@telus-uds/components-base 3.29.0 → 3.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -1
- package/jest.config.cjs +1 -0
- package/lib/cjs/ActionCard/ActionCard.js +4 -4
- package/lib/cjs/ActivityIndicator/Dots.native.js +1 -2
- package/lib/cjs/ActivityIndicator/Spinner.native.js +1 -2
- package/lib/cjs/Box/Box.js +1 -2
- package/lib/cjs/Button/Button.js +1 -2
- package/lib/cjs/Button/ButtonBase.js +8 -8
- package/lib/cjs/Button/ButtonDropdown.js +1 -2
- package/lib/cjs/Button/ButtonGroup.js +1 -2
- package/lib/cjs/Button/ButtonLink.js +1 -2
- package/lib/cjs/Card/Card.js +1 -2
- package/lib/cjs/Card/PressableCardBase.js +1 -2
- package/lib/cjs/Card/index.js +1 -2
- package/lib/cjs/CardGroup/CardGroup.js +1 -2
- package/lib/cjs/Carousel/Carousel.js +6 -6
- package/lib/cjs/CheckboxCard/CheckboxCard.js +1 -2
- package/lib/cjs/CheckboxCardGroup/CheckboxCardGroup.js +1 -2
- package/lib/cjs/HorizontalScroll/index.js +1 -2
- package/lib/cjs/Icon/IconText.js +1 -2
- package/lib/cjs/Icon/index.js +1 -2
- package/lib/cjs/InputSupports/InputSupports.js +1 -2
- package/lib/cjs/InputSupports/useInputSupports.js +1 -3
- package/lib/cjs/Link/MobileIconTextContent.js +1 -2
- package/lib/cjs/Listbox/Listbox.js +1 -2
- package/lib/cjs/Modal/Modal.js +1 -1
- package/lib/cjs/Pagination/PageButton.js +1 -2
- package/lib/cjs/Pagination/Pagination.js +1 -2
- package/lib/cjs/QuickLinks/QuickLinks.js +7 -0
- package/lib/cjs/Radio/Radio.js +1 -2
- package/lib/cjs/RadioCard/RadioCard.js +1 -2
- package/lib/cjs/RadioCard/RadioCardGroup.js +1 -2
- package/lib/cjs/Shortcuts/Shortcuts.js +1 -2
- package/lib/cjs/SideNav/SideNav.js +1 -2
- package/lib/cjs/StackView/StackWrapBox.js +9 -1
- package/lib/cjs/StackView/StackWrapGap.js +3 -1
- package/lib/cjs/StackView/getStackedContent.js +21 -12
- package/lib/cjs/Tabs/Tabs.js +1 -2
- package/lib/cjs/Tooltip/Tooltip.native.js +2 -2
- package/lib/cjs/index.js +1 -2
- package/lib/cjs/utils/index.js +1 -2
- package/lib/esm/ActionCard/ActionCard.js +4 -4
- package/lib/esm/Button/ButtonBase.js +8 -8
- package/lib/esm/Carousel/Carousel.js +6 -6
- package/lib/esm/InputSupports/InputSupports.js +1 -2
- package/lib/esm/InputSupports/useInputSupports.js +1 -3
- package/lib/esm/Modal/Modal.js +1 -1
- package/lib/esm/QuickLinks/QuickLinks.js +7 -0
- package/lib/esm/StackView/StackWrapBox.js +9 -1
- package/lib/esm/StackView/StackWrapGap.js +3 -1
- package/lib/esm/StackView/getStackedContent.js +20 -10
- package/lib/esm/Tooltip/Tooltip.native.js +2 -2
- package/lib/package.json +1 -1
- package/package.json +1 -1
- package/src/InputSupports/InputSupports.jsx +1 -6
- package/src/InputSupports/useInputSupports.js +1 -1
- package/src/Modal/Modal.jsx +1 -1
- package/src/QuickLinks/QuickLinks.jsx +8 -0
- package/src/StackView/StackWrapBox.jsx +13 -1
- package/src/StackView/StackWrapGap.jsx +2 -1
- package/src/StackView/getStackedContent.jsx +22 -8
|
@@ -50,6 +50,7 @@ const StackWrapBox = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
50
50
|
variant,
|
|
51
51
|
tag,
|
|
52
52
|
accessibilityRole,
|
|
53
|
+
itemAccessibilityRole,
|
|
53
54
|
...rest
|
|
54
55
|
} = _ref;
|
|
55
56
|
const viewport = (0, _ViewportProvider.useViewport)();
|
|
@@ -76,7 +77,8 @@ const StackWrapBox = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
76
77
|
const content = (0, _getStackedContent.default)(children, {
|
|
77
78
|
direction,
|
|
78
79
|
space: 0,
|
|
79
|
-
box: boxProps
|
|
80
|
+
box: boxProps,
|
|
81
|
+
itemAccessibilityRole
|
|
80
82
|
});
|
|
81
83
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
82
84
|
ref: ref,
|
|
@@ -112,6 +114,12 @@ StackWrapBox.propTypes = {
|
|
|
112
114
|
* is not defined, the accessibilityRole will default to "heading".
|
|
113
115
|
*/
|
|
114
116
|
tag: _propTypes.default.oneOf(_utils.layoutTags),
|
|
117
|
+
/**
|
|
118
|
+
* Optional accessibility role to apply to each item in the stack.
|
|
119
|
+
* On web, items are wrapped (or cloned) with this role, enabling correct list semantics
|
|
120
|
+
* when the container tag is "ul" or "ol".
|
|
121
|
+
*/
|
|
122
|
+
itemAccessibilityRole: _propTypes.default.string,
|
|
115
123
|
/**
|
|
116
124
|
* A StackWrap may take any children, but will have no effect if it is only passed one child or is passed children
|
|
117
125
|
* wrapped in a component. If necessary, children may be wrapped in one React Fragment.
|
|
@@ -35,6 +35,7 @@ const StackWrapGap = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
35
35
|
children,
|
|
36
36
|
tag,
|
|
37
37
|
accessibilityRole,
|
|
38
|
+
itemAccessibilityRole,
|
|
38
39
|
...rest
|
|
39
40
|
} = _ref;
|
|
40
41
|
const viewport = (0, _ViewportProvider.useViewport)();
|
|
@@ -54,7 +55,8 @@ const StackWrapGap = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
54
55
|
};
|
|
55
56
|
const content = (0, _getStackedContent.default)(children, {
|
|
56
57
|
direction,
|
|
57
|
-
space: 0
|
|
58
|
+
space: 0,
|
|
59
|
+
itemAccessibilityRole
|
|
58
60
|
});
|
|
59
61
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
60
62
|
ref: ref,
|
|
@@ -10,8 +10,7 @@ var _Divider = _interopRequireDefault(require("../Divider"));
|
|
|
10
10
|
var _Spacer = _interopRequireDefault(require("../Spacer"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
function
|
|
14
|
-
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; }
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
14
|
/**
|
|
16
15
|
* @typedef {import('react').ReactChildren} ReactChildren
|
|
17
16
|
* @typedef {import('react').ReactElement} ReactElement
|
|
@@ -43,7 +42,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
43
42
|
space,
|
|
44
43
|
direction = 'column',
|
|
45
44
|
box,
|
|
46
|
-
preserveFragments = false
|
|
45
|
+
preserveFragments = false,
|
|
46
|
+
itemAccessibilityRole
|
|
47
47
|
} = _ref;
|
|
48
48
|
const boxProps = box && typeof box === 'object' ? box : {
|
|
49
49
|
space
|
|
@@ -55,15 +55,24 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
55
55
|
const validChildren = _react.default.Children.toArray(topLevelChildren).filter(Boolean);
|
|
56
56
|
const content = validChildren.reduce((newChildren, child, index) => {
|
|
57
57
|
const boxID = `Stack-Box-${index}`;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
let item;
|
|
59
|
+
if (box) {
|
|
60
|
+
// If wrapped in Box, that Box needs a key.
|
|
61
|
+
// If possible, use an existing content key; use an index-based key only if necessary.
|
|
62
|
+
item = /*#__PURE__*/(0, _react.createElement)(_Box.default, {
|
|
63
|
+
...boxProps,
|
|
64
|
+
accessibilityRole: itemAccessibilityRole,
|
|
65
|
+
key: child.key || boxID,
|
|
66
|
+
testID: boxID
|
|
67
|
+
}, child);
|
|
68
|
+
} else if (itemAccessibilityRole) {
|
|
69
|
+
item = /*#__PURE__*/_react.default.cloneElement(child, {
|
|
70
|
+
accessibilityRole: itemAccessibilityRole,
|
|
71
|
+
key: child.key || boxID
|
|
72
|
+
});
|
|
73
|
+
} else {
|
|
74
|
+
item = child;
|
|
75
|
+
}
|
|
67
76
|
if (!index || !space && !divider) return [...newChildren, item];
|
|
68
77
|
const testID = `Stack-${divider ? 'Divider' : 'Spacer'}-${index}`;
|
|
69
78
|
const commonProps = {
|
package/lib/cjs/Tabs/Tabs.js
CHANGED
|
@@ -15,8 +15,7 @@ var _HorizontalScroll = _interopRequireWildcard(require("../HorizontalScroll"));
|
|
|
15
15
|
var _TabsItem = _interopRequireDefault(require("./TabsItem"));
|
|
16
16
|
var _TabsDropdown = _interopRequireDefault(require("./TabsDropdown"));
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
function
|
|
19
|
-
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; }
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
20
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
20
|
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
|
|
22
21
|
const [selectItemProps, selectedItemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.focusHandlerProps, _utils.pressProps, _utils.viewProps]);
|
|
@@ -213,7 +213,7 @@ const Tooltip = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
|
|
|
213
213
|
focus: focused
|
|
214
214
|
};
|
|
215
215
|
};
|
|
216
|
-
const onTooltipLayout =
|
|
216
|
+
const onTooltipLayout = _ref0 => {
|
|
217
217
|
let {
|
|
218
218
|
nativeEvent: {
|
|
219
219
|
layout: {
|
|
@@ -221,7 +221,7 @@ const Tooltip = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
|
|
|
221
221
|
height
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
} =
|
|
224
|
+
} = _ref0;
|
|
225
225
|
if (tooltipDimensions === null || tooltipDimensions.width !== width || tooltipDimensions.height !== height) {
|
|
226
226
|
setTooltipDimensions({
|
|
227
227
|
width: _Platform.default.select({
|
package/lib/cjs/index.js
CHANGED
|
@@ -816,6 +816,5 @@ Object.keys(_utils).forEach(function (key) {
|
|
|
816
816
|
});
|
|
817
817
|
});
|
|
818
818
|
var _Portal = _interopRequireDefault(require("./Portal"));
|
|
819
|
-
function
|
|
820
|
-
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; }
|
|
819
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
821
820
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
package/lib/cjs/utils/index.js
CHANGED
|
@@ -280,6 +280,5 @@ var _getSpacingScale = _interopRequireDefault(require("./getSpacingScale"));
|
|
|
280
280
|
var _useVariants = _interopRequireDefault(require("./useVariants"));
|
|
281
281
|
var _isTouchDevice = _interopRequireDefault(require("./isTouchDevice"));
|
|
282
282
|
var _resolveContentMaxWidth = _interopRequireDefault(require("./resolveContentMaxWidth"));
|
|
283
|
-
function
|
|
284
|
-
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; }
|
|
283
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
285
284
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -153,11 +153,11 @@ const selectActionIconStyles = _ref9 => {
|
|
|
153
153
|
marginTop: actionIconMarginTop
|
|
154
154
|
};
|
|
155
155
|
};
|
|
156
|
-
const selectActionIconProps =
|
|
156
|
+
const selectActionIconProps = _ref0 => {
|
|
157
157
|
let {
|
|
158
158
|
actionIcon,
|
|
159
159
|
actionIconColor
|
|
160
|
-
} =
|
|
160
|
+
} = _ref0;
|
|
161
161
|
return {
|
|
162
162
|
icon: actionIcon,
|
|
163
163
|
tokens: {
|
|
@@ -186,7 +186,7 @@ const ACTION_ICON_ANIMATION_DURATION = 100;
|
|
|
186
186
|
* </ActionCard>
|
|
187
187
|
* )
|
|
188
188
|
*/
|
|
189
|
-
const ActionCard = /*#__PURE__*/React.forwardRef((
|
|
189
|
+
const ActionCard = /*#__PURE__*/React.forwardRef((_ref1, ref) => {
|
|
190
190
|
let {
|
|
191
191
|
icon,
|
|
192
192
|
title,
|
|
@@ -197,7 +197,7 @@ const ActionCard = /*#__PURE__*/React.forwardRef((_ref11, ref) => {
|
|
|
197
197
|
tokens,
|
|
198
198
|
variant,
|
|
199
199
|
...rest
|
|
200
|
-
} =
|
|
200
|
+
} = _ref1;
|
|
201
201
|
const themeTokens = useThemeTokens('ActionCard', tokens, variant);
|
|
202
202
|
const actionIconAnimation = React.useRef(new Animated.Value(0)).current;
|
|
203
203
|
const {
|
|
@@ -218,27 +218,27 @@ const selectWebOnlyStyles = (inactive, themeTokens, _ref9) => {
|
|
|
218
218
|
default: {}
|
|
219
219
|
});
|
|
220
220
|
};
|
|
221
|
-
const selectButtonStyles =
|
|
221
|
+
const selectButtonStyles = _ref0 => {
|
|
222
222
|
let {
|
|
223
223
|
textAlign
|
|
224
|
-
} =
|
|
224
|
+
} = _ref0;
|
|
225
225
|
return {
|
|
226
226
|
flexDirection: 'row',
|
|
227
227
|
justifyContent: textAlign
|
|
228
228
|
};
|
|
229
229
|
};
|
|
230
|
-
const selectItemIconTokens =
|
|
230
|
+
const selectItemIconTokens = _ref1 => {
|
|
231
231
|
let {
|
|
232
232
|
color,
|
|
233
233
|
iconColor,
|
|
234
234
|
iconSize
|
|
235
|
-
} =
|
|
235
|
+
} = _ref1;
|
|
236
236
|
return {
|
|
237
237
|
size: iconSize,
|
|
238
238
|
color: iconColor || color
|
|
239
239
|
};
|
|
240
240
|
};
|
|
241
|
-
const ButtonBase = /*#__PURE__*/React.forwardRef((
|
|
241
|
+
const ButtonBase = /*#__PURE__*/React.forwardRef((_ref10, ref) => {
|
|
242
242
|
let {
|
|
243
243
|
id,
|
|
244
244
|
href,
|
|
@@ -254,7 +254,7 @@ const ButtonBase = /*#__PURE__*/React.forwardRef((_ref12, ref) => {
|
|
|
254
254
|
iconProps,
|
|
255
255
|
heightFull = true,
|
|
256
256
|
...rawRest
|
|
257
|
-
} =
|
|
257
|
+
} = _ref10;
|
|
258
258
|
const {
|
|
259
259
|
themeOptions
|
|
260
260
|
} = useTheme();
|
|
@@ -282,8 +282,8 @@ const ButtonBase = /*#__PURE__*/React.forwardRef((_ref12, ref) => {
|
|
|
282
282
|
focused: false
|
|
283
283
|
};
|
|
284
284
|
const defaultTokensByViewport = resolveButtonTokens(defaultPressableState);
|
|
285
|
-
const layoutTokensByViewport = Object.entries(defaultTokensByViewport).reduce((acc,
|
|
286
|
-
let [vp, viewportTokens] =
|
|
285
|
+
const layoutTokensByViewport = Object.entries(defaultTokensByViewport).reduce((acc, _ref11) => {
|
|
286
|
+
let [vp, viewportTokens] = _ref11;
|
|
287
287
|
const flexAndWidthStyles = viewportTokens.width === '100%' && viewportTokens.flex === 1 ? selectFlexAndWidthStyles(viewportTokens) : {};
|
|
288
288
|
acc[vp] = {
|
|
289
289
|
...staticStyles.row,
|
|
@@ -761,7 +761,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
761
761
|
height
|
|
762
762
|
}));
|
|
763
763
|
};
|
|
764
|
-
const onHeroContainerLayout =
|
|
764
|
+
const onHeroContainerLayout = _ref0 => {
|
|
765
765
|
let {
|
|
766
766
|
nativeEvent: {
|
|
767
767
|
layout: {
|
|
@@ -771,7 +771,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
771
771
|
height
|
|
772
772
|
}
|
|
773
773
|
}
|
|
774
|
-
} =
|
|
774
|
+
} = _ref0;
|
|
775
775
|
return setHeroContainerLayout(prevState => ({
|
|
776
776
|
...prevState,
|
|
777
777
|
x,
|
|
@@ -780,17 +780,17 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
780
780
|
height
|
|
781
781
|
}));
|
|
782
782
|
};
|
|
783
|
-
const onPreviousNextNavigationButtonLayout =
|
|
783
|
+
const onPreviousNextNavigationButtonLayout = _ref1 => {
|
|
784
784
|
let {
|
|
785
785
|
nativeEvent: {
|
|
786
786
|
layout: {
|
|
787
787
|
width
|
|
788
788
|
}
|
|
789
789
|
}
|
|
790
|
-
} =
|
|
790
|
+
} = _ref1;
|
|
791
791
|
return setPreviousNextNavigationButtonWidth(width);
|
|
792
792
|
};
|
|
793
|
-
const onRootContainerLayout =
|
|
793
|
+
const onRootContainerLayout = _ref10 => {
|
|
794
794
|
let {
|
|
795
795
|
nativeEvent: {
|
|
796
796
|
layout: {
|
|
@@ -800,7 +800,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
800
800
|
height
|
|
801
801
|
}
|
|
802
802
|
}
|
|
803
|
-
} =
|
|
803
|
+
} = _ref10;
|
|
804
804
|
return setRootContainerLayout(prevState => ({
|
|
805
805
|
...prevState,
|
|
806
806
|
x,
|
|
@@ -65,8 +65,7 @@ const InputSupports = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
65
65
|
}), typeof children === 'function' ? children({
|
|
66
66
|
inputId,
|
|
67
67
|
...a11yProps,
|
|
68
|
-
validation: feedbackValidation
|
|
69
|
-
accessibilityDescribedBy: feedbackId
|
|
68
|
+
validation: feedbackValidation
|
|
70
69
|
}) : children, feedback || maxCharsReachedErrorMessage ? /*#__PURE__*/_jsx(Feedback, {
|
|
71
70
|
id: feedbackId,
|
|
72
71
|
title: feedback || maxCharsReachedErrorMessage,
|
|
@@ -25,9 +25,7 @@ const useInputSupports = _ref => {
|
|
|
25
25
|
accessibilityLabel: label,
|
|
26
26
|
accessibilityHint: joinDefined([!hasValidationError && feedback, hint, maxCharacterAllowed ? getCopy('maxCharacters').replace(/%\{charCount\}/g, maxCharacterAllowed) : undefined]),
|
|
27
27
|
// native only -> replaced with describedBy on web
|
|
28
|
-
accessibilityDescribedBy: joinDefined([
|
|
29
|
-
// feedback receives a11yRole=alert on error, so there's no need to include it here
|
|
30
|
-
hint && hintId, charactersCount ? getCopy('charactersRemaining').replace(/%\{charCount\}/g, charactersCount) : undefined]),
|
|
28
|
+
accessibilityDescribedBy: joinDefined([hint && hintId, feedback && feedbackId || undefined, charactersCount ? getCopy('charactersRemaining').replace(/%\{charCount\}/g, charactersCount) : undefined]),
|
|
31
29
|
accessibilityInvalid: hasValidationError
|
|
32
30
|
};
|
|
33
31
|
return {
|
package/lib/esm/Modal/Modal.js
CHANGED
|
@@ -239,7 +239,7 @@ const Modal = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
|
|
|
239
239
|
})]
|
|
240
240
|
})
|
|
241
241
|
}), /*#__PURE__*/_jsx(TouchableWithoutFeedback, {
|
|
242
|
-
onPress: isBackdropClickable
|
|
242
|
+
onPress: isBackdropClickable ? handleClose : undefined,
|
|
243
243
|
children: /*#__PURE__*/_jsx(View, {
|
|
244
244
|
style: [staticStyles.backdrop, selectBackdropStyles(themeTokens)]
|
|
245
245
|
})
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import Platform from "react-native-web/dist/exports/Platform";
|
|
3
4
|
import { useThemeTokens } from '../ThemeProvider';
|
|
4
5
|
import { useViewport } from '../ViewportProvider';
|
|
5
6
|
import { getTokensPropType, variantProp } from '../utils';
|
|
7
|
+
import { tagsToRoles } from '../utils/a11y/semantics';
|
|
6
8
|
import List from '../List';
|
|
7
9
|
import StackWrap from '../StackView/StackWrap';
|
|
8
10
|
import QuickLinksCard from './QuickLinksCard';
|
|
@@ -35,6 +37,10 @@ const QuickLinks = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
35
37
|
} = useThemeTokens('QuickLinks', tokens, variant, {
|
|
36
38
|
viewport
|
|
37
39
|
});
|
|
40
|
+
const itemAccessibilityRole = Platform.select({
|
|
41
|
+
web: ['ul', 'ol'].includes(tag) ? tagsToRoles.li : undefined,
|
|
42
|
+
default: undefined
|
|
43
|
+
});
|
|
38
44
|
const content = list && /*#__PURE__*/_jsx(List, {
|
|
39
45
|
ref: ref,
|
|
40
46
|
tokens: listTokens,
|
|
@@ -49,6 +55,7 @@ const QuickLinks = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
49
55
|
justifyContent: stackJustify
|
|
50
56
|
},
|
|
51
57
|
tag: tag,
|
|
58
|
+
itemAccessibilityRole: itemAccessibilityRole,
|
|
52
59
|
...rest,
|
|
53
60
|
children: children
|
|
54
61
|
});
|
|
@@ -43,6 +43,7 @@ const StackWrapBox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
43
43
|
variant,
|
|
44
44
|
tag,
|
|
45
45
|
accessibilityRole,
|
|
46
|
+
itemAccessibilityRole,
|
|
46
47
|
...rest
|
|
47
48
|
} = _ref;
|
|
48
49
|
const viewport = useViewport();
|
|
@@ -69,7 +70,8 @@ const StackWrapBox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
69
70
|
const content = getStackedContent(children, {
|
|
70
71
|
direction,
|
|
71
72
|
space: 0,
|
|
72
|
-
box: boxProps
|
|
73
|
+
box: boxProps,
|
|
74
|
+
itemAccessibilityRole
|
|
73
75
|
});
|
|
74
76
|
return /*#__PURE__*/_jsx(View, {
|
|
75
77
|
ref: ref,
|
|
@@ -105,6 +107,12 @@ StackWrapBox.propTypes = {
|
|
|
105
107
|
* is not defined, the accessibilityRole will default to "heading".
|
|
106
108
|
*/
|
|
107
109
|
tag: PropTypes.oneOf(layoutTags),
|
|
110
|
+
/**
|
|
111
|
+
* Optional accessibility role to apply to each item in the stack.
|
|
112
|
+
* On web, items are wrapped (or cloned) with this role, enabling correct list semantics
|
|
113
|
+
* when the container tag is "ul" or "ol".
|
|
114
|
+
*/
|
|
115
|
+
itemAccessibilityRole: PropTypes.string,
|
|
108
116
|
/**
|
|
109
117
|
* A StackWrap may take any children, but will have no effect if it is only passed one child or is passed children
|
|
110
118
|
* wrapped in a component. If necessary, children may be wrapped in one React Fragment.
|
|
@@ -28,6 +28,7 @@ const StackWrapGap = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
28
28
|
children,
|
|
29
29
|
tag,
|
|
30
30
|
accessibilityRole,
|
|
31
|
+
itemAccessibilityRole,
|
|
31
32
|
...rest
|
|
32
33
|
} = _ref;
|
|
33
34
|
const viewport = useViewport();
|
|
@@ -47,7 +48,8 @@ const StackWrapGap = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
47
48
|
};
|
|
48
49
|
const content = getStackedContent(children, {
|
|
49
50
|
direction,
|
|
50
|
-
space: 0
|
|
51
|
+
space: 0,
|
|
52
|
+
itemAccessibilityRole
|
|
51
53
|
});
|
|
52
54
|
return /*#__PURE__*/_jsx(View, {
|
|
53
55
|
ref: ref,
|
|
@@ -36,7 +36,8 @@ const getStackedContent = (children, _ref) => {
|
|
|
36
36
|
space,
|
|
37
37
|
direction = 'column',
|
|
38
38
|
box,
|
|
39
|
-
preserveFragments = false
|
|
39
|
+
preserveFragments = false,
|
|
40
|
+
itemAccessibilityRole
|
|
40
41
|
} = _ref;
|
|
41
42
|
const boxProps = box && typeof box === 'object' ? box : {
|
|
42
43
|
space
|
|
@@ -48,15 +49,24 @@ const getStackedContent = (children, _ref) => {
|
|
|
48
49
|
const validChildren = React.Children.toArray(topLevelChildren).filter(Boolean);
|
|
49
50
|
const content = validChildren.reduce((newChildren, child, index) => {
|
|
50
51
|
const boxID = `Stack-Box-${index}`;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
let item;
|
|
53
|
+
if (box) {
|
|
54
|
+
// If wrapped in Box, that Box needs a key.
|
|
55
|
+
// If possible, use an existing content key; use an index-based key only if necessary.
|
|
56
|
+
item = /*#__PURE__*/_createElement(Box, {
|
|
57
|
+
...boxProps,
|
|
58
|
+
accessibilityRole: itemAccessibilityRole,
|
|
59
|
+
key: child.key || boxID,
|
|
60
|
+
testID: boxID
|
|
61
|
+
}, child);
|
|
62
|
+
} else if (itemAccessibilityRole) {
|
|
63
|
+
item = /*#__PURE__*/React.cloneElement(child, {
|
|
64
|
+
accessibilityRole: itemAccessibilityRole,
|
|
65
|
+
key: child.key || boxID
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
item = child;
|
|
69
|
+
}
|
|
60
70
|
if (!index || !space && !divider) return [...newChildren, item];
|
|
61
71
|
const testID = `Stack-${divider ? 'Divider' : 'Spacer'}-${index}`;
|
|
62
72
|
const commonProps = {
|
|
@@ -206,7 +206,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef((_ref7, ref) => {
|
|
|
206
206
|
focus: focused
|
|
207
207
|
};
|
|
208
208
|
};
|
|
209
|
-
const onTooltipLayout =
|
|
209
|
+
const onTooltipLayout = _ref0 => {
|
|
210
210
|
let {
|
|
211
211
|
nativeEvent: {
|
|
212
212
|
layout: {
|
|
@@ -214,7 +214,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef((_ref7, ref) => {
|
|
|
214
214
|
height
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
-
} =
|
|
217
|
+
} = _ref0;
|
|
218
218
|
if (tooltipDimensions === null || tooltipDimensions.width !== width || tooltipDimensions.height !== height) {
|
|
219
219
|
setTooltipDimensions({
|
|
220
220
|
width: Platform.select({
|
package/lib/package.json
CHANGED
package/package.json
CHANGED
|
@@ -66,12 +66,7 @@ const InputSupports = React.forwardRef(
|
|
|
66
66
|
/>
|
|
67
67
|
)}
|
|
68
68
|
{typeof children === 'function'
|
|
69
|
-
? children({
|
|
70
|
-
inputId,
|
|
71
|
-
...a11yProps,
|
|
72
|
-
validation: feedbackValidation,
|
|
73
|
-
accessibilityDescribedBy: feedbackId
|
|
74
|
-
})
|
|
69
|
+
? children({ inputId, ...a11yProps, validation: feedbackValidation })
|
|
75
70
|
: children}
|
|
76
71
|
{feedback || maxCharsReachedErrorMessage ? (
|
|
77
72
|
<Feedback
|
|
@@ -31,8 +31,8 @@ const useInputSupports = ({
|
|
|
31
31
|
: undefined
|
|
32
32
|
]), // native only -> replaced with describedBy on web
|
|
33
33
|
accessibilityDescribedBy: joinDefined([
|
|
34
|
-
!hasValidationError && feedback && feedbackId, // feedback receives a11yRole=alert on error, so there's no need to include it here
|
|
35
34
|
hint && hintId,
|
|
35
|
+
(feedback && feedbackId) || undefined,
|
|
36
36
|
charactersCount
|
|
37
37
|
? getCopy('charactersRemaining').replace(/%\{charCount\}/g, charactersCount)
|
|
38
38
|
: undefined
|
package/src/Modal/Modal.jsx
CHANGED
|
@@ -262,7 +262,7 @@ const Modal = React.forwardRef(
|
|
|
262
262
|
</View>
|
|
263
263
|
{/* when a modal becomes open its first focusable element is being automatically focused */}
|
|
264
264
|
{/* and we prefer the close button over backdrop */}
|
|
265
|
-
<TouchableWithoutFeedback onPress={isBackdropClickable
|
|
265
|
+
<TouchableWithoutFeedback onPress={isBackdropClickable ? handleClose : undefined}>
|
|
266
266
|
<View style={[staticStyles.backdrop, selectBackdropStyles(themeTokens)]} />
|
|
267
267
|
</TouchableWithoutFeedback>
|
|
268
268
|
</ScrollView>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
|
|
4
|
+
import { Platform } from 'react-native'
|
|
4
5
|
import { useThemeTokens } from '../ThemeProvider'
|
|
5
6
|
import { useViewport } from '../ViewportProvider'
|
|
6
7
|
import { getTokensPropType, variantProp } from '../utils'
|
|
8
|
+
import { tagsToRoles } from '../utils/a11y/semantics'
|
|
7
9
|
|
|
8
10
|
import List from '../List'
|
|
9
11
|
import StackWrap from '../StackView/StackWrap'
|
|
@@ -27,6 +29,11 @@ const QuickLinks = React.forwardRef(
|
|
|
27
29
|
}
|
|
28
30
|
)
|
|
29
31
|
|
|
32
|
+
const itemAccessibilityRole = Platform.select({
|
|
33
|
+
web: ['ul', 'ol'].includes(tag) ? tagsToRoles.li : undefined,
|
|
34
|
+
default: undefined
|
|
35
|
+
})
|
|
36
|
+
|
|
30
37
|
const content = (list && (
|
|
31
38
|
<List ref={ref} tokens={listTokens} showDivider={dividers} tag={tag} {...rest}>
|
|
32
39
|
{children}
|
|
@@ -37,6 +44,7 @@ const QuickLinks = React.forwardRef(
|
|
|
37
44
|
gap={stackGap}
|
|
38
45
|
tokens={{ justifyContent: stackJustify }}
|
|
39
46
|
tag={tag}
|
|
47
|
+
itemAccessibilityRole={itemAccessibilityRole}
|
|
40
48
|
{...rest}
|
|
41
49
|
>
|
|
42
50
|
{children}
|
|
@@ -58,6 +58,7 @@ const StackWrapBox = React.forwardRef(
|
|
|
58
58
|
variant,
|
|
59
59
|
tag,
|
|
60
60
|
accessibilityRole,
|
|
61
|
+
itemAccessibilityRole,
|
|
61
62
|
...rest
|
|
62
63
|
},
|
|
63
64
|
ref
|
|
@@ -76,7 +77,12 @@ const StackWrapBox = React.forwardRef(
|
|
|
76
77
|
const gapSize = useSpacingScale(gap)
|
|
77
78
|
const offsetStyle = { [offsetSides[direction]]: -1 * gapSize }
|
|
78
79
|
const boxProps = { [gapSides[direction]]: gap, [spaceSides[direction]]: space }
|
|
79
|
-
const content = getStackedContent(children, {
|
|
80
|
+
const content = getStackedContent(children, {
|
|
81
|
+
direction,
|
|
82
|
+
space: 0,
|
|
83
|
+
box: boxProps,
|
|
84
|
+
itemAccessibilityRole
|
|
85
|
+
})
|
|
80
86
|
|
|
81
87
|
return (
|
|
82
88
|
<View
|
|
@@ -119,6 +125,12 @@ StackWrapBox.propTypes = {
|
|
|
119
125
|
* is not defined, the accessibilityRole will default to "heading".
|
|
120
126
|
*/
|
|
121
127
|
tag: PropTypes.oneOf(layoutTags),
|
|
128
|
+
/**
|
|
129
|
+
* Optional accessibility role to apply to each item in the stack.
|
|
130
|
+
* On web, items are wrapped (or cloned) with this role, enabling correct list semantics
|
|
131
|
+
* when the container tag is "ul" or "ol".
|
|
132
|
+
*/
|
|
133
|
+
itemAccessibilityRole: PropTypes.string,
|
|
122
134
|
/**
|
|
123
135
|
* A StackWrap may take any children, but will have no effect if it is only passed one child or is passed children
|
|
124
136
|
* wrapped in a component. If necessary, children may be wrapped in one React Fragment.
|
|
@@ -37,6 +37,7 @@ const StackWrapGap = React.forwardRef(
|
|
|
37
37
|
children,
|
|
38
38
|
tag,
|
|
39
39
|
accessibilityRole,
|
|
40
|
+
itemAccessibilityRole,
|
|
40
41
|
...rest
|
|
41
42
|
},
|
|
42
43
|
ref
|
|
@@ -54,7 +55,7 @@ const StackWrapGap = React.forwardRef(
|
|
|
54
55
|
const size = useSpacingScale(space)
|
|
55
56
|
const gapStyle = { gap: size }
|
|
56
57
|
|
|
57
|
-
const content = getStackedContent(children, { direction, space: 0 })
|
|
58
|
+
const content = getStackedContent(children, { direction, space: 0, itemAccessibilityRole })
|
|
58
59
|
|
|
59
60
|
return (
|
|
60
61
|
<View
|