@telus-uds/components-web 2.43.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 +21 -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 +105 -101
- 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 +17 -4
- 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 -506
- 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,250 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { Helmet, HelmetProvider } from 'react-helmet-async';
|
|
5
|
-
import { isEqual } from 'lodash';
|
|
6
|
-
import { componentPropType, selectSystemProps, unpackFragment, withLinkRouter, getTokensPropType, useThemeTokens, useViewport } from '@telus-uds/components-base';
|
|
7
|
-
import { htmlAttrs } from '../utils';
|
|
8
|
-
import Item from './Item/Item';
|
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
import { createElement as _createElement } from "react";
|
|
11
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
13
|
-
const StyledList = /*#__PURE__*/styled.ol.withConfig({
|
|
14
|
-
displayName: "Breadcrumbs__StyledList",
|
|
15
|
-
componentId: "components-web__sc-gwwxrc-0"
|
|
16
|
-
})({
|
|
17
|
-
display: 'flex',
|
|
18
|
-
flexDirection: 'row',
|
|
19
|
-
flexWrap: 'wrap',
|
|
20
|
-
listStyle: 'none',
|
|
21
|
-
listStylePosition: 'inside',
|
|
22
|
-
margin: 0,
|
|
23
|
-
padding: 0,
|
|
24
|
-
alignItems: 'baseline'
|
|
25
|
-
});
|
|
26
|
-
const omitProps = _ref => {
|
|
27
|
-
let {
|
|
28
|
-
current,
|
|
29
|
-
path,
|
|
30
|
-
breadcrumbName,
|
|
31
|
-
indexRoute,
|
|
32
|
-
childRoutes,
|
|
33
|
-
component,
|
|
34
|
-
...props
|
|
35
|
-
} = _ref;
|
|
36
|
-
return props;
|
|
37
|
-
};
|
|
38
|
-
const getBreadcrumbName = (item, params) => {
|
|
39
|
-
if (!item.breadcrumbName) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
let {
|
|
43
|
-
breadcrumbName
|
|
44
|
-
} = item;
|
|
45
|
-
Object.keys(params).forEach(key => {
|
|
46
|
-
breadcrumbName = breadcrumbName.replace(`:${key}`, params[key]);
|
|
47
|
-
});
|
|
48
|
-
return breadcrumbName;
|
|
49
|
-
};
|
|
50
|
-
const getPath = (path, params, concatenatePaths, paths) => {
|
|
51
|
-
let p = path;
|
|
52
|
-
if (concatenatePaths) {
|
|
53
|
-
p = p.replace(/^\//, '');
|
|
54
|
-
Object.keys(params).forEach(key => {
|
|
55
|
-
p = p.replace(`:${key}`, params[key]);
|
|
56
|
-
});
|
|
57
|
-
if (p) {
|
|
58
|
-
paths.push(p);
|
|
59
|
-
}
|
|
60
|
-
return `/${paths.join('/')}`;
|
|
61
|
-
}
|
|
62
|
-
return p;
|
|
63
|
-
};
|
|
64
|
-
const getItems = (items, params, concatenatePaths) => {
|
|
65
|
-
const paths = [];
|
|
66
|
-
return items.filter(item => item.path).map((item, i, filteredItems) => {
|
|
67
|
-
const isLast = i === filteredItems.length - 1;
|
|
68
|
-
const breadcrumbName = getBreadcrumbName(item, params);
|
|
69
|
-
const href = getPath(item.path, params, concatenatePaths, paths);
|
|
70
|
-
const {
|
|
71
|
-
LinkRouter,
|
|
72
|
-
linkRouterProps
|
|
73
|
-
} = item;
|
|
74
|
-
return {
|
|
75
|
-
breadcrumbName,
|
|
76
|
-
href: item.isExpander ? '#' : href,
|
|
77
|
-
current: isLast,
|
|
78
|
-
LinkRouter,
|
|
79
|
-
linkRouterProps,
|
|
80
|
-
onPress: item.onPress,
|
|
81
|
-
...omitProps(selectProps(item))
|
|
82
|
-
};
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
const getStructuredData = (items, baseUrl) => {
|
|
86
|
-
return items.map((item, index) => ({
|
|
87
|
-
'@type': 'ListItem',
|
|
88
|
-
position: index + 1,
|
|
89
|
-
item: {
|
|
90
|
-
'@id': `${baseUrl || ''}${item.href}`,
|
|
91
|
-
name: item.breadcrumbName
|
|
92
|
-
}
|
|
93
|
-
}));
|
|
94
|
-
};
|
|
95
|
-
const MAX_ITEMS_ON_XS_VIEWPORT = 4;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Display a hierarchy of links, commonly used for navigation.
|
|
99
|
-
*/
|
|
100
|
-
const Breadcrumbs = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
101
|
-
let {
|
|
102
|
-
baseUrl,
|
|
103
|
-
children,
|
|
104
|
-
linkRouterProps,
|
|
105
|
-
params = {},
|
|
106
|
-
tokens,
|
|
107
|
-
routes,
|
|
108
|
-
variant,
|
|
109
|
-
LinkRouter,
|
|
110
|
-
...rest
|
|
111
|
-
} = _ref2;
|
|
112
|
-
// React Helmet can cause a memory leak in SSR if not properly configured.
|
|
113
|
-
// Only run it in SSR if theme options tells us to.
|
|
114
|
-
/* const {
|
|
115
|
-
themeOptions: { enableHelmetSSR }
|
|
116
|
-
} = useTheme() */
|
|
117
|
-
// const isHydrating = useHydrationContext()
|
|
118
|
-
// const isSSR = typeof window === 'undefined' || isHydrating
|
|
119
|
-
// const hasMetadata = isSSR ? enableHelmetSSR : true
|
|
120
|
-
const helmetContext = {};
|
|
121
|
-
const activeRoutes = children ? React.Children.map(unpackFragment(children), _ref3 => {
|
|
122
|
-
let {
|
|
123
|
-
props: {
|
|
124
|
-
href,
|
|
125
|
-
children: breadcrumbName,
|
|
126
|
-
...itemRest
|
|
127
|
-
},
|
|
128
|
-
ref: routeRef
|
|
129
|
-
} = _ref3;
|
|
130
|
-
return {
|
|
131
|
-
path: href,
|
|
132
|
-
breadcrumbName,
|
|
133
|
-
routeRef,
|
|
134
|
-
...itemRest
|
|
135
|
-
};
|
|
136
|
-
}) : routes.filter(route => route.path && route.breadcrumbName);
|
|
137
|
-
const [optionsHidden, setOptionsHidden] = React.useState(false);
|
|
138
|
-
const [itemsToBeRendered, setItemsToBeRendered] = React.useState([]);
|
|
139
|
-
const viewport = useViewport();
|
|
140
|
-
React.useEffect(() => {
|
|
141
|
-
if (optionsHidden) {
|
|
142
|
-
if (viewport !== 'xs' && !isEqual(itemsToBeRendered, activeRoutes)) {
|
|
143
|
-
setItemsToBeRendered(activeRoutes);
|
|
144
|
-
}
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
if (viewport === 'xs' && activeRoutes.length >= MAX_ITEMS_ON_XS_VIEWPORT) {
|
|
148
|
-
const newItems = [...activeRoutes.slice(0, 2), {
|
|
149
|
-
path: '#',
|
|
150
|
-
breadcrumbName: '...',
|
|
151
|
-
onPress: event => {
|
|
152
|
-
event.preventDefault();
|
|
153
|
-
setItemsToBeRendered(activeRoutes);
|
|
154
|
-
},
|
|
155
|
-
isExpander: true
|
|
156
|
-
}, activeRoutes[activeRoutes.length - 1]];
|
|
157
|
-
setItemsToBeRendered(newItems);
|
|
158
|
-
setOptionsHidden(true);
|
|
159
|
-
} else if (!isEqual(itemsToBeRendered, activeRoutes)) {
|
|
160
|
-
setItemsToBeRendered(activeRoutes);
|
|
161
|
-
}
|
|
162
|
-
}, [viewport, activeRoutes, optionsHidden, itemsToBeRendered]);
|
|
163
|
-
const items = getItems(itemsToBeRendered, params, !children);
|
|
164
|
-
const themeTokens = useThemeTokens('Breadcrumbs', tokens, variant);
|
|
165
|
-
const metadata = /*#__PURE__*/_jsx(HelmetProvider, {
|
|
166
|
-
context: helmetContext,
|
|
167
|
-
children: /*#__PURE__*/_jsx(Helmet, {
|
|
168
|
-
children: /*#__PURE__*/_jsx("script", {
|
|
169
|
-
type: "application/ld+json",
|
|
170
|
-
children: `
|
|
171
|
-
{
|
|
172
|
-
"@context": "http://schema.org",
|
|
173
|
-
"@type": "BreadcrumbList",
|
|
174
|
-
"itemListElement": ${JSON.stringify(getStructuredData(items, baseUrl))}
|
|
175
|
-
}
|
|
176
|
-
`
|
|
177
|
-
})
|
|
178
|
-
})
|
|
179
|
-
});
|
|
180
|
-
return /*#__PURE__*/_jsxs("nav", {
|
|
181
|
-
"aria-label": "Breadcrumb",
|
|
182
|
-
ref: ref,
|
|
183
|
-
...selectProps(rest),
|
|
184
|
-
children: [/*#__PURE__*/_jsx(StyledList, {
|
|
185
|
-
iconContainerSize: themeTokens.iconContainerSize,
|
|
186
|
-
children: items.map(_ref4 => {
|
|
187
|
-
let {
|
|
188
|
-
href,
|
|
189
|
-
current,
|
|
190
|
-
breadcrumbName,
|
|
191
|
-
LinkRouter: ItemLinkRouter = LinkRouter,
|
|
192
|
-
linkRouterProps: itemLinkRouterProps,
|
|
193
|
-
onPress,
|
|
194
|
-
...itemRest
|
|
195
|
-
} = _ref4;
|
|
196
|
-
return /*#__PURE__*/_createElement(Item, {
|
|
197
|
-
...itemRest,
|
|
198
|
-
current: current,
|
|
199
|
-
href: href,
|
|
200
|
-
tokens: tokens,
|
|
201
|
-
key: href,
|
|
202
|
-
linkRouterProps: {
|
|
203
|
-
...linkRouterProps,
|
|
204
|
-
...itemLinkRouterProps
|
|
205
|
-
},
|
|
206
|
-
variant: {
|
|
207
|
-
...variant,
|
|
208
|
-
size: 'micro'
|
|
209
|
-
},
|
|
210
|
-
LinkRouter: ItemLinkRouter,
|
|
211
|
-
onPress: onPress
|
|
212
|
-
}, breadcrumbName);
|
|
213
|
-
})
|
|
214
|
-
}), metadata]
|
|
215
|
-
});
|
|
216
|
-
});
|
|
217
|
-
Breadcrumbs.displayName = 'Breadcrumbs';
|
|
218
|
-
Breadcrumbs.propTypes = {
|
|
219
|
-
...selectedSystemPropTypes,
|
|
220
|
-
tokens: getTokensPropType('Breadcrumbs'),
|
|
221
|
-
...withLinkRouter.propTypes,
|
|
222
|
-
/**
|
|
223
|
-
* Base URL used to build structured data.
|
|
224
|
-
*/
|
|
225
|
-
baseUrl: PropTypes.string,
|
|
226
|
-
/**
|
|
227
|
-
* A list of Items to be used as an alternative to the `routes` prop.
|
|
228
|
-
*/
|
|
229
|
-
children: componentPropType('Item'),
|
|
230
|
-
/**
|
|
231
|
-
* React Router params.
|
|
232
|
-
*/
|
|
233
|
-
params: PropTypes.object,
|
|
234
|
-
/**
|
|
235
|
-
* An array of routes to be displayed as breadcrumbs.
|
|
236
|
-
*/
|
|
237
|
-
routes: PropTypes.arrayOf(PropTypes.shape({
|
|
238
|
-
path: PropTypes.string,
|
|
239
|
-
breadcrumbName: PropTypes.string
|
|
240
|
-
})),
|
|
241
|
-
/**
|
|
242
|
-
* Variant to render.
|
|
243
|
-
*/
|
|
244
|
-
variant: PropTypes.shape({
|
|
245
|
-
inverse: PropTypes.bool,
|
|
246
|
-
light: PropTypes.bool
|
|
247
|
-
})
|
|
248
|
-
};
|
|
249
|
-
Breadcrumbs.Item = Item;
|
|
250
|
-
export default Breadcrumbs;
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { Link, Typography, applyTextStyles, clickProps, selectSystemProps, useThemeTokens } from '@telus-uds/components-base';
|
|
5
|
-
import { htmlAttrs } from '../../utils';
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
8
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
10
|
-
const StyledItemContainer = /*#__PURE__*/styled.li.withConfig({
|
|
11
|
-
displayName: "Item__StyledItemContainer",
|
|
12
|
-
componentId: "components-web__sc-1rfdaul-0"
|
|
13
|
-
})({
|
|
14
|
-
display: 'inline-block',
|
|
15
|
-
paddingLeft: _ref => {
|
|
16
|
-
let {
|
|
17
|
-
listItemPadding
|
|
18
|
-
} = _ref;
|
|
19
|
-
return `${listItemPadding}px`;
|
|
20
|
-
},
|
|
21
|
-
lineHeight: _ref2 => {
|
|
22
|
-
let {
|
|
23
|
-
lineHeight,
|
|
24
|
-
fontSize
|
|
25
|
-
} = _ref2;
|
|
26
|
-
return `${Math.ceil(lineHeight * fontSize)}px`;
|
|
27
|
-
},
|
|
28
|
-
marginBottom: '8px'
|
|
29
|
-
});
|
|
30
|
-
const IconContainer = /*#__PURE__*/styled.span.withConfig({
|
|
31
|
-
displayName: "Item__IconContainer",
|
|
32
|
-
componentId: "components-web__sc-1rfdaul-1"
|
|
33
|
-
})({
|
|
34
|
-
display: 'inline-block',
|
|
35
|
-
paddingLeft: _ref3 => {
|
|
36
|
-
let {
|
|
37
|
-
iconPadding
|
|
38
|
-
} = _ref3;
|
|
39
|
-
return `${iconPadding}px`;
|
|
40
|
-
},
|
|
41
|
-
paddingRight: _ref4 => {
|
|
42
|
-
let {
|
|
43
|
-
iconPadding
|
|
44
|
-
} = _ref4;
|
|
45
|
-
return `${iconPadding}px`;
|
|
46
|
-
},
|
|
47
|
-
fontFamily: _ref5 => {
|
|
48
|
-
let {
|
|
49
|
-
fontName,
|
|
50
|
-
fontWeight
|
|
51
|
-
} = _ref5;
|
|
52
|
-
return applyTextStyles({
|
|
53
|
-
fontName,
|
|
54
|
-
fontWeight
|
|
55
|
-
}).fontFamily;
|
|
56
|
-
},
|
|
57
|
-
height: _ref6 => {
|
|
58
|
-
let {
|
|
59
|
-
iconContainerSize
|
|
60
|
-
} = _ref6;
|
|
61
|
-
return `${iconContainerSize}px`;
|
|
62
|
-
},
|
|
63
|
-
width: _ref7 => {
|
|
64
|
-
let {
|
|
65
|
-
iconContainerSize,
|
|
66
|
-
iconPadding
|
|
67
|
-
} = _ref7;
|
|
68
|
-
return `${iconContainerSize + iconPadding * 2}px`;
|
|
69
|
-
},
|
|
70
|
-
verticalAlign: 'bottom'
|
|
71
|
-
});
|
|
72
|
-
const Item = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
|
|
73
|
-
let {
|
|
74
|
-
href,
|
|
75
|
-
children,
|
|
76
|
-
current = false,
|
|
77
|
-
tokens,
|
|
78
|
-
variant = {
|
|
79
|
-
light: true
|
|
80
|
-
},
|
|
81
|
-
// `light` variant (shared with the `Link` component) is default by design
|
|
82
|
-
LinkRouter,
|
|
83
|
-
linkRouterProps,
|
|
84
|
-
onPress,
|
|
85
|
-
...rest
|
|
86
|
-
} = _ref8;
|
|
87
|
-
const {
|
|
88
|
-
iconColor,
|
|
89
|
-
icon: ChevronRightIcon,
|
|
90
|
-
currentColor,
|
|
91
|
-
color,
|
|
92
|
-
iconSize,
|
|
93
|
-
fontSize,
|
|
94
|
-
fontWeight,
|
|
95
|
-
fontName,
|
|
96
|
-
lineHeight,
|
|
97
|
-
listItemPadding,
|
|
98
|
-
iconContainerSize,
|
|
99
|
-
iconPadding
|
|
100
|
-
} = useThemeTokens('Breadcrumbs', tokens, variant);
|
|
101
|
-
const linkOptions = {
|
|
102
|
-
...clickProps.toPressProps(selectProps(rest)),
|
|
103
|
-
href
|
|
104
|
-
};
|
|
105
|
-
return /*#__PURE__*/_jsx(StyledItemContainer, {
|
|
106
|
-
listItemPadding: listItemPadding,
|
|
107
|
-
lineHeight: lineHeight,
|
|
108
|
-
fontSize: fontSize,
|
|
109
|
-
iconContainerSize: iconContainerSize,
|
|
110
|
-
children: current ? /*#__PURE__*/_jsx(Typography, {
|
|
111
|
-
tokens: {
|
|
112
|
-
color: currentColor,
|
|
113
|
-
fontSize,
|
|
114
|
-
fontWeight,
|
|
115
|
-
lineHeight
|
|
116
|
-
},
|
|
117
|
-
variant: variant,
|
|
118
|
-
children: children
|
|
119
|
-
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
120
|
-
children: [/*#__PURE__*/_jsx(Link, {
|
|
121
|
-
...linkOptions,
|
|
122
|
-
ref: ref,
|
|
123
|
-
tokens: {
|
|
124
|
-
color,
|
|
125
|
-
blockFontSize: fontSize,
|
|
126
|
-
blockLineHeight: lineHeight
|
|
127
|
-
},
|
|
128
|
-
LinkRouter: LinkRouter,
|
|
129
|
-
linkRouterProps: linkRouterProps,
|
|
130
|
-
variant: variant,
|
|
131
|
-
onPress: onPress,
|
|
132
|
-
children: children
|
|
133
|
-
}), /*#__PURE__*/_jsx(IconContainer, {
|
|
134
|
-
iconPadding: iconPadding,
|
|
135
|
-
fontName: fontName,
|
|
136
|
-
fontWeight: fontWeight,
|
|
137
|
-
iconContainerSize: iconContainerSize,
|
|
138
|
-
children: /*#__PURE__*/_jsx(ChevronRightIcon, {
|
|
139
|
-
size: iconSize,
|
|
140
|
-
color: iconColor
|
|
141
|
-
})
|
|
142
|
-
})]
|
|
143
|
-
})
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
Item.displayName = 'Item';
|
|
147
|
-
Item.propTypes = {
|
|
148
|
-
...selectedSystemPropTypes,
|
|
149
|
-
/**
|
|
150
|
-
* Breadcrumb text
|
|
151
|
-
*/
|
|
152
|
-
children: PropTypes.node.isRequired,
|
|
153
|
-
/**
|
|
154
|
-
* @ignore
|
|
155
|
-
*
|
|
156
|
-
* Indicates whether or not the Item should be as current/active
|
|
157
|
-
*/
|
|
158
|
-
current: PropTypes.bool,
|
|
159
|
-
/**
|
|
160
|
-
* Target URL. This will be converted to `to` if the `LinkRouter`
|
|
161
|
-
* prop is provided to the `Item` or parent `Breadcrumbs` element.
|
|
162
|
-
*/
|
|
163
|
-
href: PropTypes.string.isRequired,
|
|
164
|
-
/**
|
|
165
|
-
* Variant to render.
|
|
166
|
-
*/
|
|
167
|
-
variant: PropTypes.shape({
|
|
168
|
-
inverse: PropTypes.bool
|
|
169
|
-
}),
|
|
170
|
-
/**
|
|
171
|
-
* Function to be called when the Item is clicked.
|
|
172
|
-
*/
|
|
173
|
-
onPress: PropTypes.func
|
|
174
|
-
};
|
|
175
|
-
export default Item;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './Breadcrumbs';
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { Icon, selectSystemProps, Typography, useThemeTokens, getTokensPropType } from '@telus-uds/components-base';
|
|
5
|
-
import { htmlAttrs } from '../utils';
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
9
|
-
const getAlignment = (rounded, textAlignToFlex) => {
|
|
10
|
-
if (textAlignToFlex) {
|
|
11
|
-
switch (textAlignToFlex) {
|
|
12
|
-
case 'left':
|
|
13
|
-
return 'flex-star';
|
|
14
|
-
case 'center':
|
|
15
|
-
return 'center';
|
|
16
|
-
default:
|
|
17
|
-
return 'flex-start';
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return rounded ? 'center' : ' flex-start';
|
|
21
|
-
};
|
|
22
|
-
const verticalAlignToFlex = verticalAlign => {
|
|
23
|
-
switch (verticalAlign) {
|
|
24
|
-
case 'top':
|
|
25
|
-
return 'flex-start';
|
|
26
|
-
case 'middle':
|
|
27
|
-
return 'center';
|
|
28
|
-
case 'bottom':
|
|
29
|
-
return 'flex-end';
|
|
30
|
-
default:
|
|
31
|
-
return 'top';
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
const CalloutContainer = /*#__PURE__*/styled.div.withConfig({
|
|
35
|
-
displayName: "Callout__CalloutContainer",
|
|
36
|
-
componentId: "components-web__sc-1a7ptx-0"
|
|
37
|
-
})(_ref => {
|
|
38
|
-
let {
|
|
39
|
-
rounded,
|
|
40
|
-
verticalAlign,
|
|
41
|
-
textAlignToFlex,
|
|
42
|
-
background,
|
|
43
|
-
gap,
|
|
44
|
-
borderRadius,
|
|
45
|
-
padding
|
|
46
|
-
} = _ref;
|
|
47
|
-
return {
|
|
48
|
-
background,
|
|
49
|
-
display: 'flex',
|
|
50
|
-
gap,
|
|
51
|
-
borderRadius,
|
|
52
|
-
padding,
|
|
53
|
-
justifyContent: getAlignment(rounded, textAlignToFlex),
|
|
54
|
-
alignItems: verticalAlignToFlex(verticalAlign)
|
|
55
|
-
};
|
|
56
|
-
});
|
|
57
|
-
const Callout = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
58
|
-
let {
|
|
59
|
-
icon,
|
|
60
|
-
children,
|
|
61
|
-
verticalAlign,
|
|
62
|
-
textAlignToFlex,
|
|
63
|
-
tokens,
|
|
64
|
-
variant = {},
|
|
65
|
-
...rest
|
|
66
|
-
} = _ref2;
|
|
67
|
-
const {
|
|
68
|
-
background,
|
|
69
|
-
gap,
|
|
70
|
-
borderRadius,
|
|
71
|
-
paddingLeft,
|
|
72
|
-
paddingRight,
|
|
73
|
-
paddingTop,
|
|
74
|
-
paddingBottom,
|
|
75
|
-
color
|
|
76
|
-
} = useThemeTokens('Callout', tokens, variant);
|
|
77
|
-
const {
|
|
78
|
-
rounded = false,
|
|
79
|
-
size = 'medium'
|
|
80
|
-
} = variant;
|
|
81
|
-
return /*#__PURE__*/_jsxs(CalloutContainer, {
|
|
82
|
-
size: size,
|
|
83
|
-
rounded: rounded,
|
|
84
|
-
"data-testid": "callout-container",
|
|
85
|
-
verticalAlign: verticalAlign,
|
|
86
|
-
textAlignToFlex: textAlignToFlex,
|
|
87
|
-
background: background,
|
|
88
|
-
gap: gap,
|
|
89
|
-
borderRadius: borderRadius,
|
|
90
|
-
padding: `${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`,
|
|
91
|
-
ref: ref,
|
|
92
|
-
...selectProps(rest),
|
|
93
|
-
children: [icon && /*#__PURE__*/_jsx(Icon, {
|
|
94
|
-
tokens: {
|
|
95
|
-
color
|
|
96
|
-
},
|
|
97
|
-
icon: icon,
|
|
98
|
-
variant: {
|
|
99
|
-
rank: 'primary',
|
|
100
|
-
size
|
|
101
|
-
}
|
|
102
|
-
}), /*#__PURE__*/_jsx(Typography, {
|
|
103
|
-
variant: {
|
|
104
|
-
size,
|
|
105
|
-
compact: size === 'small'
|
|
106
|
-
},
|
|
107
|
-
tokens: {
|
|
108
|
-
color
|
|
109
|
-
},
|
|
110
|
-
children: children
|
|
111
|
-
})]
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
Callout.displayName = 'Callout';
|
|
115
|
-
Callout.propTypes = {
|
|
116
|
-
...selectedSystemPropTypes,
|
|
117
|
-
tokens: getTokensPropType('Callout'),
|
|
118
|
-
/**
|
|
119
|
-
* Icon to display on the left side of the Callout
|
|
120
|
-
*/
|
|
121
|
-
icon: PropTypes.elementType,
|
|
122
|
-
/**
|
|
123
|
-
* Children nodes that can be added
|
|
124
|
-
*/
|
|
125
|
-
children: PropTypes.node.isRequired,
|
|
126
|
-
/**
|
|
127
|
-
* To change the horizontal alignment of the Callout's text
|
|
128
|
-
*/
|
|
129
|
-
textAlignToFlex: PropTypes.oneOf(['center', 'left']),
|
|
130
|
-
/**
|
|
131
|
-
* To change the vertical alignment of the Callout's icon
|
|
132
|
-
*/
|
|
133
|
-
verticalAlign: PropTypes.oneOf(['top', 'middle', 'bottom'])
|
|
134
|
-
};
|
|
135
|
-
export default Callout;
|