@eifi1/ui-kit 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +32 -0
- package/README.md +498 -57
- package/dist/chart.d.ts +10 -0
- package/dist/chart.js +10 -0
- package/dist/chart.js.map +1 -0
- package/dist/components/account-settings.d.ts +11 -0
- package/dist/components/account-settings.js +19 -12
- package/dist/components/account-settings.js.map +1 -1
- package/dist/components/alert-banner.d.ts +10 -6
- package/dist/components/alert-banner.js +20 -16
- package/dist/components/alert-banner.js.map +1 -1
- package/dist/components/amount-input.d.ts +30 -4
- package/dist/components/amount-input.js +36 -14
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/calculator.d.ts +24 -7
- package/dist/components/calculator.js +37 -20
- package/dist/components/calculator.js.map +1 -1
- package/dist/components/chart-zoom.d.ts +156 -0
- package/dist/components/chart-zoom.js +262 -0
- package/dist/components/chart-zoom.js.map +1 -0
- package/dist/components/chart.d.ts +28 -3
- package/dist/components/chart.js +71 -32
- package/dist/components/chart.js.map +1 -1
- package/dist/components/checkbox.d.ts +51 -0
- package/dist/components/checkbox.js +123 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/chip.d.ts +128 -0
- package/dist/components/chip.js +357 -0
- package/dist/components/chip.js.map +1 -0
- package/dist/components/choice-parts.d.ts +24 -0
- package/dist/components/choice-parts.js +18 -0
- package/dist/components/choice-parts.js.map +1 -0
- package/dist/components/combobox-core.d.ts +52 -9
- package/dist/components/combobox-core.js +91 -20
- package/dist/components/combobox-core.js.map +1 -1
- package/dist/components/combobox.d.ts +43 -33
- package/dist/components/combobox.js +409 -340
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/currency-select.d.ts +48 -8
- package/dist/components/currency-select.js +107 -65
- package/dist/components/currency-select.js.map +1 -1
- package/dist/components/data-table-filter-popover.d.ts +15 -3
- package/dist/components/data-table-filter-popover.js +23 -17
- package/dist/components/data-table-filter-popover.js.map +1 -1
- package/dist/components/data-table-filters.d.ts +1 -1
- package/dist/components/data-table-filters.js +3 -2
- package/dist/components/data-table-filters.js.map +1 -1
- package/dist/components/data-table-labels.d.ts +53 -2
- package/dist/components/data-table-labels.js +31 -2
- package/dist/components/data-table-labels.js.map +1 -1
- package/dist/components/data-table-pagination.d.ts +3 -1
- package/dist/components/data-table-pagination.js +16 -10
- package/dist/components/data-table-pagination.js.map +1 -1
- package/dist/components/data-table-sort.js +1 -0
- package/dist/components/data-table-sort.js.map +1 -1
- package/dist/components/data-table.d.ts +1 -1
- package/dist/components/data-table.js +201 -85
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.d.ts +25 -9
- package/dist/components/date-picker.js +232 -94
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/dropdown.d.ts +96 -20
- package/dist/components/dropdown.js +77 -33
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/entity-combobox.d.ts +5 -4
- package/dist/components/entity-combobox.js +107 -76
- package/dist/components/entity-combobox.js.map +1 -1
- package/dist/components/facing-pair.d.ts +36 -0
- package/dist/components/facing-pair.js +40 -0
- package/dist/components/facing-pair.js.map +1 -0
- package/dist/components/field-sync.d.ts +164 -0
- package/dist/components/field-sync.js +264 -0
- package/dist/components/field-sync.js.map +1 -0
- package/dist/components/file-dropzone.d.ts +38 -6
- package/dist/components/file-dropzone.js +34 -9
- package/dist/components/file-dropzone.js.map +1 -1
- package/dist/components/full-bleed-dialog.d.ts +37 -26
- package/dist/components/full-bleed-dialog.js +20 -5
- package/dist/components/full-bleed-dialog.js.map +1 -1
- package/dist/components/grouped-picker.d.ts +21 -10
- package/dist/components/grouped-picker.js +66 -52
- package/dist/components/grouped-picker.js.map +1 -1
- package/dist/components/hover-menu.d.ts +20 -4
- package/dist/components/hover-menu.js +15 -4
- package/dist/components/hover-menu.js.map +1 -1
- package/dist/components/mini-calendar.d.ts +102 -14
- package/dist/components/mini-calendar.js +256 -70
- package/dist/components/mini-calendar.js.map +1 -1
- package/dist/components/modal.d.ts +9 -3
- package/dist/components/modal.js +34 -45
- package/dist/components/modal.js.map +1 -1
- package/dist/components/month-picker.d.ts +79 -0
- package/dist/components/month-picker.js +342 -0
- package/dist/components/month-picker.js.map +1 -0
- package/dist/components/multi-entity-combobox.d.ts +7 -6
- package/dist/components/multi-entity-combobox.js +112 -72
- package/dist/components/multi-entity-combobox.js.map +1 -1
- package/dist/components/multi-select.d.ts +13 -11
- package/dist/components/multi-select.js +161 -84
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/number-field.d.ts +92 -0
- package/dist/components/number-field.js +111 -0
- package/dist/components/number-field.js.map +1 -0
- package/dist/components/number-input.d.ts +28 -2
- package/dist/components/number-input.js +12 -2
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numpad-sheet.d.ts +32 -4
- package/dist/components/numpad-sheet.js +30 -13
- package/dist/components/numpad-sheet.js.map +1 -1
- package/dist/components/page-contents.d.ts +90 -0
- package/dist/components/page-contents.js +170 -0
- package/dist/components/page-contents.js.map +1 -0
- package/dist/components/password-strength.d.ts +106 -0
- package/dist/components/password-strength.js +132 -0
- package/dist/components/password-strength.js.map +1 -0
- package/dist/components/picker-sheet.d.ts +23 -15
- package/dist/components/picker-sheet.js +34 -14
- package/dist/components/picker-sheet.js.map +1 -1
- package/dist/components/popover.d.ts +62 -4
- package/dist/components/popover.js +52 -2
- package/dist/components/popover.js.map +1 -1
- package/dist/components/search-field.d.ts +25 -7
- package/dist/components/search-field.js +7 -5
- package/dist/components/search-field.js.map +1 -1
- package/dist/components/series-chart-labels.d.ts +14 -0
- package/dist/components/series-chart-labels.js +11 -0
- package/dist/components/series-chart-labels.js.map +1 -0
- package/dist/components/series-chart.d.ts +207 -0
- package/dist/components/series-chart.js +223 -0
- package/dist/components/series-chart.js.map +1 -0
- package/dist/components/settings-fields.d.ts +14 -4
- package/dist/components/settings-fields.js +19 -8
- package/dist/components/settings-fields.js.map +1 -1
- package/dist/components/signature-pad.d.ts +119 -0
- package/dist/components/signature-pad.js +405 -0
- package/dist/components/signature-pad.js.map +1 -0
- package/dist/components/slider.d.ts +80 -0
- package/dist/components/slider.js +155 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/sparkline.d.ts +93 -0
- package/dist/components/sparkline.js +205 -0
- package/dist/components/sparkline.js.map +1 -0
- package/dist/components/stat-tile.d.ts +151 -0
- package/dist/components/stat-tile.js +236 -0
- package/dist/components/stat-tile.js.map +1 -0
- package/dist/components/swipeable-row.d.ts +25 -2
- package/dist/components/swipeable-row.js +31 -0
- package/dist/components/swipeable-row.js.map +1 -1
- package/dist/components/switch.d.ts +60 -0
- package/dist/components/switch.js +81 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/time-input.d.ts +58 -0
- package/dist/components/time-input.js +50 -0
- package/dist/components/time-input.js.map +1 -0
- package/dist/components/toggle-group.d.ts +18 -3
- package/dist/components/toggle-group.js +10 -6
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle-legend.d.ts +115 -0
- package/dist/components/toggle-legend.js +114 -0
- package/dist/components/toggle-legend.js.map +1 -0
- package/dist/components/tooltip.d.ts +40 -11
- package/dist/components/tooltip.js +77 -20
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/treemap.d.ts +132 -0
- package/dist/components/treemap.js +179 -0
- package/dist/components/treemap.js.map +1 -0
- package/dist/components/ui.d.ts +159 -46
- package/dist/components/ui.js +220 -115
- package/dist/components/ui.js.map +1 -1
- package/dist/components/use-mobile-reveal.js +1 -0
- package/dist/components/use-mobile-reveal.js.map +1 -1
- package/dist/components/use-table-state.d.ts +1 -1
- package/dist/components/use-table-state.js +38 -17
- package/dist/components/use-table-state.js.map +1 -1
- package/dist/components/user-avatar.d.ts +15 -4
- package/dist/components/user-avatar.js +5 -4
- package/dist/components/user-avatar.js.map +1 -1
- package/dist/components/wizard-stepper.js +3 -2
- package/dist/components/wizard-stepper.js.map +1 -1
- package/dist/{data-table-filters-aXyf0Xub.d.ts → data-table-filters-DM1auUfH.d.ts} +27 -5
- package/dist/data-table.d.ts +7 -0
- package/dist/data-table.js +12 -0
- package/dist/data-table.js.map +1 -0
- package/dist/feedback/feedback-attachment.js +12 -11
- package/dist/feedback/feedback-attachment.js.map +1 -1
- package/dist/feedback/feedback-dialog.js +2 -1
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-inbox.d.ts +33 -7
- package/dist/feedback/feedback-inbox.js +49 -37
- package/dist/feedback/feedback-inbox.js.map +1 -1
- package/dist/feedback.d.ts +5 -0
- package/dist/feedback.js +5 -0
- package/dist/feedback.js.map +1 -0
- package/dist/hooks/use-anchored-panel.js +1 -0
- package/dist/hooks/use-anchored-panel.js.map +1 -1
- package/dist/hooks/use-anchored-rect.js +1 -0
- package/dist/hooks/use-anchored-rect.js.map +1 -1
- package/dist/hooks/use-announce.d.ts +46 -0
- package/dist/hooks/use-announce.js +37 -0
- package/dist/hooks/use-announce.js.map +1 -0
- package/dist/hooks/use-body-scroll-lock.js +1 -0
- package/dist/hooks/use-body-scroll-lock.js.map +1 -1
- package/dist/hooks/use-close-transition.js +1 -0
- package/dist/hooks/use-close-transition.js.map +1 -1
- package/dist/hooks/use-dismiss.js +1 -0
- package/dist/hooks/use-dismiss.js.map +1 -1
- package/dist/hooks/use-focus-trap.d.ts +16 -0
- package/dist/hooks/use-focus-trap.js +67 -0
- package/dist/hooks/use-focus-trap.js.map +1 -0
- package/dist/hooks/use-media-query.js +1 -0
- package/dist/hooks/use-media-query.js.map +1 -1
- package/dist/hooks/use-overlay-history.js +27 -1
- package/dist/hooks/use-overlay-history.js.map +1 -1
- package/dist/hooks/use-row-swipe.js +1 -0
- package/dist/hooks/use-row-swipe.js.map +1 -1
- package/dist/i18n/defaults.d.ts +31 -0
- package/dist/i18n/defaults.js +63 -0
- package/dist/i18n/defaults.js.map +1 -0
- package/dist/i18n/kit-labels.d.ts +250 -0
- package/dist/i18n/kit-labels.js +184 -0
- package/dist/i18n/kit-labels.js.map +1 -0
- package/dist/index.d.ts +47 -22
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/calc.js +1 -0
- package/dist/lib/calc.js.map +1 -1
- package/dist/lib/cn.js +1 -0
- package/dist/lib/cn.js.map +1 -1
- package/dist/lib/dates.js +1 -0
- package/dist/lib/dates.js.map +1 -1
- package/dist/lib/logger.js +1 -0
- package/dist/lib/logger.js.map +1 -1
- package/dist/lib/safe-storage.js +1 -0
- package/dist/lib/safe-storage.js.map +1 -1
- package/dist/search/command-palette.d.ts +11 -1
- package/dist/search/command-palette.js +21 -15
- package/dist/search/command-palette.js.map +1 -1
- package/dist/search.d.ts +2 -0
- package/dist/search.js +3 -0
- package/dist/search.js.map +1 -0
- package/dist/shell/app-shell.d.ts +33 -4
- package/dist/shell/app-shell.js +275 -78
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/option-switcher-menu.js +3 -2
- package/dist/shell/option-switcher-menu.js.map +1 -1
- package/dist/shell/role-switcher.d.ts +6 -0
- package/dist/shell/role-switcher.js +7 -4
- package/dist/shell/role-switcher.js.map +1 -1
- package/dist/shell/top-bar.d.ts +15 -7
- package/dist/shell/top-bar.js +3 -5
- package/dist/shell/top-bar.js.map +1 -1
- package/dist/shell/topbar-action-menu.js +3 -2
- package/dist/shell/topbar-action-menu.js.map +1 -1
- package/dist/shell/topbar-controls.d.ts +5 -2
- package/dist/shell/topbar-controls.js +20 -15
- package/dist/shell/topbar-controls.js.map +1 -1
- package/dist/shell.d.ts +13 -0
- package/dist/shell.js +8 -0
- package/dist/shell.js.map +1 -0
- package/dist/theme/chart-palette.d.ts +19 -12
- package/dist/theme/chart-palette.js +24 -30
- package/dist/theme/chart-palette.js.map +1 -1
- package/dist/theme/color.d.ts +78 -0
- package/dist/theme/color.js +148 -0
- package/dist/theme/color.js.map +1 -0
- package/dist/theme/palette-derive.d.ts +140 -0
- package/dist/theme/palette-derive.js +376 -0
- package/dist/theme/palette-derive.js.map +1 -0
- package/dist/theme/palette-presets.d.ts +27 -5
- package/dist/theme/palette-presets.js +231 -33
- package/dist/theme/palette-presets.js.map +1 -1
- package/dist/theme/palette-store.js +1 -0
- package/dist/theme/palette-store.js.map +1 -1
- package/dist/theme/theme-store.js +1 -0
- package/dist/theme/theme-store.js.map +1 -1
- package/dist/tour/tour.d.ts +2 -1
- package/dist/tour/tour.js +15 -9
- package/dist/tour/tour.js.map +1 -1
- package/dist/tour.d.ts +2 -0
- package/dist/tour.js +3 -0
- package/dist/tour.js.map +1 -0
- package/dist/wizard/stepper-nav.js +10 -8
- package/dist/wizard/stepper-nav.js.map +1 -1
- package/dist/wizard/types.d.ts +18 -2
- package/dist/wizard/types.js +4 -1
- package/dist/wizard/types.js.map +1 -1
- package/dist/wizard/use-wizard.js +12 -4
- package/dist/wizard/use-wizard.js.map +1 -1
- package/dist/wizard/validation.js +1 -0
- package/dist/wizard/validation.js.map +1 -1
- package/dist/wizard/wizard-context.js +1 -0
- package/dist/wizard/wizard-context.js.map +1 -1
- package/dist/wizard/wizard-step.js +1 -0
- package/dist/wizard/wizard-step.js.map +1 -1
- package/dist/wizard/wizard-summary.js +5 -3
- package/dist/wizard/wizard-summary.js.map +1 -1
- package/dist/wizard.d.ts +8 -0
- package/dist/wizard.js +9 -0
- package/dist/wizard.js.map +1 -0
- package/package.json +67 -14
- package/src/chart.ts +22 -0
- package/src/components/account-settings.tsx +275 -0
- package/src/components/alert-banner.tsx +75 -0
- package/src/components/amount-input.tsx +471 -0
- package/src/components/calculator.tsx +252 -0
- package/src/components/chart-zoom.tsx +499 -0
- package/src/components/chart.tsx +363 -0
- package/src/components/checkbox.tsx +222 -0
- package/src/components/chip.tsx +570 -0
- package/src/components/choice-parts.ts +33 -0
- package/src/components/combobox-core.tsx +540 -0
- package/src/components/combobox.tsx +1026 -0
- package/src/components/currency-select.tsx +269 -0
- package/src/components/data-table-filter-popover.tsx +252 -0
- package/src/components/data-table-filters.ts +176 -0
- package/src/components/data-table-labels.ts +190 -0
- package/src/components/data-table-pagination.tsx +126 -0
- package/src/components/data-table-sort.ts +70 -0
- package/src/components/data-table.tsx +1740 -0
- package/src/components/date-picker.tsx +631 -0
- package/src/components/dropdown.tsx +341 -0
- package/src/components/entity-combobox.tsx +215 -0
- package/src/components/facing-pair.ts +86 -0
- package/src/components/field-sync.tsx +472 -0
- package/src/components/file-dropzone.tsx +181 -0
- package/src/components/full-bleed-dialog.tsx +179 -0
- package/src/components/grouped-picker.tsx +157 -0
- package/src/components/hover-menu.tsx +183 -0
- package/src/components/mini-calendar.tsx +554 -0
- package/src/components/modal.tsx +287 -0
- package/src/components/month-picker.tsx +549 -0
- package/src/components/multi-entity-combobox.tsx +226 -0
- package/src/components/multi-select.tsx +303 -0
- package/src/components/number-field.tsx +225 -0
- package/src/components/number-input.tsx +211 -0
- package/src/components/numpad-sheet.tsx +264 -0
- package/src/components/page-contents.tsx +289 -0
- package/src/components/password-strength.tsx +258 -0
- package/src/components/picker-sheet.tsx +251 -0
- package/src/components/popover.tsx +195 -0
- package/src/components/search-field.tsx +146 -0
- package/src/components/series-chart-labels.ts +26 -0
- package/src/components/series-chart.tsx +481 -0
- package/src/components/settings-fields.tsx +68 -0
- package/src/components/signature-pad.tsx +630 -0
- package/src/components/slider.tsx +313 -0
- package/src/components/sparkline.tsx +329 -0
- package/src/components/stat-tile.tsx +448 -0
- package/src/components/swipeable-row.tsx +271 -0
- package/src/components/switch.tsx +170 -0
- package/src/components/time-input.tsx +107 -0
- package/src/components/toggle-group.tsx +153 -0
- package/src/components/toggle-legend.tsx +229 -0
- package/src/components/tooltip.tsx +477 -0
- package/src/components/treemap.tsx +390 -0
- package/src/components/ui.tsx +1284 -0
- package/src/components/use-mobile-reveal.ts +54 -0
- package/src/components/use-table-state.ts +295 -0
- package/src/components/user-avatar.tsx +61 -0
- package/src/components/wizard-stepper.tsx +37 -0
- package/src/data-table.ts +19 -0
- package/src/feedback/feedback-attachment.tsx +246 -0
- package/src/feedback/feedback-dialog.tsx +209 -0
- package/src/feedback/feedback-inbox.tsx +615 -0
- package/src/feedback.ts +8 -0
- package/src/hooks/use-anchored-panel.ts +169 -0
- package/src/hooks/use-anchored-rect.ts +78 -0
- package/src/hooks/use-announce.ts +85 -0
- package/src/hooks/use-body-scroll-lock.ts +94 -0
- package/src/hooks/use-close-transition.ts +99 -0
- package/src/hooks/use-dismiss.ts +77 -0
- package/src/hooks/use-focus-trap.ts +160 -0
- package/src/hooks/use-media-query.ts +23 -0
- package/src/hooks/use-overlay-history.ts +345 -0
- package/src/hooks/use-row-swipe.ts +212 -0
- package/src/i18n/defaults.ts +68 -0
- package/src/i18n/kit-labels.tsx +447 -0
- package/src/index.ts +169 -0
- package/src/lib/calc.ts +309 -0
- package/src/lib/cn.ts +5 -0
- package/src/lib/dates.ts +187 -0
- package/src/lib/logger.ts +73 -0
- package/src/lib/safe-storage.ts +37 -0
- package/src/search/command-palette.tsx +342 -0
- package/src/search.ts +3 -0
- package/src/shell/app-shell.tsx +772 -0
- package/src/shell/option-switcher-menu.tsx +72 -0
- package/src/shell/role-switcher.tsx +46 -0
- package/src/shell/top-bar.tsx +39 -0
- package/src/shell/topbar-action-menu.tsx +91 -0
- package/src/shell/topbar-controls.tsx +229 -0
- package/src/shell.ts +10 -0
- package/src/theme/chart-palette.ts +145 -0
- package/src/theme/color.ts +266 -0
- package/src/theme/palette-derive.ts +681 -0
- package/src/theme/palette-presets.ts +760 -0
- package/src/theme/palette-store.ts +94 -0
- package/src/theme/theme-store.ts +145 -0
- package/src/tour/tour.tsx +586 -0
- package/src/tour.ts +3 -0
- package/src/vite-env.d.ts +26 -0
- package/src/wizard/stepper-nav.tsx +221 -0
- package/src/wizard/types.ts +178 -0
- package/src/wizard/use-wizard.ts +345 -0
- package/src/wizard/validation.ts +37 -0
- package/src/wizard/wizard-context.tsx +29 -0
- package/src/wizard/wizard-step.tsx +14 -0
- package/src/wizard/wizard-summary.tsx +69 -0
- package/src/wizard.ts +14 -0
- package/tokens.css +222 -20
|
@@ -1,11 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useId, useMemo, useRef } from "react";
|
|
2
4
|
import { Calendar, CalendarClock, ChevronLeft, ChevronRight, X } from "lucide-react";
|
|
3
5
|
import { cn } from "../lib/cn.js";
|
|
4
|
-
import { addDaysIso,
|
|
6
|
+
import { addDaysIso, parseIsoDate } from "../lib/dates.js";
|
|
7
|
+
import {
|
|
8
|
+
DEFAULT_DATE_PICKER_LABELS,
|
|
9
|
+
useKitLabels,
|
|
10
|
+
useKitLocale
|
|
11
|
+
} from "../i18n/kit-labels.js";
|
|
5
12
|
import { FieldLabel, FIELD_BASE, FIELD_TRIGGER, FIELD_FLOATING_PAD, FIELD_INVALID } from "./ui.js";
|
|
6
13
|
import { MiniCalendar } from "./mini-calendar.js";
|
|
7
14
|
import { Popover } from "./popover.js";
|
|
8
15
|
import { Tooltip } from "./tooltip.js";
|
|
16
|
+
function formatDate(iso, locale, options) {
|
|
17
|
+
return parseIsoDate(iso)?.toLocaleDateString(locale, options) ?? "";
|
|
18
|
+
}
|
|
19
|
+
function DateFieldTrigger({
|
|
20
|
+
open,
|
|
21
|
+
toggle,
|
|
22
|
+
triggerRef,
|
|
23
|
+
triggerText,
|
|
24
|
+
hasValue,
|
|
25
|
+
labelledBy,
|
|
26
|
+
valueId,
|
|
27
|
+
padded,
|
|
28
|
+
disabled,
|
|
29
|
+
invalid,
|
|
30
|
+
panelId
|
|
31
|
+
}) {
|
|
32
|
+
const wasOpen = useRef(false);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const justClosed = wasOpen.current && !open;
|
|
35
|
+
wasOpen.current = open;
|
|
36
|
+
if (!justClosed) return;
|
|
37
|
+
const active = document.activeElement;
|
|
38
|
+
if (!active || active === document.body) triggerRef.current?.focus();
|
|
39
|
+
}, [open, triggerRef]);
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
"button",
|
|
42
|
+
{
|
|
43
|
+
ref: triggerRef,
|
|
44
|
+
type: "button",
|
|
45
|
+
disabled,
|
|
46
|
+
onClick: toggle,
|
|
47
|
+
"aria-labelledby": labelledBy,
|
|
48
|
+
role: "combobox",
|
|
49
|
+
"aria-haspopup": "dialog",
|
|
50
|
+
"aria-controls": panelId,
|
|
51
|
+
"aria-expanded": open,
|
|
52
|
+
"aria-invalid": invalid || void 0,
|
|
53
|
+
className: cn(
|
|
54
|
+
FIELD_TRIGGER,
|
|
55
|
+
"pr-9",
|
|
56
|
+
padded && FIELD_FLOATING_PAD,
|
|
57
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
58
|
+
invalid && FIELD_INVALID
|
|
59
|
+
),
|
|
60
|
+
children: /* @__PURE__ */ jsx("span", { id: valueId, className: cn("truncate", !hasValue && "text-[var(--text-placeholder)]"), children: triggerText || "\xA0" })
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
9
64
|
function DateField({
|
|
10
65
|
triggerText,
|
|
11
66
|
hasValue,
|
|
@@ -13,64 +68,76 @@ function DateField({
|
|
|
13
68
|
disabled,
|
|
14
69
|
clearable,
|
|
15
70
|
clearLabel,
|
|
71
|
+
panelLabel,
|
|
16
72
|
className,
|
|
17
73
|
width,
|
|
18
74
|
onClear,
|
|
19
75
|
invalid,
|
|
20
|
-
children
|
|
76
|
+
children,
|
|
77
|
+
...rest
|
|
21
78
|
}) {
|
|
22
79
|
const showClear = Boolean(clearable && hasValue && !disabled);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
80
|
+
const id = useId();
|
|
81
|
+
const labelId = `${id}-label`;
|
|
82
|
+
const valueId = `${id}-value`;
|
|
83
|
+
const panelId = `${id}-panel`;
|
|
84
|
+
const named = typeof label === "string";
|
|
85
|
+
return (
|
|
86
|
+
// The caller's attributes land here, on the field's own box — the trigger inside is
|
|
87
|
+
// named by `aria-labelledby` and must keep the id pair it is given.
|
|
88
|
+
/* @__PURE__ */ jsxs("div", { ...rest, className: cn("relative", className), children: [
|
|
89
|
+
label !== void 0 && /* @__PURE__ */ jsx(FieldLabel, { children: label }),
|
|
90
|
+
named && /* @__PURE__ */ jsx("span", { id: labelId, "aria-hidden": true, className: "sr-only-fixed", children: label }),
|
|
91
|
+
/* @__PURE__ */ jsx(
|
|
92
|
+
Popover,
|
|
93
|
+
{
|
|
94
|
+
width,
|
|
95
|
+
panelId,
|
|
96
|
+
labels: { panel: panelLabel },
|
|
97
|
+
trigger: ({ open, toggle, ref }) => /* @__PURE__ */ jsx(
|
|
98
|
+
DateFieldTrigger,
|
|
99
|
+
{
|
|
100
|
+
open,
|
|
101
|
+
toggle,
|
|
102
|
+
triggerRef: ref,
|
|
103
|
+
triggerText,
|
|
104
|
+
hasValue,
|
|
105
|
+
labelledBy: named ? `${labelId} ${valueId}` : valueId,
|
|
106
|
+
panelId,
|
|
107
|
+
valueId,
|
|
108
|
+
padded: label !== void 0,
|
|
109
|
+
disabled,
|
|
110
|
+
invalid
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
children: (close) => children(close)
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
showClear ? /* @__PURE__ */ jsx(
|
|
117
|
+
"button",
|
|
118
|
+
{
|
|
119
|
+
type: "button",
|
|
120
|
+
"aria-label": clearLabel,
|
|
121
|
+
onClick: onClear,
|
|
122
|
+
className: "absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-1 text-[var(--text-placeholder)] hover:text-[var(--text-secondary)]",
|
|
123
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-4" })
|
|
124
|
+
}
|
|
125
|
+
) : /* @__PURE__ */ jsx(
|
|
126
|
+
Calendar,
|
|
127
|
+
{
|
|
128
|
+
"aria-hidden": true,
|
|
129
|
+
className: "pointer-events-none absolute right-2.5 top-1/2 size-4 -translate-y-1/2 text-[var(--text-placeholder)]"
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
] })
|
|
133
|
+
);
|
|
68
134
|
}
|
|
69
135
|
function StepButton({
|
|
70
136
|
icon: Icon,
|
|
71
137
|
label,
|
|
72
138
|
disabled,
|
|
73
|
-
onClick
|
|
139
|
+
onClick,
|
|
140
|
+
className
|
|
74
141
|
}) {
|
|
75
142
|
return /* @__PURE__ */ jsx(Tooltip, { label, portal: true, children: /* @__PURE__ */ jsx(
|
|
76
143
|
"button",
|
|
@@ -83,18 +150,37 @@ function StepButton({
|
|
|
83
150
|
FIELD_BASE,
|
|
84
151
|
// FIELD_BASE is `block w-full` for text inputs; a step button is neither, and
|
|
85
152
|
// px-3 would make it wider than it needs to be. twMerge lets these win.
|
|
86
|
-
"flex w-10 shrink-0 items-center justify-center px-0 text-
|
|
87
|
-
"hover:bg-
|
|
88
|
-
|
|
153
|
+
"relative flex h-full w-10 shrink-0 items-center justify-center px-0 text-[var(--text-muted)]",
|
|
154
|
+
"hover:bg-[var(--bg-hover)] hover:text-[var(--text-secondary)]",
|
|
155
|
+
// Raised while hovered or focused, so the shared border and the focus ring are
|
|
156
|
+
// drawn on top of the neighbour they overlap by a pixel.
|
|
157
|
+
"hover:z-10 focus-visible:z-10",
|
|
158
|
+
// Dimmed ICON, not a dimmed box: at 40% opacity the whole button — border
|
|
159
|
+
// included — faded out of the group and read as a broken, detached control.
|
|
160
|
+
"disabled:cursor-not-allowed disabled:text-[var(--text-placeholder)] disabled:opacity-60 disabled:hover:bg-[var(--bg-surface)]",
|
|
161
|
+
className
|
|
89
162
|
),
|
|
90
163
|
children: /* @__PURE__ */ jsx(Icon, { className: "size-4" })
|
|
91
164
|
}
|
|
92
165
|
) });
|
|
93
166
|
}
|
|
167
|
+
function useDatePickerLabels(clearLabel, stepLabels, todayLabel) {
|
|
168
|
+
const prev = stepLabels?.prev;
|
|
169
|
+
const next = stepLabels?.next;
|
|
170
|
+
const fromProps = useMemo(() => {
|
|
171
|
+
const out = {};
|
|
172
|
+
if (clearLabel !== void 0) out.clear = clearLabel;
|
|
173
|
+
if (prev !== void 0) out.previousDay = prev;
|
|
174
|
+
if (next !== void 0) out.nextDay = next;
|
|
175
|
+
if (todayLabel !== void 0) out.today = todayLabel;
|
|
176
|
+
return out;
|
|
177
|
+
}, [clearLabel, prev, next, todayLabel]);
|
|
178
|
+
return useKitLabels("datePicker", DEFAULT_DATE_PICKER_LABELS, fromProps);
|
|
179
|
+
}
|
|
94
180
|
function DatePicker({
|
|
95
181
|
value,
|
|
96
182
|
onChange,
|
|
97
|
-
locale,
|
|
183
|
+
locale: localeProp,
|
|
98
184
|
placeholder,
|
|
99
185
|
min,
|
|
100
186
|
max,
|
|
@@ -106,13 +192,27 @@ function DatePicker({
|
|
|
106
192
|
todayLabel,
|
|
107
193
|
className,
|
|
108
194
|
calendarLabels,
|
|
195
|
+
label,
|
|
196
|
+
clearable,
|
|
197
|
+
clearLabel,
|
|
198
|
+
disabled,
|
|
199
|
+
invalid,
|
|
109
200
|
...rest
|
|
110
201
|
}) {
|
|
111
|
-
const
|
|
202
|
+
const locale = useKitLocale(localeProp);
|
|
203
|
+
const text = useDatePickerLabels(clearLabel, stepLabels, todayLabel);
|
|
204
|
+
const render = formatValue ?? ((iso) => formatDate(iso, locale, formatOptions));
|
|
205
|
+
const wrapped = Boolean(step || today);
|
|
112
206
|
const field = /* @__PURE__ */ jsx(
|
|
113
207
|
DateField,
|
|
114
208
|
{
|
|
115
|
-
...rest,
|
|
209
|
+
...wrapped ? {} : rest,
|
|
210
|
+
label,
|
|
211
|
+
clearable,
|
|
212
|
+
clearLabel: text.clear,
|
|
213
|
+
panelLabel: text.panel,
|
|
214
|
+
disabled,
|
|
215
|
+
invalid,
|
|
116
216
|
className: step ? "min-w-0 flex-1" : className,
|
|
117
217
|
hasValue: Boolean(value),
|
|
118
218
|
triggerText: value ? render(value) : placeholder ?? "",
|
|
@@ -121,6 +221,7 @@ function DatePicker({
|
|
|
121
221
|
MiniCalendar,
|
|
122
222
|
{
|
|
123
223
|
mode: "single",
|
|
224
|
+
focusOnOpen: true,
|
|
124
225
|
from: value,
|
|
125
226
|
to: value,
|
|
126
227
|
locale,
|
|
@@ -135,54 +236,77 @@ function DatePicker({
|
|
|
135
236
|
)
|
|
136
237
|
}
|
|
137
238
|
);
|
|
138
|
-
if (!
|
|
239
|
+
if (!wrapped) return field;
|
|
139
240
|
const target = (days) => value ? addDaysIso(value, days) : "";
|
|
140
241
|
const outOfBounds = (iso) => Boolean(min && iso < min || max && iso > max);
|
|
141
242
|
const blocked = (days) => {
|
|
142
243
|
const next = target(days);
|
|
143
|
-
if (!next ||
|
|
244
|
+
if (!next || disabled) return true;
|
|
144
245
|
return outOfBounds(next);
|
|
145
246
|
};
|
|
146
247
|
return (
|
|
248
|
+
// ONE joined control, not three boxes in a row: the buttons and the field share
|
|
249
|
+
// their borders (each piece overlaps the previous by a pixel) and only the outer
|
|
250
|
+
// ends are rounded — the button-group shape, so ‹ date › reads as one field with
|
|
251
|
+
// controls rather than a field with loose buttons parked beside it, which is what
|
|
252
|
+
// the `gap-1` version looked like.
|
|
253
|
+
//
|
|
147
254
|
// items-stretch, not items-center: the buttons match the field's height, which
|
|
148
|
-
// varies with whether it carries a floating label.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
255
|
+
// varies with whether it carries a floating label. The field's trigger is nested
|
|
256
|
+
// inside DateField, so its inner corners are squared from here.
|
|
257
|
+
/* @__PURE__ */ jsxs(
|
|
258
|
+
"div",
|
|
259
|
+
{
|
|
260
|
+
...rest,
|
|
261
|
+
className: cn(
|
|
262
|
+
"flex items-stretch [&>*:not(:first-child)]:-ms-px",
|
|
263
|
+
step && "[&_[role=combobox]]:rounded-s-none",
|
|
264
|
+
(step || today) && "[&_[role=combobox]]:rounded-e-none",
|
|
265
|
+
"[&_[role=combobox]:focus-visible]:relative [&_[role=combobox]:focus-visible]:z-10",
|
|
266
|
+
className
|
|
267
|
+
),
|
|
268
|
+
children: [
|
|
269
|
+
step && /* @__PURE__ */ jsx(
|
|
270
|
+
StepButton,
|
|
271
|
+
{
|
|
272
|
+
icon: ChevronLeft,
|
|
273
|
+
label: text.previousDay,
|
|
274
|
+
disabled: blocked(-1),
|
|
275
|
+
onClick: () => onChange(target(-1)),
|
|
276
|
+
className: "rounded-e-none"
|
|
277
|
+
}
|
|
278
|
+
),
|
|
279
|
+
field,
|
|
280
|
+
step && /* @__PURE__ */ jsx(
|
|
281
|
+
StepButton,
|
|
282
|
+
{
|
|
283
|
+
icon: ChevronRight,
|
|
284
|
+
label: text.nextDay,
|
|
285
|
+
disabled: blocked(1),
|
|
286
|
+
onClick: () => onChange(target(1)),
|
|
287
|
+
className: cn("rounded-s-none", today && "rounded-e-none")
|
|
288
|
+
}
|
|
289
|
+
),
|
|
290
|
+
today && /* @__PURE__ */ jsx(
|
|
291
|
+
StepButton,
|
|
292
|
+
{
|
|
293
|
+
icon: CalendarClock,
|
|
294
|
+
label: text.today,
|
|
295
|
+
disabled: Boolean(disabled) || value === today || outOfBounds(today),
|
|
296
|
+
onClick: () => onChange(today),
|
|
297
|
+
className: "rounded-s-none"
|
|
298
|
+
}
|
|
299
|
+
)
|
|
300
|
+
]
|
|
301
|
+
}
|
|
302
|
+
)
|
|
179
303
|
);
|
|
180
304
|
}
|
|
181
305
|
function DateRangePicker({
|
|
182
306
|
from,
|
|
183
307
|
to,
|
|
184
308
|
onChange,
|
|
185
|
-
locale,
|
|
309
|
+
locale: localeProp,
|
|
186
310
|
placeholder,
|
|
187
311
|
min,
|
|
188
312
|
max,
|
|
@@ -191,9 +315,16 @@ function DateRangePicker({
|
|
|
191
315
|
separator = " \u2013 ",
|
|
192
316
|
presets,
|
|
193
317
|
calendarLabels,
|
|
318
|
+
label,
|
|
319
|
+
clearable,
|
|
320
|
+
clearLabel,
|
|
321
|
+
disabled,
|
|
322
|
+
invalid,
|
|
194
323
|
...rest
|
|
195
324
|
}) {
|
|
196
|
-
const
|
|
325
|
+
const locale = useKitLocale(localeProp);
|
|
326
|
+
const text = useDatePickerLabels(clearLabel, void 0, void 0);
|
|
327
|
+
const render = formatValue ?? ((iso) => formatDate(iso, locale, formatOptions));
|
|
197
328
|
const a = from ? render(from) : "";
|
|
198
329
|
const b = to ? render(to) : "";
|
|
199
330
|
const triggerText = from ? to ? `${a}${separator}${b}` : `${a}${separator}\u2026` : placeholder ?? "";
|
|
@@ -201,6 +332,7 @@ function DateRangePicker({
|
|
|
201
332
|
const calendar = (close) => /* @__PURE__ */ jsx(
|
|
202
333
|
MiniCalendar,
|
|
203
334
|
{
|
|
335
|
+
focusOnOpen: true,
|
|
204
336
|
from,
|
|
205
337
|
to,
|
|
206
338
|
locale,
|
|
@@ -217,12 +349,18 @@ function DateRangePicker({
|
|
|
217
349
|
DateField,
|
|
218
350
|
{
|
|
219
351
|
...rest,
|
|
220
|
-
|
|
352
|
+
label,
|
|
353
|
+
clearable,
|
|
354
|
+
clearLabel: text.clear,
|
|
355
|
+
panelLabel: text.rangePanel,
|
|
356
|
+
disabled,
|
|
357
|
+
invalid,
|
|
358
|
+
width: hasPresets ? 440 : void 0,
|
|
221
359
|
hasValue: Boolean(from || to),
|
|
222
360
|
triggerText,
|
|
223
361
|
onClear: () => onChange("", ""),
|
|
224
362
|
children: (close) => hasPresets ? /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
|
|
225
|
-
/* @__PURE__ */ jsx("div", { className: "flex w-32 shrink-0 flex-col gap-0.5 border-
|
|
363
|
+
/* @__PURE__ */ jsx("div", { className: "flex w-32 shrink-0 flex-col gap-0.5 border-e border-[var(--border)] pe-2", children: presets.map((p, i) => {
|
|
226
364
|
const selected = p.from === from && p.to === to;
|
|
227
365
|
return /* @__PURE__ */ jsx(
|
|
228
366
|
"button",
|
|
@@ -233,15 +371,15 @@ function DateRangePicker({
|
|
|
233
371
|
close();
|
|
234
372
|
},
|
|
235
373
|
className: cn(
|
|
236
|
-
"rounded px-2 py-1 text-
|
|
237
|
-
selected ? "bg-
|
|
374
|
+
"rounded px-2 py-1.5 text-start text-xs",
|
|
375
|
+
selected ? "bg-[var(--bg-active)] font-medium text-[var(--text-primary)]" : "text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]"
|
|
238
376
|
),
|
|
239
377
|
children: p.label
|
|
240
378
|
},
|
|
241
379
|
i
|
|
242
380
|
);
|
|
243
381
|
}) }),
|
|
244
|
-
calendar(close)
|
|
382
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: calendar(close) })
|
|
245
383
|
] }) : calendar(close)
|
|
246
384
|
}
|
|
247
385
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/date-picker.tsx"],"sourcesContent":["import type { ComponentType, ReactNode } from \"react\";\nimport { Calendar, CalendarClock, ChevronLeft, ChevronRight, X } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { addDaysIso, formatIsoDate } from \"../lib/dates\";\nimport { FieldLabel, FIELD_BASE, FIELD_TRIGGER, FIELD_FLOATING_PAD, FIELD_INVALID } from \"./ui\";\nimport { MiniCalendar, type MiniCalendarProps } from \"./mini-calendar\";\nimport { Popover } from \"./popover\";\nimport { Tooltip } from \"./tooltip\";\n\ninterface DatePickerBaseProps {\n locale: string;\n /** Embedded top-boundary label, matching the native Input/Select fields. */\n label?: ReactNode;\n placeholder?: string;\n /** Inclusive ISO bounds for selectable days. */\n min?: string;\n max?: string;\n /** Show an X to clear the value (emits `\"\"`). */\n clearable?: boolean;\n clearLabel?: string;\n disabled?: boolean;\n /** Required and unanswered — {@link FIELD_INVALID}. See {@link Input}'s `invalid`. */\n invalid?: boolean;\n className?: string;\n /** Intl options for the trigger's formatted date (default: locale short date). */\n formatOptions?: Intl.DateTimeFormatOptions;\n /** Render the trigger's text for an ISO date yourself; wins over `formatOptions`.\n * For a host whose date rendering is more than one `Intl` call can say — Keksdose\n * puts the weekday's name in the UI language beside digits ordered by a separate\n * format preference, two locales in one string. `locale` still drives the calendar. */\n formatValue?: (iso: string) => string;\n /** Passed through to the {@link MiniCalendar} this opens. Its month arrows are\n * icon-only, so their `aria-label` is the only name they have — and the package\n * ships English defaults, which a translating host has to be able to replace. */\n calendarLabels?: MiniCalendarProps[\"labels\"];\n}\n\n/** A field-styled trigger that opens a portalled MiniCalendar. Shared by the\n * single- and range-date pickers below. */\nfunction DateField({\n triggerText,\n hasValue,\n label,\n disabled,\n clearable,\n clearLabel,\n className,\n width,\n onClear,\n invalid,\n children,\n}: {\n triggerText: string;\n hasValue: boolean;\n label?: ReactNode;\n disabled?: boolean;\n clearable?: boolean;\n clearLabel?: string;\n invalid?: boolean;\n className?: string;\n /** Popover panel width; omit for the default (a bare calendar). */\n width?: number;\n onClear: () => void;\n children: (close: () => void) => ReactNode;\n}) {\n const showClear = Boolean(clearable && hasValue && !disabled);\n return (\n <div className={cn(\"relative\", className)}>\n {label !== undefined && <FieldLabel>{label}</FieldLabel>}\n <Popover\n width={width}\n trigger={({ toggle, ref }) => (\n <button\n ref={ref}\n type=\"button\"\n disabled={disabled}\n onClick={toggle}\n // The visual FieldLabel is a plain span (not a <label htmlFor>), so give\n // the trigger an accessible name from a string label — a11y + testable.\n aria-label={typeof label === \"string\" ? label : undefined}\n aria-invalid={invalid || undefined}\n className={cn(\n FIELD_TRIGGER,\n \"pr-9\",\n label !== undefined && FIELD_FLOATING_PAD,\n disabled && \"cursor-not-allowed opacity-50\",\n invalid && FIELD_INVALID,\n )}\n >\n <span className={cn(\"truncate\", !hasValue && \"text-slate-400 dark:text-slate-500\")}>\n {/* `|| \" \"` (a NON-BREAKING space) — triggerText is \"\" when there is no value and no\n placeholder was passed. An empty span has no line box, so the\n trigger collapses to its padding and sits shorter than every\n other field beside it.\n\n It has to be a NON-BREAKING space. This read `|| \" \"` first, and\n that fix did nothing at all: an ordinary space is collapsible\n white space, and white space at the start and end of a line is\n removed — so the span rendered with height 0 and the trigger\n stayed 22px against the 42px of the fields either side of it\n (Keksdose live #294, measured in the browser: `span.textContent`\n WAS `\" \"` and `getBoundingClientRect().height` was 0). U+00A0 is\n not collapsible, so it holds the line. */}\n {triggerText || \" \"}\n </span>\n </button>\n )}\n >\n {(close) => children(close)}\n </Popover>\n {showClear ? (\n <button\n type=\"button\"\n aria-label={clearLabel ?? \"Clear\"}\n onClick={onClear}\n className=\"absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-1 text-slate-400 hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300\"\n >\n <X className=\"size-4\" />\n </button>\n ) : (\n <Calendar\n aria-hidden\n className=\"pointer-events-none absolute right-2.5 top-1/2 size-4 -translate-y-1/2 text-slate-400 dark:text-slate-500\"\n />\n )}\n </div>\n );\n}\n\n/** One ‹ / › day-step button, sized to sit flush beside the field. */\nfunction StepButton({\n icon: Icon,\n label,\n disabled,\n onClick,\n}: {\n icon: ComponentType<{ className?: string }>;\n label: string;\n disabled: boolean;\n onClick: () => void;\n}) {\n return (\n <Tooltip label={label} portal>\n <button\n type=\"button\"\n aria-label={label}\n disabled={disabled}\n onClick={onClick}\n className={cn(\n FIELD_BASE,\n // FIELD_BASE is `block w-full` for text inputs; a step button is neither, and\n // px-3 would make it wider than it needs to be. twMerge lets these win.\n \"flex w-10 shrink-0 items-center justify-center px-0 text-slate-500 dark:text-slate-400\",\n \"hover:bg-slate-50 hover:text-slate-700 dark:hover:bg-slate-800 dark:hover:text-slate-200\",\n \"disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-white dark:disabled:hover:bg-slate-900\",\n )}\n >\n <Icon className=\"size-4\" />\n </button>\n </Tooltip>\n );\n}\n\nexport interface DatePickerProps extends DatePickerBaseProps {\n /** ISO \"YYYY-MM-DD\", or \"\" for empty. */\n value: string;\n onChange: (iso: string) => void;\n /**\n * Flank the field with ‹ › buttons that move the value one day. For fields whose\n * typical edit is a day or two — opening a calendar to go \"yesterday\" is three\n * interactions for what should be one.\n *\n * Off by default: on a filter or a far-away date the buttons are dead weight, and\n * they cost ~5rem of width that a narrow layout may not have.\n */\n step?: boolean;\n /** Accessible names for the step buttons. Required with `step` — this package\n * ships no strings of its own, so every label is passed in by the consumer. */\n stepLabels?: { prev: string; next: string };\n /**\n * Today's date as ISO \"YYYY-MM-DD\". Adds a jump-to-today button beside the field,\n * disabled once the value already is that day.\n *\n * Passed in rather than read from a clock here: a component that decides what \"today\"\n * is cannot be tested at a fixed date, and the consumer already has one definition of\n * it. The button is always RENDERED — going flat instead of disappearing — because a\n * control that comes and goes with the value reflows whatever sits beside it, which\n * is the report this exists to answer.\n */\n today?: string;\n /** Accessible name for the today button. Required with `today`. */\n todayLabel?: string;\n}\n\n/** Single-date picker: a field showing the formatted date, opening a calendar. */\nexport function DatePicker({\n value,\n onChange,\n locale,\n placeholder,\n min,\n max,\n formatOptions,\n formatValue,\n step,\n stepLabels,\n today,\n todayLabel,\n className,\n calendarLabels,\n ...rest\n}: DatePickerProps) {\n const render = formatValue ?? ((iso: string) => formatIsoDate(iso, locale, formatOptions));\n const field = (\n <DateField\n {...rest}\n className={step ? \"min-w-0 flex-1\" : className}\n hasValue={Boolean(value)}\n triggerText={value ? render(value) : (placeholder ?? \"\")}\n onClear={() => onChange(\"\")}\n >\n {(close) => (\n <MiniCalendar\n mode=\"single\"\n from={value}\n to={value}\n locale={locale}\n min={min}\n max={max}\n labels={calendarLabels}\n onSelect={(iso) => {\n onChange(iso);\n close();\n }}\n />\n )}\n </DateField>\n );\n if (!step && !today) return field;\n\n // An empty field has nothing to step from, so both buttons are dead until a date\n // is picked. Bounds are compared as strings: \"YYYY-MM-DD\" sorts chronologically.\n const target = (days: number) => (value ? addDaysIso(value, days) : \"\");\n const outOfBounds = (iso: string) => Boolean((min && iso < min) || (max && iso > max));\n const blocked = (days: number) => {\n const next = target(days);\n if (!next || rest.disabled) return true;\n return outOfBounds(next);\n };\n return (\n // items-stretch, not items-center: the buttons match the field's height, which\n // varies with whether it carries a floating label.\n <div className={cn(\"flex items-stretch gap-1\", className)}>\n {step && (\n <StepButton\n icon={ChevronLeft}\n label={stepLabels?.prev ?? \"Previous day\"}\n disabled={blocked(-1)}\n onClick={() => onChange(target(-1))}\n />\n )}\n {field}\n {step && (\n <StepButton\n icon={ChevronRight}\n label={stepLabels?.next ?? \"Next day\"}\n disabled={blocked(1)}\n onClick={() => onChange(target(1))}\n />\n )}\n {today && (\n <StepButton\n icon={CalendarClock}\n label={todayLabel ?? \"Today\"}\n disabled={Boolean(rest.disabled) || value === today || outOfBounds(today)}\n onClick={() => onChange(today)}\n />\n )}\n </div>\n );\n}\n\nexport interface DateRangePickerPreset {\n label: ReactNode;\n from: string;\n to: string;\n}\n\nexport interface DateRangePickerProps extends DatePickerBaseProps {\n from: string;\n to: string;\n onChange: (from: string, to: string) => void;\n /** Separator between the two formatted dates in the trigger (default \" – \"). */\n separator?: string;\n /** Optional named ranges rendered as a left column (last month / YTD / …). */\n presets?: DateRangePickerPreset[];\n}\n\n/** Two-date range picker: click a start then an end; closes once both are set.\n * With `presets`, a left column of named ranges is shown beside the calendar. */\nexport function DateRangePicker({\n from,\n to,\n onChange,\n locale,\n placeholder,\n min,\n max,\n formatOptions,\n formatValue,\n separator = \" – \",\n presets,\n calendarLabels,\n ...rest\n}: DateRangePickerProps) {\n const render = formatValue ?? ((iso: string) => formatIsoDate(iso, locale, formatOptions));\n const a = from ? render(from) : \"\";\n const b = to ? render(to) : \"\";\n const triggerText = from\n ? to\n ? `${a}${separator}${b}`\n : `${a}${separator}…`\n : (placeholder ?? \"\");\n const hasPresets = Boolean(presets && presets.length > 0);\n const calendar = (close: () => void) => (\n <MiniCalendar\n from={from}\n to={to}\n locale={locale}\n min={min}\n max={max}\n labels={calendarLabels}\n onSelect={(f, t) => {\n onChange(f, t);\n // Two-click range: only dismiss once both ends are chosen.\n if (f && t) close();\n }}\n />\n );\n return (\n <DateField\n {...rest}\n // Widen so the preset column sits beside the calendar (default otherwise).\n width={hasPresets ? 424 : undefined}\n hasValue={Boolean(from || to)}\n triggerText={triggerText}\n onClear={() => onChange(\"\", \"\")}\n >\n {(close) =>\n hasPresets ? (\n <div className=\"flex gap-3\">\n <div className=\"flex w-32 shrink-0 flex-col gap-0.5 border-r border-slate-100 pr-2 dark:border-slate-800\">\n {presets!.map((p, i) => {\n const selected = p.from === from && p.to === to;\n return (\n <button\n key={i}\n type=\"button\"\n onClick={() => {\n onChange(p.from, p.to);\n close();\n }}\n className={cn(\n \"rounded px-2 py-1 text-left text-xs\",\n selected\n ? \"bg-slate-100 font-medium text-slate-900 dark:bg-slate-800 dark:text-slate-100\"\n : \"text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800\",\n )}\n >\n {p.label}\n </button>\n );\n })}\n </div>\n {calendar(close)}\n </div>\n ) : (\n calendar(close)\n )\n }\n </DateField>\n );\n}\n"],"mappings":"AAmEI,SAC0B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AG,SAAS,GAAG,CAAC,KACpB,GAAG,CAAC,GAAG,SAAS,WACjB,eAAe;AACpB,QAAM,aAAa,QAAQ,WAAW,QAAQ,SAAS,CAAC;AACxD,QAAM,WAAW,CAAC,UAChB;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,MACR,UAAU,CAAC,GAAG,MAAM;AAClB,iBAAS,GAAG,CAAC;AAEb,YAAI,KAAK,EAAG,OAAM;AAAA,MACpB;AAAA;AAAA,EACF;AAEF,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MAEJ,OAAO,aAAa,MAAM;AAAA,MAC1B,UAAU,QAAQ,QAAQ,EAAE;AAAA,MAC5B;AAAA,MACA,SAAS,MAAM,SAAS,IAAI,EAAE;AAAA,MAE7B,WAAC,UACA,aACE,qBAAC,SAAI,WAAU,cACb;AAAA,4BAAC,SAAI,WAAU,4FACZ,kBAAS,IAAI,CAAC,GAAG,MAAM;AACtB,gBAAM,WAAW,EAAE,SAAS,QAAQ,EAAE,OAAO;AAC7C,iBACE;AAAA,YAAC;AAAA;AAAA,cAEC,MAAK;AAAA,cACL,SAAS,MAAM;AACb,yBAAS,EAAE,MAAM,EAAE,EAAE;AACrB,sBAAM;AAAA,cACR;AAAA,cACA,WAAW;AAAA,gBACT;AAAA,gBACA,WACI,kFACA;AAAA,cACN;AAAA,cAEC,YAAE;AAAA;AAAA,YAbE;AAAA,UAcP;AAAA,QAEJ,CAAC,GACH;AAAA,QACC,SAAS,KAAK;AAAA,SACjB,IAEA,SAAS,KAAK;AAAA;AAAA,EAGpB;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/date-picker.tsx"],"sourcesContent":["import { useEffect, useId, useMemo, useRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ComponentType, ReactNode, RefObject } from \"react\";\nimport { Calendar, CalendarClock, ChevronLeft, ChevronRight, X } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { addDaysIso, parseIsoDate } from \"../lib/dates\";\nimport {\n DEFAULT_DATE_PICKER_LABELS,\n useKitLabels,\n useKitLocale,\n type DatePickerLabels,\n} from \"../i18n/kit-labels\";\nimport { FieldLabel, FIELD_BASE, FIELD_TRIGGER, FIELD_FLOATING_PAD, FIELD_INVALID } from \"./ui\";\nimport { MiniCalendar, type MiniCalendarProps } from \"./mini-calendar\";\nimport { Popover } from \"./popover\";\nimport { Tooltip } from \"./tooltip\";\n\n/**\n * What both pickers share — and, through `ComponentPropsWithoutRef<\"div\">`, everything a\n * `<div>` takes, so a `data-tour` anchor, a test id or an `aria-describedby` reaches the\n * field's root element instead of being dropped (audit §api-design).\n *\n * `onChange` is omitted from those attributes: the DOM event of that name carries a\n * `FormEvent`, while both pickers answer with ISO date strings. Each declares its own\n * below.\n */\ninterface DatePickerBaseProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"onChange\"> {\n /** BCP 47 tag for the trigger's date and the calendar. Falls back to\n * `<UiKitProvider locale>`, then to the runtime's default. */\n locale?: string;\n /** Embedded top-boundary label, matching the native Input/Select fields. */\n label?: ReactNode;\n placeholder?: string;\n /** Inclusive ISO bounds for selectable days. */\n min?: string;\n max?: string;\n /** Show an X to clear the value (emits `\"\"`). */\n clearable?: boolean;\n /** Accessible name of the clear button. Wins over `datePicker.clear` from\n * `<UiKitProvider labels>`; kept as a prop because it predates the provider. */\n clearLabel?: string;\n disabled?: boolean;\n /** Required and unanswered — {@link FIELD_INVALID}. See {@link Input}'s `invalid`. */\n invalid?: boolean;\n className?: string;\n /** Intl options for the trigger's formatted date (default: locale short date). */\n formatOptions?: Intl.DateTimeFormatOptions;\n /** Render the trigger's text for an ISO date yourself; wins over `formatOptions`.\n * For a host whose date rendering is more than one `Intl` call can say — Keksdose\n * puts the weekday's name in the UI language beside digits ordered by a separate\n * format preference, two locales in one string. `locale` still drives the calendar. */\n formatValue?: (iso: string) => string;\n /** Passed through to the {@link MiniCalendar} this opens. Its month arrows are\n * icon-only, so their `aria-label` is the only name they have — and the package\n * ships English defaults, which a translating host has to be able to replace.\n * Usually unnecessary now: the calendar reads `miniCalendar` from the provider. */\n calendarLabels?: MiniCalendarProps[\"labels\"];\n}\n\n/** Format an ISO date for the trigger. `lib/dates`' `formatIsoDate` insists on a\n * locale, and here there may be none — no prop and no provider — which `Intl` reads\n * as \"the runtime's default\", as every other kit formatter does. */\nfunction formatDate(iso: string, locale: string | undefined, options?: Intl.DateTimeFormatOptions) {\n return parseIsoDate(iso)?.toLocaleDateString(locale, options) ?? \"\";\n}\n\n/**\n * The field-shaped button that opens the calendar.\n *\n * A component of its own rather than JSX inline in `Popover`'s `trigger` render prop,\n * because handing focus back to it is an effect and a render prop is not somewhere a\n * hook can go.\n */\nfunction DateFieldTrigger({\n open,\n toggle,\n triggerRef,\n triggerText,\n hasValue,\n labelledBy,\n valueId,\n padded,\n disabled,\n invalid,\n panelId,\n}: {\n open: boolean;\n toggle: () => void;\n triggerRef: RefObject<HTMLButtonElement | null>;\n /** The panel's id — `role=\"combobox\"` requires `aria-controls`. */\n panelId: string;\n triggerText: string;\n hasValue: boolean;\n /** ids of the hidden label twin + the value span, in the order they are spoken. */\n labelledBy?: string;\n valueId: string;\n padded: boolean;\n disabled?: boolean;\n invalid?: boolean;\n}) {\n const wasOpen = useRef(false);\n useEffect(() => {\n const justClosed = wasOpen.current && !open;\n wasOpen.current = open;\n if (!justClosed) return;\n // Only when the panel still HAD focus. The day the user was standing on has just\n // been unmounted with the panel, which drops focus to <body> and leaves a\n // keyboard user back at the top of the document with no idea where they were.\n // But an outside click closes this panel too, and that click has already given\n // focus to whatever it landed on — dragging it back here would be worse than the\n // bug, so a focus that is somewhere real is left alone.\n const active = document.activeElement;\n if (!active || active === document.body) triggerRef.current?.focus();\n // Here rather than through `useFocusTrap`'s `restoreFocus`, and not only because\n // `Popover` runs no trap to carry it: that option restores to whatever held focus\n // when the panel opened, and on Safari — and on Firefox on macOS — clicking a\n // button does not focus it, so \"whatever held focus\" is the page. The requirement\n // is this trigger, every time, however the panel was opened.\n }, [open, triggerRef]);\n\n return (\n <button\n ref={triggerRef}\n type=\"button\"\n disabled={disabled}\n onClick={toggle}\n // The name has to carry the VALUE. A bare `aria-label={label}` — which is what\n // this was — replaces the button's text outright, so the one field in the form\n // whose entire job is to show a date announced \"Due date\" and stopped there,\n // and a screen-reader user could not read back what they had picked without\n // opening the calendar and hunting for the selected day.\n //\n // Two ids rather than one composed string (`common.fieldValue`): \"label: value\"\n // is a sentence, and a name reference is spoken as the two texts in order with\n // no punctuation to translate at all. The hidden twin of the FieldLabel lives\n // in DateField, next to the label it copies.\n aria-labelledby={labelledBy}\n // `role=\"combobox\"` on a button that opens a calendar is the APG date-picker\n // shape, and it is what makes the next two lines legal: `button` supports\n // neither `aria-expanded` nor `aria-invalid`, so the previous markup set an\n // invalid state that announced nothing (ESLint's `role-supports-aria-props`).\n //\n // `aria-haspopup=\"dialog\"` is now honest — it was not when this comment first\n // said so. `Popover` gained a real `role=\"dialog\"` in the same wave, so the\n // trigger's promise and the panel's role finally agree.\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n aria-controls={panelId}\n aria-expanded={open}\n aria-invalid={invalid || undefined}\n className={cn(\n FIELD_TRIGGER,\n \"pr-9\",\n padded && FIELD_FLOATING_PAD,\n disabled && \"cursor-not-allowed opacity-50\",\n invalid && FIELD_INVALID,\n )}\n >\n <span id={valueId} className={cn(\"truncate\", !hasValue && \"text-[var(--text-placeholder)]\")}>\n {/* `|| \" \"` (a NON-BREAKING space) — triggerText is \"\" when there is no value and no\n placeholder was passed. An empty span has no line box, so the\n trigger collapses to its padding and sits shorter than every\n other field beside it.\n\n It has to be a NON-BREAKING space. This read `|| \" \"` first, and\n that fix did nothing at all: an ordinary space is collapsible\n white space, and white space at the start and end of a line is\n removed — so the span rendered with height 0 and the trigger\n stayed 22px against the 42px of the fields either side of it\n (Keksdose live #294, measured in the browser: `span.textContent`\n WAS `\" \"` and `getBoundingClientRect().height` was 0). U+00A0 is\n not collapsible, so it holds the line. */}\n {triggerText || \" \"}\n </span>\n </button>\n );\n}\n\n/** A field-styled trigger that opens a portalled MiniCalendar. Shared by the\n * single- and range-date pickers below. */\nfunction DateField({\n triggerText,\n hasValue,\n label,\n disabled,\n clearable,\n clearLabel,\n panelLabel,\n className,\n width,\n onClear,\n invalid,\n children,\n ...rest\n}: Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> & {\n triggerText: string;\n hasValue: boolean;\n label?: ReactNode;\n disabled?: boolean;\n clearable?: boolean;\n /** Already resolved by the picker (prop > provider > English). */\n clearLabel: string;\n /** The popover panel's accessible name, resolved likewise. */\n panelLabel: string;\n invalid?: boolean;\n className?: string;\n /** Popover panel width; omit for the default (a bare calendar). */\n width?: number;\n onClear: () => void;\n children: (close: () => void) => ReactNode;\n}) {\n const showClear = Boolean(clearable && hasValue && !disabled);\n const id = useId();\n const labelId = `${id}-label`;\n const valueId = `${id}-value`;\n const panelId = `${id}-panel`;\n // Only a STRING label can be reused as a name; a ReactNode may be a whole row with\n // its own interactive \"?\" hint in it, and naming a button with that reads the hint\n // out as part of the field's name.\n const named = typeof label === \"string\";\n return (\n // The caller's attributes land here, on the field's own box — the trigger inside is\n // named by `aria-labelledby` and must keep the id pair it is given.\n <div {...rest} className={cn(\"relative\", className)}>\n {label !== undefined && <FieldLabel>{label}</FieldLabel>}\n {/* The visible FieldLabel is a plain span, not a `<label htmlFor>`, so it names\n nothing on its own — this hidden twin is what the trigger is named by.\n `aria-hidden` because a name reference reads a hidden element deliberately\n (accname §4.3.1), and without it the label would be announced twice: once as\n loose text before the button, once inside the button's own name.\n `sr-only-fixed` rather than `sr-only` — see the note on the class in\n tokens.css. */}\n {named && (\n <span id={labelId} aria-hidden className=\"sr-only-fixed\">\n {label}\n </span>\n )}\n <Popover\n width={width}\n panelId={panelId}\n // Named for what it is. Unnamed, it fell back to `popover.panel`, and a date\n // field announced its calendar as \"Popover\" — in English, in every language.\n labels={{ panel: panelLabel }}\n trigger={({ open, toggle, ref }) => (\n <DateFieldTrigger\n open={open}\n toggle={toggle}\n triggerRef={ref}\n triggerText={triggerText}\n hasValue={hasValue}\n // ALWAYS a name reference, never `undefined`. A `<button>` takes its\n // accessible name from its contents, so an unlabelled trigger used to\n // announce its own date text for free. `role=\"combobox\"` does not —\n // content is excluded from name computation for that role — so leaving\n // this undefined made an unlabelled date field announce nothing at all.\n // Named: \"label, value\". Unnamed: the value alone, which is what the\n // button was saying before.\n labelledBy={named ? `${labelId} ${valueId}` : valueId}\n panelId={panelId}\n valueId={valueId}\n padded={label !== undefined}\n disabled={disabled}\n invalid={invalid}\n />\n )}\n >\n {(close) => children(close)}\n </Popover>\n {showClear ? (\n <button\n type=\"button\"\n aria-label={clearLabel}\n onClick={onClear}\n className=\"absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-1 text-[var(--text-placeholder)] hover:text-[var(--text-secondary)]\"\n >\n <X className=\"size-4\" />\n </button>\n ) : (\n <Calendar\n aria-hidden\n className=\"pointer-events-none absolute right-2.5 top-1/2 size-4 -translate-y-1/2 text-[var(--text-placeholder)]\"\n />\n )}\n </div>\n );\n}\n\n/** One ‹ / › day-step button, sized to sit flush beside the field. */\nfunction StepButton({\n icon: Icon,\n label,\n disabled,\n onClick,\n className,\n}: {\n icon: ComponentType<{ className?: string }>;\n label: string;\n disabled: boolean;\n onClick: () => void;\n /** The button's corners in the joined group (see DatePicker). */\n className?: string;\n}) {\n return (\n <Tooltip label={label} portal>\n <button\n type=\"button\"\n aria-label={label}\n disabled={disabled}\n onClick={onClick}\n className={cn(\n FIELD_BASE,\n // FIELD_BASE is `block w-full` for text inputs; a step button is neither, and\n // px-3 would make it wider than it needs to be. twMerge lets these win.\n \"relative flex h-full w-10 shrink-0 items-center justify-center px-0 text-[var(--text-muted)]\",\n \"hover:bg-[var(--bg-hover)] hover:text-[var(--text-secondary)]\",\n // Raised while hovered or focused, so the shared border and the focus ring are\n // drawn on top of the neighbour they overlap by a pixel.\n \"hover:z-10 focus-visible:z-10\",\n // Dimmed ICON, not a dimmed box: at 40% opacity the whole button — border\n // included — faded out of the group and read as a broken, detached control.\n \"disabled:cursor-not-allowed disabled:text-[var(--text-placeholder)] disabled:opacity-60 disabled:hover:bg-[var(--bg-surface)]\",\n className,\n )}\n >\n <Icon className=\"size-4\" />\n </button>\n </Tooltip>\n );\n}\n\nexport interface DatePickerProps extends DatePickerBaseProps {\n /** ISO \"YYYY-MM-DD\", or \"\" for empty. */\n value: string;\n onChange: (iso: string) => void;\n /**\n * Flank the field with ‹ › buttons that move the value one day. For fields whose\n * typical edit is a day or two — opening a calendar to go \"yesterday\" is three\n * interactions for what should be one.\n *\n * Off by default: on a filter or a far-away date the buttons are dead weight, and\n * they cost ~5rem of width that a narrow layout may not have.\n */\n step?: boolean;\n /** Accessible names for the step buttons. Optional: they resolve from\n * `datePicker.previousDay` / `nextDay` in `<UiKitProvider labels>`, then from the\n * English defaults. This prop wins over both, for the one field that says it\n * differently. */\n stepLabels?: { prev: string; next: string };\n /**\n * Today's date as ISO \"YYYY-MM-DD\". Adds a jump-to-today button beside the field,\n * disabled once the value already is that day.\n *\n * Passed in rather than read from a clock here: a component that decides what \"today\"\n * is cannot be tested at a fixed date, and the consumer already has one definition of\n * it. The button is always RENDERED — going flat instead of disappearing — because a\n * control that comes and goes with the value reflows whatever sits beside it, which\n * is the report this exists to answer.\n */\n today?: string;\n /** Accessible name for the today button; wins over `datePicker.today`. */\n todayLabel?: string;\n}\n\n/**\n * The picker's own label props, folded into one `datePicker` override so they sit at\n * the top of the same precedence chain as everything else: prop > provider > English.\n * They predate the provider and stay public API, which is why they are not simply\n * replaced by a `labels` prop.\n */\nfunction useDatePickerLabels(\n clearLabel: string | undefined,\n stepLabels: { prev: string; next: string } | undefined,\n todayLabel: string | undefined,\n): DatePickerLabels {\n const prev = stepLabels?.prev;\n const next = stepLabels?.next;\n const fromProps = useMemo(() => {\n const out: Partial<DatePickerLabels> = {};\n if (clearLabel !== undefined) out.clear = clearLabel;\n if (prev !== undefined) out.previousDay = prev;\n if (next !== undefined) out.nextDay = next;\n if (todayLabel !== undefined) out.today = todayLabel;\n return out;\n }, [clearLabel, prev, next, todayLabel]);\n return useKitLabels(\"datePicker\", DEFAULT_DATE_PICKER_LABELS, fromProps);\n}\n\n/** Single-date picker: a field showing the formatted date, opening a calendar. */\nexport function DatePicker({\n value,\n onChange,\n locale: localeProp,\n placeholder,\n min,\n max,\n formatOptions,\n formatValue,\n step,\n stepLabels,\n today,\n todayLabel,\n className,\n calendarLabels,\n label,\n clearable,\n clearLabel,\n disabled,\n invalid,\n ...rest\n}: DatePickerProps) {\n const locale = useKitLocale(localeProp);\n const text = useDatePickerLabels(clearLabel, stepLabels, todayLabel);\n const render = formatValue ?? ((iso: string) => formatDate(iso, locale, formatOptions));\n // With a step or a today button beside it the field is no longer the outermost\n // element — the flex row at the bottom is, and a caller's attributes belong on\n // whichever of the two is actually the root. Naming the shared props rather than\n // letting `...rest` carry them is what makes that choice possible.\n const wrapped = Boolean(step || today);\n const field = (\n <DateField\n {...(wrapped ? {} : rest)}\n label={label}\n clearable={clearable}\n clearLabel={text.clear}\n panelLabel={text.panel}\n disabled={disabled}\n invalid={invalid}\n className={step ? \"min-w-0 flex-1\" : className}\n hasValue={Boolean(value)}\n triggerText={value ? render(value) : (placeholder ?? \"\")}\n onClear={() => onChange(\"\")}\n >\n {(close) => (\n <MiniCalendar\n mode=\"single\"\n focusOnOpen\n from={value}\n to={value}\n locale={locale}\n min={min}\n max={max}\n labels={calendarLabels}\n onSelect={(iso) => {\n onChange(iso);\n close();\n }}\n />\n )}\n </DateField>\n );\n if (!wrapped) return field;\n\n // An empty field has nothing to step from, so both buttons are dead until a date\n // is picked. Bounds are compared as strings: \"YYYY-MM-DD\" sorts chronologically.\n const target = (days: number) => (value ? addDaysIso(value, days) : \"\");\n const outOfBounds = (iso: string) => Boolean((min && iso < min) || (max && iso > max));\n const blocked = (days: number) => {\n const next = target(days);\n if (!next || disabled) return true;\n return outOfBounds(next);\n };\n return (\n // ONE joined control, not three boxes in a row: the buttons and the field share\n // their borders (each piece overlaps the previous by a pixel) and only the outer\n // ends are rounded — the button-group shape, so ‹ date › reads as one field with\n // controls rather than a field with loose buttons parked beside it, which is what\n // the `gap-1` version looked like.\n //\n // items-stretch, not items-center: the buttons match the field's height, which\n // varies with whether it carries a floating label. The field's trigger is nested\n // inside DateField, so its inner corners are squared from here.\n <div\n {...rest}\n className={cn(\n \"flex items-stretch [&>*:not(:first-child)]:-ms-px\",\n step && \"[&_[role=combobox]]:rounded-s-none\",\n (step || today) && \"[&_[role=combobox]]:rounded-e-none\",\n \"[&_[role=combobox]:focus-visible]:relative [&_[role=combobox]:focus-visible]:z-10\",\n className,\n )}\n >\n {step && (\n <StepButton\n icon={ChevronLeft}\n label={text.previousDay}\n disabled={blocked(-1)}\n onClick={() => onChange(target(-1))}\n className=\"rounded-e-none\"\n />\n )}\n {field}\n {step && (\n <StepButton\n icon={ChevronRight}\n label={text.nextDay}\n disabled={blocked(1)}\n onClick={() => onChange(target(1))}\n className={cn(\"rounded-s-none\", today && \"rounded-e-none\")}\n />\n )}\n {today && (\n <StepButton\n icon={CalendarClock}\n label={text.today}\n disabled={Boolean(disabled) || value === today || outOfBounds(today)}\n onClick={() => onChange(today)}\n className=\"rounded-s-none\"\n />\n )}\n </div>\n );\n}\n\nexport interface DateRangePickerPreset {\n label: ReactNode;\n from: string;\n to: string;\n}\n\nexport interface DateRangePickerProps extends DatePickerBaseProps {\n from: string;\n to: string;\n onChange: (from: string, to: string) => void;\n /** Separator between the two formatted dates in the trigger (default \" – \"). */\n separator?: string;\n /** Optional named ranges rendered as a left column (last month / YTD / …). */\n presets?: DateRangePickerPreset[];\n}\n\n/** Two-date range picker: click a start then an end; closes once both are set.\n * With `presets`, a left column of named ranges is shown beside the calendar. */\nexport function DateRangePicker({\n from,\n to,\n onChange,\n locale: localeProp,\n placeholder,\n min,\n max,\n formatOptions,\n formatValue,\n separator = \" – \",\n presets,\n calendarLabels,\n label,\n clearable,\n clearLabel,\n disabled,\n invalid,\n ...rest\n}: DateRangePickerProps) {\n const locale = useKitLocale(localeProp);\n const text = useDatePickerLabels(clearLabel, undefined, undefined);\n const render = formatValue ?? ((iso: string) => formatDate(iso, locale, formatOptions));\n const a = from ? render(from) : \"\";\n const b = to ? render(to) : \"\";\n const triggerText = from\n ? to\n ? `${a}${separator}${b}`\n : `${a}${separator}…`\n : (placeholder ?? \"\");\n const hasPresets = Boolean(presets && presets.length > 0);\n const calendar = (close: () => void) => (\n <MiniCalendar\n focusOnOpen\n from={from}\n to={to}\n locale={locale}\n min={min}\n max={max}\n labels={calendarLabels}\n onSelect={(f, t) => {\n onChange(f, t);\n // Two-click range: only dismiss once both ends are chosen.\n if (f && t) close();\n }}\n />\n );\n return (\n <DateField\n {...rest}\n label={label}\n clearable={clearable}\n clearLabel={text.clear}\n panelLabel={text.rangePanel}\n disabled={disabled}\n invalid={invalid}\n // Widen so the preset column sits beside the calendar (default otherwise).\n width={hasPresets ? 440 : undefined}\n hasValue={Boolean(from || to)}\n triggerText={triggerText}\n onClear={() => onChange(\"\", \"\")}\n >\n {(close) =>\n hasPresets ? (\n <div className=\"flex gap-3\">\n {/* `border-e`/`pe`, not `-r`: the preset column is on the START side, and the\n rule between it and the calendar has to follow it in a right-to-left UI. */}\n <div className=\"flex w-32 shrink-0 flex-col gap-0.5 border-e border-[var(--border)] pe-2\">\n {presets!.map((p, i) => {\n const selected = p.from === from && p.to === to;\n return (\n <button\n key={i}\n type=\"button\"\n onClick={() => {\n onChange(p.from, p.to);\n close();\n }}\n className={cn(\n \"rounded px-2 py-1.5 text-start text-xs\",\n selected\n ? \"bg-[var(--bg-active)] font-medium text-[var(--text-primary)]\"\n : \"text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]\",\n )}\n >\n {p.label}\n </button>\n );\n })}\n </div>\n {/* `flex-1`: the calendar takes the rest of the panel. Content-sized it was\n seven tiny cells beside a wide preset column. */}\n <div className=\"min-w-0 flex-1\">{calendar(close)}</div>\n </div>\n ) : (\n calendar(close)\n )\n }\n </DateField>\n );\n}\n"],"mappings":";AA6JM,cAiEF,YAjEE;AA7JN,SAAS,WAAW,OAAO,SAAS,cAAc;AAElD,SAAS,UAAU,eAAe,aAAa,cAAc,SAAS;AACtE,SAAS,UAAU;AACnB,SAAS,YAAY,oBAAoB;AACzC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,YAAY,YAAY,eAAe,oBAAoB,qBAAqB;AACzF,SAAS,oBAA4C;AACrD,SAAS,eAAe;AACxB,SAAS,eAAe;AA+CxB,SAAS,WAAW,KAAa,QAA4B,SAAsC;AACjG,SAAO,aAAa,GAAG,GAAG,mBAAmB,QAAQ,OAAO,KAAK;AACnE;AASA,SAAS,iBAAiB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAcG;AACD,QAAM,UAAU,OAAO,KAAK;AAC5B,YAAU,MAAM;AACd,UAAM,aAAa,QAAQ,WAAW,CAAC;AACvC,YAAQ,UAAU;AAClB,QAAI,CAAC,WAAY;AAOjB,UAAM,SAAS,SAAS;AACxB,QAAI,CAAC,UAAU,WAAW,SAAS,KAAM,YAAW,SAAS,MAAM;AAAA,EAMrE,GAAG,CAAC,MAAM,UAAU,CAAC;AAErB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,MAAK;AAAA,MACL;AAAA,MACA,SAAS;AAAA,MAWT,mBAAiB;AAAA,MASjB,MAAK;AAAA,MACL,iBAAc;AAAA,MACd,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,gBAAc,WAAW;AAAA,MACzB,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,WAAW;AAAA,MACb;AAAA,M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