@telus-uds/components-web 2.11.0 → 2.13.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.
- package/CHANGELOG.md +38 -2
- package/component-docs.json +123 -35
- package/lib/Autocomplete/Loading.js +5 -10
- package/lib/Autocomplete/dictionary.js +2 -2
- package/lib/Card/Card.js +2 -0
- package/lib/DatePicker/DatePicker.js +6 -0
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +5 -10
- package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +32 -7
- package/lib/Footnote/FootnoteLink.js +1 -2
- package/lib/NavigationBar/NavigationSubMenu.js +4 -8
- package/lib/PriceLockup/PriceLockup.js +6 -1
- package/lib/Spinner/Spinner.js +10 -1
- package/lib/Spinner/SpinnerContent.js +8 -0
- package/lib/Table/Cell.js +62 -91
- package/lib/Table/Header.js +4 -1
- package/lib/Table/SubHeading.js +4 -1
- package/lib/Table/Table.js +2 -1
- package/lib/TermsAndConditions/ExpandCollapse.js +31 -13
- package/lib/TermsAndConditions/TermsAndConditions.js +21 -6
- package/lib/VideoPicker/VideoPickerPlayer.js +4 -2
- package/lib/VideoPicker/VideoPickerThumbnail.js +103 -60
- package/lib/VideoPicker/VideoSlider.js +2 -2
- package/lib-module/Autocomplete/Loading.js +6 -12
- package/lib-module/Autocomplete/dictionary.js +2 -2
- package/lib-module/Card/Card.js +2 -0
- package/lib-module/DatePicker/DatePicker.js +7 -1
- package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +6 -11
- package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +32 -7
- package/lib-module/Footnote/FootnoteLink.js +1 -2
- package/lib-module/NavigationBar/NavigationSubMenu.js +5 -9
- package/lib-module/PriceLockup/PriceLockup.js +7 -2
- package/lib-module/Spinner/Spinner.js +10 -1
- package/lib-module/Spinner/SpinnerContent.js +8 -0
- package/lib-module/Table/Cell.js +65 -90
- package/lib-module/Table/Header.js +4 -1
- package/lib-module/Table/SubHeading.js +4 -1
- package/lib-module/Table/Table.js +2 -1
- package/lib-module/TermsAndConditions/ExpandCollapse.js +33 -15
- package/lib-module/TermsAndConditions/TermsAndConditions.js +22 -7
- package/lib-module/VideoPicker/VideoPickerPlayer.js +4 -2
- package/lib-module/VideoPicker/VideoPickerThumbnail.js +103 -61
- package/lib-module/VideoPicker/VideoSlider.js +2 -2
- package/package.json +3 -3
- package/src/Autocomplete/Loading.jsx +2 -5
- package/src/Autocomplete/dictionary.js +2 -2
- package/src/Card/Card.jsx +12 -8
- package/src/DatePicker/DatePicker.jsx +8 -1
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +9 -6
- package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +21 -4
- package/src/Footnote/FootnoteLink.jsx +1 -2
- package/src/NavigationBar/NavigationSubMenu.jsx +3 -4
- package/src/PriceLockup/PriceLockup.jsx +7 -2
- package/src/Spinner/Spinner.jsx +9 -1
- package/src/Spinner/SpinnerContent.jsx +13 -1
- package/src/Table/Cell.jsx +58 -78
- package/src/Table/Header.jsx +6 -1
- package/src/Table/SubHeading.jsx +4 -1
- package/src/Table/Table.jsx +10 -2
- package/src/TermsAndConditions/ExpandCollapse.jsx +36 -14
- package/src/TermsAndConditions/TermsAndConditions.jsx +18 -6
- package/src/VideoPicker/VideoPickerPlayer.jsx +2 -2
- package/src/VideoPicker/VideoPickerThumbnail.jsx +51 -30
- package/src/VideoPicker/VideoSlider.jsx +2 -2
- package/types/BaseProvider.d.ts +25 -0
- package/types/index.d.ts +1 -1
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
selectSystemProps,
|
|
7
7
|
Typography,
|
|
8
8
|
useThemeTokens,
|
|
9
|
-
useViewport
|
|
9
|
+
useViewport,
|
|
10
|
+
getTokensPropType
|
|
10
11
|
} from '@telus-uds/components-base'
|
|
11
12
|
import styled from 'styled-components'
|
|
12
13
|
import FootnoteLink from '../Footnote/FootnoteLink'
|
|
@@ -273,7 +274,11 @@ PriceLockup.propTypes = {
|
|
|
273
274
|
*
|
|
274
275
|
* **Note:** a11yText will override strikethrough price, so it must include price (ie. "was 50 dollars per month")
|
|
275
276
|
*/
|
|
276
|
-
a11yText: PropTypes.string
|
|
277
|
+
a11yText: PropTypes.string,
|
|
278
|
+
/**
|
|
279
|
+
* `PriceLockup` tokens
|
|
280
|
+
*/
|
|
281
|
+
tokens: getTokensPropType('PriceLockup')
|
|
277
282
|
}
|
|
278
283
|
|
|
279
284
|
export default PriceLockup
|
package/src/Spinner/Spinner.jsx
CHANGED
|
@@ -64,6 +64,7 @@ const Spinner = ({
|
|
|
64
64
|
fullScreen = false,
|
|
65
65
|
inline = false,
|
|
66
66
|
label,
|
|
67
|
+
labelPosition,
|
|
67
68
|
show = false,
|
|
68
69
|
isStatic = false,
|
|
69
70
|
tokens,
|
|
@@ -97,6 +98,7 @@ const Spinner = ({
|
|
|
97
98
|
>
|
|
98
99
|
<SpinnerContent
|
|
99
100
|
label={label}
|
|
101
|
+
labelPosition={labelPosition}
|
|
100
102
|
overlay={true}
|
|
101
103
|
size={size}
|
|
102
104
|
thickness={thickness}
|
|
@@ -115,6 +117,7 @@ const Spinner = ({
|
|
|
115
117
|
<SpinnerContainer inline={inline} aria-live="assertive" {...selectProps(rest)}>
|
|
116
118
|
<SpinnerContent
|
|
117
119
|
label={label}
|
|
120
|
+
labelPosition={labelPosition}
|
|
118
121
|
overlay={true}
|
|
119
122
|
size={size}
|
|
120
123
|
thickness={thickness}
|
|
@@ -141,6 +144,7 @@ const Spinner = ({
|
|
|
141
144
|
<SpinnerContainer {...selectProps(rest)}>
|
|
142
145
|
<SpinnerContent
|
|
143
146
|
label={label}
|
|
147
|
+
labelPosition={labelPosition}
|
|
144
148
|
size={size}
|
|
145
149
|
thickness={thickness}
|
|
146
150
|
sizeVariant={sizeVariant}
|
|
@@ -183,7 +187,11 @@ Spinner.propTypes = {
|
|
|
183
187
|
/**
|
|
184
188
|
* If true, it should render a static spinner
|
|
185
189
|
*/
|
|
186
|
-
isStatic: PropTypes.bool
|
|
190
|
+
isStatic: PropTypes.bool,
|
|
191
|
+
/**
|
|
192
|
+
* Determine where the label of the spinner should be placed, left, right, bottom or top.
|
|
193
|
+
*/
|
|
194
|
+
labelPosition: PropTypes.string
|
|
187
195
|
}
|
|
188
196
|
|
|
189
197
|
export default Spinner
|
|
@@ -27,6 +27,7 @@ const Container = styled.div(({ overlay }) => ({
|
|
|
27
27
|
|
|
28
28
|
const SpinnerContent = ({
|
|
29
29
|
label,
|
|
30
|
+
labelPosition,
|
|
30
31
|
overlay = false,
|
|
31
32
|
sizeVariant,
|
|
32
33
|
size,
|
|
@@ -34,9 +35,20 @@ const SpinnerContent = ({
|
|
|
34
35
|
isStatic,
|
|
35
36
|
...rest
|
|
36
37
|
}) => {
|
|
38
|
+
const labelMapping = {
|
|
39
|
+
top: 'column-reverse',
|
|
40
|
+
bottom: 'column',
|
|
41
|
+
left: 'row-reverse',
|
|
42
|
+
right: 'row'
|
|
43
|
+
}
|
|
44
|
+
|
|
37
45
|
return (
|
|
38
46
|
<Container overlay={overlay}>
|
|
39
|
-
<StackView
|
|
47
|
+
<StackView
|
|
48
|
+
space={3}
|
|
49
|
+
tokens={{ alignItems: 'center' }}
|
|
50
|
+
direction={labelMapping[labelPosition]}
|
|
51
|
+
>
|
|
40
52
|
<ActivityIndicator
|
|
41
53
|
label={label}
|
|
42
54
|
tokens={{ size, thickness }}
|
package/src/Table/Cell.jsx
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import styled, { css } from 'styled-components'
|
|
4
|
-
import { Typography, useThemeTokens } from '@telus-uds/components-base'
|
|
4
|
+
import { Typography, useThemeTokens, applyShadowToken } from '@telus-uds/components-base'
|
|
5
5
|
import { useTableContext } from './Table'
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const HEADER_TYPE = {
|
|
8
|
+
HEADING: 'heading',
|
|
9
|
+
SUBHEADING: 'subHeading',
|
|
10
|
+
ROWHEADING: 'rowHeading'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const stickyStyles = ({ cellStickyShadow, stickyBackgroundColor, type }) => css`
|
|
8
14
|
position: sticky;
|
|
9
15
|
left: 0; // needed for sticky to work
|
|
10
16
|
z-index: 2;
|
|
11
17
|
clip-path: inset(0 -8px 0 0); // use clip path to cut off the shadow rendered below
|
|
12
|
-
|
|
18
|
+
// Override default cell background with stickyBackgroundColor with an exception to subheading and heading
|
|
19
|
+
${type !== HEADER_TYPE.SUBHEADING && type !== HEADER_TYPE.HEADING
|
|
20
|
+
? `background-color: ${stickyBackgroundColor};`
|
|
21
|
+
: undefined}
|
|
13
22
|
&::before {
|
|
14
23
|
// use a pseudo element for the sticky shadow, since we already use shadows for inner cells border
|
|
15
24
|
content: '';
|
|
16
|
-
box-shadow: ${
|
|
25
|
+
box-shadow: ${cellStickyShadow};
|
|
17
26
|
position: absolute;
|
|
18
27
|
top: 0;
|
|
19
28
|
left: 0;
|
|
@@ -25,55 +34,43 @@ const stickyStyles = css`
|
|
|
25
34
|
const sharedStyles = css`
|
|
26
35
|
${({
|
|
27
36
|
isSticky,
|
|
28
|
-
cellBoxShadowColor,
|
|
29
37
|
align,
|
|
30
38
|
cellPaddingTop,
|
|
31
39
|
cellPaddingRight,
|
|
32
40
|
cellPaddingBottom,
|
|
33
41
|
cellPaddingLeft,
|
|
34
|
-
cellMinWidth
|
|
42
|
+
cellMinWidth,
|
|
43
|
+
cellBackground,
|
|
44
|
+
cellStickyShadow,
|
|
45
|
+
stickyBackgroundColor,
|
|
46
|
+
type
|
|
35
47
|
}) => css`
|
|
36
|
-
${isSticky ? stickyStyles : undefined};
|
|
37
|
-
box-shadow: inset 0 -1px 0 ${cellBoxShadowColor};
|
|
38
48
|
text-align: ${align};
|
|
39
49
|
min-width: ${cellMinWidth}px;
|
|
40
50
|
padding: ${cellPaddingTop}px ${cellPaddingRight}px ${cellPaddingBottom}px ${cellPaddingLeft}px;
|
|
51
|
+
background-color: ${cellBackground};
|
|
52
|
+
${isSticky && stickyStyles({ type, cellStickyShadow, stickyBackgroundColor })};
|
|
41
53
|
`}
|
|
42
54
|
`
|
|
43
|
-
const
|
|
44
|
-
${sharedStyles};
|
|
45
|
-
${({ cellHeadingBackground, cellHeadingBoxShadowColor }) => `
|
|
46
|
-
background-color: ${cellHeadingBackground};
|
|
47
|
-
box-shadow: inset 0 1px 0 ${cellHeadingBoxShadowColor}, inset 0 -1px 0 ${cellHeadingBoxShadowColor};`}
|
|
48
|
-
`
|
|
49
|
-
|
|
50
|
-
const StyledSubHeading = styled.th`
|
|
51
|
-
${sharedStyles};
|
|
52
|
-
background-color: ${({ cellSubheadingBackground }) => cellSubheadingBackground};
|
|
53
|
-
`
|
|
54
|
-
|
|
55
|
-
const StyledCell = styled.td`
|
|
56
|
-
${sharedStyles};
|
|
57
|
-
background-color: ${({ cellBackground }) => cellBackground};
|
|
58
|
-
`
|
|
59
|
-
|
|
60
|
-
const StyledRowHeading = styled.th`
|
|
55
|
+
const createStyledCell = (htmlElement) => styled[htmlElement]`
|
|
61
56
|
${sharedStyles};
|
|
62
|
-
|
|
57
|
+
box-shadow: ${({ cellBoxShadowColor, type }) => {
|
|
58
|
+
return type === HEADER_TYPE.HEADING
|
|
59
|
+
? `inset 0 1px 0 ${cellBoxShadowColor}, inset 0 -1px 0 ${cellBoxShadowColor}`
|
|
60
|
+
: `inset 0 1px 0 ${cellBoxShadowColor}`
|
|
61
|
+
}};
|
|
63
62
|
`
|
|
63
|
+
const StyledHeaderCell = createStyledCell('th')
|
|
64
|
+
const StyledDataCell = createStyledCell('td')
|
|
64
65
|
|
|
65
|
-
const Cell = ({ children,
|
|
66
|
-
const { text, isScrollable: isTableScrollable,
|
|
66
|
+
const Cell = ({ children, isFirstInRow, align = 'left', tokens: cellTokens, type }) => {
|
|
67
|
+
const { text, isScrollable: isTableScrollable, tokens: tableTokens, spacing } = useTableContext()
|
|
67
68
|
const themeTokens = { ...tableTokens, ...cellTokens }
|
|
68
69
|
|
|
69
70
|
const {
|
|
70
71
|
cellMinWidth,
|
|
71
|
-
cellHeadingBackground,
|
|
72
|
-
cellHeadingBoxShadowColor,
|
|
73
72
|
cellBoxShadowColor,
|
|
74
|
-
cellSubheadingBackground,
|
|
75
73
|
cellBackground,
|
|
76
|
-
cellRowHeadingBackground,
|
|
77
74
|
cellStickyShadow,
|
|
78
75
|
cellPaddingTop,
|
|
79
76
|
cellPaddingRight,
|
|
@@ -81,84 +78,67 @@ const Cell = ({ children, type = 'default', isFirstInRow, align = 'left', tokens
|
|
|
81
78
|
cellPaddingBottom,
|
|
82
79
|
fontName,
|
|
83
80
|
fontWeight,
|
|
84
|
-
fontSize
|
|
85
|
-
|
|
81
|
+
fontSize,
|
|
82
|
+
lineHeight,
|
|
83
|
+
stickyBackgroundColor
|
|
84
|
+
} = useThemeTokens('Table', themeTokens, { spacing, type, text })
|
|
86
85
|
|
|
87
86
|
const sharedProps = {
|
|
88
87
|
align,
|
|
89
88
|
isSticky: isTableScrollable && isFirstInRow,
|
|
89
|
+
cellBackground,
|
|
90
90
|
cellMinWidth,
|
|
91
|
-
cellStickyShadow,
|
|
91
|
+
cellStickyShadow: applyShadowToken(cellStickyShadow).boxShadow,
|
|
92
92
|
cellPaddingTop,
|
|
93
93
|
cellPaddingRight,
|
|
94
94
|
cellPaddingLeft,
|
|
95
95
|
cellPaddingBottom,
|
|
96
|
+
stickyBackgroundColor,
|
|
96
97
|
cellBoxShadowColor
|
|
97
98
|
}
|
|
98
|
-
|
|
99
99
|
const typographyTokens = {
|
|
100
100
|
fontName,
|
|
101
101
|
fontWeight,
|
|
102
|
-
fontSize
|
|
102
|
+
fontSize,
|
|
103
|
+
lineHeight
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
switch (type) {
|
|
106
|
-
case
|
|
107
|
+
case HEADER_TYPE.HEADING:
|
|
107
108
|
return (
|
|
108
|
-
<
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
cellHeadingBoxShadowColor={cellHeadingBoxShadowColor}
|
|
112
|
-
{...sharedProps}
|
|
113
|
-
>
|
|
114
|
-
<Typography tokens={typographyTokens} variant={{ size: 'h4' }}>
|
|
115
|
-
{children}
|
|
116
|
-
</Typography>
|
|
117
|
-
</StyledHeading>
|
|
109
|
+
<StyledHeaderCell scope="col" {...sharedProps} type={type}>
|
|
110
|
+
<Typography tokens={typographyTokens}>{children}</Typography>
|
|
111
|
+
</StyledHeaderCell>
|
|
118
112
|
)
|
|
119
|
-
|
|
113
|
+
|
|
114
|
+
case HEADER_TYPE.SUBHEADING:
|
|
120
115
|
return (
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
{...sharedProps}
|
|
125
|
-
>
|
|
126
|
-
<Typography tokens={typographyTokens} variant={{ size: 'h5' }}>
|
|
127
|
-
{children}
|
|
128
|
-
</Typography>
|
|
129
|
-
</StyledSubHeading>
|
|
116
|
+
<StyledHeaderCell scope="col" {...sharedProps} type={type}>
|
|
117
|
+
<Typography tokens={typographyTokens}>{children}</Typography>
|
|
118
|
+
</StyledHeaderCell>
|
|
130
119
|
)
|
|
131
|
-
|
|
120
|
+
|
|
121
|
+
case HEADER_TYPE.ROWHEADING:
|
|
132
122
|
return (
|
|
133
|
-
<
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
{...sharedProps}
|
|
137
|
-
>
|
|
138
|
-
<Typography tokens={typographyTokens} variant={{ size: text === 'small' ? 'h5' : 'h4' }}>
|
|
139
|
-
{children}
|
|
140
|
-
</Typography>
|
|
141
|
-
</StyledRowHeading>
|
|
123
|
+
<StyledHeaderCell scope="row" {...sharedProps} type={type}>
|
|
124
|
+
<Typography tokens={typographyTokens}>{children}</Typography>
|
|
125
|
+
</StyledHeaderCell>
|
|
142
126
|
)
|
|
143
127
|
|
|
144
128
|
default:
|
|
145
129
|
return (
|
|
146
|
-
<
|
|
147
|
-
<Typography tokens={
|
|
148
|
-
|
|
149
|
-
</Typography>
|
|
150
|
-
</StyledCell>
|
|
130
|
+
<StyledDataCell {...sharedProps}>
|
|
131
|
+
<Typography tokens={typographyTokens}>{children}</Typography>
|
|
132
|
+
</StyledDataCell>
|
|
151
133
|
)
|
|
152
134
|
}
|
|
153
135
|
}
|
|
154
136
|
|
|
155
137
|
Cell.propTypes = {
|
|
138
|
+
type: PropTypes.oneOf(['default', 'heading', 'subHeading', 'rowHeading']),
|
|
156
139
|
tokens: PropTypes.object,
|
|
157
140
|
children: PropTypes.node,
|
|
158
|
-
|
|
159
|
-
* Defines the visual styles of a cell, and whether it should be a `td` or `th` element
|
|
160
|
-
*/
|
|
161
|
-
type: PropTypes.oneOf(['default', 'heading', 'subHeading', 'rowHeading']),
|
|
141
|
+
|
|
162
142
|
/**
|
|
163
143
|
* @ignore
|
|
164
144
|
* Used internally for making the first column sticky
|
package/src/Table/Header.jsx
CHANGED
|
@@ -5,7 +5,12 @@ import Row from './Row'
|
|
|
5
5
|
const Header = ({ children }) => {
|
|
6
6
|
return (
|
|
7
7
|
<thead>
|
|
8
|
-
<Row>
|
|
8
|
+
<Row>
|
|
9
|
+
{React.Children.map(children, (child) =>
|
|
10
|
+
// TO DO: pass type as a variant instead of prop
|
|
11
|
+
cloneElement(child, { type: 'heading' })
|
|
12
|
+
)}
|
|
13
|
+
</Row>
|
|
9
14
|
</thead>
|
|
10
15
|
)
|
|
11
16
|
}
|
package/src/Table/SubHeading.jsx
CHANGED
|
@@ -5,7 +5,10 @@ import Row from './Row'
|
|
|
5
5
|
const Header = ({ children }) => {
|
|
6
6
|
return (
|
|
7
7
|
<Row>
|
|
8
|
-
{React.Children.map(children, (child) =>
|
|
8
|
+
{React.Children.map(children, (child) =>
|
|
9
|
+
// TO DO: pass type as a variant instead of prop
|
|
10
|
+
cloneElement(child, { type: 'subHeading' })
|
|
11
|
+
)}
|
|
9
12
|
</Row>
|
|
10
13
|
)
|
|
11
14
|
}
|
package/src/Table/Table.jsx
CHANGED
|
@@ -36,7 +36,15 @@ export const useTableContext = () => useContext(TableContext)
|
|
|
36
36
|
* - Use `Table.Row` and `Table.Cell` to build up the tabular data
|
|
37
37
|
* - Use `Cell`'s `type` prop to visually mark it as a row heading (`type="rowHeading"`)
|
|
38
38
|
*/
|
|
39
|
-
const Table = ({
|
|
39
|
+
const Table = ({
|
|
40
|
+
children,
|
|
41
|
+
spacing = 'default',
|
|
42
|
+
fullWidth = true,
|
|
43
|
+
text = 'medium',
|
|
44
|
+
tokens,
|
|
45
|
+
variant,
|
|
46
|
+
...rest
|
|
47
|
+
}) => {
|
|
40
48
|
const { tablePaddingBottom } = useThemeTokens('Table', tokens, variant)
|
|
41
49
|
const containerRef = useRef()
|
|
42
50
|
const tableRef = useRef()
|
|
@@ -75,7 +83,7 @@ const Table = ({ children, fullWidth = true, text = 'medium', tokens, variant, .
|
|
|
75
83
|
tablePaddingBottom={`${tablePaddingBottom}px`}
|
|
76
84
|
{...selectProps(rest)}
|
|
77
85
|
>
|
|
78
|
-
<TableContext.Provider value={{ text, isScrollable, tokens,
|
|
86
|
+
<TableContext.Provider value={{ text, isScrollable, tokens, spacing }}>
|
|
79
87
|
<StyledTable tableWidth={tableWidth} cellSpacing={0} ref={tableRef}>
|
|
80
88
|
{children}
|
|
81
89
|
</StyledTable>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react'
|
|
1
|
+
import React, { forwardRef, useState } from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import {
|
|
4
4
|
ExpandCollapse as ExpandCollapseBase,
|
|
5
|
-
|
|
5
|
+
IconButton,
|
|
6
6
|
useThemeTokensCallback
|
|
7
7
|
} from '@telus-uds/components-base'
|
|
8
8
|
import styled from 'styled-components'
|
|
@@ -17,18 +17,15 @@ const ExpandCollapseControl = styled.div({
|
|
|
17
17
|
|
|
18
18
|
const ExpandCollapseIconContainer = styled.div(({ tokens }) => ({
|
|
19
19
|
alignItems: tokens.expandIconContainerAlignItems,
|
|
20
|
-
border: `${tokens.expandIconContainerBorder}px solid ${tokens.expandIconContainerBorderColor}`,
|
|
21
|
-
borderRadius: '50%',
|
|
22
|
-
display: 'flex',
|
|
23
|
-
height: tokens.expandIconContainerHeight,
|
|
24
20
|
justifyContent: tokens.expandIconContainerJustifyContent,
|
|
25
|
-
|
|
21
|
+
marginLeft: `${tokens.expandIconContainerMarginY}px`,
|
|
22
|
+
marginRight: `${tokens.expandIconContainerMarginY}px`,
|
|
26
23
|
width: tokens.expandIconContainerWidth
|
|
27
24
|
}))
|
|
28
25
|
|
|
29
26
|
const ExpandCollapseTitle = styled.h4(({ tokens }) => ({
|
|
30
27
|
color: tokens.expandTitleColor,
|
|
31
|
-
fontFamily: `${tokens.
|
|
28
|
+
fontFamily: `${tokens.expandTitleFontName}${tokens.expandTitleFontWeight}normal`,
|
|
32
29
|
fontSize: tokens.expandTitleFontSize,
|
|
33
30
|
lineHeight: tokens.expandTitleLineHeight,
|
|
34
31
|
margin: `${tokens.expandTitleMarginX}px ${tokens.expandTitleMarginY}px`
|
|
@@ -42,8 +39,20 @@ const ExpandCollapse = forwardRef(
|
|
|
42
39
|
expandContentPaddingBottom,
|
|
43
40
|
expandContentPaddingLeft,
|
|
44
41
|
expandContentPaddingRight,
|
|
45
|
-
expandContentPaddingTop
|
|
42
|
+
expandContentPaddingTop,
|
|
43
|
+
contentBorderColor,
|
|
44
|
+
contentMarginBottom,
|
|
45
|
+
expandTitlePaddingLeft,
|
|
46
|
+
expandTitleBorder,
|
|
47
|
+
expandTitleBorderColor,
|
|
48
|
+
expandTitleUnderline
|
|
46
49
|
} = getTokens()
|
|
50
|
+
const [expand, setExpand] = useState(false)
|
|
51
|
+
|
|
52
|
+
const handleExpandToggle = (expandProps, event, expanded) => {
|
|
53
|
+
expandProps.onToggle('ExpandCollapsePanel', event)
|
|
54
|
+
setExpand(!expanded)
|
|
55
|
+
}
|
|
47
56
|
|
|
48
57
|
return (
|
|
49
58
|
<ExpandCollapseBase
|
|
@@ -55,7 +64,14 @@ const ExpandCollapse = forwardRef(
|
|
|
55
64
|
<ExpandCollapseBase.Panel
|
|
56
65
|
{...expandProps}
|
|
57
66
|
panelId="ExpandCollapsePanel"
|
|
58
|
-
controlTokens={{
|
|
67
|
+
controlTokens={{
|
|
68
|
+
icon: null,
|
|
69
|
+
backgroundColor: 'transparent',
|
|
70
|
+
paddingLeft: expandTitlePaddingLeft,
|
|
71
|
+
borderColor: expandTitleBorderColor,
|
|
72
|
+
borderWidth: expandTitleBorder,
|
|
73
|
+
textLine: expandTitleUnderline
|
|
74
|
+
}}
|
|
59
75
|
// TODO refactor
|
|
60
76
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
61
77
|
control={(pressableState) => {
|
|
@@ -64,11 +80,15 @@ const ExpandCollapse = forwardRef(
|
|
|
64
80
|
|
|
65
81
|
return (
|
|
66
82
|
<ExpandCollapseControl
|
|
67
|
-
onClick={(event) => expandProps
|
|
83
|
+
onClick={(event) => handleExpandToggle(expandProps, event, expanded)}
|
|
68
84
|
ref={ref}
|
|
69
85
|
>
|
|
70
86
|
<ExpandCollapseIconContainer tokens={getTokens()}>
|
|
71
|
-
<
|
|
87
|
+
<IconButton
|
|
88
|
+
icon={icon}
|
|
89
|
+
variant={{ size: 'small' }}
|
|
90
|
+
onClick={(event) => handleExpandToggle(expandProps, event, expanded)}
|
|
91
|
+
/>
|
|
72
92
|
</ExpandCollapseIconContainer>
|
|
73
93
|
<ExpandCollapseTitle tokens={getTokens()}>
|
|
74
94
|
{expanded ? expandTitle : collapseTitle}
|
|
@@ -80,10 +100,12 @@ const ExpandCollapse = forwardRef(
|
|
|
80
100
|
contentPaddingBottom: expandContentPaddingBottom,
|
|
81
101
|
contentPaddingLeft: expandContentPaddingLeft,
|
|
82
102
|
contentPaddingRight: expandContentPaddingRight,
|
|
83
|
-
contentPaddingTop: expandContentPaddingTop
|
|
103
|
+
contentPaddingTop: expandContentPaddingTop,
|
|
104
|
+
borderColor: contentBorderColor,
|
|
105
|
+
marginBottom: contentMarginBottom
|
|
84
106
|
}}
|
|
85
107
|
>
|
|
86
|
-
{children}
|
|
108
|
+
{expand ? children : null}
|
|
87
109
|
</ExpandCollapseBase.Panel>
|
|
88
110
|
)}
|
|
89
111
|
</ExpandCollapseBase>
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
selectSystemProps,
|
|
8
8
|
Typography,
|
|
9
9
|
useCopy,
|
|
10
|
-
useThemeTokens
|
|
10
|
+
useThemeTokens,
|
|
11
|
+
useViewport
|
|
11
12
|
} from '@telus-uds/components-base'
|
|
12
13
|
import ExpandCollapse from './ExpandCollapse'
|
|
13
14
|
import OrderedListBase from '../OrderedList/OrderedListBase'
|
|
@@ -33,7 +34,8 @@ const Ordered = styled(OrderedListBase)(({ tokens }) => ({
|
|
|
33
34
|
const Unordered = styled.ul(({ tokens }) => ({
|
|
34
35
|
listStyleType: 'none',
|
|
35
36
|
margin: 0,
|
|
36
|
-
padding:
|
|
37
|
+
padding: 0,
|
|
38
|
+
paddingTop: tokens.unorderedPadding
|
|
37
39
|
}))
|
|
38
40
|
|
|
39
41
|
const ListItem = styled(OrderedListBase.Item)(({ tokens }) => ({
|
|
@@ -75,11 +77,12 @@ const TermsAndConditions = forwardRef(
|
|
|
75
77
|
const hasIndexedContent = indexedContent.length > 0
|
|
76
78
|
const hasNonIndexedContent = nonIndexedContent.length > 0
|
|
77
79
|
|
|
78
|
-
const
|
|
80
|
+
const viewport = useViewport()
|
|
81
|
+
const themeTokens = useThemeTokens('TermsAndConditions', tokens, variant, { viewport })
|
|
79
82
|
|
|
80
83
|
return (
|
|
81
84
|
<div {...selectProps(rest)}>
|
|
82
|
-
<Divider />
|
|
85
|
+
<Divider tokens={{ color: themeTokens.dividerColor }} />
|
|
83
86
|
<ExpandCollapse
|
|
84
87
|
collapseTitle={getCopy('headingView')}
|
|
85
88
|
expandTitle={getCopy('headingHide')}
|
|
@@ -99,7 +102,16 @@ const TermsAndConditions = forwardRef(
|
|
|
99
102
|
{hasNonIndexedContent && (
|
|
100
103
|
<Box between={3}>
|
|
101
104
|
<NonIndexedContentTitle tokens={themeTokens}>
|
|
102
|
-
<Typography
|
|
105
|
+
<Typography
|
|
106
|
+
block
|
|
107
|
+
heading
|
|
108
|
+
tokens={{
|
|
109
|
+
fontName: themeTokens.expandTitleFontName,
|
|
110
|
+
fontWeight: themeTokens.expandTitleFontWeight,
|
|
111
|
+
fontSize: themeTokens.titleFontSize,
|
|
112
|
+
lineHeight: themeTokens.titleLineHeight
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
103
115
|
{getCopy('nonIndexedTitle')}
|
|
104
116
|
</Typography>
|
|
105
117
|
</NonIndexedContentTitle>
|
|
@@ -115,7 +127,7 @@ const TermsAndConditions = forwardRef(
|
|
|
115
127
|
)}
|
|
116
128
|
</ContentContainer>
|
|
117
129
|
</ExpandCollapse>
|
|
118
|
-
<Divider />
|
|
130
|
+
<Divider tokens={{ color: themeTokens.dividerColor }} />
|
|
119
131
|
</div>
|
|
120
132
|
)
|
|
121
133
|
}
|
|
@@ -10,8 +10,8 @@ const VideoPickerPlayer = ({ video = {}, videoPlayerRef, onStartVideo = () => {}
|
|
|
10
10
|
{video.videoId && <WebVideo {...video} onStart={() => onStartVideo(video)} />}
|
|
11
11
|
</div>
|
|
12
12
|
<StackView space={2}>
|
|
13
|
-
<Typography variant={{ size: '
|
|
14
|
-
<Typography>{video.description}</Typography>
|
|
13
|
+
<Typography variant={{ size: 'h3' }}>{video.title}</Typography>
|
|
14
|
+
<Typography variant={{ colour: 'default' }}>{video.description}</Typography>
|
|
15
15
|
</StackView>
|
|
16
16
|
</StackView>
|
|
17
17
|
)
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
Typography,
|
|
9
9
|
useViewport,
|
|
10
10
|
horizontalScrollUtils,
|
|
11
|
-
|
|
11
|
+
useThemeTokensCallback
|
|
12
12
|
} from '@telus-uds/components-base'
|
|
13
13
|
import { getTimestamp } from '../shared/VideoSplash/helpers'
|
|
14
14
|
import { VideoPropType, RefPropType } from './videoPropType'
|
|
@@ -42,6 +42,12 @@ const createReactNativeStyles = ({
|
|
|
42
42
|
}
|
|
43
43
|
})
|
|
44
44
|
|
|
45
|
+
const ImageContainer = styled.div`
|
|
46
|
+
padding: ${(props) => `${props.outerBorderGap}px`};
|
|
47
|
+
border: ${(props) => `${props.outerBorderWidth}px solid ${props.outerBorderColor}`};
|
|
48
|
+
border-radius: ${({ outerBorderRadius }) => outerBorderRadius}px;
|
|
49
|
+
`
|
|
50
|
+
|
|
45
51
|
const VideoThumbnail = styled.div`
|
|
46
52
|
position: relative;
|
|
47
53
|
width: ${(props) => (props.layout === 'vertical' ? '100%' : '144px')};
|
|
@@ -61,7 +67,7 @@ const VideoThumbnail = styled.div`
|
|
|
61
67
|
&::after {
|
|
62
68
|
content: '';
|
|
63
69
|
border: ${({ borderWidth }) => borderWidth}px solid;
|
|
64
|
-
border-color: ${({
|
|
70
|
+
border-color: ${({ borderColor }) => borderColor};
|
|
65
71
|
border-radius: ${({ borderRadius }) => borderRadius}px;
|
|
66
72
|
position: absolute;
|
|
67
73
|
top: 0;
|
|
@@ -94,27 +100,30 @@ const VideoPickerThumbnail = ({
|
|
|
94
100
|
width = '100%'
|
|
95
101
|
}) => {
|
|
96
102
|
const viewport = useViewport()
|
|
97
|
-
const
|
|
103
|
+
const getTokens = useThemeTokensCallback('VideoPickerThumbnail', {}, {})
|
|
98
104
|
|
|
99
|
-
const rnStyles = createReactNativeStyles(themeTokens)
|
|
100
105
|
const { timestamp } = getTimestamp(video.videoLength, video.copy)
|
|
101
106
|
const isPlaying = selectedVideoId === video.videoId
|
|
102
107
|
|
|
103
|
-
const renderThumbnailImage = () =>
|
|
104
|
-
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
const renderThumbnailImage = (themeTokens) => {
|
|
109
|
+
return (
|
|
110
|
+
<VideoThumbnail {...themeTokens} isPlaying={isPlaying} layout={layout}>
|
|
111
|
+
<VideoSplash
|
|
112
|
+
simpleMode
|
|
113
|
+
poster={
|
|
114
|
+
video.posterSrc || `https://img.youtube.com/vi/${video.videoId}/maxresdefault.jpg`
|
|
115
|
+
}
|
|
116
|
+
videoLength={video.videoLength}
|
|
117
|
+
copy={video.copy}
|
|
118
|
+
/>
|
|
119
|
+
</VideoThumbnail>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
113
122
|
|
|
114
|
-
const renderThumbnailInfo = () => (
|
|
123
|
+
const renderThumbnailInfo = ({ titleColor, subTitleColor }) => (
|
|
115
124
|
<StackView space={2} tokens={{ flexShrink: 1 }}>
|
|
116
125
|
<ThumbnailTitleContainer viewport={viewport}>
|
|
117
|
-
<Typography variant={{ bold: true }} tokens={{ color:
|
|
126
|
+
<Typography variant={{ bold: true }} tokens={{ color: titleColor }}>
|
|
118
127
|
{video.title}
|
|
119
128
|
</Typography>
|
|
120
129
|
</ThumbnailTitleContainer>
|
|
@@ -148,21 +157,33 @@ const VideoPickerThumbnail = ({
|
|
|
148
157
|
onKeyPress={onKeyPress}
|
|
149
158
|
accessibilityRole="radio"
|
|
150
159
|
accessibilityState={{ checked: isPlaying }}
|
|
151
|
-
style={
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
160
|
+
style={({ hovered: hover, focused: focus, pressed }) => {
|
|
161
|
+
const themeTokens = getTokens({ hover, focus, pressed, selected: isPlaying })
|
|
162
|
+
|
|
163
|
+
const rnStyles = createReactNativeStyles(themeTokens)
|
|
164
|
+
return [
|
|
165
|
+
rnStyles.container,
|
|
166
|
+
layout === 'horizontal' && rnStyles.horizontal,
|
|
167
|
+
isFramed && rnStyles.framed,
|
|
168
|
+
isFramed && index > 0 && rnStyles.framedLine,
|
|
169
|
+
{ width },
|
|
170
|
+
{ outline: 'none' }
|
|
171
|
+
]
|
|
172
|
+
}}
|
|
158
173
|
>
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
174
|
+
{({ hovered: hover, focused: focus, pressed }) => {
|
|
175
|
+
const themeTokens = getTokens({ hover, focus, pressed, selected: isPlaying })
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
<StackView
|
|
179
|
+
space={layout === 'vertical' ? 2 : 3}
|
|
180
|
+
direction={layout === 'vertical' ? 'column' : 'row'}
|
|
181
|
+
>
|
|
182
|
+
<ImageContainer {...themeTokens}>{renderThumbnailImage(themeTokens)}</ImageContainer>
|
|
183
|
+
{renderThumbnailInfo(themeTokens)}
|
|
184
|
+
</StackView>
|
|
185
|
+
)
|
|
186
|
+
}}
|
|
166
187
|
</Pressable>
|
|
167
188
|
)
|
|
168
189
|
}
|