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
|
@@ -40,13 +40,13 @@ const CellImpl = (props, ref) => {
|
|
|
40
40
|
extra,
|
|
41
41
|
icon,
|
|
42
42
|
rightIcon,
|
|
43
|
-
border:
|
|
43
|
+
border: borderP,
|
|
44
44
|
clickable,
|
|
45
45
|
isLink,
|
|
46
46
|
required,
|
|
47
47
|
center,
|
|
48
|
-
size:
|
|
49
|
-
arrowDirection:
|
|
48
|
+
size: sizeP,
|
|
49
|
+
arrowDirection: arrP,
|
|
50
50
|
tokensOverride,
|
|
51
51
|
children,
|
|
52
52
|
style,
|
|
@@ -61,56 +61,56 @@ const CellImpl = (props, ref) => {
|
|
|
61
61
|
} = props;
|
|
62
62
|
const tokens = (0, _tokens.useCellTokens)(tokensOverride);
|
|
63
63
|
const dir = (0, _useDirection.useDirection)();
|
|
64
|
-
const
|
|
65
|
-
const border =
|
|
66
|
-
const size =
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
show:
|
|
85
|
-
containerStyle:
|
|
64
|
+
const grp = (0, _react().useContext)(_CellContext.CellGroupContext);
|
|
65
|
+
const border = borderP ?? tokens.defaults.border;
|
|
66
|
+
const size = sizeP ?? tokens.defaults.size;
|
|
67
|
+
const arrRaw = arrP ?? tokens.defaults.arrowDirection;
|
|
68
|
+
const arr = dir === 'rtl' ? arrRaw === 'left' ? 'right' : arrRaw === 'right' ? 'left' : arrRaw : arrRaw;
|
|
69
|
+
const lh = tokens.typography.lineHeight;
|
|
70
|
+
const hasT = (0, _utils.isRenderable)(title);
|
|
71
|
+
const hasV = (0, _utils.isRenderable)(value);
|
|
72
|
+
const hasL = (0, _utils.isRenderable)(label);
|
|
73
|
+
const hasE = (0, _utils.isRenderable)(extra);
|
|
74
|
+
const hasCh = (0, _utils.isRenderable)(children);
|
|
75
|
+
const hasI = (0, _utils.isRenderable)(icon);
|
|
76
|
+
const hasRI = (0, _utils.isRenderable)(rightIcon);
|
|
77
|
+
const onlyV = !hasT && !hasCh;
|
|
78
|
+
const showB = border && grp.border && !grp.isLast;
|
|
79
|
+
const showArr = !!isLink || !!clickable;
|
|
80
|
+
const inter = !disabled && (clickable || !!onPress || !!rest.onLongPress || !!rest.onPressIn || !!rest.onPressOut);
|
|
81
|
+
const large = size === 'large';
|
|
82
|
+
const ctrStyle = (0, _react().useMemo)(() => [large ? tokens.layout.containerLarge : tokens.layout.container, center && tokens.layout.center, style], [size, center, tokens.layout, style]);
|
|
83
|
+
const hair = (0, _hooks.useHairline)({
|
|
84
|
+
show: showB,
|
|
85
|
+
containerStyle: ctrStyle,
|
|
86
86
|
color: tokens.colors.border,
|
|
87
87
|
width: tokens.borders.width,
|
|
88
88
|
defaultPaddingHorizontal: tokens.sizing.paddingHorizontal
|
|
89
89
|
});
|
|
90
|
-
const
|
|
90
|
+
const cntStyle = (0, _react().useMemo)(() => [tokens.layout.customContent, {
|
|
91
91
|
justifyContent: center ? 'center' : 'flex-start'
|
|
92
92
|
}, contentStyle], [center, tokens.layout.customContent, contentStyle]);
|
|
93
93
|
const {
|
|
94
94
|
interactionProps,
|
|
95
95
|
states
|
|
96
96
|
} = (0, _hooks.useAriaPress)({
|
|
97
|
-
disabled: !
|
|
97
|
+
disabled: !inter,
|
|
98
98
|
onPress: onPress ?? undefined
|
|
99
99
|
});
|
|
100
|
-
const
|
|
101
|
-
const
|
|
100
|
+
const Comp = inter ? _reactNative().Pressable : _reactNative().View;
|
|
101
|
+
const compProps = inter ? {
|
|
102
102
|
android_ripple: android_ripple ?? {
|
|
103
103
|
color: tokens.colors.ripple
|
|
104
104
|
},
|
|
105
105
|
accessibilityRole: 'button',
|
|
106
106
|
...interactionProps
|
|
107
107
|
} : {};
|
|
108
|
-
return /*#__PURE__*/_react().default.createElement(
|
|
108
|
+
return /*#__PURE__*/_react().default.createElement(Comp, _extends({
|
|
109
109
|
ref: ref,
|
|
110
|
-
style: [
|
|
110
|
+
style: [ctrStyle, inter && states.pressed && {
|
|
111
111
|
opacity: tokens.defaults.activeOpacity
|
|
112
112
|
}]
|
|
113
|
-
},
|
|
113
|
+
}, compProps, rest), hasI && /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
114
114
|
style: [tokens.layout.iconWrapper, {
|
|
115
115
|
marginRight: tokens.spacing.iconGap,
|
|
116
116
|
minHeight: tokens.sizing.iconSize,
|
|
@@ -118,60 +118,63 @@ const CellImpl = (props, ref) => {
|
|
|
118
118
|
}]
|
|
119
119
|
}, icon), /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
120
120
|
style: tokens.layout.body
|
|
121
|
-
}, (
|
|
121
|
+
}, (hasT || required) && /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
122
122
|
style: [tokens.layout.titleRow, {
|
|
123
|
-
minHeight:
|
|
123
|
+
minHeight: lh
|
|
124
124
|
}]
|
|
125
125
|
}, required && /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
|
|
126
126
|
style: {
|
|
127
127
|
color: tokens.colors.required,
|
|
128
128
|
marginRight: tokens.spacing.iconGap / 2
|
|
129
129
|
}
|
|
130
|
-
}, "*"),
|
|
130
|
+
}, "*"), hasT && /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
131
131
|
style: titleStyle
|
|
132
132
|
}, (0, _utils.renderTextOrNode)(title, [{
|
|
133
133
|
color: tokens.colors.title,
|
|
134
|
-
fontSize:
|
|
134
|
+
fontSize: large ? tokens.typography.largeTitleSize : tokens.typography.titleSize,
|
|
135
135
|
fontWeight: tokens.typography.titleWeight
|
|
136
136
|
}, titleStyle], {
|
|
137
137
|
numberOfLines: 1
|
|
138
|
-
}))),
|
|
138
|
+
}))), hasL && /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
139
139
|
style: [{
|
|
140
140
|
marginTop: tokens.spacing.labelMarginTop
|
|
141
141
|
}, labelStyle]
|
|
142
142
|
}, (0, _utils.renderTextOrNode)(label, [{
|
|
143
143
|
color: tokens.colors.label,
|
|
144
|
-
fontSize:
|
|
144
|
+
fontSize: large ? tokens.typography.largeLabelSize : tokens.typography.labelSize
|
|
145
145
|
}, labelStyle], {
|
|
146
146
|
numberOfLines: 2
|
|
147
147
|
}))), /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
148
148
|
style: [tokens.layout.valueContainer, {
|
|
149
|
-
minHeight:
|
|
149
|
+
minHeight: lh,
|
|
150
150
|
marginLeft: tokens.spacing.valueGap
|
|
151
|
-
}, !center &&
|
|
152
|
-
},
|
|
153
|
-
style:
|
|
154
|
-
}, (0, _utils.renderTextOrNode)(value, [tokens.layout.value,
|
|
151
|
+
}, !center && onlyV && tokens.layout.valueOnlyContainer, center && tokens.layout.valueCenter]
|
|
152
|
+
}, hasV ? /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
153
|
+
style: cntStyle
|
|
154
|
+
}, (0, _utils.renderTextOrNode)(value, [tokens.layout.value, onlyV && tokens.layout.valueOnly, {
|
|
155
155
|
color: tokens.colors.value,
|
|
156
|
-
fontSize:
|
|
156
|
+
fontSize: large ? tokens.typography.largeValueSize : tokens.typography.valueSize
|
|
157
157
|
}, valueStyle], {
|
|
158
158
|
numberOfLines: 1
|
|
159
|
-
})) :
|
|
160
|
-
style:
|
|
161
|
-
}, children)
|
|
159
|
+
})) : hasCh && /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
160
|
+
style: cntStyle
|
|
161
|
+
}, (0, _utils.isText)(children) ? (0, _utils.renderTextOrNode)(children, [tokens.layout.value, {
|
|
162
|
+
color: tokens.colors.value,
|
|
163
|
+
fontSize: large ? tokens.typography.largeValueSize : tokens.typography.valueSize
|
|
164
|
+
}, valueStyle]) : children)), hasE && /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
162
165
|
style: {
|
|
163
166
|
marginLeft: tokens.spacing.extraGap
|
|
164
167
|
}
|
|
165
168
|
}, (0, _utils.renderTextOrNode)(extra, {
|
|
166
169
|
marginLeft: tokens.spacing.extraGap,
|
|
167
170
|
color: tokens.colors.value,
|
|
168
|
-
fontSize:
|
|
169
|
-
})),
|
|
170
|
-
style: [tokens.layout.rightIconWrapper, tokens.layout.arrowTransforms[
|
|
171
|
+
fontSize: large ? tokens.typography.largeValueSize : tokens.typography.valueSize
|
|
172
|
+
})), hasRI ? rightIcon : showArr && /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
173
|
+
style: [tokens.layout.rightIconWrapper, tokens.layout.arrowTransforms[arr]]
|
|
171
174
|
}, /*#__PURE__*/_react().default.createElement(_reactNativeSystemIcon().Arrow, {
|
|
172
175
|
size: tokens.sizing.arrowSize,
|
|
173
176
|
fill: tokens.colors.arrow
|
|
174
|
-
})),
|
|
177
|
+
})), hair);
|
|
175
178
|
};
|
|
176
179
|
const CellForwardRef = /*#__PURE__*/_react().default.forwardRef(CellImpl);
|
|
177
180
|
CellForwardRef.displayName = 'Cell';
|
|
@@ -39,30 +39,31 @@ const CellGroup = exports.CellGroup = /*#__PURE__*/_react().default.memo(({
|
|
|
39
39
|
tokensOverride
|
|
40
40
|
}) => {
|
|
41
41
|
const tokens = (0, _tokens.useCellTokens)(tokensOverride);
|
|
42
|
-
const
|
|
42
|
+
const rBorder = border ?? tokens.defaults.groupBorder;
|
|
43
43
|
const showInset = (inset ?? tokens.defaults.groupInset) || (card ?? tokens.defaults.groupCard);
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
for (let i =
|
|
49
|
-
if (isCellElement(
|
|
44
|
+
const rCard = card ?? tokens.defaults.groupCard;
|
|
45
|
+
const showOuter = rBorder && !showInset;
|
|
46
|
+
const chArr = (0, _react().useMemo)(() => _react().default.Children.toArray(children), [children]);
|
|
47
|
+
const lastIdx = (0, _react().useMemo)(() => {
|
|
48
|
+
for (let i = chArr.length - 1; i >= 0; i--) {
|
|
49
|
+
if (isCellElement(chArr[i])) return i;
|
|
50
50
|
}
|
|
51
|
+
;
|
|
51
52
|
return -1;
|
|
52
|
-
}, [
|
|
53
|
-
const
|
|
54
|
-
marginBottom:
|
|
55
|
-
}, style], [
|
|
56
|
-
const
|
|
53
|
+
}, [chArr]);
|
|
54
|
+
const ctrStyle = (0, _react().useMemo)(() => [{
|
|
55
|
+
marginBottom: rCard ? 0 : tokens.sizing.groupMarginBottom
|
|
56
|
+
}, style], [rCard, style, tokens.sizing.groupMarginBottom]);
|
|
57
|
+
const insStyle = (0, _react().useMemo)(() => ({
|
|
57
58
|
overflow: 'hidden',
|
|
58
59
|
borderRadius: tokens.radii.groupInset,
|
|
59
60
|
marginHorizontal: tokens.sizing.groupInsetMarginHorizontal,
|
|
60
61
|
backgroundColor: tokens.colors.background
|
|
61
62
|
}), [tokens.colors.background, tokens.radii.groupInset, tokens.sizing.groupInsetMarginHorizontal]);
|
|
62
|
-
const
|
|
63
|
+
const bodyStyleArr = [{
|
|
63
64
|
backgroundColor: tokens.colors.groupBodyBackground
|
|
64
|
-
}, showInset ?
|
|
65
|
-
const
|
|
65
|
+
}, showInset ? insStyle : null, rCard ? tokens.layout.groupCardShadow : null, bodyStyle];
|
|
66
|
+
const rTitle = (0, _react().useMemo)(() => title ? /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
|
|
66
67
|
style: {
|
|
67
68
|
color: tokens.colors.groupTitle,
|
|
68
69
|
fontSize: tokens.typography.groupTitleSize,
|
|
@@ -70,22 +71,22 @@ const CellGroup = exports.CellGroup = /*#__PURE__*/_react().default.memo(({
|
|
|
70
71
|
paddingVertical: tokens.sizing.groupTitlePaddingVertical
|
|
71
72
|
}
|
|
72
73
|
}, title) : null, [title, tokens.colors.groupTitle, tokens.sizing.groupTitlePaddingHorizontal, tokens.sizing.groupTitlePaddingVertical, tokens.typography.groupTitleSize]);
|
|
73
|
-
const
|
|
74
|
-
const key = /*#__PURE__*/_react().default.isValidElement(
|
|
74
|
+
const rCh = (0, _react().useMemo)(() => chArr.map((ch, i) => {
|
|
75
|
+
const key = /*#__PURE__*/_react().default.isValidElement(ch) && ch.key != null ? ch.key : i;
|
|
75
76
|
return /*#__PURE__*/_react().default.createElement(_CellContext.CellGroupContext.Provider, {
|
|
76
77
|
key: key,
|
|
77
78
|
value: {
|
|
78
|
-
border:
|
|
79
|
+
border: rBorder,
|
|
79
80
|
inset: showInset,
|
|
80
|
-
isLast: isCellElement(
|
|
81
|
+
isLast: isCellElement(ch) ? i === lastIdx : false
|
|
81
82
|
}
|
|
82
|
-
},
|
|
83
|
-
}), [
|
|
83
|
+
}, ch);
|
|
84
|
+
}), [chArr, lastIdx, rBorder, showInset]);
|
|
84
85
|
return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
85
|
-
style:
|
|
86
|
-
},
|
|
87
|
-
style:
|
|
88
|
-
},
|
|
86
|
+
style: ctrStyle
|
|
87
|
+
}, rTitle, /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
88
|
+
style: bodyStyleArr
|
|
89
|
+
}, rCh, showOuter ? /*#__PURE__*/_react().default.createElement(_react().default.Fragment, null, ['top', 'bottom'].map(pos => /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
89
90
|
key: pos,
|
|
90
91
|
style: (0, _utils.createHairlineView)({
|
|
91
92
|
position: pos,
|
|
@@ -101,6 +101,7 @@ const CheckboxImpl = (p, ref) => {
|
|
|
101
101
|
g.registerValue(sv, rv, rd);
|
|
102
102
|
return () => g.unregisterValue(sv);
|
|
103
103
|
}
|
|
104
|
+
;
|
|
104
105
|
return undefined;
|
|
105
106
|
}, [bg, g, sv, rv, rd]);
|
|
106
107
|
const ral = accessibilityLabel ?? al ?? ((0, _validate.isText)(children) ? String(children) : undefined) ?? sv ?? 'checkbox';
|
|
@@ -79,15 +79,15 @@ const CheckboxGroup = exports.CheckboxGroup = /*#__PURE__*/_react().default.forw
|
|
|
79
79
|
'aria-label': accessibilityLabel,
|
|
80
80
|
'aria-describedby': accessibilityHint
|
|
81
81
|
}, state);
|
|
82
|
-
const
|
|
82
|
+
const gpr = groupProps ?? {};
|
|
83
83
|
const {
|
|
84
84
|
[' aria-disabled']: __ariaDisabledTypo,
|
|
85
|
-
...
|
|
86
|
-
} =
|
|
87
|
-
const
|
|
88
|
-
...
|
|
85
|
+
...restGP
|
|
86
|
+
} = gpr;
|
|
87
|
+
const rGroupProps = (0, _react().useMemo)(() => ({
|
|
88
|
+
...restGP,
|
|
89
89
|
'aria-disabled': disabled
|
|
90
|
-
}), [disabled,
|
|
90
|
+
}), [disabled, restGP]);
|
|
91
91
|
const registerValue = (0, _react().useCallback)((key, raw, itemDisabled) => {
|
|
92
92
|
registryRef.current.set(key, {
|
|
93
93
|
value: raw,
|
|
@@ -97,31 +97,32 @@ const CheckboxGroup = exports.CheckboxGroup = /*#__PURE__*/_react().default.forw
|
|
|
97
97
|
const unregisterValue = (0, _react().useCallback)(key => {
|
|
98
98
|
registryRef.current.delete(key);
|
|
99
99
|
}, []);
|
|
100
|
-
const
|
|
100
|
+
const chArr = (0, _react().useMemo)(() => _react().default.Children.toArray(children).filter(ch => ch != null && !(0, _utils.isBoolean)(ch)), [children]);
|
|
101
101
|
const toggleAll = (0, _react().useCallback)((options = {}) => {
|
|
102
102
|
const opts = (0, _utils.isBoolean)(options) ? {
|
|
103
103
|
checked: options
|
|
104
104
|
} : options;
|
|
105
105
|
const {
|
|
106
|
-
checked:
|
|
106
|
+
checked: tgt,
|
|
107
107
|
skipDisabled
|
|
108
108
|
} = opts;
|
|
109
|
-
const
|
|
109
|
+
const cur = new Set(state.value ?? []);
|
|
110
110
|
const nextKeys = [];
|
|
111
111
|
registryRef.current.forEach((meta, key) => {
|
|
112
|
-
const
|
|
113
|
-
if (skipDisabled &&
|
|
114
|
-
if (
|
|
112
|
+
const isDis = !!meta.disabled || disabled;
|
|
113
|
+
if (skipDisabled && isDis) {
|
|
114
|
+
if (cur.has(key)) nextKeys.push(key);
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
|
-
|
|
117
|
+
;
|
|
118
|
+
if (tgt === true ? true : tgt === false ? false : !cur.has(key)) nextKeys.push(key);
|
|
118
119
|
});
|
|
119
120
|
state.setValue(nextKeys);
|
|
120
121
|
}, [disabled, state]);
|
|
121
122
|
(0, _react().useImperativeHandle)(ref, () => ({
|
|
122
123
|
toggleAll
|
|
123
124
|
}), [toggleAll]);
|
|
124
|
-
const
|
|
125
|
+
const ctxVal = (0, _react().useMemo)(() => ({
|
|
125
126
|
state,
|
|
126
127
|
direction,
|
|
127
128
|
shape,
|
|
@@ -133,15 +134,15 @@ const CheckboxGroup = exports.CheckboxGroup = /*#__PURE__*/_react().default.forw
|
|
|
133
134
|
registerValue,
|
|
134
135
|
unregisterValue
|
|
135
136
|
}), [checkedColor, direction, iconRender, iconSize, labelDisabled, max, registerValue, shape, state, unregisterValue]);
|
|
136
|
-
const
|
|
137
|
+
const ctrStyle = [direction === 'horizontal' ? tokens.layout.groupHorizontal : tokens.layout.groupVertical, {
|
|
137
138
|
columnGap: direction === 'horizontal' ? gap : undefined,
|
|
138
139
|
rowGap: gap
|
|
139
140
|
}, style];
|
|
140
141
|
return /*#__PURE__*/_react().default.createElement(CheckboxGroupContext.Provider, {
|
|
141
|
-
value:
|
|
142
|
-
}, /*#__PURE__*/_react().default.createElement(_reactNative().View, _extends({},
|
|
142
|
+
value: ctxVal
|
|
143
|
+
}, /*#__PURE__*/_react().default.createElement(_reactNative().View, _extends({}, rGroupProps, viewProps, {
|
|
143
144
|
accessibilityLabel: accessibilityLabel,
|
|
144
145
|
accessibilityHint: accessibilityHint,
|
|
145
|
-
style:
|
|
146
|
-
}),
|
|
146
|
+
style: ctrStyle
|
|
147
|
+
}), chArr));
|
|
147
148
|
});
|
|
@@ -55,16 +55,16 @@ const AnimatedSvgCircle = _reactNative().Animated.createAnimatedComponent(_react
|
|
|
55
55
|
const CircleImpl = props => {
|
|
56
56
|
const {
|
|
57
57
|
tokensOverride,
|
|
58
|
-
rate:
|
|
58
|
+
rate: rateP,
|
|
59
59
|
size,
|
|
60
60
|
strokeWidth,
|
|
61
61
|
color,
|
|
62
62
|
layerColor,
|
|
63
|
-
fill:
|
|
64
|
-
clockwise:
|
|
65
|
-
startPosition:
|
|
66
|
-
lineCap:
|
|
67
|
-
animated:
|
|
63
|
+
fill: fillP,
|
|
64
|
+
clockwise: cwP,
|
|
65
|
+
startPosition: startP,
|
|
66
|
+
lineCap: capP,
|
|
67
|
+
animated: animP,
|
|
68
68
|
animationDuration,
|
|
69
69
|
style,
|
|
70
70
|
textStyle,
|
|
@@ -72,47 +72,47 @@ const CircleImpl = props => {
|
|
|
72
72
|
} = props;
|
|
73
73
|
const tokens = (0, _tokens.useCircleTokens)(tokensOverride);
|
|
74
74
|
const reducedMotion = (0, _animation.useReducedMotion)();
|
|
75
|
-
const fill =
|
|
76
|
-
const clockwise =
|
|
77
|
-
const startPosition =
|
|
78
|
-
const lineCap =
|
|
79
|
-
const animated =
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
const rate = (0, _utils.clamp)((0, _utils.parsePercentage)(
|
|
83
|
-
const
|
|
84
|
-
const
|
|
75
|
+
const fill = fillP ?? tokens.defaults.fill;
|
|
76
|
+
const clockwise = cwP ?? tokens.defaults.clockwise;
|
|
77
|
+
const startPosition = startP ?? tokens.defaults.startPosition;
|
|
78
|
+
const lineCap = capP ?? tokens.defaults.lineCap;
|
|
79
|
+
const animated = animP ?? tokens.defaults.animated;
|
|
80
|
+
const rSize = Math.max(0, (0, _utils.parseNumber)(size, tokens.defaults.size));
|
|
81
|
+
const rStroke = Math.max(0, (0, _utils.parseNumber)(strokeWidth, tokens.defaults.strokeWidth));
|
|
82
|
+
const rate = (0, _utils.clamp)((0, _utils.parsePercentage)(rateP ?? tokens.defaults.rate), 0, 100);
|
|
83
|
+
const rColor = color ?? tokens.colors.color;
|
|
84
|
+
const rLayerColor = layerColor ?? tokens.colors.layerColor;
|
|
85
85
|
const baseStyle = (0, _react().useMemo)(() => [tokens.layout.root, {
|
|
86
|
-
width:
|
|
87
|
-
height:
|
|
88
|
-
}, style], [
|
|
86
|
+
width: rSize,
|
|
87
|
+
height: rSize
|
|
88
|
+
}, style], [rSize, style, tokens.layout.root]);
|
|
89
89
|
const contentStyle = (0, _react().useMemo)(() => [tokens.layout.content, {
|
|
90
|
-
width:
|
|
91
|
-
height:
|
|
92
|
-
}], [
|
|
90
|
+
width: rSize,
|
|
91
|
+
height: rSize
|
|
92
|
+
}], [rSize, tokens.layout.content]);
|
|
93
93
|
const content = (0, _react().useMemo)(() => {
|
|
94
94
|
if (children == null || children === false) return null;
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
95
|
+
const arr = _react().default.Children.toArray(children);
|
|
96
|
+
if (arr.every(_utils.isText)) return /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
|
|
97
97
|
style: [tokens.layout.text, {
|
|
98
98
|
color: tokens.colors.text,
|
|
99
99
|
fontSize: tokens.typography.fontSize,
|
|
100
100
|
lineHeight: tokens.typography.lineHeight
|
|
101
101
|
}, textStyle]
|
|
102
|
-
},
|
|
102
|
+
}, arr.map(String).join(''));
|
|
103
103
|
return children;
|
|
104
104
|
}, [children, textStyle, tokens.colors.text, tokens.layout.text, tokens.typography.fontSize, tokens.typography.lineHeight]);
|
|
105
105
|
if (_reactNative().Platform.OS === 'web') {
|
|
106
|
-
const safeStroke = Math.min(
|
|
107
|
-
const innerSize = Math.max(0,
|
|
106
|
+
const safeStroke = Math.min(rStroke, rSize / 2);
|
|
107
|
+
const innerSize = Math.max(0, rSize - safeStroke * 2);
|
|
108
108
|
const progressAngle = rate / 100 * 360;
|
|
109
109
|
const rotation = WEB_ROTATION[startPosition];
|
|
110
|
-
const
|
|
111
|
-
const gradient = clockwise ? `conic-gradient(from ${rotation}deg, ${
|
|
110
|
+
const showInner = innerSize > 0 && !isTransparentColor(fill);
|
|
111
|
+
const gradient = clockwise ? `conic-gradient(from ${rotation}deg, ${rColor} 0deg ${progressAngle}deg, ${rLayerColor} ${progressAngle}deg 360deg)` : `conic-gradient(from ${rotation}deg, ${rLayerColor} 0deg ${360 - progressAngle}deg, ${rColor} ${360 - progressAngle}deg 360deg)`;
|
|
112
112
|
const webRingStyle = {
|
|
113
|
-
width:
|
|
114
|
-
height:
|
|
115
|
-
borderRadius:
|
|
113
|
+
width: rSize,
|
|
114
|
+
height: rSize,
|
|
115
|
+
borderRadius: rSize / 2,
|
|
116
116
|
backgroundImage: gradient
|
|
117
117
|
};
|
|
118
118
|
if (safeStroke > 0) {
|
|
@@ -126,11 +126,12 @@ const CircleImpl = props => {
|
|
|
126
126
|
maskSize: '100% 100%'
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
+
;
|
|
129
130
|
return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
130
131
|
style: baseStyle
|
|
131
132
|
}, /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
132
133
|
style: [tokens.layout.webRing, webRingStyle]
|
|
133
|
-
}),
|
|
134
|
+
}), showInner ? /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
134
135
|
style: [tokens.layout.webInner, {
|
|
135
136
|
width: innerSize,
|
|
136
137
|
height: innerSize,
|
|
@@ -142,47 +143,53 @@ const CircleImpl = props => {
|
|
|
142
143
|
}) : null, /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
143
144
|
pointerEvents: "box-none",
|
|
144
145
|
style: contentStyle
|
|
145
|
-
}, content))
|
|
146
|
+
}, (0, _utils.isText)(content) ? /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
|
|
147
|
+
style: [tokens.layout.text, {
|
|
148
|
+
color: tokens.colors.text,
|
|
149
|
+
fontSize: tokens.typography.fontSize
|
|
150
|
+
}, textStyle]
|
|
151
|
+
}, content) : content));
|
|
146
152
|
}
|
|
147
|
-
const radius = Math.max(0, (
|
|
153
|
+
const radius = Math.max(0, (rSize - rStroke) / 2);
|
|
148
154
|
const circumference = 2 * Math.PI * radius;
|
|
149
155
|
const rotation = SVG_ROTATION[startPosition];
|
|
150
|
-
const
|
|
151
|
-
const
|
|
152
|
-
const dashOffset = (0, _react().useRef)(new (_reactNative().Animated.Value)(
|
|
156
|
+
const safeDur = Math.max(0, animationDuration ?? tokens.defaults.animationDuration);
|
|
157
|
+
const dashTarget = (clockwise ? 1 : -1) * circumference * (1 - rate / 100);
|
|
158
|
+
const dashOffset = (0, _react().useRef)(new (_reactNative().Animated.Value)(dashTarget)).current;
|
|
153
159
|
(0, _react().useEffect)(() => {
|
|
154
|
-
if (!animated ||
|
|
155
|
-
dashOffset.setValue(
|
|
160
|
+
if (!animated || safeDur <= 0 || reducedMotion) {
|
|
161
|
+
dashOffset.setValue(dashTarget);
|
|
156
162
|
return;
|
|
157
163
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
164
|
+
;
|
|
165
|
+
const anim = _reactNative().Animated.timing(dashOffset, {
|
|
166
|
+
toValue: dashTarget,
|
|
167
|
+
duration: safeDur,
|
|
161
168
|
useNativeDriver: false,
|
|
162
169
|
isInteraction: false
|
|
163
170
|
});
|
|
164
|
-
|
|
165
|
-
return () =>
|
|
166
|
-
}, [animated, dashOffset,
|
|
167
|
-
const center =
|
|
171
|
+
anim.start();
|
|
172
|
+
return () => anim.stop();
|
|
173
|
+
}, [animated, dashOffset, dashTarget, reducedMotion, safeDur]);
|
|
174
|
+
const center = rSize / 2;
|
|
168
175
|
return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
169
176
|
style: baseStyle
|
|
170
177
|
}, /*#__PURE__*/_react().default.createElement(_reactNativeSvg().default, {
|
|
171
|
-
width:
|
|
172
|
-
height:
|
|
178
|
+
width: rSize,
|
|
179
|
+
height: rSize
|
|
173
180
|
}, /*#__PURE__*/_react().default.createElement(_reactNativeSvg().Circle, {
|
|
174
181
|
cx: center,
|
|
175
182
|
cy: center,
|
|
176
183
|
r: radius,
|
|
177
|
-
stroke:
|
|
178
|
-
strokeWidth:
|
|
184
|
+
stroke: rLayerColor,
|
|
185
|
+
strokeWidth: rStroke,
|
|
179
186
|
fill: fill
|
|
180
187
|
}), /*#__PURE__*/_react().default.createElement(AnimatedSvgCircle, {
|
|
181
188
|
cx: center,
|
|
182
189
|
cy: center,
|
|
183
190
|
r: radius,
|
|
184
|
-
stroke:
|
|
185
|
-
strokeWidth:
|
|
191
|
+
stroke: rColor,
|
|
192
|
+
strokeWidth: rStroke,
|
|
186
193
|
fill: "transparent",
|
|
187
194
|
strokeDasharray: `${circumference} ${circumference}`,
|
|
188
195
|
strokeDashoffset: dashOffset,
|
|
@@ -193,7 +200,12 @@ const CircleImpl = props => {
|
|
|
193
200
|
})), /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
194
201
|
pointerEvents: "box-none",
|
|
195
202
|
style: contentStyle
|
|
196
|
-
}, content))
|
|
203
|
+
}, (0, _utils.isText)(content) ? /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
|
|
204
|
+
style: [tokens.layout.text, {
|
|
205
|
+
color: tokens.colors.text,
|
|
206
|
+
fontSize: tokens.typography.fontSize
|
|
207
|
+
}, textStyle]
|
|
208
|
+
}, content) : content));
|
|
197
209
|
};
|
|
198
210
|
const Circle = exports.Circle = /*#__PURE__*/_react().default.memo(CircleImpl);
|
|
199
211
|
Circle.displayName = 'Circle';
|
|
@@ -43,41 +43,40 @@ const CollapseImpl = props => {
|
|
|
43
43
|
const {
|
|
44
44
|
tokensOverride,
|
|
45
45
|
children,
|
|
46
|
-
accordion:
|
|
46
|
+
accordion: accP,
|
|
47
47
|
value,
|
|
48
48
|
defaultValue,
|
|
49
49
|
onChange,
|
|
50
|
-
border:
|
|
51
|
-
iconPosition:
|
|
50
|
+
border: borderP,
|
|
51
|
+
iconPosition: iconPosP,
|
|
52
52
|
expandIcon,
|
|
53
53
|
disabled,
|
|
54
54
|
style,
|
|
55
55
|
...rest
|
|
56
56
|
} = props;
|
|
57
57
|
const tokens = (0, _tokens.useCollapseTokens)(tokensOverride);
|
|
58
|
-
const accordion =
|
|
59
|
-
const border =
|
|
60
|
-
const iconPosition =
|
|
58
|
+
const accordion = accP ?? tokens.defaults.accordion;
|
|
59
|
+
const border = borderP ?? tokens.defaults.border;
|
|
60
|
+
const iconPosition = iconPosP ?? tokens.defaults.iconPosition;
|
|
61
61
|
const {
|
|
62
62
|
colors
|
|
63
63
|
} = tokens;
|
|
64
64
|
const controlled = value !== undefined;
|
|
65
|
-
const
|
|
66
|
-
const
|
|
65
|
+
const normVal = normalizeValue(value);
|
|
66
|
+
const normDef = normalizeValue(defaultValue) ?? [];
|
|
67
67
|
const onChangeRef = (0, _react().useRef)(onChange);
|
|
68
68
|
onChangeRef.current = onChange;
|
|
69
|
-
const [internalValue, setInternalValue] = (0, _react().useState)(() => accordion ?
|
|
70
|
-
const activeKeys = controlled ? accordion ? (
|
|
69
|
+
const [internalValue, setInternalValue] = (0, _react().useState)(() => accordion ? normDef.slice(0, 1) : normDef);
|
|
70
|
+
const activeKeys = controlled ? accordion ? (normVal ?? []).slice(0, 1) : normVal ?? [] : internalValue;
|
|
71
71
|
const toggle = (0, _react().useCallback)((name, expand) => {
|
|
72
72
|
if (disabled) return;
|
|
73
73
|
const existing = activeKeys.includes(name);
|
|
74
74
|
const shouldExpand = expand ?? !existing;
|
|
75
|
-
|
|
76
|
-
if (accordion) nextKeys = shouldExpand ? [name] : existing ? [] : activeKeys;else nextKeys = shouldExpand ? existing ? activeKeys : [...activeKeys, name] : existing ? activeKeys.filter(key => key !== name) : activeKeys;
|
|
75
|
+
const nextKeys = accordion ? shouldExpand ? [name] : existing ? [] : activeKeys : shouldExpand ? existing ? activeKeys : [...activeKeys, name] : existing ? activeKeys.filter(k => k !== name) : activeKeys;
|
|
77
76
|
if (!controlled) setInternalValue(nextKeys);
|
|
78
77
|
onChangeRef.current?.(buildOutputValue(nextKeys, accordion));
|
|
79
78
|
}, [accordion, activeKeys, controlled, disabled]);
|
|
80
|
-
const
|
|
79
|
+
const ctxVal = (0, _react().useMemo)(() => ({
|
|
81
80
|
activeKeys,
|
|
82
81
|
toggle,
|
|
83
82
|
accordion,
|
|
@@ -89,18 +88,18 @@ const CollapseImpl = props => {
|
|
|
89
88
|
}), [accordion, activeKeys, border, disabled, expandIcon, iconPosition, tokens, toggle]);
|
|
90
89
|
const renderedChildren = (0, _react().useMemo)(() => {
|
|
91
90
|
const items = _react().default.Children.toArray(children);
|
|
92
|
-
return items.map((child,
|
|
91
|
+
return items.map((child, i) => {
|
|
93
92
|
if (! /*#__PURE__*/_react().default.isValidElement(child)) return child;
|
|
94
93
|
if (!(0, _utils.isFunction)(child.type) && !(0, _utils.isObject)(child.type)) return child;
|
|
95
|
-
const name = child.props.name ?? String(
|
|
94
|
+
const name = child.props.name ?? String(i);
|
|
96
95
|
return /*#__PURE__*/_react().default.cloneElement(child, {
|
|
97
96
|
name,
|
|
98
|
-
index
|
|
97
|
+
index: i
|
|
99
98
|
});
|
|
100
99
|
});
|
|
101
100
|
}, [children]);
|
|
102
101
|
return /*#__PURE__*/_react().default.createElement(CollapseContext.Provider, {
|
|
103
|
-
value:
|
|
102
|
+
value: ctxVal
|
|
104
103
|
}, /*#__PURE__*/_react().default.createElement(_reactNative().View, _extends({
|
|
105
104
|
style: [tokens.layout.container, border && {
|
|
106
105
|
backgroundColor: colors.background
|
|
@@ -237,9 +236,10 @@ const CollapsePanel = /*#__PURE__*/_react().default.forwardRef((props, ref) => {
|
|
|
237
236
|
}, [colors.arrow, colors.disabled, expandIcon, isActive, mergedDisabled, rotation]);
|
|
238
237
|
const contentNode = (0, _react().useMemo)(() => (0, _utils.renderTextOrNode)(children, {
|
|
239
238
|
color: mergedDisabled ? colors.disabled : colors.description,
|
|
239
|
+
fontFamily: typography.fontFamily,
|
|
240
240
|
fontSize: typography.descriptionSize,
|
|
241
241
|
lineHeight: Math.round(typography.descriptionSize * 1.5)
|
|
242
|
-
}), [children, colors.description, colors.disabled, mergedDisabled, typography.descriptionSize]);
|
|
242
|
+
}), [children, colors.description, colors.disabled, mergedDisabled, typography.descriptionSize, typography.fontFamily]);
|
|
243
243
|
const showInnerBorder = Boolean(panelBorder);
|
|
244
244
|
const showTopBorder = index > 0 && showInnerBorder;
|
|
245
245
|
const showHeaderBottomBorder = isActive && showInnerBorder;
|