@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,55 +0,0 @@
|
|
|
1
|
-
import { useResponsiveProp } from '@telus-uds/components-base';
|
|
2
|
-
const getContentStackDirection = fullBleedContentPosition => {
|
|
3
|
-
switch (fullBleedContentPosition) {
|
|
4
|
-
case 'left':
|
|
5
|
-
return 'row-reverse';
|
|
6
|
-
case 'right':
|
|
7
|
-
return 'row';
|
|
8
|
-
case 'top':
|
|
9
|
-
return 'column-reverse';
|
|
10
|
-
default:
|
|
11
|
-
return 'column';
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
const getContentStackAlign = fullBleedContentAlign => {
|
|
15
|
-
switch (fullBleedContentAlign) {
|
|
16
|
-
case 'center':
|
|
17
|
-
return 'center';
|
|
18
|
-
case 'end':
|
|
19
|
-
case 'flex-end':
|
|
20
|
-
return 'flex-end';
|
|
21
|
-
case 'start':
|
|
22
|
-
case 'flex-start':
|
|
23
|
-
return 'flex-start';
|
|
24
|
-
default:
|
|
25
|
-
return 'stretch';
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Resolves a set of `FullBleedContent` props into the variables a container needs to
|
|
31
|
-
* correctly position a `FullBleedContent` component for the current viewport.
|
|
32
|
-
*
|
|
33
|
-
* @param {object} [fullBleedContent] - a set of valid proptypes for FullBleedContent
|
|
34
|
-
* @returns
|
|
35
|
-
*/
|
|
36
|
-
const useFullBleedContentProps = fullBleedContent => {
|
|
37
|
-
const {
|
|
38
|
-
align: fullBleedContentAlignProp,
|
|
39
|
-
position: fullBleedContentPositionProp,
|
|
40
|
-
...fullBleedContentProps
|
|
41
|
-
} = fullBleedContent ?? {
|
|
42
|
-
position: 'none'
|
|
43
|
-
};
|
|
44
|
-
const fullBleedContentPosition = useResponsiveProp(fullBleedContentPositionProp, 'none');
|
|
45
|
-
const contentStackDirection = getContentStackDirection(fullBleedContentPosition);
|
|
46
|
-
const fullBleedContentAlign = useResponsiveProp(fullBleedContentAlignProp, 'stretch');
|
|
47
|
-
const contentStackAlign = getContentStackAlign(fullBleedContentAlign);
|
|
48
|
-
return {
|
|
49
|
-
contentStackAlign,
|
|
50
|
-
contentStackDirection,
|
|
51
|
-
fullBleedContentPosition,
|
|
52
|
-
fullBleedContentProps
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
export default useFullBleedContentProps;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { useThemeTokens } from '@telus-uds/components-base';
|
|
5
|
-
import { getAriaLabel, getTimestamp } from '../helpers';
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
const ButtonContainer = /*#__PURE__*/styled.button.withConfig({
|
|
8
|
-
displayName: "SplashButton__ButtonContainer",
|
|
9
|
-
componentId: "components-web__sc-1oe22fk-0"
|
|
10
|
-
})({
|
|
11
|
-
background: 'none',
|
|
12
|
-
border: 0,
|
|
13
|
-
padding: 0,
|
|
14
|
-
position: 'absolute',
|
|
15
|
-
width: '100%',
|
|
16
|
-
height: '100%',
|
|
17
|
-
display: 'flex',
|
|
18
|
-
justifyContent: 'center',
|
|
19
|
-
alignItems: 'center',
|
|
20
|
-
cursor: 'pointer'
|
|
21
|
-
});
|
|
22
|
-
const ButtonContent = /*#__PURE__*/styled.div.withConfig({
|
|
23
|
-
displayName: "SplashButton__ButtonContent",
|
|
24
|
-
componentId: "components-web__sc-1oe22fk-1"
|
|
25
|
-
})({
|
|
26
|
-
display: 'flex',
|
|
27
|
-
justifyContent: 'center',
|
|
28
|
-
alignItems: 'center',
|
|
29
|
-
width: 64,
|
|
30
|
-
height: 64,
|
|
31
|
-
background: _ref => {
|
|
32
|
-
let {
|
|
33
|
-
buttonContentBackground
|
|
34
|
-
} = _ref;
|
|
35
|
-
return buttonContentBackground ?? 'none';
|
|
36
|
-
},
|
|
37
|
-
borderRadius: '100%',
|
|
38
|
-
transition: 'background 0.2s ease-in-out',
|
|
39
|
-
[`${ButtonContainer}:hover &`]: {
|
|
40
|
-
background: _ref2 => {
|
|
41
|
-
let {
|
|
42
|
-
buttonContentChildrenBackground
|
|
43
|
-
} = _ref2;
|
|
44
|
-
return buttonContentChildrenBackground;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
const SplashButton = _ref3 => {
|
|
49
|
-
let {
|
|
50
|
-
copy,
|
|
51
|
-
tokens,
|
|
52
|
-
variant,
|
|
53
|
-
videoLength
|
|
54
|
-
} = _ref3;
|
|
55
|
-
const {
|
|
56
|
-
buttonContentChildrenBackground
|
|
57
|
-
} = useThemeTokens('SplashButton', tokens, variant, {
|
|
58
|
-
hover: true
|
|
59
|
-
});
|
|
60
|
-
const {
|
|
61
|
-
playIcon: PlayIcon,
|
|
62
|
-
playIconColor,
|
|
63
|
-
...themeTokens
|
|
64
|
-
} = useThemeTokens('SplashButton', tokens, variant);
|
|
65
|
-
const ariaLabel = getAriaLabel(getTimestamp(videoLength), copy);
|
|
66
|
-
return /*#__PURE__*/_jsx(ButtonContainer, {
|
|
67
|
-
"aria-label": ariaLabel,
|
|
68
|
-
children: /*#__PURE__*/_jsx(ButtonContent, {
|
|
69
|
-
...themeTokens,
|
|
70
|
-
buttonContentChildrenBackground: buttonContentChildrenBackground,
|
|
71
|
-
children: /*#__PURE__*/_jsx(PlayIcon, {
|
|
72
|
-
size: 27,
|
|
73
|
-
color: playIconColor
|
|
74
|
-
})
|
|
75
|
-
})
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
SplashButton.propTypes = {
|
|
79
|
-
videoLength: PropTypes.number,
|
|
80
|
-
tokens: PropTypes.object,
|
|
81
|
-
variant: PropTypes.object,
|
|
82
|
-
copy: PropTypes.oneOf(['en', 'fr'])
|
|
83
|
-
};
|
|
84
|
-
export default SplashButton;
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { Typography, useThemeTokens } from '@telus-uds/components-base';
|
|
5
|
-
import { getAriaLabel, getTimestamp } from '../helpers';
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
-
const ButtonContainer = /*#__PURE__*/styled.button.withConfig({
|
|
9
|
-
displayName: "SplashButtonWithDetails__ButtonContainer",
|
|
10
|
-
componentId: "components-web__sc-1edwy9o-0"
|
|
11
|
-
})({
|
|
12
|
-
background: 'none',
|
|
13
|
-
border: 0,
|
|
14
|
-
position: 'absolute',
|
|
15
|
-
width: '100%',
|
|
16
|
-
height: '100%',
|
|
17
|
-
padding: 0,
|
|
18
|
-
cursor: 'pointer'
|
|
19
|
-
});
|
|
20
|
-
const ButtonContent = /*#__PURE__*/styled.div.withConfig({
|
|
21
|
-
displayName: "SplashButtonWithDetails__ButtonContent",
|
|
22
|
-
componentId: "components-web__sc-1edwy9o-1"
|
|
23
|
-
})({
|
|
24
|
-
background: _ref => {
|
|
25
|
-
let {
|
|
26
|
-
buttonBackground
|
|
27
|
-
} = _ref;
|
|
28
|
-
return buttonBackground;
|
|
29
|
-
},
|
|
30
|
-
border: _ref2 => {
|
|
31
|
-
let {
|
|
32
|
-
buttonBorderColor
|
|
33
|
-
} = _ref2;
|
|
34
|
-
return `1px solid ${buttonBorderColor}`;
|
|
35
|
-
},
|
|
36
|
-
borderRadius: _ref3 => {
|
|
37
|
-
let {
|
|
38
|
-
buttonRadius
|
|
39
|
-
} = _ref3;
|
|
40
|
-
return `${buttonRadius}px`;
|
|
41
|
-
},
|
|
42
|
-
position: 'absolute',
|
|
43
|
-
left: _ref4 => {
|
|
44
|
-
let {
|
|
45
|
-
buttonLeftPosition
|
|
46
|
-
} = _ref4;
|
|
47
|
-
return `${buttonLeftPosition}px`;
|
|
48
|
-
},
|
|
49
|
-
bottom: _ref5 => {
|
|
50
|
-
let {
|
|
51
|
-
buttonBottomPosition
|
|
52
|
-
} = _ref5;
|
|
53
|
-
return `${buttonBottomPosition}px`;
|
|
54
|
-
},
|
|
55
|
-
boxSizing: 'border-box',
|
|
56
|
-
display: 'flex',
|
|
57
|
-
alignItems: 'center',
|
|
58
|
-
minHeight: _ref6 => {
|
|
59
|
-
let {
|
|
60
|
-
buttonMinHeight
|
|
61
|
-
} = _ref6;
|
|
62
|
-
return `${buttonMinHeight}px`;
|
|
63
|
-
},
|
|
64
|
-
paddingRight: _ref7 => {
|
|
65
|
-
let {
|
|
66
|
-
buttonPaddingLeft
|
|
67
|
-
} = _ref7;
|
|
68
|
-
return `${buttonPaddingLeft}px`;
|
|
69
|
-
},
|
|
70
|
-
paddingLeft: _ref8 => {
|
|
71
|
-
let {
|
|
72
|
-
buttonPaddingRight
|
|
73
|
-
} = _ref8;
|
|
74
|
-
return `${buttonPaddingRight}px`;
|
|
75
|
-
},
|
|
76
|
-
transition: 'background 0.2s ease-in-out',
|
|
77
|
-
[`${ButtonContainer}:hover &`]: {
|
|
78
|
-
background: _ref9 => {
|
|
79
|
-
let {
|
|
80
|
-
buttonContentChildrenBackground
|
|
81
|
-
} = _ref9;
|
|
82
|
-
return buttonContentChildrenBackground;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
const PlayIconContainer = /*#__PURE__*/styled.div.withConfig({
|
|
87
|
-
displayName: "SplashButtonWithDetails__PlayIconContainer",
|
|
88
|
-
componentId: "components-web__sc-1edwy9o-2"
|
|
89
|
-
})({
|
|
90
|
-
display: 'flex',
|
|
91
|
-
justifyContent: 'center',
|
|
92
|
-
alignItems: 'center',
|
|
93
|
-
width: 32,
|
|
94
|
-
height: 32,
|
|
95
|
-
background: _ref10 => {
|
|
96
|
-
let {
|
|
97
|
-
playIconContainerBackground
|
|
98
|
-
} = _ref10;
|
|
99
|
-
return playIconContainerBackground ?? 'none';
|
|
100
|
-
},
|
|
101
|
-
borderRadius: '100%',
|
|
102
|
-
transition: 'background 0.2s ease-in-out'
|
|
103
|
-
});
|
|
104
|
-
const DetailsContainer = /*#__PURE__*/styled.div.withConfig({
|
|
105
|
-
displayName: "SplashButtonWithDetails__DetailsContainer",
|
|
106
|
-
componentId: "components-web__sc-1edwy9o-3"
|
|
107
|
-
})({
|
|
108
|
-
display: 'flex',
|
|
109
|
-
flexDirection: 'column',
|
|
110
|
-
alignItems: 'flex-start',
|
|
111
|
-
paddingLeft: _ref11 => {
|
|
112
|
-
let {
|
|
113
|
-
detailsContainerPadding
|
|
114
|
-
} = _ref11;
|
|
115
|
-
return `${detailsContainerPadding}px`;
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
const selectPlayIconContainerTokens = _ref12 => {
|
|
119
|
-
let {
|
|
120
|
-
playIconContainerBackground
|
|
121
|
-
} = _ref12;
|
|
122
|
-
return {
|
|
123
|
-
playIconContainerBackground
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
const selectDetailsContainerTokens = _ref13 => {
|
|
127
|
-
let {
|
|
128
|
-
detailsContainerPadding
|
|
129
|
-
} = _ref13;
|
|
130
|
-
return {
|
|
131
|
-
detailsContainerPadding
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
const selectButtonContentTokens = _ref14 => {
|
|
135
|
-
let {
|
|
136
|
-
buttonBackground,
|
|
137
|
-
buttonBorderColor,
|
|
138
|
-
buttonRadius,
|
|
139
|
-
buttonLeftPosition,
|
|
140
|
-
buttonBottomPosition,
|
|
141
|
-
buttonMinHeight,
|
|
142
|
-
buttonPaddingLeft,
|
|
143
|
-
buttonPaddingRight
|
|
144
|
-
} = _ref14;
|
|
145
|
-
return {
|
|
146
|
-
buttonBackground,
|
|
147
|
-
buttonBorderColor,
|
|
148
|
-
buttonRadius,
|
|
149
|
-
buttonLeftPosition,
|
|
150
|
-
buttonBottomPosition,
|
|
151
|
-
buttonMinHeight,
|
|
152
|
-
buttonPaddingLeft,
|
|
153
|
-
buttonPaddingRight
|
|
154
|
-
};
|
|
155
|
-
};
|
|
156
|
-
const getLabelTokens = _ref15 => {
|
|
157
|
-
let {
|
|
158
|
-
labelFontName: fontName,
|
|
159
|
-
labelFontWeight: fontWeight
|
|
160
|
-
} = _ref15;
|
|
161
|
-
return {
|
|
162
|
-
fontName,
|
|
163
|
-
fontWeight
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
const SplashButtonWithDetails = _ref16 => {
|
|
167
|
-
let {
|
|
168
|
-
label,
|
|
169
|
-
tokens,
|
|
170
|
-
variant,
|
|
171
|
-
copy,
|
|
172
|
-
videoLength
|
|
173
|
-
} = _ref16;
|
|
174
|
-
const {
|
|
175
|
-
buttonContentChildrenBackground
|
|
176
|
-
} = useThemeTokens('SplashButtonWithDetails', tokens, variant, {
|
|
177
|
-
hover: true
|
|
178
|
-
});
|
|
179
|
-
const {
|
|
180
|
-
playIcon: PlayIcon,
|
|
181
|
-
playIconColor,
|
|
182
|
-
...themeTokens
|
|
183
|
-
} = useThemeTokens('SplashButtonWithDetails', tokens, variant);
|
|
184
|
-
const mappedVideoLength = getTimestamp(videoLength, copy);
|
|
185
|
-
const ariaLabel = getAriaLabel(mappedVideoLength, copy);
|
|
186
|
-
return /*#__PURE__*/_jsx(ButtonContainer, {
|
|
187
|
-
"aria-label": ariaLabel,
|
|
188
|
-
children: /*#__PURE__*/_jsxs(ButtonContent, {
|
|
189
|
-
...selectButtonContentTokens(themeTokens),
|
|
190
|
-
buttonContentChildrenBackground: buttonContentChildrenBackground,
|
|
191
|
-
children: [/*#__PURE__*/_jsx(PlayIconContainer, {
|
|
192
|
-
...selectPlayIconContainerTokens(themeTokens),
|
|
193
|
-
children: /*#__PURE__*/_jsx(PlayIcon, {
|
|
194
|
-
size: 13,
|
|
195
|
-
color: playIconColor
|
|
196
|
-
})
|
|
197
|
-
}), /*#__PURE__*/_jsxs(DetailsContainer, {
|
|
198
|
-
...selectDetailsContainerTokens(themeTokens),
|
|
199
|
-
children: [/*#__PURE__*/_jsx(Typography, {
|
|
200
|
-
variant: {
|
|
201
|
-
bold: true
|
|
202
|
-
},
|
|
203
|
-
tokens: getLabelTokens(themeTokens),
|
|
204
|
-
children: label
|
|
205
|
-
}), /*#__PURE__*/_jsx(Typography, {
|
|
206
|
-
variant: {
|
|
207
|
-
colour: 'secondary' /* TODO: this is not the same color as in designs */,
|
|
208
|
-
size: 'micro'
|
|
209
|
-
},
|
|
210
|
-
children: mappedVideoLength.timestamp
|
|
211
|
-
})]
|
|
212
|
-
})]
|
|
213
|
-
})
|
|
214
|
-
});
|
|
215
|
-
};
|
|
216
|
-
SplashButtonWithDetails.propTypes = {
|
|
217
|
-
label: PropTypes.string,
|
|
218
|
-
tokens: PropTypes.object,
|
|
219
|
-
variant: PropTypes.object,
|
|
220
|
-
videoLength: PropTypes.number,
|
|
221
|
-
copy: PropTypes.oneOf(['en', 'fr'])
|
|
222
|
-
};
|
|
223
|
-
export default SplashButtonWithDetails;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { selectSystemProps, useViewport } from '@telus-uds/components-base';
|
|
5
|
-
import { viewports } from '@telus-uds/system-constants';
|
|
6
|
-
import SplashButton from './SplashButton/SplashButton';
|
|
7
|
-
import SplashButtonWithDetails from './SplashButtonWithDetails/SplashButtonWithDetails';
|
|
8
|
-
import videoText from '../../Video/videoText';
|
|
9
|
-
import { htmlAttrs } from '../../utils';
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
12
|
-
const SplashBackground = /*#__PURE__*/styled.div.withConfig({
|
|
13
|
-
displayName: "VideoSplash__SplashBackground",
|
|
14
|
-
componentId: "components-web__sc-1ejxt6-0"
|
|
15
|
-
})(_ref => {
|
|
16
|
-
let {
|
|
17
|
-
videoPoster
|
|
18
|
-
} = _ref;
|
|
19
|
-
return {
|
|
20
|
-
backgroundImage: `url(${videoPoster})`,
|
|
21
|
-
backgroundSize: 'cover',
|
|
22
|
-
backgroundPosition: 'center',
|
|
23
|
-
position: 'absolute',
|
|
24
|
-
top: 0,
|
|
25
|
-
width: '100%',
|
|
26
|
-
height: '100%',
|
|
27
|
-
// fixes vertical alignment on IE 11
|
|
28
|
-
cursor: 'pointer'
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
const VideoSplash = _ref2 => {
|
|
32
|
-
let {
|
|
33
|
-
poster,
|
|
34
|
-
videoLength,
|
|
35
|
-
simpleMode,
|
|
36
|
-
copy = 'en',
|
|
37
|
-
onClick,
|
|
38
|
-
...rest
|
|
39
|
-
} = _ref2;
|
|
40
|
-
const viewport = useViewport();
|
|
41
|
-
const showDetails = !simpleMode && viewport !== viewports.xs;
|
|
42
|
-
const label = videoText[copy].watch;
|
|
43
|
-
return /*#__PURE__*/_jsx(SplashBackground, {
|
|
44
|
-
...selectProps(rest),
|
|
45
|
-
onClick: onClick,
|
|
46
|
-
videoPoster: poster,
|
|
47
|
-
children: showDetails ? /*#__PURE__*/_jsx(SplashButtonWithDetails, {
|
|
48
|
-
videoLength: videoLength,
|
|
49
|
-
copy: copy,
|
|
50
|
-
label: label
|
|
51
|
-
}) : /*#__PURE__*/_jsx(SplashButton, {
|
|
52
|
-
videoLength: videoLength,
|
|
53
|
-
copy: copy
|
|
54
|
-
})
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
VideoSplash.propTypes = {
|
|
58
|
-
...selectedSystemPropTypes,
|
|
59
|
-
onClick: PropTypes.func,
|
|
60
|
-
poster: PropTypes.string,
|
|
61
|
-
videoLength: PropTypes.number.isRequired,
|
|
62
|
-
simpleMode: PropTypes.bool,
|
|
63
|
-
copy: PropTypes.oneOf(['en', 'fr'])
|
|
64
|
-
};
|
|
65
|
-
export default VideoSplash;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import videoText from '../../Video/videoText';
|
|
2
|
-
export const getTimestamp = (videoLength, copy) => {
|
|
3
|
-
const minutes = Math.floor(videoLength / 60);
|
|
4
|
-
const seconds = Math.ceil(videoLength % 60);
|
|
5
|
-
const minutesText = minutes > 0 ? `${minutes}min ` : '';
|
|
6
|
-
const secondsText = `${seconds}${copy === 'fr' ? 's' : 'sec'}`;
|
|
7
|
-
const timestamp = `${minutesText}${secondsText}`;
|
|
8
|
-
return {
|
|
9
|
-
minutes,
|
|
10
|
-
seconds,
|
|
11
|
-
timestamp
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export const getAriaLabel = (timestamp, copy) => {
|
|
15
|
-
const {
|
|
16
|
-
minutes,
|
|
17
|
-
seconds
|
|
18
|
-
} = timestamp;
|
|
19
|
-
const text = videoText[copy];
|
|
20
|
-
const minutesText = `${minutes} ${minutes !== 1 ? text.minutes : text.minute}`;
|
|
21
|
-
const secondsText = `${seconds} ${seconds !== 1 ? text.seconds : text.second}`;
|
|
22
|
-
return text.ariaLabel.replace('{minutes}', minutesText).replace('{seconds}', secondsText);
|
|
23
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { htmlAttrs } from '@telus-uds/components-base';
|
|
2
|
-
import { warn, deprecate } from './logger';
|
|
3
|
-
import { transformGradient } from './transforms';
|
|
4
|
-
import useTypographyTheme from './useTypographyTheme';
|
|
5
|
-
import media from './media';
|
|
6
|
-
import ssrStyles from './ssr';
|
|
7
|
-
import isElementFocusable from './isElementFocusable';
|
|
8
|
-
import renderStructuredContent from './renderStructuredContent';
|
|
9
|
-
import useOverlaidPosition from './useOverlaidPosition';
|
|
10
|
-
export { deprecate, htmlAttrs, transformGradient, useTypographyTheme, warn, media, renderStructuredContent, ssrStyles, isElementFocusable, useOverlaidPosition };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns focusable elements inside of the Footnote
|
|
3
|
-
*/
|
|
4
|
-
const isElementFocusable = element => {
|
|
5
|
-
const focusableElements = `a[href], button, textarea, input, select, form, label, audio, video, source, track, canvas, rect, polygon, iframe[data-src], [tabindex]:not([tabindex="-1"]), [contenteditable]`;
|
|
6
|
-
return element.matches(focusableElements) && !element.hasAttribute('disabled') && !element.matches('[tabindex="-1"]');
|
|
7
|
-
};
|
|
8
|
-
export default isElementFocusable;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export const deprecate = (componentName, message) => {
|
|
2
|
-
if (process.env.NODE_ENV === 'production') {
|
|
3
|
-
return;
|
|
4
|
-
}
|
|
5
|
-
console.warn(`[Allium] [Deprecate] ${componentName}: ${message}`); // eslint-disable-line no-console
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const warn = (componentName, message) => {
|
|
9
|
-
if (process.env.NODE_ENV === 'production') {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
console.warn(`[Allium] ${componentName}: ${message}`); // eslint-disable-line no-console
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
deprecate,
|
|
17
|
-
warn
|
|
18
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { viewports } from '@telus-uds/system-constants';
|
|
2
|
-
export default function media() {
|
|
3
|
-
return {
|
|
4
|
-
query: {},
|
|
5
|
-
from(breakpoint) {
|
|
6
|
-
if (breakpoint !== viewports.xs) {
|
|
7
|
-
this.query.minWidth = breakpoint;
|
|
8
|
-
}
|
|
9
|
-
return this;
|
|
10
|
-
},
|
|
11
|
-
until(breakpoint) {
|
|
12
|
-
this.query.maxWidth = breakpoint;
|
|
13
|
-
return this;
|
|
14
|
-
},
|
|
15
|
-
and(custom) {
|
|
16
|
-
this.query.and = custom;
|
|
17
|
-
return this;
|
|
18
|
-
},
|
|
19
|
-
css(style) {
|
|
20
|
-
const {
|
|
21
|
-
minWidth,
|
|
22
|
-
maxWidth,
|
|
23
|
-
and
|
|
24
|
-
} = this.query;
|
|
25
|
-
const min = minWidth ? `(min-width: ${viewports.map.get(minWidth)}px)` : undefined;
|
|
26
|
-
const max = maxWidth ? `(max-width: ${viewports.map.get(maxWidth) - 1}px)` : undefined;
|
|
27
|
-
if (typeof min !== 'undefined' || typeof max !== 'undefined' || typeof and !== 'undefined') {
|
|
28
|
-
const mediaQuery = `@media ${[min, max, and].filter(a => a).join(' and ')}`;
|
|
29
|
-
this.query = {};
|
|
30
|
-
return {
|
|
31
|
-
[mediaQuery]: {
|
|
32
|
-
...(typeof style === 'function' ? style() : style)
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
return typeof style === 'function' ? style() : style;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Link } from '@telus-uds/components-base';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Takes a string content and marks up all the links in it by wrapping them
|
|
6
|
-
* in `Link` component.
|
|
7
|
-
*/
|
|
8
|
-
import { createElement as _createElement } from "react";
|
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
const generateLinks = content => {
|
|
11
|
-
const linkRegex = /<\s*a([^>]*)>(.*?)<\s*\/\s*a>/g;
|
|
12
|
-
const attributeRegex = /(\w+)\s*=\s*((["'])(.*?)\3|(?=\s|\/>))/g;
|
|
13
|
-
const parts = content.split(linkRegex);
|
|
14
|
-
if (parts.length === 1) {
|
|
15
|
-
return parts;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Start with first anchor text, attributes will be in the previous part
|
|
19
|
-
for (let i = 2; i < parts.length; i += 3) {
|
|
20
|
-
const o = {};
|
|
21
|
-
// Get attributes from previous part
|
|
22
|
-
const attributes = parts[i - 1].trim();
|
|
23
|
-
|
|
24
|
-
// Create object from attributes
|
|
25
|
-
const matchedAttributes = attributes.match(attributeRegex);
|
|
26
|
-
if (matchedAttributes) {
|
|
27
|
-
matchedAttributes.forEach(attribute => {
|
|
28
|
-
const split = attribute.split('=');
|
|
29
|
-
o[split[0]] = split[1].substr(1, split[1].length - 2);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
// Remove anchor attributes from parts
|
|
33
|
-
parts[i - 1] = undefined;
|
|
34
|
-
// Replace anchor text with Link in parts
|
|
35
|
-
parts[i] = /*#__PURE__*/_createElement(Link, {
|
|
36
|
-
...o,
|
|
37
|
-
key: i
|
|
38
|
-
}, parts[i]);
|
|
39
|
-
}
|
|
40
|
-
return parts;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Takes an array of strings and in each element replaces the breaks with `<br>` tags.
|
|
45
|
-
*/
|
|
46
|
-
const generateBreaks = parts => {
|
|
47
|
-
const breakRegex = /<br\s?\/*>/g;
|
|
48
|
-
const partsWithBreaks = parts;
|
|
49
|
-
for (let i = 0; i < partsWithBreaks.length; i += 1) {
|
|
50
|
-
if (typeof partsWithBreaks[i] === 'string' && partsWithBreaks[i].search(breakRegex) !== -1) {
|
|
51
|
-
const toSplit = partsWithBreaks[i].split(breakRegex);
|
|
52
|
-
for (let x = 1; x < toSplit.length; x += 2) {
|
|
53
|
-
toSplit.splice(x, 0, /*#__PURE__*/_jsx("br", {}, `break-${i}-${x}`));
|
|
54
|
-
}
|
|
55
|
-
partsWithBreaks[i] = toSplit;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return partsWithBreaks;
|
|
59
|
-
};
|
|
60
|
-
const renderStructuredContent = content => {
|
|
61
|
-
if (typeof content !== 'string') {
|
|
62
|
-
return content;
|
|
63
|
-
}
|
|
64
|
-
return generateBreaks(generateLinks(content));
|
|
65
|
-
};
|
|
66
|
-
export default renderStructuredContent;
|
package/lib-module/utils/ssr.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { ServerStyleSheet } from 'styled-components';
|
|
2
|
-
import { ssrStyles as baseSsrStyles } from '@telus-uds/components-base';
|
|
3
|
-
/**
|
|
4
|
-
* Returns object with `renderApp` and `getStyles` functions.
|
|
5
|
-
* Weave these into your app's server-side render process:
|
|
6
|
-
*
|
|
7
|
-
* - Call `renderApp` first to do the actual server-side render
|
|
8
|
-
* - After the render is complete, call `getStyles`
|
|
9
|
-
* - Include the style tags returned by `getStyles` in the SSR <head>
|
|
10
|
-
*
|
|
11
|
-
* This wraps ssrStyles from @telus-uds/components-base and adds Styled Components support.
|
|
12
|
-
*
|
|
13
|
-
* @param {string} [appName] - optional unique identifier if ssrStyles is called multiple times for multiple apps
|
|
14
|
-
* @param {object} [options] -
|
|
15
|
-
* - `styleGetters`: optional array of additional style getter functions to call after render
|
|
16
|
-
* - `collectStyles`: optional function, takes the rendered app, returns either the same or a new app element
|
|
17
|
-
* @param {boolean} [options.styleGetters]
|
|
18
|
-
* @param {(ReactElement) => ReactElement} [options.collectStyles]
|
|
19
|
-
*/
|
|
20
|
-
const ssrStyles = function () {
|
|
21
|
-
let appName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Allium app';
|
|
22
|
-
let {
|
|
23
|
-
styleGetters = [],
|
|
24
|
-
collectStyles = renderedApp => renderedApp
|
|
25
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
26
|
-
const sheet = new ServerStyleSheet();
|
|
27
|
-
const getStyledComponentsStyles = () => {
|
|
28
|
-
const styles = sheet.getStyleElement();
|
|
29
|
-
sheet.seal();
|
|
30
|
-
return styles;
|
|
31
|
-
};
|
|
32
|
-
return baseSsrStyles(appName, {
|
|
33
|
-
styleGetters: [getStyledComponentsStyles, ...styleGetters],
|
|
34
|
-
collectStyles: renderedApp => collectStyles(sheet.collectStyles(renderedApp))
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
export default ssrStyles;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const cachedTheme = {};
|
|
2
|
-
const theme = process.env.UDS_THEME;
|
|
3
|
-
async function importTheme(componentName) {
|
|
4
|
-
try {
|
|
5
|
-
cachedTheme[componentName] = await import(`@telus-uds/theme-${theme}/build/rn/${componentName}.js`);
|
|
6
|
-
} catch (_) {
|
|
7
|
-
throw new Error(`An error occurred while trying to import theme-${process.env.UDS_THEME}. Please check that the theme has been installed in your app or that you are not importing a server component inside a client component.`);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export default async function getTheme(componentName) {
|
|
11
|
-
if (cachedTheme[componentName]) {
|
|
12
|
-
return cachedTheme[componentName];
|
|
13
|
-
}
|
|
14
|
-
await importTheme(componentName);
|
|
15
|
-
return cachedTheme[componentName];
|
|
16
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { getTokensPropType, useThemeTokens } from '@telus-uds/components-base';
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
const withClientTheme = Component => {
|
|
6
|
-
const UdsStyledComponent = _ref => {
|
|
7
|
-
let {
|
|
8
|
-
tokens: tokenOverrides,
|
|
9
|
-
variant,
|
|
10
|
-
...props
|
|
11
|
-
} = _ref;
|
|
12
|
-
const theme = useThemeTokens(Component.displayName, tokenOverrides, variant);
|
|
13
|
-
return /*#__PURE__*/_jsx(Component, {
|
|
14
|
-
theme: theme,
|
|
15
|
-
...props
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
UdsStyledComponent.propTypes = {
|
|
19
|
-
tokens: getTokensPropType(Component.displayName),
|
|
20
|
-
variant: PropTypes.string
|
|
21
|
-
};
|
|
22
|
-
return UdsStyledComponent;
|
|
23
|
-
};
|
|
24
|
-
export default withClientTheme;
|