@cdx-ui/components 0.1.7 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/coverage.svg +1 -1
- package/lib/commonjs/components/Calendar/flashCalendarAdapter.js +18 -0
- package/lib/commonjs/components/Calendar/flashCalendarAdapter.js.map +1 -1
- package/lib/commonjs/components/Calendar/index.js +32 -3
- package/lib/commonjs/components/Calendar/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/DatePicker/index.js +2 -0
- package/lib/commonjs/components/DatePicker/index.js.map +1 -1
- package/lib/commonjs/components/Field/index.js +4 -2
- package/lib/commonjs/components/Field/index.js.map +1 -1
- 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/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/Toast/hooks.js +0 -1
- package/lib/commonjs/components/Toast/hooks.js.map +1 -1
- package/lib/commonjs/components/Toast/index.js +9 -6
- package/lib/commonjs/components/Toast/index.js.map +1 -1
- package/lib/commonjs/components/Toast/styles.js +36 -19
- 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 +68 -0
- package/lib/commonjs/components/index.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/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 +1 -0
- 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/Calendar/flashCalendarAdapter.js +17 -0
- package/lib/module/components/Calendar/flashCalendarAdapter.js.map +1 -1
- package/lib/module/components/Calendar/index.js +34 -5
- package/lib/module/components/Calendar/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/DatePicker/index.js +2 -0
- package/lib/module/components/DatePicker/index.js.map +1 -1
- package/lib/module/components/Field/index.js +4 -2
- package/lib/module/components/Field/index.js.map +1 -1
- 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/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/Toast/hooks.js +0 -1
- package/lib/module/components/Toast/hooks.js.map +1 -1
- package/lib/module/components/Toast/index.js +10 -7
- package/lib/module/components/Toast/index.js.map +1 -1
- package/lib/module/components/Toast/styles.js +35 -19
- 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 +6 -0
- package/lib/module/components/index.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/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 +2 -1
- 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 +1 -1
- package/lib/typescript/components/Alert/index.d.ts.map +1 -1
- package/lib/typescript/components/Avatar/index.d.ts +1 -1
- package/lib/typescript/components/Avatar/index.d.ts.map +1 -1
- package/lib/typescript/components/Badge/styles.d.ts +3 -3
- package/lib/typescript/components/Breadcrumbs/styles.d.ts +1 -1
- package/lib/typescript/components/Button/index.d.ts +1 -1
- 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/Calendar/flashCalendarAdapter.d.ts +3 -1
- package/lib/typescript/components/Calendar/flashCalendarAdapter.d.ts.map +1 -1
- package/lib/typescript/components/Calendar/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 +1 -1
- 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/DatePicker/index.d.ts +1 -1
- package/lib/typescript/components/DatePicker/index.d.ts.map +1 -1
- package/lib/typescript/components/Divider/index.d.ts +1 -1
- package/lib/typescript/components/Divider/index.d.ts.map +1 -1
- package/lib/typescript/components/Field/index.d.ts +5 -0
- package/lib/typescript/components/Field/index.d.ts.map +1 -1
- 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 +2 -2
- package/lib/typescript/components/Input/index.d.ts +1 -1
- package/lib/typescript/components/Input/index.d.ts.map +1 -1
- package/lib/typescript/components/Link/index.d.ts +1 -1
- package/lib/typescript/components/Link/index.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/Select/index.d.ts +1 -1
- package/lib/typescript/components/Select/index.d.ts.map +1 -1
- package/lib/typescript/components/Slider/styles.d.ts +3 -3
- 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/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.map +1 -1
- package/lib/typescript/components/Toast/styles.d.ts +4 -0
- package/lib/typescript/components/Toast/styles.d.ts.map +1 -1
- package/lib/typescript/components/Toast/types.d.ts +1 -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 +6 -0
- package/lib/typescript/components/index.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/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/types.d.ts +5 -0
- 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 +1 -1
- package/src/components/Avatar/index.tsx +1 -1
- package/src/components/Button/index.tsx +1 -1
- package/src/components/Calendar/flashCalendarAdapter.ts +13 -1
- package/src/components/Calendar/index.tsx +43 -5
- package/src/components/Checkbox/index.tsx +1 -1
- package/src/components/Chip/index.tsx +1 -1
- 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/DatePicker/index.tsx +13 -3
- package/src/components/Divider/index.tsx +1 -1
- package/src/components/Field/index.tsx +9 -3
- 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/Input/index.tsx +1 -1
- package/src/components/Link/index.tsx +1 -1
- package/src/components/Menu/index.tsx +2 -2
- package/src/components/Select/index.tsx +1 -1
- package/src/components/Text/index.tsx +32 -5
- package/src/components/Text/styles.ts +39 -1
- package/src/components/Toast/hooks.ts +0 -1
- package/src/components/Toast/index.tsx +14 -8
- package/src/components/Toast/styles.ts +47 -19
- package/src/components/Toast/types.ts +1 -1
- package/src/components/ToggleButton/index.tsx +9 -7
- package/src/components/index.ts +6 -0
- package/src/components/picker/surfaces.tsx +15 -2
- package/src/providers/toast/insets-container.tsx +23 -9
- package/src/providers/toast/provider.tsx +2 -2
- package/src/providers/toast/types.ts +5 -0
- package/src/styles/constants.ts +13 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ColorPicker = void 0;
|
|
7
|
+
Object.defineProperty(exports, "parseColor", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _primitives.parseColor;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _react = require("react");
|
|
14
|
+
var _primitives = require("@cdx-ui/primitives");
|
|
15
|
+
var _utils = require("@cdx-ui/utils");
|
|
16
|
+
var _surfaces = require("../picker/surfaces");
|
|
17
|
+
var _styles = require("./styles");
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
const ColorPickerRoot = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
20
|
+
asChild,
|
|
21
|
+
className,
|
|
22
|
+
style,
|
|
23
|
+
children,
|
|
24
|
+
...props
|
|
25
|
+
}, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.ColorPickerRoot, {
|
|
26
|
+
ref: ref,
|
|
27
|
+
asChild: asChild,
|
|
28
|
+
className: (0, _utils.cn)((0, _styles.colorPickerVariants)(), className),
|
|
29
|
+
style: style,
|
|
30
|
+
...props,
|
|
31
|
+
...(0, _primitives.mergeDataAttributes)(props, (0, _primitives.dataAttributes)({
|
|
32
|
+
slot: 'color-picker'
|
|
33
|
+
})),
|
|
34
|
+
children: children
|
|
35
|
+
}));
|
|
36
|
+
ColorPickerRoot.displayName = 'ColorPicker';
|
|
37
|
+
const ColorPickerTrigger = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
38
|
+
asChild,
|
|
39
|
+
className,
|
|
40
|
+
style,
|
|
41
|
+
children,
|
|
42
|
+
...props
|
|
43
|
+
}, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.ColorPickerTrigger, {
|
|
44
|
+
ref: ref,
|
|
45
|
+
asChild: asChild,
|
|
46
|
+
className: asChild ? className : (0, _utils.cn)((0, _styles.colorPickerTriggerVariants)(), className),
|
|
47
|
+
style: style,
|
|
48
|
+
...props,
|
|
49
|
+
...(0, _primitives.mergeDataAttributes)(props, (0, _primitives.dataAttributes)({
|
|
50
|
+
slot: 'color-picker-trigger'
|
|
51
|
+
})),
|
|
52
|
+
children: children
|
|
53
|
+
}));
|
|
54
|
+
ColorPickerTrigger.displayName = 'ColorPicker.Trigger';
|
|
55
|
+
const registerPopoverSurface = type => {
|
|
56
|
+
void type;
|
|
57
|
+
};
|
|
58
|
+
function ColorPickerPopover({
|
|
59
|
+
className,
|
|
60
|
+
contentClassName,
|
|
61
|
+
children
|
|
62
|
+
}) {
|
|
63
|
+
const context = (0, _primitives.useColorPickerRootContext)();
|
|
64
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_surfaces.PickerPopoverSurface, {
|
|
65
|
+
open: context.open,
|
|
66
|
+
setOpen: context.setOpen,
|
|
67
|
+
registerSurface: registerPopoverSurface,
|
|
68
|
+
anchorRef: context.anchorRef,
|
|
69
|
+
triggerRef: context.triggerRef,
|
|
70
|
+
className: (0, _utils.cn)((0, _styles.colorPickerPopoverVariants)(), className),
|
|
71
|
+
contentClassName: (0, _utils.cn)((0, _styles.colorPickerPopoverContentVariants)(), contentClassName),
|
|
72
|
+
dataSlot: "color-picker-popover",
|
|
73
|
+
width: "content",
|
|
74
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.ColorPickerRootProvider, {
|
|
75
|
+
value: context,
|
|
76
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.ColorPickerProvider, {
|
|
77
|
+
value: context,
|
|
78
|
+
children: children
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
ColorPickerPopover.displayName = 'ColorPicker.Popover';
|
|
84
|
+
const ColorPicker = exports.ColorPicker = Object.assign(ColorPickerRoot, {
|
|
85
|
+
Trigger: ColorPickerTrigger,
|
|
86
|
+
Popover: ColorPickerPopover
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_primitives","_utils","_surfaces","_styles","_jsxRuntime","ColorPickerRoot","forwardRef","asChild","className","style","children","props","ref","jsx","cn","colorPickerVariants","mergeDataAttributes","dataAttributes","slot","displayName","ColorPickerTrigger","colorPickerTriggerVariants","registerPopoverSurface","type","ColorPickerPopover","contentClassName","context","useColorPickerRootContext","PickerPopoverSurface","open","setOpen","registerSurface","anchorRef","triggerRef","colorPickerPopoverVariants","colorPickerPopoverContentVariants","dataSlot","width","ColorPickerRootProvider","value","ColorPickerProvider","ColorPicker","exports","Object","assign","Trigger","Popover"],"sourceRoot":"../../../../src","sources":["components/ColorPicker/index.tsx"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAWA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKkB,IAAAK,WAAA,GAAAL,OAAA;AAMlB,MAAMM,eAAe,gBAAG,IAAAC,iBAAU,EAChC,CAAC;EAAEC,OAAO;EAAEC,SAAS;EAAEC,KAAK;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,kBACrD,IAAAR,WAAA,CAAAS,GAAA,EAACb,WAAA,CAAAK,eAAwB;EACvBO,GAAG,EAAEA,GAAI;EACTL,OAAO,EAAEA,OAAQ;E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IAAI,EAAEH,OAAO,CAACG,IAAK;IACnBC,OAAO,EAAEJ,OAAO,CAACI,OAAQ;IACzBC,eAAe,EAAET,sBAAuB;IACxCU,SAAS,EAAEN,OAAO,CAACM,SAAU;IAC7BC,UAAU,EAAEP,OAAO,CAACO,UAAW;IAC/BzB,SAAS,EAAE,IAAAM,SAAE,EAAC,IAAAoB,kCAA0B,EAAC,CAAC,EAAE1B,SAAS,CAAE;IACvDiB,gBAAgB,EAAE,IAAAX,SAAE,EAAC,IAAAqB,yCAAiC,EAAC,CAAC,EAAEV,gBAAgB,CAAE;IAC5EW,QAAQ,EAAC,sBAAsB;IAC/BC,KAAK,EAAC,SAAS;IAAA3B,QAAA,eAEf,IAAAN,WAAA,CAAAS,GAAA,EAACb,WAAA,CAAAsC,uBAAuB;MAACC,KAAK,EAAEb,OAAQ;MAAAhB,QAAA,eACtC,IAAAN,WAAA,CAAAS,GAAA,EAACb,WAAA,CAAAwC,mBAAmB;QAACD,KAAK,EAAEb,OAAQ;QAAAhB,QAAA,EAAEA;MAAQ,CAAsB;IAAC,CAC9C;EAAC,CACN,CAAC;AAE3B;AAEAc,kBAAkB,CAACL,WAAW,GAAG,qBAAqB;AAO/C,MAAMsB,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAGE,MAAM,CAACC,MAAM,CAACvC,eAAe,EAAE;EACxDwC,OAAO,EAAEzB,kBAAkB;EAC3B0B,OAAO,EAAEtB;AACX,CAAC,CAAiC","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.colorPickerVariants = exports.colorPickerTriggerVariants = exports.colorPickerPopoverVariants = exports.colorPickerPopoverContentVariants = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _utils = require("@cdx-ui/utils");
|
|
9
|
+
var _constants = require("../../styles/constants");
|
|
10
|
+
const colorPickerVariants = exports.colorPickerVariants = (0, _utils.cva)(['items-start gap-2']);
|
|
11
|
+
const colorPickerTriggerVariants = exports.colorPickerTriggerVariants = (0, _utils.cva)(['h-10 self-start flex-row items-center justify-center gap-2 px-3', 'rounded-[var(--border-radius-button)]', 'border border-stroke-action bg-transparent', _constants.TRANSITION_COLORS, 'data-[disabled=true]:opacity-[var(--opacity-disabled)]', _constants.DISABLED_CURSOR, 'web:outline-none web:focus:outline-none web:focus-visible:outline-none', 'web:data-[focus-visible=true]:ring-2', 'web:data-[focus-visible=true]:ring-stroke-focus', 'web:data-[focus-visible=true]:ring-offset-2', _reactNative.Platform.select({
|
|
12
|
+
default: 'data-[active=true]:bg-surface-action-tint-active',
|
|
13
|
+
web: ['data-[hover=true]:bg-surface-action-tint-hover', 'data-[active=true]:data-[hover=true]:bg-surface-action-tint-active'].join(' ')
|
|
14
|
+
})]);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Padding lives on the scroll content, not the popover: the popover's `ScrollView` clips at its
|
|
18
|
+
* own bounds, and slider/area thumbs overhang their track ends by half a thumb plus shadow.
|
|
19
|
+
*/
|
|
20
|
+
const colorPickerPopoverVariants = exports.colorPickerPopoverVariants = (0, _utils.cva)(['w-80 p-0']);
|
|
21
|
+
const colorPickerPopoverContentVariants = exports.colorPickerPopoverContentVariants = (0, _utils.cva)(['gap-3 p-4']);
|
|
22
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_utils","_constants","colorPickerVariants","exports","cva","colorPickerTriggerVariants","TRANSITION_COLORS","DISABLED_CURSOR","Platform","select","default","web","join","colorPickerPopoverVariants","colorPickerPopoverContentVariants"],"sourceRoot":"../../../../src","sources":["components/ColorPicker/styles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEO,MAAMG,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,IAAAE,UAAG,EAAC,CAAC,mBAAmB,CAAC,CAAC;AAEtD,MAAMC,0BAA0B,GAAAF,OAAA,CAAAE,0BAAA,GAAG,IAAAD,UAAG,EAAC,CAC5C,iEAAiE,EACjE,uCAAuC,EACvC,4CAA4C,EAC5CE,4BAAiB,EACjB,wDAAwD,EACxDC,0BAAe,EACf,wEAAwE,EACxE,sCAAsC,EACtC,iDAAiD,EACjD,6CAA6C,EAC7CC,qBAAQ,CAACC,MAAM,CAAC;EACdC,OAAO,EAAE,kDAAkD;EAC3DC,GAAG,EAAE,CACH,gDAAgD,EAChD,oEAAoE,CACrE,CAACC,IAAI,CAAC,GAAG;AACZ,CAAC,CAAC,CACH,CAAC;;AAEF;AACA;AACA;AACA;AACO,MAAMC,0BAA0B,GAAAV,OAAA,CAAAU,0BAAA,GAAG,IAAAT,UAAG,EAAC,CAAC,UAAU,CAAC,CAAC;AAEpD,MAAMU,iCAAiC,GAAAX,OAAA,CAAAW,iCAAA,GAAG,IAAAV,UAAG,EAAC,CAAC,WAAW,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ColorSliderRailPaint = ColorSliderRailPaint;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeSvg = require("react-native-svg");
|
|
10
|
+
var _primitives = require("@cdx-ui/primitives");
|
|
11
|
+
var _styles = require("./styles");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function getStopOffset(index, count, railSize, endCap) {
|
|
14
|
+
const ratio = index / (count - 1);
|
|
15
|
+
if (railSize <= 0 || endCap <= 0) {
|
|
16
|
+
return `${String(ratio * 100)}%`;
|
|
17
|
+
}
|
|
18
|
+
return `${String((endCap + ratio * railSize) / (railSize + 2 * endCap) * 100)}%`;
|
|
19
|
+
}
|
|
20
|
+
function ColorSliderRailPaint() {
|
|
21
|
+
const {
|
|
22
|
+
gradientColors,
|
|
23
|
+
orientation,
|
|
24
|
+
layout,
|
|
25
|
+
thumbSize
|
|
26
|
+
} = (0, _primitives.useColorSliderContext)();
|
|
27
|
+
const gradientId = (0, _react.useId)();
|
|
28
|
+
const isVertical = orientation === 'vertical';
|
|
29
|
+
const railSize = (isVertical ? layout?.height : layout?.width) ?? 0;
|
|
30
|
+
const endCap = (isVertical ? thumbSize.height : thumbSize.width) / 2;
|
|
31
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
32
|
+
className: (0, _styles.colorSliderRailPaintVariants)({
|
|
33
|
+
orientation
|
|
34
|
+
}),
|
|
35
|
+
style: styles.paint,
|
|
36
|
+
accessible: false,
|
|
37
|
+
accessibilityElementsHidden: true,
|
|
38
|
+
importantForAccessibility: "no-hide-descendants",
|
|
39
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeSvg.Svg, {
|
|
40
|
+
width: "100%",
|
|
41
|
+
height: "100%",
|
|
42
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.Defs, {
|
|
43
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.LinearGradient, {
|
|
44
|
+
id: gradientId,
|
|
45
|
+
x1: "0%",
|
|
46
|
+
y1: orientation === 'vertical' ? '100%' : '0%',
|
|
47
|
+
x2: orientation === 'horizontal' ? '100%' : '0%',
|
|
48
|
+
y2: "0%",
|
|
49
|
+
children: gradientColors.map((color, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.Stop, {
|
|
50
|
+
offset: getStopOffset(index, gradientColors.length, railSize, endCap),
|
|
51
|
+
stopColor: color
|
|
52
|
+
}, `${color}-${String(index)}`))
|
|
53
|
+
})
|
|
54
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.Rect, {
|
|
55
|
+
width: "100%",
|
|
56
|
+
height: "100%",
|
|
57
|
+
fill: `url(#${gradientId})`
|
|
58
|
+
})]
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
ColorSliderRailPaint.displayName = 'ColorSliderRailPaint';
|
|
63
|
+
const styles = _reactNative.StyleSheet.create({
|
|
64
|
+
paint: {
|
|
65
|
+
pointerEvents: 'none'
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=ColorSliderRailPaint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_reactNativeSvg","_primitives","_styles","_jsxRuntime","getStopOffset","index","count","railSize","endCap","ratio","String","ColorSliderRailPaint","gradientColors","orientation","layout","thumbSize","useColorSliderContext","gradientId","useId","isVertical","height","width","jsx","View","className","colorSliderRailPaintVariants","style","styles","paint","accessible","accessibilityElementsHidden","importantForAccessibility","children","jsxs","Svg","Defs","LinearGradient","id","x1","y1","x2","y2","map","color","Stop","offset","length","stopColor","Rect","fill","displayName","StyleSheet","create","pointerEvents"],"sourceRoot":"../../../../src","sources":["components/ColorSlider/ColorSliderRailPaint.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAAwD,IAAAK,WAAA,GAAAL,OAAA;AAExD,SAASM,aAAaA,CAACC,KAAa,EAAEC,KAAa,EAAEC,QAAgB,EAAEC,MAAc,EAAU;EAC7F,MAAMC,KAAK,GAAGJ,KAAK,IAAIC,KAAK,GAAG,CAAC,CAAC;EACjC,IAAIC,QAAQ,IAAI,CAAC,IAAIC,MAAM,IAAI,CAAC,EAAE;I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C,EAAE,EAAE1B,WAAW,KAAK,UAAU,GAAG,MAAM,GAAG,IAAK;UAC/C2B,EAAE,EAAE3B,WAAW,KAAK,YAAY,GAAG,MAAM,GAAG,IAAK;UACjD4B,EAAE,EAAC,IAAI;UAAAT,QAAA,EAENpB,cAAc,CAAC8B,GAAG,CAAC,CAACC,KAAK,EAAEtC,KAAK,kBAC/B,IAAAF,WAAA,CAAAmB,GAAA,EAACtB,eAAA,CAAA4C,IAAI;YAEHC,MAAM,EAAEzC,aAAa,CAACC,KAAK,EAAEO,cAAc,CAACkC,MAAM,EAAEvC,QAAQ,EAAEC,MAAM,CAAE;YACtEuC,SAAS,EAAEJ;UAAM,GAFZ,GAAGA,KAAK,IAAIjC,MAAM,CAACL,KAAK,CAAC,EAG/B,CACF;QAAC,CACY;MAAC,CACb,CAAC,eACP,IAAAF,WAAA,CAAAmB,GAAA,EAACtB,eAAA,CAAAgD,IAAI;QAAC3B,KAAK,EAAC,MAAM;QAACD,MAAM,EAAC,MAAM;QAAC6B,IAAI,EAAE,QAAQhC,UAAU;MAAI,CAAE,CAAC;IAAA,CAC7D;EAAC,CACF,CAAC;AAEX;AAEAN,oBAAoB,CAACuC,WAAW,GAAG,sBAAsB;AAEzD,MAAMvB,MAAM,GAAGwB,uBAAU,CAACC,MAAM,CAAC;EAC/BxB,KAAK,EAAE;IACLyB,aAAa,EAAE;EACjB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ColorSliderRailPaint = ColorSliderRailPaint;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _primitives = require("@cdx-ui/primitives");
|
|
9
|
+
var _styles = require("./styles");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function getGradientStops(colors, endCap) {
|
|
12
|
+
if (endCap <= 0 || colors.length < 2) {
|
|
13
|
+
return colors.join(', ');
|
|
14
|
+
}
|
|
15
|
+
const first = `${colors[0]} ${String(endCap)}px`;
|
|
16
|
+
const last = `${colors[colors.length - 1]} calc(100% - ${String(endCap)}px)`;
|
|
17
|
+
return [first, ...colors.slice(1, -1), last].join(', ');
|
|
18
|
+
}
|
|
19
|
+
function ColorSliderRailPaint() {
|
|
20
|
+
const {
|
|
21
|
+
gradientColors,
|
|
22
|
+
orientation,
|
|
23
|
+
thumbSize
|
|
24
|
+
} = (0, _primitives.useColorSliderContext)();
|
|
25
|
+
const direction = orientation === 'vertical' ? 'to top' : 'to right';
|
|
26
|
+
const endCap = (orientation === 'vertical' ? thumbSize.height : thumbSize.width) / 2;
|
|
27
|
+
const paintStyle = {
|
|
28
|
+
backgroundImage: `linear-gradient(${direction}, ${getGradientStops(gradientColors, endCap)})`
|
|
29
|
+
};
|
|
30
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
31
|
+
className: (0, _styles.colorSliderRailPaintVariants)({
|
|
32
|
+
orientation
|
|
33
|
+
}),
|
|
34
|
+
style: paintStyle,
|
|
35
|
+
accessible: false,
|
|
36
|
+
accessibilityElementsHidden: true,
|
|
37
|
+
importantForAccessibility: "no-hide-descendants"
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
ColorSliderRailPaint.displayName = 'ColorSliderRailPaint';
|
|
41
|
+
//# sourceMappingURL=ColorSliderRailPaint.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_primitives","_styles","_jsxRuntime","getGradientStops","colors","endCap","length","join","first","String","last","slice","ColorSliderRailPaint","gradientColors","orientation","thumbSize","useColorSliderContext","direction","height","width","paintStyle","backgroundImage","jsx","View","className","colorSliderRailPaintVariants","style","accessible","accessibilityElementsHidden","importantForAccessibility","displayName"],"sourceRoot":"../../../../src","sources":["components/ColorSlider/ColorSliderRailPaint.web.tsx"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AAEX;IAAY,CAAC,CAAE;IACzDY,KAAK,EAAEN,UAAW;IAClBO,UAAU,EAAE,KAAM;IAClBC,2BAA2B;IAC3BC,yBAAyB,EAAC;EAAqB,CAChD,CAAC;AAEN;AAEAjB,oBAAoB,CAACkB,WAAW,GAAG,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ColorSlider = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _primitives = require("@cdx-ui/primitives");
|
|
10
|
+
var _utils = require("@cdx-ui/utils");
|
|
11
|
+
var _ColorSliderRailPaint = require("./ColorSliderRailPaint");
|
|
12
|
+
var _styles = require("./styles");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
const ColorSliderRoot = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
15
|
+
asChild,
|
|
16
|
+
className,
|
|
17
|
+
style,
|
|
18
|
+
orientation = 'horizontal',
|
|
19
|
+
children,
|
|
20
|
+
...props
|
|
21
|
+
}, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.ColorSliderRoot, {
|
|
22
|
+
ref: ref,
|
|
23
|
+
asChild: asChild,
|
|
24
|
+
className: (0, _utils.cn)((0, _styles.colorSliderVariants)({
|
|
25
|
+
orientation
|
|
26
|
+
}), className),
|
|
27
|
+
style: style,
|
|
28
|
+
orientation: orientation,
|
|
29
|
+
...props,
|
|
30
|
+
...(0, _primitives.mergeDataAttributes)(props, (0, _primitives.dataAttributes)({
|
|
31
|
+
slot: 'color-slider'
|
|
32
|
+
})),
|
|
33
|
+
children: children
|
|
34
|
+
}));
|
|
35
|
+
ColorSliderRoot.displayName = 'ColorSlider';
|
|
36
|
+
const ColorSliderRail = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
37
|
+
asChild,
|
|
38
|
+
className,
|
|
39
|
+
style,
|
|
40
|
+
hitSlop,
|
|
41
|
+
children,
|
|
42
|
+
...props
|
|
43
|
+
}, ref) => {
|
|
44
|
+
const {
|
|
45
|
+
orientation,
|
|
46
|
+
thumbSize
|
|
47
|
+
} = (0, _primitives.useColorSliderContext)();
|
|
48
|
+
const endCap = orientation === 'vertical' ? {
|
|
49
|
+
top: thumbSize.height / 2,
|
|
50
|
+
bottom: thumbSize.height / 2
|
|
51
|
+
} : {
|
|
52
|
+
left: thumbSize.width / 2,
|
|
53
|
+
right: thumbSize.width / 2
|
|
54
|
+
};
|
|
55
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.ColorSliderRail, {
|
|
56
|
+
ref: ref,
|
|
57
|
+
asChild: asChild,
|
|
58
|
+
className: (0, _utils.cn)((0, _styles.colorSliderRailVariants)({
|
|
59
|
+
orientation
|
|
60
|
+
}), className),
|
|
61
|
+
style: style,
|
|
62
|
+
hitSlop: hitSlop ?? endCap,
|
|
63
|
+
...props,
|
|
64
|
+
...(0, _primitives.mergeDataAttributes)(props, (0, _primitives.dataAttributes)({
|
|
65
|
+
slot: 'color-slider-rail'
|
|
66
|
+
})),
|
|
67
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ColorSliderRailPaint.ColorSliderRailPaint, {}), children]
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
ColorSliderRail.displayName = 'ColorSlider.Rail';
|
|
71
|
+
const ColorSliderThumb = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
72
|
+
className,
|
|
73
|
+
style,
|
|
74
|
+
children,
|
|
75
|
+
...props
|
|
76
|
+
}, ref) => {
|
|
77
|
+
const {
|
|
78
|
+
value
|
|
79
|
+
} = (0, _primitives.useColorSliderContext)();
|
|
80
|
+
const fillStyle = {
|
|
81
|
+
backgroundColor: value.toString('hex')
|
|
82
|
+
};
|
|
83
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.ColorSliderThumb, {
|
|
84
|
+
ref: ref,
|
|
85
|
+
className: (0, _utils.cn)((0, _styles.colorSliderThumbVariants)(), className),
|
|
86
|
+
style: typeof style === 'function' ? state => [fillStyle, style(state)] : [fillStyle, style],
|
|
87
|
+
...props,
|
|
88
|
+
...(0, _primitives.mergeDataAttributes)(props, (0, _primitives.dataAttributes)({
|
|
89
|
+
slot: 'color-slider-thumb'
|
|
90
|
+
})),
|
|
91
|
+
children: children
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
ColorSliderThumb.displayName = 'ColorSlider.Thumb';
|
|
95
|
+
const ColorSliderOutput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
96
|
+
asChild,
|
|
97
|
+
className,
|
|
98
|
+
style,
|
|
99
|
+
children,
|
|
100
|
+
...props
|
|
101
|
+
}, ref) => {
|
|
102
|
+
const {
|
|
103
|
+
valueLabel
|
|
104
|
+
} = (0, _primitives.useColorSliderContext)();
|
|
105
|
+
const Comp = asChild ? _primitives.Slot : _reactNative.Text;
|
|
106
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, {
|
|
107
|
+
ref: ref,
|
|
108
|
+
className: (0, _utils.cn)((0, _styles.colorSliderOutputVariants)(), className),
|
|
109
|
+
style: style,
|
|
110
|
+
...props,
|
|
111
|
+
...(0, _primitives.mergeDataAttributes)(props, (0, _primitives.dataAttributes)({
|
|
112
|
+
slot: 'color-slider-output'
|
|
113
|
+
})),
|
|
114
|
+
children: children ?? valueLabel
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
ColorSliderOutput.displayName = 'ColorSlider.Output';
|
|
118
|
+
const ColorSlider = exports.ColorSlider = Object.assign(ColorSliderRoot, {
|
|
119
|
+
Rail: ColorSliderRail,
|
|
120
|
+
Thumb: ColorSliderThumb,
|
|
121
|
+
Output: ColorSliderOutput
|
|
122
|
+
});
|
|
123
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_primitives","_utils","_ColorSliderRailPaint","_styles","_jsxRuntime","ColorSliderRoot","forwardRef","asChild","className","style","orientation","children","props","ref","jsx","cn","colorSliderVariants","mergeDataAttributes","dataAttributes","slot","displayName","ColorSliderRail","hitSlop","thumbSize","useColorSliderContext","endCap","top","height","bottom","left","width","right","jsxs","colorSliderRailVariants","ColorSliderRailPaint","ColorSliderThumb","value","fillStyle","backgroundColor","toString","colorSliderThumbVariants","state","ColorSliderOutput","valueLabel","Comp","Slot","Text","colorSliderOutputVariants","ColorSlider","exports","Object","assign","Rail","Thumb","Output"],"sourceRoot":"../../../../src","sources":["components/ColorSlider/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAYA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,qBAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAKkB,IAAAM,WAAA,GAAAN,OAAA;AAQlB,MAAMO,eAAe,gBAAG,IAAAC,iBAAU,EAChC,CAAC;EAAEC,OAAO;EAAEC,SAAS;EAAEC,KAAK;EAAEC,WAAW,GAAG,YAAY;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,kBACjF,IAAAT,WAAA,CAAAU,GAAA,EAACd,WAAA,CAAAK,eAAwB;EACvBQ,GAAG,EAAEA,GAAI;EACTN,OAAO,EAAEA,OAAQ;EACjBC,SAAS,EAAE,IAAAO,SAAE,EAAC,IAAAC,2BAAmB,EAAC;IAAEN;EAAY,CAAC,CAAC,EAAEF,SAAS,CAAE;EAC/DC,KAAK,EAAEA,KAAM;EACbC,WAAW,EAAEA,WAAY;EAAA,GACrBE,KAAK;EAAA,GACL,IAAAK,+BAAmB,EAACL,KAAK,EAAE,IAAAM,0BAAc,EAAC;IAAEC,IAAI,EAAE;EA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GAAI;IACTL,SAAS,EAAE,IAAAO,SAAE,EAAC,IAAAgC,iCAAyB,EAAC,CAAC,EAAEvC,SAAS,CAAE;IACtDC,KAAK,EAAEA,KAAM;IAAA,GACTG,KAAK;IAAA,GACL,IAAAK,+BAAmB,EAACL,KAAK,EAAE,IAAAM,0BAAc,EAAC;MAAEC,IAAI,EAAE;IAAsB,CAAC,CAAC,CAAC;IAAAR,QAAA,EAE9EA,QAAQ,IAAIgC;EAAU,CACnB,CAAC;AAEX,CACF,CAAC;AAEDD,iBAAiB,CAACtB,WAAW,GAAG,oBAAoB;AAQ7C,MAAM4B,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAGE,MAAM,CAACC,MAAM,CAAC9C,eAAe,EAAE;EACxD+C,IAAI,EAAE/B,eAAe;EACrBgC,KAAK,EAAElB,gBAAgB;EACvBmB,MAAM,EAAEZ;AACV,CAAC,CAAiC","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.colorSliderVariants = exports.colorSliderThumbVariants = exports.colorSliderRailVariants = exports.colorSliderRailPaintVariants = exports.colorSliderOutputVariants = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _utils = require("@cdx-ui/utils");
|
|
9
|
+
var _constants = require("../../styles/constants");
|
|
10
|
+
const colorSliderVariants = exports.colorSliderVariants = (0, _utils.cva)(['relative select-none', 'data-[disabled=true]:opacity-[var(--opacity-disabled)]', _constants.DISABLED_CURSOR], {
|
|
11
|
+
variants: {
|
|
12
|
+
orientation: {
|
|
13
|
+
horizontal: 'w-full',
|
|
14
|
+
vertical: 'h-48'
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
orientation: 'horizontal'
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// The rail inset equals the `size-5` thumb's radius so the thumb sits flush inside the pill ends.
|
|
23
|
+
const colorSliderRailVariants = exports.colorSliderRailVariants = (0, _utils.cva)(['relative touch-none'], {
|
|
24
|
+
variants: {
|
|
25
|
+
orientation: {
|
|
26
|
+
horizontal: 'mx-2.5 h-5 w-auto',
|
|
27
|
+
vertical: 'my-2.5 w-5 flex-1'
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
defaultVariants: {
|
|
31
|
+
orientation: 'horizontal'
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const colorSliderRailPaintVariants = exports.colorSliderRailPaintVariants = (0, _utils.cva)(['absolute overflow-hidden rounded-[var(--border-radius-round)]'], {
|
|
35
|
+
variants: {
|
|
36
|
+
orientation: {
|
|
37
|
+
horizontal: '-inset-x-2.5 inset-y-0',
|
|
38
|
+
vertical: '-inset-y-2.5 inset-x-0'
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
defaultVariants: {
|
|
42
|
+
orientation: 'horizontal'
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const colorSliderThumbVariants = exports.colorSliderThumbVariants = (0, _utils.cva)(['z-2 box-border size-5 rounded-[var(--border-radius-round)]', 'border-2 border-surface-primary shadow-md', 'transition-[transform,box-shadow,opacity] duration-150', 'data-[dragging=true]:transition-none', 'web:outline-none web:active:cursor-grabbing', _reactNative.Platform.select({
|
|
46
|
+
default: 'data-[focus=true]:scale-105',
|
|
47
|
+
web: ['web:cursor-grab', 'data-[hover=true]:scale-110', 'data-[dragging=true]:scale-110', 'data-[focus-visible=true]:ring-4', 'data-[focus-visible=true]:ring-stroke-focus'].join(' ')
|
|
48
|
+
})]);
|
|
49
|
+
const colorSliderOutputVariants = exports.colorSliderOutputVariants = (0, _utils.cva)(['text-sm font-medium text-content-primary']);
|
|
50
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_utils","_constants","colorSliderVariants","exports","cva","DISABLED_CURSOR","variants","orientation","horizontal","vertical","defaultVariants","colorSliderRailVariants","colorSliderRailPaintVariants","colorSliderThumbVariants","Platform","select","default","web","join","colorSliderOutputVariants"],"sourceRoot":"../../../../src","sources":["components/ColorSlider/styles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEO,MAAMG,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,IAAAE,UAAG,EACpC,CACE,sBAAsB,EACtB,wDAAwD,EACxDC,0BAAe,CAChB,EACD;EACEC,QAAQ,EAAE;IACRC,WAAW,EAAE;MACXC,UAAU,EAAE,QAAQ;MACpBC,QAAQ,EAAE;IACZ;EACF,CAAC;EACDC,eAAe,EAAE;IACfH,WAAW,EAAE;EACf;AACF,CACF,CAAC;;AAED;AACO,MAAMI,uBAAuB,GAAAR,OAAA,CAAAQ,uBAAA,GAAG,IAAAP,UAAG,EAAC,CAAC,qBAAqB,CAAC,EAAE;EAClEE,QAAQ,EAAE;IACRC,WAAW,EAAE;MACXC,UAAU,EAAE,mBAAmB;MAC/BC,QAAQ,EAAE;IACZ;EACF,CAAC;EACDC,eAAe,EAAE;IACfH,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAEK,MAAMK,4BAA4B,GAAAT,OAAA,CAAAS,4BAAA,GAAG,IAAAR,UAAG,EAC7C,CAAC,+DAA+D,CAAC,EACjE;EACEE,QAAQ,EAAE;IACRC,WAAW,EAAE;MACXC,UAAU,EAAE,wBAAwB;MACpCC,QAAQ,EAAE;IACZ;EACF,CAAC;EACDC,eAAe,EAAE;IACfH,WAAW,EAAE;EACf;AACF,CACF,CAAC;AAEM,MAAMM,wBAAwB,GAAAV,OAAA,CAAAU,wBAAA,GAAG,IAAAT,UAAG,EAAC,CAC1C,4DAA4D,EAC5D,2CAA2C,EAC3C,wDAAwD,EACxD,sCAAsC,EACtC,6CAA6C,EAC7CU,qBAAQ,CAACC,MAAM,CAAC;EACdC,OAAO,EAAE,6BAA6B;EACtCC,GAAG,EAAE,CACH,iBAAiB,EACjB,6BAA6B,EAC7B,gCAAgC,EAChC,kCAAkC,EAClC,6CAA6C,CAC9C,CAACC,IAAI,CAAC,GAAG;AACZ,CAAC,CAAC,CACH,CAAC;AAEK,MAAMC,yBAAyB,GAAAhB,OAAA,CAAAgB,yBAAA,GAAG,IAAAf,UAAG,EAAC,CAAC,0CAA0C,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ColorSwatchView = exports.ColorSwatch = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _primitives = require("@cdx-ui/primitives");
|
|
10
|
+
var _utils = require("@cdx-ui/utils");
|
|
11
|
+
var _styles = require("./styles");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
const ColorSwatchView = exports.ColorSwatchView = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
14
|
+
asChild,
|
|
15
|
+
color,
|
|
16
|
+
size = 'sm',
|
|
17
|
+
shape = 'circle',
|
|
18
|
+
slot,
|
|
19
|
+
className,
|
|
20
|
+
style,
|
|
21
|
+
...props
|
|
22
|
+
}, ref) => {
|
|
23
|
+
const Comp = asChild ? _primitives.Slot : _reactNative.View;
|
|
24
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, {
|
|
25
|
+
ref: ref,
|
|
26
|
+
className: (0, _utils.cn)((0, _styles.colorSwatchVariants)({
|
|
27
|
+
size,
|
|
28
|
+
shape
|
|
29
|
+
}), className),
|
|
30
|
+
style: [color ? {
|
|
31
|
+
backgroundColor: color.toString('hex')
|
|
32
|
+
} : undefined, style],
|
|
33
|
+
...props,
|
|
34
|
+
...(0, _primitives.mergeDataAttributes)(props, (0, _primitives.dataAttributes)({
|
|
35
|
+
slot
|
|
36
|
+
}))
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
ColorSwatchView.displayName = 'ColorSwatchView';
|
|
40
|
+
const ColorSwatch = exports.ColorSwatch = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
41
|
+
color: colorProp,
|
|
42
|
+
...props
|
|
43
|
+
}, ref) => {
|
|
44
|
+
const picker = (0, _primitives.useOptionalColorPickerContext)();
|
|
45
|
+
const color = colorProp ?? picker?.value;
|
|
46
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ColorSwatchView, {
|
|
47
|
+
ref: ref,
|
|
48
|
+
color: color,
|
|
49
|
+
slot: "color-swatch",
|
|
50
|
+
...props
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
ColorSwatch.displayName = 'ColorSwatch';
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_primitives","_utils","_styles","_jsxRuntime","ColorSwatchView","exports","forwardRef","asChild","color","size","shape","slot","className","style","props","ref","Comp","Slot","View","jsx","cn","colorSwatchVariants","backgroundColor","toString","undefined","mergeDataAttributes","dataAttributes","displayName","ColorSwatch","colorProp","picker","useOptionalColorPickerContext","value"],"sourceRoot":"../../../../src","sources":["components/ColorSwatch/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAOA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAA6E,IAAAK,WAAA,GAAAL,OAAA;AAgBtE,MAAMM,eAAe,GAAAC,OAAA,CAAAD,eAAA,gBAAG,IAAAE,iBAAU,EACvC,CAAC;EAAEC,OAAO;EAAEC,KAAK;EA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@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.colorSwatchVariants = void 0;
|
|
7
|
+
var _utils = require("@cdx-ui/utils");
|
|
8
|
+
const colorSwatchVariants = exports.colorSwatchVariants = (0, _utils.cva)(['shrink-0 overflow-hidden border border-stroke-secondary'], {
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
xs: 'size-4',
|
|
12
|
+
sm: 'size-6',
|
|
13
|
+
lg: 'size-10'
|
|
14
|
+
},
|
|
15
|
+
shape: {
|
|
16
|
+
circle: 'rounded-[var(--border-radius-round)]',
|
|
17
|
+
square: 'rounded-[var(--border-radius-default)]'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
size: 'sm',
|
|
22
|
+
shape: 'circle'
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_utils","require","colorSwatchVariants","exports","cva","variants","size","xs","sm","lg","shape","circle","square","defaultVariants"],"sourceRoot":"../../../../src","sources":["components/ColorSwatch/styles.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEO,MAAMC,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,IAAAE,UAAG,EACpC,CAAC,yDAAyD,CAAC,EAC3D;EACEC,QAAQ,EAAE;IACRC,IAAI,EAAE;MACJC,EAAE,EAAE,QAAQ;MACZC,EAAE,EAAE,QAAQ;MACZC,EAAE,EAAE;IACN,CAAC;IACDC,KAAK,EAAE;MACLC,MAAM,EAAE,sCAAsC;MAC9CC,MAAM,EAAE;IACV;EACF,CAAC;EACDC,eAAe,EAAE;IACfP,IAAI,EAAE,IAAI;IACVI,KAAK,EAAE;EACT;AACF,CACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ColorSwatchPicker = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _icons = require("@cdx-ui/icons");
|
|
10
|
+
var _primitives = require("@cdx-ui/primitives");
|
|
11
|
+
var _utils = require("@cdx-ui/utils");
|
|
12
|
+
var _Icon = require("../Icon");
|
|
13
|
+
var _ColorSwatch = require("../ColorSwatch");
|
|
14
|
+
var _styles = require("./styles");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
const ColorSwatchPickerRoot = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
17
|
+
asChild,
|
|
18
|
+
className,
|
|
19
|
+
style,
|
|
20
|
+
children,
|
|
21
|
+
...props
|
|
22
|
+
}, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.ColorSwatchPickerRoot, {
|
|
23
|
+
ref: ref,
|
|
24
|
+
asChild: asChild,
|
|
25
|
+
className: (0, _utils.cn)((0, _styles.colorSwatchPickerVariants)(), className),
|
|
26
|
+
style: style,
|
|
27
|
+
...props,
|
|
28
|
+
...(0, _primitives.mergeDataAttributes)(props, (0, _primitives.dataAttributes)({
|
|
29
|
+
slot: 'color-swatch-picker'
|
|
30
|
+
})),
|
|
31
|
+
children: children
|
|
32
|
+
}));
|
|
33
|
+
ColorSwatchPickerRoot.displayName = 'ColorSwatchPicker';
|
|
34
|
+
const ColorSwatchPickerItem = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
35
|
+
asChild,
|
|
36
|
+
className,
|
|
37
|
+
style,
|
|
38
|
+
children,
|
|
39
|
+
...props
|
|
40
|
+
}, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.ColorSwatchPickerItem, {
|
|
41
|
+
ref: ref,
|
|
42
|
+
asChild: asChild,
|
|
43
|
+
className: (0, _utils.cn)((0, _styles.colorSwatchPickerItemVariants)(), className),
|
|
44
|
+
style: style,
|
|
45
|
+
...props,
|
|
46
|
+
...(0, _primitives.mergeDataAttributes)(props, (0, _primitives.dataAttributes)({
|
|
47
|
+
slot: 'color-swatch-picker-item'
|
|
48
|
+
})),
|
|
49
|
+
children: children
|
|
50
|
+
}));
|
|
51
|
+
ColorSwatchPickerItem.displayName = 'ColorSwatchPicker.Item';
|
|
52
|
+
const ColorSwatchPickerSwatch = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
53
|
+
const {
|
|
54
|
+
color
|
|
55
|
+
} = (0, _primitives.useColorSwatchPickerItemContext)();
|
|
56
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ColorSwatch.ColorSwatchView, {
|
|
57
|
+
ref: ref,
|
|
58
|
+
color: color,
|
|
59
|
+
slot: "color-swatch-picker-swatch",
|
|
60
|
+
...props
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
ColorSwatchPickerSwatch.displayName = 'ColorSwatchPicker.Swatch';
|
|
64
|
+
const ColorSwatchPickerIndicator = ({
|
|
65
|
+
asChild,
|
|
66
|
+
as = _icons.Check,
|
|
67
|
+
className,
|
|
68
|
+
style,
|
|
69
|
+
children,
|
|
70
|
+
...props
|
|
71
|
+
}) => {
|
|
72
|
+
const {
|
|
73
|
+
isChecked
|
|
74
|
+
} = (0, _primitives.useRadioContext)();
|
|
75
|
+
if (!isChecked) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
const computedClassName = (0, _utils.cn)((0, _styles.colorSwatchPickerIndicatorIconVariants)(), className);
|
|
79
|
+
const slotData = (0, _primitives.mergeDataAttributes)(props, (0, _primitives.dataAttributes)({
|
|
80
|
+
slot: 'color-swatch-picker-indicator'
|
|
81
|
+
}));
|
|
82
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
83
|
+
className: (0, _styles.colorSwatchPickerIndicatorVariants)(),
|
|
84
|
+
accessibilityElementsHidden: true,
|
|
85
|
+
"aria-hidden": true,
|
|
86
|
+
...slotData,
|
|
87
|
+
children: asChild ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Slot, {
|
|
88
|
+
className: computedClassName,
|
|
89
|
+
style: style,
|
|
90
|
+
accessibilityElementsHidden: true,
|
|
91
|
+
"aria-hidden": true,
|
|
92
|
+
...props,
|
|
93
|
+
children: children
|
|
94
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.Icon, {
|
|
95
|
+
as: as,
|
|
96
|
+
className: computedClassName,
|
|
97
|
+
style: style,
|
|
98
|
+
accessibilityElementsHidden: true,
|
|
99
|
+
"aria-hidden": true,
|
|
100
|
+
...props
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
ColorSwatchPickerIndicator.displayName = 'ColorSwatchPicker.Indicator';
|
|
105
|
+
const ColorSwatchPicker = exports.ColorSwatchPicker = Object.assign(ColorSwatchPickerRoot, {
|
|
106
|
+
Item: ColorSwatchPickerItem,
|
|
107
|
+
Swatch: ColorSwatchPickerSwatch,
|
|
108
|
+
Indicator: ColorSwatchPickerIndicator
|
|
109
|
+
});
|
|
110
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_icons","_primitives","_utils","_Icon","_ColorSwatch","_styles","_jsxRuntime","ColorSwatchPickerRoot","forwardRef","asChild","className","style","children","props","ref","jsx","cn","colorSwatchPickerVariants","mergeDataAttributes","dataAttributes","slot","displayName","ColorSwatchPickerItem","colorSwatchPickerItemVariants","ColorSwatchPickerSwatch","color","useColorSwatchPickerItemContext","ColorSwatchView","ColorSwatchPickerIndicator","as","Check","isChecked","useRadioContext","computedClassName","colorSwatchPickerIndicatorIconVariants","slotData","View","colorSwatchPickerIndicatorVariants","accessibilityElementsHidden","Slot","Icon","ColorSwatchPicker","exports","Object","assign","Item","Swatch","Indicator"],"sourceRoot":"../../../../src","sources":["components/ColorSwatchPicker/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAWA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAKkB,IAAAQ,WAAA,GAAAR,OAAA;AAOlB,MAAMS,qBAAqB,gBAAG,IAAAC,iBAAU,EACtC,CAAC;EAAEC,OAAO;EAAEC,SAAS;EAAEC,KAAK;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,kBACrD,IAAAR,WAAA,CAAAS,GAAA,EAACd,WAAA,CAAAM,qBAA8B;EAC7BO,GAAG,EAAEA,GAAI;EACTL,OAAO,EAAEA,OAAQ;EACjBC,SAAS,EAAE,IAAAM,SAAE,EAAC,IAAAC,iCAAyB,EAAC,CAAC,EAAEP,SAAS,CAAE;EACtDC,KAAK,EAAEA,KAAM;EAAA,GACTE,KAAK;EAAA,GACL,IAAAK,+BAAmB,EAACL,KAAK,EAAE,IAAAM,0BAAc,EAAC;IAAEC,IAAI,EAAE;EAAsB,CAAC,CAAC,CAAC;EAAAR,QAAA,EAE9EA;AAAQ,CACqB,CAEpC,CAAC;AAEDL,qBAAqB,CAACc,WAAW,GAAG,mBAAmB;AAQvD,MAAMC,qBAAqB,gBAAG,IAAAd,iBAAU,EACtC,CAAC;EAAEC,OAAO;EAAEC,SAAS;EAAEC,KAAK;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,kBACrD,IAAAR,WAAA,CAAAS,GAAA,EAACd,WAAA,CAAAqB,qBAA8B;EAC7BR,GAAG,EAAEA,GAAI;EACTL,OAAO,EA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