@telus-uds/components-base 1.18.1 → 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 +22 -2
- package/component-docs.json +111 -16
- package/jest.config-android.js +17 -0
- package/jest.config-ios.js +18 -0
- package/jest.config-web.js +31 -0
- 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 +8 -4
- package/lib/Button/ButtonDropdown.js +207 -0
- package/lib/Button/ButtonGroup.js +1 -1
- package/lib/Carousel/Carousel.js +31 -5
- package/lib/Carousel/CarouselContext.js +1 -1
- package/lib/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +1 -1
- package/lib/Carousel/CarouselTabs/CarouselTabsPanel.js +1 -10
- 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/SideButton.js +6 -4
- 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/Responsive/Responsive.js +58 -0
- package/lib/Responsive/index.js +13 -0
- package/lib/Search/Search.js +30 -63
- 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 +11 -5
- package/lib/TextInput/TextInputBase.js +53 -19
- 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/index.js +9 -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 +8 -4
- package/lib-module/Button/ButtonDropdown.js +181 -0
- package/lib-module/Button/ButtonGroup.js +1 -1
- package/lib-module/Carousel/Carousel.js +31 -5
- package/lib-module/Carousel/CarouselContext.js +1 -1
- package/lib-module/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +1 -1
- package/lib-module/Carousel/CarouselTabs/CarouselTabsPanel.js +1 -10
- 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/SideButton.js +6 -4
- 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/Responsive/Responsive.js +45 -0
- package/lib-module/Responsive/index.js +2 -0
- package/lib-module/Search/Search.js +30 -61
- 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 +11 -5
- package/lib-module/TextInput/TextInputBase.js +52 -19
- 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/index.js +1 -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 +7 -4
- package/src/Button/ButtonBase.jsx +4 -2
- package/src/Carousel/Carousel.jsx +42 -10
- package/src/Carousel/CarouselTabs/CarouselTabsPanel.jsx +0 -10
- package/src/Pagination/SideButton.jsx +5 -5
- package/src/Responsive/Responsive.jsx +33 -0
- package/src/Responsive/index.js +3 -0
- package/src/Search/Search.jsx +17 -32
- package/src/Tags/Tags.jsx +46 -33
- package/src/TextInput/TextInputBase.jsx +46 -16
- package/src/index.js +1 -0
package/lib/Search/Search.js
CHANGED
|
@@ -9,8 +9,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
11
11
|
|
|
12
|
-
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
13
|
-
|
|
14
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
13
|
|
|
16
14
|
var _ThemeProvider = require("../ThemeProvider");
|
|
@@ -21,8 +19,6 @@ var _TextInputBase = _interopRequireDefault(require("../TextInput/TextInputBase"
|
|
|
21
19
|
|
|
22
20
|
var _ButtonBase = _interopRequireDefault(require("../Button/ButtonBase"));
|
|
23
21
|
|
|
24
|
-
var _StackView = _interopRequireDefault(require("../StackView"));
|
|
25
|
-
|
|
26
22
|
var _useCopy = _interopRequireDefault(require("../utils/useCopy"));
|
|
27
23
|
|
|
28
24
|
var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
@@ -63,20 +59,11 @@ const selectInputTokens = _ref => {
|
|
|
63
59
|
|
|
64
60
|
const selectButtonTokens = tokens => (0, _utils.selectTokens)('Button', tokens);
|
|
65
61
|
|
|
66
|
-
const
|
|
67
|
-
let {
|
|
68
|
-
paddingRight
|
|
69
|
-
} = _ref2;
|
|
70
|
-
return {
|
|
71
|
-
paddingRight
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const selectIconTokens = _ref3 => {
|
|
62
|
+
const selectIconTokens = _ref2 => {
|
|
76
63
|
let {
|
|
77
64
|
iconSize,
|
|
78
65
|
iconColor
|
|
79
|
-
} =
|
|
66
|
+
} = _ref2;
|
|
80
67
|
return {
|
|
81
68
|
color: iconColor,
|
|
82
69
|
size: iconSize
|
|
@@ -97,7 +84,7 @@ const selectIconTokens = _ref3 => {
|
|
|
97
84
|
*/
|
|
98
85
|
|
|
99
86
|
|
|
100
|
-
const Search = /*#__PURE__*/(0, _react.forwardRef)((
|
|
87
|
+
const Search = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
101
88
|
let {
|
|
102
89
|
initialValue,
|
|
103
90
|
value,
|
|
@@ -112,7 +99,7 @@ const Search = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
|
112
99
|
tokens,
|
|
113
100
|
variant,
|
|
114
101
|
...rest
|
|
115
|
-
} =
|
|
102
|
+
} = _ref3;
|
|
116
103
|
const {
|
|
117
104
|
currentValue = '',
|
|
118
105
|
setValue
|
|
@@ -158,16 +145,14 @@ const Search = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
|
158
145
|
|
|
159
146
|
const a11yLabelText = accessibilityLabel || getCopy('accessibilityLabel'); // Placeholder is optional and may be unset by passing an empty string
|
|
160
147
|
|
|
161
|
-
const placeholderText = placeholder
|
|
148
|
+
const placeholderText = placeholder ?? a11yLabelText;
|
|
162
149
|
const {
|
|
163
150
|
nativeID,
|
|
164
151
|
testID,
|
|
165
152
|
...containerProps
|
|
166
153
|
} = selectContainerProps(rest);
|
|
167
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
168
|
-
|
|
169
|
-
...containerProps,
|
|
170
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextInputBase.default, {
|
|
154
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, { ...containerProps,
|
|
155
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextInputBase.default, {
|
|
171
156
|
nativeID: nativeID,
|
|
172
157
|
testID: testID,
|
|
173
158
|
...selectInputProps(rest),
|
|
@@ -187,35 +172,29 @@ const Search = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
|
187
172
|
onChange: setValue,
|
|
188
173
|
onSubmitEditing: handleSubmit,
|
|
189
174
|
onFocus: handleFocus,
|
|
190
|
-
accessibilityLabel: a11yLabelText
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
accessibilityLabel: getCopy('submitButtonAccessibilityLabel'),
|
|
209
|
-
tokens: buttonState => selectButtonTokens(getButtonTokens({ ...buttonState,
|
|
175
|
+
accessibilityLabel: a11yLabelText,
|
|
176
|
+
buttons: [ClearButtonIcon && !isEmpty && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
|
|
177
|
+
accessibilityLabel: getCopy('clearButtonAccessibilityLabel'),
|
|
178
|
+
accessibilityRole: "button",
|
|
179
|
+
inactive: inactive,
|
|
180
|
+
onPress: handleClear,
|
|
181
|
+
tokens: appearances => selectButtonTokens(getButtonTokens(appearances)),
|
|
182
|
+
children: buttonState => /*#__PURE__*/(0, _jsxRuntime.jsx)(ClearButtonIcon, { ...selectIconTokens(getButtonTokens(buttonState))
|
|
183
|
+
})
|
|
184
|
+
}, "clear"), SubmitButtonIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
|
|
185
|
+
accessibilityLabel: getCopy('submitButtonAccessibilityLabel'),
|
|
186
|
+
accessibilityRole: "button",
|
|
187
|
+
inactive: inactive,
|
|
188
|
+
onPress: handleSubmit,
|
|
189
|
+
tokens: buttonState => selectButtonTokens(getButtonTokens({ ...buttonState,
|
|
190
|
+
priority: 'high'
|
|
191
|
+
})),
|
|
192
|
+
children: buttonState => /*#__PURE__*/(0, _jsxRuntime.jsx)(SubmitButtonIcon, { ...selectIconTokens(getButtonTokens({ ...buttonState,
|
|
210
193
|
priority: 'high'
|
|
211
|
-
}))
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
})
|
|
216
|
-
})]
|
|
217
|
-
})
|
|
218
|
-
})]
|
|
194
|
+
}))
|
|
195
|
+
})
|
|
196
|
+
}, "submit")]
|
|
197
|
+
})
|
|
219
198
|
});
|
|
220
199
|
});
|
|
221
200
|
Search.displayName = 'Search';
|
|
@@ -280,16 +259,4 @@ Search.propTypes = { ...selectedContainerPropTypes,
|
|
|
280
259
|
variant: _utils.variantProp.propType
|
|
281
260
|
};
|
|
282
261
|
var _default = Search;
|
|
283
|
-
exports.default = _default;
|
|
284
|
-
|
|
285
|
-
const staticStyles = _StyleSheet.default.create({
|
|
286
|
-
container: {// No styles needed here except the View defaults (position: relative etc)
|
|
287
|
-
},
|
|
288
|
-
iconsContainer: {
|
|
289
|
-
position: 'absolute',
|
|
290
|
-
right: 0,
|
|
291
|
-
top: 0,
|
|
292
|
-
bottom: 0,
|
|
293
|
-
justifyContent: 'center'
|
|
294
|
-
}
|
|
295
|
-
});
|
|
262
|
+
exports.default = _default;
|
|
@@ -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
|
@@ -42,7 +42,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
42
42
|
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
|
|
43
43
|
const [selectItemProps, selectedItemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.focusHandlerProps, _utils.pressProps, _utils.viewProps]);
|
|
44
44
|
|
|
45
|
-
const
|
|
45
|
+
const separateIconTextTokens = (_ref, returnRest) => {
|
|
46
46
|
let {
|
|
47
47
|
icon,
|
|
48
48
|
iconPosition,
|
|
@@ -54,9 +54,10 @@ const selectIconTextTokens = _ref => {
|
|
|
54
54
|
iconAlignSelf,
|
|
55
55
|
iconPadding,
|
|
56
56
|
iconTranslateX,
|
|
57
|
-
iconTranslateY
|
|
57
|
+
iconTranslateY,
|
|
58
|
+
...rest
|
|
58
59
|
} = _ref;
|
|
59
|
-
return {
|
|
60
|
+
return returnRest ? rest : {
|
|
60
61
|
icon,
|
|
61
62
|
iconPosition,
|
|
62
63
|
iconSpace,
|
|
@@ -81,6 +82,10 @@ const selectIconTextTokens = _ref => {
|
|
|
81
82
|
};
|
|
82
83
|
};
|
|
83
84
|
|
|
85
|
+
const selectIconTextTokens = tokens => separateIconTextTokens(tokens, false);
|
|
86
|
+
|
|
87
|
+
const selectNonIconTextTokens = tokens => separateIconTextTokens(tokens, true);
|
|
88
|
+
|
|
84
89
|
const Tags = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
85
90
|
let {
|
|
86
91
|
variant,
|
|
@@ -109,7 +114,8 @@ const Tags = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
109
114
|
} = themeTokens;
|
|
110
115
|
const getItemTokens = (0, _ThemeProvider.useThemeTokensCallback)('TagsItem', tokens, variant);
|
|
111
116
|
|
|
112
|
-
const getButtonTokens = buttonState =>
|
|
117
|
+
const getButtonTokens = buttonState => // Remove icon-text-related tokens, since we want to handle them ourselves, not use ButtonBase's handling
|
|
118
|
+
(0, _utils.selectTokens)('Button', selectNonIconTextTokens(getItemTokens(buttonState)));
|
|
113
119
|
|
|
114
120
|
const {
|
|
115
121
|
currentValues,
|
|
@@ -129,7 +135,7 @@ const Tags = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
129
135
|
const uniqueFields = ['id', 'label'];
|
|
130
136
|
|
|
131
137
|
if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
|
|
132
|
-
throw new Error(
|
|
138
|
+
throw new Error(`Tags items must have unique ${uniqueFields.join(', ')}`);
|
|
133
139
|
}
|
|
134
140
|
|
|
135
141
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.StackWrap, {
|
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
10
12
|
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
11
13
|
|
|
12
14
|
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
@@ -15,10 +17,10 @@ var _TextInput = _interopRequireDefault(require("react-native-web/dist/cjs/expor
|
|
|
15
17
|
|
|
16
18
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
17
19
|
|
|
18
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
-
|
|
20
20
|
var _ThemeProvider = require("../ThemeProvider");
|
|
21
21
|
|
|
22
|
+
var _StackView = _interopRequireDefault(require("../StackView"));
|
|
23
|
+
|
|
22
24
|
var _utils = require("../utils");
|
|
23
25
|
|
|
24
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -133,35 +135,47 @@ const selectIconTokens = _ref3 => {
|
|
|
133
135
|
};
|
|
134
136
|
};
|
|
135
137
|
|
|
136
|
-
const selectIconContainerStyles = _ref4 => {
|
|
138
|
+
const selectIconContainerStyles = (_ref4, buttonCount) => {
|
|
137
139
|
let {
|
|
140
|
+
buttonSize,
|
|
141
|
+
buttonsGapSize,
|
|
138
142
|
paddingRight,
|
|
139
143
|
paddingBottom
|
|
140
144
|
} = _ref4;
|
|
141
145
|
return {
|
|
142
|
-
paddingRight,
|
|
146
|
+
paddingRight: paddingRight + buttonCount * (buttonSize + buttonsGapSize),
|
|
143
147
|
paddingBottom
|
|
144
148
|
};
|
|
145
149
|
};
|
|
146
150
|
|
|
147
|
-
const
|
|
151
|
+
const selectButtonsContainerStyle = _ref5 => {
|
|
148
152
|
let {
|
|
149
|
-
|
|
153
|
+
buttonsPaddingRight
|
|
154
|
+
} = _ref5;
|
|
155
|
+
return {
|
|
156
|
+
paddingRight: buttonsPaddingRight
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
161
|
+
let {
|
|
162
|
+
buttons = [],
|
|
150
163
|
height,
|
|
151
|
-
initialValue,
|
|
152
164
|
inactive,
|
|
153
|
-
|
|
165
|
+
initialValue,
|
|
166
|
+
onBlur,
|
|
154
167
|
onChange,
|
|
155
168
|
onChangeText,
|
|
156
169
|
onFocus,
|
|
157
|
-
onBlur,
|
|
158
|
-
onMouseOver,
|
|
159
170
|
onMouseOut,
|
|
171
|
+
onMouseOver,
|
|
160
172
|
pattern,
|
|
173
|
+
readOnly,
|
|
161
174
|
tokens,
|
|
175
|
+
value,
|
|
162
176
|
variant = {},
|
|
163
177
|
...rest
|
|
164
|
-
} =
|
|
178
|
+
} = _ref6;
|
|
165
179
|
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
166
180
|
|
|
167
181
|
const handleFocus = event => {
|
|
@@ -220,7 +234,8 @@ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
220
234
|
};
|
|
221
235
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('TextInput', tokens, variant, states);
|
|
222
236
|
const {
|
|
223
|
-
icon: IconComponent
|
|
237
|
+
icon: IconComponent,
|
|
238
|
+
buttonsGap
|
|
224
239
|
} = themeTokens;
|
|
225
240
|
const inputProps = { ...selectProps(rest),
|
|
226
241
|
editable: !inactive,
|
|
@@ -233,7 +248,9 @@ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
233
248
|
// currentValue is being updated even if the input is not controlled, passing it down to the
|
|
234
249
|
// Input could lead to changing its state from uncontrolled to controlled
|
|
235
250
|
value: isControlled ? currentValue : undefined
|
|
236
|
-
};
|
|
251
|
+
}; // Get the actual gap value for the current viewport
|
|
252
|
+
|
|
253
|
+
const buttonsGapSize = (0, _utils.useSpacingScale)(buttonsGap);
|
|
237
254
|
const {
|
|
238
255
|
themeOptions
|
|
239
256
|
} = (0, _ThemeProvider.useTheme)();
|
|
@@ -249,32 +266,49 @@ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
249
266
|
}), IconComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
250
267
|
pointerEvents: "none" // avoid hijacking input press events
|
|
251
268
|
,
|
|
252
|
-
style: [staticStyles.iconContainer, selectIconContainerStyles(themeTokens
|
|
269
|
+
style: [staticStyles.iconContainer, selectIconContainerStyles({ ...themeTokens,
|
|
270
|
+
buttonsGapSize
|
|
271
|
+
}, buttons === null || buttons === void 0 ? void 0 : buttons.length)],
|
|
253
272
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, { ...selectIconTokens(themeTokens)
|
|
254
273
|
})
|
|
274
|
+
}), (buttons === null || buttons === void 0 ? void 0 : buttons.length) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
275
|
+
style: [staticStyles.buttonsContainer, selectButtonsContainerStyle(themeTokens)],
|
|
276
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.default, {
|
|
277
|
+
direction: "row",
|
|
278
|
+
space: buttonsGap,
|
|
279
|
+
children: buttons
|
|
280
|
+
})
|
|
255
281
|
})]
|
|
256
282
|
});
|
|
257
283
|
});
|
|
258
284
|
TextInputBase.displayName = 'TextInputBase';
|
|
259
285
|
TextInputBase.propTypes = { ...selectedSystemPropTypes,
|
|
260
|
-
|
|
286
|
+
buttons: _propTypes.default.arrayOf(_propTypes.default.node),
|
|
261
287
|
height: _propTypes.default.number,
|
|
262
|
-
initialValue: _propTypes.default.string,
|
|
263
288
|
inactive: _propTypes.default.bool,
|
|
264
|
-
|
|
289
|
+
initialValue: _propTypes.default.string,
|
|
290
|
+
onBlur: _propTypes.default.func,
|
|
265
291
|
onChange: _propTypes.default.func,
|
|
266
292
|
onChangeText: _propTypes.default.func,
|
|
267
293
|
onFocus: _propTypes.default.func,
|
|
268
|
-
onBlur: _propTypes.default.func,
|
|
269
|
-
onMouseOver: _propTypes.default.func,
|
|
270
294
|
onMouseOut: _propTypes.default.func,
|
|
295
|
+
onMouseOver: _propTypes.default.func,
|
|
296
|
+
readOnly: _propTypes.default.bool,
|
|
271
297
|
tokens: (0, _utils.getTokensPropType)('TextInput', 'TextArea'),
|
|
298
|
+
value: _propTypes.default.string,
|
|
272
299
|
variant: _utils.variantProp.propType
|
|
273
300
|
};
|
|
274
301
|
var _default = TextInputBase;
|
|
275
302
|
exports.default = _default;
|
|
276
303
|
|
|
277
304
|
const staticStyles = _StyleSheet.default.create({
|
|
305
|
+
buttonsContainer: {
|
|
306
|
+
position: 'absolute',
|
|
307
|
+
right: 0,
|
|
308
|
+
top: 0,
|
|
309
|
+
bottom: 0,
|
|
310
|
+
justifyContent: 'center'
|
|
311
|
+
},
|
|
278
312
|
iconContainer: {
|
|
279
313
|
position: 'absolute',
|
|
280
314
|
right: 0,
|
|
@@ -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 () => {
|