@cdx-ui/primitives 0.0.1-beta.4 → 0.0.1-beta.6
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 -0
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/list-item/context.js +11 -0
- package/lib/commonjs/list-item/context.js.map +1 -0
- package/lib/commonjs/list-item/createListItemContent.js +30 -0
- package/lib/commonjs/list-item/createListItemContent.js.map +1 -0
- package/lib/commonjs/list-item/createListItemDescription.js +25 -0
- package/lib/commonjs/list-item/createListItemDescription.js.map +1 -0
- package/lib/commonjs/list-item/createListItemLeadingSlot.js +34 -0
- package/lib/commonjs/list-item/createListItemLeadingSlot.js.map +1 -0
- package/lib/commonjs/list-item/createListItemMeta.js +25 -0
- package/lib/commonjs/list-item/createListItemMeta.js.map +1 -0
- package/lib/commonjs/list-item/createListItemRoot.js +142 -0
- package/lib/commonjs/list-item/createListItemRoot.js.map +1 -0
- package/lib/commonjs/list-item/createListItemSectionHeader.js +54 -0
- package/lib/commonjs/list-item/createListItemSectionHeader.js.map +1 -0
- package/lib/commonjs/list-item/createListItemTitle.js +25 -0
- package/lib/commonjs/list-item/createListItemTitle.js.map +1 -0
- package/lib/commonjs/list-item/createListItemTrailingSlot.js +28 -0
- package/lib/commonjs/list-item/createListItemTrailingSlot.js.map +1 -0
- package/lib/commonjs/list-item/index.js +55 -0
- package/lib/commonjs/list-item/index.js.map +1 -0
- package/lib/commonjs/list-item/types.js +6 -0
- package/lib/commonjs/list-item/types.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/list-item/context.js +5 -0
- package/lib/module/list-item/context.js.map +1 -0
- package/lib/module/list-item/createListItemContent.js +24 -0
- package/lib/module/list-item/createListItemContent.js.map +1 -0
- package/lib/module/list-item/createListItemDescription.js +19 -0
- package/lib/module/list-item/createListItemDescription.js.map +1 -0
- package/lib/module/list-item/createListItemLeadingSlot.js +28 -0
- package/lib/module/list-item/createListItemLeadingSlot.js.map +1 -0
- package/lib/module/list-item/createListItemMeta.js +19 -0
- package/lib/module/list-item/createListItemMeta.js.map +1 -0
- package/lib/module/list-item/createListItemRoot.js +136 -0
- package/lib/module/list-item/createListItemRoot.js.map +1 -0
- package/lib/module/list-item/createListItemSectionHeader.js +48 -0
- package/lib/module/list-item/createListItemSectionHeader.js.map +1 -0
- package/lib/module/list-item/createListItemTitle.js +19 -0
- package/lib/module/list-item/createListItemTitle.js.map +1 -0
- package/lib/module/list-item/createListItemTrailingSlot.js +22 -0
- package/lib/module/list-item/createListItemTrailingSlot.js.map +1 -0
- package/lib/module/list-item/index.js +39 -0
- package/lib/module/list-item/index.js.map +1 -0
- package/lib/module/list-item/types.js +4 -0
- package/lib/module/list-item/types.js.map +1 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/list-item/context.d.ts +6 -0
- package/lib/typescript/list-item/context.d.ts.map +1 -0
- package/lib/typescript/list-item/createListItemContent.d.ts +3 -0
- package/lib/typescript/list-item/createListItemContent.d.ts.map +1 -0
- package/lib/typescript/list-item/createListItemDescription.d.ts +3 -0
- package/lib/typescript/list-item/createListItemDescription.d.ts.map +1 -0
- package/lib/typescript/list-item/createListItemLeadingSlot.d.ts +4 -0
- package/lib/typescript/list-item/createListItemLeadingSlot.d.ts.map +1 -0
- package/lib/typescript/list-item/createListItemMeta.d.ts +3 -0
- package/lib/typescript/list-item/createListItemMeta.d.ts.map +1 -0
- package/lib/typescript/list-item/createListItemRoot.d.ts +4 -0
- package/lib/typescript/list-item/createListItemRoot.d.ts.map +1 -0
- package/lib/typescript/list-item/createListItemSectionHeader.d.ts +4 -0
- package/lib/typescript/list-item/createListItemSectionHeader.d.ts.map +1 -0
- package/lib/typescript/list-item/createListItemTitle.d.ts +3 -0
- package/lib/typescript/list-item/createListItemTitle.d.ts.map +1 -0
- package/lib/typescript/list-item/createListItemTrailingSlot.d.ts +3 -0
- package/lib/typescript/list-item/createListItemTrailingSlot.d.ts.map +1 -0
- package/lib/typescript/list-item/index.d.ts +16 -0
- package/lib/typescript/list-item/index.d.ts.map +1 -0
- package/lib/typescript/list-item/types.d.ts +86 -0
- package/lib/typescript/list-item/types.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/list-item/context.tsx +5 -0
- package/src/list-item/createListItemContent.tsx +23 -0
- package/src/list-item/createListItemDescription.tsx +19 -0
- package/src/list-item/createListItemLeadingSlot.tsx +30 -0
- package/src/list-item/createListItemMeta.tsx +17 -0
- package/src/list-item/createListItemRoot.tsx +163 -0
- package/src/list-item/createListItemSectionHeader.tsx +53 -0
- package/src/list-item/createListItemTitle.tsx +17 -0
- package/src/list-item/createListItemTrailingSlot.tsx +21 -0
- package/src/list-item/index.ts +88 -0
- package/src/list-item/types.ts +122 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, PropsWithoutRef, ReactNode, RefAttributes } from 'react';
|
|
2
|
+
import type { PressableProps, TextProps, ViewProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export type ListItemSize = 'default' | 'compact';
|
|
5
|
+
|
|
6
|
+
export type ListItemSurface = 'default' | 'negative';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Cross-axis alignment for the row (`flex-direction: row`).
|
|
10
|
+
* - **center**: Leading, content, and trailing are vertically centered (typical transactions).
|
|
11
|
+
* - **start**: Top-aligned — use when trailing text should align with the title row (e.g. branch distance “2.04 mi”) or status chips sit above a tall content stack.
|
|
12
|
+
*/
|
|
13
|
+
export type ListItemCrossAlign = 'center' | 'start';
|
|
14
|
+
|
|
15
|
+
export type IListItemPressablePassthrough = Partial<
|
|
16
|
+
Pick<PressableProps, 'onPressIn' | 'onPressOut' | 'onHoverIn' | 'onHoverOut'>
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
export interface IListItemProps extends ViewProps, IListItemPressablePassthrough {
|
|
20
|
+
/**
|
|
21
|
+
* Disables press handling when the root is pressable (maps to Pressable `disabled`).
|
|
22
|
+
*/
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* When set (and `asChild` is not used), root renders as pressable with interaction props.
|
|
26
|
+
*/
|
|
27
|
+
onPress?: PressableProps['onPress'];
|
|
28
|
+
/**
|
|
29
|
+
* Vertical density; mapped at styled layer via `data-size`.
|
|
30
|
+
* @default 'default'
|
|
31
|
+
*/
|
|
32
|
+
size?: ListItemSize;
|
|
33
|
+
/**
|
|
34
|
+
* Semantic row surface (e.g. canceled transaction); mapped via `data-surface`.
|
|
35
|
+
* @default 'default'
|
|
36
|
+
*/
|
|
37
|
+
surface?: ListItemSurface;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the row shows a bottom separator; mapped via `data-separator`.
|
|
40
|
+
* @default true
|
|
41
|
+
*/
|
|
42
|
+
showSeparator?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Vertical alignment of leading / content / trailing along the row cross axis.
|
|
45
|
+
* @default 'center'
|
|
46
|
+
*/
|
|
47
|
+
crossAlign?: ListItemCrossAlign;
|
|
48
|
+
/**
|
|
49
|
+
* Merge interaction props onto a single child instead of rendering the default pressable root.
|
|
50
|
+
* Intended for use with `onPress`.
|
|
51
|
+
*/
|
|
52
|
+
asChild?: boolean;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface IListItemContextValue {
|
|
56
|
+
isPressed: boolean;
|
|
57
|
+
isHovered: boolean;
|
|
58
|
+
isDisabled: boolean;
|
|
59
|
+
crossAlign: ListItemCrossAlign;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface IListItemLeadingSlotProps extends ViewProps {
|
|
63
|
+
/**
|
|
64
|
+
* Decorative leading content defaults to hidden from the accessibility tree.
|
|
65
|
+
* Set to `false` when the leading region contains meaningful controls.
|
|
66
|
+
* @default true
|
|
67
|
+
*/
|
|
68
|
+
'aria-hidden'?: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type IListItemContentProps = ViewProps;
|
|
72
|
+
|
|
73
|
+
export type IListItemTitleProps = TextProps;
|
|
74
|
+
|
|
75
|
+
export type IListItemDescriptionProps = TextProps;
|
|
76
|
+
|
|
77
|
+
export type IListItemMetaProps = TextProps;
|
|
78
|
+
|
|
79
|
+
export type IListItemTrailingSlotProps = ViewProps;
|
|
80
|
+
|
|
81
|
+
export interface IListItemSectionHeaderProps extends ViewProps {
|
|
82
|
+
/** Primary section label (e.g. date heading). */
|
|
83
|
+
children: ReactNode;
|
|
84
|
+
/** Optional right-aligned adornment (e.g. section Chip). */
|
|
85
|
+
trailing?: ReactNode;
|
|
86
|
+
/**
|
|
87
|
+
* Whether to expose the top divider marker for styling (`data-divider`).
|
|
88
|
+
* @default true
|
|
89
|
+
*/
|
|
90
|
+
showDivider?: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export type IListItemComponentType<
|
|
94
|
+
RootRef,
|
|
95
|
+
LeadingSlot,
|
|
96
|
+
Content,
|
|
97
|
+
Title,
|
|
98
|
+
Description,
|
|
99
|
+
Meta,
|
|
100
|
+
TrailingSlot,
|
|
101
|
+
SectionHeader,
|
|
102
|
+
> = ForwardRefExoticComponent<RefAttributes<RootRef> & IListItemProps> & {
|
|
103
|
+
LeadingSlot: ForwardRefExoticComponent<
|
|
104
|
+
RefAttributes<LeadingSlot> & PropsWithoutRef<LeadingSlot> & IListItemLeadingSlotProps
|
|
105
|
+
>;
|
|
106
|
+
Content: ForwardRefExoticComponent<
|
|
107
|
+
RefAttributes<Content> & PropsWithoutRef<Content> & IListItemContentProps
|
|
108
|
+
>;
|
|
109
|
+
Title: ForwardRefExoticComponent<
|
|
110
|
+
RefAttributes<Title> & PropsWithoutRef<Title> & IListItemTitleProps
|
|
111
|
+
>;
|
|
112
|
+
Description: ForwardRefExoticComponent<
|
|
113
|
+
RefAttributes<Description> & PropsWithoutRef<Description> & IListItemDescriptionProps
|
|
114
|
+
>;
|
|
115
|
+
Meta: ForwardRefExoticComponent<RefAttributes<Meta> & PropsWithoutRef<Meta> & IListItemMetaProps>;
|
|
116
|
+
TrailingSlot: ForwardRefExoticComponent<
|
|
117
|
+
RefAttributes<TrailingSlot> & PropsWithoutRef<TrailingSlot> & IListItemTrailingSlotProps
|
|
118
|
+
>;
|
|
119
|
+
SectionHeader: ForwardRefExoticComponent<
|
|
120
|
+
RefAttributes<SectionHeader> & PropsWithoutRef<SectionHeader> & IListItemSectionHeaderProps
|
|
121
|
+
>;
|
|
122
|
+
};
|