react-native-system-ui 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/action-sheet/ActionSheet.js +45 -51
- package/dist/cjs/components/area/Area.js +22 -22
- package/dist/cjs/components/avatar/Avatar.js +23 -23
- package/dist/cjs/components/badge/Badge.js +56 -61
- package/dist/cjs/components/button/Button.js +87 -92
- package/dist/cjs/components/button/ButtonGroup.js +4 -4
- package/dist/cjs/components/calendar/Calendar.js +28 -28
- package/dist/cjs/components/cascader/Cascader.js +205 -212
- package/dist/cjs/components/cell/Cell.js +54 -51
- package/dist/cjs/components/cell/CellGroup.js +26 -25
- package/dist/cjs/components/checkbox/Checkbox.js +1 -0
- package/dist/cjs/components/checkbox/CheckboxGroup.js +20 -19
- package/dist/cjs/components/circle/Circle.js +66 -54
- package/dist/cjs/components/collapse/Collapse.js +18 -18
- package/dist/cjs/components/config-provider/ConfigProvider.js +5 -5
- package/dist/cjs/components/count-down/CountDown.js +17 -17
- package/dist/cjs/components/datetime-picker/DatetimePicker.js +34 -35
- package/dist/cjs/components/dialog/Dialog.js +16 -10
- package/dist/cjs/components/dialog/imperative.js +8 -14
- package/dist/cjs/components/dialog/tokens.js +1 -0
- package/dist/cjs/components/divider/Divider.js +48 -51
- package/dist/cjs/components/empty/Empty.js +30 -25
- package/dist/cjs/components/error-boundary/ErrorBoundary.js +3 -2
- package/dist/cjs/components/flex/Flex.js +27 -27
- package/dist/cjs/components/flex/FlexItem.js +1 -0
- package/dist/cjs/components/form/Form.js +93 -92
- package/dist/cjs/components/form/FormItem.js +60 -54
- package/dist/cjs/components/form/FormList.js +35 -35
- package/dist/cjs/components/grid/Grid.js +48 -48
- package/dist/cjs/components/grid/GridItem.js +9 -2
- package/dist/cjs/components/image/Image.js +25 -24
- package/dist/cjs/components/image/tokens.js +3 -1
- package/dist/cjs/components/image-preview/ImagePreview.js +19 -19
- package/dist/cjs/components/image-preview/tokens.js +3 -1
- package/dist/cjs/components/input/Input.js +16 -19
- package/dist/cjs/components/loading/Loading.js +27 -27
- package/dist/cjs/components/nav-bar/NavBar.js +21 -18
- package/dist/cjs/components/nav-bar/tokens.js +3 -1
- package/dist/cjs/components/notice-bar/NoticeBar.js +7 -3
- package/dist/cjs/components/notice-bar/tokens.js +3 -1
- package/dist/cjs/components/notify/Notify.js +2 -1
- package/dist/cjs/components/notify/imperative.js +17 -17
- package/dist/cjs/components/notify/tokens.js +1 -0
- package/dist/cjs/components/number-keyboard/NumberKeyboard.js +217 -201
- package/dist/cjs/components/number-keyboard/tokens.js +7 -1
- package/dist/cjs/components/overlay/Overlay.js +15 -15
- package/dist/cjs/components/password-input/PasswordInput.js +49 -49
- package/dist/cjs/components/picker/Picker.js +50 -58
- package/dist/cjs/components/popup/Popup.js +10 -10
- package/dist/cjs/components/popup/tokens.js +1 -0
- package/dist/cjs/components/portal/Portal.js +3 -4
- package/dist/cjs/components/progress/Progress.js +94 -95
- package/dist/cjs/components/progress/tokens.js +1 -0
- package/dist/cjs/components/radio/Radio.js +67 -63
- package/dist/cjs/components/radio/RadioGroup.js +6 -6
- package/dist/cjs/components/safe-area-view/SafeAreaView.js +7 -7
- package/dist/cjs/components/search/Search.js +28 -28
- package/dist/cjs/components/selector/Selector.js +19 -26
- package/dist/cjs/components/share-sheet/ShareSheet.js +6 -1
- package/dist/cjs/components/share-sheet/tokens.js +3 -1
- package/dist/cjs/components/sidebar/Sidebar.js +22 -16
- package/dist/cjs/components/sidebar/SidebarItem.js +9 -8
- package/dist/cjs/components/sidebar/tokens.js +3 -1
- package/dist/cjs/components/skeleton/Skeleton.js +43 -42
- package/dist/cjs/components/space/Space.js +45 -41
- package/dist/cjs/components/space/tokens.js +7 -1
- package/dist/cjs/components/stepper/Stepper.js +17 -15
- package/dist/cjs/components/stepper/tokens.js +1 -0
- package/dist/cjs/components/swiper/Swiper.js +10 -7
- package/dist/cjs/components/swiper/SwiperPagIndicator.js +3 -2
- package/dist/cjs/components/switch/Switch.js +23 -23
- package/dist/cjs/components/tabbar/Tabbar.js +26 -26
- package/dist/cjs/components/tabs/Tabs.js +143 -153
- package/dist/cjs/components/tabs/tokens.js +3 -1
- package/dist/cjs/components/tag/Tag.js +38 -38
- package/dist/cjs/components/toast/Toast.js +3 -2
- package/dist/cjs/components/toast/tokens.js +1 -0
- package/dist/cjs/components/typography/Typography.js +23 -21
- package/dist/cjs/components/water-mark/WaterMark.js +65 -65
- package/dist/cjs/design-system/Text.js +38 -0
- package/dist/cjs/design-system/createComponentTokensHook.js +2 -2
- package/dist/cjs/design-system/index.js +7 -0
- package/dist/cjs/design-system/mergeTokensOverride.js +1 -4
- package/dist/cjs/hooks/useControllableValue.js +11 -11
- package/dist/cjs/hooks/useCountDown.js +18 -18
- package/dist/cjs/platform/measure.js +4 -2
- package/dist/cjs/utils/color.js +2 -7
- package/dist/cjs/utils/compare.js +3 -3
- package/dist/cjs/utils/date.js +2 -2
- package/dist/cjs/utils/deepMerge.js +5 -5
- package/dist/cjs/utils/hairline.js +1 -0
- package/dist/cjs/utils/render.js +2 -8
- package/dist/cjs/utils/validate.js +2 -4
- package/dist/es/components/action-sheet/ActionSheet.js +45 -51
- package/dist/es/components/area/Area.js +22 -22
- package/dist/es/components/avatar/Avatar.js +23 -23
- package/dist/es/components/badge/Badge.js +56 -61
- package/dist/es/components/button/Button.js +87 -92
- package/dist/es/components/button/ButtonGroup.js +4 -4
- package/dist/es/components/calendar/Calendar.js +28 -28
- package/dist/es/components/cascader/Cascader.js +205 -212
- package/dist/es/components/cell/Cell.js +55 -52
- package/dist/es/components/cell/CellGroup.js +26 -25
- package/dist/es/components/checkbox/Checkbox.js +1 -0
- package/dist/es/components/checkbox/CheckboxGroup.js +20 -19
- package/dist/es/components/circle/Circle.js +66 -54
- package/dist/es/components/collapse/Collapse.js +18 -18
- package/dist/es/components/config-provider/ConfigProvider.js +5 -5
- package/dist/es/components/count-down/CountDown.js +17 -17
- package/dist/es/components/datetime-picker/DatetimePicker.js +34 -35
- package/dist/es/components/dialog/Dialog.js +16 -10
- package/dist/es/components/dialog/imperative.js +8 -14
- package/dist/es/components/dialog/tokens.js +1 -0
- package/dist/es/components/divider/Divider.js +48 -51
- package/dist/es/components/empty/Empty.js +30 -25
- package/dist/es/components/error-boundary/ErrorBoundary.js +3 -2
- package/dist/es/components/flex/Flex.js +27 -27
- package/dist/es/components/flex/FlexItem.js +1 -0
- package/dist/es/components/form/Form.js +93 -92
- package/dist/es/components/form/FormItem.js +60 -54
- package/dist/es/components/form/FormList.js +35 -35
- package/dist/es/components/grid/Grid.js +48 -48
- package/dist/es/components/grid/GridItem.js +10 -3
- package/dist/es/components/image/Image.js +25 -24
- package/dist/es/components/image/tokens.js +3 -1
- package/dist/es/components/image-preview/ImagePreview.js +19 -19
- package/dist/es/components/image-preview/tokens.js +3 -1
- package/dist/es/components/input/Input.js +16 -19
- package/dist/es/components/loading/Loading.js +27 -27
- package/dist/es/components/nav-bar/NavBar.js +21 -18
- package/dist/es/components/nav-bar/tokens.js +3 -1
- package/dist/es/components/notice-bar/NoticeBar.js +7 -3
- package/dist/es/components/notice-bar/tokens.js +3 -1
- package/dist/es/components/notify/Notify.js +2 -1
- package/dist/es/components/notify/imperative.js +17 -17
- package/dist/es/components/notify/tokens.js +1 -0
- package/dist/es/components/number-keyboard/NumberKeyboard.js +217 -201
- package/dist/es/components/number-keyboard/tokens.js +7 -1
- package/dist/es/components/overlay/Overlay.js +15 -15
- package/dist/es/components/password-input/PasswordInput.js +49 -49
- package/dist/es/components/picker/Picker.js +50 -58
- package/dist/es/components/popup/Popup.js +10 -10
- package/dist/es/components/popup/tokens.js +1 -0
- package/dist/es/components/portal/Portal.js +3 -4
- package/dist/es/components/progress/Progress.js +94 -95
- package/dist/es/components/progress/tokens.js +1 -0
- package/dist/es/components/radio/Radio.js +67 -63
- package/dist/es/components/radio/RadioGroup.js +6 -6
- package/dist/es/components/safe-area-view/SafeAreaView.js +7 -7
- package/dist/es/components/search/Search.js +28 -28
- package/dist/es/components/selector/Selector.js +19 -26
- package/dist/es/components/share-sheet/ShareSheet.js +6 -1
- package/dist/es/components/share-sheet/tokens.js +3 -1
- package/dist/es/components/sidebar/Sidebar.js +22 -16
- package/dist/es/components/sidebar/SidebarItem.js +9 -8
- package/dist/es/components/sidebar/tokens.js +3 -1
- package/dist/es/components/skeleton/Skeleton.js +43 -42
- package/dist/es/components/space/Space.js +45 -41
- package/dist/es/components/space/tokens.js +7 -1
- package/dist/es/components/stepper/Stepper.js +17 -15
- package/dist/es/components/stepper/tokens.js +1 -0
- package/dist/es/components/swiper/Swiper.js +11 -8
- package/dist/es/components/swiper/SwiperPagIndicator.js +3 -2
- package/dist/es/components/switch/Switch.js +23 -23
- package/dist/es/components/tabbar/Tabbar.js +26 -26
- package/dist/es/components/tabs/Tabs.js +144 -154
- package/dist/es/components/tabs/tokens.js +3 -1
- package/dist/es/components/tag/Tag.js +38 -38
- package/dist/es/components/toast/Toast.js +3 -2
- package/dist/es/components/toast/tokens.js +1 -0
- package/dist/es/components/typography/Typography.js +23 -21
- package/dist/es/components/water-mark/WaterMark.js +65 -65
- package/dist/es/design-system/Text.js +19 -0
- package/dist/es/design-system/createComponentTokensHook.js +2 -2
- package/dist/es/design-system/index.js +1 -0
- package/dist/es/design-system/mergeTokensOverride.js +1 -4
- package/dist/es/hooks/useControllableValue.js +11 -11
- package/dist/es/hooks/useCountDown.js +18 -18
- package/dist/es/platform/measure.js +4 -2
- package/dist/es/utils/color.js +1 -4
- package/dist/es/utils/compare.js +3 -3
- package/dist/es/utils/date.js +2 -2
- package/dist/es/utils/deepMerge.js +5 -5
- package/dist/es/utils/hairline.js +1 -0
- package/dist/es/utils/render.js +1 -1
- package/dist/es/utils/validate.js +1 -2
- package/dist/types/components/dialog/tokens.d.ts +1 -0
- package/dist/types/components/image-preview/tokens.d.ts +1 -0
- package/dist/types/components/nav-bar/tokens.d.ts +1 -1
- package/dist/types/components/notice-bar/tokens.d.ts +1 -0
- package/dist/types/components/number-keyboard/tokens.d.ts +5 -0
- package/dist/types/components/picker/Picker.d.ts +1 -1
- package/dist/types/components/popup/tokens.d.ts +1 -0
- package/dist/types/components/share-sheet/tokens.d.ts +1 -0
- package/dist/types/components/stepper/tokens.d.ts +1 -0
- package/dist/types/components/tabs/tokens.d.ts +1 -0
- package/dist/types/components/toast/tokens.d.ts +1 -0
- package/dist/types/design-system/Text.d.ts +3 -0
- package/dist/types/design-system/index.d.ts +1 -0
- package/dist/types/hooks/useCountDown.d.ts +1 -1
- package/dist/types/utils/color.d.ts +0 -2
- package/dist/types/utils/date.d.ts +1 -1
- package/dist/types/utils/render.d.ts +1 -1
- package/dist/types/utils/validate.d.ts +0 -1
- package/package.json +17 -3
|
@@ -52,52 +52,52 @@ const useTabsAnimation = ({
|
|
|
52
52
|
layoutMap,
|
|
53
53
|
navContainerWidthRef
|
|
54
54
|
}) => {
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
const
|
|
55
|
+
const indX = (0, _react().useRef)(new (_reactNative().Animated.Value)(0)).current;
|
|
56
|
+
const indW = (0, _react().useRef)(new (_reactNative().Animated.Value)(0)).current;
|
|
57
|
+
const indInitRef = (0, _react().useRef)(false);
|
|
58
|
+
const animRef = (0, _react().useRef)(null);
|
|
59
59
|
const animateIndicator = (0, _react().useCallback)((name, immediate) => {
|
|
60
60
|
if (name == null || type !== 'line') return false;
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
x: Math.max(
|
|
66
|
-
width:
|
|
61
|
+
const eqW = !scrollable && align !== 'start' && navContainerWidthRef.current > 0 && panes.length > 0;
|
|
62
|
+
const idx = nameIndexMap.get(name) ?? -1;
|
|
63
|
+
const eqTabW = eqW ? navContainerWidthRef.current / panes.length : 0;
|
|
64
|
+
const lay = eqW ? {
|
|
65
|
+
x: Math.max(idx, 0) * eqTabW,
|
|
66
|
+
width: eqTabW
|
|
67
67
|
} : layoutMap.current.get(name);
|
|
68
|
-
if (!
|
|
69
|
-
|
|
70
|
-
const timing = (
|
|
71
|
-
toValue,
|
|
68
|
+
if (!lay || idx < 0) return false;
|
|
69
|
+
animRef.current?.stop();
|
|
70
|
+
const timing = (v, to) => _reactNative().Animated.timing(v, {
|
|
71
|
+
toValue: to,
|
|
72
72
|
duration: immediate || !animated ? 0 : resolvedDuration,
|
|
73
73
|
useNativeDriver: false,
|
|
74
74
|
isInteraction: false
|
|
75
75
|
});
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
const anim = _reactNative().Animated.parallel([timing(
|
|
79
|
-
|
|
76
|
+
const tW = resolvedLineWidth ?? lay.width;
|
|
77
|
+
const tX = resolvedLineWidth ? lay.x + (lay.width - tW) / 2 : lay.x;
|
|
78
|
+
const anim = _reactNative().Animated.parallel([timing(indX, tX), timing(indW, tW)]);
|
|
79
|
+
animRef.current = anim;
|
|
80
80
|
anim.start(({
|
|
81
81
|
finished
|
|
82
82
|
}) => {
|
|
83
|
-
if (finished)
|
|
83
|
+
if (finished) animRef.current = null;
|
|
84
84
|
});
|
|
85
85
|
return true;
|
|
86
|
-
}, [align, animated,
|
|
86
|
+
}, [align, animated, indW, indX, nameIndexMap, panes.length, resolvedDuration, resolvedLineWidth, scrollable, type, layoutMap, navContainerWidthRef]);
|
|
87
87
|
(0, _react().useEffect)(() => {
|
|
88
88
|
if (currentName == null) return;
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
89
|
+
const should = indInitRef.current;
|
|
90
|
+
const did = animateIndicator(currentName, !should);
|
|
91
|
+
if (did && !indInitRef.current) indInitRef.current = true;
|
|
92
92
|
}, [animateIndicator, currentName]);
|
|
93
93
|
(0, _react().useEffect)(() => () => {
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
animRef.current?.stop();
|
|
95
|
+
animRef.current = null;
|
|
96
96
|
}, []);
|
|
97
97
|
return {
|
|
98
|
-
indicatorX,
|
|
99
|
-
indicatorWidth,
|
|
100
|
-
indicatorInitializedRef,
|
|
98
|
+
indicatorX: indX,
|
|
99
|
+
indicatorWidth: indW,
|
|
100
|
+
indicatorInitializedRef: indInitRef,
|
|
101
101
|
animateIndicator
|
|
102
102
|
};
|
|
103
103
|
};
|
|
@@ -110,97 +110,86 @@ const useTabsScroll = ({
|
|
|
110
110
|
navContainerWidthRef,
|
|
111
111
|
navContentWidthRef
|
|
112
112
|
}) => {
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
const
|
|
113
|
+
const navScrRef = (0, _react().useRef)(null);
|
|
114
|
+
const navX = (0, _react().useRef)(new (_reactNative().Animated.Value)(0)).current;
|
|
115
|
+
const navAnimRef = (0, _react().useRef)(null);
|
|
116
|
+
const autoScrRef = (0, _react().useRef)(false);
|
|
117
|
+
const lastXRef = (0, _react().useRef)(0);
|
|
118
|
+
const frameRef = (0, _react().useRef)(null);
|
|
119
119
|
const scrollIntoView = (0, _react().useCallback)(immediate => {
|
|
120
120
|
if (!scrollable || currentName == null) return;
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
if (!
|
|
124
|
-
const
|
|
125
|
-
const
|
|
126
|
-
const
|
|
127
|
-
const
|
|
128
|
-
if (
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
cancelFrame(navAutoScrollFrameRef.current);
|
|
135
|
-
navAutoScrollFrameRef.current = null;
|
|
121
|
+
const lay = layoutMap.current.get(currentName);
|
|
122
|
+
const ctrW = navContainerWidthRef.current;
|
|
123
|
+
if (!lay || !ctrW) return;
|
|
124
|
+
const cntW = navContentWidthRef.current;
|
|
125
|
+
const tX = lay.x - (ctrW - lay.width) / 2;
|
|
126
|
+
const maxS = Math.max(cntW - ctrW, 0);
|
|
127
|
+
const clampX = Math.max(0, Math.min(tX, maxS));
|
|
128
|
+
if (maxS <= 0 || Math.abs(clampX - lastXRef.current) < 1) return;
|
|
129
|
+
navAnimRef.current?.stop();
|
|
130
|
+
navAnimRef.current = null;
|
|
131
|
+
cancelFrame(frameRef.current);
|
|
132
|
+
frameRef.current = null;
|
|
136
133
|
if (immediate || !animated) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
134
|
+
autoScrRef.current = true;
|
|
135
|
+
navX.setValue(clampX);
|
|
136
|
+
frameRef.current = requestFrame(() => {
|
|
137
|
+
frameRef.current = null;
|
|
138
|
+
autoScrRef.current = false;
|
|
142
139
|
});
|
|
143
140
|
return;
|
|
144
141
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
toValue:
|
|
142
|
+
navX.setValue(lastXRef.current);
|
|
143
|
+
autoScrRef.current = true;
|
|
144
|
+
navAnimRef.current = _reactNative().Animated.timing(navX, {
|
|
145
|
+
toValue: clampX,
|
|
149
146
|
duration: resolvedDuration,
|
|
150
147
|
useNativeDriver: false,
|
|
151
148
|
isInteraction: false
|
|
152
149
|
});
|
|
153
|
-
|
|
150
|
+
navAnimRef.current.start(({
|
|
154
151
|
finished
|
|
155
152
|
}) => {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if (
|
|
159
|
-
navLastScrollXRef.current = clampedX;
|
|
153
|
+
navAnimRef.current = null;
|
|
154
|
+
autoScrRef.current = false;
|
|
155
|
+
if (finished) lastXRef.current = clampX;
|
|
160
156
|
});
|
|
161
|
-
}, [animated, currentName,
|
|
157
|
+
}, [animated, currentName, navX, resolvedDuration, scrollable, layoutMap, navContainerWidthRef, navContentWidthRef]);
|
|
162
158
|
(0, _react().useEffect)(() => {
|
|
163
159
|
if (!scrollable) return;
|
|
164
|
-
const
|
|
160
|
+
const id = navX.addListener(({
|
|
165
161
|
value
|
|
166
162
|
}) => {
|
|
167
|
-
const prev =
|
|
168
|
-
|
|
169
|
-
if (Math.abs(value - prev)
|
|
170
|
-
navScrollRef.current?.scrollTo({
|
|
163
|
+
const prev = lastXRef.current;
|
|
164
|
+
lastXRef.current = value;
|
|
165
|
+
if (Math.abs(value - prev) >= 0.5) navScrRef.current?.scrollTo({
|
|
171
166
|
x: value,
|
|
172
167
|
y: 0,
|
|
173
168
|
animated: false
|
|
174
169
|
});
|
|
175
170
|
});
|
|
176
|
-
return () =>
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return () => {
|
|
182
|
-
cancelFrame(navAutoScrollFrameRef.current);
|
|
183
|
-
navAutoScrollFrameRef.current = null;
|
|
184
|
-
};
|
|
171
|
+
return () => navX.removeListener(id);
|
|
172
|
+
}, [navX, scrollable]);
|
|
173
|
+
(0, _react().useEffect)(() => () => {
|
|
174
|
+
cancelFrame(frameRef.current);
|
|
175
|
+
frameRef.current = null;
|
|
185
176
|
}, []);
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
navLastScrollXRef.current = event.nativeEvent.contentOffset.x;
|
|
177
|
+
const onNavBeginDrag = (0, _react().useCallback)(e => {
|
|
178
|
+
autoScrRef.current = false;
|
|
179
|
+
navAnimRef.current?.stop();
|
|
180
|
+
navAnimRef.current = null;
|
|
181
|
+
lastXRef.current = e.nativeEvent.contentOffset.x;
|
|
193
182
|
}, []);
|
|
194
|
-
const
|
|
195
|
-
if (
|
|
196
|
-
|
|
183
|
+
const onNavScroll = (0, _react().useCallback)(e => {
|
|
184
|
+
if (autoScrRef.current) return;
|
|
185
|
+
lastXRef.current = e.nativeEvent.contentOffset.x;
|
|
197
186
|
}, []);
|
|
198
187
|
return {
|
|
199
|
-
navScrollRef,
|
|
200
|
-
navScrollX,
|
|
188
|
+
navScrollRef: navScrRef,
|
|
189
|
+
navScrollX: navX,
|
|
201
190
|
scrollIntoView,
|
|
202
|
-
handleNavScrollBeginDrag,
|
|
203
|
-
handleNavScroll
|
|
191
|
+
handleNavScrollBeginDrag: onNavBeginDrag,
|
|
192
|
+
handleNavScroll: onNavScroll
|
|
204
193
|
};
|
|
205
194
|
};
|
|
206
195
|
const TabBarItemInner = ({
|
|
@@ -221,45 +210,45 @@ const TabBarItemInner = ({
|
|
|
221
210
|
onLayout,
|
|
222
211
|
isLast
|
|
223
212
|
}) => {
|
|
224
|
-
const
|
|
225
|
-
const
|
|
226
|
-
onPress:
|
|
213
|
+
const dis = !!pane.disabled;
|
|
214
|
+
const aria = (0, _hooks.useAriaPress)({
|
|
215
|
+
onPress: e => onSelect(pane, pane.index, e),
|
|
227
216
|
extraProps: {
|
|
228
217
|
accessibilityRole: 'tab',
|
|
229
218
|
accessibilityState: {
|
|
230
219
|
selected: isActive,
|
|
231
|
-
disabled:
|
|
220
|
+
disabled: dis
|
|
232
221
|
},
|
|
233
222
|
testID: `rv-tabs-item-${pane.name}`
|
|
234
223
|
}
|
|
235
224
|
});
|
|
236
|
-
const
|
|
237
|
-
const
|
|
238
|
-
const
|
|
239
|
-
const
|
|
240
|
-
const
|
|
241
|
-
const
|
|
242
|
-
const
|
|
243
|
-
const
|
|
244
|
-
const
|
|
245
|
-
const
|
|
246
|
-
const
|
|
247
|
-
const
|
|
248
|
-
const
|
|
249
|
-
const
|
|
225
|
+
const isCap = type === 'capsule';
|
|
226
|
+
const isJ = type === 'jumbo';
|
|
227
|
+
const isC = type === 'card';
|
|
228
|
+
const rTitle = (0, _validate.isFunction)(pane.title) ? pane.title(isActive) : pane.title ?? pane.name;
|
|
229
|
+
const rDesc = (0, _validate.isFunction)(pane.description) ? pane.description(isActive) : pane.description;
|
|
230
|
+
const actClr = titleActiveColor ?? (isC ? tokens.colors.cardActiveText : isCap ? tokens.colors.capsuleActiveText : color ?? tokens.colors.textActive);
|
|
231
|
+
const inactClr = titleInactiveColor ?? (isC ? color ?? tokens.colors.cardBorder : isCap ? tokens.colors.capsuleText : tokens.colors.text);
|
|
232
|
+
const txtClr = pane.disabled ? tokens.colors.textDisabled : isActive ? actClr : inactClr;
|
|
233
|
+
const descClr = dis ? tokens.colors.textDisabled : isJ ? isActive ? tokens.colors.jumboDescriptionActive : tokens.colors.jumboDescription : isActive ? tokens.colors.descriptionActive : tokens.colors.description;
|
|
234
|
+
const flex = !scrollable && (align !== 'start' || isC);
|
|
235
|
+
const compact = isC || isJ || isCap;
|
|
236
|
+
const hPad = compact ? 0 : tokens.tabList.paddingHorizontal;
|
|
237
|
+
const vPad = compact ? 0 : tokens.tabList.paddingVertical;
|
|
238
|
+
const lblWrap = [S.lblW, isJ && S.lblWJ, isC && S.cardLbl, isC && {
|
|
250
239
|
paddingHorizontal: tokens.card.paddingHorizontal,
|
|
251
240
|
paddingVertical: tokens.card.paddingVertical
|
|
252
|
-
},
|
|
241
|
+
}, isCap && {
|
|
253
242
|
flex: 1,
|
|
254
243
|
alignSelf: 'stretch',
|
|
255
244
|
paddingHorizontal: tokens.capsule.paddingHorizontal,
|
|
256
245
|
paddingVertical: tokens.capsule.paddingVertical
|
|
257
|
-
},
|
|
246
|
+
}, isJ && {
|
|
258
247
|
paddingHorizontal: tokens.jumbo.paddingHorizontal,
|
|
259
248
|
paddingVertical: tokens.jumbo.paddingVertical,
|
|
260
249
|
alignItems: 'center'
|
|
261
250
|
}].filter(Boolean);
|
|
262
|
-
const
|
|
251
|
+
const lblTxtWrap = isCap ? [{
|
|
263
252
|
flex: 1,
|
|
264
253
|
alignSelf: 'stretch',
|
|
265
254
|
justifyContent: 'center',
|
|
@@ -267,63 +256,64 @@ const TabBarItemInner = ({
|
|
|
267
256
|
borderRadius: tokens.capsule.radius,
|
|
268
257
|
backgroundColor: isActive ? color ?? tokens.colors.capsuleActiveBackground : tokens.colors.capsuleBackground
|
|
269
258
|
}] : null;
|
|
270
|
-
const
|
|
271
|
-
color:
|
|
272
|
-
|
|
259
|
+
const titleStyleArr = [S.title, {
|
|
260
|
+
color: txtClr,
|
|
261
|
+
fontFamily: tokens.typography.fontFamily,
|
|
262
|
+
fontSize: isJ ? tokens.typography.jumboTitleSize : tokens.typography.titleSize,
|
|
273
263
|
fontWeight: isActive ? tokens.typography.titleActiveWeight : tokens.typography.titleWeight,
|
|
274
|
-
lineHeight:
|
|
264
|
+
lineHeight: isJ ? tokens.typography.jumboLineHeight : undefined,
|
|
275
265
|
textAlign: 'center'
|
|
276
|
-
}, ellipsis && !
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
numberOfLines: ellipsis && !isJumbo ? 1 : undefined
|
|
280
|
-
}, renderTitle);
|
|
281
|
-
const descriptionMarginTop = isJumbo ? tokens.spacing.jumboDescriptionMarginTop : tokens.spacing.descriptionMarginTop;
|
|
282
|
-
const descriptionJumboStyle = isJumbo ? {
|
|
266
|
+
}, ellipsis && !isJ ? S.ellipsis : null, titleStyle];
|
|
267
|
+
const descMT = isJ ? tokens.spacing.jumboDescriptionMarginTop : tokens.spacing.descriptionMarginTop;
|
|
268
|
+
const descJStyle = isJ ? {
|
|
283
269
|
backgroundColor: isActive ? tokens.colors.jumboDescriptionActiveBackground : tokens.colors.jumboDescriptionBackground,
|
|
284
270
|
paddingHorizontal: tokens.jumbo.descriptionPaddingHorizontal,
|
|
285
271
|
paddingVertical: tokens.jumbo.descriptionPaddingVertical,
|
|
286
272
|
borderRadius: tokens.jumbo.descriptionRadius
|
|
287
273
|
} : null;
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
marginTop: descriptionMarginTop,
|
|
296
|
-
alignItems: 'center'
|
|
297
|
-
}, descriptionJumboStyle];
|
|
298
|
-
const handleLayout = (0, _react().useCallback)(event => {
|
|
299
|
-
onLayout(pane.name, event);
|
|
300
|
-
}, [onLayout, pane.name]);
|
|
301
|
-
return /*#__PURE__*/_react().default.createElement(_reactNative().Pressable, _extends({}, ariaPress.interactionProps, {
|
|
302
|
-
onLayout: handleLayout,
|
|
303
|
-
style: [S.tabI, shouldFlex ? S.flexI : null, {
|
|
304
|
-
paddingHorizontal: horizontalPadding,
|
|
305
|
-
paddingVertical: verticalPadding
|
|
306
|
-
}, isCard ? {
|
|
274
|
+
const onLay = (0, _react().useCallback)(e => onLayout(pane.name, e), [onLayout, pane.name]);
|
|
275
|
+
return /*#__PURE__*/_react().default.createElement(_reactNative().Pressable, _extends({}, aria.interactionProps, {
|
|
276
|
+
onLayout: onLay,
|
|
277
|
+
style: [S.tabI, flex ? S.flexI : null, {
|
|
278
|
+
paddingHorizontal: hPad,
|
|
279
|
+
paddingVertical: vPad
|
|
280
|
+
}, isC ? {
|
|
307
281
|
backgroundColor: isActive ? color ?? tokens.colors.cardActiveBackground : tokens.colors.cardBackground
|
|
308
282
|
} : null, tabStyle]
|
|
309
283
|
}), /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
310
|
-
style:
|
|
311
|
-
},
|
|
312
|
-
style:
|
|
313
|
-
},
|
|
314
|
-
style:
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
284
|
+
style: lblWrap
|
|
285
|
+
}, lblTxtWrap ? /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
286
|
+
style: lblTxtWrap
|
|
287
|
+
}, /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
|
|
288
|
+
style: titleStyleArr,
|
|
289
|
+
numberOfLines: ellipsis && !isJ ? 1 : undefined
|
|
290
|
+
}, rTitle)) : /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
|
|
291
|
+
style: titleStyleArr,
|
|
292
|
+
numberOfLines: ellipsis && !isJ ? 1 : undefined
|
|
293
|
+
}, rTitle), (0, _validate.isRenderable)(rDesc) && ((0, _validate.isText)(rDesc) ? /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
|
|
294
|
+
style: [S.descTxt, {
|
|
295
|
+
color: descClr,
|
|
296
|
+
fontFamily: tokens.typography.fontFamily,
|
|
297
|
+
fontSize: tokens.typography.descriptionSize,
|
|
298
|
+
marginTop: descMT,
|
|
299
|
+
textAlign: 'center'
|
|
300
|
+
}, descJStyle, descriptionStyle]
|
|
301
|
+
}, rDesc) : /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
302
|
+
style: [{
|
|
303
|
+
marginTop: descMT,
|
|
304
|
+
alignItems: 'center'
|
|
305
|
+
}, descJStyle]
|
|
306
|
+
}, rDesc)), (0, _validate.isRenderable)(pane.badge) && /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
318
307
|
style: {
|
|
319
308
|
marginTop: tokens.spacing.badgeMarginTop
|
|
320
309
|
}
|
|
321
310
|
}, (0, _validate.isText)(pane.badge) ? /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
|
|
322
311
|
style: {
|
|
323
312
|
color: tokens.colors.badgeText,
|
|
313
|
+
fontFamily: tokens.typography.fontFamily,
|
|
324
314
|
fontSize: tokens.typography.badgeTextSize
|
|
325
315
|
}
|
|
326
|
-
}, pane.badge) : pane.badge)),
|
|
316
|
+
}, pane.badge) : pane.badge)), isC && !isLast && /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
327
317
|
style: (0, _hairline.createHairlineView)({
|
|
328
318
|
position: 'right',
|
|
329
319
|
color: color ?? tokens.colors.cardBorder,
|
|
@@ -398,7 +388,7 @@ const TabsBaseInner = (props, ref) => {
|
|
|
398
388
|
_react().Children.forEach(nodes, node => {
|
|
399
389
|
if (! /*#__PURE__*/(0, _react().isValidElement)(node)) return;
|
|
400
390
|
const element = node;
|
|
401
|
-
if (element.type === _react().Fragment) {
|
|
391
|
+
if (element.type === _react().default.Fragment) {
|
|
402
392
|
walk(element.props.children);
|
|
403
393
|
return;
|
|
404
394
|
}
|
|
@@ -10,7 +10,8 @@ const createTokens = foundations => {
|
|
|
10
10
|
palette,
|
|
11
11
|
spacing,
|
|
12
12
|
fontSize,
|
|
13
|
-
radii
|
|
13
|
+
radii,
|
|
14
|
+
typography
|
|
14
15
|
} = foundations;
|
|
15
16
|
const onPrimary = palette.primary.foreground ?? '#ffffff';
|
|
16
17
|
return {
|
|
@@ -62,6 +63,7 @@ const createTokens = foundations => {
|
|
|
62
63
|
background: '#ffffff'
|
|
63
64
|
},
|
|
64
65
|
typography: {
|
|
66
|
+
fontFamily: typography.fontFamily,
|
|
65
67
|
titleSize: fontSize.sm,
|
|
66
68
|
titleWeight: foundations.typography.weight.medium,
|
|
67
69
|
titleActiveWeight: foundations.typography.weight.semiBold,
|
|
@@ -35,14 +35,14 @@ const TagImpl = props => {
|
|
|
35
35
|
const {
|
|
36
36
|
tokensOverride,
|
|
37
37
|
children,
|
|
38
|
-
type:
|
|
39
|
-
size:
|
|
40
|
-
plain:
|
|
41
|
-
round:
|
|
42
|
-
mark:
|
|
38
|
+
type: typeP,
|
|
39
|
+
size: sizeP,
|
|
40
|
+
plain: plainP,
|
|
41
|
+
round: roundP,
|
|
42
|
+
mark: markP,
|
|
43
43
|
color,
|
|
44
44
|
textColor,
|
|
45
|
-
show:
|
|
45
|
+
show: showP,
|
|
46
46
|
closeable,
|
|
47
47
|
closeIcon,
|
|
48
48
|
onClose,
|
|
@@ -53,20 +53,20 @@ const TagImpl = props => {
|
|
|
53
53
|
} = props;
|
|
54
54
|
const tokens = (0, _tokens.useTagTokens)(tokensOverride);
|
|
55
55
|
const dir = (0, _useDirection.useDirection)();
|
|
56
|
-
const type =
|
|
57
|
-
const size =
|
|
58
|
-
const plain =
|
|
59
|
-
const round =
|
|
60
|
-
const mark =
|
|
61
|
-
const show =
|
|
56
|
+
const type = typeP ?? tokens.defaults.type;
|
|
57
|
+
const size = sizeP ?? tokens.defaults.size;
|
|
58
|
+
const plain = plainP ?? tokens.defaults.plain;
|
|
59
|
+
const round = roundP ?? tokens.defaults.round;
|
|
60
|
+
const mark = markP ?? tokens.defaults.mark;
|
|
61
|
+
const show = showP ?? tokens.defaults.show;
|
|
62
62
|
if (!show) return null;
|
|
63
63
|
const tone = tokens.colors.toneMap[type] ?? tokens.colors.toneMap.default;
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
const
|
|
64
|
+
const szTok = tokens.sizing.sizes[size];
|
|
65
|
+
const bgClr = plain ? tokens.colors.plainBackground : color ?? tone.background;
|
|
66
|
+
const txtClr = textColor ?? (plain ? color ?? tone.background : tone.text);
|
|
67
|
+
const borderClr = plain ? color ?? tone.background : 'transparent';
|
|
68
|
+
const radius = round ? tokens.radii.round : szTok.borderRadius;
|
|
69
|
+
const markR = mark ? dir === 'rtl' ? {
|
|
70
70
|
borderTopRightRadius: tokens.radii.markLeading,
|
|
71
71
|
borderBottomRightRadius: tokens.radii.markLeading,
|
|
72
72
|
borderTopLeftRadius: tokens.radii.round,
|
|
@@ -77,17 +77,17 @@ const TagImpl = props => {
|
|
|
77
77
|
borderTopRightRadius: tokens.radii.round,
|
|
78
78
|
borderBottomRightRadius: tokens.radii.round
|
|
79
79
|
} : null;
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
backgroundColor,
|
|
83
|
-
paddingHorizontal:
|
|
84
|
-
paddingVertical:
|
|
85
|
-
borderRadius
|
|
86
|
-
},
|
|
80
|
+
const resRadius = mark ? tokens.radii.round : radius;
|
|
81
|
+
const ctrStyle = [tokens.layout.container, {
|
|
82
|
+
backgroundColor: bgClr,
|
|
83
|
+
paddingHorizontal: szTok.paddingHorizontal,
|
|
84
|
+
paddingVertical: szTok.paddingVertical,
|
|
85
|
+
borderRadius: radius
|
|
86
|
+
}, markR, style];
|
|
87
87
|
const label = !(0, _validate.isRenderable)(children) ? null : (0, _utils.renderTextOrNode)(children, [{
|
|
88
|
-
color:
|
|
89
|
-
fontSize:
|
|
90
|
-
lineHeight:
|
|
88
|
+
color: txtClr,
|
|
89
|
+
fontSize: szTok.fontSize,
|
|
90
|
+
lineHeight: szTok.lineHeight,
|
|
91
91
|
fontFamily: tokens.typography.fontFamily,
|
|
92
92
|
fontWeight: tokens.typography.fontWeight
|
|
93
93
|
}, textStyle].filter(Boolean));
|
|
@@ -97,33 +97,33 @@ const TagImpl = props => {
|
|
|
97
97
|
style: [tokens.layout.close, {
|
|
98
98
|
marginLeft: tokens.spacing.closeGap
|
|
99
99
|
}],
|
|
100
|
-
onPress:
|
|
101
|
-
|
|
100
|
+
onPress: e => {
|
|
101
|
+
e.stopPropagation?.();
|
|
102
102
|
onClose?.();
|
|
103
103
|
}
|
|
104
|
-
}, (0, _utils.isFunction)(closeIcon) ? closeIcon(
|
|
105
|
-
color:
|
|
104
|
+
}, (0, _utils.isFunction)(closeIcon) ? closeIcon(txtClr, tokens.sizing.closeIconSize) : closeIcon ?? /*#__PURE__*/_react().default.createElement(_reactNativeSystemIcon().Close, {
|
|
105
|
+
color: txtClr,
|
|
106
106
|
size: tokens.sizing.closeIconSize
|
|
107
107
|
}));
|
|
108
|
-
const
|
|
108
|
+
const hlOverlay = plain ? /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
109
109
|
style: (0, _utils.createHairlineView)({
|
|
110
110
|
position: 'all',
|
|
111
|
-
color:
|
|
112
|
-
borderRadius:
|
|
111
|
+
color: borderClr,
|
|
112
|
+
borderRadius: resRadius
|
|
113
113
|
})
|
|
114
114
|
}) : null;
|
|
115
|
-
const content = /*#__PURE__*/_react().default.createElement(_react().default.Fragment, null, label, close,
|
|
115
|
+
const content = /*#__PURE__*/_react().default.createElement(_react().default.Fragment, null, label, close, hlOverlay);
|
|
116
116
|
if (onPress) return /*#__PURE__*/_react().default.createElement(_reactNative().Pressable, _extends({
|
|
117
117
|
accessibilityRole: "button",
|
|
118
118
|
onPress: onPress,
|
|
119
119
|
style: ({
|
|
120
120
|
pressed
|
|
121
|
-
}) => [
|
|
121
|
+
}) => [ctrStyle, pressed && {
|
|
122
122
|
opacity: tokens.defaults.pressedOpacity
|
|
123
123
|
}]
|
|
124
124
|
}, rest), content);
|
|
125
125
|
return /*#__PURE__*/_react().default.createElement(_reactNative().View, _extends({
|
|
126
|
-
style:
|
|
126
|
+
style: ctrStyle
|
|
127
127
|
}, rest), content);
|
|
128
128
|
};
|
|
129
129
|
const Tag = exports.Tag = /*#__PURE__*/_react().default.memo(TagImpl);
|
|
@@ -219,8 +219,9 @@ const ToastContentImpl = props => {
|
|
|
219
219
|
const messageStyle = (0, _react().useMemo)(() => ({
|
|
220
220
|
color: colors.text,
|
|
221
221
|
fontSize: tokens.fontSize,
|
|
222
|
-
lineHeight: tokens.lineHeight
|
|
223
|
-
|
|
222
|
+
lineHeight: tokens.lineHeight,
|
|
223
|
+
fontFamily: tokens.fontFamily
|
|
224
|
+
}), [colors.text, tokens.fontSize, tokens.fontFamily, tokens.lineHeight]);
|
|
224
225
|
const isTextOnly = type === 'info' && !iconNode;
|
|
225
226
|
const baseStyle = (0, _react().useMemo)(() => isTextOnly ? {
|
|
226
227
|
minWidth: tokens.textMinWidth,
|
|
@@ -22,6 +22,7 @@ const createToastTokens = foundations => {
|
|
|
22
22
|
},
|
|
23
23
|
fontSize: foundations.fontSize.sm,
|
|
24
24
|
lineHeight: Math.round(foundations.fontSize.sm * foundations.typography.lineHeightMultiplier),
|
|
25
|
+
fontFamily: foundations.typography.fontFamily,
|
|
25
26
|
radius: foundations.radii.md,
|
|
26
27
|
gap: foundations.spacing.sm,
|
|
27
28
|
iconSize: 36,
|