@raystack/apsara 0.53.1 → 0.53.3
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/components/calendar/date-picker.cjs +1 -1
- package/dist/components/calendar/date-picker.cjs.map +1 -1
- package/dist/components/calendar/date-picker.js +1 -1
- package/dist/components/calendar/date-picker.js.map +1 -1
- package/dist/hooks/index.cjs +2 -0
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useDebouncedState.cjs +41 -0
- package/dist/hooks/useDebouncedState.cjs.map +1 -0
- package/dist/hooks/useDebouncedState.d.ts +28 -0
- package/dist/hooks/useDebouncedState.d.ts.map +1 -0
- package/dist/hooks/useDebouncedState.js +39 -0
- package/dist/hooks/useDebouncedState.js.map +1 -0
- package/package.json +1 -1
|
@@ -113,7 +113,7 @@ function DatePicker({ dateFormat = 'DD/MM/YYYY', inputFieldProps, calendarProps,
|
|
|
113
113
|
setError('Invalid date');
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
const defaultTrigger = (jsxRuntime.jsx(inputField.InputField, { size: 'small', placeholder: 'Select date', error: error, className: calendar_module.default.datePickerInput, trailingIcon: showCalendarIcon ? jsxRuntime.jsx(reactIcons_esm.CalendarIcon, {}) : undefined, ...inputFieldProps, ref: inputFieldRef,
|
|
116
|
+
const defaultTrigger = (jsxRuntime.jsx(inputField.InputField, { size: 'small', placeholder: 'Select date', error: error, className: calendar_module.default.datePickerInput, trailingIcon: showCalendarIcon ? jsxRuntime.jsx(reactIcons_esm.CalendarIcon, {}) : undefined, ...inputFieldProps, ref: inputFieldRef, value: formattedDate, onChange: handleInputChange, onFocus: handleInputFocus, onBlur: handleInputBlur, onKeyUp: handleKeyUp }));
|
|
117
117
|
const trigger = typeof children === 'function' ? (children({ selectedDate: formattedDate })) : children ? (jsxRuntime.jsx("div", { children: children })) : (jsxRuntime.jsx("div", { children: defaultTrigger }));
|
|
118
118
|
return (jsxRuntime.jsxs(popover.Popover, { open: showCalendar, onOpenChange: onOpenChange, children: [jsxRuntime.jsx(popover.Popover.Trigger, { asChild: true, children: trigger }), jsxRuntime.jsx(popover.Popover.Content, { ref: contentRef, ...popoverProps, className: index.cx(calendar_module.default.calendarPopover, popoverProps?.className), side: popoverProps?.side ?? 'top', children: jsxRuntime.jsx(calendar.Calendar, { required: true, ...calendarProps, timeZone: timeZone, onDropdownOpen: onDropdownOpen, mode: 'single', selected: selectedDate, month: selectedDate, onSelect: handleSelect, onMonthChange: setSelectedDate }) })] }));
|
|
119
119
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.cjs","sources":["../../../components/calendar/date-picker.tsx"],"sourcesContent":["'use client';\n\nimport { CalendarIcon } from '@radix-ui/react-icons';\nimport { cx } from 'class-variance-authority';\nimport dayjs from 'dayjs';\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { PropsBase, PropsSingleRequired } from 'react-day-picker';\nimport { InputField } from '../input-field';\nimport { InputFieldProps } from '../input-field/input-field';\nimport { Popover } from '../popover';\nimport { PopoverContentProps } from '../popover/popover';\nimport { Calendar } from './calendar';\nimport styles from './calendar.module.css';\n\ndayjs.extend(customParseFormat);\n\ninterface DatePickerProps {\n dateFormat?: string;\n inputFieldProps?: InputFieldProps;\n calendarProps?: PropsSingleRequired & PropsBase;\n onSelect?: (date: Date) => void;\n value?: Date;\n children?:\n | React.ReactNode\n | ((props: { selectedDate: string }) => React.ReactNode);\n showCalendarIcon?: boolean;\n timeZone?: string;\n popoverProps?: PopoverContentProps;\n}\n\nexport function DatePicker({\n dateFormat = 'DD/MM/YYYY',\n inputFieldProps,\n calendarProps,\n value = new Date(),\n onSelect = () => {},\n children,\n showCalendarIcon = true,\n timeZone,\n popoverProps\n}: DatePickerProps) {\n const [showCalendar, setShowCalendar] = useState(false);\n const [selectedDate, setSelectedDate] = useState(value);\n const [error, setError] = useState<string>();\n\n const formattedDate = dayjs(selectedDate).format(dateFormat);\n\n const isDropdownOpenRef = useRef(false);\n const inputFieldRef = useRef<HTMLInputElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const isInputFieldFocused = useRef(false);\n const selectedDateRef = useRef(selectedDate);\n\n useEffect(() => {\n selectedDateRef.current = selectedDate;\n }, [selectedDate]);\n\n const isElementOutside = useCallback((el: HTMLElement) => {\n return (\n !isDropdownOpenRef.current && // Month and Year dropdown from Date picker\n !inputFieldRef.current?.contains(el) && // InputField\n !contentRef.current?.contains(el)\n );\n }, []);\n\n const handleMouseDown = useCallback(\n (event: MouseEvent) => {\n const el = event.target as HTMLElement | null;\n if (el && isElementOutside(el)) removeEventListeners();\n },\n [isElementOutside]\n );\n\n function registerEventListeners() {\n isInputFieldFocused.current = true;\n document.addEventListener('mouseup', handleMouseDown);\n }\n\n function removeEventListeners(skipUpdate = false) {\n isInputFieldFocused.current = false;\n setShowCalendar(false);\n\n const updatedVal = dayjs(selectedDateRef.current).format(dateFormat);\n\n if (inputFieldRef.current) inputFieldRef.current.value = updatedVal;\n if (!error && !skipUpdate) onSelect(dayjs(updatedVal).toDate());\n\n document.removeEventListener('mouseup', handleMouseDown);\n }\n\n const handleSelect = (day: Date) => {\n setSelectedDate(day);\n onSelect(day);\n setError(undefined);\n removeEventListeners(true);\n };\n\n function onDropdownOpen() {\n isDropdownOpenRef.current = true;\n }\n\n function onOpenChange(open?: boolean) {\n if (\n !isDropdownOpenRef.current &&\n !(isInputFieldFocused.current && showCalendar)\n ) {\n setShowCalendar(Boolean(open));\n }\n\n isDropdownOpenRef.current = false;\n }\n\n function handleInputFocus() {\n if (isInputFieldFocused.current) return;\n if (!showCalendar) setShowCalendar(true);\n }\n\n function handleInputBlur(event: React.FocusEvent) {\n if (isInputFieldFocused.current) {\n const el = event.relatedTarget as HTMLElement | null;\n if (el && isElementOutside(el)) removeEventListeners();\n } else {\n registerEventListeners();\n setTimeout(() => inputFieldRef.current?.select());\n }\n }\n\n function handleKeyUp(event: React.KeyboardEvent) {\n if (event.code === 'Enter' && inputFieldRef.current) {\n inputFieldRef.current.blur();\n removeEventListeners();\n }\n }\n\n function handleInputChange(event: React.ChangeEvent<HTMLInputElement>) {\n const { value } = event.target;\n\n const format = value.includes('/')\n ? 'DD/MM/YYYY'\n : value.includes('-')\n ? 'DD-MM-YYYY'\n : undefined;\n const date = dayjs(value, format);\n\n const isValidDate = date.isValid();\n\n const isAfter =\n calendarProps?.startMonth !== undefined\n ? dayjs(date).isSameOrAfter(calendarProps.startMonth)\n : true;\n const isBefore =\n calendarProps?.endMonth !== undefined\n ? dayjs(date).isSameOrBefore(calendarProps.endMonth)\n : true;\n\n const isValid =\n isValidDate && isAfter && isBefore && dayjs(date).isSameOrBefore(dayjs());\n\n if (isValid) {\n setSelectedDate(date.toDate());\n setError(undefined);\n } else {\n setError('Invalid date');\n }\n }\n\n const defaultTrigger = (\n <InputField\n size='small'\n placeholder='Select date'\n error={error}\n className={styles.datePickerInput}\n trailingIcon={showCalendarIcon ? <CalendarIcon /> : undefined}\n {...inputFieldProps}\n ref={inputFieldRef}\n
|
|
1
|
+
{"version":3,"file":"date-picker.cjs","sources":["../../../components/calendar/date-picker.tsx"],"sourcesContent":["'use client';\n\nimport { CalendarIcon } from '@radix-ui/react-icons';\nimport { cx } from 'class-variance-authority';\nimport dayjs from 'dayjs';\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { PropsBase, PropsSingleRequired } from 'react-day-picker';\nimport { InputField } from '../input-field';\nimport { InputFieldProps } from '../input-field/input-field';\nimport { Popover } from '../popover';\nimport { PopoverContentProps } from '../popover/popover';\nimport { Calendar } from './calendar';\nimport styles from './calendar.module.css';\n\ndayjs.extend(customParseFormat);\n\ninterface DatePickerProps {\n dateFormat?: string;\n inputFieldProps?: InputFieldProps;\n calendarProps?: PropsSingleRequired & PropsBase;\n onSelect?: (date: Date) => void;\n value?: Date;\n children?:\n | React.ReactNode\n | ((props: { selectedDate: string }) => React.ReactNode);\n showCalendarIcon?: boolean;\n timeZone?: string;\n popoverProps?: PopoverContentProps;\n}\n\nexport function DatePicker({\n dateFormat = 'DD/MM/YYYY',\n inputFieldProps,\n calendarProps,\n value = new Date(),\n onSelect = () => {},\n children,\n showCalendarIcon = true,\n timeZone,\n popoverProps\n}: DatePickerProps) {\n const [showCalendar, setShowCalendar] = useState(false);\n const [selectedDate, setSelectedDate] = useState(value);\n const [error, setError] = useState<string>();\n\n const formattedDate = dayjs(selectedDate).format(dateFormat);\n\n const isDropdownOpenRef = useRef(false);\n const inputFieldRef = useRef<HTMLInputElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const isInputFieldFocused = useRef(false);\n const selectedDateRef = useRef(selectedDate);\n\n useEffect(() => {\n selectedDateRef.current = selectedDate;\n }, [selectedDate]);\n\n const isElementOutside = useCallback((el: HTMLElement) => {\n return (\n !isDropdownOpenRef.current && // Month and Year dropdown from Date picker\n !inputFieldRef.current?.contains(el) && // InputField\n !contentRef.current?.contains(el)\n );\n }, []);\n\n const handleMouseDown = useCallback(\n (event: MouseEvent) => {\n const el = event.target as HTMLElement | null;\n if (el && isElementOutside(el)) removeEventListeners();\n },\n [isElementOutside]\n );\n\n function registerEventListeners() {\n isInputFieldFocused.current = true;\n document.addEventListener('mouseup', handleMouseDown);\n }\n\n function removeEventListeners(skipUpdate = false) {\n isInputFieldFocused.current = false;\n setShowCalendar(false);\n\n const updatedVal = dayjs(selectedDateRef.current).format(dateFormat);\n\n if (inputFieldRef.current) inputFieldRef.current.value = updatedVal;\n if (!error && !skipUpdate) onSelect(dayjs(updatedVal).toDate());\n\n document.removeEventListener('mouseup', handleMouseDown);\n }\n\n const handleSelect = (day: Date) => {\n setSelectedDate(day);\n onSelect(day);\n setError(undefined);\n removeEventListeners(true);\n };\n\n function onDropdownOpen() {\n isDropdownOpenRef.current = true;\n }\n\n function onOpenChange(open?: boolean) {\n if (\n !isDropdownOpenRef.current &&\n !(isInputFieldFocused.current && showCalendar)\n ) {\n setShowCalendar(Boolean(open));\n }\n\n isDropdownOpenRef.current = false;\n }\n\n function handleInputFocus() {\n if (isInputFieldFocused.current) return;\n if (!showCalendar) setShowCalendar(true);\n }\n\n function handleInputBlur(event: React.FocusEvent) {\n if (isInputFieldFocused.current) {\n const el = event.relatedTarget as HTMLElement | null;\n if (el && isElementOutside(el)) removeEventListeners();\n } else {\n registerEventListeners();\n setTimeout(() => inputFieldRef.current?.select());\n }\n }\n\n function handleKeyUp(event: React.KeyboardEvent) {\n if (event.code === 'Enter' && inputFieldRef.current) {\n inputFieldRef.current.blur();\n removeEventListeners();\n }\n }\n\n function handleInputChange(event: React.ChangeEvent<HTMLInputElement>) {\n const { value } = event.target;\n\n const format = value.includes('/')\n ? 'DD/MM/YYYY'\n : value.includes('-')\n ? 'DD-MM-YYYY'\n : undefined;\n const date = dayjs(value, format);\n\n const isValidDate = date.isValid();\n\n const isAfter =\n calendarProps?.startMonth !== undefined\n ? dayjs(date).isSameOrAfter(calendarProps.startMonth)\n : true;\n const isBefore =\n calendarProps?.endMonth !== undefined\n ? dayjs(date).isSameOrBefore(calendarProps.endMonth)\n : true;\n\n const isValid =\n isValidDate && isAfter && isBefore && dayjs(date).isSameOrBefore(dayjs());\n\n if (isValid) {\n setSelectedDate(date.toDate());\n setError(undefined);\n } else {\n setError('Invalid date');\n }\n }\n\n const defaultTrigger = (\n <InputField\n size='small'\n placeholder='Select date'\n error={error}\n className={styles.datePickerInput}\n trailingIcon={showCalendarIcon ? <CalendarIcon /> : undefined}\n {...inputFieldProps}\n ref={inputFieldRef}\n value={formattedDate}\n onChange={handleInputChange}\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n onKeyUp={handleKeyUp}\n />\n );\n\n const trigger =\n typeof children === 'function' ? (\n children({ selectedDate: formattedDate })\n ) : children ? (\n <div>{children}</div>\n ) : (\n <div>{defaultTrigger}</div>\n );\n\n return (\n <Popover open={showCalendar} onOpenChange={onOpenChange}>\n <Popover.Trigger asChild>{trigger}</Popover.Trigger>\n <Popover.Content\n ref={contentRef}\n {...popoverProps}\n className={cx(styles.calendarPopover, popoverProps?.className)}\n side={popoverProps?.side ?? 'top'}\n >\n <Calendar\n required={true}\n {...calendarProps}\n timeZone={timeZone}\n onDropdownOpen={onDropdownOpen}\n mode='single'\n selected={selectedDate}\n month={selectedDate}\n onSelect={handleSelect}\n onMonthChange={setSelectedDate}\n />\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["dayjs"],"mappings":";;;;;;;;;;;;;;AAeAA;AAgBgB;;;;;AAiBd;AACA;AACA;AACA;AACA;;AAGE;AACF;AAEA;AACE;;;;AAOF;AAEI;AACA;AAAgC;AAClC;AAIF;AACE;AACA;;AAGF;AACE;;AAGA;;AAE2B;AAC3B;;AAEA;;AAGF;;;;;AAKA;AAEA;AACE;;;;;AAQE;;AAGF;;AAGF;;;AAEE;;;;AAIA;AACE;AACA;AAAgC;;;AAEhC;;;;;;AAOA;AACA;;;;AAKF;AAEA;AACE;AACA;AACE;;;AAIJ;AAEA;;;AAIA;;;AAKA;;AAIE;;;;;;;AAOJ;AAiBA;;AAgCF;;"}
|
|
@@ -111,7 +111,7 @@ function DatePicker({ dateFormat = 'DD/MM/YYYY', inputFieldProps, calendarProps,
|
|
|
111
111
|
setError('Invalid date');
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
const defaultTrigger = (jsx(InputField, { size: 'small', placeholder: 'Select date', error: error, className: styles.datePickerInput, trailingIcon: showCalendarIcon ? jsx(CalendarIcon, {}) : undefined, ...inputFieldProps, ref: inputFieldRef,
|
|
114
|
+
const defaultTrigger = (jsx(InputField, { size: 'small', placeholder: 'Select date', error: error, className: styles.datePickerInput, trailingIcon: showCalendarIcon ? jsx(CalendarIcon, {}) : undefined, ...inputFieldProps, ref: inputFieldRef, value: formattedDate, onChange: handleInputChange, onFocus: handleInputFocus, onBlur: handleInputBlur, onKeyUp: handleKeyUp }));
|
|
115
115
|
const trigger = typeof children === 'function' ? (children({ selectedDate: formattedDate })) : children ? (jsx("div", { children: children })) : (jsx("div", { children: defaultTrigger }));
|
|
116
116
|
return (jsxs(Popover, { open: showCalendar, onOpenChange: onOpenChange, children: [jsx(Popover.Trigger, { asChild: true, children: trigger }), jsx(Popover.Content, { ref: contentRef, ...popoverProps, className: cx(styles.calendarPopover, popoverProps?.className), side: popoverProps?.side ?? 'top', children: jsx(Calendar, { required: true, ...calendarProps, timeZone: timeZone, onDropdownOpen: onDropdownOpen, mode: 'single', selected: selectedDate, month: selectedDate, onSelect: handleSelect, onMonthChange: setSelectedDate }) })] }));
|
|
117
117
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.js","sources":["../../../components/calendar/date-picker.tsx"],"sourcesContent":["'use client';\n\nimport { CalendarIcon } from '@radix-ui/react-icons';\nimport { cx } from 'class-variance-authority';\nimport dayjs from 'dayjs';\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { PropsBase, PropsSingleRequired } from 'react-day-picker';\nimport { InputField } from '../input-field';\nimport { InputFieldProps } from '../input-field/input-field';\nimport { Popover } from '../popover';\nimport { PopoverContentProps } from '../popover/popover';\nimport { Calendar } from './calendar';\nimport styles from './calendar.module.css';\n\ndayjs.extend(customParseFormat);\n\ninterface DatePickerProps {\n dateFormat?: string;\n inputFieldProps?: InputFieldProps;\n calendarProps?: PropsSingleRequired & PropsBase;\n onSelect?: (date: Date) => void;\n value?: Date;\n children?:\n | React.ReactNode\n | ((props: { selectedDate: string }) => React.ReactNode);\n showCalendarIcon?: boolean;\n timeZone?: string;\n popoverProps?: PopoverContentProps;\n}\n\nexport function DatePicker({\n dateFormat = 'DD/MM/YYYY',\n inputFieldProps,\n calendarProps,\n value = new Date(),\n onSelect = () => {},\n children,\n showCalendarIcon = true,\n timeZone,\n popoverProps\n}: DatePickerProps) {\n const [showCalendar, setShowCalendar] = useState(false);\n const [selectedDate, setSelectedDate] = useState(value);\n const [error, setError] = useState<string>();\n\n const formattedDate = dayjs(selectedDate).format(dateFormat);\n\n const isDropdownOpenRef = useRef(false);\n const inputFieldRef = useRef<HTMLInputElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const isInputFieldFocused = useRef(false);\n const selectedDateRef = useRef(selectedDate);\n\n useEffect(() => {\n selectedDateRef.current = selectedDate;\n }, [selectedDate]);\n\n const isElementOutside = useCallback((el: HTMLElement) => {\n return (\n !isDropdownOpenRef.current && // Month and Year dropdown from Date picker\n !inputFieldRef.current?.contains(el) && // InputField\n !contentRef.current?.contains(el)\n );\n }, []);\n\n const handleMouseDown = useCallback(\n (event: MouseEvent) => {\n const el = event.target as HTMLElement | null;\n if (el && isElementOutside(el)) removeEventListeners();\n },\n [isElementOutside]\n );\n\n function registerEventListeners() {\n isInputFieldFocused.current = true;\n document.addEventListener('mouseup', handleMouseDown);\n }\n\n function removeEventListeners(skipUpdate = false) {\n isInputFieldFocused.current = false;\n setShowCalendar(false);\n\n const updatedVal = dayjs(selectedDateRef.current).format(dateFormat);\n\n if (inputFieldRef.current) inputFieldRef.current.value = updatedVal;\n if (!error && !skipUpdate) onSelect(dayjs(updatedVal).toDate());\n\n document.removeEventListener('mouseup', handleMouseDown);\n }\n\n const handleSelect = (day: Date) => {\n setSelectedDate(day);\n onSelect(day);\n setError(undefined);\n removeEventListeners(true);\n };\n\n function onDropdownOpen() {\n isDropdownOpenRef.current = true;\n }\n\n function onOpenChange(open?: boolean) {\n if (\n !isDropdownOpenRef.current &&\n !(isInputFieldFocused.current && showCalendar)\n ) {\n setShowCalendar(Boolean(open));\n }\n\n isDropdownOpenRef.current = false;\n }\n\n function handleInputFocus() {\n if (isInputFieldFocused.current) return;\n if (!showCalendar) setShowCalendar(true);\n }\n\n function handleInputBlur(event: React.FocusEvent) {\n if (isInputFieldFocused.current) {\n const el = event.relatedTarget as HTMLElement | null;\n if (el && isElementOutside(el)) removeEventListeners();\n } else {\n registerEventListeners();\n setTimeout(() => inputFieldRef.current?.select());\n }\n }\n\n function handleKeyUp(event: React.KeyboardEvent) {\n if (event.code === 'Enter' && inputFieldRef.current) {\n inputFieldRef.current.blur();\n removeEventListeners();\n }\n }\n\n function handleInputChange(event: React.ChangeEvent<HTMLInputElement>) {\n const { value } = event.target;\n\n const format = value.includes('/')\n ? 'DD/MM/YYYY'\n : value.includes('-')\n ? 'DD-MM-YYYY'\n : undefined;\n const date = dayjs(value, format);\n\n const isValidDate = date.isValid();\n\n const isAfter =\n calendarProps?.startMonth !== undefined\n ? dayjs(date).isSameOrAfter(calendarProps.startMonth)\n : true;\n const isBefore =\n calendarProps?.endMonth !== undefined\n ? dayjs(date).isSameOrBefore(calendarProps.endMonth)\n : true;\n\n const isValid =\n isValidDate && isAfter && isBefore && dayjs(date).isSameOrBefore(dayjs());\n\n if (isValid) {\n setSelectedDate(date.toDate());\n setError(undefined);\n } else {\n setError('Invalid date');\n }\n }\n\n const defaultTrigger = (\n <InputField\n size='small'\n placeholder='Select date'\n error={error}\n className={styles.datePickerInput}\n trailingIcon={showCalendarIcon ? <CalendarIcon /> : undefined}\n {...inputFieldProps}\n ref={inputFieldRef}\n
|
|
1
|
+
{"version":3,"file":"date-picker.js","sources":["../../../components/calendar/date-picker.tsx"],"sourcesContent":["'use client';\n\nimport { CalendarIcon } from '@radix-ui/react-icons';\nimport { cx } from 'class-variance-authority';\nimport dayjs from 'dayjs';\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { PropsBase, PropsSingleRequired } from 'react-day-picker';\nimport { InputField } from '../input-field';\nimport { InputFieldProps } from '../input-field/input-field';\nimport { Popover } from '../popover';\nimport { PopoverContentProps } from '../popover/popover';\nimport { Calendar } from './calendar';\nimport styles from './calendar.module.css';\n\ndayjs.extend(customParseFormat);\n\ninterface DatePickerProps {\n dateFormat?: string;\n inputFieldProps?: InputFieldProps;\n calendarProps?: PropsSingleRequired & PropsBase;\n onSelect?: (date: Date) => void;\n value?: Date;\n children?:\n | React.ReactNode\n | ((props: { selectedDate: string }) => React.ReactNode);\n showCalendarIcon?: boolean;\n timeZone?: string;\n popoverProps?: PopoverContentProps;\n}\n\nexport function DatePicker({\n dateFormat = 'DD/MM/YYYY',\n inputFieldProps,\n calendarProps,\n value = new Date(),\n onSelect = () => {},\n children,\n showCalendarIcon = true,\n timeZone,\n popoverProps\n}: DatePickerProps) {\n const [showCalendar, setShowCalendar] = useState(false);\n const [selectedDate, setSelectedDate] = useState(value);\n const [error, setError] = useState<string>();\n\n const formattedDate = dayjs(selectedDate).format(dateFormat);\n\n const isDropdownOpenRef = useRef(false);\n const inputFieldRef = useRef<HTMLInputElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const isInputFieldFocused = useRef(false);\n const selectedDateRef = useRef(selectedDate);\n\n useEffect(() => {\n selectedDateRef.current = selectedDate;\n }, [selectedDate]);\n\n const isElementOutside = useCallback((el: HTMLElement) => {\n return (\n !isDropdownOpenRef.current && // Month and Year dropdown from Date picker\n !inputFieldRef.current?.contains(el) && // InputField\n !contentRef.current?.contains(el)\n );\n }, []);\n\n const handleMouseDown = useCallback(\n (event: MouseEvent) => {\n const el = event.target as HTMLElement | null;\n if (el && isElementOutside(el)) removeEventListeners();\n },\n [isElementOutside]\n );\n\n function registerEventListeners() {\n isInputFieldFocused.current = true;\n document.addEventListener('mouseup', handleMouseDown);\n }\n\n function removeEventListeners(skipUpdate = false) {\n isInputFieldFocused.current = false;\n setShowCalendar(false);\n\n const updatedVal = dayjs(selectedDateRef.current).format(dateFormat);\n\n if (inputFieldRef.current) inputFieldRef.current.value = updatedVal;\n if (!error && !skipUpdate) onSelect(dayjs(updatedVal).toDate());\n\n document.removeEventListener('mouseup', handleMouseDown);\n }\n\n const handleSelect = (day: Date) => {\n setSelectedDate(day);\n onSelect(day);\n setError(undefined);\n removeEventListeners(true);\n };\n\n function onDropdownOpen() {\n isDropdownOpenRef.current = true;\n }\n\n function onOpenChange(open?: boolean) {\n if (\n !isDropdownOpenRef.current &&\n !(isInputFieldFocused.current && showCalendar)\n ) {\n setShowCalendar(Boolean(open));\n }\n\n isDropdownOpenRef.current = false;\n }\n\n function handleInputFocus() {\n if (isInputFieldFocused.current) return;\n if (!showCalendar) setShowCalendar(true);\n }\n\n function handleInputBlur(event: React.FocusEvent) {\n if (isInputFieldFocused.current) {\n const el = event.relatedTarget as HTMLElement | null;\n if (el && isElementOutside(el)) removeEventListeners();\n } else {\n registerEventListeners();\n setTimeout(() => inputFieldRef.current?.select());\n }\n }\n\n function handleKeyUp(event: React.KeyboardEvent) {\n if (event.code === 'Enter' && inputFieldRef.current) {\n inputFieldRef.current.blur();\n removeEventListeners();\n }\n }\n\n function handleInputChange(event: React.ChangeEvent<HTMLInputElement>) {\n const { value } = event.target;\n\n const format = value.includes('/')\n ? 'DD/MM/YYYY'\n : value.includes('-')\n ? 'DD-MM-YYYY'\n : undefined;\n const date = dayjs(value, format);\n\n const isValidDate = date.isValid();\n\n const isAfter =\n calendarProps?.startMonth !== undefined\n ? dayjs(date).isSameOrAfter(calendarProps.startMonth)\n : true;\n const isBefore =\n calendarProps?.endMonth !== undefined\n ? dayjs(date).isSameOrBefore(calendarProps.endMonth)\n : true;\n\n const isValid =\n isValidDate && isAfter && isBefore && dayjs(date).isSameOrBefore(dayjs());\n\n if (isValid) {\n setSelectedDate(date.toDate());\n setError(undefined);\n } else {\n setError('Invalid date');\n }\n }\n\n const defaultTrigger = (\n <InputField\n size='small'\n placeholder='Select date'\n error={error}\n className={styles.datePickerInput}\n trailingIcon={showCalendarIcon ? <CalendarIcon /> : undefined}\n {...inputFieldProps}\n ref={inputFieldRef}\n value={formattedDate}\n onChange={handleInputChange}\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n onKeyUp={handleKeyUp}\n />\n );\n\n const trigger =\n typeof children === 'function' ? (\n children({ selectedDate: formattedDate })\n ) : children ? (\n <div>{children}</div>\n ) : (\n <div>{defaultTrigger}</div>\n );\n\n return (\n <Popover open={showCalendar} onOpenChange={onOpenChange}>\n <Popover.Trigger asChild>{trigger}</Popover.Trigger>\n <Popover.Content\n ref={contentRef}\n {...popoverProps}\n className={cx(styles.calendarPopover, popoverProps?.className)}\n side={popoverProps?.side ?? 'top'}\n >\n <Calendar\n required={true}\n {...calendarProps}\n timeZone={timeZone}\n onDropdownOpen={onDropdownOpen}\n mode='single'\n selected={selectedDate}\n month={selectedDate}\n onSelect={handleSelect}\n onMonthChange={setSelectedDate}\n />\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAeA;AAgBgB;;;;;AAiBd;AACA;AACA;AACA;AACA;;AAGE;AACF;AAEA;AACE;;;;AAOF;AAEI;AACA;AAAgC;AAClC;AAIF;AACE;AACA;;AAGF;AACE;;AAGA;;AAE2B;AAC3B;;AAEA;;AAGF;;;;;AAKA;AAEA;AACE;;;;;AAQE;;AAGF;;AAGF;;;AAEE;;;;AAIA;AACE;AACA;AAAgC;;;AAEhC;;;;;;AAOA;AACA;;;;AAKF;AAEA;AACE;AACA;AACE;;;AAIJ;AAEA;;;AAIA;;;AAKA;;AAIE;;;;;;;AAOJ;AAiBA;;AAgCF;;"}
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
var useCopyToClipboard = require('./useCopyToClipboard.cjs');
|
|
4
4
|
var useMouse = require('./useMouse.cjs');
|
|
5
5
|
var useIsomorphicLayoutEffect = require('./useIsomorphicLayoutEffect.cjs');
|
|
6
|
+
var useDebouncedState = require('./useDebouncedState.cjs');
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
exports.useCopyToClipboard = useCopyToClipboard.useCopyToClipboard;
|
|
10
11
|
exports.useMouse = useMouse.useMouse;
|
|
11
12
|
exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect.useIsomorphicLayoutEffect;
|
|
13
|
+
exports.useDebouncedState = useDebouncedState.useDebouncedState;
|
|
12
14
|
//# sourceMappingURL=index.cjs.map
|
package/dist/hooks/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../hooks/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../hooks/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { useCopyToClipboard } from './useCopyToClipboard.js';
|
|
2
2
|
export { useMouse } from './useMouse.js';
|
|
3
3
|
export { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect.js';
|
|
4
|
+
export { useDebouncedState } from './useDebouncedState.js';
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
package/dist/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A hook that debounces the state update.
|
|
7
|
+
* @param defaultValue - The default value of the state.
|
|
8
|
+
* @param delay - The delay time in milliseconds.
|
|
9
|
+
* @param options - The options for the hook.
|
|
10
|
+
* @returns A tuple containing the current value and the debounced set value function.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const [value, setValue] = useDebouncedState('Hello', 1000);
|
|
14
|
+
|
|
15
|
+
* @example
|
|
16
|
+
* const [value, setValue] = useDebouncedState('Hello', 1000, { leading: true });
|
|
17
|
+
*/
|
|
18
|
+
function useDebouncedState(defaultValue, delay, options = { leading: false }) {
|
|
19
|
+
const [value, setValue] = react.useState(defaultValue);
|
|
20
|
+
const timeoutRef = react.useRef(null);
|
|
21
|
+
const leadingRef = react.useRef(true);
|
|
22
|
+
const clearTimeout = react.useCallback(() => window.clearTimeout(timeoutRef.current), []);
|
|
23
|
+
react.useEffect(() => clearTimeout, [clearTimeout]);
|
|
24
|
+
const debouncedSetValue = react.useCallback((newValue) => {
|
|
25
|
+
clearTimeout();
|
|
26
|
+
if (leadingRef.current && options.leading) {
|
|
27
|
+
setValue(newValue);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
timeoutRef.current = window.setTimeout(() => {
|
|
31
|
+
leadingRef.current = true;
|
|
32
|
+
setValue(newValue);
|
|
33
|
+
}, delay);
|
|
34
|
+
}
|
|
35
|
+
leadingRef.current = false;
|
|
36
|
+
}, [options.leading, clearTimeout, delay]);
|
|
37
|
+
return [value, debouncedSetValue];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
exports.useDebouncedState = useDebouncedState;
|
|
41
|
+
//# sourceMappingURL=useDebouncedState.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebouncedState.cjs","sources":["../../hooks/useDebouncedState.tsx"],"sourcesContent":["import {\n SetStateAction,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react';\n\nexport interface UseDebouncedStateOptions {\n /**\n * If `true`, the state will be updated immediately on the first call (leading edge).\n * Subsequent calls within the delay period will be debounced.\n * @default false\n */\n leading?: boolean;\n}\n\nexport type UseDebouncedStateReturnValue<T> = [\n T,\n (newValue: SetStateAction<T>) => void\n];\n\n/**\n * A hook that debounces the state update.\n * @param defaultValue - The default value of the state.\n * @param delay - The delay time in milliseconds.\n * @param options - The options for the hook.\n * @returns A tuple containing the current value and the debounced set value function.\n *\n * @example\n * const [value, setValue] = useDebouncedState('Hello', 1000);\n\n * @example\n * const [value, setValue] = useDebouncedState('Hello', 1000, { leading: true });\n */\nexport function useDebouncedState<T = any>(\n defaultValue: T,\n delay: number,\n options: UseDebouncedStateOptions = { leading: false }\n): UseDebouncedStateReturnValue<T> {\n const [value, setValue] = useState(defaultValue);\n const timeoutRef = useRef<number | null>(null);\n const leadingRef = useRef(true);\n\n const clearTimeout = useCallback(\n () => window.clearTimeout(timeoutRef.current!),\n []\n );\n useEffect(() => clearTimeout, [clearTimeout]);\n\n const debouncedSetValue = useCallback(\n (newValue: SetStateAction<T>) => {\n clearTimeout();\n if (leadingRef.current && options.leading) {\n setValue(newValue);\n } else {\n timeoutRef.current = window.setTimeout(() => {\n leadingRef.current = true;\n setValue(newValue);\n }, delay);\n }\n leadingRef.current = false;\n },\n [options.leading, clearTimeout, delay]\n );\n\n return [value, debouncedSetValue] as const;\n}\n"],"names":["useState","useRef","useCallback","useEffect"],"mappings":";;;;AAsBA;;;;;;;;;;;;AAYG;AACa,SAAA,iBAAiB,CAC/B,YAAe,EACf,KAAa,EACb,OAAA,GAAoC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAA;IAEtD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAGA,cAAQ,CAAC,YAAY,CAAC,CAAC;AACjD,IAAA,MAAM,UAAU,GAAGC,YAAM,CAAgB,IAAI,CAAC,CAAC;AAC/C,IAAA,MAAM,UAAU,GAAGA,YAAM,CAAC,IAAI,CAAC,CAAC;AAEhC,IAAA,MAAM,YAAY,GAAGC,iBAAW,CAC9B,MAAM,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,OAAQ,CAAC,EAC9C,EAAE,CACH,CAAC;IACFC,eAAS,CAAC,MAAM,YAAY,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;AAE9C,IAAA,MAAM,iBAAiB,GAAGD,iBAAW,CACnC,CAAC,QAA2B,KAAI;AAC9B,QAAA,YAAY,EAAE,CAAC;QACf,IAAI,UAAU,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE;YACzC,QAAQ,CAAC,QAAQ,CAAC,CAAC;SACpB;aAAM;YACL,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,MAAK;AAC1C,gBAAA,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC;gBAC1B,QAAQ,CAAC,QAAQ,CAAC,CAAC;aACpB,EAAE,KAAK,CAAC,CAAC;SACX;AACD,QAAA,UAAU,CAAC,OAAO,GAAG,KAAK,CAAC;KAC5B,EACD,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,CACvC,CAAC;AAEF,IAAA,OAAO,CAAC,KAAK,EAAE,iBAAiB,CAAU,CAAC;AAC7C;;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SetStateAction } from 'react';
|
|
2
|
+
export interface UseDebouncedStateOptions {
|
|
3
|
+
/**
|
|
4
|
+
* If `true`, the state will be updated immediately on the first call (leading edge).
|
|
5
|
+
* Subsequent calls within the delay period will be debounced.
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
leading?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type UseDebouncedStateReturnValue<T> = [
|
|
11
|
+
T,
|
|
12
|
+
(newValue: SetStateAction<T>) => void
|
|
13
|
+
];
|
|
14
|
+
/**
|
|
15
|
+
* A hook that debounces the state update.
|
|
16
|
+
* @param defaultValue - The default value of the state.
|
|
17
|
+
* @param delay - The delay time in milliseconds.
|
|
18
|
+
* @param options - The options for the hook.
|
|
19
|
+
* @returns A tuple containing the current value and the debounced set value function.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* const [value, setValue] = useDebouncedState('Hello', 1000);
|
|
23
|
+
|
|
24
|
+
* @example
|
|
25
|
+
* const [value, setValue] = useDebouncedState('Hello', 1000, { leading: true });
|
|
26
|
+
*/
|
|
27
|
+
export declare function useDebouncedState<T = any>(defaultValue: T, delay: number, options?: UseDebouncedStateOptions): UseDebouncedStateReturnValue<T>;
|
|
28
|
+
//# sourceMappingURL=useDebouncedState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebouncedState.d.ts","sourceRoot":"","sources":["../../hooks/useDebouncedState.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAKf,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,4BAA4B,CAAC,CAAC,IAAI;IAC5C,CAAC;IACD,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,IAAI;CACtC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,GAAG,GAAG,EACvC,YAAY,EAAE,CAAC,EACf,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,wBAA6C,GACrD,4BAA4B,CAAC,CAAC,CAAC,CA4BjC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A hook that debounces the state update.
|
|
5
|
+
* @param defaultValue - The default value of the state.
|
|
6
|
+
* @param delay - The delay time in milliseconds.
|
|
7
|
+
* @param options - The options for the hook.
|
|
8
|
+
* @returns A tuple containing the current value and the debounced set value function.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const [value, setValue] = useDebouncedState('Hello', 1000);
|
|
12
|
+
|
|
13
|
+
* @example
|
|
14
|
+
* const [value, setValue] = useDebouncedState('Hello', 1000, { leading: true });
|
|
15
|
+
*/
|
|
16
|
+
function useDebouncedState(defaultValue, delay, options = { leading: false }) {
|
|
17
|
+
const [value, setValue] = useState(defaultValue);
|
|
18
|
+
const timeoutRef = useRef(null);
|
|
19
|
+
const leadingRef = useRef(true);
|
|
20
|
+
const clearTimeout = useCallback(() => window.clearTimeout(timeoutRef.current), []);
|
|
21
|
+
useEffect(() => clearTimeout, [clearTimeout]);
|
|
22
|
+
const debouncedSetValue = useCallback((newValue) => {
|
|
23
|
+
clearTimeout();
|
|
24
|
+
if (leadingRef.current && options.leading) {
|
|
25
|
+
setValue(newValue);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
timeoutRef.current = window.setTimeout(() => {
|
|
29
|
+
leadingRef.current = true;
|
|
30
|
+
setValue(newValue);
|
|
31
|
+
}, delay);
|
|
32
|
+
}
|
|
33
|
+
leadingRef.current = false;
|
|
34
|
+
}, [options.leading, clearTimeout, delay]);
|
|
35
|
+
return [value, debouncedSetValue];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { useDebouncedState };
|
|
39
|
+
//# sourceMappingURL=useDebouncedState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebouncedState.js","sources":["../../hooks/useDebouncedState.tsx"],"sourcesContent":["import {\n SetStateAction,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react';\n\nexport interface UseDebouncedStateOptions {\n /**\n * If `true`, the state will be updated immediately on the first call (leading edge).\n * Subsequent calls within the delay period will be debounced.\n * @default false\n */\n leading?: boolean;\n}\n\nexport type UseDebouncedStateReturnValue<T> = [\n T,\n (newValue: SetStateAction<T>) => void\n];\n\n/**\n * A hook that debounces the state update.\n * @param defaultValue - The default value of the state.\n * @param delay - The delay time in milliseconds.\n * @param options - The options for the hook.\n * @returns A tuple containing the current value and the debounced set value function.\n *\n * @example\n * const [value, setValue] = useDebouncedState('Hello', 1000);\n\n * @example\n * const [value, setValue] = useDebouncedState('Hello', 1000, { leading: true });\n */\nexport function useDebouncedState<T = any>(\n defaultValue: T,\n delay: number,\n options: UseDebouncedStateOptions = { leading: false }\n): UseDebouncedStateReturnValue<T> {\n const [value, setValue] = useState(defaultValue);\n const timeoutRef = useRef<number | null>(null);\n const leadingRef = useRef(true);\n\n const clearTimeout = useCallback(\n () => window.clearTimeout(timeoutRef.current!),\n []\n );\n useEffect(() => clearTimeout, [clearTimeout]);\n\n const debouncedSetValue = useCallback(\n (newValue: SetStateAction<T>) => {\n clearTimeout();\n if (leadingRef.current && options.leading) {\n setValue(newValue);\n } else {\n timeoutRef.current = window.setTimeout(() => {\n leadingRef.current = true;\n setValue(newValue);\n }, delay);\n }\n leadingRef.current = false;\n },\n [options.leading, clearTimeout, delay]\n );\n\n return [value, debouncedSetValue] as const;\n}\n"],"names":[],"mappings":";;AAsBA;;;;;;;;;;;;AAYG;AACa,SAAA,iBAAiB,CAC/B,YAAe,EACf,KAAa,EACb,OAAA,GAAoC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAA;IAEtD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;AACjD,IAAA,MAAM,UAAU,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;AAC/C,IAAA,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAEhC,IAAA,MAAM,YAAY,GAAG,WAAW,CAC9B,MAAM,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,OAAQ,CAAC,EAC9C,EAAE,CACH,CAAC;IACF,SAAS,CAAC,MAAM,YAAY,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;AAE9C,IAAA,MAAM,iBAAiB,GAAG,WAAW,CACnC,CAAC,QAA2B,KAAI;AAC9B,QAAA,YAAY,EAAE,CAAC;QACf,IAAI,UAAU,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE;YACzC,QAAQ,CAAC,QAAQ,CAAC,CAAC;SACpB;aAAM;YACL,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,MAAK;AAC1C,gBAAA,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC;gBAC1B,QAAQ,CAAC,QAAQ,CAAC,CAAC;aACpB,EAAE,KAAK,CAAC,CAAC;SACX;AACD,QAAA,UAAU,CAAC,OAAO,GAAG,KAAK,CAAC;KAC5B,EACD,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,CACvC,CAAC;AAEF,IAAA,OAAO,CAAC,KAAK,EAAE,iBAAiB,CAAU,CAAC;AAC7C;;;;"}
|