@seekalfred/primitives 0.5.1 → 0.7.1
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/README.md +682 -19
- package/dist/accordion/accordion.js +10 -4
- package/dist/accordion/accordion.js.map +1 -1
- package/dist/action-button/action-button.d.ts +50 -0
- package/dist/action-button/action-button.js +159 -0
- package/dist/action-button/action-button.js.map +1 -0
- package/dist/action-button/index.d.ts +2 -0
- package/dist/action-button/index.js +2 -0
- package/dist/activity-heatmap/activity-heatmap.d.ts +92 -0
- package/dist/activity-heatmap/activity-heatmap.js +699 -0
- package/dist/activity-heatmap/activity-heatmap.js.map +1 -0
- package/dist/activity-heatmap/index.d.ts +2 -0
- package/dist/activity-heatmap/index.js +2 -0
- package/dist/alert/alert.d.ts +19 -1
- package/dist/alert/alert.js +180 -23
- package/dist/alert/alert.js.map +1 -1
- package/dist/alert-dialog/alert-dialog.d.ts +45 -18
- package/dist/alert-dialog/alert-dialog.js +128 -9
- package/dist/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/alert-dialog/index.d.ts +2 -2
- package/dist/alert-dialog/index.js +2 -2
- package/dist/animated-counter/animated-counter.d.ts +38 -0
- package/dist/animated-counter/animated-counter.js +230 -0
- package/dist/animated-counter/animated-counter.js.map +1 -0
- package/dist/animated-counter/index.d.ts +2 -0
- package/dist/animated-counter/index.js +2 -0
- package/dist/announcement-bar/announcement-bar.d.ts +67 -0
- package/dist/announcement-bar/announcement-bar.js +364 -0
- package/dist/announcement-bar/announcement-bar.js.map +1 -0
- package/dist/announcement-bar/index.d.ts +2 -0
- package/dist/announcement-bar/index.js +2 -0
- package/dist/avatar/avatar.d.ts +6 -0
- package/dist/avatar/avatar.js +47 -16
- package/dist/avatar/avatar.js.map +1 -1
- package/dist/badge/badge.d.ts +10 -3
- package/dist/badge/badge.js +35 -5
- package/dist/badge/badge.js.map +1 -1
- package/dist/bar-chart/bar-chart.d.ts +51 -0
- package/dist/bar-chart/bar-chart.js +565 -0
- package/dist/bar-chart/bar-chart.js.map +1 -0
- package/dist/bar-chart/index.d.ts +2 -0
- package/dist/bar-chart/index.js +2 -0
- package/dist/breadcrumb/breadcrumb.d.ts +2 -29
- package/dist/breadcrumb/breadcrumb.js +32 -9
- package/dist/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/brush-chart/brush-chart.d.ts +64 -0
- package/dist/brush-chart/brush-chart.js +1056 -0
- package/dist/brush-chart/brush-chart.js.map +1 -0
- package/dist/brush-chart/index.d.ts +2 -0
- package/dist/brush-chart/index.js +2 -0
- package/dist/button/button.d.ts +36 -23
- package/dist/button/button.js +198 -45
- package/dist/button/button.js.map +1 -1
- package/dist/button-group/button-group.d.ts +76 -0
- package/dist/button-group/button-group.js +402 -0
- package/dist/button-group/button-group.js.map +1 -0
- package/dist/button-group/index.d.ts +2 -0
- package/dist/button-group/index.js +2 -0
- package/dist/calendar/calendar.d.ts +1 -1
- package/dist/calendar/calendar.js +257 -30
- package/dist/calendar/calendar.js.map +1 -1
- package/dist/card/card.d.ts +9 -2
- package/dist/card/card.js +16 -5
- package/dist/card/card.js.map +1 -1
- package/dist/card-stack/card-stack.d.ts +54 -0
- package/dist/card-stack/card-stack.js +492 -0
- package/dist/card-stack/card-stack.js.map +1 -0
- package/dist/card-stack/index.d.ts +2 -0
- package/dist/card-stack/index.js +2 -0
- package/dist/carousel/carousel.d.ts +56 -0
- package/dist/carousel/carousel.js +389 -0
- package/dist/carousel/carousel.js.map +1 -0
- package/dist/carousel/index.d.ts +2 -0
- package/dist/carousel/index.js +2 -0
- package/dist/checkbox/checkbox.d.ts +0 -7
- package/dist/checkbox/checkbox.js +26 -29
- package/dist/checkbox/checkbox.js.map +1 -1
- package/dist/chip-group/chip-group.d.ts +37 -0
- package/dist/chip-group/chip-group.js +148 -0
- package/dist/chip-group/chip-group.js.map +1 -0
- package/dist/chip-group/index.d.ts +2 -0
- package/dist/chip-group/index.js +2 -0
- package/dist/confirm-morph/confirm-morph.d.ts +85 -0
- package/dist/confirm-morph/confirm-morph.js +652 -0
- package/dist/confirm-morph/confirm-morph.js.map +1 -0
- package/dist/confirm-morph/index.d.ts +2 -0
- package/dist/confirm-morph/index.js +2 -0
- package/dist/copy-button/copy-button.d.ts +32 -0
- package/dist/copy-button/copy-button.js +134 -0
- package/dist/copy-button/copy-button.js.map +1 -0
- package/dist/copy-button/index.d.ts +2 -0
- package/dist/copy-button/index.js +2 -0
- package/dist/countdown/countdown.d.ts +45 -0
- package/dist/countdown/countdown.js +298 -0
- package/dist/countdown/countdown.js.map +1 -0
- package/dist/countdown/index.d.ts +2 -0
- package/dist/countdown/index.js +2 -0
- package/dist/date-picker/date-picker.d.ts +51 -0
- package/dist/date-picker/date-picker.js +241 -0
- package/dist/date-picker/date-picker.js.map +1 -0
- package/dist/date-picker/date-range-picker.d.ts +78 -0
- package/dist/date-picker/date-range-picker.js +1015 -0
- package/dist/date-picker/date-range-picker.js.map +1 -0
- package/dist/date-picker/index.d.ts +4 -0
- package/dist/date-picker/index.js +4 -0
- package/dist/date-picker/picker-parts.d.ts +46 -0
- package/dist/date-picker/picker-parts.js +135 -0
- package/dist/date-picker/picker-parts.js.map +1 -0
- package/dist/dialog/dialog.d.ts +10 -14
- package/dist/dialog/dialog.js +40 -12
- package/dist/dialog/dialog.js.map +1 -1
- package/dist/donut-chart/donut-chart.d.ts +64 -0
- package/dist/donut-chart/donut-chart.js +576 -0
- package/dist/donut-chart/donut-chart.js.map +1 -0
- package/dist/donut-chart/index.d.ts +2 -0
- package/dist/donut-chart/index.js +2 -0
- package/dist/empty-state/empty-state.d.ts +55 -0
- package/dist/empty-state/empty-state.js +89 -0
- package/dist/empty-state/empty-state.js.map +1 -0
- package/dist/empty-state/index.d.ts +2 -0
- package/dist/empty-state/index.js +2 -0
- package/dist/expanding-button-group/expanding-button-group.d.ts +54 -0
- package/dist/expanding-button-group/expanding-button-group.js +350 -0
- package/dist/expanding-button-group/expanding-button-group.js.map +1 -0
- package/dist/expanding-button-group/index.d.ts +2 -0
- package/dist/expanding-button-group/index.js +2 -0
- package/dist/file-drop-zone/file-drop-zone.d.ts +71 -0
- package/dist/file-drop-zone/file-drop-zone.js +116 -0
- package/dist/file-drop-zone/file-drop-zone.js.map +1 -0
- package/dist/file-drop-zone/index.d.ts +2 -0
- package/dist/file-drop-zone/index.js +2 -0
- package/dist/filter-bar/filter-bar.d.ts +142 -0
- package/dist/filter-bar/filter-bar.js +416 -0
- package/dist/filter-bar/filter-bar.js.map +1 -0
- package/dist/filter-bar/index.d.ts +2 -0
- package/dist/filter-bar/index.js +2 -0
- package/dist/floating-button-group/floating-button-group.d.ts +61 -0
- package/dist/floating-button-group/floating-button-group.js +340 -0
- package/dist/floating-button-group/floating-button-group.js.map +1 -0
- package/dist/floating-button-group/index.d.ts +2 -0
- package/dist/floating-button-group/index.js +2 -0
- package/dist/gauge/gauge.d.ts +45 -0
- package/dist/gauge/gauge.js +219 -0
- package/dist/gauge/gauge.js.map +1 -0
- package/dist/gauge/index.d.ts +2 -0
- package/dist/gauge/index.js +2 -0
- package/dist/icon-morph/icon-morph.d.ts +55 -0
- package/dist/icon-morph/icon-morph.js +331 -0
- package/dist/icon-morph/icon-morph.js.map +1 -0
- package/dist/icon-morph/index.d.ts +2 -0
- package/dist/icon-morph/index.js +2 -0
- package/dist/in-view-title/in-view-title.d.ts +33 -0
- package/dist/in-view-title/in-view-title.js +119 -0
- package/dist/in-view-title/in-view-title.js.map +1 -0
- package/dist/in-view-title/index.d.ts +2 -0
- package/dist/in-view-title/index.js +2 -0
- package/dist/index.d.ts +71 -6
- package/dist/index.js +73 -11
- package/dist/input/input.d.ts +22 -0
- package/dist/input/input.js +36 -12
- package/dist/input/input.js.map +1 -1
- package/dist/lib/cn.js +11 -1
- package/dist/lib/cn.js.map +1 -1
- package/dist/lib/count-to.js +113 -0
- package/dist/lib/count-to.js.map +1 -0
- package/dist/lib/eye-morph.js +62 -0
- package/dist/lib/eye-morph.js.map +1 -0
- package/dist/lib/field-message.js +354 -0
- package/dist/lib/field-message.js.map +1 -0
- package/dist/lib/field-shell.js +81 -0
- package/dist/lib/field-shell.js.map +1 -0
- package/dist/lib/field-surface.js +11 -8
- package/dist/lib/field-surface.js.map +1 -1
- package/dist/lib/flag-emoji.js +50 -0
- package/dist/lib/flag-emoji.js.map +1 -0
- package/dist/lib/flip.js +88 -0
- package/dist/lib/flip.js.map +1 -0
- package/dist/lib/height-follow.js +59 -0
- package/dist/lib/height-follow.js.map +1 -0
- package/dist/lib/icon-swap.js +47 -0
- package/dist/lib/icon-swap.js.map +1 -0
- package/dist/lib/leaving-list.js +57 -0
- package/dist/lib/leaving-list.js.map +1 -0
- package/dist/lib/menu-highlight.js +64 -0
- package/dist/lib/menu-highlight.js.map +1 -0
- package/dist/lib/merge-refs.js +3 -3
- package/dist/lib/merge-refs.js.map +1 -1
- package/dist/lib/morph-text.js +128 -0
- package/dist/lib/morph-text.js.map +1 -0
- package/dist/lib/motion.js +169 -0
- package/dist/lib/motion.js.map +1 -0
- package/dist/lib/pausable-timeout.js +67 -0
- package/dist/lib/pausable-timeout.js.map +1 -0
- package/dist/lib/rolling-value.js +31 -0
- package/dist/lib/rolling-value.js.map +1 -0
- package/dist/lib/spring-progress.js +114 -0
- package/dist/lib/spring-progress.js.map +1 -0
- package/dist/lib/spring-tween.js +500 -0
- package/dist/lib/spring-tween.js.map +1 -0
- package/dist/lib/svg-id.js +10 -0
- package/dist/lib/svg-id.js.map +1 -0
- package/dist/lib/swap-text.js +79 -0
- package/dist/lib/swap-text.js.map +1 -0
- package/dist/lib/use-copy-feedback.js +36 -0
- package/dist/lib/use-copy-feedback.js.map +1 -0
- package/dist/line-chart/index.d.ts +2 -0
- package/dist/line-chart/index.js +2 -0
- package/dist/line-chart/line-chart.d.ts +76 -0
- package/dist/line-chart/line-chart.js +611 -0
- package/dist/line-chart/line-chart.js.map +1 -0
- package/dist/mention-input/index.d.ts +2 -0
- package/dist/mention-input/index.js +2 -0
- package/dist/mention-input/mention-input.d.ts +98 -0
- package/dist/mention-input/mention-input.js +576 -0
- package/dist/mention-input/mention-input.js.map +1 -0
- package/dist/menu/menu.d.ts +2 -0
- package/dist/menu/menu.js +23 -12
- package/dist/menu/menu.js.map +1 -1
- package/dist/money-input/index.d.ts +2 -0
- package/dist/money-input/index.js +2 -0
- package/dist/money-input/money-input.d.ts +65 -0
- package/dist/money-input/money-input.js +607 -0
- package/dist/money-input/money-input.js.map +1 -0
- package/dist/morph-select/index.d.ts +2 -0
- package/dist/morph-select/index.js +2 -0
- package/dist/morph-select/morph-select.d.ts +71 -0
- package/dist/morph-select/morph-select.js +693 -0
- package/dist/morph-select/morph-select.js.map +1 -0
- package/dist/multi-select/index.d.ts +2 -0
- package/dist/multi-select/index.js +2 -0
- package/dist/multi-select/multi-select.d.ts +36 -0
- package/dist/multi-select/multi-select.js +152 -0
- package/dist/multi-select/multi-select.js.map +1 -0
- package/dist/number-field/index.d.ts +2 -0
- package/dist/number-field/index.js +2 -0
- package/dist/number-field/number-field.d.ts +42 -0
- package/dist/number-field/number-field.js +199 -0
- package/dist/number-field/number-field.js.map +1 -0
- package/dist/onboarding-checklist/index.d.ts +2 -0
- package/dist/onboarding-checklist/index.js +2 -0
- package/dist/onboarding-checklist/onboarding-checklist.d.ts +55 -0
- package/dist/onboarding-checklist/onboarding-checklist.js +577 -0
- package/dist/onboarding-checklist/onboarding-checklist.js.map +1 -0
- package/dist/page-header/index.d.ts +2 -0
- package/dist/page-header/index.js +2 -0
- package/dist/page-header/page-header.d.ts +75 -0
- package/dist/page-header/page-header.js +83 -0
- package/dist/page-header/page-header.js.map +1 -0
- package/dist/password-field/index.d.ts +2 -0
- package/dist/password-field/index.js +2 -0
- package/dist/password-field/password-field.d.ts +37 -0
- package/dist/password-field/password-field.js +101 -0
- package/dist/password-field/password-field.js.map +1 -0
- package/dist/password-strength/index.d.ts +2 -0
- package/dist/password-strength/index.js +2 -0
- package/dist/password-strength/password-strength.d.ts +127 -0
- package/dist/password-strength/password-strength.js +455 -0
- package/dist/password-strength/password-strength.js.map +1 -0
- package/dist/phone-input/index.d.ts +3 -0
- package/dist/phone-input/index.js +3 -0
- package/dist/phone-input/phone-countries.d.ts +29 -0
- package/dist/phone-input/phone-countries.js +170 -0
- package/dist/phone-input/phone-countries.js.map +1 -0
- package/dist/phone-input/phone-input.d.ts +66 -0
- package/dist/phone-input/phone-input.js +440 -0
- package/dist/phone-input/phone-input.js.map +1 -0
- package/dist/popover/popover.d.ts +20 -0
- package/dist/popover/popover.js +33 -9
- package/dist/popover/popover.js.map +1 -1
- package/dist/progress/progress.js +46 -5
- package/dist/progress/progress.js.map +1 -1
- package/dist/radio-group/radio-group.js +8 -7
- package/dist/radio-group/radio-group.js.map +1 -1
- package/dist/reactions/index.d.ts +2 -0
- package/dist/reactions/index.js +2 -0
- package/dist/reactions/reactions.d.ts +50 -0
- package/dist/reactions/reactions.js +315 -0
- package/dist/reactions/reactions.js.map +1 -0
- package/dist/rich-text-editor/index.d.ts +3 -0
- package/dist/rich-text-editor/index.js +2 -0
- package/dist/rich-text-editor/rich-text-editor.d.ts +70 -0
- package/dist/rich-text-editor/rich-text-editor.js +909 -0
- package/dist/rich-text-editor/rich-text-editor.js.map +1 -0
- package/dist/rich-text-editor/rich-text-engine.d.ts +16 -0
- package/dist/rich-text-editor/rich-text-engine.js +366 -0
- package/dist/rich-text-editor/rich-text-engine.js.map +1 -0
- package/dist/rich-text-editor/rich-text-html.js +174 -0
- package/dist/rich-text-editor/rich-text-html.js.map +1 -0
- package/dist/rich-text-editor/rich-text-icons.js +43 -0
- package/dist/rich-text-editor/rich-text-icons.js.map +1 -0
- package/dist/ridgeline/index.d.ts +2 -0
- package/dist/ridgeline/index.js +2 -0
- package/dist/ridgeline/ridgeline.d.ts +55 -0
- package/dist/ridgeline/ridgeline.js +701 -0
- package/dist/ridgeline/ridgeline.js.map +1 -0
- package/dist/scroll-area/index.d.ts +2 -2
- package/dist/scroll-area/index.js +2 -2
- package/dist/scroll-area/scroll-area.d.ts +75 -28
- package/dist/scroll-area/scroll-area.js +212 -41
- package/dist/scroll-area/scroll-area.js.map +1 -1
- package/dist/scrub-input/evaluate.d.ts +14 -0
- package/dist/scrub-input/evaluate.js +72 -0
- package/dist/scrub-input/evaluate.js.map +1 -0
- package/dist/scrub-input/index.d.ts +3 -0
- package/dist/scrub-input/index.js +3 -0
- package/dist/scrub-input/scrub-input.d.ts +74 -0
- package/dist/scrub-input/scrub-input.js +486 -0
- package/dist/scrub-input/scrub-input.js.map +1 -0
- package/dist/search-field/index.d.ts +2 -0
- package/dist/search-field/index.js +2 -0
- package/dist/search-field/search-field.d.ts +27 -0
- package/dist/search-field/search-field.js +155 -0
- package/dist/search-field/search-field.js.map +1 -0
- package/dist/select/select.d.ts +3 -1
- package/dist/select/select.js +95 -25
- package/dist/select/select.js.map +1 -1
- package/dist/separator/separator.d.ts +1 -1
- package/dist/sheet/sheet.js +4 -2
- package/dist/sheet/sheet.js.map +1 -1
- package/dist/shortcut-recorder/index.d.ts +3 -0
- package/dist/shortcut-recorder/index.js +3 -0
- package/dist/shortcut-recorder/shortcut-model.d.ts +27 -0
- package/dist/shortcut-recorder/shortcut-model.js +206 -0
- package/dist/shortcut-recorder/shortcut-model.js.map +1 -0
- package/dist/shortcut-recorder/shortcut-recorder.d.ts +93 -0
- package/dist/shortcut-recorder/shortcut-recorder.js +489 -0
- package/dist/shortcut-recorder/shortcut-recorder.js.map +1 -0
- package/dist/side-nav/index.d.ts +2 -0
- package/dist/side-nav/index.js +2 -0
- package/dist/side-nav/side-nav.d.ts +72 -0
- package/dist/side-nav/side-nav.js +142 -0
- package/dist/side-nav/side-nav.js.map +1 -0
- package/dist/skeleton/skeleton.d.ts +8 -2
- package/dist/skeleton/skeleton.js +6 -2
- package/dist/skeleton/skeleton.js.map +1 -1
- package/dist/slider/index.d.ts +2 -2
- package/dist/slider/slider.d.ts +46 -14
- package/dist/slider/slider.js +188 -50
- package/dist/slider/slider.js.map +1 -1
- package/dist/slope-chart/index.d.ts +2 -0
- package/dist/slope-chart/index.js +2 -0
- package/dist/slope-chart/slope-chart.d.ts +54 -0
- package/dist/slope-chart/slope-chart.js +568 -0
- package/dist/slope-chart/slope-chart.js.map +1 -0
- package/dist/sparkline/index.d.ts +2 -0
- package/dist/sparkline/index.js +2 -0
- package/dist/sparkline/sparkline.d.ts +46 -0
- package/dist/sparkline/sparkline.js +390 -0
- package/dist/sparkline/sparkline.js.map +1 -0
- package/dist/split-bar/index.d.ts +2 -0
- package/dist/split-bar/index.js +2 -0
- package/dist/split-bar/split-bar.d.ts +62 -0
- package/dist/split-bar/split-bar.js +513 -0
- package/dist/split-bar/split-bar.js.map +1 -0
- package/dist/split-button/index.d.ts +2 -0
- package/dist/split-button/index.js +2 -0
- package/dist/split-button/split-button.d.ts +46 -0
- package/dist/split-button/split-button.js +123 -0
- package/dist/split-button/split-button.js.map +1 -0
- package/dist/stat-card/index.d.ts +2 -0
- package/dist/stat-card/index.js +2 -0
- package/dist/stat-card/stat-card.d.ts +101 -0
- package/dist/stat-card/stat-card.js +249 -0
- package/dist/stat-card/stat-card.js.map +1 -0
- package/dist/stepper/index.d.ts +2 -0
- package/dist/stepper/index.js +2 -0
- package/dist/stepper/stepper.d.ts +51 -0
- package/dist/stepper/stepper.js +215 -0
- package/dist/stepper/stepper.js.map +1 -0
- package/dist/streamgraph/index.d.ts +2 -0
- package/dist/streamgraph/index.js +2 -0
- package/dist/streamgraph/streamgraph.d.ts +70 -0
- package/dist/streamgraph/streamgraph.js +613 -0
- package/dist/streamgraph/streamgraph.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/swipe-actions/index.d.ts +2 -0
- package/dist/swipe-actions/index.js +2 -0
- package/dist/swipe-actions/swipe-actions.d.ts +67 -0
- package/dist/swipe-actions/swipe-actions.js +552 -0
- package/dist/swipe-actions/swipe-actions.js.map +1 -0
- package/dist/switch/switch.js +10 -9
- package/dist/switch/switch.js.map +1 -1
- package/dist/table/index.d.ts +2 -2
- package/dist/table/index.js +2 -2
- package/dist/table/table.d.ts +87 -4
- package/dist/table/table.js +441 -165
- package/dist/table/table.js.map +1 -1
- package/dist/tabs/tabs.js +143 -7
- package/dist/tabs/tabs.js.map +1 -1
- package/dist/tag-input/index.d.ts +2 -0
- package/dist/tag-input/index.js +2 -0
- package/dist/tag-input/tag-input.d.ts +40 -0
- package/dist/tag-input/tag-input.js +269 -0
- package/dist/tag-input/tag-input.js.map +1 -0
- package/dist/text-morph/index.d.ts +2 -0
- package/dist/text-morph/index.js +2 -0
- package/dist/text-morph/text-morph.d.ts +23 -0
- package/dist/text-morph/text-morph.js +21 -0
- package/dist/text-morph/text-morph.js.map +1 -0
- package/dist/text-reveal/index.d.ts +2 -0
- package/dist/text-reveal/index.js +2 -0
- package/dist/text-reveal/text-reveal.d.ts +27 -0
- package/dist/text-reveal/text-reveal.js +51 -0
- package/dist/text-reveal/text-reveal.js.map +1 -0
- package/dist/text-shimmer/index.d.ts +2 -0
- package/dist/text-shimmer/index.js +2 -0
- package/dist/text-shimmer/text-shimmer.d.ts +29 -0
- package/dist/text-shimmer/text-shimmer.js +29 -0
- package/dist/text-shimmer/text-shimmer.js.map +1 -0
- package/dist/textarea/textarea.d.ts +23 -0
- package/dist/textarea/textarea.js +24 -2
- package/dist/textarea/textarea.js.map +1 -1
- package/dist/theme-switch/index.d.ts +2 -0
- package/dist/theme-switch/index.js +2 -0
- package/dist/theme-switch/theme-switch.d.ts +37 -0
- package/dist/theme-switch/theme-switch.js +123 -0
- package/dist/theme-switch/theme-switch.js.map +1 -0
- package/dist/time-picker/index.d.ts +2 -0
- package/dist/time-picker/index.js +2 -0
- package/dist/time-picker/time-picker.d.ts +54 -0
- package/dist/time-picker/time-picker.js +201 -0
- package/dist/time-picker/time-picker.js.map +1 -0
- package/dist/toast/index.d.ts +2 -2
- package/dist/toast/index.js +2 -2
- package/dist/toast/toast.d.ts +6 -0
- package/dist/toast/toast.js +98 -36
- package/dist/toast/toast.js.map +1 -1
- package/dist/tooltip/tooltip.d.ts +10 -3
- package/dist/tooltip/tooltip.js +67 -18
- package/dist/tooltip/tooltip.js.map +1 -1
- package/dist/treemap/index.d.ts +2 -0
- package/dist/treemap/index.js +2 -0
- package/dist/treemap/treemap.d.ts +53 -0
- package/dist/treemap/treemap.js +699 -0
- package/dist/treemap/treemap.js.map +1 -0
- package/dist/usage-meter/index.d.ts +2 -0
- package/dist/usage-meter/index.js +2 -0
- package/dist/usage-meter/usage-meter.d.ts +50 -0
- package/dist/usage-meter/usage-meter.js +440 -0
- package/dist/usage-meter/usage-meter.js.map +1 -0
- package/dist/waffle-chart/index.d.ts +2 -0
- package/dist/waffle-chart/index.js +2 -0
- package/dist/waffle-chart/waffle-chart.d.ts +57 -0
- package/dist/waffle-chart/waffle-chart.js +426 -0
- package/dist/waffle-chart/waffle-chart.js.map +1 -0
- package/package.json +245 -3
package/dist/table/table.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn, cnAll } from "../lib/cn.js";
|
|
3
3
|
import { Button as Button$1 } from "../button/button.js";
|
|
4
|
+
import { SwapText } from "../lib/swap-text.js";
|
|
5
|
+
import { useFlip } from "../lib/flip.js";
|
|
6
|
+
import { Checkbox as Checkbox$1 } from "../checkbox/checkbox.js";
|
|
4
7
|
import { Select as Select$1, SelectItem } from "../select/select.js";
|
|
5
8
|
import { cva } from "class-variance-authority";
|
|
6
|
-
import { forwardRef, useMemo, useState } from "react";
|
|
9
|
+
import { forwardRef, useEffect, useMemo, useRef, useState } from "react";
|
|
7
10
|
import { Cell, Column, Row, Table, TableBody, TableFooter, TableHeader } from "react-aria-components";
|
|
8
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { flushSync } from "react-dom";
|
|
9
13
|
//#region src/table/table.tsx
|
|
10
14
|
/**
|
|
11
15
|
* Table, ported from the legacy shadcn table onto React Aria's Table.
|
|
@@ -58,10 +62,29 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
58
62
|
*
|
|
59
63
|
* overflow-hidden is load-bearing: the header fill runs to the table's edge and
|
|
60
64
|
* would square off the rounded corners without it.
|
|
65
|
+
*
|
|
66
|
+
* THE EDGE SHADOWS. A table wider than its card scrolls inside it, and on a
|
|
67
|
+
* trackpad the scrollbar only shows while scrolling, so a cut-off column looks
|
|
68
|
+
* like the table's last one. The card carries `data-overflow-start` and
|
|
69
|
+
* `data-overflow-end` while columns are hidden on that side (the Table sets
|
|
70
|
+
* them from its scroll position), and each draws a shadow on that edge: the
|
|
71
|
+
* text colour fading to nothing at 15%, so it follows the theme. With a sticky
|
|
72
|
+
* first column the start is never hidden behind the card's edge, so the start
|
|
73
|
+
* shadow stays off and the sticky column's own divider does that job.
|
|
61
74
|
*/
|
|
62
|
-
const tableCardVariants = cva([
|
|
75
|
+
const tableCardVariants = cva([
|
|
76
|
+
"w-full box-border overflow-hidden relative isolate",
|
|
77
|
+
"before:pointer-events-none before:absolute before:inset-y-0 before:start-0 before:z-2 before:w-6",
|
|
78
|
+
"before:bg-linear-to-r rtl:before:bg-linear-to-l before:from-foreground before:to-transparent",
|
|
79
|
+
"before:opacity-0 motion-safe:before:transition-opacity",
|
|
80
|
+
"data-[overflow-start]:not-data-[sticky-first]:before:opacity-15",
|
|
81
|
+
"after:pointer-events-none after:absolute after:inset-y-0 after:end-0 after:z-2 after:w-6",
|
|
82
|
+
"after:bg-linear-to-l rtl:after:bg-linear-to-r after:from-foreground after:to-transparent",
|
|
83
|
+
"after:opacity-0 motion-safe:after:transition-opacity",
|
|
84
|
+
"data-[overflow-end]:after:opacity-15"
|
|
85
|
+
], {
|
|
63
86
|
variants: { frame: {
|
|
64
|
-
card: "rounded-
|
|
87
|
+
card: "rounded-panel border-(length:--border-width) border-separator bg-surface",
|
|
65
88
|
none: ""
|
|
66
89
|
} },
|
|
67
90
|
defaultVariants: { frame: "card" }
|
|
@@ -85,12 +108,16 @@ function renderValue(column, value, row) {
|
|
|
85
108
|
/** Reserved id for the chevron column, so it cannot collide with a real one. */
|
|
86
109
|
const CHEVRON_COLUMN_ID = "__table_row_action";
|
|
87
110
|
const CHEVRON_CELL = "w-10 px-0 text-center";
|
|
111
|
+
/** Reserved id for the checkbox column of a selectable table. */
|
|
112
|
+
const SELECT_COLUMN_ID = "__table_row_select";
|
|
113
|
+
/** The checkbox column is as wide as its box needs, with the table's usual inset on its leading side. */
|
|
114
|
+
const SELECT_CELL = "w-11 px-0 ps-(--density-row-pad-x)";
|
|
88
115
|
/** The horizontal scroll container. The table owns it; 5 of 6 consumers built one by hand. */
|
|
89
116
|
const tableScrollVariants = cva(["w-full overflow-x-auto box-border"]);
|
|
90
117
|
const tableVariants = cva([
|
|
91
118
|
"w-full border-collapse box-border",
|
|
92
119
|
"font-sans text-base leading-(--leading-normal)",
|
|
93
|
-
"bg-
|
|
120
|
+
"bg-surface text-foreground"
|
|
94
121
|
]);
|
|
95
122
|
/**
|
|
96
123
|
* The header is near-white, not a grey band.
|
|
@@ -116,8 +143,24 @@ const tablePaginationVariants = cva([
|
|
|
116
143
|
"px-(--density-row-pad-x) py-(--density-row-pad-y)",
|
|
117
144
|
"font-sans text-sm leading-(--leading-normal) text-muted-foreground"
|
|
118
145
|
]);
|
|
146
|
+
/**
|
|
147
|
+
* The bar under a selectable table: how many rows, or how many are selected,
|
|
148
|
+
* and the action that clears them. A sibling of the table, like the pagination.
|
|
149
|
+
*/
|
|
150
|
+
const tableSelectionBarVariants = cva([
|
|
151
|
+
"flex min-h-11 items-center justify-between gap-(--density-control-gap) box-border",
|
|
152
|
+
"border-t-(length:--border-width) border-t-separator",
|
|
153
|
+
"ps-(--density-row-pad-x) pe-2 font-sans text-sm leading-(--leading-normal)",
|
|
154
|
+
"text-muted-foreground data-[active]:text-foreground",
|
|
155
|
+
"motion-safe:transition-colors motion-safe:duration-(--duration-standard) motion-safe:ease-settle"
|
|
156
|
+
]);
|
|
157
|
+
/**
|
|
158
|
+
* What stands in for the rows when there are none: centred, muted, and tall
|
|
159
|
+
* enough to read as a state rather than as a squashed row.
|
|
160
|
+
*/
|
|
161
|
+
const tableEmptyVariants = cva(["flex min-h-30 items-center justify-center px-(--density-row-pad-x) py-6", "box-border text-center text-sm text-muted-foreground wrap-anywhere"]);
|
|
119
162
|
/** The footer band. Heavier than a row rule, because it closes the table. */
|
|
120
|
-
const tableFooterVariants = cva(["bg-
|
|
163
|
+
const tableFooterVariants = cva(["bg-surface font-semibold text-foreground", "border-t-(length:--border-width) border-t-border"]);
|
|
121
164
|
/** Shared focus treatment. Authored once; both the column header and the row take it. */
|
|
122
165
|
const FOCUS_RING = [
|
|
123
166
|
"outline-none",
|
|
@@ -129,6 +172,7 @@ const FOCUS_RING = [
|
|
|
129
172
|
const tableColumnVariants = cva([
|
|
130
173
|
"px-(--density-row-pad-x) py-(--density-row-pad-y)",
|
|
131
174
|
"box-border align-middle text-sm font-semibold select-none",
|
|
175
|
+
"data-[sorted]:bg-foreground/3 data-[sorted]:text-foreground",
|
|
132
176
|
...FOCUS_RING,
|
|
133
177
|
"data-[allows-sorting]:cursor-pointer"
|
|
134
178
|
], {
|
|
@@ -149,9 +193,10 @@ const tableColumnVariants = cva([
|
|
|
149
193
|
}
|
|
150
194
|
});
|
|
151
195
|
const tableRowVariants = cva([
|
|
152
|
-
"box-border",
|
|
196
|
+
"group/row box-border bg-surface",
|
|
153
197
|
"motion-safe:transition-colors motion-safe:duration-(--duration-fast) motion-safe:ease-standard",
|
|
154
198
|
"hover:bg-muted data-[hovered]:bg-muted data-[focused]:bg-muted",
|
|
199
|
+
"data-[selected]:bg-muted data-[selected]:hover:bg-separator data-[selected]:data-[hovered]:bg-separator",
|
|
155
200
|
"data-[highlighted]:bg-primary-subtle",
|
|
156
201
|
...FOCUS_RING
|
|
157
202
|
], {
|
|
@@ -172,7 +217,8 @@ const tableRowVariants = cva([
|
|
|
172
217
|
});
|
|
173
218
|
const tableCellVariants = cva([
|
|
174
219
|
"px-(--density-row-pad-x) py-(--density-row-pad-y)",
|
|
175
|
-
"box-border align-middle",
|
|
220
|
+
"box-border align-middle wrap-anywhere",
|
|
221
|
+
"data-[sorted]:bg-foreground/3",
|
|
176
222
|
...FOCUS_RING
|
|
177
223
|
], {
|
|
178
224
|
variants: {
|
|
@@ -182,7 +228,7 @@ const tableCellVariants = cva([
|
|
|
182
228
|
end: "text-end"
|
|
183
229
|
},
|
|
184
230
|
numeric: {
|
|
185
|
-
true: "tabular-nums",
|
|
231
|
+
true: "tabular-nums whitespace-nowrap",
|
|
186
232
|
false: ""
|
|
187
233
|
}
|
|
188
234
|
},
|
|
@@ -192,6 +238,78 @@ const tableCellVariants = cva([
|
|
|
192
238
|
}
|
|
193
239
|
});
|
|
194
240
|
/**
|
|
241
|
+
* The first cell of every row, held in place while the rest scroll under it
|
|
242
|
+
* (`stickyFirstColumn`).
|
|
243
|
+
*
|
|
244
|
+
* A sticky cell is opaque -- otherwise the scrolled cells show through it -- so
|
|
245
|
+
* it repaints whatever fill its row has: the row's hover, focus and highlight
|
|
246
|
+
* through `group/row`, the stripe when striped. A divider on its trailing edge
|
|
247
|
+
* marks where the frozen column ends.
|
|
248
|
+
*/
|
|
249
|
+
const tableStickyCellVariants = cva(["sticky start-0 z-1", "border-e-(length:--border-width) border-e-separator"], {
|
|
250
|
+
variants: {
|
|
251
|
+
part: {
|
|
252
|
+
header: "bg-header-fill",
|
|
253
|
+
bare: "bg-surface",
|
|
254
|
+
body: [
|
|
255
|
+
"bg-surface",
|
|
256
|
+
"group-hover/row:bg-muted group-data-[hovered]/row:bg-muted group-data-[focused]/row:bg-muted",
|
|
257
|
+
"group-data-[highlighted]/row:bg-primary-subtle"
|
|
258
|
+
]
|
|
259
|
+
},
|
|
260
|
+
striped: {
|
|
261
|
+
true: "",
|
|
262
|
+
false: ""
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
compoundVariants: [{
|
|
266
|
+
part: "body",
|
|
267
|
+
striped: true,
|
|
268
|
+
class: "group-even/row:bg-row-stripe"
|
|
269
|
+
}],
|
|
270
|
+
defaultVariants: {
|
|
271
|
+
part: "body",
|
|
272
|
+
striped: false
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
/**
|
|
276
|
+
* Which sides of a scroll container hide content right now.
|
|
277
|
+
*
|
|
278
|
+
* Read from the container on scroll and whenever it or the table resizes, so
|
|
279
|
+
* a window resize or rows arriving later update it too. scrollLeft runs
|
|
280
|
+
* negative in a right-to-left layout; the distance travelled is what counts.
|
|
281
|
+
*/
|
|
282
|
+
function useScrollEdges(scroller) {
|
|
283
|
+
const [edges, setEdges] = useState({
|
|
284
|
+
start: false,
|
|
285
|
+
end: false
|
|
286
|
+
});
|
|
287
|
+
useEffect(() => {
|
|
288
|
+
const el = scroller.current;
|
|
289
|
+
if (!el) return;
|
|
290
|
+
const update = () => {
|
|
291
|
+
const hidden = el.scrollWidth - el.clientWidth;
|
|
292
|
+
const travelled = Math.abs(el.scrollLeft);
|
|
293
|
+
const start = hidden > 1 && travelled > 1;
|
|
294
|
+
const end = hidden > 1 && travelled < hidden - 1;
|
|
295
|
+
setEdges((prev) => prev.start === start && prev.end === end ? prev : {
|
|
296
|
+
start,
|
|
297
|
+
end
|
|
298
|
+
});
|
|
299
|
+
};
|
|
300
|
+
update();
|
|
301
|
+
el.addEventListener("scroll", update, { passive: true });
|
|
302
|
+
const resize = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(update);
|
|
303
|
+
resize?.observe(el);
|
|
304
|
+
if (el.firstElementChild) resize?.observe(el.firstElementChild);
|
|
305
|
+
return () => {
|
|
306
|
+
el.removeEventListener("scroll", update);
|
|
307
|
+
resize?.disconnect();
|
|
308
|
+
};
|
|
309
|
+
}, [scroller]);
|
|
310
|
+
return edges;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
195
313
|
* Both glyphs are aria-hidden and neither is focusable.
|
|
196
314
|
*
|
|
197
315
|
* The chevron says "this row does something"; the ROW is what React Aria makes
|
|
@@ -258,7 +376,7 @@ function RowChevronGlyph() {
|
|
|
258
376
|
});
|
|
259
377
|
}
|
|
260
378
|
function SortCaretGlyph({ direction }) {
|
|
261
|
-
return /* @__PURE__ */
|
|
379
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
262
380
|
"data-slot": "table-sort-caret",
|
|
263
381
|
"data-direction": direction,
|
|
264
382
|
"aria-hidden": "true",
|
|
@@ -268,8 +386,67 @@ function SortCaretGlyph({ direction }) {
|
|
|
268
386
|
strokeWidth: "1.5",
|
|
269
387
|
strokeLinecap: "round",
|
|
270
388
|
strokeLinejoin: "round",
|
|
271
|
-
className: "size-(--icon-sm) ms-1 inline-block align-middle",
|
|
272
|
-
children:
|
|
389
|
+
className: "table-sort-caret size-(--icon-sm) ms-1 inline-block align-middle",
|
|
390
|
+
children: [/* @__PURE__ */ jsxs("g", {
|
|
391
|
+
className: "table-sort-idle",
|
|
392
|
+
children: [/* @__PURE__ */ jsx("path", { d: "m4 7 4-4 4 4" }), /* @__PURE__ */ jsx("path", { d: "m4 9 4 4 4-4" })]
|
|
393
|
+
}), /* @__PURE__ */ jsxs("g", {
|
|
394
|
+
className: "table-sort-arrow",
|
|
395
|
+
children: [/* @__PURE__ */ jsx("path", { d: "M8 13V3" }), /* @__PURE__ */ jsx("path", { d: "m4.5 6.5 3.5-3.5 3.5 3.5" })]
|
|
396
|
+
})]
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
/** 1 when the value grew, -1 when it shrank: the way a changed number swaps. Updated during render. */
|
|
400
|
+
function useChangeDirection(value) {
|
|
401
|
+
const [seen, setSeen] = useState({
|
|
402
|
+
value,
|
|
403
|
+
dir: 1
|
|
404
|
+
});
|
|
405
|
+
if (seen.value !== value) setSeen({
|
|
406
|
+
value,
|
|
407
|
+
dir: value < seen.value ? -1 : 1
|
|
408
|
+
});
|
|
409
|
+
return seen.dir;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* The bar under a selectable table. With nothing chosen it counts the rows
|
|
413
|
+
* ("12 rows"); with some chosen it counts them ("3 selected") and offers the
|
|
414
|
+
* way back. The number and the word swap in place as they change.
|
|
415
|
+
*/
|
|
416
|
+
function SelectionBar({ count, total, labels, onClear }) {
|
|
417
|
+
const shown = count || total;
|
|
418
|
+
const noun = count ? labels.selected : shown === 1 ? labels.item.one : labels.item.other;
|
|
419
|
+
const direction = useChangeDirection(shown);
|
|
420
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
421
|
+
"data-slot": "table-selection-bar",
|
|
422
|
+
"data-active": count > 0 || void 0,
|
|
423
|
+
className: cnAll(tableSelectionBarVariants()),
|
|
424
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
425
|
+
"data-slot": "table-selection-count",
|
|
426
|
+
className: "inline-flex items-baseline gap-1",
|
|
427
|
+
children: [
|
|
428
|
+
/* @__PURE__ */ jsx(SwapText, {
|
|
429
|
+
swapKey: String(shown),
|
|
430
|
+
dir: direction,
|
|
431
|
+
className: "inline-block tabular-nums",
|
|
432
|
+
children: shown
|
|
433
|
+
}),
|
|
434
|
+
" ",
|
|
435
|
+
/* @__PURE__ */ jsx(SwapText, {
|
|
436
|
+
swapKey: noun,
|
|
437
|
+
dir: count ? 1 : -1,
|
|
438
|
+
className: "inline-block",
|
|
439
|
+
children: noun
|
|
440
|
+
})
|
|
441
|
+
]
|
|
442
|
+
}), count > 0 ? /* @__PURE__ */ jsx(Button$1, {
|
|
443
|
+
variant: "ghost",
|
|
444
|
+
size: "sm",
|
|
445
|
+
"data-slot": "table-selection-clear",
|
|
446
|
+
className: "motion-safe:animate-fade-in",
|
|
447
|
+
onPress: onClear,
|
|
448
|
+
children: labels.clear
|
|
449
|
+
}) : null]
|
|
273
450
|
});
|
|
274
451
|
}
|
|
275
452
|
/** Builds columns that keep each column's own value type. */
|
|
@@ -279,9 +456,11 @@ function createColumns() {
|
|
|
279
456
|
/**
|
|
280
457
|
* A data table.
|
|
281
458
|
*
|
|
282
|
-
* Maturity: **beta**.
|
|
283
|
-
*
|
|
284
|
-
*
|
|
459
|
+
* Maturity: **beta**. Row expansion, filtering and grouping are deliberately
|
|
460
|
+
* absent -- each had one consumer or none across the six legacy tables, and the
|
|
461
|
+
* stateful ones belong to DataGrid. Sorting glides: when a sort reorders the
|
|
462
|
+
* rows, each slides to its new place instead of jumping (the lib/flip helper).
|
|
463
|
+
* Selection is opt-in with `selectionMode="multiple"`.
|
|
285
464
|
*
|
|
286
465
|
* @example
|
|
287
466
|
* const { column } = createColumns<Channel>();
|
|
@@ -317,7 +496,7 @@ function compareKeys(a, b) {
|
|
|
317
496
|
if (typeof a === "number" && typeof b === "number") return a - b;
|
|
318
497
|
return String(a).localeCompare(String(b));
|
|
319
498
|
}
|
|
320
|
-
const Table$1 = forwardRef(function Table$2({ data, columns, getRowId, variant, sortDescriptor, defaultSortDescriptor, onSortChange, onRowAction, isRowHighlighted, rowClassName, frame, headerType, headerFill, striped, totalRow, empty, minWidth, pageSize, pageSizeOptions, onPageSizeChange, pageLabels, className, ...props }, ref) {
|
|
499
|
+
const Table$1 = forwardRef(function Table$2({ data, columns, getRowId, variant, sortDescriptor, defaultSortDescriptor, onSortChange, onRowAction, isRowHighlighted, rowClassName, selectionMode, selectedKeys, defaultSelectedKeys, onSelectionChange, selectionLabels, frame, headerType, headerFill, striped, totalRow, empty, minWidth, stickyFirstColumn, pageSize, pageSizeOptions, onPageSizeChange, pageLabels, className, ...props }, ref) {
|
|
321
500
|
const isControlled = sortDescriptor !== void 0;
|
|
322
501
|
const [uncontrolledSort, setUncontrolledSort] = useState(defaultSortDescriptor);
|
|
323
502
|
const activeSort = isControlled ? sortDescriptor : uncontrolledSort;
|
|
@@ -348,167 +527,264 @@ const Table$1 = forwardRef(function Table$2({ data, columns, getRowId, variant,
|
|
|
348
527
|
rowsPerPage: pageLabels?.rowsPerPage ?? "Rows per page"
|
|
349
528
|
};
|
|
350
529
|
const rowsByKey = new Map(data.map((row) => [getRowId(row), row]));
|
|
530
|
+
const selectable = selectionMode === "multiple";
|
|
531
|
+
const [uncontrolledSelection, setUncontrolledSelection] = useState(defaultSelectedKeys ?? /* @__PURE__ */ new Set());
|
|
532
|
+
const selection = selectedKeys ?? uncontrolledSelection;
|
|
533
|
+
const commitSelection = (keys) => {
|
|
534
|
+
if (selectedKeys === void 0) setUncontrolledSelection(keys);
|
|
535
|
+
onSelectionChange?.(keys);
|
|
536
|
+
};
|
|
537
|
+
const selectedCount = selection === "all" ? visibleRows.length : [...selection].filter((key) => rowsByKey.has(key)).length;
|
|
538
|
+
const selectLabels = {
|
|
539
|
+
item: selectionLabels?.item ?? {
|
|
540
|
+
one: "row",
|
|
541
|
+
other: "rows"
|
|
542
|
+
},
|
|
543
|
+
selected: selectionLabels?.selected ?? "selected",
|
|
544
|
+
clear: selectionLabels?.clear ?? "Clear selection"
|
|
545
|
+
};
|
|
546
|
+
const sortedColumn = activeSort?.column;
|
|
351
547
|
const hasWidths = columns.some((column) => column.width !== void 0);
|
|
352
548
|
const tableStyle = {};
|
|
353
549
|
if (minWidth !== void 0) tableStyle.minWidth = minWidth;
|
|
354
550
|
if (hasWidths) tableStyle.tableLayout = "fixed";
|
|
551
|
+
const scrollRef = useRef(null);
|
|
552
|
+
const edges = useScrollEdges(scrollRef);
|
|
553
|
+
const [rowOrder, setRowOrder] = useState("");
|
|
554
|
+
useEffect(() => {
|
|
555
|
+
const root = scrollRef.current;
|
|
556
|
+
if (!root) return;
|
|
557
|
+
let last = "";
|
|
558
|
+
const look = () => {
|
|
559
|
+
const next = Array.from(root.querySelectorAll("tbody > [data-flip]")).map((row) => row.dataset.flip).join("\0");
|
|
560
|
+
if (next === last) return;
|
|
561
|
+
last = next;
|
|
562
|
+
flushSync(() => setRowOrder(next));
|
|
563
|
+
};
|
|
564
|
+
look();
|
|
565
|
+
const observer = new MutationObserver(look);
|
|
566
|
+
observer.observe(root, {
|
|
567
|
+
childList: true,
|
|
568
|
+
subtree: true
|
|
569
|
+
});
|
|
570
|
+
return () => observer.disconnect();
|
|
571
|
+
}, []);
|
|
572
|
+
useFlip(scrollRef, rowOrder, "var(--duration-smooth)", "var(--ease-smooth)", true);
|
|
573
|
+
const stickyCell = (part) => tableStickyCellVariants({
|
|
574
|
+
part,
|
|
575
|
+
striped: part === "body" && !!striped
|
|
576
|
+
});
|
|
355
577
|
return /* @__PURE__ */ jsxs("div", {
|
|
356
578
|
"data-slot": "table-card",
|
|
579
|
+
"data-overflow-start": edges.start || void 0,
|
|
580
|
+
"data-overflow-end": edges.end || void 0,
|
|
581
|
+
"data-sticky-first": stickyFirstColumn || void 0,
|
|
357
582
|
className: cnAll(tableCardVariants({ frame })),
|
|
358
|
-
children: [
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
id: getRowId(row),
|
|
404
|
-
"data-slot": "table-row",
|
|
405
|
-
"data-highlighted": isRowHighlighted?.(row) || void 0,
|
|
406
|
-
className: cn(cnAll(tableRowVariants({
|
|
407
|
-
variant,
|
|
408
|
-
striped
|
|
409
|
-
}), onRowAction && "cursor-pointer"), rowClassName?.(row)),
|
|
410
|
-
children: [columns.map((column) => {
|
|
411
|
-
const value = column.accessor(row);
|
|
412
|
-
return /* @__PURE__ */ jsx(Cell, {
|
|
413
|
-
"data-slot": "table-cell",
|
|
414
|
-
className: cnAll(tableCellVariants({
|
|
583
|
+
children: [
|
|
584
|
+
/* @__PURE__ */ jsx("div", {
|
|
585
|
+
ref: scrollRef,
|
|
586
|
+
"data-slot": "table-scroll",
|
|
587
|
+
className: cnAll(tableScrollVariants()),
|
|
588
|
+
children: /* @__PURE__ */ jsxs(Table, {
|
|
589
|
+
ref,
|
|
590
|
+
...props,
|
|
591
|
+
"data-slot": "table",
|
|
592
|
+
className: cn(tableVariants(), className),
|
|
593
|
+
style: tableStyle,
|
|
594
|
+
selectionMode: selectable ? "multiple" : void 0,
|
|
595
|
+
selectedKeys: selectable ? selection : void 0,
|
|
596
|
+
onSelectionChange: selectable ? commitSelection : void 0,
|
|
597
|
+
sortDescriptor: activeSort,
|
|
598
|
+
onSortChange: (descriptor) => {
|
|
599
|
+
if (!isControlled) setUncontrolledSort(descriptor);
|
|
600
|
+
setPage(1);
|
|
601
|
+
onSortChange?.(descriptor);
|
|
602
|
+
},
|
|
603
|
+
onRowAction: onRowAction ? (key) => {
|
|
604
|
+
const row = rowsByKey.get(key);
|
|
605
|
+
if (row !== void 0) onRowAction(row);
|
|
606
|
+
} : void 0,
|
|
607
|
+
children: [
|
|
608
|
+
/* @__PURE__ */ jsxs(TableHeader, {
|
|
609
|
+
"data-slot": "table-header",
|
|
610
|
+
className: cnAll(tableHeaderVariants({ headerFill })),
|
|
611
|
+
children: [
|
|
612
|
+
selectable ? /* @__PURE__ */ jsx(Column, {
|
|
613
|
+
id: SELECT_COLUMN_ID,
|
|
614
|
+
"data-slot": "table-column",
|
|
615
|
+
className: cnAll(tableColumnVariants({ headerType }), SELECT_CELL, stickyFirstColumn && stickyCell(headerFill === "none" ? "bare" : "header"), stickyFirstColumn && "border-e-0"),
|
|
616
|
+
children: /* @__PURE__ */ jsx(Checkbox$1, {
|
|
617
|
+
slot: "selection",
|
|
618
|
+
"aria-label": selectionLabels?.selectAll
|
|
619
|
+
})
|
|
620
|
+
}) : null,
|
|
621
|
+
columns.map((column) => /* @__PURE__ */ jsxs(Column, {
|
|
622
|
+
id: column.id,
|
|
623
|
+
isRowHeader: column === columns[0],
|
|
624
|
+
allowsSorting: column.sortable,
|
|
625
|
+
"data-slot": "table-column",
|
|
626
|
+
"data-sorted": sortedColumn === column.id || void 0,
|
|
627
|
+
className: cnAll(tableColumnVariants({
|
|
415
628
|
align: column.align ?? (column.numeric ? "end" : void 0),
|
|
416
|
-
|
|
417
|
-
})),
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
children:
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
629
|
+
headerType
|
|
630
|
+
}), stickyFirstColumn && column === columns[0] && stickyCell(headerFill === "none" ? "bare" : "header"), stickyFirstColumn && selectable && column === columns[0] && "start-11"),
|
|
631
|
+
style: column.width === void 0 ? void 0 : { width: column.width },
|
|
632
|
+
children: [column.header, column.sortable ? /* @__PURE__ */ jsx(SortCaretGlyph, { direction: activeSort?.column === column.id ? activeSort.direction : "none" }) : null]
|
|
633
|
+
}, column.id)),
|
|
634
|
+
onRowAction ? /* @__PURE__ */ jsx(Column, {
|
|
635
|
+
id: CHEVRON_COLUMN_ID,
|
|
636
|
+
"data-slot": "table-column",
|
|
637
|
+
className: cnAll(tableColumnVariants({ headerType }), CHEVRON_CELL),
|
|
638
|
+
children: ""
|
|
639
|
+
}) : null
|
|
640
|
+
]
|
|
641
|
+
}),
|
|
642
|
+
/* @__PURE__ */ jsx(TableBody, {
|
|
643
|
+
"data-slot": "table-body",
|
|
644
|
+
renderEmptyState: empty === void 0 ? void 0 : () => /* @__PURE__ */ jsx("div", {
|
|
645
|
+
"data-slot": "table-empty",
|
|
646
|
+
className: cnAll(tableEmptyVariants()),
|
|
647
|
+
children: empty
|
|
648
|
+
}),
|
|
649
|
+
children: visibleRows.map((row, index) => /* @__PURE__ */ jsxs(Row, {
|
|
650
|
+
id: getRowId(row),
|
|
651
|
+
"data-slot": "table-row",
|
|
652
|
+
"data-flip": String(getRowId(row)),
|
|
653
|
+
"data-highlighted": isRowHighlighted?.(row) || void 0,
|
|
654
|
+
className: cn(cnAll(tableRowVariants({
|
|
655
|
+
variant,
|
|
656
|
+
striped
|
|
657
|
+
}), onRowAction && "cursor-pointer"), rowClassName?.(row)),
|
|
658
|
+
children: [
|
|
659
|
+
selectable ? /* @__PURE__ */ jsx(Cell, {
|
|
660
|
+
"data-slot": "table-cell",
|
|
661
|
+
className: cnAll(tableCellVariants(), SELECT_CELL, stickyFirstColumn && stickyCell("body"), stickyFirstColumn && "border-e-0"),
|
|
662
|
+
children: /* @__PURE__ */ jsx(Checkbox$1, {
|
|
663
|
+
slot: "selection",
|
|
664
|
+
"aria-label": selectionLabels?.selectRow
|
|
665
|
+
})
|
|
666
|
+
}) : null,
|
|
667
|
+
columns.map((column) => {
|
|
668
|
+
const value = column.accessor(row);
|
|
669
|
+
return /* @__PURE__ */ jsx(Cell, {
|
|
670
|
+
"data-slot": "table-cell",
|
|
671
|
+
"data-sorted": sortedColumn === column.id || void 0,
|
|
672
|
+
className: cnAll(tableCellVariants({
|
|
673
|
+
align: column.align ?? (column.numeric ? "end" : void 0),
|
|
674
|
+
numeric: column.numeric
|
|
675
|
+
}), stickyFirstColumn && column === columns[0] && stickyCell("body"), stickyFirstColumn && selectable && column === columns[0] && "start-11"),
|
|
676
|
+
children: column.cell ? column.cell({
|
|
677
|
+
value,
|
|
678
|
+
row,
|
|
679
|
+
index
|
|
680
|
+
}) : renderValue(column, value, row)
|
|
681
|
+
}, column.id);
|
|
682
|
+
}),
|
|
683
|
+
onRowAction ? /* @__PURE__ */ jsx(Cell, {
|
|
684
|
+
"data-slot": "table-cell",
|
|
685
|
+
className: cnAll(tableCellVariants(), CHEVRON_CELL),
|
|
686
|
+
children: /* @__PURE__ */ jsx(RowChevronGlyph, {})
|
|
687
|
+
}) : null
|
|
688
|
+
]
|
|
689
|
+
}, String(getRowId(row))))
|
|
690
|
+
}),
|
|
691
|
+
totalRow ? /* @__PURE__ */ jsx(TableFooter, {
|
|
692
|
+
"data-slot": "table-footer",
|
|
693
|
+
className: cnAll(tableFooterVariants()),
|
|
694
|
+
children: /* @__PURE__ */ jsxs(Row, {
|
|
695
|
+
id: "__table_total",
|
|
696
|
+
children: [
|
|
697
|
+
selectable ? /* @__PURE__ */ jsx(Cell, {
|
|
698
|
+
"data-slot": "table-cell",
|
|
699
|
+
className: cnAll(tableCellVariants(), SELECT_CELL, stickyFirstColumn && stickyCell("bare"), stickyFirstColumn && "border-e-0"),
|
|
700
|
+
children: ""
|
|
701
|
+
}) : null,
|
|
702
|
+
columns.map((col) => /* @__PURE__ */ jsx(Cell, {
|
|
703
|
+
"data-slot": "table-cell",
|
|
704
|
+
className: cnAll(tableCellVariants({
|
|
705
|
+
align: col.align ?? (col.numeric ? "end" : void 0),
|
|
706
|
+
numeric: col.numeric
|
|
707
|
+
}), stickyFirstColumn && col === columns[0] && stickyCell("bare"), stickyFirstColumn && selectable && col === columns[0] && "start-11"),
|
|
708
|
+
children: totalRow(col)
|
|
709
|
+
}, col.id)),
|
|
710
|
+
onRowAction ? /* @__PURE__ */ jsx(Cell, {
|
|
711
|
+
"data-slot": "table-cell",
|
|
712
|
+
className: cnAll(tableCellVariants(), CHEVRON_CELL),
|
|
713
|
+
children: ""
|
|
714
|
+
}) : null
|
|
715
|
+
]
|
|
716
|
+
})
|
|
717
|
+
}) : null
|
|
718
|
+
]
|
|
719
|
+
})
|
|
720
|
+
}),
|
|
721
|
+
selectable ? /* @__PURE__ */ jsx(SelectionBar, {
|
|
722
|
+
count: selectedCount,
|
|
723
|
+
total: data.length,
|
|
724
|
+
labels: selectLabels,
|
|
725
|
+
onClear: () => commitSelection(/* @__PURE__ */ new Set())
|
|
726
|
+
}) : null,
|
|
727
|
+
rowsPerPage === void 0 || pageCount <= 1 && !pageSizeOptions ? null : /* @__PURE__ */ jsxs("nav", {
|
|
728
|
+
"data-slot": "table-pagination",
|
|
729
|
+
"aria-label": `${props["aria-label"]} pagination`,
|
|
730
|
+
className: cnAll(tablePaginationVariants()),
|
|
731
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
732
|
+
"data-slot": "table-pagination-pages",
|
|
733
|
+
className: "flex items-center gap-1",
|
|
734
|
+
children: pageCount <= 1 ? null : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
735
|
+
/* @__PURE__ */ jsx(Button$1, {
|
|
736
|
+
variant: "ghost",
|
|
737
|
+
size: "sm",
|
|
738
|
+
className: "w-(--density-control-h-sm) px-0",
|
|
739
|
+
"aria-label": labels.previous,
|
|
740
|
+
isDisabled: currentPage <= 1,
|
|
741
|
+
onPress: () => setPage(currentPage - 1),
|
|
742
|
+
children: /* @__PURE__ */ jsx(PageChevronGlyph, { direction: "previous" })
|
|
743
|
+
}),
|
|
744
|
+
pageWindow(currentPage, pageCount).map((entry, index) => entry === "ellipsis" ? /* @__PURE__ */ jsx("span", {
|
|
745
|
+
"data-slot": "table-pagination-ellipsis",
|
|
746
|
+
"aria-hidden": "true",
|
|
747
|
+
className: "px-2 text-sm text-muted-foreground",
|
|
748
|
+
children: "…"
|
|
749
|
+
}, `ellipsis-${String(index)}`) : /* @__PURE__ */ jsx(Button$1, {
|
|
750
|
+
variant: entry === currentPage ? "primary" : "ghost",
|
|
751
|
+
size: "sm",
|
|
752
|
+
className: "min-w-(--density-control-h-sm) px-2",
|
|
753
|
+
"aria-label": labels.page(entry, entry === currentPage),
|
|
754
|
+
onPress: () => setPage(entry),
|
|
755
|
+
children: entry
|
|
756
|
+
}, entry)),
|
|
757
|
+
/* @__PURE__ */ jsx(Button$1, {
|
|
758
|
+
variant: "ghost",
|
|
759
|
+
size: "sm",
|
|
760
|
+
className: "w-(--density-control-h-sm) px-0",
|
|
761
|
+
"aria-label": labels.next,
|
|
762
|
+
isDisabled: currentPage >= pageCount,
|
|
763
|
+
onPress: () => setPage(currentPage + 1),
|
|
764
|
+
children: /* @__PURE__ */ jsx(PageChevronGlyph, { direction: "next" })
|
|
448
765
|
})
|
|
449
|
-
})
|
|
450
|
-
|
|
766
|
+
] })
|
|
767
|
+
}), pageSizeOptions === void 0 ? null : /* @__PURE__ */ jsx(Select$1, {
|
|
768
|
+
className: "w-auto",
|
|
769
|
+
label: labels.rowsPerPage,
|
|
770
|
+
labelHidden: true,
|
|
771
|
+
selectedKey: String(rowsPerPage),
|
|
772
|
+
onSelectionChange: (key) => {
|
|
773
|
+
const size = Number(key);
|
|
774
|
+
setChosenSize(size);
|
|
775
|
+
setPage(1);
|
|
776
|
+
onPageSizeChange?.(size);
|
|
777
|
+
},
|
|
778
|
+
children: pageSizeOptions.map((option) => /* @__PURE__ */ jsx(SelectItem, {
|
|
779
|
+
id: String(option),
|
|
780
|
+
children: labels.perPage(option)
|
|
781
|
+
}, option))
|
|
782
|
+
})]
|
|
451
783
|
})
|
|
452
|
-
|
|
453
|
-
"data-slot": "table-pagination",
|
|
454
|
-
"aria-label": `${props["aria-label"]} pagination`,
|
|
455
|
-
className: cnAll(tablePaginationVariants()),
|
|
456
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
457
|
-
"data-slot": "table-pagination-pages",
|
|
458
|
-
className: "flex items-center gap-1",
|
|
459
|
-
children: pageCount <= 1 ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
460
|
-
/* @__PURE__ */ jsx(Button$1, {
|
|
461
|
-
variant: "ghost",
|
|
462
|
-
size: "sm",
|
|
463
|
-
className: "w-(--density-control-h-sm) px-0",
|
|
464
|
-
"aria-label": labels.previous,
|
|
465
|
-
isDisabled: currentPage <= 1,
|
|
466
|
-
onPress: () => setPage(currentPage - 1),
|
|
467
|
-
children: /* @__PURE__ */ jsx(PageChevronGlyph, { direction: "previous" })
|
|
468
|
-
}),
|
|
469
|
-
pageWindow(currentPage, pageCount).map((entry, index) => entry === "ellipsis" ? /* @__PURE__ */ jsx("span", {
|
|
470
|
-
"data-slot": "table-pagination-ellipsis",
|
|
471
|
-
"aria-hidden": "true",
|
|
472
|
-
className: "px-2 text-sm text-muted-foreground",
|
|
473
|
-
children: "…"
|
|
474
|
-
}, `ellipsis-${String(index)}`) : /* @__PURE__ */ jsx(Button$1, {
|
|
475
|
-
variant: entry === currentPage ? "primary" : "ghost",
|
|
476
|
-
size: "sm",
|
|
477
|
-
className: "min-w-(--density-control-h-sm) px-2",
|
|
478
|
-
"aria-label": labels.page(entry, entry === currentPage),
|
|
479
|
-
onPress: () => setPage(entry),
|
|
480
|
-
children: entry
|
|
481
|
-
}, entry)),
|
|
482
|
-
/* @__PURE__ */ jsx(Button$1, {
|
|
483
|
-
variant: "ghost",
|
|
484
|
-
size: "sm",
|
|
485
|
-
className: "w-(--density-control-h-sm) px-0",
|
|
486
|
-
"aria-label": labels.next,
|
|
487
|
-
isDisabled: currentPage >= pageCount,
|
|
488
|
-
onPress: () => setPage(currentPage + 1),
|
|
489
|
-
children: /* @__PURE__ */ jsx(PageChevronGlyph, { direction: "next" })
|
|
490
|
-
})
|
|
491
|
-
] })
|
|
492
|
-
}), pageSizeOptions === void 0 ? null : /* @__PURE__ */ jsx(Select$1, {
|
|
493
|
-
className: "w-auto",
|
|
494
|
-
label: labels.rowsPerPage,
|
|
495
|
-
labelHidden: true,
|
|
496
|
-
selectedKey: String(rowsPerPage),
|
|
497
|
-
onSelectionChange: (key) => {
|
|
498
|
-
const size = Number(key);
|
|
499
|
-
setChosenSize(size);
|
|
500
|
-
setPage(1);
|
|
501
|
-
onPageSizeChange?.(size);
|
|
502
|
-
},
|
|
503
|
-
children: pageSizeOptions.map((option) => /* @__PURE__ */ jsx(SelectItem, {
|
|
504
|
-
id: String(option),
|
|
505
|
-
children: labels.perPage(option)
|
|
506
|
-
}, option))
|
|
507
|
-
})]
|
|
508
|
-
})]
|
|
784
|
+
]
|
|
509
785
|
});
|
|
510
786
|
});
|
|
511
787
|
//#endregion
|
|
512
|
-
export { Table$1 as Table, createColumns, tableCardVariants, tableCellVariants, tableColumnVariants, tableFooterVariants, tableHeaderVariants, tablePaginationVariants, tableRowVariants, tableScrollVariants, tableVariants };
|
|
788
|
+
export { Table$1 as Table, createColumns, tableCardVariants, tableCellVariants, tableColumnVariants, tableEmptyVariants, tableFooterVariants, tableHeaderVariants, tablePaginationVariants, tableRowVariants, tableScrollVariants, tableSelectionBarVariants, tableStickyCellVariants, tableVariants };
|
|
513
789
|
|
|
514
790
|
//# sourceMappingURL=table.js.map
|