@telus-uds/components-web 3.2.0 → 3.3.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 (119) hide show
  1. package/CHANGELOG.md +31 -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 +26 -28
  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 +5 -6
  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 +90 -64
  27. package/lib/PriceLockup/tokens.js +6 -2
  28. package/lib/Progress/ProgressBar.js +6 -6
  29. package/lib/QuantitySelector/styles.js +18 -9
  30. package/lib/Ribbon/Ribbon.js +57 -31
  31. package/lib/Span/Span.js +6 -7
  32. package/lib/Spinner/Spinner.js +8 -18
  33. package/lib/Spinner/SpinnerContent.js +5 -6
  34. package/lib/StoryCard/StoryCard.js +7 -10
  35. package/lib/Table/Cell.js +43 -12
  36. package/lib/Table/Table.js +15 -11
  37. package/lib/TermsAndConditions/ExpandCollapse.js +7 -13
  38. package/lib/TermsAndConditions/TermsAndConditions.js +9 -22
  39. package/lib/Testimonial/Testimonial.js +10 -26
  40. package/lib/Toast/Toast.js +64 -13
  41. package/lib/Video/ControlBar/ControlBar.js +8 -18
  42. package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +5 -6
  43. package/lib/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +7 -14
  44. package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +7 -14
  45. package/lib/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +6 -10
  46. package/lib/Video/MiddleControlButton/MiddleControlButton.js +5 -6
  47. package/lib/Video/Video.js +10 -26
  48. package/lib/VideoPicker/VideoPicker.js +44 -20
  49. package/lib/VideoPicker/VideoPickerThumbnail.js +52 -18
  50. package/lib/WaffleGrid/WaffleGrid.js +7 -14
  51. package/lib/WebVideo/WebVideo.js +9 -14
  52. package/lib/index.js +1 -1
  53. package/lib/shared/FullBleedContent/FullBleedContent.js +5 -5
  54. package/lib/shared/VideoSplash/SplashButton/SplashButton.js +6 -9
  55. package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +8 -17
  56. package/lib/shared/VideoSplash/VideoSplash.js +5 -6
  57. package/lib/utils/index.js +2 -1
  58. package/lib/utils/ssr.js +4 -1
  59. package/lib/utils/theming/styled-components.js +26 -0
  60. package/package.json +3 -3
  61. package/src/Badge/Badge.jsx +3 -2
  62. package/src/BlockQuote/BlockQuote.jsx +3 -2
  63. package/src/Breadcrumbs/Breadcrumbs.jsx +23 -13
  64. package/src/Breadcrumbs/Item/Item.jsx +3 -2
  65. package/src/Callout/Callout.jsx +3 -2
  66. package/src/Card/Card.jsx +3 -1
  67. package/src/Card/CardContent.jsx +3 -2
  68. package/src/Card/CardFooter.jsx +3 -2
  69. package/src/Countdown/Countdown.jsx +3 -2
  70. package/src/Countdown/Segment.jsx +3 -1
  71. package/src/DatePicker/CalendarContainer.jsx +3 -1
  72. package/src/DatePicker/DatePicker.jsx +22 -13
  73. package/src/DatePicker/reactDatesCss.js +3 -1
  74. package/src/Disclaimer/Disclaimer.jsx +3 -2
  75. package/src/Footnote/Footnote.jsx +9 -2
  76. package/src/Footnote/FootnoteLink.jsx +3 -2
  77. package/src/NavigationBar/NavigationBar.jsx +3 -2
  78. package/src/NavigationBar/NavigationItem.jsx +3 -2
  79. package/src/OrderedList/Item.jsx +4 -3
  80. package/src/OrderedList/ItemBase.jsx +3 -1
  81. package/src/OrderedList/OrderedList.jsx +3 -2
  82. package/src/OrderedList/OrderedListBase.jsx +3 -1
  83. package/src/Paragraph/Paragraph.jsx +3 -2
  84. package/src/PreviewCard/PreviewCard.jsx +3 -1
  85. package/src/PriceLockup/PriceLockup.jsx +15 -4
  86. package/src/PriceLockup/tokens.js +15 -3
  87. package/src/Progress/ProgressBar.jsx +3 -1
  88. package/src/QuantitySelector/styles.js +3 -1
  89. package/src/Ribbon/Ribbon.jsx +3 -2
  90. package/src/Span/Span.jsx +3 -2
  91. package/src/Spinner/Spinner.jsx +3 -2
  92. package/src/Spinner/SpinnerContent.jsx +3 -2
  93. package/src/StoryCard/StoryCard.jsx +3 -1
  94. package/src/Table/Cell.jsx +3 -1
  95. package/src/Table/Table.jsx +3 -2
  96. package/src/TermsAndConditions/ExpandCollapse.jsx +3 -1
  97. package/src/TermsAndConditions/TermsAndConditions.jsx +3 -2
  98. package/src/Testimonial/Testimonial.jsx +3 -2
  99. package/src/Toast/Toast.jsx +3 -2
  100. package/src/Video/ControlBar/ControlBar.jsx +3 -3
  101. package/src/Video/ControlBar/Controls/VideoButton/VideoButton.jsx +4 -3
  102. package/src/Video/ControlBar/Controls/VideoMenu/VideoMenu.jsx +3 -3
  103. package/src/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.jsx +3 -3
  104. package/src/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.jsx +3 -3
  105. package/src/Video/MiddleControlButton/MiddleControlButton.jsx +4 -3
  106. package/src/Video/Video.jsx +3 -2
  107. package/src/VideoPicker/VideoPicker.jsx +3 -2
  108. package/src/VideoPicker/VideoPickerThumbnail.jsx +3 -1
  109. package/src/WaffleGrid/WaffleGrid.jsx +3 -2
  110. package/src/WebVideo/WebVideo.jsx +4 -3
  111. package/src/index.js +1 -1
  112. package/src/shared/FullBleedContent/FullBleedContent.jsx +3 -2
  113. package/src/shared/VideoSplash/SplashButton/SplashButton.jsx +3 -1
  114. package/src/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.jsx +4 -2
  115. package/src/shared/VideoSplash/VideoSplash.jsx +3 -2
  116. package/src/utils/index.js +3 -1
  117. package/src/utils/ssr.js +2 -1
  118. package/src/utils/theming/styled-components.js +23 -0
  119. package/types/common.d.ts +1 -1
@@ -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;
@@ -8,4 +8,5 @@ import isElementFocusable from './isElementFocusable';
8
8
  import renderStructuredContent from './renderStructuredContent';
9
9
  import useOverlaidPosition from './useOverlaidPosition';
10
10
  import scrollToAnchor from './scrollToAnchor';
11
- export { deprecate, htmlAttrs, contentfulProps, transformGradient, useTypographyTheme, warn, media, renderStructuredContent, ssrStyles, isElementFocusable, useOverlaidPosition, scrollToAnchor };
11
+ import styledComponents from './theming/styled-components';
12
+ export { deprecate, htmlAttrs, contentfulProps, transformGradient, useTypographyTheme, warn, media, renderStructuredContent, ssrStyles, isElementFocusable, useOverlaidPosition, scrollToAnchor, styledComponents };
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.2.0",
9
+ "@telus-uds/components-base": "^2.4.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.3.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.2.0"
84
+ "version": "3.3.0"
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)
@@ -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
  import {
5
4
  Link,
6
5
  Typography,
@@ -9,10 +8,12 @@ import {
9
8
  selectSystemProps,
10
9
  useThemeTokens
11
10
  } from '@telus-uds/components-base'
12
- import { htmlAttrs } from '../../utils'
11
+ import { htmlAttrs, styledComponents } from '../../utils'
13
12
 
14
13
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
15
14
 
15
+ const { styled } = styledComponents
16
+
16
17
  const StyledItemContainer = styled.li({
17
18
  display: 'inline-block',
18
19
  paddingLeft: ({ listItemPadding }) => `${listItemPadding}px`,
@@ -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
  import {
5
4
  Icon,
6
5
  selectSystemProps,
@@ -9,10 +8,12 @@ import {
9
8
  getTokensPropType
10
9
  } from '@telus-uds/components-base'
11
10
 
12
- import { htmlAttrs } from '../utils'
11
+ import { htmlAttrs, styledComponents } from '../utils'
13
12
 
14
13
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
15
14
 
15
+ const { styled } = styledComponents
16
+
16
17
  const getAlignment = (rounded, textAlignToFlex) => {
17
18
  if (textAlignToFlex) {
18
19
  switch (textAlignToFlex) {
package/src/Card/Card.jsx CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  PressableCardBase,
16
16
  useResponsiveProp
17
17
  } from '@telus-uds/components-base'
18
- import styled from 'styled-components'
18
+ import { styledComponents } from '../utils'
19
19
  import CardContent from './CardContent'
20
20
  import CardFooter from './CardFooter'
21
21
  import FullBleedContent, {
@@ -27,6 +27,8 @@ import ConditionalWrapper from '../shared/ConditionalWrapper'
27
27
  // Passes React Native-oriented system props through UDS Card
28
28
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps])
29
29
 
30
+ const { styled } = styledComponents
31
+
30
32
  /**
31
33
  * A basic card component, unstyled by default.
32
34
  *
@@ -7,11 +7,12 @@ import {
7
7
  useViewport,
8
8
  variantProp
9
9
  } from '@telus-uds/components-base'
10
- import styled from 'styled-components'
11
- import { htmlAttrs } from '../utils'
10
+ import { htmlAttrs, styledComponents } from '../utils'
12
11
 
13
12
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
14
13
 
14
+ const { styled } = styledComponents
15
+
15
16
  const CardContentContainer = styled.div(
16
17
  ({
17
18
  borderRadius,
@@ -8,11 +8,12 @@ import {
8
8
  useViewport,
9
9
  variantProp
10
10
  } from '@telus-uds/components-base'
11
- import styled from 'styled-components'
12
- import { htmlAttrs } from '../utils'
11
+ import { htmlAttrs, styledComponents } from '../utils'
13
12
 
14
13
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
15
14
 
15
+ const { styled } = styledComponents
16
+
16
17
  const CardFooterContainer = styled.div(
17
18
  ({ backgroundColor, borderRadius, paddingBottom, paddingLeft, paddingRight, paddingTop }) => ({
18
19
  backgroundColor,
@@ -15,16 +15,17 @@ import {
15
15
  StyleSheet
16
16
  } from '@telus-uds/components-base'
17
17
  import { viewports } from '@telus-uds/system-constants'
18
- import styled from 'styled-components'
19
18
  // Reading these from the RN palette since they will be used to generate
20
19
  // the `Typography` tokens
21
- import { htmlAttrs, transformGradient } from '../utils'
20
+ import { htmlAttrs, transformGradient, styledComponents } from '../utils'
22
21
  import Segment from './Segment'
23
22
  import useCountdown from './useCountdown'
24
23
  import { countdownVariantPropType, dictionaryContentShape } from './types'
25
24
 
26
25
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
27
26
 
27
+ const { styled } = styledComponents
28
+
28
29
  const Container = styled.div(({ variant: { feature, inverse, large }, themeTokens, gradient }) => ({
29
30
  ...(large || feature ? { display: 'flex', flex: 0 } : {}),
30
31
  ...(feature && {
@@ -1,12 +1,14 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import { StackView, Typography, useCopy } from '@telus-uds/components-base'
4
- import styled from 'styled-components'
4
+ import { styledComponents } from '../utils'
5
5
  import dictionary from './dictionary'
6
6
  import { countdownVariantPropType, dictionaryContentShape } from './types'
7
7
  // !TODO: put this back
8
8
  import { SEGMENT_WIDTH_TO_FONT_SIZE_RATIO } from './constants'
9
9
 
10
+ const { styled } = styledComponents
11
+
10
12
  // Pads with zeros on the left if it's a single digit number
11
13
  const pad = (number, segmentWidth = 2) => String(number).padStart(segmentWidth, '0')
12
14