@utilitywarehouse/hearth-react-native 0.16.0 → 0.16.2

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 (96) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-lint.log +67 -4
  3. package/CHANGELOG.md +30 -0
  4. package/build/components/Avatar/Avatar.js +0 -2
  5. package/build/components/Banner/Banner.d.ts +1 -1
  6. package/build/components/Banner/Banner.js +3 -1
  7. package/build/components/Carousel/Carousel.js +1 -1
  8. package/build/components/DateInput/DateInput.d.ts +1 -1
  9. package/build/components/DateInput/DateInput.js +2 -2
  10. package/build/components/DateInput/DateInput.props.d.ts +22 -1
  11. package/build/components/DateInput/DateInputSegment.d.ts +2 -16
  12. package/build/components/DateInput/DateInputSegment.js +2 -5
  13. package/build/components/DatePicker/DatePicker.js +8 -4
  14. package/build/components/DatePicker/DatePickerHeader/DatePickerHeader.props.d.ts +0 -1
  15. package/build/components/DatePicker/DatePickerHeader/index.js +1 -1
  16. package/build/components/DatePicker/index.d.ts +1 -0
  17. package/build/components/DatePicker/polyfill.js +3 -3
  18. package/build/components/DatePicker/time-picker/wheel-web.js +1 -3
  19. package/build/components/DatePickerInput/DatePickerInput.js +1 -2
  20. package/build/components/DescriptionList/DescriptionList.d.ts +1 -1
  21. package/build/components/DescriptionList/DescriptionList.js +2 -2
  22. package/build/components/DescriptionList/DescriptionList.props.d.ts +1 -0
  23. package/build/components/DescriptionList/DescriptionListItem.d.ts +1 -1
  24. package/build/components/DescriptionList/DescriptionListItem.js +3 -2
  25. package/build/components/DescriptionList/DescriptionListItem.props.d.ts +1 -0
  26. package/build/components/Input/Input.js +1 -1
  27. package/build/components/Switch/Switch.js +1 -1
  28. package/build/components/Tabs/Tabs.d.ts +1 -1
  29. package/build/components/Tabs/Tabs.js +1 -1
  30. package/build/components/Textarea/Textarea.js +3 -0
  31. package/build/components/Toast/ToastItem.js +1 -1
  32. package/build/components/ToggleButton/ToggleButtonIcon.js +1 -1
  33. package/build/components/ToggleButton/ToggleButtonRoot.js +0 -2
  34. package/build/components/UnstyledIconButton/UnstyledIconButtonIcon.js +1 -1
  35. package/build/utils/coloursAsArray.js +1 -1
  36. package/docs/components/AllComponents.web.tsx +16 -18
  37. package/docs/components/UsageWrap.tsx +17 -20
  38. package/eslint.config.js +5 -1
  39. package/package.json +11 -11
  40. package/src/components/Accordion/Accordion.figma.tsx +15 -17
  41. package/src/components/Accordion/AccordionItem.figma.tsx +27 -0
  42. package/src/components/Avatar/Avatar.figma.tsx +11 -21
  43. package/src/components/Avatar/Avatar.tsx +0 -2
  44. package/src/components/Badge/Badge.figma.tsx +45 -54
  45. package/src/components/Banner/Banner.figma.tsx +21 -13
  46. package/src/components/Banner/Banner.stories.tsx +4 -4
  47. package/src/components/Banner/Banner.tsx +2 -1
  48. package/src/components/Button/Button.figma.tsx +118 -46
  49. package/src/components/Card/Card.figma.tsx +27 -43
  50. package/src/components/Card/Card.stories.tsx +1 -1
  51. package/src/components/Carousel/Carousel.figma.tsx +20 -17
  52. package/src/components/Carousel/Carousel.tsx +1 -1
  53. package/src/components/Checkbox/Checkbox.figma.tsx +15 -18
  54. package/src/components/Checkbox/Checkbox.stories.tsx +2 -2
  55. package/src/components/Checkbox/CheckboxGroup.figma.tsx +48 -15
  56. package/src/components/Checkbox/CheckboxTileRoot.figma.tsx +24 -27
  57. package/src/components/CurrencyInput/CurrencyInput.figma.tsx +65 -49
  58. package/src/components/DateInput/DateInput.docs.mdx +47 -29
  59. package/src/components/DateInput/DateInput.figma.tsx +58 -45
  60. package/src/components/DateInput/DateInput.props.ts +32 -1
  61. package/src/components/DateInput/DateInput.stories.tsx +10 -0
  62. package/src/components/DateInput/DateInput.tsx +12 -0
  63. package/src/components/DateInput/DateInputSegment.tsx +7 -22
  64. package/src/components/DatePicker/DatePicker.figma.tsx +47 -0
  65. package/src/components/DatePicker/DatePicker.tsx +8 -4
  66. package/src/components/DatePicker/DatePickerHeader/DatePickerHeader.props.ts +0 -2
  67. package/src/components/DatePicker/DatePickerHeader/index.tsx +2 -2
  68. package/src/components/DatePicker/index.ts +2 -0
  69. package/src/components/DatePicker/polyfill.ts +3 -3
  70. package/src/components/DatePicker/time-picker/wheel-web.tsx +0 -1
  71. package/src/components/DatePickerInput/DatePickerInput.figma.tsx +18 -46
  72. package/src/components/DatePickerInput/DatePickerInput.tsx +0 -2
  73. package/src/components/DescriptionList/DescriptionList.docs.mdx +16 -14
  74. package/src/components/DescriptionList/DescriptionList.figma.tsx +41 -17
  75. package/src/components/DescriptionList/DescriptionList.props.ts +1 -0
  76. package/src/components/DescriptionList/DescriptionList.stories.tsx +24 -0
  77. package/src/components/DescriptionList/DescriptionList.tsx +2 -0
  78. package/src/components/DescriptionList/DescriptionListItem.figma.tsx +42 -0
  79. package/src/components/DescriptionList/DescriptionListItem.props.ts +1 -0
  80. package/src/components/DescriptionList/DescriptionListItem.tsx +7 -0
  81. package/src/components/Divider/Divider.figma.tsx +10 -23
  82. package/src/components/Input/Input.tsx +0 -1
  83. package/src/components/List/List.stories.tsx +1 -4
  84. package/src/components/Radio/Radio.stories.tsx +1 -1
  85. package/src/components/Switch/Switch.tsx +1 -1
  86. package/src/components/Tabs/Tabs.tsx +0 -1
  87. package/src/components/Textarea/Textarea.tsx +3 -0
  88. package/src/components/ThemedImage/ThemedImage.stories.tsx +14 -14
  89. package/src/components/Toast/ToastItem.tsx +1 -1
  90. package/src/components/ToggleButton/ToggleButtonIcon.tsx +1 -1
  91. package/src/components/ToggleButton/ToggleButtonRoot.tsx +0 -2
  92. package/src/components/UnstyledIconButton/UnstyledIconButtonIcon.tsx +1 -1
  93. package/src/utils/coloursAsArray.ts +1 -1
  94. package/tsconfig.eslint.json +13 -0
  95. package/src/components/Accordion/AccordionItemRoot.figma.tsx +0 -47
  96. package/src/components/DatePicker/DatePickerCalendar.figma.tsx +0 -34
@@ -1,60 +1,132 @@
1
1
  import figma from '@figma/code-connect';
2
- import Button from './Button';
2
+ import { Button } 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
- */
10
-
11
- figma.connect(Button, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=90%3A432', {
12
- props: {
13
- // These props were automatically mapped based on your linked code:
14
- focusable: figma.enum('State', {
15
- Focus: true,
16
- }),
17
- 'aria-disabled': figma.enum('State', {
18
- Disabled: true,
19
- }),
20
- disabled: figma.enum('State', {
21
- Disabled: true,
22
- }),
23
- size: figma.enum('Size', {
24
- 'SM-32': 'sm',
25
- 'MD-48': 'md',
26
- }),
27
- paddingNone: figma.boolean('Padding None?'),
28
- colorScheme: figma.enum('Color Scheme', {
29
- Affirmative: 'affirmative',
30
- Destructive: 'destructive',
4
+ const props = {
5
+ disabled: figma.enum('State', {
6
+ Disabled: true,
7
+ }),
8
+ size: figma.enum('Size', {
9
+ 'SM-32': 'sm',
10
+ 'MD-48': 'md',
11
+ }),
12
+ paddingNone: figma.boolean('Padding None?'),
13
+ colorScheme: figma.enum('Color Scheme', {
14
+ Affirmative: 'affirmative',
15
+ Destructive: 'destructive',
16
+ Functional: 'functional',
17
+ Highlight: 'highlight',
18
+ }),
19
+ loading: figma.enum('State', {
20
+ Loading: true,
21
+ }),
22
+ text: figma.string('Text'),
23
+ ghostText: figma.string('Ghost Text'),
24
+ iconPosition: figma.boolean('Show icon left?', {
25
+ true: undefined,
26
+ false: figma.boolean('Show icon right?', {
27
+ true: 'right',
28
+ false: undefined,
31
29
  }),
32
- loading: figma.enum('State', {
33
- Loading: true,
30
+ }),
31
+ icon: figma.boolean('Show icon left?', {
32
+ true: figma.instance('Icon left-20'),
33
+ false: figma.boolean('Show icon right?', {
34
+ true: figma.instance('Icon right-20'),
35
+ false: undefined,
34
36
  }),
35
- // No matching props could be found for these Figma properties:
36
- // "text": figma.string('Text'),
37
- // "showIconLeft": figma.boolean('Show icon left?'),
38
- // "showIconRight": figma.boolean('Show icon right?'),
39
- // "iconLeft20": figma.instance('Icon left-20'),
40
- // "iconRight20": figma.instance('Icon right-20'),
41
- // "ghostText": figma.string('Ghost Text'),
42
- // "variant": figma.enum('Variant', {
43
- // "Emphasis": "emphasis",
44
- // "Solid": "solid",
45
- // "Outline": "outline",
46
- // "Ghost": "ghost"
47
- // }),
48
- // "inverted": figma.boolean('Inverted?')
37
+ }),
38
+ variant: figma.enum('Variant', {
39
+ Emphasis: 'emphasis',
40
+ Solid: 'solid',
41
+ Outline: 'outline',
42
+ Ghost: 'ghost',
43
+ }),
44
+ inverted: figma.boolean('Inverted?'),
45
+ };
46
+
47
+ figma.connect(Button, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=90%3A432', {
48
+ props,
49
+ variant: {
50
+ Variant: 'Solid',
51
+ },
52
+ example: props => (
53
+ <Button
54
+ disabled={props.disabled}
55
+ size={props.size}
56
+ variant={props.variant}
57
+ inverted={props.inverted}
58
+ paddingNone={props.paddingNone}
59
+ colorScheme={props.colorScheme}
60
+ loading={props.loading}
61
+ icon={props.icon}
62
+ iconPosition={props.iconPosition}
63
+ >
64
+ {props.text}
65
+ </Button>
66
+ ),
67
+ });
68
+ figma.connect(Button, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=90%3A432', {
69
+ props,
70
+ variant: {
71
+ Variant: 'Emphasis',
72
+ },
73
+ example: props => (
74
+ <Button
75
+ disabled={props.disabled}
76
+ size={props.size}
77
+ variant={props.variant}
78
+ inverted={props.inverted}
79
+ paddingNone={props.paddingNone}
80
+ colorScheme={props.colorScheme}
81
+ loading={props.loading}
82
+ iconPosition={props.iconPosition}
83
+ icon={props.icon}
84
+ >
85
+ {props.text}
86
+ </Button>
87
+ ),
88
+ });
89
+
90
+ figma.connect(Button, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=90%3A432', {
91
+ variant: {
92
+ Variant: 'Outline',
93
+ },
94
+ props,
95
+ example: props => (
96
+ <Button
97
+ disabled={props.disabled}
98
+ size={props.size}
99
+ variant={props.variant}
100
+ inverted={props.inverted}
101
+ paddingNone={props.paddingNone}
102
+ colorScheme={props.colorScheme}
103
+ loading={props.loading}
104
+ icon={props.icon}
105
+ iconPosition={props.iconPosition}
106
+ >
107
+ {props.text}
108
+ </Button>
109
+ ),
110
+ });
111
+
112
+ figma.connect(Button, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=90%3A432', {
113
+ variant: {
114
+ Variant: 'Ghost',
49
115
  },
116
+ props,
50
117
  example: props => (
51
118
  <Button
52
- focusable={props.focusable}
53
119
  disabled={props.disabled}
54
120
  size={props.size}
121
+ variant={props.variant}
122
+ inverted={props.inverted}
55
123
  paddingNone={props.paddingNone}
56
124
  colorScheme={props.colorScheme}
57
125
  loading={props.loading}
58
- />
126
+ icon={props.icon}
127
+ iconPosition={props.iconPosition}
128
+ >
129
+ {props.ghostText}
130
+ </Button>
59
131
  ),
60
132
  });
@@ -1,45 +1,29 @@
1
- import React from "react"
2
- import Card from "./Card"
3
- import figma from "@figma/code-connect"
1
+ import figma from '@figma/code-connect';
2
+ import Card from './Card';
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
- */
11
-
12
- figma.connect(
13
- Card,
14
- "https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=2160%3A11",
15
- {
16
- props: {
17
- // These props were automatically mapped based on your linked code:
18
- variant: figma.enum("Variant", {
19
- Emphasis: "emphasis",
20
- Subtle: "subtle",
21
- }),
22
- colorScheme: figma.enum("Color Scheme", {
23
- "Neutral Strong": "neutralStrong",
24
- "Neutral Subtle": "neutralSubtle",
25
- Brand: "brand",
26
- Energy: "energy",
27
- Broadband: "broadband",
28
- Mobile: "mobile",
29
- Insurance: "insurance",
30
- Cashback: "cashback",
31
- Pig: "pig",
32
- }),
33
- noPadding: figma.boolean("Padding None?"),
34
- // No matching props could be found for these Figma properties:
35
- // "content": figma.instance('Content')
36
- },
37
- example: (props) => (
38
- <Card
39
- variant={props.variant}
40
- colorScheme={props.colorScheme}
41
- noPadding={props.noPadding}
42
- />
43
- ),
4
+ figma.connect(Card, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=2160%3A11', {
5
+ props: {
6
+ variant: figma.enum('Variant', {
7
+ Emphasis: 'emphasis',
8
+ Subtle: 'subtle',
9
+ }),
10
+ colorScheme: figma.enum('Color Scheme', {
11
+ 'Neutral Strong': 'neutralStrong',
12
+ 'Neutral Subtle': 'neutralSubtle',
13
+ Brand: 'brand',
14
+ Energy: 'energy',
15
+ Broadband: 'broadband',
16
+ Mobile: 'mobile',
17
+ Insurance: 'insurance',
18
+ Cashback: 'cashback',
19
+ Pig: 'pig',
20
+ }),
21
+ noPadding: figma.boolean('Padding None?'),
22
+ content: figma.instance('Content'),
44
23
  },
45
- )
24
+ example: props => (
25
+ <Card variant={props.variant} colorScheme={props.colorScheme} noPadding={props.noPadding}>
26
+ {props.content}
27
+ </Card>
28
+ ),
29
+ });
@@ -106,7 +106,7 @@ export const WithOnlyAction: Story = {
106
106
  args: {
107
107
  variant: 'emphasis',
108
108
  },
109
- render: ({ children, ...props }) => {
109
+ render: ({ ...props }) => {
110
110
  return (
111
111
  <Card {...props} flexDirection="column" alignItems="stretch" space="md">
112
112
  <CardAction
@@ -1,19 +1,22 @@
1
1
  import figma from '@figma/code-connect';
2
- import Carousel from './Carousel';
2
+ import { Carousel, CarouselItem } 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
- */
10
-
11
- figma.connect(Carousel, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=5191%3A3220', {
12
- props: {
13
- // These props were automatically mapped based on your linked code:
14
- inverted: figma.boolean('Inverted?'),
15
- // No matching props could be found for these Figma properties:
16
- // "arrows": figma.boolean('Arrows?')
17
- },
18
- example: props => <Carousel width={null} inverted={props.inverted} />,
19
- });
4
+ figma.connect(
5
+ Carousel,
6
+ 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=5191-3220&m=dev',
7
+ {
8
+ props: {
9
+ inverted: figma.boolean('Inverted?'),
10
+ showNavigation: figma.boolean('Arrows?'),
11
+ },
12
+ example: props => (
13
+ // Example usage of the Carousel component
14
+ // See https://hearth.prod.uw.systems/react-native/?path=/docs/components-carousel--docs
15
+ <Carousel width={300} inverted={props.inverted} showNavigation={props.showNavigation}>
16
+ <CarouselItem>Item 1</CarouselItem>
17
+ <CarouselItem>Item 2</CarouselItem>
18
+ <CarouselItem>Item 3</CarouselItem>
19
+ </Carousel>
20
+ ),
21
+ }
22
+ );
@@ -49,7 +49,7 @@ const Carousel = ({
49
49
  ...props
50
50
  }: CarouselProps) => {
51
51
  const [activeIndex, setActiveIndex] = useState(initialActiveIndex);
52
- const [numItems, setNumItems] = useState(0);
52
+ const [, setNumItems] = useState(0);
53
53
 
54
54
  const scrollViewRef = useRef<ScrollView>(null);
55
55
  const flatListRef = useRef<FlatList>(null);
@@ -1,29 +1,26 @@
1
1
  import figma from '@figma/code-connect';
2
2
  import { Checkbox } from './Checkbox';
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
- */
10
-
11
- figma.connect(Checkbox, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3087%3A7316', {
4
+ figma.connect(Checkbox, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3087-7316', {
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
9
  checked: figma.boolean('Checked?'),
18
- 'aria-disabled': figma.enum('State', {
19
- Disabled: true,
10
+ label: figma.string('Label'),
11
+ helperText: figma.boolean('Helper text?', {
12
+ true: figma.string('Helper text'),
13
+ false: undefined,
20
14
  }),
21
- // No matching props could be found for these Figma properties:
22
- // "label": figma.string('Label'),
23
- // "helperText": figma.string('Helper text'),
24
- // "helperText": figma.boolean('Helper text?'),
25
- // "validationText": figma.string('Validation text'),
26
- // "image": figma.boolean('Image?')
15
+ validationText: figma.string('Validation text'),
27
16
  },
28
- example: props => <Checkbox disabled={props.disabled} checked={props.checked} />,
17
+ example: props => (
18
+ <Checkbox
19
+ disabled={props.disabled}
20
+ checked={props.checked}
21
+ label={props.label}
22
+ helperText={props.helperText}
23
+ invalidText={props.validationText}
24
+ />
25
+ ),
29
26
  });
@@ -76,7 +76,7 @@ type Story = StoryObj<typeof meta>;
76
76
 
77
77
  export const Playground: Story = {
78
78
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
79
- render: ({ checked: checkedArg = false, value, children, onChange, ...args }) => {
79
+ render: ({ checked: checkedArg = false, value, onChange, ...args }) => {
80
80
  const [checked, setChecked] = React.useState(checkedArg);
81
81
  useEffect(() => {
82
82
  setChecked(checkedArg);
@@ -95,7 +95,7 @@ export const Playground: Story = {
95
95
  };
96
96
 
97
97
  export const WithImage: Story = {
98
- render: ({ children, ...args }) => (
98
+ render: ({ ...args }) => (
99
99
  <CheckboxGroup aria-label="Checkbox Group" nativeID="checkbox-group">
100
100
  <Checkbox
101
101
  aria-label="Visa"
@@ -1,20 +1,53 @@
1
- import React from "react"
2
- import CheckboxGroup from "./CheckboxGroup"
3
- import figma from "@figma/code-connect"
1
+ import figma from '@figma/code-connect';
2
+ import { CheckboxGroup } from '../';
4
3
 
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
- */
4
+ const props = {
5
+ label: figma.string('Group label'),
6
+ helperText: figma.boolean('Helper text?', {
7
+ true: figma.string('Helper text'),
8
+ false: undefined,
9
+ }),
10
+ direction: figma.enum('Direction', {
11
+ Column: undefined,
12
+ Row: 'row',
13
+ }),
14
+ tiles: figma.children('Checkbox Tile'),
15
+ checkboxes: figma.children('Checkbox'),
16
+ };
12
17
 
13
18
  figma.connect(
14
19
  CheckboxGroup,
15
- "https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3141%3A4275",
20
+ 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=3141-4275&m=dev',
16
21
  {
17
- props: {},
18
- example: (props) => <CheckboxGroup />,
19
- },
20
- )
22
+ variant: {
23
+ Content: 'Checkbox Tile',
24
+ },
25
+ props,
26
+ example: props => (
27
+ <CheckboxGroup
28
+ type="tile"
29
+ label={props.label}
30
+ helperText={props.helperText}
31
+ direction={props.direction}
32
+ >
33
+ {props.tiles}
34
+ </CheckboxGroup>
35
+ ),
36
+ }
37
+ );
38
+
39
+ figma.connect(
40
+ CheckboxGroup,
41
+ 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=3141-4275&m=dev',
42
+ {
43
+ variant: {
44
+ Content: 'Checkbox',
45
+ },
46
+ props,
47
+ example: props => (
48
+ <CheckboxGroup label={props.label} helperText={props.helperText} direction={props.direction}>
49
+ {props.checkboxes}
50
+ </CheckboxGroup>
51
+ ),
52
+ }
53
+ );
@@ -1,32 +1,29 @@
1
- import React from "react"
2
- import CheckboxTileRoot from "./CheckboxTileRoot"
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 { Checkbox } from './Checkbox';
12
3
 
13
4
  figma.connect(
14
- CheckboxTileRoot,
15
- "https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=4961%3A23797",
5
+ Checkbox,
6
+ 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=4961-23797&m=dev',
16
7
  {
17
8
  props: {
18
- // No matching props could be found for these Figma properties:
19
- // "helperText": figma.boolean('Helper text?'),
20
- // "helperText": figma.string('Helper text'),
21
- // "label": figma.string('Label'),
22
- // "image": figma.boolean('Image?'),
23
- // "state": figma.enum('State', {
24
- // "Default": "default",
25
- // "Invalid": "invalid",
26
- // "Focus": "focus"
27
- // }),
28
- // "checked": figma.boolean('Checked?')
9
+ disabled: figma.enum('State', {
10
+ Disabled: true,
11
+ }),
12
+ checked: figma.boolean('Checked?'),
13
+ label: figma.string('Label'),
14
+ helperText: figma.boolean('Helper text?', {
15
+ true: figma.string('Helper text'),
16
+ false: undefined,
17
+ }),
29
18
  },
30
- example: (props) => <CheckboxTileRoot />,
31
- },
32
- )
19
+ example: props => (
20
+ <Checkbox
21
+ type="tile"
22
+ disabled={props.disabled}
23
+ checked={props.checked}
24
+ label={props.label}
25
+ helperText={props.helperText}
26
+ />
27
+ ),
28
+ }
29
+ );
@@ -1,56 +1,72 @@
1
- import React from "react"
2
- import CurrencyInput from "./CurrencyInput"
3
- import figma from "@figma/code-connect"
1
+ import figma from '@figma/code-connect';
2
+ import { CurrencyInput, FormField } 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
+ placeholder: figma.string('Value'),
6
+ value: figma.string('Value'),
7
+ label: figma.string('Label'),
8
+ helperText: figma.boolean('Helper text?', {
9
+ true: figma.string('Helper text'),
10
+ false: undefined,
11
+ }),
12
+ invalidText: figma.enum('State', {
13
+ Default: undefined,
14
+ Invalid: figma.string('Validation'),
15
+ }),
16
+ validationStatus: figma.enum('State', {
17
+ Default: undefined,
18
+ Invalid: 'invalid',
19
+ }),
20
+ // "labelVariant": figma.enum('Label variant', {
21
+ // "Body": "body",
22
+ // "Heading": "heading"
23
+ // })
24
+ };
25
+
26
+ const onChangeHandler = () => {
27
+ // Placeholder for onChange handler
28
+ };
29
+
30
+ const value = 'some value';
31
+
32
+ figma.connect(
33
+ CurrencyInput,
34
+ 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=2161%3A1336',
35
+ {
36
+ props,
37
+ variant: {
38
+ 'Value type': 'Filled',
39
+ },
40
+ example: props => (
41
+ <FormField
42
+ label={props.label}
43
+ helperText={props.helperText}
44
+ invalidText={props.invalidText}
45
+ validationStatus={props.validationStatus}
46
+ >
47
+ <CurrencyInput value={props.value} onChange={onChangeHandler} />
48
+ </FormField>
49
+ ),
50
+ }
51
+ );
11
52
 
12
53
  figma.connect(
13
54
  CurrencyInput,
14
- "https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=2161%3A1336",
55
+ 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=2161%3A1336',
15
56
  {
16
- props: {
17
- // These props were automatically mapped based on your linked code:
18
- focused: figma.boolean("Focus?"),
19
- placeholder: figma.string("Label"),
20
- autoFocus: figma.boolean("Focus?"),
21
- defaultValue: figma.string("Value"),
22
- value: figma.string("Value"),
23
- focusable: figma.boolean("Focus?"),
24
- hasTVPreferredFocus: figma.boolean("Focus?"),
25
- // No matching props could be found for these Figma properties:
26
- // "validation": figma.string('Validation'),
27
- // "helperText": figma.string('Helper text'),
28
- // "label": figma.string('Label'),
29
- // "value": figma.string('Value'),
30
- // "helperText": figma.boolean('Helper text?'),
31
- // "state": figma.enum('State', {
32
- // "Default": "default",
33
- // "Invalid": "invalid"
34
- // }),
35
- // "valueType": figma.enum('Value type', {
36
- // "Placeholder": "placeholder",
37
- // "Filled": "filled"
38
- // }),
39
- // "labelVariant": figma.enum('Label variant', {
40
- // "Body": "body",
41
- // "Heading": "heading"
42
- // })
57
+ props,
58
+ variant: {
59
+ 'Value type': 'Placeholder',
43
60
  },
44
- example: (props) => (
45
- <CurrencyInput
46
- focused={props.focused}
47
- placeholder={props.placeholder}
48
- autoFocus={props.autoFocus}
49
- defaultValue={props.defaultValue}
50
- value={props.value}
51
- focusable={props.focusable}
52
- hasTVPreferredFocus={props.hasTVPreferredFocus}
53
- />
61
+ example: props => (
62
+ <FormField
63
+ label={props.label}
64
+ helperText={props.helperText}
65
+ invalidText={props.invalidText}
66
+ validationStatus={props.validationStatus}
67
+ >
68
+ <CurrencyInput placeholder={props.placeholder} value={value} onChange={onChangeHandler} />
69
+ </FormField>
54
70
  ),
55
- },
56
- )
71
+ }
72
+ );