@cdx-ui/components 0.1.7 → 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.
Files changed (260) hide show
  1. package/coverage.svg +1 -1
  2. package/lib/commonjs/components/ColorArea/ColorAreaPaint.js +78 -0
  3. package/lib/commonjs/components/ColorArea/ColorAreaPaint.js.map +1 -0
  4. package/lib/commonjs/components/ColorArea/ColorAreaPaint.web.js +31 -0
  5. package/lib/commonjs/components/ColorArea/ColorAreaPaint.web.js.map +1 -0
  6. package/lib/commonjs/components/ColorArea/index.js +57 -0
  7. package/lib/commonjs/components/ColorArea/index.js.map +1 -0
  8. package/lib/commonjs/components/ColorArea/styles.js +12 -0
  9. package/lib/commonjs/components/ColorArea/styles.js.map +1 -0
  10. package/lib/commonjs/components/ColorField/index.js +138 -0
  11. package/lib/commonjs/components/ColorField/index.js.map +1 -0
  12. package/lib/commonjs/components/ColorField/styles.js +14 -0
  13. package/lib/commonjs/components/ColorField/styles.js.map +1 -0
  14. package/lib/commonjs/components/ColorPicker/index.js +88 -0
  15. package/lib/commonjs/components/ColorPicker/index.js.map +1 -0
  16. package/lib/commonjs/components/ColorPicker/styles.js +22 -0
  17. package/lib/commonjs/components/ColorPicker/styles.js.map +1 -0
  18. package/lib/commonjs/components/ColorSlider/ColorSliderRailPaint.js +68 -0
  19. package/lib/commonjs/components/ColorSlider/ColorSliderRailPaint.js.map +1 -0
  20. package/lib/commonjs/components/ColorSlider/ColorSliderRailPaint.web.js +41 -0
  21. package/lib/commonjs/components/ColorSlider/ColorSliderRailPaint.web.js.map +1 -0
  22. package/lib/commonjs/components/ColorSlider/index.js +123 -0
  23. package/lib/commonjs/components/ColorSlider/index.js.map +1 -0
  24. package/lib/commonjs/components/ColorSlider/styles.js +50 -0
  25. package/lib/commonjs/components/ColorSlider/styles.js.map +1 -0
  26. package/lib/commonjs/components/ColorSwatch/index.js +54 -0
  27. package/lib/commonjs/components/ColorSwatch/index.js.map +1 -0
  28. package/lib/commonjs/components/ColorSwatch/styles.js +25 -0
  29. package/lib/commonjs/components/ColorSwatch/styles.js.map +1 -0
  30. package/lib/commonjs/components/ColorSwatchPicker/index.js +110 -0
  31. package/lib/commonjs/components/ColorSwatchPicker/index.js.map +1 -0
  32. package/lib/commonjs/components/ColorSwatchPicker/styles.js +17 -0
  33. package/lib/commonjs/components/ColorSwatchPicker/styles.js.map +1 -0
  34. package/lib/commonjs/components/Heading/styles.js +3 -0
  35. package/lib/commonjs/components/Heading/styles.js.map +1 -1
  36. package/lib/commonjs/components/Icon/index.js +27 -3
  37. package/lib/commonjs/components/Icon/index.js.map +1 -1
  38. package/lib/commonjs/components/Icon/styles.js +19 -0
  39. package/lib/commonjs/components/Icon/styles.js.map +1 -0
  40. package/lib/commonjs/components/Text/index.js +13 -4
  41. package/lib/commonjs/components/Text/index.js.map +1 -1
  42. package/lib/commonjs/components/Text/styles.js +39 -3
  43. package/lib/commonjs/components/Text/styles.js.map +1 -1
  44. package/lib/commonjs/components/Toast/hooks.js +0 -1
  45. package/lib/commonjs/components/Toast/hooks.js.map +1 -1
  46. package/lib/commonjs/components/Toast/index.js +9 -6
  47. package/lib/commonjs/components/Toast/index.js.map +1 -1
  48. package/lib/commonjs/components/Toast/styles.js +36 -19
  49. package/lib/commonjs/components/Toast/styles.js.map +1 -1
  50. package/lib/commonjs/components/ToggleButton/index.js +5 -4
  51. package/lib/commonjs/components/ToggleButton/index.js.map +1 -1
  52. package/lib/commonjs/components/index.js +68 -0
  53. package/lib/commonjs/components/index.js.map +1 -1
  54. package/lib/commonjs/components/picker/surfaces.js +9 -2
  55. package/lib/commonjs/components/picker/surfaces.js.map +1 -1
  56. package/lib/commonjs/figma/Icon.figma.js +30 -3
  57. package/lib/commonjs/figma/Icon.figma.js.map +1 -1
  58. package/lib/commonjs/figma/Text.figma.js +15 -1
  59. package/lib/commonjs/figma/Text.figma.js.map +1 -1
  60. package/lib/commonjs/providers/toast/insets-container.js +15 -3
  61. package/lib/commonjs/providers/toast/insets-container.js.map +1 -1
  62. package/lib/commonjs/providers/toast/provider.js +1 -0
  63. package/lib/commonjs/providers/toast/provider.js.map +1 -1
  64. package/lib/commonjs/styles/constants.js +14 -1
  65. package/lib/commonjs/styles/constants.js.map +1 -1
  66. package/lib/module/components/ColorArea/ColorAreaPaint.js +74 -0
  67. package/lib/module/components/ColorArea/ColorAreaPaint.js.map +1 -0
  68. package/lib/module/components/ColorArea/ColorAreaPaint.web.js +27 -0
  69. package/lib/module/components/ColorArea/ColorAreaPaint.web.js.map +1 -0
  70. package/lib/module/components/ColorArea/index.js +53 -0
  71. package/lib/module/components/ColorArea/index.js.map +1 -0
  72. package/lib/module/components/ColorArea/styles.js +8 -0
  73. package/lib/module/components/ColorArea/styles.js.map +1 -0
  74. package/lib/module/components/ColorField/index.js +134 -0
  75. package/lib/module/components/ColorField/index.js.map +1 -0
  76. package/lib/module/components/ColorField/styles.js +10 -0
  77. package/lib/module/components/ColorField/styles.js.map +1 -0
  78. package/lib/module/components/ColorPicker/index.js +79 -0
  79. package/lib/module/components/ColorPicker/index.js.map +1 -0
  80. package/lib/module/components/ColorPicker/styles.js +18 -0
  81. package/lib/module/components/ColorPicker/styles.js.map +1 -0
  82. package/lib/module/components/ColorSlider/ColorSliderRailPaint.js +64 -0
  83. package/lib/module/components/ColorSlider/ColorSliderRailPaint.js.map +1 -0
  84. package/lib/module/components/ColorSlider/ColorSliderRailPaint.web.js +37 -0
  85. package/lib/module/components/ColorSlider/ColorSliderRailPaint.web.js.map +1 -0
  86. package/lib/module/components/ColorSlider/index.js +119 -0
  87. package/lib/module/components/ColorSlider/index.js.map +1 -0
  88. package/lib/module/components/ColorSlider/styles.js +46 -0
  89. package/lib/module/components/ColorSlider/styles.js.map +1 -0
  90. package/lib/module/components/ColorSwatch/index.js +50 -0
  91. package/lib/module/components/ColorSwatch/index.js.map +1 -0
  92. package/lib/module/components/ColorSwatch/styles.js +21 -0
  93. package/lib/module/components/ColorSwatch/styles.js.map +1 -0
  94. package/lib/module/components/ColorSwatchPicker/index.js +106 -0
  95. package/lib/module/components/ColorSwatchPicker/index.js.map +1 -0
  96. package/lib/module/components/ColorSwatchPicker/styles.js +13 -0
  97. package/lib/module/components/ColorSwatchPicker/styles.js.map +1 -0
  98. package/lib/module/components/Heading/styles.js +3 -0
  99. package/lib/module/components/Heading/styles.js.map +1 -1
  100. package/lib/module/components/Icon/index.js +27 -3
  101. package/lib/module/components/Icon/index.js.map +1 -1
  102. package/lib/module/components/Icon/styles.js +16 -0
  103. package/lib/module/components/Icon/styles.js.map +1 -0
  104. package/lib/module/components/Text/index.js +14 -5
  105. package/lib/module/components/Text/index.js.map +1 -1
  106. package/lib/module/components/Text/styles.js +38 -2
  107. package/lib/module/components/Text/styles.js.map +1 -1
  108. package/lib/module/components/Toast/hooks.js +0 -1
  109. package/lib/module/components/Toast/hooks.js.map +1 -1
  110. package/lib/module/components/Toast/index.js +10 -7
  111. package/lib/module/components/Toast/index.js.map +1 -1
  112. package/lib/module/components/Toast/styles.js +35 -19
  113. package/lib/module/components/Toast/styles.js.map +1 -1
  114. package/lib/module/components/ToggleButton/index.js +3 -3
  115. package/lib/module/components/ToggleButton/index.js.map +1 -1
  116. package/lib/module/components/index.js +6 -0
  117. package/lib/module/components/index.js.map +1 -1
  118. package/lib/module/components/picker/surfaces.js +10 -3
  119. package/lib/module/components/picker/surfaces.js.map +1 -1
  120. package/lib/module/figma/Icon.figma.js +30 -3
  121. package/lib/module/figma/Icon.figma.js.map +1 -1
  122. package/lib/module/figma/Text.figma.js +15 -1
  123. package/lib/module/figma/Text.figma.js.map +1 -1
  124. package/lib/module/providers/toast/insets-container.js +15 -4
  125. package/lib/module/providers/toast/insets-container.js.map +1 -1
  126. package/lib/module/providers/toast/provider.js +2 -1
  127. package/lib/module/providers/toast/provider.js.map +1 -1
  128. package/lib/module/styles/constants.js +13 -0
  129. package/lib/module/styles/constants.js.map +1 -1
  130. package/lib/typescript/components/Alert/index.d.ts +1 -1
  131. package/lib/typescript/components/Alert/index.d.ts.map +1 -1
  132. package/lib/typescript/components/Avatar/index.d.ts +1 -1
  133. package/lib/typescript/components/Avatar/index.d.ts.map +1 -1
  134. package/lib/typescript/components/Badge/styles.d.ts +3 -3
  135. package/lib/typescript/components/Breadcrumbs/styles.d.ts +1 -1
  136. package/lib/typescript/components/Button/index.d.ts +1 -1
  137. package/lib/typescript/components/Button/index.d.ts.map +1 -1
  138. package/lib/typescript/components/Button/styles.d.ts +4 -4
  139. package/lib/typescript/components/Checkbox/index.d.ts +1 -1
  140. package/lib/typescript/components/Checkbox/index.d.ts.map +1 -1
  141. package/lib/typescript/components/Chip/index.d.ts +1 -1
  142. package/lib/typescript/components/Chip/index.d.ts.map +1 -1
  143. package/lib/typescript/components/Chip/styles.d.ts +3 -3
  144. package/lib/typescript/components/ColorArea/ColorAreaPaint.d.ts +5 -0
  145. package/lib/typescript/components/ColorArea/ColorAreaPaint.d.ts.map +1 -0
  146. package/lib/typescript/components/ColorArea/ColorAreaPaint.web.d.ts +5 -0
  147. package/lib/typescript/components/ColorArea/ColorAreaPaint.web.d.ts.map +1 -0
  148. package/lib/typescript/components/ColorArea/index.d.ts +20 -0
  149. package/lib/typescript/components/ColorArea/index.d.ts.map +1 -0
  150. package/lib/typescript/components/ColorArea/styles.d.ts +4 -0
  151. package/lib/typescript/components/ColorArea/styles.d.ts.map +1 -0
  152. package/lib/typescript/components/ColorField/index.d.ts +41 -0
  153. package/lib/typescript/components/ColorField/index.d.ts.map +1 -0
  154. package/lib/typescript/components/ColorField/styles.d.ts +13 -0
  155. package/lib/typescript/components/ColorField/styles.d.ts.map +1 -0
  156. package/lib/typescript/components/ColorPicker/index.d.ts +28 -0
  157. package/lib/typescript/components/ColorPicker/index.d.ts.map +1 -0
  158. package/lib/typescript/components/ColorPicker/styles.d.ts +9 -0
  159. package/lib/typescript/components/ColorPicker/styles.d.ts.map +1 -0
  160. package/lib/typescript/components/ColorSlider/ColorSliderRailPaint.d.ts +5 -0
  161. package/lib/typescript/components/ColorSlider/ColorSliderRailPaint.d.ts.map +1 -0
  162. package/lib/typescript/components/ColorSlider/ColorSliderRailPaint.web.d.ts +5 -0
  163. package/lib/typescript/components/ColorSlider/ColorSliderRailPaint.web.d.ts.map +1 -0
  164. package/lib/typescript/components/ColorSlider/index.d.ts +33 -0
  165. package/lib/typescript/components/ColorSlider/index.d.ts.map +1 -0
  166. package/lib/typescript/components/ColorSlider/styles.d.ts +14 -0
  167. package/lib/typescript/components/ColorSlider/styles.d.ts.map +1 -0
  168. package/lib/typescript/components/ColorSwatch/index.d.ts +19 -0
  169. package/lib/typescript/components/ColorSwatch/index.d.ts.map +1 -0
  170. package/lib/typescript/components/ColorSwatch/styles.d.ts +7 -0
  171. package/lib/typescript/components/ColorSwatch/styles.d.ts.map +1 -0
  172. package/lib/typescript/components/ColorSwatchPicker/index.d.ts +37 -0
  173. package/lib/typescript/components/ColorSwatchPicker/index.d.ts.map +1 -0
  174. package/lib/typescript/components/ColorSwatchPicker/styles.d.ts +5 -0
  175. package/lib/typescript/components/ColorSwatchPicker/styles.d.ts.map +1 -0
  176. package/lib/typescript/components/Divider/index.d.ts +1 -1
  177. package/lib/typescript/components/Divider/index.d.ts.map +1 -1
  178. package/lib/typescript/components/Heading/styles.d.ts.map +1 -1
  179. package/lib/typescript/components/Icon/index.d.ts +14 -22
  180. package/lib/typescript/components/Icon/index.d.ts.map +1 -1
  181. package/lib/typescript/components/Icon/styles.d.ts +6 -0
  182. package/lib/typescript/components/Icon/styles.d.ts.map +1 -0
  183. package/lib/typescript/components/IconButton/styles.d.ts +2 -2
  184. package/lib/typescript/components/Input/index.d.ts +1 -1
  185. package/lib/typescript/components/Input/index.d.ts.map +1 -1
  186. package/lib/typescript/components/Link/index.d.ts +1 -1
  187. package/lib/typescript/components/Link/index.d.ts.map +1 -1
  188. package/lib/typescript/components/Menu/index.d.ts +2 -2
  189. package/lib/typescript/components/Menu/index.d.ts.map +1 -1
  190. package/lib/typescript/components/Select/index.d.ts +1 -1
  191. package/lib/typescript/components/Select/index.d.ts.map +1 -1
  192. package/lib/typescript/components/Slider/styles.d.ts +3 -3
  193. package/lib/typescript/components/Text/index.d.ts +40 -3
  194. package/lib/typescript/components/Text/index.d.ts.map +1 -1
  195. package/lib/typescript/components/Text/styles.d.ts +9 -0
  196. package/lib/typescript/components/Text/styles.d.ts.map +1 -1
  197. package/lib/typescript/components/Toast/hooks.d.ts +1 -1
  198. package/lib/typescript/components/Toast/hooks.d.ts.map +1 -1
  199. package/lib/typescript/components/Toast/index.d.ts.map +1 -1
  200. package/lib/typescript/components/Toast/styles.d.ts +4 -0
  201. package/lib/typescript/components/Toast/styles.d.ts.map +1 -1
  202. package/lib/typescript/components/Toast/types.d.ts +1 -1
  203. package/lib/typescript/components/Toast/types.d.ts.map +1 -1
  204. package/lib/typescript/components/ToggleButton/index.d.ts +5 -3
  205. package/lib/typescript/components/ToggleButton/index.d.ts.map +1 -1
  206. package/lib/typescript/components/index.d.ts +6 -0
  207. package/lib/typescript/components/index.d.ts.map +1 -1
  208. package/lib/typescript/components/picker/surfaces.d.ts +5 -1
  209. package/lib/typescript/components/picker/surfaces.d.ts.map +1 -1
  210. package/lib/typescript/figma/Icon.figma.d.ts.map +1 -1
  211. package/lib/typescript/figma/Text.figma.d.ts.map +1 -1
  212. package/lib/typescript/providers/toast/insets-container.d.ts +12 -0
  213. package/lib/typescript/providers/toast/insets-container.d.ts.map +1 -1
  214. package/lib/typescript/providers/toast/types.d.ts +5 -0
  215. package/lib/typescript/providers/toast/types.d.ts.map +1 -1
  216. package/lib/typescript/styles/constants.d.ts +10 -0
  217. package/lib/typescript/styles/constants.d.ts.map +1 -1
  218. package/package.json +5 -5
  219. package/src/components/Alert/index.tsx +1 -1
  220. package/src/components/Avatar/index.tsx +1 -1
  221. package/src/components/Button/index.tsx +1 -1
  222. package/src/components/Checkbox/index.tsx +1 -1
  223. package/src/components/Chip/index.tsx +1 -1
  224. package/src/components/ColorArea/ColorAreaPaint.tsx +51 -0
  225. package/src/components/ColorArea/ColorAreaPaint.web.tsx +31 -0
  226. package/src/components/ColorArea/index.tsx +71 -0
  227. package/src/components/ColorArea/styles.ts +18 -0
  228. package/src/components/ColorField/index.tsx +181 -0
  229. package/src/components/ColorField/styles.ts +20 -0
  230. package/src/components/ColorPicker/index.tsx +110 -0
  231. package/src/components/ColorPicker/styles.ts +33 -0
  232. package/src/components/ColorSlider/ColorSliderRailPaint.tsx +60 -0
  233. package/src/components/ColorSlider/ColorSliderRailPaint.web.tsx +33 -0
  234. package/src/components/ColorSlider/index.tsx +147 -0
  235. package/src/components/ColorSlider/styles.ts +72 -0
  236. package/src/components/ColorSwatch/index.tsx +56 -0
  237. package/src/components/ColorSwatch/styles.ts +24 -0
  238. package/src/components/ColorSwatchPicker/index.tsx +150 -0
  239. package/src/components/ColorSwatchPicker/styles.ts +32 -0
  240. package/src/components/Divider/index.tsx +1 -1
  241. package/src/components/Heading/styles.ts +3 -0
  242. package/src/components/Icon/index.tsx +46 -6
  243. package/src/components/Icon/styles.ts +15 -0
  244. package/src/components/Input/index.tsx +1 -1
  245. package/src/components/Link/index.tsx +1 -1
  246. package/src/components/Menu/index.tsx +2 -2
  247. package/src/components/Select/index.tsx +1 -1
  248. package/src/components/Text/index.tsx +32 -5
  249. package/src/components/Text/styles.ts +39 -1
  250. package/src/components/Toast/hooks.ts +0 -1
  251. package/src/components/Toast/index.tsx +14 -8
  252. package/src/components/Toast/styles.ts +47 -19
  253. package/src/components/Toast/types.ts +1 -1
  254. package/src/components/ToggleButton/index.tsx +9 -7
  255. package/src/components/index.ts +6 -0
  256. package/src/components/picker/surfaces.tsx +15 -2
  257. package/src/providers/toast/insets-container.tsx +23 -9
  258. package/src/providers/toast/provider.tsx +2 -2
  259. package/src/providers/toast/types.ts +5 -0
  260. package/src/styles/constants.ts +13 -0
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+
3
+ import { forwardRef, useMemo } from 'react';
4
+ import { View } from 'react-native';
5
+ import { ColorFieldInput as ColorFieldInputPrimitive, ColorFieldRoot as ColorFieldRootPrimitive, InputRoot as InputRootPrimitive, Slot, dataAttributes, mergeDataAttributes, useColorFieldContext } from '@cdx-ui/primitives';
6
+ import { cn, ParentContext, useParentContext } from '@cdx-ui/utils';
7
+ import { positionToDataIcon } from '../../utils/positionToDataIcon';
8
+ import { colorFieldGroupVariants, colorFieldInputPlaceholderVariants, colorFieldInputVariants, colorFieldSlotVariants, colorFieldVariants } from './styles';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ const SCOPE = 'COLOR_FIELD';
11
+ const useColorFieldStyleContext = () => useParentContext()[SCOPE] ?? {};
12
+ const ColorFieldRoot = /*#__PURE__*/forwardRef(({
13
+ variant = 'outline',
14
+ size = 'default',
15
+ fullWidth,
16
+ className,
17
+ children,
18
+ style,
19
+ ...props
20
+ }, ref) => {
21
+ const parent = useParentContext();
22
+ const context = useMemo(() => ({
23
+ ...parent,
24
+ [SCOPE]: {
25
+ variant,
26
+ size,
27
+ fullWidth
28
+ }
29
+ }), [fullWidth, parent, size, variant]);
30
+ return /*#__PURE__*/_jsx(ParentContext.Provider, {
31
+ value: context,
32
+ children: /*#__PURE__*/_jsx(ColorFieldRootPrimitive, {
33
+ ref: ref,
34
+ className: cn(colorFieldVariants(), className),
35
+ style: style,
36
+ ...props,
37
+ ...mergeDataAttributes(props, dataAttributes({
38
+ slot: 'color-field'
39
+ })),
40
+ children: children
41
+ })
42
+ });
43
+ });
44
+ ColorFieldRoot.displayName = 'ColorField';
45
+ const ColorFieldGroup = /*#__PURE__*/forwardRef(({
46
+ asChild,
47
+ variant,
48
+ size,
49
+ fullWidth,
50
+ className,
51
+ children,
52
+ style,
53
+ ...props
54
+ }, ref) => {
55
+ const inherited = useColorFieldStyleContext();
56
+ const {
57
+ disabled,
58
+ invalid,
59
+ readOnly,
60
+ required
61
+ } = useColorFieldContext();
62
+ const resolvedVariant = variant ?? inherited.variant ?? 'outline';
63
+ const resolvedSize = size ?? inherited.size ?? 'default';
64
+ const resolvedFullWidth = fullWidth ?? inherited.fullWidth ?? true;
65
+ return /*#__PURE__*/_jsx(InputRootPrimitive, {
66
+ ref: ref,
67
+ asChild: asChild,
68
+ isDisabled: disabled,
69
+ isInvalid: invalid,
70
+ isReadOnly: readOnly,
71
+ isRequired: required,
72
+ className: cn(colorFieldGroupVariants({
73
+ variant: resolvedVariant,
74
+ size: resolvedSize
75
+ }), !resolvedFullWidth && 'w-auto self-start', className),
76
+ style: style,
77
+ ...props,
78
+ ...mergeDataAttributes(props, dataAttributes({
79
+ slot: 'color-field-group'
80
+ })),
81
+ children: children
82
+ });
83
+ });
84
+ ColorFieldGroup.displayName = 'ColorField.Group';
85
+ const ColorFieldInput = /*#__PURE__*/forwardRef(({
86
+ className,
87
+ placeholderTextColorClassName,
88
+ style,
89
+ ...props
90
+ }, ref) => {
91
+ const {
92
+ size
93
+ } = useColorFieldStyleContext();
94
+ return /*#__PURE__*/_jsx(ColorFieldInputPrimitive, {
95
+ ref: ref,
96
+ className: cn(colorFieldInputVariants({
97
+ size: size ?? 'default'
98
+ }), className),
99
+ placeholderTextColorClassName: cn(colorFieldInputPlaceholderVariants(), placeholderTextColorClassName),
100
+ style: style,
101
+ ...props,
102
+ ...mergeDataAttributes(props, dataAttributes({
103
+ slot: 'color-field-input'
104
+ }))
105
+ });
106
+ });
107
+ ColorFieldInput.displayName = 'ColorField.Input';
108
+ const ColorFieldSlot = /*#__PURE__*/forwardRef(({
109
+ asChild,
110
+ position,
111
+ className,
112
+ children,
113
+ style,
114
+ ...props
115
+ }, ref) => {
116
+ const Comp = asChild ? Slot : View;
117
+ return /*#__PURE__*/_jsx(Comp, {
118
+ ref: ref,
119
+ className: cn(colorFieldSlotVariants(), className),
120
+ style: style,
121
+ ...props,
122
+ ...mergeDataAttributes(props, dataAttributes({
123
+ slot: 'color-field-slot'
124
+ }), positionToDataIcon(position)),
125
+ children: children
126
+ });
127
+ });
128
+ ColorFieldSlot.displayName = 'ColorField.Slot';
129
+ export const ColorField = Object.assign(ColorFieldRoot, {
130
+ Group: ColorFieldGroup,
131
+ Input: ColorFieldInput,
132
+ Slot: ColorFieldSlot
133
+ });
134
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","useMemo","View","ColorFieldInput","ColorFieldInputPrimitive","ColorFieldRoot","ColorFieldRootPrimitive","InputRoot","InputRootPrimitive","Slot","dataAttributes","mergeDataAttributes","useColorFieldContext","cn","ParentContext","useParentContext","positionToDataIcon","colorFieldGroupVariants","colorFieldInputPlaceholderVariants","colorFieldInputVariants","colorFieldSlotVariants","colorFieldVariants","jsx","_jsx","SCOPE","useColorFieldStyleContext","variant","size","fullWidth","className","children","style","props","ref","parent","context","Provider","value","slot","displayName","ColorFieldGroup","asChild","inherited","disabled","invalid","readOnly","required","resolvedVariant","resolvedSize","resolvedFullWidth","isDisabled","isInvalid","isReadOnly","isRequired","placeholderTextColorClassName","ColorFieldSlot","position","Comp","ColorField","Object","assign","Group","Input"],"sourceRoot":"../../../../src","sources":["components/ColorField/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,OAAO,QAAwB,OAAO;AAC3D,SAAoBC,IAAI,QAAwB,cAAc;AAC9D,SACEC,eAAe,IAAIC,wBAAwB,EAC3CC,cAAc,IAAIC,uBAAuB,EACzCC,SAAS,IAAIC,kBAAkB,EAC/BC,IAAI,EACJC,cAAc,EACdC,mBAAmB,EACnBC,oBAAoB,QAGf,oBAAoB;AAC3B,SAASC,EAAE,EAAEC,aAAa,EAAEC,gBAAgB,QAAQ,eAAe;AACnE,SAASC,kBAAkB,QAA+B,gCAAgC;AAC1F,SACEC,uBAAuB,EACvBC,kCAAkC,EAClCC,uBAAuB,EACvBC,sBAAsB,EACtBC,kBAAkB,QAEb,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElB,MAAMC,KAAK,GAAG,aAAa;AAM3B,MAAMC,yBAAyB,GAAGA,CAAA,KAC/BV,gBAAg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+
3
+ import { cva } from '@cdx-ui/utils';
4
+ import { inputFieldPlaceholderVariants, inputFieldVariants, inputRootVariants, inputSlotVariants } from '../Input/styles';
5
+ export const colorFieldVariants = cva('gap-1.5');
6
+ export const colorFieldGroupVariants = inputRootVariants;
7
+ export const colorFieldInputVariants = inputFieldVariants;
8
+ export const colorFieldInputPlaceholderVariants = inputFieldPlaceholderVariants;
9
+ export const colorFieldSlotVariants = inputSlotVariants;
10
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["cva","inputFieldPlaceholderVariants","inputFieldVariants","inputRootVariants","inputSlotVariants","colorFieldVariants","colorFieldGroupVariants","colorFieldInputVariants","colorFieldInputPlaceholderVariants","colorFieldSlotVariants"],"sourceRoot":"../../../../src","sources":["components/ColorField/styles.ts"],"mappings":";;AAAA,SAASA,GAAG,QAAQ,eAAe;AACnC,SACEC,6BAA6B,EAC7BC,kBAAkB,EAClBC,iBAAiB,EACjBC,iBAAiB,QAEZ,iBAAiB;AAExB,OAAO,MAAMC,kBAAkB,GAAGL,GAAG,CAAC,SAAS,CAAC;AAEhD,OAAO,MAAMM,uBAAuB,GAAGH,iBAAiB;AAExD,OAAO,MAAMI,uBAAuB,GAAGL,kBAAkB;AAEzD,OAAO,MAAMM,kCAAkC,GAAGP,6BAA6B;AAE/E,OAAO,MAAMQ,sBAAsB,GAAGL,iBAAiB","ignoreList":[]}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ import { forwardRef } from 'react';
4
+ import { ColorPickerProvider, ColorPickerRoot as ColorPickerRootPrimitive, ColorPickerRootProvider, ColorPickerTrigger as ColorPickerTriggerPrimitive, dataAttributes, mergeDataAttributes, useColorPickerRootContext } from '@cdx-ui/primitives';
5
+ import { cn } from '@cdx-ui/utils';
6
+ import { PickerPopoverSurface } from '../picker/surfaces';
7
+ import { colorPickerPopoverContentVariants, colorPickerPopoverVariants, colorPickerTriggerVariants, colorPickerVariants } from './styles';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ const ColorPickerRoot = /*#__PURE__*/forwardRef(({
10
+ asChild,
11
+ className,
12
+ style,
13
+ children,
14
+ ...props
15
+ }, ref) => /*#__PURE__*/_jsx(ColorPickerRootPrimitive, {
16
+ ref: ref,
17
+ asChild: asChild,
18
+ className: cn(colorPickerVariants(), className),
19
+ style: style,
20
+ ...props,
21
+ ...mergeDataAttributes(props, dataAttributes({
22
+ slot: 'color-picker'
23
+ })),
24
+ children: children
25
+ }));
26
+ ColorPickerRoot.displayName = 'ColorPicker';
27
+ const ColorPickerTrigger = /*#__PURE__*/forwardRef(({
28
+ asChild,
29
+ className,
30
+ style,
31
+ children,
32
+ ...props
33
+ }, ref) => /*#__PURE__*/_jsx(ColorPickerTriggerPrimitive, {
34
+ ref: ref,
35
+ asChild: asChild,
36
+ className: asChild ? className : cn(colorPickerTriggerVariants(), className),
37
+ style: style,
38
+ ...props,
39
+ ...mergeDataAttributes(props, dataAttributes({
40
+ slot: 'color-picker-trigger'
41
+ })),
42
+ children: children
43
+ }));
44
+ ColorPickerTrigger.displayName = 'ColorPicker.Trigger';
45
+ const registerPopoverSurface = type => {
46
+ void type;
47
+ };
48
+ function ColorPickerPopover({
49
+ className,
50
+ contentClassName,
51
+ children
52
+ }) {
53
+ const context = useColorPickerRootContext();
54
+ return /*#__PURE__*/_jsx(PickerPopoverSurface, {
55
+ open: context.open,
56
+ setOpen: context.setOpen,
57
+ registerSurface: registerPopoverSurface,
58
+ anchorRef: context.anchorRef,
59
+ triggerRef: context.triggerRef,
60
+ className: cn(colorPickerPopoverVariants(), className),
61
+ contentClassName: cn(colorPickerPopoverContentVariants(), contentClassName),
62
+ dataSlot: "color-picker-popover",
63
+ width: "content",
64
+ children: /*#__PURE__*/_jsx(ColorPickerRootProvider, {
65
+ value: context,
66
+ children: /*#__PURE__*/_jsx(ColorPickerProvider, {
67
+ value: context,
68
+ children: children
69
+ })
70
+ })
71
+ });
72
+ }
73
+ ColorPickerPopover.displayName = 'ColorPicker.Popover';
74
+ export const ColorPicker = Object.assign(ColorPickerRoot, {
75
+ Trigger: ColorPickerTrigger,
76
+ Popover: ColorPickerPopover
77
+ });
78
+ export { parseColor } from '@cdx-ui/primitives';
79
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","ColorPickerProvider","ColorPickerRoot","ColorPickerRootPrimitive","ColorPickerRootProvider","ColorPickerTrigger","ColorPickerTriggerPrimitive","dataAttributes","mergeDataAttributes","useColorPickerRootContext","cn","PickerPopoverSurface","colorPickerPopoverContentVariants","colorPickerPopoverVariants","colorPickerTriggerVariants","colorPickerVariants","jsx","_jsx","asChild","className","style","children","props","ref","slot","displayName","registerPopoverSurface","type","ColorPickerPopover","contentClassName","context","open","setOpen","registerSurface","anchorRef","triggerRef","dataSlot","width","value","ColorPicker","Object","assign","Trigger","Popover","parseColor"],"sourceRoot":"../../../../src","sources":["components/ColorPicker/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAwB,OAAO;AAElD,SACEC,mBAAmB,EACnBC,eAAe,IAAIC,wBAAwB,EAC3CC,uBAAuB,EACvBC,kBAAkB,IAAIC,2BAA2B,EACjDC,cAAc,EACdC,mBAAmB,EACnBC,yBAAyB,QAGpB,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,eAAe;AAClC,SAASC,oBAAoB,QAAQ,oBAAoB;AACzD,SACEC,iCAAiC,EACjCC,0BAA0B,EAC1BC,0BAA0B,EAC1BC,mBAAmB,QACd,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMlB,MAAMf,eAAe,gBAAGF,UAAU,CAChC,CAAC;EAAEkB,OAAO;EAAEC,SAAS;EAAEC,KAAK;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,kBACrDN,IAAA,CAACd,wBAAwB;EACvBoB,GAAG,EAAEA,GAAI;EACTL,OAAO,EAAEA,OAAQ;EACjBC,SAAS,EAAET,EAAE,CAACK,mBAAm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AO,CAACK,UAAW;IAC/BhB,SAAS,EAAET,EAAE,CAACG,0BAA0B,CAAC,CAAC,EAAEM,SAAS,CAAE;IACvDU,gBAAgB,EAAEnB,EAAE,CAACE,iCAAiC,CAAC,CAAC,EAAEiB,gBAAgB,CAAE;IAC5EO,QAAQ,EAAC,sBAAsB;IAC/BC,KAAK,EAAC,SAAS;IAAAhB,QAAA,eAEfJ,IAAA,CAACb,uBAAuB;MAACkC,KAAK,EAAER,OAAQ;MAAAT,QAAA,eACtCJ,IAAA,CAAChB,mBAAmB;QAACqC,KAAK,EAAER,OAAQ;QAAAT,QAAA,EAAEA;MAAQ,CAAsB;IAAC,CAC9C;EAAC,CACN,CAAC;AAE3B;AAEAO,kBAAkB,CAACH,WAAW,GAAG,qBAAqB;AAOtD,OAAO,MAAMc,WAAW,GAAGC,MAAM,CAACC,MAAM,CAACvC,eAAe,EAAE;EACxDwC,OAAO,EAAErC,kBAAkB;EAC3BsC,OAAO,EAAEf;AACX,CAAC,CAAiC;AAElC,SAASgB,UAAU,QAAQ,oBAAoB","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ import { Platform } from 'react-native';
4
+ import { cva } from '@cdx-ui/utils';
5
+ import { DISABLED_CURSOR, TRANSITION_COLORS } from '../../styles/constants';
6
+ export const colorPickerVariants = cva(['items-start gap-2']);
7
+ export const colorPickerTriggerVariants = 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', TRANSITION_COLORS, 'data-[disabled=true]:opacity-[var(--opacity-disabled)]', 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', Platform.select({
8
+ default: 'data-[active=true]:bg-surface-action-tint-active',
9
+ web: ['data-[hover=true]:bg-surface-action-tint-hover', 'data-[active=true]:data-[hover=true]:bg-surface-action-tint-active'].join(' ')
10
+ })]);
11
+
12
+ /**
13
+ * Padding lives on the scroll content, not the popover: the popover's `ScrollView` clips at its
14
+ * own bounds, and slider/area thumbs overhang their track ends by half a thumb plus shadow.
15
+ */
16
+ export const colorPickerPopoverVariants = cva(['w-80 p-0']);
17
+ export const colorPickerPopoverContentVariants = cva(['gap-3 p-4']);
18
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","cva","DISABLED_CURSOR","TRANSITION_COLORS","colorPickerVariants","colorPickerTriggerVariants","select","default","web","join","colorPickerPopoverVariants","colorPickerPopoverContentVariants"],"sourceRoot":"../../../../src","sources":["components/ColorPicker/styles.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,GAAG,QAAQ,eAAe;AACnC,SAASC,eAAe,EAAEC,iBAAiB,QAAQ,wBAAwB;AAE3E,OAAO,MAAMC,mBAAmB,GAAGH,GAAG,CAAC,CAAC,mBAAmB,CAAC,CAAC;AAE7D,OAAO,MAAMI,0BAA0B,GAAGJ,GAAG,CAAC,CAC5C,iEAAiE,EACjE,uCAAuC,EACvC,4CAA4C,EAC5CE,iBAAiB,EACjB,wDAAwD,EACxDD,eAAe,EACf,wEAAwE,EACxE,sCAAsC,EACtC,iDAAiD,EACjD,6CAA6C,EAC7CF,QAAQ,CAACM,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;AACA,OAAO,MAAMC,0BAA0B,GAAGT,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC;AAE3D,OAAO,MAAMU,iCAAiC,GAAGV,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ import { useId } from 'react';
4
+ import { StyleSheet, View } from 'react-native';
5
+ import { Defs, LinearGradient, Rect, Stop, Svg } from 'react-native-svg';
6
+ import { useColorSliderContext } from '@cdx-ui/primitives';
7
+ import { colorSliderRailPaintVariants } from './styles';
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ function getStopOffset(index, count, railSize, endCap) {
10
+ const ratio = index / (count - 1);
11
+ if (railSize <= 0 || endCap <= 0) {
12
+ return `${String(ratio * 100)}%`;
13
+ }
14
+ return `${String((endCap + ratio * railSize) / (railSize + 2 * endCap) * 100)}%`;
15
+ }
16
+ export function ColorSliderRailPaint() {
17
+ const {
18
+ gradientColors,
19
+ orientation,
20
+ layout,
21
+ thumbSize
22
+ } = useColorSliderContext();
23
+ const gradientId = useId();
24
+ const isVertical = orientation === 'vertical';
25
+ const railSize = (isVertical ? layout?.height : layout?.width) ?? 0;
26
+ const endCap = (isVertical ? thumbSize.height : thumbSize.width) / 2;
27
+ return /*#__PURE__*/_jsx(View, {
28
+ className: colorSliderRailPaintVariants({
29
+ orientation
30
+ }),
31
+ style: styles.paint,
32
+ accessible: false,
33
+ accessibilityElementsHidden: true,
34
+ importantForAccessibility: "no-hide-descendants",
35
+ children: /*#__PURE__*/_jsxs(Svg, {
36
+ width: "100%",
37
+ height: "100%",
38
+ children: [/*#__PURE__*/_jsx(Defs, {
39
+ children: /*#__PURE__*/_jsx(LinearGradient, {
40
+ id: gradientId,
41
+ x1: "0%",
42
+ y1: orientation === 'vertical' ? '100%' : '0%',
43
+ x2: orientation === 'horizontal' ? '100%' : '0%',
44
+ y2: "0%",
45
+ children: gradientColors.map((color, index) => /*#__PURE__*/_jsx(Stop, {
46
+ offset: getStopOffset(index, gradientColors.length, railSize, endCap),
47
+ stopColor: color
48
+ }, `${color}-${String(index)}`))
49
+ })
50
+ }), /*#__PURE__*/_jsx(Rect, {
51
+ width: "100%",
52
+ height: "100%",
53
+ fill: `url(#${gradientId})`
54
+ })]
55
+ })
56
+ });
57
+ }
58
+ ColorSliderRailPaint.displayName = 'ColorSliderRailPaint';
59
+ const styles = StyleSheet.create({
60
+ paint: {
61
+ pointerEvents: 'none'
62
+ }
63
+ });
64
+ //# sourceMappingURL=ColorSliderRailPaint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useId","StyleSheet","View","Defs","LinearGradient","Rect","Stop","Svg","useColorSliderContext","colorSliderRailPaintVariants","jsx","_jsx","jsxs","_jsxs","getStopOffset","index","count","railSize","endCap","ratio","String","ColorSliderRailPaint","gradientColors","orientation","layout","thumbSize","gradientId","isVertical","height","width","className","style","styles","paint","accessible","accessibilityElementsHidden","importantForAccessibility","children","id","x1","y1","x2","y2","map","color","offset","length","stopColor","fill","displayName","create","pointerEvents"],"sourceRoot":"../../../../src","sources":["components/ColorSlider/ColorSliderRailPaint.tsx"],"mappings":";;AAAA,SAASA,KAAK,QAAQ,OAAO;AAC7B,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SAASC,IAAI,EAAEC,cAAc,EAAEC,IAAI,EAAEC,IAAI,EAAEC,GAAG,QAAQ,kBAAkB;AACxE,SAASC,qBAAqB,QAAQ,oBAAoB;AAC1D,SAASC,4BAA4B,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAExD,SAASC,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;IAChC,OAAO,GAAGE,MAAM,CAACD,KAAK,GAAG,GAAG,CAAC,GAAG;EAClC;EACA,OAAO,GAAGC,MAAM,CAAE,CAACF,MAAM,GAAGC,KAAK,GAAGF,QAAQ,KAAKA,QAAQ,GAAG,CAAC,GAAGC,MAAM,CAAC,GAAI,GAAG,CAAC,GAAG;AACpF;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,SAAS,EAAEH;UAAM,GAFZ,GAAGA,KAAK,IAAIxB,MAAM,CAACL,KAAK,CAAC,EAG/B,CACF;QAAC,CACY;MAAC,CACb,CAAC,eACPJ,IAAA,CAACN,IAAI;QAACwB,KAAK,EAAC,MAAM;QAACD,MAAM,EAAC,MAAM;QAACoB,IAAI,EAAE,QAAQtB,UAAU;MAAI,CAAE,CAAC;IAAA,CAC7D;EAAC,CACF,CAAC;AAEX;AAEAL,oBAAoB,CAAC4B,WAAW,GAAG,sBAAsB;AAEzD,MAAMjB,MAAM,GAAG/B,UAAU,CAACiD,MAAM,CAAC;EAC/BjB,KAAK,EAAE;IACLkB,aAAa,EAAE;EACjB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ import { View } from 'react-native';
4
+ import { useColorSliderContext } from '@cdx-ui/primitives';
5
+ import { colorSliderRailPaintVariants } from './styles';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ function getGradientStops(colors, endCap) {
8
+ if (endCap <= 0 || colors.length < 2) {
9
+ return colors.join(', ');
10
+ }
11
+ const first = `${colors[0]} ${String(endCap)}px`;
12
+ const last = `${colors[colors.length - 1]} calc(100% - ${String(endCap)}px)`;
13
+ return [first, ...colors.slice(1, -1), last].join(', ');
14
+ }
15
+ export function ColorSliderRailPaint() {
16
+ const {
17
+ gradientColors,
18
+ orientation,
19
+ thumbSize
20
+ } = useColorSliderContext();
21
+ const direction = orientation === 'vertical' ? 'to top' : 'to right';
22
+ const endCap = (orientation === 'vertical' ? thumbSize.height : thumbSize.width) / 2;
23
+ const paintStyle = {
24
+ backgroundImage: `linear-gradient(${direction}, ${getGradientStops(gradientColors, endCap)})`
25
+ };
26
+ return /*#__PURE__*/_jsx(View, {
27
+ className: colorSliderRailPaintVariants({
28
+ orientation
29
+ }),
30
+ style: paintStyle,
31
+ accessible: false,
32
+ accessibilityElementsHidden: true,
33
+ importantForAccessibility: "no-hide-descendants"
34
+ });
35
+ }
36
+ ColorSliderRailPaint.displayName = 'ColorSliderRailPaint';
37
+ //# sourceMappingURL=ColorSliderRailPaint.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["View","useColorSliderContext","colorSliderRailPaintVariants","jsx","_jsx","getGradientStops","colors","endCap","length","join","first","String","last","slice","ColorSliderRailPaint","gradientColors","orientation","thumbSize","direction","height","width","paintStyle","backgroundImage","className","style","accessible","accessibilityElementsHidden","importantForAccessibility","displayName"],"sourceRoot":"../../../../src","sources":["components/ColorSlider/ColorSliderRailPaint.web.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAwB,cAAc;AACnD,SAASC,qBAAqB,QAAQ,oBAAoB;AAC1D,SAASC,4BAA4B,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAExD,SAASC,gBAAgBA,CAACC,MAAyB,EAAEC,MAAc,EAAU;EAC3E,IAAIA,MAAM,IAAI,CAAC,IAAID,MAAM,CAACE,MAAM,GAAG,CAAC,EAAE;IACpC,OAAOF,MAAM,CAACG,IAAI,CAAC,IAAI,CAAC;EAC1B;EACA,MAAMC,KAAK,GAAG,GAAGJ,MAAM,CAAC,CAAC,CAAC,IAAIK,MAAM,CAACJ,MAAM,CAAC,IAAI;EAChD,MAAMK,IAAI,GAAG,GAAGN,MAAM,CAACA,MAAM,CAACE,MAAM,GAAG,CAAC,CAAC,gBAAgBG,MAAM,CAACJ,MAAM,CAAC,KAAK;EAC5E,OAAO,CAACG,KAAK,EAAE,GAAGJ,MAAM,CAACO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAED,IAAI,CAAC,CAACH,IAAI,CAAC,IAAI,CAAC;AACzD;AAEA,OAAO,SAASK,oBAAoBA,CAAA,EAAG;EACrC,MAAM;IAAEC,cAAc;IAAEC,WAAW;IAAEC;EAAU,CAAC,GAAGhB,qBAAqB,CAAC,CAAC;EAC1E,MAAMiB,SAAS,GAAGF,WAAW,KAAK,UAAU,GAAG,QAAQ,GAAG,UAAU;EACpE,MAAMT,MAAM,GAAG,CAACS,WAAW,KAAK,UAAU,GAAGC,SAAS,CAACE,MAAM,GAAGF,SAAS,CAACG,KAAK,IAAI,CAAC;EACpF,MAAMC,UAAU,GAAG;IACjBC,eAAe,EAAE,mBAAmBJ,SAAS,KAAKb,gBAAgB,CAACU,cAAc,EAAER,MAAM,CAAC;EAC5F,CAAyB;EAEzB,oBACEH,IAAA,CAACJ,IAAI;IACHuB,SAAS,EAAErB,4BAA4B,CAAC;MAAEc;IAAY,CAAC,CAAE;IACzDQ,KAAK,EAAEH,UAAW;IAClBI,UAAU,EAAE,KAAM;IAClBC,2BAA2B;IAC3BC,yBAAyB,EAAC;EAAqB,CAChD,CAAC;AAEN;AAEAb,oBAAoB,CAACc,WAAW,GAAG,sBAAsB","ignoreList":[]}
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+
3
+ import { forwardRef } from 'react';
4
+ import { Text } from 'react-native';
5
+ import { ColorSliderRail as ColorSliderRailPrimitive, ColorSliderRoot as ColorSliderRootPrimitive, ColorSliderThumb as ColorSliderThumbPrimitive, Slot, dataAttributes, mergeDataAttributes, useColorSliderContext } from '@cdx-ui/primitives';
6
+ import { cn } from '@cdx-ui/utils';
7
+ import { ColorSliderRailPaint } from './ColorSliderRailPaint';
8
+ import { colorSliderOutputVariants, colorSliderRailVariants, colorSliderThumbVariants, colorSliderVariants } from './styles';
9
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ const ColorSliderRoot = /*#__PURE__*/forwardRef(({
11
+ asChild,
12
+ className,
13
+ style,
14
+ orientation = 'horizontal',
15
+ children,
16
+ ...props
17
+ }, ref) => /*#__PURE__*/_jsx(ColorSliderRootPrimitive, {
18
+ ref: ref,
19
+ asChild: asChild,
20
+ className: cn(colorSliderVariants({
21
+ orientation
22
+ }), className),
23
+ style: style,
24
+ orientation: orientation,
25
+ ...props,
26
+ ...mergeDataAttributes(props, dataAttributes({
27
+ slot: 'color-slider'
28
+ })),
29
+ children: children
30
+ }));
31
+ ColorSliderRoot.displayName = 'ColorSlider';
32
+ const ColorSliderRail = /*#__PURE__*/forwardRef(({
33
+ asChild,
34
+ className,
35
+ style,
36
+ hitSlop,
37
+ children,
38
+ ...props
39
+ }, ref) => {
40
+ const {
41
+ orientation,
42
+ thumbSize
43
+ } = useColorSliderContext();
44
+ const endCap = orientation === 'vertical' ? {
45
+ top: thumbSize.height / 2,
46
+ bottom: thumbSize.height / 2
47
+ } : {
48
+ left: thumbSize.width / 2,
49
+ right: thumbSize.width / 2
50
+ };
51
+ return /*#__PURE__*/_jsxs(ColorSliderRailPrimitive, {
52
+ ref: ref,
53
+ asChild: asChild,
54
+ className: cn(colorSliderRailVariants({
55
+ orientation
56
+ }), className),
57
+ style: style,
58
+ hitSlop: hitSlop ?? endCap,
59
+ ...props,
60
+ ...mergeDataAttributes(props, dataAttributes({
61
+ slot: 'color-slider-rail'
62
+ })),
63
+ children: [/*#__PURE__*/_jsx(ColorSliderRailPaint, {}), children]
64
+ });
65
+ });
66
+ ColorSliderRail.displayName = 'ColorSlider.Rail';
67
+ const ColorSliderThumb = /*#__PURE__*/forwardRef(({
68
+ className,
69
+ style,
70
+ children,
71
+ ...props
72
+ }, ref) => {
73
+ const {
74
+ value
75
+ } = useColorSliderContext();
76
+ const fillStyle = {
77
+ backgroundColor: value.toString('hex')
78
+ };
79
+ return /*#__PURE__*/_jsx(ColorSliderThumbPrimitive, {
80
+ ref: ref,
81
+ className: cn(colorSliderThumbVariants(), className),
82
+ style: typeof style === 'function' ? state => [fillStyle, style(state)] : [fillStyle, style],
83
+ ...props,
84
+ ...mergeDataAttributes(props, dataAttributes({
85
+ slot: 'color-slider-thumb'
86
+ })),
87
+ children: children
88
+ });
89
+ });
90
+ ColorSliderThumb.displayName = 'ColorSlider.Thumb';
91
+ const ColorSliderOutput = /*#__PURE__*/forwardRef(({
92
+ asChild,
93
+ className,
94
+ style,
95
+ children,
96
+ ...props
97
+ }, ref) => {
98
+ const {
99
+ valueLabel
100
+ } = useColorSliderContext();
101
+ const Comp = asChild ? Slot : Text;
102
+ return /*#__PURE__*/_jsx(Comp, {
103
+ ref: ref,
104
+ className: cn(colorSliderOutputVariants(), className),
105
+ style: style,
106
+ ...props,
107
+ ...mergeDataAttributes(props, dataAttributes({
108
+ slot: 'color-slider-output'
109
+ })),
110
+ children: children ?? valueLabel
111
+ });
112
+ });
113
+ ColorSliderOutput.displayName = 'ColorSlider.Output';
114
+ export const ColorSlider = Object.assign(ColorSliderRoot, {
115
+ Rail: ColorSliderRail,
116
+ Thumb: ColorSliderThumb,
117
+ Output: ColorSliderOutput
118
+ });
119
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","Text","ColorSliderRail","ColorSliderRailPrimitive","ColorSliderRoot","ColorSliderRootPrimitive","ColorSliderThumb","ColorSliderThumbPrimitive","Slot","dataAttributes","mergeDataAttributes","useColorSliderContext","cn","ColorSliderRailPaint","colorSliderOutputVariants","colorSliderRailVariants","colorSliderThumbVariants","colorSliderVariants","jsx","_jsx","jsxs","_jsxs","asChild","className","style","orientation","children","props","ref","slot","displayName","hitSlop","thumbSize","endCap","top","height","bottom","left","width","right","value","fillStyle","backgroundColor","toString","state","ColorSliderOutput","valueLabel","Comp","ColorSlider","Object","assign","Rail","Thumb","Output"],"sourceRoot":"../../../../src","sources":["components/ColorSlider/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAwB,OAAO;AAClD,SAASC,IAAI,QAA+D,cAAc;AAC1F,SACEC,eAAe,IAAIC,wBAAwB,EAC3CC,eAAe,IAAIC,wBAAwB,EAC3CC,gBAAgB,IAAIC,yBAAyB,EAC7CC,IAAI,EACJC,cAAc,EACdC,mBAAmB,EACnBC,qBAAqB,QAIhB,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,eAAe;AAClC,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SACEC,yBAAyB,EACzBC,uBAAuB,EACvBC,wBAAw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C;AAEDpB,gBAAgB,CAACwB,WAAW,GAAG,mBAAmB;AAQlD,MAAMe,iBAAiB,gBAAG7C,UAAU,CAClC,CAAC;EAAEsB,OAAO;EAAEC,SAAS;EAAEC,KAAK;EAAEE,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EAC1D,MAAM;IAAEkB;EAAW,CAAC,GAAGnC,qBAAqB,CAAC,CAAC;EAC9C,MAAMoC,IAAI,GAAGzB,OAAO,GAAGd,IAAI,GAAGP,IAAI;EAElC,oBACEkB,IAAA,CAAC4B,IAAI;IACHnB,GAAG,EAAEA,GAAI;IACTL,SAAS,EAAEX,EAAE,CAACE,yBAAyB,CAAC,CAAC,EAAES,SAAS,CAAE;IACtDC,KAAK,EAAEA,KAAM;IAAA,GACTG,KAAK;IAAA,GACLjB,mBAAmB,CAACiB,KAAK,EAAElB,cAAc,CAAC;MAAEoB,IAAI,EAAE;IAAsB,CAAC,CAAC,CAAC;IAAAH,QAAA,EAE9EA,QAAQ,IAAIoB;EAAU,CACnB,CAAC;AAEX,CACF,CAAC;AAEDD,iBAAiB,CAACf,WAAW,GAAG,oBAAoB;AAQpD,OAAO,MAAMkB,WAAW,GAAGC,MAAM,CAACC,MAAM,CAAC9C,eAAe,EAAE;EACxD+C,IAAI,EAAEjD,eAAe;EACrBkD,KAAK,EAAE9C,gBAAgB;EACvB+C,MAAM,EAAER;AACV,CAAC,CAAiC","ignoreList":[]}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ import { Platform } from 'react-native';
4
+ import { cva } from '@cdx-ui/utils';
5
+ import { DISABLED_CURSOR } from '../../styles/constants';
6
+ export const colorSliderVariants = cva(['relative select-none', 'data-[disabled=true]:opacity-[var(--opacity-disabled)]', DISABLED_CURSOR], {
7
+ variants: {
8
+ orientation: {
9
+ horizontal: 'w-full',
10
+ vertical: 'h-48'
11
+ }
12
+ },
13
+ defaultVariants: {
14
+ orientation: 'horizontal'
15
+ }
16
+ });
17
+
18
+ // The rail inset equals the `size-5` thumb's radius so the thumb sits flush inside the pill ends.
19
+ export const colorSliderRailVariants = cva(['relative touch-none'], {
20
+ variants: {
21
+ orientation: {
22
+ horizontal: 'mx-2.5 h-5 w-auto',
23
+ vertical: 'my-2.5 w-5 flex-1'
24
+ }
25
+ },
26
+ defaultVariants: {
27
+ orientation: 'horizontal'
28
+ }
29
+ });
30
+ export const colorSliderRailPaintVariants = cva(['absolute overflow-hidden rounded-[var(--border-radius-round)]'], {
31
+ variants: {
32
+ orientation: {
33
+ horizontal: '-inset-x-2.5 inset-y-0',
34
+ vertical: '-inset-y-2.5 inset-x-0'
35
+ }
36
+ },
37
+ defaultVariants: {
38
+ orientation: 'horizontal'
39
+ }
40
+ });
41
+ export const colorSliderThumbVariants = 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', Platform.select({
42
+ default: 'data-[focus=true]:scale-105',
43
+ 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(' ')
44
+ })]);
45
+ export const colorSliderOutputVariants = cva(['text-sm font-medium text-content-primary']);
46
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","cva","DISABLED_CURSOR","colorSliderVariants","variants","orientation","horizontal","vertical","defaultVariants","colorSliderRailVariants","colorSliderRailPaintVariants","colorSliderThumbVariants","select","default","web","join","colorSliderOutputVariants"],"sourceRoot":"../../../../src","sources":["components/ColorSlider/styles.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,GAAG,QAA2B,eAAe;AACtD,SAASC,eAAe,QAAQ,wBAAwB;AAExD,OAAO,MAAMC,mBAAmB,GAAGF,GAAG,CACpC,CACE,sBAAsB,EACtB,wDAAwD,EACxDC,eAAe,CAChB,EACD;EACEE,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;AACA,OAAO,MAAMI,uBAAuB,GAAGR,GAAG,CAAC,CAAC,qBAAqB,CAAC,EAAE;EAClEG,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;AAEF,OAAO,MAAMK,4BAA4B,GAAGT,GAAG,CAC7C,CAAC,+DAA+D,CAAC,EACjE;EACEG,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;AAED,OAAO,MAAMM,wBAAwB,GAAGV,GAAG,CAAC,CAC1C,4DAA4D,EAC5D,2CAA2C,EAC3C,wDAAwD,EACxD,sCAAsC,EACtC,6CAA6C,EAC7CD,QAAQ,CAACY,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;AAEF,OAAO,MAAMC,yBAAyB,GAAGf,GAAG,CAAC,CAAC,0CAA0C,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ import { forwardRef } from 'react';
4
+ import { View } from 'react-native';
5
+ import { Slot, dataAttributes, mergeDataAttributes, useOptionalColorPickerContext } from '@cdx-ui/primitives';
6
+ import { cn } from '@cdx-ui/utils';
7
+ import { colorSwatchVariants } from './styles';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ export const ColorSwatchView = /*#__PURE__*/forwardRef(({
10
+ asChild,
11
+ color,
12
+ size = 'sm',
13
+ shape = 'circle',
14
+ slot,
15
+ className,
16
+ style,
17
+ ...props
18
+ }, ref) => {
19
+ const Comp = asChild ? Slot : View;
20
+ return /*#__PURE__*/_jsx(Comp, {
21
+ ref: ref,
22
+ className: cn(colorSwatchVariants({
23
+ size,
24
+ shape
25
+ }), className),
26
+ style: [color ? {
27
+ backgroundColor: color.toString('hex')
28
+ } : undefined, style],
29
+ ...props,
30
+ ...mergeDataAttributes(props, dataAttributes({
31
+ slot
32
+ }))
33
+ });
34
+ });
35
+ ColorSwatchView.displayName = 'ColorSwatchView';
36
+ export const ColorSwatch = /*#__PURE__*/forwardRef(({
37
+ color: colorProp,
38
+ ...props
39
+ }, ref) => {
40
+ const picker = useOptionalColorPickerContext();
41
+ const color = colorProp ?? picker?.value;
42
+ return /*#__PURE__*/_jsx(ColorSwatchView, {
43
+ ref: ref,
44
+ color: color,
45
+ slot: "color-swatch",
46
+ ...props
47
+ });
48
+ });
49
+ ColorSwatch.displayName = 'ColorSwatch';
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","View","Slot","dataAttributes","mergeDataAttributes","useOptionalColorPickerContext","cn","colorSwatchVariants","jsx","_jsx","ColorSwatchView","asChild","color","size","shape","slot","className","style","props","ref","Comp","backgroundColor","toString","undefined","displayName","ColorSwatch","colorProp","picker","value"],"sourceRoot":"../../../../src","sources":["components/ColorSwatch/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAA2B,OAAO;AACrD,SAASC,IAAI,QAAwB,cAAc;AACnD,SACEC,IAAI,EACJC,cAAc,EACdC,mBAAmB,EACnBC,6BAA6B,QAExB,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,eAAe;AAClC,SAASC,mBAAmB,QA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,0 +1,21 @@
1
+ "use strict";
2
+
3
+ import { cva } from '@cdx-ui/utils';
4
+ export const colorSwatchVariants = cva(['shrink-0 overflow-hidden border border-stroke-secondary'], {
5
+ variants: {
6
+ size: {
7
+ xs: 'size-4',
8
+ sm: 'size-6',
9
+ lg: 'size-10'
10
+ },
11
+ shape: {
12
+ circle: 'rounded-[var(--border-radius-round)]',
13
+ square: 'rounded-[var(--border-radius-default)]'
14
+ }
15
+ },
16
+ defaultVariants: {
17
+ size: 'sm',
18
+ shape: 'circle'
19
+ }
20
+ });
21
+ //# sourceMappingURL=styles.js.map