@hero-design/rn 8.27.0 → 8.27.1

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.
@@ -20,53 +20,76 @@ exports[`ToolbarItems renders correctly when disabled 1`] = `
20
20
  style={
21
21
  Object {
22
22
  "alignItems": "center",
23
+ "flexDirection": "row",
24
+ "height": 64,
23
25
  "opacity": 1,
24
- "paddingHorizontal": 12,
26
+ "paddingHorizontal": 8,
25
27
  "paddingVertical": 8,
26
28
  }
27
29
  }
28
30
  >
29
- <HeroIcon
30
- name="home"
31
+ <View
31
32
  style={
32
33
  Array [
33
34
  Object {
34
- "color": "#bfc1c5",
35
- "fontSize": 24,
35
+ "alignItems": "center",
36
+ "backgroundColor": "#ece8ef",
37
+ "borderRadius": 24,
38
+ "flexDirection": "row",
39
+ "justifyContent": "center",
40
+ "padding": 12,
36
41
  },
37
42
  undefined,
38
43
  ]
39
44
  }
40
- testID="toolbar-item-icon-home"
41
- themeIntent="disabled-text"
42
- themeSize="medium"
43
- />
44
- <Text
45
- allowFontScaling={false}
46
- numberOfLines={1}
47
- style={
48
- Array [
49
- Object {
50
- "color": "#4d6265",
51
- "fontFamily": "BeVietnamPro-SemiBold",
52
- "fontSize": 12,
53
- "letterSpacing": 0.36,
54
- "lineHeight": 20,
55
- },
56
- undefined,
57
- ]
58
- }
59
- themeFontSize="small"
60
- themeFontWeight="semi-bold"
61
- themeIntent="subdued"
62
- themeTypeface="neutral"
63
45
  >
64
- Action
65
- </Text>
46
+ <HeroIcon
47
+ name="home"
48
+ style={
49
+ Array [
50
+ Object {
51
+ "color": "#bfc1c5",
52
+ "fontSize": 24,
53
+ },
54
+ undefined,
55
+ ]
56
+ }
57
+ testID="toolbar-item-icon-home"
58
+ themeIntent="disabled-text"
59
+ themeSize="medium"
60
+ />
61
+ <Text
62
+ allowFontScaling={false}
63
+ numberOfLines={1}
64
+ style={
65
+ Array [
66
+ Object {
67
+ "color": "#4d6265",
68
+ "fontFamily": "BeVietnamPro-SemiBold",
69
+ "fontSize": 16,
70
+ "letterSpacing": 0.48,
71
+ "lineHeight": 24,
72
+ },
73
+ Array [
74
+ Object {
75
+ "marginLeft": 8,
76
+ },
77
+ undefined,
78
+ ],
79
+ ]
80
+ }
81
+ themeFontSize="large"
82
+ themeFontWeight="semi-bold"
83
+ themeIntent="subdued"
84
+ themeTypeface="neutral"
85
+ >
86
+ Action
87
+ </Text>
88
+ </View>
66
89
  </View>
67
90
  `;
68
91
 
69
- exports[`ToolbarItems renders correctly when intent is danger 1`] = `
92
+ exports[`ToolbarItems renders correctly when intent is danger, icon is undefined, label is Discard and disabled is false 1`] = `
70
93
  <View
71
94
  accessibilityState={
72
95
  Object {
@@ -86,27 +109,14 @@ exports[`ToolbarItems renders correctly when intent is danger 1`] = `
86
109
  style={
87
110
  Object {
88
111
  "alignItems": "center",
112
+ "flexDirection": "row",
113
+ "height": 64,
89
114
  "opacity": 1,
90
- "paddingHorizontal": 12,
115
+ "paddingHorizontal": 8,
91
116
  "paddingVertical": 8,
92
117
  }
93
118
  }
94
119
  >
95
- <HeroIcon
96
- name="home"
97
- style={
98
- Array [
99
- Object {
100
- "color": "#de350b",
101
- "fontSize": 24,
102
- },
103
- undefined,
104
- ]
105
- }
106
- testID="toolbar-item-icon-home"
107
- themeIntent="danger"
108
- themeSize="medium"
109
- />
110
120
  <Text
111
121
  allowFontScaling={false}
112
122
  numberOfLines={1}
@@ -115,24 +125,24 @@ exports[`ToolbarItems renders correctly when intent is danger 1`] = `
115
125
  Object {
116
126
  "color": "#f46363",
117
127
  "fontFamily": "BeVietnamPro-SemiBold",
118
- "fontSize": 12,
119
- "letterSpacing": 0.36,
120
- "lineHeight": 20,
128
+ "fontSize": 16,
129
+ "letterSpacing": 0.48,
130
+ "lineHeight": 24,
121
131
  },
122
132
  undefined,
123
133
  ]
124
134
  }
125
- themeFontSize="small"
135
+ themeFontSize="large"
126
136
  themeFontWeight="semi-bold"
127
137
  themeIntent="danger"
128
138
  themeTypeface="neutral"
129
139
  >
130
- Action
140
+ Discard
131
141
  </Text>
132
142
  </View>
133
143
  `;
134
144
 
135
- exports[`ToolbarItems renders correctly when intent is info 1`] = `
145
+ exports[`ToolbarItems renders correctly when intent is info, icon is undefined, label is Save and disabled is false 1`] = `
136
146
  <View
137
147
  accessibilityState={
138
148
  Object {
@@ -152,27 +162,14 @@ exports[`ToolbarItems renders correctly when intent is info 1`] = `
152
162
  style={
153
163
  Object {
154
164
  "alignItems": "center",
165
+ "flexDirection": "row",
166
+ "height": 64,
155
167
  "opacity": 1,
156
- "paddingHorizontal": 12,
168
+ "paddingHorizontal": 8,
157
169
  "paddingVertical": 8,
158
170
  }
159
171
  }
160
172
  >
161
- <HeroIcon
162
- name="home"
163
- style={
164
- Array [
165
- Object {
166
- "color": "#b5c3fd",
167
- "fontSize": 24,
168
- },
169
- undefined,
170
- ]
171
- }
172
- testID="toolbar-item-icon-home"
173
- themeIntent="info"
174
- themeSize="medium"
175
- />
176
173
  <Text
177
174
  allowFontScaling={false}
178
175
  numberOfLines={1}
@@ -181,24 +178,24 @@ exports[`ToolbarItems renders correctly when intent is info 1`] = `
181
178
  Object {
182
179
  "color": "#4568fb",
183
180
  "fontFamily": "BeVietnamPro-SemiBold",
184
- "fontSize": 12,
185
- "letterSpacing": 0.36,
186
- "lineHeight": 20,
181
+ "fontSize": 16,
182
+ "letterSpacing": 0.48,
183
+ "lineHeight": 24,
187
184
  },
188
185
  undefined,
189
186
  ]
190
187
  }
191
- themeFontSize="small"
188
+ themeFontSize="large"
192
189
  themeFontWeight="semi-bold"
193
190
  themeIntent="info"
194
191
  themeTypeface="neutral"
195
192
  >
196
- Action
193
+ Save
197
194
  </Text>
198
195
  </View>
199
196
  `;
200
197
 
201
- exports[`ToolbarItems renders correctly when intent is primary 1`] = `
198
+ exports[`ToolbarItems renders correctly when intent is primary, icon is ai-outlined, label is Try again and disabled is false 1`] = `
202
199
  <View
203
200
  accessibilityState={
204
201
  Object {
@@ -218,53 +215,165 @@ exports[`ToolbarItems renders correctly when intent is primary 1`] = `
218
215
  style={
219
216
  Object {
220
217
  "alignItems": "center",
218
+ "flexDirection": "row",
219
+ "height": 64,
221
220
  "opacity": 1,
222
- "paddingHorizontal": 12,
221
+ "paddingHorizontal": 8,
223
222
  "paddingVertical": 8,
224
223
  }
225
224
  }
226
225
  >
227
- <HeroIcon
228
- name="home"
226
+ <View
229
227
  style={
230
228
  Array [
231
229
  Object {
232
- "color": "#401960",
233
- "fontSize": 24,
230
+ "alignItems": "center",
231
+ "backgroundColor": "#ece8ef",
232
+ "borderRadius": 24,
233
+ "flexDirection": "row",
234
+ "justifyContent": "center",
235
+ "padding": 12,
234
236
  },
235
237
  undefined,
236
238
  ]
237
239
  }
238
- testID="toolbar-item-icon-home"
239
- themeIntent="primary"
240
- themeSize="medium"
241
- />
242
- <Text
243
- allowFontScaling={false}
244
- numberOfLines={1}
240
+ >
241
+ <HeroIcon
242
+ name="ai-outlined"
243
+ style={
244
+ Array [
245
+ Object {
246
+ "color": "#401960",
247
+ "fontSize": 24,
248
+ },
249
+ undefined,
250
+ ]
251
+ }
252
+ testID="toolbar-item-icon-ai-outlined"
253
+ themeIntent="primary"
254
+ themeSize="medium"
255
+ />
256
+ <Text
257
+ allowFontScaling={false}
258
+ numberOfLines={1}
259
+ style={
260
+ Array [
261
+ Object {
262
+ "color": "#401960",
263
+ "fontFamily": "BeVietnamPro-SemiBold",
264
+ "fontSize": 16,
265
+ "letterSpacing": 0.48,
266
+ "lineHeight": 24,
267
+ },
268
+ Array [
269
+ Object {
270
+ "marginLeft": 8,
271
+ },
272
+ undefined,
273
+ ],
274
+ ]
275
+ }
276
+ themeFontSize="large"
277
+ themeFontWeight="semi-bold"
278
+ themeIntent="primary"
279
+ themeTypeface="neutral"
280
+ >
281
+ Try again
282
+ </Text>
283
+ </View>
284
+ </View>
285
+ `;
286
+
287
+ exports[`ToolbarItems renders correctly when intent is primary, icon is ai-outlined, label is Try again and disabled is true 1`] = `
288
+ <View
289
+ accessibilityState={
290
+ Object {
291
+ "disabled": true,
292
+ }
293
+ }
294
+ accessible={true}
295
+ collapsable={false}
296
+ focusable={true}
297
+ onClick={[Function]}
298
+ onResponderGrant={[Function]}
299
+ onResponderMove={[Function]}
300
+ onResponderRelease={[Function]}
301
+ onResponderTerminate={[Function]}
302
+ onResponderTerminationRequest={[Function]}
303
+ onStartShouldSetResponder={[Function]}
304
+ style={
305
+ Object {
306
+ "alignItems": "center",
307
+ "flexDirection": "row",
308
+ "height": 64,
309
+ "opacity": 1,
310
+ "paddingHorizontal": 8,
311
+ "paddingVertical": 8,
312
+ }
313
+ }
314
+ >
315
+ <View
245
316
  style={
246
317
  Array [
247
318
  Object {
248
- "color": "#401960",
249
- "fontFamily": "BeVietnamPro-SemiBold",
250
- "fontSize": 12,
251
- "letterSpacing": 0.36,
252
- "lineHeight": 20,
319
+ "alignItems": "center",
320
+ "backgroundColor": "#ece8ef",
321
+ "borderRadius": 24,
322
+ "flexDirection": "row",
323
+ "justifyContent": "center",
324
+ "padding": 12,
253
325
  },
254
326
  undefined,
255
327
  ]
256
328
  }
257
- themeFontSize="small"
258
- themeFontWeight="semi-bold"
259
- themeIntent="primary"
260
- themeTypeface="neutral"
261
329
  >
262
- Action
263
- </Text>
330
+ <HeroIcon
331
+ name="ai-outlined"
332
+ style={
333
+ Array [
334
+ Object {
335
+ "color": "#bfc1c5",
336
+ "fontSize": 24,
337
+ },
338
+ undefined,
339
+ ]
340
+ }
341
+ testID="toolbar-item-icon-ai-outlined"
342
+ themeIntent="disabled-text"
343
+ themeSize="medium"
344
+ />
345
+ <Text
346
+ allowFontScaling={false}
347
+ numberOfLines={1}
348
+ style={
349
+ Array [
350
+ Object {
351
+ "color": "#4d6265",
352
+ "fontFamily": "BeVietnamPro-SemiBold",
353
+ "fontSize": 16,
354
+ "letterSpacing": 0.48,
355
+ "lineHeight": 24,
356
+ },
357
+ Array [
358
+ Object {
359
+ "marginLeft": 8,
360
+ },
361
+ undefined,
362
+ ],
363
+ ]
364
+ }
365
+ themeFontSize="large"
366
+ themeFontWeight="semi-bold"
367
+ themeIntent="subdued"
368
+ themeTypeface="neutral"
369
+ >
370
+ Try again
371
+ </Text>
372
+ </View>
264
373
  </View>
265
374
  `;
266
375
 
267
- exports[`ToolbarItems renders correctly when intent is success 1`] = `
376
+ exports[`ToolbarItems renders correctly when intent is primary, icon is ai-outlined, label is undefined and disabled is false 1`] = `
268
377
  <View
269
378
  accessibilityState={
270
379
  Object {
@@ -284,27 +393,76 @@ exports[`ToolbarItems renders correctly when intent is success 1`] = `
284
393
  style={
285
394
  Object {
286
395
  "alignItems": "center",
396
+ "flexDirection": "row",
397
+ "height": 64,
287
398
  "opacity": 1,
288
- "paddingHorizontal": 12,
399
+ "paddingHorizontal": 8,
289
400
  "paddingVertical": 8,
290
401
  }
291
402
  }
292
403
  >
293
- <HeroIcon
294
- name="home"
404
+ <View
295
405
  style={
296
406
  Array [
297
407
  Object {
298
- "color": "#5ace7d",
299
- "fontSize": 24,
408
+ "alignItems": "center",
409
+ "backgroundColor": "#ece8ef",
410
+ "borderRadius": 24,
411
+ "flexDirection": "row",
412
+ "justifyContent": "center",
413
+ "padding": 12,
300
414
  },
301
415
  undefined,
302
416
  ]
303
417
  }
304
- testID="toolbar-item-icon-home"
305
- themeIntent="success"
306
- themeSize="medium"
307
- />
418
+ >
419
+ <HeroIcon
420
+ name="ai-outlined"
421
+ style={
422
+ Array [
423
+ Object {
424
+ "color": "#401960",
425
+ "fontSize": 24,
426
+ },
427
+ undefined,
428
+ ]
429
+ }
430
+ testID="toolbar-item-icon-ai-outlined"
431
+ themeIntent="primary"
432
+ themeSize="medium"
433
+ />
434
+ </View>
435
+ </View>
436
+ `;
437
+
438
+ exports[`ToolbarItems renders correctly when intent is success, icon is undefined, label is Save and disabled is false 1`] = `
439
+ <View
440
+ accessibilityState={
441
+ Object {
442
+ "disabled": false,
443
+ }
444
+ }
445
+ accessible={true}
446
+ collapsable={false}
447
+ focusable={true}
448
+ onClick={[Function]}
449
+ onResponderGrant={[Function]}
450
+ onResponderMove={[Function]}
451
+ onResponderRelease={[Function]}
452
+ onResponderTerminate={[Function]}
453
+ onResponderTerminationRequest={[Function]}
454
+ onStartShouldSetResponder={[Function]}
455
+ style={
456
+ Object {
457
+ "alignItems": "center",
458
+ "flexDirection": "row",
459
+ "height": 64,
460
+ "opacity": 1,
461
+ "paddingHorizontal": 8,
462
+ "paddingVertical": 8,
463
+ }
464
+ }
465
+ >
308
466
  <Text
309
467
  allowFontScaling={false}
310
468
  numberOfLines={1}
@@ -313,24 +471,24 @@ exports[`ToolbarItems renders correctly when intent is success 1`] = `
313
471
  Object {
314
472
  "color": "#5ace7d",
315
473
  "fontFamily": "BeVietnamPro-SemiBold",
316
- "fontSize": 12,
317
- "letterSpacing": 0.36,
318
- "lineHeight": 20,
474
+ "fontSize": 16,
475
+ "letterSpacing": 0.48,
476
+ "lineHeight": 24,
319
477
  },
320
478
  undefined,
321
479
  ]
322
480
  }
323
- themeFontSize="small"
481
+ themeFontSize="large"
324
482
  themeFontWeight="semi-bold"
325
483
  themeIntent="success"
326
484
  themeTypeface="neutral"
327
485
  >
328
- Action
486
+ Save
329
487
  </Text>
330
488
  </View>
331
489
  `;
332
490
 
333
- exports[`ToolbarItems renders correctly when intent is warning 1`] = `
491
+ exports[`ToolbarItems renders correctly when intent is warning, icon is undefined, label is Warning and disabled is false 1`] = `
334
492
  <View
335
493
  accessibilityState={
336
494
  Object {
@@ -350,27 +508,14 @@ exports[`ToolbarItems renders correctly when intent is warning 1`] = `
350
508
  style={
351
509
  Object {
352
510
  "alignItems": "center",
511
+ "flexDirection": "row",
512
+ "height": 64,
353
513
  "opacity": 1,
354
- "paddingHorizontal": 12,
514
+ "paddingHorizontal": 8,
355
515
  "paddingVertical": 8,
356
516
  }
357
517
  }
358
518
  >
359
- <HeroIcon
360
- name="home"
361
- style={
362
- Array [
363
- Object {
364
- "color": "#ffbe71",
365
- "fontSize": 24,
366
- },
367
- undefined,
368
- ]
369
- }
370
- testID="toolbar-item-icon-home"
371
- themeIntent="warning"
372
- themeSize="medium"
373
- />
374
519
  <Text
375
520
  allowFontScaling={false}
376
521
  numberOfLines={1}
@@ -379,19 +524,19 @@ exports[`ToolbarItems renders correctly when intent is warning 1`] = `
379
524
  Object {
380
525
  "color": "#ffbe71",
381
526
  "fontFamily": "BeVietnamPro-SemiBold",
382
- "fontSize": 12,
383
- "letterSpacing": 0.36,
384
- "lineHeight": 20,
527
+ "fontSize": 16,
528
+ "letterSpacing": 0.48,
529
+ "lineHeight": 24,
385
530
  },
386
531
  undefined,
387
532
  ]
388
533
  }
389
- themeFontSize="small"
534
+ themeFontSize="large"
390
535
  themeFontWeight="semi-bold"
391
536
  themeIntent="warning"
392
537
  themeTypeface="neutral"
393
538
  >
394
- Action
539
+ Warning
395
540
  </Text>
396
541
  </View>
397
542
  `;
@@ -30,7 +30,8 @@ const StyledText = styled(Text)<{
30
30
  | 'warning'
31
31
  | 'danger'
32
32
  | 'inverted'
33
- | 'archived';
33
+ | 'archived'
34
+ | 'disabled';
34
35
  themeTypeface: 'neutral' | 'playful';
35
36
  }>(({ themeFontSize, themeFontWeight, themeIntent, themeTypeface, theme }) => {
36
37
  const sizeStyles = {
@@ -43,7 +43,8 @@ export interface TextProps extends NativeTextProps {
43
43
  | 'warning'
44
44
  | 'danger'
45
45
  | 'inverted'
46
- | 'archived';
46
+ | 'archived'
47
+ | 'disabled';
47
48
  /**
48
49
  * Additional style.
49
50
  */
@@ -1067,13 +1067,22 @@ Object {
1067
1067
  "danger": "#ffbe71",
1068
1068
  "disabled": "#bfc1c5",
1069
1069
  "error": "#f46363",
1070
+ "iconButtonBackground": "#ece8ef",
1070
1071
  "info": "#b5c3fd",
1071
1072
  "primary": "#401960",
1072
1073
  "secondary": "#795e90",
1073
1074
  "success": "#5ace7d",
1074
1075
  },
1076
+ "radii": Object {
1077
+ "iconButtonWrapperBorderRadius": 24,
1078
+ },
1079
+ "sizes": Object {
1080
+ "itemWrapperHeight": 64,
1081
+ },
1075
1082
  "space": Object {
1076
- "horizontalPadding": 12,
1083
+ "horizontalPadding": 8,
1084
+ "iconButtonLabelMarginLeft": 8,
1085
+ "iconButtonWrapperPadding": 12,
1077
1086
  "verticalPadding": 8,
1078
1087
  },
1079
1088
  },
@@ -1082,6 +1091,7 @@ Object {
1082
1091
  "archived": "#737479",
1083
1092
  "body": "#001f23",
1084
1093
  "danger": "#f46363",
1094
+ "disabled": "#bfc1c5",
1085
1095
  "info": "#4568fb",
1086
1096
  "inverted": "#ffffff",
1087
1097
  "primary": "#401960",
@@ -1,3 +1,4 @@
1
+ import { scale } from '../../utils/scale';
1
2
  import type { GlobalTheme } from '../global';
2
3
 
3
4
  const getToolbarTheme = (theme: GlobalTheme) => {
@@ -11,18 +12,29 @@ const getToolbarTheme = (theme: GlobalTheme) => {
11
12
  danger: theme.colors.warning,
12
13
  error: theme.colors.error,
13
14
  disabled: theme.colors.disabledOnDefaultGlobalSurface,
15
+ iconButtonBackground: theme.colors.highlightedSurface,
14
16
  };
15
17
 
16
18
  const space = {
17
19
  verticalPadding: theme.space.small,
18
- horizontalPadding: theme.space.smallMedium,
20
+ horizontalPadding: theme.space.small,
21
+ iconButtonLabelMarginLeft: theme.space.small,
22
+ iconButtonWrapperPadding: theme.space.smallMedium,
19
23
  };
20
24
 
21
25
  const borderWidths = {
22
26
  default: theme.borderWidths.base,
23
27
  };
24
28
 
25
- return { colors, space, borderWidths };
29
+ const sizes = {
30
+ itemWrapperHeight: scale(64),
31
+ };
32
+
33
+ const radii = {
34
+ iconButtonWrapperBorderRadius: theme.radii.xxxlarge,
35
+ };
36
+
37
+ return { colors, space, borderWidths, sizes, radii };
26
38
  };
27
39
 
28
40
  export default getToolbarTheme;
@@ -12,6 +12,7 @@ const getTypographyTheme = (theme: GlobalTheme) => {
12
12
  success: theme.colors.success,
13
13
  inverted: theme.colors.onDarkGlobalSurface,
14
14
  archived: theme.colors.onArchivedSurface,
15
+ disabled: theme.colors.disabledOnDefaultGlobalSurface,
15
16
  };
16
17
 
17
18
  const fontSizes = {