@telus-uds/components-web 2.33.2 → 2.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -3
- package/lib/Badge/Badge.js +4 -2
- package/lib/BlockQuote/BlockQuote.js +4 -2
- package/lib/Breadcrumbs/Breadcrumbs.js +7 -5
- package/lib/Breadcrumbs/Item/Item.js +2 -13
- package/lib/Callout/Callout.js +4 -2
- package/lib/Card/Card.js +3 -5
- package/lib/Card/CardContent.js +4 -2
- package/lib/Countdown/Countdown.js +2 -6
- package/lib/Countdown/Segment.js +4 -2
- package/lib/DatePicker/CalendarContainer.js +2 -2
- package/lib/DatePicker/DatePicker.js +21 -35
- package/lib/Disclaimer/Disclaimer.js +4 -2
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +5 -11
- package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +4 -2
- package/lib/Footnote/Footnote.js +32 -37
- package/lib/Footnote/FootnoteLink.js +5 -6
- package/lib/IconButton/IconButton.js +4 -11
- package/lib/Image/Image.js +5 -3
- package/lib/List/ListItem.js +2 -7
- package/lib/NavigationBar/NavigationBar.js +8 -18
- package/lib/NavigationBar/NavigationItem.js +4 -9
- package/lib/NavigationBar/NavigationSubMenu.js +8 -7
- package/lib/NavigationBar/index.js +2 -0
- package/lib/OptimizeImage/OptimizeImage.js +8 -8
- package/lib/OrderedList/Item.js +3 -9
- package/lib/OrderedList/OrderedList.js +5 -13
- package/lib/OrderedList/OrderedListBase.js +3 -8
- package/lib/Paragraph/Paragraph.js +5 -3
- package/lib/PreviewCard/PreviewCard.js +3 -5
- package/lib/PriceLockup/PriceLockup.js +4 -2
- package/lib/Progress/ProgressBar.js +4 -2
- package/lib/QuantitySelector/QuantitySelector.js +21 -24
- package/lib/QuantitySelector/SideButton.js +12 -20
- package/lib/ResponsiveImage/ResponsiveImage.js +4 -2
- package/lib/Ribbon/Ribbon.js +4 -2
- package/lib/SkeletonProvider/SkeletonImage.js +5 -3
- package/lib/SkeletonProvider/SkeletonProvider.js +3 -5
- package/lib/SkeletonProvider/SkeletonTypography.js +5 -3
- package/lib/Span/Span.js +5 -3
- package/lib/Spinner/Spinner.js +4 -2
- package/lib/Spinner/SpinnerContent.js +4 -2
- package/lib/StoryCard/StoryCard.js +3 -5
- package/lib/Table/Body.js +4 -2
- package/lib/Table/Cell.js +5 -3
- package/lib/Table/Header.js +6 -6
- package/lib/Table/Row.js +6 -6
- package/lib/Table/SubHeading.js +6 -6
- package/lib/Table/Table.js +6 -8
- package/lib/TermsAndConditions/ExpandCollapse.js +2 -7
- package/lib/TermsAndConditions/TermsAndConditions.js +5 -14
- package/lib/Testimonial/Testimonial.js +4 -2
- package/lib/Toast/Toast.js +4 -2
- package/lib/Video/Video.js +19 -55
- package/lib/VideoPicker/VideoPicker.js +38 -9
- package/lib/VideoPicker/VideoPickerPlayer.js +4 -2
- package/lib/VideoPicker/VideoPickerThumbnail.js +4 -2
- package/lib/VideoPicker/VideoSlider.js +7 -7
- package/lib/WaffleGrid/WaffleGrid.js +4 -2
- package/lib/WebVideo/WebVideo.js +51 -13
- package/lib/WebVideo/utils/index.js +58 -0
- package/lib/baseExports.js +6 -0
- package/lib/utils/theming/with-client-theme.js +1 -1
- package/lib/utils/theming/with-server-theme.js +1 -1
- package/lib-module/Badge/Badge.js +4 -2
- package/lib-module/BlockQuote/BlockQuote.js +4 -2
- package/lib-module/Breadcrumbs/Breadcrumbs.js +7 -5
- package/lib-module/Breadcrumbs/Item/Item.js +2 -11
- package/lib-module/Callout/Callout.js +4 -2
- package/lib-module/Card/Card.js +2 -3
- package/lib-module/Card/CardContent.js +4 -2
- package/lib-module/Countdown/Countdown.js +2 -3
- package/lib-module/Countdown/Segment.js +4 -2
- package/lib-module/DatePicker/CalendarContainer.js +2 -2
- package/lib-module/DatePicker/DatePicker.js +21 -33
- package/lib-module/Disclaimer/Disclaimer.js +4 -2
- package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +5 -9
- package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +4 -2
- package/lib-module/Footnote/Footnote.js +31 -36
- package/lib-module/Footnote/FootnoteLink.js +5 -7
- package/lib-module/IconButton/IconButton.js +4 -9
- package/lib-module/Image/Image.js +5 -3
- package/lib-module/List/ListItem.js +2 -5
- package/lib-module/NavigationBar/NavigationBar.js +9 -17
- package/lib-module/NavigationBar/NavigationItem.js +5 -8
- package/lib-module/NavigationBar/NavigationSubMenu.js +9 -6
- package/lib-module/NavigationBar/index.js +2 -0
- package/lib-module/OptimizeImage/OptimizeImage.js +8 -6
- package/lib-module/OrderedList/Item.js +3 -7
- package/lib-module/OrderedList/OrderedList.js +6 -12
- package/lib-module/OrderedList/OrderedListBase.js +3 -6
- package/lib-module/Paragraph/Paragraph.js +6 -4
- package/lib-module/PreviewCard/PreviewCard.js +2 -3
- package/lib-module/PriceLockup/PriceLockup.js +4 -2
- package/lib-module/Progress/ProgressBar.js +4 -2
- package/lib-module/QuantitySelector/QuantitySelector.js +22 -23
- package/lib-module/QuantitySelector/SideButton.js +13 -21
- package/lib-module/ResponsiveImage/ResponsiveImage.js +4 -2
- package/lib-module/Ribbon/Ribbon.js +4 -2
- package/lib-module/SkeletonProvider/SkeletonImage.js +5 -3
- package/lib-module/SkeletonProvider/SkeletonProvider.js +3 -3
- package/lib-module/SkeletonProvider/SkeletonTypography.js +5 -3
- package/lib-module/Span/Span.js +6 -4
- package/lib-module/Spinner/Spinner.js +4 -2
- package/lib-module/Spinner/SpinnerContent.js +4 -2
- package/lib-module/StoryCard/StoryCard.js +2 -3
- package/lib-module/Table/Body.js +4 -2
- package/lib-module/Table/Cell.js +5 -3
- package/lib-module/Table/Header.js +6 -4
- package/lib-module/Table/Row.js +6 -4
- package/lib-module/Table/SubHeading.js +6 -4
- package/lib-module/Table/Table.js +6 -6
- package/lib-module/TermsAndConditions/ExpandCollapse.js +2 -5
- package/lib-module/TermsAndConditions/TermsAndConditions.js +5 -12
- package/lib-module/Testimonial/Testimonial.js +4 -2
- package/lib-module/Toast/Toast.js +4 -2
- package/lib-module/Video/Video.js +19 -53
- package/lib-module/VideoPicker/VideoPicker.js +37 -8
- package/lib-module/VideoPicker/VideoPickerPlayer.js +4 -2
- package/lib-module/VideoPicker/VideoPickerThumbnail.js +4 -2
- package/lib-module/VideoPicker/VideoSlider.js +7 -5
- package/lib-module/WaffleGrid/WaffleGrid.js +4 -2
- package/lib-module/WebVideo/WebVideo.js +51 -11
- package/lib-module/WebVideo/utils/index.js +50 -0
- package/lib-module/baseExports.js +1 -1
- package/lib-module/utils/theming/with-client-theme.js +2 -2
- package/lib-module/utils/theming/with-server-theme.js +2 -2
- package/package.json +3 -3
- package/src/Badge/Badge.jsx +5 -2
- package/src/BlockQuote/BlockQuote.jsx +120 -112
- package/src/Breadcrumbs/Breadcrumbs.jsx +84 -77
- package/src/Breadcrumbs/Item/Item.jsx +2 -9
- package/src/Callout/Callout.jsx +37 -40
- package/src/Card/Card.jsx +2 -3
- package/src/Card/CardContent.jsx +19 -14
- package/src/Countdown/Countdown.jsx +72 -71
- package/src/Countdown/Segment.jsx +40 -28
- package/src/DatePicker/CalendarContainer.jsx +2 -2
- package/src/DatePicker/DatePicker.jsx +21 -34
- package/src/Disclaimer/Disclaimer.jsx +5 -3
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +37 -40
- package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +52 -44
- package/src/Footnote/Footnote.jsx +32 -38
- package/src/Footnote/FootnoteLink.jsx +41 -49
- package/src/IconButton/IconButton.jsx +19 -20
- package/src/Image/Image.jsx +40 -43
- package/src/List/ListItem.jsx +3 -5
- package/src/NavigationBar/NavigationBar.jsx +9 -18
- package/src/NavigationBar/NavigationItem.jsx +6 -5
- package/src/NavigationBar/NavigationSubMenu.jsx +104 -88
- package/src/NavigationBar/index.js +3 -0
- package/src/OptimizeImage/OptimizeImage.jsx +48 -41
- package/src/OrderedList/Item.jsx +34 -35
- package/src/OrderedList/OrderedList.jsx +4 -6
- package/src/OrderedList/OrderedListBase.jsx +2 -3
- package/src/Paragraph/Paragraph.jsx +21 -16
- package/src/PreviewCard/PreviewCard.jsx +2 -3
- package/src/PriceLockup/PriceLockup.jsx +143 -136
- package/src/Progress/ProgressBar.jsx +11 -3
- package/src/QuantitySelector/QuantitySelector.jsx +162 -154
- package/src/QuantitySelector/SideButton.jsx +52 -56
- package/src/ResponsiveImage/ResponsiveImage.jsx +16 -22
- package/src/Ribbon/Ribbon.jsx +85 -83
- package/src/SkeletonProvider/SkeletonImage.jsx +24 -15
- package/src/SkeletonProvider/SkeletonProvider.jsx +3 -3
- package/src/SkeletonProvider/SkeletonTypography.jsx +18 -13
- package/src/Span/Span.jsx +7 -5
- package/src/Spinner/Spinner.jsx +86 -79
- package/src/Spinner/SpinnerContent.jsx +31 -33
- package/src/StoryCard/StoryCard.jsx +2 -3
- package/src/Table/Body.jsx +5 -3
- package/src/Table/Cell.jsx +77 -67
- package/src/Table/Header.jsx +7 -5
- package/src/Table/Row.jsx +7 -5
- package/src/Table/SubHeading.jsx +7 -5
- package/src/Table/Table.jsx +6 -6
- package/src/TermsAndConditions/ExpandCollapse.jsx +2 -6
- package/src/TermsAndConditions/TermsAndConditions.jsx +5 -13
- package/src/Testimonial/Testimonial.jsx +148 -137
- package/src/Toast/Toast.jsx +68 -63
- package/src/Video/Video.jsx +25 -45
- package/src/VideoPicker/VideoPicker.jsx +114 -75
- package/src/VideoPicker/VideoPickerPlayer.jsx +13 -9
- package/src/VideoPicker/VideoPickerThumbnail.jsx +102 -94
- package/src/VideoPicker/VideoSlider.jsx +8 -6
- package/src/WaffleGrid/WaffleGrid.jsx +36 -40
- package/src/WebVideo/WebVideo.jsx +114 -60
- package/src/WebVideo/utils/index.js +56 -0
- package/src/baseExports.js +1 -0
- package/src/utils/theming/with-client-theme.jsx +2 -2
- package/src/utils/theming/with-server-theme.jsx +2 -2
- package/types/WebVideo.d.ts +2 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { selectSystemProps } from '@telus-uds/components-base';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import React
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import YouTube from 'react-youtube';
|
|
5
5
|
import styled from 'styled-components';
|
|
6
6
|
import VideoSplash from '../shared/VideoSplash/VideoSplash';
|
|
7
7
|
import { htmlAttrs } from '../utils';
|
|
8
|
+
import { triggerInProgressVideoIntervals, YoutubePlayerState } from './utils';
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
10
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
10
11
|
const StyledPlayerContainer = /*#__PURE__*/styled.div.withConfig({
|
|
@@ -43,7 +44,7 @@ const AspectLimiter = /*#__PURE__*/styled.div.withConfig({
|
|
|
43
44
|
...aspectRatios[props.aspectRatio],
|
|
44
45
|
position: 'relative'
|
|
45
46
|
}));
|
|
46
|
-
const WebVideo = _ref => {
|
|
47
|
+
const WebVideo = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
47
48
|
let {
|
|
48
49
|
videoId,
|
|
49
50
|
aspectRatio = '16:9',
|
|
@@ -52,15 +53,29 @@ const WebVideo = _ref => {
|
|
|
52
53
|
beginMuted = false,
|
|
53
54
|
videoLength,
|
|
54
55
|
copy,
|
|
55
|
-
onPlay,
|
|
56
|
-
onPause,
|
|
57
|
-
onEnd,
|
|
56
|
+
onPlay = () => {},
|
|
57
|
+
onPause = () => {},
|
|
58
|
+
onEnd = () => {},
|
|
59
|
+
onProgress = () => {},
|
|
58
60
|
onStart = () => {},
|
|
59
61
|
...rest
|
|
60
62
|
} = _ref;
|
|
61
|
-
const [started, setStarted] = useState(false);
|
|
63
|
+
const [started, setStarted] = React.useState(false);
|
|
64
|
+
const videoStateData = React.useRef({
|
|
65
|
+
requestAnimationIds: [],
|
|
66
|
+
state: YoutubePlayerState.UNSTARTED
|
|
67
|
+
});
|
|
68
|
+
const playerRef = React.useRef(null);
|
|
69
|
+
const onPlayCallback = event => {
|
|
70
|
+
onPlay(event, videoStateData.current.state === YoutubePlayerState.PAUSED);
|
|
71
|
+
videoStateData.current.state = YoutubePlayerState.PLAYING;
|
|
72
|
+
if (onProgress) {
|
|
73
|
+
videoStateData.current.requestAnimationIds = triggerInProgressVideoIntervals(onProgress, playerRef, event);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
62
76
|
const initializeYoutubePlayer = event => {
|
|
63
77
|
onStart();
|
|
78
|
+
playerRef.current = event.target;
|
|
64
79
|
if (beginMuted) {
|
|
65
80
|
event.target.mute();
|
|
66
81
|
}
|
|
@@ -68,7 +83,23 @@ const WebVideo = _ref => {
|
|
|
68
83
|
event.target.playVideo(); // This plays the video after passing the splash screen on mobile.
|
|
69
84
|
};
|
|
70
85
|
|
|
86
|
+
const onEndVideoCallback = event => {
|
|
87
|
+
onEnd(event);
|
|
88
|
+
videoStateData.current.requestAnimationIds.forEach(id => cancelAnimationFrame(id));
|
|
89
|
+
videoStateData.current.requestAnimationIds = [];
|
|
90
|
+
videoStateData.current.state = YoutubePlayerState.ENDED;
|
|
91
|
+
if (onProgress) {
|
|
92
|
+
onProgress(event, 100);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const onPauseVideoCallback = event => {
|
|
96
|
+
videoStateData.current.requestAnimationIds.forEach(id => cancelAnimationFrame(id));
|
|
97
|
+
onPause(event);
|
|
98
|
+
videoStateData.current.state = YoutubePlayerState.PAUSED;
|
|
99
|
+
videoStateData.current.requestAnimationIds = [];
|
|
100
|
+
};
|
|
71
101
|
return /*#__PURE__*/_jsx(StyledPlayerContainer, {
|
|
102
|
+
ref: ref,
|
|
72
103
|
"data-testid": "web-video-container",
|
|
73
104
|
...selectProps(rest),
|
|
74
105
|
children: /*#__PURE__*/_jsx(AspectLimiter, {
|
|
@@ -86,9 +117,9 @@ const WebVideo = _ref => {
|
|
|
86
117
|
}
|
|
87
118
|
},
|
|
88
119
|
onReady: initializeYoutubePlayer,
|
|
89
|
-
onPlay:
|
|
90
|
-
onPause:
|
|
91
|
-
onEnd:
|
|
120
|
+
onPlay: onPlayCallback,
|
|
121
|
+
onPause: onPauseVideoCallback,
|
|
122
|
+
onEnd: onEndVideoCallback
|
|
92
123
|
}) : /*#__PURE__*/_jsx(VideoSplash, {
|
|
93
124
|
poster: posterSrc || `https://img.youtube.com/vi/${videoId}/maxresdefault.jpg`,
|
|
94
125
|
videoLength: videoLength,
|
|
@@ -99,7 +130,8 @@ const WebVideo = _ref => {
|
|
|
99
130
|
})
|
|
100
131
|
})
|
|
101
132
|
});
|
|
102
|
-
};
|
|
133
|
+
});
|
|
134
|
+
WebVideo.displayName = 'WebVideo';
|
|
103
135
|
export const VideoProps = {
|
|
104
136
|
...selectedSystemPropTypes,
|
|
105
137
|
/**
|
|
@@ -145,7 +177,15 @@ export const VideoProps = {
|
|
|
145
177
|
/**
|
|
146
178
|
* A function to be run when the video ends.
|
|
147
179
|
*/
|
|
148
|
-
onEnd: PropTypes.func
|
|
180
|
+
onEnd: PropTypes.func,
|
|
181
|
+
/**
|
|
182
|
+
* A function to be run when the video resumes.
|
|
183
|
+
*/
|
|
184
|
+
onResume: PropTypes.func,
|
|
185
|
+
/**
|
|
186
|
+
* A function to be run when the video progresses. This function will be run at 10%, 25%, 50%, 75% and 100%.
|
|
187
|
+
*/
|
|
188
|
+
onProgress: PropTypes.func
|
|
149
189
|
};
|
|
150
190
|
WebVideo.propTypes = VideoProps;
|
|
151
191
|
export default WebVideo;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fires analytics events for inProgress analytics
|
|
3
|
+
* @param {current progress} progress
|
|
4
|
+
* @param {callback to run on defined milestones} onProgress
|
|
5
|
+
* @param {YouTube Video Event} event
|
|
6
|
+
*/
|
|
7
|
+
const fireVideoProgressEvents = (progress, onProgress, event) => {
|
|
8
|
+
const validProgressValues = [10, 25, 50, 75];
|
|
9
|
+
if (validProgressValues.includes(progress)) {
|
|
10
|
+
onProgress(event, progress);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export const YoutubePlayerState = {
|
|
14
|
+
UNSTARTED: -1,
|
|
15
|
+
ENDED: 0,
|
|
16
|
+
PLAYING: 1,
|
|
17
|
+
PAUSED: 2,
|
|
18
|
+
BUFFERING: 3,
|
|
19
|
+
CUED: 5
|
|
20
|
+
};
|
|
21
|
+
const PERCENTAGE_MULTIPLIER = 100;
|
|
22
|
+
/**
|
|
23
|
+
* Run an interval to check the progress of the video and fire events at 10%, 25%, 50% and 75%
|
|
24
|
+
* @param {callback to run on defined milestones} onProgress
|
|
25
|
+
* @param {player reference} playerRef
|
|
26
|
+
* @param {YouTube video event} event
|
|
27
|
+
*/
|
|
28
|
+
export const triggerInProgressVideoIntervals = (onProgress, playerRef, event) => {
|
|
29
|
+
const duration = playerRef.current.getDuration();
|
|
30
|
+
let lastProgress = null;
|
|
31
|
+
const requestAnimationFrameIds = [];
|
|
32
|
+
const frame = () => {
|
|
33
|
+
const currentTime = playerRef.current.getCurrentTime();
|
|
34
|
+
const progress = Math.round(currentTime / duration * PERCENTAGE_MULTIPLIER);
|
|
35
|
+
if (progress !== lastProgress) {
|
|
36
|
+
fireVideoProgressEvents(progress, onProgress, event);
|
|
37
|
+
lastProgress = progress;
|
|
38
|
+
}
|
|
39
|
+
if (currentTime < duration) {
|
|
40
|
+
requestAnimationFrameIds.push(requestAnimationFrame(frame));
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Cancel any previous animation frames
|
|
45
|
+
requestAnimationFrameIds.forEach(id => cancelAnimationFrame(id));
|
|
46
|
+
|
|
47
|
+
// Start a new animation frame
|
|
48
|
+
requestAnimationFrameIds.push(requestAnimationFrame(frame));
|
|
49
|
+
return requestAnimationFrameIds;
|
|
50
|
+
};
|
|
@@ -5,7 +5,7 @@ export {
|
|
|
5
5
|
/**
|
|
6
6
|
* Most base components should be re-exported as-is.
|
|
7
7
|
*/
|
|
8
|
-
A11yText, ActivityIndicator, Autocomplete, Box, Button, BaseProvider, A11yInfoProvider, ViewportProvider, ThemeProvider, ButtonDropdown, ButtonGroup, ButtonLink, Carousel, CarouselTabs, Checkbox, CheckboxGroup, ChevronLink, ColourToggle, Divider, ExpandCollapse, Feedback, FlexGrid, Icon, InputLabel, InputSupports, Link, Listbox, Modal, MultiSelectFilter, Notification, Pagination, Portal, QuickLinks, QuickLinksFeature, Radio, RadioGroup, RadioCard, RadioCardGroup, Responsive, Search, Select, SideNav, Skeleton, SkipLink, Spacer, StackView, StackWrap, StepTracker, Tabs, Tags, TextButton, TextArea, TextInput, Timeline, ToggleSwitch, ToggleSwitchGroup, TooltipButton, Tooltip, Typography, Validator,
|
|
8
|
+
A11yText, ActivityIndicator, Autocomplete, Box, Button, BaseProvider, A11yInfoProvider, ViewportProvider, ThemeProvider, ButtonDropdown, ButtonGroup, ButtonLink, CardGroup, Carousel, CarouselTabs, Checkbox, CheckboxGroup, ChevronLink, ColourToggle, Divider, ExpandCollapse, Feedback, FlexGrid, Icon, InputLabel, InputSupports, Link, Listbox, Modal, MultiSelectFilter, Notification, Pagination, Portal, QuickLinks, QuickLinksFeature, Radio, RadioGroup, RadioCard, RadioCardGroup, Responsive, Search, Select, SideNav, Skeleton, SkipLink, Spacer, StackView, StackWrap, StepTracker, Tabs, Tags, TextButton, TextArea, TextInput, Timeline, ToggleSwitch, ToggleSwitchGroup, TooltipButton, Tooltip, Typography, Validator,
|
|
9
9
|
/*
|
|
10
10
|
* Most utilities exported from @telus-uds/components-base are for building systems, not apps.
|
|
11
11
|
* Re-export only those utilities with a stable API and known use cases within apps / pages.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { useThemeTokens } from '@telus-uds/components-base';
|
|
3
|
+
import { getTokensPropType, useThemeTokens } from '@telus-uds/components-base';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
const withClientTheme = Component => {
|
|
6
6
|
const UdsStyledComponent = _ref => {
|
|
@@ -16,7 +16,7 @@ const withClientTheme = Component => {
|
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
18
|
UdsStyledComponent.propTypes = {
|
|
19
|
-
tokens:
|
|
19
|
+
tokens: getTokensPropType(Component.displayName),
|
|
20
20
|
variant: PropTypes.string
|
|
21
21
|
};
|
|
22
22
|
return UdsStyledComponent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { getThemeTokens } from '@telus-uds/components-base/server';
|
|
3
|
+
import { getThemeTokens, getTokensPropType } from '@telus-uds/components-base/server';
|
|
4
4
|
import getTheme from './get-theme-from-server';
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
const withServerTheme = (Component, componentName) => {
|
|
@@ -18,7 +18,7 @@ const withServerTheme = (Component, componentName) => {
|
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
UdsStyledComponent.propTypes = {
|
|
21
|
-
tokens:
|
|
21
|
+
tokens: getTokensPropType(componentName),
|
|
22
22
|
variant: PropTypes.string
|
|
23
23
|
};
|
|
24
24
|
return UdsStyledComponent;
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
],
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@gorhom/portal": "^1.0.14",
|
|
8
|
-
"@telus-uds/components-base": "1.
|
|
8
|
+
"@telus-uds/components-base": "1.85.0",
|
|
9
9
|
"@telus-uds/system-constants": "^1.3.0",
|
|
10
10
|
"fscreen": "^1.2.0",
|
|
11
11
|
"lodash.omit": "^4.5.0",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"react-dates": "^21.8.0",
|
|
14
14
|
"react-helmet-async": "^1.3.0",
|
|
15
15
|
"react-moment-proptypes": "^1.8.1",
|
|
16
|
-
"@telus-uds/system-theme-tokens": "^2.
|
|
16
|
+
"@telus-uds/system-theme-tokens": "^2.56.0",
|
|
17
17
|
"prop-types": "^15.7.2",
|
|
18
18
|
"lodash.throttle": "^4.1.1",
|
|
19
19
|
"react-youtube": "^10.1.0",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"skip": true
|
|
84
84
|
},
|
|
85
85
|
"types": "types/index.d.ts",
|
|
86
|
-
"version": "2.
|
|
86
|
+
"version": "2.34.0"
|
|
87
87
|
}
|
package/src/Badge/Badge.jsx
CHANGED
|
@@ -35,7 +35,7 @@ const fontSizeMapping = {
|
|
|
35
35
|
16: 'h6'
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
const Badge = ({ children, tokens, variant = {}, ...rest }) => {
|
|
38
|
+
const Badge = React.forwardRef(({ children, tokens, variant = {}, ...rest }, ref) => {
|
|
39
39
|
const {
|
|
40
40
|
backgroundColor,
|
|
41
41
|
gradient,
|
|
@@ -74,6 +74,7 @@ const Badge = ({ children, tokens, variant = {}, ...rest }) => {
|
|
|
74
74
|
fontWeight={fontWeight}
|
|
75
75
|
gradient={semanticGradient}
|
|
76
76
|
border={`${borderWidth}px solid ${borderColor}`}
|
|
77
|
+
ref={ref}
|
|
77
78
|
{...selectProps(rest)}
|
|
78
79
|
>
|
|
79
80
|
<Typography
|
|
@@ -84,7 +85,9 @@ const Badge = ({ children, tokens, variant = {}, ...rest }) => {
|
|
|
84
85
|
</Typography>
|
|
85
86
|
</BadgeContainer>
|
|
86
87
|
)
|
|
87
|
-
}
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
Badge.displayName = 'Badge'
|
|
88
91
|
|
|
89
92
|
Badge.propTypes = {
|
|
90
93
|
...selectedSystemPropTypes,
|
|
@@ -38,132 +38,140 @@ const QuoteContainer = styled.div`
|
|
|
38
38
|
margin-bottom: ${({ marginBottom }) => `${marginBottom}px`};
|
|
39
39
|
`
|
|
40
40
|
|
|
41
|
-
const BlockQuote = (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
41
|
+
const BlockQuote = React.forwardRef(
|
|
42
|
+
(
|
|
43
|
+
{
|
|
44
|
+
children,
|
|
45
|
+
link,
|
|
46
|
+
additionalInfo,
|
|
47
|
+
linkHref,
|
|
48
|
+
textStyle = 'large',
|
|
49
|
+
LinkRouter,
|
|
50
|
+
linkRouterProps,
|
|
51
|
+
tokens,
|
|
52
|
+
variant,
|
|
53
|
+
...rest
|
|
54
|
+
},
|
|
55
|
+
ref
|
|
56
|
+
) => {
|
|
57
|
+
const viewport = useViewport()
|
|
58
|
+
const {
|
|
59
|
+
color,
|
|
60
|
+
paddingTop,
|
|
61
|
+
paddingBottom,
|
|
62
|
+
paddingLeft,
|
|
63
|
+
paddingRight,
|
|
64
|
+
marginBottom,
|
|
65
|
+
width,
|
|
66
|
+
backgroundGradient,
|
|
67
|
+
titleHeadingFontSize,
|
|
68
|
+
titleHeadingFontName,
|
|
69
|
+
titleHeadingFontWeight,
|
|
70
|
+
titleHeadingLineHeight,
|
|
71
|
+
titleFontSize,
|
|
72
|
+
titleFontName,
|
|
73
|
+
titleFontWeight,
|
|
74
|
+
titleLineHeight,
|
|
75
|
+
linkFontSize,
|
|
76
|
+
linkFontName,
|
|
77
|
+
linkFontWeight,
|
|
78
|
+
linkLineHeight
|
|
79
|
+
} = useThemeTokens('BlockQuote', tokens, variant, {
|
|
80
|
+
viewport
|
|
81
|
+
})
|
|
82
|
+
const mappedTextSize = textStyle === 'heading' ? 'h3' : textStyle
|
|
83
|
+
const titleTokens =
|
|
84
|
+
textStyle === 'heading'
|
|
85
|
+
? {
|
|
86
|
+
fontSize: titleHeadingFontSize,
|
|
87
|
+
fontName: titleHeadingFontName,
|
|
88
|
+
fontWeight: titleHeadingFontWeight,
|
|
89
|
+
lineHeight: titleHeadingLineHeight
|
|
90
|
+
}
|
|
91
|
+
: {
|
|
92
|
+
fontSize: titleFontSize,
|
|
93
|
+
fontName: titleFontName,
|
|
94
|
+
fontWeight: titleFontWeight,
|
|
95
|
+
lineHeight: titleLineHeight
|
|
96
|
+
}
|
|
97
|
+
const renderLink = () => {
|
|
98
|
+
if (linkHref) {
|
|
99
|
+
return (
|
|
100
|
+
<Link
|
|
101
|
+
href={linkHref}
|
|
102
|
+
tokens={{
|
|
103
|
+
blockFontSize: linkFontSize,
|
|
104
|
+
blockFontName: linkFontName,
|
|
105
|
+
blockFontWeight: linkFontWeight,
|
|
106
|
+
blockLineHeight: linkLineHeight,
|
|
107
|
+
color
|
|
108
|
+
}}
|
|
109
|
+
variant={{ alternative: true }}
|
|
110
|
+
LinkRouter={LinkRouter}
|
|
111
|
+
linkRouterProps={linkRouterProps}
|
|
112
|
+
>
|
|
113
|
+
{link}
|
|
114
|
+
</Link>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
95
118
|
return (
|
|
96
|
-
<
|
|
97
|
-
href={linkHref}
|
|
119
|
+
<Typography
|
|
98
120
|
tokens={{
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
121
|
+
color,
|
|
122
|
+
fontName: linkFontName,
|
|
123
|
+
fontSize: linkFontSize,
|
|
124
|
+
fontWeight: linkFontWeight,
|
|
125
|
+
lineHeight: linkLineHeight
|
|
104
126
|
}}
|
|
105
|
-
variant={{ alternative: true }}
|
|
106
|
-
LinkRouter={LinkRouter}
|
|
107
|
-
linkRouterProps={linkRouterProps}
|
|
108
127
|
>
|
|
109
128
|
{link}
|
|
110
|
-
</
|
|
129
|
+
</Typography>
|
|
111
130
|
)
|
|
112
131
|
}
|
|
113
132
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
tokens={{
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
fontWeight: linkFontWeight,
|
|
121
|
-
lineHeight: linkLineHeight
|
|
122
|
-
}}
|
|
123
|
-
>
|
|
124
|
-
{link}
|
|
125
|
-
</Typography>
|
|
126
|
-
)
|
|
127
|
-
}
|
|
133
|
+
const renderQuote = () => {
|
|
134
|
+
const quote = (
|
|
135
|
+
<Typography tokens={{ color, ...titleTokens }} variant={{ size: mappedTextSize }}>
|
|
136
|
+
{children}
|
|
137
|
+
</Typography>
|
|
138
|
+
)
|
|
128
139
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
{children}
|
|
133
|
-
</Typography>
|
|
134
|
-
)
|
|
140
|
+
if (additionalInfo || link) {
|
|
141
|
+
return <QuoteContainer marginBottom={marginBottom}>{quote}</QuoteContainer>
|
|
142
|
+
}
|
|
135
143
|
|
|
136
|
-
|
|
137
|
-
return <QuoteContainer marginBottom={marginBottom}>{quote}</QuoteContainer>
|
|
144
|
+
return quote
|
|
138
145
|
}
|
|
139
146
|
|
|
140
|
-
return
|
|
147
|
+
return (
|
|
148
|
+
<BlockQuoteContainer
|
|
149
|
+
{...selectProps(rest)}
|
|
150
|
+
paddingTop={paddingTop}
|
|
151
|
+
paddingBottom={paddingBottom}
|
|
152
|
+
paddingLeft={paddingLeft}
|
|
153
|
+
paddingRight={paddingRight}
|
|
154
|
+
width={width}
|
|
155
|
+
backgroundGradient={backgroundGradient}
|
|
156
|
+
ref={ref}
|
|
157
|
+
>
|
|
158
|
+
{renderQuote()}
|
|
159
|
+
{(additionalInfo || link) && (
|
|
160
|
+
<StackView space={0}>
|
|
161
|
+
{link && renderLink()}
|
|
162
|
+
{additionalInfo && (
|
|
163
|
+
<Typography tokens={{ color }} variant={{ size: 'small' }}>
|
|
164
|
+
{additionalInfo}
|
|
165
|
+
</Typography>
|
|
166
|
+
)}
|
|
167
|
+
</StackView>
|
|
168
|
+
)}
|
|
169
|
+
</BlockQuoteContainer>
|
|
170
|
+
)
|
|
141
171
|
}
|
|
172
|
+
)
|
|
142
173
|
|
|
143
|
-
|
|
144
|
-
<BlockQuoteContainer
|
|
145
|
-
{...selectProps(rest)}
|
|
146
|
-
paddingTop={paddingTop}
|
|
147
|
-
paddingBottom={paddingBottom}
|
|
148
|
-
paddingLeft={paddingLeft}
|
|
149
|
-
paddingRight={paddingRight}
|
|
150
|
-
width={width}
|
|
151
|
-
backgroundGradient={backgroundGradient}
|
|
152
|
-
>
|
|
153
|
-
{renderQuote()}
|
|
154
|
-
{(additionalInfo || link) && (
|
|
155
|
-
<StackView space={0}>
|
|
156
|
-
{link && renderLink()}
|
|
157
|
-
{additionalInfo && (
|
|
158
|
-
<Typography tokens={{ color }} variant={{ size: 'small' }}>
|
|
159
|
-
{additionalInfo}
|
|
160
|
-
</Typography>
|
|
161
|
-
)}
|
|
162
|
-
</StackView>
|
|
163
|
-
)}
|
|
164
|
-
</BlockQuoteContainer>
|
|
165
|
-
)
|
|
166
|
-
}
|
|
174
|
+
BlockQuote.displayName = 'BlockQuote'
|
|
167
175
|
|
|
168
176
|
BlockQuote.propTypes = {
|
|
169
177
|
...selectedSystemPropTypes,
|