@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,159 +1,188 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"[&_svg]:shrink-0",
|
|
16
|
-
"[&_svg:not([class*='size-']):not([class*='w-'])]:w-4",
|
|
17
|
-
"[&_svg:not([class*='size-']):not([class*='h-'])]:h-4"
|
|
18
|
-
].join(" ")), g = p("relative w-full rounded-md pt-2.5 pr-3 has-[>button[data-slot=alert-close]]:pr-12 pb-2 pl-3 text-sm grid has-[>[data-slot=alert-icon]]:grid-cols-[auto_1fr] grid-cols-[0_1fr] has-[>[data-slot=alert-icon]]:gap-x-2 has-[>[data-slot=alert-icon]]:gap-y-1 items-start", {
|
|
19
|
-
variants: {
|
|
20
|
-
variant: {
|
|
21
|
-
default: "bg-neutral-muted-background text-foreground [&>[data-slot=alert-icon]]:text-muted-foreground",
|
|
22
|
-
info: "bg-info-muted-background text-foreground [&>[data-slot=alert-icon]]:text-info-foreground",
|
|
23
|
-
warning: "bg-warning-muted-background [&>[data-slot=alert-icon]]:text-warning-foreground",
|
|
24
|
-
error: "bg-destructive-muted-background text-foreground [&>[data-slot=alert-icon]]:text-destructive-foreground"
|
|
25
|
-
},
|
|
26
|
-
alertStyle: {
|
|
27
|
-
card: "pt-3 pr-5 pb-3 pl-3 [&>[data-slot=alert-title]+[data-slot=alert-description]]:mt-2 [&>[data-slot=alert-icon]]:mt-0.5",
|
|
28
|
-
strip: "flex min-h-11 items-center gap-2 py-2 pr-3 pl-3 [&>[data-slot=alert-title]]:hidden"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
defaultVariants: {
|
|
32
|
-
variant: "default",
|
|
33
|
-
alertStyle: "card"
|
|
34
|
-
}
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, forwardRef, useContext, useMemo } from "react";
|
|
3
|
+
import { IconAlertCircleFilled, IconAlertTriangleFilled, IconInfoCircleFilled, IconX } from "@tabler/icons-react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { useControllableState } from "../../../../lib/use-controllable-state.js";
|
|
6
|
+
import { cn } from "../../../../lib/utils.js";
|
|
7
|
+
import { Button } from "../button/button.js";
|
|
8
|
+
const AlertContext = /*#__PURE__*/ createContext({
|
|
9
|
+
show: true,
|
|
10
|
+
setShow: ()=>{
|
|
11
|
+
void 0; /* noop - default context fallback */
|
|
12
|
+
},
|
|
13
|
+
variant: 'default',
|
|
14
|
+
alertStyle: 'card'
|
|
35
15
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
16
|
+
const alertIconVariants = cva([
|
|
17
|
+
'[&_svg]:shrink-0',
|
|
18
|
+
"[&_svg:not([class*='size-']):not([class*='w-'])]:w-4",
|
|
19
|
+
"[&_svg:not([class*='size-']):not([class*='h-'])]:h-4"
|
|
20
|
+
].join(' '));
|
|
21
|
+
const alertVariants = cva('relative w-full rounded-md pt-2.5 pr-3 has-[>button[data-slot=alert-close]]:pr-12 pb-2 pl-3 text-sm grid has-[>[data-slot=alert-icon]]:grid-cols-[auto_1fr] grid-cols-[0_1fr] has-[>[data-slot=alert-icon]]:gap-x-2 has-[>[data-slot=alert-icon]]:gap-y-1 items-start', {
|
|
22
|
+
variants: {
|
|
23
|
+
variant: {
|
|
24
|
+
default: 'bg-neutral-muted-background text-foreground [&>[data-slot=alert-icon]]:text-muted-foreground',
|
|
25
|
+
info: 'bg-info-muted-background text-foreground [&>[data-slot=alert-icon]]:text-info-foreground',
|
|
26
|
+
warning: 'bg-warning-muted-background [&>[data-slot=alert-icon]]:text-warning-foreground',
|
|
27
|
+
error: 'bg-destructive-muted-background text-foreground [&>[data-slot=alert-icon]]:text-destructive-foreground'
|
|
28
|
+
},
|
|
29
|
+
alertStyle: {
|
|
30
|
+
card: 'pt-3 pr-5 pb-3 pl-3 [&>[data-slot=alert-title]+[data-slot=alert-description]]:mt-2 [&>[data-slot=alert-icon]]:mt-0.5',
|
|
31
|
+
strip: 'flex min-h-11 items-center gap-2 py-2 pr-3 pl-3 [&>[data-slot=alert-title]]:hidden'
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: {
|
|
35
|
+
variant: 'default',
|
|
36
|
+
alertStyle: 'card'
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
function getDefaultAlertIcon(variant) {
|
|
40
|
+
const iconProps = {
|
|
41
|
+
'aria-hidden': true
|
|
42
|
+
};
|
|
43
|
+
switch(variant){
|
|
44
|
+
case 'warning':
|
|
45
|
+
return /*#__PURE__*/ _jsx(IconAlertTriangleFilled, {
|
|
46
|
+
...iconProps
|
|
47
|
+
});
|
|
48
|
+
case 'error':
|
|
49
|
+
return /*#__PURE__*/ _jsx(IconAlertCircleFilled, {
|
|
50
|
+
...iconProps
|
|
51
|
+
});
|
|
52
|
+
case 'info':
|
|
53
|
+
case 'default':
|
|
54
|
+
default:
|
|
55
|
+
return /*#__PURE__*/ _jsx(IconInfoCircleFilled, {
|
|
56
|
+
...iconProps
|
|
57
|
+
});
|
|
58
|
+
}
|
|
43
59
|
}
|
|
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
|
-
|
|
60
|
+
const Alert = /*#__PURE__*/ forwardRef(({ className, variant = 'default', alertStyle = 'card', visible, defaultVisible = true, onClose, icon, children, ...props }, ref)=>{
|
|
61
|
+
const [show, setShow] = useControllableState({
|
|
62
|
+
defaultProp: defaultVisible,
|
|
63
|
+
prop: visible,
|
|
64
|
+
onChange: onClose
|
|
65
|
+
});
|
|
66
|
+
const alertVariant = variant === 'secondary' ? 'info' : variant ?? 'default';
|
|
67
|
+
const contextValue = useMemo(()=>{
|
|
68
|
+
return {
|
|
69
|
+
show,
|
|
70
|
+
setShow,
|
|
71
|
+
variant: alertVariant,
|
|
72
|
+
alertStyle
|
|
73
|
+
};
|
|
74
|
+
}, [
|
|
75
|
+
show,
|
|
76
|
+
setShow,
|
|
77
|
+
alertVariant,
|
|
78
|
+
alertStyle
|
|
79
|
+
]);
|
|
80
|
+
if (!show) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
const resolvedIcon = icon !== undefined ? icon : getDefaultAlertIcon(alertVariant);
|
|
84
|
+
return /*#__PURE__*/ _jsx(AlertContext.Provider, {
|
|
85
|
+
value: contextValue,
|
|
86
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
87
|
+
ref: ref,
|
|
88
|
+
"data-slot": "alert",
|
|
89
|
+
role: "alert",
|
|
90
|
+
className: cn(alertVariants({
|
|
91
|
+
variant: alertVariant,
|
|
92
|
+
alertStyle
|
|
93
|
+
}), className),
|
|
94
|
+
...props,
|
|
95
|
+
children: [
|
|
96
|
+
resolvedIcon && /*#__PURE__*/ _jsx("span", {
|
|
97
|
+
"data-slot": "alert-icon",
|
|
98
|
+
className: alertIconVariants(),
|
|
99
|
+
children: resolvedIcon
|
|
100
|
+
}),
|
|
101
|
+
children,
|
|
102
|
+
onClose && /*#__PURE__*/ _jsx(AlertClose, {})
|
|
103
|
+
]
|
|
104
|
+
})
|
|
105
|
+
});
|
|
84
106
|
});
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
107
|
+
Alert.displayName = 'Alert';
|
|
108
|
+
const alertTitleVariants = {
|
|
109
|
+
default: 'text-foreground',
|
|
110
|
+
info: 'text-foreground',
|
|
111
|
+
warning: 'text-foreground',
|
|
112
|
+
error: 'text-foreground'
|
|
113
|
+
};
|
|
114
|
+
const AlertTitle = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>{
|
|
115
|
+
const { variant, alertStyle } = useContext(AlertContext);
|
|
116
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
117
|
+
ref: ref,
|
|
118
|
+
"data-slot": "alert-title",
|
|
119
|
+
className: cn(alertStyle === 'strip' ? 'text-sm font-medium leading-[18px] tracking-normal' : 'col-start-2 text-base font-medium leading-5 tracking-tighter', alertTitleVariants[variant], className),
|
|
120
|
+
...props
|
|
121
|
+
});
|
|
99
122
|
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
123
|
+
AlertTitle.displayName = 'AlertTitle';
|
|
124
|
+
const alertDescriptionVariants = {
|
|
125
|
+
default: 'text-secondary-foreground',
|
|
126
|
+
info: 'text-secondary-foreground',
|
|
127
|
+
warning: 'text-secondary-foreground',
|
|
128
|
+
error: 'text-secondary-foreground'
|
|
129
|
+
};
|
|
130
|
+
const AlertDescription = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>{
|
|
131
|
+
const { variant, alertStyle } = useContext(AlertContext);
|
|
132
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
133
|
+
ref: ref,
|
|
134
|
+
"data-slot": "alert-description",
|
|
135
|
+
className: cn(alertStyle === 'strip' ? 'flex-1 min-w-0 pr-4 text-sm font-normal leading-[18px] tracking-tight' : 'col-start-2 text-sm font-normal leading-[18px] tracking-tight', alertDescriptionVariants[variant], className),
|
|
136
|
+
...props
|
|
137
|
+
});
|
|
114
138
|
});
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
139
|
+
AlertDescription.displayName = 'AlertDescription';
|
|
140
|
+
const AlertActions = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>{
|
|
141
|
+
const { alertStyle } = useContext(AlertContext);
|
|
142
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
143
|
+
ref: ref,
|
|
144
|
+
"data-slot": "alert-actions",
|
|
145
|
+
className: cn(alertStyle === 'strip' ? 'ml-auto flex shrink-0 items-center gap-3' : 'col-start-2 flex flex-wrap items-center gap-3 pt-2', className),
|
|
146
|
+
...props
|
|
147
|
+
});
|
|
124
148
|
});
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
149
|
+
AlertActions.displayName = 'AlertActions';
|
|
150
|
+
const alertButtonStyles = {
|
|
151
|
+
default: 'gap-2 rounded-md',
|
|
152
|
+
ghost: 'h-auto p-0 hover:bg-transparent'
|
|
153
|
+
};
|
|
154
|
+
const AlertButton = /*#__PURE__*/ forwardRef(({ className, variant = 'default', ...props }, ref)=>/*#__PURE__*/ _jsx(Button, {
|
|
155
|
+
ref: ref,
|
|
156
|
+
"data-slot": "alert-button",
|
|
157
|
+
variant: variant === 'ghost' ? 'ghost' : undefined,
|
|
158
|
+
size: "sm",
|
|
159
|
+
className: cn(alertButtonStyles[variant], className),
|
|
160
|
+
...props
|
|
161
|
+
}));
|
|
162
|
+
AlertButton.displayName = 'AlertButton';
|
|
163
|
+
const AlertClose = /*#__PURE__*/ forwardRef(({ className, onClick, ...props }, ref)=>{
|
|
164
|
+
const { setShow, alertStyle } = useContext(AlertContext);
|
|
165
|
+
const closeLabel = props['aria-label'] ?? 'Close alert';
|
|
166
|
+
const handleClick = (e)=>{
|
|
167
|
+
setShow(false);
|
|
168
|
+
onClick?.(e);
|
|
169
|
+
};
|
|
170
|
+
return /*#__PURE__*/ _jsx(Button, {
|
|
171
|
+
ref: ref,
|
|
172
|
+
"data-slot": "alert-close",
|
|
173
|
+
variant: "ghost",
|
|
174
|
+
size: "sm",
|
|
175
|
+
className: cn('shrink-0 size-7 rounded-md p-0 text-secondary-foreground hover:bg-transparent hover:text-foreground', alertStyle === 'card' && 'absolute right-2 top-2', className),
|
|
176
|
+
"aria-label": closeLabel,
|
|
177
|
+
onClick: handleClick,
|
|
178
|
+
...props,
|
|
179
|
+
children: /*#__PURE__*/ _jsx(IconX, {
|
|
180
|
+
"aria-hidden": "true",
|
|
181
|
+
className: "size-4"
|
|
182
|
+
})
|
|
183
|
+
});
|
|
156
184
|
});
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
185
|
+
AlertClose.displayName = 'AlertClose';
|
|
186
|
+
export { Alert, AlertTitle, AlertDescription, AlertActions, AlertButton, AlertClose };
|
|
187
|
+
|
|
188
|
+
//# sourceMappingURL=alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/alert/alert.tsx"],"sourcesContent":["import {\n type ForwardRefExoticComponent,\n type RefAttributes,\n type ComponentProps,\n type ComponentRef,\n type MouseEventHandler,\n type ReactNode,\n createContext,\n forwardRef,\n useContext,\n useMemo,\n} from 'react';\n\nimport {\n IconAlertCircleFilled,\n IconAlertTriangleFilled,\n IconInfoCircleFilled,\n IconX,\n} from '@tabler/icons-react';\nimport { type VariantProps, cva } from 'class-variance-authority';\nimport type { ClassProp } from 'class-variance-authority/types';\n\nimport { useControllableState } from '../../../../lib/use-controllable-state';\nimport { cn } from '../../../../lib/utils';\nimport { Button } from '../button/button';\n\ntype AlertVariant = 'default' | 'info' | 'warning' | 'error';\n/** @deprecated Use `'info'` instead. Will be removed in a future major release. */\ntype DeprecatedAlertVariant = 'secondary';\ntype AlertVariantInput = AlertVariant | DeprecatedAlertVariant;\ntype AlertStyle = 'card' | 'strip';\n\ntype AlertContextProps = {\n show: boolean;\n setShow: (show: boolean) => void;\n variant: AlertVariant;\n alertStyle: AlertStyle;\n};\n\nconst AlertContext = createContext<AlertContextProps>({\n show: true,\n setShow: () => {\n void 0; /* noop - default context fallback */\n },\n variant: 'default',\n alertStyle: 'card',\n});\n\nconst alertIconVariants = cva(\n [\n '[&_svg]:shrink-0',\n \"[&_svg:not([class*='size-']):not([class*='w-'])]:w-4\",\n \"[&_svg:not([class*='size-']):not([class*='h-'])]:h-4\",\n ].join(' ')\n);\n\ninterface AlertVariantProps {\n variant?: 'default' | 'error' | 'info' | 'warning' | null;\n alertStyle?: 'card' | 'strip' | null;\n}\n\nconst alertVariants: (\n props?: (AlertVariantProps & ClassProp) | undefined\n) => string = cva(\n 'relative w-full rounded-md pt-2.5 pr-3 has-[>button[data-slot=alert-close]]:pr-12 pb-2 pl-3 text-sm grid has-[>[data-slot=alert-icon]]:grid-cols-[auto_1fr] grid-cols-[0_1fr] has-[>[data-slot=alert-icon]]:gap-x-2 has-[>[data-slot=alert-icon]]:gap-y-1 items-start',\n {\n variants: {\n variant: {\n default:\n 'bg-neutral-muted-background text-foreground [&>[data-slot=alert-icon]]:text-muted-foreground',\n info: 'bg-info-muted-background text-foreground [&>[data-slot=alert-icon]]:text-info-foreground',\n warning:\n 'bg-warning-muted-background [&>[data-slot=alert-icon]]:text-warning-foreground',\n error:\n 'bg-destructive-muted-background text-foreground [&>[data-slot=alert-icon]]:text-destructive-foreground',\n },\n alertStyle: {\n card: 'pt-3 pr-5 pb-3 pl-3 [&>[data-slot=alert-title]+[data-slot=alert-description]]:mt-2 [&>[data-slot=alert-icon]]:mt-0.5',\n strip:\n 'flex min-h-11 items-center gap-2 py-2 pr-3 pl-3 [&>[data-slot=alert-title]]:hidden',\n },\n },\n defaultVariants: {\n variant: 'default',\n alertStyle: 'card',\n },\n }\n);\n\ntype AlertProps = ComponentProps<'div'> &\n Omit<VariantProps<typeof alertVariants>, 'variant'> & {\n variant?: AlertVariantInput;\n alertStyle?: AlertStyle;\n visible?: boolean;\n defaultVisible?: boolean;\n onClose?: () => void;\n icon?: ReactNode;\n };\n\nfunction getDefaultAlertIcon(variant: AlertVariant) {\n const iconProps = { 'aria-hidden': true };\n\n switch (variant) {\n case 'warning':\n return <IconAlertTriangleFilled {...iconProps} />;\n case 'error':\n return <IconAlertCircleFilled {...iconProps} />;\n case 'info':\n case 'default':\n default:\n return <IconInfoCircleFilled {...iconProps} />;\n }\n}\n\nconst Alert: ForwardRefExoticComponent<\n Omit<AlertProps, 'ref'> & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<'div'>, AlertProps>(\n (\n {\n className,\n variant = 'default',\n alertStyle = 'card',\n visible,\n defaultVisible = true,\n onClose,\n icon,\n children,\n ...props\n },\n ref\n ) => {\n const [show, setShow] = useControllableState({\n defaultProp: defaultVisible,\n prop: visible,\n onChange: onClose,\n });\n const alertVariant: AlertVariant =\n variant === 'secondary' ? 'info' : (variant ?? 'default');\n\n const contextValue = useMemo(() => {\n return { show, setShow, variant: alertVariant, alertStyle };\n }, [show, setShow, alertVariant, alertStyle]);\n\n if (!show) {\n return null;\n }\n\n const resolvedIcon =\n icon !== undefined ? icon : getDefaultAlertIcon(alertVariant);\n\n return (\n <AlertContext.Provider value={contextValue}>\n <div\n ref={ref}\n data-slot=\"alert\"\n role=\"alert\"\n className={cn(\n alertVariants({ variant: alertVariant, alertStyle }),\n className\n )}\n {...props}\n >\n {resolvedIcon && (\n <span data-slot=\"alert-icon\" className={alertIconVariants()}>\n {resolvedIcon}\n </span>\n )}\n {children}\n {onClose && <AlertClose />}\n </div>\n </AlertContext.Provider>\n );\n }\n);\nAlert.displayName = 'Alert';\n\nconst alertTitleVariants: Record<AlertVariant, string> = {\n default: 'text-foreground',\n info: 'text-foreground',\n warning: 'text-foreground',\n error: 'text-foreground',\n};\n\nconst AlertTitle: ForwardRefExoticComponent<\n ComponentProps<'div'> & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<'div'>, ComponentProps<'div'>>(\n ({ className, ...props }, ref) => {\n const { variant, alertStyle } = useContext(AlertContext);\n return (\n <div\n ref={ref}\n data-slot=\"alert-title\"\n className={cn(\n alertStyle === 'strip'\n ? 'text-sm font-medium leading-[18px] tracking-normal'\n : 'col-start-2 text-base font-medium leading-5 tracking-tighter',\n alertTitleVariants[variant],\n className\n )}\n {...props}\n />\n );\n }\n);\nAlertTitle.displayName = 'AlertTitle';\n\nconst alertDescriptionVariants: Record<AlertVariant, string> = {\n default: 'text-secondary-foreground',\n info: 'text-secondary-foreground',\n warning: 'text-secondary-foreground',\n error: 'text-secondary-foreground',\n};\n\nconst AlertDescription: ForwardRefExoticComponent<\n ComponentProps<'div'> & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<'div'>, ComponentProps<'div'>>(\n ({ className, ...props }, ref) => {\n const { variant, alertStyle } = useContext(AlertContext);\n return (\n <div\n ref={ref}\n data-slot=\"alert-description\"\n className={cn(\n alertStyle === 'strip'\n ? 'flex-1 min-w-0 pr-4 text-sm font-normal leading-[18px] tracking-tight'\n : 'col-start-2 text-sm font-normal leading-[18px] tracking-tight',\n alertDescriptionVariants[variant],\n className\n )}\n {...props}\n />\n );\n }\n);\nAlertDescription.displayName = 'AlertDescription';\n\nconst AlertActions: ForwardRefExoticComponent<\n ComponentProps<'div'> & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<'div'>, ComponentProps<'div'>>(\n ({ className, ...props }, ref) => {\n const { alertStyle } = useContext(AlertContext);\n return (\n <div\n ref={ref}\n data-slot=\"alert-actions\"\n className={cn(\n alertStyle === 'strip'\n ? 'ml-auto flex shrink-0 items-center gap-3'\n : 'col-start-2 flex flex-wrap items-center gap-3 pt-2',\n className\n )}\n {...props}\n />\n );\n }\n);\nAlertActions.displayName = 'AlertActions';\n\ntype AlertButtonVariant = 'default' | 'ghost';\n\nconst alertButtonStyles: Record<AlertButtonVariant, string> = {\n default: 'gap-2 rounded-md',\n ghost: 'h-auto p-0 hover:bg-transparent',\n};\n\nconst AlertButton: ForwardRefExoticComponent<\n Omit<\n ComponentProps<'button'> & {\n variant?: AlertButtonVariant;\n },\n 'ref'\n > &\n RefAttributes<HTMLButtonElement>\n> = forwardRef<\n ComponentRef<'button'>,\n ComponentProps<'button'> & { variant?: AlertButtonVariant }\n>(({ className, variant = 'default', ...props }, ref) => (\n <Button\n ref={ref}\n data-slot=\"alert-button\"\n variant={variant === 'ghost' ? 'ghost' : undefined}\n size=\"sm\"\n className={cn(alertButtonStyles[variant], className)}\n {...props}\n />\n));\nAlertButton.displayName = 'AlertButton';\n\nconst AlertClose: ForwardRefExoticComponent<\n ComponentProps<'button'> & RefAttributes<HTMLButtonElement>\n> = forwardRef<ComponentRef<'button'>, ComponentProps<'button'>>(\n ({ className, onClick, ...props }, ref) => {\n const { setShow, alertStyle } = useContext(AlertContext);\n const closeLabel = props['aria-label'] ?? 'Close alert';\n\n const handleClick: MouseEventHandler<HTMLButtonElement> = (e) => {\n setShow(false);\n onClick?.(e);\n };\n\n return (\n <Button\n ref={ref}\n data-slot=\"alert-close\"\n variant=\"ghost\"\n size=\"sm\"\n className={cn(\n 'shrink-0 size-7 rounded-md p-0 text-secondary-foreground hover:bg-transparent hover:text-foreground',\n alertStyle === 'card' && 'absolute right-2 top-2',\n className\n )}\n aria-label={closeLabel}\n onClick={handleClick}\n {...props}\n >\n <IconX aria-hidden=\"true\" className=\"size-4\" />\n </Button>\n );\n }\n);\nAlertClose.displayName = 'AlertClose';\n\nexport {\n Alert,\n AlertTitle,\n AlertDescription,\n AlertActions,\n AlertButton,\n AlertClose,\n};\n"],"names":["createContext","forwardRef","useContext","useMemo","IconAlertCircleFilled","IconAlertTriangleFilled","IconInfoCircleFilled","IconX","cva","useControllableState","cn","Button","AlertContext","show","setShow","variant","alertStyle","alertIconVariants","join","alertVariants","variants","default","info","warning","error","card","strip","defaultVariants","getDefaultAlertIcon","iconProps","Alert","className","visible","defaultVisible","onClose","icon","children","props","ref","defaultProp","prop","onChange","alertVariant","contextValue","resolvedIcon","undefined","Provider","value","div","data-slot","role","span","AlertClose","displayName","alertTitleVariants","AlertTitle","alertDescriptionVariants","AlertDescription","AlertActions","alertButtonStyles","ghost","AlertButton","size","onClick","closeLabel","handleClick","e","aria-label","aria-hidden"],"mappings":"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"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { ForwardRefExoticComponent, RefAttributes, HTMLAttributes } from
|
|
2
|
-
import { AvatarFallbackProps, AvatarImageProps, AvatarRootProps } from
|
|
3
|
-
import { VariantProps } from
|
|
4
|
-
import { ClassProp } from
|
|
1
|
+
import { type ForwardRefExoticComponent, type RefAttributes, type HTMLAttributes } from "react";
|
|
2
|
+
import type { AvatarFallbackProps, AvatarImageProps, AvatarRootProps } from "@base-ui/react/avatar";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
import type { ClassProp } from "class-variance-authority/types";
|
|
5
|
+
import { type DecorativeVariantProp } from "../../../../lib/decorative-variant-classes";
|
|
5
6
|
interface AvatarVariantProps {
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
variant?: DecorativeVariantProp | "default" | "overflow" | null;
|
|
8
|
+
sizes?: "default" | "xsm" | "xxsm" | null;
|
|
8
9
|
}
|
|
9
10
|
declare const avatarVariants: (props?: (AvatarVariantProps & ClassProp) | undefined) => string;
|
|
10
|
-
declare const Avatar: ForwardRefExoticComponent<Omit<AvatarRootProps & VariantProps<typeof avatarVariants>,
|
|
11
|
-
declare const AvatarImage: ForwardRefExoticComponent<Omit<AvatarImageProps,
|
|
12
|
-
declare const AvatarFallback: ForwardRefExoticComponent<Omit<AvatarFallbackProps,
|
|
11
|
+
declare const Avatar: ForwardRefExoticComponent<Omit<AvatarRootProps & VariantProps<typeof avatarVariants>, "ref"> & RefAttributes<HTMLSpanElement>>;
|
|
12
|
+
declare const AvatarImage: ForwardRefExoticComponent<Omit<AvatarImageProps, "ref"> & RefAttributes<HTMLImageElement>>;
|
|
13
|
+
declare const AvatarFallback: ForwardRefExoticComponent<Omit<AvatarFallbackProps, "ref"> & RefAttributes<HTMLSpanElement>>;
|
|
13
14
|
declare const AvatarIcon: ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & RefAttributes<HTMLSpanElement>>;
|
|
14
15
|
export { Avatar, AvatarImage, AvatarFallback, AvatarIcon };
|
|
@@ -1,65 +1,75 @@
|
|
|
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
|
-
|
|
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
|
-
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { decorativeAvatarVariantClasses, legacyDecorativeAvatarVariantClasses } from "../../../../lib/decorative-variant-classes.js";
|
|
6
|
+
import { cn } from "../../../../lib/utils.js";
|
|
7
|
+
const avatarVariants = cva('group/avatar relative inline-flex text-base font-medium leading-5 shrink-0 overflow-hidden flex-col justify-center items-center box-border', {
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
...decorativeAvatarVariantClasses,
|
|
11
|
+
...legacyDecorativeAvatarVariantClasses,
|
|
12
|
+
overflow: 'bg-secondary-background text-secondary-foreground hover:bg-secondary-background-hover'
|
|
13
|
+
},
|
|
14
|
+
sizes: {
|
|
15
|
+
default: 'size-9 rounded-lg text-sm [&_svg]:w-5 [&_svg]:h-5',
|
|
16
|
+
xsm: 'size-7 rounded-md text-xs [&_svg]:w-4 [&_svg]:h-4',
|
|
17
|
+
xxsm: 'size-5 rounded-sm text-2xs [&_svg]:w-3 [&_svg]:h-3'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
variant: 'decorative-1',
|
|
22
|
+
sizes: 'default'
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const Avatar = /*#__PURE__*/ forwardRef(({ className, variant, sizes, ...props }, ref)=>{
|
|
26
|
+
return /*#__PURE__*/ _jsx(AvatarPrimitive.Root, {
|
|
27
|
+
ref: ref,
|
|
28
|
+
"data-slot": "avatar",
|
|
29
|
+
className: cn(avatarVariants({
|
|
30
|
+
variant,
|
|
31
|
+
sizes
|
|
32
|
+
}), className),
|
|
33
|
+
...props
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
Avatar.displayName = 'Avatar';
|
|
37
|
+
const AvatarImage = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>{
|
|
38
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
39
|
+
children: [
|
|
40
|
+
/*#__PURE__*/ _jsx(AvatarPrimitive.Image, {
|
|
41
|
+
ref: ref,
|
|
42
|
+
"data-slot": "avatar-image",
|
|
43
|
+
className: cn('aspect-square size-full object-cover object-center', className),
|
|
44
|
+
...props
|
|
45
|
+
}),
|
|
46
|
+
/*#__PURE__*/ _jsx("span", {
|
|
47
|
+
"data-slot": "avatar-image-backdrop",
|
|
48
|
+
className: "absolute inset-0 bg-base-background-overlay opacity-0 transition-opacity group-hover/avatar:opacity-100 pointer-events-none",
|
|
49
|
+
"aria-hidden": "true"
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
AvatarImage.displayName = 'AvatarImage';
|
|
55
|
+
const AvatarFallback = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>{
|
|
56
|
+
return /*#__PURE__*/ _jsx(AvatarPrimitive.Fallback, {
|
|
57
|
+
ref: ref,
|
|
58
|
+
"data-slot": "avatar-fallback",
|
|
59
|
+
className: cn(' flex size-full items-center justify-center', className),
|
|
60
|
+
...props
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
AvatarFallback.displayName = 'AvatarFallback';
|
|
64
|
+
const AvatarIcon = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>{
|
|
65
|
+
return /*#__PURE__*/ _jsx("span", {
|
|
66
|
+
ref: ref,
|
|
67
|
+
"data-slot": "avatar-icon",
|
|
68
|
+
className: cn('flex size-full items-center justify-center', className),
|
|
69
|
+
...props
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
AvatarIcon.displayName = 'AvatarIcon';
|
|
73
|
+
export { Avatar, AvatarImage, AvatarFallback, AvatarIcon };
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/avatar/avatar.tsx"],"sourcesContent":["import {\n type ForwardRefExoticComponent,\n type RefAttributes,\n type ComponentProps,\n type ComponentRef,\n type HTMLAttributes,\n forwardRef,\n} from 'react';\n\nimport type {\n AvatarFallbackProps,\n AvatarImageProps,\n AvatarRootProps,\n} from '@base-ui/react/avatar';\nimport { Avatar as AvatarPrimitive } from '@base-ui/react/avatar';\nimport { type VariantProps, cva } from 'class-variance-authority';\nimport type { ClassProp } from 'class-variance-authority/types';\n\nimport {\n decorativeAvatarVariantClasses,\n legacyDecorativeAvatarVariantClasses,\n type DecorativeVariantProp,\n} from '../../../../lib/decorative-variant-classes';\nimport { cn } from '../../../../lib/utils';\n\ninterface AvatarVariantProps {\n variant?: DecorativeVariantProp | 'default' | 'overflow' | null;\n sizes?: 'default' | 'xsm' | 'xxsm' | null;\n}\n\nconst avatarVariants: (\n props?: (AvatarVariantProps & ClassProp) | undefined\n) => string = cva(\n 'group/avatar relative inline-flex text-base font-medium leading-5 shrink-0 overflow-hidden flex-col justify-center items-center box-border',\n {\n variants: {\n variant: {\n ...decorativeAvatarVariantClasses,\n ...legacyDecorativeAvatarVariantClasses,\n overflow:\n 'bg-secondary-background text-secondary-foreground hover:bg-secondary-background-hover',\n },\n sizes: {\n default: 'size-9 rounded-lg text-sm [&_svg]:w-5 [&_svg]:h-5',\n xsm: 'size-7 rounded-md text-xs [&_svg]:w-4 [&_svg]:h-4',\n xxsm: 'size-5 rounded-sm text-2xs [&_svg]:w-3 [&_svg]:h-3',\n },\n },\n defaultVariants: {\n variant: 'decorative-1',\n sizes: 'default',\n },\n }\n);\n\nconst Avatar: ForwardRefExoticComponent<\n Omit<AvatarRootProps & VariantProps<typeof avatarVariants>, 'ref'> &\n RefAttributes<HTMLSpanElement>\n> = forwardRef<\n ComponentRef<typeof AvatarPrimitive.Root>,\n ComponentProps<typeof AvatarPrimitive.Root> &\n VariantProps<typeof avatarVariants>\n>(({ className, variant, sizes, ...props }, ref) => {\n return (\n <AvatarPrimitive.Root\n ref={ref}\n data-slot=\"avatar\"\n className={cn(avatarVariants({ variant, sizes }), className)}\n {...props}\n />\n );\n});\nAvatar.displayName = 'Avatar';\n\nconst AvatarImage: ForwardRefExoticComponent<\n Omit<AvatarImageProps, 'ref'> & RefAttributes<HTMLImageElement>\n> = forwardRef<\n ComponentRef<typeof AvatarPrimitive.Image>,\n ComponentProps<typeof AvatarPrimitive.Image>\n>(({ className, ...props }, ref) => {\n return (\n <>\n <AvatarPrimitive.Image\n ref={ref}\n data-slot=\"avatar-image\"\n className={cn(\n 'aspect-square size-full object-cover object-center',\n className\n )}\n {...props}\n />\n <span\n data-slot=\"avatar-image-backdrop\"\n className=\"absolute inset-0 bg-base-background-overlay opacity-0 transition-opacity group-hover/avatar:opacity-100 pointer-events-none\"\n aria-hidden=\"true\"\n />\n </>\n );\n});\nAvatarImage.displayName = 'AvatarImage';\n\nconst AvatarFallback: ForwardRefExoticComponent<\n Omit<AvatarFallbackProps, 'ref'> & RefAttributes<HTMLSpanElement>\n> = forwardRef<\n ComponentRef<typeof AvatarPrimitive.Fallback>,\n ComponentProps<typeof AvatarPrimitive.Fallback>\n>(({ className, ...props }, ref) => {\n return (\n <AvatarPrimitive.Fallback\n ref={ref}\n data-slot=\"avatar-fallback\"\n className={cn(' flex size-full items-center justify-center', className)}\n {...props}\n />\n );\n});\nAvatarFallback.displayName = 'AvatarFallback';\n\nconst AvatarIcon: ForwardRefExoticComponent<\n HTMLAttributes<HTMLSpanElement> & RefAttributes<HTMLSpanElement>\n> = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(\n ({ className, ...props }, ref) => {\n return (\n <span\n ref={ref}\n data-slot=\"avatar-icon\"\n className={cn('flex size-full items-center justify-center', className)}\n {...props}\n />\n );\n }\n);\nAvatarIcon.displayName = 'AvatarIcon';\n\nexport { Avatar, AvatarImage, AvatarFallback, AvatarIcon };\n"],"names":["forwardRef","Avatar","AvatarPrimitive","cva","decorativeAvatarVariantClasses","legacyDecorativeAvatarVariantClasses","cn","avatarVariants","variants","variant","overflow","sizes","default","xsm","xxsm","defaultVariants","className","props","ref","Root","data-slot","displayName","AvatarImage","Image","span","aria-hidden","AvatarFallback","Fallback","AvatarIcon"],"mappings":";AAAA,SAMEA,UAAU,QACL,QAAQ;AAOf,SAASC,UAAUC,eAAe,QAAQ,wBAAwB;AAClE,SAA4BC,GAAG,QAAQ,2BAA2B;AAGlE,SACEC,8BAA8B,EAC9BC,oCAAoC,QAE/B,gDAA6C;AACpD,SAASC,EAAE,QAAQ,2BAAwB;AAO3C,MAAMC,iBAEQJ,IACZ,8IACA;IACEK,UAAU;QACRC,SAAS;YACP,GAAGL,8BAA8B;YACjC,GAAGC,oCAAoC;YACvCK,UACE;QACJ;QACAC,OAAO;YACLC,SAAS;YACTC,KAAK;YACLC,MAAM;QACR;IACF;IACAC,iBAAiB;QACfN,SAAS;QACTE,OAAO;IACT;AACF;AAGF,MAAMV,uBAGFD,WAIF,CAAC,EAAEgB,SAAS,EAAEP,OAAO,EAAEE,KAAK,EAAE,GAAGM,OAAO,EAAEC;IAC1C,qBACE,KAAChB,gBAAgBiB,IAAI;QACnBD,KAAKA;QACLE,aAAU;QACVJ,WAAWV,GAAGC,eAAe;YAAEE;YAASE;QAAM,IAAIK;QACjD,GAAGC,KAAK;;AAGf;AACAhB,OAAOoB,WAAW,GAAG;AAErB,MAAMC,4BAEFtB,WAGF,CAAC,EAAEgB,SAAS,EAAE,GAAGC,OAAO,EAAEC;IAC1B,qBACE;;0BACE,KAAChB,gBAAgBqB,KAAK;gBACpBL,KAAKA;gBACLE,aAAU;gBACVJ,WAAWV,GACT,sDACAU;gBAED,GAAGC,KAAK;;0BAEX,KAACO;gBACCJ,aAAU;gBACVJ,WAAU;gBACVS,eAAY;;;;AAIpB;AACAH,YAAYD,WAAW,GAAG;AAE1B,MAAMK,+BAEF1B,WAGF,CAAC,EAAEgB,SAAS,EAAE,GAAGC,OAAO,EAAEC;IAC1B,qBACE,KAAChB,gBAAgByB,QAAQ;QACvBT,KAAKA;QACLE,aAAU;QACVJ,WAAWV,GAAG,+CAA+CU;QAC5D,GAAGC,KAAK;;AAGf;AACAS,eAAeL,WAAW,GAAG;AAE7B,MAAMO,2BAEF5B,WACF,CAAC,EAAEgB,SAAS,EAAE,GAAGC,OAAO,EAAEC;IACxB,qBACE,KAACM;QACCN,KAAKA;QACLE,aAAU;QACVJ,WAAWV,GAAG,8CAA8CU;QAC3D,GAAGC,KAAK;;AAGf;AAEFW,WAAWP,WAAW,GAAG;AAEzB,SAASpB,MAAM,EAAEqB,WAAW,EAAEI,cAAc,EAAEE,UAAU,GAAG"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { ForwardRefExoticComponent, RefAttributes } from
|
|
2
|
-
import { useRender } from
|
|
3
|
-
import { VariantProps } from
|
|
4
|
-
import { ClassProp } from
|
|
1
|
+
import type { ForwardRefExoticComponent, RefAttributes } from "react";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
import type { ClassProp } from "class-variance-authority/types";
|
|
5
|
+
import { type DecorativeVariantProp } from "../../../../lib/decorative-variant-classes";
|
|
5
6
|
interface BadgeVariantProps {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
variant?: DecorativeVariantProp | "secondary" | "error" | "warning" | "success" | "inProgress" | "archived" | "closable" | null;
|
|
8
|
+
size?: "default" | "icon" | null;
|
|
9
|
+
outline?: boolean | null;
|
|
10
|
+
background?: boolean | null;
|
|
11
|
+
dot?: boolean | null;
|
|
11
12
|
}
|
|
12
13
|
declare const badgeVariants: (props?: (BadgeVariantProps & ClassProp) | undefined) => string;
|
|
13
|
-
type BadgeProps = useRender.ComponentProps<
|
|
14
|
-
|
|
14
|
+
type BadgeProps = useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
|
|
15
|
+
urgent?: boolean;
|
|
15
16
|
};
|
|
16
|
-
declare const Badge: ForwardRefExoticComponent<Omit<BadgeProps,
|
|
17
|
+
declare const Badge: ForwardRefExoticComponent<Omit<BadgeProps, "ref"> & RefAttributes<HTMLSpanElement>>;
|
|
17
18
|
export { Badge, badgeVariants };
|