@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.
- package/.storybook/manager.ts +1 -0
- package/.storybook/preview.tsx +1 -0
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +13 -13
- package/CHANGELOG.md +299 -4
- package/build/components/BodyText/BodyText.js +12 -5
- package/build/components/BodyText/BodyText.props.d.ts +5 -19
- package/build/components/Box/Box.js +23 -3
- package/build/components/Box/Box.props.d.ts +3 -95
- package/build/components/Card/Card.props.d.ts +2 -5
- package/build/components/Container/Container.props.d.ts +2 -78
- package/build/components/DateInput/DateInput.d.ts +1 -1
- package/build/components/DateInput/DateInput.js +2 -2
- package/build/components/DateInput/DateInput.props.d.ts +15 -1
- package/build/components/DateInput/DateInputSegment.d.ts +1 -1
- package/build/components/DateInput/DateInputSegment.js +2 -2
- package/build/components/DetailText/DetailText.js +14 -13
- package/build/components/DetailText/DetailText.props.d.ts +4 -17
- package/build/components/Flex/Flex.js +3 -1
- package/build/components/Flex/Flex.props.d.ts +2 -2
- package/build/components/Heading/Heading.js +34 -13
- package/build/components/Heading/Heading.props.d.ts +4 -18
- 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/build/core/themes.d.ts +188 -8
- package/build/core/themes.js +18 -2
- package/build/hooks/useStyleProps.js +22 -5
- package/build/tokens/color.d.ts +4 -0
- package/build/tokens/color.js +2 -0
- package/build/tokens/components/dark/modal.d.ts +6 -0
- package/build/tokens/components/dark/modal.js +6 -0
- package/build/tokens/components/dark/navigation.d.ts +1 -0
- package/build/tokens/components/dark/navigation.js +1 -0
- package/build/tokens/components/light/modal.d.ts +6 -0
- package/build/tokens/components/light/modal.js +6 -0
- package/build/tokens/components/light/navigation.d.ts +1 -0
- package/build/tokens/components/light/navigation.js +1 -0
- package/build/tokens/components/light/skeleton.d.ts +1 -1
- package/build/tokens/components/light/skeleton.js +1 -1
- package/build/tokens/font.d.ts +2 -0
- package/build/tokens/font.js +2 -0
- package/build/tokens/line-height.d.ts +2 -0
- package/build/tokens/line-height.js +2 -0
- package/build/tokens/primitive.d.ts +4 -0
- package/build/tokens/primitive.js +4 -0
- package/build/tokens/semantic-dark.d.ts +1 -0
- package/build/tokens/semantic-dark.js +1 -0
- package/build/tokens/semantic-light.d.ts +1 -0
- package/build/tokens/semantic-light.js +1 -0
- package/build/tokens/typography.d.ts +30 -0
- package/build/tokens/typography.js +15 -0
- package/build/types/index.d.ts +4 -2
- package/build/types/index.js +4 -2
- package/build/types/semanticColorValues.d.ts +22 -0
- package/build/types/semanticColorValues.js +1 -0
- package/build/types/utilityProps.d.ts +326 -0
- package/build/types/utilityProps.js +1 -0
- package/build/types/values.d.ts +4 -3
- package/build/utils/coloursAsArray.d.ts +4 -0
- package/build/utils/coloursAsArray.js +5 -0
- package/build/utils/index.d.ts +1 -1
- package/build/utils/index.js +1 -1
- package/build/utils/styleUtils.d.ts +26 -2
- package/build/utils/styleUtils.js +42 -13
- package/build/utils/themeValueHelpers.d.ts +13 -0
- package/build/utils/themeValueHelpers.js +29 -0
- package/docs/changelog.mdx +74 -2
- package/docs/components/AllComponents.web.tsx +23 -24
- package/docs/components/UsageWrap.tsx +2 -2
- package/docs/introduction.mdx +0 -7
- package/package.json +5 -3
- package/src/components/BodyText/BodyText.props.ts +5 -19
- package/src/components/BodyText/BodyText.stories.tsx +2 -1
- package/src/components/BodyText/BodyText.tsx +17 -6
- package/src/components/Box/Box.docs.mdx +5 -4
- package/src/components/Box/Box.props.ts +3 -231
- package/src/components/Box/Box.stories.tsx +2 -2
- package/src/components/Box/Box.tsx +38 -9
- package/src/components/Button/Button.docs.mdx +46 -1
- package/src/components/Card/Card.docs.mdx +1 -1
- package/src/components/Card/Card.props.ts +2 -5
- package/src/components/Card/Card.stories.tsx +54 -23
- package/src/components/Carousel/Carousel.docs.mdx +49 -44
- package/src/components/Center/Center.docs.mdx +6 -4
- package/src/components/Checkbox/CheckboxGroup.figma.tsx +21 -1
- package/src/components/Container/Container.docs.mdx +13 -8
- package/src/components/Container/Container.props.ts +9 -80
- package/src/components/Container/Container.stories.tsx +81 -65
- package/src/components/DateInput/DateInput.docs.mdx +43 -0
- package/src/components/DateInput/DateInput.props.ts +15 -1
- package/src/components/DateInput/DateInput.stories.tsx +37 -2
- package/src/components/DateInput/DateInput.tsx +6 -0
- package/src/components/DateInput/DateInputSegment.tsx +2 -0
- package/src/components/DetailText/DetailText.props.ts +4 -17
- package/src/components/DetailText/DetailText.stories.tsx +2 -3
- package/src/components/DetailText/DetailText.tsx +16 -17
- package/src/components/Flex/Flex.props.ts +2 -2
- package/src/components/Flex/Flex.stories.tsx +1 -1
- package/src/components/Flex/Flex.tsx +4 -1
- package/src/components/Grid/Grid.docs.mdx +53 -49
- package/src/components/Heading/Heading.props.ts +4 -18
- package/src/components/Heading/Heading.stories.tsx +2 -1
- package/src/components/Heading/Heading.tsx +40 -18
- 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/Toast/ToastItem.figma.tsx +1 -8
- package/src/components/ToggleButtonCard/ToggleButtonCard.figma.tsx +24 -0
- package/src/components/VerificationInput/VerificationInput.figma.tsx +53 -0
- package/src/core/themes.ts +19 -2
- package/src/hooks/useStyleProps.ts +40 -5
- package/src/tokens/color.ts +2 -0
- package/src/tokens/components/dark/modal.ts +6 -0
- package/src/tokens/components/dark/navigation.ts +1 -0
- package/src/tokens/components/light/modal.ts +6 -0
- package/src/tokens/components/light/navigation.ts +1 -0
- package/src/tokens/components/light/skeleton.ts +1 -1
- package/src/tokens/font.ts +2 -0
- package/src/tokens/line-height.ts +2 -0
- package/src/tokens/primitive.ts +4 -0
- package/src/tokens/semantic-dark.ts +1 -0
- package/src/tokens/semantic-light.ts +1 -0
- package/src/tokens/typography.ts +15 -0
- package/src/types/index.ts +4 -2
- package/src/types/semanticColorValues.ts +26 -0
- package/src/types/utilityProps.ts +410 -0
- package/src/types/values.ts +4 -7
- package/src/utils/coloursAsArray.ts +6 -0
- package/src/utils/index.ts +8 -1
- package/src/utils/styleUtils.ts +45 -14
- package/src/utils/themeValueHelpers.ts +38 -0
- package/src/components/Radio/RadioTileRoot.figma.tsx +0 -31
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
import type { Ref } from 'react';
|
|
2
|
+
import type { TextProps as RNTextProps, Text, TextStyle, ViewStyle } from 'react-native';
|
|
3
|
+
import type {
|
|
4
|
+
BackgroundColorValue,
|
|
5
|
+
BorderColorValue,
|
|
6
|
+
IconColorValue,
|
|
7
|
+
TextColorValue,
|
|
8
|
+
} from './semanticColorValues';
|
|
9
|
+
import type {
|
|
10
|
+
BorderRadiusValue,
|
|
11
|
+
BorderWidthValue,
|
|
12
|
+
ColorValue,
|
|
13
|
+
OpacityValue,
|
|
14
|
+
RawColorValue,
|
|
15
|
+
SpaceValue,
|
|
16
|
+
} from './values';
|
|
17
|
+
|
|
18
|
+
// ─── Margin Props ────────────────────────────────────────────────────────────
|
|
19
|
+
|
|
20
|
+
export interface MarginProps {
|
|
21
|
+
/** Margin on all sides. Accepts theme space tokens or raw values. */
|
|
22
|
+
margin?: SpaceValue;
|
|
23
|
+
/** Horizontal margin (left and right). */
|
|
24
|
+
marginHorizontal?: SpaceValue;
|
|
25
|
+
/** Vertical margin (top and bottom). */
|
|
26
|
+
marginVertical?: SpaceValue;
|
|
27
|
+
/** Top margin. */
|
|
28
|
+
marginTop?: SpaceValue;
|
|
29
|
+
/** Bottom margin. */
|
|
30
|
+
marginBottom?: SpaceValue;
|
|
31
|
+
/** Left margin. */
|
|
32
|
+
marginLeft?: SpaceValue;
|
|
33
|
+
/** Right margin. */
|
|
34
|
+
marginRight?: SpaceValue;
|
|
35
|
+
/** End margin (logical). */
|
|
36
|
+
marginEnd?: SpaceValue;
|
|
37
|
+
/** Start margin (logical). */
|
|
38
|
+
marginStart?: SpaceValue;
|
|
39
|
+
/** Shorthand: margin on all sides. */
|
|
40
|
+
m?: SpaceValue;
|
|
41
|
+
/** Shorthand: horizontal margin. */
|
|
42
|
+
mx?: SpaceValue;
|
|
43
|
+
/** Shorthand: vertical margin. */
|
|
44
|
+
my?: SpaceValue;
|
|
45
|
+
/** Shorthand: top margin. */
|
|
46
|
+
mt?: SpaceValue;
|
|
47
|
+
/** Shorthand: bottom margin. */
|
|
48
|
+
mb?: SpaceValue;
|
|
49
|
+
/** Shorthand: left margin. */
|
|
50
|
+
ml?: SpaceValue;
|
|
51
|
+
/** Shorthand: right margin. */
|
|
52
|
+
mr?: SpaceValue;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ─── Padding Props ───────────────────────────────────────────────────────────
|
|
56
|
+
|
|
57
|
+
export interface PaddingProps {
|
|
58
|
+
/** Padding on all sides. Accepts theme space tokens or raw values. */
|
|
59
|
+
padding?: SpaceValue;
|
|
60
|
+
/** Horizontal padding (left and right). */
|
|
61
|
+
paddingHorizontal?: SpaceValue;
|
|
62
|
+
/** Vertical padding (top and bottom). */
|
|
63
|
+
paddingVertical?: SpaceValue;
|
|
64
|
+
/** Top padding. */
|
|
65
|
+
paddingTop?: SpaceValue;
|
|
66
|
+
/** Bottom padding. */
|
|
67
|
+
paddingBottom?: SpaceValue;
|
|
68
|
+
/** Left padding. */
|
|
69
|
+
paddingLeft?: SpaceValue;
|
|
70
|
+
/** Right padding. */
|
|
71
|
+
paddingRight?: SpaceValue;
|
|
72
|
+
/** End padding (logical). */
|
|
73
|
+
paddingEnd?: SpaceValue;
|
|
74
|
+
/** Start padding (logical). */
|
|
75
|
+
paddingStart?: SpaceValue;
|
|
76
|
+
/** Shorthand: padding on all sides. */
|
|
77
|
+
p?: SpaceValue;
|
|
78
|
+
/** Shorthand: horizontal padding. */
|
|
79
|
+
px?: SpaceValue;
|
|
80
|
+
/** Shorthand: vertical padding. */
|
|
81
|
+
py?: SpaceValue;
|
|
82
|
+
/** Shorthand: top padding. */
|
|
83
|
+
pt?: SpaceValue;
|
|
84
|
+
/** Shorthand: bottom padding. */
|
|
85
|
+
pb?: SpaceValue;
|
|
86
|
+
/** Shorthand: left padding. */
|
|
87
|
+
pl?: SpaceValue;
|
|
88
|
+
/** Shorthand: right padding. */
|
|
89
|
+
pr?: SpaceValue;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// ─── Spacing (Gap) Props ─────────────────────────────────────────────────────
|
|
93
|
+
|
|
94
|
+
export interface GapProps {
|
|
95
|
+
/** Gap between child elements. */
|
|
96
|
+
gap?: SpaceValue;
|
|
97
|
+
/** Row gap between child elements. */
|
|
98
|
+
rowGap?: SpaceValue;
|
|
99
|
+
/** Column gap between child elements. */
|
|
100
|
+
columnGap?: SpaceValue;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ─── Size Props ──────────────────────────────────────────────────────────────
|
|
104
|
+
|
|
105
|
+
export interface SizeProps {
|
|
106
|
+
/** Element height. Accepts theme space tokens or raw values. */
|
|
107
|
+
height?: SpaceValue;
|
|
108
|
+
/** Element width. */
|
|
109
|
+
width?: SpaceValue;
|
|
110
|
+
/** Minimum height. */
|
|
111
|
+
minHeight?: SpaceValue;
|
|
112
|
+
/** Minimum width. */
|
|
113
|
+
minWidth?: SpaceValue;
|
|
114
|
+
/** Maximum height. */
|
|
115
|
+
maxHeight?: SpaceValue;
|
|
116
|
+
/** Maximum width. */
|
|
117
|
+
maxWidth?: SpaceValue;
|
|
118
|
+
/** Shorthand: height. */
|
|
119
|
+
h?: SpaceValue;
|
|
120
|
+
/** Shorthand: width. */
|
|
121
|
+
w?: SpaceValue;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// ─── Position Props ──────────────────────────────────────────────────────────
|
|
125
|
+
|
|
126
|
+
export interface PositionProps {
|
|
127
|
+
/** Position type. */
|
|
128
|
+
position?: ViewStyle['position'];
|
|
129
|
+
/** Top offset. */
|
|
130
|
+
top?: SpaceValue;
|
|
131
|
+
/** Bottom offset. */
|
|
132
|
+
bottom?: SpaceValue;
|
|
133
|
+
/** Left offset. */
|
|
134
|
+
left?: SpaceValue;
|
|
135
|
+
/** Right offset. */
|
|
136
|
+
right?: SpaceValue;
|
|
137
|
+
/** Logical start offset. */
|
|
138
|
+
start?: SpaceValue;
|
|
139
|
+
/** Logical end offset. */
|
|
140
|
+
end?: SpaceValue;
|
|
141
|
+
/** Z-index for stacking order. */
|
|
142
|
+
zIndex?: number;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ─── Background Color Props ──────────────────────────────────────────────────
|
|
146
|
+
|
|
147
|
+
export interface BackgroundColorProps {
|
|
148
|
+
/** Background color. Accepts simplified semantic background tokens. */
|
|
149
|
+
backgroundColor?: BackgroundColorValue | RawColorValue;
|
|
150
|
+
/** Shorthand: background color. */
|
|
151
|
+
bg?: BackgroundColorValue | RawColorValue;
|
|
152
|
+
/** Shorthand: background color. */
|
|
153
|
+
bgColor?: BackgroundColorValue | RawColorValue;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// ─── Border Color Props ──────────────────────────────────────────────────────
|
|
157
|
+
|
|
158
|
+
export interface BorderColorStyleProps {
|
|
159
|
+
/** Border color. Accepts simplified semantic border tokens. */
|
|
160
|
+
borderColor?: BorderColorValue | RawColorValue;
|
|
161
|
+
/** Bottom border color. */
|
|
162
|
+
borderBottomColor?: BorderColorValue | RawColorValue;
|
|
163
|
+
/** Left border color. */
|
|
164
|
+
borderLeftColor?: BorderColorValue | RawColorValue;
|
|
165
|
+
/** Right border color. */
|
|
166
|
+
borderRightColor?: BorderColorValue | RawColorValue;
|
|
167
|
+
/** Top border color. */
|
|
168
|
+
borderTopColor?: BorderColorValue | RawColorValue;
|
|
169
|
+
/** Block border color. */
|
|
170
|
+
borderBlockColor?: BorderColorValue | RawColorValue;
|
|
171
|
+
/** Block end border color. */
|
|
172
|
+
borderBlockEndColor?: BorderColorValue | RawColorValue;
|
|
173
|
+
/** Block start border color. */
|
|
174
|
+
borderBlockStartColor?: BorderColorValue | RawColorValue;
|
|
175
|
+
/** End border color. */
|
|
176
|
+
borderEndColor?: BorderColorValue | RawColorValue;
|
|
177
|
+
/** Start border color. */
|
|
178
|
+
borderStartColor?: BorderColorValue | RawColorValue;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// ─── Border Width Props ──────────────────────────────────────────────────────
|
|
182
|
+
|
|
183
|
+
export interface BorderWidthProps {
|
|
184
|
+
/** Border width on all sides. */
|
|
185
|
+
borderWidth?: BorderWidthValue;
|
|
186
|
+
/** Bottom border width. */
|
|
187
|
+
borderBottomWidth?: BorderWidthValue;
|
|
188
|
+
/** End border width. */
|
|
189
|
+
borderEndWidth?: BorderWidthValue;
|
|
190
|
+
/** Left border width. */
|
|
191
|
+
borderLeftWidth?: BorderWidthValue;
|
|
192
|
+
/** Right border width. */
|
|
193
|
+
borderRightWidth?: BorderWidthValue;
|
|
194
|
+
/** Start border width. */
|
|
195
|
+
borderStartWidth?: BorderWidthValue;
|
|
196
|
+
/** Top border width. */
|
|
197
|
+
borderTopWidth?: BorderWidthValue;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// ─── Border Radius Props ────────────────────────────────────────────────────
|
|
201
|
+
|
|
202
|
+
export interface BorderRadiusProps {
|
|
203
|
+
/** Border radius on all corners. */
|
|
204
|
+
borderRadius?: BorderRadiusValue;
|
|
205
|
+
/** Bottom-end border radius. */
|
|
206
|
+
borderBottomEndRadius?: BorderRadiusValue;
|
|
207
|
+
/** Bottom-left border radius. */
|
|
208
|
+
borderBottomLeftRadius?: BorderRadiusValue;
|
|
209
|
+
/** Bottom-right border radius. */
|
|
210
|
+
borderBottomRightRadius?: BorderRadiusValue;
|
|
211
|
+
/** Bottom-start border radius. */
|
|
212
|
+
borderBottomStartRadius?: BorderRadiusValue;
|
|
213
|
+
/** Top-end border radius. */
|
|
214
|
+
borderTopEndRadius?: BorderRadiusValue;
|
|
215
|
+
/** Top-left border radius. */
|
|
216
|
+
borderTopLeftRadius?: BorderRadiusValue;
|
|
217
|
+
/** Top-right border radius. */
|
|
218
|
+
borderTopRightRadius?: BorderRadiusValue;
|
|
219
|
+
/** Top-start border radius. */
|
|
220
|
+
borderTopStartRadius?: BorderRadiusValue;
|
|
221
|
+
/** End-end border radius. */
|
|
222
|
+
borderEndEndRadius?: BorderRadiusValue;
|
|
223
|
+
/** End-start border radius. */
|
|
224
|
+
borderEndStartRadius?: BorderRadiusValue;
|
|
225
|
+
/** Start-end border radius. */
|
|
226
|
+
borderStartEndRadius?: BorderRadiusValue;
|
|
227
|
+
/** Start-start border radius. */
|
|
228
|
+
borderStartStartRadius?: BorderRadiusValue;
|
|
229
|
+
/** Shorthand: border radius on all corners. */
|
|
230
|
+
rounded?: BorderRadiusValue;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// ─── Border Style Props ─────────────────────────────────────────────────────
|
|
234
|
+
|
|
235
|
+
export interface BorderStyleProps {
|
|
236
|
+
/** Border style. */
|
|
237
|
+
borderStyle?: ViewStyle['borderStyle'];
|
|
238
|
+
/** Border curve. */
|
|
239
|
+
borderCurve?: ViewStyle['borderCurve'];
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// ─── Border Props (combined) ─────────────────────────────────────────────────
|
|
243
|
+
|
|
244
|
+
export interface BorderProps
|
|
245
|
+
extends BorderWidthProps, BorderRadiusProps, BorderColorStyleProps, BorderStyleProps {}
|
|
246
|
+
|
|
247
|
+
// ─── Flex Layout Props ───────────────────────────────────────────────────────
|
|
248
|
+
|
|
249
|
+
export interface FlexLayoutProps {
|
|
250
|
+
/** Align content. */
|
|
251
|
+
alignContent?: ViewStyle['alignContent'];
|
|
252
|
+
/** Align items. */
|
|
253
|
+
alignItems?: ViewStyle['alignItems'];
|
|
254
|
+
/** Align self. */
|
|
255
|
+
alignSelf?: ViewStyle['alignSelf'];
|
|
256
|
+
/** Flex value. */
|
|
257
|
+
flex?: number;
|
|
258
|
+
/** Flex basis. */
|
|
259
|
+
flexBasis?: ViewStyle['flexBasis'];
|
|
260
|
+
/** Flex direction. */
|
|
261
|
+
flexDirection?: ViewStyle['flexDirection'];
|
|
262
|
+
/** Flex grow. */
|
|
263
|
+
flexGrow?: number;
|
|
264
|
+
/** Flex shrink. */
|
|
265
|
+
flexShrink?: number;
|
|
266
|
+
/** Flex wrap. */
|
|
267
|
+
flexWrap?: ViewStyle['flexWrap'];
|
|
268
|
+
/** Justify content. */
|
|
269
|
+
justifyContent?: ViewStyle['justifyContent'];
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// ─── Opacity Props ───────────────────────────────────────────────────────────
|
|
273
|
+
|
|
274
|
+
export interface OpacityProps {
|
|
275
|
+
/** Opacity value. */
|
|
276
|
+
opacity?: OpacityValue;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// ─── Shadow Props ────────────────────────────────────────────────────────────
|
|
280
|
+
|
|
281
|
+
export interface ShadowProps {
|
|
282
|
+
/** Shadow color. */
|
|
283
|
+
shadowColor?: ColorValue;
|
|
284
|
+
/** Shadow offset. */
|
|
285
|
+
shadowOffset?: ViewStyle['shadowOffset'];
|
|
286
|
+
/** Shadow opacity. */
|
|
287
|
+
shadowOpacity?: number;
|
|
288
|
+
/** Shadow radius. */
|
|
289
|
+
shadowRadius?: number;
|
|
290
|
+
/** Box shadow. */
|
|
291
|
+
boxShadow?: ViewStyle['boxShadow'];
|
|
292
|
+
/** Elevation (Android). */
|
|
293
|
+
elevation?: number;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// ─── Outline Props ───────────────────────────────────────────────────────────
|
|
297
|
+
|
|
298
|
+
export interface OutlineProps {
|
|
299
|
+
/** Outline color. */
|
|
300
|
+
outlineColor?: ColorValue;
|
|
301
|
+
/** Outline offset. */
|
|
302
|
+
outlineOffset?: number;
|
|
303
|
+
/** Outline style. */
|
|
304
|
+
outlineStyle?: ViewStyle['outlineStyle'];
|
|
305
|
+
/** Outline width. */
|
|
306
|
+
outlineWidth?: number;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// ─── Display Props ───────────────────────────────────────────────────────────
|
|
310
|
+
|
|
311
|
+
export interface DisplayProps {
|
|
312
|
+
/** Display type. */
|
|
313
|
+
display?: ViewStyle['display'];
|
|
314
|
+
/** Overflow behavior. */
|
|
315
|
+
overflow?: ViewStyle['overflow'];
|
|
316
|
+
/** Pointer events behavior. */
|
|
317
|
+
pointerEvents?: ViewStyle['pointerEvents'];
|
|
318
|
+
/** Backface visibility. */
|
|
319
|
+
backfaceVisibility?: ViewStyle['backfaceVisibility'];
|
|
320
|
+
/** Cursor type. */
|
|
321
|
+
cursor?: ViewStyle['cursor'];
|
|
322
|
+
/** Direction for bidirectional text. */
|
|
323
|
+
direction?: ViewStyle['direction'];
|
|
324
|
+
/** Aspect ratio. */
|
|
325
|
+
aspectRatio?: ViewStyle['aspectRatio'];
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// ─── Transform Props ────────────────────────────────────────────────────────
|
|
329
|
+
|
|
330
|
+
export interface TransformProps {
|
|
331
|
+
/** Transform array. */
|
|
332
|
+
transform?: ViewStyle['transform'];
|
|
333
|
+
/** Transform origin. */
|
|
334
|
+
transformOrigin?: ViewStyle['transformOrigin'];
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// ─── Text Color Props ────────────────────────────────────────────────────────
|
|
338
|
+
|
|
339
|
+
export interface TextColorProps {
|
|
340
|
+
/** Text color. Accepts simplified semantic text tokens. */
|
|
341
|
+
color?: TextColorValue;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// ─── Icon Color Props ────────────────────────────────────────────────────────
|
|
345
|
+
|
|
346
|
+
export interface IconColorProps {
|
|
347
|
+
/** Icon color. Accepts simplified semantic icon tokens. */
|
|
348
|
+
iconColor?: IconColorValue;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// ─── Common Text Props ───────────────────────────────────────────────────────
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Common text styling props shared across text components (BodyText, Heading, DetailText).
|
|
355
|
+
* Includes margin utility props, simplified semantic text color, and standard text style props.
|
|
356
|
+
*/
|
|
357
|
+
export interface CommonTextProps extends RNTextProps, MarginProps {
|
|
358
|
+
/** Whether to truncate text with an ellipsis. */
|
|
359
|
+
truncated?: boolean;
|
|
360
|
+
/** Whether to show strikethrough text. */
|
|
361
|
+
strikeThrough?: boolean;
|
|
362
|
+
/** Whether to underline text. */
|
|
363
|
+
underline?: boolean;
|
|
364
|
+
/** Whether to italicise text. */
|
|
365
|
+
italic?: boolean;
|
|
366
|
+
/** Text color. Accepts simplified semantic text tokens. */
|
|
367
|
+
color?: TextColorValue | RawColorValue;
|
|
368
|
+
/** Text transform (uppercase, lowercase, capitalize). */
|
|
369
|
+
textTransform?: TextStyle['textTransform'];
|
|
370
|
+
/** Text alignment. */
|
|
371
|
+
textAlign?: TextStyle['textAlign'];
|
|
372
|
+
/** Vertical text alignment. */
|
|
373
|
+
textAlignVertical?: TextStyle['textAlignVertical'];
|
|
374
|
+
/** Text decoration line. */
|
|
375
|
+
textDecorationLine?: TextStyle['textDecorationLine'];
|
|
376
|
+
/** Text decoration style. */
|
|
377
|
+
textDecorationStyle?: TextStyle['textDecorationStyle'];
|
|
378
|
+
/** Text decoration color. Accepts any color value. */
|
|
379
|
+
textDecorationColor?: ColorValue;
|
|
380
|
+
/** User select behavior. */
|
|
381
|
+
userSelect?: TextStyle['userSelect'];
|
|
382
|
+
/** Whether to use inverted (light-on-dark) text color. */
|
|
383
|
+
inverted?: boolean;
|
|
384
|
+
/** Ref to the underlying Text element. */
|
|
385
|
+
ref?: Ref<Text>;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// ─── Composed Groups ─────────────────────────────────────────────────────────
|
|
389
|
+
|
|
390
|
+
/** All spacing-related utility props (margin, padding, gap). */
|
|
391
|
+
export interface SpacingProps extends MarginProps, PaddingProps, GapProps {}
|
|
392
|
+
|
|
393
|
+
/** All layout-related utility props (flex, size, position). */
|
|
394
|
+
export interface LayoutProps extends FlexLayoutProps, SizeProps, PositionProps {}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* All Box-level utility style props.
|
|
398
|
+
* This is the full set of style utilities available on Box.
|
|
399
|
+
*/
|
|
400
|
+
export interface AllUtilityProps
|
|
401
|
+
extends
|
|
402
|
+
SpacingProps,
|
|
403
|
+
LayoutProps,
|
|
404
|
+
BackgroundColorProps,
|
|
405
|
+
BorderProps,
|
|
406
|
+
OpacityProps,
|
|
407
|
+
ShadowProps,
|
|
408
|
+
OutlineProps,
|
|
409
|
+
DisplayProps,
|
|
410
|
+
TransformProps {}
|
package/src/types/values.ts
CHANGED
|
@@ -57,16 +57,13 @@ export type FlattenColorKeys<T> =
|
|
|
57
57
|
}[keyof T]
|
|
58
58
|
: never;
|
|
59
59
|
|
|
60
|
+
export type RawColorValue = 'transparent' | HSLA | HSL | RGB | RGBA | HEX;
|
|
61
|
+
|
|
60
62
|
export type ColorValue =
|
|
61
63
|
| 'currentColor'
|
|
62
|
-
|
|
|
64
|
+
| RawColorValue
|
|
63
65
|
| FlattenColorKeys<Omit<typeof color, 'light' | 'dark'> & { white: '#ffffff'; black: '#000000' }>
|
|
64
66
|
| FlattenColorKeys<(typeof color)['light']>
|
|
65
|
-
| HSLA
|
|
66
|
-
| HSL
|
|
67
|
-
| RGB
|
|
68
|
-
| RGBA
|
|
69
|
-
| HEX
|
|
70
67
|
| undefined;
|
|
71
68
|
|
|
72
69
|
export type BorderRadiusValue =
|
|
@@ -74,7 +71,7 @@ export type BorderRadiusValue =
|
|
|
74
71
|
| AnimatableNumericValue
|
|
75
72
|
| undefined;
|
|
76
73
|
|
|
77
|
-
export type
|
|
74
|
+
export type BorderWidthValue =
|
|
78
75
|
| `${keyof (typeof lightTheme)['borderWidth'] & (string | number)}`
|
|
79
76
|
| number
|
|
80
77
|
| undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { color } from '../tokens';
|
|
2
|
+
import semanticColors from '../tokens/semantic-light';
|
|
2
3
|
|
|
3
4
|
const { light, ...restOfColors } = color;
|
|
4
5
|
|
|
@@ -57,3 +58,8 @@ export default function coloursAsArray(): Array<string> {
|
|
|
57
58
|
|
|
58
59
|
return [...primitiveColors, ...primitiveColorValues, ...semanticColorValues];
|
|
59
60
|
}
|
|
61
|
+
|
|
62
|
+
export const backgroundColorKeys = Object.keys(semanticColors.background);
|
|
63
|
+
export const borderColorKeys = Object.keys(semanticColors.border);
|
|
64
|
+
export const textColorKeys = Object.keys(semanticColors.text);
|
|
65
|
+
export const iconColorKeys = Object.keys(semanticColors.icon);
|
package/src/utils/index.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {
|
|
2
|
+
backgroundColorKeys,
|
|
3
|
+
borderColorKeys,
|
|
4
|
+
default as coloursAsArray,
|
|
5
|
+
extractLightColorValues,
|
|
6
|
+
iconColorKeys,
|
|
7
|
+
textColorKeys,
|
|
8
|
+
} from './coloursAsArray';
|
|
2
9
|
export { default as formatThousands } from './formatThousands';
|
|
3
10
|
export { default as getFlattenedColorValue } from './getFlattenedColorValue';
|
|
4
11
|
export { getInitials } from './getInitials';
|
package/src/utils/styleUtils.ts
CHANGED
|
@@ -34,9 +34,15 @@ export const propStyleMapping: { [key: string]: keyof ViewStyle } = {
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
* Mapping of style props to their theme category
|
|
37
|
+
* Mapping of style props to their theme category.
|
|
38
|
+
*
|
|
39
|
+
* - `backgroundColor` maps to `theme.helpers.semanticColor.background` (simplified semantic background tokens)
|
|
40
|
+
* with fallback to `theme.color` for full color values
|
|
41
|
+
* - `borderColor` (and variants) maps to `theme.helpers.semanticColor.border` (simplified semantic border tokens)
|
|
42
|
+
* with fallback to `theme.color` for full color values
|
|
43
|
+
* - Other color props (shadowColor, outlineColor) still map to the full `theme.color` object
|
|
38
44
|
*/
|
|
39
|
-
export const themeStyleMapping: { [key
|
|
45
|
+
export const themeStyleMapping: { [key: string]: string } = {
|
|
40
46
|
// Space related
|
|
41
47
|
top: 'space',
|
|
42
48
|
bottom: 'space',
|
|
@@ -71,18 +77,20 @@ export const themeStyleMapping: { [key in keyof ViewStyle]?: string } = {
|
|
|
71
77
|
maxHeight: 'space',
|
|
72
78
|
start: 'space',
|
|
73
79
|
end: 'space',
|
|
74
|
-
//
|
|
75
|
-
backgroundColor: '
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
// Semantic background color (simplified keys: 'brand', 'primary', 'secondary')
|
|
81
|
+
backgroundColor: 'helpers.semanticColor.background',
|
|
82
|
+
// Semantic border colors (simplified keys: 'strong', 'subtle')
|
|
83
|
+
borderColor: 'helpers.semanticColor.border',
|
|
84
|
+
borderBottomColor: 'helpers.semanticColor.border',
|
|
85
|
+
borderLeftColor: 'helpers.semanticColor.border',
|
|
86
|
+
borderRightColor: 'helpers.semanticColor.border',
|
|
87
|
+
borderTopColor: 'helpers.semanticColor.border',
|
|
88
|
+
borderBlockColor: 'helpers.semanticColor.border',
|
|
89
|
+
borderBlockEndColor: 'helpers.semanticColor.border',
|
|
90
|
+
borderBlockStartColor: 'helpers.semanticColor.border',
|
|
91
|
+
borderEndColor: 'helpers.semanticColor.border',
|
|
92
|
+
borderStartColor: 'helpers.semanticColor.border',
|
|
93
|
+
// Other colors (still use the full color object for flexibility)
|
|
86
94
|
outlineColor: 'color',
|
|
87
95
|
shadowColor: 'color',
|
|
88
96
|
// Border radii
|
|
@@ -109,6 +117,29 @@ export const themeStyleMapping: { [key in keyof ViewStyle]?: string } = {
|
|
|
109
117
|
borderWidth: 'borderWidth',
|
|
110
118
|
};
|
|
111
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Mapping of theme categories to their fallback categories.
|
|
122
|
+
* When a value isn't found in the primary theme category, the fallback is tried.
|
|
123
|
+
* This ensures backward compatibility with full color values.
|
|
124
|
+
*/
|
|
125
|
+
export const themeStyleFallbackMapping: { [key: string]: string } = {
|
|
126
|
+
'helpers.semanticColor.background': 'color',
|
|
127
|
+
'helpers.semanticColor.border': 'color',
|
|
128
|
+
'helpers.semanticColor.text': 'color',
|
|
129
|
+
'helpers.semanticColor.icon': 'color',
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Mapping of custom semantic prop names to their style prop + theme category.
|
|
134
|
+
* These are props that don't correspond 1:1 with ViewStyle keys.
|
|
135
|
+
*/
|
|
136
|
+
export const semanticPropMapping: { [key: string]: { styleProp: string; themeKey: string } } = {
|
|
137
|
+
/** Maps iconColor prop -> resolves against theme.helpers.semanticColor.icon (semantic icon tokens) */
|
|
138
|
+
iconColor: { styleProp: 'color', themeKey: 'helpers.semanticColor.icon' },
|
|
139
|
+
/** Maps color prop -> resolves against theme.helpers.semanticColor.text (semantic text tokens) */
|
|
140
|
+
color: { styleProp: 'color', themeKey: 'helpers.semanticColor.text' },
|
|
141
|
+
};
|
|
142
|
+
|
|
112
143
|
/**
|
|
113
144
|
* Set of all possible ViewStyle property names
|
|
114
145
|
*/
|
|
@@ -58,3 +58,41 @@ export const resolveThemeValue = (value: any, themeMapping: any): any => {
|
|
|
58
58
|
// If none of the approaches work, return the original value
|
|
59
59
|
return value;
|
|
60
60
|
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Resolve a dot-notation key against the theme object.
|
|
64
|
+
* e.g., 'semanticColor.text' -> theme.semanticColor.text
|
|
65
|
+
* Simple keys like 'space' are resolved via direct bracket access.
|
|
66
|
+
*/
|
|
67
|
+
export const resolveThemeKey = (theme: Record<string, any>, key: string): any => {
|
|
68
|
+
if (key.includes('.')) {
|
|
69
|
+
return key.split('.').reduce((obj, k) => obj?.[k], theme);
|
|
70
|
+
}
|
|
71
|
+
return theme[key];
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Resolve a theme value with a fallback theme mapping.
|
|
76
|
+
* First tries the primary mapping (e.g., theme.semanticColor.background for simplified tokens).
|
|
77
|
+
* If not found, falls back to the secondary mapping (e.g., theme.color for full color values).
|
|
78
|
+
* This ensures backward compatibility while supporting simplified token names.
|
|
79
|
+
*/
|
|
80
|
+
export const resolveThemeValueWithFallback = (
|
|
81
|
+
value: any,
|
|
82
|
+
primaryMapping: any,
|
|
83
|
+
fallbackMapping?: any
|
|
84
|
+
): any => {
|
|
85
|
+
const resolved = resolveThemeValue(value, primaryMapping);
|
|
86
|
+
|
|
87
|
+
// If the value was resolved (changed from input), return it
|
|
88
|
+
if (resolved !== value) {
|
|
89
|
+
return resolved;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// If we have a fallback mapping and the primary didn't resolve, try the fallback
|
|
93
|
+
if (fallbackMapping) {
|
|
94
|
+
return resolveThemeValue(value, fallbackMapping);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return resolved;
|
|
98
|
+
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import RadioTileRoot from "./RadioTileRoot"
|
|
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
|
-
*/
|
|
12
|
-
|
|
13
|
-
figma.connect(
|
|
14
|
-
RadioTileRoot,
|
|
15
|
-
"https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3138%3A13222",
|
|
16
|
-
{
|
|
17
|
-
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
|
-
// "Focus": "focus"
|
|
26
|
-
// }),
|
|
27
|
-
// "checked": figma.boolean('Checked?')
|
|
28
|
-
},
|
|
29
|
-
example: (props) => <RadioTileRoot />,
|
|
30
|
-
},
|
|
31
|
-
)
|