@cdx-ui/components 0.0.1-alpha.2 → 0.0.1-alpha.21

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 (262) hide show
  1. package/README.md +2 -2
  2. package/lib/commonjs/components/Avatar/index.js +156 -0
  3. package/lib/commonjs/components/Avatar/index.js.map +1 -0
  4. package/lib/commonjs/components/Avatar/styles.js +80 -0
  5. package/lib/commonjs/components/Avatar/styles.js.map +1 -0
  6. package/lib/commonjs/components/BottomSheet/index.js +248 -0
  7. package/lib/commonjs/components/BottomSheet/index.js.map +1 -0
  8. package/lib/commonjs/components/BottomSheet/styles.js +61 -0
  9. package/lib/commonjs/components/BottomSheet/styles.js.map +1 -0
  10. package/lib/commonjs/components/Box/Box.js +1 -0
  11. package/lib/commonjs/components/Box/Box.js.map +1 -1
  12. package/lib/commonjs/components/Button/index.js +28 -13
  13. package/lib/commonjs/components/Button/index.js.map +1 -1
  14. package/lib/commonjs/components/Button/styles.js +323 -139
  15. package/lib/commonjs/components/Button/styles.js.map +1 -1
  16. package/lib/commonjs/components/Card/index.js +104 -0
  17. package/lib/commonjs/components/Card/index.js.map +1 -0
  18. package/lib/commonjs/components/Card/styles.js +28 -0
  19. package/lib/commonjs/components/Card/styles.js.map +1 -0
  20. package/lib/commonjs/components/Checkbox/index.js +180 -0
  21. package/lib/commonjs/components/Checkbox/index.js.map +1 -0
  22. package/lib/commonjs/components/Checkbox/styles.js +68 -0
  23. package/lib/commonjs/components/Checkbox/styles.js.map +1 -0
  24. package/lib/commonjs/components/Chip/index.js +103 -0
  25. package/lib/commonjs/components/Chip/index.js.map +1 -0
  26. package/lib/commonjs/components/Chip/styles.js +50 -0
  27. package/lib/commonjs/components/Chip/styles.js.map +1 -0
  28. package/lib/commonjs/components/Heading/index.js +35 -0
  29. package/lib/commonjs/components/Heading/index.js.map +1 -0
  30. package/lib/commonjs/components/Heading/styles.js +24 -0
  31. package/lib/commonjs/components/Heading/styles.js.map +1 -0
  32. package/lib/commonjs/components/Icon/index.js +61 -0
  33. package/lib/commonjs/components/Icon/index.js.map +1 -0
  34. package/lib/commonjs/components/Input/index.js +10 -16
  35. package/lib/commonjs/components/Input/index.js.map +1 -1
  36. package/lib/commonjs/components/Input/styles.js +16 -30
  37. package/lib/commonjs/components/Input/styles.js.map +1 -1
  38. package/lib/commonjs/components/Link/index.js +94 -0
  39. package/lib/commonjs/components/Link/index.js.map +1 -0
  40. package/lib/commonjs/components/Link/styles.js +16 -0
  41. package/lib/commonjs/components/Link/styles.js.map +1 -0
  42. package/lib/commonjs/components/Select/index.js +11 -12
  43. package/lib/commonjs/components/Select/index.js.map +1 -1
  44. package/lib/commonjs/components/Select/styles.js +29 -53
  45. package/lib/commonjs/components/Select/styles.js.map +1 -1
  46. package/lib/commonjs/components/Stack/HStack.js +8 -21
  47. package/lib/commonjs/components/Stack/HStack.js.map +1 -1
  48. package/lib/commonjs/components/Stack/VStack.js +8 -21
  49. package/lib/commonjs/components/Stack/VStack.js.map +1 -1
  50. package/lib/commonjs/components/Stack/styles.js +39 -0
  51. package/lib/commonjs/components/Stack/styles.js.map +1 -0
  52. package/lib/commonjs/components/Switch/BaseSwitch.js +46 -0
  53. package/lib/commonjs/components/Switch/BaseSwitch.js.map +1 -0
  54. package/lib/commonjs/components/Switch/BaseSwitch.web.js +56 -0
  55. package/lib/commonjs/components/Switch/BaseSwitch.web.js.map +1 -0
  56. package/lib/commonjs/components/Switch/index.js +13 -0
  57. package/lib/commonjs/components/Switch/index.js.map +1 -0
  58. package/lib/commonjs/components/Switch/styles.js +128 -0
  59. package/lib/commonjs/components/Switch/styles.js.map +1 -0
  60. package/lib/commonjs/components/Text/index.js +18 -9
  61. package/lib/commonjs/components/Text/index.js.map +1 -1
  62. package/lib/commonjs/components/Text/styles.js +24 -0
  63. package/lib/commonjs/components/Text/styles.js.map +1 -0
  64. package/lib/commonjs/components/VirtualizedList/index.js +19 -0
  65. package/lib/commonjs/components/VirtualizedList/index.js.map +1 -0
  66. package/lib/commonjs/components/index.js +120 -0
  67. package/lib/commonjs/components/index.js.map +1 -1
  68. package/lib/commonjs/metro/withCdxMetroConfig.js +24 -0
  69. package/lib/commonjs/metro/withCdxMetroConfig.js.map +1 -0
  70. package/lib/commonjs/styles/index.js +17 -0
  71. package/lib/commonjs/styles/index.js.map +1 -0
  72. package/lib/commonjs/styles/primitives.js +123 -0
  73. package/lib/commonjs/styles/primitives.js.map +1 -0
  74. package/lib/module/components/Avatar/index.js +152 -0
  75. package/lib/module/components/Avatar/index.js.map +1 -0
  76. package/lib/module/components/Avatar/styles.js +77 -0
  77. package/lib/module/components/Avatar/styles.js.map +1 -0
  78. package/lib/module/components/BottomSheet/index.js +242 -0
  79. package/lib/module/components/BottomSheet/index.js.map +1 -0
  80. package/lib/module/components/BottomSheet/styles.js +58 -0
  81. package/lib/module/components/BottomSheet/styles.js.map +1 -0
  82. package/lib/module/components/Box/Box.js +1 -0
  83. package/lib/module/components/Box/Box.js.map +1 -1
  84. package/lib/module/components/Button/index.js +29 -14
  85. package/lib/module/components/Button/index.js.map +1 -1
  86. package/lib/module/components/Button/styles.js +322 -138
  87. package/lib/module/components/Button/styles.js.map +1 -1
  88. package/lib/module/components/Card/index.js +100 -0
  89. package/lib/module/components/Card/index.js.map +1 -0
  90. package/lib/module/components/Card/styles.js +25 -0
  91. package/lib/module/components/Card/styles.js.map +1 -0
  92. package/lib/module/components/Checkbox/index.js +176 -0
  93. package/lib/module/components/Checkbox/index.js.map +1 -0
  94. package/lib/module/components/Checkbox/styles.js +64 -0
  95. package/lib/module/components/Checkbox/styles.js.map +1 -0
  96. package/lib/module/components/Chip/index.js +99 -0
  97. package/lib/module/components/Chip/index.js.map +1 -0
  98. package/lib/module/components/Chip/styles.js +46 -0
  99. package/lib/module/components/Chip/styles.js.map +1 -0
  100. package/lib/module/components/Heading/index.js +31 -0
  101. package/lib/module/components/Heading/index.js.map +1 -0
  102. package/lib/module/components/Heading/styles.js +20 -0
  103. package/lib/module/components/Heading/styles.js.map +1 -0
  104. package/lib/module/components/Icon/index.js +57 -0
  105. package/lib/module/components/Icon/index.js.map +1 -0
  106. package/lib/module/components/Input/index.js +10 -16
  107. package/lib/module/components/Input/index.js.map +1 -1
  108. package/lib/module/components/Input/styles.js +16 -30
  109. package/lib/module/components/Input/styles.js.map +1 -1
  110. package/lib/module/components/Link/index.js +85 -0
  111. package/lib/module/components/Link/index.js.map +1 -0
  112. package/lib/module/components/Link/styles.js +12 -0
  113. package/lib/module/components/Link/styles.js.map +1 -0
  114. package/lib/module/components/Select/index.js +12 -13
  115. package/lib/module/components/Select/index.js.map +1 -1
  116. package/lib/module/components/Select/styles.js +29 -53
  117. package/lib/module/components/Select/styles.js.map +1 -1
  118. package/lib/module/components/Stack/HStack.js +8 -21
  119. package/lib/module/components/Stack/HStack.js.map +1 -1
  120. package/lib/module/components/Stack/VStack.js +8 -21
  121. package/lib/module/components/Stack/VStack.js.map +1 -1
  122. package/lib/module/components/Stack/styles.js +35 -0
  123. package/lib/module/components/Stack/styles.js.map +1 -0
  124. package/lib/module/components/Switch/BaseSwitch.js +42 -0
  125. package/lib/module/components/Switch/BaseSwitch.js.map +1 -0
  126. package/lib/module/components/Switch/BaseSwitch.web.js +52 -0
  127. package/lib/module/components/Switch/BaseSwitch.web.js.map +1 -0
  128. package/lib/module/components/Switch/index.js +9 -0
  129. package/lib/module/components/Switch/index.js.map +1 -0
  130. package/lib/module/components/Switch/styles.js +125 -0
  131. package/lib/module/components/Switch/styles.js.map +1 -0
  132. package/lib/module/components/Text/index.js +19 -1
  133. package/lib/module/components/Text/index.js.map +1 -1
  134. package/lib/module/components/Text/styles.js +20 -0
  135. package/lib/module/components/Text/styles.js.map +1 -0
  136. package/lib/module/components/VirtualizedList/index.js +15 -0
  137. package/lib/module/components/VirtualizedList/index.js.map +1 -0
  138. package/lib/module/components/index.js +10 -0
  139. package/lib/module/components/index.js.map +1 -1
  140. package/lib/module/metro/withCdxMetroConfig.js +20 -0
  141. package/lib/module/metro/withCdxMetroConfig.js.map +1 -0
  142. package/lib/module/styles/index.js +4 -0
  143. package/lib/module/styles/index.js.map +1 -0
  144. package/lib/module/styles/primitives.js +119 -0
  145. package/lib/module/styles/primitives.js.map +1 -0
  146. package/lib/typescript/components/Avatar/index.d.ts +40 -0
  147. package/lib/typescript/components/Avatar/index.d.ts.map +1 -0
  148. package/lib/typescript/components/Avatar/styles.d.ts +16 -0
  149. package/lib/typescript/components/Avatar/styles.d.ts.map +1 -0
  150. package/lib/typescript/components/BottomSheet/index.d.ts +61 -0
  151. package/lib/typescript/components/BottomSheet/index.d.ts.map +1 -0
  152. package/lib/typescript/components/BottomSheet/styles.d.ts +16 -0
  153. package/lib/typescript/components/BottomSheet/styles.d.ts.map +1 -0
  154. package/lib/typescript/components/Box/Box.d.ts +1 -0
  155. package/lib/typescript/components/Box/Box.d.ts.map +1 -1
  156. package/lib/typescript/components/Button/index.d.ts +6 -3
  157. package/lib/typescript/components/Button/index.d.ts.map +1 -1
  158. package/lib/typescript/components/Button/styles.d.ts +14 -8
  159. package/lib/typescript/components/Button/styles.d.ts.map +1 -1
  160. package/lib/typescript/components/Card/index.d.ts +30 -0
  161. package/lib/typescript/components/Card/index.d.ts.map +1 -0
  162. package/lib/typescript/components/Card/styles.d.ts +6 -0
  163. package/lib/typescript/components/Card/styles.d.ts.map +1 -0
  164. package/lib/typescript/components/Checkbox/index.d.ts +46 -0
  165. package/lib/typescript/components/Checkbox/index.d.ts.map +1 -0
  166. package/lib/typescript/components/Checkbox/styles.d.ts +18 -0
  167. package/lib/typescript/components/Checkbox/styles.d.ts.map +1 -0
  168. package/lib/typescript/components/Chip/index.d.ts +27 -0
  169. package/lib/typescript/components/Chip/index.d.ts.map +1 -0
  170. package/lib/typescript/components/Chip/styles.d.ts +12 -0
  171. package/lib/typescript/components/Chip/styles.d.ts.map +1 -0
  172. package/lib/typescript/components/Heading/index.d.ts +10 -0
  173. package/lib/typescript/components/Heading/index.d.ts.map +1 -0
  174. package/lib/typescript/components/Heading/styles.d.ts +6 -0
  175. package/lib/typescript/components/Heading/styles.d.ts.map +1 -0
  176. package/lib/typescript/components/Icon/index.d.ts +27 -0
  177. package/lib/typescript/components/Icon/index.d.ts.map +1 -0
  178. package/lib/typescript/components/Input/index.d.ts +6 -4
  179. package/lib/typescript/components/Input/index.d.ts.map +1 -1
  180. package/lib/typescript/components/Input/styles.d.ts +5 -7
  181. package/lib/typescript/components/Input/styles.d.ts.map +1 -1
  182. package/lib/typescript/components/Link/index.d.ts +26 -0
  183. package/lib/typescript/components/Link/index.d.ts.map +1 -0
  184. package/lib/typescript/components/Link/styles.d.ts +4 -0
  185. package/lib/typescript/components/Link/styles.d.ts.map +1 -0
  186. package/lib/typescript/components/Select/index.d.ts +6 -3
  187. package/lib/typescript/components/Select/index.d.ts.map +1 -1
  188. package/lib/typescript/components/Select/styles.d.ts +6 -8
  189. package/lib/typescript/components/Select/styles.d.ts.map +1 -1
  190. package/lib/typescript/components/Stack/HStack.d.ts +1 -12
  191. package/lib/typescript/components/Stack/HStack.d.ts.map +1 -1
  192. package/lib/typescript/components/Stack/VStack.d.ts +1 -12
  193. package/lib/typescript/components/Stack/VStack.d.ts.map +1 -1
  194. package/lib/typescript/components/Stack/styles.d.ts +10 -0
  195. package/lib/typescript/components/Stack/styles.d.ts.map +1 -0
  196. package/lib/typescript/components/Switch/BaseSwitch.d.ts +9 -0
  197. package/lib/typescript/components/Switch/BaseSwitch.d.ts.map +1 -0
  198. package/lib/typescript/components/Switch/BaseSwitch.web.d.ts +15 -0
  199. package/lib/typescript/components/Switch/BaseSwitch.web.d.ts.map +1 -0
  200. package/lib/typescript/components/Switch/index.d.ts +8 -0
  201. package/lib/typescript/components/Switch/index.d.ts.map +1 -0
  202. package/lib/typescript/components/Switch/styles.d.ts +26 -0
  203. package/lib/typescript/components/Switch/styles.d.ts.map +1 -0
  204. package/lib/typescript/components/Text/index.d.ts +9 -1
  205. package/lib/typescript/components/Text/index.d.ts.map +1 -1
  206. package/lib/typescript/components/Text/styles.d.ts +6 -0
  207. package/lib/typescript/components/Text/styles.d.ts.map +1 -0
  208. package/lib/typescript/components/VirtualizedList/index.d.ts +8 -0
  209. package/lib/typescript/components/VirtualizedList/index.d.ts.map +1 -0
  210. package/lib/typescript/components/index.d.ts +10 -0
  211. package/lib/typescript/components/index.d.ts.map +1 -1
  212. package/lib/typescript/metro/withCdxMetroConfig.d.ts +19 -0
  213. package/lib/typescript/metro/withCdxMetroConfig.d.ts.map +1 -0
  214. package/lib/typescript/styles/index.d.ts +2 -0
  215. package/lib/typescript/styles/index.d.ts.map +1 -0
  216. package/lib/typescript/styles/primitives.d.ts +85 -0
  217. package/lib/typescript/styles/primitives.d.ts.map +1 -0
  218. package/package.json +22 -13
  219. package/src/components/Avatar/index.tsx +174 -0
  220. package/src/components/Avatar/styles.ts +83 -0
  221. package/src/components/BottomSheet/index.tsx +316 -0
  222. package/src/components/BottomSheet/styles.ts +79 -0
  223. package/src/components/Box/Box.tsx +1 -0
  224. package/src/components/Button/index.tsx +23 -15
  225. package/src/components/Button/styles.ts +353 -144
  226. package/src/components/Card/index.tsx +115 -0
  227. package/src/components/Card/styles.ts +41 -0
  228. package/src/components/Checkbox/index.tsx +209 -0
  229. package/src/components/Checkbox/styles.ts +103 -0
  230. package/src/components/Chip/index.tsx +91 -0
  231. package/src/components/Chip/styles.ts +51 -0
  232. package/src/components/Heading/index.tsx +36 -0
  233. package/src/components/Heading/styles.tsx +26 -0
  234. package/src/components/Icon/index.tsx +54 -0
  235. package/src/components/Input/index.tsx +9 -20
  236. package/src/components/Input/styles.ts +42 -37
  237. package/src/components/Link/index.tsx +83 -0
  238. package/src/components/Link/styles.ts +20 -0
  239. package/src/components/Select/index.tsx +12 -11
  240. package/src/components/Select/styles.ts +63 -74
  241. package/src/components/Stack/HStack.tsx +8 -19
  242. package/src/components/Stack/VStack.tsx +8 -23
  243. package/src/components/Stack/styles.ts +37 -0
  244. package/src/components/Switch/BaseSwitch.tsx +38 -0
  245. package/src/components/Switch/BaseSwitch.web.tsx +69 -0
  246. package/src/components/Switch/index.tsx +13 -0
  247. package/src/components/Switch/styles.ts +120 -0
  248. package/src/components/Text/index.tsx +16 -0
  249. package/src/components/Text/styles.tsx +26 -0
  250. package/src/components/VirtualizedList/index.tsx +19 -0
  251. package/src/components/index.ts +10 -0
  252. package/src/metro/withCdxMetroConfig.ts +29 -0
  253. package/src/styles/index.ts +1 -0
  254. package/src/styles/primitives.ts +107 -0
  255. package/lib/commonjs/components/Text/Text.js +0 -30
  256. package/lib/commonjs/components/Text/Text.js.map +0 -1
  257. package/lib/module/components/Text/Text.js +0 -26
  258. package/lib/module/components/Text/Text.js.map +0 -1
  259. package/lib/typescript/components/Text/Text.d.ts +0 -11
  260. package/lib/typescript/components/Text/Text.d.ts.map +0 -1
  261. package/src/components/Text/Text.tsx +0 -58
  262. package/src/components/Text/index.ts +0 -1
@@ -0,0 +1,54 @@
1
+ import { withUniwind } from 'uniwind';
2
+ import { cn } from '@cdx-ui/utils';
3
+ import type { CdxIcon, CdxIconProps } from '@cdx-ui/icons';
4
+ import { COLOR_TEXT_PRIMARY } from '../../styles/primitives';
5
+
6
+ export type IconProps = CdxIconProps & {
7
+ className?: string; // TODO: Why does this need to specified manually?
8
+ as: CdxIcon;
9
+ };
10
+
11
+ function IconImpl({ as: IconComponent, ...props }: IconProps) {
12
+ return <IconComponent {...props} />;
13
+ }
14
+
15
+ const StyledIcon = withUniwind(IconImpl, {
16
+ size: {
17
+ fromClassName: 'className',
18
+ styleProperty: 'width',
19
+ },
20
+ color: {
21
+ fromClassName: 'className',
22
+ styleProperty: 'color',
23
+ },
24
+ });
25
+
26
+ /**
27
+ * A wrapper component for CDX icons with Uniwind `className` support via `withUniwind`.
28
+ *
29
+ * This component allows you to render any CDX icon while applying utility classes
30
+ * using `uniwind`. It avoids the need to wrap or configure each icon individually.
31
+ *
32
+ * @component
33
+ * @example
34
+ * ```tsx
35
+ * import { Icon } from '@cdx-ui/components';
36
+ * import { ArrowRight } from '@cdx-ui/icons';
37
+ *
38
+ * <Icon as={ArrowRight} className="text-red-500 size-4" />
39
+ * ```
40
+ *
41
+ * @param {CdxIcon} as - The CDX icon component to render.
42
+ * @param {string} className - Utility classes to style the icon using Uniwind.
43
+ * @param {number} size - Icon size (overrides the size class).
44
+ * @param {...CdxIconProps} ...props - Additional icon props passed to the "as" icon.
45
+ */
46
+ export function Icon({ as: IconComponent, className, ...props }: IconProps) {
47
+ return (
48
+ <StyledIcon
49
+ as={IconComponent}
50
+ className={cn(COLOR_TEXT_PRIMARY, 'size-5', className)}
51
+ {...props}
52
+ />
53
+ );
54
+ }
@@ -7,6 +7,7 @@ import {
7
7
  type IInputSlotProps,
8
8
  } from '@cdx-ui/primitives';
9
9
  import { cn, useStyleContext, withStyleContext } from '@cdx-ui/utils';
10
+ import { Icon, IconProps } from '../Icon';
10
11
  import { BaseInput } from './BaseInput';
11
12
  import {
12
13
  type InputVariantProps,
@@ -25,7 +26,6 @@ const useInputStyleContext = () => useStyleContext(SCOPE) as InputVariantProps;
25
26
 
26
27
  const InputPrimitive = createInput({
27
28
  Root,
28
- Icon: View,
29
29
  Slot: View,
30
30
  Field: BaseInput,
31
31
  });
@@ -40,7 +40,7 @@ export interface InputProps extends ViewProps, IInputFieldProps, InputVariantPro
40
40
  }
41
41
 
42
42
  const InputRoot = forwardRef<View, InputProps>(
43
- ({ variant = 'outline', size = 'md', className, children, style, ...props }, ref) => {
43
+ ({ variant = 'outline', size = 'default', className, children, style, ...props }, ref) => {
44
44
  const computedClassName = cn(inputRootVariants({ variant, size }), className);
45
45
 
46
46
  return (
@@ -103,9 +103,7 @@ export interface InputSlotProps extends ViewProps, IInputSlotProps {
103
103
 
104
104
  const InputSlot = forwardRef<View, InputSlotProps>(
105
105
  ({ className, children, style, ...props }, ref) => {
106
- const { size } = useInputStyleContext();
107
-
108
- const computedClassName = cn(inputSlotVariants({ size }), className);
106
+ const computedClassName = cn(inputSlotVariants(), className);
109
107
 
110
108
  return (
111
109
  <InputPrimitive.Slot ref={ref} className={computedClassName} style={style} {...props}>
@@ -121,24 +119,15 @@ InputSlot.displayName = 'Input.Slot';
121
119
  // INPUT ICON
122
120
  // =============================================================================
123
121
 
124
- export interface InputIconProps extends ViewProps {
125
- className?: string;
126
- children?: ReactNode;
127
- }
122
+ export interface InputIconProps extends Omit<IconProps, 'children'> {}
128
123
 
129
- const InputIcon = forwardRef<View, InputIconProps>(
130
- ({ className, children, style, ...props }, ref) => {
131
- const { size } = useInputStyleContext();
124
+ const InputIcon = ({ className, style, as, ...props }: InputIconProps) => {
125
+ const { size } = useInputStyleContext();
132
126
 
133
- const computedClassName = cn(inputIconVariants({ size }), className);
127
+ const computedClassName = cn(inputIconVariants({ size }), className);
134
128
 
135
- return (
136
- <InputPrimitive.Icon ref={ref} className={computedClassName} style={style} {...props}>
137
- {children}
138
- </InputPrimitive.Icon>
139
- );
140
- },
141
- );
129
+ return <Icon as={as} className={computedClassName} style={style} {...props} />;
130
+ };
142
131
 
143
132
  InputIcon.displayName = 'Input.Icon';
144
133
 
@@ -1,83 +1,88 @@
1
1
  import { cva, type VariantProps } from 'class-variance-authority';
2
+ import {
3
+ COLOR_BG_PRIMARY,
4
+ COLOR_BORDER_DEFAULT,
5
+ COLOR_TEXT_MUTED,
6
+ COLOR_TEXT_PRIMARY,
7
+ DISABLED_CURSOR,
8
+ DISABLED_OPACITY,
9
+ RADIUS_SM,
10
+ SHADOW_SM,
11
+ SIZE_SCALE,
12
+ TRANSITION_COLORS,
13
+ } from '../../styles/primitives';
2
14
 
3
15
  export const inputRootVariants = cva(
4
16
  [
5
- 'w-full flex-row items-center',
6
- 'border border-neutral-border-strong bg-neutral-surface shadow-sm',
7
- 'data-[disabled=true]:opacity-60 data-[disabled=true]:cursor-not-allowed data-[disabled=true]:bg-interactive-disabled-background data-[disabled=true]:border-interactive-disabled',
8
- 'data-[focus=true]:border-interactive-focus',
17
+ 'w-full flex-row items-stretch border',
18
+ COLOR_BG_PRIMARY,
19
+ COLOR_BORDER_DEFAULT,
20
+ RADIUS_SM,
21
+ SHADOW_SM,
22
+ TRANSITION_COLORS,
23
+ DISABLED_OPACITY,
24
+ DISABLED_CURSOR,
25
+ 'data-[disabled=true]:bg-slate-50 data-[disabled=true]:border-slate-300',
26
+ 'data-[readonly=true]:cursor-default',
27
+ 'data-[readonly=true]:bg-slate-50',
28
+ 'web:data-[hover=true]:data-[active=false]:border-slate-300',
29
+ 'data-[focus=true]:border-slate-900',
9
30
  'data-[invalid=true]:border-red-500',
10
31
  ],
11
32
  {
12
33
  variants: {
13
34
  variant: {
14
35
  outline: [
15
- 'rounded-md px-3',
16
- 'web:focus-within:border-interactive-focus web:focus-within:ring-3 web:focus-within:ring-blue-300/50',
17
- 'web:data-[invalid=true]:focus-within:border-red-500 web:data-[invalid=true]:focus-within:ring-red-300/50',
36
+ 'web:focus-within:border-slate-900 web:focus-within:ring-2 web:focus-within:ring-slate-400/50 web:focus-within:ring-offset-0',
37
+ 'web:data-[invalid=true]:focus-within:border-red-500 web:data-[invalid=true]:focus-within:ring-2 web:data-[invalid=true]:focus-within:ring-red-400/50',
18
38
  ],
19
- underlined:
20
- 'rounded-none border-t-0 border-l-0 border-r-0 border-b-neutral-border data-[focus=true]:border-b-interactive-focus shadow-none',
21
39
  },
22
40
  size: {
23
- sm: 'h-9 py-1',
24
- md: 'h-11 py-1.5',
25
- lg: 'h-12 py-2',
41
+ default: `${SIZE_SCALE.default.height} ${SIZE_SCALE.default.px} py-2 ${SIZE_SCALE.default.gap}`,
42
+ small: `${SIZE_SCALE.small.height} ${SIZE_SCALE.small.px} py-1.5 ${SIZE_SCALE.small.gap}`,
26
43
  },
27
44
  },
28
45
  defaultVariants: {
29
46
  variant: 'outline',
30
- size: 'md',
47
+ size: 'default',
31
48
  },
32
49
  },
33
50
  );
34
51
 
35
52
  export const inputFieldVariants = cva(
36
53
  [
37
- 'flex-1 bg-transparent text-neutral-text-primary',
38
- 'placeholder:text-neutral-placeholder',
54
+ 'flex-1 justify-center bg-transparent',
55
+ COLOR_TEXT_PRIMARY,
56
+ 'placeholder:text-slate-400',
39
57
  'web:outline-none',
40
58
  ],
41
59
  {
42
60
  variants: {
43
61
  size: {
44
- sm: 'text-sm leading-none',
45
- md: 'text-base leading-none',
46
- lg: 'text-lg leading-none',
62
+ default: 'text-[1rem]',
63
+ small: 'text-[0.875rem]',
47
64
  },
48
65
  },
49
66
  defaultVariants: {
50
- size: 'sm',
67
+ size: 'default',
51
68
  },
52
69
  },
53
70
  );
54
71
 
55
- export const inputSlotVariants = cva(['items-center justify-center'], {
56
- variants: {
57
- size: {
58
- sm: 'h-4 w-4',
59
- md: 'h-5 w-5',
60
- lg: 'h-6 w-6',
61
- },
62
- },
63
- defaultVariants: {
64
- size: 'sm',
65
- },
66
- });
72
+ export const inputSlotVariants = cva(['items-center justify-center self-center']);
67
73
 
68
- export const inputIconVariants = cva(['text-neutral-text-tertiary'], {
74
+ export const inputIconVariants = cva([COLOR_TEXT_MUTED], {
69
75
  variants: {
70
76
  size: {
71
- sm: 'h-4 w-4',
72
- md: 'h-5 w-5',
73
- lg: 'h-5 w-5',
77
+ default: 'size-5',
78
+ small: 'size-4',
74
79
  },
75
80
  },
76
81
  defaultVariants: {
77
- size: 'sm',
82
+ size: 'default',
78
83
  },
79
84
  });
80
85
 
81
- export const inputFieldPlaceholderVariants = cva(['accent-neutral-placeholder']);
86
+ export const inputFieldPlaceholderVariants = cva(['accent-slate-400']);
82
87
 
83
88
  export type InputVariantProps = VariantProps<typeof inputRootVariants>;
@@ -0,0 +1,83 @@
1
+ import { forwardRef, type ReactNode } from 'react';
2
+ import { Pressable, Text as RNText, type TextProps, type View } from 'react-native';
3
+ import { createLink, type ILinkProps } from '@cdx-ui/primitives';
4
+ import { cn } from '@cdx-ui/utils';
5
+ import { Icon, type IconProps } from '../Icon';
6
+ import { linkRootVariants, linkLabelVariants, linkIconVariants } from './styles';
7
+
8
+ export { LinkProvider, type LinkConfig, type LinkAction } from '@cdx-ui/primitives';
9
+
10
+ const LinkPrimitive = createLink({
11
+ Root: Pressable,
12
+ });
13
+
14
+ // =============================================================================
15
+ // STYLED ROOT COMPONENT
16
+ // =============================================================================
17
+
18
+ export interface LinkProps extends ILinkProps {
19
+ className?: string;
20
+ }
21
+
22
+ const LinkRoot = forwardRef<View, LinkProps>(({ className, children, style, ...props }, ref) => {
23
+ const rootClassName = cn(linkRootVariants(), className);
24
+
25
+ return (
26
+ <LinkPrimitive ref={ref} className={rootClassName} style={style} {...props}>
27
+ {children}
28
+ </LinkPrimitive>
29
+ );
30
+ });
31
+
32
+ LinkRoot.displayName = 'Link';
33
+
34
+ // =============================================================================
35
+ // STYLED LABEL COMPONENT
36
+ // =============================================================================
37
+
38
+ export interface LinkLabelProps extends TextProps {
39
+ className?: string;
40
+ children?: ReactNode;
41
+ }
42
+
43
+ const LinkLabel = forwardRef<RNText, LinkLabelProps>(
44
+ ({ className, children, style, ...props }, ref) => {
45
+ const computedClassName = cn(linkLabelVariants(), className);
46
+
47
+ return (
48
+ <RNText ref={ref} className={computedClassName} style={style} {...props}>
49
+ {children}
50
+ </RNText>
51
+ );
52
+ },
53
+ );
54
+
55
+ LinkLabel.displayName = 'Link.Label';
56
+
57
+ // =============================================================================
58
+ // STYLED ICON COMPONENT
59
+ // =============================================================================
60
+
61
+ export interface LinkIconProps extends Omit<IconProps, 'children'> {}
62
+
63
+ const LinkIcon = ({ className, style, as, ...props }: LinkIconProps) => {
64
+ const computedClassName = cn(linkIconVariants(), className);
65
+
66
+ return <Icon as={as} className={computedClassName} style={style} {...props} />;
67
+ };
68
+
69
+ LinkIcon.displayName = 'Link.Icon';
70
+
71
+ // =============================================================================
72
+ // COMPOUND COMPONENT EXPORT
73
+ // =============================================================================
74
+
75
+ type LinkCompoundComponent = typeof LinkRoot & {
76
+ Label: typeof LinkLabel;
77
+ Icon: typeof LinkIcon;
78
+ };
79
+
80
+ export const Link = Object.assign(LinkRoot, {
81
+ Label: LinkLabel,
82
+ Icon: LinkIcon,
83
+ }) as LinkCompoundComponent;
@@ -0,0 +1,20 @@
1
+ import { Platform } from 'react-native';
2
+ import { cva } from 'class-variance-authority';
3
+ import { TRANSITION_COLORS } from '../../styles/primitives';
4
+
5
+ export const linkRootVariants = cva([
6
+ 'flex-row items-center gap-1',
7
+ 'web:outline-none web:focus:outline-none web:focus-visible:outline-none',
8
+ 'text-blue-600',
9
+ 'underline decoration-slate-300 underline-offset-4',
10
+ TRANSITION_COLORS,
11
+ Platform.select({
12
+ web: 'data-[hover=true]:decoration-slate-900',
13
+ default: '',
14
+ }),
15
+ 'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-slate-400/50 web:data-[focus-visible=true]:ring-offset-2',
16
+ ]);
17
+
18
+ export const linkLabelVariants = cva(['text-sm font-medium', 'text-blue-600']);
19
+
20
+ export const linkIconVariants = cva(['size-4', 'text-blue-600']);
@@ -1,5 +1,6 @@
1
1
  import { forwardRef, type ReactNode } from 'react';
2
2
  import { Pressable, Text, type TextProps, View, type ViewProps } from 'react-native';
3
+ import { ArrowDropDown } from '@cdx-ui/icons';
3
4
  import {
4
5
  createSelect,
5
6
  type ISelectContentProps,
@@ -10,6 +11,7 @@ import {
10
11
  type ISelectValueProps,
11
12
  } from '@cdx-ui/primitives';
12
13
  import { cn, useStyleContext, withStyleContext } from '@cdx-ui/utils';
14
+ import { Icon, IconProps } from '../Icon';
13
15
  import {
14
16
  type SelectVariantProps,
15
17
  selectContentVariants,
@@ -45,7 +47,7 @@ export interface SelectProps extends ViewProps, ISelectProps, SelectVariantProps
45
47
  }
46
48
 
47
49
  const SelectRoot = forwardRef<View, SelectProps>(
48
- ({ variant = 'outline', size = 'md', className, children, style, ...props }, ref) => {
50
+ ({ variant = 'outline', size = 'default', className, children, style, ...props }, ref) => {
49
51
  return (
50
52
  <SelectPrimitive
51
53
  ref={ref}
@@ -80,6 +82,7 @@ const SelectTrigger = forwardRef<View, SelectTriggerProps>(
80
82
  return (
81
83
  <SelectPrimitive.Trigger ref={ref} className={computedClassName} style={style} {...props}>
82
84
  {children}
85
+ <SelectIcon as={ArrowDropDown} />
83
86
  </SelectPrimitive.Trigger>
84
87
  );
85
88
  },
@@ -96,9 +99,9 @@ export interface SelectValueProps extends TextProps, ISelectValueProps {
96
99
  }
97
100
 
98
101
  const SelectValue = forwardRef<Text, SelectValueProps>(({ className, style, ...props }, ref) => {
99
- const { variant, size } = useSelectStyleContext();
102
+ const { size } = useSelectStyleContext();
100
103
 
101
- const computedClassName = cn(selectValueVariants({ variant, size }), className);
104
+ const computedClassName = cn(selectValueVariants({ size }), className);
102
105
 
103
106
  return <SelectPrimitive.Value ref={ref} className={computedClassName} style={style} {...props} />;
104
107
  });
@@ -109,17 +112,15 @@ SelectValue.displayName = 'Select.Value';
109
112
  // STYLED ICON COMPONENT
110
113
  // =============================================================================
111
114
 
112
- export interface SelectIconProps extends ViewProps {
113
- className?: string;
114
- }
115
+ export interface SelectIconProps extends Omit<IconProps, 'children'> {}
115
116
 
116
- const SelectIcon = forwardRef<View, SelectIconProps>(({ className, style, ...props }, ref) => {
117
- const { variant, size } = useSelectStyleContext();
117
+ const SelectIcon = ({ className, style, ...props }: SelectIconProps) => {
118
+ const { size } = useSelectStyleContext();
118
119
 
119
- const computedClassName = cn(selectIconVariants({ variant, size }), className);
120
+ const computedClassName = cn(selectIconVariants({ size }), className);
120
121
 
121
- return <SelectPrimitive.Icon ref={ref} className={computedClassName} style={style} {...props} />;
122
- });
122
+ return <Icon className={computedClassName} style={style} {...props} />;
123
+ };
123
124
 
124
125
  SelectIcon.displayName = 'Select.Icon';
125
126
 
@@ -1,58 +1,58 @@
1
1
  import { Platform } from 'react-native';
2
2
  import { cva, type VariantProps } from 'class-variance-authority';
3
+ import {
4
+ COLOR_BG_PRIMARY,
5
+ COLOR_BORDER_DEFAULT,
6
+ COLOR_TEXT_MUTED,
7
+ COLOR_TEXT_PRIMARY,
8
+ DISABLED_CURSOR,
9
+ DISABLED_OPACITY,
10
+ RADIUS_SM,
11
+ RADIUS_MD,
12
+ SHADOW_SM,
13
+ SHADOW_MD,
14
+ SIZE_SCALE,
15
+ TRANSITION_COLORS,
16
+ } from '../../styles/primitives';
3
17
 
4
18
  // ── Trigger ─────────────────────────────────────────────────
5
19
 
6
20
  export const selectTriggerVariants = cva(
7
21
  [
8
22
  'flex-row items-center justify-between',
9
- 'rounded-lg',
10
- 'transition-colors duration-150',
11
- 'data-[disabled=true]:opacity-60 data-[disabled=true]:cursor-not-allowed data-[disabled=true]:pointer-events-none',
23
+ RADIUS_SM,
24
+ SHADOW_SM,
25
+ TRANSITION_COLORS,
26
+ COLOR_BG_PRIMARY,
27
+ `border ${COLOR_BORDER_DEFAULT}`,
28
+ DISABLED_OPACITY,
29
+ DISABLED_CURSOR,
12
30
  'data-[readonly=true]:cursor-default',
13
- 'data-[focus-visible=true]:ring-2 data-[focus-visible=true]:ring-blue-500 data-[focus-visible=true]:ring-offset-2',
31
+ 'data-[state=open]:border-slate-900',
32
+ 'data-[invalid=true]:border-red-500',
33
+ 'data-[readonly=true]:bg-slate-50',
34
+ Platform.select({
35
+ default: 'data-[active=true]:border-slate-300',
36
+ web: [
37
+ 'data-[hover=true]:border-slate-300 data-[active=true]:data-[hover=true]:border-slate-400',
38
+ 'data-[focus-visible=true]:ring-2 data-[focus-visible=true]:ring-slate-400/50 data-[focus-visible=true]:ring-offset-2',
39
+ 'data-[state=open]:ring-2 data-[state=open]:ring-slate-400/50',
40
+ ].join(' '),
41
+ }),
14
42
  ],
15
43
  {
16
44
  variants: {
17
45
  variant: {
18
- outline: [
19
- 'bg-white border border-gray-300',
20
- Platform.select({
21
- default: 'data-[active=true]:border-gray-400',
22
- web: 'data-[hover=true]:border-gray-400 data-[active=true]:data-[hover=true]:border-gray-500',
23
- }),
24
- 'data-[state=open]:data-[invalid=false]:border-blue-500',
25
- 'data-[invalid=true]:border-red-500',
26
- 'data-[readonly=true]:bg-gray-50',
27
- ],
28
- filled: [
29
- 'bg-gray-100 border border-transparent',
30
- Platform.select({
31
- default: 'data-[active=true]:bg-gray-200',
32
- web: 'data-[hover=true]:bg-gray-200 data-[active=true]:data-[hover=true]:bg-gray-300',
33
- }),
34
- 'data-[state=open]:border-blue-500',
35
- 'data-[invalid=true]:border-red-500 data-[invalid=true]:border',
36
- 'data-[readonly=true]:bg-gray-200',
37
- ],
38
- ghost: [
39
- 'bg-transparent border border-transparent',
40
- Platform.select({
41
- default: 'data-[active=true]:bg-gray-100',
42
- web: 'data-[hover=true]:bg-gray-50 data-[active=true]:data-[hover=true]:bg-gray-100',
43
- }),
44
- 'data-[invalid=true]:border-red-500 data-[invalid=true]:border',
45
- ],
46
+ outline: [],
46
47
  },
47
48
  size: {
48
- sm: 'h-8 px-2.5 gap-1.5',
49
- md: 'h-10 px-3 gap-2',
50
- lg: 'h-12 px-4 gap-2.5',
49
+ default: `${SIZE_SCALE.default.height} ${SIZE_SCALE.default.px} ${SIZE_SCALE.default.gap}`,
50
+ small: `${SIZE_SCALE.small.height} ${SIZE_SCALE.small.px} ${SIZE_SCALE.small.gap}`,
51
51
  },
52
52
  },
53
53
  defaultVariants: {
54
54
  variant: 'outline',
55
- size: 'md',
55
+ size: 'default',
56
56
  },
57
57
  },
58
58
  );
@@ -60,23 +60,21 @@ export const selectTriggerVariants = cva(
60
60
  // ── Value ───────────────────────────────────────────────────
61
61
 
62
62
  export const selectValueVariants = cva(
63
- ['flex-1', 'data-[placeholder=true]:text-gray-400', 'data-[invalid=true]:text-red-600'],
63
+ [
64
+ 'flex-1',
65
+ 'data-[placeholder=true]:text-slate-400',
66
+ 'data-[invalid=true]:text-red-600',
67
+ COLOR_TEXT_PRIMARY,
68
+ ],
64
69
  {
65
70
  variants: {
66
- variant: {
67
- outline: 'text-gray-900',
68
- filled: 'text-gray-900',
69
- ghost: 'text-gray-900',
70
- },
71
71
  size: {
72
- sm: 'text-sm',
73
- md: 'text-base',
74
- lg: 'text-lg',
72
+ default: SIZE_SCALE.default.text,
73
+ small: SIZE_SCALE.small.text,
75
74
  },
76
75
  },
77
76
  defaultVariants: {
78
- variant: 'outline',
79
- size: 'md',
77
+ size: 'default',
80
78
  },
81
79
  },
82
80
  );
@@ -84,23 +82,16 @@ export const selectValueVariants = cva(
84
82
  // ── Icon ────────────────────────────────────────────────────
85
83
 
86
84
  export const selectIconVariants = cva(
87
- ['items-center justify-center', 'data-[invalid=true]:text-red-500'],
85
+ ['items-center justify-center', COLOR_TEXT_MUTED, 'data-[invalid=true]:text-red-500'],
88
86
  {
89
87
  variants: {
90
- variant: {
91
- outline: 'text-gray-500',
92
- filled: 'text-gray-500',
93
- ghost: 'text-gray-400',
94
- },
95
88
  size: {
96
- sm: 'h-4 w-4',
97
- md: 'h-5 w-5',
98
- lg: 'h-6 w-6',
89
+ default: 'h-5 w-5',
90
+ small: 'h-4 w-4',
99
91
  },
100
92
  },
101
93
  defaultVariants: {
102
- variant: 'outline',
103
- size: 'md',
94
+ size: 'default',
104
95
  },
105
96
  },
106
97
  );
@@ -108,12 +99,12 @@ export const selectIconVariants = cva(
108
99
  // ── Content ─────────────────────────────────────────────────
109
100
 
110
101
  export const selectContentVariants = cva([
111
- 'bg-white',
112
- 'border border-gray-200',
102
+ COLOR_BG_PRIMARY,
103
+ `border ${COLOR_BORDER_DEFAULT}`,
113
104
  'overflow-hidden',
114
- 'rounded-lg',
105
+ RADIUS_MD,
115
106
  Platform.select({
116
- web: 'shadow-lg',
107
+ web: SHADOW_MD,
117
108
  default: '',
118
109
  }),
119
110
  'max-h-60',
@@ -127,22 +118,21 @@ export const selectItemVariants = cva(
127
118
  'flex-row items-center',
128
119
  'transition-colors duration-100',
129
120
  'data-[disabled=true]:opacity-50 data-[disabled=true]:pointer-events-none',
130
- 'data-[state=checked]:bg-blue-50',
121
+ 'data-[state=checked]:bg-slate-50 data-[state=checked]:font-medium',
131
122
  Platform.select({
132
- default: 'data-[active=true]:bg-gray-100',
133
- web: 'data-[hover=true]:bg-gray-100 data-[active=true]:data-[hover=true]:bg-gray-200 data-[highlighted=true]:bg-blue-50',
123
+ default: 'data-[active=true]:bg-slate-100',
124
+ web: 'data-[hover=true]:bg-slate-50 data-[active=true]:data-[hover=true]:bg-slate-100 data-[highlighted=true]:bg-slate-50',
134
125
  }),
135
126
  ],
136
127
  {
137
128
  variants: {
138
129
  size: {
139
- sm: 'px-2.5 py-1.5',
140
- md: 'px-3 py-2',
141
- lg: 'px-4 py-2.5',
130
+ default: 'px-3 py-2',
131
+ small: 'px-2.5 py-1.5',
142
132
  },
143
133
  },
144
134
  defaultVariants: {
145
- size: 'md',
135
+ size: 'default',
146
136
  },
147
137
  },
148
138
  );
@@ -150,17 +140,16 @@ export const selectItemVariants = cva(
150
140
  // ── ItemLabel ───────────────────────────────────────────────
151
141
 
152
142
  export const selectItemLabelVariants = cva(
153
- ['text-gray-900', 'data-[state=checked]:font-semibold', 'data-[state=checked]:text-blue-700'],
143
+ [COLOR_TEXT_PRIMARY, 'data-[state=checked]:font-medium'],
154
144
  {
155
145
  variants: {
156
146
  size: {
157
- sm: 'text-sm',
158
- md: 'text-base',
159
- lg: 'text-lg',
147
+ default: SIZE_SCALE.default.text,
148
+ small: SIZE_SCALE.small.text,
160
149
  },
161
150
  },
162
151
  defaultVariants: {
163
- size: 'md',
152
+ size: 'default',
164
153
  },
165
154
  },
166
155
  );