@shopgate/pwa-ui-material 7.29.9 → 7.30.0-alpha.11
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/Accordion/components/AccordionContent/index.js +55 -2
- package/Accordion/components/AccordionContent/spec.js +37 -1
- package/Accordion/components/AccordionContent/style.js +9 -1
- package/Accordion/index.js +100 -2
- package/Accordion/spec.js +41 -1
- package/Accordion/style.js +47 -1
- package/AppBar/components/Below/index.js +26 -2
- package/AppBar/components/Center/index.js +26 -2
- package/AppBar/components/Field/index.js +48 -3
- package/AppBar/components/Field/style.js +14 -1
- package/AppBar/components/Icon/index.js +52 -3
- package/AppBar/components/Icon/style.js +14 -1
- package/AppBar/components/Left/index.js +26 -2
- package/AppBar/components/Right/index.js +26 -2
- package/AppBar/components/Title/index.js +46 -3
- package/AppBar/components/Title/style.js +11 -1
- package/AppBar/index.js +91 -3
- package/AppBar/style.js +21 -1
- package/BaseDialog/components/Buttons/index.js +29 -2
- package/BaseDialog/components/Buttons/spec.js +29 -1
- package/BaseDialog/components/Content/index.js +23 -2
- package/BaseDialog/components/Content/spec.js +18 -1
- package/BaseDialog/components/Title/index.js +32 -2
- package/BaseDialog/components/Title/spec.js +18 -1
- package/BaseDialog/index.js +46 -2
- package/BaseDialog/spec.js +44 -1
- package/BaseDialog/style.js +64 -1
- package/FloatingActionButton/index.js +56 -3
- package/FloatingActionButton/style.js +33 -1
- package/NavDrawer/components/Divider/index.js +11 -2
- package/NavDrawer/components/Divider/spec.js +10 -1
- package/NavDrawer/components/Divider/style.js +12 -2
- package/NavDrawer/components/Item/index.js +81 -6
- package/NavDrawer/components/Item/style.js +49 -1
- package/NavDrawer/components/Section/index.js +32 -2
- package/NavDrawer/components/Title/index.js +25 -2
- package/NavDrawer/components/Title/style.js +8 -1
- package/NavDrawer/index.js +145 -10
- package/NavDrawer/spec.js +41 -1
- package/NavDrawer/style.js +26 -1
- package/NavDrawer/transition.js +20 -1
- package/SnackBar/index.js +178 -25
- package/SnackBar/style.js +64 -2
- package/colors.js +4 -1
- package/icons/ShareIcon.js +12 -2
- package/index.js +5 -1
- package/jest.config.js +1 -1
- package/package.json +7 -7
|
@@ -1,5 +1,58 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import { useSpring, animated } from 'react-spring';
|
|
5
|
+
import { useMeasure } from 'react-use';
|
|
6
|
+
import * as styles from "./style";
|
|
7
|
+
|
|
8
|
+
/**
|
|
2
9
|
* The accordion content component.
|
|
3
10
|
* @param {Object} props The component props.
|
|
4
11
|
* @returns {JSX}
|
|
5
|
-
*/
|
|
12
|
+
*/
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
function AccordionContent(props) {
|
|
15
|
+
const {
|
|
16
|
+
children,
|
|
17
|
+
open,
|
|
18
|
+
id,
|
|
19
|
+
className
|
|
20
|
+
} = props;
|
|
21
|
+
const [contentHeight, setContentHeight] = React.useState(0);
|
|
22
|
+
const [ref, {
|
|
23
|
+
height
|
|
24
|
+
}] = useMeasure();
|
|
25
|
+
React.useEffect(() => {
|
|
26
|
+
setContentHeight(height);
|
|
27
|
+
window.addEventListener('resize', setContentHeight(height));
|
|
28
|
+
return () => {
|
|
29
|
+
window.removeEventListener('resize', setContentHeight(height));
|
|
30
|
+
};
|
|
31
|
+
}, [height]);
|
|
32
|
+
const expand = useSpring({
|
|
33
|
+
config: {
|
|
34
|
+
duration: 175,
|
|
35
|
+
tension: 100,
|
|
36
|
+
friction: 20
|
|
37
|
+
},
|
|
38
|
+
height: open ? contentHeight : 0
|
|
39
|
+
});
|
|
40
|
+
return /*#__PURE__*/_jsx(animated.div, {
|
|
41
|
+
className: classnames('ui-material__accordion-content', styles.content),
|
|
42
|
+
style: expand,
|
|
43
|
+
id: id,
|
|
44
|
+
"aria-hidden": !open,
|
|
45
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
46
|
+
ref: ref,
|
|
47
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
48
|
+
className: classnames(styles.contentInner, className),
|
|
49
|
+
children: children
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
AccordionContent.defaultProps = {
|
|
55
|
+
open: false,
|
|
56
|
+
className: null
|
|
57
|
+
};
|
|
58
|
+
export default AccordionContent;
|
|
@@ -1 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
import AccordionContent from "./index";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
jest.mock('react-spring', () => ({
|
|
6
|
+
...jest.requireActual('react-spring'),
|
|
7
|
+
useSpring: jest.fn().mockReturnValue({
|
|
8
|
+
hook: 'useSpring return value'
|
|
9
|
+
})
|
|
10
|
+
}));
|
|
11
|
+
describe('<AccordionContent />', () => {
|
|
12
|
+
it('should render as closed', () => {
|
|
13
|
+
const wrapper = mount(/*#__PURE__*/_jsx(AccordionContent, {
|
|
14
|
+
id: "some-id",
|
|
15
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
16
|
+
id: "test",
|
|
17
|
+
children: "Some Child"
|
|
18
|
+
})
|
|
19
|
+
}));
|
|
20
|
+
expect(wrapper.find('#test').text()).toEqual('Some Child');
|
|
21
|
+
expect(wrapper.find('div').get(0).props['aria-hidden']).toEqual(true);
|
|
22
|
+
expect(wrapper).toMatchSnapshot();
|
|
23
|
+
});
|
|
24
|
+
it('should render as open', () => {
|
|
25
|
+
const wrapper = mount(/*#__PURE__*/_jsx(AccordionContent, {
|
|
26
|
+
open: true,
|
|
27
|
+
id: "some-id",
|
|
28
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
29
|
+
id: "test",
|
|
30
|
+
children: "Some Child"
|
|
31
|
+
})
|
|
32
|
+
}));
|
|
33
|
+
expect(wrapper.find('#test').text()).toEqual('Some Child');
|
|
34
|
+
expect(wrapper.find('div').get(0).props['aria-hidden']).toEqual(false);
|
|
35
|
+
expect(wrapper).toMatchSnapshot();
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
import{css
|
|
1
|
+
import { css } from 'glamor';
|
|
2
|
+
export const content = css({
|
|
3
|
+
overflow: 'hidden',
|
|
4
|
+
willChange: 'height'
|
|
5
|
+
}).toString();
|
|
6
|
+
export const contentInner = css({
|
|
7
|
+
padding: '0 16px 16px',
|
|
8
|
+
overflow: 'hidden'
|
|
9
|
+
}).toString();
|
package/Accordion/index.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import "core-js/modules/es.string.replace.js";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
import noop from 'lodash/noop';
|
|
6
|
+
import { AccordionContainer, ChevronIcon } from '@shopgate/engage/components';
|
|
7
|
+
import { i18n } from '@shopgate/engage/core/helpers';
|
|
8
|
+
import AccordionContent from "./components/AccordionContent";
|
|
9
|
+
import * as styles from "./style";
|
|
10
|
+
|
|
11
|
+
/**
|
|
2
12
|
* Accordion component
|
|
3
13
|
* @param {Object} props The component props.
|
|
4
14
|
* @param {Function} props.renderLabel Function that returns a React component used as header label
|
|
@@ -16,4 +26,92 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
|
|
|
16
26
|
* @param {Function} props.renderAdditionalHeaderContent optional additional content
|
|
17
27
|
* for the accordion header
|
|
18
28
|
* @returns {JSX.Element}
|
|
19
|
-
*/
|
|
29
|
+
*/
|
|
30
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
31
|
+
import { createElement as _createElement } from "react";
|
|
32
|
+
function Accordion(props) {
|
|
33
|
+
const {
|
|
34
|
+
renderLabel,
|
|
35
|
+
handleLabel,
|
|
36
|
+
role,
|
|
37
|
+
children,
|
|
38
|
+
testId,
|
|
39
|
+
className,
|
|
40
|
+
contentClassName,
|
|
41
|
+
chevronClassName,
|
|
42
|
+
openWithChevron,
|
|
43
|
+
startOpened,
|
|
44
|
+
chevronPosition,
|
|
45
|
+
renderAdditionalHeaderContent
|
|
46
|
+
} = props;
|
|
47
|
+
if (!renderLabel || !children) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const controlsId = testId ? `${testId}-content`.replace(/[^\w\s]/gi, '-').replace(' ', '-') : 'accordion-content';
|
|
51
|
+
return /*#__PURE__*/_jsx("div", {
|
|
52
|
+
className: "ui-material__accordion-container",
|
|
53
|
+
children: /*#__PURE__*/_jsx(AccordionContainer, {
|
|
54
|
+
open: startOpened,
|
|
55
|
+
children: ({
|
|
56
|
+
handleOpen,
|
|
57
|
+
handleClose,
|
|
58
|
+
open
|
|
59
|
+
}) => {
|
|
60
|
+
const clickHandlers = {
|
|
61
|
+
onClick: open ? handleClose : handleOpen,
|
|
62
|
+
onKeyDown: open ? handleClose : handleOpen,
|
|
63
|
+
role
|
|
64
|
+
};
|
|
65
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
66
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
67
|
+
className: classnames('ui-material__accordion-title', className, styles.toggle),
|
|
68
|
+
"data-test-id": testId,
|
|
69
|
+
children: [/*#__PURE__*/_createElement("div", {
|
|
70
|
+
...(openWithChevron ? {} : clickHandlers),
|
|
71
|
+
key: "accordion-toggle",
|
|
72
|
+
"aria-expanded": open,
|
|
73
|
+
"aria-controls": controlsId,
|
|
74
|
+
"aria-label": handleLabel,
|
|
75
|
+
className: classnames(styles.labelContainer, {
|
|
76
|
+
[styles.toggleLeftAligned]: chevronPosition === 'left'
|
|
77
|
+
})
|
|
78
|
+
}, renderLabel({
|
|
79
|
+
open
|
|
80
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
81
|
+
className: classnames(styles.chevronContainer, chevronClassName, {
|
|
82
|
+
[styles.clickable]: openWithChevron
|
|
83
|
+
}),
|
|
84
|
+
...(openWithChevron ? clickHandlers : {}),
|
|
85
|
+
"aria-label": i18n.text(open ? 'favorites.close_list' : 'favorites.open_list'),
|
|
86
|
+
children: /*#__PURE__*/_jsx(ChevronIcon, {
|
|
87
|
+
className: open ? styles.chevronOpen : styles.chevronClosed
|
|
88
|
+
})
|
|
89
|
+
})), renderAdditionalHeaderContent && /*#__PURE__*/_jsx("div", {
|
|
90
|
+
children: renderAdditionalHeaderContent()
|
|
91
|
+
})]
|
|
92
|
+
}), /*#__PURE__*/_jsx(AccordionContent, {
|
|
93
|
+
open: open,
|
|
94
|
+
id: controlsId,
|
|
95
|
+
className: contentClassName,
|
|
96
|
+
children: children
|
|
97
|
+
}, controlsId)]
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
Accordion.defaultProps = {
|
|
104
|
+
children: null,
|
|
105
|
+
renderAdditionalHeaderContent: null,
|
|
106
|
+
renderLabel: noop,
|
|
107
|
+
className: null,
|
|
108
|
+
contentClassName: null,
|
|
109
|
+
chevronClassName: null,
|
|
110
|
+
handleLabel: null,
|
|
111
|
+
role: 'button',
|
|
112
|
+
testId: null,
|
|
113
|
+
openWithChevron: false,
|
|
114
|
+
chevronPosition: 'right',
|
|
115
|
+
startOpened: false
|
|
116
|
+
};
|
|
117
|
+
export default Accordion;
|
package/Accordion/spec.js
CHANGED
|
@@ -1 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
import Accordion from "./index";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
jest.unmock('@shopgate/pwa-ui-shared');
|
|
6
|
+
jest.mock('@shopgate/engage/components');
|
|
7
|
+
jest.mock('react-spring', () => ({
|
|
8
|
+
...jest.requireActual('react-spring'),
|
|
9
|
+
useSpring: jest.fn().mockReturnValue({
|
|
10
|
+
hook: 'useSpring return value'
|
|
11
|
+
})
|
|
12
|
+
}));
|
|
13
|
+
describe('<Accordion />', () => {
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
jest.clearAllMocks();
|
|
16
|
+
});
|
|
17
|
+
it('should render with renderLabel prop and children', () => {
|
|
18
|
+
const wrapper = mount(/*#__PURE__*/_jsx(Accordion, {
|
|
19
|
+
renderLabel: () => /*#__PURE__*/_jsx("div", {}),
|
|
20
|
+
testId: "Some Thing",
|
|
21
|
+
children: "Some content."
|
|
22
|
+
}));
|
|
23
|
+
expect(wrapper).toMatchSnapshot();
|
|
24
|
+
expect(wrapper.find('AccordionContent').exists()).toBe(true);
|
|
25
|
+
});
|
|
26
|
+
it('should not render without a renderLabel prop', () => {
|
|
27
|
+
const wrapper = mount(/*#__PURE__*/_jsx(Accordion, {
|
|
28
|
+
testId: "Some Thing"
|
|
29
|
+
}));
|
|
30
|
+
expect(wrapper).toMatchSnapshot();
|
|
31
|
+
expect(wrapper.instance()).toEqual(null);
|
|
32
|
+
});
|
|
33
|
+
it('should not render without children', () => {
|
|
34
|
+
const wrapper = mount(/*#__PURE__*/_jsx(Accordion, {
|
|
35
|
+
renderLabel: () => {},
|
|
36
|
+
testId: "Some Thing"
|
|
37
|
+
}));
|
|
38
|
+
expect(wrapper).toMatchSnapshot();
|
|
39
|
+
expect(wrapper.instance()).toEqual(null);
|
|
40
|
+
});
|
|
41
|
+
});
|
package/Accordion/style.js
CHANGED
|
@@ -1 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
import { css } from 'glamor';
|
|
2
|
+
import { responsiveMediaQuery } from '@shopgate/engage/styles';
|
|
3
|
+
export const toggle = css({
|
|
4
|
+
padding: '12px 16px',
|
|
5
|
+
position: 'relative',
|
|
6
|
+
display: 'flex',
|
|
7
|
+
flexDirection: 'row',
|
|
8
|
+
alignItems: 'center',
|
|
9
|
+
justifyContent: 'space-between',
|
|
10
|
+
gap: 12
|
|
11
|
+
}).toString();
|
|
12
|
+
export const clickable = css({
|
|
13
|
+
cursor: 'pointer'
|
|
14
|
+
}).toString();
|
|
15
|
+
export const toggleLeftAligned = css({
|
|
16
|
+
flexDirection: 'row-reverse'
|
|
17
|
+
});
|
|
18
|
+
export const chevronContainer = css({
|
|
19
|
+
display: 'flex',
|
|
20
|
+
flexShrink: 0,
|
|
21
|
+
fontSize: '1.5rem',
|
|
22
|
+
[responsiveMediaQuery('>sm', {
|
|
23
|
+
webOnly: true
|
|
24
|
+
})]: {
|
|
25
|
+
backgroundColor: 'rgba(0, 0, 0, 0.04)',
|
|
26
|
+
borderRadius: 32,
|
|
27
|
+
padding: 8
|
|
28
|
+
}
|
|
29
|
+
}).toString();
|
|
30
|
+
export const labelContainer = css({
|
|
31
|
+
marginRight: 'auto',
|
|
32
|
+
display: 'flex',
|
|
33
|
+
flex: 1,
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
justifyContent: 'space-between',
|
|
36
|
+
gap: 12
|
|
37
|
+
});
|
|
38
|
+
export const chevron = css({
|
|
39
|
+
transformOrigin: 'center center',
|
|
40
|
+
transition: 'transform 250ms cubic-bezier(0.25, 0.1, 0.25, 1)'
|
|
41
|
+
});
|
|
42
|
+
export const chevronClosed = css(chevron, {
|
|
43
|
+
transform: 'rotateZ(-90deg)'
|
|
44
|
+
}).toString();
|
|
45
|
+
export const chevronOpen = css(chevron, {
|
|
46
|
+
transform: 'rotateZ(90deg)'
|
|
47
|
+
}).toString();
|
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
import React,{Fragment}from'react';
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Portal } from '@shopgate/pwa-common/components';
|
|
4
|
+
import { APP_BAR_BELOW, APP_BAR_BELOW_BEFORE, APP_BAR_BELOW_AFTER } from '@shopgate/pwa-common/constants/Portals';
|
|
5
|
+
|
|
6
|
+
/**
|
|
2
7
|
* @param {Object} props The component props.
|
|
3
8
|
* @returns {JSX}
|
|
4
|
-
*/
|
|
9
|
+
*/
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
function Below({
|
|
12
|
+
elements
|
|
13
|
+
}) {
|
|
14
|
+
return /*#__PURE__*/_jsxs(Fragment, {
|
|
15
|
+
children: [/*#__PURE__*/_jsx(Portal, {
|
|
16
|
+
name: APP_BAR_BELOW_BEFORE
|
|
17
|
+
}), /*#__PURE__*/_jsx(Portal, {
|
|
18
|
+
name: APP_BAR_BELOW,
|
|
19
|
+
children: elements
|
|
20
|
+
}), /*#__PURE__*/_jsx(Portal, {
|
|
21
|
+
name: APP_BAR_BELOW_AFTER
|
|
22
|
+
})]
|
|
23
|
+
}, "below");
|
|
24
|
+
}
|
|
25
|
+
Below.defaultProps = {
|
|
26
|
+
elements: null
|
|
27
|
+
};
|
|
28
|
+
export default Below;
|
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
import React,{Fragment}from'react';
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Portal } from '@shopgate/pwa-common/components';
|
|
4
|
+
import { APP_BAR_CENTER, APP_BAR_CENTER_BEFORE, APP_BAR_CENTER_AFTER } from '@shopgate/pwa-common/constants/Portals';
|
|
5
|
+
|
|
6
|
+
/**
|
|
2
7
|
* @param {Object} props The component props.
|
|
3
8
|
* @returns {JSX}
|
|
4
|
-
*/
|
|
9
|
+
*/
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
function Center({
|
|
12
|
+
elements
|
|
13
|
+
}) {
|
|
14
|
+
return /*#__PURE__*/_jsxs(Fragment, {
|
|
15
|
+
children: [/*#__PURE__*/_jsx(Portal, {
|
|
16
|
+
name: APP_BAR_CENTER_BEFORE
|
|
17
|
+
}), /*#__PURE__*/_jsx(Portal, {
|
|
18
|
+
name: APP_BAR_CENTER,
|
|
19
|
+
children: elements
|
|
20
|
+
}), /*#__PURE__*/_jsx(Portal, {
|
|
21
|
+
name: APP_BAR_CENTER_AFTER
|
|
22
|
+
})]
|
|
23
|
+
}, "center");
|
|
24
|
+
}
|
|
25
|
+
Center.defaultProps = {
|
|
26
|
+
elements: null
|
|
27
|
+
};
|
|
28
|
+
export default Center;
|
|
@@ -1,5 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
2
|
+
import React, { PureComponent } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import styles from "./style";
|
|
5
|
+
|
|
6
|
+
/**
|
|
2
7
|
* The AppBarField component.
|
|
3
|
-
*/
|
|
8
|
+
*/
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
let AppBarField = /*#__PURE__*/function (_PureComponent) {
|
|
11
|
+
function AppBarField() {
|
|
12
|
+
return _PureComponent.apply(this, arguments) || this;
|
|
13
|
+
}
|
|
14
|
+
_inheritsLoose(AppBarField, _PureComponent);
|
|
15
|
+
var _proto = AppBarField.prototype;
|
|
16
|
+
/**
|
|
4
17
|
* @returns {JSX}
|
|
5
|
-
*/
|
|
18
|
+
*/
|
|
19
|
+
_proto.render = function render() {
|
|
20
|
+
const {
|
|
21
|
+
fieldRef,
|
|
22
|
+
onChange,
|
|
23
|
+
onSubmit
|
|
24
|
+
} = this.props;
|
|
25
|
+
const {
|
|
26
|
+
__
|
|
27
|
+
} = this.context.i18n();
|
|
28
|
+
return /*#__PURE__*/_jsx("form", {
|
|
29
|
+
className: styles.form,
|
|
30
|
+
onSubmit: onSubmit,
|
|
31
|
+
children: /*#__PURE__*/_jsx("input", {
|
|
32
|
+
className: styles.field,
|
|
33
|
+
onChange: onChange,
|
|
34
|
+
placeholder: __('search.placeholder'),
|
|
35
|
+
ref: fieldRef,
|
|
36
|
+
"data-test-id": "searchInput"
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
return AppBarField;
|
|
41
|
+
}(PureComponent);
|
|
42
|
+
AppBarField.defaultProps = {
|
|
43
|
+
fieldRef: null,
|
|
44
|
+
onChange: null,
|
|
45
|
+
onSubmit: null
|
|
46
|
+
};
|
|
47
|
+
AppBarField.contextTypes = {
|
|
48
|
+
i18n: PropTypes.func
|
|
49
|
+
};
|
|
50
|
+
export default AppBarField;
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
import{css
|
|
1
|
+
import { css } from 'glamor';
|
|
2
|
+
const form = css({
|
|
3
|
+
display: 'flex',
|
|
4
|
+
flexGrow: 1
|
|
5
|
+
});
|
|
6
|
+
const field = css({
|
|
7
|
+
outline: 0,
|
|
8
|
+
padding: '0 16px',
|
|
9
|
+
width: '100%'
|
|
10
|
+
});
|
|
11
|
+
export default {
|
|
12
|
+
form,
|
|
13
|
+
field
|
|
14
|
+
};
|
|
@@ -1,5 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
2
|
+
import React, { PureComponent } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import styles from "./style";
|
|
5
|
+
|
|
6
|
+
/**
|
|
2
7
|
* The AppBarIcon component.
|
|
3
|
-
*/
|
|
8
|
+
*/
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
let AppBarIcon = /*#__PURE__*/function (_PureComponent) {
|
|
11
|
+
function AppBarIcon() {
|
|
12
|
+
return _PureComponent.apply(this, arguments) || this;
|
|
13
|
+
}
|
|
14
|
+
_inheritsLoose(AppBarIcon, _PureComponent);
|
|
15
|
+
var _proto = AppBarIcon.prototype;
|
|
16
|
+
/**
|
|
4
17
|
* @returns {JSX}
|
|
5
|
-
*/
|
|
18
|
+
*/
|
|
19
|
+
_proto.render = function render() {
|
|
20
|
+
const {
|
|
21
|
+
background,
|
|
22
|
+
badge: Badge,
|
|
23
|
+
color,
|
|
24
|
+
icon: Icon,
|
|
25
|
+
onClick,
|
|
26
|
+
testId,
|
|
27
|
+
'aria-hidden': ariaHidden,
|
|
28
|
+
'aria-label': ariaLabel
|
|
29
|
+
} = this.props;
|
|
30
|
+
return /*#__PURE__*/_jsxs("button", {
|
|
31
|
+
className: styles,
|
|
32
|
+
onClick: onClick,
|
|
33
|
+
style: {
|
|
34
|
+
background,
|
|
35
|
+
color
|
|
36
|
+
},
|
|
37
|
+
"data-test-id": testId,
|
|
38
|
+
"aria-hidden": ariaHidden,
|
|
39
|
+
"aria-label": ariaLabel,
|
|
40
|
+
type: "button",
|
|
41
|
+
children: [/*#__PURE__*/_jsx(Icon, {}), Badge && /*#__PURE__*/_jsx(Badge, {})]
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
return AppBarIcon;
|
|
45
|
+
}(PureComponent);
|
|
46
|
+
AppBarIcon.defaultProps = {
|
|
47
|
+
'aria-hidden': null,
|
|
48
|
+
'aria-label': null,
|
|
49
|
+
background: 'inherit',
|
|
50
|
+
badge: null,
|
|
51
|
+
color: 'inherit',
|
|
52
|
+
testId: null
|
|
53
|
+
};
|
|
54
|
+
export default AppBarIcon;
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
import{css}from'glamor';
|
|
1
|
+
import { css } from 'glamor';
|
|
2
|
+
export default css({
|
|
3
|
+
color: 'inherit',
|
|
4
|
+
display: 'flex',
|
|
5
|
+
flexShrink: 0,
|
|
6
|
+
fontSize: 24,
|
|
7
|
+
height: 56,
|
|
8
|
+
justifyContent: 'center',
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
outline: 0,
|
|
11
|
+
padding: 0,
|
|
12
|
+
position: 'relative',
|
|
13
|
+
width: 56
|
|
14
|
+
});
|
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
import React,{Fragment}from'react';
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Portal } from '@shopgate/pwa-common/components';
|
|
4
|
+
import { APP_BAR_LEFT, APP_BAR_LEFT_BEFORE, APP_BAR_LEFT_AFTER } from '@shopgate/pwa-common/constants/Portals';
|
|
5
|
+
|
|
6
|
+
/**
|
|
2
7
|
* @param {Object} props The component props.
|
|
3
8
|
* @returns {JSX}
|
|
4
|
-
*/
|
|
9
|
+
*/
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
function Left({
|
|
12
|
+
elements
|
|
13
|
+
}) {
|
|
14
|
+
return /*#__PURE__*/_jsxs(Fragment, {
|
|
15
|
+
children: [/*#__PURE__*/_jsx(Portal, {
|
|
16
|
+
name: APP_BAR_LEFT_BEFORE
|
|
17
|
+
}), /*#__PURE__*/_jsx(Portal, {
|
|
18
|
+
name: APP_BAR_LEFT,
|
|
19
|
+
children: elements
|
|
20
|
+
}), /*#__PURE__*/_jsx(Portal, {
|
|
21
|
+
name: APP_BAR_LEFT_AFTER
|
|
22
|
+
})]
|
|
23
|
+
}, "left");
|
|
24
|
+
}
|
|
25
|
+
Left.defaultProps = {
|
|
26
|
+
elements: null
|
|
27
|
+
};
|
|
28
|
+
export default Left;
|
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
import React,{Fragment}from'react';
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Portal } from '@shopgate/pwa-common/components';
|
|
4
|
+
import { APP_BAR_RIGHT, APP_BAR_RIGHT_BEFORE, APP_BAR_RIGHT_AFTER } from '@shopgate/pwa-common/constants/Portals';
|
|
5
|
+
|
|
6
|
+
/**
|
|
2
7
|
* @param {Object} props The component props.
|
|
3
8
|
* @returns {JSX}
|
|
4
|
-
*/
|
|
9
|
+
*/
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
function Right({
|
|
12
|
+
elements
|
|
13
|
+
}) {
|
|
14
|
+
return /*#__PURE__*/_jsxs(Fragment, {
|
|
15
|
+
children: [/*#__PURE__*/_jsx(Portal, {
|
|
16
|
+
name: APP_BAR_RIGHT_BEFORE
|
|
17
|
+
}), /*#__PURE__*/_jsx(Portal, {
|
|
18
|
+
name: APP_BAR_RIGHT,
|
|
19
|
+
children: elements
|
|
20
|
+
}), /*#__PURE__*/_jsx(Portal, {
|
|
21
|
+
name: APP_BAR_RIGHT_AFTER
|
|
22
|
+
})]
|
|
23
|
+
}, "right");
|
|
24
|
+
}
|
|
25
|
+
Right.defaultProps = {
|
|
26
|
+
elements: null
|
|
27
|
+
};
|
|
28
|
+
export default Right;
|