@telus-uds/components-web 3.2.1 → 3.4.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 +35 -2
- package/lib/Badge/Badge.js +2 -0
- package/lib/Card/Card.js +5 -5
- package/lib/DatePicker/DatePicker.js +20 -18
- package/lib/Footnote/Footnote.js +4 -7
- package/lib/NavigationBar/NavigationBar.js +13 -15
- package/lib/NavigationBar/NavigationSubMenu.js +1 -2
- package/lib/NavigationBar/collapseItems.js +2 -3
- package/lib/NavigationBar/resolveItemSelection.js +1 -1
- package/lib/OrderedList/OrderedList.js +2 -3
- package/lib/PriceLockup/PriceLockup.js +26 -10
- package/lib/PriceLockup/tokens.js +6 -2
- package/lib/SkeletonProvider/SkeletonImage.js +3 -4
- package/lib/SkeletonProvider/SkeletonTypography.js +5 -6
- package/lib/Table/Table.js +2 -3
- package/lib/TermsAndConditions/ExpandCollapse.js +2 -1
- package/lib/Toast/Toast.js +2 -3
- package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +1 -2
- package/lib/Video/Video.js +2 -2
- package/lib/VideoPicker/VideoPicker.js +1 -2
- package/lib/VideoPicker/VideoPickerThumbnail.js +1 -2
- package/lib/baseExports.js +1 -1
- package/lib/index.js +0 -1
- package/lib/utils/scrollToAnchor.js +2 -2
- package/lib/utils/ssr.js +7 -0
- package/lib/utils/useOverlaidPosition.js +2 -4
- package/package.json +3 -3
- package/src/Badge/Badge.jsx +2 -0
- package/src/DatePicker/DatePicker.jsx +19 -11
- package/src/PriceLockup/PriceLockup.jsx +12 -2
- package/src/PriceLockup/tokens.js +15 -3
- package/src/TermsAndConditions/ExpandCollapse.jsx +5 -1
- package/src/baseExports.js +1 -0
- package/src/index.js +0 -1
- package/src/utils/ssr.js +9 -1
- package/types/Callout.d.ts +2 -1
- package/types/Tooltip.d.ts +1 -0
- package/types/common.d.ts +1 -1
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +0 -73
- package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +0 -116
- package/lib/ExpandCollapseMini/index.js +0 -2
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +0 -72
- package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +0 -104
- package/src/ExpandCollapseMini/index.js +0 -3
|
@@ -45,9 +45,8 @@ const VideoButton = _ref2 => {
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
const handleClick = event => {
|
|
48
|
-
var _rest$onClick;
|
|
49
48
|
event.preventDefault();
|
|
50
|
-
|
|
49
|
+
rest.onClick?.(event);
|
|
51
50
|
};
|
|
52
51
|
return /*#__PURE__*/_jsxs(StyledButton, {
|
|
53
52
|
"aria-label": label,
|
package/lib/Video/Video.js
CHANGED
|
@@ -553,8 +553,8 @@ const Video = _ref3 => {
|
|
|
553
553
|
|
|
554
554
|
// This allows playing videos within components that act like
|
|
555
555
|
// links, e.g. `PreviewCard`, `StoryCard`, etc.
|
|
556
|
-
event
|
|
557
|
-
event
|
|
556
|
+
event?.preventDefault();
|
|
557
|
+
event?.stopPropagation();
|
|
558
558
|
};
|
|
559
559
|
const handleKeyboard = event => {
|
|
560
560
|
const {
|
|
@@ -82,10 +82,9 @@ const VideoListContainer = styled.div`
|
|
|
82
82
|
${props => props.isFramed && framedVideoListContainerStyle}
|
|
83
83
|
`;
|
|
84
84
|
const VideoPicker = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
85
|
-
var _videoList$;
|
|
86
85
|
let {
|
|
87
86
|
videoList = [],
|
|
88
|
-
selectedVideo =
|
|
87
|
+
selectedVideo = videoList[0]?.videoId,
|
|
89
88
|
frame,
|
|
90
89
|
onStartVideo = () => {},
|
|
91
90
|
onSelectVideo = () => {},
|
|
@@ -178,9 +178,8 @@ const VideoPickerThumbnail = /*#__PURE__*/React.forwardRef((_ref7, ref) => {
|
|
|
178
178
|
const handleLayout = itemPositions !== undefined ? getItemPositionLayoutHandler(itemPositions.positions, index) : undefined;
|
|
179
179
|
const onKeyPress = event => {
|
|
180
180
|
if (['Space', 'Enter'].includes(event.key)) {
|
|
181
|
-
var _videoPlayerRef$curre;
|
|
182
181
|
onSelectVideo(video);
|
|
183
|
-
const splashButton =
|
|
182
|
+
const splashButton = videoPlayerRef.current?.querySelector('button');
|
|
184
183
|
if (splashButton) splashButton.focus();
|
|
185
184
|
}
|
|
186
185
|
};
|
package/lib/baseExports.js
CHANGED
|
@@ -5,7 +5,7 @@ export {
|
|
|
5
5
|
/**
|
|
6
6
|
* Most base components should be re-exported as-is.
|
|
7
7
|
*/
|
|
8
|
-
ActionCard, A11yText, ActivityIndicator, Autocomplete, Box, Button, BaseProvider, A11yInfoProvider, ViewportProvider, ThemeProvider, ButtonDropdown, ButtonGroup, ButtonLink, CardGroup, Carousel, CarouselTabs, Checkbox, CheckboxGroup, ChevronLink, ColourToggle, Divider, DownloadApp, ExpandCollapse, Feedback, FlexGrid, FileUpload, Icon, InputLabel, InputSupports, Link, Listbox, Modal, MultiSelectFilter, Notification, Pagination, Portal, QuickLinks, QuickLinksFeature, Radio, RadioGroup, RadioCard, RadioCardGroup, Responsive, Search, Select, SideNav, Skeleton, SkipLink, Spacer, StackView, StackWrap, StepTracker, Status, Tabs, TabBar, Tags, TextButton, TextArea, TextInput, Timeline, ToggleSwitch, ToggleSwitchGroup, TooltipButton, Tooltip, Typography, Validator,
|
|
8
|
+
ActionCard, A11yText, ActivityIndicator, Autocomplete, Box, Button, BaseProvider, A11yInfoProvider, ViewportProvider, ThemeProvider, ButtonDropdown, ButtonGroup, ButtonLink, CardGroup, Carousel, CarouselTabs, Checkbox, CheckboxGroup, ChevronLink, ColourToggle, Divider, DownloadApp, ExpandCollapse, ExpandCollapseMini, Feedback, FlexGrid, FileUpload, Icon, InputLabel, InputSupports, Link, Listbox, Modal, MultiSelectFilter, Notification, Pagination, Portal, QuickLinks, QuickLinksFeature, Radio, RadioGroup, RadioCard, RadioCardGroup, Responsive, Search, Select, SideNav, Skeleton, SkipLink, Spacer, StackView, StackWrap, StepTracker, Status, Tabs, TabBar, Tags, TextButton, TextArea, TextInput, Timeline, ToggleSwitch, ToggleSwitchGroup, TooltipButton, Tooltip, Typography, Validator,
|
|
9
9
|
/*
|
|
10
10
|
* Most utilities exported from @telus-uds/components-base are for building systems, not apps.
|
|
11
11
|
* Re-export only those utilities with a stable API and known use cases within apps / pages.
|
package/lib/index.js
CHANGED
|
@@ -9,7 +9,6 @@ export { default as Countdown } from './Countdown';
|
|
|
9
9
|
export { default as DatePicker } from './DatePicker';
|
|
10
10
|
export { default as Paragraph } from './Paragraph';
|
|
11
11
|
export { default as Span } from './Span';
|
|
12
|
-
export { default as ExpandCollapseMini } from './ExpandCollapseMini';
|
|
13
12
|
export { default as Callout } from './Callout';
|
|
14
13
|
export { default as PriceLockup } from './PriceLockup';
|
|
15
14
|
export { default as Footnote } from './Footnote';
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* @param {Function} onAfterScroll - A callback function to be executed after the scroll action is completed.
|
|
7
7
|
*/
|
|
8
8
|
const scrollToAnchor = (href, event, onAfterScroll) => {
|
|
9
|
-
if (href
|
|
9
|
+
if (href?.startsWith('#')) {
|
|
10
10
|
event.preventDefault();
|
|
11
11
|
const target = document.getElementById(href.slice(1));
|
|
12
|
-
target
|
|
12
|
+
target?.scrollIntoView({
|
|
13
13
|
behavior: 'smooth'
|
|
14
14
|
});
|
|
15
15
|
window.location.hash = href;
|
package/lib/utils/ssr.js
CHANGED
|
@@ -23,6 +23,7 @@ const ssrStyles = function () {
|
|
|
23
23
|
styleGetters = [],
|
|
24
24
|
collectStyles = renderedApp => renderedApp
|
|
25
25
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
26
|
+
let router = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'pages';
|
|
26
27
|
const {
|
|
27
28
|
ServerStyleSheet
|
|
28
29
|
} = styledComponents;
|
|
@@ -32,6 +33,12 @@ const ssrStyles = function () {
|
|
|
32
33
|
sheet.seal();
|
|
33
34
|
return styles;
|
|
34
35
|
};
|
|
36
|
+
if (router === 'app') {
|
|
37
|
+
return baseSsrStyles(appName, {
|
|
38
|
+
styleGetters: [...styleGetters],
|
|
39
|
+
collectStyles
|
|
40
|
+
});
|
|
41
|
+
}
|
|
35
42
|
return baseSsrStyles(appName, {
|
|
36
43
|
styleGetters: [getStyledComponentsStyles, ...styleGetters],
|
|
37
44
|
collectStyles: renderedApp => collectStyles(sheet.collectStyles(renderedApp))
|
|
@@ -159,11 +159,10 @@ const useOverlaidPosition = _ref3 => {
|
|
|
159
159
|
const readyToShow = Boolean(isShown && sourceRef.current);
|
|
160
160
|
useEffect(() => {
|
|
161
161
|
const handleDimensionsChange = _ref5 => {
|
|
162
|
-
var _sourceRef$current;
|
|
163
162
|
let {
|
|
164
163
|
window
|
|
165
164
|
} = _ref5;
|
|
166
|
-
|
|
165
|
+
sourceRef.current?.measureInWindow((x, y, width, height) => {
|
|
167
166
|
// Could add a debouncer here if there's too many rerenders during gradual resizes
|
|
168
167
|
setWindowDimensions(window);
|
|
169
168
|
setSourceLayout({
|
|
@@ -176,8 +175,7 @@ const useOverlaidPosition = _ref3 => {
|
|
|
176
175
|
};
|
|
177
176
|
let subscription;
|
|
178
177
|
const unsubscribe = () => {
|
|
179
|
-
|
|
180
|
-
if (typeof ((_subscription = subscription) === null || _subscription === void 0 ? void 0 : _subscription.remove) === 'function') {
|
|
178
|
+
if (typeof subscription?.remove === 'function') {
|
|
181
179
|
// React Native >=0.65.0
|
|
182
180
|
subscription.remove();
|
|
183
181
|
} else if (typeof Dimensions.remove === 'function') {
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
],
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@gorhom/portal": "^1.0.14",
|
|
9
|
-
"@telus-uds/components-base": "^2.
|
|
9
|
+
"@telus-uds/components-base": "^2.5.0",
|
|
10
10
|
"@telus-uds/system-constants": "^2.0.0",
|
|
11
11
|
"fscreen": "^1.2.0",
|
|
12
12
|
"lodash.omit": "^4.5.0",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"react-dates": "^21.8.0",
|
|
15
15
|
"react-helmet-async": "^1.3.0",
|
|
16
16
|
"react-moment-proptypes": "^1.8.1",
|
|
17
|
-
"@telus-uds/system-theme-tokens": "^3.
|
|
17
|
+
"@telus-uds/system-theme-tokens": "^3.3.0",
|
|
18
18
|
"prop-types": "^15.7.2",
|
|
19
19
|
"lodash.throttle": "^4.1.1",
|
|
20
20
|
"react-youtube": "^10.1.0",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"skip": true
|
|
82
82
|
},
|
|
83
83
|
"types": "types/index.d.ts",
|
|
84
|
-
"version": "3.
|
|
84
|
+
"version": "3.4.0"
|
|
85
85
|
}
|
package/src/Badge/Badge.jsx
CHANGED
|
@@ -17,6 +17,8 @@ const BadgeContainer = styled.div`
|
|
|
17
17
|
border: ${({ border }) => border};
|
|
18
18
|
display: inline-flex;
|
|
19
19
|
justify-content: center;
|
|
20
|
+
align-items: center;
|
|
21
|
+
height: fit-content;
|
|
20
22
|
padding: ${({ padding }) => padding};
|
|
21
23
|
border-radius: ${({ radius }) => radius};
|
|
22
24
|
width: fit-content;
|
|
@@ -24,8 +24,7 @@ import { htmlAttrs, styledComponents } from '../utils'
|
|
|
24
24
|
const { styled } = styledComponents
|
|
25
25
|
|
|
26
26
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
27
|
-
|
|
28
|
-
const dateFormatWithoutSpaces = 'DD/MM/YYYY'
|
|
27
|
+
|
|
29
28
|
const getResponsiveDaySize = (inline = false, viewport = 'md') => {
|
|
30
29
|
if (viewport === 'xs') {
|
|
31
30
|
return inline ? undefined : 36
|
|
@@ -56,8 +55,6 @@ const PortalPositionedContainer = styled.div({
|
|
|
56
55
|
top: ({ top }) => `${top}px`
|
|
57
56
|
})
|
|
58
57
|
|
|
59
|
-
const validDatePattern = /^([0-2][0-9]|3[0-1])(\/)(0[1-9]|1[0-2])\2(\d{4})$/
|
|
60
|
-
|
|
61
58
|
const getInitialVisibleMonth = (initialVisibleMonth, inputDate) => {
|
|
62
59
|
if (initialVisibleMonth === '' || inputDate instanceof moment) {
|
|
63
60
|
return null
|
|
@@ -92,6 +89,7 @@ const DatePicker = React.forwardRef(
|
|
|
92
89
|
copy = 'en',
|
|
93
90
|
id,
|
|
94
91
|
date,
|
|
92
|
+
dateFormat = 'DD / MM / YYYY',
|
|
95
93
|
feedback,
|
|
96
94
|
inline = false,
|
|
97
95
|
isDayDisabled,
|
|
@@ -106,16 +104,20 @@ const DatePicker = React.forwardRef(
|
|
|
106
104
|
disabled = false,
|
|
107
105
|
prevTestID = '',
|
|
108
106
|
nextTestID = '',
|
|
109
|
-
placeholder =
|
|
107
|
+
placeholder = dateFormat,
|
|
108
|
+
|
|
110
109
|
initialVisibleMonth = '',
|
|
111
110
|
...rest
|
|
112
111
|
},
|
|
113
112
|
ref
|
|
114
113
|
) => {
|
|
115
114
|
const [inputDate, setInputDate] = React.useState(date instanceof moment ? date : undefined)
|
|
115
|
+
|
|
116
116
|
const [inputText, setInputText] = React.useState(
|
|
117
117
|
date instanceof moment ? date.format(dateFormat) : ''
|
|
118
118
|
)
|
|
119
|
+
const dateFormatWithoutSpaces = dateFormat.replace(/\s/g, '')
|
|
120
|
+
|
|
119
121
|
const textInputRef = React.useRef()
|
|
120
122
|
const prevButtonRef = React.useRef()
|
|
121
123
|
const [datePickerPosition, setDatePickerPosition] = React.useState({ left: 0, top: 0 })
|
|
@@ -136,7 +138,7 @@ const DatePicker = React.forwardRef(
|
|
|
136
138
|
const throttledUpdate = throttle(updateDatePickerPosition, 100, { leading: false })
|
|
137
139
|
|
|
138
140
|
// Initial call to set the position
|
|
139
|
-
|
|
141
|
+
throttledUpdate()
|
|
140
142
|
|
|
141
143
|
// Register event listeners
|
|
142
144
|
window.addEventListener('resize', throttledUpdate)
|
|
@@ -161,7 +163,7 @@ const DatePicker = React.forwardRef(
|
|
|
161
163
|
setInputDate(date)
|
|
162
164
|
setInputText(date instanceof moment ? date.format(dateFormat) : '')
|
|
163
165
|
}
|
|
164
|
-
}, [date, inputDate])
|
|
166
|
+
}, [date, inputDate, dateFormat])
|
|
165
167
|
|
|
166
168
|
React.useEffect(() => {
|
|
167
169
|
let timeoutId
|
|
@@ -241,7 +243,10 @@ const DatePicker = React.forwardRef(
|
|
|
241
243
|
}
|
|
242
244
|
|
|
243
245
|
const handleValidation = (inputValidation) => {
|
|
244
|
-
|
|
246
|
+
const momentDate = moment(inputText, dateFormat, true)
|
|
247
|
+
const isValidDate = momentDate.isValid()
|
|
248
|
+
|
|
249
|
+
if (!isValidDate && inputText !== '') {
|
|
245
250
|
return 'error'
|
|
246
251
|
}
|
|
247
252
|
|
|
@@ -467,8 +472,11 @@ DatePicker.propTypes = {
|
|
|
467
472
|
*/
|
|
468
473
|
date: momentPropTypes.momentObj,
|
|
469
474
|
/**
|
|
470
|
-
* A
|
|
471
|
-
|
|
475
|
+
* A Moment instance representing the currently selected date, i.e. `moment()`
|
|
476
|
+
*/
|
|
477
|
+
dateFormat: PropTypes.string,
|
|
478
|
+
/**
|
|
479
|
+
* Optional date format for the date input. If not set, the default value will be `DD / MM / YYYY`
|
|
472
480
|
*/
|
|
473
481
|
feedback: PropTypes.string,
|
|
474
482
|
/**
|
|
@@ -524,7 +532,7 @@ DatePicker.propTypes = {
|
|
|
524
532
|
*/
|
|
525
533
|
nextTestID: PropTypes.string,
|
|
526
534
|
/**
|
|
527
|
-
* Optional placeholder for the date input. If not set the default value will be
|
|
535
|
+
* Optional placeholder for the date input. If not set, the default value will be equal to the `dateFormat` prop
|
|
528
536
|
*/
|
|
529
537
|
placeholder: PropTypes.string,
|
|
530
538
|
/**
|
|
@@ -74,6 +74,10 @@ const StrikeThroughContainer = styled.div`
|
|
|
74
74
|
position: absolute;
|
|
75
75
|
}
|
|
76
76
|
`
|
|
77
|
+
const TypographyContainer = styled.div`
|
|
78
|
+
display: flex;
|
|
79
|
+
padding-top: ${({ paddingTop }) => `${paddingTop || 0}px`};
|
|
80
|
+
`
|
|
77
81
|
|
|
78
82
|
const selectFootnoteLinkStyles = ({
|
|
79
83
|
footnoteLinkColor,
|
|
@@ -154,11 +158,17 @@ const PriceLockup = React.forwardRef(
|
|
|
154
158
|
const cents = hasCents ? priceString.substring(separatorPosition + 1) : null
|
|
155
159
|
|
|
156
160
|
const renderTypography = (value, tokens, position) => {
|
|
161
|
+
const { paddingTop, ...restOfTokens } = tokens
|
|
157
162
|
const customProps =
|
|
158
163
|
position === 'bottom'
|
|
159
164
|
? { variant: { size: 'micro' }, tokens: { color: fontColor } }
|
|
160
|
-
: { tokens: { ...
|
|
161
|
-
|
|
165
|
+
: { tokens: { ...restOfTokens, color: fontColor } }
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
<TypographyContainer paddingTop={paddingTop}>
|
|
169
|
+
<Typography {...customProps}>{value}</Typography>
|
|
170
|
+
</TypographyContainer>
|
|
171
|
+
)
|
|
162
172
|
}
|
|
163
173
|
|
|
164
174
|
const renderCurrencySymbol = () =>
|
|
@@ -6,12 +6,14 @@ export default ({
|
|
|
6
6
|
currencySymbolFontSize,
|
|
7
7
|
currencySymbolLineHeight,
|
|
8
8
|
currencySymbolFontWeight,
|
|
9
|
+
currencySymbolPaddingTop,
|
|
9
10
|
amountFontSize,
|
|
10
11
|
amountLineHeight,
|
|
11
12
|
amountLetterSpacing,
|
|
12
13
|
amountFontWeight,
|
|
13
14
|
centsFontSize,
|
|
14
15
|
centsLineHeight,
|
|
16
|
+
centsPaddingTop,
|
|
15
17
|
rateFontSize,
|
|
16
18
|
rateLineHeight,
|
|
17
19
|
bottomTextFontSize,
|
|
@@ -23,7 +25,8 @@ export default ({
|
|
|
23
25
|
dollarSign: {
|
|
24
26
|
fontSize: currencySymbolFontSize,
|
|
25
27
|
lineHeight: currencySymbolLineHeight,
|
|
26
|
-
fontWeight: currencySymbolFontWeight
|
|
28
|
+
fontWeight: currencySymbolFontWeight,
|
|
29
|
+
paddingTop: currencySymbolPaddingTop
|
|
27
30
|
},
|
|
28
31
|
amount: {
|
|
29
32
|
color: fontColor,
|
|
@@ -32,7 +35,16 @@ export default ({
|
|
|
32
35
|
letterSpacing: amountLetterSpacing,
|
|
33
36
|
fontWeight: amountFontWeight
|
|
34
37
|
},
|
|
35
|
-
cents: {
|
|
36
|
-
|
|
38
|
+
cents: {
|
|
39
|
+
fontSize: centsFontSize,
|
|
40
|
+
lineHeight: centsLineHeight,
|
|
41
|
+
fontWeight: centsFontWeight,
|
|
42
|
+
paddingTop: centsPaddingTop
|
|
43
|
+
},
|
|
44
|
+
rate: {
|
|
45
|
+
fontSize: rateFontSize,
|
|
46
|
+
lineHeight: rateLineHeight,
|
|
47
|
+
fontWeight: rateFontWeight
|
|
48
|
+
},
|
|
37
49
|
bottomText: { fontSize: bottomTextFontSize, lineHeight: bottomTextLineHeight }
|
|
38
50
|
})
|
|
@@ -96,12 +96,16 @@ const ExpandCollapse = React.forwardRef(
|
|
|
96
96
|
return (
|
|
97
97
|
<ExpandCollapseControl ref={ref}>
|
|
98
98
|
<ExpandCollapseIconContainer tokens={getTokens()}>
|
|
99
|
-
{/*
|
|
99
|
+
{/*
|
|
100
|
+
Can use `Icon` instead of `IconButton` but `Icon` does not have required stylistic variants
|
|
101
|
+
Setting `accessibilityRole` to `none` for `IconButton` to render as a `div` instead of `button` to avoid nested `buttons`
|
|
102
|
+
*/}
|
|
100
103
|
<IconButton
|
|
101
104
|
variant={{ size: 'small' }}
|
|
102
105
|
tokens={iconTokens}
|
|
103
106
|
focusable={false}
|
|
104
107
|
accessibilityLabel={label}
|
|
108
|
+
accessibilityRole="none"
|
|
105
109
|
/>
|
|
106
110
|
</ExpandCollapseIconContainer>
|
|
107
111
|
<ExpandCollapseTitle tokens={getTokens()}>
|
package/src/baseExports.js
CHANGED
package/src/index.js
CHANGED
|
@@ -9,7 +9,6 @@ export { default as Countdown } from './Countdown'
|
|
|
9
9
|
export { default as DatePicker } from './DatePicker'
|
|
10
10
|
export { default as Paragraph } from './Paragraph'
|
|
11
11
|
export { default as Span } from './Span'
|
|
12
|
-
export { default as ExpandCollapseMini } from './ExpandCollapseMini'
|
|
13
12
|
export { default as Callout } from './Callout'
|
|
14
13
|
export { default as PriceLockup } from './PriceLockup'
|
|
15
14
|
export { default as Footnote } from './Footnote'
|
package/src/utils/ssr.js
CHANGED
|
@@ -19,7 +19,8 @@ import styledComponents from './theming/styled-components'
|
|
|
19
19
|
*/
|
|
20
20
|
const ssrStyles = (
|
|
21
21
|
appName = 'Allium app',
|
|
22
|
-
{ styleGetters = [], collectStyles = (renderedApp) => renderedApp } = {}
|
|
22
|
+
{ styleGetters = [], collectStyles = (renderedApp) => renderedApp } = {},
|
|
23
|
+
router = 'pages'
|
|
23
24
|
) => {
|
|
24
25
|
const { ServerStyleSheet } = styledComponents
|
|
25
26
|
const sheet = new ServerStyleSheet()
|
|
@@ -29,6 +30,13 @@ const ssrStyles = (
|
|
|
29
30
|
return styles
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
if (router === 'app') {
|
|
34
|
+
return baseSsrStyles(appName, {
|
|
35
|
+
styleGetters: [...styleGetters],
|
|
36
|
+
collectStyles
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
32
40
|
return baseSsrStyles(appName, {
|
|
33
41
|
styleGetters: [getStyledComponentsStyles, ...styleGetters],
|
|
34
42
|
collectStyles: (renderedApp) => collectStyles(sheet.collectStyles(renderedApp))
|
package/types/Callout.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentType, ElementType, ReactNode } from 'react'
|
|
2
|
-
import type { HTMLAttrs, Variant } from './common'
|
|
2
|
+
import type { HTMLAttrs, Tokens, Variant } from './common'
|
|
3
3
|
|
|
4
4
|
export interface CalloutProps extends HTMLAttrs {
|
|
5
5
|
children: ReactNode
|
|
@@ -7,6 +7,7 @@ export interface CalloutProps extends HTMLAttrs {
|
|
|
7
7
|
icon?: ElementType
|
|
8
8
|
verticalAlign?: 'top' | 'middle' | 'bottom'
|
|
9
9
|
textAlignToFlex?: 'left' | 'center'
|
|
10
|
+
tokens?: Tokens
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
declare const Callout: ComponentType<CalloutProps>
|
package/types/Tooltip.d.ts
CHANGED
package/types/common.d.ts
CHANGED
|
@@ -154,7 +154,7 @@ export interface PressableState {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
// TODO: Make this more specific:
|
|
157
|
-
// https://telus.com/universal-design-system/components/allium/
|
|
157
|
+
// https://telus.com/universal-design-system/components/allium/Skeleton/#props
|
|
158
158
|
export type SkeletonProps = Record<string, any>
|
|
159
159
|
|
|
160
160
|
export type HeadingTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { ExpandCollapse, getTokensPropType } from '@telus-uds/components-base';
|
|
4
|
-
import ExpandCollapseMiniControl from './ExpandCollapseMiniControl';
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
const ExpandCollapseMini = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
7
|
-
let {
|
|
8
|
-
children,
|
|
9
|
-
onToggle = () => {},
|
|
10
|
-
tokens = {},
|
|
11
|
-
nativeID,
|
|
12
|
-
initialOpen = false,
|
|
13
|
-
...rest
|
|
14
|
-
} = _ref;
|
|
15
|
-
const expandCollapeMiniPanelId = 'ExpandCollapseMiniPanel';
|
|
16
|
-
const handleChange = (openPanels, event) => {
|
|
17
|
-
if (typeof onToggle === 'function') {
|
|
18
|
-
const isOpen = openPanels.length > 0;
|
|
19
|
-
onToggle(event, isOpen);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
return /*#__PURE__*/_jsx(ExpandCollapse, {
|
|
23
|
-
onChange: handleChange,
|
|
24
|
-
tokens: tokens,
|
|
25
|
-
initialOpen: initialOpen ? [expandCollapeMiniPanelId] : [],
|
|
26
|
-
children: expandProps => /*#__PURE__*/_jsx(ExpandCollapse.Panel, {
|
|
27
|
-
...expandProps,
|
|
28
|
-
panelId: expandCollapeMiniPanelId,
|
|
29
|
-
variant: {
|
|
30
|
-
mini: true
|
|
31
|
-
},
|
|
32
|
-
controlTokens: {
|
|
33
|
-
// Remove unwanted look and feel from ExpandCollapse(background pressed, focus border and text underline)
|
|
34
|
-
icon: null,
|
|
35
|
-
borderColor: 'transparent',
|
|
36
|
-
textLine: 'none',
|
|
37
|
-
backgroundColor: 'transparent'
|
|
38
|
-
}
|
|
39
|
-
// TODO refactor
|
|
40
|
-
// eslint-disable-next-line react/no-unstable-nested-components
|
|
41
|
-
,
|
|
42
|
-
control: pressableState => /*#__PURE__*/_jsx(ExpandCollapseMiniControl, {
|
|
43
|
-
pressableState: pressableState,
|
|
44
|
-
...rest
|
|
45
|
-
}),
|
|
46
|
-
controlRef: ref,
|
|
47
|
-
nativeID: nativeID,
|
|
48
|
-
children: children
|
|
49
|
-
})
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
ExpandCollapseMini.displayName = 'ExpandCollapseMini';
|
|
53
|
-
ExpandCollapseMini.propTypes = {
|
|
54
|
-
...ExpandCollapseMiniControl.propTypes,
|
|
55
|
-
/**
|
|
56
|
-
* Function to call on pressing the panel's control, which should open or close the panel.
|
|
57
|
-
*/
|
|
58
|
-
onToggle: PropTypes.func,
|
|
59
|
-
/**
|
|
60
|
-
* ID for DOM element on web
|
|
61
|
-
*/
|
|
62
|
-
nativeID: PropTypes.string,
|
|
63
|
-
/**
|
|
64
|
-
* Children nodes that can be added
|
|
65
|
-
*/
|
|
66
|
-
children: PropTypes.node.isRequired,
|
|
67
|
-
/**
|
|
68
|
-
* Controls if the panel and the content is opened by default on the first load
|
|
69
|
-
*/
|
|
70
|
-
initialOpen: PropTypes.bool,
|
|
71
|
-
tokens: getTokensPropType('ExpandCollapseMini')
|
|
72
|
-
};
|
|
73
|
-
export default ExpandCollapseMini;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { selectSystemProps, Link, useThemeTokens } from '@telus-uds/components-base';
|
|
4
|
-
import { htmlAttrs } from '../utils';
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
7
|
-
|
|
8
|
-
// The ExpandCollapseControl has all the appropriate role, a11y, press handling etc
|
|
9
|
-
// and a more appropriate press area, defer interaction handling to it.
|
|
10
|
-
const presentationOnly = {
|
|
11
|
-
accessibilityRole: null,
|
|
12
|
-
// Treat as regular flow content with the Control
|
|
13
|
-
pointerEvents: 'none',
|
|
14
|
-
// Stop RNW from stopping clicks from bubbling to Control
|
|
15
|
-
focusable: false // Stop RNW from setting tabIndex={0}: focus goes to Control only
|
|
16
|
-
};
|
|
17
|
-
const selectLinkTokens = _ref => {
|
|
18
|
-
let {
|
|
19
|
-
color,
|
|
20
|
-
textLine,
|
|
21
|
-
lineHeight,
|
|
22
|
-
fontSize
|
|
23
|
-
} = _ref;
|
|
24
|
-
return {
|
|
25
|
-
color,
|
|
26
|
-
textLine,
|
|
27
|
-
blockLineHeight: lineHeight,
|
|
28
|
-
blockFontSize: fontSize
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
const ExpandCollapseMiniControl = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
32
|
-
let {
|
|
33
|
-
pressableState,
|
|
34
|
-
collapseTitle,
|
|
35
|
-
expandTitle = collapseTitle,
|
|
36
|
-
iconPosition = 'right',
|
|
37
|
-
tokens,
|
|
38
|
-
variant = {},
|
|
39
|
-
...rest
|
|
40
|
-
} = _ref2;
|
|
41
|
-
const {
|
|
42
|
-
expanded,
|
|
43
|
-
hover,
|
|
44
|
-
focus
|
|
45
|
-
} = pressableState || {};
|
|
46
|
-
// we only want focus outline when focusing, if user is pressing we don't want the border.
|
|
47
|
-
const {
|
|
48
|
-
outerBorderColor
|
|
49
|
-
} = useThemeTokens('Link', {}, {}, {
|
|
50
|
-
focus
|
|
51
|
-
});
|
|
52
|
-
const {
|
|
53
|
-
size,
|
|
54
|
-
icon,
|
|
55
|
-
...themeTokens
|
|
56
|
-
} = useThemeTokens('ExpandCollapseMiniControl', tokens, variant, {
|
|
57
|
-
expanded,
|
|
58
|
-
focus
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
// Choose hover styles when any part of Control is hoverred
|
|
62
|
-
const appearance = {
|
|
63
|
-
...variant,
|
|
64
|
-
hover
|
|
65
|
-
};
|
|
66
|
-
const getTokens = linkState => {
|
|
67
|
-
const {
|
|
68
|
-
hover: linkHover
|
|
69
|
-
} = linkState || {};
|
|
70
|
-
const isHovered = hover || linkHover;
|
|
71
|
-
if (isHovered) {
|
|
72
|
-
// Include vertical icon animation on hover alongside built-in Link theme, the size is size4
|
|
73
|
-
return {
|
|
74
|
-
iconTranslateY: (expanded ? -1 : 1) * size
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
return {};
|
|
78
|
-
};
|
|
79
|
-
return /*#__PURE__*/_jsx(Link, {
|
|
80
|
-
variant: appearance,
|
|
81
|
-
icon: icon,
|
|
82
|
-
iconPosition: iconPosition,
|
|
83
|
-
tokens: linkState => ({
|
|
84
|
-
...getTokens(linkState),
|
|
85
|
-
...selectLinkTokens(themeTokens),
|
|
86
|
-
outerBorderColor
|
|
87
|
-
}),
|
|
88
|
-
ref: ref,
|
|
89
|
-
...presentationOnly,
|
|
90
|
-
...selectProps(rest),
|
|
91
|
-
children: expanded ? expandTitle : collapseTitle
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
ExpandCollapseMiniControl.displayName = 'ExpandCollapseMiniControl';
|
|
95
|
-
ExpandCollapseMiniControl.propTypes = {
|
|
96
|
-
...selectedSystemPropTypes,
|
|
97
|
-
...Link.propTypes,
|
|
98
|
-
/**
|
|
99
|
-
* Optional function to call on pressing the panel's control, in addition to opening or closing the panel
|
|
100
|
-
*/
|
|
101
|
-
onPress: PropTypes.func,
|
|
102
|
-
/**
|
|
103
|
-
* ExpandCollapseMiniControl title when expanded
|
|
104
|
-
*/
|
|
105
|
-
expandTitle: PropTypes.string.isRequired,
|
|
106
|
-
/**
|
|
107
|
-
* ExpandCollapseMiniControl title when collapsed
|
|
108
|
-
*/
|
|
109
|
-
collapseTitle: PropTypes.string.isRequired,
|
|
110
|
-
/**
|
|
111
|
-
* React Native's `Pressable`'s state object
|
|
112
|
-
*/
|
|
113
|
-
pressableState: PropTypes.object,
|
|
114
|
-
variant: PropTypes.object
|
|
115
|
-
};
|
|
116
|
-
export default ExpandCollapseMiniControl;
|