@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.
Files changed (166) hide show
  1. package/CHANGELOG.md +31 -2
  2. package/lib/Badge/Badge.js +0 -0
  3. package/lib/Badge/index.js +0 -0
  4. package/lib/BlockQuote/BlockQuote.js +56 -10
  5. package/lib/BlockQuote/index.js +0 -0
  6. package/lib/Breadcrumbs/Breadcrumbs.js +0 -0
  7. package/lib/Breadcrumbs/Item/Item.js +0 -0
  8. package/lib/Breadcrumbs/index.js +0 -0
  9. package/lib/Callout/Callout.js +0 -0
  10. package/lib/Callout/index.js +0 -0
  11. package/lib/Card/Card.js +0 -0
  12. package/lib/Card/CardContent.js +0 -0
  13. package/lib/Card/CardFooter.js +0 -0
  14. package/lib/Card/index.js +0 -0
  15. package/lib/Countdown/Countdown.js +78 -6
  16. package/lib/Countdown/Segment.js +6 -0
  17. package/lib/Countdown/constants.js +0 -0
  18. package/lib/Countdown/dictionary.js +0 -0
  19. package/lib/Countdown/index.js +0 -0
  20. package/lib/Countdown/types.js +0 -0
  21. package/lib/Countdown/useCountdown.js +0 -0
  22. package/lib/DatePicker/CalendarContainer.js +0 -0
  23. package/lib/DatePicker/DatePicker.js +0 -0
  24. package/lib/DatePicker/dictionary.js +0 -0
  25. package/lib/DatePicker/index.js +0 -0
  26. package/lib/DatePicker/reactDatesCss.js +0 -0
  27. package/lib/Disclaimer/Disclaimer.js +0 -0
  28. package/lib/Disclaimer/index.js +0 -0
  29. package/lib/ExpandCollapseMini/ExpandCollapseMini.js +0 -0
  30. package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +0 -0
  31. package/lib/ExpandCollapseMini/index.js +0 -0
  32. package/lib/Footnote/Footnote.js +0 -0
  33. package/lib/Footnote/FootnoteLink.js +0 -0
  34. package/lib/Footnote/dictionary.js +0 -0
  35. package/lib/Footnote/index.js +0 -0
  36. package/lib/IconButton/IconButton.js +0 -0
  37. package/lib/IconButton/index.js +0 -0
  38. package/lib/Image/Image.js +0 -0
  39. package/lib/Image/index.js +0 -0
  40. package/lib/Image/server.js +0 -0
  41. package/lib/List/List.js +0 -0
  42. package/lib/List/ListItem.js +0 -0
  43. package/lib/List/index.js +0 -0
  44. package/lib/NavigationBar/NavigationBar.js +69 -15
  45. package/lib/NavigationBar/NavigationItem.js +0 -0
  46. package/lib/NavigationBar/NavigationSubMenu.js +0 -0
  47. package/lib/NavigationBar/collapseItems.js +0 -0
  48. package/lib/NavigationBar/index.js +0 -0
  49. package/lib/NavigationBar/resolveItemSelection.js +0 -0
  50. package/lib/OptimizeImage/OptimizeImage.js +0 -0
  51. package/lib/OptimizeImage/index.js +0 -0
  52. package/lib/OptimizeImage/utils/getFallbackUrl.js +0 -0
  53. package/lib/OptimizeImage/utils/getImageUrls.js +0 -0
  54. package/lib/OptimizeImage/utils/getOptimizedUrl.js +0 -0
  55. package/lib/OptimizeImage/utils/hasWebpSupport.js +0 -0
  56. package/lib/OptimizeImage/utils/index.js +0 -0
  57. package/lib/OptimizeImage/utils/isSvgUrl.js +0 -0
  58. package/lib/OrderedList/Item.js +0 -0
  59. package/lib/OrderedList/ItemBase.js +0 -0
  60. package/lib/OrderedList/OrderedList.js +0 -0
  61. package/lib/OrderedList/OrderedListBase.js +0 -0
  62. package/lib/OrderedList/constants.js +0 -0
  63. package/lib/OrderedList/index.js +0 -0
  64. package/lib/Paragraph/Paragraph.js +0 -0
  65. package/lib/Paragraph/index.js +0 -0
  66. package/lib/PreviewCard/AuthorDate.js +0 -0
  67. package/lib/PreviewCard/PreviewCard.js +0 -0
  68. package/lib/PreviewCard/index.js +0 -0
  69. package/lib/PriceLockup/PriceLockup.js +0 -0
  70. package/lib/PriceLockup/index.js +0 -0
  71. package/lib/PriceLockup/tokens.js +0 -0
  72. package/lib/Progress/ProgressBar.js +11 -1
  73. package/lib/Progress/index.js +0 -0
  74. package/lib/QuantitySelector/QuantitySelector.js +1 -1
  75. package/lib/QuantitySelector/SideButton.js +0 -0
  76. package/lib/QuantitySelector/dictionary.js +0 -0
  77. package/lib/QuantitySelector/index.js +0 -0
  78. package/lib/QuantitySelector/styles.js +0 -0
  79. package/lib/ResponsiveImage/ResponsiveImage.js +9 -3
  80. package/lib/ResponsiveImage/index.js +0 -0
  81. package/lib/Ribbon/Ribbon.js +0 -0
  82. package/lib/Ribbon/index.js +0 -0
  83. package/lib/SkeletonProvider/SkeletonImage.js +0 -0
  84. package/lib/SkeletonProvider/SkeletonProvider.js +0 -0
  85. package/lib/SkeletonProvider/SkeletonTypography.js +0 -0
  86. package/lib/SkeletonProvider/index.js +0 -0
  87. package/lib/Span/Span.js +0 -0
  88. package/lib/Span/index.js +0 -0
  89. package/lib/Spinner/Spinner.js +0 -0
  90. package/lib/Spinner/SpinnerContent.js +0 -0
  91. package/lib/Spinner/constants.js +0 -0
  92. package/lib/Spinner/index.js +0 -0
  93. package/lib/StoryCard/StoryCard.js +0 -0
  94. package/lib/StoryCard/index.js +0 -0
  95. package/lib/Table/Body.js +0 -0
  96. package/lib/Table/Cell.js +0 -0
  97. package/lib/Table/Header.js +0 -0
  98. package/lib/Table/Row.js +0 -0
  99. package/lib/Table/SubHeading.js +0 -0
  100. package/lib/Table/Table.js +0 -0
  101. package/lib/Table/index.js +0 -0
  102. package/lib/TermsAndConditions/ExpandCollapse.js +0 -0
  103. package/lib/TermsAndConditions/TermsAndConditions.js +0 -0
  104. package/lib/TermsAndConditions/dictionary.js +0 -0
  105. package/lib/TermsAndConditions/index.js +0 -0
  106. package/lib/Testimonial/Testimonial.js +0 -0
  107. package/lib/Testimonial/index.js +0 -0
  108. package/lib/Toast/Toast.js +0 -0
  109. package/lib/Toast/index.js +0 -0
  110. package/lib/Video/ControlBar/ControlBar.js +0 -0
  111. package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +0 -0
  112. package/lib/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +0 -0
  113. package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +3 -0
  114. package/lib/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +0 -0
  115. package/lib/Video/MiddleControlButton/MiddleControlButton.js +0 -0
  116. package/lib/Video/Video.js +0 -0
  117. package/lib/Video/index.js +0 -0
  118. package/lib/Video/videoText.js +0 -0
  119. package/lib/VideoPicker/VideoPicker.js +0 -0
  120. package/lib/VideoPicker/VideoPickerPlayer.js +0 -0
  121. package/lib/VideoPicker/VideoPickerThumbnail.js +0 -0
  122. package/lib/VideoPicker/VideoSlider.js +0 -0
  123. package/lib/VideoPicker/index.js +0 -0
  124. package/lib/VideoPicker/videoPropType.js +0 -0
  125. package/lib/WaffleGrid/WaffleGrid.js +0 -0
  126. package/lib/WaffleGrid/index.js +0 -0
  127. package/lib/WebVideo/WebVideo.js +0 -0
  128. package/lib/WebVideo/index.js +0 -0
  129. package/lib/WebVideo/utils/index.js +0 -0
  130. package/lib/baseExports.js +0 -0
  131. package/lib/index.js +0 -0
  132. package/lib/server.js +0 -0
  133. package/lib/shared/ConditionalWrapper/ConditionalWrapper.js +0 -0
  134. package/lib/shared/ConditionalWrapper/index.js +0 -0
  135. package/lib/shared/FullBleedContent/FullBleedContent.js +0 -0
  136. package/lib/shared/FullBleedContent/getFullBleedBorderRadius.js +0 -0
  137. package/lib/shared/FullBleedContent/index.js +0 -0
  138. package/lib/shared/FullBleedContent/useFullBleedContentProps.js +0 -0
  139. package/lib/shared/VideoSplash/SplashButton/SplashButton.js +0 -0
  140. package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +0 -0
  141. package/lib/shared/VideoSplash/VideoSplash.js +0 -0
  142. package/lib/shared/VideoSplash/helpers.js +0 -0
  143. package/lib/utils/index.js +3 -2
  144. package/lib/utils/isElementFocusable.js +0 -0
  145. package/lib/utils/logger.js +0 -0
  146. package/lib/utils/media.js +0 -0
  147. package/lib/utils/renderStructuredContent.js +0 -0
  148. package/lib/utils/scrollToAnchor.js +19 -0
  149. package/lib/utils/ssr.js +0 -0
  150. package/lib/utils/theming/get-theme-from-server.js +0 -0
  151. package/lib/utils/theming/with-client-theme.js +0 -0
  152. package/lib/utils/theming/with-server-theme.js +0 -0
  153. package/lib/utils/transforms.js +0 -0
  154. package/lib/utils/useOverlaidPosition.js +0 -0
  155. package/lib/utils/useTypographyTheme.js +0 -0
  156. package/package.json +3 -3
  157. package/src/BlockQuote/BlockQuote.jsx +73 -11
  158. package/src/Countdown/Countdown.jsx +90 -6
  159. package/src/Countdown/Segment.jsx +8 -2
  160. package/src/NavigationBar/NavigationBar.jsx +53 -12
  161. package/src/Progress/ProgressBar.jsx +11 -2
  162. package/src/QuantitySelector/QuantitySelector.jsx +1 -1
  163. package/src/ResponsiveImage/ResponsiveImage.jsx +12 -5
  164. package/src/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.jsx +5 -1
  165. package/src/utils/index.js +5 -2
  166. package/src/utils/scrollToAnchor.js +18 -0
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
File without changes
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/lib/Table/Body.js CHANGED
File without changes
package/lib/Table/Cell.js CHANGED
File without changes
File without changes
package/lib/Table/Row.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
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
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
File without changes
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
@@ -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
- export { deprecate, htmlAttrs, transformGradient, useTypographyTheme, warn, media, renderStructuredContent, ssrStyles, isElementFocusable, useOverlaidPosition };
10
+ import scrollToAnchor from './scrollToAnchor';
11
+ export { deprecate, htmlAttrs, contentfulProps, transformGradient, useTypographyTheme, warn, media, renderStructuredContent, ssrStyles, isElementFocusable, useOverlaidPosition, scrollToAnchor };
File without changes
File without changes
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
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.2",
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.0.0",
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.1"
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
- } = useThemeTokens('BlockQuote', tokens, variant, {
80
- viewport
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 tokens={{ color, ...titleTokens }} variant={{ size: mappedTextSize }}>
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
- const themeTokens = useThemeTokens('Countdown', tokens, variant, { viewport })
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: mainTextTokens,
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={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}>{pad(number, segmentWidth)}</Typography>
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