@telus-uds/components-web 3.2.1 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -2
- package/lib/Badge/Badge.js +2 -0
- package/lib/Card/Card.js +5 -5
- package/lib/DatePicker/DatePicker.js +20 -18
- package/lib/Footnote/Footnote.js +4 -7
- package/lib/NavigationBar/NavigationBar.js +13 -15
- package/lib/NavigationBar/NavigationSubMenu.js +1 -2
- package/lib/NavigationBar/collapseItems.js +2 -3
- package/lib/NavigationBar/resolveItemSelection.js +1 -1
- package/lib/OrderedList/OrderedList.js +2 -3
- package/lib/PriceLockup/PriceLockup.js +26 -10
- package/lib/PriceLockup/tokens.js +6 -2
- package/lib/SkeletonProvider/SkeletonImage.js +3 -4
- package/lib/SkeletonProvider/SkeletonTypography.js +5 -6
- package/lib/Table/Table.js +2 -3
- package/lib/TermsAndConditions/ExpandCollapse.js +2 -1
- package/lib/Toast/Toast.js +2 -3
- package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +1 -2
- package/lib/Video/Video.js +2 -2
- package/lib/VideoPicker/VideoPicker.js +1 -2
- package/lib/VideoPicker/VideoPickerThumbnail.js +1 -2
- package/lib/baseExports.js +1 -1
- package/lib/index.js +0 -1
- package/lib/utils/scrollToAnchor.js +2 -2
- package/lib/utils/ssr.js +7 -0
- package/lib/utils/useOverlaidPosition.js +2 -4
- package/package.json +3 -3
- package/src/Badge/Badge.jsx +2 -0
- package/src/DatePicker/DatePicker.jsx +19 -11
- package/src/PriceLockup/PriceLockup.jsx +12 -2
- package/src/PriceLockup/tokens.js +15 -3
- package/src/TermsAndConditions/ExpandCollapse.jsx +5 -1
- package/src/baseExports.js +1 -0
- package/src/index.js +0 -1
- package/src/utils/ssr.js +9 -1
- package/types/Callout.d.ts +2 -1
- package/types/Tooltip.d.ts +1 -0
- package/types/common.d.ts +1 -1
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +0 -73
- package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +0 -116
- package/lib/ExpandCollapseMini/index.js +0 -2
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +0 -72
- package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +0 -104
- package/src/ExpandCollapseMini/index.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,45 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-web
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 22 Jan 2025 21:06:14 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 3.4.0
|
|
8
|
+
|
|
9
|
+
Wed, 22 Jan 2025 21:06:14 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- `Badge`: new size variant (sergio.ramirez@telus.com)
|
|
14
|
+
- `SSR`: add router property (guillermo.peitzner@telus.com)
|
|
15
|
+
- Bump @telus-uds/components-base to v2.5.0
|
|
16
|
+
|
|
17
|
+
### Patches
|
|
18
|
+
|
|
19
|
+
- `TermsAndConditions`: throws nested button error as `Pressable` tends to render as a `button` rather than a `div` with `button` role (shahzaibkhalidmalik@outlook.com)
|
|
20
|
+
- `Tooltip`: Customized/optional props interface types update (shivam.gupta3@telus.com)
|
|
21
|
+
- `Callout`: include `tokens` to type definition. (jaime.tuyuc@telus.com)
|
|
22
|
+
|
|
23
|
+
## 3.3.0
|
|
24
|
+
|
|
25
|
+
Fri, 10 Jan 2025 21:49:25 GMT
|
|
26
|
+
|
|
27
|
+
### Minor changes
|
|
28
|
+
|
|
29
|
+
- "Search: iconLeftGap value added in the testTheme file for TextInput in Search" (35577399+JoshHC@users.noreply.github.com)
|
|
30
|
+
- `Docs`: fixed camelcase and hardcoded path for components (kristina.kirpichnikova@telus.com)
|
|
31
|
+
- `DatePicker`: update component to enable custom date formats (eduardo.pereira1@telus.com)
|
|
32
|
+
- `PriceLockup`: new tokens `centsPaddingTop` and `currencySymbolPaddingTop` added to the component to match with Koodo design in the micro variant (35577399+JoshHC@users.noreply.github.com)
|
|
33
|
+
- Bump @telus-uds/components-base to v2.4.0
|
|
34
|
+
- Bump @telus-uds/system-theme-tokens to v3.3.0
|
|
35
|
+
|
|
36
|
+
### Patches
|
|
37
|
+
|
|
38
|
+
- "`DatePicker`: calendar position issue rendered incorrectly fixed" (35577399+JoshHC@users.noreply.github.com)
|
|
39
|
+
|
|
7
40
|
## 3.2.1
|
|
8
41
|
|
|
9
|
-
Thu, 19 Dec 2024
|
|
42
|
+
Thu, 19 Dec 2024 05:02:20 GMT
|
|
10
43
|
|
|
11
44
|
### Patches
|
|
12
45
|
|
package/lib/Badge/Badge.js
CHANGED
package/lib/Card/Card.js
CHANGED
|
@@ -92,9 +92,9 @@ const Card = /*#__PURE__*/React.forwardRef(function () {
|
|
|
92
92
|
const {
|
|
93
93
|
borderRadius
|
|
94
94
|
} = useThemeTokens('Card', tokens, variant);
|
|
95
|
-
const getThemeTokens = useThemeTokensCallback('Card', interactiveCard
|
|
95
|
+
const getThemeTokens = useThemeTokensCallback('Card', interactiveCard?.tokens, {
|
|
96
96
|
interactive: true,
|
|
97
|
-
...(
|
|
97
|
+
...(interactiveCard?.variant || {})
|
|
98
98
|
});
|
|
99
99
|
const hasFooter = Boolean(footer);
|
|
100
100
|
const fullBleedBorderRadius = getFullBleedBorderRadius(borderRadius, fullBleedContentPosition, hasFooter);
|
|
@@ -118,7 +118,7 @@ const Card = /*#__PURE__*/React.forwardRef(function () {
|
|
|
118
118
|
display: imgColCurrentViewport === 0 ? 'none' : undefined
|
|
119
119
|
};
|
|
120
120
|
const columnFlex = {
|
|
121
|
-
flexGrow: interactiveCard
|
|
121
|
+
flexGrow: interactiveCard?.body ? 0 : 1,
|
|
122
122
|
flexShrink: 1,
|
|
123
123
|
justifyContent: 'space-between'
|
|
124
124
|
};
|
|
@@ -140,13 +140,13 @@ const Card = /*#__PURE__*/React.forwardRef(function () {
|
|
|
140
140
|
tokens: restOfTokens,
|
|
141
141
|
backgroundImage: backgroundImage,
|
|
142
142
|
...selectProps(rest),
|
|
143
|
-
children: [interactiveCard
|
|
143
|
+
children: [interactiveCard?.body ? /*#__PURE__*/_jsx(PressableCardBase, {
|
|
144
144
|
ref: ref,
|
|
145
145
|
tokens: getThemeTokens,
|
|
146
146
|
dataSet: dataSet,
|
|
147
147
|
onPress: onPress,
|
|
148
148
|
...selectProps(rest),
|
|
149
|
-
children: typeof
|
|
149
|
+
children: typeof interactiveCard?.body === 'function' ? interactiveCard.body() : interactiveCard.body
|
|
150
150
|
}) : null, children || fullBleedContentPosition !== 'none' ? /*#__PURE__*/_jsxs(StackView, {
|
|
151
151
|
direction: contentStackDirection,
|
|
152
152
|
tokens: {
|
|
@@ -14,8 +14,6 @@ const {
|
|
|
14
14
|
styled
|
|
15
15
|
} = styledComponents;
|
|
16
16
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
17
|
-
const dateFormat = 'DD / MM / YYYY';
|
|
18
|
-
const dateFormatWithoutSpaces = 'DD/MM/YYYY';
|
|
19
17
|
const getResponsiveDaySize = function () {
|
|
20
18
|
let inline = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
21
19
|
let viewport = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'md';
|
|
@@ -55,7 +53,6 @@ const PortalPositionedContainer = styled.div({
|
|
|
55
53
|
return `${top}px`;
|
|
56
54
|
}
|
|
57
55
|
});
|
|
58
|
-
const validDatePattern = /^([0-2][0-9]|3[0-1])(\/)(0[1-9]|1[0-2])\2(\d{4})$/;
|
|
59
56
|
const getInitialVisibleMonth = (initialVisibleMonth, inputDate) => {
|
|
60
57
|
if (initialVisibleMonth === '' || inputDate instanceof moment) {
|
|
61
58
|
return null;
|
|
@@ -85,11 +82,11 @@ const getInitialVisibleMonth = (initialVisibleMonth, inputDate) => {
|
|
|
85
82
|
* - Recommended for viewports greater than or equal to 576px
|
|
86
83
|
*/
|
|
87
84
|
const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
88
|
-
var _dictionary$copy;
|
|
89
85
|
let {
|
|
90
86
|
copy = 'en',
|
|
91
87
|
id,
|
|
92
88
|
date,
|
|
89
|
+
dateFormat = 'DD / MM / YYYY',
|
|
93
90
|
feedback,
|
|
94
91
|
inline = false,
|
|
95
92
|
isDayDisabled,
|
|
@@ -104,12 +101,13 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
104
101
|
disabled = false,
|
|
105
102
|
prevTestID = '',
|
|
106
103
|
nextTestID = '',
|
|
107
|
-
placeholder =
|
|
104
|
+
placeholder = dateFormat,
|
|
108
105
|
initialVisibleMonth = '',
|
|
109
106
|
...rest
|
|
110
107
|
} = _ref3;
|
|
111
108
|
const [inputDate, setInputDate] = React.useState(date instanceof moment ? date : undefined);
|
|
112
109
|
const [inputText, setInputText] = React.useState(date instanceof moment ? date.format(dateFormat) : '');
|
|
110
|
+
const dateFormatWithoutSpaces = dateFormat.replace(/\s/g, '');
|
|
113
111
|
const textInputRef = React.useRef();
|
|
114
112
|
const prevButtonRef = React.useRef();
|
|
115
113
|
const [datePickerPosition, setDatePickerPosition] = React.useState({
|
|
@@ -119,7 +117,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
119
117
|
const datePickerRef = React.useRef(null);
|
|
120
118
|
useSafeLayoutEffect(() => {
|
|
121
119
|
const updateDatePickerPosition = () => {
|
|
122
|
-
if (inline || !
|
|
120
|
+
if (inline || !textInputRef?.current) return;
|
|
123
121
|
const {
|
|
124
122
|
left,
|
|
125
123
|
top
|
|
@@ -136,7 +134,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
136
134
|
});
|
|
137
135
|
|
|
138
136
|
// Initial call to set the position
|
|
139
|
-
|
|
137
|
+
throttledUpdate();
|
|
140
138
|
|
|
141
139
|
// Register event listeners
|
|
142
140
|
window.addEventListener('resize', throttledUpdate);
|
|
@@ -165,7 +163,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
165
163
|
setInputDate(date);
|
|
166
164
|
setInputText(date instanceof moment ? date.format(dateFormat) : '');
|
|
167
165
|
}
|
|
168
|
-
}, [date, inputDate]);
|
|
166
|
+
}, [date, inputDate, dateFormat]);
|
|
169
167
|
React.useEffect(() => {
|
|
170
168
|
let timeoutId;
|
|
171
169
|
if (prevButtonRef.current && isFocused) {
|
|
@@ -175,8 +173,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
175
173
|
}, [isFocused]);
|
|
176
174
|
React.useEffect(() => {
|
|
177
175
|
if (inputText !== '' && inputDate !== undefined) {
|
|
178
|
-
|
|
179
|
-
textInputRef === null || textInputRef === void 0 || (_textInputRef$current = textInputRef.current) === null || _textInputRef$current === void 0 || _textInputRef$current.focus();
|
|
176
|
+
textInputRef?.current?.focus();
|
|
180
177
|
}
|
|
181
178
|
}, [inputDate, inputText]);
|
|
182
179
|
const onFocusChange = _ref4 => {
|
|
@@ -217,10 +214,10 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
217
214
|
if (value === '' || moment(value.replace(/\s/g, ''), dateFormatWithoutSpaces, true).isValid()) {
|
|
218
215
|
if (value === '') {
|
|
219
216
|
setInputDate(undefined); // Set inputDate to undefined if input is empty
|
|
220
|
-
onDateChange
|
|
217
|
+
onDateChange?.(undefined);
|
|
221
218
|
} else {
|
|
222
219
|
setInputDate(moment(value, dateFormat));
|
|
223
|
-
onDateChange
|
|
220
|
+
onDateChange?.(moment(value, dateFormat));
|
|
224
221
|
}
|
|
225
222
|
setInputText(value === '' ? '' : moment(value, dateFormatWithoutSpaces).format(dateFormat));
|
|
226
223
|
} else {
|
|
@@ -230,11 +227,13 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
230
227
|
const handleOnKeyPress = event => {
|
|
231
228
|
if (event.key === 'Backspace' && inputText === '') {
|
|
232
229
|
setInputDate(undefined);
|
|
233
|
-
onDateChange
|
|
230
|
+
onDateChange?.(undefined);
|
|
234
231
|
}
|
|
235
232
|
};
|
|
236
233
|
const handleValidation = inputValidation => {
|
|
237
|
-
|
|
234
|
+
const momentDate = moment(inputText, dateFormat, true);
|
|
235
|
+
const isValidDate = momentDate.isValid();
|
|
236
|
+
if (!isValidDate && inputText !== '') {
|
|
238
237
|
return 'error';
|
|
239
238
|
}
|
|
240
239
|
if (inputValidation === 'error' || inputValidation === 'success') {
|
|
@@ -368,7 +367,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
368
367
|
onKeyPress: handleOnKeyPress,
|
|
369
368
|
tooltip: tooltip,
|
|
370
369
|
hintPosition: hintPosition,
|
|
371
|
-
label: label ??
|
|
370
|
+
label: label ?? dictionary[copy]?.roleDescription,
|
|
372
371
|
value: inputText,
|
|
373
372
|
validation: handleValidation(validation),
|
|
374
373
|
inactive: disabled,
|
|
@@ -443,8 +442,11 @@ DatePicker.propTypes = {
|
|
|
443
442
|
*/
|
|
444
443
|
date: momentPropTypes.momentObj,
|
|
445
444
|
/**
|
|
446
|
-
* A
|
|
447
|
-
|
|
445
|
+
* A Moment instance representing the currently selected date, i.e. `moment()`
|
|
446
|
+
*/
|
|
447
|
+
dateFormat: PropTypes.string,
|
|
448
|
+
/**
|
|
449
|
+
* Optional date format for the date input. If not set, the default value will be `DD / MM / YYYY`
|
|
448
450
|
*/
|
|
449
451
|
feedback: PropTypes.string,
|
|
450
452
|
/**
|
|
@@ -499,7 +501,7 @@ DatePicker.propTypes = {
|
|
|
499
501
|
*/
|
|
500
502
|
nextTestID: PropTypes.string,
|
|
501
503
|
/**
|
|
502
|
-
* Optional placeholder for the date input. If not set the default value will be
|
|
504
|
+
* Optional placeholder for the date input. If not set, the default value will be equal to the `dateFormat` prop
|
|
503
505
|
*/
|
|
504
506
|
placeholder: PropTypes.string,
|
|
505
507
|
/**
|
package/lib/Footnote/Footnote.js
CHANGED
|
@@ -220,7 +220,6 @@ const usePrevious = value => {
|
|
|
220
220
|
* - When `Footnote` is closed, focus must return to the initiating element
|
|
221
221
|
*/
|
|
222
222
|
const Footnote = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
223
|
-
var _theme$themeOptions;
|
|
224
223
|
const {
|
|
225
224
|
copy = 'en',
|
|
226
225
|
number,
|
|
@@ -290,7 +289,7 @@ const Footnote = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
290
289
|
});
|
|
291
290
|
const prevProps = usePrevious(props);
|
|
292
291
|
const theme = useTheme();
|
|
293
|
-
const maxWidth = useResponsiveProp(
|
|
292
|
+
const maxWidth = useResponsiveProp(theme.themeOptions?.contentMaxWidth);
|
|
294
293
|
const [isScrollable, setIsScrollable] = React.useState(false);
|
|
295
294
|
const closeFootnote = React.useCallback((event, options) => {
|
|
296
295
|
onClose(event, options);
|
|
@@ -304,7 +303,6 @@ const Footnote = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
304
303
|
* if there are no interactive elements the focus will remain inside the close button.
|
|
305
304
|
*/
|
|
306
305
|
const manageFootnoteFocusAndClose = React.useCallback(event => {
|
|
307
|
-
var _footnoteRef$current, _footnoteRef$current2;
|
|
308
306
|
if (!isVisible) {
|
|
309
307
|
return;
|
|
310
308
|
}
|
|
@@ -325,11 +323,11 @@ const Footnote = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
325
323
|
firstElement.focus();
|
|
326
324
|
}
|
|
327
325
|
}
|
|
328
|
-
} else if ((event.type === 'click' || event.type === 'mousedown') && footnoteRef
|
|
326
|
+
} else if ((event.type === 'click' || event.type === 'mousedown') && footnoteRef?.current && event.target && !footnoteRef?.current?.contains(event.target) && event.target.getAttribute('data-tds-id') !== 'footnote-link') {
|
|
329
327
|
closeFootnote(event, {
|
|
330
328
|
returnFocus: false
|
|
331
329
|
});
|
|
332
|
-
} else if (event.type === 'touchstart' && footnoteRef
|
|
330
|
+
} else if (event.type === 'touchstart' && footnoteRef?.current && event.touches[0].target && !footnoteRef?.current?.contains(event.touches[0].target) && event.touches[0].target.getAttribute('data-tds-id') !== 'footnote-link') {
|
|
333
331
|
closeFootnote(event, {
|
|
334
332
|
returnFocus: false
|
|
335
333
|
});
|
|
@@ -381,8 +379,7 @@ const Footnote = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
381
379
|
|
|
382
380
|
// Set height of header on mount
|
|
383
381
|
React.useEffect(() => {
|
|
384
|
-
|
|
385
|
-
setHeaderHeight((_headerRef$current = headerRef.current) === null || _headerRef$current === void 0 ? void 0 : _headerRef$current.offsetHeight);
|
|
382
|
+
setHeaderHeight(headerRef.current?.offsetHeight);
|
|
386
383
|
}, []);
|
|
387
384
|
const preventDefault = event => {
|
|
388
385
|
if (!bodyRef.current.contains(event.touches[0].target)) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
var _withLinkRouter$propT, _withLinkRouter$propT2, _withLinkRouter$propT3, _withLinkRouter$propT4;
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
import { selectSystemProps, StackView, Typography, useHash, useInputValue, useResponsiveProp, withLinkRouter } from '@telus-uds/components-base';
|
|
@@ -59,14 +58,14 @@ const NavigationBar = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
59
58
|
let {
|
|
60
59
|
items: parentItems
|
|
61
60
|
} = _ref3;
|
|
62
|
-
return parentItems
|
|
61
|
+
return parentItems?.some(_ref4 => {
|
|
63
62
|
let {
|
|
64
63
|
href
|
|
65
64
|
} = _ref4;
|
|
66
65
|
return hash === href;
|
|
67
66
|
});
|
|
68
67
|
});
|
|
69
|
-
hashItem = parentItem
|
|
68
|
+
hashItem = parentItem?.items.find(_ref5 => {
|
|
70
69
|
let {
|
|
71
70
|
href
|
|
72
71
|
} = _ref5;
|
|
@@ -87,14 +86,13 @@ const NavigationBar = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
87
86
|
const openOverlayRef = React.useRef(null);
|
|
88
87
|
const [openSubMenuId, setOpenSubMenuId] = React.useState(null);
|
|
89
88
|
const handleSubMenuClose = event => {
|
|
90
|
-
var _openOverlayRef$curre, _openOverlayRef$curre2;
|
|
91
89
|
if (event.type === 'keydown') {
|
|
92
90
|
if (event.key === 'Escape' || event.key === 27) {
|
|
93
91
|
setOpenSubMenuId(null);
|
|
94
92
|
}
|
|
95
|
-
} else if (event.type === 'click' && openOverlayRef
|
|
93
|
+
} else if (event.type === 'click' && openOverlayRef?.current && event.target && !openOverlayRef?.current?.contains(event.target)) {
|
|
96
94
|
setOpenSubMenuId(null);
|
|
97
|
-
} else if (event.type === 'touchstart' && openOverlayRef
|
|
95
|
+
} else if (event.type === 'touchstart' && openOverlayRef?.current && event.touches[0].target && !openOverlayRef?.current?.contains(event.touches[0].target)) {
|
|
98
96
|
setOpenSubMenuId(null);
|
|
99
97
|
}
|
|
100
98
|
};
|
|
@@ -155,7 +153,7 @@ const NavigationBar = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
155
153
|
heading: headingLevel,
|
|
156
154
|
children: heading
|
|
157
155
|
})
|
|
158
|
-
}), itemsForViewport
|
|
156
|
+
}), itemsForViewport?.map((_ref6, index) => {
|
|
159
157
|
let {
|
|
160
158
|
href,
|
|
161
159
|
label,
|
|
@@ -173,22 +171,22 @@ const NavigationBar = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
173
171
|
setOpenSubMenuId(openSubMenuId !== itemId ? itemId : null);
|
|
174
172
|
return;
|
|
175
173
|
}
|
|
176
|
-
if (href
|
|
174
|
+
if (href?.startsWith('#')) {
|
|
177
175
|
scrollToAnchor(href, event, () => setValue(itemId, event));
|
|
178
176
|
} else {
|
|
179
177
|
setValue(itemId, event);
|
|
180
178
|
}
|
|
181
|
-
onClick
|
|
179
|
+
onClick?.(event);
|
|
182
180
|
};
|
|
183
181
|
const ItemComponent = nestedItems ? NavigationSubMenu : NavigationItem;
|
|
184
182
|
const isOpen = itemId === openSubMenuId;
|
|
185
|
-
const scrollableNestedItems =
|
|
183
|
+
const scrollableNestedItems = nestedItems?.map(item => ({
|
|
186
184
|
...item,
|
|
187
185
|
onPress: event => {
|
|
188
186
|
const nestedItemId = item.id ?? item.label;
|
|
189
187
|
scrollToAnchor(item.href, event, () => setValue(nestedItemId, event));
|
|
190
188
|
}
|
|
191
|
-
}))
|
|
189
|
+
})) ?? nestedItems;
|
|
192
190
|
return /*#__PURE__*/_jsx(ItemComponent, {
|
|
193
191
|
ref: itemRef,
|
|
194
192
|
href: href,
|
|
@@ -235,8 +233,8 @@ NavigationBar.propTypes = {
|
|
|
235
233
|
id: PropTypes.string.isRequired,
|
|
236
234
|
onClick: PropTypes.func,
|
|
237
235
|
selected: PropTypes.bool,
|
|
238
|
-
LinkRouter:
|
|
239
|
-
linkRouterProps:
|
|
236
|
+
LinkRouter: withLinkRouter.propTypes?.LinkRouter,
|
|
237
|
+
linkRouterProps: withLinkRouter.propTypes?.linkRouterProps,
|
|
240
238
|
// One layer of nested links is allowed
|
|
241
239
|
items: PropTypes.arrayOf(PropTypes.shape({
|
|
242
240
|
label: PropTypes.string.isRequired,
|
|
@@ -244,8 +242,8 @@ NavigationBar.propTypes = {
|
|
|
244
242
|
id: PropTypes.string.isRequired,
|
|
245
243
|
onClick: PropTypes.func,
|
|
246
244
|
selected: PropTypes.bool,
|
|
247
|
-
LinkRouter:
|
|
248
|
-
linkRouterProps:
|
|
245
|
+
LinkRouter: withLinkRouter.propTypes?.LinkRouter,
|
|
246
|
+
linkRouterProps: withLinkRouter.propTypes?.linkRouterProps
|
|
249
247
|
}))
|
|
250
248
|
})).isRequired,
|
|
251
249
|
/**
|
|
@@ -99,7 +99,6 @@ const NavigationSubMenu = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
99
99
|
icon: icoMenu,
|
|
100
100
|
tokens: tokens,
|
|
101
101
|
children: _ref2 => {
|
|
102
|
-
var _textStyles$;
|
|
103
102
|
let {
|
|
104
103
|
textStyles
|
|
105
104
|
} = _ref2;
|
|
@@ -109,7 +108,7 @@ const NavigationSubMenu = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
109
108
|
size: 'micro'
|
|
110
109
|
},
|
|
111
110
|
tokens: {
|
|
112
|
-
color:
|
|
111
|
+
color: textStyles[0]?.color
|
|
113
112
|
}
|
|
114
113
|
}, `${id}_icon`)];
|
|
115
114
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Make a list of items into a one-item list where all items are nested under the first item
|
|
3
3
|
*/
|
|
4
4
|
const collapseItems = (items, selectedId) => {
|
|
5
|
-
if (!
|
|
5
|
+
if (!items?.length) return items;
|
|
6
6
|
|
|
7
7
|
// Give the root item the label of the current active link
|
|
8
8
|
// (or the first item if for some reason there's no match on the selectedId)
|
|
@@ -17,12 +17,11 @@ const collapseItems = (items, selectedId) => {
|
|
|
17
17
|
|
|
18
18
|
// Linter doesn't like for loops, simulate loop that breaks
|
|
19
19
|
items.some(item => {
|
|
20
|
-
var _item$items;
|
|
21
20
|
if (isSelected(item)) {
|
|
22
21
|
rootLabel = item.label;
|
|
23
22
|
return true; // break
|
|
24
23
|
}
|
|
25
|
-
const nestedMatch =
|
|
24
|
+
const nestedMatch = item.items?.find(isSelected);
|
|
26
25
|
if (nestedMatch) {
|
|
27
26
|
rootLabel = nestedMatch.label;
|
|
28
27
|
return true; // break
|
|
@@ -7,7 +7,7 @@ const resolveItemSelection = (_ref, selectedId) => {
|
|
|
7
7
|
const itemId = id ?? label;
|
|
8
8
|
|
|
9
9
|
// Treat item as selected if it or any nested child matches the selected id
|
|
10
|
-
const selected = Boolean(selectedId === itemId ||
|
|
10
|
+
const selected = Boolean(selectedId === itemId || items?.some(item => resolveItemSelection(item, selectedId).selected));
|
|
11
11
|
return {
|
|
12
12
|
itemId,
|
|
13
13
|
selected
|
|
@@ -38,9 +38,8 @@ const OrderedList = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
38
38
|
// Pass any variants and tokens "OrderedList" receives down to the individual list items.
|
|
39
39
|
const childrenWithParentVariantsAndTokens = React.useMemo(() => {
|
|
40
40
|
const addVariantAndTokensToProps = child => {
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const existingChildTokens = ((_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.tokens) ?? {};
|
|
41
|
+
const existingChildVariants = child.props?.variant ?? {};
|
|
42
|
+
const existingChildTokens = child.props?.tokens ?? {};
|
|
44
43
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
45
44
|
variant: {
|
|
46
45
|
...existingChildVariants,
|
|
@@ -117,13 +117,22 @@ const StrikeThroughContainer = styled.div`
|
|
|
117
117
|
position: absolute;
|
|
118
118
|
}
|
|
119
119
|
`;
|
|
120
|
-
const
|
|
120
|
+
const TypographyContainer = styled.div`
|
|
121
|
+
display: flex;
|
|
122
|
+
padding-top: ${_ref13 => {
|
|
123
|
+
let {
|
|
124
|
+
paddingTop
|
|
125
|
+
} = _ref13;
|
|
126
|
+
return `${paddingTop || 0}px`;
|
|
127
|
+
}};
|
|
128
|
+
`;
|
|
129
|
+
const selectFootnoteLinkStyles = _ref14 => {
|
|
121
130
|
let {
|
|
122
131
|
footnoteLinkColor,
|
|
123
132
|
footnoteLinkFontName,
|
|
124
133
|
footnoteLinkFontWeight,
|
|
125
134
|
footnoteLinkLineHeight
|
|
126
|
-
} =
|
|
135
|
+
} = _ref14;
|
|
127
136
|
return {
|
|
128
137
|
color: footnoteLinkColor,
|
|
129
138
|
fontName: footnoteLinkFontName,
|
|
@@ -131,19 +140,19 @@ const selectFootnoteLinkStyles = _ref13 => {
|
|
|
131
140
|
lineHeight: footnoteLinkLineHeight
|
|
132
141
|
};
|
|
133
142
|
};
|
|
134
|
-
const selectStrikeThroughTokens =
|
|
143
|
+
const selectStrikeThroughTokens = _ref15 => {
|
|
135
144
|
let {
|
|
136
145
|
strikeThroughPosition,
|
|
137
146
|
strikeThroughHeight,
|
|
138
147
|
strikeThroughColor
|
|
139
|
-
} =
|
|
148
|
+
} = _ref15;
|
|
140
149
|
return {
|
|
141
150
|
strikeThroughHeight,
|
|
142
151
|
strikeThroughPosition,
|
|
143
152
|
strikeThroughColor
|
|
144
153
|
};
|
|
145
154
|
};
|
|
146
|
-
const PriceLockup = /*#__PURE__*/React.forwardRef((
|
|
155
|
+
const PriceLockup = /*#__PURE__*/React.forwardRef((_ref16, ref) => {
|
|
147
156
|
let {
|
|
148
157
|
size = 'medium',
|
|
149
158
|
signDirection = 'left',
|
|
@@ -160,7 +169,7 @@ const PriceLockup = /*#__PURE__*/React.forwardRef((_ref15, ref) => {
|
|
|
160
169
|
tokens: priceLockupTokens,
|
|
161
170
|
variant = {},
|
|
162
171
|
...rest
|
|
163
|
-
} =
|
|
172
|
+
} = _ref16;
|
|
164
173
|
const viewport = useViewport();
|
|
165
174
|
const {
|
|
166
175
|
footnoteMarginTop,
|
|
@@ -193,6 +202,10 @@ const PriceLockup = /*#__PURE__*/React.forwardRef((_ref15, ref) => {
|
|
|
193
202
|
const amount = hasCents ? priceString.substring(0, separatorPosition) : priceString;
|
|
194
203
|
const cents = hasCents ? priceString.substring(separatorPosition + 1) : null;
|
|
195
204
|
const renderTypography = (value, tokens, position) => {
|
|
205
|
+
const {
|
|
206
|
+
paddingTop,
|
|
207
|
+
...restOfTokens
|
|
208
|
+
} = tokens;
|
|
196
209
|
const customProps = position === 'bottom' ? {
|
|
197
210
|
variant: {
|
|
198
211
|
size: 'micro'
|
|
@@ -202,13 +215,16 @@ const PriceLockup = /*#__PURE__*/React.forwardRef((_ref15, ref) => {
|
|
|
202
215
|
}
|
|
203
216
|
} : {
|
|
204
217
|
tokens: {
|
|
205
|
-
...
|
|
218
|
+
...restOfTokens,
|
|
206
219
|
color: fontColor
|
|
207
220
|
}
|
|
208
221
|
};
|
|
209
|
-
return /*#__PURE__*/_jsx(
|
|
210
|
-
|
|
211
|
-
children:
|
|
222
|
+
return /*#__PURE__*/_jsx(TypographyContainer, {
|
|
223
|
+
paddingTop: paddingTop,
|
|
224
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
225
|
+
...customProps,
|
|
226
|
+
children: value
|
|
227
|
+
})
|
|
212
228
|
});
|
|
213
229
|
};
|
|
214
230
|
const renderCurrencySymbol = () => renderTypography(`${currencySymbol}`, typographyTokens.dollarSign);
|
|
@@ -7,12 +7,14 @@ export default _ref => {
|
|
|
7
7
|
currencySymbolFontSize,
|
|
8
8
|
currencySymbolLineHeight,
|
|
9
9
|
currencySymbolFontWeight,
|
|
10
|
+
currencySymbolPaddingTop,
|
|
10
11
|
amountFontSize,
|
|
11
12
|
amountLineHeight,
|
|
12
13
|
amountLetterSpacing,
|
|
13
14
|
amountFontWeight,
|
|
14
15
|
centsFontSize,
|
|
15
16
|
centsLineHeight,
|
|
17
|
+
centsPaddingTop,
|
|
16
18
|
rateFontSize,
|
|
17
19
|
rateLineHeight,
|
|
18
20
|
bottomTextFontSize,
|
|
@@ -28,7 +30,8 @@ export default _ref => {
|
|
|
28
30
|
dollarSign: {
|
|
29
31
|
fontSize: currencySymbolFontSize,
|
|
30
32
|
lineHeight: currencySymbolLineHeight,
|
|
31
|
-
fontWeight: currencySymbolFontWeight
|
|
33
|
+
fontWeight: currencySymbolFontWeight,
|
|
34
|
+
paddingTop: currencySymbolPaddingTop
|
|
32
35
|
},
|
|
33
36
|
amount: {
|
|
34
37
|
color: fontColor,
|
|
@@ -40,7 +43,8 @@ export default _ref => {
|
|
|
40
43
|
cents: {
|
|
41
44
|
fontSize: centsFontSize,
|
|
42
45
|
lineHeight: centsLineHeight,
|
|
43
|
-
fontWeight: centsFontWeight
|
|
46
|
+
fontWeight: centsFontWeight,
|
|
47
|
+
paddingTop: centsPaddingTop
|
|
44
48
|
},
|
|
45
49
|
rate: {
|
|
46
50
|
fontSize: rateFontSize,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
var _Skeleton$propTypes, _Skeleton$propTypes2, _Skeleton$propTypes3;
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
import { Skeleton } from '@telus-uds/components-base';
|
|
@@ -30,9 +29,9 @@ SkeletonImage.displayName = 'SkeletonImage';
|
|
|
30
29
|
SkeletonImage.propTypes = {
|
|
31
30
|
imgHeight: PropTypes.number,
|
|
32
31
|
rounded: PropTypes.oneOf(['circle', 'corners']),
|
|
33
|
-
size:
|
|
34
|
-
sizeIndex:
|
|
35
|
-
sizePixels:
|
|
32
|
+
size: Skeleton.propTypes?.size,
|
|
33
|
+
sizeIndex: Skeleton.propTypes?.sizeIndex,
|
|
34
|
+
sizePixels: Skeleton.propTypes?.sizePixels,
|
|
36
35
|
show: PropTypes.bool.isRequired,
|
|
37
36
|
children: PropTypes.node
|
|
38
37
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
var _Skeleton$propTypes, _Skeleton$propTypes2, _Skeleton$propTypes3, _Skeleton$propTypes4, _Skeleton$propTypes5;
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
import { Skeleton } from '@telus-uds/components-base';
|
|
@@ -29,10 +28,10 @@ SkeletonTypography.displayName = 'SkeletonTypography';
|
|
|
29
28
|
SkeletonTypography.propTypes = {
|
|
30
29
|
show: PropTypes.bool.isRequired,
|
|
31
30
|
children: PropTypes.node,
|
|
32
|
-
size:
|
|
33
|
-
sizeIndex:
|
|
34
|
-
sizePixels:
|
|
35
|
-
characters:
|
|
36
|
-
lines:
|
|
31
|
+
size: Skeleton.propTypes?.size,
|
|
32
|
+
sizeIndex: Skeleton.propTypes?.sizeIndex,
|
|
33
|
+
sizePixels: Skeleton.propTypes?.sizePixels,
|
|
34
|
+
characters: Skeleton.propTypes?.characters,
|
|
35
|
+
lines: Skeleton.propTypes?.lines
|
|
37
36
|
};
|
|
38
37
|
export default SkeletonTypography;
|
package/lib/Table/Table.js
CHANGED
|
@@ -62,9 +62,8 @@ const Table = _ref2 => {
|
|
|
62
62
|
const [tableWidth, setTableWidth] = React.useState(0);
|
|
63
63
|
useSafeLayoutEffect(() => {
|
|
64
64
|
const updateDimensions = () => {
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
const responsiveTableWidth = fullWidth ? containerClientWidth : (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.clientWidth;
|
|
65
|
+
const containerClientWidth = containerRef.current?.clientWidth;
|
|
66
|
+
const responsiveTableWidth = fullWidth ? containerClientWidth : tableRef.current?.clientWidth;
|
|
68
67
|
setContainerWidth(containerClientWidth);
|
|
69
68
|
setTableWidth(responsiveTableWidth);
|
|
70
69
|
};
|
|
@@ -114,7 +114,8 @@ const ExpandCollapse = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
|
|
|
114
114
|
},
|
|
115
115
|
tokens: iconTokens,
|
|
116
116
|
focusable: false,
|
|
117
|
-
accessibilityLabel: label
|
|
117
|
+
accessibilityLabel: label,
|
|
118
|
+
accessibilityRole: "none"
|
|
118
119
|
})
|
|
119
120
|
}), /*#__PURE__*/_jsx(ExpandCollapseTitle, {
|
|
120
121
|
tokens: getTokens(),
|
package/lib/Toast/Toast.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
var _withLinkRouter$propT, _withLinkRouter$propT2;
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
import { ChevronLink, selectSystemProps, useThemeTokens, Typography, withLinkRouter, Spacer, useViewport, getTokensPropType } from '@telus-uds/components-base';
|
|
@@ -201,8 +200,8 @@ Toast.propTypes = {
|
|
|
201
200
|
link: PropTypes.shape({
|
|
202
201
|
href: PropTypes.string.isRequired,
|
|
203
202
|
text: PropTypes.string.isRequired,
|
|
204
|
-
LinkRouter:
|
|
205
|
-
linkRouterProps:
|
|
203
|
+
LinkRouter: withLinkRouter.propTypes?.LinkRouter,
|
|
204
|
+
linkRouterProps: withLinkRouter.propTypes?.linkRouterProps
|
|
206
205
|
})
|
|
207
206
|
};
|
|
208
207
|
export default Toast;
|