@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
@@ -1,7 +1,5 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
- import styled from 'styled-components'
4
-
5
3
  import {
6
4
  StackView,
7
5
  Typography,
@@ -11,7 +9,9 @@ import {
11
9
  } from '@telus-uds/components-base'
12
10
 
13
11
  import videoText from '../../../videoText'
14
- import { htmlAttrs } from '../../../../utils'
12
+ import { htmlAttrs, styledComponents } from '../../../../utils'
13
+
14
+ const { styled } = styledComponents
15
15
 
16
16
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
17
17
 
@@ -1,11 +1,11 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
- import styled from 'styled-components'
4
-
5
3
  import { Typography, useThemeTokens, selectSystemProps } from '@telus-uds/components-base'
6
4
 
7
5
  import videoText from '../../../videoText'
8
- import { htmlAttrs } from '../../../../utils'
6
+ import { htmlAttrs, styledComponents } from '../../../../utils'
7
+
8
+ const { styled } = styledComponents
9
9
 
10
10
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
11
11
 
@@ -1,12 +1,12 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
- import styled from 'styled-components'
4
-
5
3
  import { Icon, useThemeTokens, selectSystemProps } from '@telus-uds/components-base'
6
4
 
7
5
  import VideoButton from '../VideoButton/VideoButton'
8
6
  import videoText from '../../../videoText'
9
- import { htmlAttrs } from '../../../../utils'
7
+ import { htmlAttrs, styledComponents } from '../../../../utils'
8
+
9
+ const { styled } = styledComponents
10
10
 
11
11
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
12
12
 
@@ -1,9 +1,10 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
- import styled from 'styled-components'
4
-
5
3
  import { useThemeTokens, selectSystemProps } from '@telus-uds/components-base'
6
- import { htmlAttrs } from '../../utils'
4
+
5
+ import { htmlAttrs, styledComponents } from '../../utils'
6
+
7
+ const { styled } = styledComponents
7
8
 
8
9
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
9
10
 
@@ -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 fscreen from 'fscreen'
5
4
  import {
6
5
  useThemeTokens,
@@ -10,12 +9,14 @@ import {
10
9
  } from '@telus-uds/components-base'
11
10
  import Spinner from '../Spinner'
12
11
 
13
- import { warn, htmlAttrs } from '../utils'
12
+ import { warn, htmlAttrs, styledComponents } from '../utils'
14
13
  import VideoSplash from '../shared/VideoSplash/VideoSplash'
15
14
  import MiddleControlButton from './MiddleControlButton/MiddleControlButton'
16
15
  import ControlBar from './ControlBar/ControlBar'
17
16
  import videoText from './videoText'
18
17
 
18
+ const { styled } = styledComponents
19
+
19
20
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
20
21
 
21
22
  // TODO: replace with the actual spinner component from UDS
@@ -9,12 +9,13 @@ import {
9
9
  getTokensPropType
10
10
  } from '@telus-uds/components-base'
11
11
 
12
- import styled, { css } from 'styled-components'
13
12
  import { VideoPropType } from './videoPropType'
14
13
  import VideoPickerThumbnail from './VideoPickerThumbnail'
15
14
  import VideoPickerPlayer from './VideoPickerPlayer'
16
15
  import VideoSlider from './VideoSlider'
17
- import { htmlAttrs } from '../utils'
16
+ import { htmlAttrs, styledComponents } from '../utils'
17
+
18
+ const { styled, css } = styledComponents
18
19
 
19
20
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
20
21
 
@@ -2,7 +2,6 @@ import React from 'react'
2
2
  import { Pressable, StyleSheet } from 'react-native-web'
3
3
  import PropTypes from 'prop-types'
4
4
  import { viewports } from '@telus-uds/system-constants'
5
- import styled from 'styled-components'
6
5
  import {
7
6
  StackView,
8
7
  Typography,
@@ -10,10 +9,13 @@ import {
10
9
  horizontalScrollUtils,
11
10
  useThemeTokensCallback
12
11
  } from '@telus-uds/components-base'
12
+ import { styledComponents } from '../utils'
13
13
  import { getTimestamp } from '../shared/VideoSplash/helpers'
14
14
  import { VideoPropType, RefPropType } from './videoPropType'
15
15
  import VideoSplash from '../shared/VideoSplash/VideoSplash'
16
16
 
17
+ const { styled } = styledComponents
18
+
17
19
  const { getItemPositionLayoutHandler, itemPositionsPropType } = horizontalScrollUtils
18
20
 
19
21
  // Use a React Native (web) outer container so it can take an onLayout callback, to
@@ -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
  responsiveProps,
@@ -15,7 +14,9 @@ import {
15
14
  import OrderedListBase from '../OrderedList/OrderedListBase'
16
15
  import ItemBase from '../OrderedList/ItemBase'
17
16
  import Image from '../Image'
18
- import { htmlAttrs } from '../utils'
17
+ import { htmlAttrs, styledComponents } from '../utils'
18
+
19
+ const { styled } = styledComponents
19
20
 
20
21
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
21
22
 
@@ -2,11 +2,12 @@ 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
 
9
+ const { styled } = styledComponents
10
+
10
11
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
11
12
 
12
13
  const StyledPlayerContainer = styled.div({
@@ -15,7 +16,7 @@ const StyledPlayerContainer = styled.div({
15
16
  outline: 'none'
16
17
  })
17
18
 
18
- const StyledYoutubePlayer = styled(YouTube)({
19
+ const StyledYoutubePlayer = styled((props) => <YouTube {...props} />)({
19
20
  position: 'absolute',
20
21
  top: 0,
21
22
  left: 0,
package/src/index.js CHANGED
@@ -37,6 +37,6 @@ export { default as NavigationBar } from './NavigationBar'
37
37
  export { default as Progress } from './Progress'
38
38
  export { default as SkeletonProvider } from './SkeletonProvider'
39
39
 
40
- export { ssrStyles } from './utils'
40
+ export { ssrStyles, styledComponents } from './utils'
41
41
 
42
42
  export * from './baseExports'
@@ -1,9 +1,10 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
- import styled from 'styled-components'
4
-
3
+ import { styledComponents } from '../../utils'
5
4
  import ResponsiveImage from '../../ResponsiveImage'
6
5
 
6
+ const { styled } = styledComponents
7
+
7
8
  const selectFullBleedContentProps = ({
8
9
  alt,
9
10
  height,
@@ -1,9 +1,11 @@
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
 
7
+ const { styled } = styledComponents
8
+
7
9
  const ButtonContainer = styled.button({
8
10
  background: 'none',
9
11
  border: 0,
@@ -1,10 +1,12 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
- import styled from 'styled-components'
4
-
5
3
  import { Typography, useThemeTokens } from '@telus-uds/components-base'
4
+ import { styledComponents } from '../../../utils'
5
+
6
6
  import { getAriaLabel, getTimestamp } from '../helpers'
7
7
 
8
+ const { styled } = styledComponents
9
+
8
10
  const ButtonContainer = styled.button({
9
11
  background: 'none',
10
12
  border: 0,
@@ -1,12 +1,13 @@
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'
9
+
10
+ const { styled } = styledComponents
10
11
 
11
12
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
12
13
 
@@ -8,6 +8,7 @@ import isElementFocusable from './isElementFocusable'
8
8
  import renderStructuredContent from './renderStructuredContent'
9
9
  import useOverlaidPosition from './useOverlaidPosition'
10
10
  import scrollToAnchor from './scrollToAnchor'
11
+ import styledComponents from './theming/styled-components'
11
12
 
12
13
  export {
13
14
  deprecate,
@@ -21,5 +22,6 @@ export {
21
22
  ssrStyles,
22
23
  isElementFocusable,
23
24
  useOverlaidPosition,
24
- scrollToAnchor
25
+ scrollToAnchor,
26
+ styledComponents
25
27
  }
package/src/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:
@@ -21,6 +21,7 @@ const ssrStyles = (
21
21
  appName = 'Allium app',
22
22
  { styleGetters = [], collectStyles = (renderedApp) => renderedApp } = {}
23
23
  ) => {
24
+ const { ServerStyleSheet } = styledComponents
24
25
  const sheet = new ServerStyleSheet()
25
26
  const getStyledComponentsStyles = () => {
26
27
  const styles = sheet.getStyleElement()
@@ -0,0 +1,23 @@
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
+
19
+ const styled = typeof _styled === 'function' ? _styled : _styled.default
20
+
21
+ const styledComponents = { styled, css, keyframes, createGlobalStyle, ServerStyleSheet }
22
+
23
+ export default styledComponents
package/types/common.d.ts CHANGED
@@ -154,7 +154,7 @@ export interface PressableState {
154
154
  }
155
155
 
156
156
  // TODO: Make this more specific:
157
- // https://telus.com/universal-design-system/components/allium/skeleton/#props
157
+ // https://telus.com/universal-design-system/components/allium/Skeleton/#props
158
158
  export type SkeletonProps = Record<string, any>
159
159
 
160
160
  export type HeadingTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'