@telus-uds/components-base 3.18.0 → 3.19.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 +17 -1
- package/jest.config.cjs +10 -2
- package/lib/cjs/Box/Box.js +114 -62
- package/lib/cjs/Box/backgroundImageStylesMap.js +136 -28
- package/lib/cjs/Carousel/Carousel.js +1 -1
- package/lib/cjs/MultiSelectFilter/MultiSelectFilter.js +2 -2
- package/lib/cjs/StepTracker/Step.js +12 -1
- package/lib/cjs/StepTracker/StepTracker.js +15 -4
- package/lib/cjs/TabBar/TabBar.js +4 -2
- package/lib/cjs/TabBar/index.js +2 -0
- package/lib/cjs/Tooltip/Backdrop.js +1 -1
- package/lib/cjs/utils/index.js +9 -1
- package/lib/cjs/utils/isTouchDevice.js +34 -0
- package/lib/esm/Box/Box.js +113 -63
- package/lib/esm/Box/backgroundImageStylesMap.js +134 -27
- package/lib/esm/Carousel/Carousel.js +2 -2
- package/lib/esm/MultiSelectFilter/MultiSelectFilter.js +2 -2
- package/lib/esm/StepTracker/Step.js +12 -1
- package/lib/esm/StepTracker/StepTracker.js +15 -4
- package/lib/esm/TabBar/TabBar.js +4 -2
- package/lib/esm/TabBar/index.js +2 -0
- package/lib/esm/Tooltip/Backdrop.js +1 -1
- package/lib/esm/utils/index.js +2 -1
- package/lib/esm/utils/isTouchDevice.js +27 -0
- package/lib/package.json +2 -2
- package/package.json +2 -2
- package/src/Box/Box.jsx +97 -55
- package/src/Box/backgroundImageStylesMap.js +48 -15
- package/src/Carousel/Carousel.jsx +3 -2
- package/src/MultiSelectFilter/MultiSelectFilter.jsx +2 -2
- package/src/StepTracker/Step.jsx +47 -27
- package/src/StepTracker/StepTracker.jsx +9 -1
- package/src/TabBar/TabBar.jsx +3 -1
- package/src/TabBar/index.js +3 -0
- package/src/Tooltip/Backdrop.jsx +1 -1
- package/src/utils/index.js +1 -0
- package/src/utils/isTouchDevice.js +34 -0
package/lib/cjs/utils/index.js
CHANGED
|
@@ -21,7 +21,8 @@ var _exportNames = {
|
|
|
21
21
|
convertFromMegaByteToByte: true,
|
|
22
22
|
formatImageSource: true,
|
|
23
23
|
getSpacingScale: true,
|
|
24
|
-
useVariants: true
|
|
24
|
+
useVariants: true,
|
|
25
|
+
isTouchDevice: true
|
|
25
26
|
};
|
|
26
27
|
Object.defineProperty(exports, "BaseView", {
|
|
27
28
|
enumerable: true,
|
|
@@ -65,6 +66,12 @@ Object.defineProperty(exports, "info", {
|
|
|
65
66
|
return _info.default;
|
|
66
67
|
}
|
|
67
68
|
});
|
|
69
|
+
Object.defineProperty(exports, "isTouchDevice", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
get: function () {
|
|
72
|
+
return _isTouchDevice.default;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
68
75
|
Object.defineProperty(exports, "transformGradient", {
|
|
69
76
|
enumerable: true,
|
|
70
77
|
get: function () {
|
|
@@ -256,6 +263,7 @@ var _convertFromMegaByteToByte = _interopRequireDefault(require("./convertFromMe
|
|
|
256
263
|
var _formatImageSource = _interopRequireDefault(require("./formatImageSource"));
|
|
257
264
|
var _getSpacingScale = _interopRequireDefault(require("./getSpacingScale"));
|
|
258
265
|
var _useVariants = _interopRequireDefault(require("./useVariants"));
|
|
266
|
+
var _isTouchDevice = _interopRequireDefault(require("./isTouchDevice"));
|
|
259
267
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
260
268
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
261
269
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
/**
|
|
10
|
+
* Determines if the current device supports touch interactions
|
|
11
|
+
*
|
|
12
|
+
* @returns {boolean} True if the device supports touch, false otherwise
|
|
13
|
+
*/
|
|
14
|
+
const isTouchDevice = () => {
|
|
15
|
+
if (_Platform.default.OS !== 'web') {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
if (typeof window !== 'undefined') {
|
|
19
|
+
if ('ontouchstart' in window) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
if (window.navigator && window.navigator.maxTouchPoints > 0) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
if (window.navigator && window.navigator.msMaxTouchPoints > 0) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
if (window.matchMedia && window.matchMedia('(pointer: coarse)').matches) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
};
|
|
34
|
+
var _default = exports.default = isTouchDevice;
|
package/lib/esm/Box/Box.js
CHANGED
|
@@ -7,8 +7,8 @@ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
|
7
7
|
import ImageBackground from "react-native-web/dist/exports/ImageBackground";
|
|
8
8
|
import Image from "react-native-web/dist/exports/Image";
|
|
9
9
|
import { useTheme, useThemeTokens, useResponsiveThemeTokens, useThemeTokensCallback } from '../ThemeProvider';
|
|
10
|
-
import { a11yProps, createMediaQueryStyles, getA11yPropsFromHtmlTag, getTokensPropType, layoutTags, responsiveProps, selectSystemProps, spacingProps, useResponsiveProp, useSpacingScale, variantProp, viewProps, StyleSheet as RNMQStyleSheet, getSpacingScale } from '../utils';
|
|
11
|
-
import backgroundImageStylesMap from './backgroundImageStylesMap';
|
|
10
|
+
import { a11yProps, createMediaQueryStyles, getA11yPropsFromHtmlTag, getTokensPropType, layoutTags, responsiveProps, selectSystemProps, spacingProps, useResponsiveProp, useSpacingScale, variantProp, viewProps, StyleSheet as RNMQStyleSheet, getSpacingScale, formatImageSource } from '../utils';
|
|
11
|
+
import backgroundImageStylesMap, { backgroundPositions } from './backgroundImageStylesMap';
|
|
12
12
|
import { useViewport } from '../ViewportProvider';
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
@@ -68,39 +68,51 @@ const setBackgroundImage = _ref2 => {
|
|
|
68
68
|
backgroundImageResizeMode,
|
|
69
69
|
backgroundImagePosition,
|
|
70
70
|
backgroundImageAlign,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
content
|
|
71
|
+
content,
|
|
72
|
+
testID
|
|
74
73
|
} = _ref2;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
const backgroundImageTestID = testID ? `${testID}-background-image` : undefined;
|
|
75
|
+
if (backgroundImageResizeMode === 'contain' && backgroundImagePosition && backgroundImageAlign) {
|
|
76
|
+
const positionKey = `${backgroundImagePosition}-${backgroundImageAlign}`;
|
|
77
|
+
if (Platform.OS === 'web') {
|
|
78
|
+
const backgroundPosition = backgroundPositions[positionKey] || 'center center';
|
|
79
|
+
const backgroundImageStyle = {
|
|
80
|
+
backgroundImage: `url(${src})`,
|
|
81
|
+
backgroundSize: 'contain',
|
|
82
|
+
backgroundRepeat: 'no-repeat',
|
|
83
|
+
backgroundPosition
|
|
84
|
+
};
|
|
85
|
+
return /*#__PURE__*/_jsx(View, {
|
|
86
|
+
style: [staticStyles.imageBackground, backgroundImageStyle],
|
|
87
|
+
"aria-label": alt,
|
|
88
|
+
testID: backgroundImageTestID,
|
|
89
|
+
children: content
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const positionStyles = backgroundImageStylesMap[positionKey] || {};
|
|
82
93
|
return /*#__PURE__*/_jsxs(View, {
|
|
83
|
-
style: staticStyles.
|
|
84
|
-
children: [/*#__PURE__*/_jsx(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
style: staticStyles.containContainer,
|
|
95
|
+
children: [/*#__PURE__*/_jsx(Image, {
|
|
96
|
+
source: src,
|
|
97
|
+
resizeMode: backgroundImageResizeMode,
|
|
98
|
+
style: [staticStyles.containImage, positionStyles],
|
|
99
|
+
accessible: true,
|
|
100
|
+
accessibilityLabel: alt,
|
|
101
|
+
accessibilityIgnoresInvertColors: true,
|
|
102
|
+
testID: backgroundImageTestID
|
|
103
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
104
|
+
style: staticStyles.contentOverlay,
|
|
105
|
+
children: content
|
|
106
|
+
})]
|
|
95
107
|
});
|
|
96
108
|
}
|
|
97
109
|
return /*#__PURE__*/_jsx(ImageBackground, {
|
|
98
|
-
source:
|
|
99
|
-
uri: src
|
|
100
|
-
},
|
|
101
|
-
alt: alt,
|
|
102
|
-
style: staticStyles.backgroundImageContainer,
|
|
110
|
+
source: src,
|
|
103
111
|
resizeMode: backgroundImageResizeMode,
|
|
112
|
+
style: staticStyles.imageBackground,
|
|
113
|
+
accessible: true,
|
|
114
|
+
accessibilityLabel: alt,
|
|
115
|
+
testID: backgroundImageTestID,
|
|
104
116
|
children: content
|
|
105
117
|
});
|
|
106
118
|
};
|
|
@@ -257,31 +269,61 @@ const Box = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
257
269
|
align = ''
|
|
258
270
|
} = backgroundImage || {};
|
|
259
271
|
const backgroundImageResizeMode = useResponsiveProp(resizeMode, 'cover');
|
|
260
|
-
const backgroundImagePosition = useResponsiveProp(position
|
|
261
|
-
const backgroundImageAlign = useResponsiveProp(align
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
272
|
+
const backgroundImagePosition = useResponsiveProp(position);
|
|
273
|
+
const backgroundImageAlign = useResponsiveProp(align);
|
|
274
|
+
const imageSourceViewport = formatImageSource(useResponsiveProp(src));
|
|
275
|
+
if (backgroundImage && src) {
|
|
276
|
+
const {
|
|
277
|
+
paddingTop,
|
|
278
|
+
paddingBottom,
|
|
279
|
+
paddingLeft,
|
|
280
|
+
paddingRight,
|
|
281
|
+
...containerStyle
|
|
282
|
+
} = boxStyles;
|
|
283
|
+
const hasPadding = paddingTop || paddingBottom || paddingLeft || paddingRight;
|
|
284
|
+
const paddedContent = hasPadding ? /*#__PURE__*/_jsx(View, {
|
|
285
|
+
style: {
|
|
286
|
+
paddingTop,
|
|
287
|
+
paddingBottom,
|
|
288
|
+
paddingLeft,
|
|
289
|
+
paddingRight
|
|
290
|
+
},
|
|
291
|
+
children: children
|
|
292
|
+
}) : children;
|
|
293
|
+
content = setBackgroundImage({
|
|
294
|
+
src: imageSourceViewport,
|
|
295
|
+
alt,
|
|
296
|
+
backgroundImageResizeMode,
|
|
297
|
+
backgroundImagePosition,
|
|
298
|
+
backgroundImageAlign,
|
|
299
|
+
content: paddedContent,
|
|
300
|
+
testID
|
|
301
|
+
});
|
|
302
|
+
const dataSetValue = boxMediaIds ? {
|
|
303
|
+
media: boxMediaIds,
|
|
304
|
+
...dataSet
|
|
305
|
+
} : dataSet;
|
|
306
|
+
if (scroll) {
|
|
307
|
+
const scrollProps = typeof scroll === 'object' ? scroll : {};
|
|
308
|
+
scrollProps.contentContainerStyle = [containerStyle, scrollProps.contentContainerStyle];
|
|
309
|
+
return /*#__PURE__*/_jsx(ScrollView, {
|
|
310
|
+
...scrollProps,
|
|
311
|
+
...props,
|
|
312
|
+
testID: testID,
|
|
313
|
+
dataSet: dataSetValue,
|
|
314
|
+
ref: ref,
|
|
315
|
+
children: content
|
|
282
316
|
});
|
|
283
317
|
}
|
|
284
|
-
|
|
318
|
+
return /*#__PURE__*/_jsx(View, {
|
|
319
|
+
...props,
|
|
320
|
+
style: containerStyle,
|
|
321
|
+
testID: testID,
|
|
322
|
+
dataSet: dataSetValue,
|
|
323
|
+
ref: ref,
|
|
324
|
+
children: content
|
|
325
|
+
});
|
|
326
|
+
}
|
|
285
327
|
const dataSetValue = boxMediaIds ? {
|
|
286
328
|
media: boxMediaIds,
|
|
287
329
|
...dataSet
|
|
@@ -394,10 +436,12 @@ Box.propTypes = {
|
|
|
394
436
|
*/
|
|
395
437
|
customGradient: PropTypes.func,
|
|
396
438
|
/**
|
|
397
|
-
*
|
|
439
|
+
* Apply background image to the box.
|
|
398
440
|
*/
|
|
399
441
|
backgroundImage: PropTypes.shape({
|
|
400
|
-
src
|
|
442
|
+
// The image src is either a URI string or a number (when a local image src is bundled in IOS or Android app)
|
|
443
|
+
// src is an object when used responsively to provide different image sources for different screen sizes
|
|
444
|
+
src: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]).isRequired,
|
|
401
445
|
alt: PropTypes.string,
|
|
402
446
|
resizeMode: responsiveProps.getTypeOptionallyByViewport(PropTypes.oneOf(['cover', 'contain', 'stretch', 'repeat', 'center'])),
|
|
403
447
|
position: responsiveProps.getTypeOptionallyByViewport(PropTypes.oneOf(['none', 'bottom', 'left', 'right', 'top'])),
|
|
@@ -406,18 +450,24 @@ Box.propTypes = {
|
|
|
406
450
|
};
|
|
407
451
|
export default Box;
|
|
408
452
|
const staticStyles = StyleSheet.create({
|
|
409
|
-
|
|
410
|
-
|
|
453
|
+
imageBackground: {
|
|
454
|
+
width: '100%',
|
|
455
|
+
height: '100%'
|
|
411
456
|
},
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
457
|
+
contentOverlay: {
|
|
458
|
+
position: 'relative',
|
|
459
|
+
width: '100%',
|
|
460
|
+
height: '100%',
|
|
461
|
+
zIndex: 1
|
|
415
462
|
},
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
463
|
+
containContainer: {
|
|
464
|
+
width: '100%',
|
|
465
|
+
height: '100%',
|
|
466
|
+
overflow: 'hidden',
|
|
467
|
+
position: 'relative'
|
|
419
468
|
},
|
|
420
|
-
|
|
469
|
+
containImage: {
|
|
470
|
+
position: 'absolute',
|
|
421
471
|
width: '100%',
|
|
422
472
|
height: '100%'
|
|
423
473
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import Platform from "react-native-web/dist/exports/Platform";
|
|
2
|
+
const webStyles = {
|
|
2
3
|
'top-start': {
|
|
3
|
-
top: 0
|
|
4
|
+
top: 0,
|
|
5
|
+
left: 0
|
|
4
6
|
},
|
|
5
7
|
'top-center': {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
top: 0,
|
|
9
|
+
left: '50%',
|
|
10
|
+
transform: [{
|
|
11
|
+
translateX: '-50%'
|
|
12
|
+
}]
|
|
9
13
|
},
|
|
10
14
|
'top-end': {
|
|
11
15
|
top: 0,
|
|
@@ -16,60 +20,160 @@ export default {
|
|
|
16
20
|
right: 0
|
|
17
21
|
},
|
|
18
22
|
'left-start': {
|
|
19
|
-
top: 0
|
|
23
|
+
top: 0,
|
|
24
|
+
left: 0
|
|
20
25
|
},
|
|
21
26
|
'left-center': {
|
|
22
|
-
top:
|
|
27
|
+
top: '50%',
|
|
28
|
+
left: 0,
|
|
29
|
+
transform: [{
|
|
30
|
+
translateY: '-50%'
|
|
31
|
+
}]
|
|
32
|
+
},
|
|
33
|
+
'right-center': {
|
|
34
|
+
top: '50%',
|
|
35
|
+
right: 0,
|
|
36
|
+
transform: [{
|
|
37
|
+
translateY: '-50%'
|
|
38
|
+
}]
|
|
39
|
+
},
|
|
40
|
+
'bottom-start': {
|
|
41
|
+
bottom: 0,
|
|
42
|
+
left: 0
|
|
43
|
+
},
|
|
44
|
+
'left-end': {
|
|
45
|
+
bottom: 0,
|
|
46
|
+
left: 0
|
|
47
|
+
},
|
|
48
|
+
'bottom-center': {
|
|
49
|
+
bottom: 0,
|
|
50
|
+
left: '50%',
|
|
51
|
+
transform: [{
|
|
52
|
+
translateX: '-50%'
|
|
53
|
+
}]
|
|
54
|
+
},
|
|
55
|
+
'bottom-end': {
|
|
23
56
|
bottom: 0,
|
|
24
|
-
|
|
57
|
+
right: 0
|
|
58
|
+
},
|
|
59
|
+
'right-end': {
|
|
60
|
+
bottom: 0,
|
|
61
|
+
right: 0
|
|
25
62
|
},
|
|
26
|
-
'
|
|
63
|
+
'top-stretch': {
|
|
64
|
+
top: 0,
|
|
65
|
+
left: 0,
|
|
66
|
+
right: 0,
|
|
67
|
+
width: '100%'
|
|
68
|
+
},
|
|
69
|
+
'left-stretch': {
|
|
27
70
|
top: 0,
|
|
28
71
|
bottom: 0,
|
|
29
|
-
|
|
72
|
+
left: 0,
|
|
73
|
+
height: '100%'
|
|
30
74
|
},
|
|
31
|
-
'
|
|
75
|
+
'right-stretch': {
|
|
32
76
|
top: 0,
|
|
77
|
+
bottom: 0,
|
|
78
|
+
right: 0,
|
|
79
|
+
height: '100%'
|
|
80
|
+
},
|
|
81
|
+
'bottom-stretch': {
|
|
33
82
|
bottom: 0,
|
|
34
83
|
left: 0,
|
|
35
84
|
right: 0,
|
|
36
|
-
|
|
85
|
+
width: '100%'
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const webBackgroundPositions = {
|
|
89
|
+
'top-start': 'left top',
|
|
90
|
+
'top-center': 'center top',
|
|
91
|
+
'top-end': 'right top',
|
|
92
|
+
'bottom-start': 'left bottom',
|
|
93
|
+
'bottom-center': 'center bottom',
|
|
94
|
+
'bottom-end': 'right bottom',
|
|
95
|
+
'left-center': 'left center',
|
|
96
|
+
'right-center': 'right center'
|
|
97
|
+
};
|
|
98
|
+
const nativeStyles = {
|
|
99
|
+
'top-start': {
|
|
100
|
+
top: 0,
|
|
101
|
+
left: 0,
|
|
102
|
+
width: 150,
|
|
103
|
+
height: 200
|
|
37
104
|
},
|
|
38
|
-
'
|
|
105
|
+
'top-center': {
|
|
106
|
+
top: 0,
|
|
107
|
+
left: '50%',
|
|
108
|
+
marginLeft: -75,
|
|
109
|
+
width: 150,
|
|
110
|
+
height: 200
|
|
111
|
+
},
|
|
112
|
+
'top-end': {
|
|
39
113
|
top: 0,
|
|
40
|
-
bottom: 0,
|
|
41
114
|
right: 0,
|
|
42
|
-
|
|
115
|
+
width: 150,
|
|
116
|
+
height: 200
|
|
43
117
|
},
|
|
44
|
-
'
|
|
118
|
+
'right-start': {
|
|
45
119
|
top: 0,
|
|
46
|
-
bottom: 0,
|
|
47
120
|
right: 0,
|
|
48
|
-
|
|
121
|
+
width: 150,
|
|
122
|
+
height: 200
|
|
123
|
+
},
|
|
124
|
+
'left-start': {
|
|
125
|
+
top: 0,
|
|
126
|
+
left: 0,
|
|
127
|
+
width: 150,
|
|
128
|
+
height: 200
|
|
129
|
+
},
|
|
130
|
+
'left-center': {
|
|
131
|
+
left: 0,
|
|
132
|
+
top: '50%',
|
|
133
|
+
marginTop: -100,
|
|
134
|
+
width: 150,
|
|
135
|
+
height: 200
|
|
136
|
+
},
|
|
137
|
+
'right-center': {
|
|
138
|
+
right: 0,
|
|
139
|
+
top: '50%',
|
|
140
|
+
marginTop: -100,
|
|
141
|
+
width: 150,
|
|
142
|
+
height: 200
|
|
49
143
|
},
|
|
50
144
|
'bottom-start': {
|
|
51
145
|
bottom: 0,
|
|
52
|
-
left: 0
|
|
146
|
+
left: 0,
|
|
147
|
+
width: 150,
|
|
148
|
+
height: 200
|
|
53
149
|
},
|
|
54
150
|
'left-end': {
|
|
55
151
|
bottom: 0,
|
|
56
|
-
left: 0
|
|
152
|
+
left: 0,
|
|
153
|
+
width: 150,
|
|
154
|
+
height: 200
|
|
57
155
|
},
|
|
58
156
|
'bottom-center': {
|
|
59
|
-
left: 0,
|
|
60
|
-
right: 0,
|
|
61
157
|
bottom: 0,
|
|
62
|
-
|
|
158
|
+
left: '50%',
|
|
159
|
+
marginLeft: -75,
|
|
160
|
+
width: 150,
|
|
161
|
+
height: 200
|
|
63
162
|
},
|
|
64
163
|
'bottom-end': {
|
|
164
|
+
bottom: 0,
|
|
65
165
|
right: 0,
|
|
66
|
-
|
|
166
|
+
width: 150,
|
|
167
|
+
height: 200
|
|
67
168
|
},
|
|
68
169
|
'right-end': {
|
|
170
|
+
bottom: 0,
|
|
69
171
|
right: 0,
|
|
70
|
-
|
|
172
|
+
width: 150,
|
|
173
|
+
height: 200
|
|
71
174
|
},
|
|
72
175
|
'top-stretch': {
|
|
176
|
+
top: 0,
|
|
73
177
|
left: 0,
|
|
74
178
|
right: 0,
|
|
75
179
|
width: '100%'
|
|
@@ -77,6 +181,7 @@ export default {
|
|
|
77
181
|
'left-stretch': {
|
|
78
182
|
top: 0,
|
|
79
183
|
bottom: 0,
|
|
184
|
+
left: 0,
|
|
80
185
|
height: '100%'
|
|
81
186
|
},
|
|
82
187
|
'right-stretch': {
|
|
@@ -86,9 +191,11 @@ export default {
|
|
|
86
191
|
height: '100%'
|
|
87
192
|
},
|
|
88
193
|
'bottom-stretch': {
|
|
194
|
+
bottom: 0,
|
|
89
195
|
left: 0,
|
|
90
196
|
right: 0,
|
|
91
|
-
bottom: 0,
|
|
92
197
|
width: '100%'
|
|
93
198
|
}
|
|
94
|
-
};
|
|
199
|
+
};
|
|
200
|
+
export const backgroundPositions = Platform.OS === 'web' ? webBackgroundPositions : {};
|
|
201
|
+
export default Platform.OS === 'web' ? webStyles : nativeStyles;
|
|
@@ -8,7 +8,7 @@ import Dimensions from "react-native-web/dist/exports/Dimensions";
|
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { useThemeTokens } from '../ThemeProvider';
|
|
10
10
|
import { useViewport } from '../ViewportProvider';
|
|
11
|
-
import { getTokensPropType, getA11yPropsFromHtmlTag, layoutTags, variantProp, selectSystemProps, a11yProps, viewProps, useCopy, unpackFragment } from '../utils';
|
|
11
|
+
import { getTokensPropType, getA11yPropsFromHtmlTag, layoutTags, variantProp, selectSystemProps, a11yProps, viewProps, useCopy, unpackFragment, isTouchDevice } from '../utils';
|
|
12
12
|
import { useA11yInfo } from '../A11yInfoProvider';
|
|
13
13
|
import { CarouselProvider } from './CarouselContext';
|
|
14
14
|
import CarouselItem from './CarouselItem';
|
|
@@ -717,7 +717,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
717
717
|
return false;
|
|
718
718
|
}
|
|
719
719
|
if (Platform.OS === 'web') {
|
|
720
|
-
return !!(viewport === 'xs' || viewport === 'sm');
|
|
720
|
+
return !!(viewport === 'xs' || viewport === 'sm' || viewport === 'md' && isTouchDevice());
|
|
721
721
|
}
|
|
722
722
|
return true;
|
|
723
723
|
}, [viewport, totalItems]);
|
|
@@ -482,9 +482,9 @@ MultiSelectFilter.propTypes = {
|
|
|
482
482
|
*/
|
|
483
483
|
label: PropTypes.string.isRequired,
|
|
484
484
|
/**
|
|
485
|
-
* The text for the subtitle
|
|
485
|
+
* The text for the subtitle. Can also be JSX.
|
|
486
486
|
*/
|
|
487
|
-
subtitle: PropTypes.string,
|
|
487
|
+
subtitle: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
488
488
|
/**
|
|
489
489
|
* An optional unique string may be provided to identify the ButtonDropdown.
|
|
490
490
|
* If not provided, the label is used.
|
|
@@ -150,6 +150,13 @@ const getStepTestID = (isCompleted, isCurrent) => {
|
|
|
150
150
|
}
|
|
151
151
|
return testID;
|
|
152
152
|
};
|
|
153
|
+
const selectBarContainerStyles = (themeTokens, isCompleted, isCurrent) => ({
|
|
154
|
+
backgroundColor: isCompleted ? themeTokens.barCompletedBackgroundColor : themeTokens.barBackgroundColor,
|
|
155
|
+
height: themeTokens.barHeight,
|
|
156
|
+
...(isCurrent && {
|
|
157
|
+
backgroundColor: themeTokens.barCurrentBackgroundColor
|
|
158
|
+
})
|
|
159
|
+
});
|
|
153
160
|
|
|
154
161
|
/**
|
|
155
162
|
* A single step of a StepTracker.
|
|
@@ -162,6 +169,7 @@ const Step = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
|
|
|
162
169
|
stepCount = 0,
|
|
163
170
|
stepIndex = 0,
|
|
164
171
|
tokens,
|
|
172
|
+
isBarVariant,
|
|
165
173
|
...rest
|
|
166
174
|
} = _ref8;
|
|
167
175
|
const {
|
|
@@ -190,7 +198,10 @@ const Step = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
|
|
|
190
198
|
accessibilityCurrent: status === stepIndex,
|
|
191
199
|
ref: ref,
|
|
192
200
|
...selectProps(rest),
|
|
193
|
-
children: [/*#__PURE__*/
|
|
201
|
+
children: [isBarVariant && /*#__PURE__*/_jsx(View, {
|
|
202
|
+
style: selectBarContainerStyles(themeTokens, isCompleted, isCurrent),
|
|
203
|
+
testID: getStepTestID(isCompleted, isCurrent)
|
|
204
|
+
}), !isBarVariant && /*#__PURE__*/_jsxs(StackView, {
|
|
194
205
|
direction: "row",
|
|
195
206
|
space: 0,
|
|
196
207
|
tokens: {
|
|
@@ -12,6 +12,7 @@ import useCopy from '../utils/useCopy';
|
|
|
12
12
|
import Step from './Step';
|
|
13
13
|
import defaultDictionary from './dictionary';
|
|
14
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
const STYLE_BAR_VARIANT = 'bar';
|
|
15
16
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
16
17
|
const selectContainerStyles = _ref => {
|
|
17
18
|
let {
|
|
@@ -52,6 +53,14 @@ const selectStepTrackerLabelStyles = (_ref3, themeOptions) => {
|
|
|
52
53
|
themeOptions
|
|
53
54
|
});
|
|
54
55
|
};
|
|
56
|
+
const selectStepsContainerStyles = _ref4 => {
|
|
57
|
+
let {
|
|
58
|
+
barGap
|
|
59
|
+
} = _ref4;
|
|
60
|
+
return {
|
|
61
|
+
gap: barGap
|
|
62
|
+
};
|
|
63
|
+
};
|
|
55
64
|
|
|
56
65
|
/**
|
|
57
66
|
* StepTracker component shows the current position in a sequence of steps.
|
|
@@ -85,7 +94,7 @@ const selectStepTrackerLabelStyles = (_ref3, themeOptions) => {
|
|
|
85
94
|
* - `accessibilityValue.text` (`aria-valuetext`): `<Current Step Label>`,
|
|
86
95
|
*
|
|
87
96
|
*/
|
|
88
|
-
const StepTracker = /*#__PURE__*/React.forwardRef((
|
|
97
|
+
const StepTracker = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
|
|
89
98
|
let {
|
|
90
99
|
current = 0,
|
|
91
100
|
copy = 'en',
|
|
@@ -94,7 +103,8 @@ const StepTracker = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
|
|
|
94
103
|
tokens,
|
|
95
104
|
variant,
|
|
96
105
|
...rest
|
|
97
|
-
} =
|
|
106
|
+
} = _ref5;
|
|
107
|
+
const isBarVariant = variant?.style === STYLE_BAR_VARIANT;
|
|
98
108
|
const viewport = useViewport();
|
|
99
109
|
const {
|
|
100
110
|
showStepTrackerLabel,
|
|
@@ -140,7 +150,7 @@ const StepTracker = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
|
|
|
140
150
|
children: /*#__PURE__*/_jsxs(StackView, {
|
|
141
151
|
space: 0,
|
|
142
152
|
children: [/*#__PURE__*/_jsx(View, {
|
|
143
|
-
style: staticStyles.stepsContainer,
|
|
153
|
+
style: [staticStyles.stepsContainer, selectStepsContainerStyles(themeTokens)],
|
|
144
154
|
accessibilityRole: stepsContainerAccessibilityRole,
|
|
145
155
|
children: steps.map((label, index) => {
|
|
146
156
|
return /*#__PURE__*/_jsx(Step, {
|
|
@@ -151,7 +161,8 @@ const StepTracker = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
|
|
|
151
161
|
stepCount: steps.length,
|
|
152
162
|
tokens: themeTokens,
|
|
153
163
|
accessibilityRole: stepAccessibilityRole,
|
|
154
|
-
accessibilityCurrent: current === index && Platform.OS === 'web' && 'step'
|
|
164
|
+
accessibilityCurrent: current === index && Platform.OS === 'web' && 'step',
|
|
165
|
+
isBarVariant: isBarVariant
|
|
155
166
|
}, label);
|
|
156
167
|
})
|
|
157
168
|
}), showStepTrackerLabel && /*#__PURE__*/_jsx(View, {
|
package/lib/esm/TabBar/TabBar.js
CHANGED
|
@@ -84,7 +84,8 @@ const TabBar = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
84
84
|
iconActive: item.iconActive,
|
|
85
85
|
onPress: () => handlePress(item.id),
|
|
86
86
|
id: `tab-item-${index}`,
|
|
87
|
-
accessibilityRole: "tablist"
|
|
87
|
+
accessibilityRole: "tablist",
|
|
88
|
+
tokens: item.tokens
|
|
88
89
|
}, item.id))
|
|
89
90
|
})
|
|
90
91
|
});
|
|
@@ -98,7 +99,8 @@ TabBar.propTypes = {
|
|
|
98
99
|
icon: PropTypes.node,
|
|
99
100
|
iconActive: PropTypes.node,
|
|
100
101
|
label: PropTypes.string.isRequired,
|
|
101
|
-
href: PropTypes.string
|
|
102
|
+
href: PropTypes.string,
|
|
103
|
+
tokens: getTokensPropType('TabBarItem')
|
|
102
104
|
})).isRequired,
|
|
103
105
|
/** Id of the initially selected item. */
|
|
104
106
|
initiallySelectedItem: PropTypes.number,
|
package/lib/esm/TabBar/index.js
CHANGED
package/lib/esm/utils/index.js
CHANGED
|
@@ -24,4 +24,5 @@ export { transformGradient } from './transformGradient';
|
|
|
24
24
|
export { default as convertFromMegaByteToByte } from './convertFromMegaByteToByte';
|
|
25
25
|
export { default as formatImageSource } from './formatImageSource';
|
|
26
26
|
export { default as getSpacingScale } from './getSpacingScale';
|
|
27
|
-
export { default as useVariants } from './useVariants';
|
|
27
|
+
export { default as useVariants } from './useVariants';
|
|
28
|
+
export { default as isTouchDevice } from './isTouchDevice';
|