@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
|
@@ -55,33 +55,40 @@ var ModalBackdropTv = tcv({
|
|
|
55
55
|
});
|
|
56
56
|
var ModalContent = forwardRef((props, ref) => {
|
|
57
57
|
const { className, ...rest } = props;
|
|
58
|
-
const
|
|
58
|
+
const tv = ModalContentTv();
|
|
59
59
|
return /* @__PURE__ */ jsx(
|
|
60
60
|
"div",
|
|
61
61
|
{
|
|
62
62
|
ref,
|
|
63
|
-
className: tcx(
|
|
63
|
+
className: tcx(tv.root(), className),
|
|
64
64
|
...rest
|
|
65
65
|
}
|
|
66
66
|
);
|
|
67
67
|
});
|
|
68
68
|
ModalContent.displayName = "ModalContent";
|
|
69
69
|
var ModalHeader = forwardRef((props, ref) => {
|
|
70
|
-
const { className, children, title, onClose, ...rest } = props;
|
|
70
|
+
const { className, children, title, onClose, closeButtonProps, ...rest } = props;
|
|
71
71
|
const validElement = useMemo(() => {
|
|
72
72
|
return isValidElement(title);
|
|
73
73
|
}, [title]);
|
|
74
|
-
const
|
|
74
|
+
const tv = ModalHeaderTv({ validElement, close: !!onClose });
|
|
75
75
|
return /* @__PURE__ */ jsxs(
|
|
76
76
|
"div",
|
|
77
77
|
{
|
|
78
78
|
ref,
|
|
79
|
-
className: tcx(
|
|
79
|
+
className: tcx(tv.root(), className),
|
|
80
80
|
...rest,
|
|
81
81
|
children: [
|
|
82
|
-
title && /* @__PURE__ */ jsx("div", { className:
|
|
82
|
+
title && /* @__PURE__ */ jsx("div", { className: tv.title(), children: /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: title }) }),
|
|
83
83
|
children,
|
|
84
|
-
onClose && /* @__PURE__ */ jsx("div", { className:
|
|
84
|
+
onClose && /* @__PURE__ */ jsx("div", { className: tv.close(), children: /* @__PURE__ */ jsx(
|
|
85
|
+
IconButton,
|
|
86
|
+
{
|
|
87
|
+
onClick: onClose,
|
|
88
|
+
...closeButtonProps,
|
|
89
|
+
children: /* @__PURE__ */ jsx(Remove, {})
|
|
90
|
+
}
|
|
91
|
+
) })
|
|
85
92
|
]
|
|
86
93
|
}
|
|
87
94
|
);
|
|
@@ -89,12 +96,12 @@ var ModalHeader = forwardRef((props, ref) => {
|
|
|
89
96
|
ModalHeader.displayName = "ModalHeader";
|
|
90
97
|
var ModalFooter = forwardRef((props, ref) => {
|
|
91
98
|
const { className, ...rest } = props;
|
|
92
|
-
const
|
|
99
|
+
const tv = ModalFooterTv();
|
|
93
100
|
return /* @__PURE__ */ jsx(
|
|
94
101
|
"div",
|
|
95
102
|
{
|
|
96
103
|
ref,
|
|
97
|
-
className: tcx(
|
|
104
|
+
className: tcx(tv.root(), className),
|
|
98
105
|
...rest
|
|
99
106
|
}
|
|
100
107
|
);
|
|
@@ -180,12 +187,12 @@ var ModalTextarea = memo(
|
|
|
180
187
|
ModalTextarea.displayName = "ModalTextarea";
|
|
181
188
|
var ModalBase = forwardRef((props, ref) => {
|
|
182
189
|
const { className, title, onClose, ...rest } = props;
|
|
183
|
-
const
|
|
190
|
+
const tv = ModalTv();
|
|
184
191
|
return /* @__PURE__ */ jsx(
|
|
185
192
|
"div",
|
|
186
193
|
{
|
|
187
194
|
ref,
|
|
188
|
-
className: tcx(
|
|
195
|
+
className: tcx(tv.root(), className),
|
|
189
196
|
...rest
|
|
190
197
|
}
|
|
191
198
|
);
|
|
@@ -4,12 +4,12 @@ import { ModalContentTv } from "../tv.js";
|
|
|
4
4
|
import { tcx } from "../../../../shared/utils/tcx/tcx.js";
|
|
5
5
|
const ModalContent = forwardRef((props, ref) => {
|
|
6
6
|
const { className, ...rest } = props;
|
|
7
|
-
const
|
|
7
|
+
const tv = ModalContentTv();
|
|
8
8
|
return /* @__PURE__ */ jsx(
|
|
9
9
|
"div",
|
|
10
10
|
{
|
|
11
11
|
ref,
|
|
12
|
-
className: tcx(
|
|
12
|
+
className: tcx(tv.root(), className),
|
|
13
13
|
...rest
|
|
14
14
|
}
|
|
15
15
|
);
|
|
@@ -4,12 +4,12 @@ import { ModalFooterTv } from "../tv.js";
|
|
|
4
4
|
import { tcx } from "../../../../shared/utils/tcx/tcx.js";
|
|
5
5
|
const ModalFooter = forwardRef((props, ref) => {
|
|
6
6
|
const { className, ...rest } = props;
|
|
7
|
-
const
|
|
7
|
+
const tv = ModalFooterTv();
|
|
8
8
|
return /* @__PURE__ */ jsx(
|
|
9
9
|
"div",
|
|
10
10
|
{
|
|
11
11
|
ref,
|
|
12
|
-
className: tcx(
|
|
12
|
+
className: tcx(tv.root(), className),
|
|
13
13
|
...rest
|
|
14
14
|
}
|
|
15
15
|
);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { IconButtonProps } from '../../../icon-button/src';
|
|
1
2
|
import { HTMLProps, ReactNode } from 'react';
|
|
2
3
|
export interface ModalHeaderProps extends Omit<HTMLProps<HTMLDivElement>, "title"> {
|
|
3
|
-
onClose?: () => void;
|
|
4
4
|
title?: ReactNode;
|
|
5
|
+
closeButtonProps?: IconButtonProps;
|
|
6
|
+
onClose?: () => void;
|
|
5
7
|
}
|
|
6
8
|
export declare const ModalHeader: import('react').ForwardRefExoticComponent<Omit<ModalHeaderProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -5,21 +5,28 @@ import { forwardRef, useMemo, isValidElement } from "react";
|
|
|
5
5
|
import { ModalHeaderTv } from "../tv.js";
|
|
6
6
|
import { tcx } from "../../../../shared/utils/tcx/tcx.js";
|
|
7
7
|
const ModalHeader = forwardRef((props, ref) => {
|
|
8
|
-
const { className, children, title, onClose, ...rest } = props;
|
|
8
|
+
const { className, children, title, onClose, closeButtonProps, ...rest } = props;
|
|
9
9
|
const validElement = useMemo(() => {
|
|
10
10
|
return isValidElement(title);
|
|
11
11
|
}, [title]);
|
|
12
|
-
const
|
|
12
|
+
const tv = ModalHeaderTv({ validElement, close: !!onClose });
|
|
13
13
|
return /* @__PURE__ */ jsxs(
|
|
14
14
|
"div",
|
|
15
15
|
{
|
|
16
16
|
ref,
|
|
17
|
-
className: tcx(
|
|
17
|
+
className: tcx(tv.root(), className),
|
|
18
18
|
...rest,
|
|
19
19
|
children: [
|
|
20
|
-
title && /* @__PURE__ */ jsx("div", { className:
|
|
20
|
+
title && /* @__PURE__ */ jsx("div", { className: tv.title(), children: /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: title }) }),
|
|
21
21
|
children,
|
|
22
|
-
onClose && /* @__PURE__ */ jsx("div", { className:
|
|
22
|
+
onClose && /* @__PURE__ */ jsx("div", { className: tv.close(), children: /* @__PURE__ */ jsx(
|
|
23
|
+
IconButton,
|
|
24
|
+
{
|
|
25
|
+
onClick: onClose,
|
|
26
|
+
...closeButtonProps,
|
|
27
|
+
children: /* @__PURE__ */ jsx(Remove, {})
|
|
28
|
+
}
|
|
29
|
+
) })
|
|
23
30
|
]
|
|
24
31
|
}
|
|
25
32
|
);
|
|
@@ -11,12 +11,12 @@ import { ModalBackdrop } from "./components/modal-backdrop.js";
|
|
|
11
11
|
import { tcx } from "../../../shared/utils/tcx/tcx.js";
|
|
12
12
|
const ModalBase = forwardRef((props, ref) => {
|
|
13
13
|
const { className, title, onClose, ...rest } = props;
|
|
14
|
-
const
|
|
14
|
+
const tv = ModalTv();
|
|
15
15
|
return /* @__PURE__ */ jsx(
|
|
16
16
|
"div",
|
|
17
17
|
{
|
|
18
18
|
ref,
|
|
19
|
-
className: tcx(
|
|
19
|
+
className: tcx(tv.root(), className),
|
|
20
20
|
...rest
|
|
21
21
|
}
|
|
22
22
|
);
|
|
@@ -104,7 +104,7 @@ var MultiSelectTrigger = memo(
|
|
|
104
104
|
...rest
|
|
105
105
|
} = props;
|
|
106
106
|
const containerRef = useRef(null);
|
|
107
|
-
const
|
|
107
|
+
const tv = multiSelectTriggerTv({
|
|
108
108
|
size: size2,
|
|
109
109
|
disabled,
|
|
110
110
|
hasValues: values.length > 0,
|
|
@@ -140,7 +140,7 @@ var MultiSelectTrigger = memo(
|
|
|
140
140
|
);
|
|
141
141
|
const renderChips = useMemo(() => {
|
|
142
142
|
if (!hasValues) return null;
|
|
143
|
-
return /* @__PURE__ */ jsxs("div", { className:
|
|
143
|
+
return /* @__PURE__ */ jsxs("div", { className: tv.chips(), children: [
|
|
144
144
|
displayValues.map((value, index) => {
|
|
145
145
|
const chipDisabled = !!valueDisabledMap[value] || disabled;
|
|
146
146
|
const handleRemove = !chipDisabled && !readOnly && onRemove ? (e) => {
|
|
@@ -194,20 +194,20 @@ var MultiSelectTrigger = memo(
|
|
|
194
194
|
readOnly,
|
|
195
195
|
onRemove,
|
|
196
196
|
getDisplayValue,
|
|
197
|
-
|
|
197
|
+
tv,
|
|
198
198
|
renderChip,
|
|
199
199
|
variant,
|
|
200
200
|
valueDisabledMap
|
|
201
201
|
]);
|
|
202
202
|
const renderPlaceholder = useMemo(() => {
|
|
203
203
|
if (hasValues) return null;
|
|
204
|
-
return /* @__PURE__ */ jsx("span", { className:
|
|
205
|
-
}, [hasValues, placeholder,
|
|
204
|
+
return /* @__PURE__ */ jsx("span", { className: tv.placeholder(), children: placeholder });
|
|
205
|
+
}, [hasValues, placeholder, tv]);
|
|
206
206
|
return /* @__PURE__ */ jsxs(
|
|
207
207
|
"div",
|
|
208
208
|
{
|
|
209
209
|
ref: mergeRefs(ref, containerRef),
|
|
210
|
-
className: tcx(
|
|
210
|
+
className: tcx(tv.root(), className),
|
|
211
211
|
tabIndex: disabled ? -1 : 0,
|
|
212
212
|
onClick: handleContainerClick,
|
|
213
213
|
onKeyDown: handleKeyDown,
|
|
@@ -220,7 +220,7 @@ var MultiSelectTrigger = memo(
|
|
|
220
220
|
/* @__PURE__ */ jsxs(
|
|
221
221
|
"div",
|
|
222
222
|
{
|
|
223
|
-
className:
|
|
223
|
+
className: tv.content(),
|
|
224
224
|
onClick: (e) => {
|
|
225
225
|
const target = e.target;
|
|
226
226
|
if (target.closest("[data-remove-button]") || target.closest('button[aria-label*="Remove"]')) {
|
|
@@ -233,7 +233,7 @@ var MultiSelectTrigger = memo(
|
|
|
233
233
|
]
|
|
234
234
|
}
|
|
235
235
|
),
|
|
236
|
-
suffixElement && /* @__PURE__ */ jsx("span", { className:
|
|
236
|
+
suffixElement && /* @__PURE__ */ jsx("span", { className: tv.suffix(), children: suffixElement })
|
|
237
237
|
]
|
|
238
238
|
}
|
|
239
239
|
);
|
|
@@ -487,8 +487,10 @@ var MultiSelectComponent = memo(
|
|
|
487
487
|
apply(args) {
|
|
488
488
|
var _a;
|
|
489
489
|
const { elements, availableHeight, rects } = args;
|
|
490
|
-
const
|
|
491
|
-
const
|
|
490
|
+
const floatingScrollHeight = elements.floating.scrollHeight;
|
|
491
|
+
const scrollRefHeight = ((_a = scrollRef.current) == null ? void 0 : _a.scrollHeight) || 0;
|
|
492
|
+
const contentHeight = Math.max(floatingScrollHeight, scrollRefHeight);
|
|
493
|
+
const maxHeight = contentHeight > 0 ? Math.min(contentHeight, availableHeight) : availableHeight;
|
|
492
494
|
Object.assign(elements.floating.style, {
|
|
493
495
|
maxHeight: `${maxHeight}px`,
|
|
494
496
|
display: "flex",
|
|
@@ -561,7 +563,7 @@ var MultiSelectComponent = memo(
|
|
|
561
563
|
setScrollTop,
|
|
562
564
|
touch,
|
|
563
565
|
isSelect: false,
|
|
564
|
-
//
|
|
566
|
+
// Use dropdown scroll logic
|
|
565
567
|
fallback: false
|
|
566
568
|
});
|
|
567
569
|
const { handleSelect: baseHandleSelect, handleRemove: baseHandleRemove } = useMultiSelectSelection({
|
|
@@ -26,7 +26,7 @@ const MultiSelectTrigger = memo(
|
|
|
26
26
|
...rest
|
|
27
27
|
} = props;
|
|
28
28
|
const containerRef = useRef(null);
|
|
29
|
-
const
|
|
29
|
+
const tv = multiSelectTriggerTv({
|
|
30
30
|
size,
|
|
31
31
|
disabled,
|
|
32
32
|
hasValues: values.length > 0,
|
|
@@ -62,7 +62,7 @@ const MultiSelectTrigger = memo(
|
|
|
62
62
|
);
|
|
63
63
|
const renderChips = useMemo(() => {
|
|
64
64
|
if (!hasValues) return null;
|
|
65
|
-
return /* @__PURE__ */ jsxs("div", { className:
|
|
65
|
+
return /* @__PURE__ */ jsxs("div", { className: tv.chips(), children: [
|
|
66
66
|
displayValues.map((value, index) => {
|
|
67
67
|
const chipDisabled = !!valueDisabledMap[value] || disabled;
|
|
68
68
|
const handleRemove = !chipDisabled && !readOnly && onRemove ? (e) => {
|
|
@@ -116,20 +116,20 @@ const MultiSelectTrigger = memo(
|
|
|
116
116
|
readOnly,
|
|
117
117
|
onRemove,
|
|
118
118
|
getDisplayValue,
|
|
119
|
-
|
|
119
|
+
tv,
|
|
120
120
|
renderChip,
|
|
121
121
|
variant,
|
|
122
122
|
valueDisabledMap
|
|
123
123
|
]);
|
|
124
124
|
const renderPlaceholder = useMemo(() => {
|
|
125
125
|
if (hasValues) return null;
|
|
126
|
-
return /* @__PURE__ */ jsx("span", { className:
|
|
127
|
-
}, [hasValues, placeholder,
|
|
126
|
+
return /* @__PURE__ */ jsx("span", { className: tv.placeholder(), children: placeholder });
|
|
127
|
+
}, [hasValues, placeholder, tv]);
|
|
128
128
|
return /* @__PURE__ */ jsxs(
|
|
129
129
|
"div",
|
|
130
130
|
{
|
|
131
131
|
ref: mergeRefs(ref, containerRef),
|
|
132
|
-
className: tcx(
|
|
132
|
+
className: tcx(tv.root(), className),
|
|
133
133
|
tabIndex: disabled ? -1 : 0,
|
|
134
134
|
onClick: handleContainerClick,
|
|
135
135
|
onKeyDown: handleKeyDown,
|
|
@@ -142,7 +142,7 @@ const MultiSelectTrigger = memo(
|
|
|
142
142
|
/* @__PURE__ */ jsxs(
|
|
143
143
|
"div",
|
|
144
144
|
{
|
|
145
|
-
className:
|
|
145
|
+
className: tv.content(),
|
|
146
146
|
onClick: (e) => {
|
|
147
147
|
const target = e.target;
|
|
148
148
|
if (target.closest("[data-remove-button]") || target.closest('button[aria-label*="Remove"]')) {
|
|
@@ -155,7 +155,7 @@ const MultiSelectTrigger = memo(
|
|
|
155
155
|
]
|
|
156
156
|
}
|
|
157
157
|
),
|
|
158
|
-
suffixElement && /* @__PURE__ */ jsx("span", { className:
|
|
158
|
+
suffixElement && /* @__PURE__ */ jsx("span", { className: tv.suffix(), children: suffixElement })
|
|
159
159
|
]
|
|
160
160
|
}
|
|
161
161
|
);
|
|
@@ -105,8 +105,10 @@ const MultiSelectComponent = memo(
|
|
|
105
105
|
apply(args) {
|
|
106
106
|
var _a;
|
|
107
107
|
const { elements, availableHeight, rects } = args;
|
|
108
|
-
const
|
|
109
|
-
const
|
|
108
|
+
const floatingScrollHeight = elements.floating.scrollHeight;
|
|
109
|
+
const scrollRefHeight = ((_a = scrollRef.current) == null ? void 0 : _a.scrollHeight) || 0;
|
|
110
|
+
const contentHeight = Math.max(floatingScrollHeight, scrollRefHeight);
|
|
111
|
+
const maxHeight = contentHeight > 0 ? Math.min(contentHeight, availableHeight) : availableHeight;
|
|
110
112
|
Object.assign(elements.floating.style, {
|
|
111
113
|
maxHeight: `${maxHeight}px`,
|
|
112
114
|
display: "flex",
|
|
@@ -179,7 +181,7 @@ const MultiSelectComponent = memo(
|
|
|
179
181
|
setScrollTop,
|
|
180
182
|
touch,
|
|
181
183
|
isSelect: false,
|
|
182
|
-
//
|
|
184
|
+
// Use dropdown scroll logic
|
|
183
185
|
fallback: false
|
|
184
186
|
});
|
|
185
187
|
const { handleSelect: baseHandleSelect, handleRemove: baseHandleRemove } = useMultiSelectSelection({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TooltipProps } from '../../tooltip/src';
|
|
2
|
+
import { default as react__default, ReactNode, HTMLProps } from 'react';
|
|
2
3
|
import { IconButtonProps } from '../../icon-button/src';
|
|
3
4
|
import { PressMoveProps } from '../../../../../shared/src';
|
|
4
|
-
import
|
|
5
|
-
import * as React$1 from 'react';
|
|
5
|
+
import * as react from 'react';
|
|
6
6
|
|
|
7
7
|
type ElementType = "action" | "handler" | "menu";
|
|
8
8
|
interface NumericInputElementProps {
|
|
@@ -11,18 +11,18 @@ interface NumericInputElementProps {
|
|
|
11
11
|
position?: "prefix" | "suffix";
|
|
12
12
|
type?: ElementType;
|
|
13
13
|
}
|
|
14
|
-
declare const NumericInputElement:
|
|
14
|
+
declare const NumericInputElement: react.MemoExoticComponent<react.ForwardRefExoticComponent<NumericInputElementProps & react.RefAttributes<HTMLDivElement>>>;
|
|
15
15
|
|
|
16
16
|
interface NumericInputMenuTriggerProps extends IconButtonProps {
|
|
17
17
|
className?: string;
|
|
18
18
|
type?: "menu" | "action";
|
|
19
19
|
}
|
|
20
|
-
declare const NumericInputMenuTrigger:
|
|
20
|
+
declare const NumericInputMenuTrigger: react.ForwardRefExoticComponent<Omit<NumericInputMenuTriggerProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
21
21
|
interface NumericInputMenuActionPromptProps extends HTMLProps<HTMLDivElement> {
|
|
22
22
|
children?: React.ReactNode;
|
|
23
23
|
className?: string;
|
|
24
24
|
}
|
|
25
|
-
declare const NumericInputMenuActionPrompt:
|
|
25
|
+
declare const NumericInputMenuActionPrompt: react.ForwardRefExoticComponent<Omit<NumericInputMenuActionPromptProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
26
26
|
|
|
27
27
|
interface NumericInputVariableProps {
|
|
28
28
|
className?: string;
|
|
@@ -30,7 +30,7 @@ interface NumericInputVariableProps {
|
|
|
30
30
|
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
31
31
|
value?: number | null;
|
|
32
32
|
}
|
|
33
|
-
declare const NumericInputVariable:
|
|
33
|
+
declare const NumericInputVariable: react.ForwardRefExoticComponent<NumericInputVariableProps & react.RefAttributes<HTMLDivElement>>;
|
|
34
34
|
|
|
35
35
|
type NumericInputValue = string | number | (string | number | undefined)[] | Record<string, number>;
|
|
36
36
|
type NumberResult = {
|
|
@@ -40,112 +40,6 @@ type NumberResult = {
|
|
|
40
40
|
};
|
|
41
41
|
type NumericChangeDetail = NumberResult;
|
|
42
42
|
|
|
43
|
-
interface UseNumericInputProps<T extends NumericInputValue> extends Omit<HTMLProps<HTMLInputElement>, "value" | "defaultValue" | "onChange" | "onWheel"> {
|
|
44
|
-
containerRef?: React__default.RefObject<HTMLElement>;
|
|
45
|
-
decimal?: number;
|
|
46
|
-
defaultValue?: T;
|
|
47
|
-
disabled?: boolean;
|
|
48
|
-
expression?: string;
|
|
49
|
-
max?: number;
|
|
50
|
-
min?: number;
|
|
51
|
-
onChange?: (value: T, obj: NumberResult) => void;
|
|
52
|
-
onEmpty?: () => void;
|
|
53
|
-
onPressEnd?: PressMoveProps["onPressEnd"];
|
|
54
|
-
onPressStart?: PressMoveProps["onPressStart"];
|
|
55
|
-
readOnly?: boolean;
|
|
56
|
-
ref?: React__default.Ref<HTMLInputElement>;
|
|
57
|
-
shiftStep?: number;
|
|
58
|
-
step?: number;
|
|
59
|
-
value?: T;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* 数值输入控件的主钩子,整合各种交互功能
|
|
63
|
-
* @param props 配置选项
|
|
64
|
-
* @returns 处理状态和事件处理器
|
|
65
|
-
*/
|
|
66
|
-
declare function useNumericInput<T extends NumericInputValue>(props: UseNumericInputProps<T>): {
|
|
67
|
-
handlerPressed: boolean;
|
|
68
|
-
inputProps: {
|
|
69
|
-
onChange: (e: React__default.ChangeEvent<HTMLInputElement>) => void;
|
|
70
|
-
onFocus: (e: React__default.FocusEvent<HTMLInputElement, Element>) => void;
|
|
71
|
-
onBlur: () => void;
|
|
72
|
-
onKeyDown: (e: React__default.KeyboardEvent<HTMLInputElement>) => void;
|
|
73
|
-
ref: (node: HTMLInputElement | null) => void;
|
|
74
|
-
disabled: boolean | undefined;
|
|
75
|
-
readOnly: boolean | undefined;
|
|
76
|
-
value: string;
|
|
77
|
-
};
|
|
78
|
-
handlerProps: {
|
|
79
|
-
ref: (el: HTMLElement | null) => void;
|
|
80
|
-
onPointerDown: (e: React__default.PointerEvent<HTMLElement>) => void;
|
|
81
|
-
style?: React__default.CSSProperties;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* 计算数值步进大小的钩子
|
|
87
|
-
* @param shiftPressed Shift键是否按下
|
|
88
|
-
* @param metaPressed Meta/Alt键是否按下
|
|
89
|
-
* @param shiftStep Shift按下时的步进值
|
|
90
|
-
* @param step 正常步进值
|
|
91
|
-
* @returns 计算步进值的函数
|
|
92
|
-
*/
|
|
93
|
-
declare function useStepCalculation(shiftPressed: boolean, metaPressed: boolean, shiftStep: number, step: number): () => number;
|
|
94
|
-
|
|
95
|
-
interface UseNumericValueProcessingProps<T extends NumericInputValue> {
|
|
96
|
-
decimal?: number;
|
|
97
|
-
defaultValue?: T;
|
|
98
|
-
expression: string;
|
|
99
|
-
max?: number;
|
|
100
|
-
min?: number;
|
|
101
|
-
value?: T;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* 处理数值输入和转换的钩子
|
|
105
|
-
* @param props 数值处理配置
|
|
106
|
-
* @returns 处理后的值和表达式引用
|
|
107
|
-
*/
|
|
108
|
-
declare function useNumericValueProcessing<T extends NumericInputValue>({ value, defaultValue, expression, min, max, decimal, }: UseNumericValueProcessingProps<T>): {
|
|
109
|
-
valuePre: NumberResult | undefined;
|
|
110
|
-
defaultValuePre: NumberResult | undefined;
|
|
111
|
-
expressionRef: React$1.MutableRefObject<string>;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
interface UseInputInteractionsProps<T extends NumericInputValue> {
|
|
115
|
-
decimal?: number;
|
|
116
|
-
disabled?: boolean;
|
|
117
|
-
displayValue: string;
|
|
118
|
-
expression: string;
|
|
119
|
-
getCurrentStep: () => number;
|
|
120
|
-
innerValue?: NumberResult;
|
|
121
|
-
inputRef: RefObject<HTMLInputElement>;
|
|
122
|
-
isFocused: boolean;
|
|
123
|
-
max?: number;
|
|
124
|
-
min?: number;
|
|
125
|
-
onChange?: (value: T, detail: NumberResult) => void;
|
|
126
|
-
onEmpty?: () => void;
|
|
127
|
-
readOnly?: boolean;
|
|
128
|
-
setDisplayValue: (value: string) => void;
|
|
129
|
-
setIsFocused: (focused: boolean) => void;
|
|
130
|
-
setValue: (value: NumberResult | ((prev: NumberResult | undefined) => NumberResult)) => void;
|
|
131
|
-
updateValue: (updateFn?: (value: number) => number) => void;
|
|
132
|
-
value?: T;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* 处理输入框交互的钩子
|
|
136
|
-
* @param props 输入交互配置
|
|
137
|
-
* @returns 输入处理器和初始值引用
|
|
138
|
-
*/
|
|
139
|
-
declare function useInputInteractions<T extends NumericInputValue>({ inputRef, displayValue, setDisplayValue, isFocused, setIsFocused, expression, min, max, decimal, disabled, readOnly, innerValue, setValue, updateValue, getCurrentStep, onChange, onEmpty, value, }: UseInputInteractionsProps<T>): {
|
|
140
|
-
inputHandlers: {
|
|
141
|
-
onChange: (e: React__default.ChangeEvent<HTMLInputElement>) => void;
|
|
142
|
-
onFocus: (e: React__default.FocusEvent<HTMLInputElement, Element>) => void;
|
|
143
|
-
onBlur: () => void;
|
|
144
|
-
onKeyDown: (e: React__default.KeyboardEvent<HTMLInputElement>) => void;
|
|
145
|
-
};
|
|
146
|
-
initialValueRef: React__default.MutableRefObject<string>;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
43
|
interface NumericInputContextValue {
|
|
150
44
|
decimal?: number;
|
|
151
45
|
defaultValue?: NumericInputValue;
|
|
@@ -180,16 +74,15 @@ interface NumericInputProps extends NumericInputContextValue, Omit<HTMLProps<HTM
|
|
|
180
74
|
id?: string;
|
|
181
75
|
onChange?: (value: NumericInputValue, detail: NumericChangeDetail) => void;
|
|
182
76
|
tooltip?: TooltipProps;
|
|
183
|
-
triggerRef?:
|
|
77
|
+
triggerRef?: react__default.RefObject<HTMLDivElement> | ((el: HTMLDivElement | null) => void);
|
|
184
78
|
}
|
|
185
|
-
interface NumericInputComponent extends
|
|
79
|
+
interface NumericInputComponent extends react__default.ForwardRefExoticComponent<NumericInputProps & react__default.RefAttributes<HTMLInputElement>> {
|
|
186
80
|
ActionPrompt: typeof NumericInputMenuActionPrompt;
|
|
187
81
|
MenuTrigger: typeof NumericInputMenuTrigger;
|
|
188
82
|
Prefix: typeof NumericInputElement;
|
|
189
83
|
Suffix: typeof NumericInputElement;
|
|
190
84
|
Variable: typeof NumericInputVariable;
|
|
191
85
|
}
|
|
192
|
-
declare const NumericInputBase: React__default.ForwardRefExoticComponent<Omit<NumericInputProps, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
|
|
193
86
|
declare const NumericInput: NumericInputComponent;
|
|
194
87
|
|
|
195
|
-
export { type
|
|
88
|
+
export { type NumberResult, type NumericChangeDetail, NumericInput, NumericInputElement, type NumericInputElementProps, NumericInputMenuTrigger, type NumericInputMenuTriggerProps, type NumericInputProps, type NumericInputValue, NumericInputVariable, type NumericInputVariableProps };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { Tooltip } from "../../tooltip/dist/index.js";
|
|
1
2
|
import { forwardRef, useRef, useState, useMemo, createContext, cloneElement, memo, useEffect, useCallback, Children, isValidElement, useContext } from "react";
|
|
3
|
+
import { useEventCallback } from "usehooks-ts";
|
|
2
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
5
|
import { IconButton } from "../../icon-button/dist/index.js";
|
|
4
6
|
import { ChevronDownSmall } from "@choiceform/icons-react";
|
|
5
7
|
import { Chip } from "../../chip/dist/index.js";
|
|
6
|
-
import { useEventCallback } from "usehooks-ts";
|
|
7
|
-
import { Tooltip } from "../../tooltip/dist/index.js";
|
|
8
8
|
import { useDisableScroll } from "../../../shared/hooks/use-disable-scroll/use-disable-scroll.js";
|
|
9
9
|
import { mergeProps } from "../../../shared/utils/merge-props/merge-props.js";
|
|
10
10
|
import { mergeRefs } from "../../../shared/utils/merge-refs/merge-refs.js";
|
|
@@ -420,7 +420,7 @@ var NumericInputElement = memo(
|
|
|
420
420
|
const { type = "handler", className, position, children } = props;
|
|
421
421
|
const context = useNumericInputContext();
|
|
422
422
|
const handlerProps = context.handlerProps;
|
|
423
|
-
const
|
|
423
|
+
const tv = NumericInputElementTv({
|
|
424
424
|
type,
|
|
425
425
|
position,
|
|
426
426
|
disabled: context.disabled,
|
|
@@ -434,7 +434,7 @@ var NumericInputElement = memo(
|
|
|
434
434
|
"div",
|
|
435
435
|
{
|
|
436
436
|
ref,
|
|
437
|
-
className: tcx(
|
|
437
|
+
className: tcx(tv, className),
|
|
438
438
|
"data-element-position": position,
|
|
439
439
|
"data-element-type": type,
|
|
440
440
|
...elementProps,
|
|
@@ -448,7 +448,7 @@ var NumericInputMenuTrigger = forwardRef(
|
|
|
448
448
|
(props, ref) => {
|
|
449
449
|
const { className, type = "menu", ...rest } = props;
|
|
450
450
|
const context = useNumericInputContext();
|
|
451
|
-
const
|
|
451
|
+
const tv = NumericInputMenuTriggerTv({
|
|
452
452
|
type,
|
|
453
453
|
disabled: context.disabled,
|
|
454
454
|
variant: context.variant
|
|
@@ -458,7 +458,7 @@ var NumericInputMenuTrigger = forwardRef(
|
|
|
458
458
|
{
|
|
459
459
|
ref,
|
|
460
460
|
variant: type === "menu" ? context.disabled ? "ghost" : "solid" : void 0,
|
|
461
|
-
className: tcx(
|
|
461
|
+
className: tcx(tv, className),
|
|
462
462
|
disabled: context.disabled,
|
|
463
463
|
...rest,
|
|
464
464
|
children: /* @__PURE__ */ jsx(ChevronDownSmall, {})
|
|
@@ -485,17 +485,17 @@ var NumericInputVariable = forwardRef(
|
|
|
485
485
|
(props, ref) => {
|
|
486
486
|
const { onClick, className, hasPrefixElement, value } = props;
|
|
487
487
|
const context = useNumericInputContext();
|
|
488
|
-
const
|
|
488
|
+
const tv = NumericInputVariableTv({
|
|
489
489
|
prefixElement: hasPrefixElement,
|
|
490
490
|
variant: context.variant,
|
|
491
491
|
disabled: context.disabled,
|
|
492
492
|
selected: context.selected
|
|
493
493
|
});
|
|
494
|
-
return /* @__PURE__ */ jsx("div", { className: tcx(
|
|
494
|
+
return /* @__PURE__ */ jsx("div", { className: tcx(tv.root(), className), children: /* @__PURE__ */ jsx(
|
|
495
495
|
Chip,
|
|
496
496
|
{
|
|
497
497
|
as: "button",
|
|
498
|
-
className:
|
|
498
|
+
className: tv.chip(),
|
|
499
499
|
ref,
|
|
500
500
|
onClick: (e) => {
|
|
501
501
|
e.stopPropagation();
|
|
@@ -1094,7 +1094,7 @@ var NumericInputBase = forwardRef((props, ref) => {
|
|
|
1094
1094
|
const contextValue = useMemo(
|
|
1095
1095
|
() => ({
|
|
1096
1096
|
variant,
|
|
1097
|
-
//
|
|
1097
|
+
// State
|
|
1098
1098
|
value,
|
|
1099
1099
|
defaultValue,
|
|
1100
1100
|
disabled,
|
|
@@ -1102,20 +1102,20 @@ var NumericInputBase = forwardRef((props, ref) => {
|
|
|
1102
1102
|
selected,
|
|
1103
1103
|
focused,
|
|
1104
1104
|
handlerPressed,
|
|
1105
|
-
//
|
|
1105
|
+
// Configuration
|
|
1106
1106
|
min,
|
|
1107
1107
|
max,
|
|
1108
1108
|
step,
|
|
1109
1109
|
shiftStep,
|
|
1110
1110
|
decimal,
|
|
1111
1111
|
expression,
|
|
1112
|
-
//
|
|
1112
|
+
// Event handling methods
|
|
1113
1113
|
onChange,
|
|
1114
1114
|
onEmpty,
|
|
1115
1115
|
onPressStart,
|
|
1116
1116
|
onPressEnd,
|
|
1117
1117
|
onIsEditingChange,
|
|
1118
|
-
//
|
|
1118
|
+
// Handler props
|
|
1119
1119
|
handlerProps
|
|
1120
1120
|
}),
|
|
1121
1121
|
[
|
|
@@ -1173,7 +1173,7 @@ var NumericInputBase = forwardRef((props, ref) => {
|
|
|
1173
1173
|
const suffixNode = suffix[0] || null;
|
|
1174
1174
|
const variableNode = variable[0] || null;
|
|
1175
1175
|
const actionPromptNode = actionPrompt[0] || null;
|
|
1176
|
-
const
|
|
1176
|
+
const tv = NumericInputTv({
|
|
1177
1177
|
variant,
|
|
1178
1178
|
selected: selected || handlerPressed,
|
|
1179
1179
|
focused,
|
|
@@ -1186,7 +1186,7 @@ var NumericInputBase = forwardRef((props, ref) => {
|
|
|
1186
1186
|
"div",
|
|
1187
1187
|
{
|
|
1188
1188
|
ref: triggerRef,
|
|
1189
|
-
className: tcx(
|
|
1189
|
+
className: tcx(tv.container(), classNames == null ? void 0 : classNames.container, className),
|
|
1190
1190
|
onMouseDown: (e) => {
|
|
1191
1191
|
e.stopPropagation();
|
|
1192
1192
|
},
|
|
@@ -1207,7 +1207,7 @@ var NumericInputBase = forwardRef((props, ref) => {
|
|
|
1207
1207
|
autoComplete: "off",
|
|
1208
1208
|
spellCheck: false,
|
|
1209
1209
|
required,
|
|
1210
|
-
className: tcx("[grid-area:input]",
|
|
1210
|
+
className: tcx("[grid-area:input]", tv.input(), classNames == null ? void 0 : classNames.input),
|
|
1211
1211
|
disabled,
|
|
1212
1212
|
"aria-label": ariaLabel,
|
|
1213
1213
|
"aria-describedby": ariaDescribedby,
|
|
@@ -1223,7 +1223,7 @@ var NumericInputBase = forwardRef((props, ref) => {
|
|
|
1223
1223
|
"span",
|
|
1224
1224
|
{
|
|
1225
1225
|
tabIndex: -1,
|
|
1226
|
-
className:
|
|
1226
|
+
className: tv.tooltip(),
|
|
1227
1227
|
onFocusCapture: () => {
|
|
1228
1228
|
if (inputRef.current) {
|
|
1229
1229
|
inputRef.current.focus();
|
|
@@ -1250,13 +1250,7 @@ var NumericInput = Object.assign(NumericInputBase, {
|
|
|
1250
1250
|
});
|
|
1251
1251
|
export {
|
|
1252
1252
|
NumericInput,
|
|
1253
|
-
NumericInputBase,
|
|
1254
1253
|
NumericInputElement,
|
|
1255
|
-
NumericInputMenuActionPrompt,
|
|
1256
1254
|
NumericInputMenuTrigger,
|
|
1257
|
-
NumericInputVariable
|
|
1258
|
-
useInputInteractions,
|
|
1259
|
-
useNumericInput,
|
|
1260
|
-
useNumericValueProcessing,
|
|
1261
|
-
useStepCalculation
|
|
1255
|
+
NumericInputVariable
|
|
1262
1256
|
};
|