@utilitywarehouse/hearth-react-native 0.4.2 → 0.5.0

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 (180) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-lint.log +1 -1
  3. package/CHANGELOG.md +44 -0
  4. package/build/components/Alert/AlertTitle.js +6 -6
  5. package/build/components/Badge/Badge.js +3 -3
  6. package/build/components/Badge/Badge.props.d.ts +1 -0
  7. package/build/components/Button/ButtonRoot.js +4 -0
  8. package/build/components/Button/ButtonText.js +2 -2
  9. package/build/components/Card/CardRoot.js +1 -1
  10. package/build/components/Carousel/Carousel.context.d.ts +4 -0
  11. package/build/components/Carousel/Carousel.context.js +4 -0
  12. package/build/components/Carousel/Carousel.d.ts +6 -0
  13. package/build/components/Carousel/Carousel.js +278 -0
  14. package/build/components/Carousel/Carousel.props.d.ts +65 -0
  15. package/build/components/Carousel/Carousel.props.js +1 -0
  16. package/build/components/Carousel/CarouselControlItem.d.ts +24 -0
  17. package/build/components/Carousel/CarouselControlItem.js +64 -0
  18. package/build/components/Carousel/CarouselControls.d.ts +4 -0
  19. package/build/components/Carousel/CarouselControls.js +74 -0
  20. package/build/components/Carousel/CarouselItem.d.ts +6 -0
  21. package/build/components/Carousel/CarouselItem.js +38 -0
  22. package/build/components/Carousel/index.d.ts +5 -0
  23. package/build/components/Carousel/index.js +5 -0
  24. package/build/components/DescriptionList/DescriptionList.d.ts +1 -1
  25. package/build/components/DescriptionList/DescriptionList.js +2 -2
  26. package/build/components/DescriptionList/DescriptionList.props.d.ts +1 -8
  27. package/build/components/DescriptionList/DescriptionListItem.d.ts +1 -1
  28. package/build/components/DescriptionList/DescriptionListItem.js +4 -3
  29. package/build/components/DescriptionList/DescriptionListItem.props.d.ts +3 -8
  30. package/build/components/IndicatorIconButton/IndicatorIconButton.d.ts +6 -0
  31. package/build/components/IndicatorIconButton/IndicatorIconButton.js +26 -0
  32. package/build/components/IndicatorIconButton/IndicatorIconButton.props.d.ts +8 -0
  33. package/build/components/IndicatorIconButton/IndicatorIconButton.props.js +1 -0
  34. package/build/components/IndicatorIconButton/index.d.ts +2 -0
  35. package/build/components/IndicatorIconButton/index.js +1 -0
  36. package/build/components/Link/LinkText.js +3 -3
  37. package/build/components/List/List.context.d.ts +0 -2
  38. package/build/components/List/List.d.ts +1 -1
  39. package/build/components/List/List.js +5 -5
  40. package/build/components/List/List.props.d.ts +1 -9
  41. package/build/components/List/ListAction/ListAction.d.ts +18 -0
  42. package/build/components/List/ListAction/ListAction.js +103 -0
  43. package/build/components/List/ListAction/ListAction.props.d.ts +8 -0
  44. package/build/components/List/ListAction/ListAction.props.js +1 -0
  45. package/build/components/List/ListAction/ListActionContent.d.ts +6 -0
  46. package/build/components/List/ListAction/ListActionContent.js +14 -0
  47. package/build/components/List/ListAction/ListActionText.d.ts +6 -0
  48. package/build/components/List/ListAction/ListActionText.js +7 -0
  49. package/build/components/List/ListAction/ListActionTrailingContent.d.ts +6 -0
  50. package/build/components/List/ListAction/ListActionTrailingContent.js +5 -0
  51. package/build/components/List/ListAction/ListActionTrailingIcon.d.ts +9 -0
  52. package/build/components/List/ListAction/ListActionTrailingIcon.js +18 -0
  53. package/build/components/List/ListAction/index.d.ts +6 -0
  54. package/build/components/List/ListAction/index.js +5 -0
  55. package/build/components/List/ListItem/ListItem.context.d.ts +1 -1
  56. package/build/components/List/ListItem/ListItem.props.d.ts +9 -5
  57. package/build/components/List/ListItem/ListItemRoot.d.ts +1 -1
  58. package/build/components/List/ListItem/ListItemRoot.js +10 -12
  59. package/build/components/List/ListItem/index.d.ts +4 -4
  60. package/build/components/List/ListItem/index.js +3 -3
  61. package/build/components/List/index.d.ts +1 -0
  62. package/build/components/List/index.js +1 -0
  63. package/build/components/ProgressStepper/ProgressStep.d.ts +10 -0
  64. package/build/components/ProgressStepper/ProgressStep.js +100 -0
  65. package/build/components/ProgressStepper/ProgressStepper.d.ts +6 -0
  66. package/build/components/ProgressStepper/ProgressStepper.js +22 -0
  67. package/build/components/ProgressStepper/ProgressStepper.props.d.ts +22 -0
  68. package/build/components/ProgressStepper/ProgressStepper.props.js +1 -0
  69. package/build/components/ProgressStepper/ProgressStepperRoot.d.ts +6 -0
  70. package/build/components/ProgressStepper/ProgressStepperRoot.js +16 -0
  71. package/build/components/ProgressStepper/index.d.ts +3 -0
  72. package/build/components/ProgressStepper/index.js +2 -0
  73. package/build/components/SectionHeader/SectionHeader.d.ts +1 -1
  74. package/build/components/SectionHeader/SectionHeader.js +6 -3
  75. package/build/components/SectionHeader/SectionHeader.props.d.ts +9 -16
  76. package/build/components/SectionHeader/SectionHeaderTrailingContent.d.ts +6 -0
  77. package/build/components/SectionHeader/SectionHeaderTrailingContent.js +13 -0
  78. package/build/components/SectionHeader/index.d.ts +1 -0
  79. package/build/components/SectionHeader/index.js +1 -0
  80. package/build/components/Tabs/Tab.js +2 -2
  81. package/build/components/ToggleButton/ToggleButtonText.js +2 -2
  82. package/build/components/UnstyledIconButton/UnstyledIconButton.props.d.ts +4 -1
  83. package/build/components/index.d.ts +3 -0
  84. package/build/components/index.js +3 -0
  85. package/build/core/themes.d.ts +12 -24
  86. package/build/tokens/components/dark/button.d.ts +1 -1
  87. package/build/tokens/components/dark/button.js +1 -1
  88. package/build/tokens/components/dark/dialog.d.ts +1 -0
  89. package/build/tokens/components/dark/dialog.js +1 -0
  90. package/build/tokens/components/dark/illustrations.d.ts +1 -0
  91. package/build/tokens/components/dark/illustrations.js +1 -0
  92. package/build/tokens/components/dark/toast.d.ts +4 -1
  93. package/build/tokens/components/dark/toast.js +4 -1
  94. package/build/tokens/components/light/button.d.ts +1 -1
  95. package/build/tokens/components/light/button.js +1 -1
  96. package/build/tokens/components/light/dialog.d.ts +1 -0
  97. package/build/tokens/components/light/dialog.js +1 -0
  98. package/build/tokens/components/light/illustrations.d.ts +1 -0
  99. package/build/tokens/components/light/illustrations.js +1 -0
  100. package/build/tokens/components/light/toast.d.ts +4 -1
  101. package/build/tokens/components/light/toast.js +4 -1
  102. package/build/tokens/layout.d.ts +6 -12
  103. package/build/tokens/layout.js +3 -6
  104. package/docs/components/AllComponents.web.tsx +86 -4
  105. package/docs/components/BadgeList.tsx +20 -56
  106. package/docs/components/SwitchList.tsx +4 -8
  107. package/docs/getting-started.mdx +30 -14
  108. package/docs/introduction.mdx +1 -1
  109. package/package.json +4 -4
  110. package/src/components/Alert/AlertTitle.tsx +7 -7
  111. package/src/components/Badge/Badge.props.ts +1 -0
  112. package/src/components/Badge/Badge.tsx +3 -2
  113. package/src/components/Button/ButtonRoot.tsx +4 -0
  114. package/src/components/Button/ButtonText.tsx +3 -3
  115. package/src/components/Card/CardRoot.tsx +2 -0
  116. package/src/components/Carousel/Carousel.context.tsx +8 -0
  117. package/src/components/Carousel/Carousel.docs.mdx +389 -0
  118. package/src/components/Carousel/Carousel.props.ts +89 -0
  119. package/src/components/Carousel/Carousel.stories.tsx +317 -0
  120. package/src/components/Carousel/Carousel.tsx +444 -0
  121. package/src/components/Carousel/CarouselControlItem.tsx +87 -0
  122. package/src/components/Carousel/CarouselControls.tsx +150 -0
  123. package/src/components/Carousel/CarouselItem.tsx +68 -0
  124. package/src/components/Carousel/index.ts +6 -0
  125. package/src/components/DescriptionList/DescriptionList.docs.mdx +24 -27
  126. package/src/components/DescriptionList/DescriptionList.props.ts +1 -8
  127. package/src/components/DescriptionList/DescriptionList.stories.tsx +13 -19
  128. package/src/components/DescriptionList/DescriptionList.tsx +2 -14
  129. package/src/components/DescriptionList/DescriptionListItem.props.ts +3 -8
  130. package/src/components/DescriptionList/DescriptionListItem.tsx +13 -21
  131. package/src/components/IndicatorIconButton/IndicatorIconButton.docs.mdx +85 -0
  132. package/src/components/IndicatorIconButton/IndicatorIconButton.props.ts +12 -0
  133. package/src/components/IndicatorIconButton/IndicatorIconButton.stories.tsx +142 -0
  134. package/src/components/IndicatorIconButton/IndicatorIconButton.tsx +36 -0
  135. package/src/components/IndicatorIconButton/index.tsx +2 -0
  136. package/src/components/Link/LinkText.tsx +4 -4
  137. package/src/components/List/List.context.ts +0 -1
  138. package/src/components/List/List.docs.mdx +376 -179
  139. package/src/components/List/List.props.ts +1 -9
  140. package/src/components/List/List.stories.tsx +289 -38
  141. package/src/components/List/List.tsx +5 -26
  142. package/src/components/List/ListAction/ListAction.props.ts +10 -0
  143. package/src/components/List/ListAction/ListAction.tsx +133 -0
  144. package/src/components/List/ListAction/ListActionContent.tsx +21 -0
  145. package/src/components/List/ListAction/ListActionText.tsx +14 -0
  146. package/src/components/List/ListAction/ListActionTrailingContent.tsx +9 -0
  147. package/src/components/List/ListAction/ListActionTrailingIcon.tsx +32 -0
  148. package/src/components/List/ListAction/index.ts +6 -0
  149. package/src/components/List/ListItem/ListItem.context.ts +1 -1
  150. package/src/components/List/ListItem/ListItem.props.ts +9 -5
  151. package/src/components/List/ListItem/ListItemRoot.tsx +18 -14
  152. package/src/components/List/ListItem/index.ts +4 -4
  153. package/src/components/List/index.ts +1 -0
  154. package/src/components/ProgressStepper/ProgressStep.tsx +134 -0
  155. package/src/components/ProgressStepper/ProgressStepper.docs.mdx +87 -0
  156. package/src/components/ProgressStepper/ProgressStepper.props.ts +27 -0
  157. package/src/components/ProgressStepper/ProgressStepper.stories.tsx +108 -0
  158. package/src/components/ProgressStepper/ProgressStepper.tsx +26 -0
  159. package/src/components/ProgressStepper/ProgressStepperRoot.tsx +32 -0
  160. package/src/components/ProgressStepper/index.ts +3 -0
  161. package/src/components/SectionHeader/SectionHeader.props.ts +9 -16
  162. package/src/components/SectionHeader/SectionHeader.stories.tsx +28 -18
  163. package/src/components/SectionHeader/SectionHeader.tsx +18 -19
  164. package/src/components/SectionHeader/SectionHeaderTrailingContent.tsx +20 -0
  165. package/src/components/SectionHeader/Sectionheader.docs.mdx +9 -24
  166. package/src/components/SectionHeader/index.ts +1 -0
  167. package/src/components/Switch/Switch.docs.mdx +0 -4
  168. package/src/components/Tabs/Tab.tsx +4 -2
  169. package/src/components/ToggleButton/ToggleButtonText.tsx +3 -3
  170. package/src/components/UnstyledIconButton/UnstyledIconButton.props.ts +2 -1
  171. package/src/components/index.ts +3 -0
  172. package/src/tokens/components/dark/button.ts +1 -1
  173. package/src/tokens/components/dark/dialog.ts +1 -0
  174. package/src/tokens/components/dark/illustrations.ts +1 -0
  175. package/src/tokens/components/dark/toast.ts +4 -1
  176. package/src/tokens/components/light/button.ts +1 -1
  177. package/src/tokens/components/light/dialog.ts +1 -0
  178. package/src/tokens/components/light/illustrations.ts +1 -0
  179. package/src/tokens/components/light/toast.ts +4 -1
  180. package/src/tokens/layout.ts +3 -6
@@ -0,0 +1,317 @@
1
+ import { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { color } from '@utilitywarehouse/hearth-tokens/js';
3
+ import { useState } from 'react';
4
+ import { LayoutChangeEvent, Platform } from 'react-native';
5
+ import { StyleSheet } from 'react-native-unistyles';
6
+ import { Carousel, CarouselControls, CarouselItem, CarouselProps } from '.';
7
+ import { Alert, BodyText, Box } from '../';
8
+
9
+ const meta = {
10
+ title: 'Stories / Carousel',
11
+ component: Carousel,
12
+ parameters: {
13
+ layout: 'centered',
14
+ },
15
+ argTypes: {
16
+ disabled: {
17
+ control: 'boolean',
18
+ description: 'Enable or disable the carousel',
19
+ },
20
+ inactiveItemOpacity: {
21
+ control: 'number',
22
+ description: 'Opacity of inactive items',
23
+ },
24
+ itemWidth: {
25
+ control: 'number',
26
+ description: 'Width of each item',
27
+ },
28
+ showOverflow: {
29
+ control: 'boolean',
30
+ description: 'Show overflow items',
31
+ },
32
+ showControls: {
33
+ control: 'boolean',
34
+ description: 'Show carousel controls',
35
+ },
36
+ inverted: {
37
+ control: 'boolean',
38
+ description: 'Invert the colors of the carousel controls',
39
+ },
40
+ showNavigation: {
41
+ control: 'boolean',
42
+ description: 'Show prev/next navigation buttons',
43
+ },
44
+ style: {
45
+ control: 'object',
46
+ description: 'Style of the carousel',
47
+ },
48
+ width: {
49
+ control: 'number',
50
+ description: 'Width of the carousel',
51
+ },
52
+ centered: {
53
+ control: 'boolean',
54
+ description: 'Center the carousel items',
55
+ },
56
+ },
57
+ args: {
58
+ disabled: false,
59
+ inactiveItemOpacity: 1,
60
+ showOverflow: false,
61
+ showControls: true,
62
+ showNavigation: false,
63
+ inverted: false,
64
+ },
65
+ } satisfies Meta<typeof Carousel>;
66
+
67
+ export default meta;
68
+ type Story = StoryObj<typeof meta>;
69
+
70
+ interface CarouselItemCardProps {
71
+ backgroundColor: string;
72
+ title: string;
73
+ }
74
+
75
+ interface CarouselExampleProps extends Omit<CarouselProps, 'children'> {
76
+ items: Array<any>;
77
+ }
78
+
79
+ const styles = StyleSheet.create(theme => ({
80
+ carouselItem: {
81
+ aspectRatio: 1.6,
82
+ borderRadius: theme.borderRadius.sm,
83
+ justifyContent: 'center',
84
+ marginHorizontal: theme.space['100'],
85
+ padding: theme.space['200'],
86
+ },
87
+ carouselItemTitle: {
88
+ color: theme.color.white,
89
+ },
90
+ title: {
91
+ marginBottom: theme.space['100'],
92
+ },
93
+ }));
94
+
95
+ const CarouselItemCard = ({ backgroundColor, title }: CarouselItemCardProps) => {
96
+ return (
97
+ <Box style={[styles.carouselItem, { backgroundColor }]}>
98
+ <BodyText style={styles.carouselItemTitle}>{title}</BodyText>
99
+ </Box>
100
+ );
101
+ };
102
+
103
+ const items = [
104
+ {
105
+ color: color.purple['800'],
106
+ key: 1,
107
+ title: '1111',
108
+ },
109
+ {
110
+ color: color.red['800'],
111
+ key: 2,
112
+ title: '2222',
113
+ },
114
+ {
115
+ color: color.green['800'],
116
+ key: 3,
117
+ title: '3333',
118
+ },
119
+ {
120
+ color: color.blue['800'],
121
+ key: 4,
122
+ title: '4444',
123
+ },
124
+ {
125
+ color: color.piggyPink['700'],
126
+ key: 5,
127
+ title: '5555',
128
+ },
129
+ ];
130
+
131
+ const CarouselExample = ({ items, ...props }: CarouselExampleProps) => (
132
+ <Carousel {...props}>
133
+ {items.map(({ color, key, title }) => (
134
+ <CarouselItem key={key}>
135
+ <CarouselItemCard backgroundColor={color} title={`•••• •••• •••• ${title}`} />
136
+ </CarouselItem>
137
+ ))}
138
+ </Carousel>
139
+ );
140
+
141
+ export const Playground: Story = {
142
+ args: {
143
+ width: 300,
144
+ },
145
+ render: args => {
146
+ const [width, setWidth] = useState(0);
147
+
148
+ const handleLayout = ({ nativeEvent }: LayoutChangeEvent) => {
149
+ setWidth(nativeEvent.layout.width);
150
+ };
151
+
152
+ return (
153
+ <Box width={Platform.OS === 'web' ? 400 : '100%'} overflow="hidden" onLayout={handleLayout}>
154
+ <CarouselExample {...args} items={items} width={width} />
155
+ </Box>
156
+ );
157
+ },
158
+ };
159
+
160
+ export const FullWidth: Story = {
161
+ args: {
162
+ width: 300,
163
+ },
164
+ render: args => {
165
+ const [width, setWidth] = useState(0);
166
+
167
+ const handleLayout = ({ nativeEvent }: LayoutChangeEvent) => {
168
+ setWidth(nativeEvent.layout.width);
169
+ };
170
+
171
+ return (
172
+ <Box width={Platform.OS === 'web' ? 400 : '100%'} overflow="hidden" onLayout={handleLayout}>
173
+ <CarouselExample {...args} items={items} width={width} />
174
+ </Box>
175
+ );
176
+ },
177
+ };
178
+
179
+ export const FixedWidthCentered: Story = {
180
+ args: {
181
+ width: 300,
182
+ },
183
+ render: args => {
184
+ const [width, setWidth] = useState(0);
185
+
186
+ const handleLayout = ({ nativeEvent }: LayoutChangeEvent) => {
187
+ setWidth(nativeEvent.layout.width);
188
+ };
189
+
190
+ const itemWidth = width * 0.8;
191
+
192
+ return (
193
+ <Box width={Platform.OS === 'web' ? 400 : '100%'} overflow="hidden" onLayout={handleLayout}>
194
+ <CarouselExample
195
+ {...args}
196
+ centered
197
+ items={items}
198
+ itemWidth={itemWidth}
199
+ showOverflow
200
+ width={width}
201
+ />
202
+ </Box>
203
+ );
204
+ },
205
+ };
206
+
207
+ export const FixedWidthStart: Story = {
208
+ args: {
209
+ width: 300,
210
+ },
211
+ render: args => {
212
+ const [width, setWidth] = useState(0);
213
+
214
+ const handleLayout = ({ nativeEvent }: LayoutChangeEvent) => {
215
+ setWidth(nativeEvent.layout.width);
216
+ };
217
+
218
+ const itemWidth = width * 0.8;
219
+
220
+ return (
221
+ <Box width={Platform.OS === 'web' ? 400 : '100%'} overflow="hidden" onLayout={handleLayout}>
222
+ <CarouselExample {...args} items={items} itemWidth={itemWidth} showOverflow width={width} />
223
+ </Box>
224
+ );
225
+ },
226
+ };
227
+
228
+ export const WithNavigation: Story = {
229
+ args: {
230
+ width: 300,
231
+ showNavigation: true,
232
+ },
233
+ render: args => {
234
+ const [width, setWidth] = useState(0);
235
+
236
+ const handleLayout = ({ nativeEvent }: LayoutChangeEvent) => {
237
+ setWidth(nativeEvent.layout.width);
238
+ };
239
+
240
+ return (
241
+ <Box width={Platform.OS === 'web' ? 400 : '100%'} overflow="hidden" onLayout={handleLayout}>
242
+ <CarouselExample {...args} items={items} width={width} />
243
+ </Box>
244
+ );
245
+ },
246
+ };
247
+
248
+ export const WithoutControls: Story = {
249
+ args: {
250
+ width: 300,
251
+ showControls: false,
252
+ },
253
+ render: args => {
254
+ const [width, setWidth] = useState(0);
255
+
256
+ const handleLayout = ({ nativeEvent }: LayoutChangeEvent) => {
257
+ setWidth(nativeEvent.layout.width);
258
+ };
259
+
260
+ return (
261
+ <Box width={Platform.OS === 'web' ? 400 : '100%'} overflow="hidden" onLayout={handleLayout}>
262
+ <CarouselExample {...args} items={items} width={width} />
263
+ </Box>
264
+ );
265
+ },
266
+ };
267
+
268
+ export const CustomControls: Story = {
269
+ args: {
270
+ width: 300,
271
+ },
272
+ render: args => {
273
+ const [width, setWidth] = useState(0);
274
+
275
+ const handleLayout = ({ nativeEvent }: LayoutChangeEvent) => {
276
+ setWidth(nativeEvent.layout.width);
277
+ };
278
+
279
+ return (
280
+ <Box width={Platform.OS === 'web' ? 400 : '100%'} overflow="hidden" onLayout={handleLayout}>
281
+ <Carousel {...args} width={width}>
282
+ {items.map(({ color, key, title }) => (
283
+ <CarouselItem key={key}>
284
+ <CarouselItemCard backgroundColor={color} title={`•••• •••• •••• ${title}`} />
285
+ </CarouselItem>
286
+ ))}
287
+ <Box gap="200" mt="200">
288
+ <Alert text="You can swipe to see more items or use the navigation below" />
289
+ <CarouselControls showNavigation />
290
+ </Box>
291
+ </Carousel>
292
+ </Box>
293
+ );
294
+ },
295
+ };
296
+
297
+ export const InvertedControls: Story = {
298
+ args: {
299
+ width: 300,
300
+ showControls: true,
301
+ inverted: true,
302
+ showNavigation: true,
303
+ },
304
+ render: args => {
305
+ const [width, setWidth] = useState(0);
306
+
307
+ const handleLayout = ({ nativeEvent }: LayoutChangeEvent) => {
308
+ setWidth(nativeEvent.layout.width);
309
+ };
310
+
311
+ return (
312
+ <Box width={Platform.OS === 'web' ? 400 : '100%'} overflow="hidden" onLayout={handleLayout}>
313
+ <CarouselExample {...args} items={items} width={width} />
314
+ </Box>
315
+ );
316
+ },
317
+ };