@knitui/components 0.4.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/ActionIcon/ActionIcon.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/Avatar/Avatar.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/PinInput/PinInput.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/ThemeIcon/ThemeIcon.js.map +1 -1
- package/lib/commonjs/Title/Title.js.map +1 -1
- package/lib/commonjs/Tooltip/Tooltip.js +27 -5
- package/lib/commonjs/Tooltip/Tooltip.js.map +1 -1
- package/lib/commonjs/Transition/use-transition.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/ActionIcon/ActionIcon.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/Avatar/Avatar.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/PinInput/PinInput.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/ThemeIcon/ThemeIcon.js.map +1 -1
- package/lib/module/Title/Title.js.map +1 -1
- package/lib/module/Tooltip/Tooltip.js +27 -5
- package/lib/module/Tooltip/Tooltip.js.map +1 -1
- package/lib/module/Transition/use-transition.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/ActionIcon/ActionIcon.d.ts.map +1 -1
- 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/Avatar/Avatar.d.ts.map +1 -1
- 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/FileButton/FileButton.types.d.ts.map +1 -1
- 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/PinInput/PinInput.d.ts.map +1 -1
- 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/ThemeIcon/ThemeIcon.d.ts.map +1 -1
- package/lib/typescript/Title/Title.d.ts +3 -3
- package/lib/typescript/Title/Title.d.ts.map +1 -1
- package/lib/typescript/Tooltip/Tooltip.d.ts.map +1 -1
- package/lib/typescript/Transition/use-transition.d.ts.map +1 -1
- package/lib/typescript/Tree/Tree.d.ts +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 +13 -13
- package/src/Accordion/Accordion.tsx +6 -2
- package/src/ActionIcon/ActionIcon.tsx +1 -8
- package/src/Alert/Alert.tsx +44 -29
- package/src/AngleSlider/AngleSlider.tsx +73 -21
- package/src/Autocomplete/Autocomplete.tsx +74 -55
- package/src/Avatar/Avatar.tsx +1 -7
- package/src/Badge/Badge.tsx +7 -16
- package/src/Button/Button.tsx +18 -11
- 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 +39 -27
- package/src/Combobox/Combobox.tsx +10 -6
- package/src/Combobox/OptionsDropdown.tsx +6 -1
- package/src/FileButton/FileButton.types.ts +2 -11
- 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/PinInput/PinInput.tsx +1 -8
- 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/ThemeIcon/ThemeIcon.tsx +1 -8
- package/src/Title/Title.tsx +1 -13
- package/src/Tooltip/Tooltip.tsx +33 -7
- package/src/Transition/use-transition.ts +1 -6
- 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,
|
|
@@ -104,13 +104,6 @@ interface AutocompleteContextValue {
|
|
|
104
104
|
styles?: SlotStyles<AutocompleteStyles>;
|
|
105
105
|
/** Deprecated alias merged over the `clearButton` slot. */
|
|
106
106
|
clearButtonProps?: Partial<ComboboxClearButtonProps>;
|
|
107
|
-
/** Trigger props the sugar wrapper assembled (chrome, aria, handlers). */
|
|
108
|
-
triggerProps?: Partial<AutocompleteInputProps> & {
|
|
109
|
-
placeholder?: React.ReactNode;
|
|
110
|
-
id?: string;
|
|
111
|
-
ref?: React.Ref<AutocompleteRef>;
|
|
112
|
-
clearSectionMode?: "clear" | "default" | "rightSection" | "both";
|
|
113
|
-
};
|
|
114
107
|
// Event/behaviour handlers consumed by Autocomplete.Trigger.
|
|
115
108
|
onClear: () => void;
|
|
116
109
|
onChangeText: React.ChangeEventHandler<HTMLInputElement>;
|
|
@@ -122,6 +115,26 @@ interface AutocompleteContextValue {
|
|
|
122
115
|
|
|
123
116
|
const AutocompleteContext = React.createContext<AutocompleteContextValue | null>(null);
|
|
124
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Trigger props the sugar wrapper assembled (chrome, aria, handlers, ref). Rebuilt
|
|
120
|
+
* every render (`...inputProps` is a rest spread, so its identity can never be
|
|
121
|
+
* preserved), which is why it rides its OWN context: `Autocomplete.Trigger` is the
|
|
122
|
+
* only consumer, while the option rows consume `AutocompleteContext`.
|
|
123
|
+
*/
|
|
124
|
+
type AutocompleteFunneledTriggerProps = Partial<AutocompleteInputProps> & {
|
|
125
|
+
placeholder?: React.ReactNode;
|
|
126
|
+
id?: string;
|
|
127
|
+
ref?: React.Ref<AutocompleteRef>;
|
|
128
|
+
clearSectionMode?: "clear" | "default" | "rightSection" | "both";
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const AutocompleteTriggerPropsContext = React.createContext<
|
|
132
|
+
AutocompleteFunneledTriggerProps | undefined
|
|
133
|
+
>(undefined);
|
|
134
|
+
|
|
135
|
+
/** Shared empty funnel for the composable path (no sugar wrapper above). */
|
|
136
|
+
const EMPTY_TRIGGER_PROPS: AutocompleteFunneledTriggerProps = {};
|
|
137
|
+
|
|
125
138
|
const useAutocompleteContext = (): AutocompleteContextValue => {
|
|
126
139
|
const ctx = React.useContext(AutocompleteContext);
|
|
127
140
|
if (!ctx) {
|
|
@@ -200,7 +213,7 @@ export interface AutocompleteRootProps {
|
|
|
200
213
|
* composing by hand you render `<Autocomplete.Trigger>` with your own props.
|
|
201
214
|
* @internal
|
|
202
215
|
*/
|
|
203
|
-
__triggerProps?:
|
|
216
|
+
__triggerProps?: AutocompleteFunneledTriggerProps;
|
|
204
217
|
}
|
|
205
218
|
|
|
206
219
|
function AutocompleteRoot(props: AutocompleteRootProps) {
|
|
@@ -243,13 +256,16 @@ function AutocompleteRoot(props: AutocompleteRootProps) {
|
|
|
243
256
|
defaultValue,
|
|
244
257
|
finalValue: "",
|
|
245
258
|
});
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
)
|
|
259
|
+
// Every handler in this Root is `useCallbackRef`-stable (identity fixed, latest
|
|
260
|
+
// closure). That is what lets the context memo below actually HIT: with fresh
|
|
261
|
+
// closures it either had to be invalidated every render (re-rendering every option
|
|
262
|
+
// row, since context propagation walks past `React.memo`) or it would have served
|
|
263
|
+
// stale callbacks. `handleSubmit` additionally lands on `<Combobox onOptionSubmit>`,
|
|
264
|
+
// a dep of Combobox's OWN context memo, so churn there hit every `Combobox.Option`.
|
|
265
|
+
const setValue = useCallbackRef((next: string) => {
|
|
266
|
+
setValueState(next);
|
|
267
|
+
onChange?.(next);
|
|
268
|
+
});
|
|
253
269
|
|
|
254
270
|
const parsed = React.useMemo(() => getParsedComboboxData(data), [data]);
|
|
255
271
|
const filterFn = filter ?? defaultOptionsFilter;
|
|
@@ -289,14 +305,11 @@ function AutocompleteRoot(props: AutocompleteRootProps) {
|
|
|
289
305
|
}
|
|
290
306
|
}, [flatOptions]);
|
|
291
307
|
|
|
292
|
-
const handleSubmit =
|
|
293
|
-
(optionValue
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
},
|
|
298
|
-
[setValue, onOptionSubmit, combobox],
|
|
299
|
-
);
|
|
308
|
+
const handleSubmit = useCallbackRef((optionValue: string) => {
|
|
309
|
+
setValue(optionValue);
|
|
310
|
+
onOptionSubmit?.(optionValue);
|
|
311
|
+
combobox.closeDropdown();
|
|
312
|
+
});
|
|
300
313
|
|
|
301
314
|
const moveActive = (direction: 1 | -1) => {
|
|
302
315
|
if (flatOptions.length === 0) return;
|
|
@@ -310,7 +323,7 @@ function AutocompleteRoot(props: AutocompleteRootProps) {
|
|
|
310
323
|
setActiveValue(flatOptions[nextIndex].value);
|
|
311
324
|
};
|
|
312
325
|
|
|
313
|
-
const handleKeyDown
|
|
326
|
+
const handleKeyDown = useCallbackRef<[React.KeyboardEvent<HTMLInputElement>], void>((event) => {
|
|
314
327
|
if (disabled || readOnly) return;
|
|
315
328
|
switch (event.key) {
|
|
316
329
|
case "ArrowDown":
|
|
@@ -342,20 +355,20 @@ function AutocompleteRoot(props: AutocompleteRootProps) {
|
|
|
342
355
|
break;
|
|
343
356
|
}
|
|
344
357
|
__triggerProps?.onKeyDown?.(event);
|
|
345
|
-
};
|
|
358
|
+
});
|
|
346
359
|
|
|
347
|
-
const handleChange
|
|
360
|
+
const handleChange = useCallbackRef<[React.ChangeEvent<HTMLInputElement>], void>((event) => {
|
|
348
361
|
setValue(event.currentTarget.value);
|
|
349
362
|
combobox.openDropdown();
|
|
350
363
|
if (selectFirstOptionOnChange) selectFirstPending.current = true;
|
|
351
|
-
};
|
|
364
|
+
});
|
|
352
365
|
|
|
353
|
-
const handleFocus
|
|
366
|
+
const handleFocus = useCallbackRef<[React.FocusEvent<HTMLInputElement>], void>((event) => {
|
|
354
367
|
if (openOnFocus) combobox.openDropdown();
|
|
355
368
|
__triggerProps?.onFocus?.(event);
|
|
356
|
-
};
|
|
369
|
+
});
|
|
357
370
|
|
|
358
|
-
const handleBlur
|
|
371
|
+
const handleBlur = useCallbackRef<[React.FocusEvent<HTMLInputElement>], void>((event) => {
|
|
359
372
|
if (autoSelectOnBlur && combobox.opened && activeValue != null) {
|
|
360
373
|
// Commit the highlighted suggestion; handleSubmit fills the input + closes.
|
|
361
374
|
handleSubmit(activeValue);
|
|
@@ -363,20 +376,20 @@ function AutocompleteRoot(props: AutocompleteRootProps) {
|
|
|
363
376
|
combobox.closeDropdown();
|
|
364
377
|
}
|
|
365
378
|
__triggerProps?.onBlur?.(event);
|
|
366
|
-
};
|
|
379
|
+
});
|
|
367
380
|
|
|
368
|
-
const handleClick
|
|
381
|
+
const handleClick = useCallbackRef<[React.MouseEvent<HTMLInputElement>], void>((event) => {
|
|
369
382
|
// Clicking the input is the usual way to focus it, so gate it on the same
|
|
370
383
|
// flag as focus — otherwise `openOnFocus={false}` (open-on-type only) is
|
|
371
384
|
// defeated by the click that focuses the field.
|
|
372
385
|
if (openOnFocus) combobox.openDropdown();
|
|
373
386
|
__triggerProps?.onClick?.(event);
|
|
374
|
-
};
|
|
387
|
+
});
|
|
375
388
|
|
|
376
|
-
const handleClear =
|
|
389
|
+
const handleClear = useCallbackRef(() => {
|
|
377
390
|
setValue("");
|
|
378
391
|
onClear?.();
|
|
379
|
-
}
|
|
392
|
+
});
|
|
380
393
|
|
|
381
394
|
const canClear = clearable && _value !== "" && !disabled && !readOnly;
|
|
382
395
|
|
|
@@ -397,7 +410,6 @@ function AutocompleteRoot(props: AutocompleteRootProps) {
|
|
|
397
410
|
renderOption,
|
|
398
411
|
styles,
|
|
399
412
|
clearButtonProps,
|
|
400
|
-
triggerProps: __triggerProps,
|
|
401
413
|
onClear: handleClear,
|
|
402
414
|
onChangeText: handleChange,
|
|
403
415
|
onKeyDown: handleKeyDown,
|
|
@@ -405,9 +417,9 @@ function AutocompleteRoot(props: AutocompleteRootProps) {
|
|
|
405
417
|
onBlur: handleBlur,
|
|
406
418
|
onClick: handleClick,
|
|
407
419
|
}),
|
|
408
|
-
//
|
|
409
|
-
//
|
|
410
|
-
|
|
420
|
+
// Deps are COMPLETE: every handler above is `useCallbackRef`-stable, so this memo
|
|
421
|
+
// genuinely hits. `__triggerProps` is deliberately absent — it rides its own
|
|
422
|
+
// context (it is rebuilt every render and only the Trigger reads it).
|
|
411
423
|
[
|
|
412
424
|
combobox,
|
|
413
425
|
size,
|
|
@@ -424,7 +436,12 @@ function AutocompleteRoot(props: AutocompleteRootProps) {
|
|
|
424
436
|
renderOption,
|
|
425
437
|
styles,
|
|
426
438
|
clearButtonProps,
|
|
427
|
-
|
|
439
|
+
handleClear,
|
|
440
|
+
handleChange,
|
|
441
|
+
handleKeyDown,
|
|
442
|
+
handleFocus,
|
|
443
|
+
handleBlur,
|
|
444
|
+
handleClick,
|
|
428
445
|
],
|
|
429
446
|
);
|
|
430
447
|
|
|
@@ -432,18 +449,20 @@ function AutocompleteRoot(props: AutocompleteRootProps) {
|
|
|
432
449
|
|
|
433
450
|
return (
|
|
434
451
|
<AutocompleteContext.Provider value={ctx}>
|
|
435
|
-
<
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
452
|
+
<AutocompleteTriggerPropsContext.Provider value={__triggerProps}>
|
|
453
|
+
<Combobox
|
|
454
|
+
position="bottom"
|
|
455
|
+
width="target"
|
|
456
|
+
// Deprecated `comboboxProps` alias merged OVER the `root` slot sugar
|
|
457
|
+
// ("explicit beats sugar").
|
|
458
|
+
{...s.merge("root", comboboxProps)}
|
|
459
|
+
store={combobox}
|
|
460
|
+
onOptionSubmit={handleSubmit}
|
|
461
|
+
size={size}
|
|
462
|
+
>
|
|
463
|
+
{children}
|
|
464
|
+
</Combobox>
|
|
465
|
+
</AutocompleteTriggerPropsContext.Provider>
|
|
447
466
|
</AutocompleteContext.Provider>
|
|
448
467
|
);
|
|
449
468
|
}
|
|
@@ -467,7 +486,7 @@ const AutocompleteTrigger = React.forwardRef<AutocompleteRef, AutocompleteTrigge
|
|
|
467
486
|
// the sugar caller resolve to the same trigger. Explicit props on
|
|
468
487
|
// `<Autocomplete.Trigger>` win over the funneled ones, which in turn win over
|
|
469
488
|
// the `trigger` slot sugar.
|
|
470
|
-
const funneled =
|
|
489
|
+
const funneled = React.useContext(AutocompleteTriggerPropsContext) ?? EMPTY_TRIGGER_PROPS;
|
|
471
490
|
const {
|
|
472
491
|
placeholder: funneledPlaceholder,
|
|
473
492
|
id: funneledId,
|
|
@@ -715,7 +734,7 @@ const AutocompleteComponent = React.forwardRef<AutocompleteRef, AutocompleteProp
|
|
|
715
734
|
|
|
716
735
|
// The remaining chrome props are funneled to `Autocomplete.Trigger` via Root
|
|
717
736
|
// context so the sugar path and the composable path converge on the same trigger.
|
|
718
|
-
const triggerProps:
|
|
737
|
+
const triggerProps: AutocompleteFunneledTriggerProps = {
|
|
719
738
|
...inputProps,
|
|
720
739
|
placeholder,
|
|
721
740
|
id,
|
package/src/Avatar/Avatar.tsx
CHANGED
|
@@ -25,13 +25,7 @@ import { Text } from "../Text";
|
|
|
25
25
|
|
|
26
26
|
export type AvatarSize = SizeKey;
|
|
27
27
|
export type AvatarVariant =
|
|
28
|
-
| "
|
|
29
|
-
| "light"
|
|
30
|
-
| "outline"
|
|
31
|
-
| "transparent"
|
|
32
|
-
| "default"
|
|
33
|
-
| "white"
|
|
34
|
-
| "gradient";
|
|
28
|
+
"filled" | "light" | "outline" | "transparent" | "default" | "white" | "gradient";
|
|
35
29
|
|
|
36
30
|
/** Accent color theme names available for auto-color assignment. */
|
|
37
31
|
const ACCENT_COLORS = [
|
package/src/Badge/Badge.tsx
CHANGED
|
@@ -16,18 +16,12 @@ 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;
|
|
22
23
|
type BadgeVariant =
|
|
23
|
-
| "
|
|
24
|
-
| "light"
|
|
25
|
-
| "outline"
|
|
26
|
-
| "dot"
|
|
27
|
-
| "transparent"
|
|
28
|
-
| "white"
|
|
29
|
-
| "default"
|
|
30
|
-
| "gradient";
|
|
24
|
+
"filled" | "light" | "outline" | "dot" | "transparent" | "white" | "default" | "gradient";
|
|
31
25
|
|
|
32
26
|
const BadgeContext = createStyledContext<{ size: BadgeSize | number; variant: BadgeVariant }>({
|
|
33
27
|
size: "md",
|
|
@@ -184,14 +178,11 @@ const BadgeComponent = BadgeFrame.styleable<BadgeProps>(function Badge(props, re
|
|
|
184
178
|
|
|
185
179
|
// Inject the `text` slot props into the wrapper `renderTextChild` auto-applies
|
|
186
180
|
// around string/number children, so the label slot reaches the auto-wrapped text.
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
},
|
|
193
|
-
[textSlot],
|
|
194
|
-
);
|
|
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"));
|
|
195
186
|
|
|
196
187
|
return (
|
|
197
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";
|
|
@@ -38,14 +38,7 @@ import { Text } from "../Text";
|
|
|
38
38
|
type ButtonSize = SizeKey;
|
|
39
39
|
|
|
40
40
|
type ButtonVariant =
|
|
41
|
-
| "
|
|
42
|
-
| "light"
|
|
43
|
-
| "outline"
|
|
44
|
-
| "subtle"
|
|
45
|
-
| "default"
|
|
46
|
-
| "white"
|
|
47
|
-
| "transparent"
|
|
48
|
-
| "gradient";
|
|
41
|
+
"filled" | "light" | "outline" | "subtle" | "default" | "white" | "transparent" | "gradient";
|
|
49
42
|
|
|
50
43
|
const ButtonContext = createStyledContext<{ size: ButtonSize; variant: ButtonVariant }>({
|
|
51
44
|
size: "md",
|
|
@@ -82,6 +75,14 @@ const ButtonFrame = styled(Box, {
|
|
|
82
75
|
// `variant-colors` ladder so Button/ActionIcon and `theme="…"` stay in lockstep.
|
|
83
76
|
variant: {
|
|
84
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" },
|
|
85
86
|
},
|
|
86
87
|
size: {
|
|
87
88
|
...controlVariant,
|
|
@@ -172,6 +173,12 @@ export interface ButtonStyles {
|
|
|
172
173
|
loader?: Partial<LoaderProps>;
|
|
173
174
|
}
|
|
174
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
|
+
|
|
175
182
|
const BUTTON_SLOT_KEYS = [
|
|
176
183
|
"left",
|
|
177
184
|
"label",
|
|
@@ -231,7 +238,7 @@ const ButtonComponent = ButtonFrame.styleable<ButtonProps>(function Button(props
|
|
|
231
238
|
|
|
232
239
|
// Normalize marker slots from `children`. Plain (non-marker) children fold
|
|
233
240
|
// into `Label`, so `<Button>plain text</Button>` behaves exactly as before.
|
|
234
|
-
const slots = ButtonSlots.collect(children,
|
|
241
|
+
const slots = ButtonSlots.collect(children, BUTTON_COLLECT_OPTS);
|
|
235
242
|
|
|
236
243
|
// Precedence (slot-system-plan): marker slot → legacy prop → plain children.
|
|
237
244
|
// `loading` still replaces the left visual, matching the prior behavior. The
|
|
@@ -286,7 +293,7 @@ const ButtonComponent = ButtonFrame.styleable<ButtonProps>(function Button(props
|
|
|
286
293
|
aria-disabled={isDisabled || undefined}
|
|
287
294
|
{...nativeIdProps}
|
|
288
295
|
// Real focusable `<button>` on web so the `:focus-visible` outline fires.
|
|
289
|
-
{...
|
|
296
|
+
{...WEB_BUTTON_PROPS}
|
|
290
297
|
>
|
|
291
298
|
{grad.layer}
|
|
292
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
|