@hero-design/rn 8.83.0 → 8.84.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.
@@ -1,5 +1,74 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`StyledButtonContainer has false style 1`] = `
4
+ <View
5
+ style={
6
+ {
7
+ "flex": 1,
8
+ }
9
+ }
10
+ >
11
+ <View
12
+ accessibilityValue={
13
+ {
14
+ "max": undefined,
15
+ "min": undefined,
16
+ "now": undefined,
17
+ "text": undefined,
18
+ }
19
+ }
20
+ accessible={true}
21
+ focusable={false}
22
+ onClick={[Function]}
23
+ onResponderGrant={[Function]}
24
+ onResponderMove={[Function]}
25
+ onResponderRelease={[Function]}
26
+ onResponderTerminate={[Function]}
27
+ onResponderTerminationRequest={[Function]}
28
+ onStartShouldSetResponder={[Function]}
29
+ style={
30
+ [
31
+ {
32
+ "alignItems": "center",
33
+ "alignSelf": "stretch",
34
+ "backgroundColor": "#401960",
35
+ "borderRadius": 32,
36
+ "flexDirection": "row",
37
+ "height": 60,
38
+ "justifyContent": "center",
39
+ "padding": 16,
40
+ },
41
+ undefined,
42
+ ]
43
+ }
44
+ >
45
+ <Text>
46
+ Title
47
+ </Text>
48
+ </View>
49
+ <View
50
+ pointerEvents="box-none"
51
+ position="bottom"
52
+ style={
53
+ [
54
+ {
55
+ "bottom": 0,
56
+ "elevation": 9999,
57
+ "flexDirection": "column-reverse",
58
+ "left": 0,
59
+ "paddingHorizontal": 24,
60
+ "paddingVertical": 16,
61
+ "position": "absolute",
62
+ "right": 0,
63
+ "top": 0,
64
+ },
65
+ undefined,
66
+ ]
67
+ }
68
+ />
69
+ </View>
70
+ `;
71
+
3
72
  exports[`StyledButtonContainer has filled-danger style 1`] = `
4
73
  <View
5
74
  style={
@@ -627,6 +696,145 @@ exports[`StyledButtonContainer has text-secondary style 1`] = `
627
696
  </View>
628
697
  `;
629
698
 
699
+ exports[`StyledButtonContainer has true style 1`] = `
700
+ <View
701
+ style={
702
+ {
703
+ "flex": 1,
704
+ }
705
+ }
706
+ >
707
+ <View
708
+ accessibilityValue={
709
+ {
710
+ "max": undefined,
711
+ "min": undefined,
712
+ "now": undefined,
713
+ "text": undefined,
714
+ }
715
+ }
716
+ accessible={true}
717
+ focusable={false}
718
+ onClick={[Function]}
719
+ onResponderGrant={[Function]}
720
+ onResponderMove={[Function]}
721
+ onResponderRelease={[Function]}
722
+ onResponderTerminate={[Function]}
723
+ onResponderTerminationRequest={[Function]}
724
+ onStartShouldSetResponder={[Function]}
725
+ style={
726
+ [
727
+ {
728
+ "alignItems": "center",
729
+ "alignSelf": "flex-start",
730
+ "backgroundColor": "#401960",
731
+ "borderRadius": 32,
732
+ "flexDirection": "row",
733
+ "height": 36,
734
+ "justifyContent": "center",
735
+ "paddingHorizontal": 16,
736
+ "paddingVertical": 8,
737
+ },
738
+ undefined,
739
+ ]
740
+ }
741
+ >
742
+ <Text>
743
+ Title
744
+ </Text>
745
+ </View>
746
+ <View
747
+ pointerEvents="box-none"
748
+ position="bottom"
749
+ style={
750
+ [
751
+ {
752
+ "bottom": 0,
753
+ "elevation": 9999,
754
+ "flexDirection": "column-reverse",
755
+ "left": 0,
756
+ "paddingHorizontal": 24,
757
+ "paddingVertical": 16,
758
+ "position": "absolute",
759
+ "right": 0,
760
+ "top": 0,
761
+ },
762
+ undefined,
763
+ ]
764
+ }
765
+ />
766
+ </View>
767
+ `;
768
+
769
+ exports[`StyledButtonContainer has undefined style 1`] = `
770
+ <View
771
+ style={
772
+ {
773
+ "flex": 1,
774
+ }
775
+ }
776
+ >
777
+ <View
778
+ accessibilityValue={
779
+ {
780
+ "max": undefined,
781
+ "min": undefined,
782
+ "now": undefined,
783
+ "text": undefined,
784
+ }
785
+ }
786
+ accessible={true}
787
+ focusable={false}
788
+ onClick={[Function]}
789
+ onResponderGrant={[Function]}
790
+ onResponderMove={[Function]}
791
+ onResponderRelease={[Function]}
792
+ onResponderTerminate={[Function]}
793
+ onResponderTerminationRequest={[Function]}
794
+ onStartShouldSetResponder={[Function]}
795
+ style={
796
+ [
797
+ {
798
+ "alignItems": "center",
799
+ "alignSelf": "stretch",
800
+ "backgroundColor": "#401960",
801
+ "borderRadius": 32,
802
+ "flexDirection": "row",
803
+ "height": 60,
804
+ "justifyContent": "center",
805
+ "padding": 16,
806
+ },
807
+ undefined,
808
+ ]
809
+ }
810
+ >
811
+ <Text>
812
+ Title
813
+ </Text>
814
+ </View>
815
+ <View
816
+ pointerEvents="box-none"
817
+ position="bottom"
818
+ style={
819
+ [
820
+ {
821
+ "bottom": 0,
822
+ "elevation": 9999,
823
+ "flexDirection": "column-reverse",
824
+ "left": 0,
825
+ "paddingHorizontal": 24,
826
+ "paddingVertical": 16,
827
+ "position": "absolute",
828
+ "right": 0,
829
+ "top": 0,
830
+ },
831
+ undefined,
832
+ ]
833
+ }
834
+ />
835
+ </View>
836
+ `;
837
+
630
838
  exports[`StyledButtonContainer renders disabled correctly 1`] = `
631
839
  <View
632
840
  style={
@@ -701,6 +909,57 @@ exports[`StyledButtonContainer renders disabled correctly 1`] = `
701
909
  </View>
702
910
  `;
703
911
 
912
+ exports[`StyledButtonIcon has false style 1`] = `
913
+ <View
914
+ style={
915
+ {
916
+ "flex": 1,
917
+ }
918
+ }
919
+ >
920
+ <HeroIcon
921
+ name="bell"
922
+ style={
923
+ [
924
+ {
925
+ "color": "#001f23",
926
+ "fontSize": 24,
927
+ },
928
+ [
929
+ {
930
+ "color": "#ffffff",
931
+ "fontSize": 20,
932
+ },
933
+ undefined,
934
+ ],
935
+ ]
936
+ }
937
+ themeIntent="text"
938
+ themeSize="medium"
939
+ />
940
+ <View
941
+ pointerEvents="box-none"
942
+ position="bottom"
943
+ style={
944
+ [
945
+ {
946
+ "bottom": 0,
947
+ "elevation": 9999,
948
+ "flexDirection": "column-reverse",
949
+ "left": 0,
950
+ "paddingHorizontal": 24,
951
+ "paddingVertical": 16,
952
+ "position": "absolute",
953
+ "right": 0,
954
+ "top": 0,
955
+ },
956
+ undefined,
957
+ ]
958
+ }
959
+ />
960
+ </View>
961
+ `;
962
+
704
963
  exports[`StyledButtonIcon has filled-danger style 1`] = `
705
964
  <View
706
965
  style={
@@ -1313,6 +1572,108 @@ exports[`StyledButtonIcon has text-secondary style 2`] = `
1313
1572
  </View>
1314
1573
  `;
1315
1574
 
1575
+ exports[`StyledButtonIcon has true style 1`] = `
1576
+ <View
1577
+ style={
1578
+ {
1579
+ "flex": 1,
1580
+ }
1581
+ }
1582
+ >
1583
+ <HeroIcon
1584
+ name="bell"
1585
+ style={
1586
+ [
1587
+ {
1588
+ "color": "#001f23",
1589
+ "fontSize": 24,
1590
+ },
1591
+ [
1592
+ {
1593
+ "color": "#ffffff",
1594
+ "fontSize": 12,
1595
+ },
1596
+ undefined,
1597
+ ],
1598
+ ]
1599
+ }
1600
+ themeIntent="text"
1601
+ themeSize="medium"
1602
+ />
1603
+ <View
1604
+ pointerEvents="box-none"
1605
+ position="bottom"
1606
+ style={
1607
+ [
1608
+ {
1609
+ "bottom": 0,
1610
+ "elevation": 9999,
1611
+ "flexDirection": "column-reverse",
1612
+ "left": 0,
1613
+ "paddingHorizontal": 24,
1614
+ "paddingVertical": 16,
1615
+ "position": "absolute",
1616
+ "right": 0,
1617
+ "top": 0,
1618
+ },
1619
+ undefined,
1620
+ ]
1621
+ }
1622
+ />
1623
+ </View>
1624
+ `;
1625
+
1626
+ exports[`StyledButtonIcon has undefined style 1`] = `
1627
+ <View
1628
+ style={
1629
+ {
1630
+ "flex": 1,
1631
+ }
1632
+ }
1633
+ >
1634
+ <HeroIcon
1635
+ name="bell"
1636
+ style={
1637
+ [
1638
+ {
1639
+ "color": "#001f23",
1640
+ "fontSize": 24,
1641
+ },
1642
+ [
1643
+ {
1644
+ "color": "#ffffff",
1645
+ "fontSize": 20,
1646
+ },
1647
+ undefined,
1648
+ ],
1649
+ ]
1650
+ }
1651
+ themeIntent="text"
1652
+ themeSize="medium"
1653
+ />
1654
+ <View
1655
+ pointerEvents="box-none"
1656
+ position="bottom"
1657
+ style={
1658
+ [
1659
+ {
1660
+ "bottom": 0,
1661
+ "elevation": 9999,
1662
+ "flexDirection": "column-reverse",
1663
+ "left": 0,
1664
+ "paddingHorizontal": 24,
1665
+ "paddingVertical": 16,
1666
+ "position": "absolute",
1667
+ "right": 0,
1668
+ "top": 0,
1669
+ },
1670
+ undefined,
1671
+ ]
1672
+ }
1673
+ />
1674
+ </View>
1675
+ `;
1676
+
1316
1677
  exports[`StyledButtonIcon renders disabled correctly 1`] = `
1317
1678
  <View
1318
1679
  style={
@@ -1364,6 +1725,49 @@ exports[`StyledButtonIcon renders disabled correctly 1`] = `
1364
1725
  </View>
1365
1726
  `;
1366
1727
 
1728
+ exports[`StyledButtonIconWrapper has false style 1`] = `
1729
+ <View
1730
+ style={
1731
+ {
1732
+ "flex": 1,
1733
+ }
1734
+ }
1735
+ >
1736
+ <View
1737
+ style={
1738
+ [
1739
+ {
1740
+ "paddingRight": 12,
1741
+ },
1742
+ undefined,
1743
+ ]
1744
+ }
1745
+ themeIsCompact={false}
1746
+ themePosition="left"
1747
+ />
1748
+ <View
1749
+ pointerEvents="box-none"
1750
+ position="bottom"
1751
+ style={
1752
+ [
1753
+ {
1754
+ "bottom": 0,
1755
+ "elevation": 9999,
1756
+ "flexDirection": "column-reverse",
1757
+ "left": 0,
1758
+ "paddingHorizontal": 24,
1759
+ "paddingVertical": 16,
1760
+ "position": "absolute",
1761
+ "right": 0,
1762
+ "top": 0,
1763
+ },
1764
+ undefined,
1765
+ ]
1766
+ }
1767
+ />
1768
+ </View>
1769
+ `;
1770
+
1367
1771
  exports[`StyledButtonIconWrapper has left style 1`] = `
1368
1772
  <View
1369
1773
  style={
@@ -1448,6 +1852,91 @@ exports[`StyledButtonIconWrapper has right style 1`] = `
1448
1852
  </View>
1449
1853
  `;
1450
1854
 
1855
+ exports[`StyledButtonIconWrapper has true style 1`] = `
1856
+ <View
1857
+ style={
1858
+ {
1859
+ "flex": 1,
1860
+ }
1861
+ }
1862
+ >
1863
+ <View
1864
+ style={
1865
+ [
1866
+ {
1867
+ "paddingRight": 8,
1868
+ },
1869
+ undefined,
1870
+ ]
1871
+ }
1872
+ themeIsCompact={true}
1873
+ themePosition="left"
1874
+ />
1875
+ <View
1876
+ pointerEvents="box-none"
1877
+ position="bottom"
1878
+ style={
1879
+ [
1880
+ {
1881
+ "bottom": 0,
1882
+ "elevation": 9999,
1883
+ "flexDirection": "column-reverse",
1884
+ "left": 0,
1885
+ "paddingHorizontal": 24,
1886
+ "paddingVertical": 16,
1887
+ "position": "absolute",
1888
+ "right": 0,
1889
+ "top": 0,
1890
+ },
1891
+ undefined,
1892
+ ]
1893
+ }
1894
+ />
1895
+ </View>
1896
+ `;
1897
+
1898
+ exports[`StyledButtonIconWrapper has undefined style 1`] = `
1899
+ <View
1900
+ style={
1901
+ {
1902
+ "flex": 1,
1903
+ }
1904
+ }
1905
+ >
1906
+ <View
1907
+ style={
1908
+ [
1909
+ {
1910
+ "paddingRight": 12,
1911
+ },
1912
+ undefined,
1913
+ ]
1914
+ }
1915
+ themePosition="left"
1916
+ />
1917
+ <View
1918
+ pointerEvents="box-none"
1919
+ position="bottom"
1920
+ style={
1921
+ [
1922
+ {
1923
+ "bottom": 0,
1924
+ "elevation": 9999,
1925
+ "flexDirection": "column-reverse",
1926
+ "left": 0,
1927
+ "paddingHorizontal": 24,
1928
+ "paddingVertical": 16,
1929
+ "position": "absolute",
1930
+ "right": 0,
1931
+ "top": 0,
1932
+ },
1933
+ undefined,
1934
+ ]
1935
+ }
1936
+ />
1937
+ </View>
1938
+ `;
1939
+
1451
1940
  exports[`StyledButtonText has filled-danger style 1`] = `
1452
1941
  <View
1453
1942
  style={
@@ -35,6 +35,7 @@ const DatePickerIOS = ({
35
35
  testID,
36
36
  supportedOrientations = ['portrait'],
37
37
  variant = 'default',
38
+ locale,
38
39
  }: DatePickerIOSProps) => {
39
40
  const [selectingDate, setSelectingDate] = useState<Date>(
40
41
  getDateValue(value || new Date(), minDate, maxDate)
@@ -83,6 +84,7 @@ const DatePickerIOS = ({
83
84
  {variant === 'month-year' ? (
84
85
  <MonthYearPickerViewIOS
85
86
  value={value}
87
+ locale={locale}
86
88
  minimumDate={minDate}
87
89
  maximumDate={maxDate}
88
90
  onChange={(date: Date | undefined) => {
@@ -95,6 +97,7 @@ const DatePickerIOS = ({
95
97
  ) : null}
96
98
  {variant === 'default' ? (
97
99
  <DateTimePicker
100
+ locale={locale}
98
101
  testID="datePickerIOS"
99
102
  value={selectingDate}
100
103
  minimumDate={minDate}
@@ -102,6 +102,40 @@ describe('DatePickerIOS', () => {
102
102
  expect(onChange).toBeCalledWith(new Date('December 17, 1995'));
103
103
  });
104
104
 
105
+ it('renders correctly with custom locale', () => {
106
+ const onChange = jest.fn();
107
+ const { getByText, queryByTestId, toJSON } = renderWithTheme(
108
+ <DatePickerIOS
109
+ locale="zh-CN"
110
+ value={new Date('December 21, 1995')}
111
+ label="Start date"
112
+ confirmLabel="Confirm"
113
+ onChange={onChange}
114
+ />
115
+ );
116
+
117
+ expect(getByText('Start date')).toBeDefined();
118
+ expect(queryByTestId('text-input').props.value).toBe('21/12/1995');
119
+ expect(queryByTestId('datePickerIOS')).toBeNull();
120
+
121
+ // Open date picker
122
+ fireEvent.press(getByText('Start date'));
123
+ expect(queryByTestId('datePickerIOS')).toBeTruthy();
124
+
125
+ expect(toJSON()).toMatchSnapshot();
126
+
127
+ // Change date
128
+ fireEvent(
129
+ queryByTestId('datePickerIOS'),
130
+ 'onChange',
131
+ null,
132
+ new Date('December 17, 1995')
133
+ );
134
+ fireEvent.press(getByText('Confirm'));
135
+
136
+ expect(onChange).toBeCalledWith(new Date('December 17, 1995'));
137
+ });
138
+
105
139
  it('renders correct help text', () => {
106
140
  const { getByText } = renderWithTheme(
107
141
  <DatePickerIOS