@cdx-ui/components 0.0.1-beta.11 → 0.0.1-beta.13
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.
- package/README.md +1 -1
- package/lib/commonjs/components/Checkbox/styles.js +1 -1
- package/lib/commonjs/components/Checkbox/styles.js.map +1 -1
- package/lib/commonjs/components/ListItem/styles.js +9 -9
- package/lib/commonjs/components/ListItem/styles.js.map +1 -1
- package/lib/commonjs/components/Tile/index.js +251 -0
- package/lib/commonjs/components/Tile/index.js.map +1 -0
- package/lib/commonjs/components/Tile/styles.js +52 -0
- package/lib/commonjs/components/Tile/styles.js.map +1 -0
- package/lib/commonjs/components/index.js +12 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/styles/primitives.js +36 -2
- package/lib/commonjs/styles/primitives.js.map +1 -1
- package/lib/module/components/Checkbox/styles.js +2 -2
- package/lib/module/components/Checkbox/styles.js.map +1 -1
- package/lib/module/components/ListItem/styles.js +10 -10
- package/lib/module/components/ListItem/styles.js.map +1 -1
- package/lib/module/components/Tile/index.js +243 -0
- package/lib/module/components/Tile/index.js.map +1 -0
- package/lib/module/components/Tile/styles.js +48 -0
- package/lib/module/components/Tile/styles.js.map +1 -0
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/styles/primitives.js +36 -2
- package/lib/module/styles/primitives.js.map +1 -1
- package/lib/typescript/components/Checkbox/styles.d.ts.map +1 -1
- package/lib/typescript/components/ListItem/styles.d.ts.map +1 -1
- package/lib/typescript/components/Tile/index.d.ts +70 -0
- package/lib/typescript/components/Tile/index.d.ts.map +1 -0
- package/lib/typescript/components/Tile/styles.d.ts +18 -0
- package/lib/typescript/components/Tile/styles.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/styles/primitives.d.ts +35 -0
- package/lib/typescript/styles/primitives.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/components/Checkbox/styles.ts +7 -9
- package/src/components/ListItem/styles.ts +12 -19
- package/src/components/Tile/index.tsx +296 -0
- package/src/components/Tile/styles.ts +82 -0
- package/src/components/index.ts +1 -0
- package/src/styles/primitives.ts +36 -2
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { TRANSITION_COLORS } from '../../styles/primitives';
|
|
4
|
+
|
|
5
|
+
export const tileGroupVariants = cva(['flex w-full'], {
|
|
6
|
+
variants: {
|
|
7
|
+
direction: {
|
|
8
|
+
column: 'flex-col',
|
|
9
|
+
row: 'flex-row',
|
|
10
|
+
},
|
|
11
|
+
spacing: {
|
|
12
|
+
default: 'gap-2',
|
|
13
|
+
none: 'gap-0',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
direction: 'column',
|
|
18
|
+
spacing: 'default',
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export type TileGroupVariantProps = VariantProps<typeof tileGroupVariants>;
|
|
23
|
+
|
|
24
|
+
export const tileRootVariants = cva(
|
|
25
|
+
[
|
|
26
|
+
'flex-row self-stretch gap-3 px-4 py-3',
|
|
27
|
+
'data-[disabled=true]:opacity-50',
|
|
28
|
+
TRANSITION_COLORS,
|
|
29
|
+
Platform.select({
|
|
30
|
+
web: [
|
|
31
|
+
'outline-none',
|
|
32
|
+
'data-[hover=true]:data-[disabled=false]:bg-surface-action-tint-hover',
|
|
33
|
+
'data-[active=true]:data-[disabled=false]:data-[hover=true]:bg-surface-action-tint-active',
|
|
34
|
+
'data-[hover=true]:data-[disabled=false]:data-[state=unselected]:border-stroke-action',
|
|
35
|
+
'focus-visible:data-[disabled=false]:ring-2 focus-visible:data-[disabled=false]:ring-stroke-focus focus-visible:data-[disabled=false]:ring-offset-2',
|
|
36
|
+
].join(' '),
|
|
37
|
+
default: [
|
|
38
|
+
'data-[active=true]:bg-surface-action-tint-hover',
|
|
39
|
+
'data-[active=true]:border-stroke-action',
|
|
40
|
+
].join(' '),
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
{
|
|
44
|
+
variants: {
|
|
45
|
+
shape: {
|
|
46
|
+
flat: 'rounded-none border-0 bg-transparent',
|
|
47
|
+
card: [
|
|
48
|
+
'rounded-xl border-1 border-solid',
|
|
49
|
+
'border-stroke-secondary',
|
|
50
|
+
'bg-surface-primary',
|
|
51
|
+
'data-[state=selected]:border-stroke-action',
|
|
52
|
+
'data-[state=selected]:border-1.5',
|
|
53
|
+
'data-[state=selected]:bg-surface-action-tint',
|
|
54
|
+
].join(' '),
|
|
55
|
+
},
|
|
56
|
+
showSeparator: {
|
|
57
|
+
true: [
|
|
58
|
+
'border-b border-solid border-stroke-secondary! native:data-[active=true]:border-stroke-secondary', // Override border-stroke-action on hover
|
|
59
|
+
],
|
|
60
|
+
false: '',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
defaultVariants: {
|
|
64
|
+
shape: 'card',
|
|
65
|
+
showSeparator: false,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
export const tileLeadingSlotVariants = cva(['flex shrink-0 items-center justify-center']);
|
|
71
|
+
|
|
72
|
+
export const tileTrailingSlotVariants = cva(['flex shrink-0 items-center justify-center']);
|
|
73
|
+
|
|
74
|
+
export const tileContentVariants = cva(['min-w-0 flex-1 flex-col gap-0.5 no-underline']);
|
|
75
|
+
|
|
76
|
+
export const tileTitleVariants = cva(['text-base font-medium text-content-primary no-underline']);
|
|
77
|
+
|
|
78
|
+
export const tileDescriptionVariants = cva(['text-sm text-content-secondary no-underline']);
|
|
79
|
+
|
|
80
|
+
export const tileIndicatorVariants = cva(['flex shrink-0 items-center justify-center']);
|
|
81
|
+
|
|
82
|
+
export type TileVariantProps = VariantProps<typeof tileRootVariants>;
|
package/src/components/index.ts
CHANGED
package/src/styles/primitives.ts
CHANGED
|
@@ -3,36 +3,65 @@
|
|
|
3
3
|
|
|
4
4
|
// ─── Colors ──────────────────────────────────────────────
|
|
5
5
|
// Surface & background
|
|
6
|
+
/** @deprecated Use `bg-surface-primary` (--color-surface-primary) instead. */
|
|
6
7
|
export const COLOR_BG_PRIMARY = 'bg-white';
|
|
8
|
+
/** @deprecated Use `bg-surface-secondary` (--color-surface-secondary) instead. */
|
|
7
9
|
export const COLOR_BG_SUBTLE = 'bg-slate-50';
|
|
10
|
+
/** @deprecated Use `bg-surface-neutral-subtle` (--color-surface-neutral-subtle) instead. */
|
|
8
11
|
export const COLOR_BG_MUTED = 'bg-slate-100';
|
|
12
|
+
/** @deprecated Use `bg-base-950` (--color-base-950) instead. */
|
|
9
13
|
export const COLOR_BG_INVERSE = 'bg-slate-900';
|
|
10
14
|
|
|
11
15
|
// Border
|
|
16
|
+
/** @deprecated Use `border-stroke-secondary` (--color-stroke-secondary) instead. */
|
|
12
17
|
export const COLOR_BORDER_DEFAULT = 'border-slate-200';
|
|
18
|
+
/** @deprecated Use `border-stroke-hover` (--color-stroke-hover) instead. */
|
|
13
19
|
export const COLOR_BORDER_STRONG = 'border-slate-300';
|
|
20
|
+
/** @deprecated Use `border-stroke-focus` (--color-stroke-focus) instead. */
|
|
14
21
|
export const COLOR_BORDER_FOCUS = 'border-slate-900';
|
|
22
|
+
/** @deprecated Use `border-stroke-danger` (--color-stroke-danger) instead. */
|
|
15
23
|
export const COLOR_BORDER_INVALID = 'border-red-500';
|
|
16
24
|
|
|
17
25
|
// Text
|
|
26
|
+
/** @deprecated Use `text-content-primary` (--color-content-primary) instead. */
|
|
18
27
|
export const COLOR_TEXT_PRIMARY = 'text-slate-900';
|
|
28
|
+
/** @deprecated Use `text-content-secondary` (--color-content-secondary) instead. */
|
|
19
29
|
export const COLOR_TEXT_SECONDARY = 'text-slate-500';
|
|
30
|
+
/** @deprecated Use `text-content-tertiary` (--color-content-tertiary) instead. */
|
|
20
31
|
export const COLOR_TEXT_MUTED = 'text-slate-400';
|
|
32
|
+
/** @deprecated Use the appropriate `text-content-*-on-strong` token for the surface color, e.g. `text-content-action-on-strong` (--color-content-action-on-strong). */
|
|
21
33
|
export const COLOR_TEXT_INVERSE = 'text-white';
|
|
34
|
+
/** @deprecated Use `text-content-tertiary` (--color-content-tertiary) instead. */
|
|
22
35
|
export const COLOR_TEXT_PLACEHOLDER = 'text-slate-400';
|
|
36
|
+
/** @deprecated Use `text-content-danger` (--color-content-danger) instead. */
|
|
23
37
|
export const COLOR_TEXT_INVALID = 'text-red-600';
|
|
24
38
|
|
|
25
39
|
// Brand / Action
|
|
40
|
+
/** @deprecated Use `bg-surface-action-strong` (--color-surface-action-strong) instead. */
|
|
26
41
|
export const COLOR_BRAND_DEFAULT = 'bg-slate-900';
|
|
42
|
+
/** @deprecated Use `bg-surface-action-strong-hover` (--color-surface-action-strong-hover) instead. */
|
|
27
43
|
export const COLOR_BRAND_HOVER = 'bg-slate-800';
|
|
44
|
+
/** @deprecated Use `bg-surface-action-strong-active` (--color-surface-action-strong-active) instead. */
|
|
28
45
|
export const COLOR_BRAND_ACTIVE = 'bg-slate-700';
|
|
29
46
|
|
|
30
47
|
// Accent (for checked states, active indicators)
|
|
48
|
+
/** @deprecated Use `bg-surface-action-strong` (--color-surface-action-strong) instead. */
|
|
31
49
|
export const COLOR_ACCENT_DEFAULT = 'bg-slate-900';
|
|
50
|
+
/** @deprecated Use `border-stroke-action` (--color-stroke-action) instead. */
|
|
32
51
|
export const COLOR_ACCENT_BORDER = 'border-slate-900';
|
|
33
52
|
|
|
34
|
-
|
|
35
|
-
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated Use semantic token classes directly instead. Map each color key to its
|
|
55
|
+
* corresponding `--color-surface-*`, `--color-stroke-*`, and `--color-content-*` tokens:
|
|
56
|
+
* - `bg` → `bg-surface-{color}-strong` (--color-surface-{color}-strong)
|
|
57
|
+
* - `bgHover` → `bg-surface-{color}-strong-hover` (--color-surface-{color}-strong-hover)
|
|
58
|
+
* - `bgActive` → `bg-surface-{color}-strong-active` (--color-surface-{color}-strong-active)
|
|
59
|
+
* - `border` → `border-stroke-{color}` (--color-stroke-{color})
|
|
60
|
+
* - `text` → `text-content-{color}` (--color-content-{color})
|
|
61
|
+
* - `ring` → `ring-[--color-stroke-focus]` (--color-stroke-focus)
|
|
62
|
+
*
|
|
63
|
+
* See Button/styles.ts for a complete migration example.
|
|
64
|
+
*/
|
|
36
65
|
export const SEMANTIC_COLORS = {
|
|
37
66
|
action: {
|
|
38
67
|
bg: 'bg-slate-900',
|
|
@@ -77,6 +106,7 @@ export const SEMANTIC_COLORS = {
|
|
|
77
106
|
} as const;
|
|
78
107
|
|
|
79
108
|
// ─── Focus ───────────────────────────────────────────────
|
|
109
|
+
/** @deprecated Use `ring-2 ring-[--color-stroke-focus] ring-offset-2` (--color-stroke-focus) instead. */
|
|
80
110
|
export const FOCUS_RING = 'ring-2 ring-slate-400/50 ring-offset-2';
|
|
81
111
|
|
|
82
112
|
// ─── Radius ──────────────────────────────────────────────
|
|
@@ -85,13 +115,17 @@ export const RADIUS_MD = 'rounded-xl'; // cards, dropdowns, modals
|
|
|
85
115
|
export const RADIUS_FULL = 'rounded-full'; // pills, avatars, switches
|
|
86
116
|
|
|
87
117
|
// ─── Shadows ─────────────────────────────────────────────
|
|
118
|
+
|
|
119
|
+
/** @deprecated Use `shadow-sm` directly instead */
|
|
88
120
|
export const SHADOW_SM = 'shadow-sm';
|
|
121
|
+
/** @deprecated Use `shadow-md` directly instead */
|
|
89
122
|
export const SHADOW_MD = 'shadow-md';
|
|
90
123
|
|
|
91
124
|
// ─── Sizing ──────────────────────────────────────────────
|
|
92
125
|
// Unified size scale for interactive/form components (Button, Input, Select, Checkbox).
|
|
93
126
|
// Only two sizes: 'default' (regular) and 'small' (compact).
|
|
94
127
|
// NOTE: Text and Heading use a separate typography scale (xs/sm/md/lg/xl) — not this.
|
|
128
|
+
/** @deprecated */
|
|
95
129
|
export const SIZE_SCALE = {
|
|
96
130
|
default: { height: 'h-10', px: 'px-4', gap: 'gap-2', text: 'text-base' },
|
|
97
131
|
small: { height: 'h-8', px: 'px-3', gap: 'gap-1.5', text: 'text-sm' },
|