@ledgerhq/lumen-ui-rnative 0.0.46 → 0.0.48

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 (148) hide show
  1. package/dist/package.json +6 -2
  2. package/dist/src/lib/Components/Divider/Divider.d.ts +25 -0
  3. package/dist/src/lib/Components/Divider/Divider.d.ts.map +1 -0
  4. package/dist/src/lib/Components/Divider/Divider.js +40 -0
  5. package/dist/src/lib/Components/Divider/Divider.stories.d.ts +9 -0
  6. package/dist/src/lib/Components/Divider/Divider.stories.d.ts.map +1 -0
  7. package/dist/src/lib/Components/Divider/Divider.stories.js +51 -0
  8. package/dist/src/lib/Components/Divider/index.d.ts +3 -0
  9. package/dist/src/lib/Components/Divider/index.d.ts.map +1 -0
  10. package/dist/src/lib/Components/Divider/index.js +1 -0
  11. package/dist/src/lib/Components/Divider/types.d.ts +9 -0
  12. package/dist/src/lib/Components/Divider/types.d.ts.map +1 -0
  13. package/dist/src/lib/Components/Icon/Icon.d.ts.map +1 -1
  14. package/dist/src/lib/Components/Icon/Icon.js +3 -4
  15. package/dist/src/lib/Components/Icon/createIcon.d.ts.map +1 -1
  16. package/dist/src/lib/Components/Icon/createIcon.js +1 -1
  17. package/dist/src/lib/Components/ListItem/ListItem.d.ts +88 -34
  18. package/dist/src/lib/Components/ListItem/ListItem.d.ts.map +1 -1
  19. package/dist/src/lib/Components/ListItem/ListItem.js +248 -97
  20. package/dist/src/lib/Components/ListItem/ListItem.stories.d.ts +2 -3
  21. package/dist/src/lib/Components/ListItem/ListItem.stories.d.ts.map +1 -1
  22. package/dist/src/lib/Components/ListItem/ListItem.stories.js +63 -73
  23. package/dist/src/lib/Components/ListItem/index.d.ts +1 -1
  24. package/dist/src/lib/Components/ListItem/index.d.ts.map +1 -1
  25. package/dist/src/lib/Components/ListItem/index.js +1 -1
  26. package/dist/src/lib/Components/ListItem/types.d.ts +106 -0
  27. package/dist/src/lib/Components/ListItem/types.d.ts.map +1 -0
  28. package/dist/src/lib/Components/ListItem/types.js +1 -0
  29. package/dist/src/lib/Components/Select/GlobalSelectBottomSheet.d.ts.map +1 -1
  30. package/dist/src/lib/Components/Select/GlobalSelectBottomSheet.js +2 -7
  31. package/dist/src/lib/Components/Select/Select.d.ts.map +1 -1
  32. package/dist/src/lib/Components/Select/Select.js +4 -10
  33. package/dist/src/lib/Components/Select/types.d.ts.map +1 -1
  34. package/dist/src/lib/Components/Spot/types.d.ts +1 -1
  35. package/dist/src/lib/Components/Spot/types.d.ts.map +1 -1
  36. package/dist/src/lib/Components/Tile/Tile.d.ts +84 -19
  37. package/dist/src/lib/Components/Tile/Tile.d.ts.map +1 -1
  38. package/dist/src/lib/Components/Tile/Tile.figma.js +8 -18
  39. package/dist/src/lib/Components/Tile/Tile.js +160 -59
  40. package/dist/src/lib/Components/Tile/Tile.stories.d.ts +2 -2
  41. package/dist/src/lib/Components/Tile/Tile.stories.d.ts.map +1 -1
  42. package/dist/src/lib/Components/Tile/Tile.stories.js +30 -81
  43. package/dist/src/lib/Components/Tile/index.d.ts +1 -1
  44. package/dist/src/lib/Components/Tile/index.d.ts.map +1 -1
  45. package/dist/src/lib/Components/Tile/index.js +1 -1
  46. package/dist/src/lib/Components/Tile/types.d.ts +29 -19
  47. package/dist/src/lib/Components/Tile/types.d.ts.map +1 -1
  48. package/dist/src/lib/Components/index.d.ts +1 -0
  49. package/dist/src/lib/Components/index.d.ts.map +1 -1
  50. package/dist/src/lib/Components/index.js +1 -0
  51. package/dist/src/lib/utils/index.d.ts +3 -4
  52. package/dist/src/lib/utils/index.d.ts.map +1 -1
  53. package/dist/src/lib/utils/index.js +3 -4
  54. package/dist/src/lib/utils/react/{extract-text-from-children.d.ts → extractTextFromChildren.d.ts} +1 -1
  55. package/dist/src/lib/utils/react/extractTextFromChildren.d.ts.map +1 -0
  56. package/dist/src/lib/utils/react/index.d.ts +1 -1
  57. package/dist/src/lib/utils/react/index.d.ts.map +1 -1
  58. package/dist/src/lib/utils/react/index.js +1 -1
  59. package/dist/src/lib/utils/startTransition/index.d.ts +2 -0
  60. package/dist/src/lib/utils/startTransition/index.d.ts.map +1 -0
  61. package/dist/src/lib/utils/startTransition/index.js +1 -0
  62. package/dist/src/lib/utils/{start-transition/start-transition.d.ts → startTransition/startTransition.d.ts} +1 -1
  63. package/dist/src/lib/utils/startTransition/startTransition.d.ts.map +1 -0
  64. package/dist/src/lib/utils/useControllableState/index.d.ts +2 -0
  65. package/dist/src/lib/utils/useControllableState/index.d.ts.map +1 -0
  66. package/dist/src/lib/utils/useControllableState/index.js +1 -0
  67. package/dist/src/lib/utils/{use-controllable-state/use-controllable-state.d.ts → useControllableState/useControllableState.d.ts} +1 -1
  68. package/dist/src/lib/utils/useControllableState/useControllableState.d.ts.map +1 -0
  69. package/dist/src/lib/utils/{use-controllable-state/use-controllable-state.js → useControllableState/useControllableState.js} +2 -2
  70. package/dist/src/lib/utils/useEvent/index.d.ts +3 -0
  71. package/dist/src/lib/utils/useEvent/index.d.ts.map +1 -0
  72. package/dist/src/lib/utils/useEvent/index.js +2 -0
  73. package/dist/src/lib/utils/{use-event/use-event.d.ts → useEvent/useEvent.d.ts} +1 -1
  74. package/dist/src/lib/utils/useEvent/useEvent.d.ts.map +1 -0
  75. package/dist/src/lib/utils/{use-event/use-event.js → useEvent/useEvent.js} +1 -1
  76. package/dist/src/lib/utils/{use-event/use-get.d.ts → useEvent/useGet.d.ts} +1 -1
  77. package/dist/src/lib/utils/useEvent/useGet.d.ts.map +1 -0
  78. package/dist/src/styles/provider/LumenStyleSheetProvider.d.ts +1 -1
  79. package/dist/src/styles/provider/LumenStyleSheetProvider.d.ts.map +1 -1
  80. package/dist/src/styles/provider/LumenStyleSheetProvider.js +1 -2
  81. package/package.json +6 -2
  82. package/src/lib/Components/Checkbox/Checkbox.mdx +1 -0
  83. package/src/lib/Components/Divider/Divider.mdx +151 -0
  84. package/src/lib/Components/Divider/Divider.stories.tsx +140 -0
  85. package/src/lib/Components/Divider/Divider.test.tsx +92 -0
  86. package/src/lib/Components/Divider/Divider.tsx +52 -0
  87. package/src/lib/Components/Divider/index.ts +2 -0
  88. package/src/lib/Components/Divider/types.ts +9 -0
  89. package/src/lib/Components/Icon/Icon.tsx +3 -5
  90. package/src/lib/Components/Icon/createIcon.ts +1 -1
  91. package/src/lib/Components/ListItem/ListItem.mdx +402 -124
  92. package/src/lib/Components/ListItem/ListItem.stories.tsx +357 -228
  93. package/src/lib/Components/ListItem/ListItem.tsx +444 -181
  94. package/src/lib/Components/ListItem/index.ts +1 -1
  95. package/src/lib/Components/ListItem/types.ts +121 -0
  96. package/src/lib/Components/Select/GlobalSelectBottomSheet.tsx +5 -7
  97. package/src/lib/Components/Select/Select.tsx +4 -18
  98. package/src/lib/Components/Select/types.ts +1 -3
  99. package/src/lib/Components/Spot/types.ts +5 -1
  100. package/src/lib/Components/Switch/Switch.mdx +1 -0
  101. package/src/lib/Components/Tile/Tile.figma.tsx +24 -23
  102. package/src/lib/Components/Tile/Tile.mdx +128 -35
  103. package/src/lib/Components/Tile/Tile.stories.tsx +167 -146
  104. package/src/lib/Components/Tile/Tile.test.tsx +193 -221
  105. package/src/lib/Components/Tile/Tile.tsx +270 -123
  106. package/src/lib/Components/Tile/index.ts +7 -1
  107. package/src/lib/Components/Tile/types.ts +38 -19
  108. package/src/lib/Components/index.ts +1 -0
  109. package/src/lib/utils/index.ts +3 -4
  110. package/src/lib/utils/react/index.ts +1 -1
  111. package/src/lib/utils/startTransition/index.ts +1 -0
  112. package/src/lib/utils/useControllableState/index.ts +1 -0
  113. package/src/lib/utils/{use-controllable-state/use-controllable-state.ts → useControllableState/useControllableState.ts} +2 -2
  114. package/src/lib/utils/useEvent/index.ts +2 -0
  115. package/src/lib/utils/{use-event/use-event.ts → useEvent/useEvent.ts} +1 -1
  116. package/src/styles/provider/LumenStyleSheetProvider.tsx +2 -3
  117. package/dist/src/lib/Components/ListItem/ListItem.types.d.ts +0 -31
  118. package/dist/src/lib/Components/ListItem/ListItem.types.d.ts.map +0 -1
  119. package/dist/src/lib/utils/react/extract-text-from-children.d.ts.map +0 -1
  120. package/dist/src/lib/utils/start-transition/index.d.ts +0 -2
  121. package/dist/src/lib/utils/start-transition/index.d.ts.map +0 -1
  122. package/dist/src/lib/utils/start-transition/index.js +0 -1
  123. package/dist/src/lib/utils/start-transition/start-transition.d.ts.map +0 -1
  124. package/dist/src/lib/utils/string-utils.d.ts +0 -6
  125. package/dist/src/lib/utils/string-utils.d.ts.map +0 -1
  126. package/dist/src/lib/utils/string-utils.js +0 -12
  127. package/dist/src/lib/utils/use-controllable-state/index.d.ts +0 -2
  128. package/dist/src/lib/utils/use-controllable-state/index.d.ts.map +0 -1
  129. package/dist/src/lib/utils/use-controllable-state/index.js +0 -1
  130. package/dist/src/lib/utils/use-controllable-state/use-controllable-state.d.ts.map +0 -1
  131. package/dist/src/lib/utils/use-event/index.d.ts +0 -3
  132. package/dist/src/lib/utils/use-event/index.d.ts.map +0 -1
  133. package/dist/src/lib/utils/use-event/index.js +0 -2
  134. package/dist/src/lib/utils/use-event/use-event.d.ts.map +0 -1
  135. package/dist/src/lib/utils/use-event/use-get.d.ts.map +0 -1
  136. package/src/lib/Components/ListItem/ListItem.types.ts +0 -31
  137. package/src/lib/utils/start-transition/index.ts +0 -1
  138. package/src/lib/utils/string-utils.test.ts +0 -73
  139. package/src/lib/utils/string-utils.ts +0 -11
  140. package/src/lib/utils/use-controllable-state/index.ts +0 -1
  141. package/src/lib/utils/use-event/index.ts +0 -2
  142. /package/dist/src/lib/Components/{ListItem/ListItem.types.js → Divider/types.js} +0 -0
  143. /package/dist/src/lib/utils/react/{extract-text-from-children.js → extractTextFromChildren.js} +0 -0
  144. /package/dist/src/lib/utils/{start-transition/start-transition.js → startTransition/startTransition.js} +0 -0
  145. /package/dist/src/lib/utils/{use-event/use-get.js → useEvent/useGet.js} +0 -0
  146. /package/src/lib/utils/react/{extract-text-from-children.ts → extractTextFromChildren.ts} +0 -0
  147. /package/src/lib/utils/{start-transition/start-transition.ts → startTransition/startTransition.ts} +0 -0
  148. /package/src/lib/utils/{use-event/use-get.ts → useEvent/useGet.ts} +0 -0
@@ -1,12 +1,27 @@
1
- import React, { FC, forwardRef } from 'react';
2
- import { StyleSheet, View, Text } from 'react-native';
1
+ import {
2
+ createSafeContext,
3
+ isTextChildren,
4
+ } from '@ledgerhq/lumen-utils-shared';
5
+ import React, { forwardRef, ReactNode } from 'react';
6
+ import { StyleSheet, View } from 'react-native';
3
7
  import { useStyleSheet } from '../../../styles';
4
- import { Pressable } from '../Utility';
5
- import { TileProps } from './types';
8
+ import { Spot } from '../Spot';
9
+ import { Box, Pressable, Text } from '../Utility';
10
+ import {
11
+ TileContentProps,
12
+ TileContextValue,
13
+ TileDescriptionProps,
14
+ TileProps,
15
+ TileSpotProps,
16
+ TileTitleProps,
17
+ } from './types';
18
+
19
+ const [TileProvider, useTileContext] =
20
+ createSafeContext<TileContextValue>('Tile');
6
21
 
7
22
  type Appearance = NonNullable<TileProps['appearance']>;
8
23
 
9
- const useStyles = ({
24
+ const useRootStyles = ({
10
25
  appearance,
11
26
  disabled,
12
27
  pressed,
@@ -35,7 +50,8 @@ const useStyles = ({
35
50
  width: '100%',
36
51
  alignItems: 'center',
37
52
  gap: t.spacings.s8,
38
- padding: t.spacings.s8,
53
+ paddingHorizontal: t.spacings.s8,
54
+ paddingVertical: t.spacings.s12,
39
55
  borderRadius: t.borderRadius.sm,
40
56
  backgroundColor: bgColors[appearance],
41
57
  },
@@ -44,152 +60,283 @@ const useStyles = ({
44
60
  backgroundColor: pressedBgColors[appearance],
45
61
  },
46
62
  ]),
47
- contentWrapper: {
48
- width: t.sizes.full,
49
- alignItems: 'center',
50
- gap: t.spacings.s8,
51
- },
52
- leadingWrapper: {
53
- alignItems: 'center',
54
- justifyContent: 'center',
55
- },
56
- textWrapper: {
57
- width: t.sizes.full,
58
- alignItems: 'center',
59
- gap: t.spacings.s4,
60
- },
61
- titleWrapper: {
62
- width: t.sizes.full,
63
- alignItems: 'center',
64
- },
65
- title: StyleSheet.flatten([
66
- t.typographies.body3SemiBold,
67
- {
68
- width: t.sizes.full,
69
- textAlign: 'center',
70
- color: disabled ? t.colors.text.disabled : t.colors.text.base,
71
- },
72
- ]),
73
- description: StyleSheet.flatten([
74
- t.typographies.body3,
75
- {
76
- width: t.sizes.full,
77
- textAlign: 'center',
78
- color: disabled ? t.colors.text.disabled : t.colors.text.muted,
79
- },
80
- ]),
81
63
  };
82
64
  },
83
65
  [appearance, disabled, pressed],
84
66
  );
85
67
  };
86
68
 
87
- type TileContentProps = {
88
- appearance: Appearance;
89
- disabled: boolean;
90
- pressed: boolean;
91
- leadingContent: TileProps['leadingContent'];
92
- title: string;
93
- description?: string;
94
- trailingContent?: TileProps['trailingContent'];
95
- };
96
-
97
- const TileContent: FC<TileContentProps> = ({
98
- appearance,
99
- disabled,
100
- pressed,
101
- leadingContent,
102
- title,
103
- description,
104
- trailingContent,
105
- }) => {
106
- const styles = useStyles({ appearance, disabled, pressed });
107
-
108
- return (
109
- <View style={styles.container}>
110
- <View style={styles.contentWrapper}>
111
- <View style={styles.leadingWrapper}>{leadingContent}</View>
112
- <View style={styles.textWrapper}>
113
- <View style={styles.titleWrapper}>
114
- <Text numberOfLines={1} style={styles.title}>
115
- {title}
116
- </Text>
117
- {description && (
118
- <Text numberOfLines={1} style={styles.description}>
119
- {description}
120
- </Text>
121
- )}
122
- </View>
123
- {trailingContent}
124
- </View>
125
- </View>
126
- </View>
127
- );
128
- };
129
-
130
69
  /**
131
- * A tile list item component that displays a spot icon at the top, title and optional description,
132
- * and optional trailing content at the bottom. It functions as a pressable component with active states,
133
- * and supports long press actions.
70
+ * A flexible tile component that uses a composite pattern for maximum customization.
71
+ * Displays content in a vertical layout with support for spots, text, and custom content.
134
72
  *
135
- * @see {@link https://ldls.vercel.app/?path=/docs/components-Tile-overview--docs Storybook}
136
- * @see {@link https://ldls.vercel.app/?path=/docs/components-Tile-implementation--docs#dos-and-donts Guidelines}
73
+ * @see {@link https://ldls.vercel.app/?path=/docs/react-native_containment-tile--docs Storybook}
74
+ * @see {@link https://ldls.vercel.app/?path=/docs/react-native_containment-tile--docs#dos-and-donts Guidelines}
137
75
  *
138
76
  * @warning The `lx` prop should only be used for layout adjustments like margins or positioning.
139
77
  * Do not use it to modify the tile's core appearance (colors, padding, etc). Use the `appearance` prop instead.
140
78
  *
141
79
  * @example
142
- * // Basic tile item
143
- * import { Tile, Spot } from '@ledgerhq/lumen-ui-rnative';
80
+ * // Basic tile with spot and content
81
+ * import { Tile, TileSpot, TileContent, TileTitle, TileDescription } from '@ledgerhq/lumen-ui-rnative';
144
82
  * import { Wallet } from '@ledgerhq/lumen-ui-rnative/symbols';
145
83
  *
146
- * <Tile
147
- * title="Ethereum"
148
- * description="ETH"
149
- * leadingContent={<Spot appearance="coin" icon={Wallet} />}
150
- * onPress={() => console.log('Pressed!')}
151
- * onLongPress={() => console.log('Long pressed!')}
152
- * />
84
+ * <Tile appearance="card" onPress={() => console.log('Pressed!')}>
85
+ * <TileSpot appearance="icon" icon={Wallet} />
86
+ * <TileContent>
87
+ * <TileTitle>My Wallet</TileTitle>
88
+ * <TileDescription>Description</TileDescription>
89
+ * </TileContent>
90
+ * </Tile>
91
+ *
92
+ * @example
93
+ * // With custom content and long press
94
+ * import { Tile, TileSpot, TileContent, TileTitle, Tag } from '@ledgerhq/lumen-ui-rnative';
95
+ * import { Bitcoin } from '@ledgerhq/lumen-ui-rnative/symbols';
96
+ *
97
+ * <Tile appearance="card" onLongPress={() => console.log('Long pressed')}>
98
+ * <TileSpot appearance="icon" icon={Bitcoin} />
99
+ * <TileContent>
100
+ * <TileTitle>Bitcoin</TileTitle>
101
+ * </TileContent>
102
+ * <Tag label="Active" />
103
+ * </Tile>
153
104
  */
154
105
  export const Tile = forwardRef<React.ElementRef<typeof Pressable>, TileProps>(
155
106
  (
156
107
  {
157
108
  lx = {},
158
109
  style,
159
- title,
160
- description,
161
- leadingContent,
162
- trailingContent,
163
110
  appearance = 'no-background',
164
111
  disabled = false,
112
+ children,
165
113
  ...props
166
114
  },
167
115
  ref,
168
116
  ) => {
169
117
  return (
170
- <Pressable
171
- ref={ref}
172
- lx={lx}
173
- style={style}
174
- disabled={disabled}
175
- accessibilityRole='button'
176
- accessibilityState={{ disabled }}
177
- {...props}
178
- >
179
- {({ pressed }) => (
180
- <TileContent
181
- appearance={appearance}
182
- disabled={disabled}
183
- pressed={pressed}
184
- leadingContent={leadingContent}
185
- title={title}
186
- description={description}
187
- trailingContent={trailingContent}
188
- />
189
- )}
190
- </Pressable>
118
+ <TileProvider value={{ disabled }}>
119
+ <Pressable
120
+ ref={ref}
121
+ lx={lx}
122
+ style={StyleSheet.flatten([{ width: '100%' }, style])}
123
+ disabled={disabled}
124
+ accessibilityRole='button'
125
+ accessibilityState={{ disabled }}
126
+ {...props}
127
+ >
128
+ {({ pressed }) => (
129
+ <TilePressableContent
130
+ appearance={appearance}
131
+ disabled={disabled}
132
+ pressed={pressed}
133
+ >
134
+ {children}
135
+ </TilePressableContent>
136
+ )}
137
+ </Pressable>
138
+ </TileProvider>
191
139
  );
192
140
  },
193
141
  );
194
-
195
142
  Tile.displayName = 'Tile';
143
+
144
+ const TilePressableContent = ({
145
+ appearance,
146
+ disabled,
147
+ pressed,
148
+ children,
149
+ }: {
150
+ appearance: Appearance;
151
+ disabled: boolean;
152
+ pressed: boolean;
153
+ children: ReactNode;
154
+ }) => {
155
+ const styles = useRootStyles({ appearance, disabled, pressed });
156
+ return <View style={styles.container}>{children}</View>;
157
+ };
158
+
159
+ /**
160
+ * A spot adapter for use within Tile. Automatically inherits the disabled state from the parent Tile.
161
+ * Always renders at a fixed size of 48.
162
+ *
163
+ * @example
164
+ * <Tile>
165
+ * <TileSpot appearance="icon" icon={Settings} />
166
+ * </Tile>
167
+ */
168
+ export const TileSpot = (props: TileSpotProps) => {
169
+ const { disabled } = useTileContext({
170
+ consumerName: 'TileSpot',
171
+ contextRequired: true,
172
+ });
173
+ return <Spot {...props} size={48} disabled={disabled} />;
174
+ };
175
+
176
+ const useContentStyles = () => {
177
+ return useStyleSheet(
178
+ (t) => ({
179
+ container: {
180
+ width: t.sizes.full,
181
+ alignItems: 'center',
182
+ gap: t.spacings.s4,
183
+ },
184
+ }),
185
+ [],
186
+ );
187
+ };
188
+ TileSpot.displayName = 'TileSpot';
189
+
190
+ /**
191
+ * A container for grouping TileTitle and TileDescription with consistent spacing.
192
+ * Use this to wrap text content within a Tile.
193
+ *
194
+ * @example
195
+ * <Tile>
196
+ * <TileContent>
197
+ * <TileTitle>My Title</TileTitle>
198
+ * <TileDescription>My Description</TileDescription>
199
+ * </TileContent>
200
+ * </Tile>
201
+ */
202
+ export const TileContent = ({ children, lx, style }: TileContentProps) => {
203
+ const styles = useContentStyles();
204
+ return (
205
+ <Box
206
+ lx={lx}
207
+ style={StyleSheet.flatten([styles.container, style])}
208
+ testID='tile-content'
209
+ >
210
+ {children}
211
+ </Box>
212
+ );
213
+ };
214
+ TileContent.displayName = 'TileContent';
215
+
216
+ const useTitleStyles = ({ disabled }: { disabled: boolean }) => {
217
+ return useStyleSheet(
218
+ (t) => ({
219
+ container: {
220
+ width: t.sizes.full,
221
+ alignItems: 'center',
222
+ },
223
+ text: StyleSheet.flatten([
224
+ t.typographies.body3SemiBold,
225
+ {
226
+ alignItems: 'center',
227
+ width: t.sizes.full,
228
+ textAlign: 'center',
229
+ color: disabled ? t.colors.text.disabled : t.colors.text.base,
230
+ },
231
+ ]),
232
+ }),
233
+ [disabled],
234
+ );
235
+ };
236
+
237
+ /**
238
+ * The primary text label for a Tile. Automatically inherits the disabled state from the parent Tile.
239
+ * Text will truncate with ellipsis if it exceeds the available width.
240
+ * If children is a string, it will be automatically wrapped in a Text component.
241
+ */
242
+ export const TileTitle = ({ children, lx, style }: TileTitleProps) => {
243
+ const { disabled } = useTileContext({
244
+ consumerName: 'TileTitle',
245
+ contextRequired: true,
246
+ });
247
+ const styles = useTitleStyles({ disabled });
248
+
249
+ if (isTextChildren(children)) {
250
+ return (
251
+ <Text
252
+ testID='tile-title'
253
+ numberOfLines={1}
254
+ lx={lx}
255
+ style={StyleSheet.flatten([styles.text, style])}
256
+ >
257
+ {children}
258
+ </Text>
259
+ );
260
+ }
261
+
262
+ return (
263
+ <Box
264
+ lx={lx}
265
+ style={StyleSheet.flatten([styles.container, style])}
266
+ testID='tile-title'
267
+ >
268
+ {children}
269
+ </Box>
270
+ );
271
+ };
272
+ TileTitle.displayName = 'TileTitle';
273
+
274
+ const useDescriptionStyles = ({ disabled }: { disabled: boolean }) => {
275
+ return useStyleSheet(
276
+ (t) => ({
277
+ container: {
278
+ width: t.sizes.full,
279
+ alignItems: 'center',
280
+ },
281
+ text: StyleSheet.flatten([
282
+ t.typographies.body3,
283
+ {
284
+ width: t.sizes.full,
285
+ alignItems: 'center',
286
+ textAlign: 'center',
287
+ color: disabled ? t.colors.text.disabled : t.colors.text.muted,
288
+ },
289
+ ]),
290
+ }),
291
+ [disabled],
292
+ );
293
+ };
294
+
295
+ /**
296
+ * The secondary text label for a Tile. Automatically inherits the disabled state from the parent Tile.
297
+ * Text will truncate with ellipsis if it exceeds the available width.
298
+ * If children is a string, it will be automatically wrapped in a Text component.
299
+ *
300
+ * @example
301
+ * <Tile>
302
+ * <TileContent>
303
+ * <TileTitle>My Title</TileTitle>
304
+ * <TileDescription>My Description</TileDescription>
305
+ * </TileContent>
306
+ * </Tile>
307
+ */
308
+ export const TileDescription = ({
309
+ children,
310
+ lx,
311
+ style,
312
+ }: TileDescriptionProps) => {
313
+ const { disabled } = useTileContext({
314
+ consumerName: 'TileDescription',
315
+ contextRequired: true,
316
+ });
317
+ const styles = useDescriptionStyles({ disabled });
318
+
319
+ if (isTextChildren(children)) {
320
+ return (
321
+ <Text
322
+ lx={lx}
323
+ numberOfLines={1}
324
+ style={StyleSheet.flatten([styles.text, style])}
325
+ testID='tile-description'
326
+ >
327
+ {children}
328
+ </Text>
329
+ );
330
+ }
331
+
332
+ return (
333
+ <Box
334
+ lx={lx}
335
+ style={StyleSheet.flatten([styles.container, style])}
336
+ testID='tile-description'
337
+ >
338
+ {children}
339
+ </Box>
340
+ );
341
+ };
342
+ TileDescription.displayName = 'TileDescription';
@@ -1,2 +1,8 @@
1
- export * from './Tile';
1
+ export {
2
+ Tile,
3
+ TileSpot,
4
+ TileContent,
5
+ TileTitle,
6
+ TileDescription,
7
+ } from './Tile';
2
8
  export * from './types';
@@ -1,25 +1,16 @@
1
1
  import { ReactNode } from 'react';
2
- import { StyledPressableProps } from '../../../styles';
2
+ import {
3
+ StyledPressableProps,
4
+ StyledTextProps,
5
+ StyledViewProps,
6
+ } from '../../../styles';
7
+ import { DiscriminatedSpotProps } from '../Spot/types';
8
+
9
+ export type TileContextValue = {
10
+ disabled: boolean;
11
+ };
3
12
 
4
13
  export type TileProps = {
5
- /**
6
- * Custom content to display at the top (leading area) of the tile.
7
- * Accepts ReactNode such as <Spot appearance="icon" icon={Settings} />
8
- */
9
- leadingContent: ReactNode;
10
- /**
11
- * The title of the tile.
12
- */
13
- title: string;
14
- /**
15
- * The description of the tile.
16
- */
17
- description?: string;
18
- /**
19
- * Custom content to display at the bottom (trailing area) of the tile.
20
- * Accepts ReactNode such as <Tag label="New" appearance="base" />
21
- */
22
- trailingContent?: ReactNode;
23
14
  /**
24
15
  * The visual style of the tile.
25
16
  * - `no-background`: Transparent background with pressed state
@@ -42,4 +33,32 @@ export type TileProps = {
42
33
  * Can be used to perform secondary actions.
43
34
  */
44
35
  onLongPress?: StyledPressableProps['onLongPress'];
36
+ /**
37
+ * The children to display inside the tile.
38
+ */
39
+ children: ReactNode;
45
40
  } & Omit<StyledPressableProps, 'onPress' | 'onLongPress' | 'disabled'>;
41
+
42
+ export type TileSpotProps = DiscriminatedSpotProps;
43
+
44
+ export type TileContentProps = {
45
+ /**
46
+ * The children to display inside the tile content area.
47
+ * Typically contains TileTitle and TileDescription.
48
+ */
49
+ children: ReactNode;
50
+ } & StyledViewProps;
51
+
52
+ export type TileTitleProps = {
53
+ /**
54
+ * The title text to display.
55
+ */
56
+ children: ReactNode;
57
+ } & StyledViewProps;
58
+
59
+ export type TileDescriptionProps = {
60
+ /**
61
+ * The description text to display.
62
+ */
63
+ children: ReactNode;
64
+ } & StyledTextProps;
@@ -5,6 +5,7 @@ export * from './BottomSheet';
5
5
  export * from './Button';
6
6
  export * from './CardButton';
7
7
  export * from './Checkbox';
8
+ export * from './Divider';
8
9
  export * from './IconButton';
9
10
  export * from './InteractiveIcon';
10
11
  export * from './Link';
@@ -1,7 +1,6 @@
1
1
  export * from './constants';
2
2
  export * from './components';
3
3
  export * from './react';
4
- export * from './use-controllable-state';
5
- export * from './string-utils';
6
- export * from './use-event';
7
- export * from './start-transition';
4
+ export * from './useControllableState';
5
+ export * from './useEvent';
6
+ export * from './startTransition';
@@ -1 +1 @@
1
- export * from './extract-text-from-children';
1
+ export * from './extractTextFromChildren';
@@ -0,0 +1 @@
1
+ export * from './startTransition';
@@ -0,0 +1 @@
1
+ export * from './useControllableState';
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { startTransition } from '../start-transition';
3
- import { useEvent } from '../use-event';
2
+ import { startTransition } from '../startTransition';
3
+ import { useEvent } from '../useEvent';
4
4
 
5
5
  // can configure to allow most-recent-wins or prop-wins
6
6
  // defaults to prop-wins
@@ -0,0 +1,2 @@
1
+ export * from './useEvent';
2
+ export * from './useGet';
@@ -1,4 +1,4 @@
1
- import { useGet } from './use-get';
1
+ import { useGet } from './useGet';
2
2
 
3
3
  type AnyFunction = (...args: any[]) => any;
4
4
 
@@ -5,11 +5,10 @@ import {
5
5
  ColorSchemeName,
6
6
  useColorScheme as useReactNativeColorScheme,
7
7
  } from 'react-native';
8
- import { RuntimeConstants } from '../../lib/utils';
9
- import { useControllableState } from '../../lib/utils/use-controllable-state/use-controllable-state';
8
+ import { RuntimeConstants, useControllableState } from '../../lib/utils';
10
9
  import { createStylesheetTheme } from '../theme/createStylesheetTheme';
11
10
  import { type LumenStyleSheetTheme } from '../types';
12
- import { LumenStyleSheetProviderProps } from './types';
11
+ import { type LumenStyleSheetProviderProps } from './types';
13
12
 
14
13
  const DARK_MODE = 'dark';
15
14
  const LIGHT_MODE = 'light';
@@ -1,31 +0,0 @@
1
- import { StyledPressableProps } from '../../../styles';
2
- export type ListItemProps = {
3
- /**
4
- * The main title of the list item.
5
- */
6
- title: string;
7
- /**
8
- * Optional descriptive text below the title.
9
- */
10
- description?: string;
11
- /**
12
- * Optional content to display on the left, usually a Spot component.
13
- * @example leadingContent={<Spot appearance="icon" icon={Settings} />}
14
- */
15
- leadingContent?: React.ReactNode;
16
- /**
17
- * Optional Tag component displayed next to the description.
18
- * @example descriptionTag={<Tag label="New" appearance="accent" size="sm" />}
19
- */
20
- descriptionTag?: React.ReactNode;
21
- /**
22
- * Custom content to render on the right side of the list item.
23
- * @example trailingContent={<Icon />}
24
- */
25
- trailingContent?: React.ReactNode;
26
- /**
27
- * Whether the list item is disabled.
28
- */
29
- disabled?: boolean;
30
- } & Omit<StyledPressableProps, 'disabled'>;
31
- //# sourceMappingURL=ListItem.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ListItem.types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/ListItem/ListItem.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACjC;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACjC;;;OAGG;IACH,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"extract-text-from-children.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/react/extract-text-from-children.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,iBAAiB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,GAC3C,MAAM,CAoBR"}
@@ -1,2 +0,0 @@
1
- export * from './start-transition';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/start-transition/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -1 +0,0 @@
1
- export * from './start-transition';
@@ -1 +0,0 @@
1
- {"version":3,"file":"start-transition.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/start-transition/start-transition.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,GAAI,UAAU,KAAK,CAAC,kBAAkB,KAAG,IAQpE,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Transforms a kebab-case or snake_case string into a PascalCase string.
3
- * e.g., 'arrow-up' -> 'ArrowUp'
4
- */
5
- export declare function toPascalCase(str: string): string;
6
- //# sourceMappingURL=string-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"string-utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/string-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMhD"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Transforms a kebab-case or snake_case string into a PascalCase string.
3
- * e.g., 'arrow-up' -> 'ArrowUp'
4
- */
5
- export function toPascalCase(str) {
6
- if (!str)
7
- return '';
8
- return str
9
- .split(/[-_ ]+/)
10
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
11
- .join('');
12
- }
@@ -1,2 +0,0 @@
1
- export * from './use-controllable-state';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/use-controllable-state/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}