@hero-design/rn 8.85.0 → 8.87.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.
- package/.turbo/turbo-build.log +8 -2
- package/CHANGELOG.md +18 -0
- package/es/index.js +10763 -8758
- package/lib/index.js +10763 -8758
- package/package.json +2 -2
- package/src/components/Button/Button.tsx +22 -6
- package/src/components/Button/LoadingIndicator/StyledLoadingIndicator.tsx +8 -2
- package/src/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.tsx +3 -0
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +139 -1
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +408 -3
- package/src/components/Button/LoadingIndicator/__tests__/index.spec.tsx +3 -0
- package/src/components/Button/LoadingIndicator/index.tsx +4 -1
- package/src/components/Button/StyledButton.tsx +95 -5
- package/src/components/Button/__tests__/Button.spec.tsx +12 -0
- package/src/components/Button/__tests__/StyledButton.spec.tsx +10 -0
- package/src/components/Button/__tests__/__snapshots__/Button.spec.tsx.snap +1240 -90
- package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +630 -40
- package/src/components/Carousel/CardCarousel.tsx +7 -2
- package/src/components/Carousel/StyledCardCarousel.tsx +6 -2
- package/src/components/Carousel/__tests__/CardCarousel.spec.tsx +28 -1
- package/src/components/Carousel/__tests__/StyledCardCarousel.spec.tsx +7 -2
- package/src/components/Carousel/__tests__/__snapshots__/CardCarousel.spec.tsx.snap +1799 -1
- package/src/components/Carousel/__tests__/__snapshots__/StyledCardCarousel.spec.tsx.snap +86 -1
- package/src/components/RichTextEditor/RichTextEditor.tsx +30 -1
- package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +59 -0
- package/src/components/RichTextEditor/types.ts +2 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +10 -1
- package/src/theme/components/button.ts +5 -0
- package/src/theme/components/cardCarousel.ts +5 -1
- package/stats/8.86.0/rn-stats.html +4842 -0
- package/stats/8.87.0/rn-stats.html +4844 -0
- package/stats/8.87.1/rn-stats.html +4842 -0
- package/types/components/Button/Button.d.ts +1 -1
- package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +1 -1
- package/types/components/Button/LoadingIndicator/index.d.ts +1 -1
- package/types/components/Button/StyledButton.d.ts +3 -3
- package/types/components/Carousel/CardCarousel.d.ts +4 -0
- package/types/components/Carousel/StyledCardCarousel.d.ts +2 -0
- package/types/components/RichTextEditor/RichTextEditor.d.ts +4 -0
- package/types/components/RichTextEditor/types.d.ts +1 -0
- package/types/theme/components/button.d.ts +5 -0
- package/types/theme/components/cardCarousel.d.ts +5 -1
|
@@ -540,6 +540,141 @@ exports[`LoadingIndicator renders correctly when themeVariant is filled-secondar
|
|
|
540
540
|
</View>
|
|
541
541
|
`;
|
|
542
542
|
|
|
543
|
+
exports[`LoadingIndicator renders correctly when themeVariant is filled-white 1`] = `
|
|
544
|
+
<View
|
|
545
|
+
style={
|
|
546
|
+
{
|
|
547
|
+
"flex": 1,
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
>
|
|
551
|
+
<View
|
|
552
|
+
collapsable={false}
|
|
553
|
+
style={
|
|
554
|
+
[
|
|
555
|
+
{
|
|
556
|
+
"alignItems": "center",
|
|
557
|
+
"flexDirection": "row",
|
|
558
|
+
"justifyContent": "center",
|
|
559
|
+
},
|
|
560
|
+
{},
|
|
561
|
+
]
|
|
562
|
+
}
|
|
563
|
+
>
|
|
564
|
+
<View
|
|
565
|
+
collapsable={false}
|
|
566
|
+
style={
|
|
567
|
+
{
|
|
568
|
+
"transform": [
|
|
569
|
+
{
|
|
570
|
+
"scale": 1,
|
|
571
|
+
},
|
|
572
|
+
],
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
>
|
|
576
|
+
<View
|
|
577
|
+
collapsable={false}
|
|
578
|
+
size={12}
|
|
579
|
+
style={
|
|
580
|
+
[
|
|
581
|
+
{
|
|
582
|
+
"backgroundColor": "#401960",
|
|
583
|
+
"borderRadius": 8,
|
|
584
|
+
"height": 12,
|
|
585
|
+
"marginHorizontal": 8,
|
|
586
|
+
"width": 12,
|
|
587
|
+
},
|
|
588
|
+
{},
|
|
589
|
+
]
|
|
590
|
+
}
|
|
591
|
+
themeVariant="filled-white"
|
|
592
|
+
/>
|
|
593
|
+
</View>
|
|
594
|
+
<View
|
|
595
|
+
collapsable={false}
|
|
596
|
+
style={
|
|
597
|
+
{
|
|
598
|
+
"transform": [
|
|
599
|
+
{
|
|
600
|
+
"scale": 1,
|
|
601
|
+
},
|
|
602
|
+
],
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
>
|
|
606
|
+
<View
|
|
607
|
+
collapsable={false}
|
|
608
|
+
size={12}
|
|
609
|
+
style={
|
|
610
|
+
[
|
|
611
|
+
{
|
|
612
|
+
"backgroundColor": "#401960",
|
|
613
|
+
"borderRadius": 8,
|
|
614
|
+
"height": 12,
|
|
615
|
+
"marginHorizontal": 8,
|
|
616
|
+
"width": 12,
|
|
617
|
+
},
|
|
618
|
+
{},
|
|
619
|
+
]
|
|
620
|
+
}
|
|
621
|
+
themeVariant="filled-white"
|
|
622
|
+
/>
|
|
623
|
+
</View>
|
|
624
|
+
<View
|
|
625
|
+
collapsable={false}
|
|
626
|
+
style={
|
|
627
|
+
{
|
|
628
|
+
"transform": [
|
|
629
|
+
{
|
|
630
|
+
"scale": 1,
|
|
631
|
+
},
|
|
632
|
+
],
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
>
|
|
636
|
+
<View
|
|
637
|
+
collapsable={false}
|
|
638
|
+
size={12}
|
|
639
|
+
style={
|
|
640
|
+
[
|
|
641
|
+
{
|
|
642
|
+
"backgroundColor": "#401960",
|
|
643
|
+
"borderRadius": 8,
|
|
644
|
+
"height": 12,
|
|
645
|
+
"marginHorizontal": 8,
|
|
646
|
+
"width": 12,
|
|
647
|
+
},
|
|
648
|
+
{},
|
|
649
|
+
]
|
|
650
|
+
}
|
|
651
|
+
themeVariant="filled-white"
|
|
652
|
+
/>
|
|
653
|
+
</View>
|
|
654
|
+
</View>
|
|
655
|
+
<View
|
|
656
|
+
pointerEvents="box-none"
|
|
657
|
+
position="bottom"
|
|
658
|
+
style={
|
|
659
|
+
[
|
|
660
|
+
{
|
|
661
|
+
"bottom": 0,
|
|
662
|
+
"elevation": 9999,
|
|
663
|
+
"flexDirection": "column-reverse",
|
|
664
|
+
"left": 0,
|
|
665
|
+
"paddingHorizontal": 24,
|
|
666
|
+
"paddingVertical": 16,
|
|
667
|
+
"position": "absolute",
|
|
668
|
+
"right": 0,
|
|
669
|
+
"top": 0,
|
|
670
|
+
},
|
|
671
|
+
undefined,
|
|
672
|
+
]
|
|
673
|
+
}
|
|
674
|
+
/>
|
|
675
|
+
</View>
|
|
676
|
+
`;
|
|
677
|
+
|
|
543
678
|
exports[`LoadingIndicator renders correctly when themeVariant is outlined-danger 1`] = `
|
|
544
679
|
<View
|
|
545
680
|
style={
|
|
@@ -945,6 +1080,141 @@ exports[`LoadingIndicator renders correctly when themeVariant is outlined-second
|
|
|
945
1080
|
</View>
|
|
946
1081
|
`;
|
|
947
1082
|
|
|
1083
|
+
exports[`LoadingIndicator renders correctly when themeVariant is outlined-white 1`] = `
|
|
1084
|
+
<View
|
|
1085
|
+
style={
|
|
1086
|
+
{
|
|
1087
|
+
"flex": 1,
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
>
|
|
1091
|
+
<View
|
|
1092
|
+
collapsable={false}
|
|
1093
|
+
style={
|
|
1094
|
+
[
|
|
1095
|
+
{
|
|
1096
|
+
"alignItems": "center",
|
|
1097
|
+
"flexDirection": "row",
|
|
1098
|
+
"justifyContent": "center",
|
|
1099
|
+
},
|
|
1100
|
+
{},
|
|
1101
|
+
]
|
|
1102
|
+
}
|
|
1103
|
+
>
|
|
1104
|
+
<View
|
|
1105
|
+
collapsable={false}
|
|
1106
|
+
style={
|
|
1107
|
+
{
|
|
1108
|
+
"transform": [
|
|
1109
|
+
{
|
|
1110
|
+
"scale": 1,
|
|
1111
|
+
},
|
|
1112
|
+
],
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
>
|
|
1116
|
+
<View
|
|
1117
|
+
collapsable={false}
|
|
1118
|
+
size={12}
|
|
1119
|
+
style={
|
|
1120
|
+
[
|
|
1121
|
+
{
|
|
1122
|
+
"backgroundColor": "#ffffff",
|
|
1123
|
+
"borderRadius": 8,
|
|
1124
|
+
"height": 12,
|
|
1125
|
+
"marginHorizontal": 8,
|
|
1126
|
+
"width": 12,
|
|
1127
|
+
},
|
|
1128
|
+
{},
|
|
1129
|
+
]
|
|
1130
|
+
}
|
|
1131
|
+
themeVariant="outlined-white"
|
|
1132
|
+
/>
|
|
1133
|
+
</View>
|
|
1134
|
+
<View
|
|
1135
|
+
collapsable={false}
|
|
1136
|
+
style={
|
|
1137
|
+
{
|
|
1138
|
+
"transform": [
|
|
1139
|
+
{
|
|
1140
|
+
"scale": 1,
|
|
1141
|
+
},
|
|
1142
|
+
],
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
>
|
|
1146
|
+
<View
|
|
1147
|
+
collapsable={false}
|
|
1148
|
+
size={12}
|
|
1149
|
+
style={
|
|
1150
|
+
[
|
|
1151
|
+
{
|
|
1152
|
+
"backgroundColor": "#ffffff",
|
|
1153
|
+
"borderRadius": 8,
|
|
1154
|
+
"height": 12,
|
|
1155
|
+
"marginHorizontal": 8,
|
|
1156
|
+
"width": 12,
|
|
1157
|
+
},
|
|
1158
|
+
{},
|
|
1159
|
+
]
|
|
1160
|
+
}
|
|
1161
|
+
themeVariant="outlined-white"
|
|
1162
|
+
/>
|
|
1163
|
+
</View>
|
|
1164
|
+
<View
|
|
1165
|
+
collapsable={false}
|
|
1166
|
+
style={
|
|
1167
|
+
{
|
|
1168
|
+
"transform": [
|
|
1169
|
+
{
|
|
1170
|
+
"scale": 1,
|
|
1171
|
+
},
|
|
1172
|
+
],
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
>
|
|
1176
|
+
<View
|
|
1177
|
+
collapsable={false}
|
|
1178
|
+
size={12}
|
|
1179
|
+
style={
|
|
1180
|
+
[
|
|
1181
|
+
{
|
|
1182
|
+
"backgroundColor": "#ffffff",
|
|
1183
|
+
"borderRadius": 8,
|
|
1184
|
+
"height": 12,
|
|
1185
|
+
"marginHorizontal": 8,
|
|
1186
|
+
"width": 12,
|
|
1187
|
+
},
|
|
1188
|
+
{},
|
|
1189
|
+
]
|
|
1190
|
+
}
|
|
1191
|
+
themeVariant="outlined-white"
|
|
1192
|
+
/>
|
|
1193
|
+
</View>
|
|
1194
|
+
</View>
|
|
1195
|
+
<View
|
|
1196
|
+
pointerEvents="box-none"
|
|
1197
|
+
position="bottom"
|
|
1198
|
+
style={
|
|
1199
|
+
[
|
|
1200
|
+
{
|
|
1201
|
+
"bottom": 0,
|
|
1202
|
+
"elevation": 9999,
|
|
1203
|
+
"flexDirection": "column-reverse",
|
|
1204
|
+
"left": 0,
|
|
1205
|
+
"paddingHorizontal": 24,
|
|
1206
|
+
"paddingVertical": 16,
|
|
1207
|
+
"position": "absolute",
|
|
1208
|
+
"right": 0,
|
|
1209
|
+
"top": 0,
|
|
1210
|
+
},
|
|
1211
|
+
undefined,
|
|
1212
|
+
]
|
|
1213
|
+
}
|
|
1214
|
+
/>
|
|
1215
|
+
</View>
|
|
1216
|
+
`;
|
|
1217
|
+
|
|
948
1218
|
exports[`LoadingIndicator renders correctly when themeVariant is text-danger 1`] = `
|
|
949
1219
|
<View
|
|
950
1220
|
style={
|
|
@@ -1254,7 +1524,7 @@ exports[`LoadingIndicator renders correctly when themeVariant is text-secondary
|
|
|
1254
1524
|
style={
|
|
1255
1525
|
[
|
|
1256
1526
|
{
|
|
1257
|
-
"backgroundColor": "#
|
|
1527
|
+
"backgroundColor": "#cb300a",
|
|
1258
1528
|
"borderRadius": 8,
|
|
1259
1529
|
"height": 12,
|
|
1260
1530
|
"marginHorizontal": 8,
|
|
@@ -1284,7 +1554,7 @@ exports[`LoadingIndicator renders correctly when themeVariant is text-secondary
|
|
|
1284
1554
|
style={
|
|
1285
1555
|
[
|
|
1286
1556
|
{
|
|
1287
|
-
"backgroundColor": "#
|
|
1557
|
+
"backgroundColor": "#cb300a",
|
|
1288
1558
|
"borderRadius": 8,
|
|
1289
1559
|
"height": 12,
|
|
1290
1560
|
"marginHorizontal": 8,
|
|
@@ -1314,7 +1584,7 @@ exports[`LoadingIndicator renders correctly when themeVariant is text-secondary
|
|
|
1314
1584
|
style={
|
|
1315
1585
|
[
|
|
1316
1586
|
{
|
|
1317
|
-
"backgroundColor": "#
|
|
1587
|
+
"backgroundColor": "#cb300a",
|
|
1318
1588
|
"borderRadius": 8,
|
|
1319
1589
|
"height": 12,
|
|
1320
1590
|
"marginHorizontal": 8,
|
|
@@ -1349,3 +1619,138 @@ exports[`LoadingIndicator renders correctly when themeVariant is text-secondary
|
|
|
1349
1619
|
/>
|
|
1350
1620
|
</View>
|
|
1351
1621
|
`;
|
|
1622
|
+
|
|
1623
|
+
exports[`LoadingIndicator renders correctly when themeVariant is text-white 1`] = `
|
|
1624
|
+
<View
|
|
1625
|
+
style={
|
|
1626
|
+
{
|
|
1627
|
+
"flex": 1,
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
>
|
|
1631
|
+
<View
|
|
1632
|
+
collapsable={false}
|
|
1633
|
+
style={
|
|
1634
|
+
[
|
|
1635
|
+
{
|
|
1636
|
+
"alignItems": "center",
|
|
1637
|
+
"flexDirection": "row",
|
|
1638
|
+
"justifyContent": "center",
|
|
1639
|
+
},
|
|
1640
|
+
{},
|
|
1641
|
+
]
|
|
1642
|
+
}
|
|
1643
|
+
>
|
|
1644
|
+
<View
|
|
1645
|
+
collapsable={false}
|
|
1646
|
+
style={
|
|
1647
|
+
{
|
|
1648
|
+
"transform": [
|
|
1649
|
+
{
|
|
1650
|
+
"scale": 1,
|
|
1651
|
+
},
|
|
1652
|
+
],
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
>
|
|
1656
|
+
<View
|
|
1657
|
+
collapsable={false}
|
|
1658
|
+
size={12}
|
|
1659
|
+
style={
|
|
1660
|
+
[
|
|
1661
|
+
{
|
|
1662
|
+
"backgroundColor": "#ffffff",
|
|
1663
|
+
"borderRadius": 8,
|
|
1664
|
+
"height": 12,
|
|
1665
|
+
"marginHorizontal": 8,
|
|
1666
|
+
"width": 12,
|
|
1667
|
+
},
|
|
1668
|
+
{},
|
|
1669
|
+
]
|
|
1670
|
+
}
|
|
1671
|
+
themeVariant="text-white"
|
|
1672
|
+
/>
|
|
1673
|
+
</View>
|
|
1674
|
+
<View
|
|
1675
|
+
collapsable={false}
|
|
1676
|
+
style={
|
|
1677
|
+
{
|
|
1678
|
+
"transform": [
|
|
1679
|
+
{
|
|
1680
|
+
"scale": 1,
|
|
1681
|
+
},
|
|
1682
|
+
],
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
>
|
|
1686
|
+
<View
|
|
1687
|
+
collapsable={false}
|
|
1688
|
+
size={12}
|
|
1689
|
+
style={
|
|
1690
|
+
[
|
|
1691
|
+
{
|
|
1692
|
+
"backgroundColor": "#ffffff",
|
|
1693
|
+
"borderRadius": 8,
|
|
1694
|
+
"height": 12,
|
|
1695
|
+
"marginHorizontal": 8,
|
|
1696
|
+
"width": 12,
|
|
1697
|
+
},
|
|
1698
|
+
{},
|
|
1699
|
+
]
|
|
1700
|
+
}
|
|
1701
|
+
themeVariant="text-white"
|
|
1702
|
+
/>
|
|
1703
|
+
</View>
|
|
1704
|
+
<View
|
|
1705
|
+
collapsable={false}
|
|
1706
|
+
style={
|
|
1707
|
+
{
|
|
1708
|
+
"transform": [
|
|
1709
|
+
{
|
|
1710
|
+
"scale": 1,
|
|
1711
|
+
},
|
|
1712
|
+
],
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
>
|
|
1716
|
+
<View
|
|
1717
|
+
collapsable={false}
|
|
1718
|
+
size={12}
|
|
1719
|
+
style={
|
|
1720
|
+
[
|
|
1721
|
+
{
|
|
1722
|
+
"backgroundColor": "#ffffff",
|
|
1723
|
+
"borderRadius": 8,
|
|
1724
|
+
"height": 12,
|
|
1725
|
+
"marginHorizontal": 8,
|
|
1726
|
+
"width": 12,
|
|
1727
|
+
},
|
|
1728
|
+
{},
|
|
1729
|
+
]
|
|
1730
|
+
}
|
|
1731
|
+
themeVariant="text-white"
|
|
1732
|
+
/>
|
|
1733
|
+
</View>
|
|
1734
|
+
</View>
|
|
1735
|
+
<View
|
|
1736
|
+
pointerEvents="box-none"
|
|
1737
|
+
position="bottom"
|
|
1738
|
+
style={
|
|
1739
|
+
[
|
|
1740
|
+
{
|
|
1741
|
+
"bottom": 0,
|
|
1742
|
+
"elevation": 9999,
|
|
1743
|
+
"flexDirection": "column-reverse",
|
|
1744
|
+
"left": 0,
|
|
1745
|
+
"paddingHorizontal": 24,
|
|
1746
|
+
"paddingVertical": 16,
|
|
1747
|
+
"position": "absolute",
|
|
1748
|
+
"right": 0,
|
|
1749
|
+
"top": 0,
|
|
1750
|
+
},
|
|
1751
|
+
undefined,
|
|
1752
|
+
]
|
|
1753
|
+
}
|
|
1754
|
+
/>
|
|
1755
|
+
</View>
|
|
1756
|
+
`;
|
|
@@ -10,12 +10,15 @@ describe('LoadingIndicator', () => {
|
|
|
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
|
`(
|
|
20
23
|
'renders correctly when themeVariant is $themeVariant',
|
|
21
24
|
({ themeVariant }) => {
|
|
@@ -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 AnimatedLoadingIndicatorWrapper = Animated.createAnimatedComponent(
|
|
22
25
|
StyledLoadingIndicatorWrapper
|
|
@@ -6,18 +6,21 @@ import Icon from '../Icon';
|
|
|
6
6
|
import Typography from '../Typography';
|
|
7
7
|
import { scale } from '../../utils/scale';
|
|
8
8
|
|
|
9
|
-
type Intent = 'primary' | 'secondary' | 'danger';
|
|
9
|
+
type Intent = 'primary' | 'secondary' | 'danger' | 'white';
|
|
10
10
|
|
|
11
11
|
type ThemeVariant =
|
|
12
12
|
| 'filled-primary'
|
|
13
13
|
| 'filled-secondary'
|
|
14
14
|
| 'filled-danger'
|
|
15
|
+
| 'filled-white'
|
|
15
16
|
| 'outlined-primary'
|
|
16
17
|
| 'outlined-secondary'
|
|
17
18
|
| 'outlined-danger'
|
|
19
|
+
| 'outlined-white'
|
|
18
20
|
| 'text-primary'
|
|
19
21
|
| 'text-secondary'
|
|
20
|
-
| 'text-danger'
|
|
22
|
+
| 'text-danger'
|
|
23
|
+
| 'text-white';
|
|
21
24
|
|
|
22
25
|
const getButtonHeight = (themeIsCompact: boolean) => {
|
|
23
26
|
switch (themeIsCompact) {
|
|
@@ -172,6 +175,14 @@ const StyledButtonContainer = styled(TouchableHighlight)<{
|
|
|
172
175
|
loading,
|
|
173
176
|
themeIsCompact
|
|
174
177
|
);
|
|
178
|
+
case 'filled-white':
|
|
179
|
+
return genFilledContainerStyles(
|
|
180
|
+
theme,
|
|
181
|
+
'white',
|
|
182
|
+
disabled,
|
|
183
|
+
loading,
|
|
184
|
+
themeIsCompact
|
|
185
|
+
);
|
|
175
186
|
case 'outlined-primary':
|
|
176
187
|
return genOutlineContainerStyles(
|
|
177
188
|
theme,
|
|
@@ -196,9 +207,18 @@ const StyledButtonContainer = styled(TouchableHighlight)<{
|
|
|
196
207
|
loading,
|
|
197
208
|
themeIsCompact
|
|
198
209
|
);
|
|
210
|
+
case 'outlined-white':
|
|
211
|
+
return genOutlineContainerStyles(
|
|
212
|
+
theme,
|
|
213
|
+
'white',
|
|
214
|
+
disabled,
|
|
215
|
+
loading,
|
|
216
|
+
themeIsCompact
|
|
217
|
+
);
|
|
199
218
|
case 'text-primary':
|
|
200
219
|
case 'text-secondary':
|
|
201
220
|
case 'text-danger':
|
|
221
|
+
case 'text-white':
|
|
202
222
|
return {
|
|
203
223
|
height: themeInlineText ? undefined : getButtonHeight(themeIsCompact),
|
|
204
224
|
borderRadius: theme.__hd__.button.radii.text,
|
|
@@ -212,7 +232,7 @@ const StyledButtonContainer = styled(TouchableHighlight)<{
|
|
|
212
232
|
|
|
213
233
|
borderWidth: 0,
|
|
214
234
|
backgroundColor:
|
|
215
|
-
loading && !themeInlineText
|
|
235
|
+
loading && !themeInlineText && themeButtonVariant !== 'text-white'
|
|
216
236
|
? theme.__hd__.button.colors.textLoadingBackground
|
|
217
237
|
: 'transparent',
|
|
218
238
|
};
|
|
@@ -220,6 +240,47 @@ const StyledButtonContainer = styled(TouchableHighlight)<{
|
|
|
220
240
|
}
|
|
221
241
|
);
|
|
222
242
|
|
|
243
|
+
const genWhiteTextStyles = ({
|
|
244
|
+
variant,
|
|
245
|
+
disabled,
|
|
246
|
+
theme,
|
|
247
|
+
}: {
|
|
248
|
+
variant: ThemeVariant;
|
|
249
|
+
disabled?: boolean;
|
|
250
|
+
theme: Theme;
|
|
251
|
+
}) => {
|
|
252
|
+
if (disabled) {
|
|
253
|
+
switch (variant) {
|
|
254
|
+
case 'filled-white': {
|
|
255
|
+
return {
|
|
256
|
+
color: theme.__hd__.button.colors.invertedText,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
case 'outlined-white':
|
|
260
|
+
case 'text-white': {
|
|
261
|
+
return {
|
|
262
|
+
color: theme.__hd__.button.colors.disabledText,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
switch (variant) {
|
|
269
|
+
case 'filled-white': {
|
|
270
|
+
return {
|
|
271
|
+
color: theme.__hd__.button.colors.primary,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
case 'outlined-white':
|
|
276
|
+
case 'text-white': {
|
|
277
|
+
return {
|
|
278
|
+
color: theme.__hd__.button.colors.invertedText,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
|
|
223
284
|
const StyledButtonText = styled(Typography.Title)<{
|
|
224
285
|
disabled?: boolean;
|
|
225
286
|
themeButtonVariant: ThemeVariant;
|
|
@@ -238,12 +299,21 @@ const StyledButtonText = styled(Typography.Title)<{
|
|
|
238
299
|
return genTextStyles(theme, 'secondary', disabled);
|
|
239
300
|
case 'outlined-danger':
|
|
240
301
|
return genTextStyles(theme, 'danger', disabled);
|
|
302
|
+
|
|
241
303
|
case 'text-primary':
|
|
242
304
|
return genTextStyles(theme, 'primary', disabled);
|
|
243
305
|
case 'text-secondary':
|
|
244
306
|
return genTextStyles(theme, 'secondary', disabled);
|
|
245
307
|
case 'text-danger':
|
|
246
308
|
return genTextStyles(theme, 'danger', disabled);
|
|
309
|
+
case 'filled-white':
|
|
310
|
+
case 'outlined-white':
|
|
311
|
+
case 'text-white':
|
|
312
|
+
return genWhiteTextStyles({
|
|
313
|
+
variant: themeButtonVariant,
|
|
314
|
+
disabled,
|
|
315
|
+
theme,
|
|
316
|
+
});
|
|
247
317
|
}
|
|
248
318
|
};
|
|
249
319
|
return {
|
|
@@ -257,7 +327,11 @@ const StyledSmallButtonText = StyledButtonText.withComponent(Typography.Body);
|
|
|
257
327
|
|
|
258
328
|
const StyledButtonTitleOfVariantText = styled(Typography.Body)<{
|
|
259
329
|
disabled?: boolean;
|
|
260
|
-
themeButtonVariant:
|
|
330
|
+
themeButtonVariant:
|
|
331
|
+
| 'text-primary'
|
|
332
|
+
| 'text-secondary'
|
|
333
|
+
| 'text-danger'
|
|
334
|
+
| 'text-white';
|
|
261
335
|
themeIsPressed?: boolean;
|
|
262
336
|
}>(({ disabled, themeButtonVariant, themeIsPressed, theme }) => {
|
|
263
337
|
const themeStyling = () => {
|
|
@@ -268,6 +342,12 @@ const StyledButtonTitleOfVariantText = styled(Typography.Body)<{
|
|
|
268
342
|
return genTextStyles(theme, 'secondary', disabled, themeIsPressed);
|
|
269
343
|
case 'text-danger':
|
|
270
344
|
return genTextStyles(theme, 'danger', disabled, themeIsPressed);
|
|
345
|
+
case 'text-white':
|
|
346
|
+
return genWhiteTextStyles({
|
|
347
|
+
variant: 'text-white',
|
|
348
|
+
disabled,
|
|
349
|
+
theme,
|
|
350
|
+
});
|
|
271
351
|
}
|
|
272
352
|
};
|
|
273
353
|
return {
|
|
@@ -310,7 +390,9 @@ const StyledButtonIcon = styled(Icon)<{
|
|
|
310
390
|
case 'filled-primary':
|
|
311
391
|
case 'filled-secondary':
|
|
312
392
|
case 'filled-danger':
|
|
313
|
-
return {
|
|
393
|
+
return {
|
|
394
|
+
color: theme.__hd__.button.colors.invertedText,
|
|
395
|
+
};
|
|
314
396
|
case 'outlined-primary':
|
|
315
397
|
return genTextStyles(theme, 'primary', disabled);
|
|
316
398
|
case 'outlined-secondary':
|
|
@@ -323,6 +405,14 @@ const StyledButtonIcon = styled(Icon)<{
|
|
|
323
405
|
return genTextStyles(theme, 'secondary', disabled, themeIsPressed);
|
|
324
406
|
case 'text-danger':
|
|
325
407
|
return genTextStyles(theme, 'danger', disabled, themeIsPressed);
|
|
408
|
+
case 'filled-white':
|
|
409
|
+
case 'outlined-white':
|
|
410
|
+
case 'text-white':
|
|
411
|
+
return genWhiteTextStyles({
|
|
412
|
+
variant: themeButtonVariant,
|
|
413
|
+
disabled,
|
|
414
|
+
theme,
|
|
415
|
+
});
|
|
326
416
|
}
|
|
327
417
|
};
|
|
328
418
|
|
|
@@ -112,9 +112,15 @@ describe('Button', () => {
|
|
|
112
112
|
${'filled'} | ${'primary'} | ${false} | ${false}
|
|
113
113
|
${'filled'} | ${'primary'} | ${true} | ${false}
|
|
114
114
|
${'filled'} | ${'primary'} | ${false} | ${true}
|
|
115
|
+
${'filled'} | ${'white'} | ${false} | ${false}
|
|
116
|
+
${'filled'} | ${'white'} | ${true} | ${false}
|
|
117
|
+
${'filled'} | ${'white'} | ${false} | ${true}
|
|
115
118
|
${'outlined'} | ${'primary'} | ${false} | ${false}
|
|
116
119
|
${'outlined'} | ${'primary'} | ${true} | ${false}
|
|
117
120
|
${'outlined'} | ${'primary'} | ${false} | ${true}
|
|
121
|
+
${'outlined'} | ${'white'} | ${false} | ${false}
|
|
122
|
+
${'outlined'} | ${'white'} | ${true} | ${false}
|
|
123
|
+
${'outlined'} | ${'white'} | ${false} | ${true}
|
|
118
124
|
${'text'} | ${'primary'} | ${false} | ${false}
|
|
119
125
|
${'text'} | ${'primary'} | ${true} | ${false}
|
|
120
126
|
${'text'} | ${'primary'} | ${false} | ${true}
|
|
@@ -124,6 +130,9 @@ describe('Button', () => {
|
|
|
124
130
|
${'text'} | ${'danger'} | ${false} | ${false}
|
|
125
131
|
${'text'} | ${'danger'} | ${true} | ${false}
|
|
126
132
|
${'text'} | ${'danger'} | ${false} | ${true}
|
|
133
|
+
${'text'} | ${'white'} | ${false} | ${false}
|
|
134
|
+
${'text'} | ${'white'} | ${true} | ${false}
|
|
135
|
+
${'text'} | ${'white'} | ${false} | ${true}
|
|
127
136
|
${'inline-text'} | ${'primary'} | ${false} | ${false}
|
|
128
137
|
${'inline-text'} | ${'secondary'} | ${true} | ${false}
|
|
129
138
|
${'inline-text'} | ${'danger'} | ${false} | ${false}
|
|
@@ -157,14 +166,17 @@ describe('getThemeVariant', () => {
|
|
|
157
166
|
${'filled'} | ${'primary'} | ${'filled-primary'}
|
|
158
167
|
${'filled'} | ${'secondary'} | ${'filled-secondary'}
|
|
159
168
|
${'filled'} | ${'danger'} | ${'filled-danger'}
|
|
169
|
+
${'filled'} | ${'white'} | ${'filled-white'}
|
|
160
170
|
${'filled-compact'} | ${'danger'} | ${'filled-danger'}
|
|
161
171
|
${'outlined'} | ${'primary'} | ${'outlined-primary'}
|
|
162
172
|
${'outlined'} | ${'secondary'} | ${'outlined-secondary'}
|
|
163
173
|
${'outlined'} | ${'danger'} | ${'outlined-danger'}
|
|
174
|
+
${'outlined'} | ${'white'} | ${'outlined-white'}
|
|
164
175
|
${'outlined-compact'} | ${'danger'} | ${'outlined-danger'}
|
|
165
176
|
${'text'} | ${'primary'} | ${'text-primary'}
|
|
166
177
|
${'text'} | ${'secondary'} | ${'text-secondary'}
|
|
167
178
|
${'text'} | ${'danger'} | ${'text-danger'}
|
|
179
|
+
${'text'} | ${'white'} | ${'text-white'}
|
|
168
180
|
`('returns $themeVariant', ({ variant, intent, themeVariant }) => {
|
|
169
181
|
expect(getThemeVariant(variant, intent)).toBe(themeVariant);
|
|
170
182
|
});
|