@cognite/aura 0.3.4 → 1.46104.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +264 -0
- package/DESIGN.md +638 -281
- package/LICENSE +21 -0
- package/README.md +48 -13
- package/dist/colors-deprecated.css +587 -0
- package/dist/colors.css +803 -830
- package/dist/components/index.d.ts +63 -57
- package/dist/components/index.js +62 -59
- package/dist/components/index.js.map +1 -0
- package/dist/components/ui/core/accordion/accordion.d.ts +19 -18
- package/dist/components/ui/core/accordion/accordion.js +99 -78
- package/dist/components/ui/core/accordion/accordion.js.map +1 -0
- package/dist/components/ui/core/action-toolbar/action-toolbar-motion.d.ts +8 -0
- package/dist/components/ui/core/action-toolbar/action-toolbar-motion.js +125 -0
- package/dist/components/ui/core/action-toolbar/action-toolbar-motion.js.map +1 -0
- package/dist/components/ui/core/action-toolbar/action-toolbar.d.ts +31 -31
- package/dist/components/ui/core/action-toolbar/action-toolbar.js +156 -106
- package/dist/components/ui/core/action-toolbar/action-toolbar.js.map +1 -0
- package/dist/components/ui/core/alert/alert.d.ts +25 -25
- package/dist/components/ui/core/alert/alert.js +181 -152
- package/dist/components/ui/core/alert/alert.js.map +1 -0
- package/dist/components/ui/core/avatar/avatar.d.ts +10 -9
- package/dist/components/ui/core/avatar/avatar.js +75 -65
- package/dist/components/ui/core/avatar/avatar.js.map +1 -0
- package/dist/components/ui/core/badge/badge.d.ts +13 -12
- package/dist/components/ui/core/badge/badge.js +88 -72
- package/dist/components/ui/core/badge/badge.js.map +1 -0
- package/dist/components/ui/core/banner/banner.d.ts +18 -18
- package/dist/components/ui/core/banner/banner.js +179 -142
- package/dist/components/ui/core/banner/banner.js.map +1 -0
- package/dist/components/ui/core/breadcrumb/breadcrumb.d.ts +12 -12
- package/dist/components/ui/core/breadcrumb/breadcrumb.js +139 -104
- package/dist/components/ui/core/breadcrumb/breadcrumb.js.map +1 -0
- package/dist/components/ui/core/button/button.d.ts +7 -7
- package/dist/components/ui/core/button/button.gallery.d.ts +2 -0
- package/dist/components/ui/core/button/button.gallery.js +76 -0
- package/dist/components/ui/core/button/button.gallery.js.map +1 -0
- package/dist/components/ui/core/button/button.js +57 -47
- package/dist/components/ui/core/button/button.js.map +1 -0
- package/dist/components/ui/core/button-group/button-group.d.ts +9 -9
- package/dist/components/ui/core/button-group/button-group.js +50 -40
- package/dist/components/ui/core/button-group/button-group.js.map +1 -0
- package/dist/components/ui/core/calendar/calendar-header.d.ts +7 -7
- package/dist/components/ui/core/calendar/calendar-header.js +102 -63
- package/dist/components/ui/core/calendar/calendar-header.js.map +1 -0
- package/dist/components/ui/core/calendar/calendar-utils.d.ts +30 -30
- package/dist/components/ui/core/calendar/calendar-utils.js +116 -39
- package/dist/components/ui/core/calendar/calendar-utils.js.map +1 -0
- package/dist/components/ui/core/calendar/calendar.d.ts +10 -10
- package/dist/components/ui/core/calendar/calendar.js +95 -66
- package/dist/components/ui/core/calendar/calendar.js.map +1 -0
- package/dist/components/ui/core/calendar/constants.js +3 -0
- package/dist/components/ui/core/calendar/constants.js.map +1 -0
- package/dist/components/ui/core/card/card.d.ts +20 -20
- package/dist/components/ui/core/card/card.js +133 -104
- package/dist/components/ui/core/card/card.js.map +1 -0
- package/dist/components/ui/core/chart/chart.d.ts +55 -53
- package/dist/components/ui/core/chart/chart.js +196 -116
- package/dist/components/ui/core/chart/chart.js.map +1 -0
- package/dist/components/ui/core/chart/index.d.ts +2 -2
- package/dist/components/ui/core/chart/index.js +3 -2
- package/dist/components/ui/core/chart/index.js.map +1 -0
- package/dist/components/ui/core/checkbox/checkbox.d.ts +9 -9
- package/dist/components/ui/core/checkbox/checkbox.js +88 -68
- package/dist/components/ui/core/checkbox/checkbox.js.map +1 -0
- package/dist/components/ui/core/checkbox/checkbox.metadata.d.ts +1 -1
- package/dist/components/ui/core/checkbox/checkbox.metadata.js +6 -7
- package/dist/components/ui/core/checkbox/checkbox.metadata.js.map +1 -0
- package/dist/components/ui/core/code-block/code-block.d.ts +19 -19
- package/dist/components/ui/core/code-block/code-block.js +259 -175
- package/dist/components/ui/core/code-block/code-block.js.map +1 -0
- package/dist/components/ui/core/collapsible/collapsible.d.ts +5 -5
- package/dist/components/ui/core/collapsible/collapsible.js +36 -30
- package/dist/components/ui/core/collapsible/collapsible.js.map +1 -0
- package/dist/components/ui/core/combobox/combobox.d.ts +13 -13
- package/dist/components/ui/core/combobox/combobox.js +89 -40
- package/dist/components/ui/core/combobox/combobox.js.map +1 -0
- package/dist/components/ui/core/command/command.d.ts +20 -18
- package/dist/components/ui/core/command/command.js +137 -85
- package/dist/components/ui/core/command/command.js.map +1 -0
- package/dist/components/ui/core/conversation/conversation.d.ts +14 -0
- package/dist/components/ui/core/conversation/conversation.js +51 -0
- package/dist/components/ui/core/conversation/conversation.js.map +1 -0
- package/dist/components/ui/core/count/count.d.ts +8 -6
- package/dist/components/ui/core/count/count.js +51 -21
- package/dist/components/ui/core/count/count.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-cell.d.ts +7 -7
- package/dist/components/ui/core/data-grid/data-grid-cell.js +23 -0
- package/dist/components/ui/core/data-grid/data-grid-cell.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-clauses.d.ts +14 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-clauses.js +36 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-clauses.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-panel.d.ts +41 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-panel.js +273 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-panel.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-footer.d.ts +6 -0
- package/dist/components/ui/core/data-grid/data-grid-footer.js +34 -0
- package/dist/components/ui/core/data-grid/data-grid-footer.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-header-row.d.ts +10 -10
- package/dist/components/ui/core/data-grid/data-grid-header-row.js +70 -0
- package/dist/components/ui/core/data-grid/data-grid-header-row.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-header.d.ts +11 -0
- package/dist/components/ui/core/data-grid/data-grid-header.js +67 -0
- package/dist/components/ui/core/data-grid/data-grid-header.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-row.d.ts +15 -15
- package/dist/components/ui/core/data-grid/data-grid-row.js +105 -0
- package/dist/components/ui/core/data-grid/data-grid-row.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid.d.ts +85 -35
- package/dist/components/ui/core/data-grid/data-grid.fixtures.d.ts +7 -7
- package/dist/components/ui/core/data-grid/data-grid.fixtures.js +139 -0
- package/dist/components/ui/core/data-grid/data-grid.fixtures.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid.js +404 -0
- package/dist/components/ui/core/data-grid/data-grid.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid.utils.d.ts +3 -3
- package/dist/components/ui/core/data-grid/data-grid.utils.js +51 -0
- package/dist/components/ui/core/data-grid/data-grid.utils.js.map +1 -0
- package/dist/components/ui/core/data-grid/index.d.ts +4 -0
- package/dist/components/ui/core/data-grid/index.js +5 -0
- package/dist/components/ui/core/data-grid/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.d.ts +11 -13
- package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +85 -61
- package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/index.d.ts +3 -3
- package/dist/components/ui/core/date-time-pickers/date-picker/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/types.d.ts +14 -14
- package/dist/components/ui/core/date-time-pickers/date-picker/types.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/types.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.d.ts +2 -2
- package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +51 -36
- package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.d.ts +11 -13
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +89 -64
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/index.d.ts +3 -3
- package/dist/components/ui/core/date-time-pickers/date-range-picker/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +20 -20
- package/dist/components/ui/core/date-time-pickers/date-range-picker/types.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/types.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.d.ts +4 -4
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +95 -60
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.d.ts +15 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.js +120 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/index.d.ts +3 -1
- package/dist/components/ui/core/date-time-pickers/date-time-picker/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/types.d.ts +25 -32
- package/dist/components/ui/core/date-time-pickers/date-time-picker/types.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/types.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.d.ts +2 -2
- package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.js +78 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.d.ts +13 -15
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +165 -119
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.d.ts +3 -3
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +37 -37
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.d.ts +3 -3
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +163 -104
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/index.d.ts +17 -12
- package/dist/components/ui/core/date-time-pickers/index.js +10 -6
- package/dist/components/ui/core/date-time-pickers/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.d.ts +5 -5
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js +52 -42
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/constants.d.ts +6 -1
- package/dist/components/ui/core/date-time-pickers/shared/constants.js +23 -0
- package/dist/components/ui/core/date-time-pickers/shared/constants.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.d.ts +16 -15
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +87 -64
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.d.ts +10 -9
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js +89 -38
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.d.ts +5 -5
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +34 -23
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.d.ts +23 -23
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js +95 -52
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.d.ts +5 -5
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js +22 -18
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.d.ts +19 -19
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js +41 -24
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.d.ts +13 -13
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +33 -24
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.d.ts +5 -5
- package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js +9 -4
- package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.d.ts +13 -9
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +22 -17
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.d.ts +2 -2
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.d.ts +13 -13
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +49 -40
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.d.ts +7 -7
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +41 -34
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/index.d.ts +3 -3
- package/dist/components/ui/core/date-time-pickers/time-picker/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.d.ts +12 -14
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +99 -79
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/types.d.ts +20 -20
- package/dist/components/ui/core/date-time-pickers/time-picker/types.js +3 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/types.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.d.ts +2 -2
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +63 -41
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/index.d.ts +3 -1
- package/dist/components/ui/core/date-time-pickers/time-range-picker/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.d.ts +14 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.js +115 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/types.d.ts +30 -36
- package/dist/components/ui/core/date-time-pickers/time-range-picker/types.js +3 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/types.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.d.ts +2 -2
- package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.js +145 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/date-input.d.ts +56 -0
- package/dist/components/ui/core/date-time-pickers/utils/date-input.js +67 -0
- package/dist/components/ui/core/date-time-pickers/utils/date-input.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.d.ts +18 -18
- package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.js +42 -0
- package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/format-utils.d.ts +31 -29
- package/dist/components/ui/core/date-time-pickers/utils/format-utils.js +56 -0
- package/dist/components/ui/core/date-time-pickers/utils/format-utils.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/segment-utils.d.ts +21 -21
- package/dist/components/ui/core/date-time-pickers/utils/segment-utils.js +170 -0
- package/dist/components/ui/core/date-time-pickers/utils/segment-utils.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/time-utils.d.ts +28 -28
- package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +88 -7
- package/dist/components/ui/core/date-time-pickers/utils/time-utils.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/time-validation.d.ts +17 -17
- package/dist/components/ui/core/date-time-pickers/utils/time-validation.js +43 -0
- package/dist/components/ui/core/date-time-pickers/utils/time-validation.js.map +1 -0
- package/dist/components/ui/core/dialog/dialog.d.ts +12 -9
- package/dist/components/ui/core/dialog/dialog.js +90 -82
- package/dist/components/ui/core/dialog/dialog.js.map +1 -0
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +22 -19
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +204 -149
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.js.map +1 -0
- package/dist/components/ui/core/empty-state/empty-state.context.d.ts +4 -4
- package/dist/components/ui/core/empty-state/empty-state.context.js +8 -5
- package/dist/components/ui/core/empty-state/empty-state.context.js.map +1 -0
- package/dist/components/ui/core/empty-state/empty-state.d.ts +14 -14
- package/dist/components/ui/core/empty-state/empty-state.js +96 -82
- package/dist/components/ui/core/empty-state/empty-state.js.map +1 -0
- package/dist/components/ui/core/helper-text/helper-text.d.ts +7 -7
- package/dist/components/ui/core/helper-text/helper-text.js +55 -36
- package/dist/components/ui/core/helper-text/helper-text.js.map +1 -0
- package/dist/components/ui/core/hover-card/hover-card.d.ts +7 -6
- package/dist/components/ui/core/hover-card/hover-card.js +56 -52
- package/dist/components/ui/core/hover-card/hover-card.js.map +1 -0
- package/dist/components/ui/core/inline-citation/inline-citation.d.ts +26 -25
- package/dist/components/ui/core/inline-citation/inline-citation.js +121 -97
- package/dist/components/ui/core/inline-citation/inline-citation.js.map +1 -0
- package/dist/components/ui/core/input/input.d.ts +2 -2
- package/dist/components/ui/core/input/input.js +15 -13
- package/dist/components/ui/core/input/input.js.map +1 -0
- package/dist/components/ui/core/input-group/input-group.d.ts +25 -14
- package/dist/components/ui/core/input-group/input-group.js +149 -76
- package/dist/components/ui/core/input-group/input-group.js.map +1 -0
- package/dist/components/ui/core/item/item.d.ts +20 -0
- package/dist/components/ui/core/item/item.js +93 -0
- package/dist/components/ui/core/item/item.js.map +1 -0
- package/dist/components/ui/core/kbd/kbd.d.ts +3 -3
- package/dist/components/ui/core/kbd/kbd.js +24 -20
- package/dist/components/ui/core/kbd/kbd.js.map +1 -0
- package/dist/components/ui/core/label/label.d.ts +3 -3
- package/dist/components/ui/core/label/label.js +33 -26
- package/dist/components/ui/core/label/label.js.map +1 -0
- package/dist/components/ui/core/loader/loader.d.ts +6 -6
- package/dist/components/ui/core/loader/loader.js +97 -80
- package/dist/components/ui/core/loader/loader.js.map +1 -0
- package/dist/components/ui/core/message/message-response-default-streamdown-controls.d.ts +9 -9
- package/dist/components/ui/core/message/message-response-default-streamdown-controls.js +19 -12
- package/dist/components/ui/core/message/message-response-default-streamdown-controls.js.map +1 -0
- package/dist/components/ui/core/message/message-response-math-plugin.d.ts +3 -0
- package/dist/components/ui/core/message/message-response-math-plugin.js +6 -0
- package/dist/components/ui/core/message/message-response-math-plugin.js.map +1 -0
- package/dist/components/ui/core/message/message.d.ts +27 -23
- package/dist/components/ui/core/message/message.js +453 -316
- package/dist/components/ui/core/message/message.js.map +1 -0
- package/dist/components/ui/core/overflow-list/overflow-list.d.ts +21 -0
- package/dist/components/ui/core/overflow-list/overflow-list.js +197 -0
- package/dist/components/ui/core/overflow-list/overflow-list.js.map +1 -0
- package/dist/components/ui/core/overflow-list/overflow-list.utils.d.ts +37 -35
- package/dist/components/ui/core/overflow-list/overflow-list.utils.js +206 -0
- package/dist/components/ui/core/overflow-list/overflow-list.utils.js.map +1 -0
- package/dist/components/ui/core/pagination/pagination-size-context.d.ts +2 -2
- package/dist/components/ui/core/pagination/pagination-size-context.js +6 -5
- package/dist/components/ui/core/pagination/pagination-size-context.js.map +1 -0
- package/dist/components/ui/core/pagination/pagination-teleport.d.ts +9 -9
- package/dist/components/ui/core/pagination/pagination-teleport.js +127 -84
- package/dist/components/ui/core/pagination/pagination-teleport.js.map +1 -0
- package/dist/components/ui/core/pagination/pagination-teleport.utils.js +6 -6
- package/dist/components/ui/core/pagination/pagination-teleport.utils.js.map +1 -0
- package/dist/components/ui/core/pagination/pagination.d.ts +39 -39
- package/dist/components/ui/core/pagination/pagination.js +294 -234
- package/dist/components/ui/core/pagination/pagination.js.map +1 -0
- package/dist/components/ui/core/popover/popover.d.ts +12 -11
- package/dist/components/ui/core/popover/popover.js +104 -89
- package/dist/components/ui/core/popover/popover.js.map +1 -0
- package/dist/components/ui/core/progress/progress.d.ts +9 -8
- package/dist/components/ui/core/progress/progress.js +50 -35
- package/dist/components/ui/core/progress/progress.js.map +1 -0
- package/dist/components/ui/core/prompt-input/prompt-input.d.ts +27 -27
- package/dist/components/ui/core/prompt-input/prompt-input.js +342 -271
- package/dist/components/ui/core/prompt-input/prompt-input.js.map +1 -0
- package/dist/components/ui/core/radio-group/radio-group.d.ts +12 -12
- package/dist/components/ui/core/radio-group/radio-group.js +88 -58
- package/dist/components/ui/core/radio-group/radio-group.js.map +1 -0
- package/dist/components/ui/core/reasoning/reasoning.d.ts +7 -7
- package/dist/components/ui/core/reasoning/reasoning.js +68 -56
- package/dist/components/ui/core/reasoning/reasoning.js.map +1 -0
- package/dist/components/ui/core/scroll-area/scroll-area.d.ts +4 -4
- package/dist/components/ui/core/scroll-area/scroll-area.js +50 -40
- package/dist/components/ui/core/scroll-area/scroll-area.js.map +1 -0
- package/dist/components/ui/core/search/search.d.ts +8 -8
- package/dist/components/ui/core/search/search.js +122 -76
- package/dist/components/ui/core/search/search.js.map +1 -0
- package/dist/components/ui/core/segmented-control/segmented-control.d.ts +17 -11
- package/dist/components/ui/core/segmented-control/segmented-control.js +204 -108
- package/dist/components/ui/core/segmented-control/segmented-control.js.map +1 -0
- package/dist/components/ui/core/select/select.d.ts +27 -26
- package/dist/components/ui/core/select/select.js +213 -168
- package/dist/components/ui/core/select/select.js.map +1 -0
- package/dist/components/ui/core/separator/separator.d.ts +2 -2
- package/dist/components/ui/core/separator/separator.js +13 -13
- package/dist/components/ui/core/separator/separator.js.map +1 -0
- package/dist/components/ui/core/shimmer/shimmer.d.ts +8 -8
- package/dist/components/ui/core/shimmer/shimmer.js +64 -40
- package/dist/components/ui/core/shimmer/shimmer.js.map +1 -0
- package/dist/components/ui/core/skeleton/skeleton.d.ts +2 -2
- package/dist/components/ui/core/skeleton/skeleton.js +13 -13
- package/dist/components/ui/core/skeleton/skeleton.js.map +1 -0
- package/dist/components/ui/core/slider/slider.d.ts +7 -7
- package/dist/components/ui/core/slider/slider.js +51 -39
- package/dist/components/ui/core/slider/slider.js.map +1 -0
- package/dist/components/ui/core/sonner-toast/sonner-toast.d.ts +2 -2
- package/dist/components/ui/core/sonner-toast/sonner-toast.js +67 -54
- package/dist/components/ui/core/sonner-toast/sonner-toast.js.map +1 -0
- package/dist/components/ui/core/sources/sources.d.ts +12 -12
- package/dist/components/ui/core/sources/sources.js +87 -58
- package/dist/components/ui/core/sources/sources.js.map +1 -0
- package/dist/components/ui/core/switch/switch.d.ts +9 -9
- package/dist/components/ui/core/switch/switch.js +83 -61
- package/dist/components/ui/core/switch/switch.js.map +1 -0
- package/dist/components/ui/core/switch/switch.metadata.d.ts +1 -1
- package/dist/components/ui/core/switch/switch.metadata.js +8 -0
- package/dist/components/ui/core/switch/switch.metadata.js.map +1 -0
- package/dist/components/ui/core/tabs/tabs.d.ts +20 -18
- package/dist/components/ui/core/tabs/tabs.js +176 -147
- package/dist/components/ui/core/tabs/tabs.js.map +1 -0
- package/dist/components/ui/core/tabs/tabs.utils.d.ts +1 -1
- package/dist/components/ui/core/tabs/tabs.utils.js +10 -6
- package/dist/components/ui/core/tabs/tabs.utils.js.map +1 -0
- package/dist/components/ui/core/textarea/textarea.d.ts +2 -2
- package/dist/components/ui/core/textarea/textarea.js +13 -13
- package/dist/components/ui/core/textarea/textarea.js.map +1 -0
- package/dist/components/ui/core/toggle/toggle.d.ts +9 -9
- package/dist/components/ui/core/toggle/toggle.js +60 -54
- package/dist/components/ui/core/toggle/toggle.js.map +1 -0
- package/dist/components/ui/core/tool/tool.d.ts +18 -18
- package/dist/components/ui/core/tool/tool.js +167 -126
- package/dist/components/ui/core/tool/tool.js.map +1 -0
- package/dist/components/ui/core/toolbar/toolbar.d.ts +37 -0
- package/dist/components/ui/core/toolbar/toolbar.js +171 -0
- package/dist/components/ui/core/toolbar/toolbar.js.map +1 -0
- package/dist/components/ui/core/tooltip/tooltip.d.ts +8 -7
- package/dist/components/ui/core/tooltip/tooltip.js +53 -46
- package/dist/components/ui/core/tooltip/tooltip.js.map +1 -0
- package/dist/components/ui/core/topbar/topbar.d.ts +26 -26
- package/dist/components/ui/core/topbar/topbar.js +160 -105
- package/dist/components/ui/core/topbar/topbar.js.map +1 -0
- package/dist/components/ui/core/tree/tree.d.ts +20 -0
- package/dist/components/ui/core/tree/tree.js +100 -0
- package/dist/components/ui/core/tree/tree.js.map +1 -0
- package/dist/eslint/index.d.ts +5 -5
- package/dist/eslint/index.js +9 -5
- package/dist/eslint/index.js.map +1 -0
- package/dist/eslint/no-overriding-styles.d.ts +1 -1
- package/dist/eslint/no-overriding-styles.js +341 -201
- package/dist/eslint/no-overriding-styles.js.map +1 -0
- package/dist/icons/index.d.ts +1 -1
- package/dist/icons/index.js +2 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/ai/types.d.ts +43 -43
- package/dist/lib/ai/types.js +3 -0
- package/dist/lib/ai/types.js.map +1 -0
- package/dist/lib/decorative-variant-classes.d.ts +53 -0
- package/dist/lib/decorative-variant-classes.js +58 -0
- package/dist/lib/decorative-variant-classes.js.map +1 -0
- package/dist/lib/highlight-code.d.ts +11 -8
- package/dist/lib/highlight-code.js +58 -40
- package/dist/lib/highlight-code.js.map +1 -0
- package/dist/lib/portal-container-context.d.ts +1 -1
- package/dist/lib/portal-container-context.js +8 -8
- package/dist/lib/portal-container-context.js.map +1 -0
- package/dist/lib/shared-theme-from-url.d.ts +13 -0
- package/dist/lib/shared-theme-from-url.js +61 -0
- package/dist/lib/shared-theme-from-url.js.map +1 -0
- package/dist/lib/style-scope.d.ts +2 -2
- package/dist/lib/style-scope.js +6 -6
- package/dist/lib/style-scope.js.map +1 -0
- package/dist/lib/theme-share-url.d.ts +31 -0
- package/dist/lib/theme-share-url.js +116 -0
- package/dist/lib/theme-share-url.js.map +1 -0
- package/dist/lib/types.d.ts +39 -39
- package/dist/lib/types.js +3 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/use-controllable-state.d.ts +4 -7
- package/dist/lib/use-controllable-state.js +34 -21
- package/dist/lib/use-controllable-state.js.map +1 -0
- package/dist/lib/utils.d.ts +63 -34
- package/dist/lib/utils.js +134 -32
- package/dist/lib/utils.js.map +1 -0
- package/dist/styles.css +2 -1
- package/dist/styles.source.css +24 -12
- package/dist/utils/assign-ref.d.ts +3 -0
- package/dist/utils/assign-ref.js +13 -0
- package/dist/utils/assign-ref.js.map +1 -0
- package/package.json +50 -11
- package/src/components/ui/core/button/button.md +93 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ForwardRefExoticComponent, RefAttributes, ComponentProps } from
|
|
2
|
-
type SearchProps = Omit<ComponentProps<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { type ForwardRefExoticComponent, type RefAttributes, type ComponentProps } from "react";
|
|
2
|
+
type SearchProps = Omit<ComponentProps<"input">, "type" | "className"> & {
|
|
3
|
+
className?: string;
|
|
4
|
+
inputClassName?: string;
|
|
5
|
+
clearLabel?: string;
|
|
6
|
+
onClear?: () => void;
|
|
7
|
+
"data-slot"?: never;
|
|
8
8
|
};
|
|
9
|
-
declare const Search: ForwardRefExoticComponent<Omit<SearchProps,
|
|
9
|
+
declare const Search: ForwardRefExoticComponent<Omit<SearchProps, "ref"> & RefAttributes<HTMLInputElement | null>>;
|
|
10
10
|
export { Search };
|
|
@@ -1,77 +1,123 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useImperativeHandle, useRef, useState } from "react";
|
|
3
|
+
import { IconCircleXFilled, IconSearch } from "@tabler/icons-react";
|
|
4
|
+
import { cn } from "../../../../lib/utils.js";
|
|
5
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "../input-group/input-group.js";
|
|
6
|
+
const hasInputValue = (value)=>{
|
|
7
|
+
if (typeof value === 'string') {
|
|
8
|
+
return value.length > 0;
|
|
9
|
+
}
|
|
10
|
+
if (typeof value === 'number') {
|
|
11
|
+
return Number.isFinite(value);
|
|
12
|
+
}
|
|
13
|
+
if (Array.isArray(value)) {
|
|
14
|
+
return value.length > 0;
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
};
|
|
18
|
+
const Search = /*#__PURE__*/ forwardRef(({ className, inputClassName, clearLabel = 'Clear search', onClear, value, defaultValue, onChange, onInput, onFocus, onBlur, disabled, readOnly, ...props }, ref)=>{
|
|
19
|
+
const [hasFocusWithin, setHasFocusWithin] = useState(false);
|
|
20
|
+
const [isUncontrolledInputFilled, setIsUncontrolledInputFilled] = useState(()=>hasInputValue(value ?? defaultValue));
|
|
21
|
+
const inputRef = useRef(null);
|
|
22
|
+
const isControlled = value != null;
|
|
23
|
+
const isInputFilled = isControlled ? hasInputValue(value) : isUncontrolledInputFilled;
|
|
24
|
+
useImperativeHandle(ref, ()=>inputRef.current, []);
|
|
25
|
+
const handleFocusCapture = ()=>{
|
|
26
|
+
setHasFocusWithin(true);
|
|
27
|
+
};
|
|
28
|
+
const handleBlurCapture = (event)=>{
|
|
29
|
+
if (event.relatedTarget instanceof Node && event.currentTarget.contains(event.relatedTarget)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
setHasFocusWithin(false);
|
|
33
|
+
};
|
|
34
|
+
const handleClear = ()=>{
|
|
35
|
+
const input = inputRef.current;
|
|
36
|
+
if (input == null) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
onClear?.();
|
|
40
|
+
if (!isControlled && input.value !== '') {
|
|
41
|
+
// Use the native setter so React's synthetic event system detects the change.
|
|
42
|
+
Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set?.call(input, '');
|
|
43
|
+
input.dispatchEvent(new Event('input', {
|
|
44
|
+
bubbles: true
|
|
45
|
+
}));
|
|
46
|
+
input.dispatchEvent(new Event('change', {
|
|
47
|
+
bubbles: true
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
input.focus();
|
|
51
|
+
};
|
|
52
|
+
const handleInput = (event)=>{
|
|
53
|
+
if (!isControlled) {
|
|
54
|
+
setIsUncontrolledInputFilled(hasInputValue(event.currentTarget.value));
|
|
55
|
+
}
|
|
56
|
+
onInput?.(event);
|
|
57
|
+
};
|
|
58
|
+
const handleChange = (event)=>{
|
|
59
|
+
if (!isControlled) {
|
|
60
|
+
setIsUncontrolledInputFilled(hasInputValue(event.currentTarget.value));
|
|
61
|
+
}
|
|
62
|
+
onChange?.(event);
|
|
63
|
+
};
|
|
64
|
+
const canClear = !isControlled || onClear != null;
|
|
65
|
+
const showClearButton = hasFocusWithin && isInputFilled && !disabled && !readOnly && canClear;
|
|
66
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
67
|
+
"data-slot": "search",
|
|
68
|
+
className: cn('w-full cursor-text', className),
|
|
69
|
+
onFocusCapture: handleFocusCapture,
|
|
70
|
+
onBlurCapture: handleBlurCapture,
|
|
71
|
+
onClick: ()=>inputRef.current?.focus(),
|
|
72
|
+
children: /*#__PURE__*/ _jsxs(InputGroup, {
|
|
73
|
+
className: "w-full transition-none",
|
|
74
|
+
children: [
|
|
75
|
+
/*#__PURE__*/ _jsx(InputGroupAddon, {
|
|
76
|
+
align: "inline-start",
|
|
77
|
+
className: "[&_svg]:text-muted-foreground group-hover/input-group:[&_svg]:text-muted-foreground group-has-[[data-slot=input-group-control]:enabled:focus-visible:not(:read-only)]/input-group:[&_svg]:text-muted-foreground group-has-[[data-slot=input-group-control]:enabled:not(:placeholder-shown):not(:read-only)]/input-group:[&_svg]:text-muted-foreground",
|
|
78
|
+
children: /*#__PURE__*/ _jsx(IconSearch, {
|
|
79
|
+
className: "size-4",
|
|
80
|
+
"aria-hidden": true
|
|
81
|
+
})
|
|
82
|
+
}),
|
|
83
|
+
/*#__PURE__*/ _jsx(InputGroupInput, {
|
|
84
|
+
...props,
|
|
85
|
+
ref: inputRef,
|
|
86
|
+
type: "search",
|
|
87
|
+
value: value,
|
|
88
|
+
defaultValue: defaultValue,
|
|
89
|
+
disabled: disabled,
|
|
90
|
+
readOnly: readOnly,
|
|
91
|
+
onInput: handleInput,
|
|
92
|
+
onChange: handleChange,
|
|
93
|
+
onFocus: onFocus,
|
|
94
|
+
onBlur: onBlur,
|
|
95
|
+
className: cn('placeholder:text-muted-foreground [&:not(:placeholder-shown):not(:read-only)]:text-base-foreground [&:not(:placeholder-shown):not(:read-only)]:hover:text-base-foreground [&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none', inputClassName)
|
|
96
|
+
}),
|
|
97
|
+
/*#__PURE__*/ _jsx(InputGroupAddon, {
|
|
98
|
+
align: "inline-end",
|
|
99
|
+
"aria-hidden": showClearButton ? undefined : true,
|
|
100
|
+
className: showClearButton ? undefined : 'invisible pointer-events-none',
|
|
101
|
+
children: /*#__PURE__*/ _jsx(InputGroupButton, {
|
|
102
|
+
type: "button",
|
|
103
|
+
variant: "ghost",
|
|
104
|
+
size: "icon-sm",
|
|
105
|
+
"aria-label": clearLabel,
|
|
106
|
+
onMouseDown: (event)=>{
|
|
107
|
+
event.preventDefault();
|
|
108
|
+
},
|
|
109
|
+
onClick: handleClear,
|
|
110
|
+
children: /*#__PURE__*/ _jsx(IconCircleXFilled, {
|
|
111
|
+
className: "size-4",
|
|
112
|
+
"aria-hidden": true
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
})
|
|
116
|
+
]
|
|
117
|
+
})
|
|
118
|
+
});
|
|
74
119
|
});
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
120
|
+
Search.displayName = 'Search';
|
|
121
|
+
export { Search };
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/search/search.tsx"],"sourcesContent":["import {\n type ForwardRefExoticComponent,\n type RefAttributes,\n type ChangeEvent,\n type ComponentProps,\n type ComponentRef,\n type FocusEvent,\n type FormEvent,\n forwardRef,\n type MouseEvent,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\n\nimport { IconCircleXFilled, IconSearch } from '@tabler/icons-react';\n\nimport { cn } from '../../../../lib/utils';\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from '../input-group/input-group';\n\ntype SearchProps = Omit<ComponentProps<'input'>, 'type' | 'className'> & {\n className?: string;\n inputClassName?: string;\n clearLabel?: string;\n onClear?: () => void;\n 'data-slot'?: never;\n};\n\nconst hasInputValue = (value: unknown): boolean => {\n if (typeof value === 'string') {\n return value.length > 0;\n }\n if (typeof value === 'number') {\n return Number.isFinite(value);\n }\n if (Array.isArray(value)) {\n return value.length > 0;\n }\n return false;\n};\n\nconst Search: ForwardRefExoticComponent<\n Omit<SearchProps, 'ref'> & RefAttributes<HTMLInputElement | null>\n> = forwardRef<ComponentRef<'input'> | null, SearchProps>(\n (\n {\n className,\n inputClassName,\n clearLabel = 'Clear search',\n onClear,\n value,\n defaultValue,\n onChange,\n onInput,\n onFocus,\n onBlur,\n disabled,\n readOnly,\n ...props\n },\n ref\n ) => {\n const [hasFocusWithin, setHasFocusWithin] = useState(false);\n const [isUncontrolledInputFilled, setIsUncontrolledInputFilled] =\n useState<boolean>(() => hasInputValue(value ?? defaultValue));\n const inputRef = useRef<ComponentRef<'input'>>(null);\n const isControlled = value != null;\n const isInputFilled = isControlled\n ? hasInputValue(value)\n : isUncontrolledInputFilled;\n\n useImperativeHandle<\n ComponentRef<'input'> | null,\n ComponentRef<'input'> | null\n >(ref, () => inputRef.current, []);\n\n const handleFocusCapture = (): void => {\n setHasFocusWithin(true);\n };\n\n const handleBlurCapture = (event: FocusEvent<HTMLDivElement>): void => {\n if (\n event.relatedTarget instanceof Node &&\n event.currentTarget.contains(event.relatedTarget)\n ) {\n return;\n }\n setHasFocusWithin(false);\n };\n\n const handleClear = (): void => {\n const input = inputRef.current;\n if (input == null) {\n return;\n }\n onClear?.();\n if (!isControlled && input.value !== '') {\n // Use the native setter so React's synthetic event system detects the change.\n Object.getOwnPropertyDescriptor(\n HTMLInputElement.prototype,\n 'value'\n )?.set?.call(input, '');\n input.dispatchEvent(new Event('input', { bubbles: true }));\n input.dispatchEvent(new Event('change', { bubbles: true }));\n }\n input.focus();\n };\n\n const handleInput = (event: FormEvent<HTMLInputElement>): void => {\n if (!isControlled) {\n setIsUncontrolledInputFilled(hasInputValue(event.currentTarget.value));\n }\n onInput?.(event);\n };\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>): void => {\n if (!isControlled) {\n setIsUncontrolledInputFilled(hasInputValue(event.currentTarget.value));\n }\n onChange?.(event);\n };\n\n const canClear = !isControlled || onClear != null;\n const showClearButton =\n hasFocusWithin && isInputFilled && !disabled && !readOnly && canClear;\n\n return (\n <div\n data-slot=\"search\"\n className={cn('w-full cursor-text', className)}\n onFocusCapture={handleFocusCapture}\n onBlurCapture={handleBlurCapture}\n onClick={() => inputRef.current?.focus()}\n >\n <InputGroup className=\"w-full transition-none\">\n <InputGroupAddon\n align=\"inline-start\"\n className=\"[&_svg]:text-muted-foreground group-hover/input-group:[&_svg]:text-muted-foreground group-has-[[data-slot=input-group-control]:enabled:focus-visible:not(:read-only)]/input-group:[&_svg]:text-muted-foreground group-has-[[data-slot=input-group-control]:enabled:not(:placeholder-shown):not(:read-only)]/input-group:[&_svg]:text-muted-foreground\"\n >\n <IconSearch className=\"size-4\" aria-hidden />\n </InputGroupAddon>\n <InputGroupInput\n {...props}\n ref={inputRef}\n type=\"search\"\n value={value}\n defaultValue={defaultValue}\n disabled={disabled}\n readOnly={readOnly}\n onInput={handleInput}\n onChange={handleChange}\n onFocus={onFocus}\n onBlur={onBlur}\n className={cn(\n 'placeholder:text-muted-foreground [&:not(:placeholder-shown):not(:read-only)]:text-base-foreground [&:not(:placeholder-shown):not(:read-only)]:hover:text-base-foreground [&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none',\n inputClassName\n )}\n />\n <InputGroupAddon\n align=\"inline-end\"\n aria-hidden={showClearButton ? undefined : true}\n className={\n showClearButton ? undefined : 'invisible pointer-events-none'\n }\n >\n <InputGroupButton\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={clearLabel}\n onMouseDown={(event: MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n }}\n onClick={handleClear}\n >\n <IconCircleXFilled className=\"size-4\" aria-hidden />\n </InputGroupButton>\n </InputGroupAddon>\n </InputGroup>\n </div>\n );\n }\n);\n\nSearch.displayName = 'Search';\n\nexport { Search };\n"],"names":["forwardRef","useImperativeHandle","useRef","useState","IconCircleXFilled","IconSearch","cn","InputGroup","InputGroupAddon","InputGroupButton","InputGroupInput","hasInputValue","value","length","Number","isFinite","Array","isArray","Search","className","inputClassName","clearLabel","onClear","defaultValue","onChange","onInput","onFocus","onBlur","disabled","readOnly","props","ref","hasFocusWithin","setHasFocusWithin","isUncontrolledInputFilled","setIsUncontrolledInputFilled","inputRef","isControlled","isInputFilled","current","handleFocusCapture","handleBlurCapture","event","relatedTarget","Node","currentTarget","contains","handleClear","input","Object","getOwnPropertyDescriptor","HTMLInputElement","prototype","set","call","dispatchEvent","Event","bubbles","focus","handleInput","handleChange","canClear","showClearButton","div","data-slot","onFocusCapture","onBlurCapture","onClick","align","aria-hidden","type","undefined","variant","size","aria-label","onMouseDown","preventDefault","displayName"],"mappings":";AAAA,SAQEA,UAAU,EAEVC,mBAAmB,EACnBC,MAAM,EACNC,QAAQ,QACH,QAAQ;AAEf,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,sBAAsB;AAEpE,SAASC,EAAE,QAAQ,2BAAwB;AAC3C,SACEC,UAAU,EACVC,eAAe,EACfC,gBAAgB,EAChBC,eAAe,QACV,gCAA6B;AAUpC,MAAMC,gBAAgB,CAACC;IACrB,IAAI,OAAOA,UAAU,UAAU;QAC7B,OAAOA,MAAMC,MAAM,GAAG;IACxB;IACA,IAAI,OAAOD,UAAU,UAAU;QAC7B,OAAOE,OAAOC,QAAQ,CAACH;IACzB;IACA,IAAII,MAAMC,OAAO,CAACL,QAAQ;QACxB,OAAOA,MAAMC,MAAM,GAAG;IACxB;IACA,OAAO;AACT;AAEA,MAAMK,uBAEFlB,WACF,CACE,EACEmB,SAAS,EACTC,cAAc,EACdC,aAAa,cAAc,EAC3BC,OAAO,EACPV,KAAK,EACLW,YAAY,EACZC,QAAQ,EACRC,OAAO,EACPC,OAAO,EACPC,MAAM,EACNC,QAAQ,EACRC,QAAQ,EACR,GAAGC,OACJ,EACDC;IAEA,MAAM,CAACC,gBAAgBC,kBAAkB,GAAG9B,SAAS;IACrD,MAAM,CAAC+B,2BAA2BC,6BAA6B,GAC7DhC,SAAkB,IAAMQ,cAAcC,SAASW;IACjD,MAAMa,WAAWlC,OAA8B;IAC/C,MAAMmC,eAAezB,SAAS;IAC9B,MAAM0B,gBAAgBD,eAClB1B,cAAcC,SACdsB;IAEJjC,oBAGE8B,KAAK,IAAMK,SAASG,OAAO,EAAE,EAAE;IAEjC,MAAMC,qBAAqB;QACzBP,kBAAkB;IACpB;IAEA,MAAMQ,oBAAoB,CAACC;QACzB,IACEA,MAAMC,aAAa,YAAYC,QAC/BF,MAAMG,aAAa,CAACC,QAAQ,CAACJ,MAAMC,aAAa,GAChD;YACA;QACF;QACAV,kBAAkB;IACpB;IAEA,MAAMc,cAAc;QAClB,MAAMC,QAAQZ,SAASG,OAAO;QAC9B,IAAIS,SAAS,MAAM;YACjB;QACF;QACA1B;QACA,IAAI,CAACe,gBAAgBW,MAAMpC,KAAK,KAAK,IAAI;YACvC,8EAA8E;YAC9EqC,OAAOC,wBAAwB,CAC7BC,iBAAiBC,SAAS,EAC1B,UACCC,KAAKC,KAAKN,OAAO;YACpBA,MAAMO,aAAa,CAAC,IAAIC,MAAM,SAAS;gBAAEC,SAAS;YAAK;YACvDT,MAAMO,aAAa,CAAC,IAAIC,MAAM,UAAU;gBAAEC,SAAS;YAAK;QAC1D;QACAT,MAAMU,KAAK;IACb;IAEA,MAAMC,cAAc,CAACjB;QACnB,IAAI,CAACL,cAAc;YACjBF,6BAA6BxB,cAAc+B,MAAMG,aAAa,CAACjC,KAAK;QACtE;QACAa,UAAUiB;IACZ;IAEA,MAAMkB,eAAe,CAAClB;QACpB,IAAI,CAACL,cAAc;YACjBF,6BAA6BxB,cAAc+B,MAAMG,aAAa,CAACjC,KAAK;QACtE;QACAY,WAAWkB;IACb;IAEA,MAAMmB,WAAW,CAACxB,gBAAgBf,WAAW;IAC7C,MAAMwC,kBACJ9B,kBAAkBM,iBAAiB,CAACV,YAAY,CAACC,YAAYgC;IAE/D,qBACE,KAACE;QACCC,aAAU;QACV7C,WAAWb,GAAG,sBAAsBa;QACpC8C,gBAAgBzB;QAChB0B,eAAezB;QACf0B,SAAS,IAAM/B,SAASG,OAAO,EAAEmB;kBAEjC,cAAA,MAACnD;YAAWY,WAAU;;8BACpB,KAACX;oBACC4D,OAAM;oBACNjD,WAAU;8BAEV,cAAA,KAACd;wBAAWc,WAAU;wBAASkD,aAAW;;;8BAE5C,KAAC3D;oBACE,GAAGoB,KAAK;oBACTC,KAAKK;oBACLkC,MAAK;oBACL1D,OAAOA;oBACPW,cAAcA;oBACdK,UAAUA;oBACVC,UAAUA;oBACVJ,SAASkC;oBACTnC,UAAUoC;oBACVlC,SAASA;oBACTC,QAAQA;oBACRR,WAAWb,GACT,8QACAc;;8BAGJ,KAACZ;oBACC4D,OAAM;oBACNC,eAAaP,kBAAkBS,YAAY;oBAC3CpD,WACE2C,kBAAkBS,YAAY;8BAGhC,cAAA,KAAC9D;wBACC6D,MAAK;wBACLE,SAAQ;wBACRC,MAAK;wBACLC,cAAYrD;wBACZsD,aAAa,CAACjC;4BACZA,MAAMkC,cAAc;wBACtB;wBACAT,SAASpB;kCAET,cAAA,KAAC3C;4BAAkBe,WAAU;4BAASkD,aAAW;;;;;;;AAM7D;AAGFnD,OAAO2D,WAAW,GAAG;AAErB,SAAS3D,MAAM,GAAG"}
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
import { ReactNode } from
|
|
2
|
-
import { Tabs as TabsPrimitive } from
|
|
3
|
-
import { VariantProps } from
|
|
4
|
-
import { ClassProp } from
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
2
|
+
import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
import type { ClassProp } from "class-variance-authority/types";
|
|
5
5
|
declare function SegmentedControl({ className, ...props }: TabsPrimitive.Root.Props): ReactNode;
|
|
6
|
-
interface
|
|
7
|
-
|
|
6
|
+
interface SegmentedControlSizeVariantProps {
|
|
7
|
+
size?: "small" | "default" | null;
|
|
8
8
|
}
|
|
9
|
-
declare const segmentedControlListVariants: (props?: (
|
|
9
|
+
declare const segmentedControlListVariants: (props?: (SegmentedControlSizeVariantProps & ClassProp) | undefined) => string;
|
|
10
|
+
type SegmentedControlSize = NonNullable<VariantProps<typeof segmentedControlListVariants>["size"]>;
|
|
10
11
|
type SegmentedControlListProps = TabsPrimitive.List.Props & VariantProps<typeof segmentedControlListVariants>;
|
|
11
12
|
declare function SegmentedControlList({ className, size, children, ...props }: SegmentedControlListProps): ReactNode;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
declare const segmentedControlIndicatorVariants: (props?: (SegmentedControlSizeVariantProps & ClassProp) | undefined) => string;
|
|
14
|
+
type SegmentedControlIndicatorProps = ComponentProps<"div"> & VariantProps<typeof segmentedControlIndicatorVariants> & {
|
|
15
|
+
activeSelector?: string;
|
|
16
|
+
};
|
|
17
|
+
declare function SegmentedControlIndicator({ className, size, activeSelector, style, ...props }: SegmentedControlIndicatorProps): ReactNode;
|
|
18
|
+
interface SegmentedControlButtonVariantProps extends SegmentedControlSizeVariantProps {
|
|
19
|
+
tabContent?: "icon-label" | "label-only" | "icon-only" | null;
|
|
15
20
|
}
|
|
16
21
|
declare const segmentedControlButtonVariants: (props?: (SegmentedControlButtonVariantProps & ClassProp) | undefined) => string;
|
|
17
22
|
type SegmentedControlButtonProps = TabsPrimitive.Tab.Props & VariantProps<typeof segmentedControlButtonVariants>;
|
|
18
23
|
declare function SegmentedControlButton({ className, size, tabContent, ...props }: SegmentedControlButtonProps): ReactNode;
|
|
19
24
|
declare function SegmentedControlContent({ className, ...props }: TabsPrimitive.Panel.Props): ReactNode;
|
|
20
|
-
export { SegmentedControl, SegmentedControlButton, SegmentedControlContent, SegmentedControlList, segmentedControlButtonVariants,
|
|
25
|
+
export { SegmentedControl, SegmentedControlButton, SegmentedControlContent, SegmentedControlIndicator, SegmentedControlList, segmentedControlButtonVariants, segmentedControlIndicatorVariants, segmentedControlListVariants };
|
|
26
|
+
export type { SegmentedControlSize };
|
|
@@ -1,115 +1,211 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createContext
|
|
3
|
-
import {
|
|
4
|
-
import { cva
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useLayoutEffect, useRef } from "react";
|
|
3
|
+
import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../../../lib/utils.js";
|
|
6
|
+
function SegmentedControl({ className, ...props }) {
|
|
7
|
+
return /*#__PURE__*/ _jsx(TabsPrimitive.Root, {
|
|
8
|
+
"data-slot": "segmented-control",
|
|
9
|
+
className: cn('flex flex-col gap-2', className),
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
13
|
+
const segmentedControlListVariants = cva('bg-medium-background text-muted-foreground relative isolate inline-flex w-fit items-center justify-center gap-2 p-0.5', {
|
|
14
|
+
variants: {
|
|
15
|
+
size: {
|
|
16
|
+
default: 'h-9 rounded-lg',
|
|
17
|
+
small: 'h-7 rounded-md'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
size: 'default'
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const SegmentedControlSizeContext = /*#__PURE__*/ createContext(undefined);
|
|
25
|
+
function useSegmentedControlSize(size) {
|
|
26
|
+
const inherited = useContext(SegmentedControlSizeContext);
|
|
27
|
+
return size ?? inherited ?? 'default';
|
|
28
|
+
}
|
|
29
|
+
function SegmentedControlList({ className, size, children, ...props }) {
|
|
30
|
+
const resolvedSize = size ?? 'default';
|
|
31
|
+
return /*#__PURE__*/ _jsx(TabsPrimitive.List, {
|
|
32
|
+
"data-slot": "segmented-control-list",
|
|
33
|
+
className: cn(segmentedControlListVariants({
|
|
34
|
+
size
|
|
35
|
+
}), className),
|
|
36
|
+
...props,
|
|
37
|
+
children: /*#__PURE__*/ _jsxs(SegmentedControlSizeContext.Provider, {
|
|
38
|
+
value: resolvedSize,
|
|
39
|
+
children: [
|
|
40
|
+
/*#__PURE__*/ _jsx(SegmentedControlIndicator, {
|
|
41
|
+
size: resolvedSize,
|
|
42
|
+
activeSelector: '[aria-selected="true"]'
|
|
43
|
+
}),
|
|
44
|
+
children
|
|
45
|
+
]
|
|
46
|
+
})
|
|
47
|
+
});
|
|
32
48
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
49
|
+
const segmentedControlIndicatorVariants = cva('bg-background shadow-sm pointer-events-none absolute top-(--active-tab-top) left-(--active-tab-left) -z-0 h-(--active-tab-height) w-(--active-tab-width) motion-safe:transition-[top,left,width,height] motion-safe:duration-200 motion-safe:ease-out data-[activation-direction=none]:transition-none', {
|
|
50
|
+
variants: {
|
|
51
|
+
size: {
|
|
52
|
+
default: 'rounded-md',
|
|
53
|
+
small: 'rounded-sm'
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
defaultVariants: {
|
|
57
|
+
size: 'default'
|
|
58
|
+
}
|
|
39
59
|
});
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
60
|
+
function SegmentedControlIndicator({ className, size, activeSelector = '[aria-selected="true"],[data-active]', style, ...props }) {
|
|
61
|
+
const ref = useRef(null);
|
|
62
|
+
const previousLeftRef = useRef(null);
|
|
63
|
+
useLayoutEffect(()=>{
|
|
64
|
+
const indicator = ref.current;
|
|
65
|
+
const list = indicator?.parentElement;
|
|
66
|
+
if (!indicator || !list) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
let currentActive = null;
|
|
70
|
+
const pendingInitialObserve = new Set();
|
|
71
|
+
const observeResize = (element)=>{
|
|
72
|
+
pendingInitialObserve.add(element);
|
|
73
|
+
resizeObserver.observe(element);
|
|
74
|
+
};
|
|
75
|
+
const update = (isResize = false)=>{
|
|
76
|
+
const active = list.querySelector(activeSelector);
|
|
77
|
+
if (!active) {
|
|
78
|
+
indicator.style.opacity = '0';
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (active !== currentActive) {
|
|
82
|
+
if (currentActive) {
|
|
83
|
+
resizeObserver.unobserve(currentActive);
|
|
84
|
+
}
|
|
85
|
+
observeResize(active);
|
|
86
|
+
currentActive = active;
|
|
87
|
+
}
|
|
88
|
+
const left = active.offsetLeft;
|
|
89
|
+
const previousLeft = previousLeftRef.current;
|
|
90
|
+
const direction = isResize || previousLeft === null || left === previousLeft ? 'none' : left > previousLeft ? 'right' : 'left';
|
|
91
|
+
indicator.dataset.activationDirection = direction;
|
|
92
|
+
indicator.style.opacity = '1';
|
|
93
|
+
indicator.style.setProperty('--active-tab-left', `${left}px`);
|
|
94
|
+
indicator.style.setProperty('--active-tab-top', `${active.offsetTop}px`);
|
|
95
|
+
indicator.style.setProperty('--active-tab-width', `${active.offsetWidth}px`);
|
|
96
|
+
indicator.style.setProperty('--active-tab-height', `${active.offsetHeight}px`);
|
|
97
|
+
previousLeftRef.current = left;
|
|
98
|
+
};
|
|
99
|
+
const resizeObserver = new ResizeObserver((entries)=>{
|
|
100
|
+
const isGenuineResize = entries.some((entry)=>{
|
|
101
|
+
if (pendingInitialObserve.has(entry.target)) {
|
|
102
|
+
pendingInitialObserve.delete(entry.target);
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
return true;
|
|
106
|
+
});
|
|
107
|
+
if (isGenuineResize) {
|
|
108
|
+
update(true);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
observeResize(list);
|
|
112
|
+
update();
|
|
113
|
+
const mutationObserver = new MutationObserver(()=>update(false));
|
|
114
|
+
mutationObserver.observe(list, {
|
|
115
|
+
attributes: true,
|
|
116
|
+
attributeFilter: [
|
|
117
|
+
'aria-selected',
|
|
118
|
+
'data-active',
|
|
119
|
+
'class'
|
|
120
|
+
],
|
|
121
|
+
subtree: true,
|
|
122
|
+
childList: true
|
|
123
|
+
});
|
|
124
|
+
return ()=>{
|
|
125
|
+
mutationObserver.disconnect();
|
|
126
|
+
resizeObserver.disconnect();
|
|
127
|
+
};
|
|
128
|
+
}, [
|
|
129
|
+
activeSelector
|
|
130
|
+
]);
|
|
131
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
132
|
+
ref: ref,
|
|
133
|
+
"data-slot": "segmented-control-indicator",
|
|
134
|
+
"data-activation-direction": "none",
|
|
135
|
+
className: cn('opacity-0', segmentedControlIndicatorVariants({
|
|
136
|
+
size
|
|
137
|
+
}), className),
|
|
138
|
+
style: style,
|
|
139
|
+
...props
|
|
140
|
+
});
|
|
46
141
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
142
|
+
const segmentedControlButtonVariants = cva('text-sm leading-4.5 tracking-normal font-medium relative z-10 inline-flex flex-1 items-center justify-center whitespace-nowrap text-muted-foreground dark:text-muted-foreground border border-transparent transition-[color,box-shadow] duration-200 ease-out focus-visible:border-ring focus-visible:ring focus-visible:ring-ring-shadow focus-visible:outline-1 focus-visible:outline-ring [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4 data-disabled:pointer-events-none data-disabled:opacity-50 hover:text-foreground data-active:text-foreground data-active:hover:text-foreground', {
|
|
143
|
+
variants: {
|
|
144
|
+
size: {
|
|
145
|
+
default: 'rounded-md',
|
|
146
|
+
small: 'rounded-sm'
|
|
147
|
+
},
|
|
148
|
+
tabContent: {
|
|
149
|
+
'icon-label': '',
|
|
150
|
+
'label-only': '',
|
|
151
|
+
'icon-only': 'px-0'
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
compoundVariants: [
|
|
155
|
+
{
|
|
156
|
+
size: 'default',
|
|
157
|
+
tabContent: 'icon-label',
|
|
158
|
+
className: 'h-8 gap-2 px-2 py-0'
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
size: 'default',
|
|
162
|
+
tabContent: 'label-only',
|
|
163
|
+
className: 'h-8 gap-0 px-2 py-0'
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
size: 'default',
|
|
167
|
+
tabContent: 'icon-only',
|
|
168
|
+
className: 'size-8 gap-0 py-0'
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
size: 'small',
|
|
172
|
+
tabContent: 'icon-label',
|
|
173
|
+
className: 'h-6 gap-2 px-2 py-0'
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
size: 'small',
|
|
177
|
+
tabContent: 'label-only',
|
|
178
|
+
className: 'h-6 gap-0 px-2 py-0'
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
size: 'small',
|
|
182
|
+
tabContent: 'icon-only',
|
|
183
|
+
className: 'size-6 gap-0 py-0'
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
defaultVariants: {
|
|
187
|
+
size: 'default',
|
|
188
|
+
tabContent: 'icon-label'
|
|
189
|
+
}
|
|
95
190
|
});
|
|
96
|
-
function
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
191
|
+
function SegmentedControlButton({ className, size, tabContent, ...props }) {
|
|
192
|
+
const resolvedSize = useSegmentedControlSize(size);
|
|
193
|
+
return /*#__PURE__*/ _jsx(TabsPrimitive.Tab, {
|
|
194
|
+
"data-slot": "segmented-control-trigger",
|
|
195
|
+
className: cn(segmentedControlButtonVariants({
|
|
196
|
+
size: resolvedSize,
|
|
197
|
+
tabContent
|
|
198
|
+
}), className),
|
|
199
|
+
...props
|
|
200
|
+
});
|
|
106
201
|
}
|
|
107
|
-
function
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
202
|
+
function SegmentedControlContent({ className, ...props }) {
|
|
203
|
+
return /*#__PURE__*/ _jsx(TabsPrimitive.Panel, {
|
|
204
|
+
"data-slot": "segmented-control-content",
|
|
205
|
+
className: cn('flex-1 outline-none', className),
|
|
206
|
+
...props
|
|
207
|
+
});
|
|
113
208
|
}
|
|
114
|
-
|
|
115
|
-
|
|
209
|
+
export { SegmentedControl, SegmentedControlButton, SegmentedControlContent, SegmentedControlIndicator, SegmentedControlList, segmentedControlButtonVariants, segmentedControlIndicatorVariants, segmentedControlListVariants };
|
|
210
|
+
|
|
211
|
+
//# sourceMappingURL=segmented-control.js.map
|