@telus-uds/components-base 1.19.0 → 1.19.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 +2 -2
- package/lib/ActivityIndicator/Spinner.js +7 -7
- package/lib/ActivityIndicator/Spinner.native.js +2 -2
- package/lib/BaseProvider/HydrationContext.js +1 -1
- package/lib/BaseProvider/TamaguiProvider.js +30 -0
- package/lib/Button/ButtonBase.js +2 -2
- package/lib/Button/ButtonDropdown.js +207 -0
- package/lib/Button/ButtonGroup.js +1 -1
- package/lib/Carousel/Carousel.js +2 -4
- package/lib/Carousel/CarouselContext.js +1 -1
- package/lib/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +1 -1
- package/lib/Carousel/CarouselThumbnail.js +2 -2
- package/lib/Checkbox/Checkbox.js +1 -1
- package/lib/Checkbox/CheckboxGroup.js +2 -2
- package/lib/Divider/Divider.js +2 -2
- package/lib/FlexGrid/Col/Col.js +1 -1
- package/lib/Icon/Icon.js +1 -1
- package/lib/MultiSelectFilter/ModalOverlay.js +136 -0
- package/lib/MultiSelectFilter/MultiSelectFilter.js +314 -0
- package/lib/MultiSelectFilter/dictionary.js +19 -0
- package/lib/MultiSelectFilter/index.js +13 -0
- package/lib/Pagination/PageButton.js +2 -2
- package/lib/Pagination/Pagination.js +3 -5
- package/lib/Pagination/usePagination.js +2 -2
- package/lib/Progress/ProgressBar.js +3 -3
- package/lib/Progress/ProgressBarBackground.js +3 -3
- package/lib/QuickLinksFeature/QuickLinksFeature.js +91 -0
- package/lib/QuickLinksFeature/QuickLinksFeatureItem.js +157 -0
- package/lib/QuickLinksFeature/index.js +16 -0
- package/lib/Radio/Radio.js +2 -2
- package/lib/Radio/RadioGroup.js +2 -2
- package/lib/RadioCard/RadioCard.js +1 -1
- package/lib/RadioCard/RadioCardGroup.js +2 -2
- package/lib/Search/Search.js +1 -1
- package/lib/Select/constants.js +15 -0
- package/lib/SideNav/SideNav.js +2 -2
- package/lib/Skeleton/Skeleton.js +1 -1
- package/lib/Skeleton/skeletonWebAnimation.js +1 -1
- package/lib/StackView/StackWrap.js +1 -3
- package/lib/StackView/getStackedContent.js +2 -2
- package/lib/Tabs/Tabs.js +2 -4
- package/lib/Tags/Tags.js +1 -1
- package/lib/TextInput/dictionary.js +19 -0
- package/lib/ThemeProvider/utils/styles.js +3 -3
- package/lib/ThemeProvider/utils/theme-tokens.js +9 -7
- package/lib/Timeline/Timeline.js +1 -1
- package/lib/ToggleSwitch/ToggleSwitch.js +1 -1
- package/lib/ToggleSwitch/ToggleSwitchGroup.js +1 -1
- package/lib/Tooltip/Backdrop.js +10 -2
- package/lib/Tooltip/Tooltip.native.js +357 -0
- package/lib/Tooltip/shared.js +39 -0
- package/lib/Validator/Validator.js +271 -0
- package/lib/Validator/index.js +13 -0
- package/lib/utils/BaseView/BaseView.js +64 -0
- package/lib/utils/BaseView/BaseView.native.js +16 -0
- package/lib/utils/BaseView/index.js +13 -0
- package/lib/utils/animation/useVerticalExpandAnimation.js +1 -1
- package/lib/utils/children.js +2 -2
- package/lib/utils/floating-ui/index.js +43 -0
- package/lib/utils/floating-ui/index.native.js +43 -0
- package/lib/utils/input.js +12 -6
- package/lib/utils/props/componentPropType.js +3 -3
- package/lib/utils/props/selectSystemProps.js +2 -2
- package/lib/utils/props/tokens.js +2 -2
- package/lib/utils/useOverlaidPosition.js +243 -0
- package/lib/utils/useSpacingScale.js +1 -3
- package/lib/utils/useUniqueId.js +1 -1
- package/lib-module/ActivityIndicator/Spinner.js +7 -7
- package/lib-module/ActivityIndicator/Spinner.native.js +2 -2
- package/lib-module/BaseProvider/HydrationContext.js +1 -1
- package/lib-module/BaseProvider/TamaguiProvider.js +22 -0
- package/lib-module/Button/ButtonBase.js +2 -2
- package/lib-module/Button/ButtonDropdown.js +181 -0
- package/lib-module/Button/ButtonGroup.js +1 -1
- package/lib-module/Carousel/Carousel.js +2 -4
- package/lib-module/Carousel/CarouselContext.js +1 -1
- package/lib-module/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +1 -1
- package/lib-module/Carousel/CarouselThumbnail.js +2 -2
- package/lib-module/Checkbox/Checkbox.js +1 -1
- package/lib-module/Checkbox/CheckboxGroup.js +2 -2
- package/lib-module/Divider/Divider.js +2 -2
- package/lib-module/FlexGrid/Col/Col.js +1 -1
- package/lib-module/Icon/Icon.js +1 -1
- package/lib-module/MultiSelectFilter/ModalOverlay.js +112 -0
- package/lib-module/MultiSelectFilter/MultiSelectFilter.js +286 -0
- package/lib-module/MultiSelectFilter/dictionary.js +12 -0
- package/lib-module/MultiSelectFilter/index.js +2 -0
- package/lib-module/Pagination/PageButton.js +2 -2
- package/lib-module/Pagination/Pagination.js +3 -5
- package/lib-module/Pagination/usePagination.js +2 -2
- package/lib-module/Progress/ProgressBar.js +3 -3
- package/lib-module/Progress/ProgressBarBackground.js +3 -3
- package/lib-module/QuickLinksFeature/QuickLinksFeature.js +69 -0
- package/lib-module/QuickLinksFeature/QuickLinksFeatureItem.js +130 -0
- package/lib-module/QuickLinksFeature/index.js +4 -0
- package/lib-module/Radio/Radio.js +2 -2
- package/lib-module/Radio/RadioGroup.js +2 -2
- package/lib-module/RadioCard/RadioCard.js +1 -1
- package/lib-module/RadioCard/RadioCardGroup.js +2 -2
- package/lib-module/Search/Search.js +1 -1
- package/lib-module/Select/constants.js +5 -0
- package/lib-module/SideNav/SideNav.js +2 -2
- package/lib-module/Skeleton/Skeleton.js +1 -1
- package/lib-module/Skeleton/skeletonWebAnimation.js +1 -1
- package/lib-module/StackView/StackWrap.js +1 -3
- package/lib-module/StackView/getStackedContent.js +2 -2
- package/lib-module/Tabs/Tabs.js +2 -4
- package/lib-module/Tags/Tags.js +1 -1
- package/lib-module/TextInput/dictionary.js +12 -0
- package/lib-module/ThemeProvider/utils/styles.js +3 -3
- package/lib-module/ThemeProvider/utils/theme-tokens.js +9 -7
- package/lib-module/Timeline/Timeline.js +1 -1
- package/lib-module/ToggleSwitch/ToggleSwitch.js +1 -1
- package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +1 -1
- package/lib-module/Tooltip/Backdrop.js +10 -2
- package/lib-module/Tooltip/Tooltip.native.js +326 -0
- package/lib-module/Tooltip/shared.js +27 -0
- package/lib-module/Validator/Validator.js +245 -0
- package/lib-module/Validator/index.js +2 -0
- package/lib-module/utils/BaseView/BaseView.js +43 -0
- package/lib-module/utils/BaseView/BaseView.native.js +6 -0
- package/lib-module/utils/BaseView/index.js +2 -0
- package/lib-module/utils/animation/useVerticalExpandAnimation.js +1 -1
- package/lib-module/utils/children.js +2 -2
- package/lib-module/utils/floating-ui/index.js +1 -0
- package/lib-module/utils/floating-ui/index.native.js +1 -0
- package/lib-module/utils/input.js +12 -6
- package/lib-module/utils/props/componentPropType.js +3 -3
- package/lib-module/utils/props/selectSystemProps.js +2 -2
- package/lib-module/utils/props/tokens.js +2 -2
- package/lib-module/utils/useOverlaidPosition.js +232 -0
- package/lib-module/utils/useSpacingScale.js +1 -3
- package/lib-module/utils/useUniqueId.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,157 @@
|
|
|
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 _Image = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Image"));
|
|
13
|
+
|
|
14
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
15
|
+
|
|
16
|
+
var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
|
|
17
|
+
|
|
18
|
+
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
19
|
+
|
|
20
|
+
var _utils = require("../utils");
|
|
21
|
+
|
|
22
|
+
var _ViewportProvider = require("../ViewportProvider");
|
|
23
|
+
|
|
24
|
+
var _ThemeProvider = require("../ThemeProvider");
|
|
25
|
+
|
|
26
|
+
var _Link = require("../Link");
|
|
27
|
+
|
|
28
|
+
var _StackView = require("../StackView");
|
|
29
|
+
|
|
30
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
|
+
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
+
|
|
34
|
+
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); }
|
|
35
|
+
|
|
36
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
|
+
|
|
38
|
+
// pass through and type relevant system props - add more sets for interactive components
|
|
39
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.linkProps]);
|
|
40
|
+
|
|
41
|
+
const selectImageStyle = imageDimension => ({
|
|
42
|
+
width: imageDimension,
|
|
43
|
+
height: imageDimension,
|
|
44
|
+
..._Platform.default.select({
|
|
45
|
+
// TODO: https://github.com/telus/universal-design-system/issues/487
|
|
46
|
+
web: {
|
|
47
|
+
transition: 'width 200ms, height 200ms'
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const selectContainerStyle = _ref => {
|
|
53
|
+
let {
|
|
54
|
+
contentMaxDimension,
|
|
55
|
+
textAlign
|
|
56
|
+
} = _ref;
|
|
57
|
+
return {
|
|
58
|
+
textAlign,
|
|
59
|
+
width: contentMaxDimension,
|
|
60
|
+
overflow: 'hidden'
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const selectImageContainerStyle = contentMaxDimension => ({
|
|
65
|
+
width: contentMaxDimension,
|
|
66
|
+
height: contentMaxDimension,
|
|
67
|
+
justifyContent: 'center',
|
|
68
|
+
alignItems: 'center'
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* Component export along with QuickLinksFeature to be used as children
|
|
72
|
+
*
|
|
73
|
+
* It will receive a image source and a accessibility label and will render a link accordingly with the theme tokens
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
const QuickLinksFeatureItem = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
78
|
+
let {
|
|
79
|
+
tokens,
|
|
80
|
+
variant,
|
|
81
|
+
children,
|
|
82
|
+
imageAccessibilityLabel,
|
|
83
|
+
imageSource,
|
|
84
|
+
...rest
|
|
85
|
+
} = _ref2;
|
|
86
|
+
const viewport = (0, _ViewportProvider.useViewport)();
|
|
87
|
+
const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('QuickLinksFeatureItem', tokens, variant);
|
|
88
|
+
const [hover, setHover] = (0, _react.useState)(false);
|
|
89
|
+
const {
|
|
90
|
+
contentDirection,
|
|
91
|
+
contentSpace,
|
|
92
|
+
contentAlignItems,
|
|
93
|
+
contentMaxDimension,
|
|
94
|
+
imageDimension,
|
|
95
|
+
textAlign
|
|
96
|
+
} = getTokens({
|
|
97
|
+
viewport,
|
|
98
|
+
hover
|
|
99
|
+
});
|
|
100
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Link.Link, {
|
|
101
|
+
ref: ref,
|
|
102
|
+
tokens: state => {
|
|
103
|
+
setHover(state.hover);
|
|
104
|
+
return getTokens(state);
|
|
105
|
+
},
|
|
106
|
+
...selectProps(rest),
|
|
107
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
108
|
+
style: selectContainerStyle({
|
|
109
|
+
contentMaxDimension,
|
|
110
|
+
textAlign
|
|
111
|
+
}),
|
|
112
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.StackWrap, {
|
|
113
|
+
direction: contentDirection,
|
|
114
|
+
space: contentSpace,
|
|
115
|
+
tokens: {
|
|
116
|
+
alignItems: contentAlignItems
|
|
117
|
+
},
|
|
118
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
119
|
+
style: selectImageContainerStyle(contentMaxDimension),
|
|
120
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Image.default, {
|
|
121
|
+
accessibilityIgnoresInvertColors: true,
|
|
122
|
+
imageAccessibilityLabel: imageAccessibilityLabel,
|
|
123
|
+
source: imageSource,
|
|
124
|
+
style: selectImageStyle(imageDimension)
|
|
125
|
+
})
|
|
126
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
127
|
+
children: children
|
|
128
|
+
})]
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
QuickLinksFeatureItem.displayName = 'QuickLinksFeatureItem';
|
|
134
|
+
QuickLinksFeatureItem.propTypes = { ..._utils.withLinkRouter.propTypes,
|
|
135
|
+
...selectedSystemPropTypes,
|
|
136
|
+
tokens: (0, _utils.getTokensPropType)('QuickLinksFeatureItem'),
|
|
137
|
+
variant: _utils.variantProp.propType,
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Text which will be rendered within the Link
|
|
141
|
+
*/
|
|
142
|
+
children: _propTypes.default.node.isRequired,
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Image accessibility label
|
|
146
|
+
*/
|
|
147
|
+
imageAccessibilityLabel: _propTypes.default.string.isRequired,
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Image node or Image url
|
|
151
|
+
*/
|
|
152
|
+
imageSource: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]).isRequired
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
var _default = (0, _utils.withLinkRouter)(QuickLinksFeatureItem);
|
|
156
|
+
|
|
157
|
+
exports.default = _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _QuickLinksFeature = _interopRequireDefault(require("./QuickLinksFeature"));
|
|
9
|
+
|
|
10
|
+
var _QuickLinksFeatureItem = _interopRequireDefault(require("./QuickLinksFeatureItem"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
_QuickLinksFeature.default.Item = _QuickLinksFeatureItem.default;
|
|
15
|
+
var _default = _QuickLinksFeature.default;
|
|
16
|
+
exports.default = _default;
|
package/lib/Radio/Radio.js
CHANGED
|
@@ -70,7 +70,7 @@ const selectDescriptionStyles = _ref2 => {
|
|
|
70
70
|
labelMarginLeft = 0
|
|
71
71
|
} = _ref2;
|
|
72
72
|
return {
|
|
73
|
-
marginLeft: descriptionMarginLeft
|
|
73
|
+
marginLeft: descriptionMarginLeft ?? containerPaddingLeft + inputSize + labelMarginLeft,
|
|
74
74
|
...(0, _ThemeProvider.applyTextStyles)({
|
|
75
75
|
fontSize: descriptionFontSize,
|
|
76
76
|
lineHeight: descriptionLineHeight
|
|
@@ -174,7 +174,7 @@ const Radio = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
|
174
174
|
};
|
|
175
175
|
|
|
176
176
|
const uniqueId = (0, _utils.useUniqueId)('radio');
|
|
177
|
-
const inputId = id
|
|
177
|
+
const inputId = id ?? uniqueId;
|
|
178
178
|
const selectedProps = selectProps({
|
|
179
179
|
accessibilityRole: 'radio',
|
|
180
180
|
accessibilityState: {
|
package/lib/Radio/RadioGroup.js
CHANGED
|
@@ -122,7 +122,7 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
122
122
|
const uniqueFields = ['id', 'label'];
|
|
123
123
|
|
|
124
124
|
if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
|
|
125
|
-
throw new Error(
|
|
125
|
+
throw new Error(`RadioGroup items must have unique ${uniqueFields.join(', ')}`);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
const radios = items.map((_ref2, index) => {
|
|
@@ -133,7 +133,7 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
133
133
|
ref: itemRef,
|
|
134
134
|
...itemRest
|
|
135
135
|
} = _ref2;
|
|
136
|
-
const radioId = id ||
|
|
136
|
+
const radioId = id || `Radio[${index}]`;
|
|
137
137
|
const isChecked = currentValue === radioId;
|
|
138
138
|
|
|
139
139
|
const handleChange = (newCheckedState, event) => {
|
|
@@ -102,7 +102,7 @@ const RadioCard = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
102
102
|
};
|
|
103
103
|
|
|
104
104
|
const uniqueId = (0, _utils.useUniqueId)('RadioCard');
|
|
105
|
-
const inputId = id
|
|
105
|
+
const inputId = id ?? uniqueId;
|
|
106
106
|
const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('RadioCard', tokens, variant);
|
|
107
107
|
|
|
108
108
|
const getCardTokens = cardState => (0, _Card.selectPressableCardTokens)(getTokens(cardState));
|
|
@@ -127,7 +127,7 @@ const RadioCardGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
127
127
|
const uniqueFields = ['id'];
|
|
128
128
|
|
|
129
129
|
if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
|
|
130
|
-
throw new Error(
|
|
130
|
+
throw new Error(`RadioCardGroup items must have unique ${uniqueFields.join(', ')}`);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Fieldset.default, {
|
|
@@ -155,7 +155,7 @@ const RadioCardGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
155
155
|
onChange: itemOnChange,
|
|
156
156
|
...itemRest
|
|
157
157
|
} = _ref2;
|
|
158
|
-
const cardId = id ||
|
|
158
|
+
const cardId = id || `RadioCard[${index}]`;
|
|
159
159
|
|
|
160
160
|
const handleChange = (newCheckedState, event) => {
|
|
161
161
|
if (typeof itemOnChange === 'function') itemOnChange(newCheckedState, event);
|
package/lib/Search/Search.js
CHANGED
|
@@ -145,7 +145,7 @@ const Search = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
|
145
145
|
|
|
146
146
|
const a11yLabelText = accessibilityLabel || getCopy('accessibilityLabel'); // Placeholder is optional and may be unset by passing an empty string
|
|
147
147
|
|
|
148
|
-
const placeholderText = placeholder
|
|
148
|
+
const placeholderText = placeholder ?? a11yLabelText;
|
|
149
149
|
const {
|
|
150
150
|
nativeID,
|
|
151
151
|
testID,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ANDROID_VALIDATION_ICON_CONTAINER_OFFSET = exports.ANDROID_HORIZONTAL_PADDING_OFFSET = exports.ANDROID_HEIGHT_OFFSET = exports.ANDROID_DEFAULT_PADDING = void 0;
|
|
7
|
+
// Because Android
|
|
8
|
+
const ANDROID_VALIDATION_ICON_CONTAINER_OFFSET = 5;
|
|
9
|
+
exports.ANDROID_VALIDATION_ICON_CONTAINER_OFFSET = ANDROID_VALIDATION_ICON_CONTAINER_OFFSET;
|
|
10
|
+
const ANDROID_HEIGHT_OFFSET = 12;
|
|
11
|
+
exports.ANDROID_HEIGHT_OFFSET = ANDROID_HEIGHT_OFFSET;
|
|
12
|
+
const ANDROID_HORIZONTAL_PADDING_OFFSET = 8;
|
|
13
|
+
exports.ANDROID_HORIZONTAL_PADDING_OFFSET = ANDROID_HORIZONTAL_PADDING_OFFSET;
|
|
14
|
+
const ANDROID_DEFAULT_PADDING = 0;
|
|
15
|
+
exports.ANDROID_DEFAULT_PADDING = ANDROID_DEFAULT_PADDING;
|
package/lib/SideNav/SideNav.js
CHANGED
|
@@ -82,7 +82,7 @@ const SideNav = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
82
82
|
|
|
83
83
|
const renderItem = (item, index, groupId) => {
|
|
84
84
|
const {
|
|
85
|
-
itemId =
|
|
85
|
+
itemId = `item-${index}`,
|
|
86
86
|
onPress
|
|
87
87
|
} = item.props;
|
|
88
88
|
|
|
@@ -110,7 +110,7 @@ const SideNav = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
110
110
|
|
|
111
111
|
if (child.type === _ItemsGroup.default) {
|
|
112
112
|
const {
|
|
113
|
-
groupId =
|
|
113
|
+
groupId = `group-${index}`
|
|
114
114
|
} = child.props;
|
|
115
115
|
const isGroupActive = active.itemId !== undefined && active.groupId === groupId;
|
|
116
116
|
|
package/lib/Skeleton/Skeleton.js
CHANGED
|
@@ -150,7 +150,7 @@ const Skeleton = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
150
150
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
151
151
|
testID: "skeleton",
|
|
152
152
|
style: [selectSkeletonStyles(themeTokens), getAnimationBasedOnPlatform(), getStyledBasedOnShape()]
|
|
153
|
-
},
|
|
153
|
+
}, `skeleton-${index + 1}`);
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.default, {
|
|
@@ -8,7 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _skeleton = require("./skeleton.constant");
|
|
9
9
|
|
|
10
10
|
var _default = {
|
|
11
|
-
animationDuration:
|
|
11
|
+
animationDuration: `${_skeleton.ANIMATION_DURATION}ms`,
|
|
12
12
|
animationTimingFunction: 'ease-in-out',
|
|
13
13
|
animationDelay: '0.5s',
|
|
14
14
|
animationIterationCount: 'infinite',
|
|
@@ -42,14 +42,12 @@ const exampleGapValue = '1px';
|
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
44
|
const StackWrap = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
45
|
-
var _props$gap;
|
|
46
|
-
|
|
47
45
|
const [canUseCSSGap, setCanUseCSSGap] = (0, _react.useState)(false);
|
|
48
46
|
const {
|
|
49
47
|
space
|
|
50
48
|
} = props; // Don't apply separate gap if `null` or `undefined`, so can be unset in Storybook etc
|
|
51
49
|
|
|
52
|
-
const gap =
|
|
50
|
+
const gap = props.gap ?? space;
|
|
53
51
|
const gapEqualsSpace = gap === space; // If possible, use the cleaner implementation that applies CSS `gap` styles to the container,
|
|
54
52
|
// preserving direct parent-child relationships between the container and each item, which
|
|
55
53
|
// can result in clearer descriptions on some screen readers (e.g. radio "X of Y" on MacOS).
|
|
@@ -65,7 +65,7 @@ const getStackedContent = (children, _ref) => {
|
|
|
65
65
|
const validChildren = _react.Children.toArray(topLevelChildren).filter(Boolean);
|
|
66
66
|
|
|
67
67
|
const content = validChildren.reduce((newChildren, child, index) => {
|
|
68
|
-
const boxID =
|
|
68
|
+
const boxID = `Stack-Box-${index}`;
|
|
69
69
|
const item = box ?
|
|
70
70
|
/*#__PURE__*/
|
|
71
71
|
// If wrapped in Box, that Box needs a key.
|
|
@@ -75,7 +75,7 @@ const getStackedContent = (children, _ref) => {
|
|
|
75
75
|
testID: boxID
|
|
76
76
|
}, child) : child;
|
|
77
77
|
if (!index || !space && !divider) return [...newChildren, item];
|
|
78
|
-
const testID =
|
|
78
|
+
const testID = `Stack-${divider ? 'Divider' : 'Spacer'}-${index}`;
|
|
79
79
|
const commonProps = {
|
|
80
80
|
testID,
|
|
81
81
|
key: testID,
|
package/lib/Tabs/Tabs.js
CHANGED
|
@@ -59,8 +59,6 @@ const getDefaultTabItemAccessibilityRole = parentRole => {
|
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
const Tabs = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
62
|
-
var _restProps$accessibil;
|
|
63
|
-
|
|
64
62
|
let {
|
|
65
63
|
tokens,
|
|
66
64
|
itemTokens,
|
|
@@ -98,7 +96,7 @@ const Tabs = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
98
96
|
if (hashId) setTimeout(setValue(hashId, event), 500);
|
|
99
97
|
}, [items, setValue]), isPositioningReady);
|
|
100
98
|
const restProps = selectProps(rest);
|
|
101
|
-
const parentAccessibilityRole =
|
|
99
|
+
const parentAccessibilityRole = restProps.accessibilityRole ?? 'tablist';
|
|
102
100
|
const defaultTabItemAccessibiltyRole = getDefaultTabItemAccessibilityRole(parentAccessibilityRole);
|
|
103
101
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_HorizontalScroll.default, {
|
|
104
102
|
ref: ref,
|
|
@@ -123,7 +121,7 @@ const Tabs = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
123
121
|
linkRouterProps: itemLinkRouterProps,
|
|
124
122
|
...itemRest
|
|
125
123
|
} = _ref3;
|
|
126
|
-
const itemId = id
|
|
124
|
+
const itemId = id ?? label;
|
|
127
125
|
const isSelected = Boolean(currentValue && currentValue === itemId);
|
|
128
126
|
|
|
129
127
|
const handlePress = event => {
|
package/lib/Tags/Tags.js
CHANGED
|
@@ -135,7 +135,7 @@ const Tags = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
135
135
|
const uniqueFields = ['id', 'label'];
|
|
136
136
|
|
|
137
137
|
if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
|
|
138
|
-
throw new Error(
|
|
138
|
+
throw new Error(`Tags items must have unique ${uniqueFields.join(', ')}`);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.StackWrap, {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
en: {
|
|
9
|
+
clearButtonAccessibilityLabel: 'Clear',
|
|
10
|
+
showPasswordAccessibilityLabel: 'Show Password',
|
|
11
|
+
hidePasswordAccessibilityLabel: 'Hide Password'
|
|
12
|
+
},
|
|
13
|
+
fr: {
|
|
14
|
+
clearButtonAccessibilityLabel: 'Effacer',
|
|
15
|
+
showPasswordAccessibilityLabel: 'montrer le mot de passe',
|
|
16
|
+
hidePasswordAccessibilityLabel: 'masquer le mot de passe'
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.default = _default;
|
|
@@ -42,7 +42,7 @@ function applyTextStyles(_ref) {
|
|
|
42
42
|
|
|
43
43
|
if (fontSize) {
|
|
44
44
|
// If relative font sizes are needed, catch and calculate them here
|
|
45
|
-
styles.fontSize = _Platform.default.OS === 'web' && !forceAbsoluteFontSizing ?
|
|
45
|
+
styles.fontSize = _Platform.default.OS === 'web' && !forceAbsoluteFontSizing ? `${fontSize / _systemConstants.fontBasePixels}rem` : fontSize;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
if (typeof lineHeight === 'number') {
|
|
@@ -58,7 +58,7 @@ function applyTextStyles(_ref) {
|
|
|
58
58
|
if (fontName) {
|
|
59
59
|
// Don't set undefined font families. May need some validation here that the font is available.
|
|
60
60
|
// Android doesn't recognise font weights natively so apply custom font weights via `fontFamily`.
|
|
61
|
-
styles.fontFamily =
|
|
61
|
+
styles.fontFamily = `${fontName}${fontWeight}${fontStyle}`;
|
|
62
62
|
} else if (fontWeight) {
|
|
63
63
|
// If using system default font, apply the font weight directly.
|
|
64
64
|
// Font weight support in Android is limited to 'bold' or anything else === 'normal'.
|
|
@@ -108,7 +108,7 @@ function applyWebShadow(_ref2) {
|
|
|
108
108
|
} = _ref2;
|
|
109
109
|
const insetString = inset ? 'inset ' : '';
|
|
110
110
|
const boxShadow = {
|
|
111
|
-
boxShadow:
|
|
111
|
+
boxShadow: `${insetString}${offsetX}px ${offsetY}px ${blur}px ${spread}px ${color}`
|
|
112
112
|
};
|
|
113
113
|
return boxShadow;
|
|
114
114
|
}
|
|
@@ -28,19 +28,19 @@ const getComponentTheme = (theme, componentName) => {
|
|
|
28
28
|
// Give clear and understandable error messages for common dev errors, for example,
|
|
29
29
|
// typo in component name, missing export or accessing old version of theme
|
|
30
30
|
if (!theme) {
|
|
31
|
-
throw new Error(
|
|
31
|
+
throw new Error(`Called useTheme's getStyle on "${componentName}" with no theme provided`);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const themeName = ((_theme$metadata = theme.metadata) === null || _theme$metadata === void 0 ? void 0 : _theme$metadata.name) || '';
|
|
35
35
|
|
|
36
36
|
if (!theme.components) {
|
|
37
|
-
throw new Error(
|
|
37
|
+
throw new Error(`Theme "${themeName}" has no components defined (looking for "${componentName}")`);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const componentTheme = theme.components[componentName];
|
|
41
41
|
|
|
42
42
|
if (!componentTheme) {
|
|
43
|
-
throw new Error(
|
|
43
|
+
throw new Error(`Theme "${themeName}" does not have styles for component "${componentName}"`);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
return componentTheme;
|
|
@@ -49,11 +49,9 @@ const getComponentTheme = (theme, componentName) => {
|
|
|
49
49
|
exports.getComponentTheme = getComponentTheme;
|
|
50
50
|
|
|
51
51
|
const doesThemeConditionApply = (_ref, appearances) => {
|
|
52
|
-
var _appearances$key;
|
|
53
|
-
|
|
54
52
|
let [key, value] = _ref;
|
|
55
53
|
// use null rather than undefined so we can serialise the value in themes
|
|
56
|
-
const appearanceValue =
|
|
54
|
+
const appearanceValue = appearances[key] ?? null;
|
|
57
55
|
return Array.isArray(value) ? value.includes(appearanceValue) : value === appearanceValue;
|
|
58
56
|
};
|
|
59
57
|
|
|
@@ -194,7 +192,11 @@ const validateThemeTokensVersion = theme => {
|
|
|
194
192
|
const actualThemeTokensVersion = theme === null || theme === void 0 ? void 0 : (_theme$metadata2 = theme.metadata) === null || _theme$metadata2 === void 0 ? void 0 : _theme$metadata2.themeTokensVersion;
|
|
195
193
|
|
|
196
194
|
if (!(0, _satisfies.default)(actualThemeTokensVersion, expectedThemeTokensVersion)) {
|
|
197
|
-
throw new Error(
|
|
195
|
+
throw new Error(`Invalid UDS token schema version detected.
|
|
196
|
+
|
|
197
|
+
The UDS base components ${_package.default.name} v${_package.default.version} are only compatible with UDS themes that are built with @telus-uds/system-theme-tokens version that is semver compatible with ${expectedThemeTokensVersion}. The current theme was built with @telus-uds/system-theme-tokens v${actualThemeTokensVersion}.
|
|
198
|
+
|
|
199
|
+
If you see this error than most likely you have attempted to install ${_package.default.name} and a UDS theme manually because you are building a multi-brand application. If you are building a single brand application, consider installing the brand specific design system package such as @telus-uds/ds-allium. For more information, see https://github.com/telus/universal-design-system/blob/main/docs/docs/multi-brand-usage.md`);
|
|
198
200
|
}
|
|
199
201
|
};
|
|
200
202
|
|
package/lib/Timeline/Timeline.js
CHANGED
|
@@ -159,7 +159,7 @@ const Timeline = /*#__PURE__*/(0, _react.forwardRef)((_ref7, ref) => {
|
|
|
159
159
|
style: selectItemContentStyles(themeTokens, index + 1 === children.length),
|
|
160
160
|
children: child
|
|
161
161
|
})]
|
|
162
|
-
},
|
|
162
|
+
}, `timeline-${index}-${child.displayName}`);
|
|
163
163
|
})
|
|
164
164
|
});
|
|
165
165
|
});
|
|
@@ -160,7 +160,7 @@ const ToggleSwitch = /*#__PURE__*/(0, _react.forwardRef)((_ref7, ref) => {
|
|
|
160
160
|
const getButtonTokens = buttonState => selectButtonTokens(getTokens(buttonState));
|
|
161
161
|
|
|
162
162
|
const uniqueId = (0, _utils.useUniqueId)('toggleSwitch');
|
|
163
|
-
const inputId = id
|
|
163
|
+
const inputId = id ?? uniqueId;
|
|
164
164
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.default, {
|
|
165
165
|
space: 2,
|
|
166
166
|
direction: "row",
|
|
@@ -87,7 +87,7 @@ const ToggleSwitchGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
87
87
|
const uniqueFields = ['id', 'label'];
|
|
88
88
|
|
|
89
89
|
if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
|
|
90
|
-
throw new Error(
|
|
90
|
+
throw new Error(`ToggleSwitchGroup items must have unique ${uniqueFields.join(', ')}`);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
const toggleSwitches = items.map((_ref2, index) => {
|
package/lib/Tooltip/Backdrop.js
CHANGED
|
@@ -19,7 +19,15 @@ function createPortalNode(nodeId) {
|
|
|
19
19
|
// this way the backdrop stays in place when scrolling the window - that's why we need to
|
|
20
20
|
// position it at the scroll position when rendering
|
|
21
21
|
|
|
22
|
-
node.style.cssText =
|
|
22
|
+
node.style.cssText = `
|
|
23
|
+
position: absolute;
|
|
24
|
+
top: ${window.scrollY}px;
|
|
25
|
+
left: ${window.scrollX}px;
|
|
26
|
+
right: 0;
|
|
27
|
+
bottom: 0;
|
|
28
|
+
z-index: 9999;
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
`;
|
|
23
31
|
document.body.appendChild(node);
|
|
24
32
|
return node;
|
|
25
33
|
}
|
|
@@ -40,7 +48,7 @@ function Backdrop(_ref) {
|
|
|
40
48
|
} = _ref;
|
|
41
49
|
const [portalNode, setPortalNode] = (0, _react.useState)();
|
|
42
50
|
(0, _react.useEffect)(() => {
|
|
43
|
-
const nodeId =
|
|
51
|
+
const nodeId = `tooltip-backdrop-${Date.now()}`;
|
|
44
52
|
const node = createPortalNode(nodeId);
|
|
45
53
|
setPortalNode(node);
|
|
46
54
|
return () => {
|