@telus-uds/components-base 1.12.1 → 1.13.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 +20 -2
- package/component-docs.json +740 -33
- package/lib/Button/ButtonGroup.js +7 -0
- package/lib/Carousel/Carousel.js +69 -12
- package/lib/Carousel/CarouselContext.js +17 -11
- package/lib/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +73 -0
- package/lib/Carousel/CarouselTabs/CarouselTabs.js +70 -0
- package/lib/Carousel/CarouselTabs/CarouselTabsPanel.js +95 -0
- package/lib/Carousel/CarouselTabs/CarouselTabsPanelItem.js +148 -0
- package/lib/Carousel/CarouselTabs/index.js +13 -0
- package/lib/Carousel/CarouselThumbnail.js +99 -0
- package/lib/Carousel/CarouselThumbnailNavigation.js +87 -0
- package/lib/Carousel/dictionary.js +4 -2
- package/lib/Carousel/index.js +10 -1
- package/lib/Checkbox/CheckboxGroup.js +7 -0
- package/lib/Link/InlinePressable.js +1 -8
- package/lib/Link/LinkBase.js +5 -6
- package/lib/Radio/RadioGroup.js +8 -0
- package/lib/RadioCard/RadioCardGroup.js +7 -0
- package/lib/SkipLink/SkipLink.js +216 -0
- package/lib/SkipLink/index.js +13 -0
- package/lib/ThemeProvider/ThemeProvider.js +6 -1
- package/lib/ToggleSwitch/ToggleSwitchGroup.js +7 -0
- package/lib/index.js +9 -0
- package/lib-module/Button/ButtonGroup.js +7 -0
- package/lib-module/Carousel/Carousel.js +66 -11
- package/lib-module/Carousel/CarouselContext.js +17 -11
- package/lib-module/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +51 -0
- package/lib-module/Carousel/CarouselTabs/CarouselTabs.js +50 -0
- package/lib-module/Carousel/CarouselTabs/CarouselTabsPanel.js +76 -0
- package/lib-module/Carousel/CarouselTabs/CarouselTabsPanelItem.js +126 -0
- package/lib-module/Carousel/CarouselTabs/index.js +2 -0
- package/lib-module/Carousel/CarouselThumbnail.js +85 -0
- package/lib-module/Carousel/CarouselThumbnailNavigation.js +66 -0
- package/lib-module/Carousel/dictionary.js +4 -2
- package/lib-module/Carousel/index.js +2 -1
- package/lib-module/Checkbox/CheckboxGroup.js +7 -0
- package/lib-module/Link/InlinePressable.js +1 -8
- package/lib-module/Link/LinkBase.js +5 -6
- package/lib-module/Radio/RadioGroup.js +8 -0
- package/lib-module/RadioCard/RadioCardGroup.js +7 -0
- package/lib-module/SkipLink/SkipLink.js +188 -0
- package/lib-module/SkipLink/index.js +2 -0
- package/lib-module/ThemeProvider/ThemeProvider.js +5 -1
- package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +7 -0
- package/lib-module/index.js +1 -0
- package/package.json +46 -47
- package/src/Button/ButtonGroup.jsx +6 -0
- package/src/Carousel/Carousel.jsx +68 -10
- package/src/Carousel/CarouselContext.jsx +22 -9
- package/src/Carousel/CarouselFirstFocus/CarouselFirstFocus.jsx +49 -0
- package/src/Carousel/CarouselTabs/CarouselTabs.jsx +37 -0
- package/src/Carousel/CarouselTabs/CarouselTabsPanel.jsx +69 -0
- package/src/Carousel/CarouselTabs/CarouselTabsPanelItem.jsx +119 -0
- package/src/Carousel/CarouselTabs/index.js +3 -0
- package/src/Carousel/CarouselThumbnail.jsx +77 -0
- package/src/Carousel/CarouselThumbnailNavigation.jsx +53 -0
- package/src/Carousel/dictionary.js +4 -2
- package/src/Carousel/index.js +1 -0
- package/src/Checkbox/CheckboxGroup.jsx +7 -0
- package/src/Link/InlinePressable.jsx +2 -8
- package/src/Link/LinkBase.jsx +7 -16
- package/src/Radio/RadioGroup.jsx +7 -0
- package/src/RadioCard/RadioCardGroup.jsx +6 -0
- package/src/SkipLink/SkipLink.jsx +179 -0
- package/src/SkipLink/index.js +3 -0
- package/src/ThemeProvider/ThemeProvider.jsx +7 -1
- package/src/ToggleSwitch/ToggleSwitchGroup.jsx +6 -0
- package/src/index.js +1 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _Pressable = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Pressable"));
|
|
13
|
+
|
|
14
|
+
var _Image = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Image"));
|
|
15
|
+
|
|
16
|
+
var _CarouselContext = require("./CarouselContext");
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* `Carousel.Thumbnail` is used to wrap the content of an individual slide and is suppsoed to be the
|
|
24
|
+
* only top-level component passed to the `Carousel`
|
|
25
|
+
*/
|
|
26
|
+
const CarouselThumbnail = _ref => {
|
|
27
|
+
let {
|
|
28
|
+
accessibilityLabel,
|
|
29
|
+
alt,
|
|
30
|
+
index,
|
|
31
|
+
src
|
|
32
|
+
} = _ref;
|
|
33
|
+
const {
|
|
34
|
+
activeIndex,
|
|
35
|
+
itemLabel,
|
|
36
|
+
totalItems,
|
|
37
|
+
getCopyWithPlaceholders,
|
|
38
|
+
goTo,
|
|
39
|
+
themeTokens
|
|
40
|
+
} = (0, _CarouselContext.useCarousel)();
|
|
41
|
+
const thumbnailTitle = alt !== null && alt !== void 0 ? alt : getCopyWithPlaceholders('stepTrackerLabel').replace(/%\{itemLabel\}/g, itemLabel).replace(/%\{stepNumber\}/g, index).replace(/%\{stepCount\}/g, totalItems);
|
|
42
|
+
|
|
43
|
+
const handlePress = () => goTo(index);
|
|
44
|
+
|
|
45
|
+
const handleKeyDown = event => {
|
|
46
|
+
// Allow using the spacebar for navigation
|
|
47
|
+
if ((event === null || event === void 0 ? void 0 : event.key) === ' ') goTo(index);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const {
|
|
51
|
+
thumbnailBorderColor,
|
|
52
|
+
thumbnailBorderRadius,
|
|
53
|
+
thumbnailBorderWidth,
|
|
54
|
+
thumbnailMargin,
|
|
55
|
+
thumbnailPadding,
|
|
56
|
+
thumbnailSelectedBorderColor,
|
|
57
|
+
thumbnailSelectedBorderWidth,
|
|
58
|
+
thumbnailSize
|
|
59
|
+
} = themeTokens;
|
|
60
|
+
const styles = {
|
|
61
|
+
pressable: {
|
|
62
|
+
borderColor: thumbnailBorderColor,
|
|
63
|
+
borderRadius: thumbnailBorderRadius,
|
|
64
|
+
borderWidth: thumbnailBorderWidth,
|
|
65
|
+
margin: thumbnailMargin,
|
|
66
|
+
padding: thumbnailPadding
|
|
67
|
+
},
|
|
68
|
+
image: {
|
|
69
|
+
height: thumbnailSize,
|
|
70
|
+
width: thumbnailSize
|
|
71
|
+
},
|
|
72
|
+
selected: {
|
|
73
|
+
borderColor: thumbnailSelectedBorderColor,
|
|
74
|
+
borderWidth: thumbnailSelectedBorderWidth,
|
|
75
|
+
padding: thumbnailPadding - thumbnailSelectedBorderWidth + thumbnailBorderWidth
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
|
|
79
|
+
onKeyDown: handleKeyDown,
|
|
80
|
+
onPress: handlePress,
|
|
81
|
+
style: [styles.pressable, index === activeIndex && styles.selected],
|
|
82
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Image.default, {
|
|
83
|
+
accessibilityIgnoresInvertColors: true,
|
|
84
|
+
accessibilityLabel: accessibilityLabel !== null && accessibilityLabel !== void 0 ? accessibilityLabel : alt,
|
|
85
|
+
source: src,
|
|
86
|
+
style: styles.image,
|
|
87
|
+
title: thumbnailTitle
|
|
88
|
+
})
|
|
89
|
+
}, src);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
CarouselThumbnail.propTypes = {
|
|
93
|
+
accessibilityLabel: _propTypes.default.string,
|
|
94
|
+
alt: _propTypes.default.string,
|
|
95
|
+
index: _propTypes.default.number,
|
|
96
|
+
src: _propTypes.default.string
|
|
97
|
+
};
|
|
98
|
+
var _default = CarouselThumbnail;
|
|
99
|
+
exports.default = _default;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
13
|
+
|
|
14
|
+
var _CarouselContext = require("./CarouselContext");
|
|
15
|
+
|
|
16
|
+
var _CarouselThumbnail = _interopRequireDefault(require("./CarouselThumbnail"));
|
|
17
|
+
|
|
18
|
+
var _StackView = require("../StackView");
|
|
19
|
+
|
|
20
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
const CarouselThumbnailNavigation = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
29
|
+
let {
|
|
30
|
+
thumbnails = []
|
|
31
|
+
} = _ref;
|
|
32
|
+
const {
|
|
33
|
+
totalItems,
|
|
34
|
+
themeTokens
|
|
35
|
+
} = (0, _CarouselContext.useCarousel)();
|
|
36
|
+
|
|
37
|
+
if (thumbnails.length !== totalItems) {
|
|
38
|
+
throw new Error('Thumbnail set provided does not match the number of slides in the carousel');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const {
|
|
42
|
+
thumbnailContainerPaddingTop,
|
|
43
|
+
thumbnailMargin
|
|
44
|
+
} = themeTokens;
|
|
45
|
+
const stackWrapTokens = {
|
|
46
|
+
justifyContent: 'flex-start'
|
|
47
|
+
};
|
|
48
|
+
const containerStyles = {
|
|
49
|
+
justifyContent: 'center',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
paddingTop: thumbnailContainerPaddingTop - thumbnailMargin
|
|
52
|
+
};
|
|
53
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
54
|
+
style: containerStyles,
|
|
55
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.StackWrap, {
|
|
56
|
+
direction: "row",
|
|
57
|
+
tokens: stackWrapTokens,
|
|
58
|
+
ref: ref,
|
|
59
|
+
children: thumbnails.map((_ref2, index) => {
|
|
60
|
+
let {
|
|
61
|
+
accessibilityLabel,
|
|
62
|
+
alt,
|
|
63
|
+
src
|
|
64
|
+
} = _ref2;
|
|
65
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CarouselThumbnail.default, {
|
|
66
|
+
accessibilityLabel: accessibilityLabel,
|
|
67
|
+
alt: alt,
|
|
68
|
+
index: index,
|
|
69
|
+
src: src
|
|
70
|
+
}, src);
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
CarouselThumbnailNavigation.displayName = 'CarouselThumbnailNavigation';
|
|
76
|
+
CarouselThumbnailNavigation.propTypes = {
|
|
77
|
+
/**
|
|
78
|
+
* An array of objects containing information on the thumbnail images.
|
|
79
|
+
*/
|
|
80
|
+
thumbnails: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
81
|
+
accessibilityLabel: _propTypes.default.string,
|
|
82
|
+
alt: _propTypes.default.string,
|
|
83
|
+
src: _propTypes.default.string
|
|
84
|
+
})).isRequired
|
|
85
|
+
};
|
|
86
|
+
var _default = CarouselThumbnailNavigation;
|
|
87
|
+
exports.default = _default;
|
|
@@ -10,14 +10,16 @@ var _default = {
|
|
|
10
10
|
carouselLabel: '%{stepCount} items',
|
|
11
11
|
iconButtonLabel: 'Show %{itemLabel} %{targetStep} of %{stepCount}',
|
|
12
12
|
stepLabel: '%{itemLabel} %{stepNumber}',
|
|
13
|
-
stepTrackerLabel: '%{itemLabel} %{stepNumber} of %{stepCount}'
|
|
13
|
+
stepTrackerLabel: '%{itemLabel} %{stepNumber} of %{stepCount}',
|
|
14
|
+
skipLink: 'Skip %{title}'
|
|
14
15
|
},
|
|
15
16
|
fr: {
|
|
16
17
|
// TODO: French translations here
|
|
17
18
|
carouselLabel: '(fr) %{stepCount} items',
|
|
18
19
|
iconButtonLabel: '(fr) Show %{itemLabel} %{targetStep} of %{stepCount}',
|
|
19
20
|
stepLabel: '(fr) %{itemLabel} %{stepNumber}',
|
|
20
|
-
stepTrackerLabel: '(fr) %{itemLabel} %{stepNumber} of %{stepCount}'
|
|
21
|
+
stepTrackerLabel: '(fr) %{itemLabel} %{stepNumber} of %{stepCount}',
|
|
22
|
+
skipLink: '(fr) Skip %{title}'
|
|
21
23
|
}
|
|
22
24
|
};
|
|
23
25
|
exports.default = _default;
|
package/lib/Carousel/index.js
CHANGED
|
@@ -4,7 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
|
-
Carousel: true
|
|
7
|
+
Carousel: true,
|
|
8
|
+
CarouselTabs: true
|
|
8
9
|
};
|
|
9
10
|
Object.defineProperty(exports, "Carousel", {
|
|
10
11
|
enumerable: true,
|
|
@@ -12,6 +13,12 @@ Object.defineProperty(exports, "Carousel", {
|
|
|
12
13
|
return _Carousel.default;
|
|
13
14
|
}
|
|
14
15
|
});
|
|
16
|
+
Object.defineProperty(exports, "CarouselTabs", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return _CarouselTabs.default;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
15
22
|
|
|
16
23
|
var _CarouselContext = require("./CarouselContext");
|
|
17
24
|
|
|
@@ -29,4 +36,6 @@ Object.keys(_CarouselContext).forEach(function (key) {
|
|
|
29
36
|
|
|
30
37
|
var _Carousel = _interopRequireDefault(require("./Carousel"));
|
|
31
38
|
|
|
39
|
+
var _CarouselTabs = _interopRequireDefault(require("./CarouselTabs"));
|
|
40
|
+
|
|
32
41
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -90,6 +90,7 @@ const CheckboxGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
90
90
|
legend,
|
|
91
91
|
tooltip,
|
|
92
92
|
hint,
|
|
93
|
+
hintPosition = 'inline',
|
|
93
94
|
validation,
|
|
94
95
|
feedback,
|
|
95
96
|
initialCheckedIds,
|
|
@@ -156,6 +157,7 @@ const CheckboxGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
156
157
|
legend: legend,
|
|
157
158
|
tooltip: tooltip,
|
|
158
159
|
hint: hint,
|
|
160
|
+
hintPosition: hintPosition,
|
|
159
161
|
space: fieldSpace,
|
|
160
162
|
feedback: feedback,
|
|
161
163
|
inactive: inactive,
|
|
@@ -205,6 +207,11 @@ CheckboxGroup.propTypes = { ...selectedSystemPropTypes,
|
|
|
205
207
|
*/
|
|
206
208
|
hint: _propTypes.default.string,
|
|
207
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Position of the hint relative to label. Use `below` to display a larger hint below the label.
|
|
212
|
+
*/
|
|
213
|
+
hintPosition: _propTypes.default.oneOf(['inline', 'below']),
|
|
214
|
+
|
|
208
215
|
/**
|
|
209
216
|
* Optional tooltip text content to include alongside the legend and hint.
|
|
210
217
|
*/
|
|
@@ -27,8 +27,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
27
27
|
* InlinePressable is an alternative to React Native's Pressable that works better when nested
|
|
28
28
|
* inline inside Text. It accepts the same props as React Native's Pressable.
|
|
29
29
|
*
|
|
30
|
-
* On Web it simply passes its props to Pressable and defaults to `inline-flex` instead of `flex`.
|
|
31
|
-
*
|
|
32
30
|
* @param {PressableProps} PressableProps
|
|
33
31
|
*/
|
|
34
32
|
// React Native exports prop Types but not propTypes, use JSDoc types here rather than duplicate RN
|
|
@@ -37,12 +35,11 @@ const InlinePressable = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
37
35
|
let {
|
|
38
36
|
children,
|
|
39
37
|
style,
|
|
40
|
-
inline = false,
|
|
41
38
|
...props
|
|
42
39
|
} = _ref;
|
|
43
40
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
|
|
44
41
|
ref: ref,
|
|
45
|
-
style: pressState => [staticStyles
|
|
42
|
+
style: pressState => [staticStyles.inline, typeof style === 'function' ? style(pressState) : style],
|
|
46
43
|
...props,
|
|
47
44
|
children: pressState => typeof children === 'function' ? children(pressState) : children
|
|
48
45
|
});
|
|
@@ -51,11 +48,7 @@ InlinePressable.displayName = 'InlinePressable';
|
|
|
51
48
|
|
|
52
49
|
const staticStyles = _StyleSheet.default.create({
|
|
53
50
|
inline: {
|
|
54
|
-
// Stop Pressable defaulting to (block) flex
|
|
55
51
|
display: 'inline'
|
|
56
|
-
},
|
|
57
|
-
inlineFlex: {
|
|
58
|
-
display: 'inline-flex'
|
|
59
52
|
}
|
|
60
53
|
});
|
|
61
54
|
|
package/lib/Link/LinkBase.js
CHANGED
|
@@ -37,7 +37,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
37
37
|
|
|
38
38
|
const [selectProps, selectedSystemPropTypes] = (0, _props.selectSystemProps)([_props.a11yProps, _props.linkProps, _props.viewProps]);
|
|
39
39
|
|
|
40
|
-
const selectOuterBorderStyles = _ref => {
|
|
40
|
+
const selectOuterBorderStyles = (_ref, hasIcon) => {
|
|
41
41
|
let {
|
|
42
42
|
outerBorderColor,
|
|
43
43
|
outerBorderWidth,
|
|
@@ -58,7 +58,8 @@ const selectOuterBorderStyles = _ref => {
|
|
|
58
58
|
}),
|
|
59
59
|
// Stops focus ring stretching horizontally if parent has display: block
|
|
60
60
|
// width: fit-content isn't supported on Firefox; can't cascade props like CSS `width: fit-content; width: --moz-fit-content;`
|
|
61
|
-
display: 'inline-flex'
|
|
61
|
+
display: hasIcon ? 'inline-flex' : 'inline' // Stop Pressable defaulting to (block) flex
|
|
62
|
+
|
|
62
63
|
} : {}
|
|
63
64
|
);
|
|
64
65
|
};
|
|
@@ -197,14 +198,12 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
|
197
198
|
themeOptions
|
|
198
199
|
} = (0, _ThemeProvider.useTheme)();
|
|
199
200
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InlinePressable.default, { ...selectedProps,
|
|
200
|
-
inline: hasIcon // assuming links without icons should be inline (even if they are long)
|
|
201
|
-
,
|
|
202
201
|
ref: ref,
|
|
203
202
|
style: linkState => {
|
|
204
203
|
const themeTokens = resolveLinkTokens(linkState);
|
|
205
|
-
const outerBorderStyles = selectOuterBorderStyles(themeTokens);
|
|
204
|
+
const outerBorderStyles = selectOuterBorderStyles(themeTokens, hasIcon);
|
|
206
205
|
const decorationStyles = selectDecorationStyles(themeTokens);
|
|
207
|
-
return [outerBorderStyles, blockLeftStyle, decorationStyles,
|
|
206
|
+
return [outerBorderStyles, blockLeftStyle, decorationStyles, staticStyles.rowContainer];
|
|
208
207
|
},
|
|
209
208
|
children: linkState => {
|
|
210
209
|
const themeTokens = resolveLinkTokens(linkState);
|
package/lib/Radio/RadioGroup.js
CHANGED
|
@@ -92,6 +92,7 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
92
92
|
legend,
|
|
93
93
|
tooltip,
|
|
94
94
|
hint,
|
|
95
|
+
hintPosition = 'inline',
|
|
95
96
|
validation,
|
|
96
97
|
feedback,
|
|
97
98
|
initialCheckedId,
|
|
@@ -141,6 +142,7 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
141
142
|
};
|
|
142
143
|
|
|
143
144
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Radio.default, {
|
|
145
|
+
error: validation === 'error',
|
|
144
146
|
ref: itemRef,
|
|
145
147
|
id: radioId,
|
|
146
148
|
checked: isChecked,
|
|
@@ -160,6 +162,7 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
160
162
|
legend: legend,
|
|
161
163
|
tooltip: tooltip,
|
|
162
164
|
hint: hint,
|
|
165
|
+
hintPosition: hintPosition,
|
|
163
166
|
space: fieldSpace,
|
|
164
167
|
feedback: feedback,
|
|
165
168
|
inactive: inactive,
|
|
@@ -215,6 +218,11 @@ RadioGroup.propTypes = { ...selectedSystemPropTypes,
|
|
|
215
218
|
*/
|
|
216
219
|
hint: _propTypes.default.string,
|
|
217
220
|
|
|
221
|
+
/**
|
|
222
|
+
* Position of the hint relative to label. Use `below` to display a larger hint below the label.
|
|
223
|
+
*/
|
|
224
|
+
hintPosition: _propTypes.default.oneOf(['inline', 'below']),
|
|
225
|
+
|
|
218
226
|
/**
|
|
219
227
|
* Optional tooltip text content to include alongside the legend and hint.
|
|
220
228
|
*/
|
|
@@ -92,6 +92,7 @@ const RadioCardGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
92
92
|
legend,
|
|
93
93
|
tooltip,
|
|
94
94
|
hint,
|
|
95
|
+
hintPosition = 'inline',
|
|
95
96
|
validation,
|
|
96
97
|
feedback,
|
|
97
98
|
initialCheckedId,
|
|
@@ -136,6 +137,7 @@ const RadioCardGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
136
137
|
legend: legend,
|
|
137
138
|
tooltip: tooltip,
|
|
138
139
|
hint: hint,
|
|
140
|
+
hintPosition: hintPosition,
|
|
139
141
|
space: fieldSpace,
|
|
140
142
|
feedback: feedback,
|
|
141
143
|
inactive: inactive || readOnly,
|
|
@@ -221,6 +223,11 @@ RadioCardGroup.propTypes = { ...selectedSystemPropTypes,
|
|
|
221
223
|
*/
|
|
222
224
|
hint: _propTypes.default.string,
|
|
223
225
|
|
|
226
|
+
/**
|
|
227
|
+
* Position of the hint relative to label. Use `below` to display a larger hint below the label.
|
|
228
|
+
*/
|
|
229
|
+
hintPosition: _propTypes.default.oneOf(['inline', 'below']),
|
|
230
|
+
|
|
224
231
|
/**
|
|
225
232
|
* Optional tooltip text content to include alongside the legend and hint.
|
|
226
233
|
*/
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
11
|
+
|
|
12
|
+
var _Pressable = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Pressable"));
|
|
13
|
+
|
|
14
|
+
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
15
|
+
|
|
16
|
+
var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
|
|
17
|
+
|
|
18
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
+
|
|
20
|
+
var _ThemeProvider = require("../ThemeProvider");
|
|
21
|
+
|
|
22
|
+
var _utils = require("../utils");
|
|
23
|
+
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
+
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.linkProps]); // ensure explicit selection of tokens
|
|
33
|
+
|
|
34
|
+
const selectStyles = _ref => {
|
|
35
|
+
let {
|
|
36
|
+
backgroundColor,
|
|
37
|
+
outlineColor,
|
|
38
|
+
outlineOffset,
|
|
39
|
+
outlineStyle,
|
|
40
|
+
outlineWidth,
|
|
41
|
+
paddingHorizontal,
|
|
42
|
+
paddingVertical,
|
|
43
|
+
borderRadius
|
|
44
|
+
} = _ref;
|
|
45
|
+
return {
|
|
46
|
+
backgroundColor,
|
|
47
|
+
outlineColor,
|
|
48
|
+
outlineOffset,
|
|
49
|
+
outlineStyle,
|
|
50
|
+
outlineWidth,
|
|
51
|
+
paddingHorizontal,
|
|
52
|
+
paddingVertical,
|
|
53
|
+
borderRadius
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const selectTextStyles = _ref2 => {
|
|
58
|
+
let {
|
|
59
|
+
color
|
|
60
|
+
} = _ref2;
|
|
61
|
+
return {
|
|
62
|
+
color
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* A generic Skip link component, unstyled by default.
|
|
67
|
+
* A Skip link component help keyboard-only users, screen reader users to skip
|
|
68
|
+
* sections and navigate to the content they want.
|
|
69
|
+
*
|
|
70
|
+
* ## Component API
|
|
71
|
+
*
|
|
72
|
+
* For common uses, pass a `href` that is a # link to a DOM id that can be skipped to (web only).
|
|
73
|
+
*
|
|
74
|
+
* The element with this ID should be focusable, e.g. `<Box nativeID="skip-target" focusable>`.
|
|
75
|
+
*
|
|
76
|
+
* Other custom behaviour may be set by passing an `onPress` function, and routers may be integrated
|
|
77
|
+
* in the same way as other navigation-related components by passing a `LinkRouter`; but a # anchor
|
|
78
|
+
* href on web and/or a `targetRef` for cross-platform applications is the recommended approach.
|
|
79
|
+
*
|
|
80
|
+
* ## Visible styling
|
|
81
|
+
*
|
|
82
|
+
* When focused, the skip link shows as a visible element similar to a simplified ButtonLink using
|
|
83
|
+
* UDS theming. The `tokens` prop may be used to override these styles.
|
|
84
|
+
*
|
|
85
|
+
* To control the background of a skip link, the following tokens can be used:
|
|
86
|
+
*
|
|
87
|
+
* - `backgroundColor`
|
|
88
|
+
* *
|
|
89
|
+
* In order to control the color of the skip link text, the following tokens can be used:
|
|
90
|
+
*
|
|
91
|
+
* - `color`
|
|
92
|
+
*
|
|
93
|
+
* ### Padding
|
|
94
|
+
*
|
|
95
|
+
* The following padding tokens can be used:
|
|
96
|
+
*
|
|
97
|
+
* - `paddingHorizontal`
|
|
98
|
+
* - `paddingVertical`
|
|
99
|
+
*
|
|
100
|
+
* ### Outline
|
|
101
|
+
*
|
|
102
|
+
* The following tokens to control the outline:
|
|
103
|
+
*
|
|
104
|
+
* - `outlineColor`
|
|
105
|
+
* - `outlineOffset`
|
|
106
|
+
* - `outlineStyle`
|
|
107
|
+
* - `outlineWidth`
|
|
108
|
+
*
|
|
109
|
+
* ## Usability and A11y guidelines
|
|
110
|
+
*
|
|
111
|
+
* - The skip link component is visually hidden until a keyboard press activates it.
|
|
112
|
+
* - Usually, you should place the skip link immediately after the opening <body> tag.
|
|
113
|
+
* - This lets users bypass top-level navigation links and jump to the main content on a page.
|
|
114
|
+
* - Also consider using SkipLink before a complex feature containing many focusable elements.
|
|
115
|
+
*
|
|
116
|
+
* ## Accessibility
|
|
117
|
+
*
|
|
118
|
+
* Skip link supports all the common a11y and link props.
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
const SkipLink = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
123
|
+
let {
|
|
124
|
+
tokens,
|
|
125
|
+
variant,
|
|
126
|
+
href,
|
|
127
|
+
children,
|
|
128
|
+
...rawRest
|
|
129
|
+
} = _ref3;
|
|
130
|
+
|
|
131
|
+
const {
|
|
132
|
+
onPress,
|
|
133
|
+
...rest
|
|
134
|
+
} = _utils.clickProps.toPressProps(rawRest);
|
|
135
|
+
|
|
136
|
+
const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('SkipLink', tokens, variant);
|
|
137
|
+
const defaultTokens = getTokens();
|
|
138
|
+
|
|
139
|
+
const resolveLinkTokens = pressState => (0, _utils.resolvePressableTokens)(defaultTokens, pressState);
|
|
140
|
+
|
|
141
|
+
const handlePress = event => {
|
|
142
|
+
if (typeof onPress === 'function') onPress(event); // TODO - support native apps with something based on refs and/or setAccessibilityFocus
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
|
|
146
|
+
ref: ref,
|
|
147
|
+
accessibilityRole: "link",
|
|
148
|
+
onPress: handlePress,
|
|
149
|
+
href: href,
|
|
150
|
+
style: _ref4 => {
|
|
151
|
+
let {
|
|
152
|
+
focused: focus
|
|
153
|
+
} = _ref4;
|
|
154
|
+
const themeTokens = getTokens({
|
|
155
|
+
focus
|
|
156
|
+
});
|
|
157
|
+
const skipLinkStyle = selectStyles(themeTokens);
|
|
158
|
+
return [staticStyles.absolute, skipLinkStyle, !focus && staticStyles.hidden];
|
|
159
|
+
},
|
|
160
|
+
...selectProps(rest),
|
|
161
|
+
children: pressState => {
|
|
162
|
+
const themeTokens = resolveLinkTokens(pressState);
|
|
163
|
+
const textStyles = selectTextStyles(themeTokens);
|
|
164
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
165
|
+
style: [textStyles, staticStyles.baseline],
|
|
166
|
+
children: children
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
SkipLink.displayName = 'SkipLink';
|
|
172
|
+
SkipLink.propTypes = { ...selectedSystemPropTypes,
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* The text content shown or read out when the SkipLink is focused, usually a string.
|
|
176
|
+
*/
|
|
177
|
+
children: _propTypes.default.node,
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The target to skip to. Usually an anchor link to a section id (e.g. href="#main-section").
|
|
181
|
+
*/
|
|
182
|
+
href: _propTypes.default.string,
|
|
183
|
+
tokens: (0, _utils.getTokensPropType)('SkipLink'),
|
|
184
|
+
variant: _utils.variantProp.propType
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const staticStyles = _StyleSheet.default.create({
|
|
188
|
+
baseline: {
|
|
189
|
+
alignSelf: 'baseline'
|
|
190
|
+
},
|
|
191
|
+
absolute: {
|
|
192
|
+
margin: 0,
|
|
193
|
+
position: 'absolute',
|
|
194
|
+
top: 0,
|
|
195
|
+
left: 0
|
|
196
|
+
},
|
|
197
|
+
hidden: {
|
|
198
|
+
overflow: 'hidden',
|
|
199
|
+
..._Platform.default.select({
|
|
200
|
+
web: {
|
|
201
|
+
clip: 'rect(0 0 0 0)',
|
|
202
|
+
clipPath: 'inset(50%)'
|
|
203
|
+
},
|
|
204
|
+
default: {
|
|
205
|
+
// width / height of 0 would make it non-focusable
|
|
206
|
+
height: 1,
|
|
207
|
+
width: 1,
|
|
208
|
+
opacity: 0
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
var _default = (0, _utils.withLinkRouter)(SkipLink);
|
|
215
|
+
|
|
216
|
+
exports.default = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _SkipLink = _interopRequireDefault(require("./SkipLink"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _SkipLink.default;
|
|
13
|
+
exports.default = _default;
|
|
@@ -11,6 +11,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _utils = require("./utils");
|
|
13
13
|
|
|
14
|
+
var _responsiveProps = _interopRequireDefault(require("../utils/props/responsiveProps"));
|
|
15
|
+
|
|
14
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
17
|
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -65,9 +67,12 @@ ThemeProvider.propTypes = {
|
|
|
65
67
|
* - `forceAbsoluteFontSizing`: available on web only; when set to true, allows
|
|
66
68
|
* using absolute font sizing (in pixels, doesn't scale) instead of the
|
|
67
69
|
* relative sizing (in `rem`, scales depending on the browser settings)
|
|
70
|
+
* - `contentMaxWidth`: allows configuration of the content max width to be used in components
|
|
71
|
+
* such as Footnote and Notification to avoid content to stretch width more then the page's width
|
|
68
72
|
*/
|
|
69
73
|
themeOptions: _propTypes.default.shape({
|
|
70
|
-
forceAbsoluteFontSizing: _propTypes.default.bool
|
|
74
|
+
forceAbsoluteFontSizing: _propTypes.default.bool,
|
|
75
|
+
contentMaxWidth: _responsiveProps.default.getTypeOptionallyByViewport(_propTypes.default.number)
|
|
71
76
|
})
|
|
72
77
|
};
|
|
73
78
|
var _default = ThemeProvider;
|
|
@@ -49,6 +49,7 @@ const ToggleSwitchGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
49
49
|
inactive = false,
|
|
50
50
|
feedback,
|
|
51
51
|
hint,
|
|
52
|
+
hintPosition = 'inline',
|
|
52
53
|
tooltip,
|
|
53
54
|
legend,
|
|
54
55
|
name: inputGroupName,
|
|
@@ -134,6 +135,7 @@ const ToggleSwitchGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
134
135
|
legend: legend,
|
|
135
136
|
tooltip: tooltip,
|
|
136
137
|
hint: hint,
|
|
138
|
+
hintPosition: hintPosition,
|
|
137
139
|
space: fieldSpace,
|
|
138
140
|
feedback: feedback,
|
|
139
141
|
inactive: inactive,
|
|
@@ -216,6 +218,11 @@ ToggleSwitchGroup.propTypes = { ...selectedSystemPropTypes,
|
|
|
216
218
|
*/
|
|
217
219
|
hint: _propTypes.default.string,
|
|
218
220
|
|
|
221
|
+
/**
|
|
222
|
+
* Position of the hint relative to label. Use `below` to display a larger hint below the label.
|
|
223
|
+
*/
|
|
224
|
+
hintPosition: _propTypes.default.oneOf(['inline', 'below']),
|
|
225
|
+
|
|
219
226
|
/**
|
|
220
227
|
* Optional tooltip text content to include alongside the legend and hint.
|
|
221
228
|
*/
|