lkd-web-kit 0.0.19 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +98 -1
- package/dist/lkd-web-kit.css +1 -0
- package/dist/src/components/EmptyState/index.cjs +2 -0
- package/dist/src/components/EmptyState/index.cjs.map +1 -0
- package/dist/{components → src/components}/EmptyState/index.mjs +13 -13
- package/dist/src/components/EmptyState/index.mjs.map +1 -0
- package/dist/src/components/Icon.cjs.map +1 -0
- package/dist/src/components/Icon.mjs.map +1 -0
- package/dist/src/components/InfinityLoader/index.cjs.map +1 -0
- package/dist/src/components/InfinityLoader/index.mjs.map +1 -0
- package/dist/src/components/MyDatePickerInput/CalendarIcon.cjs +2 -0
- package/dist/src/components/MyDatePickerInput/CalendarIcon.cjs.map +1 -0
- package/dist/src/components/MyDatePickerInput/CalendarIcon.mjs +62 -0
- package/dist/src/components/MyDatePickerInput/CalendarIcon.mjs.map +1 -0
- package/dist/src/components/MyDatePickerInput/index.cjs +2 -0
- package/dist/src/components/MyDatePickerInput/index.cjs.map +1 -0
- package/dist/src/components/MyDatePickerInput/index.mjs +15 -0
- package/dist/src/components/MyDatePickerInput/index.mjs.map +1 -0
- package/dist/src/components/MyDateTimePicker/index.cjs +2 -0
- package/dist/src/components/MyDateTimePicker/index.cjs.map +1 -0
- package/dist/src/components/MyDateTimePicker/index.mjs +15 -0
- package/dist/src/components/MyDateTimePicker/index.mjs.map +1 -0
- package/dist/src/components/MyNotifications/index.cjs +2 -0
- package/dist/src/components/MyNotifications/index.cjs.map +1 -0
- package/dist/src/components/MyNotifications/index.mjs +14 -0
- package/dist/src/components/MyNotifications/index.mjs.map +1 -0
- package/dist/src/components/MyNumberInput/index.cjs +2 -0
- package/dist/src/components/MyNumberInput/index.cjs.map +1 -0
- package/dist/src/components/MyNumberInput/index.mjs +13 -0
- package/dist/src/components/MyNumberInput/index.mjs.map +1 -0
- package/dist/src/components/MySelect/index.cjs +2 -0
- package/dist/src/components/MySelect/index.cjs.map +1 -0
- package/dist/src/components/MySelect/index.mjs +13 -0
- package/dist/src/components/MySelect/index.mjs.map +1 -0
- package/dist/src/components/MyTextInput/index.cjs +2 -0
- package/dist/src/components/MyTextInput/index.cjs.map +1 -0
- package/dist/src/components/MyTextInput/index.mjs +13 -0
- package/dist/src/components/MyTextInput/index.mjs.map +1 -0
- package/dist/src/components/MyTextarea/index.cjs +2 -0
- package/dist/src/components/MyTextarea/index.cjs.map +1 -0
- package/dist/src/components/MyTextarea/index.mjs +13 -0
- package/dist/src/components/MyTextarea/index.mjs.map +1 -0
- package/dist/src/components/MyTimeInput/index.cjs +2 -0
- package/dist/src/components/MyTimeInput/index.cjs.map +1 -0
- package/dist/src/components/MyTimeInput/index.mjs +13 -0
- package/dist/src/components/MyTimeInput/index.mjs.map +1 -0
- package/dist/src/components/NavItems.cjs.map +1 -0
- package/dist/src/components/NavItems.mjs.map +1 -0
- package/dist/src/components/SelectInfinity/index.cjs.map +1 -0
- package/dist/src/components/SelectInfinity/index.mjs.map +1 -0
- package/dist/src/consts/http-status.cjs.map +1 -0
- package/dist/src/consts/http-status.mjs.map +1 -0
- package/dist/src/consts/revalidate.cjs.map +1 -0
- package/dist/src/consts/revalidate.mjs.map +1 -0
- package/dist/src/contexts/NavigationHistoryContext/index.cjs.map +1 -0
- package/dist/{contexts → src/contexts}/NavigationHistoryContext/index.mjs +4 -4
- package/dist/src/contexts/NavigationHistoryContext/index.mjs.map +1 -0
- package/dist/src/contexts/PageDataContext/index.cjs.map +1 -0
- package/dist/src/contexts/PageDataContext/index.mjs.map +1 -0
- package/dist/src/form/Form.cjs.map +1 -0
- package/dist/src/form/Form.mjs.map +1 -0
- package/dist/src/form/FormButtonSubmit.cjs.map +1 -0
- package/dist/src/form/FormButtonSubmit.mjs.map +1 -0
- package/dist/src/form/base/FormCheckbox.cjs +2 -0
- package/dist/src/form/base/FormCheckbox.cjs.map +1 -0
- package/dist/src/form/base/FormCheckbox.mjs +15 -0
- package/dist/src/form/base/FormCheckbox.mjs.map +1 -0
- package/dist/src/form/base/FormDatePickerInput.cjs +2 -0
- package/dist/src/form/base/FormDatePickerInput.cjs.map +1 -0
- package/dist/src/form/base/FormDatePickerInput.mjs +14 -0
- package/dist/src/form/base/FormDatePickerInput.mjs.map +1 -0
- package/dist/src/form/base/FormDateTimePicker.cjs +2 -0
- package/dist/src/form/base/FormDateTimePicker.cjs.map +1 -0
- package/dist/src/form/base/FormDateTimePicker.mjs +14 -0
- package/dist/src/form/base/FormDateTimePicker.mjs.map +1 -0
- package/dist/src/form/base/FormNumberInput.cjs +2 -0
- package/dist/src/form/base/FormNumberInput.cjs.map +1 -0
- package/dist/src/form/base/FormNumberInput.mjs +14 -0
- package/dist/src/form/base/FormNumberInput.mjs.map +1 -0
- package/dist/src/form/base/FormRadioGroup.cjs +2 -0
- package/dist/src/form/base/FormRadioGroup.cjs.map +1 -0
- package/dist/src/form/base/FormRadioGroup.mjs +14 -0
- package/dist/src/form/base/FormRadioGroup.mjs.map +1 -0
- package/dist/src/form/base/FormSelect.cjs +2 -0
- package/dist/src/form/base/FormSelect.cjs.map +1 -0
- package/dist/src/form/base/FormSelect.mjs +14 -0
- package/dist/src/form/base/FormSelect.mjs.map +1 -0
- package/dist/src/form/base/FormSelectInfinity.cjs +2 -0
- package/dist/src/form/base/FormSelectInfinity.cjs.map +1 -0
- package/dist/src/form/base/FormSelectInfinity.mjs +14 -0
- package/dist/src/form/base/FormSelectInfinity.mjs.map +1 -0
- package/dist/src/form/base/FormTextArea.cjs +2 -0
- package/dist/src/form/base/FormTextArea.cjs.map +1 -0
- package/dist/src/form/base/FormTextArea.mjs +14 -0
- package/dist/src/form/base/FormTextArea.mjs.map +1 -0
- package/dist/src/form/base/FormTextInput.cjs +2 -0
- package/dist/src/form/base/FormTextInput.cjs.map +1 -0
- package/dist/src/form/base/FormTextInput.mjs +14 -0
- package/dist/src/form/base/FormTextInput.mjs.map +1 -0
- package/dist/src/form/base/FormTimeInput.cjs +2 -0
- package/dist/src/form/base/FormTimeInput.cjs.map +1 -0
- package/dist/src/form/base/FormTimeInput.mjs +22 -0
- package/dist/src/form/base/FormTimeInput.mjs.map +1 -0
- package/dist/src/form/utils/nullableInput.cjs.map +1 -0
- package/dist/src/form/utils/nullableInput.mjs.map +1 -0
- package/dist/src/form/utils/zodValidator.cjs.map +1 -0
- package/dist/src/form/utils/zodValidator.mjs.map +1 -0
- package/dist/src/hocs/withForm.cjs +2 -0
- package/dist/src/hocs/withForm.cjs.map +1 -0
- package/dist/{hocs → src/hocs}/withForm.mjs +12 -14
- package/dist/src/hocs/withForm.mjs.map +1 -0
- package/dist/src/hocs/withModalManager.cjs.map +1 -0
- package/dist/src/hocs/withModalManager.mjs.map +1 -0
- package/dist/src/hooks/useBreakpoint.cjs.map +1 -0
- package/dist/src/hooks/useBreakpoint.mjs.map +1 -0
- package/dist/src/hooks/useFetchNextPageOnScroll.cjs.map +1 -0
- package/dist/src/hooks/useFetchNextPageOnScroll.mjs.map +1 -0
- package/dist/src/hooks/useOnScrollProgress.cjs.map +1 -0
- package/dist/src/hooks/useOnScrollProgress.mjs.map +1 -0
- package/dist/src/hooks/useUpdateSearchParams.cjs.map +1 -0
- package/dist/src/hooks/useUpdateSearchParams.mjs.map +1 -0
- package/dist/src/index.cjs +2 -0
- package/dist/src/index.mjs +103 -0
- package/dist/src/index.mjs.map +1 -0
- package/dist/{mantine/breakpointsWithPx.cjs → src/mantine/breakpoints-with-px.cjs} +1 -1
- package/dist/src/mantine/breakpoints-with-px.cjs.map +1 -0
- package/dist/{mantine/breakpointsWithPx.mjs → src/mantine/breakpoints-with-px.mjs} +1 -1
- package/dist/src/mantine/breakpoints-with-px.mjs.map +1 -0
- package/dist/src/mantine/my-default-theme.cjs +2 -0
- package/dist/src/mantine/my-default-theme.cjs.map +1 -0
- package/dist/src/mantine/my-default-theme.mjs +38 -0
- package/dist/src/mantine/my-default-theme.mjs.map +1 -0
- package/dist/{mantine/toTailwindColors.cjs → src/mantine/to-tailwind-colors.cjs} +1 -1
- package/dist/src/mantine/to-tailwind-colors.cjs.map +1 -0
- package/dist/{mantine/toTailwindColors.mjs → src/mantine/to-tailwind-colors.mjs} +1 -1
- package/dist/src/mantine/to-tailwind-colors.mjs.map +1 -0
- package/dist/src/utils/array/groupBy.cjs.map +1 -0
- package/dist/src/utils/array/groupBy.mjs.map +1 -0
- package/dist/src/utils/array/shuffleArray.cjs.map +1 -0
- package/dist/src/utils/array/shuffleArray.mjs.map +1 -0
- package/dist/src/utils/formatBytes.cjs.map +1 -0
- package/dist/src/utils/formatBytes.mjs.map +1 -0
- package/dist/src/utils/isInfinityEmpty.cjs.map +1 -0
- package/dist/src/utils/isInfinityEmpty.mjs.map +1 -0
- package/dist/src/utils/ky/addBodyJsonHook.cjs.map +1 -0
- package/dist/src/utils/ky/addBodyJsonHook.mjs.map +1 -0
- package/dist/src/utils/ky/parseJson.cjs.map +1 -0
- package/dist/src/utils/ky/parseJson.mjs.map +1 -0
- package/dist/src/utils/newHref.cjs.map +1 -0
- package/dist/src/utils/newHref.mjs.map +1 -0
- package/package.json +10 -5
- package/dist/components/EmptyState/index.cjs +0 -2
- package/dist/components/EmptyState/index.cjs.map +0 -1
- package/dist/components/EmptyState/index.mjs.map +0 -1
- package/dist/components/Icon.cjs.map +0 -1
- package/dist/components/Icon.mjs.map +0 -1
- package/dist/components/InfinityLoader/index.cjs.map +0 -1
- package/dist/components/InfinityLoader/index.mjs.map +0 -1
- package/dist/components/NavItems.cjs.map +0 -1
- package/dist/components/NavItems.mjs.map +0 -1
- package/dist/components/SelectInfinity/index.cjs.map +0 -1
- package/dist/components/SelectInfinity/index.mjs.map +0 -1
- package/dist/consts/http-status.cjs.map +0 -1
- package/dist/consts/http-status.mjs.map +0 -1
- package/dist/consts/revalidate.cjs.map +0 -1
- package/dist/consts/revalidate.mjs.map +0 -1
- package/dist/contexts/NavigationHistoryContext/index.cjs.map +0 -1
- package/dist/contexts/NavigationHistoryContext/index.mjs.map +0 -1
- package/dist/contexts/PageDataContext/index.cjs.map +0 -1
- package/dist/contexts/PageDataContext/index.mjs.map +0 -1
- package/dist/form/Form.cjs.map +0 -1
- package/dist/form/Form.mjs.map +0 -1
- package/dist/form/FormButtonSubmit.cjs.map +0 -1
- package/dist/form/FormButtonSubmit.mjs.map +0 -1
- package/dist/form/utils/nullableInput.cjs.map +0 -1
- package/dist/form/utils/nullableInput.mjs.map +0 -1
- package/dist/form/utils/zodValidator.cjs.map +0 -1
- package/dist/form/utils/zodValidator.mjs.map +0 -1
- package/dist/hocs/withForm.cjs +0 -2
- package/dist/hocs/withForm.cjs.map +0 -1
- package/dist/hocs/withForm.mjs.map +0 -1
- package/dist/hocs/withModalManager.cjs.map +0 -1
- package/dist/hocs/withModalManager.mjs.map +0 -1
- package/dist/hooks/useBreakpoint.cjs.map +0 -1
- package/dist/hooks/useBreakpoint.mjs.map +0 -1
- package/dist/hooks/useFetchNextPageOnScroll.cjs.map +0 -1
- package/dist/hooks/useFetchNextPageOnScroll.mjs.map +0 -1
- package/dist/hooks/useOnScrollProgress.cjs.map +0 -1
- package/dist/hooks/useOnScrollProgress.mjs.map +0 -1
- package/dist/hooks/useUpdateSearchParams.cjs.map +0 -1
- package/dist/hooks/useUpdateSearchParams.mjs.map +0 -1
- package/dist/index.cjs +0 -2
- package/dist/index.mjs +0 -63
- package/dist/index.mjs.map +0 -1
- package/dist/mantine/breakpointsWithPx.cjs.map +0 -1
- package/dist/mantine/breakpointsWithPx.mjs.map +0 -1
- package/dist/mantine/toTailwindColors.cjs.map +0 -1
- package/dist/mantine/toTailwindColors.mjs.map +0 -1
- package/dist/utils/array/groupBy.cjs.map +0 -1
- package/dist/utils/array/groupBy.mjs.map +0 -1
- package/dist/utils/array/shuffleArray.cjs.map +0 -1
- package/dist/utils/array/shuffleArray.mjs.map +0 -1
- package/dist/utils/formatBytes.cjs.map +0 -1
- package/dist/utils/formatBytes.mjs.map +0 -1
- package/dist/utils/isInfinityEmpty.cjs.map +0 -1
- package/dist/utils/isInfinityEmpty.mjs.map +0 -1
- package/dist/utils/ky/addBodyJsonHook.cjs.map +0 -1
- package/dist/utils/ky/addBodyJsonHook.mjs.map +0 -1
- package/dist/utils/ky/parseJson.cjs.map +0 -1
- package/dist/utils/ky/parseJson.mjs.map +0 -1
- package/dist/utils/newHref.cjs.map +0 -1
- package/dist/utils/newHref.mjs.map +0 -1
- /package/dist/{components → src/components}/Icon.cjs +0 -0
- /package/dist/{components → src/components}/Icon.mjs +0 -0
- /package/dist/{components → src/components}/InfinityLoader/index.cjs +0 -0
- /package/dist/{components → src/components}/InfinityLoader/index.mjs +0 -0
- /package/dist/{components → src/components}/NavItems.cjs +0 -0
- /package/dist/{components → src/components}/NavItems.mjs +0 -0
- /package/dist/{components → src/components}/SelectInfinity/index.cjs +0 -0
- /package/dist/{components → src/components}/SelectInfinity/index.mjs +0 -0
- /package/dist/{consts → src/consts}/http-status.cjs +0 -0
- /package/dist/{consts → src/consts}/http-status.mjs +0 -0
- /package/dist/{consts → src/consts}/revalidate.cjs +0 -0
- /package/dist/{consts → src/consts}/revalidate.mjs +0 -0
- /package/dist/{contexts → src/contexts}/NavigationHistoryContext/index.cjs +0 -0
- /package/dist/{contexts → src/contexts}/PageDataContext/index.cjs +0 -0
- /package/dist/{contexts → src/contexts}/PageDataContext/index.mjs +0 -0
- /package/dist/{form → src/form}/Form.cjs +0 -0
- /package/dist/{form → src/form}/Form.mjs +0 -0
- /package/dist/{form → src/form}/FormButtonSubmit.cjs +0 -0
- /package/dist/{form → src/form}/FormButtonSubmit.mjs +0 -0
- /package/dist/{form → src/form}/utils/nullableInput.cjs +0 -0
- /package/dist/{form → src/form}/utils/nullableInput.mjs +0 -0
- /package/dist/{form → src/form}/utils/zodValidator.cjs +0 -0
- /package/dist/{form → src/form}/utils/zodValidator.mjs +0 -0
- /package/dist/{hocs → src/hocs}/withModalManager.cjs +0 -0
- /package/dist/{hocs → src/hocs}/withModalManager.mjs +0 -0
- /package/dist/{hooks → src/hooks}/useBreakpoint.cjs +0 -0
- /package/dist/{hooks → src/hooks}/useBreakpoint.mjs +0 -0
- /package/dist/{hooks → src/hooks}/useFetchNextPageOnScroll.cjs +0 -0
- /package/dist/{hooks → src/hooks}/useFetchNextPageOnScroll.mjs +0 -0
- /package/dist/{hooks → src/hooks}/useOnScrollProgress.cjs +0 -0
- /package/dist/{hooks → src/hooks}/useOnScrollProgress.mjs +0 -0
- /package/dist/{hooks → src/hooks}/useUpdateSearchParams.cjs +0 -0
- /package/dist/{hooks → src/hooks}/useUpdateSearchParams.mjs +0 -0
- /package/dist/{index.cjs.map → src/index.cjs.map} +0 -0
- /package/dist/{utils → src/utils}/array/groupBy.cjs +0 -0
- /package/dist/{utils → src/utils}/array/groupBy.mjs +0 -0
- /package/dist/{utils → src/utils}/array/shuffleArray.cjs +0 -0
- /package/dist/{utils → src/utils}/array/shuffleArray.mjs +0 -0
- /package/dist/{utils → src/utils}/formatBytes.cjs +0 -0
- /package/dist/{utils → src/utils}/formatBytes.mjs +0 -0
- /package/dist/{utils → src/utils}/isInfinityEmpty.cjs +0 -0
- /package/dist/{utils → src/utils}/isInfinityEmpty.mjs +0 -0
- /package/dist/{utils → src/utils}/ky/addBodyJsonHook.cjs +0 -0
- /package/dist/{utils → src/utils}/ky/addBodyJsonHook.mjs +0 -0
- /package/dist/{utils → src/utils}/ky/parseJson.cjs +0 -0
- /package/dist/{utils → src/utils}/ky/parseJson.mjs +0 -0
- /package/dist/{utils → src/utils}/newHref.cjs +0 -0
- /package/dist/{utils → src/utils}/newHref.mjs +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/SelectInfinity/index.tsx"],"sourcesContent":["'use client';\r\nimport {\r\n Combobox,\r\n ComboboxItem,\r\n ElementProps,\r\n Input,\r\n InputBase,\r\n InputBaseProps,\r\n ScrollArea,\r\n useCombobox,\r\n} from '@mantine/core';\r\nimport { InfiniteData } from '@tanstack/react-query';\r\nimport { ReactNode, useRef } from 'react';\r\nimport { InfiniteQueryHookResult } from 'react-query-kit';\r\nimport { useFetchNextPageOnScroll } from '../../hooks/useFetchNextPageOnScroll';\r\nimport { InfinityLoader } from '../InfinityLoader';\r\n\r\nexport interface SelectInfinityProps\r\n extends InputBaseProps,\r\n ElementProps<'button', keyof InputBaseProps | 'value' | 'onChange'> {\r\n value?: string | null;\r\n onChange?: (value: string | null) => void;\r\n data?: ComboboxItem[];\r\n searchValue?: string;\r\n onSearchChange?: (value: string) => void;\r\n renderOption?: (args: { option: ComboboxItem }) => React.ReactNode;\r\n onOptionSubmit?: (value: string) => void;\r\n nothingFoundMessage?: ReactNode;\r\n infinity: InfiniteQueryHookResult<InfiniteData<{ data: unknown[] }, number>, Error>;\r\n placeholder?: string;\r\n}\r\n\r\nexport function SelectInfinity({\r\n value,\r\n onChange,\r\n data = [],\r\n searchValue,\r\n onSearchChange,\r\n renderOption,\r\n onOptionSubmit,\r\n nothingFoundMessage,\r\n infinity,\r\n placeholder,\r\n ...props\r\n}: SelectInfinityProps) {\r\n const combobox = useCombobox({\r\n onDropdownClose: () => {\r\n combobox.resetSelectedOption();\r\n combobox.focusTarget();\r\n onSearchChange?.('');\r\n },\r\n onDropdownOpen: () => {\r\n combobox.focusSearchInput();\r\n },\r\n });\r\n\r\n const options = data.map((i) => (\r\n <Combobox.Option\r\n value={i.value}\r\n key={i.value}\r\n >\r\n {renderOption ? renderOption({ option: i }) : i.label}\r\n </Combobox.Option>\r\n ));\r\n\r\n const selectedOption = data.find((i) => i.value === value);\r\n\r\n const scrollAreaRef = useRef<HTMLDivElement>(null);\r\n\r\n useFetchNextPageOnScroll(infinity, scrollAreaRef);\r\n\r\n return (\r\n <Combobox\r\n store={combobox}\r\n middlewares={{\r\n shift: {\r\n crossAxis: true,\r\n },\r\n }}\r\n onOptionSubmit={(val) => {\r\n onChange?.(val);\r\n onOptionSubmit?.(val);\r\n combobox.closeDropdown();\r\n }}\r\n >\r\n <Combobox.Target>\r\n <InputBase\r\n component=\"button\"\r\n type=\"button\"\r\n pointer\r\n rightSection={<Combobox.Chevron />}\r\n onClick={() => combobox.toggleDropdown()}\r\n rightSectionPointerEvents=\"none\"\r\n {...props}\r\n >\r\n {selectedOption?.label || <Input.Placeholder>{placeholder}</Input.Placeholder>}\r\n </InputBase>\r\n </Combobox.Target>\r\n <Combobox.Dropdown>\r\n <Combobox.Search\r\n value={searchValue}\r\n onChange={(event) => onSearchChange?.(event.currentTarget.value)}\r\n placeholder=\"Escribe para buscar\"\r\n />\r\n <Combobox.Options>\r\n <ScrollArea.Autosize\r\n mah={200}\r\n type=\"scroll\"\r\n viewportRef={scrollAreaRef}\r\n >\r\n {options.length > 0 ? (\r\n options\r\n ) : !infinity.isFetching ? (\r\n <Combobox.Empty\r\n onClick={() => combobox.closeDropdown()}\r\n className=\"min-h-6\"\r\n >\r\n {nothingFoundMessage ?? 'Sin resultados'}\r\n </Combobox.Empty>\r\n ) : null}\r\n <InfinityLoader\r\n className=\"text-sm\"\r\n infinity={infinity}\r\n loaderProps={{\r\n size: 'sm',\r\n className: 'mt-1 mb-2',\r\n }}\r\n />\r\n </ScrollArea.Autosize>\r\n </Combobox.Options>\r\n </Combobox.Dropdown>\r\n </Combobox>\r\n );\r\n}\r\n"],"names":["SelectInfinity","value","onChange","data","searchValue","onSearchChange","renderOption","onOptionSubmit","nothingFoundMessage","infinity","placeholder","props","combobox","useCombobox","options","i","jsx","Combobox","selectedOption","scrollAreaRef","useRef","useFetchNextPageOnScroll","jsxs","val","InputBase","Input","event","ScrollArea","InfinityLoader"],"mappings":"+QAgCO,SAASA,EAAe,CAC7B,MAAAC,EACA,SAAAC,EACA,KAAAC,EAAO,CAAC,EACR,YAAAC,EACA,eAAAC,EACA,aAAAC,EACA,eAAAC,EACA,oBAAAC,EACA,SAAAC,EACA,YAAAC,EACA,GAAGC,CACL,EAAwB,CACtB,MAAMC,EAAWC,EAAAA,YAAY,CAC3B,gBAAiB,IAAM,CACrBD,EAAS,oBAAoB,EAC7BA,EAAS,YAAY,EACrBP,IAAiB,EAAE,CACrB,EACA,eAAgB,IAAM,CACpBO,EAAS,iBAAiB,CAAA,CAC5B,CACD,EAEKE,EAAUX,EAAK,IAAKY,GACxBC,EAAA,IAACC,EAAAA,SAAS,OAAT,CACC,MAAOF,EAAE,MAGR,WAAeT,EAAa,CAAE,OAAQS,CAAE,CAAC,EAAIA,EAAE,KAAA,EAF3CA,EAAE,KAAA,CAIV,EAEKG,EAAiBf,EAAK,KAAMY,GAAMA,EAAE,QAAUd,CAAK,EAEnDkB,EAAgBC,SAAuB,IAAI,EAEjDC,OAAAA,EAAA,yBAAyBZ,EAAUU,CAAa,EAG9CG,EAAA,KAACL,EAAA,SAAA,CACC,MAAOL,EACP,YAAa,CACX,MAAO,CACL,UAAW,EAAA,CAEf,EACA,eAAiBW,GAAQ,CACvBrB,IAAWqB,CAAG,EACdhB,IAAiBgB,CAAG,EACpBX,EAAS,cAAc,CACzB,EAEA,SAAA,CAACI,EAAAA,IAAAC,EAAA,SAAS,OAAT,CACC,SAAAD,EAAA,IAACQ,EAAA,UAAA,CACC,UAAU,SACV,KAAK,SACL,QAAO,GACP,aAAcR,EAAA,IAACC,WAAS,QAAT,CAAA,CAAiB,EAChC,QAAS,IAAML,EAAS,eAAe,EACvC,0BAA0B,OACzB,GAAGD,EAEH,YAAgB,OAASK,EAAA,IAACS,EAAM,MAAA,YAAN,CAAmB,SAAYf,CAAA,CAAA,CAAA,CAAA,EAE9D,EACAY,EAAAA,KAACL,EAAS,SAAA,SAAT,CACC,SAAA,CAAAD,EAAA,IAACC,EAAAA,SAAS,OAAT,CACC,MAAOb,EACP,SAAWsB,GAAUrB,IAAiBqB,EAAM,cAAc,KAAK,EAC/D,YAAY,qBAAA,CACd,EACAV,EAAAA,IAACC,EAAS,SAAA,QAAT,CACC,SAAAK,EAAA,KAACK,EAAAA,WAAW,SAAX,CACC,IAAK,IACL,KAAK,SACL,YAAaR,EAEZ,SAAA,CAAAL,EAAQ,OAAS,EAChBA,EACGL,EAAS,WAOV,KANFO,EAAA,IAACC,EAAAA,SAAS,MAAT,CACC,QAAS,IAAML,EAAS,cAAc,EACtC,UAAU,UAET,SAAuBJ,GAAA,gBAAA,CAAA,EAG5BQ,EAAA,IAACY,EAAA,eAAA,CACC,UAAU,UACV,SAAAnB,EACA,YAAa,CACX,KAAM,KACN,UAAW,WAAA,CACb,CAAA,CACF,CAAA,CAAA,CAEJ,CAAA,CAAA,CACF,CAAA,CAAA,CAAA,CACF,CAEJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/components/SelectInfinity/index.tsx"],"sourcesContent":["'use client';\r\nimport {\r\n Combobox,\r\n ComboboxItem,\r\n ElementProps,\r\n Input,\r\n InputBase,\r\n InputBaseProps,\r\n ScrollArea,\r\n useCombobox,\r\n} from '@mantine/core';\r\nimport { InfiniteData } from '@tanstack/react-query';\r\nimport { ReactNode, useRef } from 'react';\r\nimport { InfiniteQueryHookResult } from 'react-query-kit';\r\nimport { useFetchNextPageOnScroll } from '../../hooks/useFetchNextPageOnScroll';\r\nimport { InfinityLoader } from '../InfinityLoader';\r\n\r\nexport interface SelectInfinityProps\r\n extends InputBaseProps,\r\n ElementProps<'button', keyof InputBaseProps | 'value' | 'onChange'> {\r\n value?: string | null;\r\n onChange?: (value: string | null) => void;\r\n data?: ComboboxItem[];\r\n searchValue?: string;\r\n onSearchChange?: (value: string) => void;\r\n renderOption?: (args: { option: ComboboxItem }) => React.ReactNode;\r\n onOptionSubmit?: (value: string) => void;\r\n nothingFoundMessage?: ReactNode;\r\n infinity: InfiniteQueryHookResult<InfiniteData<{ data: unknown[] }, number>, Error>;\r\n placeholder?: string;\r\n}\r\n\r\nexport function SelectInfinity({\r\n value,\r\n onChange,\r\n data = [],\r\n searchValue,\r\n onSearchChange,\r\n renderOption,\r\n onOptionSubmit,\r\n nothingFoundMessage,\r\n infinity,\r\n placeholder,\r\n ...props\r\n}: SelectInfinityProps) {\r\n const combobox = useCombobox({\r\n onDropdownClose: () => {\r\n combobox.resetSelectedOption();\r\n combobox.focusTarget();\r\n onSearchChange?.('');\r\n },\r\n onDropdownOpen: () => {\r\n combobox.focusSearchInput();\r\n },\r\n });\r\n\r\n const options = data.map((i) => (\r\n <Combobox.Option\r\n value={i.value}\r\n key={i.value}\r\n >\r\n {renderOption ? renderOption({ option: i }) : i.label}\r\n </Combobox.Option>\r\n ));\r\n\r\n const selectedOption = data.find((i) => i.value === value);\r\n\r\n const scrollAreaRef = useRef<HTMLDivElement>(null);\r\n\r\n useFetchNextPageOnScroll(infinity, scrollAreaRef);\r\n\r\n return (\r\n <Combobox\r\n store={combobox}\r\n middlewares={{\r\n shift: {\r\n crossAxis: true,\r\n },\r\n }}\r\n onOptionSubmit={(val) => {\r\n onChange?.(val);\r\n onOptionSubmit?.(val);\r\n combobox.closeDropdown();\r\n }}\r\n >\r\n <Combobox.Target>\r\n <InputBase\r\n component=\"button\"\r\n type=\"button\"\r\n pointer\r\n rightSection={<Combobox.Chevron />}\r\n onClick={() => combobox.toggleDropdown()}\r\n rightSectionPointerEvents=\"none\"\r\n {...props}\r\n >\r\n {selectedOption?.label || <Input.Placeholder>{placeholder}</Input.Placeholder>}\r\n </InputBase>\r\n </Combobox.Target>\r\n <Combobox.Dropdown>\r\n <Combobox.Search\r\n value={searchValue}\r\n onChange={(event) => onSearchChange?.(event.currentTarget.value)}\r\n placeholder=\"Escribe para buscar\"\r\n />\r\n <Combobox.Options>\r\n <ScrollArea.Autosize\r\n mah={200}\r\n type=\"scroll\"\r\n viewportRef={scrollAreaRef}\r\n >\r\n {options.length > 0 ? (\r\n options\r\n ) : !infinity.isFetching ? (\r\n <Combobox.Empty\r\n onClick={() => combobox.closeDropdown()}\r\n className=\"min-h-6\"\r\n >\r\n {nothingFoundMessage ?? 'Sin resultados'}\r\n </Combobox.Empty>\r\n ) : null}\r\n <InfinityLoader\r\n className=\"text-sm\"\r\n infinity={infinity}\r\n loaderProps={{\r\n size: 'sm',\r\n className: 'mt-1 mb-2',\r\n }}\r\n />\r\n </ScrollArea.Autosize>\r\n </Combobox.Options>\r\n </Combobox.Dropdown>\r\n </Combobox>\r\n );\r\n}\r\n"],"names":["SelectInfinity","value","onChange","data","searchValue","onSearchChange","renderOption","onOptionSubmit","nothingFoundMessage","infinity","placeholder","props","combobox","useCombobox","options","i","jsx","Combobox","selectedOption","scrollAreaRef","useRef","useFetchNextPageOnScroll","jsxs","val","InputBase","Input","event","ScrollArea","InfinityLoader"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-status.cjs","sources":["../../../src/consts/http-status.ts"],"sourcesContent":["export enum HttpStatus {\r\n Continue = 100,\r\n SwitchingProtocols = 101,\r\n Processing = 102,\r\n EarlyHints = 103,\r\n Ok = 200,\r\n Created = 201,\r\n Accepted = 202,\r\n NonAuthoritativeInformation = 203,\r\n NoContent = 204,\r\n ResetContent = 205,\r\n PartialContent = 206,\r\n MultiStatus = 207,\r\n AlreadyReported = 208,\r\n ImUsed = 226,\r\n MultipleChoices = 300,\r\n MovedPermanently = 301,\r\n Found = 302,\r\n SeeOther = 303,\r\n NotModified = 304,\r\n UseProxy = 305,\r\n TemporaryRedirect = 307,\r\n PermanentRedirect = 308,\r\n BadRequest = 400,\r\n Unauthorized = 401,\r\n PaymentRequired = 402,\r\n Forbidden = 403,\r\n NotFound = 404,\r\n MethodNotAllowed = 405,\r\n NotAcceptable = 406,\r\n ProxyAuthenticationRequired = 407,\r\n RequestTimeout = 408,\r\n Conflict = 409,\r\n Gone = 410,\r\n LengthRequired = 411,\r\n PreconditionFailed = 412,\r\n PayloadTooLarge = 413,\r\n UriTooLong = 414,\r\n UnsupportedMediaType = 415,\r\n RangeNotSatisfiable = 416,\r\n ExpectationFailed = 417,\r\n MisdirectedRequest = 421,\r\n UnprocessableEntity = 422,\r\n Locked = 423,\r\n FailedDependency = 424,\r\n TooEarly = 425,\r\n UpgradeRequired = 426,\r\n PreconditionRequired = 428,\r\n TooManyRequests = 429,\r\n RequestHeaderFieldsTooLarge = 431,\r\n UnavailableForLegalReasons = 451,\r\n InternalServerError = 500,\r\n NotImplemented = 501,\r\n BadGateway = 502,\r\n ServiceUnavailable = 503,\r\n GatewayTimeout = 504,\r\n HttpVersionNotSupported = 505,\r\n VariantAlsoNegotiates = 506,\r\n InsufficientStorage = 507,\r\n LoopDetected = 508,\r\n NotExtended = 510,\r\n NetworkAuthenticationRequired = 511,\r\n}\r\n"],"names":["HttpStatus"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-status.mjs","sources":["../../../src/consts/http-status.ts"],"sourcesContent":["export enum HttpStatus {\r\n Continue = 100,\r\n SwitchingProtocols = 101,\r\n Processing = 102,\r\n EarlyHints = 103,\r\n Ok = 200,\r\n Created = 201,\r\n Accepted = 202,\r\n NonAuthoritativeInformation = 203,\r\n NoContent = 204,\r\n ResetContent = 205,\r\n PartialContent = 206,\r\n MultiStatus = 207,\r\n AlreadyReported = 208,\r\n ImUsed = 226,\r\n MultipleChoices = 300,\r\n MovedPermanently = 301,\r\n Found = 302,\r\n SeeOther = 303,\r\n NotModified = 304,\r\n UseProxy = 305,\r\n TemporaryRedirect = 307,\r\n PermanentRedirect = 308,\r\n BadRequest = 400,\r\n Unauthorized = 401,\r\n PaymentRequired = 402,\r\n Forbidden = 403,\r\n NotFound = 404,\r\n MethodNotAllowed = 405,\r\n NotAcceptable = 406,\r\n ProxyAuthenticationRequired = 407,\r\n RequestTimeout = 408,\r\n Conflict = 409,\r\n Gone = 410,\r\n LengthRequired = 411,\r\n PreconditionFailed = 412,\r\n PayloadTooLarge = 413,\r\n UriTooLong = 414,\r\n UnsupportedMediaType = 415,\r\n RangeNotSatisfiable = 416,\r\n ExpectationFailed = 417,\r\n MisdirectedRequest = 421,\r\n UnprocessableEntity = 422,\r\n Locked = 423,\r\n FailedDependency = 424,\r\n TooEarly = 425,\r\n UpgradeRequired = 426,\r\n PreconditionRequired = 428,\r\n TooManyRequests = 429,\r\n RequestHeaderFieldsTooLarge = 431,\r\n UnavailableForLegalReasons = 451,\r\n InternalServerError = 500,\r\n NotImplemented = 501,\r\n BadGateway = 502,\r\n ServiceUnavailable = 503,\r\n GatewayTimeout = 504,\r\n HttpVersionNotSupported = 505,\r\n VariantAlsoNegotiates = 506,\r\n InsufficientStorage = 507,\r\n LoopDetected = 508,\r\n NotExtended = 510,\r\n NetworkAuthenticationRequired = 511,\r\n}\r\n"],"names":["HttpStatus"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revalidate.cjs","sources":["../../../src/consts/revalidate.ts"],"sourcesContent":["export enum Revalidate {\r\n OneHour = 3600,\r\n OneDay = 86400,\r\n OneWeek = 604800,\r\n OneMonth = 2592000,\r\n OneYear = 31536000\r\n}\r\n"],"names":["Revalidate"],"mappings":"gFAAY,IAAAA,GAAAA,IACVA,EAAAA,EAAA,QAAU,IAAV,EAAA,UACAA,EAAAA,EAAA,OAAS,KAAT,EAAA,SACAA,EAAAA,EAAA,QAAU,MAAV,EAAA,UACAA,EAAAA,EAAA,SAAW,MAAX,EAAA,WACAA,EAAAA,EAAA,QAAU,OAAV,EAAA,UALUA,IAAAA,GAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revalidate.mjs","sources":["../../../src/consts/revalidate.ts"],"sourcesContent":["export enum Revalidate {\r\n OneHour = 3600,\r\n OneDay = 86400,\r\n OneWeek = 604800,\r\n OneMonth = 2592000,\r\n OneYear = 31536000\r\n}\r\n"],"names":["Revalidate"],"mappings":"AAAY,IAAAA,sBAAAA,OACVA,EAAAA,EAAA,UAAU,IAAV,IAAA,WACAA,EAAAA,EAAA,SAAS,KAAT,IAAA,UACAA,EAAAA,EAAA,UAAU,MAAV,IAAA,WACAA,EAAAA,EAAA,WAAW,MAAX,IAAA,YACAA,EAAAA,EAAA,UAAU,OAAV,IAAA,WALUA,IAAAA,KAAA,CAAA,CAAA;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/contexts/NavigationHistoryContext/index.tsx"],"sourcesContent":["'use client';\r\nimport { usePathname, useRouter, useSearchParams } from 'next/navigation';\r\nimport { createContext, ReactNode, useContext, useEffect, useState } from 'react';\r\n\r\n// Defining types for the context value\r\ninterface NavigationHistoryContextType {\r\n history: string[];\r\n}\r\n\r\n// Creating the context with a proper type\r\nconst NavigationHistoryContext = createContext<NavigationHistoryContextType | null>(null);\r\n\r\n// Props type for the provider component\r\ninterface NavigationHistoryProviderProps {\r\n children: ReactNode;\r\n}\r\n\r\n/**\r\n * Proveedor de historial de navegación\r\n * Solo se encarga de registrar las rutas visitadas\r\n */\r\nexport function NavigationHistoryProvider({ children }: NavigationHistoryProviderProps) {\r\n const pathname = usePathname();\r\n const searchParams = useSearchParams();\r\n\r\n // Estado para almacenar el historial de navegación\r\n const [history, setHistory] = useState<string[]>([]);\r\n\r\n // Efecto para actualizar el historial cuando cambia la ruta o los parámetros\r\n useEffect(() => {\r\n // Creamos la URL completa (ruta + parámetros)\r\n const fullPath = searchParams?.size ? `${pathname}?${searchParams.toString()}` : pathname;\r\n\r\n if (fullPath) {\r\n setHistory((prev) => {\r\n // Evitar duplicados consecutivos\r\n if (prev.length > 0 && prev[prev.length - 1] === fullPath) {\r\n return prev;\r\n }\r\n return [...prev, fullPath];\r\n });\r\n }\r\n }, [pathname, searchParams]);\r\n\r\n return (\r\n <NavigationHistoryContext.Provider value={{ history }}>\r\n {children}\r\n </NavigationHistoryContext.Provider>\r\n );\r\n}\r\n\r\n// Return type for the useNavigationHistory hook\r\ninterface NavigationHistoryHook {\r\n history: string[];\r\n goBack: (fallback?: string) => void;\r\n currentRoute: string | null;\r\n hasPreviousRoute: boolean;\r\n getPreviousRoute: () => string | null;\r\n}\r\n\r\nexport const QP_BACK_URL_NAME = 'backUrl';\r\n\r\n/**\r\n * Hook para usar el historial de navegación\r\n * @returns {NavigationHistoryHook} Objeto con el historial y la función goBack\r\n */\r\nexport function useNavigationHistory(): NavigationHistoryHook {\r\n const context = useContext(NavigationHistoryContext);\r\n const router = useRouter();\r\n\r\n if (!context) {\r\n throw new Error('useNavigationHistory debe usarse dentro de un NavigationHistoryProvider');\r\n }\r\n\r\n const searchParams = useSearchParams();\r\n\r\n const { history } = context;\r\n\r\n /**\r\n * Navega hacia atrás en el historial o a la ruta de fallback\r\n * @param {string} fallback - Ruta a la que ir si no hay historial previo\r\n */\r\n const goBack = (fallback?: string) => {\r\n const returnUrl = searchParams.get(QP_BACK_URL_NAME);\r\n if (returnUrl) {\r\n router.push(returnUrl);\r\n return;\r\n }\r\n\r\n if (history.length <= 1) {\r\n router.push(fallback ?? '/');\r\n return;\r\n }\r\n\r\n // Obtener las dos últimas rutas\r\n const previousRoute = history[history.length - 2];\r\n const currentRoute = history[history.length - 1];\r\n\r\n // Si hay más de 2 rutas en el historial y detectamos un patrón de bucle\r\n if (history.length >= 3 && history[history.length - 3] === currentRoute) {\r\n // Ir a una ruta segura (home) o a la ruta de fallback\r\n router.push(fallback ?? '/');\r\n return;\r\n }\r\n\r\n // Navegación normal\r\n router.push(previousRoute ?? '/');\r\n };\r\n\r\n return {\r\n history,\r\n goBack,\r\n currentRoute: history.length > 0 ? history[history.length - 1] : null,\r\n hasPreviousRoute: history.length > 1,\r\n getPreviousRoute: () => (history.length >= 2 ? history[history.length - 2] : null),\r\n };\r\n}\r\n"],"names":["NavigationHistoryContext","createContext","NavigationHistoryProvider","children","pathname","usePathname","searchParams","useSearchParams","history","setHistory","useState","useEffect","fullPath","prev","jsx","QP_BACK_URL_NAME","useNavigationHistory","context","useContext","router","useRouter","fallback","returnUrl","previousRoute","currentRoute"],"mappings":"kLAUMA,EAA2BC,gBAAmD,IAAI,EAWxE,SAAAC,EAA0B,CAAE,SAAAC,GAA4C,CACtF,MAAMC,EAAWC,EAAAA,YAAY,EACvBC,EAAeC,EAAAA,gBAAgB,EAG/B,CAACC,EAASC,CAAU,EAAIC,EAAAA,SAAmB,CAAA,CAAE,EAGnDC,OAAAA,EAAAA,UAAU,IAAM,CAER,MAAAC,EAAWN,GAAc,KAAO,GAAGF,CAAQ,IAAIE,EAAa,UAAU,GAAKF,EAE7EQ,GACFH,EAAYI,GAENA,EAAK,OAAS,GAAKA,EAAKA,EAAK,OAAS,CAAC,IAAMD,EACxCC,EAEF,CAAC,GAAGA,EAAMD,CAAQ,CAC1B,CACH,EACC,CAACR,EAAUE,CAAY,CAAC,EAGzBQ,EAAA,IAACd,EAAyB,SAAzB,CAAkC,MAAO,CAAE,QAAAQ,CAAA,EACzC,SAAAL,EACH,CAEJ,CAWO,MAAMY,EAAmB,UAMzB,SAASC,GAA8C,CACtD,MAAAC,EAAUC,aAAWlB,CAAwB,EAC7CmB,EAASC,EAAAA,UAAU,EAEzB,GAAI,CAACH,EACG,MAAA,IAAI,MAAM,yEAAyE,EAG3F,MAAMX,EAAeC,EAAAA,gBAAgB,EAE/B,CAAE,QAAAC,GAAYS,EAiCb,MAAA,CACL,QAAAT,EACA,OA7Bca,GAAsB,CAC9B,MAAAC,EAAYhB,EAAa,IAAIS,CAAgB,EACnD,GAAIO,EAAW,CACbH,EAAO,KAAKG,CAAS,EACrB,MAAA,CAGE,GAAAd,EAAQ,QAAU,EAAG,CAChBW,EAAA,KAAKE,GAAY,GAAG,EAC3B,MAAA,CAIF,MAAME,EAAgBf,EAAQA,EAAQ,OAAS,CAAC,EAC1CgB,EAAehB,EAAQA,EAAQ,OAAS,CAAC,EAG3C,GAAAA,EAAQ,QAAU,GAAKA,EAAQA,EAAQ,OAAS,CAAC,IAAMgB,EAAc,CAEhEL,EAAA,KAAKE,GAAY,GAAG,EAC3B,MAAA,CAIKF,EAAA,KAAKI,GAAiB,GAAG,CAClC,EAKE,aAAcf,EAAQ,OAAS,EAAIA,EAAQA,EAAQ,OAAS,CAAC,EAAI,KACjE,iBAAkBA,EAAQ,OAAS,EACnC,iBAAkB,IAAOA,EAAQ,QAAU,EAAIA,EAAQA,EAAQ,OAAS,CAAC,EAAI,IAC/E,CACF"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as g } from "react/jsx-runtime";
|
|
3
3
|
import { usePathname as l, useSearchParams as i, useRouter as f } from "next/navigation";
|
|
4
|
-
import {
|
|
5
|
-
const a =
|
|
4
|
+
import { useState as m, useEffect as P, createContext as v, useContext as y } from "react";
|
|
5
|
+
const a = v(null);
|
|
6
6
|
function H({ children: s }) {
|
|
7
|
-
const e = l(), r = i(), [t, u] =
|
|
8
|
-
return
|
|
7
|
+
const e = l(), r = i(), [t, u] = m([]);
|
|
8
|
+
return P(() => {
|
|
9
9
|
const o = r?.size ? `${e}?${r.toString()}` : e;
|
|
10
10
|
o && u((n) => n.length > 0 && n[n.length - 1] === o ? n : [...n, o]);
|
|
11
11
|
}, [e, r]), /* @__PURE__ */ g(a.Provider, { value: { history: t }, children: s });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/contexts/NavigationHistoryContext/index.tsx"],"sourcesContent":["'use client';\r\nimport { usePathname, useRouter, useSearchParams } from 'next/navigation';\r\nimport { createContext, ReactNode, useContext, useEffect, useState } from 'react';\r\n\r\n// Defining types for the context value\r\ninterface NavigationHistoryContextType {\r\n history: string[];\r\n}\r\n\r\n// Creating the context with a proper type\r\nconst NavigationHistoryContext = createContext<NavigationHistoryContextType | null>(null);\r\n\r\n// Props type for the provider component\r\ninterface NavigationHistoryProviderProps {\r\n children: ReactNode;\r\n}\r\n\r\n/**\r\n * Proveedor de historial de navegación\r\n * Solo se encarga de registrar las rutas visitadas\r\n */\r\nexport function NavigationHistoryProvider({ children }: NavigationHistoryProviderProps) {\r\n const pathname = usePathname();\r\n const searchParams = useSearchParams();\r\n\r\n // Estado para almacenar el historial de navegación\r\n const [history, setHistory] = useState<string[]>([]);\r\n\r\n // Efecto para actualizar el historial cuando cambia la ruta o los parámetros\r\n useEffect(() => {\r\n // Creamos la URL completa (ruta + parámetros)\r\n const fullPath = searchParams?.size ? `${pathname}?${searchParams.toString()}` : pathname;\r\n\r\n if (fullPath) {\r\n setHistory((prev) => {\r\n // Evitar duplicados consecutivos\r\n if (prev.length > 0 && prev[prev.length - 1] === fullPath) {\r\n return prev;\r\n }\r\n return [...prev, fullPath];\r\n });\r\n }\r\n }, [pathname, searchParams]);\r\n\r\n return (\r\n <NavigationHistoryContext.Provider value={{ history }}>\r\n {children}\r\n </NavigationHistoryContext.Provider>\r\n );\r\n}\r\n\r\n// Return type for the useNavigationHistory hook\r\ninterface NavigationHistoryHook {\r\n history: string[];\r\n goBack: (fallback?: string) => void;\r\n currentRoute: string | null;\r\n hasPreviousRoute: boolean;\r\n getPreviousRoute: () => string | null;\r\n}\r\n\r\nexport const QP_BACK_URL_NAME = 'backUrl';\r\n\r\n/**\r\n * Hook para usar el historial de navegación\r\n * @returns {NavigationHistoryHook} Objeto con el historial y la función goBack\r\n */\r\nexport function useNavigationHistory(): NavigationHistoryHook {\r\n const context = useContext(NavigationHistoryContext);\r\n const router = useRouter();\r\n\r\n if (!context) {\r\n throw new Error('useNavigationHistory debe usarse dentro de un NavigationHistoryProvider');\r\n }\r\n\r\n const searchParams = useSearchParams();\r\n\r\n const { history } = context;\r\n\r\n /**\r\n * Navega hacia atrás en el historial o a la ruta de fallback\r\n * @param {string} fallback - Ruta a la que ir si no hay historial previo\r\n */\r\n const goBack = (fallback?: string) => {\r\n const returnUrl = searchParams.get(QP_BACK_URL_NAME);\r\n if (returnUrl) {\r\n router.push(returnUrl);\r\n return;\r\n }\r\n\r\n if (history.length <= 1) {\r\n router.push(fallback ?? '/');\r\n return;\r\n }\r\n\r\n // Obtener las dos últimas rutas\r\n const previousRoute = history[history.length - 2];\r\n const currentRoute = history[history.length - 1];\r\n\r\n // Si hay más de 2 rutas en el historial y detectamos un patrón de bucle\r\n if (history.length >= 3 && history[history.length - 3] === currentRoute) {\r\n // Ir a una ruta segura (home) o a la ruta de fallback\r\n router.push(fallback ?? '/');\r\n return;\r\n }\r\n\r\n // Navegación normal\r\n router.push(previousRoute ?? '/');\r\n };\r\n\r\n return {\r\n history,\r\n goBack,\r\n currentRoute: history.length > 0 ? history[history.length - 1] : null,\r\n hasPreviousRoute: history.length > 1,\r\n getPreviousRoute: () => (history.length >= 2 ? history[history.length - 2] : null),\r\n };\r\n}\r\n"],"names":["NavigationHistoryContext","createContext","NavigationHistoryProvider","children","pathname","usePathname","searchParams","useSearchParams","history","setHistory","useState","useEffect","fullPath","prev","jsx","QP_BACK_URL_NAME","useNavigationHistory","context","useContext","router","useRouter","fallback","returnUrl","previousRoute","currentRoute"],"mappings":";;;;AAUA,MAAMA,IAA2BC,EAAmD,IAAI;AAWxE,SAAAC,EAA0B,EAAE,UAAAC,KAA4C;AACtF,QAAMC,IAAWC,EAAY,GACvBC,IAAeC,EAAgB,GAG/B,CAACC,GAASC,CAAU,IAAIC,EAAmB,CAAA,CAAE;AAGnD,SAAAC,EAAU,MAAM;AAER,UAAAC,IAAWN,GAAc,OAAO,GAAGF,CAAQ,IAAIE,EAAa,UAAU,KAAKF;AAEjF,IAAIQ,KACFH,EAAW,CAACI,MAENA,EAAK,SAAS,KAAKA,EAAKA,EAAK,SAAS,CAAC,MAAMD,IACxCC,IAEF,CAAC,GAAGA,GAAMD,CAAQ,CAC1B;AAAA,EACH,GACC,CAACR,GAAUE,CAAY,CAAC,GAGzB,gBAAAQ,EAACd,EAAyB,UAAzB,EAAkC,OAAO,EAAE,SAAAQ,EAAA,GACzC,UAAAL,GACH;AAEJ;AAWO,MAAMY,IAAmB;AAMzB,SAASC,IAA8C;AACtD,QAAAC,IAAUC,EAAWlB,CAAwB,GAC7CmB,IAASC,EAAU;AAEzB,MAAI,CAACH;AACG,UAAA,IAAI,MAAM,yEAAyE;AAG3F,QAAMX,IAAeC,EAAgB,GAE/B,EAAE,SAAAC,MAAYS;AAiCb,SAAA;AAAA,IACL,SAAAT;AAAA,IACA,QA7Ba,CAACa,MAAsB;AAC9B,YAAAC,IAAYhB,EAAa,IAAIS,CAAgB;AACnD,UAAIO,GAAW;AACb,QAAAH,EAAO,KAAKG,CAAS;AACrB;AAAA,MAAA;AAGE,UAAAd,EAAQ,UAAU,GAAG;AAChB,QAAAW,EAAA,KAAKE,KAAY,GAAG;AAC3B;AAAA,MAAA;AAIF,YAAME,IAAgBf,EAAQA,EAAQ,SAAS,CAAC,GAC1CgB,IAAehB,EAAQA,EAAQ,SAAS,CAAC;AAG3C,UAAAA,EAAQ,UAAU,KAAKA,EAAQA,EAAQ,SAAS,CAAC,MAAMgB,GAAc;AAEhE,QAAAL,EAAA,KAAKE,KAAY,GAAG;AAC3B;AAAA,MAAA;AAIK,MAAAF,EAAA,KAAKI,KAAiB,GAAG;AAAA,IAClC;AAAA,IAKE,cAAcf,EAAQ,SAAS,IAAIA,EAAQA,EAAQ,SAAS,CAAC,IAAI;AAAA,IACjE,kBAAkBA,EAAQ,SAAS;AAAA,IACnC,kBAAkB,MAAOA,EAAQ,UAAU,IAAIA,EAAQA,EAAQ,SAAS,CAAC,IAAI;AAAA,EAC/E;AACF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/contexts/PageDataContext/index.tsx"],"sourcesContent":["\"use client\";\r\nimport { createContext, useContext } from \"react\";\r\n\r\nconst PageData = createContext<any | undefined>(undefined);\r\n\r\ninterface PageDataProviderProps {\r\n children: React.ReactNode;\r\n value: any;\r\n}\r\n\r\nexport const PageDataProvider = ({\r\n value,\r\n children\r\n}: PageDataProviderProps) => (\r\n <PageData.Provider value={value}>{children}</PageData.Provider>\r\n);\r\nexport const usePageData = <T,>(): T => {\r\n const data = useContext(PageData);\r\n if (data === undefined) throw new Error(\"Out of context: usePageData\");\r\n\r\n return data;\r\n};\r\n"],"names":["PageData","createContext","PageDataProvider","value","children","jsx","usePageData","data","useContext"],"mappings":"qJAGMA,EAAWC,gBAA+B,MAAS,EAO5CC,EAAmB,CAAC,CAC/B,MAAAC,EACA,SAAAC,CACF,IACGC,EAAA,IAAAL,EAAS,SAAT,CAAkB,MAAAG,EAAe,SAAAC,CAAS,CAAA,EAEhCE,EAAc,IAAa,CAChC,MAAAC,EAAOC,aAAWR,CAAQ,EAChC,GAAIO,IAAS,OAAiB,MAAA,IAAI,MAAM,6BAA6B,EAE9D,OAAAA,CACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/contexts/PageDataContext/index.tsx"],"sourcesContent":["\"use client\";\r\nimport { createContext, useContext } from \"react\";\r\n\r\nconst PageData = createContext<any | undefined>(undefined);\r\n\r\ninterface PageDataProviderProps {\r\n children: React.ReactNode;\r\n value: any;\r\n}\r\n\r\nexport const PageDataProvider = ({\r\n value,\r\n children\r\n}: PageDataProviderProps) => (\r\n <PageData.Provider value={value}>{children}</PageData.Provider>\r\n);\r\nexport const usePageData = <T,>(): T => {\r\n const data = useContext(PageData);\r\n if (data === undefined) throw new Error(\"Out of context: usePageData\");\r\n\r\n return data;\r\n};\r\n"],"names":["PageData","createContext","PageDataProvider","value","children","jsx","usePageData","data","useContext"],"mappings":";;;AAGA,MAAMA,IAAWC,EAA+B,MAAS,GAO5CC,IAAmB,CAAC;AAAA,EAC/B,OAAAC;AAAA,EACA,UAAAC;AACF,MACG,gBAAAC,EAAAL,EAAS,UAAT,EAAkB,OAAAG,GAAe,UAAAC,EAAS,CAAA,GAEhCE,IAAc,MAAa;AAChC,QAAAC,IAAOC,EAAWR,CAAQ;AAChC,MAAIO,MAAS,OAAiB,OAAA,IAAI,MAAM,6BAA6B;AAE9D,SAAAA;AACT;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.cjs","sources":["../../../src/form/Form.tsx"],"sourcesContent":["'use client';\r\nimport { Box, BoxProps, ElementProps } from '@mantine/core';\r\nimport {\r\n FieldValues,\r\n FormProvider,\r\n SubmitErrorHandler,\r\n SubmitHandler,\r\n UseFormReturn,\r\n} from 'react-hook-form';\r\n\r\n// TODO: Completar el tipado con el schema usando z.output<schema> en el data del onSubmit\r\ninterface FormProps<T extends FieldValues> extends BoxProps, ElementProps<'form', 'onSubmit'> {\r\n methods: UseFormReturn<T, any, any>;\r\n onSubmit?: SubmitHandler<T>;\r\n onSubmitError?: SubmitErrorHandler<any>;\r\n}\r\n\r\nexport const Form = <T extends FieldValues>({\r\n methods,\r\n onSubmit = () => {},\r\n onSubmitError,\r\n ...rest\r\n}: FormProps<T>) => {\r\n return (\r\n <FormProvider {...methods}>\r\n <Box\r\n component=\"form\"\r\n onSubmit={methods.handleSubmit(onSubmit, onSubmitError)}\r\n {...rest}\r\n />\r\n </FormProvider>\r\n );\r\n};\r\n"],"names":["Form","methods","onSubmit","onSubmitError","rest","jsx","FormProvider","Box"],"mappings":"0LAiBaA,EAAO,CAAwB,CAC1C,QAAAC,EACA,SAAAC,EAAW,IAAM,CAAC,EAClB,cAAAC,EACA,GAAGC,CACL,IAEIC,EAAA,IAACC,EAAc,aAAA,CAAA,GAAGL,EAChB,SAAAI,EAAA,IAACE,EAAA,IAAA,CACC,UAAU,OACV,SAAUN,EAAQ,aAAaC,EAAUC,CAAa,EACrD,GAAGC,CAAA,CAAA,EAER"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.mjs","sources":["../../../src/form/Form.tsx"],"sourcesContent":["'use client';\r\nimport { Box, BoxProps, ElementProps } from '@mantine/core';\r\nimport {\r\n FieldValues,\r\n FormProvider,\r\n SubmitErrorHandler,\r\n SubmitHandler,\r\n UseFormReturn,\r\n} from 'react-hook-form';\r\n\r\n// TODO: Completar el tipado con el schema usando z.output<schema> en el data del onSubmit\r\ninterface FormProps<T extends FieldValues> extends BoxProps, ElementProps<'form', 'onSubmit'> {\r\n methods: UseFormReturn<T, any, any>;\r\n onSubmit?: SubmitHandler<T>;\r\n onSubmitError?: SubmitErrorHandler<any>;\r\n}\r\n\r\nexport const Form = <T extends FieldValues>({\r\n methods,\r\n onSubmit = () => {},\r\n onSubmitError,\r\n ...rest\r\n}: FormProps<T>) => {\r\n return (\r\n <FormProvider {...methods}>\r\n <Box\r\n component=\"form\"\r\n onSubmit={methods.handleSubmit(onSubmit, onSubmitError)}\r\n {...rest}\r\n />\r\n </FormProvider>\r\n );\r\n};\r\n"],"names":["Form","methods","onSubmit","onSubmitError","rest","jsx","FormProvider","Box"],"mappings":";;;;AAiBO,MAAMA,IAAO,CAAwB;AAAA,EAC1C,SAAAC;AAAA,EACA,UAAAC,IAAW,MAAM;AAAA,EAAC;AAAA,EAClB,eAAAC;AAAA,EACA,GAAGC;AACL,MAEI,gBAAAC,EAACC,GAAc,EAAA,GAAGL,GAChB,UAAA,gBAAAI;AAAA,EAACE;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV,UAAUN,EAAQ,aAAaC,GAAUC,CAAa;AAAA,IACrD,GAAGC;AAAA,EAAA;AAAA,GAER;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormButtonSubmit.cjs","sources":["../../../src/form/FormButtonSubmit.tsx"],"sourcesContent":["'use client';\r\nimport { Button, ButtonProps, ElementProps } from '@mantine/core';\r\nimport { useFormContext } from 'react-hook-form';\r\n\r\nexport interface FormButtonSubmitProps\r\n extends ButtonProps,\r\n ElementProps<'button', keyof ButtonProps> {}\r\n\r\nexport const FormButtonSubmit = (props: FormButtonSubmitProps) => {\r\n const { formState } = useFormContext();\r\n\r\n const { isSubmitting } = formState;\r\n\r\n return (\r\n <Button\r\n // disabled={isSubmitSuccessful}\r\n loading={isSubmitting}\r\n type=\"submit\"\r\n {...props}\r\n />\r\n );\r\n};\r\n"],"names":["FormButtonSubmit","props","formState","useFormContext","isSubmitting","jsx","Button"],"mappings":"0LAQaA,EAAoBC,GAAiC,CAC1D,KAAA,CAAE,UAAAC,CAAU,EAAIC,iBAAe,EAE/B,CAAE,aAAAC,GAAiBF,EAGvB,OAAAG,EAAA,IAACC,EAAA,OAAA,CAEC,QAASF,EACT,KAAK,SACJ,GAAGH,CAAA,CACN,CAEJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormButtonSubmit.mjs","sources":["../../../src/form/FormButtonSubmit.tsx"],"sourcesContent":["'use client';\r\nimport { Button, ButtonProps, ElementProps } from '@mantine/core';\r\nimport { useFormContext } from 'react-hook-form';\r\n\r\nexport interface FormButtonSubmitProps\r\n extends ButtonProps,\r\n ElementProps<'button', keyof ButtonProps> {}\r\n\r\nexport const FormButtonSubmit = (props: FormButtonSubmitProps) => {\r\n const { formState } = useFormContext();\r\n\r\n const { isSubmitting } = formState;\r\n\r\n return (\r\n <Button\r\n // disabled={isSubmitSuccessful}\r\n loading={isSubmitting}\r\n type=\"submit\"\r\n {...props}\r\n />\r\n );\r\n};\r\n"],"names":["FormButtonSubmit","props","formState","useFormContext","isSubmitting","jsx","Button"],"mappings":";;;;AAQa,MAAAA,IAAmB,CAACC,MAAiC;AAC1D,QAAA,EAAE,WAAAC,EAAU,IAAIC,EAAe,GAE/B,EAAE,cAAAC,MAAiBF;AAGvB,SAAA,gBAAAG;AAAA,IAACC;AAAA,IAAA;AAAA,MAEC,SAASF;AAAA,MACT,MAAK;AAAA,MACJ,GAAGH;AAAA,IAAA;AAAA,EACN;AAEJ;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),t=require("@mantine/core"),c=require("../../hocs/withForm.cjs"),i=c.withForm(({field:e,props:o})=>r.jsx(t.Checkbox,{...e,checked:e.value,...o}));exports.FormCheckbox=i;
|
|
2
|
+
//# sourceMappingURL=FormCheckbox.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormCheckbox.cjs","sources":["../../../../src/form/base/FormCheckbox.tsx"],"sourcesContent":["import { CheckboxProps, Checkbox } from '@mantine/core';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormCheckboxProps = CheckboxProps & WithFormProps;\r\n\r\nexport const FormCheckbox = withForm<FormCheckboxProps>(({ field, props }) => (\r\n <Checkbox\r\n {...field}\r\n checked={field.value}\r\n {...props}\r\n />\r\n));\r\n"],"names":["FormCheckbox","withForm","field","props","jsx","Checkbox"],"mappings":"qLAKaA,EAAeC,EAAAA,SAA4B,CAAC,CAAE,MAAAC,EAAO,MAAAC,CAChE,IAAAC,EAAA,IAACC,EAAA,SAAA,CACE,GAAGH,EACJ,QAASA,EAAM,MACd,GAAGC,CAAA,CACN,CACD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { Checkbox as t } from "@mantine/core";
|
|
3
|
+
import { withForm as c } from "../../hocs/withForm.mjs";
|
|
4
|
+
const x = c(({ field: o, props: r }) => /* @__PURE__ */ m(
|
|
5
|
+
t,
|
|
6
|
+
{
|
|
7
|
+
...o,
|
|
8
|
+
checked: o.value,
|
|
9
|
+
...r
|
|
10
|
+
}
|
|
11
|
+
));
|
|
12
|
+
export {
|
|
13
|
+
x as FormCheckbox
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=FormCheckbox.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormCheckbox.mjs","sources":["../../../../src/form/base/FormCheckbox.tsx"],"sourcesContent":["import { CheckboxProps, Checkbox } from '@mantine/core';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormCheckboxProps = CheckboxProps & WithFormProps;\r\n\r\nexport const FormCheckbox = withForm<FormCheckboxProps>(({ field, props }) => (\r\n <Checkbox\r\n {...field}\r\n checked={field.value}\r\n {...props}\r\n />\r\n));\r\n"],"names":["FormCheckbox","withForm","field","props","jsx","Checkbox"],"mappings":";;;AAKO,MAAMA,IAAeC,EAA4B,CAAC,EAAE,OAAAC,GAAO,OAAAC,EAChE,MAAA,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACE,GAAGH;AAAA,IACJ,SAASA,EAAM;AAAA,IACd,GAAGC;AAAA,EAAA;AACN,CACD;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),i=require("../../components/MyDatePickerInput/index.cjs"),o=require("../../hocs/withForm.cjs"),n=o.withForm(({field:e,props:t})=>r.jsx(i.MyDatePickerInput,{...e,...t}));exports.FormDatePickerInput=n;
|
|
2
|
+
//# sourceMappingURL=FormDatePickerInput.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormDatePickerInput.cjs","sources":["../../../../src/form/base/FormDatePickerInput.tsx"],"sourcesContent":["import { MyDatePickerInput, MyDatePickerInputProps } from 'src/components';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormDatePickerInput = WithFormProps & MyDatePickerInputProps;\r\n\r\nexport const FormDatePickerInput = withForm<MyDatePickerInputProps>(({ field, props }) => (\r\n <MyDatePickerInput\r\n {...field}\r\n {...props}\r\n />\r\n));\r\n"],"names":["FormDatePickerInput","withForm","field","props","jsx","MyDatePickerInput"],"mappings":"oNAKaA,EAAsBC,EAAAA,SAAiC,CAAC,CAAE,MAAAC,EAAO,MAAAC,CAC5E,IAAAC,EAAA,IAACC,EAAA,kBAAA,CACE,GAAGH,EACH,GAAGC,CAAA,CACN,CACD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { MyDatePickerInput as m } from "../../components/MyDatePickerInput/index.mjs";
|
|
3
|
+
import { withForm as i } from "../../hocs/withForm.mjs";
|
|
4
|
+
const f = i(({ field: r, props: o }) => /* @__PURE__ */ t(
|
|
5
|
+
m,
|
|
6
|
+
{
|
|
7
|
+
...r,
|
|
8
|
+
...o
|
|
9
|
+
}
|
|
10
|
+
));
|
|
11
|
+
export {
|
|
12
|
+
f as FormDatePickerInput
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=FormDatePickerInput.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormDatePickerInput.mjs","sources":["../../../../src/form/base/FormDatePickerInput.tsx"],"sourcesContent":["import { MyDatePickerInput, MyDatePickerInputProps } from 'src/components';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormDatePickerInput = WithFormProps & MyDatePickerInputProps;\r\n\r\nexport const FormDatePickerInput = withForm<MyDatePickerInputProps>(({ field, props }) => (\r\n <MyDatePickerInput\r\n {...field}\r\n {...props}\r\n />\r\n));\r\n"],"names":["FormDatePickerInput","withForm","field","props","jsx","MyDatePickerInput"],"mappings":";;;AAKO,MAAMA,IAAsBC,EAAiC,CAAC,EAAE,OAAAC,GAAO,OAAAC,EAC5E,MAAA,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACE,GAAGH;AAAA,IACH,GAAGC;AAAA,EAAA;AACN,CACD;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),t=require("../../components/MyDateTimePicker/index.cjs"),o=require("../../hocs/withForm.cjs"),c=o.withForm(({field:e,props:r})=>i.jsx(t.MyDateTimePicker,{...e,...r}));exports.FormDateTimePicker=c;
|
|
2
|
+
//# sourceMappingURL=FormDateTimePicker.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormDateTimePicker.cjs","sources":["../../../../src/form/base/FormDateTimePicker.tsx"],"sourcesContent":["import { DateTimePickerProps } from '@mantine/dates';\r\nimport { MyDateTimePickerProps, MyDateTimePicker } from 'src/components';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormDateTimePickerProps = WithFormProps & MyDateTimePickerProps;\r\n\r\nexport const FormDateTimePicker = withForm<DateTimePickerProps>(({ field, props }) => (\r\n <MyDateTimePicker\r\n {...field}\r\n {...props}\r\n />\r\n));\r\n"],"names":["FormDateTimePicker","withForm","field","props","jsx","MyDateTimePicker"],"mappings":"mNAMaA,EAAqBC,EAAAA,SAA8B,CAAC,CAAE,MAAAC,EAAO,MAAAC,CACxE,IAAAC,EAAA,IAACC,EAAA,iBAAA,CACE,GAAGH,EACH,GAAGC,CAAA,CACN,CACD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { MyDateTimePicker as i } from "../../components/MyDateTimePicker/index.mjs";
|
|
3
|
+
import { withForm as t } from "../../hocs/withForm.mjs";
|
|
4
|
+
const f = t(({ field: r, props: m }) => /* @__PURE__ */ o(
|
|
5
|
+
i,
|
|
6
|
+
{
|
|
7
|
+
...r,
|
|
8
|
+
...m
|
|
9
|
+
}
|
|
10
|
+
));
|
|
11
|
+
export {
|
|
12
|
+
f as FormDateTimePicker
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=FormDateTimePicker.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormDateTimePicker.mjs","sources":["../../../../src/form/base/FormDateTimePicker.tsx"],"sourcesContent":["import { DateTimePickerProps } from '@mantine/dates';\r\nimport { MyDateTimePickerProps, MyDateTimePicker } from 'src/components';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormDateTimePickerProps = WithFormProps & MyDateTimePickerProps;\r\n\r\nexport const FormDateTimePicker = withForm<DateTimePickerProps>(({ field, props }) => (\r\n <MyDateTimePicker\r\n {...field}\r\n {...props}\r\n />\r\n));\r\n"],"names":["FormDateTimePicker","withForm","field","props","jsx","MyDateTimePicker"],"mappings":";;;AAMO,MAAMA,IAAqBC,EAA8B,CAAC,EAAE,OAAAC,GAAO,OAAAC,EACxE,MAAA,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACE,GAAGH;AAAA,IACH,GAAGC;AAAA,EAAA;AACN,CACD;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),u=require("../../components/MyNumberInput/index.cjs"),o=require("../../hocs/withForm.cjs"),n=o.withForm(({field:e,props:r})=>t.jsx(u.MyNumberInput,{...e,...r}));exports.FormNumberInput=n;
|
|
2
|
+
//# sourceMappingURL=FormNumberInput.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormNumberInput.cjs","sources":["../../../../src/form/base/FormNumberInput.tsx"],"sourcesContent":["import { MyNumberInputProps, MyNumberInput } from 'src/components';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormNumberInputProps = MyNumberInputProps & WithFormProps;\r\n\r\nexport const FormNumberInput = withForm<FormNumberInputProps>(({ field, props }) => (\r\n <MyNumberInput\r\n {...field}\r\n {...props}\r\n />\r\n));\r\n"],"names":["FormNumberInput","withForm","field","props","jsx","MyNumberInput"],"mappings":"gNAKaA,EAAkBC,EAAAA,SAA+B,CAAC,CAAE,MAAAC,EAAO,MAAAC,CACtE,IAAAC,EAAA,IAACC,EAAA,cAAA,CACE,GAAGH,EACH,GAAGC,CAAA,CACN,CACD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { MyNumberInput as t } from "../../components/MyNumberInput/index.mjs";
|
|
3
|
+
import { withForm as p } from "../../hocs/withForm.mjs";
|
|
4
|
+
const f = p(({ field: r, props: m }) => /* @__PURE__ */ o(
|
|
5
|
+
t,
|
|
6
|
+
{
|
|
7
|
+
...r,
|
|
8
|
+
...m
|
|
9
|
+
}
|
|
10
|
+
));
|
|
11
|
+
export {
|
|
12
|
+
f as FormNumberInput
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=FormNumberInput.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormNumberInput.mjs","sources":["../../../../src/form/base/FormNumberInput.tsx"],"sourcesContent":["import { MyNumberInputProps, MyNumberInput } from 'src/components';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormNumberInputProps = MyNumberInputProps & WithFormProps;\r\n\r\nexport const FormNumberInput = withForm<FormNumberInputProps>(({ field, props }) => (\r\n <MyNumberInput\r\n {...field}\r\n {...props}\r\n />\r\n));\r\n"],"names":["FormNumberInput","withForm","field","props","jsx","MyNumberInput"],"mappings":";;;AAKO,MAAMA,IAAkBC,EAA+B,CAAC,EAAE,OAAAC,GAAO,OAAAC,EACtE,MAAA,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACE,GAAGH;AAAA,IACH,GAAGC;AAAA,EAAA;AACN,CACD;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("@mantine/core"),i=require("../../hocs/withForm.cjs"),u=i.withForm(({field:o,props:r})=>e.jsx(t.Radio.Group,{...o,...r}));exports.FormRadioGroup=u;
|
|
2
|
+
//# sourceMappingURL=FormRadioGroup.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormRadioGroup.cjs","sources":["../../../../src/form/base/FormRadioGroup.tsx"],"sourcesContent":["import { RadioGroupProps, Radio } from '@mantine/core';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormRadioGroupProps = RadioGroupProps & WithFormProps;\r\n\r\nexport const FormRadioGroup = withForm<FormRadioGroupProps>(({ field, props }) => (\r\n <Radio.Group\r\n {...field}\r\n {...props}\r\n />\r\n));\r\n"],"names":["FormRadioGroup","withForm","field","props","jsx","Radio"],"mappings":"qLAKaA,EAAiBC,EAAAA,SAA8B,CAAC,CAAE,MAAAC,EAAO,MAAAC,CACpE,IAAAC,EAAA,IAACC,EAAAA,MAAM,MAAN,CACE,GAAGH,EACH,GAAGC,CAAA,CACN,CACD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { Radio as i } from "@mantine/core";
|
|
3
|
+
import { withForm as p } from "../../hocs/withForm.mjs";
|
|
4
|
+
const d = p(({ field: o, props: r }) => /* @__PURE__ */ m(
|
|
5
|
+
i.Group,
|
|
6
|
+
{
|
|
7
|
+
...o,
|
|
8
|
+
...r
|
|
9
|
+
}
|
|
10
|
+
));
|
|
11
|
+
export {
|
|
12
|
+
d as FormRadioGroup
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=FormRadioGroup.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormRadioGroup.mjs","sources":["../../../../src/form/base/FormRadioGroup.tsx"],"sourcesContent":["import { RadioGroupProps, Radio } from '@mantine/core';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormRadioGroupProps = RadioGroupProps & WithFormProps;\r\n\r\nexport const FormRadioGroup = withForm<FormRadioGroupProps>(({ field, props }) => (\r\n <Radio.Group\r\n {...field}\r\n {...props}\r\n />\r\n));\r\n"],"names":["FormRadioGroup","withForm","field","props","jsx","Radio"],"mappings":";;;AAKO,MAAMA,IAAiBC,EAA8B,CAAC,EAAE,OAAAC,GAAO,OAAAC,EACpE,MAAA,gBAAAC;AAAA,EAACC,EAAM;AAAA,EAAN;AAAA,IACE,GAAGH;AAAA,IACH,GAAGC;AAAA,EAAA;AACN,CACD;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),o=require("../../components/MySelect/index.cjs"),i=require("../../hocs/withForm.cjs"),c=i.withForm(({field:e,props:t})=>r.jsx(o.MySelect,{...e,...t}));exports.FormSelect=c;
|
|
2
|
+
//# sourceMappingURL=FormSelect.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormSelect.cjs","sources":["../../../../src/form/base/FormSelect.tsx"],"sourcesContent":["import { MySelectProps, MySelect } from 'src/components';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormSelectProps = MySelectProps & WithFormProps;\r\n\r\nexport const FormSelect = withForm<FormSelectProps>(({ field, props }) => (\r\n <MySelect\r\n {...field}\r\n {...props}\r\n />\r\n));\r\n"],"names":["FormSelect","withForm","field","props","jsx","MySelect"],"mappings":"2MAKaA,EAAaC,EAAAA,SAA0B,CAAC,CAAE,MAAAC,EAAO,MAAAC,CAC5D,IAAAC,EAAA,IAACC,EAAA,SAAA,CACE,GAAGH,EACH,GAAGC,CAAA,CACN,CACD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { MySelect as t } from "../../components/MySelect/index.mjs";
|
|
3
|
+
import { withForm as e } from "../../hocs/withForm.mjs";
|
|
4
|
+
const f = e(({ field: o, props: r }) => /* @__PURE__ */ m(
|
|
5
|
+
t,
|
|
6
|
+
{
|
|
7
|
+
...o,
|
|
8
|
+
...r
|
|
9
|
+
}
|
|
10
|
+
));
|
|
11
|
+
export {
|
|
12
|
+
f as FormSelect
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=FormSelect.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormSelect.mjs","sources":["../../../../src/form/base/FormSelect.tsx"],"sourcesContent":["import { MySelectProps, MySelect } from 'src/components';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormSelectProps = MySelectProps & WithFormProps;\r\n\r\nexport const FormSelect = withForm<FormSelectProps>(({ field, props }) => (\r\n <MySelect\r\n {...field}\r\n {...props}\r\n />\r\n));\r\n"],"names":["FormSelect","withForm","field","props","jsx","MySelect"],"mappings":";;;AAKO,MAAMA,IAAaC,EAA0B,CAAC,EAAE,OAAAC,GAAO,OAAAC,EAC5D,MAAA,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACE,GAAGH;AAAA,IACH,GAAGC;AAAA,EAAA;AACN,CACD;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),n=require("../../components/SelectInfinity/index.cjs"),r=require("../../hocs/withForm.cjs"),o=r.withForm(({field:e,props:t})=>i.jsx(n.SelectInfinity,{...e,...t}));exports.FormSelectInfinity=o;
|
|
2
|
+
//# sourceMappingURL=FormSelectInfinity.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormSelectInfinity.cjs","sources":["../../../../src/form/base/FormSelectInfinity.tsx"],"sourcesContent":["import { SelectInfinityProps, SelectInfinity } from 'src/components';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormSelectInfinityProps = SelectInfinityProps & WithFormProps;\r\n\r\nexport const FormSelectInfinity = withForm<SelectInfinityProps>(({ field, props }) => (\r\n <SelectInfinity\r\n {...field}\r\n {...props}\r\n />\r\n));\r\n"],"names":["FormSelectInfinity","withForm","field","props","jsx","SelectInfinity"],"mappings":"iNAKaA,EAAqBC,EAAAA,SAA8B,CAAC,CAAE,MAAAC,EAAO,MAAAC,CACxE,IAAAC,EAAA,IAACC,EAAA,eAAA,CACE,GAAGH,EACH,GAAGC,CAAA,CACN,CACD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { SelectInfinity as i } from "../../components/SelectInfinity/index.mjs";
|
|
3
|
+
import { withForm as m } from "../../hocs/withForm.mjs";
|
|
4
|
+
const p = m(({ field: o, props: t }) => /* @__PURE__ */ r(
|
|
5
|
+
i,
|
|
6
|
+
{
|
|
7
|
+
...o,
|
|
8
|
+
...t
|
|
9
|
+
}
|
|
10
|
+
));
|
|
11
|
+
export {
|
|
12
|
+
p as FormSelectInfinity
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=FormSelectInfinity.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormSelectInfinity.mjs","sources":["../../../../src/form/base/FormSelectInfinity.tsx"],"sourcesContent":["import { SelectInfinityProps, SelectInfinity } from 'src/components';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormSelectInfinityProps = SelectInfinityProps & WithFormProps;\r\n\r\nexport const FormSelectInfinity = withForm<SelectInfinityProps>(({ field, props }) => (\r\n <SelectInfinity\r\n {...field}\r\n {...props}\r\n />\r\n));\r\n"],"names":["FormSelectInfinity","withForm","field","props","jsx","SelectInfinity"],"mappings":";;;AAKO,MAAMA,IAAqBC,EAA8B,CAAC,EAAE,OAAAC,GAAO,OAAAC,EACxE,MAAA,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACE,GAAGH;AAAA,IACH,GAAGC;AAAA,EAAA;AACN,CACD;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),o=require("../../components/MyTextarea/index.cjs"),i=require("../../hocs/withForm.cjs"),a=i.withForm(({field:e,props:r})=>t.jsx(o.MyTextarea,{...e,...r}));exports.FormTextarea=a;
|
|
2
|
+
//# sourceMappingURL=FormTextArea.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormTextArea.cjs","sources":["../../../../src/form/base/FormTextArea.tsx"],"sourcesContent":["import { TextareaProps } from '@mantine/core';\r\nimport { MyTextareaProps, MyTextarea } from 'src/components';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormTextarea = MyTextareaProps & WithFormProps;\r\n\r\nexport const FormTextarea = withForm<TextareaProps>(({ field, props }) => (\r\n <MyTextarea\r\n {...field}\r\n {...props}\r\n />\r\n));\r\n"],"names":["FormTextarea","withForm","field","props","jsx","MyTextarea"],"mappings":"6MAMaA,EAAeC,EAAAA,SAAwB,CAAC,CAAE,MAAAC,EAAO,MAAAC,CAC5D,IAAAC,EAAA,IAACC,EAAA,WAAA,CACE,GAAGH,EACH,GAAGC,CAAA,CACN,CACD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { MyTextarea as t } from "../../components/MyTextarea/index.mjs";
|
|
3
|
+
import { withForm as e } from "../../hocs/withForm.mjs";
|
|
4
|
+
const x = e(({ field: r, props: o }) => /* @__PURE__ */ m(
|
|
5
|
+
t,
|
|
6
|
+
{
|
|
7
|
+
...r,
|
|
8
|
+
...o
|
|
9
|
+
}
|
|
10
|
+
));
|
|
11
|
+
export {
|
|
12
|
+
x as FormTextarea
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=FormTextArea.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormTextArea.mjs","sources":["../../../../src/form/base/FormTextArea.tsx"],"sourcesContent":["import { TextareaProps } from '@mantine/core';\r\nimport { MyTextareaProps, MyTextarea } from 'src/components';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormTextarea = MyTextareaProps & WithFormProps;\r\n\r\nexport const FormTextarea = withForm<TextareaProps>(({ field, props }) => (\r\n <MyTextarea\r\n {...field}\r\n {...props}\r\n />\r\n));\r\n"],"names":["FormTextarea","withForm","field","props","jsx","MyTextarea"],"mappings":";;;AAMO,MAAMA,IAAeC,EAAwB,CAAC,EAAE,OAAAC,GAAO,OAAAC,EAC5D,MAAA,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACE,GAAGH;AAAA,IACH,GAAGC;AAAA,EAAA;AACN,CACD;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),o=require("../../components/MyTextInput/index.cjs"),n=require("../../hocs/withForm.cjs"),i=n.withForm(({field:t,props:e})=>r.jsx(o.MyTextInput,{...t,...e}));exports.FormTextInput=i;
|
|
2
|
+
//# sourceMappingURL=FormTextInput.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormTextInput.cjs","sources":["../../../../src/form/base/FormTextInput.tsx"],"sourcesContent":["import { MyTextInputProps, MyTextInput } from 'src/components';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormTextInputProps = WithFormProps & MyTextInputProps;\r\n\r\nexport const FormTextInput = withForm<FormTextInputProps>(({ field, props }) => (\r\n <MyTextInput\r\n {...field}\r\n {...props}\r\n />\r\n));\r\n"],"names":["FormTextInput","withForm","field","props","jsx","MyTextInput"],"mappings":"8MAKaA,EAAgBC,EAAAA,SAA6B,CAAC,CAAE,MAAAC,EAAO,MAAAC,CAClE,IAAAC,EAAA,IAACC,EAAA,YAAA,CACE,GAAGH,EACH,GAAGC,CAAA,CACN,CACD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { MyTextInput as m } from "../../components/MyTextInput/index.mjs";
|
|
3
|
+
import { withForm as p } from "../../hocs/withForm.mjs";
|
|
4
|
+
const f = p(({ field: o, props: t }) => /* @__PURE__ */ r(
|
|
5
|
+
m,
|
|
6
|
+
{
|
|
7
|
+
...o,
|
|
8
|
+
...t
|
|
9
|
+
}
|
|
10
|
+
));
|
|
11
|
+
export {
|
|
12
|
+
f as FormTextInput
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=FormTextInput.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormTextInput.mjs","sources":["../../../../src/form/base/FormTextInput.tsx"],"sourcesContent":["import { MyTextInputProps, MyTextInput } from 'src/components';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormTextInputProps = WithFormProps & MyTextInputProps;\r\n\r\nexport const FormTextInput = withForm<FormTextInputProps>(({ field, props }) => (\r\n <MyTextInput\r\n {...field}\r\n {...props}\r\n />\r\n));\r\n"],"names":["FormTextInput","withForm","field","props","jsx","MyTextInput"],"mappings":";;;AAKO,MAAMA,IAAgBC,EAA6B,CAAC,EAAE,OAAAC,GAAO,OAAAC,EAClE,MAAA,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACE,GAAGH;AAAA,IACH,GAAGC;AAAA,EAAA;AACN,CACD;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),u=require("../../components/MyTimeInput/index.cjs"),i=require("../../hocs/withForm.cjs"),m=i.withForm(({field:t,props:e})=>n.jsx(u.MyTimeInput,{...t,...e})),s=t=>{const[e,r]=t.split(":").map(Number),o=e+r/60;return Number(o.toFixed(2))},c=t=>{const e=Math.floor(t),r=Math.round((t-e)*60);return`${e.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`};exports.FormTimeInput=m;exports.numberToTimeInput=c;exports.timeInputToNumber=s;
|
|
2
|
+
//# sourceMappingURL=FormTimeInput.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormTimeInput.cjs","sources":["../../../../src/form/base/FormTimeInput.tsx"],"sourcesContent":["import { TimeInputProps } from '@mantine/dates';\r\nimport { MyTimeInputProps, MyTimeInput } from 'src/components';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormTimeInput = MyTimeInputProps & WithFormProps;\r\n\r\nexport const FormTimeInput = withForm<TimeInputProps>(({ field, props }) => (\r\n <MyTimeInput\r\n {...field}\r\n {...props}\r\n />\r\n));\r\n\r\nexport const timeInputToNumber = (timeInput: string) => {\r\n const [hours, minutes] = timeInput.split(':').map(Number);\r\n const result = hours + minutes / 60;\r\n return Number(result.toFixed(2));\r\n};\r\n\r\nexport const numberToTimeInput = (number: number) => {\r\n const hours = Math.floor(number);\r\n const minutes = Math.round((number - hours) * 60);\r\n return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}`;\r\n};\r\n"],"names":["FormTimeInput","withForm","field","props","jsx","MyTimeInput","timeInputToNumber","timeInput","hours","minutes","result","numberToTimeInput","number"],"mappings":"8MAMaA,EAAgBC,EAAAA,SAAyB,CAAC,CAAE,MAAAC,EAAO,MAAAC,CAC9D,IAAAC,EAAA,IAACC,EAAA,YAAA,CACE,GAAGH,EACH,GAAGC,CAAA,CACN,CACD,EAEYG,EAAqBC,GAAsB,CAChD,KAAA,CAACC,EAAOC,CAAO,EAAIF,EAAU,MAAM,GAAG,EAAE,IAAI,MAAM,EAClDG,EAASF,EAAQC,EAAU,GACjC,OAAO,OAAOC,EAAO,QAAQ,CAAC,CAAC,CACjC,EAEaC,EAAqBC,GAAmB,CAC7C,MAAAJ,EAAQ,KAAK,MAAMI,CAAM,EACzBH,EAAU,KAAK,OAAOG,EAASJ,GAAS,EAAE,EAChD,MAAO,GAAGA,EAAM,SAAS,EAAE,SAAS,EAAG,GAAG,CAAC,IAAIC,EAAQ,SAAS,EAAE,SAAS,EAAG,GAAG,CAAC,EACpF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { MyTimeInput as u } from "../../components/MyTimeInput/index.mjs";
|
|
3
|
+
import { withForm as e } from "../../hocs/withForm.mjs";
|
|
4
|
+
const a = e(({ field: t, props: o }) => /* @__PURE__ */ n(
|
|
5
|
+
u,
|
|
6
|
+
{
|
|
7
|
+
...t,
|
|
8
|
+
...o
|
|
9
|
+
}
|
|
10
|
+
)), c = (t) => {
|
|
11
|
+
const [o, r] = t.split(":").map(Number), m = o + r / 60;
|
|
12
|
+
return Number(m.toFixed(2));
|
|
13
|
+
}, h = (t) => {
|
|
14
|
+
const o = Math.floor(t), r = Math.round((t - o) * 60);
|
|
15
|
+
return `${o.toString().padStart(2, "0")}:${r.toString().padStart(2, "0")}`;
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
a as FormTimeInput,
|
|
19
|
+
h as numberToTimeInput,
|
|
20
|
+
c as timeInputToNumber
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=FormTimeInput.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormTimeInput.mjs","sources":["../../../../src/form/base/FormTimeInput.tsx"],"sourcesContent":["import { TimeInputProps } from '@mantine/dates';\r\nimport { MyTimeInputProps, MyTimeInput } from 'src/components';\r\nimport { WithFormProps, withForm } from 'src/hocs';\r\n\r\nexport type FormTimeInput = MyTimeInputProps & WithFormProps;\r\n\r\nexport const FormTimeInput = withForm<TimeInputProps>(({ field, props }) => (\r\n <MyTimeInput\r\n {...field}\r\n {...props}\r\n />\r\n));\r\n\r\nexport const timeInputToNumber = (timeInput: string) => {\r\n const [hours, minutes] = timeInput.split(':').map(Number);\r\n const result = hours + minutes / 60;\r\n return Number(result.toFixed(2));\r\n};\r\n\r\nexport const numberToTimeInput = (number: number) => {\r\n const hours = Math.floor(number);\r\n const minutes = Math.round((number - hours) * 60);\r\n return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}`;\r\n};\r\n"],"names":["FormTimeInput","withForm","field","props","jsx","MyTimeInput","timeInputToNumber","timeInput","hours","minutes","result","numberToTimeInput","number"],"mappings":";;;AAMO,MAAMA,IAAgBC,EAAyB,CAAC,EAAE,OAAAC,GAAO,OAAAC,EAC9D,MAAA,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACE,GAAGH;AAAA,IACH,GAAGC;AAAA,EAAA;AACN,CACD,GAEYG,IAAoB,CAACC,MAAsB;AAChD,QAAA,CAACC,GAAOC,CAAO,IAAIF,EAAU,MAAM,GAAG,EAAE,IAAI,MAAM,GAClDG,IAASF,IAAQC,IAAU;AACjC,SAAO,OAAOC,EAAO,QAAQ,CAAC,CAAC;AACjC,GAEaC,IAAoB,CAACC,MAAmB;AAC7C,QAAAJ,IAAQ,KAAK,MAAMI,CAAM,GACzBH,IAAU,KAAK,OAAOG,IAASJ,KAAS,EAAE;AAChD,SAAO,GAAGA,EAAM,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC,IAAIC,EAAQ,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC;AACpF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nullableInput.cjs","sources":["../../../../src/form/utils/nullableInput.ts"],"sourcesContent":["import { ZodTypeAny, z } from \"zod\";\r\n\r\nexport const nullableInput = <T extends ZodTypeAny>(\r\n schema: T,\r\n message = \"Campo requerido\"\r\n) => {\r\n return schema.nullable().transform((val, ctx) => {\r\n if (val === null) {\r\n ctx.addIssue({\r\n code: z.ZodIssueCode.custom,\r\n fatal: true,\r\n message\r\n });\r\n\r\n return z.NEVER;\r\n }\r\n\r\n return val;\r\n });\r\n};\r\n"],"names":["nullableInput","schema","message","val","ctx","z"],"mappings":"uGAEaA,EAAgB,CAC3BC,EACAC,EAAU,oBAEHD,EAAO,SAAS,EAAE,UAAU,CAACE,EAAKC,IACnCD,IAAQ,MACVC,EAAI,SAAS,CACX,KAAMC,EAAAA,EAAE,aAAa,OACrB,MAAO,GACP,QAAAH,CAAA,CACD,EAEMG,EAAE,EAAA,OAGJF,CACR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nullableInput.mjs","sources":["../../../../src/form/utils/nullableInput.ts"],"sourcesContent":["import { ZodTypeAny, z } from \"zod\";\r\n\r\nexport const nullableInput = <T extends ZodTypeAny>(\r\n schema: T,\r\n message = \"Campo requerido\"\r\n) => {\r\n return schema.nullable().transform((val, ctx) => {\r\n if (val === null) {\r\n ctx.addIssue({\r\n code: z.ZodIssueCode.custom,\r\n fatal: true,\r\n message\r\n });\r\n\r\n return z.NEVER;\r\n }\r\n\r\n return val;\r\n });\r\n};\r\n"],"names":["nullableInput","schema","message","val","ctx","z"],"mappings":";AAEO,MAAMA,IAAgB,CAC3BC,GACAC,IAAU,sBAEHD,EAAO,SAAS,EAAE,UAAU,CAACE,GAAKC,MACnCD,MAAQ,QACVC,EAAI,SAAS;AAAA,EACX,MAAMC,EAAE,aAAa;AAAA,EACrB,OAAO;AAAA,EACP,SAAAH;AAAA,CACD,GAEMG,EAAE,SAGJF,CACR;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zodValidator.cjs","sources":["../../../../src/form/utils/zodValidator.ts"],"sourcesContent":["import { ZodTypeAny } from 'zod';\r\n\r\nexport const zodValidator = (schema: ZodTypeAny) => {\r\n return (values: any) => {\r\n const result = schema.safeParse(values);\r\n if (result.success) return;\r\n\r\n const { error } = result;\r\n const firstError = error.issues[0];\r\n\r\n return firstError?.message;\r\n };\r\n};\r\n"],"names":["zodValidator","schema","values","result","error"],"mappings":"gFAEa,MAAAA,EAAgBC,GACnBC,GAAgB,CAChB,MAAAC,EAASF,EAAO,UAAUC,CAAM,EACtC,GAAIC,EAAO,QAAS,OAEd,KAAA,CAAE,MAAAC,GAAUD,EAGlB,OAFmBC,EAAM,OAAO,CAAC,GAEd,OACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zodValidator.mjs","sources":["../../../../src/form/utils/zodValidator.ts"],"sourcesContent":["import { ZodTypeAny } from 'zod';\r\n\r\nexport const zodValidator = (schema: ZodTypeAny) => {\r\n return (values: any) => {\r\n const result = schema.safeParse(values);\r\n if (result.success) return;\r\n\r\n const { error } = result;\r\n const firstError = error.issues[0];\r\n\r\n return firstError?.message;\r\n };\r\n};\r\n"],"names":["zodValidator","schema","values","result","error"],"mappings":"AAEa,MAAAA,IAAe,CAACC,MACpB,CAACC,MAAgB;AAChB,QAAAC,IAASF,EAAO,UAAUC,CAAM;AACtC,MAAIC,EAAO,QAAS;AAEd,QAAA,EAAE,OAAAC,MAAUD;AAGlB,SAFmBC,EAAM,OAAO,CAAC,GAEd;AACrB;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),b=require("react-hook-form"),f=require("../form/utils/zodValidator.cjs"),h=(i,a)=>{const r=e=>{const{validate:l,name:d="",placeholder:s,label:c,description:n,...u}=e;return o.jsx(b.Controller,{name:d,defaultValue:"",rules:{validate:l&&!e.disabled?f.zodValidator(l):void 0},disabled:e.disabled,...a?.(e),render:t=>{const{fieldState:{isTouched:v,error:m}}=t,F={...t,props:{...e,validate:void 0},field:{...t.field,label:c,placeholder:s,description:n,error:m?.message},...u};return o.jsx(i,{...F})}})};return r.displayName=`withForm(${i.displayName})`,r};exports.withForm=h;
|
|
2
|
+
//# sourceMappingURL=withForm.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withForm.cjs","sources":["../../../src/hocs/withForm.tsx"],"sourcesContent":["'use client';\r\nimport { Controller, ControllerProps } from 'react-hook-form';\r\nimport { ZodTypeAny } from 'zod';\r\nimport { zodValidator } from '../form';\r\n\r\nexport interface WithFormProps {\r\n name?: string;\r\n label?: React.ReactNode;\r\n placeholder?: string;\r\n description?: React.ReactNode;\r\n validate?: ZodTypeAny;\r\n disabled?: boolean;\r\n}\r\n\r\nexport type FormFieldProps<T = unknown> = Parameters<ControllerProps['render']>[0] & {\r\n props: T;\r\n field: {\r\n label?: React.ReactNode;\r\n placeholder?: string;\r\n description?: React.ReactNode;\r\n error?: string;\r\n };\r\n};\r\n\r\nexport const withForm = <P extends unknown>(\r\n WrappedComponent: React.ComponentType<FormFieldProps<P>>,\r\n getControllerProps?: (props: P) => Omit<Partial<ControllerProps>, 'render'>,\r\n) => {\r\n const FormField: React.FC<P & WithFormProps> = (props) => {\r\n const { validate, name = '', placeholder, label, description, ...withFormRestProps } = props;\r\n\r\n return (\r\n <Controller\r\n name={name}\r\n defaultValue={''}\r\n rules={{\r\n validate: validate && !props.disabled ? zodValidator(validate) : undefined,\r\n }}\r\n disabled={props.disabled}\r\n {...getControllerProps?.(props)}\r\n render={(renderProps) => {\r\n const {\r\n fieldState: { isTouched, error },\r\n } = renderProps;\r\n\r\n const fieldProps = {\r\n ...renderProps,\r\n props: {\r\n ...props,\r\n validate: undefined,\r\n },\r\n field: {\r\n ...renderProps.field,\r\n label,\r\n placeholder,\r\n description,\r\n error: error?.message,\r\n },\r\n ...withFormRestProps,\r\n } as FormFieldProps<P>;\r\n\r\n return <WrappedComponent {...fieldProps} />;\r\n }}\r\n />\r\n );\r\n };\r\n\r\n FormField.displayName = `withForm(${WrappedComponent.displayName})`;\r\n\r\n return FormField;\r\n};\r\n"],"names":["withForm","WrappedComponent","getControllerProps","FormField","props","validate","name","placeholder","label","description","withFormRestProps","jsx","Controller","zodValidator","renderProps","isTouched","error","fieldProps"],"mappings":"2MAwBaA,EAAW,CACtBC,EACAC,IACG,CACG,MAAAC,EAA0CC,GAAU,CAClD,KAAA,CAAE,SAAAC,EAAU,KAAAC,EAAO,GAAI,YAAAC,EAAa,MAAAC,EAAO,YAAAC,EAAa,GAAGC,CAAA,EAAsBN,EAGrF,OAAAO,EAAA,IAACC,EAAA,WAAA,CACC,KAAAN,EACA,aAAc,GACd,MAAO,CACL,SAAUD,GAAY,CAACD,EAAM,SAAWS,EAAAA,aAAaR,CAAQ,EAAI,MACnE,EACA,SAAUD,EAAM,SACf,GAAGF,IAAqBE,CAAK,EAC9B,OAASU,GAAgB,CACjB,KAAA,CACJ,WAAY,CAAE,UAAAC,EAAW,MAAAC,CAAM,CAAA,EAC7BF,EAEEG,EAAa,CACjB,GAAGH,EACH,MAAO,CACL,GAAGV,EACH,SAAU,MACZ,EACA,MAAO,CACL,GAAGU,EAAY,MACf,MAAAN,EACA,YAAAD,EACA,YAAAE,EACA,MAAOO,GAAO,OAChB,EACA,GAAGN,CACL,EAEO,OAAAC,MAACV,EAAkB,CAAA,GAAGgB,CAAY,CAAA,CAAA,CAC3C,CACF,CAEJ,EAEU,OAAAd,EAAA,YAAc,YAAYF,EAAiB,WAAW,IAEzDE,CACT"}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
3
3
|
import { Controller as h } from "react-hook-form";
|
|
4
|
-
import "@mantine/core";
|
|
5
4
|
import { zodValidator as v } from "../form/utils/zodValidator.mjs";
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return /* @__PURE__ */ o(
|
|
5
|
+
const y = (t, o) => {
|
|
6
|
+
const l = (e) => {
|
|
7
|
+
const { validate: r, name: a = "", placeholder: s, label: m, description: c, ...n } = e;
|
|
8
|
+
return /* @__PURE__ */ d(
|
|
11
9
|
h,
|
|
12
10
|
{
|
|
13
11
|
name: a,
|
|
14
12
|
defaultValue: "",
|
|
15
13
|
rules: {
|
|
16
|
-
validate:
|
|
14
|
+
validate: r && !e.disabled ? v(r) : void 0
|
|
17
15
|
},
|
|
18
16
|
disabled: e.disabled,
|
|
19
|
-
...
|
|
17
|
+
...o?.(e),
|
|
20
18
|
render: (i) => {
|
|
21
19
|
const {
|
|
22
20
|
fieldState: { isTouched: F, error: f }
|
|
@@ -28,21 +26,21 @@ const V = (t, d) => {
|
|
|
28
26
|
},
|
|
29
27
|
field: {
|
|
30
28
|
...i.field,
|
|
31
|
-
label:
|
|
32
|
-
placeholder:
|
|
29
|
+
label: m,
|
|
30
|
+
placeholder: s,
|
|
33
31
|
description: c,
|
|
34
32
|
error: f?.message
|
|
35
33
|
},
|
|
36
34
|
...n
|
|
37
35
|
};
|
|
38
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ d(t, { ...u });
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
);
|
|
42
40
|
};
|
|
43
|
-
return
|
|
41
|
+
return l.displayName = `withForm(${t.displayName})`, l;
|
|
44
42
|
};
|
|
45
43
|
export {
|
|
46
|
-
|
|
44
|
+
y as withForm
|
|
47
45
|
};
|
|
48
46
|
//# sourceMappingURL=withForm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withForm.mjs","sources":["../../../src/hocs/withForm.tsx"],"sourcesContent":["'use client';\r\nimport { Controller, ControllerProps } from 'react-hook-form';\r\nimport { ZodTypeAny } from 'zod';\r\nimport { zodValidator } from '../form';\r\n\r\nexport interface WithFormProps {\r\n name?: string;\r\n label?: React.ReactNode;\r\n placeholder?: string;\r\n description?: React.ReactNode;\r\n validate?: ZodTypeAny;\r\n disabled?: boolean;\r\n}\r\n\r\nexport type FormFieldProps<T = unknown> = Parameters<ControllerProps['render']>[0] & {\r\n props: T;\r\n field: {\r\n label?: React.ReactNode;\r\n placeholder?: string;\r\n description?: React.ReactNode;\r\n error?: string;\r\n };\r\n};\r\n\r\nexport const withForm = <P extends unknown>(\r\n WrappedComponent: React.ComponentType<FormFieldProps<P>>,\r\n getControllerProps?: (props: P) => Omit<Partial<ControllerProps>, 'render'>,\r\n) => {\r\n const FormField: React.FC<P & WithFormProps> = (props) => {\r\n const { validate, name = '', placeholder, label, description, ...withFormRestProps } = props;\r\n\r\n return (\r\n <Controller\r\n name={name}\r\n defaultValue={''}\r\n rules={{\r\n validate: validate && !props.disabled ? zodValidator(validate) : undefined,\r\n }}\r\n disabled={props.disabled}\r\n {...getControllerProps?.(props)}\r\n render={(renderProps) => {\r\n const {\r\n fieldState: { isTouched, error },\r\n } = renderProps;\r\n\r\n const fieldProps = {\r\n ...renderProps,\r\n props: {\r\n ...props,\r\n validate: undefined,\r\n },\r\n field: {\r\n ...renderProps.field,\r\n label,\r\n placeholder,\r\n description,\r\n error: error?.message,\r\n },\r\n ...withFormRestProps,\r\n } as FormFieldProps<P>;\r\n\r\n return <WrappedComponent {...fieldProps} />;\r\n }}\r\n />\r\n );\r\n };\r\n\r\n FormField.displayName = `withForm(${WrappedComponent.displayName})`;\r\n\r\n return FormField;\r\n};\r\n"],"names":["withForm","WrappedComponent","getControllerProps","FormField","props","validate","name","placeholder","label","description","withFormRestProps","jsx","Controller","zodValidator","renderProps","isTouched","error","fieldProps"],"mappings":";;;;AAwBa,MAAAA,IAAW,CACtBC,GACAC,MACG;AACG,QAAAC,IAAyC,CAACC,MAAU;AAClD,UAAA,EAAE,UAAAC,GAAU,MAAAC,IAAO,IAAI,aAAAC,GAAa,OAAAC,GAAO,aAAAC,GAAa,GAAGC,EAAA,IAAsBN;AAGrF,WAAA,gBAAAO;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAAN;AAAA,QACA,cAAc;AAAA,QACd,OAAO;AAAA,UACL,UAAUD,KAAY,CAACD,EAAM,WAAWS,EAAaR,CAAQ,IAAI;AAAA,QACnE;AAAA,QACA,UAAUD,EAAM;AAAA,QACf,GAAGF,IAAqBE,CAAK;AAAA,QAC9B,QAAQ,CAACU,MAAgB;AACjB,gBAAA;AAAA,YACJ,YAAY,EAAE,WAAAC,GAAW,OAAAC,EAAM;AAAA,UAAA,IAC7BF,GAEEG,IAAa;AAAA,YACjB,GAAGH;AAAA,YACH,OAAO;AAAA,cACL,GAAGV;AAAA,cACH,UAAU;AAAA,YACZ;AAAA,YACA,OAAO;AAAA,cACL,GAAGU,EAAY;AAAA,cACf,OAAAN;AAAA,cACA,aAAAD;AAAA,cACA,aAAAE;AAAA,cACA,OAAOO,GAAO;AAAA,YAChB;AAAA,YACA,GAAGN;AAAA,UACL;AAEO,iBAAA,gBAAAC,EAACV,GAAkB,EAAA,GAAGgB,EAAY,CAAA;AAAA,QAAA;AAAA,MAC3C;AAAA,IACF;AAAA,EAEJ;AAEU,SAAAd,EAAA,cAAc,YAAYF,EAAiB,WAAW,KAEzDE;AACT;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withModalManager.cjs","sources":["../../../src/hocs/withModalManager.tsx"],"sourcesContent":["'use client';\r\nimport { ModalProps } from '@mantine/core';\r\nimport { useEffect, useState } from 'react';\r\n\r\nexport interface WithModalManagerProps {\r\n removeModal: () => void;\r\n opened: boolean;\r\n}\r\n\r\nexport const withModalManager = <P extends Object>(\r\n WrappedComponent: React.ComponentType<P & ModalProps>,\r\n) => {\r\n const Component: React.FC<P & WithModalManagerProps & ModalProps> = ({\r\n removeModal,\r\n opened,\r\n ...props\r\n }) => {\r\n const [isOpen, setIsOpen] = useState(false);\r\n\r\n const onClose = () => {\r\n setIsOpen(false);\r\n setTimeout(() => removeModal(), 200);\r\n props.onClose?.();\r\n };\r\n\r\n useEffect(() => {\r\n if (opened) setTimeout(() => setIsOpen(true), 0);\r\n else onClose();\r\n }, [opened]);\r\n\r\n return (\r\n <WrappedComponent\r\n {...(props as P)}\r\n opened={isOpen}\r\n onClose={onClose}\r\n />\r\n );\r\n };\r\n\r\n Component.displayName = `withModalManager(${WrappedComponent.displayName})`;\r\n\r\n return Component;\r\n};\r\n"],"names":["withModalManager","WrappedComponent","Component","removeModal","opened","props","isOpen","setIsOpen","useState","onClose","useEffect","jsx"],"mappings":"qJASaA,EACXC,GACG,CACH,MAAMC,EAA8D,CAAC,CACnE,YAAAC,EACA,OAAAC,EACA,GAAGC,CAAA,IACC,CACJ,KAAM,CAACC,EAAQC,CAAS,EAAIC,EAAAA,SAAS,EAAK,EAEpCC,EAAU,IAAM,CACpBF,EAAU,EAAK,EACJ,WAAA,IAAMJ,EAAY,EAAG,GAAG,EACnCE,EAAM,UAAU,CAClB,EAEAK,OAAAA,EAAAA,UAAU,IAAM,CACVN,EAAmB,WAAA,IAAMG,EAAU,EAAI,EAAG,CAAC,EAClCE,EAAA,CAAA,EACZ,CAACL,CAAM,CAAC,EAGTO,EAAA,IAACV,EAAA,CACE,GAAII,EACL,OAAQC,EACR,QAAAG,CAAA,CACF,CAEJ,EAEU,OAAAP,EAAA,YAAc,oBAAoBD,EAAiB,WAAW,IAEjEC,CACT"}
|