@telus-uds/components-web 2.44.0 → 3.0.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/.eslintrc.cjs +26 -0
- package/CHANGELOG.md +13 -2
- package/babel.config.cjs +4 -0
- package/jest.config.cjs +29 -0
- package/lib/Badge/Badge.js +21 -29
- package/lib/Badge/index.js +2 -10
- package/lib/BlockQuote/BlockQuote.js +31 -39
- package/lib/BlockQuote/index.js +2 -10
- package/lib/Breadcrumbs/Breadcrumbs.js +39 -49
- package/lib/Breadcrumbs/Item/Item.js +26 -34
- package/lib/Breadcrumbs/index.js +1 -13
- package/lib/Callout/Callout.js +19 -27
- package/lib/Callout/index.js +2 -10
- package/lib/Card/Card.js +44 -54
- package/lib/Card/CardContent.js +17 -25
- package/lib/Card/CardFooter.js +16 -24
- package/lib/Card/index.js +2 -10
- package/lib/Countdown/Countdown.js +34 -42
- package/lib/Countdown/Segment.js +26 -34
- package/lib/Countdown/constants.js +4 -14
- package/lib/Countdown/dictionary.js +2 -9
- package/lib/Countdown/index.js +2 -10
- package/lib/Countdown/types.js +18 -28
- package/lib/Countdown/useCountdown.js +4 -11
- package/lib/DatePicker/CalendarContainer.js +6 -12
- package/lib/DatePicker/DatePicker.js +94 -103
- package/lib/DatePicker/dictionary.js +1 -8
- package/lib/DatePicker/index.js +2 -10
- package/lib/DatePicker/reactDatesCss.js +3 -10
- package/lib/Disclaimer/Disclaimer.js +15 -23
- package/lib/Disclaimer/index.js +1 -13
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +16 -24
- package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +17 -26
- package/lib/ExpandCollapseMini/index.js +2 -10
- package/lib/Footnote/Footnote.js +85 -95
- package/lib/Footnote/FootnoteLink.js +25 -33
- package/lib/Footnote/dictionary.js +2 -9
- package/lib/Footnote/index.js +4 -12
- package/lib/IconButton/IconButton.js +12 -20
- package/lib/IconButton/index.js +2 -10
- package/lib/Image/Image.js +17 -25
- package/lib/Image/index.js +6 -18
- package/lib/Image/server.js +4 -12
- package/lib/List/List.js +2 -9
- package/lib/List/ListItem.js +10 -18
- package/lib/List/index.js +4 -12
- package/lib/NavigationBar/NavigationBar.js +51 -59
- package/lib/NavigationBar/NavigationItem.js +19 -27
- package/lib/NavigationBar/NavigationSubMenu.js +34 -40
- package/lib/NavigationBar/collapseItems.js +1 -11
- package/lib/NavigationBar/index.js +4 -12
- package/lib/NavigationBar/resolveItemSelection.js +1 -8
- package/lib/OptimizeImage/OptimizeImage.js +26 -34
- package/lib/OptimizeImage/index.js +2 -10
- package/lib/OptimizeImage/utils/getFallbackUrl.js +3 -10
- package/lib/OptimizeImage/utils/getImageUrls.js +9 -16
- package/lib/OptimizeImage/utils/getOptimizedUrl.js +3 -10
- package/lib/OptimizeImage/utils/hasWebpSupport.js +1 -7
- package/lib/OptimizeImage/utils/index.js +5 -34
- package/lib/OptimizeImage/utils/isSvgUrl.js +1 -7
- package/lib/OrderedList/Item.js +28 -36
- package/lib/OrderedList/ItemBase.js +8 -16
- package/lib/OrderedList/OrderedList.js +22 -30
- package/lib/OrderedList/OrderedListBase.js +12 -20
- package/lib/OrderedList/constants.js +1 -8
- package/lib/OrderedList/index.js +4 -12
- package/lib/Paragraph/Paragraph.js +22 -30
- package/lib/Paragraph/index.js +2 -10
- package/lib/PreviewCard/AuthorDate.js +17 -21
- package/lib/PreviewCard/PreviewCard.js +40 -49
- package/lib/PreviewCard/index.js +2 -10
- package/lib/PriceLockup/PriceLockup.js +56 -64
- package/lib/PriceLockup/index.js +2 -10
- package/lib/PriceLockup/tokens.js +2 -9
- package/lib/Progress/ProgressBar.js +17 -24
- package/lib/Progress/index.js +4 -12
- package/lib/QuantitySelector/QuantitySelector.js +55 -63
- package/lib/QuantitySelector/SideButton.js +15 -23
- package/lib/QuantitySelector/dictionary.js +2 -9
- package/lib/QuantitySelector/index.js +2 -10
- package/lib/QuantitySelector/styles.js +4 -13
- package/lib/ResponsiveImage/ResponsiveImage.js +29 -37
- package/lib/ResponsiveImage/index.js +2 -10
- package/lib/Ribbon/Ribbon.js +22 -30
- package/lib/Ribbon/index.js +2 -10
- package/lib/SkeletonProvider/SkeletonImage.js +14 -22
- package/lib/SkeletonProvider/SkeletonProvider.js +17 -25
- package/lib/SkeletonProvider/SkeletonTypography.js +14 -22
- package/lib/SkeletonProvider/index.js +2 -10
- package/lib/Span/Span.js +23 -31
- package/lib/Span/index.js +2 -10
- package/lib/Spinner/Spinner.js +43 -51
- package/lib/Spinner/SpinnerContent.js +21 -29
- package/lib/Spinner/constants.js +4 -14
- package/lib/Spinner/index.js +2 -10
- package/lib/StoryCard/StoryCard.js +40 -49
- package/lib/StoryCard/index.js +2 -10
- package/lib/Table/Body.js +7 -15
- package/lib/Table/Cell.js +28 -38
- package/lib/Table/Header.js +11 -19
- package/lib/Table/Row.js +8 -16
- package/lib/Table/SubHeading.js +10 -18
- package/lib/Table/Table.js +26 -35
- package/lib/Table/index.js +12 -20
- package/lib/TermsAndConditions/ExpandCollapse.js +22 -30
- package/lib/TermsAndConditions/TermsAndConditions.js +52 -60
- package/lib/TermsAndConditions/dictionary.js +2 -9
- package/lib/TermsAndConditions/index.js +1 -13
- package/lib/Testimonial/Testimonial.js +37 -45
- package/lib/Testimonial/index.js +2 -10
- package/lib/Toast/Toast.js +32 -42
- package/lib/Toast/index.js +2 -10
- package/lib/Video/ControlBar/ControlBar.js +73 -81
- package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +16 -24
- package/lib/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +27 -35
- package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +27 -36
- package/lib/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +30 -38
- package/lib/Video/MiddleControlButton/MiddleControlButton.js +16 -24
- package/lib/Video/Video.js +74 -83
- package/lib/Video/index.js +2 -10
- package/lib/Video/videoText.js +1 -8
- package/lib/VideoPicker/VideoPicker.js +43 -53
- package/lib/VideoPicker/VideoPickerPlayer.js +17 -25
- package/lib/VideoPicker/VideoPickerThumbnail.js +38 -46
- package/lib/VideoPicker/VideoSlider.js +17 -26
- package/lib/VideoPicker/index.js +2 -10
- package/lib/VideoPicker/videoPropType.js +9 -18
- package/lib/WaffleGrid/WaffleGrid.js +33 -43
- package/lib/WaffleGrid/index.js +2 -10
- package/lib/WebVideo/WebVideo.js +42 -52
- package/lib/WebVideo/index.js +2 -10
- package/lib/WebVideo/utils/index.js +3 -11
- package/lib/baseExports.js +18 -431
- package/lib/index.js +38 -323
- package/lib/server.js +4 -12
- package/lib/shared/ConditionalWrapper/ConditionalWrapper.js +9 -17
- package/lib/shared/ConditionalWrapper/index.js +2 -10
- package/lib/shared/FullBleedContent/FullBleedContent.js +21 -29
- package/lib/shared/FullBleedContent/getFullBleedBorderRadius.js +1 -8
- package/lib/shared/FullBleedContent/index.js +4 -24
- package/lib/shared/FullBleedContent/useFullBleedContentProps.js +4 -11
- package/lib/shared/VideoSplash/SplashButton/SplashButton.js +19 -27
- package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +27 -35
- package/lib/shared/VideoSplash/VideoSplash.js +24 -32
- package/lib/shared/VideoSplash/helpers.js +5 -14
- package/lib/utils/index.js +10 -75
- package/lib/utils/isElementFocusable.js +1 -8
- package/lib/utils/logger.js +6 -15
- package/lib/utils/media.js +5 -11
- package/lib/utils/renderStructuredContent.js +8 -15
- package/lib/utils/ssr.js +5 -12
- package/lib/utils/theming/get-theme-from-server.js +2 -10
- package/lib/utils/theming/with-client-theme.js +9 -17
- package/lib/utils/theming/with-server-theme.js +11 -19
- package/lib/utils/transforms.js +3 -11
- package/lib/utils/useOverlaidPosition.js +15 -23
- package/lib/utils/useTypographyTheme.js +6 -13
- package/package.json +18 -20
- package/src/Card/Card.jsx +2 -2
- package/src/DatePicker/DatePicker.jsx +1 -2
- package/src/PreviewCard/AuthorDate.jsx +5 -3
- package/src/utils/logger.js +2 -2
- package/lib-module/Badge/Badge.js +0 -121
- package/lib-module/Badge/index.js +0 -2
- package/lib-module/BlockQuote/BlockQuote.js +0 -204
- package/lib-module/BlockQuote/index.js +0 -2
- package/lib-module/Breadcrumbs/Breadcrumbs.js +0 -250
- package/lib-module/Breadcrumbs/Item/Item.js +0 -175
- package/lib-module/Breadcrumbs/index.js +0 -1
- package/lib-module/Callout/Callout.js +0 -135
- package/lib-module/Callout/index.js +0 -2
- package/lib-module/Card/Card.js +0 -251
- package/lib-module/Card/CardContent.js +0 -90
- package/lib-module/Card/CardFooter.js +0 -78
- package/lib-module/Card/index.js +0 -2
- package/lib-module/Countdown/Countdown.js +0 -169
- package/lib-module/Countdown/Segment.js +0 -96
- package/lib-module/Countdown/constants.js +0 -4
- package/lib-module/Countdown/dictionary.js +0 -22
- package/lib-module/Countdown/index.js +0 -2
- package/lib-module/Countdown/types.js +0 -24
- package/lib-module/Countdown/useCountdown.js +0 -26
- package/lib-module/DatePicker/CalendarContainer.js +0 -208
- package/lib-module/DatePicker/DatePicker.js +0 -519
- package/lib-module/DatePicker/dictionary.js +0 -119
- package/lib-module/DatePicker/index.js +0 -2
- package/lib-module/DatePicker/reactDatesCss.js +0 -3
- package/lib-module/Disclaimer/Disclaimer.js +0 -54
- package/lib-module/Disclaimer/index.js +0 -1
- package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +0 -73
- package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +0 -117
- package/lib-module/ExpandCollapseMini/index.js +0 -2
- package/lib-module/Footnote/Footnote.js +0 -632
- package/lib-module/Footnote/FootnoteLink.js +0 -118
- package/lib-module/Footnote/dictionary.js +0 -12
- package/lib-module/Footnote/index.js +0 -4
- package/lib-module/IconButton/IconButton.js +0 -55
- package/lib-module/IconButton/index.js +0 -2
- package/lib-module/Image/Image.js +0 -83
- package/lib-module/Image/index.js +0 -9
- package/lib-module/Image/server.js +0 -4
- package/lib-module/List/List.js +0 -2
- package/lib-module/List/ListItem.js +0 -28
- package/lib-module/List/index.js +0 -4
- package/lib-module/NavigationBar/NavigationBar.js +0 -224
- package/lib-module/NavigationBar/NavigationItem.js +0 -87
- package/lib-module/NavigationBar/NavigationSubMenu.js +0 -162
- package/lib-module/NavigationBar/collapseItems.js +0 -41
- package/lib-module/NavigationBar/index.js +0 -4
- package/lib-module/NavigationBar/resolveItemSelection.js +0 -16
- package/lib-module/OptimizeImage/OptimizeImage.js +0 -92
- package/lib-module/OptimizeImage/index.js +0 -2
- package/lib-module/OptimizeImage/utils/getFallbackUrl.js +0 -7
- package/lib-module/OptimizeImage/utils/getImageUrls.js +0 -12
- package/lib-module/OptimizeImage/utils/getOptimizedUrl.js +0 -17
- package/lib-module/OptimizeImage/utils/hasWebpSupport.js +0 -28
- package/lib-module/OptimizeImage/utils/index.js +0 -5
- package/lib-module/OptimizeImage/utils/isSvgUrl.js +0 -3
- package/lib-module/OrderedList/Item.js +0 -145
- package/lib-module/OrderedList/ItemBase.js +0 -27
- package/lib-module/OrderedList/OrderedList.js +0 -86
- package/lib-module/OrderedList/OrderedListBase.js +0 -45
- package/lib-module/OrderedList/constants.js +0 -2
- package/lib-module/OrderedList/index.js +0 -4
- package/lib-module/Paragraph/Paragraph.js +0 -90
- package/lib-module/Paragraph/index.js +0 -2
- package/lib-module/PreviewCard/AuthorDate.js +0 -57
- package/lib-module/PreviewCard/PreviewCard.js +0 -209
- package/lib-module/PreviewCard/index.js +0 -2
- package/lib-module/PriceLockup/PriceLockup.js +0 -335
- package/lib-module/PriceLockup/index.js +0 -2
- package/lib-module/PriceLockup/tokens.js +0 -55
- package/lib-module/Progress/ProgressBar.js +0 -83
- package/lib-module/Progress/index.js +0 -4
- package/lib-module/QuantitySelector/QuantitySelector.js +0 -261
- package/lib-module/QuantitySelector/SideButton.js +0 -70
- package/lib-module/QuantitySelector/dictionary.js +0 -26
- package/lib-module/QuantitySelector/index.js +0 -2
- package/lib-module/QuantitySelector/styles.js +0 -9
- package/lib-module/ResponsiveImage/ResponsiveImage.js +0 -95
- package/lib-module/ResponsiveImage/index.js +0 -2
- package/lib-module/Ribbon/Ribbon.js +0 -216
- package/lib-module/Ribbon/index.js +0 -2
- package/lib-module/SkeletonProvider/SkeletonImage.js +0 -39
- package/lib-module/SkeletonProvider/SkeletonProvider.js +0 -57
- package/lib-module/SkeletonProvider/SkeletonTypography.js +0 -38
- package/lib-module/SkeletonProvider/index.js +0 -2
- package/lib-module/Span/Span.js +0 -72
- package/lib-module/Span/index.js +0 -2
- package/lib-module/Spinner/Spinner.js +0 -215
- package/lib-module/Spinner/SpinnerContent.js +0 -94
- package/lib-module/Spinner/constants.js +0 -4
- package/lib-module/Spinner/index.js +0 -2
- package/lib-module/StoryCard/StoryCard.js +0 -212
- package/lib-module/StoryCard/index.js +0 -2
- package/lib-module/Table/Body.js +0 -17
- package/lib-module/Table/Cell.js +0 -176
- package/lib-module/Table/Header.js +0 -25
- package/lib-module/Table/Row.js +0 -19
- package/lib-module/Table/SubHeading.js +0 -23
- package/lib-module/Table/Table.js +0 -114
- package/lib-module/Table/index.js +0 -12
- package/lib-module/TermsAndConditions/ExpandCollapse.js +0 -153
- package/lib-module/TermsAndConditions/TermsAndConditions.js +0 -277
- package/lib-module/TermsAndConditions/dictionary.js +0 -16
- package/lib-module/TermsAndConditions/index.js +0 -1
- package/lib-module/Testimonial/Testimonial.js +0 -234
- package/lib-module/Testimonial/index.js +0 -2
- package/lib-module/Toast/Toast.js +0 -158
- package/lib-module/Toast/index.js +0 -2
- package/lib-module/Video/ControlBar/ControlBar.js +0 -288
- package/lib-module/Video/ControlBar/Controls/VideoButton/VideoButton.js +0 -70
- package/lib-module/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +0 -163
- package/lib-module/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +0 -203
- package/lib-module/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +0 -191
- package/lib-module/Video/MiddleControlButton/MiddleControlButton.js +0 -71
- package/lib-module/Video/Video.js +0 -959
- package/lib-module/Video/index.js +0 -2
- package/lib-module/Video/videoText.js +0 -55
- package/lib-module/VideoPicker/VideoPicker.js +0 -190
- package/lib-module/VideoPicker/VideoPickerPlayer.js +0 -48
- package/lib-module/VideoPicker/VideoPickerThumbnail.js +0 -218
- package/lib-module/VideoPicker/VideoSlider.js +0 -82
- package/lib-module/VideoPicker/index.js +0 -2
- package/lib-module/VideoPicker/videoPropType.js +0 -10
- package/lib-module/WaffleGrid/WaffleGrid.js +0 -157
- package/lib-module/WaffleGrid/index.js +0 -2
- package/lib-module/WebVideo/WebVideo.js +0 -191
- package/lib-module/WebVideo/index.js +0 -2
- package/lib-module/WebVideo/utils/index.js +0 -50
- package/lib-module/baseExports.js +0 -19
- package/lib-module/index.js +0 -40
- package/lib-module/server.js +0 -5
- package/lib-module/shared/ConditionalWrapper/ConditionalWrapper.js +0 -22
- package/lib-module/shared/ConditionalWrapper/index.js +0 -2
- package/lib-module/shared/FullBleedContent/FullBleedContent.js +0 -101
- package/lib-module/shared/FullBleedContent/getFullBleedBorderRadius.js +0 -55
- package/lib-module/shared/FullBleedContent/index.js +0 -4
- package/lib-module/shared/FullBleedContent/useFullBleedContentProps.js +0 -55
- package/lib-module/shared/VideoSplash/SplashButton/SplashButton.js +0 -84
- package/lib-module/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +0 -223
- package/lib-module/shared/VideoSplash/VideoSplash.js +0 -65
- package/lib-module/shared/VideoSplash/helpers.js +0 -23
- package/lib-module/utils/index.js +0 -10
- package/lib-module/utils/isElementFocusable.js +0 -8
- package/lib-module/utils/logger.js +0 -18
- package/lib-module/utils/media.js +0 -39
- package/lib-module/utils/renderStructuredContent.js +0 -66
- package/lib-module/utils/ssr.js +0 -37
- package/lib-module/utils/theming/get-theme-from-server.js +0 -16
- package/lib-module/utils/theming/with-client-theme.js +0 -24
- package/lib-module/utils/theming/with-server-theme.js +0 -26
- package/lib-module/utils/transforms.js +0 -4
- package/lib-module/utils/useOverlaidPosition.js +0 -216
- package/lib-module/utils/useTypographyTheme.js +0 -24
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _componentsBase = require("@telus-uds/components-base");
|
|
11
|
-
var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
12
|
-
var _utils = require("../utils");
|
|
13
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
16
|
-
const StyledSup = /*#__PURE__*/_styledComponents.default.sup.withConfig({
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { applyTextStyles, selectSystemProps, useCopy, useThemeTokens, variantProp } from '@telus-uds/components-base';
|
|
5
|
+
import dictionary from './dictionary';
|
|
6
|
+
import { htmlAttrs } from '../utils';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
9
|
+
const StyledSup = /*#__PURE__*/styled.sup.withConfig({
|
|
17
10
|
displayName: "FootnoteLink__StyledSup",
|
|
18
11
|
componentId: "components-web__sc-17nd7xo-0"
|
|
19
12
|
})(_ref => {
|
|
@@ -37,7 +30,7 @@ const StyledSup = /*#__PURE__*/_styledComponents.default.sup.withConfig({
|
|
|
37
30
|
paddingRight,
|
|
38
31
|
textDecoration: 'underline',
|
|
39
32
|
// apply font family
|
|
40
|
-
...
|
|
33
|
+
...applyTextStyles(fontNameAndWeight)
|
|
41
34
|
};
|
|
42
35
|
});
|
|
43
36
|
|
|
@@ -50,7 +43,7 @@ const StyledSup = /*#__PURE__*/_styledComponents.default.sup.withConfig({
|
|
|
50
43
|
* - Avoid using FootnoteLink if there is only one annotation on a page. Consider including
|
|
51
44
|
* the annotation as part of the content whenever possible.
|
|
52
45
|
*/
|
|
53
|
-
const FootnoteLink = /*#__PURE__*/
|
|
46
|
+
const FootnoteLink = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
54
47
|
let {
|
|
55
48
|
copy = 'en',
|
|
56
49
|
number = [],
|
|
@@ -60,14 +53,14 @@ const FootnoteLink = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
60
53
|
variant = {},
|
|
61
54
|
...rest
|
|
62
55
|
} = _ref2;
|
|
63
|
-
const themeTokens =
|
|
56
|
+
const themeTokens = useThemeTokens('FootnoteLink', tokens, variant);
|
|
64
57
|
const numbers = Array.isArray(number) ? number : [number];
|
|
65
|
-
const refs = numbers.map(() => /*#__PURE__*/
|
|
58
|
+
const refs = numbers.map(() => /*#__PURE__*/React.createRef());
|
|
66
59
|
const handleClick = index => {
|
|
67
60
|
onClick(numbers[index], refs[index]);
|
|
68
61
|
};
|
|
69
|
-
const getCopy =
|
|
70
|
-
dictionary
|
|
62
|
+
const getCopy = useCopy({
|
|
63
|
+
dictionary,
|
|
71
64
|
copy
|
|
72
65
|
});
|
|
73
66
|
const handleOnClick = (event, index) => {
|
|
@@ -80,9 +73,9 @@ const FootnoteLink = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
80
73
|
handleClick(index);
|
|
81
74
|
}
|
|
82
75
|
};
|
|
83
|
-
return /*#__PURE__*/(
|
|
76
|
+
return /*#__PURE__*/_jsx("span", {
|
|
84
77
|
ref: ref,
|
|
85
|
-
children: numbers.map((num, index) => /*#__PURE__*/(
|
|
78
|
+
children: numbers.map((num, index) => /*#__PURE__*/_jsx(StyledSup, {
|
|
86
79
|
onKeyDown: event => handleOnKeyDown(event, index),
|
|
87
80
|
role: "button",
|
|
88
81
|
"aria-label": getCopy('a11yLabel'),
|
|
@@ -97,30 +90,29 @@ const FootnoteLink = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
97
90
|
});
|
|
98
91
|
});
|
|
99
92
|
FootnoteLink.displayName = 'FootnoteLink';
|
|
100
|
-
const copyShape =
|
|
101
|
-
a11yLabel:
|
|
93
|
+
const copyShape = PropTypes.shape({
|
|
94
|
+
a11yLabel: PropTypes.string.isRequired
|
|
102
95
|
});
|
|
103
96
|
FootnoteLink.propTypes = {
|
|
104
97
|
...selectedSystemPropTypes,
|
|
105
|
-
variant:
|
|
98
|
+
variant: variantProp.propType,
|
|
106
99
|
/**
|
|
107
100
|
* Use the `copy` prop to either select provided English or French copy by passing 'en' or 'fr' respectively.
|
|
108
101
|
* To provide your own, pass a JSON object with the key `a11yLabel`.
|
|
109
102
|
*/
|
|
110
|
-
copy:
|
|
103
|
+
copy: PropTypes.oneOfType([PropTypes.oneOf(['en', 'fr']), copyShape]),
|
|
111
104
|
/**
|
|
112
105
|
* The footnote number, or multiple numbers if passed as an array.
|
|
113
106
|
* If using an array, a comma-separated group of numbers will be rendered as superscript.
|
|
114
107
|
*/
|
|
115
|
-
number:
|
|
108
|
+
number: PropTypes.oneOfType([PropTypes.number, PropTypes.arrayOf(PropTypes.number), PropTypes.string, PropTypes.arrayOf(PropTypes.string)]).isRequired,
|
|
116
109
|
/**
|
|
117
110
|
* A callback function to handle the click of a FootnoteLink.
|
|
118
111
|
*/
|
|
119
|
-
onClick:
|
|
112
|
+
onClick: PropTypes.func.isRequired,
|
|
120
113
|
/**
|
|
121
114
|
* Override default `fontSize` to set specific font size value
|
|
122
115
|
*/
|
|
123
|
-
fontSize:
|
|
116
|
+
fontSize: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
124
117
|
};
|
|
125
|
-
|
|
126
|
-
exports.default = _default;
|
|
118
|
+
export default FootnoteLink;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _default = {
|
|
1
|
+
export default {
|
|
8
2
|
en: {
|
|
9
3
|
a11yLabel: 'Read legal footnote',
|
|
10
4
|
close: 'close',
|
|
@@ -15,5 +9,4 @@ var _default = {
|
|
|
15
9
|
close: 'fermer',
|
|
16
10
|
heading: 'Modalités et conditions'
|
|
17
11
|
}
|
|
18
|
-
};
|
|
19
|
-
exports.default = _default;
|
|
12
|
+
};
|
package/lib/Footnote/index.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _Footnote = _interopRequireDefault(require("./Footnote"));
|
|
8
|
-
var _FootnoteLink = _interopRequireDefault(require("./FootnoteLink"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
_Footnote.default.Link = _FootnoteLink.default;
|
|
11
|
-
var _default = _Footnote.default;
|
|
12
|
-
exports.default = _default;
|
|
1
|
+
import Footnote from './Footnote';
|
|
2
|
+
import FootnoteLink from './FootnoteLink';
|
|
3
|
+
Footnote.Link = FootnoteLink;
|
|
4
|
+
export default Footnote;
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _componentsBase = require("@telus-uds/components-base");
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
const IconButton = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { IconButton as IconButtonBase, useThemeTokens, getTokensPropType } from '@telus-uds/components-base';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const IconButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
13
6
|
let {
|
|
14
7
|
icon = null,
|
|
15
8
|
action,
|
|
@@ -23,13 +16,13 @@ const IconButton = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
23
16
|
} : variant;
|
|
24
17
|
const {
|
|
25
18
|
icon: themeIcon
|
|
26
|
-
} =
|
|
19
|
+
} = useThemeTokens('IconButton', tokens, variantWithAction);
|
|
27
20
|
return (
|
|
28
21
|
/*#__PURE__*/
|
|
29
22
|
// If we want the arrow icons to have directional animation instead of scale, we can pass
|
|
30
23
|
// either appropriate iconTransateX/Y here, or define and pass variants like { direction: 'left' }
|
|
31
24
|
// which have theme rules that set `iconTranslateX` tokens in the theme rules and unset `iconScale`.
|
|
32
|
-
(
|
|
25
|
+
_jsx(IconButtonBase, {
|
|
33
26
|
ref: ref,
|
|
34
27
|
...iconButtonProps,
|
|
35
28
|
tokens: tokens,
|
|
@@ -48,16 +41,15 @@ const propsWithoutIcon = _ref2 => {
|
|
|
48
41
|
return props;
|
|
49
42
|
};
|
|
50
43
|
IconButton.propTypes = {
|
|
51
|
-
...propsWithoutIcon(
|
|
52
|
-
tokens:
|
|
44
|
+
...propsWithoutIcon(IconButtonBase.propTypes),
|
|
45
|
+
tokens: getTokensPropType('IconButton'),
|
|
53
46
|
/**
|
|
54
47
|
* To set the icon to a multi-brand compatabile icon
|
|
55
48
|
*/
|
|
56
|
-
action:
|
|
49
|
+
action: PropTypes.oneOf(multiBrandIconNames),
|
|
57
50
|
/**
|
|
58
51
|
* To set a custom icon
|
|
59
52
|
*/
|
|
60
|
-
icon:
|
|
53
|
+
icon: PropTypes.func
|
|
61
54
|
};
|
|
62
|
-
|
|
63
|
-
exports.default = _default;
|
|
55
|
+
export default IconButton;
|
package/lib/IconButton/index.js
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _IconButton = _interopRequireDefault(require("./IconButton"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
var _default = _IconButton.default;
|
|
10
|
-
exports.default = _default;
|
|
1
|
+
import IconButton from './IconButton';
|
|
2
|
+
export default IconButton;
|
package/lib/Image/Image.js
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _server = require("@telus-uds/components-base/server");
|
|
10
|
-
var _logger = require("../utils/logger");
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
const [selectProps, selectedSystemPropTypes] = (0, _server.selectSystemProps)([_server.htmlAttrs]);
|
|
14
|
-
const Image = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { htmlAttrs, selectSystemProps, getTokensPropType } from '@telus-uds/components-base/server';
|
|
4
|
+
import { warn } from '../utils/logger';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
7
|
+
const Image = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
15
8
|
let {
|
|
16
9
|
src,
|
|
17
10
|
width,
|
|
@@ -31,7 +24,7 @@ const Image = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
31
24
|
const isCorners = rounded === 'corners';
|
|
32
25
|
const isSquare = width === height;
|
|
33
26
|
if (isCircle && !isSquare) {
|
|
34
|
-
|
|
27
|
+
warn('Image', 'rounded="circle" is not supported for non-square images. Please provide a square image, otherwise the resulting shape will not be a circle.');
|
|
35
28
|
}
|
|
36
29
|
if (isCircle) {
|
|
37
30
|
borderRadius = '50%';
|
|
@@ -43,7 +36,7 @@ const Image = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
43
36
|
height: height ?? 'auto',
|
|
44
37
|
maxWidth: '100%'
|
|
45
38
|
};
|
|
46
|
-
return /*#__PURE__*/(
|
|
39
|
+
return /*#__PURE__*/_jsx("img", {
|
|
47
40
|
...selectProps(rest),
|
|
48
41
|
style: style,
|
|
49
42
|
src: src,
|
|
@@ -61,31 +54,30 @@ Image.propTypes = {
|
|
|
61
54
|
* The src attribute for the HTML img element.
|
|
62
55
|
*/
|
|
63
56
|
|
|
64
|
-
src:
|
|
57
|
+
src: PropTypes.string.isRequired,
|
|
65
58
|
/**
|
|
66
59
|
* The alt attribute for the HTML img element. Setting this attribute to an empty string (alt="") indicates that this image is not a key part of the content, and that non-visual browsers may omit it from rendering.
|
|
67
60
|
*/
|
|
68
|
-
alt:
|
|
61
|
+
alt: PropTypes.string.isRequired,
|
|
69
62
|
/**
|
|
70
63
|
* The image's width.
|
|
71
64
|
*/
|
|
72
|
-
width:
|
|
65
|
+
width: PropTypes.number.isRequired,
|
|
73
66
|
/**
|
|
74
67
|
* The image's height.
|
|
75
68
|
*/
|
|
76
|
-
height:
|
|
69
|
+
height: PropTypes.number,
|
|
77
70
|
/**
|
|
78
71
|
* Loading strategy.
|
|
79
72
|
* @default 'eager'
|
|
80
73
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading
|
|
81
74
|
*/
|
|
82
|
-
loading:
|
|
75
|
+
loading: PropTypes.oneOf(['eager', 'lazy']),
|
|
83
76
|
/**
|
|
84
77
|
* Make image render as a circle or with rounded corners.
|
|
85
78
|
*/
|
|
86
|
-
rounded:
|
|
87
|
-
tokens:
|
|
79
|
+
rounded: PropTypes.oneOf(['circle', 'corners']),
|
|
80
|
+
tokens: getTokensPropType('Image')
|
|
88
81
|
};
|
|
89
82
|
Image.displayName = 'Image';
|
|
90
|
-
|
|
91
|
-
exports.default = _default;
|
|
83
|
+
export default Image;
|
package/lib/Image/index.js
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
Object.defineProperty(exports, "DefaultImage", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () {
|
|
10
|
-
return _Image.default;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
exports.default = void 0;
|
|
14
|
-
var _Image = _interopRequireDefault(require("./Image"));
|
|
15
|
-
var _withClientTheme = _interopRequireDefault(require("../utils/theming/with-client-theme"));
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
// Exporting the unwrapped component separately for react-docgen to extract info for docsite
|
|
3
|
+
import Image from './Image';
|
|
4
|
+
import withClientTheme from '../utils/theming/with-client-theme';
|
|
18
5
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
// Exporting the unwrapped component separately for react-docgen to extract info for docsite
|
|
7
|
+
export { Image as DefaultImage };
|
|
8
|
+
const ClientThemedImage = withClientTheme(Image);
|
|
9
|
+
export default ClientThemedImage;
|
package/lib/Image/server.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _withServerTheme = _interopRequireDefault(require("../utils/theming/with-server-theme"));
|
|
8
|
-
var _Image = _interopRequireDefault(require("./Image"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
const ServerThemedImage = (0, _withServerTheme.default)(_Image.default, 'Image');
|
|
11
|
-
var _default = ServerThemedImage;
|
|
12
|
-
exports.default = _default;
|
|
1
|
+
import withServerTheme from '../utils/theming/with-server-theme';
|
|
2
|
+
import Image from './Image';
|
|
3
|
+
const ServerThemedImage = withServerTheme(Image, 'Image');
|
|
4
|
+
export default ServerThemedImage;
|
package/lib/List/List.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _componentsBase = require("@telus-uds/components-base");
|
|
8
|
-
var _default = _componentsBase.ListBase;
|
|
9
|
-
exports.default = _default;
|
|
1
|
+
import { ListBase as List } from '@telus-uds/components-base';
|
|
2
|
+
export default List;
|
package/lib/List/ListItem.js
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _componentsBase = require("@telus-uds/components-base");
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
const ListItem = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { ListItem as ListItemBase, Typography } from '@telus-uds/components-base';
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
const ListItem = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
13
6
|
let {
|
|
14
7
|
children,
|
|
15
8
|
title,
|
|
16
9
|
...rest
|
|
17
10
|
} = _ref;
|
|
18
|
-
return /*#__PURE__*/(
|
|
11
|
+
return /*#__PURE__*/_jsxs(ListItemBase, {
|
|
19
12
|
ref: ref,
|
|
20
13
|
...rest,
|
|
21
|
-
children: [Boolean(title) && /*#__PURE__*/(
|
|
14
|
+
children: [Boolean(title) && /*#__PURE__*/_jsx(Typography, {
|
|
22
15
|
variant: {
|
|
23
16
|
size: 'h4'
|
|
24
17
|
},
|
|
@@ -28,8 +21,7 @@ const ListItem = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
28
21
|
});
|
|
29
22
|
ListItem.displayName = 'ListItem';
|
|
30
23
|
ListItem.propTypes = {
|
|
31
|
-
children:
|
|
32
|
-
title:
|
|
24
|
+
children: PropTypes.node.isRequired,
|
|
25
|
+
title: PropTypes.string
|
|
33
26
|
};
|
|
34
|
-
|
|
35
|
-
exports.default = _default;
|
|
27
|
+
export default ListItem;
|
package/lib/List/index.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _List = _interopRequireDefault(require("./List"));
|
|
8
|
-
var _ListItem = _interopRequireDefault(require("./ListItem"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
_List.default.Item = _ListItem.default;
|
|
11
|
-
var _default = _List.default;
|
|
12
|
-
exports.default = _default;
|
|
1
|
+
import List from './List';
|
|
2
|
+
import ListItem from './ListItem';
|
|
3
|
+
List.Item = ListItem;
|
|
4
|
+
export default List;
|
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _componentsBase = require("@telus-uds/components-base");
|
|
10
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
-
var _utils = require("../utils");
|
|
12
|
-
var _NavigationItem = _interopRequireDefault(require("./NavigationItem"));
|
|
13
|
-
var _NavigationSubMenu = _interopRequireDefault(require("./NavigationSubMenu"));
|
|
14
|
-
var _collapseItems = _interopRequireDefault(require("./collapseItems"));
|
|
15
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
1
|
var _withLinkRouter$propT, _withLinkRouter$propT2, _withLinkRouter$propT3, _withLinkRouter$propT4;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { selectSystemProps, StackView, Typography, useResponsiveProp, withLinkRouter } from '@telus-uds/components-base';
|
|
5
|
+
import styled from 'styled-components';
|
|
6
|
+
import { htmlAttrs } from '../utils';
|
|
7
|
+
import NavigationItem from './NavigationItem';
|
|
8
|
+
import NavigationSubMenu from './NavigationSubMenu';
|
|
9
|
+
import collapseItems from './collapseItems';
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
12
|
+
const Heading = /*#__PURE__*/styled.div.withConfig({
|
|
20
13
|
displayName: "NavigationBar__Heading",
|
|
21
14
|
componentId: "components-web__sc-1vis1gt-0"
|
|
22
15
|
})({
|
|
@@ -34,7 +27,7 @@ const Heading = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
|
34
27
|
* NavigationBar can be used to allow customers to consistently navigate across
|
|
35
28
|
* key pages within a specific product line
|
|
36
29
|
*/
|
|
37
|
-
const NavigationBar = /*#__PURE__*/
|
|
30
|
+
const NavigationBar = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
38
31
|
let {
|
|
39
32
|
accessibilityRole = 'navigation',
|
|
40
33
|
heading,
|
|
@@ -46,16 +39,16 @@ const NavigationBar = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
46
39
|
linkRouterProps,
|
|
47
40
|
...rest
|
|
48
41
|
} = _ref;
|
|
49
|
-
const direction =
|
|
42
|
+
const direction = useResponsiveProp({
|
|
50
43
|
xs: 'column',
|
|
51
44
|
sm: 'row'
|
|
52
45
|
});
|
|
53
|
-
const itemsForViewport =
|
|
54
|
-
xs: (
|
|
46
|
+
const itemsForViewport = useResponsiveProp({
|
|
47
|
+
xs: collapseItems(items, selectedId),
|
|
55
48
|
lg: items
|
|
56
49
|
});
|
|
57
|
-
const openOverlayRef =
|
|
58
|
-
const [openSubMenuId, setOpenSubMenuId] =
|
|
50
|
+
const openOverlayRef = React.useRef(null);
|
|
51
|
+
const [openSubMenuId, setOpenSubMenuId] = React.useState(null);
|
|
59
52
|
const handleSubMenuClose = event => {
|
|
60
53
|
var _openOverlayRef$curre, _openOverlayRef$curre2;
|
|
61
54
|
if (event.type === 'keydown') {
|
|
@@ -68,12 +61,12 @@ const NavigationBar = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
68
61
|
setOpenSubMenuId(null);
|
|
69
62
|
}
|
|
70
63
|
};
|
|
71
|
-
const navRefDefault =
|
|
64
|
+
const navRefDefault = React.useRef(null);
|
|
72
65
|
const navRef = ref ?? navRefDefault;
|
|
73
|
-
const itemsRef =
|
|
66
|
+
const itemsRef = React.useRef(null);
|
|
74
67
|
|
|
75
68
|
// Close the submenu when the user clicks outside the navigation bar
|
|
76
|
-
const handleMouseDown =
|
|
69
|
+
const handleMouseDown = React.useCallback(event => {
|
|
77
70
|
if (navRef.current && itemsRef.current) {
|
|
78
71
|
// Get the bounding rectangles of the navigation bar and the items container
|
|
79
72
|
const navRect = navRef.current.getBoundingClientRect();
|
|
@@ -89,7 +82,7 @@ const NavigationBar = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
89
82
|
}, [navRef, itemsRef, setOpenSubMenuId]);
|
|
90
83
|
|
|
91
84
|
// TODO: create a custom hook for that and use here and in the Footnote
|
|
92
|
-
|
|
85
|
+
React.useEffect(() => {
|
|
93
86
|
// Add listeners for mouse clicks outside and for key presses
|
|
94
87
|
document.addEventListener('mousedown', handleMouseDown);
|
|
95
88
|
if (openSubMenuId !== null) {
|
|
@@ -107,7 +100,7 @@ const NavigationBar = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
107
100
|
}
|
|
108
101
|
};
|
|
109
102
|
}, [openSubMenuId, handleMouseDown]);
|
|
110
|
-
return /*#__PURE__*/(
|
|
103
|
+
return /*#__PURE__*/_jsxs(StackView, {
|
|
111
104
|
accessibilityRole: accessibilityRole,
|
|
112
105
|
direction: direction,
|
|
113
106
|
ref: navRef,
|
|
@@ -117,8 +110,8 @@ const NavigationBar = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
117
110
|
justifyContent: 'flex-end'
|
|
118
111
|
},
|
|
119
112
|
...selectProps(rest),
|
|
120
|
-
children: [heading && /*#__PURE__*/(
|
|
121
|
-
children: /*#__PURE__*/(
|
|
113
|
+
children: [heading && /*#__PURE__*/_jsx(Heading, {
|
|
114
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
122
115
|
variant: {
|
|
123
116
|
size: 'h5'
|
|
124
117
|
},
|
|
@@ -142,12 +135,12 @@ const NavigationBar = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
142
135
|
if (nestedItems) {
|
|
143
136
|
setOpenSubMenuId(openSubMenuId !== itemId ? itemId : null);
|
|
144
137
|
}
|
|
145
|
-
onClick === null || onClick === void 0
|
|
146
|
-
onChange === null || onChange === void 0
|
|
138
|
+
onClick === null || onClick === void 0 || onClick(event);
|
|
139
|
+
onChange === null || onChange === void 0 || onChange(itemId, event);
|
|
147
140
|
};
|
|
148
|
-
const ItemComponent = nestedItems ?
|
|
141
|
+
const ItemComponent = nestedItems ? NavigationSubMenu : NavigationItem;
|
|
149
142
|
const isOpen = itemId === openSubMenuId;
|
|
150
|
-
return /*#__PURE__*/(
|
|
143
|
+
return /*#__PURE__*/_jsx(ItemComponent, {
|
|
151
144
|
ref: itemRef,
|
|
152
145
|
href: href,
|
|
153
146
|
onClick: handleClick
|
|
@@ -178,7 +171,7 @@ const NavigationBar = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
178
171
|
NavigationBar.displayName = 'NavigationBar';
|
|
179
172
|
NavigationBar.propTypes = {
|
|
180
173
|
...selectedSystemPropTypes,
|
|
181
|
-
...
|
|
174
|
+
...withLinkRouter.propTypes,
|
|
182
175
|
/**
|
|
183
176
|
* NavigationBar pages
|
|
184
177
|
*
|
|
@@ -187,45 +180,44 @@ NavigationBar.propTypes = {
|
|
|
187
180
|
* - `href` - the URL of the page linked to. Do not use hash links, for content within a page, use `Tabs`.
|
|
188
181
|
* - `id` - a stable, unique identifier of the page within the set. Not written into the HTML.
|
|
189
182
|
*/
|
|
190
|
-
items:
|
|
191
|
-
label:
|
|
192
|
-
href:
|
|
193
|
-
id:
|
|
194
|
-
onClick:
|
|
195
|
-
selected:
|
|
196
|
-
LinkRouter: (_withLinkRouter$propT =
|
|
197
|
-
linkRouterProps: (_withLinkRouter$propT2 =
|
|
183
|
+
items: PropTypes.arrayOf(PropTypes.shape({
|
|
184
|
+
label: PropTypes.string.isRequired,
|
|
185
|
+
href: PropTypes.string,
|
|
186
|
+
id: PropTypes.string.isRequired,
|
|
187
|
+
onClick: PropTypes.func,
|
|
188
|
+
selected: PropTypes.bool,
|
|
189
|
+
LinkRouter: (_withLinkRouter$propT = withLinkRouter.propTypes) === null || _withLinkRouter$propT === void 0 ? void 0 : _withLinkRouter$propT.LinkRouter,
|
|
190
|
+
linkRouterProps: (_withLinkRouter$propT2 = withLinkRouter.propTypes) === null || _withLinkRouter$propT2 === void 0 ? void 0 : _withLinkRouter$propT2.linkRouterProps,
|
|
198
191
|
// One layer of nested links is allowed
|
|
199
|
-
items:
|
|
200
|
-
label:
|
|
201
|
-
href:
|
|
202
|
-
id:
|
|
203
|
-
onClick:
|
|
204
|
-
selected:
|
|
205
|
-
LinkRouter: (_withLinkRouter$propT3 =
|
|
206
|
-
linkRouterProps: (_withLinkRouter$propT4 =
|
|
192
|
+
items: PropTypes.arrayOf(PropTypes.shape({
|
|
193
|
+
label: PropTypes.string.isRequired,
|
|
194
|
+
href: PropTypes.string,
|
|
195
|
+
id: PropTypes.string.isRequired,
|
|
196
|
+
onClick: PropTypes.func,
|
|
197
|
+
selected: PropTypes.bool,
|
|
198
|
+
LinkRouter: (_withLinkRouter$propT3 = withLinkRouter.propTypes) === null || _withLinkRouter$propT3 === void 0 ? void 0 : _withLinkRouter$propT3.LinkRouter,
|
|
199
|
+
linkRouterProps: (_withLinkRouter$propT4 = withLinkRouter.propTypes) === null || _withLinkRouter$propT4 === void 0 ? void 0 : _withLinkRouter$propT4.linkRouterProps
|
|
207
200
|
}))
|
|
208
201
|
})).isRequired,
|
|
209
202
|
/**
|
|
210
203
|
* Common navigation bar heading.
|
|
211
204
|
*/
|
|
212
|
-
heading:
|
|
205
|
+
heading: PropTypes.string,
|
|
213
206
|
/**
|
|
214
207
|
* Sets the `headingLevel` of the `heading`
|
|
215
208
|
*/
|
|
216
|
-
headingLevel:
|
|
209
|
+
headingLevel: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6']),
|
|
217
210
|
/**
|
|
218
211
|
* Matches the `id` property of the item in `items` corresponding to the current page
|
|
219
212
|
*/
|
|
220
|
-
selectedId:
|
|
213
|
+
selectedId: PropTypes.string.isRequired,
|
|
221
214
|
/**
|
|
222
215
|
* Optional function to be called on pressing a link
|
|
223
216
|
*/
|
|
224
|
-
onChange:
|
|
217
|
+
onChange: PropTypes.func,
|
|
225
218
|
/**
|
|
226
219
|
* Accesibility role for stackview
|
|
227
220
|
*/
|
|
228
|
-
accessibilityRole:
|
|
221
|
+
accessibilityRole: PropTypes.string
|
|
229
222
|
};
|
|
230
|
-
|
|
231
|
-
exports.default = _default;
|
|
223
|
+
export default NavigationBar;
|