@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
package/src/Badge/Badge.tsx
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
surfaceColorVariant,
|
|
17
17
|
} from "../internal/style-props";
|
|
18
18
|
import { slotStyles, type SlotStyles } from "../internal/styles";
|
|
19
|
+
import { useSlotTextWrapper } from "../internal/use-slot-text-wrapper";
|
|
19
20
|
import { Text } from "../Text";
|
|
20
21
|
|
|
21
22
|
type BadgeSize = SizeKey;
|
|
@@ -177,14 +178,11 @@ const BadgeComponent = BadgeFrame.styleable<BadgeProps>(function Badge(props, re
|
|
|
177
178
|
|
|
178
179
|
// Inject the `text` slot props into the wrapper `renderTextChild` auto-applies
|
|
179
180
|
// around string/number children, so the label slot reaches the auto-wrapped text.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
},
|
|
186
|
-
[textSlot],
|
|
187
|
-
);
|
|
181
|
+
// Via the shared hook: keying this memo on the slot object's IDENTITY meant the
|
|
182
|
+
// documented inline `styles={{ text: { … } }}` literal produced a new component
|
|
183
|
+
// TYPE every render, so React unmounted and remounted the label — and a Badge is
|
|
184
|
+
// a list item rendered N times. The hook compares the slot props by value.
|
|
185
|
+
const BadgeLabel = useSlotTextWrapper(BadgeText, s.get("text"));
|
|
188
186
|
|
|
189
187
|
return (
|
|
190
188
|
<BadgeFrame
|
package/src/Button/Button.tsx
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
pressScaleStyle,
|
|
28
28
|
radiusVariant,
|
|
29
29
|
type SizeKey,
|
|
30
|
-
|
|
30
|
+
WEB_BUTTON_PROPS,
|
|
31
31
|
webCursor,
|
|
32
32
|
} from "../internal/style-props";
|
|
33
33
|
import { slotStyles, type SlotStyles } from "../internal/styles";
|
|
@@ -75,6 +75,14 @@ const ButtonFrame = styled(Box, {
|
|
|
75
75
|
// `variant-colors` ladder so Button/ActionIcon and `theme="…"` stay in lockstep.
|
|
76
76
|
variant: {
|
|
77
77
|
...controlColorVariant,
|
|
78
|
+
// `name: "Button"` collided with a `surface3`-templated entry in Tamagui's
|
|
79
|
+
// (deprecated) `defaultComponentThemes`, so until `core/config/themes.ts`
|
|
80
|
+
// set `componentThemes: false` this frame resolved inside a
|
|
81
|
+
// `<scheme>_Button` theme where `$borderColor` was offset from step 4 to
|
|
82
|
+
// step 7. `default` is the ONLY variant that reads `$borderColor` (every
|
|
83
|
+
// other one is an explicit `$colorN` or `transparent`, which the surface
|
|
84
|
+
// template left alone), so pin just that one to keep its shipped weight.
|
|
85
|
+
default: { ...controlColorVariant.default, borderColor: "$color7" },
|
|
78
86
|
},
|
|
79
87
|
size: {
|
|
80
88
|
...controlVariant,
|
|
@@ -165,6 +173,12 @@ export interface ButtonStyles {
|
|
|
165
173
|
loader?: Partial<LoaderProps>;
|
|
166
174
|
}
|
|
167
175
|
|
|
176
|
+
/**
|
|
177
|
+
* `collect` options — a module constant, not an inline literal: it is invariant,
|
|
178
|
+
* and `Button` calls `collect` on every render.
|
|
179
|
+
*/
|
|
180
|
+
const BUTTON_COLLECT_OPTS = { defaultSlot: "Label", displayName: "Button" } as const;
|
|
181
|
+
|
|
168
182
|
const BUTTON_SLOT_KEYS = [
|
|
169
183
|
"left",
|
|
170
184
|
"label",
|
|
@@ -224,7 +238,7 @@ const ButtonComponent = ButtonFrame.styleable<ButtonProps>(function Button(props
|
|
|
224
238
|
|
|
225
239
|
// Normalize marker slots from `children`. Plain (non-marker) children fold
|
|
226
240
|
// into `Label`, so `<Button>plain text</Button>` behaves exactly as before.
|
|
227
|
-
const slots = ButtonSlots.collect(children,
|
|
241
|
+
const slots = ButtonSlots.collect(children, BUTTON_COLLECT_OPTS);
|
|
228
242
|
|
|
229
243
|
// Precedence (slot-system-plan): marker slot → legacy prop → plain children.
|
|
230
244
|
// `loading` still replaces the left visual, matching the prior behavior. The
|
|
@@ -279,7 +293,7 @@ const ButtonComponent = ButtonFrame.styleable<ButtonProps>(function Button(props
|
|
|
279
293
|
aria-disabled={isDisabled || undefined}
|
|
280
294
|
{...nativeIdProps}
|
|
281
295
|
// Real focusable `<button>` on web so the `:focus-visible` outline fires.
|
|
282
|
-
{...
|
|
296
|
+
{...WEB_BUTTON_PROPS}
|
|
283
297
|
>
|
|
284
298
|
{grad.layer}
|
|
285
299
|
{left}
|
package/src/Card/Card.tsx
CHANGED
|
@@ -35,8 +35,15 @@ const CardContext = React.createContext<CardContextValue>({
|
|
|
35
35
|
const CardFrame = styled(Box, {
|
|
36
36
|
name: "Card",
|
|
37
37
|
flexDirection: "column",
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
// Pinned ramp steps, NOT `$background`/`$borderColor`. `name: "Card"` used to
|
|
39
|
+
// collide with Tamagui's (deprecated) `defaultComponentThemes`, which nested
|
|
40
|
+
// this frame into a `<scheme>_Card` theme whose `surface1` template offset
|
|
41
|
+
// `$background` to `$color2` and `$borderColor` to `$color5`. Those component
|
|
42
|
+
// themes are now off (`core/config/themes.ts` → `componentThemes: false`), so
|
|
43
|
+
// the offset is stated here instead — a card must read as a raised surface
|
|
44
|
+
// ABOVE the page background (`$color1`), which `$background` alone would not.
|
|
45
|
+
backgroundColor: "$color2",
|
|
46
|
+
borderColor: "$color5",
|
|
40
47
|
borderRadius: "$md",
|
|
41
48
|
padding: DEFAULT_PADDING,
|
|
42
49
|
gap: "$sm",
|
|
@@ -121,7 +128,8 @@ const CardSection = CardSectionFrame.styleable<CardSectionProps>(function CardSe
|
|
|
121
128
|
borderBottomWidth={withBorder && !isHorizontal ? 1 : undefined}
|
|
122
129
|
borderLeftWidth={withBorder && isHorizontal ? 1 : undefined}
|
|
123
130
|
borderRightWidth={withBorder && isHorizontal ? 1 : undefined}
|
|
124
|
-
|
|
131
|
+
// `$color5` (not `$borderColor`) to match `CardFrame` — see the note there.
|
|
132
|
+
borderColor={withBorder ? "$color5" : undefined}
|
|
125
133
|
{...bleed}
|
|
126
134
|
{...rest}
|
|
127
135
|
/>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { IconCheck } from "@knitui/icons/IconCheck";
|
|
4
|
+
import { IconMinus } from "@knitui/icons/IconMinus";
|
|
5
5
|
|
|
6
6
|
import { controlIconSize } from "../internal/control-icon-size";
|
|
7
|
-
import { resolveThemeColor } from "../internal/resolve-theme-color";
|
|
8
7
|
import { type SizeKey } from "../internal/style-props";
|
|
8
|
+
import { useIconColor } from "../internal/use-icon-color";
|
|
9
9
|
import { type TextProps } from "../Text";
|
|
10
10
|
|
|
11
11
|
export type CheckboxIconSize = SizeKey;
|
|
@@ -41,8 +41,12 @@ export function CheckboxIcon({
|
|
|
41
41
|
color = "$color1",
|
|
42
42
|
...rest
|
|
43
43
|
}: CheckboxIconProps) {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
// `useIconColor` instead of `useTheme()` + `resolveThemeColor`: on web the token
|
|
45
|
+
// → `var(--token)` mapping is a pure string transform, so the glyph needs no
|
|
46
|
+
// theme subscription at all (one per checkbox, plus the dep-less `useEffect`
|
|
47
|
+
// `useThemeWithState` fires after every render). Native still reads the theme,
|
|
48
|
+
// where `react-native-svg` needs a concrete colour. See `use-icon-color.ts`.
|
|
49
|
+
const resolvedColor = useIconColor(typeof color === "string" ? color : "$color1");
|
|
46
50
|
const iconSize = controlIconSize(size);
|
|
47
51
|
|
|
48
52
|
const Icon = indeterminate ? IconMinus : IconCheck;
|
|
@@ -89,7 +89,14 @@ type CheckboxAriaProps = {
|
|
|
89
89
|
/** Resolve box/border/icon colours from the variant + active (checked) state. */
|
|
90
90
|
function checkColors(variant: CheckboxVariant, active: boolean): CheckColors {
|
|
91
91
|
if (!active) {
|
|
92
|
-
|
|
92
|
+
// Pinned ramp steps, NOT `$background`/`$borderColor`. `CheckboxBox` is
|
|
93
|
+
// `name: "Checkbox"`, which used to collide with Tamagui's (deprecated)
|
|
94
|
+
// `defaultComponentThemes` and nest into a `<scheme>_Checkbox` theme whose
|
|
95
|
+
// `surface2` template offset `$background` → `$color3` and `$borderColor` →
|
|
96
|
+
// `$color6`. Component themes are now off (`core/config/themes.ts` →
|
|
97
|
+
// `componentThemes: false`), so the unchecked box states its own steps: it
|
|
98
|
+
// needs a faint fill + a border strong enough to read as an empty target.
|
|
99
|
+
return { background: "$color3", border: "$color6", icon: "$color1" };
|
|
93
100
|
}
|
|
94
101
|
if (variant === "outline") {
|
|
95
102
|
return { background: "transparent", border: "$color9", icon: "$color9" };
|
package/src/Chip/Chip.tsx
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
createStyledContext,
|
|
5
|
-
type GetProps,
|
|
6
|
-
styled,
|
|
7
|
-
useTheme,
|
|
8
|
-
withStaticProperties,
|
|
9
|
-
} from "@knitui/core";
|
|
3
|
+
import { createStyledContext, type GetProps, styled, withStaticProperties } from "@knitui/core";
|
|
10
4
|
import { useKeyboardActions, useUncontrolled } from "@knitui/hooks";
|
|
11
|
-
import { IconCheck } from "@knitui/icons";
|
|
5
|
+
import { IconCheck } from "@knitui/icons/IconCheck";
|
|
12
6
|
|
|
13
7
|
import { Box } from "../Box";
|
|
14
8
|
import { controlIconSize } from "../internal/control-icon-size";
|
|
15
9
|
import { usePressScale } from "../internal/motion";
|
|
16
10
|
import { renderTextChild } from "../internal/render-text-child";
|
|
17
|
-
import { resolveThemeColor } from "../internal/resolve-theme-color";
|
|
18
11
|
import {
|
|
19
12
|
controlFontVariant,
|
|
20
13
|
controlGapVariant,
|
|
@@ -25,6 +18,8 @@ import {
|
|
|
25
18
|
webCursor,
|
|
26
19
|
} from "../internal/style-props";
|
|
27
20
|
import { slotStyles, type SlotStyles } from "../internal/styles";
|
|
21
|
+
import { useIconColor } from "../internal/use-icon-color";
|
|
22
|
+
import { useSlotTextWrapper } from "../internal/use-slot-text-wrapper";
|
|
28
23
|
import { useToggle } from "../internal/use-toggle";
|
|
29
24
|
import { Text } from "../Text";
|
|
30
25
|
|
|
@@ -312,18 +307,13 @@ const ChipComponent = ChipFrame.styleable<ChipProps>(function Chip(props, ref) {
|
|
|
312
307
|
const s = slotStyles<ChipSlots>(styles, CHIP_SLOTS, "Chip");
|
|
313
308
|
|
|
314
309
|
// The label slot must reach the `ChipLabel` that `renderTextChild` mounts, so
|
|
315
|
-
// wrap `ChipLabel` to fold in the slot props.
|
|
316
|
-
//
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
return <ChipLabel {...labelSlot}>{labelChildren}</ChipLabel>;
|
|
322
|
-
},
|
|
323
|
-
[labelSlot],
|
|
324
|
-
);
|
|
310
|
+
// wrap `ChipLabel` to fold in the slot props. `useSlotTextWrapper` keys the memo
|
|
311
|
+
// on the slot props' SHALLOW VALUE, not their identity: the documented call is an
|
|
312
|
+
// inline literal (`styles={{ label: { … } }}`), which is a new object every
|
|
313
|
+
// render, so an identity-keyed memo never hit — the wrapper was a new component
|
|
314
|
+
// TYPE each render and React unmounted + remounted the label subtree.
|
|
315
|
+
const LabelWrapper = useSlotTextWrapper(ChipLabel, s.get("label"));
|
|
325
316
|
|
|
326
|
-
const theme = useTheme();
|
|
327
317
|
const group = React.useContext(ChipGroupContext);
|
|
328
318
|
const inGroup = group !== null && value !== undefined;
|
|
329
319
|
const [selfOn, toggle] = useToggle(checked, defaultChecked, onChange);
|
|
@@ -348,9 +338,12 @@ const ChipComponent = ChipFrame.styleable<ChipProps>(function Chip(props, ref) {
|
|
|
348
338
|
// resolve theme tokens or the font cascade). Colour tracks the combined state,
|
|
349
339
|
// size tracks the control key via the canonical icon ladder. A `color` from the
|
|
350
340
|
// `icon` slot overrides the state colour and is routed to the icon.
|
|
341
|
+
// `useIconColor` (not `useTheme()` + `resolveThemeColor`): on web the token →
|
|
342
|
+
// `var(--token)` mapping is a pure string transform, so no theme subscription is
|
|
343
|
+
// needed — which matters because this runs on every chip render even when the
|
|
344
|
+
// glyph is hidden (the hook must stay unconditional).
|
|
351
345
|
const { color: iconSlotColor, ...iconSlotProps } = s.get("icon") ?? {};
|
|
352
|
-
const checkColor =
|
|
353
|
-
theme,
|
|
346
|
+
const checkColor = useIconColor(
|
|
354
347
|
typeof iconSlotColor === "string" ? iconSlotColor : CHIP_ICON_TOKEN[state],
|
|
355
348
|
);
|
|
356
349
|
const checkSize = controlIconSize(size);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
3
|
import { type GetProps, styled, withStaticProperties } from "@knitui/core";
|
|
4
|
-
import { IconX } from "@knitui/icons";
|
|
4
|
+
import { IconX } from "@knitui/icons/IconX";
|
|
5
5
|
|
|
6
6
|
import { ActionIcon } from "../ActionIcon";
|
|
7
7
|
import { Box } from "../Box";
|
|
@@ -228,11 +228,22 @@ const ColorInputComponent = React.forwardRef<ColorInputRef, ColorInputProps>(
|
|
|
228
228
|
|
|
229
229
|
// The `swatch` slot reaches the dropdown picker's own swatch slot; explicit
|
|
230
230
|
// `styles={{ picker: { styles } }}` wins (it is spread last).
|
|
231
|
+
//
|
|
232
|
+
// Memoized because this lands on `ColorPicker.Root`'s `styles` prop, which is a
|
|
233
|
+
// dependency of its context memo: a fresh object here re-provides the picker
|
|
234
|
+
// context on every render — i.e. on every keystroke in the hex field — which
|
|
235
|
+
// re-renders the whole swatch grid. `s.get(…)` returns the consumer's own slot
|
|
236
|
+
// objects unchanged, so keying on them is exact.
|
|
231
237
|
const pickerSugar = s.get("picker");
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
238
|
+
const swatchSugar = s.get("swatch");
|
|
239
|
+
const pickerSugarStyles = pickerSugar?.styles;
|
|
240
|
+
const pickerStyles = React.useMemo<SlotStyles<ColorPickerStyles> | undefined>(
|
|
241
|
+
() =>
|
|
242
|
+
swatchSugar || pickerSugarStyles
|
|
243
|
+
? { swatch: swatchSugar, ...pickerSugarStyles }
|
|
244
|
+
: undefined,
|
|
245
|
+
[swatchSugar, pickerSugarStyles],
|
|
246
|
+
);
|
|
236
247
|
|
|
237
248
|
return (
|
|
238
249
|
<Popover
|
|
@@ -272,10 +272,14 @@ function ColorPickerSaturation(props: ColorPickerSaturationProps) {
|
|
|
272
272
|
const { parsed: value, value: color, size, focusable, saturationLabel, geometry } = ctx;
|
|
273
273
|
const { onPartChange: onChange, onSaturationChangeEnd, onScrubStart, onScrubEnd } = ctx;
|
|
274
274
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
275
|
+
// `ctx.parsed` IS the source of truth for the thumb, so the position is
|
|
276
|
+
// DERIVED during render instead of mirrored into state by an effect. The mirror
|
|
277
|
+
// cost a second render of the whole picker subtree for every pointermove:
|
|
278
|
+
// ctx change → render → effect → setPosition → render again.
|
|
279
|
+
const position: MovePosition = { x: value.s / 100, y: 1 - value.v / 100 };
|
|
280
|
+
// Raw (unrounded) last-move position, read by `onScrubEnd` — deliberately NOT
|
|
281
|
+
// written during render; `useMove` always reports the final move before
|
|
282
|
+
// `onScrubEnd`, so this is fresh whenever it is read.
|
|
279
283
|
const positionRef = React.useRef(position);
|
|
280
284
|
|
|
281
285
|
const { ref, rootProps } = useMove(
|
|
@@ -293,10 +297,6 @@ function ColorPickerSaturation(props: ColorPickerSaturationProps) {
|
|
|
293
297
|
},
|
|
294
298
|
);
|
|
295
299
|
|
|
296
|
-
React.useEffect(() => {
|
|
297
|
-
setPosition({ x: value.s / 100, y: 1 - value.v / 100 });
|
|
298
|
-
}, [value.s, value.v]);
|
|
299
|
-
|
|
300
300
|
const nudge = (next: MovePosition) => {
|
|
301
301
|
const clamped = clampMovePosition(next);
|
|
302
302
|
onChange({ s: Math.round(clamped.x * 100), v: Math.round((1 - clamped.y) * 100) });
|
|
@@ -411,7 +411,9 @@ function ColorSlider(props: ColorSliderEngineProps) {
|
|
|
411
411
|
|
|
412
412
|
const s = slotStyles<ColorPickerStyles>(styles, COLOR_PICKER_SLOT_KEYS, "ColorPicker");
|
|
413
413
|
|
|
414
|
-
|
|
414
|
+
// Derived during render from the incoming `value` — see the note in
|
|
415
|
+
// `ColorPickerSaturation`; the old mirror state + effect doubled every render.
|
|
416
|
+
const position: MovePosition = { x: value / maxValue, y: 0 };
|
|
415
417
|
const positionRef = React.useRef(position);
|
|
416
418
|
|
|
417
419
|
const getValue = (x: number) => (round_ ? Math.round(x * maxValue) : x * maxValue);
|
|
@@ -430,10 +432,6 @@ function ColorSlider(props: ColorSliderEngineProps) {
|
|
|
430
432
|
},
|
|
431
433
|
);
|
|
432
434
|
|
|
433
|
-
React.useEffect(() => {
|
|
434
|
-
setPosition({ x: value / maxValue, y: 0 });
|
|
435
|
-
}, [value, maxValue]);
|
|
436
|
-
|
|
437
435
|
const nudge = (x: number) => {
|
|
438
436
|
const clamped = clampMovePosition({ x, y: 0 });
|
|
439
437
|
onChange(getValue(clamped.x));
|
|
@@ -539,6 +537,9 @@ export interface ColorPickerAlphaSliderProps extends GetProps<typeof SliderFrame
|
|
|
539
537
|
function ColorPickerAlphaSlider(props: ColorPickerAlphaSliderProps) {
|
|
540
538
|
const ctx = useColorPickerContext();
|
|
541
539
|
const { thumbProps, ...rest } = props;
|
|
540
|
+
// The gradient overlay and the thumb want the SAME hex; converting twice ran the
|
|
541
|
+
// HSVA→hex math twice per drag frame.
|
|
542
|
+
const hex = convertHsvaTo("hex", ctx.parsed);
|
|
542
543
|
return (
|
|
543
544
|
<ColorSlider
|
|
544
545
|
value={ctx.parsed.a}
|
|
@@ -547,10 +548,10 @@ function ColorPickerAlphaSlider(props: ColorPickerAlphaSliderProps) {
|
|
|
547
548
|
baseColor="#ffffff"
|
|
548
549
|
overlays={[
|
|
549
550
|
{
|
|
550
|
-
backgroundImage: `linear-gradient(90deg, transparent, ${
|
|
551
|
+
backgroundImage: `linear-gradient(90deg, transparent, ${hex})`,
|
|
551
552
|
},
|
|
552
553
|
]}
|
|
553
|
-
thumbColor={
|
|
554
|
+
thumbColor={hex}
|
|
554
555
|
size={ctx.size}
|
|
555
556
|
focusable={ctx.focusable}
|
|
556
557
|
aria-label={ctx.alphaLabel}
|
|
@@ -609,7 +610,15 @@ function ColorPickerSwatch(props: ColorPickerSwatchProps) {
|
|
|
609
610
|
);
|
|
610
611
|
const swatchSize = size ?? autoSize;
|
|
611
612
|
const selected = ctx.value === color;
|
|
612
|
-
|
|
613
|
+
// `luminance` runs `parseColor` (a multi-pattern regex scan) plus HSVA math, and
|
|
614
|
+
// this component subscribes to a context that legitimately changes on EVERY
|
|
615
|
+
// pointermove of a saturation/hue/alpha drag — so all N swatches re-render per
|
|
616
|
+
// frame. The check colour depends only on `color`, which never changes for a
|
|
617
|
+
// given swatch, so it is computed once per swatch instead of once per frame.
|
|
618
|
+
const checkColor = React.useMemo(
|
|
619
|
+
() => (luminance(color) < 0.5 ? "#fff" : "#000") as TextProps["color"],
|
|
620
|
+
[color],
|
|
621
|
+
);
|
|
613
622
|
const numericSize = typeof swatchSize === "number" ? swatchSize : autoSize;
|
|
614
623
|
|
|
615
624
|
return (
|
|
@@ -738,13 +747,18 @@ const ColorPickerRoot = React.forwardRef<
|
|
|
738
747
|
|
|
739
748
|
const withAlpha = format === "hexa" || format === "rgba" || format === "hsla";
|
|
740
749
|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
750
|
+
// `setValue` from `useUncontrolled` is referentially stable AND reads the latest
|
|
751
|
+
// `onChange` through a ref, so listing it honestly keeps this callback stable
|
|
752
|
+
// across renders — the old `[]` + eslint-disable workaround is now dead.
|
|
753
|
+
const handleChange = React.useCallback(
|
|
754
|
+
(color: Partial<HsvaColor>) => {
|
|
755
|
+
const next = { ...parsedRef.current, ...color };
|
|
756
|
+
parsedRef.current = next;
|
|
757
|
+
setParsed(next);
|
|
758
|
+
setValue(convertHsvaTo(formatRef.current, next));
|
|
759
|
+
},
|
|
760
|
+
[setValue],
|
|
761
|
+
);
|
|
748
762
|
|
|
749
763
|
const startScrubbing = React.useCallback(() => {
|
|
750
764
|
scrubbingRef.current = true;
|
|
@@ -808,8 +822,7 @@ const ColorPickerRoot = React.forwardRef<
|
|
|
808
822
|
onColorSwatchClick?.(color);
|
|
809
823
|
onChangeEnd?.(convertHsvaTo(formatRef.current, parseColor(color)));
|
|
810
824
|
},
|
|
811
|
-
|
|
812
|
-
[onColorSwatchClick, onChangeEnd],
|
|
825
|
+
[onColorSwatchClick, onChangeEnd, setValue],
|
|
813
826
|
);
|
|
814
827
|
|
|
815
828
|
const ctx = React.useMemo<ColorPickerContextValue>(
|
|
@@ -5,10 +5,9 @@ import {
|
|
|
5
5
|
type GetProps,
|
|
6
6
|
type RadiusTokens,
|
|
7
7
|
styled,
|
|
8
|
-
useTheme,
|
|
9
8
|
withStaticProperties,
|
|
10
9
|
} from "@knitui/core";
|
|
11
|
-
import { IconChevronDown } from "@knitui/icons";
|
|
10
|
+
import { IconChevronDown } from "@knitui/icons/IconChevronDown";
|
|
12
11
|
|
|
13
12
|
import { Box } from "../Box";
|
|
14
13
|
import { CloseButton, type CloseButtonProps } from "../CloseButton";
|
|
@@ -16,7 +15,6 @@ import { CONTROL_ICON_SIZE, controlIconSize } from "../internal/control-icon-siz
|
|
|
16
15
|
import { toEmbeddedControlSize } from "../internal/embedded-control-size";
|
|
17
16
|
import { HiddenInput } from "../internal/hidden-input";
|
|
18
17
|
import { renderTextChild } from "../internal/render-text-child";
|
|
19
|
-
import { resolveThemeColor } from "../internal/resolve-theme-color";
|
|
20
18
|
import {
|
|
21
19
|
fontSizePassthroughVariant,
|
|
22
20
|
fontSizeVariant,
|
|
@@ -24,6 +22,7 @@ import {
|
|
|
24
22
|
type SizeKey,
|
|
25
23
|
webCursor,
|
|
26
24
|
} from "../internal/style-props";
|
|
25
|
+
import { useIconColor } from "../internal/use-icon-color";
|
|
27
26
|
import { Popover, type PopoverPosition, type PopoverWidth } from "../Popover";
|
|
28
27
|
import { Text } from "../Text";
|
|
29
28
|
import { type ComboboxStore, useCombobox } from "./use-combobox";
|
|
@@ -656,12 +655,17 @@ export interface ComboboxChevronProps extends Omit<
|
|
|
656
655
|
const ComboboxChevron = ComboboxChevronText.styleable<ComboboxChevronProps>(
|
|
657
656
|
function ComboboxChevron({ error, color, size, ...rest }, ref) {
|
|
658
657
|
void error;
|
|
659
|
-
|
|
660
|
-
// Concrete colour for the SVG (defaults to the chevron's `$color11`); an
|
|
658
|
+
// Paintable colour for the SVG (defaults to the chevron's `$color11`); an
|
|
661
659
|
// explicit `color`/slot value still wins. Size tracks the field's control key
|
|
662
660
|
// via the canonical icon ladder. The wrapper `Box` keeps the open/close
|
|
663
661
|
// rotation + slot passthrough.
|
|
664
|
-
|
|
662
|
+
//
|
|
663
|
+
// `useIconColor` rather than `useTheme()` + `resolveThemeColor`: on web the
|
|
664
|
+
// token → `var(--token)` mapping is a pure string transform, so the chevron of
|
|
665
|
+
// every Select/Autocomplete/MultiSelect no longer registers a theme subscriber
|
|
666
|
+
// (nor pays `useThemeWithState`'s dep-less per-render `useEffect`). Native
|
|
667
|
+
// still resolves through the theme, where the SVG needs a concrete colour.
|
|
668
|
+
const iconColor = useIconColor(typeof color === "string" ? color : "$color11");
|
|
665
669
|
// `size` is the open-ended host type (SizeKey | bare string | number); the
|
|
666
670
|
// ladder only keys on `SizeKey`/number, so narrow before mapping.
|
|
667
671
|
const iconSize =
|
|
@@ -179,9 +179,13 @@ export function OptionsDropdown(props: OptionsDropdownProps) {
|
|
|
179
179
|
"aria-label": ariaLabel,
|
|
180
180
|
} = props;
|
|
181
181
|
|
|
182
|
+
// Multi-select membership is O(1) per option — building the set once keeps the
|
|
183
|
+
// whole render O(n + m) instead of O(n * m) (`value.includes` per option).
|
|
184
|
+
const valueSet = React.useMemo(() => (Array.isArray(value) ? new Set(value) : null), [value]);
|
|
185
|
+
|
|
182
186
|
const options = React.useMemo(() => {
|
|
183
187
|
const isChecked = (optionValue: string) =>
|
|
184
|
-
|
|
188
|
+
valueSet ? valueSet.has(optionValue) : value != null && value === optionValue;
|
|
185
189
|
|
|
186
190
|
const renderItem = (item: ComboboxItem) => (
|
|
187
191
|
<OptionRow
|
|
@@ -208,6 +212,7 @@ export function OptionsDropdown(props: OptionsDropdownProps) {
|
|
|
208
212
|
}, [
|
|
209
213
|
data,
|
|
210
214
|
value,
|
|
215
|
+
valueSet,
|
|
211
216
|
activeValue,
|
|
212
217
|
withCheckIcon,
|
|
213
218
|
checkIconPosition,
|
package/src/Group/Group.tsx
CHANGED
|
@@ -98,7 +98,27 @@ export interface GroupProps extends GroupFrameProps {
|
|
|
98
98
|
export const Group = GroupFrame.styleable<GroupProps>(function Group(props, ref) {
|
|
99
99
|
const { children, grow = false, preventGrowOverflow = true, ...rest } = props;
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
const items = grow ? React.Children.toArray(children).filter(Boolean) : null;
|
|
102
|
+
|
|
103
|
+
// Memoised because it is the `style` handed to every non-Tamagui child (a
|
|
104
|
+
// memoized icon, a raw RN host). A fresh object per render is a fresh `style`
|
|
105
|
+
// identity, so the child's `React.memo` misses on every Group render — and on
|
|
106
|
+
// native react-native-svg then re-runs `StyleSheet.flatten` and rebuilds its
|
|
107
|
+
// root style array. It only actually depends on the child COUNT and the cap
|
|
108
|
+
// flag. Declared above the `!grow` early return so the hook order is stable
|
|
109
|
+
// when `grow` toggles.
|
|
110
|
+
const growStyle = React.useMemo<GrowStyle>(
|
|
111
|
+
() => ({
|
|
112
|
+
flexGrow: 1,
|
|
113
|
+
flexShrink: 1,
|
|
114
|
+
flexBasis: 0,
|
|
115
|
+
minWidth: 0,
|
|
116
|
+
...(preventGrowOverflow ? { maxWidth: `${100 / Math.max(items?.length ?? 1, 1)}%` } : {}),
|
|
117
|
+
}),
|
|
118
|
+
[items?.length, preventGrowOverflow],
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
if (!items) {
|
|
102
122
|
return (
|
|
103
123
|
<GroupFrame ref={ref} {...rest}>
|
|
104
124
|
{children}
|
|
@@ -106,15 +126,6 @@ export const Group = GroupFrame.styleable<GroupProps>(function Group(props, ref)
|
|
|
106
126
|
);
|
|
107
127
|
}
|
|
108
128
|
|
|
109
|
-
const items = React.Children.toArray(children).filter(Boolean);
|
|
110
|
-
const growStyle: GrowStyle = {
|
|
111
|
-
flexGrow: 1,
|
|
112
|
-
flexShrink: 1,
|
|
113
|
-
flexBasis: 0,
|
|
114
|
-
minWidth: 0,
|
|
115
|
-
...(preventGrowOverflow ? { maxWidth: `${100 / Math.max(items.length, 1)}%` } : {}),
|
|
116
|
-
};
|
|
117
|
-
|
|
118
129
|
return (
|
|
119
130
|
<GroupFrame ref={ref} {...rest}>
|
|
120
131
|
{items.map((child, i) =>
|
|
@@ -14,6 +14,9 @@ interface HighlightChunk {
|
|
|
14
14
|
matchedTerm: string;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/** Shared result for the non-string-children path — never rendered, never mutated. */
|
|
18
|
+
const NO_CHUNKS: readonly HighlightChunk[] = Object.freeze([]);
|
|
19
|
+
|
|
17
20
|
type HighlightMarkProps = Omit<MarkProps, "children">;
|
|
18
21
|
type HighlightStylesMap = Record<string, HighlightMarkProps>;
|
|
19
22
|
|
|
@@ -43,17 +46,22 @@ function isPerTermMap(
|
|
|
43
46
|
* The deprecated `highlightStyles` alias therefore merges OVER the `mark` slot
|
|
44
47
|
* ("explicit beats sugar"); a per-term entry, the documented exception with no
|
|
45
48
|
* Pillar-B equivalent, is the most specific and wins outright for its term.
|
|
49
|
+
*
|
|
50
|
+
* `perTermStyles` is the ALREADY-DECIDED per-term map (`undefined` when `legacy`
|
|
51
|
+
* is the single-object form). Deciding it in here re-ran `isPerTermMap` — a fresh
|
|
52
|
+
* `Set` plus `Object.entries` — once per highlighted chunk, even though the answer
|
|
53
|
+
* only depends on `highlightStyles` + the term list; the caller now decides once.
|
|
46
54
|
*/
|
|
47
55
|
function resolveHighlightStyles(
|
|
48
56
|
slotMark: HighlightMarkProps | undefined,
|
|
49
57
|
legacy: HighlightMarkProps | HighlightStylesMap | undefined,
|
|
50
|
-
|
|
58
|
+
perTermStyles: HighlightStylesMap | undefined,
|
|
51
59
|
matchedTerm: string,
|
|
52
60
|
): HighlightMarkProps {
|
|
53
61
|
const base = slotMark ?? {};
|
|
54
62
|
if (legacy === undefined) return base;
|
|
55
|
-
if (
|
|
56
|
-
return { ...base, ...legacy };
|
|
63
|
+
if (perTermStyles !== undefined) return { ...base, ...(perTermStyles[matchedTerm] ?? {}) };
|
|
64
|
+
return { ...base, ...(legacy as HighlightMarkProps) };
|
|
57
65
|
}
|
|
58
66
|
|
|
59
67
|
/** Strip diacritics for accent-insensitive matching. */
|
|
@@ -198,6 +206,36 @@ export const Highlight = Text.styleable<HighlightProps>(function Highlight(props
|
|
|
198
206
|
const s = slotStyles<HighlightStyles>(styles, HIGHLIGHT_SLOT_KEYS, "Highlight");
|
|
199
207
|
const slotMark = s.get("mark");
|
|
200
208
|
|
|
209
|
+
// ## Cost
|
|
210
|
+
//
|
|
211
|
+
// This is the search-results primitive: N instances re-render on every
|
|
212
|
+
// keystroke of the query they highlight. The scan below is the expensive part —
|
|
213
|
+
// a full `normalize()` of `children` (`.normalize("NFD")` + a `\p{M}` strip +
|
|
214
|
+
// `.toLowerCase()`) plus an O(len × terms) walk — and it used to run on every
|
|
215
|
+
// render even when nothing it reads had changed. Memoized on its real inputs.
|
|
216
|
+
// (The hooks sit ABOVE the non-string-children early return so hook order stays
|
|
217
|
+
// stable if `children` changes shape; the scan itself is guarded by `typeof`.)
|
|
218
|
+
const terms = React.useMemo(
|
|
219
|
+
() => (Array.isArray(highlight) ? highlight : [highlight]),
|
|
220
|
+
[highlight],
|
|
221
|
+
);
|
|
222
|
+
const chunks = React.useMemo(
|
|
223
|
+
() =>
|
|
224
|
+
typeof children === "string"
|
|
225
|
+
? highlighter(children, terms, { caseInsensitive, wholeWord, accentInsensitive })
|
|
226
|
+
: NO_CHUNKS,
|
|
227
|
+
[children, terms, caseInsensitive, wholeWord, accentInsensitive],
|
|
228
|
+
);
|
|
229
|
+
// Decide the `highlightStyles` shape ONCE per render rather than per matched
|
|
230
|
+
// chunk (see `resolveHighlightStyles`).
|
|
231
|
+
const perTermStyles = React.useMemo(
|
|
232
|
+
() =>
|
|
233
|
+
highlightStyles !== undefined && isPerTermMap(highlightStyles, terms)
|
|
234
|
+
? highlightStyles
|
|
235
|
+
: undefined,
|
|
236
|
+
[highlightStyles, terms],
|
|
237
|
+
);
|
|
238
|
+
|
|
201
239
|
if (typeof children !== "string") {
|
|
202
240
|
return (
|
|
203
241
|
<Text ref={ref} {...rest}>
|
|
@@ -206,9 +244,6 @@ export const Highlight = Text.styleable<HighlightProps>(function Highlight(props
|
|
|
206
244
|
);
|
|
207
245
|
}
|
|
208
246
|
|
|
209
|
-
const terms = Array.isArray(highlight) ? highlight : [highlight];
|
|
210
|
-
const chunks = highlighter(children, terms, { caseInsensitive, wholeWord, accentInsensitive });
|
|
211
|
-
|
|
212
247
|
return (
|
|
213
248
|
<Text ref={ref} {...rest}>
|
|
214
249
|
{chunks.map((part, index) => {
|
|
@@ -218,7 +253,7 @@ export const Highlight = Text.styleable<HighlightProps>(function Highlight(props
|
|
|
218
253
|
const markProps = resolveHighlightStyles(
|
|
219
254
|
slotMark,
|
|
220
255
|
highlightStyles,
|
|
221
|
-
|
|
256
|
+
perTermStyles,
|
|
222
257
|
part.matchedTerm,
|
|
223
258
|
);
|
|
224
259
|
return (
|