@telus-uds/components-web 2.44.0 → 3.0.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/.eslintrc.cjs +26 -0
- package/CHANGELOG.md +13 -2
- package/babel.config.cjs +4 -0
- package/jest.config.cjs +29 -0
- package/lib/Badge/Badge.js +21 -29
- package/lib/Badge/index.js +2 -10
- package/lib/BlockQuote/BlockQuote.js +31 -39
- package/lib/BlockQuote/index.js +2 -10
- package/lib/Breadcrumbs/Breadcrumbs.js +39 -49
- package/lib/Breadcrumbs/Item/Item.js +26 -34
- package/lib/Breadcrumbs/index.js +1 -13
- package/lib/Callout/Callout.js +19 -27
- package/lib/Callout/index.js +2 -10
- package/lib/Card/Card.js +44 -54
- package/lib/Card/CardContent.js +17 -25
- package/lib/Card/CardFooter.js +16 -24
- package/lib/Card/index.js +2 -10
- package/lib/Countdown/Countdown.js +34 -42
- package/lib/Countdown/Segment.js +26 -34
- package/lib/Countdown/constants.js +4 -14
- package/lib/Countdown/dictionary.js +2 -9
- package/lib/Countdown/index.js +2 -10
- package/lib/Countdown/types.js +18 -28
- package/lib/Countdown/useCountdown.js +4 -11
- package/lib/DatePicker/CalendarContainer.js +6 -12
- package/lib/DatePicker/DatePicker.js +94 -103
- package/lib/DatePicker/dictionary.js +1 -8
- package/lib/DatePicker/index.js +2 -10
- package/lib/DatePicker/reactDatesCss.js +3 -10
- package/lib/Disclaimer/Disclaimer.js +15 -23
- package/lib/Disclaimer/index.js +1 -13
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +16 -24
- package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +17 -26
- package/lib/ExpandCollapseMini/index.js +2 -10
- package/lib/Footnote/Footnote.js +85 -95
- package/lib/Footnote/FootnoteLink.js +25 -33
- package/lib/Footnote/dictionary.js +2 -9
- package/lib/Footnote/index.js +4 -12
- package/lib/IconButton/IconButton.js +12 -20
- package/lib/IconButton/index.js +2 -10
- package/lib/Image/Image.js +17 -25
- package/lib/Image/index.js +6 -18
- package/lib/Image/server.js +4 -12
- package/lib/List/List.js +2 -9
- package/lib/List/ListItem.js +10 -18
- package/lib/List/index.js +4 -12
- package/lib/NavigationBar/NavigationBar.js +51 -59
- package/lib/NavigationBar/NavigationItem.js +19 -27
- package/lib/NavigationBar/NavigationSubMenu.js +34 -40
- package/lib/NavigationBar/collapseItems.js +1 -11
- package/lib/NavigationBar/index.js +4 -12
- package/lib/NavigationBar/resolveItemSelection.js +1 -8
- package/lib/OptimizeImage/OptimizeImage.js +26 -34
- package/lib/OptimizeImage/index.js +2 -10
- package/lib/OptimizeImage/utils/getFallbackUrl.js +3 -10
- package/lib/OptimizeImage/utils/getImageUrls.js +9 -16
- package/lib/OptimizeImage/utils/getOptimizedUrl.js +3 -10
- package/lib/OptimizeImage/utils/hasWebpSupport.js +1 -7
- package/lib/OptimizeImage/utils/index.js +5 -34
- package/lib/OptimizeImage/utils/isSvgUrl.js +1 -7
- package/lib/OrderedList/Item.js +28 -36
- package/lib/OrderedList/ItemBase.js +8 -16
- package/lib/OrderedList/OrderedList.js +22 -30
- package/lib/OrderedList/OrderedListBase.js +12 -20
- package/lib/OrderedList/constants.js +1 -8
- package/lib/OrderedList/index.js +4 -12
- package/lib/Paragraph/Paragraph.js +22 -30
- package/lib/Paragraph/index.js +2 -10
- package/lib/PreviewCard/AuthorDate.js +17 -21
- package/lib/PreviewCard/PreviewCard.js +40 -49
- package/lib/PreviewCard/index.js +2 -10
- package/lib/PriceLockup/PriceLockup.js +56 -64
- package/lib/PriceLockup/index.js +2 -10
- package/lib/PriceLockup/tokens.js +2 -9
- package/lib/Progress/ProgressBar.js +17 -24
- package/lib/Progress/index.js +4 -12
- package/lib/QuantitySelector/QuantitySelector.js +55 -63
- package/lib/QuantitySelector/SideButton.js +15 -23
- package/lib/QuantitySelector/dictionary.js +2 -9
- package/lib/QuantitySelector/index.js +2 -10
- package/lib/QuantitySelector/styles.js +4 -13
- package/lib/ResponsiveImage/ResponsiveImage.js +29 -37
- package/lib/ResponsiveImage/index.js +2 -10
- package/lib/Ribbon/Ribbon.js +22 -30
- package/lib/Ribbon/index.js +2 -10
- package/lib/SkeletonProvider/SkeletonImage.js +14 -22
- package/lib/SkeletonProvider/SkeletonProvider.js +17 -25
- package/lib/SkeletonProvider/SkeletonTypography.js +14 -22
- package/lib/SkeletonProvider/index.js +2 -10
- package/lib/Span/Span.js +23 -31
- package/lib/Span/index.js +2 -10
- package/lib/Spinner/Spinner.js +43 -51
- package/lib/Spinner/SpinnerContent.js +21 -29
- package/lib/Spinner/constants.js +4 -14
- package/lib/Spinner/index.js +2 -10
- package/lib/StoryCard/StoryCard.js +40 -49
- package/lib/StoryCard/index.js +2 -10
- package/lib/Table/Body.js +7 -15
- package/lib/Table/Cell.js +28 -38
- package/lib/Table/Header.js +11 -19
- package/lib/Table/Row.js +8 -16
- package/lib/Table/SubHeading.js +10 -18
- package/lib/Table/Table.js +26 -35
- package/lib/Table/index.js +12 -20
- package/lib/TermsAndConditions/ExpandCollapse.js +22 -30
- package/lib/TermsAndConditions/TermsAndConditions.js +52 -60
- package/lib/TermsAndConditions/dictionary.js +2 -9
- package/lib/TermsAndConditions/index.js +1 -13
- package/lib/Testimonial/Testimonial.js +37 -45
- package/lib/Testimonial/index.js +2 -10
- package/lib/Toast/Toast.js +32 -42
- package/lib/Toast/index.js +2 -10
- package/lib/Video/ControlBar/ControlBar.js +73 -81
- package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +16 -24
- package/lib/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +27 -35
- package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +27 -36
- package/lib/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +30 -38
- package/lib/Video/MiddleControlButton/MiddleControlButton.js +16 -24
- package/lib/Video/Video.js +74 -83
- package/lib/Video/index.js +2 -10
- package/lib/Video/videoText.js +1 -8
- package/lib/VideoPicker/VideoPicker.js +43 -53
- package/lib/VideoPicker/VideoPickerPlayer.js +17 -25
- package/lib/VideoPicker/VideoPickerThumbnail.js +38 -46
- package/lib/VideoPicker/VideoSlider.js +17 -26
- package/lib/VideoPicker/index.js +2 -10
- package/lib/VideoPicker/videoPropType.js +9 -18
- package/lib/WaffleGrid/WaffleGrid.js +33 -43
- package/lib/WaffleGrid/index.js +2 -10
- package/lib/WebVideo/WebVideo.js +42 -52
- package/lib/WebVideo/index.js +2 -10
- package/lib/WebVideo/utils/index.js +3 -11
- package/lib/baseExports.js +18 -431
- package/lib/index.js +38 -323
- package/lib/server.js +4 -12
- package/lib/shared/ConditionalWrapper/ConditionalWrapper.js +9 -17
- package/lib/shared/ConditionalWrapper/index.js +2 -10
- package/lib/shared/FullBleedContent/FullBleedContent.js +21 -29
- package/lib/shared/FullBleedContent/getFullBleedBorderRadius.js +1 -8
- package/lib/shared/FullBleedContent/index.js +4 -24
- package/lib/shared/FullBleedContent/useFullBleedContentProps.js +4 -11
- package/lib/shared/VideoSplash/SplashButton/SplashButton.js +19 -27
- package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +27 -35
- package/lib/shared/VideoSplash/VideoSplash.js +24 -32
- package/lib/shared/VideoSplash/helpers.js +5 -14
- package/lib/utils/index.js +10 -75
- package/lib/utils/isElementFocusable.js +1 -8
- package/lib/utils/logger.js +6 -15
- package/lib/utils/media.js +5 -11
- package/lib/utils/renderStructuredContent.js +8 -15
- package/lib/utils/ssr.js +5 -12
- package/lib/utils/theming/get-theme-from-server.js +2 -10
- package/lib/utils/theming/with-client-theme.js +9 -17
- package/lib/utils/theming/with-server-theme.js +11 -19
- package/lib/utils/transforms.js +3 -11
- package/lib/utils/useOverlaidPosition.js +15 -23
- package/lib/utils/useTypographyTheme.js +6 -13
- package/package.json +18 -20
- package/src/Card/Card.jsx +2 -2
- package/src/DatePicker/DatePicker.jsx +1 -2
- package/src/PreviewCard/AuthorDate.jsx +5 -3
- package/src/utils/logger.js +2 -2
- package/lib-module/Badge/Badge.js +0 -121
- package/lib-module/Badge/index.js +0 -2
- package/lib-module/BlockQuote/BlockQuote.js +0 -204
- package/lib-module/BlockQuote/index.js +0 -2
- package/lib-module/Breadcrumbs/Breadcrumbs.js +0 -250
- package/lib-module/Breadcrumbs/Item/Item.js +0 -175
- package/lib-module/Breadcrumbs/index.js +0 -1
- package/lib-module/Callout/Callout.js +0 -135
- package/lib-module/Callout/index.js +0 -2
- package/lib-module/Card/Card.js +0 -251
- package/lib-module/Card/CardContent.js +0 -90
- package/lib-module/Card/CardFooter.js +0 -78
- package/lib-module/Card/index.js +0 -2
- package/lib-module/Countdown/Countdown.js +0 -169
- package/lib-module/Countdown/Segment.js +0 -96
- package/lib-module/Countdown/constants.js +0 -4
- package/lib-module/Countdown/dictionary.js +0 -22
- package/lib-module/Countdown/index.js +0 -2
- package/lib-module/Countdown/types.js +0 -24
- package/lib-module/Countdown/useCountdown.js +0 -26
- package/lib-module/DatePicker/CalendarContainer.js +0 -208
- package/lib-module/DatePicker/DatePicker.js +0 -519
- package/lib-module/DatePicker/dictionary.js +0 -119
- package/lib-module/DatePicker/index.js +0 -2
- package/lib-module/DatePicker/reactDatesCss.js +0 -3
- package/lib-module/Disclaimer/Disclaimer.js +0 -54
- package/lib-module/Disclaimer/index.js +0 -1
- package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +0 -73
- package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +0 -117
- package/lib-module/ExpandCollapseMini/index.js +0 -2
- package/lib-module/Footnote/Footnote.js +0 -632
- package/lib-module/Footnote/FootnoteLink.js +0 -118
- package/lib-module/Footnote/dictionary.js +0 -12
- package/lib-module/Footnote/index.js +0 -4
- package/lib-module/IconButton/IconButton.js +0 -55
- package/lib-module/IconButton/index.js +0 -2
- package/lib-module/Image/Image.js +0 -83
- package/lib-module/Image/index.js +0 -9
- package/lib-module/Image/server.js +0 -4
- package/lib-module/List/List.js +0 -2
- package/lib-module/List/ListItem.js +0 -28
- package/lib-module/List/index.js +0 -4
- package/lib-module/NavigationBar/NavigationBar.js +0 -224
- package/lib-module/NavigationBar/NavigationItem.js +0 -87
- package/lib-module/NavigationBar/NavigationSubMenu.js +0 -162
- package/lib-module/NavigationBar/collapseItems.js +0 -41
- package/lib-module/NavigationBar/index.js +0 -4
- package/lib-module/NavigationBar/resolveItemSelection.js +0 -16
- package/lib-module/OptimizeImage/OptimizeImage.js +0 -92
- package/lib-module/OptimizeImage/index.js +0 -2
- package/lib-module/OptimizeImage/utils/getFallbackUrl.js +0 -7
- package/lib-module/OptimizeImage/utils/getImageUrls.js +0 -12
- package/lib-module/OptimizeImage/utils/getOptimizedUrl.js +0 -17
- package/lib-module/OptimizeImage/utils/hasWebpSupport.js +0 -28
- package/lib-module/OptimizeImage/utils/index.js +0 -5
- package/lib-module/OptimizeImage/utils/isSvgUrl.js +0 -3
- package/lib-module/OrderedList/Item.js +0 -145
- package/lib-module/OrderedList/ItemBase.js +0 -27
- package/lib-module/OrderedList/OrderedList.js +0 -86
- package/lib-module/OrderedList/OrderedListBase.js +0 -45
- package/lib-module/OrderedList/constants.js +0 -2
- package/lib-module/OrderedList/index.js +0 -4
- package/lib-module/Paragraph/Paragraph.js +0 -90
- package/lib-module/Paragraph/index.js +0 -2
- package/lib-module/PreviewCard/AuthorDate.js +0 -57
- package/lib-module/PreviewCard/PreviewCard.js +0 -209
- package/lib-module/PreviewCard/index.js +0 -2
- package/lib-module/PriceLockup/PriceLockup.js +0 -335
- package/lib-module/PriceLockup/index.js +0 -2
- package/lib-module/PriceLockup/tokens.js +0 -55
- package/lib-module/Progress/ProgressBar.js +0 -83
- package/lib-module/Progress/index.js +0 -4
- package/lib-module/QuantitySelector/QuantitySelector.js +0 -261
- package/lib-module/QuantitySelector/SideButton.js +0 -70
- package/lib-module/QuantitySelector/dictionary.js +0 -26
- package/lib-module/QuantitySelector/index.js +0 -2
- package/lib-module/QuantitySelector/styles.js +0 -9
- package/lib-module/ResponsiveImage/ResponsiveImage.js +0 -95
- package/lib-module/ResponsiveImage/index.js +0 -2
- package/lib-module/Ribbon/Ribbon.js +0 -216
- package/lib-module/Ribbon/index.js +0 -2
- package/lib-module/SkeletonProvider/SkeletonImage.js +0 -39
- package/lib-module/SkeletonProvider/SkeletonProvider.js +0 -57
- package/lib-module/SkeletonProvider/SkeletonTypography.js +0 -38
- package/lib-module/SkeletonProvider/index.js +0 -2
- package/lib-module/Span/Span.js +0 -72
- package/lib-module/Span/index.js +0 -2
- package/lib-module/Spinner/Spinner.js +0 -215
- package/lib-module/Spinner/SpinnerContent.js +0 -94
- package/lib-module/Spinner/constants.js +0 -4
- package/lib-module/Spinner/index.js +0 -2
- package/lib-module/StoryCard/StoryCard.js +0 -212
- package/lib-module/StoryCard/index.js +0 -2
- package/lib-module/Table/Body.js +0 -17
- package/lib-module/Table/Cell.js +0 -176
- package/lib-module/Table/Header.js +0 -25
- package/lib-module/Table/Row.js +0 -19
- package/lib-module/Table/SubHeading.js +0 -23
- package/lib-module/Table/Table.js +0 -114
- package/lib-module/Table/index.js +0 -12
- package/lib-module/TermsAndConditions/ExpandCollapse.js +0 -153
- package/lib-module/TermsAndConditions/TermsAndConditions.js +0 -277
- package/lib-module/TermsAndConditions/dictionary.js +0 -16
- package/lib-module/TermsAndConditions/index.js +0 -1
- package/lib-module/Testimonial/Testimonial.js +0 -234
- package/lib-module/Testimonial/index.js +0 -2
- package/lib-module/Toast/Toast.js +0 -158
- package/lib-module/Toast/index.js +0 -2
- package/lib-module/Video/ControlBar/ControlBar.js +0 -288
- package/lib-module/Video/ControlBar/Controls/VideoButton/VideoButton.js +0 -70
- package/lib-module/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +0 -163
- package/lib-module/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +0 -203
- package/lib-module/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +0 -191
- package/lib-module/Video/MiddleControlButton/MiddleControlButton.js +0 -71
- package/lib-module/Video/Video.js +0 -959
- package/lib-module/Video/index.js +0 -2
- package/lib-module/Video/videoText.js +0 -55
- package/lib-module/VideoPicker/VideoPicker.js +0 -190
- package/lib-module/VideoPicker/VideoPickerPlayer.js +0 -48
- package/lib-module/VideoPicker/VideoPickerThumbnail.js +0 -218
- package/lib-module/VideoPicker/VideoSlider.js +0 -82
- package/lib-module/VideoPicker/index.js +0 -2
- package/lib-module/VideoPicker/videoPropType.js +0 -10
- package/lib-module/WaffleGrid/WaffleGrid.js +0 -157
- package/lib-module/WaffleGrid/index.js +0 -2
- package/lib-module/WebVideo/WebVideo.js +0 -191
- package/lib-module/WebVideo/index.js +0 -2
- package/lib-module/WebVideo/utils/index.js +0 -50
- package/lib-module/baseExports.js +0 -19
- package/lib-module/index.js +0 -40
- package/lib-module/server.js +0 -5
- package/lib-module/shared/ConditionalWrapper/ConditionalWrapper.js +0 -22
- package/lib-module/shared/ConditionalWrapper/index.js +0 -2
- package/lib-module/shared/FullBleedContent/FullBleedContent.js +0 -101
- package/lib-module/shared/FullBleedContent/getFullBleedBorderRadius.js +0 -55
- package/lib-module/shared/FullBleedContent/index.js +0 -4
- package/lib-module/shared/FullBleedContent/useFullBleedContentProps.js +0 -55
- package/lib-module/shared/VideoSplash/SplashButton/SplashButton.js +0 -84
- package/lib-module/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +0 -223
- package/lib-module/shared/VideoSplash/VideoSplash.js +0 -65
- package/lib-module/shared/VideoSplash/helpers.js +0 -23
- package/lib-module/utils/index.js +0 -10
- package/lib-module/utils/isElementFocusable.js +0 -8
- package/lib-module/utils/logger.js +0 -18
- package/lib-module/utils/media.js +0 -39
- package/lib-module/utils/renderStructuredContent.js +0 -66
- package/lib-module/utils/ssr.js +0 -37
- package/lib-module/utils/theming/get-theme-from-server.js +0 -16
- package/lib-module/utils/theming/with-client-theme.js +0 -24
- package/lib-module/utils/theming/with-server-theme.js +0 -26
- package/lib-module/utils/transforms.js +0 -4
- package/lib-module/utils/useOverlaidPosition.js +0 -216
- package/lib-module/utils/useTypographyTheme.js +0 -24
package/lib/Disclaimer/index.js
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
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
|
-
var _Disclaimer = _interopRequireDefault(require("./Disclaimer"));
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
export { default } from './Disclaimer';
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _componentsBase = require("@telus-uds/components-base");
|
|
10
|
-
var _ExpandCollapseMiniControl = _interopRequireDefault(require("./ExpandCollapseMiniControl"));
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
const ExpandCollapseMini = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
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) => {
|
|
14
7
|
let {
|
|
15
8
|
children,
|
|
16
9
|
onToggle = () => {},
|
|
@@ -26,11 +19,11 @@ const ExpandCollapseMini = /*#__PURE__*/_react.default.forwardRef((_ref, ref) =>
|
|
|
26
19
|
onToggle(event, isOpen);
|
|
27
20
|
}
|
|
28
21
|
};
|
|
29
|
-
return /*#__PURE__*/(
|
|
22
|
+
return /*#__PURE__*/_jsx(ExpandCollapse, {
|
|
30
23
|
onChange: handleChange,
|
|
31
24
|
tokens: tokens,
|
|
32
25
|
initialOpen: initialOpen ? [expandCollapeMiniPanelId] : [],
|
|
33
|
-
children: expandProps => /*#__PURE__*/(
|
|
26
|
+
children: expandProps => /*#__PURE__*/_jsx(ExpandCollapse.Panel, {
|
|
34
27
|
...expandProps,
|
|
35
28
|
panelId: expandCollapeMiniPanelId,
|
|
36
29
|
variant: {
|
|
@@ -46,7 +39,7 @@ const ExpandCollapseMini = /*#__PURE__*/_react.default.forwardRef((_ref, ref) =>
|
|
|
46
39
|
// TODO refactor
|
|
47
40
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
48
41
|
,
|
|
49
|
-
control: pressableState => /*#__PURE__*/(
|
|
42
|
+
control: pressableState => /*#__PURE__*/_jsx(ExpandCollapseMiniControl, {
|
|
50
43
|
pressableState: pressableState,
|
|
51
44
|
...rest
|
|
52
45
|
}),
|
|
@@ -58,24 +51,23 @@ const ExpandCollapseMini = /*#__PURE__*/_react.default.forwardRef((_ref, ref) =>
|
|
|
58
51
|
});
|
|
59
52
|
ExpandCollapseMini.displayName = 'ExpandCollapseMini';
|
|
60
53
|
ExpandCollapseMini.propTypes = {
|
|
61
|
-
...
|
|
54
|
+
...ExpandCollapseMiniControl.propTypes,
|
|
62
55
|
/**
|
|
63
56
|
* Function to call on pressing the panel's control, which should open or close the panel.
|
|
64
57
|
*/
|
|
65
|
-
onToggle:
|
|
58
|
+
onToggle: PropTypes.func,
|
|
66
59
|
/**
|
|
67
60
|
* ID for DOM element on web
|
|
68
61
|
*/
|
|
69
|
-
nativeID:
|
|
62
|
+
nativeID: PropTypes.string,
|
|
70
63
|
/**
|
|
71
64
|
* Children nodes that can be added
|
|
72
65
|
*/
|
|
73
|
-
children:
|
|
66
|
+
children: PropTypes.node.isRequired,
|
|
74
67
|
/**
|
|
75
68
|
* Controls if the panel and the content is opened by default on the first load
|
|
76
69
|
*/
|
|
77
|
-
initialOpen:
|
|
78
|
-
tokens:
|
|
70
|
+
initialOpen: PropTypes.bool,
|
|
71
|
+
tokens: getTokensPropType('ExpandCollapseMini')
|
|
79
72
|
};
|
|
80
|
-
|
|
81
|
-
exports.default = _default;
|
|
73
|
+
export default ExpandCollapseMini;
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _componentsBase = require("@telus-uds/components-base");
|
|
10
|
-
var _utils = require("../utils");
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
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]);
|
|
14
7
|
|
|
15
8
|
// The ExpandCollapseControl has all the appropriate role, a11y, press handling etc
|
|
16
9
|
// and a more appropriate press area, defer interaction handling to it.
|
|
@@ -21,7 +14,6 @@ const presentationOnly = {
|
|
|
21
14
|
// Stop RNW from stopping clicks from bubbling to Control
|
|
22
15
|
focusable: false // Stop RNW from setting tabIndex={0}: focus goes to Control only
|
|
23
16
|
};
|
|
24
|
-
|
|
25
17
|
const selectLinkTokens = _ref => {
|
|
26
18
|
let {
|
|
27
19
|
color,
|
|
@@ -36,7 +28,7 @@ const selectLinkTokens = _ref => {
|
|
|
36
28
|
blockFontSize: fontSize
|
|
37
29
|
};
|
|
38
30
|
};
|
|
39
|
-
const ExpandCollapseMiniControl = /*#__PURE__*/
|
|
31
|
+
const ExpandCollapseMiniControl = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
40
32
|
let {
|
|
41
33
|
pressableState,
|
|
42
34
|
collapseTitle,
|
|
@@ -54,14 +46,14 @@ const ExpandCollapseMiniControl = /*#__PURE__*/_react.default.forwardRef((_ref2,
|
|
|
54
46
|
// we only want focus outline when focusing, if user is pressing we don't want the border.
|
|
55
47
|
const {
|
|
56
48
|
outerBorderColor
|
|
57
|
-
} =
|
|
49
|
+
} = useThemeTokens('Link', {}, {}, {
|
|
58
50
|
focus
|
|
59
51
|
});
|
|
60
52
|
const {
|
|
61
53
|
size,
|
|
62
54
|
icon,
|
|
63
55
|
...themeTokens
|
|
64
|
-
} =
|
|
56
|
+
} = useThemeTokens('ExpandCollapseMiniControl', tokens, variant, {
|
|
65
57
|
expanded,
|
|
66
58
|
focus
|
|
67
59
|
});
|
|
@@ -84,7 +76,7 @@ const ExpandCollapseMiniControl = /*#__PURE__*/_react.default.forwardRef((_ref2,
|
|
|
84
76
|
}
|
|
85
77
|
return {};
|
|
86
78
|
};
|
|
87
|
-
return /*#__PURE__*/(
|
|
79
|
+
return /*#__PURE__*/_jsx(Link, {
|
|
88
80
|
variant: appearance,
|
|
89
81
|
icon: icon,
|
|
90
82
|
iconPosition: iconPosition,
|
|
@@ -102,24 +94,23 @@ const ExpandCollapseMiniControl = /*#__PURE__*/_react.default.forwardRef((_ref2,
|
|
|
102
94
|
ExpandCollapseMiniControl.displayName = 'ExpandCollapseMiniControl';
|
|
103
95
|
ExpandCollapseMiniControl.propTypes = {
|
|
104
96
|
...selectedSystemPropTypes,
|
|
105
|
-
...
|
|
97
|
+
...Link.propTypes,
|
|
106
98
|
/**
|
|
107
99
|
* Optional function to call on pressing the panel's control, in addition to opening or closing the panel
|
|
108
100
|
*/
|
|
109
|
-
onPress:
|
|
101
|
+
onPress: PropTypes.func,
|
|
110
102
|
/**
|
|
111
103
|
* ExpandCollapseMiniControl title when expanded
|
|
112
104
|
*/
|
|
113
|
-
expandTitle:
|
|
105
|
+
expandTitle: PropTypes.string.isRequired,
|
|
114
106
|
/**
|
|
115
107
|
* ExpandCollapseMiniControl title when collapsed
|
|
116
108
|
*/
|
|
117
|
-
collapseTitle:
|
|
109
|
+
collapseTitle: PropTypes.string.isRequired,
|
|
118
110
|
/**
|
|
119
111
|
* React Native's `Pressable`'s state object
|
|
120
112
|
*/
|
|
121
|
-
pressableState:
|
|
122
|
-
variant:
|
|
113
|
+
pressableState: PropTypes.object,
|
|
114
|
+
variant: PropTypes.object
|
|
123
115
|
};
|
|
124
|
-
|
|
125
|
-
exports.default = _default;
|
|
116
|
+
export default ExpandCollapseMiniControl;
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _ExpandCollapseMini = _interopRequireDefault(require("./ExpandCollapseMini"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
var _default = _ExpandCollapseMini.default;
|
|
10
|
-
exports.default = _default;
|
|
1
|
+
import ExpandCollapseMini from './ExpandCollapseMini';
|
|
2
|
+
export default ExpandCollapseMini;
|
package/lib/Footnote/Footnote.js
CHANGED
|
@@ -1,28 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _componentsBase = require("@telus-uds/components-base");
|
|
11
|
-
var _OrderedListBase = _interopRequireDefault(require("../OrderedList/OrderedListBase"));
|
|
12
|
-
var _utils = require("../utils");
|
|
13
|
-
var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
14
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled, { createGlobalStyle } from 'styled-components';
|
|
4
|
+
import { Icon, Portal, selectSystemProps, Typography, useCopy, useTheme, useResponsiveProp, useThemeTokens, useViewport, getTokensPropType } from '@telus-uds/components-base';
|
|
5
|
+
import OrderedListBase from '../OrderedList/OrderedListBase';
|
|
6
|
+
import { htmlAttrs, media, renderStructuredContent, isElementFocusable } from '../utils';
|
|
7
|
+
import defaultDictionary from './dictionary';
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
19
10
|
const viewportBreakpoint = 1440;
|
|
20
|
-
const GlobalBodyScrollLock = /*#__PURE__*/
|
|
21
|
-
'html, body':
|
|
11
|
+
const GlobalBodyScrollLock = /*#__PURE__*/createGlobalStyle({
|
|
12
|
+
'html, body': media().until('md').css({
|
|
22
13
|
overflow: 'hidden'
|
|
23
14
|
})
|
|
24
15
|
});
|
|
25
|
-
const StyledFootnote = /*#__PURE__*/
|
|
16
|
+
const StyledFootnote = /*#__PURE__*/styled.div.withConfig({
|
|
26
17
|
displayName: "Footnote__StyledFootnote",
|
|
27
18
|
componentId: "components-web__sc-1563bo5-0"
|
|
28
19
|
})(_ref => {
|
|
@@ -50,7 +41,7 @@ const StyledFootnote = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
|
50
41
|
},
|
|
51
42
|
zIndex: 99999,
|
|
52
43
|
visibility: isVisible ? 'visible' : 'hidden',
|
|
53
|
-
...
|
|
44
|
+
...media().from(isMobileFullScreen ? 'md' : 'xs').css({
|
|
54
45
|
top: 'auto',
|
|
55
46
|
bottom: 0,
|
|
56
47
|
height: 'auto',
|
|
@@ -69,14 +60,14 @@ const StyledFootnote = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
|
69
60
|
}
|
|
70
61
|
return {};
|
|
71
62
|
});
|
|
72
|
-
const StyledFootnoteHeader = /*#__PURE__*/
|
|
63
|
+
const StyledFootnoteHeader = /*#__PURE__*/styled.div.withConfig({
|
|
73
64
|
displayName: "Footnote__StyledFootnoteHeader",
|
|
74
65
|
componentId: "components-web__sc-1563bo5-1"
|
|
75
66
|
})(() => ({
|
|
76
67
|
position: 'relative',
|
|
77
68
|
width: '100%'
|
|
78
69
|
}));
|
|
79
|
-
const StyledHeader = /*#__PURE__*/
|
|
70
|
+
const StyledHeader = /*#__PURE__*/styled.div.withConfig({
|
|
80
71
|
displayName: "Footnote__StyledHeader",
|
|
81
72
|
componentId: "components-web__sc-1563bo5-2"
|
|
82
73
|
})(_ref3 => {
|
|
@@ -97,7 +88,7 @@ const StyledHeader = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
|
97
88
|
paddingLeft: footnoteHeaderPaddingLeft
|
|
98
89
|
};
|
|
99
90
|
});
|
|
100
|
-
const StyledFootnoteBody = /*#__PURE__*/
|
|
91
|
+
const StyledFootnoteBody = /*#__PURE__*/styled.div.withConfig({
|
|
101
92
|
displayName: "Footnote__StyledFootnoteBody",
|
|
102
93
|
componentId: "components-web__sc-1563bo5-3"
|
|
103
94
|
})(_ref4 => {
|
|
@@ -118,14 +109,14 @@ const StyledFootnoteBody = /*#__PURE__*/_styledComponents.default.div.withConfig
|
|
|
118
109
|
backgroundColor: footnoteBodyBackground,
|
|
119
110
|
padding: footnoteBodyPadding,
|
|
120
111
|
maxHeight: `calc(100vh - ${headerHeight}px)`,
|
|
121
|
-
...
|
|
112
|
+
...media().from('md').css({
|
|
122
113
|
maxHeight: `calc(50vh - ${headerHeight}px)`
|
|
123
114
|
}),
|
|
124
115
|
height: bodyHeight,
|
|
125
116
|
opacity: isTextVisible ? 1 : 0
|
|
126
117
|
};
|
|
127
118
|
});
|
|
128
|
-
const List = /*#__PURE__*/(
|
|
119
|
+
const List = /*#__PURE__*/styled(OrderedListBase).withConfig({
|
|
129
120
|
displayName: "Footnote__List",
|
|
130
121
|
componentId: "components-web__sc-1563bo5-4"
|
|
131
122
|
})(_ref5 => {
|
|
@@ -137,7 +128,7 @@ const List = /*#__PURE__*/(0, _styledComponents.default)(_OrderedListBase.defaul
|
|
|
137
128
|
paddingLeft: listPaddingLeft
|
|
138
129
|
};
|
|
139
130
|
});
|
|
140
|
-
const ListItem = /*#__PURE__*/(
|
|
131
|
+
const ListItem = /*#__PURE__*/styled(OrderedListBase.Item).withConfig({
|
|
141
132
|
displayName: "Footnote__ListItem",
|
|
142
133
|
componentId: "components-web__sc-1563bo5-5"
|
|
143
134
|
})(_ref6 => {
|
|
@@ -164,7 +155,7 @@ const ListItem = /*#__PURE__*/(0, _styledComponents.default)(_OrderedListBase.de
|
|
|
164
155
|
paddingLeft: listItemPaddingLeft
|
|
165
156
|
};
|
|
166
157
|
});
|
|
167
|
-
const CloseButton = /*#__PURE__*/
|
|
158
|
+
const CloseButton = /*#__PURE__*/styled.button.withConfig({
|
|
168
159
|
displayName: "Footnote__CloseButton",
|
|
169
160
|
componentId: "components-web__sc-1563bo5-6"
|
|
170
161
|
})(_ref7 => {
|
|
@@ -188,7 +179,7 @@ const CloseButton = /*#__PURE__*/_styledComponents.default.button.withConfig({
|
|
|
188
179
|
width: closeButtonWidth
|
|
189
180
|
};
|
|
190
181
|
});
|
|
191
|
-
const ContentContainer = /*#__PURE__*/
|
|
182
|
+
const ContentContainer = /*#__PURE__*/styled.div.withConfig({
|
|
192
183
|
displayName: "Footnote__ContentContainer",
|
|
193
184
|
componentId: "components-web__sc-1563bo5-7"
|
|
194
185
|
})({
|
|
@@ -205,7 +196,7 @@ const ContentContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
|
205
196
|
width: maxWidth
|
|
206
197
|
};
|
|
207
198
|
});
|
|
208
|
-
const StyledCustomContentContainer = /*#__PURE__*/
|
|
199
|
+
const StyledCustomContentContainer = /*#__PURE__*/styled.div.withConfig({
|
|
209
200
|
displayName: "Footnote__StyledCustomContentContainer",
|
|
210
201
|
componentId: "components-web__sc-1563bo5-8"
|
|
211
202
|
})(_ref9 => {
|
|
@@ -224,8 +215,8 @@ const StyledCustomContentContainer = /*#__PURE__*/_styledComponents.default.div.
|
|
|
224
215
|
};
|
|
225
216
|
});
|
|
226
217
|
const usePrevious = value => {
|
|
227
|
-
const ref =
|
|
228
|
-
|
|
218
|
+
const ref = React.useRef();
|
|
219
|
+
React.useEffect(() => {
|
|
229
220
|
ref.current = value;
|
|
230
221
|
});
|
|
231
222
|
if (ref.current) {
|
|
@@ -252,7 +243,7 @@ const usePrevious = value => {
|
|
|
252
243
|
* - When `Footnote` is open, the inert prop must be set on all children of body excluding the Footnote
|
|
253
244
|
* - When `Footnote` is closed, focus must return to the initiating element
|
|
254
245
|
*/
|
|
255
|
-
const Footnote = /*#__PURE__*/
|
|
246
|
+
const Footnote = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
256
247
|
var _theme$themeOptions;
|
|
257
248
|
const {
|
|
258
249
|
copy = 'en',
|
|
@@ -263,10 +254,10 @@ const Footnote = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
263
254
|
tokens,
|
|
264
255
|
variant = {},
|
|
265
256
|
isMobileFullScreen = true,
|
|
266
|
-
dictionary =
|
|
257
|
+
dictionary = defaultDictionary,
|
|
267
258
|
...rest
|
|
268
259
|
} = props;
|
|
269
|
-
const viewport =
|
|
260
|
+
const viewport = useViewport();
|
|
270
261
|
const {
|
|
271
262
|
footnoteBackground,
|
|
272
263
|
footnoteBorderTopSizeMd,
|
|
@@ -301,31 +292,31 @@ const Footnote = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
301
292
|
closeButtonWidth,
|
|
302
293
|
closeButtonIconSize,
|
|
303
294
|
closeIcon
|
|
304
|
-
} =
|
|
295
|
+
} = useThemeTokens('Footnote', tokens, variant, {
|
|
305
296
|
viewport
|
|
306
297
|
});
|
|
307
|
-
const footnoteRef =
|
|
308
|
-
const headerRef =
|
|
309
|
-
const bodyRef =
|
|
310
|
-
const contentRef =
|
|
311
|
-
const closeButtonRef =
|
|
312
|
-
const [data, setData] =
|
|
298
|
+
const footnoteRef = React.useRef(null);
|
|
299
|
+
const headerRef = React.useRef(null);
|
|
300
|
+
const bodyRef = React.useRef(null);
|
|
301
|
+
const contentRef = React.useRef(null);
|
|
302
|
+
const closeButtonRef = React.useRef(null);
|
|
303
|
+
const [data, setData] = React.useState({
|
|
313
304
|
content: null,
|
|
314
305
|
number: null
|
|
315
306
|
});
|
|
316
|
-
const [headerHeight, setHeaderHeight] =
|
|
317
|
-
const [bodyHeight, setBodyHeight] =
|
|
318
|
-
const [isVisible, setIsVisible] =
|
|
319
|
-
const [isTextVisible, setIsTextVisible] =
|
|
320
|
-
const getCopy =
|
|
307
|
+
const [headerHeight, setHeaderHeight] = React.useState('auto');
|
|
308
|
+
const [bodyHeight, setBodyHeight] = React.useState('auto');
|
|
309
|
+
const [isVisible, setIsVisible] = React.useState(false);
|
|
310
|
+
const [isTextVisible, setIsTextVisible] = React.useState(true);
|
|
311
|
+
const getCopy = useCopy({
|
|
321
312
|
dictionary,
|
|
322
313
|
copy
|
|
323
314
|
});
|
|
324
315
|
const prevProps = usePrevious(props);
|
|
325
|
-
const theme =
|
|
326
|
-
const maxWidth =
|
|
327
|
-
const [isScrollable, setIsScrollable] =
|
|
328
|
-
const closeFootnote =
|
|
316
|
+
const theme = useTheme();
|
|
317
|
+
const maxWidth = useResponsiveProp((_theme$themeOptions = theme.themeOptions) === null || _theme$themeOptions === void 0 ? void 0 : _theme$themeOptions.contentMaxWidth);
|
|
318
|
+
const [isScrollable, setIsScrollable] = React.useState(false);
|
|
319
|
+
const closeFootnote = React.useCallback((event, options) => {
|
|
329
320
|
onClose(event, options);
|
|
330
321
|
}, [onClose]);
|
|
331
322
|
|
|
@@ -336,7 +327,7 @@ const Footnote = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
336
327
|
* if the footnote is active the focus will be inside the footnote until it is closed,
|
|
337
328
|
* if there are no interactive elements the focus will remain inside the close button.
|
|
338
329
|
*/
|
|
339
|
-
const manageFootnoteFocusAndClose =
|
|
330
|
+
const manageFootnoteFocusAndClose = React.useCallback(event => {
|
|
340
331
|
var _footnoteRef$current, _footnoteRef$current2;
|
|
341
332
|
if (!isVisible) {
|
|
342
333
|
return;
|
|
@@ -347,7 +338,7 @@ const Footnote = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
347
338
|
returnFocus: true
|
|
348
339
|
});
|
|
349
340
|
} else if (event.key === 'Tab') {
|
|
350
|
-
const focusableElements = Array.from(footnoteRef.current.querySelectorAll('*')).filter(
|
|
341
|
+
const focusableElements = Array.from(footnoteRef.current.querySelectorAll('*')).filter(isElementFocusable);
|
|
351
342
|
const firstElement = focusableElements[0];
|
|
352
343
|
const lastElement = focusableElements[focusableElements.length - 1];
|
|
353
344
|
if (event.shiftKey && document.activeElement === firstElement) {
|
|
@@ -413,7 +404,7 @@ const Footnote = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
413
404
|
};
|
|
414
405
|
|
|
415
406
|
// Set height of header on mount
|
|
416
|
-
|
|
407
|
+
React.useEffect(() => {
|
|
417
408
|
var _headerRef$current;
|
|
418
409
|
setHeaderHeight((_headerRef$current = headerRef.current) === null || _headerRef$current === void 0 ? void 0 : _headerRef$current.offsetHeight);
|
|
419
410
|
}, []);
|
|
@@ -424,7 +415,7 @@ const Footnote = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
424
415
|
};
|
|
425
416
|
|
|
426
417
|
// Add listeners for mouse clicks outside of Footnote and for ESCAPE key presses
|
|
427
|
-
|
|
418
|
+
React.useEffect(() => {
|
|
428
419
|
if (isOpen) {
|
|
429
420
|
setIsVisible(true);
|
|
430
421
|
document.addEventListener('mousedown', manageFootnoteFocusAndClose);
|
|
@@ -447,7 +438,7 @@ const Footnote = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
447
438
|
}, [manageFootnoteFocusAndClose, isOpen]);
|
|
448
439
|
|
|
449
440
|
// Set data if opening a new footnote
|
|
450
|
-
|
|
441
|
+
React.useEffect(() => {
|
|
451
442
|
if (isOpen && !prevProps.isOpen) {
|
|
452
443
|
setData({
|
|
453
444
|
content,
|
|
@@ -455,7 +446,7 @@ const Footnote = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
455
446
|
});
|
|
456
447
|
}
|
|
457
448
|
}, [isOpen, prevProps.isOpen, content, number]);
|
|
458
|
-
|
|
449
|
+
React.useEffect(() => {
|
|
459
450
|
if (isOpen && prevProps.isOpen && number !== prevProps.number) {
|
|
460
451
|
saveCurrentHeight();
|
|
461
452
|
setIsTextVisible(false);
|
|
@@ -463,13 +454,13 @@ const Footnote = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
463
454
|
}, [number, isOpen, prevProps.isOpen, prevProps.number]);
|
|
464
455
|
|
|
465
456
|
// Reset footnote on close
|
|
466
|
-
|
|
467
|
-
const getFootnoteBodyContent =
|
|
457
|
+
React.useEffect(resetFootnote, [isOpen]);
|
|
458
|
+
const getFootnoteBodyContent = React.useCallback(() => {
|
|
468
459
|
if (!data.number || !data.content) {
|
|
469
460
|
return null;
|
|
470
461
|
}
|
|
471
|
-
if (
|
|
472
|
-
return /*#__PURE__*/(
|
|
462
|
+
if (/*#__PURE__*/React.isValidElement(data.content)) {
|
|
463
|
+
return /*#__PURE__*/_jsx(StyledCustomContentContainer, {
|
|
473
464
|
listItemColor: listItemColor,
|
|
474
465
|
listItemFontSize: listItemFontSize,
|
|
475
466
|
listItemLineHeight: listItemLineHeight,
|
|
@@ -478,28 +469,28 @@ const Footnote = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
478
469
|
children: data.content
|
|
479
470
|
});
|
|
480
471
|
}
|
|
481
|
-
return /*#__PURE__*/(
|
|
472
|
+
return /*#__PURE__*/_jsx(List, {
|
|
482
473
|
start: data.number,
|
|
483
474
|
ref: contentRef,
|
|
484
475
|
listPaddingLeft: listPaddingLeft,
|
|
485
|
-
children: /*#__PURE__*/(
|
|
476
|
+
children: /*#__PURE__*/_jsx(ListItem, {
|
|
486
477
|
listItemMarkerFontSize: listItemMarkerFontSize,
|
|
487
478
|
listItemMarkerLineHeight: listItemMarkerLineHeight,
|
|
488
479
|
listItemColor: listItemColor,
|
|
489
480
|
listItemFontSize: listItemFontSize,
|
|
490
481
|
listItemLineHeight: listItemLineHeight,
|
|
491
482
|
listItemPaddingLeft: listItemPaddingLeft,
|
|
492
|
-
children: /*#__PURE__*/(
|
|
483
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
493
484
|
tokens: {
|
|
494
485
|
fontSize: listItemFontSize,
|
|
495
486
|
lineHeight: listItemLineHeight
|
|
496
487
|
},
|
|
497
|
-
children:
|
|
488
|
+
children: renderStructuredContent(data.content)
|
|
498
489
|
})
|
|
499
490
|
})
|
|
500
491
|
});
|
|
501
492
|
}, [data.content, data.number, listItemColor, listItemFontSize, listItemLineHeight, listItemMarkerFontSize, listItemMarkerLineHeight, listItemPaddingLeft, listPaddingLeft]);
|
|
502
|
-
const checkIfScrollable =
|
|
493
|
+
const checkIfScrollable = React.useCallback(() => {
|
|
503
494
|
const footnoteElement = footnoteRef.current;
|
|
504
495
|
if (footnoteElement) {
|
|
505
496
|
const footnoteViewportHeight = footnoteElement.clientHeight ? footnoteElement.clientHeight : 0;
|
|
@@ -507,18 +498,18 @@ const Footnote = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
507
498
|
setIsScrollable(contentHeight > footnoteViewportHeight * 0.5);
|
|
508
499
|
}
|
|
509
500
|
}, [contentRef, setIsScrollable]);
|
|
510
|
-
|
|
501
|
+
React.useEffect(() => {
|
|
511
502
|
if (isOpen) {
|
|
512
503
|
setTimeout(() => {
|
|
513
504
|
checkIfScrollable();
|
|
514
505
|
}, 100);
|
|
515
506
|
}
|
|
516
507
|
}, [isOpen, checkIfScrollable]);
|
|
517
|
-
return /*#__PURE__*/(
|
|
518
|
-
children: /*#__PURE__*/(
|
|
508
|
+
return /*#__PURE__*/_jsx(Portal, {
|
|
509
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
519
510
|
...selectProps(rest),
|
|
520
511
|
ref: ref,
|
|
521
|
-
children: [isOpen && /*#__PURE__*/(
|
|
512
|
+
children: [isOpen && /*#__PURE__*/_jsx(GlobalBodyScrollLock, {}), /*#__PURE__*/_jsx(StyledFootnote, {
|
|
522
513
|
ref: footnoteRef,
|
|
523
514
|
isOpen: isOpen,
|
|
524
515
|
isVisible: isVisible,
|
|
@@ -528,18 +519,18 @@ const Footnote = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
528
519
|
footnoteBorderTop: `${footnoteBorderTopSizeMd}px solid ${footnoteBorderColorMd}`,
|
|
529
520
|
isScrollable: isScrollable,
|
|
530
521
|
isMobileFullScreen: isMobileFullScreen,
|
|
531
|
-
children: /*#__PURE__*/(
|
|
522
|
+
children: /*#__PURE__*/_jsxs(ContentContainer, {
|
|
532
523
|
maxWidth: maxWidth,
|
|
533
|
-
children: [/*#__PURE__*/(
|
|
524
|
+
children: [/*#__PURE__*/_jsx(StyledFootnoteHeader, {
|
|
534
525
|
ref: headerRef,
|
|
535
526
|
viewport: viewport,
|
|
536
|
-
children: /*#__PURE__*/(
|
|
527
|
+
children: /*#__PURE__*/_jsxs(StyledHeader, {
|
|
537
528
|
footnoteHeaderPaddingLeft: footnoteHeaderPaddingLeft,
|
|
538
529
|
footnoteHeaderPaddingRight: footnoteHeaderPaddingRight,
|
|
539
530
|
footnoteHeaderPaddingTop: footnoteHeaderPaddingTop,
|
|
540
531
|
footnoteHeaderPaddingBottom: footnoteHeaderPaddingBottom,
|
|
541
532
|
headerMargin: headerMargin,
|
|
542
|
-
children: [/*#__PURE__*/(
|
|
533
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
543
534
|
tokens: {
|
|
544
535
|
fontSize: headerFontSize,
|
|
545
536
|
lineHeight: headerLineHeight
|
|
@@ -548,7 +539,7 @@ const Footnote = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
548
539
|
size: 'h4'
|
|
549
540
|
},
|
|
550
541
|
children: getCopy('heading')
|
|
551
|
-
}), /*#__PURE__*/(
|
|
542
|
+
}), /*#__PURE__*/_jsx(CloseButton, {
|
|
552
543
|
ref: closeButtonRef,
|
|
553
544
|
closeButtonBorder: `${closeButtonBorderSize} solid ${closeButtonBorderColor}`,
|
|
554
545
|
closeButtonWidth: `${closeButtonWidth}px`,
|
|
@@ -561,7 +552,7 @@ const Footnote = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
561
552
|
});
|
|
562
553
|
},
|
|
563
554
|
"aria-label": getCopy('close'),
|
|
564
|
-
children: /*#__PURE__*/(
|
|
555
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
565
556
|
icon: closeIcon,
|
|
566
557
|
tokens: {
|
|
567
558
|
size: `${closeButtonIconSize}px`
|
|
@@ -569,7 +560,7 @@ const Footnote = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
569
560
|
})
|
|
570
561
|
})]
|
|
571
562
|
})
|
|
572
|
-
}), /*#__PURE__*/(
|
|
563
|
+
}), /*#__PURE__*/_jsx(StyledFootnoteBody, {
|
|
573
564
|
ref: bodyRef,
|
|
574
565
|
bodyHeight: bodyHeight,
|
|
575
566
|
headerHeight: headerHeight,
|
|
@@ -586,37 +577,37 @@ const Footnote = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
586
577
|
});
|
|
587
578
|
});
|
|
588
579
|
Footnote.displayName = 'Footnote';
|
|
589
|
-
const copyShape =
|
|
590
|
-
close:
|
|
591
|
-
heading:
|
|
580
|
+
const copyShape = PropTypes.shape({
|
|
581
|
+
close: PropTypes.string.isRequired,
|
|
582
|
+
heading: PropTypes.string.isRequired
|
|
592
583
|
});
|
|
593
584
|
|
|
594
585
|
// If a language dictionary entry is provided, it must contain every key
|
|
595
|
-
const dictionaryContentShape =
|
|
596
|
-
a11yLabel:
|
|
597
|
-
close:
|
|
598
|
-
heading:
|
|
586
|
+
const dictionaryContentShape = PropTypes.shape({
|
|
587
|
+
a11yLabel: PropTypes.string.isRequired,
|
|
588
|
+
close: PropTypes.string.isRequired,
|
|
589
|
+
heading: PropTypes.string.isRequired
|
|
599
590
|
});
|
|
600
591
|
Footnote.propTypes = {
|
|
601
592
|
...selectedSystemPropTypes,
|
|
602
|
-
tokens:
|
|
593
|
+
tokens: getTokensPropType('Footnote'),
|
|
603
594
|
/**
|
|
604
595
|
* The content.
|
|
605
596
|
*/
|
|
606
|
-
content:
|
|
597
|
+
content: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
607
598
|
/**
|
|
608
599
|
* Use the `copy` prop to either select provided English or French copy by passing 'en' or 'fr' respectively.
|
|
609
600
|
* To provide your own, pass a JSON object with the keys `heading` and `close`.
|
|
610
601
|
*/
|
|
611
|
-
copy:
|
|
602
|
+
copy: PropTypes.oneOfType([PropTypes.oneOf(['en', 'fr']), copyShape]),
|
|
612
603
|
/**
|
|
613
604
|
* A boolean flag used hide or show the `Footnote`. Set to `true` to open the `Footnote`.
|
|
614
605
|
*/
|
|
615
|
-
isOpen:
|
|
606
|
+
isOpen: PropTypes.bool,
|
|
616
607
|
/**
|
|
617
608
|
* The number, must match the number of the `FootnoteLink` that initiated the `Footnote`.
|
|
618
609
|
*/
|
|
619
|
-
number:
|
|
610
|
+
number: PropTypes.number,
|
|
620
611
|
/**
|
|
621
612
|
* A callback function to handle the closing of the footnote.
|
|
622
613
|
*
|
|
@@ -624,18 +615,17 @@ Footnote.propTypes = {
|
|
|
624
615
|
* @param {Object} options Custom options
|
|
625
616
|
* @param {boolean} options.returnFocus Should the `Footnote` return focus on close
|
|
626
617
|
*/
|
|
627
|
-
onClose:
|
|
618
|
+
onClose: PropTypes.func.isRequired,
|
|
628
619
|
/**
|
|
629
620
|
* Override the default dictionary, by passing the complete dictionary object for `en` and `fr`
|
|
630
621
|
*/
|
|
631
|
-
dictionary:
|
|
622
|
+
dictionary: PropTypes.shape({
|
|
632
623
|
en: dictionaryContentShape,
|
|
633
624
|
fr: dictionaryContentShape
|
|
634
625
|
}),
|
|
635
626
|
/**
|
|
636
627
|
* A boolean flag used to disable isMobileFullScreen of Footnote for mobile view
|
|
637
628
|
*/
|
|
638
|
-
isMobileFullScreen:
|
|
629
|
+
isMobileFullScreen: PropTypes.bool
|
|
639
630
|
};
|
|
640
|
-
|
|
641
|
-
exports.default = _default;
|
|
631
|
+
export default Footnote;
|