@cognite/aura 0.3.4 → 1.46104.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +264 -0
- package/DESIGN.md +638 -281
- package/LICENSE +21 -0
- package/README.md +48 -13
- package/dist/colors-deprecated.css +587 -0
- package/dist/colors.css +803 -830
- package/dist/components/index.d.ts +63 -57
- package/dist/components/index.js +62 -59
- package/dist/components/index.js.map +1 -0
- package/dist/components/ui/core/accordion/accordion.d.ts +19 -18
- package/dist/components/ui/core/accordion/accordion.js +99 -78
- package/dist/components/ui/core/accordion/accordion.js.map +1 -0
- package/dist/components/ui/core/action-toolbar/action-toolbar-motion.d.ts +8 -0
- package/dist/components/ui/core/action-toolbar/action-toolbar-motion.js +125 -0
- package/dist/components/ui/core/action-toolbar/action-toolbar-motion.js.map +1 -0
- package/dist/components/ui/core/action-toolbar/action-toolbar.d.ts +31 -31
- package/dist/components/ui/core/action-toolbar/action-toolbar.js +156 -106
- package/dist/components/ui/core/action-toolbar/action-toolbar.js.map +1 -0
- package/dist/components/ui/core/alert/alert.d.ts +25 -25
- package/dist/components/ui/core/alert/alert.js +181 -152
- package/dist/components/ui/core/alert/alert.js.map +1 -0
- package/dist/components/ui/core/avatar/avatar.d.ts +10 -9
- package/dist/components/ui/core/avatar/avatar.js +75 -65
- package/dist/components/ui/core/avatar/avatar.js.map +1 -0
- package/dist/components/ui/core/badge/badge.d.ts +13 -12
- package/dist/components/ui/core/badge/badge.js +88 -72
- package/dist/components/ui/core/badge/badge.js.map +1 -0
- package/dist/components/ui/core/banner/banner.d.ts +18 -18
- package/dist/components/ui/core/banner/banner.js +179 -142
- package/dist/components/ui/core/banner/banner.js.map +1 -0
- package/dist/components/ui/core/breadcrumb/breadcrumb.d.ts +12 -12
- package/dist/components/ui/core/breadcrumb/breadcrumb.js +139 -104
- package/dist/components/ui/core/breadcrumb/breadcrumb.js.map +1 -0
- package/dist/components/ui/core/button/button.d.ts +7 -7
- package/dist/components/ui/core/button/button.gallery.d.ts +2 -0
- package/dist/components/ui/core/button/button.gallery.js +76 -0
- package/dist/components/ui/core/button/button.gallery.js.map +1 -0
- package/dist/components/ui/core/button/button.js +57 -47
- package/dist/components/ui/core/button/button.js.map +1 -0
- package/dist/components/ui/core/button-group/button-group.d.ts +9 -9
- package/dist/components/ui/core/button-group/button-group.js +50 -40
- package/dist/components/ui/core/button-group/button-group.js.map +1 -0
- package/dist/components/ui/core/calendar/calendar-header.d.ts +7 -7
- package/dist/components/ui/core/calendar/calendar-header.js +102 -63
- package/dist/components/ui/core/calendar/calendar-header.js.map +1 -0
- package/dist/components/ui/core/calendar/calendar-utils.d.ts +30 -30
- package/dist/components/ui/core/calendar/calendar-utils.js +116 -39
- package/dist/components/ui/core/calendar/calendar-utils.js.map +1 -0
- package/dist/components/ui/core/calendar/calendar.d.ts +10 -10
- package/dist/components/ui/core/calendar/calendar.js +95 -66
- package/dist/components/ui/core/calendar/calendar.js.map +1 -0
- package/dist/components/ui/core/calendar/constants.js +3 -0
- package/dist/components/ui/core/calendar/constants.js.map +1 -0
- package/dist/components/ui/core/card/card.d.ts +20 -20
- package/dist/components/ui/core/card/card.js +133 -104
- package/dist/components/ui/core/card/card.js.map +1 -0
- package/dist/components/ui/core/chart/chart.d.ts +55 -53
- package/dist/components/ui/core/chart/chart.js +196 -116
- package/dist/components/ui/core/chart/chart.js.map +1 -0
- package/dist/components/ui/core/chart/index.d.ts +2 -2
- package/dist/components/ui/core/chart/index.js +3 -2
- package/dist/components/ui/core/chart/index.js.map +1 -0
- package/dist/components/ui/core/checkbox/checkbox.d.ts +9 -9
- package/dist/components/ui/core/checkbox/checkbox.js +88 -68
- package/dist/components/ui/core/checkbox/checkbox.js.map +1 -0
- package/dist/components/ui/core/checkbox/checkbox.metadata.d.ts +1 -1
- package/dist/components/ui/core/checkbox/checkbox.metadata.js +6 -7
- package/dist/components/ui/core/checkbox/checkbox.metadata.js.map +1 -0
- package/dist/components/ui/core/code-block/code-block.d.ts +19 -19
- package/dist/components/ui/core/code-block/code-block.js +259 -175
- package/dist/components/ui/core/code-block/code-block.js.map +1 -0
- package/dist/components/ui/core/collapsible/collapsible.d.ts +5 -5
- package/dist/components/ui/core/collapsible/collapsible.js +36 -30
- package/dist/components/ui/core/collapsible/collapsible.js.map +1 -0
- package/dist/components/ui/core/combobox/combobox.d.ts +13 -13
- package/dist/components/ui/core/combobox/combobox.js +89 -40
- package/dist/components/ui/core/combobox/combobox.js.map +1 -0
- package/dist/components/ui/core/command/command.d.ts +20 -18
- package/dist/components/ui/core/command/command.js +137 -85
- package/dist/components/ui/core/command/command.js.map +1 -0
- package/dist/components/ui/core/conversation/conversation.d.ts +14 -0
- package/dist/components/ui/core/conversation/conversation.js +51 -0
- package/dist/components/ui/core/conversation/conversation.js.map +1 -0
- package/dist/components/ui/core/count/count.d.ts +8 -6
- package/dist/components/ui/core/count/count.js +51 -21
- package/dist/components/ui/core/count/count.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-cell.d.ts +7 -7
- package/dist/components/ui/core/data-grid/data-grid-cell.js +23 -0
- package/dist/components/ui/core/data-grid/data-grid-cell.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-clauses.d.ts +14 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-clauses.js +36 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-clauses.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-panel.d.ts +41 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-panel.js +273 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-panel.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-footer.d.ts +6 -0
- package/dist/components/ui/core/data-grid/data-grid-footer.js +34 -0
- package/dist/components/ui/core/data-grid/data-grid-footer.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-header-row.d.ts +10 -10
- package/dist/components/ui/core/data-grid/data-grid-header-row.js +70 -0
- package/dist/components/ui/core/data-grid/data-grid-header-row.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-header.d.ts +11 -0
- package/dist/components/ui/core/data-grid/data-grid-header.js +67 -0
- package/dist/components/ui/core/data-grid/data-grid-header.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-row.d.ts +15 -15
- package/dist/components/ui/core/data-grid/data-grid-row.js +105 -0
- package/dist/components/ui/core/data-grid/data-grid-row.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid.d.ts +85 -35
- package/dist/components/ui/core/data-grid/data-grid.fixtures.d.ts +7 -7
- package/dist/components/ui/core/data-grid/data-grid.fixtures.js +139 -0
- package/dist/components/ui/core/data-grid/data-grid.fixtures.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid.js +404 -0
- package/dist/components/ui/core/data-grid/data-grid.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid.utils.d.ts +3 -3
- package/dist/components/ui/core/data-grid/data-grid.utils.js +51 -0
- package/dist/components/ui/core/data-grid/data-grid.utils.js.map +1 -0
- package/dist/components/ui/core/data-grid/index.d.ts +4 -0
- package/dist/components/ui/core/data-grid/index.js +5 -0
- package/dist/components/ui/core/data-grid/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.d.ts +11 -13
- package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +85 -61
- package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/index.d.ts +3 -3
- package/dist/components/ui/core/date-time-pickers/date-picker/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/types.d.ts +14 -14
- package/dist/components/ui/core/date-time-pickers/date-picker/types.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/types.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.d.ts +2 -2
- package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +51 -36
- package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.d.ts +11 -13
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +89 -64
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/index.d.ts +3 -3
- package/dist/components/ui/core/date-time-pickers/date-range-picker/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +20 -20
- package/dist/components/ui/core/date-time-pickers/date-range-picker/types.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/types.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.d.ts +4 -4
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +95 -60
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.d.ts +15 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.js +120 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/index.d.ts +3 -1
- package/dist/components/ui/core/date-time-pickers/date-time-picker/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/types.d.ts +25 -32
- package/dist/components/ui/core/date-time-pickers/date-time-picker/types.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/types.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.d.ts +2 -2
- package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.js +78 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.d.ts +13 -15
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +165 -119
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.d.ts +3 -3
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +37 -37
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.d.ts +3 -3
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +163 -104
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/index.d.ts +17 -12
- package/dist/components/ui/core/date-time-pickers/index.js +10 -6
- package/dist/components/ui/core/date-time-pickers/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.d.ts +5 -5
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js +52 -42
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/constants.d.ts +6 -1
- package/dist/components/ui/core/date-time-pickers/shared/constants.js +23 -0
- package/dist/components/ui/core/date-time-pickers/shared/constants.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.d.ts +16 -15
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +87 -64
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.d.ts +10 -9
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js +89 -38
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.d.ts +5 -5
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +34 -23
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.d.ts +23 -23
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js +95 -52
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.d.ts +5 -5
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js +22 -18
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.d.ts +19 -19
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js +41 -24
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.d.ts +13 -13
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +33 -24
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.d.ts +5 -5
- package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js +9 -4
- package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.d.ts +13 -9
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +22 -17
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.d.ts +2 -2
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.d.ts +13 -13
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +49 -40
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.d.ts +7 -7
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +41 -34
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/index.d.ts +3 -3
- package/dist/components/ui/core/date-time-pickers/time-picker/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.d.ts +12 -14
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +99 -79
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/types.d.ts +20 -20
- package/dist/components/ui/core/date-time-pickers/time-picker/types.js +3 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/types.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.d.ts +2 -2
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +63 -41
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/index.d.ts +3 -1
- package/dist/components/ui/core/date-time-pickers/time-range-picker/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.d.ts +14 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.js +115 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/types.d.ts +30 -36
- package/dist/components/ui/core/date-time-pickers/time-range-picker/types.js +3 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/types.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.d.ts +2 -2
- package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.js +145 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/date-input.d.ts +56 -0
- package/dist/components/ui/core/date-time-pickers/utils/date-input.js +67 -0
- package/dist/components/ui/core/date-time-pickers/utils/date-input.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.d.ts +18 -18
- package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.js +42 -0
- package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/format-utils.d.ts +31 -29
- package/dist/components/ui/core/date-time-pickers/utils/format-utils.js +56 -0
- package/dist/components/ui/core/date-time-pickers/utils/format-utils.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/segment-utils.d.ts +21 -21
- package/dist/components/ui/core/date-time-pickers/utils/segment-utils.js +170 -0
- package/dist/components/ui/core/date-time-pickers/utils/segment-utils.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/time-utils.d.ts +28 -28
- package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +88 -7
- package/dist/components/ui/core/date-time-pickers/utils/time-utils.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/time-validation.d.ts +17 -17
- package/dist/components/ui/core/date-time-pickers/utils/time-validation.js +43 -0
- package/dist/components/ui/core/date-time-pickers/utils/time-validation.js.map +1 -0
- package/dist/components/ui/core/dialog/dialog.d.ts +12 -9
- package/dist/components/ui/core/dialog/dialog.js +90 -82
- package/dist/components/ui/core/dialog/dialog.js.map +1 -0
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +22 -19
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +204 -149
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.js.map +1 -0
- package/dist/components/ui/core/empty-state/empty-state.context.d.ts +4 -4
- package/dist/components/ui/core/empty-state/empty-state.context.js +8 -5
- package/dist/components/ui/core/empty-state/empty-state.context.js.map +1 -0
- package/dist/components/ui/core/empty-state/empty-state.d.ts +14 -14
- package/dist/components/ui/core/empty-state/empty-state.js +96 -82
- package/dist/components/ui/core/empty-state/empty-state.js.map +1 -0
- package/dist/components/ui/core/helper-text/helper-text.d.ts +7 -7
- package/dist/components/ui/core/helper-text/helper-text.js +55 -36
- package/dist/components/ui/core/helper-text/helper-text.js.map +1 -0
- package/dist/components/ui/core/hover-card/hover-card.d.ts +7 -6
- package/dist/components/ui/core/hover-card/hover-card.js +56 -52
- package/dist/components/ui/core/hover-card/hover-card.js.map +1 -0
- package/dist/components/ui/core/inline-citation/inline-citation.d.ts +26 -25
- package/dist/components/ui/core/inline-citation/inline-citation.js +121 -97
- package/dist/components/ui/core/inline-citation/inline-citation.js.map +1 -0
- package/dist/components/ui/core/input/input.d.ts +2 -2
- package/dist/components/ui/core/input/input.js +15 -13
- package/dist/components/ui/core/input/input.js.map +1 -0
- package/dist/components/ui/core/input-group/input-group.d.ts +25 -14
- package/dist/components/ui/core/input-group/input-group.js +149 -76
- package/dist/components/ui/core/input-group/input-group.js.map +1 -0
- package/dist/components/ui/core/item/item.d.ts +20 -0
- package/dist/components/ui/core/item/item.js +93 -0
- package/dist/components/ui/core/item/item.js.map +1 -0
- package/dist/components/ui/core/kbd/kbd.d.ts +3 -3
- package/dist/components/ui/core/kbd/kbd.js +24 -20
- package/dist/components/ui/core/kbd/kbd.js.map +1 -0
- package/dist/components/ui/core/label/label.d.ts +3 -3
- package/dist/components/ui/core/label/label.js +33 -26
- package/dist/components/ui/core/label/label.js.map +1 -0
- package/dist/components/ui/core/loader/loader.d.ts +6 -6
- package/dist/components/ui/core/loader/loader.js +97 -80
- package/dist/components/ui/core/loader/loader.js.map +1 -0
- package/dist/components/ui/core/message/message-response-default-streamdown-controls.d.ts +9 -9
- package/dist/components/ui/core/message/message-response-default-streamdown-controls.js +19 -12
- package/dist/components/ui/core/message/message-response-default-streamdown-controls.js.map +1 -0
- package/dist/components/ui/core/message/message-response-math-plugin.d.ts +3 -0
- package/dist/components/ui/core/message/message-response-math-plugin.js +6 -0
- package/dist/components/ui/core/message/message-response-math-plugin.js.map +1 -0
- package/dist/components/ui/core/message/message.d.ts +27 -23
- package/dist/components/ui/core/message/message.js +453 -316
- package/dist/components/ui/core/message/message.js.map +1 -0
- package/dist/components/ui/core/overflow-list/overflow-list.d.ts +21 -0
- package/dist/components/ui/core/overflow-list/overflow-list.js +197 -0
- package/dist/components/ui/core/overflow-list/overflow-list.js.map +1 -0
- package/dist/components/ui/core/overflow-list/overflow-list.utils.d.ts +37 -35
- package/dist/components/ui/core/overflow-list/overflow-list.utils.js +206 -0
- package/dist/components/ui/core/overflow-list/overflow-list.utils.js.map +1 -0
- package/dist/components/ui/core/pagination/pagination-size-context.d.ts +2 -2
- package/dist/components/ui/core/pagination/pagination-size-context.js +6 -5
- package/dist/components/ui/core/pagination/pagination-size-context.js.map +1 -0
- package/dist/components/ui/core/pagination/pagination-teleport.d.ts +9 -9
- package/dist/components/ui/core/pagination/pagination-teleport.js +127 -84
- package/dist/components/ui/core/pagination/pagination-teleport.js.map +1 -0
- package/dist/components/ui/core/pagination/pagination-teleport.utils.js +6 -6
- package/dist/components/ui/core/pagination/pagination-teleport.utils.js.map +1 -0
- package/dist/components/ui/core/pagination/pagination.d.ts +39 -39
- package/dist/components/ui/core/pagination/pagination.js +294 -234
- package/dist/components/ui/core/pagination/pagination.js.map +1 -0
- package/dist/components/ui/core/popover/popover.d.ts +12 -11
- package/dist/components/ui/core/popover/popover.js +104 -89
- package/dist/components/ui/core/popover/popover.js.map +1 -0
- package/dist/components/ui/core/progress/progress.d.ts +9 -8
- package/dist/components/ui/core/progress/progress.js +50 -35
- package/dist/components/ui/core/progress/progress.js.map +1 -0
- package/dist/components/ui/core/prompt-input/prompt-input.d.ts +27 -27
- package/dist/components/ui/core/prompt-input/prompt-input.js +342 -271
- package/dist/components/ui/core/prompt-input/prompt-input.js.map +1 -0
- package/dist/components/ui/core/radio-group/radio-group.d.ts +12 -12
- package/dist/components/ui/core/radio-group/radio-group.js +88 -58
- package/dist/components/ui/core/radio-group/radio-group.js.map +1 -0
- package/dist/components/ui/core/reasoning/reasoning.d.ts +7 -7
- package/dist/components/ui/core/reasoning/reasoning.js +68 -56
- package/dist/components/ui/core/reasoning/reasoning.js.map +1 -0
- package/dist/components/ui/core/scroll-area/scroll-area.d.ts +4 -4
- package/dist/components/ui/core/scroll-area/scroll-area.js +50 -40
- package/dist/components/ui/core/scroll-area/scroll-area.js.map +1 -0
- package/dist/components/ui/core/search/search.d.ts +8 -8
- package/dist/components/ui/core/search/search.js +122 -76
- package/dist/components/ui/core/search/search.js.map +1 -0
- package/dist/components/ui/core/segmented-control/segmented-control.d.ts +17 -11
- package/dist/components/ui/core/segmented-control/segmented-control.js +204 -108
- package/dist/components/ui/core/segmented-control/segmented-control.js.map +1 -0
- package/dist/components/ui/core/select/select.d.ts +27 -26
- package/dist/components/ui/core/select/select.js +213 -168
- package/dist/components/ui/core/select/select.js.map +1 -0
- package/dist/components/ui/core/separator/separator.d.ts +2 -2
- package/dist/components/ui/core/separator/separator.js +13 -13
- package/dist/components/ui/core/separator/separator.js.map +1 -0
- package/dist/components/ui/core/shimmer/shimmer.d.ts +8 -8
- package/dist/components/ui/core/shimmer/shimmer.js +64 -40
- package/dist/components/ui/core/shimmer/shimmer.js.map +1 -0
- package/dist/components/ui/core/skeleton/skeleton.d.ts +2 -2
- package/dist/components/ui/core/skeleton/skeleton.js +13 -13
- package/dist/components/ui/core/skeleton/skeleton.js.map +1 -0
- package/dist/components/ui/core/slider/slider.d.ts +7 -7
- package/dist/components/ui/core/slider/slider.js +51 -39
- package/dist/components/ui/core/slider/slider.js.map +1 -0
- package/dist/components/ui/core/sonner-toast/sonner-toast.d.ts +2 -2
- package/dist/components/ui/core/sonner-toast/sonner-toast.js +67 -54
- package/dist/components/ui/core/sonner-toast/sonner-toast.js.map +1 -0
- package/dist/components/ui/core/sources/sources.d.ts +12 -12
- package/dist/components/ui/core/sources/sources.js +87 -58
- package/dist/components/ui/core/sources/sources.js.map +1 -0
- package/dist/components/ui/core/switch/switch.d.ts +9 -9
- package/dist/components/ui/core/switch/switch.js +83 -61
- package/dist/components/ui/core/switch/switch.js.map +1 -0
- package/dist/components/ui/core/switch/switch.metadata.d.ts +1 -1
- package/dist/components/ui/core/switch/switch.metadata.js +8 -0
- package/dist/components/ui/core/switch/switch.metadata.js.map +1 -0
- package/dist/components/ui/core/tabs/tabs.d.ts +20 -18
- package/dist/components/ui/core/tabs/tabs.js +176 -147
- package/dist/components/ui/core/tabs/tabs.js.map +1 -0
- package/dist/components/ui/core/tabs/tabs.utils.d.ts +1 -1
- package/dist/components/ui/core/tabs/tabs.utils.js +10 -6
- package/dist/components/ui/core/tabs/tabs.utils.js.map +1 -0
- package/dist/components/ui/core/textarea/textarea.d.ts +2 -2
- package/dist/components/ui/core/textarea/textarea.js +13 -13
- package/dist/components/ui/core/textarea/textarea.js.map +1 -0
- package/dist/components/ui/core/toggle/toggle.d.ts +9 -9
- package/dist/components/ui/core/toggle/toggle.js +60 -54
- package/dist/components/ui/core/toggle/toggle.js.map +1 -0
- package/dist/components/ui/core/tool/tool.d.ts +18 -18
- package/dist/components/ui/core/tool/tool.js +167 -126
- package/dist/components/ui/core/tool/tool.js.map +1 -0
- package/dist/components/ui/core/toolbar/toolbar.d.ts +37 -0
- package/dist/components/ui/core/toolbar/toolbar.js +171 -0
- package/dist/components/ui/core/toolbar/toolbar.js.map +1 -0
- package/dist/components/ui/core/tooltip/tooltip.d.ts +8 -7
- package/dist/components/ui/core/tooltip/tooltip.js +53 -46
- package/dist/components/ui/core/tooltip/tooltip.js.map +1 -0
- package/dist/components/ui/core/topbar/topbar.d.ts +26 -26
- package/dist/components/ui/core/topbar/topbar.js +160 -105
- package/dist/components/ui/core/topbar/topbar.js.map +1 -0
- package/dist/components/ui/core/tree/tree.d.ts +20 -0
- package/dist/components/ui/core/tree/tree.js +100 -0
- package/dist/components/ui/core/tree/tree.js.map +1 -0
- package/dist/eslint/index.d.ts +5 -5
- package/dist/eslint/index.js +9 -5
- package/dist/eslint/index.js.map +1 -0
- package/dist/eslint/no-overriding-styles.d.ts +1 -1
- package/dist/eslint/no-overriding-styles.js +341 -201
- package/dist/eslint/no-overriding-styles.js.map +1 -0
- package/dist/icons/index.d.ts +1 -1
- package/dist/icons/index.js +2 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/ai/types.d.ts +43 -43
- package/dist/lib/ai/types.js +3 -0
- package/dist/lib/ai/types.js.map +1 -0
- package/dist/lib/decorative-variant-classes.d.ts +53 -0
- package/dist/lib/decorative-variant-classes.js +58 -0
- package/dist/lib/decorative-variant-classes.js.map +1 -0
- package/dist/lib/highlight-code.d.ts +11 -8
- package/dist/lib/highlight-code.js +58 -40
- package/dist/lib/highlight-code.js.map +1 -0
- package/dist/lib/portal-container-context.d.ts +1 -1
- package/dist/lib/portal-container-context.js +8 -8
- package/dist/lib/portal-container-context.js.map +1 -0
- package/dist/lib/shared-theme-from-url.d.ts +13 -0
- package/dist/lib/shared-theme-from-url.js +61 -0
- package/dist/lib/shared-theme-from-url.js.map +1 -0
- package/dist/lib/style-scope.d.ts +2 -2
- package/dist/lib/style-scope.js +6 -6
- package/dist/lib/style-scope.js.map +1 -0
- package/dist/lib/theme-share-url.d.ts +31 -0
- package/dist/lib/theme-share-url.js +116 -0
- package/dist/lib/theme-share-url.js.map +1 -0
- package/dist/lib/types.d.ts +39 -39
- package/dist/lib/types.js +3 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/use-controllable-state.d.ts +4 -7
- package/dist/lib/use-controllable-state.js +34 -21
- package/dist/lib/use-controllable-state.js.map +1 -0
- package/dist/lib/utils.d.ts +63 -34
- package/dist/lib/utils.js +134 -32
- package/dist/lib/utils.js.map +1 -0
- package/dist/styles.css +2 -1
- package/dist/styles.source.css +24 -12
- package/dist/utils/assign-ref.d.ts +3 -0
- package/dist/utils/assign-ref.js +13 -0
- package/dist/utils/assign-ref.js.map +1 -0
- package/package.json +50 -11
- package/src/components/ui/core/button/button.md +93 -0
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { Dayjs } from
|
|
2
|
-
import { RangeSelectionStep } from
|
|
3
|
-
import { ShortcutValueDayjs } from
|
|
4
|
-
import { AmPm, TimeFormat } from
|
|
1
|
+
import type { Dayjs } from "dayjs";
|
|
2
|
+
import type { RangeSelectionStep } from "../shared/hooks/use-range-step-manager";
|
|
3
|
+
import type { ShortcutValueDayjs } from "../shared/shortcuts-panel/shortcuts-panel";
|
|
4
|
+
import type { AmPm, TimeFormat } from "../utils/format-utils";
|
|
5
5
|
export type { RangeSelectionStep };
|
|
6
6
|
export interface UseDateTimeRangePickerProps {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
value: [Dayjs | null, Dayjs | null];
|
|
8
|
+
onChange: (range: [Dayjs | null, Dayjs | null]) => void;
|
|
9
|
+
timeFormat?: TimeFormat;
|
|
10
|
+
defaultDate?: Dayjs;
|
|
11
11
|
}
|
|
12
12
|
export interface UseDateTimeRangePickerReturn {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
13
|
+
isOpen: boolean;
|
|
14
|
+
step: RangeSelectionStep;
|
|
15
|
+
displayedMonth: Dayjs;
|
|
16
|
+
tempStart: Dayjs | null;
|
|
17
|
+
tempEnd: Dayjs | null;
|
|
18
|
+
hoverDate: Dayjs | null;
|
|
19
|
+
tempStartHour: number;
|
|
20
|
+
tempStartMinute: number;
|
|
21
|
+
tempEndHour: number;
|
|
22
|
+
tempEndMinute: number;
|
|
23
|
+
startAmPm: AmPm;
|
|
24
|
+
endAmPm: AmPm;
|
|
25
|
+
handleOpenChange: (open: boolean) => void;
|
|
26
|
+
handleSetStep: (step: RangeSelectionStep) => void;
|
|
27
|
+
handleDateClick: (date: Dayjs) => void;
|
|
28
|
+
handleMonthChange: (month: Dayjs) => void;
|
|
29
|
+
handleDateHover: (date: Dayjs | null) => void;
|
|
30
|
+
handleStartHourChange: (hour: number) => void;
|
|
31
|
+
handleStartMinuteChange: (minute: number) => void;
|
|
32
|
+
handleEndHourChange: (hour: number) => void;
|
|
33
|
+
handleEndMinuteChange: (minute: number) => void;
|
|
34
|
+
handleStartAmPmChange: (value: AmPm) => void;
|
|
35
|
+
handleEndAmPmChange: (value: AmPm) => void;
|
|
36
|
+
handleNext: () => void;
|
|
37
|
+
handleApply: () => void;
|
|
38
|
+
handleBack: () => void;
|
|
39
|
+
handleApplyShortcut: (range: ShortcutValueDayjs) => void;
|
|
40
|
+
popoverRef: React.RefObject<HTMLDivElement>;
|
|
41
|
+
inputRef: React.RefObject<HTMLDivElement>;
|
|
42
42
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/ui/core/date-time-pickers/date-time-range-picker/types.ts"],"sourcesContent":["import type { Dayjs } from 'dayjs';\n\nimport type { RangeSelectionStep } from '../shared/hooks/use-range-step-manager';\nimport type { ShortcutValueDayjs } from '../shared/shortcuts-panel/shortcuts-panel';\nimport type { AmPm, TimeFormat } from '../utils/format-utils';\n\nexport type { RangeSelectionStep };\n\nexport interface UseDateTimeRangePickerProps {\n value: [Dayjs | null, Dayjs | null];\n onChange: (range: [Dayjs | null, Dayjs | null]) => void;\n timeFormat?: TimeFormat;\n defaultDate?: Dayjs;\n}\n\nexport interface UseDateTimeRangePickerReturn {\n isOpen: boolean;\n step: RangeSelectionStep;\n displayedMonth: Dayjs;\n tempStart: Dayjs | null;\n tempEnd: Dayjs | null;\n hoverDate: Dayjs | null;\n tempStartHour: number;\n tempStartMinute: number;\n tempEndHour: number;\n tempEndMinute: number;\n startAmPm: AmPm;\n endAmPm: AmPm;\n handleOpenChange: (open: boolean) => void;\n handleSetStep: (step: RangeSelectionStep) => void;\n handleDateClick: (date: Dayjs) => void;\n handleMonthChange: (month: Dayjs) => void;\n handleDateHover: (date: Dayjs | null) => void;\n handleStartHourChange: (hour: number) => void;\n handleStartMinuteChange: (minute: number) => void;\n handleEndHourChange: (hour: number) => void;\n handleEndMinuteChange: (minute: number) => void;\n handleStartAmPmChange: (value: AmPm) => void;\n handleEndAmPmChange: (value: AmPm) => void;\n handleNext: () => void;\n handleApply: () => void;\n handleBack: () => void;\n handleApplyShortcut: (range: ShortcutValueDayjs) => void;\n popoverRef: React.RefObject<HTMLDivElement>;\n inputRef: React.RefObject<HTMLDivElement>;\n}\n"],"names":[],"mappings":"AAeA,WA8BC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { RangeSelectionStep, UseDateTimeRangePickerProps, UseDateTimeRangePickerReturn } from
|
|
2
|
-
export type { RangeSelectionStep, UseDateTimeRangePickerProps, UseDateTimeRangePickerReturn
|
|
3
|
-
export declare const useDateTimeRangePicker: ({ value, onChange, timeFormat, defaultDate
|
|
1
|
+
import type { RangeSelectionStep, UseDateTimeRangePickerProps, UseDateTimeRangePickerReturn } from "./types";
|
|
2
|
+
export type { RangeSelectionStep, UseDateTimeRangePickerProps, UseDateTimeRangePickerReturn };
|
|
3
|
+
export declare const useDateTimeRangePicker: ({ value, onChange, timeFormat, defaultDate }: UseDateTimeRangePickerProps) => UseDateTimeRangePickerReturn;
|
|
@@ -1,107 +1,166 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
1
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import { DEFAULT_MINUTE, END_OF_DAY_HOUR, END_OF_DAY_MINUTE, START_OF_DAY_HOUR } from "../shared/constants.js";
|
|
4
|
+
import { usePopoverState } from "../shared/hooks/use-popover-state.js";
|
|
5
|
+
import { useRangeDateState } from "../shared/hooks/use-range-date-state.js";
|
|
6
|
+
import { useRangeStepManager } from "../shared/hooks/use-range-step-manager.js";
|
|
7
|
+
import { useTimeState } from "../shared/hooks/use-time-state.js";
|
|
8
|
+
function withStartOfDayTime(date) {
|
|
9
|
+
return date.hour(START_OF_DAY_HOUR).minute(DEFAULT_MINUTE);
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
11
|
+
function withEndOfDayTime(date) {
|
|
12
|
+
return date.hour(END_OF_DAY_HOUR).minute(END_OF_DAY_MINUTE);
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
14
|
+
export const useDateTimeRangePicker = ({ value, onChange, timeFormat = '24h', defaultDate = dayjs() })=>{
|
|
15
|
+
const onBackspaceRef = useRef(()=>{});
|
|
16
|
+
const { isOpen, setIsOpen, popoverRef, inputRef } = usePopoverState({
|
|
17
|
+
onBackspace: useCallback(()=>onBackspaceRef.current(), [])
|
|
18
|
+
});
|
|
19
|
+
const stepMgr = useRangeStepManager();
|
|
20
|
+
const { step, handleNext, handleBack: stepBack, resetStep } = stepMgr;
|
|
21
|
+
const dateState = useRangeDateState({
|
|
22
|
+
value,
|
|
23
|
+
defaultDate,
|
|
24
|
+
mapDate: (date, role)=>role === 'start' ? withStartOfDayTime(date) : withEndOfDayTime(date)
|
|
25
|
+
});
|
|
26
|
+
const { tempStart, tempEnd, displayedMonth, hoverDate, stateRef, handleDateClick: dateClick, handleDateHover, handleMonthChange, clearActiveSegment, resetDates } = dateState;
|
|
27
|
+
const startTime = useTimeState({
|
|
28
|
+
initialHour: value[0]?.hour() ?? START_OF_DAY_HOUR,
|
|
29
|
+
initialMinute: value[0]?.minute() ?? DEFAULT_MINUTE,
|
|
30
|
+
timeFormat
|
|
31
|
+
});
|
|
32
|
+
const { hour: startHour, minute: startMinute, amPm: startAmPm, hour24: startHour24, handleHourChange: handleStartHourChange, handleMinuteChange: handleStartMinuteChange, handleAmPmChange: handleStartAmPmChange, resetTime: resetStartTime } = startTime;
|
|
33
|
+
const endTime = useTimeState({
|
|
34
|
+
initialHour: value[1]?.hour() ?? END_OF_DAY_HOUR,
|
|
35
|
+
initialMinute: value[1]?.minute() ?? END_OF_DAY_MINUTE,
|
|
36
|
+
timeFormat
|
|
37
|
+
});
|
|
38
|
+
const { hour: endHour, minute: endMinute, amPm: endAmPm, hour24: endHour24, handleHourChange: handleEndHourChange, handleMinuteChange: handleEndMinuteChange, handleAmPmChange: handleEndAmPmChange, resetTime: resetEndTime } = endTime;
|
|
39
|
+
const resetAll = useCallback(()=>{
|
|
40
|
+
resetDates(value);
|
|
41
|
+
resetStep();
|
|
42
|
+
resetStartTime(value[0]?.hour() ?? START_OF_DAY_HOUR, value[0]?.minute() ?? DEFAULT_MINUTE);
|
|
43
|
+
resetEndTime(value[1]?.hour() ?? END_OF_DAY_HOUR, value[1]?.minute() ?? END_OF_DAY_MINUTE);
|
|
44
|
+
}, [
|
|
45
|
+
value,
|
|
46
|
+
resetDates,
|
|
47
|
+
resetStep,
|
|
48
|
+
resetStartTime,
|
|
49
|
+
resetEndTime
|
|
50
|
+
]);
|
|
51
|
+
const handleBackspace = useCallback(()=>{
|
|
52
|
+
const result = clearActiveSegment(step);
|
|
53
|
+
if (result === null) {
|
|
54
|
+
stepBack();
|
|
55
|
+
} else if (result[0] === null && result[1] === null) {
|
|
56
|
+
// Only apply the change if the result is [null, null]
|
|
57
|
+
onChange(result);
|
|
58
|
+
}
|
|
59
|
+
}, [
|
|
60
|
+
clearActiveSegment,
|
|
61
|
+
step,
|
|
62
|
+
stepBack,
|
|
63
|
+
onChange
|
|
64
|
+
]);
|
|
65
|
+
useEffect(()=>{
|
|
66
|
+
onBackspaceRef.current = handleBackspace;
|
|
67
|
+
}, [
|
|
68
|
+
handleBackspace
|
|
69
|
+
]);
|
|
70
|
+
const handleOpenChange = (open)=>{
|
|
71
|
+
resetAll();
|
|
72
|
+
setIsOpen(open);
|
|
73
|
+
};
|
|
74
|
+
const handleSetStep = useCallback((s)=>{
|
|
75
|
+
if (s === 'start') stepBack();
|
|
76
|
+
else handleNext();
|
|
77
|
+
}, [
|
|
78
|
+
stepBack,
|
|
79
|
+
handleNext
|
|
80
|
+
]);
|
|
81
|
+
const handleDateClick = useCallback((date)=>{
|
|
82
|
+
dateClick(date, step);
|
|
83
|
+
}, [
|
|
84
|
+
dateClick,
|
|
85
|
+
step
|
|
86
|
+
]);
|
|
87
|
+
const handleApply = useCallback(()=>{
|
|
88
|
+
const { tempStart: s, tempEnd: e } = stateRef.current;
|
|
89
|
+
if (s && e) {
|
|
90
|
+
const start = s.hour(startHour24).minute(startMinute).startOf('minute');
|
|
91
|
+
const end = e.hour(endHour24).minute(endMinute).endOf('minute');
|
|
92
|
+
const ordered = start.isAfter(end) ? [
|
|
93
|
+
end,
|
|
94
|
+
start
|
|
95
|
+
] : [
|
|
96
|
+
start,
|
|
97
|
+
end
|
|
98
|
+
];
|
|
99
|
+
onChange(ordered);
|
|
100
|
+
setIsOpen(false);
|
|
101
|
+
}
|
|
102
|
+
}, [
|
|
103
|
+
stateRef,
|
|
104
|
+
startHour24,
|
|
105
|
+
startMinute,
|
|
106
|
+
endHour24,
|
|
107
|
+
endMinute,
|
|
108
|
+
onChange,
|
|
109
|
+
setIsOpen
|
|
110
|
+
]);
|
|
111
|
+
const handleBack = useCallback(()=>{
|
|
112
|
+
stepBack();
|
|
113
|
+
resetDates([
|
|
114
|
+
stateRef.current.tempStart,
|
|
115
|
+
null
|
|
116
|
+
]);
|
|
117
|
+
}, [
|
|
118
|
+
stepBack,
|
|
119
|
+
resetDates,
|
|
120
|
+
stateRef
|
|
121
|
+
]);
|
|
122
|
+
const handleApplyShortcut = useCallback((rangeValue)=>{
|
|
123
|
+
const range = Array.isArray(rangeValue) ? rangeValue : [
|
|
124
|
+
rangeValue,
|
|
125
|
+
rangeValue
|
|
126
|
+
];
|
|
127
|
+
onChange(range);
|
|
128
|
+
setIsOpen(false);
|
|
129
|
+
}, [
|
|
130
|
+
onChange,
|
|
131
|
+
setIsOpen
|
|
132
|
+
]);
|
|
133
|
+
return {
|
|
134
|
+
isOpen,
|
|
135
|
+
step,
|
|
136
|
+
displayedMonth,
|
|
137
|
+
tempStart,
|
|
138
|
+
tempEnd,
|
|
139
|
+
hoverDate,
|
|
140
|
+
tempStartHour: startHour,
|
|
141
|
+
tempStartMinute: startMinute,
|
|
142
|
+
tempEndHour: endHour,
|
|
143
|
+
tempEndMinute: endMinute,
|
|
144
|
+
startAmPm,
|
|
145
|
+
endAmPm,
|
|
146
|
+
handleOpenChange,
|
|
147
|
+
handleSetStep,
|
|
148
|
+
handleDateClick,
|
|
149
|
+
handleMonthChange,
|
|
150
|
+
handleDateHover,
|
|
151
|
+
handleStartHourChange,
|
|
152
|
+
handleStartMinuteChange,
|
|
153
|
+
handleEndHourChange,
|
|
154
|
+
handleEndMinuteChange,
|
|
155
|
+
handleStartAmPmChange,
|
|
156
|
+
handleEndAmPmChange,
|
|
157
|
+
handleNext,
|
|
158
|
+
handleApply,
|
|
159
|
+
handleBack,
|
|
160
|
+
handleApplyShortcut,
|
|
161
|
+
popoverRef,
|
|
162
|
+
inputRef
|
|
163
|
+
};
|
|
105
164
|
};
|
|
106
|
-
|
|
107
|
-
|
|
165
|
+
|
|
166
|
+
//# sourceMappingURL=use-date-time-range-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\n\nimport type { Dayjs } from 'dayjs';\nimport dayjs from 'dayjs';\n\nimport {\n DEFAULT_MINUTE,\n END_OF_DAY_HOUR,\n END_OF_DAY_MINUTE,\n START_OF_DAY_HOUR,\n} from '../shared/constants';\nimport { usePopoverState } from '../shared/hooks/use-popover-state';\nimport { useRangeDateState } from '../shared/hooks/use-range-date-state';\nimport { useRangeStepManager } from '../shared/hooks/use-range-step-manager';\nimport { useTimeState } from '../shared/hooks/use-time-state';\nimport type { ShortcutValueDayjs } from '../shared/shortcuts-panel/shortcuts-panel';\n\nimport type {\n RangeSelectionStep,\n UseDateTimeRangePickerProps,\n UseDateTimeRangePickerReturn,\n} from './types';\n\nexport type {\n RangeSelectionStep,\n UseDateTimeRangePickerProps,\n UseDateTimeRangePickerReturn,\n};\n\nfunction withStartOfDayTime(date: Dayjs): Dayjs {\n return date.hour(START_OF_DAY_HOUR).minute(DEFAULT_MINUTE);\n}\n\nfunction withEndOfDayTime(date: Dayjs): Dayjs {\n return date.hour(END_OF_DAY_HOUR).minute(END_OF_DAY_MINUTE);\n}\n\nexport const useDateTimeRangePicker = ({\n value,\n onChange,\n timeFormat = '24h',\n defaultDate = dayjs(),\n}: UseDateTimeRangePickerProps): UseDateTimeRangePickerReturn => {\n const onBackspaceRef = useRef<() => void>(() => {});\n\n const { isOpen, setIsOpen, popoverRef, inputRef } = usePopoverState({\n onBackspace: useCallback(() => onBackspaceRef.current(), []),\n });\n\n const stepMgr = useRangeStepManager();\n const { step, handleNext, handleBack: stepBack, resetStep } = stepMgr;\n\n const dateState = useRangeDateState({\n value,\n defaultDate,\n mapDate: (date, role) =>\n role === 'start' ? withStartOfDayTime(date) : withEndOfDayTime(date),\n });\n const {\n tempStart,\n tempEnd,\n displayedMonth,\n hoverDate,\n stateRef,\n handleDateClick: dateClick,\n handleDateHover,\n handleMonthChange,\n clearActiveSegment,\n resetDates,\n } = dateState;\n\n const startTime = useTimeState({\n initialHour: value[0]?.hour() ?? START_OF_DAY_HOUR,\n initialMinute: value[0]?.minute() ?? DEFAULT_MINUTE,\n timeFormat,\n });\n const {\n hour: startHour,\n minute: startMinute,\n amPm: startAmPm,\n hour24: startHour24,\n handleHourChange: handleStartHourChange,\n handleMinuteChange: handleStartMinuteChange,\n handleAmPmChange: handleStartAmPmChange,\n resetTime: resetStartTime,\n } = startTime;\n\n const endTime = useTimeState({\n initialHour: value[1]?.hour() ?? END_OF_DAY_HOUR,\n initialMinute: value[1]?.minute() ?? END_OF_DAY_MINUTE,\n timeFormat,\n });\n const {\n hour: endHour,\n minute: endMinute,\n amPm: endAmPm,\n hour24: endHour24,\n handleHourChange: handleEndHourChange,\n handleMinuteChange: handleEndMinuteChange,\n handleAmPmChange: handleEndAmPmChange,\n resetTime: resetEndTime,\n } = endTime;\n\n const resetAll = useCallback(() => {\n resetDates(value);\n resetStep();\n resetStartTime(\n value[0]?.hour() ?? START_OF_DAY_HOUR,\n value[0]?.minute() ?? DEFAULT_MINUTE\n );\n resetEndTime(\n value[1]?.hour() ?? END_OF_DAY_HOUR,\n value[1]?.minute() ?? END_OF_DAY_MINUTE\n );\n }, [value, resetDates, resetStep, resetStartTime, resetEndTime]);\n\n const handleBackspace = useCallback(() => {\n const result = clearActiveSegment(step);\n if (result === null) {\n stepBack();\n } else if (result[0] === null && result[1] === null) {\n // Only apply the change if the result is [null, null]\n onChange(result);\n }\n }, [clearActiveSegment, step, stepBack, onChange]);\n\n useEffect(() => {\n onBackspaceRef.current = handleBackspace;\n }, [handleBackspace]);\n\n const handleOpenChange = (open: boolean) => {\n resetAll();\n setIsOpen(open);\n };\n\n const handleSetStep = useCallback(\n (s: RangeSelectionStep) => {\n if (s === 'start') stepBack();\n else handleNext();\n },\n [stepBack, handleNext]\n );\n\n const handleDateClick = useCallback(\n (date: Dayjs) => {\n dateClick(date, step);\n },\n [dateClick, step]\n );\n\n const handleApply = useCallback(() => {\n const { tempStart: s, tempEnd: e } = stateRef.current;\n if (s && e) {\n const start = s.hour(startHour24).minute(startMinute).startOf('minute');\n const end = e.hour(endHour24).minute(endMinute).endOf('minute');\n const ordered: [Dayjs, Dayjs] = start.isAfter(end)\n ? [end, start]\n : [start, end];\n onChange(ordered);\n setIsOpen(false);\n }\n }, [\n stateRef,\n startHour24,\n startMinute,\n endHour24,\n endMinute,\n onChange,\n setIsOpen,\n ]);\n\n const handleBack = useCallback(() => {\n stepBack();\n resetDates([stateRef.current.tempStart, null]);\n }, [stepBack, resetDates, stateRef]);\n\n const handleApplyShortcut = useCallback(\n (rangeValue: ShortcutValueDayjs) => {\n const range: [Dayjs | null, Dayjs | null] = Array.isArray(rangeValue)\n ? rangeValue\n : [rangeValue, rangeValue];\n onChange(range);\n setIsOpen(false);\n },\n [onChange, setIsOpen]\n );\n\n return {\n isOpen,\n step,\n displayedMonth,\n tempStart,\n tempEnd,\n hoverDate,\n tempStartHour: startHour,\n tempStartMinute: startMinute,\n tempEndHour: endHour,\n tempEndMinute: endMinute,\n startAmPm,\n endAmPm,\n handleOpenChange,\n handleSetStep,\n handleDateClick,\n handleMonthChange,\n handleDateHover,\n handleStartHourChange,\n handleStartMinuteChange,\n handleEndHourChange,\n handleEndMinuteChange,\n handleStartAmPmChange,\n handleEndAmPmChange,\n handleNext,\n handleApply,\n handleBack,\n handleApplyShortcut,\n popoverRef,\n inputRef,\n };\n};\n"],"names":["useCallback","useEffect","useRef","dayjs","DEFAULT_MINUTE","END_OF_DAY_HOUR","END_OF_DAY_MINUTE","START_OF_DAY_HOUR","usePopoverState","useRangeDateState","useRangeStepManager","useTimeState","withStartOfDayTime","date","hour","minute","withEndOfDayTime","useDateTimeRangePicker","value","onChange","timeFormat","defaultDate","onBackspaceRef","isOpen","setIsOpen","popoverRef","inputRef","onBackspace","current","stepMgr","step","handleNext","handleBack","stepBack","resetStep","dateState","mapDate","role","tempStart","tempEnd","displayedMonth","hoverDate","stateRef","handleDateClick","dateClick","handleDateHover","handleMonthChange","clearActiveSegment","resetDates","startTime","initialHour","initialMinute","startHour","startMinute","amPm","startAmPm","hour24","startHour24","handleHourChange","handleStartHourChange","handleMinuteChange","handleStartMinuteChange","handleAmPmChange","handleStartAmPmChange","resetTime","resetStartTime","endTime","endHour","endMinute","endAmPm","endHour24","handleEndHourChange","handleEndMinuteChange","handleEndAmPmChange","resetEndTime","resetAll","handleBackspace","result","handleOpenChange","open","handleSetStep","s","handleApply","e","start","startOf","end","endOf","ordered","isAfter","handleApplyShortcut","rangeValue","range","Array","isArray","tempStartHour","tempStartMinute","tempEndHour","tempEndMinute"],"mappings":"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"}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
export { DatePicker } from
|
|
2
|
-
export type { DatePickerProps } from
|
|
3
|
-
export { TimePicker } from
|
|
4
|
-
export type { TimePickerProps } from
|
|
5
|
-
export {
|
|
6
|
-
export type {
|
|
7
|
-
export {
|
|
8
|
-
export type {
|
|
9
|
-
export
|
|
10
|
-
export type {
|
|
11
|
-
export {
|
|
12
|
-
export type {
|
|
1
|
+
export { DatePicker } from "./date-picker";
|
|
2
|
+
export type { DatePickerProps } from "./date-picker";
|
|
3
|
+
export { TimePicker } from "./time-picker";
|
|
4
|
+
export type { TimePickerProps } from "./time-picker";
|
|
5
|
+
export { DateTimePicker } from "./date-time-picker";
|
|
6
|
+
export type { DateTimePickerProps } from "./date-time-picker";
|
|
7
|
+
export { DateRangePicker } from "./date-range-picker";
|
|
8
|
+
export type { DateRangePickerProps } from "./date-range-picker";
|
|
9
|
+
export { TimeRangePicker } from "./time-range-picker";
|
|
10
|
+
export type { TimeRangePickerProps } from "./time-range-picker";
|
|
11
|
+
export { DateTimeRangePicker } from "./date-time-range-picker";
|
|
12
|
+
export type { DateTimeRangePickerProps } from "./date-time-range-picker";
|
|
13
|
+
export type { ShortcutItem } from "./date-time-range-picker";
|
|
14
|
+
export type { DateInput, DateRangeValueProps, DateValueProps, DateValueType } from "./utils/date-input";
|
|
15
|
+
export type { AmPm, TimeFormat } from "./utils/format-utils";
|
|
16
|
+
export { Calendar } from "../calendar/calendar";
|
|
17
|
+
export type { CalendarProps } from "../calendar/calendar";
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export {
|
|
1
|
+
// Export all picker variants
|
|
2
|
+
export { DatePicker } from "./date-picker/index.js";
|
|
3
|
+
export { TimePicker } from "./time-picker/index.js";
|
|
4
|
+
export { DateTimePicker } from "./date-time-picker/index.js";
|
|
5
|
+
export { DateRangePicker } from "./date-range-picker/index.js";
|
|
6
|
+
export { TimeRangePicker } from "./time-range-picker/index.js";
|
|
7
|
+
export { DateTimeRangePicker } from "./date-time-range-picker/index.js";
|
|
8
|
+
export { Calendar } from "../calendar/calendar.js";
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/date-time-pickers/index.ts"],"sourcesContent":["// Export all picker variants\nexport { DatePicker } from './date-picker';\nexport type { DatePickerProps } from './date-picker';\n\nexport { TimePicker } from './time-picker';\nexport type { TimePickerProps } from './time-picker';\n\nexport { DateTimePicker } from './date-time-picker';\nexport type { DateTimePickerProps } from './date-time-picker';\n\nexport { DateRangePicker } from './date-range-picker';\nexport type { DateRangePickerProps } from './date-range-picker';\n\nexport { TimeRangePicker } from './time-range-picker';\nexport type { TimeRangePickerProps } from './time-range-picker';\n\nexport { DateTimeRangePicker } from './date-time-range-picker';\nexport type { DateTimeRangePickerProps } from './date-time-range-picker';\n\n// Export shared types\nexport type { ShortcutItem } from './date-time-range-picker';\nexport type {\n DateInput,\n DateRangeValueProps,\n DateValueProps,\n DateValueType,\n} from './utils/date-input';\nexport type { AmPm, TimeFormat } from './utils/format-utils';\n\nexport { Calendar } from '../calendar/calendar';\nexport type { CalendarProps } from '../calendar/calendar';\n"],"names":["DatePicker","TimePicker","DateTimePicker","DateRangePicker","TimeRangePicker","DateTimeRangePicker","Calendar"],"mappings":"AAAA,6BAA6B;AAC7B,SAASA,UAAU,QAAQ,yBAAgB;AAG3C,SAASC,UAAU,QAAQ,yBAAgB;AAG3C,SAASC,cAAc,QAAQ,8BAAqB;AAGpD,SAASC,eAAe,QAAQ,+BAAsB;AAGtD,SAASC,eAAe,QAAQ,+BAAsB;AAGtD,SAASC,mBAAmB,QAAQ,oCAA2B;AAa/D,SAASC,QAAQ,QAAQ,0BAAuB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FC } from
|
|
2
|
-
import { AmPm } from
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { AmPm } from "../../utils/format-utils";
|
|
3
3
|
export type AmPmScrollProps = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
value: AmPm | null;
|
|
5
|
+
onChange: (value: AmPm) => void;
|
|
6
|
+
className?: string;
|
|
7
7
|
};
|
|
8
8
|
export declare const AmPmScroll: FC<AmPmScrollProps>;
|
|
@@ -1,43 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { cn } from "../../../../../../lib/utils.js";
|
|
4
|
+
import { SCROLL_CONTAINER_CLASSES, SCROLL_ITEM_BASE_CLASSES, SCROLL_ITEM_SELECTED_CLASSES, SCROLL_ITEM_UNSELECTED_CLASSES } from "../scroll-cell-classes.js";
|
|
5
|
+
const AM_PM_VALUES = [
|
|
6
|
+
'AM',
|
|
7
|
+
'PM'
|
|
8
|
+
];
|
|
9
|
+
export const AmPmScroll = ({ value, onChange, className })=>{
|
|
10
|
+
const scrollContainerRef = useRef(null);
|
|
11
|
+
const selectedItemRef = useRef(null);
|
|
12
|
+
useEffect(()=>{
|
|
13
|
+
if (value !== null && selectedItemRef.current && scrollContainerRef.current) {
|
|
14
|
+
const container = scrollContainerRef.current;
|
|
15
|
+
const item = selectedItemRef.current;
|
|
16
|
+
container.scrollTo({
|
|
17
|
+
top: item.offsetTop - container.offsetHeight / 2 + item.offsetHeight / 2,
|
|
18
|
+
behavior: 'smooth'
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}, [
|
|
22
|
+
value
|
|
23
|
+
]);
|
|
24
|
+
const handleKeyDown = (event, ampmValue)=>{
|
|
25
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
26
|
+
event.preventDefault();
|
|
27
|
+
onChange(ampmValue);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
31
|
+
"data-slot": "am-pm-scroll",
|
|
32
|
+
ref: scrollContainerRef,
|
|
33
|
+
role: "listbox",
|
|
34
|
+
"aria-label": "AM/PM",
|
|
35
|
+
"aria-orientation": "vertical",
|
|
36
|
+
className: cn(SCROLL_CONTAINER_CLASSES, className),
|
|
37
|
+
children: AM_PM_VALUES.map((ampmValue)=>{
|
|
38
|
+
const isSelected = value !== null && ampmValue === value;
|
|
39
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
40
|
+
ref: isSelected ? selectedItemRef : undefined,
|
|
41
|
+
tabIndex: 0,
|
|
42
|
+
className: cn(SCROLL_ITEM_BASE_CLASSES, isSelected ? SCROLL_ITEM_SELECTED_CLASSES : SCROLL_ITEM_UNSELECTED_CLASSES),
|
|
43
|
+
onClick: ()=>onChange(ampmValue),
|
|
44
|
+
onKeyDown: (event)=>handleKeyDown(event, ampmValue),
|
|
45
|
+
role: "option",
|
|
46
|
+
"aria-selected": isSelected,
|
|
47
|
+
children: ampmValue
|
|
48
|
+
}, ampmValue);
|
|
49
|
+
})
|
|
50
|
+
});
|
|
41
51
|
};
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=am-pm-scroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.tsx"],"sourcesContent":["import type { FC, KeyboardEvent } from 'react';\nimport { useEffect, useRef } from 'react';\n\nimport { cn } from '../../../../../../lib/utils';\nimport type { AmPm } from '../../utils/format-utils';\nimport {\n SCROLL_CONTAINER_CLASSES,\n SCROLL_ITEM_BASE_CLASSES,\n SCROLL_ITEM_SELECTED_CLASSES,\n SCROLL_ITEM_UNSELECTED_CLASSES,\n} from '../scroll-cell-classes';\n\nexport type AmPmScrollProps = {\n value: AmPm | null;\n onChange: (value: AmPm) => void;\n className?: string;\n};\n\nconst AM_PM_VALUES: AmPm[] = ['AM', 'PM'];\n\nexport const AmPmScroll: FC<AmPmScrollProps> = ({\n value,\n onChange,\n className,\n}) => {\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n const selectedItemRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (\n value !== null &&\n selectedItemRef.current &&\n scrollContainerRef.current\n ) {\n const container = scrollContainerRef.current;\n const item = selectedItemRef.current;\n container.scrollTo({\n top:\n item.offsetTop - container.offsetHeight / 2 + item.offsetHeight / 2,\n behavior: 'smooth',\n });\n }\n }, [value]);\n\n const handleKeyDown = (\n event: KeyboardEvent<HTMLDivElement>,\n ampmValue: AmPm\n ) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n onChange(ampmValue);\n }\n };\n\n return (\n <div\n data-slot=\"am-pm-scroll\"\n ref={scrollContainerRef}\n role=\"listbox\"\n aria-label=\"AM/PM\"\n aria-orientation=\"vertical\"\n className={cn(SCROLL_CONTAINER_CLASSES, className)}\n >\n {AM_PM_VALUES.map((ampmValue) => {\n const isSelected = value !== null && ampmValue === value;\n return (\n <div\n key={ampmValue}\n ref={isSelected ? selectedItemRef : undefined}\n tabIndex={0}\n className={cn(\n SCROLL_ITEM_BASE_CLASSES,\n isSelected\n ? SCROLL_ITEM_SELECTED_CLASSES\n : SCROLL_ITEM_UNSELECTED_CLASSES\n )}\n onClick={() => onChange(ampmValue)}\n onKeyDown={(event) => handleKeyDown(event, ampmValue)}\n role=\"option\"\n aria-selected={isSelected}\n >\n {ampmValue}\n </div>\n );\n })}\n </div>\n );\n};\n"],"names":["useEffect","useRef","cn","SCROLL_CONTAINER_CLASSES","SCROLL_ITEM_BASE_CLASSES","SCROLL_ITEM_SELECTED_CLASSES","SCROLL_ITEM_UNSELECTED_CLASSES","AM_PM_VALUES","AmPmScroll","value","onChange","className","scrollContainerRef","selectedItemRef","current","container","item","scrollTo","top","offsetTop","offsetHeight","behavior","handleKeyDown","event","ampmValue","key","preventDefault","div","data-slot","ref","role","aria-label","aria-orientation","map","isSelected","undefined","tabIndex","onClick","onKeyDown","aria-selected"],"mappings":";AACA,SAASA,SAAS,EAAEC,MAAM,QAAQ,QAAQ;AAE1C,SAASC,EAAE,QAAQ,iCAA8B;AAEjD,SACEC,wBAAwB,EACxBC,wBAAwB,EACxBC,4BAA4B,EAC5BC,8BAA8B,QACzB,4BAAyB;AAQhC,MAAMC,eAAuB;IAAC;IAAM;CAAK;AAEzC,OAAO,MAAMC,aAAkC,CAAC,EAC9CC,KAAK,EACLC,QAAQ,EACRC,SAAS,EACV;IACC,MAAMC,qBAAqBX,OAAuB;IAClD,MAAMY,kBAAkBZ,OAAuB;IAE/CD,UAAU;QACR,IACES,UAAU,QACVI,gBAAgBC,OAAO,IACvBF,mBAAmBE,OAAO,EAC1B;YACA,MAAMC,YAAYH,mBAAmBE,OAAO;YAC5C,MAAME,OAAOH,gBAAgBC,OAAO;YACpCC,UAAUE,QAAQ,CAAC;gBACjBC,KACEF,KAAKG,SAAS,GAAGJ,UAAUK,YAAY,GAAG,IAAIJ,KAAKI,YAAY,GAAG;gBACpEC,UAAU;YACZ;QACF;IACF,GAAG;QAACZ;KAAM;IAEV,MAAMa,gBAAgB,CACpBC,OACAC;QAEA,IAAID,MAAME,GAAG,KAAK,WAAWF,MAAME,GAAG,KAAK,KAAK;YAC9CF,MAAMG,cAAc;YACpBhB,SAASc;QACX;IACF;IAEA,qBACE,KAACG;QACCC,aAAU;QACVC,KAAKjB;QACLkB,MAAK;QACLC,cAAW;QACXC,oBAAiB;QACjBrB,WAAWT,GAAGC,0BAA0BQ;kBAEvCJ,aAAa0B,GAAG,CAAC,CAACT;YACjB,MAAMU,aAAazB,UAAU,QAAQe,cAAcf;YACnD,qBACE,KAACkB;gBAECE,KAAKK,aAAarB,kBAAkBsB;gBACpCC,UAAU;gBACVzB,WAAWT,GACTE,0BACA8B,aACI7B,+BACAC;gBAEN+B,SAAS,IAAM3B,SAASc;gBACxBc,WAAW,CAACf,QAAUD,cAAcC,OAAOC;gBAC3CM,MAAK;gBACLS,iBAAeL;0BAEdV;eAdIA;QAiBX;;AAGN,EAAE"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Shared numeric constants for date/time picker components.
|
|
3
|
+
* Colors and typography are applied via Tailwind utility classes — no CSS
|
|
4
|
+
* variable strings are exported from here.
|
|
5
|
+
*/
|
|
6
|
+
import type { AmPm } from "../utils/format-utils";
|
|
2
7
|
export declare const HOURS_IN_DAY = 24;
|
|
3
8
|
export declare const HOURS_IN_12H = 12;
|
|
4
9
|
export declare const MINUTES_IN_HOUR = 60;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared numeric constants for date/time picker components.
|
|
3
|
+
* Colors and typography are applied via Tailwind utility classes — no CSS
|
|
4
|
+
* variable strings are exported from here.
|
|
5
|
+
*/ // Time values
|
|
6
|
+
export const HOURS_IN_DAY = 24;
|
|
7
|
+
export const HOURS_IN_12H = 12;
|
|
8
|
+
export const MINUTES_IN_HOUR = 60;
|
|
9
|
+
export const MINUTE_INCREMENT = 1;
|
|
10
|
+
// Default time values
|
|
11
|
+
export const DEFAULT_START_HOUR = 9;
|
|
12
|
+
export const DEFAULT_END_HOUR = 17;
|
|
13
|
+
export const DEFAULT_MINUTE = 0;
|
|
14
|
+
export const START_OF_DAY_HOUR = 0;
|
|
15
|
+
export const END_OF_DAY_HOUR = 23;
|
|
16
|
+
export const END_OF_DAY_MINUTE = 59;
|
|
17
|
+
export const DEFAULT_START_AMPM = 'AM';
|
|
18
|
+
export const DEFAULT_END_AMPM = 'PM';
|
|
19
|
+
// 12h/24h conversion constants
|
|
20
|
+
export const NOON_HOUR = 12;
|
|
21
|
+
export const MIDNIGHT_HOUR = 0;
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/ui/core/date-time-pickers/shared/constants.ts"],"sourcesContent":["/**\n * Shared numeric constants for date/time picker components.\n * Colors and typography are applied via Tailwind utility classes — no CSS\n * variable strings are exported from here.\n */\n\nimport type { AmPm } from '../utils/format-utils';\n\n// Time values\nexport const HOURS_IN_DAY = 24;\nexport const HOURS_IN_12H = 12;\nexport const MINUTES_IN_HOUR = 60;\nexport const MINUTE_INCREMENT = 1;\n\n// Default time values\nexport const DEFAULT_START_HOUR = 9;\nexport const DEFAULT_END_HOUR = 17;\nexport const DEFAULT_MINUTE = 0;\nexport const START_OF_DAY_HOUR = 0;\nexport const END_OF_DAY_HOUR = 23;\nexport const END_OF_DAY_MINUTE = 59;\nexport const DEFAULT_START_AMPM: AmPm = 'AM';\nexport const DEFAULT_END_AMPM: AmPm = 'PM';\n\n// 12h/24h conversion constants\nexport const NOON_HOUR = 12;\nexport const MIDNIGHT_HOUR = 0;\n"],"names":["HOURS_IN_DAY","HOURS_IN_12H","MINUTES_IN_HOUR","MINUTE_INCREMENT","DEFAULT_START_HOUR","DEFAULT_END_HOUR","DEFAULT_MINUTE","START_OF_DAY_HOUR","END_OF_DAY_HOUR","END_OF_DAY_MINUTE","DEFAULT_START_AMPM","DEFAULT_END_AMPM","NOON_HOUR","MIDNIGHT_HOUR"],"mappings":"AAAA;;;;CAIC,GAID,cAAc;AACd,OAAO,MAAMA,eAAe,GAAG;AAC/B,OAAO,MAAMC,eAAe,GAAG;AAC/B,OAAO,MAAMC,kBAAkB,GAAG;AAClC,OAAO,MAAMC,mBAAmB,EAAE;AAElC,sBAAsB;AACtB,OAAO,MAAMC,qBAAqB,EAAE;AACpC,OAAO,MAAMC,mBAAmB,GAAG;AACnC,OAAO,MAAMC,iBAAiB,EAAE;AAChC,OAAO,MAAMC,oBAAoB,EAAE;AACnC,OAAO,MAAMC,kBAAkB,GAAG;AAClC,OAAO,MAAMC,oBAAoB,GAAG;AACpC,OAAO,MAAMC,qBAA2B,KAAK;AAC7C,OAAO,MAAMC,mBAAyB,KAAK;AAE3C,+BAA+B;AAC/B,OAAO,MAAMC,YAAY,GAAG;AAC5B,OAAO,MAAMC,gBAAgB,EAAE"}
|