jaci-ui 0.6.3 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +48 -0
- package/dist/components/alert/alert.cjs +11 -1
- package/dist/components/alert/alert.cjs.map +1 -1
- package/dist/components/alert/alert.d.cts +4 -1
- package/dist/components/alert/alert.d.ts +4 -1
- package/dist/components/alert/alert.js +11 -2
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/alert/index.d.cts +2 -2
- package/dist/components/alert/index.d.ts +2 -2
- package/dist/components/alert-dialog/alert-dialog.cjs +4 -1
- package/dist/components/alert-dialog/alert-dialog.cjs.map +1 -1
- package/dist/components/alert-dialog/alert-dialog.d.cts +2 -2
- package/dist/components/alert-dialog/alert-dialog.d.ts +2 -2
- package/dist/components/alert-dialog/alert-dialog.js +4 -1
- package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/aspect-ratio/aspect-ratio.cjs +23 -0
- package/dist/components/aspect-ratio/aspect-ratio.cjs.map +1 -0
- package/dist/components/aspect-ratio/aspect-ratio.d.cts +9 -0
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +9 -0
- package/dist/components/aspect-ratio/aspect-ratio.js +23 -0
- package/dist/components/aspect-ratio/aspect-ratio.js.map +1 -0
- package/dist/components/aspect-ratio/index.d.cts +2 -0
- package/dist/components/aspect-ratio/index.d.ts +2 -0
- package/dist/components/card/card.cjs +10 -1
- package/dist/components/card/card.cjs.map +1 -1
- package/dist/components/card/card.d.cts +15 -2
- package/dist/components/card/card.d.ts +15 -2
- package/dist/components/card/card.js +10 -2
- package/dist/components/card/card.js.map +1 -1
- package/dist/components/card/index.d.cts +2 -2
- package/dist/components/card/index.d.ts +2 -2
- package/dist/components/code/code.cjs +39 -0
- package/dist/components/code/code.cjs.map +1 -0
- package/dist/components/code/code.d.cts +14 -0
- package/dist/components/code/code.d.ts +14 -0
- package/dist/components/code/code.js +39 -0
- package/dist/components/code/code.js.map +1 -0
- package/dist/components/code/index.d.cts +2 -0
- package/dist/components/code/index.d.ts +2 -0
- package/dist/components/color-picker/color-picker.cjs +4 -1
- package/dist/components/color-picker/color-picker.cjs.map +1 -1
- package/dist/components/color-picker/color-picker.d.cts +2 -2
- package/dist/components/color-picker/color-picker.d.ts +2 -2
- package/dist/components/color-picker/color-picker.js +4 -1
- package/dist/components/color-picker/color-picker.js.map +1 -1
- package/dist/components/combobox/combobox.cjs +4 -1
- package/dist/components/combobox/combobox.cjs.map +1 -1
- package/dist/components/combobox/combobox.d.cts +2 -2
- package/dist/components/combobox/combobox.d.ts +2 -2
- package/dist/components/combobox/combobox.js +4 -1
- package/dist/components/combobox/combobox.js.map +1 -1
- package/dist/components/command/command.cjs +73 -12
- package/dist/components/command/command.cjs.map +1 -1
- package/dist/components/command/command.d.cts +7 -1
- package/dist/components/command/command.d.ts +7 -1
- package/dist/components/command/command.js +73 -12
- package/dist/components/command/command.js.map +1 -1
- package/dist/components/command/index.d.cts +2 -2
- package/dist/components/command/index.d.ts +2 -2
- package/dist/components/context-menu/context-menu.cjs +4 -1
- package/dist/components/context-menu/context-menu.cjs.map +1 -1
- package/dist/components/context-menu/context-menu.d.cts +2 -2
- package/dist/components/context-menu/context-menu.d.ts +2 -2
- package/dist/components/context-menu/context-menu.js +4 -1
- package/dist/components/context-menu/context-menu.js.map +1 -1
- package/dist/components/date-picker/date-picker.cjs +4 -1
- package/dist/components/date-picker/date-picker.cjs.map +1 -1
- package/dist/components/date-picker/date-picker.d.cts +2 -2
- package/dist/components/date-picker/date-picker.d.ts +2 -2
- package/dist/components/date-picker/date-picker.js +4 -1
- package/dist/components/date-picker/date-picker.js.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.cjs +4 -1
- package/dist/components/date-range-picker/date-range-picker.cjs.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.d.cts +2 -2
- package/dist/components/date-range-picker/date-range-picker.d.ts +2 -2
- package/dist/components/date-range-picker/date-range-picker.js +4 -1
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/dialog/dialog.cjs +4 -1
- package/dist/components/dialog/dialog.cjs.map +1 -1
- package/dist/components/dialog/dialog.d.cts +2 -2
- package/dist/components/dialog/dialog.d.ts +2 -2
- package/dist/components/dialog/dialog.js +4 -1
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/drawer/drawer.cjs +4 -1
- package/dist/components/drawer/drawer.cjs.map +1 -1
- package/dist/components/drawer/drawer.d.cts +2 -2
- package/dist/components/drawer/drawer.d.ts +2 -2
- package/dist/components/drawer/drawer.js +4 -1
- package/dist/components/drawer/drawer.js.map +1 -1
- package/dist/components/feedback/badge.cjs +6 -3
- package/dist/components/feedback/badge.cjs.map +1 -1
- package/dist/components/feedback/badge.d.cts +1 -0
- package/dist/components/feedback/badge.d.ts +1 -0
- package/dist/components/feedback/badge.js +6 -3
- package/dist/components/feedback/badge.js.map +1 -1
- package/dist/components/figure/figure.cjs +134 -0
- package/dist/components/figure/figure.cjs.map +1 -0
- package/dist/components/figure/figure.d.cts +24 -0
- package/dist/components/figure/figure.d.ts +24 -0
- package/dist/components/figure/figure.js +131 -0
- package/dist/components/figure/figure.js.map +1 -0
- package/dist/components/figure/index.d.cts +2 -0
- package/dist/components/figure/index.d.ts +2 -0
- package/dist/components/image/image.cjs +112 -0
- package/dist/components/image/image.cjs.map +1 -0
- package/dist/components/image/image.d.cts +21 -0
- package/dist/components/image/image.d.ts +21 -0
- package/dist/components/image/image.js +112 -0
- package/dist/components/image/image.js.map +1 -0
- package/dist/components/image/index.d.cts +2 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/kbd/index.d.cts +2 -0
- package/dist/components/kbd/index.d.ts +2 -0
- package/dist/components/kbd/kbd.cjs +23 -0
- package/dist/components/kbd/kbd.cjs.map +1 -0
- package/dist/components/kbd/kbd.d.cts +12 -0
- package/dist/components/kbd/kbd.d.ts +12 -0
- package/dist/components/kbd/kbd.js +23 -0
- package/dist/components/kbd/kbd.js.map +1 -0
- package/dist/components/menu/menu.cjs +4 -1
- package/dist/components/menu/menu.cjs.map +1 -1
- package/dist/components/menu/menu.d.cts +2 -2
- package/dist/components/menu/menu.d.ts +2 -2
- package/dist/components/menu/menu.js +4 -1
- package/dist/components/menu/menu.js.map +1 -1
- package/dist/components/menubar/menubar.cjs +4 -1
- package/dist/components/menubar/menubar.cjs.map +1 -1
- package/dist/components/menubar/menubar.d.cts +2 -2
- package/dist/components/menubar/menubar.d.ts +2 -2
- package/dist/components/menubar/menubar.js +4 -1
- package/dist/components/menubar/menubar.js.map +1 -1
- package/dist/components/navigation/navigation.cjs +3 -1
- package/dist/components/navigation/navigation.cjs.map +1 -1
- package/dist/components/navigation/navigation.js +3 -1
- package/dist/components/navigation/navigation.js.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.cjs +4 -1
- package/dist/components/navigation-menu/navigation-menu.cjs.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.d.cts +2 -2
- package/dist/components/navigation-menu/navigation-menu.d.ts +2 -2
- package/dist/components/navigation-menu/navigation-menu.js +4 -1
- package/dist/components/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/popover/popover.cjs +4 -1
- package/dist/components/popover/popover.cjs.map +1 -1
- package/dist/components/popover/popover.d.cts +2 -2
- package/dist/components/popover/popover.d.ts +2 -2
- package/dist/components/popover/popover.js +4 -1
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/progress/progress.cjs +19 -7
- package/dist/components/progress/progress.cjs.map +1 -1
- package/dist/components/progress/progress.d.cts +4 -0
- package/dist/components/progress/progress.d.ts +4 -0
- package/dist/components/progress/progress.js +19 -7
- package/dist/components/progress/progress.js.map +1 -1
- package/dist/components/quote/index.d.cts +2 -0
- package/dist/components/quote/index.d.ts +2 -0
- package/dist/components/quote/quote.cjs +38 -0
- package/dist/components/quote/quote.cjs.map +1 -0
- package/dist/components/quote/quote.d.cts +19 -0
- package/dist/components/quote/quote.d.ts +19 -0
- package/dist/components/quote/quote.js +38 -0
- package/dist/components/quote/quote.js.map +1 -0
- package/dist/components/select/select.cjs +4 -1
- package/dist/components/select/select.cjs.map +1 -1
- package/dist/components/select/select.d.cts +2 -2
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/select/select.js +4 -1
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/sidebar/sidebar.cjs +24 -17
- package/dist/components/sidebar/sidebar.cjs.map +1 -1
- package/dist/components/sidebar/sidebar.d.cts +4 -2
- package/dist/components/sidebar/sidebar.d.ts +4 -2
- package/dist/components/sidebar/sidebar.js +24 -17
- package/dist/components/sidebar/sidebar.js.map +1 -1
- package/dist/components/stat/index.d.cts +2 -0
- package/dist/components/stat/index.d.ts +2 -0
- package/dist/components/stat/stat.cjs +122 -0
- package/dist/components/stat/stat.cjs.map +1 -0
- package/dist/components/stat/stat.d.cts +51 -0
- package/dist/components/stat/stat.d.ts +51 -0
- package/dist/components/stat/stat.js +114 -0
- package/dist/components/stat/stat.js.map +1 -0
- package/dist/components/stat-group/index.d.cts +2 -0
- package/dist/components/stat-group/index.d.ts +2 -0
- package/dist/components/toast/toast.cjs +4 -1
- package/dist/components/toast/toast.cjs.map +1 -1
- package/dist/components/toast/toast.d.cts +1 -1
- package/dist/components/toast/toast.d.ts +1 -1
- package/dist/components/toast/toast.js +4 -1
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/components/tooltip/tooltip.cjs +4 -1
- package/dist/components/tooltip/tooltip.cjs.map +1 -1
- package/dist/components/tooltip/tooltip.d.cts +2 -2
- package/dist/components/tooltip/tooltip.d.ts +2 -2
- package/dist/components/tooltip/tooltip.js +4 -1
- package/dist/components/tooltip/tooltip.js.map +1 -1
- package/dist/components/typography/heading.cjs +8 -2
- package/dist/components/typography/heading.cjs.map +1 -1
- package/dist/components/typography/heading.d.cts +8 -1
- package/dist/components/typography/heading.d.ts +8 -1
- package/dist/components/typography/heading.js +8 -2
- package/dist/components/typography/heading.js.map +1 -1
- package/dist/components/typography/index.d.cts +2 -2
- package/dist/components/typography/index.d.ts +2 -2
- package/dist/components/typography/paragraph.cjs +7 -2
- package/dist/components/typography/paragraph.cjs.map +1 -1
- package/dist/components/typography/paragraph.d.cts +8 -2
- package/dist/components/typography/paragraph.d.ts +8 -2
- package/dist/components/typography/paragraph.js +7 -2
- package/dist/components/typography/paragraph.js.map +1 -1
- package/dist/components/typography/text.cjs +6 -2
- package/dist/components/typography/text.cjs.map +1 -1
- package/dist/components/typography/text.d.cts +5 -0
- package/dist/components/typography/text.d.ts +5 -0
- package/dist/components/typography/text.js +6 -2
- package/dist/components/typography/text.js.map +1 -1
- package/dist/index.cjs +28 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +20 -5
- package/dist/index.d.ts +20 -5
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -0
- package/dist/styled-system/recipes/alert.cjs +2 -1
- package/dist/styled-system/recipes/alert.cjs.map +1 -1
- package/dist/styled-system/recipes/alert.js +2 -1
- package/dist/styled-system/recipes/alert.js.map +1 -1
- package/dist/styled-system/recipes/aspect-ratio-box.cjs +25 -0
- package/dist/styled-system/recipes/aspect-ratio-box.cjs.map +1 -0
- package/dist/styled-system/recipes/aspect-ratio-box.js +25 -0
- package/dist/styled-system/recipes/aspect-ratio-box.js.map +1 -0
- package/dist/styled-system/recipes/badge.cjs +16 -6
- package/dist/styled-system/recipes/badge.cjs.map +1 -1
- package/dist/styled-system/recipes/badge.js +16 -6
- package/dist/styled-system/recipes/badge.js.map +1 -1
- package/dist/styled-system/recipes/code.cjs +33 -0
- package/dist/styled-system/recipes/code.cjs.map +1 -0
- package/dist/styled-system/recipes/code.js +33 -0
- package/dist/styled-system/recipes/code.js.map +1 -0
- package/dist/styled-system/recipes/command.cjs +3 -3
- package/dist/styled-system/recipes/command.cjs.map +1 -1
- package/dist/styled-system/recipes/command.js +3 -3
- package/dist/styled-system/recipes/command.js.map +1 -1
- package/dist/styled-system/recipes/figure.cjs +43 -0
- package/dist/styled-system/recipes/figure.cjs.map +1 -0
- package/dist/styled-system/recipes/figure.js +43 -0
- package/dist/styled-system/recipes/figure.js.map +1 -0
- package/dist/styled-system/recipes/heading.cjs +34 -9
- package/dist/styled-system/recipes/heading.cjs.map +1 -1
- package/dist/styled-system/recipes/heading.js +34 -9
- package/dist/styled-system/recipes/heading.js.map +1 -1
- package/dist/styled-system/recipes/image.cjs +57 -0
- package/dist/styled-system/recipes/image.cjs.map +1 -0
- package/dist/styled-system/recipes/image.js +57 -0
- package/dist/styled-system/recipes/image.js.map +1 -0
- package/dist/styled-system/recipes/kbd.cjs +39 -0
- package/dist/styled-system/recipes/kbd.cjs.map +1 -0
- package/dist/styled-system/recipes/kbd.js +39 -0
- package/dist/styled-system/recipes/kbd.js.map +1 -0
- package/dist/styled-system/recipes/paragraph.cjs +25 -2
- package/dist/styled-system/recipes/paragraph.cjs.map +1 -1
- package/dist/styled-system/recipes/paragraph.js +25 -2
- package/dist/styled-system/recipes/paragraph.js.map +1 -1
- package/dist/styled-system/recipes/progress.cjs +1 -0
- package/dist/styled-system/recipes/progress.cjs.map +1 -1
- package/dist/styled-system/recipes/progress.js +1 -0
- package/dist/styled-system/recipes/progress.js.map +1 -1
- package/dist/styled-system/recipes/quote.cjs +39 -0
- package/dist/styled-system/recipes/quote.cjs.map +1 -0
- package/dist/styled-system/recipes/quote.js +39 -0
- package/dist/styled-system/recipes/quote.js.map +1 -0
- package/dist/styled-system/recipes/stat-group.cjs +40 -0
- package/dist/styled-system/recipes/stat-group.cjs.map +1 -0
- package/dist/styled-system/recipes/stat-group.js +40 -0
- package/dist/styled-system/recipes/stat-group.js.map +1 -0
- package/dist/styled-system/recipes/stat.cjs +63 -0
- package/dist/styled-system/recipes/stat.cjs.map +1 -0
- package/dist/styled-system/recipes/stat.js +63 -0
- package/dist/styled-system/recipes/stat.js.map +1 -0
- package/dist/styled-system/recipes/text.cjs +23 -2
- package/dist/styled-system/recipes/text.cjs.map +1 -1
- package/dist/styled-system/recipes/text.js +23 -2
- package/dist/styled-system/recipes/text.js.map +1 -1
- package/dist/styles.css +1064 -117
- package/dist/theme/theme-provider.cjs +18 -8
- package/dist/theme/theme-provider.cjs.map +1 -1
- package/dist/theme/theme-provider.js +18 -8
- package/dist/theme/theme-provider.js.map +1 -1
- package/dist/theme/theme-scope.cjs +21 -0
- package/dist/theme/theme-scope.cjs.map +1 -0
- package/dist/theme/theme-scope.js +19 -0
- package/dist/theme/theme-scope.js.map +1 -0
- package/package.json +7 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-range-picker.js","names":["BasePopover"],"sources":["../../../src/components/date-range-picker/date-range-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport { Popover as BasePopover } from \"@base-ui/react/popover\";\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\nimport type { PopoverRoot as BasePopoverRoot } from \"@base-ui/react/popover\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { dateRangePicker } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport {\n addDays,\n addMonths,\n createCalendarDate,\n dateKey,\n formatDateLabel,\n formatMonthLabel,\n getCalendarDays,\n getMonthLabels,\n getWeekdayLabels,\n isAfterDay,\n isBeforeDay,\n isSameDay,\n startOfMonth,\n toInputDate,\n} from \"../date-picker/date-utils\";\n\nexport interface DateRange {\n start: Date | null;\n end: Date | null;\n}\n\nexport interface DateRangePickerYearRange {\n start: number;\n end: number;\n}\n\nexport interface DateRangePickerRootProps extends Omit<BasePopoverRoot.Props, \"children\"> {\n value?: DateRange;\n defaultValue?: DateRange;\n onValueChange?: (range: DateRange) => void;\n referenceDate?: Date;\n locale?: string;\n weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n minDate?: Date;\n maxDate?: Date;\n isDateDisabled?: (date: Date) => boolean;\n yearRange?: DateRangePickerYearRange;\n closeOnSelect?: boolean;\n name?: string;\n disabled?: boolean;\n placeholder?: ReactNode;\n children?: ReactNode;\n}\n\ninterface DateRangePickerContextValue {\n canNavigate: (amount: number) => boolean;\n close: () => void;\n dateDisabled: (date: Date) => boolean;\n disabled: boolean;\n focusDate: (date: Date, direction?: number) => void;\n focusedDate: Date;\n hoveredDate: Date | null;\n locale: string;\n maxDate: Date | undefined;\n minDate: Date | undefined;\n month: Date;\n monthDisabled: (date: Date) => boolean;\n onSelect: (date: Date) => void;\n range: DateRange;\n selectMonth: (month: number) => void;\n selectYear: (year: number) => void;\n setMonth: (date: Date) => void;\n setHoveredDate: (date: Date | null) => void;\n setRange: (range: DateRange) => void;\n styles: ReturnType<typeof dateRangePicker>;\n today: Date;\n triggerId: string;\n weekStartsOn: number;\n yearRange: DateRangePickerYearRange;\n registerDay: (key: string, node: HTMLButtonElement | null) => void;\n}\n\nconst DateRangePickerContext = createContext<DateRangePickerContextValue | null>(null);\n\nfunction useDateRangePickerContext() {\n const context = useContext(DateRangePickerContext);\n if (!context)\n throw new Error(\"DateRangePicker parts must be rendered inside DateRangePicker.Root.\");\n return context;\n}\n\nfunction sameMonth(left: Date, right: Date) {\n return left.getFullYear() === right.getFullYear() && left.getMonth() === right.getMonth();\n}\n\nfunction dateInRange(date: Date, range: DateRange, preview: Date | null) {\n const end = range.end ?? preview;\n return Boolean(range.start && end && !isBeforeDay(date, range.start) && !isAfterDay(date, end));\n}\n\nexport function DateRangePickerRoot({\n children,\n closeOnSelect = true,\n defaultValue = { start: null, end: null },\n disabled = false,\n isDateDisabled,\n locale = \"pt-BR\",\n maxDate,\n minDate,\n name,\n onValueChange,\n referenceDate,\n value: controlledValue,\n weekStartsOn = 0,\n yearRange: configuredYearRange,\n ...popoverProps\n}: DateRangePickerRootProps) {\n const [uncontrolledRange, setUncontrolledRange] = useState<DateRange>(defaultValue);\n const range = controlledValue ?? uncontrolledRange;\n const initialDate = range.start ?? referenceDate ?? new Date();\n const [month, setMonthState] = useState(() => startOfMonth(initialDate));\n const [focusedDate, setFocusedDate] = useState(range.start ?? initialDate);\n const [hoveredDate, setHoveredDate] = useState<Date | null>(null);\n const dayRefs = useRef(new Map<string, HTMLButtonElement>());\n const actionsRef = useRef<BasePopoverRoot.Actions | null>(null);\n const triggerId = useId();\n const styles = dateRangePicker();\n const today = useMemo(() => referenceDate ?? new Date(), [referenceDate]);\n const minMonth = minDate ? startOfMonth(minDate) : undefined;\n const maxMonth = maxDate ? startOfMonth(maxDate) : undefined;\n const yearRange = useMemo(() => {\n const start = configuredYearRange?.start ?? today.getFullYear() - 100;\n const end = configuredYearRange?.end ?? today.getFullYear() + 20;\n const years = [\n range.start?.getFullYear(),\n range.end?.getFullYear(),\n minDate?.getFullYear(),\n maxDate?.getFullYear(),\n ].filter((year): year is number => year !== undefined);\n return { start: Math.min(start, end, ...years), end: Math.max(start, end, ...years) };\n }, [\n configuredYearRange?.end,\n configuredYearRange?.start,\n maxDate,\n minDate,\n range.end,\n range.start,\n today,\n ]);\n\n const dateDisabled = useCallback(\n (date: Date) =>\n Boolean(\n (minDate && isBeforeDay(date, minDate)) ||\n (maxDate && isAfterDay(date, maxDate)) ||\n isDateDisabled?.(date),\n ),\n [isDateDisabled, maxDate, minDate],\n );\n const monthDisabled = useCallback(\n (date: Date) => {\n const first = startOfMonth(date);\n const last = createCalendarDate(date.getFullYear(), date.getMonth() + 1, 0);\n return Boolean(\n (minDate && isBeforeDay(last, minDate)) || (maxDate && isAfterDay(first, maxDate)),\n );\n },\n [maxDate, minDate],\n );\n const clampMonth = useCallback(\n (date: Date) => {\n const normalized = startOfMonth(date);\n if (minMonth && isBeforeDay(normalized, minMonth)) return minMonth;\n if (maxMonth && isAfterDay(normalized, maxMonth)) return maxMonth;\n return normalized;\n },\n [maxMonth, minMonth],\n );\n const setMonth = useCallback((date: Date) => setMonthState(clampMonth(date)), [clampMonth]);\n const canNavigate = useCallback(\n (amount: number) => {\n const next = addMonths(month, amount);\n return (\n !(minMonth && isBeforeDay(next, minMonth)) && !(maxMonth && isAfterDay(next, maxMonth))\n );\n },\n [maxMonth, minMonth, month],\n );\n const setRange = useCallback(\n (nextRange: DateRange) => {\n if (controlledValue === undefined) setUncontrolledRange(nextRange);\n onValueChange?.(nextRange);\n },\n [controlledValue, onValueChange],\n );\n const close = useCallback(() => actionsRef.current?.close(), []);\n const onSelect = useCallback(\n (date: Date) => {\n if (disabled || dateDisabled(date)) return;\n const nextDate = createCalendarDate(date.getFullYear(), date.getMonth(), date.getDate());\n let nextRange: DateRange;\n if (!range.start || range.end) nextRange = { start: nextDate, end: null };\n else if (isBeforeDay(nextDate, range.start)) nextRange = { start: nextDate, end: null };\n else nextRange = { start: range.start, end: nextDate };\n setRange(nextRange);\n setFocusedDate(nextDate);\n setMonth(nextDate);\n setHoveredDate(null);\n if (nextRange.start && nextRange.end && closeOnSelect) close();\n },\n [close, closeOnSelect, dateDisabled, disabled, range.end, range.start, setMonth, setRange],\n );\n const focusDate = useCallback(\n (date: Date, direction = 1) => {\n let next = createCalendarDate(date.getFullYear(), date.getMonth(), date.getDate());\n const step = direction < 0 ? -1 : 1;\n let attempts = 0;\n while (dateDisabled(next) && attempts < 366) {\n next = addDays(next, step);\n attempts += 1;\n }\n setFocusedDate(next);\n setMonth(next);\n const focusTarget = () => dayRefs.current.get(dateKey(next))?.focus();\n focusTarget();\n queueMicrotask(focusTarget);\n },\n [dateDisabled, setMonth],\n );\n const selectMonth = useCallback(\n (monthIndex: number) => setMonth(createCalendarDate(month.getFullYear(), monthIndex, 1)),\n [month, setMonth],\n );\n const selectYear = useCallback(\n (year: number) => setMonth(createCalendarDate(year, month.getMonth(), 1)),\n [month, setMonth],\n );\n const registerDay = useCallback((key: string, node: HTMLButtonElement | null) => {\n if (node) dayRefs.current.set(key, node);\n else dayRefs.current.delete(key);\n }, []);\n\n useEffect(() => {\n const selected = range.end ?? range.start;\n if (!selected) return;\n setFocusedDate(selected);\n setMonthState((current) => (sameMonth(current, selected) ? current : clampMonth(selected)));\n }, [clampMonth, range.end, range.start]);\n\n const context: DateRangePickerContextValue = {\n canNavigate,\n close,\n dateDisabled,\n disabled,\n focusDate,\n focusedDate,\n hoveredDate,\n locale,\n maxDate,\n minDate,\n month,\n monthDisabled,\n onSelect,\n range,\n registerDay,\n selectMonth,\n selectYear,\n setHoveredDate,\n setMonth,\n setRange,\n styles,\n today,\n triggerId,\n weekStartsOn,\n yearRange,\n };\n\n return (\n <DateRangePickerContext.Provider value={context}>\n <BasePopover.Root {...popoverProps} actionsRef={actionsRef}>\n {children}\n </BasePopover.Root>\n {name ? (\n <>\n <input\n disabled={disabled}\n name={`${name}[start]`}\n type=\"hidden\"\n value={toInputDate(range.start)}\n />\n <input\n disabled={disabled}\n name={`${name}[end]`}\n type=\"hidden\"\n value={toInputDate(range.end)}\n />\n </>\n ) : null}\n </DateRangePickerContext.Provider>\n );\n}\n\nexport type DateRangePickerLabelProps = ComponentPropsWithoutRef<\"label\">;\nexport const DateRangePickerLabel = forwardRef<HTMLLabelElement, DateRangePickerLabelProps>(\n function DateRangePickerLabel({ className, ...props }, ref) {\n const { styles, triggerId } = useDateRangePickerContext();\n return (\n // biome-ignore lint/a11y/noLabelWithoutControl: the consumer renders the trigger/control in this composition.\n <label\n {...props}\n className={cx(styles.label, className)}\n data-slot=\"date-range-picker-label\"\n htmlFor={props.htmlFor ?? triggerId}\n ref={ref}\n />\n );\n },\n);\n\nexport type DateRangePickerControlProps = ComponentPropsWithoutRef<\"div\">;\nexport const DateRangePickerControl = forwardRef<HTMLDivElement, DateRangePickerControlProps>(\n function DateRangePickerControl({ className, ...props }, ref) {\n const { styles } = useDateRangePickerContext();\n return (\n <div\n {...props}\n className={cx(styles.control, className)}\n data-slot=\"date-range-picker-control\"\n ref={ref}\n />\n );\n },\n);\n\nexport type DateRangePickerTriggerProps = ComponentPropsWithoutRef<typeof BasePopover.Trigger>;\nexport const DateRangePickerTrigger = forwardRef<HTMLButtonElement, DateRangePickerTriggerProps>(\n function DateRangePickerTrigger({ children, className, disabled, id, ...props }, ref) {\n const { disabled: pickerDisabled, styles, triggerId } = useDateRangePickerContext();\n return (\n <BasePopover.Trigger\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Choose date range\"}\n className={withRecipeClassName(styles.trigger, className)}\n data-jaci-component=\"date-range-picker\"\n data-slot=\"date-range-picker-trigger\"\n disabled={disabled ?? pickerDisabled}\n id={id ?? triggerId}\n ref={ref}\n >\n {children ?? (\n <>\n <DateRangePickerValue />\n <span aria-hidden=\"true\">▾</span>\n </>\n )}\n </BasePopover.Trigger>\n );\n },\n);\n\nexport interface DateRangePickerValueProps extends ComponentPropsWithoutRef<\"span\"> {\n placeholder?: ReactNode;\n}\nexport const DateRangePickerValue = forwardRef<HTMLSpanElement, DateRangePickerValueProps>(\n function DateRangePickerValue({ children, className, placeholder, ...props }, ref) {\n const { locale, range, styles } = useDateRangePickerContext();\n const value =\n children ??\n (range.start && range.end\n ? `${formatDateLabel(range.start, locale, \"\")} – ${formatDateLabel(range.end, locale, \"\")}`\n : range.start\n ? `${formatDateLabel(range.start, locale, \"\")} – …`\n : (placeholder ?? \"Select a date range\"));\n return (\n <span\n {...props}\n className={cx(styles.value, className)}\n data-placeholder={range.start ? undefined : \"true\"}\n data-slot=\"date-range-picker-value\"\n ref={ref}\n >\n {value}\n </span>\n );\n },\n);\n\nexport type DateRangePickerClearProps = ComponentPropsWithoutRef<\"button\">;\nexport const DateRangePickerClear = forwardRef<HTMLButtonElement, DateRangePickerClearProps>(\n function DateRangePickerClear({ children = \"×\", className, disabled, onClick, ...props }, ref) {\n const {\n disabled: pickerDisabled,\n range,\n setRange,\n styles,\n close,\n } = useDateRangePickerContext();\n return (\n <button\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Clear date range\"}\n className={cx(styles.clear, className)}\n data-slot=\"date-range-picker-clear\"\n disabled={disabled || pickerDisabled || (!range.start && !range.end)}\n onClick={(event) => {\n setRange({ start: null, end: null });\n close();\n onClick?.(event);\n }}\n ref={ref}\n type=\"button\"\n >\n {children}\n </button>\n );\n },\n);\n\nexport type DateRangePickerPortalProps = ComponentPropsWithoutRef<typeof BasePopover.Portal>;\nexport const DateRangePickerPortal = BasePopover.Portal;\nexport type DateRangePickerPositionerProps = ComponentPropsWithoutRef<\n typeof BasePopover.Positioner\n>;\nexport const DateRangePickerPositioner = forwardRef<HTMLDivElement, DateRangePickerPositionerProps>(\n function DateRangePickerPositioner({ className, ...props }, ref) {\n const { styles } = useDateRangePickerContext();\n return (\n <BasePopover.Positioner\n {...props}\n className={withRecipeClassName(styles.positioner, className)}\n data-slot=\"date-range-picker-positioner\"\n ref={ref}\n />\n );\n },\n);\nexport type DateRangePickerPopupProps = ComponentPropsWithoutRef<typeof BasePopover.Popup>;\nexport const DateRangePickerPopup = forwardRef<HTMLDivElement, DateRangePickerPopupProps>(\n function DateRangePickerPopup({ className, ...props }, ref) {\n const { styles } = useDateRangePickerContext();\n return (\n <BasePopover.Popup\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Calendar\"}\n className={withRecipeClassName(styles.popup, className)}\n data-slot=\"date-range-picker-popup\"\n ref={ref}\n />\n );\n },\n);\nexport type DateRangePickerCloseProps = ComponentPropsWithoutRef<typeof BasePopover.Close>;\nexport const DateRangePickerClose = forwardRef<HTMLButtonElement, DateRangePickerCloseProps>(\n function DateRangePickerClose({ className, ...props }, ref) {\n const { styles } = useDateRangePickerContext();\n return (\n <BasePopover.Close\n {...props}\n className={withRecipeClassName(styles.close, className)}\n data-slot=\"date-range-picker-close\"\n ref={ref}\n />\n );\n },\n);\n\nexport type DateRangePickerHeaderProps = ComponentPropsWithoutRef<\"div\">;\nexport const DateRangePickerHeader = forwardRef<HTMLDivElement, DateRangePickerHeaderProps>(\n function DateRangePickerHeader({ className, ...props }, ref) {\n const { styles } = useDateRangePickerContext();\n return (\n <div\n {...props}\n className={cx(styles.header, className)}\n data-slot=\"date-range-picker-header\"\n ref={ref}\n />\n );\n },\n);\nexport type DateRangePickerNavigationProps = ComponentPropsWithoutRef<\"button\"> & {\n amount?: number;\n};\nconst DateRangePickerNavigationButton = forwardRef<\n HTMLButtonElement,\n DateRangePickerNavigationProps\n>(function DateRangePickerNavigationButton(\n { amount = 1, children, className, onClick, ...props },\n ref,\n) {\n const { canNavigate, month, setMonth, styles } = useDateRangePickerContext();\n const isDisabled = props.disabled || !canNavigate(amount);\n return (\n <button\n {...props}\n aria-label={props[\"aria-label\"] ?? (amount < 0 ? \"Previous month\" : \"Next month\")}\n className={cx(styles.navigation, className)}\n data-slot={amount < 0 ? \"date-range-picker-previous\" : \"date-range-picker-next\"}\n disabled={isDisabled}\n onClick={(event) => {\n if (!isDisabled) setMonth(addMonths(month, amount));\n onClick?.(event);\n }}\n ref={ref}\n type=\"button\"\n >\n {children ?? (amount < 0 ? \"‹\" : \"›\")}\n </button>\n );\n});\nexport const DateRangePickerPrevious = forwardRef<\n HTMLButtonElement,\n DateRangePickerNavigationProps\n>(function DateRangePickerPrevious(props, ref) {\n return <DateRangePickerNavigationButton {...props} amount={-1} ref={ref} />;\n});\nexport const DateRangePickerNext = forwardRef<HTMLButtonElement, DateRangePickerNavigationProps>(\n function DateRangePickerNext(props, ref) {\n return <DateRangePickerNavigationButton {...props} amount={1} ref={ref} />;\n },\n);\nexport type DateRangePickerMonthSelectProps = Omit<\n ComponentPropsWithoutRef<\"select\">,\n \"children\" | \"onChange\" | \"value\"\n>;\nexport const DateRangePickerMonthSelect = forwardRef<\n HTMLSelectElement,\n DateRangePickerMonthSelectProps\n>(function DateRangePickerMonthSelect({ className, ...props }, ref) {\n const { locale, month, monthDisabled, selectMonth, styles } = useDateRangePickerContext();\n const labels = getMonthLabels(locale);\n return (\n <select\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Select month\"}\n className={cx(styles.monthSelect, className)}\n data-slot=\"date-range-picker-month-select\"\n onChange={(event) => selectMonth(Number(event.currentTarget.value))}\n ref={ref}\n value={month.getMonth()}\n >\n {labels.map((label, index) => (\n <option\n disabled={monthDisabled(createCalendarDate(month.getFullYear(), index, 1))}\n key={label}\n value={index}\n >\n {label}\n </option>\n ))}\n </select>\n );\n});\nexport type DateRangePickerYearSelectProps = Omit<\n ComponentPropsWithoutRef<\"select\">,\n \"children\" | \"onChange\" | \"value\"\n>;\nexport const DateRangePickerYearSelect = forwardRef<\n HTMLSelectElement,\n DateRangePickerYearSelectProps\n>(function DateRangePickerYearSelect({ className, ...props }, ref) {\n const { month, monthDisabled, selectYear, styles, yearRange } = useDateRangePickerContext();\n const years = Array.from(\n { length: yearRange.end - yearRange.start + 1 },\n (_, index) => yearRange.start + index,\n );\n return (\n <select\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Select year\"}\n className={cx(styles.yearSelect, className)}\n data-slot=\"date-range-picker-year-select\"\n onChange={(event) => selectYear(Number(event.currentTarget.value))}\n ref={ref}\n value={month.getFullYear()}\n >\n {years.map((year) => (\n <option\n disabled={monthDisabled(createCalendarDate(year, month.getMonth(), 1))}\n key={year}\n value={year}\n >\n {year}\n </option>\n ))}\n </select>\n );\n});\n\nexport interface DateRangePickerDayProps extends Omit<ComponentPropsWithoutRef<\"button\">, \"value\"> {\n date: Date;\n}\nexport const DateRangePickerDay = forwardRef<HTMLButtonElement, DateRangePickerDayProps>(\n function DateRangePickerDay(\n { children, className, date, disabled, onClick, onKeyDown, onMouseEnter, ...props },\n ref,\n ) {\n const {\n dateDisabled,\n disabled: pickerDisabled,\n focusDate,\n focusedDate,\n hoveredDate,\n locale,\n month,\n range,\n onSelect,\n registerDay,\n setHoveredDate,\n styles,\n today,\n weekStartsOn,\n } = useDateRangePickerContext();\n const key = dateKey(date);\n const isDisabled = Boolean(disabled || pickerDisabled || dateDisabled(date));\n const isStart = Boolean(range.start && isSameDay(date, range.start));\n const isEnd = Boolean(range.end && isSameDay(date, range.end));\n const inRange = dateInRange(date, range, hoveredDate);\n const outsideMonth = !sameMonth(date, month);\n const isFocused = isSameDay(date, focusedDate);\n const isToday = isSameDay(date, today);\n return (\n // biome-ignore lint/a11y/useSemanticElements: the roving button is the interactive grid cell.\n <button\n {...props}\n aria-label={\n props[\"aria-label\"] ?? new Intl.DateTimeFormat(locale, { dateStyle: \"full\" }).format(date)\n }\n aria-current={isToday ? \"date\" : undefined}\n aria-selected={isStart || isEnd}\n className={cx(styles.day, className)}\n data-date={key}\n data-disabled={isDisabled || undefined}\n data-in-range={inRange || undefined}\n data-outside-month={outsideMonth || undefined}\n data-range-end={isEnd || undefined}\n data-range-start={isStart || undefined}\n data-slot=\"date-range-picker-day\"\n data-today={isToday || undefined}\n disabled={isDisabled}\n onClick={(event) => {\n onSelect(date);\n onClick?.(event);\n }}\n onKeyDown={(event) => {\n if (!event.defaultPrevented) {\n let nextDate: Date | undefined;\n switch (event.key) {\n case \"ArrowLeft\":\n nextDate = addDays(date, -1);\n break;\n case \"ArrowRight\":\n nextDate = addDays(date, 1);\n break;\n case \"ArrowUp\":\n nextDate = addDays(date, -7);\n break;\n case \"ArrowDown\":\n nextDate = addDays(date, 7);\n break;\n case \"Home\":\n nextDate = addDays(date, -((date.getDay() - weekStartsOn + 7) % 7));\n break;\n case \"End\":\n nextDate = addDays(date, 6 - ((date.getDay() - weekStartsOn + 7) % 7));\n break;\n case \"PageUp\":\n nextDate = addMonths(date, event.shiftKey ? -12 : -1);\n break;\n case \"PageDown\":\n nextDate = addMonths(date, event.shiftKey ? 12 : 1);\n break;\n case \"Enter\":\n case \" \":\n if (!isDisabled) {\n event.preventDefault();\n onSelect(date);\n }\n break;\n }\n if (nextDate) {\n event.preventDefault();\n focusDate(nextDate, nextDate < date ? -1 : 1);\n }\n }\n onKeyDown?.(event);\n }}\n onMouseEnter={(event) => {\n if (!isDisabled) setHoveredDate(date);\n onMouseEnter?.(event);\n }}\n ref={(node) => {\n registerDay(key, node);\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n role=\"gridcell\"\n tabIndex={isFocused && !isDisabled ? 0 : -1}\n type=\"button\"\n >\n {children ?? date.getDate()}\n </button>\n );\n },\n);\n\nexport interface DateRangePickerCalendarProps\n extends Omit<ComponentPropsWithoutRef<\"section\">, \"children\"> {\n \"aria-label\"?: string;\n}\nexport const DateRangePickerCalendar = forwardRef<HTMLElement, DateRangePickerCalendarProps>(\n function DateRangePickerCalendar({ \"aria-label\": ariaLabel, className, ...props }, ref) {\n const { locale, month, styles, weekStartsOn } = useDateRangePickerContext();\n const days = useMemo(() => getCalendarDays(month, weekStartsOn), [month, weekStartsOn]);\n const weekdays = useMemo(() => getWeekdayLabels(locale, weekStartsOn), [locale, weekStartsOn]);\n return (\n <section\n {...props}\n aria-label={ariaLabel ?? formatMonthLabel(month, locale)}\n className={cx(styles.calendar, className)}\n data-slot=\"date-range-picker-calendar\"\n ref={ref}\n >\n <div aria-hidden=\"true\" className={styles.weekdays} data-slot=\"date-range-picker-weekdays\">\n {weekdays.map((weekday) => (\n <span className={styles.weekday} data-slot=\"date-range-picker-weekday\" key={weekday}>\n {weekday}\n </span>\n ))}\n </div>\n {/* biome-ignore lint/a11y/useSemanticElements: the calendar uses the ARIA grid pattern. */}\n <div\n aria-label={formatMonthLabel(month, locale)}\n className={styles.grid}\n data-slot=\"date-range-picker-grid\"\n role=\"grid\"\n >\n {days.map((date) => (\n <DateRangePickerDay date={date} key={dateKey(date)} />\n ))}\n </div>\n </section>\n );\n },\n);\n\nexport interface DateRangePickerPreviewProps extends ComponentPropsWithoutRef<\"div\"> {\n children?: ReactNode;\n}\nexport const DateRangePickerPreview = forwardRef<HTMLDivElement, DateRangePickerPreviewProps>(\n function DateRangePickerPreview({ children, className, ...props }, ref) {\n const { hoveredDate, locale, range, styles } = useDateRangePickerContext();\n const content =\n children ??\n (range.start\n ? `${formatDateLabel(range.start, locale, \"\")} – ${range.end ? formatDateLabel(range.end, locale, \"\") : hoveredDate ? formatDateLabel(hoveredDate, locale, \"\") : \"…\"}`\n : \"Select a start date\");\n return (\n <div\n {...props}\n aria-live=\"polite\"\n className={cx(styles.preview, className)}\n data-slot=\"date-range-picker-preview\"\n ref={ref}\n >\n {content}\n </div>\n );\n },\n);\n\nexport interface DateRangePickerInputProps\n extends Omit<ComponentPropsWithoutRef<\"input\">, \"type\" | \"value\" | \"onChange\"> {\n side: \"start\" | \"end\";\n}\nexport const DateRangePickerInput = forwardRef<HTMLInputElement, DateRangePickerInputProps>(\n function DateRangePickerInput({ className, onBlur, onInput, side, ...props }, ref) {\n const { disabled, range, setRange, styles } = useDateRangePickerContext();\n const value = toInputDate(side === \"start\" ? range.start : range.end);\n return (\n <input\n {...props}\n aria-label={props[\"aria-label\"] ?? (side === \"start\" ? \"Start date\" : \"End date\")}\n className={cx(styles.input, className)}\n data-slot={`date-range-picker-${side}-input`}\n disabled={disabled || props.disabled}\n onChange={(event) => {\n const [year, month, day] = event.currentTarget.value.split(\"-\").map(Number);\n if (!year || !month || !day) return;\n const date = createCalendarDate(year, month - 1, day);\n setRange(\n side === \"start\" ? { start: date, end: range.end } : { start: range.start, end: date },\n );\n }}\n onBlur={onBlur}\n onInput={onInput}\n ref={ref}\n type=\"date\"\n value={value}\n />\n );\n },\n);\n\nexport const DateRangePickerStartInput = forwardRef<\n HTMLInputElement,\n Omit<DateRangePickerInputProps, \"side\">\n>(function DateRangePickerStartInput(props, ref) {\n return <DateRangePickerInput {...props} ref={ref} side=\"start\" />;\n});\nexport const DateRangePickerEndInput = forwardRef<\n HTMLInputElement,\n Omit<DateRangePickerInputProps, \"side\">\n>(function DateRangePickerEndInput(props, ref) {\n return <DateRangePickerInput {...props} ref={ref} side=\"end\" />;\n});\n\nexport const DateRangePicker = {\n Root: DateRangePickerRoot,\n Label: DateRangePickerLabel,\n Control: DateRangePickerControl,\n Trigger: DateRangePickerTrigger,\n Value: DateRangePickerValue,\n Clear: DateRangePickerClear,\n Portal: DateRangePickerPortal,\n Positioner: DateRangePickerPositioner,\n Popup: DateRangePickerPopup,\n Close: DateRangePickerClose,\n Header: DateRangePickerHeader,\n Previous: DateRangePickerPrevious,\n Next: DateRangePickerNext,\n MonthSelect: DateRangePickerMonthSelect,\n YearSelect: DateRangePickerYearSelect,\n Calendar: DateRangePickerCalendar,\n Day: DateRangePickerDay,\n Preview: DateRangePickerPreview,\n StartInput: DateRangePickerStartInput,\n EndInput: DateRangePickerEndInput,\n};\n"],"mappings":";;;;;;;;;AA6FA,MAAM,yBAAyB,cAAkD,IAAI;AAErF,SAAS,4BAA4B;CACnC,MAAM,UAAU,WAAW,sBAAsB;CACjD,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,qEAAqE;CACvF,OAAO;AACT;AAEA,SAAS,UAAU,MAAY,OAAa;CAC1C,OAAO,KAAK,YAAY,MAAM,MAAM,YAAY,KAAK,KAAK,SAAS,MAAM,MAAM,SAAS;AAC1F;AAEA,SAAS,YAAY,MAAY,OAAkB,SAAsB;CACvE,MAAM,MAAM,MAAM,OAAO;CACzB,OAAO,QAAQ,MAAM,SAAS,OAAO,CAAC,YAAY,MAAM,MAAM,KAAK,KAAK,CAAC,WAAW,MAAM,GAAG,CAAC;AAChG;AAEA,SAAgB,oBAAoB,EAClC,UACA,gBAAgB,MAChB,eAAe;CAAE,OAAO;CAAM,KAAK;AAAK,GACxC,WAAW,OACX,gBACA,SAAS,SACT,SACA,SACA,MACA,eACA,eACA,OAAO,iBACP,eAAe,GACf,WAAW,qBACX,GAAG,gBACwB;CAC3B,MAAM,CAAC,mBAAmB,wBAAwB,SAAoB,YAAY;CAClF,MAAM,QAAQ,mBAAmB;CACjC,MAAM,cAAc,MAAM,SAAS,iCAAiB,IAAI,KAAK;CAC7D,MAAM,CAAC,OAAO,iBAAiB,eAAe,aAAa,WAAW,CAAC;CACvE,MAAM,CAAC,aAAa,kBAAkB,SAAS,MAAM,SAAS,WAAW;CACzE,MAAM,CAAC,aAAa,kBAAkB,SAAsB,IAAI;CAChE,MAAM,UAAU,uBAAO,IAAI,IAA+B,CAAC;CAC3D,MAAM,aAAa,OAAuC,IAAI;CAC9D,MAAM,YAAY,MAAM;CACxB,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e;EACtE,WAAW,GAAG,OAAO,OAAO,SAAS;EACrC,aAAW,qBAAqB,KAAK;EACrC,UAAU,YAAY,MAAM;EAC5B,WAAW,UAAU;GACnB,MAAM,CAAC,MAAM,OAAO,OAAO,MAAM,cAAc,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;GAC1E,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK;GAC7B,MAAM,OAAO,mBAAmB,MAAM,QAAQ,GAAG,GAAG;GACpD,SACE,SAAS,UAAU;IAAE,OAAO;IAAM,KAAK,MAAM;GAAI,IAAI;IAAE,OAAO,MAAM;IAAO,KAAK;GAAK,CACvF;EACF;EACQ;EACC;EACJ;EACL,MAAK;EACE;CACR,CAAA;AAEL,CACF;AAEA,MAAa,4BAA4B,WAGvC,SAAS,0BAA0B,OAAO,KAAK;CAC/C,OAAO,oBAAC,sBAAD;EAAsB,GAAI;EAAY;EAAK,MAAK;CAAS,CAAA;AAClE,CAAC;AACD,MAAa,0BAA0B,WAGrC,SAAS,wBAAwB,OAAO,KAAK;CAC7C,OAAO,oBAAC,sBAAD;EAAsB,GAAI;EAAY;EAAK,MAAK;CAAO,CAAA;AAChE,CAAC;AAED,MAAa,kBAAkB;CAC7B,MAAM;CACN,OAAO;CACP,SAAS;CACT,SAAS;CACT,OAAO;CACP,OAAO;CACP,QAAQ;CACR,YAAY;CACZ,OAAO;CACP,OAAO;CACP,QAAQ;CACR,UAAU;CACV,MAAM;CACN,aAAa;CACb,YAAY;CACZ,UAAU;CACV,KAAK;CACL,SAAS;CACT,YAAY;CACZ,UAAU;AACZ"}
|
|
1
|
+
{"version":3,"file":"date-range-picker.js","names":["BasePopover"],"sources":["../../../src/components/date-range-picker/date-range-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport { Popover as BasePopover } from \"@base-ui/react/popover\";\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\nimport type { PopoverRoot as BasePopoverRoot } from \"@base-ui/react/popover\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { dateRangePicker } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\nimport {\n addDays,\n addMonths,\n createCalendarDate,\n dateKey,\n formatDateLabel,\n formatMonthLabel,\n getCalendarDays,\n getMonthLabels,\n getWeekdayLabels,\n isAfterDay,\n isBeforeDay,\n isSameDay,\n startOfMonth,\n toInputDate,\n} from \"../date-picker/date-utils\";\n\nexport interface DateRange {\n start: Date | null;\n end: Date | null;\n}\n\nexport interface DateRangePickerYearRange {\n start: number;\n end: number;\n}\n\nexport interface DateRangePickerRootProps extends Omit<BasePopoverRoot.Props, \"children\"> {\n value?: DateRange;\n defaultValue?: DateRange;\n onValueChange?: (range: DateRange) => void;\n referenceDate?: Date;\n locale?: string;\n weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n minDate?: Date;\n maxDate?: Date;\n isDateDisabled?: (date: Date) => boolean;\n yearRange?: DateRangePickerYearRange;\n closeOnSelect?: boolean;\n name?: string;\n disabled?: boolean;\n placeholder?: ReactNode;\n children?: ReactNode;\n}\n\ninterface DateRangePickerContextValue {\n canNavigate: (amount: number) => boolean;\n close: () => void;\n dateDisabled: (date: Date) => boolean;\n disabled: boolean;\n focusDate: (date: Date, direction?: number) => void;\n focusedDate: Date;\n hoveredDate: Date | null;\n locale: string;\n maxDate: Date | undefined;\n minDate: Date | undefined;\n month: Date;\n monthDisabled: (date: Date) => boolean;\n onSelect: (date: Date) => void;\n range: DateRange;\n selectMonth: (month: number) => void;\n selectYear: (year: number) => void;\n setMonth: (date: Date) => void;\n setHoveredDate: (date: Date | null) => void;\n setRange: (range: DateRange) => void;\n styles: ReturnType<typeof dateRangePicker>;\n today: Date;\n triggerId: string;\n weekStartsOn: number;\n yearRange: DateRangePickerYearRange;\n registerDay: (key: string, node: HTMLButtonElement | null) => void;\n}\n\nconst DateRangePickerContext = createContext<DateRangePickerContextValue | null>(null);\n\nfunction useDateRangePickerContext() {\n const context = useContext(DateRangePickerContext);\n if (!context)\n throw new Error(\"DateRangePicker parts must be rendered inside DateRangePicker.Root.\");\n return context;\n}\n\nfunction sameMonth(left: Date, right: Date) {\n return left.getFullYear() === right.getFullYear() && left.getMonth() === right.getMonth();\n}\n\nfunction dateInRange(date: Date, range: DateRange, preview: Date | null) {\n const end = range.end ?? preview;\n return Boolean(range.start && end && !isBeforeDay(date, range.start) && !isAfterDay(date, end));\n}\n\nexport function DateRangePickerRoot({\n children,\n closeOnSelect = true,\n defaultValue = { start: null, end: null },\n disabled = false,\n isDateDisabled,\n locale = \"pt-BR\",\n maxDate,\n minDate,\n name,\n onValueChange,\n referenceDate,\n value: controlledValue,\n weekStartsOn = 0,\n yearRange: configuredYearRange,\n ...popoverProps\n}: DateRangePickerRootProps) {\n const [uncontrolledRange, setUncontrolledRange] = useState<DateRange>(defaultValue);\n const range = controlledValue ?? uncontrolledRange;\n const initialDate = range.start ?? referenceDate ?? new Date();\n const [month, setMonthState] = useState(() => startOfMonth(initialDate));\n const [focusedDate, setFocusedDate] = useState(range.start ?? initialDate);\n const [hoveredDate, setHoveredDate] = useState<Date | null>(null);\n const dayRefs = useRef(new Map<string, HTMLButtonElement>());\n const actionsRef = useRef<BasePopoverRoot.Actions | null>(null);\n const triggerId = useId();\n const styles = dateRangePicker();\n const today = useMemo(() => referenceDate ?? new Date(), [referenceDate]);\n const minMonth = minDate ? startOfMonth(minDate) : undefined;\n const maxMonth = maxDate ? startOfMonth(maxDate) : undefined;\n const yearRange = useMemo(() => {\n const start = configuredYearRange?.start ?? today.getFullYear() - 100;\n const end = configuredYearRange?.end ?? today.getFullYear() + 20;\n const years = [\n range.start?.getFullYear(),\n range.end?.getFullYear(),\n minDate?.getFullYear(),\n maxDate?.getFullYear(),\n ].filter((year): year is number => year !== undefined);\n return { start: Math.min(start, end, ...years), end: Math.max(start, end, ...years) };\n }, [\n configuredYearRange?.end,\n configuredYearRange?.start,\n maxDate,\n minDate,\n range.end,\n range.start,\n today,\n ]);\n\n const dateDisabled = useCallback(\n (date: Date) =>\n Boolean(\n (minDate && isBeforeDay(date, minDate)) ||\n (maxDate && isAfterDay(date, maxDate)) ||\n isDateDisabled?.(date),\n ),\n [isDateDisabled, maxDate, minDate],\n );\n const monthDisabled = useCallback(\n (date: Date) => {\n const first = startOfMonth(date);\n const last = createCalendarDate(date.getFullYear(), date.getMonth() + 1, 0);\n return Boolean(\n (minDate && isBeforeDay(last, minDate)) || (maxDate && isAfterDay(first, maxDate)),\n );\n },\n [maxDate, minDate],\n );\n const clampMonth = useCallback(\n (date: Date) => {\n const normalized = startOfMonth(date);\n if (minMonth && isBeforeDay(normalized, minMonth)) return minMonth;\n if (maxMonth && isAfterDay(normalized, maxMonth)) return maxMonth;\n return normalized;\n },\n [maxMonth, minMonth],\n );\n const setMonth = useCallback((date: Date) => setMonthState(clampMonth(date)), [clampMonth]);\n const canNavigate = useCallback(\n (amount: number) => {\n const next = addMonths(month, amount);\n return (\n !(minMonth && isBeforeDay(next, minMonth)) && !(maxMonth && isAfterDay(next, maxMonth))\n );\n },\n [maxMonth, minMonth, month],\n );\n const setRange = useCallback(\n (nextRange: DateRange) => {\n if (controlledValue === undefined) setUncontrolledRange(nextRange);\n onValueChange?.(nextRange);\n },\n [controlledValue, onValueChange],\n );\n const close = useCallback(() => actionsRef.current?.close(), []);\n const onSelect = useCallback(\n (date: Date) => {\n if (disabled || dateDisabled(date)) return;\n const nextDate = createCalendarDate(date.getFullYear(), date.getMonth(), date.getDate());\n let nextRange: DateRange;\n if (!range.start || range.end) nextRange = { start: nextDate, end: null };\n else if (isBeforeDay(nextDate, range.start)) nextRange = { start: nextDate, end: null };\n else nextRange = { start: range.start, end: nextDate };\n setRange(nextRange);\n setFocusedDate(nextDate);\n setMonth(nextDate);\n setHoveredDate(null);\n if (nextRange.start && nextRange.end && closeOnSelect) close();\n },\n [close, closeOnSelect, dateDisabled, disabled, range.end, range.start, setMonth, setRange],\n );\n const focusDate = useCallback(\n (date: Date, direction = 1) => {\n let next = createCalendarDate(date.getFullYear(), date.getMonth(), date.getDate());\n const step = direction < 0 ? -1 : 1;\n let attempts = 0;\n while (dateDisabled(next) && attempts < 366) {\n next = addDays(next, step);\n attempts += 1;\n }\n setFocusedDate(next);\n setMonth(next);\n const focusTarget = () => dayRefs.current.get(dateKey(next))?.focus();\n focusTarget();\n queueMicrotask(focusTarget);\n },\n [dateDisabled, setMonth],\n );\n const selectMonth = useCallback(\n (monthIndex: number) => setMonth(createCalendarDate(month.getFullYear(), monthIndex, 1)),\n [month, setMonth],\n );\n const selectYear = useCallback(\n (year: number) => setMonth(createCalendarDate(year, month.getMonth(), 1)),\n [month, setMonth],\n );\n const registerDay = useCallback((key: string, node: HTMLButtonElement | null) => {\n if (node) dayRefs.current.set(key, node);\n else dayRefs.current.delete(key);\n }, []);\n\n useEffect(() => {\n const selected = range.end ?? range.start;\n if (!selected) return;\n setFocusedDate(selected);\n setMonthState((current) => (sameMonth(current, selected) ? current : clampMonth(selected)));\n }, [clampMonth, range.end, range.start]);\n\n const context: DateRangePickerContextValue = {\n canNavigate,\n close,\n dateDisabled,\n disabled,\n focusDate,\n focusedDate,\n hoveredDate,\n locale,\n maxDate,\n minDate,\n month,\n monthDisabled,\n onSelect,\n range,\n registerDay,\n selectMonth,\n selectYear,\n setHoveredDate,\n setMonth,\n setRange,\n styles,\n today,\n triggerId,\n weekStartsOn,\n yearRange,\n };\n\n return (\n <DateRangePickerContext.Provider value={context}>\n <BasePopover.Root {...popoverProps} actionsRef={actionsRef}>\n {children}\n </BasePopover.Root>\n {name ? (\n <>\n <input\n disabled={disabled}\n name={`${name}[start]`}\n type=\"hidden\"\n value={toInputDate(range.start)}\n />\n <input\n disabled={disabled}\n name={`${name}[end]`}\n type=\"hidden\"\n value={toInputDate(range.end)}\n />\n </>\n ) : null}\n </DateRangePickerContext.Provider>\n );\n}\n\nexport type DateRangePickerLabelProps = ComponentPropsWithoutRef<\"label\">;\nexport const DateRangePickerLabel = forwardRef<HTMLLabelElement, DateRangePickerLabelProps>(\n function DateRangePickerLabel({ className, ...props }, ref) {\n const { styles, triggerId } = useDateRangePickerContext();\n return (\n // biome-ignore lint/a11y/noLabelWithoutControl: the consumer renders the trigger/control in this composition.\n <label\n {...props}\n className={cx(styles.label, className)}\n data-slot=\"date-range-picker-label\"\n htmlFor={props.htmlFor ?? triggerId}\n ref={ref}\n />\n );\n },\n);\n\nexport type DateRangePickerControlProps = ComponentPropsWithoutRef<\"div\">;\nexport const DateRangePickerControl = forwardRef<HTMLDivElement, DateRangePickerControlProps>(\n function DateRangePickerControl({ className, ...props }, ref) {\n const { styles } = useDateRangePickerContext();\n return (\n <div\n {...props}\n className={cx(styles.control, className)}\n data-slot=\"date-range-picker-control\"\n ref={ref}\n />\n );\n },\n);\n\nexport type DateRangePickerTriggerProps = ComponentPropsWithoutRef<typeof BasePopover.Trigger>;\nexport const DateRangePickerTrigger = forwardRef<HTMLButtonElement, DateRangePickerTriggerProps>(\n function DateRangePickerTrigger({ children, className, disabled, id, ...props }, ref) {\n const { disabled: pickerDisabled, styles, triggerId } = useDateRangePickerContext();\n return (\n <BasePopover.Trigger\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Choose date range\"}\n className={withRecipeClassName(styles.trigger, className)}\n data-jaci-component=\"date-range-picker\"\n data-slot=\"date-range-picker-trigger\"\n disabled={disabled ?? pickerDisabled}\n id={id ?? triggerId}\n ref={ref}\n >\n {children ?? (\n <>\n <DateRangePickerValue />\n <span aria-hidden=\"true\">▾</span>\n </>\n )}\n </BasePopover.Trigger>\n );\n },\n);\n\nexport interface DateRangePickerValueProps extends ComponentPropsWithoutRef<\"span\"> {\n placeholder?: ReactNode;\n}\nexport const DateRangePickerValue = forwardRef<HTMLSpanElement, DateRangePickerValueProps>(\n function DateRangePickerValue({ children, className, placeholder, ...props }, ref) {\n const { locale, range, styles } = useDateRangePickerContext();\n const value =\n children ??\n (range.start && range.end\n ? `${formatDateLabel(range.start, locale, \"\")} – ${formatDateLabel(range.end, locale, \"\")}`\n : range.start\n ? `${formatDateLabel(range.start, locale, \"\")} – …`\n : (placeholder ?? \"Select a date range\"));\n return (\n <span\n {...props}\n className={cx(styles.value, className)}\n data-placeholder={range.start ? undefined : \"true\"}\n data-slot=\"date-range-picker-value\"\n ref={ref}\n >\n {value}\n </span>\n );\n },\n);\n\nexport type DateRangePickerClearProps = ComponentPropsWithoutRef<\"button\">;\nexport const DateRangePickerClear = forwardRef<HTMLButtonElement, DateRangePickerClearProps>(\n function DateRangePickerClear({ children = \"×\", className, disabled, onClick, ...props }, ref) {\n const {\n disabled: pickerDisabled,\n range,\n setRange,\n styles,\n close,\n } = useDateRangePickerContext();\n return (\n <button\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Clear date range\"}\n className={cx(styles.clear, className)}\n data-slot=\"date-range-picker-clear\"\n disabled={disabled || pickerDisabled || (!range.start && !range.end)}\n onClick={(event) => {\n setRange({ start: null, end: null });\n close();\n onClick?.(event);\n }}\n ref={ref}\n type=\"button\"\n >\n {children}\n </button>\n );\n },\n);\n\nexport type DateRangePickerPortalProps = ComponentPropsWithoutRef<typeof BasePopover.Portal>;\nexport function DateRangePickerPortal(props: DateRangePickerPortalProps) {\n return <BasePopover.Portal {...useThemePortalProps(props)} />;\n}\nexport type DateRangePickerPositionerProps = ComponentPropsWithoutRef<\n typeof BasePopover.Positioner\n>;\nexport const DateRangePickerPositioner = forwardRef<HTMLDivElement, DateRangePickerPositionerProps>(\n function DateRangePickerPositioner({ className, ...props }, ref) {\n const { styles } = useDateRangePickerContext();\n return (\n <BasePopover.Positioner\n {...props}\n className={withRecipeClassName(styles.positioner, className)}\n data-slot=\"date-range-picker-positioner\"\n ref={ref}\n />\n );\n },\n);\nexport type DateRangePickerPopupProps = ComponentPropsWithoutRef<typeof BasePopover.Popup>;\nexport const DateRangePickerPopup = forwardRef<HTMLDivElement, DateRangePickerPopupProps>(\n function DateRangePickerPopup({ className, ...props }, ref) {\n const { styles } = useDateRangePickerContext();\n return (\n <BasePopover.Popup\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Calendar\"}\n className={withRecipeClassName(styles.popup, className)}\n data-slot=\"date-range-picker-popup\"\n ref={ref}\n />\n );\n },\n);\nexport type DateRangePickerCloseProps = ComponentPropsWithoutRef<typeof BasePopover.Close>;\nexport const DateRangePickerClose = forwardRef<HTMLButtonElement, DateRangePickerCloseProps>(\n function DateRangePickerClose({ className, ...props }, ref) {\n const { styles } = useDateRangePickerContext();\n return (\n <BasePopover.Close\n {...props}\n className={withRecipeClassName(styles.close, className)}\n data-slot=\"date-range-picker-close\"\n ref={ref}\n />\n );\n },\n);\n\nexport type DateRangePickerHeaderProps = ComponentPropsWithoutRef<\"div\">;\nexport const DateRangePickerHeader = forwardRef<HTMLDivElement, DateRangePickerHeaderProps>(\n function DateRangePickerHeader({ className, ...props }, ref) {\n const { styles } = useDateRangePickerContext();\n return (\n <div\n {...props}\n className={cx(styles.header, className)}\n data-slot=\"date-range-picker-header\"\n ref={ref}\n />\n );\n },\n);\nexport type DateRangePickerNavigationProps = ComponentPropsWithoutRef<\"button\"> & {\n amount?: number;\n};\nconst DateRangePickerNavigationButton = forwardRef<\n HTMLButtonElement,\n DateRangePickerNavigationProps\n>(function DateRangePickerNavigationButton(\n { amount = 1, children, className, onClick, ...props },\n ref,\n) {\n const { canNavigate, month, setMonth, styles } = useDateRangePickerContext();\n const isDisabled = props.disabled || !canNavigate(amount);\n return (\n <button\n {...props}\n aria-label={props[\"aria-label\"] ?? (amount < 0 ? \"Previous month\" : \"Next month\")}\n className={cx(styles.navigation, className)}\n data-slot={amount < 0 ? \"date-range-picker-previous\" : \"date-range-picker-next\"}\n disabled={isDisabled}\n onClick={(event) => {\n if (!isDisabled) setMonth(addMonths(month, amount));\n onClick?.(event);\n }}\n ref={ref}\n type=\"button\"\n >\n {children ?? (amount < 0 ? \"‹\" : \"›\")}\n </button>\n );\n});\nexport const DateRangePickerPrevious = forwardRef<\n HTMLButtonElement,\n DateRangePickerNavigationProps\n>(function DateRangePickerPrevious(props, ref) {\n return <DateRangePickerNavigationButton {...props} amount={-1} ref={ref} />;\n});\nexport const DateRangePickerNext = forwardRef<HTMLButtonElement, DateRangePickerNavigationProps>(\n function DateRangePickerNext(props, ref) {\n return <DateRangePickerNavigationButton {...props} amount={1} ref={ref} />;\n },\n);\nexport type DateRangePickerMonthSelectProps = Omit<\n ComponentPropsWithoutRef<\"select\">,\n \"children\" | \"onChange\" | \"value\"\n>;\nexport const DateRangePickerMonthSelect = forwardRef<\n HTMLSelectElement,\n DateRangePickerMonthSelectProps\n>(function DateRangePickerMonthSelect({ className, ...props }, ref) {\n const { locale, month, monthDisabled, selectMonth, styles } = useDateRangePickerContext();\n const labels = getMonthLabels(locale);\n return (\n <select\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Select month\"}\n className={cx(styles.monthSelect, className)}\n data-slot=\"date-range-picker-month-select\"\n onChange={(event) => selectMonth(Number(event.currentTarget.value))}\n ref={ref}\n value={month.getMonth()}\n >\n {labels.map((label, index) => (\n <option\n disabled={monthDisabled(createCalendarDate(month.getFullYear(), index, 1))}\n key={label}\n value={index}\n >\n {label}\n </option>\n ))}\n </select>\n );\n});\nexport type DateRangePickerYearSelectProps = Omit<\n ComponentPropsWithoutRef<\"select\">,\n \"children\" | \"onChange\" | \"value\"\n>;\nexport const DateRangePickerYearSelect = forwardRef<\n HTMLSelectElement,\n DateRangePickerYearSelectProps\n>(function DateRangePickerYearSelect({ className, ...props }, ref) {\n const { month, monthDisabled, selectYear, styles, yearRange } = useDateRangePickerContext();\n const years = Array.from(\n { length: yearRange.end - yearRange.start + 1 },\n (_, index) => yearRange.start + index,\n );\n return (\n <select\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Select year\"}\n className={cx(styles.yearSelect, className)}\n data-slot=\"date-range-picker-year-select\"\n onChange={(event) => selectYear(Number(event.currentTarget.value))}\n ref={ref}\n value={month.getFullYear()}\n >\n {years.map((year) => (\n <option\n disabled={monthDisabled(createCalendarDate(year, month.getMonth(), 1))}\n key={year}\n value={year}\n >\n {year}\n </option>\n ))}\n </select>\n );\n});\n\nexport interface DateRangePickerDayProps extends Omit<ComponentPropsWithoutRef<\"button\">, \"value\"> {\n date: Date;\n}\nexport const DateRangePickerDay = forwardRef<HTMLButtonElement, DateRangePickerDayProps>(\n function DateRangePickerDay(\n { children, className, date, disabled, onClick, onKeyDown, onMouseEnter, ...props },\n ref,\n ) {\n const {\n dateDisabled,\n disabled: pickerDisabled,\n focusDate,\n focusedDate,\n hoveredDate,\n locale,\n month,\n range,\n onSelect,\n registerDay,\n setHoveredDate,\n styles,\n today,\n weekStartsOn,\n } = useDateRangePickerContext();\n const key = dateKey(date);\n const isDisabled = Boolean(disabled || pickerDisabled || dateDisabled(date));\n const isStart = Boolean(range.start && isSameDay(date, range.start));\n const isEnd = Boolean(range.end && isSameDay(date, range.end));\n const inRange = dateInRange(date, range, hoveredDate);\n const outsideMonth = !sameMonth(date, month);\n const isFocused = isSameDay(date, focusedDate);\n const isToday = isSameDay(date, today);\n return (\n // biome-ignore lint/a11y/useSemanticElements: the roving button is the interactive grid cell.\n <button\n {...props}\n aria-label={\n props[\"aria-label\"] ?? new Intl.DateTimeFormat(locale, { dateStyle: \"full\" }).format(date)\n }\n aria-current={isToday ? \"date\" : undefined}\n aria-selected={isStart || isEnd}\n className={cx(styles.day, className)}\n data-date={key}\n data-disabled={isDisabled || undefined}\n data-in-range={inRange || undefined}\n data-outside-month={outsideMonth || undefined}\n data-range-end={isEnd || undefined}\n data-range-start={isStart || undefined}\n data-slot=\"date-range-picker-day\"\n data-today={isToday || undefined}\n disabled={isDisabled}\n onClick={(event) => {\n onSelect(date);\n onClick?.(event);\n }}\n onKeyDown={(event) => {\n if (!event.defaultPrevented) {\n let nextDate: Date | undefined;\n switch (event.key) {\n case \"ArrowLeft\":\n nextDate = addDays(date, -1);\n break;\n case \"ArrowRight\":\n nextDate = addDays(date, 1);\n break;\n case \"ArrowUp\":\n nextDate = addDays(date, -7);\n break;\n case \"ArrowDown\":\n nextDate = addDays(date, 7);\n break;\n case \"Home\":\n nextDate = addDays(date, -((date.getDay() - weekStartsOn + 7) % 7));\n break;\n case \"End\":\n nextDate = addDays(date, 6 - ((date.getDay() - weekStartsOn + 7) % 7));\n break;\n case \"PageUp\":\n nextDate = addMonths(date, event.shiftKey ? -12 : -1);\n break;\n case \"PageDown\":\n nextDate = addMonths(date, event.shiftKey ? 12 : 1);\n break;\n case \"Enter\":\n case \" \":\n if (!isDisabled) {\n event.preventDefault();\n onSelect(date);\n }\n break;\n }\n if (nextDate) {\n event.preventDefault();\n focusDate(nextDate, nextDate < date ? -1 : 1);\n }\n }\n onKeyDown?.(event);\n }}\n onMouseEnter={(event) => {\n if (!isDisabled) setHoveredDate(date);\n onMouseEnter?.(event);\n }}\n ref={(node) => {\n registerDay(key, node);\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n role=\"gridcell\"\n tabIndex={isFocused && !isDisabled ? 0 : -1}\n type=\"button\"\n >\n {children ?? date.getDate()}\n </button>\n );\n },\n);\n\nexport interface DateRangePickerCalendarProps\n extends Omit<ComponentPropsWithoutRef<\"section\">, \"children\"> {\n \"aria-label\"?: string;\n}\nexport const DateRangePickerCalendar = forwardRef<HTMLElement, DateRangePickerCalendarProps>(\n function DateRangePickerCalendar({ \"aria-label\": ariaLabel, className, ...props }, ref) {\n const { locale, month, styles, weekStartsOn } = useDateRangePickerContext();\n const days = useMemo(() => getCalendarDays(month, weekStartsOn), [month, weekStartsOn]);\n const weekdays = useMemo(() => getWeekdayLabels(locale, weekStartsOn), [locale, weekStartsOn]);\n return (\n <section\n {...props}\n aria-label={ariaLabel ?? formatMonthLabel(month, locale)}\n className={cx(styles.calendar, className)}\n data-slot=\"date-range-picker-calendar\"\n ref={ref}\n >\n <div aria-hidden=\"true\" className={styles.weekdays} data-slot=\"date-range-picker-weekdays\">\n {weekdays.map((weekday) => (\n <span className={styles.weekday} data-slot=\"date-range-picker-weekday\" key={weekday}>\n {weekday}\n </span>\n ))}\n </div>\n {/* biome-ignore lint/a11y/useSemanticElements: the calendar uses the ARIA grid pattern. */}\n <div\n aria-label={formatMonthLabel(month, locale)}\n className={styles.grid}\n data-slot=\"date-range-picker-grid\"\n role=\"grid\"\n >\n {days.map((date) => (\n <DateRangePickerDay date={date} key={dateKey(date)} />\n ))}\n </div>\n </section>\n );\n },\n);\n\nexport interface DateRangePickerPreviewProps extends ComponentPropsWithoutRef<\"div\"> {\n children?: ReactNode;\n}\nexport const DateRangePickerPreview = forwardRef<HTMLDivElement, DateRangePickerPreviewProps>(\n function DateRangePickerPreview({ children, className, ...props }, ref) {\n const { hoveredDate, locale, range, styles } = useDateRangePickerContext();\n const content =\n children ??\n (range.start\n ? `${formatDateLabel(range.start, locale, \"\")} – ${range.end ? formatDateLabel(range.end, locale, \"\") : hoveredDate ? formatDateLabel(hoveredDate, locale, \"\") : \"…\"}`\n : \"Select a start date\");\n return (\n <div\n {...props}\n aria-live=\"polite\"\n className={cx(styles.preview, className)}\n data-slot=\"date-range-picker-preview\"\n ref={ref}\n >\n {content}\n </div>\n );\n },\n);\n\nexport interface DateRangePickerInputProps\n extends Omit<ComponentPropsWithoutRef<\"input\">, \"type\" | \"value\" | \"onChange\"> {\n side: \"start\" | \"end\";\n}\nexport const DateRangePickerInput = forwardRef<HTMLInputElement, DateRangePickerInputProps>(\n function DateRangePickerInput({ className, onBlur, onInput, side, ...props }, ref) {\n const { disabled, range, setRange, styles } = useDateRangePickerContext();\n const value = toInputDate(side === \"start\" ? range.start : range.end);\n return (\n <input\n {...props}\n aria-label={props[\"aria-label\"] ?? (side === \"start\" ? \"Start date\" : \"End date\")}\n className={cx(styles.input, className)}\n data-slot={`date-range-picker-${side}-input`}\n disabled={disabled || props.disabled}\n onChange={(event) => {\n const [year, month, day] = event.currentTarget.value.split(\"-\").map(Number);\n if (!year || !month || !day) return;\n const date = createCalendarDate(year, month - 1, day);\n setRange(\n side === \"start\" ? { start: date, end: range.end } : { start: range.start, end: date },\n );\n }}\n onBlur={onBlur}\n onInput={onInput}\n ref={ref}\n type=\"date\"\n value={value}\n />\n );\n },\n);\n\nexport const DateRangePickerStartInput = forwardRef<\n HTMLInputElement,\n Omit<DateRangePickerInputProps, \"side\">\n>(function DateRangePickerStartInput(props, ref) {\n return <DateRangePickerInput {...props} ref={ref} side=\"start\" />;\n});\nexport const DateRangePickerEndInput = forwardRef<\n HTMLInputElement,\n Omit<DateRangePickerInputProps, \"side\">\n>(function DateRangePickerEndInput(props, ref) {\n return <DateRangePickerInput {...props} ref={ref} side=\"end\" />;\n});\n\nexport const DateRangePicker = {\n Root: DateRangePickerRoot,\n Label: DateRangePickerLabel,\n Control: DateRangePickerControl,\n Trigger: DateRangePickerTrigger,\n Value: DateRangePickerValue,\n Clear: DateRangePickerClear,\n Portal: DateRangePickerPortal,\n Positioner: DateRangePickerPositioner,\n Popup: DateRangePickerPopup,\n Close: DateRangePickerClose,\n Header: DateRangePickerHeader,\n Previous: DateRangePickerPrevious,\n Next: DateRangePickerNext,\n MonthSelect: DateRangePickerMonthSelect,\n YearSelect: DateRangePickerYearSelect,\n Calendar: DateRangePickerCalendar,\n Day: DateRangePickerDay,\n Preview: DateRangePickerPreview,\n StartInput: DateRangePickerStartInput,\n EndInput: DateRangePickerEndInput,\n};\n"],"mappings":";;;;;;;;;;AA8FA,MAAM,yBAAyB,cAAkD,IAAI;AAErF,SAAS,4BAA4B;CACnC,MAAM,UAAU,WAAW,sBAAsB;CACjD,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,qEAAqE;CACvF,OAAO;AACT;AAEA,SAAS,UAAU,MAAY,OAAa;CAC1C,OAAO,KAAK,YAAY,MAAM,MAAM,YAAY,KAAK,KAAK,SAAS,MAAM,MAAM,SAAS;AAC1F;AAEA,SAAS,YAAY,MAAY,O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Q;EACC;EACJ;EACL,MAAK;EACE;CACR,CAAA;AAEL,CACF;AAEA,MAAa,4BAA4B,WAGvC,SAAS,0BAA0B,OAAO,KAAK;CAC/C,OAAO,oBAAC,sBAAD;EAAsB,GAAI;EAAY;EAAK,MAAK;CAAS,CAAA;AAClE,CAAC;AACD,MAAa,0BAA0B,WAGrC,SAAS,wBAAwB,OAAO,KAAK;CAC7C,OAAO,oBAAC,sBAAD;EAAsB,GAAI;EAAY;EAAK,MAAK;CAAO,CAAA;AAChE,CAAC;AAED,MAAa,kBAAkB;CAC7B,MAAM;CACN,OAAO;CACP,SAAS;CACT,SAAS;CACT,OAAO;CACP,OAAO;CACP,QAAQ;CACR,YAAY;CACZ,OAAO;CACP,OAAO;CACP,QAAQ;CACR,UAAU;CACV,MAAM;CACN,aAAa;CACb,YAAY;CACZ,UAAU;CACV,KAAK;CACL,SAAS;CACT,YAAY;CACZ,UAAU;AACZ"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const require_cx = require("../../styled-system/css/cx.cjs");
|
|
3
3
|
const require_base_ui = require("../base-ui.cjs");
|
|
4
4
|
const require_dialog = require("../../styled-system/recipes/dialog.cjs");
|
|
5
|
+
const require_theme_scope = require("../../theme/theme-scope.cjs");
|
|
5
6
|
let react = require("react");
|
|
6
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
8
|
let _base_ui_react_dialog = require("@base-ui/react/dialog");
|
|
@@ -20,7 +21,9 @@ const DialogTrigger = (0, react.forwardRef)(function DialogTrigger({ className,
|
|
|
20
21
|
/**
|
|
21
22
|
* Preserves Base UI's portal behavior and optional container/ref APIs.
|
|
22
23
|
*/
|
|
23
|
-
|
|
24
|
+
function DialogPortal(props) {
|
|
25
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_dialog.Dialog.Portal, { ...require_theme_scope.useThemePortalProps(props) });
|
|
26
|
+
}
|
|
24
27
|
const DialogBackdrop = (0, react.forwardRef)(function DialogBackdrop({ className, ...props }, ref) {
|
|
25
28
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_dialog.Dialog.Backdrop, {
|
|
26
29
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.cjs","names":["BaseDialog","withRecipeClassName","dialog","cx"],"sources":["../../../src/components/dialog/dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { DialogRoot as BaseDialogRoot } from \"@base-ui/react/dialog\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { dialog } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\n\nexport type DialogSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * Groups the dialog parts. It supports Base UI's controlled open/onOpenChange\n * API and uncontrolled defaultOpen API.\n */\nexport type DialogRootProps<Payload = unknown> = BaseDialogRoot.Props<Payload>;\n\nexport function DialogRoot<Payload = unknown>(props: DialogRootProps<Payload>) {\n return <BaseDialog.Root {...props} />;\n}\n\nexport type DialogTriggerProps = ComponentPropsWithoutRef<typeof BaseDialog.Trigger>;\n\nexport const DialogTrigger = forwardRef<HTMLButtonElement, DialogTriggerProps>(\n function DialogTrigger({ className, ...props }, ref) {\n return (\n <BaseDialog.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(dialog().trigger, className)}\n data-slot=\"dialog-trigger\"\n />\n );\n },\n);\n\nexport type DialogPortalProps = ComponentPropsWithoutRef<typeof BaseDialog.Portal>;\n\n/**\n * Preserves Base UI's portal behavior and optional container/ref APIs.\n */\nexport
|
|
1
|
+
{"version":3,"file":"dialog.cjs","names":["BaseDialog","withRecipeClassName","dialog","useThemePortalProps","cx"],"sources":["../../../src/components/dialog/dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { DialogRoot as BaseDialogRoot } from \"@base-ui/react/dialog\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { dialog } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type DialogSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * Groups the dialog parts. It supports Base UI's controlled open/onOpenChange\n * API and uncontrolled defaultOpen API.\n */\nexport type DialogRootProps<Payload = unknown> = BaseDialogRoot.Props<Payload>;\n\nexport function DialogRoot<Payload = unknown>(props: DialogRootProps<Payload>) {\n return <BaseDialog.Root {...props} />;\n}\n\nexport type DialogTriggerProps = ComponentPropsWithoutRef<typeof BaseDialog.Trigger>;\n\nexport const DialogTrigger = forwardRef<HTMLButtonElement, DialogTriggerProps>(\n function DialogTrigger({ className, ...props }, ref) {\n return (\n <BaseDialog.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(dialog().trigger, className)}\n data-slot=\"dialog-trigger\"\n />\n );\n },\n);\n\nexport type DialogPortalProps = ComponentPropsWithoutRef<typeof BaseDialog.Portal>;\n\n/**\n * Preserves Base UI's portal behavior and optional container/ref APIs.\n */\nexport function DialogPortal(props: DialogPortalProps) {\n return <BaseDialog.Portal {...useThemePortalProps(props)} />;\n}\n\nexport type DialogBackdropProps = ComponentPropsWithoutRef<typeof BaseDialog.Backdrop>;\n\nexport const DialogBackdrop = forwardRef<HTMLDivElement, DialogBackdropProps>(\n function DialogBackdrop({ className, ...props }, ref) {\n return (\n <BaseDialog.Backdrop\n {...props}\n ref={ref}\n className={withRecipeClassName(dialog().backdrop, className)}\n data-slot=\"dialog-backdrop\"\n />\n );\n },\n);\n\nexport type DialogViewportProps = ComponentPropsWithoutRef<typeof BaseDialog.Viewport>;\n\nexport const DialogViewport = forwardRef<HTMLDivElement, DialogViewportProps>(\n function DialogViewport({ className, ...props }, ref) {\n return (\n <BaseDialog.Viewport\n {...props}\n ref={ref}\n className={withRecipeClassName(dialog().viewport, className)}\n data-slot=\"dialog-viewport\"\n />\n );\n },\n);\n\nexport interface DialogPopupProps extends ComponentPropsWithoutRef<typeof BaseDialog.Popup> {\n size?: DialogSize;\n}\n\nexport const DialogPopup = forwardRef<HTMLDivElement, DialogPopupProps>(function DialogPopup(\n { className, size = \"md\", ...props },\n ref,\n) {\n return (\n <BaseDialog.Popup\n {...props}\n ref={ref}\n className={withRecipeClassName(dialog({ size }).popup, className)}\n data-jaci-component=\"dialog\"\n data-slot=\"dialog-popup\"\n />\n );\n});\n\nexport type DialogHeaderProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DialogHeader = forwardRef<HTMLDivElement, DialogHeaderProps>(function DialogHeader(\n { className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(dialog().header, className)}\n data-slot=\"dialog-header\"\n />\n );\n});\n\nexport type DialogTitleProps = ComponentPropsWithoutRef<typeof BaseDialog.Title>;\n\nexport const DialogTitle = forwardRef<HTMLHeadingElement, DialogTitleProps>(function DialogTitle(\n { className, ...props },\n ref,\n) {\n return (\n <BaseDialog.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(dialog().title, className)}\n data-slot=\"dialog-title\"\n />\n );\n});\n\nexport type DialogDescriptionProps = ComponentPropsWithoutRef<typeof BaseDialog.Description>;\n\nexport const DialogDescription = forwardRef<HTMLParagraphElement, DialogDescriptionProps>(\n function DialogDescription({ className, ...props }, ref) {\n return (\n <BaseDialog.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(dialog().description, className)}\n data-slot=\"dialog-description\"\n />\n );\n },\n);\n\nexport type DialogBodyProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DialogBody = forwardRef<HTMLDivElement, DialogBodyProps>(function DialogBody(\n { className, ...props },\n ref,\n) {\n return (\n <div {...props} ref={ref} className={cx(dialog().body, className)} data-slot=\"dialog-body\" />\n );\n});\n\nexport type DialogFooterProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DialogFooter = forwardRef<HTMLDivElement, DialogFooterProps>(function DialogFooter(\n { className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(dialog().footer, className)}\n data-slot=\"dialog-footer\"\n />\n );\n});\n\nexport type DialogCloseProps = ComponentPropsWithoutRef<typeof BaseDialog.Close>;\n\nexport const DialogClose = forwardRef<HTMLButtonElement, DialogCloseProps>(function DialogClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const hasVisibleLabel = children != null;\n\n return (\n <BaseDialog.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Close dialog\")}\n ref={ref}\n className={withRecipeClassName(hasVisibleLabel ? dialog().action : dialog().close, className)}\n data-slot=\"dialog-close\"\n >\n {children ?? \"×\"}\n </BaseDialog.Close>\n );\n});\n\nexport const Dialog = {\n Root: DialogRoot,\n Trigger: DialogTrigger,\n Portal: DialogPortal,\n Backdrop: DialogBackdrop,\n Viewport: DialogViewport,\n Popup: DialogPopup,\n Header: DialogHeader,\n Title: DialogTitle,\n Description: DialogDescription,\n Body: DialogBody,\n Footer: DialogFooter,\n Close: DialogClose,\n createHandle: BaseDialog.createHandle,\n};\n"],"mappings":";;;;;;;;;AAoBA,SAAgB,WAA8B,OAAiC;CAC7E,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACA,sBAAAA,OAAW,MAAZ,EAAiB,GAAI,MAAQ,CAAA;AACtC;AAIA,MAAa,iBAAA,GAAA,MAAA,WAAA,CACX,SAAS,cAAc,EAAE,WAAW,GAAG,SAAS,KAAK;CACnD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,sBAAAA,OAAW,SAAZ;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBC,eAAAA,OAAO,CAAC,CAAC,SAAS,SAAS;EAC1D,aAAU;CACX,CAAA;AAEL,CACF;;;;AAOA,SAAgB,aAAa,OAA0B;CACrD,OAAO,iBA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B,KAAA,IAAY;EACnD;EACL,WAAWC,gBAAAA,oBAAoB,kBAAkBC,eAAAA,OAAO,CAAC,CAAC,SAASA,eAAAA,OAAO,CAAC,CAAC,OAAO,SAAS;EAC5F,aAAU;YAET,YAAY;CACG,CAAA;AAEtB,CAAC;AAED,MAAa,SAAS;CACpB,MAAM;CACN,SAAS;CACT,QAAQ;CACR,UAAU;CACV,UAAU;CACV,OAAO;CACP,QAAQ;CACR,OAAO;CACP,aAAa;CACb,MAAM;CACN,QAAQ;CACR,OAAO;CACP,cAAcF,sBAAAA,OAAW;AAC3B"}
|
|
@@ -14,7 +14,7 @@ type DialogPortalProps = ComponentPropsWithoutRef<typeof Dialog.Portal>;
|
|
|
14
14
|
/**
|
|
15
15
|
* Preserves Base UI's portal behavior and optional container/ref APIs.
|
|
16
16
|
*/
|
|
17
|
-
declare
|
|
17
|
+
declare function DialogPortal(props: DialogPortalProps): import("react").JSX.Element;
|
|
18
18
|
type DialogBackdropProps = ComponentPropsWithoutRef<typeof Dialog.Backdrop>;
|
|
19
19
|
declare const DialogBackdrop: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AlertDialogBackdropProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
20
20
|
type DialogViewportProps = ComponentPropsWithoutRef<typeof Dialog.Viewport>;
|
|
@@ -38,7 +38,7 @@ declare const DialogClose: import("react").ForwardRefExoticComponent<Omit<Omit<i
|
|
|
38
38
|
declare const Dialog$1: {
|
|
39
39
|
Root: typeof DialogRoot$1;
|
|
40
40
|
Trigger: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").DialogTriggerProps<unknown> & import("react").RefAttributes<HTMLElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
41
|
-
Portal:
|
|
41
|
+
Portal: typeof DialogPortal;
|
|
42
42
|
Backdrop: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AlertDialogBackdropProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
43
43
|
Viewport: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AlertDialogViewportProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
44
44
|
Popup: import("react").ForwardRefExoticComponent<DialogPopupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -14,7 +14,7 @@ type DialogPortalProps = ComponentPropsWithoutRef<typeof Dialog.Portal>;
|
|
|
14
14
|
/**
|
|
15
15
|
* Preserves Base UI's portal behavior and optional container/ref APIs.
|
|
16
16
|
*/
|
|
17
|
-
declare
|
|
17
|
+
declare function DialogPortal(props: DialogPortalProps): import("react").JSX.Element;
|
|
18
18
|
type DialogBackdropProps = ComponentPropsWithoutRef<typeof Dialog.Backdrop>;
|
|
19
19
|
declare const DialogBackdrop: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AlertDialogBackdropProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
20
20
|
type DialogViewportProps = ComponentPropsWithoutRef<typeof Dialog.Viewport>;
|
|
@@ -38,7 +38,7 @@ declare const DialogClose: import("react").ForwardRefExoticComponent<Omit<Omit<i
|
|
|
38
38
|
declare const Dialog$1: {
|
|
39
39
|
Root: typeof DialogRoot$1;
|
|
40
40
|
Trigger: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").DialogTriggerProps<unknown> & import("react").RefAttributes<HTMLElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
41
|
-
Portal:
|
|
41
|
+
Portal: typeof DialogPortal;
|
|
42
42
|
Backdrop: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AlertDialogBackdropProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
43
43
|
Viewport: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AlertDialogViewportProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
44
44
|
Popup: import("react").ForwardRefExoticComponent<DialogPopupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { cx } from "../../styled-system/css/cx.js";
|
|
3
3
|
import { withRecipeClassName } from "../base-ui.js";
|
|
4
4
|
import { dialog } from "../../styled-system/recipes/dialog.js";
|
|
5
|
+
import { useThemePortalProps } from "../../theme/theme-scope.js";
|
|
5
6
|
import { forwardRef } from "react";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
8
|
import { Dialog } from "@base-ui/react/dialog";
|
|
@@ -20,7 +21,9 @@ const DialogTrigger = forwardRef(function DialogTrigger({ className, ...props },
|
|
|
20
21
|
/**
|
|
21
22
|
* Preserves Base UI's portal behavior and optional container/ref APIs.
|
|
22
23
|
*/
|
|
23
|
-
|
|
24
|
+
function DialogPortal(props) {
|
|
25
|
+
return /* @__PURE__ */ jsx(Dialog.Portal, { ...useThemePortalProps(props) });
|
|
26
|
+
}
|
|
24
27
|
const DialogBackdrop = forwardRef(function DialogBackdrop({ className, ...props }, ref) {
|
|
25
28
|
return /* @__PURE__ */ jsx(Dialog.Backdrop, {
|
|
26
29
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","names":["DialogRoot","BaseDialog","Dialog"],"sources":["../../../src/components/dialog/dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { DialogRoot as BaseDialogRoot } from \"@base-ui/react/dialog\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { dialog } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\n\nexport type DialogSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * Groups the dialog parts. It supports Base UI's controlled open/onOpenChange\n * API and uncontrolled defaultOpen API.\n */\nexport type DialogRootProps<Payload = unknown> = BaseDialogRoot.Props<Payload>;\n\nexport function DialogRoot<Payload = unknown>(props: DialogRootProps<Payload>) {\n return <BaseDialog.Root {...props} />;\n}\n\nexport type DialogTriggerProps = ComponentPropsWithoutRef<typeof BaseDialog.Trigger>;\n\nexport const DialogTrigger = forwardRef<HTMLButtonElement, DialogTriggerProps>(\n function DialogTrigger({ className, ...props }, ref) {\n return (\n <BaseDialog.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(dialog().trigger, className)}\n data-slot=\"dialog-trigger\"\n />\n );\n },\n);\n\nexport type DialogPortalProps = ComponentPropsWithoutRef<typeof BaseDialog.Portal>;\n\n/**\n * Preserves Base UI's portal behavior and optional container/ref APIs.\n */\nexport
|
|
1
|
+
{"version":3,"file":"dialog.js","names":["DialogRoot","BaseDialog","Dialog"],"sources":["../../../src/components/dialog/dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { DialogRoot as BaseDialogRoot } from \"@base-ui/react/dialog\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { dialog } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type DialogSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * Groups the dialog parts. It supports Base UI's controlled open/onOpenChange\n * API and uncontrolled defaultOpen API.\n */\nexport type DialogRootProps<Payload = unknown> = BaseDialogRoot.Props<Payload>;\n\nexport function DialogRoot<Payload = unknown>(props: DialogRootProps<Payload>) {\n return <BaseDialog.Root {...props} />;\n}\n\nexport type DialogTriggerProps = ComponentPropsWithoutRef<typeof BaseDialog.Trigger>;\n\nexport const DialogTrigger = forwardRef<HTMLButtonElement, DialogTriggerProps>(\n function DialogTrigger({ className, ...props }, ref) {\n return (\n <BaseDialog.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(dialog().trigger, className)}\n data-slot=\"dialog-trigger\"\n />\n );\n },\n);\n\nexport type DialogPortalProps = ComponentPropsWithoutRef<typeof BaseDialog.Portal>;\n\n/**\n * Preserves Base UI's portal behavior and optional container/ref APIs.\n */\nexport function DialogPortal(props: DialogPortalProps) {\n return <BaseDialog.Portal {...useThemePortalProps(props)} />;\n}\n\nexport type DialogBackdropProps = ComponentPropsWithoutRef<typeof BaseDialog.Backdrop>;\n\nexport const DialogBackdrop = forwardRef<HTMLDivElement, DialogBackdropProps>(\n function DialogBackdrop({ className, ...props }, ref) {\n return (\n <BaseDialog.Backdrop\n {...props}\n ref={ref}\n className={withRecipeClassName(dialog().backdrop, className)}\n data-slot=\"dialog-backdrop\"\n />\n );\n },\n);\n\nexport type DialogViewportProps = ComponentPropsWithoutRef<typeof BaseDialog.Viewport>;\n\nexport const DialogViewport = forwardRef<HTMLDivElement, DialogViewportProps>(\n function DialogViewport({ className, ...props }, ref) {\n return (\n <BaseDialog.Viewport\n {...props}\n ref={ref}\n className={withRecipeClassName(dialog().viewport, className)}\n data-slot=\"dialog-viewport\"\n />\n );\n },\n);\n\nexport interface DialogPopupProps extends ComponentPropsWithoutRef<typeof BaseDialog.Popup> {\n size?: DialogSize;\n}\n\nexport const DialogPopup = forwardRef<HTMLDivElement, DialogPopupProps>(function DialogPopup(\n { className, size = \"md\", ...props },\n ref,\n) {\n return (\n <BaseDialog.Popup\n {...props}\n ref={ref}\n className={withRecipeClassName(dialog({ size }).popup, className)}\n data-jaci-component=\"dialog\"\n data-slot=\"dialog-popup\"\n />\n );\n});\n\nexport type DialogHeaderProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DialogHeader = forwardRef<HTMLDivElement, DialogHeaderProps>(function DialogHeader(\n { className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(dialog().header, className)}\n data-slot=\"dialog-header\"\n />\n );\n});\n\nexport type DialogTitleProps = ComponentPropsWithoutRef<typeof BaseDialog.Title>;\n\nexport const DialogTitle = forwardRef<HTMLHeadingElement, DialogTitleProps>(function DialogTitle(\n { className, ...props },\n ref,\n) {\n return (\n <BaseDialog.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(dialog().title, className)}\n data-slot=\"dialog-title\"\n />\n );\n});\n\nexport type DialogDescriptionProps = ComponentPropsWithoutRef<typeof BaseDialog.Description>;\n\nexport const DialogDescription = forwardRef<HTMLParagraphElement, DialogDescriptionProps>(\n function DialogDescription({ className, ...props }, ref) {\n return (\n <BaseDialog.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(dialog().description, className)}\n data-slot=\"dialog-description\"\n />\n );\n },\n);\n\nexport type DialogBodyProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DialogBody = forwardRef<HTMLDivElement, DialogBodyProps>(function DialogBody(\n { className, ...props },\n ref,\n) {\n return (\n <div {...props} ref={ref} className={cx(dialog().body, className)} data-slot=\"dialog-body\" />\n );\n});\n\nexport type DialogFooterProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DialogFooter = forwardRef<HTMLDivElement, DialogFooterProps>(function DialogFooter(\n { className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(dialog().footer, className)}\n data-slot=\"dialog-footer\"\n />\n );\n});\n\nexport type DialogCloseProps = ComponentPropsWithoutRef<typeof BaseDialog.Close>;\n\nexport const DialogClose = forwardRef<HTMLButtonElement, DialogCloseProps>(function DialogClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const hasVisibleLabel = children != null;\n\n return (\n <BaseDialog.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Close dialog\")}\n ref={ref}\n className={withRecipeClassName(hasVisibleLabel ? dialog().action : dialog().close, className)}\n data-slot=\"dialog-close\"\n >\n {children ?? \"×\"}\n </BaseDialog.Close>\n );\n});\n\nexport const Dialog = {\n Root: DialogRoot,\n Trigger: DialogTrigger,\n Portal: DialogPortal,\n Backdrop: DialogBackdrop,\n Viewport: DialogViewport,\n Popup: DialogPopup,\n Header: DialogHeader,\n Title: DialogTitle,\n Description: DialogDescription,\n Body: DialogBody,\n Footer: DialogFooter,\n Close: DialogClose,\n createHandle: BaseDialog.createHandle,\n};\n"],"mappings":";;;;;;;;;AAoBA,SAAgBA,aAA8B,OAAiC;CAC7E,OAAO,oBAACC,OAAW,MAAZ,EAAiB,GAAI,MAAQ,CAAA;AACtC;AAIA,MAAa,gBAAgB,WAC3B,SAAS,cAAc,EAAE,WAAW,GAAG,SAAS,KAAK;CACnD,OACE,oBAACA,OAAW,SAAZ;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,OAAO,CAAC,CAAC,SAAS,SAAS;EAC1D,aAAU;CACX,CAAA;AAEL,CACF;;;;AAOA,SAAgB,aAAa,OAA0B;CACrD,OAAO,oBAACA,OAAW,QAAZ,EAAmB,GAAI,oBAAoB,KAAK,EAAI,CAAA;AAC7D;AAIA,MAAa,iBAAiB,WAC5B,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,oBAACA,OAAW,UAAZ;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,OAAO,CAAC,CAAC,UAAU,SAAS;EAC3D,aAAU;CACX,CAAA;AAEL,CACF;AAIA,MAAa,iBAAiB,WAC5B,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,oBAACA,OAAW,UAAZ;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,OAAO,CAAC,CAAC,UAAU,SAAS;EAC3D,aAAU;CACX,CAAA;AAEL,CACF;AAMA,MAAa,cAAc,WAA6C,SAAS,YAC/E,EAAE,WAAW,OAAO,MAAM,GAAG,SAC7B,KACA;CACA,OACE,oBAACA,OAAW,OAAZ;EACE,G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ACE,GAAI;EACJ,cAAY,cAAc,kBAAkB,KAAA,IAAY;EACnD;EACL,WAAW,oBAAoB,kBAAkB,OAAO,CAAC,CAAC,SAAS,OAAO,CAAC,CAAC,OAAO,SAAS;EAC5F,aAAU;YAET,YAAY;CACG,CAAA;AAEtB,CAAC;AAED,MAAaC,WAAS;CACpB,MAAMF;CACN,SAAS;CACT,QAAQ;CACR,UAAU;CACV,UAAU;CACV,OAAO;CACP,QAAQ;CACR,OAAO;CACP,aAAa;CACb,MAAM;CACN,QAAQ;CACR,OAAO;CACP,cAAcC,OAAW;AAC3B"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const require_cx = require("../../styled-system/css/cx.cjs");
|
|
3
3
|
const require_base_ui = require("../base-ui.cjs");
|
|
4
4
|
const require_drawer = require("../../styled-system/recipes/drawer.cjs");
|
|
5
|
+
const require_theme_scope = require("../../theme/theme-scope.cjs");
|
|
5
6
|
let react = require("react");
|
|
6
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
8
|
let _base_ui_react_drawer = require("@base-ui/react/drawer");
|
|
@@ -42,7 +43,9 @@ const DrawerTrigger = (0, react.forwardRef)(function DrawerTrigger({ className,
|
|
|
42
43
|
"data-slot": "drawer-trigger"
|
|
43
44
|
});
|
|
44
45
|
});
|
|
45
|
-
|
|
46
|
+
function DrawerPortal(props) {
|
|
47
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_drawer.Drawer.Portal, { ...require_theme_scope.useThemePortalProps(props) });
|
|
48
|
+
}
|
|
46
49
|
const DrawerBackdrop = (0, react.forwardRef)(function DrawerBackdrop({ className, ...props }, ref) {
|
|
47
50
|
const { styles } = useDrawerContext();
|
|
48
51
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_drawer.Drawer.Backdrop, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.cjs","names":["drawer","BaseDrawer","withRecipeClassName","cx"],"sources":["../../../src/components/drawer/drawer.tsx"],"sourcesContent":["\"use client\";\n\nimport { Drawer as BaseDrawer } from \"@base-ui/react/drawer\";\nimport { createContext, forwardRef, useContext, useMemo } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { DrawerRoot as BaseDrawerRoot } from \"@base-ui/react/drawer\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { drawer } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\n\nexport type DrawerSide = \"bottom\" | \"left\" | \"right\" | \"top\";\nexport type DrawerSize = \"sm\" | \"md\" | \"lg\";\n\ninterface DrawerContextValue {\n side: DrawerSide;\n size: DrawerSize;\n styles: ReturnType<typeof drawer>;\n}\n\nconst DrawerContext = createContext<DrawerContextValue | null>(null);\n\nfunction useDrawerContext() {\n const context = useContext(DrawerContext);\n if (!context) {\n throw new Error(\"Drawer parts must be rendered inside Drawer.Root.\");\n }\n\n return context;\n}\n\nexport interface DrawerRootProps<Payload = unknown>\n extends Omit<BaseDrawerRoot.Props<Payload>, \"children\"> {\n /** Side from which the drawer enters. */\n side?: DrawerSide;\n /** Shared spacing scale for the drawer content. */\n size?: DrawerSize;\n children?: BaseDrawerRoot.Props<Payload>[\"children\"];\n}\n\nexport function DrawerRoot<Payload = unknown>({\n children,\n side = \"bottom\",\n size = \"md\",\n ...props\n}: DrawerRootProps<Payload>) {\n const styles = drawer({ size });\n const context = useMemo(() => ({ side, size, styles }), [side, size, styles]);\n const swipeDirection =\n props.swipeDirection ?? (side === \"bottom\" ? \"down\" : side === \"top\" ? \"up\" : side);\n\n return (\n <DrawerContext.Provider value={context}>\n <BaseDrawer.Root {...props} swipeDirection={swipeDirection}>\n {children}\n </BaseDrawer.Root>\n </DrawerContext.Provider>\n );\n}\n\nexport type DrawerTriggerProps = ComponentPropsWithoutRef<typeof BaseDrawer.Trigger>;\n\nexport const DrawerTrigger = forwardRef<HTMLButtonElement, DrawerTriggerProps>(\n function DrawerTrigger({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.trigger, className)}\n data-slot=\"drawer-trigger\"\n />\n );\n },\n);\n\nexport type DrawerPortalProps = ComponentPropsWithoutRef<typeof BaseDrawer.Portal>;\nexport const DrawerPortal: typeof BaseDrawer.Portal = BaseDrawer.Portal;\n\nexport type DrawerBackdropProps = ComponentPropsWithoutRef<typeof BaseDrawer.Backdrop>;\n\nexport const DrawerBackdrop = forwardRef<HTMLDivElement, DrawerBackdropProps>(\n function DrawerBackdrop({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Backdrop\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.backdrop, className)}\n data-slot=\"drawer-backdrop\"\n />\n );\n },\n);\n\nexport type DrawerViewportProps = ComponentPropsWithoutRef<typeof BaseDrawer.Viewport>;\n\nexport const DrawerViewport = forwardRef<HTMLDivElement, DrawerViewportProps>(\n function DrawerViewport({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Viewport\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.viewport, className)}\n data-slot=\"drawer-viewport\"\n />\n );\n },\n);\n\nexport interface DrawerPopupProps extends ComponentPropsWithoutRef<typeof BaseDrawer.Popup> {\n /** Overrides the side configured on `Drawer.Root`. */\n side?: DrawerSide;\n /** Overrides the size configured on `Drawer.Root`. */\n size?: DrawerSize;\n}\n\nexport const DrawerPopup = forwardRef<HTMLDivElement, DrawerPopupProps>(function DrawerPopup(\n { \"aria-label\": ariaLabel, className, side: popupSide, size: popupSize, ...props },\n ref,\n) {\n const { side: rootSide, size: rootSize, styles: rootStyles } = useDrawerContext();\n const side = popupSide ?? rootSide;\n const styles = popupSize && popupSize !== rootSize ? drawer({ size: popupSize }) : rootStyles;\n\n return (\n <BaseDrawer.Popup\n {...props}\n aria-label={ariaLabel ?? \"Drawer\"}\n data-jaci-component=\"drawer\"\n data-side={side}\n data-slot=\"drawer-popup\"\n ref={ref}\n className={withRecipeClassName(styles.popup, className)}\n />\n );\n});\n\nexport type DrawerContentProps = ComponentPropsWithoutRef<typeof BaseDrawer.Content>;\n\nexport const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>(function DrawerContent(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Content\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.content, className)}\n data-slot=\"drawer-content\"\n />\n );\n});\n\nexport type DrawerHeaderProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DrawerHeader = forwardRef<HTMLDivElement, DrawerHeaderProps>(function DrawerHeader(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <div {...props} ref={ref} className={cx(styles.header, className)} data-slot=\"drawer-header\" />\n );\n});\n\nexport type DrawerTitleProps = ComponentPropsWithoutRef<typeof BaseDrawer.Title>;\n\nexport const DrawerTitle = forwardRef<HTMLHeadingElement, DrawerTitleProps>(function DrawerTitle(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <BaseDrawer.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.title, className)}\n data-slot=\"drawer-title\"\n />\n );\n});\n\nexport type DrawerDescriptionProps = ComponentPropsWithoutRef<typeof BaseDrawer.Description>;\n\nexport const DrawerDescription = forwardRef<HTMLParagraphElement, DrawerDescriptionProps>(\n function DrawerDescription({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n return (\n <BaseDrawer.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.description, className)}\n data-slot=\"drawer-description\"\n />\n );\n },\n);\n\nexport type DrawerFooterProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DrawerFooter = forwardRef<HTMLDivElement, DrawerFooterProps>(function DrawerFooter(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <div {...props} ref={ref} className={cx(styles.footer, className)} data-slot=\"drawer-footer\" />\n );\n});\n\nexport type DrawerCloseProps = ComponentPropsWithoutRef<typeof BaseDrawer.Close>;\n\nexport const DrawerClose = forwardRef<HTMLButtonElement, DrawerCloseProps>(function DrawerClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n const hasVisibleLabel = children != null;\n\n return (\n <BaseDrawer.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Close drawer\")}\n ref={ref}\n className={withRecipeClassName(hasVisibleLabel ? styles.action : styles.close, className)}\n data-slot=\"drawer-close\"\n >\n {children ?? \"×\"}\n </BaseDrawer.Close>\n );\n});\n\nexport const Drawer = {\n Root: DrawerRoot,\n Trigger: DrawerTrigger,\n Portal: DrawerPortal,\n Backdrop: DrawerBackdrop,\n Viewport: DrawerViewport,\n Popup: DrawerPopup,\n Content: DrawerContent,\n Header: DrawerHeader,\n Title: DrawerTitle,\n Description: DrawerDescription,\n Footer: DrawerFooter,\n Close: DrawerClose,\n createHandle: BaseDrawer.createHandle,\n};\n"],"mappings":";;;;;;;;AAoBA,MAAM,iBAAA,GAAA,MAAA,cAAA,CAAyD,IAAI;AAEnE,SAAS,mBAAmB;CAC1B,MAAM,WAAA,GAAA,MAAA,WAAA,CAAqB,aAAa;CACxC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,mDAAmD;CAGrE,OAAO;AACT;AAWA,SAAgB,WAA8B,EAC5C,UACA,OAAO,UACP,OAAO,MACP,GAAG,SACwB;CAC3B,MAAM,SAASA,eAAAA,OAAO,EAAE,KAAK,CAAC;CAC9B,MAAM,WAAA,GAAA,MAAA,QAAA,QAAyB;EAAE;EAAM;EAAM;CAAO,IAAI;EAAC;EAAM;EAAM;CAAM,CAAC;CAC5E,MAAM,iBACJ,MAAM,mBAAmB,SAAS,WAAW,SAAS,SAAS,QAAQ,OAAO;CAEhF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,cAAc,UAAf;EAAwB,OAAO;YAC7B,i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BAAAA,OAAW,aAAZ;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoB,OAAO,aAAa,SAAS;EAC5D,aAAU;CACX,CAAA;AAEL,CACF;AAIA,MAAa,gBAAA,GAAA,MAAA,WAAA,CAA6D,SAAS,aACjF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,MAAM,EAAE,WAAW,iBAAiB;CACpC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,GAAI;EAAY;EAAK,WAAWC,WAAAA,GAAG,OAAO,QAAQ,SAAS;EAAG,aAAU;CAAiB,CAAA;AAElG,CAAC;AAID,MAAa,eAAA,GAAA,MAAA,WAAA,CAA8D,SAAS,YAClF,EAAE,cAAc,WAAW,UAAU,WAAW,GAAG,SACnD,KACA;CACA,MAAM,EAAE,WAAW,iBAAiB;CACpC,MAAM,kBAAkB,YAAY;CAEpC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACF,sBAAAA,OAAW,OAAZ;EACE,GAAI;EACJ,cAAY,cAAc,kBAAkB,KAAA,IAAY;EACnD;EACL,WAAWC,gBAAAA,oBAAoB,kBAAkB,OAAO,SAAS,OAAO,OAAO,SAAS;EACxF,aAAU;YAET,YAAY;CACG,CAAA;AAEtB,CAAC;AAED,MAAa,SAAS;CACpB,MAAM;CACN,SAAS;CACT,QAAQ;CACR,UAAU;CACV,UAAU;CACV,OAAO;CACP,SAAS;CACT,QAAQ;CACR,OAAO;CACP,aAAa;CACb,QAAQ;CACR,OAAO;CACP,cAAcD,sBAAAA,OAAW;AAC3B"}
|
|
1
|
+
{"version":3,"file":"drawer.cjs","names":["drawer","BaseDrawer","withRecipeClassName","useThemePortalProps","cx"],"sources":["../../../src/components/drawer/drawer.tsx"],"sourcesContent":["\"use client\";\n\nimport { Drawer as BaseDrawer } from \"@base-ui/react/drawer\";\nimport { createContext, forwardRef, useContext, useMemo } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { DrawerRoot as BaseDrawerRoot } from \"@base-ui/react/drawer\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { drawer } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type DrawerSide = \"bottom\" | \"left\" | \"right\" | \"top\";\nexport type DrawerSize = \"sm\" | \"md\" | \"lg\";\n\ninterface DrawerContextValue {\n side: DrawerSide;\n size: DrawerSize;\n styles: ReturnType<typeof drawer>;\n}\n\nconst DrawerContext = createContext<DrawerContextValue | null>(null);\n\nfunction useDrawerContext() {\n const context = useContext(DrawerContext);\n if (!context) {\n throw new Error(\"Drawer parts must be rendered inside Drawer.Root.\");\n }\n\n return context;\n}\n\nexport interface DrawerRootProps<Payload = unknown>\n extends Omit<BaseDrawerRoot.Props<Payload>, \"children\"> {\n /** Side from which the drawer enters. */\n side?: DrawerSide;\n /** Shared spacing scale for the drawer content. */\n size?: DrawerSize;\n children?: BaseDrawerRoot.Props<Payload>[\"children\"];\n}\n\nexport function DrawerRoot<Payload = unknown>({\n children,\n side = \"bottom\",\n size = \"md\",\n ...props\n}: DrawerRootProps<Payload>) {\n const styles = drawer({ size });\n const context = useMemo(() => ({ side, size, styles }), [side, size, styles]);\n const swipeDirection =\n props.swipeDirection ?? (side === \"bottom\" ? \"down\" : side === \"top\" ? \"up\" : side);\n\n return (\n <DrawerContext.Provider value={context}>\n <BaseDrawer.Root {...props} swipeDirection={swipeDirection}>\n {children}\n </BaseDrawer.Root>\n </DrawerContext.Provider>\n );\n}\n\nexport type DrawerTriggerProps = ComponentPropsWithoutRef<typeof BaseDrawer.Trigger>;\n\nexport const DrawerTrigger = forwardRef<HTMLButtonElement, DrawerTriggerProps>(\n function DrawerTrigger({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.trigger, className)}\n data-slot=\"drawer-trigger\"\n />\n );\n },\n);\n\nexport type DrawerPortalProps = ComponentPropsWithoutRef<typeof BaseDrawer.Portal>;\nexport function DrawerPortal(props: DrawerPortalProps) {\n return <BaseDrawer.Portal {...useThemePortalProps(props)} />;\n}\n\nexport type DrawerBackdropProps = ComponentPropsWithoutRef<typeof BaseDrawer.Backdrop>;\n\nexport const DrawerBackdrop = forwardRef<HTMLDivElement, DrawerBackdropProps>(\n function DrawerBackdrop({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Backdrop\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.backdrop, className)}\n data-slot=\"drawer-backdrop\"\n />\n );\n },\n);\n\nexport type DrawerViewportProps = ComponentPropsWithoutRef<typeof BaseDrawer.Viewport>;\n\nexport const DrawerViewport = forwardRef<HTMLDivElement, DrawerViewportProps>(\n function DrawerViewport({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Viewport\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.viewport, className)}\n data-slot=\"drawer-viewport\"\n />\n );\n },\n);\n\nexport interface DrawerPopupProps extends ComponentPropsWithoutRef<typeof BaseDrawer.Popup> {\n /** Overrides the side configured on `Drawer.Root`. */\n side?: DrawerSide;\n /** Overrides the size configured on `Drawer.Root`. */\n size?: DrawerSize;\n}\n\nexport const DrawerPopup = forwardRef<HTMLDivElement, DrawerPopupProps>(function DrawerPopup(\n { \"aria-label\": ariaLabel, className, side: popupSide, size: popupSize, ...props },\n ref,\n) {\n const { side: rootSide, size: rootSize, styles: rootStyles } = useDrawerContext();\n const side = popupSide ?? rootSide;\n const styles = popupSize && popupSize !== rootSize ? drawer({ size: popupSize }) : rootStyles;\n\n return (\n <BaseDrawer.Popup\n {...props}\n aria-label={ariaLabel ?? \"Drawer\"}\n data-jaci-component=\"drawer\"\n data-side={side}\n data-slot=\"drawer-popup\"\n ref={ref}\n className={withRecipeClassName(styles.popup, className)}\n />\n );\n});\n\nexport type DrawerContentProps = ComponentPropsWithoutRef<typeof BaseDrawer.Content>;\n\nexport const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>(function DrawerContent(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Content\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.content, className)}\n data-slot=\"drawer-content\"\n />\n );\n});\n\nexport type DrawerHeaderProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DrawerHeader = forwardRef<HTMLDivElement, DrawerHeaderProps>(function DrawerHeader(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <div {...props} ref={ref} className={cx(styles.header, className)} data-slot=\"drawer-header\" />\n );\n});\n\nexport type DrawerTitleProps = ComponentPropsWithoutRef<typeof BaseDrawer.Title>;\n\nexport const DrawerTitle = forwardRef<HTMLHeadingElement, DrawerTitleProps>(function DrawerTitle(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <BaseDrawer.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.title, className)}\n data-slot=\"drawer-title\"\n />\n );\n});\n\nexport type DrawerDescriptionProps = ComponentPropsWithoutRef<typeof BaseDrawer.Description>;\n\nexport const DrawerDescription = forwardRef<HTMLParagraphElement, DrawerDescriptionProps>(\n function DrawerDescription({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n return (\n <BaseDrawer.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.description, className)}\n data-slot=\"drawer-description\"\n />\n );\n },\n);\n\nexport type DrawerFooterProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DrawerFooter = forwardRef<HTMLDivElement, DrawerFooterProps>(function DrawerFooter(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <div {...props} ref={ref} className={cx(styles.footer, className)} data-slot=\"drawer-footer\" />\n );\n});\n\nexport type DrawerCloseProps = ComponentPropsWithoutRef<typeof BaseDrawer.Close>;\n\nexport const DrawerClose = forwardRef<HTMLButtonElement, DrawerCloseProps>(function DrawerClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n const hasVisibleLabel = children != null;\n\n return (\n <BaseDrawer.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Close drawer\")}\n ref={ref}\n className={withRecipeClassName(hasVisibleLabel ? styles.action : styles.close, className)}\n data-slot=\"drawer-close\"\n >\n {children ?? \"×\"}\n </BaseDrawer.Close>\n );\n});\n\nexport const Drawer = {\n Root: DrawerRoot,\n Trigger: DrawerTrigger,\n Portal: DrawerPortal,\n Backdrop: DrawerBackdrop,\n Viewport: DrawerViewport,\n Popup: DrawerPopup,\n Content: DrawerContent,\n Header: DrawerHeader,\n Title: DrawerTitle,\n Description: DrawerDescription,\n Footer: DrawerFooter,\n Close: DrawerClose,\n createHandle: BaseDrawer.createHandle,\n};\n"],"mappings":";;;;;;;;;AAqBA,MAAM,iBAAA,GAAA,MAAA,cAAA,CAAyD,IAAI;AAEnE,SAAS,mBAAmB;CAC1B,MAAM,WAAA,GAAA,MAAA,WAAA,CAAqB,aAAa;CACxC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,mDAAmD;CAGrE,OAAO;AACT;AAWA,SAAgB,WAA8B,EAC5C,UACA,OAAO,UACP,OAAO,MACP,GAAG,SACwB;CAC3B,MAAM,SAASA,eAAAA,OAAO,EAAE,KAAK,CAAC;CAC9B,MAAM,WAAA,GAAA,MAAA,QAAA,QAAyB;EAAE;EAAM;EAAM;CAAO,IAAI;EAAC;EAAM;EAAM;CAAM,CAAC;CAC5E,MAAM,iBACJ,MAAM,mBAAmB,SAAS,WAAW,SAAS,SAAS,QAAQ,OAAO;CAEhF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,cAAc,UAAf;EAAwB,OAAO;YAC7B,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,OAAW,MAAZ;GAAiB,GAAI;GAAuB;GACzC;EACc,CAAA;CACK,CAAA;AAE5B;AAIA,MAA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A,OAAW,aAAZ;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoB,OAAO,aAAa,SAAS;EAC5D,aAAU;CACX,CAAA;AAEL,CACF;AAIA,MAAa,gBAAA,GAAA,MAAA,WAAA,CAA6D,SAAS,aACjF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,MAAM,EAAE,WAAW,iBAAiB;CACpC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,GAAI;EAAY;EAAK,WAAWE,WAAAA,GAAG,OAAO,QAAQ,SAAS;EAAG,aAAU;CAAiB,CAAA;AAElG,CAAC;AAID,MAAa,eAAA,GAAA,MAAA,WAAA,CAA8D,SAAS,YAClF,EAAE,cAAc,WAAW,UAAU,WAAW,GAAG,SACnD,KACA;CACA,MAAM,EAAE,WAAW,iBAAiB;CACpC,MAAM,kBAAkB,YAAY;CAEpC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACH,sBAAAA,OAAW,OAAZ;EACE,GAAI;EACJ,cAAY,cAAc,kBAAkB,KAAA,IAAY;EACnD;EACL,WAAWC,gBAAAA,oBAAoB,kBAAkB,OAAO,SAAS,OAAO,OAAO,SAAS;EACxF,aAAU;YAET,YAAY;CACG,CAAA;AAEtB,CAAC;AAED,MAAa,SAAS;CACpB,MAAM;CACN,SAAS;CACT,QAAQ;CACR,UAAU;CACV,UAAU;CACV,OAAO;CACP,SAAS;CACT,QAAQ;CACR,OAAO;CACP,aAAa;CACb,QAAQ;CACR,OAAO;CACP,cAAcD,sBAAAA,OAAW;AAC3B"}
|
|
@@ -14,7 +14,7 @@ declare function DrawerRoot$1<Payload = unknown>({ children, side, size, ...prop
|
|
|
14
14
|
type DrawerTriggerProps = ComponentPropsWithoutRef<typeof Drawer.Trigger>;
|
|
15
15
|
declare const DrawerTrigger: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").DrawerTriggerProps<unknown> & import("react").RefAttributes<HTMLElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
16
16
|
type DrawerPortalProps = ComponentPropsWithoutRef<typeof Drawer.Portal>;
|
|
17
|
-
declare
|
|
17
|
+
declare function DrawerPortal(props: DrawerPortalProps): import("react").JSX.Element;
|
|
18
18
|
type DrawerBackdropProps = ComponentPropsWithoutRef<typeof Drawer.Backdrop>;
|
|
19
19
|
declare const DrawerBackdrop: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").DrawerBackdropProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
20
20
|
type DrawerViewportProps = ComponentPropsWithoutRef<typeof Drawer.Viewport>;
|
|
@@ -41,7 +41,7 @@ declare const DrawerClose: import("react").ForwardRefExoticComponent<Omit<import
|
|
|
41
41
|
declare const Drawer$1: {
|
|
42
42
|
Root: typeof DrawerRoot$1;
|
|
43
43
|
Trigger: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").DrawerTriggerProps<unknown> & import("react").RefAttributes<HTMLElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
44
|
-
Portal:
|
|
44
|
+
Portal: typeof DrawerPortal;
|
|
45
45
|
Backdrop: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").DrawerBackdropProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
46
46
|
Viewport: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").DrawerViewportProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
47
47
|
Popup: import("react").ForwardRefExoticComponent<DrawerPopupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -14,7 +14,7 @@ declare function DrawerRoot$1<Payload = unknown>({ children, side, size, ...prop
|
|
|
14
14
|
type DrawerTriggerProps = ComponentPropsWithoutRef<typeof Drawer.Trigger>;
|
|
15
15
|
declare const DrawerTrigger: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").DrawerTriggerProps<unknown> & import("react").RefAttributes<HTMLElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
16
16
|
type DrawerPortalProps = ComponentPropsWithoutRef<typeof Drawer.Portal>;
|
|
17
|
-
declare
|
|
17
|
+
declare function DrawerPortal(props: DrawerPortalProps): import("react").JSX.Element;
|
|
18
18
|
type DrawerBackdropProps = ComponentPropsWithoutRef<typeof Drawer.Backdrop>;
|
|
19
19
|
declare const DrawerBackdrop: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").DrawerBackdropProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
20
20
|
type DrawerViewportProps = ComponentPropsWithoutRef<typeof Drawer.Viewport>;
|
|
@@ -41,7 +41,7 @@ declare const DrawerClose: import("react").ForwardRefExoticComponent<Omit<import
|
|
|
41
41
|
declare const Drawer$1: {
|
|
42
42
|
Root: typeof DrawerRoot$1;
|
|
43
43
|
Trigger: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").DrawerTriggerProps<unknown> & import("react").RefAttributes<HTMLElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
44
|
-
Portal:
|
|
44
|
+
Portal: typeof DrawerPortal;
|
|
45
45
|
Backdrop: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").DrawerBackdropProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
46
46
|
Viewport: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").DrawerViewportProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
47
47
|
Popup: import("react").ForwardRefExoticComponent<DrawerPopupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { cx } from "../../styled-system/css/cx.js";
|
|
3
3
|
import { withRecipeClassName } from "../base-ui.js";
|
|
4
4
|
import { drawer } from "../../styled-system/recipes/drawer.js";
|
|
5
|
+
import { useThemePortalProps } from "../../theme/theme-scope.js";
|
|
5
6
|
import { createContext, forwardRef, useContext, useMemo } from "react";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
8
|
import { Drawer } from "@base-ui/react/drawer";
|
|
@@ -42,7 +43,9 @@ const DrawerTrigger = forwardRef(function DrawerTrigger({ className, ...props },
|
|
|
42
43
|
"data-slot": "drawer-trigger"
|
|
43
44
|
});
|
|
44
45
|
});
|
|
45
|
-
|
|
46
|
+
function DrawerPortal(props) {
|
|
47
|
+
return /* @__PURE__ */ jsx(Drawer.Portal, { ...useThemePortalProps(props) });
|
|
48
|
+
}
|
|
46
49
|
const DrawerBackdrop = forwardRef(function DrawerBackdrop({ className, ...props }, ref) {
|
|
47
50
|
const { styles } = useDrawerContext();
|
|
48
51
|
return /* @__PURE__ */ jsx(Drawer.Backdrop, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.js","names":["DrawerRoot","BaseDrawer","Drawer"],"sources":["../../../src/components/drawer/drawer.tsx"],"sourcesContent":["\"use client\";\n\nimport { Drawer as BaseDrawer } from \"@base-ui/react/drawer\";\nimport { createContext, forwardRef, useContext, useMemo } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { DrawerRoot as BaseDrawerRoot } from \"@base-ui/react/drawer\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { drawer } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\n\nexport type DrawerSide = \"bottom\" | \"left\" | \"right\" | \"top\";\nexport type DrawerSize = \"sm\" | \"md\" | \"lg\";\n\ninterface DrawerContextValue {\n side: DrawerSide;\n size: DrawerSize;\n styles: ReturnType<typeof drawer>;\n}\n\nconst DrawerContext = createContext<DrawerContextValue | null>(null);\n\nfunction useDrawerContext() {\n const context = useContext(DrawerContext);\n if (!context) {\n throw new Error(\"Drawer parts must be rendered inside Drawer.Root.\");\n }\n\n return context;\n}\n\nexport interface DrawerRootProps<Payload = unknown>\n extends Omit<BaseDrawerRoot.Props<Payload>, \"children\"> {\n /** Side from which the drawer enters. */\n side?: DrawerSide;\n /** Shared spacing scale for the drawer content. */\n size?: DrawerSize;\n children?: BaseDrawerRoot.Props<Payload>[\"children\"];\n}\n\nexport function DrawerRoot<Payload = unknown>({\n children,\n side = \"bottom\",\n size = \"md\",\n ...props\n}: DrawerRootProps<Payload>) {\n const styles = drawer({ size });\n const context = useMemo(() => ({ side, size, styles }), [side, size, styles]);\n const swipeDirection =\n props.swipeDirection ?? (side === \"bottom\" ? \"down\" : side === \"top\" ? \"up\" : side);\n\n return (\n <DrawerContext.Provider value={context}>\n <BaseDrawer.Root {...props} swipeDirection={swipeDirection}>\n {children}\n </BaseDrawer.Root>\n </DrawerContext.Provider>\n );\n}\n\nexport type DrawerTriggerProps = ComponentPropsWithoutRef<typeof BaseDrawer.Trigger>;\n\nexport const DrawerTrigger = forwardRef<HTMLButtonElement, DrawerTriggerProps>(\n function DrawerTrigger({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.trigger, className)}\n data-slot=\"drawer-trigger\"\n />\n );\n },\n);\n\nexport type DrawerPortalProps = ComponentPropsWithoutRef<typeof BaseDrawer.Portal>;\nexport const DrawerPortal: typeof BaseDrawer.Portal = BaseDrawer.Portal;\n\nexport type DrawerBackdropProps = ComponentPropsWithoutRef<typeof BaseDrawer.Backdrop>;\n\nexport const DrawerBackdrop = forwardRef<HTMLDivElement, DrawerBackdropProps>(\n function DrawerBackdrop({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Backdrop\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.backdrop, className)}\n data-slot=\"drawer-backdrop\"\n />\n );\n },\n);\n\nexport type DrawerViewportProps = ComponentPropsWithoutRef<typeof BaseDrawer.Viewport>;\n\nexport const DrawerViewport = forwardRef<HTMLDivElement, DrawerViewportProps>(\n function DrawerViewport({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Viewport\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.viewport, className)}\n data-slot=\"drawer-viewport\"\n />\n );\n },\n);\n\nexport interface DrawerPopupProps extends ComponentPropsWithoutRef<typeof BaseDrawer.Popup> {\n /** Overrides the side configured on `Drawer.Root`. */\n side?: DrawerSide;\n /** Overrides the size configured on `Drawer.Root`. */\n size?: DrawerSize;\n}\n\nexport const DrawerPopup = forwardRef<HTMLDivElement, DrawerPopupProps>(function DrawerPopup(\n { \"aria-label\": ariaLabel, className, side: popupSide, size: popupSize, ...props },\n ref,\n) {\n const { side: rootSide, size: rootSize, styles: rootStyles } = useDrawerContext();\n const side = popupSide ?? rootSide;\n const styles = popupSize && popupSize !== rootSize ? drawer({ size: popupSize }) : rootStyles;\n\n return (\n <BaseDrawer.Popup\n {...props}\n aria-label={ariaLabel ?? \"Drawer\"}\n data-jaci-component=\"drawer\"\n data-side={side}\n data-slot=\"drawer-popup\"\n ref={ref}\n className={withRecipeClassName(styles.popup, className)}\n />\n );\n});\n\nexport type DrawerContentProps = ComponentPropsWithoutRef<typeof BaseDrawer.Content>;\n\nexport const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>(function DrawerContent(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Content\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.content, className)}\n data-slot=\"drawer-content\"\n />\n );\n});\n\nexport type DrawerHeaderProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DrawerHeader = forwardRef<HTMLDivElement, DrawerHeaderProps>(function DrawerHeader(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <div {...props} ref={ref} className={cx(styles.header, className)} data-slot=\"drawer-header\" />\n );\n});\n\nexport type DrawerTitleProps = ComponentPropsWithoutRef<typeof BaseDrawer.Title>;\n\nexport const DrawerTitle = forwardRef<HTMLHeadingElement, DrawerTitleProps>(function DrawerTitle(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <BaseDrawer.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.title, className)}\n data-slot=\"drawer-title\"\n />\n );\n});\n\nexport type DrawerDescriptionProps = ComponentPropsWithoutRef<typeof BaseDrawer.Description>;\n\nexport const DrawerDescription = forwardRef<HTMLParagraphElement, DrawerDescriptionProps>(\n function DrawerDescription({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n return (\n <BaseDrawer.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.description, className)}\n data-slot=\"drawer-description\"\n />\n );\n },\n);\n\nexport type DrawerFooterProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DrawerFooter = forwardRef<HTMLDivElement, DrawerFooterProps>(function DrawerFooter(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <div {...props} ref={ref} className={cx(styles.footer, className)} data-slot=\"drawer-footer\" />\n );\n});\n\nexport type DrawerCloseProps = ComponentPropsWithoutRef<typeof BaseDrawer.Close>;\n\nexport const DrawerClose = forwardRef<HTMLButtonElement, DrawerCloseProps>(function DrawerClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n const hasVisibleLabel = children != null;\n\n return (\n <BaseDrawer.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Close drawer\")}\n ref={ref}\n className={withRecipeClassName(hasVisibleLabel ? styles.action : styles.close, className)}\n data-slot=\"drawer-close\"\n >\n {children ?? \"×\"}\n </BaseDrawer.Close>\n );\n});\n\nexport const Drawer = {\n Root: DrawerRoot,\n Trigger: DrawerTrigger,\n Portal: DrawerPortal,\n Backdrop: DrawerBackdrop,\n Viewport: DrawerViewport,\n Popup: DrawerPopup,\n Content: DrawerContent,\n Header: DrawerHeader,\n Title: DrawerTitle,\n Description: DrawerDescription,\n Footer: DrawerFooter,\n Close: DrawerClose,\n createHandle: BaseDrawer.createHandle,\n};\n"],"mappings":";;;;;;;;AAoBA,MAAM,gBAAgB,cAAyC,IAAI;AAEnE,SAAS,mBAAmB;CAC1B,MAAM,UAAU,WAAW,aAAa;CACxC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,mDAAmD;CAGrE,OAAO;AACT;AAWA,SAAgBA,aAA8B,EAC5C,UACA,OAAO,UACP,OAAO,MACP,GAAG,SACwB;CAC3B,MAAM,SAAS,OAAO,EAAE,KAAK,CAAC;CAC9B,MAAM,UAAU,eAAe;EAAE;EAAM;EAAM;CAAO,IAAI;EAAC;EAAM;EAAM;CAAM,CAAC;CAC5E,MAAM,iBACJ,MAAM,mBAAmB,SAAS,WAAW,SAAS,SAAS,QAAQ,OAAO;CAEhF,OACE,oBAAC,cAAc,UAAf;EAAwB,OAAO;YAC7B,oBAACC,OAAW,MAAZ;GAAiB,GAAI;GAAuB;GACzC;EACc,CAAA;CACK,CAAA;AAE5B;AAIA,MAAa,gBAAgB,WAC3B,SAAS,cAAc,EAAE,WAAW,GAAG,SAAS,KAAK;CACnD,MAAM,EAAE,WAAW,iBAAiB;CAEpC,OACE,oBAACA,OAAW,SAAZ;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,OAAO,SAAS,SAAS;EACxD,aAAU;CACX,CAAA;AAEL,CACF;AAGA,MAAa,eAAyCA,OAAW;AAIjE,MAAa,iBAAiB,WAC5B,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,MAAM,EAAE,WAAW,iBAAiB;CAEpC,OACE,oBAACA,OAAW,UAAZ;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,OAAO,UAAU,SAAS;EACzD,aAAU;CACX,CAAA;AAEL,CACF;AAIA,MAAa,iBAAiB,WAC5B,SAAS,eAAe,EAAE,WA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AAA;AAEL,CAAC;AAID,MAAa,oBAAoB,WAC/B,SAAS,kBAAkB,EAAE,WAAW,GAAG,SAAS,KAAK;CACvD,MAAM,EAAE,WAAW,iBAAiB;CACpC,OACE,oBAACA,OAAW,aAAZ;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,OAAO,aAAa,SAAS;EAC5D,aAAU;CACX,CAAA;AAEL,CACF;AAIA,MAAa,eAAe,WAA8C,SAAS,aACjF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,MAAM,EAAE,WAAW,iBAAiB;CACpC,OACE,oBAAC,OAAD;EAAK,GAAI;EAAY;EAAK,WAAW,GAAG,OAAO,QAAQ,SAAS;EAAG,aAAU;CAAiB,CAAA;AAElG,CAAC;AAID,MAAa,cAAc,WAAgD,SAAS,YAClF,EAAE,cAAc,WAAW,UAAU,WAAW,GAAG,SACnD,KACA;CACA,MAAM,EAAE,WAAW,iBAAiB;CACpC,MAAM,kBAAkB,YAAY;CAEpC,OACE,oBAACA,OAAW,OAAZ;EACE,GAAI;EACJ,cAAY,cAAc,kBAAkB,KAAA,IAAY;EACnD;EACL,WAAW,oBAAoB,kBAAkB,OAAO,SAAS,OAAO,OAAO,SAAS;EACxF,aAAU;YAET,YAAY;CACG,CAAA;AAEtB,CAAC;AAED,MAAaC,WAAS;CACpB,MAAMF;CACN,SAAS;CACT,QAAQ;CACR,UAAU;CACV,UAAU;CACV,OAAO;CACP,SAAS;CACT,QAAQ;CACR,OAAO;CACP,aAAa;CACb,QAAQ;CACR,OAAO;CACP,cAAcC,OAAW;AAC3B"}
|
|
1
|
+
{"version":3,"file":"drawer.js","names":["DrawerRoot","BaseDrawer","Drawer"],"sources":["../../../src/components/drawer/drawer.tsx"],"sourcesContent":["\"use client\";\n\nimport { Drawer as BaseDrawer } from \"@base-ui/react/drawer\";\nimport { createContext, forwardRef, useContext, useMemo } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { DrawerRoot as BaseDrawerRoot } from \"@base-ui/react/drawer\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { drawer } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type DrawerSide = \"bottom\" | \"left\" | \"right\" | \"top\";\nexport type DrawerSize = \"sm\" | \"md\" | \"lg\";\n\ninterface DrawerContextValue {\n side: DrawerSide;\n size: DrawerSize;\n styles: ReturnType<typeof drawer>;\n}\n\nconst DrawerContext = createContext<DrawerContextValue | null>(null);\n\nfunction useDrawerContext() {\n const context = useContext(DrawerContext);\n if (!context) {\n throw new Error(\"Drawer parts must be rendered inside Drawer.Root.\");\n }\n\n return context;\n}\n\nexport interface DrawerRootProps<Payload = unknown>\n extends Omit<BaseDrawerRoot.Props<Payload>, \"children\"> {\n /** Side from which the drawer enters. */\n side?: DrawerSide;\n /** Shared spacing scale for the drawer content. */\n size?: DrawerSize;\n children?: BaseDrawerRoot.Props<Payload>[\"children\"];\n}\n\nexport function DrawerRoot<Payload = unknown>({\n children,\n side = \"bottom\",\n size = \"md\",\n ...props\n}: DrawerRootProps<Payload>) {\n const styles = drawer({ size });\n const context = useMemo(() => ({ side, size, styles }), [side, size, styles]);\n const swipeDirection =\n props.swipeDirection ?? (side === \"bottom\" ? \"down\" : side === \"top\" ? \"up\" : side);\n\n return (\n <DrawerContext.Provider value={context}>\n <BaseDrawer.Root {...props} swipeDirection={swipeDirection}>\n {children}\n </BaseDrawer.Root>\n </DrawerContext.Provider>\n );\n}\n\nexport type DrawerTriggerProps = ComponentPropsWithoutRef<typeof BaseDrawer.Trigger>;\n\nexport const DrawerTrigger = forwardRef<HTMLButtonElement, DrawerTriggerProps>(\n function DrawerTrigger({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.trigger, className)}\n data-slot=\"drawer-trigger\"\n />\n );\n },\n);\n\nexport type DrawerPortalProps = ComponentPropsWithoutRef<typeof BaseDrawer.Portal>;\nexport function DrawerPortal(props: DrawerPortalProps) {\n return <BaseDrawer.Portal {...useThemePortalProps(props)} />;\n}\n\nexport type DrawerBackdropProps = ComponentPropsWithoutRef<typeof BaseDrawer.Backdrop>;\n\nexport const DrawerBackdrop = forwardRef<HTMLDivElement, DrawerBackdropProps>(\n function DrawerBackdrop({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Backdrop\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.backdrop, className)}\n data-slot=\"drawer-backdrop\"\n />\n );\n },\n);\n\nexport type DrawerViewportProps = ComponentPropsWithoutRef<typeof BaseDrawer.Viewport>;\n\nexport const DrawerViewport = forwardRef<HTMLDivElement, DrawerViewportProps>(\n function DrawerViewport({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Viewport\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.viewport, className)}\n data-slot=\"drawer-viewport\"\n />\n );\n },\n);\n\nexport interface DrawerPopupProps extends ComponentPropsWithoutRef<typeof BaseDrawer.Popup> {\n /** Overrides the side configured on `Drawer.Root`. */\n side?: DrawerSide;\n /** Overrides the size configured on `Drawer.Root`. */\n size?: DrawerSize;\n}\n\nexport const DrawerPopup = forwardRef<HTMLDivElement, DrawerPopupProps>(function DrawerPopup(\n { \"aria-label\": ariaLabel, className, side: popupSide, size: popupSize, ...props },\n ref,\n) {\n const { side: rootSide, size: rootSize, styles: rootStyles } = useDrawerContext();\n const side = popupSide ?? rootSide;\n const styles = popupSize && popupSize !== rootSize ? drawer({ size: popupSize }) : rootStyles;\n\n return (\n <BaseDrawer.Popup\n {...props}\n aria-label={ariaLabel ?? \"Drawer\"}\n data-jaci-component=\"drawer\"\n data-side={side}\n data-slot=\"drawer-popup\"\n ref={ref}\n className={withRecipeClassName(styles.popup, className)}\n />\n );\n});\n\nexport type DrawerContentProps = ComponentPropsWithoutRef<typeof BaseDrawer.Content>;\n\nexport const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>(function DrawerContent(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Content\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.content, className)}\n data-slot=\"drawer-content\"\n />\n );\n});\n\nexport type DrawerHeaderProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DrawerHeader = forwardRef<HTMLDivElement, DrawerHeaderProps>(function DrawerHeader(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <div {...props} ref={ref} className={cx(styles.header, className)} data-slot=\"drawer-header\" />\n );\n});\n\nexport type DrawerTitleProps = ComponentPropsWithoutRef<typeof BaseDrawer.Title>;\n\nexport const DrawerTitle = forwardRef<HTMLHeadingElement, DrawerTitleProps>(function DrawerTitle(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <BaseDrawer.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.title, className)}\n data-slot=\"drawer-title\"\n />\n );\n});\n\nexport type DrawerDescriptionProps = ComponentPropsWithoutRef<typeof BaseDrawer.Description>;\n\nexport const DrawerDescription = forwardRef<HTMLParagraphElement, DrawerDescriptionProps>(\n function DrawerDescription({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n return (\n <BaseDrawer.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.description, className)}\n data-slot=\"drawer-description\"\n />\n );\n },\n);\n\nexport type DrawerFooterProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DrawerFooter = forwardRef<HTMLDivElement, DrawerFooterProps>(function DrawerFooter(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <div {...props} ref={ref} className={cx(styles.footer, className)} data-slot=\"drawer-footer\" />\n );\n});\n\nexport type DrawerCloseProps = ComponentPropsWithoutRef<typeof BaseDrawer.Close>;\n\nexport const DrawerClose = forwardRef<HTMLButtonElement, DrawerCloseProps>(function DrawerClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n const hasVisibleLabel = children != null;\n\n return (\n <BaseDrawer.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Close drawer\")}\n ref={ref}\n className={withRecipeClassName(hasVisibleLabel ? styles.action : styles.close, className)}\n data-slot=\"drawer-close\"\n >\n {children ?? \"×\"}\n </BaseDrawer.Close>\n );\n});\n\nexport const Drawer = {\n Root: DrawerRoot,\n Trigger: DrawerTrigger,\n Portal: DrawerPortal,\n Backdrop: DrawerBackdrop,\n Viewport: DrawerViewport,\n Popup: DrawerPopup,\n Content: DrawerContent,\n Header: DrawerHeader,\n Title: DrawerTitle,\n Description: DrawerDescription,\n Footer: DrawerFooter,\n Close: DrawerClose,\n createHandle: BaseDrawer.createHandle,\n};\n"],"mappings":";;;;;;;;;AAqBA,MAAM,gBAAgB,cAAyC,IAAI;AAEnE,SAAS,mBAAmB;CAC1B,MAAM,UAAU,WAAW,aAAa;CACxC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,mDAAmD;CAGrE,OAAO;AACT;AAWA,SAAgBA,aAA8B,EAC5C,UACA,OAAO,UACP,OAAO,MACP,GAAG,SACwB;CAC3B,MAAM,SAAS,OAAO,EAAE,KAAK,CAAC;CAC9B,MAAM,UAAU,eAAe;EAAE;EAAM;EAAM;CAAO,IAAI;EAAC;EAAM;EAAM;CAAM,CAAC;CAC5E,MAAM,iBACJ,MAAM,mBAAmB,SAAS,WAAW,SAAS,SAAS,QAAQ,OAAO;CAEhF,OACE,oBAAC,cAAc,UAAf;EAAwB,OAAO;YAC7B,oBAACC,OAAW,MAAZ;GAAiB,GAAI;GAAuB;GACzC;EACc,CAAA;CACK,CAAA;AAE5B;AAIA,MAAa,gBAAgB,WAC3B,SAAS,cAAc,EAAE,WAAW,GAAG,SAAS,KAAK;CACnD,MAAM,EAAE,WAAW,iBAAiB;CAEpC,OACE,oBAACA,OAAW,SAAZ;EACE,GAAI;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