@telus-uds/components-web 3.0.0 → 3.1.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 +26 -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 +0 -0
- 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 +0 -0
- 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 +2 -2
- 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 +2 -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/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/Progress/ProgressBar.jsx +11 -2
- package/src/ResponsiveImage/ResponsiveImage.jsx +2 -2
- package/src/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.jsx +5 -1
- package/src/utils/index.js +2 -1
|
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,4 @@ import ssrStyles from './ssr';
|
|
|
7
7
|
import isElementFocusable from './isElementFocusable';
|
|
8
8
|
import renderStructuredContent from './renderStructuredContent';
|
|
9
9
|
import useOverlaidPosition from './useOverlaidPosition';
|
|
10
|
-
export { deprecate, htmlAttrs, transformGradient, useTypographyTheme, warn, media, renderStructuredContent, ssrStyles, isElementFocusable, useOverlaidPosition };
|
|
10
|
+
export { deprecate, htmlAttrs, contentfulProps, transformGradient, useTypographyTheme, warn, media, renderStructuredContent, ssrStyles, isElementFocusable, useOverlaidPosition };
|
|
File without changes
|
package/lib/utils/logger.js
CHANGED
|
File without changes
|
package/lib/utils/media.js
CHANGED
|
File without changes
|
|
File without changes
|
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": "1.
|
|
9
|
+
"@telus-uds/components-base": "^2.1.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.
|
|
84
|
+
"version": "3.1.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
|
|
|
@@ -37,7 +37,8 @@ const Gradient = styled.div.attrs({ 'data-testid': 'ProgressBar-Gradient' })(
|
|
|
37
37
|
* `gradient` is being used here to provide gradient filling.
|
|
38
38
|
*
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
const ProgressBar = React.forwardRef(({ percentage, tokens, variant, offset, ...rest }, ref) => {
|
|
41
42
|
const themeTokens = useThemeTokens('ProgressBar', tokens, variant)
|
|
42
43
|
const selectedProps = selectProps(rest)
|
|
43
44
|
|
|
@@ -47,6 +48,7 @@ const ProgressBar = React.forwardRef(({ percentage, tokens, variant, ...rest },
|
|
|
47
48
|
tokens={tokens}
|
|
48
49
|
variant={variant}
|
|
49
50
|
ref={ref}
|
|
51
|
+
offset={offset}
|
|
50
52
|
{...selectedProps}
|
|
51
53
|
>
|
|
52
54
|
{themeTokens.gradient && <Gradient {...themeTokens} />}
|
|
@@ -69,7 +71,14 @@ ProgressBar.propTypes = {
|
|
|
69
71
|
/**
|
|
70
72
|
* ProgressBar variant.
|
|
71
73
|
*/
|
|
72
|
-
variant: variantProp.propType
|
|
74
|
+
variant: variantProp.propType,
|
|
75
|
+
/**
|
|
76
|
+
* Offset position.
|
|
77
|
+
*/
|
|
78
|
+
offset: PropTypes.shape({
|
|
79
|
+
items: PropTypes.number,
|
|
80
|
+
current: PropTypes.number
|
|
81
|
+
})
|
|
73
82
|
}
|
|
74
83
|
|
|
75
84
|
export default ProgressBar
|
|
@@ -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
|
|
|
7
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
7
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs, contentfulProps])
|
|
8
8
|
|
|
9
9
|
const staticStyles = {
|
|
10
10
|
image: { display: 'block', width: '100%' }
|
|
@@ -119,6 +119,8 @@ const VideoProgressBar = ({
|
|
|
119
119
|
thumbBackground,
|
|
120
120
|
timestampMarginLeft,
|
|
121
121
|
timestampMarginRight,
|
|
122
|
+
remainingTimestampMarginLeft,
|
|
123
|
+
remainingTimestampMarginRight,
|
|
122
124
|
trackGradientStart,
|
|
123
125
|
trackGradientEnd,
|
|
124
126
|
rangeBackground
|
|
@@ -166,7 +168,9 @@ const VideoProgressBar = ({
|
|
|
166
168
|
tabIndex="-1"
|
|
167
169
|
{...sharedProps}
|
|
168
170
|
/>
|
|
169
|
-
<StyledTimestamp
|
|
171
|
+
<StyledTimestamp
|
|
172
|
+
margin={`0 ${remainingTimestampMarginRight}px 0 ${remainingTimestampMarginLeft}px`}
|
|
173
|
+
>
|
|
170
174
|
<Typography variant={{ inverse: true }}>{remainingTimestamp}</Typography>
|
|
171
175
|
</StyledTimestamp>
|
|
172
176
|
</ProgressBarContainer>
|
package/src/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'
|
|
@@ -11,6 +11,7 @@ import useOverlaidPosition from './useOverlaidPosition'
|
|
|
11
11
|
export {
|
|
12
12
|
deprecate,
|
|
13
13
|
htmlAttrs,
|
|
14
|
+
contentfulProps,
|
|
14
15
|
transformGradient,
|
|
15
16
|
useTypographyTheme,
|
|
16
17
|
warn,
|