@telus-uds/components-web 3.0.1 → 3.2.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 +31 -2
- package/lib/Badge/Badge.js +0 -0
- package/lib/Badge/index.js +0 -0
- package/lib/BlockQuote/BlockQuote.js +56 -10
- package/lib/BlockQuote/index.js +0 -0
- package/lib/Breadcrumbs/Breadcrumbs.js +0 -0
- package/lib/Breadcrumbs/Item/Item.js +0 -0
- package/lib/Breadcrumbs/index.js +0 -0
- package/lib/Callout/Callout.js +0 -0
- package/lib/Callout/index.js +0 -0
- package/lib/Card/Card.js +0 -0
- package/lib/Card/CardContent.js +0 -0
- package/lib/Card/CardFooter.js +0 -0
- package/lib/Card/index.js +0 -0
- package/lib/Countdown/Countdown.js +78 -6
- package/lib/Countdown/Segment.js +6 -0
- package/lib/Countdown/constants.js +0 -0
- package/lib/Countdown/dictionary.js +0 -0
- package/lib/Countdown/index.js +0 -0
- package/lib/Countdown/types.js +0 -0
- package/lib/Countdown/useCountdown.js +0 -0
- package/lib/DatePicker/CalendarContainer.js +0 -0
- package/lib/DatePicker/DatePicker.js +0 -0
- package/lib/DatePicker/dictionary.js +0 -0
- package/lib/DatePicker/index.js +0 -0
- package/lib/DatePicker/reactDatesCss.js +0 -0
- package/lib/Disclaimer/Disclaimer.js +0 -0
- package/lib/Disclaimer/index.js +0 -0
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +0 -0
- package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +0 -0
- package/lib/ExpandCollapseMini/index.js +0 -0
- package/lib/Footnote/Footnote.js +0 -0
- package/lib/Footnote/FootnoteLink.js +0 -0
- package/lib/Footnote/dictionary.js +0 -0
- package/lib/Footnote/index.js +0 -0
- package/lib/IconButton/IconButton.js +0 -0
- package/lib/IconButton/index.js +0 -0
- package/lib/Image/Image.js +0 -0
- package/lib/Image/index.js +0 -0
- package/lib/Image/server.js +0 -0
- package/lib/List/List.js +0 -0
- package/lib/List/ListItem.js +0 -0
- package/lib/List/index.js +0 -0
- package/lib/NavigationBar/NavigationBar.js +69 -15
- package/lib/NavigationBar/NavigationItem.js +0 -0
- package/lib/NavigationBar/NavigationSubMenu.js +0 -0
- package/lib/NavigationBar/collapseItems.js +0 -0
- package/lib/NavigationBar/index.js +0 -0
- package/lib/NavigationBar/resolveItemSelection.js +0 -0
- package/lib/OptimizeImage/OptimizeImage.js +0 -0
- package/lib/OptimizeImage/index.js +0 -0
- package/lib/OptimizeImage/utils/getFallbackUrl.js +0 -0
- package/lib/OptimizeImage/utils/getImageUrls.js +0 -0
- package/lib/OptimizeImage/utils/getOptimizedUrl.js +0 -0
- package/lib/OptimizeImage/utils/hasWebpSupport.js +0 -0
- package/lib/OptimizeImage/utils/index.js +0 -0
- package/lib/OptimizeImage/utils/isSvgUrl.js +0 -0
- package/lib/OrderedList/Item.js +0 -0
- package/lib/OrderedList/ItemBase.js +0 -0
- package/lib/OrderedList/OrderedList.js +0 -0
- package/lib/OrderedList/OrderedListBase.js +0 -0
- package/lib/OrderedList/constants.js +0 -0
- package/lib/OrderedList/index.js +0 -0
- package/lib/Paragraph/Paragraph.js +0 -0
- package/lib/Paragraph/index.js +0 -0
- package/lib/PreviewCard/AuthorDate.js +0 -0
- package/lib/PreviewCard/PreviewCard.js +0 -0
- package/lib/PreviewCard/index.js +0 -0
- package/lib/PriceLockup/PriceLockup.js +0 -0
- package/lib/PriceLockup/index.js +0 -0
- package/lib/PriceLockup/tokens.js +0 -0
- package/lib/Progress/ProgressBar.js +11 -1
- package/lib/Progress/index.js +0 -0
- package/lib/QuantitySelector/QuantitySelector.js +1 -1
- package/lib/QuantitySelector/SideButton.js +0 -0
- package/lib/QuantitySelector/dictionary.js +0 -0
- package/lib/QuantitySelector/index.js +0 -0
- package/lib/QuantitySelector/styles.js +0 -0
- package/lib/ResponsiveImage/ResponsiveImage.js +9 -3
- package/lib/ResponsiveImage/index.js +0 -0
- package/lib/Ribbon/Ribbon.js +0 -0
- package/lib/Ribbon/index.js +0 -0
- package/lib/SkeletonProvider/SkeletonImage.js +0 -0
- package/lib/SkeletonProvider/SkeletonProvider.js +0 -0
- package/lib/SkeletonProvider/SkeletonTypography.js +0 -0
- package/lib/SkeletonProvider/index.js +0 -0
- package/lib/Span/Span.js +0 -0
- package/lib/Span/index.js +0 -0
- package/lib/Spinner/Spinner.js +0 -0
- package/lib/Spinner/SpinnerContent.js +0 -0
- package/lib/Spinner/constants.js +0 -0
- package/lib/Spinner/index.js +0 -0
- package/lib/StoryCard/StoryCard.js +0 -0
- package/lib/StoryCard/index.js +0 -0
- package/lib/Table/Body.js +0 -0
- package/lib/Table/Cell.js +0 -0
- package/lib/Table/Header.js +0 -0
- package/lib/Table/Row.js +0 -0
- package/lib/Table/SubHeading.js +0 -0
- package/lib/Table/Table.js +0 -0
- package/lib/Table/index.js +0 -0
- package/lib/TermsAndConditions/ExpandCollapse.js +0 -0
- package/lib/TermsAndConditions/TermsAndConditions.js +0 -0
- package/lib/TermsAndConditions/dictionary.js +0 -0
- package/lib/TermsAndConditions/index.js +0 -0
- package/lib/Testimonial/Testimonial.js +0 -0
- package/lib/Testimonial/index.js +0 -0
- package/lib/Toast/Toast.js +0 -0
- package/lib/Toast/index.js +0 -0
- package/lib/Video/ControlBar/ControlBar.js +0 -0
- package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +0 -0
- package/lib/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +0 -0
- package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +3 -0
- package/lib/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +0 -0
- package/lib/Video/MiddleControlButton/MiddleControlButton.js +0 -0
- package/lib/Video/Video.js +0 -0
- package/lib/Video/index.js +0 -0
- package/lib/Video/videoText.js +0 -0
- package/lib/VideoPicker/VideoPicker.js +0 -0
- package/lib/VideoPicker/VideoPickerPlayer.js +0 -0
- package/lib/VideoPicker/VideoPickerThumbnail.js +0 -0
- package/lib/VideoPicker/VideoSlider.js +0 -0
- package/lib/VideoPicker/index.js +0 -0
- package/lib/VideoPicker/videoPropType.js +0 -0
- package/lib/WaffleGrid/WaffleGrid.js +0 -0
- package/lib/WaffleGrid/index.js +0 -0
- package/lib/WebVideo/WebVideo.js +0 -0
- package/lib/WebVideo/index.js +0 -0
- package/lib/WebVideo/utils/index.js +0 -0
- package/lib/baseExports.js +0 -0
- package/lib/index.js +0 -0
- package/lib/server.js +0 -0
- package/lib/shared/ConditionalWrapper/ConditionalWrapper.js +0 -0
- package/lib/shared/ConditionalWrapper/index.js +0 -0
- package/lib/shared/FullBleedContent/FullBleedContent.js +0 -0
- package/lib/shared/FullBleedContent/getFullBleedBorderRadius.js +0 -0
- package/lib/shared/FullBleedContent/index.js +0 -0
- package/lib/shared/FullBleedContent/useFullBleedContentProps.js +0 -0
- package/lib/shared/VideoSplash/SplashButton/SplashButton.js +0 -0
- package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +0 -0
- package/lib/shared/VideoSplash/VideoSplash.js +0 -0
- package/lib/shared/VideoSplash/helpers.js +0 -0
- package/lib/utils/index.js +3 -2
- package/lib/utils/isElementFocusable.js +0 -0
- package/lib/utils/logger.js +0 -0
- package/lib/utils/media.js +0 -0
- package/lib/utils/renderStructuredContent.js +0 -0
- package/lib/utils/scrollToAnchor.js +19 -0
- package/lib/utils/ssr.js +0 -0
- package/lib/utils/theming/get-theme-from-server.js +0 -0
- package/lib/utils/theming/with-client-theme.js +0 -0
- package/lib/utils/theming/with-server-theme.js +0 -0
- package/lib/utils/transforms.js +0 -0
- package/lib/utils/useOverlaidPosition.js +0 -0
- package/lib/utils/useTypographyTheme.js +0 -0
- package/package.json +3 -3
- package/src/BlockQuote/BlockQuote.jsx +73 -11
- package/src/Countdown/Countdown.jsx +90 -6
- package/src/Countdown/Segment.jsx +8 -2
- package/src/NavigationBar/NavigationBar.jsx +53 -12
- package/src/Progress/ProgressBar.jsx +11 -2
- package/src/QuantitySelector/QuantitySelector.jsx +1 -1
- package/src/ResponsiveImage/ResponsiveImage.jsx +12 -5
- package/src/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.jsx +5 -1
- package/src/utils/index.js +5 -2
- package/src/utils/scrollToAnchor.js +18 -0
package/lib/Progress/index.js
CHANGED
|
File without changes
|
|
@@ -78,7 +78,7 @@ const QuantitySelector = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
78
78
|
setError(getCopy('errors').invalidCharacters);
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
const renderLabel = () => label ? /*#__PURE__*/_jsx(InputLabel, {
|
|
81
|
+
const renderLabel = () => label || hint ? /*#__PURE__*/_jsx(InputLabel, {
|
|
82
82
|
forId: id,
|
|
83
83
|
label: label,
|
|
84
84
|
hint: hint,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -2,9 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { selectSystemProps } from '@telus-uds/components-base';
|
|
4
4
|
import { viewports } from '@telus-uds/system-constants';
|
|
5
|
-
import { htmlAttrs } from '../utils';
|
|
5
|
+
import { htmlAttrs, contentfulProps } from '../utils';
|
|
6
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
7
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs, contentfulProps]);
|
|
8
8
|
const staticStyles = {
|
|
9
9
|
image: {
|
|
10
10
|
display: 'block',
|
|
@@ -25,11 +25,13 @@ const ResponsiveImage = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
25
25
|
fallbackSrc,
|
|
26
26
|
alt,
|
|
27
27
|
loading = 'eager',
|
|
28
|
+
dataSet,
|
|
28
29
|
...rest
|
|
29
30
|
} = _ref;
|
|
30
31
|
return /*#__PURE__*/_jsxs("picture", {
|
|
31
32
|
...selectProps(rest),
|
|
32
33
|
ref: ref,
|
|
34
|
+
...dataSet,
|
|
33
35
|
children: [/*#__PURE__*/_jsx("source", {
|
|
34
36
|
srcSet: xlSrc,
|
|
35
37
|
media: `(min-width: ${viewports.map.get(viewports.xl)}px)`
|
|
@@ -89,6 +91,10 @@ ResponsiveImage.propTypes = {
|
|
|
89
91
|
* @default 'eager'
|
|
90
92
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading
|
|
91
93
|
*/
|
|
92
|
-
loading: PropTypes.oneOf(['eager', 'lazy'])
|
|
94
|
+
loading: PropTypes.oneOf(['eager', 'lazy']),
|
|
95
|
+
/**
|
|
96
|
+
* The dataSet prop allows to pass data-* attributes element to the component.
|
|
97
|
+
*/
|
|
98
|
+
dataSet: PropTypes.object
|
|
93
99
|
};
|
|
94
100
|
export default ResponsiveImage;
|
|
File without changes
|
package/lib/Ribbon/Ribbon.js
CHANGED
|
File without changes
|
package/lib/Ribbon/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/Span/Span.js
CHANGED
|
File without changes
|
package/lib/Span/index.js
CHANGED
|
File without changes
|
package/lib/Spinner/Spinner.js
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/Spinner/constants.js
CHANGED
|
File without changes
|
package/lib/Spinner/index.js
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/StoryCard/index.js
CHANGED
|
File without changes
|
package/lib/Table/Body.js
CHANGED
|
File without changes
|
package/lib/Table/Cell.js
CHANGED
|
File without changes
|
package/lib/Table/Header.js
CHANGED
|
File without changes
|
package/lib/Table/Row.js
CHANGED
|
File without changes
|
package/lib/Table/SubHeading.js
CHANGED
|
File without changes
|
package/lib/Table/Table.js
CHANGED
|
File without changes
|
package/lib/Table/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/Testimonial/index.js
CHANGED
|
File without changes
|
package/lib/Toast/Toast.js
CHANGED
|
File without changes
|
package/lib/Toast/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -133,6 +133,8 @@ const VideoProgressBar = _ref5 => {
|
|
|
133
133
|
thumbBackground,
|
|
134
134
|
timestampMarginLeft,
|
|
135
135
|
timestampMarginRight,
|
|
136
|
+
remainingTimestampMarginLeft,
|
|
137
|
+
remainingTimestampMarginRight,
|
|
136
138
|
trackGradientStart,
|
|
137
139
|
trackGradientEnd,
|
|
138
140
|
rangeBackground
|
|
@@ -180,6 +182,7 @@ const VideoProgressBar = _ref5 => {
|
|
|
180
182
|
tabIndex: "-1",
|
|
181
183
|
...sharedProps
|
|
182
184
|
}), /*#__PURE__*/_jsx(StyledTimestamp, {
|
|
185
|
+
margin: `0 ${remainingTimestampMarginRight}px 0 ${remainingTimestampMarginLeft}px`,
|
|
183
186
|
children: /*#__PURE__*/_jsx(Typography, {
|
|
184
187
|
variant: {
|
|
185
188
|
inverse: true
|
|
File without changes
|
|
File without changes
|
package/lib/Video/Video.js
CHANGED
|
File without changes
|
package/lib/Video/index.js
CHANGED
|
File without changes
|
package/lib/Video/videoText.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/VideoPicker/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/WaffleGrid/index.js
CHANGED
|
File without changes
|
package/lib/WebVideo/WebVideo.js
CHANGED
|
File without changes
|
package/lib/WebVideo/index.js
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/baseExports.js
CHANGED
|
File without changes
|
package/lib/index.js
CHANGED
|
File without changes
|
package/lib/server.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/utils/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { htmlAttrs } from '@telus-uds/components-base';
|
|
1
|
+
import { htmlAttrs, contentfulProps } from '@telus-uds/components-base';
|
|
2
2
|
import { warn, deprecate } from './logger';
|
|
3
3
|
import { transformGradient } from './transforms';
|
|
4
4
|
import useTypographyTheme from './useTypographyTheme';
|
|
@@ -7,4 +7,5 @@ import ssrStyles from './ssr';
|
|
|
7
7
|
import isElementFocusable from './isElementFocusable';
|
|
8
8
|
import renderStructuredContent from './renderStructuredContent';
|
|
9
9
|
import useOverlaidPosition from './useOverlaidPosition';
|
|
10
|
-
|
|
10
|
+
import scrollToAnchor from './scrollToAnchor';
|
|
11
|
+
export { deprecate, htmlAttrs, contentfulProps, transformGradient, useTypographyTheme, warn, media, renderStructuredContent, ssrStyles, isElementFocusable, useOverlaidPosition, scrollToAnchor };
|
|
File without changes
|
package/lib/utils/logger.js
CHANGED
|
File without changes
|
package/lib/utils/media.js
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scrolls smoothly to the anchor element specified by the href.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} href - The href attribute value, expected to be an anchor link starting with '#'.
|
|
5
|
+
* @param {Event} event - The event object associated with the click or navigation action.
|
|
6
|
+
* @param {Function} onAfterScroll - A callback function to be executed after the scroll action is completed.
|
|
7
|
+
*/
|
|
8
|
+
const scrollToAnchor = (href, event, onAfterScroll) => {
|
|
9
|
+
if (href !== null && href !== void 0 && href.startsWith('#')) {
|
|
10
|
+
event.preventDefault();
|
|
11
|
+
const target = document.getElementById(href.slice(1));
|
|
12
|
+
target === null || target === void 0 || target.scrollIntoView({
|
|
13
|
+
behavior: 'smooth'
|
|
14
|
+
});
|
|
15
|
+
window.location.hash = href;
|
|
16
|
+
onAfterScroll(event);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export default scrollToAnchor;
|
package/lib/utils/ssr.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/utils/transforms.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
],
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@gorhom/portal": "^1.0.14",
|
|
9
|
-
"@telus-uds/components-base": "^2.0
|
|
9
|
+
"@telus-uds/components-base": "^2.2.0",
|
|
10
10
|
"@telus-uds/system-constants": "^2.0.0",
|
|
11
11
|
"fscreen": "^1.2.0",
|
|
12
12
|
"lodash.omit": "^4.5.0",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"react-dates": "^21.8.0",
|
|
15
15
|
"react-helmet-async": "^1.3.0",
|
|
16
16
|
"react-moment-proptypes": "^1.8.1",
|
|
17
|
-
"@telus-uds/system-theme-tokens": "^3.
|
|
17
|
+
"@telus-uds/system-theme-tokens": "^3.1.0",
|
|
18
18
|
"prop-types": "^15.7.2",
|
|
19
19
|
"lodash.throttle": "^4.1.1",
|
|
20
20
|
"react-youtube": "^10.1.0",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"skip": true
|
|
82
82
|
},
|
|
83
83
|
"types": "types/index.d.ts",
|
|
84
|
-
"version": "3.0
|
|
84
|
+
"version": "3.2.0"
|
|
85
85
|
}
|
|
@@ -5,10 +5,14 @@ import {
|
|
|
5
5
|
selectSystemProps,
|
|
6
6
|
StackView,
|
|
7
7
|
Typography,
|
|
8
|
+
useTheme,
|
|
8
9
|
useThemeTokens,
|
|
10
|
+
useResponsiveThemeTokens,
|
|
11
|
+
createMediaQueryStyles,
|
|
9
12
|
withLinkRouter,
|
|
10
13
|
useViewport,
|
|
11
|
-
getTokensPropType
|
|
14
|
+
getTokensPropType,
|
|
15
|
+
StyleSheet
|
|
12
16
|
} from '@telus-uds/components-base'
|
|
13
17
|
import styled from 'styled-components'
|
|
14
18
|
import { htmlAttrs, transformGradient } from '../utils'
|
|
@@ -38,6 +42,13 @@ const QuoteContainer = styled.div`
|
|
|
38
42
|
margin-bottom: ${({ marginBottom }) => `${marginBottom}px`};
|
|
39
43
|
`
|
|
40
44
|
|
|
45
|
+
const selectTitleHeadingTokens = (themeTokens) => ({
|
|
46
|
+
fontSize: themeTokens.titleHeadingFontSize,
|
|
47
|
+
fontName: themeTokens.titleHeadingFontName,
|
|
48
|
+
fontWeight: themeTokens.titleHeadingFontWeight,
|
|
49
|
+
lineHeight: themeTokens.titleHeadingLineHeight
|
|
50
|
+
})
|
|
51
|
+
|
|
41
52
|
const BlockQuote = React.forwardRef(
|
|
42
53
|
(
|
|
43
54
|
{
|
|
@@ -55,6 +66,18 @@ const BlockQuote = React.forwardRef(
|
|
|
55
66
|
ref
|
|
56
67
|
) => {
|
|
57
68
|
const viewport = useViewport()
|
|
69
|
+
const {
|
|
70
|
+
themeOptions: { enableMediaQueryStyleSheet }
|
|
71
|
+
} = useTheme()
|
|
72
|
+
|
|
73
|
+
const useTokens = enableMediaQueryStyleSheet ? useResponsiveThemeTokens : useThemeTokens
|
|
74
|
+
|
|
75
|
+
const themeTokens = useTokens(
|
|
76
|
+
'BlockQuote',
|
|
77
|
+
tokens,
|
|
78
|
+
variant,
|
|
79
|
+
!enableMediaQueryStyleSheet && { viewport }
|
|
80
|
+
)
|
|
58
81
|
const {
|
|
59
82
|
color,
|
|
60
83
|
paddingTop,
|
|
@@ -76,18 +99,53 @@ const BlockQuote = React.forwardRef(
|
|
|
76
99
|
linkFontName,
|
|
77
100
|
linkFontWeight,
|
|
78
101
|
linkLineHeight
|
|
79
|
-
} =
|
|
80
|
-
|
|
81
|
-
|
|
102
|
+
} = themeTokens
|
|
103
|
+
|
|
104
|
+
let titleHeadingStyles
|
|
105
|
+
let titleHeadingMediaIds
|
|
106
|
+
|
|
107
|
+
if (enableMediaQueryStyleSheet) {
|
|
108
|
+
const { transformedTitleHeadingThemeTokens } = Object.entries(themeTokens).reduce(
|
|
109
|
+
(acc, [vp, viewportTokens]) => {
|
|
110
|
+
acc.transformedTitleHeadingThemeTokens[vp] = {
|
|
111
|
+
fontSize: viewportTokens.titleHeadingFontSize,
|
|
112
|
+
fontName: viewportTokens.titleHeadingFontName,
|
|
113
|
+
fontWeight: viewportTokens.titleHeadingFontWeight,
|
|
114
|
+
lineHeight: viewportTokens.titleHeadingLineHeight
|
|
115
|
+
}
|
|
116
|
+
return acc
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
transformedTitleHeadingThemeTokens: {}
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
const titleHeadingMediaQueryStyles = createMediaQueryStyles(
|
|
124
|
+
transformedTitleHeadingThemeTokens
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
const { ids, styles } = StyleSheet.create({
|
|
128
|
+
titleHeading: {
|
|
129
|
+
...selectTitleHeadingTokens(themeTokens[viewport]),
|
|
130
|
+
...titleHeadingMediaQueryStyles
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
titleHeadingStyles = styles.titleHeading
|
|
135
|
+
titleHeadingMediaIds = ids.titleHeading
|
|
136
|
+
} else {
|
|
137
|
+
titleHeadingStyles = {
|
|
138
|
+
fontSize: titleHeadingFontSize,
|
|
139
|
+
fontName: titleHeadingFontName,
|
|
140
|
+
fontWeight: titleHeadingFontWeight,
|
|
141
|
+
lineHeight: titleHeadingLineHeight
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
82
145
|
const mappedTextSize = textStyle === 'heading' ? 'h3' : textStyle
|
|
83
146
|
const titleTokens =
|
|
84
147
|
textStyle === 'heading'
|
|
85
|
-
?
|
|
86
|
-
fontSize: titleHeadingFontSize,
|
|
87
|
-
fontName: titleHeadingFontName,
|
|
88
|
-
fontWeight: titleHeadingFontWeight,
|
|
89
|
-
lineHeight: titleHeadingLineHeight
|
|
90
|
-
}
|
|
148
|
+
? titleHeadingStyles
|
|
91
149
|
: {
|
|
92
150
|
fontSize: titleFontSize,
|
|
93
151
|
fontName: titleFontName,
|
|
@@ -132,7 +190,11 @@ const BlockQuote = React.forwardRef(
|
|
|
132
190
|
|
|
133
191
|
const renderQuote = () => {
|
|
134
192
|
const quote = (
|
|
135
|
-
<Typography
|
|
193
|
+
<Typography
|
|
194
|
+
tokens={{ color, ...titleTokens }}
|
|
195
|
+
media={titleHeadingMediaIds}
|
|
196
|
+
variant={{ size: mappedTextSize }}
|
|
197
|
+
>
|
|
136
198
|
{children}
|
|
137
199
|
</Typography>
|
|
138
200
|
)
|
|
@@ -6,9 +6,13 @@ import {
|
|
|
6
6
|
Typography,
|
|
7
7
|
selectSystemProps,
|
|
8
8
|
useViewport,
|
|
9
|
+
useTheme,
|
|
9
10
|
useThemeTokens,
|
|
11
|
+
useResponsiveThemeTokens,
|
|
12
|
+
createMediaQueryStyles,
|
|
10
13
|
applyTextStyles,
|
|
11
|
-
getTokensPropType
|
|
14
|
+
getTokensPropType,
|
|
15
|
+
StyleSheet
|
|
12
16
|
} from '@telus-uds/components-base'
|
|
13
17
|
import { viewports } from '@telus-uds/system-constants'
|
|
14
18
|
import styled from 'styled-components'
|
|
@@ -71,11 +75,89 @@ const Countdown = React.forwardRef(
|
|
|
71
75
|
if (noDivider && !label) {
|
|
72
76
|
throw new Error('`noDivider` variant can only be used with `label` enabled!')
|
|
73
77
|
}
|
|
74
|
-
|
|
78
|
+
|
|
79
|
+
const { themeOptions } = useTheme()
|
|
80
|
+
|
|
81
|
+
const { enableMediaQueryStyleSheet } = themeOptions
|
|
82
|
+
|
|
83
|
+
const useTokens = enableMediaQueryStyleSheet ? useResponsiveThemeTokens : useThemeTokens
|
|
84
|
+
const themeTokens = useTokens(
|
|
85
|
+
'Countdown',
|
|
86
|
+
tokens,
|
|
87
|
+
variant,
|
|
88
|
+
!enableMediaQueryStyleSheet && { viewport }
|
|
89
|
+
)
|
|
90
|
+
|
|
75
91
|
const segmentFontSize = themeTokens.textFontSize
|
|
76
92
|
const semanticGradient =
|
|
77
93
|
themeTokens.containerGradient && transformGradient(themeTokens.containerGradient)
|
|
78
94
|
const mainTextTokens = getMainTextTokens(themeTokens)
|
|
95
|
+
const labelTokens = getLabelTokens(themeTokens)
|
|
96
|
+
|
|
97
|
+
let labelStyles
|
|
98
|
+
let labelMediaIds
|
|
99
|
+
let mainTextStyles
|
|
100
|
+
let mainTextMediaIds
|
|
101
|
+
let containerStyles
|
|
102
|
+
let containerMediaIds
|
|
103
|
+
|
|
104
|
+
if (enableMediaQueryStyleSheet) {
|
|
105
|
+
const {
|
|
106
|
+
transformedLabelThemeTokens,
|
|
107
|
+
transformedMainTextThemeTokens,
|
|
108
|
+
transformedContainerThemeTokens
|
|
109
|
+
} = Object.entries(themeTokens).reduce(
|
|
110
|
+
(acc, [vp, viewportTokens]) => {
|
|
111
|
+
acc.transformedLabelThemeTokens[vp] = {
|
|
112
|
+
fontSize: viewportTokens.labelFontSize,
|
|
113
|
+
lineHeight: viewportTokens.labelLineHeight
|
|
114
|
+
}
|
|
115
|
+
acc.transformedMainTextThemeTokens[vp] = {
|
|
116
|
+
fontSize: viewportTokens.textFontSize,
|
|
117
|
+
lineHeight: viewportTokens.textLineHeight
|
|
118
|
+
}
|
|
119
|
+
acc.transformedContainerThemeTokens[vp] = {
|
|
120
|
+
containerPaddingBottomTop: viewportTokens.containerPaddingBottomTop,
|
|
121
|
+
containerPaddingLeftRight: viewportTokens.containerPaddingLeftRight
|
|
122
|
+
}
|
|
123
|
+
return acc
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
transformedLabelThemeTokens: {},
|
|
127
|
+
transformedMainTextThemeTokens: {},
|
|
128
|
+
transformedContainerThemeTokens: {}
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
const labelMediaQueryStyles = createMediaQueryStyles(transformedLabelThemeTokens)
|
|
133
|
+
const mainTestMediaQueryStyles = createMediaQueryStyles(transformedMainTextThemeTokens)
|
|
134
|
+
const containerMediaQueryStyles = createMediaQueryStyles(transformedContainerThemeTokens)
|
|
135
|
+
|
|
136
|
+
const { ids, styles } = StyleSheet.create({
|
|
137
|
+
label: {
|
|
138
|
+
...themeTokens[viewport],
|
|
139
|
+
...labelMediaQueryStyles
|
|
140
|
+
},
|
|
141
|
+
mainText: {
|
|
142
|
+
...themeTokens[viewport],
|
|
143
|
+
...mainTestMediaQueryStyles
|
|
144
|
+
},
|
|
145
|
+
container: {
|
|
146
|
+
...themeTokens[viewport],
|
|
147
|
+
...containerMediaQueryStyles
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
labelStyles = getLabelTokens(styles.label)
|
|
151
|
+
labelMediaIds = ids.label
|
|
152
|
+
mainTextStyles = getMainTextTokens(styles.mainText)
|
|
153
|
+
mainTextMediaIds = ids.mainText
|
|
154
|
+
containerStyles = styles.container
|
|
155
|
+
containerMediaIds = ids.container
|
|
156
|
+
} else {
|
|
157
|
+
labelStyles = labelTokens
|
|
158
|
+
mainTextStyles = mainTextTokens
|
|
159
|
+
containerStyles = themeTokens
|
|
160
|
+
}
|
|
79
161
|
|
|
80
162
|
const divider =
|
|
81
163
|
noDivider === true ? (
|
|
@@ -84,12 +166,13 @@ const Countdown = React.forwardRef(
|
|
|
84
166
|
) : (
|
|
85
167
|
<Typography tokens={mainTextTokens}>:</Typography>
|
|
86
168
|
)
|
|
87
|
-
const labelTokens = getLabelTokens(themeTokens)
|
|
88
169
|
|
|
89
170
|
const segmentProps = {
|
|
90
171
|
copy,
|
|
91
|
-
labelTokens,
|
|
92
|
-
numberTokens:
|
|
172
|
+
labelTokens: labelStyles,
|
|
173
|
+
numberTokens: mainTextStyles,
|
|
174
|
+
labelMediaIds,
|
|
175
|
+
mainTextMediaIds,
|
|
93
176
|
segmentFontSize,
|
|
94
177
|
variant
|
|
95
178
|
}
|
|
@@ -101,8 +184,9 @@ const Countdown = React.forwardRef(
|
|
|
101
184
|
variant={variant}
|
|
102
185
|
{...selectProps(rest)}
|
|
103
186
|
tabIndex={0}
|
|
104
|
-
themeTokens={
|
|
187
|
+
themeTokens={containerStyles}
|
|
105
188
|
gradient={semanticGradient}
|
|
189
|
+
media={containerMediaIds}
|
|
106
190
|
>
|
|
107
191
|
<StackView direction="row" space={1}>
|
|
108
192
|
<Segment
|
|
@@ -31,6 +31,8 @@ const Segment = React.forwardRef(
|
|
|
31
31
|
labelTokens,
|
|
32
32
|
number,
|
|
33
33
|
numberTokens,
|
|
34
|
+
labelMediaIds,
|
|
35
|
+
mainTextMediaIds,
|
|
34
36
|
segmentWidth = 2,
|
|
35
37
|
variant = {}
|
|
36
38
|
},
|
|
@@ -51,9 +53,11 @@ const Segment = React.forwardRef(
|
|
|
51
53
|
space={large || feature ? 0 : 1}
|
|
52
54
|
tokens={{ alignItems: 'center' }}
|
|
53
55
|
>
|
|
54
|
-
<Typography tokens={numberTokens}
|
|
56
|
+
<Typography tokens={numberTokens} media={mainTextMediaIds}>
|
|
57
|
+
{pad(number, segmentWidth)}
|
|
58
|
+
</Typography>
|
|
55
59
|
{label && (
|
|
56
|
-
<Typography tokens={labelTokens}>
|
|
60
|
+
<Typography tokens={labelTokens} media={labelMediaIds}>
|
|
57
61
|
{getCopy(number === 1 ? labelKey : `${labelKey}s`)}
|
|
58
62
|
</Typography>
|
|
59
63
|
)}
|
|
@@ -76,6 +80,8 @@ Segment.propTypes = {
|
|
|
76
80
|
number: PropTypes.number,
|
|
77
81
|
numberTokens: PropTypes.object,
|
|
78
82
|
segmentWidth: PropTypes.number,
|
|
83
|
+
labelMediaIds: PropTypes.string,
|
|
84
|
+
mainTextMediaIds: PropTypes.string,
|
|
79
85
|
variant: countdownVariantPropType
|
|
80
86
|
}
|
|
81
87
|
|