@telus-uds/components-base 1.15.0 → 1.16.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 +18 -2
- package/component-docs.json +393 -5
- package/lib/Carousel/Carousel.js +18 -2
- package/lib/Carousel/CarouselTabs/CarouselTabs.js +6 -7
- package/lib/Skeleton/Skeleton.js +18 -13
- package/lib/Skeleton/useSkeletonNativeAnimation.js +4 -2
- package/lib/ToggleSwitch/ToggleSwitch.js +24 -19
- package/lib/utils/props/a11yProps.js +50 -47
- package/lib-module/Carousel/Carousel.js +16 -2
- package/lib-module/Carousel/CarouselTabs/CarouselTabs.js +7 -6
- package/lib-module/Skeleton/Skeleton.js +15 -13
- package/lib-module/Skeleton/useSkeletonNativeAnimation.js +3 -2
- package/lib-module/ToggleSwitch/ToggleSwitch.js +24 -19
- package/lib-module/utils/props/a11yProps.js +50 -47
- package/package.json +4 -4
- package/src/Carousel/Carousel.jsx +15 -2
- package/src/Carousel/CarouselTabs/CarouselTabs.jsx +5 -3
- package/src/Skeleton/Skeleton.jsx +25 -19
- package/src/Skeleton/useSkeletonNativeAnimation.js +3 -3
- package/src/ToggleSwitch/ToggleSwitch.jsx +3 -3
- package/src/utils/props/a11yProps.js +61 -68
|
@@ -9,6 +9,8 @@ var _react = require("react");
|
|
|
9
9
|
|
|
10
10
|
var _Animated = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Animated"));
|
|
11
11
|
|
|
12
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
13
|
+
|
|
12
14
|
var _skeleton = require("./skeleton.constant");
|
|
13
15
|
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -19,11 +21,11 @@ const useSkeletonNativeAnimation = () => {
|
|
|
19
21
|
const fade = _Animated.default.sequence([_Animated.default.timing(fadeAnimation, {
|
|
20
22
|
toValue: _skeleton.OPACITY_STOP,
|
|
21
23
|
duration: _skeleton.ANIMATION_DURATION,
|
|
22
|
-
useNativeDriver:
|
|
24
|
+
useNativeDriver: _Platform.default.OS !== 'web'
|
|
23
25
|
}), _Animated.default.timing(fadeAnimation, {
|
|
24
26
|
toValue: _skeleton.DEFAULT_OPACITY,
|
|
25
27
|
duration: _skeleton.ANIMATION_DURATION,
|
|
26
|
-
useNativeDriver:
|
|
28
|
+
useNativeDriver: _Platform.default.OS !== 'web'
|
|
27
29
|
})]);
|
|
28
30
|
|
|
29
31
|
_Animated.default.loop(fade).start();
|
|
@@ -35,32 +35,39 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
35
35
|
|
|
36
36
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
37
|
|
|
38
|
-
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.focusHandlerProps, _utils.pressProps, _utils.viewProps]);
|
|
38
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.focusHandlerProps, _utils.pressProps, _utils.viewProps]); // We need to drop the icon before passing it to the `ButtonBase`, because it's
|
|
39
|
+
// being handled separately in this case
|
|
39
40
|
|
|
40
|
-
const selectButtonTokens =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
const selectButtonTokens = _ref => {
|
|
42
|
+
let {
|
|
43
|
+
icon: _,
|
|
44
|
+
...tokens
|
|
45
|
+
} = _ref;
|
|
46
|
+
return (0, _utils.selectTokens)('Button', { ...tokens,
|
|
47
|
+
// Width tokens are applied to our inner track. Disable Button width token so it wraps our track width.
|
|
48
|
+
width: null
|
|
49
|
+
});
|
|
50
|
+
}; // Map and rename icon-specific tokens to name used within Icon
|
|
44
51
|
|
|
45
52
|
|
|
46
|
-
const selectIconTokens =
|
|
53
|
+
const selectIconTokens = _ref2 => {
|
|
47
54
|
let {
|
|
48
55
|
iconSize,
|
|
49
56
|
iconColor
|
|
50
|
-
} =
|
|
57
|
+
} = _ref2;
|
|
51
58
|
return {
|
|
52
59
|
size: iconSize,
|
|
53
60
|
color: iconColor
|
|
54
61
|
};
|
|
55
62
|
};
|
|
56
63
|
|
|
57
|
-
const selectTrackStyles =
|
|
64
|
+
const selectTrackStyles = _ref3 => {
|
|
58
65
|
let {
|
|
59
66
|
trackBorderWidth,
|
|
60
67
|
trackBorderColor,
|
|
61
68
|
trackBorderRadius,
|
|
62
69
|
width
|
|
63
|
-
} =
|
|
70
|
+
} = _ref3;
|
|
64
71
|
return {
|
|
65
72
|
borderWidth: trackBorderWidth,
|
|
66
73
|
borderColor: trackBorderColor,
|
|
@@ -69,7 +76,7 @@ const selectTrackStyles = _ref2 => {
|
|
|
69
76
|
};
|
|
70
77
|
};
|
|
71
78
|
|
|
72
|
-
const selectSwitchStyles =
|
|
79
|
+
const selectSwitchStyles = _ref4 => {
|
|
73
80
|
let {
|
|
74
81
|
switchSize,
|
|
75
82
|
switchColor,
|
|
@@ -77,7 +84,7 @@ const selectSwitchStyles = _ref3 => {
|
|
|
77
84
|
switchBorderColor,
|
|
78
85
|
switchBorderRadius,
|
|
79
86
|
switchShadow
|
|
80
|
-
} =
|
|
87
|
+
} = _ref4;
|
|
81
88
|
return {
|
|
82
89
|
width: switchSize,
|
|
83
90
|
height: switchSize,
|
|
@@ -95,23 +102,23 @@ const selectSwitchStyles = _ref3 => {
|
|
|
95
102
|
};
|
|
96
103
|
};
|
|
97
104
|
|
|
98
|
-
const selectLabelStyles =
|
|
105
|
+
const selectLabelStyles = _ref5 => {
|
|
99
106
|
let {
|
|
100
107
|
labelMarginLeft
|
|
101
|
-
} =
|
|
108
|
+
} = _ref5;
|
|
102
109
|
return {
|
|
103
110
|
marginLeft: labelMarginLeft
|
|
104
111
|
};
|
|
105
112
|
};
|
|
106
113
|
|
|
107
|
-
const selectLabelTokens =
|
|
114
|
+
const selectLabelTokens = _ref6 => {
|
|
108
115
|
let {
|
|
109
116
|
labelColor,
|
|
110
117
|
labelFontName,
|
|
111
118
|
labelFontSize,
|
|
112
119
|
labelFontWeight,
|
|
113
120
|
labelLineHeight
|
|
114
|
-
} =
|
|
121
|
+
} = _ref6;
|
|
115
122
|
return {
|
|
116
123
|
color: labelColor,
|
|
117
124
|
fontName: labelFontName,
|
|
@@ -121,7 +128,7 @@ const selectLabelTokens = _ref5 => {
|
|
|
121
128
|
};
|
|
122
129
|
};
|
|
123
130
|
|
|
124
|
-
const ToggleSwitch = /*#__PURE__*/(0, _react.forwardRef)((
|
|
131
|
+
const ToggleSwitch = /*#__PURE__*/(0, _react.forwardRef)((_ref7, ref) => {
|
|
125
132
|
let {
|
|
126
133
|
copy = 'en',
|
|
127
134
|
value,
|
|
@@ -136,7 +143,7 @@ const ToggleSwitch = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
|
136
143
|
accessibilityRole = 'switch',
|
|
137
144
|
accessibilityLabel = label,
|
|
138
145
|
...rest
|
|
139
|
-
} =
|
|
146
|
+
} = _ref7;
|
|
140
147
|
const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('ToggleSwitch', tokens, variant);
|
|
141
148
|
const themeTokens = getTokens();
|
|
142
149
|
const {
|
|
@@ -260,8 +267,6 @@ ToggleSwitch.propTypes = { ...selectedSystemPropTypes,
|
|
|
260
267
|
|
|
261
268
|
const staticStyles = _StyleSheet.default.create({
|
|
262
269
|
track: {
|
|
263
|
-
flexGrow: 1,
|
|
264
|
-
alignSelf: 'stretch',
|
|
265
270
|
flexDirection: 'row'
|
|
266
271
|
},
|
|
267
272
|
switch: {
|
|
@@ -48,55 +48,58 @@ const nativeA11yPropTypes = {
|
|
|
48
48
|
onAccessibilityEscape: _propTypes.default.func,
|
|
49
49
|
onAccessibilityTap: _propTypes.default.func
|
|
50
50
|
};
|
|
51
|
+
const a11yPropTypes = { ...nativeA11yPropTypes,
|
|
52
|
+
// React Native Web adds many a11y props that alias aria-* attributes
|
|
53
|
+
// Types based on https://necolas.github.io/react-native-web/docs/accessibility/
|
|
54
|
+
accessibilityActiveDescendant: _propTypes.default.string,
|
|
55
|
+
accessibilityAtomic: _propTypes.default.bool,
|
|
56
|
+
accessibilityAutoComplete: _propTypes.default.string,
|
|
57
|
+
accessibilityBusy: _propTypes.default.bool,
|
|
58
|
+
accessibilityChecked: _propTypes.default.oneOf([true, false, 'mixed']),
|
|
59
|
+
accessibilityColumnCount: _propTypes.default.number,
|
|
60
|
+
accessibilityColumnIndex: _propTypes.default.number,
|
|
61
|
+
accessibilityColumnSpan: _propTypes.default.number,
|
|
62
|
+
accessibilityControls: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
63
|
+
accessibilityCurrent: _propTypes.default.oneOf([true, false, 'page', 'step', 'location', 'date', 'time']),
|
|
64
|
+
accessibilityDescribedBy: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
65
|
+
accessibilityDetails: _propTypes.default.string,
|
|
66
|
+
accessibilityDisabled: _propTypes.default.bool,
|
|
67
|
+
accessibilityErrorMessage: _propTypes.default.string,
|
|
68
|
+
accessibilityExpanded: _propTypes.default.bool,
|
|
69
|
+
accessibilityFlowTo: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
70
|
+
accessibilityHasPopup: _propTypes.default.string,
|
|
71
|
+
accessibilityHidden: _propTypes.default.bool,
|
|
72
|
+
accessibilityInvalid: _propTypes.default.bool,
|
|
73
|
+
accessibilityKeyShortcuts: _propTypes.default.string,
|
|
74
|
+
accessibilityLabelledBy: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
75
|
+
accessibilityLevel: _propTypes.default.number,
|
|
76
|
+
accessibilityModal: _propTypes.default.bool,
|
|
77
|
+
accessibilityMultiline: _propTypes.default.bool,
|
|
78
|
+
accessibilityMultiSelectable: _propTypes.default.bool,
|
|
79
|
+
accessibilityOrientation: _propTypes.default.oneOf(['horizontal', 'vertical']),
|
|
80
|
+
accessibilityOwns: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
81
|
+
accessibilityPlaceholder: _propTypes.default.string,
|
|
82
|
+
accessibilityPosInSet: _propTypes.default.number,
|
|
83
|
+
accessibilityPressed: _propTypes.default.bool,
|
|
84
|
+
accessibilityReadOnly: _propTypes.default.bool,
|
|
85
|
+
accessibilityRequired: _propTypes.default.bool,
|
|
86
|
+
accessibilityRoleDescription: _propTypes.default.string,
|
|
87
|
+
accessibilityRowCount: _propTypes.default.number,
|
|
88
|
+
accessibilityRowIndex: _propTypes.default.number,
|
|
89
|
+
accessibilityRowSpan: _propTypes.default.number,
|
|
90
|
+
accessibilitySelected: _propTypes.default.bool,
|
|
91
|
+
accessibilitySetSize: _propTypes.default.number,
|
|
92
|
+
accessibilitySort: _propTypes.default.oneOf(['ascending', 'descending', 'none', 'other']),
|
|
93
|
+
accessibilityValueMax: _propTypes.default.number,
|
|
94
|
+
accessibilityValueMin: _propTypes.default.number,
|
|
95
|
+
accessibilityValueNow: _propTypes.default.number,
|
|
96
|
+
accessibilityValueText: _propTypes.default.string
|
|
97
|
+
};
|
|
51
98
|
|
|
52
|
-
const
|
|
99
|
+
const a11yPropTypesByPlatform = _Platform.default.select({
|
|
53
100
|
// React Native Web adds many a11y props that alias aria-* attributes
|
|
54
101
|
// Types based on https://necolas.github.io/react-native-web/docs/accessibility/
|
|
55
|
-
web:
|
|
56
|
-
accessibilityActiveDescendant: _propTypes.default.string,
|
|
57
|
-
accessibilityAtomic: _propTypes.default.bool,
|
|
58
|
-
accessibilityAutoComplete: _propTypes.default.string,
|
|
59
|
-
accessibilityBusy: _propTypes.default.bool,
|
|
60
|
-
accessibilityChecked: _propTypes.default.oneOf([true, false, 'mixed']),
|
|
61
|
-
accessibilityColumnCount: _propTypes.default.number,
|
|
62
|
-
accessibilityColumnIndex: _propTypes.default.number,
|
|
63
|
-
accessibilityColumnSpan: _propTypes.default.number,
|
|
64
|
-
accessibilityControls: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
65
|
-
accessibilityCurrent: _propTypes.default.oneOf([true, false, 'page', 'step', 'location', 'date', 'time']),
|
|
66
|
-
accessibilityDescribedBy: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
67
|
-
accessibilityDetails: _propTypes.default.string,
|
|
68
|
-
accessibilityDisabled: _propTypes.default.bool,
|
|
69
|
-
accessibilityErrorMessage: _propTypes.default.string,
|
|
70
|
-
accessibilityExpanded: _propTypes.default.bool,
|
|
71
|
-
accessibilityFlowTo: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
72
|
-
accessibilityHasPopup: _propTypes.default.string,
|
|
73
|
-
accessibilityHidden: _propTypes.default.bool,
|
|
74
|
-
accessibilityInvalid: _propTypes.default.bool,
|
|
75
|
-
accessibilityKeyShortcuts: _propTypes.default.string,
|
|
76
|
-
accessibilityLabelledBy: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
77
|
-
accessibilityLevel: _propTypes.default.number,
|
|
78
|
-
accessibilityModal: _propTypes.default.bool,
|
|
79
|
-
accessibilityMultiline: _propTypes.default.bool,
|
|
80
|
-
accessibilityMultiSelectable: _propTypes.default.bool,
|
|
81
|
-
accessibilityOrientation: _propTypes.default.oneOf(['horizontal', 'vertical']),
|
|
82
|
-
accessibilityOwns: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
83
|
-
accessibilityPlaceholder: _propTypes.default.string,
|
|
84
|
-
accessibilityPosInSet: _propTypes.default.number,
|
|
85
|
-
accessibilityPressed: _propTypes.default.bool,
|
|
86
|
-
accessibilityReadOnly: _propTypes.default.bool,
|
|
87
|
-
accessibilityRequired: _propTypes.default.bool,
|
|
88
|
-
accessibilityRoleDescription: _propTypes.default.string,
|
|
89
|
-
accessibilityRowCount: _propTypes.default.number,
|
|
90
|
-
accessibilityRowIndex: _propTypes.default.number,
|
|
91
|
-
accessibilityRowSpan: _propTypes.default.number,
|
|
92
|
-
accessibilitySelected: _propTypes.default.bool,
|
|
93
|
-
accessibilitySetSize: _propTypes.default.number,
|
|
94
|
-
accessibilitySort: _propTypes.default.oneOf(['ascending', 'descending', 'none', 'other']),
|
|
95
|
-
accessibilityValueMax: _propTypes.default.number,
|
|
96
|
-
accessibilityValueMin: _propTypes.default.number,
|
|
97
|
-
accessibilityValueNow: _propTypes.default.number,
|
|
98
|
-
accessibilityValueText: _propTypes.default.string
|
|
99
|
-
},
|
|
102
|
+
web: a11yPropTypes,
|
|
100
103
|
// Ignore web-only props in native builds
|
|
101
104
|
default: nativeA11yPropTypes
|
|
102
105
|
}); // These RNW-only props only exist in RNW >=0.18. Catch them and map them according to platform
|
|
@@ -269,7 +272,7 @@ var _default = {
|
|
|
269
272
|
* then spread the returned object into the component's props (usually its outer container).
|
|
270
273
|
*/
|
|
271
274
|
select: (0, _getPropSelector.default)( // Allow all React Native accessibility props
|
|
272
|
-
|
|
275
|
+
a11yPropTypesByPlatform, // Allow any `aria-*` attribute on web; ignore them on native
|
|
273
276
|
_Platform.default.OS === 'web' && /^aria-/, // For the props added and deprecated in React Native Web 0.18, convert them to
|
|
274
277
|
// a form that is platform-appropriate and RNW-version safe
|
|
275
278
|
(key, value) => {
|
|
@@ -16,6 +16,8 @@ import SkipLink from '../SkipLink';
|
|
|
16
16
|
import A11yText from '../A11yText';
|
|
17
17
|
import CarouselStepTracker from './CarouselStepTracker';
|
|
18
18
|
import CarouselThumbnailNavigation from './CarouselThumbnailNavigation';
|
|
19
|
+
import CarouselTabsPanel from './CarouselTabs/CarouselTabsPanel';
|
|
20
|
+
import CarouselTabsPanelItem from './CarouselTabs/CarouselTabsPanelItem';
|
|
19
21
|
import dictionary from './dictionary';
|
|
20
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
23
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -138,7 +140,8 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
138
140
|
onAnimationEnd,
|
|
139
141
|
onIndexChanged,
|
|
140
142
|
skipLinkHref,
|
|
141
|
-
|
|
143
|
+
tabs,
|
|
144
|
+
refocus = Boolean(tabs),
|
|
142
145
|
title = 'carousel',
|
|
143
146
|
springConfig = undefined,
|
|
144
147
|
thumbnails = undefined,
|
|
@@ -161,6 +164,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
161
164
|
nextIcon,
|
|
162
165
|
showPreviousNextNavigation,
|
|
163
166
|
showPanelNavigation,
|
|
167
|
+
showPanelTabs,
|
|
164
168
|
spaceBetweenSlideAndPreviousNextNavigation
|
|
165
169
|
} = themeTokens;
|
|
166
170
|
const [activeIndex, setActiveIndex] = React.useState(0);
|
|
@@ -389,6 +393,9 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
389
393
|
|
|
390
394
|
return "".concat(copyText[0].toUpperCase()).concat(copyText.slice(1));
|
|
391
395
|
}, [activeIndex, childrenArray.length, itemLabel, getCopy, title]);
|
|
396
|
+
const activePanelNavigation = tabs && showPanelTabs ? /*#__PURE__*/_jsx(CarouselTabsPanel, {
|
|
397
|
+
items: tabs
|
|
398
|
+
}) : panelNavigation;
|
|
392
399
|
return /*#__PURE__*/_jsxs(CarouselProvider, {
|
|
393
400
|
activeIndex: activeIndex,
|
|
394
401
|
goTo: goTo,
|
|
@@ -462,7 +469,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
462
469
|
accessibilityLabel: getCopyWithPlaceholders('iconButtonLabel').replace('%{targetStep}', activeIndex + 2)
|
|
463
470
|
})
|
|
464
471
|
})]
|
|
465
|
-
}), showPanelNavigation ?
|
|
472
|
+
}), showPanelNavigation ? activePanelNavigation : null]
|
|
466
473
|
});
|
|
467
474
|
});
|
|
468
475
|
Carousel.propTypes = { ...selectedSystemPropTypes,
|
|
@@ -543,6 +550,13 @@ Carousel.propTypes = { ...selectedSystemPropTypes,
|
|
|
543
550
|
*/
|
|
544
551
|
skipLinkHref: PropTypes.string,
|
|
545
552
|
|
|
553
|
+
/**
|
|
554
|
+
* If provided, defaults the navigation panel to a CarouselTabsPanel element passing each item as props for one tab.
|
|
555
|
+
*
|
|
556
|
+
* Be careful to ensure that the order of each element in the items array matches the order of each child in the Carousel.
|
|
557
|
+
*/
|
|
558
|
+
tabs: PropTypes.arrayOf(PropTypes.shape(CarouselTabsPanelItem.propTypes || {})),
|
|
559
|
+
|
|
546
560
|
/**
|
|
547
561
|
* If true, whenever a new slide comes into view, the focus of the Carousel switches to the start.
|
|
548
562
|
*
|
|
@@ -4,7 +4,10 @@ import React, { forwardRef } from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { useResponsiveProp } from '../../utils';
|
|
6
6
|
import Carousel from '../Carousel';
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Please use Carousel and pass the `tabs` prop.
|
|
9
|
+
*/
|
|
10
|
+
|
|
8
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
12
|
const CarouselTabs = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
10
13
|
let {
|
|
@@ -12,16 +15,14 @@ const CarouselTabs = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
12
15
|
refocus = true,
|
|
13
16
|
...carouselProps
|
|
14
17
|
} = _ref;
|
|
15
|
-
const
|
|
16
|
-
md:
|
|
17
|
-
items: items
|
|
18
|
-
})
|
|
18
|
+
const tabs = useResponsiveProp({
|
|
19
|
+
md: items
|
|
19
20
|
});
|
|
20
21
|
return /*#__PURE__*/_jsx(Carousel, {
|
|
21
22
|
refocus: refocus,
|
|
22
23
|
...carouselProps,
|
|
23
24
|
ref: ref,
|
|
24
|
-
|
|
25
|
+
tabs: tabs,
|
|
25
26
|
children: items.map(_ref2 => {
|
|
26
27
|
let {
|
|
27
28
|
title,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import Animated from "react-native-web/dist/exports/Animated";
|
|
3
3
|
import Platform from "react-native-web/dist/exports/Platform";
|
|
4
|
+
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
5
|
+
import View from "react-native-web/dist/exports/View";
|
|
4
6
|
import propTypes from 'prop-types';
|
|
5
7
|
import StackView from '../StackView';
|
|
6
8
|
import { useThemeTokens } from '../ThemeProvider';
|
|
@@ -13,14 +15,12 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
|
|
|
13
15
|
const selectSkeletonStyles = _ref => {
|
|
14
16
|
let {
|
|
15
17
|
color,
|
|
16
|
-
radius
|
|
17
|
-
fadeAnimation
|
|
18
|
+
radius
|
|
18
19
|
} = _ref;
|
|
19
20
|
return {
|
|
20
21
|
backgroundColor: color,
|
|
21
22
|
borderRadius: radius,
|
|
22
|
-
maxWidth: '100%'
|
|
23
|
-
...fadeAnimation
|
|
23
|
+
maxWidth: '100%'
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
|
|
@@ -78,12 +78,14 @@ const Skeleton = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
|
78
78
|
const skeletonHeight = useSpacingScale(spacingScaleValue);
|
|
79
79
|
const nativeAnimation = useSkeletonNativeAnimation();
|
|
80
80
|
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
81
|
+
const getAnimationBasedOnPlatform = () => {
|
|
82
|
+
const animation = Platform.OS === 'web' ? skeletonWebAnimation : nativeAnimation; // We must pass the animation styles through `StyleSheet.create`
|
|
83
|
+
// @see https://github.com/necolas/react-native-web/issues/2387
|
|
85
84
|
|
|
86
|
-
|
|
85
|
+
const styles = StyleSheet.create({
|
|
86
|
+
animation
|
|
87
|
+
});
|
|
88
|
+
return styles.animation;
|
|
87
89
|
};
|
|
88
90
|
|
|
89
91
|
const getLineWidth = () => {
|
|
@@ -117,11 +119,11 @@ const Skeleton = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
|
117
119
|
|
|
118
120
|
const renderSkeleton = function () {
|
|
119
121
|
let index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
120
|
-
|
|
122
|
+
// @see https://github.com/necolas/react-native-web/issues/2387
|
|
123
|
+
const Component = Platform.OS === 'web' ? View : Animated.View;
|
|
124
|
+
return /*#__PURE__*/_jsx(Component, {
|
|
121
125
|
testID: "skeleton",
|
|
122
|
-
style: [selectSkeletonStyles(
|
|
123
|
-
fadeAnimation: getAnimationBaseOnPlatform()
|
|
124
|
-
}), getStyledBasedOnShape()]
|
|
126
|
+
style: [selectSkeletonStyles(themeTokens), getAnimationBasedOnPlatform(), getStyledBasedOnShape()]
|
|
125
127
|
}, "skeleton-".concat(index + 1));
|
|
126
128
|
};
|
|
127
129
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
2
|
import Animated from "react-native-web/dist/exports/Animated";
|
|
3
|
+
import Platform from "react-native-web/dist/exports/Platform";
|
|
3
4
|
import { ANIMATION_DURATION, DEFAULT_OPACITY, OPACITY_STOP } from './skeleton.constant';
|
|
4
5
|
|
|
5
6
|
const useSkeletonNativeAnimation = () => {
|
|
@@ -8,11 +9,11 @@ const useSkeletonNativeAnimation = () => {
|
|
|
8
9
|
const fade = Animated.sequence([Animated.timing(fadeAnimation, {
|
|
9
10
|
toValue: OPACITY_STOP,
|
|
10
11
|
duration: ANIMATION_DURATION,
|
|
11
|
-
useNativeDriver:
|
|
12
|
+
useNativeDriver: Platform.OS !== 'web'
|
|
12
13
|
}), Animated.timing(fadeAnimation, {
|
|
13
14
|
toValue: DEFAULT_OPACITY,
|
|
14
15
|
duration: ANIMATION_DURATION,
|
|
15
|
-
useNativeDriver:
|
|
16
|
+
useNativeDriver: Platform.OS !== 'web'
|
|
16
17
|
})]);
|
|
17
18
|
Animated.loop(fade).start();
|
|
18
19
|
}, [fadeAnimation]);
|
|
@@ -11,32 +11,39 @@ import { a11yProps, focusHandlerProps, getTokensPropType, selectTokens, pressPro
|
|
|
11
11
|
import { useInputValue } from '../utils/input';
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, pressProps, viewProps]);
|
|
14
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, pressProps, viewProps]); // We need to drop the icon before passing it to the `ButtonBase`, because it's
|
|
15
|
+
// being handled separately in this case
|
|
15
16
|
|
|
16
|
-
const selectButtonTokens =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const selectButtonTokens = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
icon: _,
|
|
20
|
+
...tokens
|
|
21
|
+
} = _ref;
|
|
22
|
+
return selectTokens('Button', { ...tokens,
|
|
23
|
+
// Width tokens are applied to our inner track. Disable Button width token so it wraps our track width.
|
|
24
|
+
width: null
|
|
25
|
+
});
|
|
26
|
+
}; // Map and rename icon-specific tokens to name used within Icon
|
|
20
27
|
|
|
21
28
|
|
|
22
|
-
const selectIconTokens =
|
|
29
|
+
const selectIconTokens = _ref2 => {
|
|
23
30
|
let {
|
|
24
31
|
iconSize,
|
|
25
32
|
iconColor
|
|
26
|
-
} =
|
|
33
|
+
} = _ref2;
|
|
27
34
|
return {
|
|
28
35
|
size: iconSize,
|
|
29
36
|
color: iconColor
|
|
30
37
|
};
|
|
31
38
|
};
|
|
32
39
|
|
|
33
|
-
const selectTrackStyles =
|
|
40
|
+
const selectTrackStyles = _ref3 => {
|
|
34
41
|
let {
|
|
35
42
|
trackBorderWidth,
|
|
36
43
|
trackBorderColor,
|
|
37
44
|
trackBorderRadius,
|
|
38
45
|
width
|
|
39
|
-
} =
|
|
46
|
+
} = _ref3;
|
|
40
47
|
return {
|
|
41
48
|
borderWidth: trackBorderWidth,
|
|
42
49
|
borderColor: trackBorderColor,
|
|
@@ -45,7 +52,7 @@ const selectTrackStyles = _ref2 => {
|
|
|
45
52
|
};
|
|
46
53
|
};
|
|
47
54
|
|
|
48
|
-
const selectSwitchStyles =
|
|
55
|
+
const selectSwitchStyles = _ref4 => {
|
|
49
56
|
let {
|
|
50
57
|
switchSize,
|
|
51
58
|
switchColor,
|
|
@@ -53,7 +60,7 @@ const selectSwitchStyles = _ref3 => {
|
|
|
53
60
|
switchBorderColor,
|
|
54
61
|
switchBorderRadius,
|
|
55
62
|
switchShadow
|
|
56
|
-
} =
|
|
63
|
+
} = _ref4;
|
|
57
64
|
return {
|
|
58
65
|
width: switchSize,
|
|
59
66
|
height: switchSize,
|
|
@@ -71,23 +78,23 @@ const selectSwitchStyles = _ref3 => {
|
|
|
71
78
|
};
|
|
72
79
|
};
|
|
73
80
|
|
|
74
|
-
const selectLabelStyles =
|
|
81
|
+
const selectLabelStyles = _ref5 => {
|
|
75
82
|
let {
|
|
76
83
|
labelMarginLeft
|
|
77
|
-
} =
|
|
84
|
+
} = _ref5;
|
|
78
85
|
return {
|
|
79
86
|
marginLeft: labelMarginLeft
|
|
80
87
|
};
|
|
81
88
|
};
|
|
82
89
|
|
|
83
|
-
const selectLabelTokens =
|
|
90
|
+
const selectLabelTokens = _ref6 => {
|
|
84
91
|
let {
|
|
85
92
|
labelColor,
|
|
86
93
|
labelFontName,
|
|
87
94
|
labelFontSize,
|
|
88
95
|
labelFontWeight,
|
|
89
96
|
labelLineHeight
|
|
90
|
-
} =
|
|
97
|
+
} = _ref6;
|
|
91
98
|
return {
|
|
92
99
|
color: labelColor,
|
|
93
100
|
fontName: labelFontName,
|
|
@@ -97,7 +104,7 @@ const selectLabelTokens = _ref5 => {
|
|
|
97
104
|
};
|
|
98
105
|
};
|
|
99
106
|
|
|
100
|
-
const ToggleSwitch = /*#__PURE__*/forwardRef((
|
|
107
|
+
const ToggleSwitch = /*#__PURE__*/forwardRef((_ref7, ref) => {
|
|
101
108
|
let {
|
|
102
109
|
copy = 'en',
|
|
103
110
|
value,
|
|
@@ -112,7 +119,7 @@ const ToggleSwitch = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
112
119
|
accessibilityRole = 'switch',
|
|
113
120
|
accessibilityLabel = label,
|
|
114
121
|
...rest
|
|
115
|
-
} =
|
|
122
|
+
} = _ref7;
|
|
116
123
|
const getTokens = useThemeTokensCallback('ToggleSwitch', tokens, variant);
|
|
117
124
|
const themeTokens = getTokens();
|
|
118
125
|
const {
|
|
@@ -235,8 +242,6 @@ ToggleSwitch.propTypes = { ...selectedSystemPropTypes,
|
|
|
235
242
|
};
|
|
236
243
|
const staticStyles = StyleSheet.create({
|
|
237
244
|
track: {
|
|
238
|
-
flexGrow: 1,
|
|
239
|
-
alignSelf: 'stretch',
|
|
240
245
|
flexDirection: 'row'
|
|
241
246
|
},
|
|
242
247
|
switch: {
|