{"version":3,"file":"index.DmpIOpu1.js","sources":["../../../../../../../node_modules/@babylon/ui-kit-forms/components/inputs/accommodation/variants/with-discounts/components/discount/views/desktop/index.js","../../../../../../../node_modules/@babylon/ui-kit-forms/components/inputs/accommodation/variants/with-discounts/views/desktop/index.js"],"sourcesContent":["import { jsxs, jsx } from 'react/jsx-runtime';\nimport { DiscountWrapper, DiscountBody, ContainerSelect, DiscountSelect } from './styled.js';\n\nconst DiscountDesktop = ({ title, discount, resident, discounts, residents })=>{\n const discountLength = discounts && discounts.items?.length && discounts.items.length > 1;\n const residentsLength = residents && residents.items?.length && residents.items.length > 1;\n if (!discountLength && !residentsLength) return null;\n return /*#__PURE__*/ jsxs(DiscountWrapper, {\n \"data-testid\": \"Discount\",\n children: [\n /*#__PURE__*/ jsx(\"p\", {\n children: title\n }),\n /*#__PURE__*/ jsxs(DiscountBody, {\n children: [\n discounts && discount && discounts.items?.length && discounts.items.length > 1 && /*#__PURE__*/ jsx(ContainerSelect, {\n children: /*#__PURE__*/ jsx(DiscountSelect, {\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 })\n }),\n residents && resident && residents.items?.length && residents.items.length > 1 && /*#__PURE__*/ jsx(ContainerSelect, {\n children: /*#__PURE__*/ jsx(DiscountSelect, {\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 })\n })\n ]\n })\n ]\n });\n};\n\nexport { DiscountDesktop as default };\n","import { jsxs, jsx, Fragment } from 'react/jsx-runtime';\nimport PanelAccommodationDesktop from '../../../../components/panel-accommodation/views/desktop/index.js';\nimport InputPanelDesktop from '../../../../../../others/input-panel/views/desktop/index.js';\nimport { forwardRef, useMemo } from 'react';\nimport AddRoom from '../../../../components/add-room/index.js';\nimport PanelErrorDesktop from '../../../../components/panel-accommodation/components/panel-error/views/desktop/index.js';\nimport useAccommodation from '../../../../hooks/useAccommodation.js';\nimport useFormAccommodationWithDiscounts from '../../../../hooks/useFormAccommodationWithDiscounts.js';\nimport DiscountDesktop from '../../components/discount/views/desktop/index.js';\nimport { Header, InputPanelFooter, AccomodationWithDiscounts } from './styled.js';\n\nconst AccommodationWithDiscountsDesktop = /*#__PURE__*/ forwardRef((props, ref)=>{\n const { literals, discount, discounts, resident, residents, tooltipOptions, disableAges = false } = props;\n const { addRoom = '', accommodationTitle = '', discountTitle = '', accommodationLabel = '' } = literals ?? {};\n const { inputProps, panelRooms, config, people, goToLast, hasError, error, onAddRoom, onChangeRooms, renderFooter } = useAccommodation(props);\n const hasDiscounts = !!(discount && discounts) || !!(resident && residents);\n const headerTitle = accommodationTitle || accommodationLabel;\n const panel = useMemo(()=>({\n header: /*#__PURE__*/ jsxs(Header, {\n children: [\n headerTitle && /*#__PURE__*/ jsx(\"p\", {\n children: headerTitle\n }),\n /*#__PURE__*/ jsx(AddRoom, {\n addRoom: addRoom,\n onAddRoom: onAddRoom,\n hasError: hasError\n })\n ]\n }),\n content: /*#__PURE__*/ jsx(PanelAccommodationDesktop, {\n config: config,\n onChange: onChangeRooms,\n people: people,\n rooms: panelRooms,\n error: error,\n goToLast: goToLast,\n disableAges: disableAges\n }),\n footer: (renderProps)=>/*#__PURE__*/ jsxs(Fragment, {\n children: [\n (hasDiscounts || error) && /*#__PURE__*/ jsxs(InputPanelFooter, {\n children: [\n error && /*#__PURE__*/ jsx(PanelErrorDesktop, {\n error: error\n }),\n hasDiscounts && /*#__PURE__*/ jsx(DiscountDesktop, {\n title: discountTitle,\n discount: discount,\n resident: resident,\n discounts: discounts,\n residents: residents\n })\n ]\n }),\n literals?.accept ? renderFooter(renderProps) : undefined\n ]\n })\n }), [\n addRoom,\n config,\n disableAges,\n discount,\n discountTitle,\n discounts,\n error,\n goToLast,\n hasDiscounts,\n hasError,\n headerTitle,\n literals?.accept,\n onAddRoom,\n onChangeRooms,\n panelRooms,\n people,\n renderFooter,\n resident,\n residents\n ]);\n const tooltipProps = useMemo(()=>({\n options: tooltipOptions\n }), [\n tooltipOptions\n ]);\n return /*#__PURE__*/ jsx(AccomodationWithDiscounts, {\n \"data-testid\": \"AccommodationWithDiscounts\",\n children: /*#__PURE__*/ jsx(InputPanelDesktop, {\n ref: ref,\n inputProps: inputProps,\n footerVariant: \"noStyle\",\n panel: panel,\n tooltipProps: tooltipProps\n })\n });\n});\nAccommodationWithDiscountsDesktop.displayName = 'AccommodationWithDiscountsDesktop';\nconst FormAccommodationWithDiscountsDesktop = (props)=>{\n const finalProps = useFormAccommodationWithDiscounts(props);\n return /*#__PURE__*/ jsx(AccommodationWithDiscountsDesktop, {\n ...finalProps\n });\n};\n\nexport { FormAccommodationWithDiscountsDesktop, AccommodationWithDiscountsDesktop as default };\n"],"names":["DiscountDesktop","title","discount","resident","discounts","residents","discountLength","_a","residentsLength","_b","jsxs","DiscountWrapper","jsx","DiscountBody","_c","ContainerSelect","DiscountSelect","_d","AccommodationWithDiscountsDesktop","forwardRef","props","ref","literals","tooltipOptions","disableAges","addRoom","accommodationTitle","discountTitle","accommodationLabel","inputProps","panelRooms","config","people","goToLast","hasError","error","onAddRoom","onChangeRooms","renderFooter","useAccommodation","hasDiscounts","headerTitle","panel","useMemo","Header","AddRoom","PanelAccommodationDesktop","renderProps","Fragment","InputPanelFooter","PanelErrorDesktop","tooltipProps","AccomodationWithDiscounts","InputPanelDesktop","FormAccommodationWithDiscountsDesktop","finalProps","useFormAccommodationWithDiscounts"],"mappings":"mNAGA,MAAMA,EAAkB,CAAC,CAAE,MAAAC,EAAO,SAAAC,EAAU,SAAAC,EAAU,UAAAC,EAAW,UAAAC,KAAc,aAC3E,MAAMC,EAAiBF,KAAaG,EAAAH,EAAU,QAAV,YAAAG,EAAiB,SAAUH,EAAU,MAAM,OAAS,EAClFI,EAAkBH,KAAaI,EAAAJ,EAAU,QAAV,YAAAI,EAAiB,SAAUJ,EAAU,MAAM,OAAS,EACzF,MAAI,CAACC,GAAkB,CAACE,EA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