@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,261 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Box, TextInput, Spacer, Feedback, InputLabel, useInputValue, useCopy, useThemeTokensCallback, getTokensPropType, selectSystemProps, a11yProps } from '@telus-uds/components-base';
|
|
4
|
-
import { htmlAttrs } from '../utils';
|
|
5
|
-
import { InputField, InputWrapper } from './styles';
|
|
6
|
-
import defaultDictionary from './dictionary';
|
|
7
|
-
import SideButton from './SideButton';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
const {
|
|
11
|
-
isNaN
|
|
12
|
-
} = Number;
|
|
13
|
-
const isNumber = value => {
|
|
14
|
-
return typeof value === 'number' && !isNaN(value);
|
|
15
|
-
};
|
|
16
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, htmlAttrs]);
|
|
17
|
-
const QuantitySelector = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
18
|
-
let {
|
|
19
|
-
id = 'quantity-selector',
|
|
20
|
-
minNumber,
|
|
21
|
-
maxNumber,
|
|
22
|
-
defaultValue,
|
|
23
|
-
value,
|
|
24
|
-
label,
|
|
25
|
-
hint,
|
|
26
|
-
hintPosition = 'inline',
|
|
27
|
-
tooltip,
|
|
28
|
-
onChange,
|
|
29
|
-
dictionary = defaultDictionary,
|
|
30
|
-
accessibilityLabel,
|
|
31
|
-
copy = 'en',
|
|
32
|
-
variant = {
|
|
33
|
-
alternative: false
|
|
34
|
-
},
|
|
35
|
-
tokens,
|
|
36
|
-
testID = 'quantity-selector-testid',
|
|
37
|
-
...rest
|
|
38
|
-
} = _ref;
|
|
39
|
-
const {
|
|
40
|
-
disabled
|
|
41
|
-
} = variant;
|
|
42
|
-
const [error, setError] = React.useState('');
|
|
43
|
-
const getCopy = useCopy({
|
|
44
|
-
dictionary,
|
|
45
|
-
copy
|
|
46
|
-
});
|
|
47
|
-
const getValidatedNumber = numberToEvaluate => {
|
|
48
|
-
if (isNaN(numberToEvaluate)) return null;
|
|
49
|
-
if (isNumber(minNumber) && numberToEvaluate < minNumber) throw getCopy('errors').numberIsTooSmall(minNumber);
|
|
50
|
-
if (isNumber(maxNumber) && numberToEvaluate > maxNumber) throw getCopy('errors').numberIsTooBig(maxNumber);
|
|
51
|
-
return numberToEvaluate;
|
|
52
|
-
};
|
|
53
|
-
const {
|
|
54
|
-
currentValue: number,
|
|
55
|
-
setValue: setNumber
|
|
56
|
-
} = useInputValue({
|
|
57
|
-
value: getValidatedNumber(value),
|
|
58
|
-
initialValue: getValidatedNumber(defaultValue),
|
|
59
|
-
onChange
|
|
60
|
-
});
|
|
61
|
-
const isDecreaseEnabled = !disabled && !isNumber(minNumber) || number > minNumber;
|
|
62
|
-
const isIncreaseEnabled = !disabled && !isNumber(maxNumber) || number < maxNumber;
|
|
63
|
-
const inputValue = isNumber(number) ? number.toString() : '';
|
|
64
|
-
const updateNumber = (newNumber, originalInputEvent) => {
|
|
65
|
-
try {
|
|
66
|
-
const validatedNumber = getValidatedNumber(newNumber);
|
|
67
|
-
setNumber(validatedNumber, originalInputEvent);
|
|
68
|
-
setError('');
|
|
69
|
-
} catch (e) {
|
|
70
|
-
setError(e);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
const inputChangeHandler = (textInputValue, event) => {
|
|
74
|
-
if (textInputValue === '') setNumber(null);
|
|
75
|
-
const numberFromTextInput = Number(textInputValue);
|
|
76
|
-
if (isNumber(numberFromTextInput)) {
|
|
77
|
-
updateNumber(numberFromTextInput, event);
|
|
78
|
-
} else {
|
|
79
|
-
setError(getCopy('errors').invalidCharacters);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
const renderLabel = () => label ? /*#__PURE__*/_jsx(InputLabel, {
|
|
83
|
-
forId: id,
|
|
84
|
-
label: label,
|
|
85
|
-
hint: hint,
|
|
86
|
-
hintPosition: hintPosition,
|
|
87
|
-
tooltip: tooltip
|
|
88
|
-
}) : null;
|
|
89
|
-
const getTokens = useThemeTokensCallback('QuantitySelector', tokens, variant);
|
|
90
|
-
const renderTextInput = () => /*#__PURE__*/_jsx(TextInput, {
|
|
91
|
-
nativeID: id,
|
|
92
|
-
value: inputValue,
|
|
93
|
-
defaultValue: defaultValue,
|
|
94
|
-
tokens: textInputState => {
|
|
95
|
-
const {
|
|
96
|
-
inputWidth,
|
|
97
|
-
inputBorderWidth,
|
|
98
|
-
inputBorderColor,
|
|
99
|
-
textColor,
|
|
100
|
-
inputBackgroundColor,
|
|
101
|
-
...restOfTokens
|
|
102
|
-
} = getTokens({
|
|
103
|
-
...textInputState
|
|
104
|
-
});
|
|
105
|
-
return {
|
|
106
|
-
...restOfTokens,
|
|
107
|
-
order: 1,
|
|
108
|
-
borderWidth: inputBorderWidth,
|
|
109
|
-
backgroundColor: inputBackgroundColor,
|
|
110
|
-
color: textColor,
|
|
111
|
-
width: inputWidth,
|
|
112
|
-
borderColor: inputBorderColor,
|
|
113
|
-
borderRadius: 0,
|
|
114
|
-
outerBorderWidth: 0
|
|
115
|
-
};
|
|
116
|
-
},
|
|
117
|
-
onChange: inputChangeHandler
|
|
118
|
-
// Using title as an accessibility workaround
|
|
119
|
-
// given that accessibilityLabel is not available
|
|
120
|
-
,
|
|
121
|
-
keyboardType: "numeric",
|
|
122
|
-
accessibilityLabel: accessibilityLabel ?? getCopy('accessibility').a11yLabel,
|
|
123
|
-
accessibilityRole: "spinbutton",
|
|
124
|
-
accessibilityValueMax: maxNumber,
|
|
125
|
-
accessibilityValueMin: minNumber,
|
|
126
|
-
accessibilityValueNow: number
|
|
127
|
-
});
|
|
128
|
-
const flexOrder = order => ({
|
|
129
|
-
order
|
|
130
|
-
});
|
|
131
|
-
return /*#__PURE__*/_jsxs(Box, {
|
|
132
|
-
testID: testID,
|
|
133
|
-
ref: ref,
|
|
134
|
-
...selectProps(rest),
|
|
135
|
-
children: [renderLabel(), /*#__PURE__*/_jsx(Spacer, {
|
|
136
|
-
space: 2
|
|
137
|
-
}), /*#__PURE__*/_jsxs(InputWrapper, {
|
|
138
|
-
children: [/*#__PURE__*/_jsx(InputField, {
|
|
139
|
-
children: renderTextInput()
|
|
140
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
141
|
-
style: flexOrder(0),
|
|
142
|
-
children: /*#__PURE__*/_jsx(SideButton, {
|
|
143
|
-
isEnabled: isDecreaseEnabled,
|
|
144
|
-
onPress: () => updateNumber(number - 1),
|
|
145
|
-
onDoubleClick: () => updateNumber(number - 1),
|
|
146
|
-
tokens: tokens,
|
|
147
|
-
variant: {
|
|
148
|
-
decrease: true,
|
|
149
|
-
...variant
|
|
150
|
-
},
|
|
151
|
-
accessibilityLabel: getCopy('accessibility').decreaseButton,
|
|
152
|
-
accessibilityDisabled: !isDecreaseEnabled
|
|
153
|
-
})
|
|
154
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
155
|
-
style: flexOrder(2),
|
|
156
|
-
children: /*#__PURE__*/_jsx(SideButton, {
|
|
157
|
-
isEnabled: isIncreaseEnabled,
|
|
158
|
-
onPress: () => updateNumber(number + 1),
|
|
159
|
-
onDoubleClick: () => updateNumber(number + 1),
|
|
160
|
-
accessibilityLabel: getCopy('accessibility').increaseButton,
|
|
161
|
-
accessibilityDisabled: !isIncreaseEnabled,
|
|
162
|
-
tokens: tokens,
|
|
163
|
-
variant: {
|
|
164
|
-
increase: true,
|
|
165
|
-
...variant
|
|
166
|
-
}
|
|
167
|
-
})
|
|
168
|
-
})]
|
|
169
|
-
}), error ? /*#__PURE__*/_jsx(Box, {
|
|
170
|
-
vertical: 2,
|
|
171
|
-
children: /*#__PURE__*/_jsx(Feedback, {
|
|
172
|
-
validation: "error",
|
|
173
|
-
children: error
|
|
174
|
-
})
|
|
175
|
-
}) : null]
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
// If a language dictionary entry is provided, it must contain every key
|
|
180
|
-
const dictionaryContentShape = PropTypes.shape({
|
|
181
|
-
accessibility: PropTypes.shape({
|
|
182
|
-
a11yLabel: PropTypes.string.isRequired,
|
|
183
|
-
increaseButton: PropTypes.string.isRequired,
|
|
184
|
-
decreaseButton: PropTypes.string.isRequired
|
|
185
|
-
}).isRequired,
|
|
186
|
-
errors: PropTypes.shape({
|
|
187
|
-
numberIsTooSmall: PropTypes.func.isRequired,
|
|
188
|
-
numberIsTooBig: PropTypes.func.isRequired,
|
|
189
|
-
invalidCharacters: PropTypes.string.isRequired
|
|
190
|
-
}).isRequired
|
|
191
|
-
});
|
|
192
|
-
QuantitySelector.displayName = 'QuantitySelector';
|
|
193
|
-
QuantitySelector.propTypes = {
|
|
194
|
-
...selectedSystemPropTypes,
|
|
195
|
-
/**
|
|
196
|
-
* The id of the input field
|
|
197
|
-
*/
|
|
198
|
-
id: PropTypes.string,
|
|
199
|
-
/**
|
|
200
|
-
* The minimum number allowed
|
|
201
|
-
*/
|
|
202
|
-
minNumber: PropTypes.number,
|
|
203
|
-
/**
|
|
204
|
-
* The maximum number allowed
|
|
205
|
-
*/
|
|
206
|
-
maxNumber: PropTypes.number,
|
|
207
|
-
/**
|
|
208
|
-
* The callback function that is called when the value of the input field changes
|
|
209
|
-
*/
|
|
210
|
-
onChange: PropTypes.func,
|
|
211
|
-
/**
|
|
212
|
-
* The default value of the input field
|
|
213
|
-
*/
|
|
214
|
-
defaultValue: PropTypes.number,
|
|
215
|
-
/**
|
|
216
|
-
* If the input's state is to be controlled by a parent component, use this prop
|
|
217
|
-
* together with the `onChange` to pass down and update the lifted state.
|
|
218
|
-
*/
|
|
219
|
-
value: PropTypes.number,
|
|
220
|
-
/**
|
|
221
|
-
* The label of the input field
|
|
222
|
-
*/
|
|
223
|
-
label: PropTypes.string,
|
|
224
|
-
/**
|
|
225
|
-
* The hint of the input field
|
|
226
|
-
*/
|
|
227
|
-
hint: PropTypes.string,
|
|
228
|
-
/**
|
|
229
|
-
* The position of the hint. Could be shown along side the label or below it
|
|
230
|
-
*/
|
|
231
|
-
hintPosition: PropTypes.oneOf(['inline', 'below']),
|
|
232
|
-
/**
|
|
233
|
-
* Adds a question mark which will display a tooltip when clicked
|
|
234
|
-
*/
|
|
235
|
-
tooltip: PropTypes.string,
|
|
236
|
-
/**
|
|
237
|
-
* The accessibility label of the input field
|
|
238
|
-
*/
|
|
239
|
-
accessibilityLabel: PropTypes.string,
|
|
240
|
-
/**
|
|
241
|
-
* The dictionary object containing the content for the input field
|
|
242
|
-
*/
|
|
243
|
-
dictionary: PropTypes.shape({
|
|
244
|
-
en: dictionaryContentShape,
|
|
245
|
-
fr: dictionaryContentShape
|
|
246
|
-
}),
|
|
247
|
-
/**
|
|
248
|
-
* The language to use for the copy.
|
|
249
|
-
*/
|
|
250
|
-
copy: PropTypes.oneOfType([PropTypes.oneOf(['en', 'fr'])]),
|
|
251
|
-
variant: PropTypes.exact({
|
|
252
|
-
alternative: PropTypes.bool,
|
|
253
|
-
disabled: PropTypes.bool
|
|
254
|
-
}),
|
|
255
|
-
tokens: getTokensPropType('QuantitySelector'),
|
|
256
|
-
/**
|
|
257
|
-
* Sets `data-testid` attribute on the input field for testing purposes.
|
|
258
|
-
*/
|
|
259
|
-
testID: PropTypes.string
|
|
260
|
-
};
|
|
261
|
-
export default QuantitySelector;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { IconButton, getTokensPropType, useThemeTokensCallback } from '@telus-uds/components-base';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
const SideButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
6
|
-
let {
|
|
7
|
-
isEnabled = true,
|
|
8
|
-
onPress = () => {},
|
|
9
|
-
onDoubleClick = () => {},
|
|
10
|
-
accessibilityLabel = '',
|
|
11
|
-
accessibilityDisabled = false,
|
|
12
|
-
tokens = {},
|
|
13
|
-
variant = {}
|
|
14
|
-
} = _ref;
|
|
15
|
-
const getTokens = useThemeTokensCallback('QuantitySelectorSideButton', tokens, variant);
|
|
16
|
-
const getButtonTokens = _ref2 => {
|
|
17
|
-
let {
|
|
18
|
-
buttonState,
|
|
19
|
-
disabled
|
|
20
|
-
} = _ref2;
|
|
21
|
-
const {
|
|
22
|
-
borderRadius,
|
|
23
|
-
borderTopLeftRadius,
|
|
24
|
-
borderTopRightRadius,
|
|
25
|
-
borderBottomLeftRadius,
|
|
26
|
-
borderBottomRightRadius,
|
|
27
|
-
...rest
|
|
28
|
-
} = getTokens({
|
|
29
|
-
...buttonState,
|
|
30
|
-
disabled
|
|
31
|
-
});
|
|
32
|
-
return {
|
|
33
|
-
...rest,
|
|
34
|
-
borderRadius,
|
|
35
|
-
borderTopLeftRadius,
|
|
36
|
-
borderTopRightRadius,
|
|
37
|
-
borderBottomLeftRadius,
|
|
38
|
-
borderBottomRightRadius,
|
|
39
|
-
outerBorderRadius: borderRadius,
|
|
40
|
-
outerBorderTopLeftRadius: borderTopLeftRadius,
|
|
41
|
-
outerBorderTopRightRadius: borderTopRightRadius,
|
|
42
|
-
outerBorderBottomLeftRadius: borderBottomLeftRadius,
|
|
43
|
-
outerBorderBottomRightRadius: borderBottomRightRadius,
|
|
44
|
-
outerBorderGap: 0,
|
|
45
|
-
outerBorderWidth: 0
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
return /*#__PURE__*/_jsx(IconButton, {
|
|
49
|
-
tokens: buttonState => getButtonTokens({
|
|
50
|
-
disabled: !isEnabled,
|
|
51
|
-
buttonState
|
|
52
|
-
}),
|
|
53
|
-
onPress: onPress,
|
|
54
|
-
onDoubleClick: onDoubleClick,
|
|
55
|
-
accessibilityLabel: accessibilityLabel,
|
|
56
|
-
accessibilityDisabled: accessibilityDisabled,
|
|
57
|
-
ref: ref
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
SideButton.displayName = 'QuantitySelectorSideButton';
|
|
61
|
-
SideButton.propTypes = {
|
|
62
|
-
isEnabled: PropTypes.bool,
|
|
63
|
-
onPress: PropTypes.func,
|
|
64
|
-
onDoubleClick: PropTypes.func,
|
|
65
|
-
accessibilityLabel: PropTypes.string,
|
|
66
|
-
accessibilityDisabled: PropTypes.bool,
|
|
67
|
-
tokens: getTokensPropType('QuantitySelectorSideButton'),
|
|
68
|
-
variant: PropTypes.object
|
|
69
|
-
};
|
|
70
|
-
export default SideButton;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
en: {
|
|
3
|
-
accessibility: {
|
|
4
|
-
a11yLabel: 'Quantity selector',
|
|
5
|
-
increaseButton: 'Increase quantity',
|
|
6
|
-
decreaseButton: 'Decrease quantity'
|
|
7
|
-
},
|
|
8
|
-
errors: {
|
|
9
|
-
numberIsTooSmall: minNumber => `You can enter a number equal or greater than ${minNumber}.`,
|
|
10
|
-
numberIsTooBig: maxNumber => `You can enter a number equal or less than ${maxNumber}.`,
|
|
11
|
-
invalidCharacters: 'Try using numbers only. Alphabetical or symbols characters are not allowed.'
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
fr: {
|
|
15
|
-
accessibility: {
|
|
16
|
-
a11yLabel: 'Sélecteur de quantité',
|
|
17
|
-
increaseButton: `Augmenter la quantité`,
|
|
18
|
-
decreaseButton: `Réduire la quantité`
|
|
19
|
-
},
|
|
20
|
-
errors: {
|
|
21
|
-
numberIsTooSmall: minNumber => `Vous pouvez saisir un nombre égal ou supérieur à ${minNumber}.`,
|
|
22
|
-
numberIsTooBig: maxNumber => `Vous pouvez saisir un nombre égal ou inférieur à ${maxNumber}.`,
|
|
23
|
-
invalidCharacters: `Essayez d'utiliser seulement des chiffres. Les caractères alphabétiques ou les symboles ne sont pas permis.`
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
export const InputField = /*#__PURE__*/styled.div.withConfig({
|
|
3
|
-
displayName: "styles__InputField",
|
|
4
|
-
componentId: "components-web__sc-1lrz1xk-0"
|
|
5
|
-
})(["order:1;text-align:center;z-index:10;input{text-align:center;}"]);
|
|
6
|
-
export const InputWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
7
|
-
displayName: "styles__InputWrapper",
|
|
8
|
-
componentId: "components-web__sc-1lrz1xk-1"
|
|
9
|
-
})(["text-align:start;display:flex;flex-direction:row;flex-wrap:nowrap;"]);
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { selectSystemProps } from '@telus-uds/components-base';
|
|
4
|
-
import { viewports } from '@telus-uds/system-constants';
|
|
5
|
-
import { htmlAttrs } from '../utils';
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
9
|
-
const staticStyles = {
|
|
10
|
-
image: {
|
|
11
|
-
display: 'block',
|
|
12
|
-
width: '100%'
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Provide different image sources for different screen sizes.
|
|
18
|
-
*/
|
|
19
|
-
const ResponsiveImage = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
20
|
-
let {
|
|
21
|
-
xsSrc,
|
|
22
|
-
smSrc,
|
|
23
|
-
mdSrc,
|
|
24
|
-
lgSrc,
|
|
25
|
-
xlSrc,
|
|
26
|
-
fallbackSrc,
|
|
27
|
-
alt,
|
|
28
|
-
loading = 'eager',
|
|
29
|
-
...rest
|
|
30
|
-
} = _ref;
|
|
31
|
-
return /*#__PURE__*/_jsxs("picture", {
|
|
32
|
-
...selectProps(rest),
|
|
33
|
-
ref: ref,
|
|
34
|
-
children: [/*#__PURE__*/_jsx("source", {
|
|
35
|
-
srcSet: xlSrc,
|
|
36
|
-
media: `(min-width: ${viewports.map.get(viewports.xl)}px)`
|
|
37
|
-
}), /*#__PURE__*/_jsx("source", {
|
|
38
|
-
srcSet: lgSrc,
|
|
39
|
-
media: `(min-width: ${viewports.map.get(viewports.lg)}px)`
|
|
40
|
-
}), /*#__PURE__*/_jsx("source", {
|
|
41
|
-
srcSet: mdSrc,
|
|
42
|
-
media: `(min-width: ${viewports.map.get(viewports.md)}px)`
|
|
43
|
-
}), /*#__PURE__*/_jsx("source", {
|
|
44
|
-
srcSet: smSrc,
|
|
45
|
-
media: `(min-width: ${viewports.map.get(viewports.sm)}px)`
|
|
46
|
-
}), /*#__PURE__*/_jsx("source", {
|
|
47
|
-
srcSet: xsSrc,
|
|
48
|
-
media: `(max-width: ${viewports.map.get(viewports.sm) - 1}px)`
|
|
49
|
-
}), /*#__PURE__*/_jsx("img", {
|
|
50
|
-
src: fallbackSrc,
|
|
51
|
-
alt: alt,
|
|
52
|
-
style: staticStyles.image,
|
|
53
|
-
loading: loading
|
|
54
|
-
})]
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
ResponsiveImage.displayName = 'ResponsiveImage';
|
|
58
|
-
ResponsiveImage.propTypes = {
|
|
59
|
-
...selectedSystemPropTypes,
|
|
60
|
-
/**
|
|
61
|
-
* The src attribute used for screen widths up to 575px
|
|
62
|
-
*/
|
|
63
|
-
xsSrc: PropTypes.string.isRequired,
|
|
64
|
-
/**
|
|
65
|
-
* The src attribute used for screen widths greater than 576px
|
|
66
|
-
*/
|
|
67
|
-
smSrc: PropTypes.string.isRequired,
|
|
68
|
-
/**
|
|
69
|
-
* The src attribute used for screen widths greater than 768px
|
|
70
|
-
*/
|
|
71
|
-
mdSrc: PropTypes.string,
|
|
72
|
-
/**
|
|
73
|
-
* The src attribute used for screen widths greater than 992px
|
|
74
|
-
*/
|
|
75
|
-
lgSrc: PropTypes.string,
|
|
76
|
-
/**
|
|
77
|
-
* The src attribute used for screen widths greater than 1200px
|
|
78
|
-
*/
|
|
79
|
-
xlSrc: PropTypes.string,
|
|
80
|
-
/**
|
|
81
|
-
* The src attribute used for browsers that don't support responsive images (InternetExplorer)
|
|
82
|
-
*/
|
|
83
|
-
fallbackSrc: PropTypes.string.isRequired,
|
|
84
|
-
/**
|
|
85
|
-
* The alt attribute for the HTML img element. Setting this attribute to an empty string (alt="") indicates that this image is not a key part of the content, and that non-visual browsers may omit it from rendering.
|
|
86
|
-
*/
|
|
87
|
-
alt: PropTypes.string.isRequired,
|
|
88
|
-
/**
|
|
89
|
-
* Loading strategy.
|
|
90
|
-
* @default 'eager'
|
|
91
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading
|
|
92
|
-
*/
|
|
93
|
-
loading: PropTypes.oneOf(['eager', 'lazy'])
|
|
94
|
-
};
|
|
95
|
-
export default ResponsiveImage;
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { selectSystemProps, Typography, useThemeTokens, getTokensPropType } from '@telus-uds/components-base';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
|
-
import { htmlAttrs } from '../utils';
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
9
|
-
const RibbonWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
10
|
-
displayName: "Ribbon__RibbonWrapper",
|
|
11
|
-
componentId: "components-web__sc-186270k-0"
|
|
12
|
-
})(["width:fit-content;position:", ";z-index:1;left:", ";top:", ";"], _ref => {
|
|
13
|
-
let {
|
|
14
|
-
left,
|
|
15
|
-
top
|
|
16
|
-
} = _ref;
|
|
17
|
-
return left ?? top ? 'absolute' : 'relative';
|
|
18
|
-
}, _ref2 => {
|
|
19
|
-
let {
|
|
20
|
-
left
|
|
21
|
-
} = _ref2;
|
|
22
|
-
return left && `${left}px`;
|
|
23
|
-
}, _ref3 => {
|
|
24
|
-
let {
|
|
25
|
-
top
|
|
26
|
-
} = _ref3;
|
|
27
|
-
return top && `${top}px`;
|
|
28
|
-
});
|
|
29
|
-
const RibbonContainer = /*#__PURE__*/styled.div.withConfig({
|
|
30
|
-
displayName: "Ribbon__RibbonContainer",
|
|
31
|
-
componentId: "components-web__sc-186270k-1"
|
|
32
|
-
})(["display:flex;justify-content:center;background:", ";padding:", ";border-radius:", ";width:fit-content;box-shadow:", ";border-bottom-right-radius:", ";border-bottom-left-radius:", ";"], _ref4 => {
|
|
33
|
-
let {
|
|
34
|
-
backgroundColor
|
|
35
|
-
} = _ref4;
|
|
36
|
-
return backgroundColor;
|
|
37
|
-
}, _ref5 => {
|
|
38
|
-
let {
|
|
39
|
-
padding
|
|
40
|
-
} = _ref5;
|
|
41
|
-
return `${padding}`;
|
|
42
|
-
}, _ref6 => {
|
|
43
|
-
let {
|
|
44
|
-
borderRadius
|
|
45
|
-
} = _ref6;
|
|
46
|
-
return borderRadius;
|
|
47
|
-
}, _ref7 => {
|
|
48
|
-
let {
|
|
49
|
-
boxShadow,
|
|
50
|
-
shouldWrap
|
|
51
|
-
} = _ref7;
|
|
52
|
-
return shouldWrap && boxShadow;
|
|
53
|
-
}, _ref8 => {
|
|
54
|
-
let {
|
|
55
|
-
borderRadiusBottomLeft
|
|
56
|
-
} = _ref8;
|
|
57
|
-
return borderRadiusBottomLeft;
|
|
58
|
-
}, _ref9 => {
|
|
59
|
-
let {
|
|
60
|
-
borderRadiusBottomRight
|
|
61
|
-
} = _ref9;
|
|
62
|
-
return borderRadiusBottomRight;
|
|
63
|
-
});
|
|
64
|
-
const RibbonCurve = /*#__PURE__*/styled.div.withConfig({
|
|
65
|
-
displayName: "Ribbon__RibbonCurve",
|
|
66
|
-
componentId: "components-web__sc-186270k-2"
|
|
67
|
-
})(["background:", ";width:", ";height:", ";margin-top:-", ";border-radius:0 0 0 100%;position:relative;z-index:-1;overflow:hidden;&::after{content:'';border-bottom-left-radius:", ";position:absolute;height:", ";background:", ";width:", ";}"], _ref10 => {
|
|
68
|
-
let {
|
|
69
|
-
curveBackgroundColor
|
|
70
|
-
} = _ref10;
|
|
71
|
-
return curveBackgroundColor;
|
|
72
|
-
}, _ref11 => {
|
|
73
|
-
let {
|
|
74
|
-
curveWidth
|
|
75
|
-
} = _ref11;
|
|
76
|
-
return curveWidth;
|
|
77
|
-
}, _ref12 => {
|
|
78
|
-
let {
|
|
79
|
-
curveHeight
|
|
80
|
-
} = _ref12;
|
|
81
|
-
return curveHeight;
|
|
82
|
-
}, _ref13 => {
|
|
83
|
-
let {
|
|
84
|
-
curveMarginTop
|
|
85
|
-
} = _ref13;
|
|
86
|
-
return curveMarginTop;
|
|
87
|
-
}, _ref14 => {
|
|
88
|
-
let {
|
|
89
|
-
curveAfterRadius
|
|
90
|
-
} = _ref14;
|
|
91
|
-
return curveAfterRadius;
|
|
92
|
-
}, _ref15 => {
|
|
93
|
-
let {
|
|
94
|
-
curveAfterHeight
|
|
95
|
-
} = _ref15;
|
|
96
|
-
return curveAfterHeight;
|
|
97
|
-
}, _ref16 => {
|
|
98
|
-
let {
|
|
99
|
-
curveAfterBackgroundColor
|
|
100
|
-
} = _ref16;
|
|
101
|
-
return curveAfterBackgroundColor;
|
|
102
|
-
}, _ref17 => {
|
|
103
|
-
let {
|
|
104
|
-
curveAfterWidth
|
|
105
|
-
} = _ref17;
|
|
106
|
-
return curveAfterWidth;
|
|
107
|
-
});
|
|
108
|
-
const Ribbon = /*#__PURE__*/React.forwardRef((_ref18, ref) => {
|
|
109
|
-
let {
|
|
110
|
-
children,
|
|
111
|
-
tokens,
|
|
112
|
-
wrap: shouldWrap = false,
|
|
113
|
-
left,
|
|
114
|
-
top,
|
|
115
|
-
variant = {},
|
|
116
|
-
...rest
|
|
117
|
-
} = _ref18;
|
|
118
|
-
const {
|
|
119
|
-
backgroundColor,
|
|
120
|
-
borderRadius,
|
|
121
|
-
boxShadowPaddingBottom,
|
|
122
|
-
boxShadowPaddingLeft,
|
|
123
|
-
boxShadowPaddingRight,
|
|
124
|
-
boxShadowPaddingTop,
|
|
125
|
-
boxShadowColor,
|
|
126
|
-
curveAfterBackgroundColor,
|
|
127
|
-
curveAfterHeight,
|
|
128
|
-
curveAfterWidth,
|
|
129
|
-
curveBackgroundColor,
|
|
130
|
-
curveHeight,
|
|
131
|
-
curveAfterRadius,
|
|
132
|
-
curveWidth,
|
|
133
|
-
curveMarginTop,
|
|
134
|
-
paddingBottom,
|
|
135
|
-
paddingLeft,
|
|
136
|
-
paddingRight,
|
|
137
|
-
paddingTop,
|
|
138
|
-
gradient,
|
|
139
|
-
fontColor,
|
|
140
|
-
borderRadiusBottomLeft,
|
|
141
|
-
borderRadiusBottomRight,
|
|
142
|
-
fontName,
|
|
143
|
-
fontWeight,
|
|
144
|
-
fontSize,
|
|
145
|
-
lineHeight
|
|
146
|
-
} = useThemeTokens('Ribbon', tokens, {
|
|
147
|
-
...variant,
|
|
148
|
-
wrap: shouldWrap
|
|
149
|
-
});
|
|
150
|
-
let background = backgroundColor;
|
|
151
|
-
if (gradient) {
|
|
152
|
-
const {
|
|
153
|
-
type: gradientType,
|
|
154
|
-
angle: gradientAngle,
|
|
155
|
-
stops: gradientColors
|
|
156
|
-
} = gradient;
|
|
157
|
-
const gradientBackground = `${gradientType}-gradient(${gradientAngle}deg, ${gradientColors[0].color}, ${gradientColors[1].color})`;
|
|
158
|
-
background = gradientBackground;
|
|
159
|
-
}
|
|
160
|
-
return /*#__PURE__*/_jsxs(RibbonWrapper, {
|
|
161
|
-
left: left,
|
|
162
|
-
top: top,
|
|
163
|
-
"data-testid": "ribbon-wrapper",
|
|
164
|
-
ref: ref,
|
|
165
|
-
...selectProps(rest),
|
|
166
|
-
children: [/*#__PURE__*/_jsx(RibbonContainer, {
|
|
167
|
-
shouldWrap: shouldWrap,
|
|
168
|
-
backgroundColor: background,
|
|
169
|
-
padding: `${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`,
|
|
170
|
-
borderRadius: `${borderRadius}px`,
|
|
171
|
-
boxShadow: `${boxShadowPaddingTop}px ${boxShadowPaddingRight}px ${boxShadowPaddingBottom}px ${boxShadowPaddingLeft}px ${boxShadowColor}`,
|
|
172
|
-
borderRadiusBottomLeft: `${borderRadiusBottomLeft}px`,
|
|
173
|
-
borderRadiusBottomRight: `${borderRadiusBottomRight}px`,
|
|
174
|
-
children: /*#__PURE__*/_jsx(Typography, {
|
|
175
|
-
variant: {
|
|
176
|
-
bold: true,
|
|
177
|
-
inverse: true
|
|
178
|
-
},
|
|
179
|
-
tokens: {
|
|
180
|
-
color: fontColor,
|
|
181
|
-
fontName,
|
|
182
|
-
fontWeight,
|
|
183
|
-
fontSize,
|
|
184
|
-
lineHeight
|
|
185
|
-
},
|
|
186
|
-
children: children
|
|
187
|
-
})
|
|
188
|
-
}), shouldWrap && /*#__PURE__*/_jsx(RibbonCurve, {
|
|
189
|
-
"data-testid": "ribbon-curve",
|
|
190
|
-
backgroundColor: backgroundColor,
|
|
191
|
-
curveMarginTop: `${curveMarginTop}px`,
|
|
192
|
-
curveWidth: `${curveWidth}px`,
|
|
193
|
-
curveHeight: `${curveHeight}px`,
|
|
194
|
-
curveBackgroundColor: curveBackgroundColor,
|
|
195
|
-
curveAfterRadius: `${curveAfterRadius}px`,
|
|
196
|
-
curveAfterWidth: `${curveAfterWidth}px`,
|
|
197
|
-
curveAfterHeight: `${curveAfterHeight}px`,
|
|
198
|
-
curveAfterBackgroundColor: curveAfterBackgroundColor
|
|
199
|
-
})]
|
|
200
|
-
});
|
|
201
|
-
});
|
|
202
|
-
Ribbon.displayName = 'Ribbon';
|
|
203
|
-
Ribbon.propTypes = {
|
|
204
|
-
...selectedSystemPropTypes,
|
|
205
|
-
tokens: getTokensPropType('Ribbon'),
|
|
206
|
-
children: PropTypes.node,
|
|
207
|
-
/** show/hide the ribbon fold
|
|
208
|
-
* @deprecated please don't rely on `wrap` to turn off the wrapping (use `Badge` instead) as it will be removed in the future
|
|
209
|
-
*/
|
|
210
|
-
wrap: PropTypes.bool,
|
|
211
|
-
/** sets the left offset (triggers absolute positioning) */
|
|
212
|
-
left: PropTypes.number,
|
|
213
|
-
/** sets the top offset (triggers absolute positioning) */
|
|
214
|
-
top: PropTypes.number
|
|
215
|
-
};
|
|
216
|
-
export default Ribbon;
|