@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
package/CHANGELOG.md CHANGED
@@ -1,12 +1,41 @@
1
1
  # Change Log - @telus-uds/components-web
2
2
 
3
- <!-- This log was last generated on Sat, 23 Nov 2024 01:38:59 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Fri, 06 Dec 2024 02:03:26 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 3.2.0
8
+
9
+ Fri, 06 Dec 2024 02:03:26 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - `NavigationBar`: enable hash navigation (guillermo.peitzner@telus.com)
14
+ - `ChevronLink`, `Search` & `ResponsiveImage`: new `dataSet` prop added to the components to allow the capability to pass data (35577399+JoshHC@users.noreply.github.com)
15
+ - Bump @telus-uds/components-base to v2.2.0
16
+
17
+ ### Patches
18
+
19
+ - `QuantitySelector`: render hint when no label is provided (guillermo.peitzner@telus.com)
20
+
21
+ ## 3.1.0
22
+
23
+ Mon, 02 Dec 2024 20:29:26 GMT
24
+
25
+ ### Minor changes
26
+
27
+ - `Progress`: Added rules for `subtle` and `inverse` variants. Deprecated `inactive` and `negative` appearances and moved them to `style` appearances. Enabled `offset` object for controlling the position of the `ProgressBar` component. (jaime.tuyuc@telus.com)
28
+ - `Blockquote`: refactor to use media query stylesheet (Mauricio.BatresMontejo@telus.com)
29
+ - `CountDown`: refactor component to use media-query-stylesheet (Mauricio.BatresMontejo@telus.com)
30
+ - `ChevronLink`, `Search` & `ResponsiveImage`: new contentful props data-contentful-field-id and data-contentful-entry-id added to the components (35577399+JoshHC@users.noreply.github.com)
31
+ - `Modal`: update component to enable heading bottom border and content spacing (eduardo.pereira1@telus.com)
32
+ - `Video`: new tokens remainingTimestampMarginRight and remainingTimestampMarginLeft added to match with the visual design intention (35577399+JoshHC@users.noreply.github.com)
33
+ - Bump @telus-uds/components-base to v2.1.0
34
+ - Bump @telus-uds/system-theme-tokens to v3.1.0
35
+
7
36
  ## 3.0.1
8
37
 
9
- Sat, 23 Nov 2024 01:38:59 GMT
38
+ Sat, 23 Nov 2024 01:40:21 GMT
10
39
 
11
40
  ### Patches
12
41
 
File without changes
File without changes
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { Link, selectSystemProps, StackView, Typography, useThemeTokens, withLinkRouter, useViewport, getTokensPropType } from '@telus-uds/components-base';
3
+ import { Link, selectSystemProps, StackView, Typography, useTheme, useThemeTokens, useResponsiveThemeTokens, createMediaQueryStyles, withLinkRouter, useViewport, getTokensPropType, StyleSheet } from '@telus-uds/components-base';
4
4
  import styled from 'styled-components';
5
5
  import { htmlAttrs, transformGradient } from '../utils';
6
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -48,6 +48,12 @@ const QuoteContainer = /*#__PURE__*/styled.div.withConfig({
48
48
  } = _ref7;
49
49
  return `${marginBottom}px`;
50
50
  });
51
+ const selectTitleHeadingTokens = themeTokens => ({
52
+ fontSize: themeTokens.titleHeadingFontSize,
53
+ fontName: themeTokens.titleHeadingFontName,
54
+ fontWeight: themeTokens.titleHeadingFontWeight,
55
+ lineHeight: themeTokens.titleHeadingLineHeight
56
+ });
51
57
  const BlockQuote = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
52
58
  let {
53
59
  children,
@@ -62,6 +68,15 @@ const BlockQuote = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
62
68
  ...rest
63
69
  } = _ref8;
64
70
  const viewport = useViewport();
71
+ const {
72
+ themeOptions: {
73
+ enableMediaQueryStyleSheet
74
+ }
75
+ } = useTheme();
76
+ const useTokens = enableMediaQueryStyleSheet ? useResponsiveThemeTokens : useThemeTokens;
77
+ const themeTokens = useTokens('BlockQuote', tokens, variant, !enableMediaQueryStyleSheet && {
78
+ viewport
79
+ });
65
80
  const {
66
81
  color,
67
82
  paddingTop,
@@ -83,16 +98,46 @@ const BlockQuote = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
83
98
  linkFontName,
84
99
  linkFontWeight,
85
100
  linkLineHeight
86
- } = useThemeTokens('BlockQuote', tokens, variant, {
87
- viewport
88
- });
101
+ } = themeTokens;
102
+ let titleHeadingStyles;
103
+ let titleHeadingMediaIds;
104
+ if (enableMediaQueryStyleSheet) {
105
+ const {
106
+ transformedTitleHeadingThemeTokens
107
+ } = Object.entries(themeTokens).reduce((acc, _ref9) => {
108
+ let [vp, viewportTokens] = _ref9;
109
+ acc.transformedTitleHeadingThemeTokens[vp] = {
110
+ fontSize: viewportTokens.titleHeadingFontSize,
111
+ fontName: viewportTokens.titleHeadingFontName,
112
+ fontWeight: viewportTokens.titleHeadingFontWeight,
113
+ lineHeight: viewportTokens.titleHeadingLineHeight
114
+ };
115
+ return acc;
116
+ }, {
117
+ transformedTitleHeadingThemeTokens: {}
118
+ });
119
+ const titleHeadingMediaQueryStyles = createMediaQueryStyles(transformedTitleHeadingThemeTokens);
120
+ const {
121
+ ids,
122
+ styles
123
+ } = StyleSheet.create({
124
+ titleHeading: {
125
+ ...selectTitleHeadingTokens(themeTokens[viewport]),
126
+ ...titleHeadingMediaQueryStyles
127
+ }
128
+ });
129
+ titleHeadingStyles = styles.titleHeading;
130
+ titleHeadingMediaIds = ids.titleHeading;
131
+ } else {
132
+ titleHeadingStyles = {
133
+ fontSize: titleHeadingFontSize,
134
+ fontName: titleHeadingFontName,
135
+ fontWeight: titleHeadingFontWeight,
136
+ lineHeight: titleHeadingLineHeight
137
+ };
138
+ }
89
139
  const mappedTextSize = textStyle === 'heading' ? 'h3' : textStyle;
90
- const titleTokens = textStyle === 'heading' ? {
91
- fontSize: titleHeadingFontSize,
92
- fontName: titleHeadingFontName,
93
- fontWeight: titleHeadingFontWeight,
94
- lineHeight: titleHeadingLineHeight
95
- } : {
140
+ const titleTokens = textStyle === 'heading' ? titleHeadingStyles : {
96
141
  fontSize: titleFontSize,
97
142
  fontName: titleFontName,
98
143
  fontWeight: titleFontWeight,
@@ -134,6 +179,7 @@ const BlockQuote = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
134
179
  color,
135
180
  ...titleTokens
136
181
  },
182
+ media: titleHeadingMediaIds,
137
183
  variant: {
138
184
  size: mappedTextSize
139
185
  },
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/lib/Card/Card.js CHANGED
File without changes
File without changes
File without changes
package/lib/Card/index.js CHANGED
File without changes
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { Spacer, StackView, Typography, selectSystemProps, useViewport, useThemeTokens, applyTextStyles, getTokensPropType } from '@telus-uds/components-base';
3
+ import { Spacer, StackView, Typography, selectSystemProps, useViewport, useTheme, useThemeTokens, useResponsiveThemeTokens, createMediaQueryStyles, applyTextStyles, getTokensPropType, StyleSheet } from '@telus-uds/components-base';
4
4
  import { viewports } from '@telus-uds/system-constants';
5
5
  import styled from 'styled-components';
6
6
  // Reading these from the RN palette since they will be used to generate
@@ -87,12 +87,82 @@ const Countdown = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
87
87
  if (noDivider && !label) {
88
88
  throw new Error('`noDivider` variant can only be used with `label` enabled!');
89
89
  }
90
- const themeTokens = useThemeTokens('Countdown', tokens, variant, {
90
+ const {
91
+ themeOptions
92
+ } = useTheme();
93
+ const {
94
+ enableMediaQueryStyleSheet
95
+ } = themeOptions;
96
+ const useTokens = enableMediaQueryStyleSheet ? useResponsiveThemeTokens : useThemeTokens;
97
+ const themeTokens = useTokens('Countdown', tokens, variant, !enableMediaQueryStyleSheet && {
91
98
  viewport
92
99
  });
93
100
  const segmentFontSize = themeTokens.textFontSize;
94
101
  const semanticGradient = themeTokens.containerGradient && transformGradient(themeTokens.containerGradient);
95
102
  const mainTextTokens = getMainTextTokens(themeTokens);
103
+ const labelTokens = getLabelTokens(themeTokens);
104
+ let labelStyles;
105
+ let labelMediaIds;
106
+ let mainTextStyles;
107
+ let mainTextMediaIds;
108
+ let containerStyles;
109
+ let containerMediaIds;
110
+ if (enableMediaQueryStyleSheet) {
111
+ const {
112
+ transformedLabelThemeTokens,
113
+ transformedMainTextThemeTokens,
114
+ transformedContainerThemeTokens
115
+ } = Object.entries(themeTokens).reduce((acc, _ref4) => {
116
+ let [vp, viewportTokens] = _ref4;
117
+ acc.transformedLabelThemeTokens[vp] = {
118
+ fontSize: viewportTokens.labelFontSize,
119
+ lineHeight: viewportTokens.labelLineHeight
120
+ };
121
+ acc.transformedMainTextThemeTokens[vp] = {
122
+ fontSize: viewportTokens.textFontSize,
123
+ lineHeight: viewportTokens.textLineHeight
124
+ };
125
+ acc.transformedContainerThemeTokens[vp] = {
126
+ containerPaddingBottomTop: viewportTokens.containerPaddingBottomTop,
127
+ containerPaddingLeftRight: viewportTokens.containerPaddingLeftRight
128
+ };
129
+ return acc;
130
+ }, {
131
+ transformedLabelThemeTokens: {},
132
+ transformedMainTextThemeTokens: {},
133
+ transformedContainerThemeTokens: {}
134
+ });
135
+ const labelMediaQueryStyles = createMediaQueryStyles(transformedLabelThemeTokens);
136
+ const mainTestMediaQueryStyles = createMediaQueryStyles(transformedMainTextThemeTokens);
137
+ const containerMediaQueryStyles = createMediaQueryStyles(transformedContainerThemeTokens);
138
+ const {
139
+ ids,
140
+ styles
141
+ } = StyleSheet.create({
142
+ label: {
143
+ ...themeTokens[viewport],
144
+ ...labelMediaQueryStyles
145
+ },
146
+ mainText: {
147
+ ...themeTokens[viewport],
148
+ ...mainTestMediaQueryStyles
149
+ },
150
+ container: {
151
+ ...themeTokens[viewport],
152
+ ...containerMediaQueryStyles
153
+ }
154
+ });
155
+ labelStyles = getLabelTokens(styles.label);
156
+ labelMediaIds = ids.label;
157
+ mainTextStyles = getMainTextTokens(styles.mainText);
158
+ mainTextMediaIds = ids.mainText;
159
+ containerStyles = styles.container;
160
+ containerMediaIds = ids.container;
161
+ } else {
162
+ labelStyles = labelTokens;
163
+ mainTextStyles = mainTextTokens;
164
+ containerStyles = themeTokens;
165
+ }
96
166
  const divider = noDivider === true ?
97
167
  /*#__PURE__*/
98
168
  // StackView-based subcontainer adds a 1-step space on the each side of the divider
@@ -103,11 +173,12 @@ const Countdown = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
103
173
  tokens: mainTextTokens,
104
174
  children: ":"
105
175
  });
106
- const labelTokens = getLabelTokens(themeTokens);
107
176
  const segmentProps = {
108
177
  copy,
109
- labelTokens,
110
- numberTokens: mainTextTokens,
178
+ labelTokens: labelStyles,
179
+ numberTokens: mainTextStyles,
180
+ labelMediaIds,
181
+ mainTextMediaIds,
111
182
  segmentFontSize,
112
183
  variant
113
184
  };
@@ -119,8 +190,9 @@ const Countdown = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
119
190
  variant: variant,
120
191
  ...selectProps(rest),
121
192
  tabIndex: 0,
122
- themeTokens: themeTokens,
193
+ themeTokens: containerStyles,
123
194
  gradient: semanticGradient,
195
+ media: containerMediaIds,
124
196
  children: /*#__PURE__*/_jsxs(StackView, {
125
197
  direction: "row",
126
198
  space: 1,
@@ -45,6 +45,8 @@ const Segment = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
45
45
  labelTokens,
46
46
  number,
47
47
  numberTokens,
48
+ labelMediaIds,
49
+ mainTextMediaIds,
48
50
  segmentWidth = 2,
49
51
  variant = {}
50
52
  } = _ref2;
@@ -70,9 +72,11 @@ const Segment = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
70
72
  },
71
73
  children: [/*#__PURE__*/_jsx(Typography, {
72
74
  tokens: numberTokens,
75
+ media: mainTextMediaIds,
73
76
  children: pad(number, segmentWidth)
74
77
  }), label && /*#__PURE__*/_jsx(Typography, {
75
78
  tokens: labelTokens,
79
+ media: labelMediaIds,
76
80
  children: getCopy(number === 1 ? labelKey : `${labelKey}s`)
77
81
  })]
78
82
  })
@@ -90,6 +94,8 @@ Segment.propTypes = {
90
94
  number: PropTypes.number,
91
95
  numberTokens: PropTypes.object,
92
96
  segmentWidth: PropTypes.number,
97
+ labelMediaIds: PropTypes.string,
98
+ mainTextMediaIds: PropTypes.string,
93
99
  variant: countdownVariantPropType
94
100
  };
95
101
  export default Segment;
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
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/List/List.js CHANGED
File without changes
File without changes
package/lib/List/index.js CHANGED
File without changes
@@ -1,9 +1,9 @@
1
1
  var _withLinkRouter$propT, _withLinkRouter$propT2, _withLinkRouter$propT3, _withLinkRouter$propT4;
2
2
  import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import { selectSystemProps, StackView, Typography, useResponsiveProp, withLinkRouter } from '@telus-uds/components-base';
4
+ import { selectSystemProps, StackView, Typography, useHash, useInputValue, useResponsiveProp, withLinkRouter } from '@telus-uds/components-base';
5
5
  import styled from 'styled-components';
6
- import { htmlAttrs } from '../utils';
6
+ import { htmlAttrs, scrollToAnchor } from '../utils';
7
7
  import NavigationItem from './NavigationItem';
8
8
  import NavigationSubMenu from './NavigationSubMenu';
9
9
  import collapseItems from './collapseItems';
@@ -33,18 +33,56 @@ const NavigationBar = /*#__PURE__*/React.forwardRef((_ref, ref) => {
33
33
  heading,
34
34
  headingLevel = 'h1',
35
35
  items,
36
- onChange = () => {},
36
+ onChange,
37
37
  selectedId,
38
+ value,
38
39
  LinkRouter,
39
40
  linkRouterProps,
40
41
  ...rest
41
42
  } = _ref;
43
+ const {
44
+ currentValue,
45
+ setValue
46
+ } = useInputValue({
47
+ value,
48
+ initialValue: selectedId,
49
+ onChange
50
+ });
51
+ useHash((hash, event) => {
52
+ let hashItem = hash && items.find(_ref2 => {
53
+ let {
54
+ href
55
+ } = _ref2;
56
+ return hash === href;
57
+ });
58
+ if (!hashItem) {
59
+ const parentItem = items.find(_ref3 => {
60
+ let {
61
+ items: parentItems
62
+ } = _ref3;
63
+ return parentItems === null || parentItems === void 0 ? void 0 : parentItems.some(_ref4 => {
64
+ let {
65
+ href
66
+ } = _ref4;
67
+ return hash === href;
68
+ });
69
+ });
70
+ hashItem = parentItem === null || parentItem === void 0 ? void 0 : parentItem.items.find(_ref5 => {
71
+ let {
72
+ href
73
+ } = _ref5;
74
+ return hash === href;
75
+ });
76
+ }
77
+ const hashId = hashItem && (hashItem.id || hashItem.label);
78
+ if (hashId) setValue(hashId, event);
79
+ }, [items, setValue]);
42
80
  const direction = useResponsiveProp({
43
81
  xs: 'column',
44
82
  sm: 'row'
45
83
  });
46
84
  const itemsForViewport = useResponsiveProp({
47
- xs: collapseItems(items, selectedId),
85
+ xs: collapseItems(items, currentValue),
48
86
  lg: items
49
87
  });
50
88
  const openOverlayRef = React.useRef(null);
@@ -118,7 +156,7 @@ const NavigationBar = /*#__PURE__*/React.forwardRef((_ref, ref) => {
118
156
  heading: headingLevel,
119
157
  children: heading
120
158
  })
121
- }), itemsForViewport === null || itemsForViewport === void 0 ? void 0 : itemsForViewport.map((_ref2, index) => {
159
+ }), itemsForViewport === null || itemsForViewport === void 0 ? void 0 : itemsForViewport.map((_ref6, index) => {
122
160
  let {
123
161
  href,
124
162
  label,
@@ -129,38 +167,50 @@ const NavigationBar = /*#__PURE__*/React.forwardRef((_ref, ref) => {
129
167
  linkRouterProps: itemLinkRouterProps,
130
168
  items: nestedItems,
131
169
  ...itemRest
132
- } = _ref2;
170
+ } = _ref6;
133
171
  const itemId = id ?? label;
134
172
  const handleClick = event => {
135
173
  if (nestedItems) {
136
174
  setOpenSubMenuId(openSubMenuId !== itemId ? itemId : null);
175
+ return;
176
+ }
177
+ if (href !== null && href !== void 0 && href.startsWith('#')) {
178
+ scrollToAnchor(href, event, () => setValue(itemId, event));
179
+ } else {
180
+ setValue(itemId, event);
137
181
  }
138
182
  onClick === null || onClick === void 0 || onClick(event);
139
- onChange === null || onChange === void 0 || onChange(itemId, event);
140
183
  };
141
184
  const ItemComponent = nestedItems ? NavigationSubMenu : NavigationItem;
142
185
  const isOpen = itemId === openSubMenuId;
186
+ const scrollableNestedItems = (nestedItems === null || nestedItems === void 0 ? void 0 : nestedItems.map(item => ({
187
+ ...item,
188
+ onPress: event => {
189
+ const nestedItemId = item.id ?? item.label;
190
+ scrollToAnchor(item.href, event, () => setValue(nestedItemId, event));
191
+ }
192
+ }))) ?? nestedItems;
143
193
  return /*#__PURE__*/_jsx(ItemComponent, {
144
194
  ref: itemRef,
145
195
  href: href,
146
196
  onClick: handleClick
147
197
  // TODO: refactor to pass selected ID via context
148
198
  ,
149
- selectedId: selectedId,
199
+ selectedId: currentValue,
150
200
  index: index,
151
201
  LinkRouter: ItemLinkRouter,
152
202
  linkRouterProps: {
153
203
  ...linkRouterProps,
154
204
  ...itemLinkRouterProps
155
205
  },
156
- items: nestedItems,
157
- selected: itemId === selectedId,
206
+ items: scrollableNestedItems,
207
+ selected: itemId === currentValue,
158
208
  itemsContainerRef: itemsRef,
159
209
  ...itemRest,
160
- ...(nestedItems && {
210
+ ...(scrollableNestedItems && {
161
211
  isOpen
162
212
  }),
163
- ...(nestedItems && isOpen && {
213
+ ...(scrollableNestedItems && isOpen && {
164
214
  openOverlayRef
165
215
  }),
166
216
  children: label
@@ -177,7 +227,7 @@ NavigationBar.propTypes = {
177
227
  *
178
228
  * Each `item` object must contain:
179
229
  * - `heading` - user-facing text in the tab link
180
- * - `href` - the URL of the page linked to. Do not use hash links, for content within a page, use `Tabs`.
230
+ * - `href` - the URL of the page linked to.
181
231
  * - `id` - a stable, unique identifier of the page within the set. Not written into the HTML.
182
232
  */
183
233
  items: PropTypes.arrayOf(PropTypes.shape({
@@ -208,13 +258,17 @@ NavigationBar.propTypes = {
208
258
  */
209
259
  headingLevel: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6']),
210
260
  /**
211
- * Matches the `id` property of the item in `items` corresponding to the current page
261
+ * Initial selected item ID
212
262
  */
213
- selectedId: PropTypes.string.isRequired,
263
+ selectedId: PropTypes.string,
214
264
  /**
215
265
  * Optional function to be called on pressing a link
216
266
  */
217
267
  onChange: PropTypes.func,
268
+ /**
269
+ * Controlled value for selected item ID
270
+ */
271
+ value: PropTypes.string,
218
272
  /**
219
273
  * Accesibility role for stackview
220
274
  */
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
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
@@ -44,11 +44,13 @@ const Gradient = /*#__PURE__*/styled.div.attrs({
44
44
  * `gradient` is being used here to provide gradient filling.
45
45
  *
46
46
  */
47
+
47
48
  const ProgressBar = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
48
49
  let {
49
50
  percentage,
50
51
  tokens,
51
52
  variant,
53
+ offset,
52
54
  ...rest
53
55
  } = _ref2;
54
56
  const themeTokens = useThemeTokens('ProgressBar', tokens, variant);
@@ -58,6 +60,7 @@ const ProgressBar = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
58
60
  tokens: tokens,
59
61
  variant: variant,
60
62
  ref: ref,
63
+ offset: offset,
61
64
  ...selectedProps,
62
65
  children: themeTokens.gradient && /*#__PURE__*/_jsx(Gradient, {
63
66
  ...themeTokens
@@ -78,6 +81,13 @@ ProgressBar.propTypes = {
78
81
  /**
79
82
  * ProgressBar variant.
80
83
  */
81
- variant: variantProp.propType
84
+ variant: variantProp.propType,
85
+ /**
86
+ * Offset position.
87
+ */
88
+ offset: PropTypes.shape({
89
+ items: PropTypes.number,
90
+ current: PropTypes.number
91
+ })
82
92
  };
83
93
  export default ProgressBar;