@shopgate/pwa-ui-shared 7.30.0-alpha.10 → 7.30.0-alpha.12
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 +47 -33
- package/ActionButton/spec.js +5 -1
- package/AddToCartButton/index.js +44 -33
- package/AddToCartButton/mock.js +20 -8
- package/AddToCartButton/spec.js +4 -3
- 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 +10 -9
- 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 +12 -10
- 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/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
|
@@ -9,39 +9,46 @@ import styles from "./style";
|
|
|
9
9
|
/**
|
|
10
10
|
* @return {JSX}
|
|
11
11
|
*/
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
13
|
const SearchBar = ({
|
|
13
14
|
handleChange
|
|
14
15
|
}) => {
|
|
15
16
|
const [query, setQuery] = useState('');
|
|
16
17
|
const name = 'search';
|
|
17
|
-
return /*#__PURE__*/
|
|
18
|
+
return /*#__PURE__*/_jsx("div", {
|
|
18
19
|
className: "ui-shared__sheet__search-field",
|
|
19
|
-
"data-test-id": "SearchField"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
20
|
+
"data-test-id": "SearchField",
|
|
21
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
22
|
+
className: styles.container,
|
|
23
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
24
|
+
className: styles.inputWrapper,
|
|
25
|
+
children: /*#__PURE__*/_jsxs("form", {
|
|
26
|
+
onSubmit: e => {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
},
|
|
29
|
+
children: [/*#__PURE__*/_jsxs("label", {
|
|
30
|
+
htmlFor: name,
|
|
31
|
+
className: styles.label,
|
|
32
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
33
|
+
className: styles.icon,
|
|
34
|
+
children: /*#__PURE__*/_jsx(MagnifierIcon, {})
|
|
35
|
+
}), !query.length && /*#__PURE__*/_jsx(I18n.Text, {
|
|
36
|
+
string: "search.placeholder"
|
|
37
|
+
})]
|
|
38
|
+
}), /*#__PURE__*/_jsx(Input, {
|
|
39
|
+
name: name,
|
|
40
|
+
autoComplete: false,
|
|
41
|
+
className: classNames(styles.input),
|
|
42
|
+
onChange: value => {
|
|
43
|
+
handleChange(value);
|
|
44
|
+
setQuery(value);
|
|
45
|
+
},
|
|
46
|
+
value: query,
|
|
47
|
+
type: "search"
|
|
48
|
+
})]
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
});
|
|
46
53
|
};
|
|
47
54
|
export default SearchBar;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { mount } from 'enzyme';
|
|
3
3
|
import SearchBar from "./index";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
5
|
describe('<SearchBar />', () => {
|
|
5
6
|
it('should call handleChange on input', async () => {
|
|
6
7
|
const handleChange = jest.fn();
|
|
7
|
-
const wrapper = await mount(/*#__PURE__*/
|
|
8
|
+
const wrapper = await mount(/*#__PURE__*/_jsx(SearchBar, {
|
|
8
9
|
handleChange: handleChange
|
|
9
10
|
}));
|
|
10
11
|
expect(wrapper).toMatchSnapshot();
|
|
@@ -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 classNames from 'classnames';
|
|
@@ -11,20 +11,26 @@ import SearchBar from "./components/SearchBar";
|
|
|
11
11
|
/**
|
|
12
12
|
* Header component.
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
let Header = /*#__PURE__*/function (_Component) {
|
|
16
|
+
function Header() {
|
|
17
|
+
return _Component.apply(this, arguments) || this;
|
|
18
|
+
}
|
|
19
|
+
_inheritsLoose(Header, _Component);
|
|
20
|
+
var _proto = Header.prototype;
|
|
15
21
|
/**
|
|
16
22
|
* @param {Object} nextProps Next Props
|
|
17
23
|
* @returns {boolean}
|
|
18
24
|
*/
|
|
19
|
-
shouldComponentUpdate(nextProps) {
|
|
25
|
+
_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
|
|
20
26
|
return this.props.shadow !== nextProps.shadow || this.props.title !== nextProps.title;
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
/**
|
|
24
30
|
* Renders the component.
|
|
25
31
|
* @returns {JSX}
|
|
26
|
-
|
|
27
|
-
render() {
|
|
32
|
+
*/;
|
|
33
|
+
_proto.render = function render() {
|
|
28
34
|
const {
|
|
29
35
|
allowClose
|
|
30
36
|
} = this.props;
|
|
@@ -32,37 +38,44 @@ class Header extends Component {
|
|
|
32
38
|
const {
|
|
33
39
|
__
|
|
34
40
|
} = this.context.i18n();
|
|
35
|
-
return /*#__PURE__*/
|
|
41
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
36
42
|
className: classNames({
|
|
37
43
|
[styles.shadow]: this.props.shadow
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
44
|
+
}),
|
|
45
|
+
children: [/*#__PURE__*/_jsxs(Grid, {
|
|
46
|
+
className: classes,
|
|
47
|
+
component: "div",
|
|
48
|
+
wrap: false,
|
|
49
|
+
children: [allowClose ? /*#__PURE__*/_jsx("button", {
|
|
50
|
+
className: styles.closeButton,
|
|
51
|
+
onClick: this.props.onToggleClose,
|
|
52
|
+
"aria-label": __('common.close'),
|
|
53
|
+
type: "button",
|
|
54
|
+
children: /*#__PURE__*/_jsx(Ripple, {
|
|
55
|
+
className: styles.closeIcon,
|
|
56
|
+
children: /*#__PURE__*/_jsx(CrossIcon, {
|
|
57
|
+
size: 24
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
}) : /*#__PURE__*/_jsx("div", {
|
|
61
|
+
className: styles.closePlaceholder
|
|
62
|
+
}), /*#__PURE__*/_jsx(Grid.Item, {
|
|
63
|
+
className: styles.title,
|
|
64
|
+
component: "div",
|
|
65
|
+
grow: 1,
|
|
66
|
+
role: "heading",
|
|
67
|
+
...(allowClose ? {
|
|
68
|
+
tabIndex: 0
|
|
69
|
+
} : null),
|
|
70
|
+
children: this.props.title
|
|
71
|
+
})]
|
|
72
|
+
}), this.props.showSearch && /*#__PURE__*/_jsx(SearchBar, {
|
|
73
|
+
handleChange: this.props.handleChange
|
|
74
|
+
})]
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
return Header;
|
|
78
|
+
}(Component);
|
|
66
79
|
/**
|
|
67
80
|
* The component's default props.
|
|
68
81
|
* @type {Object}
|
|
@@ -2,10 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { shallow } from 'enzyme';
|
|
3
3
|
import mockRenderOptions from '@shopgate/pwa-common/helpers/mocks/mockRenderOptions';
|
|
4
4
|
import Header from "./index";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
6
|
describe('<Header />', () => {
|
|
6
7
|
it('should render with correct title', () => {
|
|
7
8
|
const title = 'My Title';
|
|
8
|
-
const wrapper = shallow(/*#__PURE__*/
|
|
9
|
+
const wrapper = shallow(/*#__PURE__*/_jsx(Header, {
|
|
9
10
|
title: title
|
|
10
11
|
}), mockRenderOptions);
|
|
11
12
|
expect(wrapper).toMatchSnapshot();
|
package/Sheet/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
2
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
1
3
|
import React, { Component } from 'react';
|
|
2
4
|
import PropTypes from 'prop-types';
|
|
3
5
|
import throttle from 'lodash/throttle';
|
|
@@ -8,6 +10,7 @@ import Drawer from '@shopgate/pwa-common/components/Drawer';
|
|
|
8
10
|
import ProgressBar from "../ProgressBar";
|
|
9
11
|
import Header from "./components/Header";
|
|
10
12
|
import styles from "./style";
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
14
|
export const SHEET_EVENTS = {
|
|
12
15
|
OPEN: 'Sheet.open',
|
|
13
16
|
CLOSE: 'Sheet.close'
|
|
@@ -16,20 +19,21 @@ export const SHEET_EVENTS = {
|
|
|
16
19
|
/**
|
|
17
20
|
* Sheet component.
|
|
18
21
|
*/
|
|
19
|
-
|
|
22
|
+
let Sheet = /*#__PURE__*/function (_Component) {
|
|
20
23
|
/**
|
|
21
24
|
* The constructor.
|
|
22
25
|
* @param {Object} props The component props.
|
|
23
26
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
function Sheet(props) {
|
|
28
|
+
var _this;
|
|
29
|
+
_this = _Component.call(this, props) || this;
|
|
26
30
|
/**
|
|
27
31
|
* Close the Sheet.
|
|
28
32
|
*/
|
|
29
|
-
|
|
30
|
-
const scrolled =
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
+
_this.handleScroll = throttle(() => {
|
|
34
|
+
const scrolled = _this.content.current.scrollTop !== 0;
|
|
35
|
+
if (_this.state.scrolled !== scrolled) {
|
|
36
|
+
_this.setState({
|
|
33
37
|
scrolled
|
|
34
38
|
});
|
|
35
39
|
}
|
|
@@ -37,45 +41,48 @@ class Sheet extends Component {
|
|
|
37
41
|
/**
|
|
38
42
|
* Close the Sheet.
|
|
39
43
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
_this.handleClose = () => {
|
|
45
|
+
_this.props.onClose();
|
|
46
|
+
_this.setState({
|
|
43
47
|
isOpen: false,
|
|
44
48
|
scrolled: false
|
|
45
49
|
});
|
|
46
50
|
};
|
|
47
51
|
/** The Sheet is opened */
|
|
48
|
-
|
|
52
|
+
_this.handleDidOpen = () => {
|
|
49
53
|
UIEvents.emit(SHEET_EVENTS.OPEN);
|
|
50
|
-
|
|
54
|
+
_this.props.onDidOpen();
|
|
51
55
|
};
|
|
52
56
|
/** The Sheet is closed */
|
|
53
|
-
|
|
57
|
+
_this.handleDidClose = () => {
|
|
54
58
|
UIEvents.emit(SHEET_EVENTS.CLOSE);
|
|
55
|
-
|
|
59
|
+
_this.props.onDidClose();
|
|
56
60
|
};
|
|
57
61
|
/**
|
|
58
62
|
* New value from SearchBar
|
|
59
63
|
* @param {string} value .
|
|
60
64
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
_this.handleSearchInput = value => {
|
|
66
|
+
_this.setState({
|
|
63
67
|
query: value
|
|
64
68
|
});
|
|
65
69
|
};
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
_this.content = /*#__PURE__*/React.createRef();
|
|
71
|
+
_this.state = {
|
|
68
72
|
isOpen: props.isOpen,
|
|
69
73
|
scrolled: false,
|
|
70
74
|
query: ''
|
|
71
75
|
};
|
|
76
|
+
return _this;
|
|
72
77
|
}
|
|
73
78
|
|
|
74
79
|
/**
|
|
75
80
|
* Change isOpen state for new incoming props.
|
|
76
81
|
* @param {Object} nextProps The next component props.
|
|
77
82
|
*/
|
|
78
|
-
|
|
83
|
+
_inheritsLoose(Sheet, _Component);
|
|
84
|
+
var _proto = Sheet.prototype;
|
|
85
|
+
_proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps({
|
|
79
86
|
isOpen
|
|
80
87
|
}) {
|
|
81
88
|
if (this.state.isOpen !== isOpen) {
|
|
@@ -83,23 +90,12 @@ class Sheet extends Component {
|
|
|
83
90
|
isOpen
|
|
84
91
|
});
|
|
85
92
|
}
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Getter for the animation props of the Sheet.
|
|
89
|
-
* @returns {Object}
|
|
90
|
-
*/
|
|
91
|
-
get animationProps() {
|
|
92
|
-
return {
|
|
93
|
-
duration: this.props.duration,
|
|
94
|
-
...styles.drawerAnimation,
|
|
95
|
-
...this.props.animation
|
|
96
|
-
};
|
|
97
|
-
}
|
|
93
|
+
};
|
|
98
94
|
/**
|
|
99
95
|
* Renders the component.
|
|
100
96
|
* @returns {JSX}
|
|
101
97
|
*/
|
|
102
|
-
render() {
|
|
98
|
+
_proto.render = function render() {
|
|
103
99
|
const {
|
|
104
100
|
allowClose
|
|
105
101
|
} = this.props;
|
|
@@ -119,41 +115,60 @@ class Sheet extends Component {
|
|
|
119
115
|
}, {
|
|
120
116
|
[styles.shadow]: !this.props.backdrop
|
|
121
117
|
});
|
|
122
|
-
return /*#__PURE__*/
|
|
118
|
+
return /*#__PURE__*/_jsxs("section", {
|
|
123
119
|
className: classNames('ui-shared__sheet', {
|
|
124
120
|
[styles.section]: this.state.isOpen
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
121
|
+
}),
|
|
122
|
+
children: [/*#__PURE__*/_jsxs(Drawer, {
|
|
123
|
+
className: drawerClassNames,
|
|
124
|
+
isOpen: this.state.isOpen,
|
|
125
|
+
onDidOpen: this.handleDidOpen,
|
|
126
|
+
onDidClose: this.handleDidClose,
|
|
127
|
+
onOpen: this.props.onOpen,
|
|
128
|
+
onClose: this.handleClose,
|
|
129
|
+
animation: this.animationProps,
|
|
130
|
+
children: [this.props.title && /*#__PURE__*/_jsx(Sheet.Header, {
|
|
131
|
+
showSearch: this.props.showSearch,
|
|
132
|
+
handleChange: this.handleSearchInput,
|
|
133
|
+
onToggleClose: this.handleClose,
|
|
134
|
+
shadow: this.state.scrolled,
|
|
135
|
+
title: this.props.title,
|
|
136
|
+
allowClose: allowClose
|
|
137
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
138
|
+
className: styles.progressBarContainer,
|
|
139
|
+
children: /*#__PURE__*/_jsx(ProgressBar, {
|
|
140
|
+
isVisible: this.props.isLoading
|
|
141
|
+
})
|
|
142
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
143
|
+
ref: this.content,
|
|
144
|
+
onScroll: this.handleScroll,
|
|
145
|
+
className: contentClassNames,
|
|
146
|
+
children: children
|
|
147
|
+
})]
|
|
148
|
+
}), this.props.backdrop && /*#__PURE__*/_jsx(Backdrop, {
|
|
149
|
+
isVisible: this.state.isOpen,
|
|
150
|
+
level: 4,
|
|
151
|
+
onClick: allowClose ? this.handleClose : () => {},
|
|
152
|
+
opacity: 20
|
|
153
|
+
})]
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
return _createClass(Sheet, [{
|
|
157
|
+
key: "animationProps",
|
|
158
|
+
get:
|
|
159
|
+
/**
|
|
160
|
+
* Getter for the animation props of the Sheet.
|
|
161
|
+
* @returns {Object}
|
|
162
|
+
*/
|
|
163
|
+
function () {
|
|
164
|
+
return {
|
|
165
|
+
duration: this.props.duration,
|
|
166
|
+
...styles.drawerAnimation,
|
|
167
|
+
...this.props.animation
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}]);
|
|
171
|
+
}(Component);
|
|
157
172
|
Sheet.Header = Header;
|
|
158
173
|
/**
|
|
159
174
|
* The component default props.
|
package/Sheet/spec.js
CHANGED
|
@@ -3,6 +3,7 @@ import { shallow, mount } from 'enzyme';
|
|
|
3
3
|
import mockRenderOptions from '@shopgate/pwa-common/helpers/mocks/mockRenderOptions';
|
|
4
4
|
import UIEvents from '@shopgate/pwa-core/emitters/ui';
|
|
5
5
|
import Sheet, { SHEET_EVENTS } from "./index";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
7
|
window.requestAnimationFrame = () => {};
|
|
7
8
|
jest.mock('@shopgate/pwa-core/emitters/ui', () => ({
|
|
8
9
|
emit: jest.fn()
|
|
@@ -10,30 +11,36 @@ jest.mock('@shopgate/pwa-core/emitters/ui', () => ({
|
|
|
10
11
|
jest.mock('@shopgate/engage/a11y/components');
|
|
11
12
|
describe('<Sheet />', () => {
|
|
12
13
|
it('should render closed without content', () => {
|
|
13
|
-
const wrapper = shallow(/*#__PURE__*/
|
|
14
|
+
const wrapper = shallow(/*#__PURE__*/_jsx(Sheet, {}));
|
|
14
15
|
expect(wrapper).toMatchSnapshot();
|
|
15
16
|
});
|
|
16
17
|
it('should render opened without content', () => {
|
|
17
|
-
const wrapper = shallow(/*#__PURE__*/
|
|
18
|
+
const wrapper = shallow(/*#__PURE__*/_jsx(Sheet, {
|
|
18
19
|
isOpen: true
|
|
19
20
|
}));
|
|
20
21
|
expect(wrapper).toMatchSnapshot();
|
|
21
22
|
});
|
|
22
23
|
it('should render with content and title', () => {
|
|
23
|
-
const wrapper = shallow(/*#__PURE__*/
|
|
24
|
+
const wrapper = shallow(/*#__PURE__*/_jsx(Sheet, {
|
|
24
25
|
isOpen: true,
|
|
25
|
-
title: "Test-Title"
|
|
26
|
-
|
|
26
|
+
title: "Test-Title",
|
|
27
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
28
|
+
children: "Test"
|
|
29
|
+
})
|
|
30
|
+
}));
|
|
27
31
|
expect(wrapper).toMatchSnapshot();
|
|
28
32
|
});
|
|
29
33
|
it('should call onDidOpen callback when the Sheet was opened', () => {
|
|
30
34
|
const onOpen = jest.fn();
|
|
31
35
|
const onDidOpen = jest.fn();
|
|
32
|
-
const wrapper = mount(/*#__PURE__*/
|
|
36
|
+
const wrapper = mount(/*#__PURE__*/_jsx(Sheet, {
|
|
33
37
|
isOpen: false,
|
|
34
38
|
onOpen: onOpen,
|
|
35
|
-
onDidOpen: onDidOpen
|
|
36
|
-
|
|
39
|
+
onDidOpen: onDidOpen,
|
|
40
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
41
|
+
children: "Test"
|
|
42
|
+
})
|
|
43
|
+
}), mockRenderOptions);
|
|
37
44
|
expect(onOpen).not.toHaveBeenCalled();
|
|
38
45
|
expect(onDidOpen).not.toHaveBeenCalled();
|
|
39
46
|
wrapper.setProps({
|
|
@@ -46,11 +53,14 @@ describe('<Sheet />', () => {
|
|
|
46
53
|
});
|
|
47
54
|
it('should trigger onClose callback and close the Sheet', () => {
|
|
48
55
|
const onCloseSpy = jest.fn();
|
|
49
|
-
const wrapper = mount(/*#__PURE__*/
|
|
56
|
+
const wrapper = mount(/*#__PURE__*/_jsx(Sheet, {
|
|
50
57
|
isOpen: true,
|
|
51
58
|
title: "Test-Title",
|
|
52
|
-
onClose: onCloseSpy
|
|
53
|
-
|
|
59
|
+
onClose: onCloseSpy,
|
|
60
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
61
|
+
children: "Test"
|
|
62
|
+
})
|
|
63
|
+
}), mockRenderOptions);
|
|
54
64
|
|
|
55
65
|
// Trigger a click on the close button of the Sheet.
|
|
56
66
|
wrapper.find('button').first().simulate('click');
|
|
@@ -71,10 +81,13 @@ describe('<Sheet />', () => {
|
|
|
71
81
|
});
|
|
72
82
|
});
|
|
73
83
|
it('should open', () => {
|
|
74
|
-
const wrapper = mount(/*#__PURE__*/
|
|
84
|
+
const wrapper = mount(/*#__PURE__*/_jsx(Sheet, {
|
|
75
85
|
isOpen: false,
|
|
76
|
-
title: "Test-Title"
|
|
77
|
-
|
|
86
|
+
title: "Test-Title",
|
|
87
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
88
|
+
children: "Test"
|
|
89
|
+
})
|
|
90
|
+
}), mockRenderOptions);
|
|
78
91
|
wrapper.setProps({
|
|
79
92
|
isOpen: true
|
|
80
93
|
});
|
package/TaxDisclaimer/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import styles from "./style";
|
|
|
10
10
|
* TaxDisclaimer component.
|
|
11
11
|
* @returns {Function}
|
|
12
12
|
*/
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
const TaxDisclaimer = () => {
|
|
14
15
|
// Added with PWA 6 - CCP-2372
|
|
15
16
|
const {
|
|
@@ -19,18 +20,20 @@ const TaxDisclaimer = () => {
|
|
|
19
20
|
|
|
20
21
|
// use widget setting if set to true/false, otherwise use market logic
|
|
21
22
|
const showDisclaimer = typeof show === 'boolean' ? show : showTaxDisclaimer;
|
|
22
|
-
return /*#__PURE__*/
|
|
23
|
+
return /*#__PURE__*/_jsx(SurroundPortals, {
|
|
23
24
|
portalName: PRODUCT_TAX_DISCLAIMER,
|
|
24
25
|
portalProps: {
|
|
25
26
|
showTaxDisclaimer: showDisclaimer
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
},
|
|
28
|
+
children: showDisclaimer && /*#__PURE__*/_jsx("div", {
|
|
29
|
+
"data-test-id": "taxDisclaimer",
|
|
30
|
+
"aria-hidden": true,
|
|
31
|
+
className: "ui-shared__tax-disclaimer",
|
|
32
|
+
children: /*#__PURE__*/_jsx(I18n.Text, {
|
|
33
|
+
className: styles,
|
|
34
|
+
string: text || 'product.tax_disclaimer'
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
});
|
|
35
38
|
};
|
|
36
39
|
export default TaxDisclaimer;
|
package/TaxDisclaimer/spec.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { shallow } from 'enzyme';
|
|
3
3
|
import I18n from '@shopgate/pwa-common/components/I18n';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
5
|
jest.mock('@shopgate/engage/core/hooks/useWidgetSettings', () => ({
|
|
5
6
|
useWidgetSettings: jest.fn().mockReturnValue({
|
|
6
7
|
show: null,
|
|
@@ -16,7 +17,7 @@ describe('<TaxDisclaimer />', () => {
|
|
|
16
17
|
jest.mock('@shopgate/pwa-common-commerce/market/helpers/showTaxDisclaimer', () => true);
|
|
17
18
|
// eslint-disable-next-line global-require
|
|
18
19
|
const TaxDisclaimer = require("./index").default;
|
|
19
|
-
const wrapper = shallow(/*#__PURE__*/
|
|
20
|
+
const wrapper = shallow(/*#__PURE__*/_jsx(TaxDisclaimer, {}));
|
|
20
21
|
expect(wrapper).toMatchSnapshot();
|
|
21
22
|
expect(wrapper.find(I18n.Text).exists()).toBe(true);
|
|
22
23
|
});
|
|
@@ -24,7 +25,7 @@ describe('<TaxDisclaimer />', () => {
|
|
|
24
25
|
jest.mock('@shopgate/pwa-common-commerce/market/helpers/showTaxDisclaimer', () => false);
|
|
25
26
|
// eslint-disable-next-line global-require
|
|
26
27
|
const TaxDisclaimer = require("./index").default;
|
|
27
|
-
const wrapper = shallow(/*#__PURE__*/
|
|
28
|
+
const wrapper = shallow(/*#__PURE__*/_jsx(TaxDisclaimer, {}));
|
|
28
29
|
expect(wrapper).toMatchSnapshot();
|
|
29
30
|
expect(wrapper.find(I18n.Text).exists()).toBe(false);
|
|
30
31
|
});
|
|
@@ -9,6 +9,7 @@ import styles from "./style";
|
|
|
9
9
|
* @param {Object} props The component props.
|
|
10
10
|
* @returns {JSX.Element}
|
|
11
11
|
*/
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
13
|
const ErrorText = ({
|
|
13
14
|
elementName,
|
|
14
15
|
validationError,
|
|
@@ -16,15 +17,16 @@ const ErrorText = ({
|
|
|
16
17
|
ariaHidden,
|
|
17
18
|
translate,
|
|
18
19
|
className
|
|
19
|
-
}) => /*#__PURE__*/
|
|
20
|
+
}) => /*#__PURE__*/_jsxs("div", {
|
|
20
21
|
id: `ariaError-${elementName}`,
|
|
21
22
|
className: classNames(className, styles.error, 'errorText'),
|
|
22
23
|
"aria-live": "assertive",
|
|
23
24
|
"aria-atomic": "true",
|
|
24
|
-
"aria-hidden": ariaHidden
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}), !translate && (validationError || errorText)
|
|
25
|
+
"aria-hidden": ariaHidden,
|
|
26
|
+
children: [translate && /*#__PURE__*/_jsx(I18n.Text, {
|
|
27
|
+
string: validationError || errorText
|
|
28
|
+
}), !translate && (validationError || errorText)]
|
|
29
|
+
});
|
|
28
30
|
ErrorText.defaultProps = {
|
|
29
31
|
className: '',
|
|
30
32
|
errorText: null,
|
|
@@ -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 Input from '@shopgate/pwa-common/components/Input';
|
|
@@ -9,12 +8,14 @@ import styles from "./style";
|
|
|
9
8
|
* @param {Object} props The props.
|
|
10
9
|
* @returns {JSX.Element}
|
|
11
10
|
*/
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
const FormElement = props => {
|
|
13
13
|
const styleType = props.multiLine ? 'multiLine' : 'input';
|
|
14
|
-
return /*#__PURE__*/
|
|
14
|
+
return /*#__PURE__*/_jsx(Input, {
|
|
15
|
+
...props,
|
|
15
16
|
className: styles[styleType],
|
|
16
17
|
validateOnBlur: true
|
|
17
|
-
})
|
|
18
|
+
});
|
|
18
19
|
};
|
|
19
20
|
FormElement.defaultProps = {
|
|
20
21
|
multiLine: false
|
|
@@ -10,14 +10,16 @@ import styles from "./style";
|
|
|
10
10
|
* @param {boolean} visible Sets the hint visibility.
|
|
11
11
|
* @return {JSX}
|
|
12
12
|
*/
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
const Hint = ({
|
|
14
15
|
hintText,
|
|
15
16
|
visible
|
|
16
|
-
}) => /*#__PURE__*/
|
|
17
|
-
className: classNames(styles.hintStyles(visible), 'hint')
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
})
|
|
17
|
+
}) => /*#__PURE__*/_jsx("div", {
|
|
18
|
+
className: classNames(styles.hintStyles(visible), 'hint'),
|
|
19
|
+
children: /*#__PURE__*/_jsx(I18n.Text, {
|
|
20
|
+
string: hintText
|
|
21
|
+
})
|
|
22
|
+
});
|
|
21
23
|
Hint.defaultProps = {
|
|
22
24
|
hintText: '',
|
|
23
25
|
visible: false
|