{"version":3,"file":"index.D7qmQBWd.js","sources":["../../../../../../../node_modules/@babylon/ui-kit-forms/components/inputs/accommodation/variants/with-discounts/components/discount/views/mobile/styled.js","../../../../../../../node_modules/@babylon/ui-kit-forms/components/inputs/accommodation/variants/with-discounts/components/discount/views/mobile/index.js","../../../../../../../node_modules/@babylon/ui-kit-forms/components/inputs/accommodation/variants/with-discounts/views/mobile/hooks/useAccommodationWithDiscountsMobile.js","../../../../../../../node_modules/@babylon/ui-kit-forms/components/inputs/accommodation/variants/with-discounts/views/mobile/index.js"],"sourcesContent":["import { FontMixin } from '@babylon/ui-kit-styles/common/mixins/helpers.styled';\nimport styled from 'styled-components';\n\nconst DiscountWrapper = /*#__PURE__*/ styled.div.withConfig({\n displayName: \"DiscountWrapper\"\n})([\n `padding:16px 16px 8px;margin-top:12px;background-color:`,\n `;border-bottom:2px solid `,\n `;& > p{`,\n ` color:`,\n `;margin-bottom:8px;}`\n], ({ theme })=>theme.colors.white.base, ({ theme })=>theme.colors.primary.lighter, FontMixin({\n size: 'large',\n weight: 'medium',\n height: 'large'\n}), ({ theme })=>theme.colors.grays.darker);\nconst ContainerSelect = /*#__PURE__*/ styled.div.withConfig({\n displayName: \"ContainerSelect\"\n})([\n `& > :not(:last-child){border-bottom:1px solid `,\n `;}& .react-select__control{height:56px;padding:0px;}& .react-select__placeholder{position:static;`,\n ` color:`,\n `;}`\n], ({ theme })=>theme.colors.grays.light, FontMixin({\n size: 'base',\n weight: 'light',\n height: 'base'\n}), ({ theme })=>theme.colors.grays.dark);\n\nexport { ContainerSelect, DiscountWrapper };\n//# sourceMappingURL=styled.js.map\n","import { jsxs, jsx } from 'react/jsx-runtime';\nimport SelectMobile from '../../../../../../../select/views/mobile/index.js';\nimport { DiscountWrapper, ContainerSelect } from './styled.js';\n\nconst DiscountMobile = ({ title, discount, resident, discounts, residents })=>/*#__PURE__*/ jsxs(DiscountWrapper, {\n \"data-testid\": \"DiscountMobile\",\n children: [\n /*#__PURE__*/ jsx(\"p\", {\n children: title\n }),\n /*#__PURE__*/ jsxs(ContainerSelect, {\n children: [\n discounts && discount && discounts.items?.length && discounts.items.length > 1 && /*#__PURE__*/ jsx(SelectMobile, {\n ref: discount.ref,\n onBlur: discount.onBlur,\n value: discount.value,\n onChange: discount.onChange,\n placeholder: discounts.label,\n options: discounts.items,\n enableSearch: false,\n variant: \"horizontal\",\n menuVariant: \"floating\"\n }),\n residents && resident && residents.items?.length && residents.items.length > 1 && /*#__PURE__*/ jsx(SelectMobile, {\n ref: resident.ref,\n onBlur: resident.onBlur,\n value: resident.value,\n onChange: resident.onChange,\n placeholder: residents.label,\n options: residents.items,\n variant: \"horizontal\",\n enableSearch: false,\n menuVariant: \"floating\"\n })\n ]\n })\n ]\n });\n\nexport { DiscountMobile as default };\n//# sourceMappingURL=index.js.map\n","import useAccommodationMobile from '../../../../../hooks/useAccommodationMobile.js';\nimport { useState, useEffect, useCallback } from 'react';\n\nconst useAccommodationWithDiscountsMobile = (props)=>{\n const { value, discount, resident } = props;\n const { inputProps, isOpen, config, people, panelRooms, hasError, error, goToLast, onChangeRooms, onAddRoom, onAccept, setIsOpen } = useAccommodationMobile(props);\n const [tempDiscount, setTempDiscount] = useState(discount?.value);\n const [tempResident, setTempResident] = useState(resident?.value);\n useEffect(()=>{\n if (!isOpen) {\n setTempDiscount(discount?.value);\n setTempResident(resident?.value);\n }\n }, [\n discount?.value,\n error,\n isOpen,\n resident?.value,\n value\n ]);\n const onAcceptWithDiscounts = useCallback((close)=>()=>{\n discount?.onChange?.(tempDiscount, {\n action: 'select-option',\n option: tempDiscount\n });\n resident?.onChange?.(tempResident, {\n action: 'select-option',\n option: tempResident\n });\n onAccept(close)();\n }, [\n discount,\n onAccept,\n resident,\n tempDiscount,\n tempResident\n ]);\n return {\n inputProps,\n isOpen,\n config,\n people,\n panelRooms,\n tempDiscount,\n tempResident,\n hasError,\n error,\n goToLast,\n onAccept: onAcceptWithDiscounts,\n setIsOpen,\n onChangeRooms,\n onAddRoom,\n setTempDiscount,\n setTempResident\n };\n};\n\nexport { useAccommodationWithDiscountsMobile as default };\n//# sourceMappingURL=useAccommodationWithDiscountsMobile.js.map\n","import { jsx, jsxs } from 'react/jsx-runtime';\nimport { ButtonPanel } from '@babylon/ui-kit-base/components/buttons/button';\nimport PanelAccommodationMobile from '../../../../components/panel-accommodation/views/mobile/index.js';\nimport InputPanelMobile from '../../../../../../others/input-panel/views/mobile/index.js';\nimport { forwardRef, useCallback, useMemo } from 'react';\nimport AddRoom from '../../../../components/add-room/index.js';\nimport PanelErrorMobile from '../../../../components/panel-accommodation/components/panel-error/views/mobile/index.js';\nimport useFormAccommodationWithDiscounts from '../../../../hooks/useFormAccommodationWithDiscounts.js';\nimport DiscountMobile from '../../components/discount/views/mobile/index.js';\nimport useAccommodationWithDiscountsMobile from './hooks/useAccommodationWithDiscountsMobile.js';\nimport { AccommodationPanelWrapper, AccommodationPanelContent, AccommodationPanelFooter } from '../../../simple/views/mobile/styled.js';\n\nconst AccommodationWithDiscountsMobile = /*#__PURE__*/ forwardRef((props, ref)=>{\n const { literals, discounts, residents, disableAges = false } = props;\n const { addRoom = '', accommodationTitle = '', accept = '', discountTitle = '', accommodationLabel = '' } = literals ?? {};\n const { inputProps, config, people, panelRooms, tempDiscount, tempResident, goToLast, hasError, error, onAccept, setIsOpen, onAddRoom, onChangeRooms, setTempDiscount, setTempResident } = useAccommodationWithDiscountsMobile(props);\n const renderFooter = useCallback(({ close })=>/*#__PURE__*/ jsx(ButtonPanel, {\n onClick: onAccept(close),\n children: accept\n }), [\n accept,\n onAccept\n ]);\n const discount = useMemo(()=>({\n value: tempDiscount,\n onChange: setTempDiscount\n }), [\n setTempDiscount,\n tempDiscount\n ]);\n const resident = useMemo(()=>({\n value: tempResident,\n onChange: setTempResident\n }), [\n setTempResident,\n tempResident\n ]);\n const panel = useMemo(()=>({\n beforeContent: error && /*#__PURE__*/ jsx(PanelErrorMobile, {\n error: error\n }),\n content: /*#__PURE__*/ jsx(AccommodationPanelWrapper, {\n \"data-testid\": \"AccommodationPanel\",\n children: /*#__PURE__*/ jsxs(AccommodationPanelContent, {\n children: [\n /*#__PURE__*/ jsx(PanelAccommodationMobile, {\n config: config,\n disableAges: disableAges,\n error: error,\n goToLast: goToLast,\n onChange: onChangeRooms,\n people: people,\n rooms: panelRooms\n }),\n /*#__PURE__*/ jsx(AccommodationPanelFooter, {\n children: /*#__PURE__*/ jsx(AddRoom, {\n addRoom: addRoom,\n onAddRoom: onAddRoom,\n hasError: hasError\n })\n }),\n discounts && /*#__PURE__*/ jsx(AccommodationPanelFooter, {\n children: /*#__PURE__*/ jsx(DiscountMobile, {\n discount: discount,\n discounts: discounts,\n resident: resident,\n residents: residents,\n title: discountTitle\n })\n })\n ]\n })\n }),\n header: accommodationTitle || accommodationLabel,\n onChange: setIsOpen,\n footer: renderFooter\n }), [\n accommodationLabel,\n accommodationTitle,\n addRoom,\n config,\n disableAges,\n discount,\n discountTitle,\n discounts,\n error,\n goToLast,\n hasError,\n onAddRoom,\n onChangeRooms,\n panelRooms,\n people,\n renderFooter,\n resident,\n residents,\n setIsOpen\n ]);\n const modalProps = useMemo(()=>({\n color: 'primary'\n }), []);\n return /*#__PURE__*/ jsx(\"div\", {\n \"data-testid\": \"AccommodationWithDiscounts\",\n children: /*#__PURE__*/ jsx(InputPanelMobile, {\n ref: ref,\n inputProps: inputProps,\n panel: panel,\n modalProps: modalProps\n })\n });\n});\nAccommodationWithDiscountsMobile.displayName = 'AccommodationWithDiscountsMobile';\nconst FormAccommodationWithDiscountsMobile = (props)=>{\n const finalProps = useFormAccommodationWithDiscounts(props);\n return /*#__PURE__*/ jsx(AccommodationWithDiscountsMobile, {\n ...finalProps\n });\n};\n\nexport { FormAccommodationWithDiscountsMobile, AccommodationWithDiscountsMobile as default };\n//# sourceMappingURL=index.js.map\n"],"names":["DiscountWrapper","styled","theme","FontMixin","ContainerSelect","DiscountMobile","title","discount","resident","discounts","residents","jsxs","jsx","_a","SelectMobile","_b","useAccommodationWithDiscountsMobile","props","value","inputProps","isOpen","config","people","panelRooms","hasError","error","goToLast","onChangeRooms","onAddRoom","onAccept","setIsOpen","useAccommodationMobile","tempDiscount","setTempDiscount","useState","tempResident","setTempResident","useEffect","onAcceptWithDiscounts","useCallback","close","AccommodationWithDiscountsMobile","forwardRef","ref","literals","disableAges","addRoom","accommodationTitle","accept","discountTitle","accommodationLabel","renderFooter","ButtonPanel","useMemo","panel","PanelErrorMobile","AccommodationPanelWrapper","AccommodationPanelContent","PanelAccommodationMobile","AccommodationPanelFooter","AddRoom","modalProps","InputPanelMobile","FormAccommodationWithDiscountsMobile","finalProps","useFormAccommodationWithDiscounts"],"mappings":"iNAGA,MAAMA,EAAgCC,EAAO,IAAI,WAAW,CACxD,YAAa,iBACjB,CAAC,EAAE,CACC,0DACA,4BACA,UACA,UACA,sBACJ,EAAG,CAAC,CAAE,MAAAC,CAAO,IAAGA,EAAM,OAAO,MAAM,KAAM,CAAC,CAAE,MAAAA,CAAK,IAAKA,EAAM,OAAO,QAAQ,QAASC,EAAU,CAC1F,KAAM,QACN,OAAQ,SACR,OAAQ,OACZ,CAAC,EAAG,CAAC,CAAE,MAAAD,CAAO,IAAGA,EAAM,OAAO,MAAM,MAAM,EACpCE,EAAgCH,EAAO,IAAI,WAAW,CACxD,YAAa,iBACjB,CAAC,EAAE,CACC,iDACA,oGACA,UACA,IACJ,EAAG,CAAC,CAAE,MAAAC,KAAUA,EAAM,OAAO,MAAM,MAAOC,EAAU,CAChD,KAAM,OACN,OAAQ,QACR,OAAQ,MACZ,CAAC,EAAG,CAAC,CAAE,MAAAD,CAAO,IAAGA,EAAM,OAAO,MAAM,IAAI,ECvBlCG,EAAiB,CAAC,CAAE,MAAAC,EAAO,SAAAC,EAAU,SAAAC,EAAU,UAAAC,EAAW,UAAAC,CAAS,aAAmBC,OAAAA,EAAI,KAACX,EAAiB,CAC1G,cAAe,iBACf,SAAU,CACQY,EAAAA,IAAI,IAAK,CACnB,SAAUN,CAC1B,CAA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