@telus-uds/components-web 3.1.0 → 3.2.1

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 (122) hide show
  1. package/CHANGELOG.md +28 -2
  2. package/lib/Badge/Badge.js +19 -11
  3. package/lib/BlockQuote/BlockQuote.js +31 -17
  4. package/lib/Breadcrumbs/Breadcrumbs.js +23 -17
  5. package/lib/Breadcrumbs/Item/Item.js +6 -10
  6. package/lib/Callout/Callout.js +5 -6
  7. package/lib/Card/Card.js +5 -5
  8. package/lib/Card/CardContent.js +5 -6
  9. package/lib/Card/CardFooter.js +5 -6
  10. package/lib/Countdown/Countdown.js +5 -6
  11. package/lib/Countdown/Segment.js +6 -6
  12. package/lib/DatePicker/CalendarContainer.js +5 -5
  13. package/lib/DatePicker/DatePicker.js +12 -18
  14. package/lib/DatePicker/reactDatesCss.js +829 -2
  15. package/lib/Disclaimer/Disclaimer.js +5 -6
  16. package/lib/Footnote/Footnote.js +15 -39
  17. package/lib/Footnote/FootnoteLink.js +5 -6
  18. package/lib/NavigationBar/NavigationBar.js +73 -20
  19. package/lib/NavigationBar/NavigationItem.js +5 -6
  20. package/lib/OrderedList/Item.js +7 -11
  21. package/lib/OrderedList/ItemBase.js +5 -5
  22. package/lib/OrderedList/OrderedList.js +5 -6
  23. package/lib/OrderedList/OrderedListBase.js +5 -5
  24. package/lib/Paragraph/Paragraph.js +16 -8
  25. package/lib/PreviewCard/PreviewCard.js +7 -10
  26. package/lib/PriceLockup/PriceLockup.js +64 -54
  27. package/lib/Progress/ProgressBar.js +6 -6
  28. package/lib/QuantitySelector/QuantitySelector.js +1 -1
  29. package/lib/QuantitySelector/styles.js +18 -9
  30. package/lib/ResponsiveImage/ResponsiveImage.js +7 -1
  31. package/lib/Ribbon/Ribbon.js +57 -31
  32. package/lib/Span/Span.js +6 -7
  33. package/lib/Spinner/Spinner.js +8 -18
  34. package/lib/Spinner/SpinnerContent.js +5 -6
  35. package/lib/StoryCard/StoryCard.js +7 -10
  36. package/lib/Table/Cell.js +43 -12
  37. package/lib/Table/Table.js +15 -11
  38. package/lib/TermsAndConditions/ExpandCollapse.js +7 -13
  39. package/lib/TermsAndConditions/TermsAndConditions.js +9 -22
  40. package/lib/Testimonial/Testimonial.js +10 -26
  41. package/lib/Toast/Toast.js +64 -13
  42. package/lib/Video/ControlBar/ControlBar.js +8 -18
  43. package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +5 -6
  44. package/lib/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +7 -14
  45. package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +7 -14
  46. package/lib/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +6 -10
  47. package/lib/Video/MiddleControlButton/MiddleControlButton.js +5 -6
  48. package/lib/Video/Video.js +10 -26
  49. package/lib/VideoPicker/VideoPicker.js +44 -20
  50. package/lib/VideoPicker/VideoPickerThumbnail.js +52 -18
  51. package/lib/WaffleGrid/WaffleGrid.js +7 -14
  52. package/lib/WebVideo/WebVideo.js +9 -14
  53. package/lib/index.js +1 -1
  54. package/lib/shared/FullBleedContent/FullBleedContent.js +5 -5
  55. package/lib/shared/VideoSplash/SplashButton/SplashButton.js +6 -9
  56. package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +8 -17
  57. package/lib/shared/VideoSplash/VideoSplash.js +5 -6
  58. package/lib/utils/index.js +3 -1
  59. package/lib/utils/scrollToAnchor.js +19 -0
  60. package/lib/utils/ssr.js +4 -1
  61. package/lib/utils/theming/styled-components.js +26 -0
  62. package/package.json +3 -3
  63. package/src/Badge/Badge.jsx +3 -2
  64. package/src/BlockQuote/BlockQuote.jsx +3 -2
  65. package/src/Breadcrumbs/Breadcrumbs.jsx +23 -13
  66. package/src/Breadcrumbs/Item/Item.jsx +3 -2
  67. package/src/Callout/Callout.jsx +3 -2
  68. package/src/Card/Card.jsx +3 -1
  69. package/src/Card/CardContent.jsx +3 -2
  70. package/src/Card/CardFooter.jsx +3 -2
  71. package/src/Countdown/Countdown.jsx +3 -2
  72. package/src/Countdown/Segment.jsx +3 -1
  73. package/src/DatePicker/CalendarContainer.jsx +3 -1
  74. package/src/DatePicker/DatePicker.jsx +3 -2
  75. package/src/DatePicker/reactDatesCss.js +3 -1
  76. package/src/Disclaimer/Disclaimer.jsx +3 -2
  77. package/src/Footnote/Footnote.jsx +9 -2
  78. package/src/Footnote/FootnoteLink.jsx +3 -2
  79. package/src/NavigationBar/NavigationBar.jsx +55 -13
  80. package/src/NavigationBar/NavigationItem.jsx +3 -2
  81. package/src/OrderedList/Item.jsx +4 -3
  82. package/src/OrderedList/ItemBase.jsx +3 -1
  83. package/src/OrderedList/OrderedList.jsx +3 -2
  84. package/src/OrderedList/OrderedListBase.jsx +3 -1
  85. package/src/Paragraph/Paragraph.jsx +3 -2
  86. package/src/PreviewCard/PreviewCard.jsx +3 -1
  87. package/src/PriceLockup/PriceLockup.jsx +3 -2
  88. package/src/Progress/ProgressBar.jsx +3 -1
  89. package/src/QuantitySelector/QuantitySelector.jsx +1 -1
  90. package/src/QuantitySelector/styles.js +3 -1
  91. package/src/ResponsiveImage/ResponsiveImage.jsx +10 -3
  92. package/src/Ribbon/Ribbon.jsx +3 -2
  93. package/src/Span/Span.jsx +3 -2
  94. package/src/Spinner/Spinner.jsx +3 -2
  95. package/src/Spinner/SpinnerContent.jsx +3 -2
  96. package/src/StoryCard/StoryCard.jsx +3 -1
  97. package/src/Table/Cell.jsx +3 -1
  98. package/src/Table/Table.jsx +3 -2
  99. package/src/TermsAndConditions/ExpandCollapse.jsx +3 -1
  100. package/src/TermsAndConditions/TermsAndConditions.jsx +3 -2
  101. package/src/Testimonial/Testimonial.jsx +3 -2
  102. package/src/Toast/Toast.jsx +3 -2
  103. package/src/Video/ControlBar/ControlBar.jsx +3 -3
  104. package/src/Video/ControlBar/Controls/VideoButton/VideoButton.jsx +4 -3
  105. package/src/Video/ControlBar/Controls/VideoMenu/VideoMenu.jsx +3 -3
  106. package/src/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.jsx +3 -3
  107. package/src/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.jsx +3 -3
  108. package/src/Video/MiddleControlButton/MiddleControlButton.jsx +4 -3
  109. package/src/Video/Video.jsx +3 -2
  110. package/src/VideoPicker/VideoPicker.jsx +3 -2
  111. package/src/VideoPicker/VideoPickerThumbnail.jsx +3 -1
  112. package/src/WaffleGrid/WaffleGrid.jsx +3 -2
  113. package/src/WebVideo/WebVideo.jsx +4 -3
  114. package/src/index.js +1 -1
  115. package/src/shared/FullBleedContent/FullBleedContent.jsx +3 -2
  116. package/src/shared/VideoSplash/SplashButton/SplashButton.jsx +3 -1
  117. package/src/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.jsx +4 -2
  118. package/src/shared/VideoSplash/VideoSplash.jsx +3 -2
  119. package/src/utils/index.js +5 -1
  120. package/src/utils/scrollToAnchor.js +18 -0
  121. package/src/utils/ssr.js +2 -1
  122. package/src/utils/theming/styled-components.js +23 -0
@@ -2,13 +2,16 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { viewports } from '@telus-uds/system-constants';
4
4
  import { selectSystemProps, StackView, useThemeTokens, useViewport, getTokensPropType } from '@telus-uds/components-base';
5
- import styled, { css } from 'styled-components';
6
5
  import { VideoPropType } from './videoPropType';
7
6
  import VideoPickerThumbnail from './VideoPickerThumbnail';
8
7
  import VideoPickerPlayer from './VideoPickerPlayer';
9
8
  import VideoSlider from './VideoSlider';
10
- import { htmlAttrs } from '../utils';
9
+ import { htmlAttrs, styledComponents } from '../utils';
11
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ const {
12
+ styled,
13
+ css
14
+ } = styledComponents;
12
15
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
13
16
  const framedContainerStyles = _ref => {
14
17
  let {
@@ -18,45 +21,66 @@ const framedContainerStyles = _ref => {
18
21
  framedContainerBorderRadius,
19
22
  framedMaxHeight
20
23
  } = _ref;
21
- return css(["background-color:", ";border:", "px solid ", ";border-radius:", "px;& > div{max-height:", "px;}"], framedContainerBackgroundColor, framedContainerBorderWidth, framedContainerBorderColor, framedContainerBorderRadius, framedMaxHeight);
24
+ return css`
25
+ background-color: ${framedContainerBackgroundColor};
26
+ border: ${framedContainerBorderWidth}px solid ${framedContainerBorderColor};
27
+ border-radius: ${framedContainerBorderRadius}px;
28
+
29
+ & > div {
30
+ max-height: ${framedMaxHeight}px;
31
+ }
32
+ `;
22
33
  };
23
- const VideoPickerContainer = /*#__PURE__*/styled.div.withConfig({
24
- displayName: "VideoPicker__VideoPickerContainer",
25
- componentId: "components-web__sc-x6lxp0-0"
26
- })(["", ""], _ref2 => {
34
+ const VideoPickerContainer = styled.div`
35
+ ${_ref2 => {
27
36
  let {
28
37
  isFramed,
29
38
  ...tokens
30
39
  } = _ref2;
31
40
  return isFramed && framedContainerStyles(tokens);
32
- });
41
+ }}
42
+ `;
33
43
  const framedPlayerContainerStyles = _ref3 => {
34
44
  let {
35
45
  framedMaxHeight,
36
46
  framedContainerPadding
37
47
  } = _ref3;
38
- return css(["width:66.67%;padding:", "px;max-height:", "px;flex-shrink:0;box-sizing:border-box;"], framedContainerPadding, framedMaxHeight);
48
+ return css`
49
+ width: 66.67%;
50
+ padding: ${framedContainerPadding}px;
51
+ max-height: ${framedMaxHeight}px;
52
+ flex-shrink: 0;
53
+ box-sizing: border-box;
54
+ `;
39
55
  };
40
- const VideoPlayerContainer = /*#__PURE__*/styled.div.withConfig({
41
- displayName: "VideoPicker__VideoPlayerContainer",
42
- componentId: "components-web__sc-x6lxp0-1"
43
- })(["", " overflow:auto;"], _ref4 => {
56
+ const VideoPlayerContainer = styled.div`
57
+ ${_ref4 => {
44
58
  let {
45
59
  isFramed,
46
60
  ...tokens
47
61
  } = _ref4;
48
62
  return isFramed && framedPlayerContainerStyles(tokens);
49
- });
50
- const framedVideoListContainerStyle = /*#__PURE__*/css(["max-height:", "px;overflow:auto;flex-direction:column;"], _ref5 => {
63
+ }}
64
+ overflow: auto;
65
+ `;
66
+ const framedVideoListContainerStyle = css`
67
+ max-height: ${_ref5 => {
51
68
  let {
52
69
  framedMaxHeight
53
70
  } = _ref5;
54
71
  return framedMaxHeight;
55
- });
56
- const VideoListContainer = /*#__PURE__*/styled.div.withConfig({
57
- displayName: "VideoPicker__VideoListContainer",
58
- componentId: "components-web__sc-x6lxp0-2"
59
- })(["display:flex;justify-content:flex-start;position:relative;flex-grow:1;flex-direction:column;", ""], props => props.isFramed && framedVideoListContainerStyle);
72
+ }}px;
73
+ overflow: auto;
74
+ flex-direction: column;
75
+ `;
76
+ const VideoListContainer = styled.div`
77
+ display: flex;
78
+ justify-content: flex-start;
79
+ position: relative;
80
+ flex-grow: 1;
81
+ flex-direction: column;
82
+ ${props => props.isFramed && framedVideoListContainerStyle}
83
+ `;
60
84
  const VideoPicker = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
61
85
  var _videoList$;
62
86
  let {
@@ -3,12 +3,15 @@ import Pressable from "react-native-web/dist/exports/Pressable";
3
3
  import StyleSheet from "react-native-web/dist/exports/StyleSheet";
4
4
  import PropTypes from 'prop-types';
5
5
  import { viewports } from '@telus-uds/system-constants';
6
- import styled from 'styled-components';
7
6
  import { StackView, Typography, useViewport, horizontalScrollUtils, useThemeTokensCallback } from '@telus-uds/components-base';
7
+ import { styledComponents } from '../utils';
8
8
  import { getTimestamp } from '../shared/VideoSplash/helpers';
9
9
  import { VideoPropType, RefPropType } from './videoPropType';
10
10
  import VideoSplash from '../shared/VideoSplash/VideoSplash';
11
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ const {
13
+ styled
14
+ } = styledComponents;
12
15
  const {
13
16
  getItemPositionLayoutHandler,
14
17
  itemPositionsPropType
@@ -41,43 +44,74 @@ const createReactNativeStyles = _ref => {
41
44
  }
42
45
  });
43
46
  };
44
- const ImageContainer = /*#__PURE__*/styled.div.withConfig({
45
- displayName: "VideoPickerThumbnail__ImageContainer",
46
- componentId: "components-web__sc-1glxurq-0"
47
- })(["padding:", ";border:", ";border-radius:", "px;"], props => `${props.outerBorderGap}px`, props => `${props.outerBorderWidth}px solid ${props.outerBorderColor}`, _ref2 => {
47
+ const ImageContainer = styled.div`
48
+ padding: ${props => `${props.outerBorderGap}px`};
49
+ border: ${props => `${props.outerBorderWidth}px solid ${props.outerBorderColor}`};
50
+ border-radius: ${_ref2 => {
48
51
  let {
49
52
  outerBorderRadius
50
53
  } = _ref2;
51
54
  return outerBorderRadius;
52
- });
53
- const VideoThumbnail = /*#__PURE__*/styled.div.withConfig({
54
- displayName: "VideoPickerThumbnail__VideoThumbnail",
55
- componentId: "components-web__sc-1glxurq-1"
56
- })(["position:relative;width:", ";flex-shrink:0;* button{display:none;}&::before{content:'';display:block;padding-bottom:56.25%;}&::after{content:'';border:", "px solid;border-color:", ";border-radius:", "px;position:absolute;top:0;left:0;right:0;bottom:0;}& > div{border-radius:", "px;}"], props => props.layout === 'vertical' ? '100%' : '144px', _ref3 => {
55
+ }}px;
56
+ `;
57
+ const VideoThumbnail = styled.div`
58
+ position: relative;
59
+ width: ${props => props.layout === 'vertical' ? '100%' : '144px'};
60
+ flex-shrink: 0;
61
+
62
+ * button {
63
+ display: none;
64
+ }
65
+
66
+ // use a pseudo-element to ensure aspect ratio
67
+ &::before {
68
+ content: '';
69
+ display: block;
70
+ padding-bottom: 56.25%;
71
+ }
72
+
73
+ &::after {
74
+ content: '';
75
+ border: ${_ref3 => {
57
76
  let {
58
77
  borderWidth
59
78
  } = _ref3;
60
79
  return borderWidth;
61
- }, _ref4 => {
80
+ }}px solid;
81
+ border-color: ${_ref4 => {
62
82
  let {
63
83
  borderColor
64
84
  } = _ref4;
65
85
  return borderColor;
66
- }, _ref5 => {
86
+ }};
87
+ border-radius: ${_ref5 => {
67
88
  let {
68
89
  borderRadius
69
90
  } = _ref5;
70
91
  return borderRadius;
71
- }, _ref6 => {
92
+ }}px;
93
+ position: absolute;
94
+ top: 0;
95
+ left: 0;
96
+ right: 0;
97
+ bottom: 0;
98
+ }
99
+
100
+ & > div {
101
+ border-radius: ${_ref6 => {
72
102
  let {
73
103
  borderRadius
74
104
  } = _ref6;
75
105
  return borderRadius;
76
- });
77
- const ThumbnailTitleContainer = /*#__PURE__*/styled.div.withConfig({
78
- displayName: "VideoPickerThumbnail__ThumbnailTitleContainer",
79
- componentId: "components-web__sc-1glxurq-2"
80
- })(["display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;"]);
106
+ }}px;
107
+ }
108
+ `;
109
+ const ThumbnailTitleContainer = styled.div`
110
+ display: -webkit-box;
111
+ -webkit-line-clamp: 2;
112
+ -webkit-box-orient: vertical;
113
+ overflow: hidden;
114
+ `;
81
115
  const VideoPickerThumbnail = /*#__PURE__*/React.forwardRef((_ref7, ref) => {
82
116
  let {
83
117
  videoPlayerRef,
@@ -1,12 +1,14 @@
1
1
  import React, { createElement as _createElement } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import styled from 'styled-components';
4
3
  import { Link, responsiveProps, selectSystemProps, useResponsiveProp, useThemeTokens, withLinkRouter, useViewport, Typography, getTokensPropType } from '@telus-uds/components-base';
5
4
  import OrderedListBase from '../OrderedList/OrderedListBase';
6
5
  import ItemBase from '../OrderedList/ItemBase';
7
6
  import Image from '../Image';
8
- import { htmlAttrs } from '../utils';
7
+ import { htmlAttrs, styledComponents } from '../utils';
9
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ const {
10
+ styled
11
+ } = styledComponents;
10
12
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
11
13
  const row = (rowSize, rowBorderWidth) => ({
12
14
  flexBasis: `calc(100% / ${rowSize})`,
@@ -17,19 +19,13 @@ const row = (rowSize, rowBorderWidth) => ({
17
19
  borderTopWidth: `${rowBorderWidth}px`
18
20
  }
19
21
  });
20
- const Container = /*#__PURE__*/styled(OrderedListBase).withConfig({
21
- displayName: "WaffleGrid__Container",
22
- componentId: "components-web__sc-ec8g0a-0"
23
- })({
22
+ const Container = styled(OrderedListBase)({
24
23
  display: 'flex',
25
24
  flexDirection: 'row',
26
25
  flexWrap: 'wrap',
27
26
  justifyContent: 'flex-start'
28
27
  });
29
- const Item = /*#__PURE__*/styled(ItemBase).withConfig({
30
- displayName: "WaffleGrid__Item",
31
- componentId: "components-web__sc-ec8g0a-1"
32
- })(_ref => {
28
+ const Item = styled(ItemBase)(_ref => {
33
29
  let {
34
30
  rowSize,
35
31
  itemPadding,
@@ -54,10 +50,7 @@ const Item = /*#__PURE__*/styled(ItemBase).withConfig({
54
50
  ...row(rowSize, rowBorderWidth)
55
51
  };
56
52
  });
57
- const Center = /*#__PURE__*/styled('div').withConfig({
58
- displayName: "WaffleGrid__Center",
59
- componentId: "components-web__sc-ec8g0a-2"
60
- })({
53
+ const Center = styled('div')({
61
54
  display: 'flex',
62
55
  flexDirection: 'column',
63
56
  alignItems: 'center',
@@ -2,24 +2,22 @@ import { selectSystemProps } from '@telus-uds/components-base';
2
2
  import PropTypes from 'prop-types';
3
3
  import React from 'react';
4
4
  import YouTube from 'react-youtube';
5
- import styled from 'styled-components';
6
5
  import VideoSplash from '../shared/VideoSplash/VideoSplash';
7
- import { htmlAttrs } from '../utils';
6
+ import { htmlAttrs, styledComponents } from '../utils';
8
7
  import { triggerInProgressVideoIntervals, YoutubePlayerState } from './utils';
9
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
+ const {
10
+ styled
11
+ } = styledComponents;
10
12
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
11
- const StyledPlayerContainer = /*#__PURE__*/styled.div.withConfig({
12
- displayName: "WebVideo__StyledPlayerContainer",
13
- componentId: "components-web__sc-327a6k-0"
14
- })({
13
+ const StyledPlayerContainer = styled.div({
15
14
  width: '100%',
16
15
  minWidth: 288,
17
16
  outline: 'none'
18
17
  });
19
- const StyledYoutubePlayer = /*#__PURE__*/styled(YouTube).withConfig({
20
- displayName: "WebVideo__StyledYoutubePlayer",
21
- componentId: "components-web__sc-327a6k-1"
22
- })({
18
+ const StyledYoutubePlayer = styled(props => /*#__PURE__*/_jsx(YouTube, {
19
+ ...props
20
+ }))({
23
21
  position: 'absolute',
24
22
  top: 0,
25
23
  left: 0,
@@ -37,10 +35,7 @@ const aspectRatios = {
37
35
  paddingTop: '100%'
38
36
  }
39
37
  };
40
- const AspectLimiter = /*#__PURE__*/styled.div.withConfig({
41
- displayName: "WebVideo__AspectLimiter",
42
- componentId: "components-web__sc-327a6k-2"
43
- })(props => ({
38
+ const AspectLimiter = styled.div(props => ({
44
39
  ...aspectRatios[props.aspectRatio],
45
40
  position: 'relative'
46
41
  }));
package/lib/index.js CHANGED
@@ -36,5 +36,5 @@ export { default as TermsAndConditions } from './TermsAndConditions';
36
36
  export { default as NavigationBar } from './NavigationBar';
37
37
  export { default as Progress } from './Progress';
38
38
  export { default as SkeletonProvider } from './SkeletonProvider';
39
- export { ssrStyles } from './utils';
39
+ export { ssrStyles, styledComponents } from './utils';
40
40
  export * from './baseExports';
@@ -1,8 +1,11 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import styled from 'styled-components';
3
+ import { styledComponents } from '../../utils';
4
4
  import ResponsiveImage from '../../ResponsiveImage';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
+ const {
7
+ styled
8
+ } = styledComponents;
6
9
  const selectFullBleedContentProps = _ref => {
7
10
  let {
8
11
  alt,
@@ -31,10 +34,7 @@ const selectFullBleedContentProps = _ref => {
31
34
  xsSrc
32
35
  };
33
36
  };
34
- const FullBleedContentContainer = /*#__PURE__*/styled.div.withConfig({
35
- displayName: "FullBleedContent__FullBleedContentContainer",
36
- componentId: "components-web__sc-1130ea5-0"
37
- })(_ref2 => {
37
+ const FullBleedContentContainer = styled.div(_ref2 => {
38
38
  let {
39
39
  borderBottomLeftRadius,
40
40
  borderBottomRightRadius,
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import styled from 'styled-components';
4
3
  import { useThemeTokens } from '@telus-uds/components-base';
4
+ import { styledComponents } from '../../../utils';
5
5
  import { getAriaLabel, getTimestamp } from '../helpers';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
- const ButtonContainer = /*#__PURE__*/styled.button.withConfig({
8
- displayName: "SplashButton__ButtonContainer",
9
- componentId: "components-web__sc-1oe22fk-0"
10
- })({
7
+ const {
8
+ styled
9
+ } = styledComponents;
10
+ const ButtonContainer = styled.button({
11
11
  background: 'none',
12
12
  border: 0,
13
13
  padding: 0,
@@ -19,10 +19,7 @@ const ButtonContainer = /*#__PURE__*/styled.button.withConfig({
19
19
  alignItems: 'center',
20
20
  cursor: 'pointer'
21
21
  });
22
- const ButtonContent = /*#__PURE__*/styled.div.withConfig({
23
- displayName: "SplashButton__ButtonContent",
24
- componentId: "components-web__sc-1oe22fk-1"
25
- })({
22
+ const ButtonContent = styled.div({
26
23
  display: 'flex',
27
24
  justifyContent: 'center',
28
25
  alignItems: 'center',
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import styled from 'styled-components';
4
3
  import { Typography, useThemeTokens } from '@telus-uds/components-base';
4
+ import { styledComponents } from '../../../utils';
5
5
  import { getAriaLabel, getTimestamp } from '../helpers';
6
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
- const ButtonContainer = /*#__PURE__*/styled.button.withConfig({
8
- displayName: "SplashButtonWithDetails__ButtonContainer",
9
- componentId: "components-web__sc-1edwy9o-0"
10
- })({
7
+ const {
8
+ styled
9
+ } = styledComponents;
10
+ const ButtonContainer = styled.button({
11
11
  background: 'none',
12
12
  border: 0,
13
13
  position: 'absolute',
@@ -16,10 +16,7 @@ const ButtonContainer = /*#__PURE__*/styled.button.withConfig({
16
16
  padding: 0,
17
17
  cursor: 'pointer'
18
18
  });
19
- const ButtonContent = /*#__PURE__*/styled.div.withConfig({
20
- displayName: "SplashButtonWithDetails__ButtonContent",
21
- componentId: "components-web__sc-1edwy9o-1"
22
- })({
19
+ const ButtonContent = styled.div({
23
20
  background: _ref => {
24
21
  let {
25
22
  buttonBackground
@@ -82,10 +79,7 @@ const ButtonContent = /*#__PURE__*/styled.div.withConfig({
82
79
  }
83
80
  }
84
81
  });
85
- const PlayIconContainer = /*#__PURE__*/styled.div.withConfig({
86
- displayName: "SplashButtonWithDetails__PlayIconContainer",
87
- componentId: "components-web__sc-1edwy9o-2"
88
- })({
82
+ const PlayIconContainer = styled.div({
89
83
  display: 'flex',
90
84
  justifyContent: 'center',
91
85
  alignItems: 'center',
@@ -100,10 +94,7 @@ const PlayIconContainer = /*#__PURE__*/styled.div.withConfig({
100
94
  borderRadius: '100%',
101
95
  transition: 'background 0.2s ease-in-out'
102
96
  });
103
- const DetailsContainer = /*#__PURE__*/styled.div.withConfig({
104
- displayName: "SplashButtonWithDetails__DetailsContainer",
105
- componentId: "components-web__sc-1edwy9o-3"
106
- })({
97
+ const DetailsContainer = styled.div({
107
98
  display: 'flex',
108
99
  flexDirection: 'column',
109
100
  alignItems: 'flex-start',
@@ -1,18 +1,17 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import styled from 'styled-components';
4
3
  import { selectSystemProps, useViewport } from '@telus-uds/components-base';
5
4
  import { viewports } from '@telus-uds/system-constants';
6
5
  import SplashButton from './SplashButton/SplashButton';
7
6
  import SplashButtonWithDetails from './SplashButtonWithDetails/SplashButtonWithDetails';
8
7
  import videoText from '../../Video/videoText';
9
- import { htmlAttrs } from '../../utils';
8
+ import { htmlAttrs, styledComponents } from '../../utils';
10
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
+ const {
11
+ styled
12
+ } = styledComponents;
11
13
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
12
- const SplashBackground = /*#__PURE__*/styled.div.withConfig({
13
- displayName: "VideoSplash__SplashBackground",
14
- componentId: "components-web__sc-1ejxt6-0"
15
- })(_ref => {
14
+ const SplashBackground = styled.div(_ref => {
16
15
  let {
17
16
  videoPoster
18
17
  } = _ref;
@@ -7,4 +7,6 @@ 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, contentfulProps, transformGradient, useTypographyTheme, warn, media, renderStructuredContent, ssrStyles, isElementFocusable, useOverlaidPosition };
10
+ import scrollToAnchor from './scrollToAnchor';
11
+ import styledComponents from './theming/styled-components';
12
+ export { deprecate, htmlAttrs, contentfulProps, transformGradient, useTypographyTheme, warn, media, renderStructuredContent, ssrStyles, isElementFocusable, useOverlaidPosition, scrollToAnchor, styledComponents };
@@ -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
@@ -1,5 +1,5 @@
1
- import { ServerStyleSheet } from 'styled-components';
2
1
  import { ssrStyles as baseSsrStyles } from '@telus-uds/components-base';
2
+ import styledComponents from './theming/styled-components';
3
3
  /**
4
4
  * Returns object with `renderApp` and `getStyles` functions.
5
5
  * Weave these into your app's server-side render process:
@@ -23,6 +23,9 @@ const ssrStyles = function () {
23
23
  styleGetters = [],
24
24
  collectStyles = renderedApp => renderedApp
25
25
  } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
26
+ const {
27
+ ServerStyleSheet
28
+ } = styledComponents;
26
29
  const sheet = new ServerStyleSheet();
27
30
  const getStyledComponentsStyles = () => {
28
31
  const styles = sheet.getStyleElement();
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Currently, `styled` is only available as the default export in `styled-components`.
3
+ * In transpiled/CommonJS environments, that works as expected, but it breaks server-side ESM usage of `styled-components`.
4
+ *
5
+ * To make `styled-components` work server-side, instead of:
6
+ *
7
+ * import styled from 'styled-components';
8
+ *
9
+ * We must write:
10
+ *
11
+ * import styledWrapper from 'styled-components';
12
+ * const styled = styledWrapper.default;
13
+ *
14
+ * This approach is confusing and not a viable option for code that should run in both browser and server.
15
+ */
16
+
17
+ import _styled, { css, keyframes, createGlobalStyle, ServerStyleSheet } from 'styled-components';
18
+ const styled = typeof _styled === 'function' ? _styled : _styled.default;
19
+ const styledComponents = {
20
+ styled,
21
+ css,
22
+ keyframes,
23
+ createGlobalStyle,
24
+ ServerStyleSheet
25
+ };
26
+ export default styledComponents;
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.1.0",
9
+ "@telus-uds/components-base": "^2.3.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.1.0",
17
+ "@telus-uds/system-theme-tokens": "^3.2.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.1.0"
84
+ "version": "3.2.1"
85
85
  }
@@ -1,5 +1,4 @@
1
1
  import React from 'react'
2
- import styled from 'styled-components'
3
2
  import PropTypes from 'prop-types'
4
3
  import {
5
4
  selectSystemProps,
@@ -7,10 +6,12 @@ import {
7
6
  getTokensPropType,
8
7
  useThemeTokens
9
8
  } from '@telus-uds/components-base'
10
- import { htmlAttrs, transformGradient } from '../utils'
9
+ import { htmlAttrs, transformGradient, styledComponents } from '../utils'
11
10
 
12
11
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
13
12
 
13
+ const { styled } = styledComponents
14
+
14
15
  const BadgeContainer = styled.div`
15
16
  background: ${({ background }) => background};
16
17
  border: ${({ border }) => border};
@@ -14,11 +14,12 @@ import {
14
14
  getTokensPropType,
15
15
  StyleSheet
16
16
  } from '@telus-uds/components-base'
17
- import styled from 'styled-components'
18
- import { htmlAttrs, transformGradient } from '../utils'
17
+ import { htmlAttrs, transformGradient, styledComponents } from '../utils'
19
18
 
20
19
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
21
20
 
21
+ const { styled } = styledComponents
22
+
22
23
  const BlockQuoteContainer = styled.blockquote`
23
24
  margin: 0;
24
25
  position: relative;
@@ -1,6 +1,5 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
- import styled from 'styled-components'
4
3
 
5
4
  import { Helmet, HelmetProvider } from 'react-helmet-async'
6
5
  import { isEqual } from 'lodash'
@@ -14,11 +13,13 @@ import {
14
13
  useThemeTokens,
15
14
  useViewport
16
15
  } from '@telus-uds/components-base'
17
- import { htmlAttrs } from '../utils'
16
+ import { htmlAttrs, styledComponents } from '../utils'
18
17
  import Item from './Item/Item'
19
18
 
20
19
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
21
20
 
21
+ const { styled } = styledComponents
22
+
22
23
  const StyledList = styled.ol({
23
24
  display: 'flex',
24
25
  flexDirection: 'row',
@@ -149,15 +150,9 @@ const Breadcrumbs = React.forwardRef(
149
150
 
150
151
  const viewport = useViewport()
151
152
 
152
- React.useEffect(() => {
153
- if (optionsHidden) {
154
- if (viewport !== 'xs' && !isEqual(itemsToBeRendered, activeRoutes)) {
155
- setItemsToBeRendered(activeRoutes)
156
- }
157
- return
158
- }
153
+ const newItems = React.useMemo(() => {
159
154
  if (viewport === 'xs' && activeRoutes.length >= MAX_ITEMS_ON_XS_VIEWPORT) {
160
- const newItems = [
155
+ return [
161
156
  ...activeRoutes.slice(0, 2),
162
157
  {
163
158
  path: '#',
@@ -170,12 +165,27 @@ const Breadcrumbs = React.forwardRef(
170
165
  },
171
166
  activeRoutes[activeRoutes.length - 1]
172
167
  ]
173
- setItemsToBeRendered(newItems)
174
- setOptionsHidden(true)
168
+ }
169
+ return activeRoutes
170
+ }, [viewport, activeRoutes])
171
+
172
+ React.useEffect(() => {
173
+ if (optionsHidden) {
174
+ if (viewport !== 'xs' && !isEqual(itemsToBeRendered, activeRoutes)) {
175
+ setItemsToBeRendered(activeRoutes)
176
+ }
177
+ return
178
+ }
179
+
180
+ if (viewport === 'xs' && activeRoutes.length >= MAX_ITEMS_ON_XS_VIEWPORT) {
181
+ if (!isEqual(itemsToBeRendered, newItems)) {
182
+ setItemsToBeRendered(newItems)
183
+ setOptionsHidden(true)
184
+ }
175
185
  } else if (!isEqual(itemsToBeRendered, activeRoutes)) {
176
186
  setItemsToBeRendered(activeRoutes)
177
187
  }
178
- }, [viewport, activeRoutes, optionsHidden, itemsToBeRendered])
188
+ }, [viewport, activeRoutes, optionsHidden, itemsToBeRendered, newItems])
179
189
 
180
190
  const items = getItems(itemsToBeRendered, params, !children)
181
191
  const themeTokens = useThemeTokens('Breadcrumbs', tokens, variant)