@cdx-ui/primitives 0.0.1-beta.4 → 0.0.1-beta.5

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.
Files changed (85) hide show
  1. package/lib/commonjs/index.js +12 -0
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/list-item/context.js +11 -0
  4. package/lib/commonjs/list-item/context.js.map +1 -0
  5. package/lib/commonjs/list-item/createListItemContent.js +30 -0
  6. package/lib/commonjs/list-item/createListItemContent.js.map +1 -0
  7. package/lib/commonjs/list-item/createListItemDescription.js +25 -0
  8. package/lib/commonjs/list-item/createListItemDescription.js.map +1 -0
  9. package/lib/commonjs/list-item/createListItemLeadingSlot.js +34 -0
  10. package/lib/commonjs/list-item/createListItemLeadingSlot.js.map +1 -0
  11. package/lib/commonjs/list-item/createListItemMeta.js +25 -0
  12. package/lib/commonjs/list-item/createListItemMeta.js.map +1 -0
  13. package/lib/commonjs/list-item/createListItemRoot.js +142 -0
  14. package/lib/commonjs/list-item/createListItemRoot.js.map +1 -0
  15. package/lib/commonjs/list-item/createListItemSectionHeader.js +54 -0
  16. package/lib/commonjs/list-item/createListItemSectionHeader.js.map +1 -0
  17. package/lib/commonjs/list-item/createListItemTitle.js +25 -0
  18. package/lib/commonjs/list-item/createListItemTitle.js.map +1 -0
  19. package/lib/commonjs/list-item/createListItemTrailingSlot.js +28 -0
  20. package/lib/commonjs/list-item/createListItemTrailingSlot.js.map +1 -0
  21. package/lib/commonjs/list-item/index.js +55 -0
  22. package/lib/commonjs/list-item/index.js.map +1 -0
  23. package/lib/commonjs/list-item/types.js +6 -0
  24. package/lib/commonjs/list-item/types.js.map +1 -0
  25. package/lib/module/index.js +1 -0
  26. package/lib/module/index.js.map +1 -1
  27. package/lib/module/list-item/context.js +5 -0
  28. package/lib/module/list-item/context.js.map +1 -0
  29. package/lib/module/list-item/createListItemContent.js +24 -0
  30. package/lib/module/list-item/createListItemContent.js.map +1 -0
  31. package/lib/module/list-item/createListItemDescription.js +19 -0
  32. package/lib/module/list-item/createListItemDescription.js.map +1 -0
  33. package/lib/module/list-item/createListItemLeadingSlot.js +28 -0
  34. package/lib/module/list-item/createListItemLeadingSlot.js.map +1 -0
  35. package/lib/module/list-item/createListItemMeta.js +19 -0
  36. package/lib/module/list-item/createListItemMeta.js.map +1 -0
  37. package/lib/module/list-item/createListItemRoot.js +136 -0
  38. package/lib/module/list-item/createListItemRoot.js.map +1 -0
  39. package/lib/module/list-item/createListItemSectionHeader.js +48 -0
  40. package/lib/module/list-item/createListItemSectionHeader.js.map +1 -0
  41. package/lib/module/list-item/createListItemTitle.js +19 -0
  42. package/lib/module/list-item/createListItemTitle.js.map +1 -0
  43. package/lib/module/list-item/createListItemTrailingSlot.js +22 -0
  44. package/lib/module/list-item/createListItemTrailingSlot.js.map +1 -0
  45. package/lib/module/list-item/index.js +39 -0
  46. package/lib/module/list-item/index.js.map +1 -0
  47. package/lib/module/list-item/types.js +4 -0
  48. package/lib/module/list-item/types.js.map +1 -0
  49. package/lib/typescript/index.d.ts +1 -0
  50. package/lib/typescript/index.d.ts.map +1 -1
  51. package/lib/typescript/list-item/context.d.ts +6 -0
  52. package/lib/typescript/list-item/context.d.ts.map +1 -0
  53. package/lib/typescript/list-item/createListItemContent.d.ts +3 -0
  54. package/lib/typescript/list-item/createListItemContent.d.ts.map +1 -0
  55. package/lib/typescript/list-item/createListItemDescription.d.ts +3 -0
  56. package/lib/typescript/list-item/createListItemDescription.d.ts.map +1 -0
  57. package/lib/typescript/list-item/createListItemLeadingSlot.d.ts +4 -0
  58. package/lib/typescript/list-item/createListItemLeadingSlot.d.ts.map +1 -0
  59. package/lib/typescript/list-item/createListItemMeta.d.ts +3 -0
  60. package/lib/typescript/list-item/createListItemMeta.d.ts.map +1 -0
  61. package/lib/typescript/list-item/createListItemRoot.d.ts +4 -0
  62. package/lib/typescript/list-item/createListItemRoot.d.ts.map +1 -0
  63. package/lib/typescript/list-item/createListItemSectionHeader.d.ts +4 -0
  64. package/lib/typescript/list-item/createListItemSectionHeader.d.ts.map +1 -0
  65. package/lib/typescript/list-item/createListItemTitle.d.ts +3 -0
  66. package/lib/typescript/list-item/createListItemTitle.d.ts.map +1 -0
  67. package/lib/typescript/list-item/createListItemTrailingSlot.d.ts +3 -0
  68. package/lib/typescript/list-item/createListItemTrailingSlot.d.ts.map +1 -0
  69. package/lib/typescript/list-item/index.d.ts +16 -0
  70. package/lib/typescript/list-item/index.d.ts.map +1 -0
  71. package/lib/typescript/list-item/types.d.ts +86 -0
  72. package/lib/typescript/list-item/types.d.ts.map +1 -0
  73. package/package.json +2 -2
  74. package/src/index.ts +1 -0
  75. package/src/list-item/context.tsx +5 -0
  76. package/src/list-item/createListItemContent.tsx +23 -0
  77. package/src/list-item/createListItemDescription.tsx +19 -0
  78. package/src/list-item/createListItemLeadingSlot.tsx +30 -0
  79. package/src/list-item/createListItemMeta.tsx +17 -0
  80. package/src/list-item/createListItemRoot.tsx +163 -0
  81. package/src/list-item/createListItemSectionHeader.tsx +53 -0
  82. package/src/list-item/createListItemTitle.tsx +17 -0
  83. package/src/list-item/createListItemTrailingSlot.tsx +21 -0
  84. package/src/list-item/index.ts +88 -0
  85. 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
+ };