{"version":3,"file":"index.I9l79Daj.js","sources":["../../../../../../../node_modules/@babylon/ui-kit-forms/esm/components/inputs/accommodation/variants/with-discounts/components/discount/views/mobile/styled.mjs","../../../../../../../node_modules/@babylon/ui-kit-forms/esm/components/inputs/accommodation/variants/with-discounts/components/discount/views/mobile/index.mjs","../../../../../../../node_modules/@babylon/ui-kit-forms/esm/components/inputs/accommodation/variants/with-discounts/views/mobile/hooks/useAccommodationWithDiscountsMobile.mjs","../../../../../../../node_modules/@babylon/ui-kit-forms/esm/components/inputs/accommodation/variants/with-discounts/views/mobile/index.mjs"],"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.mjs.map\n","import { jsxs, jsx } from 'react/jsx-runtime';\nimport SelectMobile from '../../../../../../../select/views/mobile/index.mjs';\nimport { DiscountWrapper, ContainerSelect } from './styled.mjs';\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 > 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 > 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.mjs.map\n","import useAccommodationMobile from '../../../../../hooks/useAccommodationMobile.mjs';\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.mjs.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.mjs';\nimport InputPanelMobile from '../../../../../../others/input-panel/views/mobile/index.mjs';\nimport { forwardRef, useCallback, useMemo } from 'react';\nimport AddRoom from '../../../../components/add-room/index.mjs';\nimport PanelErrorMobile from '../../../../components/panel-accommodation/components/panel-error/views/mobile/index.mjs';\nimport useFormAccommodationWithDiscounts from '../../../../hooks/useFormAccommodationWithDiscounts.mjs';\nimport DiscountMobile from '../../components/discount/views/mobile/index.mjs';\nimport useAccommodationWithDiscountsMobile from './hooks/useAccommodationWithDiscountsMobile.mjs';\nimport { AccommodationPanelWrapper, AccommodationPanelContent, AccommodationPanelFooter } from '../../../simple/views/mobile/styled.mjs';\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.mjs.map\n"],"names":["DiscountWrapper","styled","theme","FontMixin","ContainerSelect","DiscountMobile","title","discount","resident","discounts","residents","jsxs","jsx","SelectMobile","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","_a","_b","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,IAAmBC,EAAI,KAACX,EAAiB,CAC1G,cAAe,iBACf,SAAU,CACQY,EAAAA,IAAI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