@hero-design/rn 8.22.0 → 8.23.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.
- package/.turbo/turbo-build.log +9 -9
- package/es/index.js +235 -65
- package/lib/index.js +235 -64
- package/package.json +5 -5
- package/src/components/Alert/index.tsx +6 -0
- package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
- package/src/components/Error/__tests__/__snapshots__/index.spec.tsx.snap +5 -5
- package/src/components/List/ListItem.tsx +12 -8
- package/src/components/Success/StyledSuccess.tsx +87 -0
- package/src/components/Success/__tests__/__snapshots__/index.spec.tsx.snap +497 -0
- package/src/components/Success/__tests__/index.spec.tsx +78 -0
- package/src/components/Success/index.tsx +129 -0
- package/src/components/Tag/StyledTag.tsx +1 -1
- package/src/components/Tag/__tests__/Tag.spec.tsx +22 -71
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +106 -53
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +265 -0
- package/src/components/TextInput/__tests__/index.spec.tsx +29 -0
- package/src/components/TextInput/index.tsx +6 -1
- package/src/index.ts +2 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +33 -3
- package/src/theme/components/empty.ts +1 -1
- package/src/theme/components/error.ts +1 -1
- package/src/theme/components/success.ts +40 -0
- package/src/theme/components/tag.ts +1 -1
- package/src/theme/getTheme.ts +3 -0
- package/src/utils/hooks.ts +1 -1
- package/types/components/Success/StyledSuccess.d.ts +54 -0
- package/types/components/Success/index.d.ts +42 -0
- package/types/components/TextInput/index.d.ts +5 -1
- package/types/index.d.ts +2 -1
- package/types/theme/components/success.d.ts +32 -0
- package/types/theme/getTheme.d.ts +2 -0
|
@@ -2692,6 +2692,271 @@ exports[`TextInput max length renders correctly 1`] = `
|
|
|
2692
2692
|
</View>
|
|
2693
2693
|
`;
|
|
2694
2694
|
|
|
2695
|
+
exports[`TextInput max length renders correctly with hide character count 1`] = `
|
|
2696
|
+
<View
|
|
2697
|
+
pointerEvents="auto"
|
|
2698
|
+
style={
|
|
2699
|
+
Array [
|
|
2700
|
+
Object {
|
|
2701
|
+
"marginTop": 8,
|
|
2702
|
+
"width": "100%",
|
|
2703
|
+
},
|
|
2704
|
+
undefined,
|
|
2705
|
+
]
|
|
2706
|
+
}
|
|
2707
|
+
>
|
|
2708
|
+
<View
|
|
2709
|
+
style={
|
|
2710
|
+
Array [
|
|
2711
|
+
Object {
|
|
2712
|
+
"alignItems": "center",
|
|
2713
|
+
"backgroundColor": "#ffffff",
|
|
2714
|
+
"borderRadius": 8,
|
|
2715
|
+
"flexDirection": "row",
|
|
2716
|
+
"padding": 16,
|
|
2717
|
+
},
|
|
2718
|
+
undefined,
|
|
2719
|
+
]
|
|
2720
|
+
}
|
|
2721
|
+
>
|
|
2722
|
+
<View
|
|
2723
|
+
style={
|
|
2724
|
+
Array [
|
|
2725
|
+
Object {
|
|
2726
|
+
"borderColor": "#de350b",
|
|
2727
|
+
"borderRadius": 8,
|
|
2728
|
+
"borderWidth": 1,
|
|
2729
|
+
"bottom": 0,
|
|
2730
|
+
"left": 0,
|
|
2731
|
+
"position": "absolute",
|
|
2732
|
+
"right": 0,
|
|
2733
|
+
"top": 0,
|
|
2734
|
+
},
|
|
2735
|
+
Array [
|
|
2736
|
+
Object {
|
|
2737
|
+
"backgroundColor": "#ffffff",
|
|
2738
|
+
},
|
|
2739
|
+
undefined,
|
|
2740
|
+
],
|
|
2741
|
+
]
|
|
2742
|
+
}
|
|
2743
|
+
testID="text-input-border"
|
|
2744
|
+
themeFocused={false}
|
|
2745
|
+
themeVariant="error"
|
|
2746
|
+
/>
|
|
2747
|
+
<View
|
|
2748
|
+
pointerEvents="none"
|
|
2749
|
+
style={
|
|
2750
|
+
Array [
|
|
2751
|
+
Object {
|
|
2752
|
+
"backgroundColor": "#ffffff",
|
|
2753
|
+
"flexDirection": "row",
|
|
2754
|
+
"left": 16,
|
|
2755
|
+
"paddingHorizontal": 4,
|
|
2756
|
+
"position": "absolute",
|
|
2757
|
+
"top": -10,
|
|
2758
|
+
"zIndex": 1,
|
|
2759
|
+
},
|
|
2760
|
+
Object {
|
|
2761
|
+
"backgroundColor": "#ffffff",
|
|
2762
|
+
},
|
|
2763
|
+
]
|
|
2764
|
+
}
|
|
2765
|
+
testID="label-container"
|
|
2766
|
+
>
|
|
2767
|
+
<Text
|
|
2768
|
+
allowFontScaling={false}
|
|
2769
|
+
style={
|
|
2770
|
+
Array [
|
|
2771
|
+
Object {
|
|
2772
|
+
"color": "#001f23",
|
|
2773
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
2774
|
+
"fontSize": 12,
|
|
2775
|
+
"letterSpacing": 0.36,
|
|
2776
|
+
"lineHeight": 20,
|
|
2777
|
+
},
|
|
2778
|
+
Array [
|
|
2779
|
+
Object {
|
|
2780
|
+
"color": "#de350b",
|
|
2781
|
+
},
|
|
2782
|
+
undefined,
|
|
2783
|
+
],
|
|
2784
|
+
]
|
|
2785
|
+
}
|
|
2786
|
+
themeFontSize="small"
|
|
2787
|
+
themeFontWeight="regular"
|
|
2788
|
+
themeIntent="body"
|
|
2789
|
+
themeTypeface="neutral"
|
|
2790
|
+
themeVariant="error"
|
|
2791
|
+
>
|
|
2792
|
+
*
|
|
2793
|
+
</Text>
|
|
2794
|
+
<Text
|
|
2795
|
+
allowFontScaling={false}
|
|
2796
|
+
style={
|
|
2797
|
+
Array [
|
|
2798
|
+
Object {
|
|
2799
|
+
"color": "#001f23",
|
|
2800
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
2801
|
+
"fontSize": 12,
|
|
2802
|
+
"letterSpacing": 0.36,
|
|
2803
|
+
"lineHeight": 20,
|
|
2804
|
+
},
|
|
2805
|
+
Array [
|
|
2806
|
+
Object {
|
|
2807
|
+
"color": "#001f23",
|
|
2808
|
+
},
|
|
2809
|
+
Object {
|
|
2810
|
+
"backgroundColor": "#ffffff",
|
|
2811
|
+
},
|
|
2812
|
+
],
|
|
2813
|
+
]
|
|
2814
|
+
}
|
|
2815
|
+
testID="input-label"
|
|
2816
|
+
themeFontSize="small"
|
|
2817
|
+
themeFontWeight="regular"
|
|
2818
|
+
themeIntent="body"
|
|
2819
|
+
themeTypeface="neutral"
|
|
2820
|
+
themeVariant="error"
|
|
2821
|
+
>
|
|
2822
|
+
Shout out
|
|
2823
|
+
</Text>
|
|
2824
|
+
</View>
|
|
2825
|
+
<View
|
|
2826
|
+
style={
|
|
2827
|
+
Array [
|
|
2828
|
+
Object {
|
|
2829
|
+
"alignItems": "center",
|
|
2830
|
+
"alignSelf": "stretch",
|
|
2831
|
+
"flexDirection": "row",
|
|
2832
|
+
"flexGrow": 2,
|
|
2833
|
+
"flexShrink": 1,
|
|
2834
|
+
},
|
|
2835
|
+
undefined,
|
|
2836
|
+
]
|
|
2837
|
+
}
|
|
2838
|
+
>
|
|
2839
|
+
<TextInput
|
|
2840
|
+
accessibilityState={
|
|
2841
|
+
Object {
|
|
2842
|
+
"disabled": false,
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
allowFontScaling={false}
|
|
2846
|
+
editable={true}
|
|
2847
|
+
maxLength={255}
|
|
2848
|
+
multiline={true}
|
|
2849
|
+
onBlur={[Function]}
|
|
2850
|
+
onChangeText={[Function]}
|
|
2851
|
+
onFocus={[Function]}
|
|
2852
|
+
placeholder=" "
|
|
2853
|
+
style={
|
|
2854
|
+
Array [
|
|
2855
|
+
Object {
|
|
2856
|
+
"alignSelf": "stretch",
|
|
2857
|
+
"flexGrow": 2,
|
|
2858
|
+
"fontSize": 14,
|
|
2859
|
+
"marginHorizontal": 8,
|
|
2860
|
+
"paddingVertical": 0,
|
|
2861
|
+
"textAlignVertical": "center",
|
|
2862
|
+
},
|
|
2863
|
+
Object {
|
|
2864
|
+
"backgroundColor": "#ffffff",
|
|
2865
|
+
"color": "#001f23",
|
|
2866
|
+
},
|
|
2867
|
+
]
|
|
2868
|
+
}
|
|
2869
|
+
testID="text-input"
|
|
2870
|
+
value="shout out Tung Van"
|
|
2871
|
+
/>
|
|
2872
|
+
</View>
|
|
2873
|
+
</View>
|
|
2874
|
+
<View
|
|
2875
|
+
style={
|
|
2876
|
+
Array [
|
|
2877
|
+
Object {
|
|
2878
|
+
"minHeight": 16,
|
|
2879
|
+
"paddingLeft": 16,
|
|
2880
|
+
},
|
|
2881
|
+
undefined,
|
|
2882
|
+
]
|
|
2883
|
+
}
|
|
2884
|
+
>
|
|
2885
|
+
<View
|
|
2886
|
+
style={
|
|
2887
|
+
Array [
|
|
2888
|
+
Object {
|
|
2889
|
+
"flexDirection": "row",
|
|
2890
|
+
"justifyContent": "space-between",
|
|
2891
|
+
},
|
|
2892
|
+
undefined,
|
|
2893
|
+
]
|
|
2894
|
+
}
|
|
2895
|
+
>
|
|
2896
|
+
<View
|
|
2897
|
+
style={
|
|
2898
|
+
Array [
|
|
2899
|
+
Object {
|
|
2900
|
+
"alignItems": "center",
|
|
2901
|
+
"flex": 1,
|
|
2902
|
+
"flexDirection": "row",
|
|
2903
|
+
"flexGrow": 4,
|
|
2904
|
+
"marginRight": 4,
|
|
2905
|
+
},
|
|
2906
|
+
undefined,
|
|
2907
|
+
]
|
|
2908
|
+
}
|
|
2909
|
+
>
|
|
2910
|
+
<HeroIcon
|
|
2911
|
+
name="circle-info"
|
|
2912
|
+
style={
|
|
2913
|
+
Array [
|
|
2914
|
+
Object {
|
|
2915
|
+
"color": "#de350b",
|
|
2916
|
+
"fontSize": 16,
|
|
2917
|
+
},
|
|
2918
|
+
undefined,
|
|
2919
|
+
]
|
|
2920
|
+
}
|
|
2921
|
+
testID="input-error-icon"
|
|
2922
|
+
themeIntent="danger"
|
|
2923
|
+
themeSize="xsmall"
|
|
2924
|
+
/>
|
|
2925
|
+
<Text
|
|
2926
|
+
allowFontScaling={false}
|
|
2927
|
+
style={
|
|
2928
|
+
Array [
|
|
2929
|
+
Object {
|
|
2930
|
+
"color": "#001f23",
|
|
2931
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
2932
|
+
"fontSize": 14,
|
|
2933
|
+
"letterSpacing": 0.42,
|
|
2934
|
+
"lineHeight": 22,
|
|
2935
|
+
},
|
|
2936
|
+
Array [
|
|
2937
|
+
Object {
|
|
2938
|
+
"color": "#de350b",
|
|
2939
|
+
"fontSize": 12,
|
|
2940
|
+
"marginLeft": 4,
|
|
2941
|
+
},
|
|
2942
|
+
undefined,
|
|
2943
|
+
],
|
|
2944
|
+
]
|
|
2945
|
+
}
|
|
2946
|
+
testID="input-error-message"
|
|
2947
|
+
themeFontSize="medium"
|
|
2948
|
+
themeFontWeight="regular"
|
|
2949
|
+
themeIntent="body"
|
|
2950
|
+
themeTypeface="neutral"
|
|
2951
|
+
>
|
|
2952
|
+
must not exceed character limit
|
|
2953
|
+
</Text>
|
|
2954
|
+
</View>
|
|
2955
|
+
</View>
|
|
2956
|
+
</View>
|
|
2957
|
+
</View>
|
|
2958
|
+
`;
|
|
2959
|
+
|
|
2695
2960
|
exports[`TextInput placeholder TextInput is idle renders correctly 1`] = `
|
|
2696
2961
|
<View
|
|
2697
2962
|
pointerEvents="auto"
|
|
@@ -250,6 +250,35 @@ describe('TextInput', () => {
|
|
|
250
250
|
|
|
251
251
|
expect(getByTestId('text-input')).not.toHaveProp('multiline', 'true');
|
|
252
252
|
});
|
|
253
|
+
|
|
254
|
+
it('renders correctly with hide character count', () => {
|
|
255
|
+
const {
|
|
256
|
+
toJSON,
|
|
257
|
+
queryAllByTestId,
|
|
258
|
+
queryAllByText,
|
|
259
|
+
queryAllByDisplayValue,
|
|
260
|
+
getByTestId,
|
|
261
|
+
} = renderWithTheme(
|
|
262
|
+
<TextInput
|
|
263
|
+
label="Shout out"
|
|
264
|
+
value="shout out Tung Van"
|
|
265
|
+
required
|
|
266
|
+
maxLength={255}
|
|
267
|
+
multiline
|
|
268
|
+
error="must not exceed character limit"
|
|
269
|
+
hideCharacterCount
|
|
270
|
+
/>
|
|
271
|
+
);
|
|
272
|
+
|
|
273
|
+
expect(toJSON()).toMatchSnapshot();
|
|
274
|
+
expect(queryAllByText('Shout out')).toHaveLength(1);
|
|
275
|
+
expect(queryAllByDisplayValue('shout out Tung Van')).toHaveLength(1);
|
|
276
|
+
expect(queryAllByText('18/255')).toHaveLength(0);
|
|
277
|
+
expect(queryAllByTestId('input-label')).toHaveLength(1);
|
|
278
|
+
expect(queryAllByTestId('text-input')).toHaveLength(1);
|
|
279
|
+
|
|
280
|
+
expect(getByTestId('text-input')).not.toHaveProp('multiline', 'true');
|
|
281
|
+
});
|
|
253
282
|
});
|
|
254
283
|
|
|
255
284
|
describe('disabled', () => {
|
|
@@ -94,6 +94,10 @@ export interface TextInputProps extends NativeTextInputProps {
|
|
|
94
94
|
* If the max length is set, the input will display the current length and the max length.
|
|
95
95
|
* */
|
|
96
96
|
maxLength?: number;
|
|
97
|
+
/**
|
|
98
|
+
* Whether to hide the character count.
|
|
99
|
+
* */
|
|
100
|
+
hideCharacterCount?: boolean;
|
|
97
101
|
/**
|
|
98
102
|
* The helper text to display.
|
|
99
103
|
*/
|
|
@@ -157,6 +161,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
157
161
|
disabled = false,
|
|
158
162
|
loading = false,
|
|
159
163
|
maxLength,
|
|
164
|
+
hideCharacterCount = false,
|
|
160
165
|
helpText,
|
|
161
166
|
value,
|
|
162
167
|
defaultValue,
|
|
@@ -181,7 +186,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
181
186
|
isEmptyValue,
|
|
182
187
|
});
|
|
183
188
|
|
|
184
|
-
const shouldShowMaxLength = maxLength !== undefined;
|
|
189
|
+
const shouldShowMaxLength = maxLength !== undefined && !hideCharacterCount;
|
|
185
190
|
|
|
186
191
|
const theme = useTheme();
|
|
187
192
|
|
package/src/index.ts
CHANGED
|
@@ -46,6 +46,7 @@ import Radio from './components/Radio';
|
|
|
46
46
|
import SectionHeading from './components/SectionHeading';
|
|
47
47
|
import Select from './components/Select';
|
|
48
48
|
import Skeleton from './components/Skeleton';
|
|
49
|
+
import Success from './components/Success';
|
|
49
50
|
import Switch from './components/Switch';
|
|
50
51
|
import Tabs from './components/Tabs';
|
|
51
52
|
import Tag from './components/Tag';
|
|
@@ -107,6 +108,7 @@ export {
|
|
|
107
108
|
Radio,
|
|
108
109
|
SectionHeading,
|
|
109
110
|
Select,
|
|
111
|
+
Success,
|
|
110
112
|
Switch,
|
|
111
113
|
Tabs,
|
|
112
114
|
Tag,
|
|
@@ -417,7 +417,7 @@ Object {
|
|
|
417
417
|
},
|
|
418
418
|
"space": Object {
|
|
419
419
|
"imageMargin": 24,
|
|
420
|
-
"titleMargin":
|
|
420
|
+
"titleMargin": 8,
|
|
421
421
|
"wrapperPadding": 16,
|
|
422
422
|
},
|
|
423
423
|
},
|
|
@@ -446,7 +446,7 @@ Object {
|
|
|
446
446
|
"wrapperHorizontalPadding": 16,
|
|
447
447
|
"wrapperVerticalPadding": 48,
|
|
448
448
|
},
|
|
449
|
-
"imageMarginBottom":
|
|
449
|
+
"imageMarginBottom": 24,
|
|
450
450
|
"titleMarginBottom": 8,
|
|
451
451
|
"wrapperPadding": 24,
|
|
452
452
|
},
|
|
@@ -793,6 +793,36 @@ Object {
|
|
|
793
793
|
},
|
|
794
794
|
},
|
|
795
795
|
},
|
|
796
|
+
"success": Object {
|
|
797
|
+
"colors": Object {
|
|
798
|
+
"description": "#4d6265",
|
|
799
|
+
"fullScreenBackground": "#ccd2d3",
|
|
800
|
+
"inPageBackground": "#f6f6f7",
|
|
801
|
+
"title": "#001f23",
|
|
802
|
+
},
|
|
803
|
+
"fontSizes": Object {
|
|
804
|
+
"description": 18,
|
|
805
|
+
"title": 24,
|
|
806
|
+
},
|
|
807
|
+
"fonts": Object {
|
|
808
|
+
"description": "RebondGrotesque",
|
|
809
|
+
"title": "RebondGrotesque-SemiBold",
|
|
810
|
+
},
|
|
811
|
+
"sizes": Object {
|
|
812
|
+
"image": 176,
|
|
813
|
+
},
|
|
814
|
+
"space": Object {
|
|
815
|
+
"button": Object {
|
|
816
|
+
"margin": 16,
|
|
817
|
+
"padding": 16,
|
|
818
|
+
"wrapperHorizontalPadding": 16,
|
|
819
|
+
"wrapperVerticalPadding": 48,
|
|
820
|
+
},
|
|
821
|
+
"imageMarginBottom": 32,
|
|
822
|
+
"titleMarginBottom": 8,
|
|
823
|
+
"wrapperPadding": 24,
|
|
824
|
+
},
|
|
825
|
+
},
|
|
796
826
|
"swipeable": Object {
|
|
797
827
|
"colors": Object {
|
|
798
828
|
"danger": "#f46363",
|
|
@@ -874,7 +904,7 @@ Object {
|
|
|
874
904
|
"dangerBackground": "#fcebe7",
|
|
875
905
|
"info": "#4568fb",
|
|
876
906
|
"infoBackground": "#ecf0ff",
|
|
877
|
-
"primary": "#
|
|
907
|
+
"primary": "#001f23",
|
|
878
908
|
"primaryBackground": undefined,
|
|
879
909
|
"success": "#017d6d",
|
|
880
910
|
"successBackground": "#f0fef4",
|
|
@@ -3,7 +3,7 @@ import type { GlobalTheme } from '../global';
|
|
|
3
3
|
const getErrorTheme = (theme: GlobalTheme) => {
|
|
4
4
|
const space = {
|
|
5
5
|
titleMarginBottom: theme.space.small,
|
|
6
|
-
imageMarginBottom: theme.space.
|
|
6
|
+
imageMarginBottom: theme.space.large,
|
|
7
7
|
wrapperPadding: theme.space.large,
|
|
8
8
|
button: {
|
|
9
9
|
wrapperHorizontalPadding: theme.space.medium,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { GlobalTheme } from '../global';
|
|
2
|
+
|
|
3
|
+
const getSuccessTheme = (theme: GlobalTheme) => {
|
|
4
|
+
const space = {
|
|
5
|
+
titleMarginBottom: theme.space.small,
|
|
6
|
+
imageMarginBottom: theme.space.xlarge,
|
|
7
|
+
wrapperPadding: theme.space.large,
|
|
8
|
+
button: {
|
|
9
|
+
wrapperHorizontalPadding: theme.space.medium,
|
|
10
|
+
wrapperVerticalPadding: theme.space.xxxlarge,
|
|
11
|
+
margin: theme.space.medium,
|
|
12
|
+
padding: theme.space.medium,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const sizes = {
|
|
17
|
+
image: theme.sizes['19xlarge'],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const colors = {
|
|
21
|
+
title: theme.colors.onDefaultGlobalSurface,
|
|
22
|
+
description: theme.colors.mutedOnDefaultGlobalSurface,
|
|
23
|
+
fullScreenBackground: theme.colors.decorativePrimarySurface,
|
|
24
|
+
inPageBackground: theme.colors.neutralGlobalSurface,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const fontSizes = {
|
|
28
|
+
title: theme.fontSizes.xxxlarge,
|
|
29
|
+
description: theme.fontSizes.xlarge,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const fonts = {
|
|
33
|
+
title: theme.fonts.playful.semiBold,
|
|
34
|
+
description: theme.fonts.playful.regular,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return { fontSizes, colors, sizes, space, fonts };
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default getSuccessTheme;
|
|
@@ -6,7 +6,7 @@ const getTagTheme = (theme: GlobalTheme) => {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
const colors = {
|
|
9
|
-
primary: theme.colors.
|
|
9
|
+
primary: theme.colors.onDefaultGlobalSurface,
|
|
10
10
|
primaryBackground: undefined,
|
|
11
11
|
info: theme.colors.onInfoSurface,
|
|
12
12
|
infoBackground: theme.colors.infoSurface,
|
package/src/theme/getTheme.ts
CHANGED
|
@@ -34,6 +34,7 @@ import getSelectTheme from './components/select';
|
|
|
34
34
|
import getSkeletonTheme from './components/skeleton';
|
|
35
35
|
import getSliderTheme from './components/slider';
|
|
36
36
|
import getSpinnerTheme from './components/spinner';
|
|
37
|
+
import getSuccessTheme from './components/success';
|
|
37
38
|
import getSwipeableTheme from './components/swipeable';
|
|
38
39
|
import getSwitchTheme from './components/switch';
|
|
39
40
|
import getTabsTheme from './components/tabs';
|
|
@@ -82,6 +83,7 @@ type Theme = GlobalTheme & {
|
|
|
82
83
|
skeleton: ReturnType<typeof getSkeletonTheme>;
|
|
83
84
|
slider: ReturnType<typeof getSliderTheme>;
|
|
84
85
|
spinner: ReturnType<typeof getSpinnerTheme>;
|
|
86
|
+
success: ReturnType<typeof getSuccessTheme>;
|
|
85
87
|
swipeable: ReturnType<typeof getSwipeableTheme>;
|
|
86
88
|
switch: ReturnType<typeof getSwitchTheme>;
|
|
87
89
|
tabs: ReturnType<typeof getTabsTheme>;
|
|
@@ -136,6 +138,7 @@ const getTheme = (
|
|
|
136
138
|
skeleton: getSkeletonTheme(globalTheme),
|
|
137
139
|
slider: getSliderTheme(globalTheme),
|
|
138
140
|
spinner: getSpinnerTheme(globalTheme),
|
|
141
|
+
success: getSuccessTheme(globalTheme),
|
|
139
142
|
swipeable: getSwipeableTheme(globalTheme),
|
|
140
143
|
switch: getSwitchTheme(globalTheme),
|
|
141
144
|
tabs: getTabsTheme(globalTheme),
|
package/src/utils/hooks.ts
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Modal, View } from 'react-native';
|
|
3
|
+
declare type SuccessVariant = 'full-screen' | 'in-page';
|
|
4
|
+
declare const StyledSuccessContainer: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
5
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
6
|
+
as?: import("react").ElementType<any> | undefined;
|
|
7
|
+
} & {
|
|
8
|
+
themeVariant: SuccessVariant;
|
|
9
|
+
}, {}, {
|
|
10
|
+
ref?: import("react").Ref<View> | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
declare const StyledSuccessImage: import("@emotion/native").StyledComponent<import("../Image").ImageProps & {
|
|
13
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
14
|
+
as?: import("react").ElementType<any> | undefined;
|
|
15
|
+
}, {}, {}>;
|
|
16
|
+
declare const StyledSuccessContent: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
17
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
18
|
+
as?: import("react").ElementType<any> | undefined;
|
|
19
|
+
}, {}, {
|
|
20
|
+
ref?: import("react").Ref<View> | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
declare const StyledSuccessImageContainer: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
23
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
24
|
+
as?: import("react").ElementType<any> | undefined;
|
|
25
|
+
}, {}, {
|
|
26
|
+
ref?: import("react").Ref<View> | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
declare const StyledSuccessTitle: import("@emotion/native").StyledComponent<import("../..").TextProps & {
|
|
29
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
30
|
+
as?: import("react").ElementType<any> | undefined;
|
|
31
|
+
}, {}, {}>;
|
|
32
|
+
declare const StyledSuccessDescription: import("@emotion/native").StyledComponent<import("../..").TextProps & {
|
|
33
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
34
|
+
as?: import("react").ElementType<any> | undefined;
|
|
35
|
+
}, {}, {}>;
|
|
36
|
+
declare const StyledSuccessButtonContainer: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
37
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
38
|
+
as?: import("react").ElementType<any> | undefined;
|
|
39
|
+
}, {}, {
|
|
40
|
+
ref?: import("react").Ref<View> | undefined;
|
|
41
|
+
}>;
|
|
42
|
+
declare const StyledSuccessButtonPrimary: import("@emotion/native").StyledComponent<import("../Button/Button").ButtonProps & {
|
|
43
|
+
children?: import("react").ReactNode;
|
|
44
|
+
} & {
|
|
45
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
46
|
+
as?: import("react").ElementType<any> | undefined;
|
|
47
|
+
}, {}, {}>;
|
|
48
|
+
declare const StyledSuccessModal: import("@emotion/native").StyledComponent<import("react-native").ModalBaseProps & import("react-native").ModalPropsIOS & import("react-native").ModalPropsAndroid & import("react-native").ViewProps & {
|
|
49
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
50
|
+
as?: import("react").ElementType<any> | undefined;
|
|
51
|
+
}, {}, {
|
|
52
|
+
ref?: import("react").Ref<Modal> | undefined;
|
|
53
|
+
}>;
|
|
54
|
+
export { SuccessVariant, StyledSuccessImage, StyledSuccessContainer, StyledSuccessContent, StyledSuccessImageContainer, StyledSuccessTitle, StyledSuccessDescription, StyledSuccessButtonContainer, StyledSuccessButtonPrimary, StyledSuccessModal, };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import type { ViewProps, ImageSourcePropType, ImageProps as RNImageProps } from 'react-native';
|
|
3
|
+
import { SuccessVariant } from './StyledSuccess';
|
|
4
|
+
import { ImageProps } from '../Image';
|
|
5
|
+
export interface SuccessProps extends ViewProps {
|
|
6
|
+
/**
|
|
7
|
+
* Image to be displayed.
|
|
8
|
+
*/
|
|
9
|
+
image?: ReactElement<ImageProps | RNImageProps> | ImageSourcePropType | string;
|
|
10
|
+
/**
|
|
11
|
+
* Success's title.
|
|
12
|
+
*/
|
|
13
|
+
title: string;
|
|
14
|
+
/**
|
|
15
|
+
* Success's description.
|
|
16
|
+
*/
|
|
17
|
+
description?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Success's variant.
|
|
20
|
+
*/
|
|
21
|
+
variant?: SuccessVariant;
|
|
22
|
+
/**
|
|
23
|
+
* Action button text
|
|
24
|
+
*/
|
|
25
|
+
ctaText?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Callback when the action button is pressed.
|
|
28
|
+
*/
|
|
29
|
+
onCtaPress?: () => void;
|
|
30
|
+
/**
|
|
31
|
+
* Testing id of the component.
|
|
32
|
+
*/
|
|
33
|
+
testID?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Renders success page
|
|
37
|
+
*
|
|
38
|
+
* @param {SuccessProps} props
|
|
39
|
+
* @return {*} {ReactElement}
|
|
40
|
+
*/
|
|
41
|
+
declare const Success: (props: SuccessProps) => ReactElement;
|
|
42
|
+
export default Success;
|
|
@@ -62,6 +62,10 @@ export interface TextInputProps extends NativeTextInputProps {
|
|
|
62
62
|
* If the max length is set, the input will display the current length and the max length.
|
|
63
63
|
* */
|
|
64
64
|
maxLength?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Whether to hide the character count.
|
|
67
|
+
* */
|
|
68
|
+
hideCharacterCount?: boolean;
|
|
65
69
|
/**
|
|
66
70
|
* The helper text to display.
|
|
67
71
|
*/
|
|
@@ -83,5 +87,5 @@ export declare const getVariant: ({ disabled, error, editable, loading, isEmptyV
|
|
|
83
87
|
isFocused?: boolean | undefined;
|
|
84
88
|
isEmptyValue?: boolean | undefined;
|
|
85
89
|
}) => Variant;
|
|
86
|
-
declare const TextInput: React.ForwardRefExoticComponent<Pick<TextInputProps, "children" | "label" | "style" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "disabled" | "value" | "onBlur" | "onFocus" | "onPressIn" | "onPressOut" | "allowFontScaling" | "numberOfLines" | "maxFontSizeMultiplier" | "selectionColor" | "textBreakStrategy" | "loading" | "accessibilityLabelledBy" | "textAlign" | "error" | "textAlignVertical" | "onContentSizeChange" | "onScroll" | "scrollEnabled" | "onChange" | "autoCapitalize" | "autoCorrect" | "autoFocus" | "blurOnSubmit" | "caretHidden" | "contextMenuHidden" | "defaultValue" | "editable" | "keyboardType" | "maxLength" | "multiline" | "onChangeText" | "onEndEditing" | "onSelectionChange" | "onSubmitEditing" | "onTextInput" | "onKeyPress" | "placeholder" | "placeholderTextColor" | "returnKeyType" | "secureTextEntry" | "selectTextOnFocus" | "selection" | "inputAccessoryViewID" | "clearButtonMode" | "clearTextOnFocus" | "dataDetectorTypes" | "enablesReturnKeyAutomatically" | "keyboardAppearance" | "passwordRules" | "rejectResponderTermination" | "selectionState" | "spellCheck" | "textContentType" | "autoComplete" | "importantForAutofill" | "disableFullscreenUI" | "inlineImageLeft" | "inlineImagePadding" | "returnKeyLabel" | "underlineColorAndroid" | "showSoftInputOnFocus" | "prefix" | "suffix" | "textStyle" | "required" | "helpText" | "renderInputValue"> & React.RefAttributes<TextInputHandles>>;
|
|
90
|
+
declare const TextInput: React.ForwardRefExoticComponent<Pick<TextInputProps, "children" | "label" | "style" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "disabled" | "value" | "onBlur" | "onFocus" | "onPressIn" | "onPressOut" | "allowFontScaling" | "numberOfLines" | "maxFontSizeMultiplier" | "selectionColor" | "textBreakStrategy" | "loading" | "accessibilityLabelledBy" | "textAlign" | "error" | "textAlignVertical" | "onContentSizeChange" | "onScroll" | "scrollEnabled" | "onChange" | "autoCapitalize" | "autoCorrect" | "autoFocus" | "blurOnSubmit" | "caretHidden" | "contextMenuHidden" | "defaultValue" | "editable" | "keyboardType" | "maxLength" | "multiline" | "onChangeText" | "onEndEditing" | "onSelectionChange" | "onSubmitEditing" | "onTextInput" | "onKeyPress" | "placeholder" | "placeholderTextColor" | "returnKeyType" | "secureTextEntry" | "selectTextOnFocus" | "selection" | "inputAccessoryViewID" | "clearButtonMode" | "clearTextOnFocus" | "dataDetectorTypes" | "enablesReturnKeyAutomatically" | "keyboardAppearance" | "passwordRules" | "rejectResponderTermination" | "selectionState" | "spellCheck" | "textContentType" | "autoComplete" | "importantForAutofill" | "disableFullscreenUI" | "inlineImageLeft" | "inlineImagePadding" | "returnKeyLabel" | "underlineColorAndroid" | "showSoftInputOnFocus" | "prefix" | "suffix" | "textStyle" | "required" | "hideCharacterCount" | "helpText" | "renderInputValue"> & React.RefAttributes<TextInputHandles>>;
|
|
87
91
|
export default TextInput;
|
package/types/index.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ import Radio from './components/Radio';
|
|
|
33
33
|
import SectionHeading from './components/SectionHeading';
|
|
34
34
|
import Select from './components/Select';
|
|
35
35
|
import Skeleton from './components/Skeleton';
|
|
36
|
+
import Success from './components/Success';
|
|
36
37
|
import Switch from './components/Switch';
|
|
37
38
|
import Tabs from './components/Tabs';
|
|
38
39
|
import Tag from './components/Tag';
|
|
@@ -44,5 +45,5 @@ import Typography from './components/Typography';
|
|
|
44
45
|
import RefreshControl from './components/RefreshControl';
|
|
45
46
|
import RichTextEditor from './components/RichTextEditor';
|
|
46
47
|
import PageControl from './components/PageControl';
|
|
47
|
-
export { theme, getTheme, useTheme, scale, ThemeProvider, ThemeSwitcher, withTheme, swagSystemPalette, swagDarkSystemPalette, workSystemPalette, jobsSystemPalette, walletSystemPalette, eBensSystemPalette, Accordion, Alert, Attachment, Avatar, useAvatarColors, Badge, BottomNavigation, BottomSheet, Box, Button, Calendar, Card, Carousel, Collapse, Checkbox, ContentNavigator, DatePicker, Divider, Drawer, Empty, Error, FAB, Icon, Image, List, PinInput, Progress, PageControl, Skeleton, Slider, Spinner, Swipeable, Radio, SectionHeading, Select, Switch, Tabs, Tag, TextInput, TimePicker, Toast, Toolbar, Typography, RefreshControl, RichTextEditor, };
|
|
48
|
+
export { theme, getTheme, useTheme, scale, ThemeProvider, ThemeSwitcher, withTheme, swagSystemPalette, swagDarkSystemPalette, workSystemPalette, jobsSystemPalette, walletSystemPalette, eBensSystemPalette, Accordion, Alert, Attachment, Avatar, useAvatarColors, Badge, BottomNavigation, BottomSheet, Box, Button, Calendar, Card, Carousel, Collapse, Checkbox, ContentNavigator, DatePicker, Divider, Drawer, Empty, Error, FAB, Icon, Image, List, PinInput, Progress, PageControl, Skeleton, Slider, Spinner, Swipeable, Radio, SectionHeading, Select, Success, Switch, Tabs, Tag, TextInput, TimePicker, Toast, Toolbar, Typography, RefreshControl, RichTextEditor, };
|
|
48
49
|
export * from './types';
|