@nocoo/basalt 2.0.3 → 2.1.2
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/README.md +134 -15
- package/ai/COMPATIBILITY.md +180 -0
- package/ai/INTEGRATION.md +1760 -0
- package/ai/RECIPES.md +161 -0
- package/ai/USAGE.md +99 -0
- package/ai/registry.json +38099 -0
- package/ai/sources.json +10 -0
- package/dist/assets/brand-mark.d.ts +1 -0
- package/dist/assets/brand-mark.js +7 -0
- package/dist/assets/brand-mark.js.map +1 -0
- package/dist/charts/area.d.ts +58 -5
- package/dist/charts/area.js +20 -12
- package/dist/charts/area.js.map +1 -1
- package/dist/charts/bar.d.ts +54 -5
- package/dist/charts/bar.js +16 -10
- package/dist/charts/bar.js.map +1 -1
- package/dist/charts/bullet.d.ts +18 -1
- package/dist/charts/bullet.js +6 -3
- package/dist/charts/bullet.js.map +1 -1
- package/dist/charts/charts.d.ts +58 -5
- package/dist/charts/charts.js +13 -2
- package/dist/charts/charts.js.map +1 -1
- package/dist/charts/config.d.ts +7 -0
- package/dist/charts/config.js +5 -1
- package/dist/charts/config.js.map +1 -1
- package/dist/charts/custom-chart.d.ts +58 -5
- package/dist/charts/custom-chart.js +13 -2
- package/dist/charts/custom-chart.js.map +1 -1
- package/dist/charts/donut.d.ts +18 -1
- package/dist/charts/donut.js +6 -3
- package/dist/charts/donut.js.map +1 -1
- package/dist/charts/frame.d.ts +40 -3
- package/dist/charts/frame.js +55 -28
- package/dist/charts/frame.js.map +1 -1
- package/dist/charts/funnel.d.ts +18 -1
- package/dist/charts/funnel.js +5 -1
- package/dist/charts/funnel.js.map +1 -1
- package/dist/charts/gauge.d.ts +18 -1
- package/dist/charts/gauge.js +38 -20
- package/dist/charts/gauge.js.map +1 -1
- package/dist/charts/grouped-bar.d.ts +54 -5
- package/dist/charts/grouped-bar.js +16 -10
- package/dist/charts/grouped-bar.js.map +1 -1
- package/dist/charts/heatmap-calendar.d.ts +61 -0
- package/dist/charts/heatmap-calendar.js +287 -96
- package/dist/charts/heatmap-calendar.js.map +1 -1
- package/dist/charts/heatmap-matrix.d.ts +99 -0
- package/dist/charts/heatmap-matrix.js +249 -0
- package/dist/charts/heatmap-matrix.js.map +1 -0
- package/dist/charts/line.d.ts +66 -5
- package/dist/charts/line.js +37 -30
- package/dist/charts/line.js.map +1 -1
- package/dist/charts/palette.d.ts +1 -0
- package/dist/charts/palette.js +7 -1
- package/dist/charts/palette.js.map +1 -1
- package/dist/charts/radar.d.ts +18 -1
- package/dist/charts/radar.js +26 -19
- package/dist/charts/radar.js.map +1 -1
- package/dist/charts/sankey.d.ts +18 -1
- package/dist/charts/sankey.js +4 -1
- package/dist/charts/sankey.js.map +1 -1
- package/dist/charts/series.d.ts +5 -7
- package/dist/charts/series.js.map +1 -1
- package/dist/charts/slot-bar.d.ts +38 -6
- package/dist/charts/slot-bar.js +5 -2
- package/dist/charts/slot-bar.js.map +1 -1
- package/dist/charts/sparkline.d.ts +35 -5
- package/dist/charts/sparkline.js +22 -18
- package/dist/charts/sparkline.js.map +1 -1
- package/dist/charts/stacked-bar.d.ts +58 -5
- package/dist/charts/stacked-bar.js +19 -12
- package/dist/charts/stacked-bar.js.map +1 -1
- package/dist/charts/stat-card.d.ts +51 -1
- package/dist/charts/stat-card.js +66 -39
- package/dist/charts/stat-card.js.map +1 -1
- package/dist/charts/timeline.d.ts +3 -0
- package/dist/charts/timeline.js +4 -3
- package/dist/charts/timeline.js.map +1 -1
- package/dist/charts/timeseries.d.ts +58 -5
- package/dist/charts/timeseries.js +13 -2
- package/dist/charts/timeseries.js.map +1 -1
- package/dist/charts/tooltip.d.ts +57 -0
- package/dist/charts/tooltip.js +119 -2
- package/dist/charts/tooltip.js.map +1 -1
- package/dist/components/accordion.d.ts +117 -2
- package/dist/components/accordion.js +20 -13
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/alert-dialog.d.ts +131 -13
- package/dist/components/alert-dialog.js +12 -9
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/app-header.js +18 -17
- package/dist/components/app-header.js.map +1 -1
- package/dist/components/app-shell.js +15 -14
- package/dist/components/app-shell.js.map +1 -1
- package/dist/components/autocomplete.d.ts +4 -0
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.d.ts +76 -3
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.d.ts +15 -1
- package/dist/components/badge.js +13 -12
- package/dist/components/badge.js.map +1 -1
- package/dist/components/banner.d.ts +88 -2
- package/dist/components/banner.js +41 -40
- package/dist/components/banner.js.map +1 -1
- package/dist/components/basalt-mark.js +14 -8
- package/dist/components/basalt-mark.js.map +1 -1
- package/dist/components/battery-meter.d.ts +10 -0
- package/dist/components/battery-meter.js +56 -0
- package/dist/components/battery-meter.js.map +1 -0
- package/dist/components/breadcrumbs.d.ts +27 -7
- package/dist/components/breadcrumbs.js +21 -20
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/button.d.ts +48 -2
- package/dist/components/button.js +87 -36
- package/dist/components/button.js.map +1 -1
- package/dist/components/chat-bubble.d.ts +7 -0
- package/dist/components/chat-bubble.js +14 -13
- package/dist/components/chat-bubble.js.map +1 -1
- package/dist/components/chat-composer.d.ts +7 -3
- package/dist/components/chat-composer.js.map +1 -1
- package/dist/components/chat-header.d.ts +6 -1
- package/dist/components/chat-header.js +17 -16
- package/dist/components/chat-header.js.map +1 -1
- package/dist/components/chat-inbox.d.ts +7 -2
- package/dist/components/chat-inbox.js.map +1 -1
- package/dist/components/checkbox.js +84 -53
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/clipboard-text.d.ts +13 -2
- package/dist/components/clipboard-text.js +4 -4
- package/dist/components/clipboard-text.js.map +1 -1
- package/dist/components/collapsible.d.ts +58 -15
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/command-palette.d.ts +151 -61
- package/dist/components/command-palette.js.map +1 -1
- package/dist/components/confirm-dialog.d.ts +1 -1
- package/dist/components/confirm-dialog.js +6 -4
- package/dist/components/confirm-dialog.js.map +1 -1
- package/dist/components/context-menu.d.ts +210 -2
- package/dist/components/context-menu.js +7 -4
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/data-table.d.ts +40 -2
- package/dist/components/data-table.js +168 -120
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.d.ts +53 -2
- package/dist/components/date-picker.js +387 -219
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/delete-resource.d.ts +7 -1
- package/dist/components/delete-resource.js +22 -18
- package/dist/components/delete-resource.js.map +1 -1
- package/dist/components/description-list.js +16 -15
- package/dist/components/description-list.js.map +1 -1
- package/dist/components/dialog.d.ts +141 -12
- package/dist/components/dialog.js +42 -38
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dock.d.ts +1 -1
- package/dist/components/dock.js +39 -58
- package/dist/components/dock.js.map +1 -1
- package/dist/components/dropdown-menu.d.ts +229 -15
- package/dist/components/dropdown-menu.js +9 -6
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/editable-nav-item.d.ts +33 -0
- package/dist/components/editable-nav-item.js +90 -0
- package/dist/components/editable-nav-item.js.map +1 -0
- package/dist/components/empty.d.ts +22 -2
- package/dist/components/empty.js +22 -13
- package/dist/components/empty.js.map +1 -1
- package/dist/components/field.js +31 -30
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-dropzone.d.ts +37 -0
- package/dist/components/file-dropzone.js +103 -0
- package/dist/components/file-dropzone.js.map +1 -0
- package/dist/components/filter-bar.d.ts +34 -0
- package/dist/components/filter-bar.js +52 -0
- package/dist/components/filter-bar.js.map +1 -0
- package/dist/components/flow.js +19 -18
- package/dist/components/flow.js.map +1 -1
- package/dist/components/grid.d.ts +3 -1
- package/dist/components/grid.js.map +1 -1
- package/dist/components/hover-card.d.ts +111 -1
- package/dist/components/hover-card.js +9 -6
- package/dist/components/hover-card.js.map +1 -1
- package/dist/components/icon-picker.d.ts +34 -0
- package/dist/components/icon-picker.js +77 -0
- package/dist/components/icon-picker.js.map +1 -0
- package/dist/components/inline-editable.d.ts +46 -0
- package/dist/components/inline-editable.js +124 -0
- package/dist/components/inline-editable.js.map +1 -0
- package/dist/components/input-area.js +3 -3
- package/dist/components/input-group.js +7 -7
- package/dist/components/input.js +3 -3
- package/dist/components/label.js +18 -17
- package/dist/components/label.js.map +1 -1
- package/dist/components/layer-card.d.ts +10 -2
- package/dist/components/layer-card.js +71 -68
- package/dist/components/layer-card.js.map +1 -1
- package/dist/components/loader.d.ts +10 -2
- package/dist/components/loader.js.map +1 -1
- package/dist/components/menu-bar.d.ts +174 -6
- package/dist/components/menu-bar.js +33 -29
- package/dist/components/menu-bar.js.map +1 -1
- package/dist/components/meter.d.ts +27 -2
- package/dist/components/meter.js.map +1 -1
- package/dist/components/multi-select.d.ts +64 -0
- package/dist/components/multi-select.js +218 -0
- package/dist/components/multi-select.js.map +1 -0
- package/dist/components/navigation-menu.d.ts +88 -5
- package/dist/components/navigation-menu.js.map +1 -1
- package/dist/components/overlay.js +6 -5
- package/dist/components/overlay.js.map +1 -1
- package/dist/components/page-header.js +23 -21
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/pagination.js +7 -7
- package/dist/components/popover.d.ts +136 -16
- package/dist/components/popover.js +32 -28
- package/dist/components/popover.js.map +1 -1
- package/dist/components/radio.js +38 -37
- package/dist/components/radio.js.map +1 -1
- package/dist/components/resource-list.d.ts +26 -1
- package/dist/components/resource-list.js +28 -15
- package/dist/components/resource-list.js.map +1 -1
- package/dist/components/responsive-master-detail.d.ts +27 -0
- package/dist/components/responsive-master-detail.js +85 -0
- package/dist/components/responsive-master-detail.js.map +1 -0
- package/dist/components/section-rule.js +23 -22
- package/dist/components/section-rule.js.map +1 -1
- package/dist/components/select.d.ts +27 -3
- package/dist/components/select.js +11 -11
- package/dist/components/select.js.map +1 -1
- package/dist/components/sheet.d.ts +115 -11
- package/dist/components/sheet.js +37 -30
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/sidebar.d.ts +109 -17
- package/dist/components/sidebar.js +112 -111
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/skeleton-line.d.ts +22 -2
- package/dist/components/skeleton-line.js.map +1 -1
- package/dist/components/slider.d.ts +61 -1
- package/dist/components/slider.js +31 -15
- package/dist/components/slider.js.map +1 -1
- package/dist/components/stat-strip.js +16 -15
- package/dist/components/stat-strip.js.map +1 -1
- package/dist/components/switch.js +78 -47
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table-of-contents.js +18 -17
- package/dist/components/table-of-contents.js.map +1 -1
- package/dist/components/table-pager.js +20 -19
- package/dist/components/table-pager.js.map +1 -1
- package/dist/components/table.d.ts +9 -3
- package/dist/components/table.js +19 -18
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.js +29 -22
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tag-badge.d.ts +58 -0
- package/dist/components/tag-badge.js +72 -0
- package/dist/components/tag-badge.js.map +1 -0
- package/dist/components/tag-color-picker.d.ts +20 -0
- package/dist/components/tag-color-picker.js +42 -0
- package/dist/components/tag-color-picker.js.map +1 -0
- package/dist/components/text.js +17 -16
- package/dist/components/text.js.map +1 -1
- package/dist/components/toast.d.ts +173 -3
- package/dist/components/toast.js +1 -1
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.d.ts +88 -2
- package/dist/components/toggle-group.js +32 -31
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle.d.ts +35 -2
- package/dist/components/toggle.js +12 -11
- package/dist/components/toggle.js.map +1 -1
- package/dist/components/tooltip.d.ts +144 -6
- package/dist/components/tooltip.js +9 -6
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/typeahead-field.js +193 -132
- package/dist/components/typeahead-field.js.map +1 -1
- package/dist/components/upload-queue.d.ts +51 -0
- package/dist/components/upload-queue.js +116 -0
- package/dist/components/upload-queue.js.map +1 -0
- package/dist/providers/accent.d.ts +46 -2
- package/dist/providers/accent.js +358 -172
- package/dist/providers/accent.js.map +1 -1
- package/dist/providers/link.d.ts +14 -4
- package/dist/providers/link.js.map +1 -1
- package/dist/providers/theme.d.ts +38 -2
- package/dist/providers/theme.js +160 -27
- package/dist/providers/theme.js.map +1 -1
- package/dist/styles/base.css +83 -0
- package/dist/styles/standalone.css +699 -120
- package/dist/styles/tailwind.css +21 -7
- package/dist/styles/tokens.css +145 -91
- package/dist/utils/control-surface.d.ts +2 -1
- package/dist/utils/control-surface.js +4 -4
- package/dist/utils/control-surface.js.map +1 -1
- package/dist/utils/selection-indicator.js +2 -2
- package/dist/utils/selection-indicator.js.map +1 -1
- package/package.json +8 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.js","names":[],"sources":["../../src/components/date-picker.tsx"],"sourcesContent":["import { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport { type ComponentProps, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { Button } from \"./button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\n\ntype Civil = { y: number; m: number; d: number };\n\nfunction pad(value: number) {\n\treturn String(value).padStart(2, \"0\");\n}\n\nfunction formatIso(date: Civil) {\n\treturn `${String(date.y).padStart(4, \"0\")}-${pad(date.m)}-${pad(date.d)}`;\n}\n\nfunction utcDate(date: Civil) {\n\tconst next = new Date(Date.UTC(date.y, date.m - 1, date.d));\n\tnext.setUTCFullYear(date.y);\n\treturn next;\n}\n\nfunction civilDate(date: Civil) {\n\tconst next = new Date(date.y, date.m - 1, date.d);\n\tnext.setFullYear(date.y);\n\treturn next;\n}\n\nfunction parseIso(value: string): Civil | null {\n\tconst match = /^(\\d{4,})-(\\d{2})-(\\d{2})$/.exec(value);\n\tif (!match) {\n\t\treturn null;\n\t}\n\tconst year = Number(match[1]);\n\tconst month = Number(match[2]);\n\tconst day = Number(match[3]);\n\tif (year < 1) {\n\t\treturn null;\n\t}\n\tconst utc = utcDate({ y: year, m: month, d: day });\n\tif (\n\t\tutc.getUTCFullYear() !== year ||\n\t\tutc.getUTCMonth() + 1 !== month ||\n\t\tutc.getUTCDate() !== day\n\t) {\n\t\treturn null;\n\t}\n\treturn { y: year, m: month, d: day };\n}\n\nconst CALENDAR_BUTTON =\n\t\"appearance-none border-0 bg-transparent p-0 font-inherit text-inherit cursor-pointer\";\n\nfunction todayCivil(timeZone?: string): Civil {\n\tconst parts = new Intl.DateTimeFormat(\"en-CA\", {\n\t\ttimeZone,\n\t\tyear: \"numeric\",\n\t\tmonth: \"2-digit\",\n\t\tday: \"2-digit\",\n\t}).formatToParts(new Date());\n\tconst read = (type: Intl.DateTimeFormatPartTypes) =>\n\t\tNumber(parts.find((part) => part.type === type)?.value);\n\treturn { y: read(\"year\"), m: read(\"month\"), d: read(\"day\") };\n}\n\nfunction formatCivil(date: Civil, locale: string, options: Intl.DateTimeFormatOptions) {\n\treturn new Intl.DateTimeFormat(locale, {\n\t\t...options,\n\t\ttimeZone: \"UTC\",\n\t\tcalendar: \"gregory\",\n\t}).format(utcDate(date));\n}\n\nfunction formatTriggerLabel({\n\tmode,\n\tselectedDate,\n\trangeFrom,\n\trangeTo,\n\tlocale,\n\tformatDate,\n}: {\n\tmode: \"single\" | \"range\";\n\tselectedDate: Civil | null;\n\trangeFrom: string;\n\trangeTo?: string;\n\tlocale: string;\n\tformatDate?: (date: Date) => string;\n}) {\n\tfunction one(iso: string) {\n\t\tconst date = parseIso(iso);\n\t\tif (!date) {\n\t\t\treturn iso;\n\t\t}\n\t\treturn formatDate?.(civilDate(date)) ?? formatCivil(date, locale, { dateStyle: \"medium\" });\n\t}\n\tif (mode === \"range\") {\n\t\tif (!rangeFrom) {\n\t\t\treturn \"Pick a date\";\n\t\t}\n\t\tif (!rangeTo) {\n\t\t\treturn `${one(rangeFrom)} – …`;\n\t\t}\n\t\treturn `${one(rangeFrom)} – ${one(rangeTo)}`;\n\t}\n\treturn selectedDate\n\t\t? (formatDate?.(civilDate(selectedDate)) ??\n\t\t\t\tformatCivil(selectedDate, locale, { dateStyle: \"medium\" }))\n\t\t: \"Pick a date\";\n}\n\nfunction compareCivil(left: Civil, right: Civil) {\n\tif (left.y !== right.y) {\n\t\treturn left.y - right.y;\n\t}\n\tif (left.m !== right.m) {\n\t\treturn left.m - right.m;\n\t}\n\treturn left.d - right.d;\n}\n\nfunction withinBounds(iso: string, min?: string, max?: string) {\n\tconst date = parseIso(iso);\n\tconst minDate = min ? parseIso(min) : null;\n\tconst maxDate = max ? parseIso(max) : null;\n\tif (!date) {\n\t\treturn false;\n\t}\n\tif (minDate && compareCivil(date, minDate) < 0) {\n\t\treturn false;\n\t}\n\tif (maxDate && compareCivil(date, maxDate) > 0) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\nfunction dateSelectable(\n\tiso: string,\n\tmin?: string,\n\tmax?: string,\n\tisDisabledDate?: (iso: string) => boolean,\n) {\n\treturn withinBounds(iso, min, max) && !isDisabledDate?.(iso);\n}\n\nexport type DatePickerRange = { from: string; to?: string };\n\nexport type DatePickerPreset = {\n\tlabel: string;\n\tvalue: string | { from: string; to: string };\n};\n\nexport type DatePickerProps = Omit<\n\tComponentProps<\"input\">,\n\t| \"value\"\n\t| \"defaultValue\"\n\t| \"onChange\"\n\t| \"type\"\n\t| \"children\"\n\t| \"disabled\"\n\t| \"name\"\n\t| \"required\"\n\t| \"min\"\n\t| \"max\"\n> & {\n\t/**\n\t * The controlled ISO date in single mode.\n\t */\n\tvalue?: string;\n\t/**\n\t * The uncontrolled initial ISO date in single mode.\n\t */\n\tdefaultValue?: string;\n\t/**\n\t * Called with the ISO date in single mode.\n\t */\n\tonChange?: (value: string) => void;\n\t/**\n\t * Selection mode.\n\t * @default single\n\t */\n\tmode?: \"single\" | \"range\";\n\t/**\n\t * The controlled range in range mode.\n\t */\n\trangeValue?: DatePickerRange;\n\t/**\n\t * The uncontrolled initial range in range mode.\n\t */\n\tdefaultRangeValue?: DatePickerRange;\n\t/**\n\t * Called when the range changes.\n\t */\n\tonRangeChange?: (value: DatePickerRange) => void;\n\t/**\n\t * Additional dates that cannot be selected.\n\t */\n\tisDisabledDate?: (iso: string) => boolean;\n\t/**\n\t * Shortcut values shown above the calendar.\n\t */\n\tpresets?: DatePickerPreset[];\n\t/**\n\t * Locale used to format the trigger and weekday labels.\n\t * @default en-US\n\t */\n\tlocale?: string;\n\t/**\n\t * First day of the week. 0 is Sunday.\n\t * @default 0\n\t */\n\tweekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\t/**\n\t * IANA time zone used to resolve today.\n\t */\n\ttimeZone?: string;\n\t/**\n\t * Custom formatter for the trigger label.\n\t */\n\tformatDate?: (date: Date) => string;\n\t/**\n\t * Native form field name.\n\t */\n\tname?: string;\n\t/**\n\t * Native required constraint.\n\t */\n\trequired?: boolean;\n\t/**\n\t * Inclusive lower ISO bound.\n\t */\n\tmin?: string;\n\t/**\n\t * Inclusive upper ISO bound.\n\t */\n\tmax?: string;\n\t/**\n\t * Disable the trigger and calendar.\n\t */\n\tdisabled?: boolean;\n};\n\nfunction clampCivil(date: Civil, min?: string, max?: string) {\n\tconst minDate = min ? parseIso(min) : null;\n\tconst maxDate = max ? parseIso(max) : null;\n\tif (minDate && compareCivil(date, minDate) < 0) {\n\t\treturn minDate;\n\t}\n\tif (maxDate && compareCivil(date, maxDate) > 0) {\n\t\treturn maxDate;\n\t}\n\treturn date;\n}\n\nfunction isValidCivil(date: Civil): boolean {\n\tif (!Number.isFinite(date.y) || date.m < 1 || date.m > 12 || date.d < 1 || date.d > 31) {\n\t\treturn false;\n\t}\n\tconst utc = utcDate(date);\n\treturn (\n\t\t!Number.isNaN(utc.getTime()) &&\n\t\tutc.getUTCFullYear() === date.y &&\n\t\tutc.getUTCMonth() + 1 === date.m &&\n\t\tutc.getUTCDate() === date.d\n\t);\n}\n\nfunction isoOf(date: Civil | null) {\n\treturn date ? formatIso(date) : \"\";\n}\n\nfunction addDays(date: Civil, days: number): Civil | null {\n\tconst next = utcDate(date);\n\tif (Number.isNaN(next.getTime())) {\n\t\treturn null;\n\t}\n\tnext.setUTCDate(next.getUTCDate() + days);\n\tif (Number.isNaN(next.getTime())) {\n\t\treturn null;\n\t}\n\tconst civil = { y: next.getUTCFullYear(), m: next.getUTCMonth() + 1, d: next.getUTCDate() };\n\treturn isValidCivil(civil) ? civil : null;\n}\n\nfunction shiftMonth(month: Civil, delta: number): Civil | null {\n\tconst total = month.y * 12 + (month.m - 1) + delta;\n\tconst next = { y: Math.floor(total / 12), m: (total % 12) + 1, d: 1 };\n\treturn isValidCivil(next) ? next : null;\n}\n\nexport function DatePicker({\n\tvalue,\n\tdefaultValue = \"\",\n\tonChange,\n\tmode = \"single\",\n\trangeValue,\n\tdefaultRangeValue,\n\tonRangeChange,\n\tisDisabledDate,\n\tpresets,\n\tlocale = \"en-US\",\n\tweekStartsOn = 0,\n\ttimeZone,\n\tformatDate,\n\tname,\n\trequired,\n\tmin,\n\tmax,\n\tdisabled,\n\tclassName,\n\tid,\n\t\"aria-label\": ariaLabel,\n\t\"aria-describedby\": ariaDescribedBy,\n\t\"aria-invalid\": ariaInvalid,\n\t...inputRest\n}: DatePickerProps) {\n\tconst {\n\t\treadOnly,\n\t\tautoFocus,\n\t\tonFocus,\n\t\tonBlur,\n\t\t\"aria-labelledby\": ariaLabelledBy,\n\t\t...formRest\n\t} = inputRest;\n\tconst [uncontrolled, setUncontrolled] = useState(defaultValue);\n\tconst [uncontrolledRange, setUncontrolledRange] = useState<DatePickerRange>(\n\t\tdefaultRangeValue ?? { from: \"\", to: undefined },\n\t);\n\tconst [open, setOpen] = useState(false);\n\tconst [focusIndex, setFocusIndex] = useState(0);\n\tconst dayRefs = useRef<Array<HTMLButtonElement | null>>([]);\n\tconst pendingFocusIso = useRef<string | null>(null);\n\tconst focusDay = useRef(false);\n\tconst hiddenRef = useRef<HTMLInputElement>(null);\n\tconst triggerRef = useRef<HTMLButtonElement>(null);\n\tconst selected = value ?? uncontrolled;\n\tconst selectedRange = rangeValue ?? uncontrolledRange;\n\tconst selectedDate = parseIso(\n\t\tmode === \"range\" ? selectedRange.to || selectedRange.from || \"\" : selected,\n\t);\n\tconst cursorIso = selectedDate ? formatIso(selectedDate) : \"\";\n\tconst submitted = mode === \"range\" ? \"\" : cursorIso;\n\tconst cursor = selectedDate ?? todayCivil(timeZone);\n\tconst [month, setMonth] = useState<Civil>({ y: cursor.y, m: cursor.m, d: 1 });\n\tconst prevSelected = useRef(cursorIso);\n\tif (open && prevSelected.current !== cursorIso) {\n\t\tfocusDay.current = true;\n\t\tconst next = selectedDate ?? todayCivil(timeZone);\n\t\tif (month.y !== next.y || month.m !== next.m) {\n\t\t\tsetMonth({ y: next.y, m: next.m, d: 1 });\n\t\t}\n\t}\n\tprevSelected.current = cursorIso;\n\n\tuseEffect(() => {\n\t\tif (!open) {\n\t\t\treturn;\n\t\t}\n\t\tconst next = clampCivil(\n\t\t\t(cursorIso ? parseIso(cursorIso) : null) ?? todayCivil(timeZone),\n\t\t\tmin,\n\t\t\tmax,\n\t\t);\n\t\tsetMonth({ y: next.y, m: next.m, d: 1 });\n\t\tif (!cursorIso) {\n\t\t\tfocusDay.current = true;\n\t\t}\n\t}, [open, cursorIso, timeZone, min, max]);\n\n\tuseEffect(() => {\n\t\tif (disabled) {\n\t\t\tsetOpen(false);\n\t\t}\n\t}, [disabled]);\n\n\tuseEffect(() => {\n\t\tif (autoFocus) {\n\t\t\ttriggerRef.current?.focus();\n\t\t}\n\t}, [autoFocus]);\n\n\tuseEffect(() => {\n\t\tconst form = hiddenRef.current?.form;\n\t\tif (!form || (mode === \"range\" ? rangeValue !== undefined : value !== undefined)) {\n\t\t\treturn;\n\t\t}\n\t\tconst onReset = (event: Event) => {\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tif (event.defaultPrevented) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tsetUncontrolled(defaultValue);\n\t\t\t\tsetUncontrolledRange(defaultRangeValue ?? { from: \"\", to: undefined });\n\t\t\t\tsetOpen(false);\n\t\t\t});\n\t\t};\n\t\tform.addEventListener(\"reset\", onReset);\n\t\treturn () => form.removeEventListener(\"reset\", onReset);\n\t}, [defaultRangeValue, defaultValue, mode, rangeValue, value]);\n\n\tconst weekdayLabels = useMemo(() => {\n\t\tconst formatter = new Intl.DateTimeFormat(locale, { weekday: \"short\", timeZone: \"UTC\" });\n\t\treturn Array.from({ length: 7 }, (_, index) => {\n\t\t\tconst day = new Date(Date.UTC(2024, 0, 7 + ((index + weekStartsOn) % 7)));\n\t\t\treturn formatter.format(day);\n\t\t});\n\t}, [locale, weekStartsOn]);\n\n\tconst days = useMemo(() => {\n\t\tconst first = { y: month.y, m: month.m, d: 1 };\n\t\tif (!isValidCivil(first)) {\n\t\t\treturn Array.from({ length: 42 }, () => null);\n\t\t}\n\t\tconst startOffset = (utcDate(first).getUTCDay() - weekStartsOn + 7) % 7;\n\t\tconst start = addDays(first, -startOffset);\n\t\tif (!start) {\n\t\t\treturn Array.from({ length: 42 }, (_, index) => addDays(first, index - startOffset));\n\t\t}\n\t\treturn Array.from({ length: 42 }, (_, index) => addDays(start, index));\n\t}, [month, weekStartsOn]);\n\n\tuseLayoutEffect(() => {\n\t\tif (!open) {\n\t\t\treturn;\n\t\t}\n\t\tconst pending = pendingFocusIso.current;\n\t\tlet index = 0;\n\t\tif (pending) {\n\t\t\tpendingFocusIso.current = null;\n\t\t\tindex = days.findIndex((date) => isoOf(date) === pending);\n\t\t\tif (index < 0) {\n\t\t\t\tindex = 0;\n\t\t\t}\n\t\t} else {\n\t\t\tconst focused = document.activeElement;\n\t\t\tconst focusedIso =\n\t\t\t\t!focusDay.current &&\n\t\t\t\tfocused instanceof HTMLElement &&\n\t\t\t\tdayRefs.current.some((node) => node === focused)\n\t\t\t\t\t? focused.getAttribute(\"aria-label\")\n\t\t\t\t\t: null;\n\t\t\tconst focusedIndex = focusedIso ? days.findIndex((date) => isoOf(date) === focusedIso) : -1;\n\t\t\tif (focusedIndex >= 0) {\n\t\t\t\tindex = focusedIndex;\n\t\t\t} else {\n\t\t\t\tconst iso = cursorIso || submitted || formatIso(todayCivil(timeZone));\n\t\t\t\tconst selectedIndex = days.findIndex((date) => isoOf(date) === iso);\n\t\t\t\tif (selectedIndex >= 0 && days[selectedIndex]?.m === month.m) {\n\t\t\t\t\tindex = selectedIndex;\n\t\t\t\t} else {\n\t\t\t\t\tconst firstInMonth = days.findIndex((date) => date?.m === month.m);\n\t\t\t\t\tindex = firstInMonth >= 0 ? firstInMonth : 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst enabled = (date: Civil | null) =>\n\t\t\tBoolean(date && date.y >= 1 && dateSelectable(formatIso(date), min, max, isDisabledDate));\n\t\tif (!enabled(days[index] ?? null)) {\n\t\t\tconst inMonth = days.findIndex((date) => date?.m === month.m && enabled(date));\n\t\t\tconst any = days.findIndex((date) => enabled(date));\n\t\t\tindex = inMonth >= 0 ? inMonth : any >= 0 ? any : index;\n\t\t}\n\t\tsetFocusIndex(index);\n\t\tif (focusDay.current) {\n\t\t\tfocusDay.current = false;\n\t\t\tdayRefs.current[index]?.focus();\n\t\t}\n\t}, [open, cursorIso, submitted, timeZone, days, month.m, min, max, isDisabledDate]);\n\n\tconst previousMonth = shiftMonth(month, -1);\n\tconst followingMonth = shiftMonth(month, 1);\n\tconst rangeFrom = mode === \"range\" ? selectedRange.from : \"\";\n\tconst rangeTo = mode === \"range\" ? selectedRange.to : undefined;\n\tconst label = formatTriggerLabel({\n\t\tmode,\n\t\tselectedDate,\n\t\trangeFrom,\n\t\trangeTo,\n\t\tlocale,\n\t\tformatDate,\n\t});\n\n\tfunction selectable(iso: string) {\n\t\treturn dateSelectable(iso, min, max, isDisabledDate);\n\t}\n\n\tfunction commit(next: string) {\n\t\tif (disabled || readOnly || !selectable(next)) {\n\t\t\treturn;\n\t\t}\n\t\tif (mode === \"range\") {\n\t\t\tconst current = rangeValue ?? uncontrolledRange;\n\t\t\tconst nextRange =\n\t\t\t\t!current.from || current.to\n\t\t\t\t\t? { from: next }\n\t\t\t\t\t: compareCivil(\n\t\t\t\t\t\t\t\tparseIso(next) ?? { y: 1, m: 1, d: 1 },\n\t\t\t\t\t\t\t\tparseIso(current.from) ?? { y: 1, m: 1, d: 1 },\n\t\t\t\t\t\t\t) < 0\n\t\t\t\t\t\t? { from: next, to: current.from }\n\t\t\t\t\t\t: { from: current.from, to: next };\n\t\t\tif (rangeValue === undefined) {\n\t\t\t\tsetUncontrolledRange(nextRange);\n\t\t\t}\n\t\t\tonRangeChange?.(nextRange);\n\t\t\tif (nextRange.to) {\n\t\t\t\tsetOpen(false);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (value === undefined) {\n\t\t\tsetUncontrolled(next);\n\t\t}\n\t\tsetOpen(false);\n\t\tonChange?.(next);\n\t}\n\n\tfunction applyPreset(preset: DatePickerPreset) {\n\t\tif (disabled || readOnly) {\n\t\t\treturn;\n\t\t}\n\t\tif (typeof preset.value === \"string\") {\n\t\t\tif (mode === \"range\") {\n\t\t\t\tif (!selectable(preset.value)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst nextRange = { from: preset.value, to: preset.value };\n\t\t\t\tif (rangeValue === undefined) {\n\t\t\t\t\tsetUncontrolledRange(nextRange);\n\t\t\t\t}\n\t\t\t\tonRangeChange?.(nextRange);\n\t\t\t\tsetOpen(false);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcommit(preset.value);\n\t\t\treturn;\n\t\t}\n\t\tif (mode === \"range\") {\n\t\t\tif (!selectable(preset.value.from) || !selectable(preset.value.to)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (rangeValue === undefined) {\n\t\t\t\tsetUncontrolledRange(preset.value);\n\t\t\t}\n\t\t\tonRangeChange?.(preset.value);\n\t\t\tsetOpen(false);\n\t\t}\n\t}\n\n\treturn (\n\t\t<Popover\n\t\t\topen={open}\n\t\t\tonOpenChange={(next) => {\n\t\t\t\tif (next && disabled) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (next) {\n\t\t\t\t\tconst synced = (cursorIso ? parseIso(cursorIso) : null) ?? todayCivil(timeZone);\n\t\t\t\t\tsetMonth({ y: synced.y, m: synced.m, d: 1 });\n\t\t\t\t\tfocusDay.current = true;\n\t\t\t\t}\n\t\t\t\tsetOpen(next);\n\t\t\t}}\n\t\t>\n\t\t\t<input\n\t\t\t\tref={hiddenRef}\n\t\t\t\ttype={mode === \"range\" ? \"text\" : \"date\"}\n\t\t\t\tname={name}\n\t\t\t\trequired={required}\n\t\t\t\tmin={mode === \"range\" ? undefined : min}\n\t\t\t\tmax={mode === \"range\" ? undefined : max}\n\t\t\t\tclassName=\"sr-only mb-2 h-7\"\n\t\t\t\tstyle={{\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\twidth: 1,\n\t\t\t\t\theight: 1,\n\t\t\t\t\toverflow: \"hidden\",\n\t\t\t\t\tclip: \"rect(0, 0, 0, 0)\",\n\t\t\t\t}}\n\t\t\t\tvalue={\n\t\t\t\t\tmode === \"range\" ? (rangeFrom && rangeTo ? `${rangeFrom}/${rangeTo}` : \"\") : submitted\n\t\t\t\t}\n\t\t\t\tonChange={() => undefined}\n\t\t\t\tdisabled={disabled}\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\ttabIndex={-1}\n\t\t\t\t{...formRest}\n\t\t\t/>\n\t\t\t<PopoverTrigger asChild>\n\t\t\t\t<Button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tref={triggerRef}\n\t\t\t\t\tid={id}\n\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tonFocus={onFocus as ComponentProps<\"button\">[\"onFocus\"]}\n\t\t\t\t\tonBlur={onBlur as ComponentProps<\"button\">[\"onBlur\"]}\n\t\t\t\t\taria-labelledby={ariaLabelledBy}\n\t\t\t\t\taria-label={\n\t\t\t\t\t\tariaLabel ? (label === \"Pick a date\" ? ariaLabel : `${ariaLabel}: ${label}`) : undefined\n\t\t\t\t\t}\n\t\t\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t\t\taria-invalid={ariaInvalid}\n\t\t\t\t\tclassName={cn(\"justify-start font-normal\", className)}\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t</Button>\n\t\t\t</PopoverTrigger>\n\t\t\t<PopoverContent\n\t\t\t\tarrow={false}\n\t\t\t\tclassName=\"w-64 p-3\"\n\t\t\t\taria-label={ariaLabel ? `${ariaLabel} calendar` : \"Date calendar\"}\n\t\t\t\tonOpenAutoFocus={(event) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tconst iso = cursorIso || submitted || formatIso(todayCivil(timeZone));\n\t\t\t\t\tconst selectedIndex = days.findIndex((date) => isoOf(date) === iso);\n\t\t\t\t\tconst enabled = (date: Civil | null) =>\n\t\t\t\t\t\tBoolean(\n\t\t\t\t\t\t\tdate && date.y >= 1 && dateSelectable(formatIso(date), min, max, isDisabledDate),\n\t\t\t\t\t\t);\n\t\t\t\t\tlet index =\n\t\t\t\t\t\tselectedIndex >= 0 && days[selectedIndex]?.m === month.m\n\t\t\t\t\t\t\t? selectedIndex\n\t\t\t\t\t\t\t: Math.max(\n\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\tdays.findIndex((date) => date?.m === month.m),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\tif (!enabled(days[index] ?? null)) {\n\t\t\t\t\t\tconst inMonth = days.findIndex((date) => date?.m === month.m && enabled(date));\n\t\t\t\t\t\tconst any = days.findIndex((date) => enabled(date));\n\t\t\t\t\t\tindex = inMonth >= 0 ? inMonth : any >= 0 ? any : index;\n\t\t\t\t\t}\n\t\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t\tdayRefs.current[index]?.focus();\n\t\t\t\t\t});\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{presets && presets.length > 0 ? (\n\t\t\t\t\t<div className=\"mb-2 flex flex-wrap gap-1\">\n\t\t\t\t\t\t{presets.map((preset) => (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tkey={preset.label}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\tclassName=\"h-7 px-2 text-xs\"\n\t\t\t\t\t\t\t\tdisabled={disabled || readOnly}\n\t\t\t\t\t\t\t\tonClick={() => applyPreset(preset)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{preset.label}\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t\t<div className=\"mb-2 flex items-center justify-between gap-2\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\ticon={<ChevronLeft />}\n\t\t\t\t\t\taria-label=\"Prev\"\n\t\t\t\t\t\tclassName=\"size-8\"\n\t\t\t\t\t\tdisabled={disabled || !previousMonth || previousMonth.y < 1}\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tif (!previousMonth || previousMonth.y < 1) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfocusDay.current = false;\n\t\t\t\t\t\t\tsetMonth(previousMonth);\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t<span className=\"text-sm font-medium\">\n\t\t\t\t\t\t{formatCivil(month, locale, { month: \"long\", year: \"numeric\" })}\n\t\t\t\t\t</span>\n\t\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\ticon={<ChevronRight />}\n\t\t\t\t\t\taria-label=\"Next\"\n\t\t\t\t\t\tclassName=\"size-8\"\n\t\t\t\t\t\tdisabled={disabled || !followingMonth}\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tif (!followingMonth) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfocusDay.current = false;\n\t\t\t\t\t\t\tsetMonth(followingMonth);\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"grid grid-cols-7 gap-1 text-center\"\n\t\t\t\t\tonKeyDown={(event) => {\n\t\t\t\t\t\tconst current = days[focusIndex];\n\t\t\t\t\t\tif (!current) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tevent.key === \"ArrowRight\" ||\n\t\t\t\t\t\t\tevent.key === \"ArrowLeft\" ||\n\t\t\t\t\t\t\tevent.key === \"ArrowDown\" ||\n\t\t\t\t\t\t\tevent.key === \"ArrowUp\"\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tconst delta =\n\t\t\t\t\t\t\t\tevent.key === \"ArrowRight\"\n\t\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t\t: event.key === \"ArrowLeft\"\n\t\t\t\t\t\t\t\t\t\t? -1\n\t\t\t\t\t\t\t\t\t\t: event.key === \"ArrowDown\"\n\t\t\t\t\t\t\t\t\t\t\t? 7\n\t\t\t\t\t\t\t\t\t\t\t: -7;\n\t\t\t\t\t\t\tlet next = addDays(current, delta);\n\t\t\t\t\t\t\tfor (\n\t\t\t\t\t\t\t\tlet step = 0;\n\t\t\t\t\t\t\t\tnext && next.y >= 1 && !selectable(formatIso(next)) && step < 42;\n\t\t\t\t\t\t\t\tstep += 1\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnext = addDays(next, delta);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!next || next.y < 1 || !selectable(formatIso(next))) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (next.y !== month.y || next.m !== month.m) {\n\t\t\t\t\t\t\t\tpendingFocusIso.current = formatIso(next);\n\t\t\t\t\t\t\t\tfocusDay.current = true;\n\t\t\t\t\t\t\t\tsetMonth({ y: next.y, m: next.m, d: 1 });\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst index = days.findIndex((date) => isoOf(date) === formatIso(next));\n\t\t\t\t\t\t\tif (index >= 0) {\n\t\t\t\t\t\t\t\tsetFocusIndex(index);\n\t\t\t\t\t\t\t\tdayRefs.current[index]?.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (event.key === \"Enter\" || event.key === \" \") {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tconst iso = formatIso(current);\n\t\t\t\t\t\t\tif (current.y >= 1 && selectable(iso)) {\n\t\t\t\t\t\t\t\tcommit(iso);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{weekdayLabels.map((day, index) => (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tkey={`${day}-${index}`}\n\t\t\t\t\t\t\tclassName=\"flex h-8 items-center justify-center text-xs font-medium text-basalt-muted-foreground\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{day}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t))}\n\t\t\t\t\t{days.map((date, index) => {\n\t\t\t\t\t\tif (!date) {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tkey={`empty-${index}`}\n\t\t\t\t\t\t\t\t\tclassName=\"h-8\"\n\t\t\t\t\t\t\t\t\tref={() => {\n\t\t\t\t\t\t\t\t\t\tdayRefs.current[index] = null;\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst iso = formatIso(date);\n\t\t\t\t\t\tconst inMonth = date.m === month.m;\n\t\t\t\t\t\tconst inRange = date.y >= 1 && selectable(iso);\n\t\t\t\t\t\tconst fromDate = rangeFrom ? parseIso(rangeFrom) : null;\n\t\t\t\t\t\tconst toDate = rangeTo ? parseIso(rangeTo) : null;\n\t\t\t\t\t\tconst thisDate = parseIso(iso);\n\t\t\t\t\t\tconst inSelectedRange = Boolean(\n\t\t\t\t\t\t\tfromDate &&\n\t\t\t\t\t\t\t\ttoDate &&\n\t\t\t\t\t\t\t\tthisDate &&\n\t\t\t\t\t\t\t\tcompareCivil(thisDate, fromDate) >= 0 &&\n\t\t\t\t\t\t\t\tcompareCivil(thisDate, toDate) <= 0,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst isRangeEdge = iso === rangeFrom || iso === rangeTo;\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tkey={iso}\n\t\t\t\t\t\t\t\tref={(node) => {\n\t\t\t\t\t\t\t\t\tdayRefs.current[index] = node;\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\ttabIndex={index === focusIndex ? 0 : -1}\n\t\t\t\t\t\t\t\taria-label={iso}\n\t\t\t\t\t\t\t\taria-pressed={\n\t\t\t\t\t\t\t\t\tmode === \"range\"\n\t\t\t\t\t\t\t\t\t\t? iso === rangeFrom || iso === rangeTo\n\t\t\t\t\t\t\t\t\t\t: Boolean(submitted) && iso === submitted\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={disabled || readOnly || !inRange}\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\tCALENDAR_BUTTON,\n\t\t\t\t\t\t\t\t\t\"flex h-8 w-8 items-center justify-center rounded-basalt-md text-sm\",\n\t\t\t\t\t\t\t\t\tinMonth ? \"text-basalt-foreground\" : \"text-basalt-muted-foreground\",\n\t\t\t\t\t\t\t\t\tinRange && \"hover:bg-basalt-accent\",\n\t\t\t\t\t\t\t\t\tinSelectedRange && !isRangeEdge && \"bg-basalt-accent\",\n\t\t\t\t\t\t\t\t\tinRange &&\n\t\t\t\t\t\t\t\t\t\t(mode === \"range\" ? isRangeEdge : iso === submitted) &&\n\t\t\t\t\t\t\t\t\t\t\"bg-basalt-primary text-basalt-primary-foreground hover:bg-basalt-primary/90\",\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\tonClick={() => inRange && commit(iso)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{date.d}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t);\n\t\t\t\t\t})}\n\t\t\t\t</div>\n\t\t\t</PopoverContent>\n\t\t</Popover>\n\t);\n}\n"],"mappings":";;;;;;;;AAQA,SAAS,EAAI,GAAe;CAC3B,OAAO,OAAO,CAAK,CAAC,CAAC,SAAS,GAAG,GAAG;AACrC;AAEA,SAAS,EAAU,GAAa;CAC/B,OAAO,GAAG,OAAO,EAAK,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG,EAAI,EAAK,CAAC,EAAE,GAAG,EAAI,EAAK,CAAC;AACvE;AAEA,SAAS,EAAQ,GAAa;CAC7B,IAAM,IAAO,IAAI,KAAK,KAAK,IAAI,EAAK,GAAG,EAAK,IAAI,GAAG,EAAK,CAAC,CAAC;CAE1D,OADA,EAAK,eAAe,EAAK,CAAC,GACnB;AACR;AAEA,SAAS,EAAU,GAAa;CAC/B,IAAM,IAAO,IAAI,KAAK,EAAK,GAAG,EAAK,IAAI,GAAG,EAAK,CAAC;CAEhD,OADA,EAAK,YAAY,EAAK,CAAC,GAChB;AACR;AAEA,SAAS,EAAS,GAA6B;CAC9C,IAAM,IAAQ,6BAA6B,KAAK,CAAK;CACrD,IAAI,CAAC,GACJ,OAAO;CAER,I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,EAAQ,QAAQ,KAAS;QAC1B;OACA,GALK,SAAS,GAKd;OAGH,IAAM,IAAM,EAAU,CAAI,GACpB,IAAU,EAAK,MAAM,EAAM,GAC3B,IAAU,EAAK,KAAK,KAAK,EAAW,CAAG,GACvC,IAAW,IAAY,EAAS,CAAS,IAAI,MAC7C,IAAS,IAAU,EAAS,CAAO,IAAI,MACvC,IAAW,EAAS,CAAG,GACvB,IAAkB,GACvB,KACC,KACA,KACA,EAAa,GAAU,CAAQ,KAAK,KACpC,EAAa,GAAU,CAAM,KAAK,IAE9B,IAAc,MAAQ,KAAa,MAAQ;OACjD,OACC,kBAAC,UAAD;QACC,MAAK;QAEL,MAAM,MAAS;SACd,EAAQ,QAAQ,KAAS;QAC1B;QACA,UAAU,MAAU,KAAa,IAAI;QACrC,cAAY;QACZ,gBACC,MAAS,UACN,MAAQ,KAAa,MAAQ,IAC7B,EAAQ,KAAc,MAAQ;QAElC,UAAU,KAAY,KAAY,CAAC;QACnC,WAAW,EACV,IACA,sEACA,IAAU,2BAA2B,gCACrC,KAAW,0BACX,KAAmB,CAAC,KAAe,oBACnC,MACE,MAAS,UAAU,IAAc,MAAQ,MAC1C,6EACF;QACA,eAAe,KAAW,GAAO,CAAG;QAEnC,UAAA,EAAK;OACC,GAzBF,CAyBE;MAEV,CAAC,CACG;;IACU;;EACR;;AAEX"}
|
|
1
|
+
{"version":3,"file":"date-picker.js","names":[],"sources":["../../src/components/date-picker.tsx"],"sourcesContent":["import { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport * as React from \"react\";\nimport { type ComponentProps, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { Button } from \"./button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\n\ntype Civil = { y: number; m: number; d: number };\n\nfunction pad(value: number) {\n\treturn String(value).padStart(2, \"0\");\n}\n\nfunction formatIso(date: Civil) {\n\treturn `${String(date.y).padStart(4, \"0\")}-${pad(date.m)}-${pad(date.d)}`;\n}\n\nfunction utcDate(date: Civil) {\n\tconst next = new Date(Date.UTC(date.y, date.m - 1, date.d));\n\tnext.setUTCFullYear(date.y);\n\treturn next;\n}\n\nfunction civilDate(date: Civil) {\n\tconst next = new Date(date.y, date.m - 1, date.d);\n\tnext.setFullYear(date.y);\n\treturn next;\n}\n\nfunction parseIso(value: string): Civil | null {\n\tconst match = /^(\\d{4,})-(\\d{2})-(\\d{2})$/.exec(value);\n\tif (!match) {\n\t\treturn null;\n\t}\n\tconst year = Number(match[1]);\n\tconst month = Number(match[2]);\n\tconst day = Number(match[3]);\n\tif (year < 1) {\n\t\treturn null;\n\t}\n\tconst utc = utcDate({ y: year, m: month, d: day });\n\tif (\n\t\tutc.getUTCFullYear() !== year ||\n\t\tutc.getUTCMonth() + 1 !== month ||\n\t\tutc.getUTCDate() !== day\n\t) {\n\t\treturn null;\n\t}\n\treturn { y: year, m: month, d: day };\n}\n\nfunction parseIsoMonth(value: string | undefined): Civil | null {\n\tif (!value) {\n\t\treturn null;\n\t}\n\tconst match = /^(\\d{4,})-(\\d{2})$/.exec(value);\n\tif (!match) {\n\t\treturn null;\n\t}\n\tconst year = Number(match[1]);\n\tconst month = Number(match[2]);\n\tif (year < 1 || month < 1 || month > 12) {\n\t\treturn null;\n\t}\n\tconst civil = { y: year, m: month, d: 1 };\n\treturn isValidCivil(civil) ? civil : null;\n}\n\nfunction formatIsoMonth(date: Civil): string {\n\treturn `${String(date.y).padStart(4, \"0\")}-${pad(date.m)}`;\n}\n\nconst CALENDAR_BUTTON =\n\t\"appearance-none border-0 bg-transparent p-0 font-inherit text-inherit cursor-pointer\";\n\nfunction todayCivil(timeZone?: string): Civil {\n\tconst parts = new Intl.DateTimeFormat(\"en-CA\", {\n\t\ttimeZone,\n\t\tyear: \"numeric\",\n\t\tmonth: \"2-digit\",\n\t\tday: \"2-digit\",\n\t}).formatToParts(new Date());\n\tconst read = (type: Intl.DateTimeFormatPartTypes) =>\n\t\tNumber(parts.find((part) => part.type === type)?.value);\n\treturn { y: read(\"year\"), m: read(\"month\"), d: read(\"day\") };\n}\n\nfunction formatCivil(date: Civil, locale: string, options: Intl.DateTimeFormatOptions) {\n\treturn new Intl.DateTimeFormat(locale, {\n\t\t...options,\n\t\ttimeZone: \"UTC\",\n\t\tcalendar: \"gregory\",\n\t}).format(utcDate(date));\n}\n\nfunction isLeapYear(y: number): boolean {\n\treturn (y % 4 === 0 && y % 100 !== 0) || y % 400 === 0;\n}\n\nfunction daysInCivilMonth(y: number, m: number): number {\n\tif (m === 2) {\n\t\treturn isLeapYear(y) ? 29 : 28;\n\t}\n\tif (m === 4 || m === 6 || m === 9 || m === 11) {\n\t\treturn 30;\n\t}\n\treturn 31;\n}\n\nfunction shiftCivilMonthClamped(current: Civil, deltaMonths: number): Civil | null {\n\tconst total = current.y * 12 + (current.m - 1) + deltaMonths;\n\tconst targetY = Math.floor(total / 12);\n\tif (targetY < 1) {\n\t\treturn null;\n\t}\n\tconst targetM = (((total % 12) + 12) % 12) + 1;\n\tconst maxD = daysInCivilMonth(targetY, targetM);\n\tconst target = { y: targetY, m: targetM, d: Math.min(current.d, maxD) };\n\treturn isValidCivil(target) ? target : null;\n}\n\nfunction formatTriggerLabel({\n\tmode,\n\tselectedDate,\n\trangeFrom,\n\trangeTo,\n\tlocale,\n\tformatDate,\n\tplaceholder = \"Pick a date\",\n}: {\n\tmode: \"single\" | \"range\";\n\tselectedDate: Civil | null;\n\trangeFrom: string;\n\trangeTo?: string;\n\tlocale: string;\n\tformatDate?: (date: Date) => string;\n\tplaceholder?: string;\n}) {\n\tfunction one(iso: string) {\n\t\tconst date = parseIso(iso);\n\t\tif (!date) {\n\t\t\treturn iso;\n\t\t}\n\t\treturn formatDate?.(civilDate(date)) ?? formatCivil(date, locale, { dateStyle: \"medium\" });\n\t}\n\tif (mode === \"range\") {\n\t\tif (!rangeFrom) {\n\t\t\treturn placeholder;\n\t\t}\n\t\tif (!rangeTo) {\n\t\t\treturn `${one(rangeFrom)} – …`;\n\t\t}\n\t\treturn `${one(rangeFrom)} – ${one(rangeTo)}`;\n\t}\n\treturn selectedDate\n\t\t? (formatDate?.(civilDate(selectedDate)) ??\n\t\t\t\tformatCivil(selectedDate, locale, { dateStyle: \"medium\" }))\n\t\t: placeholder;\n}\n\nfunction compareCivil(left: Civil, right: Civil) {\n\tif (left.y !== right.y) {\n\t\treturn left.y - right.y;\n\t}\n\tif (left.m !== right.m) {\n\t\treturn left.m - right.m;\n\t}\n\treturn left.d - right.d;\n}\n\nfunction withinBounds(iso: string, min?: string, max?: string) {\n\tconst date = parseIso(iso);\n\tconst minDate = min ? parseIso(min) : null;\n\tconst maxDate = max ? parseIso(max) : null;\n\tif (!date) {\n\t\treturn false;\n\t}\n\tif (minDate && compareCivil(date, minDate) < 0) {\n\t\treturn false;\n\t}\n\tif (maxDate && compareCivil(date, maxDate) > 0) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\nfunction dateSelectable(\n\tiso: string,\n\tmin?: string,\n\tmax?: string,\n\tisDisabledDate?: (iso: string) => boolean,\n) {\n\treturn withinBounds(iso, min, max) && !isDisabledDate?.(iso);\n}\n\nexport type DatePickerRange = { from: string; to?: string };\n\nexport type DatePickerPreset = {\n\tlabel: string;\n\tvalue: string | { from: string; to: string };\n};\n\nexport type DatePickerLabels = {\n\t/**\n\t * Accessible label for the calendar popup container.\n\t * @default \"Date calendar\" (or derived from `aria-label`)\n\t */\n\tcalendar?: string;\n\t/**\n\t * Accessible label for previous month button.\n\t * @default \"Prev\"\n\t */\n\tpreviousMonth?: string;\n\t/**\n\t * Accessible label for next month button.\n\t * @default \"Next\"\n\t */\n\tnextMonth?: string;\n\t/**\n\t * Fallback label for the trigger when no date is chosen.\n\t * @default \"Pick a date\"\n\t */\n\tplaceholder?: string;\n\t/**\n\t * Custom validation error message displayed when form validation fails.\n\t */\n\tvalidationMessage?: string;\n\t/**\n\t * Accessible keyboard navigation instructions announced for the calendar grid.\n\t */\n\tkeyboardInstructions?: string;\n};\n\nexport type DatePickerProps = Omit<\n\tComponentProps<\"input\">,\n\t| \"value\"\n\t| \"defaultValue\"\n\t| \"onChange\"\n\t| \"type\"\n\t| \"children\"\n\t| \"disabled\"\n\t| \"name\"\n\t| \"required\"\n\t| \"min\"\n\t| \"max\"\n> & {\n\t/**\n\t * The controlled ISO date in single mode.\n\t */\n\tvalue?: string;\n\t/**\n\t * The uncontrolled initial ISO date in single mode.\n\t */\n\tdefaultValue?: string;\n\t/**\n\t * Called with the ISO date in single mode.\n\t */\n\tonChange?: (value: string) => void;\n\t/**\n\t * Selection mode.\n\t * @default single\n\t */\n\tmode?: \"single\" | \"range\";\n\t/**\n\t * The controlled displayed month in `YYYY-MM` format (at least 4-digit positive year).\n\t * If omitted or invalid, falls back smoothly to `defaultMonth`, selected date, or today.\n\t */\n\tmonth?: string;\n\t/**\n\t * The uncontrolled initial displayed month in `YYYY-MM` format (at least 4-digit positive year).\n\t * If omitted or invalid, falls back smoothly to selected date or today.\n\t */\n\tdefaultMonth?: string;\n\t/**\n\t * Called only when calendar navigation requests a month change (`YYYY-MM`).\n\t * Not invoked during component render or synchronous prop synchronization.\n\t */\n\tonMonthChange?: (month: string) => void;\n\t/**\n\t * The controlled range in range mode.\n\t */\n\trangeValue?: DatePickerRange;\n\t/**\n\t * The uncontrolled initial range in range mode.\n\t */\n\tdefaultRangeValue?: DatePickerRange;\n\t/**\n\t * Called when the range changes.\n\t */\n\tonRangeChange?: (value: DatePickerRange) => void;\n\t/**\n\t * Additional dates that cannot be selected.\n\t */\n\tisDisabledDate?: (iso: string) => boolean;\n\t/**\n\t * Shortcut values shown above the calendar.\n\t */\n\tpresets?: DatePickerPreset[];\n\t/**\n\t * Locale used to format the trigger and weekday labels.\n\t * @default en-US\n\t */\n\tlocale?: string;\n\t/**\n\t * First day of the week. 0 is Sunday.\n\t * @default 0\n\t */\n\tweekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\t/**\n\t * IANA time zone used to resolve today.\n\t */\n\ttimeZone?: string;\n\t/**\n\t * Custom formatter for the trigger label.\n\t */\n\tformatDate?: (date: Date) => string;\n\t/**\n\t * Optional localized labels for calendar dialog, navigation, and trigger placeholder.\n\t */\n\tlabels?: DatePickerLabels;\n\t/**\n\t * Native form field name.\n\t */\n\tname?: string;\n\t/**\n\t * Native required constraint. When readOnly is set, native required validation is disabled.\n\t * When an empty required DatePicker submits, the visible trigger receives focus and invalid state.\n\t */\n\trequired?: boolean;\n\t/**\n\t * Inclusive lower ISO bound.\n\t */\n\tmin?: string;\n\t/**\n\t * Inclusive upper ISO bound.\n\t */\n\tmax?: string;\n\t/**\n\t * Disable the trigger and calendar.\n\t */\n\tdisabled?: boolean;\n};\n\nfunction clampCivil(date: Civil, min?: string, max?: string) {\n\tconst minDate = min ? parseIso(min) : null;\n\tconst maxDate = max ? parseIso(max) : null;\n\tif (minDate && compareCivil(date, minDate) < 0) {\n\t\treturn minDate;\n\t}\n\tif (maxDate && compareCivil(date, maxDate) > 0) {\n\t\treturn maxDate;\n\t}\n\treturn date;\n}\n\nfunction isValidCivil(date: Civil): boolean {\n\tif (!Number.isFinite(date.y) || date.m < 1 || date.m > 12 || date.d < 1 || date.d > 31) {\n\t\treturn false;\n\t}\n\tconst utc = utcDate(date);\n\treturn (\n\t\t!Number.isNaN(utc.getTime()) &&\n\t\tutc.getUTCFullYear() === date.y &&\n\t\tutc.getUTCMonth() + 1 === date.m &&\n\t\tutc.getUTCDate() === date.d\n\t);\n}\n\nfunction isoOf(date: Civil | null) {\n\treturn date ? formatIso(date) : \"\";\n}\n\nfunction addDays(date: Civil, days: number): Civil | null {\n\tconst next = utcDate(date);\n\tif (Number.isNaN(next.getTime())) {\n\t\treturn null;\n\t}\n\tnext.setUTCDate(next.getUTCDate() + days);\n\tif (Number.isNaN(next.getTime())) {\n\t\treturn null;\n\t}\n\tconst civil = { y: next.getUTCFullYear(), m: next.getUTCMonth() + 1, d: next.getUTCDate() };\n\treturn isValidCivil(civil) ? civil : null;\n}\n\nfunction shiftMonth(month: Civil, delta: number): Civil | null {\n\tconst total = month.y * 12 + (month.m - 1) + delta;\n\tconst next = { y: Math.floor(total / 12), m: (total % 12) + 1, d: 1 };\n\treturn isValidCivil(next) ? next : null;\n}\n\nexport function DatePicker({\n\tvalue,\n\tdefaultValue = \"\",\n\tonChange,\n\tmode = \"single\",\n\tmonth: controlledMonthProp,\n\tdefaultMonth: defaultMonthProp,\n\tonMonthChange,\n\trangeValue,\n\tdefaultRangeValue,\n\tonRangeChange,\n\tisDisabledDate,\n\tpresets,\n\tlocale = \"en-US\",\n\tweekStartsOn = 0,\n\ttimeZone,\n\tformatDate,\n\tname,\n\trequired,\n\tmin,\n\tmax,\n\tdisabled,\n\tclassName,\n\tid,\n\t\"aria-label\": ariaLabel,\n\t\"aria-describedby\": ariaDescribedBy,\n\t\"aria-invalid\": ariaInvalid,\n\tlabels,\n\t...inputRest\n}: DatePickerProps) {\n\tconst {\n\t\tref: externalRef,\n\t\treadOnly,\n\t\tautoFocus,\n\t\tonFocus,\n\t\tonBlur,\n\t\tonInvalid: externalOnInvalid,\n\t\t\"aria-labelledby\": ariaLabelledBy,\n\t\t...formRest\n\t} = inputRest;\n\tconst [uncontrolled, setUncontrolled] = useState(defaultValue);\n\tconst [uncontrolledRange, setUncontrolledRange] = useState<DatePickerRange>(\n\t\tdefaultRangeValue ?? { from: \"\", to: undefined },\n\t);\n\tconst [open, setOpen] = useState(false);\n\tconst [isInvalid, setIsInvalid] = useState(false);\n\tconst [validationMessage, setValidationMessage] = useState(\"\");\n\tconst [focusIndex, setFocusIndex] = useState(0);\n\tconst dayRefs = useRef<Array<HTMLButtonElement | null>>([]);\n\tconst pendingFocus = useRef<{ targetMonthKey: string; iso: string } | null>(null);\n\tconst focusDay = useRef(false);\n\tconst hiddenRef = useRef<HTMLInputElement>(null);\n\tconst triggerRef = useRef<HTMLButtonElement>(null);\n\tconst generatedErrorId = React.useId();\n\tconst errorId = id ? `${id}-error` : generatedErrorId;\n\tconst generatedMonthLiveId = React.useId();\n\tconst monthLiveId = id ? `${id}-month-live` : generatedMonthLiveId;\n\tconst generatedKeyboardInstructionsId = React.useId();\n\tconst keyboardInstructionsId = id\n\t\t? `${id}-keyboard-instructions`\n\t\t: generatedKeyboardInstructionsId;\n\n\tconst selected = value ?? uncontrolled;\n\tconst selectedRange = rangeValue ?? uncontrolledRange;\n\tconst selectedDate = parseIso(\n\t\tmode === \"range\" ? selectedRange.to || selectedRange.from || \"\" : selected,\n\t);\n\tconst cursorIso = selectedDate ? formatIso(selectedDate) : \"\";\n\n\tuseEffect(() => {\n\t\tif (cursorIso) {\n\t\t\tsetIsInvalid(false);\n\t\t\tsetValidationMessage(\"\");\n\t\t}\n\t}, [cursorIso]);\n\tconst submitted = mode === \"range\" ? \"\" : cursorIso;\n\n\tconst controlledParsed = useMemo(() => parseIsoMonth(controlledMonthProp), [controlledMonthProp]);\n\tconst isMonthControlled = controlledParsed !== null;\n\n\tconst [uncontrolledMonth, setUncontrolledMonth] = useState<Civil>(() => {\n\t\tconst parsedDef = parseIsoMonth(defaultMonthProp);\n\t\tif (parsedDef) {\n\t\t\treturn parsedDef;\n\t\t}\n\t\tconst initialCursor = selectedDate ?? todayCivil(timeZone);\n\t\tconst clampedInitial = clampCivil(initialCursor, min, max);\n\t\treturn { y: clampedInitial.y, m: clampedInitial.m, d: 1 };\n\t});\n\n\tconst activeMonth = controlledParsed ?? uncontrolledMonth;\n\tconst activeMonthKey = formatIsoMonth(activeMonth);\n\n\tconst requestMonth = (target: Civil) => {\n\t\tconst monthKey = formatIsoMonth(target);\n\t\tif (!isMonthControlled) {\n\t\t\tsetUncontrolledMonth(target);\n\t\t}\n\t\tonMonthChange?.(monthKey);\n\t};\n\n\tconst prevSelected = useRef(cursorIso);\n\tif (open && prevSelected.current !== cursorIso) {\n\t\tfocusDay.current = true;\n\t\tif (controlledMonthProp === undefined && defaultMonthProp === undefined) {\n\t\t\tconst next = selectedDate ?? todayCivil(timeZone);\n\t\t\tif (activeMonth.y !== next.y || activeMonth.m !== next.m) {\n\t\t\t\tsetUncontrolledMonth({ y: next.y, m: next.m, d: 1 });\n\t\t\t}\n\t\t}\n\t}\n\tprevSelected.current = cursorIso;\n\n\tconst hasExplicitMonthConfig =\n\t\tcontrolledMonthProp !== undefined || defaultMonthProp !== undefined;\n\n\tuseEffect(() => {\n\t\tif (!open) {\n\t\t\treturn;\n\t\t}\n\t\tif (!hasExplicitMonthConfig) {\n\t\t\tconst next = clampCivil(\n\t\t\t\t(cursorIso ? parseIso(cursorIso) : null) ?? todayCivil(timeZone),\n\t\t\t\tmin,\n\t\t\t\tmax,\n\t\t\t);\n\t\t\tsetUncontrolledMonth({ y: next.y, m: next.m, d: 1 });\n\t\t\tif (!cursorIso) {\n\t\t\t\tfocusDay.current = true;\n\t\t\t}\n\t\t}\n\t}, [open, cursorIso, timeZone, min, max, hasExplicitMonthConfig]);\n\n\tuseEffect(() => {\n\t\tif (disabled) {\n\t\t\tsetOpen(false);\n\t\t}\n\t}, [disabled]);\n\n\tuseEffect(() => {\n\t\tif (autoFocus) {\n\t\t\ttriggerRef.current?.focus();\n\t\t}\n\t}, [autoFocus]);\n\n\tconst latestConfigRef = useRef({\n\t\tdefaultValue,\n\t\tdefaultRangeValue,\n\t\tmode,\n\t\trangeValue,\n\t\tvalue,\n\t});\n\tuseEffect(() => {\n\t\tlatestConfigRef.current = {\n\t\t\tdefaultValue,\n\t\t\tdefaultRangeValue,\n\t\t\tmode,\n\t\t\trangeValue,\n\t\t\tvalue,\n\t\t};\n\t});\n\n\tconst formAttr = formRest.form;\n\tuseEffect(() => {\n\t\tconst form = hiddenRef.current?.form;\n\t\tif (!form || (formAttr && form.id !== formAttr)) {\n\t\t\treturn;\n\t\t}\n\t\tlet disposed = false;\n\t\tconst timers = new Set<ReturnType<typeof setTimeout>>();\n\t\tconst onReset = (event: Event) => {\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\ttimers.delete(timer);\n\t\t\t\tif (disposed || event.defaultPrevented) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst cfg = latestConfigRef.current;\n\t\t\t\tif (cfg.mode === \"range\" ? cfg.rangeValue === undefined : cfg.value === undefined) {\n\t\t\t\t\tsetUncontrolled(cfg.defaultValue);\n\t\t\t\t\tsetUncontrolledRange(cfg.defaultRangeValue ?? { from: \"\", to: undefined });\n\t\t\t\t}\n\t\t\t\tsetIsInvalid(false);\n\t\t\t\tsetValidationMessage(\"\");\n\t\t\t\tsetOpen(false);\n\t\t\t}, 0);\n\t\t\ttimers.add(timer);\n\t\t};\n\t\tform.addEventListener(\"reset\", onReset);\n\t\treturn () => {\n\t\t\tdisposed = true;\n\t\t\tfor (const timer of timers) {\n\t\t\t\tclearTimeout(timer);\n\t\t\t}\n\t\t\ttimers.clear();\n\t\t\tform.removeEventListener(\"reset\", onReset);\n\t\t};\n\t}, [formAttr]);\n\n\tconst weekdayLabels = useMemo(() => {\n\t\tconst formatter = new Intl.DateTimeFormat(locale, { weekday: \"short\", timeZone: \"UTC\" });\n\t\treturn Array.from({ length: 7 }, (_, index) => {\n\t\t\tconst day = new Date(Date.UTC(2024, 0, 7 + ((index + weekStartsOn) % 7)));\n\t\t\treturn formatter.format(day);\n\t\t});\n\t}, [locale, weekStartsOn]);\n\n\tconst days = useMemo(() => {\n\t\tconst first = { y: activeMonth.y, m: activeMonth.m, d: 1 };\n\t\tif (!isValidCivil(first)) {\n\t\t\treturn Array.from({ length: 42 }, () => null);\n\t\t}\n\t\tconst startOffset = (utcDate(first).getUTCDay() - weekStartsOn + 7) % 7;\n\t\tconst start = addDays(first, -startOffset);\n\t\tif (!start) {\n\t\t\treturn Array.from({ length: 42 }, (_, index) => addDays(first, index - startOffset));\n\t\t}\n\t\treturn Array.from({ length: 42 }, (_, index) => addDays(start, index));\n\t}, [activeMonth, weekStartsOn]);\n\n\tuseLayoutEffect(() => {\n\t\tif (!open) {\n\t\t\treturn;\n\t\t}\n\t\tconst pending = pendingFocus.current;\n\t\tlet index = 0;\n\t\tif (pending) {\n\t\t\tif (pending.targetMonthKey === activeMonthKey) {\n\t\t\t\tpendingFocus.current = null;\n\t\t\t\tindex = days.findIndex((date) => isoOf(date) === pending.iso);\n\t\t\t\tif (index < 0) {\n\t\t\t\t\tindex = 0;\n\t\t\t\t}\n\t\t\t\tfocusDay.current = true;\n\t\t\t} else {\n\t\t\t\tconst focused = document.activeElement;\n\t\t\t\tconst focusedIso =\n\t\t\t\t\tfocused instanceof HTMLElement && dayRefs.current.some((node) => node === focused)\n\t\t\t\t\t\t? focused.getAttribute(\"aria-label\")\n\t\t\t\t\t\t: null;\n\t\t\t\tconst focusedIndex = focusedIso ? days.findIndex((date) => isoOf(date) === focusedIso) : -1;\n\t\t\t\tif (focusedIndex >= 0) {\n\t\t\t\t\tindex = focusedIndex;\n\t\t\t\t} else {\n\t\t\t\t\tindex = focusIndex;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst focused = document.activeElement;\n\t\t\tconst focusedIso =\n\t\t\t\t!focusDay.current &&\n\t\t\t\tfocused instanceof HTMLElement &&\n\t\t\t\tdayRefs.current.some((node) => node === focused)\n\t\t\t\t\t? focused.getAttribute(\"aria-label\")\n\t\t\t\t\t: null;\n\t\t\tconst focusedIndex = focusedIso ? days.findIndex((date) => isoOf(date) === focusedIso) : -1;\n\t\t\tif (focusedIndex >= 0) {\n\t\t\t\tindex = focusedIndex;\n\t\t\t} else {\n\t\t\t\tconst iso = cursorIso || submitted || formatIso(todayCivil(timeZone));\n\t\t\t\tconst selectedIndex = days.findIndex((date) => isoOf(date) === iso);\n\t\t\t\tif (selectedIndex >= 0 && days[selectedIndex]?.m === activeMonth.m) {\n\t\t\t\t\tindex = selectedIndex;\n\t\t\t\t} else {\n\t\t\t\t\tconst firstInMonth = days.findIndex((date) => date?.m === activeMonth.m);\n\t\t\t\t\tindex = firstInMonth >= 0 ? firstInMonth : 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst enabled = (date: Civil | null) =>\n\t\t\tBoolean(date && date.y >= 1 && dateSelectable(formatIso(date), min, max, isDisabledDate));\n\t\tif (!enabled(days[index] ?? null)) {\n\t\t\tconst inMonth = days.findIndex((date) => date?.m === activeMonth.m && enabled(date));\n\t\t\tconst any = days.findIndex((date) => enabled(date));\n\t\t\tindex = inMonth >= 0 ? inMonth : any >= 0 ? any : index;\n\t\t}\n\t\tsetFocusIndex(index);\n\t\tif (focusDay.current) {\n\t\t\tfocusDay.current = false;\n\t\t\tdayRefs.current[index]?.focus();\n\t\t}\n\t}, [\n\t\topen,\n\t\tcursorIso,\n\t\tsubmitted,\n\t\ttimeZone,\n\t\tdays,\n\t\tactiveMonth.m,\n\t\tactiveMonthKey,\n\t\tfocusIndex,\n\t\tmin,\n\t\tmax,\n\t\tisDisabledDate,\n\t]);\n\n\tconst previousMonth = shiftMonth(activeMonth, -1);\n\tconst followingMonth = shiftMonth(activeMonth, 1);\n\tconst rangeFrom = mode === \"range\" ? selectedRange.from : \"\";\n\tconst rangeTo = mode === \"range\" ? selectedRange.to : undefined;\n\tconst label = formatTriggerLabel({\n\t\tmode,\n\t\tselectedDate,\n\t\trangeFrom,\n\t\trangeTo,\n\t\tlocale,\n\t\tformatDate,\n\t\tplaceholder: labels?.placeholder,\n\t});\n\tconst calendarLabel = labels?.calendar ?? (ariaLabel ? `${ariaLabel} calendar` : \"Date calendar\");\n\tconst prevMonthLabel = labels?.previousMonth ?? \"Prev\";\n\tconst nextMonthLabel = labels?.nextMonth ?? \"Next\";\n\n\tfunction selectable(iso: string) {\n\t\treturn dateSelectable(iso, min, max, isDisabledDate);\n\t}\n\n\tfunction commit(next: string) {\n\t\tif (disabled || readOnly || !selectable(next)) {\n\t\t\treturn;\n\t\t}\n\t\tif (next) {\n\t\t\tsetIsInvalid(false);\n\t\t\tsetValidationMessage(\"\");\n\t\t}\n\t\tif (mode === \"range\") {\n\t\t\tconst current = rangeValue ?? uncontrolledRange;\n\t\t\tconst nextRange =\n\t\t\t\t!current.from || current.to\n\t\t\t\t\t? { from: next }\n\t\t\t\t\t: compareCivil(\n\t\t\t\t\t\t\t\tparseIso(next) ?? { y: 1, m: 1, d: 1 },\n\t\t\t\t\t\t\t\tparseIso(current.from) ?? { y: 1, m: 1, d: 1 },\n\t\t\t\t\t\t\t) < 0\n\t\t\t\t\t\t? { from: next, to: current.from }\n\t\t\t\t\t\t: { from: current.from, to: next };\n\t\t\tif (rangeValue === undefined) {\n\t\t\t\tsetUncontrolledRange(nextRange);\n\t\t\t}\n\t\t\tonRangeChange?.(nextRange);\n\t\t\tif (nextRange.to) {\n\t\t\t\tsetOpen(false);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (value === undefined) {\n\t\t\tsetUncontrolled(next);\n\t\t}\n\t\tsetOpen(false);\n\t\tonChange?.(next);\n\t}\n\n\tfunction applyPreset(preset: DatePickerPreset) {\n\t\tif (disabled || readOnly) {\n\t\t\treturn;\n\t\t}\n\t\tif (typeof preset.value === \"string\") {\n\t\t\tif (mode === \"range\") {\n\t\t\t\tif (!selectable(preset.value)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst nextRange = { from: preset.value, to: preset.value };\n\t\t\t\tif (rangeValue === undefined) {\n\t\t\t\t\tsetUncontrolledRange(nextRange);\n\t\t\t\t}\n\t\t\t\tonRangeChange?.(nextRange);\n\t\t\t\tsetOpen(false);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcommit(preset.value);\n\t\t\treturn;\n\t\t}\n\t\tif (mode === \"range\") {\n\t\t\tif (!selectable(preset.value.from) || !selectable(preset.value.to)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (rangeValue === undefined) {\n\t\t\t\tsetUncontrolledRange(preset.value);\n\t\t\t}\n\t\t\tonRangeChange?.(preset.value);\n\t\t\tsetOpen(false);\n\t\t}\n\t}\n\n\tconst handleHiddenRef = React.useCallback(\n\t\t(node: HTMLInputElement | null) => {\n\t\t\thiddenRef.current = node;\n\t\t\tif (!externalRef) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (typeof externalRef === \"function\") {\n\t\t\t\tconst cleanup = externalRef(node);\n\t\t\t\tif (typeof cleanup === \"function\") {\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\thiddenRef.current = null;\n\t\t\t\t\t\tcleanup();\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn () => {\n\t\t\t\t\thiddenRef.current = null;\n\t\t\t\t\texternalRef(null);\n\t\t\t\t};\n\t\t\t}\n\t\t\t(externalRef as React.RefObject<HTMLInputElement | null>).current = node;\n\t\t\treturn () => {\n\t\t\t\thiddenRef.current = null;\n\t\t\t\t(externalRef as React.RefObject<HTMLInputElement | null>).current = null;\n\t\t\t};\n\t\t},\n\t\t[externalRef],\n\t);\n\n\tconst invalidState = ariaInvalid ?? (isInvalid || undefined);\n\tconst hasDestructiveStyle =\n\t\tinvalidState === true ||\n\t\tinvalidState === \"true\" ||\n\t\tinvalidState === \"grammar\" ||\n\t\tinvalidState === \"spelling\";\n\n\tconst describedBy =\n\t\t[ariaDescribedBy, isInvalid && errorId ? errorId : undefined].filter(Boolean).join(\" \") ||\n\t\tundefined;\n\n\treturn (\n\t\t<Popover\n\t\t\topen={open}\n\t\t\tonOpenChange={(next) => {\n\t\t\t\tif (next && disabled) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (next) {\n\t\t\t\t\tpendingFocus.current = null;\n\t\t\t\t\tif (controlledMonthProp === undefined && defaultMonthProp === undefined) {\n\t\t\t\t\t\tconst synced = (cursorIso ? parseIso(cursorIso) : null) ?? todayCivil(timeZone);\n\t\t\t\t\t\tsetUncontrolledMonth({ y: synced.y, m: synced.m, d: 1 });\n\t\t\t\t\t}\n\t\t\t\t\tfocusDay.current = true;\n\t\t\t\t} else {\n\t\t\t\t\tpendingFocus.current = null;\n\t\t\t\t}\n\t\t\t\tsetOpen(next);\n\t\t\t}}\n\t\t>\n\t\t\t<input\n\t\t\t\tref={handleHiddenRef}\n\t\t\t\ttype={mode === \"range\" ? \"text\" : \"date\"}\n\t\t\t\tname={name}\n\t\t\t\trequired={required}\n\t\t\t\treadOnly={readOnly}\n\t\t\t\tmin={mode === \"range\" ? undefined : min}\n\t\t\t\tmax={mode === \"range\" ? undefined : max}\n\t\t\t\tclassName=\"sr-only mb-2 h-7\"\n\t\t\t\tstyle={{\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\twidth: 1,\n\t\t\t\t\theight: 1,\n\t\t\t\t\toverflow: \"hidden\",\n\t\t\t\t\tclip: \"rect(0, 0, 0, 0)\",\n\t\t\t\t}}\n\t\t\t\tvalue={\n\t\t\t\t\tmode === \"range\" ? (rangeFrom && rangeTo ? `${rangeFrom}/${rangeTo}` : \"\") : submitted\n\t\t\t\t}\n\t\t\t\tonChange={() => undefined}\n\t\t\t\tonInvalid={(event) => {\n\t\t\t\t\texternalOnInvalid?.(event);\n\t\t\t\t\tif (!event.defaultPrevented) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tsetIsInvalid(true);\n\t\t\t\t\t\tsetValidationMessage(\n\t\t\t\t\t\t\tlabels?.validationMessage ||\n\t\t\t\t\t\t\t\t(event.target as HTMLInputElement).validationMessage ||\n\t\t\t\t\t\t\t\t\"Please fill out this field.\",\n\t\t\t\t\t\t);\n\t\t\t\t\t\ttriggerRef.current?.focus();\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\tdisabled={disabled}\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\ttabIndex={-1}\n\t\t\t\t{...formRest}\n\t\t\t/>\n\t\t\t<PopoverTrigger asChild>\n\t\t\t\t<Button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tref={triggerRef}\n\t\t\t\t\tid={id}\n\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tonFocus={onFocus as ComponentProps<\"button\">[\"onFocus\"]}\n\t\t\t\t\tonBlur={onBlur as ComponentProps<\"button\">[\"onBlur\"]}\n\t\t\t\t\taria-labelledby={ariaLabelledBy}\n\t\t\t\t\taria-label={\n\t\t\t\t\t\tariaLabel ? (label === \"Pick a date\" ? ariaLabel : `${ariaLabel}: ${label}`) : undefined\n\t\t\t\t\t}\n\t\t\t\t\taria-describedby={describedBy}\n\t\t\t\t\taria-invalid={invalidState}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\"justify-start font-normal\",\n\t\t\t\t\t\thasDestructiveStyle && \"border-basalt-destructive text-basalt-destructive\",\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t</Button>\n\t\t\t</PopoverTrigger>\n\t\t\t{isInvalid && validationMessage ? (\n\t\t\t\t<span id={errorId} role=\"alert\" className=\"mt-1 block text-xs text-basalt-destructive\">\n\t\t\t\t\t{validationMessage}\n\t\t\t\t</span>\n\t\t\t) : null}\n\t\t\t<PopoverContent\n\t\t\t\tarrow={false}\n\t\t\t\tclassName=\"w-64 p-3\"\n\t\t\t\taria-label={calendarLabel}\n\t\t\t\taria-describedby={keyboardInstructionsId}\n\t\t\t\tonOpenAutoFocus={(event) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tconst iso = cursorIso || submitted || formatIso(todayCivil(timeZone));\n\t\t\t\t\tconst selectedIndex = days.findIndex((date) => isoOf(date) === iso);\n\t\t\t\t\tconst enabled = (date: Civil | null) =>\n\t\t\t\t\t\tBoolean(\n\t\t\t\t\t\t\tdate && date.y >= 1 && dateSelectable(formatIso(date), min, max, isDisabledDate),\n\t\t\t\t\t\t);\n\t\t\t\t\tlet index =\n\t\t\t\t\t\tselectedIndex >= 0 && days[selectedIndex]?.m === activeMonth.m\n\t\t\t\t\t\t\t? selectedIndex\n\t\t\t\t\t\t\t: Math.max(\n\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\tdays.findIndex((date) => date?.m === activeMonth.m),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\tif (!enabled(days[index] ?? null)) {\n\t\t\t\t\t\tconst inMonth = days.findIndex((date) => date?.m === activeMonth.m && enabled(date));\n\t\t\t\t\t\tconst any = days.findIndex((date) => enabled(date));\n\t\t\t\t\t\tindex = inMonth >= 0 ? inMonth : any >= 0 ? any : index;\n\t\t\t\t\t}\n\t\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t\tdayRefs.current[index]?.focus();\n\t\t\t\t\t});\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{presets && presets.length > 0 ? (\n\t\t\t\t\t<div className=\"mb-2 flex flex-wrap gap-1\">\n\t\t\t\t\t\t{presets.map((preset) => (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tkey={preset.label}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\tclassName=\"h-7 px-2 text-xs\"\n\t\t\t\t\t\t\t\tdisabled={disabled || readOnly}\n\t\t\t\t\t\t\t\tonClick={() => applyPreset(preset)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{preset.label}\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t\t<div className=\"mb-2 flex items-center justify-between gap-2\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\ticon={<ChevronLeft />}\n\t\t\t\t\t\taria-label={prevMonthLabel}\n\t\t\t\t\t\tclassName=\"size-8\"\n\t\t\t\t\t\tdisabled={disabled || !previousMonth || previousMonth.y < 1}\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tif (!previousMonth || previousMonth.y < 1) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpendingFocus.current = null;\n\t\t\t\t\t\t\tfocusDay.current = false;\n\t\t\t\t\t\t\trequestMonth(previousMonth);\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t<span\n\t\t\t\t\t\tid={monthLiveId}\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\tclassName=\"text-sm font-medium\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{formatCivil(activeMonth, locale, { month: \"long\", year: \"numeric\" })}\n\t\t\t\t\t</span>\n\t\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\ticon={<ChevronRight />}\n\t\t\t\t\t\taria-label={nextMonthLabel}\n\t\t\t\t\t\tclassName=\"size-8\"\n\t\t\t\t\t\tdisabled={disabled || !followingMonth}\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tif (!followingMonth) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpendingFocus.current = null;\n\t\t\t\t\t\t\tfocusDay.current = false;\n\t\t\t\t\t\t\trequestMonth(followingMonth);\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<p id={keyboardInstructionsId} className=\"sr-only\">\n\t\t\t\t\t{labels?.keyboardInstructions ??\n\t\t\t\t\t\t\"Use arrow keys to navigate dates, PageUp and PageDown to change months, and Enter or Space to select.\"}\n\t\t\t\t</p>\n\t\t\t\t{/* Biome override: WAI-ARIA APG Date Picker pattern uses a semantic table with role=\"grid\" and role=\"gridcell\" on cells while roving tabindex focuses the child button */}\n\t\t\t\t<table\n\t\t\t\t\trole=\"grid\"\n\t\t\t\t\taria-labelledby={monthLiveId}\n\t\t\t\t\taria-multiselectable={mode === \"range\" ? \"true\" : undefined}\n\t\t\t\t\tclassName=\"w-full border-collapse text-center\"\n\t\t\t\t\tonKeyDown={(event) => {\n\t\t\t\t\t\tconst current = days[focusIndex];\n\t\t\t\t\t\tif (!current) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tevent.key === \"ArrowRight\" ||\n\t\t\t\t\t\t\tevent.key === \"ArrowLeft\" ||\n\t\t\t\t\t\t\tevent.key === \"ArrowDown\" ||\n\t\t\t\t\t\t\tevent.key === \"ArrowUp\"\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tconst delta =\n\t\t\t\t\t\t\t\tevent.key === \"ArrowRight\"\n\t\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t\t: event.key === \"ArrowLeft\"\n\t\t\t\t\t\t\t\t\t\t? -1\n\t\t\t\t\t\t\t\t\t\t: event.key === \"ArrowDown\"\n\t\t\t\t\t\t\t\t\t\t\t? 7\n\t\t\t\t\t\t\t\t\t\t\t: -7;\n\t\t\t\t\t\t\tlet next = addDays(current, delta);\n\t\t\t\t\t\t\tfor (\n\t\t\t\t\t\t\t\tlet step = 0;\n\t\t\t\t\t\t\t\tnext && next.y >= 1 && !selectable(formatIso(next)) && step < 42;\n\t\t\t\t\t\t\t\tstep += 1\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnext = addDays(next, delta);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!next || next.y < 1 || !selectable(formatIso(next))) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (next.y !== activeMonth.y || next.m !== activeMonth.m) {\n\t\t\t\t\t\t\t\tpendingFocus.current = {\n\t\t\t\t\t\t\t\t\ttargetMonthKey: formatIsoMonth(next),\n\t\t\t\t\t\t\t\t\tiso: formatIso(next),\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\trequestMonth({ y: next.y, m: next.m, d: 1 });\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst index = days.findIndex((date) => isoOf(date) === formatIso(next));\n\t\t\t\t\t\t\tif (index >= 0) {\n\t\t\t\t\t\t\t\tsetFocusIndex(index);\n\t\t\t\t\t\t\t\tdayRefs.current[index]?.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (event.key === \"Home\" || event.key === \"End\") {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tconst dayOfWeek = utcDate(current).getUTCDay();\n\t\t\t\t\t\t\tconst col = (dayOfWeek - weekStartsOn + 7) % 7;\n\t\t\t\t\t\t\tconst deltaToEdge = event.key === \"Home\" ? -col : 6 - col;\n\t\t\t\t\t\t\tlet next: Civil | null = addDays(current, deltaToEdge);\n\t\t\t\t\t\t\tconst stepDir = event.key === \"Home\" ? 1 : -1;\n\t\t\t\t\t\t\tfor (\n\t\t\t\t\t\t\t\tlet step = 0;\n\t\t\t\t\t\t\t\tnext && next.y >= 1 && !selectable(formatIso(next)) && step < 7;\n\t\t\t\t\t\t\t\tstep += 1\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnext = addDays(next, stepDir);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!next || next.y < 1 || !selectable(formatIso(next))) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (next.y !== activeMonth.y || next.m !== activeMonth.m) {\n\t\t\t\t\t\t\t\tpendingFocus.current = {\n\t\t\t\t\t\t\t\t\ttargetMonthKey: formatIsoMonth(next),\n\t\t\t\t\t\t\t\t\tiso: formatIso(next),\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\trequestMonth({ y: next.y, m: next.m, d: 1 });\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst index = days.findIndex((date) => isoOf(date) === formatIso(next));\n\t\t\t\t\t\t\tif (index >= 0) {\n\t\t\t\t\t\t\t\tsetFocusIndex(index);\n\t\t\t\t\t\t\t\tdayRefs.current[index]?.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (event.key === \"PageDown\" || event.key === \"PageUp\") {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tconst deltaMonths = event.shiftKey\n\t\t\t\t\t\t\t\t? event.key === \"PageDown\"\n\t\t\t\t\t\t\t\t\t? 12\n\t\t\t\t\t\t\t\t\t: -12\n\t\t\t\t\t\t\t\t: event.key === \"PageDown\"\n\t\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t\t: -1;\n\t\t\t\t\t\t\tconst target = shiftCivilMonthClamped(current, deltaMonths);\n\t\t\t\t\t\t\tif (!target) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlet next: Civil | null = target;\n\t\t\t\t\t\t\tfor (\n\t\t\t\t\t\t\t\tlet step = 0;\n\t\t\t\t\t\t\t\tnext && next.y >= 1 && !selectable(formatIso(next)) && step < 42;\n\t\t\t\t\t\t\t\tstep += 1\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnext = addDays(next, 1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!next || next.y < 1 || !selectable(formatIso(next))) {\n\t\t\t\t\t\t\t\tnext = target;\n\t\t\t\t\t\t\t\tfor (\n\t\t\t\t\t\t\t\t\tlet step = 0;\n\t\t\t\t\t\t\t\t\tnext && next.y >= 1 && !selectable(formatIso(next)) && step < 42;\n\t\t\t\t\t\t\t\t\tstep += 1\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tnext = addDays(next, -1);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!next || next.y < 1 || !selectable(formatIso(next))) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpendingFocus.current = {\n\t\t\t\t\t\t\t\ttargetMonthKey: formatIsoMonth(next),\n\t\t\t\t\t\t\t\tiso: formatIso(next),\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\trequestMonth({ y: next.y, m: next.m, d: 1 });\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (event.key === \"Enter\" || event.key === \" \") {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tconst iso = formatIso(current);\n\t\t\t\t\t\t\tif (current.y >= 1 && selectable(iso)) {\n\t\t\t\t\t\t\t\tcommit(iso);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t{weekdayLabels.map((day, index) => (\n\t\t\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t\t\tkey={`${day}-${index}`}\n\t\t\t\t\t\t\t\t\tscope=\"col\"\n\t\t\t\t\t\t\t\t\tclassName=\"h-8 text-center text-xs font-medium text-basalt-muted-foreground\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{day}\n\t\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t{Array.from({ length: 6 }, (_, weekIndex) => (\n\t\t\t\t\t\t\t<tr key={`week-${weekIndex}`}>\n\t\t\t\t\t\t\t\t{days.slice(weekIndex * 7, weekIndex * 7 + 7).map((date, colIndex) => {\n\t\t\t\t\t\t\t\t\tconst index = weekIndex * 7 + colIndex;\n\t\t\t\t\t\t\t\t\tif (!date) {\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<td\n\t\t\t\t\t\t\t\t\t\t\t\tkey={`empty-${index}`}\n\t\t\t\t\t\t\t\t\t\t\t\trole=\"gridcell\"\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"h-8 p-0 text-center\"\n\t\t\t\t\t\t\t\t\t\t\t\tref={() => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tdayRefs.current[index] = null;\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tconst iso = formatIso(date);\n\t\t\t\t\t\t\t\t\tconst inMonth = date.m === activeMonth.m;\n\t\t\t\t\t\t\t\t\tconst inRange = date.y >= 1 && selectable(iso);\n\t\t\t\t\t\t\t\t\tconst fromDate = rangeFrom ? parseIso(rangeFrom) : null;\n\t\t\t\t\t\t\t\t\tconst toDate = rangeTo ? parseIso(rangeTo) : null;\n\t\t\t\t\t\t\t\t\tconst thisDate = parseIso(iso);\n\t\t\t\t\t\t\t\t\tconst inSelectedRange = Boolean(\n\t\t\t\t\t\t\t\t\t\tfromDate &&\n\t\t\t\t\t\t\t\t\t\t\ttoDate &&\n\t\t\t\t\t\t\t\t\t\t\tthisDate &&\n\t\t\t\t\t\t\t\t\t\t\tcompareCivil(thisDate, fromDate) >= 0 &&\n\t\t\t\t\t\t\t\t\t\t\tcompareCivil(thisDate, toDate) <= 0,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tconst isRangeEdge = iso === rangeFrom || iso === rangeTo;\n\t\t\t\t\t\t\t\t\tconst isSelected =\n\t\t\t\t\t\t\t\t\t\tmode === \"range\"\n\t\t\t\t\t\t\t\t\t\t\t? inSelectedRange || isRangeEdge\n\t\t\t\t\t\t\t\t\t\t\t: Boolean(submitted) && iso === submitted;\n\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<td\n\t\t\t\t\t\t\t\t\t\t\tkey={iso}\n\t\t\t\t\t\t\t\t\t\t\trole=\"gridcell\"\n\t\t\t\t\t\t\t\t\t\t\taria-selected={isSelected ? \"true\" : undefined}\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"h-8 p-0 text-center\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\t\tref={(node) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tdayRefs.current[index] = node;\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\ttabIndex={index === focusIndex ? 0 : -1}\n\t\t\t\t\t\t\t\t\t\t\t\tdata-date={iso}\n\t\t\t\t\t\t\t\t\t\t\t\taria-label={iso}\n\t\t\t\t\t\t\t\t\t\t\t\taria-pressed={mode === \"range\" ? isRangeEdge : isSelected}\n\t\t\t\t\t\t\t\t\t\t\t\tdisabled={disabled || readOnly || !inRange}\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t\tCALENDAR_BUTTON,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"mx-auto flex h-8 w-8 items-center justify-center rounded-basalt-md text-sm\",\n\t\t\t\t\t\t\t\t\t\t\t\t\tinMonth ? \"text-basalt-foreground\" : \"text-basalt-muted-foreground\",\n\t\t\t\t\t\t\t\t\t\t\t\t\tinRange && \"hover:bg-basalt-accent\",\n\t\t\t\t\t\t\t\t\t\t\t\t\tinSelectedRange && !isRangeEdge && \"bg-basalt-accent\",\n\t\t\t\t\t\t\t\t\t\t\t\t\tinRange &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t(mode === \"range\" ? isRangeEdge : isSelected) &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"bg-basalt-primary text-basalt-primary-foreground hover:bg-basalt-primary/90\",\n\t\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,KAAK,IAE9B,IAAc,MAAQ,KAAa,MAAQ,GAC3C,IACL,MAAS,UACN,MAAmB,IACnB,EAAQ,KAAc,MAAQ;OAElC,OACC,kBAAC,MAAD;QAEC,MAAK;QACL,iBAAe,IAAa,SAAS,KAAA;QACrC,WAAU;QAEV,UAAA,kBAAC,UAAD;SACC,MAAK;SACL,MAAM,MAAS;UACd,EAAQ,QAAQ,KAAS;SAC1B;SACA,UAAU,MAAU,KAAa,IAAI;SACrC,aAAW;SACX,cAAY;SACZ,gBAAc,MAAS,UAAU,IAAc;SAC/C,UAAU,KAAY,KAAY,CAAC;SACnC,WAAW,EACV,IACA,8EACA,IAAU,2BAA2B,gCACrC,KAAW,0BACX,MAAmB,CAAC,KAAe,oBACnC,MACE,MAAS,UAAU,IAAc,MAClC,6EACF;SACA,eAAe,KAAW,GAAO,CAAG;SAEnC,UAAA,EAAK;QACC,CAAA;OACL,GA7BE,CA6BF;MAEN,CAAC,EACE,GApEK,QAAQ,GAoEb,CACJ,EACK,CAAA,CACD;;IACQ;;EACR;;AAEX"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type DeleteResourceErrorFormatter = (error: unknown) => React.ReactNode;
|
|
1
3
|
export type DeleteResourceProps = {
|
|
4
|
+
/** Name of the resource being deleted, interpolated into dialog title and trigger label. */
|
|
2
5
|
name: string;
|
|
6
|
+
/** Called when deletion is confirmed. When this throws or rejects, an error alert is shown and the dialog remains open for retry. */
|
|
3
7
|
onDelete: () => void | Promise<void>;
|
|
8
|
+
/** Custom error message or renderer when onDelete fails. Accepts a ReactNode or an (error: unknown) => ReactNode formatter. Defaults to the caught Error message or 'Failed to delete resource. Please try again.' */
|
|
9
|
+
errorMessage?: React.ReactNode | DeleteResourceErrorFormatter;
|
|
4
10
|
};
|
|
5
|
-
export declare function DeleteResource({ name, onDelete }: DeleteResourceProps):
|
|
11
|
+
export declare function DeleteResource({ name, onDelete, errorMessage }: DeleteResourceProps): React.JSX.Element;
|
|
@@ -1,38 +1,42 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Button as e } from "./button.js";
|
|
3
3
|
import { ConfirmDialog as t } from "./confirm-dialog.js";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
4
|
+
import * as n from "react";
|
|
5
|
+
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/delete-resource.tsx
|
|
7
|
-
function
|
|
8
|
-
let [
|
|
9
|
-
return /* @__PURE__ */
|
|
10
|
-
trigger: /* @__PURE__ */
|
|
7
|
+
function o({ name: o, onDelete: s, errorMessage: c }) {
|
|
8
|
+
let [l, u] = n.useState(!1), [d, f] = n.useState(!1), [p, m] = n.useState(null), h = (e) => typeof c == "function" ? c(e) : c ?? (e instanceof Error && e.message ? e.message : "Failed to delete resource. Please try again.");
|
|
9
|
+
return /* @__PURE__ */ i(t, {
|
|
10
|
+
trigger: /* @__PURE__ */ a(e, {
|
|
11
11
|
variant: "destructive",
|
|
12
|
-
children: ["Delete ",
|
|
12
|
+
children: ["Delete ", o]
|
|
13
13
|
}),
|
|
14
|
-
open:
|
|
15
|
-
loading:
|
|
14
|
+
open: l,
|
|
15
|
+
loading: d,
|
|
16
16
|
variant: "destructive",
|
|
17
|
-
title: `Delete ${
|
|
18
|
-
description: "This cannot be undone.",
|
|
17
|
+
title: `Delete ${o}?`,
|
|
18
|
+
description: /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i("span", { children: "This cannot be undone." }), p ? /* @__PURE__ */ i("span", {
|
|
19
|
+
role: "alert",
|
|
20
|
+
className: "mt-2 block text-xs text-basalt-destructive",
|
|
21
|
+
children: p
|
|
22
|
+
}) : null] }),
|
|
19
23
|
confirmLabel: "Delete",
|
|
20
24
|
onOpenChange: (e) => {
|
|
21
|
-
|
|
25
|
+
d && !e || (u(e), e || (f(!1), m(null)));
|
|
22
26
|
},
|
|
23
27
|
onConfirm: async () => {
|
|
24
|
-
|
|
28
|
+
f(!0), m(null);
|
|
25
29
|
try {
|
|
26
|
-
await
|
|
27
|
-
} catch {
|
|
28
|
-
|
|
30
|
+
await s(), u(!1);
|
|
31
|
+
} catch (e) {
|
|
32
|
+
m(h(e)), u(!0);
|
|
29
33
|
} finally {
|
|
30
|
-
|
|
34
|
+
f(!1);
|
|
31
35
|
}
|
|
32
36
|
}
|
|
33
37
|
});
|
|
34
38
|
}
|
|
35
39
|
//#endregion
|
|
36
|
-
export {
|
|
40
|
+
export { o as DeleteResource };
|
|
37
41
|
|
|
38
42
|
//# sourceMappingURL=delete-resource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-resource.js","names":[],"sources":["../../src/components/delete-resource.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"delete-resource.js","names":[],"sources":["../../src/components/delete-resource.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Button } from \"./button\";\nimport { ConfirmDialog } from \"./confirm-dialog\";\n\nexport type DeleteResourceErrorFormatter = (error: unknown) => React.ReactNode;\n\nexport type DeleteResourceProps = {\n\t/** Name of the resource being deleted, interpolated into dialog title and trigger label. */\n\tname: string;\n\t/** Called when deletion is confirmed. When this throws or rejects, an error alert is shown and the dialog remains open for retry. */\n\tonDelete: () => void | Promise<void>;\n\t/** Custom error message or renderer when onDelete fails. Accepts a ReactNode or an (error: unknown) => ReactNode formatter. Defaults to the caught Error message or 'Failed to delete resource. Please try again.' */\n\terrorMessage?: React.ReactNode | DeleteResourceErrorFormatter;\n};\n\nexport function DeleteResource({ name, onDelete, errorMessage }: DeleteResourceProps) {\n\tconst [open, setOpen] = React.useState(false);\n\tconst [loading, setLoading] = React.useState(false);\n\tconst [error, setError] = React.useState<React.ReactNode | null>(null);\n\n\tconst resolveErrorMessage = (err: unknown): React.ReactNode => {\n\t\tif (typeof errorMessage === \"function\") {\n\t\t\treturn errorMessage(err);\n\t\t}\n\t\tif (errorMessage != null) {\n\t\t\treturn errorMessage;\n\t\t}\n\t\tif (err instanceof Error && err.message) {\n\t\t\treturn err.message;\n\t\t}\n\t\treturn \"Failed to delete resource. Please try again.\";\n\t};\n\n\treturn (\n\t\t<ConfirmDialog\n\t\t\ttrigger={<Button variant=\"destructive\">Delete {name}</Button>}\n\t\t\topen={open}\n\t\t\tloading={loading}\n\t\t\tvariant=\"destructive\"\n\t\t\ttitle={`Delete ${name}?`}\n\t\t\tdescription={\n\t\t\t\t<>\n\t\t\t\t\t<span>This cannot be undone.</span>\n\t\t\t\t\t{error ? (\n\t\t\t\t\t\t<span role=\"alert\" className=\"mt-2 block text-xs text-basalt-destructive\">\n\t\t\t\t\t\t\t{error}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : null}\n\t\t\t\t</>\n\t\t\t}\n\t\t\tconfirmLabel=\"Delete\"\n\t\t\tonOpenChange={(next) => {\n\t\t\t\tif (loading && !next) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tsetOpen(next);\n\t\t\t\tif (!next) {\n\t\t\t\t\tsetLoading(false);\n\t\t\t\t\tsetError(null);\n\t\t\t\t}\n\t\t\t}}\n\t\t\tonConfirm={async () => {\n\t\t\t\tsetLoading(true);\n\t\t\t\tsetError(null);\n\t\t\t\ttry {\n\t\t\t\t\tawait onDelete();\n\t\t\t\t\tsetOpen(false);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tsetError(resolveErrorMessage(err));\n\t\t\t\t\tsetOpen(true);\n\t\t\t\t} finally {\n\t\t\t\t\tsetLoading(false);\n\t\t\t\t}\n\t\t\t}}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;AAeA,SAAgB,EAAe,EAAE,SAAM,aAAU,mBAAqC;CACrF,IAAM,CAAC,GAAM,KAAW,EAAM,SAAS,EAAK,GACtC,CAAC,GAAS,KAAc,EAAM,SAAS,EAAK,GAC5C,CAAC,GAAO,KAAY,EAAM,SAAiC,IAAI,GAE/D,KAAuB,MACxB,OAAO,KAAiB,aACpB,EAAa,CAAG,IAEpB,MAGA,aAAe,SAAS,EAAI,UACxB,EAAI,UAEL;CAGR,OACC,kBAAC,GAAD;EACC,SAAS,kBAAC,GAAD;GAAQ,SAAQ;GAAhB,UAAA,CAA8B,WAAQ,CAAa;;EACtD;EACG;EACT,SAAQ;EACR,OAAO,UAAU,EAAK;EACtB,aACC,kBAAA,GAAA,EAAA,UAAA,CACC,kBAAC,QAAD,EAAA,UAAM,yBAA4B,CAAA,GACjC,IACA,kBAAC,QAAD;GAAM,MAAK;GAAQ,WAAU;GAC3B,UAAA;EACI,CAAA,IACH,IACH,EAAA,CAAA;EAEH,cAAa;EACb,eAAe,MAAS;GACnB,KAAW,CAAC,MAGhB,EAAQ,CAAI,GACP,MACJ,EAAW,EAAK,GAChB,EAAS,IAAI;EAEf;EACA,WAAW,YAAY;GAEtB,AADA,EAAW,EAAI,GACf,EAAS,IAAI;GACb,IAAI;IAEH,AADA,MAAM,EAAS,GACf,EAAQ,EAAK;GACd,SAAS,GAAK;IAEb,AADA,EAAS,EAAoB,CAAG,CAAC,GACjC,EAAQ,EAAI;GACb,UAAU;IACT,EAAW,EAAK;GACjB;EACD;CACA,CAAA;AAEH"}
|
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../utils/cn.js";
|
|
3
|
-
import {
|
|
3
|
+
import { BASALT_UI_CLASS as t } from "../utils/control-surface.js";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
5
|
//#region src/components/description-list.tsx
|
|
5
|
-
var
|
|
6
|
+
var i = {
|
|
6
7
|
1: "sm:grid-cols-1",
|
|
7
8
|
2: "sm:grid-cols-2",
|
|
8
9
|
3: "sm:grid-cols-3"
|
|
9
10
|
};
|
|
10
|
-
function
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
className: e("grid gap-x-8 gap-y-3 text-sm",
|
|
13
|
-
...
|
|
11
|
+
function a({ className: r, columns: a = 2, ...o }) {
|
|
12
|
+
return /* @__PURE__ */ n("dl", {
|
|
13
|
+
className: e(t, "grid gap-x-8 gap-y-3 text-sm", i[a], r),
|
|
14
|
+
...o
|
|
14
15
|
});
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
-
function
|
|
18
|
-
return /* @__PURE__ */
|
|
17
|
+
a.displayName = "DescriptionList";
|
|
18
|
+
function o({ term: t, className: i, children: a, ...o }) {
|
|
19
|
+
return /* @__PURE__ */ r("div", {
|
|
19
20
|
className: e("min-w-0", i),
|
|
20
21
|
...o,
|
|
21
|
-
children: [/* @__PURE__ */
|
|
22
|
+
children: [/* @__PURE__ */ n("dt", {
|
|
22
23
|
className: "text-xs text-basalt-muted-foreground",
|
|
23
|
-
children:
|
|
24
|
-
}), /* @__PURE__ */
|
|
24
|
+
children: t
|
|
25
|
+
}), /* @__PURE__ */ n("dd", {
|
|
25
26
|
className: "mt-0.5 wrap-break-word text-basalt-foreground",
|
|
26
27
|
children: a
|
|
27
28
|
})]
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
var
|
|
31
|
+
o.displayName = "DescriptionList.Item";
|
|
32
|
+
var s = Object.assign(a, { Item: o });
|
|
32
33
|
//#endregion
|
|
33
|
-
export {
|
|
34
|
+
export { s as DescriptionList };
|
|
34
35
|
|
|
35
36
|
//# sourceMappingURL=description-list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"description-list.js","names":[],"sources":["../../src/components/description-list.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"../utils/cn\";\n\nexport type DescriptionListColumns = 1 | 2 | 3;\n\nexport type DescriptionListProps = HTMLAttributes<HTMLDListElement> & {\n\t/**\n\t * Number of term/value columns from the small breakpoint up.\n\t * @default 2\n\t */\n\tcolumns?: DescriptionListColumns;\n};\n\nconst COLUMN_CLASS: Record<DescriptionListColumns, string> = {\n\t1: \"sm:grid-cols-1\",\n\t2: \"sm:grid-cols-2\",\n\t3: \"sm:grid-cols-3\",\n};\n\nfunction DescriptionListRoot({ className, columns = 2, ...props }: DescriptionListProps) {\n\treturn (\n\t\t<dl\n\t\t\tclassName={cn(\"grid gap-x-8 gap-y-3 text-sm\"
|
|
1
|
+
{"version":3,"file":"description-list.js","names":[],"sources":["../../src/components/description-list.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { BASALT_UI_CLASS } from \"../utils/control-surface\";\n\nexport type DescriptionListColumns = 1 | 2 | 3;\n\nexport type DescriptionListProps = HTMLAttributes<HTMLDListElement> & {\n\t/**\n\t * Number of term/value columns from the small breakpoint up.\n\t * @default 2\n\t */\n\tcolumns?: DescriptionListColumns;\n};\n\nconst COLUMN_CLASS: Record<DescriptionListColumns, string> = {\n\t1: \"sm:grid-cols-1\",\n\t2: \"sm:grid-cols-2\",\n\t3: \"sm:grid-cols-3\",\n};\n\nfunction DescriptionListRoot({ className, columns = 2, ...props }: DescriptionListProps) {\n\treturn (\n\t\t<dl\n\t\t\tclassName={cn(\n\t\t\t\tBASALT_UI_CLASS,\n\t\t\t\t\"grid gap-x-8 gap-y-3 text-sm\",\n\t\t\t\tCOLUMN_CLASS[columns],\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\nDescriptionListRoot.displayName = \"DescriptionList\";\n\nexport type DescriptionListItemProps = HTMLAttributes<HTMLDivElement> & {\n\t/**\n\t * Term shown above the value.\n\t */\n\tterm: ReactNode;\n};\n\nfunction DescriptionListItem({ term, className, children, ...props }: DescriptionListItemProps) {\n\treturn (\n\t\t<div className={cn(\"min-w-0\", className)} {...props}>\n\t\t\t<dt className=\"text-xs text-basalt-muted-foreground\">{term}</dt>\n\t\t\t<dd className=\"mt-0.5 wrap-break-word text-basalt-foreground\">{children}</dd>\n\t\t</div>\n\t);\n}\nDescriptionListItem.displayName = \"DescriptionList.Item\";\n\nexport const DescriptionList = Object.assign(DescriptionListRoot, {\n\tItem: DescriptionListItem,\n});\n"],"mappings":";;;;;AAcA,IAAM,IAAuD;CAC5D,GAAG;CACH,GAAG;CACH,GAAG;AACJ;AAEA,SAAS,EAAoB,EAAE,cAAW,aAAU,GAAG,GAAG,KAA+B;CACxF,OACC,kBAAC,MAAD;EACC,WAAW,EACV,GACA,gCACA,EAAa,IACb,CACD;EACA,GAAI;CACJ,CAAA;AAEH;AACA,EAAoB,cAAc;AASlC,SAAS,EAAoB,EAAE,SAAM,cAAW,aAAU,GAAG,KAAmC;CAC/F,OACC,kBAAC,OAAD;EAAK,WAAW,EAAG,WAAW,CAAS;EAAG,GAAI;EAA9C,UAAA,CACC,kBAAC,MAAD;GAAI,WAAU;GAAwC,UAAA;EAAS,CAAA,GAC/D,kBAAC,MAAD;GAAI,WAAU;GAAiD;EAAa,CAAA,CACxE;;AAEP;AACA,EAAoB,cAAc;AAElC,IAAa,IAAkB,OAAO,OAAO,GAAqB,EACjE,MAAM,EACP,CAAC"}
|
|
@@ -12,26 +12,155 @@ export declare function dialogPanelClass({ size, className, }?: {
|
|
|
12
12
|
size?: DialogSize;
|
|
13
13
|
className?: string;
|
|
14
14
|
}): string;
|
|
15
|
-
|
|
15
|
+
type RadixDialogProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
|
|
16
|
+
type RadixDialogTriggerProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;
|
|
17
|
+
type RadixDialogPortalProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;
|
|
18
|
+
type RadixDialogOverlayProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
|
|
19
|
+
type RadixDialogContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
|
|
20
|
+
type RadixDialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;
|
|
21
|
+
type RadixDialogDescriptionProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;
|
|
22
|
+
type RadixDialogCloseProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;
|
|
23
|
+
export interface DialogProps extends Omit<RadixDialogProps, "open" | "defaultOpen" | "onOpenChange" | "modal"> {
|
|
24
|
+
/**
|
|
25
|
+
* Controlled open state of the dialog.
|
|
26
|
+
*/
|
|
27
|
+
open?: RadixDialogProps["open"];
|
|
28
|
+
/**
|
|
29
|
+
* Uncontrolled default open state of the dialog on initial render.
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
defaultOpen?: RadixDialogProps["defaultOpen"];
|
|
33
|
+
/**
|
|
34
|
+
* Callback invoked when the open state changes.
|
|
35
|
+
*/
|
|
36
|
+
onOpenChange?: RadixDialogProps["onOpenChange"];
|
|
37
|
+
/**
|
|
38
|
+
* Whether the dialog renders modally, preventing outside interaction and hiding background content from screen readers.
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
modal?: RadixDialogProps["modal"];
|
|
42
|
+
}
|
|
43
|
+
export declare const Dialog: React.FC<DialogProps>;
|
|
44
|
+
export interface DialogTriggerProps extends Omit<RadixDialogTriggerProps, "asChild"> {
|
|
45
|
+
/**
|
|
46
|
+
* Change the default rendered button element to the child element, merging props and behavior.
|
|
47
|
+
* Trigger forwards ref to HTMLButtonElement and inherits native button attributes.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
asChild?: RadixDialogTriggerProps["asChild"];
|
|
51
|
+
}
|
|
16
52
|
export declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
53
|
+
export interface DialogCloseProps extends Omit<RadixDialogCloseProps, "asChild"> {
|
|
54
|
+
/**
|
|
55
|
+
* Change the default rendered button element to the child element, merging props and behavior.
|
|
56
|
+
* Close forwards ref to HTMLButtonElement and inherits native button attributes.
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
|
+
asChild?: RadixDialogCloseProps["asChild"];
|
|
60
|
+
}
|
|
17
61
|
export declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
62
|
+
export interface DialogPortalProps extends Omit<RadixDialogPortalProps, "container" | "forceMount"> {
|
|
63
|
+
/**
|
|
64
|
+
* Target container element where the dialog overlay and content portal should mount.
|
|
65
|
+
*/
|
|
66
|
+
container?: RadixDialogPortalProps["container"];
|
|
67
|
+
/**
|
|
68
|
+
* Used to force mounting when controlling transition animations externally.
|
|
69
|
+
*/
|
|
70
|
+
forceMount?: RadixDialogPortalProps["forceMount"];
|
|
71
|
+
}
|
|
18
72
|
export declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
73
|
+
export interface DialogOverlayProps extends Omit<RadixDialogOverlayProps, "asChild" | "forceMount"> {
|
|
74
|
+
/**
|
|
75
|
+
* Change the default rendered div element to the child element, merging props and behavior.
|
|
76
|
+
* Overlay forwards ref to HTMLDivElement and inherits native div attributes.
|
|
77
|
+
* @default false
|
|
78
|
+
*/
|
|
79
|
+
asChild?: RadixDialogOverlayProps["asChild"];
|
|
80
|
+
/**
|
|
81
|
+
* Used to force mounting when controlling transition animations externally.
|
|
82
|
+
*/
|
|
83
|
+
forceMount?: RadixDialogOverlayProps["forceMount"];
|
|
84
|
+
}
|
|
85
|
+
export declare const DialogOverlay: React.ForwardRefExoticComponent<DialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
|
|
86
|
+
export interface DialogContentProps extends Omit<RadixDialogContentProps, "size" | "disablePointerDismissal" | "asChild" | "forceMount" | "trapFocus" | "onOpenAutoFocus" | "onCloseAutoFocus" | "onEscapeKeyDown" | "onPointerDownOutside" | "onFocusOutside" | "onInteractOutside"> {
|
|
87
|
+
/**
|
|
88
|
+
* Fixed desktop width preset. Dialog panel scrolls vertically when content overflows available viewport height.
|
|
89
|
+
* @default "base"
|
|
90
|
+
*/
|
|
25
91
|
size?: DialogSize;
|
|
92
|
+
/**
|
|
93
|
+
* When true, pointer interactions outside the dialog panel are prevented from dismissing the dialog.
|
|
94
|
+
* @default false
|
|
95
|
+
*/
|
|
26
96
|
disablePointerDismissal?: boolean;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
97
|
+
/**
|
|
98
|
+
* Change the default rendered div element to the child element, merging props and behavior.
|
|
99
|
+
* Content forwards ref to HTMLDivElement and inherits native div attributes.
|
|
100
|
+
* @default false
|
|
101
|
+
*/
|
|
102
|
+
asChild?: RadixDialogContentProps["asChild"];
|
|
103
|
+
/**
|
|
104
|
+
* Force mounting content in DOM for external animation controls.
|
|
105
|
+
* When forceMount is true, the content remains mounted even when closed.
|
|
106
|
+
* The caller is responsible for visibility transitions and unmounting after animation completes.
|
|
107
|
+
* Note: Keeping modal content forceMounted may isolate background interactions until unmounted.
|
|
108
|
+
*/
|
|
109
|
+
forceMount?: RadixDialogContentProps["forceMount"];
|
|
110
|
+
/**
|
|
111
|
+
* Event handler called when auto-focusing the first element on open. Can be prevented with event.preventDefault().
|
|
112
|
+
*/
|
|
113
|
+
onOpenAutoFocus?: RadixDialogContentProps["onOpenAutoFocus"];
|
|
114
|
+
/**
|
|
115
|
+
* Event handler called when restoring focus on close. Can be prevented with event.preventDefault().
|
|
116
|
+
*/
|
|
117
|
+
onCloseAutoFocus?: RadixDialogContentProps["onCloseAutoFocus"];
|
|
118
|
+
/**
|
|
119
|
+
* Event handler called when the Escape key is pressed. Can be prevented with event.preventDefault().
|
|
120
|
+
*/
|
|
121
|
+
onEscapeKeyDown?: RadixDialogContentProps["onEscapeKeyDown"];
|
|
122
|
+
/**
|
|
123
|
+
* Event handler called when a pointer event occurs outside the dialog bounds.
|
|
124
|
+
*/
|
|
125
|
+
onPointerDownOutside?: RadixDialogContentProps["onPointerDownOutside"];
|
|
126
|
+
/**
|
|
127
|
+
* Event handler called when focus moves outside the dialog bounds.
|
|
128
|
+
*/
|
|
129
|
+
onFocusOutside?: RadixDialogContentProps["onFocusOutside"];
|
|
130
|
+
/**
|
|
131
|
+
* Event handler called when any interaction (pointer or focus) occurs outside the dialog bounds.
|
|
132
|
+
*/
|
|
133
|
+
onInteractOutside?: RadixDialogContentProps["onInteractOutside"];
|
|
134
|
+
}
|
|
135
|
+
export declare const DialogContent: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
136
|
+
export interface DialogTitleProps extends Omit<RadixDialogTitleProps, "asChild"> {
|
|
137
|
+
/**
|
|
138
|
+
* Change the default rendered heading element to the child element, merging props and behavior.
|
|
139
|
+
* Title forwards ref to HTMLHeadingElement and inherits native h2 attributes.
|
|
140
|
+
* @default false
|
|
141
|
+
*/
|
|
142
|
+
asChild?: RadixDialogTitleProps["asChild"];
|
|
143
|
+
}
|
|
144
|
+
export declare const DialogTitle: React.ForwardRefExoticComponent<DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
145
|
+
export interface DialogDescriptionProps extends Omit<RadixDialogDescriptionProps, "asChild"> {
|
|
146
|
+
/**
|
|
147
|
+
* Change the default rendered paragraph element to the child element, merging props and behavior.
|
|
148
|
+
* Description forwards ref to HTMLParagraphElement and inherits native p attributes.
|
|
149
|
+
* @default false
|
|
150
|
+
*/
|
|
151
|
+
asChild?: RadixDialogDescriptionProps["asChild"];
|
|
152
|
+
}
|
|
153
|
+
export declare const DialogDescription: React.ForwardRefExoticComponent<DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
154
|
+
export interface DialogHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
155
|
+
}
|
|
156
|
+
export declare function DialogHeader({ className, ...props }: DialogHeaderProps): React.JSX.Element;
|
|
31
157
|
export declare namespace DialogHeader {
|
|
32
158
|
var displayName: string;
|
|
33
159
|
}
|
|
34
|
-
export
|
|
160
|
+
export interface DialogFooterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
161
|
+
}
|
|
162
|
+
export declare function DialogFooter({ className, ...props }: DialogFooterProps): React.JSX.Element;
|
|
35
163
|
export declare namespace DialogFooter {
|
|
36
164
|
var displayName: string;
|
|
37
165
|
}
|
|
166
|
+
export {};
|