@shopgate/pwa-ui-ios 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/AppBar/components/Field/index.js +36 -38
- package/AppBar/components/Icon/index.js +52 -43
- package/AppBar/components/Title/index.js +44 -32
- package/AppBar/index.js +22 -7
- package/BaseDialog/components/Buttons/index.js +57 -20
- package/BaseDialog/components/Content/index.js +16 -3
- package/BaseDialog/components/Title/index.js +13 -5
- package/BaseDialog/index.js +55 -23
- package/icons/CartIcon.d.ts +7 -0
- package/icons/CartIcon.d.ts.map +1 -0
- package/icons/CartIcon.js +0 -3
- package/icons/FilterIcon.d.ts +7 -0
- package/icons/FilterIcon.d.ts.map +1 -0
- package/icons/FilterIcon.js +0 -2
- package/icons/HomeIcon.d.ts +7 -0
- package/icons/HomeIcon.d.ts.map +1 -0
- package/icons/HomeIcon.js +0 -2
- package/icons/ShareIcon.d.ts +7 -0
- package/icons/ShareIcon.d.ts.map +1 -0
- package/icons/ShareIcon.js +0 -2
- package/package.json +2 -2
- package/tsconfig.build.json +16 -0
- package/tsconfig.json +3 -0
- package/AppBar/components/Field/style.js +0 -14
- package/AppBar/components/Icon/style.js +0 -15
- package/AppBar/components/Title/style.js +0 -15
- package/AppBar/style.js +0 -16
- package/BaseDialog/style.js +0 -80
|
@@ -1,49 +1,47 @@
|
|
|
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
|
-
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
|
-
})
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
return AppBarField;
|
|
40
|
-
}(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
|
+
})
|
|
40
|
+
});
|
|
41
|
+
};
|
|
41
42
|
AppBarField.defaultProps = {
|
|
42
43
|
fieldRef: null,
|
|
43
44
|
onChange: null,
|
|
44
45
|
onSubmit: null
|
|
45
46
|
};
|
|
46
|
-
AppBarField.contextTypes = {
|
|
47
|
-
i18n: PropTypes.func
|
|
48
|
-
};
|
|
49
47
|
export default AppBarField;
|
|
@@ -1,53 +1,62 @@
|
|
|
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
|
+
alignItems: 'center',
|
|
8
|
+
color: 'inherit',
|
|
9
|
+
display: 'flex',
|
|
10
|
+
flexShrink: 0,
|
|
11
|
+
fontSize: 24,
|
|
12
|
+
height: 44,
|
|
13
|
+
justifyContent: 'center',
|
|
14
|
+
outline: 0,
|
|
15
|
+
padding: 0,
|
|
16
|
+
position: 'relative',
|
|
17
|
+
width: 44,
|
|
18
|
+
zIndex: 1
|
|
19
|
+
}
|
|
20
|
+
});
|
|
5
21
|
|
|
6
22
|
/**
|
|
7
23
|
* The AppBarIcon component.
|
|
24
|
+
* @param {Object} props Props.
|
|
25
|
+
* @returns {JSX.Element}
|
|
8
26
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
27
|
+
const AppBarIcon = props => {
|
|
28
|
+
const {
|
|
29
|
+
classes
|
|
30
|
+
} = useStyles();
|
|
31
|
+
const {
|
|
32
|
+
background,
|
|
33
|
+
badge: Badge,
|
|
34
|
+
color,
|
|
35
|
+
icon: Icon,
|
|
36
|
+
onClick,
|
|
37
|
+
testId,
|
|
38
|
+
'aria-hidden': ariaHidden,
|
|
39
|
+
'aria-label': ariaLabel,
|
|
40
|
+
...iconProps
|
|
41
|
+
} = props;
|
|
42
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
43
|
+
onKeyDown: onClick,
|
|
44
|
+
tabIndex: 0,
|
|
45
|
+
role: "button",
|
|
46
|
+
"aria-hidden": ariaHidden,
|
|
47
|
+
"aria-label": ariaLabel,
|
|
48
|
+
className: classes.root,
|
|
49
|
+
onClick: onClick,
|
|
50
|
+
style: {
|
|
21
51
|
background,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
testId,
|
|
27
|
-
'aria-hidden': ariaHidden,
|
|
28
|
-
'aria-label': ariaLabel,
|
|
52
|
+
color
|
|
53
|
+
},
|
|
54
|
+
"data-test-id": testId,
|
|
55
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
29
56
|
...iconProps
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
tabIndex: 0,
|
|
34
|
-
role: "button",
|
|
35
|
-
"aria-hidden": ariaHidden,
|
|
36
|
-
"aria-label": ariaLabel,
|
|
37
|
-
className: styles,
|
|
38
|
-
onClick: onClick,
|
|
39
|
-
style: {
|
|
40
|
-
background,
|
|
41
|
-
color
|
|
42
|
-
},
|
|
43
|
-
"data-test-id": testId,
|
|
44
|
-
children: [/*#__PURE__*/_jsx(Icon, {
|
|
45
|
-
...iconProps
|
|
46
|
-
}, "icon"), Badge && /*#__PURE__*/_jsx(Badge, {}, "badge")]
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
return AppBarIcon;
|
|
50
|
-
}(PureComponent);
|
|
57
|
+
}, "icon"), Badge && /*#__PURE__*/_jsx(Badge, {}, "badge")]
|
|
58
|
+
});
|
|
59
|
+
};
|
|
51
60
|
AppBarIcon.defaultProps = {
|
|
52
61
|
'aria-hidden': false,
|
|
53
62
|
'aria-label': null,
|
|
@@ -1,39 +1,51 @@
|
|
|
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: 17,
|
|
8
|
+
fontWeight: 600,
|
|
9
|
+
flexGrow: 1,
|
|
10
|
+
lineHeight: '44px',
|
|
11
|
+
left: 90,
|
|
12
|
+
overflow: 'hidden',
|
|
13
|
+
position: 'absolute',
|
|
14
|
+
right: 90,
|
|
15
|
+
textAlign: 'center',
|
|
16
|
+
textOverflow: 'ellipsis',
|
|
17
|
+
top: 0,
|
|
18
|
+
whiteSpace: 'nowrap'
|
|
19
|
+
}
|
|
20
|
+
});
|
|
6
21
|
|
|
7
22
|
/**
|
|
8
23
|
* The AppBarTitle component.
|
|
24
|
+
* @param {Object} props Props.
|
|
25
|
+
* @returns {JSX.Element|null}
|
|
9
26
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
27
|
+
const AppBarTitle = ({
|
|
28
|
+
title
|
|
29
|
+
}) => {
|
|
30
|
+
const {
|
|
31
|
+
classes,
|
|
32
|
+
cx
|
|
33
|
+
} = useStyles();
|
|
34
|
+
if (!title) {
|
|
35
|
+
return null;
|
|
14
36
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"aria-live": "polite",
|
|
30
|
-
tabIndex: -1,
|
|
31
|
-
"data-test-id": `title: ${title}`,
|
|
32
|
-
dangerouslySetInnerHTML: {
|
|
33
|
-
__html: title
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
return AppBarTitle;
|
|
38
|
-
}(PureComponent);
|
|
37
|
+
return /*#__PURE__*/_jsx("div", {
|
|
38
|
+
className: cx(classes.root, 'theme__app-bar__title'),
|
|
39
|
+
role: "heading",
|
|
40
|
+
"aria-level": "1",
|
|
41
|
+
"aria-live": "polite",
|
|
42
|
+
tabIndex: -1,
|
|
43
|
+
"data-test-id": `title: ${title}`
|
|
44
|
+
// eslint-disable-next-line react/no-danger
|
|
45
|
+
,
|
|
46
|
+
dangerouslySetInnerHTML: {
|
|
47
|
+
__html: title
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
};
|
|
39
51
|
export default AppBarTitle;
|
package/AppBar/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { useMemo, useRef, useLayoutEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import classnames from 'classnames';
|
|
4
3
|
import { getAbsoluteHeight } from '@shopgate/pwa-common/helpers/dom';
|
|
5
4
|
import { themeColors } from '@shopgate/pwa-common/helpers/config';
|
|
6
|
-
import { setCSSCustomProp } from '@shopgate/engage/styles';
|
|
5
|
+
import { makeStyles, setCSSCustomProp } from '@shopgate/engage/styles';
|
|
7
6
|
import { SurroundPortals } from '@shopgate/engage/components';
|
|
8
7
|
import { APP_BAR_CONTENT } from '@shopgate/engage/core/constants';
|
|
9
8
|
import Field from "./components/Field";
|
|
@@ -13,13 +12,25 @@ import Right from "./components/Right";
|
|
|
13
12
|
import Center from "./components/Center";
|
|
14
13
|
import Left from "./components/Left";
|
|
15
14
|
import Below from "./components/Below";
|
|
16
|
-
import
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
const useStyles = makeStyles()({
|
|
17
|
+
outer: {
|
|
18
|
+
boxSizing: 'content-box',
|
|
19
|
+
minHeight: 44,
|
|
20
|
+
paddingTop: 'var(--safe-area-inset-top)'
|
|
21
|
+
},
|
|
22
|
+
inner: {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
justifyContent: 'space-between',
|
|
25
|
+
position: 'relative',
|
|
26
|
+
zIndex: 1
|
|
27
|
+
}
|
|
28
|
+
});
|
|
17
29
|
|
|
18
30
|
/**
|
|
19
31
|
* Updates the --app-bar-height custom property
|
|
20
32
|
* @param {Object} ref The app bar ref.
|
|
21
33
|
*/
|
|
22
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
34
|
const updateAppBarHeight = ref => {
|
|
24
35
|
if (!ref.current) {
|
|
25
36
|
return;
|
|
@@ -37,11 +48,15 @@ const AppBar = ({
|
|
|
37
48
|
center,
|
|
38
49
|
left,
|
|
39
50
|
right,
|
|
40
|
-
classes,
|
|
51
|
+
classes: parentClasses,
|
|
41
52
|
'aria-hidden': ariaHidden,
|
|
42
53
|
backgroundColor,
|
|
43
54
|
textColor
|
|
44
55
|
}) => {
|
|
56
|
+
const {
|
|
57
|
+
classes,
|
|
58
|
+
cx
|
|
59
|
+
} = useStyles();
|
|
45
60
|
const contentRef = useRef(null);
|
|
46
61
|
const style = useMemo(() => ({
|
|
47
62
|
background: backgroundColor,
|
|
@@ -59,7 +74,7 @@ const AppBar = ({
|
|
|
59
74
|
observer.disconnect();
|
|
60
75
|
};
|
|
61
76
|
}, [contentRef, observer]);
|
|
62
|
-
const sectionClasses =
|
|
77
|
+
const sectionClasses = cx(classes.outer, parentClasses.outer, 'ui-ios__app-bar');
|
|
63
78
|
return /*#__PURE__*/_jsxs("section", {
|
|
64
79
|
className: sectionClasses,
|
|
65
80
|
"data-test-id": "Navigator",
|
|
@@ -69,7 +84,7 @@ const AppBar = ({
|
|
|
69
84
|
children: [/*#__PURE__*/_jsx(SurroundPortals, {
|
|
70
85
|
portalName: APP_BAR_CONTENT,
|
|
71
86
|
children: /*#__PURE__*/_jsxs("div", {
|
|
72
|
-
className:
|
|
87
|
+
className: cx(classes.inner, parentClasses.inner),
|
|
73
88
|
children: [/*#__PURE__*/_jsx(Left, {
|
|
74
89
|
elements: left
|
|
75
90
|
}), /*#__PURE__*/_jsx(Center, {
|
|
@@ -1,32 +1,69 @@
|
|
|
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 borderColor = 'rgba(0,0,0,0.2)';
|
|
7
|
+
const useStyles = makeStyles()(theme => ({
|
|
8
|
+
button: {
|
|
9
|
+
'&& > *': {
|
|
10
|
+
color: 'var(--color-button-dialog-ios, #1a73e8)'
|
|
11
|
+
},
|
|
12
|
+
'&&': {
|
|
13
|
+
fontWeight: 400,
|
|
14
|
+
minWidth: '50%',
|
|
15
|
+
flexGrow: 1,
|
|
16
|
+
paddingTop: 10,
|
|
17
|
+
paddingBottom: 10
|
|
18
|
+
},
|
|
19
|
+
marginBottom: -1,
|
|
20
|
+
marginRight: theme.spacing(-0.5),
|
|
21
|
+
'&:not(:last-child)': {
|
|
22
|
+
borderRadius: '0 !important',
|
|
23
|
+
borderRight: `0.5px solid ${borderColor}`,
|
|
24
|
+
borderBottom: `0.5px solid ${borderColor}`
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
buttonPrimary: {
|
|
28
|
+
'&&': {
|
|
29
|
+
fontWeight: 400
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
buttonText: {
|
|
33
|
+
overflow: 'hidden',
|
|
34
|
+
textOverflow: 'ellipsis',
|
|
35
|
+
display: 'block'
|
|
36
|
+
}
|
|
37
|
+
}));
|
|
6
38
|
|
|
7
39
|
/**
|
|
8
40
|
* @param {Object} props The component props.
|
|
9
41
|
* @returns {JSX}
|
|
10
42
|
*/
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
43
|
const Buttons = ({
|
|
13
44
|
actions
|
|
14
|
-
}) =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
45
|
+
}) => {
|
|
46
|
+
const {
|
|
47
|
+
classes,
|
|
48
|
+
cx
|
|
49
|
+
} = useStyles();
|
|
50
|
+
return actions.map(({
|
|
51
|
+
label,
|
|
52
|
+
action,
|
|
53
|
+
type = 'normal',
|
|
54
|
+
disabled = false
|
|
55
|
+
}) => /*#__PURE__*/_jsx(Button, {
|
|
56
|
+
className: cx(classes.button, type === 'primary' && classes.buttonPrimary),
|
|
57
|
+
type: "primary",
|
|
58
|
+
onClick: action,
|
|
59
|
+
disabled: disabled,
|
|
60
|
+
flat: true,
|
|
61
|
+
children: /*#__PURE__*/_jsx(I18n.Text, {
|
|
62
|
+
className: classes.buttonText,
|
|
63
|
+
string: label
|
|
64
|
+
})
|
|
65
|
+
}, label));
|
|
66
|
+
};
|
|
30
67
|
Buttons.defaultProps = {
|
|
31
68
|
actions: []
|
|
32
69
|
};
|
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
3
|
+
import { themeColors } 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: themeColors.dark,
|
|
9
|
+
flexGrow: 1,
|
|
10
|
+
fontSize: '13px',
|
|
11
|
+
textAlign: 'center',
|
|
12
|
+
overflow: 'auto'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
4
15
|
|
|
5
16
|
/**
|
|
6
17
|
* @param {Object} props The component props.
|
|
7
18
|
* @returns {JSX}
|
|
8
19
|
*/
|
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
20
|
const Content = ({
|
|
11
21
|
content
|
|
12
22
|
}) => {
|
|
23
|
+
const {
|
|
24
|
+
classes
|
|
25
|
+
} = useStyles();
|
|
13
26
|
if (!content) {
|
|
14
27
|
return null;
|
|
15
28
|
}
|
|
16
29
|
return /*#__PURE__*/_jsx("div", {
|
|
17
|
-
className:
|
|
30
|
+
className: classes.body,
|
|
18
31
|
id: "basicDialogDesc",
|
|
19
32
|
children: content
|
|
20
33
|
});
|
|
@@ -1,22 +1,30 @@
|
|
|
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 { makeStyles } from '@shopgate/engage/styles';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const useStyles = makeStyles()({
|
|
7
|
+
title: {
|
|
8
|
+
textAlign: 'center',
|
|
9
|
+
fontWeight: 600
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
|
|
7
13
|
/**
|
|
8
14
|
* @param {Object} props The component props.
|
|
9
15
|
* @returns {JSX}
|
|
10
16
|
*/
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
17
|
const Title = ({
|
|
13
18
|
title
|
|
14
19
|
}) => {
|
|
20
|
+
const {
|
|
21
|
+
classes
|
|
22
|
+
} = useStyles();
|
|
15
23
|
if (!title) {
|
|
16
24
|
return null;
|
|
17
25
|
}
|
|
18
26
|
return /*#__PURE__*/_jsx("div", {
|
|
19
|
-
className:
|
|
27
|
+
className: classes.title,
|
|
20
28
|
id: "basicDialogTitle",
|
|
21
29
|
role: "heading",
|
|
22
30
|
"aria-level": "2",
|
package/BaseDialog/index.js
CHANGED
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { FocusTrap } from '@shopgate/engage/a11y/components';
|
|
4
|
+
import { themeColors } from '@shopgate/pwa-common/helpers/config';
|
|
5
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
4
6
|
import Title from "./components/Title";
|
|
5
7
|
import Content from "./components/Content";
|
|
6
8
|
import Buttons from "./components/Buttons";
|
|
7
|
-
import
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
const outerGap = 40;
|
|
11
|
+
const borderColor = 'rgba(0,0,0,0.2)';
|
|
12
|
+
const useStyles = makeStyles()({
|
|
13
|
+
container: {
|
|
14
|
+
position: 'relative',
|
|
15
|
+
overflow: 'hidden',
|
|
16
|
+
display: 'flex',
|
|
17
|
+
flexDirection: 'column',
|
|
18
|
+
width: 270,
|
|
19
|
+
maxHeight: `calc(100vh - ${outerGap * 2}px)`,
|
|
20
|
+
borderRadius: 14,
|
|
21
|
+
background: themeColors.lightTransparent,
|
|
22
|
+
backdropFilter: 'blur(20px)'
|
|
23
|
+
},
|
|
24
|
+
content: {
|
|
25
|
+
padding: '16px',
|
|
26
|
+
display: 'flex',
|
|
27
|
+
flexDirection: 'column'
|
|
28
|
+
},
|
|
29
|
+
actions: {
|
|
30
|
+
borderTop: `0.5px solid ${borderColor}`,
|
|
31
|
+
display: 'flex',
|
|
32
|
+
flexWrap: 'wrap'
|
|
33
|
+
}
|
|
34
|
+
});
|
|
8
35
|
|
|
9
36
|
/**
|
|
10
37
|
* This component renders a basic dialog in Google Material Design.
|
|
@@ -15,33 +42,38 @@ import styles from "./style";
|
|
|
15
42
|
* @param {string | ReactNode} props.title The title of the dialog.
|
|
16
43
|
* @return {JSX.Element} The rendered dialog.
|
|
17
44
|
*/
|
|
18
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
45
|
const BasicDialog = ({
|
|
20
46
|
children,
|
|
21
47
|
actions,
|
|
22
48
|
title
|
|
23
|
-
}) =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
49
|
+
}) => {
|
|
50
|
+
const {
|
|
51
|
+
classes,
|
|
52
|
+
cx
|
|
53
|
+
} = useStyles();
|
|
54
|
+
return /*#__PURE__*/_jsx(FocusTrap, {
|
|
55
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
56
|
+
className: cx(classes.container, 'ui-ios__base-dialog'),
|
|
57
|
+
"data-test-id": "basicDialog",
|
|
58
|
+
role: "alertdialog",
|
|
59
|
+
"aria-modal": true,
|
|
60
|
+
"aria-labelledby": "basicDialogTitle basicDialogDesc",
|
|
61
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
62
|
+
className: classes.content,
|
|
63
|
+
children: [/*#__PURE__*/_jsx(Title, {
|
|
64
|
+
title: title
|
|
65
|
+
}), /*#__PURE__*/_jsx(Content, {
|
|
66
|
+
content: children
|
|
67
|
+
})]
|
|
68
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
69
|
+
className: classes.actions,
|
|
70
|
+
children: /*#__PURE__*/_jsx(Buttons, {
|
|
71
|
+
actions: actions
|
|
72
|
+
})
|
|
36
73
|
})]
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
actions: actions
|
|
41
|
-
})
|
|
42
|
-
})]
|
|
43
|
-
})
|
|
44
|
-
});
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
};
|
|
45
77
|
BasicDialog.defaultProps = {
|
|
46
78
|
children: null,
|
|
47
79
|
actions: [],
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IconProps } from '@shopgate/pwa-common/components/Icon';
|
|
2
|
+
/**
|
|
3
|
+
* The cart icon component.
|
|
4
|
+
*/
|
|
5
|
+
declare const CartIcon: (props: Omit<IconProps, "content">) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default CartIcon;
|
|
7
|
+
//# sourceMappingURL=CartIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CartIcon.d.ts","sourceRoot":"","sources":["../../icons/CartIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAItE;;GAEG;AACH,QAAA,MAAM,QAAQ,GAAI,OAAO,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,4CACI,CAAC;AAExD,eAAe,QAAQ,CAAC"}
|
package/icons/CartIcon.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import Icon from '@shopgate/pwa-common/components/Icon';
|
|
3
2
|
import { themeConfig } from '@shopgate/pwa-common/helpers/config';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* The cart icon component.
|
|
7
|
-
* @param {Object} props The icon component properties.
|
|
8
|
-
* @returns {JSX}
|
|
9
6
|
*/
|
|
10
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
8
|
const CartIcon = props => /*#__PURE__*/_jsx(Icon, {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IconProps } from '@shopgate/pwa-common/components/Icon';
|
|
2
|
+
/**
|
|
3
|
+
* The filter icon component.
|
|
4
|
+
*/
|
|
5
|
+
declare const Filter: (props: Omit<IconProps, "content">) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default Filter;
|
|
7
|
+
//# sourceMappingURL=FilterIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterIcon.d.ts","sourceRoot":"","sources":["../../icons/FilterIcon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAItE;;GAEG;AACH,QAAA,MAAM,MAAM,GAAI,OAAO,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,4CACQ,CAAC;AAE1D,eAAe,MAAM,CAAC"}
|
package/icons/FilterIcon.js
CHANGED
|
@@ -4,8 +4,6 @@ import { themeConfig } from '@shopgate/pwa-common/helpers/config';
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The filter icon component.
|
|
7
|
-
* @param {Object} props The icon component properties.
|
|
8
|
-
* @returns {JSX}
|
|
9
7
|
*/
|
|
10
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
9
|
const Filter = props => /*#__PURE__*/_jsx(Icon, {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IconProps } from '@shopgate/pwa-common/components/Icon';
|
|
2
|
+
/**
|
|
3
|
+
* The home icon component.
|
|
4
|
+
*/
|
|
5
|
+
declare const Home: (props: Omit<IconProps, "content">) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default Home;
|
|
7
|
+
//# sourceMappingURL=HomeIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HomeIcon.d.ts","sourceRoot":"","sources":["../../icons/HomeIcon.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAGtE;;GAEG;AACH,QAAA,MAAM,IAAI,GAAI,OAAO,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,4CAE9C,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/icons/HomeIcon.js
CHANGED
|
@@ -4,8 +4,6 @@ import { themeConfig } from '@shopgate/pwa-common/helpers/config';
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The home icon component.
|
|
7
|
-
* @param {Object} props The icon component properties.
|
|
8
|
-
* @returns {JSX}
|
|
9
7
|
*/
|
|
10
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
9
|
const Home = props => /*#__PURE__*/_jsx(Icon, {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IconProps } from '@shopgate/pwa-common/components/Icon';
|
|
2
|
+
/**
|
|
3
|
+
* The Share icon component.
|
|
4
|
+
*/
|
|
5
|
+
declare const ShareIcon: (props: Omit<IconProps, "content">) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default ShareIcon;
|
|
7
|
+
//# sourceMappingURL=ShareIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShareIcon.d.ts","sourceRoot":"","sources":["../../icons/ShareIcon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAItE;;GAEG;AACH,QAAA,MAAM,SAAS,GAAI,OAAO,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,4CACI,CAAC;AAEzD,eAAe,SAAS,CAAC"}
|
package/icons/ShareIcon.js
CHANGED
|
@@ -4,8 +4,6 @@ import { themeConfig } from '@shopgate/pwa-common/helpers/config';
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The Share icon component.
|
|
7
|
-
* @param {Object} props The icon component properties.
|
|
8
|
-
* @returns {JSX}
|
|
9
7
|
*/
|
|
10
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
9
|
const ShareIcon = props => /*#__PURE__*/_jsx(Icon, {
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-ui-ios",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.31.0-alpha.1",
|
|
4
4
|
"description": "Shopgate's iOS UI components.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@shopgate/pwa-common": "7.
|
|
8
|
+
"@shopgate/pwa-common": "7.31.0-alpha.1",
|
|
9
9
|
"react": "^17.0.2"
|
|
10
10
|
},
|
|
11
11
|
"peerDependencies": {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@shopgate/engage/tsconfig.build.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "./dist",
|
|
5
|
+
"rootDir": "."
|
|
6
|
+
},
|
|
7
|
+
"include": ["**/*.ts", "**/*.tsx"],
|
|
8
|
+
"exclude": [
|
|
9
|
+
"dist",
|
|
10
|
+
"node_modules",
|
|
11
|
+
"**/*.spec.*",
|
|
12
|
+
"**/__tests__/**",
|
|
13
|
+
"**/__snapshots__/**",
|
|
14
|
+
"coverage"
|
|
15
|
+
]
|
|
16
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { css } from 'glamor';
|
|
2
|
-
export default css({
|
|
3
|
-
alignItems: 'center',
|
|
4
|
-
color: 'inherit',
|
|
5
|
-
display: 'flex',
|
|
6
|
-
flexShrink: 0,
|
|
7
|
-
fontSize: 24,
|
|
8
|
-
height: 44,
|
|
9
|
-
justifyContent: 'center',
|
|
10
|
-
outline: 0,
|
|
11
|
-
padding: 0,
|
|
12
|
-
position: 'relative',
|
|
13
|
-
width: 44,
|
|
14
|
-
zIndex: 1
|
|
15
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { css } from 'glamor';
|
|
2
|
-
export default css({
|
|
3
|
-
fontSize: 17,
|
|
4
|
-
fontWeight: 600,
|
|
5
|
-
flexGrow: 1,
|
|
6
|
-
lineHeight: '44px',
|
|
7
|
-
left: 90,
|
|
8
|
-
overflow: 'hidden',
|
|
9
|
-
position: 'absolute',
|
|
10
|
-
right: 90,
|
|
11
|
-
textAlign: 'center',
|
|
12
|
-
textOverflow: 'ellipsis',
|
|
13
|
-
top: 0,
|
|
14
|
-
whiteSpace: 'nowrap'
|
|
15
|
-
});
|
package/AppBar/style.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { css } from 'glamor';
|
|
2
|
-
const outer = css({
|
|
3
|
-
boxSizing: 'content-box',
|
|
4
|
-
minHeight: 44,
|
|
5
|
-
paddingTop: 'var(--safe-area-inset-top)'
|
|
6
|
-
}).toString();
|
|
7
|
-
const inner = css({
|
|
8
|
-
display: 'flex',
|
|
9
|
-
justifyContent: 'space-between',
|
|
10
|
-
position: 'relative',
|
|
11
|
-
zIndex: 1
|
|
12
|
-
}).toString();
|
|
13
|
-
export default {
|
|
14
|
-
outer,
|
|
15
|
-
inner
|
|
16
|
-
};
|
package/BaseDialog/style.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { css } from 'glamor';
|
|
2
|
-
import { themeColors, themeVariables } from '@shopgate/pwa-common/helpers/config';
|
|
3
|
-
const outerGap = 40;
|
|
4
|
-
const borderColor = 'rgba(0,0,0,0.2)';
|
|
5
|
-
const container = css({
|
|
6
|
-
position: 'relative',
|
|
7
|
-
overflow: 'hidden',
|
|
8
|
-
display: 'flex',
|
|
9
|
-
flexDirection: 'column',
|
|
10
|
-
width: 270,
|
|
11
|
-
maxHeight: `calc(100vh - ${outerGap * 2}px)`,
|
|
12
|
-
borderRadius: 14,
|
|
13
|
-
background: themeColors.lightTransparent,
|
|
14
|
-
backdropFilter: 'blur(20px)'
|
|
15
|
-
}).toString();
|
|
16
|
-
const content = css({
|
|
17
|
-
padding: '16px',
|
|
18
|
-
display: 'flex',
|
|
19
|
-
flexDirection: 'column'
|
|
20
|
-
}).toString();
|
|
21
|
-
const title = css({
|
|
22
|
-
textAlign: 'center',
|
|
23
|
-
fontWeight: 600
|
|
24
|
-
}).toString();
|
|
25
|
-
const body = css({
|
|
26
|
-
color: themeColors.dark,
|
|
27
|
-
flexGrow: 1,
|
|
28
|
-
fontSize: '13px',
|
|
29
|
-
textAlign: 'center',
|
|
30
|
-
overflow: 'auto'
|
|
31
|
-
}).toString();
|
|
32
|
-
const actions = css({
|
|
33
|
-
borderTop: `0.5px solid ${borderColor}`,
|
|
34
|
-
display: 'flex',
|
|
35
|
-
flexWrap: 'wrap'
|
|
36
|
-
}).toString();
|
|
37
|
-
const button = css({
|
|
38
|
-
'&& > *': {
|
|
39
|
-
color: 'var(--color-button-dialog-ios, #1a73e8)'
|
|
40
|
-
},
|
|
41
|
-
// Increases specificity to allow button customization.
|
|
42
|
-
'&&': {
|
|
43
|
-
fontWeight: 400,
|
|
44
|
-
minWidth: '50%',
|
|
45
|
-
flexGrow: 1,
|
|
46
|
-
paddingTop: 10,
|
|
47
|
-
paddingBottom: 10
|
|
48
|
-
},
|
|
49
|
-
/*
|
|
50
|
-
* Due to overflow hidden this will cause the bottom border to be
|
|
51
|
-
* not visible in vertical button mode.
|
|
52
|
-
*/
|
|
53
|
-
marginBottom: -1,
|
|
54
|
-
marginRight: `-${themeVariables.gap.small / 2}px`,
|
|
55
|
-
'&:not(:last-child)': {
|
|
56
|
-
borderRadius: '0 !important',
|
|
57
|
-
borderRight: `0.5px solid ${borderColor}`,
|
|
58
|
-
borderBottom: `0.5px solid ${borderColor}`
|
|
59
|
-
}
|
|
60
|
-
}).toString();
|
|
61
|
-
const buttonPrimary = css({
|
|
62
|
-
'&&': {
|
|
63
|
-
fontWeight: 400
|
|
64
|
-
}
|
|
65
|
-
}).toString();
|
|
66
|
-
const buttonText = css({
|
|
67
|
-
overflow: 'hidden',
|
|
68
|
-
textOverflow: 'ellipsis',
|
|
69
|
-
display: 'block'
|
|
70
|
-
}).toString();
|
|
71
|
-
export default {
|
|
72
|
-
container,
|
|
73
|
-
content,
|
|
74
|
-
title,
|
|
75
|
-
body,
|
|
76
|
-
actions,
|
|
77
|
-
button,
|
|
78
|
-
buttonPrimary,
|
|
79
|
-
buttonText
|
|
80
|
-
};
|