@choice-ui/react 1.4.3 → 1.4.6
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/dist/components/alert-dialog/dist/index.d.ts +20 -41
- package/dist/components/alert-dialog/dist/index.js +497 -0
- package/dist/components/alert-dialog/src/alert-dialog.js +1 -1
- package/dist/components/alert-dialog/src/hooks/use-alert-dialog.d.ts +1 -1
- package/dist/components/alert-dialog/src/index.d.ts +4 -5
- package/dist/components/alert-dialog/src/types.d.ts +11 -11
- package/dist/components/avatar/dist/index.js +4 -4
- package/dist/components/avatar/src/avatar.js +4 -4
- package/dist/components/badge/src/badge.js +2 -2
- package/dist/components/badge/src/index.d.ts +2 -1
- package/dist/components/button/dist/index.js +4 -4
- package/dist/components/button/src/button.js +4 -4
- package/dist/components/calendar/dist/index.d.ts +296 -296
- package/dist/components/calendar/dist/index.js +57 -56
- package/dist/components/calendar/src/date-range-input/date-range-input.d.ts +5 -5
- package/dist/components/calendar/src/time-calendar/time-calendar.d.ts +3 -3
- package/dist/components/calendar/src/time-calendar/time-calendar.js +2 -2
- package/dist/components/calendar/src/time-input/time-input.d.ts +9 -9
- package/dist/components/calendar/src/time-input/time-input.js +4 -4
- package/dist/components/calendar/src/types.d.ts +165 -165
- package/dist/components/calendar/src/utils/constants.js +32 -31
- package/dist/components/calendar/src/utils/date-comparisons.d.ts +34 -34
- package/dist/components/calendar/src/utils/locale.d.ts +12 -12
- package/dist/components/calendar/src/utils/month.d.ts +3 -3
- package/dist/components/calendar/src/utils/month.js +1 -1
- package/dist/components/calendar/src/utils/parsers/month-names.js +3 -3
- package/dist/components/calendar/src/utils/parsers/numeric-utils.d.ts +20 -20
- package/dist/components/calendar/src/utils/parsers/numeric-utils.js +8 -8
- package/dist/components/calendar/src/utils/parsers/parsers.d.ts +17 -17
- package/dist/components/calendar/src/utils/parsers/parsers.js +2 -2
- package/dist/components/calendar/src/utils/parsers/prediction.d.ts +7 -7
- package/dist/components/calendar/src/utils/parsers/relative-dates.js +6 -6
- package/dist/components/calendar/src/utils/quarter.d.ts +13 -13
- package/dist/components/calendar/src/utils/quarter.js +6 -6
- package/dist/components/calendar/src/utils/time.d.ts +8 -8
- package/dist/components/calendar/src/utils/year.d.ts +3 -3
- package/dist/components/calendar/src/utils/year.js +3 -3
- package/dist/components/checkbox/dist/index.d.ts +1 -12
- package/dist/components/checkbox/dist/index.js +9 -9
- package/dist/components/checkbox/src/checkbox-label.js +2 -2
- package/dist/components/checkbox/src/checkbox.js +6 -5
- package/dist/components/checkbox/src/context.js +1 -1
- package/dist/components/checkbox/src/index.d.ts +0 -3
- package/dist/components/chip/dist/index.js +6 -6
- package/dist/components/chip/src/chip.js +6 -6
- package/dist/components/chip/src/index.d.ts +2 -1
- package/dist/components/chips-input/dist/index.js +270 -0
- package/dist/components/chips-input/src/index.d.ts +2 -1
- package/dist/components/code-block/dist/index.d.ts +14 -32
- package/dist/components/code-block/dist/index.js +211 -147
- package/dist/components/code-block/src/code-block.d.ts +8 -1
- package/dist/components/code-block/src/code-block.js +14 -3
- package/dist/components/code-block/src/components/code-block-code.js +31 -5
- package/dist/components/code-block/src/components/code-block-header.js +45 -10
- package/dist/components/code-block/src/index.d.ts +3 -9
- package/dist/components/combobox/dist/index.d.ts +21 -2
- package/dist/components/combobox/dist/index.js +16 -13
- package/dist/components/combobox/src/combobox-trigger.d.ts +1 -1
- package/dist/components/combobox/src/combobox-trigger.js +7 -4
- package/dist/components/combobox/src/combobox.d.ts +20 -1
- package/dist/components/combobox/src/combobox.js +10 -10
- package/dist/components/command/dist/index.d.ts +65 -4
- package/dist/components/command/src/command.js +6 -5
- package/dist/components/command/src/components/command-divider.d.ts +4 -1
- package/dist/components/command/src/components/command-group.d.ts +16 -1
- package/dist/components/command/src/components/command-group.js +56 -54
- package/dist/components/command/src/components/command-input.js +3 -3
- package/dist/components/command/src/components/command-item.d.ts +1 -1
- package/dist/components/command/src/components/command-item.js +117 -115
- package/dist/components/command/src/components/command-loading.d.ts +8 -0
- package/dist/components/command/src/components/command-loading.js +1 -1
- package/dist/components/command/src/context/create-command-context.js +1 -1
- package/dist/components/command/src/hooks/use-schedule-layout-effect.d.ts +1 -1
- package/dist/components/command/src/hooks/use-value.js +2 -2
- package/dist/components/command/src/index.d.ts +16 -8
- package/dist/components/command/src/tv.d.ts +30 -0
- package/dist/components/command/src/tv.js +10 -0
- package/dist/components/command/src/types.d.ts +8 -0
- package/dist/components/command/src/utils/constants.d.ts +1 -1
- package/dist/components/command/src/utils/constants.js +1 -1
- package/dist/components/command/src/utils/helpers.d.ts +0 -1
- package/dist/components/command/src/utils/helpers.js +1 -3
- package/dist/components/command/src/utils/index.d.ts +1 -0
- package/dist/components/comments/src/comment-input/components/comment-input-mention-popover.js +4 -2
- package/dist/components/comments/src/comments.js +1 -1
- package/dist/components/context-input/dist/index.d.ts +47 -251
- package/dist/components/context-input/src/components/mention-menu.d.ts +5 -4
- package/dist/components/context-input/src/components/mention-menu.js +19 -4
- package/dist/components/context-input/src/components/mention.d.ts +2 -2
- package/dist/components/context-input/src/components/slate-editor.js +4 -2
- package/dist/components/context-input/src/context-input.js +31 -16
- package/dist/components/context-input/src/extensions/with-mentions.d.ts +1 -1
- package/dist/components/context-input/src/extensions/with-mentions.js +10 -9
- package/dist/components/context-input/src/hooks/use-context-input.js +87 -46
- package/dist/components/context-input/src/hooks/use-mentions.d.ts +11 -10
- package/dist/components/context-input/src/hooks/use-mentions.js +147 -128
- package/dist/components/context-input/src/index.d.ts +4 -5
- package/dist/components/context-input/src/types.d.ts +12 -12
- package/dist/components/context-input/src/utils/mention-spacing.d.ts +16 -16
- package/dist/components/context-input/src/utils/slate-converters.d.ts +6 -6
- package/dist/components/context-input/src/utils/slate-converters.js +2 -2
- package/dist/components/context-input/src/utils/text-extraction.js +7 -1
- package/dist/components/context-menu/src/context-menu.js +10 -4
- package/dist/components/dialog/dist/index.js +1 -2
- package/dist/components/dialog/src/dialog.js +0 -1
- package/dist/components/dialog/src/hooks/use-floating-dialog.js +1 -1
- package/dist/components/dialog/src/index.d.ts +3 -2
- package/dist/components/dropdown/dist/index.d.ts +1 -2
- package/dist/components/dropdown/dist/index.js +23 -8
- package/dist/components/dropdown/src/dropdown.d.ts +1 -2
- package/dist/components/dropdown/src/dropdown.js +23 -8
- package/dist/components/emoji-picker/dist/index.d.ts +33 -1
- package/dist/components/emoji-picker/dist/index.js +3 -1
- package/dist/components/emoji-picker/src/emoji-picker.d.ts +1 -1
- package/dist/components/emoji-picker/src/emoji-picker.js +3 -1
- package/dist/components/emoji-picker/src/index.d.ts +3 -1
- package/dist/components/form/dist/index.d.ts +93 -98
- package/dist/components/form/src/adapters/base-adapter.d.ts +3 -3
- package/dist/components/form/src/adapters/checkbox-adapter.d.ts +1 -1
- package/dist/components/form/src/adapters/chips-input-adapter.d.ts +9 -0
- package/dist/components/form/src/adapters/chips-input-adapter.js +38 -0
- package/dist/components/form/src/adapters/index.d.ts +8 -7
- package/dist/components/form/src/adapters/input-adapter.d.ts +1 -1
- package/dist/components/form/src/adapters/multi-select-adapter.d.ts +1 -1
- package/dist/components/form/src/adapters/numeric-input-adapter.d.ts +1 -1
- package/dist/components/form/src/adapters/raido-group-adapter.d.ts +1 -7
- package/dist/components/form/src/adapters/range-adapter.d.ts +1 -7
- package/dist/components/form/src/adapters/segmented-adapter.d.ts +1 -7
- package/dist/components/form/src/adapters/select-adapter.d.ts +1 -1
- package/dist/components/form/src/adapters/switch-adapter.d.ts +1 -1
- package/dist/components/form/src/adapters/textarea-adapter.d.ts +1 -1
- package/dist/components/form/src/index.d.ts +18 -16
- package/dist/components/form/src/index.js +16 -13
- package/dist/components/form/src/types.d.ts +58 -51
- package/dist/components/hint/dist/index.d.ts +10 -54
- package/dist/components/hint/src/components/info-content.d.ts +3 -5
- package/dist/components/hint/src/components/info-content.js +14 -6
- package/dist/components/hint/src/components/info-trigger.d.ts +2 -3
- package/dist/components/hint/src/components/info-trigger.js +4 -2
- package/dist/components/hint/src/context/hint-context.d.ts +2 -0
- package/dist/components/hint/src/context/hint-context.js +1 -1
- package/dist/components/hint/src/hint.d.ts +7 -7
- package/dist/components/hint/src/hint.js +24 -29
- package/dist/components/hint/src/hooks/use-hint.d.ts +4 -2
- package/dist/components/hint/src/hooks/use-hint.js +12 -4
- package/dist/components/hint/src/index.d.ts +3 -3
- package/dist/components/hint/src/tv.d.ts +33 -0
- package/dist/components/hint/src/tv.js +11 -0
- package/dist/components/icon-button/dist/index.js +2 -2
- package/dist/components/icon-button/src/icon-button.js +2 -2
- package/dist/components/index.d.ts +3 -0
- package/dist/components/input/dist/index.js +4 -4
- package/dist/components/input/src/input.js +3 -3
- package/dist/components/input/src/tv.js +1 -1
- package/dist/components/kbd/dist/index.js +4 -4
- package/dist/components/kbd/src/kbd.js +4 -4
- package/dist/components/label/dist/index.js +3 -3
- package/dist/components/label/src/tv.js +3 -3
- package/dist/components/link-button/dist/index.js +3 -3
- package/dist/components/link-button/src/link-button.js +3 -3
- package/dist/components/list/src/components/list-content.js +2 -2
- package/dist/components/list/src/components/list-divider.js +3 -3
- package/dist/components/list/src/components/list-item.js +5 -5
- package/dist/components/list/src/components/list-label.js +2 -2
- package/dist/components/list/src/components/list-sub-trigger.js +4 -4
- package/dist/components/list/src/list.js +2 -2
- package/dist/components/md-input/dist/index.d.ts +8 -104
- package/dist/components/md-input/src/components/extensions/md-input-mention.d.ts +6 -4
- package/dist/components/md-input/src/components/extensions/md-input-mention.js +23 -6
- package/dist/components/md-input/src/components/md-input-container.js +1 -0
- package/dist/components/md-input/src/components/md-input-editor.js +4 -1
- package/dist/components/md-input/src/components/md-input-footer.js +5 -1
- package/dist/components/md-input/src/components/toolbar/default-actions.d.ts +2 -2
- package/dist/components/md-input/src/components/toolbar/toolbar-button.d.ts +1 -0
- package/dist/components/md-input/src/components/toolbar/toolbar-button.js +1 -7
- package/dist/components/md-input/src/components/toolbar/toolbar.d.ts +2 -2
- package/dist/components/md-input/src/hooks/use-markdown-mentions.d.ts +5 -4
- package/dist/components/md-input/src/hooks/use-markdown-mentions.js +31 -4
- package/dist/components/md-input/src/index.d.ts +1 -4
- package/dist/components/md-input/src/md-input.js +18 -14
- package/dist/components/md-input/src/tv.d.ts +3 -0
- package/dist/components/md-input/src/tv.js +2 -1
- package/dist/components/md-input/src/types.d.ts +18 -16
- package/dist/components/md-render/dist/index.d.ts +1 -4
- package/dist/components/md-render/dist/index.js +8 -9
- package/dist/components/md-render/src/components/markdown-components.js +3 -3
- package/dist/components/md-render/src/index.d.ts +0 -1
- package/dist/components/md-render/src/md-render.js +5 -4
- package/dist/components/md-render/src/tv.js +1 -1
- package/dist/components/menubar/dist/index.d.ts +50 -0
- package/dist/components/menubar/src/components/index.d.ts +3 -0
- package/dist/components/menubar/src/components/menubar-divider.d.ts +8 -0
- package/dist/components/menubar/src/components/menubar-divider.js +24 -0
- package/dist/components/menubar/src/components/menubar-item.d.ts +8 -0
- package/dist/components/menubar/src/components/menubar-item.js +195 -0
- package/dist/components/menubar/src/components/menubar-trigger.d.ts +8 -0
- package/dist/components/menubar/src/components/menubar-trigger.js +45 -0
- package/dist/components/menubar/src/context/index.d.ts +1 -0
- package/dist/components/menubar/src/context/menubar-context.d.ts +34 -0
- package/dist/components/menubar/src/context/menubar-context.js +13 -0
- package/dist/components/menubar/src/index.d.ts +3 -0
- package/dist/components/menubar/src/menubar.d.ts +22 -0
- package/dist/components/menubar/src/menubar.js +177 -0
- package/dist/components/menubar/src/tv.d.ts +108 -0
- package/dist/components/menubar/src/tv.js +72 -0
- package/dist/components/menubar/tsup.config.d.ts +2 -0
- package/dist/components/menus/dist/index.d.ts +144 -143
- package/dist/components/menus/dist/index.js +50 -49
- package/dist/components/menus/src/components/menu-button.js +2 -2
- package/dist/components/menus/src/components/menu-checkbox.d.ts +1 -2
- package/dist/components/menus/src/components/menu-checkbox.js +2 -2
- package/dist/components/menus/src/components/menu-divider.js +3 -3
- package/dist/components/menus/src/components/menu-item.js +5 -5
- package/dist/components/menus/src/components/menu-label.js +2 -2
- package/dist/components/menus/src/components/menu-scroll-arrow.d.ts +2 -2
- package/dist/components/menus/src/components/menu-scroll-arrow.js +13 -3
- package/dist/components/menus/src/components/menu-search.js +3 -3
- package/dist/components/menus/src/components/menu-trigger.js +4 -4
- package/dist/components/menus/src/context/menu-context-item.d.ts +6 -6
- package/dist/components/menus/src/context/menu-context-item.js +2 -2
- package/dist/components/menus/src/context/menu-context-sub-trigger.js +4 -19
- package/dist/components/menus/src/context/menu-context.d.ts +2 -2
- package/dist/components/menus/src/hooks/use-menu-base-refs.d.ts +12 -12
- package/dist/components/menus/src/hooks/use-menu-children.d.ts +16 -16
- package/dist/components/menus/src/hooks/use-menu-floating.d.ts +22 -22
- package/dist/components/menus/src/hooks/use-menu-refs.d.ts +8 -8
- package/dist/components/menus/src/hooks/use-menu-refs.js +2 -2
- package/dist/components/menus/src/hooks/use-menu-scroll-height.d.ts +11 -11
- package/dist/components/menus/src/hooks/use-menu-scroll.d.ts +18 -18
- package/dist/components/menus/src/hooks/use-menu-selection.d.ts +21 -21
- package/dist/components/menus/src/hooks/use-menu-state.d.ts +11 -11
- package/dist/components/menus/src/hooks/use-menu-state.js +4 -4
- package/dist/components/menus/src/hooks/use-menu-touch.d.ts +11 -11
- package/dist/components/menus/src/hooks/use-menu-tree.d.ts +15 -15
- package/dist/components/menus/src/index.d.ts +5 -0
- package/dist/components/menus/src/menus.js +2 -2
- package/dist/components/menus/src/tv.d.ts +15 -0
- package/dist/components/menus/src/tv.js +8 -2
- package/dist/components/modal/dist/index.d.ts +3 -1
- package/dist/components/modal/dist/index.js +18 -11
- package/dist/components/modal/src/components/modal-content.js +2 -2
- package/dist/components/modal/src/components/modal-footer.js +2 -2
- package/dist/components/modal/src/components/modal-header.d.ts +3 -1
- package/dist/components/modal/src/components/modal-header.js +12 -5
- package/dist/components/modal/src/modal.js +2 -2
- package/dist/components/multi-select/dist/index.js +13 -11
- package/dist/components/multi-select/src/components/multi-select-trigger.js +8 -8
- package/dist/components/multi-select/src/multi-select.js +5 -3
- package/dist/components/numeric-input/dist/index.d.ts +10 -117
- package/dist/components/numeric-input/dist/index.js +18 -24
- package/dist/components/numeric-input/src/components/numeric-input-element.js +2 -2
- package/dist/components/numeric-input/src/components/numeric-input-menu-trigger.d.ts +1 -1
- package/dist/components/numeric-input/src/components/numeric-input-menu-trigger.js +2 -2
- package/dist/components/numeric-input/src/components/numeric-input-variable.d.ts +1 -2
- package/dist/components/numeric-input/src/components/numeric-input-variable.js +3 -3
- package/dist/components/numeric-input/src/hooks/use-input-interactions.d.ts +3 -3
- package/dist/components/numeric-input/src/hooks/use-numeric-input.d.ts +3 -3
- package/dist/components/numeric-input/src/hooks/use-numeric-value-processing.d.ts +3 -3
- package/dist/components/numeric-input/src/hooks/use-step-calculation.d.ts +6 -6
- package/dist/components/numeric-input/src/index.d.ts +5 -4
- package/dist/components/numeric-input/src/numeric-input.js +9 -9
- package/dist/components/numeric-input/src/utils/error-handler.d.ts +8 -8
- package/dist/components/numeric-input/src/utils/expression-evaluator.d.ts +11 -11
- package/dist/components/numeric-input/src/utils/input-parser.d.ts +8 -8
- package/dist/components/numeric-input/src/utils/numeric-value-processor.d.ts +6 -6
- package/dist/components/numeric-input/src/utils/pattern-parser.d.ts +7 -7
- package/dist/components/numeric-input/src/utils/value-comparator.d.ts +16 -16
- package/dist/components/numeric-input/src/utils/value-processor.d.ts +14 -14
- package/dist/components/pagination/src/components/pagination-items-per-page.js +1 -1
- package/dist/components/pagination/src/components/pagination-navigation.js +5 -5
- package/dist/components/pagination/src/components/pagination-root.js +3 -3
- package/dist/components/pagination/src/components/pagination-spinner.js +20 -19
- package/dist/components/pagination/src/context/index.d.ts +1 -0
- package/dist/components/popover/dist/index.d.ts +2 -4
- package/dist/components/popover/dist/index.js +25 -33
- package/dist/components/popover/src/components/popover-header.js +1 -1
- package/dist/components/popover/src/hooks/use-drag.d.ts +3 -3
- package/dist/components/popover/src/hooks/use-floating-popover.d.ts +0 -2
- package/dist/components/popover/src/hooks/use-floating-popover.js +16 -13
- package/dist/components/popover/src/index.d.ts +2 -1
- package/dist/components/popover/src/popover.d.ts +1 -2
- package/dist/components/popover/src/popover.js +11 -21
- package/dist/components/progress/src/index.d.ts +4 -2
- package/dist/components/radio/dist/index.d.ts +1 -17
- package/dist/components/radio/dist/index.js +7 -10
- package/dist/components/radio/src/context.js +1 -1
- package/dist/components/radio/src/index.d.ts +0 -4
- package/dist/components/radio/src/radio-label.js +2 -2
- package/dist/components/radio/src/radio.js +4 -4
- package/dist/components/range/dist/index.js +16 -16
- package/dist/components/range/src/index.d.ts +4 -2
- package/dist/components/range/src/range-tuple.js +10 -10
- package/dist/components/range/src/range.js +6 -6
- package/dist/components/rich-input/dist/index.d.ts +12 -366
- package/dist/components/rich-input/src/components/rich-input-editable-component.d.ts +2 -2
- package/dist/components/rich-input/src/components/rich-input-viewport.d.ts +2 -2
- package/dist/components/rich-input/src/hooks/use-editor-config.d.ts +1 -1
- package/dist/components/rich-input/src/hooks/use-editor-effects.js +3 -0
- package/dist/components/rich-input/src/hooks/use-floating-ui.js +1 -1
- package/dist/components/rich-input/src/hooks/use-keyboard-shortcuts.d.ts +9 -9
- package/dist/components/rich-input/src/hooks/use-rich-input.d.ts +2 -2
- package/dist/components/rich-input/src/hooks/use-rich-input.js +40 -17
- package/dist/components/rich-input/src/hooks/use-selection-events.js +1 -2
- package/dist/components/rich-input/src/index.d.ts +3 -5
- package/dist/components/rich-input/src/rich-input-base.js +1 -1
- package/dist/components/rich-input/src/utils/custom-options.js +1 -1
- package/dist/components/rich-input/src/utils/editor-utils.js +1 -1
- package/dist/components/rich-input/src/utils/markdown-to-slate.d.ts +2 -2
- package/dist/components/rich-input/src/utils/slate-to-markdown.d.ts +1 -1
- package/dist/components/rich-input/src/utils/slate-to-markdown.js +9 -0
- package/dist/components/scroll-area/dist/index.d.ts +19 -19
- package/dist/components/scroll-area/dist/index.js +24 -24
- package/dist/components/scroll-area/src/components/scroll-area-corner.js +2 -2
- package/dist/components/scroll-area/src/components/scroll-area-root.js +3 -3
- package/dist/components/scroll-area/src/components/scroll-area-scrollbar.js +2 -2
- package/dist/components/scroll-area/src/components/scroll-area-thumb.js +2 -2
- package/dist/components/scroll-area/src/hooks/use-scroll-performance-monitor.d.ts +6 -6
- package/dist/components/scroll-area/src/hooks/use-scroll-performance-monitor.js +3 -3
- package/dist/components/scroll-area/src/hooks/use-scroll-state-and-visibility.d.ts +1 -1
- package/dist/components/scroll-area/src/hooks/use-scroll-state-and-visibility.js +3 -3
- package/dist/components/scroll-area/src/hooks/use-scrollbar.d.ts +2 -2
- package/dist/components/scroll-area/src/hooks/use-thumb.d.ts +2 -2
- package/dist/components/scroll-area/src/tv.d.ts +18 -18
- package/dist/components/scroll-area/src/tv.js +12 -12
- package/dist/components/scroll-area/src/types.d.ts +8 -8
- package/dist/components/scroll-area/src/utils/index.d.ts +3 -3
- package/dist/components/search-input/dist/index.js +3 -3
- package/dist/components/search-input/src/index.d.ts +2 -1
- package/dist/components/search-input/src/search-input.js +3 -3
- package/dist/components/segmented/dist/index.js +5 -5
- package/dist/components/segmented/src/segmented-item.js +3 -3
- package/dist/components/segmented/src/segmented.js +2 -2
- package/dist/components/select/dist/index.js +4 -4
- package/dist/components/select/src/select.js +4 -4
- package/dist/components/separator/dist/index.d.ts +26 -0
- package/dist/components/separator/src/index.d.ts +2 -0
- package/dist/components/separator/src/separator.d.ts +22 -0
- package/dist/components/separator/src/separator.js +33 -0
- package/dist/components/separator/src/tv.d.ts +76 -0
- package/dist/components/separator/src/tv.js +25 -0
- package/dist/components/separator/tsup.config.d.ts +2 -0
- package/dist/components/skeleton/dist/index.d.ts +1 -28
- package/dist/components/skeleton/src/context/skeleton-context.js +1 -1
- package/dist/components/skeleton/src/hooks/use-skeleton.d.ts +1 -2
- package/dist/components/skeleton/src/hooks/use-skeleton.js +1 -1
- package/dist/components/skeleton/src/index.d.ts +1 -3
- package/dist/components/skeleton/src/skeleton.d.ts +0 -13
- package/dist/components/skeleton/src/skeleton.js +4 -6
- package/dist/components/skeleton/src/tv.d.ts +18 -12
- package/dist/components/skeleton/src/tv.js +10 -6
- package/dist/components/slot/dist/index.d.ts +10 -10
- package/dist/components/slot/dist/index.js +4 -2
- package/dist/components/slot/src/slot.d.ts +12 -12
- package/dist/components/slot/src/slot.js +6 -3
- package/dist/components/stackflow/src/context.js +1 -1
- package/dist/components/stackflow/src/index.d.ts +2 -1
- package/dist/components/switch/dist/index.d.ts +2 -2
- package/dist/components/switch/dist/index.js +6 -7
- package/dist/components/switch/src/index.d.ts +2 -1
- package/dist/components/switch/src/switch.js +6 -6
- package/dist/components/table/dist/index.d.ts +679 -0
- package/dist/components/table/index.d.ts +1 -0
- package/dist/components/table/src/components/column-resizer.d.ts +8 -0
- package/dist/components/table/src/components/column-resizer.js +58 -0
- package/dist/components/table/src/components/drag-guide.d.ts +6 -0
- package/dist/components/table/src/components/drag-guide.js +64 -0
- package/dist/components/table/src/components/index.d.ts +12 -0
- package/dist/components/table/src/components/resize-guide.d.ts +5 -0
- package/dist/components/table/src/components/resize-guide.js +25 -0
- package/dist/components/table/src/components/table-body.d.ts +6 -0
- package/dist/components/table/src/components/table-body.js +335 -0
- package/dist/components/table/src/components/table-cell.d.ts +6 -0
- package/dist/components/table/src/components/table-cell.js +89 -0
- package/dist/components/table/src/components/table-column.d.ts +5 -0
- package/dist/components/table/src/components/table-column.js +269 -0
- package/dist/components/table/src/components/table-empty.d.ts +8 -0
- package/dist/components/table/src/components/table-empty.js +10 -0
- package/dist/components/table/src/components/table-footer.d.ts +7 -0
- package/dist/components/table/src/components/table-footer.js +15 -0
- package/dist/components/table/src/components/table-header.d.ts +3 -0
- package/dist/components/table/src/components/table-header.js +88 -0
- package/dist/components/table/src/components/table-root.d.ts +3 -0
- package/dist/components/table/src/components/table-root.js +317 -0
- package/dist/components/table/src/components/table-row.d.ts +23 -0
- package/dist/components/table/src/components/table-row.js +166 -0
- package/dist/components/table/src/components/table-value.d.ts +6 -0
- package/dist/components/table/src/components/table-value.js +8 -0
- package/dist/components/table/src/context.d.ts +121 -0
- package/dist/components/table/src/context.js +63 -0
- package/dist/components/table/src/hooks/index.d.ts +4 -0
- package/dist/components/table/src/hooks/use-column-order.d.ts +26 -0
- package/dist/components/table/src/hooks/use-column-order.js +95 -0
- package/dist/components/table/src/hooks/use-column-resize.d.ts +17 -0
- package/dist/components/table/src/hooks/use-column-resize.js +75 -0
- package/dist/components/table/src/hooks/use-consecutive-selection-style.d.ts +12 -0
- package/dist/components/table/src/hooks/use-consecutive-selection-style.js +28 -0
- package/dist/components/table/src/hooks/use-table.d.ts +35 -0
- package/dist/components/table/src/hooks/use-table.js +245 -0
- package/dist/components/table/src/index.d.ts +4 -0
- package/dist/components/table/src/table.d.ts +88 -0
- package/dist/components/table/src/table.js +24 -0
- package/dist/components/table/src/tv.d.ts +176 -0
- package/dist/components/table/src/tv.js +97 -0
- package/dist/components/table/src/types.d.ts +292 -0
- package/dist/components/table/tsup.config.d.ts +2 -0
- package/dist/components/tabs/dist/index.js +4 -3
- package/dist/components/tabs/src/tabs.d.ts +2 -2
- package/dist/components/tabs/src/tabs.js +5 -4
- package/dist/components/text-field/dist/index.d.ts +1 -1
- package/dist/components/text-field/dist/index.js +10 -10
- package/dist/components/text-field/src/components/field-addon.d.ts +1 -2
- package/dist/components/text-field/src/index.d.ts +3 -1
- package/dist/components/text-field/src/text-field.js +10 -10
- package/dist/components/textarea/dist/index.d.ts +33 -5
- package/dist/components/textarea/dist/index.js +32 -7
- package/dist/components/textarea/src/components/autosize/index.d.ts +6 -1
- package/dist/components/textarea/src/components/autosize/index.js +31 -6
- package/dist/components/textarea/src/textarea.js +1 -1
- package/dist/components/textarea/src/types.d.ts +33 -5
- package/dist/components/toggle-button/dist/index.d.ts +26 -2
- package/dist/components/toggle-button/src/context.d.ts +11 -0
- package/dist/components/toggle-button/src/context.js +13 -0
- package/dist/components/toggle-button/src/index.d.ts +2 -0
- package/dist/components/toggle-button/src/toggle-button.js +4 -4
- package/dist/components/toggle-button/src/toggle-group.d.ts +26 -0
- package/dist/components/toggle-button/src/toggle-group.js +156 -0
- package/dist/components/toggle-button/src/tv.d.ts +67 -3
- package/dist/components/toggle-button/src/tv.js +45 -14
- package/dist/components/tooltip/dist/index.d.ts +10 -43
- package/dist/components/tooltip/dist/index.js +35 -33
- package/dist/components/tooltip/src/components/tooltip-arrow.js +1 -1
- package/dist/components/tooltip/src/components/tooltip-content.js +5 -4
- package/dist/components/tooltip/src/context/index.d.ts +1 -0
- package/dist/components/tooltip/src/hooks/use-tooltip.js +3 -3
- package/dist/components/tooltip/src/index.d.ts +2 -4
- package/dist/components/tooltip/src/tooltip.d.ts +7 -1
- package/dist/components/tooltip/src/tooltip.js +6 -1
- package/dist/components/tooltip/src/tv.js +1 -1
- package/dist/components/virtualized-grid/dist/index.d.ts +2 -2
- package/dist/components/virtualized-grid/src/use-item-pool.js +14 -26
- package/dist/components/virtualized-grid/src/use-virtualized-grid.d.ts +1 -1
- package/dist/components/virtualized-grid/src/use-virtualized-grid.js +14 -8
- package/dist/components/virtualized-grid/src/utility.d.ts +1 -1
- package/dist/components/virtualized-grid/src/utility.js +37 -31
- package/dist/components/virtualized-grid/src/virtualized-grid.js +27 -17
- package/dist/context/choice-ui-provider.d.ts +35 -0
- package/dist/context/choice-ui-provider.js +14 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +53 -177
- package/package.json +1 -1
- package/dist/components/code-block/src/index.js +0 -15
- package/dist/components/rich-input/src/hooks/use-mouse-events.js +0 -113
- package/dist/components/rich-input/src/hooks/use-validation.js +0 -80
- package/dist/components/rich-input/src/utils/markdown-to-slate.js +0 -219
- /package/dist/components/command/src/{command-score.d.ts → utils/command-score.d.ts} +0 -0
- /package/dist/components/command/src/{command-score.js → utils/command-score.js} +0 -0
- /package/dist/components/pagination/src/{components → context}/pagination-context.d.ts +0 -0
- /package/dist/components/pagination/src/{components → context}/pagination-context.js +0 -0
|
@@ -0,0 +1,679 @@
|
|
|
1
|
+
import { ReactNode, RefObject } from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
4
|
+
|
|
5
|
+
/** Selection mode for the table */
|
|
6
|
+
type SelectionMode = "single" | "multiple" | "none";
|
|
7
|
+
/** Scroll mode for virtualization */
|
|
8
|
+
type ScrollMode = "container" | "window";
|
|
9
|
+
/** Row key type */
|
|
10
|
+
type RowKey = string | number;
|
|
11
|
+
/** Sort direction */
|
|
12
|
+
type SortDirection = "asc" | "desc";
|
|
13
|
+
/** Sorting state */
|
|
14
|
+
interface SortingState {
|
|
15
|
+
id: string;
|
|
16
|
+
desc: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** Row selection state */
|
|
19
|
+
type SelectionState = Set<RowKey>;
|
|
20
|
+
/** Column definition */
|
|
21
|
+
interface TableColumnDef<T = unknown> {
|
|
22
|
+
/** Unique column identifier */
|
|
23
|
+
id: string;
|
|
24
|
+
/** Column header content */
|
|
25
|
+
header?: ReactNode;
|
|
26
|
+
/** Column width (px or CSS value) */
|
|
27
|
+
width?: number | string;
|
|
28
|
+
/** Minimum column width */
|
|
29
|
+
minWidth?: number;
|
|
30
|
+
/** Maximum column width */
|
|
31
|
+
maxWidth?: number;
|
|
32
|
+
/** Flex grow value for flexible column width (e.g., 1, 2, 3) */
|
|
33
|
+
flex?: number;
|
|
34
|
+
/** Whether column is sortable */
|
|
35
|
+
sortable?: boolean;
|
|
36
|
+
/** Whether column is resizable */
|
|
37
|
+
resizable?: boolean;
|
|
38
|
+
/** Custom cell className */
|
|
39
|
+
className?: string;
|
|
40
|
+
/** Custom header className */
|
|
41
|
+
headerClassName?: string;
|
|
42
|
+
}
|
|
43
|
+
/** Column width state */
|
|
44
|
+
interface ColumnWidthState {
|
|
45
|
+
[columnId: string]: number;
|
|
46
|
+
}
|
|
47
|
+
/** Alias for ColumnWidthState */
|
|
48
|
+
type ColumnWidthsState = ColumnWidthState;
|
|
49
|
+
/** Column order state */
|
|
50
|
+
type ColumnOrderState = string[];
|
|
51
|
+
/** Resize state for showing guide line during drag */
|
|
52
|
+
interface ResizeState {
|
|
53
|
+
columnId: string;
|
|
54
|
+
startX: number;
|
|
55
|
+
startWidth: number;
|
|
56
|
+
currentX: number;
|
|
57
|
+
}
|
|
58
|
+
/** Table instance (exposed via ref) */
|
|
59
|
+
interface TableInstance<T> {
|
|
60
|
+
/** Get all rows data */
|
|
61
|
+
getData: () => T[];
|
|
62
|
+
/** Get selected row keys */
|
|
63
|
+
getSelectedKeys: () => RowKey[];
|
|
64
|
+
/** Get selected rows data */
|
|
65
|
+
getSelectedRows: () => T[];
|
|
66
|
+
/** Check if row is selected */
|
|
67
|
+
isRowSelected: (key: RowKey) => boolean;
|
|
68
|
+
/** Select row */
|
|
69
|
+
selectRow: (key: RowKey) => void;
|
|
70
|
+
/** Deselect row */
|
|
71
|
+
deselectRow: (key: RowKey) => void;
|
|
72
|
+
/** Toggle row selection */
|
|
73
|
+
toggleRowSelection: (key: RowKey) => void;
|
|
74
|
+
/** Select all rows */
|
|
75
|
+
selectAll: () => void;
|
|
76
|
+
/** Deselect all rows */
|
|
77
|
+
deselectAll: () => void;
|
|
78
|
+
/** Check if all rows are selected */
|
|
79
|
+
isAllSelected: () => boolean;
|
|
80
|
+
/** Check if some (but not all) rows are selected */
|
|
81
|
+
isSomeSelected: () => boolean;
|
|
82
|
+
}
|
|
83
|
+
/** Internal row data with metadata */
|
|
84
|
+
interface InternalRow<T> {
|
|
85
|
+
key: RowKey;
|
|
86
|
+
data: T;
|
|
87
|
+
index: number;
|
|
88
|
+
}
|
|
89
|
+
/** Consecutive selection style type */
|
|
90
|
+
type ConsecutiveStyle = "rounded-md" | "rounded-t-md" | "rounded-b-md" | "rounded-none" | "";
|
|
91
|
+
/** Table context value */
|
|
92
|
+
interface TableContextValue<T = unknown> {
|
|
93
|
+
data: T[];
|
|
94
|
+
rows: InternalRow<T>[];
|
|
95
|
+
getRowKey: (row: T, index: number) => RowKey;
|
|
96
|
+
columns: TableColumnDef<T>[];
|
|
97
|
+
columnOrder: ColumnOrderState;
|
|
98
|
+
registerColumn: (column: TableColumnDef<T>) => void;
|
|
99
|
+
unregisterColumn: (id: string) => void;
|
|
100
|
+
selectable: boolean;
|
|
101
|
+
selectionMode: SelectionMode;
|
|
102
|
+
selectedKeys: Set<RowKey>;
|
|
103
|
+
isRowSelected: (key: RowKey) => boolean;
|
|
104
|
+
toggleRowSelection: (key: RowKey, index?: number) => void;
|
|
105
|
+
handleCheckboxClick: (key: RowKey, index: number, event: React.MouseEvent) => void;
|
|
106
|
+
isAllSelected: () => boolean;
|
|
107
|
+
isSomeSelected: () => boolean;
|
|
108
|
+
selectAll: () => void;
|
|
109
|
+
deselectAll: () => void;
|
|
110
|
+
sortable: boolean;
|
|
111
|
+
sorting: SortingState[];
|
|
112
|
+
toggleSort: (columnId: string) => void;
|
|
113
|
+
getSortDirection: (columnId: string) => SortDirection | null;
|
|
114
|
+
resizable: boolean;
|
|
115
|
+
columnWidths: ColumnWidthState;
|
|
116
|
+
resizeState: ResizeState | null;
|
|
117
|
+
getColumnWidth: (columnId: string) => number | undefined;
|
|
118
|
+
startResize: (columnId: string, startX: number, startWidth: number) => void;
|
|
119
|
+
updateResize: (currentX: number) => void;
|
|
120
|
+
endResize: () => void;
|
|
121
|
+
reorderable: boolean;
|
|
122
|
+
dragState: {
|
|
123
|
+
columnId: string;
|
|
124
|
+
targetIndex: number;
|
|
125
|
+
} | null;
|
|
126
|
+
startDrag: (columnId: string) => void;
|
|
127
|
+
updateDragTarget: (targetIndex: number) => void;
|
|
128
|
+
endDrag: () => void;
|
|
129
|
+
cancelDrag: () => void;
|
|
130
|
+
scrollMode: ScrollMode;
|
|
131
|
+
scrollRef?: RefObject<HTMLElement>;
|
|
132
|
+
containerRef?: RefObject<HTMLElement>;
|
|
133
|
+
virtualized: boolean;
|
|
134
|
+
/** Fixed row height in pixels */
|
|
135
|
+
rowHeight: number;
|
|
136
|
+
overscan: number;
|
|
137
|
+
activeRowKey: RowKey | null;
|
|
138
|
+
onRowClick?: (row: T, event: React.MouseEvent) => void;
|
|
139
|
+
getConsecutiveStyle: (index: number) => ConsecutiveStyle;
|
|
140
|
+
tableRef: RefObject<HTMLDivElement>;
|
|
141
|
+
tableInstance: TableInstance<T>;
|
|
142
|
+
}
|
|
143
|
+
/** Props for the Table root component */
|
|
144
|
+
interface TableProps<T> {
|
|
145
|
+
/** Table data */
|
|
146
|
+
data: T[];
|
|
147
|
+
/** Function to get unique key for each row */
|
|
148
|
+
getRowKey: (row: T, index: number) => RowKey;
|
|
149
|
+
/** Whether to show selection column */
|
|
150
|
+
selectable?: boolean;
|
|
151
|
+
/** Selection mode */
|
|
152
|
+
selectionMode?: SelectionMode;
|
|
153
|
+
/** Controlled selected keys */
|
|
154
|
+
selectedKeys?: RowKey[];
|
|
155
|
+
/** Default selected keys (uncontrolled) */
|
|
156
|
+
defaultSelectedKeys?: RowKey[];
|
|
157
|
+
/** Selection change callback */
|
|
158
|
+
onSelectionChange?: (selectedKeys: RowKey[]) => void;
|
|
159
|
+
/** Whether to enable virtualization */
|
|
160
|
+
virtualized?: boolean;
|
|
161
|
+
/** Fixed row height in pixels for virtualization (default: 32) */
|
|
162
|
+
rowHeight?: number;
|
|
163
|
+
/** Number of rows to render outside viewport */
|
|
164
|
+
overscan?: number;
|
|
165
|
+
/** Scroll mode */
|
|
166
|
+
scrollMode?: ScrollMode;
|
|
167
|
+
/** Custom scroll element ref (for custom container scroll) */
|
|
168
|
+
scrollRef?: RefObject<HTMLElement>;
|
|
169
|
+
/** Custom container ref (for custom container scroll) */
|
|
170
|
+
containerRef?: RefObject<HTMLElement>;
|
|
171
|
+
/** Whether table is sortable */
|
|
172
|
+
sortable?: boolean;
|
|
173
|
+
/** Controlled sorting state */
|
|
174
|
+
sorting?: SortingState[];
|
|
175
|
+
/** Default sorting state */
|
|
176
|
+
defaultSorting?: SortingState[];
|
|
177
|
+
/** Sorting change callback */
|
|
178
|
+
onSortingChange?: (sorting: SortingState[]) => void;
|
|
179
|
+
/** Whether columns are resizable */
|
|
180
|
+
resizable?: boolean;
|
|
181
|
+
/** Controlled column widths */
|
|
182
|
+
columnWidths?: ColumnWidthState;
|
|
183
|
+
/** Default column widths */
|
|
184
|
+
defaultColumnWidths?: ColumnWidthState;
|
|
185
|
+
/** Column width change callback */
|
|
186
|
+
onColumnWidthsChange?: (widths: ColumnWidthState) => void;
|
|
187
|
+
/** Whether columns are reorderable */
|
|
188
|
+
reorderable?: boolean;
|
|
189
|
+
/** Controlled column order */
|
|
190
|
+
columnOrder?: ColumnOrderState;
|
|
191
|
+
/** Default column order */
|
|
192
|
+
defaultColumnOrder?: ColumnOrderState;
|
|
193
|
+
/** Column order change callback */
|
|
194
|
+
onColumnOrderChange?: (order: ColumnOrderState) => void;
|
|
195
|
+
/** Active row key (for highlighting) */
|
|
196
|
+
activeRowKey?: RowKey | null;
|
|
197
|
+
/** Row click handler */
|
|
198
|
+
onRowClick?: (row: T, event: React.MouseEvent) => void;
|
|
199
|
+
/** Custom class name */
|
|
200
|
+
className?: string;
|
|
201
|
+
/** Container height (for container scroll mode) */
|
|
202
|
+
height?: number | string;
|
|
203
|
+
/** Scroll event callback (for infinite scroll, etc.) */
|
|
204
|
+
onScroll?: (event: {
|
|
205
|
+
scrollTop: number;
|
|
206
|
+
scrollHeight: number;
|
|
207
|
+
clientHeight: number;
|
|
208
|
+
}) => void;
|
|
209
|
+
/** Ref to table instance */
|
|
210
|
+
tableRef?: RefObject<TableInstance<T> | null>;
|
|
211
|
+
/** Children (Table.Header, Table.Body) */
|
|
212
|
+
children: ReactNode;
|
|
213
|
+
}
|
|
214
|
+
/** Props for Table.Header */
|
|
215
|
+
interface TableHeaderProps {
|
|
216
|
+
children: ReactNode;
|
|
217
|
+
className?: string;
|
|
218
|
+
}
|
|
219
|
+
/** Props for Table.Column (used inside Table.Header) */
|
|
220
|
+
interface TableColumnProps {
|
|
221
|
+
/** Unique column identifier */
|
|
222
|
+
id: string;
|
|
223
|
+
/** Column header content */
|
|
224
|
+
children?: ReactNode;
|
|
225
|
+
/** Column width */
|
|
226
|
+
width?: number | string;
|
|
227
|
+
/** Minimum width */
|
|
228
|
+
minWidth?: number;
|
|
229
|
+
/** Maximum width */
|
|
230
|
+
maxWidth?: number;
|
|
231
|
+
/** Flex grow value for flexible column width (e.g., 1, 2, 3) */
|
|
232
|
+
flex?: number;
|
|
233
|
+
/** Whether sortable */
|
|
234
|
+
sortable?: boolean;
|
|
235
|
+
/** Whether resizable (overrides table-level setting) */
|
|
236
|
+
resizable?: boolean;
|
|
237
|
+
/** Header className */
|
|
238
|
+
className?: string;
|
|
239
|
+
}
|
|
240
|
+
/** Props for Table.Body */
|
|
241
|
+
interface TableBodyProps<T = unknown> {
|
|
242
|
+
/** Render function for each row */
|
|
243
|
+
children: (row: T, index: number) => ReactNode;
|
|
244
|
+
/** Body className */
|
|
245
|
+
className?: string;
|
|
246
|
+
/** Body class names */
|
|
247
|
+
classNames?: {
|
|
248
|
+
viewport?: string;
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
/** Props for Table.Row */
|
|
252
|
+
interface TableRowProps {
|
|
253
|
+
/** Row key (must match getRowKey result) */
|
|
254
|
+
rowKey: RowKey;
|
|
255
|
+
/** Row index */
|
|
256
|
+
index: number;
|
|
257
|
+
/** Children (Table.Cell elements) */
|
|
258
|
+
children: ReactNode;
|
|
259
|
+
/** Row className */
|
|
260
|
+
className?: string;
|
|
261
|
+
/** Click handler */
|
|
262
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
263
|
+
}
|
|
264
|
+
/** Props for Table.Cell */
|
|
265
|
+
interface TableCellProps {
|
|
266
|
+
/** Cell content */
|
|
267
|
+
children: ReactNode;
|
|
268
|
+
/** Column id this cell belongs to */
|
|
269
|
+
columnId?: string;
|
|
270
|
+
/** Cell className */
|
|
271
|
+
className?: string;
|
|
272
|
+
}
|
|
273
|
+
/** Props for Table.Value */
|
|
274
|
+
interface TableValueProps {
|
|
275
|
+
/** Value content */
|
|
276
|
+
children?: ReactNode;
|
|
277
|
+
/** Value className */
|
|
278
|
+
className?: string;
|
|
279
|
+
}
|
|
280
|
+
/** Props for Table.Footer (e.g., loading indicator for infinite scroll) */
|
|
281
|
+
interface TableFooterProps {
|
|
282
|
+
/** Footer content */
|
|
283
|
+
children: ReactNode;
|
|
284
|
+
/** Footer className */
|
|
285
|
+
className?: string;
|
|
286
|
+
}
|
|
287
|
+
/** Props for Table.SelectCell */
|
|
288
|
+
interface TableSelectCellProps {
|
|
289
|
+
/** Row key */
|
|
290
|
+
rowKey: RowKey;
|
|
291
|
+
/** Row index */
|
|
292
|
+
index: number;
|
|
293
|
+
/** Disabled state */
|
|
294
|
+
disabled?: boolean;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
interface TableEmptyProps {
|
|
298
|
+
/** Empty state content */
|
|
299
|
+
children: ReactNode;
|
|
300
|
+
/** Custom className */
|
|
301
|
+
className?: string;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Table component with compound components pattern.
|
|
306
|
+
*
|
|
307
|
+
* Supports:
|
|
308
|
+
* - Row selection (single/multiple)
|
|
309
|
+
* - Consecutive selection rounded corners
|
|
310
|
+
* - Virtualization for large datasets
|
|
311
|
+
* - Two scroll modes: "container" (internal ScrollArea) or "window" (window scroll)
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* // Container scroll (default) - Table has its own scroll area
|
|
315
|
+
* <Table
|
|
316
|
+
* data={users}
|
|
317
|
+
* getRowKey={(user) => user.id}
|
|
318
|
+
* selectable
|
|
319
|
+
* height={400}
|
|
320
|
+
* >
|
|
321
|
+
* <Table.Header>
|
|
322
|
+
* <Table.Column id="name" width={200}>Name</Table.Column>
|
|
323
|
+
* <Table.Column id="email">Email</Table.Column>
|
|
324
|
+
* </Table.Header>
|
|
325
|
+
* <Table.Body>
|
|
326
|
+
* {(user, index) => (
|
|
327
|
+
* <Table.Row rowKey={user.id} index={index}>
|
|
328
|
+
* <Table.Cell columnId="name">{user.name}</Table.Cell>
|
|
329
|
+
* <Table.Cell columnId="email">{user.email}</Table.Cell>
|
|
330
|
+
* </Table.Row>
|
|
331
|
+
* )}
|
|
332
|
+
* </Table.Body>
|
|
333
|
+
* </Table>
|
|
334
|
+
*
|
|
335
|
+
* @example
|
|
336
|
+
* // Window scroll - Table uses window scroll for virtualization
|
|
337
|
+
* <Table
|
|
338
|
+
* data={users}
|
|
339
|
+
* getRowKey={(user) => user.id}
|
|
340
|
+
* selectable
|
|
341
|
+
* scrollMode="window"
|
|
342
|
+
* >
|
|
343
|
+
* <Table.Header>
|
|
344
|
+
* <Table.Column id="name">Name</Table.Column>
|
|
345
|
+
* <Table.Column id="email">Email</Table.Column>
|
|
346
|
+
* </Table.Header>
|
|
347
|
+
* <Table.Body>
|
|
348
|
+
* {(user, index) => (
|
|
349
|
+
* <Table.Row rowKey={user.id} index={index}>
|
|
350
|
+
* <Table.Cell columnId="name">{user.name}</Table.Cell>
|
|
351
|
+
* <Table.Cell columnId="email">{user.email}</Table.Cell>
|
|
352
|
+
* </Table.Row>
|
|
353
|
+
* )}
|
|
354
|
+
* </Table.Body>
|
|
355
|
+
* </Table>
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* // Custom scroll container - Provide your own ScrollArea
|
|
359
|
+
* const scrollRef = useRef<HTMLDivElement>(null)
|
|
360
|
+
* const containerRef = useRef<HTMLDivElement>(null)
|
|
361
|
+
*
|
|
362
|
+
* <ScrollArea>
|
|
363
|
+
* <ScrollArea.Viewport ref={scrollRef}>
|
|
364
|
+
* <ScrollArea.Content ref={containerRef}>
|
|
365
|
+
* <Table
|
|
366
|
+
* data={users}
|
|
367
|
+
* getRowKey={(user) => user.id}
|
|
368
|
+
* scrollRef={scrollRef}
|
|
369
|
+
* containerRef={containerRef}
|
|
370
|
+
* >
|
|
371
|
+
* ...
|
|
372
|
+
* </Table>
|
|
373
|
+
* </ScrollArea.Content>
|
|
374
|
+
* </ScrollArea.Viewport>
|
|
375
|
+
* </ScrollArea>
|
|
376
|
+
*/
|
|
377
|
+
declare function Table<T>(props: TableProps<T>): react_jsx_runtime.JSX.Element;
|
|
378
|
+
declare namespace Table {
|
|
379
|
+
var Header: (props: TableHeaderProps) => React.ReactNode;
|
|
380
|
+
var Column: (props: TableColumnProps) => React.ReactNode;
|
|
381
|
+
var Body: <T>(props: TableBodyProps<T>) => React.ReactNode;
|
|
382
|
+
var Row: (props: TableRowProps) => React.ReactNode;
|
|
383
|
+
var Cell: (props: TableCellProps) => React.ReactNode;
|
|
384
|
+
var Value: (props: TableValueProps) => React.ReactNode;
|
|
385
|
+
var Empty: (props: TableEmptyProps) => React.ReactNode;
|
|
386
|
+
var Footer: (props: TableFooterProps) => React.ReactNode;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Static context - rarely changes
|
|
391
|
+
* Contains: columns, config, refs, and stable handlers
|
|
392
|
+
*/
|
|
393
|
+
interface TableStaticContextValue<T = unknown> {
|
|
394
|
+
getData: () => T[];
|
|
395
|
+
getRowKey: (row: T, index: number) => RowKey;
|
|
396
|
+
columns: TableColumnDef<T>[];
|
|
397
|
+
registerColumn: (column: TableColumnDef<T>) => void;
|
|
398
|
+
unregisterColumn: (id: string) => void;
|
|
399
|
+
selectable: boolean;
|
|
400
|
+
selectionMode: SelectionMode;
|
|
401
|
+
sortable: boolean;
|
|
402
|
+
resizable: boolean;
|
|
403
|
+
reorderable: boolean;
|
|
404
|
+
virtualized: boolean;
|
|
405
|
+
/** Fixed row height in pixels */
|
|
406
|
+
rowHeight: number;
|
|
407
|
+
overscan: number;
|
|
408
|
+
scrollMode: ScrollMode;
|
|
409
|
+
/** External scroll container ref (for external scroll mode) */
|
|
410
|
+
scrollRef?: RefObject<HTMLElement>;
|
|
411
|
+
tableRef: RefObject<HTMLDivElement>;
|
|
412
|
+
toggleSort: (columnId: string) => void;
|
|
413
|
+
getSortDirection: (columnId: string) => SortDirection | null;
|
|
414
|
+
onRowClick?: (row: T, event: React.MouseEvent) => void;
|
|
415
|
+
onScroll?: (event: {
|
|
416
|
+
scrollTop: number;
|
|
417
|
+
scrollHeight: number;
|
|
418
|
+
clientHeight: number;
|
|
419
|
+
}) => void;
|
|
420
|
+
tableInstance: TableInstance<T>;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Scroll sync context - for header/body horizontal scroll synchronization
|
|
424
|
+
* Uses refs for direct DOM manipulation to avoid React re-renders during scroll
|
|
425
|
+
*/
|
|
426
|
+
interface TableScrollContextValue {
|
|
427
|
+
/** Header inner element ref for direct DOM transform */
|
|
428
|
+
headerInnerRef: RefObject<HTMLDivElement>;
|
|
429
|
+
/** Sync scroll position directly to header (bypasses React state) */
|
|
430
|
+
syncScrollLeft: (value: number) => void;
|
|
431
|
+
/** Body scroll container ref (for virtualization) */
|
|
432
|
+
bodyScrollRef: RefObject<HTMLDivElement> | null;
|
|
433
|
+
/** Set body scroll container ref */
|
|
434
|
+
setBodyScrollRef: (ref: RefObject<HTMLDivElement>) => void;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Selection context - changes when selection changes
|
|
438
|
+
*/
|
|
439
|
+
interface TableSelectionContextValue {
|
|
440
|
+
selectedKeys: Set<RowKey>;
|
|
441
|
+
isRowSelected: (key: RowKey) => boolean;
|
|
442
|
+
toggleRowSelection: (key: RowKey, index?: number) => void;
|
|
443
|
+
handleCheckboxClick: (key: RowKey, index: number, event: React.MouseEvent) => void;
|
|
444
|
+
isAllSelected: () => boolean;
|
|
445
|
+
isSomeSelected: () => boolean;
|
|
446
|
+
selectAll: () => void;
|
|
447
|
+
deselectAll: () => void;
|
|
448
|
+
getConsecutiveStyle: (index: number) => ConsecutiveStyle;
|
|
449
|
+
activeRowKey: RowKey | null;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Column state context - changes during resize/reorder
|
|
453
|
+
*/
|
|
454
|
+
interface TableColumnStateContextValue {
|
|
455
|
+
columnWidths: ColumnWidthsState;
|
|
456
|
+
columnOrder: ColumnOrderState;
|
|
457
|
+
sorting: SortingState[];
|
|
458
|
+
getColumnWidth: (columnId: string) => number | undefined;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Drag/Resize context - changes very frequently during interactions
|
|
462
|
+
*/
|
|
463
|
+
interface TableDragResizeContextValue {
|
|
464
|
+
resizeState: {
|
|
465
|
+
columnId: string;
|
|
466
|
+
startX: number;
|
|
467
|
+
startWidth: number;
|
|
468
|
+
currentX: number;
|
|
469
|
+
} | null;
|
|
470
|
+
startResize: (columnId: string, startX: number, startWidth: number) => void;
|
|
471
|
+
updateResize: (currentX: number) => void;
|
|
472
|
+
endResize: () => void;
|
|
473
|
+
dragState: {
|
|
474
|
+
columnId: string;
|
|
475
|
+
targetIndex: number;
|
|
476
|
+
mouseX: number;
|
|
477
|
+
sourceLeft: number;
|
|
478
|
+
sourceWidth: number;
|
|
479
|
+
} | null;
|
|
480
|
+
startDrag: (columnId: string, mouseX: number, sourceLeft: number, sourceWidth: number) => void;
|
|
481
|
+
updateDragTarget: (targetIndex: number) => void;
|
|
482
|
+
updateDragPosition: (mouseX: number) => void;
|
|
483
|
+
endDrag: () => void;
|
|
484
|
+
cancelDrag: () => void;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Row data context - contains rows array
|
|
488
|
+
*/
|
|
489
|
+
interface TableRowsContextValue<T = unknown> {
|
|
490
|
+
rows: Array<{
|
|
491
|
+
key: RowKey;
|
|
492
|
+
data: T;
|
|
493
|
+
index: number;
|
|
494
|
+
}>;
|
|
495
|
+
}
|
|
496
|
+
declare function useTableStatic<T = unknown>(): TableStaticContextValue<T>;
|
|
497
|
+
declare function useTableScroll(): TableScrollContextValue;
|
|
498
|
+
declare function useTableSelection(): TableSelectionContextValue;
|
|
499
|
+
declare function useTableColumnState(): TableColumnStateContextValue;
|
|
500
|
+
declare function useTableDragResize(): TableDragResizeContextValue;
|
|
501
|
+
declare function useTableRows<T = unknown>(): TableRowsContextValue<T>;
|
|
502
|
+
|
|
503
|
+
declare const tableVariants: tailwind_variants.TVReturnType<{
|
|
504
|
+
selected: {
|
|
505
|
+
true: {
|
|
506
|
+
row: string;
|
|
507
|
+
rowStatic: string;
|
|
508
|
+
};
|
|
509
|
+
false: {};
|
|
510
|
+
};
|
|
511
|
+
active: {
|
|
512
|
+
true: {
|
|
513
|
+
row: string;
|
|
514
|
+
rowStatic: string;
|
|
515
|
+
};
|
|
516
|
+
false: {};
|
|
517
|
+
};
|
|
518
|
+
sortable: {
|
|
519
|
+
true: {
|
|
520
|
+
headerCell: string[];
|
|
521
|
+
};
|
|
522
|
+
false: {
|
|
523
|
+
headerCell: string;
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
resizing: {
|
|
527
|
+
true: {
|
|
528
|
+
root: string;
|
|
529
|
+
};
|
|
530
|
+
false: {};
|
|
531
|
+
};
|
|
532
|
+
dragging: {
|
|
533
|
+
true: {
|
|
534
|
+
resizer: string;
|
|
535
|
+
};
|
|
536
|
+
false: {};
|
|
537
|
+
};
|
|
538
|
+
}, {
|
|
539
|
+
root: string;
|
|
540
|
+
headerWrapper: string;
|
|
541
|
+
headerInner: string;
|
|
542
|
+
headerRow: string;
|
|
543
|
+
headerCell: string[];
|
|
544
|
+
headerCellDraggable: string;
|
|
545
|
+
headerCellCanDrag: string;
|
|
546
|
+
headerCellDragging: string;
|
|
547
|
+
headerCheckbox: string;
|
|
548
|
+
bodyWrapper: string;
|
|
549
|
+
bodyScroll: string;
|
|
550
|
+
body: string;
|
|
551
|
+
row: string;
|
|
552
|
+
rowStatic: string;
|
|
553
|
+
cell: string;
|
|
554
|
+
cellCheckbox: string;
|
|
555
|
+
sortIcon: string;
|
|
556
|
+
emptyState: string;
|
|
557
|
+
resizer: string[];
|
|
558
|
+
resizeGuide: string[];
|
|
559
|
+
dragGhost: string[];
|
|
560
|
+
dragIndicator: string[];
|
|
561
|
+
}, undefined, {
|
|
562
|
+
selected: {
|
|
563
|
+
true: {
|
|
564
|
+
row: string;
|
|
565
|
+
rowStatic: string;
|
|
566
|
+
};
|
|
567
|
+
false: {};
|
|
568
|
+
};
|
|
569
|
+
active: {
|
|
570
|
+
true: {
|
|
571
|
+
row: string;
|
|
572
|
+
rowStatic: string;
|
|
573
|
+
};
|
|
574
|
+
false: {};
|
|
575
|
+
};
|
|
576
|
+
sortable: {
|
|
577
|
+
true: {
|
|
578
|
+
headerCell: string[];
|
|
579
|
+
};
|
|
580
|
+
false: {
|
|
581
|
+
headerCell: string;
|
|
582
|
+
};
|
|
583
|
+
};
|
|
584
|
+
resizing: {
|
|
585
|
+
true: {
|
|
586
|
+
root: string;
|
|
587
|
+
};
|
|
588
|
+
false: {};
|
|
589
|
+
};
|
|
590
|
+
dragging: {
|
|
591
|
+
true: {
|
|
592
|
+
resizer: string;
|
|
593
|
+
};
|
|
594
|
+
false: {};
|
|
595
|
+
};
|
|
596
|
+
}, {
|
|
597
|
+
root: string;
|
|
598
|
+
headerWrapper: string;
|
|
599
|
+
headerInner: string;
|
|
600
|
+
headerRow: string;
|
|
601
|
+
headerCell: string[];
|
|
602
|
+
headerCellDraggable: string;
|
|
603
|
+
headerCellCanDrag: string;
|
|
604
|
+
headerCellDragging: string;
|
|
605
|
+
headerCheckbox: string;
|
|
606
|
+
bodyWrapper: string;
|
|
607
|
+
bodyScroll: string;
|
|
608
|
+
body: string;
|
|
609
|
+
row: string;
|
|
610
|
+
rowStatic: string;
|
|
611
|
+
cell: string;
|
|
612
|
+
cellCheckbox: string;
|
|
613
|
+
sortIcon: string;
|
|
614
|
+
emptyState: string;
|
|
615
|
+
resizer: string[];
|
|
616
|
+
resizeGuide: string[];
|
|
617
|
+
dragGhost: string[];
|
|
618
|
+
dragIndicator: string[];
|
|
619
|
+
}, tailwind_variants.TVReturnType<{
|
|
620
|
+
selected: {
|
|
621
|
+
true: {
|
|
622
|
+
row: string;
|
|
623
|
+
rowStatic: string;
|
|
624
|
+
};
|
|
625
|
+
false: {};
|
|
626
|
+
};
|
|
627
|
+
active: {
|
|
628
|
+
true: {
|
|
629
|
+
row: string;
|
|
630
|
+
rowStatic: string;
|
|
631
|
+
};
|
|
632
|
+
false: {};
|
|
633
|
+
};
|
|
634
|
+
sortable: {
|
|
635
|
+
true: {
|
|
636
|
+
headerCell: string[];
|
|
637
|
+
};
|
|
638
|
+
false: {
|
|
639
|
+
headerCell: string;
|
|
640
|
+
};
|
|
641
|
+
};
|
|
642
|
+
resizing: {
|
|
643
|
+
true: {
|
|
644
|
+
root: string;
|
|
645
|
+
};
|
|
646
|
+
false: {};
|
|
647
|
+
};
|
|
648
|
+
dragging: {
|
|
649
|
+
true: {
|
|
650
|
+
resizer: string;
|
|
651
|
+
};
|
|
652
|
+
false: {};
|
|
653
|
+
};
|
|
654
|
+
}, {
|
|
655
|
+
root: string;
|
|
656
|
+
headerWrapper: string;
|
|
657
|
+
headerInner: string;
|
|
658
|
+
headerRow: string;
|
|
659
|
+
headerCell: string[];
|
|
660
|
+
headerCellDraggable: string;
|
|
661
|
+
headerCellCanDrag: string;
|
|
662
|
+
headerCellDragging: string;
|
|
663
|
+
headerCheckbox: string;
|
|
664
|
+
bodyWrapper: string;
|
|
665
|
+
bodyScroll: string;
|
|
666
|
+
body: string;
|
|
667
|
+
row: string;
|
|
668
|
+
rowStatic: string;
|
|
669
|
+
cell: string;
|
|
670
|
+
cellCheckbox: string;
|
|
671
|
+
sortIcon: string;
|
|
672
|
+
emptyState: string;
|
|
673
|
+
resizer: string[];
|
|
674
|
+
resizeGuide: string[];
|
|
675
|
+
dragGhost: string[];
|
|
676
|
+
dragIndicator: string[];
|
|
677
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
678
|
+
|
|
679
|
+
export { type ColumnOrderState, type ColumnWidthState, type ColumnWidthsState, type ConsecutiveStyle, type InternalRow, type ResizeState, type RowKey, type ScrollMode, type SelectionMode, type SelectionState, type SortDirection, type SortingState, Table, type TableBodyProps, type TableCellProps, type TableColumnDef, type TableColumnProps, type TableContextValue, type TableEmptyProps, type TableFooterProps, type TableHeaderProps, type TableInstance, type TableProps, type TableRowProps, type TableSelectCellProps, type TableValueProps, tableVariants, useTableColumnState, useTableDragResize, useTableRows, useTableScroll, useTableSelection, useTableStatic };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface ColumnResizerProps {
|
|
2
|
+
columnId: string;
|
|
3
|
+
columnWidth: number;
|
|
4
|
+
dragging?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare function ColumnResizerInner({ columnId, columnWidth, dragging }: ColumnResizerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export declare const ColumnResizer: import('react').MemoExoticComponent<typeof ColumnResizerInner>;
|
|
8
|
+
export {};
|