@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
|
@@ -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`,
|
package/src/Callout/Callout.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
|
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
|
|
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
|
*
|
package/src/Card/CardContent.jsx
CHANGED
|
@@ -7,11 +7,12 @@ import {
|
|
|
7
7
|
useViewport,
|
|
8
8
|
variantProp
|
|
9
9
|
} from '@telus-uds/components-base'
|
|
10
|
-
import
|
|
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,
|
package/src/Card/CardFooter.jsx
CHANGED
|
@@ -8,11 +8,12 @@ import {
|
|
|
8
8
|
useViewport,
|
|
9
9
|
variantProp
|
|
10
10
|
} from '@telus-uds/components-base'
|
|
11
|
-
import
|
|
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
|
|
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
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { styledComponents } from '../utils'
|
|
2
2
|
import defaultReactDatesCss from './reactDatesCss'
|
|
3
3
|
|
|
4
4
|
// calendarDayDefaultHeight and calendarDayDefaultWidth
|
|
5
5
|
// refer to circle size when selected, focused, or hovered and is passed with getResponsiveCircleSize in DatePicker
|
|
6
6
|
|
|
7
|
+
const { styled } = styledComponents
|
|
8
|
+
|
|
7
9
|
const CalendarContainer = styled.div(
|
|
8
10
|
({
|
|
9
11
|
daySize,
|
|
@@ -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 momentPropTypes from 'react-moment-proptypes'
|
|
5
4
|
import 'react-dates/initialize'
|
|
6
5
|
import { SingleDatePicker, DayPickerSingleDateController } from 'react-dates'
|
|
@@ -20,7 +19,9 @@ import moment from 'moment'
|
|
|
20
19
|
import { isUndefined, throttle } from 'lodash'
|
|
21
20
|
import CalendarContainer from './CalendarContainer'
|
|
22
21
|
import dictionary from './dictionary'
|
|
23
|
-
import { htmlAttrs } from '../utils'
|
|
22
|
+
import { htmlAttrs, styledComponents } from '../utils'
|
|
23
|
+
|
|
24
|
+
const { styled } = styledComponents
|
|
24
25
|
|
|
25
26
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
26
27
|
const dateFormat = 'DD / MM / YYYY'
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
|
-
import styled from 'styled-components'
|
|
4
3
|
import {
|
|
5
4
|
applyTextStyles,
|
|
6
5
|
selectSystemProps,
|
|
7
6
|
useThemeTokens,
|
|
8
7
|
getTokensPropType
|
|
9
8
|
} from '@telus-uds/components-base'
|
|
10
|
-
import { htmlAttrs } from '../utils'
|
|
9
|
+
import { htmlAttrs, styledComponents } from '../utils'
|
|
10
|
+
|
|
11
|
+
const { styled } = styledComponents
|
|
11
12
|
|
|
12
13
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
13
14
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
|
-
import styled, { createGlobalStyle } from 'styled-components'
|
|
4
3
|
import {
|
|
5
4
|
Icon,
|
|
6
5
|
Portal,
|
|
@@ -15,12 +14,20 @@ import {
|
|
|
15
14
|
} from '@telus-uds/components-base'
|
|
16
15
|
|
|
17
16
|
import OrderedListBase from '../OrderedList/OrderedListBase'
|
|
18
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
htmlAttrs,
|
|
19
|
+
media,
|
|
20
|
+
renderStructuredContent,
|
|
21
|
+
isElementFocusable,
|
|
22
|
+
styledComponents
|
|
23
|
+
} from '../utils'
|
|
19
24
|
import defaultDictionary from './dictionary'
|
|
20
25
|
|
|
21
26
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
22
27
|
const viewportBreakpoint = 1440
|
|
23
28
|
|
|
29
|
+
const { styled, createGlobalStyle } = styledComponents
|
|
30
|
+
|
|
24
31
|
const GlobalBodyScrollLock = createGlobalStyle({
|
|
25
32
|
'html, body': media().until('md').css({ overflow: 'hidden' })
|
|
26
33
|
})
|
|
@@ -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
|
applyTextStyles,
|
|
6
5
|
selectSystemProps,
|
|
@@ -9,7 +8,9 @@ import {
|
|
|
9
8
|
variantProp
|
|
10
9
|
} from '@telus-uds/components-base'
|
|
11
10
|
import dictionary from './dictionary'
|
|
12
|
-
import { htmlAttrs } from '../utils'
|
|
11
|
+
import { htmlAttrs, styledComponents } from '../utils'
|
|
12
|
+
|
|
13
|
+
const { styled } = styledComponents
|
|
13
14
|
|
|
14
15
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
15
16
|
|
|
@@ -4,15 +4,18 @@ import {
|
|
|
4
4
|
selectSystemProps,
|
|
5
5
|
StackView,
|
|
6
6
|
Typography,
|
|
7
|
+
useHash,
|
|
8
|
+
useInputValue,
|
|
7
9
|
useResponsiveProp,
|
|
8
10
|
withLinkRouter
|
|
9
11
|
} from '@telus-uds/components-base'
|
|
10
|
-
import
|
|
11
|
-
import { htmlAttrs } from '../utils'
|
|
12
|
+
import { htmlAttrs, scrollToAnchor, styledComponents } from '../utils'
|
|
12
13
|
import NavigationItem from './NavigationItem'
|
|
13
14
|
import NavigationSubMenu from './NavigationSubMenu'
|
|
14
15
|
import collapseItems from './collapseItems'
|
|
15
16
|
|
|
17
|
+
const { styled } = styledComponents
|
|
18
|
+
|
|
16
19
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
17
20
|
|
|
18
21
|
const Heading = styled.div({
|
|
@@ -34,16 +37,37 @@ const NavigationBar = React.forwardRef(
|
|
|
34
37
|
heading,
|
|
35
38
|
headingLevel = 'h1',
|
|
36
39
|
items,
|
|
37
|
-
onChange
|
|
40
|
+
onChange,
|
|
38
41
|
selectedId,
|
|
42
|
+
value,
|
|
39
43
|
LinkRouter,
|
|
40
44
|
linkRouterProps,
|
|
41
45
|
...rest
|
|
42
46
|
},
|
|
43
47
|
ref
|
|
44
48
|
) => {
|
|
49
|
+
const { currentValue, setValue } = useInputValue({ value, initialValue: selectedId, onChange })
|
|
50
|
+
|
|
51
|
+
useHash(
|
|
52
|
+
(hash, event) => {
|
|
53
|
+
let hashItem = hash && items.find(({ href }) => hash === href)
|
|
54
|
+
if (!hashItem) {
|
|
55
|
+
const parentItem = items.find(({ items: parentItems }) =>
|
|
56
|
+
parentItems?.some(({ href }) => hash === href)
|
|
57
|
+
)
|
|
58
|
+
hashItem = parentItem?.items.find(({ href }) => hash === href)
|
|
59
|
+
}
|
|
60
|
+
const hashId = hashItem && (hashItem.id || hashItem.label)
|
|
61
|
+
if (hashId) setValue(hashId, event)
|
|
62
|
+
},
|
|
63
|
+
[items, setValue]
|
|
64
|
+
)
|
|
65
|
+
|
|
45
66
|
const direction = useResponsiveProp({ xs: 'column', sm: 'row' })
|
|
46
|
-
const itemsForViewport = useResponsiveProp({
|
|
67
|
+
const itemsForViewport = useResponsiveProp({
|
|
68
|
+
xs: collapseItems(items, currentValue),
|
|
69
|
+
lg: items
|
|
70
|
+
})
|
|
47
71
|
const openOverlayRef = React.useRef(null)
|
|
48
72
|
const [openSubMenuId, setOpenSubMenuId] = React.useState(null)
|
|
49
73
|
const handleSubMenuClose = (event) => {
|
|
@@ -161,14 +185,28 @@ const NavigationBar = React.forwardRef(
|
|
|
161
185
|
const handleClick = (event) => {
|
|
162
186
|
if (nestedItems) {
|
|
163
187
|
setOpenSubMenuId(openSubMenuId !== itemId ? itemId : null)
|
|
188
|
+
return
|
|
189
|
+
}
|
|
190
|
+
if (href?.startsWith('#')) {
|
|
191
|
+
scrollToAnchor(href, event, () => setValue(itemId, event))
|
|
192
|
+
} else {
|
|
193
|
+
setValue(itemId, event)
|
|
164
194
|
}
|
|
165
195
|
onClick?.(event)
|
|
166
|
-
onChange?.(itemId, event)
|
|
167
196
|
}
|
|
168
197
|
|
|
169
198
|
const ItemComponent = nestedItems ? NavigationSubMenu : NavigationItem
|
|
170
199
|
const isOpen = itemId === openSubMenuId
|
|
171
200
|
|
|
201
|
+
const scrollableNestedItems =
|
|
202
|
+
nestedItems?.map((item) => ({
|
|
203
|
+
...item,
|
|
204
|
+
onPress: (event) => {
|
|
205
|
+
const nestedItemId = item.id ?? item.label
|
|
206
|
+
scrollToAnchor(item.href, event, () => setValue(nestedItemId, event))
|
|
207
|
+
}
|
|
208
|
+
})) ?? nestedItems
|
|
209
|
+
|
|
172
210
|
return (
|
|
173
211
|
<ItemComponent
|
|
174
212
|
ref={itemRef}
|
|
@@ -176,16 +214,16 @@ const NavigationBar = React.forwardRef(
|
|
|
176
214
|
href={href}
|
|
177
215
|
onClick={handleClick}
|
|
178
216
|
// TODO: refactor to pass selected ID via context
|
|
179
|
-
selectedId={
|
|
217
|
+
selectedId={currentValue}
|
|
180
218
|
index={index}
|
|
181
219
|
LinkRouter={ItemLinkRouter}
|
|
182
220
|
linkRouterProps={{ ...linkRouterProps, ...itemLinkRouterProps }}
|
|
183
|
-
items={
|
|
184
|
-
selected={itemId ===
|
|
221
|
+
items={scrollableNestedItems}
|
|
222
|
+
selected={itemId === currentValue}
|
|
185
223
|
itemsContainerRef={itemsRef}
|
|
186
224
|
{...itemRest}
|
|
187
|
-
{...(
|
|
188
|
-
{...(
|
|
225
|
+
{...(scrollableNestedItems && { isOpen })}
|
|
226
|
+
{...(scrollableNestedItems && isOpen && { openOverlayRef })}
|
|
189
227
|
>
|
|
190
228
|
{label}
|
|
191
229
|
</ItemComponent>
|
|
@@ -207,7 +245,7 @@ NavigationBar.propTypes = {
|
|
|
207
245
|
*
|
|
208
246
|
* Each `item` object must contain:
|
|
209
247
|
* - `heading` - user-facing text in the tab link
|
|
210
|
-
* - `href` - the URL of the page linked to.
|
|
248
|
+
* - `href` - the URL of the page linked to.
|
|
211
249
|
* - `id` - a stable, unique identifier of the page within the set. Not written into the HTML.
|
|
212
250
|
*/
|
|
213
251
|
items: PropTypes.arrayOf(
|
|
@@ -242,13 +280,17 @@ NavigationBar.propTypes = {
|
|
|
242
280
|
*/
|
|
243
281
|
headingLevel: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6']),
|
|
244
282
|
/**
|
|
245
|
-
*
|
|
283
|
+
* Initial selected item ID
|
|
246
284
|
*/
|
|
247
|
-
selectedId: PropTypes.string
|
|
285
|
+
selectedId: PropTypes.string,
|
|
248
286
|
/**
|
|
249
287
|
* Optional function to be called on pressing a link
|
|
250
288
|
*/
|
|
251
289
|
onChange: PropTypes.func,
|
|
290
|
+
/**
|
|
291
|
+
* Controlled value for selected item ID
|
|
292
|
+
*/
|
|
293
|
+
value: PropTypes.string,
|
|
252
294
|
/**
|
|
253
295
|
* Accesibility role for stackview
|
|
254
296
|
*/
|
|
@@ -8,8 +8,9 @@ import {
|
|
|
8
8
|
useThemeTokensCallback,
|
|
9
9
|
getTokensPropType
|
|
10
10
|
} from '@telus-uds/components-base'
|
|
11
|
-
import
|
|
12
|
-
|
|
11
|
+
import { htmlAttrs, styledComponents } from '../utils'
|
|
12
|
+
|
|
13
|
+
const { styled } = styledComponents
|
|
13
14
|
|
|
14
15
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
15
16
|
|
package/src/OrderedList/Item.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
|
applyTextStyles,
|
|
6
5
|
getTokensPropType,
|
|
@@ -12,9 +11,11 @@ import {
|
|
|
12
11
|
wrapStringsInText
|
|
13
12
|
} from '@telus-uds/components-base'
|
|
14
13
|
import ItemBase from './ItemBase'
|
|
15
|
-
import { htmlAttrs } from '../utils'
|
|
14
|
+
import { htmlAttrs, styledComponents } from '../utils'
|
|
16
15
|
import { OL_COUNTER_NAME } from './constants'
|
|
17
16
|
|
|
17
|
+
const { styled } = styledComponents
|
|
18
|
+
|
|
18
19
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
19
20
|
|
|
20
21
|
const selectItemTextStyles = (
|
|
@@ -70,7 +71,7 @@ const StyledItemBase = styled(ItemBase)(
|
|
|
70
71
|
const ItemContent = styled.div({
|
|
71
72
|
display: 'flex',
|
|
72
73
|
flexDirection: 'column',
|
|
73
|
-
gap:
|
|
74
|
+
gap: 0
|
|
74
75
|
})
|
|
75
76
|
|
|
76
77
|
const Item = React.forwardRef(
|
|
@@ -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 { getTokensPropType, selectSystemProps, variantProp } from '@telus-uds/components-base'
|
|
5
|
-
import { htmlAttrs } from '../utils'
|
|
4
|
+
import { htmlAttrs, styledComponents } from '../utils'
|
|
6
5
|
import OrderedListBase from './OrderedListBase'
|
|
7
6
|
import Item from './Item'
|
|
8
7
|
import { OL_COUNTER_NAME } from './constants'
|
|
9
8
|
|
|
9
|
+
const { styled } = styledComponents
|
|
10
|
+
|
|
10
11
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
11
12
|
|
|
12
13
|
const StyledOrderedListBase = styled(OrderedListBase)(({ start }) => ({
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
|
-
import
|
|
3
|
+
import { styledComponents } from '../utils'
|
|
4
4
|
import ItemBase from './ItemBase'
|
|
5
5
|
|
|
6
|
+
const { styled } = styledComponents
|
|
7
|
+
|
|
6
8
|
const StyledList = styled.ol({
|
|
7
9
|
display: 'flex',
|
|
8
10
|
flexDirection: 'column',
|
|
@@ -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 { getTokensPropType, selectSystemProps } from '@telus-uds/components-base'
|
|
5
4
|
|
|
6
|
-
import { htmlAttrs, useTypographyTheme } from '../utils'
|
|
5
|
+
import { htmlAttrs, useTypographyTheme, styledComponents } from '../utils'
|
|
6
|
+
|
|
7
|
+
const { styled } = styledComponents
|
|
7
8
|
|
|
8
9
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
9
10
|
|
|
@@ -17,13 +17,15 @@ import {
|
|
|
17
17
|
useTheme,
|
|
18
18
|
getTokensPropType
|
|
19
19
|
} from '@telus-uds/components-base'
|
|
20
|
-
import
|
|
20
|
+
import { styledComponents } from '../utils'
|
|
21
21
|
import FullBleedContent, {
|
|
22
22
|
getFullBleedBorderRadius,
|
|
23
23
|
useFullBleedContentProps
|
|
24
24
|
} from '../shared/FullBleedContent'
|
|
25
25
|
import AuthorDate from './AuthorDate'
|
|
26
26
|
|
|
27
|
+
const { styled } = styledComponents
|
|
28
|
+
|
|
27
29
|
// Passes React Native-oriented system props through UDS PressableCardBase
|
|
28
30
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([
|
|
29
31
|
a11yProps,
|
|
@@ -9,10 +9,11 @@ import {
|
|
|
9
9
|
useViewport,
|
|
10
10
|
getTokensPropType
|
|
11
11
|
} from '@telus-uds/components-base'
|
|
12
|
-
import styled from 'styled-components'
|
|
13
12
|
import FootnoteLink from '../Footnote/FootnoteLink'
|
|
14
13
|
import getTypographyTokens from './tokens'
|
|
15
|
-
import { htmlAttrs, warn } from '../utils'
|
|
14
|
+
import { htmlAttrs, warn, styledComponents } from '../utils'
|
|
15
|
+
|
|
16
|
+
const { styled } = styledComponents
|
|
16
17
|
|
|
17
18
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
18
19
|
|
|
@@ -10,7 +10,9 @@ import {
|
|
|
10
10
|
variantProp,
|
|
11
11
|
applyShadowToken
|
|
12
12
|
} from '@telus-uds/components-base'
|
|
13
|
-
import
|
|
13
|
+
import { styledComponents } from '../utils'
|
|
14
|
+
|
|
15
|
+
const { styled } = styledComponents
|
|
14
16
|
|
|
15
17
|
// Passes React Native-oriented system props through UDS Progress
|
|
16
18
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps])
|
|
@@ -14,9 +14,12 @@ const staticStyles = {
|
|
|
14
14
|
* Provide different image sources for different screen sizes.
|
|
15
15
|
*/
|
|
16
16
|
const ResponsiveImage = React.forwardRef(
|
|
17
|
-
(
|
|
17
|
+
(
|
|
18
|
+
{ xsSrc, smSrc, mdSrc, lgSrc, xlSrc, fallbackSrc, alt, loading = 'eager', dataSet, ...rest },
|
|
19
|
+
ref
|
|
20
|
+
) => {
|
|
18
21
|
return (
|
|
19
|
-
<picture {...selectProps(rest)} ref={ref}>
|
|
22
|
+
<picture {...selectProps(rest)} ref={ref} {...dataSet}>
|
|
20
23
|
<source srcSet={xlSrc} media={`(min-width: ${viewports.map.get(viewports.xl)}px)`} />
|
|
21
24
|
<source srcSet={lgSrc} media={`(min-width: ${viewports.map.get(viewports.lg)}px)`} />
|
|
22
25
|
<source srcSet={mdSrc} media={`(min-width: ${viewports.map.get(viewports.md)}px)`} />
|
|
@@ -65,7 +68,11 @@ ResponsiveImage.propTypes = {
|
|
|
65
68
|
* @default 'eager'
|
|
66
69
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading
|
|
67
70
|
*/
|
|
68
|
-
loading: PropTypes.oneOf(['eager', 'lazy'])
|
|
71
|
+
loading: PropTypes.oneOf(['eager', 'lazy']),
|
|
72
|
+
/**
|
|
73
|
+
* The dataSet prop allows to pass data-* attributes element to the component.
|
|
74
|
+
*/
|
|
75
|
+
dataSet: PropTypes.object
|
|
69
76
|
}
|
|
70
77
|
|
|
71
78
|
export default ResponsiveImage
|
package/src/Ribbon/Ribbon.jsx
CHANGED
|
@@ -6,8 +6,9 @@ import {
|
|
|
6
6
|
useThemeTokens,
|
|
7
7
|
getTokensPropType
|
|
8
8
|
} from '@telus-uds/components-base'
|
|
9
|
-
import
|
|
10
|
-
|
|
9
|
+
import { htmlAttrs, styledComponents } from '../utils'
|
|
10
|
+
|
|
11
|
+
const { styled } = styledComponents
|
|
11
12
|
|
|
12
13
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
13
14
|
|
package/src/Span/Span.jsx
CHANGED
|
@@ -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 { getTokensPropType, selectSystemProps } from '@telus-uds/components-base'
|
|
5
4
|
|
|
6
|
-
import { htmlAttrs, useTypographyTheme } from '../utils'
|
|
5
|
+
import { htmlAttrs, useTypographyTheme, styledComponents } from '../utils'
|
|
6
|
+
|
|
7
|
+
const { styled } = styledComponents
|
|
7
8
|
|
|
8
9
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
9
10
|
|
package/src/Spinner/Spinner.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
|
useScrollBlocking,
|
|
@@ -9,9 +8,11 @@ import {
|
|
|
9
8
|
} from '@telus-uds/components-base'
|
|
10
9
|
import { Portal } from '@gorhom/portal'
|
|
11
10
|
import SpinnerContent from './SpinnerContent'
|
|
12
|
-
import { htmlAttrs, media } from '../utils'
|
|
11
|
+
import { htmlAttrs, media, styledComponents } from '../utils'
|
|
13
12
|
import { BACKDROP_OPACITY, BACKDROP_Z_INDEX } from './constants'
|
|
14
13
|
|
|
14
|
+
const { styled } = styledComponents
|
|
15
|
+
|
|
15
16
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
16
17
|
|
|
17
18
|
const SpinnerContainer = styled.div(({ inline, fullScreen }) => ({
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
|
-
import styled from 'styled-components'
|
|
4
3
|
import {
|
|
5
4
|
ActivityIndicator,
|
|
6
5
|
StackView,
|
|
7
6
|
Typography,
|
|
8
7
|
selectSystemProps
|
|
9
8
|
} from '@telus-uds/components-base'
|
|
10
|
-
import { htmlAttrs } from '../utils'
|
|
9
|
+
import { htmlAttrs, styledComponents } from '../utils'
|
|
11
10
|
import { BACKDROP_Z_INDEX, LARGE } from './constants'
|
|
12
11
|
|
|
12
|
+
const { styled } = styledComponents
|
|
13
|
+
|
|
13
14
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
14
15
|
|
|
15
16
|
const Container = styled.div(({ overlay }) => ({
|
|
@@ -18,12 +18,14 @@ import {
|
|
|
18
18
|
useThemeTokensCallback,
|
|
19
19
|
getTokensPropType
|
|
20
20
|
} from '@telus-uds/components-base'
|
|
21
|
-
import
|
|
21
|
+
import { styledComponents } from '../utils'
|
|
22
22
|
import FullBleedContent, {
|
|
23
23
|
getFullBleedBorderRadius,
|
|
24
24
|
useFullBleedContentProps
|
|
25
25
|
} from '../shared/FullBleedContent'
|
|
26
26
|
|
|
27
|
+
const { styled } = styledComponents
|
|
28
|
+
|
|
27
29
|
// Passes React Native-oriented system props through UDS PressableCardBase
|
|
28
30
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([
|
|
29
31
|
a11yProps,
|