@cdx-ui/components 0.0.1-beta.4 → 0.0.1-beta.40

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 (283) hide show
  1. package/README.md +18 -11
  2. package/lib/commonjs/components/Avatar/index.js +1 -1
  3. package/lib/commonjs/components/Avatar/styles.js +36 -29
  4. package/lib/commonjs/components/Avatar/styles.js.map +1 -1
  5. package/lib/commonjs/components/Button/styles.js +2 -2
  6. package/lib/commonjs/components/Button/styles.js.map +1 -1
  7. package/lib/commonjs/components/CLAUDE.md +90 -0
  8. package/lib/commonjs/components/Card/index.js +22 -4
  9. package/lib/commonjs/components/Card/index.js.map +1 -1
  10. package/lib/commonjs/components/Card/styles.js +27 -5
  11. package/lib/commonjs/components/Card/styles.js.map +1 -1
  12. package/lib/commonjs/components/Checkbox/index.js +5 -29
  13. package/lib/commonjs/components/Checkbox/index.js.map +1 -1
  14. package/lib/commonjs/components/Checkbox/styles.js +39 -47
  15. package/lib/commonjs/components/Checkbox/styles.js.map +1 -1
  16. package/lib/commonjs/components/Chip/index.js +78 -9
  17. package/lib/commonjs/components/Chip/index.js.map +1 -1
  18. package/lib/commonjs/components/Chip/styles.js +207 -21
  19. package/lib/commonjs/components/Chip/styles.js.map +1 -1
  20. package/lib/commonjs/components/Field/index.js +8 -2
  21. package/lib/commonjs/components/Field/index.js.map +1 -1
  22. package/lib/commonjs/components/Field/styles.js +4 -4
  23. package/lib/commonjs/components/Field/styles.js.map +1 -1
  24. package/lib/commonjs/components/Heading/styles.js +1 -1
  25. package/lib/commonjs/components/Heading/styles.js.map +1 -1
  26. package/lib/commonjs/components/Icon/index.js +1 -2
  27. package/lib/commonjs/components/Icon/index.js.map +1 -1
  28. package/lib/commonjs/components/IconButton/index.js +6 -1
  29. package/lib/commonjs/components/IconButton/index.js.map +1 -1
  30. package/lib/commonjs/components/IconButton/styles.js +135 -10
  31. package/lib/commonjs/components/IconButton/styles.js.map +1 -1
  32. package/lib/commonjs/components/Input/styles.js +7 -6
  33. package/lib/commonjs/components/Input/styles.js.map +1 -1
  34. package/lib/commonjs/components/ListItem/index.js +283 -0
  35. package/lib/commonjs/components/ListItem/index.js.map +1 -0
  36. package/lib/commonjs/components/ListItem/styles.js +130 -0
  37. package/lib/commonjs/components/ListItem/styles.js.map +1 -0
  38. package/lib/commonjs/components/ProgressSegmented/index.js +22 -10
  39. package/lib/commonjs/components/ProgressSegmented/index.js.map +1 -1
  40. package/lib/commonjs/components/Radio/index.js +167 -0
  41. package/lib/commonjs/components/Radio/index.js.map +1 -0
  42. package/lib/commonjs/components/Radio/styles.js +31 -0
  43. package/lib/commonjs/components/Radio/styles.js.map +1 -0
  44. package/lib/commonjs/components/Text/styles.js +2 -2
  45. package/lib/commonjs/components/Text/styles.js.map +1 -1
  46. package/lib/commonjs/components/Tile/index.js +251 -0
  47. package/lib/commonjs/components/Tile/index.js.map +1 -0
  48. package/lib/commonjs/components/Tile/styles.js +52 -0
  49. package/lib/commonjs/components/Tile/styles.js.map +1 -0
  50. package/lib/commonjs/components/index.js +36 -0
  51. package/lib/commonjs/components/index.js.map +1 -1
  52. package/lib/commonjs/figma/Avatar.figma.js +54 -0
  53. package/lib/commonjs/figma/Avatar.figma.js.map +1 -0
  54. package/lib/commonjs/figma/Button.figma.js +28 -11
  55. package/lib/commonjs/figma/Button.figma.js.map +1 -1
  56. package/lib/commonjs/figma/CLAUDE.md +30 -0
  57. package/lib/commonjs/figma/Card.Header.figma.js +28 -0
  58. package/lib/commonjs/figma/Card.Header.figma.js.map +1 -0
  59. package/lib/commonjs/figma/Card.figma.js +42 -0
  60. package/lib/commonjs/figma/Card.figma.js.map +1 -0
  61. package/lib/commonjs/figma/Checkbox.figma.js +55 -0
  62. package/lib/commonjs/figma/Checkbox.figma.js.map +1 -0
  63. package/lib/commonjs/figma/Chip.figma.js +68 -0
  64. package/lib/commonjs/figma/Chip.figma.js.map +1 -0
  65. package/lib/commonjs/figma/Field.Input.figma.js +57 -0
  66. package/lib/commonjs/figma/Field.Input.figma.js.map +1 -0
  67. package/lib/commonjs/figma/Field.Select.figma.js +57 -0
  68. package/lib/commonjs/figma/Field.Select.figma.js.map +1 -0
  69. package/lib/commonjs/figma/Heading.figma.js +30 -0
  70. package/lib/commonjs/figma/Heading.figma.js.map +1 -0
  71. package/lib/commonjs/figma/Icon.figma.js +20 -0
  72. package/lib/commonjs/figma/Icon.figma.js.map +1 -0
  73. package/lib/commonjs/figma/IconButton.figma.js +47 -0
  74. package/lib/commonjs/figma/IconButton.figma.js.map +1 -0
  75. package/lib/commonjs/figma/Input.figma.js +52 -0
  76. package/lib/commonjs/figma/Input.figma.js.map +1 -0
  77. package/lib/commonjs/figma/ProgressSegmented.figma.js +39 -0
  78. package/lib/commonjs/figma/ProgressSegmented.figma.js.map +1 -0
  79. package/lib/commonjs/figma/Radio.figma.js +38 -0
  80. package/lib/commonjs/figma/Radio.figma.js.map +1 -0
  81. package/lib/commonjs/figma/Select.figma.js +53 -0
  82. package/lib/commonjs/figma/Select.figma.js.map +1 -0
  83. package/lib/commonjs/figma/Text.figma.js +29 -0
  84. package/lib/commonjs/figma/Text.figma.js.map +1 -0
  85. package/lib/commonjs/figma/icons.figma.batch.js +27 -0
  86. package/lib/commonjs/figma/icons.figma.batch.js.map +1 -0
  87. package/lib/commonjs/figma/icons.figma.batch.json +17705 -0
  88. package/lib/commonjs/styles/primitives.js +42 -5
  89. package/lib/commonjs/styles/primitives.js.map +1 -1
  90. package/lib/module/components/Avatar/index.js +1 -1
  91. package/lib/module/components/Avatar/styles.js +36 -29
  92. package/lib/module/components/Avatar/styles.js.map +1 -1
  93. package/lib/module/components/Button/styles.js +2 -2
  94. package/lib/module/components/Button/styles.js.map +1 -1
  95. package/lib/module/components/CLAUDE.md +90 -0
  96. package/lib/module/components/Card/index.js +23 -4
  97. package/lib/module/components/Card/index.js.map +1 -1
  98. package/lib/module/components/Card/styles.js +27 -5
  99. package/lib/module/components/Card/styles.js.map +1 -1
  100. package/lib/module/components/Checkbox/index.js +6 -30
  101. package/lib/module/components/Checkbox/index.js.map +1 -1
  102. package/lib/module/components/Checkbox/styles.js +40 -48
  103. package/lib/module/components/Checkbox/styles.js.map +1 -1
  104. package/lib/module/components/Chip/index.js +82 -13
  105. package/lib/module/components/Chip/index.js.map +1 -1
  106. package/lib/module/components/Chip/styles.js +206 -20
  107. package/lib/module/components/Chip/styles.js.map +1 -1
  108. package/lib/module/components/Field/index.js +9 -3
  109. package/lib/module/components/Field/index.js.map +1 -1
  110. package/lib/module/components/Field/styles.js +4 -4
  111. package/lib/module/components/Field/styles.js.map +1 -1
  112. package/lib/module/components/Heading/styles.js +1 -1
  113. package/lib/module/components/Heading/styles.js.map +1 -1
  114. package/lib/module/components/Icon/index.js +1 -2
  115. package/lib/module/components/Icon/index.js.map +1 -1
  116. package/lib/module/components/IconButton/index.js +6 -1
  117. package/lib/module/components/IconButton/index.js.map +1 -1
  118. package/lib/module/components/IconButton/styles.js +135 -10
  119. package/lib/module/components/IconButton/styles.js.map +1 -1
  120. package/lib/module/components/Input/styles.js +7 -6
  121. package/lib/module/components/Input/styles.js.map +1 -1
  122. package/lib/module/components/ListItem/index.js +226 -0
  123. package/lib/module/components/ListItem/index.js.map +1 -0
  124. package/lib/module/components/ListItem/styles.js +127 -0
  125. package/lib/module/components/ListItem/styles.js.map +1 -0
  126. package/lib/module/components/ProgressSegmented/index.js +23 -11
  127. package/lib/module/components/ProgressSegmented/index.js.map +1 -1
  128. package/lib/module/components/Radio/index.js +164 -0
  129. package/lib/module/components/Radio/index.js.map +1 -0
  130. package/lib/module/components/Radio/styles.js +27 -0
  131. package/lib/module/components/Radio/styles.js.map +1 -0
  132. package/lib/module/components/Text/styles.js +2 -2
  133. package/lib/module/components/Text/styles.js.map +1 -1
  134. package/lib/module/components/Tile/index.js +243 -0
  135. package/lib/module/components/Tile/index.js.map +1 -0
  136. package/lib/module/components/Tile/styles.js +48 -0
  137. package/lib/module/components/Tile/styles.js.map +1 -0
  138. package/lib/module/components/index.js +3 -0
  139. package/lib/module/components/index.js.map +1 -1
  140. package/lib/module/figma/Avatar.figma.js +48 -0
  141. package/lib/module/figma/Avatar.figma.js.map +1 -0
  142. package/lib/module/figma/Button.figma.js +28 -11
  143. package/lib/module/figma/Button.figma.js.map +1 -1
  144. package/lib/module/figma/CLAUDE.md +30 -0
  145. package/lib/module/figma/Card.Header.figma.js +22 -0
  146. package/lib/module/figma/Card.Header.figma.js.map +1 -0
  147. package/lib/module/figma/Card.figma.js +36 -0
  148. package/lib/module/figma/Card.figma.js.map +1 -0
  149. package/lib/module/figma/Checkbox.figma.js +49 -0
  150. package/lib/module/figma/Checkbox.figma.js.map +1 -0
  151. package/lib/module/figma/Chip.figma.js +62 -0
  152. package/lib/module/figma/Chip.figma.js.map +1 -0
  153. package/lib/module/figma/Field.Input.figma.js +51 -0
  154. package/lib/module/figma/Field.Input.figma.js.map +1 -0
  155. package/lib/module/figma/Field.Select.figma.js +51 -0
  156. package/lib/module/figma/Field.Select.figma.js.map +1 -0
  157. package/lib/module/figma/Heading.figma.js +24 -0
  158. package/lib/module/figma/Heading.figma.js.map +1 -0
  159. package/lib/module/figma/Icon.figma.js +14 -0
  160. package/lib/module/figma/Icon.figma.js.map +1 -0
  161. package/lib/module/figma/IconButton.figma.js +41 -0
  162. package/lib/module/figma/IconButton.figma.js.map +1 -0
  163. package/lib/module/figma/Input.figma.js +46 -0
  164. package/lib/module/figma/Input.figma.js.map +1 -0
  165. package/lib/module/figma/ProgressSegmented.figma.js +33 -0
  166. package/lib/module/figma/ProgressSegmented.figma.js.map +1 -0
  167. package/lib/module/figma/Radio.figma.js +32 -0
  168. package/lib/module/figma/Radio.figma.js.map +1 -0
  169. package/lib/module/figma/Select.figma.js +47 -0
  170. package/lib/module/figma/Select.figma.js.map +1 -0
  171. package/lib/module/figma/Text.figma.js +23 -0
  172. package/lib/module/figma/Text.figma.js.map +1 -0
  173. package/lib/module/figma/icons.figma.batch.js +22 -0
  174. package/lib/module/figma/icons.figma.batch.js.map +1 -0
  175. package/lib/module/figma/icons.figma.batch.json +17705 -0
  176. package/lib/module/styles/primitives.js +42 -5
  177. package/lib/module/styles/primitives.js.map +1 -1
  178. package/lib/typescript/components/Avatar/styles.d.ts +4 -4
  179. package/lib/typescript/components/Avatar/styles.d.ts.map +1 -1
  180. package/lib/typescript/components/Card/index.d.ts +4 -3
  181. package/lib/typescript/components/Card/index.d.ts.map +1 -1
  182. package/lib/typescript/components/Card/styles.d.ts +13 -3
  183. package/lib/typescript/components/Card/styles.d.ts.map +1 -1
  184. package/lib/typescript/components/Checkbox/index.d.ts +1 -2
  185. package/lib/typescript/components/Checkbox/index.d.ts.map +1 -1
  186. package/lib/typescript/components/Checkbox/styles.d.ts +4 -14
  187. package/lib/typescript/components/Checkbox/styles.d.ts.map +1 -1
  188. package/lib/typescript/components/Chip/index.d.ts +19 -6
  189. package/lib/typescript/components/Chip/index.d.ts.map +1 -1
  190. package/lib/typescript/components/Chip/styles.d.ts +13 -4
  191. package/lib/typescript/components/Chip/styles.d.ts.map +1 -1
  192. package/lib/typescript/components/Field/FieldLabel.web.d.ts +2 -2
  193. package/lib/typescript/components/Field/FieldLabel.web.d.ts.map +1 -1
  194. package/lib/typescript/components/Field/index.d.ts.map +1 -1
  195. package/lib/typescript/components/Field/styles.d.ts.map +1 -1
  196. package/lib/typescript/components/Heading/styles.d.ts +1 -1
  197. package/lib/typescript/components/Icon/index.d.ts.map +1 -1
  198. package/lib/typescript/components/IconButton/index.d.ts.map +1 -1
  199. package/lib/typescript/components/IconButton/styles.d.ts +6 -2
  200. package/lib/typescript/components/IconButton/styles.d.ts.map +1 -1
  201. package/lib/typescript/components/Input/styles.d.ts.map +1 -1
  202. package/lib/typescript/components/ListItem/index.d.ts +49 -0
  203. package/lib/typescript/components/ListItem/index.d.ts.map +1 -0
  204. package/lib/typescript/components/ListItem/styles.d.ts +30 -0
  205. package/lib/typescript/components/ListItem/styles.d.ts.map +1 -0
  206. package/lib/typescript/components/ProgressSegmented/index.d.ts +14 -3
  207. package/lib/typescript/components/ProgressSegmented/index.d.ts.map +1 -1
  208. package/lib/typescript/components/Radio/index.d.ts +40 -0
  209. package/lib/typescript/components/Radio/index.d.ts.map +1 -0
  210. package/lib/typescript/components/Radio/styles.d.ts +8 -0
  211. package/lib/typescript/components/Radio/styles.d.ts.map +1 -0
  212. package/lib/typescript/components/Stack/styles.d.ts +2 -2
  213. package/lib/typescript/components/Text/styles.d.ts +1 -1
  214. package/lib/typescript/components/Tile/index.d.ts +70 -0
  215. package/lib/typescript/components/Tile/index.d.ts.map +1 -0
  216. package/lib/typescript/components/Tile/styles.d.ts +18 -0
  217. package/lib/typescript/components/Tile/styles.d.ts.map +1 -0
  218. package/lib/typescript/components/index.d.ts +3 -0
  219. package/lib/typescript/components/index.d.ts.map +1 -1
  220. package/lib/typescript/figma/Avatar.figma.d.ts +8 -0
  221. package/lib/typescript/figma/Avatar.figma.d.ts.map +1 -0
  222. package/lib/typescript/figma/Button.figma.d.ts.map +1 -1
  223. package/lib/typescript/figma/Card.Header.figma.d.ts +8 -0
  224. package/lib/typescript/figma/Card.Header.figma.d.ts.map +1 -0
  225. package/lib/typescript/figma/Card.figma.d.ts +8 -0
  226. package/lib/typescript/figma/Card.figma.d.ts.map +1 -0
  227. package/lib/typescript/figma/Checkbox.figma.d.ts +8 -0
  228. package/lib/typescript/figma/Checkbox.figma.d.ts.map +1 -0
  229. package/lib/typescript/figma/Chip.figma.d.ts +8 -0
  230. package/lib/typescript/figma/Chip.figma.d.ts.map +1 -0
  231. package/lib/typescript/figma/Field.Input.figma.d.ts +8 -0
  232. package/lib/typescript/figma/Field.Input.figma.d.ts.map +1 -0
  233. package/lib/typescript/figma/Field.Select.figma.d.ts +8 -0
  234. package/lib/typescript/figma/Field.Select.figma.d.ts.map +1 -0
  235. package/lib/typescript/figma/Heading.figma.d.ts +8 -0
  236. package/lib/typescript/figma/Heading.figma.d.ts.map +1 -0
  237. package/lib/typescript/figma/Icon.figma.d.ts +8 -0
  238. package/lib/typescript/figma/Icon.figma.d.ts.map +1 -0
  239. package/lib/typescript/figma/IconButton.figma.d.ts +8 -0
  240. package/lib/typescript/figma/IconButton.figma.d.ts.map +1 -0
  241. package/lib/typescript/figma/Input.figma.d.ts +8 -0
  242. package/lib/typescript/figma/Input.figma.d.ts.map +1 -0
  243. package/lib/typescript/figma/ProgressSegmented.figma.d.ts +8 -0
  244. package/lib/typescript/figma/ProgressSegmented.figma.d.ts.map +1 -0
  245. package/lib/typescript/figma/Radio.figma.d.ts +8 -0
  246. package/lib/typescript/figma/Radio.figma.d.ts.map +1 -0
  247. package/lib/typescript/figma/Select.figma.d.ts +8 -0
  248. package/lib/typescript/figma/Select.figma.d.ts.map +1 -0
  249. package/lib/typescript/figma/Text.figma.d.ts +8 -0
  250. package/lib/typescript/figma/Text.figma.d.ts.map +1 -0
  251. package/lib/typescript/figma/icons.figma.batch.d.ts +14 -0
  252. package/lib/typescript/figma/icons.figma.batch.d.ts.map +1 -0
  253. package/lib/typescript/styles/primitives.d.ts +38 -0
  254. package/lib/typescript/styles/primitives.d.ts.map +1 -1
  255. package/package.json +4 -4
  256. package/src/components/Avatar/index.tsx +1 -1
  257. package/src/components/Avatar/styles.ts +49 -34
  258. package/src/components/Button/styles.ts +2 -2
  259. package/src/components/CLAUDE.md +90 -0
  260. package/src/components/Card/index.tsx +41 -16
  261. package/src/components/Card/styles.ts +43 -23
  262. package/src/components/Checkbox/index.tsx +8 -19
  263. package/src/components/Checkbox/styles.ts +82 -86
  264. package/src/components/Chip/index.tsx +104 -27
  265. package/src/components/Chip/styles.ts +232 -18
  266. package/src/components/Field/FieldLabel.web.tsx +1 -1
  267. package/src/components/Field/index.tsx +10 -3
  268. package/src/components/Field/styles.ts +5 -4
  269. package/src/components/Heading/styles.ts +1 -1
  270. package/src/components/Icon/index.tsx +1 -2
  271. package/src/components/IconButton/index.tsx +3 -2
  272. package/src/components/IconButton/styles.ts +136 -10
  273. package/src/components/Input/styles.ts +14 -9
  274. package/src/components/ListItem/index.tsx +285 -0
  275. package/src/components/ListItem/styles.ts +153 -0
  276. package/src/components/ProgressSegmented/index.tsx +49 -14
  277. package/src/components/Radio/index.tsx +192 -0
  278. package/src/components/Radio/styles.ts +59 -0
  279. package/src/components/Text/styles.ts +2 -2
  280. package/src/components/Tile/index.tsx +296 -0
  281. package/src/components/Tile/styles.ts +82 -0
  282. package/src/components/index.ts +3 -0
  283. package/src/styles/primitives.ts +42 -5
@@ -1,92 +1,90 @@
1
1
  import { Platform } from 'react-native';
2
- import { cva, type VariantProps } from 'class-variance-authority';
3
- import {
4
- COLOR_BG_PRIMARY,
5
- COLOR_BORDER_STRONG,
6
- COLOR_TEXT_PRIMARY,
7
- DISABLED_CURSOR,
8
- DISABLED_OPACITY,
9
- TRANSITION_COLORS,
10
- } from '../../styles/primitives';
2
+ import { cva } from 'class-variance-authority';
3
+ import { DISABLED_CURSOR, DISABLED_OPACITY, TRANSITION_COLORS } from '../../styles/primitives';
11
4
 
12
- export const checkboxRootVariants = cva(
13
- ['flex-row items-center', DISABLED_OPACITY, DISABLED_CURSOR],
14
- {
15
- variants: {
16
- size: {
17
- small: 'gap-2',
18
- default: 'gap-2.5',
19
- },
20
- },
21
- defaultVariants: {
22
- size: 'default',
23
- },
24
- },
25
- );
5
+ export const checkboxRootVariants = cva([
6
+ 'flex-row items-center gap-2.5',
7
+ DISABLED_OPACITY,
8
+ DISABLED_CURSOR,
9
+ // Suppress stray outline on the Pressable/label wrapper; focus ring is drawn on Checkbox.Indicator (Radio pattern).
10
+ 'web:outline-none web:focus:outline-none web:focus-visible:outline-none',
11
+ ]);
26
12
 
27
- export const checkboxIndicatorVariants = cva(
28
- [
29
- 'items-center justify-center',
30
- 'rounded',
31
- 'border-2',
32
- COLOR_BORDER_STRONG,
33
- COLOR_BG_PRIMARY,
34
- 'data-[checked=true]:bg-slate-900 data-[checked=true]:border-slate-900',
35
- 'data-[indeterminate=true]:bg-slate-900 data-[indeterminate=true]:border-slate-900',
36
- 'data-[disabled=true]:opacity-50',
37
- 'data-[invalid=true]:border-red-500',
38
- 'data-[checked=true]:data-[invalid=true]:bg-red-500 data-[checked=true]:data-[invalid=true]:border-red-500',
39
- 'data-[indeterminate=true]:data-[invalid=true]:bg-red-500 data-[indeterminate=true]:data-[invalid=true]:border-red-500',
40
- Platform.select({
41
- web: [
42
- TRANSITION_COLORS,
43
- 'data-[hover=true]:data-[checked=false]:data-[indeterminate=false]:border-slate-400 data-[hover=true]:data-[checked=false]:data-[indeterminate=false]:bg-slate-50',
44
- 'data-[focus-visible=true]:ring-2 data-[focus-visible=true]:ring-slate-400/50 data-[focus-visible=true]:ring-offset-2',
45
- 'data-[invalid=true]:data-[hover=true]:border-red-400',
46
- 'data-[invalid=true]:data-[focus-visible=true]:ring-red-400/50',
47
- ].join(' '),
48
- default: '',
49
- }),
50
- ],
51
- {
52
- variants: {
53
- size: {
54
- small: 'h-4 w-4',
55
- default: 'h-5 w-5',
56
- },
57
- },
58
- defaultVariants: {
59
- size: 'default',
60
- },
61
- },
62
- );
13
+ export const checkboxIndicatorVariants = cva([
14
+ 'items-center justify-center',
15
+ 'h-5 w-5',
16
+ 'rounded',
17
+ 'border-2 border-solid',
18
+ 'data-[disabled=true]:opacity-50',
19
+ // Background — layered by specificity. checked=false acts as an explicit reset so the base bg
20
+ // reasserts when transitioning from checked/indeterminate on native (where absent attributes
21
+ // break data-[attr=false] selectors).
22
+ // IMPORTANT: On native (Uniwind), only the LAST data-[] condition in a compound chain is
23
+ // effectively evaluated. Place the most discriminating condition last to avoid false matches.
24
+ 'data-[checked=false]:bg-surface-primary',
25
+ 'data-[checked=true]:bg-surface-action-strong',
26
+ 'data-[indeterminate=true]:bg-surface-action-strong',
27
+ // Border — invalid (later) beats checked/indeterminate.
28
+ 'data-[checked=false]:border-content-secondary',
29
+ 'data-[checked=true]:border-stroke-action',
30
+ 'data-[indeterminate=true]:border-stroke-action',
31
+ 'data-[invalid=true]:border-stroke-danger',
32
+ Platform.select({
33
+ web: [
34
+ // Invalid bg — compound selectors evaluate correctly on web.
35
+ 'data-[invalid=true]:data-[checked=true]:bg-surface-danger-strong',
36
+ 'data-[invalid=true]:data-[indeterminate=true]:bg-surface-danger-strong',
37
+ TRANSITION_COLORS,
38
+ // Hover — unchecked (Figma: border unchanged, bg overlay at opacity/hover)
39
+ 'data-[hover=true]:data-[checked=false]:data-[indeterminate=false]:bg-content-secondary/[0.08]',
40
+ // Hover — unchecked + invalid (overlay uses danger token)
41
+ 'data-[hover=true]:data-[invalid=true]:data-[checked=false]:data-[indeterminate=false]:bg-surface-danger-strong/[0.08]',
42
+ // Hover — checked / indeterminate (bg + border darken together)
43
+ 'data-[hover=true]:data-[checked=true]:bg-surface-action-strong-hover',
44
+ 'data-[hover=true]:data-[checked=true]:border-[--color-surface-action-strong-hover]',
45
+ 'data-[hover=true]:data-[indeterminate=true]:bg-surface-action-strong-hover',
46
+ 'data-[hover=true]:data-[indeterminate=true]:border-[--color-surface-action-strong-hover]',
47
+ 'data-[hover=true]:data-[checked=true]:data-[invalid=true]:bg-surface-danger-strong-hover',
48
+ 'data-[hover=true]:data-[checked=true]:data-[invalid=true]:border-[--color-surface-danger-strong-hover]',
49
+ 'data-[hover=true]:data-[indeterminate=true]:data-[invalid=true]:bg-surface-danger-strong-hover',
50
+ 'data-[hover=true]:data-[indeterminate=true]:data-[invalid=true]:border-[--color-surface-danger-strong-hover]',
51
+ // Active — CSS :active pseudo-class (web root does not track press via data-active).
52
+ // data-[hover=true] guard ensures active beats hover by specificity (0,3,0 > 0,2,0).
53
+ 'web:active:data-[hover=true]:data-[checked=true]:bg-surface-action-strong-active',
54
+ 'web:active:data-[hover=true]:data-[checked=true]:border-[--color-surface-action-strong-active]',
55
+ 'web:active:data-[hover=true]:data-[indeterminate=true]:bg-surface-action-strong-active',
56
+ 'web:active:data-[hover=true]:data-[indeterminate=true]:border-[--color-surface-action-strong-active]',
57
+ 'web:active:data-[hover=true]:data-[checked=true]:data-[invalid=true]:bg-surface-danger-strong-active',
58
+ 'web:active:data-[hover=true]:data-[checked=true]:data-[invalid=true]:border-[--color-surface-danger-strong-active]',
59
+ 'web:active:data-[hover=true]:data-[indeterminate=true]:data-[invalid=true]:bg-surface-danger-strong-active',
60
+ 'web:active:data-[hover=true]:data-[indeterminate=true]:data-[invalid=true]:border-[--color-surface-danger-strong-active]',
61
+ // Focus ring
62
+ 'web:data-[focus-visible=true]:outline-none',
63
+ 'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-[--color-stroke-ring] web:data-[focus-visible=true]:ring-offset-2',
64
+ ].join(' '),
65
+ default: [
66
+ // Invalid bg is NOT styled on native. Compound data-[] selectors cannot express
67
+ // "invalid AND checked" without false-matching other states (Uniwind only evaluates
68
+ // the last condition). Invalid state is communicated via border-stroke-danger (single
69
+ // condition, always correct). The fill stays action-strong for checked/indeterminate.
70
+ //
71
+ // Active — native tracks press via data-[active] from usePress.
72
+ // Place data-[active=true] last so the rule only fires during press.
73
+ // 'data-[checked=false]:data-[invalid=true]:bg-transparent',
74
+ 'data-[checked=true]:data-[invalid=true]:bg-surface-danger-strong',
75
+ 'data-[checked=true]:data-[active=true]:bg-surface-action-strong-active',
76
+ 'data-[checked=true]:data-[active=true]:data-[invalid=true]:bg-surface-danger-strong-active',
77
+ 'data-[indeterminate=true]:data-[active=true]:bg-surface-action-strong-active',
78
+ ].join(' '),
79
+ }),
80
+ ]);
63
81
 
64
- export const checkboxIconVariants = cva(['text-white'], {
65
- variants: {
66
- size: {
67
- small: 'h-3 w-3',
68
- default: 'h-3.5 w-3.5',
69
- },
70
- },
71
- defaultVariants: {
72
- size: 'default',
73
- },
74
- });
82
+ export const checkboxIconVariants = cva(['text-white', 'h-5 w-5']);
75
83
 
76
- export const checkboxLabelVariants = cva(
77
- [COLOR_TEXT_PRIMARY, 'data-[disabled=true]:text-slate-400'],
78
- {
79
- variants: {
80
- size: {
81
- small: 'text-sm',
82
- default: 'text-base',
83
- },
84
- },
85
- defaultVariants: {
86
- size: 'default',
87
- },
88
- },
89
- );
84
+ export const checkboxLabelVariants = cva([
85
+ 'text-content-primary text-base',
86
+ 'data-[disabled=true]:text-content-tertiary',
87
+ ]);
90
88
 
91
89
  export const checkboxGroupVariants = cva([], {
92
90
  variants: {
@@ -99,5 +97,3 @@ export const checkboxGroupVariants = cva([], {
99
97
  direction: 'column',
100
98
  },
101
99
  });
102
-
103
- export type CheckboxVariantProps = VariantProps<typeof checkboxRootVariants>;
@@ -1,40 +1,92 @@
1
- import { forwardRef, type ReactNode } from 'react';
2
- import { View, Text as RNText, type ViewProps, type TextProps } from 'react-native';
3
- import { cn, useStyleContext, withStyleContext } from '@cdx-ui/utils';
1
+ import { forwardRef, useMemo, type ReactNode } from 'react';
2
+ import { Pressable, Text as RNText, View, type TextProps } from 'react-native';
3
+ import { createChip, type IChipProps } from '@cdx-ui/primitives';
4
+ import {
5
+ cn,
6
+ ParentContext,
7
+ useParentContext,
8
+ useStyleContext,
9
+ withStyleContext,
10
+ type WithStyleContextProps,
11
+ } from '@cdx-ui/utils';
12
+ import { Avatar, type AvatarProps } from '../Avatar';
4
13
  import { Icon, type IconProps } from '../Icon';
5
- import { chipRootVariants, chipLabelVariants, chipIconVariants, ChipVariants } from './styles';
14
+ import {
15
+ chipAvatarVariants,
16
+ chipIconVariants,
17
+ chipLabelVariants,
18
+ chipRootVariants,
19
+ type ChipVariantProps,
20
+ } from './styles';
6
21
 
7
22
  const SCOPE = 'CHIP';
8
23
 
9
- const Root = withStyleContext(View, SCOPE);
24
+ const RootView = withStyleContext(View, SCOPE);
25
+ const RootPressable = withStyleContext(Pressable, SCOPE);
10
26
 
11
- const useChipStyleContext = () => useStyleContext(SCOPE) as ChipVariants;
27
+ const ChipPrimitive = createChip({
28
+ View: RootView,
29
+ Pressable: RootPressable,
30
+ });
31
+
32
+ const useChipStyleContext = () => useStyleContext(SCOPE) as ChipVariantProps;
12
33
 
13
34
  // =============================================================================
14
- // STYLED ROOT COMPONENT
35
+ // ROOT
15
36
  // =============================================================================
16
37
 
17
- export interface ChipProps extends ViewProps, ChipVariants {
18
- children?: ReactNode;
38
+ export interface ChipProps extends IChipProps, ChipVariantProps, WithStyleContextProps {
19
39
  className?: string;
40
+ children?: ReactNode;
20
41
  }
21
42
 
22
43
  const ChipRoot = forwardRef<View, ChipProps>(
23
- ({ children, color = 'default', className, style, ...props }, ref) => {
24
- const computedClassName = cn(chipRootVariants({ color }), className);
44
+ (
45
+ {
46
+ children,
47
+ variant = 'tint',
48
+ size = 'default',
49
+ color = 'default',
50
+ className,
51
+ style,
52
+ asChild,
53
+ ...props
54
+ },
55
+ ref,
56
+ ) => {
57
+ const parentContextValues = useParentContext();
58
+ const styleContextValues = useMemo(
59
+ () => ({ ...parentContextValues, [SCOPE]: { variant, size, color } }),
60
+ [parentContextValues, variant, size, color],
61
+ );
25
62
 
26
- return (
27
- <Root ref={ref} className={computedClassName} style={style} context={{ color }} {...props}>
63
+ const computedClassName = cn(chipRootVariants({ variant, size, color }), className);
64
+
65
+ const root = (
66
+ <ChipPrimitive
67
+ ref={ref as never}
68
+ asChild={asChild}
69
+ className={computedClassName}
70
+ context={{ variant, size, color }}
71
+ style={style}
72
+ {...props}
73
+ >
28
74
  {children}
29
- </Root>
75
+ </ChipPrimitive>
30
76
  );
77
+
78
+ if (asChild) {
79
+ return <ParentContext.Provider value={styleContextValues}>{root}</ParentContext.Provider>;
80
+ }
81
+
82
+ return root;
31
83
  },
32
84
  );
33
85
 
34
86
  ChipRoot.displayName = 'Chip';
35
87
 
36
88
  // =============================================================================
37
- // STYLED LABEL COMPONENT
89
+ // LABEL
38
90
  // =============================================================================
39
91
 
40
92
  export interface ChipLabelProps extends TextProps {
@@ -44,9 +96,8 @@ export interface ChipLabelProps extends TextProps {
44
96
 
45
97
  const ChipLabel = forwardRef<RNText, ChipLabelProps>(
46
98
  ({ className, children, style, ...props }, ref) => {
47
- const { color } = useChipStyleContext();
48
-
49
- const computedClassName = cn(chipLabelVariants({ color }), className);
99
+ const { size, variant, color } = useChipStyleContext();
100
+ const computedClassName = cn(chipLabelVariants({ size, variant, color }), className);
50
101
 
51
102
  return (
52
103
  <RNText ref={ref} className={computedClassName} style={style} {...props}>
@@ -59,33 +110,59 @@ const ChipLabel = forwardRef<RNText, ChipLabelProps>(
59
110
  ChipLabel.displayName = 'Chip.Label';
60
111
 
61
112
  // =============================================================================
62
- // STYLED ICON COMPONENT
113
+ // ICON
63
114
  // =============================================================================
64
115
 
65
- export interface ChipIconProps extends Omit<IconProps, 'children'> {}
66
-
67
- const ChipIcon = ({ className, style, as, ...props }: ChipIconProps) => {
68
- const { color } = useChipStyleContext();
69
-
70
- const computedClassName = cn(chipIconVariants({ color }), className);
116
+ export interface ChipIconProps extends Omit<IconProps, 'children'> {
117
+ /** Leading (default) or trailing slot — applies the correct negative margin offset. */
118
+ slot?: 'leading' | 'trailing';
119
+ className?: string;
120
+ }
71
121
 
122
+ const ChipIcon = ({ className, style, as, slot, ...props }: ChipIconProps) => {
123
+ const { size, color } = useChipStyleContext();
124
+ const computedClassName = cn(chipIconVariants({ size, color, slot }), className);
72
125
  return <Icon as={as} className={computedClassName} style={style} {...props} />;
73
126
  };
74
127
 
75
128
  ChipIcon.displayName = 'Chip.Icon';
76
129
 
77
130
  // =============================================================================
78
- // COMPOUND COMPONENT EXPORT
131
+ // AVATAR
132
+ // =============================================================================
133
+
134
+ export interface ChipAvatarProps extends Omit<AvatarProps, 'size'> {}
135
+
136
+ const ChipAvatar = ({ className, style, children, ...props }: ChipAvatarProps) => {
137
+ const { size } = useChipStyleContext();
138
+ // chipAvatarVariants sets w/h and the leading slot negative margin.
139
+ // Avatar renders with size="sm" (its smallest named size) but chipAvatarVariants
140
+ // overrides the w/h via tailwind-merge so the chip size wins.
141
+ const computedClassName = cn(chipAvatarVariants({ size }), className);
142
+
143
+ return (
144
+ <Avatar size="sm" className={computedClassName} style={style} {...props}>
145
+ {children}
146
+ </Avatar>
147
+ );
148
+ };
149
+
150
+ ChipAvatar.displayName = 'Chip.Avatar';
151
+
152
+ // =============================================================================
153
+ // COMPOUND EXPORT
79
154
  // =============================================================================
80
155
 
81
156
  type ChipCompoundComponent = typeof ChipRoot & {
82
157
  Label: typeof ChipLabel;
83
158
  Icon: typeof ChipIcon;
159
+ Avatar: typeof ChipAvatar;
84
160
  };
85
161
 
86
162
  export const Chip = Object.assign(ChipRoot, {
87
163
  Label: ChipLabel,
88
164
  Icon: ChipIcon,
165
+ Avatar: ChipAvatar,
89
166
  }) as ChipCompoundComponent;
90
167
 
91
- export { type ChipVariants } from './styles';
168
+ export { type ChipVariantProps } from './styles';
@@ -1,52 +1,266 @@
1
+ import { Platform } from 'react-native';
1
2
  import { cva, type VariantProps } from 'class-variance-authority';
3
+ import { DISABLED_CURSOR, TRANSITION_COLORS } from '../../styles/primitives';
4
+
5
+ const chipInteractiveRoot = [
6
+ TRANSITION_COLORS,
7
+ 'data-[disabled=true]:opacity-[var(--opacity-disabled)]',
8
+ DISABLED_CURSOR,
9
+ Platform.select({
10
+ web: [
11
+ 'outline-none',
12
+ 'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-[var(--color-stroke-focus)] web:data-[focus-visible=true]:ring-offset-1',
13
+ ].join(' '),
14
+ default: '',
15
+ }),
16
+ ];
2
17
 
3
18
  export const chipRootVariants = cva(
4
- ['flex-row items-center justify-center rounded-full px-2 py-1 gap-1.5 self-start'],
19
+ ['flex-row items-center justify-center self-start overflow-hidden', ...chipInteractiveRoot],
5
20
  {
6
21
  variants: {
22
+ variant: {
23
+ tint: [],
24
+ outline: ['bg-transparent', 'border'],
25
+ },
7
26
  color: {
8
- default: 'bg-surface-neutral-tint',
9
- error: 'bg-surface-danger-tint',
10
- info: 'bg-surface-info-tint',
11
- success: 'bg-surface-success-tint',
12
- warning: 'bg-surface-warning-tint',
27
+ default: [],
28
+ action: [],
29
+ danger: [],
30
+ warning: [],
31
+ success: [],
32
+ info: [],
33
+ },
34
+ size: {
35
+ default: 'h-8 max-h-8 min-h-8 gap-1.5 px-3 rounded-lg',
36
+ small: 'h-6 max-h-6 min-h-6 gap-1 px-1.5 rounded-md',
37
+ xsmall: 'h-4 max-h-4 min-h-4 gap-0.5 px-1 rounded-sm',
13
38
  },
14
39
  },
40
+ compoundVariants: [
41
+ // ── tint × color ────────────────────────────────────────────────────
42
+ {
43
+ variant: 'tint',
44
+ color: 'default',
45
+ className: [
46
+ 'bg-surface-neutral-tint',
47
+ Platform.select({
48
+ default: 'data-[active=true]:bg-surface-neutral-tint-active',
49
+ web: 'data-[hover=true]:bg-surface-neutral-tint-hover data-[active=true]:data-[hover=true]:bg-surface-neutral-tint-active',
50
+ }),
51
+ ],
52
+ },
53
+ {
54
+ variant: 'tint',
55
+ color: 'action',
56
+ className: [
57
+ 'bg-surface-action-tint',
58
+ Platform.select({
59
+ default: 'data-[active=true]:bg-surface-action-tint-active',
60
+ web: 'data-[hover=true]:bg-surface-action-tint-hover data-[active=true]:data-[hover=true]:bg-surface-action-tint-active',
61
+ }),
62
+ ],
63
+ },
64
+ {
65
+ variant: 'tint',
66
+ color: 'danger',
67
+ className: [
68
+ 'bg-surface-danger-tint',
69
+ Platform.select({
70
+ default: 'data-[active=true]:bg-surface-danger-tint-active',
71
+ web: 'data-[hover=true]:bg-surface-danger-tint-hover data-[active=true]:data-[hover=true]:bg-surface-danger-tint-active',
72
+ }),
73
+ ],
74
+ },
75
+ {
76
+ variant: 'tint',
77
+ color: 'warning',
78
+ className: [
79
+ 'bg-surface-warning-tint',
80
+ Platform.select({
81
+ default: 'data-[active=true]:bg-surface-warning-tint-active',
82
+ web: 'data-[hover=true]:bg-surface-warning-tint-hover data-[active=true]:data-[hover=true]:bg-surface-warning-tint-active',
83
+ }),
84
+ ],
85
+ },
86
+ {
87
+ variant: 'tint',
88
+ color: 'success',
89
+ className: [
90
+ 'bg-surface-success-tint',
91
+ Platform.select({
92
+ default: 'data-[active=true]:bg-surface-success-tint-active',
93
+ web: 'data-[hover=true]:bg-surface-success-tint-hover data-[active=true]:data-[hover=true]:bg-surface-success-tint-active',
94
+ }),
95
+ ],
96
+ },
97
+ {
98
+ variant: 'tint',
99
+ color: 'info',
100
+ className: [
101
+ 'bg-surface-info-tint',
102
+ Platform.select({
103
+ default: 'data-[active=true]:bg-surface-info-tint-active',
104
+ web: 'data-[hover=true]:bg-surface-info-tint-hover data-[active=true]:data-[hover=true]:bg-surface-info-tint-active',
105
+ }),
106
+ ],
107
+ },
108
+
109
+ // ── outline × color ───────────────────────────────────────────────────
110
+ {
111
+ variant: 'outline',
112
+ color: 'default',
113
+ className: [
114
+ 'border-stroke-primary',
115
+ Platform.select({
116
+ default: 'data-[active=true]:bg-surface-neutral-tint',
117
+ web: 'data-[hover=true]:bg-surface-neutral-tint-hover data-[active=true]:data-[hover=true]:bg-surface-neutral-tint-active',
118
+ }),
119
+ ],
120
+ },
121
+ {
122
+ variant: 'outline',
123
+ color: 'action',
124
+ className: [
125
+ 'border-stroke-action',
126
+ Platform.select({
127
+ default: 'data-[active=true]:bg-surface-action-tint',
128
+ web: 'data-[hover=true]:bg-surface-action-tint-hover data-[active=true]:data-[hover=true]:bg-surface-action-tint-active',
129
+ }),
130
+ ],
131
+ },
132
+ {
133
+ variant: 'outline',
134
+ color: 'danger',
135
+ className: [
136
+ 'border-stroke-danger',
137
+ Platform.select({
138
+ default: 'data-[active=true]:bg-surface-danger-tint',
139
+ web: 'data-[hover=true]:bg-surface-danger-tint-hover data-[active=true]:data-[hover=true]:bg-surface-danger-tint-active',
140
+ }),
141
+ ],
142
+ },
143
+ {
144
+ variant: 'outline',
145
+ color: 'warning',
146
+ className: [
147
+ 'border-stroke-warning',
148
+ Platform.select({
149
+ default: 'data-[active=true]:bg-surface-warning-tint',
150
+ web: 'data-[hover=true]:bg-surface-warning-tint-hover data-[active=true]:data-[hover=true]:bg-surface-warning-tint-active',
151
+ }),
152
+ ],
153
+ },
154
+ {
155
+ variant: 'outline',
156
+ color: 'success',
157
+ className: [
158
+ 'border-stroke-success',
159
+ Platform.select({
160
+ default: 'data-[active=true]:bg-surface-success-tint',
161
+ web: 'data-[hover=true]:bg-surface-success-tint-hover data-[active=true]:data-[hover=true]:bg-surface-success-tint-active',
162
+ }),
163
+ ],
164
+ },
165
+ {
166
+ variant: 'outline',
167
+ color: 'info',
168
+ className: [
169
+ 'border-stroke-info',
170
+ Platform.select({
171
+ default: 'data-[active=true]:bg-surface-info-tint',
172
+ web: 'data-[hover=true]:bg-surface-info-tint-hover data-[active=true]:data-[hover=true]:bg-surface-info-tint-active',
173
+ }),
174
+ ],
175
+ },
176
+ ],
15
177
  defaultVariants: {
178
+ variant: 'tint',
16
179
  color: 'default',
180
+ size: 'default',
17
181
  },
18
182
  },
19
183
  );
20
184
 
21
- // TODO: letter-spacing values (tracking-wider) are not working on web, but the font-mono-medium is.
22
- export const chipLabelVariants = cva(['label-sm font-mono-medium'], {
185
+ export const chipLabelVariants = cva(['font-medium'], {
23
186
  variants: {
187
+ variant: {
188
+ tint: 'text-content-primary',
189
+ outline: 'text-content-primary',
190
+ },
24
191
  color: {
25
- default: 'text-content-primary',
26
- error: 'text-content-primary',
27
- info: 'text-content-primary',
28
- success: 'text-content-primary',
29
- warning: 'text-content-primary',
192
+ default: [],
193
+ action: [],
194
+ danger: [],
195
+ warning: [],
196
+ success: [],
197
+ info: [],
198
+ },
199
+ size: {
200
+ default: 'body-md',
201
+ small: 'body-sm',
202
+ xsmall: 'body-xs',
30
203
  },
31
204
  },
205
+ compoundVariants: [
206
+ { variant: 'outline', color: 'action', className: 'text-content-action' },
207
+ { variant: 'outline', color: 'danger', className: 'text-content-danger' },
208
+ { variant: 'outline', color: 'warning', className: 'text-content-warning' },
209
+ { variant: 'outline', color: 'success', className: 'text-content-success' },
210
+ { variant: 'outline', color: 'info', className: 'text-content-info' },
211
+ ],
32
212
  defaultVariants: {
213
+ variant: 'tint',
33
214
  color: 'default',
215
+ size: 'default',
34
216
  },
35
217
  });
36
218
 
37
- export const chipIconVariants = cva(['size-4'], {
219
+ export const chipIconVariants = cva(['shrink-0'], {
38
220
  variants: {
221
+ size: {
222
+ default: 'size-5',
223
+ small: 'size-4',
224
+ xsmall: 'size-2.5',
225
+ },
39
226
  color: {
40
227
  default: 'text-content-primary',
41
- error: 'text-content-danger',
42
- info: 'text-content-info',
43
- success: 'text-content-success',
228
+ action: 'text-content-action',
229
+ danger: 'text-content-danger',
44
230
  warning: 'text-content-warning',
231
+ success: 'text-content-success',
232
+ info: 'text-content-info',
233
+ },
234
+ slot: {
235
+ leading: '',
236
+ trailing: '',
45
237
  },
46
238
  },
239
+ compoundVariants: [
240
+ { slot: 'leading', size: 'default', className: '-ml-1.5' },
241
+ { slot: 'leading', size: 'small', className: '-ml-0.5' },
242
+ { slot: 'leading', size: 'xsmall', className: '-ml-px' },
243
+ { slot: 'trailing', size: 'default', className: '-mr-1.5' },
244
+ { slot: 'trailing', size: 'small', className: '-mr-0.5' },
245
+ { slot: 'trailing', size: 'xsmall', className: '-mr-px' },
246
+ ],
47
247
  defaultVariants: {
248
+ size: 'default',
48
249
  color: 'default',
49
250
  },
50
251
  });
51
252
 
52
- export type ChipVariants = VariantProps<typeof chipRootVariants>;
253
+ export const chipAvatarVariants = cva(['shrink-0 rounded-full overflow-hidden'], {
254
+ variants: {
255
+ size: {
256
+ default: 'size-5 -ml-1.5',
257
+ small: 'size-4 -ml-0.5',
258
+ xsmall: 'size-2.5 -ml-px',
259
+ },
260
+ },
261
+ defaultVariants: {
262
+ size: 'default',
263
+ },
264
+ });
265
+
266
+ export type ChipVariantProps = VariantProps<typeof chipRootVariants>;
@@ -7,7 +7,7 @@ export type BaseFieldLabelProps = ViewProps & {
7
7
  htmlFor?: string;
8
8
  children?: ReactNode;
9
9
  /** @platform native — ignored on DOM `<label>`; set by form primitive for Uniwind. */
10
- dataSet?: Record<string, string>;
10
+ dataSet?: Record<string, boolean | string>;
11
11
  };
12
12
 
13
13
  /** Real `<label>` so clicking the label focuses the associated control (`htmlFor` → input `id`). */