@knitui/components 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/Accordion/Accordion.js +10 -6
- package/lib/commonjs/Accordion/Accordion.js.map +1 -1
- package/lib/commonjs/Alert/Alert.js +31 -11
- package/lib/commonjs/Alert/Alert.js.map +1 -1
- package/lib/commonjs/AngleSlider/AngleSlider.js +55 -17
- package/lib/commonjs/AngleSlider/AngleSlider.js.map +1 -1
- package/lib/commonjs/Autocomplete/Autocomplete.js +53 -33
- package/lib/commonjs/Autocomplete/Autocomplete.js.map +1 -1
- package/lib/commonjs/Badge/Badge.js +6 -9
- package/lib/commonjs/Badge/Badge.js.map +1 -1
- package/lib/commonjs/Button/Button.js +22 -6
- package/lib/commonjs/Button/Button.js.map +1 -1
- package/lib/commonjs/Card/Card.js +13 -4
- package/lib/commonjs/Card/Card.js.map +1 -1
- package/lib/commonjs/Checkbox/CheckIcon.js +10 -6
- package/lib/commonjs/Checkbox/CheckIcon.js.map +1 -1
- package/lib/commonjs/Checkbox/Checkbox.js +9 -2
- package/lib/commonjs/Checkbox/Checkbox.js.map +1 -1
- package/lib/commonjs/Chip/Chip.js +15 -16
- package/lib/commonjs/Chip/Chip.js.map +1 -1
- package/lib/commonjs/CloseButton/CloseButton.js +2 -2
- package/lib/commonjs/CloseButton/CloseButton.js.map +1 -1
- package/lib/commonjs/ColorInput/ColorInput.js +12 -4
- package/lib/commonjs/ColorInput/ColorInput.js.map +1 -1
- package/lib/commonjs/ColorPicker/ColorPicker.js +32 -24
- package/lib/commonjs/ColorPicker/ColorPicker.js.map +1 -1
- package/lib/commonjs/Combobox/Combobox.js +11 -6
- package/lib/commonjs/Combobox/Combobox.js.map +1 -1
- package/lib/commonjs/Combobox/OptionsDropdown.js +6 -2
- package/lib/commonjs/Combobox/OptionsDropdown.js.map +1 -1
- package/lib/commonjs/Group/Group.js +19 -11
- package/lib/commonjs/Group/Group.js.map +1 -1
- package/lib/commonjs/Highlight/Highlight.js +30 -10
- package/lib/commonjs/Highlight/Highlight.js.map +1 -1
- package/lib/commonjs/HoverCard/HoverCard.js +23 -10
- package/lib/commonjs/HoverCard/HoverCard.js.map +1 -1
- package/lib/commonjs/Indicator/Indicator.js +5 -1
- package/lib/commonjs/Indicator/Indicator.js.map +1 -1
- package/lib/commonjs/Input/Input.js +30 -12
- package/lib/commonjs/Input/Input.js.map +1 -1
- package/lib/commonjs/Input/shared.js +18 -8
- package/lib/commonjs/Input/shared.js.map +1 -1
- package/lib/commonjs/Loader/Loader.js +18 -10
- package/lib/commonjs/Loader/Loader.js.map +1 -1
- package/lib/commonjs/Menu/Menu.js +6 -7
- package/lib/commonjs/Menu/Menu.js.map +1 -1
- package/lib/commonjs/MultiSelect/MultiSelect.js +112 -47
- package/lib/commonjs/MultiSelect/MultiSelect.js.map +1 -1
- package/lib/commonjs/Notification/Notification.js +31 -11
- package/lib/commonjs/Notification/Notification.js.map +1 -1
- package/lib/commonjs/NumberFormatter/NumberFormatter.js +48 -11
- package/lib/commonjs/NumberFormatter/NumberFormatter.js.map +1 -1
- package/lib/commonjs/Paper/Paper.js +8 -8
- package/lib/commonjs/Paper/Paper.js.map +1 -1
- package/lib/commonjs/Pill/Pill.js +6 -8
- package/lib/commonjs/Pill/Pill.js.map +1 -1
- package/lib/commonjs/Progress/Progress.js +4 -1
- package/lib/commonjs/Progress/Progress.js.map +1 -1
- package/lib/commonjs/RollingNumber/RollingNumber.js +30 -13
- package/lib/commonjs/RollingNumber/RollingNumber.js.map +1 -1
- package/lib/commonjs/RollingNumber/rolling-number-utils.js +27 -5
- package/lib/commonjs/RollingNumber/rolling-number-utils.js.map +1 -1
- package/lib/commonjs/ScrollArea/ScrollArea.js +131 -41
- package/lib/commonjs/ScrollArea/ScrollArea.js.map +1 -1
- package/lib/commonjs/ScrollArea/ScrollArea.native.js +128 -40
- package/lib/commonjs/ScrollArea/ScrollArea.native.js.map +1 -1
- package/lib/commonjs/SegmentedControl/SegmentedControl.js +4 -1
- package/lib/commonjs/SegmentedControl/SegmentedControl.js.map +1 -1
- package/lib/commonjs/Select/Select.js +64 -35
- package/lib/commonjs/Select/Select.js.map +1 -1
- package/lib/commonjs/Skeleton/Skeleton.js +6 -2
- package/lib/commonjs/Skeleton/Skeleton.js.map +1 -1
- package/lib/commonjs/Slider/Slider.js +136 -83
- package/lib/commonjs/Slider/Slider.js.map +1 -1
- package/lib/commonjs/Spoiler/Spoiler.js +22 -2
- package/lib/commonjs/Spoiler/Spoiler.js.map +1 -1
- package/lib/commonjs/Stepper/Stepper.js +2 -2
- package/lib/commonjs/Stepper/Stepper.js.map +1 -1
- package/lib/commonjs/Switch/Switch.js +18 -7
- package/lib/commonjs/Switch/Switch.js.map +1 -1
- package/lib/commonjs/Table/Table.js +91 -28
- package/lib/commonjs/Table/Table.js.map +1 -1
- package/lib/commonjs/TableOfContents/TableOfContents.js +4 -1
- package/lib/commonjs/TableOfContents/TableOfContents.js.map +1 -1
- package/lib/commonjs/TagsInput/TagsInput.js +138 -55
- package/lib/commonjs/TagsInput/TagsInput.js.map +1 -1
- package/lib/commonjs/Tooltip/Tooltip.js +27 -5
- package/lib/commonjs/Tooltip/Tooltip.js.map +1 -1
- package/lib/commonjs/Tree/Tree.js +4 -1
- package/lib/commonjs/Tree/Tree.js.map +1 -1
- package/lib/commonjs/Tree/tree-data.js +58 -23
- package/lib/commonjs/Tree/tree-data.js.map +1 -1
- package/lib/commonjs/Tree/use-tree.js +33 -4
- package/lib/commonjs/Tree/use-tree.js.map +1 -1
- package/lib/commonjs/TreeSelect/TreeSelect.js +70 -30
- package/lib/commonjs/TreeSelect/TreeSelect.js.map +1 -1
- package/lib/commonjs/Typography/Typography.js +10 -10
- package/lib/commonjs/Typography/Typography.js.map +1 -1
- package/lib/commonjs/UnstyledButton/UnstyledButton.js +8 -3
- package/lib/commonjs/UnstyledButton/UnstyledButton.js.map +1 -1
- package/lib/commonjs/VirtualList/VirtualList.js +71 -13
- package/lib/commonjs/VirtualList/VirtualList.js.map +1 -1
- package/lib/commonjs/floating/platform.js +28 -1
- package/lib/commonjs/floating/platform.js.map +1 -1
- package/lib/commonjs/floating/use-position.js +33 -1
- package/lib/commonjs/floating/use-position.js.map +1 -1
- package/lib/commonjs/internal/ControlIconProvider.js +20 -15
- package/lib/commonjs/internal/ControlIconProvider.js.map +1 -1
- package/lib/commonjs/internal/color.js +8 -1
- package/lib/commonjs/internal/color.js.map +1 -1
- package/lib/commonjs/internal/gradient-shared.js +9 -5
- package/lib/commonjs/internal/gradient-shared.js.map +1 -1
- package/lib/commonjs/internal/gradient.js +21 -9
- package/lib/commonjs/internal/gradient.js.map +1 -1
- package/lib/commonjs/internal/gradient.native.js +36 -10
- package/lib/commonjs/internal/gradient.native.js.map +1 -1
- package/lib/commonjs/internal/render-text-child.js +30 -2
- package/lib/commonjs/internal/render-text-child.js.map +1 -1
- package/lib/commonjs/internal/style-props.js +17 -5
- package/lib/commonjs/internal/style-props.js.map +1 -1
- package/lib/commonjs/internal/theme-color-web.js +46 -0
- package/lib/commonjs/internal/theme-color-web.js.map +1 -0
- package/lib/commonjs/internal/use-icon-color.js +33 -0
- package/lib/commonjs/internal/use-icon-color.js.map +1 -0
- package/lib/commonjs/internal/use-icon-color.native.js +23 -0
- package/lib/commonjs/internal/use-icon-color.native.js.map +1 -0
- package/lib/commonjs/internal/use-looping-animation.js +7 -3
- package/lib/commonjs/internal/use-looping-animation.js.map +1 -1
- package/lib/commonjs/internal/use-looping-animation.native.js +9 -1
- package/lib/commonjs/internal/use-looping-animation.native.js.map +1 -1
- package/lib/commonjs/internal/use-looping-animation.shared.js +33 -0
- package/lib/commonjs/internal/use-looping-animation.shared.js.map +1 -1
- package/lib/commonjs/internal/use-slot-text-wrapper.js +36 -5
- package/lib/commonjs/internal/use-slot-text-wrapper.js.map +1 -1
- package/lib/module/Accordion/Accordion.js +9 -5
- package/lib/module/Accordion/Accordion.js.map +1 -1
- package/lib/module/Alert/Alert.js +31 -11
- package/lib/module/Alert/Alert.js.map +1 -1
- package/lib/module/AngleSlider/AngleSlider.js +55 -17
- package/lib/module/AngleSlider/AngleSlider.js.map +1 -1
- package/lib/module/Autocomplete/Autocomplete.js +54 -34
- package/lib/module/Autocomplete/Autocomplete.js.map +1 -1
- package/lib/module/Badge/Badge.js +6 -9
- package/lib/module/Badge/Badge.js.map +1 -1
- package/lib/module/Button/Button.js +23 -7
- package/lib/module/Button/Button.js.map +1 -1
- package/lib/module/Card/Card.js +13 -4
- package/lib/module/Card/Card.js.map +1 -1
- package/lib/module/Checkbox/CheckIcon.js +9 -5
- package/lib/module/Checkbox/CheckIcon.js.map +1 -1
- package/lib/module/Checkbox/Checkbox.js +9 -2
- package/lib/module/Checkbox/Checkbox.js.map +1 -1
- package/lib/module/Chip/Chip.js +15 -16
- package/lib/module/Chip/Chip.js.map +1 -1
- package/lib/module/CloseButton/CloseButton.js +1 -1
- package/lib/module/CloseButton/CloseButton.js.map +1 -1
- package/lib/module/ColorInput/ColorInput.js +12 -4
- package/lib/module/ColorInput/ColorInput.js.map +1 -1
- package/lib/module/ColorPicker/ColorPicker.js +32 -24
- package/lib/module/ColorPicker/ColorPicker.js.map +1 -1
- package/lib/module/Combobox/Combobox.js +11 -6
- package/lib/module/Combobox/Combobox.js.map +1 -1
- package/lib/module/Combobox/OptionsDropdown.js +6 -2
- package/lib/module/Combobox/OptionsDropdown.js.map +1 -1
- package/lib/module/Group/Group.js +19 -11
- package/lib/module/Group/Group.js.map +1 -1
- package/lib/module/Highlight/Highlight.js +30 -10
- package/lib/module/Highlight/Highlight.js.map +1 -1
- package/lib/module/HoverCard/HoverCard.js +23 -10
- package/lib/module/HoverCard/HoverCard.js.map +1 -1
- package/lib/module/Indicator/Indicator.js +5 -1
- package/lib/module/Indicator/Indicator.js.map +1 -1
- package/lib/module/Input/Input.js +32 -14
- package/lib/module/Input/Input.js.map +1 -1
- package/lib/module/Input/shared.js +19 -9
- package/lib/module/Input/shared.js.map +1 -1
- package/lib/module/Loader/Loader.js +18 -10
- package/lib/module/Loader/Loader.js.map +1 -1
- package/lib/module/Menu/Menu.js +6 -7
- package/lib/module/Menu/Menu.js.map +1 -1
- package/lib/module/MultiSelect/MultiSelect.js +113 -48
- package/lib/module/MultiSelect/MultiSelect.js.map +1 -1
- package/lib/module/Notification/Notification.js +31 -11
- package/lib/module/Notification/Notification.js.map +1 -1
- package/lib/module/NumberFormatter/NumberFormatter.js +48 -11
- package/lib/module/NumberFormatter/NumberFormatter.js.map +1 -1
- package/lib/module/Paper/Paper.js +7 -8
- package/lib/module/Paper/Paper.js.map +1 -1
- package/lib/module/Pill/Pill.js +6 -8
- package/lib/module/Pill/Pill.js.map +1 -1
- package/lib/module/Progress/Progress.js +4 -1
- package/lib/module/Progress/Progress.js.map +1 -1
- package/lib/module/RollingNumber/RollingNumber.js +30 -13
- package/lib/module/RollingNumber/RollingNumber.js.map +1 -1
- package/lib/module/RollingNumber/rolling-number-utils.js +27 -5
- package/lib/module/RollingNumber/rolling-number-utils.js.map +1 -1
- package/lib/module/ScrollArea/ScrollArea.js +133 -43
- package/lib/module/ScrollArea/ScrollArea.js.map +1 -1
- package/lib/module/ScrollArea/ScrollArea.native.js +128 -40
- package/lib/module/ScrollArea/ScrollArea.native.js.map +1 -1
- package/lib/module/SegmentedControl/SegmentedControl.js +4 -1
- package/lib/module/SegmentedControl/SegmentedControl.js.map +1 -1
- package/lib/module/Select/Select.js +65 -36
- package/lib/module/Select/Select.js.map +1 -1
- package/lib/module/Skeleton/Skeleton.js +6 -2
- package/lib/module/Skeleton/Skeleton.js.map +1 -1
- package/lib/module/Slider/Slider.js +137 -84
- package/lib/module/Slider/Slider.js.map +1 -1
- package/lib/module/Spoiler/Spoiler.js +23 -3
- package/lib/module/Spoiler/Spoiler.js.map +1 -1
- package/lib/module/Stepper/Stepper.js +1 -1
- package/lib/module/Stepper/Stepper.js.map +1 -1
- package/lib/module/Switch/Switch.js +18 -7
- package/lib/module/Switch/Switch.js.map +1 -1
- package/lib/module/Table/Table.js +91 -28
- package/lib/module/Table/Table.js.map +1 -1
- package/lib/module/TableOfContents/TableOfContents.js +5 -2
- package/lib/module/TableOfContents/TableOfContents.js.map +1 -1
- package/lib/module/TagsInput/TagsInput.js +140 -57
- package/lib/module/TagsInput/TagsInput.js.map +1 -1
- package/lib/module/Tooltip/Tooltip.js +27 -5
- package/lib/module/Tooltip/Tooltip.js.map +1 -1
- package/lib/module/Tree/Tree.js +4 -1
- package/lib/module/Tree/Tree.js.map +1 -1
- package/lib/module/Tree/tree-data.js +57 -23
- package/lib/module/Tree/tree-data.js.map +1 -1
- package/lib/module/Tree/use-tree.js +34 -5
- package/lib/module/Tree/use-tree.js.map +1 -1
- package/lib/module/TreeSelect/TreeSelect.js +72 -32
- package/lib/module/TreeSelect/TreeSelect.js.map +1 -1
- package/lib/module/Typography/Typography.js +9 -10
- package/lib/module/Typography/Typography.js.map +1 -1
- package/lib/module/UnstyledButton/UnstyledButton.js +9 -4
- package/lib/module/UnstyledButton/UnstyledButton.js.map +1 -1
- package/lib/module/VirtualList/VirtualList.js +71 -13
- package/lib/module/VirtualList/VirtualList.js.map +1 -1
- package/lib/module/floating/platform.js +28 -1
- package/lib/module/floating/platform.js.map +1 -1
- package/lib/module/floating/use-position.js +33 -1
- package/lib/module/floating/use-position.js.map +1 -1
- package/lib/module/internal/ControlIconProvider.js +18 -13
- package/lib/module/internal/ControlIconProvider.js.map +1 -1
- package/lib/module/internal/color.js +8 -1
- package/lib/module/internal/color.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 +15 -15
- package/lib/typescript/Accordion/Accordion.d.ts.map +1 -1
- package/lib/typescript/ActionIcon/ActionIcon.d.ts +13 -13
- package/lib/typescript/Alert/Alert.d.ts +19 -19
- package/lib/typescript/Alert/Alert.d.ts.map +1 -1
- package/lib/typescript/Anchor/Anchor.d.ts +9 -9
- package/lib/typescript/AngleSlider/AngleSlider.d.ts +8 -8
- package/lib/typescript/AngleSlider/AngleSlider.d.ts.map +1 -1
- package/lib/typescript/Autocomplete/Autocomplete.d.ts +18 -44
- package/lib/typescript/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/lib/typescript/Avatar/Avatar.d.ts +38 -38
- package/lib/typescript/Badge/Badge.d.ts +20 -20
- package/lib/typescript/Badge/Badge.d.ts.map +1 -1
- package/lib/typescript/Blockquote/Blockquote.d.ts +8 -8
- package/lib/typescript/Breadcrumbs/Breadcrumbs.d.ts +8 -8
- package/lib/typescript/Burger/Burger.d.ts +4 -4
- package/lib/typescript/Button/Button.d.ts +13 -13
- 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 +15 -15
- package/lib/typescript/Chip/Chip.d.ts.map +1 -1
- package/lib/typescript/CloseButton/CloseButton.d.ts +7 -7
- package/lib/typescript/Code/Code.d.ts +6 -6
- 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 +9 -9
- 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 +7 -7
- package/lib/typescript/Container/Container.d.ts +3 -3
- package/lib/typescript/Dialog/Dialog.d.ts +6 -6
- package/lib/typescript/Drawer/Drawer.d.ts +4 -4
- package/lib/typescript/Fieldset/Fieldset.d.ts +11 -11
- 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 +4 -4
- 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 +25 -25
- package/lib/typescript/Image/createImage.d.ts +36 -36
- package/lib/typescript/Indicator/Indicator.d.ts +4 -4
- package/lib/typescript/Indicator/Indicator.d.ts.map +1 -1
- package/lib/typescript/Input/Input.d.ts +61 -61
- package/lib/typescript/Input/Input.d.ts.map +1 -1
- package/lib/typescript/Input/Input.native.d.ts +79 -79
- package/lib/typescript/Input/shared.d.ts +66 -66
- package/lib/typescript/Input/shared.d.ts.map +1 -1
- package/lib/typescript/InputBase/InputBase.d.ts +4 -4
- package/lib/typescript/Kbd/Kbd.d.ts +23 -23
- package/lib/typescript/KeyboardAvoidingView/KeyboardAvoidingView.d.ts +1 -1
- package/lib/typescript/KeyboardAwareScrollView/KeyboardAwareScrollView.d.ts +1 -1
- package/lib/typescript/List/List.d.ts +14 -14
- package/lib/typescript/Loader/Loader.d.ts.map +1 -1
- package/lib/typescript/LoadingOverlay/LoadingOverlay.d.ts +2 -2
- package/lib/typescript/Mark/Mark.d.ts +23 -23
- package/lib/typescript/Marquee/Marquee.d.ts +4 -4
- package/lib/typescript/MaskInput/MaskInput.d.ts +4 -4
- package/lib/typescript/Menu/Menu.d.ts +28 -28
- package/lib/typescript/Menu/Menu.d.ts.map +1 -1
- package/lib/typescript/Modal/Modal.d.ts +10 -10
- package/lib/typescript/MultiSelect/MultiSelect.d.ts +17 -62
- package/lib/typescript/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/lib/typescript/NavLink/NavLink.d.ts +19 -19
- package/lib/typescript/Notification/Notification.d.ts +12 -12
- package/lib/typescript/Notification/Notification.d.ts.map +1 -1
- package/lib/typescript/NumberFormatter/NumberFormatter.d.ts +6 -6
- package/lib/typescript/NumberFormatter/NumberFormatter.d.ts.map +1 -1
- package/lib/typescript/NumberInput/NumberInput.d.ts +15 -15
- package/lib/typescript/Overlay/Overlay.d.ts +3 -3
- package/lib/typescript/Paper/Paper.d.ts +8 -40
- package/lib/typescript/Paper/Paper.d.ts.map +1 -1
- package/lib/typescript/Paragraph/Paragraph.d.ts +6 -6
- package/lib/typescript/PasswordInput/PasswordInput.d.ts +19 -19
- package/lib/typescript/Pill/Pill.d.ts +19 -19
- package/lib/typescript/Pill/Pill.d.ts.map +1 -1
- package/lib/typescript/PinInput/PinInput.d.ts +66 -66
- package/lib/typescript/Popover/Popover.shared.d.ts +3 -3
- package/lib/typescript/Progress/Progress.d.ts +4 -4
- package/lib/typescript/Progress/Progress.d.ts.map +1 -1
- package/lib/typescript/Radio/Radio.d.ts +8 -8
- package/lib/typescript/Rating/Rating.d.ts +2 -2
- package/lib/typescript/RollingNumber/RollingNumber.d.ts +4 -4
- 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 +4 -4
- package/lib/typescript/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/lib/typescript/Select/Select.d.ts +22 -51
- package/lib/typescript/Select/Select.d.ts.map +1 -1
- package/lib/typescript/Separator/Separator.d.ts +13 -13
- package/lib/typescript/Skeleton/Skeleton.d.ts +3 -3
- package/lib/typescript/Skeleton/Skeleton.d.ts.map +1 -1
- package/lib/typescript/Slider/Slider.d.ts +12 -12
- package/lib/typescript/Slider/Slider.d.ts.map +1 -1
- package/lib/typescript/Spoiler/Spoiler.d.ts +4 -4
- package/lib/typescript/Spoiler/Spoiler.d.ts.map +1 -1
- package/lib/typescript/Stepper/Stepper.d.ts +16 -16
- package/lib/typescript/Switch/Switch.d.ts +18 -7
- package/lib/typescript/Switch/Switch.d.ts.map +1 -1
- package/lib/typescript/Table/Table.d.ts +59 -53
- package/lib/typescript/Table/Table.d.ts.map +1 -1
- package/lib/typescript/TableOfContents/TableOfContents.d.ts +4 -4
- package/lib/typescript/TableOfContents/TableOfContents.d.ts.map +1 -1
- package/lib/typescript/Tabs/Tabs.d.ts +15 -15
- package/lib/typescript/TagsInput/TagsInput.d.ts +15 -49
- package/lib/typescript/TagsInput/TagsInput.d.ts.map +1 -1
- package/lib/typescript/Text/Text.d.ts +2 -2
- package/lib/typescript/TextInput/TextInput.d.ts +4 -4
- package/lib/typescript/Textarea/Textarea.d.ts +4 -4
- package/lib/typescript/ThemeIcon/ThemeIcon.d.ts +7 -7
- package/lib/typescript/Title/Title.d.ts +9 -9
- package/lib/typescript/Tooltip/Tooltip.d.ts +4 -4
- package/lib/typescript/Tooltip/Tooltip.d.ts.map +1 -1
- package/lib/typescript/Tree/Tree.d.ts +8 -8
- 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 +36 -62
- 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/VisuallyHidden/VisuallyHidden.d.ts +6 -6
- 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/InlineControl.d.ts +6 -6
- package/lib/typescript/internal/color.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 +7 -7
- package/src/Accordion/Accordion.tsx +6 -2
- package/src/Alert/Alert.tsx +43 -22
- package/src/AngleSlider/AngleSlider.tsx +73 -21
- package/src/Autocomplete/Autocomplete.tsx +74 -55
- package/src/Badge/Badge.tsx +6 -8
- package/src/Button/Button.tsx +17 -3
- package/src/Card/Card.tsx +11 -3
- package/src/Checkbox/CheckIcon.tsx +9 -5
- package/src/Checkbox/Checkbox.tsx +8 -1
- package/src/Chip/Chip.tsx +15 -22
- package/src/CloseButton/CloseButton.tsx +1 -1
- package/src/ColorInput/ColorInput.tsx +15 -4
- package/src/ColorPicker/ColorPicker.tsx +38 -25
- package/src/Combobox/Combobox.tsx +10 -6
- package/src/Combobox/OptionsDropdown.tsx +6 -1
- package/src/Group/Group.tsx +21 -10
- package/src/Highlight/Highlight.tsx +42 -7
- package/src/HoverCard/HoverCard.tsx +48 -31
- package/src/Indicator/Indicator.tsx +4 -0
- package/src/Input/Input.tsx +31 -16
- package/src/Input/shared.tsx +20 -4
- package/src/Loader/Loader.tsx +14 -4
- package/src/Menu/Menu.tsx +6 -8
- package/src/MultiSelect/MultiSelect.tsx +140 -85
- package/src/Notification/Notification.tsx +43 -22
- package/src/NumberFormatter/NumberFormatter.tsx +66 -11
- package/src/Paper/Paper.tsx +8 -6
- package/src/Pill/Pill.tsx +6 -9
- package/src/Progress/Progress.tsx +3 -0
- package/src/RollingNumber/RollingNumber.tsx +43 -21
- package/src/RollingNumber/rolling-number-utils.ts +28 -5
- package/src/ScrollArea/ScrollArea.native.tsx +142 -49
- package/src/ScrollArea/ScrollArea.tsx +140 -47
- package/src/SegmentedControl/SegmentedControl.tsx +12 -1
- package/src/Select/Select.tsx +90 -67
- package/src/Skeleton/Skeleton.tsx +5 -1
- package/src/Slider/Slider.tsx +157 -61
- package/src/Spoiler/Spoiler.tsx +22 -10
- package/src/Stepper/Stepper.tsx +1 -1
- package/src/Switch/Switch.tsx +20 -9
- package/src/Table/Table.tsx +89 -33
- package/src/TableOfContents/TableOfContents.tsx +5 -1
- package/src/TagsInput/TagsInput.tsx +193 -141
- package/src/Tooltip/Tooltip.tsx +33 -7
- package/src/Tree/Tree.tsx +4 -1
- package/src/Tree/tree-data.ts +74 -26
- package/src/Tree/use-tree.ts +52 -7
- package/src/TreeSelect/TreeSelect.tsx +96 -64
- package/src/Typography/Typography.tsx +9 -8
- package/src/UnstyledButton/UnstyledButton.tsx +12 -5
- package/src/VirtualList/VirtualList.tsx +82 -18
- package/src/floating/platform.ts +29 -1
- package/src/floating/use-position.tsx +38 -1
- package/src/internal/ControlIconProvider.tsx +17 -12
- package/src/internal/color.ts +8 -1
- package/src/internal/gradient-shared.ts +9 -5
- package/src/internal/gradient.native.tsx +29 -5
- package/src/internal/gradient.tsx +22 -7
- package/src/internal/render-text-child.tsx +30 -2
- package/src/internal/style-props.ts +20 -4
- package/src/internal/theme-color-web.ts +40 -0
- package/src/internal/use-icon-color.native.ts +17 -0
- package/src/internal/use-icon-color.ts +26 -0
- package/src/internal/use-looping-animation.native.tsx +10 -2
- package/src/internal/use-looping-animation.shared.ts +38 -3
- package/src/internal/use-looping-animation.tsx +8 -4
- package/src/internal/use-slot-text-wrapper.tsx +39 -5
package/src/Paper/Paper.tsx
CHANGED
|
@@ -7,8 +7,14 @@ import { radiusVariant, shadowVariant } from "../internal/style-props";
|
|
|
7
7
|
* Paper — generic content surface with optional elevation and border. Mirrors
|
|
8
8
|
* Mantine's `Paper`. `shadow` (xs→xl) controls elevation, `radius` the corner
|
|
9
9
|
* rounding, `withBorder` shows the outline. No border or shadow by default.
|
|
10
|
+
*
|
|
11
|
+
* A plain `styled()` export, NOT a `.styleable()` wrapper: the wrapper's render
|
|
12
|
+
* function did nothing but `<PaperFrame ref {...props} />`, so every `<Paper>`
|
|
13
|
+
* paid a whole extra component layer (and its own render pass, and the `<Theme>`
|
|
14
|
+
* layer `themeable` puts around a named styleable) to add exactly zero props.
|
|
15
|
+
* `GetProps` gives the identical public prop shape either way.
|
|
10
16
|
*/
|
|
11
|
-
const
|
|
17
|
+
export const Paper = styled(Box, {
|
|
12
18
|
name: "Paper",
|
|
13
19
|
backgroundColor: "$background",
|
|
14
20
|
|
|
@@ -23,8 +29,4 @@ const PaperFrame = styled(Box, {
|
|
|
23
29
|
defaultVariants: { radius: "md" },
|
|
24
30
|
});
|
|
25
31
|
|
|
26
|
-
export type PaperProps = GetProps<typeof
|
|
27
|
-
|
|
28
|
-
export const Paper = PaperFrame.styleable<PaperProps>(function Paper(props, ref) {
|
|
29
|
-
return <PaperFrame ref={ref} {...props} />;
|
|
30
|
-
});
|
|
32
|
+
export type PaperProps = GetProps<typeof Paper>;
|
package/src/Pill/Pill.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
type SizeKey,
|
|
14
14
|
} from "../internal/style-props";
|
|
15
15
|
import { slotStyles, type SlotStyles } from "../internal/styles";
|
|
16
|
+
import { useSlotTextWrapper } from "../internal/use-slot-text-wrapper";
|
|
16
17
|
import { Text } from "../Text";
|
|
17
18
|
|
|
18
19
|
type PillSize = SizeKey;
|
|
@@ -233,15 +234,11 @@ const PillComponent = PillFrame.styleable<PillProps>(function Pill(props, ref) {
|
|
|
233
234
|
);
|
|
234
235
|
|
|
235
236
|
// Bind the `label` slot props onto the label wrapper that `renderTextChild`
|
|
236
|
-
// emits for text children (`styles={{ label }}` → `<Pill.Label … />`).
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
return <PillLabel {...labelSlot} {...wrapperProps} />;
|
|
242
|
-
},
|
|
243
|
-
[labelSlot],
|
|
244
|
-
);
|
|
237
|
+
// emits for text children (`styles={{ label }}` → `<Pill.Label … />`). The shared
|
|
238
|
+
// hook compares the slot props by VALUE: keyed on identity, the documented inline
|
|
239
|
+
// `styles={{ label: { … } }}` literal made the wrapper a new component TYPE every
|
|
240
|
+
// render, remounting the label of every pill in a group.
|
|
241
|
+
const LabelWrapper = useSlotTextWrapper(PillLabel, s.get("label"));
|
|
245
242
|
|
|
246
243
|
return (
|
|
247
244
|
<PillFrame
|
|
@@ -188,6 +188,9 @@ const ProgressSection = ProgressSectionFrame.styleable<ProgressSectionProps>(
|
|
|
188
188
|
axis: "x",
|
|
189
189
|
distance: animated ? STRIPE_PERIOD : 0,
|
|
190
190
|
durationMs: STRIPE_DURATION_MS,
|
|
191
|
+
// A `distance: 0` shimmer is inert, so the primitive already skips scheduling;
|
|
192
|
+
// stating it keeps the intent explicit for a plain `striped` bar.
|
|
193
|
+
enabled: Boolean(animated),
|
|
191
194
|
});
|
|
192
195
|
|
|
193
196
|
const pct = `${Math.max(0, Math.min(100, value))}%`;
|
|
@@ -81,37 +81,47 @@ const resolveFontSize = (
|
|
|
81
81
|
? { token: fontSize, px: fontSize }
|
|
82
82
|
: { token: `$${fontSize}` as TextProps["fontSize"], px: getFontSize(fontSize) };
|
|
83
83
|
|
|
84
|
+
/** Resolved per-slot style sugar for the digit-column parts. */
|
|
85
|
+
interface RollingDigitSlots {
|
|
86
|
+
viewport?: GetProps<typeof RollingNumberDigitViewport>;
|
|
87
|
+
strip?: GetProps<typeof RollingNumberDigitStrip>;
|
|
88
|
+
text?: GetProps<typeof RollingNumberDigitText>;
|
|
89
|
+
}
|
|
90
|
+
|
|
84
91
|
interface RollingDigitProps {
|
|
85
92
|
digit: string;
|
|
86
93
|
empty: boolean;
|
|
87
94
|
digitHeight: number;
|
|
88
95
|
fontSize: TextProps["fontSize"];
|
|
89
96
|
fontFamily: TextProps["fontFamily"];
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
};
|
|
97
|
+
/**
|
|
98
|
+
* The ready-made `{ transition }` object, built ONCE by the parent. Every
|
|
99
|
+
* column used to recompute the identical `transitionProps(timedTransition(…))`
|
|
100
|
+
* itself, and the fresh object also broke the `React.memo` below.
|
|
101
|
+
*/
|
|
102
|
+
transition: ReturnType<typeof transitionProps>;
|
|
103
|
+
slots: RollingDigitSlots;
|
|
98
104
|
}
|
|
99
105
|
|
|
100
106
|
/** A single rolling digit — a 0–9 strip translated so the target digit shows.
|
|
101
107
|
* The continuous `translateY` interpolation rolls through the intermediate
|
|
102
|
-
* digits when the value changes.
|
|
103
|
-
|
|
108
|
+
* digits when the value changes.
|
|
109
|
+
*
|
|
110
|
+
* Memoized: a number ticking from 1 to 2 changes ONE column, but the parent
|
|
111
|
+
* re-renders on every tick, and each column is a viewport + strip + ten glyph
|
|
112
|
+
* `Text`s. Without the memo a 6-digit value re-rendered ~78 styled nodes per
|
|
113
|
+
* tick to move one strip. Every prop is either a primitive or hoisted/memoized
|
|
114
|
+
* by the parent so the comparison can actually bail out. */
|
|
115
|
+
const RollingDigit = React.memo(function RollingDigit({
|
|
104
116
|
digit,
|
|
105
117
|
empty,
|
|
106
118
|
digitHeight,
|
|
107
119
|
fontSize,
|
|
108
120
|
fontFamily,
|
|
109
|
-
|
|
110
|
-
duration,
|
|
121
|
+
transition,
|
|
111
122
|
slots,
|
|
112
123
|
}: RollingDigitProps) {
|
|
113
124
|
const index = parseInt(digit, 10) || 0;
|
|
114
|
-
const transition = animate ? transitionProps(timedTransition(duration)) : transitionProps(null);
|
|
115
125
|
|
|
116
126
|
// `styles` slot sugar is lowest precedence — it spreads UNDER the
|
|
117
127
|
// component-owned geometry/transition props, which always win.
|
|
@@ -140,7 +150,7 @@ function RollingDigit({
|
|
|
140
150
|
</RollingNumberDigitStrip>
|
|
141
151
|
</RollingNumberDigitViewport>
|
|
142
152
|
);
|
|
143
|
-
}
|
|
153
|
+
});
|
|
144
154
|
|
|
145
155
|
/* -------------------------------------------------------------------------- */
|
|
146
156
|
/* Types */
|
|
@@ -211,15 +221,28 @@ const RollingNumberBase = RollingNumberRoot.styleable<RollingNumberProps>(
|
|
|
211
221
|
} = props;
|
|
212
222
|
|
|
213
223
|
const s = slotStyles<RollingNumberStyles>(styles, ROLLING_NUMBER_SLOT_KEYS, "RollingNumber");
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
224
|
+
// Both of these are props of the memoized `RollingDigit`, so they have to be
|
|
225
|
+
// referentially stable or the memo never bails out. `s.get(…)` hands back the
|
|
226
|
+
// consumer's own slot objects unchanged, so keying on them is exact.
|
|
227
|
+
const viewportSlot = s.get("digitViewport");
|
|
228
|
+
const stripSlot = s.get("digitStrip");
|
|
229
|
+
const textSlot = s.get("digitText");
|
|
230
|
+
const digitSlots = React.useMemo<RollingDigitSlots>(
|
|
231
|
+
() => ({ viewport: viewportSlot, strip: stripSlot, text: textSlot }),
|
|
232
|
+
[viewportSlot, stripSlot, textSlot],
|
|
233
|
+
);
|
|
219
234
|
|
|
220
235
|
const reduced = useReducedMotion();
|
|
221
236
|
const duration = reduced ? 0 : animationDuration;
|
|
222
237
|
|
|
238
|
+
// One `{ transition }` object for ALL columns instead of one per column per
|
|
239
|
+
// render. `null` (reduced motion) keeps the prop present so Tamagui's
|
|
240
|
+
// animation driver hook order is stable — see `transitionProps`.
|
|
241
|
+
const digitTransition = React.useMemo(
|
|
242
|
+
() => (duration > 0 ? transitionProps(timedTransition(duration)) : transitionProps(null)),
|
|
243
|
+
[duration],
|
|
244
|
+
);
|
|
245
|
+
|
|
223
246
|
const { token: fontToken, px: fontSizePx } = resolveFontSize(fontSize);
|
|
224
247
|
const digitHeight = Math.round(fontSizePx * 1.25);
|
|
225
248
|
const fontFamily: TextProps["fontFamily"] = tabularNumbers ? "$mono" : undefined;
|
|
@@ -267,8 +290,7 @@ const RollingNumberBase = RollingNumberRoot.styleable<RollingNumberProps>(
|
|
|
267
290
|
digitHeight={digitHeight}
|
|
268
291
|
fontSize={fontToken}
|
|
269
292
|
fontFamily={fontFamily}
|
|
270
|
-
|
|
271
|
-
duration={duration}
|
|
293
|
+
transition={digitTransition}
|
|
272
294
|
slots={digitSlots}
|
|
273
295
|
/>
|
|
274
296
|
) : (
|
|
@@ -22,17 +22,40 @@ const PLAIN_FORMAT = new Intl.NumberFormat("en-US", {
|
|
|
22
22
|
maximumFractionDigits: 20,
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Fixed-scale formatters, cached by `decimalScale`.
|
|
27
|
+
*
|
|
28
|
+
* Constructing an `Intl.NumberFormat` resolves locale data and plural rules — one
|
|
29
|
+
* of the most expensive plain-object constructions in JS. `toPlainString` is
|
|
30
|
+
* reached ~3× per `RollingNumber` render (current digits, previous digits, and
|
|
31
|
+
* `buildValue`) on a component that re-renders on every animation tick, so
|
|
32
|
+
* building the formatter inline made every tick pay for it. The formatter depends
|
|
33
|
+
* only on `decimalScale`, and a component's `decimalScale` is a fixed prop, so the
|
|
34
|
+
* key space stays tiny — same reasoning as the no-scale `PLAIN_FORMAT` above,
|
|
35
|
+
* just parameterised.
|
|
36
|
+
*/
|
|
37
|
+
const SCALED_FORMATS = new Map<number, Intl.NumberFormat>();
|
|
38
|
+
|
|
39
|
+
function getScaledFormat(decimalScale: number): Intl.NumberFormat {
|
|
40
|
+
let format = SCALED_FORMATS.get(decimalScale);
|
|
41
|
+
if (!format) {
|
|
42
|
+
format = new Intl.NumberFormat("en-US", {
|
|
43
|
+
useGrouping: false,
|
|
44
|
+
minimumFractionDigits: decimalScale,
|
|
45
|
+
maximumFractionDigits: decimalScale,
|
|
46
|
+
});
|
|
47
|
+
SCALED_FORMATS.set(decimalScale, format);
|
|
48
|
+
}
|
|
49
|
+
return format;
|
|
50
|
+
}
|
|
51
|
+
|
|
25
52
|
function toPlainString(num: number, decimalScale?: number): string {
|
|
26
53
|
if (!Number.isFinite(num)) {
|
|
27
54
|
return "0";
|
|
28
55
|
}
|
|
29
56
|
|
|
30
57
|
if (decimalScale !== undefined) {
|
|
31
|
-
return
|
|
32
|
-
useGrouping: false,
|
|
33
|
-
minimumFractionDigits: decimalScale,
|
|
34
|
-
maximumFractionDigits: decimalScale,
|
|
35
|
-
}).format(num);
|
|
58
|
+
return getScaledFormat(decimalScale).format(num);
|
|
36
59
|
}
|
|
37
60
|
|
|
38
61
|
const str = String(num);
|
|
@@ -68,6 +68,15 @@ const ANIMATE_OPACITY = ["opacity"];
|
|
|
68
68
|
scrollable case uses the Pan engine, not a native nested ScrollView. */
|
|
69
69
|
const PAN_ACTIVATE_THRESHOLD = 8;
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* How often (ms) a scroll may cross to the JS thread when the ONLY consumer is the
|
|
73
|
+
* scrollbar auto-hide (`type="hover"`/`"scroll"` with no scroll callbacks — the
|
|
74
|
+
* default). The flash is a boolean plus a ~1s trailing timer, so a few hops per
|
|
75
|
+
* second is indistinguishable from every frame, while a per-frame `runOnJS` piled
|
|
76
|
+
* work onto the JS thread precisely while it was rendering the content being flung.
|
|
77
|
+
*/
|
|
78
|
+
const SCROLL_FLASH_INTERVAL_MS = 120;
|
|
79
|
+
|
|
71
80
|
/* -------------------------------------------------------------------------- */
|
|
72
81
|
/* UI-thread worklet helpers */
|
|
73
82
|
/* -------------------------------------------------------------------------- */
|
|
@@ -78,6 +87,19 @@ function clampW(value: number, min: number, max: number): number {
|
|
|
78
87
|
return value < min ? min : value > max ? max : value;
|
|
79
88
|
}
|
|
80
89
|
|
|
90
|
+
/**
|
|
91
|
+
* UI-thread rate limiter for the `runOnJS` hop. Returns `true` (and re-arms) when a
|
|
92
|
+
* report is due: always, when `intervalMs` is 0, otherwise at most once per interval.
|
|
93
|
+
*/
|
|
94
|
+
function shouldReportW(last: { value: number }, intervalMs: number): boolean {
|
|
95
|
+
"worklet";
|
|
96
|
+
if (intervalMs <= 0) return true;
|
|
97
|
+
const now = Date.now();
|
|
98
|
+
if (now - last.value < intervalMs) return false;
|
|
99
|
+
last.value = now;
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
|
|
81
103
|
/**
|
|
82
104
|
* Thumb length + offset along one axis, computed entirely on the UI thread.
|
|
83
105
|
* Mirrors {@link getThumbGeometry} (the JS twin used for layout decisions) but is
|
|
@@ -307,10 +329,19 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
307
329
|
const [size, setSize] = React.useState<Size>(ZERO_SIZE);
|
|
308
330
|
const [scrolling, setScrolling] = React.useState(false);
|
|
309
331
|
const [dragging, setDragging] = React.useState(false);
|
|
310
|
-
//
|
|
311
|
-
//
|
|
312
|
-
|
|
332
|
+
// Which edges have content beyond them — the ONLY thing the (opt-in) edge fades
|
|
333
|
+
// need. Keeping the BOOLEANS in state (rather than mirroring the raw offset, as
|
|
334
|
+
// this used to) means a fling re-renders at most four times over its whole length
|
|
335
|
+
// — once per edge crossing — instead of once per frame.
|
|
336
|
+
const [edges, setEdges] = React.useState<EdgeState>({
|
|
337
|
+
top: false,
|
|
338
|
+
bottom: false,
|
|
339
|
+
left: false,
|
|
340
|
+
right: false,
|
|
341
|
+
});
|
|
313
342
|
const hideTimeout = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
|
|
343
|
+
// Mirrors `scrolling` so the flash can skip a redundant setState per sample.
|
|
344
|
+
const scrollingRef = React.useRef(false);
|
|
314
345
|
|
|
315
346
|
const scrubRef = React.useRef<{ pending: boolean; paging: boolean }>({
|
|
316
347
|
pending: false,
|
|
@@ -330,9 +361,17 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
330
361
|
|
|
331
362
|
const flashScrollbars = React.useCallback(() => {
|
|
332
363
|
if (type !== "hover" && type !== "scroll") return;
|
|
333
|
-
|
|
364
|
+
// Guarded by a ref: React only bails on a same-value update after re-entering
|
|
365
|
+
// the component, so the unguarded version cost a render pass per sample.
|
|
366
|
+
if (!scrollingRef.current) {
|
|
367
|
+
scrollingRef.current = true;
|
|
368
|
+
setScrolling(true);
|
|
369
|
+
}
|
|
334
370
|
clearTimeout(hideTimeout.current);
|
|
335
|
-
hideTimeout.current = setTimeout(() =>
|
|
371
|
+
hideTimeout.current = setTimeout(() => {
|
|
372
|
+
scrollingRef.current = false;
|
|
373
|
+
setScrolling(false);
|
|
374
|
+
}, scrollHideDelay);
|
|
336
375
|
}, [type, scrollHideDelay]);
|
|
337
376
|
|
|
338
377
|
const debouncedScrollEnd = useDebouncedCallback((pos: ScrollPosition) => {
|
|
@@ -361,13 +400,43 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
361
400
|
[reachThreshold, onReachTop, onReachBottom, onReachStart, onReachEnd],
|
|
362
401
|
);
|
|
363
402
|
|
|
403
|
+
// Re-derive the edge-fade booleans from an offset + the measured size, re-rendering
|
|
404
|
+
// only when one actually flips. No-op unless `shadows` is set.
|
|
405
|
+
const syncEdges = React.useCallback(
|
|
406
|
+
(x: number, y: number) => {
|
|
407
|
+
if (!anyShadow) return;
|
|
408
|
+
const sz = sizeRef.current;
|
|
409
|
+
const next: EdgeState = {
|
|
410
|
+
top: y > 1,
|
|
411
|
+
bottom: sz.contentH - sz.viewportH - y > 1,
|
|
412
|
+
left: x > 1,
|
|
413
|
+
right: sz.contentW - sz.viewportW - x > 1,
|
|
414
|
+
};
|
|
415
|
+
setEdges((prev) =>
|
|
416
|
+
prev.top === next.top &&
|
|
417
|
+
prev.bottom === next.bottom &&
|
|
418
|
+
prev.left === next.left &&
|
|
419
|
+
prev.right === next.right
|
|
420
|
+
? prev
|
|
421
|
+
: next,
|
|
422
|
+
);
|
|
423
|
+
},
|
|
424
|
+
[anyShadow],
|
|
425
|
+
);
|
|
426
|
+
|
|
427
|
+
// A size change can flip an edge without any scroll (content grew/shrank), and the
|
|
428
|
+
// fades are no longer derived during render — so re-sync when the size lands.
|
|
429
|
+
React.useEffect(() => {
|
|
430
|
+
syncEdges(scrollX.value, scrollY.value);
|
|
431
|
+
}, [syncEdges, size, scrollX, scrollY]);
|
|
432
|
+
|
|
364
433
|
// Single JS entry point for a scroll sample — invoked from the UI thread via
|
|
365
434
|
// `runOnJS`, and ONLY when something on the JS side actually consumes it.
|
|
366
435
|
const reportScroll = React.useCallback(
|
|
367
436
|
(x: number, y: number) => {
|
|
368
437
|
onScrollPositionChange?.({ x, y });
|
|
369
438
|
flashScrollbars();
|
|
370
|
-
|
|
439
|
+
syncEdges(x, y);
|
|
371
440
|
if (stickToBottom) {
|
|
372
441
|
const sz = sizeRef.current;
|
|
373
442
|
stuckRef.current = isNearBottom(y, sz.contentH, sz.viewportH, stickToBottomThreshold);
|
|
@@ -378,7 +447,7 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
378
447
|
[
|
|
379
448
|
onScrollPositionChange,
|
|
380
449
|
flashScrollbars,
|
|
381
|
-
|
|
450
|
+
syncEdges,
|
|
382
451
|
fireReachCallbacks,
|
|
383
452
|
debouncedScrollEnd,
|
|
384
453
|
onScrollEnd,
|
|
@@ -387,11 +456,9 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
387
456
|
],
|
|
388
457
|
);
|
|
389
458
|
|
|
390
|
-
//
|
|
391
|
-
//
|
|
392
|
-
const
|
|
393
|
-
type === "hover" ||
|
|
394
|
-
type === "scroll" ||
|
|
459
|
+
// Does a consumer need the ACTUAL per-frame samples (a value it reads, a threshold
|
|
460
|
+
// it crosses)? Only then may the offset cross to the JS thread every frame.
|
|
461
|
+
const needsScrollSamples =
|
|
395
462
|
stickToBottom ||
|
|
396
463
|
anyShadow ||
|
|
397
464
|
Boolean(
|
|
@@ -402,6 +469,17 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
402
469
|
onReachStart ||
|
|
403
470
|
onReachEnd,
|
|
404
471
|
);
|
|
472
|
+
// The DEFAULT configuration (`type="hover"`, no callbacks) needs the JS thread for
|
|
473
|
+
// one thing only: showing the scrollbars while the user scrolls. That is a boolean
|
|
474
|
+
// with a ~1s trailing timer, so hopping the bridge 60–120×/s for it was pure waste
|
|
475
|
+
// — and the worst kind, since `runOnJS` lands its work on the JS thread exactly
|
|
476
|
+
// while it is busy rendering the list being flung. Throttled to a few hops/s below.
|
|
477
|
+
const needsScrollFlash = type === "hover" || type === "scroll";
|
|
478
|
+
const needsJsScroll = needsScrollSamples || needsScrollFlash;
|
|
479
|
+
// 0 = every frame (a real consumer); otherwise the flash cadence.
|
|
480
|
+
const reportIntervalMs = needsScrollSamples ? 0 : SCROLL_FLASH_INTERVAL_MS;
|
|
481
|
+
// Timestamp of the last `runOnJS` hop, kept on the UI thread.
|
|
482
|
+
const lastReportSV = useSharedValue(0);
|
|
405
483
|
|
|
406
484
|
/* ---------------- size tracking ---------------- */
|
|
407
485
|
|
|
@@ -468,10 +546,12 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
468
546
|
"worklet";
|
|
469
547
|
scrollX.value = event.contentOffset.x;
|
|
470
548
|
scrollY.value = event.contentOffset.y;
|
|
471
|
-
if (needsJsScroll
|
|
549
|
+
if (needsJsScroll && shouldReportW(lastReportSV, reportIntervalMs)) {
|
|
550
|
+
runOnJS(reportScroll)(event.contentOffset.x, event.contentOffset.y);
|
|
551
|
+
}
|
|
472
552
|
},
|
|
473
553
|
},
|
|
474
|
-
[needsJsScroll, reportScroll],
|
|
554
|
+
[needsJsScroll, reportIntervalMs, lastReportSV, reportScroll],
|
|
475
555
|
);
|
|
476
556
|
|
|
477
557
|
/* ---------------- Pan engine ---------------- */
|
|
@@ -484,6 +564,7 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
484
564
|
"worklet";
|
|
485
565
|
if (!usePan || !needsJsScroll) return;
|
|
486
566
|
if (prev && curr.x === prev.x && curr.y === prev.y) return;
|
|
567
|
+
if (!shouldReportW(lastReportSV, reportIntervalMs)) return;
|
|
487
568
|
runOnJS(reportScroll)(curr.x, curr.y);
|
|
488
569
|
},
|
|
489
570
|
);
|
|
@@ -494,10 +575,16 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
494
575
|
// which hops to JS via `runOnJS` and stutters when JS is busy. Watches the
|
|
495
576
|
// internal offset shared values, so it covers BOTH the native (Autosize) and
|
|
496
577
|
// Pan engines with one reaction. No-op unless the caller passes the props.
|
|
578
|
+
// When neither prop is supplied the prepare worklet reads NO shared value, so
|
|
579
|
+
// reanimated registers no dependency and the reaction never runs — instead of
|
|
580
|
+
// allocating + comparing an `{x, y}` object on the UI thread every frame for
|
|
581
|
+
// nothing (the common case: nobody passes these).
|
|
582
|
+
const mirrorsOffset = Boolean(scrollValueX || scrollValueY);
|
|
497
583
|
useAnimatedReaction(
|
|
498
|
-
() => ({ x: scrollX.value, y: scrollY.value }),
|
|
584
|
+
() => (mirrorsOffset ? { x: scrollX.value, y: scrollY.value } : null),
|
|
499
585
|
(curr) => {
|
|
500
586
|
"worklet";
|
|
587
|
+
if (!curr) return;
|
|
501
588
|
if (scrollValueX) scrollValueX.value = curr.x;
|
|
502
589
|
if (scrollValueY) scrollValueY.value = curr.y;
|
|
503
590
|
},
|
|
@@ -708,38 +795,36 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
708
795
|
|
|
709
796
|
/* ---------------- animated thumb styles (UI thread) ---------------- */
|
|
710
797
|
|
|
798
|
+
// The per-frame style carries a TRANSFORM ONLY. This split is the whole point: a
|
|
799
|
+
// `useAnimatedStyle` re-runs (and re-applies its result) whenever any shared value
|
|
800
|
+
// it reads changes, and a transform is a compositor-only mutation while `left`/
|
|
801
|
+
// `right`/`height` are LAYOUT props — pushing those through the animated style on
|
|
802
|
+
// every scroll frame dirtied Yoga and forced a layout pass per frame per thumb.
|
|
803
|
+
// The thumb's LENGTH is scroll-independent (`yBar.size`, plain style below) and the
|
|
804
|
+
// hover-grow inset lives in its own style, which only re-runs while `insetSV` is
|
|
805
|
+
// actually animating (~150ms on drag start/end).
|
|
711
806
|
const yThumbStyle = useAnimatedStyle(() => {
|
|
712
807
|
"worklet";
|
|
713
|
-
const {
|
|
714
|
-
|
|
715
|
-
size.viewportH,
|
|
716
|
-
yTrack,
|
|
717
|
-
scrollY.value,
|
|
718
|
-
);
|
|
719
|
-
return {
|
|
720
|
-
height: thumbSize,
|
|
721
|
-
left: insetSV.value,
|
|
722
|
-
right: insetSV.value,
|
|
723
|
-
transform: [{ translateY: offset }],
|
|
724
|
-
};
|
|
808
|
+
const { offset } = thumbGeometryW(size.contentH, size.viewportH, yTrack, scrollY.value);
|
|
809
|
+
return { transform: [{ translateY: offset }] };
|
|
725
810
|
}, [size.contentH, size.viewportH, yTrack]);
|
|
726
811
|
|
|
812
|
+
const yThumbInsetStyle = useAnimatedStyle(() => {
|
|
813
|
+
"worklet";
|
|
814
|
+
return { left: insetSV.value, right: insetSV.value };
|
|
815
|
+
});
|
|
816
|
+
|
|
727
817
|
const xThumbStyle = useAnimatedStyle(() => {
|
|
728
818
|
"worklet";
|
|
729
|
-
const {
|
|
730
|
-
|
|
731
|
-
size.viewportW,
|
|
732
|
-
xTrack,
|
|
733
|
-
scrollX.value,
|
|
734
|
-
);
|
|
735
|
-
return {
|
|
736
|
-
width: thumbSize,
|
|
737
|
-
top: insetSV.value,
|
|
738
|
-
bottom: insetSV.value,
|
|
739
|
-
transform: [{ translateX: offset }],
|
|
740
|
-
};
|
|
819
|
+
const { offset } = thumbGeometryW(size.contentW, size.viewportW, xTrack, scrollX.value);
|
|
820
|
+
return { transform: [{ translateX: offset }] };
|
|
741
821
|
}, [size.contentW, size.viewportW, xTrack]);
|
|
742
822
|
|
|
823
|
+
const xThumbInsetStyle = useAnimatedStyle(() => {
|
|
824
|
+
"worklet";
|
|
825
|
+
return { top: insetSV.value, bottom: insetSV.value };
|
|
826
|
+
});
|
|
827
|
+
|
|
743
828
|
/* ---------------- content translate (Pan engine) ---------------- */
|
|
744
829
|
|
|
745
830
|
const contentTranslateStyle = useAnimatedStyle(() => {
|
|
@@ -853,14 +938,10 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
853
938
|
|
|
854
939
|
/* ---------------- edge shadows ---------------- */
|
|
855
940
|
|
|
856
|
-
// Plain (non-animated) overlays whose visibility is driven by the `
|
|
857
|
-
//
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
bottom: size.contentH - size.viewportH - shadowScroll.y > 1,
|
|
861
|
-
left: shadowScroll.x > 1,
|
|
862
|
-
right: size.contentW - size.viewportW - shadowScroll.x > 1,
|
|
863
|
-
};
|
|
941
|
+
// Plain (non-animated) overlays whose visibility is driven by the `edges` booleans
|
|
942
|
+
// derived in `reportScroll` — opt-in, so this React-state path only costs when
|
|
943
|
+
// `shadows` is set, and then only on an actual edge crossing.
|
|
944
|
+
const edgeOverflow: EdgeState = edges;
|
|
864
945
|
const resolvedScrim = (shadowColor ?? "$color8") as BoxProps["backgroundColor"];
|
|
865
946
|
|
|
866
947
|
const renderEdgeShadow = (edge: Edge) => {
|
|
@@ -911,7 +992,13 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
911
992
|
{/* Plain Animated.View carries the per-frame geometry (height/offset/
|
|
912
993
|
inset); the inner Tamagui Thumb fills it and supplies colour/radius/
|
|
913
994
|
`thumbProps`. Keeps reanimated off the styled component. */}
|
|
914
|
-
<Animated.View
|
|
995
|
+
<Animated.View
|
|
996
|
+
style={[
|
|
997
|
+
{ position: "absolute", top: 0, height: yBar.size },
|
|
998
|
+
yThumbInsetStyle,
|
|
999
|
+
yThumbStyle,
|
|
1000
|
+
]}
|
|
1001
|
+
>
|
|
915
1002
|
<ScrollAreaThumb top={0} left={0} right={0} bottom={0} {...mergedThumbProps} />
|
|
916
1003
|
</Animated.View>
|
|
917
1004
|
</ScrollAreaScrollbar>
|
|
@@ -931,7 +1018,13 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
931
1018
|
{...animateOnlyProps(ANIMATE_OPACITY)}
|
|
932
1019
|
{...mergedScrollbarProps}
|
|
933
1020
|
>
|
|
934
|
-
<Animated.View
|
|
1021
|
+
<Animated.View
|
|
1022
|
+
style={[
|
|
1023
|
+
{ position: "absolute", left: 0, width: xBar.size },
|
|
1024
|
+
xThumbInsetStyle,
|
|
1025
|
+
xThumbStyle,
|
|
1026
|
+
]}
|
|
1027
|
+
>
|
|
935
1028
|
<ScrollAreaThumb top={0} left={0} right={0} bottom={0} {...mergedThumbProps} />
|
|
936
1029
|
</Animated.View>
|
|
937
1030
|
</ScrollAreaScrollbar>
|