@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,18 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
styled,
|
|
6
|
-
type TamaguiElement,
|
|
7
|
-
useTheme,
|
|
8
|
-
withStaticProperties,
|
|
9
|
-
} from "@knitui/core";
|
|
10
|
-
import { useDebouncedCallback, useMergedRef, useMove, useReducedMotion } from "@knitui/hooks";
|
|
3
|
+
import { type GetProps, styled, type TamaguiElement, withStaticProperties } from "@knitui/core";
|
|
4
|
+
import { useDebouncedCallback, useMergedRef, useMove } from "@knitui/hooks";
|
|
11
5
|
|
|
12
6
|
import { Box, type BoxProps } from "../Box";
|
|
13
7
|
import { useReducedTransition } from "../internal/motion";
|
|
14
8
|
import { animateOnlyProps, hoverProps } from "../internal/style-props";
|
|
15
9
|
import { slotStyles } from "../internal/styles";
|
|
10
|
+
import { themeColorToCssVar } from "../internal/theme-color-web";
|
|
16
11
|
import {
|
|
17
12
|
DEFAULT_HIDE_DELAY,
|
|
18
13
|
DEFAULT_IDLE_SCROLLBAR_SIZE,
|
|
@@ -86,6 +81,26 @@ const ANIMATE_OPACITY = ["opacity"];
|
|
|
86
81
|
const ANIMATE_Y_THUMB = ["left", "right", "opacity"];
|
|
87
82
|
const ANIMATE_X_THUMB = ["top", "bottom", "opacity"];
|
|
88
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Default colour the edge-fade gradients fade FROM — the surface behind the
|
|
86
|
+
* viewport, i.e. the theme's `background`.
|
|
87
|
+
*
|
|
88
|
+
* Resolved once at module scope to the token's CSS custom property (this is the
|
|
89
|
+
* web twin; `ScrollArea.native.tsx` owns native). It used to be read per render
|
|
90
|
+
* as `theme.background?.val`, which cost a `useTheme()` — `useThemeWithState`
|
|
91
|
+
* (useId + useRef + useReducer + a DEP-LESS `useEffect` firing after every
|
|
92
|
+
* render) — AND, because touching a field on Tamagui's theme proxy calls its
|
|
93
|
+
* `track()`, made every ScrollArea a full theme SUBSCRIBER, even with `shadows`
|
|
94
|
+
* off. The `var()` follows theme changes by itself, which is the whole point.
|
|
95
|
+
* The old JS `?? "rgba(0,0,0,0.15)"` last resort is preserved as the CSS
|
|
96
|
+
* variable's own fallback, so a document with no theme variables still fades.
|
|
97
|
+
*/
|
|
98
|
+
const EDGE_SHADOW_FALLBACK = "rgba(0,0,0,0.15)";
|
|
99
|
+
const themeBackgroundVar = themeColorToCssVar("$background");
|
|
100
|
+
const DEFAULT_EDGE_SHADOW_COLOR = themeBackgroundVar.startsWith("var(")
|
|
101
|
+
? `${themeBackgroundVar.slice(0, -1)}, ${EDGE_SHADOW_FALLBACK})`
|
|
102
|
+
: themeBackgroundVar;
|
|
103
|
+
|
|
89
104
|
/* -------------------------------------------------------------------------- */
|
|
90
105
|
/* Styled frames */
|
|
91
106
|
/* -------------------------------------------------------------------------- */
|
|
@@ -249,8 +264,6 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
249
264
|
const mergedScrollbarProps = slots.merge("scrollbar", scrollbarProps);
|
|
250
265
|
const mergedThumbProps = slots.merge("thumb", thumbProps);
|
|
251
266
|
const mergedCornerProps = slots.merge("corner", cornerProps);
|
|
252
|
-
const theme = useTheme();
|
|
253
|
-
const reducedMotion = useReducedMotion();
|
|
254
267
|
|
|
255
268
|
const viewportNodeRef = React.useRef<TamaguiElement | null>(null);
|
|
256
269
|
// Size changes rarely (mount/resize). Scroll changes every frame but is kept OUT
|
|
@@ -268,6 +281,8 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
268
281
|
const geomRef = React.useRef({ yTrack: 0, xTrack: 0 });
|
|
269
282
|
const rafRef = React.useRef<number | null>(null);
|
|
270
283
|
const [scrolling, setScrolling] = React.useState(false);
|
|
284
|
+
// Mirrors `scrolling` so the per-event flash can skip a redundant setState.
|
|
285
|
+
const scrollingRef = React.useRef(false);
|
|
271
286
|
const [dragging, setDragging] = React.useState(false);
|
|
272
287
|
const hideTimeout = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
|
|
273
288
|
|
|
@@ -311,11 +326,21 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
311
326
|
setSize(next);
|
|
312
327
|
}, []);
|
|
313
328
|
|
|
329
|
+
// Called once per scroll event. `setScrolling(true)` is guarded by a ref because
|
|
330
|
+
// React only bails on a same-value update AFTER re-entering the component — on a
|
|
331
|
+
// 120 Hz trackpad fling that is a wasted render pass per frame for the whole
|
|
332
|
+
// subtree. The hide timer is cheap to restart, so it stays unguarded.
|
|
314
333
|
const flashScrollbars = React.useCallback(() => {
|
|
315
334
|
if (type !== "hover" && type !== "scroll") return;
|
|
316
|
-
|
|
335
|
+
if (!scrollingRef.current) {
|
|
336
|
+
scrollingRef.current = true;
|
|
337
|
+
setScrolling(true);
|
|
338
|
+
}
|
|
317
339
|
clearTimeout(hideTimeout.current);
|
|
318
|
-
hideTimeout.current = setTimeout(() =>
|
|
340
|
+
hideTimeout.current = setTimeout(() => {
|
|
341
|
+
scrollingRef.current = false;
|
|
342
|
+
setScrolling(false);
|
|
343
|
+
}, scrollHideDelay);
|
|
319
344
|
}, [type, scrollHideDelay]);
|
|
320
345
|
|
|
321
346
|
const debouncedScrollEnd = useDebouncedCallback((pos: ScrollPosition) => {
|
|
@@ -350,9 +375,42 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
350
375
|
const shadowEligible = resolveShadowEdges(shadows, axes);
|
|
351
376
|
const anyShadow =
|
|
352
377
|
shadowEligible.top || shadowEligible.bottom || shadowEligible.left || shadowEligible.right;
|
|
353
|
-
//
|
|
354
|
-
//
|
|
355
|
-
|
|
378
|
+
// Which edges currently have content beyond them — the ONLY thing the opt-in edge
|
|
379
|
+
// fades need. Storing the booleans (rather than mirroring the raw scroll offset
|
|
380
|
+
// into state, as this used to) means a scroll re-renders at most FOUR times over
|
|
381
|
+
// its whole length — once per edge crossing — instead of once per frame. Each of
|
|
382
|
+
// those frames previously re-rendered the ScrollArea and restyled four Tamagui
|
|
383
|
+
// overlays while the browser was already busy scrolling.
|
|
384
|
+
const [edges, setEdges] = React.useState<EdgeState>({
|
|
385
|
+
top: false,
|
|
386
|
+
bottom: false,
|
|
387
|
+
left: false,
|
|
388
|
+
right: false,
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
// Recompute the edge-fade booleans off the live scroll offset + measured size, and
|
|
392
|
+
// re-render ONLY when one actually flips. No-op unless `shadows` is set.
|
|
393
|
+
const syncEdges = React.useCallback(() => {
|
|
394
|
+
if (!anyShadow) return;
|
|
395
|
+
const sz = sizeRef.current;
|
|
396
|
+
const { x, y } = scrollRef.current;
|
|
397
|
+
const next = getEdgeState({
|
|
398
|
+
viewportW: sz.viewportW,
|
|
399
|
+
viewportH: sz.viewportH,
|
|
400
|
+
contentW: sz.contentW,
|
|
401
|
+
contentH: sz.contentH,
|
|
402
|
+
scrollX: x,
|
|
403
|
+
scrollY: y,
|
|
404
|
+
});
|
|
405
|
+
setEdges((prev) =>
|
|
406
|
+
prev.top === next.top &&
|
|
407
|
+
prev.bottom === next.bottom &&
|
|
408
|
+
prev.left === next.left &&
|
|
409
|
+
prev.right === next.right
|
|
410
|
+
? prev
|
|
411
|
+
: next,
|
|
412
|
+
);
|
|
413
|
+
}, [anyShadow]);
|
|
356
414
|
|
|
357
415
|
// Paint the thumb offsets straight to the DOM (rAF-coalesced) — never through
|
|
358
416
|
// React state — so a scroll never re-renders or restyles the Tamagui thumb. The
|
|
@@ -402,9 +460,7 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
402
460
|
const y = node.scrollTop;
|
|
403
461
|
scrollRef.current = { x, y };
|
|
404
462
|
schedulePaint();
|
|
405
|
-
|
|
406
|
-
setShadowScroll((prev) => (prev.x === x && prev.y === y ? prev : { x, y }));
|
|
407
|
-
}
|
|
463
|
+
syncEdges();
|
|
408
464
|
onScrollPositionChange?.({ x, y });
|
|
409
465
|
flashScrollbars();
|
|
410
466
|
|
|
@@ -419,7 +475,7 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
419
475
|
},
|
|
420
476
|
[
|
|
421
477
|
schedulePaint,
|
|
422
|
-
|
|
478
|
+
syncEdges,
|
|
423
479
|
onScrollPositionChange,
|
|
424
480
|
flashScrollbars,
|
|
425
481
|
fireReachCallbacks,
|
|
@@ -446,26 +502,73 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
446
502
|
);
|
|
447
503
|
|
|
448
504
|
// Re-read size whenever the viewport or its content resizes, and (when armed)
|
|
449
|
-
// follow the bottom as content grows.
|
|
450
|
-
//
|
|
451
|
-
// when content
|
|
452
|
-
|
|
505
|
+
// follow the bottom as content grows. The observer watches the viewport AND its
|
|
506
|
+
// direct children, because a `ResizeObserver` on a scroll container does NOT fire
|
|
507
|
+
// when its content grows — only the children's own boxes change.
|
|
508
|
+
//
|
|
509
|
+
// The observer is created ONCE and its observations are reconciled per commit.
|
|
510
|
+
// Rebuilding it whenever the child count changed (the previous approach) is exactly
|
|
511
|
+
// the wrong shape for the kit's most important scrolling case: a windowed list
|
|
512
|
+
// (`VirtualList`) inside a `ScrollArea` changes its child count on every window
|
|
513
|
+
// advance, i.e. mid-fling — so every advance tore down the observer and re-observed
|
|
514
|
+
// N nodes while the browser was scrolling. The callback is read through a ref so
|
|
515
|
+
// the observer never needs re-creating to see fresh props.
|
|
516
|
+
const onContentResizeRef = React.useRef<() => void>(() => {});
|
|
517
|
+
onContentResizeRef.current = () => {
|
|
518
|
+
const node = viewportNodeRef.current as HTMLElement | null;
|
|
519
|
+
if (!node) return;
|
|
520
|
+
readSize();
|
|
521
|
+
syncEdges();
|
|
522
|
+
if (stickToBottom && stuckRef.current && node.scrollHeight > prevContentHRef.current) {
|
|
523
|
+
programmaticRef.current = true;
|
|
524
|
+
node.scrollTop = node.scrollHeight;
|
|
525
|
+
}
|
|
526
|
+
prevContentHRef.current = node.scrollHeight;
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
const observerRef = React.useRef<ResizeObserver | null>(null);
|
|
530
|
+
const observedRef = React.useRef<Set<Element>>(new Set());
|
|
531
|
+
|
|
532
|
+
// ResizeObserver is absent in jsdom — guard so the suite doesn't throw.
|
|
453
533
|
React.useEffect(() => {
|
|
454
534
|
readSize();
|
|
535
|
+
// The fades depend on the measured size as well as the offset, so re-derive them
|
|
536
|
+
// whenever the size lands (they are no longer recomputed during render).
|
|
537
|
+
syncEdges();
|
|
538
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
539
|
+
const observer = new ResizeObserver(() => onContentResizeRef.current());
|
|
540
|
+
observerRef.current = observer;
|
|
541
|
+
const observed = observedRef.current;
|
|
542
|
+
return () => {
|
|
543
|
+
observer.disconnect();
|
|
544
|
+
observerRef.current = null;
|
|
545
|
+
observed.clear();
|
|
546
|
+
};
|
|
547
|
+
}, [readSize, syncEdges]);
|
|
548
|
+
|
|
549
|
+
// Reconcile WHICH nodes are observed after every commit: add newly-mounted
|
|
550
|
+
// children, drop detached ones (`observe` on an already-observed element is a
|
|
551
|
+
// no-op, so the common case where nothing changed costs one loop over the
|
|
552
|
+
// children and no observer work at all).
|
|
553
|
+
React.useEffect(() => {
|
|
554
|
+
const observer = observerRef.current;
|
|
455
555
|
const node = viewportNodeRef.current as HTMLElement | null;
|
|
456
|
-
if (!
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
556
|
+
if (!observer || !node) return;
|
|
557
|
+
const observed = observedRef.current;
|
|
558
|
+
const live = new Set<Element>([node, ...Array.from(node.children)]);
|
|
559
|
+
for (const el of live) {
|
|
560
|
+
if (!observed.has(el)) {
|
|
561
|
+
observer.observe(el);
|
|
562
|
+
observed.add(el);
|
|
462
563
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
564
|
+
}
|
|
565
|
+
for (const el of observed) {
|
|
566
|
+
if (!live.has(el)) {
|
|
567
|
+
observer.unobserve(el);
|
|
568
|
+
observed.delete(el);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
});
|
|
469
572
|
|
|
470
573
|
// Whether each axis can scroll at all (content overflows). Independent of
|
|
471
574
|
// visibility, so it can decide whether the corner is needed.
|
|
@@ -726,18 +829,8 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
726
829
|
// `shadowEligible` / `anyShadow` are resolved above (near `handleScroll`). Only
|
|
727
830
|
// compute overflow state when shadows are requested, off the gated `shadowScroll`
|
|
728
831
|
// mirror so the fades stay correct without the thumb's imperative offset.
|
|
729
|
-
const edgeOverflow = anyShadow
|
|
730
|
-
|
|
731
|
-
viewportW: size.viewportW,
|
|
732
|
-
viewportH: size.viewportH,
|
|
733
|
-
contentW: size.contentW,
|
|
734
|
-
contentH: size.contentH,
|
|
735
|
-
scrollX: shadowScroll.x,
|
|
736
|
-
scrollY: shadowScroll.y,
|
|
737
|
-
})
|
|
738
|
-
: null;
|
|
739
|
-
const resolvedShadowColor =
|
|
740
|
-
shadowColor ?? (theme.background?.val as string | undefined) ?? "rgba(0,0,0,0.15)";
|
|
832
|
+
const edgeOverflow = anyShadow ? edges : null;
|
|
833
|
+
const resolvedShadowColor = shadowColor ?? DEFAULT_EDGE_SHADOW_COLOR;
|
|
741
834
|
|
|
742
835
|
const renderEdgeShadow = (edge: Edge) => {
|
|
743
836
|
if (!shadowEligible[edge] || !edgeOverflow) return null;
|
|
@@ -402,7 +402,18 @@ const SegmentedControlBase = SegmentedControlRoot.styleable<SegmentedControlProp
|
|
|
402
402
|
const { x, y, width, height } = e.nativeEvent.layout;
|
|
403
403
|
layoutsRef.current[item.value] = { x, y, width, height };
|
|
404
404
|
if (item.value === current) {
|
|
405
|
-
|
|
405
|
+
// `onLayout` fires on every layout pass, not just on change —
|
|
406
|
+
// return the previous state when nothing moved so React bails
|
|
407
|
+
// out of the re-render instead of re-committing an equal object.
|
|
408
|
+
setActiveLayout((prev) =>
|
|
409
|
+
prev &&
|
|
410
|
+
prev.x === x &&
|
|
411
|
+
prev.y === y &&
|
|
412
|
+
prev.width === width &&
|
|
413
|
+
prev.height === height
|
|
414
|
+
? prev
|
|
415
|
+
: { x, y, width, height },
|
|
416
|
+
);
|
|
406
417
|
}
|
|
407
418
|
}}
|
|
408
419
|
>
|
package/src/Select/Select.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
|
|
3
3
|
import type { GetProps } from "@knitui/core";
|
|
4
4
|
import { withStaticProperties } from "@knitui/core";
|
|
5
|
-
import { useId, useUncontrolled } from "@knitui/hooks";
|
|
5
|
+
import { useCallbackRef, useId, useUncontrolled } from "@knitui/hooks";
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
Combobox,
|
|
@@ -115,14 +115,6 @@ interface SelectContextValue {
|
|
|
115
115
|
styles?: SlotStyles<SelectStyles>;
|
|
116
116
|
/** Deprecated alias merged over the `clearButton` slot. */
|
|
117
117
|
clearButtonProps?: Partial<ComboboxClearButtonProps>;
|
|
118
|
-
/** Trigger props the sugar wrapper assembled (chrome, aria, handlers). */
|
|
119
|
-
triggerProps?: Partial<SelectInputProps> & {
|
|
120
|
-
role?: string;
|
|
121
|
-
placeholder?: React.ReactNode;
|
|
122
|
-
id?: string;
|
|
123
|
-
ref?: React.Ref<SelectRef>;
|
|
124
|
-
clearSectionMode?: "clear" | "default" | "rightSection" | "both";
|
|
125
|
-
};
|
|
126
118
|
// Event/behaviour handlers consumed by Select.Trigger.
|
|
127
119
|
onClear: () => void;
|
|
128
120
|
onChangeText: React.ChangeEventHandler<HTMLInputElement>;
|
|
@@ -142,6 +134,30 @@ const useSelectContext = (): SelectContextValue => {
|
|
|
142
134
|
return ctx;
|
|
143
135
|
};
|
|
144
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Trigger props the sugar wrapper assembled (chrome, aria, ref, handlers). The
|
|
139
|
+
* sugar wrapper rebuilds this object on every render — `...inputProps` is a rest
|
|
140
|
+
* spread, so its identity can never be preserved — which is exactly why it rides
|
|
141
|
+
* its OWN context instead of the behaviour context above: `Select.Trigger` is the
|
|
142
|
+
* single consumer, while the option rows consume `SelectContext`. Merging the two
|
|
143
|
+
* made the behaviour context a fresh object every render and re-rendered every
|
|
144
|
+
* option row (context propagation walks past `React.memo`).
|
|
145
|
+
*/
|
|
146
|
+
type SelectFunneledTriggerProps = Partial<SelectInputProps> & {
|
|
147
|
+
role?: string;
|
|
148
|
+
placeholder?: React.ReactNode;
|
|
149
|
+
id?: string;
|
|
150
|
+
ref?: React.Ref<SelectRef>;
|
|
151
|
+
clearSectionMode?: "clear" | "default" | "rightSection" | "both";
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const SelectTriggerPropsContext = React.createContext<SelectFunneledTriggerProps | undefined>(
|
|
155
|
+
undefined,
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
/** Shared empty funnel for the composable path (no sugar wrapper above). */
|
|
159
|
+
const EMPTY_TRIGGER_PROPS: SelectFunneledTriggerProps = {};
|
|
160
|
+
|
|
145
161
|
/* -------------------------------------------------------------------------- */
|
|
146
162
|
/* Select.Root — the value / search / active-option state machine */
|
|
147
163
|
/* -------------------------------------------------------------------------- */
|
|
@@ -226,7 +242,7 @@ export interface SelectRootProps {
|
|
|
226
242
|
* by hand you render `<Select.Trigger>` with your own props instead.
|
|
227
243
|
* @internal
|
|
228
244
|
*/
|
|
229
|
-
__triggerProps?:
|
|
245
|
+
__triggerProps?: SelectFunneledTriggerProps;
|
|
230
246
|
}
|
|
231
247
|
|
|
232
248
|
function SelectRoot(props: SelectRootProps) {
|
|
@@ -281,26 +297,20 @@ function SelectRoot(props: SelectRootProps) {
|
|
|
281
297
|
});
|
|
282
298
|
const selectedOption = _value != null ? lockup[_value] : undefined;
|
|
283
299
|
|
|
284
|
-
const setValue =
|
|
285
|
-
(next
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
},
|
|
289
|
-
[setValueState, onChange],
|
|
290
|
-
);
|
|
300
|
+
const setValue = useCallbackRef((next: string | null, option: ComboboxItem | null) => {
|
|
301
|
+
setValueState(next);
|
|
302
|
+
onChange?.(next, option);
|
|
303
|
+
});
|
|
291
304
|
|
|
292
305
|
const [search, setSearchState] = useUncontrolled<string>({
|
|
293
306
|
value: searchValue,
|
|
294
307
|
defaultValue: defaultSearchValue,
|
|
295
308
|
finalValue: selectedOption ? selectedOption.label : "",
|
|
296
309
|
});
|
|
297
|
-
const setSearch =
|
|
298
|
-
(next
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
},
|
|
302
|
-
[setSearchState, onSearchChange],
|
|
303
|
-
);
|
|
310
|
+
const setSearch = useCallbackRef((next: string) => {
|
|
311
|
+
setSearchState(next);
|
|
312
|
+
onSearchChange?.(next);
|
|
313
|
+
});
|
|
304
314
|
|
|
305
315
|
const combobox = useCombobox({
|
|
306
316
|
opened: dropdownOpened,
|
|
@@ -358,18 +368,18 @@ function SelectRoot(props: SelectRootProps) {
|
|
|
358
368
|
}
|
|
359
369
|
}, [flatOptions]);
|
|
360
370
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
);
|
|
371
|
+
// Stable identity, latest closure. `handleSubmit` lands on `<Combobox
|
|
372
|
+
// onOptionSubmit>`, which is a dep of Combobox's own context memo — a fresh
|
|
373
|
+
// function here churned that context and re-rendered every `Combobox.Option`.
|
|
374
|
+
const handleSubmit = useCallbackRef((optionValue: string) => {
|
|
375
|
+
const option = lockup[optionValue];
|
|
376
|
+
if (!option || option.disabled) return;
|
|
377
|
+
onOptionSubmit?.(optionValue);
|
|
378
|
+
const next = allowDeselect && optionValue === _value ? null : optionValue;
|
|
379
|
+
setValue(next, next != null ? option : null);
|
|
380
|
+
if (!controlled) setSearch(next != null ? option.label : "");
|
|
381
|
+
combobox.closeDropdown();
|
|
382
|
+
});
|
|
373
383
|
|
|
374
384
|
const moveActive = (direction: 1 | -1) => {
|
|
375
385
|
if (flatOptions.length === 0) return;
|
|
@@ -383,7 +393,12 @@ function SelectRoot(props: SelectRootProps) {
|
|
|
383
393
|
setActiveValue(flatOptions[nextIndex].value);
|
|
384
394
|
};
|
|
385
395
|
|
|
386
|
-
|
|
396
|
+
// Every handler below is `useCallbackRef`-stable (identity fixed, latest closure).
|
|
397
|
+
// That is what lets the context memo further down actually HIT: with fresh
|
|
398
|
+
// closures the memo either had to be invalidated every render (re-rendering every
|
|
399
|
+
// option row) or it would have served stale `onSearchChange`/`__triggerProps`
|
|
400
|
+
// callbacks. Stable + always-latest gets both.
|
|
401
|
+
const handleKeyDown = useCallbackRef<[React.KeyboardEvent<HTMLInputElement>], void>((event) => {
|
|
387
402
|
if (disabled || readOnly) return;
|
|
388
403
|
switch (event.key) {
|
|
389
404
|
case "ArrowDown":
|
|
@@ -415,20 +430,20 @@ function SelectRoot(props: SelectRootProps) {
|
|
|
415
430
|
break;
|
|
416
431
|
}
|
|
417
432
|
__triggerProps?.onKeyDown?.(event);
|
|
418
|
-
};
|
|
433
|
+
});
|
|
419
434
|
|
|
420
|
-
const handleChange
|
|
435
|
+
const handleChange = useCallbackRef<[React.ChangeEvent<HTMLInputElement>], void>((event) => {
|
|
421
436
|
setSearch(event.currentTarget.value);
|
|
422
437
|
combobox.openDropdown();
|
|
423
438
|
if (selectFirstOptionOnChange) selectFirstPending.current = true;
|
|
424
|
-
};
|
|
439
|
+
});
|
|
425
440
|
|
|
426
|
-
const handleFocus
|
|
441
|
+
const handleFocus = useCallbackRef<[React.FocusEvent<HTMLInputElement>], void>((event) => {
|
|
427
442
|
if (searchable && openOnFocus) combobox.openDropdown();
|
|
428
443
|
__triggerProps?.onFocus?.(event);
|
|
429
|
-
};
|
|
444
|
+
});
|
|
430
445
|
|
|
431
|
-
const handleBlur
|
|
446
|
+
const handleBlur = useCallbackRef<[React.FocusEvent<HTMLInputElement>], void>((event) => {
|
|
432
447
|
if (autoSelectOnBlur && combobox.opened && activeValue != null) {
|
|
433
448
|
// Commit the highlighted option; handleSubmit closes the dropdown and resets
|
|
434
449
|
// the displayed label, superseding the default blur reset below.
|
|
@@ -438,22 +453,22 @@ function SelectRoot(props: SelectRootProps) {
|
|
|
438
453
|
setSearch(selectedOption ? selectedOption.label : "");
|
|
439
454
|
}
|
|
440
455
|
__triggerProps?.onBlur?.(event);
|
|
441
|
-
};
|
|
456
|
+
});
|
|
442
457
|
|
|
443
|
-
const handleClick
|
|
458
|
+
const handleClick = useCallbackRef<[React.MouseEvent<HTMLInputElement>], void>((event) => {
|
|
444
459
|
if (searchable) {
|
|
445
460
|
combobox.openDropdown();
|
|
446
461
|
} else {
|
|
447
462
|
combobox.toggleDropdown();
|
|
448
463
|
}
|
|
449
464
|
__triggerProps?.onClick?.(event);
|
|
450
|
-
};
|
|
465
|
+
});
|
|
451
466
|
|
|
452
|
-
const handleClear =
|
|
467
|
+
const handleClear = useCallbackRef(() => {
|
|
453
468
|
setValue(null, null);
|
|
454
469
|
setSearch("");
|
|
455
470
|
onClear?.();
|
|
456
|
-
}
|
|
471
|
+
});
|
|
457
472
|
|
|
458
473
|
const canClear = clearable && _value != null && !disabled && !readOnly;
|
|
459
474
|
const inputValue = searchable ? search : (selectedOption?.label ?? "");
|
|
@@ -479,7 +494,6 @@ function SelectRoot(props: SelectRootProps) {
|
|
|
479
494
|
renderOption,
|
|
480
495
|
styles,
|
|
481
496
|
clearButtonProps,
|
|
482
|
-
triggerProps: __triggerProps,
|
|
483
497
|
onClear: handleClear,
|
|
484
498
|
onChangeText: handleChange,
|
|
485
499
|
onKeyDown: handleKeyDown,
|
|
@@ -487,9 +501,11 @@ function SelectRoot(props: SelectRootProps) {
|
|
|
487
501
|
onBlur: handleBlur,
|
|
488
502
|
onClick: handleClick,
|
|
489
503
|
}),
|
|
490
|
-
//
|
|
491
|
-
// context value
|
|
492
|
-
|
|
504
|
+
// Deps are COMPLETE: every handler above is `useCallbackRef`-stable, so this memo
|
|
505
|
+
// genuinely hits and the context value only changes when observable state does.
|
|
506
|
+
// `__triggerProps` is deliberately absent — it rides its own context (see
|
|
507
|
+
// `SelectTriggerPropsContext`) because it is rebuilt every render by the sugar
|
|
508
|
+
// wrapper and only `Select.Trigger` reads it.
|
|
493
509
|
[
|
|
494
510
|
combobox,
|
|
495
511
|
size,
|
|
@@ -510,7 +526,12 @@ function SelectRoot(props: SelectRootProps) {
|
|
|
510
526
|
renderOption,
|
|
511
527
|
styles,
|
|
512
528
|
clearButtonProps,
|
|
513
|
-
|
|
529
|
+
handleClear,
|
|
530
|
+
handleChange,
|
|
531
|
+
handleKeyDown,
|
|
532
|
+
handleFocus,
|
|
533
|
+
handleBlur,
|
|
534
|
+
handleClick,
|
|
514
535
|
],
|
|
515
536
|
);
|
|
516
537
|
|
|
@@ -518,18 +539,20 @@ function SelectRoot(props: SelectRootProps) {
|
|
|
518
539
|
|
|
519
540
|
return (
|
|
520
541
|
<SelectContext.Provider value={ctx}>
|
|
521
|
-
<
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
542
|
+
<SelectTriggerPropsContext.Provider value={__triggerProps}>
|
|
543
|
+
<Combobox
|
|
544
|
+
position="bottom"
|
|
545
|
+
width="target"
|
|
546
|
+
// Deprecated `comboboxProps` alias merged OVER the `root` slot sugar
|
|
547
|
+
// ("explicit beats sugar").
|
|
548
|
+
{...s.merge("root", comboboxProps)}
|
|
549
|
+
store={combobox}
|
|
550
|
+
onOptionSubmit={handleSubmit}
|
|
551
|
+
size={size}
|
|
552
|
+
>
|
|
553
|
+
{children}
|
|
554
|
+
</Combobox>
|
|
555
|
+
</SelectTriggerPropsContext.Provider>
|
|
533
556
|
</SelectContext.Provider>
|
|
534
557
|
);
|
|
535
558
|
}
|
|
@@ -552,7 +575,7 @@ const SelectTrigger = React.forwardRef<SelectRef, SelectTriggerProps>(
|
|
|
552
575
|
// composable caller (`<Select.Trigger placeholder=… />`) and the sugar caller
|
|
553
576
|
// resolve to the same trigger. Explicit props on `<Select.Trigger>` win over the
|
|
554
577
|
// funneled ones, which in turn win over the `trigger` slot sugar.
|
|
555
|
-
const funneled =
|
|
578
|
+
const funneled = React.useContext(SelectTriggerPropsContext) ?? EMPTY_TRIGGER_PROPS;
|
|
556
579
|
const {
|
|
557
580
|
role: _funneledRole,
|
|
558
581
|
placeholder: funneledPlaceholder,
|
|
@@ -854,7 +877,7 @@ const SelectComponent = React.forwardRef<SelectRef, SelectProps>(function Select
|
|
|
854
877
|
|
|
855
878
|
// The remaining chrome props are funneled to `Select.Trigger` via Root context so
|
|
856
879
|
// the sugar path and the composable path converge on the same trigger element.
|
|
857
|
-
const triggerProps:
|
|
880
|
+
const triggerProps: SelectFunneledTriggerProps = {
|
|
858
881
|
...inputProps,
|
|
859
882
|
placeholder,
|
|
860
883
|
id,
|
|
@@ -71,12 +71,16 @@ export const Skeleton = SkeletonFrame.styleable<SkeletonProps>(function Skeleton
|
|
|
71
71
|
// Reduced motion is handled inside the hook (it returns a static, animation-
|
|
72
72
|
// free frame), so no separate `reduced` branch is needed here.
|
|
73
73
|
const reduced = useReducedMotion();
|
|
74
|
+
const pulsing = animate && !reduced && visible;
|
|
74
75
|
const loop = useLoopingAnimation({
|
|
75
76
|
kind: "pulse",
|
|
76
77
|
durationMs: DURATIONS.ambient,
|
|
77
78
|
minOpacity: 0.45,
|
|
79
|
+
// Never schedule the loop for a skeleton that isn't pulsing (`animate={false}`,
|
|
80
|
+
// or already resolved to its real content): a live loop is a permanent
|
|
81
|
+
// compositor/UI-thread animation, and skeletons are rendered by the dozen.
|
|
82
|
+
enabled: pulsing,
|
|
78
83
|
});
|
|
79
|
-
const pulsing = animate && !reduced;
|
|
80
84
|
|
|
81
85
|
// When not visible, render children as-is (a transparent pass-through wrapper).
|
|
82
86
|
if (!visible) {
|