@telus-uds/components-web 2.33.2 → 2.34.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 +29 -3
- package/lib/Badge/Badge.js +4 -2
- package/lib/BlockQuote/BlockQuote.js +4 -2
- package/lib/Breadcrumbs/Breadcrumbs.js +7 -5
- package/lib/Breadcrumbs/Item/Item.js +2 -13
- package/lib/Callout/Callout.js +4 -2
- package/lib/Card/Card.js +3 -5
- package/lib/Card/CardContent.js +4 -2
- package/lib/Countdown/Countdown.js +2 -6
- package/lib/Countdown/Segment.js +4 -2
- package/lib/DatePicker/CalendarContainer.js +2 -2
- package/lib/DatePicker/DatePicker.js +21 -35
- package/lib/Disclaimer/Disclaimer.js +4 -2
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +5 -11
- package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +4 -2
- package/lib/Footnote/Footnote.js +32 -37
- package/lib/Footnote/FootnoteLink.js +9 -6
- package/lib/IconButton/IconButton.js +4 -11
- package/lib/Image/Image.js +5 -3
- package/lib/List/ListItem.js +2 -7
- package/lib/NavigationBar/NavigationBar.js +8 -18
- package/lib/NavigationBar/NavigationItem.js +4 -9
- package/lib/NavigationBar/NavigationSubMenu.js +8 -7
- package/lib/NavigationBar/index.js +2 -0
- package/lib/OptimizeImage/OptimizeImage.js +8 -8
- package/lib/OrderedList/Item.js +3 -9
- package/lib/OrderedList/OrderedList.js +5 -13
- package/lib/OrderedList/OrderedListBase.js +3 -8
- package/lib/Paragraph/Paragraph.js +5 -3
- package/lib/PreviewCard/PreviewCard.js +3 -5
- package/lib/PriceLockup/PriceLockup.js +4 -2
- package/lib/Progress/ProgressBar.js +4 -2
- package/lib/QuantitySelector/QuantitySelector.js +21 -24
- package/lib/QuantitySelector/SideButton.js +12 -20
- package/lib/ResponsiveImage/ResponsiveImage.js +4 -2
- package/lib/Ribbon/Ribbon.js +4 -2
- package/lib/SkeletonProvider/SkeletonImage.js +5 -3
- package/lib/SkeletonProvider/SkeletonProvider.js +3 -5
- package/lib/SkeletonProvider/SkeletonTypography.js +5 -3
- package/lib/Span/Span.js +5 -3
- package/lib/Spinner/Spinner.js +4 -2
- package/lib/Spinner/SpinnerContent.js +4 -2
- package/lib/StoryCard/StoryCard.js +3 -5
- package/lib/Table/Body.js +4 -2
- package/lib/Table/Cell.js +5 -3
- package/lib/Table/Header.js +6 -6
- package/lib/Table/Row.js +6 -6
- package/lib/Table/SubHeading.js +6 -6
- package/lib/Table/Table.js +6 -8
- package/lib/TermsAndConditions/ExpandCollapse.js +2 -7
- package/lib/TermsAndConditions/TermsAndConditions.js +5 -14
- package/lib/Testimonial/Testimonial.js +4 -2
- package/lib/Toast/Toast.js +4 -2
- package/lib/Video/Video.js +19 -55
- package/lib/VideoPicker/VideoPicker.js +38 -9
- package/lib/VideoPicker/VideoPickerPlayer.js +4 -2
- package/lib/VideoPicker/VideoPickerThumbnail.js +4 -2
- package/lib/VideoPicker/VideoSlider.js +7 -7
- package/lib/WaffleGrid/WaffleGrid.js +4 -2
- package/lib/WebVideo/WebVideo.js +51 -13
- package/lib/WebVideo/utils/index.js +58 -0
- package/lib/baseExports.js +6 -0
- package/lib/utils/theming/with-client-theme.js +1 -1
- package/lib/utils/theming/with-server-theme.js +1 -1
- package/lib-module/Badge/Badge.js +4 -2
- package/lib-module/BlockQuote/BlockQuote.js +4 -2
- package/lib-module/Breadcrumbs/Breadcrumbs.js +7 -5
- package/lib-module/Breadcrumbs/Item/Item.js +2 -11
- package/lib-module/Callout/Callout.js +4 -2
- package/lib-module/Card/Card.js +2 -3
- package/lib-module/Card/CardContent.js +4 -2
- package/lib-module/Countdown/Countdown.js +2 -3
- package/lib-module/Countdown/Segment.js +4 -2
- package/lib-module/DatePicker/CalendarContainer.js +2 -2
- package/lib-module/DatePicker/DatePicker.js +21 -33
- package/lib-module/Disclaimer/Disclaimer.js +4 -2
- package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +5 -9
- package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +4 -2
- package/lib-module/Footnote/Footnote.js +31 -36
- package/lib-module/Footnote/FootnoteLink.js +9 -7
- package/lib-module/IconButton/IconButton.js +4 -9
- package/lib-module/Image/Image.js +5 -3
- package/lib-module/List/ListItem.js +2 -5
- package/lib-module/NavigationBar/NavigationBar.js +9 -17
- package/lib-module/NavigationBar/NavigationItem.js +5 -8
- package/lib-module/NavigationBar/NavigationSubMenu.js +9 -6
- package/lib-module/NavigationBar/index.js +2 -0
- package/lib-module/OptimizeImage/OptimizeImage.js +8 -6
- package/lib-module/OrderedList/Item.js +3 -7
- package/lib-module/OrderedList/OrderedList.js +6 -12
- package/lib-module/OrderedList/OrderedListBase.js +3 -6
- package/lib-module/Paragraph/Paragraph.js +6 -4
- package/lib-module/PreviewCard/PreviewCard.js +2 -3
- package/lib-module/PriceLockup/PriceLockup.js +4 -2
- package/lib-module/Progress/ProgressBar.js +4 -2
- package/lib-module/QuantitySelector/QuantitySelector.js +22 -23
- package/lib-module/QuantitySelector/SideButton.js +13 -21
- package/lib-module/ResponsiveImage/ResponsiveImage.js +4 -2
- package/lib-module/Ribbon/Ribbon.js +4 -2
- package/lib-module/SkeletonProvider/SkeletonImage.js +5 -3
- package/lib-module/SkeletonProvider/SkeletonProvider.js +3 -3
- package/lib-module/SkeletonProvider/SkeletonTypography.js +5 -3
- package/lib-module/Span/Span.js +6 -4
- package/lib-module/Spinner/Spinner.js +4 -2
- package/lib-module/Spinner/SpinnerContent.js +4 -2
- package/lib-module/StoryCard/StoryCard.js +2 -3
- package/lib-module/Table/Body.js +4 -2
- package/lib-module/Table/Cell.js +5 -3
- package/lib-module/Table/Header.js +6 -4
- package/lib-module/Table/Row.js +6 -4
- package/lib-module/Table/SubHeading.js +6 -4
- package/lib-module/Table/Table.js +6 -6
- package/lib-module/TermsAndConditions/ExpandCollapse.js +2 -5
- package/lib-module/TermsAndConditions/TermsAndConditions.js +5 -12
- package/lib-module/Testimonial/Testimonial.js +4 -2
- package/lib-module/Toast/Toast.js +4 -2
- package/lib-module/Video/Video.js +19 -53
- package/lib-module/VideoPicker/VideoPicker.js +37 -8
- package/lib-module/VideoPicker/VideoPickerPlayer.js +4 -2
- package/lib-module/VideoPicker/VideoPickerThumbnail.js +4 -2
- package/lib-module/VideoPicker/VideoSlider.js +7 -5
- package/lib-module/WaffleGrid/WaffleGrid.js +4 -2
- package/lib-module/WebVideo/WebVideo.js +51 -11
- package/lib-module/WebVideo/utils/index.js +50 -0
- package/lib-module/baseExports.js +1 -1
- package/lib-module/utils/theming/with-client-theme.js +2 -2
- package/lib-module/utils/theming/with-server-theme.js +2 -2
- package/package.json +3 -3
- package/src/Badge/Badge.jsx +5 -2
- package/src/BlockQuote/BlockQuote.jsx +120 -112
- package/src/Breadcrumbs/Breadcrumbs.jsx +84 -77
- package/src/Breadcrumbs/Item/Item.jsx +2 -9
- package/src/Callout/Callout.jsx +37 -40
- package/src/Card/Card.jsx +2 -3
- package/src/Card/CardContent.jsx +19 -14
- package/src/Countdown/Countdown.jsx +72 -71
- package/src/Countdown/Segment.jsx +40 -28
- package/src/DatePicker/CalendarContainer.jsx +2 -2
- package/src/DatePicker/DatePicker.jsx +21 -34
- package/src/Disclaimer/Disclaimer.jsx +5 -3
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +37 -40
- package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +52 -44
- package/src/Footnote/Footnote.jsx +32 -38
- package/src/Footnote/FootnoteLink.jsx +45 -49
- package/src/IconButton/IconButton.jsx +19 -20
- package/src/Image/Image.jsx +40 -43
- package/src/List/ListItem.jsx +3 -5
- package/src/NavigationBar/NavigationBar.jsx +9 -18
- package/src/NavigationBar/NavigationItem.jsx +6 -5
- package/src/NavigationBar/NavigationSubMenu.jsx +104 -88
- package/src/NavigationBar/index.js +3 -0
- package/src/OptimizeImage/OptimizeImage.jsx +48 -41
- package/src/OrderedList/Item.jsx +34 -35
- package/src/OrderedList/OrderedList.jsx +4 -6
- package/src/OrderedList/OrderedListBase.jsx +2 -3
- package/src/Paragraph/Paragraph.jsx +21 -16
- package/src/PreviewCard/PreviewCard.jsx +2 -3
- package/src/PriceLockup/PriceLockup.jsx +143 -136
- package/src/Progress/ProgressBar.jsx +11 -3
- package/src/QuantitySelector/QuantitySelector.jsx +162 -154
- package/src/QuantitySelector/SideButton.jsx +52 -56
- package/src/ResponsiveImage/ResponsiveImage.jsx +16 -22
- package/src/Ribbon/Ribbon.jsx +85 -83
- package/src/SkeletonProvider/SkeletonImage.jsx +24 -15
- package/src/SkeletonProvider/SkeletonProvider.jsx +3 -3
- package/src/SkeletonProvider/SkeletonTypography.jsx +18 -13
- package/src/Span/Span.jsx +7 -5
- package/src/Spinner/Spinner.jsx +86 -79
- package/src/Spinner/SpinnerContent.jsx +31 -33
- package/src/StoryCard/StoryCard.jsx +2 -3
- package/src/Table/Body.jsx +5 -3
- package/src/Table/Cell.jsx +77 -67
- package/src/Table/Header.jsx +7 -5
- package/src/Table/Row.jsx +7 -5
- package/src/Table/SubHeading.jsx +7 -5
- package/src/Table/Table.jsx +6 -6
- package/src/TermsAndConditions/ExpandCollapse.jsx +2 -6
- package/src/TermsAndConditions/TermsAndConditions.jsx +5 -13
- package/src/Testimonial/Testimonial.jsx +148 -137
- package/src/Toast/Toast.jsx +68 -63
- package/src/Video/Video.jsx +25 -45
- package/src/VideoPicker/VideoPicker.jsx +114 -75
- package/src/VideoPicker/VideoPickerPlayer.jsx +13 -9
- package/src/VideoPicker/VideoPickerThumbnail.jsx +102 -94
- package/src/VideoPicker/VideoSlider.jsx +8 -6
- package/src/WaffleGrid/WaffleGrid.jsx +36 -40
- package/src/WebVideo/WebVideo.jsx +114 -60
- package/src/WebVideo/utils/index.js +56 -0
- package/src/baseExports.js +1 -0
- package/src/utils/theming/with-client-theme.jsx +2 -2
- package/src/utils/theming/with-server-theme.jsx +2 -2
- package/types/WebVideo.d.ts +2 -1
|
@@ -102,91 +102,98 @@ const getStructuredData = (items, baseUrl) => {
|
|
|
102
102
|
/**
|
|
103
103
|
* Display a hierarchy of links, commonly used for navigation.
|
|
104
104
|
*/
|
|
105
|
-
const Breadcrumbs = (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
105
|
+
const Breadcrumbs = React.forwardRef(
|
|
106
|
+
(
|
|
107
|
+
{
|
|
108
|
+
baseUrl,
|
|
109
|
+
children,
|
|
110
|
+
linkRouterProps,
|
|
111
|
+
params = {},
|
|
112
|
+
tokens,
|
|
113
|
+
routes,
|
|
114
|
+
variant,
|
|
115
|
+
LinkRouter,
|
|
116
|
+
...rest
|
|
117
|
+
},
|
|
118
|
+
ref
|
|
119
|
+
) => {
|
|
120
|
+
// React Helmet can cause a memory leak in SSR if not properly configured.
|
|
121
|
+
// Only run it in SSR if theme options tells us to.
|
|
122
|
+
/* const {
|
|
119
123
|
themeOptions: { enableHelmetSSR }
|
|
120
124
|
} = useTheme() */
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
125
|
+
// const isHydrating = useHydrationContext()
|
|
126
|
+
// const isSSR = typeof window === 'undefined' || isHydrating
|
|
127
|
+
// const hasMetadata = isSSR ? enableHelmetSSR : true
|
|
128
|
+
const helmetContext = {}
|
|
129
|
+
|
|
130
|
+
const activeRoutes = children
|
|
131
|
+
? React.Children.map(
|
|
132
|
+
unpackFragment(children),
|
|
133
|
+
({ props: { href, children: breadcrumbName, ...itemRest }, ref: routeRef }) => ({
|
|
134
|
+
path: href,
|
|
135
|
+
breadcrumbName,
|
|
136
|
+
routeRef,
|
|
137
|
+
...itemRest
|
|
138
|
+
})
|
|
139
|
+
)
|
|
140
|
+
: routes.filter((route) => route.path && route.breadcrumbName)
|
|
141
|
+
|
|
142
|
+
const items = getItems(activeRoutes, params, !children)
|
|
143
|
+
const themeTokens = useThemeTokens('Breadcrumbs', tokens, variant)
|
|
144
|
+
|
|
145
|
+
const metadata = (
|
|
146
|
+
<HelmetProvider context={helmetContext}>
|
|
147
|
+
<Helmet>
|
|
148
|
+
<script type="application/ld+json">
|
|
149
|
+
{`
|
|
146
150
|
{
|
|
147
151
|
"@context": "http://schema.org",
|
|
148
152
|
"@type": "BreadcrumbList",
|
|
149
153
|
"itemListElement": ${JSON.stringify(getStructuredData(items, baseUrl))}
|
|
150
154
|
}
|
|
151
155
|
`}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
156
|
+
</script>
|
|
157
|
+
</Helmet>
|
|
158
|
+
</HelmetProvider>
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<nav aria-label="Breadcrumb" ref={ref} {...selectProps(rest)}>
|
|
163
|
+
<StyledList iconContainerSize={themeTokens.iconContainerSize}>
|
|
164
|
+
{items.map(
|
|
165
|
+
({
|
|
166
|
+
href,
|
|
167
|
+
current,
|
|
168
|
+
breadcrumbName,
|
|
169
|
+
LinkRouter: ItemLinkRouter = LinkRouter,
|
|
170
|
+
linkRouterProps: itemLinkRouterProps,
|
|
171
|
+
...itemRest
|
|
172
|
+
}) => {
|
|
173
|
+
return (
|
|
174
|
+
<Item
|
|
175
|
+
{...itemRest}
|
|
176
|
+
current={current}
|
|
177
|
+
href={href}
|
|
178
|
+
tokens={tokens}
|
|
179
|
+
key={href}
|
|
180
|
+
linkRouterProps={{ ...linkRouterProps, ...itemLinkRouterProps }}
|
|
181
|
+
variant={{ ...variant, size: 'micro' }}
|
|
182
|
+
LinkRouter={ItemLinkRouter}
|
|
183
|
+
>
|
|
184
|
+
{breadcrumbName}
|
|
185
|
+
</Item>
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
)}
|
|
189
|
+
</StyledList>
|
|
190
|
+
{metadata}
|
|
191
|
+
</nav>
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
Breadcrumbs.displayName = 'Breadcrumbs'
|
|
190
197
|
|
|
191
198
|
Breadcrumbs.propTypes = {
|
|
192
199
|
...selectedSystemPropTypes,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import styled from 'styled-components'
|
|
4
4
|
import {
|
|
@@ -32,7 +32,7 @@ const IconContainer = styled.span({
|
|
|
32
32
|
width: ({ iconContainerSize, iconPadding }) => `${iconContainerSize + iconPadding * 2}px`
|
|
33
33
|
})
|
|
34
34
|
|
|
35
|
-
const Item = forwardRef(
|
|
35
|
+
const Item = React.forwardRef(
|
|
36
36
|
(
|
|
37
37
|
{
|
|
38
38
|
href,
|
|
@@ -134,11 +134,4 @@ Item.propTypes = {
|
|
|
134
134
|
variant: PropTypes.shape({ inverse: PropTypes.bool })
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
// Since react/require-default-props eslint rule doesn't pick up default arguments as default props when combined with `forwardRef`
|
|
138
|
-
// - probably related https://github.com/yannickcr/eslint-plugin-react/issues/2760
|
|
139
|
-
Item.defaultProps = {
|
|
140
|
-
current: false,
|
|
141
|
-
variant: { light: true }
|
|
142
|
-
}
|
|
143
|
-
|
|
144
137
|
export default Item
|
package/src/Callout/Callout.jsx
CHANGED
|
@@ -52,48 +52,45 @@ const CalloutContainer = styled.div(
|
|
|
52
52
|
})
|
|
53
53
|
)
|
|
54
54
|
|
|
55
|
-
const Callout = (
|
|
56
|
-
icon,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
borderRadius,
|
|
68
|
-
paddingLeft,
|
|
69
|
-
paddingRight,
|
|
70
|
-
paddingTop,
|
|
71
|
-
paddingBottom,
|
|
72
|
-
color
|
|
73
|
-
} = useThemeTokens('Callout', tokens, variant)
|
|
55
|
+
const Callout = React.forwardRef(
|
|
56
|
+
({ icon, children, verticalAlign, textAlignToFlex, tokens, variant = {}, ...rest }, ref) => {
|
|
57
|
+
const {
|
|
58
|
+
background,
|
|
59
|
+
gap,
|
|
60
|
+
borderRadius,
|
|
61
|
+
paddingLeft,
|
|
62
|
+
paddingRight,
|
|
63
|
+
paddingTop,
|
|
64
|
+
paddingBottom,
|
|
65
|
+
color
|
|
66
|
+
} = useThemeTokens('Callout', tokens, variant)
|
|
74
67
|
|
|
75
|
-
|
|
68
|
+
const { rounded = false, size = 'medium' } = variant
|
|
76
69
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
{
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
70
|
+
return (
|
|
71
|
+
<CalloutContainer
|
|
72
|
+
size={size}
|
|
73
|
+
rounded={rounded}
|
|
74
|
+
data-testid="callout-container"
|
|
75
|
+
verticalAlign={verticalAlign}
|
|
76
|
+
textAlignToFlex={textAlignToFlex}
|
|
77
|
+
background={background}
|
|
78
|
+
gap={gap}
|
|
79
|
+
borderRadius={borderRadius}
|
|
80
|
+
padding={`${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`}
|
|
81
|
+
ref={ref}
|
|
82
|
+
{...selectProps(rest)}
|
|
83
|
+
>
|
|
84
|
+
{icon && <Icon tokens={{ color }} icon={icon} variant={{ rank: 'primary', size }} />}
|
|
85
|
+
<Typography variant={{ size, compact: size === 'small' }} tokens={{ color }}>
|
|
86
|
+
{children}
|
|
87
|
+
</Typography>
|
|
88
|
+
</CalloutContainer>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
Callout.displayName = 'Callout'
|
|
97
94
|
|
|
98
95
|
Callout.propTypes = {
|
|
99
96
|
...selectedSystemPropTypes,
|
package/src/Card/Card.jsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import React, { forwardRef } from 'react'
|
|
1
|
+
import React from 'react'
|
|
3
2
|
import PropTypes from 'prop-types'
|
|
4
3
|
import {
|
|
5
4
|
Card as CardBase,
|
|
@@ -53,7 +52,7 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
|
|
|
53
52
|
* ## Accessibility
|
|
54
53
|
* `Card` component accepts all the standard accessibility props.
|
|
55
54
|
*/
|
|
56
|
-
const Card = forwardRef(
|
|
55
|
+
const Card = React.forwardRef(
|
|
57
56
|
(
|
|
58
57
|
{
|
|
59
58
|
children,
|
package/src/Card/CardContent.jsx
CHANGED
|
@@ -48,21 +48,26 @@ const CardContentContainer = styled.div(
|
|
|
48
48
|
/**
|
|
49
49
|
* Card content, applying the card tokens as per the theme used.
|
|
50
50
|
*/
|
|
51
|
-
const CardContent = (
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
const CardContent = React.forwardRef(
|
|
52
|
+
({ children, flexContent, tokens, variant, withFooter = false, ...rest }, ref) => {
|
|
53
|
+
const viewport = useViewport()
|
|
54
|
+
const themeTokens = useThemeTokens('Card', tokens, variant, { viewport })
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
return (
|
|
57
|
+
<CardContentContainer
|
|
58
|
+
{...themeTokens}
|
|
59
|
+
flexContent={flexContent}
|
|
60
|
+
withFooter={withFooter}
|
|
61
|
+
ref={ref}
|
|
62
|
+
{...selectProps(rest)}
|
|
63
|
+
>
|
|
64
|
+
{children}
|
|
65
|
+
</CardContentContainer>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
CardContent.displayName = 'CardContent'
|
|
66
71
|
|
|
67
72
|
CardContent.propTypes = {
|
|
68
73
|
...selectedSystemPropTypes,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import React, { forwardRef } from 'react'
|
|
1
|
+
import React from 'react'
|
|
3
2
|
import PropTypes from 'prop-types'
|
|
4
3
|
import {
|
|
5
4
|
Spacer,
|
|
@@ -64,78 +63,80 @@ const getMainTextTokens = ({
|
|
|
64
63
|
fontName: textTimerFontName
|
|
65
64
|
})
|
|
66
65
|
|
|
67
|
-
const Countdown = forwardRef(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
66
|
+
const Countdown = React.forwardRef(
|
|
67
|
+
({ copy = 'en', targetTime, tokens, variant = {}, ...rest }, ref) => {
|
|
68
|
+
const [days, hours, minutes, seconds] = useCountdown(targetTime)
|
|
69
|
+
const viewport = useViewport()
|
|
70
|
+
const { feature, large, label, noDivider } = variant
|
|
71
|
+
if (noDivider && !label) {
|
|
72
|
+
throw new Error('`noDivider` variant can only be used with `label` enabled!')
|
|
73
|
+
}
|
|
74
|
+
const themeTokens = useThemeTokens('Countdown', tokens, variant, { viewport })
|
|
75
|
+
const segmentFontSize = themeTokens.textFontSize
|
|
76
|
+
const semanticGradient =
|
|
77
|
+
themeTokens.containerGradient && transformGradient(themeTokens.containerGradient)
|
|
78
|
+
const mainTextTokens = getMainTextTokens(themeTokens)
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
80
|
+
const divider =
|
|
81
|
+
noDivider === true ? (
|
|
82
|
+
// StackView-based subcontainer adds a 1-step space on the each side of the divider
|
|
83
|
+
<Spacer direction="row" space={(feature || large) && viewport !== viewports.xs ? 4 : 1} />
|
|
84
|
+
) : (
|
|
85
|
+
<Typography tokens={mainTextTokens}>:</Typography>
|
|
86
|
+
)
|
|
87
|
+
const labelTokens = getLabelTokens(themeTokens)
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
89
|
+
const segmentProps = {
|
|
90
|
+
copy,
|
|
91
|
+
labelTokens,
|
|
92
|
+
numberTokens: mainTextTokens,
|
|
93
|
+
segmentFontSize,
|
|
94
|
+
variant
|
|
95
|
+
}
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
97
|
+
return (
|
|
98
|
+
// Making it focusable for accessibility purposes
|
|
99
|
+
<Container
|
|
100
|
+
ref={ref}
|
|
101
|
+
variant={variant}
|
|
102
|
+
{...selectProps(rest)}
|
|
103
|
+
tabIndex={0}
|
|
104
|
+
themeTokens={themeTokens}
|
|
105
|
+
gradient={semanticGradient}
|
|
106
|
+
>
|
|
107
|
+
<StackView direction="row" space={1}>
|
|
108
|
+
<Segment
|
|
109
|
+
labelKey="day"
|
|
110
|
+
number={days}
|
|
111
|
+
segmentWidth={String(days).length}
|
|
112
|
+
{...segmentProps}
|
|
113
|
+
/>
|
|
114
|
+
{divider}
|
|
115
|
+
<Segment
|
|
116
|
+
labelKey="hour"
|
|
117
|
+
number={hours}
|
|
118
|
+
{...segmentProps}
|
|
119
|
+
{...applyTextStyles(themeTokens)}
|
|
120
|
+
/>
|
|
121
|
+
{divider}
|
|
122
|
+
<Segment
|
|
123
|
+
labelKey="minute"
|
|
124
|
+
number={minutes}
|
|
125
|
+
{...segmentProps}
|
|
126
|
+
{...applyTextStyles(themeTokens)}
|
|
127
|
+
/>
|
|
128
|
+
{divider}
|
|
129
|
+
<Segment
|
|
130
|
+
labelKey="second"
|
|
131
|
+
number={seconds}
|
|
132
|
+
{...segmentProps}
|
|
133
|
+
{...applyTextStyles(themeTokens)}
|
|
134
|
+
/>
|
|
135
|
+
</StackView>
|
|
136
|
+
</Container>
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
)
|
|
139
140
|
Countdown.displayName = 'Countdown'
|
|
140
141
|
|
|
141
142
|
Countdown.propTypes = {
|
|
@@ -22,36 +22,48 @@ const Container = styled.div(({ segmentFontSize, segmentWidth = 2, variant: { fe
|
|
|
22
22
|
// A segment of the countdown string: we need to make sure it
|
|
23
23
|
// keeps its width constant to prevent the whole component from
|
|
24
24
|
// being automatically resized while using variable size fonts
|
|
25
|
-
const Segment = (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
const Segment = React.forwardRef(
|
|
26
|
+
(
|
|
27
|
+
{
|
|
28
|
+
copy = 'en',
|
|
29
|
+
segmentFontSize,
|
|
30
|
+
labelKey,
|
|
31
|
+
labelTokens,
|
|
32
|
+
number,
|
|
33
|
+
numberTokens,
|
|
34
|
+
segmentWidth = 2,
|
|
35
|
+
variant = {}
|
|
36
|
+
},
|
|
37
|
+
ref
|
|
38
|
+
) => {
|
|
39
|
+
const getCopy = useCopy({ dictionary, copy })
|
|
40
|
+
const { label, large, feature } = variant
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
return (
|
|
43
|
+
<Container
|
|
44
|
+
segmentFontSize={segmentFontSize}
|
|
45
|
+
segmentWidth={segmentWidth}
|
|
46
|
+
variant={variant}
|
|
47
|
+
ref={ref}
|
|
44
48
|
>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
<StackView
|
|
50
|
+
direction={large || feature ? 'column' : 'row'}
|
|
51
|
+
space={large || feature ? 0 : 1}
|
|
52
|
+
tokens={{ alignItems: 'center' }}
|
|
53
|
+
>
|
|
54
|
+
<Typography tokens={numberTokens}>{pad(number, segmentWidth)}</Typography>
|
|
55
|
+
{label && (
|
|
56
|
+
<Typography tokens={labelTokens}>
|
|
57
|
+
{getCopy(number === 1 ? labelKey : `${labelKey}s`)}
|
|
58
|
+
</Typography>
|
|
59
|
+
)}
|
|
60
|
+
</StackView>
|
|
61
|
+
</Container>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
Segment.displayName = 'Segment'
|
|
55
67
|
|
|
56
68
|
Segment.propTypes = {
|
|
57
69
|
/**
|
|
@@ -16,7 +16,7 @@ const CalendarContainer = styled.div(
|
|
|
16
16
|
}) => `
|
|
17
17
|
${defaultReactDatesCss}
|
|
18
18
|
> div {
|
|
19
|
-
z-index:
|
|
19
|
+
z-index: 1000;
|
|
20
20
|
}
|
|
21
21
|
.SingleDatePicker,
|
|
22
22
|
.SingleDatePickerInput {
|
|
@@ -30,7 +30,7 @@ const CalendarContainer = styled.div(
|
|
|
30
30
|
padding: ${remainingTokens.singleDatePickerPaddingTopBottom}px ${
|
|
31
31
|
remainingTokens.singleDatePickerLeftRight
|
|
32
32
|
}px;
|
|
33
|
-
z-index:
|
|
33
|
+
z-index: 1000;
|
|
34
34
|
}
|
|
35
35
|
.DateInput {
|
|
36
36
|
width: 100%;
|