@choice-ui/react 1.4.3 → 1.4.5
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 +15 -340
- 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 +2 -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/mention-spacing.js +1 -27
- package/dist/components/context-input/src/utils/slate-converters.d.ts +6 -6
- package/dist/components/context-input/src/utils/slate-converters.js +3 -69
- 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 +50 -195
- 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
|
@@ -8,7 +8,7 @@ const NumericInputElement = memo(
|
|
|
8
8
|
const { type = "handler", className, position, children } = props;
|
|
9
9
|
const context = useNumericInputContext();
|
|
10
10
|
const handlerProps = context.handlerProps;
|
|
11
|
-
const
|
|
11
|
+
const tv = NumericInputElementTv({
|
|
12
12
|
type,
|
|
13
13
|
position,
|
|
14
14
|
disabled: context.disabled,
|
|
@@ -22,7 +22,7 @@ const NumericInputElement = memo(
|
|
|
22
22
|
"div",
|
|
23
23
|
{
|
|
24
24
|
ref,
|
|
25
|
-
className: tcx(
|
|
25
|
+
className: tcx(tv, className),
|
|
26
26
|
"data-element-position": position,
|
|
27
27
|
"data-element-type": type,
|
|
28
28
|
...elementProps,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IconButtonProps } from '../../../icon-button/src';
|
|
2
2
|
import { HTMLProps } from 'react';
|
|
3
|
-
interface NumericInputMenuTriggerProps extends IconButtonProps {
|
|
3
|
+
export interface NumericInputMenuTriggerProps extends IconButtonProps {
|
|
4
4
|
className?: string;
|
|
5
5
|
type?: "menu" | "action";
|
|
6
6
|
}
|
|
@@ -9,7 +9,7 @@ const NumericInputMenuTrigger = forwardRef(
|
|
|
9
9
|
(props, ref) => {
|
|
10
10
|
const { className, type = "menu", ...rest } = props;
|
|
11
11
|
const context = useNumericInputContext();
|
|
12
|
-
const
|
|
12
|
+
const tv = NumericInputMenuTriggerTv({
|
|
13
13
|
type,
|
|
14
14
|
disabled: context.disabled,
|
|
15
15
|
variant: context.variant
|
|
@@ -19,7 +19,7 @@ const NumericInputMenuTrigger = forwardRef(
|
|
|
19
19
|
{
|
|
20
20
|
ref,
|
|
21
21
|
variant: type === "menu" ? context.disabled ? "ghost" : "solid" : void 0,
|
|
22
|
-
className: tcx(
|
|
22
|
+
className: tcx(tv, className),
|
|
23
23
|
disabled: context.disabled,
|
|
24
24
|
...rest,
|
|
25
25
|
children: /* @__PURE__ */ jsx(ChevronDownSmall, {})
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
interface NumericInputVariableProps {
|
|
1
|
+
export interface NumericInputVariableProps {
|
|
2
2
|
className?: string;
|
|
3
3
|
hasPrefixElement?: boolean;
|
|
4
4
|
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
5
5
|
value?: number | null;
|
|
6
6
|
}
|
|
7
7
|
export declare const NumericInputVariable: import('react').ForwardRefExoticComponent<NumericInputVariableProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
8
|
-
export {};
|
|
@@ -8,17 +8,17 @@ const NumericInputVariable = forwardRef(
|
|
|
8
8
|
(props, ref) => {
|
|
9
9
|
const { onClick, className, hasPrefixElement, value } = props;
|
|
10
10
|
const context = useNumericInputContext();
|
|
11
|
-
const
|
|
11
|
+
const tv = NumericInputVariableTv({
|
|
12
12
|
prefixElement: hasPrefixElement,
|
|
13
13
|
variant: context.variant,
|
|
14
14
|
disabled: context.disabled,
|
|
15
15
|
selected: context.selected
|
|
16
16
|
});
|
|
17
|
-
return /* @__PURE__ */ jsx("div", { className: tcx(
|
|
17
|
+
return /* @__PURE__ */ jsx("div", { className: tcx(tv.root(), className), children: /* @__PURE__ */ jsx(
|
|
18
18
|
Chip,
|
|
19
19
|
{
|
|
20
20
|
as: "button",
|
|
21
|
-
className:
|
|
21
|
+
className: tv.chip(),
|
|
22
22
|
ref,
|
|
23
23
|
onClick: (e) => {
|
|
24
24
|
e.stopPropagation();
|
|
@@ -21,9 +21,9 @@ interface UseInputInteractionsProps<T extends NumericInputValue> {
|
|
|
21
21
|
value?: T;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
* @param props
|
|
26
|
-
* @returns
|
|
24
|
+
* Hook to handle input box interactions
|
|
25
|
+
* @param props Input interaction configuration
|
|
26
|
+
* @returns Input handlers and initial value reference
|
|
27
27
|
*/
|
|
28
28
|
export 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>): {
|
|
29
29
|
inputHandlers: {
|
|
@@ -20,9 +20,9 @@ interface UseNumericInputProps<T extends NumericInputValue> extends Omit<HTMLPro
|
|
|
20
20
|
value?: T;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
* @param props
|
|
25
|
-
* @returns
|
|
23
|
+
* Main hook for numeric input component, integrating various interaction features
|
|
24
|
+
* @param props Configuration options
|
|
25
|
+
* @returns State management and event handlers
|
|
26
26
|
*/
|
|
27
27
|
export declare function useNumericInput<T extends NumericInputValue>(props: UseNumericInputProps<T>): {
|
|
28
28
|
handlerPressed: boolean;
|
|
@@ -8,9 +8,9 @@ interface UseNumericValueProcessingProps<T extends NumericInputValue> {
|
|
|
8
8
|
value?: T;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* @param props
|
|
13
|
-
* @returns
|
|
11
|
+
* Hook to handle numeric input and conversion
|
|
12
|
+
* @param props Numeric processing configuration
|
|
13
|
+
* @returns Processed value and expression reference
|
|
14
14
|
*/
|
|
15
15
|
export declare function useNumericValueProcessing<T extends NumericInputValue>({ value, defaultValue, expression, min, max, decimal, }: UseNumericValueProcessingProps<T>): {
|
|
16
16
|
valuePre: import('../../..').NumberResult | undefined;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @param shiftPressed Shift
|
|
4
|
-
* @param metaPressed Meta/Alt
|
|
5
|
-
* @param shiftStep Shift
|
|
6
|
-
* @param step
|
|
7
|
-
* @returns
|
|
2
|
+
* Hook to calculate the step size of numeric input
|
|
3
|
+
* @param shiftPressed Whether Shift key is pressed
|
|
4
|
+
* @param metaPressed Whether Meta/Alt key is pressed
|
|
5
|
+
* @param shiftStep Step size when Shift key is pressed
|
|
6
|
+
* @param step Normal step size
|
|
7
|
+
* @returns Function to calculate step size
|
|
8
8
|
*/
|
|
9
9
|
export declare function useStepCalculation(shiftPressed: boolean, metaPressed: boolean, shiftStep: number, step: number): () => number;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export type {
|
|
1
|
+
export { NumericInput } from './numeric-input';
|
|
2
|
+
export { NumericInputElement, NumericInputMenuTrigger, NumericInputVariable } from './components';
|
|
3
|
+
export type { NumericInputProps } from './numeric-input';
|
|
4
|
+
export type { NumericInputElementProps, NumericInputMenuTriggerProps, NumericInputVariableProps, } from './components';
|
|
5
|
+
export type { NumberResult, NumericChangeDetail, NumericInputValue } from './types';
|
|
@@ -3,9 +3,9 @@ import { Tooltip } from "../../tooltip/dist/index.js";
|
|
|
3
3
|
import { forwardRef, useRef, useState, useMemo, cloneElement, Children, isValidElement } from "react";
|
|
4
4
|
import { useEventCallback } from "usehooks-ts";
|
|
5
5
|
import { NumericInputTv } from "./tv.js";
|
|
6
|
+
import { NumericInputMenuTrigger, NumericInputMenuActionPrompt } from "./components/numeric-input-menu-trigger.js";
|
|
6
7
|
import { useNumericInput } from "./hooks/use-numeric-input.js";
|
|
7
8
|
import { NumericInputContext } from "./context/numeric-input-context.js";
|
|
8
|
-
import { NumericInputMenuTrigger, NumericInputMenuActionPrompt } from "./components/numeric-input-menu-trigger.js";
|
|
9
9
|
import { NumericInputVariable } from "./components/numeric-input-variable.js";
|
|
10
10
|
import { NumericInputElement } from "./components/numeric-input-element.js";
|
|
11
11
|
import { mergeRefs } from "../../../shared/utils/merge-refs/merge-refs.js";
|
|
@@ -79,7 +79,7 @@ const NumericInputBase = forwardRef((props, ref) => {
|
|
|
79
79
|
const contextValue = useMemo(
|
|
80
80
|
() => ({
|
|
81
81
|
variant,
|
|
82
|
-
//
|
|
82
|
+
// State
|
|
83
83
|
value,
|
|
84
84
|
defaultValue,
|
|
85
85
|
disabled,
|
|
@@ -87,20 +87,20 @@ const NumericInputBase = forwardRef((props, ref) => {
|
|
|
87
87
|
selected,
|
|
88
88
|
focused,
|
|
89
89
|
handlerPressed,
|
|
90
|
-
//
|
|
90
|
+
// Configuration
|
|
91
91
|
min,
|
|
92
92
|
max,
|
|
93
93
|
step,
|
|
94
94
|
shiftStep,
|
|
95
95
|
decimal,
|
|
96
96
|
expression,
|
|
97
|
-
//
|
|
97
|
+
// Event handling methods
|
|
98
98
|
onChange,
|
|
99
99
|
onEmpty,
|
|
100
100
|
onPressStart,
|
|
101
101
|
onPressEnd,
|
|
102
102
|
onIsEditingChange,
|
|
103
|
-
//
|
|
103
|
+
// Handler props
|
|
104
104
|
handlerProps
|
|
105
105
|
}),
|
|
106
106
|
[
|
|
@@ -158,7 +158,7 @@ const NumericInputBase = forwardRef((props, ref) => {
|
|
|
158
158
|
const suffixNode = suffix[0] || null;
|
|
159
159
|
const variableNode = variable[0] || null;
|
|
160
160
|
const actionPromptNode = actionPrompt[0] || null;
|
|
161
|
-
const
|
|
161
|
+
const tv = NumericInputTv({
|
|
162
162
|
variant,
|
|
163
163
|
selected: selected || handlerPressed,
|
|
164
164
|
focused,
|
|
@@ -171,7 +171,7 @@ const NumericInputBase = forwardRef((props, ref) => {
|
|
|
171
171
|
"div",
|
|
172
172
|
{
|
|
173
173
|
ref: triggerRef,
|
|
174
|
-
className: tcx(
|
|
174
|
+
className: tcx(tv.container(), classNames == null ? void 0 : classNames.container, className),
|
|
175
175
|
onMouseDown: (e) => {
|
|
176
176
|
e.stopPropagation();
|
|
177
177
|
},
|
|
@@ -192,7 +192,7 @@ const NumericInputBase = forwardRef((props, ref) => {
|
|
|
192
192
|
autoComplete: "off",
|
|
193
193
|
spellCheck: false,
|
|
194
194
|
required,
|
|
195
|
-
className: tcx("[grid-area:input]",
|
|
195
|
+
className: tcx("[grid-area:input]", tv.input(), classNames == null ? void 0 : classNames.input),
|
|
196
196
|
disabled,
|
|
197
197
|
"aria-label": ariaLabel,
|
|
198
198
|
"aria-describedby": ariaDescribedby,
|
|
@@ -208,7 +208,7 @@ const NumericInputBase = forwardRef((props, ref) => {
|
|
|
208
208
|
"span",
|
|
209
209
|
{
|
|
210
210
|
tabIndex: -1,
|
|
211
|
-
className:
|
|
211
|
+
className: tv.tooltip(),
|
|
212
212
|
onFocusCapture: () => {
|
|
213
213
|
if (inputRef.current) {
|
|
214
214
|
inputRef.current.focus();
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Custom error type
|
|
3
3
|
*/
|
|
4
4
|
export declare class NumericInputError extends Error {
|
|
5
5
|
code: string;
|
|
6
6
|
constructor(message: string, code?: string);
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Expression parsing error
|
|
10
10
|
*/
|
|
11
11
|
export declare class ExpressionParseError extends NumericInputError {
|
|
12
12
|
constructor(expression: string, details?: string);
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Pattern parsing error
|
|
16
16
|
*/
|
|
17
17
|
export declare class PatternParseError extends NumericInputError {
|
|
18
18
|
constructor(pattern: string, details?: string);
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Input value type error
|
|
22
22
|
*/
|
|
23
23
|
export declare class InvalidInputTypeError extends NumericInputError {
|
|
24
24
|
constructor(input: any, expectedType?: string);
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
* @param fn
|
|
29
|
-
* @param fallback
|
|
30
|
-
* @returns
|
|
27
|
+
* Safe error handling wrapper
|
|
28
|
+
* @param fn Function to execute
|
|
29
|
+
* @param fallback Default return value when error occurs
|
|
30
|
+
* @returns Function execution result or default value
|
|
31
31
|
*/
|
|
32
32
|
export declare function safeExecute<T, R>(fn: (arg: T) => R, arg: T, fallback: R): R;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { Operation } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Execute binary operation
|
|
4
4
|
* @param op 操作符
|
|
5
|
-
* @param b
|
|
6
|
-
* @param a
|
|
7
|
-
* @returns
|
|
5
|
+
* @param b Right operand
|
|
6
|
+
* @param a Left operand
|
|
7
|
+
* @returns Calculation result
|
|
8
8
|
*/
|
|
9
9
|
export declare const applyOperation: (op: Operation, b: number, a: number) => number;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* @param expression
|
|
13
|
-
* @returns
|
|
11
|
+
* Evaluate mathematical expression and return calculation result
|
|
12
|
+
* @param expression Mathematical expression string
|
|
13
|
+
* @returns Calculation result of the expression
|
|
14
14
|
*/
|
|
15
15
|
export declare const evaluate: (expression: string) => number;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
* @param fn
|
|
19
|
-
* @returns
|
|
17
|
+
* Memoized wrapper function, used to cache expression calculation results
|
|
18
|
+
* @param fn Original function
|
|
19
|
+
* @returns Function with caching functionality
|
|
20
20
|
*/
|
|
21
21
|
export declare function memoize<T extends string, R>(fn: (arg: T) => R): (arg: T) => R;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Memoized expression calculation function
|
|
24
24
|
*/
|
|
25
25
|
export declare const memoizedEvaluate: (arg: string) => number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { NumericInputValue } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* @param input
|
|
5
|
-
* @returns
|
|
3
|
+
* Parse input value, support string, number, array and object types
|
|
4
|
+
* @param input Input value
|
|
5
|
+
* @returns Parsed number array
|
|
6
6
|
*/
|
|
7
7
|
export declare function parseInputValue(input: NumericInputValue): {
|
|
8
8
|
values: number[];
|
|
@@ -10,10 +10,10 @@ export declare function parseInputValue(input: NumericInputValue): {
|
|
|
10
10
|
isObjectNumber: boolean;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
* @param input
|
|
15
|
-
* @param regex
|
|
16
|
-
* @param keys
|
|
17
|
-
* @returns
|
|
13
|
+
* Extract variable values from input string
|
|
14
|
+
* @param input Input string
|
|
15
|
+
* @param regex Matching regular expression
|
|
16
|
+
* @param keys Variable key array
|
|
17
|
+
* @returns Extracted variable values
|
|
18
18
|
*/
|
|
19
19
|
export declare function extractValuesFromString(input: string, regex: RegExp, keys: string[]): Record<string, number> | null;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { DealWithNumericValueOptions, NumberResult } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* @param options
|
|
5
|
-
* @returns
|
|
3
|
+
* Safe handling of numeric input, capture exceptions and return undefined
|
|
4
|
+
* @param options Input options
|
|
5
|
+
* @returns Processing result or undefined (when error occurs)
|
|
6
6
|
*/
|
|
7
7
|
export declare const dealWithNumericValueCatch: (options: DealWithNumericValueOptions) => NumberResult | undefined;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @param options
|
|
11
|
-
* @returns
|
|
9
|
+
* Main processing function: process various types of numeric input and apply constraints
|
|
10
|
+
* @param options Input options
|
|
11
|
+
* @returns Processing result object
|
|
12
12
|
*/
|
|
13
13
|
export declare const dealWithNumericInputValue: ({ input, pattern, call, max, min, decimal, }: DealWithNumericValueOptions) => NumberResult;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @param pattern
|
|
4
|
-
* @returns
|
|
2
|
+
* Parse pattern string, extract variable keys
|
|
3
|
+
* @param pattern Pattern string (e.g. "{value}px")
|
|
4
|
+
* @returns Parsed result, containing variable keys and regular expression
|
|
5
5
|
*/
|
|
6
6
|
export declare function parsePattern(pattern: string): {
|
|
7
7
|
keys: string[];
|
|
@@ -9,9 +9,9 @@ export declare function parsePattern(pattern: string): {
|
|
|
9
9
|
regexPattern: string;
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @param pattern
|
|
14
|
-
* @param result
|
|
15
|
-
* @returns
|
|
12
|
+
* Format result, apply variable values to pattern string
|
|
13
|
+
* @param pattern Pattern string
|
|
14
|
+
* @param result Variable value object
|
|
15
|
+
* @returns Formatted string
|
|
16
16
|
*/
|
|
17
17
|
export declare function formatResult(pattern: string, result: Record<string, number>): string;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { NumberResult } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* @param array1
|
|
5
|
-
* @param array2
|
|
6
|
-
* @returns
|
|
3
|
+
* Compare two numeric arrays whether they are the same
|
|
4
|
+
* @param array1 First array
|
|
5
|
+
* @param array2 Second array
|
|
6
|
+
* @returns Whether they are the same
|
|
7
7
|
*/
|
|
8
8
|
export declare function compareNumericArrays(array1: number[] | undefined, array2: number[] | undefined): boolean;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @param object1
|
|
12
|
-
* @param object2
|
|
13
|
-
* @returns
|
|
10
|
+
* Compare two objects whether they are the same
|
|
11
|
+
* @param object1 First object
|
|
12
|
+
* @param object2 Second object
|
|
13
|
+
* @returns Whether they are the same
|
|
14
14
|
*/
|
|
15
15
|
export declare function compareNumericObjects(object1: Record<string, number> | undefined, object2: Record<string, number> | undefined): boolean;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
* @param result1
|
|
19
|
-
* @param result2
|
|
20
|
-
* @returns
|
|
17
|
+
* Compare two NumberResult whether they are the same
|
|
18
|
+
* @param result1 First result
|
|
19
|
+
* @param result2 Second result
|
|
20
|
+
* @returns Whether they are the same
|
|
21
21
|
*/
|
|
22
22
|
export declare function compareNumberResults(result1: NumberResult | undefined, result2: NumberResult | undefined): boolean;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
* @param displayValue
|
|
26
|
-
* @param processedValue
|
|
27
|
-
* @returns
|
|
24
|
+
* Check whether it is an expression input
|
|
25
|
+
* @param displayValue Display value
|
|
26
|
+
* @param processedValue Processed value
|
|
27
|
+
* @returns Whether it is an expression input
|
|
28
28
|
*/
|
|
29
29
|
export declare function isExpressionInput(displayValue: string, processedValue: NumberResult): boolean;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @param value
|
|
4
|
-
* @param min
|
|
5
|
-
* @param max
|
|
6
|
-
* @param decimal
|
|
7
|
-
* @returns
|
|
2
|
+
* Apply numeric constraints (minimum value, maximum value, decimal places)
|
|
3
|
+
* @param value Original value
|
|
4
|
+
* @param min Minimum value
|
|
5
|
+
* @param max Maximum value
|
|
6
|
+
* @param decimal Decimal places
|
|
7
|
+
* @returns Processed value
|
|
8
8
|
*/
|
|
9
9
|
export declare function applyConstraints(value: number, min?: number, max?: number, decimal?: number): number;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* @param values
|
|
13
|
-
* @param min
|
|
14
|
-
* @param max
|
|
15
|
-
* @param decimal
|
|
11
|
+
* Batch apply constraints to multiple values
|
|
12
|
+
* @param values Value object
|
|
13
|
+
* @param min Minimum value
|
|
14
|
+
* @param max Maximum value
|
|
15
|
+
* @param decimal Decimal places
|
|
16
16
|
*/
|
|
17
17
|
export declare function applyConstraintsToValues(values: Record<string, number>, min?: number, max?: number, decimal?: number): void;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
* @param values
|
|
21
|
-
* @param transformFn
|
|
19
|
+
* Apply custom transformation function to values
|
|
20
|
+
* @param values Value object
|
|
21
|
+
* @param transformFn Transformation function
|
|
22
22
|
*/
|
|
23
23
|
export declare function applyTransform(values: Record<string, number>, transformFn?: (value: number) => number): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Segmented } from "../../../segmented/dist/index.js";
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
|
-
import { usePaginationContext } from "
|
|
4
|
+
import { usePaginationContext } from "../context/pagination-context.js";
|
|
5
5
|
import { tcx } from "../../../../shared/utils/tcx/tcx.js";
|
|
6
6
|
const PaginationItemsPerPage = forwardRef(
|
|
7
7
|
(props, ref) => {
|
|
@@ -3,25 +3,25 @@ import { Button } from "../../../button/dist/index.js";
|
|
|
3
3
|
import { EllipsisSmall } from "@choiceform/icons-react";
|
|
4
4
|
import { forwardRef } from "react";
|
|
5
5
|
import { paginationTv } from "../tv.js";
|
|
6
|
-
import { usePaginationContext } from "
|
|
6
|
+
import { usePaginationContext } from "../context/pagination-context.js";
|
|
7
7
|
import { tcx } from "../../../../shared/utils/tcx/tcx.js";
|
|
8
8
|
const PaginationNavigation = forwardRef(
|
|
9
9
|
(props, ref) => {
|
|
10
10
|
const { className, variant = (isActive) => isActive ? "solid" : "ghost", ...rest } = props;
|
|
11
11
|
const { currentPage, pageNumbers, handlePageChange, labels, disabled, loading } = usePaginationContext();
|
|
12
|
-
const
|
|
12
|
+
const tv = paginationTv();
|
|
13
13
|
return /* @__PURE__ */ jsx(
|
|
14
14
|
"div",
|
|
15
15
|
{
|
|
16
16
|
ref,
|
|
17
|
-
className: tcx(
|
|
17
|
+
className: tcx(tv.pages(), className),
|
|
18
18
|
...rest,
|
|
19
19
|
children: pageNumbers.map((pageNumber, index) => {
|
|
20
20
|
if (pageNumber === "ellipsis") {
|
|
21
21
|
return /* @__PURE__ */ jsx(
|
|
22
22
|
"div",
|
|
23
23
|
{
|
|
24
|
-
className:
|
|
24
|
+
className: tv.ellipsis(),
|
|
25
25
|
children: /* @__PURE__ */ jsx(EllipsisSmall, {})
|
|
26
26
|
},
|
|
27
27
|
`ellipsis-${index}`
|
|
@@ -37,7 +37,7 @@ const PaginationNavigation = forwardRef(
|
|
|
37
37
|
onClick: () => handlePageChange(pageNumber),
|
|
38
38
|
"aria-label": `${labels.page} ${pageNumber}`,
|
|
39
39
|
"aria-current": isActive ? "page" : void 0,
|
|
40
|
-
className:
|
|
40
|
+
className: tv.pageButton({ active: isActive }),
|
|
41
41
|
children: pageNumber
|
|
42
42
|
},
|
|
43
43
|
pageNumber
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { paginationTv } from "../tv.js";
|
|
4
|
-
import { PaginationContext } from "./pagination-context.js";
|
|
5
4
|
import { getDefaultLabels } from "../utils/pagination-helpers.js";
|
|
6
5
|
import { usePagination } from "../hooks/use-pagination.js";
|
|
6
|
+
import { PaginationContext } from "../context/pagination-context.js";
|
|
7
7
|
import { tcx } from "../../../../shared/utils/tcx/tcx.js";
|
|
8
8
|
const PaginationRoot = forwardRef((props, ref) => {
|
|
9
9
|
const {
|
|
@@ -40,7 +40,7 @@ const PaginationRoot = forwardRef((props, ref) => {
|
|
|
40
40
|
onItemsPerPageChange,
|
|
41
41
|
disabled
|
|
42
42
|
});
|
|
43
|
-
const
|
|
43
|
+
const tv = paginationTv();
|
|
44
44
|
if (totalItems === 0) {
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
@@ -66,7 +66,7 @@ const PaginationRoot = forwardRef((props, ref) => {
|
|
|
66
66
|
"div",
|
|
67
67
|
{
|
|
68
68
|
ref,
|
|
69
|
-
className: tcx(
|
|
69
|
+
className: tcx(tv.root(), className),
|
|
70
70
|
...rest,
|
|
71
71
|
children
|
|
72
72
|
}
|
|
@@ -4,7 +4,7 @@ import { ChevronLeftMedium, ChevronRightMedium } from "@choiceform/icons-react";
|
|
|
4
4
|
import { forwardRef, useState, useRef, useEffect } from "react";
|
|
5
5
|
import { useOnClickOutside, useEventCallback } from "usehooks-ts";
|
|
6
6
|
import { paginationSpinnerTv } from "../tv.js";
|
|
7
|
-
import { usePaginationContext } from "
|
|
7
|
+
import { usePaginationContext } from "../context/pagination-context.js";
|
|
8
8
|
import { tcx } from "../../../../shared/utils/tcx/tcx.js";
|
|
9
9
|
const PaginationSpinner = forwardRef(
|
|
10
10
|
(props, ref) => {
|
|
@@ -20,7 +20,7 @@ const PaginationSpinner = forwardRef(
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const { currentPage, totalPages, handlePageChange, disabled } = usePaginationContext();
|
|
23
|
-
const
|
|
23
|
+
const tv = paginationSpinnerTv();
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
if (isEditing) {
|
|
26
26
|
setInputValue(currentPage.toString());
|
|
@@ -29,15 +29,17 @@ const PaginationSpinner = forwardRef(
|
|
|
29
29
|
useEffect(() => {
|
|
30
30
|
if (isEditing && inputRef.current) {
|
|
31
31
|
inputRef.current.focus();
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
if (inputRef.current.type === "number") return;
|
|
33
|
+
const timer = setTimeout(() => {
|
|
34
|
+
const el = inputRef.current;
|
|
35
|
+
if (!el) return;
|
|
36
|
+
if (el.type === "number") return;
|
|
37
|
+
try {
|
|
38
|
+
el.setSelectionRange(0, el.value.length);
|
|
39
|
+
} catch {
|
|
40
|
+
}
|
|
41
|
+
}, 0);
|
|
42
|
+
return () => clearTimeout(timer);
|
|
41
43
|
}
|
|
42
44
|
}, [isEditing]);
|
|
43
45
|
const handleInputChange = useEventCallback((e) => {
|
|
@@ -77,7 +79,7 @@ const PaginationSpinner = forwardRef(
|
|
|
77
79
|
"div",
|
|
78
80
|
{
|
|
79
81
|
ref,
|
|
80
|
-
className: tcx(
|
|
82
|
+
className: tcx(tv.spinner(), className),
|
|
81
83
|
...rest,
|
|
82
84
|
children: [
|
|
83
85
|
/* @__PURE__ */ jsx(
|
|
@@ -87,7 +89,7 @@ const PaginationSpinner = forwardRef(
|
|
|
87
89
|
disabled: currentPage === 1 || disabled,
|
|
88
90
|
onClick: handlePrevious,
|
|
89
91
|
"aria-label": "Previous page",
|
|
90
|
-
className:
|
|
92
|
+
className: tv.button({ position: "left" }),
|
|
91
93
|
children: /* @__PURE__ */ jsx(ChevronLeftMedium, {})
|
|
92
94
|
}
|
|
93
95
|
),
|
|
@@ -95,7 +97,7 @@ const PaginationSpinner = forwardRef(
|
|
|
95
97
|
"div",
|
|
96
98
|
{
|
|
97
99
|
ref: inputWrapperRef,
|
|
98
|
-
className:
|
|
100
|
+
className: tv.inputWrapper(),
|
|
99
101
|
onClick: () => {
|
|
100
102
|
if (!isEditing) {
|
|
101
103
|
setIsEditing(true);
|
|
@@ -110,16 +112,15 @@ const PaginationSpinner = forwardRef(
|
|
|
110
112
|
onChange: handleInputChange,
|
|
111
113
|
onBlur: handleInputBlur,
|
|
112
114
|
onKeyDown: handleInputKeyDown,
|
|
113
|
-
onFocus: (e) => e.target.select(),
|
|
114
115
|
type: "number",
|
|
115
116
|
min: 1,
|
|
116
117
|
max: totalPages,
|
|
117
118
|
disabled,
|
|
118
|
-
className:
|
|
119
|
+
className: tv.input(),
|
|
119
120
|
autoFocus: true
|
|
120
121
|
}
|
|
121
|
-
) : /* @__PURE__ */ jsx("span", { className: tcx(
|
|
122
|
-
/* @__PURE__ */ jsxs("span", { className:
|
|
122
|
+
) : /* @__PURE__ */ jsx("span", { className: tcx(tv.currentPage()), children: currentPage }),
|
|
123
|
+
/* @__PURE__ */ jsxs("span", { className: tv.label(), children: [
|
|
123
124
|
"/ ",
|
|
124
125
|
totalPages
|
|
125
126
|
] })
|
|
@@ -133,7 +134,7 @@ const PaginationSpinner = forwardRef(
|
|
|
133
134
|
disabled: currentPage === totalPages || disabled,
|
|
134
135
|
onClick: handleNext,
|
|
135
136
|
"aria-label": "Next page",
|
|
136
|
-
className:
|
|
137
|
+
className: tv.button({ position: "right" }),
|
|
137
138
|
children: /* @__PURE__ */ jsx(ChevronRightMedium, {})
|
|
138
139
|
}
|
|
139
140
|
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './pagination-context';
|