@telus-uds/components-web 2.33.2 → 2.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -3
- package/lib/Badge/Badge.js +4 -2
- package/lib/BlockQuote/BlockQuote.js +4 -2
- package/lib/Breadcrumbs/Breadcrumbs.js +7 -5
- package/lib/Breadcrumbs/Item/Item.js +2 -13
- package/lib/Callout/Callout.js +4 -2
- package/lib/Card/Card.js +3 -5
- package/lib/Card/CardContent.js +4 -2
- package/lib/Countdown/Countdown.js +2 -6
- package/lib/Countdown/Segment.js +4 -2
- package/lib/DatePicker/CalendarContainer.js +2 -2
- package/lib/DatePicker/DatePicker.js +21 -35
- package/lib/Disclaimer/Disclaimer.js +4 -2
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +5 -11
- package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +4 -2
- package/lib/Footnote/Footnote.js +32 -37
- package/lib/Footnote/FootnoteLink.js +5 -6
- package/lib/IconButton/IconButton.js +4 -11
- package/lib/Image/Image.js +5 -3
- package/lib/List/ListItem.js +2 -7
- package/lib/NavigationBar/NavigationBar.js +8 -18
- package/lib/NavigationBar/NavigationItem.js +4 -9
- package/lib/NavigationBar/NavigationSubMenu.js +8 -7
- package/lib/NavigationBar/index.js +2 -0
- package/lib/OptimizeImage/OptimizeImage.js +8 -8
- package/lib/OrderedList/Item.js +3 -9
- package/lib/OrderedList/OrderedList.js +5 -13
- package/lib/OrderedList/OrderedListBase.js +3 -8
- package/lib/Paragraph/Paragraph.js +5 -3
- package/lib/PreviewCard/PreviewCard.js +3 -5
- package/lib/PriceLockup/PriceLockup.js +4 -2
- package/lib/Progress/ProgressBar.js +4 -2
- package/lib/QuantitySelector/QuantitySelector.js +21 -24
- package/lib/QuantitySelector/SideButton.js +12 -20
- package/lib/ResponsiveImage/ResponsiveImage.js +4 -2
- package/lib/Ribbon/Ribbon.js +4 -2
- package/lib/SkeletonProvider/SkeletonImage.js +5 -3
- package/lib/SkeletonProvider/SkeletonProvider.js +3 -5
- package/lib/SkeletonProvider/SkeletonTypography.js +5 -3
- package/lib/Span/Span.js +5 -3
- package/lib/Spinner/Spinner.js +4 -2
- package/lib/Spinner/SpinnerContent.js +4 -2
- package/lib/StoryCard/StoryCard.js +3 -5
- package/lib/Table/Body.js +4 -2
- package/lib/Table/Cell.js +5 -3
- package/lib/Table/Header.js +6 -6
- package/lib/Table/Row.js +6 -6
- package/lib/Table/SubHeading.js +6 -6
- package/lib/Table/Table.js +6 -8
- package/lib/TermsAndConditions/ExpandCollapse.js +2 -7
- package/lib/TermsAndConditions/TermsAndConditions.js +5 -14
- package/lib/Testimonial/Testimonial.js +4 -2
- package/lib/Toast/Toast.js +4 -2
- package/lib/Video/Video.js +19 -55
- package/lib/VideoPicker/VideoPicker.js +38 -9
- package/lib/VideoPicker/VideoPickerPlayer.js +4 -2
- package/lib/VideoPicker/VideoPickerThumbnail.js +4 -2
- package/lib/VideoPicker/VideoSlider.js +7 -7
- package/lib/WaffleGrid/WaffleGrid.js +4 -2
- package/lib/WebVideo/WebVideo.js +51 -13
- package/lib/WebVideo/utils/index.js +58 -0
- package/lib/baseExports.js +6 -0
- package/lib/utils/theming/with-client-theme.js +1 -1
- package/lib/utils/theming/with-server-theme.js +1 -1
- package/lib-module/Badge/Badge.js +4 -2
- package/lib-module/BlockQuote/BlockQuote.js +4 -2
- package/lib-module/Breadcrumbs/Breadcrumbs.js +7 -5
- package/lib-module/Breadcrumbs/Item/Item.js +2 -11
- package/lib-module/Callout/Callout.js +4 -2
- package/lib-module/Card/Card.js +2 -3
- package/lib-module/Card/CardContent.js +4 -2
- package/lib-module/Countdown/Countdown.js +2 -3
- package/lib-module/Countdown/Segment.js +4 -2
- package/lib-module/DatePicker/CalendarContainer.js +2 -2
- package/lib-module/DatePicker/DatePicker.js +21 -33
- package/lib-module/Disclaimer/Disclaimer.js +4 -2
- package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +5 -9
- package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +4 -2
- package/lib-module/Footnote/Footnote.js +31 -36
- package/lib-module/Footnote/FootnoteLink.js +5 -7
- package/lib-module/IconButton/IconButton.js +4 -9
- package/lib-module/Image/Image.js +5 -3
- package/lib-module/List/ListItem.js +2 -5
- package/lib-module/NavigationBar/NavigationBar.js +9 -17
- package/lib-module/NavigationBar/NavigationItem.js +5 -8
- package/lib-module/NavigationBar/NavigationSubMenu.js +9 -6
- package/lib-module/NavigationBar/index.js +2 -0
- package/lib-module/OptimizeImage/OptimizeImage.js +8 -6
- package/lib-module/OrderedList/Item.js +3 -7
- package/lib-module/OrderedList/OrderedList.js +6 -12
- package/lib-module/OrderedList/OrderedListBase.js +3 -6
- package/lib-module/Paragraph/Paragraph.js +6 -4
- package/lib-module/PreviewCard/PreviewCard.js +2 -3
- package/lib-module/PriceLockup/PriceLockup.js +4 -2
- package/lib-module/Progress/ProgressBar.js +4 -2
- package/lib-module/QuantitySelector/QuantitySelector.js +22 -23
- package/lib-module/QuantitySelector/SideButton.js +13 -21
- package/lib-module/ResponsiveImage/ResponsiveImage.js +4 -2
- package/lib-module/Ribbon/Ribbon.js +4 -2
- package/lib-module/SkeletonProvider/SkeletonImage.js +5 -3
- package/lib-module/SkeletonProvider/SkeletonProvider.js +3 -3
- package/lib-module/SkeletonProvider/SkeletonTypography.js +5 -3
- package/lib-module/Span/Span.js +6 -4
- package/lib-module/Spinner/Spinner.js +4 -2
- package/lib-module/Spinner/SpinnerContent.js +4 -2
- package/lib-module/StoryCard/StoryCard.js +2 -3
- package/lib-module/Table/Body.js +4 -2
- package/lib-module/Table/Cell.js +5 -3
- package/lib-module/Table/Header.js +6 -4
- package/lib-module/Table/Row.js +6 -4
- package/lib-module/Table/SubHeading.js +6 -4
- package/lib-module/Table/Table.js +6 -6
- package/lib-module/TermsAndConditions/ExpandCollapse.js +2 -5
- package/lib-module/TermsAndConditions/TermsAndConditions.js +5 -12
- package/lib-module/Testimonial/Testimonial.js +4 -2
- package/lib-module/Toast/Toast.js +4 -2
- package/lib-module/Video/Video.js +19 -53
- package/lib-module/VideoPicker/VideoPicker.js +37 -8
- package/lib-module/VideoPicker/VideoPickerPlayer.js +4 -2
- package/lib-module/VideoPicker/VideoPickerThumbnail.js +4 -2
- package/lib-module/VideoPicker/VideoSlider.js +7 -5
- package/lib-module/WaffleGrid/WaffleGrid.js +4 -2
- package/lib-module/WebVideo/WebVideo.js +51 -11
- package/lib-module/WebVideo/utils/index.js +50 -0
- package/lib-module/baseExports.js +1 -1
- package/lib-module/utils/theming/with-client-theme.js +2 -2
- package/lib-module/utils/theming/with-server-theme.js +2 -2
- package/package.json +3 -3
- package/src/Badge/Badge.jsx +5 -2
- package/src/BlockQuote/BlockQuote.jsx +120 -112
- package/src/Breadcrumbs/Breadcrumbs.jsx +84 -77
- package/src/Breadcrumbs/Item/Item.jsx +2 -9
- package/src/Callout/Callout.jsx +37 -40
- package/src/Card/Card.jsx +2 -3
- package/src/Card/CardContent.jsx +19 -14
- package/src/Countdown/Countdown.jsx +72 -71
- package/src/Countdown/Segment.jsx +40 -28
- package/src/DatePicker/CalendarContainer.jsx +2 -2
- package/src/DatePicker/DatePicker.jsx +21 -34
- package/src/Disclaimer/Disclaimer.jsx +5 -3
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +37 -40
- package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +52 -44
- package/src/Footnote/Footnote.jsx +32 -38
- package/src/Footnote/FootnoteLink.jsx +41 -49
- package/src/IconButton/IconButton.jsx +19 -20
- package/src/Image/Image.jsx +40 -43
- package/src/List/ListItem.jsx +3 -5
- package/src/NavigationBar/NavigationBar.jsx +9 -18
- package/src/NavigationBar/NavigationItem.jsx +6 -5
- package/src/NavigationBar/NavigationSubMenu.jsx +104 -88
- package/src/NavigationBar/index.js +3 -0
- package/src/OptimizeImage/OptimizeImage.jsx +48 -41
- package/src/OrderedList/Item.jsx +34 -35
- package/src/OrderedList/OrderedList.jsx +4 -6
- package/src/OrderedList/OrderedListBase.jsx +2 -3
- package/src/Paragraph/Paragraph.jsx +21 -16
- package/src/PreviewCard/PreviewCard.jsx +2 -3
- package/src/PriceLockup/PriceLockup.jsx +143 -136
- package/src/Progress/ProgressBar.jsx +11 -3
- package/src/QuantitySelector/QuantitySelector.jsx +162 -154
- package/src/QuantitySelector/SideButton.jsx +52 -56
- package/src/ResponsiveImage/ResponsiveImage.jsx +16 -22
- package/src/Ribbon/Ribbon.jsx +85 -83
- package/src/SkeletonProvider/SkeletonImage.jsx +24 -15
- package/src/SkeletonProvider/SkeletonProvider.jsx +3 -3
- package/src/SkeletonProvider/SkeletonTypography.jsx +18 -13
- package/src/Span/Span.jsx +7 -5
- package/src/Spinner/Spinner.jsx +86 -79
- package/src/Spinner/SpinnerContent.jsx +31 -33
- package/src/StoryCard/StoryCard.jsx +2 -3
- package/src/Table/Body.jsx +5 -3
- package/src/Table/Cell.jsx +77 -67
- package/src/Table/Header.jsx +7 -5
- package/src/Table/Row.jsx +7 -5
- package/src/Table/SubHeading.jsx +7 -5
- package/src/Table/Table.jsx +6 -6
- package/src/TermsAndConditions/ExpandCollapse.jsx +2 -6
- package/src/TermsAndConditions/TermsAndConditions.jsx +5 -13
- package/src/Testimonial/Testimonial.jsx +148 -137
- package/src/Toast/Toast.jsx +68 -63
- package/src/Video/Video.jsx +25 -45
- package/src/VideoPicker/VideoPicker.jsx +114 -75
- package/src/VideoPicker/VideoPickerPlayer.jsx +13 -9
- package/src/VideoPicker/VideoPickerThumbnail.jsx +102 -94
- package/src/VideoPicker/VideoSlider.jsx +8 -6
- package/src/WaffleGrid/WaffleGrid.jsx +36 -40
- package/src/WebVideo/WebVideo.jsx +114 -60
- package/src/WebVideo/utils/index.js +56 -0
- package/src/baseExports.js +1 -0
- package/src/utils/theming/with-client-theme.jsx +2 -2
- package/src/utils/theming/with-server-theme.jsx +2 -2
- package/types/WebVideo.d.ts +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import momentPropTypes from 'react-moment-proptypes';
|
|
@@ -88,32 +88,33 @@ const validDatePattern = /^([0-2][0-9]|3[0-1])(\/)(0[1-9]|1[0-2])\2(\d{4})$/;
|
|
|
88
88
|
* - Optimized for keyboard interaction and tablet touch
|
|
89
89
|
* - Recommended for viewports greater than or equal to 576px
|
|
90
90
|
*/
|
|
91
|
-
const DatePicker = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
91
|
+
const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
92
92
|
var _dictionary$copy;
|
|
93
93
|
let {
|
|
94
94
|
copy = 'en',
|
|
95
95
|
id,
|
|
96
96
|
date,
|
|
97
97
|
feedback,
|
|
98
|
-
inline,
|
|
98
|
+
inline = false,
|
|
99
99
|
isDayDisabled,
|
|
100
100
|
label,
|
|
101
|
-
onDateChange,
|
|
101
|
+
onDateChange = () => {},
|
|
102
102
|
hint,
|
|
103
103
|
hintPosition = 'inline',
|
|
104
104
|
tooltip,
|
|
105
105
|
tokens,
|
|
106
106
|
variant = {},
|
|
107
107
|
validation,
|
|
108
|
-
disabled,
|
|
109
|
-
prevTestID,
|
|
110
|
-
nextTestID,
|
|
108
|
+
disabled = false,
|
|
109
|
+
prevTestID = '',
|
|
110
|
+
nextTestID = '',
|
|
111
|
+
placeholder = 'DD / MM / YYYY',
|
|
111
112
|
...rest
|
|
112
113
|
} = _ref3;
|
|
113
|
-
const [inputDate, setInputDate] = useState(date instanceof moment ? date : undefined);
|
|
114
|
-
const [inputText, setInputText] = useState(date instanceof moment ? date.format(dateFormat) : '');
|
|
115
|
-
const textInputRef = useRef();
|
|
116
|
-
const [datePickerPosition, setDatePickerPosition] = useState({
|
|
114
|
+
const [inputDate, setInputDate] = React.useState(date instanceof moment ? date : undefined);
|
|
115
|
+
const [inputText, setInputText] = React.useState(date instanceof moment ? date.format(dateFormat) : '');
|
|
116
|
+
const textInputRef = React.useRef();
|
|
117
|
+
const [datePickerPosition, setDatePickerPosition] = React.useState({
|
|
117
118
|
left: 0,
|
|
118
119
|
top: 0
|
|
119
120
|
});
|
|
@@ -137,13 +138,13 @@ const DatePicker = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
137
138
|
window.addEventListener('resize', throttledUpdateDimensions);
|
|
138
139
|
return () => window.removeEventListener('resize', throttledUpdateDimensions);
|
|
139
140
|
}, []);
|
|
140
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
141
|
-
const [isClickedInside, setIsClickedInside] = useState(false);
|
|
141
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
142
|
+
const [isClickedInside, setIsClickedInside] = React.useState(false);
|
|
142
143
|
const getCopy = useCopy({
|
|
143
144
|
dictionary,
|
|
144
145
|
copy
|
|
145
146
|
});
|
|
146
|
-
useEffect(() => {
|
|
147
|
+
React.useEffect(() => {
|
|
147
148
|
/**
|
|
148
149
|
* `date` could be passed as `null` to reset the value so explicitly
|
|
149
150
|
* checking for not being `undefined`
|
|
@@ -334,7 +335,7 @@ const DatePicker = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
334
335
|
copy: copy,
|
|
335
336
|
feedback: feedback,
|
|
336
337
|
hint: hint,
|
|
337
|
-
placeholder:
|
|
338
|
+
placeholder: placeholder,
|
|
338
339
|
onChange: onChangeInput,
|
|
339
340
|
onKeyPress: handleOnKeyPress,
|
|
340
341
|
tooltip: tooltip,
|
|
@@ -466,23 +467,10 @@ DatePicker.propTypes = {
|
|
|
466
467
|
* This is for automation testing purposes.
|
|
467
468
|
* Will be added as a `data-testid-next` attribute for example.
|
|
468
469
|
*/
|
|
469
|
-
nextTestID: PropTypes.string
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
feedback: undefined,
|
|
475
|
-
inline: false,
|
|
476
|
-
isDayDisabled: undefined,
|
|
477
|
-
label: undefined,
|
|
478
|
-
hint: undefined,
|
|
479
|
-
hintPosition: 'inline',
|
|
480
|
-
tooltip: undefined,
|
|
481
|
-
onDateChange: () => {},
|
|
482
|
-
validation: undefined,
|
|
483
|
-
disabled: false,
|
|
484
|
-
tokens: undefined,
|
|
485
|
-
prevTestID: '',
|
|
486
|
-
nextTestID: ''
|
|
470
|
+
nextTestID: PropTypes.string,
|
|
471
|
+
/**
|
|
472
|
+
* Optional placeholder for the date input. If not set the default value will be `DD / MM / YYYY`
|
|
473
|
+
*/
|
|
474
|
+
placeholder: PropTypes.string
|
|
487
475
|
};
|
|
488
476
|
export default DatePicker;
|
|
@@ -32,18 +32,20 @@ const StyledDisclaimer = /*#__PURE__*/styled.p.withConfig({
|
|
|
32
32
|
* Use Disclaimer to display singular legal statement and must be displayed
|
|
33
33
|
* immediately adjacent to the related, originating content.
|
|
34
34
|
*/
|
|
35
|
-
const Disclaimer = _ref2 => {
|
|
35
|
+
const Disclaimer = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
36
36
|
let {
|
|
37
37
|
children,
|
|
38
38
|
...rest
|
|
39
39
|
} = _ref2;
|
|
40
40
|
const themeTokens = useThemeTokens('Disclaimer');
|
|
41
41
|
return /*#__PURE__*/_jsx(StyledDisclaimer, {
|
|
42
|
+
ref: ref,
|
|
42
43
|
...selectProps(rest),
|
|
43
44
|
...themeTokens,
|
|
44
45
|
children: children
|
|
45
46
|
});
|
|
46
|
-
};
|
|
47
|
+
});
|
|
48
|
+
Disclaimer.displayName = 'Disclaimer';
|
|
47
49
|
Disclaimer.propTypes = {
|
|
48
50
|
...selectedSystemPropTypes,
|
|
49
51
|
tokens: getTokensPropType('Disclaimer'),
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { ExpandCollapse, getTokensPropType } from '@telus-uds/components-base';
|
|
4
4
|
import ExpandCollapseMiniControl from './ExpandCollapseMiniControl';
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
const ExpandCollapseMini = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
6
|
+
const ExpandCollapseMini = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
7
7
|
let {
|
|
8
8
|
children,
|
|
9
|
-
onToggle,
|
|
10
|
-
tokens,
|
|
9
|
+
onToggle = () => {},
|
|
10
|
+
tokens = {},
|
|
11
11
|
nativeID,
|
|
12
12
|
...rest
|
|
13
13
|
} = _ref;
|
|
@@ -19,6 +19,7 @@ const ExpandCollapseMini = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
19
19
|
};
|
|
20
20
|
return /*#__PURE__*/_jsx(ExpandCollapse, {
|
|
21
21
|
onChange: handleChange,
|
|
22
|
+
tokens: tokens,
|
|
22
23
|
children: expandProps => /*#__PURE__*/_jsx(ExpandCollapse.Panel, {
|
|
23
24
|
...expandProps,
|
|
24
25
|
panelId: "ExpandCollapseMiniPanel",
|
|
@@ -62,9 +63,4 @@ ExpandCollapseMini.propTypes = {
|
|
|
62
63
|
children: PropTypes.node.isRequired,
|
|
63
64
|
tokens: getTokensPropType('ExpandCollapseMini')
|
|
64
65
|
};
|
|
65
|
-
ExpandCollapseMini.defaultProps = {
|
|
66
|
-
onToggle: () => {},
|
|
67
|
-
tokens: {},
|
|
68
|
-
nativeID: ''
|
|
69
|
-
};
|
|
70
66
|
export default ExpandCollapseMini;
|
|
@@ -29,7 +29,7 @@ const selectLinkTokens = _ref => {
|
|
|
29
29
|
blockFontSize: fontSize
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
const ExpandCollapseMiniControl = _ref2 => {
|
|
32
|
+
const ExpandCollapseMiniControl = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
33
33
|
let {
|
|
34
34
|
pressableState,
|
|
35
35
|
collapseTitle,
|
|
@@ -86,11 +86,13 @@ const ExpandCollapseMiniControl = _ref2 => {
|
|
|
86
86
|
...selectLinkTokens(themeTokens),
|
|
87
87
|
outerBorderColor
|
|
88
88
|
}),
|
|
89
|
+
ref: ref,
|
|
89
90
|
...presentationOnly,
|
|
90
91
|
...selectProps(rest),
|
|
91
92
|
children: expanded ? expandTitle : collapseTitle
|
|
92
93
|
});
|
|
93
|
-
};
|
|
94
|
+
});
|
|
95
|
+
ExpandCollapseMiniControl.displayName = 'ExpandCollapseMiniControl';
|
|
94
96
|
ExpandCollapseMiniControl.propTypes = {
|
|
95
97
|
...selectedSystemPropTypes,
|
|
96
98
|
...Link.propTypes,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled, { createGlobalStyle } from 'styled-components';
|
|
4
4
|
import { Icon, Portal, selectSystemProps, Typography, useCopy, useTheme, useResponsiveProp, useThemeTokens, useViewport, getTokensPropType } from '@telus-uds/components-base';
|
|
@@ -216,8 +216,8 @@ const StyledCustomContentContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
216
216
|
};
|
|
217
217
|
});
|
|
218
218
|
const usePrevious = value => {
|
|
219
|
-
const ref = useRef();
|
|
220
|
-
useEffect(() => {
|
|
219
|
+
const ref = React.useRef();
|
|
220
|
+
React.useEffect(() => {
|
|
221
221
|
ref.current = value;
|
|
222
222
|
});
|
|
223
223
|
if (ref.current) {
|
|
@@ -244,21 +244,21 @@ const usePrevious = value => {
|
|
|
244
244
|
* - When `Footnote` is open, the inert prop must be set on all children of body excluding the Footnote
|
|
245
245
|
* - When `Footnote` is closed, focus must return to the initiating element
|
|
246
246
|
*/
|
|
247
|
-
const Footnote = props => {
|
|
247
|
+
const Footnote = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
248
248
|
var _theme$themeOptions;
|
|
249
|
-
const viewport = useViewport();
|
|
250
249
|
const {
|
|
251
|
-
copy,
|
|
250
|
+
copy = 'en',
|
|
252
251
|
number,
|
|
253
252
|
content,
|
|
254
253
|
onClose,
|
|
255
|
-
isOpen,
|
|
254
|
+
isOpen = false,
|
|
256
255
|
tokens,
|
|
257
256
|
variant = {},
|
|
258
257
|
isMobileFullScreen = true,
|
|
259
258
|
dictionary = defaultDictionary,
|
|
260
259
|
...rest
|
|
261
260
|
} = props;
|
|
261
|
+
const viewport = useViewport();
|
|
262
262
|
const {
|
|
263
263
|
footnoteBackground,
|
|
264
264
|
footnoteBorderTopSizeMd,
|
|
@@ -296,19 +296,19 @@ const Footnote = props => {
|
|
|
296
296
|
} = useThemeTokens('Footnote', tokens, variant, {
|
|
297
297
|
viewport
|
|
298
298
|
});
|
|
299
|
-
const footnoteRef = useRef(null);
|
|
300
|
-
const headerRef = useRef(null);
|
|
301
|
-
const bodyRef = useRef(null);
|
|
302
|
-
const contentRef = useRef(null);
|
|
303
|
-
const headingRef = useRef(null);
|
|
304
|
-
const [data, setData] = useState({
|
|
299
|
+
const footnoteRef = React.useRef(null);
|
|
300
|
+
const headerRef = React.useRef(null);
|
|
301
|
+
const bodyRef = React.useRef(null);
|
|
302
|
+
const contentRef = React.useRef(null);
|
|
303
|
+
const headingRef = React.useRef(null);
|
|
304
|
+
const [data, setData] = React.useState({
|
|
305
305
|
content: null,
|
|
306
306
|
number: null
|
|
307
307
|
});
|
|
308
|
-
const [headerHeight, setHeaderHeight] = useState('auto');
|
|
309
|
-
const [bodyHeight, setBodyHeight] = useState('auto');
|
|
310
|
-
const [isVisible, setIsVisible] = useState(false);
|
|
311
|
-
const [isTextVisible, setIsTextVisible] = useState(true);
|
|
308
|
+
const [headerHeight, setHeaderHeight] = React.useState('auto');
|
|
309
|
+
const [bodyHeight, setBodyHeight] = React.useState('auto');
|
|
310
|
+
const [isVisible, setIsVisible] = React.useState(false);
|
|
311
|
+
const [isTextVisible, setIsTextVisible] = React.useState(true);
|
|
312
312
|
const getCopy = useCopy({
|
|
313
313
|
dictionary,
|
|
314
314
|
copy
|
|
@@ -316,13 +316,13 @@ const Footnote = props => {
|
|
|
316
316
|
const prevProps = usePrevious(props);
|
|
317
317
|
const theme = useTheme();
|
|
318
318
|
const maxWidth = useResponsiveProp((_theme$themeOptions = theme.themeOptions) === null || _theme$themeOptions === void 0 ? void 0 : _theme$themeOptions.contentMaxWidth);
|
|
319
|
-
const [isScrollable, setIsScrollable] = useState(false);
|
|
320
|
-
const closeFootnote = useCallback((event, options) => {
|
|
319
|
+
const [isScrollable, setIsScrollable] = React.useState(false);
|
|
320
|
+
const closeFootnote = React.useCallback((event, options) => {
|
|
321
321
|
onClose(event, options);
|
|
322
322
|
}, [onClose]);
|
|
323
323
|
|
|
324
324
|
// Listen for ESCAPE, close button clicks, and clicks outside of the Footnote. Call onClose.
|
|
325
|
-
const handleClose = useCallback(event => {
|
|
325
|
+
const handleClose = React.useCallback(event => {
|
|
326
326
|
var _footnoteRef$current, _footnoteRef$current2;
|
|
327
327
|
if (!isVisible) {
|
|
328
328
|
return;
|
|
@@ -388,7 +388,7 @@ const Footnote = props => {
|
|
|
388
388
|
};
|
|
389
389
|
|
|
390
390
|
// Set height of header on mount
|
|
391
|
-
useEffect(() => {
|
|
391
|
+
React.useEffect(() => {
|
|
392
392
|
var _headerRef$current;
|
|
393
393
|
setHeaderHeight((_headerRef$current = headerRef.current) === null || _headerRef$current === void 0 ? void 0 : _headerRef$current.offsetHeight);
|
|
394
394
|
}, []);
|
|
@@ -399,7 +399,7 @@ const Footnote = props => {
|
|
|
399
399
|
};
|
|
400
400
|
|
|
401
401
|
// Add listeners for mouse clicks outside of Footnote and for ESCAPE key presses
|
|
402
|
-
useEffect(() => {
|
|
402
|
+
React.useEffect(() => {
|
|
403
403
|
if (isOpen) {
|
|
404
404
|
setIsVisible(true);
|
|
405
405
|
document.addEventListener('mousedown', handleClose);
|
|
@@ -422,7 +422,7 @@ const Footnote = props => {
|
|
|
422
422
|
}, [handleClose, isOpen]);
|
|
423
423
|
|
|
424
424
|
// Set data if opening a new footnote
|
|
425
|
-
useEffect(() => {
|
|
425
|
+
React.useEffect(() => {
|
|
426
426
|
if (isOpen && !prevProps.isOpen) {
|
|
427
427
|
setData({
|
|
428
428
|
content,
|
|
@@ -430,7 +430,7 @@ const Footnote = props => {
|
|
|
430
430
|
});
|
|
431
431
|
}
|
|
432
432
|
}, [isOpen, prevProps.isOpen, content, number]);
|
|
433
|
-
useEffect(() => {
|
|
433
|
+
React.useEffect(() => {
|
|
434
434
|
if (isOpen && prevProps.isOpen && number !== prevProps.number) {
|
|
435
435
|
saveCurrentHeight();
|
|
436
436
|
setIsTextVisible(false);
|
|
@@ -438,8 +438,8 @@ const Footnote = props => {
|
|
|
438
438
|
}, [number, isOpen, prevProps.isOpen, prevProps.number]);
|
|
439
439
|
|
|
440
440
|
// Reset footnote on close
|
|
441
|
-
useEffect(resetFootnote, [isOpen]);
|
|
442
|
-
const getFootnoteBodyContent = useCallback(() => {
|
|
441
|
+
React.useEffect(resetFootnote, [isOpen]);
|
|
442
|
+
const getFootnoteBodyContent = React.useCallback(() => {
|
|
443
443
|
if (!data.number || !data.content) {
|
|
444
444
|
return null;
|
|
445
445
|
}
|
|
@@ -474,7 +474,7 @@ const Footnote = props => {
|
|
|
474
474
|
})
|
|
475
475
|
});
|
|
476
476
|
}, [data.content, data.number, listItemColor, listItemFontSize, listItemLineHeight, listItemMarkerFontSize, listItemMarkerLineHeight, listItemPaddingLeft, listPaddingLeft]);
|
|
477
|
-
const checkIfScrollable = useCallback(() => {
|
|
477
|
+
const checkIfScrollable = React.useCallback(() => {
|
|
478
478
|
const footnoteElement = footnoteRef.current;
|
|
479
479
|
if (footnoteElement) {
|
|
480
480
|
const footnoteViewportHeight = footnoteElement.clientHeight ? footnoteElement.clientHeight : 0;
|
|
@@ -482,7 +482,7 @@ const Footnote = props => {
|
|
|
482
482
|
setIsScrollable(contentHeight > footnoteViewportHeight * 0.5);
|
|
483
483
|
}
|
|
484
484
|
}, [contentRef, setIsScrollable]);
|
|
485
|
-
useEffect(() => {
|
|
485
|
+
React.useEffect(() => {
|
|
486
486
|
if (isOpen) {
|
|
487
487
|
setTimeout(() => {
|
|
488
488
|
checkIfScrollable();
|
|
@@ -492,6 +492,7 @@ const Footnote = props => {
|
|
|
492
492
|
return /*#__PURE__*/_jsx(Portal, {
|
|
493
493
|
children: /*#__PURE__*/_jsxs("div", {
|
|
494
494
|
...selectProps(rest),
|
|
495
|
+
ref: ref,
|
|
495
496
|
children: [isOpen && /*#__PURE__*/_jsx(GlobalBodyScrollLock, {}), /*#__PURE__*/_jsx(StyledFootnote, {
|
|
496
497
|
ref: footnoteRef,
|
|
497
498
|
isOpen: isOpen,
|
|
@@ -558,7 +559,8 @@ const Footnote = props => {
|
|
|
558
559
|
})]
|
|
559
560
|
})
|
|
560
561
|
});
|
|
561
|
-
};
|
|
562
|
+
});
|
|
563
|
+
Footnote.displayName = 'Footnote';
|
|
562
564
|
const copyShape = PropTypes.shape({
|
|
563
565
|
close: PropTypes.string.isRequired,
|
|
564
566
|
heading: PropTypes.string.isRequired
|
|
@@ -610,11 +612,4 @@ Footnote.propTypes = {
|
|
|
610
612
|
*/
|
|
611
613
|
isMobileFullScreen: PropTypes.bool
|
|
612
614
|
};
|
|
613
|
-
Footnote.defaultProps = {
|
|
614
|
-
isOpen: false,
|
|
615
|
-
number: undefined,
|
|
616
|
-
content: undefined,
|
|
617
|
-
copy: 'en',
|
|
618
|
-
isMobileFullScreen: true
|
|
619
|
-
};
|
|
620
615
|
export default Footnote;
|
|
@@ -5,7 +5,6 @@ import { applyTextStyles, selectSystemProps, useCopy, useThemeTokens, variantPro
|
|
|
5
5
|
import dictionary from './dictionary';
|
|
6
6
|
import { htmlAttrs } from '../utils';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
8
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
10
9
|
const StyledSup = /*#__PURE__*/styled.sup.withConfig({
|
|
11
10
|
displayName: "FootnoteLink__StyledSup",
|
|
@@ -44,7 +43,7 @@ const StyledSup = /*#__PURE__*/styled.sup.withConfig({
|
|
|
44
43
|
* - Avoid using FootnoteLink if there is only one annotation on a page. Consider including
|
|
45
44
|
* the annotation as part of the content whenever possible.
|
|
46
45
|
*/
|
|
47
|
-
const FootnoteLink = _ref2 => {
|
|
46
|
+
const FootnoteLink = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
48
47
|
let {
|
|
49
48
|
copy = 'en',
|
|
50
49
|
number = [],
|
|
@@ -74,7 +73,8 @@ const FootnoteLink = _ref2 => {
|
|
|
74
73
|
handleClick(index);
|
|
75
74
|
}
|
|
76
75
|
};
|
|
77
|
-
return /*#__PURE__*/_jsx(
|
|
76
|
+
return /*#__PURE__*/_jsx("div", {
|
|
77
|
+
ref: ref,
|
|
78
78
|
children: numbers.map((num, index) => /*#__PURE__*/_jsx(StyledSup, {
|
|
79
79
|
onKeyDown: event => handleOnKeyDown(event, index),
|
|
80
80
|
role: "button",
|
|
@@ -88,7 +88,8 @@ const FootnoteLink = _ref2 => {
|
|
|
88
88
|
children: `${num}${index !== numbers.length - 1 ? ',' : ''}`
|
|
89
89
|
}, num))
|
|
90
90
|
});
|
|
91
|
-
};
|
|
91
|
+
});
|
|
92
|
+
FootnoteLink.displayName = 'FootnoteLink';
|
|
92
93
|
const copyShape = PropTypes.shape({
|
|
93
94
|
a11yLabel: PropTypes.string.isRequired
|
|
94
95
|
});
|
|
@@ -114,7 +115,4 @@ FootnoteLink.propTypes = {
|
|
|
114
115
|
*/
|
|
115
116
|
fontSize: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
116
117
|
};
|
|
117
|
-
FootnoteLink.defaultProps = {
|
|
118
|
-
copy: 'en'
|
|
119
|
-
};
|
|
120
118
|
export default FootnoteLink;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { IconButton as IconButtonBase, useThemeTokens, getTokensPropType } from '@telus-uds/components-base';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
const IconButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
5
|
+
const IconButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
6
6
|
let {
|
|
7
|
-
icon,
|
|
7
|
+
icon = null,
|
|
8
8
|
action,
|
|
9
|
-
tokens,
|
|
9
|
+
tokens = {},
|
|
10
10
|
variant = {},
|
|
11
11
|
...iconButtonProps
|
|
12
12
|
} = _ref;
|
|
@@ -46,15 +46,10 @@ IconButton.propTypes = {
|
|
|
46
46
|
/**
|
|
47
47
|
* To set the icon to a multi-brand compatabile icon
|
|
48
48
|
*/
|
|
49
|
-
// eslint-disable-next-line react/require-default-props
|
|
50
49
|
action: PropTypes.oneOf(multiBrandIconNames),
|
|
51
50
|
/**
|
|
52
51
|
* To set a custom icon
|
|
53
52
|
*/
|
|
54
53
|
icon: PropTypes.func
|
|
55
54
|
};
|
|
56
|
-
IconButton.defaultProps = {
|
|
57
|
-
icon: null,
|
|
58
|
-
tokens: {}
|
|
59
|
-
};
|
|
60
55
|
export default IconButton;
|
|
@@ -4,7 +4,7 @@ import { htmlAttrs, selectSystemProps, getTokensPropType } from '@telus-uds/comp
|
|
|
4
4
|
import { warn } from '../utils/logger';
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
7
|
-
const Image = _ref => {
|
|
7
|
+
const Image = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
8
8
|
let {
|
|
9
9
|
src,
|
|
10
10
|
width,
|
|
@@ -43,9 +43,11 @@ const Image = _ref => {
|
|
|
43
43
|
width: width,
|
|
44
44
|
height: height,
|
|
45
45
|
alt: alt,
|
|
46
|
-
loading: loading
|
|
46
|
+
loading: loading,
|
|
47
|
+
ref: ref
|
|
47
48
|
});
|
|
48
|
-
};
|
|
49
|
+
});
|
|
50
|
+
Image.displayName = 'Image';
|
|
49
51
|
Image.propTypes = {
|
|
50
52
|
...selectedSystemPropTypes,
|
|
51
53
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { ListItem as ListItemBase, Typography } from '@telus-uds/components-base';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
-
const ListItem = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
6
|
+
const ListItem = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
7
7
|
let {
|
|
8
8
|
children,
|
|
9
9
|
title,
|
|
@@ -25,7 +25,4 @@ ListItem.propTypes = {
|
|
|
25
25
|
children: PropTypes.node.isRequired,
|
|
26
26
|
title: PropTypes.string
|
|
27
27
|
};
|
|
28
|
-
ListItem.defaultProps = {
|
|
29
|
-
title: undefined
|
|
30
|
-
};
|
|
31
28
|
export default ListItem;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _withLinkRouter$propT, _withLinkRouter$propT2, _withLinkRouter$propT3, _withLinkRouter$propT4;
|
|
2
|
-
import React
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import { selectSystemProps, StackView, Typography, useResponsiveProp, withLinkRouter
|
|
4
|
+
import { selectSystemProps, StackView, Typography, useResponsiveProp, withLinkRouter } from '@telus-uds/components-base';
|
|
5
5
|
import styled from 'styled-components';
|
|
6
6
|
import { htmlAttrs } from '../utils';
|
|
7
7
|
import NavigationItem from './NavigationItem';
|
|
@@ -28,7 +28,7 @@ const Heading = /*#__PURE__*/styled.div.withConfig({
|
|
|
28
28
|
* NavigationBar can be used to allow customers to consistently navigate across
|
|
29
29
|
* key pages within a specific product line
|
|
30
30
|
*/
|
|
31
|
-
const NavigationBar = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
31
|
+
const NavigationBar = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
32
32
|
let {
|
|
33
33
|
accessibilityRole = 'navigation',
|
|
34
34
|
heading,
|
|
@@ -48,8 +48,8 @@ const NavigationBar = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
48
48
|
xs: collapseItems(items, selectedId),
|
|
49
49
|
lg: items
|
|
50
50
|
});
|
|
51
|
-
const openOverlayRef = useRef(null);
|
|
52
|
-
const [openSubMenuId, setOpenSubMenuId] = useState(null);
|
|
51
|
+
const openOverlayRef = React.useRef(null);
|
|
52
|
+
const [openSubMenuId, setOpenSubMenuId] = React.useState(null);
|
|
53
53
|
const handleSubMenuClose = event => {
|
|
54
54
|
var _openOverlayRef$curre, _openOverlayRef$curre2;
|
|
55
55
|
if (event.type === 'keydown') {
|
|
@@ -62,12 +62,12 @@ const NavigationBar = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
62
62
|
setOpenSubMenuId(null);
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
|
-
const navRefDefault = useRef(null);
|
|
65
|
+
const navRefDefault = React.useRef(null);
|
|
66
66
|
const navRef = ref ?? navRefDefault;
|
|
67
|
-
const itemsRef = useRef(null);
|
|
67
|
+
const itemsRef = React.useRef(null);
|
|
68
68
|
|
|
69
69
|
// Close the submenu when the user clicks outside the navigation bar
|
|
70
|
-
const handleMouseDown = useCallback(event => {
|
|
70
|
+
const handleMouseDown = React.useCallback(event => {
|
|
71
71
|
if (navRef.current && itemsRef.current) {
|
|
72
72
|
// Get the bounding rectangles of the navigation bar and the items container
|
|
73
73
|
const navRect = navRef.current.getBoundingClientRect();
|
|
@@ -83,7 +83,7 @@ const NavigationBar = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
83
83
|
}, [navRef, itemsRef, setOpenSubMenuId]);
|
|
84
84
|
|
|
85
85
|
// TODO: create a custom hook for that and use here and in the Footnote
|
|
86
|
-
useEffect(() => {
|
|
86
|
+
React.useEffect(() => {
|
|
87
87
|
// Add listeners for mouse clicks outside and for key presses
|
|
88
88
|
document.addEventListener('mousedown', handleMouseDown);
|
|
89
89
|
if (openSubMenuId !== null) {
|
|
@@ -172,7 +172,6 @@ const NavigationBar = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
172
172
|
NavigationBar.displayName = 'NavigationBar';
|
|
173
173
|
NavigationBar.propTypes = {
|
|
174
174
|
...selectedSystemPropTypes,
|
|
175
|
-
tokens: getTokensPropType('NavigationBar'),
|
|
176
175
|
...withLinkRouter.propTypes,
|
|
177
176
|
/**
|
|
178
177
|
* NavigationBar pages
|
|
@@ -222,11 +221,4 @@ NavigationBar.propTypes = {
|
|
|
222
221
|
*/
|
|
223
222
|
accessibilityRole: PropTypes.string
|
|
224
223
|
};
|
|
225
|
-
NavigationBar.defaultProps = {
|
|
226
|
-
heading: undefined,
|
|
227
|
-
headingLevel: 'h1',
|
|
228
|
-
onChange: () => {},
|
|
229
|
-
accessibilityRole: '',
|
|
230
|
-
tokens: {}
|
|
231
|
-
};
|
|
232
224
|
export default NavigationBar;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { Button, selectSystemProps, useResponsiveProp, useViewport, useThemeTokensCallback } from '@telus-uds/components-base';
|
|
3
|
+
import { Button, selectSystemProps, useResponsiveProp, useViewport, useThemeTokensCallback, getTokensPropType } from '@telus-uds/components-base';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import { htmlAttrs } from '../utils';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -28,14 +28,14 @@ const ItemContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
28
28
|
*
|
|
29
29
|
* This is rendered automatically by `NavigationBar` and isn't intended be used directly.
|
|
30
30
|
*/
|
|
31
|
-
const NavigationItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
31
|
+
const NavigationItem = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
32
32
|
let {
|
|
33
33
|
accessibilityRole = 'link',
|
|
34
34
|
// @todo switch to 'button' for dropdowns
|
|
35
35
|
children,
|
|
36
36
|
id,
|
|
37
37
|
onClick: handleClick = () => {},
|
|
38
|
-
selected,
|
|
38
|
+
selected = false,
|
|
39
39
|
accessibilityState = {
|
|
40
40
|
current: selected ? 'page' : false
|
|
41
41
|
},
|
|
@@ -79,12 +79,9 @@ const NavigationItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
79
79
|
NavigationItem.displayName = 'NavigationItem';
|
|
80
80
|
NavigationItem.propTypes = {
|
|
81
81
|
...selectedSystemPropTypes,
|
|
82
|
+
tokens: getTokensPropType('NavigationBar'),
|
|
82
83
|
onClick: PropTypes.func,
|
|
83
84
|
selected: PropTypes.bool,
|
|
84
85
|
children: PropTypes.oneOfType([PropTypes.string, PropTypes.func]).isRequired
|
|
85
86
|
};
|
|
86
|
-
NavigationItem.defaultProps = {
|
|
87
|
-
onClick: () => {},
|
|
88
|
-
selected: false
|
|
89
|
-
};
|
|
90
87
|
export default NavigationItem;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { Icon, useResponsiveProp, useThemeTokens, Listbox } from '@telus-uds/components-base';
|
|
3
|
+
import { Icon, useResponsiveProp, useThemeTokens, Listbox, getTokensPropType } from '@telus-uds/components-base';
|
|
4
4
|
import NavigationItem from './NavigationItem';
|
|
5
5
|
import useOverlaidPosition from '../utils/useOverlaidPosition';
|
|
6
6
|
import resolveItemSelection from './resolveItemSelection';
|
|
@@ -13,11 +13,12 @@ import resolveItemSelection from './resolveItemSelection';
|
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
-
const NavigationSubMenu = _ref => {
|
|
16
|
+
const NavigationSubMenu = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
17
17
|
let {
|
|
18
18
|
children,
|
|
19
19
|
id,
|
|
20
20
|
isOpen = false,
|
|
21
|
+
tokens = {},
|
|
21
22
|
label,
|
|
22
23
|
onClick,
|
|
23
24
|
selectedId,
|
|
@@ -27,7 +28,7 @@ const NavigationSubMenu = _ref => {
|
|
|
27
28
|
linkRouterProps,
|
|
28
29
|
itemsContainerRef
|
|
29
30
|
} = _ref;
|
|
30
|
-
const focusTrapRef = useRef();
|
|
31
|
+
const focusTrapRef = React.useRef();
|
|
31
32
|
const maxWidth = 289; // Slightly over 288 of nav item to account for subpixel rounding
|
|
32
33
|
const defaultOffsets = {
|
|
33
34
|
offsets: {
|
|
@@ -98,6 +99,7 @@ const NavigationSubMenu = _ref => {
|
|
|
98
99
|
selected: selected,
|
|
99
100
|
onClick: handleClick,
|
|
100
101
|
icon: icoMenu,
|
|
102
|
+
tokens: tokens,
|
|
101
103
|
children: _ref2 => {
|
|
102
104
|
var _textStyles$;
|
|
103
105
|
let {
|
|
@@ -128,7 +130,7 @@ const NavigationSubMenu = _ref => {
|
|
|
128
130
|
selectedId: selectedId,
|
|
129
131
|
LinkRouter: LinkRouter,
|
|
130
132
|
linkRouterProps: linkRouterProps,
|
|
131
|
-
ref: itemsContainerRef
|
|
133
|
+
ref: itemsContainerRef || ref
|
|
132
134
|
})
|
|
133
135
|
}), /*#__PURE__*/_jsx("div", {
|
|
134
136
|
// This catches and shifts focus to other interactive elements.
|
|
@@ -139,11 +141,12 @@ const NavigationSubMenu = _ref => {
|
|
|
139
141
|
})]
|
|
140
142
|
})]
|
|
141
143
|
});
|
|
142
|
-
};
|
|
144
|
+
});
|
|
143
145
|
NavigationSubMenu.displayName = 'NavigationSubMenu';
|
|
144
146
|
|
|
145
147
|
// @TODO - proper prop types and comments
|
|
146
148
|
NavigationSubMenu.propTypes = {
|
|
149
|
+
tokens: getTokensPropType('NavigationBar'),
|
|
147
150
|
children: PropTypes.node,
|
|
148
151
|
id: PropTypes.string,
|
|
149
152
|
isOpen: PropTypes.bool,
|