@cognite/aura 0.3.4 → 1.0.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 +274 -0
- package/DESIGN.md +664 -281
- package/LICENSE +21 -0
- package/README.md +48 -13
- package/dist/colors-deprecated.css +618 -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 +132 -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.gallery.d.ts +2 -0
- package/dist/components/ui/core/alert/alert.gallery.js +54 -0
- package/dist/components/ui/core/alert/alert.gallery.js.map +1 -0
- 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.gallery.d.ts +2 -0
- package/dist/components/ui/core/avatar/avatar.gallery.js +67 -0
- package/dist/components/ui/core/avatar/avatar.gallery.js.map +1 -0
- 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.gallery.d.ts +2 -0
- package/dist/components/ui/core/badge/badge.gallery.js +64 -0
- package/dist/components/ui/core/badge/badge.gallery.js.map +1 -0
- 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.gallery.d.ts +2 -0
- package/dist/components/ui/core/banner/banner.gallery.js +56 -0
- package/dist/components/ui/core/banner/banner.gallery.js.map +1 -0
- 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.gallery.d.ts +2 -0
- package/dist/components/ui/core/breadcrumb/breadcrumb.gallery.js +31 -0
- package/dist/components/ui/core/breadcrumb/breadcrumb.gallery.js.map +1 -0
- 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.gallery.d.ts +2 -0
- package/dist/components/ui/core/button-group/button-group.gallery.js +62 -0
- package/dist/components/ui/core/button-group/button-group.gallery.js.map +1 -0
- 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.gallery.d.ts +2 -0
- package/dist/components/ui/core/checkbox/checkbox.gallery.js +36 -0
- package/dist/components/ui/core/checkbox/checkbox.gallery.js.map +1 -0
- 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 +260 -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.gallery.d.ts +2 -0
- package/dist/components/ui/core/collapsible/collapsible.gallery.js +39 -0
- package/dist/components/ui/core/collapsible/collapsible.gallery.js.map +1 -0
- 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.gallery.d.ts +2 -0
- package/dist/components/ui/core/count/count.gallery.js +55 -0
- package/dist/components/ui/core/count/count.gallery.js.map +1 -0
- 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 +5 -7
- package/dist/components/ui/core/data-grid/data-grid-cell.js +19 -0
- package/dist/components/ui/core/data-grid/data-grid-cell.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-column-filter.d.ts +4 -0
- package/dist/components/ui/core/data-grid/data-grid-column-filter.js +13 -0
- package/dist/components/ui/core/data-grid/data-grid-column-filter.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-column-resizer.d.ts +8 -0
- package/dist/components/ui/core/data-grid/data-grid-column-resizer.js +25 -0
- package/dist/components/ui/core/data-grid/data-grid-column-resizer.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 +43 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-panel.js +287 -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 +86 -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 +13 -15
- package/dist/components/ui/core/data-grid/data-grid-row.js +118 -0
- package/dist/components/ui/core/data-grid/data-grid-row.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-selection-state.d.ts +15 -0
- package/dist/components/ui/core/data-grid/data-grid-selection-state.js +32 -0
- package/dist/components/ui/core/data-grid/data-grid-selection-state.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-selection-toolbar.d.ts +11 -0
- package/dist/components/ui/core/data-grid/data-grid-selection-toolbar.js +129 -0
- package/dist/components/ui/core/data-grid/data-grid-selection-toolbar.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-selection.types.d.ts +24 -0
- package/dist/components/ui/core/data-grid/data-grid-selection.types.js +3 -0
- package/dist/components/ui/core/data-grid/data-grid-selection.types.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid.d.ts +125 -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 +542 -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 -4
- package/dist/components/ui/core/data-grid/data-grid.utils.js +53 -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 +6 -0
- package/dist/components/ui/core/data-grid/index.js +6 -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.gallery.d.ts +2 -0
- package/dist/components/ui/core/input/input.gallery.js +89 -0
- package/dist/components/ui/core/input/input.gallery.js.map +1 -0
- 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.gallery.d.ts +2 -0
- package/dist/components/ui/core/label/label.gallery.js +57 -0
- package/dist/components/ui/core/label/label.gallery.js.map +1 -0
- 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 +8 -9
- package/dist/components/ui/core/message/message-response-default-streamdown-controls.js +18 -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 +458 -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.gallery.d.ts +2 -0
- package/dist/components/ui/core/radio-group/radio-group.gallery.js +44 -0
- package/dist/components/ui/core/radio-group/radio-group.gallery.js.map +1 -0
- 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 +33 -26
- package/dist/components/ui/core/select/select.js +262 -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.gallery.d.ts +2 -0
- package/dist/components/ui/core/separator/separator.gallery.js +63 -0
- package/dist/components/ui/core/separator/separator.gallery.js.map +1 -0
- 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.gallery.d.ts +2 -0
- package/dist/components/ui/core/skeleton/skeleton.gallery.js +22 -0
- package/dist/components/ui/core/skeleton/skeleton.gallery.js.map +1 -0
- 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.gallery.d.ts +2 -0
- package/dist/components/ui/core/slider/slider.gallery.js +62 -0
- package/dist/components/ui/core/slider/slider.gallery.js.map +1 -0
- 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/status-text/status-text.d.ts +4 -0
- package/dist/components/ui/core/status-text/status-text.js +14 -0
- package/dist/components/ui/core/status-text/status-text.js.map +1 -0
- package/dist/components/ui/core/switch/switch.d.ts +9 -9
- package/dist/components/ui/core/switch/switch.gallery.d.ts +2 -0
- package/dist/components/ui/core/switch/switch.gallery.js +67 -0
- package/dist/components/ui/core/switch/switch.gallery.js.map +1 -0
- 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.gallery.d.ts +2 -0
- package/dist/components/ui/core/textarea/textarea.gallery.js +51 -0
- package/dist/components/ui/core/textarea/textarea.gallery.js.map +1 -0
- 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.gallery.d.ts +2 -0
- package/dist/components/ui/core/toggle/toggle.gallery.js +32 -0
- package/dist/components/ui/core/toggle/toggle.gallery.js.map +1 -0
- 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.gallery.d.ts +2 -0
- package/dist/components/ui/core/tooltip/tooltip.gallery.js +52 -0
- package/dist/components/ui/core/tooltip/tooltip.gallery.js.map +1 -0
- 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 +46 -16
- 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 +53 -14
- package/src/components/ui/core/alert/alert.md +46 -0
- package/src/components/ui/core/avatar/avatar.md +30 -0
- package/src/components/ui/core/badge/badge.md +32 -0
- package/src/components/ui/core/banner/banner.md +51 -0
- package/src/components/ui/core/breadcrumb/breadcrumb.md +45 -0
- package/src/components/ui/core/button/button.md +93 -0
- package/src/components/ui/core/button-group/button-group.md +38 -0
- package/src/components/ui/core/checkbox/checkbox.md +37 -0
- package/src/components/ui/core/collapsible/collapsible.md +42 -0
- package/src/components/ui/core/count/count.md +33 -0
- package/src/components/ui/core/input/input.md +48 -0
- package/src/components/ui/core/label/label.md +35 -0
- package/src/components/ui/core/radio-group/radio-group.md +38 -0
- package/src/components/ui/core/separator/separator.md +32 -0
- package/src/components/ui/core/skeleton/skeleton.md +33 -0
- package/src/components/ui/core/slider/slider.md +41 -0
- package/src/components/ui/core/switch/switch.md +26 -0
- package/src/components/ui/core/textarea/textarea.md +42 -0
- package/src/components/ui/core/toggle/toggle.md +39 -0
- package/src/components/ui/core/tooltip/tooltip.md +41 -0
|
@@ -1,55 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import {
|
|
4
|
-
import { cva
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
}), c = (t, n) => {
|
|
24
|
-
if (t == null || t === "") return null;
|
|
25
|
-
let i = String(t);
|
|
26
|
-
return /* @__PURE__ */ r("span", {
|
|
27
|
-
"data-slot": "toggle-count",
|
|
28
|
-
className: e("inline-flex h-4 min-w-4 items-center justify-center rounded-sm px-0.5 text-xs font-medium leading-3.5 tracking-tightest", n ? "bg-disabled-background text-disabled-foreground" : "bg-decorative-background-mountain text-decorative-foreground-mountain"),
|
|
29
|
-
children: i
|
|
30
|
-
});
|
|
31
|
-
}, l = t(({ className: t, variant: a, size: l, icon: u, label: d, count: f, children: p, disabled: m, ...h }, g) => {
|
|
32
|
-
let _ = u !== void 0 || d !== void 0 || f !== void 0;
|
|
33
|
-
return /* @__PURE__ */ r(o, {
|
|
34
|
-
ref: g,
|
|
35
|
-
"data-slot": "toggle",
|
|
36
|
-
disabled: m,
|
|
37
|
-
className: e(s({
|
|
38
|
-
variant: a,
|
|
39
|
-
size: l,
|
|
40
|
-
className: t
|
|
41
|
-
})),
|
|
42
|
-
...h,
|
|
43
|
-
children: p ?? (_ && /* @__PURE__ */ i(n, { children: [
|
|
44
|
-
u,
|
|
45
|
-
d && /* @__PURE__ */ r("span", {
|
|
46
|
-
"data-slot": "toggle-label",
|
|
47
|
-
children: d
|
|
48
|
-
}),
|
|
49
|
-
c(f, m)
|
|
50
|
-
] }))
|
|
51
|
-
});
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Toggle as TogglePrimitive } from "@base-ui/react/toggle";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../../../lib/utils.js";
|
|
6
|
+
const toggleVariants = cva("group inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium text-medium-foreground hover:bg-base-background-hover disabled:pointer-events-none disabled:text-base-foreground-disabled disabled:[&_svg:not([class*='text-'])]:text-base-foreground-disabled aria-pressed:border aria-pressed:border-emphasized aria-pressed:bg-secondary-background aria-pressed:text-secondary-foreground aria-pressed:[&_svg:not([class*='text-'])]:text-secondary-foreground disabled:aria-pressed:border disabled:aria-pressed:border-default disabled:aria-pressed:bg-base-background-disabled disabled:aria-pressed:text-base-foreground-disabled disabled:aria-pressed:[&_svg:not([class*='text-'])]:text-base-foreground-disabled [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring-muted focus-visible:ring outline-none transition-[color,box-shadow] aria-invalid:ring-destructive-background/20 dark:aria-invalid:ring-destructive-background/40 aria-invalid:border-destructive-background whitespace-nowrap", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: 'bg-transparent',
|
|
10
|
+
outline: 'border border-emphasized bg-transparent shadow-xs hover:bg-base-background-hover hover:text-base-foreground'
|
|
11
|
+
},
|
|
12
|
+
size: {
|
|
13
|
+
default: 'h-9 px-2 min-w-9',
|
|
14
|
+
sm: 'h-7 px-1.5 min-w-7',
|
|
15
|
+
lg: 'h-8 px-2.5 min-w-8'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
variant: 'default',
|
|
20
|
+
size: 'default'
|
|
21
|
+
}
|
|
52
22
|
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
23
|
+
const renderCountBadge = (count, disabled)=>{
|
|
24
|
+
if (count === undefined || count === null || count === '') {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const countValue = String(count);
|
|
28
|
+
return /*#__PURE__*/ _jsx("span", {
|
|
29
|
+
"data-slot": "toggle-count",
|
|
30
|
+
className: cn('inline-flex h-4 min-w-4 items-center justify-center rounded-sm px-0.5 text-xs font-medium leading-3.5 tracking-tightest', disabled ? 'bg-base-background-disabled text-base-foreground-disabled' : 'bg-medium-background text-medium-foreground'),
|
|
31
|
+
children: countValue
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const Toggle = /*#__PURE__*/ forwardRef(({ className, variant, size, icon, label, count, children, disabled, ...props }, ref)=>{
|
|
35
|
+
const hasComposedContent = icon !== undefined || label !== undefined || count !== undefined;
|
|
36
|
+
return /*#__PURE__*/ _jsx(TogglePrimitive, {
|
|
37
|
+
ref: ref,
|
|
38
|
+
"data-slot": "toggle",
|
|
39
|
+
disabled: disabled,
|
|
40
|
+
className: cn(toggleVariants({
|
|
41
|
+
variant,
|
|
42
|
+
size,
|
|
43
|
+
className
|
|
44
|
+
})),
|
|
45
|
+
...props,
|
|
46
|
+
children: children ?? (hasComposedContent && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
47
|
+
children: [
|
|
48
|
+
icon,
|
|
49
|
+
label && /*#__PURE__*/ _jsx("span", {
|
|
50
|
+
"data-slot": "toggle-label",
|
|
51
|
+
children: label
|
|
52
|
+
}),
|
|
53
|
+
renderCountBadge(count, disabled)
|
|
54
|
+
]
|
|
55
|
+
}))
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
Toggle.displayName = 'Toggle';
|
|
59
|
+
export { Toggle, toggleVariants };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=toggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/toggle/toggle.tsx"],"sourcesContent":["import {\n type ComponentRef,\n type ForwardRefExoticComponent,\n type ReactNode,\n type RefAttributes,\n forwardRef,\n} from 'react';\n\nimport { Toggle as TogglePrimitive } from '@base-ui/react/toggle';\nimport { cva } from 'class-variance-authority';\nimport type { ClassProp } from 'class-variance-authority/types';\n\nimport { cn } from '../../../../lib/utils';\n\ntype ToggleVariantProps = {\n variant?: 'default' | 'outline';\n size?: 'default' | 'sm' | 'lg';\n};\n\nconst toggleVariants: (\n props?: (ToggleVariantProps & ClassProp) | undefined\n) => string = cva(\n \"group inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium text-medium-foreground hover:bg-base-background-hover disabled:pointer-events-none disabled:text-base-foreground-disabled disabled:[&_svg:not([class*='text-'])]:text-base-foreground-disabled aria-pressed:border aria-pressed:border-emphasized aria-pressed:bg-secondary-background aria-pressed:text-secondary-foreground aria-pressed:[&_svg:not([class*='text-'])]:text-secondary-foreground disabled:aria-pressed:border disabled:aria-pressed:border-default disabled:aria-pressed:bg-base-background-disabled disabled:aria-pressed:text-base-foreground-disabled disabled:aria-pressed:[&_svg:not([class*='text-'])]:text-base-foreground-disabled [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring-muted focus-visible:ring outline-none transition-[color,box-shadow] aria-invalid:ring-destructive-background/20 dark:aria-invalid:ring-destructive-background/40 aria-invalid:border-destructive-background whitespace-nowrap\",\n {\n variants: {\n variant: {\n default: 'bg-transparent',\n outline:\n 'border border-emphasized bg-transparent shadow-xs hover:bg-base-background-hover hover:text-base-foreground',\n },\n size: {\n default: 'h-9 px-2 min-w-9',\n sm: 'h-7 px-1.5 min-w-7',\n lg: 'h-8 px-2.5 min-w-8',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n);\n\ntype ToggleProps = TogglePrimitive.Props &\n ToggleVariantProps & {\n icon?: ReactNode;\n label?: ReactNode;\n count?: number | string;\n };\n\nconst renderCountBadge = (\n count: ToggleProps['count'],\n disabled: boolean | undefined\n): ReactNode => {\n if (count === undefined || count === null || count === '') {\n return null;\n }\n\n const countValue = String(count);\n\n return (\n <span\n data-slot=\"toggle-count\"\n className={cn(\n 'inline-flex h-4 min-w-4 items-center justify-center rounded-sm px-0.5 text-xs font-medium leading-3.5 tracking-tightest',\n disabled\n ? 'bg-base-background-disabled text-base-foreground-disabled'\n : 'bg-medium-background text-medium-foreground'\n )}\n >\n {countValue}\n </span>\n );\n};\n\nconst Toggle: ForwardRefExoticComponent<\n Omit<ToggleProps, 'ref'> & RefAttributes<ComponentRef<typeof TogglePrimitive>>\n> = forwardRef<ComponentRef<typeof TogglePrimitive>, ToggleProps>(\n (\n {\n className,\n variant,\n size,\n icon,\n label,\n count,\n children,\n disabled,\n ...props\n },\n ref\n ) => {\n const hasComposedContent =\n icon !== undefined || label !== undefined || count !== undefined;\n\n return (\n <TogglePrimitive\n ref={ref}\n data-slot=\"toggle\"\n disabled={disabled}\n className={cn(toggleVariants({ variant, size, className }))}\n {...props}\n >\n {children ??\n (hasComposedContent && (\n <>\n {icon}\n {label && <span data-slot=\"toggle-label\">{label}</span>}\n {renderCountBadge(count, disabled)}\n </>\n ))}\n </TogglePrimitive>\n );\n }\n);\n\nToggle.displayName = 'Toggle';\n\nexport { Toggle, toggleVariants };\n"],"names":["forwardRef","Toggle","TogglePrimitive","cva","cn","toggleVariants","variants","variant","default","outline","size","sm","lg","defaultVariants","renderCountBadge","count","disabled","undefined","countValue","String","span","data-slot","className","icon","label","children","props","ref","hasComposedContent","displayName"],"mappings":";AAAA,SAKEA,UAAU,QACL,QAAQ;AAEf,SAASC,UAAUC,eAAe,QAAQ,wBAAwB;AAClE,SAASC,GAAG,QAAQ,2BAA2B;AAG/C,SAASC,EAAE,QAAQ,2BAAwB;AAO3C,MAAMC,iBAEQF,IACZ,qjCACA;IACEG,UAAU;QACRC,SAAS;YACPC,SAAS;YACTC,SACE;QACJ;QACAC,MAAM;YACJF,SAAS;YACTG,IAAI;YACJC,IAAI;QACN;IACF;IACAC,iBAAiB;QACfN,SAAS;QACTG,MAAM;IACR;AACF;AAUF,MAAMI,mBAAmB,CACvBC,OACAC;IAEA,IAAID,UAAUE,aAAaF,UAAU,QAAQA,UAAU,IAAI;QACzD,OAAO;IACT;IAEA,MAAMG,aAAaC,OAAOJ;IAE1B,qBACE,KAACK;QACCC,aAAU;QACVC,WAAWlB,GACT,2HACAY,WACI,8DACA;kBAGLE;;AAGP;AAEA,MAAMjB,uBAEFD,WACF,CACE,EACEsB,SAAS,EACTf,OAAO,EACPG,IAAI,EACJa,IAAI,EACJC,KAAK,EACLT,KAAK,EACLU,QAAQ,EACRT,QAAQ,EACR,GAAGU,OACJ,EACDC;IAEA,MAAMC,qBACJL,SAASN,aAAaO,UAAUP,aAAaF,UAAUE;IAEzD,qBACE,KAACf;QACCyB,KAAKA;QACLN,aAAU;QACVL,UAAUA;QACVM,WAAWlB,GAAGC,eAAe;YAAEE;YAASG;YAAMY;QAAU;QACvD,GAAGI,KAAK;kBAERD,YACEG,CAAAA,oCACC;;gBACGL;gBACAC,uBAAS,KAACJ;oBAAKC,aAAU;8BAAgBG;;gBACzCV,iBAAiBC,OAAOC;;UAE7B;;AAGR;AAGFf,OAAO4B,WAAW,GAAG;AAErB,SAAS5B,MAAM,EAAEI,cAAc,GAAG"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { ComponentProps, ForwardRefExoticComponent, RefAttributes } from
|
|
2
|
-
import { CollapsibleRootProps, CollapsiblePanelProps } from
|
|
3
|
-
import { ToolUIPart } from
|
|
4
|
-
import { CollapsibleTrigger } from
|
|
5
|
-
declare const Tool: ForwardRefExoticComponent<Omit<CollapsibleRootProps,
|
|
6
|
-
type ToolHeaderProps = Omit<ComponentProps<typeof CollapsibleTrigger>,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import type { ComponentProps, ForwardRefExoticComponent, RefAttributes } from "react";
|
|
2
|
+
import type { CollapsibleRootProps, CollapsiblePanelProps } from "@base-ui/react";
|
|
3
|
+
import type { ToolUIPart } from "../../../../lib/ai/types";
|
|
4
|
+
import { CollapsibleTrigger } from "../collapsible/collapsible";
|
|
5
|
+
declare const Tool: ForwardRefExoticComponent<Omit<CollapsibleRootProps, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
6
|
+
type ToolHeaderProps = Omit<ComponentProps<typeof CollapsibleTrigger>, "type"> & {
|
|
7
|
+
title?: string;
|
|
8
|
+
type: ToolUIPart["type"];
|
|
9
|
+
hasError?: boolean;
|
|
10
10
|
};
|
|
11
|
-
declare const ToolHeader: ForwardRefExoticComponent<Omit<ToolHeaderProps,
|
|
12
|
-
declare const ToolContent: ForwardRefExoticComponent<Omit<CollapsiblePanelProps,
|
|
13
|
-
type ToolInputProps = ComponentProps<
|
|
14
|
-
|
|
11
|
+
declare const ToolHeader: ForwardRefExoticComponent<Omit<ToolHeaderProps, "ref"> & RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
declare const ToolContent: ForwardRefExoticComponent<Omit<CollapsiblePanelProps, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
13
|
+
type ToolInputProps = ComponentProps<"div"> & {
|
|
14
|
+
input: ToolUIPart["input"];
|
|
15
15
|
};
|
|
16
|
-
declare const ToolInput: ForwardRefExoticComponent<Omit<ToolInputProps,
|
|
17
|
-
type ToolOutputProps = ComponentProps<
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
declare const ToolInput: ForwardRefExoticComponent<Omit<ToolInputProps, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
17
|
+
type ToolOutputProps = ComponentProps<"div"> & {
|
|
18
|
+
output: ToolUIPart["output"];
|
|
19
|
+
errorText: ToolUIPart["errorText"];
|
|
20
20
|
};
|
|
21
|
-
declare const ToolOutput: ForwardRefExoticComponent<Omit<ToolOutputProps,
|
|
21
|
+
declare const ToolOutput: ForwardRefExoticComponent<Omit<ToolOutputProps, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
22
22
|
export { Tool, ToolHeader, ToolContent, ToolInput, ToolOutput };
|
|
@@ -1,127 +1,168 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { IconSelector } from "@tabler/icons-react";
|
|
4
|
+
import { cn, isJsonString } from "../../../../lib/utils.js";
|
|
5
|
+
import { Badge } from "../badge/badge.js";
|
|
6
|
+
import { Button } from "../button/button.js";
|
|
7
|
+
import { CodeBlock, CodeBlockCollapseButton, CodeBlockCopyButton, CodeBlockDownloadButton } from "../code-block/code-block.js";
|
|
8
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../collapsible/collapsible.js";
|
|
9
|
+
const Tool = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ _jsx(Collapsible, {
|
|
10
|
+
ref: ref,
|
|
11
|
+
"data-slot": "tool",
|
|
12
|
+
className: cn('group not-prose w-full bg-card-background rounded-md flex flex-col gap-2', className),
|
|
13
|
+
...props
|
|
14
|
+
}));
|
|
15
|
+
Tool.displayName = 'Tool';
|
|
16
|
+
const ToolHeader = /*#__PURE__*/ forwardRef(({ className, title, type, hasError = false, ...props }, ref)=>/*#__PURE__*/ _jsx(CollapsibleTrigger, {
|
|
17
|
+
ref: ref,
|
|
18
|
+
"data-slot": "tool-header",
|
|
19
|
+
className: className,
|
|
20
|
+
render: /*#__PURE__*/ _jsxs(Button, {
|
|
21
|
+
variant: "ghost",
|
|
22
|
+
className: "w-full justify-between text-base leading-5 tracking-tighter",
|
|
23
|
+
children: [
|
|
24
|
+
/*#__PURE__*/ _jsx("span", {
|
|
25
|
+
children: title ?? type.substring(type.indexOf('-') + 1)
|
|
26
|
+
}),
|
|
27
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
28
|
+
className: "flex items-center gap-2",
|
|
29
|
+
children: [
|
|
30
|
+
hasError ? /*#__PURE__*/ _jsx(Badge, {
|
|
31
|
+
outline: true,
|
|
32
|
+
className: "bg-card-background text-critical-foreground-strong border-default",
|
|
33
|
+
children: "Error"
|
|
34
|
+
}) : null,
|
|
35
|
+
/*#__PURE__*/ _jsx(IconSelector, {
|
|
36
|
+
className: "h-4 w-4"
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
}),
|
|
42
|
+
...props
|
|
43
|
+
}));
|
|
44
|
+
ToolHeader.displayName = 'ToolHeader';
|
|
45
|
+
const ToolContent = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ _jsx(CollapsibleContent, {
|
|
46
|
+
ref: ref,
|
|
47
|
+
"data-slot": "tool-content",
|
|
48
|
+
className: cn(/* min-h-0: flex descendants (e.g. CodeBlock max-height) may shrink */ 'flex min-h-0 flex-col gap-4 py-3 text-popover-foreground outline-none', className),
|
|
49
|
+
...props
|
|
50
|
+
}));
|
|
51
|
+
ToolContent.displayName = 'ToolContent';
|
|
52
|
+
const ToolInput = /*#__PURE__*/ forwardRef(({ className, input, ...props }, ref)=>/*#__PURE__*/ _jsxs("div", {
|
|
53
|
+
ref: ref,
|
|
54
|
+
"data-slot": "tool-input",
|
|
55
|
+
className: cn('min-h-0 space-y-2 overflow-x-hidden overflow-y-visible px-3.25', className),
|
|
56
|
+
...props,
|
|
57
|
+
children: [
|
|
58
|
+
/*#__PURE__*/ _jsx("h4", {
|
|
59
|
+
className: "text-sm font-medium uppercase tracking-wide text-muted-foreground",
|
|
60
|
+
children: "Parameters"
|
|
61
|
+
}),
|
|
62
|
+
/*#__PURE__*/ _jsx("div", {
|
|
63
|
+
className: "min-h-0 rounded-md bg-muted/50",
|
|
64
|
+
children: /*#__PURE__*/ _jsxs(CodeBlock, {
|
|
65
|
+
code: JSON.stringify(input, null, 2),
|
|
66
|
+
language: "json",
|
|
67
|
+
collapsed: true,
|
|
68
|
+
children: [
|
|
69
|
+
/*#__PURE__*/ _jsx(CodeBlockCopyButton, {}),
|
|
70
|
+
/*#__PURE__*/ _jsx(CodeBlockDownloadButton, {
|
|
71
|
+
fileName: "tool-parameters.json"
|
|
72
|
+
}),
|
|
73
|
+
/*#__PURE__*/ _jsx(CodeBlockCollapseButton, {})
|
|
74
|
+
]
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
]
|
|
78
|
+
}));
|
|
79
|
+
ToolInput.displayName = 'ToolInput';
|
|
80
|
+
const ToolOutput = /*#__PURE__*/ forwardRef(({ className, output, errorText, ...props }, ref)=>{
|
|
81
|
+
if ((output === null || output === undefined) && !errorText) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
let outputElement = null;
|
|
85
|
+
if (typeof output === 'string') {
|
|
86
|
+
outputElement = /*#__PURE__*/ _jsxs(CodeBlock, {
|
|
87
|
+
code: output,
|
|
88
|
+
language: isJsonString(output) ? 'json' : 'text',
|
|
89
|
+
collapsed: true,
|
|
90
|
+
children: [
|
|
91
|
+
/*#__PURE__*/ _jsx(CodeBlockCopyButton, {}),
|
|
92
|
+
/*#__PURE__*/ _jsx(CodeBlockDownloadButton, {
|
|
93
|
+
fileName: "tool-result.json"
|
|
94
|
+
}),
|
|
95
|
+
/*#__PURE__*/ _jsx(CodeBlockCollapseButton, {})
|
|
96
|
+
]
|
|
97
|
+
});
|
|
98
|
+
} else if (output === null || output === undefined) {
|
|
99
|
+
outputElement = null;
|
|
100
|
+
} else if (typeof output === 'object') {
|
|
101
|
+
outputElement = /*#__PURE__*/ _jsxs(CodeBlock, {
|
|
102
|
+
code: JSON.stringify(output, null, 2),
|
|
103
|
+
language: "json",
|
|
104
|
+
collapsed: true,
|
|
105
|
+
children: [
|
|
106
|
+
/*#__PURE__*/ _jsx(CodeBlockCopyButton, {}),
|
|
107
|
+
/*#__PURE__*/ _jsx(CodeBlockDownloadButton, {
|
|
108
|
+
fileName: "tool-result.json"
|
|
109
|
+
}),
|
|
110
|
+
/*#__PURE__*/ _jsx(CodeBlockCollapseButton, {})
|
|
111
|
+
]
|
|
112
|
+
});
|
|
113
|
+
} else if (typeof output === 'number' || typeof output === 'boolean' || typeof output === 'bigint') {
|
|
114
|
+
outputElement = /*#__PURE__*/ _jsxs(CodeBlock, {
|
|
115
|
+
code: String(output),
|
|
116
|
+
language: "json",
|
|
117
|
+
collapsed: true,
|
|
118
|
+
children: [
|
|
119
|
+
/*#__PURE__*/ _jsx(CodeBlockCopyButton, {}),
|
|
120
|
+
/*#__PURE__*/ _jsx(CodeBlockDownloadButton, {
|
|
121
|
+
fileName: "tool-result.json"
|
|
122
|
+
}),
|
|
123
|
+
/*#__PURE__*/ _jsx(CodeBlockCollapseButton, {})
|
|
124
|
+
]
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
if (errorText) {
|
|
128
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
129
|
+
ref: ref,
|
|
130
|
+
"data-slot": "tool-output",
|
|
131
|
+
className: cn('space-y-2 px-3.25', className),
|
|
132
|
+
...props,
|
|
133
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
134
|
+
className: "flex flex-col gap-2 text-sm",
|
|
135
|
+
children: [
|
|
136
|
+
/*#__PURE__*/ _jsx("span", {
|
|
137
|
+
className: "font-medium text-critical-foreground-strong",
|
|
138
|
+
children: "ERROR"
|
|
139
|
+
}),
|
|
140
|
+
/*#__PURE__*/ _jsx("span", {
|
|
141
|
+
className: "text-base-foreground",
|
|
142
|
+
children: errorText
|
|
143
|
+
})
|
|
144
|
+
]
|
|
145
|
+
})
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
149
|
+
ref: ref,
|
|
150
|
+
"data-slot": "tool-output",
|
|
151
|
+
className: cn('space-y-2 px-3.25', className),
|
|
152
|
+
...props,
|
|
153
|
+
children: [
|
|
154
|
+
/*#__PURE__*/ _jsx("h4", {
|
|
155
|
+
className: "text-sm font-medium uppercase tracking-wide text-muted-foreground",
|
|
156
|
+
children: "Result"
|
|
157
|
+
}),
|
|
158
|
+
/*#__PURE__*/ _jsx("div", {
|
|
159
|
+
className: "min-h-0 overflow-x-auto rounded-md bg-muted-background/50 text-xs text-base-foreground [&_table]:w-full",
|
|
160
|
+
children: outputElement
|
|
161
|
+
})
|
|
162
|
+
]
|
|
163
|
+
});
|
|
124
164
|
});
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
165
|
+
ToolOutput.displayName = 'ToolOutput';
|
|
166
|
+
export { Tool, ToolHeader, ToolContent, ToolInput, ToolOutput };
|
|
167
|
+
|
|
168
|
+
//# sourceMappingURL=tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/tool/tool.tsx"],"sourcesContent":["import type {\n ComponentProps,\n ComponentRef,\n ForwardRefExoticComponent,\n ReactNode,\n RefAttributes,\n} from 'react';\nimport { forwardRef } from 'react';\n\nimport type {\n CollapsibleRootProps,\n CollapsiblePanelProps,\n} from '@base-ui/react';\nimport { IconSelector } from '@tabler/icons-react';\n\nimport type { ToolUIPart } from '../../../../lib/ai/types';\nimport type { CodeLanguage } from '../../../../lib/highlight-code';\nimport { cn, isJsonString } from '../../../../lib/utils';\nimport { Badge } from '../badge/badge';\nimport { Button } from '../button/button';\nimport {\n CodeBlock,\n CodeBlockCollapseButton,\n CodeBlockCopyButton,\n CodeBlockDownloadButton,\n} from '../code-block/code-block';\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from '../collapsible/collapsible';\n\ntype ToolProps = ComponentProps<typeof Collapsible>;\n\nconst Tool: ForwardRefExoticComponent<\n Omit<CollapsibleRootProps, 'ref'> & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<typeof Collapsible>, ToolProps>(\n ({ className, ...props }, ref) => (\n <Collapsible\n ref={ref}\n data-slot=\"tool\"\n className={cn(\n 'group not-prose w-full bg-card-background rounded-md flex flex-col gap-2',\n className\n )}\n {...props}\n />\n )\n);\nTool.displayName = 'Tool';\n\ntype ToolHeaderProps = Omit<\n ComponentProps<typeof CollapsibleTrigger>,\n 'type'\n> & {\n title?: string;\n type: ToolUIPart['type'];\n hasError?: boolean;\n};\n\nconst ToolHeader: ForwardRefExoticComponent<\n Omit<ToolHeaderProps, 'ref'> & RefAttributes<HTMLButtonElement>\n> = forwardRef<ComponentRef<typeof CollapsibleTrigger>, ToolHeaderProps>(\n ({ className, title, type, hasError = false, ...props }, ref) => (\n <CollapsibleTrigger\n ref={ref}\n data-slot=\"tool-header\"\n className={className}\n render={\n <Button\n variant=\"ghost\"\n className=\"w-full justify-between text-base leading-5 tracking-tighter\"\n >\n <span>{title ?? type.substring(type.indexOf('-') + 1)}</span>\n <div className=\"flex items-center gap-2\">\n {hasError ? (\n <Badge\n outline\n className=\"bg-card-background text-critical-foreground-strong border-default\"\n >\n Error\n </Badge>\n ) : null}\n <IconSelector className=\"h-4 w-4\" />\n </div>\n </Button>\n }\n {...props}\n />\n )\n);\nToolHeader.displayName = 'ToolHeader';\n\ntype ToolContentProps = ComponentProps<typeof CollapsibleContent>;\n\nconst ToolContent: ForwardRefExoticComponent<\n Omit<CollapsiblePanelProps, 'ref'> & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<typeof CollapsibleContent>, ToolContentProps>(\n ({ className, ...props }, ref) => (\n <CollapsibleContent\n ref={ref}\n data-slot=\"tool-content\"\n className={cn(\n /* min-h-0: flex descendants (e.g. CodeBlock max-height) may shrink */\n 'flex min-h-0 flex-col gap-4 py-3 text-popover-foreground outline-none',\n className\n )}\n {...props}\n />\n )\n);\nToolContent.displayName = 'ToolContent';\n\ntype ToolInputProps = ComponentProps<'div'> & {\n input: ToolUIPart['input'];\n};\n\nconst ToolInput: ForwardRefExoticComponent<\n Omit<ToolInputProps, 'ref'> & RefAttributes<HTMLDivElement>\n> = forwardRef<HTMLDivElement, ToolInputProps>(\n ({ className, input, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"tool-input\"\n className={cn(\n 'min-h-0 space-y-2 overflow-x-hidden overflow-y-visible px-3.25',\n className\n )}\n {...props}\n >\n <h4 className=\"text-sm font-medium uppercase tracking-wide text-muted-foreground\">\n Parameters\n </h4>\n <div className=\"min-h-0 rounded-md bg-muted/50\">\n <CodeBlock\n code={JSON.stringify(input, null, 2)}\n language=\"json\"\n collapsed\n >\n <CodeBlockCopyButton />\n <CodeBlockDownloadButton fileName=\"tool-parameters.json\" />\n <CodeBlockCollapseButton />\n </CodeBlock>\n </div>\n </div>\n )\n);\nToolInput.displayName = 'ToolInput';\n\ntype ToolOutputProps = ComponentProps<'div'> & {\n output: ToolUIPart['output'];\n errorText: ToolUIPart['errorText'];\n};\n\nconst ToolOutput: ForwardRefExoticComponent<\n Omit<ToolOutputProps, 'ref'> & RefAttributes<HTMLDivElement>\n> = forwardRef<HTMLDivElement, ToolOutputProps>(\n ({ className, output, errorText, ...props }, ref) => {\n if ((output === null || output === undefined) && !errorText) {\n return null;\n }\n\n let outputElement: ReactNode = null;\n if (typeof output === 'string') {\n outputElement = (\n <CodeBlock\n code={output}\n language={(isJsonString(output) ? 'json' : 'text') as CodeLanguage}\n collapsed\n >\n <CodeBlockCopyButton />\n <CodeBlockDownloadButton fileName=\"tool-result.json\" />\n <CodeBlockCollapseButton />\n </CodeBlock>\n );\n } else if (output === null || output === undefined) {\n outputElement = null;\n } else if (typeof output === 'object') {\n outputElement = (\n <CodeBlock\n code={JSON.stringify(output, null, 2)}\n language=\"json\"\n collapsed\n >\n <CodeBlockCopyButton />\n <CodeBlockDownloadButton fileName=\"tool-result.json\" />\n <CodeBlockCollapseButton />\n </CodeBlock>\n );\n } else if (\n typeof output === 'number' ||\n typeof output === 'boolean' ||\n typeof output === 'bigint'\n ) {\n outputElement = (\n <CodeBlock code={String(output)} language=\"json\" collapsed>\n <CodeBlockCopyButton />\n <CodeBlockDownloadButton fileName=\"tool-result.json\" />\n <CodeBlockCollapseButton />\n </CodeBlock>\n );\n }\n\n if (errorText) {\n return (\n <div\n ref={ref}\n data-slot=\"tool-output\"\n className={cn('space-y-2 px-3.25', className)}\n {...props}\n >\n <div className=\"flex flex-col gap-2 text-sm\">\n <span className=\"font-medium text-critical-foreground-strong\">\n ERROR\n </span>\n <span className=\"text-base-foreground\">{errorText}</span>\n </div>\n </div>\n );\n }\n\n return (\n <div\n ref={ref}\n data-slot=\"tool-output\"\n className={cn('space-y-2 px-3.25', className)}\n {...props}\n >\n <h4 className=\"text-sm font-medium uppercase tracking-wide text-muted-foreground\">\n Result\n </h4>\n <div className=\"min-h-0 overflow-x-auto rounded-md bg-muted-background/50 text-xs text-base-foreground [&_table]:w-full\">\n {outputElement}\n </div>\n </div>\n );\n }\n);\nToolOutput.displayName = 'ToolOutput';\n\nexport { Tool, ToolHeader, ToolContent, ToolInput, ToolOutput };\n"],"names":["forwardRef","IconSelector","cn","isJsonString","Badge","Button","CodeBlock","CodeBlockCollapseButton","CodeBlockCopyButton","CodeBlockDownloadButton","Collapsible","CollapsibleContent","CollapsibleTrigger","Tool","className","props","ref","data-slot","displayName","ToolHeader","title","type","hasError","render","variant","span","substring","indexOf","div","outline","ToolContent","ToolInput","input","h4","code","JSON","stringify","language","collapsed","fileName","ToolOutput","output","errorText","undefined","outputElement","String"],"mappings":";AAOA,SAASA,UAAU,QAAQ,QAAQ;AAMnC,SAASC,YAAY,QAAQ,sBAAsB;AAInD,SAASC,EAAE,EAAEC,YAAY,QAAQ,2BAAwB;AACzD,SAASC,KAAK,QAAQ,oBAAiB;AACvC,SAASC,MAAM,QAAQ,sBAAmB;AAC1C,SACEC,SAAS,EACTC,uBAAuB,EACvBC,mBAAmB,EACnBC,uBAAuB,QAClB,8BAA2B;AAClC,SACEC,WAAW,EACXC,kBAAkB,EAClBC,kBAAkB,QACb,gCAA6B;AAIpC,MAAMC,qBAEFb,WACF,CAAC,EAAEc,SAAS,EAAE,GAAGC,OAAO,EAAEC,oBACxB,KAACN;QACCM,KAAKA;QACLC,aAAU;QACVH,WAAWZ,GACT,4EACAY;QAED,GAAGC,KAAK;;AAIfF,KAAKK,WAAW,GAAG;AAWnB,MAAMC,2BAEFnB,WACF,CAAC,EAAEc,SAAS,EAAEM,KAAK,EAAEC,IAAI,EAAEC,WAAW,KAAK,EAAE,GAAGP,OAAO,EAAEC,oBACvD,KAACJ;QACCI,KAAKA;QACLC,aAAU;QACVH,WAAWA;QACXS,sBACE,MAAClB;YACCmB,SAAQ;YACRV,WAAU;;8BAEV,KAACW;8BAAML,SAASC,KAAKK,SAAS,CAACL,KAAKM,OAAO,CAAC,OAAO;;8BACnD,MAACC;oBAAId,WAAU;;wBACZQ,yBACC,KAAClB;4BACCyB,OAAO;4BACPf,WAAU;sCACX;6BAGC;sCACJ,KAACb;4BAAaa,WAAU;;;;;;QAI7B,GAAGC,KAAK;;AAIfI,WAAWD,WAAW,GAAG;AAIzB,MAAMY,4BAEF9B,WACF,CAAC,EAAEc,SAAS,EAAE,GAAGC,OAAO,EAAEC,oBACxB,KAACL;QACCK,KAAKA;QACLC,aAAU;QACVH,WAAWZ,GACT,oEAAoE,GACpE,yEACAY;QAED,GAAGC,KAAK;;AAIfe,YAAYZ,WAAW,GAAG;AAM1B,MAAMa,0BAEF/B,WACF,CAAC,EAAEc,SAAS,EAAEkB,KAAK,EAAE,GAAGjB,OAAO,EAAEC,oBAC/B,MAACY;QACCZ,KAAKA;QACLC,aAAU;QACVH,WAAWZ,GACT,kEACAY;QAED,GAAGC,KAAK;;0BAET,KAACkB;gBAAGnB,WAAU;0BAAoE;;0BAGlF,KAACc;gBAAId,WAAU;0BACb,cAAA,MAACR;oBACC4B,MAAMC,KAAKC,SAAS,CAACJ,OAAO,MAAM;oBAClCK,UAAS;oBACTC,SAAS;;sCAET,KAAC9B;sCACD,KAACC;4BAAwB8B,UAAS;;sCAClC,KAAChC;;;;;;AAMXwB,UAAUb,WAAW,GAAG;AAOxB,MAAMsB,2BAEFxC,WACF,CAAC,EAAEc,SAAS,EAAE2B,MAAM,EAAEC,SAAS,EAAE,GAAG3B,OAAO,EAAEC;IAC3C,IAAI,AAACyB,CAAAA,WAAW,QAAQA,WAAWE,SAAQ,KAAM,CAACD,WAAW;QAC3D,OAAO;IACT;IAEA,IAAIE,gBAA2B;IAC/B,IAAI,OAAOH,WAAW,UAAU;QAC9BG,8BACE,MAACtC;YACC4B,MAAMO;YACNJ,UAAWlC,aAAasC,UAAU,SAAS;YAC3CH,SAAS;;8BAET,KAAC9B;8BACD,KAACC;oBAAwB8B,UAAS;;8BAClC,KAAChC;;;IAGP,OAAO,IAAIkC,WAAW,QAAQA,WAAWE,WAAW;QAClDC,gBAAgB;IAClB,OAAO,IAAI,OAAOH,WAAW,UAAU;QACrCG,8BACE,MAACtC;YACC4B,MAAMC,KAAKC,SAAS,CAACK,QAAQ,MAAM;YACnCJ,UAAS;YACTC,SAAS;;8BAET,KAAC9B;8BACD,KAACC;oBAAwB8B,UAAS;;8BAClC,KAAChC;;;IAGP,OAAO,IACL,OAAOkC,WAAW,YAClB,OAAOA,WAAW,aAClB,OAAOA,WAAW,UAClB;QACAG,8BACE,MAACtC;YAAU4B,MAAMW,OAAOJ;YAASJ,UAAS;YAAOC,SAAS;;8BACxD,KAAC9B;8BACD,KAACC;oBAAwB8B,UAAS;;8BAClC,KAAChC;;;IAGP;IAEA,IAAImC,WAAW;QACb,qBACE,KAACd;YACCZ,KAAKA;YACLC,aAAU;YACVH,WAAWZ,GAAG,qBAAqBY;YAClC,GAAGC,KAAK;sBAET,cAAA,MAACa;gBAAId,WAAU;;kCACb,KAACW;wBAAKX,WAAU;kCAA8C;;kCAG9D,KAACW;wBAAKX,WAAU;kCAAwB4B;;;;;IAIhD;IAEA,qBACE,MAACd;QACCZ,KAAKA;QACLC,aAAU;QACVH,WAAWZ,GAAG,qBAAqBY;QAClC,GAAGC,KAAK;;0BAET,KAACkB;gBAAGnB,WAAU;0BAAoE;;0BAGlF,KAACc;gBAAId,WAAU;0BACZ8B;;;;AAIT;AAEFJ,WAAWtB,WAAW,GAAG;AAEzB,SAASL,IAAI,EAAEM,UAAU,EAAEW,WAAW,EAAEC,SAAS,EAAES,UAAU,GAAG"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ComponentProps, type ForwardRefExoticComponent, type ReactNode, type RefAttributes } from "react";
|
|
2
|
+
import type { ToolbarButtonProps, ToolbarGroupProps, ToolbarRootProps, ToolbarSeparatorProps } from "@base-ui/react/toolbar";
|
|
3
|
+
import { Toolbar as ToolbarPrimitive } from "@base-ui/react/toolbar";
|
|
4
|
+
import { type VariantProps } from "class-variance-authority";
|
|
5
|
+
import type { ClassProp } from "class-variance-authority/types";
|
|
6
|
+
import { buttonVariants } from "../button/button";
|
|
7
|
+
import { segmentedControlButtonVariants, segmentedControlListVariants } from "../segmented-control/segmented-control";
|
|
8
|
+
interface ToolbarVariantProps {
|
|
9
|
+
floating?: boolean | null;
|
|
10
|
+
}
|
|
11
|
+
declare const toolbarVariants: (props?: (ToolbarVariantProps & ClassProp) | undefined) => string;
|
|
12
|
+
declare const Toolbar: ForwardRefExoticComponent<Omit<ToolbarRootProps & ToolbarVariantProps, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
13
|
+
declare const ToolbarButton: ForwardRefExoticComponent<Omit<ToolbarButtonProps & VariantProps<typeof buttonVariants>, "ref"> & RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
declare const ToolbarSeparator: ForwardRefExoticComponent<Omit<ToolbarSeparatorProps, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
15
|
+
declare const ToolbarGroup: ForwardRefExoticComponent<Omit<ToolbarGroupProps, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
16
|
+
type ToolbarTitleProps = ComponentProps<"span"> & {
|
|
17
|
+
badge?: ReactNode;
|
|
18
|
+
dropdown?: boolean;
|
|
19
|
+
};
|
|
20
|
+
declare function ToolbarTitle({ className, children, badge, dropdown, ...props }: ToolbarTitleProps): ReactNode;
|
|
21
|
+
type ToolbarSegmentedControlProps = Omit<ToolbarPrimitive.Group.Props, "onChange"> & VariantProps<typeof segmentedControlListVariants> & {
|
|
22
|
+
value?: string;
|
|
23
|
+
defaultValue?: string;
|
|
24
|
+
onValueChange?: (value: string) => void;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A single-select segmented control that participates in the Toolbar roving
|
|
28
|
+
* tabindex as real toolbar items (so arrow keys traverse it and the toolbar
|
|
29
|
+
* remains a single tab stop), while reusing SegmentedControl's styling and
|
|
30
|
+
* sliding indicator.
|
|
31
|
+
*/
|
|
32
|
+
declare function ToolbarSegmentedControl({ className, size, value, defaultValue, onValueChange, children, ...props }: ToolbarSegmentedControlProps): ReactNode;
|
|
33
|
+
type ToolbarSegmentedControlButtonProps = ComponentProps<typeof ToolbarPrimitive.Button> & VariantProps<typeof segmentedControlButtonVariants> & {
|
|
34
|
+
value: string;
|
|
35
|
+
};
|
|
36
|
+
declare function ToolbarSegmentedControlButton({ className, size, tabContent, value, onClick, children, ...props }: ToolbarSegmentedControlButtonProps): ReactNode;
|
|
37
|
+
export { Toolbar, ToolbarButton, ToolbarGroup, ToolbarSegmentedControl, ToolbarSegmentedControlButton, ToolbarSeparator, ToolbarTitle, toolbarVariants };
|