@telus-uds/components-base 1.93.0 → 1.95.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 +32 -3
- package/lib/Autocomplete/Autocomplete.js +2 -1
- package/lib/Button/ButtonGroup.js +17 -1
- package/lib/Card/Card.js +12 -0
- package/lib/Card/CardBase.js +37 -2
- package/lib/Carousel/Carousel.js +55 -13
- package/lib/Carousel/CarouselItem/CarouselItem.js +86 -12
- package/lib/DownloadApp/DownloadApp.js +168 -0
- package/lib/DownloadApp/dictionary.js +17 -0
- package/lib/DownloadApp/index.js +10 -0
- package/lib/Fieldset/FieldsetContainer.js +7 -2
- package/lib/Fieldset/FieldsetContainer.native.js +4 -1
- package/lib/FileUpload/FileUpload.js +336 -0
- package/lib/FileUpload/NotificationContent.js +60 -0
- package/lib/FileUpload/dictionary.js +47 -0
- package/lib/FileUpload/index.js +10 -0
- package/lib/Icon/IconText.js +19 -2
- package/lib/Link/LinkBase.js +2 -2
- package/lib/Link/TextButton.js +7 -17
- package/lib/Modal/Modal.js +1 -1
- package/lib/Modal/ModalContent.js +12 -6
- package/lib/MultiSelectFilter/ModalOverlay.js +49 -30
- package/lib/MultiSelectFilter/MultiSelectFilter.js +170 -131
- package/lib/Notification/Notification.js +11 -2
- package/lib/Status/Status.js +9 -4
- package/lib/TabBar/TabBar.js +133 -0
- package/lib/TabBar/TabBarItem.js +184 -0
- package/lib/TabBar/index.js +10 -0
- package/lib/TextInput/TextInputBase.js +2 -1
- package/lib/Tooltip/getTooltipPosition.js +8 -9
- package/lib/index.js +24 -0
- package/lib/utils/convertFromMegaByteToByte.js +16 -0
- package/lib/utils/formatImageSource.js +34 -0
- package/lib/utils/index.js +17 -1
- package/lib-module/Autocomplete/Autocomplete.js +2 -1
- package/lib-module/Button/ButtonGroup.js +17 -1
- package/lib-module/Card/Card.js +13 -1
- package/lib-module/Card/CardBase.js +38 -3
- package/lib-module/Carousel/Carousel.js +55 -13
- package/lib-module/Carousel/CarouselItem/CarouselItem.js +86 -12
- package/lib-module/DownloadApp/DownloadApp.js +160 -0
- package/lib-module/DownloadApp/dictionary.js +10 -0
- package/lib-module/DownloadApp/index.js +2 -0
- package/lib-module/Fieldset/FieldsetContainer.js +7 -2
- package/lib-module/Fieldset/FieldsetContainer.native.js +4 -1
- package/lib-module/FileUpload/FileUpload.js +329 -0
- package/lib-module/FileUpload/NotificationContent.js +55 -0
- package/lib-module/FileUpload/dictionary.js +40 -0
- package/lib-module/FileUpload/index.js +2 -0
- package/lib-module/Icon/IconText.js +19 -2
- package/lib-module/Link/LinkBase.js +2 -2
- package/lib-module/Link/TextButton.js +7 -17
- package/lib-module/Modal/Modal.js +1 -1
- package/lib-module/Modal/ModalContent.js +12 -6
- package/lib-module/MultiSelectFilter/ModalOverlay.js +49 -30
- package/lib-module/MultiSelectFilter/MultiSelectFilter.js +171 -132
- package/lib-module/Notification/Notification.js +11 -2
- package/lib-module/Status/Status.js +9 -4
- package/lib-module/TabBar/TabBar.js +125 -0
- package/lib-module/TabBar/TabBarItem.js +177 -0
- package/lib-module/TabBar/index.js +2 -0
- package/lib-module/TextInput/TextInputBase.js +2 -1
- package/lib-module/Tooltip/getTooltipPosition.js +8 -9
- package/lib-module/index.js +3 -0
- package/lib-module/utils/convertFromMegaByteToByte.js +10 -0
- package/lib-module/utils/formatImageSource.js +27 -0
- package/lib-module/utils/index.js +3 -1
- package/package.json +4 -3
- package/src/Autocomplete/Autocomplete.jsx +2 -1
- package/src/Button/ButtonGroup.jsx +9 -1
- package/src/Card/Card.jsx +18 -2
- package/src/Card/CardBase.jsx +47 -12
- package/src/Carousel/Carousel.jsx +59 -13
- package/src/Carousel/CarouselItem/CarouselItem.jsx +94 -9
- package/src/DownloadApp/DownloadApp.jsx +165 -0
- package/src/DownloadApp/dictionary.js +10 -0
- package/src/DownloadApp/index.js +3 -0
- package/src/Fieldset/FieldsetContainer.jsx +4 -3
- package/src/Fieldset/FieldsetContainer.native.jsx +9 -6
- package/src/FileUpload/FileUpload.jsx +396 -0
- package/src/FileUpload/NotificationContent.jsx +44 -0
- package/src/FileUpload/dictionary.js +40 -0
- package/src/FileUpload/index.js +3 -0
- package/src/Icon/IconText.jsx +21 -4
- package/src/Link/LinkBase.jsx +2 -2
- package/src/Link/TextButton.jsx +10 -17
- package/src/Modal/Modal.jsx +1 -1
- package/src/Modal/ModalContent.jsx +8 -3
- package/src/MultiSelectFilter/ModalOverlay.jsx +44 -18
- package/src/MultiSelectFilter/MultiSelectFilter.jsx +188 -126
- package/src/Notification/Notification.jsx +12 -4
- package/src/Status/Status.jsx +15 -4
- package/src/TabBar/TabBar.jsx +123 -0
- package/src/TabBar/TabBarItem.jsx +149 -0
- package/src/TabBar/index.js +3 -0
- package/src/TextInput/TextInputBase.jsx +1 -1
- package/src/Tooltip/getTooltipPosition.js +11 -12
- package/src/index.js +3 -0
- package/src/utils/convertFromMegaByteToByte.js +11 -0
- package/src/utils/formatImageSource.js +29 -0
- package/src/utils/index.js +2 -0
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
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
|
+
import Platform from "react-native-web/dist/exports/Platform";
|
|
5
6
|
import { Portal } from '@gorhom/portal';
|
|
6
7
|
import { useCopy, copyPropTypes, getTokensPropType, variantProp } from '../utils';
|
|
7
8
|
import { useViewport } from '../ViewportProvider';
|
|
@@ -15,10 +16,32 @@ const staticStyles = StyleSheet.create({
|
|
|
15
16
|
positioner: {
|
|
16
17
|
flex: 1,
|
|
17
18
|
// Grow to maxWidth when possible, shrink when not possible
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
zIndex: 10000,
|
|
20
|
+
// Position on top of all the other overlays, including backdrops and modals,
|
|
21
|
+
elevation: 10000,
|
|
22
|
+
// Position on top of all the other overlays, including backdrops and modals,
|
|
23
|
+
borderRadius: 4,
|
|
24
|
+
...Platform.select({
|
|
25
|
+
web: {
|
|
26
|
+
boxShadow: 'rgba(0, 0, 0, 0.1) 0px 4px 8px 0px'
|
|
27
|
+
},
|
|
28
|
+
default: {
|
|
29
|
+
shadowColor: 'rgba(0, 0, 0, 0.1)',
|
|
30
|
+
shadowOffset: {
|
|
31
|
+
width: 0,
|
|
32
|
+
height: 4
|
|
33
|
+
},
|
|
34
|
+
shadowOpacity: 1,
|
|
35
|
+
shadowRadius: 8
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
},
|
|
39
|
+
card: {
|
|
40
|
+
paddingLeft: 0,
|
|
41
|
+
paddingRight: 0,
|
|
42
|
+
paddingTop: 0,
|
|
43
|
+
paddingBottom: 0
|
|
20
44
|
},
|
|
21
|
-
|
|
22
45
|
closeButtonContainer: {
|
|
23
46
|
position: 'absolute',
|
|
24
47
|
top: 0,
|
|
@@ -31,6 +54,17 @@ const staticStyles = StyleSheet.create({
|
|
|
31
54
|
opacity: 0
|
|
32
55
|
}
|
|
33
56
|
});
|
|
57
|
+
const selectContainerStyle = (enableFullscreen, themeTokens) => ({
|
|
58
|
+
borderColor: themeTokens.borderColor,
|
|
59
|
+
...Platform.select({
|
|
60
|
+
web: {
|
|
61
|
+
position: enableFullscreen ? 'fixed' : 'absolute'
|
|
62
|
+
},
|
|
63
|
+
default: {
|
|
64
|
+
position: 'absolute'
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
});
|
|
34
68
|
const selectCloseButtonContainerStyles = _ref => {
|
|
35
69
|
let {
|
|
36
70
|
paddingRight,
|
|
@@ -41,20 +75,7 @@ const selectCloseButtonContainerStyles = _ref => {
|
|
|
41
75
|
paddingTop
|
|
42
76
|
};
|
|
43
77
|
};
|
|
44
|
-
const
|
|
45
|
-
let {
|
|
46
|
-
paddingTop,
|
|
47
|
-
paddingLeft,
|
|
48
|
-
paddingRight
|
|
49
|
-
} = _ref2;
|
|
50
|
-
return {
|
|
51
|
-
paddingBottom: 35,
|
|
52
|
-
paddingTop,
|
|
53
|
-
paddingLeft,
|
|
54
|
-
paddingRight
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
const ModalOverlay = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
78
|
+
const ModalOverlay = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
58
79
|
let {
|
|
59
80
|
children,
|
|
60
81
|
isReady = false,
|
|
@@ -68,22 +89,19 @@ const ModalOverlay = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
68
89
|
variant,
|
|
69
90
|
tokens,
|
|
70
91
|
copy,
|
|
71
|
-
onClose
|
|
72
|
-
|
|
92
|
+
onClose,
|
|
93
|
+
enableFullscreen = false
|
|
94
|
+
} = _ref2;
|
|
73
95
|
const viewport = useViewport();
|
|
74
96
|
const themeTokens = useThemeTokens('Modal', tokens, variant, {
|
|
75
97
|
viewport,
|
|
76
98
|
maxWidth: false
|
|
77
99
|
});
|
|
78
100
|
const containerWidthHeight = {
|
|
79
|
-
minWidth,
|
|
80
|
-
minHeight,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}),
|
|
84
|
-
...(maxHeight && maxHeightSize && {
|
|
85
|
-
maxHeight: maxHeightSize
|
|
86
|
-
})
|
|
101
|
+
minWidth: tokens.maxWidth ? maxWidthSize : minWidth,
|
|
102
|
+
minHeight: maxHeight ? maxHeightSize : minHeight,
|
|
103
|
+
maxWidth: maxWidthSize,
|
|
104
|
+
maxHeight: maxHeightSize
|
|
87
105
|
};
|
|
88
106
|
const {
|
|
89
107
|
closeIcon: CloseIconComponent
|
|
@@ -97,9 +115,9 @@ const ModalOverlay = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
97
115
|
children: /*#__PURE__*/_jsx(View, {
|
|
98
116
|
ref: ref,
|
|
99
117
|
onLayout: onLayout,
|
|
100
|
-
style: [overlaidPosition, containerWidthHeight, staticStyles.positioner, !isReady && staticStyles.hidden],
|
|
118
|
+
style: [overlaidPosition, containerWidthHeight, staticStyles.positioner, !isReady && staticStyles.hidden, selectContainerStyle(enableFullscreen, themeTokens)],
|
|
101
119
|
children: /*#__PURE__*/_jsxs(Card, {
|
|
102
|
-
tokens:
|
|
120
|
+
tokens: staticStyles.card,
|
|
103
121
|
children: [/*#__PURE__*/_jsx(View, {
|
|
104
122
|
style: [staticStyles.closeButtonContainer, selectCloseButtonContainerStyles(themeTokens)],
|
|
105
123
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
@@ -132,6 +150,7 @@ ModalOverlay.propTypes = {
|
|
|
132
150
|
variant: variantProp.propType,
|
|
133
151
|
tokens: getTokensPropType('Modal'),
|
|
134
152
|
copy: copyPropTypes,
|
|
135
|
-
onClose: PropTypes.func
|
|
153
|
+
onClose: PropTypes.func,
|
|
154
|
+
enableFullscreen: PropTypes.bool
|
|
136
155
|
};
|
|
137
156
|
export default ModalOverlay;
|
|
@@ -2,8 +2,12 @@ import React from 'react';
|
|
|
2
2
|
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
|
+
import Dimensions from "react-native-web/dist/exports/Dimensions";
|
|
6
|
+
import SafeAreaView from "react-native-web/dist/exports/SafeAreaView";
|
|
7
|
+
import Platform from "react-native-web/dist/exports/Platform";
|
|
8
|
+
import ScrollView from "react-native-web/dist/exports/ScrollView";
|
|
5
9
|
import { useThemeTokens, useThemeTokensCallback, applyTextStyles } from '../ThemeProvider';
|
|
6
|
-
import { containUniqueFields, getTokensPropType, getPressHandlersWithArgs, selectTokens, useOverlaidPosition, useCopy, useMultipleInputValues, useResponsiveProp, variantProp } from '../utils';
|
|
10
|
+
import { containUniqueFields, getTokensPropType, getPressHandlersWithArgs, selectTokens, useOverlaidPosition, useCopy, useMultipleInputValues, useResponsiveProp, variantProp, useScrollBlocking } from '../utils';
|
|
7
11
|
import defaultDictionary from './dictionary';
|
|
8
12
|
import { useViewport } from '../ViewportProvider';
|
|
9
13
|
import Box from '../Box';
|
|
@@ -16,7 +20,6 @@ import StackView from '../StackView';
|
|
|
16
20
|
import Typography from '../Typography';
|
|
17
21
|
import { TextButton } from '../Link';
|
|
18
22
|
import ModalOverlay from './ModalOverlay';
|
|
19
|
-
import Modal from '../Modal';
|
|
20
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
24
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
25
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -32,21 +35,54 @@ const selectSubTitleTokens = _ref => {
|
|
|
32
35
|
color: subtitleColor
|
|
33
36
|
};
|
|
34
37
|
};
|
|
35
|
-
const
|
|
38
|
+
const selectDividerTokens = _ref2 => {
|
|
36
39
|
let {
|
|
37
|
-
dividerColor
|
|
38
|
-
width,
|
|
39
|
-
decorative = true,
|
|
40
|
-
weight = 'thin'
|
|
40
|
+
dividerColor
|
|
41
41
|
} = _ref2;
|
|
42
42
|
return {
|
|
43
|
-
color: dividerColor
|
|
44
|
-
width,
|
|
45
|
-
decorative,
|
|
46
|
-
weight
|
|
43
|
+
color: dividerColor
|
|
47
44
|
};
|
|
48
45
|
};
|
|
49
|
-
const
|
|
46
|
+
const selectHeaderTokens = _ref3 => {
|
|
47
|
+
let {
|
|
48
|
+
contentMarginLeft,
|
|
49
|
+
contentMarginRight,
|
|
50
|
+
contentMarginTop,
|
|
51
|
+
contentPaddingLeft,
|
|
52
|
+
contentPaddingRight
|
|
53
|
+
} = _ref3;
|
|
54
|
+
return {
|
|
55
|
+
marginLeft: contentMarginLeft,
|
|
56
|
+
marginRight: contentMarginRight,
|
|
57
|
+
marginTop: contentMarginTop,
|
|
58
|
+
paddingLeft: contentPaddingLeft,
|
|
59
|
+
paddingRight: contentPaddingRight,
|
|
60
|
+
flexGrow: 1
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
const selectControlsTokens = _ref4 => {
|
|
64
|
+
let {
|
|
65
|
+
contentMarginBottom,
|
|
66
|
+
contentMarginLeft,
|
|
67
|
+
contentMarginRight,
|
|
68
|
+
contentPaddingLeft,
|
|
69
|
+
contentPaddingRight
|
|
70
|
+
} = _ref4;
|
|
71
|
+
return {
|
|
72
|
+
marginBottom: contentMarginBottom,
|
|
73
|
+
marginLeft: contentMarginLeft,
|
|
74
|
+
marginRight: contentMarginRight,
|
|
75
|
+
paddingLeft: contentPaddingLeft,
|
|
76
|
+
paddingRight: contentPaddingRight
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
const selectContainerStyle = (windowHeight, windowWidth) => ({
|
|
80
|
+
height: windowHeight,
|
|
81
|
+
width: windowWidth
|
|
82
|
+
});
|
|
83
|
+
const TOTAL_COLUMNS = 12;
|
|
84
|
+
const MAX_ITEMS_THRESHOLD = 12;
|
|
85
|
+
const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
|
|
50
86
|
let {
|
|
51
87
|
label,
|
|
52
88
|
subtitle,
|
|
@@ -68,7 +104,7 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
68
104
|
rowLimit = 12,
|
|
69
105
|
dictionary = defaultDictionary,
|
|
70
106
|
...rest
|
|
71
|
-
} =
|
|
107
|
+
} = _ref5;
|
|
72
108
|
const viewport = useViewport();
|
|
73
109
|
const {
|
|
74
110
|
currentValues,
|
|
@@ -112,7 +148,8 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
112
148
|
maxWidthSize,
|
|
113
149
|
subHeaderLineHeight,
|
|
114
150
|
minHeight,
|
|
115
|
-
minWidth
|
|
151
|
+
minWidth,
|
|
152
|
+
...restTokens
|
|
116
153
|
} = useThemeTokens('MultiSelectFilter', tokens, {
|
|
117
154
|
...variant,
|
|
118
155
|
maxHeight,
|
|
@@ -190,21 +227,35 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
190
227
|
offsets,
|
|
191
228
|
align
|
|
192
229
|
});
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
230
|
+
const [isScrolling, setIsScrolling] = React.useState(false);
|
|
231
|
+
const [scrollViewHeight, setScrollViewHeight] = React.useState(0);
|
|
232
|
+
const [rowHeight, setRowHeight] = React.useState(0);
|
|
233
|
+
const modalRef = useScrollBlocking(isOpen);
|
|
234
|
+
const windowWidth = Dimensions.get('window').width;
|
|
235
|
+
const windowHeight = Dimensions.get('window').height;
|
|
236
|
+
React.useEffect(() => {
|
|
237
|
+
if (rowHeight > scrollViewHeight) {
|
|
238
|
+
setIsScrolling(true);
|
|
239
|
+
} else {
|
|
240
|
+
setIsScrolling(false);
|
|
241
|
+
}
|
|
242
|
+
}, [scrollViewHeight, rowHeight]);
|
|
243
|
+
const handleScrollViewLayout = event => {
|
|
244
|
+
const {
|
|
245
|
+
height
|
|
246
|
+
} = event.nativeEvent.layout;
|
|
247
|
+
setScrollViewHeight(height);
|
|
248
|
+
};
|
|
249
|
+
const handleRowLayout = event => {
|
|
250
|
+
const {
|
|
251
|
+
height
|
|
252
|
+
} = event.nativeEvent.layout;
|
|
253
|
+
setRowHeight(height);
|
|
254
|
+
};
|
|
255
|
+
const headerContent = /*#__PURE__*/_jsxs(View, {
|
|
256
|
+
style: [selectHeaderTokens(restTokens), styles.container],
|
|
257
|
+
children: [/*#__PURE__*/_jsx(Row, {
|
|
258
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
208
259
|
children: /*#__PURE__*/_jsx(Typography, {
|
|
209
260
|
tokens: {
|
|
210
261
|
...headerStyles,
|
|
@@ -212,26 +263,30 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
212
263
|
},
|
|
213
264
|
children: getCopy('filterByLabel').replace(/%\{filterCategory\}/g, label.toLowerCase())
|
|
214
265
|
})
|
|
215
|
-
})
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
})
|
|
266
|
+
})
|
|
267
|
+
}), subtitle && /*#__PURE__*/_jsxs(_Fragment, {
|
|
268
|
+
children: [/*#__PURE__*/_jsx(Spacer, {
|
|
269
|
+
space: 4
|
|
270
|
+
}), /*#__PURE__*/_jsx(Row, {
|
|
271
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
272
|
+
tokens: {
|
|
273
|
+
...subeHeaderStyles,
|
|
274
|
+
lineHeight: subHeaderLineHeight
|
|
275
|
+
},
|
|
276
|
+
children: subtitle
|
|
277
|
+
})
|
|
227
278
|
}), /*#__PURE__*/_jsx(Spacer, {
|
|
228
279
|
space: 4
|
|
229
|
-
})
|
|
230
|
-
|
|
280
|
+
})]
|
|
281
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
282
|
+
style: styles.options,
|
|
283
|
+
children: /*#__PURE__*/_jsx(ScrollView, {
|
|
284
|
+
onLayout: handleScrollViewLayout,
|
|
231
285
|
children: /*#__PURE__*/_jsx(Row, {
|
|
232
286
|
distribute: "between",
|
|
287
|
+
onLayout: handleRowLayout,
|
|
233
288
|
children: [...Array(colSize).keys()].map(i => /*#__PURE__*/_jsxs(Col, {
|
|
234
|
-
xs:
|
|
289
|
+
xs: TOTAL_COLUMNS / colSize,
|
|
235
290
|
children: [/*#__PURE__*/_jsx(CheckboxGroup, {
|
|
236
291
|
items: items.slice(i * rowLength, (i + 1) * rowLength),
|
|
237
292
|
checkedIds: checkedIds,
|
|
@@ -241,13 +296,18 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
241
296
|
})]
|
|
242
297
|
}, i))
|
|
243
298
|
})
|
|
244
|
-
})
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
299
|
+
})
|
|
300
|
+
})]
|
|
301
|
+
});
|
|
302
|
+
const controlsContent = /*#__PURE__*/_jsxs(_Fragment, {
|
|
303
|
+
children: [isScrolling ? /*#__PURE__*/_jsx(Divider, {
|
|
304
|
+
tokens: selectDividerTokens(themeTokens),
|
|
305
|
+
space: 4
|
|
306
|
+
}) : /*#__PURE__*/_jsx(Spacer, {
|
|
307
|
+
space: 4
|
|
308
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
309
|
+
style: selectControlsTokens(restTokens),
|
|
310
|
+
children: /*#__PURE__*/_jsx(Row, {
|
|
251
311
|
horizontalAlign: buttonDirection === 'column' ? 'center' : 'start',
|
|
252
312
|
children: /*#__PURE__*/_jsxs(StackView, {
|
|
253
313
|
direction: buttonDirection,
|
|
@@ -261,7 +321,6 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
261
321
|
children: [/*#__PURE__*/_jsx(Button, {
|
|
262
322
|
onPress: () => onApply(checkedIds),
|
|
263
323
|
variant: {
|
|
264
|
-
size: 'small',
|
|
265
324
|
priority: 'high',
|
|
266
325
|
...(viewport === 'xs' && {
|
|
267
326
|
width: 'full'
|
|
@@ -275,105 +334,85 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
275
334
|
})
|
|
276
335
|
})]
|
|
277
336
|
})
|
|
278
|
-
})
|
|
337
|
+
})
|
|
338
|
+
})]
|
|
339
|
+
});
|
|
340
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
341
|
+
children: [/*#__PURE__*/_jsx(ButtonDropdown, {
|
|
342
|
+
ref: sourceRef,
|
|
343
|
+
...pressHandlers,
|
|
344
|
+
value: isOpen,
|
|
345
|
+
selected: isSelected,
|
|
346
|
+
label: label,
|
|
347
|
+
onChange: handleChange,
|
|
348
|
+
tokens: getButtonTokens,
|
|
349
|
+
inactive: inactive
|
|
350
|
+
}, id), isOpen && viewport === 'xs' && /*#__PURE__*/_jsx(ModalOverlay, {
|
|
351
|
+
overlaidPosition: {
|
|
352
|
+
top: 0,
|
|
353
|
+
left: 0
|
|
354
|
+
},
|
|
355
|
+
onClose: onClose,
|
|
356
|
+
maxHeight: true,
|
|
357
|
+
maxHeightSize: windowHeight,
|
|
358
|
+
maxWidthSize: windowWidth,
|
|
359
|
+
minHeight: windowHeight,
|
|
360
|
+
minWidth: windowWidth,
|
|
361
|
+
tokens: {
|
|
362
|
+
...tokens,
|
|
363
|
+
maxWidth: true
|
|
364
|
+
},
|
|
365
|
+
copy: copy,
|
|
366
|
+
isReady: isReady,
|
|
367
|
+
onLayout: onTargetLayout,
|
|
368
|
+
ref: modalRef,
|
|
369
|
+
enableFullscreen: true,
|
|
370
|
+
children: /*#__PURE__*/_jsxs(SafeAreaView, {
|
|
371
|
+
style: [selectContainerStyle(windowHeight, windowWidth), styles.content],
|
|
372
|
+
ref: ref,
|
|
373
|
+
children: [headerContent, /*#__PURE__*/_jsx(View, {
|
|
374
|
+
style: styles.controls,
|
|
375
|
+
children: controlsContent
|
|
376
|
+
})]
|
|
377
|
+
})
|
|
279
378
|
}), isOpen && viewport !== 'xs' && /*#__PURE__*/_jsxs(ModalOverlay, {
|
|
280
379
|
overlaidPosition: overlaidPosition,
|
|
281
380
|
onClose: onClose,
|
|
282
|
-
maxHeight: maxHeight,
|
|
381
|
+
maxHeight: items.length > MAX_ITEMS_THRESHOLD ? true : maxHeight,
|
|
283
382
|
maxHeightSize: maxHeightSize,
|
|
284
383
|
maxWidthSize: maxWidthSize,
|
|
285
384
|
minHeight: minHeight,
|
|
286
385
|
minWidth: minWidth,
|
|
287
386
|
tokens: {
|
|
288
387
|
...tokens,
|
|
289
|
-
maxWidth
|
|
388
|
+
maxWidth: items.length > MAX_ITEMS_THRESHOLD ? true : maxWidth
|
|
290
389
|
},
|
|
291
390
|
copy: copy,
|
|
292
391
|
isReady: isReady,
|
|
293
392
|
onLayout: onTargetLayout,
|
|
294
393
|
ref: ref,
|
|
295
|
-
children: [
|
|
296
|
-
children: /*#__PURE__*/_jsx(View, {
|
|
297
|
-
style: styles.textContainerStyle,
|
|
298
|
-
children: /*#__PURE__*/_jsx(Typography, {
|
|
299
|
-
tokens: {
|
|
300
|
-
...headerStyles,
|
|
301
|
-
lineHeight: headerLineHeight
|
|
302
|
-
},
|
|
303
|
-
children: getCopy('filterByLabel').replace(/%\{filterCategory\}/g, label.toLowerCase())
|
|
304
|
-
})
|
|
305
|
-
})
|
|
306
|
-
}), subtitle && /*#__PURE__*/_jsxs(_Fragment, {
|
|
307
|
-
children: [/*#__PURE__*/_jsx(Spacer, {
|
|
308
|
-
space: 5
|
|
309
|
-
}), /*#__PURE__*/_jsx(Row, {
|
|
310
|
-
children: /*#__PURE__*/_jsx(Typography, {
|
|
311
|
-
tokens: {
|
|
312
|
-
...subeHeaderStyles,
|
|
313
|
-
lineHeight: subHeaderLineHeight
|
|
314
|
-
},
|
|
315
|
-
children: subtitle
|
|
316
|
-
})
|
|
317
|
-
})]
|
|
318
|
-
}), /*#__PURE__*/_jsx(Spacer, {
|
|
319
|
-
space: 4
|
|
320
|
-
}), /*#__PURE__*/_jsx(Box, {
|
|
321
|
-
scroll: true,
|
|
322
|
-
children: /*#__PURE__*/_jsx(Row, {
|
|
323
|
-
distribute: "between",
|
|
324
|
-
children: [...Array(colSize).keys()].map(i => /*#__PURE__*/_jsxs(Col, {
|
|
325
|
-
xs: 12 / colSize,
|
|
326
|
-
children: [/*#__PURE__*/_jsx(CheckboxGroup, {
|
|
327
|
-
items: items.slice(i * rowLength, (i + 1) * rowLength),
|
|
328
|
-
checkedIds: checkedIds,
|
|
329
|
-
onChange: e => setCheckedIds(e, i)
|
|
330
|
-
}), /*#__PURE__*/_jsx(Spacer, {
|
|
331
|
-
size: 4
|
|
332
|
-
})]
|
|
333
|
-
}, i))
|
|
334
|
-
})
|
|
335
|
-
}), /*#__PURE__*/_jsx(Divider, {
|
|
336
|
-
variant: selectDividerToknes({
|
|
337
|
-
...themeTokens,
|
|
338
|
-
width: 'full'
|
|
339
|
-
}),
|
|
340
|
-
space: 4
|
|
341
|
-
}), /*#__PURE__*/_jsx(Row, {
|
|
342
|
-
horizontalAlign: buttonDirection === 'column' ? 'center' : 'start',
|
|
343
|
-
children: /*#__PURE__*/_jsxs(StackView, {
|
|
344
|
-
direction: buttonDirection,
|
|
345
|
-
space: 3,
|
|
346
|
-
tokens: {
|
|
347
|
-
alignItems: 'center',
|
|
348
|
-
...(viewport === 'xs' && {
|
|
349
|
-
flexGrow: 1
|
|
350
|
-
})
|
|
351
|
-
},
|
|
352
|
-
children: [/*#__PURE__*/_jsx(Button, {
|
|
353
|
-
onPress: () => onApply(checkedIds),
|
|
354
|
-
variant: {
|
|
355
|
-
size: 'small',
|
|
356
|
-
priority: 'high',
|
|
357
|
-
...(viewport === 'xs' && {
|
|
358
|
-
width: 'full'
|
|
359
|
-
})
|
|
360
|
-
},
|
|
361
|
-
children: getCopy('applyButtonLabel')
|
|
362
|
-
}), /*#__PURE__*/_jsx(Box, {
|
|
363
|
-
children: /*#__PURE__*/_jsx(TextButton, {
|
|
364
|
-
onPress: onClear,
|
|
365
|
-
children: getCopy('clearButtonLabel')
|
|
366
|
-
})
|
|
367
|
-
})]
|
|
368
|
-
})
|
|
369
|
-
})]
|
|
394
|
+
children: [headerContent, controlsContent]
|
|
370
395
|
})]
|
|
371
396
|
});
|
|
372
397
|
});
|
|
373
398
|
MultiSelectFilter.displayName = 'MultiSelectFilter';
|
|
374
399
|
const styles = StyleSheet.create({
|
|
375
|
-
|
|
376
|
-
|
|
400
|
+
container: {
|
|
401
|
+
flex: 1
|
|
402
|
+
},
|
|
403
|
+
controls: Platform.select({
|
|
404
|
+
web: {},
|
|
405
|
+
default: {
|
|
406
|
+
flex: 0.35
|
|
407
|
+
}
|
|
408
|
+
}),
|
|
409
|
+
content: {
|
|
410
|
+
flex: 1,
|
|
411
|
+
justifyContent: 'space-between',
|
|
412
|
+
backgroundColor: 'transparent'
|
|
413
|
+
},
|
|
414
|
+
options: {
|
|
415
|
+
flex: 1
|
|
377
416
|
}
|
|
378
417
|
});
|
|
379
418
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import View from "react-native-web/dist/exports/View";
|
|
3
|
+
import Platform from "react-native-web/dist/exports/Platform";
|
|
3
4
|
import PropTypes from 'prop-types';
|
|
4
5
|
import { applyTextStyles, useTheme, useThemeTokens, useResponsiveThemeTokens } from '../ThemeProvider';
|
|
5
6
|
import { a11yProps, getTokensPropType, selectSystemProps, selectTokens, variantProp, viewProps, wrapStringsInText, useResponsiveProp, createMediaQueryStyles, StyleSheet } from '../utils';
|
|
@@ -176,7 +177,7 @@ const getMediaQueryStyles = (themeTokens, themeOptions, mediaIdsRef, dismissible
|
|
|
176
177
|
const getDefaultStyles = (themeTokens, themeOptions, maxWidth, dismissible, viewport, system) => ({
|
|
177
178
|
containerStyles: {
|
|
178
179
|
container: {
|
|
179
|
-
flexDirection: system === true && viewport === 'xl' ? 'row' : 'inherit',
|
|
180
|
+
flexDirection: system === true && viewport === 'xl' || Platform.OS === 'android' ? 'row' : 'inherit',
|
|
180
181
|
...selectContainerStyles(themeTokens)
|
|
181
182
|
}
|
|
182
183
|
},
|
|
@@ -281,6 +282,7 @@ const Notification = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
|
281
282
|
copy = 'en',
|
|
282
283
|
tokens,
|
|
283
284
|
variant,
|
|
285
|
+
onDismiss,
|
|
284
286
|
...rest
|
|
285
287
|
} = _ref6;
|
|
286
288
|
const [isDismissed, setIsDismissed] = React.useState(false);
|
|
@@ -340,7 +342,10 @@ const Notification = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
|
340
342
|
dismissIcon: DismissIconComponent,
|
|
341
343
|
dismissIconColor
|
|
342
344
|
} = enableMediaQueryStyleSheet === false ? themeTokens : themeTokens[viewport];
|
|
343
|
-
const onDismissPress = () =>
|
|
345
|
+
const onDismissPress = () => {
|
|
346
|
+
setIsDismissed(true);
|
|
347
|
+
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
348
|
+
};
|
|
344
349
|
return /*#__PURE__*/_jsx(View, {
|
|
345
350
|
ref: ref,
|
|
346
351
|
style: notificationComponentRef.current.containerStyles.container,
|
|
@@ -414,6 +419,10 @@ Notification.propTypes = {
|
|
|
414
419
|
copy: PropTypes.oneOfType([PropTypes.oneOf(['en', 'fr']), PropTypes.shape({
|
|
415
420
|
dismiss: PropTypes.string
|
|
416
421
|
})]),
|
|
422
|
+
/**
|
|
423
|
+
* Callback function called when the dismiss button is clicked
|
|
424
|
+
*/
|
|
425
|
+
onDismiss: PropTypes.func,
|
|
417
426
|
tokens: getTokensPropType('Notification'),
|
|
418
427
|
variant: variantProp.propType
|
|
419
428
|
};
|
|
@@ -75,7 +75,8 @@ const selectTextStyles = _ref3 => {
|
|
|
75
75
|
textLineHeight,
|
|
76
76
|
fontName,
|
|
77
77
|
fontSize,
|
|
78
|
-
fontWeight
|
|
78
|
+
fontWeight,
|
|
79
|
+
marginLeft
|
|
79
80
|
} = _ref3;
|
|
80
81
|
return applyTextStyles({
|
|
81
82
|
fontColor: textColor,
|
|
@@ -83,7 +84,7 @@ const selectTextStyles = _ref3 => {
|
|
|
83
84
|
fontSize,
|
|
84
85
|
fontWeight,
|
|
85
86
|
lineHeight: Platform.OS === 'web' ? textLineHeight : textLineHeight * 1.2,
|
|
86
|
-
marginLeft
|
|
87
|
+
marginLeft
|
|
87
88
|
});
|
|
88
89
|
};
|
|
89
90
|
|
|
@@ -95,6 +96,7 @@ const selectTextStyles = _ref3 => {
|
|
|
95
96
|
* @param {string} variant - The variant of the status component.
|
|
96
97
|
* @param {ReactNode} children - The content to be displayed inside the status component.
|
|
97
98
|
* @param {function} customGradient - The custom gradient function for the status component.
|
|
99
|
+
* @param {elementType} customGradient - Defines an icon to be rendered.
|
|
98
100
|
* @param {object} rest - The rest of the props to be applied to the status component.
|
|
99
101
|
* @param {React.Ref} ref - The ref to be applied to the status component.
|
|
100
102
|
* @returns {ReactNode} The rendered status component.
|
|
@@ -108,14 +110,17 @@ const Status = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
|
|
|
108
110
|
...rest
|
|
109
111
|
} = _ref4;
|
|
110
112
|
const themeTokens = useThemeTokens('Status', tokens, variant);
|
|
113
|
+
const {
|
|
114
|
+
icon
|
|
115
|
+
} = themeTokens;
|
|
111
116
|
const containerStyles = {
|
|
112
117
|
...selectContainerStyles(themeTokens),
|
|
113
118
|
...staticStyles.container
|
|
114
119
|
};
|
|
115
120
|
let content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
116
|
-
children: [/*#__PURE__*/_jsx(Icon, {
|
|
121
|
+
children: [icon ? /*#__PURE__*/_jsx(Icon, {
|
|
117
122
|
...selectIconProps(themeTokens)
|
|
118
|
-
}), wrapStringsInText(children, {
|
|
123
|
+
}) : null, wrapStringsInText(children, {
|
|
119
124
|
style: selectTextStyles(themeTokens)
|
|
120
125
|
})]
|
|
121
126
|
});
|