@telus-uds/components-base 1.12.1 → 1.14.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 +41 -2
- package/component-docs.json +888 -66
- package/lib/Button/ButtonBase.js +36 -7
- package/lib/Button/ButtonGroup.js +7 -0
- package/lib/Button/propTypes.js +18 -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/Icon/IconText.js +1 -1
- package/lib/Link/InlinePressable.js +1 -8
- package/lib/Link/LinkBase.js +6 -7
- package/lib/List/ListItem.js +1 -1
- package/lib/Notification/Notification.js +37 -22
- 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/ButtonBase.js +35 -7
- package/lib-module/Button/ButtonGroup.js +7 -0
- package/lib-module/Button/propTypes.js +17 -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/Icon/IconText.js +1 -1
- package/lib-module/Link/InlinePressable.js +1 -8
- package/lib-module/Link/LinkBase.js +6 -7
- package/lib-module/List/ListItem.js +1 -1
- package/lib-module/Notification/Notification.js +38 -23
- 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/ButtonBase.jsx +28 -9
- package/src/Button/ButtonGroup.jsx +6 -0
- package/src/Button/propTypes.js +14 -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/Icon/IconText.jsx +1 -1
- package/src/Link/InlinePressable.jsx +2 -8
- package/src/Link/LinkBase.jsx +8 -17
- package/src/List/ListItem.jsx +1 -1
- package/src/Notification/Notification.jsx +35 -20
- 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,148 @@
|
|
|
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 _Pressable = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Pressable"));
|
|
13
|
+
|
|
14
|
+
var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
|
|
15
|
+
|
|
16
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
17
|
+
|
|
18
|
+
var _ThemeProvider = require("../../ThemeProvider");
|
|
19
|
+
|
|
20
|
+
var _utils = require("../../utils");
|
|
21
|
+
|
|
22
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
26
|
+
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); }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
const [selectPressProps, pressPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.pressProps, _utils.viewProps]);
|
|
31
|
+
const [selectTextProps, textPropTypes] = (0, _utils.selectSystemProps)([_utils.textProps]);
|
|
32
|
+
|
|
33
|
+
const selectContainerStyles = _ref => {
|
|
34
|
+
let {
|
|
35
|
+
paddingLeft,
|
|
36
|
+
paddingRight,
|
|
37
|
+
paddingTop,
|
|
38
|
+
paddingBottom = 0,
|
|
39
|
+
borderBottomColor,
|
|
40
|
+
borderBottomWidth = 0,
|
|
41
|
+
borderBottomStyle,
|
|
42
|
+
flex,
|
|
43
|
+
alignItems,
|
|
44
|
+
justifyContent
|
|
45
|
+
} = _ref;
|
|
46
|
+
return {
|
|
47
|
+
paddingLeft,
|
|
48
|
+
paddingRight,
|
|
49
|
+
paddingTop,
|
|
50
|
+
paddingBottom: paddingBottom - borderBottomWidth,
|
|
51
|
+
borderBottomColor,
|
|
52
|
+
borderBottomWidth,
|
|
53
|
+
borderBottomStyle,
|
|
54
|
+
flex,
|
|
55
|
+
alignItems,
|
|
56
|
+
justifyContent,
|
|
57
|
+
..._Platform.default.select({
|
|
58
|
+
// Removes the default browser :focus outline
|
|
59
|
+
web: {
|
|
60
|
+
outline: 'none'
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const selectTextStyles = _ref2 => {
|
|
67
|
+
let {
|
|
68
|
+
fontSize,
|
|
69
|
+
fontScaleCap,
|
|
70
|
+
lineHeight,
|
|
71
|
+
letterSpacing,
|
|
72
|
+
fontWeight,
|
|
73
|
+
fontName,
|
|
74
|
+
color
|
|
75
|
+
} = _ref2;
|
|
76
|
+
return (0, _ThemeProvider.applyTextStyles)({
|
|
77
|
+
fontSize,
|
|
78
|
+
fontScaleCap,
|
|
79
|
+
lineHeight,
|
|
80
|
+
letterSpacing,
|
|
81
|
+
fontWeight,
|
|
82
|
+
fontName,
|
|
83
|
+
color
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const CarouselTabsPanelItem = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
88
|
+
let {
|
|
89
|
+
title,
|
|
90
|
+
selected,
|
|
91
|
+
inactive,
|
|
92
|
+
variant,
|
|
93
|
+
tokens,
|
|
94
|
+
accessibilityRole = 'tab',
|
|
95
|
+
...rest
|
|
96
|
+
} = _ref3;
|
|
97
|
+
// Workaround for React Native Web https://github.com/necolas/react-native-web/issues/2357
|
|
98
|
+
// Don't allow disabled to be set while focus is true else focus state gets locked `true`
|
|
99
|
+
// (must refocus _after_ calling `goTo`, else focus target content is not up to date)
|
|
100
|
+
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
101
|
+
const disabled = (inactive || selected) && !isFocused;
|
|
102
|
+
const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('CarouselTabsPanelItem', tokens, variant);
|
|
103
|
+
|
|
104
|
+
const resolveTokens = pressState => getTokens((0, _utils.resolvePressableState)(pressState, {
|
|
105
|
+
selected
|
|
106
|
+
}));
|
|
107
|
+
|
|
108
|
+
const getContainerStyle = pressState => selectContainerStyles(resolveTokens(pressState));
|
|
109
|
+
|
|
110
|
+
const getTextStyle = pressState => selectTextStyles(resolveTokens(pressState));
|
|
111
|
+
|
|
112
|
+
const {
|
|
113
|
+
onPress,
|
|
114
|
+
...selectedPressProps
|
|
115
|
+
} = selectPressProps(rest);
|
|
116
|
+
|
|
117
|
+
const handleKeyDown = event => {
|
|
118
|
+
// Allow using the spacebar for navigation
|
|
119
|
+
if ((event === null || event === void 0 ? void 0 : event.key) === ' ') onPress(event);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
|
|
123
|
+
onPress: onPress,
|
|
124
|
+
style: getContainerStyle,
|
|
125
|
+
accessibilityRole: accessibilityRole,
|
|
126
|
+
ref: ref,
|
|
127
|
+
onKeyDown: handleKeyDown,
|
|
128
|
+
onFocus: () => setIsFocused(true),
|
|
129
|
+
onBlur: () => setIsFocused(false),
|
|
130
|
+
disabled: disabled,
|
|
131
|
+
...selectedPressProps,
|
|
132
|
+
children: pressState => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
133
|
+
style: getTextStyle(pressState),
|
|
134
|
+
...selectTextProps(rest),
|
|
135
|
+
children: title
|
|
136
|
+
})
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
CarouselTabsPanelItem.displayName = 'CarouselTabsPanelItem';
|
|
140
|
+
CarouselTabsPanelItem.propTypes = { ...pressPropTypes,
|
|
141
|
+
...textPropTypes,
|
|
142
|
+
title: _propTypes.default.string.isRequired,
|
|
143
|
+
selected: _propTypes.default.bool,
|
|
144
|
+
tokens: (0, _utils.getTokensPropType)('CarouselTabsPanelItem'),
|
|
145
|
+
variant: _utils.variantProp.propType
|
|
146
|
+
};
|
|
147
|
+
var _default = CarouselTabsPanelItem;
|
|
148
|
+
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 _CarouselTabs = _interopRequireDefault(require("./CarouselTabs"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _CarouselTabs.default;
|
|
13
|
+
exports.default = _default;
|
|
@@ -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
|
*/
|
package/lib/Icon/IconText.js
CHANGED
|
@@ -86,7 +86,7 @@ IconText.propTypes = {
|
|
|
86
86
|
/**
|
|
87
87
|
* A valid UDS icon component imported from a UDS palette.
|
|
88
88
|
*/
|
|
89
|
-
icon: _propTypes.default.
|
|
89
|
+
icon: _propTypes.default.elementType,
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* Props that will be passed to the icon component. By default the icon's `scalesWithText`
|
|
@@ -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);
|
|
@@ -246,7 +245,7 @@ LinkBase.propTypes = { ...selectedSystemPropTypes,
|
|
|
246
245
|
* A function component for an SVG icon to render inside the link. Inherits size and color from
|
|
247
246
|
* the link and any Typography the link is nested inside.
|
|
248
247
|
*/
|
|
249
|
-
icon: _propTypes.default.
|
|
248
|
+
icon: _propTypes.default.elementType,
|
|
250
249
|
|
|
251
250
|
/**
|
|
252
251
|
* When `icon` is provided, use `iconPosition` to place the Icon to the left or right side of Link.
|
package/lib/List/ListItem.js
CHANGED
|
@@ -79,6 +79,10 @@ const selectDismissButtonContainerStyles = _ref4 => {
|
|
|
79
79
|
paddingLeft: dismissButtonGap
|
|
80
80
|
};
|
|
81
81
|
};
|
|
82
|
+
|
|
83
|
+
const selectContentContainerStyle = maxWidth => ({
|
|
84
|
+
width: maxWidth || '100%'
|
|
85
|
+
});
|
|
82
86
|
/**
|
|
83
87
|
* A banner that highlights important messages:
|
|
84
88
|
* - Status message to show there is an error or outage of services
|
|
@@ -153,6 +157,7 @@ const Notification = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
153
157
|
const {
|
|
154
158
|
themeOptions
|
|
155
159
|
} = (0, _ThemeProvider.useTheme)();
|
|
160
|
+
const contentMaxWidth = (0, _utils.useResponsiveProp)(themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.contentMaxWidth);
|
|
156
161
|
|
|
157
162
|
if (isDismissed) {
|
|
158
163
|
return null;
|
|
@@ -172,30 +177,33 @@ const Notification = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
172
177
|
const onDismissPress = () => setIsDismissed(true); // TODO: replace the dismiss button with IconButton when implemented (https://github.com/telus/universal-design-system/issues/281)
|
|
173
178
|
|
|
174
179
|
|
|
175
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
180
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
176
181
|
ref: ref,
|
|
177
182
|
style: [staticStyles.container, selectContainerStyles(themeTokens)],
|
|
178
183
|
...selectProps(rest),
|
|
179
|
-
children:
|
|
180
|
-
style:
|
|
181
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
184
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
185
|
+
style: [staticStyles.content, selectContentContainerStyle(contentMaxWidth)],
|
|
186
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
187
|
+
style: staticStyles.contentContainer,
|
|
188
|
+
children: [IconComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
189
|
+
style: selectIconContainerStyles(themeTokens),
|
|
190
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, { ...selectIconProps(themeTokens)
|
|
191
|
+
})
|
|
192
|
+
}), content && typeof content === 'function' ? content({
|
|
193
|
+
textStyles,
|
|
194
|
+
variant
|
|
195
|
+
}) : content]
|
|
196
|
+
}), dismissible && DismissIconComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
197
|
+
style: selectDismissButtonContainerStyles(themeTokens),
|
|
198
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
|
|
199
|
+
onPress: onDismissPress,
|
|
200
|
+
accessibilityRole: "button",
|
|
201
|
+
accessibilityLabel: getCopy('dismiss'),
|
|
202
|
+
children: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(DismissIconComponent, { ...selectDismissIconProps(themeTokens)
|
|
203
|
+
})
|
|
196
204
|
})
|
|
197
|
-
})
|
|
198
|
-
})
|
|
205
|
+
})]
|
|
206
|
+
})
|
|
199
207
|
});
|
|
200
208
|
});
|
|
201
209
|
Notification.displayName = 'Notification';
|
|
@@ -230,9 +238,16 @@ exports.default = _default;
|
|
|
230
238
|
|
|
231
239
|
const staticStyles = _StyleSheet.default.create({
|
|
232
240
|
container: {
|
|
233
|
-
flexDirection: 'row'
|
|
241
|
+
flexDirection: 'row',
|
|
242
|
+
justifyContent: 'center'
|
|
234
243
|
},
|
|
235
244
|
contentContainer: {
|
|
236
|
-
|
|
245
|
+
flexDirection: 'row',
|
|
246
|
+
flexShrink: 1
|
|
247
|
+
},
|
|
248
|
+
content: {
|
|
249
|
+
flexDirection: 'row',
|
|
250
|
+
flexShrink: 1,
|
|
251
|
+
justifyContent: 'space-between'
|
|
237
252
|
}
|
|
238
253
|
});
|
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
|
*/
|