@cdx-ui/components 0.0.1-beta.117 → 0.0.1-beta.118

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 (88) hide show
  1. package/lib/commonjs/components/AlertDialog/index.js +1 -2
  2. package/lib/commonjs/components/AlertDialog/index.js.map +1 -1
  3. package/lib/commonjs/components/Chip/index.js +22 -2
  4. package/lib/commonjs/components/Chip/index.js.map +1 -1
  5. package/lib/commonjs/components/Chip/styles.js +49 -49
  6. package/lib/commonjs/components/Chip/styles.js.map +1 -1
  7. package/lib/commonjs/components/Dialog/index.js +25 -6
  8. package/lib/commonjs/components/Dialog/index.js.map +1 -1
  9. package/lib/commonjs/components/Dialog/styles.js +6 -6
  10. package/lib/commonjs/components/Dialog/styles.js.map +1 -1
  11. package/lib/commonjs/components/IconButton/index.js +11 -1
  12. package/lib/commonjs/components/IconButton/index.js.map +1 -1
  13. package/lib/commonjs/components/IconButton/styles.js +22 -22
  14. package/lib/commonjs/components/IconButton/styles.js.map +1 -1
  15. package/lib/commonjs/components/Toast/hooks.js +1 -0
  16. package/lib/commonjs/components/Toast/hooks.js.map +1 -1
  17. package/lib/commonjs/components/Toast/index.js +17 -2
  18. package/lib/commonjs/components/Toast/index.js.map +1 -1
  19. package/lib/commonjs/components/Toast/styles.js +8 -8
  20. package/lib/commonjs/components/Toast/styles.js.map +1 -1
  21. package/lib/commonjs/figma/AlertDialog.Title.figma.js +3 -3
  22. package/lib/commonjs/figma/AlertDialog.Title.figma.js.map +1 -1
  23. package/lib/commonjs/figma/Chip.figma.js +2 -2
  24. package/lib/commonjs/figma/Chip.figma.js.map +1 -1
  25. package/lib/commonjs/figma/Dialog.Title.figma.js +3 -3
  26. package/lib/commonjs/figma/Dialog.Title.figma.js.map +1 -1
  27. package/lib/commonjs/figma/IconButton.figma.js +1 -1
  28. package/lib/commonjs/figma/IconButton.figma.js.map +1 -1
  29. package/lib/commonjs/providers/toast/provider.js +1 -1
  30. package/lib/module/components/AlertDialog/index.js +1 -1
  31. package/lib/module/components/AlertDialog/index.js.map +1 -1
  32. package/lib/module/components/Chip/index.js +23 -3
  33. package/lib/module/components/Chip/index.js.map +1 -1
  34. package/lib/module/components/Chip/styles.js +49 -49
  35. package/lib/module/components/Chip/styles.js.map +1 -1
  36. package/lib/module/components/Dialog/index.js +25 -6
  37. package/lib/module/components/Dialog/index.js.map +1 -1
  38. package/lib/module/components/Dialog/styles.js +6 -6
  39. package/lib/module/components/Dialog/styles.js.map +1 -1
  40. package/lib/module/components/IconButton/index.js +12 -2
  41. package/lib/module/components/IconButton/index.js.map +1 -1
  42. package/lib/module/components/IconButton/styles.js +22 -22
  43. package/lib/module/components/IconButton/styles.js.map +1 -1
  44. package/lib/module/components/Toast/hooks.js +1 -0
  45. package/lib/module/components/Toast/hooks.js.map +1 -1
  46. package/lib/module/components/Toast/index.js +17 -2
  47. package/lib/module/components/Toast/index.js.map +1 -1
  48. package/lib/module/components/Toast/styles.js +8 -8
  49. package/lib/module/components/Toast/styles.js.map +1 -1
  50. package/lib/module/figma/AlertDialog.Title.figma.js +3 -3
  51. package/lib/module/figma/AlertDialog.Title.figma.js.map +1 -1
  52. package/lib/module/figma/Chip.figma.js +2 -2
  53. package/lib/module/figma/Chip.figma.js.map +1 -1
  54. package/lib/module/figma/Dialog.Title.figma.js +3 -3
  55. package/lib/module/figma/Dialog.Title.figma.js.map +1 -1
  56. package/lib/module/figma/IconButton.figma.js +1 -1
  57. package/lib/module/figma/IconButton.figma.js.map +1 -1
  58. package/lib/module/providers/toast/provider.js +1 -1
  59. package/lib/typescript/components/AlertDialog/index.d.ts +4 -5
  60. package/lib/typescript/components/AlertDialog/index.d.ts.map +1 -1
  61. package/lib/typescript/components/Chip/index.d.ts +21 -1
  62. package/lib/typescript/components/Chip/index.d.ts.map +1 -1
  63. package/lib/typescript/components/Chip/styles.d.ts +5 -5
  64. package/lib/typescript/components/Dialog/index.d.ts +15 -1
  65. package/lib/typescript/components/Dialog/index.d.ts.map +1 -1
  66. package/lib/typescript/components/Dialog/styles.d.ts +2 -2
  67. package/lib/typescript/components/IconButton/index.d.ts +11 -1
  68. package/lib/typescript/components/IconButton/index.d.ts.map +1 -1
  69. package/lib/typescript/components/IconButton/styles.d.ts +2 -2
  70. package/lib/typescript/components/Toast/hooks.d.ts +2 -2
  71. package/lib/typescript/components/Toast/hooks.d.ts.map +1 -1
  72. package/lib/typescript/components/Toast/index.d.ts.map +1 -1
  73. package/lib/typescript/components/Toast/styles.d.ts +4 -4
  74. package/lib/typescript/components/Toast/types.d.ts +11 -6
  75. package/lib/typescript/components/Toast/types.d.ts.map +1 -1
  76. package/package.json +4 -4
  77. package/src/components/AlertDialog/index.tsx +1 -1
  78. package/src/components/Chip/index.tsx +61 -3
  79. package/src/components/Chip/styles.ts +49 -49
  80. package/src/components/Dialog/index.tsx +50 -8
  81. package/src/components/Dialog/styles.ts +6 -6
  82. package/src/components/IconButton/index.tsx +30 -3
  83. package/src/components/IconButton/styles.ts +22 -22
  84. package/src/components/Toast/hooks.ts +3 -2
  85. package/src/components/Toast/index.tsx +33 -2
  86. package/src/components/Toast/styles.ts +8 -8
  87. package/src/components/Toast/types.ts +12 -6
  88. package/src/providers/toast/provider.tsx +1 -1
@@ -16,7 +16,7 @@ export const iconButtonRootVariants = cva(
16
16
  variants: {
17
17
  variant: {
18
18
  solid: [],
19
- tint: [],
19
+ subtle: [],
20
20
  ghost: ['bg-transparent'],
21
21
  },
22
22
  color: {
@@ -65,37 +65,37 @@ export const iconButtonRootVariants = cva(
65
65
  ],
66
66
  },
67
67
 
68
- // ── tint × color ─────────────────────────────────────────────────
68
+ // ── subtle × color ─────────────────────────────────────────────────
69
69
  {
70
- variant: 'tint',
70
+ variant: 'subtle',
71
71
  color: 'neutral',
72
72
  className: [
73
- 'bg-surface-neutral-tint',
73
+ 'bg-surface-neutral-subtle',
74
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',
75
+ default: 'data-[active=true]:bg-surface-neutral-subtle-active',
76
+ web: 'data-[hover=true]:bg-surface-neutral-subtle-hover data-[active=true]:data-[hover=true]:bg-surface-neutral-subtle-active',
77
77
  }),
78
78
  ],
79
79
  },
80
80
  {
81
- variant: 'tint',
81
+ variant: 'subtle',
82
82
  color: 'action',
83
83
  className: [
84
- 'bg-surface-action-tint',
84
+ 'bg-surface-action-subtle',
85
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',
86
+ default: 'data-[active=true]:bg-surface-action-subtle-active',
87
+ web: 'data-[hover=true]:bg-surface-action-subtle-hover data-[active=true]:data-[hover=true]:bg-surface-action-subtle-active',
88
88
  }),
89
89
  ],
90
90
  },
91
91
  {
92
- variant: 'tint',
92
+ variant: 'subtle',
93
93
  color: 'danger',
94
94
  className: [
95
- 'bg-surface-danger-tint',
95
+ 'bg-surface-danger-subtle',
96
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',
97
+ default: 'data-[active=true]:bg-surface-danger-subtle-active',
98
+ web: 'data-[hover=true]:bg-surface-danger-subtle-hover data-[active=true]:data-[hover=true]:bg-surface-danger-subtle-active',
99
99
  }),
100
100
  ],
101
101
  },
@@ -116,8 +116,8 @@ export const iconButtonRootVariants = cva(
116
116
  color: 'action',
117
117
  className: [
118
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',
119
+ default: 'data-[active=true]:bg-surface-action-subtle-active',
120
+ web: 'data-[hover=true]:bg-surface-action-subtle-hover data-[active=true]:data-[hover=true]:bg-surface-action-subtle-active',
121
121
  }),
122
122
  ],
123
123
  },
@@ -126,8 +126,8 @@ export const iconButtonRootVariants = cva(
126
126
  color: 'danger',
127
127
  className: [
128
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',
129
+ default: 'data-[active=true]:bg-surface-danger-subtle-active',
130
+ web: 'data-[hover=true]:bg-surface-danger-subtle-hover data-[active=true]:data-[hover=true]:bg-surface-danger-subtle-active',
131
131
  }),
132
132
  ],
133
133
  },
@@ -156,7 +156,7 @@ export const iconButtonIconColorVariants = cva([], {
156
156
  variants: {
157
157
  variant: {
158
158
  solid: [],
159
- tint: [],
159
+ subtle: [],
160
160
  ghost: [],
161
161
  },
162
162
  color: {
@@ -169,9 +169,9 @@ export const iconButtonIconColorVariants = cva([], {
169
169
  { variant: 'solid', color: 'neutral', className: 'text-content-primary' },
170
170
  { variant: 'solid', color: 'action', className: 'text-content-action-on-strong' },
171
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' },
172
+ { variant: 'subtle', color: 'neutral', className: 'text-content-primary' },
173
+ { variant: 'subtle', color: 'action', className: 'text-content-action-on-subtle' },
174
+ { variant: 'subtle', color: 'danger', className: 'text-content-danger-on-subtle' },
175
175
  { variant: 'ghost', color: 'neutral', className: 'text-content-primary' },
176
176
  { variant: 'ghost', color: 'action', className: 'text-content-action' },
177
177
  { variant: 'ghost', color: 'danger', className: 'text-content-danger' },
@@ -3,14 +3,14 @@ import type { StyleProp, ViewStyle } from 'react-native';
3
3
  import { StyleSheet } from 'react-native';
4
4
  import { useResolveClassNames } from 'uniwind';
5
5
  import type { ButtonProps } from '../Button';
6
- import { ToastColor } from './types';
6
+ import { ToastColorInternal } from './types';
7
7
 
8
8
  export function useButtonColor({
9
9
  color,
10
10
  toastColor,
11
11
  }: {
12
12
  color: ButtonProps['color'];
13
- toastColor: ToastColor;
13
+ toastColor: ToastColorInternal;
14
14
  }) {
15
15
  // TODO: Add toastActionVariants to styles.ts to restore color-aware action styling
16
16
  return useMemo(() => {
@@ -25,6 +25,7 @@ export function useButtonColor({
25
25
  return 'warning';
26
26
  case 'danger':
27
27
  return 'danger';
28
+ case 'neutral':
28
29
  default:
29
30
  return 'action';
30
31
  }
@@ -33,6 +33,7 @@ import type {
33
33
  DefaultToastProps,
34
34
  ToastActionProps,
35
35
  ToastCloseProps,
36
+ ToastColorInternal,
36
37
  ToastContextValue,
37
38
  ToastDescriptionProps,
38
39
  ToastIconProps,
@@ -48,6 +49,8 @@ const AnimatedToastRoot = Animated.createAnimatedComponent(ToastRootPrimitive);
48
49
 
49
50
  const IS_WEB = Platform.OS === 'web';
50
51
 
52
+ let hasWarnedToastDefaultColor = false;
53
+
51
54
  /**
52
55
  * Fallback timeout for web exit transitions. Covers cases where
53
56
  * `transitionend` never fires — `prefers-reduced-motion: reduce`
@@ -84,11 +87,25 @@ const ToastRoot = forwardRef<View, ToastProps>((props, ref) => {
84
87
  /**
85
88
  * Merge global config with local props, ensuring local props take precedence
86
89
  */
87
- const color = localColor ?? globalConfig?.color ?? 'default';
90
+ const resolvedColor = localColor ?? globalConfig?.color ?? 'neutral';
88
91
  const placement = localPlacement ?? globalConfig?.placement ?? 'bottom';
89
92
  const animation = localAnimation ?? globalConfig?.animation;
90
93
  const isSwipeable = localIsSwipeable ?? globalConfig?.isSwipeable;
91
94
 
95
+ useEffect(() => {
96
+ if (__DEV__ && resolvedColor === ('default' as string) && !hasWarnedToastDefaultColor) {
97
+ hasWarnedToastDefaultColor = true;
98
+ console.warn(
99
+ '[Toast] The `default` color is deprecated and will be removed in a future major release. Use `neutral` instead.',
100
+ );
101
+ }
102
+ }, [resolvedColor]);
103
+
104
+ const color: NonNullable<ToastColorInternal> =
105
+ (resolvedColor as string) === 'default'
106
+ ? 'neutral'
107
+ : (resolvedColor as NonNullable<ToastColorInternal>);
108
+
92
109
  // Access id from props (id is omitted from ToastProps type but available at runtime)
93
110
  const toastProps = props as ToastProps & Pick<ToastComponentProps, 'id'>;
94
111
  const { id } = toastProps;
@@ -445,11 +462,25 @@ export function DefaultToast(props: DefaultToastProps) {
445
462
  /**
446
463
  * Merge global config with local props, ensuring local props take precedence
447
464
  */
448
- const color = localColor ?? globalConfig?.color ?? 'default';
465
+ const rawDefaultColor = localColor ?? globalConfig?.color ?? 'neutral';
449
466
  const placement = localPlacement ?? globalConfig?.placement ?? 'bottom';
450
467
  const isSwipeable = localIsSwipeable ?? globalConfig?.isSwipeable;
451
468
  const animation = localAnimation ?? globalConfig?.animation;
452
469
 
470
+ useEffect(() => {
471
+ if (__DEV__ && rawDefaultColor === ('default' as string) && !hasWarnedToastDefaultColor) {
472
+ hasWarnedToastDefaultColor = true;
473
+ console.warn(
474
+ '[Toast] The `default` color is deprecated and will be removed in a future major release. Use `neutral` instead.',
475
+ );
476
+ }
477
+ }, [rawDefaultColor]);
478
+
479
+ const color: NonNullable<ToastColorInternal> =
480
+ (rawDefaultColor as string) === 'default'
481
+ ? 'neutral'
482
+ : (rawDefaultColor as NonNullable<ToastColorInternal>);
483
+
453
484
  const handleActionPress = () => {
454
485
  if (onActionPress) {
455
486
  onActionPress({ show, hide });
@@ -46,7 +46,7 @@ export const toastRootVariants = cva(
46
46
  {
47
47
  variants: {
48
48
  color: {
49
- default: '',
49
+ neutral: '',
50
50
  info: '',
51
51
  success: '',
52
52
  warning: '',
@@ -54,7 +54,7 @@ export const toastRootVariants = cva(
54
54
  },
55
55
  },
56
56
  defaultVariants: {
57
- color: 'default',
57
+ color: 'neutral',
58
58
  },
59
59
  },
60
60
  );
@@ -135,7 +135,7 @@ export const toastWrapperVariants = cva(
135
135
  export const toastLabelVariants = cva(['text-base font-sans-medium'], {
136
136
  variants: {
137
137
  color: {
138
- default: 'text-content-primary',
138
+ neutral: 'text-content-primary',
139
139
  info: 'text-content-info',
140
140
  success: 'text-content-success',
141
141
  warning: 'text-content-warning',
@@ -143,14 +143,14 @@ export const toastLabelVariants = cva(['text-base font-sans-medium'], {
143
143
  },
144
144
  },
145
145
  defaultVariants: {
146
- color: 'default',
146
+ color: 'neutral',
147
147
  },
148
148
  });
149
149
 
150
150
  export const toastDescriptionVariants = cva(['text-sm text-content-primary'], {
151
151
  variants: {
152
152
  color: {
153
- default: 'text-content-primary',
153
+ neutral: 'text-content-primary',
154
154
  info: 'text-content-info',
155
155
  success: 'text-content-success',
156
156
  warning: 'text-content-warning',
@@ -158,14 +158,14 @@ export const toastDescriptionVariants = cva(['text-sm text-content-primary'], {
158
158
  },
159
159
  },
160
160
  defaultVariants: {
161
- color: 'default',
161
+ color: 'neutral',
162
162
  },
163
163
  });
164
164
 
165
165
  export const toastIconVariants = cva(['size-5'], {
166
166
  variants: {
167
167
  color: {
168
- default: 'text-content-primary',
168
+ neutral: 'text-content-primary',
169
169
  info: 'text-content-info',
170
170
  success: 'text-content-success',
171
171
  warning: 'text-content-warning',
@@ -173,7 +173,7 @@ export const toastIconVariants = cva(['size-5'], {
173
173
  },
174
174
  },
175
175
  defaultVariants: {
176
- color: 'default',
176
+ color: 'neutral',
177
177
  },
178
178
  });
179
179
 
@@ -10,9 +10,15 @@ import type { IconProps } from '../Icon';
10
10
  import { ToastColorProps } from './styles';
11
11
 
12
12
  /**
13
- * Toast color types
13
+ * Internal (normalized) toast color values used by CVA and context.
14
14
  */
15
- export type ToastColor = ToastColorProps['color'];
15
+ export type ToastColorInternal = ToastColorProps['color'];
16
+
17
+ /**
18
+ * Toast color types accepted by consumers.
19
+ * @remarks `'default'` is deprecated — use `'neutral'` instead.
20
+ */
21
+ export type ToastColor = ToastColorInternal | 'default';
16
22
 
17
23
  /**
18
24
  * Toast placement types.
@@ -120,7 +126,7 @@ export type ToastRootAnimation = AnimationRoot<{
120
126
  export interface ToastProps extends ToastRootProps, Omit<ToastComponentProps, 'id'> {
121
127
  /**
122
128
  * Color of the toast
123
- * @default 'default'
129
+ * @default 'neutral'
124
130
  */
125
131
  color?: ToastColor;
126
132
  /**
@@ -246,9 +252,9 @@ export type ToastCloseProps = Omit<IconButtonProps, 'as'> & {
246
252
  */
247
253
  export interface ToastContextValue {
248
254
  /**
249
- * Color of the toast
255
+ * Color of the toast (normalized — always uses the current value names)
250
256
  */
251
- color?: ToastColor;
257
+ color?: ToastColorInternal;
252
258
  /**
253
259
  * Function to hide the toast
254
260
  */
@@ -288,7 +294,7 @@ export type UseToastRootAnimationOptions = Pick<
288
294
  export interface DefaultToastProps extends ToastComponentProps {
289
295
  /**
290
296
  * Color of the toast
291
- * @default 'default'
297
+ * @default 'neutral'
292
298
  */
293
299
  color?: ToastProps['color'];
294
300
  /**
@@ -68,7 +68,7 @@ function createStringToastComponent(
68
68
  ): (props: ToastComponentProps) => React.ReactElement {
69
69
  return (props: ToastComponentProps) => {
70
70
  const mergedConfig = mergeToastConfig(globalConfig, {
71
- color: 'default',
71
+ color: 'neutral',
72
72
  });
73
73
  return (
74
74
  <DefaultToast