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
|
@@ -38,11 +38,11 @@ const TypographyTextBaseInner = /*#__PURE__*/_react().default.forwardRef((props,
|
|
|
38
38
|
const {
|
|
39
39
|
tokensOverride,
|
|
40
40
|
children,
|
|
41
|
-
type:
|
|
42
|
-
color:
|
|
43
|
-
size:
|
|
41
|
+
type: typeP,
|
|
42
|
+
color: colorP,
|
|
43
|
+
size: sizeP,
|
|
44
44
|
level,
|
|
45
|
-
disabled:
|
|
45
|
+
disabled: disP,
|
|
46
46
|
delete: deleted,
|
|
47
47
|
underline,
|
|
48
48
|
center,
|
|
@@ -53,9 +53,9 @@ const TypographyTextBaseInner = /*#__PURE__*/_react().default.forwardRef((props,
|
|
|
53
53
|
...textProps
|
|
54
54
|
} = props;
|
|
55
55
|
const tokens = (0, _tokens.useTypographyTokens)(tokensOverride);
|
|
56
|
-
const type =
|
|
57
|
-
const size =
|
|
58
|
-
const disabled =
|
|
56
|
+
const type = typeP ?? tokens.defaults.type;
|
|
57
|
+
const size = sizeP ?? tokens.defaults.size;
|
|
58
|
+
const disabled = disP ?? tokens.defaults.disabled;
|
|
59
59
|
const ellipsisRows = resolveEllipsisRows(ellipsis);
|
|
60
60
|
const ellipsisConfig = isEllipsisObject(ellipsis) ? ellipsis : undefined;
|
|
61
61
|
const [isTruncated, setIsTruncated] = (0, _react().useState)(false);
|
|
@@ -67,13 +67,14 @@ const TypographyTextBaseInner = /*#__PURE__*/_react().default.forwardRef((props,
|
|
|
67
67
|
setIsTruncated(prev => prev === exceeded ? prev : exceeded);
|
|
68
68
|
}, [ellipsisRows, expanded]);
|
|
69
69
|
let resolvedColor = tokens.colors[type] ?? tokens.colors.default;
|
|
70
|
-
if (
|
|
71
|
-
const
|
|
72
|
-
resolvedColor = hasTypographyColorKey(tokens.colors,
|
|
70
|
+
if (colorP !== undefined && colorP !== null) {
|
|
71
|
+
const ck = String(colorP);
|
|
72
|
+
resolvedColor = hasTypographyColorKey(tokens.colors, ck) ? tokens.colors[ck] : ck;
|
|
73
73
|
}
|
|
74
|
+
;
|
|
74
75
|
const fontSize = level ? tokens.sizing.titles[level].fontSize : tokens.sizing.sizes[size];
|
|
75
76
|
const lineHeight = level ? tokens.sizing.titles[level].lineHeight : fontSize * tokens.sizing.lineHeightMultiplier;
|
|
76
|
-
const
|
|
77
|
+
const textDeco = underline && deleted ? 'underline line-through' : underline ? 'underline' : deleted ? 'line-through' : undefined;
|
|
77
78
|
const baseStyle = [{
|
|
78
79
|
color: resolvedColor,
|
|
79
80
|
fontSize,
|
|
@@ -81,12 +82,12 @@ const TypographyTextBaseInner = /*#__PURE__*/_react().default.forwardRef((props,
|
|
|
81
82
|
fontFamily: tokens.typography.fontFamily,
|
|
82
83
|
fontWeight: strong ? tokens.typography.weight.strong : tokens.typography.weight.regular,
|
|
83
84
|
includeFontPadding: false,
|
|
84
|
-
textDecorationLine,
|
|
85
|
+
textDecorationLine: textDeco,
|
|
85
86
|
textAlign: center ? 'center' : undefined,
|
|
86
87
|
opacity: disabled ? tokens.opacity.disabled : 1
|
|
87
88
|
}, style];
|
|
88
|
-
const
|
|
89
|
-
const
|
|
89
|
+
const hasActTxt = !!ellipsisConfig && (ellipsisConfig.expandText || ellipsisConfig.collapseText);
|
|
90
|
+
const showAct = hasActTxt && (isTruncated || expanded || isWeb);
|
|
90
91
|
const handleToggleEllipsis = (0, _react().useCallback)(() => {
|
|
91
92
|
if (!ellipsisConfig) return;
|
|
92
93
|
setExpanded(prev => {
|
|
@@ -95,24 +96,24 @@ const TypographyTextBaseInner = /*#__PURE__*/_react().default.forwardRef((props,
|
|
|
95
96
|
return next;
|
|
96
97
|
});
|
|
97
98
|
}, [ellipsisConfig]);
|
|
98
|
-
const
|
|
99
|
-
const
|
|
99
|
+
const actLabel = !ellipsisConfig ? undefined : expanded ? ellipsisConfig.collapseText ?? ellipsisConfig.expandText : ellipsisConfig.expandText ?? ellipsisConfig.collapseText;
|
|
100
|
+
const actTxtStyle = {
|
|
100
101
|
color: tokens.colors.primary,
|
|
101
102
|
fontSize: tokens.sizing.sizes.sm,
|
|
102
103
|
fontWeight: tokens.typography.weight.medium,
|
|
103
104
|
marginLeft: tokens.sizing.actionMarginLeft,
|
|
104
105
|
includeFontPadding: false
|
|
105
106
|
};
|
|
106
|
-
const textStyle =
|
|
107
|
+
const textStyle = showAct ? [baseStyle, FLEX_SHRINK_STYLE] : baseStyle;
|
|
107
108
|
const textNode = /*#__PURE__*/_react().default.createElement(_reactNative().Text, _extends({
|
|
108
109
|
ref: ref,
|
|
109
110
|
style: textStyle,
|
|
110
111
|
onPress: onPress,
|
|
111
112
|
numberOfLines: !expanded ? ellipsisRows : undefined,
|
|
112
113
|
ellipsizeMode: "tail",
|
|
113
|
-
onTextLayout:
|
|
114
|
+
onTextLayout: hasActTxt && ellipsisRows && !expanded && !isWeb ? handleTextLayout : undefined
|
|
114
115
|
}, textProps), children);
|
|
115
|
-
if (!
|
|
116
|
+
if (!showAct) return center ? /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
116
117
|
style: tokens.layout.centerWrapper
|
|
117
118
|
}, textNode) : textNode;
|
|
118
119
|
const actionNode = /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
@@ -120,8 +121,8 @@ const TypographyTextBaseInner = /*#__PURE__*/_react().default.forwardRef((props,
|
|
|
120
121
|
}, textNode, /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
|
|
121
122
|
onPress: handleToggleEllipsis,
|
|
122
123
|
suppressHighlighting: true,
|
|
123
|
-
style:
|
|
124
|
-
},
|
|
124
|
+
style: actTxtStyle
|
|
125
|
+
}, actLabel));
|
|
125
126
|
return center ? /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
126
127
|
style: tokens.layout.centerWrapper
|
|
127
128
|
}, actionNode) : actionNode;
|
|
@@ -156,6 +157,7 @@ const TypographyLink = /*#__PURE__*/_react().default.forwardRef((props, ref) =>
|
|
|
156
157
|
onPress(event);
|
|
157
158
|
return;
|
|
158
159
|
}
|
|
160
|
+
;
|
|
159
161
|
if (href) {
|
|
160
162
|
try {
|
|
161
163
|
await _reactNative().Linking.openURL(href);
|
|
@@ -27,7 +27,7 @@ const resolveNonNegativeNumber = (value, fallback) => Math.max(0, resolveFiniteN
|
|
|
27
27
|
const resolvePositiveNumber = (value, fallback) => Math.max(1, resolveFiniteNumber(value, fallback));
|
|
28
28
|
const WaterMarkImpl = props => {
|
|
29
29
|
const {
|
|
30
|
-
content:
|
|
30
|
+
content: contentP,
|
|
31
31
|
width,
|
|
32
32
|
height,
|
|
33
33
|
gapX,
|
|
@@ -38,8 +38,8 @@ const WaterMarkImpl = props => {
|
|
|
38
38
|
fontSize,
|
|
39
39
|
color,
|
|
40
40
|
opacity,
|
|
41
|
-
zIndex:
|
|
42
|
-
fullPage:
|
|
41
|
+
zIndex: zIdxP,
|
|
42
|
+
fullPage: fullP,
|
|
43
43
|
tokensOverride,
|
|
44
44
|
style,
|
|
45
45
|
onLayoutCalculated,
|
|
@@ -47,9 +47,9 @@ const WaterMarkImpl = props => {
|
|
|
47
47
|
...rest
|
|
48
48
|
} = props;
|
|
49
49
|
const tokens = (0, _tokens.useWaterMarkTokens)(tokensOverride);
|
|
50
|
-
const content =
|
|
51
|
-
const zIndex = resolveFiniteNumber(
|
|
52
|
-
const fullPage =
|
|
50
|
+
const content = contentP ?? tokens.defaults.content;
|
|
51
|
+
const zIndex = resolveFiniteNumber(zIdxP, tokens.defaults.zIndex);
|
|
52
|
+
const fullPage = fullP ?? tokens.defaults.fullPage;
|
|
53
53
|
const window = (0, _reactNative().useWindowDimensions)();
|
|
54
54
|
const [layoutSize, setLayoutSize] = (0, _react().useState)({
|
|
55
55
|
width: 0,
|
|
@@ -60,99 +60,99 @@ const WaterMarkImpl = props => {
|
|
|
60
60
|
height: 0
|
|
61
61
|
});
|
|
62
62
|
const size = fullPage ? window : layoutSize;
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
const rows = size.height ? Math.ceil(size.height /
|
|
75
|
-
const cols = size.width ? Math.ceil(size.width /
|
|
76
|
-
const
|
|
77
|
-
|
|
63
|
+
const rGapX = resolveNonNegativeNumber(gapX, tokens.defaults.gapX);
|
|
64
|
+
const rGapY = resolveNonNegativeNumber(gapY, tokens.defaults.gapY);
|
|
65
|
+
const rRotate = resolveFiniteNumber(rotate, tokens.defaults.rotate);
|
|
66
|
+
const rOpacity = Math.max(0, Math.min(1, resolveFiniteNumber(opacity, tokens.defaults.opacity)));
|
|
67
|
+
const fontSzFromFont = (0, _utils.isFiniteNumber)(font?.size) ? font.size : (0, _utils.isString)(font?.size) ? Number.parseFloat(font.size) : undefined;
|
|
68
|
+
const normFontSz = Math.max(0, resolveFiniteNumber((Number.isFinite(fontSzFromFont ?? Number.NaN) ? fontSzFromFont : undefined) ?? fontSize, tokens.defaults.fontSize));
|
|
69
|
+
const rColor = font?.color ?? color ?? tokens.colors.mark;
|
|
70
|
+
const markW = resolvePositiveNumber(image?.width ?? width, tokens.defaults.width);
|
|
71
|
+
const markH = resolvePositiveNumber(image?.height ?? height, tokens.defaults.height);
|
|
72
|
+
const cellW = Math.max(1, markW + rGapX);
|
|
73
|
+
const cellH = Math.max(1, markH + rGapY);
|
|
74
|
+
const rows = size.height ? Math.ceil(size.height / cellH) + 1 : 1;
|
|
75
|
+
const cols = size.width ? Math.ceil(size.width / cellW) + 1 : 1;
|
|
76
|
+
const onLayoutCalcRef = (0, _react().useRef)(onLayoutCalculated);
|
|
77
|
+
onLayoutCalcRef.current = onLayoutCalculated;
|
|
78
78
|
const handleLayout = (0, _react().useCallback)(event => {
|
|
79
79
|
if (fullPage) return;
|
|
80
80
|
const {
|
|
81
|
-
width,
|
|
82
|
-
height
|
|
81
|
+
width: w,
|
|
82
|
+
height: h
|
|
83
83
|
} = event.nativeEvent.layout;
|
|
84
|
-
if (!(0, _utils.isFiniteNumber)(
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
if (lastLayoutRef.current.width ===
|
|
84
|
+
if (!(0, _utils.isFiniteNumber)(w) || !(0, _utils.isFiniteNumber)(h)) return;
|
|
85
|
+
const nw = Math.max(0, w),
|
|
86
|
+
nh = Math.max(0, h);
|
|
87
|
+
if (lastLayoutRef.current.width === nw && lastLayoutRef.current.height === nh) return;
|
|
88
88
|
lastLayoutRef.current = {
|
|
89
|
-
width:
|
|
90
|
-
height:
|
|
89
|
+
width: nw,
|
|
90
|
+
height: nh
|
|
91
91
|
};
|
|
92
92
|
setLayoutSize({
|
|
93
|
-
width:
|
|
94
|
-
height:
|
|
93
|
+
width: nw,
|
|
94
|
+
height: nh
|
|
95
95
|
});
|
|
96
|
-
|
|
97
|
-
width:
|
|
98
|
-
height:
|
|
96
|
+
onLayoutCalcRef.current?.({
|
|
97
|
+
width: nw,
|
|
98
|
+
height: nh
|
|
99
99
|
});
|
|
100
100
|
}, [fullPage]);
|
|
101
101
|
(0, _react().useEffect)(() => {
|
|
102
102
|
if (!fullPage || !(0, _utils.isFiniteNumber)(window.width) || !(0, _utils.isFiniteNumber)(window.height) || window.width <= 0 || window.height <= 0) return;
|
|
103
|
-
|
|
103
|
+
onLayoutCalcRef.current?.({
|
|
104
104
|
width: window.width,
|
|
105
105
|
height: window.height
|
|
106
106
|
});
|
|
107
107
|
}, [fullPage, window.width, window.height]);
|
|
108
|
-
const
|
|
108
|
+
const zIdxStyle = (0, _react().useMemo)(() => ({
|
|
109
109
|
zIndex
|
|
110
110
|
}), [zIndex]);
|
|
111
111
|
const cellStyle = (0, _react().useMemo)(() => ({
|
|
112
|
-
width:
|
|
113
|
-
height:
|
|
114
|
-
}), [
|
|
112
|
+
width: cellW,
|
|
113
|
+
height: cellH
|
|
114
|
+
}), [cellW, cellH]);
|
|
115
115
|
const oddRowStyle = (0, _react().useMemo)(() => ({
|
|
116
|
-
paddingLeft:
|
|
117
|
-
}), [
|
|
116
|
+
paddingLeft: cellW / 2
|
|
117
|
+
}), [cellW]);
|
|
118
118
|
const markStyle = (0, _react().useMemo)(() => ({
|
|
119
|
-
width:
|
|
120
|
-
height:
|
|
119
|
+
width: markW,
|
|
120
|
+
height: markH,
|
|
121
121
|
transform: [{
|
|
122
|
-
rotate: `${
|
|
122
|
+
rotate: `${rRotate}deg`
|
|
123
123
|
}]
|
|
124
|
-
}), [
|
|
125
|
-
const
|
|
126
|
-
width:
|
|
127
|
-
height:
|
|
128
|
-
opacity:
|
|
129
|
-
}), [
|
|
130
|
-
const
|
|
131
|
-
fontSize:
|
|
132
|
-
color:
|
|
133
|
-
opacity:
|
|
124
|
+
}), [markW, markH, rRotate]);
|
|
125
|
+
const imgStyle = (0, _react().useMemo)(() => ({
|
|
126
|
+
width: markW,
|
|
127
|
+
height: markH,
|
|
128
|
+
opacity: rOpacity
|
|
129
|
+
}), [markW, markH, rOpacity]);
|
|
130
|
+
const txtBaseStyle = (0, _react().useMemo)(() => ({
|
|
131
|
+
fontSize: normFontSz,
|
|
132
|
+
color: rColor,
|
|
133
|
+
opacity: rOpacity,
|
|
134
134
|
fontFamily: font?.family,
|
|
135
135
|
fontWeight: font?.weight
|
|
136
|
-
}), [
|
|
137
|
-
const
|
|
136
|
+
}), [normFontSz, rColor, rOpacity, font?.family, font?.weight]);
|
|
137
|
+
const rowIdx = Array.from({
|
|
138
138
|
length: rows
|
|
139
139
|
}, (_, i) => i);
|
|
140
|
-
const
|
|
140
|
+
const colIdx = Array.from({
|
|
141
141
|
length: cols
|
|
142
142
|
}, (_, i) => i);
|
|
143
143
|
return /*#__PURE__*/_react().default.createElement(_reactNative().View, _extends({
|
|
144
144
|
pointerEvents: "none",
|
|
145
145
|
importantForAccessibility: "no-hide-descendants",
|
|
146
146
|
accessibilityElementsHidden: true,
|
|
147
|
-
style: [fullPage ? tokens.layout.absoluteFill : null,
|
|
147
|
+
style: [fullPage ? tokens.layout.absoluteFill : null, zIdxStyle, style],
|
|
148
148
|
onLayout: handleLayout
|
|
149
149
|
}, rest), /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
150
150
|
style: tokens.layout.wrapper
|
|
151
|
-
},
|
|
152
|
-
key: `row-${
|
|
153
|
-
style: [tokens.layout.row,
|
|
154
|
-
},
|
|
155
|
-
key: `col-${
|
|
151
|
+
}, rowIdx.map(ri => /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
152
|
+
key: `row-${ri}`,
|
|
153
|
+
style: [tokens.layout.row, ri % 2 === 0 ? null : oddRowStyle]
|
|
154
|
+
}, colIdx.map(ci => /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
155
|
+
key: `col-${ri}-${ci}`,
|
|
156
156
|
style: [tokens.layout.cell, cellStyle]
|
|
157
157
|
}, /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
158
158
|
style: [tokens.layout.mark, markStyle]
|
|
@@ -160,11 +160,11 @@ const WaterMarkImpl = props => {
|
|
|
160
160
|
source: {
|
|
161
161
|
uri: image.src
|
|
162
162
|
},
|
|
163
|
-
style:
|
|
163
|
+
style: imgStyle,
|
|
164
164
|
resizeMode: "contain"
|
|
165
165
|
}) : /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
|
|
166
166
|
allowFontScaling: false,
|
|
167
|
-
style: [
|
|
167
|
+
style: [txtBaseStyle, textStyle]
|
|
168
168
|
}, content))))))));
|
|
169
169
|
};
|
|
170
170
|
const WaterMark = /*#__PURE__*/_react().default.memo(WaterMarkImpl);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Text = void 0;
|
|
7
|
+
function _react() {
|
|
8
|
+
const data = _interopRequireDefault(require("react"));
|
|
9
|
+
_react = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _reactNative() {
|
|
15
|
+
const data = require("react-native");
|
|
16
|
+
_reactNative = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
var _useTheme = require("./useTheme");
|
|
22
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
24
|
+
const Text = exports.Text = /*#__PURE__*/_react().default.forwardRef(({
|
|
25
|
+
style,
|
|
26
|
+
...rest
|
|
27
|
+
}, ref) => {
|
|
28
|
+
const {
|
|
29
|
+
foundations
|
|
30
|
+
} = (0, _useTheme.useTheme)();
|
|
31
|
+
return /*#__PURE__*/_react().default.createElement(_reactNative().Text, _extends({
|
|
32
|
+
ref: ref,
|
|
33
|
+
style: [{
|
|
34
|
+
fontFamily: foundations.typography.fontFamily
|
|
35
|
+
}, style]
|
|
36
|
+
}, rest));
|
|
37
|
+
});
|
|
38
|
+
Text.displayName = 'Text';
|
|
@@ -21,8 +21,8 @@ const createComponentTokensHook = (key, createBaseTokens) => overrides => {
|
|
|
21
21
|
const co = components?.[key];
|
|
22
22
|
return (0, _react().useMemo)(() => {
|
|
23
23
|
const base = createBaseTokens(foundations);
|
|
24
|
-
const
|
|
25
|
-
return
|
|
24
|
+
const m = co && overrides ? (0, _deepMerge.deepMerge)(co, overrides) : co ?? overrides;
|
|
25
|
+
return m ? (0, _deepMerge.deepMerge)(base, m) : base;
|
|
26
26
|
}, [co, foundations, overrides]);
|
|
27
27
|
};
|
|
28
28
|
exports.createComponentTokensHook = createComponentTokensHook;
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "Text", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Text.Text;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "ThemeProvider", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
|
@@ -52,6 +58,7 @@ Object.defineProperty(exports, "useTheme", {
|
|
|
52
58
|
}
|
|
53
59
|
});
|
|
54
60
|
var _ThemeProvider = require("./ThemeProvider");
|
|
61
|
+
var _Text = require("./Text");
|
|
55
62
|
var _useTheme = require("./useTheme");
|
|
56
63
|
var _createComponentTokensHook = require("./createComponentTokensHook");
|
|
57
64
|
var _mergeTokensOverride = require("./mergeTokensOverride");
|
|
@@ -5,8 +5,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.mergeTokensOverride = void 0;
|
|
7
7
|
var _deepMerge = require("../utils/deepMerge");
|
|
8
|
-
const mergeTokensOverride = (base, override) =>
|
|
9
|
-
if (base && override) return (0, _deepMerge.deepMerge)(base, override);
|
|
10
|
-
return base ?? override;
|
|
11
|
-
};
|
|
8
|
+
const mergeTokensOverride = (base, override) => base && override ? (0, _deepMerge.deepMerge)(base, override) : base ?? override;
|
|
12
9
|
exports.mergeTokensOverride = mergeTokensOverride;
|
|
@@ -21,21 +21,21 @@ function useControllableValue(props = {}, options = {}) {
|
|
|
21
21
|
trigger = 'onChange'
|
|
22
22
|
} = options;
|
|
23
23
|
const p = props;
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const [
|
|
27
|
-
if (
|
|
24
|
+
const ctrl = hasProp(props, valuePropName);
|
|
25
|
+
const val = p[valuePropName];
|
|
26
|
+
const [intVal, setIntVal] = (0, _react().useState)(() => {
|
|
27
|
+
if (ctrl) return val;
|
|
28
28
|
if (hasProp(props, defaultValuePropName)) return p[defaultValuePropName];
|
|
29
29
|
return defaultValue;
|
|
30
30
|
});
|
|
31
|
-
const
|
|
31
|
+
const hRef = (0, _react().useRef)(p[trigger]);
|
|
32
32
|
(0, _react().useEffect)(() => {
|
|
33
|
-
|
|
33
|
+
hRef.current = p[trigger];
|
|
34
34
|
}, [props, trigger]);
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
37
|
-
if ((0, _validate.isFunction)(
|
|
38
|
-
}, [
|
|
39
|
-
return [
|
|
35
|
+
const setVal = (0, _react().useCallback)((next, ...args) => {
|
|
36
|
+
if (!ctrl) setIntVal(next);
|
|
37
|
+
if ((0, _validate.isFunction)(hRef.current)) hRef.current(next, ...args);
|
|
38
|
+
}, [ctrl]);
|
|
39
|
+
return [ctrl ? val : intVal, setVal];
|
|
40
40
|
}
|
|
41
41
|
var _default = exports.default = useControllableValue;
|
|
@@ -44,31 +44,31 @@ const useCountDown = options => {
|
|
|
44
44
|
const timerRef = (0, _react().useRef)(null);
|
|
45
45
|
const countingRef = (0, _react().useRef)(false);
|
|
46
46
|
const [current, setCurrent] = (0, _react().useState)(() => parseTime(remainRef.current));
|
|
47
|
-
const
|
|
47
|
+
const clear = (0, _react().useCallback)(() => {
|
|
48
48
|
if (timerRef.current) {
|
|
49
49
|
clearTimeout(timerRef.current);
|
|
50
50
|
timerRef.current = null;
|
|
51
51
|
}
|
|
52
52
|
}, []);
|
|
53
|
-
const update = (0, _react().useCallback)(
|
|
54
|
-
remainRef.current =
|
|
55
|
-
const next = parseTime(
|
|
53
|
+
const update = (0, _react().useCallback)(rem => {
|
|
54
|
+
remainRef.current = rem;
|
|
55
|
+
const next = parseTime(rem);
|
|
56
56
|
setCurrent(next);
|
|
57
57
|
onChangeRef.current?.(next);
|
|
58
|
-
if (
|
|
58
|
+
if (rem === 0) {
|
|
59
59
|
countingRef.current = false;
|
|
60
|
-
|
|
60
|
+
clear();
|
|
61
61
|
onFinishRef.current?.();
|
|
62
62
|
}
|
|
63
|
-
}, [
|
|
63
|
+
}, [clear]);
|
|
64
64
|
const tick = (0, _react().useCallback)(() => {
|
|
65
65
|
if (!countingRef.current) return;
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
update(
|
|
69
|
-
if (
|
|
70
|
-
timerRef.current = setTimeout(tick, msRef.current ? Math.max(1, Math.min(30,
|
|
71
|
-
}, [
|
|
66
|
+
clear();
|
|
67
|
+
const rem = Math.max(endTimeRef.current - Date.now(), 0);
|
|
68
|
+
update(rem);
|
|
69
|
+
if (rem <= 0) return;
|
|
70
|
+
timerRef.current = setTimeout(tick, msRef.current ? Math.max(1, Math.min(30, rem)) : Math.max(1, Math.min(rem, rem % 1000 + 1)));
|
|
71
|
+
}, [clear, update]);
|
|
72
72
|
const start = (0, _react().useCallback)(() => {
|
|
73
73
|
if (countingRef.current || remainRef.current <= 0) return;
|
|
74
74
|
countingRef.current = true;
|
|
@@ -79,16 +79,16 @@ const useCountDown = options => {
|
|
|
79
79
|
if (!countingRef.current) return;
|
|
80
80
|
countingRef.current = false;
|
|
81
81
|
remainRef.current = Math.max(endTimeRef.current - Date.now(), 0);
|
|
82
|
-
|
|
83
|
-
}, [
|
|
84
|
-
const reset = (0, _react().useCallback)(
|
|
82
|
+
clear();
|
|
83
|
+
}, [clear]);
|
|
84
|
+
const reset = (0, _react().useCallback)(newT => {
|
|
85
85
|
pause();
|
|
86
|
-
const n = Math.max(0, (0, _validate.isNumber)(
|
|
86
|
+
const n = Math.max(0, (0, _validate.isNumber)(newT) ? newT : timeRef.current);
|
|
87
87
|
remainRef.current = n;
|
|
88
88
|
endTimeRef.current = Date.now() + n;
|
|
89
89
|
setCurrent(parseTime(n));
|
|
90
90
|
}, [pause]);
|
|
91
|
-
(0, _react().useEffect)(() => () =>
|
|
91
|
+
(0, _react().useEffect)(() => () => clear(), [clear]);
|
|
92
92
|
return {
|
|
93
93
|
start,
|
|
94
94
|
pause,
|
|
@@ -16,22 +16,24 @@ const measureInWindow = (node, cb) => {
|
|
|
16
16
|
cb(null);
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
+
;
|
|
19
20
|
try {
|
|
20
21
|
const mn = node;
|
|
21
22
|
if ((0, _validate.isFunction)(mn.measureInWindow)) {
|
|
22
23
|
mn.measureInWindow((x, y, w, h) => cb(toRect(x, y, w, h)));
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
26
|
+
;
|
|
25
27
|
const dn = node;
|
|
26
28
|
if ((0, _validate.isFunction)(dn.getBoundingClientRect)) {
|
|
27
29
|
const r = dn.getBoundingClientRect();
|
|
28
30
|
cb(toRect(r?.left, r?.top, r?.width, r?.height));
|
|
29
31
|
return;
|
|
30
32
|
}
|
|
33
|
+
;
|
|
34
|
+
cb(null);
|
|
31
35
|
} catch {
|
|
32
36
|
cb(null);
|
|
33
|
-
return;
|
|
34
37
|
}
|
|
35
|
-
cb(null);
|
|
36
38
|
};
|
|
37
39
|
exports.measureInWindow = measureInWindow;
|
package/dist/cjs/utils/color.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.withAlpha = exports.hexToRgb =
|
|
6
|
+
exports.withAlpha = exports.hexToRgb = void 0;
|
|
7
7
|
var _number = require("./number");
|
|
8
8
|
const HEX_RE = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
9
9
|
const hexToRgb = input => {
|
|
@@ -30,9 +30,4 @@ const withAlpha = (color, alpha) => {
|
|
|
30
30
|
const rgb = parseRgb(t);
|
|
31
31
|
return rgb ? `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, ${a})` : t;
|
|
32
32
|
};
|
|
33
|
-
exports.withAlpha = withAlpha;
|
|
34
|
-
const ensureRgba = (color, alpha) => color.trim().toLowerCase().startsWith('rgba') ? color : withAlpha(color, alpha);
|
|
35
|
-
exports.ensureRgba = ensureRgba;
|
|
36
|
-
const GRADIENT_RE = /(#[0-9a-fA-F]{3,8}|rgba?\([^)]*\)|hsla?\([^)]*\))/i;
|
|
37
|
-
const extractFirstColorToken = input => input ? input.match(GRADIENT_RE)?.[0] : undefined;
|
|
38
|
-
exports.extractFirstColorToken = extractFirstColorToken;
|
|
33
|
+
exports.withAlpha = withAlpha;
|
|
@@ -13,9 +13,9 @@ exports.shallowEqualArray = shallowEqualArray;
|
|
|
13
13
|
const shallowEqualObject = (a, b) => {
|
|
14
14
|
if (a === b) return true;
|
|
15
15
|
if (!a || !b) return false;
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
for (const k of
|
|
16
|
+
const ks = Object.keys(a);
|
|
17
|
+
if (ks.length !== Object.keys(b).length) return false;
|
|
18
|
+
for (const k of ks) if (a[k] !== b[k]) return false;
|
|
19
19
|
return true;
|
|
20
20
|
};
|
|
21
21
|
exports.shallowEqualObject = shallowEqualObject;
|
package/dist/cjs/utils/date.js
CHANGED
|
@@ -23,7 +23,7 @@ const getMonthEndDay = (year, month) => 32 - new Date(year, month - 1, 32).getDa
|
|
|
23
23
|
exports.getMonthEndDay = getMonthEndDay;
|
|
24
24
|
const isValidDate = value => value instanceof Date && !Number.isNaN(value.getTime());
|
|
25
25
|
exports.isValidDate = isValidDate;
|
|
26
|
-
const formatDuration = (
|
|
26
|
+
const formatDuration = (fmt, time) => {
|
|
27
27
|
let {
|
|
28
28
|
days,
|
|
29
29
|
hours,
|
|
@@ -31,7 +31,7 @@ const formatDuration = (format, time) => {
|
|
|
31
31
|
seconds,
|
|
32
32
|
milliseconds
|
|
33
33
|
} = time;
|
|
34
|
-
let t =
|
|
34
|
+
let t = fmt;
|
|
35
35
|
if (t.includes('DD')) t = t.replace('DD', padZero(days));else hours += days * 24;
|
|
36
36
|
if (t.includes('HH')) t = t.replace('HH', padZero(hours));else minutes += hours * 60;
|
|
37
37
|
if (t.includes('mm')) t = t.replace('mm', padZero(minutes));else seconds += minutes * 60;
|
|
@@ -11,15 +11,15 @@ function deepMerge(target, source) {
|
|
|
11
11
|
const out = Array.isArray(target) ? [...target] : {
|
|
12
12
|
...target
|
|
13
13
|
};
|
|
14
|
-
for (const
|
|
15
|
-
const sv = source[
|
|
14
|
+
for (const k of Object.keys(source)) {
|
|
15
|
+
const sv = source[k];
|
|
16
16
|
if (sv === undefined) continue;
|
|
17
|
-
const tv = target[
|
|
17
|
+
const tv = target[k];
|
|
18
18
|
if (isPlainObject(tv) && isPlainObject(sv)) {
|
|
19
|
-
out[
|
|
19
|
+
out[k] = deepMerge(tv, sv);
|
|
20
20
|
continue;
|
|
21
21
|
}
|
|
22
|
-
out[
|
|
22
|
+
out[k] = Array.isArray(sv) ? [...sv] : isPlainObject(sv) ? {
|
|
23
23
|
...sv
|
|
24
24
|
} : sv;
|
|
25
25
|
}
|
package/dist/cjs/utils/render.js
CHANGED
|
@@ -11,17 +11,11 @@ function _react() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
const data = require("react-native");
|
|
16
|
-
_reactNative = function () {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
14
|
+
var _designSystem = require("../design-system");
|
|
21
15
|
var _validate = require("./validate");
|
|
22
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
17
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
24
|
-
const renderTextOrNode = (content, textStyle, textProps) => (0, _validate.isText)(content) ? /*#__PURE__*/_react().default.createElement(
|
|
18
|
+
const renderTextOrNode = (content, textStyle, textProps) => (0, _validate.isText)(content) ? /*#__PURE__*/_react().default.createElement(_designSystem.Text, _extends({
|
|
25
19
|
style: textStyle
|
|
26
20
|
}, textProps), content) : content;
|
|
27
21
|
exports.renderTextOrNode = renderTextOrNode;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isValidNode = exports.isUndefined = exports.isTwoCNChar = exports.isText = exports.isString = exports.isRenderable = exports.isPlainObject = exports.isObject = exports.isNumber = exports.
|
|
6
|
+
exports.isValidNode = exports.isUndefined = exports.isTwoCNChar = exports.isText = exports.isString = exports.isRenderable = exports.isPlainObject = exports.isObject = exports.isNumber = exports.isFunction = exports.isFiniteNumber = exports.isDef = exports.isBoolean = void 0;
|
|
7
7
|
function _react() {
|
|
8
8
|
const data = require("react");
|
|
9
9
|
_react = function () {
|
|
@@ -36,6 +36,4 @@ exports.isValidNode = isValidNode;
|
|
|
36
36
|
const isPlainObject = val => !!val && typeof val === 'object' && !Array.isArray(val) && ! /*#__PURE__*/(0, _react().isValidElement)(val);
|
|
37
37
|
exports.isPlainObject = isPlainObject;
|
|
38
38
|
const isTwoCNChar = value => /^(?:[\u4e00-\u9fa5]){2}$/.test(value);
|
|
39
|
-
exports.isTwoCNChar = isTwoCNChar;
|
|
40
|
-
const isImageUrlString = url => /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i.test(url);
|
|
41
|
-
exports.isImageUrlString = isImageUrlString;
|
|
39
|
+
exports.isTwoCNChar = isTwoCNChar;
|