@telus-uds/components-web 2.43.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 +21 -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 +105 -101
- 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 +17 -4
- 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 -506
- 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,26 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _componentsBase = require("@telus-uds/components-base");
|
|
10
|
-
var _utils = require("../utils");
|
|
11
|
-
var _styles = require("./styles");
|
|
12
|
-
var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
13
|
-
var _SideButton = _interopRequireDefault(require("./SideButton"));
|
|
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 { 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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
9
|
const {
|
|
17
10
|
isNaN
|
|
18
11
|
} = Number;
|
|
19
12
|
const isNumber = value => {
|
|
20
13
|
return typeof value === 'number' && !isNaN(value);
|
|
21
14
|
};
|
|
22
|
-
const [selectProps, selectedSystemPropTypes] =
|
|
23
|
-
const QuantitySelector = /*#__PURE__*/
|
|
15
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, htmlAttrs]);
|
|
16
|
+
const QuantitySelector = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
24
17
|
let {
|
|
25
18
|
id = 'quantity-selector',
|
|
26
19
|
minNumber,
|
|
@@ -32,7 +25,7 @@ const QuantitySelector = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
32
25
|
hintPosition = 'inline',
|
|
33
26
|
tooltip,
|
|
34
27
|
onChange,
|
|
35
|
-
dictionary =
|
|
28
|
+
dictionary = defaultDictionary,
|
|
36
29
|
accessibilityLabel,
|
|
37
30
|
copy = 'en',
|
|
38
31
|
variant = {
|
|
@@ -45,8 +38,8 @@ const QuantitySelector = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
45
38
|
const {
|
|
46
39
|
disabled
|
|
47
40
|
} = variant;
|
|
48
|
-
const [error, setError] =
|
|
49
|
-
const getCopy =
|
|
41
|
+
const [error, setError] = React.useState('');
|
|
42
|
+
const getCopy = useCopy({
|
|
50
43
|
dictionary,
|
|
51
44
|
copy
|
|
52
45
|
});
|
|
@@ -59,7 +52,7 @@ const QuantitySelector = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
59
52
|
const {
|
|
60
53
|
currentValue: number,
|
|
61
54
|
setValue: setNumber
|
|
62
|
-
} =
|
|
55
|
+
} = useInputValue({
|
|
63
56
|
value: getValidatedNumber(value),
|
|
64
57
|
initialValue: getValidatedNumber(defaultValue),
|
|
65
58
|
onChange
|
|
@@ -85,15 +78,15 @@ const QuantitySelector = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
85
78
|
setError(getCopy('errors').invalidCharacters);
|
|
86
79
|
}
|
|
87
80
|
};
|
|
88
|
-
const renderLabel = () => label ? /*#__PURE__*/(
|
|
81
|
+
const renderLabel = () => label ? /*#__PURE__*/_jsx(InputLabel, {
|
|
89
82
|
forId: id,
|
|
90
83
|
label: label,
|
|
91
84
|
hint: hint,
|
|
92
85
|
hintPosition: hintPosition,
|
|
93
86
|
tooltip: tooltip
|
|
94
87
|
}) : null;
|
|
95
|
-
const getTokens =
|
|
96
|
-
const renderTextInput = () => /*#__PURE__*/(
|
|
88
|
+
const getTokens = useThemeTokensCallback('QuantitySelector', tokens, variant);
|
|
89
|
+
const renderTextInput = () => /*#__PURE__*/_jsx(TextInput, {
|
|
97
90
|
nativeID: id,
|
|
98
91
|
value: inputValue,
|
|
99
92
|
defaultValue: defaultValue,
|
|
@@ -134,18 +127,18 @@ const QuantitySelector = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
134
127
|
const flexOrder = order => ({
|
|
135
128
|
order
|
|
136
129
|
});
|
|
137
|
-
return /*#__PURE__*/(
|
|
130
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
138
131
|
testID: testID,
|
|
139
132
|
ref: ref,
|
|
140
133
|
...selectProps(rest),
|
|
141
|
-
children: [renderLabel(), /*#__PURE__*/(
|
|
134
|
+
children: [renderLabel(), /*#__PURE__*/_jsx(Spacer, {
|
|
142
135
|
space: 2
|
|
143
|
-
}), /*#__PURE__*/(
|
|
144
|
-
children: [/*#__PURE__*/(
|
|
136
|
+
}), /*#__PURE__*/_jsxs(InputWrapper, {
|
|
137
|
+
children: [/*#__PURE__*/_jsx(InputField, {
|
|
145
138
|
children: renderTextInput()
|
|
146
|
-
}), /*#__PURE__*/(
|
|
139
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
147
140
|
style: flexOrder(0),
|
|
148
|
-
children: /*#__PURE__*/(
|
|
141
|
+
children: /*#__PURE__*/_jsx(SideButton, {
|
|
149
142
|
isEnabled: isDecreaseEnabled,
|
|
150
143
|
onPress: () => updateNumber(number - 1),
|
|
151
144
|
onDoubleClick: () => updateNumber(number - 1),
|
|
@@ -157,9 +150,9 @@ const QuantitySelector = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
157
150
|
accessibilityLabel: getCopy('accessibility').decreaseButton,
|
|
158
151
|
accessibilityDisabled: !isDecreaseEnabled
|
|
159
152
|
})
|
|
160
|
-
}), /*#__PURE__*/(
|
|
153
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
161
154
|
style: flexOrder(2),
|
|
162
|
-
children: /*#__PURE__*/(
|
|
155
|
+
children: /*#__PURE__*/_jsx(SideButton, {
|
|
163
156
|
isEnabled: isIncreaseEnabled,
|
|
164
157
|
onPress: () => updateNumber(number + 1),
|
|
165
158
|
onDoubleClick: () => updateNumber(number + 1),
|
|
@@ -172,9 +165,9 @@ const QuantitySelector = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
172
165
|
}
|
|
173
166
|
})
|
|
174
167
|
})]
|
|
175
|
-
}), error ? /*#__PURE__*/(
|
|
168
|
+
}), error ? /*#__PURE__*/_jsx(Box, {
|
|
176
169
|
vertical: 2,
|
|
177
|
-
children: /*#__PURE__*/(
|
|
170
|
+
children: /*#__PURE__*/_jsx(Feedback, {
|
|
178
171
|
validation: "error",
|
|
179
172
|
children: error
|
|
180
173
|
})
|
|
@@ -183,16 +176,16 @@ const QuantitySelector = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
183
176
|
});
|
|
184
177
|
|
|
185
178
|
// If a language dictionary entry is provided, it must contain every key
|
|
186
|
-
const dictionaryContentShape =
|
|
187
|
-
accessibility:
|
|
188
|
-
a11yLabel:
|
|
189
|
-
increaseButton:
|
|
190
|
-
decreaseButton:
|
|
179
|
+
const dictionaryContentShape = PropTypes.shape({
|
|
180
|
+
accessibility: PropTypes.shape({
|
|
181
|
+
a11yLabel: PropTypes.string.isRequired,
|
|
182
|
+
increaseButton: PropTypes.string.isRequired,
|
|
183
|
+
decreaseButton: PropTypes.string.isRequired
|
|
191
184
|
}).isRequired,
|
|
192
|
-
errors:
|
|
193
|
-
numberIsTooSmall:
|
|
194
|
-
numberIsTooBig:
|
|
195
|
-
invalidCharacters:
|
|
185
|
+
errors: PropTypes.shape({
|
|
186
|
+
numberIsTooSmall: PropTypes.func.isRequired,
|
|
187
|
+
numberIsTooBig: PropTypes.func.isRequired,
|
|
188
|
+
invalidCharacters: PropTypes.string.isRequired
|
|
196
189
|
}).isRequired
|
|
197
190
|
});
|
|
198
191
|
QuantitySelector.displayName = 'QuantitySelector';
|
|
@@ -201,68 +194,67 @@ QuantitySelector.propTypes = {
|
|
|
201
194
|
/**
|
|
202
195
|
* The id of the input field
|
|
203
196
|
*/
|
|
204
|
-
id:
|
|
197
|
+
id: PropTypes.string,
|
|
205
198
|
/**
|
|
206
199
|
* The minimum number allowed
|
|
207
200
|
*/
|
|
208
|
-
minNumber:
|
|
201
|
+
minNumber: PropTypes.number,
|
|
209
202
|
/**
|
|
210
203
|
* The maximum number allowed
|
|
211
204
|
*/
|
|
212
|
-
maxNumber:
|
|
205
|
+
maxNumber: PropTypes.number,
|
|
213
206
|
/**
|
|
214
207
|
* The callback function that is called when the value of the input field changes
|
|
215
208
|
*/
|
|
216
|
-
onChange:
|
|
209
|
+
onChange: PropTypes.func,
|
|
217
210
|
/**
|
|
218
211
|
* The default value of the input field
|
|
219
212
|
*/
|
|
220
|
-
defaultValue:
|
|
213
|
+
defaultValue: PropTypes.number,
|
|
221
214
|
/**
|
|
222
215
|
* If the input's state is to be controlled by a parent component, use this prop
|
|
223
216
|
* together with the `onChange` to pass down and update the lifted state.
|
|
224
217
|
*/
|
|
225
|
-
value:
|
|
218
|
+
value: PropTypes.number,
|
|
226
219
|
/**
|
|
227
220
|
* The label of the input field
|
|
228
221
|
*/
|
|
229
|
-
label:
|
|
222
|
+
label: PropTypes.string,
|
|
230
223
|
/**
|
|
231
224
|
* The hint of the input field
|
|
232
225
|
*/
|
|
233
|
-
hint:
|
|
226
|
+
hint: PropTypes.string,
|
|
234
227
|
/**
|
|
235
228
|
* The position of the hint. Could be shown along side the label or below it
|
|
236
229
|
*/
|
|
237
|
-
hintPosition:
|
|
230
|
+
hintPosition: PropTypes.oneOf(['inline', 'below']),
|
|
238
231
|
/**
|
|
239
232
|
* Adds a question mark which will display a tooltip when clicked
|
|
240
233
|
*/
|
|
241
|
-
tooltip:
|
|
234
|
+
tooltip: PropTypes.string,
|
|
242
235
|
/**
|
|
243
236
|
* The accessibility label of the input field
|
|
244
237
|
*/
|
|
245
|
-
accessibilityLabel:
|
|
238
|
+
accessibilityLabel: PropTypes.string,
|
|
246
239
|
/**
|
|
247
240
|
* The dictionary object containing the content for the input field
|
|
248
241
|
*/
|
|
249
|
-
dictionary:
|
|
242
|
+
dictionary: PropTypes.shape({
|
|
250
243
|
en: dictionaryContentShape,
|
|
251
244
|
fr: dictionaryContentShape
|
|
252
245
|
}),
|
|
253
246
|
/**
|
|
254
247
|
* The language to use for the copy.
|
|
255
248
|
*/
|
|
256
|
-
copy:
|
|
257
|
-
variant:
|
|
258
|
-
alternative:
|
|
259
|
-
disabled:
|
|
249
|
+
copy: PropTypes.oneOfType([PropTypes.oneOf(['en', 'fr'])]),
|
|
250
|
+
variant: PropTypes.exact({
|
|
251
|
+
alternative: PropTypes.bool,
|
|
252
|
+
disabled: PropTypes.bool
|
|
260
253
|
}),
|
|
261
|
-
tokens:
|
|
254
|
+
tokens: getTokensPropType('QuantitySelector'),
|
|
262
255
|
/**
|
|
263
256
|
* Sets `data-testid` attribute on the input field for testing purposes.
|
|
264
257
|
*/
|
|
265
|
-
testID:
|
|
258
|
+
testID: PropTypes.string
|
|
266
259
|
};
|
|
267
|
-
|
|
268
|
-
exports.default = _default;
|
|
260
|
+
export default QuantitySelector;
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _componentsBase = require("@telus-uds/components-base");
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
const SideButton = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
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) => {
|
|
13
6
|
let {
|
|
14
7
|
isEnabled = true,
|
|
15
8
|
onPress = () => {},
|
|
@@ -19,7 +12,7 @@ const SideButton = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
19
12
|
tokens = {},
|
|
20
13
|
variant = {}
|
|
21
14
|
} = _ref;
|
|
22
|
-
const getTokens =
|
|
15
|
+
const getTokens = useThemeTokensCallback('QuantitySelectorSideButton', tokens, variant);
|
|
23
16
|
const getButtonTokens = _ref2 => {
|
|
24
17
|
let {
|
|
25
18
|
buttonState,
|
|
@@ -52,7 +45,7 @@ const SideButton = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
52
45
|
outerBorderWidth: 0
|
|
53
46
|
};
|
|
54
47
|
};
|
|
55
|
-
return /*#__PURE__*/(
|
|
48
|
+
return /*#__PURE__*/_jsx(IconButton, {
|
|
56
49
|
tokens: buttonState => getButtonTokens({
|
|
57
50
|
disabled: !isEnabled,
|
|
58
51
|
buttonState
|
|
@@ -66,13 +59,12 @@ const SideButton = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
66
59
|
});
|
|
67
60
|
SideButton.displayName = 'QuantitySelectorSideButton';
|
|
68
61
|
SideButton.propTypes = {
|
|
69
|
-
isEnabled:
|
|
70
|
-
onPress:
|
|
71
|
-
onDoubleClick:
|
|
72
|
-
accessibilityLabel:
|
|
73
|
-
accessibilityDisabled:
|
|
74
|
-
tokens:
|
|
75
|
-
variant:
|
|
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
|
|
76
69
|
};
|
|
77
|
-
|
|
78
|
-
exports.default = _default;
|
|
70
|
+
export default SideButton;
|
|
@@ -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
|
accessibility: {
|
|
10
4
|
a11yLabel: 'Quantity selector',
|
|
@@ -29,5 +23,4 @@ var _default = {
|
|
|
29
23
|
invalidCharacters: `Essayez d'utiliser seulement des chiffres. Les caractères alphabétiques ou les symboles ne sont pas permis.`
|
|
30
24
|
}
|
|
31
25
|
}
|
|
32
|
-
};
|
|
33
|
-
exports.default = _default;
|
|
26
|
+
};
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _QuantitySelector = _interopRequireDefault(require("./QuantitySelector"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
var _default = _QuantitySelector.default;
|
|
10
|
-
exports.default = _default;
|
|
1
|
+
import QuantitySelector from './QuantitySelector';
|
|
2
|
+
export default QuantitySelector;
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.InputWrapper = exports.InputField = void 0;
|
|
7
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
const InputField = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
export const InputField = /*#__PURE__*/styled.div.withConfig({
|
|
10
3
|
displayName: "styles__InputField",
|
|
11
4
|
componentId: "components-web__sc-1lrz1xk-0"
|
|
12
5
|
})(["order:1;text-align:center;z-index:10;input{text-align:center;}"]);
|
|
13
|
-
|
|
14
|
-
const InputWrapper = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
6
|
+
export const InputWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
15
7
|
displayName: "styles__InputWrapper",
|
|
16
8
|
componentId: "components-web__sc-1lrz1xk-1"
|
|
17
|
-
})(["text-align:start;display:flex;flex-direction:row;flex-wrap:nowrap;"]);
|
|
18
|
-
exports.InputWrapper = InputWrapper;
|
|
9
|
+
})(["text-align:start;display:flex;flex-direction:row;flex-wrap:nowrap;"]);
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
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 _utils = require("../utils");
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
15
8
|
const staticStyles = {
|
|
16
9
|
image: {
|
|
17
10
|
display: 'block',
|
|
@@ -22,7 +15,7 @@ const staticStyles = {
|
|
|
22
15
|
/**
|
|
23
16
|
* Provide different image sources for different screen sizes.
|
|
24
17
|
*/
|
|
25
|
-
const ResponsiveImage = /*#__PURE__*/
|
|
18
|
+
const ResponsiveImage = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
26
19
|
let {
|
|
27
20
|
xsSrc,
|
|
28
21
|
smSrc,
|
|
@@ -34,25 +27,25 @@ const ResponsiveImage = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
34
27
|
loading = 'eager',
|
|
35
28
|
...rest
|
|
36
29
|
} = _ref;
|
|
37
|
-
return /*#__PURE__*/(
|
|
30
|
+
return /*#__PURE__*/_jsxs("picture", {
|
|
38
31
|
...selectProps(rest),
|
|
39
32
|
ref: ref,
|
|
40
|
-
children: [/*#__PURE__*/(
|
|
33
|
+
children: [/*#__PURE__*/_jsx("source", {
|
|
41
34
|
srcSet: xlSrc,
|
|
42
|
-
media: `(min-width: ${
|
|
43
|
-
}), /*#__PURE__*/(
|
|
35
|
+
media: `(min-width: ${viewports.map.get(viewports.xl)}px)`
|
|
36
|
+
}), /*#__PURE__*/_jsx("source", {
|
|
44
37
|
srcSet: lgSrc,
|
|
45
|
-
media: `(min-width: ${
|
|
46
|
-
}), /*#__PURE__*/(
|
|
38
|
+
media: `(min-width: ${viewports.map.get(viewports.lg)}px)`
|
|
39
|
+
}), /*#__PURE__*/_jsx("source", {
|
|
47
40
|
srcSet: mdSrc,
|
|
48
|
-
media: `(min-width: ${
|
|
49
|
-
}), /*#__PURE__*/(
|
|
41
|
+
media: `(min-width: ${viewports.map.get(viewports.md)}px)`
|
|
42
|
+
}), /*#__PURE__*/_jsx("source", {
|
|
50
43
|
srcSet: smSrc,
|
|
51
|
-
media: `(min-width: ${
|
|
52
|
-
}), /*#__PURE__*/(
|
|
44
|
+
media: `(min-width: ${viewports.map.get(viewports.sm)}px)`
|
|
45
|
+
}), /*#__PURE__*/_jsx("source", {
|
|
53
46
|
srcSet: xsSrc,
|
|
54
|
-
media: `(max-width: ${
|
|
55
|
-
}), /*#__PURE__*/(
|
|
47
|
+
media: `(max-width: ${viewports.map.get(viewports.sm) - 1}px)`
|
|
48
|
+
}), /*#__PURE__*/_jsx("img", {
|
|
56
49
|
src: fallbackSrc,
|
|
57
50
|
alt: alt,
|
|
58
51
|
style: staticStyles.image,
|
|
@@ -66,37 +59,36 @@ ResponsiveImage.propTypes = {
|
|
|
66
59
|
/**
|
|
67
60
|
* The src attribute used for screen widths up to 575px
|
|
68
61
|
*/
|
|
69
|
-
xsSrc:
|
|
62
|
+
xsSrc: PropTypes.string.isRequired,
|
|
70
63
|
/**
|
|
71
64
|
* The src attribute used for screen widths greater than 576px
|
|
72
65
|
*/
|
|
73
|
-
smSrc:
|
|
66
|
+
smSrc: PropTypes.string.isRequired,
|
|
74
67
|
/**
|
|
75
68
|
* The src attribute used for screen widths greater than 768px
|
|
76
69
|
*/
|
|
77
|
-
mdSrc:
|
|
70
|
+
mdSrc: PropTypes.string,
|
|
78
71
|
/**
|
|
79
72
|
* The src attribute used for screen widths greater than 992px
|
|
80
73
|
*/
|
|
81
|
-
lgSrc:
|
|
74
|
+
lgSrc: PropTypes.string,
|
|
82
75
|
/**
|
|
83
76
|
* The src attribute used for screen widths greater than 1200px
|
|
84
77
|
*/
|
|
85
|
-
xlSrc:
|
|
78
|
+
xlSrc: PropTypes.string,
|
|
86
79
|
/**
|
|
87
80
|
* The src attribute used for browsers that don't support responsive images (InternetExplorer)
|
|
88
81
|
*/
|
|
89
|
-
fallbackSrc:
|
|
82
|
+
fallbackSrc: PropTypes.string.isRequired,
|
|
90
83
|
/**
|
|
91
84
|
* 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.
|
|
92
85
|
*/
|
|
93
|
-
alt:
|
|
86
|
+
alt: PropTypes.string.isRequired,
|
|
94
87
|
/**
|
|
95
88
|
* Loading strategy.
|
|
96
89
|
* @default 'eager'
|
|
97
90
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading
|
|
98
91
|
*/
|
|
99
|
-
loading:
|
|
92
|
+
loading: PropTypes.oneOf(['eager', 'lazy'])
|
|
100
93
|
};
|
|
101
|
-
|
|
102
|
-
exports.default = _default;
|
|
94
|
+
export default ResponsiveImage;
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _ResponsiveImage = _interopRequireDefault(require("./ResponsiveImage"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
var _default = _ResponsiveImage.default;
|
|
10
|
-
exports.default = _default;
|
|
1
|
+
import ResponsiveImage from './ResponsiveImage';
|
|
2
|
+
export default ResponsiveImage;
|
package/lib/Ribbon/Ribbon.js
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _componentsBase = require("@telus-uds/components-base");
|
|
10
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
-
var _utils = require("../utils");
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
15
|
-
const RibbonWrapper = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
8
|
+
const RibbonWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
16
9
|
displayName: "Ribbon__RibbonWrapper",
|
|
17
10
|
componentId: "components-web__sc-186270k-0"
|
|
18
11
|
})(["width:fit-content;position:", ";z-index:1;left:", ";top:", ";"], _ref => {
|
|
@@ -32,7 +25,7 @@ const RibbonWrapper = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
|
32
25
|
} = _ref3;
|
|
33
26
|
return top && `${top}px`;
|
|
34
27
|
});
|
|
35
|
-
const RibbonContainer = /*#__PURE__*/
|
|
28
|
+
const RibbonContainer = /*#__PURE__*/styled.div.withConfig({
|
|
36
29
|
displayName: "Ribbon__RibbonContainer",
|
|
37
30
|
componentId: "components-web__sc-186270k-1"
|
|
38
31
|
})(["display:flex;justify-content:center;background:", ";padding:", ";border-radius:", ";width:fit-content;box-shadow:", ";border-bottom-right-radius:", ";border-bottom-left-radius:", ";"], _ref4 => {
|
|
@@ -67,7 +60,7 @@ const RibbonContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
|
67
60
|
} = _ref9;
|
|
68
61
|
return borderRadiusBottomRight;
|
|
69
62
|
});
|
|
70
|
-
const RibbonCurve = /*#__PURE__*/
|
|
63
|
+
const RibbonCurve = /*#__PURE__*/styled.div.withConfig({
|
|
71
64
|
displayName: "Ribbon__RibbonCurve",
|
|
72
65
|
componentId: "components-web__sc-186270k-2"
|
|
73
66
|
})(["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 => {
|
|
@@ -111,7 +104,7 @@ const RibbonCurve = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
|
111
104
|
} = _ref17;
|
|
112
105
|
return curveAfterWidth;
|
|
113
106
|
});
|
|
114
|
-
const Ribbon = /*#__PURE__*/
|
|
107
|
+
const Ribbon = /*#__PURE__*/React.forwardRef((_ref18, ref) => {
|
|
115
108
|
let {
|
|
116
109
|
children,
|
|
117
110
|
tokens,
|
|
@@ -149,7 +142,7 @@ const Ribbon = /*#__PURE__*/_react.default.forwardRef((_ref18, ref) => {
|
|
|
149
142
|
fontWeight,
|
|
150
143
|
fontSize,
|
|
151
144
|
lineHeight
|
|
152
|
-
} =
|
|
145
|
+
} = useThemeTokens('Ribbon', tokens, {
|
|
153
146
|
...variant,
|
|
154
147
|
wrap: shouldWrap
|
|
155
148
|
});
|
|
@@ -163,13 +156,13 @@ const Ribbon = /*#__PURE__*/_react.default.forwardRef((_ref18, ref) => {
|
|
|
163
156
|
const gradientBackground = `${gradientType}-gradient(${gradientAngle}deg, ${gradientColors[0].color}, ${gradientColors[1].color})`;
|
|
164
157
|
background = gradientBackground;
|
|
165
158
|
}
|
|
166
|
-
return /*#__PURE__*/(
|
|
159
|
+
return /*#__PURE__*/_jsxs(RibbonWrapper, {
|
|
167
160
|
left: left,
|
|
168
161
|
top: top,
|
|
169
162
|
"data-testid": "ribbon-wrapper",
|
|
170
163
|
ref: ref,
|
|
171
164
|
...selectProps(rest),
|
|
172
|
-
children: [/*#__PURE__*/(
|
|
165
|
+
children: [/*#__PURE__*/_jsx(RibbonContainer, {
|
|
173
166
|
shouldWrap: shouldWrap,
|
|
174
167
|
backgroundColor: background,
|
|
175
168
|
padding: `${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`,
|
|
@@ -177,7 +170,7 @@ const Ribbon = /*#__PURE__*/_react.default.forwardRef((_ref18, ref) => {
|
|
|
177
170
|
boxShadow: `${boxShadowPaddingTop}px ${boxShadowPaddingRight}px ${boxShadowPaddingBottom}px ${boxShadowPaddingLeft}px ${boxShadowColor}`,
|
|
178
171
|
borderRadiusBottomLeft: `${borderRadiusBottomLeft}px`,
|
|
179
172
|
borderRadiusBottomRight: `${borderRadiusBottomRight}px`,
|
|
180
|
-
children: /*#__PURE__*/(
|
|
173
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
181
174
|
variant: {
|
|
182
175
|
bold: true,
|
|
183
176
|
inverse: true
|
|
@@ -191,7 +184,7 @@ const Ribbon = /*#__PURE__*/_react.default.forwardRef((_ref18, ref) => {
|
|
|
191
184
|
},
|
|
192
185
|
children: children
|
|
193
186
|
})
|
|
194
|
-
}), shouldWrap && /*#__PURE__*/(
|
|
187
|
+
}), shouldWrap && /*#__PURE__*/_jsx(RibbonCurve, {
|
|
195
188
|
"data-testid": "ribbon-curve",
|
|
196
189
|
backgroundColor: backgroundColor,
|
|
197
190
|
curveMarginTop: `${curveMarginTop}px`,
|
|
@@ -208,16 +201,15 @@ const Ribbon = /*#__PURE__*/_react.default.forwardRef((_ref18, ref) => {
|
|
|
208
201
|
Ribbon.displayName = 'Ribbon';
|
|
209
202
|
Ribbon.propTypes = {
|
|
210
203
|
...selectedSystemPropTypes,
|
|
211
|
-
tokens:
|
|
212
|
-
children:
|
|
204
|
+
tokens: getTokensPropType('Ribbon'),
|
|
205
|
+
children: PropTypes.node,
|
|
213
206
|
/** show/hide the ribbon fold
|
|
214
207
|
* @deprecated please don't rely on `wrap` to turn off the wrapping (use `Badge` instead) as it will be removed in the future
|
|
215
208
|
*/
|
|
216
|
-
wrap:
|
|
209
|
+
wrap: PropTypes.bool,
|
|
217
210
|
/** sets the left offset (triggers absolute positioning) */
|
|
218
|
-
left:
|
|
211
|
+
left: PropTypes.number,
|
|
219
212
|
/** sets the top offset (triggers absolute positioning) */
|
|
220
|
-
top:
|
|
213
|
+
top: PropTypes.number
|
|
221
214
|
};
|
|
222
|
-
|
|
223
|
-
exports.default = _default;
|
|
215
|
+
export default Ribbon;
|
package/lib/Ribbon/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 _Ribbon = _interopRequireDefault(require("./Ribbon"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
var _default = _Ribbon.default;
|
|
10
|
-
exports.default = _default;
|
|
1
|
+
import Ribbon from './Ribbon';
|
|
2
|
+
export default Ribbon;
|