@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
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
const LIST_ELEMENTS = new Set([
|
|
3
|
+
'ol',
|
|
4
|
+
'ul',
|
|
5
|
+
'menu'
|
|
6
|
+
]);
|
|
7
|
+
export function resolveInjectedElement(as) {
|
|
8
|
+
return typeof as === 'string' && LIST_ELEMENTS.has(as) ? 'li' : 'span';
|
|
9
|
+
}
|
|
10
|
+
export function resolveCollapseOrder(order, itemCount) {
|
|
11
|
+
const rawOrder = Array.isArray(order) ? order : resolveStrategyOrder(order, itemCount);
|
|
12
|
+
const isInBounds = (index)=>index >= 0 && index < itemCount;
|
|
13
|
+
return rawOrder.map((unit)=>Array.isArray(unit) ? unit.filter(isInBounds) : unit).filter((unit)=>Array.isArray(unit) ? unit.length > 0 : isInBounds(unit));
|
|
14
|
+
}
|
|
15
|
+
function resolveStrategyOrder(strategy, itemCount) {
|
|
16
|
+
switch(strategy){
|
|
17
|
+
case 'asc':
|
|
18
|
+
return Array.from({
|
|
19
|
+
length: itemCount
|
|
20
|
+
}, (_, i)=>i);
|
|
21
|
+
case 'desc':
|
|
22
|
+
return Array.from({
|
|
23
|
+
length: itemCount
|
|
24
|
+
}, (_, i)=>itemCount - 1 - i);
|
|
25
|
+
case 'innerAscFirstKeepLast':
|
|
26
|
+
if (itemCount <= 1) return [];
|
|
27
|
+
return [
|
|
28
|
+
...Array.from({
|
|
29
|
+
length: itemCount - 2
|
|
30
|
+
}, (_, i)=>i + 1),
|
|
31
|
+
0
|
|
32
|
+
];
|
|
33
|
+
case 'innerDescFirstKeepLast':
|
|
34
|
+
if (itemCount <= 1) return [];
|
|
35
|
+
return Array.from({
|
|
36
|
+
length: itemCount - 1
|
|
37
|
+
}, (_, i)=>itemCount - 2 - i);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export const INITIAL_STATE = {
|
|
41
|
+
hiddenIndices: [],
|
|
42
|
+
overflowAt: 0
|
|
43
|
+
};
|
|
44
|
+
export function arraysEqual(a, b) {
|
|
45
|
+
return a.length === b.length && a.every((value, i)=>value === b[i]);
|
|
46
|
+
}
|
|
47
|
+
export function totalWidth(itemWidths, gap) {
|
|
48
|
+
return itemWidths.reduce((sum, w, i)=>sum + (i > 0 ? gap : 0) + w, 0);
|
|
49
|
+
}
|
|
50
|
+
export const FIT_EPSILON = 0.5;
|
|
51
|
+
export function getMeasurements(measureEl, overflowEl, hasSep, orientation = 'horizontal', lastItemFlexibleSelector) {
|
|
52
|
+
const children = Array.from(measureEl.children);
|
|
53
|
+
const itemElements = hasSep ? children.filter((child)=>child.getAttribute('data-slot') !== 'separator') : children;
|
|
54
|
+
const measuredItemCount = itemElements.length;
|
|
55
|
+
const itemWidths = [];
|
|
56
|
+
const isVertical = orientation === 'vertical';
|
|
57
|
+
for(let i = 0; i < measuredItemCount; i++){
|
|
58
|
+
const rect = itemElements[i]?.getBoundingClientRect();
|
|
59
|
+
itemWidths.push(isVertical ? rect?.height ?? 0 : rect?.width ?? 0);
|
|
60
|
+
}
|
|
61
|
+
let gap = 0;
|
|
62
|
+
if (measuredItemCount >= 2) {
|
|
63
|
+
const first = itemElements[0]?.getBoundingClientRect();
|
|
64
|
+
const second = itemElements[1]?.getBoundingClientRect();
|
|
65
|
+
if (first && second) {
|
|
66
|
+
gap = isVertical ? Math.max(0, second.top - first.bottom) : Math.max(0, second.left - first.right);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
let outerMarginLeft = 0;
|
|
70
|
+
let outerMarginRight = 0;
|
|
71
|
+
if (measuredItemCount > 0) {
|
|
72
|
+
const measureRect = measureEl.getBoundingClientRect();
|
|
73
|
+
const firstRect = itemElements[0]?.getBoundingClientRect();
|
|
74
|
+
const lastRect = itemElements[itemElements.length - 1]?.getBoundingClientRect();
|
|
75
|
+
if (isVertical) {
|
|
76
|
+
outerMarginLeft = Math.max(0, firstRect ? firstRect.top - measureRect.top : 0);
|
|
77
|
+
outerMarginRight = Math.max(0, lastRect ? measureRect.bottom - lastRect.bottom : 0);
|
|
78
|
+
} else {
|
|
79
|
+
outerMarginLeft = Math.max(0, firstRect ? firstRect.left - measureRect.left : 0);
|
|
80
|
+
outerMarginRight = Math.max(0, lastRect ? measureRect.right - lastRect.right : 0);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const overflowRect = (overflowEl.lastElementChild ?? overflowEl).getBoundingClientRect();
|
|
84
|
+
const overflowWidth = isVertical ? overflowRect.height : overflowRect.width;
|
|
85
|
+
let lastItemFlexibleWidth;
|
|
86
|
+
if (lastItemFlexibleSelector && measuredItemCount > 0) {
|
|
87
|
+
const flexibleEl = itemElements[measuredItemCount - 1]?.querySelector(lastItemFlexibleSelector);
|
|
88
|
+
if (flexibleEl) {
|
|
89
|
+
const rect = flexibleEl.getBoundingClientRect();
|
|
90
|
+
lastItemFlexibleWidth = isVertical ? rect.height : rect.width;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
itemWidths,
|
|
95
|
+
gap,
|
|
96
|
+
overflowWidth,
|
|
97
|
+
outerMarginLeft,
|
|
98
|
+
outerMarginRight,
|
|
99
|
+
lastItemFlexibleWidth
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export function hideUntilFit(total, itemWidths, gap, overflowCost, hideOrder, containerWidth) {
|
|
103
|
+
const hidden = new Set();
|
|
104
|
+
let currentWidth = total;
|
|
105
|
+
let firstHidden = null;
|
|
106
|
+
for (const unit of hideOrder){
|
|
107
|
+
if (currentWidth <= containerWidth + FIT_EPSILON) break;
|
|
108
|
+
const indices = Array.isArray(unit) ? unit : [
|
|
109
|
+
unit
|
|
110
|
+
];
|
|
111
|
+
if (hidden.size === 0) {
|
|
112
|
+
currentWidth += overflowCost;
|
|
113
|
+
firstHidden = indices[0] ?? null;
|
|
114
|
+
}
|
|
115
|
+
for (const index of indices){
|
|
116
|
+
currentWidth -= (itemWidths[index] ?? 0) + gap;
|
|
117
|
+
hidden.add(index);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
hidden,
|
|
122
|
+
firstHidden
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
export function computeCollapseState({ containerSize, itemWidths, gap, overflowWidth, outerMarginLeft, outerMarginRight, collapseOrder }) {
|
|
126
|
+
const outerMargins = (outerMarginLeft ?? 0) + (outerMarginRight ?? 0);
|
|
127
|
+
if (itemWidths.length === 0 || collapseOrder.length === 0) {
|
|
128
|
+
return INITIAL_STATE;
|
|
129
|
+
}
|
|
130
|
+
const fullWidth = totalWidth(itemWidths, gap) + outerMargins;
|
|
131
|
+
if (fullWidth <= containerSize + FIT_EPSILON) {
|
|
132
|
+
return INITIAL_STATE;
|
|
133
|
+
}
|
|
134
|
+
const { hidden, firstHidden } = hideUntilFit(fullWidth, itemWidths, gap, gap + overflowWidth, collapseOrder, containerSize);
|
|
135
|
+
if (hidden.size === 0) {
|
|
136
|
+
return INITIAL_STATE;
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
hiddenIndices: Array.from(hidden).sort((a, b)=>a - b),
|
|
140
|
+
overflowAt: firstHidden ?? Math.min(...hidden)
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
export function computeCollapsedMinWidth({ itemWidths, gap, overflowWidth, outerMarginLeft = 0, outerMarginRight = 0, collapseOrder, lastItemMinVisible, lastItemFlexibleWidth }) {
|
|
144
|
+
if (itemWidths.length === 0) return 0;
|
|
145
|
+
const outerMargins = outerMarginLeft + outerMarginRight;
|
|
146
|
+
const lastIndex = itemWidths.length - 1;
|
|
147
|
+
const cappedWidths = lastItemMinVisible == null ? itemWidths : itemWidths.map((width, index)=>{
|
|
148
|
+
if (index !== lastIndex) return width;
|
|
149
|
+
const protectedWidth = lastItemFlexibleWidth != null ? Math.max(0, width - lastItemFlexibleWidth) : 0;
|
|
150
|
+
return Math.min(width, protectedWidth + lastItemMinVisible);
|
|
151
|
+
});
|
|
152
|
+
if (collapseOrder.length === 0) return totalWidth(cappedWidths, gap) + outerMargins;
|
|
153
|
+
const collapsible = new Set(collapseOrder.flat());
|
|
154
|
+
const keptWidths = cappedWidths.filter((_, index)=>!collapsible.has(index));
|
|
155
|
+
const firstIsKept = !collapsible.has(0);
|
|
156
|
+
const lastIsKept = !collapsible.has(lastIndex);
|
|
157
|
+
const keptOuterMargins = (firstIsKept ? outerMarginLeft : 0) + (lastIsKept ? outerMarginRight : 0);
|
|
158
|
+
return totalWidth([
|
|
159
|
+
...keptWidths,
|
|
160
|
+
overflowWidth
|
|
161
|
+
], gap) + keptOuterMargins;
|
|
162
|
+
}
|
|
163
|
+
export function collapseStatesEqual(a, b) {
|
|
164
|
+
return arraysEqual(a.hiddenIndices, b.hiddenIndices) && a.overflowAt === b.overflowAt;
|
|
165
|
+
}
|
|
166
|
+
export function renderOverflow(Overflow, items, wrapper) {
|
|
167
|
+
const node = createElement(Overflow, {
|
|
168
|
+
items
|
|
169
|
+
});
|
|
170
|
+
return wrapper ? createElement(wrapper, null, node) : node;
|
|
171
|
+
}
|
|
172
|
+
export function buildVisibleTokens(items, hiddenSet, overflowAt, hiddenItems, Overflow, overflowWrapper = null) {
|
|
173
|
+
const validItems = items.filter(Boolean);
|
|
174
|
+
if (hiddenItems.length === 0) {
|
|
175
|
+
return validItems.map((item, index)=>({
|
|
176
|
+
key: item.key ?? index,
|
|
177
|
+
node: item
|
|
178
|
+
}));
|
|
179
|
+
}
|
|
180
|
+
const tokens = [];
|
|
181
|
+
let overflowInserted = false;
|
|
182
|
+
for(let i = 0; i < validItems.length; i++){
|
|
183
|
+
if (!overflowInserted && i === overflowAt) {
|
|
184
|
+
tokens.push({
|
|
185
|
+
key: '__overflow__',
|
|
186
|
+
node: renderOverflow(Overflow, hiddenItems, overflowWrapper)
|
|
187
|
+
});
|
|
188
|
+
overflowInserted = true;
|
|
189
|
+
}
|
|
190
|
+
if (hiddenSet.has(i)) continue;
|
|
191
|
+
const item = validItems[i];
|
|
192
|
+
tokens.push({
|
|
193
|
+
key: item.key ?? i,
|
|
194
|
+
node: item
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
if (!overflowInserted) {
|
|
198
|
+
tokens.push({
|
|
199
|
+
key: '__overflow__',
|
|
200
|
+
node: renderOverflow(Overflow, hiddenItems, overflowWrapper)
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
return tokens;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
//# sourceMappingURL=overflow-list.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/overflow-list/overflow-list.utils.ts"],"sourcesContent":["import {\n createElement,\n type ComponentType,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\nexport type OverflowComponent = ComponentType<{ items: ReactElement[] }>;\nexport type ItemElement = ReactElement<Record<string, unknown>>;\n\nconst LIST_ELEMENTS = new Set<string>(['ol', 'ul', 'menu']);\n\nexport function resolveInjectedElement(as: unknown): 'li' | 'span' {\n return typeof as === 'string' && LIST_ELEMENTS.has(as) ? 'li' : 'span';\n}\n\nexport type CollapseStrategy =\n 'asc' | 'desc' | 'innerAscFirstKeepLast' | 'innerDescFirstKeepLast';\n\nexport type CollapseUnit = number | number[];\n\nexport function resolveCollapseOrder(\n order: CollapseUnit[] | CollapseStrategy,\n itemCount: number\n): CollapseUnit[] {\n const rawOrder = Array.isArray(order)\n ? order\n : resolveStrategyOrder(order, itemCount);\n\n const isInBounds = (index: number) => index >= 0 && index < itemCount;\n\n return rawOrder\n .map((unit) => (Array.isArray(unit) ? unit.filter(isInBounds) : unit))\n .filter((unit) =>\n Array.isArray(unit) ? unit.length > 0 : isInBounds(unit)\n );\n}\n\nfunction resolveStrategyOrder(\n strategy: CollapseStrategy,\n itemCount: number\n): CollapseUnit[] {\n switch (strategy) {\n case 'asc':\n return Array.from({ length: itemCount }, (_, i) => i);\n case 'desc':\n return Array.from({ length: itemCount }, (_, i) => itemCount - 1 - i);\n case 'innerAscFirstKeepLast':\n if (itemCount <= 1) return [];\n return [...Array.from({ length: itemCount - 2 }, (_, i) => i + 1), 0];\n case 'innerDescFirstKeepLast':\n if (itemCount <= 1) return [];\n return Array.from({ length: itemCount - 1 }, (_, i) => itemCount - 2 - i);\n }\n}\n\nexport type CollapseState = {\n hiddenIndices: number[];\n overflowAt: number;\n};\n\nexport const INITIAL_STATE: CollapseState = {\n hiddenIndices: [],\n overflowAt: 0,\n};\n\nexport function arraysEqual(a: number[], b: number[]): boolean {\n return a.length === b.length && a.every((value, i) => value === b[i]);\n}\n\nexport function totalWidth(itemWidths: number[], gap: number): number {\n return itemWidths.reduce((sum, w, i) => sum + (i > 0 ? gap : 0) + w, 0);\n}\n\nexport const FIT_EPSILON = 0.5;\n\nexport function getMeasurements(\n measureEl: HTMLElement,\n overflowEl: HTMLElement,\n hasSep: boolean,\n orientation: 'horizontal' | 'vertical' = 'horizontal',\n lastItemFlexibleSelector?: string\n): {\n itemWidths: number[];\n gap: number;\n overflowWidth: number;\n outerMarginLeft: number;\n outerMarginRight: number;\n lastItemFlexibleWidth?: number;\n} {\n const children = Array.from(measureEl.children);\n const itemElements = hasSep\n ? children.filter(\n (child) => child.getAttribute('data-slot') !== 'separator'\n )\n : children;\n const measuredItemCount = itemElements.length;\n const itemWidths: number[] = [];\n const isVertical = orientation === 'vertical';\n\n for (let i = 0; i < measuredItemCount; i++) {\n const rect = itemElements[i]?.getBoundingClientRect();\n itemWidths.push(isVertical ? (rect?.height ?? 0) : (rect?.width ?? 0));\n }\n\n let gap = 0;\n if (measuredItemCount >= 2) {\n const first = itemElements[0]?.getBoundingClientRect();\n const second = itemElements[1]?.getBoundingClientRect();\n if (first && second) {\n gap = isVertical\n ? Math.max(0, second.top - first.bottom)\n : Math.max(0, second.left - first.right);\n }\n }\n\n let outerMarginLeft = 0;\n let outerMarginRight = 0;\n if (measuredItemCount > 0) {\n const measureRect = measureEl.getBoundingClientRect();\n const firstRect = itemElements[0]?.getBoundingClientRect();\n const lastRect =\n itemElements[itemElements.length - 1]?.getBoundingClientRect();\n if (isVertical) {\n outerMarginLeft = Math.max(\n 0,\n firstRect ? firstRect.top - measureRect.top : 0\n );\n outerMarginRight = Math.max(\n 0,\n lastRect ? measureRect.bottom - lastRect.bottom : 0\n );\n } else {\n outerMarginLeft = Math.max(\n 0,\n firstRect ? firstRect.left - measureRect.left : 0\n );\n outerMarginRight = Math.max(\n 0,\n lastRect ? measureRect.right - lastRect.right : 0\n );\n }\n }\n\n const overflowRect = (\n overflowEl.lastElementChild ?? overflowEl\n ).getBoundingClientRect();\n const overflowWidth = isVertical ? overflowRect.height : overflowRect.width;\n\n let lastItemFlexibleWidth: number | undefined;\n if (lastItemFlexibleSelector && measuredItemCount > 0) {\n const flexibleEl = itemElements[measuredItemCount - 1]?.querySelector(\n lastItemFlexibleSelector\n );\n if (flexibleEl) {\n const rect = flexibleEl.getBoundingClientRect();\n lastItemFlexibleWidth = isVertical ? rect.height : rect.width;\n }\n }\n\n return {\n itemWidths,\n gap,\n overflowWidth,\n outerMarginLeft,\n outerMarginRight,\n lastItemFlexibleWidth,\n };\n}\n\nexport function hideUntilFit(\n total: number,\n itemWidths: number[],\n gap: number,\n overflowCost: number,\n hideOrder: CollapseUnit[],\n containerWidth: number\n): { hidden: Set<number>; firstHidden: number | null } {\n const hidden = new Set<number>();\n let currentWidth = total;\n let firstHidden: number | null = null;\n\n for (const unit of hideOrder) {\n if (currentWidth <= containerWidth + FIT_EPSILON) break;\n\n const indices = Array.isArray(unit) ? unit : [unit];\n\n if (hidden.size === 0) {\n currentWidth += overflowCost;\n firstHidden = indices[0] ?? null;\n }\n\n for (const index of indices) {\n currentWidth -= (itemWidths[index] ?? 0) + gap;\n hidden.add(index);\n }\n }\n\n return { hidden, firstHidden };\n}\n\nexport function computeCollapseState({\n containerSize,\n itemWidths,\n gap,\n overflowWidth,\n outerMarginLeft,\n outerMarginRight,\n collapseOrder,\n}: {\n containerSize: number;\n itemWidths: number[];\n gap: number;\n overflowWidth: number;\n outerMarginLeft?: number;\n outerMarginRight?: number;\n collapseOrder: CollapseUnit[];\n}): CollapseState {\n const outerMargins = (outerMarginLeft ?? 0) + (outerMarginRight ?? 0);\n if (itemWidths.length === 0 || collapseOrder.length === 0) {\n return INITIAL_STATE;\n }\n\n const fullWidth = totalWidth(itemWidths, gap) + outerMargins;\n if (fullWidth <= containerSize + FIT_EPSILON) {\n return INITIAL_STATE;\n }\n\n const { hidden, firstHidden } = hideUntilFit(\n fullWidth,\n itemWidths,\n gap,\n gap + overflowWidth,\n collapseOrder,\n containerSize\n );\n\n if (hidden.size === 0) {\n return INITIAL_STATE;\n }\n\n return {\n hiddenIndices: Array.from(hidden).sort((a, b) => a - b),\n overflowAt: firstHidden ?? Math.min(...hidden),\n };\n}\n\nexport function computeCollapsedMinWidth({\n itemWidths,\n gap,\n overflowWidth,\n outerMarginLeft = 0,\n outerMarginRight = 0,\n collapseOrder,\n lastItemMinVisible,\n lastItemFlexibleWidth,\n}: {\n itemWidths: number[];\n gap: number;\n overflowWidth: number;\n outerMarginLeft?: number;\n outerMarginRight?: number;\n collapseOrder: CollapseUnit[];\n lastItemMinVisible?: number;\n lastItemFlexibleWidth?: number;\n}): number {\n if (itemWidths.length === 0) return 0;\n\n const outerMargins = outerMarginLeft + outerMarginRight;\n const lastIndex = itemWidths.length - 1;\n\n const cappedWidths =\n lastItemMinVisible == null\n ? itemWidths\n : itemWidths.map((width, index) => {\n if (index !== lastIndex) return width;\n const protectedWidth =\n lastItemFlexibleWidth != null\n ? Math.max(0, width - lastItemFlexibleWidth)\n : 0;\n return Math.min(width, protectedWidth + lastItemMinVisible);\n });\n\n if (collapseOrder.length === 0)\n return totalWidth(cappedWidths, gap) + outerMargins;\n\n const collapsible = new Set(collapseOrder.flat());\n const keptWidths = cappedWidths.filter((_, index) => !collapsible.has(index));\n\n const firstIsKept = !collapsible.has(0);\n const lastIsKept = !collapsible.has(lastIndex);\n const keptOuterMargins =\n (firstIsKept ? outerMarginLeft : 0) + (lastIsKept ? outerMarginRight : 0);\n\n return totalWidth([...keptWidths, overflowWidth], gap) + keptOuterMargins;\n}\n\nexport function collapseStatesEqual(\n a: CollapseState,\n b: CollapseState\n): boolean {\n return (\n arraysEqual(a.hiddenIndices, b.hiddenIndices) &&\n a.overflowAt === b.overflowAt\n );\n}\n\nexport function renderOverflow(\n Overflow: OverflowComponent,\n items: ReactElement[],\n wrapper: 'li' | null\n): ReactNode {\n const node = createElement(Overflow, { items });\n return wrapper ? createElement(wrapper, null, node) : node;\n}\n\nexport function buildVisibleTokens(\n items: ReactElement[],\n hiddenSet: Set<number>,\n overflowAt: number,\n hiddenItems: ReactElement[],\n Overflow: OverflowComponent,\n overflowWrapper: 'li' | null = null\n): Array<{ key: string | number; node: ReactNode }> {\n const validItems = items.filter(Boolean);\n\n if (hiddenItems.length === 0) {\n return validItems.map((item, index) => ({\n key: item.key ?? index,\n node: item,\n }));\n }\n\n const tokens: Array<{ key: string | number; node: ReactNode }> = [];\n let overflowInserted = false;\n\n for (let i = 0; i < validItems.length; i++) {\n if (!overflowInserted && i === overflowAt) {\n tokens.push({\n key: '__overflow__',\n node: renderOverflow(Overflow, hiddenItems, overflowWrapper),\n });\n overflowInserted = true;\n }\n\n if (hiddenSet.has(i)) continue;\n const item = validItems[i];\n tokens.push({ key: item.key ?? i, node: item });\n }\n\n if (!overflowInserted) {\n tokens.push({\n key: '__overflow__',\n node: renderOverflow(Overflow, hiddenItems, overflowWrapper),\n });\n }\n\n return tokens;\n}\n"],"names":["createElement","LIST_ELEMENTS","Set","resolveInjectedElement","as","has","resolveCollapseOrder","order","itemCount","rawOrder","Array","isArray","resolveStrategyOrder","isInBounds","index","map","unit","filter","length","strategy","from","_","i","INITIAL_STATE","hiddenIndices","overflowAt","arraysEqual","a","b","every","value","totalWidth","itemWidths","gap","reduce","sum","w","FIT_EPSILON","getMeasurements","measureEl","overflowEl","hasSep","orientation","lastItemFlexibleSelector","children","itemElements","child","getAttribute","measuredItemCount","isVertical","rect","getBoundingClientRect","push","height","width","first","second","Math","max","top","bottom","left","right","outerMarginLeft","outerMarginRight","measureRect","firstRect","lastRect","overflowRect","lastElementChild","overflowWidth","lastItemFlexibleWidth","flexibleEl","querySelector","hideUntilFit","total","overflowCost","hideOrder","containerWidth","hidden","currentWidth","firstHidden","indices","size","add","computeCollapseState","containerSize","collapseOrder","outerMargins","fullWidth","sort","min","computeCollapsedMinWidth","lastItemMinVisible","lastIndex","cappedWidths","protectedWidth","collapsible","flat","keptWidths","firstIsKept","lastIsKept","keptOuterMargins","collapseStatesEqual","renderOverflow","Overflow","items","wrapper","node","buildVisibleTokens","hiddenSet","hiddenItems","overflowWrapper","validItems","Boolean","item","key","tokens","overflowInserted"],"mappings":"AAAA,SACEA,aAAa,QAIR,QAAQ;AAKf,MAAMC,gBAAgB,IAAIC,IAAY;IAAC;IAAM;IAAM;CAAO;AAE1D,OAAO,SAASC,uBAAuBC,EAAW;IAChD,OAAO,OAAOA,OAAO,YAAYH,cAAcI,GAAG,CAACD,MAAM,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;IAEhC,IAAIH,YAAY7F,MAAM,KAAK,GAAG;QAC5B,OAAO+F,WAAWlG,GAAG,CAAC,CAACoG,MAAMrG,QAAW,CAAA;gBACtCsG,KAAKD,KAAKC,GAAG,IAAItG;gBACjB8F,MAAMO;YACR,CAAA;IACF;IAEA,MAAME,SAA2D,EAAE;IACnE,IAAIC,mBAAmB;IAEvB,IAAK,IAAIhG,IAAI,GAAGA,IAAI2F,WAAW/F,MAAM,EAAEI,IAAK;QAC1C,IAAI,CAACgG,oBAAoBhG,MAAMG,YAAY;YACzC4F,OAAOjE,IAAI,CAAC;gBACVgE,KAAK;gBACLR,MAAMJ,eAAeC,UAAUM,aAAaC;YAC9C;YACAM,mBAAmB;QACrB;QAEA,IAAIR,UAAUzG,GAAG,CAACiB,IAAI;QACtB,MAAM6F,OAAOF,UAAU,CAAC3F,EAAE;QAC1B+F,OAAOjE,IAAI,CAAC;YAAEgE,KAAKD,KAAKC,GAAG,IAAI9F;YAAGsF,MAAMO;QAAK;IAC/C;IAEA,IAAI,CAACG,kBAAkB;QACrBD,OAAOjE,IAAI,CAAC;YACVgE,KAAK;YACLR,MAAMJ,eAAeC,UAAUM,aAAaC;QAC9C;IACF;IAEA,OAAOK;AACT"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Context } from
|
|
2
|
-
type PaginationSize =
|
|
1
|
+
import type { Context } from "react";
|
|
2
|
+
type PaginationSize = "default" | "small";
|
|
3
3
|
declare const PaginationSizeContext: Context<PaginationSize>;
|
|
4
4
|
declare const usePaginationSize: () => PaginationSize;
|
|
5
5
|
export { type PaginationSize, PaginationSizeContext, usePaginationSize };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { createContext
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
const PaginationSizeContext = /*#__PURE__*/ createContext('default');
|
|
3
|
+
const usePaginationSize = ()=>useContext(PaginationSizeContext);
|
|
4
|
+
export { PaginationSizeContext, usePaginationSize };
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=pagination-size-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/pagination/pagination-size-context.tsx"],"sourcesContent":["import type { Context } from 'react';\nimport { createContext, useContext } from 'react';\n\ntype PaginationSize = 'default' | 'small';\n\nconst PaginationSizeContext: Context<PaginationSize> =\n createContext<PaginationSize>('default');\n\nconst usePaginationSize = (): PaginationSize =>\n useContext(PaginationSizeContext);\n\nexport { type PaginationSize, PaginationSizeContext, usePaginationSize };\n"],"names":["createContext","useContext","PaginationSizeContext","usePaginationSize"],"mappings":"AACA,SAASA,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AAIlD,MAAMC,sCACJF,cAA8B;AAEhC,MAAMG,oBAAoB,IACxBF,WAAWC;AAEb,SAA8BA,qBAAqB,EAAEC,iBAAiB,GAAG"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ForwardRefExoticComponent, RefAttributes, ComponentProps } from
|
|
2
|
-
import { Input } from
|
|
3
|
-
import { PaginationSize } from
|
|
1
|
+
import { type ForwardRefExoticComponent, type RefAttributes, type ComponentProps } from "react";
|
|
2
|
+
import { Input } from "../input/input";
|
|
3
|
+
import { type PaginationSize } from "./pagination-size-context";
|
|
4
4
|
type PaginationTeleportProps = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} & Omit<ComponentProps<typeof Input>,
|
|
10
|
-
declare const PaginationTeleport: ForwardRefExoticComponent<Omit<PaginationTeleportProps,
|
|
5
|
+
currentPage: number;
|
|
6
|
+
totalPages: number;
|
|
7
|
+
onPageChange: (page: number) => void;
|
|
8
|
+
size?: PaginationSize;
|
|
9
|
+
} & Omit<ComponentProps<typeof Input>, "size" | "value" | "onChange" | "children" | "type">;
|
|
10
|
+
declare const PaginationTeleport: ForwardRefExoticComponent<Omit<PaginationTeleportProps, "ref"> & RefAttributes<HTMLInputElement>>;
|
|
11
11
|
export { PaginationTeleport };
|
|
@@ -1,88 +1,131 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"focus-visible:bg-background focus-visible:text-secondary-foreground focus-visible:border-border-emphasized focus-visible:shadow-focus-ring"
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../../../../lib/utils.js";
|
|
5
|
+
import { Input } from "../input/input.js";
|
|
6
|
+
import { usePaginationSize } from "./pagination-size-context.js";
|
|
7
|
+
import { getPaginationTeleportWidth } from "./pagination-teleport.utils.js";
|
|
8
|
+
const paginationTeleportVariants = cva([
|
|
9
|
+
'tabular-nums text-center font-normal outline-none',
|
|
10
|
+
'border border-transparent bg-medium-background text-medium-foreground',
|
|
11
|
+
'[&:not(:placeholder-shown):not(:focus-visible)]:bg-medium-background [&:not(:placeholder-shown):not(:focus-visible)]:text-medium-foreground',
|
|
12
|
+
'hover:border-emphasized',
|
|
13
|
+
'focus-visible:bg-base-background focus-visible:text-base-foreground focus-visible:border-transparent focus-visible:shadow-focus-ring'
|
|
15
14
|
], {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
variants: {
|
|
16
|
+
size: {
|
|
17
|
+
default: 'h-9 rounded-lg px-3 py-0 text-base leading-5 tracking-tightest',
|
|
18
|
+
small: 'h-7 rounded-md px-2 py-0 text-sm leading-4.5 tracking-tight'
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
size: 'default'
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const TELEPORT_SIZING = {
|
|
26
|
+
small: {
|
|
27
|
+
minWidthPx: 43,
|
|
28
|
+
paddingPx: 16
|
|
29
|
+
},
|
|
30
|
+
default: {
|
|
31
|
+
minWidthPx: 55,
|
|
32
|
+
paddingPx: 24
|
|
33
|
+
}
|
|
30
34
|
};
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
35
|
+
function usePaginationTeleport({ currentPage, totalPages, onPageChange }) {
|
|
36
|
+
const safeTotalPages = Math.max(1, totalPages);
|
|
37
|
+
const [editingValue, setEditingValue] = useState('');
|
|
38
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
39
|
+
const cancelEditRef = useRef(false);
|
|
40
|
+
const displayValue = isEditing ? editingValue : `${currentPage}/${safeTotalPages}`;
|
|
41
|
+
const handleFocus = ()=>{
|
|
42
|
+
cancelEditRef.current = false;
|
|
43
|
+
setIsEditing(true);
|
|
44
|
+
setEditingValue(currentPage.toString());
|
|
45
|
+
};
|
|
46
|
+
const handleBlur = ()=>{
|
|
47
|
+
setIsEditing(false);
|
|
48
|
+
if (cancelEditRef.current) {
|
|
49
|
+
cancelEditRef.current = false;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const pageNum = Number.parseInt(editingValue, 10);
|
|
53
|
+
if (!Number.isNaN(pageNum) && pageNum >= 1 && pageNum <= safeTotalPages) {
|
|
54
|
+
onPageChange(pageNum);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const handleChange = (e)=>{
|
|
58
|
+
const value = e.target.value;
|
|
59
|
+
if (value === '' || /^\d+$/.test(value)) {
|
|
60
|
+
setEditingValue(value);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const handleKeyDown = (e)=>{
|
|
64
|
+
if (e.key === 'Enter') {
|
|
65
|
+
e.currentTarget.blur();
|
|
66
|
+
} else if (e.key === 'Escape') {
|
|
67
|
+
cancelEditRef.current = true;
|
|
68
|
+
setEditingValue(currentPage.toString());
|
|
69
|
+
e.currentTarget.blur();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
displayValue,
|
|
74
|
+
isEditing,
|
|
75
|
+
onChange: handleChange,
|
|
76
|
+
onFocus: handleFocus,
|
|
77
|
+
onBlur: handleBlur,
|
|
78
|
+
onKeyDown: handleKeyDown
|
|
79
|
+
};
|
|
55
80
|
}
|
|
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
|
-
|
|
81
|
+
const PaginationTeleport = /*#__PURE__*/ forwardRef(({ className, currentPage, totalPages, onPageChange, size, style, ...props }, ref)=>{
|
|
82
|
+
const inheritedSize = usePaginationSize();
|
|
83
|
+
const resolvedSize = size ?? inheritedSize;
|
|
84
|
+
const { displayValue, isEditing, onChange, onFocus, onBlur, onKeyDown } = usePaginationTeleport({
|
|
85
|
+
currentPage,
|
|
86
|
+
totalPages,
|
|
87
|
+
onPageChange
|
|
88
|
+
});
|
|
89
|
+
const inputRef = useRef(null);
|
|
90
|
+
const setInputRefs = (el)=>{
|
|
91
|
+
inputRef.current = el;
|
|
92
|
+
if (typeof ref === 'function') {
|
|
93
|
+
ref(el);
|
|
94
|
+
} else if (ref) {
|
|
95
|
+
ref.current = el;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
useLayoutEffect(()=>{
|
|
99
|
+
if (isEditing && inputRef.current) {
|
|
100
|
+
inputRef.current.select();
|
|
101
|
+
}
|
|
102
|
+
}, [
|
|
103
|
+
isEditing
|
|
104
|
+
]);
|
|
105
|
+
const sizing = TELEPORT_SIZING[resolvedSize];
|
|
106
|
+
const dynamicWidth = getPaginationTeleportWidth(totalPages, sizing.minWidthPx, sizing.paddingPx);
|
|
107
|
+
const inputClassName = cn(paginationTeleportVariants({
|
|
108
|
+
size: resolvedSize
|
|
109
|
+
}), className);
|
|
110
|
+
return /*#__PURE__*/ _jsx(Input, {
|
|
111
|
+
ref: setInputRefs,
|
|
112
|
+
type: "text",
|
|
113
|
+
inputMode: "numeric",
|
|
114
|
+
value: displayValue,
|
|
115
|
+
onChange: onChange,
|
|
116
|
+
onFocus: onFocus,
|
|
117
|
+
onBlur: onBlur,
|
|
118
|
+
onKeyDown: onKeyDown,
|
|
119
|
+
"data-slot": "pagination-teleport",
|
|
120
|
+
className: inputClassName,
|
|
121
|
+
style: {
|
|
122
|
+
width: dynamicWidth,
|
|
123
|
+
...style
|
|
124
|
+
},
|
|
125
|
+
...props
|
|
126
|
+
});
|
|
85
127
|
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
128
|
+
PaginationTeleport.displayName = 'PaginationTeleport';
|
|
129
|
+
export { PaginationTeleport };
|
|
130
|
+
|
|
131
|
+
//# sourceMappingURL=pagination-teleport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/pagination/pagination-teleport.tsx"],"sourcesContent":["import {\n type ForwardRefExoticComponent,\n type RefAttributes,\n type ChangeEvent,\n type ComponentProps,\n type ComponentRef,\n type KeyboardEvent,\n forwardRef,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { cva } from 'class-variance-authority';\n\nimport { cn } from '../../../../lib/utils';\nimport { Input } from '../input/input';\n\nimport {\n type PaginationSize,\n usePaginationSize,\n} from './pagination-size-context';\nimport { getPaginationTeleportWidth } from './pagination-teleport.utils';\n\ntype PaginationTeleportProps = {\n currentPage: number;\n totalPages: number;\n onPageChange: (page: number) => void;\n size?: PaginationSize;\n} & Omit<\n ComponentProps<typeof Input>,\n 'size' | 'value' | 'onChange' | 'children' | 'type'\n>;\n\ntype UsePaginationTeleportParams = {\n currentPage: number;\n totalPages: number;\n onPageChange: (page: number) => void;\n};\n\nconst paginationTeleportVariants = cva(\n [\n 'tabular-nums text-center font-normal outline-none',\n 'border border-transparent bg-medium-background text-medium-foreground',\n '[&:not(:placeholder-shown):not(:focus-visible)]:bg-medium-background [&:not(:placeholder-shown):not(:focus-visible)]:text-medium-foreground',\n 'hover:border-emphasized',\n 'focus-visible:bg-base-background focus-visible:text-base-foreground focus-visible:border-transparent focus-visible:shadow-focus-ring',\n ],\n {\n variants: {\n size: {\n default:\n 'h-9 rounded-lg px-3 py-0 text-base leading-5 tracking-tightest',\n small: 'h-7 rounded-md px-2 py-0 text-sm leading-4.5 tracking-tight',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\nconst TELEPORT_SIZING: Record<\n PaginationSize,\n { minWidthPx: number; paddingPx: number }\n> = {\n small: {\n minWidthPx: 43,\n paddingPx: 16,\n },\n default: {\n minWidthPx: 55,\n paddingPx: 24,\n },\n};\n\nfunction usePaginationTeleport({\n currentPage,\n totalPages,\n onPageChange,\n}: UsePaginationTeleportParams) {\n const safeTotalPages = Math.max(1, totalPages);\n const [editingValue, setEditingValue] = useState('');\n const [isEditing, setIsEditing] = useState(false);\n const cancelEditRef = useRef(false);\n\n const displayValue = isEditing\n ? editingValue\n : `${currentPage}/${safeTotalPages}`;\n\n const handleFocus = () => {\n cancelEditRef.current = false;\n setIsEditing(true);\n setEditingValue(currentPage.toString());\n };\n\n const handleBlur = () => {\n setIsEditing(false);\n if (cancelEditRef.current) {\n cancelEditRef.current = false;\n return;\n }\n const pageNum = Number.parseInt(editingValue, 10);\n\n if (!Number.isNaN(pageNum) && pageNum >= 1 && pageNum <= safeTotalPages) {\n onPageChange(pageNum);\n }\n };\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n const value = e.target.value;\n\n if (value === '' || /^\\d+$/.test(value)) {\n setEditingValue(value);\n }\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Enter') {\n e.currentTarget.blur();\n } else if (e.key === 'Escape') {\n cancelEditRef.current = true;\n setEditingValue(currentPage.toString());\n e.currentTarget.blur();\n }\n };\n\n return {\n displayValue,\n isEditing,\n onChange: handleChange,\n onFocus: handleFocus,\n onBlur: handleBlur,\n onKeyDown: handleKeyDown,\n };\n}\n\nconst PaginationTeleport: ForwardRefExoticComponent<\n Omit<PaginationTeleportProps, 'ref'> & RefAttributes<HTMLInputElement>\n> = forwardRef<ComponentRef<typeof Input>, PaginationTeleportProps>(\n (\n { className, currentPage, totalPages, onPageChange, size, style, ...props },\n ref\n ) => {\n const inheritedSize = usePaginationSize();\n const resolvedSize = size ?? inheritedSize;\n\n const { displayValue, isEditing, onChange, onFocus, onBlur, onKeyDown } =\n usePaginationTeleport({\n currentPage,\n totalPages,\n onPageChange,\n });\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const setInputRefs = (el: HTMLInputElement | null) => {\n inputRef.current = el;\n if (typeof ref === 'function') {\n ref(el);\n } else if (ref) {\n ref.current = el;\n }\n };\n\n useLayoutEffect(() => {\n if (isEditing && inputRef.current) {\n inputRef.current.select();\n }\n }, [isEditing]);\n\n const sizing = TELEPORT_SIZING[resolvedSize];\n const dynamicWidth = getPaginationTeleportWidth(\n totalPages,\n sizing.minWidthPx,\n sizing.paddingPx\n );\n\n const inputClassName = cn(\n paginationTeleportVariants({ size: resolvedSize }),\n className\n );\n\n return (\n <Input\n ref={setInputRefs}\n type=\"text\"\n inputMode=\"numeric\"\n value={displayValue}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n data-slot=\"pagination-teleport\"\n className={inputClassName}\n style={{ width: dynamicWidth, ...style }}\n {...props}\n />\n );\n }\n);\nPaginationTeleport.displayName = 'PaginationTeleport';\n\nexport { PaginationTeleport };\n"],"names":["forwardRef","useLayoutEffect","useRef","useState","cva","cn","Input","usePaginationSize","getPaginationTeleportWidth","paginationTeleportVariants","variants","size","default","small","defaultVariants","TELEPORT_SIZING","minWidthPx","paddingPx","usePaginationTeleport","currentPage","totalPages","onPageChange","safeTotalPages","Math","max","editingValue","setEditingValue","isEditing","setIsEditing","cancelEditRef","displayValue","handleFocus","current","toString","handleBlur","pageNum","Number","parseInt","isNaN","handleChange","e","value","target","test","handleKeyDown","key","currentTarget","blur","onChange","onFocus","onBlur","onKeyDown","PaginationTeleport","className","style","props","ref","inheritedSize","resolvedSize","inputRef","setInputRefs","el","select","sizing","dynamicWidth","inputClassName","type","inputMode","data-slot","width","displayName"],"mappings":";AAAA,SAOEA,UAAU,EACVC,eAAe,EACfC,MAAM,EACNC,QAAQ,QACH,QAAQ;AAEf,SAASC,GAAG,QAAQ,2BAA2B;AAE/C,SAASC,EAAE,QAAQ,2BAAwB;AAC3C,SAASC,KAAK,QAAQ,oBAAiB;AAEvC,SAEEC,iBAAiB,QACZ,+BAA4B;AACnC,SAASC,0BAA0B,QAAQ,iCAA8B;AAkBzE,MAAMC,6BAA6BL,IACjC;IACE;IACA;IACA;IACA;IACA;CACD,EACD;IACEM,UAAU;QACRC,MAAM;YACJC,SACE;YACFC,OAAO;QACT;IACF;IACAC,iBAAiB;QACfH,MAAM;IACR;AACF;AAGF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
4
|
-
|
|
1
|
+
export function getPaginationTeleportWidth(totalPages, minWidthPx, paddingPx) {
|
|
2
|
+
const safeTotalPages = Math.max(1, totalPages);
|
|
3
|
+
const maxDisplayLength = `${safeTotalPages}/${safeTotalPages}`.length;
|
|
4
|
+
return `max(${minWidthPx}px, calc(${maxDisplayLength}ch + ${paddingPx}px))`;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=pagination-teleport.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/pagination/pagination-teleport.utils.ts"],"sourcesContent":["export function getPaginationTeleportWidth(\n totalPages: number,\n minWidthPx: number,\n paddingPx: number\n): string {\n const safeTotalPages = Math.max(1, totalPages);\n const maxDisplayLength = `${safeTotalPages}/${safeTotalPages}`.length;\n return `max(${minWidthPx}px, calc(${maxDisplayLength}ch + ${paddingPx}px))`;\n}\n"],"names":["getPaginationTeleportWidth","totalPages","minWidthPx","paddingPx","safeTotalPages","Math","max","maxDisplayLength","length"],"mappings":"AAAA,OAAO,SAASA,2BACdC,UAAkB,EAClBC,UAAkB,EAClBC,SAAiB;IAEjB,MAAMC,iBAAiBC,KAAKC,GAAG,CAAC,GAAGL;IACnC,MAAMM,mBAAmB,GAAGH,eAAe,CAAC,EAAEA,gBAAgB,CAACI,MAAM;IACrE,OAAO,CAAC,IAAI,EAAEN,WAAW,SAAS,EAAEK,iBAAiB,KAAK,EAAEJ,UAAU,IAAI,CAAC;AAC7E"}
|