@hero-design/rn 8.82.2-alpha.2 → 8.83.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 +7 -0
- package/CHANGELOG.md +20 -0
- package/es/index.js +491 -21
- package/lib/index.js +490 -18
- package/package.json +6 -4
- package/rollup.config.mjs +1 -0
- package/src/components/AppCue/StyledAppCue.tsx +46 -0
- package/src/components/AppCue/__tests__/StyledAppCue.tsx +18 -0
- package/src/components/AppCue/__tests__/__snapshots__/StyledAppCue.tsx.snap +200 -0
- package/src/components/AppCue/__tests__/__snapshots__/index.spec.tsx.snap +391 -0
- package/src/components/AppCue/__tests__/index.spec.tsx +61 -0
- package/src/components/AppCue/__tests__/utils.spec.ts +90 -0
- package/src/components/AppCue/index.tsx +188 -0
- package/src/components/AppCue/utils.ts +122 -0
- package/src/components/Chip/StyledChip.tsx +9 -9
- package/src/components/Chip/__tests__/__snapshots__/index.spec.tsx.snap +434 -0
- package/src/components/Chip/__tests__/index.spec.tsx +4 -0
- package/src/components/Chip/index.tsx +32 -5
- package/src/components/Slider/RangeSlider.tsx +187 -0
- package/src/components/Slider/SingleSlider.tsx +89 -0
- package/src/components/Slider/StyledRangeSlider.tsx +16 -0
- package/src/components/Slider/__tests__/RangeSlider.spec.tsx +119 -0
- package/src/components/Slider/__tests__/{index.spec.tsx → SingleSlider.spec.tsx} +1 -1
- package/src/components/Slider/__tests__/__snapshots__/RangeSlider.spec.tsx.snap +252 -0
- package/src/components/Slider/index.tsx +8 -83
- package/src/components/Tabs/StyledScrollableTabs.tsx +2 -1
- package/src/components/Tabs/StyledTabs.tsx +1 -0
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +3 -0
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabsHeader.spec.tsx.snap +2 -0
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +3 -0
- package/src/index.ts +2 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +39 -0
- package/src/theme/components/appCue.ts +22 -0
- package/src/theme/components/slider.ts +19 -1
- package/src/theme/components/tabs.ts +1 -0
- package/src/theme/getTheme.ts +3 -0
- package/src/types.ts +2 -0
- package/stats/8.83.0/rn-stats.html +4844 -0
- package/testUtils/setup.tsx +17 -0
- package/types/components/AppCue/StyledAppCue.d.ts +20 -0
- package/types/components/AppCue/__tests__/StyledAppCue.d.ts +1 -0
- package/types/components/AppCue/index.d.ts +21 -0
- package/types/components/AppCue/utils.d.ts +63 -0
- package/types/components/Chip/StyledChip.d.ts +1 -1
- package/types/components/Chip/index.d.ts +2 -2
- package/types/components/Slider/RangeSlider.d.ts +60 -0
- package/types/components/Slider/SingleSlider.d.ts +53 -0
- package/types/components/Slider/StyledRangeSlider.d.ts +10 -0
- package/types/components/Slider/index.d.ts +6 -51
- package/types/index.d.ts +2 -1
- package/types/theme/components/appCue.d.ts +16 -0
- package/types/theme/components/slider.d.ts +24 -0
- package/types/theme/components/tabs.d.ts +1 -0
- package/types/theme/getTheme.d.ts +2 -0
- package/types/types.d.ts +2 -1
- /package/src/components/Slider/__tests__/__snapshots__/{index.spec.tsx.snap → SingleSlider.spec.tsx.snap} +0 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import RnSlider from '@react-native-community/slider';
|
|
3
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
+
import { useTheme } from '../../theme';
|
|
5
|
+
|
|
6
|
+
export interface SingleSliderProps {
|
|
7
|
+
/**
|
|
8
|
+
* Minimum value of the slider.
|
|
9
|
+
* Defaults to 0.
|
|
10
|
+
*/
|
|
11
|
+
minimumValue?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Maximum value of the slider.
|
|
14
|
+
* Defaults to 1.
|
|
15
|
+
*/
|
|
16
|
+
maximumValue?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Step value of the slider.
|
|
19
|
+
* The value should be between 0 and (maximumValue - minimumValue).
|
|
20
|
+
* Defaults to 0.
|
|
21
|
+
*/
|
|
22
|
+
step?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Value of the slider.
|
|
25
|
+
* Defaults to 0.
|
|
26
|
+
*/
|
|
27
|
+
value?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Callback continuously called while the user is dragging the slider.
|
|
30
|
+
*/
|
|
31
|
+
onValueChange?: (value: number) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Callback that is called when the user picks up the slider.
|
|
34
|
+
* The initial value is passed as an argument to the callback handler.
|
|
35
|
+
*/
|
|
36
|
+
onSlidingStart?: (value: number) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Callback that is called when the user releases the slider, regardless if the value has changed.
|
|
39
|
+
* The current value is passed as an argument to the callback handler.
|
|
40
|
+
*/
|
|
41
|
+
onSlidingComplete?: (value: number) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the slider is disabled.
|
|
44
|
+
*/
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Additional style.
|
|
48
|
+
*/
|
|
49
|
+
style?: StyleProp<ViewStyle>;
|
|
50
|
+
/**
|
|
51
|
+
* Testing id of the component.
|
|
52
|
+
*/
|
|
53
|
+
testID?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const Slider = ({
|
|
57
|
+
minimumValue = 0,
|
|
58
|
+
maximumValue = 1,
|
|
59
|
+
step = 0,
|
|
60
|
+
value = 0,
|
|
61
|
+
onValueChange,
|
|
62
|
+
onSlidingStart,
|
|
63
|
+
onSlidingComplete,
|
|
64
|
+
disabled = false,
|
|
65
|
+
style,
|
|
66
|
+
testID,
|
|
67
|
+
}: SingleSliderProps) => {
|
|
68
|
+
const theme = useTheme();
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<RnSlider
|
|
72
|
+
minimumValue={minimumValue}
|
|
73
|
+
maximumValue={maximumValue}
|
|
74
|
+
step={step}
|
|
75
|
+
value={value}
|
|
76
|
+
onValueChange={onValueChange}
|
|
77
|
+
onSlidingStart={onSlidingStart}
|
|
78
|
+
onSlidingComplete={onSlidingComplete}
|
|
79
|
+
disabled={disabled}
|
|
80
|
+
minimumTrackTintColor={theme.__hd__.slider.colors.minimumTrackTint}
|
|
81
|
+
thumbTintColor={theme.__hd__.slider.colors.thumbTint}
|
|
82
|
+
maximumTrackTintColor={theme.__hd__.slider.colors.maximumTrackTint}
|
|
83
|
+
style={style}
|
|
84
|
+
testID={testID}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export default Slider;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
const StyledMarker = styled(View)<{ themeDisabled: boolean }>(
|
|
5
|
+
({ themeDisabled, theme }) => ({
|
|
6
|
+
height: theme.__hd__.slider.sizes.markerHeight,
|
|
7
|
+
width: theme.__hd__.slider.sizes.markerWidth,
|
|
8
|
+
borderRadius: theme.__hd__.slider.radii.marker,
|
|
9
|
+
backgroundColor: themeDisabled
|
|
10
|
+
? theme.__hd__.slider.colors.disabledThumbTint
|
|
11
|
+
: theme.__hd__.slider.colors.thumbTint,
|
|
12
|
+
...theme.__hd__.slider.shadows.marker,
|
|
13
|
+
})
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export { StyledMarker };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { fireEvent } from '@testing-library/react-native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
4
|
+
import RangeSlider from '../RangeSlider';
|
|
5
|
+
import { StyledMarker } from '../StyledRangeSlider';
|
|
6
|
+
|
|
7
|
+
describe('Slider.Range', () => {
|
|
8
|
+
it('renders correctly by default', async () => {
|
|
9
|
+
const { toJSON, getByTestId } = renderWithTheme(
|
|
10
|
+
<RangeSlider
|
|
11
|
+
maximumValue={20}
|
|
12
|
+
minimumValue={-10}
|
|
13
|
+
value={{
|
|
14
|
+
start: 0,
|
|
15
|
+
end: 10,
|
|
16
|
+
}}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
// Trigger the onLayout event
|
|
20
|
+
const nativeComponent = getByTestId('native-multi-slider');
|
|
21
|
+
fireEvent(nativeComponent, 'layout', {
|
|
22
|
+
nativeEvent: {
|
|
23
|
+
layout: { width: 100, height: 50 },
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
expect(toJSON()).toMatchSnapshot();
|
|
27
|
+
|
|
28
|
+
expect(nativeComponent.props['selectedStyle'].backgroundColor).toBe(
|
|
29
|
+
'#401960'
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
expect(nativeComponent.props['trackStyle'].backgroundColor).toBe('#ece8ef');
|
|
33
|
+
|
|
34
|
+
// verify prop
|
|
35
|
+
expect(nativeComponent).toHaveProp('sliderLength', 100);
|
|
36
|
+
expect(nativeComponent).toHaveProp('values', [0, 10]);
|
|
37
|
+
expect(nativeComponent).toHaveProp('min', -10);
|
|
38
|
+
expect(nativeComponent).toHaveProp('max', 20);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('when value is undefined, value should be minumum and maximum', () => {
|
|
42
|
+
const { getByTestId } = renderWithTheme(
|
|
43
|
+
<RangeSlider maximumValue={20} minimumValue={-10} />
|
|
44
|
+
);
|
|
45
|
+
const nativeComponent = getByTestId('native-multi-slider');
|
|
46
|
+
expect(nativeComponent.props['values']).toEqual([-10, 20]);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('renders correctly when disabled is $disabled', () => {
|
|
50
|
+
const { getByTestId, toJSON } = renderWithTheme(
|
|
51
|
+
<RangeSlider
|
|
52
|
+
testID="range-slider"
|
|
53
|
+
minimumValue={-10}
|
|
54
|
+
maximumValue={10}
|
|
55
|
+
disabled
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const slider = getByTestId('range-slider');
|
|
60
|
+
expect(slider).toHaveAccessibilityState({ disabled: true });
|
|
61
|
+
|
|
62
|
+
expect(toJSON()).toMatchSnapshot();
|
|
63
|
+
const nativeComponent = getByTestId('native-multi-slider');
|
|
64
|
+
|
|
65
|
+
expect(nativeComponent.props['selectedStyle'].backgroundColor).toBe(
|
|
66
|
+
'#bfc1c5'
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
expect(nativeComponent.props['trackStyle'].backgroundColor).toBe('#f6f6f7');
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('trigger options', () => {
|
|
73
|
+
const onValueChangeSpy = jest.fn();
|
|
74
|
+
const onSlidingStartSpy = jest.fn();
|
|
75
|
+
const onSlidingCompleteSpy = jest.fn();
|
|
76
|
+
const { getByTestId } = renderWithTheme(
|
|
77
|
+
<RangeSlider
|
|
78
|
+
value={{ start: 2, end: 5 }}
|
|
79
|
+
minimumValue={-10}
|
|
80
|
+
maximumValue={10}
|
|
81
|
+
step={0.25}
|
|
82
|
+
onValueChange={onValueChangeSpy}
|
|
83
|
+
onSlidingStart={onSlidingStartSpy}
|
|
84
|
+
onSlidingComplete={onSlidingCompleteSpy}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
const nativeComponent = getByTestId('native-multi-slider');
|
|
89
|
+
fireEvent(nativeComponent, 'valuesChangeStart', [2, 5]);
|
|
90
|
+
expect(onSlidingStartSpy).toHaveBeenCalled();
|
|
91
|
+
|
|
92
|
+
fireEvent(nativeComponent, 'valuesChange', [2, 5]);
|
|
93
|
+
expect(onValueChangeSpy).toHaveBeenCalledWith({ start: 2, end: 5 });
|
|
94
|
+
|
|
95
|
+
fireEvent(nativeComponent, 'valuesChangeFinish', [2, 5]);
|
|
96
|
+
expect(onSlidingCompleteSpy).toHaveBeenCalledWith({ start: 2, end: 5 });
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
describe('StyledMarker', () => {
|
|
101
|
+
it.each`
|
|
102
|
+
themeDisabled | expectedBackgroundColor
|
|
103
|
+
${false} | ${'#401960'}
|
|
104
|
+
${true} | ${'#bfc1c5'}
|
|
105
|
+
`(
|
|
106
|
+
'renders correctly when disabled is $themeDisabled',
|
|
107
|
+
({ themeDisabled, expectedBackgroundColor }) => {
|
|
108
|
+
const { getByTestId, toJSON } = renderWithTheme(
|
|
109
|
+
<StyledMarker testID="marker" themeDisabled={themeDisabled} />
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
expect(toJSON()).toMatchSnapshot();
|
|
113
|
+
|
|
114
|
+
expect(getByTestId('marker')).toHaveStyle({
|
|
115
|
+
backgroundColor: expectedBackgroundColor,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
});
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Slider.Range renders correctly by default 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
style={
|
|
6
|
+
{
|
|
7
|
+
"flex": 1,
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
>
|
|
11
|
+
<View
|
|
12
|
+
accessibilityState={
|
|
13
|
+
{
|
|
14
|
+
"disabled": false,
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
onLayout={[Function]}
|
|
18
|
+
>
|
|
19
|
+
<MultiSlider
|
|
20
|
+
allowOverlap={false}
|
|
21
|
+
customMarker={[Function]}
|
|
22
|
+
enabledOne={true}
|
|
23
|
+
enabledTwo={true}
|
|
24
|
+
max={20}
|
|
25
|
+
min={-10}
|
|
26
|
+
onValuesChange={[Function]}
|
|
27
|
+
onValuesChangeFinish={[Function]}
|
|
28
|
+
onValuesChangeStart={[Function]}
|
|
29
|
+
selectedStyle={
|
|
30
|
+
{
|
|
31
|
+
"backgroundColor": "#401960",
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
sliderLength={100}
|
|
35
|
+
step={1}
|
|
36
|
+
testID="native-multi-slider"
|
|
37
|
+
trackStyle={
|
|
38
|
+
{
|
|
39
|
+
"backgroundColor": "#ece8ef",
|
|
40
|
+
"height": 4,
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
values={
|
|
44
|
+
[
|
|
45
|
+
0,
|
|
46
|
+
10,
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
/>
|
|
50
|
+
</View>
|
|
51
|
+
<View
|
|
52
|
+
pointerEvents="box-none"
|
|
53
|
+
position="bottom"
|
|
54
|
+
style={
|
|
55
|
+
[
|
|
56
|
+
{
|
|
57
|
+
"bottom": 0,
|
|
58
|
+
"elevation": 9999,
|
|
59
|
+
"flexDirection": "column-reverse",
|
|
60
|
+
"left": 0,
|
|
61
|
+
"paddingHorizontal": 24,
|
|
62
|
+
"paddingVertical": 16,
|
|
63
|
+
"position": "absolute",
|
|
64
|
+
"right": 0,
|
|
65
|
+
"top": 0,
|
|
66
|
+
},
|
|
67
|
+
undefined,
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
/>
|
|
71
|
+
</View>
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
exports[`Slider.Range renders correctly when disabled is $disabled 1`] = `
|
|
75
|
+
<View
|
|
76
|
+
style={
|
|
77
|
+
{
|
|
78
|
+
"flex": 1,
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
>
|
|
82
|
+
<View
|
|
83
|
+
accessibilityState={
|
|
84
|
+
{
|
|
85
|
+
"disabled": true,
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
onLayout={[Function]}
|
|
89
|
+
testID="range-slider"
|
|
90
|
+
>
|
|
91
|
+
<MultiSlider
|
|
92
|
+
allowOverlap={false}
|
|
93
|
+
customMarker={[Function]}
|
|
94
|
+
enabledOne={false}
|
|
95
|
+
enabledTwo={false}
|
|
96
|
+
max={10}
|
|
97
|
+
min={-10}
|
|
98
|
+
onValuesChange={[Function]}
|
|
99
|
+
onValuesChangeFinish={[Function]}
|
|
100
|
+
onValuesChangeStart={[Function]}
|
|
101
|
+
selectedStyle={
|
|
102
|
+
{
|
|
103
|
+
"backgroundColor": "#bfc1c5",
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
sliderLength={0}
|
|
107
|
+
step={1}
|
|
108
|
+
testID="native-multi-slider"
|
|
109
|
+
trackStyle={
|
|
110
|
+
{
|
|
111
|
+
"backgroundColor": "#f6f6f7",
|
|
112
|
+
"height": 4,
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
values={
|
|
116
|
+
[
|
|
117
|
+
-10,
|
|
118
|
+
10,
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
/>
|
|
122
|
+
</View>
|
|
123
|
+
<View
|
|
124
|
+
pointerEvents="box-none"
|
|
125
|
+
position="bottom"
|
|
126
|
+
style={
|
|
127
|
+
[
|
|
128
|
+
{
|
|
129
|
+
"bottom": 0,
|
|
130
|
+
"elevation": 9999,
|
|
131
|
+
"flexDirection": "column-reverse",
|
|
132
|
+
"left": 0,
|
|
133
|
+
"paddingHorizontal": 24,
|
|
134
|
+
"paddingVertical": 16,
|
|
135
|
+
"position": "absolute",
|
|
136
|
+
"right": 0,
|
|
137
|
+
"top": 0,
|
|
138
|
+
},
|
|
139
|
+
undefined,
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
/>
|
|
143
|
+
</View>
|
|
144
|
+
`;
|
|
145
|
+
|
|
146
|
+
exports[`StyledMarker renders correctly when disabled is false 1`] = `
|
|
147
|
+
<View
|
|
148
|
+
style={
|
|
149
|
+
{
|
|
150
|
+
"flex": 1,
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
>
|
|
154
|
+
<View
|
|
155
|
+
style={
|
|
156
|
+
[
|
|
157
|
+
{
|
|
158
|
+
"backgroundColor": "#401960",
|
|
159
|
+
"borderRadius": 999,
|
|
160
|
+
"elevation": 3,
|
|
161
|
+
"height": 24,
|
|
162
|
+
"shadowColor": "#001f23",
|
|
163
|
+
"shadowOffset": {
|
|
164
|
+
"height": 2,
|
|
165
|
+
"width": 0,
|
|
166
|
+
},
|
|
167
|
+
"shadowOpacity": 0.12,
|
|
168
|
+
"shadowRadius": 4,
|
|
169
|
+
"width": 24,
|
|
170
|
+
},
|
|
171
|
+
undefined,
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
testID="marker"
|
|
175
|
+
themeDisabled={false}
|
|
176
|
+
/>
|
|
177
|
+
<View
|
|
178
|
+
pointerEvents="box-none"
|
|
179
|
+
position="bottom"
|
|
180
|
+
style={
|
|
181
|
+
[
|
|
182
|
+
{
|
|
183
|
+
"bottom": 0,
|
|
184
|
+
"elevation": 9999,
|
|
185
|
+
"flexDirection": "column-reverse",
|
|
186
|
+
"left": 0,
|
|
187
|
+
"paddingHorizontal": 24,
|
|
188
|
+
"paddingVertical": 16,
|
|
189
|
+
"position": "absolute",
|
|
190
|
+
"right": 0,
|
|
191
|
+
"top": 0,
|
|
192
|
+
},
|
|
193
|
+
undefined,
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
/>
|
|
197
|
+
</View>
|
|
198
|
+
`;
|
|
199
|
+
|
|
200
|
+
exports[`StyledMarker renders correctly when disabled is true 1`] = `
|
|
201
|
+
<View
|
|
202
|
+
style={
|
|
203
|
+
{
|
|
204
|
+
"flex": 1,
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
>
|
|
208
|
+
<View
|
|
209
|
+
style={
|
|
210
|
+
[
|
|
211
|
+
{
|
|
212
|
+
"backgroundColor": "#bfc1c5",
|
|
213
|
+
"borderRadius": 999,
|
|
214
|
+
"elevation": 3,
|
|
215
|
+
"height": 24,
|
|
216
|
+
"shadowColor": "#001f23",
|
|
217
|
+
"shadowOffset": {
|
|
218
|
+
"height": 2,
|
|
219
|
+
"width": 0,
|
|
220
|
+
},
|
|
221
|
+
"shadowOpacity": 0.12,
|
|
222
|
+
"shadowRadius": 4,
|
|
223
|
+
"width": 24,
|
|
224
|
+
},
|
|
225
|
+
undefined,
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
testID="marker"
|
|
229
|
+
themeDisabled={true}
|
|
230
|
+
/>
|
|
231
|
+
<View
|
|
232
|
+
pointerEvents="box-none"
|
|
233
|
+
position="bottom"
|
|
234
|
+
style={
|
|
235
|
+
[
|
|
236
|
+
{
|
|
237
|
+
"bottom": 0,
|
|
238
|
+
"elevation": 9999,
|
|
239
|
+
"flexDirection": "column-reverse",
|
|
240
|
+
"left": 0,
|
|
241
|
+
"paddingHorizontal": 24,
|
|
242
|
+
"paddingVertical": 16,
|
|
243
|
+
"position": "absolute",
|
|
244
|
+
"right": 0,
|
|
245
|
+
"top": 0,
|
|
246
|
+
},
|
|
247
|
+
undefined,
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
/>
|
|
251
|
+
</View>
|
|
252
|
+
`;
|
|
@@ -1,89 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import type { FunctionComponent } from 'react';
|
|
2
|
+
import Single from './SingleSlider';
|
|
3
|
+
import type { SingleSliderProps } from './SingleSlider';
|
|
4
|
+
import Range from './RangeSlider';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* Minimum value of the slider.
|
|
9
|
-
* Defaults to 0.
|
|
10
|
-
*/
|
|
11
|
-
minimumValue?: number;
|
|
12
|
-
/**
|
|
13
|
-
* Maximum value of the slider.
|
|
14
|
-
* Defaults to 1.
|
|
15
|
-
*/
|
|
16
|
-
maximumValue?: number;
|
|
17
|
-
/**
|
|
18
|
-
* Step value of the slider.
|
|
19
|
-
* The value should be between 0 and (maximumValue - minimumValue).
|
|
20
|
-
* Defaults to 0.
|
|
21
|
-
*/
|
|
22
|
-
step?: number;
|
|
23
|
-
/**
|
|
24
|
-
* Value of the slider.
|
|
25
|
-
* Defaults to 0.
|
|
26
|
-
*/
|
|
27
|
-
value?: number;
|
|
28
|
-
/**
|
|
29
|
-
* Callback continuously called while the user is dragging the slider.
|
|
30
|
-
*/
|
|
31
|
-
onValueChange?: (value: number) => void;
|
|
32
|
-
/**
|
|
33
|
-
* Callback that is called when the user picks up the slider.
|
|
34
|
-
* The initial value is passed as an argument to the callback handler.
|
|
35
|
-
*/
|
|
36
|
-
onSlidingStart?: (value: number) => void;
|
|
37
|
-
/**
|
|
38
|
-
* Callback that is called when the user releases the slider, regardless if the value has changed.
|
|
39
|
-
* The current value is passed as an argument to the callback handler.
|
|
40
|
-
*/
|
|
41
|
-
onSlidingComplete?: (value: number) => void;
|
|
42
|
-
/**
|
|
43
|
-
* Whether the slider is disabled.
|
|
44
|
-
*/
|
|
45
|
-
disabled?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Additional style.
|
|
48
|
-
*/
|
|
49
|
-
style?: StyleProp<ViewStyle>;
|
|
50
|
-
/**
|
|
51
|
-
* Testing id of the component.
|
|
52
|
-
*/
|
|
53
|
-
testID?: string;
|
|
6
|
+
interface SliderProps extends FunctionComponent<SingleSliderProps> {
|
|
7
|
+
Range: typeof Range;
|
|
54
8
|
}
|
|
55
9
|
|
|
56
|
-
const Slider =
|
|
57
|
-
minimumValue = 0,
|
|
58
|
-
maximumValue = 1,
|
|
59
|
-
step = 0,
|
|
60
|
-
value = 0,
|
|
61
|
-
onValueChange,
|
|
62
|
-
onSlidingStart,
|
|
63
|
-
onSlidingComplete,
|
|
64
|
-
disabled = false,
|
|
65
|
-
style,
|
|
66
|
-
testID,
|
|
67
|
-
}: SliderProps) => {
|
|
68
|
-
const theme = useTheme();
|
|
10
|
+
const Slider = Single as SliderProps;
|
|
69
11
|
|
|
70
|
-
|
|
71
|
-
<RnSlider
|
|
72
|
-
minimumValue={minimumValue}
|
|
73
|
-
maximumValue={maximumValue}
|
|
74
|
-
step={step}
|
|
75
|
-
value={value}
|
|
76
|
-
onValueChange={onValueChange}
|
|
77
|
-
onSlidingStart={onSlidingStart}
|
|
78
|
-
onSlidingComplete={onSlidingComplete}
|
|
79
|
-
disabled={disabled}
|
|
80
|
-
minimumTrackTintColor={theme.__hd__.slider.colors.minimumTrackTint}
|
|
81
|
-
thumbTintColor={theme.__hd__.slider.colors.thumbTint}
|
|
82
|
-
maximumTrackTintColor={theme.__hd__.slider.colors.maximumTrackTint}
|
|
83
|
-
style={style}
|
|
84
|
-
testID={testID}
|
|
85
|
-
/>
|
|
86
|
-
);
|
|
87
|
-
};
|
|
12
|
+
Slider.Range = Range;
|
|
88
13
|
|
|
89
14
|
export default Slider;
|
|
@@ -12,8 +12,9 @@ const TabContainer = styled(View)({
|
|
|
12
12
|
|
|
13
13
|
const HeaderTabWrapper = styled(View)<{
|
|
14
14
|
themeInsets: { top: number; right: number; bottom: number; left: number };
|
|
15
|
-
}>(({ themeInsets }) => ({
|
|
15
|
+
}>(({ themeInsets, theme }) => ({
|
|
16
16
|
paddingHorizontal: Math.max(themeInsets.left, themeInsets.right),
|
|
17
|
+
backgroundColor: theme.__hd__.tabs.colors.headerBackground,
|
|
17
18
|
}));
|
|
18
19
|
|
|
19
20
|
const HeaderTabItem = styled(Animated.View)<{ isFirstItem?: boolean }>(
|
|
@@ -12,6 +12,7 @@ const HeaderTabWrapper = styled(View)<{
|
|
|
12
12
|
paddingHorizontal: Math.max(themeInsets.left, themeInsets.right),
|
|
13
13
|
borderBottomColor: theme.__hd__.tabs.colors.headerBottom,
|
|
14
14
|
borderBottomWidth: theme.__hd__.tabs.borderWidths.headerBottom,
|
|
15
|
+
backgroundColor: theme.__hd__.tabs.colors.headerBackground,
|
|
15
16
|
}));
|
|
16
17
|
|
|
17
18
|
const HeaderTab = styled(View)({
|
|
@@ -128,6 +128,7 @@ exports[`Tabs.Scroll lazy not render lazy screen: xxx 1`] = `
|
|
|
128
128
|
style={
|
|
129
129
|
[
|
|
130
130
|
{
|
|
131
|
+
"backgroundColor": "#ffffff",
|
|
131
132
|
"paddingHorizontal": 0,
|
|
132
133
|
},
|
|
133
134
|
undefined,
|
|
@@ -1057,6 +1058,7 @@ exports[`Tabs.Scroll renders correctly 1`] = `
|
|
|
1057
1058
|
style={
|
|
1058
1059
|
[
|
|
1059
1060
|
{
|
|
1061
|
+
"backgroundColor": "#ffffff",
|
|
1060
1062
|
"paddingHorizontal": 0,
|
|
1061
1063
|
},
|
|
1062
1064
|
undefined,
|
|
@@ -1986,6 +1988,7 @@ exports[`useIsFocused renders correctly 1`] = `
|
|
|
1986
1988
|
style={
|
|
1987
1989
|
[
|
|
1988
1990
|
{
|
|
1991
|
+
"backgroundColor": "#ffffff",
|
|
1989
1992
|
"paddingHorizontal": 0,
|
|
1990
1993
|
},
|
|
1991
1994
|
undefined,
|
|
@@ -23,6 +23,7 @@ exports[`ScrollableTabsHeader highlighted variant renders correctly 1`] = `
|
|
|
23
23
|
style={
|
|
24
24
|
[
|
|
25
25
|
{
|
|
26
|
+
"backgroundColor": "#ffffff",
|
|
26
27
|
"paddingHorizontal": 0,
|
|
27
28
|
},
|
|
28
29
|
undefined,
|
|
@@ -695,6 +696,7 @@ exports[`ScrollableTabsHeader underlined variant renders correctly 1`] = `
|
|
|
695
696
|
style={
|
|
696
697
|
[
|
|
697
698
|
{
|
|
699
|
+
"backgroundColor": "#ffffff",
|
|
698
700
|
"paddingHorizontal": 0,
|
|
699
701
|
},
|
|
700
702
|
undefined,
|
|
@@ -128,6 +128,7 @@ exports[`Tabs renders correctly 1`] = `
|
|
|
128
128
|
style={
|
|
129
129
|
[
|
|
130
130
|
{
|
|
131
|
+
"backgroundColor": "#ffffff",
|
|
131
132
|
"borderBottomColor": "#e8e9ea",
|
|
132
133
|
"borderBottomWidth": 2,
|
|
133
134
|
"paddingHorizontal": 0,
|
|
@@ -801,6 +802,7 @@ exports[`useIsFocused renders correctly 1`] = `
|
|
|
801
802
|
style={
|
|
802
803
|
[
|
|
803
804
|
{
|
|
805
|
+
"backgroundColor": "#ffffff",
|
|
804
806
|
"borderBottomColor": "#e8e9ea",
|
|
805
807
|
"borderBottomWidth": 2,
|
|
806
808
|
"paddingHorizontal": 0,
|
|
@@ -1474,6 +1476,7 @@ exports[`useIsFocused renders correctly: xxxxxx 1`] = `
|
|
|
1474
1476
|
style={
|
|
1475
1477
|
[
|
|
1476
1478
|
{
|
|
1479
|
+
"backgroundColor": "#ffffff",
|
|
1477
1480
|
"borderBottomColor": "#e8e9ea",
|
|
1478
1481
|
"borderBottomWidth": 2,
|
|
1479
1482
|
"paddingHorizontal": 0,
|
package/src/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { scale } from './utils/scale';
|
|
|
17
17
|
|
|
18
18
|
import Accordion from './components/Accordion';
|
|
19
19
|
import Alert from './components/Alert';
|
|
20
|
+
import AppCue from './components/AppCue';
|
|
20
21
|
import Attachment from './components/Attachment';
|
|
21
22
|
import Avatar, { useAvatarColors } from './components/Avatar';
|
|
22
23
|
import Badge from './components/Badge';
|
|
@@ -91,6 +92,7 @@ export {
|
|
|
91
92
|
eBensSystemPalette,
|
|
92
93
|
Accordion,
|
|
93
94
|
Alert,
|
|
95
|
+
AppCue,
|
|
94
96
|
Attachment,
|
|
95
97
|
Avatar,
|
|
96
98
|
useAvatarColors,
|