@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
@@ -11,10 +11,12 @@ import {
11
11
  } from 'react-native';
12
12
  import { createButton, type IButtonProps } from '@cdx-ui/primitives';
13
13
  import { cn, useStyleContext, withStyleContext } from '@cdx-ui/utils';
14
+ import { Icon, IconProps } from '../Icon';
14
15
  import {
15
16
  type ButtonGroupVariantProps,
16
17
  type ButtonVariantProps,
17
18
  buttonGroupVariants,
19
+ buttonIconVariants,
18
20
  buttonRootVariants,
19
21
  buttonSpinnerVariants,
20
22
  buttonTextVariants,
@@ -46,9 +48,10 @@ export interface ButtonProps extends PressableProps, IButtonProps, ButtonVariant
46
48
  const ButtonRoot = forwardRef<View, ButtonProps>(
47
49
  (
48
50
  {
49
- variant = 'solid',
50
- color = 'primary',
51
- size = 'md',
51
+ variant = 'strong',
52
+ color = 'action',
53
+ size = 'default',
54
+ mode = 'light',
52
55
  fullWidth = false,
53
56
  className,
54
57
  children,
@@ -58,7 +61,7 @@ const ButtonRoot = forwardRef<View, ButtonProps>(
58
61
  ref,
59
62
  ) => {
60
63
  const computedClassName = cn(
61
- buttonRootVariants({ variant, color, size, fullWidth }),
64
+ buttonRootVariants({ variant, color, size, mode, fullWidth }),
62
65
  className,
63
66
  );
64
67
 
@@ -67,7 +70,7 @@ const ButtonRoot = forwardRef<View, ButtonProps>(
67
70
  ref={ref}
68
71
  className={computedClassName}
69
72
  style={style}
70
- context={{ variant, color, size, fullWidth }}
73
+ context={{ variant, color, size, mode, fullWidth }}
71
74
  {...props}
72
75
  >
73
76
  {children}
@@ -89,9 +92,9 @@ export interface ButtonTextProps extends TextProps {
89
92
 
90
93
  const ButtonLabel = forwardRef<Text, ButtonTextProps>(
91
94
  ({ className, children, style, ...props }, ref) => {
92
- const { variant, color, size } = useButtonStyleContext();
95
+ const { variant, color, size, mode } = useButtonStyleContext();
93
96
 
94
- const computedClassName = cn(buttonTextVariants({ variant, color, size }), className);
97
+ const computedClassName = cn(buttonTextVariants({ variant, color, size, mode }), className);
95
98
 
96
99
  return (
97
100
  <ButtonPrimitive.Text ref={ref} className={computedClassName} style={style} {...props}>
@@ -135,13 +138,15 @@ const ButtonGroup = forwardRef<View, ButtonGroupProps>(
135
138
 
136
139
  ButtonGroup.displayName = 'Button.Group';
137
140
 
138
- export interface ButtonIconProps extends ViewProps {
139
- className?: string;
140
- }
141
+ export interface ButtonIconProps extends Omit<IconProps, 'children'> {}
141
142
 
142
- const ButtonIcon = forwardRef<View, ButtonIconProps>(({ className, style, ...props }, ref) => {
143
- return <ButtonPrimitive.Icon ref={ref} className={className} style={style} {...props} />;
144
- });
143
+ const ButtonIcon = ({ className, style, as, ...props }: ButtonIconProps) => {
144
+ const { size } = useButtonStyleContext();
145
+
146
+ const computedClassName = cn(buttonIconVariants({ size }), className);
147
+
148
+ return <Icon as={as} className={computedClassName} style={style} {...props} />;
149
+ };
145
150
 
146
151
  ButtonIcon.displayName = 'Button.Icon';
147
152
 
@@ -152,8 +157,11 @@ export interface ButtonSpinnerProps extends ActivityIndicatorProps {
152
157
 
153
158
  const ButtonSpinner = forwardRef<ActivityIndicator, ButtonSpinnerProps>(
154
159
  ({ className, colorClassName, style, ...props }, ref) => {
155
- const { variant, color } = useButtonStyleContext();
156
- const computedColorClassName = cn(buttonSpinnerVariants({ variant, color }), colorClassName);
160
+ const { variant, color, mode } = useButtonStyleContext();
161
+ const computedColorClassName = cn(
162
+ buttonSpinnerVariants({ variant, color, mode }),
163
+ colorClassName,
164
+ );
157
165
 
158
166
  return (
159
167
  <ButtonPrimitive.Spinner