@telus-uds/components-base 3.7.1 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -2
- package/lib/cjs/ActivityIndicator/FullScreenIndicator.js +89 -0
- package/lib/cjs/ActivityIndicator/InlineIndicator.js +64 -0
- package/lib/cjs/ActivityIndicator/OverlayIndicator.js +156 -0
- package/lib/cjs/ActivityIndicator/RenderActivityIndicator.js +88 -0
- package/lib/cjs/ActivityIndicator/index.js +91 -23
- package/lib/cjs/ActivityIndicator/shared.js +12 -1
- package/lib/cjs/ActivityIndicator/sharedProptypes.js +67 -0
- package/lib/cjs/Card/Card.js +38 -45
- package/lib/cjs/ExpandCollapseMini/ExpandCollapseMiniControl.js +1 -1
- package/lib/cjs/List/ListItemMark.js +13 -2
- package/lib/cjs/MultiSelectFilter/ModalOverlay.js +19 -5
- package/lib/cjs/MultiSelectFilter/MultiSelectFilter.js +22 -9
- package/lib/cjs/ToggleSwitch/ToggleSwitch.js +13 -2
- package/lib/cjs/Validator/Validator.js +135 -64
- package/lib/cjs/utils/index.js +9 -1
- package/lib/cjs/utils/useDetectOutsideClick.js +39 -0
- package/lib/cjs/utils/useVariants.js +46 -0
- package/lib/esm/ActivityIndicator/FullScreenIndicator.js +82 -0
- package/lib/esm/ActivityIndicator/InlineIndicator.js +57 -0
- package/lib/esm/ActivityIndicator/OverlayIndicator.js +149 -0
- package/lib/esm/ActivityIndicator/RenderActivityIndicator.js +83 -0
- package/lib/esm/ActivityIndicator/index.js +89 -23
- package/lib/esm/ActivityIndicator/shared.js +11 -0
- package/lib/esm/ActivityIndicator/sharedProptypes.js +61 -0
- package/lib/esm/Card/Card.js +38 -45
- package/lib/esm/ExpandCollapseMini/ExpandCollapseMiniControl.js +1 -1
- package/lib/esm/List/ListItemMark.js +13 -2
- package/lib/esm/MultiSelectFilter/ModalOverlay.js +19 -5
- package/lib/esm/MultiSelectFilter/MultiSelectFilter.js +22 -9
- package/lib/esm/ToggleSwitch/ToggleSwitch.js +13 -2
- package/lib/esm/Validator/Validator.js +135 -64
- package/lib/esm/utils/index.js +2 -1
- package/lib/esm/utils/useDetectOutsideClick.js +31 -0
- package/lib/esm/utils/useVariants.js +41 -0
- package/lib/package.json +2 -2
- package/package.json +2 -2
- package/src/ActivityIndicator/FullScreenIndicator.jsx +65 -0
- package/src/ActivityIndicator/InlineIndicator.jsx +47 -0
- package/src/ActivityIndicator/OverlayIndicator.jsx +140 -0
- package/src/ActivityIndicator/RenderActivityIndicator.jsx +82 -0
- package/src/ActivityIndicator/index.jsx +113 -32
- package/src/ActivityIndicator/shared.js +11 -0
- package/src/ActivityIndicator/sharedProptypes.js +62 -0
- package/src/Card/Card.jsx +51 -54
- package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +1 -1
- package/src/List/ListItemMark.jsx +18 -2
- package/src/MultiSelectFilter/ModalOverlay.jsx +18 -5
- package/src/MultiSelectFilter/MultiSelectFilter.jsx +21 -10
- package/src/ToggleSwitch/ToggleSwitch.jsx +17 -2
- package/src/Validator/Validator.jsx +172 -85
- package/src/utils/index.js +1 -0
- package/src/utils/useDetectOutsideClick.js +35 -0
- package/src/utils/useVariants.js +44 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* PropTypes for the 3 variants of the ActivityIndicator:
|
|
5
|
+
* - InlineIndicator
|
|
6
|
+
* - OverlayIndicator
|
|
7
|
+
* - FullScreenIndicator
|
|
8
|
+
*/
|
|
9
|
+
export const activityIndicatorVariantProps = PropTypes.shape({
|
|
10
|
+
/**
|
|
11
|
+
* Indicates the variant style for the ActivityIndicator
|
|
12
|
+
* */
|
|
13
|
+
variant: PropTypes.object,
|
|
14
|
+
/**
|
|
15
|
+
* Size of the dots
|
|
16
|
+
* */
|
|
17
|
+
dotSize: PropTypes.number,
|
|
18
|
+
/**
|
|
19
|
+
* Size of the ActivityIndicator Spinner
|
|
20
|
+
* */
|
|
21
|
+
size: PropTypes.number,
|
|
22
|
+
/**
|
|
23
|
+
* Primary color (Spinner)
|
|
24
|
+
* */
|
|
25
|
+
color: PropTypes.string,
|
|
26
|
+
/**
|
|
27
|
+
* Secondary color (background) of the indicator
|
|
28
|
+
* */
|
|
29
|
+
indicatorBackgroundColor: PropTypes.string,
|
|
30
|
+
/**
|
|
31
|
+
* Thickness of the ActivityIndicator Spinner
|
|
32
|
+
* */
|
|
33
|
+
thickness: PropTypes.number,
|
|
34
|
+
/**
|
|
35
|
+
* Indicates if the ActivityIndicator is static
|
|
36
|
+
* (not animated)
|
|
37
|
+
* */
|
|
38
|
+
isStatic: PropTypes.bool
|
|
39
|
+
}).isRequired;
|
|
40
|
+
export const activityIndicatorCommonProps = {
|
|
41
|
+
/**
|
|
42
|
+
* Props used by RenderActivityIndicator
|
|
43
|
+
* */
|
|
44
|
+
variantProps: activityIndicatorVariantProps,
|
|
45
|
+
/**
|
|
46
|
+
* Shows or hide the label
|
|
47
|
+
* */
|
|
48
|
+
showLabel: PropTypes.bool,
|
|
49
|
+
/**
|
|
50
|
+
* A visually hidden accessible label describing the action taking place
|
|
51
|
+
*/
|
|
52
|
+
label: PropTypes.string,
|
|
53
|
+
/**
|
|
54
|
+
* Position of the label relative to ActivityIndicator
|
|
55
|
+
*/
|
|
56
|
+
labelPosition: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
|
|
57
|
+
/**
|
|
58
|
+
* Map of flex-direction position for label
|
|
59
|
+
* */
|
|
60
|
+
labelMapping: PropTypes.object.isRequired
|
|
61
|
+
};
|
package/lib/esm/Card/Card.js
CHANGED
|
@@ -126,6 +126,7 @@ const Card = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
126
126
|
const selected = interactiveCard?.variant?.selected;
|
|
127
127
|
const inactive = interactiveCard?.variant?.inactive;
|
|
128
128
|
const selectionType = interactiveCard?.selectionType;
|
|
129
|
+
const isControl = interactiveCard?.variant?.isControl === true;
|
|
129
130
|
const getThemeTokens = useThemeTokensCallback('Card', interactiveCard?.tokens, {
|
|
130
131
|
interactive: true,
|
|
131
132
|
...(interactiveCard?.variant || {})
|
|
@@ -193,6 +194,9 @@ const Card = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
193
194
|
cardStyles = themeTokens;
|
|
194
195
|
}
|
|
195
196
|
const renderInputPerSelectionType = props => {
|
|
197
|
+
if (!isControl) {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
196
200
|
switch (selectionType) {
|
|
197
201
|
case SelectionType.Checkbox:
|
|
198
202
|
return /*#__PURE__*/_jsx(View, {
|
|
@@ -220,17 +224,8 @@ const Card = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
220
224
|
return null;
|
|
221
225
|
}
|
|
222
226
|
};
|
|
223
|
-
const renderNoSelectionView = () => /*#__PURE__*/_jsx(View, {
|
|
224
|
-
style: {
|
|
225
|
-
paddingTop,
|
|
226
|
-
paddingBottom,
|
|
227
|
-
paddingLeft,
|
|
228
|
-
paddingRight
|
|
229
|
-
},
|
|
230
|
-
children: children
|
|
231
|
-
});
|
|
232
227
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
233
|
-
children: /*#__PURE__*/
|
|
228
|
+
children: /*#__PURE__*/_jsxs(CardBase, {
|
|
234
229
|
ref: ref,
|
|
235
230
|
tokens: interactiveCard?.body ? restOfTokens : cardStyles,
|
|
236
231
|
backgroundImage: backgroundImage,
|
|
@@ -238,41 +233,39 @@ const Card = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
238
233
|
media: mediaIds
|
|
239
234
|
},
|
|
240
235
|
...selectProps(rest),
|
|
241
|
-
children: interactiveCard?.body
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}), children && selectionType !== SelectionType.None ? renderNoSelectionView() : null]
|
|
275
|
-
}) : children
|
|
236
|
+
children: [interactiveCard?.body && /*#__PURE__*/_jsx(PressableCardBase, {
|
|
237
|
+
ref: ref,
|
|
238
|
+
tokens: getThemeTokens,
|
|
239
|
+
dataSet: dataSet,
|
|
240
|
+
onPress: onPress,
|
|
241
|
+
href: interactiveCard?.href,
|
|
242
|
+
hrefAttrs: interactiveCard?.hrefAttrs,
|
|
243
|
+
...selectProps(rest),
|
|
244
|
+
children: cardState => {
|
|
245
|
+
const {
|
|
246
|
+
iconColor: checkColor,
|
|
247
|
+
inputBackgroundColor: boxBackgroundColor,
|
|
248
|
+
iconBackgroundColor: checkBackgroundColor
|
|
249
|
+
} = getThemeTokens({
|
|
250
|
+
...cardState,
|
|
251
|
+
selected,
|
|
252
|
+
interactive: true,
|
|
253
|
+
isControl
|
|
254
|
+
}, interactiveCard?.tokens);
|
|
255
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
256
|
+
children: [renderInputPerSelectionType(getInputProps({
|
|
257
|
+
id,
|
|
258
|
+
checkColor,
|
|
259
|
+
boxBackgroundColor,
|
|
260
|
+
checkBackgroundColor,
|
|
261
|
+
isControlled: true,
|
|
262
|
+
isChecked: selected || cardState?.hover,
|
|
263
|
+
isInactive: inactive,
|
|
264
|
+
onPress
|
|
265
|
+
})), typeof interactiveCard?.body === 'function' ? interactiveCard.body(cardState) : interactiveCard.body]
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
}), children]
|
|
276
269
|
})
|
|
277
270
|
});
|
|
278
271
|
});
|
|
@@ -38,7 +38,7 @@ const ExpandCollapseMiniControl = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
38
38
|
const isFocusVisible = Platform.OS === 'web' ? focus && !pressed && !hover : expanded;
|
|
39
39
|
const linkTokens = useThemeTokens('Link', {}, {
|
|
40
40
|
...variant,
|
|
41
|
-
quiet
|
|
41
|
+
quiet
|
|
42
42
|
}, {
|
|
43
43
|
focus: isFocusVisible,
|
|
44
44
|
hover,
|
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import View from "react-native-web/dist/exports/View";
|
|
4
4
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
5
5
|
import Icon from '../Icon';
|
|
6
|
+
import { useVariants } from '../utils';
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
8
|
export const tokenTypes = {
|
|
8
9
|
itemIconSize: PropTypes.number.isRequired,
|
|
@@ -53,6 +54,7 @@ const selectBulletContainerStyles = _ref4 => {
|
|
|
53
54
|
alignItems: itemBulletContainerAlign
|
|
54
55
|
};
|
|
55
56
|
};
|
|
57
|
+
const getIconColorVariants = iconVariants => iconVariants?.filter(variant => variant[0] === 'color').map(variant => variant[1]);
|
|
56
58
|
|
|
57
59
|
/**
|
|
58
60
|
* Subcomponent used within ListItem and similar components for rendering bullets or icons
|
|
@@ -71,6 +73,10 @@ const ListItemMark = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
|
|
|
71
73
|
const themeTokens = typeof tokens === 'function' ? tokens() : tokens;
|
|
72
74
|
const sideItemContainerStyles = selectSideItemContainerStyles(themeTokens);
|
|
73
75
|
const bulletContainerStyles = selectBulletContainerStyles(themeTokens);
|
|
76
|
+
|
|
77
|
+
// TODO: Remove it when iconColor custom colors are deprecated.
|
|
78
|
+
const iconVariants = useVariants('Icon');
|
|
79
|
+
const iconColorVariants = getIconColorVariants(iconVariants);
|
|
74
80
|
if (icon) {
|
|
75
81
|
const iconTokens = selectItemIconTokens(themeTokens);
|
|
76
82
|
return /*#__PURE__*/_jsx(View, {
|
|
@@ -78,10 +84,15 @@ const ListItemMark = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
|
|
|
78
84
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
79
85
|
icon: icon,
|
|
80
86
|
tokens: {
|
|
81
|
-
size: iconSize ?? iconTokens.size
|
|
87
|
+
size: iconSize ?? iconTokens.size,
|
|
88
|
+
...((iconColor && !iconColorVariants?.includes(iconColor) || !iconColor) && {
|
|
89
|
+
color: iconColor && !iconColorVariants?.includes(iconColor) ? iconColor : iconTokens.color
|
|
90
|
+
})
|
|
82
91
|
},
|
|
83
92
|
variant: {
|
|
84
|
-
|
|
93
|
+
...(iconColorVariants?.includes(iconColor) && {
|
|
94
|
+
color: iconColor
|
|
95
|
+
})
|
|
85
96
|
}
|
|
86
97
|
})
|
|
87
98
|
});
|
|
@@ -10,6 +10,7 @@ import { useThemeTokens } from '../ThemeProvider';
|
|
|
10
10
|
import dictionary from './dictionary';
|
|
11
11
|
import Card from '../Card';
|
|
12
12
|
import IconButton from '../IconButton';
|
|
13
|
+
import useDetectOutsideClick from '../utils/useDetectOutsideClick';
|
|
13
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
15
|
const staticStyles = StyleSheet.create({
|
|
15
16
|
positioner: {
|
|
@@ -55,6 +56,7 @@ const staticStyles = StyleSheet.create({
|
|
|
55
56
|
});
|
|
56
57
|
const selectContainerStyle = (enableFullscreen, themeTokens) => ({
|
|
57
58
|
borderColor: themeTokens.borderColor,
|
|
59
|
+
backgroundColor: themeTokens.backgroundColor,
|
|
58
60
|
...Platform.select({
|
|
59
61
|
web: {
|
|
60
62
|
position: enableFullscreen ? 'fixed' : 'absolute'
|
|
@@ -89,13 +91,16 @@ const ModalOverlay = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
89
91
|
tokens,
|
|
90
92
|
copy,
|
|
91
93
|
onClose,
|
|
92
|
-
enableFullscreen = false
|
|
94
|
+
enableFullscreen = false,
|
|
95
|
+
dismissWhenPressedOutside = false
|
|
93
96
|
} = _ref2;
|
|
94
97
|
const viewport = useViewport();
|
|
95
98
|
const themeTokens = useThemeTokens('Modal', tokens, variant, {
|
|
96
99
|
viewport,
|
|
97
100
|
maxWidth: false
|
|
98
101
|
});
|
|
102
|
+
const containerRef = React.useRef(ref || null);
|
|
103
|
+
useDetectOutsideClick(containerRef, onClose, dismissWhenPressedOutside);
|
|
99
104
|
const containerWidthHeight = {
|
|
100
105
|
minWidth: tokens.maxWidth ? maxWidthSize : minWidth,
|
|
101
106
|
minHeight: maxHeight ? maxHeightSize : minHeight,
|
|
@@ -103,7 +108,8 @@ const ModalOverlay = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
103
108
|
maxHeight: maxHeightSize
|
|
104
109
|
};
|
|
105
110
|
const {
|
|
106
|
-
closeIcon: CloseIconComponent
|
|
111
|
+
closeIcon: CloseIconComponent,
|
|
112
|
+
backgroundColor
|
|
107
113
|
} = themeTokens;
|
|
108
114
|
const getCopy = useCopy({
|
|
109
115
|
dictionary,
|
|
@@ -112,11 +118,14 @@ const ModalOverlay = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
112
118
|
const closeLabel = getCopy('closeButton');
|
|
113
119
|
return /*#__PURE__*/_jsx(Portal, {
|
|
114
120
|
children: /*#__PURE__*/_jsx(View, {
|
|
115
|
-
ref:
|
|
121
|
+
ref: containerRef,
|
|
116
122
|
onLayout: onLayout,
|
|
117
123
|
style: [overlaidPosition, containerWidthHeight, staticStyles.positioner, !isReady && staticStyles.hidden, selectContainerStyle(enableFullscreen, themeTokens)],
|
|
118
124
|
children: /*#__PURE__*/_jsxs(Card, {
|
|
119
|
-
tokens:
|
|
125
|
+
tokens: {
|
|
126
|
+
...staticStyles.card,
|
|
127
|
+
backgroundColor
|
|
128
|
+
},
|
|
120
129
|
children: [/*#__PURE__*/_jsx(View, {
|
|
121
130
|
style: [staticStyles.closeButtonContainer, selectCloseButtonContainerStyles(themeTokens)],
|
|
122
131
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
@@ -150,6 +159,11 @@ ModalOverlay.propTypes = {
|
|
|
150
159
|
tokens: getTokensPropType('Modal'),
|
|
151
160
|
copy: copyPropTypes,
|
|
152
161
|
onClose: PropTypes.func,
|
|
153
|
-
enableFullscreen: PropTypes.bool
|
|
162
|
+
enableFullscreen: PropTypes.bool,
|
|
163
|
+
/**
|
|
164
|
+
* If true, clicking outside the content will trigger the a close callback, dismissing the content.
|
|
165
|
+
* @deprecated This parameter will be removed in the next major release; detection will be always enabled by default.
|
|
166
|
+
*/
|
|
167
|
+
dismissWhenPressedOutside: PropTypes.bool
|
|
154
168
|
};
|
|
155
169
|
export default ModalOverlay;
|
|
@@ -85,6 +85,7 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
85
85
|
inactive = false,
|
|
86
86
|
rowLimit = 12,
|
|
87
87
|
dictionary = defaultDictionary,
|
|
88
|
+
dismissWhenPressedOutside = false,
|
|
88
89
|
...rest
|
|
89
90
|
} = _ref3;
|
|
90
91
|
const viewport = useViewport();
|
|
@@ -134,6 +135,7 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
134
135
|
buttonBackgroundColor,
|
|
135
136
|
iconColorSelected,
|
|
136
137
|
buttonBackgroundColorSelected,
|
|
138
|
+
containerBorderColor,
|
|
137
139
|
...restTokens
|
|
138
140
|
} = useThemeTokens('MultiSelectFilter', tokens, {
|
|
139
141
|
...variant,
|
|
@@ -279,7 +281,7 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
279
281
|
...headerStyles,
|
|
280
282
|
lineHeight: headerLineHeight
|
|
281
283
|
},
|
|
282
|
-
children: getCopy('filterByLabel').replace(/%\{filterCategory\}/g, label
|
|
284
|
+
children: getCopy('filterByLabel').replace(/%\{filterCategory\}/g, label)
|
|
283
285
|
})
|
|
284
286
|
})
|
|
285
287
|
}), subtitle && /*#__PURE__*/_jsxs(_Fragment, {
|
|
@@ -300,6 +302,7 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
300
302
|
style: styles.options,
|
|
301
303
|
children: /*#__PURE__*/_jsx(ScrollView, {
|
|
302
304
|
onLayout: handleScrollViewLayout,
|
|
305
|
+
style: styles.scrollContainer,
|
|
303
306
|
children: /*#__PURE__*/_jsx(Row, {
|
|
304
307
|
distribute: "between",
|
|
305
308
|
onLayout: handleRowLayout,
|
|
@@ -318,12 +321,11 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
318
321
|
})]
|
|
319
322
|
});
|
|
320
323
|
const controlsContent = /*#__PURE__*/_jsxs(_Fragment, {
|
|
321
|
-
children: [isScrolling
|
|
324
|
+
children: [isScrolling && /*#__PURE__*/_jsx(Divider, {
|
|
322
325
|
tokens: {
|
|
323
326
|
color: dividerColor
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
}) : /*#__PURE__*/_jsx(Spacer, {
|
|
327
|
+
}
|
|
328
|
+
}), /*#__PURE__*/_jsx(Spacer, {
|
|
327
329
|
space: 4
|
|
328
330
|
}), /*#__PURE__*/_jsx(View, {
|
|
329
331
|
style: selectControlsTokens(restTokens),
|
|
@@ -380,7 +382,8 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
380
382
|
minWidth: windowWidth,
|
|
381
383
|
tokens: {
|
|
382
384
|
...tokens,
|
|
383
|
-
maxWidth: true
|
|
385
|
+
maxWidth: true,
|
|
386
|
+
borderColor: containerBorderColor
|
|
384
387
|
},
|
|
385
388
|
copy: copy,
|
|
386
389
|
isReady: isReady,
|
|
@@ -396,8 +399,9 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
396
399
|
})]
|
|
397
400
|
})
|
|
398
401
|
}), isOpen && viewport !== 'xs' && /*#__PURE__*/_jsxs(ModalOverlay, {
|
|
399
|
-
|
|
402
|
+
dismissWhenPressedOutside: dismissWhenPressedOutside,
|
|
400
403
|
onClose: onClose,
|
|
404
|
+
overlaidPosition: overlaidPosition,
|
|
401
405
|
maxHeight: items.length > MAX_ITEMS_THRESHOLD ? true : maxHeight,
|
|
402
406
|
maxHeightSize: maxHeightSize,
|
|
403
407
|
maxWidthSize: maxWidthSize,
|
|
@@ -405,7 +409,8 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
405
409
|
minWidth: minWidth,
|
|
406
410
|
tokens: {
|
|
407
411
|
...tokens,
|
|
408
|
-
maxWidth: items.length > MAX_ITEMS_THRESHOLD ? true : maxWidth
|
|
412
|
+
maxWidth: items.length > MAX_ITEMS_THRESHOLD ? true : maxWidth,
|
|
413
|
+
borderColor: containerBorderColor
|
|
409
414
|
},
|
|
410
415
|
copy: copy,
|
|
411
416
|
isReady: isReady,
|
|
@@ -433,6 +438,9 @@ const styles = StyleSheet.create({
|
|
|
433
438
|
},
|
|
434
439
|
options: {
|
|
435
440
|
flex: 1
|
|
441
|
+
},
|
|
442
|
+
scrollContainer: {
|
|
443
|
+
padding: 1
|
|
436
444
|
}
|
|
437
445
|
});
|
|
438
446
|
|
|
@@ -541,6 +549,11 @@ MultiSelectFilter.propTypes = {
|
|
|
541
549
|
* Sets the maximum number of items in one column. If number of items are more
|
|
542
550
|
* than the `rowLimit`, they will be rendered in 2 columns.
|
|
543
551
|
*/
|
|
544
|
-
rowLimit: PropTypes.number
|
|
552
|
+
rowLimit: PropTypes.number,
|
|
553
|
+
/**
|
|
554
|
+
* If true, clicking outside the content will trigger the a close callback, dismissing the content.
|
|
555
|
+
* @deprecated This parameter will be removed in the next major release; detection will be always enabled by default.
|
|
556
|
+
*/
|
|
557
|
+
dismissWhenPressedOutside: PropTypes.bool
|
|
545
558
|
};
|
|
546
559
|
export default MultiSelectFilter;
|
|
@@ -94,6 +94,17 @@ const selectSwitchStyles = _ref6 => {
|
|
|
94
94
|
})
|
|
95
95
|
};
|
|
96
96
|
};
|
|
97
|
+
const selectMobileTokens = tokens => ({
|
|
98
|
+
...Platform.select({
|
|
99
|
+
web: {},
|
|
100
|
+
default: {
|
|
101
|
+
switchSize: tokens?.mobileSwitchSize,
|
|
102
|
+
trackHeight: tokens?.mobileTrackHeight,
|
|
103
|
+
width: tokens?.mobileWidth,
|
|
104
|
+
trackBorderWidth: tokens?.mobileTrackBorderWidth
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
});
|
|
97
108
|
const selectLabelStyles = _ref7 => {
|
|
98
109
|
let {
|
|
99
110
|
labelMarginLeft
|
|
@@ -146,7 +157,7 @@ const ToggleSwitch = /*#__PURE__*/React.forwardRef((_ref9, ref) => {
|
|
|
146
157
|
onChange
|
|
147
158
|
});
|
|
148
159
|
const handlePress = event => setValue(!currentValue, event);
|
|
149
|
-
const getButtonTokens = buttonState => selectButtonTokens(getTokens(buttonState), getTokens(themeTokens));
|
|
160
|
+
const getButtonTokens = buttonState => selectButtonTokens(getTokens(buttonState, selectMobileTokens(themeTokens)), getTokens(themeTokens, selectMobileTokens(themeTokens)));
|
|
150
161
|
const uniqueId = useUniqueId('toggleSwitch');
|
|
151
162
|
const inputId = id ?? uniqueId;
|
|
152
163
|
return /*#__PURE__*/_jsxs(StackView, {
|
|
@@ -179,7 +190,7 @@ const ToggleSwitch = /*#__PURE__*/React.forwardRef((_ref9, ref) => {
|
|
|
179
190
|
onPress: handlePress,
|
|
180
191
|
...selectProps(rest),
|
|
181
192
|
children: buttonState => {
|
|
182
|
-
const stateTokens = getTokens(buttonState);
|
|
193
|
+
const stateTokens = getTokens(buttonState, selectMobileTokens(themeTokens));
|
|
183
194
|
const IconComponent = stateTokens.icon;
|
|
184
195
|
const switchStyles = selectSwitchStyles(stateTokens);
|
|
185
196
|
const trackStyles = selectTrackStyles(stateTokens);
|