@telus-uds/components-web 2.17.2 → 2.18.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 +18 -2
- package/component-docs.json +534 -11
- package/lib/Autocomplete/Autocomplete.js +24 -1
- package/lib/Badge/Badge.js +2 -2
- package/lib/BlockQuote/BlockQuote.js +9 -0
- package/lib/Callout/Callout.js +5 -0
- package/lib/DatePicker/DatePicker.js +24 -4
- package/lib/Disclaimer/Disclaimer.js +4 -0
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +7 -1
- package/lib/Listbox/Listbox.js +7 -1
- package/lib/NavigationBar/NavigationBar.js +8 -2
- package/lib/OrderedList/OrderedList.js +4 -2
- package/lib/Ribbon/Ribbon.js +2 -1
- package/lib/Toast/Toast.js +2 -1
- package/lib/Video/Video.js +3 -1
- package/lib/WaffleGrid/WaffleGrid.js +20 -20
- package/lib-module/Autocomplete/Autocomplete.js +24 -1
- package/lib-module/Badge/Badge.js +1 -1
- package/lib-module/BlockQuote/BlockQuote.js +10 -1
- package/lib-module/Callout/Callout.js +6 -1
- package/lib-module/DatePicker/DatePicker.js +24 -4
- package/lib-module/Disclaimer/Disclaimer.js +4 -0
- package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +8 -2
- package/lib-module/Listbox/Listbox.js +8 -2
- package/lib-module/NavigationBar/NavigationBar.js +8 -2
- package/lib-module/OrderedList/OrderedList.js +5 -3
- package/lib-module/Ribbon/Ribbon.js +3 -2
- package/lib-module/Toast/Toast.js +3 -2
- package/lib-module/Video/Video.js +4 -2
- package/lib-module/WaffleGrid/WaffleGrid.js +21 -21
- package/package.json +3 -3
- package/src/Autocomplete/Autocomplete.jsx +19 -1
- package/src/Badge/Badge.jsx +1 -1
- package/src/BlockQuote/BlockQuote.jsx +10 -1
- package/src/Callout/Callout.jsx +11 -1
- package/src/DatePicker/DatePicker.jsx +20 -2
- package/src/Disclaimer/Disclaimer.jsx +3 -0
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +7 -2
- package/src/Listbox/Listbox.jsx +8 -2
- package/src/NavigationBar/NavigationBar.jsx +7 -2
- package/src/OrderedList/OrderedList.jsx +4 -3
- package/src/Ribbon/Ribbon.jsx +8 -2
- package/src/Toast/Toast.jsx +4 -2
- package/src/Video/Video.jsx +9 -2
- package/src/WaffleGrid/WaffleGrid.jsx +21 -15
- package/types/Callout.d.ts +1 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import { Link, responsiveProps, selectSystemProps, useResponsiveProp, useThemeTokens, withLinkRouter } from '@telus-uds/components-base';
|
|
4
|
+
import { Link, responsiveProps, selectSystemProps, useResponsiveProp, useThemeTokens, withLinkRouter, useViewport, Typography } from '@telus-uds/components-base';
|
|
5
5
|
import OrderedListBase from '../OrderedList/OrderedListBase';
|
|
6
6
|
import ItemBase from '../OrderedList/ItemBase';
|
|
7
7
|
import Image from '../Image';
|
|
@@ -10,19 +10,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
10
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { createElement as _createElement } from "react";
|
|
12
12
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
13
|
-
const DEFAULT_ROW_SIZE = {
|
|
14
|
-
sm: 2,
|
|
15
|
-
lg: 3,
|
|
16
|
-
xl: 6
|
|
17
|
-
};
|
|
18
13
|
|
|
19
|
-
const row = (rowSize,
|
|
14
|
+
const row = (rowSize, rowBorderWidth) => ({
|
|
20
15
|
flexBasis: `calc(100% / ${rowSize})`,
|
|
21
16
|
[`:not(:nth-of-type(${rowSize}n + 1))`]: {
|
|
22
|
-
borderLeftWidth: `${
|
|
17
|
+
borderLeftWidth: `${rowBorderWidth}px`
|
|
23
18
|
},
|
|
24
19
|
[`:nth-of-type(n+${rowSize + 1})`]: {
|
|
25
|
-
borderTopWidth: `${
|
|
20
|
+
borderTopWidth: `${rowBorderWidth}px`
|
|
26
21
|
}
|
|
27
22
|
});
|
|
28
23
|
|
|
@@ -47,9 +42,11 @@ const Item = /*#__PURE__*/styled(ItemBase).withConfig({
|
|
|
47
42
|
} = _ref;
|
|
48
43
|
return {
|
|
49
44
|
display: 'flex',
|
|
50
|
-
flexDirection: '
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
flexDirection: 'row',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
justifyContent: 'center',
|
|
48
|
+
flexGrow: 1,
|
|
49
|
+
flexShrink: 1,
|
|
53
50
|
padding: `${itemPadding}px`,
|
|
54
51
|
boxSizing: 'border-box',
|
|
55
52
|
borderStyle: 'solid',
|
|
@@ -77,24 +74,24 @@ const Center = /*#__PURE__*/styled('div').withConfig({
|
|
|
77
74
|
const WaffleGrid = _ref2 => {
|
|
78
75
|
let {
|
|
79
76
|
items,
|
|
80
|
-
rowSize =
|
|
77
|
+
rowSize = null,
|
|
81
78
|
LinkRouter,
|
|
82
79
|
tokens,
|
|
83
80
|
variant,
|
|
84
81
|
linkRouterProps,
|
|
85
82
|
...rest
|
|
86
83
|
} = _ref2;
|
|
87
|
-
const
|
|
84
|
+
const viewport = useViewport();
|
|
85
|
+
const themeTokens = useThemeTokens('WaffleGrid', tokens, variant, {
|
|
86
|
+
viewport
|
|
87
|
+
});
|
|
88
88
|
const currentRowSize = useResponsiveProp(rowSize);
|
|
89
89
|
return /*#__PURE__*/_jsx(Container, { ...selectProps(rest),
|
|
90
90
|
children: items.map(child => /*#__PURE__*/_createElement(Item, { ...themeTokens,
|
|
91
91
|
key: child.href,
|
|
92
|
-
rowSize: currentRowSize
|
|
92
|
+
rowSize: rowSize ? currentRowSize : themeTokens.rowSize
|
|
93
93
|
}, /*#__PURE__*/_jsx(Link, {
|
|
94
94
|
href: child.href,
|
|
95
|
-
variant: {
|
|
96
|
-
alternative: true
|
|
97
|
-
},
|
|
98
95
|
LinkRouter: child.LinkRouter || LinkRouter,
|
|
99
96
|
linkRouterProps: { ...linkRouterProps,
|
|
100
97
|
...child.linkRouterProps
|
|
@@ -106,10 +103,13 @@ const WaffleGrid = _ref2 => {
|
|
|
106
103
|
_jsx(Image, {
|
|
107
104
|
src: child.image,
|
|
108
105
|
alt: child.imageAltText,
|
|
109
|
-
width:
|
|
110
|
-
height:
|
|
106
|
+
width: 96,
|
|
107
|
+
height: 128
|
|
111
108
|
}) : // Otherwise it must be an arbitrary content, which we just display by itself
|
|
112
|
-
child.image, /*#__PURE__*/_jsx(
|
|
109
|
+
child.image, /*#__PURE__*/_jsx(Typography, {
|
|
110
|
+
variant: {
|
|
111
|
+
weight: 'semibold'
|
|
112
|
+
},
|
|
113
113
|
children: child.text
|
|
114
114
|
})]
|
|
115
115
|
})
|
package/package.json
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
],
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@gorhom/portal": "^1.0.14",
|
|
8
|
-
"@telus-uds/components-base": "1.
|
|
8
|
+
"@telus-uds/components-base": "1.60.0",
|
|
9
9
|
"@telus-uds/system-constants": "^1.3.0",
|
|
10
10
|
"fscreen": "^1.2.0",
|
|
11
11
|
"lodash.omit": "^4.5.0",
|
|
12
12
|
"react-dates": "^21.8.0",
|
|
13
13
|
"react-helmet-async": "^1.3.0",
|
|
14
14
|
"react-moment-proptypes": "^1.8.1",
|
|
15
|
-
"@telus-uds/system-theme-tokens": "^2.41.
|
|
15
|
+
"@telus-uds/system-theme-tokens": "^2.41.1",
|
|
16
16
|
"prop-types": "^15.7.2",
|
|
17
17
|
"lodash.throttle": "^4.1.1",
|
|
18
18
|
"react-youtube": "^10.1.0",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"skip": true
|
|
64
64
|
},
|
|
65
65
|
"types": "types/index.d.ts",
|
|
66
|
-
"version": "2.
|
|
66
|
+
"version": "2.18.0"
|
|
67
67
|
}
|
|
@@ -351,7 +351,25 @@ Autocomplete.propTypes = {
|
|
|
351
351
|
/**
|
|
352
352
|
* Input value for controlled usage
|
|
353
353
|
*/
|
|
354
|
-
value: PropTypes.string
|
|
354
|
+
value: PropTypes.string,
|
|
355
|
+
/**
|
|
356
|
+
* Can be used to set the initial items of the component
|
|
357
|
+
*/
|
|
358
|
+
initialItems: PropTypes.arrayOf(
|
|
359
|
+
PropTypes.shape({ id: PropTypes.string, label: PropTypes.string })
|
|
360
|
+
),
|
|
361
|
+
/**
|
|
362
|
+
* Initial value for the component
|
|
363
|
+
*/
|
|
364
|
+
initialValue: PropTypes.string,
|
|
365
|
+
/**
|
|
366
|
+
* Boolean to set if it's readonly or not
|
|
367
|
+
*/
|
|
368
|
+
readOnly: PropTypes.bool,
|
|
369
|
+
/**
|
|
370
|
+
* Use to visually mark an input as valid or invalid.
|
|
371
|
+
*/
|
|
372
|
+
validation: PropTypes.oneOf(['error', 'success'])
|
|
355
373
|
}
|
|
356
374
|
|
|
357
375
|
export default Autocomplete
|
package/src/Badge/Badge.jsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
+
import styled from 'styled-components'
|
|
2
3
|
import PropTypes from 'prop-types'
|
|
3
4
|
import {
|
|
4
5
|
selectSystemProps,
|
|
@@ -6,7 +7,6 @@ import {
|
|
|
6
7
|
getTokensPropType,
|
|
7
8
|
useThemeTokens
|
|
8
9
|
} from '@telus-uds/components-base'
|
|
9
|
-
import styled from 'styled-components'
|
|
10
10
|
import { htmlAttrs, transformGradient } from '../utils'
|
|
11
11
|
|
|
12
12
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
Typography,
|
|
8
8
|
useThemeTokens,
|
|
9
9
|
withLinkRouter,
|
|
10
|
-
useViewport
|
|
10
|
+
useViewport,
|
|
11
|
+
getTokensPropType
|
|
11
12
|
} from '@telus-uds/components-base'
|
|
12
13
|
import styled from 'styled-components'
|
|
13
14
|
import { htmlAttrs, transformGradient } from '../utils'
|
|
@@ -167,6 +168,14 @@ const BlockQuote = ({
|
|
|
167
168
|
BlockQuote.propTypes = {
|
|
168
169
|
...selectedSystemPropTypes,
|
|
169
170
|
...withLinkRouter.propTypes,
|
|
171
|
+
tokens: getTokensPropType('BlockQuote'),
|
|
172
|
+
variant: PropTypes.exact({
|
|
173
|
+
alternative: PropTypes.bool,
|
|
174
|
+
size: PropTypes.string
|
|
175
|
+
}),
|
|
176
|
+
/**
|
|
177
|
+
* Children nodes that can be added
|
|
178
|
+
*/
|
|
170
179
|
children: PropTypes.node.isRequired,
|
|
171
180
|
/**
|
|
172
181
|
* External source's identifier (e.g. author's name)
|
package/src/Callout/Callout.jsx
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import styled from 'styled-components'
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Icon,
|
|
6
|
+
selectSystemProps,
|
|
7
|
+
Typography,
|
|
8
|
+
useThemeTokens,
|
|
9
|
+
getTokensPropType
|
|
10
|
+
} from '@telus-uds/components-base'
|
|
5
11
|
|
|
6
12
|
import { htmlAttrs } from '../utils'
|
|
7
13
|
|
|
@@ -91,10 +97,14 @@ const Callout = ({
|
|
|
91
97
|
|
|
92
98
|
Callout.propTypes = {
|
|
93
99
|
...selectedSystemPropTypes,
|
|
100
|
+
tokens: getTokensPropType('Callout'),
|
|
94
101
|
/**
|
|
95
102
|
* Icon to display on the left side of the Callout
|
|
96
103
|
*/
|
|
97
104
|
icon: PropTypes.elementType,
|
|
105
|
+
/**
|
|
106
|
+
* Children nodes that can be added
|
|
107
|
+
*/
|
|
98
108
|
children: PropTypes.node.isRequired,
|
|
99
109
|
/**
|
|
100
110
|
* To change the horizontal alignment of the Callout's text
|
|
@@ -86,6 +86,8 @@ const DatePicker = forwardRef(
|
|
|
86
86
|
variant = {},
|
|
87
87
|
validation,
|
|
88
88
|
disabled,
|
|
89
|
+
prevTestID,
|
|
90
|
+
nextTestID,
|
|
89
91
|
...rest
|
|
90
92
|
},
|
|
91
93
|
ref
|
|
@@ -187,6 +189,7 @@ const DatePicker = forwardRef(
|
|
|
187
189
|
}}
|
|
188
190
|
icon={previousIcon}
|
|
189
191
|
variant={{ size: 'small' }}
|
|
192
|
+
testID={prevTestID}
|
|
190
193
|
/>
|
|
191
194
|
)
|
|
192
195
|
const renderNextButton = ({ onClick }) => (
|
|
@@ -196,6 +199,7 @@ const DatePicker = forwardRef(
|
|
|
196
199
|
}}
|
|
197
200
|
icon={nextIcon}
|
|
198
201
|
variant={{ size: 'small' }}
|
|
202
|
+
testID={nextTestID}
|
|
199
203
|
/>
|
|
200
204
|
)
|
|
201
205
|
return (
|
|
@@ -361,7 +365,19 @@ DatePicker.propTypes = {
|
|
|
361
365
|
/**
|
|
362
366
|
* Disable the input which will not open the calendar picker
|
|
363
367
|
*/
|
|
364
|
-
disabled: PropTypes.bool
|
|
368
|
+
disabled: PropTypes.bool,
|
|
369
|
+
/**
|
|
370
|
+
* A unique identifier for the previous icon button located on the datepicker.
|
|
371
|
+
* This is for automation testing purposes.
|
|
372
|
+
* Will be added as a `data-testid-prev` attribute for example.
|
|
373
|
+
*/
|
|
374
|
+
prevTestID: PropTypes.string,
|
|
375
|
+
/**
|
|
376
|
+
* A unique identifier for the next icon button located on the datepicker.
|
|
377
|
+
* This is for automation testing purposes.
|
|
378
|
+
* Will be added as a `data-testid-next` attribute for example.
|
|
379
|
+
*/
|
|
380
|
+
nextTestID: PropTypes.string
|
|
365
381
|
}
|
|
366
382
|
|
|
367
383
|
DatePicker.defaultProps = {
|
|
@@ -376,7 +392,9 @@ DatePicker.defaultProps = {
|
|
|
376
392
|
tooltip: undefined,
|
|
377
393
|
onDateChange: () => {},
|
|
378
394
|
validation: undefined,
|
|
379
|
-
disabled: false
|
|
395
|
+
disabled: false,
|
|
396
|
+
prevTestID: '',
|
|
397
|
+
nextTestID: ''
|
|
380
398
|
}
|
|
381
399
|
|
|
382
400
|
export default DatePicker
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
|
-
import { ExpandCollapse } from '@telus-uds/components-base'
|
|
3
|
+
import { ExpandCollapse, getTokensPropType } from '@telus-uds/components-base'
|
|
4
4
|
import ExpandCollapseMiniControl from './ExpandCollapseMiniControl'
|
|
5
5
|
|
|
6
6
|
const ExpandCollapseMini = forwardRef(({ children, onToggle, tokens, nativeID, ...rest }, ref) => {
|
|
@@ -51,10 +51,15 @@ ExpandCollapseMini.propTypes = {
|
|
|
51
51
|
* ID for DOM element on web
|
|
52
52
|
*/
|
|
53
53
|
nativeID: PropTypes.string,
|
|
54
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Children nodes that can be added
|
|
56
|
+
*/
|
|
57
|
+
children: PropTypes.node.isRequired,
|
|
58
|
+
tokens: getTokensPropType('ExpandCollapseMini')
|
|
55
59
|
}
|
|
56
60
|
ExpandCollapseMini.defaultProps = {
|
|
57
61
|
onToggle: () => {},
|
|
62
|
+
tokens: {},
|
|
58
63
|
nativeID: ''
|
|
59
64
|
}
|
|
60
65
|
|
package/src/Listbox/Listbox.jsx
CHANGED
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
ExpandCollapse,
|
|
6
6
|
useThemeTokens,
|
|
7
7
|
withLinkRouter,
|
|
8
|
-
ListboxContext
|
|
8
|
+
ListboxContext,
|
|
9
|
+
getTokensPropType
|
|
9
10
|
} from '@telus-uds/components-base'
|
|
10
11
|
import ListboxGroup from './ListboxGroup'
|
|
11
12
|
import ListboxItem from './ListboxItem'
|
|
@@ -155,7 +156,12 @@ Listbox.propTypes = {
|
|
|
155
156
|
/**
|
|
156
157
|
* To select an item by default
|
|
157
158
|
*/
|
|
158
|
-
selectedId: PropTypes.string
|
|
159
|
+
selectedId: PropTypes.string,
|
|
160
|
+
/**
|
|
161
|
+
* onClose event
|
|
162
|
+
*/
|
|
163
|
+
onClose: PropTypes.func,
|
|
164
|
+
tokens: getTokensPropType('Listbox')
|
|
159
165
|
}
|
|
160
166
|
|
|
161
167
|
Listbox.Overlay = DropdownOverlay
|
|
@@ -209,12 +209,17 @@ NavigationBar.propTypes = {
|
|
|
209
209
|
/**
|
|
210
210
|
* Optional function to be called on pressing a link
|
|
211
211
|
*/
|
|
212
|
-
onChange: PropTypes.func
|
|
212
|
+
onChange: PropTypes.func,
|
|
213
|
+
/**
|
|
214
|
+
* Accesibility role for stackview
|
|
215
|
+
*/
|
|
216
|
+
accessibilityRole: PropTypes.string
|
|
213
217
|
}
|
|
214
218
|
NavigationBar.defaultProps = {
|
|
215
219
|
heading: undefined,
|
|
216
220
|
headingLevel: 'h1',
|
|
217
|
-
onChange: () => {}
|
|
221
|
+
onChange: () => {},
|
|
222
|
+
accessibilityRole: ''
|
|
218
223
|
}
|
|
219
224
|
|
|
220
225
|
export default NavigationBar
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import styled from 'styled-components'
|
|
4
|
-
import { selectSystemProps } from '@telus-uds/components-base'
|
|
4
|
+
import { selectSystemProps, variantProp } from '@telus-uds/components-base'
|
|
5
5
|
import { htmlAttrs } from '../utils'
|
|
6
6
|
import OrderedListBase from './OrderedListBase'
|
|
7
7
|
import Item from './Item'
|
|
@@ -52,9 +52,10 @@ OrderedList.propTypes = {
|
|
|
52
52
|
/**
|
|
53
53
|
* The position to start the list with.
|
|
54
54
|
*/
|
|
55
|
-
start: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
55
|
+
start: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
56
|
+
variant: variantProp.propType
|
|
56
57
|
}
|
|
57
|
-
OrderedList.defaultProps = { start: 1 }
|
|
58
|
+
OrderedList.defaultProps = { start: 1, variant: {} }
|
|
58
59
|
|
|
59
60
|
OrderedList.Item = Item
|
|
60
61
|
|
package/src/Ribbon/Ribbon.jsx
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
selectSystemProps,
|
|
5
|
+
Typography,
|
|
6
|
+
useThemeTokens,
|
|
7
|
+
getTokensPropType
|
|
8
|
+
} from '@telus-uds/components-base'
|
|
4
9
|
import styled from 'styled-components'
|
|
5
10
|
import { htmlAttrs } from '../utils'
|
|
6
11
|
|
|
@@ -141,7 +146,8 @@ Ribbon.propTypes = {
|
|
|
141
146
|
/** sets the left offset (triggers absolute positioning) */
|
|
142
147
|
left: PropTypes.number,
|
|
143
148
|
/** sets the top offset (triggers absolute positioning) */
|
|
144
|
-
top: PropTypes.number
|
|
149
|
+
top: PropTypes.number,
|
|
150
|
+
tokens: getTokensPropType('Ribbon')
|
|
145
151
|
}
|
|
146
152
|
|
|
147
153
|
export default Ribbon
|
package/src/Toast/Toast.jsx
CHANGED
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
Typography,
|
|
8
8
|
withLinkRouter,
|
|
9
9
|
Spacer,
|
|
10
|
-
useViewport
|
|
10
|
+
useViewport,
|
|
11
|
+
getTokensPropType
|
|
11
12
|
} from '@telus-uds/components-base'
|
|
12
13
|
import styled, { keyframes, css } from 'styled-components'
|
|
13
14
|
import { htmlAttrs } from '../utils'
|
|
@@ -180,7 +181,8 @@ Toast.propTypes = {
|
|
|
180
181
|
text: PropTypes.string.isRequired,
|
|
181
182
|
LinkRouter: withLinkRouter.propTypes?.LinkRouter,
|
|
182
183
|
linkRouterProps: withLinkRouter.propTypes?.linkRouterProps
|
|
183
|
-
})
|
|
184
|
+
}),
|
|
185
|
+
tokens: getTokensPropType('Toast')
|
|
184
186
|
}
|
|
185
187
|
|
|
186
188
|
export default Toast
|
package/src/Video/Video.jsx
CHANGED
|
@@ -2,7 +2,12 @@ import React, { useEffect, useRef, useState } from 'react'
|
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import styled from 'styled-components'
|
|
4
4
|
import fscreen from 'fscreen'
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
useThemeTokens,
|
|
7
|
+
selectSystemProps,
|
|
8
|
+
getTokensPropType,
|
|
9
|
+
variantProp
|
|
10
|
+
} from '@telus-uds/components-base'
|
|
6
11
|
import Spinner from '../Spinner'
|
|
7
12
|
|
|
8
13
|
import { warn, htmlAttrs } from '../utils'
|
|
@@ -969,7 +974,9 @@ Video.propTypes = {
|
|
|
969
974
|
* The title of the video being rendered. This is used for analytics purposes in conjunction with `analyticsTracking`.
|
|
970
975
|
* @since 1.3.0
|
|
971
976
|
*/
|
|
972
|
-
videoTitle: PropTypes.string
|
|
977
|
+
videoTitle: PropTypes.string,
|
|
978
|
+
tokens: getTokensPropType('Video'),
|
|
979
|
+
variant: variantProp.propType
|
|
973
980
|
}
|
|
974
981
|
|
|
975
982
|
Video.defaultProps = {
|
|
@@ -7,7 +7,9 @@ import {
|
|
|
7
7
|
selectSystemProps,
|
|
8
8
|
useResponsiveProp,
|
|
9
9
|
useThemeTokens,
|
|
10
|
-
withLinkRouter
|
|
10
|
+
withLinkRouter,
|
|
11
|
+
useViewport,
|
|
12
|
+
Typography
|
|
11
13
|
} from '@telus-uds/components-base'
|
|
12
14
|
import OrderedListBase from '../OrderedList/OrderedListBase'
|
|
13
15
|
import ItemBase from '../OrderedList/ItemBase'
|
|
@@ -16,15 +18,13 @@ import { htmlAttrs } from '../utils'
|
|
|
16
18
|
|
|
17
19
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
18
20
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const row = (rowSize, rowBorderSize) => ({
|
|
21
|
+
const row = (rowSize, rowBorderWidth) => ({
|
|
22
22
|
flexBasis: `calc(100% / ${rowSize})`,
|
|
23
23
|
[`:not(:nth-of-type(${rowSize}n + 1))`]: {
|
|
24
|
-
borderLeftWidth: `${
|
|
24
|
+
borderLeftWidth: `${rowBorderWidth}px`
|
|
25
25
|
},
|
|
26
26
|
[`:nth-of-type(n+${rowSize + 1})`]: {
|
|
27
|
-
borderTopWidth: `${
|
|
27
|
+
borderTopWidth: `${rowBorderWidth}px`
|
|
28
28
|
}
|
|
29
29
|
})
|
|
30
30
|
|
|
@@ -37,9 +37,11 @@ const Container = styled(OrderedListBase)({
|
|
|
37
37
|
|
|
38
38
|
const Item = styled(ItemBase)(({ rowSize, itemPadding, itemBorderColor, rowBorderWidth }) => ({
|
|
39
39
|
display: 'flex',
|
|
40
|
-
flexDirection: '
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
flexDirection: 'row',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
justifyContent: 'center',
|
|
43
|
+
flexGrow: 1,
|
|
44
|
+
flexShrink: 1,
|
|
43
45
|
padding: `${itemPadding}px`,
|
|
44
46
|
boxSizing: 'border-box',
|
|
45
47
|
borderStyle: 'solid',
|
|
@@ -63,35 +65,39 @@ const Center = styled('div')({
|
|
|
63
65
|
*/
|
|
64
66
|
const WaffleGrid = ({
|
|
65
67
|
items,
|
|
66
|
-
rowSize =
|
|
68
|
+
rowSize = null,
|
|
67
69
|
LinkRouter,
|
|
68
70
|
tokens,
|
|
69
71
|
variant,
|
|
70
72
|
linkRouterProps,
|
|
71
73
|
...rest
|
|
72
74
|
}) => {
|
|
73
|
-
const
|
|
75
|
+
const viewport = useViewport()
|
|
76
|
+
const themeTokens = useThemeTokens('WaffleGrid', tokens, variant, { viewport })
|
|
74
77
|
const currentRowSize = useResponsiveProp(rowSize)
|
|
75
78
|
|
|
76
79
|
return (
|
|
77
80
|
<Container {...selectProps(rest)}>
|
|
78
81
|
{items.map((child) => (
|
|
79
|
-
<Item
|
|
82
|
+
<Item
|
|
83
|
+
{...themeTokens}
|
|
84
|
+
key={child.href}
|
|
85
|
+
rowSize={rowSize ? currentRowSize : themeTokens.rowSize}
|
|
86
|
+
>
|
|
80
87
|
<Link
|
|
81
88
|
href={child.href}
|
|
82
|
-
variant={{ alternative: true }}
|
|
83
89
|
LinkRouter={child.LinkRouter || LinkRouter}
|
|
84
90
|
linkRouterProps={{ ...linkRouterProps, ...child.linkRouterProps }}
|
|
85
91
|
>
|
|
86
92
|
<Center>
|
|
87
93
|
{typeof child.image === 'string' ? (
|
|
88
94
|
// Assuming that string passed is the image URL
|
|
89
|
-
<Image src={child.image} alt={child.imageAltText} width={
|
|
95
|
+
<Image src={child.image} alt={child.imageAltText} width={96} height={128} />
|
|
90
96
|
) : (
|
|
91
97
|
// Otherwise it must be an arbitrary content, which we just display by itself
|
|
92
98
|
child.image
|
|
93
99
|
)}
|
|
94
|
-
<
|
|
100
|
+
<Typography variant={{ weight: 'semibold' }}>{child.text}</Typography>
|
|
95
101
|
</Center>
|
|
96
102
|
</Link>
|
|
97
103
|
</Item>
|
package/types/Callout.d.ts
CHANGED