@shopgate/pwa-ui-shared 7.30.0-alpha.8 → 7.30.0-beta.1
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/AccordionContainer/index.js +17 -11
- package/AccordionContainer/spec.js +12 -3
- package/ActionButton/index.js +51 -32
- package/ActionButton/spec.js +13 -5
- package/AddToCartButton/index.js +44 -33
- package/AddToCartButton/mock.js +20 -8
- package/AddToCartButton/spec.js +29 -14
- package/Availability/index.js +5 -3
- package/Availability/spec.js +6 -5
- package/Button/index.js +73 -58
- package/Button/spec.js +16 -10
- package/ButtonLink/index.js +20 -12
- package/ButtonLink/spec.js +5 -3
- package/Card/index.js +5 -3
- package/CardList/components/Item/index.js +5 -3
- package/CardList/index.js +21 -12
- package/CartTotalLine/components/Amount/index.js +10 -8
- package/CartTotalLine/components/Hint/index.js +7 -5
- package/CartTotalLine/components/Label/index.js +12 -10
- package/CartTotalLine/components/Spacer/index.js +5 -3
- package/CartTotalLine/index.js +5 -3
- package/Checkbox/index.js +6 -5
- package/Chip/index.js +28 -22
- package/Chip/spec.js +9 -6
- package/ContextMenu/ContextMenuProvider.js +5 -3
- package/ContextMenu/components/Item/index.js +14 -11
- package/ContextMenu/components/Position/index.js +20 -12
- package/ContextMenu/index.js +54 -44
- package/ContextMenu/spec.js +31 -20
- package/Dialog/components/HtmlContentDialog/index.js +9 -7
- package/Dialog/components/HtmlContentDialog/spec.js +9 -6
- package/Dialog/components/PipelineErrorDialog/index.js +106 -47
- package/Dialog/components/PipelineErrorDialog/spec.js +5 -4
- package/Dialog/components/TextMessageDialog/index.js +9 -7
- package/Dialog/components/TextMessageDialog/spec.js +9 -6
- package/Dialog/components/VariantSelectModal/index.js +7 -5
- package/Dialog/components/VariantSelectModal/spec.js +6 -3
- package/Dialog/index.js +12 -8
- package/Dialog/spec.js +7 -6
- package/DiscountBadge/index.js +10 -8
- package/DiscountBadge/spec.js +3 -2
- package/FavoritesButton/index.js +40 -31
- package/FavoritesButton/spec.js +7 -3
- package/Form/Builder/classes/ActionListener/index.js +400 -401
- package/Form/Builder/components/CheckboxElement.js +13 -5
- package/Form/Builder/components/CountryElement.js +13 -5
- package/Form/Builder/components/ProvinceElement.js +13 -5
- package/Form/Builder/components/RadioElement.js +19 -11
- package/Form/Builder/components/SelectElement.js +26 -16
- package/Form/Builder/components/TextElement.js +13 -5
- package/Form/Builder/index.js +70 -60
- package/Form/Builder/spec.js +27 -18
- package/Form/Checkbox/index.js +31 -21
- package/Form/InfoField/index.js +19 -12
- package/Form/InfoField/spec.js +4 -1
- package/Form/Password/index.js +22 -15
- package/Form/Password/spec.js +10 -5
- package/Form/RadioGroup/components/Item/index.js +34 -25
- package/Form/RadioGroup/index.js +37 -28
- package/Form/RadioGroup/spec.js +45 -31
- package/Form/Select/index.js +52 -43
- package/Form/Select/spec.js +5 -2
- package/Form/SelectContextChoices/index.js +26 -22
- package/Form/SelectContextChoices/spec.js +4 -1
- package/Form/TextField/index.js +40 -27
- package/Form/TextField/spec.js +34 -21
- package/Form/index.js +23 -15
- package/FormElement/components/ErrorText/index.js +7 -5
- package/FormElement/components/Label/index.js +6 -4
- package/FormElement/components/Placeholder/index.js +7 -5
- package/FormElement/components/Underline/index.js +8 -6
- package/FormElement/index.js +62 -46
- package/FormElement/spec.js +10 -9
- package/Glow/index.js +30 -22
- package/Glow/spec.js +6 -1
- package/IndicatorCircle/index.js +10 -8
- package/IndicatorCircle/spec.js +3 -2
- package/LoadingIndicator/index.js +8 -6
- package/Manufacturer/index.js +9 -7
- package/MessageBar/index.js +20 -17
- package/MessageBar/spec.js +6 -5
- package/NoResults/components/Icon/index.js +134 -110
- package/NoResults/index.js +27 -21
- package/Placeholder/index.js +13 -5
- package/PlaceholderLabel/index.js +2 -1
- package/PlaceholderLabel/spec.js +13 -6
- package/PlaceholderParagraph/index.js +13 -12
- package/PlaceholderParagraph/spec.js +13 -6
- package/Price/index.js +46 -28
- package/PriceInfo/index.js +2 -1
- package/PriceStriked/index.js +41 -29
- package/ProductProperties/index.js +13 -10
- package/ProgressBar/index.js +28 -19
- package/ProgressBar/spec.js +2 -1
- package/RadioButton/index.js +6 -5
- package/RadioButton/spec.js +3 -2
- package/RatingNumber/index.js +2 -1
- package/RatingStars/index.js +50 -34
- package/RatingStars/spec.js +7 -6
- package/Ripple/components/RippleAnimation/index.js +48 -52
- package/Ripple/index.js +72 -62
- package/RippleButton/index.js +44 -27
- package/RippleButton/spec.js +20 -13
- package/ScannerOverlay/components/CameraOverlay/index.js +8 -5
- package/ScannerOverlay/components/CameraOverlay/style.js +0 -1
- package/ScannerOverlay/components/ScannerBar/components/FlashlightButton/index.js +25 -21
- package/ScannerOverlay/components/ScannerBar/components/ScannerInstructions/index.js +7 -5
- package/ScannerOverlay/components/ScannerBar/index.js +17 -12
- package/ScannerOverlay/index.js +24 -15
- package/Sheet/components/Header/components/SearchBar/index.js +35 -28
- package/Sheet/components/Header/components/SearchBar/spec.js +2 -1
- package/Sheet/components/Header/index.js +47 -34
- package/Sheet/components/Header/spec.js +2 -1
- package/Sheet/index.js +80 -65
- package/Sheet/spec.js +27 -14
- package/TaxDisclaimer/index.js +13 -10
- package/TaxDisclaimer/spec.js +3 -2
- package/TextField/components/ErrorText/index.js +7 -5
- package/TextField/components/FormElement/index.js +4 -3
- package/TextField/components/Hint/index.js +7 -5
- package/TextField/components/Label/index.js +6 -4
- package/TextField/components/Underline/index.js +8 -6
- package/TextField/index.js +102 -85
- package/TextField/spec.js +37 -23
- package/ToggleIcon/index.js +23 -15
- package/ToggleIcon/spec.js +12 -8
- package/icons/AccountBoxIcon.js +5 -4
- package/icons/AddMoreIcon.js +5 -4
- package/icons/ArrowDropIcon.js +5 -4
- package/icons/ArrowIcon.js +5 -4
- package/icons/BarcodeScannerIcon.js +5 -4
- package/icons/BoxIcon.js +5 -4
- package/icons/BrowseIcon.js +5 -4
- package/icons/BurgerIcon.js +5 -4
- package/icons/CalendarIcon.js +5 -5
- package/icons/CartCouponIcon.js +5 -4
- package/icons/CartIcon.js +5 -4
- package/icons/CartPlusIcon.js +5 -4
- package/icons/CheckIcon.js +5 -4
- package/icons/CheckedIcon.js +5 -4
- package/icons/ChevronIcon.js +5 -4
- package/icons/CreditCardIcon.js +5 -4
- package/icons/CrossIcon.js +5 -4
- package/icons/DescriptionIcon.js +5 -4
- package/icons/FilterIcon.js +5 -4
- package/icons/FlashDisabledIcon.js +5 -4
- package/icons/FlashEnabledIcon.js +5 -4
- package/icons/GridIcon.js +5 -4
- package/icons/HeartIcon.js +5 -4
- package/icons/HeartOutlineIcon.js +5 -4
- package/icons/HeartPlusIcon.js +5 -4
- package/icons/HeartPlusOutlineIcon.js +5 -4
- package/icons/HomeIcon.js +5 -4
- package/icons/InfoIcon.js +5 -4
- package/icons/InfoOutlineIcon.js +5 -4
- package/icons/ListIcon.js +5 -4
- package/icons/LocalShippingIcon.js +5 -4
- package/icons/LocationIcon.js +5 -4
- package/icons/LocatorIcon.js +5 -4
- package/icons/LockIcon.js +5 -4
- package/icons/LogoutIcon.js +5 -4
- package/icons/MagnifierIcon.js +5 -4
- package/icons/MapMarkerIcon.js +5 -4
- package/icons/MoreIcon.js +5 -4
- package/icons/MoreVertIcon.js +5 -4
- package/icons/NotificationIcon.js +5 -4
- package/icons/PersonIcon.js +5 -4
- package/icons/PhoneIcon.js +5 -4
- package/icons/PlaceholderIcon.js +5 -4
- package/icons/RadioCheckedIcon.js +5 -4
- package/icons/RadioUncheckedIcon.js +5 -4
- package/icons/SecurityIcon.js +5 -4
- package/icons/ShippingMethodIcon.js +5 -4
- package/icons/ShoppingCartIcon.js +5 -4
- package/icons/SortIcon.js +5 -4
- package/icons/StarHalfIcon.js +5 -4
- package/icons/StarIcon.js +5 -4
- package/icons/StarOutlineIcon.js +5 -4
- package/icons/StopIcon.js +5 -4
- package/icons/TickIcon.js +5 -4
- package/icons/TimeIcon.js +5 -4
- package/icons/TrashIcon.js +5 -4
- package/icons/TrashOutlineIcon.js +5 -4
- package/icons/UncheckedIcon.js +5 -4
- package/icons/ViewListIcon.js +5 -4
- package/icons/VisibilityIcon.js +5 -4
- package/icons/VisibilityOffIcon.js +5 -4
- package/icons/WarningIcon.js +5 -4
- package/package.json +7 -8
package/Button/index.js
CHANGED
|
@@ -1,79 +1,94 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
2
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
2
3
|
import React, { Component } from 'react';
|
|
3
4
|
import PropTypes from 'prop-types';
|
|
4
5
|
import BaseButton from '@shopgate/pwa-common/components/Button';
|
|
5
6
|
import styles from "./style";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
8
|
/**
|
|
7
9
|
* The basic button component. This components applies Material Design styles and acts as
|
|
8
10
|
* base to more feature-rich button components such as ActionButton and RippleButton, but can
|
|
9
11
|
* also be used as standalone component or any other kind of new button.
|
|
10
12
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* @returns {Object}
|
|
15
|
-
*/
|
|
16
|
-
get style() {
|
|
17
|
-
const {
|
|
18
|
-
flat,
|
|
19
|
-
disabled
|
|
20
|
-
} = this.props;
|
|
21
|
-
switch (this.props.type) {
|
|
22
|
-
case 'plain':
|
|
23
|
-
return styles.plain();
|
|
24
|
-
case 'regular':
|
|
25
|
-
return styles.regular(disabled);
|
|
26
|
-
case 'simple':
|
|
27
|
-
return styles.simple(disabled);
|
|
28
|
-
default:
|
|
29
|
-
case 'primary':
|
|
30
|
-
return styles.primary(disabled, flat);
|
|
31
|
-
case 'secondary':
|
|
32
|
-
return styles.secondary(disabled, flat);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Getter for the calculated button props.
|
|
38
|
-
* @returns {Object}
|
|
39
|
-
*/
|
|
40
|
-
get buttonProps() {
|
|
41
|
-
const {
|
|
42
|
-
className,
|
|
43
|
-
disabled,
|
|
44
|
-
onClick,
|
|
45
|
-
testId,
|
|
46
|
-
type,
|
|
47
|
-
wrapContent,
|
|
48
|
-
flat,
|
|
49
|
-
...rest
|
|
50
|
-
} = this.props;
|
|
51
|
-
const buttonProps = {
|
|
52
|
-
className,
|
|
53
|
-
disabled,
|
|
54
|
-
onClick,
|
|
55
|
-
...rest
|
|
56
|
-
};
|
|
57
|
-
return buttonProps;
|
|
13
|
+
let Button = /*#__PURE__*/function (_Component) {
|
|
14
|
+
function Button() {
|
|
15
|
+
return _Component.apply(this, arguments) || this;
|
|
58
16
|
}
|
|
59
|
-
|
|
17
|
+
_inheritsLoose(Button, _Component);
|
|
18
|
+
var _proto = Button.prototype;
|
|
60
19
|
/**
|
|
61
20
|
* Renders the component.
|
|
62
21
|
* @return {JSX}
|
|
63
22
|
*/
|
|
64
|
-
render() {
|
|
23
|
+
_proto.render = function render() {
|
|
65
24
|
const {
|
|
66
25
|
style
|
|
67
26
|
} = this;
|
|
68
|
-
const content = this.props.wrapContent ? /*#__PURE__*/
|
|
69
|
-
className: style.content
|
|
70
|
-
|
|
71
|
-
|
|
27
|
+
const content = this.props.wrapContent ? /*#__PURE__*/_jsx("div", {
|
|
28
|
+
className: style.content,
|
|
29
|
+
children: this.props.children
|
|
30
|
+
}) : this.props.children;
|
|
31
|
+
return /*#__PURE__*/_jsx(BaseButton, {
|
|
32
|
+
...this.buttonProps,
|
|
72
33
|
className: `ui-shared__button ${style.button} ${this.props.className}`,
|
|
73
|
-
testId: this.props.testId
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
34
|
+
testId: this.props.testId,
|
|
35
|
+
children: content
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
return _createClass(Button, [{
|
|
39
|
+
key: "style",
|
|
40
|
+
get:
|
|
41
|
+
/**
|
|
42
|
+
* Getter for style depending on prop type.
|
|
43
|
+
* @returns {Object}
|
|
44
|
+
*/
|
|
45
|
+
function () {
|
|
46
|
+
const {
|
|
47
|
+
flat,
|
|
48
|
+
disabled
|
|
49
|
+
} = this.props;
|
|
50
|
+
switch (this.props.type) {
|
|
51
|
+
case 'plain':
|
|
52
|
+
return styles.plain();
|
|
53
|
+
case 'regular':
|
|
54
|
+
return styles.regular(disabled);
|
|
55
|
+
case 'simple':
|
|
56
|
+
return styles.simple(disabled);
|
|
57
|
+
default:
|
|
58
|
+
case 'primary':
|
|
59
|
+
return styles.primary(disabled, flat);
|
|
60
|
+
case 'secondary':
|
|
61
|
+
return styles.secondary(disabled, flat);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Getter for the calculated button props.
|
|
67
|
+
* @returns {Object}
|
|
68
|
+
*/
|
|
69
|
+
}, {
|
|
70
|
+
key: "buttonProps",
|
|
71
|
+
get: function () {
|
|
72
|
+
const {
|
|
73
|
+
className,
|
|
74
|
+
disabled,
|
|
75
|
+
onClick,
|
|
76
|
+
testId,
|
|
77
|
+
type,
|
|
78
|
+
wrapContent,
|
|
79
|
+
flat,
|
|
80
|
+
...rest
|
|
81
|
+
} = this.props;
|
|
82
|
+
const buttonProps = {
|
|
83
|
+
className,
|
|
84
|
+
disabled,
|
|
85
|
+
onClick,
|
|
86
|
+
...rest
|
|
87
|
+
};
|
|
88
|
+
return buttonProps;
|
|
89
|
+
}
|
|
90
|
+
}]);
|
|
91
|
+
}(Component);
|
|
77
92
|
Button.defaultProps = {
|
|
78
93
|
...BaseButton.defaultProps,
|
|
79
94
|
className: '',
|
package/Button/spec.js
CHANGED
|
@@ -3,30 +3,36 @@ import React from 'react';
|
|
|
3
3
|
import { shallow } from 'enzyme';
|
|
4
4
|
import Button from "./index";
|
|
5
5
|
import styles from "./style";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
7
|
describe('<Button />', () => {
|
|
7
8
|
it('should render as a regular button if type is omitted', () => {
|
|
8
|
-
const wrapper = shallow(/*#__PURE__*/
|
|
9
|
+
const wrapper = shallow(/*#__PURE__*/_jsx(Button, {
|
|
10
|
+
children: "Press me"
|
|
11
|
+
}));
|
|
9
12
|
expect(wrapper).toMatchSnapshot();
|
|
10
13
|
expect(wrapper.render().text()).toEqual('Press me');
|
|
11
14
|
});
|
|
12
15
|
it('should render as a regular button if type is explicitly defined', () => {
|
|
13
|
-
const wrapper = shallow(/*#__PURE__*/
|
|
14
|
-
type: "regular"
|
|
15
|
-
|
|
16
|
+
const wrapper = shallow(/*#__PURE__*/_jsx(Button, {
|
|
17
|
+
type: "regular",
|
|
18
|
+
children: "Press me"
|
|
19
|
+
}));
|
|
16
20
|
expect(wrapper).toMatchSnapshot();
|
|
17
21
|
expect(trim(wrapper.prop('className'))).toEqual(`ui-shared__button ${styles.regular(false).button}`);
|
|
18
22
|
});
|
|
19
23
|
it('should render as a primary button', () => {
|
|
20
|
-
const wrapper = shallow(/*#__PURE__*/
|
|
21
|
-
type: "primary"
|
|
22
|
-
|
|
24
|
+
const wrapper = shallow(/*#__PURE__*/_jsx(Button, {
|
|
25
|
+
type: "primary",
|
|
26
|
+
children: "Press me"
|
|
27
|
+
}));
|
|
23
28
|
expect(trim(wrapper.prop('className'))).toEqual(`ui-shared__button ${styles.primary(false, false).button}`);
|
|
24
29
|
expect(wrapper).toMatchSnapshot();
|
|
25
30
|
});
|
|
26
31
|
it('should render as a secondary button', () => {
|
|
27
|
-
const wrapper = shallow(/*#__PURE__*/
|
|
28
|
-
type: "secondary"
|
|
29
|
-
|
|
32
|
+
const wrapper = shallow(/*#__PURE__*/_jsx(Button, {
|
|
33
|
+
type: "secondary",
|
|
34
|
+
children: "Press me"
|
|
35
|
+
}));
|
|
30
36
|
expect(trim(wrapper.prop('className'))).toEqual(`ui-shared__button ${styles.secondary(false, false).button}`);
|
|
31
37
|
expect(wrapper).toMatchSnapshot();
|
|
32
38
|
});
|
package/ButtonLink/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
2
2
|
import React, { Component } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import ActionButton from "../ActionButton";
|
|
@@ -7,35 +7,43 @@ import connect from "./connector";
|
|
|
7
7
|
/**
|
|
8
8
|
* Simple wrapper around ActionButton so it's easy to render buttons which behave as links.
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
let ButtonLink = /*#__PURE__*/function (_Component) {
|
|
12
|
+
function ButtonLink(...args) {
|
|
13
|
+
var _this;
|
|
14
|
+
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
|
13
15
|
/**
|
|
14
16
|
* Opens the given url on click.
|
|
15
17
|
* @returns {undefined}
|
|
16
18
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
_this.handleClick = () => {
|
|
20
|
+
_this.props.navigate(_this.props.href);
|
|
19
21
|
};
|
|
22
|
+
return _this;
|
|
20
23
|
}
|
|
24
|
+
_inheritsLoose(ButtonLink, _Component);
|
|
25
|
+
var _proto = ButtonLink.prototype;
|
|
21
26
|
/**
|
|
22
27
|
* Renders an ActionButton and handles link handling.
|
|
23
28
|
* @returns {JSX.Element}
|
|
24
29
|
*/
|
|
25
|
-
render() {
|
|
30
|
+
_proto.render = function render() {
|
|
26
31
|
const {
|
|
27
32
|
children,
|
|
28
33
|
href,
|
|
29
34
|
navigate,
|
|
30
35
|
...props
|
|
31
36
|
} = this.props;
|
|
32
|
-
return /*#__PURE__*/
|
|
37
|
+
return /*#__PURE__*/_jsx(ActionButton, {
|
|
33
38
|
className: "ui-shared__button-link",
|
|
34
39
|
onClick: this.handleClick,
|
|
35
|
-
type: "secondary"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
40
|
+
type: "secondary",
|
|
41
|
+
...props,
|
|
42
|
+
children: children
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
return ButtonLink;
|
|
46
|
+
}(Component);
|
|
39
47
|
ButtonLink.defaultProps = {
|
|
40
48
|
disabled: false,
|
|
41
49
|
className: '',
|
package/ButtonLink/spec.js
CHANGED
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { shallow } from 'enzyme';
|
|
3
3
|
import ActionButton from "../ActionButton";
|
|
4
4
|
import { UnwrappedButtonLink as ButtonLink } from "./index";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
6
|
describe('<ButtonLink>', () => {
|
|
6
7
|
describe('On click action', () => {
|
|
7
8
|
beforeAll(() => {
|
|
@@ -10,10 +11,11 @@ describe('<ButtonLink>', () => {
|
|
|
10
11
|
it('should create component and open page on click', () => {
|
|
11
12
|
const mockedNavigate = jest.fn();
|
|
12
13
|
const link = 'https://example.com';
|
|
13
|
-
const component = shallow(/*#__PURE__*/
|
|
14
|
+
const component = shallow(/*#__PURE__*/_jsx(ButtonLink, {
|
|
14
15
|
href: link,
|
|
15
|
-
navigate: mockedNavigate
|
|
16
|
-
|
|
16
|
+
navigate: mockedNavigate,
|
|
17
|
+
children: "Text inside"
|
|
18
|
+
}));
|
|
17
19
|
expect(component).toMatchSnapshot();
|
|
18
20
|
component.simulate('click');
|
|
19
21
|
expect(mockedNavigate).toHaveBeenCalledTimes(1);
|
package/Card/index.js
CHANGED
|
@@ -7,14 +7,16 @@ import styles from "./style";
|
|
|
7
7
|
* @param {Object} props The component properties.
|
|
8
8
|
* @returns {JSX}
|
|
9
9
|
*/
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
11
|
const Card = ({
|
|
11
12
|
className,
|
|
12
13
|
children,
|
|
13
14
|
id
|
|
14
|
-
}) => /*#__PURE__*/
|
|
15
|
+
}) => /*#__PURE__*/_jsx("div", {
|
|
15
16
|
className: `ui-shared__card ${styles} ${className}`,
|
|
16
|
-
id: id
|
|
17
|
-
|
|
17
|
+
id: id,
|
|
18
|
+
children: children
|
|
19
|
+
});
|
|
18
20
|
Card.defaultProps = {
|
|
19
21
|
className: '',
|
|
20
22
|
id: null
|
|
@@ -8,6 +8,7 @@ import styles from "./style";
|
|
|
8
8
|
* @param {Object} props The component props.
|
|
9
9
|
* @return {JSX}
|
|
10
10
|
*/
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
const Item = ({
|
|
12
13
|
children,
|
|
13
14
|
className,
|
|
@@ -16,10 +17,11 @@ const Item = ({
|
|
|
16
17
|
if (!Children.count(children)) {
|
|
17
18
|
return null;
|
|
18
19
|
}
|
|
19
|
-
return /*#__PURE__*/
|
|
20
|
+
return /*#__PURE__*/_jsx(ListItem, {
|
|
20
21
|
className: `${styles} ${className}`,
|
|
21
|
-
isSelected: isSelected
|
|
22
|
-
|
|
22
|
+
isSelected: isSelected,
|
|
23
|
+
children: children
|
|
24
|
+
});
|
|
23
25
|
};
|
|
24
26
|
Item.defaultProps = {
|
|
25
27
|
children: null,
|
package/CardList/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
1
2
|
import React, { Component, Children, isValidElement } from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import List from '@shopgate/pwa-common/components/List';
|
|
@@ -6,12 +7,18 @@ import Item from "./components/Item";
|
|
|
6
7
|
/**
|
|
7
8
|
* The CardList component.
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
let CardList = /*#__PURE__*/function (_Component) {
|
|
12
|
+
function CardList() {
|
|
13
|
+
return _Component.apply(this, arguments) || this;
|
|
14
|
+
}
|
|
15
|
+
_inheritsLoose(CardList, _Component);
|
|
16
|
+
var _proto = CardList.prototype;
|
|
10
17
|
/**
|
|
11
18
|
* Renders the component.
|
|
12
19
|
* @return {JSX}
|
|
13
20
|
*/
|
|
14
|
-
render() {
|
|
21
|
+
_proto.render = function render() {
|
|
15
22
|
const {
|
|
16
23
|
children,
|
|
17
24
|
className
|
|
@@ -19,16 +26,18 @@ class CardList extends Component {
|
|
|
19
26
|
if (!Children.count(children)) {
|
|
20
27
|
return null;
|
|
21
28
|
}
|
|
22
|
-
return /*#__PURE__*/
|
|
23
|
-
className: `ui-shared__card-list ${className}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
29
|
+
return /*#__PURE__*/_jsx(List, {
|
|
30
|
+
className: `ui-shared__card-list ${className}`,
|
|
31
|
+
children: Children.map(children, child => {
|
|
32
|
+
if (! /*#__PURE__*/isValidElement(child)) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return child;
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
return CardList;
|
|
40
|
+
}(Component);
|
|
32
41
|
CardList.Item = Item;
|
|
33
42
|
CardList.defaultProps = {
|
|
34
43
|
children: null,
|
|
@@ -8,6 +8,7 @@ import styles from "./style";
|
|
|
8
8
|
* @param {Object} props The component props.
|
|
9
9
|
* @return {JSX}
|
|
10
10
|
*/
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
12
|
const Amount = ({
|
|
12
13
|
amount,
|
|
13
14
|
currency
|
|
@@ -15,14 +16,15 @@ const Amount = ({
|
|
|
15
16
|
if (amount === null) {
|
|
16
17
|
return null;
|
|
17
18
|
}
|
|
18
|
-
return /*#__PURE__*/
|
|
19
|
-
className: styles.amount
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
20
|
+
className: styles.amount,
|
|
21
|
+
children: [typeof amount === 'string' && /*#__PURE__*/_jsx(I18n.Text, {
|
|
22
|
+
string: amount
|
|
23
|
+
}), typeof amount === 'number' && /*#__PURE__*/_jsx(I18n.Price, {
|
|
24
|
+
price: amount,
|
|
25
|
+
currency: currency
|
|
26
|
+
})]
|
|
27
|
+
});
|
|
26
28
|
};
|
|
27
29
|
Amount.defaultProps = {
|
|
28
30
|
amount: null,
|
|
@@ -8,17 +8,19 @@ import styles from "./style";
|
|
|
8
8
|
* @param {Object} props The component props.
|
|
9
9
|
* @return {JSX|null}
|
|
10
10
|
*/
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
const Hint = ({
|
|
12
13
|
hint
|
|
13
14
|
}) => {
|
|
14
15
|
if (hint === null) {
|
|
15
16
|
return null;
|
|
16
17
|
}
|
|
17
|
-
return /*#__PURE__*/
|
|
18
|
-
className: styles.hint
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
return /*#__PURE__*/_jsx("div", {
|
|
19
|
+
className: styles.hint,
|
|
20
|
+
children: /*#__PURE__*/_jsx(I18n.Text, {
|
|
21
|
+
string: hint
|
|
22
|
+
})
|
|
23
|
+
});
|
|
22
24
|
};
|
|
23
25
|
Hint.defaultProps = {
|
|
24
26
|
hint: null
|
|
@@ -9,6 +9,7 @@ import styles from "./style";
|
|
|
9
9
|
* @param {Object} props The component props.
|
|
10
10
|
* @return {JSX|null}
|
|
11
11
|
*/
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
13
|
function Label({
|
|
13
14
|
label,
|
|
14
15
|
showSeparator,
|
|
@@ -16,19 +17,20 @@ function Label({
|
|
|
16
17
|
suffix
|
|
17
18
|
}) {
|
|
18
19
|
if (!label) {
|
|
19
|
-
return /*#__PURE__*/
|
|
20
|
+
return /*#__PURE__*/_jsx("div", {
|
|
20
21
|
className: styles.label
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
|
-
return /*#__PURE__*/
|
|
24
|
-
className: styles.label
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
25
|
+
className: styles.label,
|
|
26
|
+
children: [/*#__PURE__*/_jsx(I18n.Text, {
|
|
27
|
+
string: label,
|
|
28
|
+
params: labelParams,
|
|
29
|
+
className: classNames({
|
|
30
|
+
[styles.labelWithSuffix]: !!suffix
|
|
31
|
+
})
|
|
32
|
+
}), suffix, `${showSeparator ? ':' : ''}`]
|
|
33
|
+
});
|
|
32
34
|
}
|
|
33
35
|
Label.defaultProps = {
|
|
34
36
|
label: null,
|
|
@@ -5,12 +5,14 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
* @param {props} The component props
|
|
6
6
|
* @returns {JSX}
|
|
7
7
|
*/
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
const Spacer = ({
|
|
9
10
|
children,
|
|
10
11
|
className
|
|
11
|
-
}) => /*#__PURE__*/
|
|
12
|
-
className: className
|
|
13
|
-
|
|
12
|
+
}) => /*#__PURE__*/_jsx("div", {
|
|
13
|
+
className: className,
|
|
14
|
+
children: children
|
|
15
|
+
});
|
|
14
16
|
Spacer.defaultProps = {
|
|
15
17
|
children: null,
|
|
16
18
|
className: null
|
package/CartTotalLine/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import styles from "./style";
|
|
|
10
10
|
/**
|
|
11
11
|
* @returns {JSX}
|
|
12
12
|
*/
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
const CartTotalLine = ({
|
|
14
15
|
children,
|
|
15
16
|
type,
|
|
@@ -19,13 +20,14 @@ const CartTotalLine = ({
|
|
|
19
20
|
if (!children) {
|
|
20
21
|
return null;
|
|
21
22
|
}
|
|
22
|
-
return /*#__PURE__*/
|
|
23
|
+
return /*#__PURE__*/_jsx("div", {
|
|
23
24
|
className: classNames(className, `ui-shared__cart-total-line ui-shared__cart-${type}-line`, styles.line, {
|
|
24
25
|
[styles.disabled]: isDisabled,
|
|
25
26
|
[styles[type] || styles.base]: true
|
|
26
27
|
}),
|
|
27
|
-
"data-test-id": `${type}CartTotal
|
|
28
|
-
|
|
28
|
+
"data-test-id": `${type}CartTotal`,
|
|
29
|
+
children: children
|
|
30
|
+
});
|
|
29
31
|
};
|
|
30
32
|
CartTotalLine.defaultProps = {
|
|
31
33
|
children: null,
|
package/Checkbox/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
import classNames from 'classnames';
|
|
@@ -15,20 +14,22 @@ import styles from "./style";
|
|
|
15
14
|
* @param {string} props.unCheckedClassName Class for unchecked icon.
|
|
16
15
|
* @returns {JSX.Element}
|
|
17
16
|
*/
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
18
|
const Checkbox = ({
|
|
19
19
|
checkedClassName,
|
|
20
20
|
unCheckedClassName,
|
|
21
21
|
className,
|
|
22
22
|
...props
|
|
23
|
-
}) => /*#__PURE__*/
|
|
23
|
+
}) => /*#__PURE__*/_jsx(BaseCheckbox, {
|
|
24
|
+
...props,
|
|
24
25
|
className: `ui-shared__checkbox ${className}`,
|
|
25
|
-
checkedIcon: /*#__PURE__*/
|
|
26
|
+
checkedIcon: /*#__PURE__*/_jsx(CheckedIcon, {
|
|
26
27
|
className: classNames(styles.icon, checkedClassName, 'checkedIcon')
|
|
27
28
|
}),
|
|
28
|
-
uncheckedIcon: /*#__PURE__*/
|
|
29
|
+
uncheckedIcon: /*#__PURE__*/_jsx(UncheckedIcon, {
|
|
29
30
|
className: classNames(styles.icon, unCheckedClassName, 'uncheckedIcon')
|
|
30
31
|
})
|
|
31
|
-
})
|
|
32
|
+
});
|
|
32
33
|
Checkbox.defaultProps = {
|
|
33
34
|
checkedClassName: styles.checkedIcon,
|
|
34
35
|
className: '',
|
package/Chip/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import styles from "./style";
|
|
|
10
10
|
* @param {Object} props The component props.
|
|
11
11
|
* @returns {JSX}
|
|
12
12
|
*/
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
14
|
function Chip(props) {
|
|
14
15
|
const {
|
|
15
16
|
removable,
|
|
@@ -28,30 +29,35 @@ function Chip(props) {
|
|
|
28
29
|
useEffect(() => {
|
|
29
30
|
ref.current.removeAttribute('style');
|
|
30
31
|
});
|
|
31
|
-
return /*#__PURE__*/
|
|
32
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
32
33
|
ref: ref,
|
|
33
34
|
className: `ui-shared__chip ${styles.chip(removable, invert)}`,
|
|
34
|
-
"data-test-id": id
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
35
|
+
"data-test-id": id,
|
|
36
|
+
children: [removable && /*#__PURE__*/_jsxs(Button, {
|
|
37
|
+
className: styles.removeButton,
|
|
38
|
+
onClick: handleRemove,
|
|
39
|
+
testId: "removeFilter",
|
|
40
|
+
"aria-label": removeLabel,
|
|
41
|
+
children: [/*#__PURE__*/_jsx(ResponsiveContainer, {
|
|
42
|
+
breakpoint: "<=xs",
|
|
43
|
+
appAlways: true,
|
|
44
|
+
children: /*#__PURE__*/_jsx(CrossIcon, {
|
|
45
|
+
size: 16
|
|
46
|
+
})
|
|
47
|
+
}), /*#__PURE__*/_jsx(ResponsiveContainer, {
|
|
48
|
+
breakpoint: ">xs",
|
|
49
|
+
webOnly: true,
|
|
50
|
+
children: /*#__PURE__*/_jsx(CrossIcon, {
|
|
51
|
+
size: 18
|
|
52
|
+
})
|
|
53
|
+
})]
|
|
54
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
55
|
+
className: styles.name,
|
|
56
|
+
onClick: onClick,
|
|
57
|
+
"aria-label": editLabel,
|
|
58
|
+
children: children
|
|
59
|
+
})]
|
|
60
|
+
});
|
|
55
61
|
}
|
|
56
62
|
Chip.defaultProps = {
|
|
57
63
|
invert: false,
|
package/Chip/spec.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { mount } from 'enzyme';
|
|
3
3
|
import Chip from '.';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
5
|
describe('<Chip />', () => {
|
|
5
6
|
it('should render a tag', () => {
|
|
6
|
-
const wrapper = mount(/*#__PURE__*/
|
|
7
|
-
id: "some-id"
|
|
8
|
-
|
|
7
|
+
const wrapper = mount(/*#__PURE__*/_jsx(Chip, {
|
|
8
|
+
id: "some-id",
|
|
9
|
+
children: "text"
|
|
10
|
+
}));
|
|
9
11
|
expect(wrapper).toMatchSnapshot();
|
|
10
12
|
expect(wrapper.find('button').length).toEqual(2);
|
|
11
13
|
expect(wrapper.find('button').at(1).text()).toEqual('text');
|
|
@@ -13,10 +15,11 @@ describe('<Chip />', () => {
|
|
|
13
15
|
});
|
|
14
16
|
describe('<Chip />', () => {
|
|
15
17
|
it('should render a without removable icon', () => {
|
|
16
|
-
const wrapper = mount(/*#__PURE__*/
|
|
18
|
+
const wrapper = mount(/*#__PURE__*/_jsx(Chip, {
|
|
17
19
|
id: "some-id",
|
|
18
|
-
removable: false
|
|
19
|
-
|
|
20
|
+
removable: false,
|
|
21
|
+
children: "text"
|
|
22
|
+
}));
|
|
20
23
|
expect(wrapper).toMatchSnapshot();
|
|
21
24
|
expect(wrapper.find('button').length).toEqual(1);
|
|
22
25
|
expect(wrapper.find('button').at(0).text()).toEqual('text');
|