@telus-uds/components-web 2.8.1 → 2.10.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 +28 -2
- package/component-docs.json +106 -84
- package/lib/BlockQuote/BlockQuote.js +49 -4
- package/lib/Callout/Callout.js +12 -0
- package/lib/Countdown/Countdown.js +34 -25
- package/lib/Countdown/Segment.js +2 -0
- package/lib/Countdown/constants.js +3 -3
- package/lib/DatePicker/CalendarContainer.js +24 -0
- package/lib/DatePicker/DatePicker.js +8 -2
- package/lib/Disclaimer/Disclaimer.js +0 -4
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +4 -0
- package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +16 -0
- package/lib/Footnote/Footnote.js +28 -11
- package/lib/IconButton/IconButton.js +8 -0
- package/lib/Listbox/Listbox.js +8 -0
- package/lib/Modal/ModalContent.js +0 -1
- package/lib/NavigationBar/NavigationBar.js +4 -0
- package/lib/OrderedList/Item.js +4 -0
- package/lib/Paragraph/Paragraph.js +4 -0
- package/lib/PreviewCard/AuthorDate.js +7 -0
- package/lib/PreviewCard/PreviewCard.js +3 -6
- package/lib/PriceLockup/PriceLockup.js +48 -0
- package/lib/QuantitySelector/QuantitySelector.js +51 -0
- package/lib/Span/Span.js +4 -0
- package/lib/Table/Table.js +4 -0
- package/lib/Toast/Toast.js +32 -2
- package/lib-module/BlockQuote/BlockQuote.js +50 -5
- package/lib-module/Callout/Callout.js +12 -0
- package/lib-module/Countdown/Countdown.js +34 -25
- package/lib-module/Countdown/Segment.js +3 -1
- package/lib-module/Countdown/constants.js +2 -2
- package/lib-module/DatePicker/CalendarContainer.js +24 -0
- package/lib-module/DatePicker/DatePicker.js +8 -2
- package/lib-module/Disclaimer/Disclaimer.js +0 -4
- package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +4 -0
- package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +16 -0
- package/lib-module/Footnote/Footnote.js +28 -11
- package/lib-module/IconButton/IconButton.js +8 -0
- package/lib-module/Listbox/Listbox.js +8 -0
- package/lib-module/Modal/ModalContent.js +0 -1
- package/lib-module/NavigationBar/NavigationBar.js +4 -0
- package/lib-module/OrderedList/Item.js +4 -0
- package/lib-module/Paragraph/Paragraph.js +4 -0
- package/lib-module/PreviewCard/AuthorDate.js +7 -0
- package/lib-module/PreviewCard/PreviewCard.js +3 -6
- package/lib-module/PriceLockup/PriceLockup.js +48 -0
- package/lib-module/QuantitySelector/QuantitySelector.js +51 -0
- package/lib-module/Span/Span.js +4 -0
- package/lib-module/Table/Table.js +4 -0
- package/lib-module/Toast/Toast.js +33 -3
- package/package.json +3 -3
- package/src/BlockQuote/BlockQuote.jsx +53 -6
- package/src/Callout/Callout.jsx +9 -0
- package/src/Countdown/Countdown.jsx +34 -23
- package/src/Countdown/Segment.jsx +2 -1
- package/src/Countdown/constants.js +1 -1
- package/src/DatePicker/CalendarContainer.jsx +24 -0
- package/src/DatePicker/DatePicker.jsx +8 -2
- package/src/Disclaimer/Disclaimer.jsx +0 -3
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +3 -0
- package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +12 -0
- package/src/Footnote/Footnote.jsx +44 -17
- package/src/IconButton/IconButton.jsx +6 -0
- package/src/Listbox/Listbox.jsx +6 -0
- package/src/Modal/ModalContent.jsx +0 -1
- package/src/NavigationBar/NavigationBar.jsx +3 -0
- package/src/OrderedList/Item.jsx +3 -0
- package/src/Paragraph/Paragraph.jsx +3 -0
- package/src/PreviewCard/AuthorDate.jsx +6 -0
- package/src/PreviewCard/PreviewCard.jsx +3 -7
- package/src/PriceLockup/PriceLockup.jsx +37 -0
- package/src/QuantitySelector/QuantitySelector.jsx +39 -0
- package/src/Span/Span.jsx +3 -0
- package/src/Table/Table.jsx +3 -0
- package/src/Toast/Toast.jsx +27 -4
|
@@ -39,6 +39,9 @@ ExpandCollapseMini.displayName = 'ExpandCollapseMini'
|
|
|
39
39
|
|
|
40
40
|
ExpandCollapseMini.propTypes = {
|
|
41
41
|
...ExpandCollapseMiniControl.propTypes,
|
|
42
|
+
/**
|
|
43
|
+
* Function to call on pressing the panel's control, which should open or close the panel.
|
|
44
|
+
*/
|
|
42
45
|
onToggle: PropTypes.func,
|
|
43
46
|
children: PropTypes.node.isRequired
|
|
44
47
|
}
|
|
@@ -57,9 +57,21 @@ const ExpandCollapseMiniControl = ({
|
|
|
57
57
|
ExpandCollapseMiniControl.propTypes = {
|
|
58
58
|
...selectedSystemPropTypes,
|
|
59
59
|
...Link.propTypes,
|
|
60
|
+
/**
|
|
61
|
+
* Optional function to call on pressing the panel's control, in addition to opening or closing the panel
|
|
62
|
+
*/
|
|
60
63
|
onPress: PropTypes.func,
|
|
64
|
+
/**
|
|
65
|
+
* ExpandCollapseMiniControl title when expanded
|
|
66
|
+
*/
|
|
61
67
|
expandTitle: PropTypes.string.isRequired,
|
|
68
|
+
/**
|
|
69
|
+
* ExpandCollapseMiniControl title when collapsed
|
|
70
|
+
*/
|
|
62
71
|
collapseTitle: PropTypes.string.isRequired,
|
|
72
|
+
/**
|
|
73
|
+
* React Native's `Pressable`'s state object
|
|
74
|
+
*/
|
|
63
75
|
pressableState: PropTypes.object,
|
|
64
76
|
variant: PropTypes.object
|
|
65
77
|
}
|
|
@@ -137,13 +137,19 @@ const ListItem = styled(OrderedListBase.Item)(
|
|
|
137
137
|
)
|
|
138
138
|
|
|
139
139
|
const CloseButton = styled.button(
|
|
140
|
-
({
|
|
140
|
+
({
|
|
141
|
+
closeButtonBorder,
|
|
142
|
+
closeButtonHeight,
|
|
143
|
+
closeButtonBackgroundColor,
|
|
144
|
+
closeButtonMargin,
|
|
145
|
+
closeButtonWidth
|
|
146
|
+
}) => ({
|
|
141
147
|
alignItems: 'center',
|
|
142
148
|
borderRadius: '50%',
|
|
143
149
|
cursor: 'pointer',
|
|
144
150
|
display: 'flex',
|
|
145
151
|
justifyContent: 'center',
|
|
146
|
-
backgroundColor:
|
|
152
|
+
backgroundColor: closeButtonBackgroundColor,
|
|
147
153
|
border: closeButtonBorder,
|
|
148
154
|
height: closeButtonHeight,
|
|
149
155
|
margin: closeButtonMargin,
|
|
@@ -163,10 +169,16 @@ const ContentContainer = styled.div(
|
|
|
163
169
|
})
|
|
164
170
|
)
|
|
165
171
|
|
|
166
|
-
const StyledCustomContentContainer = styled.div(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
172
|
+
const StyledCustomContentContainer = styled.div(
|
|
173
|
+
({ listItemColor, listItemFontSize, listItemLineHeight, listItemPaddingLeft }) => ({
|
|
174
|
+
fontSize: listItemFontSize,
|
|
175
|
+
lineHeight: listItemLineHeight,
|
|
176
|
+
paddingLeft: listItemPaddingLeft,
|
|
177
|
+
color: listItemColor,
|
|
178
|
+
fontFamily: 'HelveticaNow400normal'
|
|
179
|
+
})
|
|
180
|
+
)
|
|
181
|
+
|
|
170
182
|
const usePrevious = (value) => {
|
|
171
183
|
const ref = useRef()
|
|
172
184
|
useEffect(() => {
|
|
@@ -224,8 +236,6 @@ const Footnote = (props) => {
|
|
|
224
236
|
footnoteHeaderPaddingBottom,
|
|
225
237
|
headerLineHeight,
|
|
226
238
|
headerFontSize,
|
|
227
|
-
headerFontName,
|
|
228
|
-
headerFontWeight,
|
|
229
239
|
listPaddingLeft,
|
|
230
240
|
listItemMarkerFontSize,
|
|
231
241
|
listItemMarkerLineHeight,
|
|
@@ -235,6 +245,7 @@ const Footnote = (props) => {
|
|
|
235
245
|
listItemPaddingLeft,
|
|
236
246
|
closeButtonBorderSize,
|
|
237
247
|
closeButtonBorderColor,
|
|
248
|
+
closeButtonBackgroundColor,
|
|
238
249
|
closeButtonHeight,
|
|
239
250
|
closeButtonMarginTop,
|
|
240
251
|
closeButtonMarginLeft,
|
|
@@ -401,7 +412,15 @@ const Footnote = (props) => {
|
|
|
401
412
|
}
|
|
402
413
|
if (React.isValidElement(data.content)) {
|
|
403
414
|
return (
|
|
404
|
-
<StyledCustomContentContainer
|
|
415
|
+
<StyledCustomContentContainer
|
|
416
|
+
listItemColor={listItemColor}
|
|
417
|
+
listItemFontSize={listItemFontSize}
|
|
418
|
+
listItemLineHeight={listItemLineHeight}
|
|
419
|
+
listItemPaddingLeft={listItemPaddingLeft}
|
|
420
|
+
ref={contentRef}
|
|
421
|
+
>
|
|
422
|
+
{data.content}
|
|
423
|
+
</StyledCustomContentContainer>
|
|
405
424
|
)
|
|
406
425
|
}
|
|
407
426
|
return (
|
|
@@ -414,7 +433,14 @@ const Footnote = (props) => {
|
|
|
414
433
|
listItemLineHeight={listItemLineHeight}
|
|
415
434
|
listItemPaddingLeft={listItemPaddingLeft}
|
|
416
435
|
>
|
|
417
|
-
<Typography
|
|
436
|
+
<Typography
|
|
437
|
+
tokens={{
|
|
438
|
+
fontSize: listItemFontSize,
|
|
439
|
+
lineHeight: listItemLineHeight
|
|
440
|
+
}}
|
|
441
|
+
>
|
|
442
|
+
{renderStructuredContent(data.content)}
|
|
443
|
+
</Typography>
|
|
418
444
|
</ListItem>
|
|
419
445
|
</List>
|
|
420
446
|
)
|
|
@@ -453,19 +479,20 @@ const Footnote = (props) => {
|
|
|
453
479
|
footnoteHeaderPaddingBottom={footnoteHeaderPaddingBottom}
|
|
454
480
|
headerMargin={headerMargin}
|
|
455
481
|
>
|
|
456
|
-
<
|
|
457
|
-
|
|
458
|
-
fontSize:
|
|
459
|
-
lineHeight:
|
|
460
|
-
fontFamily: `${headerFontName}${headerFontWeight}normal`
|
|
482
|
+
<Typography
|
|
483
|
+
tokens={{
|
|
484
|
+
fontSize: headerFontSize,
|
|
485
|
+
lineHeight: headerLineHeight
|
|
461
486
|
}}
|
|
487
|
+
variant={{ size: 'h4' }}
|
|
462
488
|
>
|
|
463
489
|
{getCopy('heading')}
|
|
464
|
-
</
|
|
490
|
+
</Typography>
|
|
465
491
|
<CloseButton
|
|
466
|
-
closeButtonBorder={`${closeButtonBorderSize}
|
|
492
|
+
closeButtonBorder={`${closeButtonBorderSize} solid ${closeButtonBorderColor}`}
|
|
467
493
|
closeButtonWidth={`${closeButtonWidth}px`}
|
|
468
494
|
closeButtonHeight={`${closeButtonHeight}px`}
|
|
495
|
+
closeButtonBackgroundColor={closeButtonBackgroundColor}
|
|
469
496
|
closeButtonMargin={`${closeButtonMarginTop}px ${closeButtonMarginRight}px ${closeButtonMarginBottom}px ${closeButtonMarginLeft}px`}
|
|
470
497
|
onClick={(event) => {
|
|
471
498
|
closeFootnote(event, { returnFocus: true })
|
|
@@ -36,8 +36,14 @@ IconButton.displayName = 'IconButton'
|
|
|
36
36
|
const propsWithoutIcon = ({ icon, ...props }) => props
|
|
37
37
|
IconButton.propTypes = {
|
|
38
38
|
...propsWithoutIcon(IconButtonBase.propTypes),
|
|
39
|
+
/**
|
|
40
|
+
* To set the icon to a multi-brand compatabile icon
|
|
41
|
+
*/
|
|
39
42
|
// eslint-disable-next-line react/require-default-props
|
|
40
43
|
action: PropTypes.oneOf(multiBrandIconNames),
|
|
44
|
+
/**
|
|
45
|
+
* To set a custom icon
|
|
46
|
+
*/
|
|
41
47
|
icon: PropTypes.func
|
|
42
48
|
}
|
|
43
49
|
|
package/src/Listbox/Listbox.jsx
CHANGED
|
@@ -139,7 +139,13 @@ Listbox.propTypes = {
|
|
|
139
139
|
* the last menu item.
|
|
140
140
|
*/
|
|
141
141
|
parentRef: PropTypes.object,
|
|
142
|
+
/**
|
|
143
|
+
* `Listbox` items
|
|
144
|
+
*/
|
|
142
145
|
items: PropTypes.array,
|
|
146
|
+
/**
|
|
147
|
+
* To select an item by default
|
|
148
|
+
*/
|
|
143
149
|
selectedId: PropTypes.string
|
|
144
150
|
}
|
|
145
151
|
|
|
@@ -198,6 +198,9 @@ NavigationBar.propTypes = {
|
|
|
198
198
|
* Common navigation bar heading.
|
|
199
199
|
*/
|
|
200
200
|
heading: PropTypes.string,
|
|
201
|
+
/**
|
|
202
|
+
* Sets the `headingLevel` of the `heading`
|
|
203
|
+
*/
|
|
201
204
|
headingLevel: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6']),
|
|
202
205
|
/**
|
|
203
206
|
* Matches the `id` property of the item in `items` corresponding to the current page
|
package/src/OrderedList/Item.jsx
CHANGED
|
@@ -49,6 +49,9 @@ const Paragraph = ({ children, variant, tokens, testID, align, linesBetween = 1,
|
|
|
49
49
|
Paragraph.propTypes = {
|
|
50
50
|
...selectedSystemPropTypes,
|
|
51
51
|
children: PropTypes.node.isRequired,
|
|
52
|
+
/**
|
|
53
|
+
* Adds a `data-testid` attribute to the element for testing purposes
|
|
54
|
+
*/
|
|
52
55
|
testID: PropTypes.string,
|
|
53
56
|
/**
|
|
54
57
|
* Sets the alignment style for the paragraph. Same options as Typography's `align` prop.
|
|
@@ -120,20 +120,16 @@ const PreviewCard = forwardRef(
|
|
|
120
120
|
>
|
|
121
121
|
{Boolean(tag) && (
|
|
122
122
|
<>
|
|
123
|
-
<Typography variant={{ size: 'eyebrow'
|
|
124
|
-
{tag}
|
|
125
|
-
</Typography>
|
|
123
|
+
<Typography variant={{ size: 'eyebrow' }}>{tag}</Typography>
|
|
126
124
|
<Spacer space={2} />
|
|
127
125
|
</>
|
|
128
126
|
)}
|
|
129
|
-
<Typography variant={{ size: 'h4'
|
|
127
|
+
<Typography variant={{ size: 'h4' }}>{title}</Typography>
|
|
130
128
|
{Boolean(footer) && (
|
|
131
129
|
<>
|
|
132
130
|
<Spacer space={2} />
|
|
133
131
|
{typeof footer === 'string' ? (
|
|
134
|
-
<Typography variant={{ size: 'small'
|
|
135
|
-
{footer}
|
|
136
|
-
</Typography>
|
|
132
|
+
<Typography variant={{ size: 'small' }}>{footer}</Typography>
|
|
137
133
|
) : (
|
|
138
134
|
footer
|
|
139
135
|
)}
|
|
@@ -226,16 +226,53 @@ const PriceLockup = ({
|
|
|
226
226
|
|
|
227
227
|
PriceLockup.propTypes = {
|
|
228
228
|
...selectedSystemPropTypes,
|
|
229
|
+
/**
|
|
230
|
+
* Size of the component
|
|
231
|
+
*
|
|
232
|
+
* Small for pricing in product catalogue pages, medium for pricing in product comparison cards and large for pricing in banners and promo cards
|
|
233
|
+
*/
|
|
229
234
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
235
|
+
/**
|
|
236
|
+
* If currency symbol other than `$` to be used
|
|
237
|
+
*/
|
|
230
238
|
currencySymbol: PropTypes.string,
|
|
239
|
+
/**
|
|
240
|
+
* Shows additional info above the price
|
|
241
|
+
*/
|
|
231
242
|
topText: PropTypes.string,
|
|
243
|
+
/**
|
|
244
|
+
* Monetary value (including decimals separated by ".")
|
|
245
|
+
*/
|
|
232
246
|
price: PropTypes.string.isRequired,
|
|
247
|
+
/**
|
|
248
|
+
* Shows month/year unit
|
|
249
|
+
*/
|
|
233
250
|
rateText: PropTypes.string,
|
|
251
|
+
/**
|
|
252
|
+
* Shows additional info below the price with a `Divider`
|
|
253
|
+
*/
|
|
234
254
|
bottomText: PropTypes.string,
|
|
255
|
+
/**
|
|
256
|
+
* Displays which side the currency should apperar (left, right)
|
|
257
|
+
*/
|
|
235
258
|
signDirection: PropTypes.oneOf(['right', 'left']),
|
|
259
|
+
/**
|
|
260
|
+
* Shows additional link for context
|
|
261
|
+
*/
|
|
236
262
|
footnoteLinks: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
|
|
263
|
+
/**
|
|
264
|
+
* Function to be called when a footnote link is clicked
|
|
265
|
+
*/
|
|
237
266
|
onClickFootnote: PropTypes.func,
|
|
267
|
+
/**
|
|
268
|
+
* To show price savings comparison
|
|
269
|
+
*/
|
|
238
270
|
strikeThrough: PropTypes.bool,
|
|
271
|
+
/**
|
|
272
|
+
* To provide a11y text for `PriceLockup` component
|
|
273
|
+
*
|
|
274
|
+
* **Note:** a11yText will override strikethrough price, so it must include price (ie. "was 50 dollars per month")
|
|
275
|
+
*/
|
|
239
276
|
a11yText: PropTypes.string
|
|
240
277
|
}
|
|
241
278
|
|
|
@@ -210,25 +210,64 @@ const dictionaryContentShape = PropTypes.shape({
|
|
|
210
210
|
})
|
|
211
211
|
|
|
212
212
|
QuantitySelector.propTypes = {
|
|
213
|
+
/**
|
|
214
|
+
* The id of the input field
|
|
215
|
+
*/
|
|
213
216
|
id: PropTypes.string,
|
|
217
|
+
/**
|
|
218
|
+
* The minimum number allowed
|
|
219
|
+
*/
|
|
214
220
|
minNumber: PropTypes.number,
|
|
221
|
+
/**
|
|
222
|
+
* The maximum number allowed
|
|
223
|
+
*/
|
|
215
224
|
maxNumber: PropTypes.number,
|
|
225
|
+
/**
|
|
226
|
+
* The callback function that is called when the value of the input field changes
|
|
227
|
+
*/
|
|
216
228
|
onChange: PropTypes.func,
|
|
229
|
+
/**
|
|
230
|
+
* The default value of the input field
|
|
231
|
+
*/
|
|
217
232
|
defaultValue: PropTypes.number,
|
|
233
|
+
/**
|
|
234
|
+
* The label of the input field
|
|
235
|
+
*/
|
|
218
236
|
label: PropTypes.string,
|
|
237
|
+
/**
|
|
238
|
+
* The hint of the input field
|
|
239
|
+
*/
|
|
219
240
|
hint: PropTypes.string,
|
|
241
|
+
/**
|
|
242
|
+
* The position of the hint. Could be shown along side the label or below it
|
|
243
|
+
*/
|
|
220
244
|
hintPosition: PropTypes.oneOf(['inline', 'below']),
|
|
245
|
+
/**
|
|
246
|
+
* Adds a question mark which will display a tooltip when clicked
|
|
247
|
+
*/
|
|
221
248
|
tooltip: PropTypes.string,
|
|
249
|
+
/**
|
|
250
|
+
* The accessibility label of the input field
|
|
251
|
+
*/
|
|
222
252
|
accessibilityLabel: PropTypes.string,
|
|
253
|
+
/**
|
|
254
|
+
* The dictionary object containing the content for the input field
|
|
255
|
+
*/
|
|
223
256
|
dictionary: PropTypes.shape({
|
|
224
257
|
en: dictionaryContentShape,
|
|
225
258
|
fr: dictionaryContentShape
|
|
226
259
|
}),
|
|
260
|
+
/**
|
|
261
|
+
* The language to use for the copy.
|
|
262
|
+
*/
|
|
227
263
|
copy: PropTypes.oneOfType([PropTypes.oneOf(['en', 'fr'])]),
|
|
228
264
|
variant: PropTypes.exact({
|
|
229
265
|
alternative: PropTypes.bool
|
|
230
266
|
}),
|
|
231
267
|
tokens: PropTypes.oneOf([PropTypes.object, PropTypes.func]),
|
|
268
|
+
/**
|
|
269
|
+
* Sets `data-testid` attribute on the input field for testing purposes.
|
|
270
|
+
*/
|
|
232
271
|
testID: PropTypes.string
|
|
233
272
|
}
|
|
234
273
|
|
package/src/Span/Span.jsx
CHANGED
|
@@ -27,6 +27,9 @@ const Span = ({ children, variant, tokens, testID, flex, ...rest }) => {
|
|
|
27
27
|
Span.propTypes = {
|
|
28
28
|
...selectedSystemPropTypes,
|
|
29
29
|
children: PropTypes.node.isRequired,
|
|
30
|
+
/**
|
|
31
|
+
* Adds `data-testid` attribute for testing
|
|
32
|
+
*/
|
|
30
33
|
testID: PropTypes.string,
|
|
31
34
|
/**
|
|
32
35
|
* Sets display to inline-flex so that children are laid out using the flex model.
|
package/src/Table/Table.jsx
CHANGED
package/src/Toast/Toast.jsx
CHANGED
|
@@ -5,7 +5,9 @@ import {
|
|
|
5
5
|
selectSystemProps,
|
|
6
6
|
useThemeTokens,
|
|
7
7
|
Typography,
|
|
8
|
-
withLinkRouter
|
|
8
|
+
withLinkRouter,
|
|
9
|
+
Spacer,
|
|
10
|
+
useViewport
|
|
9
11
|
} from '@telus-uds/components-base'
|
|
10
12
|
import styled, { keyframes, css } from 'styled-components'
|
|
11
13
|
import { htmlAttrs } from '../utils'
|
|
@@ -86,6 +88,9 @@ const ToastContainer = styled.div`
|
|
|
86
88
|
`
|
|
87
89
|
|
|
88
90
|
const Toast = ({ toast, copy, headline, link, tokens, variant = {}, ...rest }) => {
|
|
91
|
+
// viewport hook added to work adjust the padding to different sizes
|
|
92
|
+
const viewport = useViewport()
|
|
93
|
+
|
|
89
94
|
const {
|
|
90
95
|
containerBackgroundColor,
|
|
91
96
|
containerGap,
|
|
@@ -98,8 +103,9 @@ const Toast = ({ toast, copy, headline, link, tokens, variant = {}, ...rest }) =
|
|
|
98
103
|
animationBackgroundColorBefore,
|
|
99
104
|
animationBackgroundColorAfter,
|
|
100
105
|
animationColorBefore,
|
|
101
|
-
animationColorAfter
|
|
102
|
-
|
|
106
|
+
animationColorAfter,
|
|
107
|
+
chevronlinkFontWeight
|
|
108
|
+
} = useThemeTokens('Toast', tokens, variant, { viewport })
|
|
103
109
|
|
|
104
110
|
// inherit ChevronLink tokens for animation colors
|
|
105
111
|
const { color: chevronDefaultColor } = useThemeTokens('ChevronLink', {}, {})
|
|
@@ -128,10 +134,15 @@ const Toast = ({ toast, copy, headline, link, tokens, variant = {}, ...rest }) =
|
|
|
128
134
|
{...selectProps(rest)}
|
|
129
135
|
>
|
|
130
136
|
{headline && <Typography variant={{ bold: true, inverse: true }}>{headline}</Typography>}
|
|
137
|
+
<Spacer space={2} direction="row" />
|
|
131
138
|
<Typography variant={{ inverse: true }}>{copy}</Typography>
|
|
139
|
+
<Spacer space={2} direction="row" />
|
|
132
140
|
{link && (
|
|
133
141
|
<ChevronLink
|
|
134
|
-
variant={{
|
|
142
|
+
variant={{
|
|
143
|
+
inverse: true
|
|
144
|
+
}}
|
|
145
|
+
tokens={{ blockFontWeight: chevronlinkFontWeight }}
|
|
135
146
|
href={link.href}
|
|
136
147
|
LinkRouter={link.LinkRouter}
|
|
137
148
|
linkRouterProps={link.linkRouterProps}
|
|
@@ -145,9 +156,21 @@ const Toast = ({ toast, copy, headline, link, tokens, variant = {}, ...rest }) =
|
|
|
145
156
|
|
|
146
157
|
Toast.propTypes = {
|
|
147
158
|
...selectedSystemPropTypes,
|
|
159
|
+
/**
|
|
160
|
+
* If true, the toast will be displayed
|
|
161
|
+
*/
|
|
148
162
|
toast: PropTypes.bool,
|
|
163
|
+
/**
|
|
164
|
+
* The copy to display in the toast
|
|
165
|
+
*/
|
|
149
166
|
copy: PropTypes.string.isRequired,
|
|
167
|
+
/**
|
|
168
|
+
* The headline to display in the toast (before copy)
|
|
169
|
+
*/
|
|
150
170
|
headline: PropTypes.string,
|
|
171
|
+
/**
|
|
172
|
+
* The link to display in the toast (after copy)
|
|
173
|
+
*/
|
|
151
174
|
link: PropTypes.shape({
|
|
152
175
|
href: PropTypes.string.isRequired,
|
|
153
176
|
text: PropTypes.string.isRequired,
|