@sth87/shadcn-design-system 0.0.15 → 0.0.17

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.
Files changed (27) hide show
  1. package/dist/cjs/components/Button/ButtonGroup.cjs +1 -1
  2. package/dist/cjs/components/Calendar/Calendar.cjs +1 -1
  3. package/dist/cjs/components/Calendar/Calendar.cjs.map +1 -1
  4. package/dist/cjs/components/DatePicker/DatePicker.cjs.map +1 -1
  5. package/dist/cjs/components/DatePicker/RangePicker.cjs.map +1 -1
  6. package/dist/cjs/index.cjs +1 -1
  7. package/dist/cjs/packages/ui/src/components/button-group.cjs +1 -1
  8. package/dist/cjs/packages/ui/src/components/button-group.cjs.map +1 -1
  9. package/dist/esm/components/Button/ButtonGroup.js +28 -25
  10. package/dist/esm/components/Button/ButtonGroup.js.map +1 -1
  11. package/dist/esm/components/Calendar/Calendar.js +13 -11
  12. package/dist/esm/components/Calendar/Calendar.js.map +1 -1
  13. package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
  14. package/dist/esm/components/DatePicker/RangePicker.js.map +1 -1
  15. package/dist/esm/index.js +225 -222
  16. package/dist/esm/packages/ui/src/components/button-group.js +47 -11
  17. package/dist/esm/packages/ui/src/components/button-group.js.map +1 -1
  18. package/dist/esm/packages/ui/src/components/calendar.js +1 -1
  19. package/dist/types/components/Button/index.d.ts +1 -1
  20. package/dist/types/components/Button/index.d.ts.map +1 -1
  21. package/dist/types/components/Calendar/index.d.ts +1 -1
  22. package/dist/types/components/Calendar/index.d.ts.map +1 -1
  23. package/dist/types/components/DatePicker/DatePicker.d.ts +0 -2
  24. package/dist/types/components/DatePicker/DatePicker.d.ts.map +1 -1
  25. package/dist/types/components/DatePicker/RangePicker.d.ts +0 -2
  26. package/dist/types/components/DatePicker/RangePicker.d.ts.map +1 -1
  27. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const q=require("react/jsx-runtime"),r=require("react"),b=require("../../packages/ui/src/components/button-group.cjs"),v=require("../../packages/ui/src/lib/utils.cjs");require("class-variance-authority");const B=require("./Button.cjs"),n=r.forwardRef(({className:s,orientation:i="horizontal",variant:u,color:a,size:l,animation:o,isLoading:c,disabled:d,children:p,...m},f)=>{const g=r.Children.map(p,t=>{if(r.isValidElement(t)&&t.type===B.default){const e=t.props;return r.cloneElement(t,{variant:o==="glass"?"ghost":e.variant??u,color:e.color??a,size:e.size??l,animation:e.animation??o,isLoading:e.isLoading??c,disabled:e.disabled??d})}return t});return q.jsx(b.ButtonGroup,{ref:f,orientation:i,className:v.cn(s),...m,children:g})});n.displayName="ButtonGroup";exports.default=n;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("react/jsx-runtime"),r=require("react"),o=require("../../packages/ui/src/components/button-group.cjs"),q=require("../../packages/ui/src/lib/utils.cjs");require("class-variance-authority");const b=require("./Button.cjs"),u=r.forwardRef(({className:s,orientation:i="horizontal",variant:a,color:l,size:p,animation:n,isLoading:c,disabled:d,children:m,...B},G)=>{const f=r.Children.map(m,e=>{if(r.isValidElement(e)&&e.type===b.default){const t=e.props;return r.cloneElement(e,{variant:n==="glass"?"ghost":t.variant??a,color:t.color??l,size:t.size??p,animation:t.animation??n,isLoading:t.isLoading??c,disabled:t.disabled??d})}return e});return g.jsx(o.ButtonGroup,{ref:G,orientation:i,className:q.cn(s),...B,children:f})});u.displayName="ButtonGroup";exports.ButtonGroupSeparator=o.ButtonGroupSeparator;exports.ButtonGroupText=o.ButtonGroupText;exports.default=u;
2
2
  //# sourceMappingURL=ButtonGroup.cjs.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),m=require("../../packages/ui/src/components/calendar.cjs");require("@radix-ui/react-slot");require("../../packages/ui/src/components/button.cjs");require("../../packages/ui/src/components/button-group.cjs");require("../../packages/ui/src/components/input.cjs");require("../../packages/ui/src/components/textarea.cjs");require("@radix-ui/react-label");const p=require("../../packages/ui/src/lib/utils.cjs");require("../../packages/ui/src/components/select.cjs");require("../../packages/ui/src/components/combobox.cjs");require("@radix-ui/react-tooltip");require("../../packages/ui/src/components/popover.cjs");require("@radix-ui/react-separator");require("../../packages/ui/src/components/switch.cjs");require("vaul");require("@radix-ui/react-scroll-area");require("../../packages/ui/src/components/tree-view.cjs");require("@radix-ui/react-alert-dialog");require("react");require("@radix-ui/react-avatar");require("../../packages/ui/src/components/badge.cjs");require("lucide-react");require("../../packages/ui/src/components/checkbox.cjs");require("@radix-ui/react-collapsible");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-dropdown-menu");require("../../packages/ui/src/components/input-otp.cjs");require("../../packages/ui/src/components/radio-group.cjs");require("../../packages/ui/src/components/sidebar.cjs");require("@radix-ui/react-slider");require("../../packages/ui/src/components/tabs.cjs");require("../../packages/ui/src/components/toggle.cjs");const i=require("date-fns/locale");function f({language:u="vi",className:q,captionLayout:o="dropdown",formatters:t,buttonVariant:a,locale:e,variant:n="default",color:l="primary",...c}){const r=e||(u==="en"?i.enUS:i.vi);return d.jsx(m.Calendar,{...c,locale:r,buttonVariant:a,captionLayout:o,variant:n,color:l,formatters:{formatMonthDropdown:s=>s.toLocaleString(r.code,{month:"short"}),...t},className:p.cn("mx-auto [--cell-size:clamp(0px,calc(100vw/7.5),40px)]",q)})}exports.Calendar=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),i=require("../../packages/ui/src/components/calendar.cjs");require("@radix-ui/react-slot");require("../../packages/ui/src/components/button.cjs");require("../../packages/ui/src/components/button-group.cjs");require("../../packages/ui/src/components/input.cjs");require("../../packages/ui/src/components/textarea.cjs");require("@radix-ui/react-label");const p=require("../../packages/ui/src/lib/utils.cjs");require("../../packages/ui/src/components/select.cjs");require("../../packages/ui/src/components/combobox.cjs");require("@radix-ui/react-tooltip");require("../../packages/ui/src/components/popover.cjs");require("@radix-ui/react-separator");require("../../packages/ui/src/components/switch.cjs");require("vaul");require("@radix-ui/react-scroll-area");require("../../packages/ui/src/components/tree-view.cjs");require("@radix-ui/react-alert-dialog");require("react");require("@radix-ui/react-avatar");require("../../packages/ui/src/components/badge.cjs");require("lucide-react");require("../../packages/ui/src/components/checkbox.cjs");require("@radix-ui/react-collapsible");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-dropdown-menu");require("../../packages/ui/src/components/input-otp.cjs");require("../../packages/ui/src/components/radio-group.cjs");require("../../packages/ui/src/components/sidebar.cjs");require("@radix-ui/react-slider");require("../../packages/ui/src/components/tabs.cjs");require("../../packages/ui/src/components/toggle.cjs");const u=require("date-fns/locale");function y({language:q="vi",className:a,captionLayout:t="dropdown",formatters:n,buttonVariant:o,locale:e,variant:l="default",color:c="primary",...s}){const r=e||(q==="en"?u.enUS:u.vi);return m.jsx(i.Calendar,{...s,locale:r,buttonVariant:o,captionLayout:t,variant:l,color:c,formatters:{formatMonthDropdown:d=>d.toLocaleString(r.code,{month:"short"}),...n},className:p.cn("mx-auto [--cell-size:clamp(0px,calc(100vw/7.5),40px)]",a)})}const C=i.CalendarDayButton;exports.Calendar=y;exports.CalendarDayButton=C;
2
2
  //# sourceMappingURL=Calendar.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Calendar.cjs","sources":["../../../../src/components/Calendar/Calendar.tsx"],"sourcesContent":["import {\n CalendarDayButton as SCalendarDayButton,\n type CalendarDayButtonProps as SCalendarDayButtonProps,\n Calendar as SCalendar,\n type CalendarProps as SCalendarProps,\n type CalendarColor,\n} from \"@dsui/ui/components/calendar\";\nimport { cn } from \"@dsui/ui/index\";\nimport { vi, enUS } from \"date-fns/locale\";\n\nexport type DateRange = {\n from: Date | undefined;\n to?: Date | undefined;\n};\n\nexport type CalendarProps = SCalendarProps & {\n language?: \"vi\" | \"en\";\n variant?: \"default\" | \"rounded\";\n color?: CalendarColor;\n};\n\nexport function Calendar({\n language = \"vi\",\n className,\n captionLayout = \"dropdown\",\n formatters,\n buttonVariant,\n locale,\n variant = \"default\",\n color = \"primary\",\n ...props\n}: CalendarProps) {\n const _locale = locale ? locale : language === \"en\" ? enUS : vi;\n\n return (\n <SCalendar\n {...props}\n locale={_locale}\n buttonVariant={buttonVariant}\n captionLayout={captionLayout}\n variant={variant}\n color={color}\n formatters={{\n formatMonthDropdown: (date: Date) =>\n date.toLocaleString(_locale.code, { month: \"short\" }),\n ...formatters,\n }}\n className={cn(\n \"mx-auto [--cell-size:clamp(0px,calc(100vw/7.5),40px)]\",\n className\n )}\n />\n );\n}\n\nexport const CalendarDayButton = SCalendarDayButton;\nexport type CalendarDayButtonProps = SCalendarDayButtonProps;\nexport type { CalendarColor };\n"],"names":["Calendar","language","className","captionLayout","formatters","buttonVariant","locale","variant","color","props","_locale","enUS","vi","jsx","SCalendar","date","cn"],"mappings":"smDAqBO,SAASA,EAAS,CACvB,SAAAC,EAAW,KACX,UAAAC,EACA,cAAAC,EAAgB,WAChB,WAAAC,EACA,cAAAC,EAAA,OACAC,EACA,QAAAC,EAAU,UACV,MAAAC,EAAQ,UACR,GAAGC,CACL,EAAkB,CAChB,MAAMC,EAAUJ,IAAkBL,IAAa,KAAOU,EAAAA,KAAOC,EAAAA,IAE7D,OACEC,EAAAA,IAACC,EAAAA,SAAA,CACE,GAAGL,EACJ,OAAQC,EACR,cAAAL,EACA,cAAAF,EACA,QAAAI,EACA,MAAAC,EACA,WAAY,CACV,oBAAsBO,GACpBA,EAAK,eAAeL,EAAQ,KAAM,CAAE,MAAO,QAAS,EACtD,GAAGN,CAAA,EAEL,UAAWY,EAAAA,GACT,wDACAd,CAAA,CACF,CAAA,CAGN"}
1
+ {"version":3,"file":"Calendar.cjs","sources":["../../../../src/components/Calendar/Calendar.tsx"],"sourcesContent":["import {\n CalendarDayButton as SCalendarDayButton,\n type CalendarDayButtonProps as SCalendarDayButtonProps,\n Calendar as SCalendar,\n type CalendarProps as SCalendarProps,\n type CalendarColor,\n} from \"@dsui/ui/components/calendar\";\nimport { cn } from \"@dsui/ui/index\";\nimport { vi, enUS } from \"date-fns/locale\";\n\nexport type DateRange = {\n from: Date | undefined;\n to?: Date | undefined;\n};\n\nexport type CalendarProps = SCalendarProps & {\n language?: \"vi\" | \"en\";\n variant?: \"default\" | \"rounded\";\n color?: CalendarColor;\n};\n\nexport function Calendar({\n language = \"vi\",\n className,\n captionLayout = \"dropdown\",\n formatters,\n buttonVariant,\n locale,\n variant = \"default\",\n color = \"primary\",\n ...props\n}: CalendarProps) {\n const _locale = locale ? locale : language === \"en\" ? enUS : vi;\n\n return (\n <SCalendar\n {...props}\n locale={_locale}\n buttonVariant={buttonVariant}\n captionLayout={captionLayout}\n variant={variant}\n color={color}\n formatters={{\n formatMonthDropdown: (date: Date) =>\n date.toLocaleString(_locale.code, { month: \"short\" }),\n ...formatters,\n }}\n className={cn(\n \"mx-auto [--cell-size:clamp(0px,calc(100vw/7.5),40px)]\",\n className\n )}\n />\n );\n}\n\nexport const CalendarDayButton = SCalendarDayButton;\nexport type CalendarDayButtonProps = SCalendarDayButtonProps;\nexport type { CalendarColor };\n"],"names":["Calendar","language","className","captionLayout","formatters","buttonVariant","locale","variant","color","props","_locale","enUS","vi","jsx","SCalendar","date","cn","CalendarDayButton","SCalendarDayButton"],"mappings":"smDAqBO,SAASA,EAAS,CACvB,SAAAC,EAAW,KACX,UAAAC,EACA,cAAAC,EAAgB,WAChB,WAAAC,EACA,cAAAC,EAAA,OACAC,EACA,QAAAC,EAAU,UACV,MAAAC,EAAQ,UACR,GAAGC,CACL,EAAkB,CAChB,MAAMC,EAAUJ,IAAkBL,IAAa,KAAOU,EAAAA,KAAOC,EAAAA,IAE7D,OACEC,EAAAA,IAACC,EAAAA,SAAA,CACE,GAAGL,EACJ,OAAQC,EACR,cAAAL,EACA,cAAAF,EACA,QAAAI,EACA,MAAAC,EACA,WAAY,CACV,oBAAsBO,GACpBA,EAAK,eAAeL,EAAQ,KAAM,CAAE,MAAO,QAAS,EACtD,GAAGN,CAAA,EAEL,UAAWY,EAAAA,GACT,wDACAd,CAAA,CACF,CAAA,CAGN,CAEO,MAAMe,EAAoBC,EAAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.cjs","sources":["../../../../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n CalendarDayButton as SCalendarDayButton,\n type CalendarDayButtonProps as SCalendarDayButtonProps,\n Calendar,\n type CalendarProps,\n type CalendarColor,\n} from \"@dsui/ui/components/calendar\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@dsui/ui/components/popover\";\nimport {\n Drawer,\n DrawerContent,\n DrawerDescription,\n DrawerHeader,\n DrawerTitle,\n DrawerTrigger,\n} from \"@dsui/ui/components/drawer\";\nimport { cn } from \"@dsui/ui/index\";\nimport { Input, type InputProps } from \"../Input\";\nimport { Button } from \"../Button\";\nimport {\n TimePicker,\n type TimePickerMode,\n type DisabledTimeRange,\n} from \"./TimePicker\";\nimport { CalendarIcon } from \"lucide-react\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport { isMobile } from \"react-device-detect\";\nimport { format as dfFormat, parse, isValid, type Locale } from \"date-fns\";\nimport { vi, enUS } from \"date-fns/locale\";\nimport { DATE_FORMAT } from \"@/constants/common\";\n\nfunction formatDate(\n date: Date | undefined,\n outputFormat: string = DATE_FORMAT,\n locale?: Locale\n) {\n if (!date) return \"\";\n\n return dfFormat(date, outputFormat, locale ? { locale } : undefined);\n}\n\nconst parseDate = (\n str: string,\n inputFormat: string = DATE_FORMAT\n): Date | undefined => {\n const date = parse(str, inputFormat, new Date());\n return isValid(date) ? date : undefined;\n};\n\nfunction generateMaskFromFormat(format: string): string {\n return format\n .replace(/dd|MM|yyyy/g, (match) => {\n switch (match) {\n case \"dd\":\n case \"MM\":\n return \"99\";\n case \"yyyy\":\n return \"9999\";\n default:\n return match;\n }\n })\n .replace(/d|M|y/g, (match) => {\n switch (match) {\n case \"d\":\n case \"M\":\n return \"9\";\n case \"y\":\n return \"9\";\n default:\n return match;\n }\n });\n}\n\nexport type FormatType = string | { input: string; output: string };\n\nexport type DatePickerRenderProps = {\n value: string;\n date?: Date;\n onSelect: (date?: Date) => void;\n onChange: (text?: string) => void;\n};\n\nexport type DatePickerProps = Omit<\n InputProps,\n \"value\" | \"onChange\" | \"onSelect\" | \"mask\" | \"children\"\n> & {\n value?: string;\n onChange?: (\n event?: React.ChangeEvent<HTMLInputElement>,\n value?: string,\n date?: Date\n ) => void;\n onSelect?: (date?: Date, value?: string) => void;\n calendarClassName?: string;\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n align?: \"start\" | \"center\" | \"end\";\n size?: VariantProps<typeof Input>[\"size\"];\n format?: FormatType;\n language?: \"vi\" | \"en\";\n mask?: boolean | string;\n closeOnSelect?: boolean;\n calendarConfig?: CalendarProps;\n desktopMode?: \"popover\" | \"drawer\";\n mobileMode?: \"popover\" | \"drawer\";\n showOutsideDays?: boolean;\n children?: (props: DatePickerRenderProps) => React.ReactNode;\n showTime?: boolean;\n timeFormat?: \"HH:mm\" | \"HH:mm:ss\";\n hideDate?: boolean;\n numberOfMonths?: number;\n variant?: \"default\" | \"rounded\";\n color?: CalendarColor;\n\n // TimePicker configuration options\n timePickerMode?: TimePickerMode; // Display mode: 'wheel' (default), 'select', 'compact'\n hourInterval?: number; // Hour interval (e.g., 1, 2, 3) - defaults to 1\n minuteInterval?: number; // Minute interval (e.g., 5, 10, 15, 30) - defaults to 1\n secondInterval?: number; // Second interval (e.g., 5, 10, 15, 30) - defaults to 1\n disabledTimes?: string[]; // Array of disabled times in \"HH:mm\" or \"HH:mm:ss\" format\n disabledTimeRanges?: DisabledTimeRange[]; // Array of disabled time ranges\n showNowButton?: boolean; // Show \"Now\" button to select current time\n nowButtonLabel?: string; // Label for \"Now\" button (defaults to \"Now\")\n timePickerLabel?:\n | boolean\n | { hours?: string; minutes?: string; seconds?: string };\n};\n\nexport function DatePicker({\n value,\n onChange,\n onSelect,\n calendarClassName,\n side = \"bottom\",\n align = \"end\",\n format = \"dd/MM/yyyy\",\n language = \"vi\",\n mask,\n closeOnSelect = false,\n calendarConfig,\n desktopMode = \"popover\",\n mobileMode = \"drawer\",\n showOutsideDays = true,\n children,\n showTime = false,\n timeFormat = \"HH:mm\",\n hideDate = false,\n numberOfMonths = 1,\n variant = \"default\",\n color = \"primary\",\n // TimePicker props\n timePickerMode = \"wheel\",\n hourInterval = 1,\n minuteInterval = 1,\n secondInterval = 1,\n disabledTimes,\n disabledTimeRanges,\n showNowButton = false,\n nowButtonLabel = \"Now\",\n timePickerLabel,\n ...props\n}: DatePickerProps) {\n let inputFormat: string;\n let outputFormat: string;\n if (typeof format === \"string\") {\n inputFormat = format;\n outputFormat = format;\n } else {\n inputFormat = format.input;\n outputFormat = format.output;\n }\n\n // Determine the mask to use\n let maskToUse: string | undefined;\n if (mask === true) {\n maskToUse = generateMaskFromFormat(inputFormat);\n } else if (typeof mask === \"string\") {\n maskToUse = mask;\n }\n // If mask is false or undefined, maskToUse remains undefined\n\n const initialDate = value ? parseDate(value, inputFormat) : undefined;\n\n const [open, setOpen] = React.useState(false);\n const [date, setDate] = React.useState<Date | undefined>(initialDate);\n const [month, setMonth] = React.useState<Date | undefined>(initialDate);\n const [inputValue, setInputValue] = React.useState(value || \"\");\n\n const _locale: Locale = calendarConfig?.locale\n ? (calendarConfig?.locale as Locale)\n : language === \"en\"\n ? enUS\n : vi;\n\n const mode = isMobile ? mobileMode : desktopMode;\n\n // Helper to format date-time based on showTime and timeFormat\n const formatDateTimeValue = (d: Date | undefined): string => {\n if (!d) return \"\";\n let result = formatDate(d, outputFormat, _locale);\n if (showTime) {\n result += ` ${dfFormat(d, timeFormat)}`;\n }\n return result;\n };\n\n // Helper functions for render props\n const handleSelectForRenderProp = (date?: Date) => {\n setDate(date);\n setInputValue(formatDateTimeValue(date));\n onSelect?.(date, formatDateTimeValue(date));\n };\n\n const handleChangeForRenderProp = (text?: string) => {\n if (!text) {\n setInputValue(\"\");\n setDate(undefined);\n onSelect?.(undefined, undefined);\n return;\n }\n setInputValue(text);\n const parsedDate = parseDate(text, inputFormat);\n if (parsedDate) {\n setDate(parsedDate);\n setMonth(parsedDate);\n onSelect?.(parsedDate, formatDateTimeValue(parsedDate));\n } else {\n setDate(undefined);\n onSelect?.(undefined, undefined);\n }\n };\n\n const handleTimeChange = (\n event?: React.ChangeEvent<HTMLInputElement>,\n value?: string,\n newDate?: Date\n ) => {\n if (!newDate) {\n // Handle clear/invalid time\n onChange?.(event, value, undefined);\n return;\n }\n\n // Merge: keep date (year, month, day) from Calendar, take time (hours, minutes, seconds) from TimePicker\n const mergedDate = new Date(date || new Date());\n mergedDate.setHours(\n newDate.getHours(),\n newDate.getMinutes(),\n newDate.getSeconds(),\n 0\n );\n\n setDate(mergedDate);\n setInputValue(formatDateTimeValue(mergedDate));\n onSelect?.(mergedDate, formatDateTimeValue(mergedDate));\n onChange?.(event, formatDateTimeValue(mergedDate), mergedDate);\n };\n\n // Determine trigger component\n const triggerComponent = children ? (\n children({\n value: inputValue,\n date,\n onSelect: handleSelectForRenderProp,\n onChange: handleChangeForRenderProp,\n })\n ) : (\n <Button\n variant=\"ghost\"\n className=\"!p-1 !leading-0 h-auto rounded hover:bg-accent transition-colors\"\n size={props.size}\n >\n <CalendarIcon\n className={cn({\n \"size-3\": props.size === \"xs\" || props.size === \"sm\",\n \"size-3.5\": !props.size || props.size === \"normal\",\n \"size-4\": props.size === \"lg\" || props.size === \"xl\",\n })}\n />\n <span className=\"sr-only\">Select date</span>\n </Button>\n );\n\n const calendarSelection = (\n <div\n className={cn(\n \"flex items-stretch mx-auto w-full\",\n showTime && !hideDate ? \"gap-0 md:max-w-lg\" : \"\",\n // mode === \"drawer\" ? \"mb-6\" : \"\",\n isMobile ? \"max-w-md md:max-w-md lg:max-w-lg\" : \"\"\n )}\n >\n {!hideDate && (\n <Calendar\n {...calendarConfig}\n mode=\"single\"\n selected={date}\n captionLayout=\"dropdown\"\n month={month}\n onMonthChange={setMonth}\n numberOfMonths={isMobile ? 1 : numberOfMonths || 1}\n variant={variant}\n color={color}\n onSelect={(selectedDate) => {\n // Preserve time from current date when selecting new date\n let newDate = selectedDate;\n if (selectedDate && date && showTime) {\n newDate = new Date(selectedDate);\n newDate.setHours(\n date.getHours(),\n date.getMinutes(),\n date.getSeconds(),\n date.getMilliseconds()\n );\n }\n setDate(newDate);\n setInputValue(formatDateTimeValue(newDate));\n onSelect?.(newDate, formatDateTimeValue(newDate));\n if (closeOnSelect && !showTime) setOpen(false);\n }}\n locale={_locale}\n formatters={{\n formatMonthDropdown: (date) =>\n date.toLocaleString(_locale.code, { month: \"short\" }),\n }}\n showOutsideDays={showOutsideDays}\n className={cn(\n \"my-auto bg-transparent mx-auto\",\n {\n \"[--cell-size:clamp(0px,calc(100vw/7.5),52px)] mb-8 bg-transparent\":\n (isMobile && !showTime) || desktopMode === \"drawer\",\n \"[--cell-size:clamp(0px,calc(100vw/7.5),34px)]\":\n !isMobile && desktopMode !== \"drawer\",\n \"w-full\": mode === \"drawer\" && showTime,\n },\n calendarClassName\n )}\n />\n )}\n {showTime && (\n <div className=\"border-l border-border\">\n <TimePicker\n value={date ? dfFormat(date, timeFormat) : undefined}\n format={timeFormat}\n onChange={handleTimeChange}\n showHours\n showMinutes\n showSeconds={timeFormat === \"HH:mm:ss\"}\n mode={timePickerMode}\n hourInterval={hourInterval}\n minuteInterval={minuteInterval}\n secondInterval={secondInterval}\n disabledTimes={disabledTimes}\n disabledTimeRanges={disabledTimeRanges}\n showNowButton={showNowButton}\n nowButtonLabel={nowButtonLabel}\n timeLabel={timePickerLabel}\n standalone={false}\n color={color}\n />\n </div>\n )}\n </div>\n );\n\n const popPicker = (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild disabled={props.disabled}>\n {triggerComponent}\n </PopoverTrigger>\n <PopoverContent\n className={cn(\n \"w-auto overflow-hidden p-0\",\n \"backdrop-blur bg-background/50\"\n )}\n side={side}\n align={align}\n >\n {calendarSelection}\n </PopoverContent>\n </Popover>\n );\n\n const drawPicker = (\n <Drawer open={open} onOpenChange={setOpen}>\n <DrawerTrigger asChild>{triggerComponent}</DrawerTrigger>\n <DrawerContent\n className={cn(\n \"w-auto overflow-hidden p-0\",\n \"backdrop-blur bg-background\"\n )}\n >\n <DrawerHeader className=\"sr-only\">\n <DrawerTitle>Select date</DrawerTitle>\n <DrawerDescription>Set date</DrawerDescription>\n </DrawerHeader>\n {calendarSelection}\n </DrawerContent>\n </Drawer>\n );\n\n // If children is provided, use render prop pattern with picker\n if (children) {\n return mode === \"drawer\" ? drawPicker : popPicker;\n }\n\n // Default input rendering\n return (\n <Input\n {...props}\n clearable\n value={inputValue}\n mask={maskToUse}\n onChange={(e) => {\n setInputValue(e.target.value);\n const date = parseDate(e.target.value, inputFormat);\n if (date) {\n setDate(date);\n setMonth(date);\n onSelect?.(date, formatDateTimeValue(date));\n onChange?.(e, formatDateTimeValue(date), date);\n } else {\n onSelect?.(undefined, undefined);\n onChange?.(e, undefined, undefined);\n }\n }}\n onBlur={() => {\n const parsedDate = parseDate(inputValue, inputFormat);\n if (!parsedDate) {\n setInputValue(\"\");\n setDate(undefined);\n setMonth(undefined);\n onSelect?.(undefined, undefined);\n }\n }}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setOpen(true);\n }\n }}\n suffixIcon={mode === \"drawer\" ? drawPicker : popPicker}\n />\n );\n}\n\nexport const CalendarDayButton = SCalendarDayButton;\nexport type CalendarDayButtonProps = SCalendarDayButtonProps;\n"],"names":["formatDate","date","outputFormat","DATE_FORMAT","locale","dfFormat","parseDate","str","inputFormat","parse","isValid","generateMaskFromFormat","format","match","DatePicker","value","onChange","onSelect","calendarClassName","side","align","language","mask","closeOnSelect","calendarConfig","desktopMode","mobileMode","showOutsideDays","children","showTime","timeFormat","hideDate","numberOfMonths","variant","color","timePickerMode","hourInterval","minuteInterval","secondInterval","disabledTimes","disabledTimeRanges","showNowButton","nowButtonLabel","timePickerLabel","props","maskToUse","initialDate","open","setOpen","React","setDate","month","setMonth","inputValue","setInputValue","_locale","enUS","vi","mode","isMobile","formatDateTimeValue","d","result","handleSelectForRenderProp","handleChangeForRenderProp","text","parsedDate","handleTimeChange","event","newDate","mergedDate","triggerComponent","jsxs","Button","jsx","CalendarIcon","cn","calendarSelection","Calendar","selectedDate","TimePicker","popPicker","Popover","PopoverTrigger","PopoverContent","drawPicker","Drawer","DrawerTrigger","DrawerContent","DrawerHeader","DrawerTitle","DrawerDescription","Input"],"mappings":"6nEAoCA,SAASA,GACPC,EACAC,EAAuBC,EAAAA,YACvBC,EACA,CACA,OAAKH,EAEEI,EAAAA,OAASJ,EAAMC,EAAcE,EAAS,CAAE,OAAAA,CAAA,EAAW,MAAS,EAFjD,EAGpB,CAEA,MAAME,EAAY,CAChBC,EACAC,EAAsBL,gBACD,CACrB,MAAMF,EAAOQ,EAAAA,MAAMF,EAAKC,EAAa,IAAI,IAAM,EAC/C,OAAOE,UAAQT,CAAI,EAAIA,EAAO,MAChC,EAEA,SAASU,GAAuBC,EAAwB,CACtD,OAAOA,EACJ,QAAQ,cAAgBC,GAAU,CACjC,OAAQA,EAAA,CACN,IAAK,KACL,IAAK,KACH,MAAO,KACT,IAAK,OACH,MAAO,OACT,QACE,OAAOA,CAAA,CAEb,CAAC,EACA,QAAQ,SAAWA,GAAU,CAC5B,OAAQA,EAAA,CACN,IAAK,IACL,IAAK,IACH,MAAO,IACT,IAAK,IACH,MAAO,IACT,QACE,OAAOA,CAAA,CAEb,CAAC,CACL,CAwDO,SAASC,GAAW,CACzB,MAAAC,EACA,SAAAC,EACA,SAAAC,EACA,kBAAAC,EACA,KAAAC,EAAO,SACP,MAAAC,EAAQ,MACR,OAAAR,EAAS,aACT,SAAAS,EAAW,KACX,KAAAC,EACA,cAAAC,EAAgB,GAChB,eAAAC,EACA,YAAAC,EAA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B3D,CAAI,CAAC,EAC1Ce,IAAW,EAAG4C,EAAoB3D,CAAI,EAAGA,CAAI,IAE7CgB,IAAW,OAAW,MAAS,EAC/BD,IAAW,EAAG,OAAW,MAAS,EAEtC,EACA,OAAQ,IAAM,CACOV,EAAU+C,EAAY7C,CAAW,IAElD8C,EAAc,EAAE,EAChBJ,EAAQ,MAAS,EACjBE,EAAS,MAAS,EAClBnC,IAAW,OAAW,MAAS,EAEnC,EACA,UAAY,GAAM,CACZ,EAAE,MAAQ,cACZ,EAAE,eAAA,EACF+B,EAAQ,EAAI,EAEhB,EACA,WAAYU,IAAS,SAAW2B,EAAaJ,CAAA,CAAA,CAGnD"}
1
+ {"version":3,"file":"DatePicker.cjs","sources":["../../../../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n CalendarDayButton as SCalendarDayButton,\n type CalendarDayButtonProps as SCalendarDayButtonProps,\n Calendar,\n type CalendarProps,\n type CalendarColor,\n} from \"@dsui/ui/components/calendar\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@dsui/ui/components/popover\";\nimport {\n Drawer,\n DrawerContent,\n DrawerDescription,\n DrawerHeader,\n DrawerTitle,\n DrawerTrigger,\n} from \"@dsui/ui/components/drawer\";\nimport { cn } from \"@dsui/ui/index\";\nimport { Input, type InputProps } from \"../Input\";\nimport { Button } from \"../Button\";\nimport {\n TimePicker,\n type TimePickerMode,\n type DisabledTimeRange,\n} from \"./TimePicker\";\nimport { CalendarIcon } from \"lucide-react\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport { isMobile } from \"react-device-detect\";\nimport { format as dfFormat, parse, isValid, type Locale } from \"date-fns\";\nimport { vi, enUS } from \"date-fns/locale\";\nimport { DATE_FORMAT } from \"@/constants/common\";\n\nfunction formatDate(\n date: Date | undefined,\n outputFormat: string = DATE_FORMAT,\n locale?: Locale\n) {\n if (!date) return \"\";\n\n return dfFormat(date, outputFormat, locale ? { locale } : undefined);\n}\n\nconst parseDate = (\n str: string,\n inputFormat: string = DATE_FORMAT\n): Date | undefined => {\n const date = parse(str, inputFormat, new Date());\n return isValid(date) ? date : undefined;\n};\n\nfunction generateMaskFromFormat(format: string): string {\n return format\n .replace(/dd|MM|yyyy/g, (match) => {\n switch (match) {\n case \"dd\":\n case \"MM\":\n return \"99\";\n case \"yyyy\":\n return \"9999\";\n default:\n return match;\n }\n })\n .replace(/d|M|y/g, (match) => {\n switch (match) {\n case \"d\":\n case \"M\":\n return \"9\";\n case \"y\":\n return \"9\";\n default:\n return match;\n }\n });\n}\n\nexport type FormatType = string | { input: string; output: string };\n\nexport type DatePickerRenderProps = {\n value: string;\n date?: Date;\n onSelect: (date?: Date) => void;\n onChange: (text?: string) => void;\n};\n\nexport type DatePickerProps = Omit<\n InputProps,\n \"value\" | \"onChange\" | \"onSelect\" | \"mask\" | \"children\"\n> & {\n value?: string;\n onChange?: (\n event?: React.ChangeEvent<HTMLInputElement>,\n value?: string,\n date?: Date\n ) => void;\n onSelect?: (date?: Date, value?: string) => void;\n calendarClassName?: string;\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n align?: \"start\" | \"center\" | \"end\";\n size?: VariantProps<typeof Input>[\"size\"];\n format?: FormatType;\n language?: \"vi\" | \"en\";\n mask?: boolean | string;\n closeOnSelect?: boolean;\n calendarConfig?: CalendarProps;\n desktopMode?: \"popover\" | \"drawer\";\n mobileMode?: \"popover\" | \"drawer\";\n showOutsideDays?: boolean;\n children?: (props: DatePickerRenderProps) => React.ReactNode;\n showTime?: boolean;\n timeFormat?: \"HH:mm\" | \"HH:mm:ss\";\n hideDate?: boolean;\n numberOfMonths?: number;\n variant?: \"default\" | \"rounded\";\n color?: CalendarColor;\n\n // TimePicker configuration options\n timePickerMode?: TimePickerMode; // Display mode: 'wheel' (default), 'select', 'compact'\n hourInterval?: number; // Hour interval (e.g., 1, 2, 3) - defaults to 1\n minuteInterval?: number; // Minute interval (e.g., 5, 10, 15, 30) - defaults to 1\n secondInterval?: number; // Second interval (e.g., 5, 10, 15, 30) - defaults to 1\n disabledTimes?: string[]; // Array of disabled times in \"HH:mm\" or \"HH:mm:ss\" format\n disabledTimeRanges?: DisabledTimeRange[]; // Array of disabled time ranges\n showNowButton?: boolean; // Show \"Now\" button to select current time\n nowButtonLabel?: string; // Label for \"Now\" button (defaults to \"Now\")\n timePickerLabel?:\n | boolean\n | { hours?: string; minutes?: string; seconds?: string };\n};\n\nexport function DatePicker({\n value,\n onChange,\n onSelect,\n calendarClassName,\n side = \"bottom\",\n align = \"end\",\n format = \"dd/MM/yyyy\",\n language = \"vi\",\n mask,\n closeOnSelect = false,\n calendarConfig,\n desktopMode = \"popover\",\n mobileMode = \"drawer\",\n showOutsideDays = true,\n children,\n showTime = false,\n timeFormat = \"HH:mm\",\n hideDate = false,\n numberOfMonths = 1,\n variant = \"default\",\n color = \"primary\",\n // TimePicker props\n timePickerMode = \"wheel\",\n hourInterval = 1,\n minuteInterval = 1,\n secondInterval = 1,\n disabledTimes,\n disabledTimeRanges,\n showNowButton = false,\n nowButtonLabel = \"Now\",\n timePickerLabel,\n ...props\n}: DatePickerProps) {\n let inputFormat: string;\n let outputFormat: string;\n if (typeof format === \"string\") {\n inputFormat = format;\n outputFormat = format;\n } else {\n inputFormat = format.input;\n outputFormat = format.output;\n }\n\n // Determine the mask to use\n let maskToUse: string | undefined;\n if (mask === true) {\n maskToUse = generateMaskFromFormat(inputFormat);\n } else if (typeof mask === \"string\") {\n maskToUse = mask;\n }\n // If mask is false or undefined, maskToUse remains undefined\n\n const initialDate = value ? parseDate(value, inputFormat) : undefined;\n\n const [open, setOpen] = React.useState(false);\n const [date, setDate] = React.useState<Date | undefined>(initialDate);\n const [month, setMonth] = React.useState<Date | undefined>(initialDate);\n const [inputValue, setInputValue] = React.useState(value || \"\");\n\n const _locale: Locale = calendarConfig?.locale\n ? (calendarConfig?.locale as Locale)\n : language === \"en\"\n ? enUS\n : vi;\n\n const mode = isMobile ? mobileMode : desktopMode;\n\n // Helper to format date-time based on showTime and timeFormat\n const formatDateTimeValue = (d: Date | undefined): string => {\n if (!d) return \"\";\n let result = formatDate(d, outputFormat, _locale);\n if (showTime) {\n result += ` ${dfFormat(d, timeFormat)}`;\n }\n return result;\n };\n\n // Helper functions for render props\n const handleSelectForRenderProp = (date?: Date) => {\n setDate(date);\n setInputValue(formatDateTimeValue(date));\n onSelect?.(date, formatDateTimeValue(date));\n };\n\n const handleChangeForRenderProp = (text?: string) => {\n if (!text) {\n setInputValue(\"\");\n setDate(undefined);\n onSelect?.(undefined, undefined);\n return;\n }\n setInputValue(text);\n const parsedDate = parseDate(text, inputFormat);\n if (parsedDate) {\n setDate(parsedDate);\n setMonth(parsedDate);\n onSelect?.(parsedDate, formatDateTimeValue(parsedDate));\n } else {\n setDate(undefined);\n onSelect?.(undefined, undefined);\n }\n };\n\n const handleTimeChange = (\n event?: React.ChangeEvent<HTMLInputElement>,\n value?: string,\n newDate?: Date\n ) => {\n if (!newDate) {\n // Handle clear/invalid time\n onChange?.(event, value, undefined);\n return;\n }\n\n // Merge: keep date (year, month, day) from Calendar, take time (hours, minutes, seconds) from TimePicker\n const mergedDate = new Date(date || new Date());\n mergedDate.setHours(\n newDate.getHours(),\n newDate.getMinutes(),\n newDate.getSeconds(),\n 0\n );\n\n setDate(mergedDate);\n setInputValue(formatDateTimeValue(mergedDate));\n onSelect?.(mergedDate, formatDateTimeValue(mergedDate));\n onChange?.(event, formatDateTimeValue(mergedDate), mergedDate);\n };\n\n // Determine trigger component\n const triggerComponent = children ? (\n children({\n value: inputValue,\n date,\n onSelect: handleSelectForRenderProp,\n onChange: handleChangeForRenderProp,\n })\n ) : (\n <Button\n variant=\"ghost\"\n className=\"!p-1 !leading-0 h-auto rounded hover:bg-accent transition-colors\"\n size={props.size}\n >\n <CalendarIcon\n className={cn({\n \"size-3\": props.size === \"xs\" || props.size === \"sm\",\n \"size-3.5\": !props.size || props.size === \"normal\",\n \"size-4\": props.size === \"lg\" || props.size === \"xl\",\n })}\n />\n <span className=\"sr-only\">Select date</span>\n </Button>\n );\n\n const calendarSelection = (\n <div\n className={cn(\n \"flex items-stretch mx-auto w-full\",\n showTime && !hideDate ? \"gap-0 md:max-w-lg\" : \"\",\n // mode === \"drawer\" ? \"mb-6\" : \"\",\n isMobile ? \"max-w-md md:max-w-md lg:max-w-lg\" : \"\"\n )}\n >\n {!hideDate && (\n <Calendar\n {...calendarConfig}\n mode=\"single\"\n selected={date}\n captionLayout=\"dropdown\"\n month={month}\n onMonthChange={setMonth}\n numberOfMonths={isMobile ? 1 : numberOfMonths || 1}\n variant={variant}\n color={color}\n onSelect={(selectedDate) => {\n // Preserve time from current date when selecting new date\n let newDate = selectedDate;\n if (selectedDate && date && showTime) {\n newDate = new Date(selectedDate);\n newDate.setHours(\n date.getHours(),\n date.getMinutes(),\n date.getSeconds(),\n date.getMilliseconds()\n );\n }\n setDate(newDate);\n setInputValue(formatDateTimeValue(newDate));\n onSelect?.(newDate, formatDateTimeValue(newDate));\n if (closeOnSelect && !showTime) setOpen(false);\n }}\n locale={_locale}\n formatters={{\n formatMonthDropdown: (date) =>\n date.toLocaleString(_locale.code, { month: \"short\" }),\n }}\n showOutsideDays={showOutsideDays}\n className={cn(\n \"my-auto bg-transparent mx-auto\",\n {\n \"[--cell-size:clamp(0px,calc(100vw/7.5),52px)] mb-8 bg-transparent\":\n (isMobile && !showTime) || desktopMode === \"drawer\",\n \"[--cell-size:clamp(0px,calc(100vw/7.5),34px)]\":\n !isMobile && desktopMode !== \"drawer\",\n \"w-full\": mode === \"drawer\" && showTime,\n },\n calendarClassName\n )}\n />\n )}\n {showTime && (\n <div className=\"border-l border-border\">\n <TimePicker\n value={date ? dfFormat(date, timeFormat) : undefined}\n format={timeFormat}\n onChange={handleTimeChange}\n showHours\n showMinutes\n showSeconds={timeFormat === \"HH:mm:ss\"}\n mode={timePickerMode}\n hourInterval={hourInterval}\n minuteInterval={minuteInterval}\n secondInterval={secondInterval}\n disabledTimes={disabledTimes}\n disabledTimeRanges={disabledTimeRanges}\n showNowButton={showNowButton}\n nowButtonLabel={nowButtonLabel}\n timeLabel={timePickerLabel}\n standalone={false}\n color={color}\n />\n </div>\n )}\n </div>\n );\n\n const popPicker = (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild disabled={props.disabled}>\n {triggerComponent}\n </PopoverTrigger>\n <PopoverContent\n className={cn(\n \"w-auto overflow-hidden p-0\",\n \"backdrop-blur bg-background/50\"\n )}\n side={side}\n align={align}\n >\n {calendarSelection}\n </PopoverContent>\n </Popover>\n );\n\n const drawPicker = (\n <Drawer open={open} onOpenChange={setOpen}>\n <DrawerTrigger asChild>{triggerComponent}</DrawerTrigger>\n <DrawerContent\n className={cn(\n \"w-auto overflow-hidden p-0\",\n \"backdrop-blur bg-background\"\n )}\n >\n <DrawerHeader className=\"sr-only\">\n <DrawerTitle>Select date</DrawerTitle>\n <DrawerDescription>Set date</DrawerDescription>\n </DrawerHeader>\n {calendarSelection}\n </DrawerContent>\n </Drawer>\n );\n\n // If children is provided, use render prop pattern with picker\n if (children) {\n return mode === \"drawer\" ? drawPicker : popPicker;\n }\n\n // Default input rendering\n return (\n <Input\n {...props}\n clearable\n value={inputValue}\n mask={maskToUse}\n onChange={(e) => {\n setInputValue(e.target.value);\n const date = parseDate(e.target.value, inputFormat);\n if (date) {\n setDate(date);\n setMonth(date);\n onSelect?.(date, formatDateTimeValue(date));\n onChange?.(e, formatDateTimeValue(date), date);\n } else {\n onSelect?.(undefined, undefined);\n onChange?.(e, undefined, undefined);\n }\n }}\n onBlur={() => {\n const parsedDate = parseDate(inputValue, inputFormat);\n if (!parsedDate) {\n setInputValue(\"\");\n setDate(undefined);\n setMonth(undefined);\n onSelect?.(undefined, undefined);\n }\n }}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setOpen(true);\n }\n }}\n suffixIcon={mode === \"drawer\" ? drawPicker : popPicker}\n />\n );\n}\n"],"names":["formatDate","date","outputFormat","DATE_FORMAT","locale","dfFormat","parseDate","str","inputFormat","parse","isValid","generateMaskFromFormat","format","match","DatePicker","value","onChange","onSelect","calendarClassName","side","align","language","mask","closeOnSelect","calendarConfig","desktopMode","mobileMode","showOutsideDays","children","showTime","timeFormat","hideDate","numberOfMonths","variant","color","timePickerMode","hourInterval","minuteInterval","secondInterval","disabledTimes","disabledTimeRanges","showNowButton","nowButtonLabel","timePickerLabel","props","maskToUse","initialDate","open","setOpen","React","setDate","month","setMonth","inputValue","setInputValue","_locale","enUS","vi","mode","isMobile","formatDateTimeValue","d","result","handleSelectForRenderProp","handleChangeForRenderProp","text","parsedDate","handleTimeChange","event","newDate","mergedDate","triggerComponent","jsxs","Button","jsx","CalendarIcon","cn","calendarSelection","Calendar","selectedDate","TimePicker","popPicker","Popover","PopoverTrigger","PopoverContent","drawPicker","Drawer","DrawerTrigger","DrawerContent","DrawerHeader","DrawerTitle","DrawerDescription","Input"],"mappings":"6nEAoCA,SAASA,GACPC,EACAC,EAAuBC,EAAAA,YACvBC,EACA,CACA,OAAKH,EAEEI,EAAAA,OAASJ,EAAMC,EAAcE,EAAS,CAAE,OAAAA,CAAA,EAAW,MAAS,EAFjD,EAGpB,CAEA,MAAME,EAAY,CAChBC,EACAC,EAAsBL,gBACD,CACrB,MAAMF,EAAOQ,EAAAA,MAAMF,EAAKC,EAAa,IAAI,IAAM,EAC/C,OAAOE,UAAQT,CAAI,EAAIA,EAAO,MAChC,EAEA,SAASU,GAAuBC,EAAwB,CACtD,OAAOA,EACJ,QAAQ,cAAgBC,GAAU,CACjC,OAAQA,EAAA,CACN,IAAK,KACL,IAAK,KACH,MAAO,KACT,IAAK,OACH,MAAO,OACT,QACE,OAAOA,CAAA,CAEb,CAAC,EACA,QAAQ,SAAWA,GAAU,CAC5B,OAAQA,EAAA,CACN,IAAK,IACL,IAAK,IACH,MAAO,IACT,IAAK,IACH,MAAO,IACT,QACE,OAAOA,CAAA,CAEb,CAAC,CACL,CAwDO,SAASC,GAAW,CACz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EACN,SAAW,GAAM,CACfS,EAAc,EAAE,OAAO,KAAK,EAC5B,MAAMrD,EAAOK,EAAU,EAAE,OAAO,MAAOE,CAAW,EAC9CP,GACFiD,EAAQjD,CAAI,EACZmD,EAASnD,CAAI,EACbgB,IAAWhB,EAAM2D,EAAoB3D,CAAI,CAAC,EAC1Ce,IAAW,EAAG4C,EAAoB3D,CAAI,EAAGA,CAAI,IAE7CgB,IAAW,OAAW,MAAS,EAC/BD,IAAW,EAAG,OAAW,MAAS,EAEtC,EACA,OAAQ,IAAM,CACOV,EAAU+C,EAAY7C,CAAW,IAElD8C,EAAc,EAAE,EAChBJ,EAAQ,MAAS,EACjBE,EAAS,MAAS,EAClBnC,IAAW,OAAW,MAAS,EAEnC,EACA,UAAY,GAAM,CACZ,EAAE,MAAQ,cACZ,EAAE,eAAA,EACF+B,EAAQ,EAAI,EAEhB,EACA,WAAYU,IAAS,SAAW2B,EAAaJ,CAAA,CAAA,CAGnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"RangePicker.cjs","sources":["../../../../src/components/DatePicker/RangePicker.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n CalendarDayButton as SCalendarDayButton,\n type CalendarDayButtonProps as SCalendarDayButtonProps,\n Calendar,\n type CalendarColor,\n} from \"@dsui/ui/components/calendar\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@dsui/ui/components/popover\";\nimport {\n Drawer,\n DrawerContent,\n DrawerDescription,\n DrawerHeader,\n DrawerTitle,\n DrawerTrigger,\n} from \"@dsui/ui/components/drawer\";\nimport { cn } from \"@dsui/ui/index\";\nimport { Input, type InputProps } from \"../Input\";\nimport { Button } from \"../Button\";\nimport { TimePicker } from \"./TimePicker\";\nimport { type DatePickerProps } from \"./DatePicker\";\nimport { CalendarIcon, MoveRight } from \"lucide-react\";\nimport { isMobile } from \"react-device-detect\";\nimport { format as dfFormat, parse, isValid, type Locale } from \"date-fns\";\nimport { vi, enUS } from \"date-fns/locale\";\nimport { DATE_FORMAT } from \"@/constants/common\";\nimport { FloatingLabel } from \"@/components/FloatLabel\";\n\nexport type DateRange = {\n from?: Date | undefined;\n to?: Date | undefined;\n};\n\nexport type DateRangeText = { from?: string; to?: string } | null;\n\nfunction formatDate(\n date: Date | undefined,\n outputFormat: string = DATE_FORMAT,\n locale?: Locale\n) {\n if (!date) return \"\";\n\n return dfFormat(date, outputFormat, locale ? { locale } : undefined);\n}\n\nconst parseDate = (\n str: string,\n inputFormat: string = DATE_FORMAT\n): Date | undefined => {\n const date = parse(str, inputFormat, new Date());\n return isValid(date) ? date : undefined;\n};\n\nfunction generateMaskFromFormat(format: string): string {\n return format\n .replace(/dd|MM|yyyy/g, (match) => {\n switch (match) {\n case \"dd\":\n case \"MM\":\n return \"99\";\n case \"yyyy\":\n return \"9999\";\n default:\n return match;\n }\n })\n .replace(/d|M|y/g, (match) => {\n switch (match) {\n case \"d\":\n case \"M\":\n return \"9\";\n case \"y\":\n return \"9\";\n default:\n return match;\n }\n });\n}\n\nexport type FormatType = string | { input: string; output: string };\n\nexport type RangePickerRenderProps = {\n fromValue: string;\n toValue: string;\n range?: DateRange;\n onSelect: (range?: DateRange) => void;\n onFromChange: (text: string) => void;\n onToChange: (text: string) => void;\n};\n\nexport type TimeConfig = Omit<\n React.ComponentProps<typeof TimePicker>,\n \"value\" | \"onSelect\" | \"format\"\n>;\n\nexport type RangePickerProps = Omit<\n DatePickerProps,\n \"value\" | \"onChange\" | \"onSelect\" | \"children\" | \"label\" | \"placeholder\"\n> & {\n label?: string | DateRangeText;\n placeholder?: string | DateRangeText;\n value?: DateRangeText;\n onChange?: (value?: DateRange, text?: DateRangeText) => void;\n onSelect?: (value?: DateRange, text?: DateRangeText) => void;\n children?: (props: RangePickerRenderProps) => React.ReactNode;\n separator?: React.ReactNode;\n timeConfig?: [TimeConfig, TimeConfig];\n numberOfMonths?: number;\n variant?: \"default\" | \"rounded\";\n color?: CalendarColor;\n};\n\nexport function RangePicker({\n label,\n value,\n placeholder,\n onChange,\n onSelect,\n calendarClassName,\n side = \"bottom\",\n align = \"end\",\n format = \"dd/MM/yyyy\",\n language = \"vi\",\n mask,\n closeOnSelect = false,\n showOutsideDays = true,\n calendarConfig,\n timeConfig,\n desktopMode = \"popover\",\n mobileMode = \"drawer\",\n children,\n separator = <MoveRight className=\"size-5\" />,\n showTime = false,\n timeFormat = \"HH:mm\",\n hideDate = false,\n numberOfMonths = 1,\n variant = \"default\",\n color = \"primary\",\n ...props\n}: RangePickerProps) {\n const inputId = React.useId();\n\n let inputFormat: string;\n let outputFormat: string;\n if (typeof format === \"string\") {\n inputFormat = format;\n outputFormat = format;\n } else {\n inputFormat = format.input;\n outputFormat = format.output;\n }\n\n // Determine the mask to use\n let maskToUse: string | undefined;\n if (mask === true) {\n maskToUse = generateMaskFromFormat(inputFormat);\n } else if (typeof mask === \"string\") {\n maskToUse = mask;\n }\n\n const initialFromDate = value?.from\n ? parseDate(value.from, inputFormat)\n : undefined;\n const initialToDate = value?.to\n ? parseDate(value.to, inputFormat)\n : undefined;\n const initialRange: DateRange = {\n from: initialFromDate,\n to: initialToDate,\n };\n\n const [open, setOpen] = React.useState(false);\n const [range, setRange] = React.useState<DateRange | undefined>(initialRange);\n const [month, setMonth] = React.useState<Date | undefined>(\n initialFromDate || new Date()\n );\n const [fromInputValue, setFromInputValue] = React.useState(value?.from || \"\");\n const [toInputValue, setToInputValue] = React.useState(value?.to || \"\");\n const [fromTime, setFromTime] = React.useState<Date | undefined>(undefined);\n const [toTime, setToTime] = React.useState<Date | undefined>(undefined);\n const fromInputRef = React.useRef<HTMLInputElement>(null);\n const toInputRef = React.useRef<HTMLInputElement>(null);\n\n const shouldFloat = !!(fromInputValue.trim() || toInputValue.trim());\n\n const _locale: Locale = calendarConfig?.locale\n ? (calendarConfig?.locale as Locale)\n : language === \"en\"\n ? enUS\n : vi;\n\n // Helper to format date-time based on showTime and timeFormat\n const formatDateTimeValue = (d: Date | undefined): string => {\n if (!d) return \"\";\n let result = formatDate(d, outputFormat, _locale);\n if (showTime) {\n result += ` ${dfFormat(d, timeFormat)}`;\n }\n return result;\n };\n\n // Helper functions for render props\n const handleSelectForRenderProp = (range?: DateRange) => {\n setRange(range);\n const fromFormatted = formatDateTimeValue(range?.from);\n const toFormatted = formatDateTimeValue(range?.to);\n setFromInputValue(fromFormatted);\n setToInputValue(toFormatted);\n onSelect?.(range, { from: fromFormatted, to: toFormatted });\n };\n\n const handleFromChangeForRenderProp = (text: string) => {\n setFromInputValue(text);\n\n // If the input is cleared (empty), clear both fields\n if (text.trim() === \"\") {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n return;\n }\n\n // Try to parse based on showTime\n let parsedDate: Date | undefined;\n if (showTime) {\n parsedDate = parseDate(text, `${inputFormat} ${timeFormat}`);\n } else {\n parsedDate = parseDate(text, inputFormat);\n }\n const newRange: DateRange = { from: parsedDate, to: range?.to };\n if (parsedDate) {\n setRange(newRange);\n setMonth(parsedDate);\n setFromTime(parsedDate);\n onSelect?.(newRange, {\n from: formatDateTimeValue(parsedDate),\n to: formatDateTimeValue(range?.to),\n });\n } else {\n setRange(newRange);\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(range?.to),\n });\n }\n };\n\n const handleToChangeForRenderProp = (text: string) => {\n setToInputValue(text);\n\n // If the input is cleared (empty), clear both fields\n if (text.trim() === \"\") {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n return;\n }\n\n // Try to parse based on showTime\n let parsedDate: Date | undefined;\n if (showTime) {\n parsedDate = parseDate(text, `${inputFormat} ${timeFormat}`);\n } else {\n parsedDate = parseDate(text, inputFormat);\n }\n const newRange: DateRange = {\n from: range?.from,\n to: parsedDate,\n };\n if (parsedDate) {\n setRange(newRange);\n setToTime(parsedDate);\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(parsedDate),\n });\n } else {\n setRange(newRange);\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: undefined,\n });\n }\n };\n\n const handleTimeChangeFrom = (date?: Date) => {\n if (date) {\n setFromTime(date);\n // Merge: keep date (year, month, day) from existing range.from, take time (hours, minutes, seconds) from TimePicker\n const mergedDate = new Date(range?.from || new Date());\n mergedDate.setHours(\n date.getHours(),\n date.getMinutes(),\n date.getSeconds(),\n 0\n );\n\n const newRange: DateRange = {\n from: mergedDate,\n to: range?.to,\n };\n setRange(newRange);\n setFromInputValue(formatDateTimeValue(mergedDate));\n onSelect?.(newRange, {\n from: formatDateTimeValue(mergedDate),\n to: formatDateTimeValue(range?.to),\n });\n onChange?.(newRange, {\n from: formatDateTimeValue(mergedDate),\n to: formatDateTimeValue(range?.to),\n });\n }\n };\n\n const handleTimeChangeTo = (date?: Date) => {\n if (date) {\n setToTime(date);\n // Merge: keep date (year, month, day) from existing range.to, take time (hours, minutes, seconds) from TimePicker\n const mergedDate = new Date(range?.to || new Date());\n mergedDate.setHours(\n date.getHours(),\n date.getMinutes(),\n date.getSeconds(),\n 0\n );\n\n const newRange: DateRange = {\n from: range?.from,\n to: mergedDate,\n };\n setRange(newRange);\n setToInputValue(formatDateTimeValue(mergedDate));\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(mergedDate),\n });\n onChange?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(mergedDate),\n });\n }\n };\n\n // Determine trigger component\n const triggerComponent = children ? (\n children({\n fromValue: fromInputValue,\n toValue: toInputValue,\n range,\n onSelect: handleSelectForRenderProp,\n onFromChange: handleFromChangeForRenderProp,\n onToChange: handleToChangeForRenderProp,\n })\n ) : (\n <Button\n variant=\"ghost\"\n className=\"!p-1 !leading-0 h-auto rounded hover:bg-accent transition-colors\"\n size={props?.size}\n >\n <CalendarIcon\n className={cn({\n \"size-3\": props.size === \"xs\" || props.size === \"sm\",\n \"size-3.5\": !props.size || props.size === \"normal\",\n \"size-4\": props.size === \"lg\" || props.size === \"xl\",\n })}\n />\n <span className=\"sr-only\">Select date range</span>\n </Button>\n );\n\n const calendarSelection = (\n <div\n className={cn(\"flex items-stretch\", showTime && !hideDate ? \"gap-0\" : \"\")}\n >\n {!hideDate && (\n <Calendar\n {...calendarConfig}\n mode=\"range\"\n selected={range as any}\n captionLayout=\"dropdown\"\n month={month}\n onMonthChange={setMonth}\n numberOfMonths={isMobile ? 1 : numberOfMonths || 1}\n variant={variant}\n color={color}\n onSelect={(selectedRange) => {\n // Preserve time from TimePicker values if showTime is enabled\n let preservedRange = selectedRange;\n if (showTime) {\n // Get current time from TimePicker state\n const fromTimeObj = fromTime;\n const toTimeObj = toTime;\n\n preservedRange = {\n from: selectedRange?.from\n ? new Date(\n selectedRange.from.getFullYear(),\n selectedRange.from.getMonth(),\n selectedRange.from.getDate(),\n fromTimeObj?.getHours() || 0,\n fromTimeObj?.getMinutes() || 0,\n fromTimeObj?.getSeconds() || 0\n )\n : undefined,\n to: selectedRange?.to\n ? new Date(\n selectedRange.to.getFullYear(),\n selectedRange.to.getMonth(),\n selectedRange.to.getDate(),\n toTimeObj?.getHours() || 0,\n toTimeObj?.getMinutes() || 0,\n toTimeObj?.getSeconds() || 0\n )\n : undefined,\n };\n }\n setRange(preservedRange);\n const fromFormatted = formatDateTimeValue(preservedRange?.from);\n const toFormatted = formatDateTimeValue(preservedRange?.to);\n setFromInputValue(fromFormatted);\n setToInputValue(toFormatted);\n onSelect?.(preservedRange, {\n from: fromFormatted,\n to: toFormatted,\n });\n onChange?.(preservedRange, {\n from: fromFormatted,\n to: toFormatted,\n });\n if (\n closeOnSelect &&\n preservedRange?.from &&\n preservedRange?.to &&\n !showTime\n ) {\n setOpen(false);\n }\n }}\n locale={_locale}\n formatters={{\n formatMonthDropdown: (date) =>\n date.toLocaleString(_locale.code, { month: \"short\" }),\n }}\n showOutsideDays={showOutsideDays}\n className={cn(\n \"mx-auto\",\n {\n \"[--cell-size:clamp(0px,calc(100vw/7.5),52px)] mb-8 bg-transparent\":\n isMobile || desktopMode === \"drawer\",\n \"[--cell-size:clamp(0px,calc(100vw/7.5),34px)]\":\n !isMobile && desktopMode !== \"drawer\",\n },\n calendarClassName\n )}\n />\n )}\n {showTime && (\n <div className=\"flex gap-0 border-l border-border\">\n <TimePicker\n {...timeConfig?.[0]}\n value={fromTime ? dfFormat(fromTime, timeFormat) : undefined}\n onSelect={handleTimeChangeFrom}\n format={timeFormat}\n showHours\n showMinutes\n showSeconds={timeFormat === \"HH:mm:ss\"}\n standalone={false}\n />\n <div className=\"border-l border-border\" />\n <TimePicker\n {...timeConfig?.[1]}\n value={toTime ? dfFormat(toTime, timeFormat) : undefined}\n onSelect={handleTimeChangeTo}\n format={timeFormat}\n showHours\n showMinutes\n showSeconds={timeFormat === \"HH:mm:ss\"}\n standalone={false}\n />\n </div>\n )}\n </div>\n );\n\n const popPicker = (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild disabled={props.disabled}>\n {triggerComponent}\n </PopoverTrigger>\n <PopoverContent\n className={cn(\n \"w-auto overflow-hidden p-0\",\n \"backdrop-blur bg-background/50\"\n )}\n side={side}\n align={align}\n >\n {calendarSelection}\n </PopoverContent>\n </Popover>\n );\n\n const drawPicker = (\n <Drawer open={open} onOpenChange={setOpen}>\n <DrawerTrigger asChild>{triggerComponent}</DrawerTrigger>\n <DrawerContent\n className={cn(\n \"w-auto overflow-hidden p-0\",\n \"backdrop-blur bg-background\"\n )}\n >\n <DrawerHeader className=\"sr-only\">\n <DrawerTitle>Select date range</DrawerTitle>\n <DrawerDescription>Set your date range</DrawerDescription>\n </DrawerHeader>\n {calendarSelection}\n </DrawerContent>\n </Drawer>\n );\n\n // If children is provided, use render prop pattern with picker\n if (children) {\n const mode = isMobile ? mobileMode : desktopMode;\n return mode === \"drawer\" ? drawPicker : popPicker;\n }\n\n // Helper function to render range input\n const renderRangeInput = (\n type: \"from\" | \"to\",\n inputValue: string,\n setInputValue: (value: string) => void,\n additionalProps?: Partial<InputProps>\n ) => {\n const isFrom = type === \"from\";\n\n return (\n <Input\n {...props}\n {...additionalProps}\n ref={isFrom ? fromInputRef : toInputRef}\n id={inputId}\n size={\n props.isFloatLabel ? (props.size ? props.size : \"xl\") : props.size\n }\n className={cn(\n props.className,\n \"relative peer border-0 focus:ring-0 rounded-none hover:bg-transparent active:bg-transparent focus-visible:ring-0 focus-visible:border-0\",\n isFrom ? \"pr-0\" : \"\"\n )}\n label={\n props.isFloatLabel && typeof label === \"object\"\n ? isFrom\n ? label?.from || \"\"\n : label?.to || \"\"\n : \"\"\n }\n placeholder={\n typeof placeholder === \"object\"\n ? isFrom\n ? placeholder?.from || \"\"\n : placeholder?.to || \"\"\n : placeholder\n }\n clearable={!isFrom}\n value={inputValue}\n mask={maskToUse}\n onChange={(e) => {\n const inputValue = e.target.value;\n setInputValue(inputValue);\n\n // If the input is cleared (empty), clear both fields\n if (inputValue.trim() === \"\") {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n onChange?.(newRange, newRange as DateRangeText);\n return;\n }\n\n // Try to parse based on showTime\n let date: Date | undefined;\n if (showTime) {\n date = parseDate(inputValue, `${inputFormat} ${timeFormat}`);\n } else {\n date = parseDate(inputValue, inputFormat);\n }\n const newRange: DateRange = isFrom\n ? { from: date, to: range?.to }\n : { from: range?.from, to: date };\n\n if (date) {\n setRange(newRange);\n if (isFrom) setMonth(date);\n // Update time state if time was parsed\n if (isFrom) {\n setFromTime(date);\n // setFromInputValue(formatDateTimeValue(date)); // Sync input value\n } else {\n setToTime(date);\n // setToInputValue(formatDateTimeValue(date)); // Sync input value\n }\n const fromFormatted = formatDateTimeValue(\n isFrom ? date : range?.from\n );\n const toFormatted = formatDateTimeValue(isFrom ? range?.to : date);\n onSelect?.(newRange, { from: fromFormatted, to: toFormatted });\n onChange?.(newRange, {\n from: isFrom ? inputValue : fromInputValue,\n to: isFrom ? toInputValue : inputValue,\n });\n\n // If from input and date is valid, auto-focus to to input if to is empty\n // if (isFrom && toInputRef.current && !toInputValue.trim()) {\n // requestAnimationFrame(() => toInputRef.current?.focus());\n // }\n } else {\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: isFrom ? formatDateTimeValue(range?.to) : undefined,\n });\n onChange?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: isFrom ? formatDateTimeValue(range?.to) : undefined,\n });\n }\n }}\n onClear={\n !isFrom\n ? () => {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n onChange?.(newRange, newRange as DateRangeText);\n }\n : undefined\n }\n onBlur={() => {\n // Check if blurring out of the entire range picker group\n const activeElement = document.activeElement;\n if (\n activeElement !== fromInputRef.current &&\n activeElement !== toInputRef.current\n ) {\n // Delay validation by 100ms\n setTimeout(() => {\n // Check again if still blurred out of the group\n const currentActiveElement = document.activeElement;\n if (\n currentActiveElement !== fromInputRef.current &&\n currentActiveElement !== toInputRef.current\n ) {\n // Blurred out of the group, validate both inputs\n const validateInput = (val: string) => {\n if (val.trim() === \"\") return true; // empty is valid (will clear)\n let parsed: Date | undefined;\n if (showTime) {\n parsed = parseDate(val, `${inputFormat} ${timeFormat}`);\n } else {\n parsed = parseDate(val, inputFormat);\n }\n return !!parsed;\n };\n\n const fromValid = validateInput(fromInputValue);\n const toValid = validateInput(toInputValue);\n\n // Clear if either is invalid, or if only one has value\n const shouldClear =\n !fromValid ||\n !toValid ||\n (fromInputValue.trim() && !toInputValue.trim()) ||\n (!fromInputValue.trim() && toInputValue.trim());\n\n if (shouldClear) {\n // If either is invalid, clear both\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = {\n from: undefined,\n to: undefined,\n };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n onChange?.(newRange, newRange as DateRangeText);\n }\n }\n }, 100);\n }\n }}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setOpen(true);\n }\n }}\n />\n );\n };\n\n // Default input rendering with two inputs\n return (\n <div\n className={cn(\n \"group relative flex items-center border rounded-md focus-within:ring-2 focus-within:ring-offset-2 bg-background transition-[color,box-shadow]\",\n {\n \"border-input focus-within:ring-ring\": !props.state,\n \"border-success focus-within:ring-success\": props.state === \"success\",\n \"border-warning focus-within:ring-warning\": props.state === \"warning\",\n \"border-error focus-within:ring-error\": props.state === \"error\",\n }\n )}\n >\n {renderRangeInput(\"from\", fromInputValue, setFromInputValue)}\n <span\n className={cn(\"text-muted-foreground select-none pl-2\", {\n \"opacity-30\": props.disabled,\n })}\n >\n {separator}\n </span>\n {renderRangeInput(\"to\", toInputValue, setToInputValue, {\n suffixIcon: isMobile\n ? mobileMode === \"drawer\"\n ? drawPicker\n : popPicker\n : desktopMode === \"drawer\"\n ? drawPicker\n : popPicker,\n })}\n {props.isFloatLabel && typeof label === \"string\" && (\n <FloatingLabel\n htmlFor={inputId}\n size={props.size}\n infoTooltip={props.infoTooltip}\n className=\"z-10\"\n shouldFloat={shouldFloat}\n >\n {label}\n </FloatingLabel>\n )}\n </div>\n );\n}\n\nexport const CalendarDayButton = SCalendarDayButton;\nexport type CalendarDayButtonProps = SCalendarDayButtonProps;\n"],"names":["formatDate","date","outputFormat","DATE_FORMAT","locale","dfFormat","parseDate","str","inputFormat","parse","isValid","generateMaskFromFormat","format","match","RangePicker","label","value","placeholder","onChange","onSelect","calendarClassName","side","align","language","mask","closeOnSelect","showOutsideDays","calendarConfig","timeConfig","desktopMode","mobileMode","children","separator","jsx","MoveRight","showTime","timeFormat","hideDate","numberOfMonths","variant","color","props","inputId","React","maskToUse","initialFromDate","initialToDate","initialRange","open","setOpen","range","setRange","month","setMonth","fromInputValue","setFromInputValue","toInputValue","setToInputValue","fromTime","setFromTime","toTime","setToTime","fromInputRef","toInputRef","shouldFloat","_locale","enUS","vi","formatDateTimeValue","d","result","handleSelectForRenderProp","fromFormatted","toFormatted","handleFromChangeForRenderProp","text","newRange","parsedDate","handleToChangeForRenderProp","handleTimeChangeFrom","mergedDate","handleTimeChangeTo","triggerComponent","jsxs","Button","CalendarIcon","cn","calendarSelection","Calendar","isMobile","selectedRange","preservedRange","fromTimeObj","toTimeObj","TimePicker","popPicker","Popover","PopoverTrigger","PopoverContent","drawPicker","Drawer","DrawerTrigger","DrawerContent","DrawerHeader","DrawerTitle","DrawerDescription","renderRangeInput","type","inputValue","setInputValue","additionalProps","isFrom","Input","e","activeElement","currentActiveElement","validateInput","val","parsed","fromValid","toValid","FloatingLabel"],"mappings":"+pEAuCA,SAASA,GACPC,EACAC,EAAuBC,GAAAA,YACvBC,EACA,CACA,OAAKH,EAEEI,EAAAA,OAASJ,EAAMC,EAAcE,EAAS,CAAE,OAAAA,CAAA,EAAW,MAAS,EAFjD,EAGpB,CAEA,MAAME,EAAY,CAChBC,EACAC,EAAsBL,iBACD,CACrB,MAAMF,EAAOQ,EAAAA,MAAMF,EAAKC,EAAa,IAAI,IAAM,EAC/C,OAAOE,UAAQT,CAAI,EAAIA,EAAO,MAChC,EAEA,SAASU,GAAuBC,EAAwB,CACtD,OAAOA,EACJ,QAAQ,cAAgBC,GAAU,CACjC,OAAQA,EAAA,CACN,IAAK,KACL,IAAK,KACH,MAAO,KACT,IAAK,OACH,MAAO,OACT,QACE,OAAOA,CAAA,CAEb,CAAC,EACA,QAAQ,SAAWA,GAAU,CAC5B,OAAQA,EAAA,CACN,IAAK,IACL,IAAK,IACH,MAAO,IACT,IAAK,IACH,MAAO,IACT,QACE,OAAOA,CAAA,CAEb,CAAC,CACL,CAmCO,SAASC,GAAY,CAC1B,MAAAC,EACA,MAAAC,EACA,YAAAC,EACA,SAAAC,EACA,SAAAC,EACA,kBAAAC,GAC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AAA,cAAA,CACC,QAAS/E,GACT,KAAMD,EAAM,KACZ,YAAaA,EAAM,YACnB,UAAU,OACV,YAAAuB,GAEC,SAAAjD,CAAA,CAAA,CACH,CAAA,CAAA,CAIR"}
1
+ {"version":3,"file":"RangePicker.cjs","sources":["../../../../src/components/DatePicker/RangePicker.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n CalendarDayButton as SCalendarDayButton,\n type CalendarDayButtonProps as SCalendarDayButtonProps,\n Calendar,\n type CalendarColor,\n} from \"@dsui/ui/components/calendar\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@dsui/ui/components/popover\";\nimport {\n Drawer,\n DrawerContent,\n DrawerDescription,\n DrawerHeader,\n DrawerTitle,\n DrawerTrigger,\n} from \"@dsui/ui/components/drawer\";\nimport { cn } from \"@dsui/ui/index\";\nimport { Input, type InputProps } from \"../Input\";\nimport { Button } from \"../Button\";\nimport { TimePicker } from \"./TimePicker\";\nimport { type DatePickerProps } from \"./DatePicker\";\nimport { CalendarIcon, MoveRight } from \"lucide-react\";\nimport { isMobile } from \"react-device-detect\";\nimport { format as dfFormat, parse, isValid, type Locale } from \"date-fns\";\nimport { vi, enUS } from \"date-fns/locale\";\nimport { DATE_FORMAT } from \"@/constants/common\";\nimport { FloatingLabel } from \"@/components/FloatLabel\";\n\nexport type DateRange = {\n from?: Date | undefined;\n to?: Date | undefined;\n};\n\nexport type DateRangeText = { from?: string; to?: string } | null;\n\nfunction formatDate(\n date: Date | undefined,\n outputFormat: string = DATE_FORMAT,\n locale?: Locale\n) {\n if (!date) return \"\";\n\n return dfFormat(date, outputFormat, locale ? { locale } : undefined);\n}\n\nconst parseDate = (\n str: string,\n inputFormat: string = DATE_FORMAT\n): Date | undefined => {\n const date = parse(str, inputFormat, new Date());\n return isValid(date) ? date : undefined;\n};\n\nfunction generateMaskFromFormat(format: string): string {\n return format\n .replace(/dd|MM|yyyy/g, (match) => {\n switch (match) {\n case \"dd\":\n case \"MM\":\n return \"99\";\n case \"yyyy\":\n return \"9999\";\n default:\n return match;\n }\n })\n .replace(/d|M|y/g, (match) => {\n switch (match) {\n case \"d\":\n case \"M\":\n return \"9\";\n case \"y\":\n return \"9\";\n default:\n return match;\n }\n });\n}\n\nexport type FormatType = string | { input: string; output: string };\n\nexport type RangePickerRenderProps = {\n fromValue: string;\n toValue: string;\n range?: DateRange;\n onSelect: (range?: DateRange) => void;\n onFromChange: (text: string) => void;\n onToChange: (text: string) => void;\n};\n\nexport type TimeConfig = Omit<\n React.ComponentProps<typeof TimePicker>,\n \"value\" | \"onSelect\" | \"format\"\n>;\n\nexport type RangePickerProps = Omit<\n DatePickerProps,\n \"value\" | \"onChange\" | \"onSelect\" | \"children\" | \"label\" | \"placeholder\"\n> & {\n label?: string | DateRangeText;\n placeholder?: string | DateRangeText;\n value?: DateRangeText;\n onChange?: (value?: DateRange, text?: DateRangeText) => void;\n onSelect?: (value?: DateRange, text?: DateRangeText) => void;\n children?: (props: RangePickerRenderProps) => React.ReactNode;\n separator?: React.ReactNode;\n timeConfig?: [TimeConfig, TimeConfig];\n numberOfMonths?: number;\n variant?: \"default\" | \"rounded\";\n color?: CalendarColor;\n};\n\nexport function RangePicker({\n label,\n value,\n placeholder,\n onChange,\n onSelect,\n calendarClassName,\n side = \"bottom\",\n align = \"end\",\n format = \"dd/MM/yyyy\",\n language = \"vi\",\n mask,\n closeOnSelect = false,\n showOutsideDays = true,\n calendarConfig,\n timeConfig,\n desktopMode = \"popover\",\n mobileMode = \"drawer\",\n children,\n separator = <MoveRight className=\"size-5\" />,\n showTime = false,\n timeFormat = \"HH:mm\",\n hideDate = false,\n numberOfMonths = 1,\n variant = \"default\",\n color = \"primary\",\n ...props\n}: RangePickerProps) {\n const inputId = React.useId();\n\n let inputFormat: string;\n let outputFormat: string;\n if (typeof format === \"string\") {\n inputFormat = format;\n outputFormat = format;\n } else {\n inputFormat = format.input;\n outputFormat = format.output;\n }\n\n // Determine the mask to use\n let maskToUse: string | undefined;\n if (mask === true) {\n maskToUse = generateMaskFromFormat(inputFormat);\n } else if (typeof mask === \"string\") {\n maskToUse = mask;\n }\n\n const initialFromDate = value?.from\n ? parseDate(value.from, inputFormat)\n : undefined;\n const initialToDate = value?.to\n ? parseDate(value.to, inputFormat)\n : undefined;\n const initialRange: DateRange = {\n from: initialFromDate,\n to: initialToDate,\n };\n\n const [open, setOpen] = React.useState(false);\n const [range, setRange] = React.useState<DateRange | undefined>(initialRange);\n const [month, setMonth] = React.useState<Date | undefined>(\n initialFromDate || new Date()\n );\n const [fromInputValue, setFromInputValue] = React.useState(value?.from || \"\");\n const [toInputValue, setToInputValue] = React.useState(value?.to || \"\");\n const [fromTime, setFromTime] = React.useState<Date | undefined>(undefined);\n const [toTime, setToTime] = React.useState<Date | undefined>(undefined);\n const fromInputRef = React.useRef<HTMLInputElement>(null);\n const toInputRef = React.useRef<HTMLInputElement>(null);\n\n const shouldFloat = !!(fromInputValue.trim() || toInputValue.trim());\n\n const _locale: Locale = calendarConfig?.locale\n ? (calendarConfig?.locale as Locale)\n : language === \"en\"\n ? enUS\n : vi;\n\n // Helper to format date-time based on showTime and timeFormat\n const formatDateTimeValue = (d: Date | undefined): string => {\n if (!d) return \"\";\n let result = formatDate(d, outputFormat, _locale);\n if (showTime) {\n result += ` ${dfFormat(d, timeFormat)}`;\n }\n return result;\n };\n\n // Helper functions for render props\n const handleSelectForRenderProp = (range?: DateRange) => {\n setRange(range);\n const fromFormatted = formatDateTimeValue(range?.from);\n const toFormatted = formatDateTimeValue(range?.to);\n setFromInputValue(fromFormatted);\n setToInputValue(toFormatted);\n onSelect?.(range, { from: fromFormatted, to: toFormatted });\n };\n\n const handleFromChangeForRenderProp = (text: string) => {\n setFromInputValue(text);\n\n // If the input is cleared (empty), clear both fields\n if (text.trim() === \"\") {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n return;\n }\n\n // Try to parse based on showTime\n let parsedDate: Date | undefined;\n if (showTime) {\n parsedDate = parseDate(text, `${inputFormat} ${timeFormat}`);\n } else {\n parsedDate = parseDate(text, inputFormat);\n }\n const newRange: DateRange = { from: parsedDate, to: range?.to };\n if (parsedDate) {\n setRange(newRange);\n setMonth(parsedDate);\n setFromTime(parsedDate);\n onSelect?.(newRange, {\n from: formatDateTimeValue(parsedDate),\n to: formatDateTimeValue(range?.to),\n });\n } else {\n setRange(newRange);\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(range?.to),\n });\n }\n };\n\n const handleToChangeForRenderProp = (text: string) => {\n setToInputValue(text);\n\n // If the input is cleared (empty), clear both fields\n if (text.trim() === \"\") {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n return;\n }\n\n // Try to parse based on showTime\n let parsedDate: Date | undefined;\n if (showTime) {\n parsedDate = parseDate(text, `${inputFormat} ${timeFormat}`);\n } else {\n parsedDate = parseDate(text, inputFormat);\n }\n const newRange: DateRange = {\n from: range?.from,\n to: parsedDate,\n };\n if (parsedDate) {\n setRange(newRange);\n setToTime(parsedDate);\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(parsedDate),\n });\n } else {\n setRange(newRange);\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: undefined,\n });\n }\n };\n\n const handleTimeChangeFrom = (date?: Date) => {\n if (date) {\n setFromTime(date);\n // Merge: keep date (year, month, day) from existing range.from, take time (hours, minutes, seconds) from TimePicker\n const mergedDate = new Date(range?.from || new Date());\n mergedDate.setHours(\n date.getHours(),\n date.getMinutes(),\n date.getSeconds(),\n 0\n );\n\n const newRange: DateRange = {\n from: mergedDate,\n to: range?.to,\n };\n setRange(newRange);\n setFromInputValue(formatDateTimeValue(mergedDate));\n onSelect?.(newRange, {\n from: formatDateTimeValue(mergedDate),\n to: formatDateTimeValue(range?.to),\n });\n onChange?.(newRange, {\n from: formatDateTimeValue(mergedDate),\n to: formatDateTimeValue(range?.to),\n });\n }\n };\n\n const handleTimeChangeTo = (date?: Date) => {\n if (date) {\n setToTime(date);\n // Merge: keep date (year, month, day) from existing range.to, take time (hours, minutes, seconds) from TimePicker\n const mergedDate = new Date(range?.to || new Date());\n mergedDate.setHours(\n date.getHours(),\n date.getMinutes(),\n date.getSeconds(),\n 0\n );\n\n const newRange: DateRange = {\n from: range?.from,\n to: mergedDate,\n };\n setRange(newRange);\n setToInputValue(formatDateTimeValue(mergedDate));\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(mergedDate),\n });\n onChange?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(mergedDate),\n });\n }\n };\n\n // Determine trigger component\n const triggerComponent = children ? (\n children({\n fromValue: fromInputValue,\n toValue: toInputValue,\n range,\n onSelect: handleSelectForRenderProp,\n onFromChange: handleFromChangeForRenderProp,\n onToChange: handleToChangeForRenderProp,\n })\n ) : (\n <Button\n variant=\"ghost\"\n className=\"!p-1 !leading-0 h-auto rounded hover:bg-accent transition-colors\"\n size={props?.size}\n >\n <CalendarIcon\n className={cn({\n \"size-3\": props.size === \"xs\" || props.size === \"sm\",\n \"size-3.5\": !props.size || props.size === \"normal\",\n \"size-4\": props.size === \"lg\" || props.size === \"xl\",\n })}\n />\n <span className=\"sr-only\">Select date range</span>\n </Button>\n );\n\n const calendarSelection = (\n <div\n className={cn(\"flex items-stretch\", showTime && !hideDate ? \"gap-0\" : \"\")}\n >\n {!hideDate && (\n <Calendar\n {...calendarConfig}\n mode=\"range\"\n selected={range as any}\n captionLayout=\"dropdown\"\n month={month}\n onMonthChange={setMonth}\n numberOfMonths={isMobile ? 1 : numberOfMonths || 1}\n variant={variant}\n color={color}\n onSelect={(selectedRange) => {\n // Preserve time from TimePicker values if showTime is enabled\n let preservedRange = selectedRange;\n if (showTime) {\n // Get current time from TimePicker state\n const fromTimeObj = fromTime;\n const toTimeObj = toTime;\n\n preservedRange = {\n from: selectedRange?.from\n ? new Date(\n selectedRange.from.getFullYear(),\n selectedRange.from.getMonth(),\n selectedRange.from.getDate(),\n fromTimeObj?.getHours() || 0,\n fromTimeObj?.getMinutes() || 0,\n fromTimeObj?.getSeconds() || 0\n )\n : undefined,\n to: selectedRange?.to\n ? new Date(\n selectedRange.to.getFullYear(),\n selectedRange.to.getMonth(),\n selectedRange.to.getDate(),\n toTimeObj?.getHours() || 0,\n toTimeObj?.getMinutes() || 0,\n toTimeObj?.getSeconds() || 0\n )\n : undefined,\n };\n }\n setRange(preservedRange);\n const fromFormatted = formatDateTimeValue(preservedRange?.from);\n const toFormatted = formatDateTimeValue(preservedRange?.to);\n setFromInputValue(fromFormatted);\n setToInputValue(toFormatted);\n onSelect?.(preservedRange, {\n from: fromFormatted,\n to: toFormatted,\n });\n onChange?.(preservedRange, {\n from: fromFormatted,\n to: toFormatted,\n });\n if (\n closeOnSelect &&\n preservedRange?.from &&\n preservedRange?.to &&\n !showTime\n ) {\n setOpen(false);\n }\n }}\n locale={_locale}\n formatters={{\n formatMonthDropdown: (date) =>\n date.toLocaleString(_locale.code, { month: \"short\" }),\n }}\n showOutsideDays={showOutsideDays}\n className={cn(\n \"mx-auto\",\n {\n \"[--cell-size:clamp(0px,calc(100vw/7.5),52px)] mb-8 bg-transparent\":\n isMobile || desktopMode === \"drawer\",\n \"[--cell-size:clamp(0px,calc(100vw/7.5),34px)]\":\n !isMobile && desktopMode !== \"drawer\",\n },\n calendarClassName\n )}\n />\n )}\n {showTime && (\n <div className=\"flex gap-0 border-l border-border\">\n <TimePicker\n {...timeConfig?.[0]}\n value={fromTime ? dfFormat(fromTime, timeFormat) : undefined}\n onSelect={handleTimeChangeFrom}\n format={timeFormat}\n showHours\n showMinutes\n showSeconds={timeFormat === \"HH:mm:ss\"}\n standalone={false}\n />\n <div className=\"border-l border-border\" />\n <TimePicker\n {...timeConfig?.[1]}\n value={toTime ? dfFormat(toTime, timeFormat) : undefined}\n onSelect={handleTimeChangeTo}\n format={timeFormat}\n showHours\n showMinutes\n showSeconds={timeFormat === \"HH:mm:ss\"}\n standalone={false}\n />\n </div>\n )}\n </div>\n );\n\n const popPicker = (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild disabled={props.disabled}>\n {triggerComponent}\n </PopoverTrigger>\n <PopoverContent\n className={cn(\n \"w-auto overflow-hidden p-0\",\n \"backdrop-blur bg-background/50\"\n )}\n side={side}\n align={align}\n >\n {calendarSelection}\n </PopoverContent>\n </Popover>\n );\n\n const drawPicker = (\n <Drawer open={open} onOpenChange={setOpen}>\n <DrawerTrigger asChild>{triggerComponent}</DrawerTrigger>\n <DrawerContent\n className={cn(\n \"w-auto overflow-hidden p-0\",\n \"backdrop-blur bg-background\"\n )}\n >\n <DrawerHeader className=\"sr-only\">\n <DrawerTitle>Select date range</DrawerTitle>\n <DrawerDescription>Set your date range</DrawerDescription>\n </DrawerHeader>\n {calendarSelection}\n </DrawerContent>\n </Drawer>\n );\n\n // If children is provided, use render prop pattern with picker\n if (children) {\n const mode = isMobile ? mobileMode : desktopMode;\n return mode === \"drawer\" ? drawPicker : popPicker;\n }\n\n // Helper function to render range input\n const renderRangeInput = (\n type: \"from\" | \"to\",\n inputValue: string,\n setInputValue: (value: string) => void,\n additionalProps?: Partial<InputProps>\n ) => {\n const isFrom = type === \"from\";\n\n return (\n <Input\n {...props}\n {...additionalProps}\n ref={isFrom ? fromInputRef : toInputRef}\n id={inputId}\n size={\n props.isFloatLabel ? (props.size ? props.size : \"xl\") : props.size\n }\n className={cn(\n props.className,\n \"relative peer border-0 focus:ring-0 rounded-none hover:bg-transparent active:bg-transparent focus-visible:ring-0 focus-visible:border-0\",\n isFrom ? \"pr-0\" : \"\"\n )}\n label={\n props.isFloatLabel && typeof label === \"object\"\n ? isFrom\n ? label?.from || \"\"\n : label?.to || \"\"\n : \"\"\n }\n placeholder={\n typeof placeholder === \"object\"\n ? isFrom\n ? placeholder?.from || \"\"\n : placeholder?.to || \"\"\n : placeholder\n }\n clearable={!isFrom}\n value={inputValue}\n mask={maskToUse}\n onChange={(e) => {\n const inputValue = e.target.value;\n setInputValue(inputValue);\n\n // If the input is cleared (empty), clear both fields\n if (inputValue.trim() === \"\") {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n onChange?.(newRange, newRange as DateRangeText);\n return;\n }\n\n // Try to parse based on showTime\n let date: Date | undefined;\n if (showTime) {\n date = parseDate(inputValue, `${inputFormat} ${timeFormat}`);\n } else {\n date = parseDate(inputValue, inputFormat);\n }\n const newRange: DateRange = isFrom\n ? { from: date, to: range?.to }\n : { from: range?.from, to: date };\n\n if (date) {\n setRange(newRange);\n if (isFrom) setMonth(date);\n // Update time state if time was parsed\n if (isFrom) {\n setFromTime(date);\n // setFromInputValue(formatDateTimeValue(date)); // Sync input value\n } else {\n setToTime(date);\n // setToInputValue(formatDateTimeValue(date)); // Sync input value\n }\n const fromFormatted = formatDateTimeValue(\n isFrom ? date : range?.from\n );\n const toFormatted = formatDateTimeValue(isFrom ? range?.to : date);\n onSelect?.(newRange, { from: fromFormatted, to: toFormatted });\n onChange?.(newRange, {\n from: isFrom ? inputValue : fromInputValue,\n to: isFrom ? toInputValue : inputValue,\n });\n\n // If from input and date is valid, auto-focus to to input if to is empty\n // if (isFrom && toInputRef.current && !toInputValue.trim()) {\n // requestAnimationFrame(() => toInputRef.current?.focus());\n // }\n } else {\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: isFrom ? formatDateTimeValue(range?.to) : undefined,\n });\n onChange?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: isFrom ? formatDateTimeValue(range?.to) : undefined,\n });\n }\n }}\n onClear={\n !isFrom\n ? () => {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n onChange?.(newRange, newRange as DateRangeText);\n }\n : undefined\n }\n onBlur={() => {\n // Check if blurring out of the entire range picker group\n const activeElement = document.activeElement;\n if (\n activeElement !== fromInputRef.current &&\n activeElement !== toInputRef.current\n ) {\n // Delay validation by 100ms\n setTimeout(() => {\n // Check again if still blurred out of the group\n const currentActiveElement = document.activeElement;\n if (\n currentActiveElement !== fromInputRef.current &&\n currentActiveElement !== toInputRef.current\n ) {\n // Blurred out of the group, validate both inputs\n const validateInput = (val: string) => {\n if (val.trim() === \"\") return true; // empty is valid (will clear)\n let parsed: Date | undefined;\n if (showTime) {\n parsed = parseDate(val, `${inputFormat} ${timeFormat}`);\n } else {\n parsed = parseDate(val, inputFormat);\n }\n return !!parsed;\n };\n\n const fromValid = validateInput(fromInputValue);\n const toValid = validateInput(toInputValue);\n\n // Clear if either is invalid, or if only one has value\n const shouldClear =\n !fromValid ||\n !toValid ||\n (fromInputValue.trim() && !toInputValue.trim()) ||\n (!fromInputValue.trim() && toInputValue.trim());\n\n if (shouldClear) {\n // If either is invalid, clear both\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = {\n from: undefined,\n to: undefined,\n };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n onChange?.(newRange, newRange as DateRangeText);\n }\n }\n }, 100);\n }\n }}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setOpen(true);\n }\n }}\n />\n );\n };\n\n // Default input rendering with two inputs\n return (\n <div\n className={cn(\n \"group relative flex items-center border rounded-md focus-within:ring-2 focus-within:ring-offset-2 bg-background transition-[color,box-shadow]\",\n {\n \"border-input focus-within:ring-ring\": !props.state,\n \"border-success focus-within:ring-success\": props.state === \"success\",\n \"border-warning focus-within:ring-warning\": props.state === \"warning\",\n \"border-error focus-within:ring-error\": props.state === \"error\",\n }\n )}\n >\n {renderRangeInput(\"from\", fromInputValue, setFromInputValue)}\n <span\n className={cn(\"text-muted-foreground select-none pl-2\", {\n \"opacity-30\": props.disabled,\n })}\n >\n {separator}\n </span>\n {renderRangeInput(\"to\", toInputValue, setToInputValue, {\n suffixIcon: isMobile\n ? mobileMode === \"drawer\"\n ? drawPicker\n : popPicker\n : desktopMode === \"drawer\"\n ? drawPicker\n : popPicker,\n })}\n {props.isFloatLabel && typeof label === \"string\" && (\n <FloatingLabel\n htmlFor={inputId}\n size={props.size}\n infoTooltip={props.infoTooltip}\n className=\"z-10\"\n shouldFloat={shouldFloat}\n >\n {label}\n </FloatingLabel>\n )}\n </div>\n );\n}\n"],"names":["formatDate","date","outputFormat","DATE_FORMAT","locale","dfFormat","parseDate","str","inputFormat","parse","isValid","generateMaskFromFormat","format","match","RangePicker","label","value","placeholder","onChange","onSelect","calendarClassName","side","align","language","mask","closeOnSelect","showOutsideDays","calendarConfig","timeConfig","desktopMode","mobileMode","children","separator","jsx","MoveRight","showTime","timeFormat","hideDate","numberOfMonths","variant","color","props","inputId","React","maskToUse","initialFromDate","initialToDate","initialRange","open","setOpen","range","setRange","month","setMonth","fromInputValue","setFromInputValue","toInputValue","setToInputValue","fromTime","setFromTime","toTime","setToTime","fromInputRef","toInputRef","shouldFloat","_locale","enUS","vi","formatDateTimeValue","d","result","handleSelectForRenderProp","fromFormatted","toFormatted","handleFromChangeForRenderProp","text","newRange","parsedDate","handleToChangeForRenderProp","handleTimeChangeFrom","mergedDate","handleTimeChangeTo","triggerComponent","jsxs","Button","CalendarIcon","cn","calendarSelection","Calendar","isMobile","selectedRange","preservedRange","fromTimeObj","toTimeObj","TimePicker","popPicker","Popover","PopoverTrigger","PopoverContent","drawPicker","Drawer","DrawerTrigger","DrawerContent","DrawerHeader","DrawerTitle","DrawerDescription","renderRangeInput","type","inputValue","setInputValue","additionalProps","isFrom","Input","e","activeElement","currentActiveElement","validateInput","val","parsed","fromValid","toValid","FloatingLabel"],"mappings":"+pEAuCA,SAASA,GACPC,EACAC,EAA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AyB,CAChD,CACF,CACF,EAAG,GAAG,CAEV,EACA,UAAYqC,GAAM,CACZA,EAAE,MAAQ,cACZA,EAAE,eAAA,EACFhE,EAAQ,EAAI,EAEhB,CAAA,CAAA,CAGN,EAGA,OACEkC,EAAAA,KAAC,MAAA,CACC,UAAWG,EAAAA,GACT,gJACA,CACE,sCAAuC,CAAC7C,EAAM,MAC9C,2CAA4CA,EAAM,QAAU,UAC5D,2CAA4CA,EAAM,QAAU,UAC5D,uCAAwCA,EAAM,QAAU,OAAA,CAC1D,EAGD,SAAA,CAAAiE,GAAiB,OAAQpD,EAAgBC,CAAiB,EAC3DtB,EAAAA,IAAC,OAAA,CACC,UAAWqD,EAAAA,GAAG,yCAA0C,CACtD,aAAc7C,EAAM,QAAA,CACrB,EAEA,SAAAT,EAAA,CAAA,EAEF0E,GAAiB,KAAMlD,EAAcC,EAAiB,CACrD,WAAYgC,EAAAA,SACR3D,KAAe,SACbqE,EACAJ,EACFlE,IAAgB,SACdsE,EACAJ,CAAA,CACP,EACAtD,EAAM,cAAgB,OAAO1B,GAAU,UACtCkB,EAAAA,IAACwF,GAAAA,cAAA,CACC,QAAS/E,GACT,KAAMD,EAAM,KACZ,YAAaA,EAAM,YACnB,UAAU,OACV,YAAAuB,GAEC,SAAAjD,CAAA,CAAA,CACH,CAAA,CAAA,CAIR"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./components/Command/index.cjs"),p=require("./components/Popover/index.cjs"),T=require("./components/Tour/index.cjs"),c=require("./components/QrCode/index.cjs"),C=require("./components/Stepper/index.cjs"),g=require("./components/Pagination/index.cjs"),m=require("./components/DropdownMenu/index.cjs"),x=require("./components/ContextMenu/index.cjs"),f=require("./components/FloatLabel.cjs"),R=require("./components/TimeGridView.cjs"),I=require("./components/WheelColumn.cjs"),M=require("./components/Marquee/index.cjs");require("@radix-ui/react-slot");require("./packages/ui/src/components/button.cjs");require("./packages/ui/src/components/button-group.cjs");require("./packages/ui/src/components/input.cjs");require("./packages/ui/src/components/textarea.cjs");const P=require("./packages/ui/src/components/label.cjs");require("./packages/ui/src/components/select.cjs");require("./packages/ui/src/components/combobox.cjs");require("react/jsx-runtime");require("@radix-ui/react-tooltip");const k=require("./packages/ui/src/lib/utils.cjs");require("react");require("lucide-react");require("react-day-picker");require("./packages/ui/src/components/popover.cjs");require("@radix-ui/react-separator");require("./packages/ui/src/components/switch.cjs");require("vaul");require("@radix-ui/react-scroll-area");const G=require("./packages/ui/src/components/tree-view.cjs");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-avatar");require("./packages/ui/src/components/badge.cjs");require("./packages/ui/src/components/checkbox.cjs");require("@radix-ui/react-collapsible");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-dropdown-menu");require("./packages/ui/src/components/input-otp.cjs");require("./packages/ui/src/components/radio-group.cjs");const w=require("./packages/ui/src/components/sidebar.cjs");require("@radix-ui/react-slider");require("./packages/ui/src/components/tabs.cjs");require("./packages/ui/src/components/toggle.cjs");const A=require("./hooks/use-callback-ref.cjs"),v=require("./hooks/use-debounced-callback.cjs"),B=require("./hooks/use-debounced-value.cjs"),y=require("./hooks/use-intersection-observer.cjs"),V=require("./hooks/use-script.cjs"),F=require("./hooks/use-scroll-lock.cjs"),D=require("./hooks/use-on-click-outside.cjs"),E=require("./hooks/use-event-listener.cjs"),O=require("./hooks/use-media-query.cjs"),z=require("./components/Badge/Badge.cjs"),L=require("./components/Breadcrumb/Breadcrumb.cjs"),h=require("./components/Button/Button.cjs"),W=require("./components/Button/ButtonGroup.cjs"),Q=require("./components/Checkbox/Checkbox.cjs"),H=require("./components/Collapsible/Collapsible.cjs"),$=require("./components/Dialog/Dialog.cjs"),N=require("./components/Glass/Glass.cjs"),U=require("./components/Input/Input.cjs"),_=require("./components/InputOTP/InputOTP.cjs"),j=require("./components/Radio/Radio.cjs"),J=require("./components/ScrollArea/ScrollArea.cjs"),K=require("./components/Select/Select.cjs"),X=require("./components/Separator/Separator.cjs"),Y=require("./components/Sheet/Sheet.cjs"),Z=require("./components/Skeleton/Skeleton.cjs"),ee=require("./components/Slider/Slider.cjs"),re=require("./components/Switch/Switch.cjs"),oe=require("./components/Tabs/Tabs.cjs"),ie=require("./components/Textarea/Textarea.cjs"),te=require("./components/Toggle/Toggle.cjs"),ue=require("./components/Rate/Rate.cjs"),t=require("./components/Resizable/Resizable.cjs"),ae=require("./components/Accordion/Accordion.cjs"),ne=require("./lib/TextAnimation/BlurText.cjs"),se=require("./lib/TextAnimation/CircularText.cjs"),le=require("./lib/TextAnimation/TextPressureEffect.cjs"),ce=require("./lib/TextAnimation/TypingText.cjs"),de=require("./components/Table/data-table.cjs"),qe=require("./components/Avatar/Avatar.cjs"),be=require("./components/Calendar/Calendar.cjs"),Se=require("./components/DatePicker/DatePicker.cjs"),pe=require("./components/DatePicker/RangePicker.cjs"),Te=require("./components/DatePicker/TimePicker.cjs"),e=require("./components/Sidebar/Sidebar.cjs"),a=require("./components/Toast/Toast.cjs"),Ce=require("./components/Tooltip/Tooltip.cjs"),ge=require("./components/Upload/Upload.cjs"),me=require("./components/QrCode/QrCode.cjs"),xe=require("./components/Stepper/Stepper.cjs"),n=require("./packages/ui/src/components/resizable.cjs"),s=require("./packages/ui/src/components/accordion.cjs"),l=require("./components/ImageViewer/ImageViewer.cjs"),d=require("./components/Carousel/Carousel.cjs"),o=require("./components/Cropper/Cropper.cjs"),q=require("./components/Cropper/CropperTool.cjs"),i=require("./components/Cropper/utils.cjs"),r=require("./components/Interactive/CursorFollow.cjs"),u=require("./components/Masonry/Masonry.cjs"),b=require("./components/Masonry/MasonryWrapper.cjs"),fe=require("./lib/TextAnimation/RotatingText.cjs"),Re=require("./lib/TextAnimation/FlipWords.cjs"),Ie=require("./lib/TextAnimation/GradientText.cjs"),Me=require("./lib/TextAnimation/RollingText.cjs"),Pe=require("./lib/TextAnimation/ShimmeringText.cjs"),ke=require("./lib/TextAnimation/SplittingText.cjs"),Ge=require("./lib/TextAnimation/TextGenerateEffect.cjs"),we=require("./lib/TextAnimation/TextHoverEffect.cjs"),Ae=require("./lib/TextAnimation/WritingText.cjs");exports.Command=S.Command;exports.Popover=p.Popover;exports.Tour=T.Tour;exports.QRCode=c.QRCode;exports.QrCode=c.QRCode;exports.Stepper=C.Stepper;exports.Pagination=g.Pagination;exports.DropdownMenu=m.DropdownMenu;exports.ContextMenu=x.ContextMenu;exports.FloatingLabel=f.FloatingLabel;exports.TimeGridView=R.TimeGridView;exports.WheelColumn=I.TimeColumnwheel;exports.Marquee=M.Marquee;exports.Label=P.Label;exports.cn=k.cn;exports.TreeSelect=G.TreeView;exports.useSidebar=w.useSidebar;exports.useCallbackRef=A.useCallbackRef;exports.useDebouncedCallback=v.useDebouncedCallback;exports.useDebounceValue=B.useDebounceValue;exports.useIntersectionObserver=y.useIntersectionObserver;exports.useScript=V.useScript;exports.useScrollLock=F.useScrollLock;exports.useOnClickOutside=D.useOnClickOutside;exports.useEventListener=E.useEventListener;exports.useMediaQuery=O.useMediaQuery;exports.Badge=z.default;exports.Breadcrumb=L.default;exports.Button=h.default;exports.ButtonGroup=W.default;exports.Checkbox=Q.default;exports.Collapsible=H.default;exports.Dialog=$.default;exports.Glass=N.default;exports.Input=U.default;exports.InputOTP=_.default;exports.Radio=j.default;exports.ScrollArea=J.ScrollArea;exports.Select=K.default;exports.Separator=X.default;exports.Sheet=Y.default;exports.Skeleton=Z.default;exports.Slider=ee.default;exports.Switch=re.default;exports.Tabs=oe.default;exports.Textarea=ie.default;exports.Toggle=te.default;exports.Rate=ue.default;exports.Handle=t.Handle;exports.Panel=t.Panel;exports.Resizable=t.default;exports.ResizableWrapper=t.ResizableWrapper;exports.Accordion=ae.default;exports.BlurText=ne.default;exports.CircularText=se.default;exports.TextPressure=le.default;exports.TypingText=ce.default;exports.Table=de.DataTable;exports.Avatar=qe.Avatar;exports.Calendar=be.Calendar;exports.DatePicker=Se.DatePicker;exports.RangePicker=pe.RangePicker;exports.TimePicker=Te.TimePicker;exports.Sidebar=e.Sidebar;exports.SidebarContent=e.SidebarContent;exports.SidebarFooter=e.SidebarFooter;exports.SidebarGroup=e.SidebarGroup;exports.SidebarGroupAction=e.SidebarGroupAction;exports.SidebarGroupContent=e.SidebarGroupContent;exports.SidebarGroupLabel=e.SidebarGroupLabel;exports.SidebarHeader=e.SidebarHeader;exports.SidebarInput=e.SidebarInput;exports.SidebarInset=e.SidebarInset;exports.SidebarMenu=e.SidebarMenu;exports.SidebarMenuAction=e.SidebarMenuAction;exports.SidebarMenuBadge=e.SidebarMenuBadge;exports.SidebarMenuButton=e.SidebarMenuButton;exports.SidebarMenuItem=e.SidebarMenuItem;exports.SidebarMenuSkeleton=e.SidebarMenuSkeleton;exports.SidebarMenuSub=e.SidebarMenuSub;exports.SidebarMenuSubButton=e.SidebarMenuSubButton;exports.SidebarMenuSubItem=e.SidebarMenuSubItem;exports.SidebarProvider=e.SidebarProvider;exports.SidebarRail=e.SidebarRail;exports.SidebarSeparator=e.SidebarSeparator;exports.SidebarTrigger=e.SidebarTrigger;exports.Toast=a.toast;exports.Toaster=a.Toaster;exports.toast=a.toast;exports.Tooltip=Ce.Tooltip;exports.Upload=ge.Upload;exports.useQRCode=me.useQRCode;exports.useStepper=xe.useStepper;exports.ResizableHandle=n.ResizableHandle;exports.ResizablePanel=n.ResizablePanel;exports.ResizablePanelGroup=n.ResizablePanelGroup;exports.AccordionContent=s.AccordionContent;exports.AccordionItem=s.AccordionItem;exports.AccordionTrigger=s.AccordionTrigger;exports.ImageViewer=l.ImageViewer;exports.ImageViewerGroup=l.ImageViewerGroup;exports.ImageViewerImage=l.ImageViewerImage;exports.Carousel=d.Carousel;exports.CarouselSlide=d.CarouselSlide;exports.Cropper=o.Root;exports.CropperArea=o.Area;exports.CropperImage=o.Image;exports.CropperVideo=o.Video;exports.useCropper=o.useCropper;exports.CropperTool=q.CropperTool;exports.useCropperTool=q.useCropperTool;exports.base64ToBlob=i.base64ToBlob;exports.base64ToFile=i.base64ToFile;exports.downloadImage=i.downloadImage;exports.getCroppedImg=i.getCroppedImg;exports.rotateSize=i.rotateSize;exports.Cursor=r.Cursor;exports.CursorFollow=r.CursorFollow;exports.CursorProvider=r.CursorProvider;exports.TRANSITION_PRESETS=r.TRANSITION_PRESETS;exports.useCursor=r.useCursor;exports.useCursorFollow=r.useCursorFollow;exports.Item=u.Item;exports.MasonryItem=u.MasonryItem;exports.MasonryRoot=u.MasonryRoot;exports.Root=u.Root;exports.Masonry=b.Masonry;exports.MasonryComponent=b.MasonryComponent;exports.RotatingText=fe.RotatingText;exports.FlipWords=Re.FlipWords;exports.GradientText=Ie.GradientText;exports.RollingText=Me.RollingText;exports.ShimmeringText=Pe.ShimmeringText;exports.SplittingText=ke.SplittingText;exports.TextGenerateEffect=Ge.TextGenerateEffect;exports.TextHoverEffect=we.TextHoverEffect;exports.WritingText=Ae.WritingText;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("./components/Command/index.cjs"),C=require("./components/Popover/index.cjs"),g=require("./components/Tour/index.cjs"),c=require("./components/QrCode/index.cjs"),m=require("./components/Stepper/index.cjs"),x=require("./components/Pagination/index.cjs"),f=require("./components/DropdownMenu/index.cjs"),R=require("./components/ContextMenu/index.cjs"),I=require("./components/FloatLabel.cjs"),M=require("./components/TimeGridView.cjs"),G=require("./components/WheelColumn.cjs"),P=require("./components/Marquee/index.cjs");require("@radix-ui/react-slot");require("./packages/ui/src/components/button.cjs");const d=require("./packages/ui/src/components/button-group.cjs");require("./packages/ui/src/components/input.cjs");require("./packages/ui/src/components/textarea.cjs");const k=require("./packages/ui/src/components/label.cjs");require("./packages/ui/src/components/select.cjs");require("./packages/ui/src/components/combobox.cjs");require("react/jsx-runtime");require("@radix-ui/react-tooltip");const w=require("./packages/ui/src/lib/utils.cjs");require("react");require("lucide-react");require("react-day-picker");require("./packages/ui/src/components/popover.cjs");require("@radix-ui/react-separator");require("./packages/ui/src/components/switch.cjs");require("vaul");require("@radix-ui/react-scroll-area");const B=require("./packages/ui/src/components/tree-view.cjs");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-avatar");require("./packages/ui/src/components/badge.cjs");require("./packages/ui/src/components/checkbox.cjs");require("@radix-ui/react-collapsible");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-dropdown-menu");require("./packages/ui/src/components/input-otp.cjs");require("./packages/ui/src/components/radio-group.cjs");const A=require("./packages/ui/src/components/sidebar.cjs");require("@radix-ui/react-slider");require("./packages/ui/src/components/tabs.cjs");require("./packages/ui/src/components/toggle.cjs");const v=require("./hooks/use-callback-ref.cjs"),y=require("./hooks/use-debounced-callback.cjs"),V=require("./hooks/use-debounced-value.cjs"),D=require("./hooks/use-intersection-observer.cjs"),F=require("./hooks/use-script.cjs"),E=require("./hooks/use-scroll-lock.cjs"),O=require("./hooks/use-on-click-outside.cjs"),z=require("./hooks/use-event-listener.cjs"),L=require("./hooks/use-media-query.cjs"),h=require("./components/Badge/Badge.cjs"),W=require("./components/Breadcrumb/Breadcrumb.cjs"),Q=require("./components/Button/Button.cjs"),H=require("./components/Button/ButtonGroup.cjs"),$=require("./components/Checkbox/Checkbox.cjs"),N=require("./components/Collapsible/Collapsible.cjs"),U=require("./components/Dialog/Dialog.cjs"),_=require("./components/Glass/Glass.cjs"),j=require("./components/Input/Input.cjs"),J=require("./components/InputOTP/InputOTP.cjs"),K=require("./components/Radio/Radio.cjs"),X=require("./components/ScrollArea/ScrollArea.cjs"),Y=require("./components/Select/Select.cjs"),Z=require("./components/Separator/Separator.cjs"),ee=require("./components/Sheet/Sheet.cjs"),re=require("./components/Skeleton/Skeleton.cjs"),oe=require("./components/Slider/Slider.cjs"),te=require("./components/Switch/Switch.cjs"),ie=require("./components/Tabs/Tabs.cjs"),ue=require("./components/Textarea/Textarea.cjs"),ae=require("./components/Toggle/Toggle.cjs"),ne=require("./components/Rate/Rate.cjs"),i=require("./components/Resizable/Resizable.cjs"),se=require("./components/Accordion/Accordion.cjs"),le=require("./lib/TextAnimation/BlurText.cjs"),ce=require("./lib/TextAnimation/CircularText.cjs"),de=require("./lib/TextAnimation/TextPressureEffect.cjs"),qe=require("./lib/TextAnimation/TypingText.cjs"),be=require("./components/Table/data-table.cjs"),Se=require("./components/Avatar/Avatar.cjs"),q=require("./components/Calendar/Calendar.cjs"),pe=require("./components/DatePicker/DatePicker.cjs"),Te=require("./components/DatePicker/RangePicker.cjs"),Ce=require("./components/DatePicker/TimePicker.cjs"),e=require("./components/Sidebar/Sidebar.cjs"),a=require("./components/Toast/Toast.cjs"),ge=require("./components/Tooltip/Tooltip.cjs"),me=require("./components/Upload/Upload.cjs"),xe=require("./components/QrCode/QrCode.cjs"),fe=require("./components/Stepper/Stepper.cjs"),n=require("./packages/ui/src/components/resizable.cjs"),s=require("./packages/ui/src/components/accordion.cjs"),l=require("./components/ImageViewer/ImageViewer.cjs"),b=require("./components/Carousel/Carousel.cjs"),o=require("./components/Cropper/Cropper.cjs"),S=require("./components/Cropper/CropperTool.cjs"),t=require("./components/Cropper/utils.cjs"),r=require("./components/Interactive/CursorFollow.cjs"),u=require("./components/Masonry/Masonry.cjs"),p=require("./components/Masonry/MasonryWrapper.cjs"),Re=require("./lib/TextAnimation/RotatingText.cjs"),Ie=require("./lib/TextAnimation/FlipWords.cjs"),Me=require("./lib/TextAnimation/GradientText.cjs"),Ge=require("./lib/TextAnimation/RollingText.cjs"),Pe=require("./lib/TextAnimation/ShimmeringText.cjs"),ke=require("./lib/TextAnimation/SplittingText.cjs"),we=require("./lib/TextAnimation/TextGenerateEffect.cjs"),Be=require("./lib/TextAnimation/TextHoverEffect.cjs"),Ae=require("./lib/TextAnimation/WritingText.cjs");exports.Command=T.Command;exports.Popover=C.Popover;exports.Tour=g.Tour;exports.QRCode=c.QRCode;exports.QrCode=c.QRCode;exports.Stepper=m.Stepper;exports.Pagination=x.Pagination;exports.DropdownMenu=f.DropdownMenu;exports.ContextMenu=R.ContextMenu;exports.FloatingLabel=I.FloatingLabel;exports.TimeGridView=M.TimeGridView;exports.WheelColumn=G.TimeColumnwheel;exports.Marquee=P.Marquee;exports.ButtonGroupSeparator=d.ButtonGroupSeparator;exports.ButtonGroupText=d.ButtonGroupText;exports.Label=k.Label;exports.cn=w.cn;exports.TreeSelect=B.TreeView;exports.useSidebar=A.useSidebar;exports.useCallbackRef=v.useCallbackRef;exports.useDebouncedCallback=y.useDebouncedCallback;exports.useDebounceValue=V.useDebounceValue;exports.useIntersectionObserver=D.useIntersectionObserver;exports.useScript=F.useScript;exports.useScrollLock=E.useScrollLock;exports.useOnClickOutside=O.useOnClickOutside;exports.useEventListener=z.useEventListener;exports.useMediaQuery=L.useMediaQuery;exports.Badge=h.default;exports.Breadcrumb=W.default;exports.Button=Q.default;exports.ButtonGroup=H.default;exports.Checkbox=$.default;exports.Collapsible=N.default;exports.Dialog=U.default;exports.Glass=_.default;exports.Input=j.default;exports.InputOTP=J.default;exports.Radio=K.default;exports.ScrollArea=X.ScrollArea;exports.Select=Y.default;exports.Separator=Z.default;exports.Sheet=ee.default;exports.Skeleton=re.default;exports.Slider=oe.default;exports.Switch=te.default;exports.Tabs=ie.default;exports.Textarea=ue.default;exports.Toggle=ae.default;exports.Rate=ne.default;exports.Handle=i.Handle;exports.Panel=i.Panel;exports.Resizable=i.default;exports.ResizableWrapper=i.ResizableWrapper;exports.Accordion=se.default;exports.BlurText=le.default;exports.CircularText=ce.default;exports.TextPressure=de.default;exports.TypingText=qe.default;exports.Table=be.DataTable;exports.Avatar=Se.Avatar;exports.Calendar=q.Calendar;exports.CalendarDayButton=q.CalendarDayButton;exports.DatePicker=pe.DatePicker;exports.RangePicker=Te.RangePicker;exports.TimePicker=Ce.TimePicker;exports.Sidebar=e.Sidebar;exports.SidebarContent=e.SidebarContent;exports.SidebarFooter=e.SidebarFooter;exports.SidebarGroup=e.SidebarGroup;exports.SidebarGroupAction=e.SidebarGroupAction;exports.SidebarGroupContent=e.SidebarGroupContent;exports.SidebarGroupLabel=e.SidebarGroupLabel;exports.SidebarHeader=e.SidebarHeader;exports.SidebarInput=e.SidebarInput;exports.SidebarInset=e.SidebarInset;exports.SidebarMenu=e.SidebarMenu;exports.SidebarMenuAction=e.SidebarMenuAction;exports.SidebarMenuBadge=e.SidebarMenuBadge;exports.SidebarMenuButton=e.SidebarMenuButton;exports.SidebarMenuItem=e.SidebarMenuItem;exports.SidebarMenuSkeleton=e.SidebarMenuSkeleton;exports.SidebarMenuSub=e.SidebarMenuSub;exports.SidebarMenuSubButton=e.SidebarMenuSubButton;exports.SidebarMenuSubItem=e.SidebarMenuSubItem;exports.SidebarProvider=e.SidebarProvider;exports.SidebarRail=e.SidebarRail;exports.SidebarSeparator=e.SidebarSeparator;exports.SidebarTrigger=e.SidebarTrigger;exports.Toast=a.toast;exports.Toaster=a.Toaster;exports.toast=a.toast;exports.Tooltip=ge.Tooltip;exports.Upload=me.Upload;exports.useQRCode=xe.useQRCode;exports.useStepper=fe.useStepper;exports.ResizableHandle=n.ResizableHandle;exports.ResizablePanel=n.ResizablePanel;exports.ResizablePanelGroup=n.ResizablePanelGroup;exports.AccordionContent=s.AccordionContent;exports.AccordionItem=s.AccordionItem;exports.AccordionTrigger=s.AccordionTrigger;exports.ImageViewer=l.ImageViewer;exports.ImageViewerGroup=l.ImageViewerGroup;exports.ImageViewerImage=l.ImageViewerImage;exports.Carousel=b.Carousel;exports.CarouselSlide=b.CarouselSlide;exports.Cropper=o.Root;exports.CropperArea=o.Area;exports.CropperImage=o.Image;exports.CropperVideo=o.Video;exports.useCropper=o.useCropper;exports.CropperTool=S.CropperTool;exports.useCropperTool=S.useCropperTool;exports.base64ToBlob=t.base64ToBlob;exports.base64ToFile=t.base64ToFile;exports.downloadImage=t.downloadImage;exports.getCroppedImg=t.getCroppedImg;exports.rotateSize=t.rotateSize;exports.Cursor=r.Cursor;exports.CursorFollow=r.CursorFollow;exports.CursorProvider=r.CursorProvider;exports.TRANSITION_PRESETS=r.TRANSITION_PRESETS;exports.useCursor=r.useCursor;exports.useCursorFollow=r.useCursorFollow;exports.Item=u.Item;exports.MasonryItem=u.MasonryItem;exports.MasonryRoot=u.MasonryRoot;exports.Root=u.Root;exports.Masonry=p.Masonry;exports.MasonryComponent=p.MasonryComponent;exports.RotatingText=Re.RotatingText;exports.FlipWords=Ie.FlipWords;exports.GradientText=Me.GradientText;exports.RollingText=Ge.RollingText;exports.ShimmeringText=Pe.ShimmeringText;exports.SplittingText=ke.SplittingText;exports.TextGenerateEffect=we.TextGenerateEffect;exports.TextHoverEffect=Be.TextHoverEffect;exports.WritingText=Ae.WritingText;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime");require("@radix-ui/react-slot");const i=require("class-variance-authority"),a=require("../lib/utils.cjs");require("@radix-ui/react-separator");const o=i.cva("flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",{variants:{orientation:{horizontal:"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}});function s({className:r,orientation:t,...e}){return n.jsx("div",{role:"group","data-slot":"button-group","data-orientation":t,className:a.cn(o({orientation:t}),r),...e})}exports.ButtonGroup=s;exports.buttonGroupVariants=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),i=require("@radix-ui/react-slot"),u=require("class-variance-authority"),n=require("../lib/utils.cjs"),l=require("./separator.cjs"),a=u.cva("flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",{variants:{orientation:{horizontal:"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}});function c({className:e,orientation:t,...o}){return r.jsx("div",{role:"group","data-slot":"button-group","data-orientation":t,className:n.cn(a({orientation:t}),e),...o})}function d({className:e,asChild:t=!1,...o}){const s=t?i.Slot:"div";return r.jsx(s,{className:n.cn("bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",e),...o})}function p({className:e,orientation:t="vertical",...o}){return r.jsx(l.Separator,{"data-slot":"button-group-separator",orientation:t,className:n.cn("bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto",e),...o})}exports.ButtonGroup=c;exports.ButtonGroupSeparator=p;exports.ButtonGroupText=d;exports.buttonGroupVariants=a;
2
2
  //# sourceMappingURL=button-group.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"button-group.cjs","sources":["../../../../../../../../packages/ui/src/components/button-group.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"@dsui/ui/lib/utils\";\nimport { Separator } from \"@dsui/ui/components/separator\";\n\nconst buttonGroupVariants = cva(\n \"flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2\",\n {\n variants: {\n orientation: {\n horizontal:\n \"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none\",\n vertical:\n \"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none\",\n },\n },\n defaultVariants: {\n orientation: \"horizontal\",\n },\n }\n);\n\nfunction ButtonGroup({\n className,\n orientation,\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof buttonGroupVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"button-group\"\n data-orientation={orientation}\n className={cn(buttonGroupVariants({ orientation }), className)}\n {...props}\n />\n );\n}\n\nfunction ButtonGroupText({\n className,\n asChild = false,\n ...props\n}: React.ComponentProps<\"div\"> & {\n asChild?: boolean;\n}) {\n const Comp = asChild ? Slot : \"div\";\n\n return (\n <Comp\n className={cn(\n \"bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction ButtonGroupSeparator({\n className,\n orientation = \"vertical\",\n ...props\n}: React.ComponentProps<typeof Separator>) {\n return (\n <Separator\n data-slot=\"button-group-separator\"\n orientation={orientation}\n className={cn(\n \"bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto\",\n className\n )}\n {...props}\n />\n );\n}\n\nexport {\n ButtonGroup,\n ButtonGroupSeparator,\n ButtonGroupText,\n buttonGroupVariants,\n};\n"],"names":["buttonGroupVariants","cva","ButtonGroup","className","orientation","props","jsx","cn"],"mappings":"oQAMA,MAAMA,EAAsBC,EAAAA,IAC1B,mSACA,CACE,SAAU,CACR,YAAa,CACX,WACE,kHACF,SACE,0HAAA,CACJ,EAEF,gBAAiB,CACf,YAAa,YAAA,CACf,CAEJ,EAEA,SAASC,EAAY,CACnB,UAAAC,EACA,YAAAC,EACA,GAAGC,CACL,EAA2E,CACzE,OACEC,EAAAA,IAAC,MAAA,CACC,KAAK,QACL,YAAU,eACV,mBAAkBF,EAClB,UAAWG,EAAAA,GAAGP,EAAoB,CAAE,YAAAI,CAAA,CAAa,EAAGD,CAAS,EAC5D,GAAGE,CAAA,CAAA,CAGV"}
1
+ {"version":3,"file":"button-group.cjs","sources":["../../../../../../../../packages/ui/src/components/button-group.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"@dsui/ui/lib/utils\";\nimport { Separator } from \"@dsui/ui/components/separator\";\n\nconst buttonGroupVariants = cva(\n \"flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2\",\n {\n variants: {\n orientation: {\n horizontal:\n \"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none\",\n vertical:\n \"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none\",\n },\n },\n defaultVariants: {\n orientation: \"horizontal\",\n },\n }\n);\n\nfunction ButtonGroup({\n className,\n orientation,\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof buttonGroupVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"button-group\"\n data-orientation={orientation}\n className={cn(buttonGroupVariants({ orientation }), className)}\n {...props}\n />\n );\n}\n\nfunction ButtonGroupText({\n className,\n asChild = false,\n ...props\n}: React.ComponentProps<\"div\"> & {\n asChild?: boolean;\n}) {\n const Comp = asChild ? Slot : \"div\";\n\n return (\n <Comp\n className={cn(\n \"bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction ButtonGroupSeparator({\n className,\n orientation = \"vertical\",\n ...props\n}: React.ComponentProps<typeof Separator>) {\n return (\n <Separator\n data-slot=\"button-group-separator\"\n orientation={orientation}\n className={cn(\n \"bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto\",\n className\n )}\n {...props}\n />\n );\n}\n\nexport {\n ButtonGroup,\n ButtonGroupSeparator,\n ButtonGroupText,\n buttonGroupVariants,\n};\n"],"names":["buttonGroupVariants","cva","ButtonGroup","className","orientation","props","jsx","cn","ButtonGroupText","asChild","Comp","Slot","ButtonGroupSeparator","Separator"],"mappings":"wPAMMA,EAAsBC,EAAAA,IAC1B,mSACA,CACE,SAAU,CACR,YAAa,CACX,WACE,kHACF,SACE,0HAAA,CACJ,EAEF,gBAAiB,CACf,YAAa,YAAA,CACf,CAEJ,EAEA,SAASC,EAAY,CACnB,UAAAC,EACA,YAAAC,EACA,GAAGC,CACL,EAA2E,CACzE,OACEC,EAAAA,IAAC,MAAA,CACC,KAAK,QACL,YAAU,eACV,mBAAkBF,EAClB,UAAWG,EAAAA,GAAGP,EAAoB,CAAE,YAAAI,CAAA,CAAa,EAAGD,CAAS,EAC5D,GAAGE,CAAA,CAAA,CAGV,CAEA,SAASG,EAAgB,CACvB,UAAAL,EACA,QAAAM,EAAU,GACV,GAAGJ,CACL,EAEG,CACD,MAAMK,EAAOD,EAAUE,EAAAA,KAAO,MAE9B,OACEL,EAAAA,IAACI,EAAA,CACC,UAAWH,EAAAA,GACT,yJACAJ,CAAA,EAED,GAAGE,CAAA,CAAA,CAGV,CAEA,SAASO,EAAqB,CAC5B,UAAAT,EACA,YAAAC,EAAc,WACd,GAAGC,CACL,EAA2C,CACzC,OACEC,EAAAA,IAACO,EAAAA,UAAA,CACC,YAAU,yBACV,YAAAT,EACA,UAAWG,EAAAA,GACT,yEACAJ,CAAA,EAED,GAAGE,CAAA,CAAA,CAGV"}
@@ -1,50 +1,53 @@
1
1
  import { jsx as B } from "react/jsx-runtime";
2
- import t from "react";
3
- import { ButtonGroup as g } from "../../packages/ui/src/components/button-group.js";
4
- import { cn as G } from "../../packages/ui/src/lib/utils.js";
2
+ import r from "react";
3
+ import { ButtonGroup as G } from "../../packages/ui/src/components/button-group.js";
4
+ import { ButtonGroupSeparator as R, ButtonGroupText as _ } from "../../packages/ui/src/components/button-group.js";
5
+ import { cn as g } from "../../packages/ui/src/lib/utils.js";
5
6
  import "class-variance-authority";
6
- import h from "./Button.js";
7
- const z = t.forwardRef(
7
+ import x from "./Button.js";
8
+ const h = r.forwardRef(
8
9
  ({
9
10
  className: a,
10
- orientation: i = "horizontal",
11
- variant: e,
12
- color: s,
13
- size: p,
11
+ orientation: e = "horizontal",
12
+ variant: i,
13
+ color: p,
14
+ size: s,
14
15
  animation: n,
15
16
  isLoading: m,
16
- disabled: l,
17
- children: u,
17
+ disabled: u,
18
+ children: l,
18
19
  ...d
19
20
  }, f) => {
20
- const c = t.Children.map(u, (r) => {
21
- if (t.isValidElement(r) && r.type === h) {
22
- const o = r.props;
23
- return t.cloneElement(r, {
24
- variant: n === "glass" ? "ghost" : o.variant ?? e,
25
- color: o.color ?? s,
26
- size: o.size ?? p,
21
+ const c = r.Children.map(l, (t) => {
22
+ if (r.isValidElement(t) && t.type === x) {
23
+ const o = t.props;
24
+ return r.cloneElement(t, {
25
+ variant: n === "glass" ? "ghost" : o.variant ?? i,
26
+ color: o.color ?? p,
27
+ size: o.size ?? s,
27
28
  animation: o.animation ?? n,
28
29
  isLoading: o.isLoading ?? m,
29
- disabled: o.disabled ?? l
30
+ disabled: o.disabled ?? u
30
31
  });
31
32
  }
32
- return r;
33
+ return t;
33
34
  });
34
35
  return /* @__PURE__ */ B(
35
- g,
36
+ G,
36
37
  {
37
38
  ref: f,
38
- orientation: i,
39
- className: G(a),
39
+ orientation: e,
40
+ className: g(a),
40
41
  ...d,
41
42
  children: c
42
43
  }
43
44
  );
44
45
  }
45
46
  );
46
- z.displayName = "ButtonGroup";
47
+ h.displayName = "ButtonGroup";
47
48
  export {
48
- z as default
49
+ R as ButtonGroupSeparator,
50
+ _ as ButtonGroupText,
51
+ h as default
49
52
  };
50
53
  //# sourceMappingURL=ButtonGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonGroup.js","sources":["../../../../src/components/Button/ButtonGroup.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n ButtonGroup as SButtonGroup,\n ButtonGroupSeparator,\n ButtonGroupText,\n buttonGroupVariants,\n} from \"@dsui/ui/components/button-group\";\nimport { cn } from \"@dsui/ui/lib/utils\";\nimport { type VariantProps } from \"class-variance-authority\";\nimport Button, { type ButtonProps } from \"./Button\";\n\nexport type ButtonGroupProps = React.ComponentProps<typeof SButtonGroup> &\n VariantProps<typeof buttonGroupVariants> & {\n variant?: ButtonProps[\"variant\"];\n color?: ButtonProps[\"color\"];\n size?: ButtonProps[\"size\"];\n animation?: ButtonProps[\"animation\"];\n isLoading?: ButtonProps[\"isLoading\"];\n disabled?: boolean;\n };\n\nconst ButtonGroup = React.forwardRef<HTMLDivElement, ButtonGroupProps>(\n (\n {\n className,\n orientation = \"horizontal\",\n variant,\n color,\n size,\n animation,\n isLoading,\n disabled,\n children,\n ...props\n },\n ref\n ) => {\n const childrenWithProps = React.Children.map(children, (child) => {\n if (React.isValidElement(child) && child.type === Button) {\n const childProps = child.props as ButtonProps;\n return React.cloneElement(child as React.ReactElement<ButtonProps>, {\n variant:\n animation === \"glass\" ? \"ghost\" : (childProps.variant ?? variant),\n color: childProps.color ?? color,\n size: childProps.size ?? size,\n animation: childProps.animation ?? animation,\n isLoading: childProps.isLoading ?? isLoading,\n disabled: childProps.disabled ?? disabled,\n });\n }\n return child;\n });\n\n return (\n <SButtonGroup\n ref={ref}\n orientation={orientation}\n className={cn(className)}\n {...props}\n >\n {childrenWithProps}\n </SButtonGroup>\n );\n }\n);\n\nButtonGroup.displayName = \"ButtonGroup\";\n\nexport { ButtonGroupSeparator, ButtonGroupText };\nexport default ButtonGroup;\n"],"names":["ButtonGroup","React","className","orientation","variant","color","size","animation","isLoading","disabled","children","props","ref","childrenWithProps","child","Button","childProps","jsx","SButtonGroup","cn"],"mappings":";;;;;;AAqBA,MAAMA,IAAcC,EAAM;AAAA,EACxB,CACE;AAAA,IACE,WAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,SAAAC;AAAA,IACA,OAAAC;AAAA,IACA,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAMC,IAAoBZ,EAAM,SAAS,IAAIS,GAAU,CAACI,MAAU;AAChE,UAAIb,EAAM,eAAea,CAAK,KAAKA,EAAM,SAASC,GAAQ;AACxD,cAAMC,IAAaF,EAAM;AACzB,eAAOb,EAAM,aAAaa,GAA0C;AAAA,UAClE,SACEP,MAAc,UAAU,UAAWS,EAAW,WAAWZ;AAAA,UAC3D,OAAOY,EAAW,SAASX;AAAA,UAC3B,MAAMW,EAAW,QAAQV;AAAA,UACzB,WAAWU,EAAW,aAAaT;AAAA,UACnC,WAAWS,EAAW,aAAaR;AAAA,UACnC,UAAUQ,EAAW,YAAYP;AAAA,QAAA,CAClC;AAAA,MACH;AACA,aAAOK;AAAA,IACT,CAAC;AAED,WACE,gBAAAG;AAAA,MAACC;AAAAA,MAAA;AAAA,QACC,KAAAN;AAAA,QACA,aAAAT;AAAA,QACA,WAAWgB,EAAGjB,CAAS;AAAA,QACtB,GAAGS;AAAA,QAEH,UAAAE;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEAb,EAAY,cAAc;"}
1
+ {"version":3,"file":"ButtonGroup.js","sources":["../../../../src/components/Button/ButtonGroup.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n ButtonGroup as SButtonGroup,\n ButtonGroupSeparator,\n ButtonGroupText,\n buttonGroupVariants,\n} from \"@dsui/ui/components/button-group\";\nimport { cn } from \"@dsui/ui/lib/utils\";\nimport { type VariantProps } from \"class-variance-authority\";\nimport Button, { type ButtonProps } from \"./Button\";\n\nexport type ButtonGroupProps = React.ComponentProps<typeof SButtonGroup> &\n VariantProps<typeof buttonGroupVariants> & {\n variant?: ButtonProps[\"variant\"];\n color?: ButtonProps[\"color\"];\n size?: ButtonProps[\"size\"];\n animation?: ButtonProps[\"animation\"];\n isLoading?: ButtonProps[\"isLoading\"];\n disabled?: boolean;\n };\n\nconst ButtonGroup = React.forwardRef<HTMLDivElement, ButtonGroupProps>(\n (\n {\n className,\n orientation = \"horizontal\",\n variant,\n color,\n size,\n animation,\n isLoading,\n disabled,\n children,\n ...props\n },\n ref\n ) => {\n const childrenWithProps = React.Children.map(children, (child) => {\n if (React.isValidElement(child) && child.type === Button) {\n const childProps = child.props as ButtonProps;\n return React.cloneElement(child as React.ReactElement<ButtonProps>, {\n variant:\n animation === \"glass\" ? \"ghost\" : (childProps.variant ?? variant),\n color: childProps.color ?? color,\n size: childProps.size ?? size,\n animation: childProps.animation ?? animation,\n isLoading: childProps.isLoading ?? isLoading,\n disabled: childProps.disabled ?? disabled,\n });\n }\n return child;\n });\n\n return (\n <SButtonGroup\n ref={ref}\n orientation={orientation}\n className={cn(className)}\n {...props}\n >\n {childrenWithProps}\n </SButtonGroup>\n );\n }\n);\n\nButtonGroup.displayName = \"ButtonGroup\";\n\nexport { ButtonGroupSeparator, ButtonGroupText };\nexport default ButtonGroup;\n"],"names":["ButtonGroup","React","className","orientation","variant","color","size","animation","isLoading","disabled","children","props","ref","childrenWithProps","child","Button","childProps","jsx","SButtonGroup","cn"],"mappings":";;;;;;;AAqBA,MAAMA,IAAcC,EAAM;AAAA,EACxB,CACE;AAAA,IACE,WAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,SAAAC;AAAA,IACA,OAAAC;AAAA,IACA,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAMC,IAAoBZ,EAAM,SAAS,IAAIS,GAAU,CAACI,MAAU;AAChE,UAAIb,EAAM,eAAea,CAAK,KAAKA,EAAM,SAASC,GAAQ;AACxD,cAAMC,IAAaF,EAAM;AACzB,eAAOb,EAAM,aAAaa,GAA0C;AAAA,UAClE,SACEP,MAAc,UAAU,UAAWS,EAAW,WAAWZ;AAAA,UAC3D,OAAOY,EAAW,SAASX;AAAA,UAC3B,MAAMW,EAAW,QAAQV;AAAA,UACzB,WAAWU,EAAW,aAAaT;AAAA,UACnC,WAAWS,EAAW,aAAaR;AAAA,UACnC,UAAUQ,EAAW,YAAYP;AAAA,QAAA,CAClC;AAAA,MACH;AACA,aAAOK;AAAA,IACT,CAAC;AAED,WACE,gBAAAG;AAAA,MAACC;AAAAA,MAAA;AAAA,QACC,KAAAN;AAAA,QACA,aAAAT;AAAA,QACA,WAAWgB,EAAGjB,CAAS;AAAA,QACtB,GAAGS;AAAA,QAEH,UAAAE;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEAb,EAAY,cAAc;"}