@utilitywarehouse/hearth-react-native 0.19.1 → 0.21.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 (149) hide show
  1. package/.storybook/manager.ts +1 -0
  2. package/.storybook/preview.tsx +1 -0
  3. package/.turbo/turbo-build.log +1 -1
  4. package/.turbo/turbo-lint.log +13 -13
  5. package/CHANGELOG.md +299 -4
  6. package/build/components/BodyText/BodyText.js +12 -5
  7. package/build/components/BodyText/BodyText.props.d.ts +5 -19
  8. package/build/components/Box/Box.js +23 -3
  9. package/build/components/Box/Box.props.d.ts +3 -95
  10. package/build/components/Card/Card.props.d.ts +2 -5
  11. package/build/components/Container/Container.props.d.ts +2 -78
  12. package/build/components/DateInput/DateInput.d.ts +1 -1
  13. package/build/components/DateInput/DateInput.js +2 -2
  14. package/build/components/DateInput/DateInput.props.d.ts +15 -1
  15. package/build/components/DateInput/DateInputSegment.d.ts +1 -1
  16. package/build/components/DateInput/DateInputSegment.js +2 -2
  17. package/build/components/DetailText/DetailText.js +14 -13
  18. package/build/components/DetailText/DetailText.props.d.ts +4 -17
  19. package/build/components/Flex/Flex.js +3 -1
  20. package/build/components/Flex/Flex.props.d.ts +2 -2
  21. package/build/components/Heading/Heading.js +34 -13
  22. package/build/components/Heading/Heading.props.d.ts +4 -18
  23. package/build/components/Select/Select.d.ts +1 -1
  24. package/build/components/Select/Select.js +9 -10
  25. package/build/components/Select/Select.props.d.ts +16 -0
  26. package/build/core/themes.d.ts +188 -8
  27. package/build/core/themes.js +18 -2
  28. package/build/hooks/useStyleProps.js +22 -5
  29. package/build/tokens/color.d.ts +4 -0
  30. package/build/tokens/color.js +2 -0
  31. package/build/tokens/components/dark/modal.d.ts +6 -0
  32. package/build/tokens/components/dark/modal.js +6 -0
  33. package/build/tokens/components/dark/navigation.d.ts +1 -0
  34. package/build/tokens/components/dark/navigation.js +1 -0
  35. package/build/tokens/components/light/modal.d.ts +6 -0
  36. package/build/tokens/components/light/modal.js +6 -0
  37. package/build/tokens/components/light/navigation.d.ts +1 -0
  38. package/build/tokens/components/light/navigation.js +1 -0
  39. package/build/tokens/components/light/skeleton.d.ts +1 -1
  40. package/build/tokens/components/light/skeleton.js +1 -1
  41. package/build/tokens/font.d.ts +2 -0
  42. package/build/tokens/font.js +2 -0
  43. package/build/tokens/line-height.d.ts +2 -0
  44. package/build/tokens/line-height.js +2 -0
  45. package/build/tokens/primitive.d.ts +4 -0
  46. package/build/tokens/primitive.js +4 -0
  47. package/build/tokens/semantic-dark.d.ts +1 -0
  48. package/build/tokens/semantic-dark.js +1 -0
  49. package/build/tokens/semantic-light.d.ts +1 -0
  50. package/build/tokens/semantic-light.js +1 -0
  51. package/build/tokens/typography.d.ts +30 -0
  52. package/build/tokens/typography.js +15 -0
  53. package/build/types/index.d.ts +4 -2
  54. package/build/types/index.js +4 -2
  55. package/build/types/semanticColorValues.d.ts +22 -0
  56. package/build/types/semanticColorValues.js +1 -0
  57. package/build/types/utilityProps.d.ts +326 -0
  58. package/build/types/utilityProps.js +1 -0
  59. package/build/types/values.d.ts +4 -3
  60. package/build/utils/coloursAsArray.d.ts +4 -0
  61. package/build/utils/coloursAsArray.js +5 -0
  62. package/build/utils/index.d.ts +1 -1
  63. package/build/utils/index.js +1 -1
  64. package/build/utils/styleUtils.d.ts +26 -2
  65. package/build/utils/styleUtils.js +42 -13
  66. package/build/utils/themeValueHelpers.d.ts +13 -0
  67. package/build/utils/themeValueHelpers.js +29 -0
  68. package/docs/changelog.mdx +74 -2
  69. package/docs/components/AllComponents.web.tsx +23 -24
  70. package/docs/components/UsageWrap.tsx +2 -2
  71. package/docs/introduction.mdx +0 -7
  72. package/package.json +5 -3
  73. package/src/components/BodyText/BodyText.props.ts +5 -19
  74. package/src/components/BodyText/BodyText.stories.tsx +2 -1
  75. package/src/components/BodyText/BodyText.tsx +17 -6
  76. package/src/components/Box/Box.docs.mdx +5 -4
  77. package/src/components/Box/Box.props.ts +3 -231
  78. package/src/components/Box/Box.stories.tsx +2 -2
  79. package/src/components/Box/Box.tsx +38 -9
  80. package/src/components/Button/Button.docs.mdx +46 -1
  81. package/src/components/Card/Card.docs.mdx +1 -1
  82. package/src/components/Card/Card.props.ts +2 -5
  83. package/src/components/Card/Card.stories.tsx +54 -23
  84. package/src/components/Carousel/Carousel.docs.mdx +49 -44
  85. package/src/components/Center/Center.docs.mdx +6 -4
  86. package/src/components/Checkbox/CheckboxGroup.figma.tsx +21 -1
  87. package/src/components/Container/Container.docs.mdx +13 -8
  88. package/src/components/Container/Container.props.ts +9 -80
  89. package/src/components/Container/Container.stories.tsx +81 -65
  90. package/src/components/DateInput/DateInput.docs.mdx +43 -0
  91. package/src/components/DateInput/DateInput.props.ts +15 -1
  92. package/src/components/DateInput/DateInput.stories.tsx +37 -2
  93. package/src/components/DateInput/DateInput.tsx +6 -0
  94. package/src/components/DateInput/DateInputSegment.tsx +2 -0
  95. package/src/components/DetailText/DetailText.props.ts +4 -17
  96. package/src/components/DetailText/DetailText.stories.tsx +2 -3
  97. package/src/components/DetailText/DetailText.tsx +16 -17
  98. package/src/components/Flex/Flex.props.ts +2 -2
  99. package/src/components/Flex/Flex.stories.tsx +1 -1
  100. package/src/components/Flex/Flex.tsx +4 -1
  101. package/src/components/Grid/Grid.docs.mdx +53 -49
  102. package/src/components/Heading/Heading.props.ts +4 -18
  103. package/src/components/Heading/Heading.stories.tsx +2 -1
  104. package/src/components/Heading/Heading.tsx +40 -18
  105. package/src/components/PillGroup/Pill.figma.tsx +4 -17
  106. package/src/components/PillGroup/PillGroup.figma.tsx +8 -9
  107. package/src/components/ProgressStepper/ProgressStep.figma.tsx +4 -15
  108. package/src/components/ProgressStepper/ProgressStepper.figma.tsx +9 -16
  109. package/src/components/Radio/Radio.figma.tsx +35 -22
  110. package/src/components/Radio/RadioGroup.figma.tsx +69 -41
  111. package/src/components/Radio/RadioTile.figma.tsx +34 -0
  112. package/src/components/RadioCard/RadioCard.figma.tsx +24 -0
  113. package/src/components/SectionHeader/SectionHeader.figma.tsx +31 -25
  114. package/src/components/Select/Select.docs.mdx +76 -28
  115. package/src/components/Select/Select.figma.tsx +44 -43
  116. package/src/components/Select/Select.props.ts +16 -0
  117. package/src/components/Select/Select.tsx +42 -35
  118. package/src/components/Select/SelectOption.figma.tsx +3 -21
  119. package/src/components/Spinner/Spinner.figma.tsx +12 -25
  120. package/src/components/Switch/Switch.figma.tsx +2 -23
  121. package/src/components/Tabs/Tab.figma.tsx +21 -0
  122. package/src/components/Tabs/Tabs.figma.tsx +18 -27
  123. package/src/components/Textarea/Textarea.figma.tsx +64 -0
  124. package/src/components/Toast/ToastItem.figma.tsx +1 -8
  125. package/src/components/ToggleButtonCard/ToggleButtonCard.figma.tsx +24 -0
  126. package/src/components/VerificationInput/VerificationInput.figma.tsx +53 -0
  127. package/src/core/themes.ts +19 -2
  128. package/src/hooks/useStyleProps.ts +40 -5
  129. package/src/tokens/color.ts +2 -0
  130. package/src/tokens/components/dark/modal.ts +6 -0
  131. package/src/tokens/components/dark/navigation.ts +1 -0
  132. package/src/tokens/components/light/modal.ts +6 -0
  133. package/src/tokens/components/light/navigation.ts +1 -0
  134. package/src/tokens/components/light/skeleton.ts +1 -1
  135. package/src/tokens/font.ts +2 -0
  136. package/src/tokens/line-height.ts +2 -0
  137. package/src/tokens/primitive.ts +4 -0
  138. package/src/tokens/semantic-dark.ts +1 -0
  139. package/src/tokens/semantic-light.ts +1 -0
  140. package/src/tokens/typography.ts +15 -0
  141. package/src/types/index.ts +4 -2
  142. package/src/types/semanticColorValues.ts +26 -0
  143. package/src/types/utilityProps.ts +410 -0
  144. package/src/types/values.ts +4 -7
  145. package/src/utils/coloursAsArray.ts +6 -0
  146. package/src/utils/index.ts +8 -1
  147. package/src/utils/styleUtils.ts +45 -14
  148. package/src/utils/themeValueHelpers.ts +38 -0
  149. package/src/components/Radio/RadioTileRoot.figma.tsx +0 -31
@@ -2,6 +2,7 @@ import { Canvas, Controls, Meta, Primary, Story } from '@storybook/addon-docs/bl
2
2
  import { BodyText, Box, Center, Grid } from '../..';
3
3
  import { BackToTopButton, UsageWrap, ViewFigmaButton } from '../../../docs/components';
4
4
  import * as Stories from './Grid.stories';
5
+ import { color } from '@utilitywarehouse/hearth-tokens';
5
6
 
6
7
  <Meta title="Primitives / Grid" />
7
8
 
@@ -26,17 +27,17 @@ The Grid component helps you create responsive grid layouts with configurable co
26
27
  <UsageWrap>
27
28
  <Center>
28
29
  <Grid columns={2} spacing="md" width={300}>
29
- <Box backgroundColor="green400" height={100} padding="200">
30
- <BodyText color="white">Item 1</BodyText>
30
+ <Box backgroundColor={color.green[400]} height={100} padding="200">
31
+ <BodyText color="inverted">Item 1</BodyText>
31
32
  </Box>
32
- <Box backgroundColor="blue400" height={100} padding="200">
33
- <BodyText color="white">Item 2</BodyText>
33
+ <Box backgroundColor={color.blue[400]} height={100} padding="200">
34
+ <BodyText color="inverted">Item 2</BodyText>
34
35
  </Box>
35
- <Box backgroundColor="red400" height={100} padding="200">
36
- <BodyText color="white">Item 3</BodyText>
36
+ <Box backgroundColor={color.red[400]} height={100} padding="200">
37
+ <BodyText color="inverted">Item 3</BodyText>
37
38
  </Box>
38
- <Box backgroundColor="yellow400" height={100} padding="200">
39
- <BodyText color="white">Item 4</BodyText>
39
+ <Box backgroundColor={color.yellow[400]} height={100} padding="200">
40
+ <BodyText color="inverted">Item 4</BodyText>
40
41
  </Box>
41
42
  </Grid>
42
43
  </Center>
@@ -44,20 +45,21 @@ The Grid component helps you create responsive grid layouts with configurable co
44
45
 
45
46
  ```jsx
46
47
  import { Grid, Box, BodyText } from '@utilitywarehouse/hearth-react-native';
48
+ import { color } from '@utilitywarehouse/hearth-tokens';
47
49
 
48
50
  const MyComponent = () => (
49
51
  <Grid columns={2} spacing="md" width={300}>
50
- <Box backgroundColor="green400" height={100} padding="200">
51
- <BodyText color="white">Item 1</BodyText>
52
+ <Box backgroundColor={color.green[400]} height={100} padding="200">
53
+ <BodyText color="inverted">Item 1</BodyText>
52
54
  </Box>
53
- <Box backgroundColor="blue400" height={100} padding="200">
54
- <BodyText color="white">Item 2</BodyText>
55
+ <Box backgroundColor={color.blue[400]} height={100} padding="200">
56
+ <BodyText color="inverted">Item 2</BodyText>
55
57
  </Box>
56
- <Box backgroundColor="red400" height={100} padding="200">
57
- <BodyText color="white">Item 3</BodyText>
58
+ <Box backgroundColor={color.red[400]} height={100} padding="200">
59
+ <BodyText color="inverted">Item 3</BodyText>
58
60
  </Box>
59
- <Box backgroundColor="yellow400" height={100} padding="200">
60
- <BodyText color="white">Item 4</BodyText>
61
+ <Box backgroundColor={color.yellow[400]} height={100} padding="200">
62
+ <BodyText color="inverted">Item 4</BodyText>
61
63
  </Box>
62
64
  </Grid>
63
65
  );
@@ -79,17 +81,17 @@ The Grid component supports responsive column layouts based on screen size break
79
81
  spacing="md"
80
82
  width="100%"
81
83
  >
82
- <Box backgroundColor="green400" height={100} padding="200">
83
- <BodyText color="white">Item 1</BodyText>
84
+ <Box backgroundColor={color.green[400]} height={100} padding="200">
85
+ <BodyText color="inverted">Item 1</BodyText>
84
86
  </Box>
85
- <Box backgroundColor="blue400" height={100} padding="200">
86
- <BodyText color="white">Item 2</BodyText>
87
+ <Box backgroundColor={color.blue[400]} height={100} padding="200">
88
+ <BodyText color="inverted">Item 2</BodyText>
87
89
  </Box>
88
- <Box backgroundColor="red400" height={100} padding="200">
89
- <BodyText color="white">Item 3</BodyText>
90
+ <Box backgroundColor={color.red[400]} height={100} padding="200">
91
+ <BodyText color="inverted">Item 3</BodyText>
90
92
  </Box>
91
- <Box backgroundColor="yellow400" height={100} padding="200">
92
- <BodyText color="white">Item 4</BodyText>
93
+ <Box backgroundColor={color.yellow[400]} height={100} padding="200">
94
+ <BodyText color="inverted">Item 4</BodyText>
93
95
  </Box>
94
96
  </Grid>
95
97
  </Center>
@@ -97,6 +99,7 @@ The Grid component supports responsive column layouts based on screen size break
97
99
 
98
100
  ```jsx
99
101
  import { Grid, Box, BodyText } from '@utilitywarehouse/hearth-react-native';
102
+ import { color } from '@utilitywarehouse/hearth-tokens';
100
103
 
101
104
  const MyComponent = () => (
102
105
  <Grid
@@ -109,17 +112,17 @@ const MyComponent = () => (
109
112
  spacing="md"
110
113
  width="100%"
111
114
  >
112
- <Box backgroundColor="green400" height={100} padding="200">
113
- <BodyText color="white">Item 1</BodyText>
115
+ <Box backgroundColor={color.green[400]} height={100} padding="200">
116
+ <BodyText color="inverted">Item 1</BodyText>
114
117
  </Box>
115
- <Box backgroundColor="blue400" height={100} padding="200">
116
- <BodyText color="white">Item 2</BodyText>
118
+ <Box backgroundColor={color.blue[400]} height={100} padding="200">
119
+ <BodyText color="inverted">Item 2</BodyText>
117
120
  </Box>
118
- <Box backgroundColor="red400" height={100} padding="200">
119
- <BodyText color="white">Item 3</BodyText>
121
+ <Box backgroundColor={color.red[400]} height={100} padding="200">
122
+ <BodyText color="inverted">Item 3</BodyText>
120
123
  </Box>
121
- <Box backgroundColor="yellow400" height={100} padding="200">
122
- <BodyText color="white">Item 4</BodyText>
124
+ <Box backgroundColor={color.yellow[400]} height={100} padding="200">
125
+ <BodyText color="inverted">Item 4</BodyText>
123
126
  </Box>
124
127
  </Grid>
125
128
  );
@@ -132,38 +135,39 @@ You can specify different horizontal and vertical spacing:
132
135
  <UsageWrap>
133
136
  <Center>
134
137
  <Grid columns={2} columnGap={24} rowGap={16}>
135
- <Box backgroundColor="green400" height={100} padding="200">
136
- <BodyText color="white">Item 1</BodyText>
138
+ <Box backgroundColor={color.green[400]} height={100} padding="200">
139
+ <BodyText color="inverted">Item 1</BodyText>
137
140
  </Box>
138
- <Box backgroundColor="blue400" height={100} padding="200">
139
- <BodyText color="white">Item 2</BodyText>
141
+ <Box backgroundColor={color.blue[400]} height={100} padding="200">
142
+ <BodyText color="inverted">Item 2</BodyText>
140
143
  </Box>
141
- <Box backgroundColor="red400" height={100} padding="200">
142
- <BodyText color="white">Item 3</BodyText>
144
+ <Box backgroundColor={color.red[400]} height={100} padding="200">
145
+ <BodyText color="inverted">Item 3</BodyText>
143
146
  </Box>
144
- <Box backgroundColor="yellow400" height={100} padding="200">
145
- <BodyText color="white">Item 4</BodyText>
147
+ <Box backgroundColor={color.yellow[400]} height={100} padding="200">
148
+ <BodyText color="inverted">Item 4</BodyText>
146
149
  </Box>
147
150
  </Grid>
148
151
  </Center>
149
152
  </UsageWrap>
150
153
 
151
154
  ```jsx
152
- import { Grid, Box } from '@utilitywarehouse/hearth-react-native';
155
+ import { Grid, Box, BodyText } from '@utilitywarehouse/hearth-react-native';
156
+ import { color } from '@utilitywarehouse/hearth-tokens';
153
157
 
154
158
  const MyComponent = () => (
155
159
  <Grid columns={2} columnGap={24} rowGap={8}>
156
- <Box backgroundColor="green400" height={100} padding="200">
157
- <BodyText color="white">Item 1</BodyText>
160
+ <Box backgroundColor={color.green[400]} height={100} padding="200">
161
+ <BodyText color="inverted">Item 1</BodyText>
158
162
  </Box>
159
- <Box backgroundColor="blue400" height={100} padding="200">
160
- <BodyText color="white">Item 2</BodyText>
163
+ <Box backgroundColor={color.blue[400]} height={100} padding="200">
164
+ <BodyText color="inverted">Item 2</BodyText>
161
165
  </Box>
162
- <Box backgroundColor="red400" height={100} padding="200">
163
- <BodyText color="white">Item 3</BodyText>
166
+ <Box backgroundColor={color.red[400]} height={100} padding="200">
167
+ <BodyText color="inverted">Item 3</BodyText>
164
168
  </Box>
165
- <Box backgroundColor="yellow400" height={100} padding="200">
166
- <BodyText color="white">Item 4</BodyText>
169
+ <Box backgroundColor={color.yellow[400]} height={100} padding="200">
170
+ <BodyText color="inverted">Item 4</BodyText>
167
171
  </Box>
168
172
  </Grid>
169
173
  );
@@ -1,22 +1,8 @@
1
- import type { Ref } from 'react';
2
- import type { Text, TextProps, TextStyle } from 'react-native';
3
- import type { ColorValue } from '../../types';
1
+ import type { CommonTextProps } from '../../types';
4
2
 
5
- interface HeadingProps extends TextProps {
6
- size?: 'sm' | 'md' | 'lg' | 'xl';
7
- strikeThrough?: boolean;
8
- underline?: boolean;
9
- truncated?: boolean;
10
- color?: ColorValue;
11
- textTransform?: TextStyle['textTransform'];
12
- textAlign?: TextStyle['textAlign'];
13
- textAlignVertical?: TextStyle['textAlignVertical'];
14
- textDecorationLine?: TextStyle['textDecorationLine'];
15
- textDecorationStyle?: TextStyle['textDecorationStyle'];
16
- textDecorationColor?: ColorValue;
17
- userSelect?: TextStyle['userSelect'];
18
- inverted?: boolean;
19
- ref?: Ref<Text>;
3
+ interface HeadingProps extends CommonTextProps {
4
+ /** Heading size variant. */
5
+ size?: 'sm' | 'md' | 'lg' | 'xl' | '2xl';
20
6
  }
21
7
 
22
8
  export default HeadingProps;
@@ -2,6 +2,7 @@ import { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import { Heading } from '.';
3
3
  import { VariantTitle } from '../../../docs/components';
4
4
  import { coloursAsArray } from '../../utils';
5
+ import { textColorKeys } from '../../utils/coloursAsArray';
5
6
  import { Box } from '../Box';
6
7
 
7
8
  // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
@@ -35,7 +36,7 @@ const meta = {
35
36
  description: 'Strike through the text.',
36
37
  },
37
38
  color: {
38
- options: coloursAsArray(),
39
+ options: textColorKeys,
39
40
  control: 'select',
40
41
  description: 'Color of the text. Use the color name from the theme.',
41
42
  },
@@ -1,9 +1,7 @@
1
- import { useMemo } from 'react';
2
1
  import { Text, TextStyle } from 'react-native';
3
2
  import { StyleSheet } from 'react-native-unistyles';
4
- import { useTheme } from '../../hooks';
5
- import type { ColorValue } from '../../types';
6
- import { getFlattenedColorValue } from '../../utils';
3
+ import { useStyleProps } from '../../hooks';
4
+ import { getFlattenedColorValue, resolveThemeValueWithFallback } from '../../utils';
7
5
  import type HeadingProps from './Heading.props';
8
6
 
9
7
  const Heading = ({
@@ -23,26 +21,19 @@ const Heading = ({
23
21
  inverted,
24
22
  ...props
25
23
  }: HeadingProps) => {
24
+ // Extract margin utility props from remaining props
25
+ const { computedStyles: utilityStyles, remainingProps } = useStyleProps(props);
26
+
26
27
  styles.useVariants({
27
28
  size,
28
29
  underline,
29
30
  strikeThrough,
30
31
  inverted,
31
32
  });
32
- const { color: themeColor, colorMode } = useTheme();
33
- const colorValue: ColorValue = useMemo(
34
- () => getFlattenedColorValue(color, themeColor),
35
- // eslint-disable-next-line react-hooks/exhaustive-deps
36
- [color, colorMode]
37
- );
38
- const decorationColor = useMemo(
39
- () => getFlattenedColorValue(textDecorationColor, themeColor),
40
- // eslint-disable-next-line react-hooks/exhaustive-deps
41
- [textDecorationColor, colorMode]
42
- );
33
+
43
34
  return (
44
35
  <Text
45
- {...props}
36
+ {...remainingProps}
46
37
  {...(truncated
47
38
  ? {
48
39
  numberOfLines: 1,
@@ -51,16 +42,16 @@ const Heading = ({
51
42
  : {})}
52
43
  style={[
53
44
  styles.text,
45
+ utilityStyles,
54
46
  {
55
- ...(colorValue ? { color: colorValue } : {}),
56
47
  ...(textTransform ? { textTransform } : {}),
57
48
  ...(textAlign ? { textAlign } : {}),
58
49
  ...(textAlignVertical ? { textAlignVertical } : {}),
59
- ...(decorationColor && { textDecorationColor: decorationColor }),
60
50
  ...(textDecorationLine && { textDecorationLine }),
61
51
  ...(textDecorationStyle && { textDecorationStyle }),
62
52
  ...(userSelect && { userSelect }),
63
53
  },
54
+ styles.getColours(color, textDecorationColor),
64
55
  props.style,
65
56
  ]}
66
57
  >
@@ -147,6 +138,23 @@ const styles = StyleSheet.create(theme => ({
147
138
  lg: theme.typography.desktop.heading.xl.lineHeight,
148
139
  },
149
140
  },
141
+ '2xl': {
142
+ fontSize: {
143
+ base: theme.typography.mobile.heading['2xl'].fontSize,
144
+ md: theme.typography.tablet.heading['2xl'].fontSize,
145
+ lg: theme.typography.desktop.heading['2xl'].fontSize,
146
+ },
147
+ fontWeight: {
148
+ base: theme.typography.mobile.heading['2xl'].fontWeight,
149
+ md: theme.typography.tablet.heading['2xl'].fontWeight,
150
+ lg: theme.typography.desktop.heading['2xl'].fontWeight,
151
+ },
152
+ lineHeight: {
153
+ base: theme.typography.mobile.heading['2xl'].lineHeight,
154
+ md: theme.typography.tablet.heading['2xl'].lineHeight,
155
+ lg: theme.typography.desktop.heading['2xl'].lineHeight,
156
+ },
157
+ },
150
158
  },
151
159
  underline: {
152
160
  true: {
@@ -165,6 +173,20 @@ const styles = StyleSheet.create(theme => ({
165
173
  },
166
174
  },
167
175
  },
176
+ getColours: (color?: string, textDecorationColor?: string) => ({
177
+ ...(color
178
+ ? {
179
+ color: resolveThemeValueWithFallback(
180
+ color,
181
+ theme.helpers.semanticColor.text,
182
+ theme.color
183
+ ),
184
+ }
185
+ : {}),
186
+ ...(textDecorationColor
187
+ ? { textDecorationColor: getFlattenedColorValue(textDecorationColor, theme.color) }
188
+ : {}),
189
+ }),
168
190
  }));
169
191
 
170
192
  export default Heading;
@@ -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
+ );