@shopgate/pwa-ui-material 7.30.3 → 7.31.0-alpha.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/Accordion/components/AccordionContent/index.js +23 -10
- package/Accordion/index.js +62 -12
- package/AppBar/components/Field/index.js +37 -39
- package/AppBar/components/Icon/index.js +47 -39
- package/AppBar/components/Title/index.js +44 -38
- package/AppBar/index.js +26 -5
- package/BaseDialog/components/Buttons/index.js +29 -18
- package/BaseDialog/components/Content/index.js +14 -3
- package/BaseDialog/components/Title/index.js +17 -5
- package/BaseDialog/index.js +71 -26
- package/FloatingActionButton/index.js +40 -12
- package/NavDrawer/components/Divider/index.js +24 -6
- package/NavDrawer/components/Item/index.js +91 -65
- package/NavDrawer/components/Title/index.js +16 -4
- package/NavDrawer/index.js +129 -120
- package/NavDrawer/spec.js +112 -14
- package/SnackBar/index.js +176 -166
- package/icons/ShareIcon.d.ts +7 -0
- package/icons/ShareIcon.d.ts.map +1 -0
- package/icons/ShareIcon.js +0 -2
- package/package.json +6 -4
- package/tsconfig.build.json +16 -0
- package/tsconfig.json +3 -0
- package/Accordion/components/AccordionContent/style.js +0 -9
- package/Accordion/style.js +0 -47
- package/AppBar/components/Field/style.js +0 -14
- package/AppBar/components/Icon/style.js +0 -14
- package/AppBar/components/Title/style.js +0 -11
- package/AppBar/style.js +0 -21
- package/BaseDialog/style.js +0 -64
- package/FloatingActionButton/style.js +0 -33
- package/NavDrawer/components/Divider/style.js +0 -12
- package/NavDrawer/components/Item/style.js +0 -49
- package/NavDrawer/components/Title/style.js +0 -8
- package/NavDrawer/style.js +0 -26
- package/SnackBar/style.js +0 -64
|
@@ -1,28 +1,41 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import classnames from 'classnames';
|
|
4
3
|
import { useSpring, animated } from 'react-spring';
|
|
5
4
|
import { useMeasure } from 'react-use';
|
|
6
|
-
import
|
|
5
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const useStyles = makeStyles()({
|
|
8
|
+
content: {
|
|
9
|
+
overflow: 'hidden',
|
|
10
|
+
willChange: 'height'
|
|
11
|
+
},
|
|
12
|
+
contentInner: {
|
|
13
|
+
padding: '0 16px 16px',
|
|
14
|
+
overflow: 'hidden'
|
|
15
|
+
}
|
|
16
|
+
});
|
|
7
17
|
|
|
8
18
|
/**
|
|
9
19
|
* The accordion content component.
|
|
10
20
|
* @param {Object} props The component props.
|
|
11
21
|
* @returns {JSX}
|
|
12
22
|
*/
|
|
13
|
-
|
|
14
|
-
function AccordionContent(props) {
|
|
23
|
+
const AccordionContent = props => {
|
|
15
24
|
const {
|
|
16
25
|
children,
|
|
17
26
|
open,
|
|
18
27
|
id,
|
|
19
28
|
className
|
|
20
29
|
} = props;
|
|
21
|
-
const
|
|
30
|
+
const {
|
|
31
|
+
classes,
|
|
32
|
+
cx
|
|
33
|
+
} = useStyles();
|
|
34
|
+
const [contentHeight, setContentHeight] = useState(0);
|
|
22
35
|
const [ref, {
|
|
23
36
|
height
|
|
24
37
|
}] = useMeasure();
|
|
25
|
-
|
|
38
|
+
useEffect(() => {
|
|
26
39
|
setContentHeight(height);
|
|
27
40
|
window.addEventListener('resize', setContentHeight(height));
|
|
28
41
|
return () => {
|
|
@@ -38,19 +51,19 @@ function AccordionContent(props) {
|
|
|
38
51
|
height: open ? contentHeight : 0
|
|
39
52
|
});
|
|
40
53
|
return /*#__PURE__*/_jsx(animated.div, {
|
|
41
|
-
className:
|
|
54
|
+
className: cx('ui-material__accordion-content', classes.content),
|
|
42
55
|
style: expand,
|
|
43
56
|
id: id,
|
|
44
57
|
"aria-hidden": !open,
|
|
45
58
|
children: /*#__PURE__*/_jsx("div", {
|
|
46
59
|
ref: ref,
|
|
47
60
|
children: /*#__PURE__*/_jsx("div", {
|
|
48
|
-
className:
|
|
61
|
+
className: cx(classes.contentInner, className),
|
|
49
62
|
children: children
|
|
50
63
|
})
|
|
51
64
|
})
|
|
52
65
|
});
|
|
53
|
-
}
|
|
66
|
+
};
|
|
54
67
|
AccordionContent.defaultProps = {
|
|
55
68
|
open: false,
|
|
56
69
|
className: null
|
package/Accordion/index.js
CHANGED
|
@@ -1,12 +1,60 @@
|
|
|
1
1
|
import "core-js/modules/es.string.replace.js";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import classnames from 'classnames';
|
|
5
4
|
import noop from 'lodash/noop';
|
|
6
5
|
import { AccordionContainer, ChevronIcon } from '@shopgate/engage/components';
|
|
7
6
|
import { i18n } from '@shopgate/engage/core/helpers';
|
|
7
|
+
import { makeStyles, responsiveMediaQuery } from '@shopgate/engage/styles';
|
|
8
8
|
import AccordionContent from "./components/AccordionContent";
|
|
9
|
-
import
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
10
|
+
import { createElement as _createElement } from "react";
|
|
11
|
+
const useStyles = makeStyles()({
|
|
12
|
+
toggle: {
|
|
13
|
+
padding: '12px 16px',
|
|
14
|
+
position: 'relative',
|
|
15
|
+
display: 'flex',
|
|
16
|
+
flexDirection: 'row',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
justifyContent: 'space-between',
|
|
19
|
+
gap: 12
|
|
20
|
+
},
|
|
21
|
+
clickable: {
|
|
22
|
+
cursor: 'pointer'
|
|
23
|
+
},
|
|
24
|
+
toggleLeftAligned: {
|
|
25
|
+
flexDirection: 'row-reverse'
|
|
26
|
+
},
|
|
27
|
+
chevronContainer: {
|
|
28
|
+
display: 'flex',
|
|
29
|
+
flexShrink: 0,
|
|
30
|
+
fontSize: '1.5rem',
|
|
31
|
+
[responsiveMediaQuery('>sm', {
|
|
32
|
+
webOnly: true
|
|
33
|
+
})]: {
|
|
34
|
+
backgroundColor: 'rgba(0, 0, 0, 0.04)',
|
|
35
|
+
borderRadius: 32,
|
|
36
|
+
padding: 8
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
labelContainer: {
|
|
40
|
+
marginRight: 'auto',
|
|
41
|
+
display: 'flex',
|
|
42
|
+
flex: 1,
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
justifyContent: 'space-between',
|
|
45
|
+
gap: 12
|
|
46
|
+
},
|
|
47
|
+
chevronClosed: {
|
|
48
|
+
transformOrigin: 'center center',
|
|
49
|
+
transition: 'transform 250ms cubic-bezier(0.25, 0.1, 0.25, 1)',
|
|
50
|
+
transform: 'rotateZ(-90deg)'
|
|
51
|
+
},
|
|
52
|
+
chevronOpen: {
|
|
53
|
+
transformOrigin: 'center center',
|
|
54
|
+
transition: 'transform 250ms cubic-bezier(0.25, 0.1, 0.25, 1)',
|
|
55
|
+
transform: 'rotateZ(90deg)'
|
|
56
|
+
}
|
|
57
|
+
});
|
|
10
58
|
|
|
11
59
|
/**
|
|
12
60
|
* Accordion component
|
|
@@ -27,9 +75,7 @@ import * as styles from "./style";
|
|
|
27
75
|
* for the accordion header
|
|
28
76
|
* @returns {JSX.Element}
|
|
29
77
|
*/
|
|
30
|
-
|
|
31
|
-
import { createElement as _createElement } from "react";
|
|
32
|
-
function Accordion(props) {
|
|
78
|
+
const Accordion = props => {
|
|
33
79
|
const {
|
|
34
80
|
renderLabel,
|
|
35
81
|
handleLabel,
|
|
@@ -44,6 +90,10 @@ function Accordion(props) {
|
|
|
44
90
|
chevronPosition,
|
|
45
91
|
renderAdditionalHeaderContent
|
|
46
92
|
} = props;
|
|
93
|
+
const {
|
|
94
|
+
classes,
|
|
95
|
+
cx
|
|
96
|
+
} = useStyles();
|
|
47
97
|
if (!renderLabel || !children) {
|
|
48
98
|
return null;
|
|
49
99
|
}
|
|
@@ -64,7 +114,7 @@ function Accordion(props) {
|
|
|
64
114
|
};
|
|
65
115
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
66
116
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
67
|
-
className:
|
|
117
|
+
className: cx('ui-material__accordion-title', classes.toggle, className),
|
|
68
118
|
"data-test-id": testId,
|
|
69
119
|
children: [/*#__PURE__*/_createElement("div", {
|
|
70
120
|
...(openWithChevron ? {} : clickHandlers),
|
|
@@ -72,19 +122,19 @@ function Accordion(props) {
|
|
|
72
122
|
"aria-expanded": open,
|
|
73
123
|
"aria-controls": controlsId,
|
|
74
124
|
"aria-label": handleLabel,
|
|
75
|
-
className:
|
|
76
|
-
[
|
|
125
|
+
className: cx(classes.labelContainer, {
|
|
126
|
+
[classes.toggleLeftAligned]: chevronPosition === 'left'
|
|
77
127
|
})
|
|
78
128
|
}, renderLabel({
|
|
79
129
|
open
|
|
80
130
|
}), /*#__PURE__*/_jsx("div", {
|
|
81
|
-
className:
|
|
82
|
-
[
|
|
131
|
+
className: cx(classes.chevronContainer, chevronClassName, {
|
|
132
|
+
[classes.clickable]: openWithChevron
|
|
83
133
|
}),
|
|
84
134
|
...(openWithChevron ? clickHandlers : {}),
|
|
85
135
|
"aria-label": i18n.text(open ? 'favorites.close_list' : 'favorites.open_list'),
|
|
86
136
|
children: /*#__PURE__*/_jsx(ChevronIcon, {
|
|
87
|
-
className: open ?
|
|
137
|
+
className: open ? classes.chevronOpen : classes.chevronClosed
|
|
88
138
|
})
|
|
89
139
|
})), renderAdditionalHeaderContent && /*#__PURE__*/_jsx("div", {
|
|
90
140
|
children: renderAdditionalHeaderContent()
|
|
@@ -99,7 +149,7 @@ function Accordion(props) {
|
|
|
99
149
|
}
|
|
100
150
|
})
|
|
101
151
|
});
|
|
102
|
-
}
|
|
152
|
+
};
|
|
103
153
|
Accordion.defaultProps = {
|
|
104
154
|
children: null,
|
|
105
155
|
renderAdditionalHeaderContent: null,
|
|
@@ -1,50 +1,48 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, { PureComponent } from 'react';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
|
-
import
|
|
3
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
4
|
+
import { i18n } from '@shopgate/engage/core/helpers';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const useStyles = makeStyles()({
|
|
7
|
+
form: {
|
|
8
|
+
display: 'flex',
|
|
9
|
+
flexGrow: 1
|
|
10
|
+
},
|
|
11
|
+
field: {
|
|
12
|
+
outline: 0,
|
|
13
|
+
padding: '0 16px',
|
|
14
|
+
width: '100%'
|
|
15
|
+
}
|
|
16
|
+
});
|
|
5
17
|
|
|
6
18
|
/**
|
|
7
19
|
* The AppBarField component.
|
|
20
|
+
* @param {Object} props Props.
|
|
21
|
+
* @returns {JSX.Element}
|
|
8
22
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
onChange,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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);
|
|
23
|
+
const AppBarField = ({
|
|
24
|
+
fieldRef,
|
|
25
|
+
onChange,
|
|
26
|
+
onSubmit
|
|
27
|
+
}) => {
|
|
28
|
+
const {
|
|
29
|
+
classes
|
|
30
|
+
} = useStyles();
|
|
31
|
+
return /*#__PURE__*/_jsx("form", {
|
|
32
|
+
className: classes.form,
|
|
33
|
+
onSubmit: onSubmit,
|
|
34
|
+
children: /*#__PURE__*/_jsx("input", {
|
|
35
|
+
className: classes.field,
|
|
36
|
+
onChange: onChange,
|
|
37
|
+
placeholder: i18n.text('search.placeholder'),
|
|
38
|
+
ref: fieldRef,
|
|
39
|
+
"data-test-id": "searchInput"
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
};
|
|
42
43
|
AppBarField.defaultProps = {
|
|
43
44
|
fieldRef: null,
|
|
44
45
|
onChange: null,
|
|
45
46
|
onSubmit: null
|
|
46
47
|
};
|
|
47
|
-
AppBarField.contextTypes = {
|
|
48
|
-
i18n: PropTypes.func
|
|
49
|
-
};
|
|
50
48
|
export default AppBarField;
|
|
@@ -1,48 +1,56 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, { PureComponent } from 'react';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
|
-
import
|
|
3
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
const useStyles = makeStyles()({
|
|
6
|
+
root: {
|
|
7
|
+
color: 'inherit',
|
|
8
|
+
display: 'flex',
|
|
9
|
+
flexShrink: 0,
|
|
10
|
+
fontSize: 24,
|
|
11
|
+
height: 56,
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
outline: 0,
|
|
15
|
+
padding: 0,
|
|
16
|
+
position: 'relative',
|
|
17
|
+
width: 56
|
|
18
|
+
}
|
|
19
|
+
});
|
|
5
20
|
|
|
6
21
|
/**
|
|
7
22
|
* The AppBarIcon component.
|
|
23
|
+
* @param {Object} props Props.
|
|
24
|
+
* @returns {JSX.Element}
|
|
8
25
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
const AppBarIcon = props => {
|
|
27
|
+
const {
|
|
28
|
+
classes
|
|
29
|
+
} = useStyles();
|
|
30
|
+
const {
|
|
31
|
+
background,
|
|
32
|
+
badge: Badge,
|
|
33
|
+
color,
|
|
34
|
+
icon: Icon,
|
|
35
|
+
onClick,
|
|
36
|
+
testId,
|
|
37
|
+
'aria-hidden': ariaHidden,
|
|
38
|
+
'aria-label': ariaLabel
|
|
39
|
+
} = props;
|
|
40
|
+
return /*#__PURE__*/_jsxs("button", {
|
|
41
|
+
className: classes.root,
|
|
42
|
+
onClick: onClick,
|
|
43
|
+
style: {
|
|
21
44
|
background,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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);
|
|
45
|
+
color
|
|
46
|
+
},
|
|
47
|
+
"data-test-id": testId,
|
|
48
|
+
"aria-hidden": ariaHidden,
|
|
49
|
+
"aria-label": ariaLabel,
|
|
50
|
+
type: "button",
|
|
51
|
+
children: [/*#__PURE__*/_jsx(Icon, {}), Badge && /*#__PURE__*/_jsx(Badge, {})]
|
|
52
|
+
});
|
|
53
|
+
};
|
|
46
54
|
AppBarIcon.defaultProps = {
|
|
47
55
|
'aria-hidden': null,
|
|
48
56
|
'aria-label': null,
|
|
@@ -1,47 +1,53 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, { PureComponent } from 'react';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const useStyles = makeStyles()({
|
|
6
|
+
root: {
|
|
7
|
+
fontSize: 20,
|
|
8
|
+
fontWeight: 500,
|
|
9
|
+
flexGrow: 1,
|
|
10
|
+
lineHeight: '56px',
|
|
11
|
+
overflow: 'hidden',
|
|
12
|
+
padding: '0 16px',
|
|
13
|
+
textOverflow: 'ellipsis',
|
|
14
|
+
whiteSpace: 'nowrap'
|
|
15
|
+
}
|
|
16
|
+
});
|
|
6
17
|
|
|
7
18
|
/**
|
|
8
19
|
* The AppBarTitle component.
|
|
20
|
+
* @param {Object} props Props.
|
|
21
|
+
* @returns {JSX.Element|null}
|
|
9
22
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
23
|
+
const AppBarTitle = ({
|
|
24
|
+
onClick,
|
|
25
|
+
title
|
|
26
|
+
}) => {
|
|
27
|
+
const {
|
|
28
|
+
classes,
|
|
29
|
+
cx
|
|
30
|
+
} = useStyles();
|
|
31
|
+
if (!title) {
|
|
32
|
+
return null;
|
|
14
33
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
tabIndex: -1,
|
|
33
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
34
|
-
role: "presentation",
|
|
35
|
-
onClick: onClick,
|
|
36
|
-
id: "titleLabel",
|
|
37
|
-
dangerouslySetInnerHTML: {
|
|
38
|
-
__html: title
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
return AppBarTitle;
|
|
44
|
-
}(PureComponent);
|
|
34
|
+
return /*#__PURE__*/_jsx("div", {
|
|
35
|
+
className: cx(classes.root, 'theme__app-bar__title'),
|
|
36
|
+
role: "heading",
|
|
37
|
+
"aria-labelledby": "titleLabel",
|
|
38
|
+
"aria-level": "1",
|
|
39
|
+
"data-test-id": `title: ${title}`,
|
|
40
|
+
tabIndex: -1,
|
|
41
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
42
|
+
role: "presentation",
|
|
43
|
+
onClick: onClick,
|
|
44
|
+
id: "titleLabel",
|
|
45
|
+
dangerouslySetInnerHTML: {
|
|
46
|
+
__html: title
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
};
|
|
45
51
|
AppBarTitle.defaultProps = {
|
|
46
52
|
onClick: null
|
|
47
53
|
};
|
package/AppBar/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import React, { useMemo, useRef, useLayoutEffect } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { getAbsoluteHeight } from '@shopgate/pwa-common/helpers/dom';
|
|
4
4
|
import { themeShadows, themeColors } from '@shopgate/pwa-common/helpers/config';
|
|
5
|
-
import { setCSSCustomProp } from '@shopgate/engage/styles';
|
|
5
|
+
import { makeStyles, setCSSCustomProp } from '@shopgate/engage/styles';
|
|
6
6
|
import { SurroundPortals } from '@shopgate/engage/components';
|
|
7
7
|
import { APP_BAR_CONTENT } from '@shopgate/engage/core/constants';
|
|
8
8
|
import Field from "./components/Field";
|
|
@@ -12,13 +12,30 @@ import Right from "./components/Right";
|
|
|
12
12
|
import Center from "./components/Center";
|
|
13
13
|
import Left from "./components/Left";
|
|
14
14
|
import Below from "./components/Below";
|
|
15
|
-
import
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
const useStyles = makeStyles()({
|
|
17
|
+
outer: {
|
|
18
|
+
boxSizing: 'content-box',
|
|
19
|
+
left: 0,
|
|
20
|
+
paddingTop: 'var(--safe-area-inset-top)',
|
|
21
|
+
position: 'sticky',
|
|
22
|
+
top: 0,
|
|
23
|
+
width: '100%',
|
|
24
|
+
zIndex: 15
|
|
25
|
+
},
|
|
26
|
+
inner: {
|
|
27
|
+
background: 'inherit',
|
|
28
|
+
display: 'flex',
|
|
29
|
+
justifyContent: 'space-between',
|
|
30
|
+
position: 'relative',
|
|
31
|
+
zIndex: 14
|
|
32
|
+
}
|
|
33
|
+
});
|
|
16
34
|
|
|
17
35
|
/**
|
|
18
36
|
* Updates the --app-bar-height custom property
|
|
19
37
|
* @param {Object} ref The app bar ref.
|
|
20
38
|
*/
|
|
21
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
39
|
const updateAppBarHeight = ref => {
|
|
23
40
|
if (!ref.current) {
|
|
24
41
|
return;
|
|
@@ -40,6 +57,10 @@ const AppBar = ({
|
|
|
40
57
|
textColor,
|
|
41
58
|
shadow
|
|
42
59
|
}) => {
|
|
60
|
+
const {
|
|
61
|
+
classes,
|
|
62
|
+
cx
|
|
63
|
+
} = useStyles();
|
|
43
64
|
const contentRef = useRef(null);
|
|
44
65
|
const style = useMemo(() => ({
|
|
45
66
|
background: backgroundColor,
|
|
@@ -60,14 +81,14 @@ const AppBar = ({
|
|
|
60
81
|
}, [contentRef, observer]);
|
|
61
82
|
return /*#__PURE__*/_jsxs("header", {
|
|
62
83
|
ref: contentRef,
|
|
63
|
-
className:
|
|
84
|
+
className: cx(classes.outer, 'ui-material__app-bar'),
|
|
64
85
|
"data-test-id": "Navigator",
|
|
65
86
|
role: "banner",
|
|
66
87
|
style: style,
|
|
67
88
|
children: [/*#__PURE__*/_jsx(SurroundPortals, {
|
|
68
89
|
portalName: APP_BAR_CONTENT,
|
|
69
90
|
children: /*#__PURE__*/_jsxs("div", {
|
|
70
|
-
className:
|
|
91
|
+
className: classes.inner,
|
|
71
92
|
children: [/*#__PURE__*/_jsx(Left, {
|
|
72
93
|
elements: left
|
|
73
94
|
}), /*#__PURE__*/_jsx(Center, {
|
|
@@ -1,30 +1,41 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import I18n from '@shopgate/
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import { I18n, Button } from '@shopgate/engage/components';
|
|
4
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const useStyles = makeStyles()(theme => ({
|
|
7
|
+
button: {
|
|
8
|
+
marginRight: theme.spacing(-0.5),
|
|
9
|
+
textAlign: 'right'
|
|
10
|
+
}
|
|
11
|
+
}));
|
|
6
12
|
|
|
7
13
|
/**
|
|
14
|
+
* Buttons component.
|
|
8
15
|
* @param {Object} props The component props.
|
|
9
16
|
* @returns {JSX}
|
|
10
17
|
*/
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
18
|
const Buttons = ({
|
|
13
19
|
actions
|
|
14
|
-
}) =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
}) => {
|
|
21
|
+
const {
|
|
22
|
+
classes
|
|
23
|
+
} = useStyles();
|
|
24
|
+
return actions.map(({
|
|
25
|
+
label,
|
|
26
|
+
action,
|
|
27
|
+
disabled = false
|
|
28
|
+
}) => /*#__PURE__*/_jsx(Button, {
|
|
29
|
+
className: classes.button,
|
|
30
|
+
flat: true,
|
|
31
|
+
type: "primary",
|
|
32
|
+
onClick: action,
|
|
33
|
+
disabled: disabled,
|
|
34
|
+
children: /*#__PURE__*/_jsx(I18n.Text, {
|
|
35
|
+
string: label
|
|
36
|
+
})
|
|
37
|
+
}, label));
|
|
38
|
+
};
|
|
28
39
|
Buttons.defaultProps = {
|
|
29
40
|
actions: []
|
|
30
41
|
};
|
|
@@ -1,20 +1,31 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
3
|
+
import { themeConfig } from '@shopgate/pwa-common/helpers/config';
|
|
4
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const useStyles = makeStyles()({
|
|
7
|
+
body: {
|
|
8
|
+
color: themeConfig.colors.shade6,
|
|
9
|
+
flexGrow: 1,
|
|
10
|
+
overflow: 'auto'
|
|
11
|
+
}
|
|
12
|
+
});
|
|
4
13
|
|
|
5
14
|
/**
|
|
6
15
|
* @param {Object} props The component props.
|
|
7
16
|
* @returns {JSX}
|
|
8
17
|
*/
|
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
18
|
const Content = ({
|
|
11
19
|
content
|
|
12
20
|
}) => {
|
|
21
|
+
const {
|
|
22
|
+
classes
|
|
23
|
+
} = useStyles();
|
|
13
24
|
if (!content) {
|
|
14
25
|
return null;
|
|
15
26
|
}
|
|
16
27
|
return /*#__PURE__*/_jsx("div", {
|
|
17
|
-
className:
|
|
28
|
+
className: classes.body,
|
|
18
29
|
id: "basicDialogDesc",
|
|
19
30
|
children: content
|
|
20
31
|
});
|
|
@@ -1,22 +1,34 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import Ellipsis from '@shopgate/
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import { I18n, Ellipsis } from '@shopgate/engage/components';
|
|
4
|
+
import { themeConfig } from '@shopgate/engage';
|
|
5
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const useStyles = makeStyles()(theme => ({
|
|
8
|
+
title: {
|
|
9
|
+
fontSize: '1.25em',
|
|
10
|
+
lineHeight: themeConfig.typography.lineHeight,
|
|
11
|
+
fontWeight: 500,
|
|
12
|
+
paddingBottom: theme.spacing(1),
|
|
13
|
+
marginTop: '-.25em'
|
|
14
|
+
}
|
|
15
|
+
}));
|
|
6
16
|
|
|
7
17
|
/**
|
|
8
18
|
* @param {Object} props The component props.
|
|
9
19
|
* @returns {JSX}
|
|
10
20
|
*/
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
21
|
const Title = ({
|
|
13
22
|
title
|
|
14
23
|
}) => {
|
|
24
|
+
const {
|
|
25
|
+
classes
|
|
26
|
+
} = useStyles();
|
|
15
27
|
if (!title) {
|
|
16
28
|
return null;
|
|
17
29
|
}
|
|
18
30
|
return /*#__PURE__*/_jsx("div", {
|
|
19
|
-
className:
|
|
31
|
+
className: classes.title,
|
|
20
32
|
id: "basicDialogTitle",
|
|
21
33
|
role: "heading",
|
|
22
34
|
"aria-level": "2",
|