@cdx-ui/components 0.0.1-beta.1 → 0.0.1-beta.10
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 +7 -1
- package/lib/commonjs/components/Card/styles.js +4 -5
- package/lib/commonjs/components/Card/styles.js.map +1 -1
- package/lib/commonjs/components/Heading/styles.js.map +1 -1
- package/lib/commonjs/components/ListItem/index.js +283 -0
- package/lib/commonjs/components/ListItem/index.js.map +1 -0
- package/lib/commonjs/components/ListItem/styles.js +130 -0
- package/lib/commonjs/components/ListItem/styles.js.map +1 -0
- package/lib/commonjs/components/Text/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/figma/Button.figma.js +69 -0
- package/lib/commonjs/figma/Button.figma.js.map +1 -0
- package/lib/commonjs/styles/primitives.js +0 -1
- package/lib/commonjs/styles/primitives.js.map +1 -1
- package/lib/module/components/Card/styles.js +4 -5
- package/lib/module/components/Card/styles.js.map +1 -1
- package/lib/module/components/Heading/styles.js.map +1 -1
- package/lib/module/components/ListItem/index.js +226 -0
- package/lib/module/components/ListItem/index.js.map +1 -0
- package/lib/module/components/ListItem/styles.js +127 -0
- package/lib/module/components/ListItem/styles.js.map +1 -0
- package/lib/module/components/Text/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/figma/Button.figma.js +63 -0
- package/lib/module/figma/Button.figma.js.map +1 -0
- package/lib/module/styles/primitives.js +0 -1
- package/lib/module/styles/primitives.js.map +1 -1
- package/lib/typescript/components/Card/styles.d.ts.map +1 -1
- package/lib/typescript/components/Heading/styles.d.ts.map +1 -1
- package/lib/typescript/components/ListItem/index.d.ts +49 -0
- package/lib/typescript/components/ListItem/index.d.ts.map +1 -0
- package/lib/typescript/components/ListItem/styles.d.ts +30 -0
- package/lib/typescript/components/ListItem/styles.d.ts.map +1 -0
- package/lib/typescript/components/Text/styles.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/figma/Button.figma.d.ts +8 -0
- package/lib/typescript/figma/Button.figma.d.ts.map +1 -0
- package/lib/typescript/styles/primitives.d.ts.map +1 -1
- package/package.json +6 -5
- package/src/components/Card/styles.ts +8 -15
- package/src/components/ListItem/index.tsx +285 -0
- package/src/components/ListItem/styles.ts +160 -0
- package/src/components/index.ts +1 -0
- package/src/styles/primitives.ts +0 -1
- /package/src/components/Heading/{styles.tsx → styles.ts} +0 -0
- /package/src/components/Text/{styles.tsx → styles.ts} +0 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Text, View, type TextProps, type ViewProps } from 'react-native';
|
|
2
|
+
import { type IListItemLeadingSlotProps, type IListItemProps, type IListItemSectionHeaderProps, type ListItemCrossAlign } from '@cdx-ui/primitives';
|
|
3
|
+
import { type WithStyleContextProps } from '@cdx-ui/utils';
|
|
4
|
+
import { type ListItemVariantProps } from './styles';
|
|
5
|
+
export interface ListItemProps extends IListItemProps, WithStyleContextProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const ListItemRoot: import("react").ForwardRefExoticComponent<ListItemProps & import("react").RefAttributes<View>>;
|
|
9
|
+
export interface ListItemLeadingSlotProps extends IListItemLeadingSlotProps {
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const ListItemLeadingSlot: import("react").ForwardRefExoticComponent<ListItemLeadingSlotProps & import("react").RefAttributes<View>>;
|
|
13
|
+
export interface ListItemContentProps extends ViewProps {
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const ListItemContent: import("react").ForwardRefExoticComponent<ListItemContentProps & import("react").RefAttributes<View>>;
|
|
17
|
+
export interface ListItemTitleProps extends TextProps {
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
declare const ListItemTitle: import("react").ForwardRefExoticComponent<ListItemTitleProps & import("react").RefAttributes<Text>>;
|
|
21
|
+
export interface ListItemDescriptionProps extends TextProps {
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
declare const ListItemDescription: import("react").ForwardRefExoticComponent<ListItemDescriptionProps & import("react").RefAttributes<Text>>;
|
|
25
|
+
export interface ListItemMetaProps extends TextProps {
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
declare const ListItemMeta: import("react").ForwardRefExoticComponent<ListItemMetaProps & import("react").RefAttributes<Text>>;
|
|
29
|
+
export interface ListItemTrailingSlotProps extends ViewProps {
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
declare const ListItemTrailingSlot: import("react").ForwardRefExoticComponent<ListItemTrailingSlotProps & import("react").RefAttributes<View>>;
|
|
33
|
+
export interface ListItemSectionHeaderComponentProps extends IListItemSectionHeaderProps {
|
|
34
|
+
className?: string;
|
|
35
|
+
}
|
|
36
|
+
declare const ListItemSectionHeader: import("react").ForwardRefExoticComponent<ListItemSectionHeaderComponentProps & import("react").RefAttributes<View>>;
|
|
37
|
+
type ListItemCompound = typeof ListItemRoot & {
|
|
38
|
+
LeadingSlot: typeof ListItemLeadingSlot;
|
|
39
|
+
Content: typeof ListItemContent;
|
|
40
|
+
Title: typeof ListItemTitle;
|
|
41
|
+
Description: typeof ListItemDescription;
|
|
42
|
+
Meta: typeof ListItemMeta;
|
|
43
|
+
TrailingSlot: typeof ListItemTrailingSlot;
|
|
44
|
+
SectionHeader: typeof ListItemSectionHeader;
|
|
45
|
+
};
|
|
46
|
+
export declare const ListItem: ListItemCompound;
|
|
47
|
+
export type { ListItemCrossAlign, ListItemVariantProps };
|
|
48
|
+
export { listItemContentVariants, listItemDescriptionVariants, listItemLeadingSlotVariants, listItemMetaVariants, listItemRootVariants, listItemSectionHeaderLabelVariants, listItemSectionHeaderVariants, listItemTitleVariants, listItemTrailingSlotVariants, } from './styles';
|
|
49
|
+
//# sourceMappingURL=index.d.ts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CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,oBAAoB,4GAazB,CAAC;AAeF,MAAM,WAAW,mCAAoC,SAAQ,2BAA2B;IACtF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,qBAAqB,sHAa1B,CAAC;AAQF,KAAK,gBAAgB,GAAG,OAAO,YAAY,GAAG;IAC5C,WAAW,EAAE,OAAO,mBAAmB,CAAC;IACxC,OAAO,EAAE,OAAO,eAAe,CAAC;IAChC,KAAK,EAAE,OAAO,aAAa,CAAC;IAC5B,WAAW,EAAE,OAAO,mBAAmB,CAAC;IACxC,IAAI,EAAE,OAAO,YAAY,CAAC;IAC1B,YAAY,EAAE,OAAO,oBAAoB,CAAC;IAC1C,aAAa,EAAE,OAAO,qBAAqB,CAAC;CAC7C,CAAC;AAEF,eAAO,MAAM,QAAQ,EAQf,gBAAgB,CAAC;AAEvB,YAAY,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,CAAC;AACzD,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,EACpB,kCAAkC,EAClC,6BAA6B,EAC7B,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
export declare const listItemRootVariants: (props?: ({
|
|
3
|
+
size?: "default" | "compact" | null | undefined;
|
|
4
|
+
surface?: "default" | "negative" | null | undefined;
|
|
5
|
+
showSeparator?: boolean | null | undefined;
|
|
6
|
+
crossAlign?: "start" | "center" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
export declare const listItemLeadingSlotVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
9
|
+
export declare const listItemTrailingSlotVariants: (props?: ({
|
|
10
|
+
crossAlign?: "start" | "center" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
|
+
export declare const listItemContentVariants: (props?: ({
|
|
13
|
+
crossAlign?: "start" | "center" | null | undefined;
|
|
14
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
|
+
export declare const listItemTitleVariants: (props?: ({
|
|
16
|
+
size?: "default" | "compact" | null | undefined;
|
|
17
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
18
|
+
export declare const listItemDescriptionVariants: (props?: ({
|
|
19
|
+
size?: "default" | "compact" | null | undefined;
|
|
20
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
21
|
+
export declare const listItemMetaVariants: (props?: ({
|
|
22
|
+
size?: "default" | "compact" | null | undefined;
|
|
23
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
24
|
+
export declare const listItemSectionHeaderVariants: (props?: ({
|
|
25
|
+
showDivider?: boolean | null | undefined;
|
|
26
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
27
|
+
/** Default section-title typography; applied by `ListItem.SectionHeader` for string/number children. Exported for rare custom composition. */
|
|
28
|
+
export declare const listItemSectionHeaderLabelVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
29
|
+
export type ListItemVariantProps = VariantProps<typeof listItemRootVariants>;
|
|
30
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/ListItem/styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAWlE,eAAO,MAAM,oBAAoB;;;;;8EAmDhC,CAAC;AAIF,eAAO,MAAM,2BAA2B,oFAAqD,CAAC;AAE9F,eAAO,MAAM,4BAA4B;;8EAUvC,CAAC;AAIH,eAAO,MAAM,uBAAuB;;8EAUlC,CAAC;AAIH,eAAO,MAAM,qBAAqB;;8EAUhC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;8EAUtC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;8EAU/B,CAAC;AAIH,eAAO,MAAM,6BAA6B;;8EAgBzC,CAAC;AAEF,8IAA8I;AAC9I,eAAO,MAAM,kCAAkC,oFAG7C,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Text/styles.
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Text/styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAElE,eAAO,MAAM,SAAS;;8EAmBrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/Button.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AAoD1B,wBASE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../src/styles/primitives.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"primitives.d.ts","sourceRoot":"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AAM,gBAAgB,oCAAoC,CAAC;AAClE,eAAO,MAAM,eAAe,qFACwD,CAAC"}
|
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.10",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"module": "lib/module/index.js",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"lib",
|
|
27
|
-
"src"
|
|
27
|
+
"src",
|
|
28
|
+
"!src/figma"
|
|
28
29
|
],
|
|
29
30
|
"react-native-builder-bob": {
|
|
30
31
|
"source": "src",
|
|
@@ -66,9 +67,9 @@
|
|
|
66
67
|
"@gorhom/bottom-sheet": "^5.2.6",
|
|
67
68
|
"class-variance-authority": "^0.7.1",
|
|
68
69
|
"uniwind": "1.6.1",
|
|
69
|
-
"@cdx-ui/primitives": "0.0.1-beta.
|
|
70
|
-
"@cdx-ui/
|
|
71
|
-
"@cdx-ui/
|
|
70
|
+
"@cdx-ui/primitives": "0.0.1-beta.10",
|
|
71
|
+
"@cdx-ui/utils": "0.0.1-beta.10",
|
|
72
|
+
"@cdx-ui/icons": "0.0.1-beta.10"
|
|
72
73
|
},
|
|
73
74
|
"devDependencies": {
|
|
74
75
|
"@types/react": "*",
|
|
@@ -1,27 +1,20 @@
|
|
|
1
1
|
import { cva } from 'class-variance-authority';
|
|
2
|
-
import {
|
|
3
|
-
COLOR_BG_PRIMARY,
|
|
4
|
-
COLOR_BORDER_DEFAULT,
|
|
5
|
-
COLOR_TEXT_PRIMARY,
|
|
6
|
-
RADIUS_SM,
|
|
7
|
-
SHADOW_SM,
|
|
8
|
-
} from '../../styles/primitives';
|
|
9
2
|
|
|
10
3
|
// ── Root ────────────────────────────────────────────────────
|
|
11
4
|
|
|
12
5
|
export const cardRootVariants = cva([
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
SHADOW_SM,
|
|
6
|
+
'bg-surface-primary',
|
|
7
|
+
'border border-stroke-secondary',
|
|
8
|
+
'rounded-[var(--border-radius-default)]',
|
|
17
9
|
'overflow-hidden',
|
|
18
10
|
]);
|
|
19
11
|
|
|
20
12
|
// ── Header ──────────────────────────────────────────────────
|
|
21
13
|
|
|
22
14
|
export const cardHeaderVariants = cva([
|
|
23
|
-
'flex-row items-center justify-between p-4
|
|
24
|
-
|
|
15
|
+
'flex-row items-center justify-between p-4',
|
|
16
|
+
'border-t-8 border-t-surface-brand-strong',
|
|
17
|
+
'border-b border-b-solid border-b-stroke-secondary',
|
|
25
18
|
]);
|
|
26
19
|
|
|
27
20
|
// ── Title ───────────────────────────────────────────────────
|
|
@@ -30,12 +23,12 @@ export const cardTitleVariants = cva(['flex-1']);
|
|
|
30
23
|
|
|
31
24
|
// ── Content ─────────────────────────────────────────────────
|
|
32
25
|
|
|
33
|
-
export const cardContentVariants = cva([
|
|
26
|
+
export const cardContentVariants = cva(['text-content-primary', 'p-4']);
|
|
34
27
|
|
|
35
28
|
// ── Footer ──────────────────────────────────────────────────
|
|
36
29
|
|
|
37
30
|
export const cardFooterVariants = cva([
|
|
38
31
|
'p-4 border-t',
|
|
39
|
-
|
|
32
|
+
'border-stroke-secondary',
|
|
40
33
|
'flex-row items-center gap-2',
|
|
41
34
|
]);
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { forwardRef, type ReactNode } from 'react';
|
|
2
|
+
import { Pressable, Text, View, type TextProps, type ViewProps } from 'react-native';
|
|
3
|
+
import {
|
|
4
|
+
createListItem,
|
|
5
|
+
type IListItemLeadingSlotProps,
|
|
6
|
+
type IListItemProps,
|
|
7
|
+
type IListItemSectionHeaderProps,
|
|
8
|
+
type ListItemCrossAlign,
|
|
9
|
+
} from '@cdx-ui/primitives';
|
|
10
|
+
import { cn, useStyleContext, withStyleContext, type WithStyleContextProps } from '@cdx-ui/utils';
|
|
11
|
+
import {
|
|
12
|
+
listItemContentVariants,
|
|
13
|
+
listItemDescriptionVariants,
|
|
14
|
+
listItemLeadingSlotVariants,
|
|
15
|
+
listItemMetaVariants,
|
|
16
|
+
listItemRootVariants,
|
|
17
|
+
listItemSectionHeaderLabelVariants,
|
|
18
|
+
listItemSectionHeaderVariants,
|
|
19
|
+
listItemTitleVariants,
|
|
20
|
+
listItemTrailingSlotVariants,
|
|
21
|
+
type ListItemVariantProps,
|
|
22
|
+
} from './styles';
|
|
23
|
+
|
|
24
|
+
const SCOPE = 'LIST_ITEM';
|
|
25
|
+
|
|
26
|
+
const RootView = withStyleContext(View, SCOPE);
|
|
27
|
+
const RootPressable = withStyleContext(Pressable, SCOPE);
|
|
28
|
+
|
|
29
|
+
const ListItemPrimitive = createListItem({
|
|
30
|
+
View: RootView,
|
|
31
|
+
Pressable: RootPressable,
|
|
32
|
+
LeadingSlot: View,
|
|
33
|
+
Content: View,
|
|
34
|
+
Title: Text,
|
|
35
|
+
Description: Text,
|
|
36
|
+
Meta: Text,
|
|
37
|
+
TrailingSlot: View,
|
|
38
|
+
SectionHeader: View,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const useListItemStyleContext = (): Pick<ListItemVariantProps, 'size' | 'crossAlign'> => {
|
|
42
|
+
const ctx = useStyleContext(SCOPE) as ListItemVariantProps | undefined;
|
|
43
|
+
return { size: ctx?.size ?? 'default', crossAlign: ctx?.crossAlign ?? 'center' };
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// =============================================================================
|
|
47
|
+
// ROOT
|
|
48
|
+
// =============================================================================
|
|
49
|
+
|
|
50
|
+
export interface ListItemProps extends IListItemProps, WithStyleContextProps {
|
|
51
|
+
className?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const ListItemRoot = forwardRef<View, ListItemProps>(
|
|
55
|
+
(
|
|
56
|
+
{
|
|
57
|
+
size = 'default',
|
|
58
|
+
surface = 'default',
|
|
59
|
+
showSeparator = true,
|
|
60
|
+
crossAlign = 'center',
|
|
61
|
+
className,
|
|
62
|
+
style,
|
|
63
|
+
...props
|
|
64
|
+
},
|
|
65
|
+
ref,
|
|
66
|
+
) => {
|
|
67
|
+
const computedClassName = cn(
|
|
68
|
+
listItemRootVariants({ size, surface, showSeparator, crossAlign }),
|
|
69
|
+
className,
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<ListItemPrimitive
|
|
74
|
+
ref={ref as never}
|
|
75
|
+
className={computedClassName}
|
|
76
|
+
context={{ size, surface, showSeparator, crossAlign }}
|
|
77
|
+
crossAlign={crossAlign}
|
|
78
|
+
showSeparator={showSeparator}
|
|
79
|
+
size={size}
|
|
80
|
+
style={style}
|
|
81
|
+
surface={surface}
|
|
82
|
+
{...props}
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
ListItemRoot.displayName = 'ListItem';
|
|
89
|
+
|
|
90
|
+
// =============================================================================
|
|
91
|
+
// SLOTS & TEXT
|
|
92
|
+
// =============================================================================
|
|
93
|
+
|
|
94
|
+
export interface ListItemLeadingSlotProps extends IListItemLeadingSlotProps {
|
|
95
|
+
className?: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const ListItemLeadingSlot = forwardRef<View, ListItemLeadingSlotProps>(
|
|
99
|
+
({ className, style, ...props }, ref) => (
|
|
100
|
+
<ListItemPrimitive.LeadingSlot
|
|
101
|
+
ref={ref as never}
|
|
102
|
+
className={cn(listItemLeadingSlotVariants(), className)}
|
|
103
|
+
style={style}
|
|
104
|
+
{...props}
|
|
105
|
+
/>
|
|
106
|
+
),
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
ListItemLeadingSlot.displayName = 'ListItem.LeadingSlot';
|
|
110
|
+
|
|
111
|
+
export interface ListItemContentProps extends ViewProps {
|
|
112
|
+
className?: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const ListItemContent = forwardRef<View, ListItemContentProps>(
|
|
116
|
+
({ className, style, ...props }, ref) => {
|
|
117
|
+
const { crossAlign } = useListItemStyleContext();
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<ListItemPrimitive.Content
|
|
121
|
+
ref={ref as never}
|
|
122
|
+
className={cn(listItemContentVariants({ crossAlign }), className)}
|
|
123
|
+
style={style}
|
|
124
|
+
{...props}
|
|
125
|
+
/>
|
|
126
|
+
);
|
|
127
|
+
},
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
ListItemContent.displayName = 'ListItem.Content';
|
|
131
|
+
|
|
132
|
+
export interface ListItemTitleProps extends TextProps {
|
|
133
|
+
className?: string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const ListItemTitle = forwardRef<Text, ListItemTitleProps>(
|
|
137
|
+
({ className, numberOfLines = 1, style, ...props }, ref) => {
|
|
138
|
+
const { size } = useListItemStyleContext();
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<ListItemPrimitive.Title
|
|
142
|
+
ref={ref as never}
|
|
143
|
+
className={cn(listItemTitleVariants({ size }), className)}
|
|
144
|
+
numberOfLines={numberOfLines}
|
|
145
|
+
style={style}
|
|
146
|
+
{...props}
|
|
147
|
+
/>
|
|
148
|
+
);
|
|
149
|
+
},
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
ListItemTitle.displayName = 'ListItem.Title';
|
|
153
|
+
|
|
154
|
+
export interface ListItemDescriptionProps extends TextProps {
|
|
155
|
+
className?: string;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const ListItemDescription = forwardRef<Text, ListItemDescriptionProps>(
|
|
159
|
+
({ className, style, ...props }, ref) => {
|
|
160
|
+
const { size } = useListItemStyleContext();
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<ListItemPrimitive.Description
|
|
164
|
+
ref={ref as never}
|
|
165
|
+
className={cn(listItemDescriptionVariants({ size }), className)}
|
|
166
|
+
style={style}
|
|
167
|
+
{...props}
|
|
168
|
+
/>
|
|
169
|
+
);
|
|
170
|
+
},
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
ListItemDescription.displayName = 'ListItem.Description';
|
|
174
|
+
|
|
175
|
+
export interface ListItemMetaProps extends TextProps {
|
|
176
|
+
className?: string;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const ListItemMeta = forwardRef<Text, ListItemMetaProps>(
|
|
180
|
+
({ className, numberOfLines = 1, style, ...props }, ref) => {
|
|
181
|
+
const { size } = useListItemStyleContext();
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
<ListItemPrimitive.Meta
|
|
185
|
+
ref={ref as never}
|
|
186
|
+
className={cn(listItemMetaVariants({ size }), className)}
|
|
187
|
+
numberOfLines={numberOfLines}
|
|
188
|
+
style={style}
|
|
189
|
+
{...props}
|
|
190
|
+
/>
|
|
191
|
+
);
|
|
192
|
+
},
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
ListItemMeta.displayName = 'ListItem.Meta';
|
|
196
|
+
|
|
197
|
+
export interface ListItemTrailingSlotProps extends ViewProps {
|
|
198
|
+
className?: string;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const ListItemTrailingSlot = forwardRef<View, ListItemTrailingSlotProps>(
|
|
202
|
+
({ className, style, ...props }, ref) => {
|
|
203
|
+
const { crossAlign } = useListItemStyleContext();
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<ListItemPrimitive.TrailingSlot
|
|
207
|
+
ref={ref as never}
|
|
208
|
+
className={cn(listItemTrailingSlotVariants({ crossAlign }), className)}
|
|
209
|
+
style={style}
|
|
210
|
+
{...props}
|
|
211
|
+
/>
|
|
212
|
+
);
|
|
213
|
+
},
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
ListItemTrailingSlot.displayName = 'ListItem.TrailingSlot';
|
|
217
|
+
|
|
218
|
+
const wrapSectionHeaderLabel = (children: ReactNode): ReactNode => {
|
|
219
|
+
if (typeof children === 'string' || typeof children === 'number') {
|
|
220
|
+
return <Text className={cn(listItemSectionHeaderLabelVariants())}>{children}</Text>;
|
|
221
|
+
}
|
|
222
|
+
return children;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
// =============================================================================
|
|
226
|
+
// SECTION HEADER
|
|
227
|
+
// =============================================================================
|
|
228
|
+
|
|
229
|
+
export interface ListItemSectionHeaderComponentProps extends IListItemSectionHeaderProps {
|
|
230
|
+
className?: string;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const ListItemSectionHeader = forwardRef<View, ListItemSectionHeaderComponentProps>(
|
|
234
|
+
({ children, className, showDivider = true, style, trailing, ...props }, ref) => (
|
|
235
|
+
<ListItemPrimitive.SectionHeader
|
|
236
|
+
ref={ref as never}
|
|
237
|
+
className={cn(listItemSectionHeaderVariants({ showDivider }), className)}
|
|
238
|
+
showDivider={showDivider}
|
|
239
|
+
style={style}
|
|
240
|
+
trailing={trailing}
|
|
241
|
+
{...props}
|
|
242
|
+
>
|
|
243
|
+
{wrapSectionHeaderLabel(children)}
|
|
244
|
+
</ListItemPrimitive.SectionHeader>
|
|
245
|
+
),
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
ListItemSectionHeader.displayName = 'ListItem.SectionHeader';
|
|
249
|
+
|
|
250
|
+
// =============================================================================
|
|
251
|
+
// COMPOUND EXPORT
|
|
252
|
+
// =============================================================================
|
|
253
|
+
|
|
254
|
+
type ListItemCompound = typeof ListItemRoot & {
|
|
255
|
+
LeadingSlot: typeof ListItemLeadingSlot;
|
|
256
|
+
Content: typeof ListItemContent;
|
|
257
|
+
Title: typeof ListItemTitle;
|
|
258
|
+
Description: typeof ListItemDescription;
|
|
259
|
+
Meta: typeof ListItemMeta;
|
|
260
|
+
TrailingSlot: typeof ListItemTrailingSlot;
|
|
261
|
+
SectionHeader: typeof ListItemSectionHeader;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
export const ListItem = Object.assign(ListItemRoot, {
|
|
265
|
+
LeadingSlot: ListItemLeadingSlot,
|
|
266
|
+
Content: ListItemContent,
|
|
267
|
+
Title: ListItemTitle,
|
|
268
|
+
Description: ListItemDescription,
|
|
269
|
+
Meta: ListItemMeta,
|
|
270
|
+
TrailingSlot: ListItemTrailingSlot,
|
|
271
|
+
SectionHeader: ListItemSectionHeader,
|
|
272
|
+
}) as ListItemCompound;
|
|
273
|
+
|
|
274
|
+
export type { ListItemCrossAlign, ListItemVariantProps };
|
|
275
|
+
export {
|
|
276
|
+
listItemContentVariants,
|
|
277
|
+
listItemDescriptionVariants,
|
|
278
|
+
listItemLeadingSlotVariants,
|
|
279
|
+
listItemMetaVariants,
|
|
280
|
+
listItemRootVariants,
|
|
281
|
+
listItemSectionHeaderLabelVariants,
|
|
282
|
+
listItemSectionHeaderVariants,
|
|
283
|
+
listItemTitleVariants,
|
|
284
|
+
listItemTrailingSlotVariants,
|
|
285
|
+
} from './styles';
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import {
|
|
4
|
+
COLOR_BORDER_DEFAULT,
|
|
5
|
+
COLOR_TEXT_MUTED,
|
|
6
|
+
COLOR_TEXT_PRIMARY,
|
|
7
|
+
COLOR_TEXT_SECONDARY,
|
|
8
|
+
TRANSITION_COLORS,
|
|
9
|
+
} from '../../styles/primitives';
|
|
10
|
+
|
|
11
|
+
// ── Root (row): density, surface, separator, interactive feedback ──────────
|
|
12
|
+
|
|
13
|
+
export const listItemRootVariants = cva(
|
|
14
|
+
[
|
|
15
|
+
'flex-row self-stretch w-full px-4',
|
|
16
|
+
'data-[disabled=true]:opacity-50 data-[disabled=true]:pointer-events-none',
|
|
17
|
+
'data-[active=true]:opacity-70',
|
|
18
|
+
TRANSITION_COLORS,
|
|
19
|
+
Platform.select({
|
|
20
|
+
web: [
|
|
21
|
+
'outline-none',
|
|
22
|
+
'web:data-[hovered=true]:bg-slate-50',
|
|
23
|
+
'web:focus-visible:data-[disabled=false]:bg-slate-50',
|
|
24
|
+
'web:focus-visible:data-[disabled=false]:ring-2 web:focus-visible:data-[disabled=false]:ring-slate-400/40 web:focus-visible:data-[disabled=false]:ring-offset-2',
|
|
25
|
+
].join(' '),
|
|
26
|
+
default: '',
|
|
27
|
+
}),
|
|
28
|
+
],
|
|
29
|
+
{
|
|
30
|
+
variants: {
|
|
31
|
+
size: {
|
|
32
|
+
default: 'gap-3 py-4',
|
|
33
|
+
compact: 'gap-2 py-3',
|
|
34
|
+
},
|
|
35
|
+
surface: {
|
|
36
|
+
default: 'bg-white',
|
|
37
|
+
negative: 'bg-red-50',
|
|
38
|
+
},
|
|
39
|
+
showSeparator: {
|
|
40
|
+
true: ['border-b border-solid', COLOR_BORDER_DEFAULT],
|
|
41
|
+
false: 'border-b-0',
|
|
42
|
+
},
|
|
43
|
+
crossAlign: {
|
|
44
|
+
center: 'items-center',
|
|
45
|
+
start: 'items-start',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
compoundVariants: [
|
|
49
|
+
{
|
|
50
|
+
surface: 'negative',
|
|
51
|
+
className: Platform.select({
|
|
52
|
+
web: 'web:data-[hovered=true]:bg-red-100/90',
|
|
53
|
+
default: '',
|
|
54
|
+
}),
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
defaultVariants: {
|
|
58
|
+
size: 'default',
|
|
59
|
+
surface: 'default',
|
|
60
|
+
showSeparator: true,
|
|
61
|
+
crossAlign: 'center',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
// ── Leading / trailing slots ─────────────────────────────────────────────────
|
|
67
|
+
|
|
68
|
+
export const listItemLeadingSlotVariants = cva(['flex shrink-0 items-center justify-center']);
|
|
69
|
+
|
|
70
|
+
export const listItemTrailingSlotVariants = cva(['flex shrink-0 flex-row justify-end gap-2'], {
|
|
71
|
+
variants: {
|
|
72
|
+
crossAlign: {
|
|
73
|
+
center: 'items-center',
|
|
74
|
+
start: 'items-start self-start',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
defaultVariants: {
|
|
78
|
+
crossAlign: 'center',
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// ── Content stack (title / description / meta) ───────────────────────────────
|
|
83
|
+
|
|
84
|
+
export const listItemContentVariants = cva(['flex min-w-0 flex-1 flex-col gap-1'], {
|
|
85
|
+
variants: {
|
|
86
|
+
crossAlign: {
|
|
87
|
+
center: 'justify-center',
|
|
88
|
+
start: 'justify-start',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
defaultVariants: {
|
|
92
|
+
crossAlign: 'center',
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// ── Typography ───────────────────────────────────────────────────────────────
|
|
97
|
+
|
|
98
|
+
export const listItemTitleVariants = cva([COLOR_TEXT_PRIMARY, 'font-medium'], {
|
|
99
|
+
variants: {
|
|
100
|
+
size: {
|
|
101
|
+
default: 'text-base leading-snug',
|
|
102
|
+
compact: 'text-sm leading-snug',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
defaultVariants: {
|
|
106
|
+
size: 'default',
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
export const listItemDescriptionVariants = cva([COLOR_TEXT_SECONDARY], {
|
|
111
|
+
variants: {
|
|
112
|
+
size: {
|
|
113
|
+
default: 'text-sm leading-normal',
|
|
114
|
+
compact: 'text-xs leading-normal',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
defaultVariants: {
|
|
118
|
+
size: 'default',
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
export const listItemMetaVariants = cva([COLOR_TEXT_MUTED], {
|
|
123
|
+
variants: {
|
|
124
|
+
size: {
|
|
125
|
+
default: 'text-xs leading-normal',
|
|
126
|
+
compact: 'text-[11px] leading-normal',
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
defaultVariants: {
|
|
130
|
+
size: 'default',
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// ── Section header (group label row inside lists / cards) ───────────────────
|
|
135
|
+
|
|
136
|
+
export const listItemSectionHeaderVariants = cva(
|
|
137
|
+
[
|
|
138
|
+
'flex-row items-center justify-between gap-2 border-b border-solid px-4 py-3',
|
|
139
|
+
COLOR_BORDER_DEFAULT,
|
|
140
|
+
],
|
|
141
|
+
{
|
|
142
|
+
variants: {
|
|
143
|
+
showDivider: {
|
|
144
|
+
true: ['border-t-4 border-solid border-t-surface-brand-strong/40', 'border-x-0'],
|
|
145
|
+
false: 'border-t-0',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
defaultVariants: {
|
|
149
|
+
showDivider: true,
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
/** Default section-title typography; applied by `ListItem.SectionHeader` for string/number children. Exported for rare custom composition. */
|
|
155
|
+
export const listItemSectionHeaderLabelVariants = cva([
|
|
156
|
+
'text-xs font-semibold uppercase tracking-wide',
|
|
157
|
+
COLOR_TEXT_SECONDARY,
|
|
158
|
+
]);
|
|
159
|
+
|
|
160
|
+
export type ListItemVariantProps = VariantProps<typeof listItemRootVariants>;
|
package/src/components/index.ts
CHANGED
package/src/styles/primitives.ts
CHANGED
|
File without changes
|