@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
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _componentsBase = require("@telus-uds/components-base");
|
|
10
|
-
var _systemConstants = require("@telus-uds/system-constants");
|
|
11
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
12
|
-
var _utils = require("../utils");
|
|
13
|
-
var _Segment = _interopRequireDefault(require("./Segment"));
|
|
14
|
-
var _useCountdown = _interopRequireDefault(require("./useCountdown"));
|
|
15
|
-
var _types = require("./types");
|
|
16
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Spacer, StackView, Typography, selectSystemProps, useViewport, useThemeTokens, applyTextStyles, getTokensPropType } from '@telus-uds/components-base';
|
|
4
|
+
import { viewports } from '@telus-uds/system-constants';
|
|
5
|
+
import styled from 'styled-components';
|
|
18
6
|
// Reading these from the RN palette since they will be used to generate
|
|
19
7
|
// the `Typography` tokens
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
import { htmlAttrs, transformGradient } from '../utils';
|
|
9
|
+
import Segment from './Segment';
|
|
10
|
+
import useCountdown from './useCountdown';
|
|
11
|
+
import { countdownVariantPropType, dictionaryContentShape } from './types';
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
14
|
+
const Container = /*#__PURE__*/styled.div.withConfig({
|
|
22
15
|
displayName: "Countdown__Container",
|
|
23
16
|
componentId: "components-web__sc-18tqcb2-0"
|
|
24
17
|
})(_ref => {
|
|
@@ -75,7 +68,7 @@ const getMainTextTokens = _ref2 => {
|
|
|
75
68
|
fontName: textTimerFontName
|
|
76
69
|
};
|
|
77
70
|
};
|
|
78
|
-
const Countdown = /*#__PURE__*/
|
|
71
|
+
const Countdown = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
79
72
|
let {
|
|
80
73
|
copy = 'en',
|
|
81
74
|
targetTime,
|
|
@@ -83,8 +76,8 @@ const Countdown = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
|
|
|
83
76
|
variant = {},
|
|
84
77
|
...rest
|
|
85
78
|
} = _ref3;
|
|
86
|
-
const [days, hours, minutes, seconds] = (
|
|
87
|
-
const viewport =
|
|
79
|
+
const [days, hours, minutes, seconds] = useCountdown(targetTime);
|
|
80
|
+
const viewport = useViewport();
|
|
88
81
|
const {
|
|
89
82
|
feature,
|
|
90
83
|
large,
|
|
@@ -94,19 +87,19 @@ const Countdown = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
|
|
|
94
87
|
if (noDivider && !label) {
|
|
95
88
|
throw new Error('`noDivider` variant can only be used with `label` enabled!');
|
|
96
89
|
}
|
|
97
|
-
const themeTokens =
|
|
90
|
+
const themeTokens = useThemeTokens('Countdown', tokens, variant, {
|
|
98
91
|
viewport
|
|
99
92
|
});
|
|
100
93
|
const segmentFontSize = themeTokens.textFontSize;
|
|
101
|
-
const semanticGradient = themeTokens.containerGradient &&
|
|
94
|
+
const semanticGradient = themeTokens.containerGradient && transformGradient(themeTokens.containerGradient);
|
|
102
95
|
const mainTextTokens = getMainTextTokens(themeTokens);
|
|
103
96
|
const divider = noDivider === true ?
|
|
104
97
|
/*#__PURE__*/
|
|
105
98
|
// StackView-based subcontainer adds a 1-step space on the each side of the divider
|
|
106
|
-
(
|
|
99
|
+
_jsx(Spacer, {
|
|
107
100
|
direction: "row",
|
|
108
|
-
space: (feature || large) && viewport !==
|
|
109
|
-
}) : /*#__PURE__*/(
|
|
101
|
+
space: (feature || large) && viewport !== viewports.xs ? 4 : 1
|
|
102
|
+
}) : /*#__PURE__*/_jsx(Typography, {
|
|
110
103
|
tokens: mainTextTokens,
|
|
111
104
|
children: ":"
|
|
112
105
|
});
|
|
@@ -121,36 +114,36 @@ const Countdown = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
|
|
|
121
114
|
return (
|
|
122
115
|
/*#__PURE__*/
|
|
123
116
|
// Making it focusable for accessibility purposes
|
|
124
|
-
(
|
|
117
|
+
_jsx(Container, {
|
|
125
118
|
ref: ref,
|
|
126
119
|
variant: variant,
|
|
127
120
|
...selectProps(rest),
|
|
128
121
|
tabIndex: 0,
|
|
129
122
|
themeTokens: themeTokens,
|
|
130
123
|
gradient: semanticGradient,
|
|
131
|
-
children: /*#__PURE__*/(
|
|
124
|
+
children: /*#__PURE__*/_jsxs(StackView, {
|
|
132
125
|
direction: "row",
|
|
133
126
|
space: 1,
|
|
134
|
-
children: [/*#__PURE__*/(
|
|
127
|
+
children: [/*#__PURE__*/_jsx(Segment, {
|
|
135
128
|
labelKey: "day",
|
|
136
129
|
number: days,
|
|
137
130
|
segmentWidth: String(days).length,
|
|
138
131
|
...segmentProps
|
|
139
|
-
}), divider, /*#__PURE__*/(
|
|
132
|
+
}), divider, /*#__PURE__*/_jsx(Segment, {
|
|
140
133
|
labelKey: "hour",
|
|
141
134
|
number: hours,
|
|
142
135
|
...segmentProps,
|
|
143
|
-
...
|
|
144
|
-
}), divider, /*#__PURE__*/(
|
|
136
|
+
...applyTextStyles(themeTokens)
|
|
137
|
+
}), divider, /*#__PURE__*/_jsx(Segment, {
|
|
145
138
|
labelKey: "minute",
|
|
146
139
|
number: minutes,
|
|
147
140
|
...segmentProps,
|
|
148
|
-
...
|
|
149
|
-
}), divider, /*#__PURE__*/(
|
|
141
|
+
...applyTextStyles(themeTokens)
|
|
142
|
+
}), divider, /*#__PURE__*/_jsx(Segment, {
|
|
150
143
|
labelKey: "second",
|
|
151
144
|
number: seconds,
|
|
152
145
|
...segmentProps,
|
|
153
|
-
...
|
|
146
|
+
...applyTextStyles(themeTokens)
|
|
154
147
|
})]
|
|
155
148
|
})
|
|
156
149
|
})
|
|
@@ -159,18 +152,17 @@ const Countdown = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
|
|
|
159
152
|
Countdown.displayName = 'Countdown';
|
|
160
153
|
Countdown.propTypes = {
|
|
161
154
|
...selectedSystemPropTypes,
|
|
162
|
-
tokens:
|
|
155
|
+
tokens: getTokensPropType('Countdown'),
|
|
163
156
|
/**
|
|
164
157
|
* Copy language identifier (`'en'` or `'fr'`) or a dictionary instance (an object with
|
|
165
158
|
* the following keys: days, day, hours, hour, minutes, minute, seconds, second)
|
|
166
159
|
*/
|
|
167
|
-
copy:
|
|
160
|
+
copy: PropTypes.oneOfType([PropTypes.oneOf(['en', 'fr']), dictionaryContentShape]),
|
|
168
161
|
/**
|
|
169
162
|
* An instance of JavaScript `Date` object or a string parseable via `Date.parse()`
|
|
170
163
|
* representing a point in the future to count down to.
|
|
171
164
|
*/
|
|
172
|
-
targetTime:
|
|
173
|
-
variant:
|
|
165
|
+
targetTime: PropTypes.instanceOf(Date),
|
|
166
|
+
variant: countdownVariantPropType
|
|
174
167
|
};
|
|
175
|
-
|
|
176
|
-
exports.default = _default;
|
|
168
|
+
export default Countdown;
|
package/lib/Countdown/Segment.js
CHANGED
|
@@ -1,26 +1,19 @@
|
|
|
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 _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
-
var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
12
|
-
var _types = require("./types");
|
|
13
|
-
var _constants = require("./constants");
|
|
14
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { StackView, Typography, useCopy } from '@telus-uds/components-base';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import dictionary from './dictionary';
|
|
6
|
+
import { countdownVariantPropType, dictionaryContentShape } from './types';
|
|
16
7
|
// !TODO: put this back
|
|
8
|
+
import { SEGMENT_WIDTH_TO_FONT_SIZE_RATIO } from './constants';
|
|
17
9
|
|
|
18
10
|
// Pads with zeros on the left if it's a single digit number
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
12
|
const pad = function (number) {
|
|
20
13
|
let segmentWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
21
14
|
return String(number).padStart(segmentWidth, '0');
|
|
22
15
|
};
|
|
23
|
-
const Container = /*#__PURE__*/
|
|
16
|
+
const Container = /*#__PURE__*/styled.div.withConfig({
|
|
24
17
|
displayName: "Segment__Container",
|
|
25
18
|
componentId: "components-web__sc-yrh35y-0"
|
|
26
19
|
})(_ref => {
|
|
@@ -36,7 +29,7 @@ const Container = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
|
36
29
|
display: 'inline-flex',
|
|
37
30
|
...(feature && {
|
|
38
31
|
// This is required because when the numbers for Countdown change, the character widths will change and thereby effecting the container demensions.
|
|
39
|
-
width: `${segmentFontSize *
|
|
32
|
+
width: `${segmentFontSize * SEGMENT_WIDTH_TO_FONT_SIZE_RATIO * segmentWidth}px`,
|
|
40
33
|
display: 'flex'
|
|
41
34
|
})
|
|
42
35
|
};
|
|
@@ -44,7 +37,7 @@ const Container = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
|
44
37
|
// A segment of the countdown string: we need to make sure it
|
|
45
38
|
// keeps its width constant to prevent the whole component from
|
|
46
39
|
// being automatically resized while using variable size fonts
|
|
47
|
-
const Segment = /*#__PURE__*/
|
|
40
|
+
const Segment = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
48
41
|
let {
|
|
49
42
|
copy = 'en',
|
|
50
43
|
segmentFontSize,
|
|
@@ -55,8 +48,8 @@ const Segment = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
55
48
|
segmentWidth = 2,
|
|
56
49
|
variant = {}
|
|
57
50
|
} = _ref2;
|
|
58
|
-
const getCopy =
|
|
59
|
-
dictionary
|
|
51
|
+
const getCopy = useCopy({
|
|
52
|
+
dictionary,
|
|
60
53
|
copy
|
|
61
54
|
});
|
|
62
55
|
const {
|
|
@@ -64,21 +57,21 @@ const Segment = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
64
57
|
large,
|
|
65
58
|
feature
|
|
66
59
|
} = variant;
|
|
67
|
-
return /*#__PURE__*/(
|
|
60
|
+
return /*#__PURE__*/_jsx(Container, {
|
|
68
61
|
segmentFontSize: segmentFontSize,
|
|
69
62
|
segmentWidth: segmentWidth,
|
|
70
63
|
variant: variant,
|
|
71
64
|
ref: ref,
|
|
72
|
-
children: /*#__PURE__*/(
|
|
65
|
+
children: /*#__PURE__*/_jsxs(StackView, {
|
|
73
66
|
direction: large || feature ? 'column' : 'row',
|
|
74
67
|
space: large || feature ? 0 : 1,
|
|
75
68
|
tokens: {
|
|
76
69
|
alignItems: 'center'
|
|
77
70
|
},
|
|
78
|
-
children: [/*#__PURE__*/(
|
|
71
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
79
72
|
tokens: numberTokens,
|
|
80
73
|
children: pad(number, segmentWidth)
|
|
81
|
-
}), label && /*#__PURE__*/(
|
|
74
|
+
}), label && /*#__PURE__*/_jsx(Typography, {
|
|
82
75
|
tokens: labelTokens,
|
|
83
76
|
children: getCopy(number === 1 ? labelKey : `${labelKey}s`)
|
|
84
77
|
})]
|
|
@@ -90,14 +83,13 @@ Segment.propTypes = {
|
|
|
90
83
|
/**
|
|
91
84
|
* Copy language identifier or a dictionary instance.
|
|
92
85
|
*/
|
|
93
|
-
copy:
|
|
94
|
-
segmentFontSize:
|
|
95
|
-
labelKey:
|
|
96
|
-
labelTokens:
|
|
97
|
-
number:
|
|
98
|
-
numberTokens:
|
|
99
|
-
segmentWidth:
|
|
100
|
-
variant:
|
|
86
|
+
copy: PropTypes.oneOfType([PropTypes.oneOf(['en', 'fr']), dictionaryContentShape]),
|
|
87
|
+
segmentFontSize: PropTypes.number,
|
|
88
|
+
labelKey: PropTypes.oneOf(['day', 'hour', 'minute', 'second']),
|
|
89
|
+
labelTokens: PropTypes.object,
|
|
90
|
+
number: PropTypes.number,
|
|
91
|
+
numberTokens: PropTypes.object,
|
|
92
|
+
segmentWidth: PropTypes.number,
|
|
93
|
+
variant: countdownVariantPropType
|
|
101
94
|
};
|
|
102
|
-
|
|
103
|
-
exports.default = _default;
|
|
95
|
+
export default Segment;
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.XS_FONT_SIZE = exports.SEGMENT_WIDTH_TO_FONT_SIZE_RATIO = exports.LARGE_FONT_SIZE = exports.DEFAULT_FONT_SIZE = void 0;
|
|
7
|
-
const DEFAULT_FONT_SIZE = 16;
|
|
8
|
-
exports.DEFAULT_FONT_SIZE = DEFAULT_FONT_SIZE;
|
|
9
|
-
const LARGE_FONT_SIZE = 64;
|
|
10
|
-
exports.LARGE_FONT_SIZE = LARGE_FONT_SIZE;
|
|
11
|
-
const XS_FONT_SIZE = 28;
|
|
12
|
-
exports.XS_FONT_SIZE = XS_FONT_SIZE;
|
|
13
|
-
const SEGMENT_WIDTH_TO_FONT_SIZE_RATIO = 0.8;
|
|
14
|
-
exports.SEGMENT_WIDTH_TO_FONT_SIZE_RATIO = SEGMENT_WIDTH_TO_FONT_SIZE_RATIO;
|
|
1
|
+
export const DEFAULT_FONT_SIZE = 16;
|
|
2
|
+
export const LARGE_FONT_SIZE = 64;
|
|
3
|
+
export const XS_FONT_SIZE = 28;
|
|
4
|
+
export const SEGMENT_WIDTH_TO_FONT_SIZE_RATIO = 0.8;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _default = {
|
|
1
|
+
export default {
|
|
8
2
|
en: {
|
|
9
3
|
days: 'Days',
|
|
10
4
|
day: 'Day',
|
|
@@ -25,5 +19,4 @@ var _default = {
|
|
|
25
19
|
seconds: 'Secondes',
|
|
26
20
|
second: 'Seconde'
|
|
27
21
|
}
|
|
28
|
-
};
|
|
29
|
-
exports.default = _default;
|
|
22
|
+
};
|
package/lib/Countdown/index.js
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _Countdown = _interopRequireDefault(require("./Countdown"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
var _default = _Countdown.default;
|
|
10
|
-
exports.default = _default;
|
|
1
|
+
import Countdown from './Countdown';
|
|
2
|
+
export default Countdown;
|
package/lib/Countdown/types.js
CHANGED
|
@@ -1,34 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
const countdownVariantPropType = _propTypes.default.shape({
|
|
10
|
-
feature: _propTypes.default.bool,
|
|
11
|
-
inverse: _propTypes.default.bool,
|
|
12
|
-
label: _propTypes.default.bool,
|
|
13
|
-
large: _propTypes.default.bool,
|
|
14
|
-
noDivider: _propTypes.default.bool
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
export const countdownVariantPropType = PropTypes.shape({
|
|
3
|
+
feature: PropTypes.bool,
|
|
4
|
+
inverse: PropTypes.bool,
|
|
5
|
+
label: PropTypes.bool,
|
|
6
|
+
large: PropTypes.bool,
|
|
7
|
+
noDivider: PropTypes.bool
|
|
15
8
|
});
|
|
16
9
|
|
|
17
10
|
// If a language dictionary entry is provided, it must contain every key
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
second: _propTypes.default.string.isRequired
|
|
11
|
+
export const dictionaryContentShape = PropTypes.shape({
|
|
12
|
+
days: PropTypes.string.isRequired,
|
|
13
|
+
day: PropTypes.string.isRequired,
|
|
14
|
+
hours: PropTypes.string.isRequired,
|
|
15
|
+
hour: PropTypes.string.isRequired,
|
|
16
|
+
minutes: PropTypes.string.isRequired,
|
|
17
|
+
minute: PropTypes.string.isRequired,
|
|
18
|
+
seconds: PropTypes.string.isRequired,
|
|
19
|
+
second: PropTypes.string.isRequired
|
|
28
20
|
});
|
|
29
|
-
|
|
30
|
-
var _default = {
|
|
21
|
+
export default {
|
|
31
22
|
countdownVariantPropType,
|
|
32
23
|
dictionaryContentShape
|
|
33
|
-
};
|
|
34
|
-
exports.default = _default;
|
|
24
|
+
};
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
8
2
|
const getTimeCounts = countdown => {
|
|
9
3
|
if (countdown <= 0) {
|
|
10
4
|
return [0, 0, 0, 0];
|
|
@@ -20,8 +14,8 @@ const useCountdown = targetTime => {
|
|
|
20
14
|
if (!countdownTime) {
|
|
21
15
|
throw new Error('Invalid target time is provided!');
|
|
22
16
|
}
|
|
23
|
-
const [countdown, setCountdown] =
|
|
24
|
-
|
|
17
|
+
const [countdown, setCountdown] = useState(countdownTime - new Date().getTime());
|
|
18
|
+
useEffect(() => {
|
|
25
19
|
const interval = setInterval(() => {
|
|
26
20
|
setCountdown(countdownTime - new Date().getTime());
|
|
27
21
|
}, 1000);
|
|
@@ -29,5 +23,4 @@ const useCountdown = targetTime => {
|
|
|
29
23
|
}, [countdownTime]);
|
|
30
24
|
return getTimeCounts(countdown);
|
|
31
25
|
};
|
|
32
|
-
|
|
33
|
-
exports.default = _default;
|
|
26
|
+
export default useCountdown;
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import defaultReactDatesCss from './reactDatesCss';
|
|
2
3
|
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
-
var _reactDatesCss = _interopRequireDefault(require("./reactDatesCss"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
4
|
// calendarDayDefaultHeight and calendarDayDefaultWidth
|
|
11
5
|
// refer to circle size when selected, focused, or hovered and is passed with getResponsiveCircleSize in DatePicker
|
|
12
|
-
|
|
6
|
+
|
|
7
|
+
const CalendarContainer = /*#__PURE__*/styled.div.withConfig({
|
|
13
8
|
displayName: "CalendarContainer",
|
|
14
9
|
componentId: "components-web__sc-qdc1tg-0"
|
|
15
10
|
})(_ref => {
|
|
@@ -23,7 +18,7 @@ const CalendarContainer = /*#__PURE__*/_styledComponents.default.div.withConfig(
|
|
|
23
18
|
defaultFontTokens
|
|
24
19
|
} = _ref;
|
|
25
20
|
return `
|
|
26
|
-
${
|
|
21
|
+
${defaultReactDatesCss}
|
|
27
22
|
> div {
|
|
28
23
|
z-index: 1000;
|
|
29
24
|
}
|
|
@@ -210,5 +205,4 @@ const CalendarContainer = /*#__PURE__*/_styledComponents.default.div.withConfig(
|
|
|
210
205
|
}
|
|
211
206
|
`;
|
|
212
207
|
});
|
|
213
|
-
|
|
214
|
-
exports.default = _default;
|
|
208
|
+
export default CalendarContainer;
|