@hero-design/rn 7.20.1 → 7.22.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/.eslintrc.js +11 -0
- package/.turbo/turbo-build.log +9 -9
- package/babel.config.js +1 -1
- package/es/index.js +714 -471
- package/lib/index.js +720 -474
- package/package.json +9 -15
- package/rollup.config.js +1 -0
- package/src/components/BottomNavigation/__tests__/index.spec.tsx +1 -1
- package/src/components/BottomNavigation/index.tsx +3 -3
- package/src/components/BottomSheet/index.tsx +6 -1
- package/src/components/Box/helpers.ts +1 -1
- package/src/components/Calendar/index.tsx +9 -9
- package/src/components/Checkbox/__tests__/__snapshots__/StyledCheckbox.spec.tsx.snap +4 -4
- package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +13 -13
- package/src/components/Collapse/index.tsx +1 -1
- package/src/components/Drawer/DragableDrawer/helpers.ts +7 -3
- package/src/components/Empty/StyledEmpty.tsx +1 -9
- package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +58 -5
- package/src/components/Empty/__tests__/index.spec.tsx +13 -0
- package/src/components/Empty/index.tsx +38 -18
- package/src/components/FAB/ActionGroup/index.tsx +1 -1
- package/src/components/Icon/HeroIcon/selection.json +7029 -1
- package/src/components/Image/__tests__/__snapshots__/index.spec.tsx.snap +81 -0
- package/src/components/Image/__tests__/index.spec.tsx +29 -0
- package/src/components/Image/index.tsx +46 -0
- package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +5 -5
- package/src/components/PinInput/index.tsx +1 -1
- package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +60 -60
- package/src/components/RichTextEditor/EditorToolbar.tsx +3 -3
- package/src/components/RichTextEditor/RichTextEditor.tsx +5 -5
- package/src/components/RichTextEditor/__tests__/EditorToolbar.spec.tsx +2 -2
- package/src/components/RichTextEditor/__tests__/MentionList.spec.tsx +1 -1
- package/src/components/RichTextEditor/__tests__/__snapshots__/EditorToolbar.spec.tsx.snap +2 -2
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +2 -2
- package/src/components/Select/MultiSelect/OptionList.tsx +5 -7
- package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +21 -0
- package/src/components/Select/MultiSelect/index.tsx +35 -5
- package/src/components/Select/SingleSelect/OptionList.tsx +4 -5
- package/src/components/Select/SingleSelect/__tests__/index.spec.tsx +16 -0
- package/src/components/Select/SingleSelect/index.tsx +36 -6
- package/src/components/Select/StyledOptionList.tsx +3 -9
- package/src/components/Select/helpers.tsx +4 -4
- package/src/components/Slider/__tests__/__snapshots__/index.spec.tsx.snap +43 -0
- package/src/components/Slider/__tests__/index.spec.tsx +33 -0
- package/src/components/Slider/index.tsx +89 -0
- package/src/components/Switch/SelectorSwitch/Option.tsx +67 -0
- package/src/components/Switch/SelectorSwitch/StyledSelectorSwitch.tsx +25 -0
- package/src/components/Switch/SelectorSwitch/__tests__/Option.spec.tsx +61 -0
- package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/Option.spec.tsx.snap +195 -0
- package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/index.spec.tsx.snap +121 -0
- package/src/components/Switch/SelectorSwitch/__tests__/index.spec.tsx +62 -0
- package/src/components/Switch/SelectorSwitch/index.tsx +60 -0
- package/src/components/Switch/StyledSwitch.tsx +4 -4
- package/src/components/Switch/__tests__/__snapshots__/StyledSwitch.spec.tsx.snap +10 -10
- package/src/components/Switch/__tests__/__snapshots__/index.spec.tsx.snap +8 -8
- package/src/components/Switch/index.tsx +9 -5
- package/src/components/Tabs/ScrollableTabs.tsx +12 -5
- package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +1 -1
- package/src/components/Tabs/__tests__/index.spec.tsx +1 -1
- package/src/components/Tabs/index.tsx +13 -6
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +3 -1
- package/src/components/TextInput/__tests__/index.spec.tsx +114 -112
- package/src/components/TextInput/index.tsx +64 -59
- package/src/components/Toast/ToastContainer.tsx +6 -6
- package/src/index.ts +4 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +70 -23
- package/src/theme/components/alert.ts +1 -2
- package/src/theme/components/avatar.ts +8 -8
- package/src/theme/components/badge.ts +4 -4
- package/src/theme/components/bottomNavigation.ts +1 -1
- package/src/theme/components/bottomSheet.ts +2 -3
- package/src/theme/components/calendar.ts +9 -7
- package/src/theme/components/card.ts +1 -1
- package/src/theme/components/checkbox.ts +2 -5
- package/src/theme/components/datePicker.ts +3 -3
- package/src/theme/components/drawer.ts +2 -3
- package/src/theme/components/empty.ts +3 -8
- package/src/theme/components/fab.ts +2 -2
- package/src/theme/components/image.ts +12 -0
- package/src/theme/components/pinInput.ts +3 -3
- package/src/theme/components/progress.ts +2 -3
- package/src/theme/components/radio.ts +7 -3
- package/src/theme/components/richTextEditor.ts +4 -4
- package/src/theme/components/slider.ts +13 -0
- package/src/theme/components/switch.ts +28 -17
- package/src/theme/components/tabs.ts +1 -1
- package/src/theme/components/timePicker.ts +3 -3
- package/src/theme/components/toast.ts +1 -2
- package/src/theme/getTheme.ts +9 -2
- package/src/theme/global/colors/swag.ts +2 -0
- package/src/theme/global/colors/types.ts +2 -0
- package/src/theme/global/index.ts +3 -0
- package/src/theme/global/scale.ts +3 -0
- package/src/theme/global/sizes.ts +29 -0
- package/testUtils/setup.tsx +15 -1
- package/tsconfig.json +1 -1
- package/types/components/BottomSheet/index.d.ts +5 -1
- package/types/components/Empty/StyledEmpty.d.ts +1 -7
- package/types/components/Empty/index.d.ts +8 -2
- package/types/components/Image/__tests__/index.spec.d.ts +1 -0
- package/types/components/Image/index.d.ts +17 -0
- package/types/components/Select/MultiSelect/OptionList.d.ts +5 -2
- package/types/components/Select/MultiSelect/index.d.ts +7 -1
- package/types/components/Select/SingleSelect/OptionList.d.ts +5 -2
- package/types/components/Select/SingleSelect/index.d.ts +8 -2
- package/types/components/Select/StyledOptionList.d.ts +4 -3
- package/types/components/Select/index.d.ts +1 -1
- package/types/components/Slider/__tests__/index.spec.d.ts +1 -0
- package/types/components/Slider/index.d.ts +52 -0
- package/types/components/Switch/SelectorSwitch/Option.d.ts +10 -0
- package/types/components/Switch/SelectorSwitch/StyledSelectorSwitch.d.ts +19 -0
- package/types/components/Switch/SelectorSwitch/__tests__/Option.spec.d.ts +1 -0
- package/types/components/Switch/SelectorSwitch/__tests__/index.spec.d.ts +1 -0
- package/types/components/Switch/SelectorSwitch/index.d.ts +37 -0
- package/types/components/Switch/index.d.ts +5 -3
- package/types/components/Tabs/ScrollableTabs.d.ts +1 -1
- package/types/components/Tabs/index.d.ts +2 -2
- package/types/components/TextInput/index.d.ts +6 -5
- package/types/index.d.ts +3 -1
- package/types/theme/components/datePicker.d.ts +2 -1
- package/types/theme/components/empty.d.ts +2 -5
- package/types/theme/components/image.d.ts +8 -0
- package/types/theme/components/slider.d.ts +9 -0
- package/types/theme/components/switch.d.ts +27 -12
- package/types/theme/components/timePicker.d.ts +2 -1
- package/types/theme/getTheme.d.ts +4 -0
- package/types/theme/global/colors/types.d.ts +2 -0
- package/types/theme/global/index.d.ts +3 -0
- package/types/theme/global/scale.d.ts +1 -0
- package/types/theme/global/sizes.d.ts +14 -0
- package/.eslintrc.json +0 -61
- package/.prettierrc.json +0 -8
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Image renders correctly when rounded is false 1`] = `
|
|
4
|
+
<Image
|
|
5
|
+
source={
|
|
6
|
+
Object {
|
|
7
|
+
"uri": "path_to_image",
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
style={
|
|
11
|
+
Array [
|
|
12
|
+
Object {
|
|
13
|
+
"borderRadius": 0,
|
|
14
|
+
"height": 72,
|
|
15
|
+
"width": 72,
|
|
16
|
+
},
|
|
17
|
+
undefined,
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
/>
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
exports[`Image renders correctly when rounded is true 1`] = `
|
|
24
|
+
<Image
|
|
25
|
+
source={
|
|
26
|
+
Object {
|
|
27
|
+
"uri": "path_to_image",
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
style={
|
|
31
|
+
Array [
|
|
32
|
+
Object {
|
|
33
|
+
"borderRadius": 36,
|
|
34
|
+
"height": 72,
|
|
35
|
+
"width": 72,
|
|
36
|
+
},
|
|
37
|
+
undefined,
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
/>
|
|
41
|
+
`;
|
|
42
|
+
|
|
43
|
+
exports[`Image renders correctly when size is 6xlarge 1`] = `
|
|
44
|
+
<Image
|
|
45
|
+
source={
|
|
46
|
+
Object {
|
|
47
|
+
"uri": "path_to_image",
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
style={
|
|
51
|
+
Array [
|
|
52
|
+
Object {
|
|
53
|
+
"borderRadius": 0,
|
|
54
|
+
"height": 72,
|
|
55
|
+
"width": 72,
|
|
56
|
+
},
|
|
57
|
+
undefined,
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
/>
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
exports[`Image renders correctly when size is 15xlarge 1`] = `
|
|
64
|
+
<Image
|
|
65
|
+
source={
|
|
66
|
+
Object {
|
|
67
|
+
"uri": "path_to_image",
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
style={
|
|
71
|
+
Array [
|
|
72
|
+
Object {
|
|
73
|
+
"borderRadius": 0,
|
|
74
|
+
"height": 144,
|
|
75
|
+
"width": 144,
|
|
76
|
+
},
|
|
77
|
+
undefined,
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
/>
|
|
81
|
+
`;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Image from '..';
|
|
3
|
+
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
4
|
+
|
|
5
|
+
describe('Image', () => {
|
|
6
|
+
it.each`
|
|
7
|
+
size
|
|
8
|
+
${'6xlarge'}
|
|
9
|
+
${'15xlarge'}
|
|
10
|
+
`('renders correctly when size is $size', ({ size }) => {
|
|
11
|
+
const { toJSON } = renderWithTheme(
|
|
12
|
+
<Image size={size} source={{ uri: 'path_to_image' }} />
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
expect(toJSON()).toMatchSnapshot();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it.each`
|
|
19
|
+
rounded
|
|
20
|
+
${true}
|
|
21
|
+
${false}
|
|
22
|
+
`('renders correctly when rounded is $rounded', ({ rounded }) => {
|
|
23
|
+
const { toJSON } = renderWithTheme(
|
|
24
|
+
<Image rounded={rounded} source={{ uri: 'path_to_image' }} />
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
expect(toJSON()).toMatchSnapshot();
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Image as RNImage } from 'react-native';
|
|
3
|
+
import type { ImageProps as RNImageProps } from 'react-native';
|
|
4
|
+
import { useTheme } from '../../theme';
|
|
5
|
+
|
|
6
|
+
export interface ImageProps extends RNImageProps {
|
|
7
|
+
/**
|
|
8
|
+
* Whether the image is rounded.
|
|
9
|
+
*/
|
|
10
|
+
rounded?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Image sizes, following the same sizes as the `sizes` global theme.
|
|
13
|
+
*/
|
|
14
|
+
size?: '6xlarge' | '15xlarge';
|
|
15
|
+
/**
|
|
16
|
+
* Testing id of the component.
|
|
17
|
+
*/
|
|
18
|
+
testID?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const Image = ({
|
|
22
|
+
rounded = false,
|
|
23
|
+
size = '6xlarge',
|
|
24
|
+
testID,
|
|
25
|
+
style,
|
|
26
|
+
...imageNativeProps
|
|
27
|
+
}: ImageProps): JSX.Element => {
|
|
28
|
+
const theme = useTheme();
|
|
29
|
+
const imageSize = theme.__hd__.image.sizes[size];
|
|
30
|
+
return (
|
|
31
|
+
<RNImage
|
|
32
|
+
testID={testID}
|
|
33
|
+
style={[
|
|
34
|
+
{
|
|
35
|
+
width: imageSize,
|
|
36
|
+
height: imageSize,
|
|
37
|
+
borderRadius: rounded ? imageSize / 2 : 0,
|
|
38
|
+
},
|
|
39
|
+
style,
|
|
40
|
+
]}
|
|
41
|
+
{...imageNativeProps}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default Image;
|
|
@@ -732,10 +732,10 @@ exports[`ListItem renders correctly ListItem with prefix suffix is React.Element
|
|
|
732
732
|
"backgroundColor": "#8505a2",
|
|
733
733
|
"borderRadius": 999,
|
|
734
734
|
"display": "flex",
|
|
735
|
-
"height":
|
|
735
|
+
"height": 32,
|
|
736
736
|
"justifyContent": "center",
|
|
737
737
|
"paddingHorizontal": 4,
|
|
738
|
-
"width":
|
|
738
|
+
"width": 64,
|
|
739
739
|
},
|
|
740
740
|
undefined,
|
|
741
741
|
]
|
|
@@ -751,9 +751,9 @@ exports[`ListItem renders correctly ListItem with prefix suffix is React.Element
|
|
|
751
751
|
Object {
|
|
752
752
|
"backgroundColor": "#ffffff",
|
|
753
753
|
"borderRadius": 999,
|
|
754
|
-
"height":
|
|
755
|
-
"left":
|
|
756
|
-
"width":
|
|
754
|
+
"height": 24,
|
|
755
|
+
"left": 32,
|
|
756
|
+
"width": 24,
|
|
757
757
|
}
|
|
758
758
|
}
|
|
759
759
|
themeSize="medium"
|
|
@@ -123,7 +123,7 @@ function PinInput({
|
|
|
123
123
|
return (
|
|
124
124
|
<StyledWrapper style={style} testID={testID}>
|
|
125
125
|
<StyledPinWrapper>
|
|
126
|
-
{[...Array(length).keys()].map(index => (
|
|
126
|
+
{[...Array(length).keys()].map((index) => (
|
|
127
127
|
<React.Fragment key={index}>
|
|
128
128
|
{index !== 0 && <StyledSpacer />}
|
|
129
129
|
<PinCell
|
|
@@ -96,9 +96,9 @@ exports[`Progress.Circle renders correctly 1`] = `
|
|
|
96
96
|
style={
|
|
97
97
|
Array [
|
|
98
98
|
Object {
|
|
99
|
-
"height":
|
|
99
|
+
"height": 72,
|
|
100
100
|
"overflow": "hidden",
|
|
101
|
-
"width":
|
|
101
|
+
"width": 36,
|
|
102
102
|
},
|
|
103
103
|
undefined,
|
|
104
104
|
]
|
|
@@ -110,8 +110,8 @@ exports[`Progress.Circle renders correctly 1`] = `
|
|
|
110
110
|
Object {
|
|
111
111
|
"backgroundColor": "#8505a2",
|
|
112
112
|
"borderRadius": 999,
|
|
113
|
-
"height":
|
|
114
|
-
"width":
|
|
113
|
+
"height": 72,
|
|
114
|
+
"width": 72,
|
|
115
115
|
},
|
|
116
116
|
undefined,
|
|
117
117
|
]
|
|
@@ -131,13 +131,13 @@ exports[`Progress.Circle renders correctly 1`] = `
|
|
|
131
131
|
"top": 0,
|
|
132
132
|
"transform": Array [
|
|
133
133
|
Object {
|
|
134
|
-
"translateX":
|
|
134
|
+
"translateX": 18,
|
|
135
135
|
},
|
|
136
136
|
Object {
|
|
137
137
|
"rotate": "0deg",
|
|
138
138
|
},
|
|
139
139
|
Object {
|
|
140
|
-
"translateX": -
|
|
140
|
+
"translateX": -18,
|
|
141
141
|
},
|
|
142
142
|
],
|
|
143
143
|
}
|
|
@@ -147,9 +147,9 @@ exports[`Progress.Circle renders correctly 1`] = `
|
|
|
147
147
|
style={
|
|
148
148
|
Array [
|
|
149
149
|
Object {
|
|
150
|
-
"height":
|
|
150
|
+
"height": 72,
|
|
151
151
|
"overflow": "hidden",
|
|
152
|
-
"width":
|
|
152
|
+
"width": 36,
|
|
153
153
|
},
|
|
154
154
|
undefined,
|
|
155
155
|
]
|
|
@@ -161,8 +161,8 @@ exports[`Progress.Circle renders correctly 1`] = `
|
|
|
161
161
|
Object {
|
|
162
162
|
"backgroundColor": "#e8e9ea",
|
|
163
163
|
"borderRadius": 999,
|
|
164
|
-
"height":
|
|
165
|
-
"width":
|
|
164
|
+
"height": 72,
|
|
165
|
+
"width": 72,
|
|
166
166
|
},
|
|
167
167
|
undefined,
|
|
168
168
|
]
|
|
@@ -188,9 +188,9 @@ exports[`Progress.Circle renders correctly 1`] = `
|
|
|
188
188
|
style={
|
|
189
189
|
Array [
|
|
190
190
|
Object {
|
|
191
|
-
"height":
|
|
191
|
+
"height": 72,
|
|
192
192
|
"overflow": "hidden",
|
|
193
|
-
"width":
|
|
193
|
+
"width": 36,
|
|
194
194
|
},
|
|
195
195
|
undefined,
|
|
196
196
|
]
|
|
@@ -202,8 +202,8 @@ exports[`Progress.Circle renders correctly 1`] = `
|
|
|
202
202
|
Object {
|
|
203
203
|
"backgroundColor": "#8505a2",
|
|
204
204
|
"borderRadius": 999,
|
|
205
|
-
"height":
|
|
206
|
-
"width":
|
|
205
|
+
"height": 72,
|
|
206
|
+
"width": 72,
|
|
207
207
|
},
|
|
208
208
|
undefined,
|
|
209
209
|
]
|
|
@@ -224,13 +224,13 @@ exports[`Progress.Circle renders correctly 1`] = `
|
|
|
224
224
|
"top": 0,
|
|
225
225
|
"transform": Array [
|
|
226
226
|
Object {
|
|
227
|
-
"translateX":
|
|
227
|
+
"translateX": 18,
|
|
228
228
|
},
|
|
229
229
|
Object {
|
|
230
230
|
"rotate": "0deg",
|
|
231
231
|
},
|
|
232
232
|
Object {
|
|
233
|
-
"translateX": -
|
|
233
|
+
"translateX": -18,
|
|
234
234
|
},
|
|
235
235
|
],
|
|
236
236
|
}
|
|
@@ -240,9 +240,9 @@ exports[`Progress.Circle renders correctly 1`] = `
|
|
|
240
240
|
style={
|
|
241
241
|
Array [
|
|
242
242
|
Object {
|
|
243
|
-
"height":
|
|
243
|
+
"height": 72,
|
|
244
244
|
"overflow": "hidden",
|
|
245
|
-
"width":
|
|
245
|
+
"width": 36,
|
|
246
246
|
},
|
|
247
247
|
undefined,
|
|
248
248
|
]
|
|
@@ -254,8 +254,8 @@ exports[`Progress.Circle renders correctly 1`] = `
|
|
|
254
254
|
Object {
|
|
255
255
|
"backgroundColor": "#e8e9ea",
|
|
256
256
|
"borderRadius": 999,
|
|
257
|
-
"height":
|
|
258
|
-
"width":
|
|
257
|
+
"height": 72,
|
|
258
|
+
"width": 72,
|
|
259
259
|
},
|
|
260
260
|
undefined,
|
|
261
261
|
]
|
|
@@ -270,11 +270,11 @@ exports[`Progress.Circle renders correctly 1`] = `
|
|
|
270
270
|
Object {
|
|
271
271
|
"backgroundColor": "#8505a2",
|
|
272
272
|
"borderRadius": 999,
|
|
273
|
-
"height": 5.
|
|
274
|
-
"left":
|
|
273
|
+
"height": 5.3999999999999995,
|
|
274
|
+
"left": 33.3,
|
|
275
275
|
"position": "absolute",
|
|
276
276
|
"top": 0,
|
|
277
|
-
"width": 5.
|
|
277
|
+
"width": 5.3999999999999995,
|
|
278
278
|
"zIndex": 2,
|
|
279
279
|
},
|
|
280
280
|
undefined,
|
|
@@ -307,11 +307,11 @@ exports[`Progress.Circle renders correctly 1`] = `
|
|
|
307
307
|
Object {
|
|
308
308
|
"backgroundColor": "#8505a2",
|
|
309
309
|
"borderRadius": 999,
|
|
310
|
-
"height": 5.
|
|
311
|
-
"left":
|
|
310
|
+
"height": 5.3999999999999995,
|
|
311
|
+
"left": 33.3,
|
|
312
312
|
"position": "absolute",
|
|
313
313
|
"top": 0,
|
|
314
|
-
"width": 5.
|
|
314
|
+
"width": 5.3999999999999995,
|
|
315
315
|
"zIndex": 2,
|
|
316
316
|
},
|
|
317
317
|
undefined,
|
|
@@ -327,12 +327,12 @@ exports[`Progress.Circle renders correctly 1`] = `
|
|
|
327
327
|
"alignItems": "center",
|
|
328
328
|
"backgroundColor": "#ffffff",
|
|
329
329
|
"borderRadius": 999,
|
|
330
|
-
"height":
|
|
330
|
+
"height": 61.199999999999996,
|
|
331
331
|
"justifyContent": "center",
|
|
332
|
-
"left": 5.
|
|
332
|
+
"left": 5.3999999999999995,
|
|
333
333
|
"position": "absolute",
|
|
334
|
-
"top": 5.
|
|
335
|
-
"width":
|
|
334
|
+
"top": 5.3999999999999995,
|
|
335
|
+
"width": 61.199999999999996,
|
|
336
336
|
"zIndex": 3,
|
|
337
337
|
},
|
|
338
338
|
undefined,
|
|
@@ -383,9 +383,9 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
|
|
|
383
383
|
style={
|
|
384
384
|
Array [
|
|
385
385
|
Object {
|
|
386
|
-
"height":
|
|
386
|
+
"height": 72,
|
|
387
387
|
"overflow": "hidden",
|
|
388
|
-
"width":
|
|
388
|
+
"width": 36,
|
|
389
389
|
},
|
|
390
390
|
undefined,
|
|
391
391
|
]
|
|
@@ -397,8 +397,8 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
|
|
|
397
397
|
Object {
|
|
398
398
|
"backgroundColor": "#5ace7d",
|
|
399
399
|
"borderRadius": 999,
|
|
400
|
-
"height":
|
|
401
|
-
"width":
|
|
400
|
+
"height": 72,
|
|
401
|
+
"width": 72,
|
|
402
402
|
},
|
|
403
403
|
undefined,
|
|
404
404
|
]
|
|
@@ -418,13 +418,13 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
|
|
|
418
418
|
"top": 0,
|
|
419
419
|
"transform": Array [
|
|
420
420
|
Object {
|
|
421
|
-
"translateX":
|
|
421
|
+
"translateX": 18,
|
|
422
422
|
},
|
|
423
423
|
Object {
|
|
424
424
|
"rotate": "0deg",
|
|
425
425
|
},
|
|
426
426
|
Object {
|
|
427
|
-
"translateX": -
|
|
427
|
+
"translateX": -18,
|
|
428
428
|
},
|
|
429
429
|
],
|
|
430
430
|
}
|
|
@@ -434,9 +434,9 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
|
|
|
434
434
|
style={
|
|
435
435
|
Array [
|
|
436
436
|
Object {
|
|
437
|
-
"height":
|
|
437
|
+
"height": 72,
|
|
438
438
|
"overflow": "hidden",
|
|
439
|
-
"width":
|
|
439
|
+
"width": 36,
|
|
440
440
|
},
|
|
441
441
|
undefined,
|
|
442
442
|
]
|
|
@@ -448,8 +448,8 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
|
|
|
448
448
|
Object {
|
|
449
449
|
"backgroundColor": "#e8e9ea",
|
|
450
450
|
"borderRadius": 999,
|
|
451
|
-
"height":
|
|
452
|
-
"width":
|
|
451
|
+
"height": 72,
|
|
452
|
+
"width": 72,
|
|
453
453
|
},
|
|
454
454
|
undefined,
|
|
455
455
|
]
|
|
@@ -475,9 +475,9 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
|
|
|
475
475
|
style={
|
|
476
476
|
Array [
|
|
477
477
|
Object {
|
|
478
|
-
"height":
|
|
478
|
+
"height": 72,
|
|
479
479
|
"overflow": "hidden",
|
|
480
|
-
"width":
|
|
480
|
+
"width": 36,
|
|
481
481
|
},
|
|
482
482
|
undefined,
|
|
483
483
|
]
|
|
@@ -489,8 +489,8 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
|
|
|
489
489
|
Object {
|
|
490
490
|
"backgroundColor": "#5ace7d",
|
|
491
491
|
"borderRadius": 999,
|
|
492
|
-
"height":
|
|
493
|
-
"width":
|
|
492
|
+
"height": 72,
|
|
493
|
+
"width": 72,
|
|
494
494
|
},
|
|
495
495
|
undefined,
|
|
496
496
|
]
|
|
@@ -511,13 +511,13 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
|
|
|
511
511
|
"top": 0,
|
|
512
512
|
"transform": Array [
|
|
513
513
|
Object {
|
|
514
|
-
"translateX":
|
|
514
|
+
"translateX": 18,
|
|
515
515
|
},
|
|
516
516
|
Object {
|
|
517
517
|
"rotate": "0deg",
|
|
518
518
|
},
|
|
519
519
|
Object {
|
|
520
|
-
"translateX": -
|
|
520
|
+
"translateX": -18,
|
|
521
521
|
},
|
|
522
522
|
],
|
|
523
523
|
}
|
|
@@ -527,9 +527,9 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
|
|
|
527
527
|
style={
|
|
528
528
|
Array [
|
|
529
529
|
Object {
|
|
530
|
-
"height":
|
|
530
|
+
"height": 72,
|
|
531
531
|
"overflow": "hidden",
|
|
532
|
-
"width":
|
|
532
|
+
"width": 36,
|
|
533
533
|
},
|
|
534
534
|
undefined,
|
|
535
535
|
]
|
|
@@ -541,8 +541,8 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
|
|
|
541
541
|
Object {
|
|
542
542
|
"backgroundColor": "#e8e9ea",
|
|
543
543
|
"borderRadius": 999,
|
|
544
|
-
"height":
|
|
545
|
-
"width":
|
|
544
|
+
"height": 72,
|
|
545
|
+
"width": 72,
|
|
546
546
|
},
|
|
547
547
|
undefined,
|
|
548
548
|
]
|
|
@@ -557,11 +557,11 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
|
|
|
557
557
|
Object {
|
|
558
558
|
"backgroundColor": "#5ace7d",
|
|
559
559
|
"borderRadius": 999,
|
|
560
|
-
"height": 5.
|
|
561
|
-
"left":
|
|
560
|
+
"height": 5.3999999999999995,
|
|
561
|
+
"left": 33.3,
|
|
562
562
|
"position": "absolute",
|
|
563
563
|
"top": 0,
|
|
564
|
-
"width": 5.
|
|
564
|
+
"width": 5.3999999999999995,
|
|
565
565
|
"zIndex": 2,
|
|
566
566
|
},
|
|
567
567
|
undefined,
|
|
@@ -594,11 +594,11 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
|
|
|
594
594
|
Object {
|
|
595
595
|
"backgroundColor": "#5ace7d",
|
|
596
596
|
"borderRadius": 999,
|
|
597
|
-
"height": 5.
|
|
598
|
-
"left":
|
|
597
|
+
"height": 5.3999999999999995,
|
|
598
|
+
"left": 33.3,
|
|
599
599
|
"position": "absolute",
|
|
600
600
|
"top": 0,
|
|
601
|
-
"width": 5.
|
|
601
|
+
"width": 5.3999999999999995,
|
|
602
602
|
"zIndex": 2,
|
|
603
603
|
},
|
|
604
604
|
undefined,
|
|
@@ -614,12 +614,12 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
|
|
|
614
614
|
"alignItems": "center",
|
|
615
615
|
"backgroundColor": "#ffffff",
|
|
616
616
|
"borderRadius": 999,
|
|
617
|
-
"height":
|
|
617
|
+
"height": 61.199999999999996,
|
|
618
618
|
"justifyContent": "center",
|
|
619
|
-
"left": 5.
|
|
619
|
+
"left": 5.3999999999999995,
|
|
620
620
|
"position": "absolute",
|
|
621
|
-
"top": 5.
|
|
622
|
-
"width":
|
|
621
|
+
"top": 5.3999999999999995,
|
|
622
|
+
"width": 61.199999999999996,
|
|
623
623
|
"zIndex": 3,
|
|
624
624
|
},
|
|
625
625
|
undefined,
|
|
@@ -152,8 +152,8 @@ const EditorToolbar = ({
|
|
|
152
152
|
const isStandalone =
|
|
153
153
|
currentButtonConfig && currentButtonConfig.standalone;
|
|
154
154
|
|
|
155
|
-
setToolbarButtonArray(prevState =>
|
|
156
|
-
prevState.map(updatingButton => {
|
|
155
|
+
setToolbarButtonArray((prevState) =>
|
|
156
|
+
prevState.map((updatingButton) => {
|
|
157
157
|
if (updatingButton.buttonName === currentButtonName) {
|
|
158
158
|
return {
|
|
159
159
|
...updatingButton,
|
|
@@ -180,7 +180,7 @@ const EditorToolbar = ({
|
|
|
180
180
|
|
|
181
181
|
const toolbarButtons = useMemo(
|
|
182
182
|
() =>
|
|
183
|
-
toolbarButtonArray.map(button => {
|
|
183
|
+
toolbarButtonArray.map((button) => {
|
|
184
184
|
if (button.buttonName === '|') {
|
|
185
185
|
return <StyledSeparator key={button.id} />;
|
|
186
186
|
}
|
|
@@ -221,8 +221,8 @@ const RichTextEditor: ComponentType<RichTextEditorProps> = ({
|
|
|
221
221
|
/* Forward events from Toolbar and MentionList to webview */
|
|
222
222
|
useEffect(() => {
|
|
223
223
|
const toolbarEventListenerRemovers = Object.values(ToolbarEvents).map(
|
|
224
|
-
eventName =>
|
|
225
|
-
Events.on(emitter, normalizeEventName(eventName), data => {
|
|
224
|
+
(eventName) =>
|
|
225
|
+
Events.on(emitter, normalizeEventName(eventName), (data) => {
|
|
226
226
|
postMessageToWebview({
|
|
227
227
|
type: `@hero-editor/webview/${eventName}`,
|
|
228
228
|
data,
|
|
@@ -233,7 +233,7 @@ const RichTextEditor: ComponentType<RichTextEditorProps> = ({
|
|
|
233
233
|
const removeMentionApplyListener = Events.on(
|
|
234
234
|
emitter,
|
|
235
235
|
normalizeEventName('mention-apply'),
|
|
236
|
-
data =>
|
|
236
|
+
(data) =>
|
|
237
237
|
postMessageToWebview({
|
|
238
238
|
type: '@hero-editor/webview/mention-apply',
|
|
239
239
|
data,
|
|
@@ -242,7 +242,7 @@ const RichTextEditor: ComponentType<RichTextEditorProps> = ({
|
|
|
242
242
|
|
|
243
243
|
return () => {
|
|
244
244
|
removeMentionApplyListener();
|
|
245
|
-
toolbarEventListenerRemovers.forEach(remover => remover());
|
|
245
|
+
toolbarEventListenerRemovers.forEach((remover) => remover());
|
|
246
246
|
};
|
|
247
247
|
}, []);
|
|
248
248
|
|
|
@@ -350,7 +350,7 @@ const RichTextEditor: ComponentType<RichTextEditorProps> = ({
|
|
|
350
350
|
)}
|
|
351
351
|
</StyledLabelContainerInsideTextInput>
|
|
352
352
|
)}
|
|
353
|
-
<TouchableWithoutFeedback onPress={e => e.stopPropagation()}>
|
|
353
|
+
<TouchableWithoutFeedback onPress={(e) => e.stopPropagation()}>
|
|
354
354
|
<StyledWebView
|
|
355
355
|
ref={webview}
|
|
356
356
|
testID="webview"
|
|
@@ -37,7 +37,7 @@ describe('EditorToolbar', () => {
|
|
|
37
37
|
'format-list-numbered',
|
|
38
38
|
'format-heading1',
|
|
39
39
|
'format-heading2',
|
|
40
|
-
].forEach(testId => {
|
|
40
|
+
].forEach((testId) => {
|
|
41
41
|
expect(wrapper.queryAllByTestId(testId)).toHaveLength(1);
|
|
42
42
|
});
|
|
43
43
|
});
|
|
@@ -105,7 +105,7 @@ describe('EditorToolbar', () => {
|
|
|
105
105
|
'format-list-numbered',
|
|
106
106
|
'format-heading1',
|
|
107
107
|
];
|
|
108
|
-
standaloneButtonTestIDs.forEach(testID => {
|
|
108
|
+
standaloneButtonTestIDs.forEach((testID) => {
|
|
109
109
|
expect(wrapper.getByTestId(testID)).toHaveStyle({
|
|
110
110
|
backgroundColor: undefined,
|
|
111
111
|
});
|
|
@@ -23,7 +23,7 @@ const SuggestionList = ({
|
|
|
23
23
|
searchValue: string;
|
|
24
24
|
onSelect: (id: string, name: string) => void;
|
|
25
25
|
}) => {
|
|
26
|
-
const filteredData = SuggestionListData.filter(item =>
|
|
26
|
+
const filteredData = SuggestionListData.filter((item) =>
|
|
27
27
|
item.name.includes(searchValue)
|
|
28
28
|
);
|
|
29
29
|
|
|
@@ -143,7 +143,7 @@ exports[`EditorToolbar when the editor is focused should render toolbar 1`] = `
|
|
|
143
143
|
"flexDirection": "row",
|
|
144
144
|
"height": 16,
|
|
145
145
|
"marginHorizontal": 8,
|
|
146
|
-
"width":
|
|
146
|
+
"width": 2,
|
|
147
147
|
},
|
|
148
148
|
undefined,
|
|
149
149
|
]
|
|
@@ -236,7 +236,7 @@ exports[`EditorToolbar when the editor is focused should render toolbar 1`] = `
|
|
|
236
236
|
"flexDirection": "row",
|
|
237
237
|
"height": 16,
|
|
238
238
|
"marginHorizontal": 8,
|
|
239
|
-
"width":
|
|
239
|
+
"width": 2,
|
|
240
240
|
},
|
|
241
241
|
undefined,
|
|
242
242
|
]
|
|
@@ -165,7 +165,7 @@ exports[`RichTextEditor onMessage recevied event editor-layout should update hei
|
|
|
165
165
|
"fontSize": 14,
|
|
166
166
|
"height": 480,
|
|
167
167
|
"marginHorizontal": 8,
|
|
168
|
-
"minHeight":
|
|
168
|
+
"minHeight": 24,
|
|
169
169
|
"textAlignVertical": "center",
|
|
170
170
|
},
|
|
171
171
|
Object {
|
|
@@ -424,7 +424,7 @@ exports[`RichTextEditor should render correctly 1`] = `
|
|
|
424
424
|
"fontSize": 14,
|
|
425
425
|
"height": undefined,
|
|
426
426
|
"marginHorizontal": 8,
|
|
427
|
-
"minHeight":
|
|
427
|
+
"minHeight": 24,
|
|
428
428
|
"textAlignVertical": "center",
|
|
429
429
|
},
|
|
430
430
|
Object {
|