@cdx-ui/components 0.1.6 → 0.1.7
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/coverage.svg +1 -1
- package/lib/commonjs/components/Alert/index.js.map +1 -1
- package/lib/commonjs/components/Avatar/index.js +6 -4
- package/lib/commonjs/components/Avatar/index.js.map +1 -1
- package/lib/commonjs/components/Badge/index.js.map +1 -1
- package/lib/commonjs/components/Badge/styles.js +2 -2
- package/lib/commonjs/components/BottomSheet/index.js +106 -91
- package/lib/commonjs/components/BottomSheet/index.js.map +1 -1
- package/lib/commonjs/components/BottomSheet/styles.js +1 -12
- package/lib/commonjs/components/BottomSheet/styles.js.map +1 -1
- package/lib/commonjs/components/Button/index.js.map +1 -1
- package/lib/commonjs/components/Card/index.js.map +1 -1
- package/lib/commonjs/components/Dialog/index.js.map +1 -1
- package/lib/commonjs/components/Divider/index.js.map +1 -1
- package/lib/commonjs/components/Form/styles.js +1 -1
- package/lib/commonjs/components/Form/styles.js.map +1 -1
- package/lib/commonjs/components/FullScreenDialog/animation.js +46 -0
- package/lib/commonjs/components/FullScreenDialog/animation.js.map +1 -0
- package/lib/commonjs/components/FullScreenDialog/index.js +343 -0
- package/lib/commonjs/components/FullScreenDialog/index.js.map +1 -0
- package/lib/commonjs/components/FullScreenDialog/styles.js +14 -0
- package/lib/commonjs/components/FullScreenDialog/styles.js.map +1 -0
- package/lib/commonjs/components/IconButton/styles.js +7 -5
- package/lib/commonjs/components/IconButton/styles.js.map +1 -1
- package/lib/commonjs/components/InsuranceDisclosure/index.js.map +1 -1
- package/lib/commonjs/components/Link/index.js.map +1 -1
- package/lib/commonjs/components/ListItem/index.js +2 -0
- package/lib/commonjs/components/ListItem/index.js.map +1 -1
- package/lib/commonjs/components/ListItem/styles.js +6 -0
- package/lib/commonjs/components/ListItem/styles.js.map +1 -1
- package/lib/commonjs/components/ProgressSegmented/index.js.map +1 -1
- package/lib/commonjs/components/Radio/index.js.map +1 -1
- package/lib/commonjs/components/ScopedTheme/index.js +11 -3
- package/lib/commonjs/components/ScopedTheme/index.js.map +1 -1
- package/lib/commonjs/components/Skeleton/index.js.map +1 -1
- package/lib/commonjs/components/Stack/HStack.js.map +1 -1
- package/lib/commonjs/components/Stack/VStack.js.map +1 -1
- package/lib/commonjs/components/Textarea/index.js.map +1 -1
- package/lib/commonjs/components/Tile/index.js.map +1 -1
- package/lib/commonjs/components/Toast/index.js +40 -12
- package/lib/commonjs/components/Toast/index.js.map +1 -1
- package/lib/commonjs/components/Toast/styles.js +15 -4
- package/lib/commonjs/components/Toast/styles.js.map +1 -1
- package/lib/commonjs/components/index.js +12 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/picker/styles.js +6 -2
- package/lib/commonjs/components/picker/styles.js.map +1 -1
- package/lib/commonjs/components/sheet-header/index.js +97 -0
- package/lib/commonjs/components/sheet-header/index.js.map +1 -0
- package/lib/commonjs/components/sheet-header/styles.js +28 -0
- package/lib/commonjs/components/sheet-header/styles.js.map +1 -0
- package/lib/commonjs/figma/BottomSheet.figma.js +1 -1
- package/lib/commonjs/providers/toast/provider.js +44 -11
- package/lib/commonjs/providers/toast/provider.js.map +1 -1
- package/lib/module/components/Alert/index.js.map +1 -1
- package/lib/module/components/Avatar/index.js +6 -4
- package/lib/module/components/Avatar/index.js.map +1 -1
- package/lib/module/components/Badge/index.js.map +1 -1
- package/lib/module/components/Badge/styles.js +2 -2
- package/lib/module/components/BottomSheet/index.js +110 -95
- package/lib/module/components/BottomSheet/index.js.map +1 -1
- package/lib/module/components/BottomSheet/styles.js +0 -11
- package/lib/module/components/BottomSheet/styles.js.map +1 -1
- package/lib/module/components/Button/index.js.map +1 -1
- package/lib/module/components/Card/index.js.map +1 -1
- package/lib/module/components/Dialog/index.js.map +1 -1
- package/lib/module/components/Divider/index.js.map +1 -1
- package/lib/module/components/Form/styles.js +1 -1
- package/lib/module/components/Form/styles.js.map +1 -1
- package/lib/module/components/FullScreenDialog/animation.js +41 -0
- package/lib/module/components/FullScreenDialog/animation.js.map +1 -0
- package/lib/module/components/FullScreenDialog/index.js +338 -0
- package/lib/module/components/FullScreenDialog/index.js.map +1 -0
- package/lib/module/components/FullScreenDialog/styles.js +10 -0
- package/lib/module/components/FullScreenDialog/styles.js.map +1 -0
- package/lib/module/components/IconButton/styles.js +7 -4
- package/lib/module/components/IconButton/styles.js.map +1 -1
- package/lib/module/components/InsuranceDisclosure/index.js.map +1 -1
- package/lib/module/components/Link/index.js.map +1 -1
- package/lib/module/components/ListItem/index.js +2 -0
- package/lib/module/components/ListItem/index.js.map +1 -1
- package/lib/module/components/ListItem/styles.js +6 -0
- package/lib/module/components/ListItem/styles.js.map +1 -1
- package/lib/module/components/ProgressSegmented/index.js.map +1 -1
- package/lib/module/components/Radio/index.js.map +1 -1
- package/lib/module/components/ScopedTheme/index.js +11 -3
- package/lib/module/components/ScopedTheme/index.js.map +1 -1
- package/lib/module/components/Skeleton/index.js.map +1 -1
- package/lib/module/components/Stack/HStack.js.map +1 -1
- package/lib/module/components/Stack/VStack.js.map +1 -1
- package/lib/module/components/Textarea/index.js.map +1 -1
- package/lib/module/components/Tile/index.js.map +1 -1
- package/lib/module/components/Toast/index.js +43 -15
- package/lib/module/components/Toast/index.js.map +1 -1
- package/lib/module/components/Toast/styles.js +14 -3
- package/lib/module/components/Toast/styles.js.map +1 -1
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/picker/styles.js +6 -2
- package/lib/module/components/picker/styles.js.map +1 -1
- package/lib/module/components/sheet-header/index.js +94 -0
- package/lib/module/components/sheet-header/index.js.map +1 -0
- package/lib/module/components/sheet-header/styles.js +25 -0
- package/lib/module/components/sheet-header/styles.js.map +1 -0
- package/lib/module/figma/BottomSheet.figma.js +1 -1
- package/lib/module/providers/toast/provider.js +44 -11
- package/lib/module/providers/toast/provider.js.map +1 -1
- package/lib/typescript/components/Alert/index.d.ts +4 -1
- package/lib/typescript/components/Alert/index.d.ts.map +1 -1
- package/lib/typescript/components/Avatar/index.d.ts +10 -4
- package/lib/typescript/components/Avatar/index.d.ts.map +1 -1
- package/lib/typescript/components/Badge/index.d.ts +34 -0
- package/lib/typescript/components/Badge/index.d.ts.map +1 -1
- package/lib/typescript/components/BottomSheet/index.d.ts +12 -1
- package/lib/typescript/components/BottomSheet/index.d.ts.map +1 -1
- package/lib/typescript/components/BottomSheet/styles.d.ts +0 -5
- package/lib/typescript/components/BottomSheet/styles.d.ts.map +1 -1
- package/lib/typescript/components/Button/index.d.ts +9 -1
- package/lib/typescript/components/Button/index.d.ts.map +1 -1
- package/lib/typescript/components/Card/index.d.ts +14 -0
- package/lib/typescript/components/Card/index.d.ts.map +1 -1
- package/lib/typescript/components/Chip/index.d.ts +1 -1
- package/lib/typescript/components/CurrencyInput/index.d.ts +2 -2
- package/lib/typescript/components/CurrencyInput/index.d.ts.map +1 -1
- package/lib/typescript/components/Dialog/index.d.ts +10 -0
- package/lib/typescript/components/Dialog/index.d.ts.map +1 -1
- package/lib/typescript/components/Dialog/styles.d.ts +1 -0
- package/lib/typescript/components/Dialog/styles.d.ts.map +1 -1
- package/lib/typescript/components/Divider/index.d.ts +5 -0
- package/lib/typescript/components/Divider/index.d.ts.map +1 -1
- package/lib/typescript/components/Drawer/styles.d.ts +1 -1
- package/lib/typescript/components/Form/styles.d.ts.map +1 -1
- package/lib/typescript/components/FullScreenDialog/animation.d.ts +9 -0
- package/lib/typescript/components/FullScreenDialog/animation.d.ts.map +1 -0
- package/lib/typescript/components/FullScreenDialog/index.d.ts +85 -0
- package/lib/typescript/components/FullScreenDialog/index.d.ts.map +1 -0
- package/lib/typescript/components/FullScreenDialog/styles.d.ts +6 -0
- package/lib/typescript/components/FullScreenDialog/styles.d.ts.map +1 -0
- package/lib/typescript/components/IconButton/styles.d.ts +5 -0
- package/lib/typescript/components/IconButton/styles.d.ts.map +1 -1
- package/lib/typescript/components/Input/index.d.ts +1 -1
- package/lib/typescript/components/InsuranceDisclosure/index.d.ts +1 -0
- package/lib/typescript/components/InsuranceDisclosure/index.d.ts.map +1 -1
- package/lib/typescript/components/Link/index.d.ts +2 -0
- package/lib/typescript/components/Link/index.d.ts.map +1 -1
- package/lib/typescript/components/ListItem/index.d.ts +43 -4
- package/lib/typescript/components/ListItem/index.d.ts.map +1 -1
- package/lib/typescript/components/ListItem/styles.d.ts +2 -0
- package/lib/typescript/components/ListItem/styles.d.ts.map +1 -1
- package/lib/typescript/components/ProgressSegmented/index.d.ts +10 -3
- package/lib/typescript/components/ProgressSegmented/index.d.ts.map +1 -1
- package/lib/typescript/components/Radio/index.d.ts +1 -0
- package/lib/typescript/components/Radio/index.d.ts.map +1 -1
- package/lib/typescript/components/ScopedTheme/index.d.ts +11 -3
- package/lib/typescript/components/ScopedTheme/index.d.ts.map +1 -1
- package/lib/typescript/components/Skeleton/index.d.ts +5 -1
- package/lib/typescript/components/Skeleton/index.d.ts.map +1 -1
- package/lib/typescript/components/Stack/HStack.d.ts +6 -0
- package/lib/typescript/components/Stack/HStack.d.ts.map +1 -1
- package/lib/typescript/components/Stack/VStack.d.ts +6 -0
- package/lib/typescript/components/Stack/VStack.d.ts.map +1 -1
- package/lib/typescript/components/Switch/index.d.ts +1 -1
- package/lib/typescript/components/Tabs/index.d.ts +2 -2
- package/lib/typescript/components/Textarea/index.d.ts +1 -0
- package/lib/typescript/components/Textarea/index.d.ts.map +1 -1
- package/lib/typescript/components/Tile/index.d.ts +49 -0
- package/lib/typescript/components/Tile/index.d.ts.map +1 -1
- package/lib/typescript/components/Toast/index.d.ts +15 -0
- package/lib/typescript/components/Toast/index.d.ts.map +1 -1
- package/lib/typescript/components/Toast/styles.d.ts +10 -0
- package/lib/typescript/components/Toast/styles.d.ts.map +1 -1
- package/lib/typescript/components/Toast/types.d.ts +9 -0
- package/lib/typescript/components/Toast/types.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/components/picker/styles.d.ts +5 -2
- package/lib/typescript/components/picker/styles.d.ts.map +1 -1
- package/lib/typescript/components/sheet-header/index.d.ts +24 -0
- package/lib/typescript/components/sheet-header/index.d.ts.map +1 -0
- package/lib/typescript/components/sheet-header/styles.d.ts +12 -0
- package/lib/typescript/components/sheet-header/styles.d.ts.map +1 -0
- package/lib/typescript/providers/toast/provider.d.ts +1 -1
- package/lib/typescript/providers/toast/provider.d.ts.map +1 -1
- package/lib/typescript/providers/toast/types.d.ts +16 -4
- package/lib/typescript/providers/toast/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/components/Alert/index.tsx +4 -1
- package/src/components/Avatar/index.tsx +10 -4
- package/src/components/Badge/index.tsx +34 -0
- package/src/components/Badge/styles.ts +2 -2
- package/src/components/BottomSheet/index.tsx +156 -125
- package/src/components/BottomSheet/styles.ts +1 -22
- package/src/components/Button/index.tsx +9 -1
- package/src/components/Card/index.tsx +14 -0
- package/src/components/Chip/index.tsx +1 -1
- package/src/components/CurrencyInput/index.tsx +2 -2
- package/src/components/Dialog/index.tsx +10 -0
- package/src/components/Dialog/styles.ts +1 -0
- package/src/components/Divider/index.tsx +5 -0
- package/src/components/Form/styles.ts +1 -1
- package/src/components/FullScreenDialog/animation.ts +22 -0
- package/src/components/FullScreenDialog/index.tsx +484 -0
- package/src/components/FullScreenDialog/styles.ts +23 -0
- package/src/components/IconButton/styles.ts +7 -4
- package/src/components/Input/index.tsx +1 -1
- package/src/components/InsuranceDisclosure/index.tsx +1 -0
- package/src/components/Link/index.tsx +2 -0
- package/src/components/ListItem/index.tsx +48 -4
- package/src/components/ListItem/styles.ts +7 -0
- package/src/components/ProgressSegmented/index.tsx +10 -3
- package/src/components/Radio/index.tsx +1 -0
- package/src/components/ScopedTheme/index.tsx +11 -3
- package/src/components/Skeleton/index.tsx +5 -1
- package/src/components/Stack/HStack.tsx +6 -0
- package/src/components/Stack/VStack.tsx +6 -0
- package/src/components/Switch/index.tsx +1 -1
- package/src/components/Tabs/index.tsx +2 -2
- package/src/components/Textarea/index.tsx +1 -0
- package/src/components/Tile/index.tsx +49 -0
- package/src/components/Toast/index.tsx +55 -9
- package/src/components/Toast/styles.ts +14 -3
- package/src/components/Toast/types.ts +9 -0
- package/src/components/index.ts +1 -0
- package/src/components/picker/styles.ts +6 -2
- package/src/components/sheet-header/index.tsx +148 -0
- package/src/components/sheet-header/styles.ts +28 -0
- package/src/providers/toast/provider.tsx +47 -13
- package/src/providers/toast/types.ts +16 -4
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
listItemSectionHeaderVariants,
|
|
20
20
|
listItemTitleVariants,
|
|
21
21
|
listItemTrailingSlotVariants,
|
|
22
|
+
type ListItemSectionHeaderVariantProps,
|
|
22
23
|
type ListItemVariantProps,
|
|
23
24
|
} from './styles';
|
|
24
25
|
|
|
@@ -34,6 +35,28 @@ const useListItemStyleContext = (): Pick<ListItemVariantProps, 'crossAlign'> =>
|
|
|
34
35
|
// =============================================================================
|
|
35
36
|
|
|
36
37
|
export interface ListItemProps extends Omit<IListItemProps, 'crossAlign'>, ListItemVariantProps {
|
|
38
|
+
/**
|
|
39
|
+
* Vertical density. `compact` reduces padding and min-height; typography stays the same.
|
|
40
|
+
* @default 'default'
|
|
41
|
+
* @remarks `'default' | 'compact'`
|
|
42
|
+
* @fumadocsType `'default' | 'compact'`
|
|
43
|
+
*/
|
|
44
|
+
size?: 'default' | 'compact' | null | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Bottom border between rows. Set `false` on the last row to avoid a trailing border.
|
|
47
|
+
* @default true
|
|
48
|
+
* @remarks `boolean`
|
|
49
|
+
* @fumadocsType `boolean`
|
|
50
|
+
*/
|
|
51
|
+
showSeparator?: boolean | null | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Vertical alignment of the leading, content, and trailing slots.
|
|
54
|
+
* `start` top-aligns them so trailing text lines up with the title.
|
|
55
|
+
* @default 'center'
|
|
56
|
+
* @remarks `'center' | 'start'`
|
|
57
|
+
* @fumadocsType `'center' | 'start'`
|
|
58
|
+
*/
|
|
59
|
+
crossAlign?: 'center' | 'start' | null | undefined;
|
|
37
60
|
className?: string;
|
|
38
61
|
}
|
|
39
62
|
|
|
@@ -82,6 +105,7 @@ ListItemRoot.displayName = 'ListItem';
|
|
|
82
105
|
const leadingSlotStyle = { flexShrink: 0 as const };
|
|
83
106
|
|
|
84
107
|
export interface ListItemLeadingSlotProps extends ViewProps {
|
|
108
|
+
/** Renders the consumer's child element in place of the default `View` host. */
|
|
85
109
|
asChild?: boolean;
|
|
86
110
|
className?: string;
|
|
87
111
|
/**
|
|
@@ -119,6 +143,7 @@ const contentStyle = {
|
|
|
119
143
|
};
|
|
120
144
|
|
|
121
145
|
export interface ListItemContentProps extends ViewProps {
|
|
146
|
+
/** Renders the consumer's child element in place of the default `View` host. */
|
|
122
147
|
asChild?: boolean;
|
|
123
148
|
className?: string;
|
|
124
149
|
}
|
|
@@ -143,6 +168,7 @@ const ListItemContent = forwardRef<View, ListItemContentProps>(
|
|
|
143
168
|
ListItemContent.displayName = 'ListItem.Content';
|
|
144
169
|
|
|
145
170
|
export interface ListItemTitleProps extends TextProps {
|
|
171
|
+
/** Renders the consumer's child element in place of the default `Text` host. */
|
|
146
172
|
asChild?: boolean;
|
|
147
173
|
className?: string;
|
|
148
174
|
}
|
|
@@ -166,6 +192,7 @@ const ListItemTitle = forwardRef<Text, ListItemTitleProps>(
|
|
|
166
192
|
ListItemTitle.displayName = 'ListItem.Title';
|
|
167
193
|
|
|
168
194
|
export interface ListItemDescriptionProps extends TextProps {
|
|
195
|
+
/** Renders the consumer's child element in place of the default `Text` host. */
|
|
169
196
|
asChild?: boolean;
|
|
170
197
|
className?: string;
|
|
171
198
|
}
|
|
@@ -188,6 +215,7 @@ const ListItemDescription = forwardRef<Text, ListItemDescriptionProps>(
|
|
|
188
215
|
ListItemDescription.displayName = 'ListItem.Description';
|
|
189
216
|
|
|
190
217
|
export interface ListItemMetaProps extends TextProps {
|
|
218
|
+
/** Renders the consumer's child element in place of the default `Text` host. */
|
|
191
219
|
asChild?: boolean;
|
|
192
220
|
className?: string;
|
|
193
221
|
}
|
|
@@ -211,6 +239,7 @@ const ListItemMeta = forwardRef<Text, ListItemMetaProps>(
|
|
|
211
239
|
ListItemMeta.displayName = 'ListItem.Meta';
|
|
212
240
|
|
|
213
241
|
export interface ListItemTrailingSlotProps extends ViewProps {
|
|
242
|
+
/** Renders the consumer's child element in place of the default `View` host. */
|
|
214
243
|
asChild?: boolean;
|
|
215
244
|
className?: string;
|
|
216
245
|
}
|
|
@@ -267,15 +296,29 @@ const sectionHeaderTrailingCell = {
|
|
|
267
296
|
alignSelf: 'center' as const,
|
|
268
297
|
};
|
|
269
298
|
|
|
299
|
+
export type ListItemSectionHeaderVariant = NonNullable<
|
|
300
|
+
ListItemSectionHeaderVariantProps['variant']
|
|
301
|
+
>;
|
|
302
|
+
|
|
270
303
|
export interface ListItemSectionHeaderProps extends ViewProps {
|
|
304
|
+
/** Renders the consumer's child element in place of the default `View` host. */
|
|
271
305
|
asChild?: boolean;
|
|
272
306
|
className?: string;
|
|
273
|
-
/** Primary section label
|
|
307
|
+
/** Primary section label. String or number children are styled as an uppercase label. */
|
|
274
308
|
children: ReactNode;
|
|
275
309
|
/** Optional right-aligned adornment (e.g. section Chip). */
|
|
276
310
|
trailing?: ReactNode;
|
|
277
311
|
/**
|
|
278
|
-
*
|
|
312
|
+
* Background treatment. `ghost` has no fill and a bottom border; `subtle` adds a neutral fill
|
|
313
|
+
* (matching `subtle` on Avatar, Chip, and IconButton) and drops the bottom border.
|
|
314
|
+
* Label typography is the same for both.
|
|
315
|
+
* @default 'ghost'
|
|
316
|
+
* @remarks `'ghost' | 'subtle'`
|
|
317
|
+
* @fumadocsType `'ghost' | 'subtle'`
|
|
318
|
+
*/
|
|
319
|
+
variant?: ListItemSectionHeaderVariant;
|
|
320
|
+
/**
|
|
321
|
+
* Accent top border above the header.
|
|
279
322
|
* @default true
|
|
280
323
|
*/
|
|
281
324
|
showDivider?: boolean;
|
|
@@ -287,6 +330,7 @@ const ListItemSectionHeader = forwardRef<View, ListItemSectionHeaderProps>(
|
|
|
287
330
|
asChild,
|
|
288
331
|
children,
|
|
289
332
|
className,
|
|
333
|
+
variant = 'ghost',
|
|
290
334
|
showDivider = true,
|
|
291
335
|
style,
|
|
292
336
|
trailing,
|
|
@@ -300,7 +344,7 @@ const ListItemSectionHeader = forwardRef<View, ListItemSectionHeaderProps>(
|
|
|
300
344
|
<Comp
|
|
301
345
|
ref={ref}
|
|
302
346
|
accessibilityRole={accessibilityRole}
|
|
303
|
-
className={cn(listItemSectionHeaderVariants({ showDivider }), className)}
|
|
347
|
+
className={cn(listItemSectionHeaderVariants({ variant, showDivider }), className)}
|
|
304
348
|
style={[sectionHeaderRow, style]}
|
|
305
349
|
{...props}
|
|
306
350
|
{...mergeDataAttributes(
|
|
@@ -341,7 +385,7 @@ export const ListItem = Object.assign(ListItemRoot, {
|
|
|
341
385
|
SectionHeader: ListItemSectionHeader,
|
|
342
386
|
}) as ListItemCompound;
|
|
343
387
|
|
|
344
|
-
export type { ListItemCrossAlign, ListItemVariantProps };
|
|
388
|
+
export type { ListItemCrossAlign, ListItemSectionHeaderVariantProps, ListItemVariantProps };
|
|
345
389
|
export {
|
|
346
390
|
listItemContentVariants,
|
|
347
391
|
listItemDescriptionVariants,
|
|
@@ -110,12 +110,18 @@ export const listItemSectionHeaderVariants = cva(
|
|
|
110
110
|
],
|
|
111
111
|
{
|
|
112
112
|
variants: {
|
|
113
|
+
variant: {
|
|
114
|
+
ghost: [],
|
|
115
|
+
// The fill separates the header from its rows, so the bottom border is dropped.
|
|
116
|
+
subtle: 'bg-surface-neutral-subtle border-b-0',
|
|
117
|
+
},
|
|
113
118
|
showDivider: {
|
|
114
119
|
true: ['border-t-4 border-solid border-t-surface-brand-strong/40', 'border-x-0'],
|
|
115
120
|
false: 'border-t-0',
|
|
116
121
|
},
|
|
117
122
|
},
|
|
118
123
|
defaultVariants: {
|
|
124
|
+
variant: 'ghost',
|
|
119
125
|
showDivider: true,
|
|
120
126
|
},
|
|
121
127
|
},
|
|
@@ -127,3 +133,4 @@ export const listItemSectionHeaderLabelVariants = cva(
|
|
|
127
133
|
);
|
|
128
134
|
|
|
129
135
|
export type ListItemVariantProps = VariantProps<typeof listItemRootVariants>;
|
|
136
|
+
export type ListItemSectionHeaderVariantProps = VariantProps<typeof listItemSectionHeaderVariants>;
|
|
@@ -8,18 +8,25 @@ import {
|
|
|
8
8
|
} from './styles';
|
|
9
9
|
|
|
10
10
|
export interface ProgressSegmentedProps extends ViewProps, ProgressSegmentedVariants {
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Current step (1-based index into the segment count).
|
|
13
|
+
* Clamped to `[0, segments]` (`0` leaves every segment incomplete).
|
|
14
|
+
*/
|
|
12
15
|
readonly step: number;
|
|
13
16
|
/**
|
|
14
17
|
* Number of segments in the bar. Matches the Figma `segments` variant (2–6 in the design
|
|
15
18
|
* system file); the prop accepts any positive integer for backward compatibility.
|
|
19
|
+
* @default 5
|
|
16
20
|
*/
|
|
17
21
|
readonly segments?: number;
|
|
18
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* When true, the current step segment is marked as complete rather than in-progress.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
19
26
|
readonly isStepComplete?: boolean;
|
|
20
27
|
/**
|
|
21
28
|
* Returns the accessibility value text announced by screen readers. Receives the clamped
|
|
22
|
-
* step, segment count, and whether the step is complete.
|
|
29
|
+
* step, segment count, and whether the step is complete. Replaces the English default.
|
|
23
30
|
*/
|
|
24
31
|
readonly getAccessibilityText?: (
|
|
25
32
|
step: number,
|
|
@@ -180,6 +180,7 @@ export interface RadioGroupProps extends ViewProps {
|
|
|
180
180
|
isDisabled?: boolean;
|
|
181
181
|
isInvalid?: boolean;
|
|
182
182
|
isRequired?: boolean;
|
|
183
|
+
/** Makes every radio in the group read-only. Items stay focusable, but the selection cannot be changed. */
|
|
183
184
|
isReadOnly?: boolean;
|
|
184
185
|
direction?: 'column' | 'row';
|
|
185
186
|
name?: string;
|
|
@@ -10,8 +10,16 @@ export type ScopedThemeProps = ComponentProps<typeof UniwindScopedTheme>;
|
|
|
10
10
|
*
|
|
11
11
|
* Wraps Uniwind's `ScopedTheme` to keep `uniwind` an internal implementation detail.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* On web, the consuming app's `global.css` must include
|
|
14
|
+
* `@custom-variant dark (&:where(.dark, .dark *));`. Without that directive,
|
|
15
|
+
* `theme="dark"` does not flip CSS variables. Native applies the scoped theme
|
|
16
|
+
* through React context and does not use the directive.
|
|
17
|
+
*
|
|
18
|
+
* On web, `theme="dark"` forces dark tokens inside a light app. `theme="light"`
|
|
19
|
+
* applies when no `.dark` ancestor is present; there is no `@custom-variant light`
|
|
20
|
+
* to override one. Native honors either value through context.
|
|
21
|
+
*
|
|
22
|
+
* Pass a static `theme`. Changing `theme` on an already-mounted instance can leave
|
|
23
|
+
* stale styles; remount to switch.
|
|
16
24
|
*/
|
|
17
25
|
export const ScopedTheme = (props: ScopedThemeProps) => <UniwindScopedTheme {...props} />;
|
|
@@ -12,7 +12,11 @@ import { skeletonVariants } from './styles';
|
|
|
12
12
|
|
|
13
13
|
export interface SkeletonProps extends ViewProps {
|
|
14
14
|
className?: string;
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Half-cycle of the opacity pulse (`1` → `0.35`) in milliseconds.
|
|
17
|
+
* A full pulse takes `duration × 2`.
|
|
18
|
+
* @default 1000
|
|
19
|
+
*/
|
|
16
20
|
duration?: number;
|
|
17
21
|
}
|
|
18
22
|
|
|
@@ -6,7 +6,13 @@ import { hStackRootVariants, type StackSpace } from './styles';
|
|
|
6
6
|
|
|
7
7
|
export interface HStackProps extends ViewProps {
|
|
8
8
|
className?: string;
|
|
9
|
+
/** Token-based gap between children. */
|
|
9
10
|
space?: StackSpace;
|
|
11
|
+
/**
|
|
12
|
+
* Reverses the visual order of children along the stack axis.
|
|
13
|
+
* Source order and screen-reader order stay unchanged.
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
10
16
|
reversed?: boolean;
|
|
11
17
|
}
|
|
12
18
|
|
|
@@ -6,7 +6,13 @@ import { vStackRootVariants, type StackSpace } from './styles';
|
|
|
6
6
|
|
|
7
7
|
export interface VStackProps extends ViewProps {
|
|
8
8
|
className?: string;
|
|
9
|
+
/** Token-based gap between children. */
|
|
9
10
|
space?: StackSpace;
|
|
11
|
+
/**
|
|
12
|
+
* Reverses the visual order of children along the stack axis.
|
|
13
|
+
* Source order and screen-reader order stay unchanged.
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
10
16
|
reversed?: boolean;
|
|
11
17
|
}
|
|
12
18
|
|
|
@@ -10,7 +10,7 @@ import { BaseSwitch } from './BaseSwitch';
|
|
|
10
10
|
|
|
11
11
|
export interface SwitchProps extends ISwitchProps {
|
|
12
12
|
/**
|
|
13
|
-
* Track and thumb size.
|
|
13
|
+
* Track and thumb size on web. iOS and Android render the system switch, so `size` has no effect.
|
|
14
14
|
* @default 'md'
|
|
15
15
|
*/
|
|
16
16
|
size?: 'sm' | 'md' | 'lg';
|
|
@@ -154,8 +154,8 @@ export interface TabsListProps extends ITabsListProps {
|
|
|
154
154
|
className?: string;
|
|
155
155
|
/**
|
|
156
156
|
* When `orientation="horizontal"`, scroll tab triggers if they overflow the list width.
|
|
157
|
-
*
|
|
158
|
-
*
|
|
157
|
+
* On native, selecting a tab scrolls it into view. On web, edge fades and paging
|
|
158
|
+
* controls appear when more tabs are off-screen. Vertical lists do not scroll.
|
|
159
159
|
* @default true
|
|
160
160
|
*/
|
|
161
161
|
scrollable?: boolean;
|
|
@@ -40,6 +40,7 @@ export interface TextareaProps
|
|
|
40
40
|
Omit<TextInputProps, 'multiline' | 'children' | 'style'>,
|
|
41
41
|
IInputFieldProps,
|
|
42
42
|
TextareaVariantProps {
|
|
43
|
+
/** Additional Tailwind classes, applied to the root shell rather than the inner field. */
|
|
43
44
|
className?: string;
|
|
44
45
|
placeholderTextColorClassName?: string;
|
|
45
46
|
/** Initial / minimum visible rows. Defaults to 2 on web and 8 on native. */
|
|
@@ -66,11 +66,39 @@ const useTileGroupStyleContext = (): TileGroupStyleContext => {
|
|
|
66
66
|
*/
|
|
67
67
|
export interface TileGroupSingleProps extends ITileGroupSingleProps, TileGroupVariantProps {
|
|
68
68
|
className?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Layout axis. `row` places tiles side by side.
|
|
71
|
+
* @default 'column'
|
|
72
|
+
* @remarks `'column' | 'row'`
|
|
73
|
+
* @fumadocsType `'column' | 'row'`
|
|
74
|
+
*/
|
|
75
|
+
direction?: 'column' | 'row' | null | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Gap between tiles. `none` removes it so rows touch.
|
|
78
|
+
* @default 'default'
|
|
79
|
+
* @remarks `'default' | 'none'`
|
|
80
|
+
* @fumadocsType `'default' | 'none'`
|
|
81
|
+
*/
|
|
82
|
+
spacing?: 'default' | 'none' | null | undefined;
|
|
69
83
|
/** Visual shape inherited by child `Tile`s. Per-tile `shape` overrides this. */
|
|
70
84
|
shape?: TileVariantProps['shape'];
|
|
71
85
|
}
|
|
72
86
|
export interface TileGroupMultipleProps extends ITileGroupMultipleProps, TileGroupVariantProps {
|
|
73
87
|
className?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Layout axis. `row` places tiles side by side.
|
|
90
|
+
* @default 'column'
|
|
91
|
+
* @remarks `'column' | 'row'`
|
|
92
|
+
* @fumadocsType `'column' | 'row'`
|
|
93
|
+
*/
|
|
94
|
+
direction?: 'column' | 'row' | null | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Gap between tiles. `none` removes it so rows touch.
|
|
97
|
+
* @default 'default'
|
|
98
|
+
* @remarks `'default' | 'none'`
|
|
99
|
+
* @fumadocsType `'default' | 'none'`
|
|
100
|
+
*/
|
|
101
|
+
spacing?: 'default' | 'none' | null | undefined;
|
|
74
102
|
/** Visual shape inherited by child `Tile`s. Per-tile `shape` overrides this. */
|
|
75
103
|
shape?: TileVariantProps['shape'];
|
|
76
104
|
}
|
|
@@ -104,6 +132,21 @@ TileGroup.displayName = 'Tile.Group';
|
|
|
104
132
|
// =============================================================================
|
|
105
133
|
|
|
106
134
|
export interface TileProps extends ITileProps, TileVariantProps {
|
|
135
|
+
/**
|
|
136
|
+
* Visual shape. Overrides the shape inherited from `Tile.Group`.
|
|
137
|
+
* `card` is a bordered surface; `flat` is a borderless row.
|
|
138
|
+
* @default 'card'
|
|
139
|
+
* @remarks `'card' | 'flat'`
|
|
140
|
+
* @fumadocsType `'card' | 'flat'`
|
|
141
|
+
*/
|
|
142
|
+
shape?: 'card' | 'flat' | null | undefined;
|
|
143
|
+
/**
|
|
144
|
+
* Renders a bottom border. Omit it on the last row of a tight list.
|
|
145
|
+
* @default false
|
|
146
|
+
* @remarks `boolean`
|
|
147
|
+
* @fumadocsType `boolean`
|
|
148
|
+
*/
|
|
149
|
+
showSeparator?: boolean | null | undefined;
|
|
107
150
|
className?: string;
|
|
108
151
|
}
|
|
109
152
|
|
|
@@ -196,6 +239,11 @@ const noUnderlineStyle = { textDecorationLine: 'none' as const };
|
|
|
196
239
|
export interface TileTitleProps extends TextProps {
|
|
197
240
|
asChild?: boolean;
|
|
198
241
|
className?: string;
|
|
242
|
+
/**
|
|
243
|
+
* Maximum lines before the title truncates.
|
|
244
|
+
* @default 1
|
|
245
|
+
*/
|
|
246
|
+
numberOfLines?: number;
|
|
199
247
|
}
|
|
200
248
|
|
|
201
249
|
const TileTitle = forwardRef<Text, TileTitleProps>(
|
|
@@ -276,6 +324,7 @@ const indicatorStyle = { flexShrink: 0 as const, pointerEvents: 'none' as const
|
|
|
276
324
|
export interface TileIndicatorProps extends ITileIndicatorProps {
|
|
277
325
|
asChild?: boolean;
|
|
278
326
|
className?: string;
|
|
327
|
+
/** Replaces the default radio or checkbox visual when provided. */
|
|
279
328
|
children?: ReactNode;
|
|
280
329
|
}
|
|
281
330
|
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Children,
|
|
3
|
+
forwardRef,
|
|
4
|
+
isValidElement,
|
|
5
|
+
useEffect,
|
|
6
|
+
useMemo,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
type ReactNode,
|
|
10
|
+
} from 'react';
|
|
2
11
|
import { Platform, View } from 'react-native';
|
|
3
12
|
import { GestureDetector } from 'react-native-gesture-handler';
|
|
4
13
|
import Animated from 'react-native-reanimated';
|
|
@@ -27,6 +36,7 @@ import {
|
|
|
27
36
|
toastDescriptionVariants,
|
|
28
37
|
toastIconVariants,
|
|
29
38
|
toastStyleSheet,
|
|
39
|
+
toastTextVariants,
|
|
30
40
|
toastWrapperVariants,
|
|
31
41
|
} from './styles';
|
|
32
42
|
import type {
|
|
@@ -64,6 +74,26 @@ type ToastDataState = 'entering' | 'open' | 'closed';
|
|
|
64
74
|
|
|
65
75
|
// --------------------------------------------------
|
|
66
76
|
|
|
77
|
+
const isTrailingChild = (child: ReactNode) =>
|
|
78
|
+
isValidElement(child) && (child.type === ToastAction || child.type === ToastClose);
|
|
79
|
+
|
|
80
|
+
const renderToastRow = (children: ReactNode) => {
|
|
81
|
+
const childArray = Children.toArray(children);
|
|
82
|
+
const iconChild = childArray.find((child) => isValidElement(child) && child.type === ToastIcon);
|
|
83
|
+
const trailingChildren = childArray.filter(isTrailingChild);
|
|
84
|
+
const textChildren = childArray.filter(
|
|
85
|
+
(child) => !(isValidElement(child) && child.type === ToastIcon) && !isTrailingChild(child),
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<>
|
|
90
|
+
{iconChild}
|
|
91
|
+
{textChildren.length > 0 ? <View className={toastTextVariants()}>{textChildren}</View> : null}
|
|
92
|
+
{trailingChildren}
|
|
93
|
+
</>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
67
97
|
const ToastRoot = forwardRef<View, ToastProps>((props, ref) => {
|
|
68
98
|
const globalConfig = useToastConfig();
|
|
69
99
|
|
|
@@ -225,6 +255,10 @@ const ToastRoot = forwardRef<View, ToastProps>((props, ref) => {
|
|
|
225
255
|
|
|
226
256
|
const wrapperClassName = cn(toastWrapperVariants({ placement }));
|
|
227
257
|
|
|
258
|
+
// Shared by the visible toast and the native measuring node so the measured
|
|
259
|
+
// height matches what is on screen.
|
|
260
|
+
const content = renderToastRow(children);
|
|
261
|
+
|
|
228
262
|
return (
|
|
229
263
|
<AnimationSettingsProvider value={animationSettingsContextValue}>
|
|
230
264
|
<ParentContext.Provider value={ctx}>
|
|
@@ -256,7 +290,7 @@ const ToastRoot = forwardRef<View, ToastProps>((props, ref) => {
|
|
|
256
290
|
}),
|
|
257
291
|
)}
|
|
258
292
|
>
|
|
259
|
-
{
|
|
293
|
+
{content}
|
|
260
294
|
{/*
|
|
261
295
|
When visible toasts have different heights, the toast adapts to the last visible toast height.
|
|
262
296
|
In cases where a toast originally has one height and gets smaller when a new toast comes to stack,
|
|
@@ -286,7 +320,7 @@ const ToastRoot = forwardRef<View, ToastProps>((props, ref) => {
|
|
|
286
320
|
}}
|
|
287
321
|
{...restProps}
|
|
288
322
|
>
|
|
289
|
-
{
|
|
323
|
+
{content}
|
|
290
324
|
</AnimatedToastRoot>
|
|
291
325
|
)}
|
|
292
326
|
</Animated.View>
|
|
@@ -494,18 +528,15 @@ export function DefaultToast(props: DefaultToastProps) {
|
|
|
494
528
|
placement={placement}
|
|
495
529
|
isSwipeable={isSwipeable}
|
|
496
530
|
animation={animation}
|
|
497
|
-
className="flex-row gap-3"
|
|
498
531
|
hide={hide}
|
|
499
532
|
show={show}
|
|
500
533
|
{...(color === 'danger' && { role: 'alert' as const })}
|
|
501
534
|
{...toastComponentProps}
|
|
502
535
|
>
|
|
503
536
|
{icon ? <ToastIcon as={icon} /> : null}
|
|
504
|
-
<
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
</View>
|
|
508
|
-
{actionLabel && <ToastAction onPress={handleActionPress}>{actionLabel}</ToastAction>}
|
|
537
|
+
{label ? <ToastTitle>{label}</ToastTitle> : null}
|
|
538
|
+
{description ? <ToastDescription>{description}</ToastDescription> : null}
|
|
539
|
+
{actionLabel ? <ToastAction onPress={handleActionPress}>{actionLabel}</ToastAction> : null}
|
|
509
540
|
</ToastRoot>
|
|
510
541
|
);
|
|
511
542
|
}
|
|
@@ -527,6 +558,21 @@ type ToastCompoundComponent = typeof ToastRoot & {
|
|
|
527
558
|
Close: typeof ToastClose;
|
|
528
559
|
};
|
|
529
560
|
|
|
561
|
+
/**
|
|
562
|
+
* Presentational toast root, rendered inside a `toast.show({ component })`
|
|
563
|
+
* render function with the supplied props spread onto it.
|
|
564
|
+
*
|
|
565
|
+
* The root lays out its direct children as a fixed row regardless of JSX
|
|
566
|
+
* order: the first `Toast.Icon` at the start, every `Toast.Action` and
|
|
567
|
+
* `Toast.Close` at the end in source order, and every other child
|
|
568
|
+
* (`Toast.Title`, `Toast.Description`, custom content) in a text column
|
|
569
|
+
* between them. Additional `Toast.Icon` children are dropped.
|
|
570
|
+
*
|
|
571
|
+
* `Toast.Icon`, `Toast.Action`, and `Toast.Close` must be direct children.
|
|
572
|
+
* They are matched by component identity, so wrapping them in `memo()`, an
|
|
573
|
+
* HOC, or a custom component hides them from the root and they render in the
|
|
574
|
+
* text column instead.
|
|
575
|
+
*/
|
|
530
576
|
export const Toast = Object.assign(ToastRoot, {
|
|
531
577
|
Title: ToastTitle,
|
|
532
578
|
Description: ToastDescription,
|
|
@@ -40,7 +40,7 @@ export const toastRootVariants = cva(
|
|
|
40
40
|
// shadow and clips the child's transform mid-transition, producing a
|
|
41
41
|
// visual "cut off" during enter/exit. Consumers that need clipping for
|
|
42
42
|
// custom child content (e.g. a background image) can add it themselves.
|
|
43
|
-
'flex-row items-center gap-
|
|
43
|
+
'flex-row items-center gap-3 rounded-[var(--border-radius-default)] min-h-12 px-4 py-2 shadow-lg bg-surface-primary border border-stroke-secondary',
|
|
44
44
|
'native:overflow-hidden',
|
|
45
45
|
],
|
|
46
46
|
{
|
|
@@ -72,6 +72,10 @@ export const toastRootVariants = cva(
|
|
|
72
72
|
* on the `top-*` / `bottom-*` variants also seeds the entering-state offset synchronously
|
|
73
73
|
* — CSS transitions to `translate-y-0` when `data-state` flips to `open`.
|
|
74
74
|
*
|
|
75
|
+
* Centered placements span the row (`inset-x-0`) and center a `w-fit` box with auto margins.
|
|
76
|
+
* Do not center with `left-1/2` + `-translate-x-1/2`: an absolute box that starts at the
|
|
77
|
+
* midpoint shrink-to-fits into half the container, so short labels wrap long before 460px.
|
|
78
|
+
*
|
|
75
79
|
* `motion-reduce:transition-none` collapses the transition for users with
|
|
76
80
|
* `prefers-reduced-motion: reduce`. In that case `transitionend` may never fire, so
|
|
77
81
|
* the Toast component's safety timeout handles removal.
|
|
@@ -96,7 +100,7 @@ export const toastWrapperVariants = cva(
|
|
|
96
100
|
],
|
|
97
101
|
top: [
|
|
98
102
|
'top-0 native:left-0 native:right-0',
|
|
99
|
-
'web:
|
|
103
|
+
'web:inset-x-0 web:mx-auto web:w-fit web:max-w-[460px]',
|
|
100
104
|
'web:data-[state=entering]:-translate-y-2',
|
|
101
105
|
'web:data-[state=closed]:-translate-y-2',
|
|
102
106
|
],
|
|
@@ -114,7 +118,7 @@ export const toastWrapperVariants = cva(
|
|
|
114
118
|
],
|
|
115
119
|
bottom: [
|
|
116
120
|
'bottom-0 native:left-0 native:right-0',
|
|
117
|
-
'web:
|
|
121
|
+
'web:inset-x-0 web:mx-auto web:w-fit web:max-w-[460px]',
|
|
118
122
|
'web:data-[state=entering]:translate-y-2',
|
|
119
123
|
'web:data-[state=closed]:translate-y-2',
|
|
120
124
|
],
|
|
@@ -132,6 +136,13 @@ export const toastWrapperVariants = cva(
|
|
|
132
136
|
},
|
|
133
137
|
);
|
|
134
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Internal text column the root renders between the leading icon and the
|
|
141
|
+
* trailing controls. Holds `Toast.Title`, `Toast.Description`, and any
|
|
142
|
+
* unrecognized children.
|
|
143
|
+
*/
|
|
144
|
+
export const toastTextVariants = cva(['flex-1 flex-col min-w-0']);
|
|
145
|
+
|
|
135
146
|
export const toastLabelVariants = cva(['text-base font-medium'], {
|
|
136
147
|
variants: {
|
|
137
148
|
color: {
|
|
@@ -186,6 +186,15 @@ export interface ToastProps extends ToastRootProps, Omit<ToastComponentProps, 'i
|
|
|
186
186
|
* @default true
|
|
187
187
|
*/
|
|
188
188
|
isAnimatedStyleActive?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Laid out automatically: the first `Toast.Icon` at the start, `Toast.Action`
|
|
191
|
+
* and `Toast.Close` at the end, and everything else in a text column between
|
|
192
|
+
* them. Additional `Toast.Icon` children are dropped. `Toast.Icon`,
|
|
193
|
+
* `Toast.Action`, and `Toast.Close` must be **direct** children — wrapping
|
|
194
|
+
* them in `memo()` or an HOC hides them from the layout, and they render in
|
|
195
|
+
* the text column instead.
|
|
196
|
+
*/
|
|
197
|
+
children?: React.ReactNode;
|
|
189
198
|
}
|
|
190
199
|
|
|
191
200
|
/**
|
package/src/components/index.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
|
+
import { MODAL_OVERLAY_Z_INDEX } from '@cdx-ui/primitives';
|
|
2
3
|
import { cva } from '@cdx-ui/utils';
|
|
3
4
|
|
|
4
|
-
/**
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Modal layer, so on web a popover opened from a `Dialog` or `FullScreenDialog` paints above it:
|
|
7
|
+
* equal z-index, and the popover mounts later in `document.body`.
|
|
8
|
+
*/
|
|
9
|
+
export const PICKER_POPOVER_Z_INDEX = MODAL_OVERLAY_Z_INDEX;
|
|
6
10
|
|
|
7
11
|
export const pickerPopoverContentVariants = cva([
|
|
8
12
|
'bg-surface-primary',
|