@hero-design/rn 8.84.3 → 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 (30) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/CHANGELOG.md +12 -0
  3. package/es/index.js +112 -27
  4. package/lib/index.js +112 -27
  5. package/package.json +1 -1
  6. package/src/components/Box/__tests__/__snapshots__/index.spec.tsx.snap +8 -0
  7. package/src/components/Box/__tests__/index.spec.tsx +1 -0
  8. package/src/components/Box/config.ts +4 -0
  9. package/src/components/Button/Button.tsx +22 -6
  10. package/src/components/Button/LoadingIndicator/StyledLoadingIndicator.tsx +8 -2
  11. package/src/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.tsx +3 -0
  12. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +139 -1
  13. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +408 -3
  14. package/src/components/Button/LoadingIndicator/__tests__/index.spec.tsx +3 -0
  15. package/src/components/Button/LoadingIndicator/index.tsx +4 -1
  16. package/src/components/Button/StyledButton.tsx +95 -5
  17. package/src/components/Button/__tests__/Button.spec.tsx +12 -0
  18. package/src/components/Button/__tests__/StyledButton.spec.tsx +10 -0
  19. package/src/components/Button/__tests__/__snapshots__/Button.spec.tsx.snap +1240 -90
  20. package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +630 -40
  21. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +5 -0
  22. package/src/theme/components/button.ts +5 -0
  23. package/stats/8.85.0/rn-stats.html +4842 -0
  24. package/stats/8.86.0/rn-stats.html +4842 -0
  25. package/types/components/Box/config.d.ts +4 -0
  26. package/types/components/Button/Button.d.ts +1 -1
  27. package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +1 -1
  28. package/types/components/Button/LoadingIndicator/index.d.ts +1 -1
  29. package/types/components/Button/StyledButton.d.ts +3 -3
  30. package/types/theme/components/button.d.ts +5 -0
@@ -567,6 +567,7 @@ exports[`Box map prop to valid property and correct space from theme 1`] = `
567
567
  }
568
568
  >
569
569
  <View
570
+ gap="large"
570
571
  margin="large"
571
572
  marginBottom="large"
572
573
  marginEnd="large"
@@ -588,6 +589,7 @@ exports[`Box map prop to valid property and correct space from theme 1`] = `
588
589
  style={
589
590
  [
590
591
  {
592
+ "gap": 24,
591
593
  "margin": 24,
592
594
  "marginBottom": 24,
593
595
  "marginEnd": 24,
@@ -643,6 +645,7 @@ exports[`Box map prop to valid property and correct space from theme 2`] = `
643
645
  }
644
646
  >
645
647
  <View
648
+ gap="medium"
646
649
  margin="medium"
647
650
  marginBottom="medium"
648
651
  marginEnd="medium"
@@ -664,6 +667,7 @@ exports[`Box map prop to valid property and correct space from theme 2`] = `
664
667
  style={
665
668
  [
666
669
  {
670
+ "gap": 16,
667
671
  "margin": 16,
668
672
  "marginBottom": 16,
669
673
  "marginEnd": 16,
@@ -719,6 +723,7 @@ exports[`Box map prop to valid property and correct space from theme 3`] = `
719
723
  }
720
724
  >
721
725
  <View
726
+ gap="small"
722
727
  margin="small"
723
728
  marginBottom="small"
724
729
  marginEnd="small"
@@ -740,6 +745,7 @@ exports[`Box map prop to valid property and correct space from theme 3`] = `
740
745
  style={
741
746
  [
742
747
  {
748
+ "gap": 8,
743
749
  "margin": 8,
744
750
  "marginBottom": 8,
745
751
  "marginEnd": 8,
@@ -795,6 +801,7 @@ exports[`Box map prop to valid property and correct space from theme 4`] = `
795
801
  }
796
802
  >
797
803
  <View
804
+ gap="xlarge"
798
805
  margin="xlarge"
799
806
  marginBottom="xlarge"
800
807
  marginEnd="xlarge"
@@ -816,6 +823,7 @@ exports[`Box map prop to valid property and correct space from theme 4`] = `
816
823
  style={
817
824
  [
818
825
  {
826
+ "gap": 32,
819
827
  "margin": 32,
820
828
  "marginBottom": 32,
821
829
  "marginEnd": 32,
@@ -81,6 +81,7 @@ describe('Box', () => {
81
81
  paddingStart={space}
82
82
  paddingTop={space}
83
83
  paddingVertical={space}
84
+ gap={space}
84
85
  />
85
86
  );
86
87
 
@@ -110,6 +110,10 @@ const space = {
110
110
  property: 'paddingVertical',
111
111
  scale: 'space',
112
112
  },
113
+ gap: {
114
+ property: 'gap',
115
+ scale: 'space',
116
+ },
113
117
  } as const;
114
118
 
115
119
  const radii = {
@@ -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
+ `;