@utilitywarehouse/hearth-react-native 0.19.1 → 0.20.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 +13 -13
- package/CHANGELOG.md +50 -4
- package/build/components/Select/Select.d.ts +1 -1
- package/build/components/Select/Select.js +9 -10
- package/build/components/Select/Select.props.d.ts +16 -0
- package/package.json +3 -3
- package/src/components/Checkbox/CheckboxGroup.figma.tsx +21 -1
- package/src/components/PillGroup/Pill.figma.tsx +4 -17
- package/src/components/PillGroup/PillGroup.figma.tsx +8 -9
- package/src/components/ProgressStepper/ProgressStep.figma.tsx +4 -15
- package/src/components/ProgressStepper/ProgressStepper.figma.tsx +9 -16
- package/src/components/Radio/Radio.figma.tsx +35 -22
- package/src/components/Radio/RadioGroup.figma.tsx +69 -41
- package/src/components/Radio/RadioTile.figma.tsx +34 -0
- package/src/components/RadioCard/RadioCard.figma.tsx +24 -0
- package/src/components/SectionHeader/SectionHeader.figma.tsx +31 -25
- package/src/components/Select/Select.docs.mdx +76 -28
- package/src/components/Select/Select.figma.tsx +44 -43
- package/src/components/Select/Select.props.ts +16 -0
- package/src/components/Select/Select.tsx +42 -35
- package/src/components/Select/SelectOption.figma.tsx +3 -21
- package/src/components/Spinner/Spinner.figma.tsx +12 -25
- package/src/components/Switch/Switch.figma.tsx +2 -23
- package/src/components/Tabs/Tab.figma.tsx +21 -0
- package/src/components/Tabs/Tabs.figma.tsx +18 -27
- package/src/components/Textarea/Textarea.figma.tsx +64 -0
- package/src/components/ToggleButtonCard/ToggleButtonCard.figma.tsx +24 -0
- package/src/components/VerificationInput/VerificationInput.figma.tsx +53 -0
- package/src/components/Radio/RadioTileRoot.figma.tsx +0 -31
|
@@ -1,31 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import SectionHeader from
|
|
3
|
-
import figma from "@figma/code-connect"
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* -- This file was auto-generated by Code Connect --
|
|
7
|
-
* None of your props could be automatically mapped to Figma properties.
|
|
8
|
-
* You should update the `props` object to include a mapping from your
|
|
9
|
-
* code props to Figma properties, and update the `example` function to
|
|
10
|
-
* return the code example you'd like to see in Figma
|
|
11
|
-
*/
|
|
1
|
+
import figma from '@figma/code-connect';
|
|
2
|
+
import { SectionHeader } from '../';
|
|
12
3
|
|
|
13
4
|
figma.connect(
|
|
14
5
|
SectionHeader,
|
|
15
|
-
|
|
6
|
+
'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=9092%3A3352',
|
|
16
7
|
{
|
|
17
8
|
props: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
trailingContent: figma.boolean('Trailing content?', {
|
|
10
|
+
true: figma.nestedProps('Trailing content', {
|
|
11
|
+
content: figma.children('Link'),
|
|
12
|
+
}),
|
|
13
|
+
}),
|
|
14
|
+
helperText: figma.boolean('Helper text?', {
|
|
15
|
+
true: figma.string('Helper text'),
|
|
16
|
+
}),
|
|
17
|
+
heading: figma.string('Heading'),
|
|
18
|
+
badge: figma.boolean('Badge?', {
|
|
19
|
+
true: figma.children('Badge'),
|
|
20
|
+
}),
|
|
21
|
+
invalidText: figma.enum('State', {
|
|
22
|
+
Invalid: figma.nestedProps('Validation Text', {
|
|
23
|
+
text: figma.string('Text'),
|
|
24
|
+
}),
|
|
25
|
+
}),
|
|
28
26
|
},
|
|
29
|
-
example:
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
example: props => (
|
|
28
|
+
<SectionHeader
|
|
29
|
+
heading={props.heading}
|
|
30
|
+
helperText={props.helperText}
|
|
31
|
+
badge={props.badge}
|
|
32
|
+
trailingContent={props.trailingContent?.content}
|
|
33
|
+
invalidText={props.invalidText?.text}
|
|
34
|
+
/>
|
|
35
|
+
),
|
|
36
|
+
}
|
|
37
|
+
);
|
|
@@ -20,6 +20,7 @@ The `Select` component creates a dropdown menu that allows users to choose from
|
|
|
20
20
|
- [`Select`](#select)
|
|
21
21
|
- [`SelectOption`](#selectoption)
|
|
22
22
|
- [Examples](#examples)
|
|
23
|
+
- [With label and helper text](#with-label-and-helper-text)
|
|
23
24
|
- [With `FormField`](#with-formfield)
|
|
24
25
|
- [Searchable `Select`](#searchable-select)
|
|
25
26
|
- [Inline `SelectOption`](#inline-selectoption)
|
|
@@ -77,42 +78,89 @@ const MyComponent = () => {
|
|
|
77
78
|
|
|
78
79
|
The `Select` component inherits all of the React Native [`View` props](https://reactnative.dev/docs/view).
|
|
79
80
|
|
|
80
|
-
| Prop | Type | Default | Description
|
|
81
|
-
| ----------------- | ----------------------------------- | ------------------------ |
|
|
82
|
-
| options | SelectOptionProps[]
|
|
83
|
-
| value | string \| null
|
|
84
|
-
| onValueChange | (value: string) => void
|
|
85
|
-
| label | string
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
-
|
|
|
98
|
-
|
|
|
81
|
+
| Prop | Type | Default | Description |
|
|
82
|
+
| ----------------- | ----------------------------------- | ------------------------ | -------------------------------------------------------------------------- |
|
|
83
|
+
| options | `SelectOptionProps[]` | `[]` | Array of options to display in the select. |
|
|
84
|
+
| value | `string \| null` | `-` | Currently selected value. |
|
|
85
|
+
| onValueChange | `(value: string) => void` | `-` | Callback when value changes. |
|
|
86
|
+
| label | `string` | `-` | Label for the select. |
|
|
87
|
+
| labelVariant | `'body' \| 'heading'` | `'body'` | Variant for the label. 'inline' will display the label next to the select. |
|
|
88
|
+
| helperText | `string` | `-` | Helper text to display below the select. |
|
|
89
|
+
| helperIcon | `React.ComponentType` | `-` | Optional icon to display next to the helper text. |
|
|
90
|
+
| placeholder | `string` | `'Select an option'` | Placeholder text to show when no value is selected. |
|
|
91
|
+
| disabled | `boolean` | `false` | Whether the select is disabled. |
|
|
92
|
+
| readonly | `boolean` | `false` | Whether the select is readonly. |
|
|
93
|
+
| leadingIcon | `React.ComponentType` | `-` | Icon to display before the select text. |
|
|
94
|
+
| validationStatus | `'initial' \| 'valid' \| 'invalid'` | `'initial'` | The validation status of the select. |
|
|
95
|
+
| invalidText | `string` | `-` | Text to display when validationStatus is 'invalid'. |
|
|
96
|
+
| validText | `string` | `-` | Text to display when validationStatus is 'valid'. |
|
|
97
|
+
| required | `boolean` | `true` | Indicates that the select is required. |
|
|
98
|
+
| menuHeading | `string` | `-` | Heading to display at the top of the menu. |
|
|
99
|
+
| children | `ReactNode` | `-` | Children to render inside the select (for custom options). |
|
|
100
|
+
| bottomSheetProps | `BottomSheetProps` | `-` | Props passed to the BottomSheetModal. |
|
|
101
|
+
| emptyText | `string` | `'No options available'` | Text to display when no options are available. |
|
|
102
|
+
| listProps | `object` | `-` | Props to be passed to the bottom sheet flat list. |
|
|
103
|
+
| searchable | `boolean` | `false` | Optional search functionality for the select. |
|
|
104
|
+
| searchPlaceholder | `string` | `'Search'` | Search placeholder. |
|
|
99
105
|
|
|
100
106
|
### `SelectOption`
|
|
101
107
|
|
|
102
108
|
The `SelectOption` component is used to create individual options within the `Select` component. It can be used inline or as part of the `options` prop.
|
|
103
109
|
|
|
104
|
-
| Prop | Type
|
|
105
|
-
| ------------ |
|
|
106
|
-
| label | string | `-` | Label to display for this option. |
|
|
107
|
-
| value | string | `-` | Value for this option. |
|
|
108
|
-
| leadingIcon | React.ComponentType | `-` | Optional left icon for this option. |
|
|
109
|
-
| trailingIcon | React.ComponentType | `-` | Optional right icon for this option. |
|
|
110
|
-
| selected | boolean | `-` | Whether this option is selected. |
|
|
111
|
-
| disabled | boolean | `false` | Whether this option is disabled. |
|
|
112
|
-
| onPress | (value: string) => void | `-` | Callback when this option is selected. |
|
|
110
|
+
| Prop | Type | Default | Description |
|
|
111
|
+
| ------------ | ------------------------- | ------- | -------------------------------------- |
|
|
112
|
+
| label | `string` | `-` | Label to display for this option. |
|
|
113
|
+
| value | `string` | `-` | Value for this option. |
|
|
114
|
+
| leadingIcon | `React.ComponentType` | `-` | Optional left icon for this option. |
|
|
115
|
+
| trailingIcon | `React.ComponentType` | `-` | Optional right icon for this option. |
|
|
116
|
+
| selected | `boolean` | `-` | Whether this option is selected. |
|
|
117
|
+
| disabled | `boolean` | `false` | Whether this option is disabled. |
|
|
118
|
+
| onPress | `(value: string) => void` | `-` | Callback when this option is selected. |
|
|
113
119
|
|
|
114
120
|
## Examples
|
|
115
121
|
|
|
122
|
+
## With label and helper text
|
|
123
|
+
|
|
124
|
+
<UsageWrap>
|
|
125
|
+
<Center>
|
|
126
|
+
<Select
|
|
127
|
+
label="Select an option"
|
|
128
|
+
helperText="This is some helper text for the select component."
|
|
129
|
+
placeholder="Select an option"
|
|
130
|
+
options={[
|
|
131
|
+
{ label: 'Option 1', value: '1' },
|
|
132
|
+
{ label: 'Option 2', value: '2' },
|
|
133
|
+
{ label: 'Option 3', value: '3' },
|
|
134
|
+
]}
|
|
135
|
+
value="1"
|
|
136
|
+
onValueChange={value => console.log('Selected:', value)}
|
|
137
|
+
/>
|
|
138
|
+
</Center>
|
|
139
|
+
</UsageWrap>
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
import { Select } from '@utilitywarehouse/hearth-react-native';
|
|
143
|
+
|
|
144
|
+
const MyComponent = () => {
|
|
145
|
+
const [value, setValue] = useState(null);
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<Select
|
|
149
|
+
label="Select an option"
|
|
150
|
+
helperText="This is some helper text for the select component."
|
|
151
|
+
placeholder="Select an option"
|
|
152
|
+
options={[
|
|
153
|
+
{ label: 'Option 1', value: '1' },
|
|
154
|
+
{ label: 'Option 2', value: '2' },
|
|
155
|
+
{ label: 'Option 3', value: '3' },
|
|
156
|
+
]}
|
|
157
|
+
value={value}
|
|
158
|
+
onValueChange={setValue}
|
|
159
|
+
/>
|
|
160
|
+
);
|
|
161
|
+
};
|
|
162
|
+
```
|
|
163
|
+
|
|
116
164
|
### With `FormField`
|
|
117
165
|
|
|
118
166
|
The `Select` component can be used with the `FormField` component for additional functionality like validation messages and helper text.
|
|
@@ -1,55 +1,56 @@
|
|
|
1
1
|
import figma from '@figma/code-connect';
|
|
2
|
-
import
|
|
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
|
-
*/
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Select } from '../';
|
|
10
4
|
|
|
11
5
|
figma.connect(Select, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3224%3A995', {
|
|
12
6
|
props: {
|
|
13
|
-
// These props were automatically mapped based on your linked code:
|
|
14
7
|
label: figma.string('Label'),
|
|
15
|
-
placeholder: figma.
|
|
8
|
+
placeholder: figma.enum('Value type', {
|
|
9
|
+
Placeholder: figma.string('Value'),
|
|
10
|
+
}),
|
|
16
11
|
disabled: figma.enum('Variant', {
|
|
17
12
|
Disabled: true,
|
|
18
13
|
}),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
'
|
|
14
|
+
validationStatus: figma.enum('Variant', {
|
|
15
|
+
Invalid: 'invalid',
|
|
16
|
+
Valid: 'valid',
|
|
22
17
|
}),
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
invalidText: figma.enum('Variant', {
|
|
19
|
+
Invalid: figma.string('Validation'),
|
|
20
|
+
}),
|
|
21
|
+
validText: figma.enum('Variant', {
|
|
22
|
+
Valid: figma.string('Validation'),
|
|
28
23
|
}),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
helperText: figma.boolean('Helper text?', {
|
|
25
|
+
true: figma.string('Helper text'),
|
|
26
|
+
}),
|
|
27
|
+
required: figma.boolean('Optional?', {
|
|
28
|
+
true: false,
|
|
29
|
+
}),
|
|
30
|
+
value: figma.enum('Value type', {
|
|
31
|
+
Selected: figma.string('Value'),
|
|
32
|
+
}),
|
|
33
|
+
},
|
|
34
|
+
example: props => {
|
|
35
|
+
const [value, setValue] = useState(null);
|
|
36
|
+
return (
|
|
37
|
+
<Select
|
|
38
|
+
label={props.label}
|
|
39
|
+
placeholder={props.placeholder}
|
|
40
|
+
disabled={props.disabled}
|
|
41
|
+
validationStatus={props.validationStatus}
|
|
42
|
+
invalidText={props.invalidText}
|
|
43
|
+
validText={props.validText}
|
|
44
|
+
helperText={props.helperText}
|
|
45
|
+
required={props.required}
|
|
46
|
+
options={[
|
|
47
|
+
{ label: 'Option 1', value: '1' },
|
|
48
|
+
{ label: 'Option 2', value: '2' },
|
|
49
|
+
{ label: 'Option 3', value: '3' },
|
|
50
|
+
]}
|
|
51
|
+
value={value}
|
|
52
|
+
onValueChange={value => setValue(value)}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
42
55
|
},
|
|
43
|
-
example: props => (
|
|
44
|
-
<Select
|
|
45
|
-
label={props.label}
|
|
46
|
-
placeholder={props.placeholder}
|
|
47
|
-
disabled={props.disabled}
|
|
48
|
-
emptyText={props.emptyText}
|
|
49
|
-
readonly={props.readonly}
|
|
50
|
-
collapsable={props.collapsable}
|
|
51
|
-
focusable={props.focusable}
|
|
52
|
-
hasTVPreferredFocus={props.hasTVPreferredFocus}
|
|
53
|
-
/>
|
|
54
|
-
),
|
|
55
56
|
});
|
|
@@ -53,6 +53,22 @@ interface SelectProps extends ViewProps {
|
|
|
53
53
|
* @default 'body'.
|
|
54
54
|
*/
|
|
55
55
|
labelVariant?: 'heading' | 'body';
|
|
56
|
+
/**
|
|
57
|
+
* Helper text to show below the select
|
|
58
|
+
*/
|
|
59
|
+
helperText?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Optional icon to display alongside the helper text
|
|
62
|
+
*/
|
|
63
|
+
helperIcon?: React.ComponentType;
|
|
64
|
+
/**
|
|
65
|
+
* Text to display when validationStatus is 'invalid'
|
|
66
|
+
*/
|
|
67
|
+
invalidText?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Text to display when validationStatus is 'valid'
|
|
70
|
+
*/
|
|
71
|
+
validText?: string;
|
|
56
72
|
/**
|
|
57
73
|
* Placeholder text to show when no value is selected
|
|
58
74
|
*/
|
|
@@ -10,10 +10,9 @@ import {
|
|
|
10
10
|
BottomSheetView,
|
|
11
11
|
} from '../BottomSheet';
|
|
12
12
|
import { DetailText } from '../DetailText';
|
|
13
|
-
import { useFormFieldContext } from '../FormField';
|
|
13
|
+
import { FormField, useFormFieldContext } from '../FormField';
|
|
14
14
|
import { Icon } from '../Icon';
|
|
15
15
|
import { Input } from '../Input';
|
|
16
|
-
import { Label } from '../Label';
|
|
17
16
|
import { SelectContext } from './Select.context';
|
|
18
17
|
import SelectProps, { SelectOptionItemProps } from './Select.props';
|
|
19
18
|
import SelectOption from './SelectOption';
|
|
@@ -28,6 +27,10 @@ const Select = ({
|
|
|
28
27
|
disabled = false,
|
|
29
28
|
leadingIcon: LeadingIcon,
|
|
30
29
|
validationStatus = 'initial',
|
|
30
|
+
helperText,
|
|
31
|
+
helperIcon,
|
|
32
|
+
invalidText,
|
|
33
|
+
validText,
|
|
31
34
|
required = true,
|
|
32
35
|
children,
|
|
33
36
|
bottomSheetProps,
|
|
@@ -122,42 +125,46 @@ const Select = ({
|
|
|
122
125
|
|
|
123
126
|
return (
|
|
124
127
|
<View {...rest} style={[styles.container, rest.style]}>
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
style={({ pressed }) => [
|
|
137
|
-
styles.selectContainer,
|
|
138
|
-
styles.pressedContainer(pressed || isOpen),
|
|
139
|
-
]}
|
|
128
|
+
<FormField
|
|
129
|
+
label={label}
|
|
130
|
+
labelVariant={labelVariant}
|
|
131
|
+
helperText={helperText}
|
|
132
|
+
helperIcon={helperIcon}
|
|
133
|
+
validationStatus={validationStatusFromContext}
|
|
134
|
+
required={isRequired}
|
|
135
|
+
disabled={isDisabled}
|
|
136
|
+
readonly={isReadonly}
|
|
137
|
+
invalidText={invalidText}
|
|
138
|
+
validText={validText}
|
|
140
139
|
>
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
140
|
+
<Pressable
|
|
141
|
+
onPress={openBottomSheet}
|
|
142
|
+
disabled={isDisabled || isReadonly}
|
|
143
|
+
style={({ pressed }) => [
|
|
144
|
+
styles.selectContainer,
|
|
145
|
+
styles.pressedContainer(pressed || isOpen),
|
|
146
|
+
]}
|
|
147
|
+
>
|
|
148
|
+
{!!LeadingIcon && (
|
|
149
|
+
<View>
|
|
150
|
+
{(() => {
|
|
151
|
+
const IconAny = Icon as any;
|
|
152
|
+
return <IconAny as={LeadingIcon} style={styles.icon as any} />;
|
|
153
|
+
})()}
|
|
154
|
+
</View>
|
|
155
|
+
)}
|
|
155
156
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
<View style={styles.optionContainer}>
|
|
158
|
+
<BodyText numberOfLines={1} style={styles.placeholderText}>
|
|
159
|
+
{selectedOption?.label || selectedLabel || placeholder}
|
|
160
|
+
</BodyText>
|
|
161
|
+
</View>
|
|
160
162
|
|
|
163
|
+
<View>
|
|
164
|
+
<Icon as={ExpandSmallIcon} style={styles.icon} />
|
|
165
|
+
</View>
|
|
166
|
+
</Pressable>
|
|
167
|
+
</FormField>
|
|
161
168
|
<BottomSheetModal
|
|
162
169
|
ref={bottomSheetModalRef}
|
|
163
170
|
snapPoints={['25%', '40%', '80%']}
|
|
@@ -1,36 +1,18 @@
|
|
|
1
1
|
import figma from '@figma/code-connect';
|
|
2
|
-
import SelectOption from '
|
|
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
|
-
*/
|
|
2
|
+
import { SelectOption } from '../';
|
|
10
3
|
|
|
11
4
|
figma.connect(
|
|
12
5
|
SelectOption,
|
|
13
6
|
'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=4340%3A1252',
|
|
14
7
|
{
|
|
15
8
|
props: {
|
|
16
|
-
// These props were automatically mapped based on your linked code:
|
|
17
9
|
label: figma.string('Label'),
|
|
18
|
-
selected: figma.boolean('Selected?'),
|
|
19
10
|
disabled: figma.enum('State', {
|
|
20
|
-
|
|
11
|
+
Disabled: true,
|
|
21
12
|
}),
|
|
22
|
-
// No matching props could be found for these Figma properties:
|
|
23
|
-
// "label": figma.string('Label'),
|
|
24
|
-
// "icon": figma.boolean('Icon?'),
|
|
25
|
-
// "icon20": figma.instance('Icon-20')
|
|
26
13
|
},
|
|
27
14
|
example: props => (
|
|
28
|
-
<SelectOption
|
|
29
|
-
label={props.label}
|
|
30
|
-
value={null}
|
|
31
|
-
selected={props.selected}
|
|
32
|
-
disabled={props.disabled}
|
|
33
|
-
/>
|
|
15
|
+
<SelectOption label={props.label} value="some value" disabled={props.disabled} />
|
|
34
16
|
),
|
|
35
17
|
}
|
|
36
18
|
);
|
|
@@ -1,27 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Spinner from
|
|
3
|
-
import figma from "@figma/code-connect"
|
|
1
|
+
import figma from '@figma/code-connect';
|
|
2
|
+
import { Spinner } from '../';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Spinner,
|
|
14
|
-
"https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=61%3A195",
|
|
15
|
-
{
|
|
16
|
-
props: {
|
|
17
|
-
// These props were automatically mapped based on your linked code:
|
|
18
|
-
size: figma.enum("Size", {
|
|
19
|
-
"XS-20": "xs",
|
|
20
|
-
"SM-24": "sm",
|
|
21
|
-
"MD-32": "md",
|
|
22
|
-
"LG-44": "lg",
|
|
23
|
-
}),
|
|
24
|
-
},
|
|
25
|
-
example: (props) => <Spinner size={props.size} />,
|
|
4
|
+
figma.connect(Spinner, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=61%3A195', {
|
|
5
|
+
props: {
|
|
6
|
+
size: figma.enum('Size', {
|
|
7
|
+
'XS-20': 'xs',
|
|
8
|
+
'SM-24': 'sm',
|
|
9
|
+
'MD-32': 'md',
|
|
10
|
+
'LG-44': 'lg',
|
|
11
|
+
}),
|
|
26
12
|
},
|
|
27
|
-
|
|
13
|
+
example: props => <Spinner size={props.size} />,
|
|
14
|
+
});
|
|
@@ -1,37 +1,16 @@
|
|
|
1
1
|
import figma from '@figma/code-connect';
|
|
2
|
-
import Switch from '
|
|
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
|
-
*/
|
|
2
|
+
import { Switch } from '../';
|
|
10
3
|
|
|
11
4
|
figma.connect(Switch, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3044%3A243', {
|
|
12
5
|
props: {
|
|
13
|
-
// These props were automatically mapped based on your linked code:
|
|
14
6
|
disabled: figma.enum('State', {
|
|
15
7
|
Disabled: true,
|
|
16
8
|
}),
|
|
17
|
-
'aria-disabled': figma.enum('State', {
|
|
18
|
-
Disabled: true,
|
|
19
|
-
}),
|
|
20
|
-
focusable: figma.enum('State', {
|
|
21
|
-
Focus: true,
|
|
22
|
-
}),
|
|
23
9
|
checked: figma.boolean('Checked?'),
|
|
24
10
|
size: figma.enum('Size', {
|
|
25
11
|
'MD-32': 'medium',
|
|
26
12
|
'SM-24': 'small',
|
|
27
13
|
}),
|
|
28
14
|
},
|
|
29
|
-
example: props =>
|
|
30
|
-
<Switch
|
|
31
|
-
value={props.checked}
|
|
32
|
-
disabled={props.disabled}
|
|
33
|
-
focusable={props.focusable}
|
|
34
|
-
size={props.size}
|
|
35
|
-
/>
|
|
36
|
-
),
|
|
15
|
+
example: props => <Switch value={props.checked} disabled={props.disabled} size={props.size} />,
|
|
37
16
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import figma from '@figma/code-connect';
|
|
2
|
+
import { Tab } from '..';
|
|
3
|
+
|
|
4
|
+
figma.connect(
|
|
5
|
+
Tab,
|
|
6
|
+
'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=6464-2288&m=dev',
|
|
7
|
+
{
|
|
8
|
+
props: {
|
|
9
|
+
label: figma.string('Label'),
|
|
10
|
+
icon: figma.boolean('Icon?', {
|
|
11
|
+
true: figma.instance('Icon-20'),
|
|
12
|
+
}),
|
|
13
|
+
tabs: figma.children('Tab item'),
|
|
14
|
+
},
|
|
15
|
+
example: props => (
|
|
16
|
+
<Tab value={props.label} icon={props.icon}>
|
|
17
|
+
{props.label}
|
|
18
|
+
</Tab>
|
|
19
|
+
),
|
|
20
|
+
}
|
|
21
|
+
);
|
|
@@ -1,29 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Tabs from
|
|
3
|
-
import figma from "@figma/code-connect"
|
|
1
|
+
import figma from '@figma/code-connect';
|
|
2
|
+
import { TabPanel, Tabs, TabsList } from '../';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
figma.connect(
|
|
13
|
-
Tabs,
|
|
14
|
-
"https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=6464%3A8744",
|
|
15
|
-
{
|
|
16
|
-
props: {
|
|
17
|
-
// These props were automatically mapped based on your linked code:
|
|
18
|
-
size: figma.enum("Size", {
|
|
19
|
-
"MD-56": "md",
|
|
20
|
-
"LG-64": "lg",
|
|
21
|
-
}),
|
|
22
|
-
// No matching props could be found for these Figma properties:
|
|
23
|
-
// "arrowLeft": figma.boolean('Arrow left?'),
|
|
24
|
-
// "arrowRight": figma.boolean('Arrow right?'),
|
|
25
|
-
// "condensed": figma.boolean('Condensed?')
|
|
26
|
-
},
|
|
27
|
-
example: (props) => <Tabs size={props.size} />,
|
|
4
|
+
figma.connect(Tabs, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=6464%3A8744', {
|
|
5
|
+
props: {
|
|
6
|
+
size: figma.enum('Size', {
|
|
7
|
+
'LG-64': 'lg',
|
|
8
|
+
}),
|
|
9
|
+
tabs: figma.children('Tab item'),
|
|
28
10
|
},
|
|
29
|
-
|
|
11
|
+
example: props => (
|
|
12
|
+
<Tabs size={props.size}>
|
|
13
|
+
<TabsList>{props.tabs}</TabsList>
|
|
14
|
+
{/* Example TabPanel content, make sure they match the value of your Tab items */}
|
|
15
|
+
<TabPanel value="account">Account content</TabPanel>
|
|
16
|
+
<TabPanel value="billing">Billing content</TabPanel>
|
|
17
|
+
<TabPanel value="usage">Usage content</TabPanel>
|
|
18
|
+
</Tabs>
|
|
19
|
+
),
|
|
20
|
+
});
|