@utilitywarehouse/hearth-react-native 0.12.0 → 0.14.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.
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/CHANGELOG.md +22 -0
- package/build/components/Accordion/AccordionTrigger.js +1 -1
- package/build/components/BodyText/index.d.ts +1 -0
- package/build/components/Checkbox/CheckboxGroup.context.d.ts +2 -0
- package/build/components/Checkbox/CheckboxGroup.js +5 -5
- package/build/components/Checkbox/CheckboxIndicator.js +3 -3
- package/build/components/Checkbox/CheckboxTextContent.js +0 -1
- package/build/components/Checkbox/CheckboxTileRoot.js +9 -1
- package/build/components/DatePicker/DatePickerDay.js +3 -3
- package/build/components/FormField/FormField.d.ts +5 -5
- package/build/components/List/List.context.d.ts +2 -0
- package/build/components/List/List.context.js +2 -0
- package/build/components/List/List.js +19 -15
- package/build/components/List/ListAction/ListAction.js +3 -2
- package/build/components/List/ListAction/ListAction.props.d.ts +0 -1
- package/build/components/List/ListItem/ListItem.props.d.ts +4 -1
- package/build/components/List/ListItem/ListItemHeading.d.ts +13 -0
- package/build/components/List/ListItem/ListItemHeading.js +12 -0
- package/build/components/List/ListItem/ListItemHelperText.d.ts +2 -2
- package/build/components/List/ListItem/ListItemRoot.d.ts +1 -1
- package/build/components/List/ListItem/ListItemRoot.js +7 -6
- package/build/components/List/ListItem/index.d.ts +1 -1
- package/build/components/List/ListItem/index.js +1 -1
- package/build/components/PillGroup/Pill.js +2 -2
- package/build/components/Radio/RadioGroup.context.d.ts +2 -0
- package/build/components/Radio/RadioGroup.js +1 -1
- package/build/components/Radio/RadioIndicator.js +3 -3
- package/build/components/Radio/RadioTextContent.js +0 -1
- package/build/components/Radio/RadioTileRoot.js +9 -1
- package/build/components/RadioCard/RadioCardIndicator.js +3 -3
- package/build/components/RadioCard/RadioCardRoot.js +3 -3
- package/build/components/Tabs/Tab.js +5 -5
- package/build/components/ToggleButton/ToggleButtonRoot.js +2 -2
- package/build/components/ToggleButtonCard/ToggleButtonCardRoot.js +3 -3
- package/build/components/UnstyledIconButton/UnstyledIconButtonRoot.js +1 -1
- package/build/components/VerificationInput/VerificationInput.d.ts +6 -0
- package/build/components/VerificationInput/VerificationInput.js +35 -0
- package/build/components/VerificationInput/VerificationInput.props.d.ts +49 -0
- package/build/components/VerificationInput/VerificationInput.props.js +1 -0
- package/build/components/VerificationInput/VerificationInputSlot.d.ts +9 -0
- package/build/components/VerificationInput/VerificationInputSlot.js +72 -0
- package/build/components/VerificationInput/index.d.ts +4 -0
- package/build/components/VerificationInput/index.js +3 -0
- package/build/components/VerificationInput/useVerificationInput.d.ts +14 -0
- package/build/components/VerificationInput/useVerificationInput.js +58 -0
- package/build/components/index.d.ts +1 -0
- package/build/components/index.js +1 -0
- package/docs/components/AllComponents.web.tsx +9 -0
- package/package.json +10 -11
- package/src/components/Accordion/Accordion.figma.tsx +23 -0
- package/src/components/Accordion/AccordionItemRoot.figma.tsx +47 -0
- package/src/components/Accordion/AccordionTrigger.tsx +1 -1
- package/src/components/Alert/Alert.figma.tsx +47 -0
- package/src/components/Avatar/Avatar.figma.tsx +33 -0
- package/src/components/Badge/Badge.figma.tsx +48 -24
- package/src/components/Banner/Banner.figma.tsx +15 -0
- package/src/components/Banner/BannerIllustration.figma.tsx +30 -0
- package/src/components/BodyText/index.ts +1 -0
- package/src/components/BottomSheet/BottomSheetModal.figma.tsx +20 -0
- package/src/components/Button/Button.figma.tsx +60 -229
- package/src/components/Card/Card.figma.tsx +43 -71
- package/src/components/Card/CardAction/CardAction.figma.tsx +44 -0
- package/src/components/Card/CardAction/CardAction.stories.tsx +1 -1
- package/src/components/Carousel/Carousel.figma.tsx +19 -0
- package/src/components/Checkbox/Checkbox.figma.tsx +26 -41
- package/src/components/Checkbox/CheckboxGroup.context.ts +1 -0
- package/src/components/Checkbox/CheckboxGroup.figma.tsx +20 -0
- package/src/components/Checkbox/CheckboxGroup.tsx +7 -8
- package/src/components/Checkbox/CheckboxImage.figma.tsx +27 -0
- package/src/components/Checkbox/CheckboxIndicator.tsx +3 -3
- package/src/components/Checkbox/CheckboxTextContent.tsx +0 -1
- package/src/components/Checkbox/CheckboxTileRoot.figma.tsx +32 -0
- package/src/components/Checkbox/CheckboxTileRoot.tsx +9 -1
- package/src/components/CurrencyInput/CurrencyInput.figma.tsx +56 -0
- package/src/components/DateInput/DateInput.figma.tsx +75 -0
- package/src/components/DatePicker/DatePickerCalendar.figma.tsx +34 -0
- package/src/components/DatePicker/DatePickerDay.tsx +3 -3
- package/src/components/DatePickerInput/DatePickerInput.figma.tsx +62 -0
- package/src/components/DescriptionList/DescriptionList.figma.tsx +23 -0
- package/src/components/Divider/Divider.figma.tsx +23 -18
- package/src/components/ExpandableCard/ExpandableCard.figma.tsx +54 -0
- package/src/components/ExpandableCard/ExpandableCardGroup.figma.tsx +23 -0
- package/src/components/FormField/FormField.figma.tsx +23 -0
- package/src/components/Helper/HelperText.figma.tsx +23 -0
- package/src/components/IconButton/IconButton.figma.tsx +55 -161
- package/src/components/IconContainer/IconContainer.figma.tsx +50 -0
- package/src/components/InlineLink/InlineLink.figma.tsx +33 -0
- package/src/components/Input/Input.figma.tsx +52 -110
- package/src/components/Label/Label.figma.tsx +24 -0
- package/src/components/Link/Link.figma.tsx +42 -0
- package/src/components/List/List.context.ts +4 -0
- package/src/components/List/List.docs.mdx +30 -24
- package/src/components/List/List.figma.tsx +29 -108
- package/src/components/List/List.stories.tsx +26 -1
- package/src/components/List/List.tsx +26 -19
- package/src/components/List/ListAction/ListAction.figma.tsx +29 -0
- package/src/components/List/ListAction/ListAction.props.ts +0 -1
- package/src/components/List/ListAction/ListAction.tsx +3 -2
- package/src/components/List/ListItem/ListItem.figma.tsx +40 -220
- package/src/components/List/ListItem/ListItem.props.ts +4 -1
- package/src/components/List/ListItem/ListItemHeading.tsx +20 -0
- package/src/components/List/ListItem/ListItemHelperText.tsx +2 -3
- package/src/components/List/ListItem/ListItemLeadingContent.figma.tsx +29 -0
- package/src/components/List/ListItem/ListItemRoot.tsx +11 -6
- package/src/components/List/ListItem/ListItemTrailingContent.figma.tsx +27 -0
- package/src/components/List/ListItem/index.ts +1 -1
- package/src/components/Menu/Menu.figma.tsx +30 -0
- package/src/components/Menu/MenuItem.figma.tsx +31 -0
- package/src/components/Modal/Modal.docs.mdx +23 -20
- package/src/components/Modal/Modal.figma.tsx +56 -0
- package/src/components/PillGroup/Pill.figma.tsx +25 -0
- package/src/components/PillGroup/Pill.tsx +3 -3
- package/src/components/PillGroup/PillGroup.figma.tsx +21 -0
- package/src/components/ProgressStepper/ProgressStep.figma.tsx +30 -0
- package/src/components/ProgressStepper/ProgressStepper.figma.tsx +20 -0
- package/src/components/Radio/Radio.figma.tsx +22 -42
- package/src/components/Radio/Radio.stories.tsx +24 -0
- package/src/components/Radio/RadioGroup.context.ts +1 -0
- package/src/components/Radio/RadioGroup.figma.tsx +54 -0
- package/src/components/Radio/RadioGroup.tsx +2 -2
- package/src/components/Radio/RadioImage.figma.tsx +27 -0
- package/src/components/Radio/RadioIndicator.tsx +3 -3
- package/src/components/Radio/RadioTextContent.tsx +0 -1
- package/src/components/Radio/RadioTileRoot.figma.tsx +31 -0
- package/src/components/Radio/RadioTileRoot.tsx +9 -1
- package/src/components/RadioCard/RadioCardIndicator.tsx +3 -3
- package/src/components/RadioCard/RadioCardRoot.tsx +3 -3
- package/src/components/SectionHeader/SectionHeader.figma.tsx +30 -16
- package/src/components/Select/Select.figma.tsx +55 -0
- package/src/components/Select/SelectOption.figma.tsx +36 -0
- package/src/components/Spinner/Spinner.figma.tsx +20 -12
- package/src/components/Switch/Switch.figma.tsx +31 -23
- package/src/components/Tabs/Tab.tsx +5 -5
- package/src/components/Tabs/Tabs.figma.tsx +29 -0
- package/src/components/ThemedImage/ThemedImage.stories.tsx +1 -1
- package/src/components/Toast/ToastItem.figma.tsx +22 -0
- package/src/components/ToggleButton/ToggleButtonRoot.tsx +2 -2
- package/src/components/ToggleButtonCard/ToggleButtonCardRoot.tsx +3 -3
- package/src/components/UnstyledIconButton/UnstyledIconButton.figma.tsx +49 -0
- package/src/components/UnstyledIconButton/UnstyledIconButtonRoot.tsx +1 -1
- package/src/components/VerificationInput/VerificationInput.docs.mdx +68 -0
- package/src/components/VerificationInput/VerificationInput.props.ts +52 -0
- package/src/components/VerificationInput/VerificationInput.stories.tsx +140 -0
- package/src/components/VerificationInput/VerificationInput.tsx +89 -0
- package/src/components/VerificationInput/VerificationInputSlot.tsx +94 -0
- package/src/components/VerificationInput/index.ts +5 -0
- package/src/components/VerificationInput/useVerificationInput.ts +72 -0
- package/src/components/index.ts +1 -0
- package/build/components/List/ListItem/ListItemText.d.ts +0 -6
- package/build/components/List/ListItem/ListItemText.js +0 -7
- package/src/components/Checkbox/CheckboxIndicator.figma.tsx +0 -19
- package/src/components/List/ListItem/ListItemText.tsx +0 -14
- package/src/components/Radio/RadioIndicator.figma.tsx +0 -21
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
ListAction,
|
|
21
21
|
ListItem,
|
|
22
22
|
ListItemContent,
|
|
23
|
+
ListItemHeading,
|
|
23
24
|
ListItemHelperText,
|
|
24
25
|
ListItemIcon,
|
|
25
26
|
ListItemLeadingContent,
|
|
26
|
-
ListItemText,
|
|
27
27
|
ListItemTrailingContent,
|
|
28
28
|
ListItemTrailingIcon,
|
|
29
29
|
SectionHeader,
|
|
@@ -105,19 +105,21 @@ const MyComponent = () => (
|
|
|
105
105
|
|
|
106
106
|
### `ListItem`
|
|
107
107
|
|
|
108
|
-
| Name
|
|
109
|
-
|
|
|
110
|
-
| heading
|
|
111
|
-
| onPress
|
|
112
|
-
| helperText
|
|
113
|
-
| leadingContent
|
|
114
|
-
| trailingContent
|
|
115
|
-
| variant
|
|
116
|
-
| disabled
|
|
117
|
-
| loading
|
|
118
|
-
| badge
|
|
119
|
-
| badgePosition
|
|
120
|
-
| numericValue
|
|
108
|
+
| Name | Type | Default | Description |
|
|
109
|
+
| ------------------ | ------------------------ | -------- | --------------------------------------------------------------- |
|
|
110
|
+
| heading | `string` | | The text to display in the list item. |
|
|
111
|
+
| onPress | `() => void` | | A callback function to be called when the list item is pressed. |
|
|
112
|
+
| helperText | `string` | | The supporting text to display in the list item. |
|
|
113
|
+
| leadingContent | `ReactNode` | | The leading content to display in the list item. |
|
|
114
|
+
| trailingContent | `ReactNode` | | The trailing content to display in the list item. |
|
|
115
|
+
| variant | `'subtle' \| 'emphasis'` | | The variant style of the list item. |
|
|
116
|
+
| disabled | `boolean` | `false` | Whether to disable the list item. |
|
|
117
|
+
| loading | `boolean` | `false` | Whether to show the list item in loading state. |
|
|
118
|
+
| badge | `ReactNode` | | The badge component to display in the list item. |
|
|
119
|
+
| badgePosition | `'top' \| 'bottom'` | `bottom` | Position of the badge in the list item. |
|
|
120
|
+
| numericValue | `string \| number` | | A numeric value to display on the right side of the item. |
|
|
121
|
+
| truncateHeading | `boolean` | `false` | Whether to truncate the heading text if it overflows. |
|
|
122
|
+
| truncateHelperText | `boolean` | `false` | Whether to truncate the helper text if it overflows. |
|
|
121
123
|
|
|
122
124
|
### `ListAction`
|
|
123
125
|
|
|
@@ -137,10 +139,14 @@ const MyComponent = () => (
|
|
|
137
139
|
|
|
138
140
|
#### - `ListItemContent`
|
|
139
141
|
|
|
140
|
-
#### - `
|
|
142
|
+
#### - `ListItemHeading`
|
|
143
|
+
|
|
144
|
+
Has all props of the [`BodyText` component](?path=/docs/typography-body-text--docs).
|
|
141
145
|
|
|
142
146
|
#### - `ListItemHelperText`
|
|
143
147
|
|
|
148
|
+
Has all props of the [`BodyText` component](?path=/docs/typography-body-text--docs).
|
|
149
|
+
|
|
144
150
|
#### - `ListItemTrailingContent`
|
|
145
151
|
|
|
146
152
|
#### - `ListItemTrailingIcon`
|
|
@@ -478,7 +484,7 @@ If you need to use the `<List>` component in a more advanced way, you can use th
|
|
|
478
484
|
<ListItemIcon as={BillMediumIcon} />
|
|
479
485
|
</ListItemLeadingContent>
|
|
480
486
|
<ListItemContent>
|
|
481
|
-
<
|
|
487
|
+
<ListItemHeading>Bills</ListItemHeading>
|
|
482
488
|
<ListItemHelperText>View your bills</ListItemHelperText>
|
|
483
489
|
</ListItemContent>
|
|
484
490
|
<ListItemTrailingContent>
|
|
@@ -490,7 +496,7 @@ If you need to use the `<List>` component in a more advanced way, you can use th
|
|
|
490
496
|
<ListItemIcon as={PaymentMediumIcon} />
|
|
491
497
|
</ListItemLeadingContent>
|
|
492
498
|
<ListItemContent>
|
|
493
|
-
<
|
|
499
|
+
<ListItemHeading>Payments</ListItemHeading>
|
|
494
500
|
<ListItemHelperText>Make a payment</ListItemHelperText>
|
|
495
501
|
</ListItemContent>
|
|
496
502
|
<ListItemTrailingContent>
|
|
@@ -502,7 +508,7 @@ If you need to use the `<List>` component in a more advanced way, you can use th
|
|
|
502
508
|
<ListItemIcon as={HomeMediumIcon} />
|
|
503
509
|
</ListItemLeadingContent>
|
|
504
510
|
<ListItemContent>
|
|
505
|
-
<
|
|
511
|
+
<ListItemHeading>Moving home</ListItemHeading>
|
|
506
512
|
<ListItemHelperText>Tell us if your moving</ListItemHelperText>
|
|
507
513
|
</ListItemContent>
|
|
508
514
|
<ListItemTrailingContent>
|
|
@@ -514,7 +520,7 @@ If you need to use the `<List>` component in a more advanced way, you can use th
|
|
|
514
520
|
<ListItemIcon as={UserMediumIcon} />
|
|
515
521
|
</ListItemLeadingContent>
|
|
516
522
|
<ListItemContent>
|
|
517
|
-
<
|
|
523
|
+
<ListItemHeading>Refer a friend</ListItemHeading>
|
|
518
524
|
<ListItemHelperText>Get rewarded with a friend</ListItemHelperText>
|
|
519
525
|
</ListItemContent>
|
|
520
526
|
<ListItemTrailingContent>
|
|
@@ -532,7 +538,7 @@ import {
|
|
|
532
538
|
ListItemIcon,
|
|
533
539
|
ListItemLeadingContent,
|
|
534
540
|
ListItemHelperText,
|
|
535
|
-
|
|
541
|
+
ListItemHeading,
|
|
536
542
|
ListItemTrailingContent,
|
|
537
543
|
ListItemTrailingIcon,
|
|
538
544
|
ListItemContent,
|
|
@@ -553,7 +559,7 @@ const MyComponent = () => (
|
|
|
553
559
|
<ListItemIcon as={BillMediumIcon} />
|
|
554
560
|
</ListItemLeadingContent>
|
|
555
561
|
<ListItemContent>
|
|
556
|
-
<
|
|
562
|
+
<ListItemHeading>Bills</ListItemHeading>
|
|
557
563
|
<ListItemHelperText>View your bills</ListItemHelperText>
|
|
558
564
|
</ListItemContent>
|
|
559
565
|
<ListItemTrailingContent>
|
|
@@ -565,7 +571,7 @@ const MyComponent = () => (
|
|
|
565
571
|
<ListItemIcon as={PaymentMediumIcon} />
|
|
566
572
|
</ListItemLeadingContent>
|
|
567
573
|
<ListItemContent>
|
|
568
|
-
<
|
|
574
|
+
<ListItemHeading>Payments</ListItemHeading>
|
|
569
575
|
<ListItemHelperText>Make a payment</ListItemHelperText>
|
|
570
576
|
</ListItemContent>
|
|
571
577
|
<ListItemTrailingContent>
|
|
@@ -577,7 +583,7 @@ const MyComponent = () => (
|
|
|
577
583
|
<ListItemIcon as={HomeMediumIcon} />
|
|
578
584
|
</ListItemLeadingContent>
|
|
579
585
|
<ListItemContent>
|
|
580
|
-
<
|
|
586
|
+
<ListItemHeading>Moving home</ListItemHeading>
|
|
581
587
|
<ListItemHelperText>Tell us if your moving</ListItemHelperText>
|
|
582
588
|
</ListItemContent>
|
|
583
589
|
<ListItemTrailingContent>
|
|
@@ -589,7 +595,7 @@ const MyComponent = () => (
|
|
|
589
595
|
<ListItemIcon as={UserMediumIcon} />
|
|
590
596
|
</ListItemLeadingContent>
|
|
591
597
|
<ListItemContent>
|
|
592
|
-
<
|
|
598
|
+
<ListItemHeading>Refer a friend</ListItemHeading>
|
|
593
599
|
<ListItemHelperText>Get rewarded with a friend</ListItemHelperText>
|
|
594
600
|
</ListItemContent>
|
|
595
601
|
<ListItemTrailingContent>
|
|
@@ -1,110 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// import figma from '@figma/code-connect';
|
|
5
|
-
// import { Card } from '../Card';
|
|
1
|
+
import React from "react"
|
|
2
|
+
import List from "./List"
|
|
3
|
+
import figma from "@figma/code-connect"
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// listItems: figma.children('List Items'),
|
|
14
|
-
// cardProps: figma.nestedProps('Card', {
|
|
15
|
-
// variant: figma.enum('variant', {
|
|
16
|
-
// dashed: 'dashed',
|
|
17
|
-
// elevated: 'elevated',
|
|
18
|
-
// outline: 'outline',
|
|
19
|
-
// filled: 'filled',
|
|
20
|
-
// }),
|
|
21
|
-
// padding: figma.enum('padding', {
|
|
22
|
-
// large: 'large',
|
|
23
|
-
// medium: 'medium',
|
|
24
|
-
// small: 'small',
|
|
25
|
-
// none: 'none',
|
|
26
|
-
// }),
|
|
27
|
-
// colorScheme: figma.enum('colorScheme', {
|
|
28
|
-
// base: 'base',
|
|
29
|
-
// grey: 'grey',
|
|
30
|
-
// purple: 'purple',
|
|
31
|
-
// }),
|
|
32
|
-
// surface: figma.enum('surface', {
|
|
33
|
-
// base: 'base',
|
|
34
|
-
// purple: 'purple',
|
|
35
|
-
// }),
|
|
36
|
-
// }),
|
|
37
|
-
// };
|
|
5
|
+
/**
|
|
6
|
+
* -- This file was auto-generated by Code Connect --
|
|
7
|
+
* `props` includes a mapping from your code props to Figma properties.
|
|
8
|
+
* You should check this is correct, and update the `example` function
|
|
9
|
+
* to return the code example you'd like to see in Figma
|
|
10
|
+
*/
|
|
38
11
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
// </List>
|
|
60
|
-
// ),
|
|
61
|
-
// }
|
|
62
|
-
// );
|
|
63
|
-
|
|
64
|
-
// figma.connect(
|
|
65
|
-
// List,
|
|
66
|
-
// 'https://www.figma.com/design/3RY3OvLA88yZksRjOfjQJm/UW-App-UI?node-id=4643-17907&m=dev',
|
|
67
|
-
// {
|
|
68
|
-
// props,
|
|
69
|
-
// variant: {
|
|
70
|
-
// container: 'tile',
|
|
71
|
-
// 'Heading?': true,
|
|
72
|
-
// },
|
|
73
|
-
// example: ({ heading, listItems, cardProps }) => (
|
|
74
|
-
// <List
|
|
75
|
-
// container="card"
|
|
76
|
-
// headingText={heading.text}
|
|
77
|
-
// headingHelperText={heading.helperText}
|
|
78
|
-
// >
|
|
79
|
-
// <Card {...cardProps}>{listItems}</Card>
|
|
80
|
-
// </List>
|
|
81
|
-
// ),
|
|
82
|
-
// }
|
|
83
|
-
// );
|
|
84
|
-
|
|
85
|
-
// figma.connect(
|
|
86
|
-
// List,
|
|
87
|
-
// 'https://www.figma.com/design/3RY3OvLA88yZksRjOfjQJm/UW-App-UI?node-id=4643-17907&m=dev',
|
|
88
|
-
// {
|
|
89
|
-
// props,
|
|
90
|
-
// variant: {
|
|
91
|
-
// container: 'tile',
|
|
92
|
-
// 'Heading?': false,
|
|
93
|
-
// },
|
|
94
|
-
// example: ({ listItems, cardProps }) => (
|
|
95
|
-
// <List container="card">
|
|
96
|
-
// <Card {...cardProps}>{listItems}</Card>
|
|
97
|
-
// </List>
|
|
98
|
-
// ),
|
|
99
|
-
// }
|
|
100
|
-
// );
|
|
101
|
-
|
|
102
|
-
// figma.connect(
|
|
103
|
-
// List,
|
|
104
|
-
// 'https://www.figma.com/design/3RY3OvLA88yZksRjOfjQJm/UW-App-UI?node-id=4623-14698&m=dev',
|
|
105
|
-
// {
|
|
106
|
-
// props,
|
|
107
|
-
// imports: [],
|
|
108
|
-
// example: ({ listItem }) => <>{listItem}</>,
|
|
109
|
-
// }
|
|
110
|
-
// );
|
|
12
|
+
figma.connect(
|
|
13
|
+
List,
|
|
14
|
+
"https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=2437%3A621",
|
|
15
|
+
{
|
|
16
|
+
props: {
|
|
17
|
+
// These props were automatically mapped based on your linked code:
|
|
18
|
+
container: figma.enum("Container", {
|
|
19
|
+
None: "none",
|
|
20
|
+
"Subtle White": "subtleWhite",
|
|
21
|
+
"Emphasis White": "emphasisWhite",
|
|
22
|
+
"Subtle Warm White": "subtleWarmWhite",
|
|
23
|
+
"Emphasis Warm White": "emphasisWarmWhite",
|
|
24
|
+
}),
|
|
25
|
+
// No matching props could be found for these Figma properties:
|
|
26
|
+
// "sectionHeader": figma.boolean('Section header?'),
|
|
27
|
+
// "listAction": figma.boolean('List action?')
|
|
28
|
+
},
|
|
29
|
+
example: (props) => <List container={props.container} />,
|
|
30
|
+
},
|
|
31
|
+
)
|
|
@@ -212,6 +212,30 @@ export const WithSectionHeader: Story = {
|
|
|
212
212
|
),
|
|
213
213
|
};
|
|
214
214
|
|
|
215
|
+
const CustomListItem = () => (
|
|
216
|
+
<ListItem
|
|
217
|
+
heading="Custom List Item"
|
|
218
|
+
helperText="This is a custom list item component"
|
|
219
|
+
leadingContent={<ListItemIcon as={SettingsMediumIcon} />}
|
|
220
|
+
trailingContent={<ListItemTrailingIcon as={ChevronRightSmallIcon} />}
|
|
221
|
+
onPress={() => console.log('Custom List Item pressed')}
|
|
222
|
+
/>
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
export const WithCustomListItemComponent: Story = {
|
|
226
|
+
parameters: {
|
|
227
|
+
controls: { include: [] },
|
|
228
|
+
},
|
|
229
|
+
render: () => (
|
|
230
|
+
<List container="subtleWarmWhite">
|
|
231
|
+
<CustomListItem />
|
|
232
|
+
<CustomListItem />
|
|
233
|
+
<CustomListItem />
|
|
234
|
+
<ListAction heading="Contact support" onPress={() => console.log('Contact pressed')} />
|
|
235
|
+
</List>
|
|
236
|
+
),
|
|
237
|
+
};
|
|
238
|
+
|
|
215
239
|
export const WithListAction: Story = {
|
|
216
240
|
parameters: {
|
|
217
241
|
controls: { include: [] },
|
|
@@ -219,7 +243,8 @@ export const WithListAction: Story = {
|
|
|
219
243
|
render: () => (
|
|
220
244
|
<List container="subtleWarmWhite">
|
|
221
245
|
<ListItem
|
|
222
|
-
heading="Upgrade your plan"
|
|
246
|
+
heading="Upgrade your plan this is really long text to test wrapping"
|
|
247
|
+
truncateHeading={true}
|
|
223
248
|
helperText="Get more features with a premium plan"
|
|
224
249
|
onPress={() => console.log('Upgrade pressed')}
|
|
225
250
|
/>
|
|
@@ -3,9 +3,10 @@ import { View, ViewProps } from 'react-native';
|
|
|
3
3
|
import { StyleSheet } from 'react-native-unistyles';
|
|
4
4
|
import { Card } from '../Card';
|
|
5
5
|
import { SectionHeader } from '../SectionHeader';
|
|
6
|
-
import { ListContext } from './List.context';
|
|
6
|
+
import { ListContext, ListFirstItemContext } from './List.context';
|
|
7
7
|
import type ListProps from './List.props';
|
|
8
|
-
import {
|
|
8
|
+
import { ListAction } from './ListAction';
|
|
9
|
+
import { ListItem } from './ListItem';
|
|
9
10
|
|
|
10
11
|
const markFirstListItem = (children: ReactNode): ViewProps['children'] => {
|
|
11
12
|
let found = false;
|
|
@@ -14,24 +15,30 @@ const markFirstListItem = (children: ReactNode): ViewProps['children'] => {
|
|
|
14
15
|
return React.Children.map(children, (child: ReactNode): ReactNode => {
|
|
15
16
|
if (!React.isValidElement(child)) return child;
|
|
16
17
|
|
|
17
|
-
// Check if the current element is the ListItem and hasn't been marked yet
|
|
18
|
-
if (!found
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
// Check if the current element is the ListItem or ListAction and hasn't been marked yet
|
|
19
|
+
if (!found) {
|
|
20
|
+
if (child.type === ListItem || child.type === ListAction) {
|
|
21
|
+
found = true;
|
|
22
|
+
return (
|
|
23
|
+
<ListFirstItemContext.Provider value={true}>{child}</ListFirstItemContext.Provider>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
// If the child has nested children, process them recursively
|
|
28
|
+
if (
|
|
29
|
+
React.isValidElement(child) &&
|
|
30
|
+
child.props &&
|
|
31
|
+
typeof child.props === 'object' &&
|
|
32
|
+
child.props !== null &&
|
|
33
|
+
'children' in child.props &&
|
|
34
|
+
child.props.children
|
|
35
|
+
) {
|
|
36
|
+
const clonedChildren = recursiveClone((child.props as any).children);
|
|
37
|
+
return React.cloneElement(child, { children: clonedChildren } as any);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
found = true;
|
|
41
|
+
return <ListFirstItemContext.Provider value={true}>{child}</ListFirstItemContext.Provider>;
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
return child;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import figma from '@figma/code-connect';
|
|
2
|
+
import ListAction from './ListAction';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* -- This file was auto-generated by Code Connect --
|
|
6
|
+
* `props` includes a mapping from your code props to Figma properties.
|
|
7
|
+
* You should check this is correct, and update the `example` function
|
|
8
|
+
* to return the code example you'd like to see in Figma
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
figma.connect(
|
|
12
|
+
ListAction,
|
|
13
|
+
'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=9661%3A5128',
|
|
14
|
+
{
|
|
15
|
+
props: {
|
|
16
|
+
// These props were automatically mapped based on your linked code:
|
|
17
|
+
heading: figma.string('Action heading'),
|
|
18
|
+
disabled: figma.enum('State', {
|
|
19
|
+
Disabled: true,
|
|
20
|
+
}),
|
|
21
|
+
'aria-disabled': figma.enum('State', {
|
|
22
|
+
Disabled: true,
|
|
23
|
+
}),
|
|
24
|
+
// No matching props could be found for these Figma properties:
|
|
25
|
+
// "actionHeading": figma.string('Action heading')
|
|
26
|
+
},
|
|
27
|
+
example: props => <ListAction heading={props.heading} disabled={props.disabled} />,
|
|
28
|
+
}
|
|
29
|
+
);
|
|
@@ -2,7 +2,7 @@ import { createPressable } from '@gluestack-ui/pressable';
|
|
|
2
2
|
import { ChevronRightSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
3
3
|
import { Pressable, ViewStyle } from 'react-native';
|
|
4
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
|
-
import { useListContext } from '../List.context';
|
|
5
|
+
import { useListContext, useListFirstItemContext } from '../List.context';
|
|
6
6
|
import type ListActionProps from './ListAction.props';
|
|
7
7
|
import ListActionContent from './ListActionContent';
|
|
8
8
|
import ListActionText from './ListActionText';
|
|
@@ -17,6 +17,7 @@ const ListActionRoot = ({
|
|
|
17
17
|
}: ListActionProps & { states?: { active?: boolean; disabled?: boolean } }) => {
|
|
18
18
|
const { onPress } = props;
|
|
19
19
|
const listContext = useListContext();
|
|
20
|
+
const isFirstContext = useListFirstItemContext();
|
|
20
21
|
|
|
21
22
|
const { active } = props.states || { active: false };
|
|
22
23
|
|
|
@@ -40,7 +41,7 @@ const ListActionRoot = ({
|
|
|
40
41
|
disabled: isDisabled,
|
|
41
42
|
active,
|
|
42
43
|
showDisabled: !listContext?.disabled && disabled,
|
|
43
|
-
isFirstChild:
|
|
44
|
+
isFirstChild: isFirstContext,
|
|
44
45
|
container: listContext?.container,
|
|
45
46
|
});
|
|
46
47
|
|