@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,335 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { A11yText, Divider, selectSystemProps, Typography, useThemeTokens, useViewport, getTokensPropType } from '@telus-uds/components-base';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
|
-
import FootnoteLink from '../Footnote/FootnoteLink';
|
|
6
|
-
import getTypographyTokens from './tokens';
|
|
7
|
-
import { htmlAttrs, warn } from '../utils';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
10
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
12
|
-
const PriceLockupContainer = /*#__PURE__*/styled.div.withConfig({
|
|
13
|
-
displayName: "PriceLockup__PriceLockupContainer",
|
|
14
|
-
componentId: "components-web__sc-1x6duay-0"
|
|
15
|
-
})(["align-items:", ";display:flex;flex-direction:column;width:fit-content;"], _ref => {
|
|
16
|
-
let {
|
|
17
|
-
alignItemsText
|
|
18
|
-
} = _ref;
|
|
19
|
-
return alignItemsText;
|
|
20
|
-
});
|
|
21
|
-
const PriceContainer = /*#__PURE__*/styled.div.withConfig({
|
|
22
|
-
displayName: "PriceLockup__PriceContainer",
|
|
23
|
-
componentId: "components-web__sc-1x6duay-1"
|
|
24
|
-
})(["display:flex;margin-bottom:", ";"], _ref2 => {
|
|
25
|
-
let {
|
|
26
|
-
priceMarginBottom
|
|
27
|
-
} = _ref2;
|
|
28
|
-
return priceMarginBottom;
|
|
29
|
-
});
|
|
30
|
-
const FootnoteContainer = /*#__PURE__*/styled.div.withConfig({
|
|
31
|
-
displayName: "PriceLockup__FootnoteContainer",
|
|
32
|
-
componentId: "components-web__sc-1x6duay-2"
|
|
33
|
-
})(["display:flex;margin-top:", ";gap:", ";"], _ref3 => {
|
|
34
|
-
let {
|
|
35
|
-
footnoteMarginTop
|
|
36
|
-
} = _ref3;
|
|
37
|
-
return footnoteMarginTop;
|
|
38
|
-
}, _ref4 => {
|
|
39
|
-
let {
|
|
40
|
-
footnoteGap
|
|
41
|
-
} = _ref4;
|
|
42
|
-
return footnoteGap;
|
|
43
|
-
});
|
|
44
|
-
const BottomTextContainer = /*#__PURE__*/styled.div.withConfig({
|
|
45
|
-
displayName: "PriceLockup__BottomTextContainer",
|
|
46
|
-
componentId: "components-web__sc-1x6duay-3"
|
|
47
|
-
})(["margin-top:", ";"], _ref5 => {
|
|
48
|
-
let {
|
|
49
|
-
bottomTextMarginTop
|
|
50
|
-
} = _ref5;
|
|
51
|
-
return bottomTextMarginTop;
|
|
52
|
-
});
|
|
53
|
-
const BottomLinksContainer = /*#__PURE__*/styled.div.withConfig({
|
|
54
|
-
displayName: "PriceLockup__BottomLinksContainer",
|
|
55
|
-
componentId: "components-web__sc-1x6duay-4"
|
|
56
|
-
})(["align-self:center;margin-left:", ";"], _ref6 => {
|
|
57
|
-
let {
|
|
58
|
-
bottomLinksMarginLeft
|
|
59
|
-
} = _ref6;
|
|
60
|
-
return bottomLinksMarginLeft;
|
|
61
|
-
});
|
|
62
|
-
const TopTextContainer = /*#__PURE__*/styled.div.withConfig({
|
|
63
|
-
displayName: "PriceLockup__TopTextContainer",
|
|
64
|
-
componentId: "components-web__sc-1x6duay-5"
|
|
65
|
-
})(["margin-bottom:", ";"], _ref7 => {
|
|
66
|
-
let {
|
|
67
|
-
topTextMarginBottom
|
|
68
|
-
} = _ref7;
|
|
69
|
-
return topTextMarginBottom;
|
|
70
|
-
});
|
|
71
|
-
const PriceTextContainer = /*#__PURE__*/styled.div.withConfig({
|
|
72
|
-
displayName: "PriceLockup__PriceTextContainer",
|
|
73
|
-
componentId: "components-web__sc-1x6duay-6"
|
|
74
|
-
})(["display:flex;flex-direction:", ";"], _ref8 => {
|
|
75
|
-
let {
|
|
76
|
-
ratePosition
|
|
77
|
-
} = _ref8;
|
|
78
|
-
return ratePosition === 'bottom' ? 'column' : 'row';
|
|
79
|
-
});
|
|
80
|
-
const RateContainer = /*#__PURE__*/styled.div.withConfig({
|
|
81
|
-
displayName: "PriceLockup__RateContainer",
|
|
82
|
-
componentId: "components-web__sc-1x6duay-7"
|
|
83
|
-
})(["display:flex;"]);
|
|
84
|
-
const RateTextContainer = /*#__PURE__*/styled.div.withConfig({
|
|
85
|
-
displayName: "PriceLockup__RateTextContainer",
|
|
86
|
-
componentId: "components-web__sc-1x6duay-8"
|
|
87
|
-
})(["align-self:", ";"], _ref9 => {
|
|
88
|
-
let {
|
|
89
|
-
ratePosition
|
|
90
|
-
} = _ref9;
|
|
91
|
-
return ratePosition === 'bottom' ? 'flex-start' : 'flex-end';
|
|
92
|
-
});
|
|
93
|
-
const StrikeThroughContainer = /*#__PURE__*/styled.div.withConfig({
|
|
94
|
-
displayName: "PriceLockup__StrikeThroughContainer",
|
|
95
|
-
componentId: "components-web__sc-1x6duay-9"
|
|
96
|
-
})(["display:flex;position:relative;align-items:center;::before{content:'';width:100%;top:", ";height:", ";background:", ";position:absolute;}"], _ref10 => {
|
|
97
|
-
let {
|
|
98
|
-
strikeThroughPosition
|
|
99
|
-
} = _ref10;
|
|
100
|
-
return `${strikeThroughPosition}px`;
|
|
101
|
-
}, _ref11 => {
|
|
102
|
-
let {
|
|
103
|
-
strikeThroughHeight
|
|
104
|
-
} = _ref11;
|
|
105
|
-
return `${strikeThroughHeight}px`;
|
|
106
|
-
}, _ref12 => {
|
|
107
|
-
let {
|
|
108
|
-
strikeThroughColor
|
|
109
|
-
} = _ref12;
|
|
110
|
-
return strikeThroughColor;
|
|
111
|
-
});
|
|
112
|
-
const selectFootnoteLinkStyles = _ref13 => {
|
|
113
|
-
let {
|
|
114
|
-
footnoteLinkColor,
|
|
115
|
-
footnoteLinkFontName,
|
|
116
|
-
footnoteLinkFontWeight,
|
|
117
|
-
footnoteLinkLineHeight
|
|
118
|
-
} = _ref13;
|
|
119
|
-
return {
|
|
120
|
-
color: footnoteLinkColor,
|
|
121
|
-
fontName: footnoteLinkFontName,
|
|
122
|
-
fontWeight: footnoteLinkFontWeight,
|
|
123
|
-
lineHeight: footnoteLinkLineHeight
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
const selectStrikeThroughTokens = _ref14 => {
|
|
127
|
-
let {
|
|
128
|
-
strikeThroughPosition,
|
|
129
|
-
strikeThroughHeight,
|
|
130
|
-
strikeThroughColor
|
|
131
|
-
} = _ref14;
|
|
132
|
-
return {
|
|
133
|
-
strikeThroughHeight,
|
|
134
|
-
strikeThroughPosition,
|
|
135
|
-
strikeThroughColor
|
|
136
|
-
};
|
|
137
|
-
};
|
|
138
|
-
const PriceLockup = /*#__PURE__*/React.forwardRef((_ref15, ref) => {
|
|
139
|
-
let {
|
|
140
|
-
size = 'medium',
|
|
141
|
-
signDirection = 'left',
|
|
142
|
-
footnoteLinks = [],
|
|
143
|
-
topText,
|
|
144
|
-
price,
|
|
145
|
-
currencySymbol = '$',
|
|
146
|
-
rateText,
|
|
147
|
-
ratePosition = 'right',
|
|
148
|
-
bottomText,
|
|
149
|
-
onClickFootnote,
|
|
150
|
-
strikeThrough,
|
|
151
|
-
a11yText,
|
|
152
|
-
tokens: priceLockupTokens,
|
|
153
|
-
variant = {},
|
|
154
|
-
...rest
|
|
155
|
-
} = _ref15;
|
|
156
|
-
const viewport = useViewport();
|
|
157
|
-
const {
|
|
158
|
-
footnoteMarginTop,
|
|
159
|
-
footnoteGap,
|
|
160
|
-
bottomTextMarginTop,
|
|
161
|
-
priceMarginBottom,
|
|
162
|
-
bottomLinksMarginLeft,
|
|
163
|
-
topTextMarginBottom,
|
|
164
|
-
fontColor,
|
|
165
|
-
dividerColor,
|
|
166
|
-
footnoteLinkFontSize,
|
|
167
|
-
alignItemsText,
|
|
168
|
-
...themeTokens
|
|
169
|
-
} = useThemeTokens('PriceLockup', priceLockupTokens, {
|
|
170
|
-
...variant,
|
|
171
|
-
size
|
|
172
|
-
}, {
|
|
173
|
-
viewport,
|
|
174
|
-
strikeThrough
|
|
175
|
-
});
|
|
176
|
-
const typographyTokens = getTypographyTokens(themeTokens);
|
|
177
|
-
const priceString = String(price);
|
|
178
|
-
const lastDotPosition = priceString.lastIndexOf('.');
|
|
179
|
-
const lastCommaPosition = priceString.lastIndexOf(',');
|
|
180
|
-
const [separator, separatorPosition] = lastDotPosition > lastCommaPosition ? ['.', lastDotPosition] : [',', lastCommaPosition];
|
|
181
|
-
|
|
182
|
-
// If the separator is at the fourth character from the end of the string or more, it's most probably
|
|
183
|
-
// a part of the amount, and the cents are not included in the price string
|
|
184
|
-
const hasCents = separatorPosition !== -1 && separatorPosition >= priceString.length - 3;
|
|
185
|
-
const amount = hasCents ? priceString.substring(0, separatorPosition) : priceString;
|
|
186
|
-
const cents = hasCents ? priceString.substring(separatorPosition + 1) : null;
|
|
187
|
-
const renderTypography = (value, tokens, position) => {
|
|
188
|
-
const customProps = position === 'bottom' ? {
|
|
189
|
-
variant: {
|
|
190
|
-
size: 'micro'
|
|
191
|
-
},
|
|
192
|
-
tokens: {
|
|
193
|
-
color: fontColor
|
|
194
|
-
}
|
|
195
|
-
} : {
|
|
196
|
-
tokens: {
|
|
197
|
-
...tokens,
|
|
198
|
-
color: fontColor
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
return /*#__PURE__*/_jsx(Typography, {
|
|
202
|
-
...customProps,
|
|
203
|
-
children: value
|
|
204
|
-
});
|
|
205
|
-
};
|
|
206
|
-
const renderCurrencySymbol = () => renderTypography(`${currencySymbol}`, typographyTokens.dollarSign);
|
|
207
|
-
const renderFootnoteLinks = () => footnoteLinks && footnoteLinks.length > 0 ? /*#__PURE__*/_jsx(FootnoteLink, {
|
|
208
|
-
fontSize: footnoteLinkFontSize,
|
|
209
|
-
tokens: selectFootnoteLinkStyles(themeTokens),
|
|
210
|
-
number: footnoteLinks,
|
|
211
|
-
onClick: onClickFootnote
|
|
212
|
-
}) : null;
|
|
213
|
-
const renderAmount = () => {
|
|
214
|
-
const amountComponent = renderTypography(amount, typographyTokens.amount);
|
|
215
|
-
if (strikeThrough) {
|
|
216
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
217
|
-
children: [/*#__PURE__*/_jsx(A11yText, {
|
|
218
|
-
text: a11yText
|
|
219
|
-
}), /*#__PURE__*/_jsx(StrikeThroughContainer, {
|
|
220
|
-
...selectStrikeThroughTokens(themeTokens),
|
|
221
|
-
children: amountComponent
|
|
222
|
-
})]
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
return amountComponent;
|
|
226
|
-
};
|
|
227
|
-
const renderPrice = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
228
|
-
children: [/*#__PURE__*/_jsxs(PriceContainer, {
|
|
229
|
-
priceMarginBottom: `${priceMarginBottom}px`,
|
|
230
|
-
children: [/*#__PURE__*/_jsxs(PriceTextContainer, {
|
|
231
|
-
ratePosition: ratePosition,
|
|
232
|
-
children: [/*#__PURE__*/_jsxs(RateContainer, {
|
|
233
|
-
children: [signDirection === 'left' && renderCurrencySymbol(), renderAmount(), cents && renderTypography(`${separator}${cents}`, typographyTokens.cents), signDirection === 'right' && /*#__PURE__*/_jsxs(_Fragment, {
|
|
234
|
-
children: ["\xA0", renderCurrencySymbol()]
|
|
235
|
-
})]
|
|
236
|
-
}), rateText && /*#__PURE__*/_jsx(RateTextContainer, {
|
|
237
|
-
ratePosition: ratePosition,
|
|
238
|
-
children: renderTypography(rateText, typographyTokens.rate, ratePosition)
|
|
239
|
-
})]
|
|
240
|
-
}), !bottomText && footnoteLinks.length <= 3 && /*#__PURE__*/_jsx(BottomLinksContainer, {
|
|
241
|
-
bottomLinksMarginLeft: `${bottomLinksMarginLeft}px`,
|
|
242
|
-
children: renderFootnoteLinks()
|
|
243
|
-
})]
|
|
244
|
-
}), !bottomText && footnoteLinks.length > 3 && renderFootnoteLinks()]
|
|
245
|
-
});
|
|
246
|
-
const renderFootnoteContent = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
247
|
-
children: [/*#__PURE__*/_jsxs(FootnoteContainer, {
|
|
248
|
-
footnoteMarginTop: `${footnoteMarginTop}px`,
|
|
249
|
-
footnoteGap: `${footnoteGap}px`,
|
|
250
|
-
children: [/*#__PURE__*/_jsx(BottomTextContainer, {
|
|
251
|
-
bottomTextMarginTop: `${bottomTextMarginTop}px`,
|
|
252
|
-
children: renderTypography(bottomText, typographyTokens.bottomText)
|
|
253
|
-
}), footnoteLinks.length <= 3 && renderFootnoteLinks()]
|
|
254
|
-
}), footnoteLinks.length > 3 && renderFootnoteLinks()]
|
|
255
|
-
});
|
|
256
|
-
if (strikeThrough && !a11yText) {
|
|
257
|
-
warn('PriceLockup', 'a11yText must be provided with strikethrough pricing');
|
|
258
|
-
}
|
|
259
|
-
return /*#__PURE__*/_jsxs(PriceLockupContainer, {
|
|
260
|
-
...selectProps(rest),
|
|
261
|
-
alignItemsText: alignItemsText,
|
|
262
|
-
ref: ref,
|
|
263
|
-
children: [topText && /*#__PURE__*/_jsx(TopTextContainer, {
|
|
264
|
-
topTextMarginBottom: `${topTextMarginBottom}px`,
|
|
265
|
-
children: renderTypography(topText, typographyTokens.topText)
|
|
266
|
-
}), renderPrice(), bottomText && /*#__PURE__*/_jsx(Divider, {
|
|
267
|
-
testID: "price-lockup-divider",
|
|
268
|
-
role: "separator",
|
|
269
|
-
tokens: {
|
|
270
|
-
color: dividerColor ?? 'rgba(0, 0, 0, 0)'
|
|
271
|
-
}
|
|
272
|
-
}), bottomText && renderFootnoteContent()]
|
|
273
|
-
});
|
|
274
|
-
});
|
|
275
|
-
PriceLockup.displayName = 'PriceLockup';
|
|
276
|
-
PriceLockup.propTypes = {
|
|
277
|
-
...selectedSystemPropTypes,
|
|
278
|
-
/**
|
|
279
|
-
* Size of the component
|
|
280
|
-
*
|
|
281
|
-
* Micro for mini cart pricing, small for pricing in product catalogue pages, medium for pricing in product comparison cards and large for pricing in banners and promo cards
|
|
282
|
-
*/
|
|
283
|
-
size: PropTypes.oneOf(['micro', 'small', 'medium', 'large']),
|
|
284
|
-
/**
|
|
285
|
-
* If currency symbol other than `$` to be used
|
|
286
|
-
*/
|
|
287
|
-
currencySymbol: PropTypes.string,
|
|
288
|
-
/**
|
|
289
|
-
* Shows additional info above the price
|
|
290
|
-
*/
|
|
291
|
-
topText: PropTypes.string,
|
|
292
|
-
/**
|
|
293
|
-
* Monetary value (including decimals separated by ".")
|
|
294
|
-
*/
|
|
295
|
-
price: PropTypes.string.isRequired,
|
|
296
|
-
/**
|
|
297
|
-
* Shows month/year unit
|
|
298
|
-
*/
|
|
299
|
-
rateText: PropTypes.string,
|
|
300
|
-
/**
|
|
301
|
-
* Shows additional info below the price with a `Divider`
|
|
302
|
-
*/
|
|
303
|
-
bottomText: PropTypes.string,
|
|
304
|
-
/**
|
|
305
|
-
* Displays which side the currency should apperar (left, right)
|
|
306
|
-
*/
|
|
307
|
-
signDirection: PropTypes.oneOf(['right', 'left']),
|
|
308
|
-
/**
|
|
309
|
-
* Displays where the rate should apperar (bottom, right)
|
|
310
|
-
*/
|
|
311
|
-
ratePosition: PropTypes.oneOf(['right', 'bottom']),
|
|
312
|
-
/**
|
|
313
|
-
* Shows additional link for context
|
|
314
|
-
*/
|
|
315
|
-
footnoteLinks: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
|
|
316
|
-
/**
|
|
317
|
-
* Function to be called when a footnote link is clicked
|
|
318
|
-
*/
|
|
319
|
-
onClickFootnote: PropTypes.func,
|
|
320
|
-
/**
|
|
321
|
-
* To show price savings comparison
|
|
322
|
-
*/
|
|
323
|
-
strikeThrough: PropTypes.bool,
|
|
324
|
-
/**
|
|
325
|
-
* To provide a11y text for `PriceLockup` component
|
|
326
|
-
*
|
|
327
|
-
* **Note:** a11yText will override strikethrough price, so it must include price (ie. "was 50 dollars per month")
|
|
328
|
-
*/
|
|
329
|
-
a11yText: PropTypes.string,
|
|
330
|
-
/**
|
|
331
|
-
* `PriceLockup` tokens
|
|
332
|
-
*/
|
|
333
|
-
tokens: getTokensPropType('PriceLockup')
|
|
334
|
-
};
|
|
335
|
-
export default PriceLockup;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// map typography tokens accordenly
|
|
2
|
-
export default (_ref => {
|
|
3
|
-
let {
|
|
4
|
-
topTextFontSize,
|
|
5
|
-
fontColor,
|
|
6
|
-
topTextLineHeight,
|
|
7
|
-
currencySymbolFontSize,
|
|
8
|
-
currencySymbolLineHeight,
|
|
9
|
-
currencySymbolFontWeight,
|
|
10
|
-
amountFontSize,
|
|
11
|
-
amountLineHeight,
|
|
12
|
-
amountLetterSpacing,
|
|
13
|
-
amountFontWeight,
|
|
14
|
-
centsFontSize,
|
|
15
|
-
centsLineHeight,
|
|
16
|
-
rateFontSize,
|
|
17
|
-
rateLineHeight,
|
|
18
|
-
bottomTextFontSize,
|
|
19
|
-
bottomTextLineHeight,
|
|
20
|
-
rateFontWeight,
|
|
21
|
-
centsFontWeight
|
|
22
|
-
} = _ref;
|
|
23
|
-
return {
|
|
24
|
-
topText: {
|
|
25
|
-
fontSize: topTextFontSize,
|
|
26
|
-
lineHeight: topTextLineHeight
|
|
27
|
-
},
|
|
28
|
-
dollarSign: {
|
|
29
|
-
fontSize: currencySymbolFontSize,
|
|
30
|
-
lineHeight: currencySymbolLineHeight,
|
|
31
|
-
fontWeight: currencySymbolFontWeight
|
|
32
|
-
},
|
|
33
|
-
amount: {
|
|
34
|
-
color: fontColor,
|
|
35
|
-
fontSize: amountFontSize,
|
|
36
|
-
lineHeight: amountLineHeight,
|
|
37
|
-
letterSpacing: amountLetterSpacing,
|
|
38
|
-
fontWeight: amountFontWeight
|
|
39
|
-
},
|
|
40
|
-
cents: {
|
|
41
|
-
fontSize: centsFontSize,
|
|
42
|
-
lineHeight: centsLineHeight,
|
|
43
|
-
fontWeight: centsFontWeight
|
|
44
|
-
},
|
|
45
|
-
rate: {
|
|
46
|
-
fontSize: rateFontSize,
|
|
47
|
-
lineHeight: rateLineHeight,
|
|
48
|
-
fontWeight: rateFontWeight
|
|
49
|
-
},
|
|
50
|
-
bottomText: {
|
|
51
|
-
fontSize: bottomTextFontSize,
|
|
52
|
-
lineHeight: bottomTextLineHeight
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
});
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { getTokensPropType, Progress, selectSystemProps, useThemeTokens, a11yProps, viewProps, variantProp, applyShadowToken } from '@telus-uds/components-base';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
|
-
|
|
6
|
-
// Passes React Native-oriented system props through UDS Progress
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
9
|
-
const {
|
|
10
|
-
Bar: ProgressBarBase
|
|
11
|
-
} = Progress;
|
|
12
|
-
const Gradient = /*#__PURE__*/styled.div.attrs({
|
|
13
|
-
'data-testid': 'ProgressBar-Gradient'
|
|
14
|
-
}).withConfig({
|
|
15
|
-
displayName: "ProgressBar__Gradient",
|
|
16
|
-
componentId: "components-web__sc-1vmzyq5-0"
|
|
17
|
-
})(_ref => {
|
|
18
|
-
let {
|
|
19
|
-
gradient: {
|
|
20
|
-
angle,
|
|
21
|
-
stops,
|
|
22
|
-
type
|
|
23
|
-
},
|
|
24
|
-
borderRadius,
|
|
25
|
-
shadow
|
|
26
|
-
} = _ref;
|
|
27
|
-
return {
|
|
28
|
-
height: '100%',
|
|
29
|
-
width: '100%',
|
|
30
|
-
background: `${type}-gradient(${angle}deg, ${stops[0].color}, ${stops[1].color})`,
|
|
31
|
-
borderRadius,
|
|
32
|
-
...applyShadowToken(shadow)
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The `ProgressBar` is a visual representation of linear progression.
|
|
38
|
-
* It provides simple but important information at a quick glance.
|
|
39
|
-
* This is a Web-specific progress bar.
|
|
40
|
-
*
|
|
41
|
-
* ## Component API
|
|
42
|
-
*
|
|
43
|
-
* Use props and tokens from the base ProgressBar component. The difference is that the
|
|
44
|
-
* `gradient` is being used here to provide gradient filling.
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
|
-
const ProgressBar = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
48
|
-
let {
|
|
49
|
-
percentage,
|
|
50
|
-
tokens,
|
|
51
|
-
variant,
|
|
52
|
-
...rest
|
|
53
|
-
} = _ref2;
|
|
54
|
-
const themeTokens = useThemeTokens('ProgressBar', tokens, variant);
|
|
55
|
-
const selectedProps = selectProps(rest);
|
|
56
|
-
return /*#__PURE__*/_jsx(ProgressBarBase, {
|
|
57
|
-
percentage: percentage,
|
|
58
|
-
tokens: tokens,
|
|
59
|
-
variant: variant,
|
|
60
|
-
ref: ref,
|
|
61
|
-
...selectedProps,
|
|
62
|
-
children: themeTokens.gradient && /*#__PURE__*/_jsx(Gradient, {
|
|
63
|
-
...themeTokens
|
|
64
|
-
})
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
ProgressBar.displayName = 'ProgressBar';
|
|
68
|
-
ProgressBar.propTypes = {
|
|
69
|
-
...selectedSystemPropTypes,
|
|
70
|
-
/**
|
|
71
|
-
* Percentage of completion.
|
|
72
|
-
*/
|
|
73
|
-
percentage: PropTypes.number,
|
|
74
|
-
/**
|
|
75
|
-
* ProgressBar tokens.
|
|
76
|
-
*/
|
|
77
|
-
tokens: getTokensPropType('ProgressBar'),
|
|
78
|
-
/**
|
|
79
|
-
* ProgressBar variant.
|
|
80
|
-
*/
|
|
81
|
-
variant: variantProp.propType
|
|
82
|
-
};
|
|
83
|
-
export default ProgressBar;
|