@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.
- package/CHANGELOG.md +28 -2
- package/lib/Badge/Badge.js +19 -11
- package/lib/BlockQuote/BlockQuote.js +31 -17
- package/lib/Breadcrumbs/Breadcrumbs.js +23 -17
- package/lib/Breadcrumbs/Item/Item.js +6 -10
- package/lib/Callout/Callout.js +5 -6
- package/lib/Card/Card.js +5 -5
- package/lib/Card/CardContent.js +5 -6
- package/lib/Card/CardFooter.js +5 -6
- package/lib/Countdown/Countdown.js +5 -6
- package/lib/Countdown/Segment.js +6 -6
- package/lib/DatePicker/CalendarContainer.js +5 -5
- package/lib/DatePicker/DatePicker.js +12 -18
- package/lib/DatePicker/reactDatesCss.js +829 -2
- package/lib/Disclaimer/Disclaimer.js +5 -6
- package/lib/Footnote/Footnote.js +15 -39
- package/lib/Footnote/FootnoteLink.js +5 -6
- package/lib/NavigationBar/NavigationBar.js +73 -20
- package/lib/NavigationBar/NavigationItem.js +5 -6
- package/lib/OrderedList/Item.js +7 -11
- package/lib/OrderedList/ItemBase.js +5 -5
- package/lib/OrderedList/OrderedList.js +5 -6
- package/lib/OrderedList/OrderedListBase.js +5 -5
- package/lib/Paragraph/Paragraph.js +16 -8
- package/lib/PreviewCard/PreviewCard.js +7 -10
- package/lib/PriceLockup/PriceLockup.js +64 -54
- package/lib/Progress/ProgressBar.js +6 -6
- package/lib/QuantitySelector/QuantitySelector.js +1 -1
- package/lib/QuantitySelector/styles.js +18 -9
- package/lib/ResponsiveImage/ResponsiveImage.js +7 -1
- package/lib/Ribbon/Ribbon.js +57 -31
- package/lib/Span/Span.js +6 -7
- package/lib/Spinner/Spinner.js +8 -18
- package/lib/Spinner/SpinnerContent.js +5 -6
- package/lib/StoryCard/StoryCard.js +7 -10
- package/lib/Table/Cell.js +43 -12
- package/lib/Table/Table.js +15 -11
- package/lib/TermsAndConditions/ExpandCollapse.js +7 -13
- package/lib/TermsAndConditions/TermsAndConditions.js +9 -22
- package/lib/Testimonial/Testimonial.js +10 -26
- package/lib/Toast/Toast.js +64 -13
- package/lib/Video/ControlBar/ControlBar.js +8 -18
- package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +5 -6
- package/lib/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +7 -14
- package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +7 -14
- package/lib/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +6 -10
- package/lib/Video/MiddleControlButton/MiddleControlButton.js +5 -6
- package/lib/Video/Video.js +10 -26
- package/lib/VideoPicker/VideoPicker.js +44 -20
- package/lib/VideoPicker/VideoPickerThumbnail.js +52 -18
- package/lib/WaffleGrid/WaffleGrid.js +7 -14
- package/lib/WebVideo/WebVideo.js +9 -14
- package/lib/index.js +1 -1
- package/lib/shared/FullBleedContent/FullBleedContent.js +5 -5
- package/lib/shared/VideoSplash/SplashButton/SplashButton.js +6 -9
- package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +8 -17
- package/lib/shared/VideoSplash/VideoSplash.js +5 -6
- package/lib/utils/index.js +3 -1
- package/lib/utils/scrollToAnchor.js +19 -0
- package/lib/utils/ssr.js +4 -1
- package/lib/utils/theming/styled-components.js +26 -0
- package/package.json +3 -3
- package/src/Badge/Badge.jsx +3 -2
- package/src/BlockQuote/BlockQuote.jsx +3 -2
- package/src/Breadcrumbs/Breadcrumbs.jsx +23 -13
- package/src/Breadcrumbs/Item/Item.jsx +3 -2
- package/src/Callout/Callout.jsx +3 -2
- package/src/Card/Card.jsx +3 -1
- package/src/Card/CardContent.jsx +3 -2
- package/src/Card/CardFooter.jsx +3 -2
- package/src/Countdown/Countdown.jsx +3 -2
- package/src/Countdown/Segment.jsx +3 -1
- package/src/DatePicker/CalendarContainer.jsx +3 -1
- package/src/DatePicker/DatePicker.jsx +3 -2
- package/src/DatePicker/reactDatesCss.js +3 -1
- package/src/Disclaimer/Disclaimer.jsx +3 -2
- package/src/Footnote/Footnote.jsx +9 -2
- package/src/Footnote/FootnoteLink.jsx +3 -2
- package/src/NavigationBar/NavigationBar.jsx +55 -13
- package/src/NavigationBar/NavigationItem.jsx +3 -2
- package/src/OrderedList/Item.jsx +4 -3
- package/src/OrderedList/ItemBase.jsx +3 -1
- package/src/OrderedList/OrderedList.jsx +3 -2
- package/src/OrderedList/OrderedListBase.jsx +3 -1
- package/src/Paragraph/Paragraph.jsx +3 -2
- package/src/PreviewCard/PreviewCard.jsx +3 -1
- package/src/PriceLockup/PriceLockup.jsx +3 -2
- package/src/Progress/ProgressBar.jsx +3 -1
- package/src/QuantitySelector/QuantitySelector.jsx +1 -1
- package/src/QuantitySelector/styles.js +3 -1
- package/src/ResponsiveImage/ResponsiveImage.jsx +10 -3
- package/src/Ribbon/Ribbon.jsx +3 -2
- package/src/Span/Span.jsx +3 -2
- package/src/Spinner/Spinner.jsx +3 -2
- package/src/Spinner/SpinnerContent.jsx +3 -2
- package/src/StoryCard/StoryCard.jsx +3 -1
- package/src/Table/Cell.jsx +3 -1
- package/src/Table/Table.jsx +3 -2
- package/src/TermsAndConditions/ExpandCollapse.jsx +3 -1
- package/src/TermsAndConditions/TermsAndConditions.jsx +3 -2
- package/src/Testimonial/Testimonial.jsx +3 -2
- package/src/Toast/Toast.jsx +3 -2
- package/src/Video/ControlBar/ControlBar.jsx +3 -3
- package/src/Video/ControlBar/Controls/VideoButton/VideoButton.jsx +4 -3
- package/src/Video/ControlBar/Controls/VideoMenu/VideoMenu.jsx +3 -3
- package/src/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.jsx +3 -3
- package/src/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.jsx +3 -3
- package/src/Video/MiddleControlButton/MiddleControlButton.jsx +4 -3
- package/src/Video/Video.jsx +3 -2
- package/src/VideoPicker/VideoPicker.jsx +3 -2
- package/src/VideoPicker/VideoPickerThumbnail.jsx +3 -1
- package/src/WaffleGrid/WaffleGrid.jsx +3 -2
- package/src/WebVideo/WebVideo.jsx +4 -3
- package/src/index.js +1 -1
- package/src/shared/FullBleedContent/FullBleedContent.jsx +3 -2
- package/src/shared/VideoSplash/SplashButton/SplashButton.jsx +3 -1
- package/src/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.jsx +4 -2
- package/src/shared/VideoSplash/VideoSplash.jsx +3 -2
- package/src/utils/index.js +5 -1
- package/src/utils/scrollToAnchor.js +18 -0
- package/src/utils/ssr.js +2 -1
- package/src/utils/theming/styled-components.js +23 -0
package/src/Table/Cell.jsx
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
|
-
import styled, { css } from 'styled-components'
|
|
4
3
|
import { Typography, useThemeTokens, applyShadowToken } from '@telus-uds/components-base'
|
|
4
|
+
import { styledComponents } from '../utils'
|
|
5
5
|
import { useTableContext } from './Table'
|
|
6
6
|
|
|
7
|
+
const { styled, css } = styledComponents
|
|
8
|
+
|
|
7
9
|
const HEADER_TYPE = {
|
|
8
10
|
HEADING: 'heading',
|
|
9
11
|
SUBHEADING: 'subHeading',
|
package/src/Table/Table.jsx
CHANGED
|
@@ -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
|
selectSystemProps,
|
|
6
5
|
useSafeLayoutEffect,
|
|
@@ -8,7 +7,9 @@ import {
|
|
|
8
7
|
getTokensPropType
|
|
9
8
|
} from '@telus-uds/components-base'
|
|
10
9
|
import throttle from 'lodash.throttle'
|
|
11
|
-
import { htmlAttrs } from '../utils'
|
|
10
|
+
import { htmlAttrs, styledComponents } from '../utils'
|
|
11
|
+
|
|
12
|
+
const { styled } = styledComponents
|
|
12
13
|
|
|
13
14
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
14
15
|
|
|
@@ -5,7 +5,9 @@ import {
|
|
|
5
5
|
IconButton,
|
|
6
6
|
useThemeTokensCallback
|
|
7
7
|
} from '@telus-uds/components-base'
|
|
8
|
-
import
|
|
8
|
+
import { styledComponents } from '../utils'
|
|
9
|
+
|
|
10
|
+
const { styled } = styledComponents
|
|
9
11
|
|
|
10
12
|
const ExpandCollapseControl = styled.div({
|
|
11
13
|
alignItems: 'center',
|
|
@@ -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
|
Box,
|
|
6
5
|
Divider,
|
|
@@ -17,9 +16,11 @@ import {
|
|
|
17
16
|
} from '@telus-uds/components-base'
|
|
18
17
|
import ExpandCollapse from './ExpandCollapse'
|
|
19
18
|
import OrderedListBase from '../OrderedList/OrderedListBase'
|
|
20
|
-
import { htmlAttrs, media, renderStructuredContent } from '../utils'
|
|
19
|
+
import { htmlAttrs, media, renderStructuredContent, styledComponents } from '../utils'
|
|
21
20
|
import defaultDictionary from './dictionary'
|
|
22
21
|
|
|
22
|
+
const { styled } = styledComponents
|
|
23
|
+
|
|
23
24
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
24
25
|
|
|
25
26
|
const ContentContainer = styled.div(({ tokens }) => ({
|
|
@@ -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,
|
|
@@ -10,7 +9,9 @@ import {
|
|
|
10
9
|
getTokensPropType
|
|
11
10
|
} from '@telus-uds/components-base'
|
|
12
11
|
import Image from '../Image'
|
|
13
|
-
import { htmlAttrs } from '../utils'
|
|
12
|
+
import { htmlAttrs, styledComponents } from '../utils'
|
|
13
|
+
|
|
14
|
+
const { styled } = styledComponents
|
|
14
15
|
|
|
15
16
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
16
17
|
|
package/src/Toast/Toast.jsx
CHANGED
|
@@ -10,8 +10,9 @@ import {
|
|
|
10
10
|
useViewport,
|
|
11
11
|
getTokensPropType
|
|
12
12
|
} from '@telus-uds/components-base'
|
|
13
|
-
import
|
|
14
|
-
|
|
13
|
+
import { htmlAttrs, styledComponents } from '../utils'
|
|
14
|
+
|
|
15
|
+
const { styled, css, keyframes } = styledComponents
|
|
15
16
|
|
|
16
17
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
17
18
|
|
|
@@ -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
|
useThemeTokens,
|
|
@@ -16,7 +14,9 @@ import VideoButton from './Controls/VideoButton/VideoButton'
|
|
|
16
14
|
import VideoMenu from './Controls/VideoMenu/VideoMenu'
|
|
17
15
|
|
|
18
16
|
import videoText from '../videoText'
|
|
19
|
-
import { htmlAttrs } from '../../utils'
|
|
17
|
+
import { htmlAttrs, styledComponents } from '../../utils'
|
|
18
|
+
|
|
19
|
+
const { styled } = styledComponents
|
|
20
20
|
|
|
21
21
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
22
22
|
|
|
@@ -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
|
-
|
|
4
|
+
|
|
5
|
+
import { htmlAttrs, styledComponents } from '../../../../utils'
|
|
6
|
+
|
|
7
|
+
const { styled } = styledComponents
|
|
7
8
|
|
|
8
9
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
9
10
|
|
|
@@ -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
|
-
|
|
4
|
+
|
|
5
|
+
import { htmlAttrs, styledComponents } from '../../utils'
|
|
6
|
+
|
|
7
|
+
const { styled } = styledComponents
|
|
7
8
|
|
|
8
9
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
9
10
|
|
package/src/Video/Video.jsx
CHANGED
|
@@ -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
|
|
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
|
|
package/src/utils/index.js
CHANGED
|
@@ -7,6 +7,8 @@ import ssrStyles from './ssr'
|
|
|
7
7
|
import isElementFocusable from './isElementFocusable'
|
|
8
8
|
import renderStructuredContent from './renderStructuredContent'
|
|
9
9
|
import useOverlaidPosition from './useOverlaidPosition'
|
|
10
|
+
import scrollToAnchor from './scrollToAnchor'
|
|
11
|
+
import styledComponents from './theming/styled-components'
|
|
10
12
|
|
|
11
13
|
export {
|
|
12
14
|
deprecate,
|
|
@@ -19,5 +21,7 @@ export {
|
|
|
19
21
|
renderStructuredContent,
|
|
20
22
|
ssrStyles,
|
|
21
23
|
isElementFocusable,
|
|
22
|
-
useOverlaidPosition
|
|
24
|
+
useOverlaidPosition,
|
|
25
|
+
scrollToAnchor,
|
|
26
|
+
styledComponents
|
|
23
27
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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?.startsWith('#')) {
|
|
10
|
+
event.preventDefault()
|
|
11
|
+
const target = document.getElementById(href.slice(1))
|
|
12
|
+
target?.scrollIntoView({ behavior: 'smooth' })
|
|
13
|
+
window.location.hash = href
|
|
14
|
+
onAfterScroll(event)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default scrollToAnchor
|
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
|