@telus-uds/components-web 1.9.0 → 1.11.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 +40 -2
- package/lib/Breadcrumbs/Breadcrumbs.js +8 -3
- package/lib/Breadcrumbs/Item/Item.js +31 -6
- package/lib/Callout/Callout.js +24 -3
- package/lib/Disclaimer/Disclaimer.js +72 -0
- package/lib/Disclaimer/index.js +15 -0
- package/lib/Footnote/Footnote.js +70 -28
- package/lib/Footnote/FootnoteLink.js +11 -13
- package/lib/NavigationBar/NavigationBar.js +231 -0
- package/lib/NavigationBar/NavigationItem.js +111 -0
- package/lib/NavigationBar/NavigationSubMenu.js +179 -0
- package/lib/NavigationBar/collapseItems.js +51 -0
- package/lib/NavigationBar/index.js +13 -0
- package/lib/PriceLockup/PriceLockup.js +40 -17
- package/lib/PriceLockup/tokens.js +49 -116
- package/lib/Progress/ProgressBar.js +100 -0
- package/lib/Progress/index.js +16 -0
- package/lib/Ribbon/Ribbon.js +53 -32
- package/lib/Spinner/Spinner.js +18 -14
- package/lib/Table/Cell.js +15 -1
- package/lib/Toast/Toast.js +15 -8
- package/lib/VideoPicker/VideoPicker.js +177 -0
- package/lib/VideoPicker/VideoPickerPlayer.js +54 -0
- package/lib/VideoPicker/VideoPickerThumbnail.js +201 -0
- package/lib/VideoPicker/VideoSlider.js +100 -0
- package/lib/VideoPicker/index.js +13 -0
- package/lib/VideoPicker/videoPropType.js +25 -0
- package/lib/index.js +37 -1
- package/lib-module/Breadcrumbs/Breadcrumbs.js +8 -3
- package/lib-module/Breadcrumbs/Item/Item.js +32 -7
- package/lib-module/Callout/Callout.js +24 -3
- package/lib-module/Disclaimer/Disclaimer.js +54 -0
- package/lib-module/Disclaimer/index.js +1 -0
- package/lib-module/Footnote/Footnote.js +68 -27
- package/lib-module/Footnote/FootnoteLink.js +12 -14
- package/lib-module/NavigationBar/NavigationBar.js +207 -0
- package/lib-module/NavigationBar/NavigationItem.js +87 -0
- package/lib-module/NavigationBar/NavigationSubMenu.js +161 -0
- package/lib-module/NavigationBar/collapseItems.js +43 -0
- package/lib-module/NavigationBar/index.js +2 -0
- package/lib-module/PriceLockup/PriceLockup.js +42 -19
- package/lib-module/PriceLockup/tokens.js +54 -119
- package/lib-module/Progress/ProgressBar.js +83 -0
- package/lib-module/Progress/index.js +4 -0
- package/lib-module/Ribbon/Ribbon.js +53 -32
- package/lib-module/Spinner/Spinner.js +17 -14
- package/lib-module/Table/Cell.js +15 -1
- package/lib-module/Toast/Toast.js +15 -8
- package/lib-module/VideoPicker/VideoPicker.js +151 -0
- package/lib-module/VideoPicker/VideoPickerPlayer.js +41 -0
- package/lib-module/VideoPicker/VideoPickerThumbnail.js +180 -0
- package/lib-module/VideoPicker/VideoSlider.js +83 -0
- package/lib-module/VideoPicker/index.js +2 -0
- package/lib-module/VideoPicker/videoPropType.js +9 -0
- package/lib-module/index.js +4 -0
- package/package.json +3 -3
- package/src/Breadcrumbs/Breadcrumbs.jsx +4 -3
- package/src/Breadcrumbs/Item/Item.jsx +18 -4
- package/src/Callout/Callout.jsx +27 -3
- package/src/Disclaimer/Disclaimer.jsx +39 -0
- package/src/Disclaimer/index.js +1 -0
- package/src/Footnote/Footnote.jsx +76 -26
- package/src/Footnote/FootnoteLink.jsx +28 -18
- package/src/NavigationBar/NavigationBar.jsx +217 -0
- package/src/NavigationBar/NavigationItem.jsx +83 -0
- package/src/NavigationBar/NavigationSubMenu.jsx +121 -0
- package/src/NavigationBar/collapseItems.js +29 -0
- package/src/NavigationBar/index.js +3 -0
- package/src/PriceLockup/PriceLockup.jsx +47 -21
- package/src/PriceLockup/tokens.js +34 -54
- package/src/Progress/ProgressBar.jsx +67 -0
- package/src/Progress/index.js +6 -0
- package/src/Ribbon/Ribbon.jsx +21 -9
- package/src/Spinner/Spinner.jsx +20 -17
- package/src/Table/Cell.jsx +22 -5
- package/src/Toast/Toast.jsx +12 -5
- package/src/VideoPicker/VideoPicker.jsx +144 -0
- package/src/VideoPicker/VideoPickerPlayer.jsx +21 -0
- package/src/VideoPicker/VideoPickerThumbnail.jsx +182 -0
- package/src/VideoPicker/VideoSlider.jsx +85 -0
- package/src/VideoPicker/index.js +3 -0
- package/src/VideoPicker/videoPropType.js +12 -0
- package/src/index.js +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,50 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-web
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 09 May 2023 00:20:29 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.11.0
|
|
8
|
+
|
|
9
|
+
Tue, 09 May 2023 00:20:29 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Fix to import icon from palette (wlsdud194@hotmail.com)
|
|
14
|
+
- make ProgressBar component to multibrand (mauricio.batresmontejo@telus.com)
|
|
15
|
+
- Add fontWeight, fontName, color, currentColor to component implementation (kyle.king2@telus.com)
|
|
16
|
+
- Callout has a new prop - textAlign that centers or left aligns text (akshay.pandey1@telus.com)
|
|
17
|
+
- refactor 'PriceLockup' & 'FootnoteLink' to take additional properties/tokens (kyle.king2@telus.com)
|
|
18
|
+
- font color as a property to follow the standarization guidelines in the brands for the ribbon components (35577399+JoshHC@users.noreply.github.com)
|
|
19
|
+
- Updated snapshots for components that depend on 'Typography' (kyle.king2@telus.com)
|
|
20
|
+
- added font props to Cell component (ignacio.cuyun@telus.com)
|
|
21
|
+
- makes navigation bar component multibrand (mauricio.batresmontejo@telus.com)
|
|
22
|
+
- moved 'Disclaimer' to components-web from ds-allium (kyle.king2@telus.com)
|
|
23
|
+
- move 'VideoPicker' to components-web (kyle.king2@telus.com)
|
|
24
|
+
- Bump @telus-uds/components-base to v1.40.0
|
|
25
|
+
- Bump @telus-uds/system-theme-tokens to v2.25.0
|
|
26
|
+
|
|
27
|
+
### Patches
|
|
28
|
+
|
|
29
|
+
- Fix an issue where `Spinner` might not render correctly in `fullScreen` mode (shahzaibkhalidmalik@outlook.com)
|
|
30
|
+
|
|
31
|
+
## 1.10.0
|
|
32
|
+
|
|
33
|
+
Mon, 01 May 2023 22:09:07 GMT
|
|
34
|
+
|
|
35
|
+
### Minor changes
|
|
36
|
+
|
|
37
|
+
- `Footnote`: Allow `content` prop to take custom JSX, override copy with custom `dictionary` (shahzaibkhalidmalik@outlook.com)
|
|
38
|
+
- Set Item size to micro in Breadcrumbs (wlsdud194@hotmail.com)
|
|
39
|
+
- List Box merged with List changes (akshay.pandey1@telus.com)
|
|
40
|
+
- Added label to Breadcrumb component (wlsdud194@hotmail.com)
|
|
41
|
+
- update snapshots (kyle.king2@telus.com)
|
|
42
|
+
- Bump @telus-uds/components-base to v1.39.0
|
|
43
|
+
- Bump @telus-uds/system-theme-tokens to v2.24.0
|
|
44
|
+
|
|
7
45
|
## 1.9.0
|
|
8
46
|
|
|
9
|
-
Thu, 27 Apr 2023 14:
|
|
47
|
+
Thu, 27 Apr 2023 14:41:57 GMT
|
|
10
48
|
|
|
11
49
|
### Minor changes
|
|
12
50
|
|
|
@@ -39,7 +39,8 @@ const StyledList = /*#__PURE__*/_styledComponents.default.ol.withConfig({
|
|
|
39
39
|
listStyle: 'none',
|
|
40
40
|
listStylePosition: 'inside',
|
|
41
41
|
margin: 0,
|
|
42
|
-
padding: 0
|
|
42
|
+
padding: 0,
|
|
43
|
+
alignItems: 'baseline'
|
|
43
44
|
});
|
|
44
45
|
|
|
45
46
|
const omitProps = _ref => {
|
|
@@ -173,7 +174,9 @@ const Breadcrumbs = _ref2 => {
|
|
|
173
174
|
})
|
|
174
175
|
})
|
|
175
176
|
});
|
|
176
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("nav", {
|
|
177
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("nav", {
|
|
178
|
+
"aria-label": "Breadcrumb",
|
|
179
|
+
...selectProps(rest),
|
|
177
180
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StyledList, {
|
|
178
181
|
children: items.map(_ref4 => {
|
|
179
182
|
let {
|
|
@@ -194,7 +197,9 @@ const Breadcrumbs = _ref2 => {
|
|
|
194
197
|
itemLinkRouterProps
|
|
195
198
|
},
|
|
196
199
|
reactRouterLinkComponent: linkComponent,
|
|
197
|
-
variant: variant,
|
|
200
|
+
variant: { ...variant,
|
|
201
|
+
size: 'micro'
|
|
202
|
+
},
|
|
198
203
|
LinkRouter: ItemLinkRouter
|
|
199
204
|
}, breadcrumbName);
|
|
200
205
|
})
|
|
@@ -55,10 +55,20 @@ const IconContainer = /*#__PURE__*/_styledComponents.default.span.withConfig({
|
|
|
55
55
|
iconPadding
|
|
56
56
|
} = _ref3;
|
|
57
57
|
return `${iconPadding}px`;
|
|
58
|
+
},
|
|
59
|
+
fontFamily: _ref4 => {
|
|
60
|
+
let {
|
|
61
|
+
fontName,
|
|
62
|
+
fontWeight
|
|
63
|
+
} = _ref4;
|
|
64
|
+
return (0, _componentsBase.applyTextStyles)({
|
|
65
|
+
fontName,
|
|
66
|
+
fontWeight
|
|
67
|
+
}).fontFamily;
|
|
58
68
|
}
|
|
59
69
|
});
|
|
60
70
|
|
|
61
|
-
const Item = /*#__PURE__*/(0, _react.forwardRef)((
|
|
71
|
+
const Item = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
62
72
|
let {
|
|
63
73
|
href,
|
|
64
74
|
reactRouterLinkComponent: ReactRouterLink,
|
|
@@ -70,10 +80,14 @@ const Item = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
|
70
80
|
},
|
|
71
81
|
// `light` variant (shared with the `Link` component) is default by design
|
|
72
82
|
...rest
|
|
73
|
-
} =
|
|
83
|
+
} = _ref5;
|
|
74
84
|
const {
|
|
75
85
|
iconColor,
|
|
76
86
|
icon: ChevronRightIcon,
|
|
87
|
+
currentColor,
|
|
88
|
+
color,
|
|
89
|
+
iconSize,
|
|
90
|
+
fontSize,
|
|
77
91
|
...themeTokens
|
|
78
92
|
} = (0, _componentsBase.useThemeTokens)('Breadcrumbs', tokens, variant);
|
|
79
93
|
|
|
@@ -87,14 +101,21 @@ const Item = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
|
87
101
|
|
|
88
102
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledItemContainer, { ...themeTokens,
|
|
89
103
|
children: current ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
90
|
-
|
|
91
|
-
|
|
104
|
+
tokens: {
|
|
105
|
+
color: currentColor,
|
|
106
|
+
fontSize
|
|
107
|
+
},
|
|
108
|
+
variant: { ...variant
|
|
92
109
|
},
|
|
93
110
|
children: children
|
|
94
111
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
95
112
|
children: [ReactRouterLink ? /*#__PURE__*/(0, _jsxRuntime.jsx)(ReactRouterLink, { ...linkOptions,
|
|
96
|
-
|
|
113
|
+
tokens: {
|
|
114
|
+
color,
|
|
115
|
+
blockFontSize: fontSize
|
|
116
|
+
} // TODO refactor
|
|
97
117
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
118
|
+
,
|
|
98
119
|
component: props => {
|
|
99
120
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Link, { ...props,
|
|
100
121
|
variant: variant
|
|
@@ -103,12 +124,16 @@ const Item = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
|
103
124
|
ref: ref,
|
|
104
125
|
children: children
|
|
105
126
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Link, { ...linkOptions,
|
|
127
|
+
tokens: {
|
|
128
|
+
color,
|
|
129
|
+
blockFontSize: fontSize
|
|
130
|
+
},
|
|
106
131
|
ref: ref,
|
|
107
132
|
variant: variant,
|
|
108
133
|
children: children
|
|
109
134
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(IconContainer, { ...themeTokens,
|
|
110
135
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ChevronRightIcon, {
|
|
111
|
-
size:
|
|
136
|
+
size: iconSize,
|
|
112
137
|
color: iconColor
|
|
113
138
|
})
|
|
114
139
|
})]
|
package/lib/Callout/Callout.js
CHANGED
|
@@ -21,6 +21,23 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
21
21
|
|
|
22
22
|
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
23
23
|
|
|
24
|
+
const getAlignment = (rounded, textAlignToFlex) => {
|
|
25
|
+
if (textAlignToFlex) {
|
|
26
|
+
switch (textAlignToFlex) {
|
|
27
|
+
case 'left':
|
|
28
|
+
return 'flex-star';
|
|
29
|
+
|
|
30
|
+
case 'center':
|
|
31
|
+
return 'center';
|
|
32
|
+
|
|
33
|
+
default:
|
|
34
|
+
return 'flex-start';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return rounded ? 'center' : ' flex-start';
|
|
39
|
+
};
|
|
40
|
+
|
|
24
41
|
const verticalAlignToFlex = verticalAlign => {
|
|
25
42
|
switch (verticalAlign) {
|
|
26
43
|
case 'top':
|
|
@@ -43,7 +60,8 @@ const CalloutContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
|
43
60
|
})(_ref => {
|
|
44
61
|
let {
|
|
45
62
|
rounded,
|
|
46
|
-
verticalAlign
|
|
63
|
+
verticalAlign,
|
|
64
|
+
textAlignToFlex,
|
|
47
65
|
background,
|
|
48
66
|
gap,
|
|
49
67
|
borderRadius,
|
|
@@ -55,7 +73,7 @@ const CalloutContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
|
55
73
|
gap,
|
|
56
74
|
borderRadius,
|
|
57
75
|
padding,
|
|
58
|
-
justifyContent:
|
|
76
|
+
justifyContent: getAlignment(rounded, textAlignToFlex),
|
|
59
77
|
alignItems: verticalAlignToFlex(verticalAlign)
|
|
60
78
|
};
|
|
61
79
|
});
|
|
@@ -64,7 +82,8 @@ const Callout = _ref2 => {
|
|
|
64
82
|
let {
|
|
65
83
|
icon,
|
|
66
84
|
children,
|
|
67
|
-
verticalAlign
|
|
85
|
+
verticalAlign,
|
|
86
|
+
textAlignToFlex,
|
|
68
87
|
tokens,
|
|
69
88
|
variant = {},
|
|
70
89
|
...rest
|
|
@@ -88,6 +107,7 @@ const Callout = _ref2 => {
|
|
|
88
107
|
rounded: rounded,
|
|
89
108
|
"data-testid": "callout-container",
|
|
90
109
|
verticalAlign: verticalAlign,
|
|
110
|
+
textAlignToFlex: textAlignToFlex,
|
|
91
111
|
background: background,
|
|
92
112
|
gap: gap,
|
|
93
113
|
borderRadius: borderRadius,
|
|
@@ -118,6 +138,7 @@ const Callout = _ref2 => {
|
|
|
118
138
|
Callout.propTypes = { ...selectedSystemPropTypes,
|
|
119
139
|
icon: _propTypes.default.elementType,
|
|
120
140
|
children: _propTypes.default.node.isRequired,
|
|
141
|
+
textAlignToFlex: _propTypes.default.oneOf(['center', 'left']),
|
|
121
142
|
verticalAlign: _propTypes.default.oneOf(['top', 'middle', 'bottom'])
|
|
122
143
|
};
|
|
123
144
|
var _default = Callout;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
+
|
|
14
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
15
|
+
|
|
16
|
+
var _utils = require("../utils");
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
23
|
+
|
|
24
|
+
const StyledDisclaimer = /*#__PURE__*/_styledComponents.default.p.withConfig({
|
|
25
|
+
displayName: "Disclaimer__StyledDisclaimer",
|
|
26
|
+
componentId: "components-web__sc-1l4xf7u-0"
|
|
27
|
+
})(_ref => {
|
|
28
|
+
let {
|
|
29
|
+
fontName,
|
|
30
|
+
fontWeight,
|
|
31
|
+
fontSize,
|
|
32
|
+
...tokens
|
|
33
|
+
} = _ref;
|
|
34
|
+
const {
|
|
35
|
+
fontFamily
|
|
36
|
+
} = (0, _componentsBase.applyTextStyles)({
|
|
37
|
+
fontName,
|
|
38
|
+
fontWeight
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
fontSize: `${fontSize}px`,
|
|
42
|
+
fontFamily,
|
|
43
|
+
...tokens
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* Use Disclaimer to display singular legal statement and must be displayed
|
|
48
|
+
* immediately adjacent to the related, originating content.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
const Disclaimer = _ref2 => {
|
|
53
|
+
let {
|
|
54
|
+
children,
|
|
55
|
+
...rest
|
|
56
|
+
} = _ref2;
|
|
57
|
+
const themeTokens = (0, _componentsBase.useThemeTokens)('Disclaimer');
|
|
58
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledDisclaimer, { ...selectProps(rest),
|
|
59
|
+
...themeTokens,
|
|
60
|
+
children: children
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
Disclaimer.propTypes = { ...selectedSystemPropTypes,
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The content
|
|
68
|
+
*/
|
|
69
|
+
children: _propTypes.default.node.isRequired
|
|
70
|
+
};
|
|
71
|
+
var _default = Disclaimer;
|
|
72
|
+
exports.default = _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Disclaimer.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _Disclaimer = _interopRequireDefault(require("./Disclaimer"));
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/lib/Footnote/Footnote.js
CHANGED
|
@@ -13,8 +13,6 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
13
13
|
|
|
14
14
|
var _componentsBase = require("@telus-uds/components-base");
|
|
15
15
|
|
|
16
|
-
var _Close = _interopRequireDefault(require("../../__fixtures__/icons/Close"));
|
|
17
|
-
|
|
18
16
|
var _OrderedListBase = _interopRequireDefault(require("../OrderedList/OrderedListBase"));
|
|
19
17
|
|
|
20
18
|
var _utils = require("../utils");
|
|
@@ -228,6 +226,19 @@ const ContentContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
|
228
226
|
};
|
|
229
227
|
});
|
|
230
228
|
|
|
229
|
+
const StyledCustomContentContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
230
|
+
displayName: "Footnote__StyledCustomContentContainer",
|
|
231
|
+
componentId: "components-web__sc-1563bo5-8"
|
|
232
|
+
})(_ref11 => {
|
|
233
|
+
let {
|
|
234
|
+
color
|
|
235
|
+
} = _ref11;
|
|
236
|
+
return {
|
|
237
|
+
color,
|
|
238
|
+
fontFamily: 'HelveticaNow400normal'
|
|
239
|
+
};
|
|
240
|
+
});
|
|
241
|
+
|
|
231
242
|
const usePrevious = value => {
|
|
232
243
|
const ref = (0, _react.useRef)();
|
|
233
244
|
(0, _react.useEffect)(() => {
|
|
@@ -271,6 +282,7 @@ const Footnote = props => {
|
|
|
271
282
|
isOpen,
|
|
272
283
|
tokens,
|
|
273
284
|
variant = {},
|
|
285
|
+
dictionary = _dictionary.default,
|
|
274
286
|
...rest
|
|
275
287
|
} = props;
|
|
276
288
|
const {
|
|
@@ -298,12 +310,13 @@ const Footnote = props => {
|
|
|
298
310
|
closeButtonMarginRight,
|
|
299
311
|
closeButtonMarginBottom,
|
|
300
312
|
closeButtonWidth,
|
|
301
|
-
closeButtonIconSize
|
|
313
|
+
closeButtonIconSize,
|
|
314
|
+
closeIcon
|
|
302
315
|
} = (0, _componentsBase.useThemeTokens)('Footnote', tokens, variant);
|
|
303
316
|
const footnoteRef = (0, _react.useRef)(null);
|
|
304
317
|
const headerRef = (0, _react.useRef)(null);
|
|
305
318
|
const bodyRef = (0, _react.useRef)(null);
|
|
306
|
-
const
|
|
319
|
+
const contentRef = (0, _react.useRef)(null);
|
|
307
320
|
const headingRef = (0, _react.useRef)(null);
|
|
308
321
|
const [data, setData] = (0, _react.useState)({
|
|
309
322
|
content: null,
|
|
@@ -314,7 +327,7 @@ const Footnote = props => {
|
|
|
314
327
|
const [isVisible, setIsVisible] = (0, _react.useState)(false);
|
|
315
328
|
const [isTextVisible, setIsTextVisible] = (0, _react.useState)(true);
|
|
316
329
|
const getCopy = (0, _componentsBase.useCopy)({
|
|
317
|
-
dictionary
|
|
330
|
+
dictionary,
|
|
318
331
|
copy
|
|
319
332
|
});
|
|
320
333
|
const prevProps = usePrevious(props);
|
|
@@ -345,7 +358,7 @@ const Footnote = props => {
|
|
|
345
358
|
}, [closeFootnote]);
|
|
346
359
|
|
|
347
360
|
const saveCurrentHeight = () => {
|
|
348
|
-
const oldHeight =
|
|
361
|
+
const oldHeight = contentRef.current.offsetHeight;
|
|
349
362
|
setBodyHeight(oldHeight);
|
|
350
363
|
};
|
|
351
364
|
|
|
@@ -372,14 +385,14 @@ const Footnote = props => {
|
|
|
372
385
|
number
|
|
373
386
|
});
|
|
374
387
|
|
|
375
|
-
if (bodyHeight !==
|
|
388
|
+
if (bodyHeight !== contentRef.current.offsetHeight) {
|
|
376
389
|
// Set new height
|
|
377
|
-
setBodyHeight(
|
|
390
|
+
setBodyHeight(contentRef.current.offsetHeight);
|
|
378
391
|
} else {
|
|
379
392
|
setIsTextVisible(true);
|
|
380
393
|
}
|
|
381
394
|
} else {
|
|
382
|
-
setBodyHeight(
|
|
395
|
+
setBodyHeight(contentRef.current.offsetHeight);
|
|
383
396
|
}
|
|
384
397
|
|
|
385
398
|
if (event.propertyName === 'height' && !isTextVisible) {
|
|
@@ -448,6 +461,35 @@ const Footnote = props => {
|
|
|
448
461
|
}, [number, isOpen, prevProps.isOpen, prevProps.number]); // Reset footnote on close
|
|
449
462
|
|
|
450
463
|
(0, _react.useEffect)(resetFootnote, [isOpen]);
|
|
464
|
+
const getFootnoteBodyContent = (0, _react.useCallback)(() => {
|
|
465
|
+
if (!data.number || !data.content) {
|
|
466
|
+
return null;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
if ( /*#__PURE__*/_react.default.isValidElement(data.content)) {
|
|
470
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledCustomContentContainer, {
|
|
471
|
+
ref: contentRef,
|
|
472
|
+
children: data.content
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(List, {
|
|
477
|
+
start: data.number,
|
|
478
|
+
ref: contentRef,
|
|
479
|
+
listPaddingLeft: listPaddingLeft,
|
|
480
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ListItem, {
|
|
481
|
+
listItemMarkerFontSize: listItemMarkerFontSize,
|
|
482
|
+
listItemMarkerLineHeight: listItemMarkerLineHeight,
|
|
483
|
+
listItemColor: listItemColor,
|
|
484
|
+
listItemFontSize: listItemFontSize,
|
|
485
|
+
listItemLineHeight: listItemLineHeight,
|
|
486
|
+
listItemPaddingLeft: listItemPaddingLeft,
|
|
487
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
488
|
+
children: (0, _utils.renderStructuredContent)(data.content)
|
|
489
|
+
})
|
|
490
|
+
})
|
|
491
|
+
});
|
|
492
|
+
}, [data.content, data.number, listItemColor, listItemFontSize, listItemLineHeight, listItemMarkerFontSize, listItemMarkerLineHeight, listItemPaddingLeft, listPaddingLeft]);
|
|
451
493
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Portal, {
|
|
452
494
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", { ...selectProps(rest),
|
|
453
495
|
children: [isOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(GlobalBodyScrollLock, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledFootnote, {
|
|
@@ -485,7 +527,7 @@ const Footnote = props => {
|
|
|
485
527
|
},
|
|
486
528
|
"aria-label": getCopy('close'),
|
|
487
529
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Icon, {
|
|
488
|
-
icon:
|
|
530
|
+
icon: closeIcon,
|
|
489
531
|
tokens: {
|
|
490
532
|
size: `${closeButtonIconSize}px`
|
|
491
533
|
}
|
|
@@ -501,22 +543,7 @@ const Footnote = props => {
|
|
|
501
543
|
maxWidth: theme.contentMaxWidth,
|
|
502
544
|
footnoteBodyBackground: footnoteBodyBackground,
|
|
503
545
|
footnoteBodyPadding: `${footnoteBodyPaddingTop}px ${footnoteBodyPaddingRight}px ${footnoteBodyPaddingBottom}px ${footnoteBodyPaddingLeft}px`,
|
|
504
|
-
children:
|
|
505
|
-
start: data.number,
|
|
506
|
-
ref: listRef,
|
|
507
|
-
listPaddingLeft: listPaddingLeft,
|
|
508
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ListItem, {
|
|
509
|
-
listItemMarkerFontSize: listItemMarkerFontSize,
|
|
510
|
-
listItemMarkerLineHeight: listItemMarkerLineHeight,
|
|
511
|
-
listItemColor: listItemColor,
|
|
512
|
-
listItemFontSize: listItemFontSize,
|
|
513
|
-
listItemLineHeight: listItemLineHeight,
|
|
514
|
-
listItemPaddingLeft: listItemPaddingLeft,
|
|
515
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
516
|
-
children: (0, _utils.renderStructuredContent)(data.content)
|
|
517
|
-
})
|
|
518
|
-
})
|
|
519
|
-
})
|
|
546
|
+
children: getFootnoteBodyContent()
|
|
520
547
|
})]
|
|
521
548
|
})
|
|
522
549
|
})]
|
|
@@ -527,6 +554,13 @@ const Footnote = props => {
|
|
|
527
554
|
const copyShape = _propTypes.default.shape({
|
|
528
555
|
close: _propTypes.default.string.isRequired,
|
|
529
556
|
heading: _propTypes.default.string.isRequired
|
|
557
|
+
}); // If a language dictionary entry is provided, it must contain every key
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
const dictionaryContentShape = _propTypes.default.shape({
|
|
561
|
+
a11yLabel: _propTypes.default.string.isRequired,
|
|
562
|
+
close: _propTypes.default.string.isRequired,
|
|
563
|
+
heading: _propTypes.default.string.isRequired
|
|
530
564
|
});
|
|
531
565
|
|
|
532
566
|
Footnote.propTypes = { ...selectedSystemPropTypes,
|
|
@@ -534,7 +568,7 @@ Footnote.propTypes = { ...selectedSystemPropTypes,
|
|
|
534
568
|
/**
|
|
535
569
|
* The content.
|
|
536
570
|
*/
|
|
537
|
-
content: _propTypes.default.string,
|
|
571
|
+
content: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.element]),
|
|
538
572
|
|
|
539
573
|
/**
|
|
540
574
|
* Use the `copy` prop to either select provided English or French copy by passing 'en' or 'fr' respectively.
|
|
@@ -559,7 +593,15 @@ Footnote.propTypes = { ...selectedSystemPropTypes,
|
|
|
559
593
|
* @param {Object} options Custom options
|
|
560
594
|
* @param {boolean} options.returnFocus Should the `Footnote` return focus on close
|
|
561
595
|
*/
|
|
562
|
-
onClose: _propTypes.default.func.isRequired
|
|
596
|
+
onClose: _propTypes.default.func.isRequired,
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Override the default dictionary, by passing the complete dictionary object for `en` and `fr`
|
|
600
|
+
*/
|
|
601
|
+
dictionary: _propTypes.default.shape({
|
|
602
|
+
en: dictionaryContentShape,
|
|
603
|
+
fr: dictionaryContentShape
|
|
604
|
+
})
|
|
563
605
|
};
|
|
564
606
|
Footnote.defaultProps = {
|
|
565
607
|
isOpen: false,
|
|
@@ -28,22 +28,26 @@ const StyledSup = /*#__PURE__*/_styledComponents.default.sup.withConfig({
|
|
|
28
28
|
componentId: "components-web__sc-17nd7xo-0"
|
|
29
29
|
})(_ref => {
|
|
30
30
|
let {
|
|
31
|
-
fontSize
|
|
31
|
+
fontSize,
|
|
32
32
|
lineHeight,
|
|
33
33
|
paddingLeft,
|
|
34
|
-
paddingRight
|
|
34
|
+
paddingRight,
|
|
35
|
+
...fontNameAndWeight
|
|
35
36
|
} = _ref;
|
|
36
37
|
return {
|
|
37
38
|
border: 0,
|
|
38
39
|
color: 'inherit',
|
|
39
40
|
cursor: 'pointer',
|
|
40
|
-
|
|
41
|
+
// we want to fallback on 'smaller' but have a valid size when a custom font size is provided.
|
|
42
|
+
fontSize: fontSize ? `${fontSize}px` : 'smaller',
|
|
41
43
|
lineHeight,
|
|
42
44
|
margin: 0,
|
|
43
45
|
paddingVertical: 0,
|
|
44
46
|
paddingLeft,
|
|
45
47
|
paddingRight,
|
|
46
|
-
textDecoration: 'underline'
|
|
48
|
+
textDecoration: 'underline',
|
|
49
|
+
// apply font family
|
|
50
|
+
...(0, _componentsBase.applyTextStyles)(fontNameAndWeight)
|
|
47
51
|
};
|
|
48
52
|
});
|
|
49
53
|
/**
|
|
@@ -67,11 +71,7 @@ const FootnoteLink = _ref2 => {
|
|
|
67
71
|
variant = {},
|
|
68
72
|
...rest
|
|
69
73
|
} = _ref2;
|
|
70
|
-
const
|
|
71
|
-
lineHeight,
|
|
72
|
-
paddingLeft,
|
|
73
|
-
paddingRight
|
|
74
|
-
} = (0, _componentsBase.useThemeTokens)('FootnoteLink', tokens, variant);
|
|
74
|
+
const themeTokens = (0, _componentsBase.useThemeTokens)('FootnoteLink', tokens, variant);
|
|
75
75
|
const numbers = Array.isArray(number) ? number : [number];
|
|
76
76
|
const refs = numbers.map(() => /*#__PURE__*/_react.default.createRef());
|
|
77
77
|
|
|
@@ -103,11 +103,9 @@ const FootnoteLink = _ref2 => {
|
|
|
103
103
|
"aria-label": getCopy('a11yLabel'),
|
|
104
104
|
ref: refs[index],
|
|
105
105
|
onClick: event => handleOnClick(event, index),
|
|
106
|
-
fontSize: fontSize,
|
|
107
|
-
lineHeight: lineHeight,
|
|
108
|
-
paddingLeft: paddingLeft,
|
|
109
|
-
paddingRight: paddingRight,
|
|
110
106
|
...selectProps(rest),
|
|
107
|
+
...themeTokens,
|
|
108
|
+
fontSize: fontSize,
|
|
111
109
|
children: `${num}${index !== numbers.length - 1 ? ',' : ''}`
|
|
112
110
|
}, num))
|
|
113
111
|
});
|