@utilitywarehouse/hearth-react-native 0.20.0 → 0.22.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 +272 -0
- 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 +4 -11
- package/build/components/Card/CardRoot.js +0 -1
- package/build/components/Checkbox/Checkbox.d.ts +1 -1
- package/build/components/Checkbox/Checkbox.js +2 -2
- package/build/components/Checkbox/Checkbox.props.d.ts +2 -0
- 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/Modal/Modal.js +1 -1
- package/build/components/Radio/Radio.d.ts +1 -1
- package/build/components/Radio/Radio.js +2 -2
- package/build/components/Radio/Radio.props.d.ts +2 -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/NextPrevPage.tsx +2 -2
- package/docs/components/UsageWrap.tsx +2 -2
- package/docs/introduction.mdx +0 -7
- package/package.json +8 -6
- 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 +5 -11
- package/src/components/Card/Card.stories.tsx +54 -23
- package/src/components/Card/CardRoot.tsx +0 -1
- package/src/components/Carousel/Carousel.docs.mdx +49 -44
- package/src/components/Center/Center.docs.mdx +6 -4
- package/src/components/Checkbox/Checkbox.docs.mdx +1 -0
- package/src/components/Checkbox/Checkbox.props.ts +2 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +26 -0
- package/src/components/Checkbox/Checkbox.tsx +2 -0
- 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/Modal/Modal.tsx +1 -1
- package/src/components/Radio/Radio.docs.mdx +1 -0
- package/src/components/Radio/Radio.props.ts +2 -0
- package/src/components/Radio/Radio.stories.tsx +22 -0
- package/src/components/Radio/Radio.tsx +2 -0
- package/src/components/Radio/RadioTile.figma.tsx +4 -0
- package/src/components/Toast/ToastItem.figma.tsx +1 -8
- 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/tokens/primitive.ts
CHANGED
|
@@ -33,7 +33,9 @@ export default {
|
|
|
33
33
|
'400': 30,
|
|
34
34
|
'500': 36,
|
|
35
35
|
'550': 40,
|
|
36
|
+
'575': 44,
|
|
36
37
|
'600': 48,
|
|
38
|
+
'650': 54,
|
|
37
39
|
'700': 60,
|
|
38
40
|
'800': 72,
|
|
39
41
|
'900': 96,
|
|
@@ -78,7 +80,9 @@ export default {
|
|
|
78
80
|
'800': 36,
|
|
79
81
|
'900': 40,
|
|
80
82
|
'950': 48,
|
|
83
|
+
'975': 52,
|
|
81
84
|
'1000': 56,
|
|
85
|
+
'1050': 62,
|
|
82
86
|
'1100': 72,
|
|
83
87
|
'1200': 90,
|
|
84
88
|
},
|
package/src/tokens/typography.ts
CHANGED
|
@@ -64,6 +64,11 @@ export const mobile = {
|
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
66
|
heading: {
|
|
67
|
+
'2xl': {
|
|
68
|
+
fontSize: 44,
|
|
69
|
+
fontWeight: 700,
|
|
70
|
+
lineHeight: 52,
|
|
71
|
+
},
|
|
67
72
|
fontFamily: 'Comic Hams',
|
|
68
73
|
lg: {
|
|
69
74
|
fontSize: 24,
|
|
@@ -151,6 +156,11 @@ export const tablet = {
|
|
|
151
156
|
},
|
|
152
157
|
},
|
|
153
158
|
heading: {
|
|
159
|
+
'2xl': {
|
|
160
|
+
fontSize: 44,
|
|
161
|
+
fontWeight: 700,
|
|
162
|
+
lineHeight: 52,
|
|
163
|
+
},
|
|
154
164
|
fontFamily: 'Comic Hams',
|
|
155
165
|
lg: {
|
|
156
166
|
fontSize: 24,
|
|
@@ -238,6 +248,11 @@ export const desktop = {
|
|
|
238
248
|
},
|
|
239
249
|
},
|
|
240
250
|
heading: {
|
|
251
|
+
'2xl': {
|
|
252
|
+
fontSize: 54,
|
|
253
|
+
fontWeight: 700,
|
|
254
|
+
lineHeight: 62,
|
|
255
|
+
},
|
|
241
256
|
fontFamily: 'Comic Hams',
|
|
242
257
|
lg: {
|
|
243
258
|
fontSize: 30,
|
package/src/types/index.ts
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type semanticLight from '../tokens/semantic-light';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Simplified background color values derived from the semantic token `background` keys.
|
|
5
|
+
* e.g., 'brand' | 'primary' | 'secondary'
|
|
6
|
+
*/
|
|
7
|
+
export type BackgroundColorValue = keyof typeof semanticLight.background;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Simplified border color values derived from the semantic token `border` keys.
|
|
11
|
+
* e.g., 'strong' | 'subtle'
|
|
12
|
+
*/
|
|
13
|
+
export type BorderColorValue = keyof typeof semanticLight.border;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Simplified text color values derived from the semantic token `text` keys.
|
|
17
|
+
* e.g., 'affirmative' | 'brand' | 'inverted' | 'primary' | 'secondary'
|
|
18
|
+
* Also accepts any raw color value or undefined.
|
|
19
|
+
*/
|
|
20
|
+
export type TextColorValue = keyof typeof semanticLight.text;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Simplified icon color values derived from the semantic token `icon` keys.
|
|
24
|
+
* e.g., 'inverted' | 'primary'
|
|
25
|
+
*/
|
|
26
|
+
export type IconColorValue = keyof typeof semanticLight.icon;
|
|
@@ -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
|
*/
|