@knitui/components 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/Accordion/Accordion.js +10 -6
- package/lib/commonjs/Accordion/Accordion.js.map +1 -1
- package/lib/commonjs/Alert/Alert.js +31 -11
- package/lib/commonjs/Alert/Alert.js.map +1 -1
- package/lib/commonjs/AngleSlider/AngleSlider.js +55 -17
- package/lib/commonjs/AngleSlider/AngleSlider.js.map +1 -1
- package/lib/commonjs/Autocomplete/Autocomplete.js +53 -33
- package/lib/commonjs/Autocomplete/Autocomplete.js.map +1 -1
- package/lib/commonjs/Badge/Badge.js +6 -9
- package/lib/commonjs/Badge/Badge.js.map +1 -1
- package/lib/commonjs/Button/Button.js +22 -6
- package/lib/commonjs/Button/Button.js.map +1 -1
- package/lib/commonjs/Card/Card.js +13 -4
- package/lib/commonjs/Card/Card.js.map +1 -1
- package/lib/commonjs/Checkbox/CheckIcon.js +10 -6
- package/lib/commonjs/Checkbox/CheckIcon.js.map +1 -1
- package/lib/commonjs/Checkbox/Checkbox.js +9 -2
- package/lib/commonjs/Checkbox/Checkbox.js.map +1 -1
- package/lib/commonjs/Chip/Chip.js +15 -16
- package/lib/commonjs/Chip/Chip.js.map +1 -1
- package/lib/commonjs/CloseButton/CloseButton.js +2 -2
- package/lib/commonjs/CloseButton/CloseButton.js.map +1 -1
- package/lib/commonjs/ColorInput/ColorInput.js +12 -4
- package/lib/commonjs/ColorInput/ColorInput.js.map +1 -1
- package/lib/commonjs/ColorPicker/ColorPicker.js +32 -24
- package/lib/commonjs/ColorPicker/ColorPicker.js.map +1 -1
- package/lib/commonjs/Combobox/Combobox.js +11 -6
- package/lib/commonjs/Combobox/Combobox.js.map +1 -1
- package/lib/commonjs/Combobox/OptionsDropdown.js +6 -2
- package/lib/commonjs/Combobox/OptionsDropdown.js.map +1 -1
- package/lib/commonjs/Group/Group.js +19 -11
- package/lib/commonjs/Group/Group.js.map +1 -1
- package/lib/commonjs/Highlight/Highlight.js +30 -10
- package/lib/commonjs/Highlight/Highlight.js.map +1 -1
- package/lib/commonjs/HoverCard/HoverCard.js +23 -10
- package/lib/commonjs/HoverCard/HoverCard.js.map +1 -1
- package/lib/commonjs/Indicator/Indicator.js +5 -1
- package/lib/commonjs/Indicator/Indicator.js.map +1 -1
- package/lib/commonjs/Input/Input.js +30 -12
- package/lib/commonjs/Input/Input.js.map +1 -1
- package/lib/commonjs/Input/shared.js +18 -8
- package/lib/commonjs/Input/shared.js.map +1 -1
- package/lib/commonjs/Loader/Loader.js +18 -10
- package/lib/commonjs/Loader/Loader.js.map +1 -1
- package/lib/commonjs/Menu/Menu.js +6 -7
- package/lib/commonjs/Menu/Menu.js.map +1 -1
- package/lib/commonjs/MultiSelect/MultiSelect.js +112 -47
- package/lib/commonjs/MultiSelect/MultiSelect.js.map +1 -1
- package/lib/commonjs/Notification/Notification.js +31 -11
- package/lib/commonjs/Notification/Notification.js.map +1 -1
- package/lib/commonjs/NumberFormatter/NumberFormatter.js +48 -11
- package/lib/commonjs/NumberFormatter/NumberFormatter.js.map +1 -1
- package/lib/commonjs/Paper/Paper.js +8 -8
- package/lib/commonjs/Paper/Paper.js.map +1 -1
- package/lib/commonjs/Pill/Pill.js +6 -8
- package/lib/commonjs/Pill/Pill.js.map +1 -1
- package/lib/commonjs/Progress/Progress.js +4 -1
- package/lib/commonjs/Progress/Progress.js.map +1 -1
- package/lib/commonjs/RollingNumber/RollingNumber.js +30 -13
- package/lib/commonjs/RollingNumber/RollingNumber.js.map +1 -1
- package/lib/commonjs/RollingNumber/rolling-number-utils.js +27 -5
- package/lib/commonjs/RollingNumber/rolling-number-utils.js.map +1 -1
- package/lib/commonjs/ScrollArea/ScrollArea.js +131 -41
- package/lib/commonjs/ScrollArea/ScrollArea.js.map +1 -1
- package/lib/commonjs/ScrollArea/ScrollArea.native.js +128 -40
- package/lib/commonjs/ScrollArea/ScrollArea.native.js.map +1 -1
- package/lib/commonjs/SegmentedControl/SegmentedControl.js +4 -1
- package/lib/commonjs/SegmentedControl/SegmentedControl.js.map +1 -1
- package/lib/commonjs/Select/Select.js +64 -35
- package/lib/commonjs/Select/Select.js.map +1 -1
- package/lib/commonjs/Skeleton/Skeleton.js +6 -2
- package/lib/commonjs/Skeleton/Skeleton.js.map +1 -1
- package/lib/commonjs/Slider/Slider.js +136 -83
- package/lib/commonjs/Slider/Slider.js.map +1 -1
- package/lib/commonjs/Spoiler/Spoiler.js +22 -2
- package/lib/commonjs/Spoiler/Spoiler.js.map +1 -1
- package/lib/commonjs/Stepper/Stepper.js +2 -2
- package/lib/commonjs/Stepper/Stepper.js.map +1 -1
- package/lib/commonjs/Switch/Switch.js +18 -7
- package/lib/commonjs/Switch/Switch.js.map +1 -1
- package/lib/commonjs/Table/Table.js +91 -28
- package/lib/commonjs/Table/Table.js.map +1 -1
- package/lib/commonjs/TableOfContents/TableOfContents.js +4 -1
- package/lib/commonjs/TableOfContents/TableOfContents.js.map +1 -1
- package/lib/commonjs/TagsInput/TagsInput.js +138 -55
- package/lib/commonjs/TagsInput/TagsInput.js.map +1 -1
- package/lib/commonjs/Tooltip/Tooltip.js +27 -5
- package/lib/commonjs/Tooltip/Tooltip.js.map +1 -1
- package/lib/commonjs/Tree/Tree.js +4 -1
- package/lib/commonjs/Tree/Tree.js.map +1 -1
- package/lib/commonjs/Tree/tree-data.js +58 -23
- package/lib/commonjs/Tree/tree-data.js.map +1 -1
- package/lib/commonjs/Tree/use-tree.js +33 -4
- package/lib/commonjs/Tree/use-tree.js.map +1 -1
- package/lib/commonjs/TreeSelect/TreeSelect.js +70 -30
- package/lib/commonjs/TreeSelect/TreeSelect.js.map +1 -1
- package/lib/commonjs/Typography/Typography.js +10 -10
- package/lib/commonjs/Typography/Typography.js.map +1 -1
- package/lib/commonjs/UnstyledButton/UnstyledButton.js +8 -3
- package/lib/commonjs/UnstyledButton/UnstyledButton.js.map +1 -1
- package/lib/commonjs/VirtualList/VirtualList.js +71 -13
- package/lib/commonjs/VirtualList/VirtualList.js.map +1 -1
- package/lib/commonjs/floating/platform.js +28 -1
- package/lib/commonjs/floating/platform.js.map +1 -1
- package/lib/commonjs/floating/use-position.js +33 -1
- package/lib/commonjs/floating/use-position.js.map +1 -1
- package/lib/commonjs/internal/ControlIconProvider.js +20 -15
- package/lib/commonjs/internal/ControlIconProvider.js.map +1 -1
- package/lib/commonjs/internal/gradient-shared.js +9 -5
- package/lib/commonjs/internal/gradient-shared.js.map +1 -1
- package/lib/commonjs/internal/gradient.js +21 -9
- package/lib/commonjs/internal/gradient.js.map +1 -1
- package/lib/commonjs/internal/gradient.native.js +36 -10
- package/lib/commonjs/internal/gradient.native.js.map +1 -1
- package/lib/commonjs/internal/render-text-child.js +30 -2
- package/lib/commonjs/internal/render-text-child.js.map +1 -1
- package/lib/commonjs/internal/style-props.js +17 -5
- package/lib/commonjs/internal/style-props.js.map +1 -1
- package/lib/commonjs/internal/theme-color-web.js +46 -0
- package/lib/commonjs/internal/theme-color-web.js.map +1 -0
- package/lib/commonjs/internal/use-icon-color.js +33 -0
- package/lib/commonjs/internal/use-icon-color.js.map +1 -0
- package/lib/commonjs/internal/use-icon-color.native.js +23 -0
- package/lib/commonjs/internal/use-icon-color.native.js.map +1 -0
- package/lib/commonjs/internal/use-looping-animation.js +7 -3
- package/lib/commonjs/internal/use-looping-animation.js.map +1 -1
- package/lib/commonjs/internal/use-looping-animation.native.js +9 -1
- package/lib/commonjs/internal/use-looping-animation.native.js.map +1 -1
- package/lib/commonjs/internal/use-looping-animation.shared.js +33 -0
- package/lib/commonjs/internal/use-looping-animation.shared.js.map +1 -1
- package/lib/commonjs/internal/use-slot-text-wrapper.js +36 -5
- package/lib/commonjs/internal/use-slot-text-wrapper.js.map +1 -1
- package/lib/module/Accordion/Accordion.js +9 -5
- package/lib/module/Accordion/Accordion.js.map +1 -1
- package/lib/module/Alert/Alert.js +31 -11
- package/lib/module/Alert/Alert.js.map +1 -1
- package/lib/module/AngleSlider/AngleSlider.js +55 -17
- package/lib/module/AngleSlider/AngleSlider.js.map +1 -1
- package/lib/module/Autocomplete/Autocomplete.js +54 -34
- package/lib/module/Autocomplete/Autocomplete.js.map +1 -1
- package/lib/module/Badge/Badge.js +6 -9
- package/lib/module/Badge/Badge.js.map +1 -1
- package/lib/module/Button/Button.js +23 -7
- package/lib/module/Button/Button.js.map +1 -1
- package/lib/module/Card/Card.js +13 -4
- package/lib/module/Card/Card.js.map +1 -1
- package/lib/module/Checkbox/CheckIcon.js +9 -5
- package/lib/module/Checkbox/CheckIcon.js.map +1 -1
- package/lib/module/Checkbox/Checkbox.js +9 -2
- package/lib/module/Checkbox/Checkbox.js.map +1 -1
- package/lib/module/Chip/Chip.js +15 -16
- package/lib/module/Chip/Chip.js.map +1 -1
- package/lib/module/CloseButton/CloseButton.js +1 -1
- package/lib/module/CloseButton/CloseButton.js.map +1 -1
- package/lib/module/ColorInput/ColorInput.js +12 -4
- package/lib/module/ColorInput/ColorInput.js.map +1 -1
- package/lib/module/ColorPicker/ColorPicker.js +32 -24
- package/lib/module/ColorPicker/ColorPicker.js.map +1 -1
- package/lib/module/Combobox/Combobox.js +11 -6
- package/lib/module/Combobox/Combobox.js.map +1 -1
- package/lib/module/Combobox/OptionsDropdown.js +6 -2
- package/lib/module/Combobox/OptionsDropdown.js.map +1 -1
- package/lib/module/Group/Group.js +19 -11
- package/lib/module/Group/Group.js.map +1 -1
- package/lib/module/Highlight/Highlight.js +30 -10
- package/lib/module/Highlight/Highlight.js.map +1 -1
- package/lib/module/HoverCard/HoverCard.js +23 -10
- package/lib/module/HoverCard/HoverCard.js.map +1 -1
- package/lib/module/Indicator/Indicator.js +5 -1
- package/lib/module/Indicator/Indicator.js.map +1 -1
- package/lib/module/Input/Input.js +32 -14
- package/lib/module/Input/Input.js.map +1 -1
- package/lib/module/Input/shared.js +19 -9
- package/lib/module/Input/shared.js.map +1 -1
- package/lib/module/Loader/Loader.js +18 -10
- package/lib/module/Loader/Loader.js.map +1 -1
- package/lib/module/Menu/Menu.js +6 -7
- package/lib/module/Menu/Menu.js.map +1 -1
- package/lib/module/MultiSelect/MultiSelect.js +113 -48
- package/lib/module/MultiSelect/MultiSelect.js.map +1 -1
- package/lib/module/Notification/Notification.js +31 -11
- package/lib/module/Notification/Notification.js.map +1 -1
- package/lib/module/NumberFormatter/NumberFormatter.js +48 -11
- package/lib/module/NumberFormatter/NumberFormatter.js.map +1 -1
- package/lib/module/Paper/Paper.js +7 -8
- package/lib/module/Paper/Paper.js.map +1 -1
- package/lib/module/Pill/Pill.js +6 -8
- package/lib/module/Pill/Pill.js.map +1 -1
- package/lib/module/Progress/Progress.js +4 -1
- package/lib/module/Progress/Progress.js.map +1 -1
- package/lib/module/RollingNumber/RollingNumber.js +30 -13
- package/lib/module/RollingNumber/RollingNumber.js.map +1 -1
- package/lib/module/RollingNumber/rolling-number-utils.js +27 -5
- package/lib/module/RollingNumber/rolling-number-utils.js.map +1 -1
- package/lib/module/ScrollArea/ScrollArea.js +133 -43
- package/lib/module/ScrollArea/ScrollArea.js.map +1 -1
- package/lib/module/ScrollArea/ScrollArea.native.js +128 -40
- package/lib/module/ScrollArea/ScrollArea.native.js.map +1 -1
- package/lib/module/SegmentedControl/SegmentedControl.js +4 -1
- package/lib/module/SegmentedControl/SegmentedControl.js.map +1 -1
- package/lib/module/Select/Select.js +65 -36
- package/lib/module/Select/Select.js.map +1 -1
- package/lib/module/Skeleton/Skeleton.js +6 -2
- package/lib/module/Skeleton/Skeleton.js.map +1 -1
- package/lib/module/Slider/Slider.js +137 -84
- package/lib/module/Slider/Slider.js.map +1 -1
- package/lib/module/Spoiler/Spoiler.js +23 -3
- package/lib/module/Spoiler/Spoiler.js.map +1 -1
- package/lib/module/Stepper/Stepper.js +1 -1
- package/lib/module/Stepper/Stepper.js.map +1 -1
- package/lib/module/Switch/Switch.js +18 -7
- package/lib/module/Switch/Switch.js.map +1 -1
- package/lib/module/Table/Table.js +91 -28
- package/lib/module/Table/Table.js.map +1 -1
- package/lib/module/TableOfContents/TableOfContents.js +5 -2
- package/lib/module/TableOfContents/TableOfContents.js.map +1 -1
- package/lib/module/TagsInput/TagsInput.js +140 -57
- package/lib/module/TagsInput/TagsInput.js.map +1 -1
- package/lib/module/Tooltip/Tooltip.js +27 -5
- package/lib/module/Tooltip/Tooltip.js.map +1 -1
- package/lib/module/Tree/Tree.js +4 -1
- package/lib/module/Tree/Tree.js.map +1 -1
- package/lib/module/Tree/tree-data.js +57 -23
- package/lib/module/Tree/tree-data.js.map +1 -1
- package/lib/module/Tree/use-tree.js +34 -5
- package/lib/module/Tree/use-tree.js.map +1 -1
- package/lib/module/TreeSelect/TreeSelect.js +72 -32
- package/lib/module/TreeSelect/TreeSelect.js.map +1 -1
- package/lib/module/Typography/Typography.js +9 -10
- package/lib/module/Typography/Typography.js.map +1 -1
- package/lib/module/UnstyledButton/UnstyledButton.js +9 -4
- package/lib/module/UnstyledButton/UnstyledButton.js.map +1 -1
- package/lib/module/VirtualList/VirtualList.js +71 -13
- package/lib/module/VirtualList/VirtualList.js.map +1 -1
- package/lib/module/floating/platform.js +28 -1
- package/lib/module/floating/platform.js.map +1 -1
- package/lib/module/floating/use-position.js +33 -1
- package/lib/module/floating/use-position.js.map +1 -1
- package/lib/module/internal/ControlIconProvider.js +18 -13
- package/lib/module/internal/ControlIconProvider.js.map +1 -1
- package/lib/module/internal/gradient-shared.js +9 -5
- package/lib/module/internal/gradient-shared.js.map +1 -1
- package/lib/module/internal/gradient.js +22 -9
- package/lib/module/internal/gradient.js.map +1 -1
- package/lib/module/internal/gradient.native.js +36 -10
- package/lib/module/internal/gradient.native.js.map +1 -1
- package/lib/module/internal/render-text-child.js +30 -2
- package/lib/module/internal/render-text-child.js.map +1 -1
- package/lib/module/internal/style-props.js +16 -4
- package/lib/module/internal/style-props.js.map +1 -1
- package/lib/module/internal/theme-color-web.js +42 -0
- package/lib/module/internal/theme-color-web.js.map +1 -0
- package/lib/module/internal/use-icon-color.js +29 -0
- package/lib/module/internal/use-icon-color.js.map +1 -0
- package/lib/module/internal/use-icon-color.native.js +19 -0
- package/lib/module/internal/use-icon-color.native.js.map +1 -0
- package/lib/module/internal/use-looping-animation.js +8 -4
- package/lib/module/internal/use-looping-animation.js.map +1 -1
- package/lib/module/internal/use-looping-animation.native.js +10 -2
- package/lib/module/internal/use-looping-animation.native.js.map +1 -1
- package/lib/module/internal/use-looping-animation.shared.js +31 -0
- package/lib/module/internal/use-looping-animation.shared.js.map +1 -1
- package/lib/module/internal/use-slot-text-wrapper.js +37 -5
- package/lib/module/internal/use-slot-text-wrapper.js.map +1 -1
- package/lib/typescript/Accordion/Accordion.d.ts +11 -11
- package/lib/typescript/Accordion/Accordion.d.ts.map +1 -1
- package/lib/typescript/ActionIcon/ActionIcon.d.ts +7 -7
- package/lib/typescript/Alert/Alert.d.ts +7 -7
- package/lib/typescript/Alert/Alert.d.ts.map +1 -1
- package/lib/typescript/Anchor/Anchor.d.ts +3 -3
- package/lib/typescript/AngleSlider/AngleSlider.d.ts.map +1 -1
- package/lib/typescript/Autocomplete/Autocomplete.d.ts +16 -42
- package/lib/typescript/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/lib/typescript/Avatar/Avatar.d.ts +21 -21
- package/lib/typescript/Badge/Badge.d.ts +7 -7
- package/lib/typescript/Badge/Badge.d.ts.map +1 -1
- package/lib/typescript/Button/Button.d.ts +7 -7
- package/lib/typescript/Button/Button.d.ts.map +1 -1
- package/lib/typescript/Card/Card.d.ts.map +1 -1
- package/lib/typescript/Checkbox/CheckIcon.d.ts.map +1 -1
- package/lib/typescript/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/Chip/Chip.d.ts.map +1 -1
- package/lib/typescript/CloseButton/CloseButton.d.ts +7 -7
- package/lib/typescript/ColorInput/ColorInput.d.ts.map +1 -1
- package/lib/typescript/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/lib/typescript/Combobox/Combobox.d.ts +2 -2
- package/lib/typescript/Combobox/Combobox.d.ts.map +1 -1
- package/lib/typescript/Combobox/OptionsDropdown.d.ts.map +1 -1
- package/lib/typescript/Combobox/index.d.ts +2 -2
- package/lib/typescript/Dialog/Dialog.d.ts +6 -6
- package/lib/typescript/Fieldset/Fieldset.d.ts +7 -7
- package/lib/typescript/Flex/Flex.d.ts +3 -3
- package/lib/typescript/Group/Group.d.ts +3 -3
- package/lib/typescript/Group/Group.d.ts.map +1 -1
- package/lib/typescript/Highlight/Highlight.d.ts.map +1 -1
- package/lib/typescript/HoverCard/HoverCard.d.ts +1 -1
- package/lib/typescript/HoverCard/HoverCard.d.ts.map +1 -1
- package/lib/typescript/Image/Image.d.ts +14 -14
- package/lib/typescript/Image/createImage.d.ts +17 -17
- package/lib/typescript/Indicator/Indicator.d.ts.map +1 -1
- package/lib/typescript/Input/Input.d.ts +13 -13
- package/lib/typescript/Input/Input.d.ts.map +1 -1
- package/lib/typescript/Input/Input.native.d.ts +16 -16
- package/lib/typescript/Input/shared.d.ts +10 -10
- package/lib/typescript/Input/shared.d.ts.map +1 -1
- package/lib/typescript/InputBase/InputBase.d.ts +2 -2
- package/lib/typescript/Kbd/Kbd.d.ts +1 -1
- package/lib/typescript/Loader/Loader.d.ts.map +1 -1
- package/lib/typescript/Mark/Mark.d.ts +1 -1
- package/lib/typescript/MaskInput/MaskInput.d.ts +2 -2
- package/lib/typescript/Menu/Menu.d.ts +1 -1
- package/lib/typescript/Menu/Menu.d.ts.map +1 -1
- package/lib/typescript/Modal/Modal.d.ts +6 -6
- package/lib/typescript/MultiSelect/MultiSelect.d.ts +15 -60
- package/lib/typescript/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/lib/typescript/NavLink/NavLink.d.ts +7 -7
- package/lib/typescript/Notification/Notification.d.ts.map +1 -1
- package/lib/typescript/NumberFormatter/NumberFormatter.d.ts.map +1 -1
- package/lib/typescript/NumberInput/NumberInput.d.ts +5 -5
- package/lib/typescript/Paper/Paper.d.ts +8 -40
- package/lib/typescript/Paper/Paper.d.ts.map +1 -1
- package/lib/typescript/PasswordInput/PasswordInput.d.ts +11 -11
- package/lib/typescript/Pill/Pill.d.ts +15 -15
- package/lib/typescript/Pill/Pill.d.ts.map +1 -1
- package/lib/typescript/PinInput/PinInput.d.ts +13 -13
- package/lib/typescript/Popover/Popover.shared.d.ts +3 -3
- package/lib/typescript/Progress/Progress.d.ts.map +1 -1
- package/lib/typescript/Radio/Radio.d.ts +8 -8
- package/lib/typescript/RollingNumber/RollingNumber.d.ts.map +1 -1
- package/lib/typescript/RollingNumber/rolling-number-utils.d.ts.map +1 -1
- package/lib/typescript/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/lib/typescript/ScrollArea/ScrollArea.native.d.ts.map +1 -1
- package/lib/typescript/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/lib/typescript/Select/Select.d.ts +20 -49
- package/lib/typescript/Select/Select.d.ts.map +1 -1
- package/lib/typescript/Separator/Separator.d.ts +9 -9
- package/lib/typescript/Skeleton/Skeleton.d.ts.map +1 -1
- package/lib/typescript/Slider/Slider.d.ts.map +1 -1
- package/lib/typescript/Spoiler/Spoiler.d.ts.map +1 -1
- package/lib/typescript/Switch/Switch.d.ts +14 -3
- package/lib/typescript/Switch/Switch.d.ts.map +1 -1
- package/lib/typescript/Table/Table.d.ts +18 -12
- package/lib/typescript/Table/Table.d.ts.map +1 -1
- package/lib/typescript/TableOfContents/TableOfContents.d.ts.map +1 -1
- package/lib/typescript/Tabs/Tabs.d.ts +12 -12
- package/lib/typescript/TagsInput/TagsInput.d.ts +13 -47
- package/lib/typescript/TagsInput/TagsInput.d.ts.map +1 -1
- package/lib/typescript/TextInput/TextInput.d.ts +2 -2
- package/lib/typescript/Textarea/Textarea.d.ts +2 -2
- package/lib/typescript/ThemeIcon/ThemeIcon.d.ts +7 -7
- package/lib/typescript/Title/Title.d.ts +3 -3
- package/lib/typescript/Tooltip/Tooltip.d.ts.map +1 -1
- package/lib/typescript/Tree/Tree.d.ts.map +1 -1
- package/lib/typescript/Tree/tree-data.d.ts +7 -0
- package/lib/typescript/Tree/tree-data.d.ts.map +1 -1
- package/lib/typescript/Tree/use-tree.d.ts +5 -0
- package/lib/typescript/Tree/use-tree.d.ts.map +1 -1
- package/lib/typescript/TreeSelect/TreeSelect.d.ts +21 -47
- package/lib/typescript/TreeSelect/TreeSelect.d.ts.map +1 -1
- package/lib/typescript/Typography/Typography.d.ts +8 -8
- package/lib/typescript/Typography/Typography.d.ts.map +1 -1
- package/lib/typescript/UnstyledButton/UnstyledButton.d.ts.map +1 -1
- package/lib/typescript/VirtualList/VirtualList.d.ts.map +1 -1
- package/lib/typescript/floating/platform.d.ts +11 -0
- package/lib/typescript/floating/platform.d.ts.map +1 -1
- package/lib/typescript/floating/use-position.d.ts.map +1 -1
- package/lib/typescript/internal/ControlIconProvider.d.ts +1 -1
- package/lib/typescript/internal/ControlIconProvider.d.ts.map +1 -1
- package/lib/typescript/internal/gradient-shared.d.ts +7 -4
- package/lib/typescript/internal/gradient-shared.d.ts.map +1 -1
- package/lib/typescript/internal/gradient.d.ts +18 -0
- package/lib/typescript/internal/gradient.d.ts.map +1 -1
- package/lib/typescript/internal/gradient.native.d.ts.map +1 -1
- package/lib/typescript/internal/render-text-child.d.ts +11 -0
- package/lib/typescript/internal/render-text-child.d.ts.map +1 -1
- package/lib/typescript/internal/style-props.d.ts +17 -0
- package/lib/typescript/internal/style-props.d.ts.map +1 -1
- package/lib/typescript/internal/theme-color-web.d.ts +2 -0
- package/lib/typescript/internal/theme-color-web.d.ts.map +1 -0
- package/lib/typescript/internal/use-icon-color.d.ts +25 -0
- package/lib/typescript/internal/use-icon-color.d.ts.map +1 -0
- package/lib/typescript/internal/use-icon-color.native.d.ts +11 -0
- package/lib/typescript/internal/use-icon-color.native.d.ts.map +1 -0
- package/lib/typescript/internal/use-looping-animation.d.ts.map +1 -1
- package/lib/typescript/internal/use-looping-animation.native.d.ts.map +1 -1
- package/lib/typescript/internal/use-looping-animation.shared.d.ts +30 -3
- package/lib/typescript/internal/use-looping-animation.shared.d.ts.map +1 -1
- package/lib/typescript/internal/use-slot-text-wrapper.d.ts +0 -20
- package/lib/typescript/internal/use-slot-text-wrapper.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/Accordion/Accordion.tsx +6 -2
- package/src/Alert/Alert.tsx +43 -22
- package/src/AngleSlider/AngleSlider.tsx +73 -21
- package/src/Autocomplete/Autocomplete.tsx +74 -55
- package/src/Badge/Badge.tsx +6 -8
- package/src/Button/Button.tsx +17 -3
- package/src/Card/Card.tsx +11 -3
- package/src/Checkbox/CheckIcon.tsx +9 -5
- package/src/Checkbox/Checkbox.tsx +8 -1
- package/src/Chip/Chip.tsx +15 -22
- package/src/CloseButton/CloseButton.tsx +1 -1
- package/src/ColorInput/ColorInput.tsx +15 -4
- package/src/ColorPicker/ColorPicker.tsx +38 -25
- package/src/Combobox/Combobox.tsx +10 -6
- package/src/Combobox/OptionsDropdown.tsx +6 -1
- package/src/Group/Group.tsx +21 -10
- package/src/Highlight/Highlight.tsx +42 -7
- package/src/HoverCard/HoverCard.tsx +48 -31
- package/src/Indicator/Indicator.tsx +4 -0
- package/src/Input/Input.tsx +31 -16
- package/src/Input/shared.tsx +20 -4
- package/src/Loader/Loader.tsx +14 -4
- package/src/Menu/Menu.tsx +6 -8
- package/src/MultiSelect/MultiSelect.tsx +140 -85
- package/src/Notification/Notification.tsx +43 -22
- package/src/NumberFormatter/NumberFormatter.tsx +66 -11
- package/src/Paper/Paper.tsx +8 -6
- package/src/Pill/Pill.tsx +6 -9
- package/src/Progress/Progress.tsx +3 -0
- package/src/RollingNumber/RollingNumber.tsx +43 -21
- package/src/RollingNumber/rolling-number-utils.ts +28 -5
- package/src/ScrollArea/ScrollArea.native.tsx +142 -49
- package/src/ScrollArea/ScrollArea.tsx +140 -47
- package/src/SegmentedControl/SegmentedControl.tsx +12 -1
- package/src/Select/Select.tsx +90 -67
- package/src/Skeleton/Skeleton.tsx +5 -1
- package/src/Slider/Slider.tsx +157 -61
- package/src/Spoiler/Spoiler.tsx +22 -10
- package/src/Stepper/Stepper.tsx +1 -1
- package/src/Switch/Switch.tsx +20 -9
- package/src/Table/Table.tsx +89 -33
- package/src/TableOfContents/TableOfContents.tsx +5 -1
- package/src/TagsInput/TagsInput.tsx +193 -141
- package/src/Tooltip/Tooltip.tsx +33 -7
- package/src/Tree/Tree.tsx +4 -1
- package/src/Tree/tree-data.ts +74 -26
- package/src/Tree/use-tree.ts +52 -7
- package/src/TreeSelect/TreeSelect.tsx +96 -64
- package/src/Typography/Typography.tsx +9 -8
- package/src/UnstyledButton/UnstyledButton.tsx +12 -5
- package/src/VirtualList/VirtualList.tsx +82 -18
- package/src/floating/platform.ts +29 -1
- package/src/floating/use-position.tsx +38 -1
- package/src/internal/ControlIconProvider.tsx +17 -12
- package/src/internal/gradient-shared.ts +9 -5
- package/src/internal/gradient.native.tsx +29 -5
- package/src/internal/gradient.tsx +22 -7
- package/src/internal/render-text-child.tsx +30 -2
- package/src/internal/style-props.ts +20 -4
- package/src/internal/theme-color-web.ts +40 -0
- package/src/internal/use-icon-color.native.ts +17 -0
- package/src/internal/use-icon-color.ts +26 -0
- package/src/internal/use-looping-animation.native.tsx +10 -2
- package/src/internal/use-looping-animation.shared.ts +38 -3
- package/src/internal/use-looping-animation.tsx +8 -4
- package/src/internal/use-slot-text-wrapper.tsx +39 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
3
|
import { withStaticProperties } from "@knitui/core";
|
|
4
|
-
import { useId, useUncontrolled } from "@knitui/hooks";
|
|
4
|
+
import { useCallbackRef, useId, useUncontrolled } from "@knitui/hooks";
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
Combobox,
|
|
@@ -146,12 +146,6 @@ interface MultiSelectContextValue {
|
|
|
146
146
|
clearButtonProps?: Partial<ComboboxClearButtonProps>;
|
|
147
147
|
/** Coexistence mode for the clear button + right section. */
|
|
148
148
|
clearSectionMode?: "clear" | "default" | "rightSection" | "both";
|
|
149
|
-
/** Trigger props the sugar wrapper assembled (chrome, aria, ref). */
|
|
150
|
-
triggerProps?: Partial<MultiSelectInputProps> & {
|
|
151
|
-
placeholder?: string;
|
|
152
|
-
id?: string;
|
|
153
|
-
ref?: React.Ref<MultiSelectRef>;
|
|
154
|
-
};
|
|
155
149
|
/** Remove a single value (pill remove / Backspace). */
|
|
156
150
|
removeValue: (value: string) => void;
|
|
157
151
|
// Event/behaviour handlers consumed by MultiSelect.Trigger.
|
|
@@ -173,6 +167,51 @@ const useMultiSelectContext = (): MultiSelectContextValue => {
|
|
|
173
167
|
return ctx;
|
|
174
168
|
};
|
|
175
169
|
|
|
170
|
+
/**
|
|
171
|
+
* Trigger props the sugar wrapper assembled (chrome, aria, ref). Rebuilt every
|
|
172
|
+
* render (`...inputProps` is a rest spread, so its identity can never be
|
|
173
|
+
* preserved), which is why it rides its OWN context: `MultiSelect.Trigger` is the
|
|
174
|
+
* only consumer, while the option rows consume `MultiSelectContext`.
|
|
175
|
+
*/
|
|
176
|
+
type MultiSelectFunneledTriggerProps = Partial<MultiSelectInputProps> & {
|
|
177
|
+
placeholder?: string;
|
|
178
|
+
id?: string;
|
|
179
|
+
ref?: React.Ref<MultiSelectRef>;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const MultiSelectTriggerPropsContext = React.createContext<
|
|
183
|
+
MultiSelectFunneledTriggerProps | undefined
|
|
184
|
+
>(undefined);
|
|
185
|
+
|
|
186
|
+
/** Shared empty funnel for the composable path (no sugar wrapper above). */
|
|
187
|
+
const EMPTY_TRIGGER_PROPS: MultiSelectFunneledTriggerProps = {};
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* The slice of Root state a PILL needs — deliberately WITHOUT `search`, so typing
|
|
191
|
+
* in the field cannot re-render the selected-value pills through context. The
|
|
192
|
+
* search text lives on `MultiSelectContext`, which the trigger/field consume; the
|
|
193
|
+
* pills subscribe here instead and `React.memo` on `{ value }` then actually holds.
|
|
194
|
+
*/
|
|
195
|
+
interface MultiSelectPillContextValue {
|
|
196
|
+
lockup: ReturnType<typeof getOptionsLockup>;
|
|
197
|
+
pillSize: ReturnType<typeof toEmbeddedControlSize>;
|
|
198
|
+
disabled?: boolean;
|
|
199
|
+
readOnly?: boolean;
|
|
200
|
+
renderPill?: ComboboxRenderPill;
|
|
201
|
+
styles?: SlotStyles<MultiSelectStyles>;
|
|
202
|
+
removeValue: (value: string) => void;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const MultiSelectPillContext = React.createContext<MultiSelectPillContextValue | null>(null);
|
|
206
|
+
|
|
207
|
+
const useMultiSelectPillContext = (): MultiSelectPillContextValue => {
|
|
208
|
+
const ctx = React.useContext(MultiSelectPillContext);
|
|
209
|
+
if (!ctx) {
|
|
210
|
+
throw new Error("MultiSelect.Pill must be rendered inside <MultiSelect.Root>");
|
|
211
|
+
}
|
|
212
|
+
return ctx;
|
|
213
|
+
};
|
|
214
|
+
|
|
176
215
|
/* -------------------------------------------------------------------------- */
|
|
177
216
|
/* MultiSelect.Root — the values / search / active-option state machine */
|
|
178
217
|
/* -------------------------------------------------------------------------- */
|
|
@@ -277,7 +316,7 @@ export interface MultiSelectRootProps {
|
|
|
277
316
|
* render `<MultiSelect.Trigger>` with your own props instead.
|
|
278
317
|
* @internal
|
|
279
318
|
*/
|
|
280
|
-
__triggerProps?:
|
|
319
|
+
__triggerProps?: MultiSelectFunneledTriggerProps;
|
|
281
320
|
}
|
|
282
321
|
|
|
283
322
|
function MultiSelectRoot(props: MultiSelectRootProps) {
|
|
@@ -398,41 +437,33 @@ function MultiSelectRoot(props: MultiSelectRootProps) {
|
|
|
398
437
|
}
|
|
399
438
|
}, [flatOptions]);
|
|
400
439
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
onMaxValues?.();
|
|
413
|
-
}
|
|
414
|
-
if (clearSearchOnChange) setSearch("");
|
|
415
|
-
},
|
|
416
|
-
[
|
|
417
|
-
lockup,
|
|
418
|
-
onOptionSubmit,
|
|
419
|
-
_value,
|
|
420
|
-
maxValues,
|
|
421
|
-
setValue,
|
|
422
|
-
onRemove,
|
|
423
|
-
onMaxValues,
|
|
424
|
-
setSearch,
|
|
425
|
-
clearSearchOnChange,
|
|
426
|
-
],
|
|
427
|
-
);
|
|
428
|
-
|
|
429
|
-
const removeValue = React.useCallback(
|
|
430
|
-
(optionValue: string) => {
|
|
440
|
+
// Every handler in this Root is `useCallbackRef`-stable (identity fixed, latest
|
|
441
|
+
// closure). That is what lets the context memo below actually HIT — with fresh
|
|
442
|
+
// closures it either had to be invalidated every render (re-rendering every option
|
|
443
|
+
// row, since context propagation walks past `React.memo`) or it would have served
|
|
444
|
+
// stale callbacks. `handleSubmit` additionally lands on `<Combobox onOptionSubmit>`,
|
|
445
|
+
// a dep of Combobox's OWN context memo, so churn there hit every `Combobox.Option`.
|
|
446
|
+
const handleSubmit = useCallbackRef((optionValue: string) => {
|
|
447
|
+
const option = lockup[optionValue];
|
|
448
|
+
if (!option || option.disabled) return;
|
|
449
|
+
onOptionSubmit?.(optionValue);
|
|
450
|
+
if (_value.includes(optionValue)) {
|
|
431
451
|
setValue(_value.filter((v) => v !== optionValue));
|
|
432
452
|
onRemove?.(optionValue);
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
|
|
453
|
+
} else if (_value.length < maxValues) {
|
|
454
|
+
setValue([..._value, optionValue]);
|
|
455
|
+
} else {
|
|
456
|
+
onMaxValues?.();
|
|
457
|
+
}
|
|
458
|
+
if (clearSearchOnChange) setSearch("");
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
// Stable so each pill's `onRemove` closure is stable too (it used to depend on
|
|
462
|
+
// `_value`, giving every pill a fresh callback on every selection change).
|
|
463
|
+
const removeValue = useCallbackRef((optionValue: string) => {
|
|
464
|
+
setValue(_value.filter((v) => v !== optionValue));
|
|
465
|
+
onRemove?.(optionValue);
|
|
466
|
+
});
|
|
436
467
|
|
|
437
468
|
const moveActive = (direction: 1 | -1) => {
|
|
438
469
|
if (flatOptions.length === 0) return;
|
|
@@ -446,7 +477,7 @@ function MultiSelectRoot(props: MultiSelectRootProps) {
|
|
|
446
477
|
setActiveValue(flatOptions[nextIndex].value);
|
|
447
478
|
};
|
|
448
479
|
|
|
449
|
-
const handleKeyDown
|
|
480
|
+
const handleKeyDown = useCallbackRef<[React.KeyboardEvent<HTMLInputElement>], void>((event) => {
|
|
450
481
|
if (disabled || readOnly) return;
|
|
451
482
|
switch (event.key) {
|
|
452
483
|
case "ArrowDown":
|
|
@@ -489,38 +520,38 @@ function MultiSelectRoot(props: MultiSelectRootProps) {
|
|
|
489
520
|
break;
|
|
490
521
|
}
|
|
491
522
|
onKeyDown?.(event);
|
|
492
|
-
};
|
|
523
|
+
});
|
|
493
524
|
|
|
494
|
-
const handleChange
|
|
525
|
+
const handleChange = useCallbackRef<[React.ChangeEvent<HTMLInputElement>], void>((event) => {
|
|
495
526
|
setSearch(event.currentTarget.value);
|
|
496
527
|
combobox.openDropdown();
|
|
497
528
|
if (selectFirstOptionOnChange) selectFirstPending.current = true;
|
|
498
|
-
};
|
|
529
|
+
});
|
|
499
530
|
|
|
500
|
-
const handleFocus
|
|
531
|
+
const handleFocus = useCallbackRef<[React.FocusEvent<HTMLInputElement>], void>((event) => {
|
|
501
532
|
if (searchable) combobox.openDropdown();
|
|
502
533
|
onFocus?.(event);
|
|
503
|
-
};
|
|
534
|
+
});
|
|
504
535
|
|
|
505
|
-
const handleBlur
|
|
536
|
+
const handleBlur = useCallbackRef<[React.FocusEvent<HTMLInputElement>], void>((event) => {
|
|
506
537
|
combobox.closeDropdown();
|
|
507
538
|
setSearch("");
|
|
508
539
|
onBlur?.(event);
|
|
509
|
-
};
|
|
540
|
+
});
|
|
510
541
|
|
|
511
|
-
const handleFieldClick =
|
|
542
|
+
const handleFieldClick = useCallbackRef(() => {
|
|
512
543
|
if (searchable) {
|
|
513
544
|
combobox.openDropdown();
|
|
514
545
|
} else {
|
|
515
546
|
combobox.toggleDropdown();
|
|
516
547
|
}
|
|
517
|
-
}
|
|
548
|
+
});
|
|
518
549
|
|
|
519
|
-
const handleClear =
|
|
550
|
+
const handleClear = useCallbackRef(() => {
|
|
520
551
|
onClear?.();
|
|
521
552
|
setValue([]);
|
|
522
553
|
setSearch("");
|
|
523
|
-
}
|
|
554
|
+
});
|
|
524
555
|
|
|
525
556
|
const canClear = clearable && _value.length > 0 && !disabled && !readOnly;
|
|
526
557
|
|
|
@@ -550,7 +581,6 @@ function MultiSelectRoot(props: MultiSelectRootProps) {
|
|
|
550
581
|
styles,
|
|
551
582
|
clearButtonProps,
|
|
552
583
|
clearSectionMode,
|
|
553
|
-
triggerProps: __triggerProps,
|
|
554
584
|
removeValue,
|
|
555
585
|
onClear: handleClear,
|
|
556
586
|
onChangeText: handleChange,
|
|
@@ -559,9 +589,9 @@ function MultiSelectRoot(props: MultiSelectRootProps) {
|
|
|
559
589
|
onBlur: handleBlur,
|
|
560
590
|
onFieldClick: handleFieldClick,
|
|
561
591
|
}),
|
|
562
|
-
//
|
|
563
|
-
//
|
|
564
|
-
|
|
592
|
+
// Deps are COMPLETE: every handler above is `useCallbackRef`-stable, so this memo
|
|
593
|
+
// genuinely hits. `__triggerProps` is deliberately absent — it rides its own
|
|
594
|
+
// context (it is rebuilt every render and only the Trigger reads it).
|
|
565
595
|
[
|
|
566
596
|
combobox,
|
|
567
597
|
dropdownId,
|
|
@@ -587,34 +617,50 @@ function MultiSelectRoot(props: MultiSelectRootProps) {
|
|
|
587
617
|
styles,
|
|
588
618
|
clearButtonProps,
|
|
589
619
|
clearSectionMode,
|
|
590
|
-
|
|
620
|
+
removeValue,
|
|
621
|
+
handleClear,
|
|
622
|
+
handleChange,
|
|
623
|
+
handleKeyDown,
|
|
624
|
+
handleFocus,
|
|
625
|
+
handleBlur,
|
|
626
|
+
handleFieldClick,
|
|
591
627
|
],
|
|
592
628
|
);
|
|
593
629
|
|
|
630
|
+
// Pill-only slice: no `search`, so typing cannot re-render the pills.
|
|
631
|
+
const pillCtx = React.useMemo<MultiSelectPillContextValue>(
|
|
632
|
+
() => ({ lockup, pillSize, disabled, readOnly, renderPill, styles, removeValue }),
|
|
633
|
+
[lockup, pillSize, disabled, readOnly, renderPill, styles, removeValue],
|
|
634
|
+
);
|
|
635
|
+
|
|
594
636
|
const s = slotStyles<MultiSelectStyles>(styles, MULTISELECT_SLOT_KEYS, "MultiSelect");
|
|
595
637
|
|
|
596
638
|
return (
|
|
597
639
|
<MultiSelectContext.Provider value={ctx}>
|
|
598
|
-
<
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
640
|
+
<MultiSelectPillContext.Provider value={pillCtx}>
|
|
641
|
+
<MultiSelectTriggerPropsContext.Provider value={__triggerProps}>
|
|
642
|
+
<Combobox
|
|
643
|
+
position="bottom"
|
|
644
|
+
width="target"
|
|
645
|
+
// Deprecated `comboboxProps` alias merged OVER the `root` slot sugar
|
|
646
|
+
// ("explicit beats sugar").
|
|
647
|
+
{...s.merge("root", comboboxProps)}
|
|
648
|
+
store={combobox}
|
|
649
|
+
onOptionSubmit={handleSubmit}
|
|
650
|
+
size={size}
|
|
651
|
+
readOnly={readOnly}
|
|
652
|
+
>
|
|
653
|
+
{children}
|
|
654
|
+
</Combobox>
|
|
655
|
+
<Combobox.HiddenInput
|
|
656
|
+
name={hiddenInputName}
|
|
657
|
+
form={form}
|
|
658
|
+
value={_value}
|
|
659
|
+
valuesDivider={hiddenInputValuesDivider}
|
|
660
|
+
disabled={disabled}
|
|
661
|
+
/>
|
|
662
|
+
</MultiSelectTriggerPropsContext.Provider>
|
|
663
|
+
</MultiSelectPillContext.Provider>
|
|
618
664
|
</MultiSelectContext.Provider>
|
|
619
665
|
);
|
|
620
666
|
}
|
|
@@ -628,11 +674,20 @@ export interface MultiSelectPillProps extends Partial<PillProps> {
|
|
|
628
674
|
value: string;
|
|
629
675
|
}
|
|
630
676
|
|
|
631
|
-
|
|
632
|
-
|
|
677
|
+
/**
|
|
678
|
+
* Memoized so typing in the field doesn't re-render the whole pill row. Two things
|
|
679
|
+
* make the memo actually hold: the pill subscribes to `MultiSelectPillContext`
|
|
680
|
+
* (which carries no `search`) rather than the Root context, and `removeValue` is
|
|
681
|
+
* `useCallbackRef`-stable — previously each pill got a brand-new `onRemove` closure
|
|
682
|
+
* on every render, so keystroke latency scaled with the number of selected values.
|
|
683
|
+
*/
|
|
684
|
+
const MultiSelectPill = React.memo(function MultiSelectPill(props: MultiSelectPillProps) {
|
|
685
|
+
const ctx = useMultiSelectPillContext();
|
|
686
|
+
const { removeValue } = ctx;
|
|
633
687
|
const s = slotStyles<MultiSelectStyles>(ctx.styles, MULTISELECT_SLOT_KEYS, "MultiSelect");
|
|
634
688
|
const { value: itemValue, children, ...rest } = props;
|
|
635
689
|
const option = ctx.lockup[itemValue];
|
|
690
|
+
const handleRemove = React.useCallback(() => removeValue(itemValue), [removeValue, itemValue]);
|
|
636
691
|
|
|
637
692
|
// A custom `renderPill` REPLACES the built-in chip (Mantine parity).
|
|
638
693
|
if (ctx.renderPill) {
|
|
@@ -641,7 +696,7 @@ function MultiSelectPill(props: MultiSelectPillProps) {
|
|
|
641
696
|
{ctx.renderPill({
|
|
642
697
|
option: option ?? { value: itemValue, label: itemValue },
|
|
643
698
|
value: itemValue,
|
|
644
|
-
onRemove:
|
|
699
|
+
onRemove: handleRemove,
|
|
645
700
|
disabled: ctx.disabled,
|
|
646
701
|
})}
|
|
647
702
|
</>
|
|
@@ -655,13 +710,13 @@ function MultiSelectPill(props: MultiSelectPillProps) {
|
|
|
655
710
|
size={ctx.pillSize}
|
|
656
711
|
withRemoveButton={!ctx.readOnly && !option?.disabled}
|
|
657
712
|
disabled={ctx.disabled}
|
|
658
|
-
onRemove={
|
|
713
|
+
onRemove={handleRemove}
|
|
659
714
|
{...rest}
|
|
660
715
|
>
|
|
661
716
|
{children ?? option?.label ?? itemValue}
|
|
662
717
|
</Pill>
|
|
663
718
|
);
|
|
664
|
-
}
|
|
719
|
+
});
|
|
665
720
|
|
|
666
721
|
/* -------------------------------------------------------------------------- */
|
|
667
722
|
/* MultiSelect.Pills — the pill row wrapper (`Pill.Group`) */
|
|
@@ -711,7 +766,7 @@ const MultiSelectTrigger = React.forwardRef<MultiSelectRef, MultiSelectTriggerPr
|
|
|
711
766
|
|
|
712
767
|
// The sugar `<MultiSelect>` wrapper funnels its chrome props + ref through
|
|
713
768
|
// context so the composable and sugar callers resolve to the same trigger.
|
|
714
|
-
const funneled =
|
|
769
|
+
const funneled = React.useContext(MultiSelectTriggerPropsContext) ?? EMPTY_TRIGGER_PROPS;
|
|
715
770
|
const {
|
|
716
771
|
placeholder: funneledPlaceholder,
|
|
717
772
|
id: funneledId,
|
|
@@ -1030,7 +1085,7 @@ const MultiSelectComponent = React.forwardRef<MultiSelectRef, MultiSelectProps>(
|
|
|
1030
1085
|
// The remaining chrome props are funneled to `MultiSelect.Trigger` via Root
|
|
1031
1086
|
// context so the sugar path and the composable path converge on the same
|
|
1032
1087
|
// trigger element.
|
|
1033
|
-
const triggerProps:
|
|
1088
|
+
const triggerProps: MultiSelectFunneledTriggerProps = {
|
|
1034
1089
|
...inputProps,
|
|
1035
1090
|
placeholder,
|
|
1036
1091
|
// Forward ONLY the field-chrome slots to the trigger's `PillsInput` →
|
|
@@ -155,17 +155,37 @@ export interface NotificationProps extends NotificationFrameProps {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* inside a `<Text>` (text
|
|
158
|
+
* How the body children render: nothing at all, a pure-text body (a single themed
|
|
159
|
+
* `NotificationMessage`), or rich content. Any element present routes to the
|
|
160
|
+
* `NotificationContent` Box so rich content isn't trapped inside a `<Text>` (text
|
|
161
|
+
* runs within it stay themed via `renderTextChild`).
|
|
161
162
|
*/
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
type NotificationBodyKind = "empty" | "text" | "rich";
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* ## Cost
|
|
167
|
+
*
|
|
168
|
+
* This replaces a `hasRenderableChild(children)` + `isTextOnly(children)` pair
|
|
169
|
+
* that BOTH called `React.Children.toArray` — which flattens *and clones every
|
|
170
|
+
* element child* — so the same work ran twice per render, and a toast stack
|
|
171
|
+
* renders N notifications. One pass now, with the single-child shapes answered
|
|
172
|
+
* before `toArray` is reached at all (same fast-path ladder as `renderTextChild`).
|
|
173
|
+
* Classification is unchanged: `toArray` drops `null`/`undefined`/booleans, and
|
|
174
|
+
* does NOT flatten a Fragment (which therefore counts as one element → "rich").
|
|
175
|
+
*/
|
|
176
|
+
function classifyBody(children: React.ReactNode): NotificationBodyKind {
|
|
177
|
+
const type = typeof children;
|
|
178
|
+
if (type === "string" || type === "number") return "text";
|
|
179
|
+
if (children == null || type === "boolean") return "empty";
|
|
180
|
+
if (React.isValidElement(children)) return "rich";
|
|
166
181
|
|
|
167
|
-
|
|
168
|
-
|
|
182
|
+
const array = React.Children.toArray(children);
|
|
183
|
+
if (array.length === 0) return "empty";
|
|
184
|
+
for (let i = 0; i < array.length; i++) {
|
|
185
|
+
const child = array[i];
|
|
186
|
+
if (typeof child !== "string" && typeof child !== "number") return "rich";
|
|
187
|
+
}
|
|
188
|
+
return "text";
|
|
169
189
|
}
|
|
170
190
|
|
|
171
191
|
const NotificationComponent = NotificationFrame.styleable<NotificationProps>(
|
|
@@ -187,21 +207,22 @@ const NotificationComponent = NotificationFrame.styleable<NotificationProps>(
|
|
|
187
207
|
const slots = slotStyles(styles, NOTIFICATION_SLOTS, "Notification");
|
|
188
208
|
const rootId = useId(typeof id === "string" ? id : undefined);
|
|
189
209
|
const titleId = title ? `${rootId}-title` : undefined;
|
|
190
|
-
const
|
|
191
|
-
const bodyId =
|
|
210
|
+
const bodyKind = classifyBody(children);
|
|
211
|
+
const bodyId = bodyKind !== "empty" ? `${rootId}-body` : undefined;
|
|
192
212
|
|
|
193
213
|
const showBadge = loading || icon != null;
|
|
194
|
-
const bodyContent =
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
{
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
{
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
214
|
+
const bodyContent =
|
|
215
|
+
bodyKind !== "empty" ? (
|
|
216
|
+
bodyKind === "text" ? (
|
|
217
|
+
<NotificationMessage id={bodyId} {...slots.get("message")}>
|
|
218
|
+
{children}
|
|
219
|
+
</NotificationMessage>
|
|
220
|
+
) : (
|
|
221
|
+
<NotificationContent id={bodyId} {...slots.get("content")}>
|
|
222
|
+
{renderTextChild(children, NotificationMessage)}
|
|
223
|
+
</NotificationContent>
|
|
224
|
+
)
|
|
225
|
+
) : null;
|
|
205
226
|
|
|
206
227
|
return (
|
|
207
228
|
<NotificationFrame
|
|
@@ -31,6 +31,33 @@ export interface NumberFormatterProps extends NumberFormatterFrameProps {
|
|
|
31
31
|
thousandSeparator?: string | boolean;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Group-separator patterns, compiled once at module scope.
|
|
36
|
+
*
|
|
37
|
+
* `groupDigits` ran `new RegExp(...)` on every format call — i.e. once per table
|
|
38
|
+
* cell / list row on every render — recompiling one of only two realistic
|
|
39
|
+
* patterns. `thousandsGroupStyle` can only reach group size 3 (`thousand`) or 4
|
|
40
|
+
* (`wan`), so both are precompiled; an unusual size still works, it is built and
|
|
41
|
+
* cached on first use rather than rejected.
|
|
42
|
+
*
|
|
43
|
+
* Reusing a `/g` regex across calls is safe here: `String.prototype.replace`
|
|
44
|
+
* resets `lastIndex` before and after a global match, so no state leaks between
|
|
45
|
+
* calls.
|
|
46
|
+
*/
|
|
47
|
+
const GROUP_PATTERNS = new Map<number, RegExp>([
|
|
48
|
+
[3, /\B(?=(\d{3})+(?!\d))/g],
|
|
49
|
+
[4, /\B(?=(\d{4})+(?!\d))/g],
|
|
50
|
+
]);
|
|
51
|
+
|
|
52
|
+
function groupPattern(groupSize: number): RegExp {
|
|
53
|
+
let pattern = GROUP_PATTERNS.get(groupSize);
|
|
54
|
+
if (pattern === undefined) {
|
|
55
|
+
pattern = new RegExp(`\\B(?=(\\d{${groupSize}})+(?!\\d))`, "g");
|
|
56
|
+
GROUP_PATTERNS.set(groupSize, pattern);
|
|
57
|
+
}
|
|
58
|
+
return pattern;
|
|
59
|
+
}
|
|
60
|
+
|
|
34
61
|
function groupDigits(
|
|
35
62
|
intPart: string,
|
|
36
63
|
style: NonNullable<NumberFormatterProps["thousandsGroupStyle"]>,
|
|
@@ -51,7 +78,7 @@ function groupDigits(
|
|
|
51
78
|
}
|
|
52
79
|
|
|
53
80
|
const groupSize = style === "wan" ? 4 : 3;
|
|
54
|
-
return `${neg ? "-" : ""}${digits.replace(
|
|
81
|
+
return `${neg ? "-" : ""}${digits.replace(groupPattern(groupSize), sep)}`;
|
|
55
82
|
}
|
|
56
83
|
|
|
57
84
|
function formatValue(props: NumberFormatterProps): string {
|
|
@@ -111,19 +138,47 @@ function formatValue(props: NumberFormatterProps): string {
|
|
|
111
138
|
export const NumberFormatter = NumberFormatterFrame.styleable<NumberFormatterProps>(
|
|
112
139
|
function NumberFormatter(props, ref) {
|
|
113
140
|
const {
|
|
114
|
-
value
|
|
115
|
-
allowNegative
|
|
116
|
-
decimalScale
|
|
117
|
-
decimalSeparator
|
|
118
|
-
fixedDecimalScale
|
|
119
|
-
prefix
|
|
120
|
-
suffix
|
|
121
|
-
thousandSeparator
|
|
122
|
-
thousandsGroupStyle
|
|
141
|
+
value,
|
|
142
|
+
allowNegative,
|
|
143
|
+
decimalScale,
|
|
144
|
+
decimalSeparator,
|
|
145
|
+
fixedDecimalScale,
|
|
146
|
+
prefix,
|
|
147
|
+
suffix,
|
|
148
|
+
thousandSeparator,
|
|
149
|
+
thousandsGroupStyle,
|
|
123
150
|
...textProps
|
|
124
151
|
} = props;
|
|
125
152
|
|
|
126
|
-
|
|
153
|
+
// Formatting is pure over these nine props (the defaults live in
|
|
154
|
+
// `formatValue`), so memoize it: this component renders per table cell / list
|
|
155
|
+
// row, and re-running the parse + rounding + grouping on every parent render —
|
|
156
|
+
// including renders where only a style prop moved — was wasted string work.
|
|
157
|
+
const formatted = React.useMemo(
|
|
158
|
+
() =>
|
|
159
|
+
formatValue({
|
|
160
|
+
value,
|
|
161
|
+
allowNegative,
|
|
162
|
+
decimalScale,
|
|
163
|
+
decimalSeparator,
|
|
164
|
+
fixedDecimalScale,
|
|
165
|
+
prefix,
|
|
166
|
+
suffix,
|
|
167
|
+
thousandSeparator,
|
|
168
|
+
thousandsGroupStyle,
|
|
169
|
+
}),
|
|
170
|
+
[
|
|
171
|
+
value,
|
|
172
|
+
allowNegative,
|
|
173
|
+
decimalScale,
|
|
174
|
+
decimalSeparator,
|
|
175
|
+
fixedDecimalScale,
|
|
176
|
+
prefix,
|
|
177
|
+
suffix,
|
|
178
|
+
thousandSeparator,
|
|
179
|
+
thousandsGroupStyle,
|
|
180
|
+
],
|
|
181
|
+
);
|
|
127
182
|
if (!formatted) return null;
|
|
128
183
|
|
|
129
184
|
return (
|
package/src/Paper/Paper.tsx
CHANGED
|
@@ -7,8 +7,14 @@ import { radiusVariant, shadowVariant } from "../internal/style-props";
|
|
|
7
7
|
* Paper — generic content surface with optional elevation and border. Mirrors
|
|
8
8
|
* Mantine's `Paper`. `shadow` (xs→xl) controls elevation, `radius` the corner
|
|
9
9
|
* rounding, `withBorder` shows the outline. No border or shadow by default.
|
|
10
|
+
*
|
|
11
|
+
* A plain `styled()` export, NOT a `.styleable()` wrapper: the wrapper's render
|
|
12
|
+
* function did nothing but `<PaperFrame ref {...props} />`, so every `<Paper>`
|
|
13
|
+
* paid a whole extra component layer (and its own render pass, and the `<Theme>`
|
|
14
|
+
* layer `themeable` puts around a named styleable) to add exactly zero props.
|
|
15
|
+
* `GetProps` gives the identical public prop shape either way.
|
|
10
16
|
*/
|
|
11
|
-
const
|
|
17
|
+
export const Paper = styled(Box, {
|
|
12
18
|
name: "Paper",
|
|
13
19
|
backgroundColor: "$background",
|
|
14
20
|
|
|
@@ -23,8 +29,4 @@ const PaperFrame = styled(Box, {
|
|
|
23
29
|
defaultVariants: { radius: "md" },
|
|
24
30
|
});
|
|
25
31
|
|
|
26
|
-
export type PaperProps = GetProps<typeof
|
|
27
|
-
|
|
28
|
-
export const Paper = PaperFrame.styleable<PaperProps>(function Paper(props, ref) {
|
|
29
|
-
return <PaperFrame ref={ref} {...props} />;
|
|
30
|
-
});
|
|
32
|
+
export type PaperProps = GetProps<typeof Paper>;
|
package/src/Pill/Pill.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
type SizeKey,
|
|
14
14
|
} from "../internal/style-props";
|
|
15
15
|
import { slotStyles, type SlotStyles } from "../internal/styles";
|
|
16
|
+
import { useSlotTextWrapper } from "../internal/use-slot-text-wrapper";
|
|
16
17
|
import { Text } from "../Text";
|
|
17
18
|
|
|
18
19
|
type PillSize = SizeKey;
|
|
@@ -233,15 +234,11 @@ const PillComponent = PillFrame.styleable<PillProps>(function Pill(props, ref) {
|
|
|
233
234
|
);
|
|
234
235
|
|
|
235
236
|
// Bind the `label` slot props onto the label wrapper that `renderTextChild`
|
|
236
|
-
// emits for text children (`styles={{ label }}` → `<Pill.Label … />`).
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
return <PillLabel {...labelSlot} {...wrapperProps} />;
|
|
242
|
-
},
|
|
243
|
-
[labelSlot],
|
|
244
|
-
);
|
|
237
|
+
// emits for text children (`styles={{ label }}` → `<Pill.Label … />`). The shared
|
|
238
|
+
// hook compares the slot props by VALUE: keyed on identity, the documented inline
|
|
239
|
+
// `styles={{ label: { … } }}` literal made the wrapper a new component TYPE every
|
|
240
|
+
// render, remounting the label of every pill in a group.
|
|
241
|
+
const LabelWrapper = useSlotTextWrapper(PillLabel, s.get("label"));
|
|
245
242
|
|
|
246
243
|
return (
|
|
247
244
|
<PillFrame
|
|
@@ -188,6 +188,9 @@ const ProgressSection = ProgressSectionFrame.styleable<ProgressSectionProps>(
|
|
|
188
188
|
axis: "x",
|
|
189
189
|
distance: animated ? STRIPE_PERIOD : 0,
|
|
190
190
|
durationMs: STRIPE_DURATION_MS,
|
|
191
|
+
// A `distance: 0` shimmer is inert, so the primitive already skips scheduling;
|
|
192
|
+
// stating it keeps the intent explicit for a plain `striped` bar.
|
|
193
|
+
enabled: Boolean(animated),
|
|
191
194
|
});
|
|
192
195
|
|
|
193
196
|
const pct = `${Math.max(0, Math.min(100, value))}%`;
|