@hero-design/rn 8.85.0 → 8.86.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 (25) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/CHANGELOG.md +6 -0
  3. package/es/index.js +108 -27
  4. package/lib/index.js +108 -27
  5. package/package.json +1 -1
  6. package/src/components/Button/Button.tsx +22 -6
  7. package/src/components/Button/LoadingIndicator/StyledLoadingIndicator.tsx +8 -2
  8. package/src/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.tsx +3 -0
  9. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +139 -1
  10. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +408 -3
  11. package/src/components/Button/LoadingIndicator/__tests__/index.spec.tsx +3 -0
  12. package/src/components/Button/LoadingIndicator/index.tsx +4 -1
  13. package/src/components/Button/StyledButton.tsx +95 -5
  14. package/src/components/Button/__tests__/Button.spec.tsx +12 -0
  15. package/src/components/Button/__tests__/StyledButton.spec.tsx +10 -0
  16. package/src/components/Button/__tests__/__snapshots__/Button.spec.tsx.snap +1240 -90
  17. package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +630 -40
  18. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +5 -0
  19. package/src/theme/components/button.ts +5 -0
  20. package/stats/8.86.0/rn-stats.html +4842 -0
  21. package/types/components/Button/Button.d.ts +1 -1
  22. package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +1 -1
  23. package/types/components/Button/LoadingIndicator/index.d.ts +1 -1
  24. package/types/components/Button/StyledButton.d.ts +3 -3
  25. package/types/theme/components/button.d.ts +5 -0
@@ -34,7 +34,7 @@ export interface ButtonProps {
34
34
  /**
35
35
  * Visual intent color to apply to button. It is required for `filled`, `outlined` and `text` variants.
36
36
  */
37
- intent?: 'primary' | 'secondary' | 'danger';
37
+ intent?: 'primary' | 'secondary' | 'danger' | 'white';
38
38
  /**
39
39
  * Loading state of button.
40
40
  */
@@ -79,18 +79,21 @@ const FILLED_VARIANTS = {
79
79
  primary: 'filled-primary',
80
80
  secondary: 'filled-secondary',
81
81
  danger: 'filled-danger',
82
+ white: 'filled-white',
82
83
  } as const;
83
84
 
84
85
  const OUTLINED_VARIANTS = {
85
86
  primary: 'outlined-primary',
86
87
  secondary: 'outlined-secondary',
87
88
  danger: 'outlined-danger',
89
+ white: 'outlined-white',
88
90
  } as const;
89
91
 
90
92
  const TEXT_VARIANTS = {
91
93
  primary: 'text-primary',
92
94
  secondary: 'text-secondary',
93
95
  danger: 'text-danger',
96
+ white: 'text-white',
94
97
  } as const;
95
98
 
96
99
  export const getThemeVariant = (
@@ -121,18 +124,24 @@ const getUnderlayColor = (theme: Theme, themeVariant: ThemeVariant) => {
121
124
  return theme.__hd__.button.colors.pressedBackground.filledSecondary;
122
125
  case 'filled-danger':
123
126
  return theme.__hd__.button.colors.pressedBackground.filledDanger;
127
+ case 'filled-white':
128
+ return theme.__hd__.button.colors.pressedBackground.filledWhite;
124
129
  case 'outlined-primary':
125
130
  return theme.__hd__.button.colors.pressedBackground.outlinedPrimary;
126
131
  case 'outlined-secondary':
127
132
  return theme.__hd__.button.colors.pressedBackground.outlinedSecondary;
128
133
  case 'outlined-danger':
129
134
  return theme.__hd__.button.colors.pressedBackground.outlineDanger;
135
+ case 'outlined-white':
136
+ return theme.__hd__.button.colors.pressedBackground.outlineWhite;
130
137
  case 'text-primary':
131
138
  return theme.__hd__.button.colors.pressedBackground.textPrimary;
132
139
  case 'text-secondary':
133
140
  return theme.__hd__.button.colors.pressedBackground.textSecondary;
134
141
  case 'text-danger':
135
142
  return theme.__hd__.button.colors.pressedBackground.textDanger;
143
+ case 'text-white':
144
+ return theme.__hd__.button.colors.pressedBackground.textWhite;
136
145
  }
137
146
  };
138
147
 
@@ -145,10 +154,17 @@ const deprecatedVariants: ThemeVariant[] = [
145
154
 
146
155
  function isTextVariant(
147
156
  themeVariant: ThemeVariant
148
- ): themeVariant is 'text-primary' | 'text-secondary' | 'text-danger' {
149
- return ['text-primary', 'text-secondary', 'text-danger'].includes(
150
- themeVariant
151
- );
157
+ ): themeVariant is
158
+ | 'text-primary'
159
+ | 'text-secondary'
160
+ | 'text-danger'
161
+ | 'text-white' {
162
+ return [
163
+ 'text-primary',
164
+ 'text-secondary',
165
+ 'text-danger',
166
+ 'text-white',
167
+ ].includes(themeVariant);
152
168
  }
153
169
 
154
170
  const Button = ({
@@ -203,7 +219,7 @@ const Button = ({
203
219
  const renderTitle = () =>
204
220
  isCompactVariant ? (
205
221
  <StyledSmallButtonText
206
- variant="small"
222
+ variant="small-bold"
207
223
  ellipsizeMode="tail"
208
224
  numberOfLines={1}
209
225
  disabled={disabled}
@@ -11,12 +11,15 @@ type ThemeVariant =
11
11
  | 'filled-primary'
12
12
  | 'filled-secondary'
13
13
  | 'filled-danger'
14
+ | 'filled-white'
14
15
  | 'outlined-primary'
15
16
  | 'outlined-secondary'
16
17
  | 'outlined-danger'
18
+ | 'outlined-white'
17
19
  | 'text-primary'
18
20
  | 'text-secondary'
19
- | 'text-danger';
21
+ | 'text-danger'
22
+ | 'text-white';
20
23
 
21
24
  const genLoadingIndicatorStyles = (
22
25
  theme: Theme,
@@ -41,15 +44,18 @@ const StyledLoadingDot = styled(View)<{
41
44
  case 'filled-primary':
42
45
  case 'filled-secondary':
43
46
  case 'filled-danger':
47
+ case 'outlined-white':
48
+ case 'text-white':
44
49
  return {
45
50
  backgroundColor: theme.__hd__.button.colors.invertedText,
46
51
  };
52
+ case 'filled-white':
47
53
  case 'outlined-primary':
48
54
  return genLoadingIndicatorStyles(theme, 'primary');
49
55
  case 'text-primary':
50
56
  case 'outlined-secondary':
51
- case 'text-secondary':
52
57
  return genLoadingIndicatorStyles(theme, 'secondary');
58
+ case 'text-secondary':
53
59
  case 'outlined-danger':
54
60
  case 'text-danger':
55
61
  return genLoadingIndicatorStyles(theme, 'danger');
@@ -10,12 +10,15 @@ describe('StyledLoadingIndicator', () => {
10
10
  ${'filled-primary'}
11
11
  ${'filled-secondary'}
12
12
  ${'filled-danger'}
13
+ ${'filled-white'}
13
14
  ${'outlined-primary'}
14
15
  ${'outlined-secondary'}
15
16
  ${'outlined-danger'}
17
+ ${'outlined-white'}
16
18
  ${'text-primary'}
17
19
  ${'text-secondary'}
18
20
  ${'text-danger'}
21
+ ${'text-white'}
19
22
  `('has $themeVariant style', ({ themeVariant }) => {
20
23
  const { toJSON } = renderWithTheme(
21
24
  <StyledLoadingDot themeVariant={themeVariant} />
@@ -184,6 +184,52 @@ exports[`StyledLoadingIndicator has filled-secondary style 1`] = `
184
184
  </View>
185
185
  `;
186
186
 
187
+ exports[`StyledLoadingIndicator has filled-white style 1`] = `
188
+ <View
189
+ style={
190
+ {
191
+ "flex": 1,
192
+ }
193
+ }
194
+ >
195
+ <View
196
+ style={
197
+ [
198
+ {
199
+ "backgroundColor": "#401960",
200
+ "borderRadius": 8,
201
+ "height": 12,
202
+ "marginHorizontal": 8,
203
+ "width": 12,
204
+ },
205
+ undefined,
206
+ ]
207
+ }
208
+ themeVariant="filled-white"
209
+ />
210
+ <View
211
+ pointerEvents="box-none"
212
+ position="bottom"
213
+ style={
214
+ [
215
+ {
216
+ "bottom": 0,
217
+ "elevation": 9999,
218
+ "flexDirection": "column-reverse",
219
+ "left": 0,
220
+ "paddingHorizontal": 24,
221
+ "paddingVertical": 16,
222
+ "position": "absolute",
223
+ "right": 0,
224
+ "top": 0,
225
+ },
226
+ undefined,
227
+ ]
228
+ }
229
+ />
230
+ </View>
231
+ `;
232
+
187
233
  exports[`StyledLoadingIndicator has outlined-danger style 1`] = `
188
234
  <View
189
235
  style={
@@ -322,6 +368,52 @@ exports[`StyledLoadingIndicator has outlined-secondary style 1`] = `
322
368
  </View>
323
369
  `;
324
370
 
371
+ exports[`StyledLoadingIndicator has outlined-white style 1`] = `
372
+ <View
373
+ style={
374
+ {
375
+ "flex": 1,
376
+ }
377
+ }
378
+ >
379
+ <View
380
+ style={
381
+ [
382
+ {
383
+ "backgroundColor": "#ffffff",
384
+ "borderRadius": 8,
385
+ "height": 12,
386
+ "marginHorizontal": 8,
387
+ "width": 12,
388
+ },
389
+ undefined,
390
+ ]
391
+ }
392
+ themeVariant="outlined-white"
393
+ />
394
+ <View
395
+ pointerEvents="box-none"
396
+ position="bottom"
397
+ style={
398
+ [
399
+ {
400
+ "bottom": 0,
401
+ "elevation": 9999,
402
+ "flexDirection": "column-reverse",
403
+ "left": 0,
404
+ "paddingHorizontal": 24,
405
+ "paddingVertical": 16,
406
+ "position": "absolute",
407
+ "right": 0,
408
+ "top": 0,
409
+ },
410
+ undefined,
411
+ ]
412
+ }
413
+ />
414
+ </View>
415
+ `;
416
+
325
417
  exports[`StyledLoadingIndicator has text-danger style 1`] = `
326
418
  <View
327
419
  style={
@@ -426,7 +518,7 @@ exports[`StyledLoadingIndicator has text-secondary style 1`] = `
426
518
  style={
427
519
  [
428
520
  {
429
- "backgroundColor": "#4d6265",
521
+ "backgroundColor": "#cb300a",
430
522
  "borderRadius": 8,
431
523
  "height": 12,
432
524
  "marginHorizontal": 8,
@@ -459,3 +551,49 @@ exports[`StyledLoadingIndicator has text-secondary style 1`] = `
459
551
  />
460
552
  </View>
461
553
  `;
554
+
555
+ exports[`StyledLoadingIndicator has text-white style 1`] = `
556
+ <View
557
+ style={
558
+ {
559
+ "flex": 1,
560
+ }
561
+ }
562
+ >
563
+ <View
564
+ style={
565
+ [
566
+ {
567
+ "backgroundColor": "#ffffff",
568
+ "borderRadius": 8,
569
+ "height": 12,
570
+ "marginHorizontal": 8,
571
+ "width": 12,
572
+ },
573
+ undefined,
574
+ ]
575
+ }
576
+ themeVariant="text-white"
577
+ />
578
+ <View
579
+ pointerEvents="box-none"
580
+ position="bottom"
581
+ style={
582
+ [
583
+ {
584
+ "bottom": 0,
585
+ "elevation": 9999,
586
+ "flexDirection": "column-reverse",
587
+ "left": 0,
588
+ "paddingHorizontal": 24,
589
+ "paddingVertical": 16,
590
+ "position": "absolute",
591
+ "right": 0,
592
+ "top": 0,
593
+ },
594
+ undefined,
595
+ ]
596
+ }
597
+ />
598
+ </View>
599
+ `;