@cdx-ui/components 0.1.6 → 0.2.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/coverage.svg +1 -1
- package/lib/commonjs/components/Alert/index.js.map +1 -1
- package/lib/commonjs/components/Avatar/index.js +6 -4
- package/lib/commonjs/components/Avatar/index.js.map +1 -1
- package/lib/commonjs/components/Badge/index.js.map +1 -1
- package/lib/commonjs/components/Badge/styles.js +2 -2
- package/lib/commonjs/components/BottomSheet/index.js +106 -91
- package/lib/commonjs/components/BottomSheet/index.js.map +1 -1
- package/lib/commonjs/components/BottomSheet/styles.js +1 -12
- package/lib/commonjs/components/BottomSheet/styles.js.map +1 -1
- package/lib/commonjs/components/Button/index.js.map +1 -1
- package/lib/commonjs/components/Card/index.js.map +1 -1
- package/lib/commonjs/components/ColorArea/ColorAreaPaint.js +78 -0
- package/lib/commonjs/components/ColorArea/ColorAreaPaint.js.map +1 -0
- package/lib/commonjs/components/ColorArea/ColorAreaPaint.web.js +31 -0
- package/lib/commonjs/components/ColorArea/ColorAreaPaint.web.js.map +1 -0
- package/lib/commonjs/components/ColorArea/index.js +57 -0
- package/lib/commonjs/components/ColorArea/index.js.map +1 -0
- package/lib/commonjs/components/ColorArea/styles.js +12 -0
- package/lib/commonjs/components/ColorArea/styles.js.map +1 -0
- package/lib/commonjs/components/ColorField/index.js +138 -0
- package/lib/commonjs/components/ColorField/index.js.map +1 -0
- package/lib/commonjs/components/ColorField/styles.js +14 -0
- package/lib/commonjs/components/ColorField/styles.js.map +1 -0
- package/lib/commonjs/components/ColorPicker/index.js +88 -0
- package/lib/commonjs/components/ColorPicker/index.js.map +1 -0
- package/lib/commonjs/components/ColorPicker/styles.js +22 -0
- package/lib/commonjs/components/ColorPicker/styles.js.map +1 -0
- package/lib/commonjs/components/ColorSlider/ColorSliderRailPaint.js +68 -0
- package/lib/commonjs/components/ColorSlider/ColorSliderRailPaint.js.map +1 -0
- package/lib/commonjs/components/ColorSlider/ColorSliderRailPaint.web.js +41 -0
- package/lib/commonjs/components/ColorSlider/ColorSliderRailPaint.web.js.map +1 -0
- package/lib/commonjs/components/ColorSlider/index.js +123 -0
- package/lib/commonjs/components/ColorSlider/index.js.map +1 -0
- package/lib/commonjs/components/ColorSlider/styles.js +50 -0
- package/lib/commonjs/components/ColorSlider/styles.js.map +1 -0
- package/lib/commonjs/components/ColorSwatch/index.js +54 -0
- package/lib/commonjs/components/ColorSwatch/index.js.map +1 -0
- package/lib/commonjs/components/ColorSwatch/styles.js +25 -0
- package/lib/commonjs/components/ColorSwatch/styles.js.map +1 -0
- package/lib/commonjs/components/ColorSwatchPicker/index.js +110 -0
- package/lib/commonjs/components/ColorSwatchPicker/index.js.map +1 -0
- package/lib/commonjs/components/ColorSwatchPicker/styles.js +17 -0
- package/lib/commonjs/components/ColorSwatchPicker/styles.js.map +1 -0
- package/lib/commonjs/components/Dialog/index.js.map +1 -1
- package/lib/commonjs/components/Divider/index.js.map +1 -1
- package/lib/commonjs/components/Form/styles.js +1 -1
- package/lib/commonjs/components/Form/styles.js.map +1 -1
- package/lib/commonjs/components/FullScreenDialog/animation.js +46 -0
- package/lib/commonjs/components/FullScreenDialog/animation.js.map +1 -0
- package/lib/commonjs/components/FullScreenDialog/index.js +343 -0
- package/lib/commonjs/components/FullScreenDialog/index.js.map +1 -0
- package/lib/commonjs/components/FullScreenDialog/styles.js +14 -0
- package/lib/commonjs/components/FullScreenDialog/styles.js.map +1 -0
- package/lib/commonjs/components/Heading/styles.js +3 -0
- package/lib/commonjs/components/Heading/styles.js.map +1 -1
- package/lib/commonjs/components/Icon/index.js +27 -3
- package/lib/commonjs/components/Icon/index.js.map +1 -1
- package/lib/commonjs/components/Icon/styles.js +19 -0
- package/lib/commonjs/components/Icon/styles.js.map +1 -0
- package/lib/commonjs/components/IconButton/styles.js +7 -5
- package/lib/commonjs/components/IconButton/styles.js.map +1 -1
- package/lib/commonjs/components/InsuranceDisclosure/index.js.map +1 -1
- package/lib/commonjs/components/Link/index.js.map +1 -1
- package/lib/commonjs/components/ListItem/index.js +2 -0
- package/lib/commonjs/components/ListItem/index.js.map +1 -1
- package/lib/commonjs/components/ListItem/styles.js +6 -0
- package/lib/commonjs/components/ListItem/styles.js.map +1 -1
- package/lib/commonjs/components/ProgressSegmented/index.js.map +1 -1
- package/lib/commonjs/components/Radio/index.js.map +1 -1
- package/lib/commonjs/components/ScopedTheme/index.js +11 -3
- package/lib/commonjs/components/ScopedTheme/index.js.map +1 -1
- package/lib/commonjs/components/Skeleton/index.js.map +1 -1
- package/lib/commonjs/components/Stack/HStack.js.map +1 -1
- package/lib/commonjs/components/Stack/VStack.js.map +1 -1
- package/lib/commonjs/components/Text/index.js +13 -4
- package/lib/commonjs/components/Text/index.js.map +1 -1
- package/lib/commonjs/components/Text/styles.js +39 -3
- package/lib/commonjs/components/Text/styles.js.map +1 -1
- package/lib/commonjs/components/Textarea/index.js.map +1 -1
- package/lib/commonjs/components/Tile/index.js.map +1 -1
- package/lib/commonjs/components/Toast/hooks.js +0 -1
- package/lib/commonjs/components/Toast/hooks.js.map +1 -1
- package/lib/commonjs/components/Toast/index.js +49 -18
- package/lib/commonjs/components/Toast/index.js.map +1 -1
- package/lib/commonjs/components/Toast/styles.js +49 -21
- package/lib/commonjs/components/Toast/styles.js.map +1 -1
- package/lib/commonjs/components/ToggleButton/index.js +5 -4
- package/lib/commonjs/components/ToggleButton/index.js.map +1 -1
- package/lib/commonjs/components/index.js +80 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/picker/styles.js +6 -2
- package/lib/commonjs/components/picker/styles.js.map +1 -1
- package/lib/commonjs/components/picker/surfaces.js +9 -2
- package/lib/commonjs/components/picker/surfaces.js.map +1 -1
- package/lib/commonjs/components/sheet-header/index.js +97 -0
- package/lib/commonjs/components/sheet-header/index.js.map +1 -0
- package/lib/commonjs/components/sheet-header/styles.js +28 -0
- package/lib/commonjs/components/sheet-header/styles.js.map +1 -0
- package/lib/commonjs/figma/BottomSheet.figma.js +1 -1
- package/lib/commonjs/figma/Icon.figma.js +30 -3
- package/lib/commonjs/figma/Icon.figma.js.map +1 -1
- package/lib/commonjs/figma/Text.figma.js +15 -1
- package/lib/commonjs/figma/Text.figma.js.map +1 -1
- package/lib/commonjs/providers/toast/insets-container.js +15 -3
- package/lib/commonjs/providers/toast/insets-container.js.map +1 -1
- package/lib/commonjs/providers/toast/provider.js +45 -11
- package/lib/commonjs/providers/toast/provider.js.map +1 -1
- package/lib/commonjs/styles/constants.js +14 -1
- package/lib/commonjs/styles/constants.js.map +1 -1
- package/lib/module/components/Alert/index.js.map +1 -1
- package/lib/module/components/Avatar/index.js +6 -4
- package/lib/module/components/Avatar/index.js.map +1 -1
- package/lib/module/components/Badge/index.js.map +1 -1
- package/lib/module/components/Badge/styles.js +2 -2
- package/lib/module/components/BottomSheet/index.js +110 -95
- package/lib/module/components/BottomSheet/index.js.map +1 -1
- package/lib/module/components/BottomSheet/styles.js +0 -11
- package/lib/module/components/BottomSheet/styles.js.map +1 -1
- package/lib/module/components/Button/index.js.map +1 -1
- package/lib/module/components/Card/index.js.map +1 -1
- package/lib/module/components/ColorArea/ColorAreaPaint.js +74 -0
- package/lib/module/components/ColorArea/ColorAreaPaint.js.map +1 -0
- package/lib/module/components/ColorArea/ColorAreaPaint.web.js +27 -0
- package/lib/module/components/ColorArea/ColorAreaPaint.web.js.map +1 -0
- package/lib/module/components/ColorArea/index.js +53 -0
- package/lib/module/components/ColorArea/index.js.map +1 -0
- package/lib/module/components/ColorArea/styles.js +8 -0
- package/lib/module/components/ColorArea/styles.js.map +1 -0
- package/lib/module/components/ColorField/index.js +134 -0
- package/lib/module/components/ColorField/index.js.map +1 -0
- package/lib/module/components/ColorField/styles.js +10 -0
- package/lib/module/components/ColorField/styles.js.map +1 -0
- package/lib/module/components/ColorPicker/index.js +79 -0
- package/lib/module/components/ColorPicker/index.js.map +1 -0
- package/lib/module/components/ColorPicker/styles.js +18 -0
- package/lib/module/components/ColorPicker/styles.js.map +1 -0
- package/lib/module/components/ColorSlider/ColorSliderRailPaint.js +64 -0
- package/lib/module/components/ColorSlider/ColorSliderRailPaint.js.map +1 -0
- package/lib/module/components/ColorSlider/ColorSliderRailPaint.web.js +37 -0
- package/lib/module/components/ColorSlider/ColorSliderRailPaint.web.js.map +1 -0
- package/lib/module/components/ColorSlider/index.js +119 -0
- package/lib/module/components/ColorSlider/index.js.map +1 -0
- package/lib/module/components/ColorSlider/styles.js +46 -0
- package/lib/module/components/ColorSlider/styles.js.map +1 -0
- package/lib/module/components/ColorSwatch/index.js +50 -0
- package/lib/module/components/ColorSwatch/index.js.map +1 -0
- package/lib/module/components/ColorSwatch/styles.js +21 -0
- package/lib/module/components/ColorSwatch/styles.js.map +1 -0
- package/lib/module/components/ColorSwatchPicker/index.js +106 -0
- package/lib/module/components/ColorSwatchPicker/index.js.map +1 -0
- package/lib/module/components/ColorSwatchPicker/styles.js +13 -0
- package/lib/module/components/ColorSwatchPicker/styles.js.map +1 -0
- package/lib/module/components/Dialog/index.js.map +1 -1
- package/lib/module/components/Divider/index.js.map +1 -1
- package/lib/module/components/Form/styles.js +1 -1
- package/lib/module/components/Form/styles.js.map +1 -1
- package/lib/module/components/FullScreenDialog/animation.js +41 -0
- package/lib/module/components/FullScreenDialog/animation.js.map +1 -0
- package/lib/module/components/FullScreenDialog/index.js +338 -0
- package/lib/module/components/FullScreenDialog/index.js.map +1 -0
- package/lib/module/components/FullScreenDialog/styles.js +10 -0
- package/lib/module/components/FullScreenDialog/styles.js.map +1 -0
- package/lib/module/components/Heading/styles.js +3 -0
- package/lib/module/components/Heading/styles.js.map +1 -1
- package/lib/module/components/Icon/index.js +27 -3
- package/lib/module/components/Icon/index.js.map +1 -1
- package/lib/module/components/Icon/styles.js +16 -0
- package/lib/module/components/Icon/styles.js.map +1 -0
- package/lib/module/components/IconButton/styles.js +7 -4
- package/lib/module/components/IconButton/styles.js.map +1 -1
- package/lib/module/components/InsuranceDisclosure/index.js.map +1 -1
- package/lib/module/components/Link/index.js.map +1 -1
- package/lib/module/components/ListItem/index.js +2 -0
- package/lib/module/components/ListItem/index.js.map +1 -1
- package/lib/module/components/ListItem/styles.js +6 -0
- package/lib/module/components/ListItem/styles.js.map +1 -1
- package/lib/module/components/ProgressSegmented/index.js.map +1 -1
- package/lib/module/components/Radio/index.js.map +1 -1
- package/lib/module/components/ScopedTheme/index.js +11 -3
- package/lib/module/components/ScopedTheme/index.js.map +1 -1
- package/lib/module/components/Skeleton/index.js.map +1 -1
- package/lib/module/components/Stack/HStack.js.map +1 -1
- package/lib/module/components/Stack/VStack.js.map +1 -1
- package/lib/module/components/Text/index.js +14 -5
- package/lib/module/components/Text/index.js.map +1 -1
- package/lib/module/components/Text/styles.js +38 -2
- package/lib/module/components/Text/styles.js.map +1 -1
- package/lib/module/components/Textarea/index.js.map +1 -1
- package/lib/module/components/Tile/index.js.map +1 -1
- package/lib/module/components/Toast/hooks.js +0 -1
- package/lib/module/components/Toast/hooks.js.map +1 -1
- package/lib/module/components/Toast/index.js +52 -21
- package/lib/module/components/Toast/index.js.map +1 -1
- package/lib/module/components/Toast/styles.js +48 -21
- package/lib/module/components/Toast/styles.js.map +1 -1
- package/lib/module/components/ToggleButton/index.js +3 -3
- package/lib/module/components/ToggleButton/index.js.map +1 -1
- package/lib/module/components/index.js +7 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/picker/styles.js +6 -2
- package/lib/module/components/picker/styles.js.map +1 -1
- package/lib/module/components/picker/surfaces.js +10 -3
- package/lib/module/components/picker/surfaces.js.map +1 -1
- package/lib/module/components/sheet-header/index.js +94 -0
- package/lib/module/components/sheet-header/index.js.map +1 -0
- package/lib/module/components/sheet-header/styles.js +25 -0
- package/lib/module/components/sheet-header/styles.js.map +1 -0
- package/lib/module/figma/BottomSheet.figma.js +1 -1
- package/lib/module/figma/Icon.figma.js +30 -3
- package/lib/module/figma/Icon.figma.js.map +1 -1
- package/lib/module/figma/Text.figma.js +15 -1
- package/lib/module/figma/Text.figma.js.map +1 -1
- package/lib/module/providers/toast/insets-container.js +15 -4
- package/lib/module/providers/toast/insets-container.js.map +1 -1
- package/lib/module/providers/toast/provider.js +46 -12
- package/lib/module/providers/toast/provider.js.map +1 -1
- package/lib/module/styles/constants.js +13 -0
- package/lib/module/styles/constants.js.map +1 -1
- package/lib/typescript/components/Alert/index.d.ts +5 -2
- package/lib/typescript/components/Alert/index.d.ts.map +1 -1
- package/lib/typescript/components/Avatar/index.d.ts +11 -5
- package/lib/typescript/components/Avatar/index.d.ts.map +1 -1
- package/lib/typescript/components/Badge/index.d.ts +34 -0
- package/lib/typescript/components/Badge/index.d.ts.map +1 -1
- package/lib/typescript/components/Badge/styles.d.ts +3 -3
- package/lib/typescript/components/BottomSheet/index.d.ts +12 -1
- package/lib/typescript/components/BottomSheet/index.d.ts.map +1 -1
- package/lib/typescript/components/BottomSheet/styles.d.ts +0 -5
- package/lib/typescript/components/BottomSheet/styles.d.ts.map +1 -1
- package/lib/typescript/components/Breadcrumbs/styles.d.ts +1 -1
- package/lib/typescript/components/Button/index.d.ts +10 -2
- package/lib/typescript/components/Button/index.d.ts.map +1 -1
- package/lib/typescript/components/Button/styles.d.ts +4 -4
- package/lib/typescript/components/Card/index.d.ts +14 -0
- package/lib/typescript/components/Card/index.d.ts.map +1 -1
- package/lib/typescript/components/Checkbox/index.d.ts +1 -1
- package/lib/typescript/components/Checkbox/index.d.ts.map +1 -1
- package/lib/typescript/components/Chip/index.d.ts +2 -2
- package/lib/typescript/components/Chip/index.d.ts.map +1 -1
- package/lib/typescript/components/Chip/styles.d.ts +3 -3
- package/lib/typescript/components/ColorArea/ColorAreaPaint.d.ts +5 -0
- package/lib/typescript/components/ColorArea/ColorAreaPaint.d.ts.map +1 -0
- package/lib/typescript/components/ColorArea/ColorAreaPaint.web.d.ts +5 -0
- package/lib/typescript/components/ColorArea/ColorAreaPaint.web.d.ts.map +1 -0
- package/lib/typescript/components/ColorArea/index.d.ts +20 -0
- package/lib/typescript/components/ColorArea/index.d.ts.map +1 -0
- package/lib/typescript/components/ColorArea/styles.d.ts +4 -0
- package/lib/typescript/components/ColorArea/styles.d.ts.map +1 -0
- package/lib/typescript/components/ColorField/index.d.ts +41 -0
- package/lib/typescript/components/ColorField/index.d.ts.map +1 -0
- package/lib/typescript/components/ColorField/styles.d.ts +13 -0
- package/lib/typescript/components/ColorField/styles.d.ts.map +1 -0
- package/lib/typescript/components/ColorPicker/index.d.ts +28 -0
- package/lib/typescript/components/ColorPicker/index.d.ts.map +1 -0
- package/lib/typescript/components/ColorPicker/styles.d.ts +9 -0
- package/lib/typescript/components/ColorPicker/styles.d.ts.map +1 -0
- package/lib/typescript/components/ColorSlider/ColorSliderRailPaint.d.ts +5 -0
- package/lib/typescript/components/ColorSlider/ColorSliderRailPaint.d.ts.map +1 -0
- package/lib/typescript/components/ColorSlider/ColorSliderRailPaint.web.d.ts +5 -0
- package/lib/typescript/components/ColorSlider/ColorSliderRailPaint.web.d.ts.map +1 -0
- package/lib/typescript/components/ColorSlider/index.d.ts +33 -0
- package/lib/typescript/components/ColorSlider/index.d.ts.map +1 -0
- package/lib/typescript/components/ColorSlider/styles.d.ts +14 -0
- package/lib/typescript/components/ColorSlider/styles.d.ts.map +1 -0
- package/lib/typescript/components/ColorSwatch/index.d.ts +19 -0
- package/lib/typescript/components/ColorSwatch/index.d.ts.map +1 -0
- package/lib/typescript/components/ColorSwatch/styles.d.ts +7 -0
- package/lib/typescript/components/ColorSwatch/styles.d.ts.map +1 -0
- package/lib/typescript/components/ColorSwatchPicker/index.d.ts +37 -0
- package/lib/typescript/components/ColorSwatchPicker/index.d.ts.map +1 -0
- package/lib/typescript/components/ColorSwatchPicker/styles.d.ts +5 -0
- package/lib/typescript/components/ColorSwatchPicker/styles.d.ts.map +1 -0
- package/lib/typescript/components/CurrencyInput/index.d.ts +2 -2
- package/lib/typescript/components/CurrencyInput/index.d.ts.map +1 -1
- package/lib/typescript/components/Dialog/index.d.ts +10 -0
- package/lib/typescript/components/Dialog/index.d.ts.map +1 -1
- package/lib/typescript/components/Dialog/styles.d.ts +1 -0
- package/lib/typescript/components/Dialog/styles.d.ts.map +1 -1
- package/lib/typescript/components/Divider/index.d.ts +6 -1
- package/lib/typescript/components/Divider/index.d.ts.map +1 -1
- package/lib/typescript/components/Drawer/styles.d.ts +1 -1
- package/lib/typescript/components/Form/styles.d.ts.map +1 -1
- package/lib/typescript/components/FullScreenDialog/animation.d.ts +9 -0
- package/lib/typescript/components/FullScreenDialog/animation.d.ts.map +1 -0
- package/lib/typescript/components/FullScreenDialog/index.d.ts +85 -0
- package/lib/typescript/components/FullScreenDialog/index.d.ts.map +1 -0
- package/lib/typescript/components/FullScreenDialog/styles.d.ts +6 -0
- package/lib/typescript/components/FullScreenDialog/styles.d.ts.map +1 -0
- package/lib/typescript/components/Heading/styles.d.ts.map +1 -1
- package/lib/typescript/components/Icon/index.d.ts +14 -22
- package/lib/typescript/components/Icon/index.d.ts.map +1 -1
- package/lib/typescript/components/Icon/styles.d.ts +6 -0
- package/lib/typescript/components/Icon/styles.d.ts.map +1 -0
- package/lib/typescript/components/IconButton/styles.d.ts +7 -2
- package/lib/typescript/components/IconButton/styles.d.ts.map +1 -1
- package/lib/typescript/components/Input/index.d.ts +2 -2
- package/lib/typescript/components/Input/index.d.ts.map +1 -1
- package/lib/typescript/components/InsuranceDisclosure/index.d.ts +1 -0
- package/lib/typescript/components/InsuranceDisclosure/index.d.ts.map +1 -1
- package/lib/typescript/components/Link/index.d.ts +3 -1
- package/lib/typescript/components/Link/index.d.ts.map +1 -1
- package/lib/typescript/components/ListItem/index.d.ts +43 -4
- package/lib/typescript/components/ListItem/index.d.ts.map +1 -1
- package/lib/typescript/components/ListItem/styles.d.ts +2 -0
- package/lib/typescript/components/ListItem/styles.d.ts.map +1 -1
- package/lib/typescript/components/Menu/index.d.ts +2 -2
- package/lib/typescript/components/Menu/index.d.ts.map +1 -1
- package/lib/typescript/components/ProgressSegmented/index.d.ts +10 -3
- package/lib/typescript/components/ProgressSegmented/index.d.ts.map +1 -1
- package/lib/typescript/components/Radio/index.d.ts +1 -0
- package/lib/typescript/components/Radio/index.d.ts.map +1 -1
- package/lib/typescript/components/ScopedTheme/index.d.ts +11 -3
- package/lib/typescript/components/ScopedTheme/index.d.ts.map +1 -1
- package/lib/typescript/components/Select/index.d.ts +1 -1
- package/lib/typescript/components/Select/index.d.ts.map +1 -1
- package/lib/typescript/components/Skeleton/index.d.ts +5 -1
- package/lib/typescript/components/Skeleton/index.d.ts.map +1 -1
- package/lib/typescript/components/Slider/styles.d.ts +3 -3
- package/lib/typescript/components/Stack/HStack.d.ts +6 -0
- package/lib/typescript/components/Stack/HStack.d.ts.map +1 -1
- package/lib/typescript/components/Stack/VStack.d.ts +6 -0
- package/lib/typescript/components/Stack/VStack.d.ts.map +1 -1
- package/lib/typescript/components/Switch/index.d.ts +1 -1
- package/lib/typescript/components/Tabs/index.d.ts +2 -2
- package/lib/typescript/components/Text/index.d.ts +40 -3
- package/lib/typescript/components/Text/index.d.ts.map +1 -1
- package/lib/typescript/components/Text/styles.d.ts +9 -0
- package/lib/typescript/components/Text/styles.d.ts.map +1 -1
- package/lib/typescript/components/Textarea/index.d.ts +1 -0
- package/lib/typescript/components/Textarea/index.d.ts.map +1 -1
- package/lib/typescript/components/Tile/index.d.ts +49 -0
- package/lib/typescript/components/Tile/index.d.ts.map +1 -1
- package/lib/typescript/components/Toast/hooks.d.ts +1 -1
- package/lib/typescript/components/Toast/hooks.d.ts.map +1 -1
- package/lib/typescript/components/Toast/index.d.ts +15 -0
- package/lib/typescript/components/Toast/index.d.ts.map +1 -1
- package/lib/typescript/components/Toast/styles.d.ts +14 -0
- package/lib/typescript/components/Toast/styles.d.ts.map +1 -1
- package/lib/typescript/components/Toast/types.d.ts +10 -1
- package/lib/typescript/components/Toast/types.d.ts.map +1 -1
- package/lib/typescript/components/ToggleButton/index.d.ts +5 -3
- package/lib/typescript/components/ToggleButton/index.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +7 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/components/picker/styles.d.ts +5 -2
- package/lib/typescript/components/picker/styles.d.ts.map +1 -1
- package/lib/typescript/components/picker/surfaces.d.ts +5 -1
- package/lib/typescript/components/picker/surfaces.d.ts.map +1 -1
- package/lib/typescript/components/sheet-header/index.d.ts +24 -0
- package/lib/typescript/components/sheet-header/index.d.ts.map +1 -0
- package/lib/typescript/components/sheet-header/styles.d.ts +12 -0
- package/lib/typescript/components/sheet-header/styles.d.ts.map +1 -0
- package/lib/typescript/figma/Icon.figma.d.ts.map +1 -1
- package/lib/typescript/figma/Text.figma.d.ts.map +1 -1
- package/lib/typescript/providers/toast/insets-container.d.ts +12 -0
- package/lib/typescript/providers/toast/insets-container.d.ts.map +1 -1
- package/lib/typescript/providers/toast/provider.d.ts +1 -1
- package/lib/typescript/providers/toast/provider.d.ts.map +1 -1
- package/lib/typescript/providers/toast/types.d.ts +21 -4
- package/lib/typescript/providers/toast/types.d.ts.map +1 -1
- package/lib/typescript/styles/constants.d.ts +10 -0
- package/lib/typescript/styles/constants.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/components/Alert/index.tsx +5 -2
- package/src/components/Avatar/index.tsx +11 -5
- package/src/components/Badge/index.tsx +34 -0
- package/src/components/Badge/styles.ts +2 -2
- package/src/components/BottomSheet/index.tsx +156 -125
- package/src/components/BottomSheet/styles.ts +1 -22
- package/src/components/Button/index.tsx +10 -2
- package/src/components/Card/index.tsx +14 -0
- package/src/components/Checkbox/index.tsx +1 -1
- package/src/components/Chip/index.tsx +2 -2
- package/src/components/ColorArea/ColorAreaPaint.tsx +51 -0
- package/src/components/ColorArea/ColorAreaPaint.web.tsx +31 -0
- package/src/components/ColorArea/index.tsx +71 -0
- package/src/components/ColorArea/styles.ts +18 -0
- package/src/components/ColorField/index.tsx +181 -0
- package/src/components/ColorField/styles.ts +20 -0
- package/src/components/ColorPicker/index.tsx +110 -0
- package/src/components/ColorPicker/styles.ts +33 -0
- package/src/components/ColorSlider/ColorSliderRailPaint.tsx +60 -0
- package/src/components/ColorSlider/ColorSliderRailPaint.web.tsx +33 -0
- package/src/components/ColorSlider/index.tsx +147 -0
- package/src/components/ColorSlider/styles.ts +72 -0
- package/src/components/ColorSwatch/index.tsx +56 -0
- package/src/components/ColorSwatch/styles.ts +24 -0
- package/src/components/ColorSwatchPicker/index.tsx +150 -0
- package/src/components/ColorSwatchPicker/styles.ts +32 -0
- package/src/components/CurrencyInput/index.tsx +2 -2
- package/src/components/Dialog/index.tsx +10 -0
- package/src/components/Dialog/styles.ts +1 -0
- package/src/components/Divider/index.tsx +6 -1
- package/src/components/Form/styles.ts +1 -1
- package/src/components/FullScreenDialog/animation.ts +22 -0
- package/src/components/FullScreenDialog/index.tsx +484 -0
- package/src/components/FullScreenDialog/styles.ts +23 -0
- package/src/components/Heading/styles.ts +3 -0
- package/src/components/Icon/index.tsx +46 -6
- package/src/components/Icon/styles.ts +15 -0
- package/src/components/IconButton/styles.ts +7 -4
- package/src/components/Input/index.tsx +2 -2
- package/src/components/InsuranceDisclosure/index.tsx +1 -0
- package/src/components/Link/index.tsx +3 -1
- package/src/components/ListItem/index.tsx +48 -4
- package/src/components/ListItem/styles.ts +7 -0
- package/src/components/Menu/index.tsx +2 -2
- package/src/components/ProgressSegmented/index.tsx +10 -3
- package/src/components/Radio/index.tsx +1 -0
- package/src/components/ScopedTheme/index.tsx +11 -3
- package/src/components/Select/index.tsx +1 -1
- package/src/components/Skeleton/index.tsx +5 -1
- package/src/components/Stack/HStack.tsx +6 -0
- package/src/components/Stack/VStack.tsx +6 -0
- package/src/components/Switch/index.tsx +1 -1
- package/src/components/Tabs/index.tsx +2 -2
- package/src/components/Text/index.tsx +32 -5
- package/src/components/Text/styles.ts +39 -1
- package/src/components/Textarea/index.tsx +1 -0
- package/src/components/Tile/index.tsx +49 -0
- package/src/components/Toast/hooks.ts +0 -1
- package/src/components/Toast/index.tsx +69 -17
- package/src/components/Toast/styles.ts +60 -21
- package/src/components/Toast/types.ts +10 -1
- package/src/components/ToggleButton/index.tsx +9 -7
- package/src/components/index.ts +7 -0
- package/src/components/picker/styles.ts +6 -2
- package/src/components/picker/surfaces.tsx +15 -2
- package/src/components/sheet-header/index.tsx +148 -0
- package/src/components/sheet-header/styles.ts +28 -0
- package/src/providers/toast/insets-container.tsx +23 -9
- package/src/providers/toast/provider.tsx +49 -15
- package/src/providers/toast/types.ts +21 -4
- package/src/styles/constants.ts +13 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { forwardRef, useMemo, type ReactNode } from 'react';
|
|
2
|
+
import { TextInput, View, type ViewProps } from 'react-native';
|
|
3
|
+
import {
|
|
4
|
+
ColorFieldInput as ColorFieldInputPrimitive,
|
|
5
|
+
ColorFieldRoot as ColorFieldRootPrimitive,
|
|
6
|
+
InputRoot as InputRootPrimitive,
|
|
7
|
+
Slot,
|
|
8
|
+
dataAttributes,
|
|
9
|
+
mergeDataAttributes,
|
|
10
|
+
useColorFieldContext,
|
|
11
|
+
type ColorFieldInputProps as ColorFieldInputPrimitiveProps,
|
|
12
|
+
type ColorFieldRootProps as ColorFieldRootPrimitiveProps,
|
|
13
|
+
} from '@cdx-ui/primitives';
|
|
14
|
+
import { cn, ParentContext, useParentContext } from '@cdx-ui/utils';
|
|
15
|
+
import { positionToDataIcon, type IconSlotPosition } from '../../utils/positionToDataIcon';
|
|
16
|
+
import {
|
|
17
|
+
colorFieldGroupVariants,
|
|
18
|
+
colorFieldInputPlaceholderVariants,
|
|
19
|
+
colorFieldInputVariants,
|
|
20
|
+
colorFieldSlotVariants,
|
|
21
|
+
colorFieldVariants,
|
|
22
|
+
type ColorFieldGroupVariantProps,
|
|
23
|
+
} from './styles';
|
|
24
|
+
|
|
25
|
+
const SCOPE = 'COLOR_FIELD';
|
|
26
|
+
|
|
27
|
+
type ColorFieldStyleContext = ColorFieldGroupVariantProps & {
|
|
28
|
+
readonly fullWidth?: boolean;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const useColorFieldStyleContext = (): ColorFieldStyleContext =>
|
|
32
|
+
(useParentContext()[SCOPE] as ColorFieldStyleContext | undefined) ?? {};
|
|
33
|
+
|
|
34
|
+
export type ColorFieldProps = ColorFieldRootPrimitiveProps &
|
|
35
|
+
ColorFieldGroupVariantProps & {
|
|
36
|
+
readonly className?: string;
|
|
37
|
+
/** When true (the default), the group stretches to fill its container. */
|
|
38
|
+
readonly fullWidth?: boolean;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const ColorFieldRoot = forwardRef<View, ColorFieldProps>(
|
|
42
|
+
(
|
|
43
|
+
{ variant = 'outline', size = 'default', fullWidth, className, children, style, ...props },
|
|
44
|
+
ref,
|
|
45
|
+
) => {
|
|
46
|
+
const parent = useParentContext();
|
|
47
|
+
const context = useMemo(
|
|
48
|
+
() => ({ ...parent, [SCOPE]: { variant, size, fullWidth } }),
|
|
49
|
+
[fullWidth, parent, size, variant],
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<ParentContext.Provider value={context}>
|
|
54
|
+
<ColorFieldRootPrimitive
|
|
55
|
+
ref={ref}
|
|
56
|
+
className={cn(colorFieldVariants(), className)}
|
|
57
|
+
style={style}
|
|
58
|
+
{...props}
|
|
59
|
+
{...mergeDataAttributes(props, dataAttributes({ slot: 'color-field' }))}
|
|
60
|
+
>
|
|
61
|
+
{children}
|
|
62
|
+
</ColorFieldRootPrimitive>
|
|
63
|
+
</ParentContext.Provider>
|
|
64
|
+
);
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
ColorFieldRoot.displayName = 'ColorField';
|
|
69
|
+
|
|
70
|
+
export interface ColorFieldGroupProps extends ViewProps, ColorFieldGroupVariantProps {
|
|
71
|
+
readonly asChild?: boolean;
|
|
72
|
+
readonly className?: string;
|
|
73
|
+
readonly children?: ReactNode;
|
|
74
|
+
readonly fullWidth?: boolean;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const ColorFieldGroup = forwardRef<View, ColorFieldGroupProps>(
|
|
78
|
+
({ asChild, variant, size, fullWidth, className, children, style, ...props }, ref) => {
|
|
79
|
+
const inherited = useColorFieldStyleContext();
|
|
80
|
+
const { disabled, invalid, readOnly, required } = useColorFieldContext();
|
|
81
|
+
const resolvedVariant = variant ?? inherited.variant ?? 'outline';
|
|
82
|
+
const resolvedSize = size ?? inherited.size ?? 'default';
|
|
83
|
+
const resolvedFullWidth = fullWidth ?? inherited.fullWidth ?? true;
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<InputRootPrimitive
|
|
87
|
+
ref={ref}
|
|
88
|
+
asChild={asChild}
|
|
89
|
+
isDisabled={disabled}
|
|
90
|
+
isInvalid={invalid}
|
|
91
|
+
isReadOnly={readOnly}
|
|
92
|
+
isRequired={required}
|
|
93
|
+
className={cn(
|
|
94
|
+
colorFieldGroupVariants({
|
|
95
|
+
variant: resolvedVariant,
|
|
96
|
+
size: resolvedSize,
|
|
97
|
+
}),
|
|
98
|
+
!resolvedFullWidth && 'w-auto self-start',
|
|
99
|
+
className,
|
|
100
|
+
)}
|
|
101
|
+
style={style}
|
|
102
|
+
{...props}
|
|
103
|
+
{...mergeDataAttributes(props, dataAttributes({ slot: 'color-field-group' }))}
|
|
104
|
+
>
|
|
105
|
+
{children}
|
|
106
|
+
</InputRootPrimitive>
|
|
107
|
+
);
|
|
108
|
+
},
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
ColorFieldGroup.displayName = 'ColorField.Group';
|
|
112
|
+
|
|
113
|
+
export type ColorFieldInputProps = ColorFieldInputPrimitiveProps & {
|
|
114
|
+
readonly className?: string;
|
|
115
|
+
readonly placeholderTextColorClassName?: string;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const ColorFieldInput = forwardRef<TextInput, ColorFieldInputProps>(
|
|
119
|
+
({ className, placeholderTextColorClassName, style, ...props }, ref) => {
|
|
120
|
+
const { size } = useColorFieldStyleContext();
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<ColorFieldInputPrimitive
|
|
124
|
+
ref={ref}
|
|
125
|
+
className={cn(colorFieldInputVariants({ size: size ?? 'default' }), className)}
|
|
126
|
+
placeholderTextColorClassName={cn(
|
|
127
|
+
colorFieldInputPlaceholderVariants(),
|
|
128
|
+
placeholderTextColorClassName,
|
|
129
|
+
)}
|
|
130
|
+
style={style}
|
|
131
|
+
{...props}
|
|
132
|
+
{...mergeDataAttributes(props, dataAttributes({ slot: 'color-field-input' }))}
|
|
133
|
+
/>
|
|
134
|
+
);
|
|
135
|
+
},
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
ColorFieldInput.displayName = 'ColorField.Input';
|
|
139
|
+
|
|
140
|
+
export interface ColorFieldSlotProps extends ViewProps {
|
|
141
|
+
readonly asChild?: boolean;
|
|
142
|
+
readonly className?: string;
|
|
143
|
+
readonly children?: ReactNode;
|
|
144
|
+
readonly position?: IconSlotPosition;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const ColorFieldSlot = forwardRef<View, ColorFieldSlotProps>(
|
|
148
|
+
({ asChild, position, className, children, style, ...props }, ref) => {
|
|
149
|
+
const Comp = asChild ? Slot : View;
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<Comp
|
|
153
|
+
ref={ref}
|
|
154
|
+
className={cn(colorFieldSlotVariants(), className)}
|
|
155
|
+
style={style}
|
|
156
|
+
{...props}
|
|
157
|
+
{...mergeDataAttributes(
|
|
158
|
+
props,
|
|
159
|
+
dataAttributes({ slot: 'color-field-slot' }),
|
|
160
|
+
positionToDataIcon(position),
|
|
161
|
+
)}
|
|
162
|
+
>
|
|
163
|
+
{children}
|
|
164
|
+
</Comp>
|
|
165
|
+
);
|
|
166
|
+
},
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
ColorFieldSlot.displayName = 'ColorField.Slot';
|
|
170
|
+
|
|
171
|
+
type ColorFieldCompoundComponent = typeof ColorFieldRoot & {
|
|
172
|
+
Group: typeof ColorFieldGroup;
|
|
173
|
+
Input: typeof ColorFieldInput;
|
|
174
|
+
Slot: typeof ColorFieldSlot;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export const ColorField = Object.assign(ColorFieldRoot, {
|
|
178
|
+
Group: ColorFieldGroup,
|
|
179
|
+
Input: ColorFieldInput,
|
|
180
|
+
Slot: ColorFieldSlot,
|
|
181
|
+
}) as ColorFieldCompoundComponent;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { cva } from '@cdx-ui/utils';
|
|
2
|
+
import {
|
|
3
|
+
inputFieldPlaceholderVariants,
|
|
4
|
+
inputFieldVariants,
|
|
5
|
+
inputRootVariants,
|
|
6
|
+
inputSlotVariants,
|
|
7
|
+
type InputVariantProps,
|
|
8
|
+
} from '../Input/styles';
|
|
9
|
+
|
|
10
|
+
export const colorFieldVariants = cva('gap-1.5');
|
|
11
|
+
|
|
12
|
+
export const colorFieldGroupVariants = inputRootVariants;
|
|
13
|
+
|
|
14
|
+
export const colorFieldInputVariants = inputFieldVariants;
|
|
15
|
+
|
|
16
|
+
export const colorFieldInputPlaceholderVariants = inputFieldPlaceholderVariants;
|
|
17
|
+
|
|
18
|
+
export const colorFieldSlotVariants = inputSlotVariants;
|
|
19
|
+
|
|
20
|
+
export type ColorFieldGroupVariantProps = InputVariantProps;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { forwardRef, type ReactNode } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import {
|
|
4
|
+
ColorPickerProvider,
|
|
5
|
+
ColorPickerRoot as ColorPickerRootPrimitive,
|
|
6
|
+
ColorPickerRootProvider,
|
|
7
|
+
ColorPickerTrigger as ColorPickerTriggerPrimitive,
|
|
8
|
+
dataAttributes,
|
|
9
|
+
mergeDataAttributes,
|
|
10
|
+
useColorPickerRootContext,
|
|
11
|
+
type ColorPickerRootProps as ColorPickerRootPrimitiveProps,
|
|
12
|
+
type ColorPickerTriggerProps as ColorPickerTriggerPrimitiveProps,
|
|
13
|
+
} from '@cdx-ui/primitives';
|
|
14
|
+
import { cn } from '@cdx-ui/utils';
|
|
15
|
+
import { PickerPopoverSurface } from '../picker/surfaces';
|
|
16
|
+
import {
|
|
17
|
+
colorPickerPopoverContentVariants,
|
|
18
|
+
colorPickerPopoverVariants,
|
|
19
|
+
colorPickerTriggerVariants,
|
|
20
|
+
colorPickerVariants,
|
|
21
|
+
} from './styles';
|
|
22
|
+
|
|
23
|
+
export interface ColorPickerProps extends ColorPickerRootPrimitiveProps {
|
|
24
|
+
readonly className?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const ColorPickerRoot = forwardRef<View, ColorPickerProps>(
|
|
28
|
+
({ asChild, className, style, children, ...props }, ref) => (
|
|
29
|
+
<ColorPickerRootPrimitive
|
|
30
|
+
ref={ref}
|
|
31
|
+
asChild={asChild}
|
|
32
|
+
className={cn(colorPickerVariants(), className)}
|
|
33
|
+
style={style}
|
|
34
|
+
{...props}
|
|
35
|
+
{...mergeDataAttributes(props, dataAttributes({ slot: 'color-picker' }))}
|
|
36
|
+
>
|
|
37
|
+
{children}
|
|
38
|
+
</ColorPickerRootPrimitive>
|
|
39
|
+
),
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
ColorPickerRoot.displayName = 'ColorPicker';
|
|
43
|
+
|
|
44
|
+
export interface ColorPickerTriggerProps extends ColorPickerTriggerPrimitiveProps {
|
|
45
|
+
readonly className?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const ColorPickerTrigger = forwardRef<View, ColorPickerTriggerProps>(
|
|
49
|
+
({ asChild, className, style, children, ...props }, ref) => (
|
|
50
|
+
<ColorPickerTriggerPrimitive
|
|
51
|
+
ref={ref}
|
|
52
|
+
asChild={asChild}
|
|
53
|
+
className={asChild ? className : cn(colorPickerTriggerVariants(), className)}
|
|
54
|
+
style={style}
|
|
55
|
+
{...props}
|
|
56
|
+
{...mergeDataAttributes(props, dataAttributes({ slot: 'color-picker-trigger' }))}
|
|
57
|
+
>
|
|
58
|
+
{children}
|
|
59
|
+
</ColorPickerTriggerPrimitive>
|
|
60
|
+
),
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
ColorPickerTrigger.displayName = 'ColorPicker.Trigger';
|
|
64
|
+
|
|
65
|
+
export interface ColorPickerPopoverProps {
|
|
66
|
+
readonly className?: string;
|
|
67
|
+
readonly contentClassName?: string;
|
|
68
|
+
readonly children: ReactNode;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const registerPopoverSurface = (type: 'popover') => {
|
|
72
|
+
void type;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
function ColorPickerPopover({ className, contentClassName, children }: ColorPickerPopoverProps) {
|
|
76
|
+
const context = useColorPickerRootContext();
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<PickerPopoverSurface
|
|
80
|
+
open={context.open}
|
|
81
|
+
setOpen={context.setOpen}
|
|
82
|
+
registerSurface={registerPopoverSurface}
|
|
83
|
+
anchorRef={context.anchorRef}
|
|
84
|
+
triggerRef={context.triggerRef}
|
|
85
|
+
className={cn(colorPickerPopoverVariants(), className)}
|
|
86
|
+
contentClassName={cn(colorPickerPopoverContentVariants(), contentClassName)}
|
|
87
|
+
dataSlot="color-picker-popover"
|
|
88
|
+
width="content"
|
|
89
|
+
>
|
|
90
|
+
<ColorPickerRootProvider value={context}>
|
|
91
|
+
<ColorPickerProvider value={context}>{children}</ColorPickerProvider>
|
|
92
|
+
</ColorPickerRootProvider>
|
|
93
|
+
</PickerPopoverSurface>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
ColorPickerPopover.displayName = 'ColorPicker.Popover';
|
|
98
|
+
|
|
99
|
+
type ColorPickerCompoundComponent = typeof ColorPickerRoot & {
|
|
100
|
+
Trigger: typeof ColorPickerTrigger;
|
|
101
|
+
Popover: typeof ColorPickerPopover;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export const ColorPicker = Object.assign(ColorPickerRoot, {
|
|
105
|
+
Trigger: ColorPickerTrigger,
|
|
106
|
+
Popover: ColorPickerPopover,
|
|
107
|
+
}) as ColorPickerCompoundComponent;
|
|
108
|
+
|
|
109
|
+
export { parseColor } from '@cdx-ui/primitives';
|
|
110
|
+
export type { Color } from '@cdx-ui/primitives';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import { cva } from '@cdx-ui/utils';
|
|
3
|
+
import { DISABLED_CURSOR, TRANSITION_COLORS } from '../../styles/constants';
|
|
4
|
+
|
|
5
|
+
export const colorPickerVariants = cva(['items-start gap-2']);
|
|
6
|
+
|
|
7
|
+
export const colorPickerTriggerVariants = cva([
|
|
8
|
+
'h-10 self-start flex-row items-center justify-center gap-2 px-3',
|
|
9
|
+
'rounded-[var(--border-radius-button)]',
|
|
10
|
+
'border border-stroke-action bg-transparent',
|
|
11
|
+
TRANSITION_COLORS,
|
|
12
|
+
'data-[disabled=true]:opacity-[var(--opacity-disabled)]',
|
|
13
|
+
DISABLED_CURSOR,
|
|
14
|
+
'web:outline-none web:focus:outline-none web:focus-visible:outline-none',
|
|
15
|
+
'web:data-[focus-visible=true]:ring-2',
|
|
16
|
+
'web:data-[focus-visible=true]:ring-stroke-focus',
|
|
17
|
+
'web:data-[focus-visible=true]:ring-offset-2',
|
|
18
|
+
Platform.select({
|
|
19
|
+
default: 'data-[active=true]:bg-surface-action-tint-active',
|
|
20
|
+
web: [
|
|
21
|
+
'data-[hover=true]:bg-surface-action-tint-hover',
|
|
22
|
+
'data-[active=true]:data-[hover=true]:bg-surface-action-tint-active',
|
|
23
|
+
].join(' '),
|
|
24
|
+
}),
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Padding lives on the scroll content, not the popover: the popover's `ScrollView` clips at its
|
|
29
|
+
* own bounds, and slider/area thumbs overhang their track ends by half a thumb plus shadow.
|
|
30
|
+
*/
|
|
31
|
+
export const colorPickerPopoverVariants = cva(['w-80 p-0']);
|
|
32
|
+
|
|
33
|
+
export const colorPickerPopoverContentVariants = cva(['gap-3 p-4']);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useId } from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import { Defs, LinearGradient, Rect, Stop, Svg } from 'react-native-svg';
|
|
4
|
+
import { useColorSliderContext } from '@cdx-ui/primitives';
|
|
5
|
+
import { colorSliderRailPaintVariants } from './styles';
|
|
6
|
+
|
|
7
|
+
function getStopOffset(index: number, count: number, railSize: number, endCap: number): string {
|
|
8
|
+
const ratio = index / (count - 1);
|
|
9
|
+
if (railSize <= 0 || endCap <= 0) {
|
|
10
|
+
return `${String(ratio * 100)}%`;
|
|
11
|
+
}
|
|
12
|
+
return `${String(((endCap + ratio * railSize) / (railSize + 2 * endCap)) * 100)}%`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function ColorSliderRailPaint() {
|
|
16
|
+
const { gradientColors, orientation, layout, thumbSize } = useColorSliderContext();
|
|
17
|
+
const gradientId = useId();
|
|
18
|
+
const isVertical = orientation === 'vertical';
|
|
19
|
+
const railSize = (isVertical ? layout?.height : layout?.width) ?? 0;
|
|
20
|
+
const endCap = (isVertical ? thumbSize.height : thumbSize.width) / 2;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<View
|
|
24
|
+
className={colorSliderRailPaintVariants({ orientation })}
|
|
25
|
+
style={styles.paint}
|
|
26
|
+
accessible={false}
|
|
27
|
+
accessibilityElementsHidden
|
|
28
|
+
importantForAccessibility="no-hide-descendants"
|
|
29
|
+
>
|
|
30
|
+
<Svg width="100%" height="100%">
|
|
31
|
+
<Defs>
|
|
32
|
+
<LinearGradient
|
|
33
|
+
id={gradientId}
|
|
34
|
+
x1="0%"
|
|
35
|
+
y1={orientation === 'vertical' ? '100%' : '0%'}
|
|
36
|
+
x2={orientation === 'horizontal' ? '100%' : '0%'}
|
|
37
|
+
y2="0%"
|
|
38
|
+
>
|
|
39
|
+
{gradientColors.map((color, index) => (
|
|
40
|
+
<Stop
|
|
41
|
+
key={`${color}-${String(index)}`}
|
|
42
|
+
offset={getStopOffset(index, gradientColors.length, railSize, endCap)}
|
|
43
|
+
stopColor={color}
|
|
44
|
+
/>
|
|
45
|
+
))}
|
|
46
|
+
</LinearGradient>
|
|
47
|
+
</Defs>
|
|
48
|
+
<Rect width="100%" height="100%" fill={`url(#${gradientId})`} />
|
|
49
|
+
</Svg>
|
|
50
|
+
</View>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
ColorSliderRailPaint.displayName = 'ColorSliderRailPaint';
|
|
55
|
+
|
|
56
|
+
const styles = StyleSheet.create({
|
|
57
|
+
paint: {
|
|
58
|
+
pointerEvents: 'none',
|
|
59
|
+
},
|
|
60
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { View, type ViewStyle } from 'react-native';
|
|
2
|
+
import { useColorSliderContext } from '@cdx-ui/primitives';
|
|
3
|
+
import { colorSliderRailPaintVariants } from './styles';
|
|
4
|
+
|
|
5
|
+
function getGradientStops(colors: readonly string[], endCap: number): string {
|
|
6
|
+
if (endCap <= 0 || colors.length < 2) {
|
|
7
|
+
return colors.join(', ');
|
|
8
|
+
}
|
|
9
|
+
const first = `${colors[0]} ${String(endCap)}px`;
|
|
10
|
+
const last = `${colors[colors.length - 1]} calc(100% - ${String(endCap)}px)`;
|
|
11
|
+
return [first, ...colors.slice(1, -1), last].join(', ');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function ColorSliderRailPaint() {
|
|
15
|
+
const { gradientColors, orientation, thumbSize } = useColorSliderContext();
|
|
16
|
+
const direction = orientation === 'vertical' ? 'to top' : 'to right';
|
|
17
|
+
const endCap = (orientation === 'vertical' ? thumbSize.height : thumbSize.width) / 2;
|
|
18
|
+
const paintStyle = {
|
|
19
|
+
backgroundImage: `linear-gradient(${direction}, ${getGradientStops(gradientColors, endCap)})`,
|
|
20
|
+
} as unknown as ViewStyle;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<View
|
|
24
|
+
className={colorSliderRailPaintVariants({ orientation })}
|
|
25
|
+
style={paintStyle}
|
|
26
|
+
accessible={false}
|
|
27
|
+
accessibilityElementsHidden
|
|
28
|
+
importantForAccessibility="no-hide-descendants"
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
ColorSliderRailPaint.displayName = 'ColorSliderRailPaint';
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { forwardRef, type ReactNode } from 'react';
|
|
2
|
+
import { Text, View, type PressableStateCallbackType, type TextProps } from 'react-native';
|
|
3
|
+
import {
|
|
4
|
+
ColorSliderRail as ColorSliderRailPrimitive,
|
|
5
|
+
ColorSliderRoot as ColorSliderRootPrimitive,
|
|
6
|
+
ColorSliderThumb as ColorSliderThumbPrimitive,
|
|
7
|
+
Slot,
|
|
8
|
+
dataAttributes,
|
|
9
|
+
mergeDataAttributes,
|
|
10
|
+
useColorSliderContext,
|
|
11
|
+
type IColorSliderProps,
|
|
12
|
+
type IColorSliderRailProps,
|
|
13
|
+
type IColorSliderThumbProps,
|
|
14
|
+
} from '@cdx-ui/primitives';
|
|
15
|
+
import { cn } from '@cdx-ui/utils';
|
|
16
|
+
import { ColorSliderRailPaint } from './ColorSliderRailPaint';
|
|
17
|
+
import {
|
|
18
|
+
colorSliderOutputVariants,
|
|
19
|
+
colorSliderRailVariants,
|
|
20
|
+
colorSliderThumbVariants,
|
|
21
|
+
colorSliderVariants,
|
|
22
|
+
} from './styles';
|
|
23
|
+
|
|
24
|
+
export type ColorSliderProps = IColorSliderProps & {
|
|
25
|
+
readonly asChild?: boolean;
|
|
26
|
+
readonly className?: string;
|
|
27
|
+
readonly children?: ReactNode;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const ColorSliderRoot = forwardRef<View, ColorSliderProps>(
|
|
31
|
+
({ asChild, className, style, orientation = 'horizontal', children, ...props }, ref) => (
|
|
32
|
+
<ColorSliderRootPrimitive
|
|
33
|
+
ref={ref}
|
|
34
|
+
asChild={asChild}
|
|
35
|
+
className={cn(colorSliderVariants({ orientation }), className)}
|
|
36
|
+
style={style}
|
|
37
|
+
orientation={orientation}
|
|
38
|
+
{...props}
|
|
39
|
+
{...mergeDataAttributes(props, dataAttributes({ slot: 'color-slider' }))}
|
|
40
|
+
>
|
|
41
|
+
{children}
|
|
42
|
+
</ColorSliderRootPrimitive>
|
|
43
|
+
),
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
ColorSliderRoot.displayName = 'ColorSlider';
|
|
47
|
+
|
|
48
|
+
export interface ColorSliderRailProps extends IColorSliderRailProps {
|
|
49
|
+
readonly className?: string;
|
|
50
|
+
readonly children?: ReactNode;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const ColorSliderRail = forwardRef<View, ColorSliderRailProps>(
|
|
54
|
+
({ asChild, className, style, hitSlop, children, ...props }, ref) => {
|
|
55
|
+
const { orientation, thumbSize } = useColorSliderContext();
|
|
56
|
+
const endCap =
|
|
57
|
+
orientation === 'vertical'
|
|
58
|
+
? { top: thumbSize.height / 2, bottom: thumbSize.height / 2 }
|
|
59
|
+
: { left: thumbSize.width / 2, right: thumbSize.width / 2 };
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<ColorSliderRailPrimitive
|
|
63
|
+
ref={ref}
|
|
64
|
+
asChild={asChild}
|
|
65
|
+
className={cn(colorSliderRailVariants({ orientation }), className)}
|
|
66
|
+
style={style}
|
|
67
|
+
hitSlop={hitSlop ?? endCap}
|
|
68
|
+
{...props}
|
|
69
|
+
{...mergeDataAttributes(props, dataAttributes({ slot: 'color-slider-rail' }))}
|
|
70
|
+
>
|
|
71
|
+
<ColorSliderRailPaint />
|
|
72
|
+
{children}
|
|
73
|
+
</ColorSliderRailPrimitive>
|
|
74
|
+
);
|
|
75
|
+
},
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
ColorSliderRail.displayName = 'ColorSlider.Rail';
|
|
79
|
+
|
|
80
|
+
export interface ColorSliderThumbProps extends IColorSliderThumbProps {
|
|
81
|
+
readonly className?: string;
|
|
82
|
+
readonly children?: ReactNode;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const ColorSliderThumb = forwardRef<View, ColorSliderThumbProps>(
|
|
86
|
+
({ className, style, children, ...props }, ref) => {
|
|
87
|
+
const { value } = useColorSliderContext();
|
|
88
|
+
const fillStyle = { backgroundColor: value.toString('hex') };
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<ColorSliderThumbPrimitive
|
|
92
|
+
ref={ref}
|
|
93
|
+
className={cn(colorSliderThumbVariants(), className)}
|
|
94
|
+
style={
|
|
95
|
+
typeof style === 'function'
|
|
96
|
+
? (state: PressableStateCallbackType) => [fillStyle, style(state)]
|
|
97
|
+
: [fillStyle, style]
|
|
98
|
+
}
|
|
99
|
+
{...props}
|
|
100
|
+
{...mergeDataAttributes(props, dataAttributes({ slot: 'color-slider-thumb' }))}
|
|
101
|
+
>
|
|
102
|
+
{children}
|
|
103
|
+
</ColorSliderThumbPrimitive>
|
|
104
|
+
);
|
|
105
|
+
},
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
ColorSliderThumb.displayName = 'ColorSlider.Thumb';
|
|
109
|
+
|
|
110
|
+
export interface ColorSliderOutputProps extends TextProps {
|
|
111
|
+
readonly asChild?: boolean;
|
|
112
|
+
readonly className?: string;
|
|
113
|
+
readonly children?: ReactNode;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const ColorSliderOutput = forwardRef<Text, ColorSliderOutputProps>(
|
|
117
|
+
({ asChild, className, style, children, ...props }, ref) => {
|
|
118
|
+
const { valueLabel } = useColorSliderContext();
|
|
119
|
+
const Comp = asChild ? Slot : Text;
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<Comp
|
|
123
|
+
ref={ref}
|
|
124
|
+
className={cn(colorSliderOutputVariants(), className)}
|
|
125
|
+
style={style}
|
|
126
|
+
{...props}
|
|
127
|
+
{...mergeDataAttributes(props, dataAttributes({ slot: 'color-slider-output' }))}
|
|
128
|
+
>
|
|
129
|
+
{children ?? valueLabel}
|
|
130
|
+
</Comp>
|
|
131
|
+
);
|
|
132
|
+
},
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
ColorSliderOutput.displayName = 'ColorSlider.Output';
|
|
136
|
+
|
|
137
|
+
type ColorSliderCompoundComponent = typeof ColorSliderRoot & {
|
|
138
|
+
Rail: typeof ColorSliderRail;
|
|
139
|
+
Thumb: typeof ColorSliderThumb;
|
|
140
|
+
Output: typeof ColorSliderOutput;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export const ColorSlider = Object.assign(ColorSliderRoot, {
|
|
144
|
+
Rail: ColorSliderRail,
|
|
145
|
+
Thumb: ColorSliderThumb,
|
|
146
|
+
Output: ColorSliderOutput,
|
|
147
|
+
}) as ColorSliderCompoundComponent;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import { cva, type VariantProps } from '@cdx-ui/utils';
|
|
3
|
+
import { DISABLED_CURSOR } from '../../styles/constants';
|
|
4
|
+
|
|
5
|
+
export const colorSliderVariants = cva(
|
|
6
|
+
[
|
|
7
|
+
'relative select-none',
|
|
8
|
+
'data-[disabled=true]:opacity-[var(--opacity-disabled)]',
|
|
9
|
+
DISABLED_CURSOR,
|
|
10
|
+
],
|
|
11
|
+
{
|
|
12
|
+
variants: {
|
|
13
|
+
orientation: {
|
|
14
|
+
horizontal: 'w-full',
|
|
15
|
+
vertical: 'h-48',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
orientation: 'horizontal',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
// The rail inset equals the `size-5` thumb's radius so the thumb sits flush inside the pill ends.
|
|
25
|
+
export const colorSliderRailVariants = cva(['relative touch-none'], {
|
|
26
|
+
variants: {
|
|
27
|
+
orientation: {
|
|
28
|
+
horizontal: 'mx-2.5 h-5 w-auto',
|
|
29
|
+
vertical: 'my-2.5 w-5 flex-1',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
orientation: 'horizontal',
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const colorSliderRailPaintVariants = cva(
|
|
38
|
+
['absolute overflow-hidden rounded-[var(--border-radius-round)]'],
|
|
39
|
+
{
|
|
40
|
+
variants: {
|
|
41
|
+
orientation: {
|
|
42
|
+
horizontal: '-inset-x-2.5 inset-y-0',
|
|
43
|
+
vertical: '-inset-y-2.5 inset-x-0',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
defaultVariants: {
|
|
47
|
+
orientation: 'horizontal',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
export const colorSliderThumbVariants = cva([
|
|
53
|
+
'z-2 box-border size-5 rounded-[var(--border-radius-round)]',
|
|
54
|
+
'border-2 border-surface-primary shadow-md',
|
|
55
|
+
'transition-[transform,box-shadow,opacity] duration-150',
|
|
56
|
+
'data-[dragging=true]:transition-none',
|
|
57
|
+
'web:outline-none web:active:cursor-grabbing',
|
|
58
|
+
Platform.select({
|
|
59
|
+
default: 'data-[focus=true]:scale-105',
|
|
60
|
+
web: [
|
|
61
|
+
'web:cursor-grab',
|
|
62
|
+
'data-[hover=true]:scale-110',
|
|
63
|
+
'data-[dragging=true]:scale-110',
|
|
64
|
+
'data-[focus-visible=true]:ring-4',
|
|
65
|
+
'data-[focus-visible=true]:ring-stroke-focus',
|
|
66
|
+
].join(' '),
|
|
67
|
+
}),
|
|
68
|
+
]);
|
|
69
|
+
|
|
70
|
+
export const colorSliderOutputVariants = cva(['text-sm font-medium text-content-primary']);
|
|
71
|
+
|
|
72
|
+
export type ColorSliderVariantProps = VariantProps<typeof colorSliderVariants>;
|