@cognite/aura 0.3.5 → 1.46105.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 +21 -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 +22 -22
- 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 +69 -55
- 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 +104 -76
- 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 +402 -132
- 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 +44 -33
- 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 -1
- package/dist/components/ui/core/data-grid/index.js +5 -2
- 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 +10 -10
- package/dist/components/ui/core/segmented-control/segmented-control.js +203 -149
- 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 +46 -11
- package/src/components/ui/core/button/button.md +93 -0
|
@@ -1,53 +1,96 @@
|
|
|
1
|
-
import { useCallback
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
import { useCallback, useRef, useState } from "react";
|
|
2
|
+
export const useRangeDateState = ({ value, defaultDate, mapDate, onEndDateSelected })=>{
|
|
3
|
+
const applyMap = useCallback((date, role)=>mapDate ? mapDate(date, role) : date, [
|
|
4
|
+
mapDate
|
|
5
|
+
]);
|
|
6
|
+
const [tempStart, setTempStart] = useState(value[0]);
|
|
7
|
+
const [tempEnd, setTempEnd] = useState(value[1]);
|
|
8
|
+
const [displayedMonth, setDisplayedMonth] = useState(()=>value[0] ?? defaultDate);
|
|
9
|
+
const [hoverDate, setHoverDate] = useState(null);
|
|
10
|
+
const stateRef = useRef({
|
|
11
|
+
tempStart: value[0],
|
|
12
|
+
tempEnd: value[1]
|
|
13
|
+
});
|
|
14
|
+
const updateStart = useCallback((date)=>{
|
|
15
|
+
stateRef.current.tempStart = date;
|
|
16
|
+
setTempStart(date);
|
|
17
|
+
}, []);
|
|
18
|
+
const updateEnd = useCallback((date)=>{
|
|
19
|
+
stateRef.current.tempEnd = date;
|
|
20
|
+
setTempEnd(date);
|
|
21
|
+
}, []);
|
|
22
|
+
const handleDateClick = useCallback((date, step)=>{
|
|
23
|
+
if (step === 'start') {
|
|
24
|
+
updateStart(applyMap(date, 'start'));
|
|
25
|
+
updateEnd(null);
|
|
26
|
+
setHoverDate(null);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const currentStart = stateRef.current.tempStart;
|
|
30
|
+
if (currentStart && date.isBefore(currentStart, 'day')) {
|
|
31
|
+
updateStart(applyMap(date, 'start'));
|
|
32
|
+
updateEnd(null);
|
|
33
|
+
setHoverDate(null);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const mappedEnd = applyMap(date, 'end');
|
|
37
|
+
updateEnd(mappedEnd);
|
|
38
|
+
setHoverDate(null);
|
|
39
|
+
onEndDateSelected?.(stateRef.current.tempStart, mappedEnd);
|
|
40
|
+
}, [
|
|
41
|
+
applyMap,
|
|
42
|
+
updateStart,
|
|
43
|
+
updateEnd,
|
|
44
|
+
onEndDateSelected
|
|
45
|
+
]);
|
|
46
|
+
const handleDateHover = useCallback((date)=>{
|
|
47
|
+
setHoverDate(date);
|
|
48
|
+
}, []);
|
|
49
|
+
const handleMonthChange = useCallback((month)=>{
|
|
50
|
+
setDisplayedMonth(month);
|
|
51
|
+
}, []);
|
|
52
|
+
const clearActiveSegment = useCallback((step)=>{
|
|
53
|
+
if (step === 'start') {
|
|
54
|
+
updateStart(null);
|
|
55
|
+
return [
|
|
56
|
+
null,
|
|
57
|
+
stateRef.current.tempEnd
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
if (stateRef.current.tempEnd === null) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
updateEnd(null);
|
|
64
|
+
return [
|
|
65
|
+
stateRef.current.tempStart,
|
|
66
|
+
null
|
|
67
|
+
];
|
|
68
|
+
}, [
|
|
69
|
+
updateStart,
|
|
70
|
+
updateEnd
|
|
71
|
+
]);
|
|
72
|
+
const resetDates = useCallback((newValue)=>{
|
|
73
|
+
updateStart(newValue[0]);
|
|
74
|
+
updateEnd(newValue[1]);
|
|
75
|
+
setHoverDate(null);
|
|
76
|
+
setDisplayedMonth(newValue[0] ?? defaultDate);
|
|
77
|
+
}, [
|
|
78
|
+
updateStart,
|
|
79
|
+
updateEnd,
|
|
80
|
+
defaultDate
|
|
81
|
+
]);
|
|
82
|
+
return {
|
|
83
|
+
tempStart,
|
|
84
|
+
tempEnd,
|
|
85
|
+
displayedMonth,
|
|
86
|
+
hoverDate,
|
|
87
|
+
stateRef,
|
|
88
|
+
handleDateClick,
|
|
89
|
+
handleDateHover,
|
|
90
|
+
handleMonthChange,
|
|
91
|
+
clearActiveSegment,
|
|
92
|
+
resetDates
|
|
93
|
+
};
|
|
51
94
|
};
|
|
52
|
-
|
|
53
|
-
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=use-range-date-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.ts"],"sourcesContent":["import { useCallback, useRef, useState } from 'react';\n\nimport type { Dayjs } from 'dayjs';\n\nimport type { RangeSelectionStep } from './use-range-step-manager';\n\nexport interface DateStateSnapshot {\n tempStart: Dayjs | null;\n tempEnd: Dayjs | null;\n}\n\nexport interface UseRangeDateStateOptions {\n value: [Dayjs | null, Dayjs | null];\n defaultDate: Dayjs;\n /** Transforms a clicked date before storing; pass time-of-day defaults for datetime variants. */\n mapDate?: (date: Dayjs, role: 'start' | 'end') => Dayjs;\n /** Called when the end date is selected; used for auto-apply in date-only variants. */\n onEndDateSelected?: (start: Dayjs | null, end: Dayjs) => void;\n}\n\nexport interface UseRangeDateStateReturn {\n tempStart: Dayjs | null;\n tempEnd: Dayjs | null;\n displayedMonth: Dayjs;\n hoverDate: Dayjs | null;\n /** Synchronous ref — use inside callbacks to avoid stale closures. */\n stateRef: React.MutableRefObject<DateStateSnapshot>;\n handleDateClick: (date: Dayjs, step: RangeSelectionStep) => void;\n handleDateHover: (date: Dayjs | null) => void;\n handleMonthChange: (month: Dayjs) => void;\n /** Returns the new [start, end] tuple, or null if the segment was already empty (signals caller to move focus to start). */\n clearActiveSegment: (\n step: RangeSelectionStep\n ) => [Dayjs | null, Dayjs | null] | null;\n resetDates: (value: [Dayjs | null, Dayjs | null]) => void;\n}\n\nexport const useRangeDateState = ({\n value,\n defaultDate,\n mapDate,\n onEndDateSelected,\n}: UseRangeDateStateOptions): UseRangeDateStateReturn => {\n const applyMap = useCallback(\n (date: Dayjs, role: 'start' | 'end'): Dayjs =>\n mapDate ? mapDate(date, role) : date,\n [mapDate]\n );\n\n const [tempStart, setTempStart] = useState<Dayjs | null>(value[0]);\n const [tempEnd, setTempEnd] = useState<Dayjs | null>(value[1]);\n const [displayedMonth, setDisplayedMonth] = useState<Dayjs>(\n () => value[0] ?? defaultDate\n );\n const [hoverDate, setHoverDate] = useState<Dayjs | null>(null);\n\n const stateRef = useRef<DateStateSnapshot>({\n tempStart: value[0],\n tempEnd: value[1],\n });\n\n const updateStart = useCallback((date: Dayjs | null) => {\n stateRef.current.tempStart = date;\n setTempStart(date);\n }, []);\n\n const updateEnd = useCallback((date: Dayjs | null) => {\n stateRef.current.tempEnd = date;\n setTempEnd(date);\n }, []);\n\n const handleDateClick = useCallback(\n (date: Dayjs, step: RangeSelectionStep) => {\n if (step === 'start') {\n updateStart(applyMap(date, 'start'));\n updateEnd(null);\n setHoverDate(null);\n return;\n }\n\n const currentStart = stateRef.current.tempStart;\n if (currentStart && date.isBefore(currentStart, 'day')) {\n updateStart(applyMap(date, 'start'));\n updateEnd(null);\n setHoverDate(null);\n return;\n }\n\n const mappedEnd = applyMap(date, 'end');\n updateEnd(mappedEnd);\n setHoverDate(null);\n onEndDateSelected?.(stateRef.current.tempStart, mappedEnd);\n },\n [applyMap, updateStart, updateEnd, onEndDateSelected]\n );\n\n const handleDateHover = useCallback((date: Dayjs | null) => {\n setHoverDate(date);\n }, []);\n\n const handleMonthChange = useCallback((month: Dayjs) => {\n setDisplayedMonth(month);\n }, []);\n\n const clearActiveSegment = useCallback(\n (step: RangeSelectionStep): [Dayjs | null, Dayjs | null] | null => {\n if (step === 'start') {\n updateStart(null);\n return [null, stateRef.current.tempEnd];\n }\n if (stateRef.current.tempEnd === null) {\n return null;\n }\n updateEnd(null);\n return [stateRef.current.tempStart, null];\n },\n [updateStart, updateEnd]\n );\n\n const resetDates = useCallback(\n (newValue: [Dayjs | null, Dayjs | null]) => {\n updateStart(newValue[0]);\n updateEnd(newValue[1]);\n setHoverDate(null);\n setDisplayedMonth(newValue[0] ?? defaultDate);\n },\n [updateStart, updateEnd, defaultDate]\n );\n\n return {\n tempStart,\n tempEnd,\n displayedMonth,\n hoverDate,\n stateRef,\n handleDateClick,\n handleDateHover,\n handleMonthChange,\n clearActiveSegment,\n resetDates,\n };\n};\n"],"names":["useCallback","useRef","useState","useRangeDateState","value","defaultDate","mapDate","onEndDateSelected","applyMap","date","role","tempStart","setTempStart","tempEnd","setTempEnd","displayedMonth","setDisplayedMonth","hoverDate","setHoverDate","stateRef","updateStart","current","updateEnd","handleDateClick","step","currentStart","isBefore","mappedEnd","handleDateHover","handleMonthChange","month","clearActiveSegment","resetDates","newValue"],"mappings":"AAAA,SAASA,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAqCtD,OAAO,MAAMC,oBAAoB,CAAC,EAChCC,KAAK,EACLC,WAAW,EACXC,OAAO,EACPC,iBAAiB,EACQ;IACzB,MAAMC,WAAWR,YACf,CAACS,MAAaC,OACZJ,UAAUA,QAAQG,MAAMC,QAAQD,MAClC;QAACH;KAAQ;IAGX,MAAM,CAACK,WAAWC,aAAa,GAAGV,SAAuBE,KAAK,CAAC,EAAE;IACjE,MAAM,CAACS,SAASC,WAAW,GAAGZ,SAAuBE,KAAK,CAAC,EAAE;IAC7D,MAAM,CAACW,gBAAgBC,kBAAkB,GAAGd,SAC1C,IAAME,KAAK,CAAC,EAAE,IAAIC;IAEpB,MAAM,CAACY,WAAWC,aAAa,GAAGhB,SAAuB;IAEzD,MAAMiB,WAAWlB,OAA0B;QACzCU,WAAWP,KAAK,CAAC,EAAE;QACnBS,SAAST,KAAK,CAAC,EAAE;IACnB;IAEA,MAAMgB,cAAcpB,YAAY,CAACS;QAC/BU,SAASE,OAAO,CAACV,SAAS,GAAGF;QAC7BG,aAAaH;IACf,GAAG,EAAE;IAEL,MAAMa,YAAYtB,YAAY,CAACS;QAC7BU,SAASE,OAAO,CAACR,OAAO,GAAGJ;QAC3BK,WAAWL;IACb,GAAG,EAAE;IAEL,MAAMc,kBAAkBvB,YACtB,CAACS,MAAae;QACZ,IAAIA,SAAS,SAAS;YACpBJ,YAAYZ,SAASC,MAAM;YAC3Ba,UAAU;YACVJ,aAAa;YACb;QACF;QAEA,MAAMO,eAAeN,SAASE,OAAO,CAACV,SAAS;QAC/C,IAAIc,gBAAgBhB,KAAKiB,QAAQ,CAACD,cAAc,QAAQ;YACtDL,YAAYZ,SAASC,MAAM;YAC3Ba,UAAU;YACVJ,aAAa;YACb;QACF;QAEA,MAAMS,YAAYnB,SAASC,MAAM;QACjCa,UAAUK;QACVT,aAAa;QACbX,oBAAoBY,SAASE,OAAO,CAACV,SAAS,EAAEgB;IAClD,GACA;QAACnB;QAAUY;QAAaE;QAAWf;KAAkB;IAGvD,MAAMqB,kBAAkB5B,YAAY,CAACS;QACnCS,aAAaT;IACf,GAAG,EAAE;IAEL,MAAMoB,oBAAoB7B,YAAY,CAAC8B;QACrCd,kBAAkBc;IACpB,GAAG,EAAE;IAEL,MAAMC,qBAAqB/B,YACzB,CAACwB;QACC,IAAIA,SAAS,SAAS;YACpBJ,YAAY;YACZ,OAAO;gBAAC;gBAAMD,SAASE,OAAO,CAACR,OAAO;aAAC;QACzC;QACA,IAAIM,SAASE,OAAO,CAACR,OAAO,KAAK,MAAM;YACrC,OAAO;QACT;QACAS,UAAU;QACV,OAAO;YAACH,SAASE,OAAO,CAACV,SAAS;YAAE;SAAK;IAC3C,GACA;QAACS;QAAaE;KAAU;IAG1B,MAAMU,aAAahC,YACjB,CAACiC;QACCb,YAAYa,QAAQ,CAAC,EAAE;QACvBX,UAAUW,QAAQ,CAAC,EAAE;QACrBf,aAAa;QACbF,kBAAkBiB,QAAQ,CAAC,EAAE,IAAI5B;IACnC,GACA;QAACe;QAAaE;QAAWjB;KAAY;IAGvC,OAAO;QACLM;QACAE;QACAE;QACAE;QACAE;QACAI;QACAK;QACAC;QACAE;QACAC;IACF;AACF,EAAE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type RangeSelectionStep =
|
|
1
|
+
export type RangeSelectionStep = "start" | "end";
|
|
2
2
|
export interface UseRangeStepManagerReturn {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
step: RangeSelectionStep;
|
|
4
|
+
handleNext: () => void;
|
|
5
|
+
handleBack: () => void;
|
|
6
|
+
resetStep: () => void;
|
|
7
7
|
}
|
|
8
8
|
export declare const useRangeStepManager: () => UseRangeStepManagerReturn;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import { useCallback
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
export const useRangeStepManager = ()=>{
|
|
3
|
+
const [step, setStep] = useState('start');
|
|
4
|
+
const handleNext = useCallback(()=>{
|
|
5
|
+
setStep('end');
|
|
6
|
+
}, []);
|
|
7
|
+
// Navigates back to the start step during range selection
|
|
8
|
+
const handleBack = useCallback(()=>{
|
|
9
|
+
setStep('start');
|
|
10
|
+
}, []);
|
|
11
|
+
// Resets selection to the initial start step (e.g. after a value is committed)
|
|
12
|
+
const resetStep = useCallback(()=>{
|
|
13
|
+
setStep('start');
|
|
14
|
+
}, []);
|
|
15
|
+
return {
|
|
16
|
+
step,
|
|
17
|
+
handleNext,
|
|
18
|
+
handleBack,
|
|
19
|
+
resetStep
|
|
20
|
+
};
|
|
17
21
|
};
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=use-range-step-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\n\nexport type RangeSelectionStep = 'start' | 'end';\n\nexport interface UseRangeStepManagerReturn {\n step: RangeSelectionStep;\n handleNext: () => void;\n handleBack: () => void;\n resetStep: () => void;\n}\n\nexport const useRangeStepManager = (): UseRangeStepManagerReturn => {\n const [step, setStep] = useState<RangeSelectionStep>('start');\n\n const handleNext = useCallback(() => {\n setStep('end');\n }, []);\n\n // Navigates back to the start step during range selection\n const handleBack = useCallback(() => {\n setStep('start');\n }, []);\n\n // Resets selection to the initial start step (e.g. after a value is committed)\n const resetStep = useCallback(() => {\n setStep('start');\n }, []);\n\n return {\n step,\n handleNext,\n handleBack,\n resetStep,\n };\n};\n"],"names":["useCallback","useState","useRangeStepManager","step","setStep","handleNext","handleBack","resetStep"],"mappings":"AAAA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,QAAQ;AAW9C,OAAO,MAAMC,sBAAsB;IACjC,MAAM,CAACC,MAAMC,QAAQ,GAAGH,SAA6B;IAErD,MAAMI,aAAaL,YAAY;QAC7BI,QAAQ;IACV,GAAG,EAAE;IAEL,0DAA0D;IAC1D,MAAME,aAAaN,YAAY;QAC7BI,QAAQ;IACV,GAAG,EAAE;IAEL,+EAA+E;IAC/E,MAAMG,YAAYP,YAAY;QAC5BI,QAAQ;IACV,GAAG,EAAE;IAEL,OAAO;QACLD;QACAE;QACAC;QACAC;IACF;AACF,EAAE"}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { Dayjs } from
|
|
1
|
+
import type { Dayjs } from "dayjs";
|
|
2
2
|
export interface UseSingleDateStateOptions {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
value: Dayjs | null;
|
|
4
|
+
defaultDate: Dayjs;
|
|
5
|
+
/** Transforms a clicked date before storing; pass time-of-day defaults for datetime variants. */
|
|
6
|
+
mapDate?: (date: Dayjs) => Dayjs;
|
|
7
|
+
/** Called when a date is selected; used for auto-apply in date-only variants. */
|
|
8
|
+
onDateSelected?: (date: Dayjs) => void;
|
|
9
9
|
}
|
|
10
10
|
export interface UseSingleDateStateReturn {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
tempDate: Dayjs | null;
|
|
12
|
+
displayedMonth: Dayjs;
|
|
13
|
+
/** Synchronous ref — use inside callbacks to avoid stale closures. */
|
|
14
|
+
stateRef: React.MutableRefObject<{
|
|
15
|
+
tempDate: Dayjs | null;
|
|
16
|
+
}>;
|
|
17
|
+
handleDateClick: (date: Dayjs) => void;
|
|
18
|
+
handleMonthChange: (month: Dayjs) => void;
|
|
19
|
+
/** Returns true when a date was cleared, false when already empty. */
|
|
20
|
+
clearDate: () => boolean;
|
|
21
|
+
resetDate: (value: Dayjs | null) => void;
|
|
22
22
|
}
|
|
23
|
-
export declare const useSingleDateState: ({ value, defaultDate, mapDate, onDateSelected
|
|
23
|
+
export declare const useSingleDateState: ({ value, defaultDate, mapDate, onDateSelected }: UseSingleDateStateOptions) => UseSingleDateStateReturn;
|
|
@@ -1,25 +1,42 @@
|
|
|
1
|
-
import { useRef
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { useRef, useState } from "react";
|
|
2
|
+
export const useSingleDateState = ({ value, defaultDate, mapDate, onDateSelected })=>{
|
|
3
|
+
const [tempDate, setTempDate] = useState(value);
|
|
4
|
+
const [displayedMonth, setDisplayedMonth] = useState(()=>value ?? defaultDate);
|
|
5
|
+
const stateRef = useRef({
|
|
6
|
+
tempDate: value
|
|
7
|
+
});
|
|
8
|
+
const updateDate = (date)=>{
|
|
9
|
+
stateRef.current.tempDate = date;
|
|
10
|
+
setTempDate(date);
|
|
11
|
+
};
|
|
12
|
+
const handleDateClick = (date)=>{
|
|
13
|
+
const mapped = mapDate ? mapDate(date) : date;
|
|
14
|
+
updateDate(mapped);
|
|
15
|
+
onDateSelected?.(mapped);
|
|
16
|
+
};
|
|
17
|
+
const handleMonthChange = (month)=>{
|
|
18
|
+
setDisplayedMonth(month);
|
|
19
|
+
};
|
|
20
|
+
const clearDate = ()=>{
|
|
21
|
+
if (stateRef.current.tempDate === null) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
updateDate(null);
|
|
25
|
+
return true;
|
|
26
|
+
};
|
|
27
|
+
const resetDate = (newValue)=>{
|
|
28
|
+
updateDate(newValue);
|
|
29
|
+
setDisplayedMonth(newValue ?? defaultDate);
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
tempDate,
|
|
33
|
+
displayedMonth,
|
|
34
|
+
stateRef,
|
|
35
|
+
handleDateClick,
|
|
36
|
+
handleMonthChange,
|
|
37
|
+
clearDate,
|
|
38
|
+
resetDate
|
|
39
|
+
};
|
|
23
40
|
};
|
|
24
|
-
|
|
25
|
-
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=use-single-date-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.ts"],"sourcesContent":["import { useRef, useState } from 'react';\n\nimport type { Dayjs } from 'dayjs';\n\nexport interface UseSingleDateStateOptions {\n value: Dayjs | null;\n defaultDate: Dayjs;\n /** Transforms a clicked date before storing; pass time-of-day defaults for datetime variants. */\n mapDate?: (date: Dayjs) => Dayjs;\n /** Called when a date is selected; used for auto-apply in date-only variants. */\n onDateSelected?: (date: Dayjs) => void;\n}\n\nexport interface UseSingleDateStateReturn {\n tempDate: Dayjs | null;\n displayedMonth: Dayjs;\n /** Synchronous ref — use inside callbacks to avoid stale closures. */\n stateRef: React.MutableRefObject<{ tempDate: Dayjs | null }>;\n handleDateClick: (date: Dayjs) => void;\n handleMonthChange: (month: Dayjs) => void;\n /** Returns true when a date was cleared, false when already empty. */\n clearDate: () => boolean;\n resetDate: (value: Dayjs | null) => void;\n}\n\nexport const useSingleDateState = ({\n value,\n defaultDate,\n mapDate,\n onDateSelected,\n}: UseSingleDateStateOptions): UseSingleDateStateReturn => {\n const [tempDate, setTempDate] = useState<Dayjs | null>(value);\n const [displayedMonth, setDisplayedMonth] = useState<Dayjs>(\n () => value ?? defaultDate\n );\n\n const stateRef = useRef({ tempDate: value });\n\n const updateDate = (date: Dayjs | null) => {\n stateRef.current.tempDate = date;\n setTempDate(date);\n };\n\n const handleDateClick = (date: Dayjs) => {\n const mapped = mapDate ? mapDate(date) : date;\n updateDate(mapped);\n onDateSelected?.(mapped);\n };\n\n const handleMonthChange = (month: Dayjs) => {\n setDisplayedMonth(month);\n };\n\n const clearDate = (): boolean => {\n if (stateRef.current.tempDate === null) {\n return false;\n }\n updateDate(null);\n return true;\n };\n\n const resetDate = (newValue: Dayjs | null) => {\n updateDate(newValue);\n setDisplayedMonth(newValue ?? defaultDate);\n };\n\n return {\n tempDate,\n displayedMonth,\n stateRef,\n handleDateClick,\n handleMonthChange,\n clearDate,\n resetDate,\n };\n};\n"],"names":["useRef","useState","useSingleDateState","value","defaultDate","mapDate","onDateSelected","tempDate","setTempDate","displayedMonth","setDisplayedMonth","stateRef","updateDate","date","current","handleDateClick","mapped","handleMonthChange","month","clearDate","resetDate","newValue"],"mappings":"AAAA,SAASA,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAyBzC,OAAO,MAAMC,qBAAqB,CAAC,EACjCC,KAAK,EACLC,WAAW,EACXC,OAAO,EACPC,cAAc,EACY;IAC1B,MAAM,CAACC,UAAUC,YAAY,GAAGP,SAAuBE;IACvD,MAAM,CAACM,gBAAgBC,kBAAkB,GAAGT,SAC1C,IAAME,SAASC;IAGjB,MAAMO,WAAWX,OAAO;QAAEO,UAAUJ;IAAM;IAE1C,MAAMS,aAAa,CAACC;QAClBF,SAASG,OAAO,CAACP,QAAQ,GAAGM;QAC5BL,YAAYK;IACd;IAEA,MAAME,kBAAkB,CAACF;QACvB,MAAMG,SAASX,UAAUA,QAAQQ,QAAQA;QACzCD,WAAWI;QACXV,iBAAiBU;IACnB;IAEA,MAAMC,oBAAoB,CAACC;QACzBR,kBAAkBQ;IACpB;IAEA,MAAMC,YAAY;QAChB,IAAIR,SAASG,OAAO,CAACP,QAAQ,KAAK,MAAM;YACtC,OAAO;QACT;QACAK,WAAW;QACX,OAAO;IACT;IAEA,MAAMQ,YAAY,CAACC;QACjBT,WAAWS;QACXX,kBAAkBW,YAAYjB;IAChC;IAEA,OAAO;QACLG;QACAE;QACAE;QACAI;QACAE;QACAE;QACAC;IACF;AACF,EAAE"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { AmPm, TimeFormat } from
|
|
1
|
+
import type { AmPm, TimeFormat } from "../../utils/format-utils";
|
|
2
2
|
export interface UseTimeStateOptions {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
initialHour?: number;
|
|
4
|
+
initialMinute?: number;
|
|
5
|
+
timeFormat?: TimeFormat;
|
|
6
6
|
}
|
|
7
7
|
export interface UseTimeStateReturn {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
hour: number;
|
|
9
|
+
minute: number;
|
|
10
|
+
amPm: AmPm;
|
|
11
|
+
hour24: number;
|
|
12
|
+
handleHourChange: (hour: number) => void;
|
|
13
|
+
handleMinuteChange: (minute: number) => void;
|
|
14
|
+
handleAmPmChange: (amPm: AmPm) => void;
|
|
15
|
+
resetTime: (hour: number, minute: number) => void;
|
|
16
16
|
}
|
|
17
|
-
export declare const useTimeState: ({ initialHour, initialMinute, timeFormat
|
|
17
|
+
export declare const useTimeState: ({ initialHour, initialMinute, timeFormat }?: UseTimeStateOptions) => UseTimeStateReturn;
|
|
@@ -1,25 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { useCallback, useMemo, useState } from "react";
|
|
2
|
+
import { convert12HourTo24Hour, convert24HourTo12Hour, getAmPmFromHour } from "../../utils/time-utils.js";
|
|
3
|
+
import { DEFAULT_MINUTE, DEFAULT_START_HOUR } from "../constants.js";
|
|
4
|
+
export const useTimeState = ({ initialHour = DEFAULT_START_HOUR, initialMinute = DEFAULT_MINUTE, timeFormat = '24h' } = {})=>{
|
|
5
|
+
const initialDisplayHour = timeFormat === '12h' ? convert24HourTo12Hour(initialHour) : initialHour;
|
|
6
|
+
const [hour, setHour] = useState(initialDisplayHour);
|
|
7
|
+
const [minute, setMinute] = useState(initialMinute);
|
|
8
|
+
const [amPm, setAmPm] = useState(()=>getAmPmFromHour(initialHour));
|
|
9
|
+
const hour24 = useMemo(()=>timeFormat === '12h' ? convert12HourTo24Hour(hour, amPm) : hour, [
|
|
10
|
+
hour,
|
|
11
|
+
amPm,
|
|
12
|
+
timeFormat
|
|
13
|
+
]);
|
|
14
|
+
const resetTime = useCallback((newHour, newMinute)=>{
|
|
15
|
+
const displayHour = timeFormat === '12h' ? convert24HourTo12Hour(newHour) : newHour;
|
|
16
|
+
setHour(displayHour);
|
|
17
|
+
setMinute(newMinute);
|
|
18
|
+
setAmPm(getAmPmFromHour(newHour));
|
|
19
|
+
}, [
|
|
20
|
+
timeFormat
|
|
21
|
+
]);
|
|
22
|
+
return {
|
|
23
|
+
hour,
|
|
24
|
+
minute,
|
|
25
|
+
amPm,
|
|
26
|
+
hour24,
|
|
27
|
+
handleHourChange: setHour,
|
|
28
|
+
handleMinuteChange: setMinute,
|
|
29
|
+
handleAmPmChange: setAmPm,
|
|
30
|
+
resetTime
|
|
31
|
+
};
|
|
23
32
|
};
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=use-time-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/ui/core/date-time-pickers/shared/hooks/use-time-state.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react';\n\nimport type { AmPm, TimeFormat } from '../../utils/format-utils';\nimport {\n convert12HourTo24Hour,\n convert24HourTo12Hour,\n getAmPmFromHour,\n} from '../../utils/time-utils';\nimport { DEFAULT_MINUTE, DEFAULT_START_HOUR } from '../constants';\n\nexport interface UseTimeStateOptions {\n initialHour?: number;\n initialMinute?: number;\n timeFormat?: TimeFormat;\n}\n\nexport interface UseTimeStateReturn {\n hour: number;\n minute: number;\n amPm: AmPm;\n hour24: number;\n handleHourChange: (hour: number) => void;\n handleMinuteChange: (minute: number) => void;\n handleAmPmChange: (amPm: AmPm) => void;\n resetTime: (hour: number, minute: number) => void;\n}\n\nexport const useTimeState = ({\n initialHour = DEFAULT_START_HOUR,\n initialMinute = DEFAULT_MINUTE,\n timeFormat = '24h',\n}: UseTimeStateOptions = {}): UseTimeStateReturn => {\n const initialDisplayHour =\n timeFormat === '12h' ? convert24HourTo12Hour(initialHour) : initialHour;\n const [hour, setHour] = useState(initialDisplayHour);\n const [minute, setMinute] = useState(initialMinute);\n const [amPm, setAmPm] = useState<AmPm>(() => getAmPmFromHour(initialHour));\n\n const hour24 = useMemo(\n () => (timeFormat === '12h' ? convert12HourTo24Hour(hour, amPm) : hour),\n [hour, amPm, timeFormat]\n );\n\n const resetTime = useCallback(\n (newHour: number, newMinute: number) => {\n const displayHour =\n timeFormat === '12h' ? convert24HourTo12Hour(newHour) : newHour;\n setHour(displayHour);\n setMinute(newMinute);\n setAmPm(getAmPmFromHour(newHour));\n },\n [timeFormat]\n );\n\n return {\n hour,\n minute,\n amPm,\n hour24,\n handleHourChange: setHour,\n handleMinuteChange: setMinute,\n handleAmPmChange: setAmPm,\n resetTime,\n };\n};\n"],"names":["useCallback","useMemo","useState","convert12HourTo24Hour","convert24HourTo12Hour","getAmPmFromHour","DEFAULT_MINUTE","DEFAULT_START_HOUR","useTimeState","initialHour","initialMinute","timeFormat","initialDisplayHour","hour","setHour","minute","setMinute","amPm","setAmPm","hour24","resetTime","newHour","newMinute","displayHour","handleHourChange","handleMinuteChange","handleAmPmChange"],"mappings":"AAAA,SAASA,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAGvD,SACEC,qBAAqB,EACrBC,qBAAqB,EACrBC,eAAe,QACV,4BAAyB;AAChC,SAASC,cAAc,EAAEC,kBAAkB,QAAQ,kBAAe;AAmBlE,OAAO,MAAMC,eAAe,CAAC,EAC3BC,cAAcF,kBAAkB,EAChCG,gBAAgBJ,cAAc,EAC9BK,aAAa,KAAK,EACE,GAAG,CAAC,CAAC;IACzB,MAAMC,qBACJD,eAAe,QAAQP,sBAAsBK,eAAeA;IAC9D,MAAM,CAACI,MAAMC,QAAQ,GAAGZ,SAASU;IACjC,MAAM,CAACG,QAAQC,UAAU,GAAGd,SAASQ;IACrC,MAAM,CAACO,MAAMC,QAAQ,GAAGhB,SAAe,IAAMG,gBAAgBI;IAE7D,MAAMU,SAASlB,QACb,IAAOU,eAAe,QAAQR,sBAAsBU,MAAMI,QAAQJ,MAClE;QAACA;QAAMI;QAAMN;KAAW;IAG1B,MAAMS,YAAYpB,YAChB,CAACqB,SAAiBC;QAChB,MAAMC,cACJZ,eAAe,QAAQP,sBAAsBiB,WAAWA;QAC1DP,QAAQS;QACRP,UAAUM;QACVJ,QAAQb,gBAAgBgB;IAC1B,GACA;QAACV;KAAW;IAGd,OAAO;QACLE;QACAE;QACAE;QACAE;QACAK,kBAAkBV;QAClBW,oBAAoBT;QACpBU,kBAAkBR;QAClBE;IACF;AACF,EAAE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* Shared Tailwind class strings for TimePickerScroll and AmPmScroll.
|
|
3
|
+
* Both components render the same scroll container and cell styles.
|
|
4
|
+
*/
|
|
5
5
|
export declare const SCROLL_CONTAINER_CLASSES = "overflow-y-auto flex flex-col items-center py-2 w-9 h-72 shrink-0 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden";
|
|
6
6
|
export declare const SCROLL_ITEM_BASE_CLASSES = "w-9 h-9 flex items-center justify-center rounded-lg cursor-pointer text-sm font-medium leading-[18px] tracking-normal select-none transition-colors duration-150 shrink-0";
|
|
7
|
-
export declare const SCROLL_ITEM_SELECTED_CLASSES = "bg-primary-background text-foreground
|
|
8
|
-
export declare const SCROLL_ITEM_UNSELECTED_CLASSES = "text-
|
|
7
|
+
export declare const SCROLL_ITEM_SELECTED_CLASSES = "bg-primary-background text-primary-foreground hover:bg-primary-background";
|
|
8
|
+
export declare const SCROLL_ITEM_UNSELECTED_CLASSES = "text-medium-foreground hover:bg-medium-background-hover hover:text-medium-foreground";
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Shared Tailwind class strings for TimePickerScroll and AmPmScroll.
|
|
3
|
+
* Both components render the same scroll container and cell styles.
|
|
4
|
+
*/ export const SCROLL_CONTAINER_CLASSES = 'overflow-y-auto flex flex-col items-center py-2 w-9 h-72 shrink-0 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden';
|
|
5
|
+
export const SCROLL_ITEM_BASE_CLASSES = 'w-9 h-9 flex items-center justify-center rounded-lg cursor-pointer text-sm font-medium leading-[18px] tracking-normal select-none transition-colors duration-150 shrink-0';
|
|
6
|
+
export const SCROLL_ITEM_SELECTED_CLASSES = 'bg-primary-background text-primary-foreground hover:bg-primary-background';
|
|
7
|
+
export const SCROLL_ITEM_UNSELECTED_CLASSES = 'text-medium-foreground hover:bg-medium-background-hover hover:text-medium-foreground';
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=scroll-cell-classes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/ui/core/date-time-pickers/shared/scroll-cell-classes.ts"],"sourcesContent":["/**\n * Shared Tailwind class strings for TimePickerScroll and AmPmScroll.\n * Both components render the same scroll container and cell styles.\n */\n\nexport const SCROLL_CONTAINER_CLASSES =\n 'overflow-y-auto flex flex-col items-center py-2 w-9 h-72 shrink-0 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden';\n\nexport const SCROLL_ITEM_BASE_CLASSES =\n 'w-9 h-9 flex items-center justify-center rounded-lg cursor-pointer text-sm font-medium leading-[18px] tracking-normal select-none transition-colors duration-150 shrink-0';\n\nexport const SCROLL_ITEM_SELECTED_CLASSES =\n 'bg-primary-background text-primary-foreground hover:bg-primary-background';\n\nexport const SCROLL_ITEM_UNSELECTED_CLASSES =\n 'text-medium-foreground hover:bg-medium-background-hover hover:text-medium-foreground';\n"],"names":["SCROLL_CONTAINER_CLASSES","SCROLL_ITEM_BASE_CLASSES","SCROLL_ITEM_SELECTED_CLASSES","SCROLL_ITEM_UNSELECTED_CLASSES"],"mappings":"AAAA;;;CAGC,GAED,OAAO,MAAMA,2BACX,yHAAyH;AAE3H,OAAO,MAAMC,2BACX,4KAA4K;AAE9K,OAAO,MAAMC,+BACX,4EAA4E;AAE9E,OAAO,MAAMC,iCACX,uFAAuF"}
|
package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { FC } from
|
|
2
|
-
import {
|
|
3
|
-
export type ShortcutValueDayjs
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { ShortcutValueDayjs, ShortcutValueInput } from "../../utils/date-input";
|
|
3
|
+
export type { ShortcutValueDayjs };
|
|
4
4
|
export interface ShortcutItem {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
id?: string;
|
|
6
|
+
label: string;
|
|
7
|
+
getValue: () => ShortcutValueInput;
|
|
8
8
|
}
|
|
9
|
+
type NormalizedShortcutItem = Omit<ShortcutItem, "getValue"> & {
|
|
10
|
+
getValue: () => ShortcutValueDayjs;
|
|
11
|
+
};
|
|
12
|
+
export type { NormalizedShortcutItem };
|
|
9
13
|
export interface ShortcutsPanelProps {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
shortcuts?: NormalizedShortcutItem[];
|
|
15
|
+
onShortcutClick: (value: ShortcutValueDayjs) => void;
|
|
16
|
+
className?: string;
|
|
13
17
|
}
|
|
14
18
|
export declare const ShortcutsPanel: FC<ShortcutsPanelProps>;
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../../../../../lib/utils.js";
|
|
3
|
+
import { Button } from "../../../button/button.js";
|
|
4
|
+
const DEFAULT_SHORTCUTS = [];
|
|
5
|
+
export const ShortcutsPanel = ({ shortcuts = DEFAULT_SHORTCUTS, onShortcutClick, className })=>{
|
|
6
|
+
if (shortcuts.length === 0) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
10
|
+
"data-slot": "shortcuts-panel",
|
|
11
|
+
className: cn('flex flex-col gap-1 p-3 border-r border-default min-w-[150px]', className),
|
|
12
|
+
children: shortcuts.map((shortcut)=>/*#__PURE__*/ _jsx(Button, {
|
|
13
|
+
variant: "ghost",
|
|
14
|
+
size: "default",
|
|
15
|
+
className: "w-full justify-start text-medium-foreground",
|
|
16
|
+
onClick: ()=>onShortcutClick(shortcut.getValue()),
|
|
17
|
+
children: shortcut.label
|
|
18
|
+
}, shortcut.id ?? shortcut.label))
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=shortcuts-panel.js.map
|
package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.tsx"],"sourcesContent":["import type { FC } from 'react';\n\nimport { cn } from '../../../../../../lib/utils';\nimport { Button } from '../../../button/button';\nimport type {\n ShortcutValueDayjs,\n ShortcutValueInput,\n} from '../../utils/date-input';\n\nexport type { ShortcutValueDayjs };\n\nexport interface ShortcutItem {\n id?: string;\n label: string;\n getValue: () => ShortcutValueInput;\n}\n\ntype NormalizedShortcutItem = Omit<ShortcutItem, 'getValue'> & {\n getValue: () => ShortcutValueDayjs;\n};\n\nexport type { NormalizedShortcutItem };\n\nexport interface ShortcutsPanelProps {\n shortcuts?: NormalizedShortcutItem[];\n onShortcutClick: (value: ShortcutValueDayjs) => void;\n className?: string;\n}\n\nconst DEFAULT_SHORTCUTS: NormalizedShortcutItem[] = [];\n\nexport const ShortcutsPanel: FC<ShortcutsPanelProps> = ({\n shortcuts = DEFAULT_SHORTCUTS,\n onShortcutClick,\n className,\n}) => {\n if (shortcuts.length === 0) {\n return null;\n }\n\n return (\n <div\n data-slot=\"shortcuts-panel\"\n className={cn(\n 'flex flex-col gap-1 p-3 border-r border-default min-w-[150px]',\n className\n )}\n >\n {shortcuts.map((shortcut) => (\n <Button\n key={shortcut.id ?? shortcut.label}\n variant=\"ghost\"\n size=\"default\"\n className=\"w-full justify-start text-medium-foreground\"\n onClick={() => onShortcutClick(shortcut.getValue())}\n >\n {shortcut.label}\n </Button>\n ))}\n </div>\n );\n};\n"],"names":["cn","Button","DEFAULT_SHORTCUTS","ShortcutsPanel","shortcuts","onShortcutClick","className","length","div","data-slot","map","shortcut","variant","size","onClick","getValue","label","id"],"mappings":";AAEA,SAASA,EAAE,QAAQ,iCAA8B;AACjD,SAASC,MAAM,QAAQ,4BAAyB;AA0BhD,MAAMC,oBAA8C,EAAE;AAEtD,OAAO,MAAMC,iBAA0C,CAAC,EACtDC,YAAYF,iBAAiB,EAC7BG,eAAe,EACfC,SAAS,EACV;IACC,IAAIF,UAAUG,MAAM,KAAK,GAAG;QAC1B,OAAO;IACT;IAEA,qBACE,KAACC;QACCC,aAAU;QACVH,WAAWN,GACT,iEACAM;kBAGDF,UAAUM,GAAG,CAAC,CAACC,yBACd,KAACV;gBAECW,SAAQ;gBACRC,MAAK;gBACLP,WAAU;gBACVQ,SAAS,IAAMT,gBAAgBM,SAASI,QAAQ;0BAE/CJ,SAASK,KAAK;eANVL,SAASM,EAAE,IAAIN,SAASK,KAAK;;AAW5C,EAAE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { TimePickerPanel } from
|
|
2
|
-
export type { TimePickerPanelProps } from
|
|
1
|
+
export { TimePickerPanel } from "./time-picker-panel";
|
|
2
|
+
export type { TimePickerPanelProps } from "./time-picker-panel";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/ui/core/date-time-pickers/shared/time-picker-panel/index.ts"],"sourcesContent":["export { TimePickerPanel } from './time-picker-panel';\nexport type { TimePickerPanelProps } from './time-picker-panel';\n"],"names":["TimePickerPanel"],"mappings":"AAAA,SAASA,eAAe,QAAQ,yBAAsB"}
|