@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.
Files changed (30) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-lint.log +13 -13
  3. package/CHANGELOG.md +50 -4
  4. package/build/components/Select/Select.d.ts +1 -1
  5. package/build/components/Select/Select.js +9 -10
  6. package/build/components/Select/Select.props.d.ts +16 -0
  7. package/package.json +3 -3
  8. package/src/components/Checkbox/CheckboxGroup.figma.tsx +21 -1
  9. package/src/components/PillGroup/Pill.figma.tsx +4 -17
  10. package/src/components/PillGroup/PillGroup.figma.tsx +8 -9
  11. package/src/components/ProgressStepper/ProgressStep.figma.tsx +4 -15
  12. package/src/components/ProgressStepper/ProgressStepper.figma.tsx +9 -16
  13. package/src/components/Radio/Radio.figma.tsx +35 -22
  14. package/src/components/Radio/RadioGroup.figma.tsx +69 -41
  15. package/src/components/Radio/RadioTile.figma.tsx +34 -0
  16. package/src/components/RadioCard/RadioCard.figma.tsx +24 -0
  17. package/src/components/SectionHeader/SectionHeader.figma.tsx +31 -25
  18. package/src/components/Select/Select.docs.mdx +76 -28
  19. package/src/components/Select/Select.figma.tsx +44 -43
  20. package/src/components/Select/Select.props.ts +16 -0
  21. package/src/components/Select/Select.tsx +42 -35
  22. package/src/components/Select/SelectOption.figma.tsx +3 -21
  23. package/src/components/Spinner/Spinner.figma.tsx +12 -25
  24. package/src/components/Switch/Switch.figma.tsx +2 -23
  25. package/src/components/Tabs/Tab.figma.tsx +21 -0
  26. package/src/components/Tabs/Tabs.figma.tsx +18 -27
  27. package/src/components/Textarea/Textarea.figma.tsx +64 -0
  28. package/src/components/ToggleButtonCard/ToggleButtonCard.figma.tsx +24 -0
  29. package/src/components/VerificationInput/VerificationInput.figma.tsx +53 -0
  30. package/src/components/Radio/RadioTileRoot.figma.tsx +0 -31
@@ -1,4 +1,4 @@
1
1
 
2
- > @utilitywarehouse/hearth-react-native@0.19.1 build /home/runner/work/hearth/hearth/packages/react-native
2
+ > @utilitywarehouse/hearth-react-native@0.20.0 build /home/runner/work/hearth/hearth/packages/react-native
3
3
  > tsc
4
4
 
@@ -1,5 +1,5 @@
1
1
 
2
- > @utilitywarehouse/hearth-react-native@0.19.1 lint /home/runner/work/hearth/hearth/packages/react-native
2
+ > @utilitywarehouse/hearth-react-native@0.20.0 lint /home/runner/work/hearth/hearth/packages/react-native
3
3
  > TIMING=1 eslint .
4
4
 
5
5
 
@@ -58,15 +58,15 @@
58
58
 
59
59
  ✖ 25 problems (0 errors, 25 warnings)
60
60
 
61
- Rule | Time (ms) | Relative
62
- :-------------------------------------------------|----------:|--------:
63
- @typescript-eslint/no-unused-vars | 1514.844 | 61.6%
64
- no-global-assign | 96.121 | 3.9%
65
- react-hooks/rules-of-hooks | 93.488 | 3.8%
66
- react-hooks/exhaustive-deps | 87.951 | 3.6%
67
- no-unexpected-multiline | 50.126 | 2.0%
68
- @typescript-eslint/triple-slash-reference | 46.928 | 1.9%
69
- @typescript-eslint/ban-ts-comment | 41.120 | 1.7%
70
- no-misleading-character-class | 40.149 | 1.6%
71
- @typescript-eslint/no-unnecessary-type-constraint | 31.744 | 1.3%
72
- no-loss-of-precision | 31.510 | 1.3%
61
+ Rule | Time (ms) | Relative
62
+ :-----------------------------------------|----------:|--------:
63
+ @typescript-eslint/no-unused-vars | 1584.824 | 64.0%
64
+ react-hooks/exhaustive-deps | 101.118 | 4.1%
65
+ no-global-assign | 70.605 | 2.8%
66
+ react-hooks/rules-of-hooks | 63.862 | 2.6%
67
+ no-misleading-character-class | 49.106 | 2.0%
68
+ @typescript-eslint/ban-ts-comment | 38.021 | 1.5%
69
+ no-unexpected-multiline | 35.859 | 1.4%
70
+ no-loss-of-precision | 32.618 | 1.3%
71
+ @typescript-eslint/triple-slash-reference | 29.048 | 1.2%
72
+ no-useless-escape | 27.538 | 1.1%
package/CHANGELOG.md CHANGED
@@ -1,19 +1,65 @@
1
1
  # @utilitywarehouse/hearth-react-native
2
2
 
3
+ ## 0.20.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#898](https://github.com/utilitywarehouse/hearth/pull/898) [`d32a188`](https://github.com/utilitywarehouse/hearth/commit/d32a18840c04222b7b1348133137dc5e56745fe3) Thanks [@jordmccord](https://github.com/jordmccord)! - 🌟 [FEATURE]: Add validation and helper text props to `Select` component
8
+
9
+ The `Select` component now supports built-in validation messages and helper text through new props: `invalidText`, `validText`, `helperText`, and `helperIcon`. This provides a more integrated validation experience without needing to wrap the component in FormField.
10
+
11
+ **Components affected**:
12
+ - `Select`
13
+
14
+ **Developer changes**:
15
+
16
+ You can now add helper text and validation messages directly to Select:
17
+
18
+ ```tsx
19
+ import { Select } from '@utilitywarehouse/hearth-react-native';
20
+
21
+ <Select
22
+ label="Choose an option"
23
+ placeholder="Select an option"
24
+ helperText="This is some helper text for the select component."
25
+ validationStatus="invalid"
26
+ invalidText="Please select a valid option"
27
+ options={[
28
+ { label: 'Option 1', value: '1' },
29
+ { label: 'Option 2', value: '2' },
30
+ { label: 'Option 3', value: '3' },
31
+ ]}
32
+ value={value}
33
+ onValueChange={setValue}
34
+ />;
35
+ ```
36
+
37
+ The component now also supports a `labelVariant` prop to control label styling:
38
+
39
+ ```tsx
40
+ <Select
41
+ label="Choose an option"
42
+ labelVariant="heading"
43
+ // ... other props
44
+ />
45
+ ```
46
+
47
+ These new props work seamlessly alongside the existing FormField wrapper if you prefer that approach. No changes are required to existing Select implementations.
48
+
3
49
  ## 0.19.1
4
50
 
5
51
  ### Patch Changes
6
52
 
7
53
  - [#886](https://github.com/utilitywarehouse/hearth/pull/886) [`7a948de`](https://github.com/utilitywarehouse/hearth/commit/7a948dea0d15ce7ca34e4d405e86984213c96196) Thanks [@jordmccord](https://github.com/jordmccord)! - 💅 [ENHANCEMENT]: Add `loadingHeading` prop to `Modal` component
8
54
 
9
- The `Modal` component now supports a `loadingHeading` prop to customize the heading text displayed during loading states. If not provided, it defaults to 'Loading...'.
55
+ The `Modal` component now supports a `loadingHeading` prop to customise the heading text displayed during loading states. If not provided, it defaults to 'Loading...'.
10
56
 
11
57
  **Components affected**:
12
58
  - `Modal`
13
59
 
14
60
  **Developer changes**:
15
61
 
16
- No changes required. To customize the loading heading text, use the new `loadingHeading` prop:
62
+ No changes required. To customise the loading heading text, use the new `loadingHeading` prop:
17
63
 
18
64
  ```tsx
19
65
  <Modal
@@ -143,7 +189,7 @@
143
189
 
144
190
  **Developer changes**:
145
191
 
146
- You can now customize `IconButton` colors for service-specific branding:
192
+ You can now customise `IconButton` colors for service-specific branding:
147
193
 
148
194
  ```tsx
149
195
  import { IconButton } from '@utilitywarehouse/hearth-react-native';
@@ -164,7 +210,7 @@
164
210
  - `activeBackgroundColor` - Sets the background color when pressed or in an active state
165
211
  - `shadowColor` - Sets the shadow/elevation color
166
212
 
167
- These overrides work alongside the existing `variant` and `colorScheme` props, allowing you to maintain structural styling while customizing colors for specific branding requirements.
213
+ These overrides work alongside the existing `variant` and `colorScheme` props, allowing you to maintain structural styling while customising colors for specific branding requirements.
168
214
 
169
215
  ### Patch Changes
170
216
 
@@ -1,6 +1,6 @@
1
1
  import SelectProps from './Select.props';
2
2
  declare const Select: {
3
- ({ options, value, onValueChange, label, labelVariant, placeholder, disabled, leadingIcon: LeadingIcon, validationStatus, required, children, bottomSheetProps, menuHeading, readonly, emptyText, listProps, searchable, searchPlaceholder, ...rest }: SelectProps): import("react/jsx-runtime").JSX.Element;
3
+ ({ options, value, onValueChange, label, labelVariant, placeholder, disabled, leadingIcon: LeadingIcon, validationStatus, helperText, helperIcon, invalidText, validText, required, children, bottomSheetProps, menuHeading, readonly, emptyText, listProps, searchable, searchPlaceholder, ...rest }: SelectProps): import("react/jsx-runtime").JSX.Element;
4
4
  displayName: string;
5
5
  };
6
6
  export default Select;
@@ -6,13 +6,12 @@ import { StyleSheet } from 'react-native-unistyles';
6
6
  import { BodyText } from '../BodyText';
7
7
  import { BottomSheetFlatList, BottomSheetModal, BottomSheetScrollView, BottomSheetView, } from '../BottomSheet';
8
8
  import { DetailText } from '../DetailText';
9
- import { useFormFieldContext } from '../FormField';
9
+ import { FormField, useFormFieldContext } from '../FormField';
10
10
  import { Icon } from '../Icon';
11
11
  import { Input } from '../Input';
12
- import { Label } from '../Label';
13
12
  import { SelectContext } from './Select.context';
14
13
  import SelectOption from './SelectOption';
15
- const Select = ({ options = [], value, onValueChange, label, labelVariant = 'body', placeholder = 'Select an option', disabled = false, leadingIcon: LeadingIcon, validationStatus = 'initial', required = true, children, bottomSheetProps, menuHeading, readonly = false, emptyText = 'No options available', listProps, searchable = false, searchPlaceholder = 'Search', ...rest }) => {
14
+ const Select = ({ options = [], value, onValueChange, label, labelVariant = 'body', placeholder = 'Select an option', disabled = false, leadingIcon: LeadingIcon, validationStatus = 'initial', helperText, helperIcon, invalidText, validText, required = true, children, bottomSheetProps, menuHeading, readonly = false, emptyText = 'No options available', listProps, searchable = false, searchPlaceholder = 'Search', ...rest }) => {
16
15
  const formFieldContext = useFormFieldContext();
17
16
  const validationStatusFromContext = formFieldContext?.validationStatus ?? validationStatus;
18
17
  const isRequired = formFieldContext?.required ?? required;
@@ -67,13 +66,13 @@ const Select = ({ options = [], value, onValueChange, label, labelVariant = 'bod
67
66
  }, []);
68
67
  const renderSelectOption = useCallback(({ item }) => (_jsx(SelectOption, { label: item.label, value: item.value, disabled: item.disabled, leadingIcon: item.leadingIcon, trailingIcon: item.trailingIcon })), []);
69
68
  const renderEmptyComponent = useCallback(() => (_jsx(BottomSheetView, { style: styles.emptyContainer, children: _jsx(DetailText, { children: emptyText }) })), [emptyText]);
70
- return (_jsxs(View, { ...rest, style: [styles.container, rest.style], children: [!!label && (_jsx(View, { children: _jsxs(Label, { variant: labelVariant, children: [label, !isRequired && _jsx(Label, { variant: labelVariant, children: " (Optional)" })] }) })), _jsxs(Pressable, { onPress: openBottomSheet, disabled: isDisabled || isReadonly, style: ({ pressed }) => [
71
- styles.selectContainer,
72
- styles.pressedContainer(pressed || isOpen),
73
- ], children: [!!LeadingIcon && (_jsx(View, { children: (() => {
74
- const IconAny = Icon;
75
- return _jsx(IconAny, { as: LeadingIcon, style: styles.icon });
76
- })() })), _jsx(View, { style: styles.optionContainer, children: _jsx(BodyText, { numberOfLines: 1, style: styles.placeholderText, children: selectedOption?.label || selectedLabel || placeholder }) }), _jsx(View, { children: _jsx(Icon, { as: ExpandSmallIcon, style: styles.icon }) })] }), _jsx(BottomSheetModal, { ref: bottomSheetModalRef, snapPoints: ['25%', '40%', '80%'], onChange: handleClose, enableDynamicSizing: false, ...bottomSheetProps, children: _jsxs(SelectContext.Provider, { value: {
69
+ return (_jsxs(View, { ...rest, style: [styles.container, rest.style], children: [_jsx(FormField, { label: label, labelVariant: labelVariant, helperText: helperText, helperIcon: helperIcon, validationStatus: validationStatusFromContext, required: isRequired, disabled: isDisabled, readonly: isReadonly, invalidText: invalidText, validText: validText, children: _jsxs(Pressable, { onPress: openBottomSheet, disabled: isDisabled || isReadonly, style: ({ pressed }) => [
70
+ styles.selectContainer,
71
+ styles.pressedContainer(pressed || isOpen),
72
+ ], children: [!!LeadingIcon && (_jsx(View, { children: (() => {
73
+ const IconAny = Icon;
74
+ return _jsx(IconAny, { as: LeadingIcon, style: styles.icon });
75
+ })() })), _jsx(View, { style: styles.optionContainer, children: _jsx(BodyText, { numberOfLines: 1, style: styles.placeholderText, children: selectedOption?.label || selectedLabel || placeholder }) }), _jsx(View, { children: _jsx(Icon, { as: ExpandSmallIcon, style: styles.icon }) })] }) }), _jsx(BottomSheetModal, { ref: bottomSheetModalRef, snapPoints: ['25%', '40%', '80%'], onChange: handleClose, enableDynamicSizing: false, ...bottomSheetProps, children: _jsxs(SelectContext.Provider, { value: {
77
76
  selectedValue: value,
78
77
  onValueChange,
79
78
  close: closeBottomSheet,
@@ -50,6 +50,22 @@ interface SelectProps extends ViewProps {
50
50
  * @default 'body'.
51
51
  */
52
52
  labelVariant?: 'heading' | 'body';
53
+ /**
54
+ * Helper text to show below the select
55
+ */
56
+ helperText?: string;
57
+ /**
58
+ * Optional icon to display alongside the helper text
59
+ */
60
+ helperIcon?: React.ComponentType;
61
+ /**
62
+ * Text to display when validationStatus is 'invalid'
63
+ */
64
+ invalidText?: string;
65
+ /**
66
+ * Text to display when validationStatus is 'valid'
67
+ */
68
+ validText?: string;
53
69
  /**
54
70
  * Placeholder text to show when no value is selected
55
71
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utilitywarehouse/hearth-react-native",
3
- "version": "0.19.1",
3
+ "version": "0.20.0",
4
4
  "description": "Utility Warehouse React Native UI library",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -56,10 +56,10 @@
56
56
  "vite-plugin-svgr": "^4.5.0",
57
57
  "vitest": "^3.2.4",
58
58
  "@utilitywarehouse/hearth-fonts": "^0.0.4",
59
+ "@utilitywarehouse/hearth-tokens": "^0.2.2",
59
60
  "@utilitywarehouse/hearth-react-icons": "^0.8.0",
60
61
  "@utilitywarehouse/hearth-react-native-icons": "^0.8.0",
61
- "@utilitywarehouse/hearth-svg-assets": "^0.3.0",
62
- "@utilitywarehouse/hearth-tokens": "^0.2.2"
62
+ "@utilitywarehouse/hearth-svg-assets": "^0.3.0"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "@gorhom/bottom-sheet": "^5.0.0",
@@ -3,6 +3,10 @@ import { CheckboxGroup } from '../';
3
3
 
4
4
  const props = {
5
5
  label: figma.string('Group label'),
6
+ labelVariant: figma.enum('Label variant', {
7
+ Heading: 'heading',
8
+ Body: 'body',
9
+ }),
6
10
  helperText: figma.boolean('Helper text?', {
7
11
  true: figma.string('Helper text'),
8
12
  false: undefined,
@@ -13,6 +17,12 @@ const props = {
13
17
  }),
14
18
  tiles: figma.children('Checkbox Tile'),
15
19
  checkboxes: figma.children('Checkbox'),
20
+ validationStatus: figma.enum('State', {
21
+ Invalid: 'invalid',
22
+ }),
23
+ invalidText: figma.enum('State', {
24
+ Invalid: figma.string('Validation text'),
25
+ }),
16
26
  };
17
27
 
18
28
  figma.connect(
@@ -27,8 +37,11 @@ figma.connect(
27
37
  <CheckboxGroup
28
38
  type="tile"
29
39
  label={props.label}
40
+ labelVariant={props.labelVariant}
30
41
  helperText={props.helperText}
31
42
  direction={props.direction}
43
+ validationStatus={props.validationStatus}
44
+ invalidText={props.invalidText}
32
45
  >
33
46
  {props.tiles}
34
47
  </CheckboxGroup>
@@ -45,7 +58,14 @@ figma.connect(
45
58
  },
46
59
  props,
47
60
  example: props => (
48
- <CheckboxGroup label={props.label} helperText={props.helperText} direction={props.direction}>
61
+ <CheckboxGroup
62
+ label={props.label}
63
+ labelVariant={props.labelVariant}
64
+ helperText={props.helperText}
65
+ direction={props.direction}
66
+ validationStatus={props.validationStatus}
67
+ invalidText={props.invalidText}
68
+ >
49
69
  {props.checkboxes}
50
70
  </CheckboxGroup>
51
71
  ),
@@ -1,25 +1,12 @@
1
1
  import figma from '@figma/code-connect';
2
- import { Pill } from './Pill';
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 { Pill } from '../';
10
3
 
11
4
  figma.connect(Pill, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=4348%3A15595', {
12
5
  props: {
13
- // These props were automatically mapped based on your linked code:
14
6
  label: figma.string('Label'),
15
- focusable: figma.enum('State', {
16
- Focus: true,
7
+ icon: figma.boolean('Icon?', {
8
+ true: figma.instance('Icon-20'),
17
9
  }),
18
- // No matching props could be found for these Figma properties:
19
- // "label": figma.string('Label'),
20
- // "icon": figma.boolean('Icon?'),
21
- // "icon20": figma.instance('Icon-20'),
22
- // "selected": figma.boolean('Selected?')
23
10
  },
24
- example: props => <Pill value={null} label={props.label} focusable={props.focusable} />,
11
+ example: props => <Pill value={props.label} label={props.label} />,
25
12
  });
@@ -1,21 +1,20 @@
1
1
  import figma from '@figma/code-connect';
2
- import { PillGroup } from './PillGroup';
2
+ import { PillGroup } from '../';
3
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
- */
4
+ const value = '';
10
5
 
11
6
  figma.connect(
12
7
  PillGroup,
13
8
  'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=4348%3A15988',
14
9
  {
15
10
  props: {
16
- // These props were automatically mapped based on your linked code:
17
11
  wrap: figma.boolean('Wrap?'),
12
+ pills: figma.children('Pill'),
18
13
  },
19
- example: props => <PillGroup value={null} wrap={props.wrap} />,
14
+ example: props => (
15
+ <PillGroup value={value} wrap={props.wrap}>
16
+ {props.pills}
17
+ </PillGroup>
18
+ ),
20
19
  }
21
20
  );
@@ -1,30 +1,19 @@
1
1
  import figma from '@figma/code-connect';
2
- import ProgressStep from './ProgressStep';
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 { ProgressStep } from '../';
10
3
 
11
4
  figma.connect(
12
5
  ProgressStep,
13
6
  'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=6056%3A1987',
14
7
  {
15
8
  props: {
16
- // These props were automatically mapped based on your linked code:
17
9
  status: figma.enum('State', {
18
10
  Complete: 'complete',
19
11
  Active: 'active',
20
12
  Incomplete: 'incomplete',
21
13
  }),
22
- // No matching props could be found for these Figma properties:
23
- // "label": figma.string('Label'),
24
- // "label": figma.boolean('Label?'),
25
- // "stepNumber": figma.string('Step number'),
26
- // "interactive": figma.boolean('Interactive?')
14
+ label: figma.string('Label'),
15
+ id: figma.string('Step number'),
27
16
  },
28
- example: props => <ProgressStep id={null} status={props.status} />,
17
+ example: props => <ProgressStep id={props.id} status={props.status} />,
29
18
  }
30
19
  );
@@ -1,20 +1,13 @@
1
- import React from "react"
2
- import ProgressStepper from "./ProgressStepper"
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 { ProgressStepper } from '../';
12
3
 
13
4
  figma.connect(
14
5
  ProgressStepper,
15
- "https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=6056%3A2000",
6
+ 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=6056%3A2000',
16
7
  {
17
- props: {},
18
- example: (props) => <ProgressStepper />,
19
- },
20
- )
8
+ props: {
9
+ steps: figma.children('Step'),
10
+ },
11
+ example: props => <ProgressStepper>{props.steps}</ProgressStepper>,
12
+ }
13
+ );
@@ -1,25 +1,38 @@
1
1
  import figma from '@figma/code-connect';
2
2
  import Radio from './Radio';
3
3
 
4
- /**
5
- * -- This file was auto-generated by Code Connect --
6
- * None of your props could be automatically mapped to Figma properties.
7
- * You should update the `props` object to include a mapping from your
8
- * code props to Figma properties, and update the `example` function to
9
- * return the code example you'd like to see in Figma
10
- */
11
-
12
- figma.connect(Radio, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=7428%3A12685', {
13
- props: {
14
- // No matching props could be found for these Figma properties:
15
- // "helperText": figma.boolean('Helper text?'),
16
- // "helperText": figma.string('Helper text'),
17
- // "label": figma.string('Label'),
18
- // "image": figma.boolean('Image?'),
19
- // "state": figma.enum('State', {
20
- // "Default": "default"
21
- // }),
22
- // "checked": figma.boolean('Checked?')
23
- },
24
- example: props => <Radio value={null} />,
25
- });
4
+ figma.connect(
5
+ Radio,
6
+ 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=7428-12685&m=dev',
7
+ {
8
+ props: {
9
+ helperText: figma.boolean('Helper text?', {
10
+ true: figma.string('Helper text'),
11
+ }),
12
+ label: figma.string('Label'),
13
+ image: figma.boolean('Image?', {
14
+ true: figma.instance('Radio Image'),
15
+ }),
16
+ state: figma.enum('State', {
17
+ Default: 'default',
18
+ }),
19
+ checked: figma.boolean('Checked?'),
20
+ indicator: figma.nestedProps('Radio Item', {
21
+ disabled: figma.enum('State', {
22
+ Disabled: true,
23
+ }),
24
+ }),
25
+ },
26
+ example: props => (
27
+ <Radio
28
+ label={props.label}
29
+ helperText={props.helperText}
30
+ image={props.image}
31
+ state={props.state}
32
+ checked={props.checked}
33
+ disabled={props.indicator.disabled}
34
+ value="someValue"
35
+ />
36
+ ),
37
+ }
38
+ );
@@ -1,54 +1,82 @@
1
- import React from "react"
2
- import RadioGroup from "./RadioGroup"
3
- import figma from "@figma/code-connect"
1
+ import figma from '@figma/code-connect';
2
+ import { RadioGroup } from '../';
4
3
 
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
- */
4
+ const props = {
5
+ validationStatus: figma.enum('State', {
6
+ Invalid: 'invalid',
7
+ }),
8
+ labelVariant: figma.enum('Label variant', {
9
+ Body: 'body',
10
+ Heading: 'heading',
11
+ }),
12
+ direction: figma.enum('Direction', {
13
+ Row: 'row',
14
+ }),
15
+ label: figma.string('Group label'),
16
+ helperText: figma.boolean('Helper text?', {
17
+ true: figma.string('Helper text'),
18
+ }),
19
+ invalidText: figma.enum('State', {
20
+ Invalid: figma.string('Validation text'),
21
+ }),
22
+ };
23
+
24
+ const value = '';
25
+ const setValue = (value: string) => {};
11
26
 
12
27
  figma.connect(
13
28
  RadioGroup,
14
- "https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3138%3A13254",
29
+ 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=3138-13254&t=Uq6QfQcygdNGv5lM-4',
15
30
  {
31
+ variant: {
32
+ Content: 'Radio',
33
+ },
16
34
  props: {
17
- // These props were automatically mapped based on your linked code:
18
- label: figma.string("Group label"),
19
- helperText: figma.string("Helper text"),
20
- invalidText: figma.string("Helper text"),
21
- validText: figma.string("Validation text"),
22
- direction: figma.enum("Direction", {
23
- Row: "row",
24
- Column: "column",
25
- }),
26
- // No matching props could be found for these Figma properties:
27
- // "groupLabel": figma.string('Group label'),
28
- // "helperText": figma.boolean('Helper text?'),
29
- // "helperText": figma.string('Helper text'),
30
- // "validationText": figma.string('Validation text'),
31
- // "state": figma.enum('State', {
32
- // "Default": "default",
33
- // "Invalid": "invalid"
34
- // }),
35
- // "labelVariant": figma.enum('Label variant', {
36
- // "Body": "body",
37
- // "Heading": "heading"
38
- // }),
39
- // "content": figma.enum('Content', {
40
- // "Radio": "radio",
41
- // "Radio Tile": "radio-tile"
42
- // })
35
+ ...props,
36
+ items: figma.children('Radio'),
43
37
  },
44
- example: (props) => (
38
+ example: props => (
45
39
  <RadioGroup
46
40
  label={props.label}
47
41
  helperText={props.helperText}
42
+ validationStatus={props.validationStatus}
43
+ labelVariant={props.labelVariant}
44
+ direction={props.direction}
48
45
  invalidText={props.invalidText}
49
- validText={props.validText}
46
+ value={value}
47
+ onChange={value => setValue(value)}
48
+ >
49
+ {props.items}
50
+ </RadioGroup>
51
+ ),
52
+ }
53
+ );
54
+
55
+ figma.connect(
56
+ RadioGroup,
57
+ 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=3138-13254&t=Uq6QfQcygdNGv5lM-4',
58
+ {
59
+ variant: {
60
+ Content: 'Radio Tile',
61
+ },
62
+ props: {
63
+ ...props,
64
+ items: figma.children('Radio Tile'),
65
+ },
66
+ example: props => (
67
+ <RadioGroup
68
+ label={props.label}
69
+ helperText={props.helperText}
70
+ validationStatus={props.validationStatus}
71
+ labelVariant={props.labelVariant}
50
72
  direction={props.direction}
51
- />
73
+ invalidText={props.invalidText}
74
+ type="tile"
75
+ value={value}
76
+ onChange={value => setValue(value)}
77
+ >
78
+ {props.items}
79
+ </RadioGroup>
52
80
  ),
53
- },
54
- )
81
+ }
82
+ );
@@ -0,0 +1,34 @@
1
+ import figma from '@figma/code-connect';
2
+ import { RadioTile } from '../';
3
+
4
+ figma.connect(
5
+ RadioTile,
6
+ 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=3138-13222&t=Uq6QfQcygdNGv5lM-4',
7
+ {
8
+ props: {
9
+ helperText: figma.boolean('Helper text?', {
10
+ true: figma.string('Helper text'),
11
+ }),
12
+ label: figma.string('Label'),
13
+ image: figma.boolean('Image?', {
14
+ true: figma.instance('Radio Image'),
15
+ }),
16
+ checked: figma.boolean('Checked?'),
17
+ indicator: figma.nestedProps('Radio Item', {
18
+ disabled: figma.enum('State', {
19
+ Disabled: true,
20
+ }),
21
+ }),
22
+ },
23
+ example: props => (
24
+ <RadioTile
25
+ label={props.label}
26
+ helperText={props.helperText}
27
+ image={props.image}
28
+ checked={props.checked}
29
+ disabled={props.indicator.disabled}
30
+ value="someValue"
31
+ />
32
+ ),
33
+ }
34
+ );
@@ -0,0 +1,24 @@
1
+ import figma from '@figma/code-connect';
2
+ import { RadioCard } from '../';
3
+
4
+ figma.connect(
5
+ RadioCard,
6
+ 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=2164-727&t=Uq6QfQcygdNGv5lM-4',
7
+ {
8
+ variant: {
9
+ Variant: 'Radio',
10
+ },
11
+ props: {
12
+ radio: figma.nestedProps('Radio', {
13
+ label: figma.string('Label'),
14
+ }),
15
+ content: figma.instance('Content'),
16
+ },
17
+ example: props => (
18
+ // This should be wrapped in a RadioCardGroup, see docs
19
+ <RadioCard label={props.radio.label} value="someValue">
20
+ {props.content}
21
+ </RadioCard>
22
+ ),
23
+ }
24
+ );