@cdx-ui/components 0.0.1-beta.3 → 0.0.1-beta.31

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 (242) hide show
  1. package/README.md +18 -11
  2. package/lib/commonjs/components/Button/styles.js +2 -2
  3. package/lib/commonjs/components/Button/styles.js.map +1 -1
  4. package/lib/commonjs/components/Card/index.js +22 -4
  5. package/lib/commonjs/components/Card/index.js.map +1 -1
  6. package/lib/commonjs/components/Card/styles.js +27 -5
  7. package/lib/commonjs/components/Card/styles.js.map +1 -1
  8. package/lib/commonjs/components/Checkbox/index.js +5 -29
  9. package/lib/commonjs/components/Checkbox/index.js.map +1 -1
  10. package/lib/commonjs/components/Checkbox/styles.js +39 -47
  11. package/lib/commonjs/components/Checkbox/styles.js.map +1 -1
  12. package/lib/commonjs/components/Field/index.js +8 -2
  13. package/lib/commonjs/components/Field/index.js.map +1 -1
  14. package/lib/commonjs/components/Field/styles.js +4 -4
  15. package/lib/commonjs/components/Field/styles.js.map +1 -1
  16. package/lib/commonjs/components/Heading/styles.js +1 -1
  17. package/lib/commonjs/components/Heading/styles.js.map +1 -1
  18. package/lib/commonjs/components/Icon/index.js +1 -2
  19. package/lib/commonjs/components/Icon/index.js.map +1 -1
  20. package/lib/commonjs/components/IconButton/index.js +6 -1
  21. package/lib/commonjs/components/IconButton/index.js.map +1 -1
  22. package/lib/commonjs/components/IconButton/styles.js +135 -10
  23. package/lib/commonjs/components/IconButton/styles.js.map +1 -1
  24. package/lib/commonjs/components/Input/styles.js +7 -6
  25. package/lib/commonjs/components/Input/styles.js.map +1 -1
  26. package/lib/commonjs/components/ListItem/index.js +283 -0
  27. package/lib/commonjs/components/ListItem/index.js.map +1 -0
  28. package/lib/commonjs/components/ListItem/styles.js +130 -0
  29. package/lib/commonjs/components/ListItem/styles.js.map +1 -0
  30. package/lib/commonjs/components/ProgressSegmented/index.js +22 -10
  31. package/lib/commonjs/components/ProgressSegmented/index.js.map +1 -1
  32. package/lib/commonjs/components/Radio/index.js +167 -0
  33. package/lib/commonjs/components/Radio/index.js.map +1 -0
  34. package/lib/commonjs/components/Radio/styles.js +31 -0
  35. package/lib/commonjs/components/Radio/styles.js.map +1 -0
  36. package/lib/commonjs/components/Text/styles.js +2 -2
  37. package/lib/commonjs/components/Text/styles.js.map +1 -1
  38. package/lib/commonjs/components/Tile/index.js +251 -0
  39. package/lib/commonjs/components/Tile/index.js.map +1 -0
  40. package/lib/commonjs/components/Tile/styles.js +52 -0
  41. package/lib/commonjs/components/Tile/styles.js.map +1 -0
  42. package/lib/commonjs/components/index.js +36 -0
  43. package/lib/commonjs/components/index.js.map +1 -1
  44. package/lib/commonjs/figma/Button.figma.js +70 -0
  45. package/lib/commonjs/figma/Button.figma.js.map +1 -0
  46. package/lib/commonjs/figma/Card.Header.figma.js +28 -0
  47. package/lib/commonjs/figma/Card.Header.figma.js.map +1 -0
  48. package/lib/commonjs/figma/Card.figma.js +42 -0
  49. package/lib/commonjs/figma/Card.figma.js.map +1 -0
  50. package/lib/commonjs/figma/Checkbox.figma.js +55 -0
  51. package/lib/commonjs/figma/Checkbox.figma.js.map +1 -0
  52. package/lib/commonjs/figma/Field.Input.figma.js +57 -0
  53. package/lib/commonjs/figma/Field.Input.figma.js.map +1 -0
  54. package/lib/commonjs/figma/Field.Select.figma.js +57 -0
  55. package/lib/commonjs/figma/Field.Select.figma.js.map +1 -0
  56. package/lib/commonjs/figma/Heading.figma.js +30 -0
  57. package/lib/commonjs/figma/Heading.figma.js.map +1 -0
  58. package/lib/commonjs/figma/Icon.figma.js +20 -0
  59. package/lib/commonjs/figma/Icon.figma.js.map +1 -0
  60. package/lib/commonjs/figma/IconButton.figma.js +47 -0
  61. package/lib/commonjs/figma/IconButton.figma.js.map +1 -0
  62. package/lib/commonjs/figma/Input.figma.js +52 -0
  63. package/lib/commonjs/figma/Input.figma.js.map +1 -0
  64. package/lib/commonjs/figma/ProgressSegmented.figma.js +39 -0
  65. package/lib/commonjs/figma/ProgressSegmented.figma.js.map +1 -0
  66. package/lib/commonjs/figma/Radio.figma.js +38 -0
  67. package/lib/commonjs/figma/Radio.figma.js.map +1 -0
  68. package/lib/commonjs/figma/Select.figma.js +53 -0
  69. package/lib/commonjs/figma/Select.figma.js.map +1 -0
  70. package/lib/commonjs/figma/Text.figma.js +29 -0
  71. package/lib/commonjs/figma/Text.figma.js.map +1 -0
  72. package/lib/commonjs/figma/icons.figma.batch.js +27 -0
  73. package/lib/commonjs/figma/icons.figma.batch.js.map +1 -0
  74. package/lib/commonjs/figma/icons.figma.batch.json +17705 -0
  75. package/lib/commonjs/styles/primitives.js +36 -2
  76. package/lib/commonjs/styles/primitives.js.map +1 -1
  77. package/lib/module/components/Button/styles.js +2 -2
  78. package/lib/module/components/Button/styles.js.map +1 -1
  79. package/lib/module/components/Card/index.js +23 -4
  80. package/lib/module/components/Card/index.js.map +1 -1
  81. package/lib/module/components/Card/styles.js +27 -5
  82. package/lib/module/components/Card/styles.js.map +1 -1
  83. package/lib/module/components/Checkbox/index.js +6 -30
  84. package/lib/module/components/Checkbox/index.js.map +1 -1
  85. package/lib/module/components/Checkbox/styles.js +40 -48
  86. package/lib/module/components/Checkbox/styles.js.map +1 -1
  87. package/lib/module/components/Field/index.js +9 -3
  88. package/lib/module/components/Field/index.js.map +1 -1
  89. package/lib/module/components/Field/styles.js +4 -4
  90. package/lib/module/components/Field/styles.js.map +1 -1
  91. package/lib/module/components/Heading/styles.js +1 -1
  92. package/lib/module/components/Heading/styles.js.map +1 -1
  93. package/lib/module/components/Icon/index.js +1 -2
  94. package/lib/module/components/Icon/index.js.map +1 -1
  95. package/lib/module/components/IconButton/index.js +6 -1
  96. package/lib/module/components/IconButton/index.js.map +1 -1
  97. package/lib/module/components/IconButton/styles.js +135 -10
  98. package/lib/module/components/IconButton/styles.js.map +1 -1
  99. package/lib/module/components/Input/styles.js +7 -6
  100. package/lib/module/components/Input/styles.js.map +1 -1
  101. package/lib/module/components/ListItem/index.js +226 -0
  102. package/lib/module/components/ListItem/index.js.map +1 -0
  103. package/lib/module/components/ListItem/styles.js +127 -0
  104. package/lib/module/components/ListItem/styles.js.map +1 -0
  105. package/lib/module/components/ProgressSegmented/index.js +23 -11
  106. package/lib/module/components/ProgressSegmented/index.js.map +1 -1
  107. package/lib/module/components/Radio/index.js +164 -0
  108. package/lib/module/components/Radio/index.js.map +1 -0
  109. package/lib/module/components/Radio/styles.js +27 -0
  110. package/lib/module/components/Radio/styles.js.map +1 -0
  111. package/lib/module/components/Text/styles.js +2 -2
  112. package/lib/module/components/Text/styles.js.map +1 -1
  113. package/lib/module/components/Tile/index.js +243 -0
  114. package/lib/module/components/Tile/index.js.map +1 -0
  115. package/lib/module/components/Tile/styles.js +48 -0
  116. package/lib/module/components/Tile/styles.js.map +1 -0
  117. package/lib/module/components/index.js +3 -0
  118. package/lib/module/components/index.js.map +1 -1
  119. package/lib/module/figma/Button.figma.js +64 -0
  120. package/lib/module/figma/Button.figma.js.map +1 -0
  121. package/lib/module/figma/Card.Header.figma.js +22 -0
  122. package/lib/module/figma/Card.Header.figma.js.map +1 -0
  123. package/lib/module/figma/Card.figma.js +36 -0
  124. package/lib/module/figma/Card.figma.js.map +1 -0
  125. package/lib/module/figma/Checkbox.figma.js +49 -0
  126. package/lib/module/figma/Checkbox.figma.js.map +1 -0
  127. package/lib/module/figma/Field.Input.figma.js +51 -0
  128. package/lib/module/figma/Field.Input.figma.js.map +1 -0
  129. package/lib/module/figma/Field.Select.figma.js +51 -0
  130. package/lib/module/figma/Field.Select.figma.js.map +1 -0
  131. package/lib/module/figma/Heading.figma.js +24 -0
  132. package/lib/module/figma/Heading.figma.js.map +1 -0
  133. package/lib/module/figma/Icon.figma.js +14 -0
  134. package/lib/module/figma/Icon.figma.js.map +1 -0
  135. package/lib/module/figma/IconButton.figma.js +41 -0
  136. package/lib/module/figma/IconButton.figma.js.map +1 -0
  137. package/lib/module/figma/Input.figma.js +46 -0
  138. package/lib/module/figma/Input.figma.js.map +1 -0
  139. package/lib/module/figma/ProgressSegmented.figma.js +33 -0
  140. package/lib/module/figma/ProgressSegmented.figma.js.map +1 -0
  141. package/lib/module/figma/Radio.figma.js +32 -0
  142. package/lib/module/figma/Radio.figma.js.map +1 -0
  143. package/lib/module/figma/Select.figma.js +47 -0
  144. package/lib/module/figma/Select.figma.js.map +1 -0
  145. package/lib/module/figma/Text.figma.js +23 -0
  146. package/lib/module/figma/Text.figma.js.map +1 -0
  147. package/lib/module/figma/icons.figma.batch.js +22 -0
  148. package/lib/module/figma/icons.figma.batch.js.map +1 -0
  149. package/lib/module/figma/icons.figma.batch.json +17705 -0
  150. package/lib/module/styles/primitives.js +36 -2
  151. package/lib/module/styles/primitives.js.map +1 -1
  152. package/lib/typescript/components/Card/index.d.ts +4 -3
  153. package/lib/typescript/components/Card/index.d.ts.map +1 -1
  154. package/lib/typescript/components/Card/styles.d.ts +13 -3
  155. package/lib/typescript/components/Card/styles.d.ts.map +1 -1
  156. package/lib/typescript/components/Checkbox/index.d.ts +1 -2
  157. package/lib/typescript/components/Checkbox/index.d.ts.map +1 -1
  158. package/lib/typescript/components/Checkbox/styles.d.ts +4 -14
  159. package/lib/typescript/components/Checkbox/styles.d.ts.map +1 -1
  160. package/lib/typescript/components/Field/FieldLabel.web.d.ts +2 -2
  161. package/lib/typescript/components/Field/FieldLabel.web.d.ts.map +1 -1
  162. package/lib/typescript/components/Field/index.d.ts.map +1 -1
  163. package/lib/typescript/components/Field/styles.d.ts.map +1 -1
  164. package/lib/typescript/components/Heading/styles.d.ts.map +1 -1
  165. package/lib/typescript/components/Icon/index.d.ts.map +1 -1
  166. package/lib/typescript/components/IconButton/index.d.ts.map +1 -1
  167. package/lib/typescript/components/IconButton/styles.d.ts +6 -2
  168. package/lib/typescript/components/IconButton/styles.d.ts.map +1 -1
  169. package/lib/typescript/components/Input/styles.d.ts.map +1 -1
  170. package/lib/typescript/components/ListItem/index.d.ts +49 -0
  171. package/lib/typescript/components/ListItem/index.d.ts.map +1 -0
  172. package/lib/typescript/components/ListItem/styles.d.ts +30 -0
  173. package/lib/typescript/components/ListItem/styles.d.ts.map +1 -0
  174. package/lib/typescript/components/ProgressSegmented/index.d.ts +14 -3
  175. package/lib/typescript/components/ProgressSegmented/index.d.ts.map +1 -1
  176. package/lib/typescript/components/Radio/index.d.ts +40 -0
  177. package/lib/typescript/components/Radio/index.d.ts.map +1 -0
  178. package/lib/typescript/components/Radio/styles.d.ts +8 -0
  179. package/lib/typescript/components/Radio/styles.d.ts.map +1 -0
  180. package/lib/typescript/components/Text/styles.d.ts.map +1 -1
  181. package/lib/typescript/components/Tile/index.d.ts +70 -0
  182. package/lib/typescript/components/Tile/index.d.ts.map +1 -0
  183. package/lib/typescript/components/Tile/styles.d.ts +18 -0
  184. package/lib/typescript/components/Tile/styles.d.ts.map +1 -0
  185. package/lib/typescript/components/index.d.ts +3 -0
  186. package/lib/typescript/components/index.d.ts.map +1 -1
  187. package/lib/typescript/figma/Button.figma.d.ts +8 -0
  188. package/lib/typescript/figma/Button.figma.d.ts.map +1 -0
  189. package/lib/typescript/figma/Card.Header.figma.d.ts +8 -0
  190. package/lib/typescript/figma/Card.Header.figma.d.ts.map +1 -0
  191. package/lib/typescript/figma/Card.figma.d.ts +8 -0
  192. package/lib/typescript/figma/Card.figma.d.ts.map +1 -0
  193. package/lib/typescript/figma/Checkbox.figma.d.ts +8 -0
  194. package/lib/typescript/figma/Checkbox.figma.d.ts.map +1 -0
  195. package/lib/typescript/figma/Field.Input.figma.d.ts +8 -0
  196. package/lib/typescript/figma/Field.Input.figma.d.ts.map +1 -0
  197. package/lib/typescript/figma/Field.Select.figma.d.ts +8 -0
  198. package/lib/typescript/figma/Field.Select.figma.d.ts.map +1 -0
  199. package/lib/typescript/figma/Heading.figma.d.ts +8 -0
  200. package/lib/typescript/figma/Heading.figma.d.ts.map +1 -0
  201. package/lib/typescript/figma/Icon.figma.d.ts +8 -0
  202. package/lib/typescript/figma/Icon.figma.d.ts.map +1 -0
  203. package/lib/typescript/figma/IconButton.figma.d.ts +8 -0
  204. package/lib/typescript/figma/IconButton.figma.d.ts.map +1 -0
  205. package/lib/typescript/figma/Input.figma.d.ts +8 -0
  206. package/lib/typescript/figma/Input.figma.d.ts.map +1 -0
  207. package/lib/typescript/figma/ProgressSegmented.figma.d.ts +8 -0
  208. package/lib/typescript/figma/ProgressSegmented.figma.d.ts.map +1 -0
  209. package/lib/typescript/figma/Radio.figma.d.ts +8 -0
  210. package/lib/typescript/figma/Radio.figma.d.ts.map +1 -0
  211. package/lib/typescript/figma/Select.figma.d.ts +8 -0
  212. package/lib/typescript/figma/Select.figma.d.ts.map +1 -0
  213. package/lib/typescript/figma/Text.figma.d.ts +8 -0
  214. package/lib/typescript/figma/Text.figma.d.ts.map +1 -0
  215. package/lib/typescript/figma/icons.figma.batch.d.ts +14 -0
  216. package/lib/typescript/figma/icons.figma.batch.d.ts.map +1 -0
  217. package/lib/typescript/styles/primitives.d.ts +35 -0
  218. package/lib/typescript/styles/primitives.d.ts.map +1 -1
  219. package/package.json +5 -5
  220. package/src/components/Button/styles.ts +2 -2
  221. package/src/components/Card/index.tsx +41 -16
  222. package/src/components/Card/styles.ts +43 -23
  223. package/src/components/Checkbox/index.tsx +8 -19
  224. package/src/components/Checkbox/styles.ts +82 -86
  225. package/src/components/Field/FieldLabel.web.tsx +1 -1
  226. package/src/components/Field/index.tsx +10 -3
  227. package/src/components/Field/styles.ts +5 -4
  228. package/src/components/Heading/{styles.tsx → styles.ts} +1 -1
  229. package/src/components/Icon/index.tsx +1 -2
  230. package/src/components/IconButton/index.tsx +3 -2
  231. package/src/components/IconButton/styles.ts +136 -10
  232. package/src/components/Input/styles.ts +13 -8
  233. package/src/components/ListItem/index.tsx +285 -0
  234. package/src/components/ListItem/styles.ts +153 -0
  235. package/src/components/ProgressSegmented/index.tsx +49 -14
  236. package/src/components/Radio/index.tsx +192 -0
  237. package/src/components/Radio/styles.ts +59 -0
  238. package/src/components/Text/{styles.tsx → styles.ts} +2 -2
  239. package/src/components/Tile/index.tsx +296 -0
  240. package/src/components/Tile/styles.ts +82 -0
  241. package/src/components/index.ts +3 -0
  242. package/src/styles/primitives.ts +36 -2
@@ -2,10 +2,9 @@ import { forwardRef, type ReactNode } from 'react';
2
2
  import { Pressable, Text, type TextProps, View, type ViewProps } from 'react-native';
3
3
  import { Check, CheckIndeterminateSmall } from '@cdx-ui/icons';
4
4
  import { createCheckbox, type ICheckboxProps } from '@cdx-ui/primitives';
5
- import { cn, useStyleContext, withStyleContext } from '@cdx-ui/utils';
5
+ import { cn } from '@cdx-ui/utils';
6
6
  import { Icon, IconProps } from '../Icon';
7
7
  import {
8
- type CheckboxVariantProps,
9
8
  checkboxGroupVariants,
10
9
  checkboxIconVariants,
11
10
  checkboxIndicatorVariants,
@@ -13,14 +12,8 @@ import {
13
12
  checkboxRootVariants,
14
13
  } from './styles';
15
14
 
16
- const SCOPE = 'CHECKBOX';
17
-
18
- const Root = withStyleContext(Pressable, SCOPE);
19
-
20
- const useCheckboxStyleContext = () => useStyleContext(SCOPE) as CheckboxVariantProps;
21
-
22
15
  const CheckboxPrimitive = createCheckbox({
23
- Root,
16
+ Root: Pressable,
24
17
  Indicator: View,
25
18
  Icon: View,
26
19
  Label: Text,
@@ -31,14 +24,14 @@ const CheckboxPrimitive = createCheckbox({
31
24
  // CHECKBOX ROOT
32
25
  // =============================================================================
33
26
 
34
- export interface CheckboxProps extends ICheckboxProps, CheckboxVariantProps {
27
+ export interface CheckboxProps extends ICheckboxProps {
35
28
  className?: string;
36
29
  children?: ReactNode;
37
30
  }
38
31
 
39
32
  const CheckboxRoot = forwardRef<View, CheckboxProps>(
40
- ({ size = 'default', className, isIndeterminate, children, style, ...props }, ref) => {
41
- const computedClassName = cn(checkboxRootVariants({ size }), className);
33
+ ({ className, isIndeterminate, children, style, ...props }, ref) => {
34
+ const computedClassName = cn(checkboxRootVariants(), className);
42
35
 
43
36
  return (
44
37
  <CheckboxPrimitive
@@ -46,7 +39,6 @@ const CheckboxRoot = forwardRef<View, CheckboxProps>(
46
39
  className={computedClassName}
47
40
  isIndeterminate={isIndeterminate}
48
41
  style={style}
49
- context={{ size }}
50
42
  {...props}
51
43
  >
52
44
  <CheckboxIndicator>
@@ -73,8 +65,7 @@ export interface CheckboxIndicatorProps extends ViewProps {
73
65
 
74
66
  const CheckboxIndicator = forwardRef<View, CheckboxIndicatorProps>(
75
67
  ({ className, children, style, ...props }, ref) => {
76
- const { size } = useCheckboxStyleContext();
77
- const computedClassName = cn(checkboxIndicatorVariants({ size }), className);
68
+ const computedClassName = cn(checkboxIndicatorVariants(), className);
78
69
 
79
70
  return (
80
71
  <CheckboxPrimitive.Indicator
@@ -98,8 +89,7 @@ CheckboxIndicator.displayName = 'Checkbox.Indicator';
98
89
  export interface CheckboxIconProps extends Omit<IconProps, 'children'> {}
99
90
 
100
91
  const CheckboxIcon = ({ className, style, ...props }: CheckboxIconProps) => {
101
- const { size } = useCheckboxStyleContext();
102
- const computedClassName = cn(checkboxIconVariants({ size }), className);
92
+ const computedClassName = cn(checkboxIconVariants(), className);
103
93
 
104
94
  return <Icon className={computedClassName} style={style} {...props} />;
105
95
  };
@@ -117,8 +107,7 @@ export interface CheckboxLabelProps extends TextProps {
117
107
 
118
108
  const CheckboxLabel = forwardRef<Text, CheckboxLabelProps>(
119
109
  ({ className, children, style, ...props }, ref) => {
120
- const { size } = useCheckboxStyleContext();
121
- const computedClassName = cn(checkboxLabelVariants({ size }), className);
110
+ const computedClassName = cn(checkboxLabelVariants(), className);
122
111
 
123
112
  return (
124
113
  <CheckboxPrimitive.Label
@@ -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>;
@@ -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`). */
@@ -8,7 +8,7 @@ import {
8
8
  IFieldLabelProps,
9
9
  type IFieldRootProps,
10
10
  } from '@cdx-ui/primitives';
11
- import { cn } from '@cdx-ui/utils';
11
+ import { cn, useFormControlContext } from '@cdx-ui/utils';
12
12
  import { Icon } from '../Icon';
13
13
  import { BaseFieldLabel } from './FieldLabel';
14
14
  import {
@@ -70,7 +70,14 @@ export interface FieldLabelProps extends IFieldLabelProps, FieldLabelVariantProp
70
70
 
71
71
  const FieldLabel = forwardRef<View, FieldLabelProps>(
72
72
  ({ className, children, style, htmlFor, ...props }, ref) => {
73
- const labelClassName = cn(fieldLabelVariants(), className);
73
+ const { isLabelFocused, isInvalid } = useFormControlContext();
74
+ // Native: inject text-content-action via context (group-has CSS handles web).
75
+ // native: prefix keeps this class inert on web so it never conflicts with text-content-primary.
76
+ const labelClassName = cn(
77
+ fieldLabelVariants(),
78
+ isLabelFocused && !isInvalid && 'native:text-content-action',
79
+ className,
80
+ );
74
81
 
75
82
  return (
76
83
  <FieldPrimitive.Label
@@ -79,7 +86,7 @@ const FieldLabel = forwardRef<View, FieldLabelProps>(
79
86
  style={style}
80
87
  htmlFor={htmlFor}
81
88
  requiredIndicator={
82
- <Text className="text-red-500" aria-hidden>
89
+ <Text className="text-content-danger" aria-hidden>
83
90
  {' *'}
84
91
  </Text>
85
92
  }
@@ -1,23 +1,24 @@
1
1
  import { cva, type VariantProps } from 'class-variance-authority';
2
2
  import { DISABLED_OPACITY } from '../../styles/primitives';
3
3
 
4
- export const fieldRootVariants = cva(['flex-col gap-2', 'web:last:mb-0', DISABLED_OPACITY]);
4
+ export const fieldRootVariants = cva(['group flex-col gap-2', 'web:last:mb-0', DISABLED_OPACITY]);
5
5
 
6
6
  export const fieldLabelVariants = cva([
7
7
  'body-md',
8
8
  'font-medium',
9
9
  'text-content-primary',
10
10
  'flex-row items-center',
11
- DISABLED_OPACITY,
11
+ 'overflow-hidden',
12
12
  'web:cursor-pointer',
13
+ 'web:group-has-[[data-focus=true]]:data-[invalid=false]:text-content-action',
13
14
  'data-[invalid=true]:text-content-danger',
14
15
  ]);
15
16
 
16
- export const fieldHelperVariants = cva(['flex-row items-center']);
17
+ export const fieldHelperVariants = cva(['flex-row items-center min-h-4']);
17
18
 
18
19
  export const fieldHelperTextVariants = cva(['body-sm', 'text-content-tertiary']);
19
20
 
20
- export const fieldErrorVariants = cva(['flex-row items-center gap-1']);
21
+ export const fieldErrorVariants = cva(['flex-row items-center gap-0.5 min-h-4']);
21
22
 
22
23
  export const fieldErrorTextVariants = cva(['body-sm', 'text-content-danger']);
23
24
 
@@ -5,7 +5,7 @@ export const headingStyle = cva(
5
5
  [
6
6
  `text-content-primary my-0`,
7
7
  Platform.select({
8
- web: 'bg-transparent display-inline no-underline',
8
+ web: 'bg-transparent no-underline',
9
9
  default: '',
10
10
  }),
11
11
  ],
@@ -1,7 +1,6 @@
1
1
  import { withUniwind } from 'uniwind';
2
2
  import { cn } from '@cdx-ui/utils';
3
3
  import type { CdxIcon, CdxIconProps } from '@cdx-ui/icons';
4
- import { COLOR_TEXT_PRIMARY } from '../../styles/primitives';
5
4
 
6
5
  export type IconProps = CdxIconProps & {
7
6
  className?: string; // TODO: Why does this need to specified manually?
@@ -47,7 +46,7 @@ export function Icon({ as: IconComponent, className, ...props }: IconProps) {
47
46
  return (
48
47
  <StyledIcon
49
48
  as={IconComponent}
50
- className={cn(COLOR_TEXT_PRIMARY, 'size-5', className)}
49
+ className={cn('text-content-primary size-5', className)}
51
50
  {...props}
52
51
  />
53
52
  );
@@ -53,6 +53,7 @@ const IconButtonRoot = forwardRef<View, IconButtonProps>(
53
53
  (
54
54
  {
55
55
  variant = 'solid',
56
+ color = 'neutral',
56
57
  size = 'default',
57
58
  className,
58
59
  style,
@@ -63,11 +64,11 @@ const IconButtonRoot = forwardRef<View, IconButtonProps>(
63
64
  },
64
65
  ref,
65
66
  ) => {
66
- const rootClassName = cn(iconButtonRootVariants({ variant, size }), className);
67
+ const rootClassName = cn(iconButtonRootVariants({ variant, color, size }), className);
67
68
 
68
69
  const glyphClassName = cn(
69
70
  iconButtonGlyphVariants({ size }),
70
- iconButtonIconColorVariants(),
71
+ iconButtonIconColorVariants({ variant, color }),
71
72
  iconClassName,
72
73
  );
73
74
 
@@ -8,35 +8,133 @@ export const iconButtonRootVariants = cva(
8
8
  'rounded-[var(--border-radius-round)]',
9
9
  'web:outline-none web:focus:outline-none web:focus-visible:outline-none',
10
10
  TRANSITION_COLORS,
11
- 'data-[disabled=true]:opacity-[--opacity-disabled]',
11
+ 'data-[disabled=true]:opacity-[var(--opacity-disabled)]',
12
12
  DISABLED_CURSOR,
13
- 'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-[--color-stroke-ring] web:data-[focus-visible=true]:ring-offset-2',
13
+ 'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-[var(--color-stroke-ring)] web:data-[focus-visible=true]:ring-offset-2',
14
14
  ],
15
15
  {
16
16
  variants: {
17
17
  variant: {
18
- solid: [
18
+ solid: [],
19
+ tint: [],
20
+ ghost: ['bg-transparent'],
21
+ },
22
+ color: {
23
+ neutral: [],
24
+ action: [],
25
+ danger: [],
26
+ },
27
+ size: {
28
+ default: 'h-11 w-11 min-w-11 shrink-0 p-2.5',
29
+ small: 'h-8 w-8 min-w-8 shrink-0 p-1.5',
30
+ },
31
+ },
32
+ compoundVariants: [
33
+ // ── solid × color ───────────────────────────────────────────────────
34
+ {
35
+ variant: 'solid',
36
+ color: 'neutral',
37
+ className: [
19
38
  'bg-surface-primary border border-stroke-secondary',
20
39
  Platform.select({
21
40
  default: 'data-[active=true]:bg-surface-primary-active',
22
41
  web: 'data-[hover=true]:bg-surface-primary-hover data-[active=true]:data-[hover=true]:bg-surface-secondary-active',
23
42
  }),
24
43
  ],
25
- ghost: [
26
- 'bg-transparent',
44
+ },
45
+ {
46
+ variant: 'solid',
47
+ color: 'action',
48
+ className: [
49
+ 'bg-surface-action-strong',
50
+ Platform.select({
51
+ default: 'data-[active=true]:bg-surface-action-strong-active',
52
+ web: 'data-[hover=true]:bg-surface-action-strong-hover data-[active=true]:data-[hover=true]:bg-surface-action-strong-active',
53
+ }),
54
+ ],
55
+ },
56
+ {
57
+ variant: 'solid',
58
+ color: 'danger',
59
+ className: [
60
+ 'bg-surface-danger-strong',
61
+ Platform.select({
62
+ default: 'data-[active=true]:bg-surface-danger-strong-active',
63
+ web: 'data-[hover=true]:bg-surface-danger-strong-hover data-[active=true]:data-[hover=true]:bg-surface-danger-strong-active',
64
+ }),
65
+ ],
66
+ },
67
+
68
+ // ── tint × color ─────────────────────────────────────────────────
69
+ {
70
+ variant: 'tint',
71
+ color: 'neutral',
72
+ className: [
73
+ 'bg-surface-neutral-tint',
74
+ Platform.select({
75
+ default: 'data-[active=true]:bg-surface-neutral-tint-active',
76
+ web: 'data-[hover=true]:bg-surface-neutral-tint-hover data-[active=true]:data-[hover=true]:bg-surface-neutral-tint-active',
77
+ }),
78
+ ],
79
+ },
80
+ {
81
+ variant: 'tint',
82
+ color: 'action',
83
+ className: [
84
+ 'bg-surface-action-tint',
85
+ Platform.select({
86
+ default: 'data-[active=true]:bg-surface-action-tint-active',
87
+ web: 'data-[hover=true]:bg-surface-action-tint-hover data-[active=true]:data-[hover=true]:bg-surface-action-tint-active',
88
+ }),
89
+ ],
90
+ },
91
+ {
92
+ variant: 'tint',
93
+ color: 'danger',
94
+ className: [
95
+ 'bg-surface-danger-tint',
96
+ Platform.select({
97
+ default: 'data-[active=true]:bg-surface-danger-tint-active',
98
+ web: 'data-[hover=true]:bg-surface-danger-tint-hover data-[active=true]:data-[hover=true]:bg-surface-danger-tint-active',
99
+ }),
100
+ ],
101
+ },
102
+
103
+ // ── ghost × color ──────────────────────────────────────────────────
104
+ {
105
+ variant: 'ghost',
106
+ color: 'neutral',
107
+ className: [
27
108
  Platform.select({
28
109
  default: 'data-[active=true]:bg-surface-primary-active',
29
110
  web: 'data-[hover=true]:bg-surface-primary-hover data-[active=true]:data-[hover=true]:bg-surface-secondary-active',
30
111
  }),
31
112
  ],
32
113
  },
33
- size: {
34
- default: 'h-11 w-11 min-w-11 shrink-0 p-2.5',
35
- small: 'h-8 w-8 min-w-8 shrink-0 p-1.5',
114
+ {
115
+ variant: 'ghost',
116
+ color: 'action',
117
+ className: [
118
+ Platform.select({
119
+ default: 'data-[active=true]:bg-surface-action-tint-active',
120
+ web: 'data-[hover=true]:bg-surface-action-tint-hover data-[active=true]:data-[hover=true]:bg-surface-action-tint-active',
121
+ }),
122
+ ],
36
123
  },
37
- },
124
+ {
125
+ variant: 'ghost',
126
+ color: 'danger',
127
+ className: [
128
+ Platform.select({
129
+ default: 'data-[active=true]:bg-surface-danger-tint-active',
130
+ web: 'data-[hover=true]:bg-surface-danger-tint-hover data-[active=true]:data-[hover=true]:bg-surface-danger-tint-active',
131
+ }),
132
+ ],
133
+ },
134
+ ],
38
135
  defaultVariants: {
39
136
  variant: 'solid',
137
+ color: 'neutral',
40
138
  size: 'default',
41
139
  },
42
140
  },
@@ -54,6 +152,34 @@ export const iconButtonGlyphVariants = cva([], {
54
152
  },
55
153
  });
56
154
 
57
- export const iconButtonIconColorVariants = cva(['text-content-primary']);
155
+ export const iconButtonIconColorVariants = cva([], {
156
+ variants: {
157
+ variant: {
158
+ solid: [],
159
+ tint: [],
160
+ ghost: [],
161
+ },
162
+ color: {
163
+ neutral: [],
164
+ action: [],
165
+ danger: [],
166
+ },
167
+ },
168
+ compoundVariants: [
169
+ { variant: 'solid', color: 'neutral', className: 'text-content-primary' },
170
+ { variant: 'solid', color: 'action', className: 'text-content-action-on-strong' },
171
+ { variant: 'solid', color: 'danger', className: 'text-content-danger-on-strong' },
172
+ { variant: 'tint', color: 'neutral', className: 'text-content-primary' },
173
+ { variant: 'tint', color: 'action', className: 'text-content-action-on-subtle' },
174
+ { variant: 'tint', color: 'danger', className: 'text-content-danger-on-subtle' },
175
+ { variant: 'ghost', color: 'neutral', className: 'text-content-primary' },
176
+ { variant: 'ghost', color: 'action', className: 'text-content-action' },
177
+ { variant: 'ghost', color: 'danger', className: 'text-content-danger' },
178
+ ],
179
+ defaultVariants: {
180
+ variant: 'solid',
181
+ color: 'neutral',
182
+ },
183
+ });
58
184
 
59
185
  export type IconButtonVariantProps = VariantProps<typeof iconButtonRootVariants>;
@@ -3,13 +3,13 @@ import { DISABLED_CURSOR, TRANSITION_COLORS } from '../../styles/primitives';
3
3
 
4
4
  export const inputRootVariants = cva(
5
5
  [
6
- 'w-full flex-row items-stretch overflow-hidden',
6
+ 'w-full flex-row items-center overflow-hidden',
7
7
  'bg-surface-primary',
8
8
  'border-solid border-[length:var(--border-width-default)] border-stroke-primary',
9
9
  'rounded-[var(--border-radius-default)]',
10
10
  TRANSITION_COLORS,
11
11
  'data-[disabled=true]:bg-surface-secondary',
12
- 'data-[disabled=true]:opacity-[--opacity-disabled]',
12
+ 'data-[disabled=true]:opacity-[var(--opacity-disabled)]',
13
13
  DISABLED_CURSOR,
14
14
  'data-[readonly=true]:cursor-default',
15
15
  'data-[readonly=true]:bg-surface-secondary',
@@ -24,11 +24,16 @@ export const inputRootVariants = cva(
24
24
  outline: [],
25
25
  },
26
26
  size: {
27
- // TODO: Find a cleaner approach to preventing layout shift when focus border is applied.
28
- default: ['h-10 px-4 py-2 gap-2', 'data-[focus=true]:px-[15px] data-[focus=true]:py-[7px]'],
27
+ default: [
28
+ 'h-11 min-h-11 px-4 py-3 gap-4',
29
+ // Subtract one hairline from padding when focused so the wider focus border doesn’t shift layout.
30
+ 'data-[focus=true]:px-[calc(var(--spacing-4)-var(--spacing-px))]',
31
+ 'data-[focus=true]:py-[calc(var(--spacing-3)-var(--spacing-px))]',
32
+ ],
29
33
  small: [
30
- 'h-8 px-3 py-1.5 gap-1.5',
31
- 'data-[focus=true]:px-[11px] data-[focus=true]:py-[5px]',
34
+ 'h-8 min-h-8 px-3 py-2 gap-1.5',
35
+ 'data-[focus=true]:px-[calc(var(--spacing-3)-var(--spacing-px))]',
36
+ 'data-[focus=true]:py-[calc(var(--spacing-2)-var(--spacing-px))]',
32
37
  ],
33
38
  },
34
39
  },
@@ -42,7 +47,7 @@ export const inputRootVariants = cva(
42
47
  export const inputFieldVariants = cva(
43
48
  [
44
49
  'flex-1 justify-center bg-transparent p-0',
45
- 'font-body text-content-primary',
50
+ 'text-content-primary',
46
51
  'placeholder:text-content-tertiary',
47
52
  'web:outline-none',
48
53
  'tracking-normal',
@@ -60,7 +65,7 @@ export const inputFieldVariants = cva(
60
65
  },
61
66
  );
62
67
 
63
- export const inputSlotVariants = cva(['items-center justify-center self-center']);
68
+ export const inputSlotVariants = cva(['items-center justify-center self-center shrink-0']);
64
69
 
65
70
  export const inputIconVariants = cva(['text-content-tertiary'], {
66
71
  variants: {