@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
package/SnackBar/index.js
CHANGED
|
@@ -1,186 +1,196 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
3
|
-
import React, { Component } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import Color from 'color';
|
|
5
4
|
import { config } from 'react-spring';
|
|
6
5
|
import { Spring } from 'react-spring/renderprops.cjs';
|
|
7
6
|
import Ellipsis from '@shopgate/pwa-common/components/Ellipsis';
|
|
8
|
-
import
|
|
7
|
+
import { i18n } from '@shopgate/engage/core/helpers';
|
|
8
|
+
import { themeColors, themeShadows } from '@shopgate/pwa-common/helpers/config';
|
|
9
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
9
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
11
|
const defaultToast = {};
|
|
12
|
+
const backgroundColor = themeColors.lightDark;
|
|
13
|
+
const buttonColor = themeColors.accent;
|
|
14
|
+
const buttonColorContrast = Color(buttonColor).contrast(Color(backgroundColor));
|
|
15
|
+
const safeButtonColor = buttonColorContrast > 4 ? buttonColor : themeColors.light;
|
|
16
|
+
const useStyles = makeStyles()({
|
|
17
|
+
container: {
|
|
18
|
+
position: 'fixed',
|
|
19
|
+
height: 'var(--snack-bar-height, 80px)',
|
|
20
|
+
bottom: 'max(var(--footer-height), var(--safe-area-inset-bottom))',
|
|
21
|
+
transition: 'bottom 0.3s ease',
|
|
22
|
+
overflow: 'hidden',
|
|
23
|
+
zIndex: 6,
|
|
24
|
+
width: '100%'
|
|
25
|
+
},
|
|
26
|
+
wrapper: {
|
|
27
|
+
top: 'var(--snack-bar-height, 80px)',
|
|
28
|
+
display: 'flex',
|
|
29
|
+
justifyContent: 'center',
|
|
30
|
+
left: 0,
|
|
31
|
+
position: 'absolute',
|
|
32
|
+
width: '100%',
|
|
33
|
+
zIndex: 6
|
|
34
|
+
},
|
|
35
|
+
box: {
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
background: backgroundColor,
|
|
38
|
+
borderRadius: 3,
|
|
39
|
+
boxShadow: themeShadows.toast,
|
|
40
|
+
color: themeColors.light,
|
|
41
|
+
display: 'flex',
|
|
42
|
+
fontSize: '0.875rem',
|
|
43
|
+
justifyContent: 'space-between',
|
|
44
|
+
letterSpacing: 0.5,
|
|
45
|
+
margin: 16,
|
|
46
|
+
maxWidth: 344,
|
|
47
|
+
minHeight: 48,
|
|
48
|
+
padding: '6px 16px',
|
|
49
|
+
width: '100%'
|
|
50
|
+
},
|
|
51
|
+
label: {
|
|
52
|
+
lineHeight: 1.4,
|
|
53
|
+
margin: '6px 0',
|
|
54
|
+
overflow: 'hidden'
|
|
55
|
+
},
|
|
56
|
+
actionButton: {
|
|
57
|
+
color: safeButtonColor,
|
|
58
|
+
fontWeight: 500,
|
|
59
|
+
height: 36,
|
|
60
|
+
letterSpacing: 'inherit',
|
|
61
|
+
margin: '0 -8px 0 8px',
|
|
62
|
+
outline: 0,
|
|
63
|
+
padding: '0 8px',
|
|
64
|
+
textTransform: 'uppercase'
|
|
65
|
+
}
|
|
66
|
+
});
|
|
11
67
|
|
|
12
68
|
/**
|
|
13
|
-
*
|
|
69
|
+
* Calculates the required amount of rows for the snack bar.
|
|
70
|
+
* @param {string} message The snack bar message.
|
|
71
|
+
* @param {string} actionLabel The snack bar action label.
|
|
72
|
+
* @return {number}
|
|
14
73
|
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @param {Object} props The component props.
|
|
18
|
-
*/
|
|
19
|
-
function SnackBar(props) {
|
|
20
|
-
var _this;
|
|
21
|
-
_this = _Component.call(this, props) || this;
|
|
22
|
-
_this.timer = null;
|
|
23
|
-
_this.handleAction = () => {
|
|
24
|
-
clearTimeout(_this.timer);
|
|
25
|
-
_this.props.toasts[0].action();
|
|
26
|
-
_this.hide();
|
|
27
|
-
};
|
|
28
|
-
_this.handleEntered = () => {
|
|
29
|
-
_this.timer = setTimeout(_this.hide, _this.props.toasts[0].duration || 2500);
|
|
30
|
-
};
|
|
31
|
-
_this.handleRest = () => {
|
|
32
|
-
if (_this.state.visible) {
|
|
33
|
-
_this.handleEntered();
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
_this.props.removeToast();
|
|
37
|
-
};
|
|
38
|
-
_this.hide = () => {
|
|
39
|
-
_this.setState({
|
|
40
|
-
visible: false
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Calculates the required amount of rows for the snack bar.
|
|
45
|
-
* @param {string} message The snack bar message.
|
|
46
|
-
* @param {string} actionLabel The snack bar action label.
|
|
47
|
-
* @return {number}
|
|
48
|
-
*/
|
|
49
|
-
_this.calcRows = (message, actionLabel) => {
|
|
50
|
-
/**
|
|
51
|
-
* Calculates the amount of rows for a passed text.
|
|
52
|
-
* @param {string} text The input text.
|
|
53
|
-
* @return {number}
|
|
54
|
-
*/
|
|
55
|
-
const calc = text => Math.max(2, Math.ceil(text.length / 40));
|
|
56
|
-
/**
|
|
57
|
-
* First calculate the required amount of rows for the message. Then append the action label
|
|
58
|
-
* once per line and calculate the rows again. Since the action label occupies an own column,
|
|
59
|
-
* we'll get an approximated number for the required rows.
|
|
60
|
-
*/
|
|
61
|
-
return calc(`${message}${actionLabel.repeat(calc(message))}`);
|
|
62
|
-
};
|
|
63
|
-
_this.state = {
|
|
64
|
-
visible: true
|
|
65
|
-
};
|
|
66
|
-
return _this;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* @param {Object} nextProps The next component props.
|
|
71
|
-
*/
|
|
72
|
-
_inheritsLoose(SnackBar, _Component);
|
|
73
|
-
var _proto = SnackBar.prototype;
|
|
74
|
-
_proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
75
|
-
const hasToast = nextProps.toasts.length > 0;
|
|
76
|
-
this.setState({
|
|
77
|
-
visible: hasToast
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
74
|
+
const calcRows = (message, actionLabel) => {
|
|
81
75
|
/**
|
|
82
|
-
* @param {
|
|
83
|
-
* @
|
|
84
|
-
* @returns {boolean}
|
|
85
|
-
*/;
|
|
86
|
-
_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
|
|
87
|
-
return this.state.visible !== nextState.visible;
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* @returns {JSX}
|
|
76
|
+
* @param {string} text Input text.
|
|
77
|
+
* @returns {number} Row count for the text.
|
|
91
78
|
*/
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
} = this.state;
|
|
96
|
-
const {
|
|
97
|
-
action = null,
|
|
98
|
-
actionLabel = null,
|
|
99
|
-
message = null
|
|
100
|
-
} = this.snack;
|
|
79
|
+
const rowsFor = text => Math.max(2, Math.ceil(text.length / 40));
|
|
80
|
+
return rowsFor(`${message}${actionLabel.repeat(rowsFor(message))}`);
|
|
81
|
+
};
|
|
101
82
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
83
|
+
/**
|
|
84
|
+
* The SnackBar component.
|
|
85
|
+
* @param {Object} props Props.
|
|
86
|
+
* @returns {JSX.Element}
|
|
87
|
+
*/
|
|
88
|
+
const SnackBar = ({
|
|
89
|
+
removeToast,
|
|
90
|
+
toasts: toastsProp
|
|
91
|
+
}) => {
|
|
92
|
+
const {
|
|
93
|
+
classes,
|
|
94
|
+
cx
|
|
95
|
+
} = useStyles();
|
|
96
|
+
const toasts = useMemo(() => toastsProp || [], [toastsProp]);
|
|
97
|
+
const [visible, setVisible] = useState(true);
|
|
98
|
+
const visibleRef = useRef(visible);
|
|
99
|
+
const timerRef = useRef(null);
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
visibleRef.current = visible;
|
|
102
|
+
}, [visible]);
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
setVisible(toasts.length > 0);
|
|
105
|
+
}, [toasts.length]);
|
|
106
|
+
const snack = useMemo(() => {
|
|
107
|
+
const raw = toasts.length ? toasts[0] : defaultToast;
|
|
108
|
+
return {
|
|
109
|
+
...raw,
|
|
110
|
+
message: i18n.text(raw.message || '', raw.messageParams || {}),
|
|
111
|
+
actionLabel: i18n.text(raw.actionLabel || '')
|
|
107
112
|
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
}, [toasts]);
|
|
114
|
+
const hide = useCallback(() => {
|
|
115
|
+
clearTimeout(timerRef.current);
|
|
116
|
+
setVisible(false);
|
|
117
|
+
}, []);
|
|
118
|
+
const handleAction = useCallback(() => {
|
|
119
|
+
clearTimeout(timerRef.current);
|
|
120
|
+
if (toasts[0]) {
|
|
121
|
+
toasts[0].action();
|
|
122
|
+
}
|
|
123
|
+
hide();
|
|
124
|
+
}, [toasts, hide]);
|
|
125
|
+
const handleRest = useCallback(() => {
|
|
126
|
+
if (visibleRef.current) {
|
|
127
|
+
const duration = toasts[0]?.duration || 2500;
|
|
128
|
+
timerRef.current = setTimeout(hide, duration);
|
|
129
|
+
} else {
|
|
130
|
+
removeToast();
|
|
131
|
+
}
|
|
132
|
+
}, [toasts, hide, removeToast]);
|
|
133
|
+
const {
|
|
134
|
+
action = null,
|
|
135
|
+
actionLabel = null,
|
|
136
|
+
message = null
|
|
137
|
+
} = snack;
|
|
138
|
+
const boxProps = {
|
|
139
|
+
...(action && !actionLabel && {
|
|
140
|
+
onClick: handleAction
|
|
141
|
+
})
|
|
142
|
+
};
|
|
143
|
+
const rows = calcRows(message, actionLabel);
|
|
144
|
+
const snackBarHeight = 40 + rows * 20;
|
|
145
|
+
return /*#__PURE__*/_jsx("div", {
|
|
146
|
+
className: cx(classes.container, 'ui-material__snack-bar'),
|
|
147
|
+
style: {
|
|
148
|
+
'--snack-bar-height': `${snackBarHeight}px`
|
|
149
|
+
},
|
|
150
|
+
children: /*#__PURE__*/_jsx(Spring, {
|
|
151
|
+
from: {
|
|
152
|
+
top: snackBarHeight
|
|
153
|
+
},
|
|
154
|
+
to: {
|
|
155
|
+
top: 0
|
|
116
156
|
},
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}), action && actionLabel && /*#__PURE__*/_jsx("button", {
|
|
149
|
-
className: styles.button,
|
|
150
|
-
onClick: this.handleAction,
|
|
151
|
-
type: "button",
|
|
152
|
-
"aria-hidden": true,
|
|
153
|
-
children: actionLabel
|
|
154
|
-
})]
|
|
155
|
-
})
|
|
157
|
+
config: config.stiff,
|
|
158
|
+
reverse: !visible,
|
|
159
|
+
force: true,
|
|
160
|
+
onRest: handleRest,
|
|
161
|
+
children: springProps =>
|
|
162
|
+
/*#__PURE__*/
|
|
163
|
+
// eslint-disable-next-line max-len
|
|
164
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
165
|
+
_jsx("div", {
|
|
166
|
+
className: classes.wrapper,
|
|
167
|
+
style: springProps,
|
|
168
|
+
"data-footer-inset-update-ignore": "true",
|
|
169
|
+
onClick: hide,
|
|
170
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
171
|
+
className: classes.box,
|
|
172
|
+
...boxProps,
|
|
173
|
+
children: [/*#__PURE__*/_jsx(Ellipsis, {
|
|
174
|
+
rows: rows,
|
|
175
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
176
|
+
className: classes.label,
|
|
177
|
+
"aria-live": "assertive",
|
|
178
|
+
role: "status",
|
|
179
|
+
children: message
|
|
180
|
+
})
|
|
181
|
+
}), action && actionLabel && /*#__PURE__*/_jsx("button", {
|
|
182
|
+
className: classes.actionButton,
|
|
183
|
+
onClick: handleAction,
|
|
184
|
+
type: "button",
|
|
185
|
+
"aria-hidden": true,
|
|
186
|
+
children: actionLabel
|
|
187
|
+
})]
|
|
156
188
|
})
|
|
157
189
|
})
|
|
158
|
-
})
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
key: "snack",
|
|
162
|
-
get:
|
|
163
|
-
/**
|
|
164
|
-
* Returns the first snack from the state.
|
|
165
|
-
* @returns {Object}
|
|
166
|
-
*/
|
|
167
|
-
function () {
|
|
168
|
-
const {
|
|
169
|
-
__
|
|
170
|
-
} = this.context.i18n();
|
|
171
|
-
const snack = this.props.toasts.length ? this.props.toasts[0] : defaultToast;
|
|
172
|
-
return {
|
|
173
|
-
...snack,
|
|
174
|
-
message: __(snack.message || '', snack.messageParams || {}),
|
|
175
|
-
actionLabel: __(snack.actionLabel || '')
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
}]);
|
|
179
|
-
}(Component);
|
|
190
|
+
})
|
|
191
|
+
});
|
|
192
|
+
};
|
|
180
193
|
SnackBar.defaultProps = {
|
|
181
194
|
toasts: null
|
|
182
195
|
};
|
|
183
|
-
SnackBar.contextTypes = {
|
|
184
|
-
i18n: PropTypes.func
|
|
185
|
-
};
|
|
186
196
|
export default SnackBar;
|
|
@@ -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,22 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-ui-material",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.31.0-alpha.1",
|
|
4
4
|
"description": "Shopgate's material design 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
|
+
"@types/color": "^4.2.0",
|
|
10
|
+
"@types/react-transition-group": "^4.4.12",
|
|
9
11
|
"react": "^17.0.2",
|
|
10
12
|
"react-dom": "^17.0.2",
|
|
11
13
|
"redux": "^5.0.1"
|
|
12
14
|
},
|
|
13
15
|
"dependencies": {
|
|
14
16
|
"classnames": "2.5.1",
|
|
15
|
-
"color": "^
|
|
17
|
+
"color": "^4.2.3",
|
|
16
18
|
"glamor": "^2.20.40",
|
|
17
19
|
"prop-types": "~15.8.1",
|
|
18
20
|
"react-spring": "^8.0.27",
|
|
19
|
-
"react-transition-group": "^
|
|
21
|
+
"react-transition-group": "^4.4.5",
|
|
20
22
|
"react-use": "^17.6.0"
|
|
21
23
|
},
|
|
22
24
|
"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
package/Accordion/style.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
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,14 +0,0 @@
|
|
|
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
|
-
});
|
package/AppBar/style.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { css } from 'glamor';
|
|
2
|
-
const outer = css({
|
|
3
|
-
boxSizing: 'content-box',
|
|
4
|
-
left: 0,
|
|
5
|
-
paddingTop: 'var(--safe-area-inset-top)',
|
|
6
|
-
position: 'sticky',
|
|
7
|
-
top: 0,
|
|
8
|
-
width: '100%',
|
|
9
|
-
zIndex: 15
|
|
10
|
-
});
|
|
11
|
-
const inner = css({
|
|
12
|
-
background: 'inherit',
|
|
13
|
-
display: 'flex',
|
|
14
|
-
justifyContent: 'space-between',
|
|
15
|
-
position: 'relative',
|
|
16
|
-
zIndex: 14
|
|
17
|
-
});
|
|
18
|
-
export default {
|
|
19
|
-
outer,
|
|
20
|
-
inner
|
|
21
|
-
};
|
package/BaseDialog/style.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { css } from 'glamor';
|
|
2
|
-
import { responsiveMediaQuery } from '@shopgate/engage/styles';
|
|
3
|
-
import { themeConfig } from '@shopgate/pwa-common/helpers/config';
|
|
4
|
-
const outerGap = 40;
|
|
5
|
-
const container = css({
|
|
6
|
-
position: 'relative',
|
|
7
|
-
display: 'flex',
|
|
8
|
-
flexDirection: 'column',
|
|
9
|
-
width: `calc(100vw - ${outerGap * 2}px)`,
|
|
10
|
-
maxHeight: `calc(100vh - ${outerGap * 2}px)`,
|
|
11
|
-
borderRadius: 2,
|
|
12
|
-
boxShadow: themeConfig.shadows.dialog,
|
|
13
|
-
background: themeConfig.colors.light,
|
|
14
|
-
[responsiveMediaQuery('>xs', {
|
|
15
|
-
webOnly: true
|
|
16
|
-
})]: {
|
|
17
|
-
width: `calc(80vh - ${outerGap * 2}px)`,
|
|
18
|
-
maxHeight: `calc(80vh - ${outerGap * 2}px)`
|
|
19
|
-
},
|
|
20
|
-
[responsiveMediaQuery('>md', {
|
|
21
|
-
webOnly: true
|
|
22
|
-
})]: {
|
|
23
|
-
width: `calc(var(--page-content-width) * 0.5 - ${outerGap * 2}px)`,
|
|
24
|
-
maxHeight: `calc(var(--page-content-width) * 0.5 - ${outerGap * 2}px)`
|
|
25
|
-
}
|
|
26
|
-
}).toString();
|
|
27
|
-
const content = css({
|
|
28
|
-
padding: themeConfig.variables.gap.small * 3,
|
|
29
|
-
overflowY: 'auto'
|
|
30
|
-
}).toString();
|
|
31
|
-
const title = css({
|
|
32
|
-
fontSize: '1.25em',
|
|
33
|
-
lineHeight: themeConfig.typography.lineHeight,
|
|
34
|
-
fontWeight: 500,
|
|
35
|
-
paddingBottom: themeConfig.variables.gap.small,
|
|
36
|
-
marginTop: '-.25em'
|
|
37
|
-
}).toString();
|
|
38
|
-
const body = css({
|
|
39
|
-
color: themeConfig.colors.shade6,
|
|
40
|
-
flexGrow: 1,
|
|
41
|
-
overflow: 'auto'
|
|
42
|
-
}).toString();
|
|
43
|
-
const actions = css({
|
|
44
|
-
alignSelf: 'flex-end',
|
|
45
|
-
padding: themeConfig.variables.gap.small
|
|
46
|
-
}).toString();
|
|
47
|
-
const innerActions = css({
|
|
48
|
-
display: 'flex',
|
|
49
|
-
flexWrap: 'wrap',
|
|
50
|
-
justifyContent: 'flex-end'
|
|
51
|
-
}).toString();
|
|
52
|
-
const button = css({
|
|
53
|
-
marginRight: `-${themeConfig.variables.gap.small / 2}px`,
|
|
54
|
-
textAlign: 'right'
|
|
55
|
-
}).toString();
|
|
56
|
-
export default {
|
|
57
|
-
container,
|
|
58
|
-
content,
|
|
59
|
-
title,
|
|
60
|
-
body,
|
|
61
|
-
actions,
|
|
62
|
-
innerActions,
|
|
63
|
-
button
|
|
64
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { css } from 'glamor';
|
|
2
|
-
import { themeConfig } from '@shopgate/pwa-common/helpers/config';
|
|
3
|
-
const {
|
|
4
|
-
shadows
|
|
5
|
-
} = themeConfig;
|
|
6
|
-
const button = css({
|
|
7
|
-
borderRadius: '50%',
|
|
8
|
-
outline: 0,
|
|
9
|
-
overflow: 'hidden',
|
|
10
|
-
padding: 0,
|
|
11
|
-
position: 'relative',
|
|
12
|
-
zIndex: 1,
|
|
13
|
-
':disabled': {
|
|
14
|
-
cursor: 'not-allowed'
|
|
15
|
-
}
|
|
16
|
-
}).toString();
|
|
17
|
-
const buttonSmall = css({
|
|
18
|
-
height: 40,
|
|
19
|
-
width: 40
|
|
20
|
-
});
|
|
21
|
-
const buttonLarge = css({
|
|
22
|
-
height: 56,
|
|
23
|
-
width: 56
|
|
24
|
-
});
|
|
25
|
-
const buttonShadow = css({
|
|
26
|
-
boxShadow: shadows.buttons.elevated
|
|
27
|
-
});
|
|
28
|
-
export default {
|
|
29
|
-
button,
|
|
30
|
-
buttonSmall,
|
|
31
|
-
buttonLarge,
|
|
32
|
-
buttonShadow
|
|
33
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { css } from 'glamor';
|
|
2
|
-
import { themeColors } from '@shopgate/pwa-common/helpers/config';
|
|
3
|
-
export default css({
|
|
4
|
-
// prevent two consecutive dividers
|
|
5
|
-
' + hr': {
|
|
6
|
-
display: 'none'
|
|
7
|
-
},
|
|
8
|
-
background: themeColors.darkGray,
|
|
9
|
-
border: 0,
|
|
10
|
-
height: 1,
|
|
11
|
-
margin: '16px 0'
|
|
12
|
-
});
|