@knitui/components 0.14.0 → 1.0.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/README.md +2 -2
- package/lib/commonjs/Accordion/Accordion.js +78 -96
- package/lib/commonjs/Accordion/Accordion.js.map +1 -1
- package/lib/commonjs/ActionIcon/ActionIcon.js +127 -61
- package/lib/commonjs/ActionIcon/ActionIcon.js.map +1 -1
- package/lib/commonjs/Affix/Affix.js +16 -20
- package/lib/commonjs/Affix/Affix.js.map +1 -1
- package/lib/commonjs/Alert/Alert.js +53 -53
- package/lib/commonjs/Alert/Alert.js.map +1 -1
- package/lib/commonjs/Anchor/Anchor.js +12 -15
- package/lib/commonjs/Anchor/Anchor.js.map +1 -1
- package/lib/commonjs/AngleSlider/AngleSlider.js +65 -37
- package/lib/commonjs/AngleSlider/AngleSlider.js.map +1 -1
- package/lib/commonjs/AspectRatio/AspectRatio.js +12 -15
- package/lib/commonjs/AspectRatio/AspectRatio.js.map +1 -1
- package/lib/commonjs/Autocomplete/Autocomplete.js +7 -3
- package/lib/commonjs/Autocomplete/Autocomplete.js.map +1 -1
- package/lib/commonjs/Avatar/Avatar.js +27 -24
- package/lib/commonjs/Avatar/Avatar.js.map +1 -1
- package/lib/commonjs/BackgroundImage/BackgroundImage.js +15 -6
- package/lib/commonjs/BackgroundImage/BackgroundImage.js.map +1 -1
- package/lib/commonjs/Badge/Badge.js +59 -48
- package/lib/commonjs/Badge/Badge.js.map +1 -1
- package/lib/commonjs/Blockquote/Blockquote.js +80 -79
- package/lib/commonjs/Blockquote/Blockquote.js.map +1 -1
- package/lib/commonjs/Box/Box.js +2 -2
- package/lib/commonjs/Box/Box.js.map +1 -1
- package/lib/commonjs/Breadcrumbs/Breadcrumbs.js +9 -9
- package/lib/commonjs/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/lib/commonjs/Burger/Burger.js +31 -20
- package/lib/commonjs/Burger/Burger.js.map +1 -1
- package/lib/commonjs/Button/Button.js +104 -62
- package/lib/commonjs/Button/Button.js.map +1 -1
- package/lib/commonjs/Card/Card.js +49 -37
- package/lib/commonjs/Card/Card.js.map +1 -1
- package/lib/commonjs/Center/Center.js +2 -2
- package/lib/commonjs/Center/Center.js.map +1 -1
- package/lib/commonjs/Checkbox/CheckIcon.js +5 -4
- package/lib/commonjs/Checkbox/CheckIcon.js.map +1 -1
- package/lib/commonjs/Checkbox/Checkbox.js +98 -68
- package/lib/commonjs/Checkbox/Checkbox.js.map +1 -1
- package/lib/commonjs/Chip/Chip.js +34 -67
- package/lib/commonjs/Chip/Chip.js.map +1 -1
- package/lib/commonjs/CloseButton/CloseButton.js +11 -4
- package/lib/commonjs/CloseButton/CloseButton.js.map +1 -1
- package/lib/commonjs/Code/Code.js +14 -10
- package/lib/commonjs/Code/Code.js.map +1 -1
- package/lib/commonjs/Collapse/Collapse.js +10 -4
- package/lib/commonjs/Collapse/Collapse.js.map +1 -1
- package/lib/commonjs/ColorInput/ColorInput.js +25 -20
- package/lib/commonjs/ColorInput/ColorInput.js.map +1 -1
- package/lib/commonjs/ColorPicker/ColorPicker.js +95 -83
- package/lib/commonjs/ColorPicker/ColorPicker.js.map +1 -1
- package/lib/commonjs/ColorSwatch/ColorSwatch.js +12 -14
- package/lib/commonjs/ColorSwatch/ColorSwatch.js.map +1 -1
- package/lib/commonjs/Combobox/Combobox.js +194 -187
- package/lib/commonjs/Combobox/Combobox.js.map +1 -1
- package/lib/commonjs/Combobox/OptionsDropdown.js +12 -6
- package/lib/commonjs/Combobox/OptionsDropdown.js.map +1 -1
- package/lib/commonjs/Combobox/index.js +6 -0
- package/lib/commonjs/Combobox/index.js.map +1 -1
- package/lib/commonjs/Container/Container.js +12 -19
- package/lib/commonjs/Container/Container.js.map +1 -1
- package/lib/commonjs/Dialog/Dialog.js +15 -14
- package/lib/commonjs/Dialog/Dialog.js.map +1 -1
- package/lib/commonjs/Drawer/Drawer.js +51 -32
- package/lib/commonjs/Drawer/Drawer.js.map +1 -1
- package/lib/commonjs/Fieldset/Fieldset.js +26 -18
- package/lib/commonjs/Fieldset/Fieldset.js.map +1 -1
- package/lib/commonjs/FileButton/FileButton.js +5 -3
- package/lib/commonjs/FileButton/FileButton.js.map +1 -1
- package/lib/commonjs/Flex/Flex.js +24 -27
- package/lib/commonjs/Flex/Flex.js.map +1 -1
- package/lib/commonjs/FocusTrap/FocusTrap.js +4 -3
- package/lib/commonjs/FocusTrap/FocusTrap.js.map +1 -1
- package/lib/commonjs/Grid/Grid.js +21 -18
- package/lib/commonjs/Grid/Grid.js.map +1 -1
- package/lib/commonjs/Group/Group.js +3 -3
- package/lib/commonjs/Group/Group.js.map +1 -1
- package/lib/commonjs/Highlight/Highlight.js +2 -1
- package/lib/commonjs/Highlight/Highlight.js.map +1 -1
- package/lib/commonjs/HoverCard/HoverCard.js +6 -23
- package/lib/commonjs/HoverCard/HoverCard.js.map +1 -1
- package/lib/commonjs/Image/Image.native.js +1 -1
- package/lib/commonjs/Image/createImage.js +88 -56
- package/lib/commonjs/Image/createImage.js.map +1 -1
- package/lib/commonjs/Indicator/Indicator.js +36 -29
- package/lib/commonjs/Indicator/Indicator.js.map +1 -1
- package/lib/commonjs/Input/Input.js +87 -119
- package/lib/commonjs/Input/Input.js.map +1 -1
- package/lib/commonjs/Input/Input.native.js +40 -30
- package/lib/commonjs/Input/Input.native.js.map +1 -1
- package/lib/commonjs/Input/shared.js +148 -225
- package/lib/commonjs/Input/shared.js.map +1 -1
- package/lib/commonjs/InputBase/InputBase.js +2 -1
- package/lib/commonjs/InputBase/InputBase.js.map +1 -1
- package/lib/commonjs/Kbd/Kbd.js +12 -18
- package/lib/commonjs/Kbd/Kbd.js.map +1 -1
- package/lib/commonjs/KeyboardAvoidingView/KeyboardAvoidingView.native.js +2 -2
- package/lib/commonjs/KeyboardAvoidingView/KeyboardAvoidingView.native.js.map +1 -1
- package/lib/commonjs/KeyboardAwareScrollView/KeyboardAwareScrollView.native.js +1 -1
- package/lib/commonjs/KeyboardAwareScrollView/KeyboardAwareScrollView.native.js.map +1 -1
- package/lib/commonjs/List/List.js +10 -10
- package/lib/commonjs/List/List.js.map +1 -1
- package/lib/commonjs/Loader/Loader.js +31 -37
- package/lib/commonjs/Loader/Loader.js.map +1 -1
- package/lib/commonjs/LoadingOverlay/LoadingOverlay.js +2 -1
- package/lib/commonjs/LoadingOverlay/LoadingOverlay.js.map +1 -1
- package/lib/commonjs/Mark/Mark.js +12 -15
- package/lib/commonjs/Mark/Mark.js.map +1 -1
- package/lib/commonjs/Marquee/Marquee.js +66 -48
- package/lib/commonjs/Marquee/Marquee.js.map +1 -1
- package/lib/commonjs/MaskInput/MaskInput.js +2 -1
- package/lib/commonjs/MaskInput/MaskInput.js.map +1 -1
- package/lib/commonjs/Menu/Menu.js +84 -48
- package/lib/commonjs/Menu/Menu.js.map +1 -1
- package/lib/commonjs/Modal/Modal.js +34 -30
- package/lib/commonjs/Modal/Modal.js.map +1 -1
- package/lib/commonjs/Modal/drag/DragDismissHost.web.js +10 -6
- package/lib/commonjs/Modal/drag/DragDismissHost.web.js.map +1 -1
- package/lib/commonjs/Modal/drag/DragDismissOverlay.web.js +6 -8
- package/lib/commonjs/Modal/drag/DragDismissOverlay.web.js.map +1 -1
- package/lib/commonjs/Modal/drag/index.js.map +1 -1
- package/lib/commonjs/Modal/modal-base-inner.js +1 -1
- package/lib/commonjs/Modal/modal-base-inner.js.map +1 -1
- package/lib/commonjs/Modal/modal-base-inner.native.js +3 -2
- package/lib/commonjs/Modal/modal-base-inner.native.js.map +1 -1
- package/lib/commonjs/Modal/modal-base.js +22 -9
- package/lib/commonjs/Modal/modal-base.js.map +1 -1
- package/lib/commonjs/MultiSelect/MultiSelect.js +6 -2
- package/lib/commonjs/MultiSelect/MultiSelect.js.map +1 -1
- package/lib/commonjs/NativeSelect/NativeSelect.js +25 -30
- package/lib/commonjs/NativeSelect/NativeSelect.js.map +1 -1
- package/lib/commonjs/NavLink/NavLink.js +63 -58
- package/lib/commonjs/NavLink/NavLink.js.map +1 -1
- package/lib/commonjs/Notification/Notification.js +28 -28
- package/lib/commonjs/Notification/Notification.js.map +1 -1
- package/lib/commonjs/NumberFormatter/NumberFormatter.js +2 -2
- package/lib/commonjs/NumberFormatter/NumberFormatter.js.map +1 -1
- package/lib/commonjs/NumberInput/NumberInput.js +46 -43
- package/lib/commonjs/NumberInput/NumberInput.js.map +1 -1
- package/lib/commonjs/Overlay/Overlay.js +18 -11
- package/lib/commonjs/Overlay/Overlay.js.map +1 -1
- package/lib/commonjs/Pagination/Pagination.js +125 -120
- package/lib/commonjs/Pagination/Pagination.js.map +1 -1
- package/lib/commonjs/Paper/Paper.js +7 -8
- package/lib/commonjs/Paper/Paper.js.map +1 -1
- package/lib/commonjs/Paragraph/Paragraph.js +7 -10
- package/lib/commonjs/Paragraph/Paragraph.js.map +1 -1
- package/lib/commonjs/PasswordInput/PasswordInput.js +3 -3
- package/lib/commonjs/PasswordInput/PasswordInput.js.map +1 -1
- package/lib/commonjs/Pill/Pill.js +39 -33
- package/lib/commonjs/Pill/Pill.js.map +1 -1
- package/lib/commonjs/PillsInput/PillsInput.js +58 -31
- package/lib/commonjs/PillsInput/PillsInput.js.map +1 -1
- package/lib/commonjs/PinInput/PinInput.js +26 -20
- package/lib/commonjs/PinInput/PinInput.js.map +1 -1
- package/lib/commonjs/Popover/Popover.native.js +6 -2
- package/lib/commonjs/Popover/Popover.native.js.map +1 -1
- package/lib/commonjs/Popover/Popover.shared.js +33 -22
- package/lib/commonjs/Popover/Popover.shared.js.map +1 -1
- package/lib/commonjs/Progress/Progress.js +37 -26
- package/lib/commonjs/Progress/Progress.js.map +1 -1
- package/lib/commonjs/Radio/Radio.js +81 -93
- package/lib/commonjs/Radio/Radio.js.map +1 -1
- package/lib/commonjs/Radio/RadioIcon.js +4 -6
- package/lib/commonjs/Radio/RadioIcon.js.map +1 -1
- package/lib/commonjs/Rating/Rating.js +48 -38
- package/lib/commonjs/Rating/Rating.js.map +1 -1
- package/lib/commonjs/RollingNumber/RollingNumber.js +48 -24
- package/lib/commonjs/RollingNumber/RollingNumber.js.map +1 -1
- package/lib/commonjs/ScrollArea/ScrollArea.js +40 -37
- package/lib/commonjs/ScrollArea/ScrollArea.js.map +1 -1
- package/lib/commonjs/ScrollArea/ScrollArea.native.js +21 -26
- package/lib/commonjs/ScrollArea/ScrollArea.native.js.map +1 -1
- package/lib/commonjs/SegmentedControl/SegmentedControl.js +106 -55
- package/lib/commonjs/SegmentedControl/SegmentedControl.js.map +1 -1
- package/lib/commonjs/Select/Select.js +7 -3
- package/lib/commonjs/Select/Select.js.map +1 -1
- package/lib/commonjs/Separator/Separator.js +47 -39
- package/lib/commonjs/Separator/Separator.js.map +1 -1
- package/lib/commonjs/SimpleGrid/SimpleGrid.js +12 -14
- package/lib/commonjs/SimpleGrid/SimpleGrid.js.map +1 -1
- package/lib/commonjs/Skeleton/Skeleton.js +39 -24
- package/lib/commonjs/Skeleton/Skeleton.js.map +1 -1
- package/lib/commonjs/Slider/Slider.js +308 -257
- package/lib/commonjs/Slider/Slider.js.map +1 -1
- package/lib/commonjs/Spacer/Spacer.js +15 -29
- package/lib/commonjs/Spacer/Spacer.js.map +1 -1
- package/lib/commonjs/Spoiler/Spoiler.js +16 -16
- package/lib/commonjs/Spoiler/Spoiler.js.map +1 -1
- package/lib/commonjs/Stack/Stack.js +3 -3
- package/lib/commonjs/Stack/Stack.js.map +1 -1
- package/lib/commonjs/Stepper/Stepper.js +96 -71
- package/lib/commonjs/Stepper/Stepper.js.map +1 -1
- package/lib/commonjs/Switch/Switch.js +71 -67
- package/lib/commonjs/Switch/Switch.js.map +1 -1
- package/lib/commonjs/Table/Table.js +96 -82
- package/lib/commonjs/Table/Table.js.map +1 -1
- package/lib/commonjs/TableOfContents/TableOfContents.js +94 -95
- package/lib/commonjs/TableOfContents/TableOfContents.js.map +1 -1
- package/lib/commonjs/Tabs/Tabs.js +71 -73
- package/lib/commonjs/Tabs/Tabs.js.map +1 -1
- package/lib/commonjs/TagsInput/TagsInput.js +19 -3
- package/lib/commonjs/TagsInput/TagsInput.js.map +1 -1
- package/lib/commonjs/Text/Text.js +29 -14
- package/lib/commonjs/Text/Text.js.map +1 -1
- package/lib/commonjs/TextInput/TextInput.js +2 -1
- package/lib/commonjs/TextInput/TextInput.js.map +1 -1
- package/lib/commonjs/Textarea/Textarea.js +1 -1
- package/lib/commonjs/Textarea/Textarea.js.map +1 -1
- package/lib/commonjs/ThemeIcon/ThemeIcon.js +9 -5
- package/lib/commonjs/ThemeIcon/ThemeIcon.js.map +1 -1
- package/lib/commonjs/Title/Title.js +49 -32
- package/lib/commonjs/Title/Title.js.map +1 -1
- package/lib/commonjs/Tooltip/Tooltip.js +43 -27
- package/lib/commonjs/Tooltip/Tooltip.js.map +1 -1
- package/lib/commonjs/Transition/Transition.native.js +11 -10
- package/lib/commonjs/Transition/Transition.native.js.map +1 -1
- package/lib/commonjs/Transition/use-overlay-transition.native.js +2 -5
- package/lib/commonjs/Transition/use-overlay-transition.native.js.map +1 -1
- package/lib/commonjs/Tree/Tree.js +30 -34
- package/lib/commonjs/Tree/Tree.js.map +1 -1
- package/lib/commonjs/TreeSelect/TreeSelect.js +50 -26
- package/lib/commonjs/TreeSelect/TreeSelect.js.map +1 -1
- package/lib/commonjs/Typography/Typography.js +5 -7
- package/lib/commonjs/Typography/Typography.js.map +1 -1
- package/lib/commonjs/UnstyledButton/UnstyledButton.js +4 -4
- package/lib/commonjs/UnstyledButton/UnstyledButton.js.map +1 -1
- package/lib/commonjs/VirtualList/VirtualList.js +23 -7
- package/lib/commonjs/VirtualList/VirtualList.js.map +1 -1
- package/lib/commonjs/VisuallyHidden/VisuallyHidden.js +7 -10
- package/lib/commonjs/VisuallyHidden/VisuallyHidden.js.map +1 -1
- package/lib/commonjs/control-system.js +7 -0
- package/lib/commonjs/control-system.js.map +1 -1
- package/lib/commonjs/index.js +6 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal/ControlIconProvider.js +1 -1
- package/lib/commonjs/internal/ControlIconProvider.js.map +1 -1
- package/lib/commonjs/internal/InlineControl.js +24 -29
- package/lib/commonjs/internal/InlineControl.js.map +1 -1
- package/lib/commonjs/internal/collapse-box.js +12 -10
- package/lib/commonjs/internal/collapse-box.js.map +1 -1
- package/lib/commonjs/internal/control-icon-size.js +5 -8
- package/lib/commonjs/internal/control-icon-size.js.map +1 -1
- package/lib/commonjs/internal/control-metrics.js +51 -51
- package/lib/commonjs/internal/control-metrics.js.map +1 -1
- package/lib/commonjs/internal/floating-arrow.js +43 -29
- package/lib/commonjs/internal/floating-arrow.js.map +1 -1
- package/lib/commonjs/internal/focus-ring.js +99 -0
- package/lib/commonjs/internal/focus-ring.js.map +1 -0
- package/lib/commonjs/internal/gradient-shared.js +7 -7
- package/lib/commonjs/internal/gradient-shared.js.map +1 -1
- package/lib/commonjs/internal/gradient.native.js +1 -1
- package/lib/commonjs/internal/motion.js +247 -359
- package/lib/commonjs/internal/motion.js.map +1 -1
- package/lib/commonjs/internal/resolve-theme-color.js +10 -10
- package/lib/commonjs/internal/resolve-theme-color.js.map +1 -1
- package/lib/commonjs/internal/style-props.js +510 -464
- package/lib/commonjs/internal/style-props.js.map +1 -1
- package/lib/commonjs/internal/theme-color-web.js +44 -26
- package/lib/commonjs/internal/theme-color-web.js.map +1 -1
- package/lib/commonjs/internal/use-icon-color.js +1 -1
- package/lib/commonjs/internal/use-icon-color.native.js +1 -1
- package/lib/commonjs/internal/use-slot-text-wrapper.js +1 -1
- package/lib/commonjs/internal/variant-colors.js +163 -229
- package/lib/commonjs/internal/variant-colors.js.map +1 -1
- package/lib/module/Accordion/Accordion.js +80 -98
- package/lib/module/Accordion/Accordion.js.map +1 -1
- package/lib/module/ActionIcon/ActionIcon.js +128 -62
- package/lib/module/ActionIcon/ActionIcon.js.map +1 -1
- package/lib/module/Affix/Affix.js +17 -21
- package/lib/module/Affix/Affix.js.map +1 -1
- package/lib/module/Alert/Alert.js +54 -54
- package/lib/module/Alert/Alert.js.map +1 -1
- package/lib/module/Anchor/Anchor.js +13 -16
- package/lib/module/Anchor/Anchor.js.map +1 -1
- package/lib/module/AngleSlider/AngleSlider.js +66 -38
- package/lib/module/AngleSlider/AngleSlider.js.map +1 -1
- package/lib/module/AspectRatio/AspectRatio.js +10 -14
- package/lib/module/AspectRatio/AspectRatio.js.map +1 -1
- package/lib/module/Autocomplete/Autocomplete.js +8 -4
- package/lib/module/Autocomplete/Autocomplete.js.map +1 -1
- package/lib/module/Avatar/Avatar.js +29 -26
- package/lib/module/Avatar/Avatar.js.map +1 -1
- package/lib/module/BackgroundImage/BackgroundImage.js +16 -7
- package/lib/module/BackgroundImage/BackgroundImage.js.map +1 -1
- package/lib/module/Badge/Badge.js +61 -50
- package/lib/module/Badge/Badge.js.map +1 -1
- package/lib/module/Blockquote/Blockquote.js +82 -81
- package/lib/module/Blockquote/Blockquote.js.map +1 -1
- package/lib/module/Box/Box.js +2 -2
- package/lib/module/Box/Box.js.map +1 -1
- package/lib/module/Breadcrumbs/Breadcrumbs.js +10 -10
- package/lib/module/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/lib/module/Burger/Burger.js +32 -21
- package/lib/module/Burger/Burger.js.map +1 -1
- package/lib/module/Button/Button.js +105 -63
- package/lib/module/Button/Button.js.map +1 -1
- package/lib/module/Card/Card.js +51 -39
- package/lib/module/Card/Card.js.map +1 -1
- package/lib/module/Center/Center.js +3 -3
- package/lib/module/Center/Center.js.map +1 -1
- package/lib/module/Checkbox/CheckIcon.js +5 -4
- package/lib/module/Checkbox/CheckIcon.js.map +1 -1
- package/lib/module/Checkbox/Checkbox.js +100 -70
- package/lib/module/Checkbox/Checkbox.js.map +1 -1
- package/lib/module/Chip/Chip.js +35 -68
- package/lib/module/Chip/Chip.js.map +1 -1
- package/lib/module/CloseButton/CloseButton.js +12 -5
- package/lib/module/CloseButton/CloseButton.js.map +1 -1
- package/lib/module/Code/Code.js +15 -11
- package/lib/module/Code/Code.js.map +1 -1
- package/lib/module/Collapse/Collapse.js +11 -5
- package/lib/module/Collapse/Collapse.js.map +1 -1
- package/lib/module/ColorInput/ColorInput.js +26 -21
- package/lib/module/ColorInput/ColorInput.js.map +1 -1
- package/lib/module/ColorPicker/ColorPicker.js +96 -84
- package/lib/module/ColorPicker/ColorPicker.js.map +1 -1
- package/lib/module/ColorSwatch/ColorSwatch.js +13 -15
- package/lib/module/ColorSwatch/ColorSwatch.js.map +1 -1
- package/lib/module/Combobox/Combobox.js +194 -188
- package/lib/module/Combobox/Combobox.js.map +1 -1
- package/lib/module/Combobox/OptionsDropdown.js +13 -7
- package/lib/module/Combobox/OptionsDropdown.js.map +1 -1
- package/lib/module/Combobox/index.js +1 -1
- package/lib/module/Combobox/index.js.map +1 -1
- package/lib/module/Container/Container.js +12 -19
- package/lib/module/Container/Container.js.map +1 -1
- package/lib/module/Dialog/Dialog.js +16 -15
- package/lib/module/Dialog/Dialog.js.map +1 -1
- package/lib/module/Drawer/Drawer.js +53 -34
- package/lib/module/Drawer/Drawer.js.map +1 -1
- package/lib/module/Fieldset/Fieldset.js +27 -19
- package/lib/module/Fieldset/Fieldset.js.map +1 -1
- package/lib/module/FileButton/FileButton.js +5 -3
- package/lib/module/FileButton/FileButton.js.map +1 -1
- package/lib/module/Flex/Flex.js +24 -28
- package/lib/module/Flex/Flex.js.map +1 -1
- package/lib/module/FocusTrap/FocusTrap.js +4 -3
- package/lib/module/FocusTrap/FocusTrap.js.map +1 -1
- package/lib/module/Grid/Grid.js +22 -19
- package/lib/module/Grid/Grid.js.map +1 -1
- package/lib/module/Group/Group.js +4 -4
- package/lib/module/Group/Group.js.map +1 -1
- package/lib/module/Highlight/Highlight.js +2 -1
- package/lib/module/Highlight/Highlight.js.map +1 -1
- package/lib/module/HoverCard/HoverCard.js +8 -25
- package/lib/module/HoverCard/HoverCard.js.map +1 -1
- package/lib/module/Image/Image.native.js +1 -1
- package/lib/module/Image/createImage.js +88 -56
- package/lib/module/Image/createImage.js.map +1 -1
- package/lib/module/Indicator/Indicator.js +37 -30
- package/lib/module/Indicator/Indicator.js.map +1 -1
- package/lib/module/Input/Input.js +89 -121
- package/lib/module/Input/Input.js.map +1 -1
- package/lib/module/Input/Input.native.js +42 -32
- package/lib/module/Input/Input.native.js.map +1 -1
- package/lib/module/Input/shared.js +148 -225
- package/lib/module/Input/shared.js.map +1 -1
- package/lib/module/InputBase/InputBase.js +2 -1
- package/lib/module/InputBase/InputBase.js.map +1 -1
- package/lib/module/Kbd/Kbd.js +12 -18
- package/lib/module/Kbd/Kbd.js.map +1 -1
- package/lib/module/KeyboardAvoidingView/KeyboardAvoidingView.native.js +2 -2
- package/lib/module/KeyboardAvoidingView/KeyboardAvoidingView.native.js.map +1 -1
- package/lib/module/KeyboardAwareScrollView/KeyboardAwareScrollView.native.js +1 -1
- package/lib/module/KeyboardAwareScrollView/KeyboardAwareScrollView.native.js.map +1 -1
- package/lib/module/List/List.js +11 -11
- package/lib/module/List/List.js.map +1 -1
- package/lib/module/Loader/Loader.js +33 -39
- package/lib/module/Loader/Loader.js.map +1 -1
- package/lib/module/LoadingOverlay/LoadingOverlay.js +2 -1
- package/lib/module/LoadingOverlay/LoadingOverlay.js.map +1 -1
- package/lib/module/Mark/Mark.js +11 -15
- package/lib/module/Mark/Mark.js.map +1 -1
- package/lib/module/Marquee/Marquee.js +66 -48
- package/lib/module/Marquee/Marquee.js.map +1 -1
- package/lib/module/MaskInput/MaskInput.js +2 -1
- package/lib/module/MaskInput/MaskInput.js.map +1 -1
- package/lib/module/Menu/Menu.js +86 -50
- package/lib/module/Menu/Menu.js.map +1 -1
- package/lib/module/Modal/Modal.js +35 -31
- package/lib/module/Modal/Modal.js.map +1 -1
- package/lib/module/Modal/drag/DragDismissHost.web.js +10 -6
- package/lib/module/Modal/drag/DragDismissHost.web.js.map +1 -1
- package/lib/module/Modal/drag/DragDismissOverlay.web.js +6 -8
- package/lib/module/Modal/drag/DragDismissOverlay.web.js.map +1 -1
- package/lib/module/Modal/drag/index.js +1 -1
- package/lib/module/Modal/drag/index.js.map +1 -1
- package/lib/module/Modal/modal-base-inner.js +1 -1
- package/lib/module/Modal/modal-base-inner.js.map +1 -1
- package/lib/module/Modal/modal-base-inner.native.js +3 -2
- package/lib/module/Modal/modal-base-inner.native.js.map +1 -1
- package/lib/module/Modal/modal-base.js +22 -9
- package/lib/module/Modal/modal-base.js.map +1 -1
- package/lib/module/MultiSelect/MultiSelect.js +7 -3
- package/lib/module/MultiSelect/MultiSelect.js.map +1 -1
- package/lib/module/NativeSelect/NativeSelect.js +26 -31
- package/lib/module/NativeSelect/NativeSelect.js.map +1 -1
- package/lib/module/NavLink/NavLink.js +64 -59
- package/lib/module/NavLink/NavLink.js.map +1 -1
- package/lib/module/Notification/Notification.js +29 -29
- package/lib/module/Notification/Notification.js.map +1 -1
- package/lib/module/NumberFormatter/NumberFormatter.js +3 -3
- package/lib/module/NumberFormatter/NumberFormatter.js.map +1 -1
- package/lib/module/NumberInput/NumberInput.js +49 -46
- package/lib/module/NumberInput/NumberInput.js.map +1 -1
- package/lib/module/Overlay/Overlay.js +19 -12
- package/lib/module/Overlay/Overlay.js.map +1 -1
- package/lib/module/Pagination/Pagination.js +127 -122
- package/lib/module/Pagination/Pagination.js.map +1 -1
- package/lib/module/Paper/Paper.js +8 -9
- package/lib/module/Paper/Paper.js.map +1 -1
- package/lib/module/Paragraph/Paragraph.js +6 -10
- package/lib/module/Paragraph/Paragraph.js.map +1 -1
- package/lib/module/PasswordInput/PasswordInput.js +4 -4
- package/lib/module/PasswordInput/PasswordInput.js.map +1 -1
- package/lib/module/Pill/Pill.js +40 -34
- package/lib/module/Pill/Pill.js.map +1 -1
- package/lib/module/PillsInput/PillsInput.js +59 -32
- package/lib/module/PillsInput/PillsInput.js.map +1 -1
- package/lib/module/PinInput/PinInput.js +27 -21
- package/lib/module/PinInput/PinInput.js.map +1 -1
- package/lib/module/Popover/Popover.native.js +6 -2
- package/lib/module/Popover/Popover.native.js.map +1 -1
- package/lib/module/Popover/Popover.shared.js +34 -23
- package/lib/module/Popover/Popover.shared.js.map +1 -1
- package/lib/module/Progress/Progress.js +39 -28
- package/lib/module/Progress/Progress.js.map +1 -1
- package/lib/module/Radio/Radio.js +83 -95
- package/lib/module/Radio/Radio.js.map +1 -1
- package/lib/module/Radio/RadioIcon.js +4 -6
- package/lib/module/Radio/RadioIcon.js.map +1 -1
- package/lib/module/Rating/Rating.js +50 -40
- package/lib/module/Rating/Rating.js.map +1 -1
- package/lib/module/RollingNumber/RollingNumber.js +49 -25
- package/lib/module/RollingNumber/RollingNumber.js.map +1 -1
- package/lib/module/ScrollArea/ScrollArea.js +41 -38
- package/lib/module/ScrollArea/ScrollArea.js.map +1 -1
- package/lib/module/ScrollArea/ScrollArea.native.js +22 -27
- package/lib/module/ScrollArea/ScrollArea.native.js.map +1 -1
- package/lib/module/SegmentedControl/SegmentedControl.js +108 -57
- package/lib/module/SegmentedControl/SegmentedControl.js.map +1 -1
- package/lib/module/Select/Select.js +8 -4
- package/lib/module/Select/Select.js.map +1 -1
- package/lib/module/Separator/Separator.js +49 -41
- package/lib/module/Separator/Separator.js.map +1 -1
- package/lib/module/SimpleGrid/SimpleGrid.js +14 -16
- package/lib/module/SimpleGrid/SimpleGrid.js.map +1 -1
- package/lib/module/Skeleton/Skeleton.js +40 -25
- package/lib/module/Skeleton/Skeleton.js.map +1 -1
- package/lib/module/Slider/Slider.js +309 -258
- package/lib/module/Slider/Slider.js.map +1 -1
- package/lib/module/Spacer/Spacer.js +16 -29
- package/lib/module/Spacer/Spacer.js.map +1 -1
- package/lib/module/Spoiler/Spoiler.js +17 -17
- package/lib/module/Spoiler/Spoiler.js.map +1 -1
- package/lib/module/Stack/Stack.js +3 -3
- package/lib/module/Stack/Stack.js.map +1 -1
- package/lib/module/Stepper/Stepper.js +97 -72
- package/lib/module/Stepper/Stepper.js.map +1 -1
- package/lib/module/Switch/Switch.js +73 -69
- package/lib/module/Switch/Switch.js.map +1 -1
- package/lib/module/Table/Table.js +99 -85
- package/lib/module/Table/Table.js.map +1 -1
- package/lib/module/TableOfContents/TableOfContents.js +96 -97
- package/lib/module/TableOfContents/TableOfContents.js.map +1 -1
- package/lib/module/Tabs/Tabs.js +72 -74
- package/lib/module/Tabs/Tabs.js.map +1 -1
- package/lib/module/TagsInput/TagsInput.js +21 -5
- package/lib/module/TagsInput/TagsInput.js.map +1 -1
- package/lib/module/Text/Text.js +29 -14
- package/lib/module/Text/Text.js.map +1 -1
- package/lib/module/TextInput/TextInput.js +2 -1
- package/lib/module/TextInput/TextInput.js.map +1 -1
- package/lib/module/Textarea/Textarea.js +2 -2
- package/lib/module/Textarea/Textarea.js.map +1 -1
- package/lib/module/ThemeIcon/ThemeIcon.js +10 -6
- package/lib/module/ThemeIcon/ThemeIcon.js.map +1 -1
- package/lib/module/Title/Title.js +51 -34
- package/lib/module/Title/Title.js.map +1 -1
- package/lib/module/Tooltip/Tooltip.js +44 -28
- package/lib/module/Tooltip/Tooltip.js.map +1 -1
- package/lib/module/Transition/Transition.native.js +12 -11
- package/lib/module/Transition/Transition.native.js.map +1 -1
- package/lib/module/Transition/use-overlay-transition.native.js +3 -6
- package/lib/module/Transition/use-overlay-transition.native.js.map +1 -1
- package/lib/module/Tree/Tree.js +31 -35
- package/lib/module/Tree/Tree.js.map +1 -1
- package/lib/module/TreeSelect/TreeSelect.js +52 -28
- package/lib/module/TreeSelect/TreeSelect.js.map +1 -1
- package/lib/module/Typography/Typography.js +5 -7
- package/lib/module/Typography/Typography.js.map +1 -1
- package/lib/module/UnstyledButton/UnstyledButton.js +5 -5
- package/lib/module/UnstyledButton/UnstyledButton.js.map +1 -1
- package/lib/module/VirtualList/VirtualList.js +23 -7
- package/lib/module/VirtualList/VirtualList.js.map +1 -1
- package/lib/module/VisuallyHidden/VisuallyHidden.js +6 -10
- package/lib/module/VisuallyHidden/VisuallyHidden.js.map +1 -1
- package/lib/module/control-system.js +5 -0
- package/lib/module/control-system.js.map +1 -1
- package/lib/module/index.js +8 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/ControlIconProvider.js +1 -1
- package/lib/module/internal/ControlIconProvider.js.map +1 -1
- package/lib/module/internal/InlineControl.js +25 -30
- package/lib/module/internal/InlineControl.js.map +1 -1
- package/lib/module/internal/collapse-box.js +13 -11
- package/lib/module/internal/collapse-box.js.map +1 -1
- package/lib/module/internal/control-icon-size.js +5 -8
- package/lib/module/internal/control-icon-size.js.map +1 -1
- package/lib/module/internal/control-metrics.js +52 -52
- package/lib/module/internal/control-metrics.js.map +1 -1
- package/lib/module/internal/floating-arrow.js +44 -30
- package/lib/module/internal/floating-arrow.js.map +1 -1
- package/lib/module/internal/focus-ring.js +95 -0
- package/lib/module/internal/focus-ring.js.map +1 -0
- package/lib/module/internal/gradient-shared.js +7 -7
- package/lib/module/internal/gradient-shared.js.map +1 -1
- package/lib/module/internal/gradient.native.js +1 -1
- package/lib/module/internal/motion.js +245 -359
- package/lib/module/internal/motion.js.map +1 -1
- package/lib/module/internal/resolve-theme-color.js +10 -10
- package/lib/module/internal/resolve-theme-color.js.map +1 -1
- package/lib/module/internal/style-props.js +471 -459
- package/lib/module/internal/style-props.js.map +1 -1
- package/lib/module/internal/theme-color-web.js +45 -27
- package/lib/module/internal/theme-color-web.js.map +1 -1
- package/lib/module/internal/use-icon-color.js +1 -1
- package/lib/module/internal/use-icon-color.native.js +1 -1
- package/lib/module/internal/use-slot-text-wrapper.js +1 -1
- package/lib/module/internal/variant-colors.js +150 -228
- package/lib/module/internal/variant-colors.js.map +1 -1
- package/lib/typescript/Accordion/Accordion.d.ts +120 -74
- package/lib/typescript/Accordion/Accordion.d.ts.map +1 -1
- package/lib/typescript/ActionIcon/ActionIcon.d.ts +236 -94
- package/lib/typescript/ActionIcon/ActionIcon.d.ts.map +1 -1
- package/lib/typescript/Affix/Affix.d.ts +12 -7
- package/lib/typescript/Affix/Affix.d.ts.map +1 -1
- package/lib/typescript/Alert/Alert.d.ts +228 -68
- package/lib/typescript/Alert/Alert.d.ts.map +1 -1
- package/lib/typescript/Anchor/Anchor.d.ts +33 -24
- package/lib/typescript/Anchor/Anchor.d.ts.map +1 -1
- package/lib/typescript/AngleSlider/AngleSlider.d.ts +224 -66
- package/lib/typescript/AngleSlider/AngleSlider.d.ts.map +1 -1
- package/lib/typescript/AspectRatio/AspectRatio.d.ts +34 -14
- package/lib/typescript/AspectRatio/AspectRatio.d.ts.map +1 -1
- package/lib/typescript/Autocomplete/Autocomplete.d.ts +30 -42
- package/lib/typescript/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/lib/typescript/Avatar/Avatar.d.ts +167 -191
- package/lib/typescript/Avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/BackgroundImage/BackgroundImage.d.ts +15 -10
- package/lib/typescript/BackgroundImage/BackgroundImage.d.ts.map +1 -1
- package/lib/typescript/Badge/Badge.d.ts +138 -62
- package/lib/typescript/Badge/Badge.d.ts.map +1 -1
- package/lib/typescript/Blockquote/Blockquote.d.ts +148 -50
- package/lib/typescript/Blockquote/Blockquote.d.ts.map +1 -1
- package/lib/typescript/Box/Box.d.ts +11 -3
- package/lib/typescript/Box/Box.d.ts.map +1 -1
- package/lib/typescript/Breadcrumbs/Breadcrumbs.d.ts +115 -35
- package/lib/typescript/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/lib/typescript/Burger/Burger.d.ts +124 -41
- package/lib/typescript/Burger/Burger.d.ts.map +1 -1
- package/lib/typescript/Button/Button.d.ts +236 -107
- package/lib/typescript/Button/Button.d.ts.map +1 -1
- package/lib/typescript/Card/Card.d.ts +79 -47
- package/lib/typescript/Card/Card.d.ts.map +1 -1
- package/lib/typescript/Center/Center.d.ts +13 -9
- package/lib/typescript/Center/Center.d.ts.map +1 -1
- package/lib/typescript/Checkbox/CheckIcon.d.ts +7 -3
- package/lib/typescript/Checkbox/CheckIcon.d.ts.map +1 -1
- package/lib/typescript/Checkbox/Checkbox.d.ts +79 -60
- package/lib/typescript/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/Chip/Chip.d.ts +140 -57
- package/lib/typescript/Chip/Chip.d.ts.map +1 -1
- package/lib/typescript/CloseButton/CloseButton.d.ts +85 -50
- package/lib/typescript/CloseButton/CloseButton.d.ts.map +1 -1
- package/lib/typescript/Code/Code.d.ts +31 -23
- package/lib/typescript/Code/Code.d.ts.map +1 -1
- package/lib/typescript/Collapse/Collapse.d.ts +44 -20
- package/lib/typescript/Collapse/Collapse.d.ts.map +1 -1
- package/lib/typescript/ColorInput/ColorInput.d.ts +15 -5
- package/lib/typescript/ColorInput/ColorInput.d.ts.map +1 -1
- package/lib/typescript/ColorPicker/ColorPicker.d.ts +72 -16
- package/lib/typescript/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/lib/typescript/ColorSwatch/ColorSwatch.d.ts +59 -38
- package/lib/typescript/ColorSwatch/ColorSwatch.d.ts.map +1 -1
- package/lib/typescript/Combobox/Combobox.d.ts +183 -100
- package/lib/typescript/Combobox/Combobox.d.ts.map +1 -1
- package/lib/typescript/Combobox/OptionsDropdown.d.ts +6 -0
- package/lib/typescript/Combobox/OptionsDropdown.d.ts.map +1 -1
- package/lib/typescript/Combobox/index.d.ts +66 -86
- package/lib/typescript/Combobox/index.d.ts.map +1 -1
- package/lib/typescript/Container/Container.d.ts +3 -41
- package/lib/typescript/Container/Container.d.ts.map +1 -1
- package/lib/typescript/Dialog/Dialog.d.ts +79 -76
- package/lib/typescript/Dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/Drawer/Drawer.d.ts +115 -40
- package/lib/typescript/Drawer/Drawer.d.ts.map +1 -1
- package/lib/typescript/Fieldset/Fieldset.d.ts +91 -46
- package/lib/typescript/Fieldset/Fieldset.d.ts.map +1 -1
- package/lib/typescript/FileButton/FileButton.d.ts.map +1 -1
- package/lib/typescript/FileInput/FileInput.d.ts +1 -1
- package/lib/typescript/FileInput/FileInput.d.ts.map +1 -1
- package/lib/typescript/Flex/Flex.d.ts +28 -26
- package/lib/typescript/Flex/Flex.d.ts.map +1 -1
- package/lib/typescript/FocusTrap/FocusTrap.d.ts.map +1 -1
- package/lib/typescript/Grid/Grid.d.ts +56 -48
- package/lib/typescript/Grid/Grid.d.ts.map +1 -1
- package/lib/typescript/Group/Group.d.ts +21 -16
- package/lib/typescript/Group/Group.d.ts.map +1 -1
- package/lib/typescript/Highlight/Highlight.d.ts +1 -15
- package/lib/typescript/Highlight/Highlight.d.ts.map +1 -1
- package/lib/typescript/HoverCard/HoverCard.d.ts +9 -9
- package/lib/typescript/HoverCard/HoverCard.d.ts.map +1 -1
- package/lib/typescript/Image/Image.d.ts +46 -114
- package/lib/typescript/Image/Image.d.ts.map +1 -1
- package/lib/typescript/Image/Image.native.d.ts +47 -115
- package/lib/typescript/Image/Image.native.d.ts.map +1 -1
- package/lib/typescript/Image/createImage.d.ts +49 -357
- package/lib/typescript/Image/createImage.d.ts.map +1 -1
- package/lib/typescript/Image/types.d.ts +4 -1
- package/lib/typescript/Image/types.d.ts.map +1 -1
- package/lib/typescript/Indicator/Indicator.d.ts +122 -43
- package/lib/typescript/Indicator/Indicator.d.ts.map +1 -1
- package/lib/typescript/Input/Input.d.ts +131 -328
- package/lib/typescript/Input/Input.d.ts.map +1 -1
- package/lib/typescript/Input/Input.native.d.ts +150 -472
- package/lib/typescript/Input/Input.native.d.ts.map +1 -1
- package/lib/typescript/Input/shared.d.ts +290 -490
- package/lib/typescript/Input/shared.d.ts.map +1 -1
- package/lib/typescript/Input/types.d.ts +14 -1
- package/lib/typescript/Input/types.d.ts.map +1 -1
- package/lib/typescript/InputBase/InputBase.d.ts +1 -52
- package/lib/typescript/InputBase/InputBase.d.ts.map +1 -1
- package/lib/typescript/Kbd/Kbd.d.ts +21 -65
- package/lib/typescript/Kbd/Kbd.d.ts.map +1 -1
- package/lib/typescript/KeyboardAvoidingView/KeyboardAvoidingView.d.ts +2 -6
- package/lib/typescript/KeyboardAvoidingView/KeyboardAvoidingView.d.ts.map +1 -1
- package/lib/typescript/KeyboardAvoidingView/KeyboardAvoidingView.native.d.ts +7 -3
- package/lib/typescript/KeyboardAvoidingView/KeyboardAvoidingView.native.d.ts.map +1 -1
- package/lib/typescript/KeyboardAwareScrollView/KeyboardAwareScrollView.d.ts +2 -6
- package/lib/typescript/KeyboardAwareScrollView/KeyboardAwareScrollView.d.ts.map +1 -1
- package/lib/typescript/KeyboardAwareScrollView/KeyboardAwareScrollView.native.d.ts +6 -2
- package/lib/typescript/KeyboardAwareScrollView/KeyboardAwareScrollView.native.d.ts.map +1 -1
- package/lib/typescript/List/List.d.ts +165 -63
- package/lib/typescript/List/List.d.ts.map +1 -1
- package/lib/typescript/Loader/Loader.d.ts +58 -28
- package/lib/typescript/Loader/Loader.d.ts.map +1 -1
- package/lib/typescript/LoadingOverlay/LoadingOverlay.d.ts +1 -9
- package/lib/typescript/LoadingOverlay/LoadingOverlay.d.ts.map +1 -1
- package/lib/typescript/Mark/Mark.d.ts +21 -65
- package/lib/typescript/Mark/Mark.d.ts.map +1 -1
- package/lib/typescript/Marquee/Marquee.d.ts +127 -44
- package/lib/typescript/Marquee/Marquee.d.ts.map +1 -1
- package/lib/typescript/MaskInput/MaskInput.d.ts +1 -51
- package/lib/typescript/MaskInput/MaskInput.d.ts.map +1 -1
- package/lib/typescript/Menu/Menu.d.ts +93 -105
- package/lib/typescript/Menu/Menu.d.ts.map +1 -1
- package/lib/typescript/Modal/Modal.d.ts +166 -91
- package/lib/typescript/Modal/Modal.d.ts.map +1 -1
- package/lib/typescript/Modal/drag/DragDismissHost.web.d.ts.map +1 -1
- package/lib/typescript/Modal/drag/DragDismissOverlay.web.d.ts.map +1 -1
- package/lib/typescript/Modal/drag/index.d.ts +2 -2
- package/lib/typescript/Modal/drag/index.d.ts.map +1 -1
- package/lib/typescript/Modal/drag/types.d.ts +14 -2
- package/lib/typescript/Modal/drag/types.d.ts.map +1 -1
- package/lib/typescript/Modal/modal-base-inner.d.ts +6 -2
- package/lib/typescript/Modal/modal-base-inner.d.ts.map +1 -1
- package/lib/typescript/Modal/modal-base-inner.native.d.ts +7 -3
- package/lib/typescript/Modal/modal-base-inner.native.d.ts.map +1 -1
- package/lib/typescript/Modal/modal-base.d.ts +2 -2
- package/lib/typescript/Modal/modal-base.d.ts.map +1 -1
- package/lib/typescript/MultiSelect/MultiSelect.d.ts +30 -50
- package/lib/typescript/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/lib/typescript/NativeSelect/NativeSelect.d.ts.map +1 -1
- package/lib/typescript/NativeSelect/NativeSelect.native.d.ts +1 -1
- package/lib/typescript/NativeSelect/NativeSelect.native.d.ts.map +1 -1
- package/lib/typescript/NavLink/NavLink.d.ts +245 -72
- package/lib/typescript/NavLink/NavLink.d.ts.map +1 -1
- package/lib/typescript/Notification/Notification.d.ts +230 -69
- package/lib/typescript/Notification/Notification.d.ts.map +1 -1
- package/lib/typescript/NumberFormatter/NumberFormatter.d.ts +24 -19
- package/lib/typescript/NumberFormatter/NumberFormatter.d.ts.map +1 -1
- package/lib/typescript/NumberInput/NumberInput.d.ts +91 -150
- package/lib/typescript/NumberInput/NumberInput.d.ts.map +1 -1
- package/lib/typescript/Overlay/Overlay.d.ts +17 -12
- package/lib/typescript/Overlay/Overlay.d.ts.map +1 -1
- package/lib/typescript/Pagination/Pagination.d.ts +43 -65
- package/lib/typescript/Pagination/Pagination.d.ts.map +1 -1
- package/lib/typescript/Paper/Paper.d.ts +19 -7
- package/lib/typescript/Paper/Paper.d.ts.map +1 -1
- package/lib/typescript/Paragraph/Paragraph.d.ts +23 -19
- package/lib/typescript/Paragraph/Paragraph.d.ts.map +1 -1
- package/lib/typescript/PasswordInput/PasswordInput.d.ts +110 -207
- package/lib/typescript/PasswordInput/PasswordInput.d.ts.map +1 -1
- package/lib/typescript/Pill/Pill.d.ts +133 -95
- package/lib/typescript/Pill/Pill.d.ts.map +1 -1
- package/lib/typescript/PillsInput/PillsInput.d.ts +2 -2
- package/lib/typescript/PillsInput/PillsInput.d.ts.map +1 -1
- package/lib/typescript/PinInput/PinInput.d.ts +148 -297
- package/lib/typescript/PinInput/PinInput.d.ts.map +1 -1
- package/lib/typescript/Popover/Popover.native.d.ts.map +1 -1
- package/lib/typescript/Popover/Popover.shared.d.ts +15 -11
- package/lib/typescript/Popover/Popover.shared.d.ts.map +1 -1
- package/lib/typescript/Progress/Progress.d.ts +114 -65
- package/lib/typescript/Progress/Progress.d.ts.map +1 -1
- package/lib/typescript/Radio/Radio.d.ts +69 -80
- package/lib/typescript/Radio/Radio.d.ts.map +1 -1
- package/lib/typescript/Radio/RadioIcon.d.ts +5 -0
- package/lib/typescript/Radio/RadioIcon.d.ts.map +1 -1
- package/lib/typescript/Rating/Rating.d.ts +94 -44
- package/lib/typescript/Rating/Rating.d.ts.map +1 -1
- package/lib/typescript/RollingNumber/RollingNumber.d.ts +112 -32
- package/lib/typescript/RollingNumber/RollingNumber.d.ts.map +1 -1
- package/lib/typescript/ScrollArea/ScrollArea.d.ts +50 -10
- package/lib/typescript/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/lib/typescript/ScrollArea/ScrollArea.native.d.ts +40 -8
- package/lib/typescript/ScrollArea/ScrollArea.native.d.ts.map +1 -1
- package/lib/typescript/ScrollArea/ScrollArea.shared.d.ts +2 -2
- package/lib/typescript/SegmentedControl/SegmentedControl.d.ts +148 -56
- package/lib/typescript/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/lib/typescript/Select/Select.d.ts +31 -51
- package/lib/typescript/Select/Select.d.ts.map +1 -1
- package/lib/typescript/Separator/Separator.d.ts +124 -61
- package/lib/typescript/Separator/Separator.d.ts.map +1 -1
- package/lib/typescript/SimpleGrid/SimpleGrid.d.ts +15 -13
- package/lib/typescript/SimpleGrid/SimpleGrid.d.ts.map +1 -1
- package/lib/typescript/Skeleton/Skeleton.d.ts +18 -14
- package/lib/typescript/Skeleton/Skeleton.d.ts.map +1 -1
- package/lib/typescript/Slider/Slider.d.ts +425 -129
- package/lib/typescript/Slider/Slider.d.ts.map +1 -1
- package/lib/typescript/Spacer/Spacer.d.ts +10 -17
- package/lib/typescript/Spacer/Spacer.d.ts.map +1 -1
- package/lib/typescript/Spoiler/Spoiler.d.ts +88 -28
- package/lib/typescript/Spoiler/Spoiler.d.ts.map +1 -1
- package/lib/typescript/Stack/Stack.d.ts +17 -5
- package/lib/typescript/Stack/Stack.d.ts.map +1 -1
- package/lib/typescript/Stepper/Stepper.d.ts +433 -101
- package/lib/typescript/Stepper/Stepper.d.ts.map +1 -1
- package/lib/typescript/Switch/Switch.d.ts +157 -69
- package/lib/typescript/Switch/Switch.d.ts.map +1 -1
- package/lib/typescript/Table/Table.d.ts +151 -201
- package/lib/typescript/Table/Table.d.ts.map +1 -1
- package/lib/typescript/TableOfContents/TableOfContents.d.ts +116 -46
- package/lib/typescript/TableOfContents/TableOfContents.d.ts.map +1 -1
- package/lib/typescript/Tabs/Tabs.d.ts +138 -88
- package/lib/typescript/Tabs/Tabs.d.ts.map +1 -1
- package/lib/typescript/TagsInput/TagsInput.d.ts +30 -42
- package/lib/typescript/TagsInput/TagsInput.d.ts.map +1 -1
- package/lib/typescript/Text/Text.d.ts +22 -4
- package/lib/typescript/Text/Text.d.ts.map +1 -1
- package/lib/typescript/TextInput/TextInput.d.ts +1 -51
- package/lib/typescript/TextInput/TextInput.d.ts.map +1 -1
- package/lib/typescript/Textarea/Textarea.d.ts +1 -51
- package/lib/typescript/Textarea/Textarea.d.ts.map +1 -1
- package/lib/typescript/ThemeIcon/ThemeIcon.d.ts +52 -39
- package/lib/typescript/ThemeIcon/ThemeIcon.d.ts.map +1 -1
- package/lib/typescript/Title/Title.d.ts +40 -25
- package/lib/typescript/Title/Title.d.ts.map +1 -1
- package/lib/typescript/Tooltip/Tooltip.d.ts +97 -41
- package/lib/typescript/Tooltip/Tooltip.d.ts.map +1 -1
- package/lib/typescript/Transition/Transition.native.d.ts.map +1 -1
- package/lib/typescript/Transition/use-overlay-transition.d.ts +1 -2
- package/lib/typescript/Transition/use-overlay-transition.d.ts.map +1 -1
- package/lib/typescript/Transition/use-overlay-transition.native.d.ts +3 -4
- package/lib/typescript/Transition/use-overlay-transition.native.d.ts.map +1 -1
- package/lib/typescript/Tree/Tree.d.ts +180 -50
- package/lib/typescript/Tree/Tree.d.ts.map +1 -1
- package/lib/typescript/TreeSelect/TreeSelect.d.ts +141 -182
- package/lib/typescript/TreeSelect/TreeSelect.d.ts.map +1 -1
- package/lib/typescript/Typography/Typography.d.ts +13 -7
- package/lib/typescript/Typography/Typography.d.ts.map +1 -1
- package/lib/typescript/UnstyledButton/UnstyledButton.d.ts +27 -20
- package/lib/typescript/UnstyledButton/UnstyledButton.d.ts.map +1 -1
- package/lib/typescript/VirtualList/VirtualList.d.ts.map +1 -1
- package/lib/typescript/VirtualList/VirtualList.shared.d.ts +1 -1
- package/lib/typescript/VirtualList/VirtualList.shared.d.ts.map +1 -1
- package/lib/typescript/VisuallyHidden/VisuallyHidden.d.ts +23 -19
- package/lib/typescript/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
- package/lib/typescript/control-system.d.ts +3 -0
- package/lib/typescript/control-system.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/internal/InlineControl.d.ts +80 -22
- package/lib/typescript/internal/InlineControl.d.ts.map +1 -1
- package/lib/typescript/internal/collapse-box.d.ts +3 -3
- package/lib/typescript/internal/collapse-box.d.ts.map +1 -1
- package/lib/typescript/internal/collapse-box.shared.d.ts +1 -1
- package/lib/typescript/internal/control-icon-size.d.ts +4 -3
- package/lib/typescript/internal/control-icon-size.d.ts.map +1 -1
- package/lib/typescript/internal/control-metrics.d.ts +50 -50
- package/lib/typescript/internal/floating-arrow.d.ts +6 -7
- package/lib/typescript/internal/floating-arrow.d.ts.map +1 -1
- package/lib/typescript/internal/focus-ring.d.ts +94 -0
- package/lib/typescript/internal/focus-ring.d.ts.map +1 -0
- package/lib/typescript/internal/gradient-shared.d.ts +8 -8
- package/lib/typescript/internal/gradient-shared.d.ts.map +1 -1
- package/lib/typescript/internal/motion.d.ts +77 -67
- package/lib/typescript/internal/motion.d.ts.map +1 -1
- package/lib/typescript/internal/resolve-theme-color.d.ts +9 -8
- package/lib/typescript/internal/resolve-theme-color.d.ts.map +1 -1
- package/lib/typescript/internal/style-props.d.ts +490 -664
- package/lib/typescript/internal/style-props.d.ts.map +1 -1
- package/lib/typescript/internal/theme-color-web.d.ts.map +1 -1
- package/lib/typescript/internal/use-icon-color.d.ts +1 -1
- package/lib/typescript/internal/use-icon-color.native.d.ts +1 -1
- package/lib/typescript/internal/use-looping-animation.d.ts +10 -2
- package/lib/typescript/internal/use-looping-animation.d.ts.map +1 -1
- package/lib/typescript/internal/variant-colors.d.ts +191 -199
- package/lib/typescript/internal/variant-colors.d.ts.map +1 -1
- package/package.json +7 -6
- package/src/Accordion/Accordion.tsx +55 -47
- package/src/ActionIcon/ActionIcon.tsx +114 -57
- package/src/Affix/Affix.tsx +14 -25
- package/src/Alert/Alert.tsx +55 -42
- package/src/Anchor/Anchor.tsx +13 -12
- package/src/AngleSlider/AngleSlider.tsx +87 -63
- package/src/AspectRatio/AspectRatio.tsx +9 -12
- package/src/Autocomplete/Autocomplete.tsx +7 -2
- package/src/Avatar/Avatar.tsx +42 -34
- package/src/BackgroundImage/BackgroundImage.tsx +9 -6
- package/src/Badge/Badge.tsx +53 -28
- package/src/Blockquote/Blockquote.tsx +55 -45
- package/src/Box/Box.tsx +2 -2
- package/src/Breadcrumbs/Breadcrumbs.tsx +13 -11
- package/src/Burger/Burger.tsx +33 -24
- package/src/Button/Button.tsx +104 -78
- package/src/Card/Card.tsx +52 -44
- package/src/Center/Center.tsx +3 -3
- package/src/Checkbox/CheckIcon.tsx +8 -5
- package/src/Checkbox/Checkbox.tsx +97 -62
- package/src/Chip/Chip.tsx +50 -45
- package/src/CloseButton/CloseButton.tsx +30 -11
- package/src/Code/Code.tsx +15 -11
- package/src/Collapse/Collapse.tsx +11 -6
- package/src/ColorInput/ColorInput.tsx +30 -24
- package/src/ColorPicker/ColorPicker.tsx +78 -79
- package/src/ColorSwatch/ColorSwatch.tsx +11 -14
- package/src/Combobox/Combobox.tsx +174 -153
- package/src/Combobox/OptionsDropdown.tsx +15 -2
- package/src/Combobox/index.ts +1 -0
- package/src/Container/Container.tsx +11 -15
- package/src/Dialog/Dialog.tsx +26 -16
- package/src/Drawer/Drawer.tsx +51 -33
- package/src/Fieldset/Fieldset.tsx +25 -17
- package/src/FileButton/FileButton.tsx +4 -1
- package/src/Flex/Flex.tsx +24 -21
- package/src/FocusTrap/FocusTrap.tsx +4 -3
- package/src/Grid/Grid.tsx +24 -27
- package/src/Group/Group.tsx +4 -4
- package/src/Highlight/Highlight.tsx +2 -2
- package/src/HoverCard/HoverCard.tsx +17 -32
- package/src/Image/Image.native.tsx +1 -1
- package/src/Image/createImage.tsx +96 -63
- package/src/Image/types.ts +5 -1
- package/src/Indicator/Indicator.tsx +41 -32
- package/src/Input/Input.native.tsx +521 -501
- package/src/Input/Input.tsx +110 -156
- package/src/Input/shared.tsx +198 -291
- package/src/Input/types.ts +15 -0
- package/src/InputBase/InputBase.tsx +3 -1
- package/src/Kbd/Kbd.tsx +13 -15
- package/src/KeyboardAvoidingView/KeyboardAvoidingView.native.tsx +2 -2
- package/src/KeyboardAwareScrollView/KeyboardAwareScrollView.native.tsx +1 -1
- package/src/List/List.tsx +17 -11
- package/src/Loader/Loader.tsx +33 -37
- package/src/LoadingOverlay/LoadingOverlay.tsx +3 -2
- package/src/Mark/Mark.tsx +12 -12
- package/src/Marquee/Marquee.tsx +58 -46
- package/src/MaskInput/MaskInput.tsx +2 -1
- package/src/Menu/Menu.tsx +110 -45
- package/src/Modal/Modal.tsx +38 -31
- package/src/Modal/drag/DragDismissHost.web.tsx +2 -1
- package/src/Modal/drag/DragDismissOverlay.web.tsx +6 -1
- package/src/Modal/drag/index.ts +7 -2
- package/src/Modal/drag/types.ts +15 -3
- package/src/Modal/modal-base-inner.native.tsx +3 -2
- package/src/Modal/modal-base-inner.tsx +1 -1
- package/src/Modal/modal-base.tsx +10 -8
- package/src/MultiSelect/MultiSelect.tsx +6 -1
- package/src/NativeSelect/NativeSelect.tsx +21 -32
- package/src/NavLink/NavLink.tsx +54 -47
- package/src/Notification/Notification.tsx +31 -30
- package/src/NumberFormatter/NumberFormatter.tsx +4 -3
- package/src/NumberInput/NumberInput.tsx +52 -42
- package/src/Overlay/Overlay.tsx +18 -14
- package/src/Pagination/Pagination.tsx +142 -123
- package/src/Paper/Paper.tsx +8 -9
- package/src/Paragraph/Paragraph.tsx +7 -7
- package/src/PasswordInput/PasswordInput.tsx +67 -67
- package/src/Pill/Pill.tsx +42 -30
- package/src/PillsInput/PillsInput.tsx +60 -31
- package/src/PinInput/PinInput.tsx +31 -23
- package/src/Popover/Popover.native.tsx +3 -4
- package/src/Popover/Popover.shared.tsx +29 -24
- package/src/Progress/Progress.tsx +77 -64
- package/src/Radio/Radio.tsx +128 -122
- package/src/Radio/RadioIcon.tsx +4 -10
- package/src/Rating/Rating.tsx +63 -42
- package/src/RollingNumber/RollingNumber.tsx +60 -28
- package/src/ScrollArea/ScrollArea.native.tsx +28 -27
- package/src/ScrollArea/ScrollArea.shared.ts +2 -2
- package/src/ScrollArea/ScrollArea.tsx +35 -33
- package/src/SegmentedControl/SegmentedControl.tsx +98 -53
- package/src/Select/Select.tsx +7 -2
- package/src/Separator/Separator.tsx +43 -36
- package/src/SimpleGrid/SimpleGrid.tsx +23 -24
- package/src/Skeleton/Skeleton.tsx +35 -16
- package/src/Slider/Slider.tsx +303 -227
- package/src/Spacer/Spacer.tsx +17 -41
- package/src/Spoiler/Spoiler.tsx +19 -13
- package/src/Stack/Stack.tsx +3 -3
- package/src/Stepper/Stepper.tsx +89 -73
- package/src/Switch/Switch.tsx +87 -73
- package/src/Table/Table.tsx +100 -77
- package/src/TableOfContents/TableOfContents.tsx +80 -74
- package/src/Tabs/Tabs.tsx +78 -66
- package/src/TagsInput/TagsInput.tsx +35 -4
- package/src/Text/Text.tsx +25 -10
- package/src/TextInput/TextInput.tsx +3 -1
- package/src/Textarea/Textarea.tsx +2 -2
- package/src/ThemeIcon/ThemeIcon.tsx +37 -22
- package/src/Title/Title.tsx +48 -23
- package/src/Tooltip/Tooltip.tsx +50 -29
- package/src/Transition/Transition.native.tsx +16 -19
- package/src/Transition/use-overlay-transition.native.ts +6 -12
- package/src/Transition/use-overlay-transition.ts +2 -2
- package/src/Tree/Tree.tsx +39 -44
- package/src/TreeSelect/TreeSelect.tsx +49 -24
- package/src/Typography/Typography.tsx +5 -7
- package/src/UnstyledButton/UnstyledButton.tsx +6 -5
- package/src/VirtualList/VirtualList.shared.ts +1 -1
- package/src/VirtualList/VirtualList.tsx +18 -6
- package/src/VisuallyHidden/VisuallyHidden.tsx +7 -9
- package/src/control-system.ts +5 -0
- package/src/index.ts +30 -12
- package/src/internal/ControlIconProvider.tsx +1 -1
- package/src/internal/InlineControl.tsx +23 -27
- package/src/internal/collapse-box.shared.ts +1 -1
- package/src/internal/collapse-box.tsx +15 -11
- package/src/internal/control-icon-size.ts +5 -8
- package/src/internal/control-metrics.ts +52 -52
- package/src/internal/floating-arrow.tsx +48 -40
- package/src/internal/focus-ring.ts +92 -0
- package/src/internal/gradient-shared.ts +10 -10
- package/src/internal/gradient.native.tsx +1 -1
- package/src/internal/motion.ts +204 -244
- package/src/internal/resolve-theme-color.ts +10 -10
- package/src/internal/style-props.ts +545 -390
- package/src/internal/theme-color-web.ts +47 -27
- package/src/internal/use-icon-color.native.ts +1 -1
- package/src/internal/use-icon-color.ts +1 -1
- package/src/internal/use-slot-text-wrapper.tsx +1 -1
- package/src/internal/variant-colors.ts +187 -151
|
@@ -1,20 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* Shared variant helpers that map Mantine's NAMED props onto Tamagui style props
|
|
3
|
+
* — the kit's v3 variant vocabulary (docs/v3/conventions.md §5, "Internal helpers").
|
|
4
|
+
*
|
|
5
|
+
* Two shapes, picked by what the prop accepts:
|
|
6
|
+
*
|
|
7
|
+
* - **Static exact-key maps** (`controlVariant`, `controlFontVariant`,
|
|
8
|
+
* `squareSizeVariant`, `fontSizeVariant`, `shadowVariant`, the colour ladders):
|
|
9
|
+
* plain literal objects generated from `controlMetrics` / `variant-colors`.
|
|
10
|
+
* Compiler-extractable, and they still work per clause (`size="sm md:lg"`).
|
|
11
|
+
* Spread them at MODULE scope only (`{ ...controlVariant.md, gap: "xs" }`).
|
|
12
|
+
* - **`styled.dynamic` variants** for an OPEN domain — a size key OR a raw
|
|
13
|
+
* number / CSS value (`radiusVariant`, `squareSizeVariantFallthrough`,
|
|
14
|
+
* `fontSizePassthroughVariant`, …). v3 runs a dynamic once per clause payload,
|
|
15
|
+
* so `radius="sm md:lg"` works. Use them AS the variant (`radius: radiusVariant`),
|
|
16
|
+
* NEVER spread them: spreading a dynamic copies only its brand symbol and turns
|
|
17
|
+
* the variant into a style-less "bare" dynamic. To extend a table with extra
|
|
18
|
+
* keys, build a new one with {@link tableVariant}.
|
|
19
|
+
*
|
|
20
|
+
* v2's `":string"` / `":number"` / `"...size"` catch-all keys are gone (v3 treats
|
|
21
|
+
* them as literal keys that never match), and so are the `$`-sigil helpers
|
|
22
|
+
* (`toRadius` & co.): a string is a token lookup, a number a raw value.
|
|
7
23
|
*/
|
|
8
|
-
import { type FontSizeTokens, isWeb, type RadiusTokens } from "@knitui/core";
|
|
9
|
-
|
|
10
|
-
import type { BoxProps } from "../Box";
|
|
11
|
-
import type { TextProps } from "../Text";
|
|
12
|
-
import { controlMetrics as M } from "./control-metrics";
|
|
13
24
|
import {
|
|
25
|
+
type MotionPresetName as DriverPresetName,
|
|
26
|
+
type FontSizeTokens,
|
|
27
|
+
isWeb,
|
|
28
|
+
MOTION_PRESETS,
|
|
29
|
+
type RadiusTokens,
|
|
30
|
+
type SizeTokens,
|
|
31
|
+
type SpaceTokens,
|
|
32
|
+
styled,
|
|
33
|
+
} from "@knitui/core";
|
|
34
|
+
|
|
35
|
+
import { controlMetrics as M, type SizeKey } from "./control-metrics";
|
|
36
|
+
import {
|
|
37
|
+
VARIANT_CONTROL,
|
|
14
38
|
VARIANT_FILL,
|
|
15
39
|
VARIANT_FOREGROUND_EMPHASIS,
|
|
16
40
|
VARIANT_FOREGROUND_MUTED,
|
|
17
|
-
VARIANT_INTERACTION,
|
|
18
41
|
type VariantKey,
|
|
19
42
|
} from "./variant-colors";
|
|
20
43
|
|
|
@@ -25,9 +48,10 @@ import {
|
|
|
25
48
|
* `DEFAULT_SIZE` live in `control-metrics.ts` next to the table they describe.
|
|
26
49
|
*/
|
|
27
50
|
export { DEFAULT_SIZE, type SizeKey } from "./control-metrics";
|
|
51
|
+
export { FOCUS_RING, FOCUS_WITHIN_RING, focusRingResetStyle, focusRingStyle } from "./focus-ring";
|
|
28
52
|
export {
|
|
29
|
-
|
|
30
|
-
|
|
53
|
+
VARIANT_COLOR_LADDER,
|
|
54
|
+
VARIANT_CONTROL,
|
|
31
55
|
VARIANT_FILL,
|
|
32
56
|
VARIANT_FOREGROUND_EMPHASIS,
|
|
33
57
|
VARIANT_FOREGROUND_MUTED,
|
|
@@ -36,81 +60,184 @@ export {
|
|
|
36
60
|
type VariantKey,
|
|
37
61
|
} from "./variant-colors";
|
|
38
62
|
|
|
39
|
-
|
|
63
|
+
/* -------------------------------------------------------------------------- */
|
|
64
|
+
/* Dynamic-variant infrastructure */
|
|
65
|
+
/* -------------------------------------------------------------------------- */
|
|
66
|
+
|
|
67
|
+
/** A style fragment a variant emits (style props, token names, clause strings). */
|
|
68
|
+
export type StyleFragment = Record<string, unknown>;
|
|
40
69
|
|
|
41
|
-
/** `"
|
|
42
|
-
|
|
70
|
+
/** An open-ended CSS string (`"10px"`, `"50%"`) that keeps literal autocomplete. */
|
|
71
|
+
export type CssString = string & {};
|
|
43
72
|
|
|
44
73
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
74
|
+
* A v3 `styled.dynamic` variant accepting `V` — the type every open-domain helper
|
|
75
|
+
* below returns. `GetProps` of the frame widens it to `FlatStyleValue<V>`, so the
|
|
76
|
+
* prop also takes clause programs (`"sm md:lg"`).
|
|
77
|
+
*
|
|
78
|
+
* The brand intersection is load-bearing for the lib build: v3 does not export its
|
|
79
|
+
* `StyledDynamicFn` interface, so a bare `ReturnType<…>` resolves to a type the
|
|
80
|
+
* declaration emitter cannot name (TS2883). An intersection keeps THIS alias as the
|
|
81
|
+
* printed name, so every exported variant emits as `DynamicVariant<…>`.
|
|
47
82
|
*/
|
|
48
|
-
export
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
83
|
+
export type DynamicVariant<V> = ReturnType<typeof styled.dynamic<V>> & {
|
|
84
|
+
readonly __knituiDynamic?: true;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const makeDynamic = <V>(fn: (value: V) => StyleFragment | null | undefined): DynamicVariant<V> =>
|
|
88
|
+
styled.dynamic<V>(fn);
|
|
89
|
+
|
|
90
|
+
/** Output cache cap per dynamic: open domains (arbitrary px) must not grow forever. */
|
|
91
|
+
const CACHE_LIMIT = 256;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Memoise a value → fragment mapping per primitive value, so a re-render with the
|
|
95
|
+
* same prop hands Tamagui the SAME fragment object (no per-render allocation, and
|
|
96
|
+
* Tamagui's own identity caches hit). Bounded by {@link CACHE_LIMIT}.
|
|
97
|
+
*/
|
|
98
|
+
const memoFragment = <V>(build: (value: V) => StyleFragment | undefined) => {
|
|
99
|
+
const cache = new Map<unknown, StyleFragment | undefined>();
|
|
100
|
+
return (value: V): StyleFragment | undefined => {
|
|
101
|
+
const primitive = typeof value === "string" || typeof value === "number";
|
|
102
|
+
if (primitive) {
|
|
103
|
+
const hit = cache.get(value);
|
|
104
|
+
if (hit !== undefined || cache.has(value)) return hit;
|
|
105
|
+
}
|
|
106
|
+
const out = build(value);
|
|
107
|
+
if (primitive) {
|
|
108
|
+
if (cache.size >= CACHE_LIMIT) cache.clear();
|
|
109
|
+
cache.set(value, out);
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* A `styled.dynamic` variant that maps one value straight onto one or more style
|
|
117
|
+
* props (`passthroughVariant<RadiusValue>("borderRadius")` →
|
|
118
|
+
* `radius="md"` ⇒ `{ borderRadius: "md" }`, `radius={6}` ⇒ `{ borderRadius: 6 }`).
|
|
119
|
+
* Token names resolve per property at the style layer; numbers are px.
|
|
120
|
+
*/
|
|
121
|
+
export function passthroughVariant<V>(...props: readonly [string, ...string[]]): DynamicVariant<V> {
|
|
122
|
+
const fragment = memoFragment<V>((value) => {
|
|
123
|
+
const out: StyleFragment = {};
|
|
124
|
+
for (const prop of props) out[prop] = value;
|
|
125
|
+
return out;
|
|
126
|
+
});
|
|
127
|
+
return makeDynamic<V>(fragment);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Build a `styled.dynamic` variant from a STATIC key table plus an optional
|
|
132
|
+
* fallthrough for any other value — the v3 replacement for v2's
|
|
133
|
+
* `{ xs: {...}, md: {...}, ":number": fn, ":string": fn }` maps. A table hit
|
|
134
|
+
* returns the table's own (static, shared) fragment; anything else goes to
|
|
135
|
+
* `fallback` (memoised per value). Runs per clause, so `size="sm md:lg"` works.
|
|
136
|
+
*
|
|
137
|
+
* ```ts
|
|
138
|
+
* size: tableVariant(
|
|
139
|
+
* { ...fontSizeVariant, h1: { fontSize: "xxl" } },
|
|
140
|
+
* (value: number | CssString) => ({ fontSize: value }),
|
|
141
|
+
* )
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
export function tableVariant<const Table extends Record<string, StyleFragment>>(
|
|
145
|
+
table: Table,
|
|
146
|
+
): DynamicVariant<Extract<keyof Table, string>>;
|
|
147
|
+
export function tableVariant<const Table extends Record<string, StyleFragment>, Extra>(
|
|
148
|
+
table: Table,
|
|
149
|
+
fallback: (value: Extra) => StyleFragment | undefined,
|
|
150
|
+
): DynamicVariant<Extract<keyof Table, string> | Extra>;
|
|
151
|
+
export function tableVariant(
|
|
152
|
+
table: Record<string, StyleFragment>,
|
|
153
|
+
fallback?: (value: unknown) => StyleFragment | undefined,
|
|
154
|
+
): DynamicVariant<unknown> {
|
|
155
|
+
const fall = fallback ? memoFragment(fallback) : undefined;
|
|
156
|
+
return makeDynamic<unknown>((value) => {
|
|
157
|
+
if (typeof value === "string" && Object.prototype.hasOwnProperty.call(table, value)) {
|
|
158
|
+
return table[value];
|
|
159
|
+
}
|
|
160
|
+
return fall?.(value);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/* -------------------------------------------------------------------------- */
|
|
165
|
+
/* Shape / layout variants */
|
|
166
|
+
/* -------------------------------------------------------------------------- */
|
|
167
|
+
|
|
168
|
+
/** What a `radius` prop accepts: a radius token, a number (px), or a CSS length. */
|
|
169
|
+
export type RadiusValue = SizeKey | RadiusTokens | number | CssString;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Mantine-style `radius` prop. Accepts a size key (`"md"`, a radius token), a
|
|
173
|
+
* number (px), or an arbitrary CSS value (`"10px"`). Use as the variant
|
|
174
|
+
* (`radius: radiusVariant`), never spread it.
|
|
175
|
+
*/
|
|
176
|
+
export const radiusVariant = passthroughVariant<RadiusValue>("borderRadius");
|
|
52
177
|
|
|
53
178
|
/**
|
|
54
179
|
* Like `radiusVariant`, but rounds only the two INLINE-END corners (top-right +
|
|
55
180
|
* bottom-right). Used where one edge carries a solid border that should stay
|
|
56
181
|
* square — e.g. `Blockquote`'s start border.
|
|
57
182
|
*/
|
|
58
|
-
export const endRadiusVariant =
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
183
|
+
export const endRadiusVariant = passthroughVariant<RadiusValue>(
|
|
184
|
+
"borderTopRightRadius",
|
|
185
|
+
"borderBottomRightRadius",
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
/** Flexbox cross-axis alignment values. */
|
|
189
|
+
export type AlignValue =
|
|
190
|
+
"flex-start" | "flex-end" | "center" | "stretch" | "baseline" | "start" | "end" | CssString;
|
|
191
|
+
|
|
192
|
+
/** Flexbox main-axis distribution values. */
|
|
193
|
+
export type JustifyValue =
|
|
194
|
+
| "flex-start"
|
|
195
|
+
| "flex-end"
|
|
196
|
+
| "center"
|
|
197
|
+
| "space-between"
|
|
198
|
+
| "space-around"
|
|
199
|
+
| "space-evenly"
|
|
200
|
+
| "start"
|
|
201
|
+
| "end"
|
|
202
|
+
| CssString;
|
|
68
203
|
|
|
69
204
|
/** Map a flexbox alignment prop name onto its Tamagui style prop. */
|
|
70
|
-
export const alignVariant =
|
|
71
|
-
":string": (val: string) => ({ alignItems: val as BoxProps["alignItems"] }),
|
|
72
|
-
} as const;
|
|
205
|
+
export const alignVariant = passthroughVariant<AlignValue>("alignItems");
|
|
73
206
|
|
|
74
|
-
export const justifyVariant =
|
|
75
|
-
":string": (val: string) => ({ justifyContent: val as BoxProps["justifyContent"] }),
|
|
76
|
-
} as const;
|
|
207
|
+
export const justifyVariant = passthroughVariant<JustifyValue>("justifyContent");
|
|
77
208
|
|
|
78
|
-
export const wrapVariant =
|
|
79
|
-
":string": (val: string) => ({ flexWrap: val as BoxProps["flexWrap"] }),
|
|
80
|
-
} as const;
|
|
209
|
+
export const wrapVariant = passthroughVariant<"wrap" | "nowrap" | "wrap-reverse">("flexWrap");
|
|
81
210
|
|
|
82
211
|
/**
|
|
83
|
-
* Mantine-style `spacing`/`gap` prop. A space token (`"
|
|
84
|
-
* value, or number maps onto `gap`. Used by `List`'s `spacing`.
|
|
212
|
+
* Mantine-style `spacing`/`gap` prop. A space token (`"sm"`), arbitrary CSS
|
|
213
|
+
* value, or number maps onto `gap`. Used by `List`'s `spacing`, `PinInput`'s `gap`.
|
|
85
214
|
*/
|
|
86
|
-
export const gapVariant =
|
|
87
|
-
":number": (val: number) => ({ gap: val }),
|
|
88
|
-
":string": (val: string) => ({ gap: val as BoxProps["gap"] }),
|
|
89
|
-
} as const;
|
|
215
|
+
export const gapVariant = passthroughVariant<SizeKey | SpaceTokens | number | CssString>("gap");
|
|
90
216
|
|
|
91
217
|
/** Open-ended `overflow` prop (`"hidden"`, `"scroll"`, …). Used by `Grid`. */
|
|
92
|
-
export const overflowVariant =
|
|
93
|
-
"
|
|
94
|
-
|
|
218
|
+
export const overflowVariant = passthroughVariant<"visible" | "hidden" | "scroll" | CssString>(
|
|
219
|
+
"overflow",
|
|
220
|
+
);
|
|
95
221
|
|
|
96
222
|
/**
|
|
97
|
-
* Mantine-style `maxWidth
|
|
98
|
-
*
|
|
223
|
+
* Mantine-style `maxWidth` cap. A number is a raw pixel width; a string is a
|
|
224
|
+
* token or arbitrary CSS value.
|
|
99
225
|
*/
|
|
100
|
-
export const maxWidthVariant =
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
226
|
+
export const maxWidthVariant = passthroughVariant<SizeTokens | number | CssString>("maxWidth");
|
|
227
|
+
|
|
228
|
+
/** A raw width / height escape hatch: px number or CSS length. */
|
|
229
|
+
type Length = number | CssString;
|
|
230
|
+
|
|
231
|
+
const maxWidthOf = (value: Length): StyleFragment => ({ maxWidth: value });
|
|
232
|
+
const widthOf = (value: Length): StyleFragment => ({ width: value });
|
|
233
|
+
const heightOf = (value: Length): StyleFragment => ({ height: value });
|
|
104
234
|
|
|
105
235
|
/**
|
|
106
|
-
* Named content-width scale for overlay panels (`Modal`, etc.)
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* only, so named keys silently fall through to an invalid `maxWidth: "md"`) and
|
|
110
|
-
* UNLIKE `Container`'s viewport-`breakpoints` caps, these are dialog-scale widths
|
|
111
|
-
* tuned after Mantine's modal sizes (xs 320 → xl 780).
|
|
236
|
+
* Named content-width scale for overlay panels (`Modal`, etc.): dialog-scale
|
|
237
|
+
* `maxWidth`s tuned after Mantine's modal sizes (xs 320 → xl 780). Any other
|
|
238
|
+
* number / CSS value passes through as the `maxWidth`.
|
|
112
239
|
*/
|
|
113
|
-
export const
|
|
240
|
+
export const MODAL_SIZES = {
|
|
114
241
|
xxs: { maxWidth: 240 },
|
|
115
242
|
xs: { maxWidth: 320 },
|
|
116
243
|
sm: { maxWidth: 380 },
|
|
@@ -118,20 +245,16 @@ export const modalSizeVariant = {
|
|
|
118
245
|
lg: { maxWidth: 620 },
|
|
119
246
|
xl: { maxWidth: 780 },
|
|
120
247
|
xxl: { maxWidth: 1040 },
|
|
121
|
-
":number": (val: number) => ({ maxWidth: val }),
|
|
122
|
-
":string": (val: string) => ({ maxWidth: val as BoxProps["maxWidth"] }),
|
|
123
248
|
} as const;
|
|
124
249
|
|
|
250
|
+
export const modalSizeVariant = tableVariant(MODAL_SIZES, maxWidthOf);
|
|
251
|
+
|
|
125
252
|
/**
|
|
126
|
-
* Named content-width scale for `Container
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* only — named keys would silently fall through to an invalid `maxWidth: "md"`),
|
|
130
|
-
* and UNLIKE `modalSizeVariant` (dialog-card scale), these are page-column
|
|
131
|
-
* widths tuned after Mantine's container sizes (xs 540 → xl 1320), extended to
|
|
132
|
-
* the kit's full seven-step scale.
|
|
253
|
+
* Named content-width scale for `Container`: page-column `maxWidth`s tuned after
|
|
254
|
+
* Mantine's container sizes (xs 540 → xl 1320), on the kit's seven-step scale.
|
|
255
|
+
* Any other number / CSS value passes through as the `maxWidth`.
|
|
133
256
|
*/
|
|
134
|
-
export const
|
|
257
|
+
export const CONTAINER_SIZES = {
|
|
135
258
|
xxs: { maxWidth: 420 },
|
|
136
259
|
xs: { maxWidth: 540 },
|
|
137
260
|
sm: { maxWidth: 720 },
|
|
@@ -139,21 +262,16 @@ export const containerSizeVariant = {
|
|
|
139
262
|
lg: { maxWidth: 1140 },
|
|
140
263
|
xl: { maxWidth: 1320 },
|
|
141
264
|
xxl: { maxWidth: 1608 },
|
|
142
|
-
":number": (val: number) => ({ maxWidth: val }),
|
|
143
|
-
":string": (val: string) => ({ maxWidth: val as BoxProps["maxWidth"] }),
|
|
144
265
|
} as const;
|
|
145
266
|
|
|
267
|
+
export const containerSizeVariant = tableVariant(CONTAINER_SIZES, maxWidthOf);
|
|
268
|
+
|
|
146
269
|
/**
|
|
147
|
-
* Square `size`
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* ```ts
|
|
153
|
-
* size: { xs: { width: "$xs", height: "$xs" }, …, ...squareSizeVariant }
|
|
154
|
-
* ```
|
|
155
|
-
*
|
|
156
|
-
* Used by `ActionIcon`, `AngleSlider`, `Avatar`, and `ColorSwatch`.
|
|
270
|
+
* Square `size` ladder — maps a size key onto BOTH `width` and `height` (+
|
|
271
|
+
* `minWidth`) from the canonical control heights. A static exact-key map; use
|
|
272
|
+
* {@link squareSizeVariantFallthrough} when the prop also takes a number / CSS
|
|
273
|
+
* value. Used by `Radio`, `Stepper` (spread into their own size map) and read as
|
|
274
|
+
* data by `PinInput` / `ColorPicker`.
|
|
157
275
|
*/
|
|
158
276
|
export const squareSizeVariant = {
|
|
159
277
|
xxs: { minWidth: M.xxs.height, width: M.xxs.height, height: M.xxs.height },
|
|
@@ -165,76 +283,55 @@ export const squareSizeVariant = {
|
|
|
165
283
|
xxl: { minWidth: M.xxl.height, width: M.xxl.height, height: M.xxl.height },
|
|
166
284
|
} as const;
|
|
167
285
|
|
|
286
|
+
/**
|
|
287
|
+
* The square fallthrough body — a raw px / CSS size onto `minWidth` + `width` +
|
|
288
|
+
* `height`. Exported for frames that build their own {@link tableVariant} on top
|
|
289
|
+
* of it (Pagination).
|
|
290
|
+
*/
|
|
291
|
+
export const squareSizeOf = (value: Length): StyleFragment => ({
|
|
292
|
+
minWidth: value,
|
|
293
|
+
width: value,
|
|
294
|
+
height: value,
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* {@link squareSizeVariant} plus the raw escape hatch: `size={44}` / `size="3rem"`
|
|
299
|
+
* size the square directly. Used by `ActionIcon`-likes, `Avatar`, `ColorSwatch`,
|
|
300
|
+
* `Loader`, `Burger`, `Rating`, `AngleSlider`, `Indicator`.
|
|
301
|
+
*/
|
|
302
|
+
export const squareSizeVariantFallthrough = tableVariant(squareSizeVariant, squareSizeOf);
|
|
303
|
+
|
|
168
304
|
/**
|
|
169
305
|
* The corner a square control (`ActionIcon`, `ThemeIcon`) takes from `sm` to `xl`
|
|
170
|
-
* —
|
|
171
|
-
* `controlMetrics.borderRadius` (4 at sm/md), so an icon button beside a labelled
|
|
172
|
-
* one at the same height was visibly squarer than it. The tiny steps keep the
|
|
306
|
+
* — `md` (8), the SAME corner `Button` uses at every size. The tiny steps keep the
|
|
173
307
|
* table's 2px (an 8px corner on an 18–24px square reads as a circle); `xxl` keeps
|
|
174
308
|
* its 16.
|
|
175
309
|
*/
|
|
176
|
-
const SQUARE_CONTROL_RADIUS = "
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
width: M.xs.height,
|
|
188
|
-
height: M.xs.height,
|
|
189
|
-
borderRadius: M.xs.borderRadius,
|
|
190
|
-
},
|
|
191
|
-
sm: {
|
|
192
|
-
minWidth: M.sm.height,
|
|
193
|
-
width: M.sm.height,
|
|
194
|
-
height: M.sm.height,
|
|
195
|
-
borderRadius: SQUARE_CONTROL_RADIUS,
|
|
196
|
-
},
|
|
197
|
-
md: {
|
|
198
|
-
minWidth: M.md.height,
|
|
199
|
-
width: M.md.height,
|
|
200
|
-
height: M.md.height,
|
|
201
|
-
borderRadius: SQUARE_CONTROL_RADIUS,
|
|
202
|
-
},
|
|
203
|
-
lg: {
|
|
204
|
-
minWidth: M.lg.height,
|
|
205
|
-
width: M.lg.height,
|
|
206
|
-
height: M.lg.height,
|
|
207
|
-
borderRadius: SQUARE_CONTROL_RADIUS,
|
|
208
|
-
},
|
|
209
|
-
xl: {
|
|
210
|
-
minWidth: M.xl.height,
|
|
211
|
-
width: M.xl.height,
|
|
212
|
-
height: M.xl.height,
|
|
213
|
-
borderRadius: SQUARE_CONTROL_RADIUS,
|
|
214
|
-
},
|
|
215
|
-
xxl: {
|
|
216
|
-
minWidth: M.xxl.height,
|
|
217
|
-
width: M.xxl.height,
|
|
218
|
-
height: M.xxl.height,
|
|
219
|
-
borderRadius: M.xxl.borderRadius,
|
|
220
|
-
},
|
|
221
|
-
":string": (val: string) => ({ borderRadius: toRadius(val) }),
|
|
222
|
-
":number": (val: number) => ({ borderRadius: val }),
|
|
310
|
+
const SQUARE_CONTROL_RADIUS = "md";
|
|
311
|
+
|
|
312
|
+
/** Square control sizes WITH the matching corner, per size key. */
|
|
313
|
+
export const SQUARE_ROUNDED_SIZES = {
|
|
314
|
+
xxs: { ...squareSizeVariant.xxs, borderRadius: M.xxs.borderRadius },
|
|
315
|
+
xs: { ...squareSizeVariant.xs, borderRadius: M.xs.borderRadius },
|
|
316
|
+
sm: { ...squareSizeVariant.sm, borderRadius: SQUARE_CONTROL_RADIUS },
|
|
317
|
+
md: { ...squareSizeVariant.md, borderRadius: SQUARE_CONTROL_RADIUS },
|
|
318
|
+
lg: { ...squareSizeVariant.lg, borderRadius: SQUARE_CONTROL_RADIUS },
|
|
319
|
+
xl: { ...squareSizeVariant.xl, borderRadius: SQUARE_CONTROL_RADIUS },
|
|
320
|
+
xxl: { ...squareSizeVariant.xxl, borderRadius: M.xxl.borderRadius },
|
|
223
321
|
} as const;
|
|
224
322
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
323
|
+
/**
|
|
324
|
+
* Square control `size` (ActionIcon, ThemeIcon): a size key sizes the square AND
|
|
325
|
+
* picks its corner; a raw number / CSS value sizes the square only (the corner
|
|
326
|
+
* comes from the frame's `radius`).
|
|
327
|
+
*/
|
|
328
|
+
export const squareSizeRoundedVariant = tableVariant(SQUARE_ROUNDED_SIZES, squareSizeOf);
|
|
230
329
|
|
|
231
330
|
/**
|
|
232
331
|
* Mantine-style `size` prop for a text-bearing control (Button, etc.): each key
|
|
233
|
-
* maps to a `height` (from the `size` token scale)
|
|
234
|
-
* the `space` scale)
|
|
235
|
-
*
|
|
236
|
-
* the ladder inline. Token groups resolve by property: `$md` is size.md on
|
|
237
|
-
* `height`, space.md on `paddingHorizontal`, radius.md on `borderRadius`.
|
|
332
|
+
* maps to a `height` (from the `size` token scale) and `paddingHorizontal` (from
|
|
333
|
+
* the `space` scale). Token names resolve by property: `md` is size.md on
|
|
334
|
+
* `height`, space.md on `paddingHorizontal`. Static exact-key map.
|
|
238
335
|
*
|
|
239
336
|
* Used by `Button`, `Button.GroupSection`, `SegmentedControl.Control`.
|
|
240
337
|
*/
|
|
@@ -251,10 +348,8 @@ export const controlVariant = {
|
|
|
251
348
|
/**
|
|
252
349
|
* Balanced control-text font ladder — the `fontSize` column of `controlMetrics`.
|
|
253
350
|
* UNLIKE `fontSizeVariant` (which maps each key to its same-key font token), this
|
|
254
|
-
* CLAMPS the two smallest steps (xxs/xs →
|
|
255
|
-
* dominated by its label.
|
|
256
|
-
* input hosts) should size their label/value text with this so control text stays
|
|
257
|
-
* proportional to control height; standalone typography keeps `fontSizeVariant`.
|
|
351
|
+
* CLAMPS the two smallest steps (xxs/xs → `xxs`) so a tiny control isn't
|
|
352
|
+
* dominated by its label. Static exact-key map.
|
|
258
353
|
*/
|
|
259
354
|
export const controlFontVariant = {
|
|
260
355
|
xxs: { fontSize: M.xxs.fontSize },
|
|
@@ -266,16 +361,8 @@ export const controlFontVariant = {
|
|
|
266
361
|
xxl: { fontSize: M.xxl.fontSize },
|
|
267
362
|
} as const;
|
|
268
363
|
|
|
269
|
-
/**
|
|
270
|
-
|
|
271
|
-
* `borderRadius` (e.g. `borderRadius: 9999`) and lays out inline children with a
|
|
272
|
-
* `gap`: each key maps `height` + `paddingHorizontal` (identical to
|
|
273
|
-
* `controlVariant`) + `gap` (from the `space` scale), with NO `borderRadius`. A
|
|
274
|
-
* `:number` passes a raw pixel size through to a proportional height/padding/gap.
|
|
275
|
-
*
|
|
276
|
-
* Used by `Badge`, `Chip`, `Pill` so the three stay in lockstep.
|
|
277
|
-
*/
|
|
278
|
-
export const controlGapVariant = {
|
|
364
|
+
/** Pill-control sizes: height + pill padding + gap, NO borderRadius. */
|
|
365
|
+
export const CONTROL_GAP_SIZES = {
|
|
279
366
|
xxs: { height: M.xxs.height, paddingHorizontal: M.xxs.paddingHorizontalPill, gap: M.xxs.gap },
|
|
280
367
|
xs: { height: M.xs.height, paddingHorizontal: M.xs.paddingHorizontalPill, gap: M.xs.gap },
|
|
281
368
|
sm: { height: M.sm.height, paddingHorizontal: M.sm.paddingHorizontalPill, gap: M.sm.gap },
|
|
@@ -283,25 +370,32 @@ export const controlGapVariant = {
|
|
|
283
370
|
lg: { height: M.lg.height, paddingHorizontal: M.lg.paddingHorizontalPill, gap: M.lg.gap },
|
|
284
371
|
xl: { height: M.xl.height, paddingHorizontal: M.xl.paddingHorizontalPill, gap: M.xl.gap },
|
|
285
372
|
xxl: { height: M.xxl.height, paddingHorizontal: M.xxl.paddingHorizontalPill, gap: M.xxl.gap },
|
|
286
|
-
":number": (val: number) => ({
|
|
287
|
-
height: val,
|
|
288
|
-
paddingHorizontal: Math.round(val * 0.5),
|
|
289
|
-
gap: Math.max(4, Math.round(val * 0.25)),
|
|
290
|
-
}),
|
|
291
373
|
} as const;
|
|
292
374
|
|
|
375
|
+
/**
|
|
376
|
+
* Like `controlVariant`, but for a pill-shaped control that pins its own
|
|
377
|
+
* `borderRadius` and lays out inline children with a `gap`. A number passes a raw
|
|
378
|
+
* pixel height through to a proportional height/padding/gap.
|
|
379
|
+
*
|
|
380
|
+
* Used by `Badge`, `Chip`, `Pill` so the three stay in lockstep.
|
|
381
|
+
*/
|
|
382
|
+
export const controlGapVariant = tableVariant(CONTROL_GAP_SIZES, (value: number) => ({
|
|
383
|
+
height: value,
|
|
384
|
+
paddingHorizontal: Math.round(value * 0.5),
|
|
385
|
+
gap: Math.max(4, Math.round(value * 0.25)),
|
|
386
|
+
}));
|
|
387
|
+
|
|
293
388
|
/* -------------------------------------------------------------------------- */
|
|
294
|
-
/* Variant COLOR builders — the color twin of the size builders above.
|
|
295
|
-
/*
|
|
296
|
-
/*
|
|
297
|
-
/* inline. Re-tune a ramp token in `variant-colors.ts` and every consumer moves */
|
|
298
|
-
/* together (the same contract `controlMetrics` gives the size builders). */
|
|
389
|
+
/* Variant COLOR builders — the color twin of the size builders above. Static */
|
|
390
|
+
/* exact-key maps generated from `variant-colors.ts`, so a component puts one */
|
|
391
|
+
/* in its `variant` variant instead of re-declaring the palette ladder inline. */
|
|
299
392
|
/* -------------------------------------------------------------------------- */
|
|
300
393
|
|
|
301
394
|
/**
|
|
302
|
-
* Keep only `keys` from a variant
|
|
303
|
-
*
|
|
304
|
-
*
|
|
395
|
+
* Keep only `keys` from a variant map — lets a component expose a SUBSET of the
|
|
396
|
+
* canonical vocabulary (e.g. Badge wants `dot` but not `subtle`) while still
|
|
397
|
+
* sourcing every value from the shared ladder. Module-scope use only (it
|
|
398
|
+
* allocates). Unknown keys are ignored.
|
|
305
399
|
*/
|
|
306
400
|
export const pickVariants = <T extends Record<string, unknown>, K extends keyof T>(
|
|
307
401
|
map: T,
|
|
@@ -313,44 +407,35 @@ export const pickVariants = <T extends Record<string, unknown>, K extends keyof
|
|
|
313
407
|
};
|
|
314
408
|
|
|
315
409
|
/**
|
|
316
|
-
* INTERACTIVE control fill — background + border
|
|
317
|
-
*
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
subtle: { ...VARIANT_FILL.subtle, ...VARIANT_INTERACTION.subtle },
|
|
324
|
-
default: { ...VARIANT_FILL.default, ...VARIANT_INTERACTION.default },
|
|
325
|
-
white: { ...VARIANT_FILL.white, ...VARIANT_INTERACTION.white },
|
|
326
|
-
transparent: { ...VARIANT_FILL.transparent, ...VARIANT_INTERACTION.transparent },
|
|
327
|
-
// No hover/press color: the runtime gradient sits in `backgroundImage` (web) or
|
|
328
|
-
// an SVG layer (native), so a hover/press `backgroundColor` would be invisible
|
|
329
|
-
// beneath it. The shared press-dip (`pressScaleStyle`) still gives tactile feedback.
|
|
330
|
-
gradient: { ...VARIANT_FILL.gradient },
|
|
331
|
-
} as const;
|
|
410
|
+
* INTERACTIVE control fill — background (+ border) with hover/press clauses per
|
|
411
|
+
* variant (`filled → { backgroundColor: "color9 hover:color10 press:color8" }`).
|
|
412
|
+
* The frame ladder for `Button` and `ActionIcon`. Use as (or spread into, at
|
|
413
|
+
* module scope) `variants.variant`. `gradient` has no hover/press colour: its
|
|
414
|
+
* runtime gradient would hide it; the press-dip still gives tactile feedback.
|
|
415
|
+
*/
|
|
416
|
+
export const controlColorVariant = VARIANT_CONTROL;
|
|
332
417
|
|
|
333
418
|
/**
|
|
334
|
-
* STATIC surface fill — background + border only, no
|
|
335
|
-
* ladder for non-interactive surfaces (`Badge`, `Alert`). Includes the
|
|
336
|
-
* `dot
|
|
419
|
+
* STATIC surface fill — background + border only, no interaction clauses. The
|
|
420
|
+
* frame ladder for non-interactive surfaces (`Badge`, `Alert`). Includes the
|
|
421
|
+
* pill-only `dot`; `pickVariants` to expose just the subset a component supports.
|
|
337
422
|
*/
|
|
338
|
-
export const surfaceColorVariant =
|
|
423
|
+
export const surfaceColorVariant = VARIANT_FILL;
|
|
339
424
|
|
|
340
425
|
/**
|
|
341
426
|
* EMPHASIS text color per variant — labels, titles, glyphs sitting on the fill.
|
|
342
427
|
* The text ladder for `Button`/`ActionIcon` labels, `Badge` text, `Alert.Title`.
|
|
343
428
|
*/
|
|
344
|
-
export const controlTextColorVariant =
|
|
429
|
+
export const controlTextColorVariant = VARIANT_FOREGROUND_EMPHASIS;
|
|
345
430
|
|
|
346
431
|
/**
|
|
347
432
|
* MUTED text color per variant — softer body copy (e.g. `Alert.Message`). Only
|
|
348
|
-
* `filled` inverts to sit on the strong fill; the rest resolve to
|
|
433
|
+
* `filled` inverts to sit on the strong fill; the rest resolve to `color12`.
|
|
349
434
|
*/
|
|
350
|
-
export const mutedTextColorVariant =
|
|
435
|
+
export const mutedTextColorVariant = VARIANT_FOREGROUND_MUTED;
|
|
351
436
|
|
|
352
|
-
/** The canonical variant keys,
|
|
353
|
-
const VARIANT_KEY_SET = new Set<
|
|
437
|
+
/** The canonical variant keys, as a Set for cheap membership checks. */
|
|
438
|
+
const VARIANT_KEY_SET = new Set<string>([
|
|
354
439
|
"filled",
|
|
355
440
|
"light",
|
|
356
441
|
"outline",
|
|
@@ -363,17 +448,14 @@ const VARIANT_KEY_SET = new Set<VariantKey>([
|
|
|
363
448
|
]);
|
|
364
449
|
|
|
365
450
|
/** True when `value` is one of the canonical variant keys. */
|
|
366
|
-
export const isVariantKey = (value: string): value is VariantKey =>
|
|
367
|
-
VARIANT_KEY_SET.has(value as VariantKey);
|
|
451
|
+
export const isVariantKey = (value: string): value is VariantKey => VARIANT_KEY_SET.has(value);
|
|
368
452
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
*/
|
|
376
|
-
export const heightVariant = {
|
|
453
|
+
/* -------------------------------------------------------------------------- */
|
|
454
|
+
/* Thickness / extent ladders */
|
|
455
|
+
/* -------------------------------------------------------------------------- */
|
|
456
|
+
|
|
457
|
+
/** Height-only sizes from the canonical control heights. */
|
|
458
|
+
const HEIGHT_SIZES = {
|
|
377
459
|
xxs: { height: M.xxs.height },
|
|
378
460
|
xs: { height: M.xs.height },
|
|
379
461
|
sm: { height: M.sm.height },
|
|
@@ -381,37 +463,28 @@ export const heightVariant = {
|
|
|
381
463
|
lg: { height: M.lg.height },
|
|
382
464
|
xl: { height: M.xl.height },
|
|
383
465
|
xxl: { height: M.xxl.height },
|
|
384
|
-
":number": (val: number) => ({ height: val }),
|
|
385
466
|
} as const;
|
|
386
467
|
|
|
468
|
+
/**
|
|
469
|
+
* Thickness/height-only `size` prop — a size key onto `height` (from the `size`
|
|
470
|
+
* scale), or a number straight through. Used by `Loader` (frame).
|
|
471
|
+
*/
|
|
472
|
+
export const heightVariant = tableVariant(HEIGHT_SIZES, (value: number) => ({ height: value }));
|
|
473
|
+
|
|
387
474
|
/**
|
|
388
475
|
* The input root frame's per-size HEIGHT (a `md` field is 40px, matching a `md`
|
|
389
|
-
* Button), with
|
|
390
|
-
* `heightVariant` but with the extra `:string` pass-through. It lives HERE — not in
|
|
476
|
+
* Button), with a number / CSS value escape hatch. It lives HERE — not in
|
|
391
477
|
* `Input/shared.tsx` — so the styled input frame's `size` variant doesn't create a
|
|
392
|
-
* circular TYPE reference back through its own props
|
|
393
|
-
* frame-props → frame). Derived from the canonical control heights.
|
|
478
|
+
* circular TYPE reference back through its own props.
|
|
394
479
|
*/
|
|
395
|
-
export const fieldHeightVariant =
|
|
396
|
-
xxs: { height: M.xxs.height },
|
|
397
|
-
xs: { height: M.xs.height },
|
|
398
|
-
sm: { height: M.sm.height },
|
|
399
|
-
md: { height: M.md.height },
|
|
400
|
-
lg: { height: M.lg.height },
|
|
401
|
-
xl: { height: M.xl.height },
|
|
402
|
-
xxl: { height: M.xxl.height },
|
|
403
|
-
":string": (val: string) => ({ height: val as BoxProps["height"] }),
|
|
404
|
-
":number": (val: number) => ({ height: val }),
|
|
405
|
-
} as const;
|
|
480
|
+
export const fieldHeightVariant = tableVariant(HEIGHT_SIZES, heightOf);
|
|
406
481
|
|
|
407
482
|
/**
|
|
408
|
-
* Track-thickness
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
* variant (reviewed as a set, `:number` escape hatch preserved) instead of an
|
|
412
|
-
* inline magic-number map. Used by `Progress`.
|
|
483
|
+
* Track-thickness ladder for thin horizontal bars (Progress) — far thinner than a
|
|
484
|
+
* control height, so its own small px ladder. Read as data by `Progress` for the
|
|
485
|
+
* vertical orientation.
|
|
413
486
|
*/
|
|
414
|
-
export const
|
|
487
|
+
export const PROGRESS_THICKNESS = {
|
|
415
488
|
xxs: { height: 2 },
|
|
416
489
|
xs: { height: 3 },
|
|
417
490
|
sm: { height: 5 },
|
|
@@ -419,14 +492,14 @@ export const progressThicknessVariant = {
|
|
|
419
492
|
lg: { height: 12 },
|
|
420
493
|
xl: { height: 16 },
|
|
421
494
|
xxl: { height: 20 },
|
|
422
|
-
":number": (val: number) => ({ height: val }),
|
|
423
495
|
} as const;
|
|
424
496
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
497
|
+
export const progressThicknessVariant = tableVariant(PROGRESS_THICKNESS, (value: number) => ({
|
|
498
|
+
height: value,
|
|
499
|
+
}));
|
|
500
|
+
|
|
501
|
+
/** Slider track-thickness ladder — tuned for a draggable track. Used by `Slider`. */
|
|
502
|
+
export const SLIDER_TRACK_SIZES = {
|
|
430
503
|
xxs: { height: 3 },
|
|
431
504
|
xs: { height: 4 },
|
|
432
505
|
sm: { height: 5 },
|
|
@@ -434,14 +507,14 @@ export const sliderTrackVariant = {
|
|
|
434
507
|
lg: { height: 8 },
|
|
435
508
|
xl: { height: 10 },
|
|
436
509
|
xxl: { height: 12 },
|
|
437
|
-
":number": (val: number) => ({ height: val }),
|
|
438
510
|
} as const;
|
|
439
511
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
512
|
+
export const sliderTrackVariant = tableVariant(SLIDER_TRACK_SIZES, (value: number) => ({
|
|
513
|
+
height: value,
|
|
514
|
+
}));
|
|
515
|
+
|
|
516
|
+
/** Slider thumb ladder — square handle tuned above the same-key track. Used by `Slider`. */
|
|
517
|
+
export const SLIDER_THUMB_SIZES = {
|
|
445
518
|
xxs: { width: 12, height: 12 },
|
|
446
519
|
xs: { width: 14, height: 14 },
|
|
447
520
|
sm: { width: 16, height: 16 },
|
|
@@ -449,16 +522,18 @@ export const sliderThumbVariant = {
|
|
|
449
522
|
lg: { width: 24, height: 24 },
|
|
450
523
|
xl: { width: 28, height: 28 },
|
|
451
524
|
xxl: { width: 32, height: 32 },
|
|
452
|
-
":number": (val: number) => ({ width: val, height: val }),
|
|
453
525
|
} as const;
|
|
454
526
|
|
|
527
|
+
export const sliderThumbVariant = tableVariant(SLIDER_THUMB_SIZES, (value: number) => ({
|
|
528
|
+
width: value,
|
|
529
|
+
height: value,
|
|
530
|
+
}));
|
|
531
|
+
|
|
455
532
|
/**
|
|
456
|
-
* Fixed content-WIDTH ladder for panels (Dialog, Drawer width axis)
|
|
457
|
-
*
|
|
458
|
-
* passes an arbitrary px/CSS width through. Distinct from `maxWidthVariant`, which
|
|
459
|
-
* sets a max-width cap rather than a fixed width.
|
|
533
|
+
* Fixed content-WIDTH ladder for panels (Dialog, Drawer width axis), so a `md` of
|
|
534
|
+
* any panel is the same width. Read as data by `Drawer`.
|
|
460
535
|
*/
|
|
461
|
-
export const
|
|
536
|
+
export const PANEL_WIDTH = {
|
|
462
537
|
xxs: { width: 160 },
|
|
463
538
|
xs: { width: 200 },
|
|
464
539
|
sm: { width: 280 },
|
|
@@ -466,10 +541,11 @@ export const panelWidthVariant = {
|
|
|
466
541
|
lg: { width: 400 },
|
|
467
542
|
xl: { width: 480 },
|
|
468
543
|
xxl: { width: 560 },
|
|
469
|
-
":number": (val: number) => ({ width: val }),
|
|
470
|
-
":string": (val: string) => ({ width: val as BoxProps["width"] }),
|
|
471
544
|
} as const;
|
|
472
545
|
|
|
546
|
+
/** {@link PANEL_WIDTH} as a variant; a number / CSS value passes through as `width`. */
|
|
547
|
+
export const panelWidthVariant = tableVariant(PANEL_WIDTH, widthOf);
|
|
548
|
+
|
|
473
549
|
/**
|
|
474
550
|
* Cursor is a web affordance in this kit. Passing it as a Tamagui style prop on
|
|
475
551
|
* native can leak to React Native's host node as a top-level prop and trigger
|
|
@@ -552,51 +628,79 @@ export const webButtonTextReset = (): { textAlign: "left" } | undefined => WEB_B
|
|
|
552
628
|
*/
|
|
553
629
|
export type FlexDirection = "row" | "column" | "row-reverse" | "column-reverse";
|
|
554
630
|
|
|
631
|
+
/* -------------------------------------------------------------------------- */
|
|
632
|
+
/* Transitions (v3 `transition` prop values) */
|
|
633
|
+
/* -------------------------------------------------------------------------- */
|
|
634
|
+
|
|
555
635
|
/**
|
|
556
|
-
*
|
|
557
|
-
*
|
|
558
|
-
*
|
|
559
|
-
*
|
|
560
|
-
*
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
*
|
|
587
|
-
*
|
|
588
|
-
*
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
636
|
+
* The named presets registered in `@knitui/core`'s animation drivers — the keys
|
|
637
|
+
* of the one `MOTION_PRESETS` table both drivers are built from (`fast`,
|
|
638
|
+
* `medium`, `slow`, `bouncy`, `pulse`, `spin`, `stripe`, and the easing-curve
|
|
639
|
+
* keys `linear` / `ease` / `ease-in` / `ease-out` / `ease-in-out`). v2's
|
|
640
|
+
* `"100ms"` key is gone: a duration is plain CSS in v3.
|
|
641
|
+
*/
|
|
642
|
+
export type TransitionName = DriverPresetName;
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* The object form of a v3 transition — the subset of Tamagui's `TransitionConfig`
|
|
646
|
+
* the kit authors. `properties` scopes the transition (v2's `animateOnly`, as a
|
|
647
|
+
* CSS `transition-property` list: `"transform, opacity"`).
|
|
648
|
+
*/
|
|
649
|
+
export type TransitionSpec = {
|
|
650
|
+
preset?: TransitionName;
|
|
651
|
+
/** ms. Overrides the preset's duration (a spring preset re-solves). */
|
|
652
|
+
duration?: number;
|
|
653
|
+
/** Any CSS timing function (`"ease-out"`, `"cubic-bezier(…)"`) — exact on web AND native. */
|
|
654
|
+
easing?: string;
|
|
655
|
+
/** ms. */
|
|
656
|
+
delay?: number;
|
|
657
|
+
/** Comma-separated style properties this transition applies to. */
|
|
658
|
+
properties?: string;
|
|
659
|
+
/** The transition while mounting, if it differs. */
|
|
660
|
+
enter?: TransitionName | TransitionSpec;
|
|
661
|
+
/** The transition while unmounting, if it differs. */
|
|
662
|
+
exit?: TransitionName | TransitionSpec;
|
|
663
|
+
};
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* A kit transition value: a preset name, an object, or `null` (keep the
|
|
667
|
+
* `transition` key present but animate nothing — Tamagui's rule for animated
|
|
668
|
+
* views, so hook order never changes).
|
|
669
|
+
*/
|
|
670
|
+
export type TransitionValue = TransitionName | TransitionSpec | null;
|
|
671
|
+
|
|
672
|
+
/** `["transform", "opacity"]` / `"transform, opacity"` → `"transform, opacity"`. */
|
|
673
|
+
export const toTransitionProperties = (properties: readonly string[] | string): string =>
|
|
674
|
+
typeof properties === "string" ? properties : properties.join(", ");
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Scope a transition to `properties` (the v3 home of v2's `animateOnly`): a preset
|
|
678
|
+
* name becomes `{ preset, properties }`, an object gains `properties`, `null` stays
|
|
679
|
+
* `null`. Without it a plain `transition="fast"` animates EVERY changing property,
|
|
680
|
+
* which slides floating elements across the screen on each re-measure.
|
|
681
|
+
*/
|
|
682
|
+
export const withTransitionProperties = (
|
|
683
|
+
value: TransitionValue,
|
|
684
|
+
properties: readonly string[] | string | undefined,
|
|
685
|
+
): TransitionValue => {
|
|
686
|
+
if (value == null || properties === undefined) return value;
|
|
687
|
+
const list = toTransitionProperties(properties);
|
|
688
|
+
return typeof value === "string"
|
|
689
|
+
? { preset: value, properties: list }
|
|
690
|
+
: { ...value, properties: list };
|
|
691
|
+
};
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Map a CSS `transition-timing-function` onto the registered easing preset that
|
|
695
|
+
* reproduces it (`"ease-out"` → `"ease-out"`; unknown → `"ease"`; a
|
|
696
|
+
* `cubic-bezier(…)` → `"ease"`). v3 accepts any CSS easing in the object form,
|
|
697
|
+
* so prefer {@link timedTransition}, which keeps the curve EXACT; this stays for
|
|
698
|
+
* callers that need a preset NAME.
|
|
593
699
|
*/
|
|
594
700
|
export const resolveTransition = (timingFunction = "ease"): TransitionName => {
|
|
595
701
|
switch (timingFunction.trim().toLowerCase()) {
|
|
596
702
|
case "linear":
|
|
597
703
|
return "linear";
|
|
598
|
-
case "ease":
|
|
599
|
-
return "ease";
|
|
600
704
|
case "ease-in":
|
|
601
705
|
return "ease-in";
|
|
602
706
|
case "ease-out":
|
|
@@ -604,118 +708,177 @@ export const resolveTransition = (timingFunction = "ease"): TransitionName => {
|
|
|
604
708
|
case "ease-in-out":
|
|
605
709
|
return "ease-in-out";
|
|
606
710
|
default:
|
|
607
|
-
return
|
|
711
|
+
return "ease";
|
|
608
712
|
}
|
|
609
713
|
};
|
|
610
714
|
|
|
611
715
|
/**
|
|
612
|
-
*
|
|
613
|
-
*
|
|
614
|
-
* `
|
|
615
|
-
*
|
|
616
|
-
* idiom the size/height-clip components all repeat.
|
|
716
|
+
* A timed (non-spring) transition: exact `duration` (ms) and exact CSS easing
|
|
717
|
+
* curve, as the v3 object form `{ duration, easing }` — both drivers take any CSS
|
|
718
|
+
* timing function (`cubic-bezier(…)` included), so nothing approximates any more.
|
|
719
|
+
* Pass `properties` to scope it.
|
|
617
720
|
*/
|
|
618
|
-
export const timedTransition = (
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
]
|
|
721
|
+
export const timedTransition = (
|
|
722
|
+
duration: number,
|
|
723
|
+
timingFunction = "ease",
|
|
724
|
+
properties?: readonly string[] | string,
|
|
725
|
+
): TransitionSpec =>
|
|
726
|
+
properties === undefined
|
|
727
|
+
? { duration, easing: timingFunction }
|
|
728
|
+
: { duration, easing: timingFunction, properties: toTransitionProperties(properties) };
|
|
622
729
|
|
|
623
730
|
/**
|
|
624
731
|
* Build a precisely-typed `{ transition }` object to spread onto a styled
|
|
625
|
-
* component
|
|
626
|
-
*
|
|
732
|
+
* component (or a `styled()` base), optionally scoped to `properties`. Keep the
|
|
733
|
+
* prop present and pass `null` when disabled (Tamagui's animated-view rule).
|
|
734
|
+
*
|
|
735
|
+
* ```ts
|
|
736
|
+
* styled(Box, { ...transitionProps("fast", ["backgroundColor"]) })
|
|
737
|
+
* ```
|
|
627
738
|
*/
|
|
628
|
-
export const transitionProps = (
|
|
629
|
-
transition,
|
|
739
|
+
export const transitionProps = (
|
|
740
|
+
transition: TransitionValue,
|
|
741
|
+
properties?: readonly string[] | string,
|
|
742
|
+
): { transition: TransitionValue } => ({
|
|
743
|
+
transition: withTransitionProperties(transition, properties),
|
|
630
744
|
});
|
|
631
745
|
|
|
746
|
+
const scopedCache = new WeakMap<object, Map<string, { transition: TransitionValue }>>();
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* Scope an existing `{ transition }` result (e.g. from `useReducedTransition`) to
|
|
750
|
+
* `properties` — the v3 replacement for the v2 pair
|
|
751
|
+
* `{...fade} {...animateOnlyProps(["opacity"])}` → `{...scopeTransition(fade, ["opacity"])}`.
|
|
752
|
+
* Cached per (result object, property list), so a memoised `fade` yields the same
|
|
753
|
+
* object every render.
|
|
754
|
+
*/
|
|
755
|
+
export const scopeTransition = (
|
|
756
|
+
result: { transition: TransitionValue },
|
|
757
|
+
properties: readonly string[] | string,
|
|
758
|
+
): { transition: TransitionValue } => {
|
|
759
|
+
const list = toTransitionProperties(properties);
|
|
760
|
+
let byList = scopedCache.get(result);
|
|
761
|
+
if (!byList) scopedCache.set(result, (byList = new Map()));
|
|
762
|
+
let hit = byList.get(list);
|
|
763
|
+
if (!hit)
|
|
764
|
+
byList.set(list, (hit = { transition: withTransitionProperties(result.transition, list) }));
|
|
765
|
+
return hit;
|
|
766
|
+
};
|
|
767
|
+
|
|
768
|
+
/** The base duration (ms) of a timed preset, or `undefined` for a spring. */
|
|
769
|
+
export const presetDurationMs = (name: TransitionName): number | undefined => {
|
|
770
|
+
const preset = MOTION_PRESETS[name] as { duration?: number };
|
|
771
|
+
return typeof preset.duration === "number" ? preset.duration : undefined;
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
/* -------------------------------------------------------------------------- */
|
|
775
|
+
/* Press feedback */
|
|
776
|
+
/* -------------------------------------------------------------------------- */
|
|
777
|
+
|
|
632
778
|
/**
|
|
633
779
|
* Fraction an interactive control scales DOWN to while pressed — the tactile
|
|
634
780
|
* "dip" shared by `Button`, `ActionIcon`, `Chip`, … `0.97` is a 3% shrink: clearly
|
|
635
|
-
* felt without looking broken on the smallest controls.
|
|
636
|
-
* once for the whole kit.
|
|
781
|
+
* felt without looking broken on the smallest controls.
|
|
637
782
|
*/
|
|
638
783
|
export const PRESS_SCALE = 0.97;
|
|
639
784
|
|
|
640
785
|
/**
|
|
641
|
-
* Tactile "shrink on press" feedback. Spread onto a pressable
|
|
642
|
-
* (`...pressScaleStyle`)
|
|
643
|
-
*
|
|
644
|
-
*
|
|
645
|
-
*
|
|
646
|
-
*
|
|
647
|
-
* native, using the kit's own animation/press internals end to end.
|
|
786
|
+
* Tactile "shrink on press" feedback as a v3 flat clause. Spread onto a pressable
|
|
787
|
+
* frame's BASE style (`...pressScaleStyle`). v3 merges clause slots per (property,
|
|
788
|
+
* condition) across tiers, so this base `scale: "press:0.97"` composes with a
|
|
789
|
+
* variant's `bg: "… press:color8"` (different properties) — on press the control
|
|
790
|
+
* both darkens (variant) and dips (this). Pair the frame with `usePressScale()` at
|
|
791
|
+
* render so the dip EASES (and collapses under reduced motion).
|
|
648
792
|
*/
|
|
649
|
-
export const pressScaleStyle = {
|
|
793
|
+
export const pressScaleStyle = { scale: `press:${PRESS_SCALE}` } as const;
|
|
650
794
|
|
|
651
|
-
/**
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
* across the screen on every re-measure. Restricting to `["transform", "opacity"]`
|
|
659
|
-
* keeps the enter/exit fade + scale/slide while positioning stays instant. Like
|
|
660
|
-
* `transitionProps`, this dodges the excess-property check WITHOUT widening to `any`.
|
|
661
|
-
*/
|
|
662
|
-
export const animateOnlyProps = (properties: string[]): { animateOnly: string[] } => ({
|
|
663
|
-
animateOnly: properties,
|
|
664
|
-
});
|
|
795
|
+
/** Hover handlers as spread by {@link hoverProps}: web keys OR native keys. */
|
|
796
|
+
export interface HoverHandlerProps<E = unknown> {
|
|
797
|
+
onMouseEnter?: (event: E) => void;
|
|
798
|
+
onMouseLeave?: (event: E) => void;
|
|
799
|
+
onHoverIn?: (event: E) => void;
|
|
800
|
+
onHoverOut?: (event: E) => void;
|
|
801
|
+
}
|
|
665
802
|
|
|
666
803
|
/**
|
|
667
|
-
*
|
|
668
|
-
*
|
|
669
|
-
*
|
|
670
|
-
*
|
|
671
|
-
*
|
|
672
|
-
* `
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
804
|
+
* Pointer-hover handlers for a Tamagui frame, per platform. Spread the result:
|
|
805
|
+
* `<Frame {...hoverProps({ onHoverIn, onHoverOut })} />`. The platform event is
|
|
806
|
+
* forwarded to the handler (typed `unknown` unless `E` is given).
|
|
807
|
+
*
|
|
808
|
+
* v3 (3.0.18) only attaches its web mouse listeners when the element has
|
|
809
|
+
* `onMouseEnter`/`onMouseLeave` (or a `hover:` style): `onHoverIn`/`onHoverOut`
|
|
810
|
+
* ALONE are never wired on web (`createComponent` → `attachHover`), so a frame that
|
|
811
|
+
* only declared them silently ignored the pointer. Web therefore gets the mouse
|
|
812
|
+
* handlers; native keeps Tamagui's `onHoverIn`/`onHoverOut` (pointer devices on
|
|
813
|
+
* iPad / Android). Absent handlers stay absent (no `undefined` keys).
|
|
814
|
+
*/
|
|
815
|
+
export function hoverProps<E = unknown>(handlers: {
|
|
816
|
+
onHoverIn?: (event: E) => void;
|
|
817
|
+
onHoverOut?: (event: E) => void;
|
|
818
|
+
}): HoverHandlerProps<E> {
|
|
819
|
+
const { onHoverIn, onHoverOut } = handlers;
|
|
820
|
+
const out: HoverHandlerProps<E> = {};
|
|
821
|
+
if (isWeb) {
|
|
822
|
+
if (onHoverIn) out.onMouseEnter = onHoverIn;
|
|
823
|
+
if (onHoverOut) out.onMouseLeave = onHoverOut;
|
|
824
|
+
} else {
|
|
825
|
+
if (onHoverIn) out.onHoverIn = onHoverIn;
|
|
826
|
+
if (onHoverOut) out.onHoverOut = onHoverOut;
|
|
827
|
+
}
|
|
828
|
+
return out;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
/* -------------------------------------------------------------------------- */
|
|
832
|
+
/* Shadows */
|
|
833
|
+
/* -------------------------------------------------------------------------- */
|
|
678
834
|
|
|
679
835
|
/**
|
|
680
836
|
* Mantine-style `shadow` scale (xxs→xxl). Elevation rises with the key; colour
|
|
681
|
-
* comes from the
|
|
837
|
+
* comes from the `dropShadowColor` theme key so it adapts to light/dark.
|
|
682
838
|
*
|
|
683
839
|
* Expressed as the cross-platform `boxShadow` style prop (`"{x}px {y}px {blur}px
|
|
684
|
-
* {spread}px {color}"`) rather than legacy RN `shadow*` props: `
|
|
685
|
-
*
|
|
686
|
-
*
|
|
687
|
-
*
|
|
688
|
-
*
|
|
689
|
-
*
|
|
840
|
+
* {spread}px {color}"`) rather than legacy RN `shadow*` props: `boxShadow` works
|
|
841
|
+
* on web + iOS + Android 9+ (RN New Arch). v3 resolves the bare theme name
|
|
842
|
+
* embedded in the shadow recipe on every platform (`getSplitStyles`
|
|
843
|
+
* `configuredValue` → `grammar.embeddedTokens`, where a recipe word that is not a
|
|
844
|
+
* token is resolved as a COLOR against the active theme): web emits
|
|
845
|
+
* `var(--dropShadowColor)`, native the theme's raw rgba. So these stay static
|
|
846
|
+
* strings — no runtime theme read. Verified by `shadow.test.tsx`.
|
|
690
847
|
*
|
|
691
|
-
* The
|
|
692
|
-
*
|
|
693
|
-
*
|
|
848
|
+
* The key is deliberately NOT named `shadowColor`: that collides with React
|
|
849
|
+
* Native's reserved legacy `shadowColor` style prop, which makes the native
|
|
850
|
+
* pipeline drop the token's alpha on iOS (shadows render washed-out).
|
|
694
851
|
*/
|
|
695
852
|
export const shadowVariant = {
|
|
696
|
-
xxs: { boxShadow: "0px 1px 1px 0px
|
|
697
|
-
xs: { boxShadow: "0px 1px 3px 0px
|
|
698
|
-
sm: { boxShadow: "0px 3px 6px 0px
|
|
699
|
-
md: { boxShadow: "0px 5px 12px 0px
|
|
700
|
-
lg: { boxShadow: "0px 8px 20px 0px
|
|
701
|
-
xl: { boxShadow: "0px 12px 28px 0px
|
|
702
|
-
xxl: { boxShadow: "0px 16px 40px 0px
|
|
853
|
+
xxs: { boxShadow: "0px 1px 1px 0px dropShadowColor" },
|
|
854
|
+
xs: { boxShadow: "0px 1px 3px 0px dropShadowColor" },
|
|
855
|
+
sm: { boxShadow: "0px 3px 6px 0px dropShadowColor" },
|
|
856
|
+
md: { boxShadow: "0px 5px 12px 0px dropShadowColor" },
|
|
857
|
+
lg: { boxShadow: "0px 8px 20px 0px dropShadowColor" },
|
|
858
|
+
xl: { boxShadow: "0px 12px 28px 0px dropShadowColor" },
|
|
859
|
+
xxl: { boxShadow: "0px 16px 40px 0px dropShadowColor" },
|
|
703
860
|
} as const;
|
|
704
861
|
|
|
862
|
+
/** The shadow scale's keys (`shadow` prop values). */
|
|
863
|
+
export type ShadowKey = keyof typeof shadowVariant;
|
|
864
|
+
|
|
865
|
+
/* -------------------------------------------------------------------------- */
|
|
866
|
+
/* Typography */
|
|
867
|
+
/* -------------------------------------------------------------------------- */
|
|
868
|
+
|
|
705
869
|
/**
|
|
706
870
|
* Mantine-style `size` prop for text: a size key (`"md"`) maps to the matching
|
|
707
|
-
* font-size token
|
|
708
|
-
*
|
|
709
|
-
* font config's per-fontSize line-height mapping.
|
|
871
|
+
* font-size token. Line height is intentionally left unset so it derives from
|
|
872
|
+
* the font config's per-fontSize line-height mapping. Static exact-key map.
|
|
710
873
|
*/
|
|
711
874
|
export const fontSizeVariant = {
|
|
712
|
-
xxs: { fontSize: "
|
|
713
|
-
xs: { fontSize: "
|
|
714
|
-
sm: { fontSize: "
|
|
715
|
-
md: { fontSize: "
|
|
716
|
-
lg: { fontSize: "
|
|
717
|
-
xl: { fontSize: "
|
|
718
|
-
xxl: { fontSize: "
|
|
875
|
+
xxs: { fontSize: "xxs" },
|
|
876
|
+
xs: { fontSize: "xs" },
|
|
877
|
+
sm: { fontSize: "sm" },
|
|
878
|
+
md: { fontSize: "md" },
|
|
879
|
+
lg: { fontSize: "lg" },
|
|
880
|
+
xl: { fontSize: "xl" },
|
|
881
|
+
xxl: { fontSize: "xxl" },
|
|
719
882
|
} as const;
|
|
720
883
|
|
|
721
884
|
/**
|
|
@@ -772,44 +935,36 @@ export const kbdSizeVariant = {
|
|
|
772
935
|
},
|
|
773
936
|
} as const;
|
|
774
937
|
|
|
938
|
+
/** The plain `fontSize` fallthrough body: a raw px / font token / CSS value. */
|
|
939
|
+
export const fontSizeOf = (value: number | FontSizeTokens | CssString): StyleFragment => ({
|
|
940
|
+
fontSize: value,
|
|
941
|
+
});
|
|
942
|
+
|
|
775
943
|
/**
|
|
776
|
-
*
|
|
777
|
-
*
|
|
778
|
-
*
|
|
779
|
-
*
|
|
780
|
-
* ```ts
|
|
781
|
-
* size: { xs: { fontSize: "$xs" }, …, ...fontSizePassthroughVariant }
|
|
782
|
-
* ```
|
|
944
|
+
* {@link fontSizeVariant} plus the escape hatch: a number / font token / CSS value
|
|
945
|
+
* flows straight to `fontSize`. To add keys (Title's `h1`…), build a new one:
|
|
946
|
+
* `tableVariant({ ...fontSizeVariant, h1: { fontSize: "xxl" } }, fontSizeOf)`.
|
|
783
947
|
*/
|
|
784
|
-
export const fontSizePassthroughVariant =
|
|
785
|
-
...fontSizeVariant,
|
|
786
|
-
":string": (val: string) => ({ fontSize: val as FontSizeTokens }),
|
|
787
|
-
":number": (val: number) => ({ fontSize: val }),
|
|
788
|
-
} as const;
|
|
948
|
+
export const fontSizePassthroughVariant = tableVariant(fontSizeVariant, fontSizeOf);
|
|
789
949
|
|
|
790
950
|
/** Open-ended `fontWeight` prop (`"700"`, `600`, `"bold"`, …). */
|
|
791
|
-
export const fontWeightVariant =
|
|
792
|
-
":string": (val: string) => ({ fontWeight: val as TextProps["fontWeight"] }),
|
|
793
|
-
":number": (val: number) => ({ fontWeight: val as TextProps["fontWeight"] }),
|
|
794
|
-
} as const;
|
|
951
|
+
export const fontWeightVariant = passthroughVariant<number | CssString>("fontWeight");
|
|
795
952
|
|
|
796
953
|
/** Open-ended `textAlign` prop (`"left"`, `"center"`, `"justify"`, …). */
|
|
797
|
-
export const textAlignVariant =
|
|
798
|
-
"
|
|
799
|
-
|
|
954
|
+
export const textAlignVariant = passthroughVariant<
|
|
955
|
+
"auto" | "left" | "right" | "center" | "justify" | CssString
|
|
956
|
+
>("textAlign");
|
|
800
957
|
|
|
801
958
|
/** Open-ended `textTransform` prop (`"uppercase"`, `"capitalize"`, …). */
|
|
802
|
-
export const textTransformVariant =
|
|
803
|
-
"
|
|
804
|
-
|
|
959
|
+
export const textTransformVariant = passthroughVariant<
|
|
960
|
+
"none" | "uppercase" | "lowercase" | "capitalize" | CssString
|
|
961
|
+
>("textTransform");
|
|
805
962
|
|
|
806
963
|
/**
|
|
807
964
|
* CSS `text-wrap` values (`"balance"`, `"pretty"`, …) — web-only and not modeled
|
|
808
|
-
* by Tamagui's style props
|
|
965
|
+
* by Tamagui's style props.
|
|
809
966
|
*/
|
|
810
967
|
export type TextWrap = "wrap" | "nowrap" | "balance" | "pretty" | "stable";
|
|
811
968
|
|
|
812
969
|
/** Mantine-style `textWrap` prop. Web-only; a no-op on native. Used by `Title`. */
|
|
813
|
-
export const textWrapVariant =
|
|
814
|
-
":string": (val: string) => ({ textWrap: val as TextWrap }),
|
|
815
|
-
} as const;
|
|
970
|
+
export const textWrapVariant = passthroughVariant<TextWrap>("textWrap");
|