@cdx-ui/components 0.0.1-beta.57 → 0.0.1-beta.58
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/lib/commonjs/components/ListItem/index.js +3 -25
- package/lib/commonjs/components/ListItem/index.js.map +1 -1
- package/lib/commonjs/components/ListItem/styles.js +27 -55
- package/lib/commonjs/components/ListItem/styles.js.map +1 -1
- package/lib/commonjs/figma/Avatar.figma.js +4 -1
- package/lib/commonjs/figma/Avatar.figma.js.map +1 -1
- package/lib/commonjs/figma/ListItem.Description.figma.js +23 -0
- package/lib/commonjs/figma/ListItem.Description.figma.js.map +1 -0
- package/lib/commonjs/figma/ListItem.LeadingSlot.figma.js +24 -0
- package/lib/commonjs/figma/ListItem.LeadingSlot.figma.js.map +1 -0
- package/lib/commonjs/figma/ListItem.Meta.figma.js +23 -0
- package/lib/commonjs/figma/ListItem.Meta.figma.js.map +1 -0
- package/lib/commonjs/figma/ListItem.SectionHeader.figma.js +24 -0
- package/lib/commonjs/figma/ListItem.SectionHeader.figma.js.map +1 -0
- package/lib/commonjs/figma/ListItem.Title.figma.js +23 -0
- package/lib/commonjs/figma/ListItem.Title.figma.js.map +1 -0
- package/lib/commonjs/figma/ListItem.TrailingSlot.figma.js +24 -0
- package/lib/commonjs/figma/ListItem.TrailingSlot.figma.js.map +1 -0
- package/lib/commonjs/figma/ListItem.figma.js +50 -0
- package/lib/commonjs/figma/ListItem.figma.js.map +1 -0
- package/lib/commonjs/figma/Text.figma.js +4 -1
- package/lib/commonjs/figma/Text.figma.js.map +1 -1
- package/lib/module/components/ListItem/index.js +3 -25
- package/lib/module/components/ListItem/index.js.map +1 -1
- package/lib/module/components/ListItem/styles.js +27 -55
- package/lib/module/components/ListItem/styles.js.map +1 -1
- package/lib/module/figma/Avatar.figma.js +4 -1
- package/lib/module/figma/Avatar.figma.js.map +1 -1
- package/lib/module/figma/ListItem.Description.figma.js +17 -0
- package/lib/module/figma/ListItem.Description.figma.js.map +1 -0
- package/lib/module/figma/ListItem.LeadingSlot.figma.js +18 -0
- package/lib/module/figma/ListItem.LeadingSlot.figma.js.map +1 -0
- package/lib/module/figma/ListItem.Meta.figma.js +17 -0
- package/lib/module/figma/ListItem.Meta.figma.js.map +1 -0
- package/lib/module/figma/ListItem.SectionHeader.figma.js +18 -0
- package/lib/module/figma/ListItem.SectionHeader.figma.js.map +1 -0
- package/lib/module/figma/ListItem.Title.figma.js +17 -0
- package/lib/module/figma/ListItem.Title.figma.js.map +1 -0
- package/lib/module/figma/ListItem.TrailingSlot.figma.js +18 -0
- package/lib/module/figma/ListItem.TrailingSlot.figma.js.map +1 -0
- package/lib/module/figma/ListItem.figma.js +44 -0
- package/lib/module/figma/ListItem.figma.js.map +1 -0
- package/lib/module/figma/Text.figma.js +4 -1
- package/lib/module/figma/Text.figma.js.map +1 -1
- package/lib/typescript/components/ListItem/index.d.ts.map +1 -1
- package/lib/typescript/components/ListItem/styles.d.ts +3 -10
- package/lib/typescript/components/ListItem/styles.d.ts.map +1 -1
- package/lib/typescript/figma/Avatar.figma.d.ts +3 -0
- package/lib/typescript/figma/Avatar.figma.d.ts.map +1 -1
- package/lib/typescript/figma/ListItem.Description.figma.d.ts +11 -0
- package/lib/typescript/figma/ListItem.Description.figma.d.ts.map +1 -0
- package/lib/typescript/figma/ListItem.LeadingSlot.figma.d.ts +8 -0
- package/lib/typescript/figma/ListItem.LeadingSlot.figma.d.ts.map +1 -0
- package/lib/typescript/figma/ListItem.Meta.figma.d.ts +11 -0
- package/lib/typescript/figma/ListItem.Meta.figma.d.ts.map +1 -0
- package/lib/typescript/figma/ListItem.SectionHeader.figma.d.ts +8 -0
- package/lib/typescript/figma/ListItem.SectionHeader.figma.d.ts.map +1 -0
- package/lib/typescript/figma/ListItem.Title.figma.d.ts +11 -0
- package/lib/typescript/figma/ListItem.Title.figma.d.ts.map +1 -0
- package/lib/typescript/figma/ListItem.TrailingSlot.figma.d.ts +8 -0
- package/lib/typescript/figma/ListItem.TrailingSlot.figma.d.ts.map +1 -0
- package/lib/typescript/figma/ListItem.figma.d.ts +8 -0
- package/lib/typescript/figma/ListItem.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Text.figma.d.ts +3 -0
- package/lib/typescript/figma/Text.figma.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/components/ListItem/index.tsx +8 -23
- package/src/components/ListItem/styles.ts +45 -69
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListItem.SectionHeader.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/ListItem.SectionHeader.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AAa1B,wBAIE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListItem.Title.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/ListItem.Title.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;;;;AAM1B,wBAKE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListItem.TrailingSlot.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/ListItem.TrailingSlot.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AAS1B,wBAIE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListItem.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/ListItem.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AA0C1B,wBASE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/Text.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"Text.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/Text.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;;;;AAe1B,wBAKE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdx-ui/components",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.58",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"module": "lib/module/index.js",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"@gorhom/bottom-sheet": "^5.2.6",
|
|
68
68
|
"class-variance-authority": "^0.7.1",
|
|
69
69
|
"uniwind": "1.6.1",
|
|
70
|
-
"@cdx-ui/
|
|
71
|
-
"@cdx-ui/icons": "0.0.1-beta.
|
|
72
|
-
"@cdx-ui/
|
|
70
|
+
"@cdx-ui/utils": "0.0.1-beta.58",
|
|
71
|
+
"@cdx-ui/icons": "0.0.1-beta.58",
|
|
72
|
+
"@cdx-ui/primitives": "0.0.1-beta.58"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@react-navigation/bottom-tabs": "*",
|
|
@@ -38,9 +38,9 @@ const ListItemPrimitive = createListItem({
|
|
|
38
38
|
SectionHeader: View,
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
const useListItemStyleContext = (): Pick<ListItemVariantProps, '
|
|
41
|
+
const useListItemStyleContext = (): Pick<ListItemVariantProps, 'crossAlign'> => {
|
|
42
42
|
const ctx = useStyleContext(SCOPE) as ListItemVariantProps | undefined;
|
|
43
|
-
return {
|
|
43
|
+
return { crossAlign: ctx?.crossAlign ?? 'center' };
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
// =============================================================================
|
|
@@ -53,19 +53,11 @@ export interface ListItemProps extends IListItemProps, WithStyleContextProps {
|
|
|
53
53
|
|
|
54
54
|
const ListItemRoot = forwardRef<View, ListItemProps>(
|
|
55
55
|
(
|
|
56
|
-
{
|
|
57
|
-
size = 'default',
|
|
58
|
-
surface = 'default',
|
|
59
|
-
showSeparator = true,
|
|
60
|
-
crossAlign = 'center',
|
|
61
|
-
className,
|
|
62
|
-
style,
|
|
63
|
-
...props
|
|
64
|
-
},
|
|
56
|
+
{ size = 'default', showSeparator = true, crossAlign = 'center', className, style, ...props },
|
|
65
57
|
ref,
|
|
66
58
|
) => {
|
|
67
59
|
const computedClassName = cn(
|
|
68
|
-
listItemRootVariants({ size,
|
|
60
|
+
listItemRootVariants({ size, showSeparator, crossAlign }),
|
|
69
61
|
className,
|
|
70
62
|
);
|
|
71
63
|
|
|
@@ -73,12 +65,11 @@ const ListItemRoot = forwardRef<View, ListItemProps>(
|
|
|
73
65
|
<ListItemPrimitive
|
|
74
66
|
ref={ref as never}
|
|
75
67
|
className={computedClassName}
|
|
76
|
-
context={{
|
|
68
|
+
context={{ crossAlign }}
|
|
77
69
|
crossAlign={crossAlign}
|
|
78
70
|
showSeparator={showSeparator}
|
|
79
71
|
size={size}
|
|
80
72
|
style={style}
|
|
81
|
-
surface={surface}
|
|
82
73
|
{...props}
|
|
83
74
|
/>
|
|
84
75
|
);
|
|
@@ -135,12 +126,10 @@ export interface ListItemTitleProps extends TextProps {
|
|
|
135
126
|
|
|
136
127
|
const ListItemTitle = forwardRef<Text, ListItemTitleProps>(
|
|
137
128
|
({ className, numberOfLines = 1, style, ...props }, ref) => {
|
|
138
|
-
const { size } = useListItemStyleContext();
|
|
139
|
-
|
|
140
129
|
return (
|
|
141
130
|
<ListItemPrimitive.Title
|
|
142
131
|
ref={ref as never}
|
|
143
|
-
className={cn(listItemTitleVariants(
|
|
132
|
+
className={cn(listItemTitleVariants(), className)}
|
|
144
133
|
numberOfLines={numberOfLines}
|
|
145
134
|
style={style}
|
|
146
135
|
{...props}
|
|
@@ -157,12 +146,10 @@ export interface ListItemDescriptionProps extends TextProps {
|
|
|
157
146
|
|
|
158
147
|
const ListItemDescription = forwardRef<Text, ListItemDescriptionProps>(
|
|
159
148
|
({ className, style, ...props }, ref) => {
|
|
160
|
-
const { size } = useListItemStyleContext();
|
|
161
|
-
|
|
162
149
|
return (
|
|
163
150
|
<ListItemPrimitive.Description
|
|
164
151
|
ref={ref as never}
|
|
165
|
-
className={cn(listItemDescriptionVariants(
|
|
152
|
+
className={cn(listItemDescriptionVariants(), className)}
|
|
166
153
|
style={style}
|
|
167
154
|
{...props}
|
|
168
155
|
/>
|
|
@@ -178,12 +165,10 @@ export interface ListItemMetaProps extends TextProps {
|
|
|
178
165
|
|
|
179
166
|
const ListItemMeta = forwardRef<Text, ListItemMetaProps>(
|
|
180
167
|
({ className, numberOfLines = 1, style, ...props }, ref) => {
|
|
181
|
-
const { size } = useListItemStyleContext();
|
|
182
|
-
|
|
183
168
|
return (
|
|
184
169
|
<ListItemPrimitive.Meta
|
|
185
170
|
ref={ref as never}
|
|
186
|
-
className={cn(listItemMetaVariants(
|
|
171
|
+
className={cn(listItemMetaVariants(), className)}
|
|
187
172
|
numberOfLines={numberOfLines}
|
|
188
173
|
style={style}
|
|
189
174
|
{...props}
|
|
@@ -2,36 +2,47 @@ import { Platform } from 'react-native';
|
|
|
2
2
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
3
|
import { TRANSITION_COLORS } from '../../styles/primitives';
|
|
4
4
|
|
|
5
|
-
// ── Root (row): density,
|
|
5
|
+
// ── Root (row): density, separator, interactive feedback ───────────────────
|
|
6
|
+
//
|
|
7
|
+
// Web hover/active/focus paint an absolutely positioned bg-content-primary overlay at
|
|
8
|
+
// --opacity-hover (8%) / --opacity-hover-overlay (20%) / --opacity-selected (12%), plus a focus
|
|
9
|
+
// ring on focus-visible. State is driven by the data attributes the primitive root emits
|
|
10
|
+
// (data-hover / data-active / data-focus-visible) — or by the composed child on `asChild`
|
|
11
|
+
// (e.g. Link emits the same attributes). Native active uses a flat tint because ::before
|
|
12
|
+
// pseudo-elements are web-only.
|
|
13
|
+
//
|
|
14
|
+
// TODO: Handle native background color hover/focus transitions
|
|
6
15
|
|
|
7
16
|
export const listItemRootVariants = cva(
|
|
8
17
|
[
|
|
9
|
-
'flex-row self-stretch w-full px-
|
|
10
|
-
'data-[disabled=true]:opacity-
|
|
11
|
-
'data-[active=true]:opacity-70',
|
|
18
|
+
'relative flex-row self-stretch w-full overflow-clip px-5 bg-transparent',
|
|
19
|
+
'data-[disabled=true]:opacity-[var(--opacity-disabled)] data-[disabled=true]:pointer-events-none',
|
|
12
20
|
TRANSITION_COLORS,
|
|
13
21
|
Platform.select({
|
|
14
22
|
web: [
|
|
15
23
|
'outline-none',
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
24
|
+
'before:pointer-events-none before:absolute before:inset-0 before:bg-content-primary before:opacity-0 before:content-[""]',
|
|
25
|
+
'before:transition-opacity before:duration-150 before:ease-out',
|
|
26
|
+
'data-[hover=true]:before:opacity-[var(--opacity-hover)]',
|
|
27
|
+
// Pressed wins over hover via the compound selector (higher specificity), mirroring Button.
|
|
28
|
+
'data-[active=true]:data-[hover=true]:before:opacity-[var(--opacity-hover-overlay)]',
|
|
29
|
+
'data-[focus-visible=true]:before:opacity-[var(--opacity-selected)]',
|
|
30
|
+
'data-[focus-visible=true]:ring-2 data-[focus-visible=true]:ring-stroke-focus data-[focus-visible=true]:ring-offset-2',
|
|
19
31
|
].join(' '),
|
|
20
|
-
default: '',
|
|
32
|
+
default: 'data-[active=true]:bg-surface-primary-hover',
|
|
21
33
|
}),
|
|
22
34
|
],
|
|
23
35
|
{
|
|
24
36
|
variants: {
|
|
25
37
|
size: {
|
|
26
|
-
default: 'gap-3 py-
|
|
27
|
-
compact: 'gap-
|
|
28
|
-
},
|
|
29
|
-
surface: {
|
|
30
|
-
default: 'bg-white',
|
|
31
|
-
negative: 'bg-red-50',
|
|
38
|
+
default: 'gap-3 py-3 min-h-16',
|
|
39
|
+
compact: 'gap-3 py-2 min-h-12',
|
|
32
40
|
},
|
|
33
41
|
showSeparator: {
|
|
34
|
-
true:
|
|
42
|
+
true: [
|
|
43
|
+
'border-b border-solid border-stroke-secondary',
|
|
44
|
+
Platform.select({ web: 'before:-bottom-px', default: '' }),
|
|
45
|
+
].join(' '),
|
|
35
46
|
false: 'border-b-0',
|
|
36
47
|
},
|
|
37
48
|
crossAlign: {
|
|
@@ -39,18 +50,8 @@ export const listItemRootVariants = cva(
|
|
|
39
50
|
start: 'items-start',
|
|
40
51
|
},
|
|
41
52
|
},
|
|
42
|
-
compoundVariants: [
|
|
43
|
-
{
|
|
44
|
-
surface: 'negative',
|
|
45
|
-
className: Platform.select({
|
|
46
|
-
web: 'web:data-[hover=true]:bg-red-100/90',
|
|
47
|
-
default: '',
|
|
48
|
-
}),
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
53
|
defaultVariants: {
|
|
52
54
|
size: 'default',
|
|
53
|
-
surface: 'default',
|
|
54
55
|
showSeparator: true,
|
|
55
56
|
crossAlign: 'center',
|
|
56
57
|
},
|
|
@@ -59,23 +60,28 @@ export const listItemRootVariants = cva(
|
|
|
59
60
|
|
|
60
61
|
// ── Leading / trailing slots ─────────────────────────────────────────────────
|
|
61
62
|
|
|
62
|
-
export const listItemLeadingSlotVariants = cva([
|
|
63
|
+
export const listItemLeadingSlotVariants = cva([
|
|
64
|
+
'relative z-10 flex shrink-0 items-center justify-center',
|
|
65
|
+
]);
|
|
63
66
|
|
|
64
|
-
export const listItemTrailingSlotVariants = cva(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
export const listItemTrailingSlotVariants = cva(
|
|
68
|
+
['relative z-10 flex shrink-0 flex-row justify-end gap-2'],
|
|
69
|
+
{
|
|
70
|
+
variants: {
|
|
71
|
+
crossAlign: {
|
|
72
|
+
center: 'items-center',
|
|
73
|
+
start: 'items-start self-start',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
defaultVariants: {
|
|
77
|
+
crossAlign: 'center',
|
|
69
78
|
},
|
|
70
79
|
},
|
|
71
|
-
|
|
72
|
-
crossAlign: 'center',
|
|
73
|
-
},
|
|
74
|
-
});
|
|
80
|
+
);
|
|
75
81
|
|
|
76
82
|
// ── Content stack (title / description / meta) ───────────────────────────────
|
|
77
83
|
|
|
78
|
-
export const listItemContentVariants = cva('flex min-w-0 flex-1 flex-col gap-1', {
|
|
84
|
+
export const listItemContentVariants = cva('relative z-10 flex min-w-0 flex-1 flex-col gap-1', {
|
|
79
85
|
variants: {
|
|
80
86
|
crossAlign: {
|
|
81
87
|
center: 'justify-center',
|
|
@@ -89,41 +95,11 @@ export const listItemContentVariants = cva('flex min-w-0 flex-1 flex-col gap-1',
|
|
|
89
95
|
|
|
90
96
|
// ── Typography ───────────────────────────────────────────────────────────────
|
|
91
97
|
|
|
92
|
-
export const listItemTitleVariants = cva('text-content-primary
|
|
93
|
-
variants: {
|
|
94
|
-
size: {
|
|
95
|
-
default: 'text-base leading-snug',
|
|
96
|
-
compact: 'text-sm leading-snug',
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
defaultVariants: {
|
|
100
|
-
size: 'default',
|
|
101
|
-
},
|
|
102
|
-
});
|
|
98
|
+
export const listItemTitleVariants = cva('body-md font-medium text-content-primary');
|
|
103
99
|
|
|
104
|
-
export const listItemDescriptionVariants = cva('text-content-secondary'
|
|
105
|
-
variants: {
|
|
106
|
-
size: {
|
|
107
|
-
default: 'text-sm leading-normal',
|
|
108
|
-
compact: 'text-xs leading-normal',
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
defaultVariants: {
|
|
112
|
-
size: 'default',
|
|
113
|
-
},
|
|
114
|
-
});
|
|
100
|
+
export const listItemDescriptionVariants = cva('body-sm text-content-secondary');
|
|
115
101
|
|
|
116
|
-
export const listItemMetaVariants = cva('text-content-tertiary'
|
|
117
|
-
variants: {
|
|
118
|
-
size: {
|
|
119
|
-
default: 'text-xs leading-normal',
|
|
120
|
-
compact: 'text-[11px] leading-normal',
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
defaultVariants: {
|
|
124
|
-
size: 'default',
|
|
125
|
-
},
|
|
126
|
-
});
|
|
102
|
+
export const listItemMetaVariants = cva('body-sm text-content-tertiary');
|
|
127
103
|
|
|
128
104
|
// ── Section header (group label row inside lists / cards) ───────────────────
|
|
129
105
|
|