@shopgate/pwa-ui-ios 7.33.3-beta.2 → 7.34.0-beta.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.
|
@@ -15,7 +15,12 @@ const useStyles = makeStyles()(theme => ({
|
|
|
15
15
|
padding: 0,
|
|
16
16
|
position: 'relative',
|
|
17
17
|
width: 44,
|
|
18
|
-
zIndex: 1
|
|
18
|
+
zIndex: 1,
|
|
19
|
+
'&:focus-visible:not([data-silent-focus])': {
|
|
20
|
+
outline: '2px solid currentColor',
|
|
21
|
+
outlineOffset: -6,
|
|
22
|
+
borderRadius: '50%'
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
25
|
}));
|
|
21
26
|
|
|
@@ -26,32 +31,48 @@ const useStyles = makeStyles()(theme => ({
|
|
|
26
31
|
*/
|
|
27
32
|
const AppBarIcon = props => {
|
|
28
33
|
const {
|
|
29
|
-
classes
|
|
34
|
+
classes,
|
|
35
|
+
cx
|
|
30
36
|
} = useStyles();
|
|
31
37
|
const {
|
|
32
38
|
background,
|
|
33
39
|
badge: Badge,
|
|
40
|
+
className,
|
|
34
41
|
color,
|
|
35
42
|
icon: Icon,
|
|
36
43
|
onClick,
|
|
37
44
|
testId,
|
|
38
45
|
'aria-hidden': ariaHidden,
|
|
39
46
|
'aria-label': ariaLabel,
|
|
40
|
-
...
|
|
47
|
+
...rest
|
|
41
48
|
} = props;
|
|
49
|
+
const entries = Object.entries(rest);
|
|
50
|
+
const dataAttributes = Object.fromEntries(entries.filter(([name]) => name.startsWith('data-')));
|
|
51
|
+
const iconProps = Object.fromEntries(entries.filter(([name]) => !name.startsWith('data-')));
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @param {KeyboardEvent} event The key event.
|
|
55
|
+
*/
|
|
56
|
+
const handleKeyDown = event => {
|
|
57
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
onClick(event);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
42
62
|
return /*#__PURE__*/_jsxs("div", {
|
|
43
|
-
onKeyDown:
|
|
63
|
+
onKeyDown: handleKeyDown,
|
|
44
64
|
tabIndex: 0,
|
|
45
65
|
role: "button",
|
|
46
66
|
"aria-hidden": ariaHidden,
|
|
47
67
|
"aria-label": ariaLabel,
|
|
48
|
-
className: classes.root,
|
|
68
|
+
className: cx(classes.root, 'ui-ios__app-bar__icon', className),
|
|
49
69
|
onClick: onClick,
|
|
50
70
|
style: {
|
|
51
71
|
background,
|
|
52
72
|
color
|
|
53
73
|
},
|
|
54
74
|
"data-test-id": testId,
|
|
75
|
+
...dataAttributes,
|
|
55
76
|
children: [/*#__PURE__*/_jsx(Icon, {
|
|
56
77
|
...iconProps
|
|
57
78
|
}, "icon"), Badge && /*#__PURE__*/_jsx(Badge, {}, "badge")]
|
|
@@ -62,6 +83,7 @@ AppBarIcon.defaultProps = {
|
|
|
62
83
|
'aria-label': null,
|
|
63
84
|
background: 'inherit',
|
|
64
85
|
badge: null,
|
|
86
|
+
className: null,
|
|
65
87
|
color: 'inherit',
|
|
66
88
|
testId: null
|
|
67
89
|
};
|
package/AppBar/index.js
CHANGED
|
@@ -16,14 +16,33 @@ const useStyles = makeStyles()(theme => ({
|
|
|
16
16
|
outer: {
|
|
17
17
|
boxSizing: 'content-box',
|
|
18
18
|
minHeight: 44,
|
|
19
|
-
paddingTop: theme.layout.safeArea.top
|
|
19
|
+
paddingTop: theme.layout.safeArea.top,
|
|
20
|
+
background: theme.components.appBar.background,
|
|
21
|
+
color: theme.components.appBar.color
|
|
20
22
|
},
|
|
21
23
|
inner: {
|
|
22
|
-
display: '
|
|
24
|
+
display: 'grid',
|
|
25
|
+
gridTemplateColumns: 'minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr)',
|
|
23
26
|
alignItems: 'center',
|
|
24
|
-
justifyContent: 'space-between',
|
|
25
27
|
position: 'relative',
|
|
26
|
-
zIndex: 1
|
|
28
|
+
zIndex: 1,
|
|
29
|
+
minHeight: 44
|
|
30
|
+
},
|
|
31
|
+
side: {
|
|
32
|
+
display: 'flex',
|
|
33
|
+
alignItems: 'center'
|
|
34
|
+
},
|
|
35
|
+
left: {
|
|
36
|
+
justifyContent: 'flex-start'
|
|
37
|
+
},
|
|
38
|
+
center: {
|
|
39
|
+
display: 'flex',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
justifyContent: 'center',
|
|
42
|
+
minWidth: 0
|
|
43
|
+
},
|
|
44
|
+
right: {
|
|
45
|
+
justifyContent: 'flex-end'
|
|
27
46
|
}
|
|
28
47
|
}));
|
|
29
48
|
|
|
@@ -47,11 +66,15 @@ const AppBar = ({
|
|
|
47
66
|
below,
|
|
48
67
|
center,
|
|
49
68
|
left,
|
|
69
|
+
leftEnd,
|
|
50
70
|
right,
|
|
71
|
+
rightStart,
|
|
51
72
|
classes: parentClasses,
|
|
52
73
|
'aria-hidden': ariaHidden,
|
|
53
74
|
backgroundColor,
|
|
54
|
-
textColor
|
|
75
|
+
textColor,
|
|
76
|
+
inert,
|
|
77
|
+
...props
|
|
55
78
|
}) => {
|
|
56
79
|
const {
|
|
57
80
|
classes,
|
|
@@ -59,38 +82,61 @@ const AppBar = ({
|
|
|
59
82
|
} = useStyles();
|
|
60
83
|
const contentRef = useRef(null);
|
|
61
84
|
const style = useMemo(() => ({
|
|
62
|
-
|
|
63
|
-
|
|
85
|
+
...(backgroundColor ? {
|
|
86
|
+
'--sg-components-appBar-background': backgroundColor
|
|
87
|
+
} : {}),
|
|
88
|
+
...(textColor ? {
|
|
89
|
+
'--sg-components-appBar-color': textColor
|
|
90
|
+
} : {})
|
|
64
91
|
}), [backgroundColor, textColor]);
|
|
65
|
-
const observer = useMemo(() =>
|
|
66
|
-
|
|
67
|
-
|
|
92
|
+
const observer = useMemo(() => {
|
|
93
|
+
const Observer = typeof ResizeObserver === 'function' ? ResizeObserver : MutationObserver;
|
|
94
|
+
return new Observer(() => {
|
|
95
|
+
updateAppBarHeight(contentRef);
|
|
96
|
+
});
|
|
97
|
+
}, [contentRef]);
|
|
68
98
|
useLayoutEffect(() => {
|
|
69
99
|
updateAppBarHeight(contentRef);
|
|
70
100
|
observer.observe(contentRef.current, {
|
|
71
|
-
childList: true
|
|
101
|
+
childList: true,
|
|
102
|
+
box: 'border-box'
|
|
72
103
|
});
|
|
73
104
|
return () => {
|
|
74
105
|
observer.disconnect();
|
|
75
106
|
};
|
|
76
107
|
}, [contentRef, observer]);
|
|
108
|
+
useLayoutEffect(() => {
|
|
109
|
+
updateAppBarHeight(contentRef);
|
|
110
|
+
});
|
|
77
111
|
const sectionClasses = cx(classes.outer, parentClasses.outer, 'ui-ios__app-bar');
|
|
112
|
+
const dataAttributes = Object.fromEntries(Object.entries(props).filter(([name]) => name.startsWith('data-')));
|
|
78
113
|
return /*#__PURE__*/_jsxs("section", {
|
|
79
114
|
className: sectionClasses,
|
|
80
115
|
"data-test-id": "Navigator",
|
|
81
116
|
style: style,
|
|
82
117
|
"aria-hidden": ariaHidden,
|
|
118
|
+
inert: inert ? '' : undefined,
|
|
83
119
|
ref: contentRef,
|
|
120
|
+
...dataAttributes,
|
|
84
121
|
children: [/*#__PURE__*/_jsx(SurroundPortals, {
|
|
85
122
|
portalName: APP_BAR_CONTENT,
|
|
86
123
|
children: /*#__PURE__*/_jsxs("div", {
|
|
87
|
-
className: cx(classes.inner, parentClasses.inner),
|
|
88
|
-
children: [/*#__PURE__*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
124
|
+
className: cx(classes.inner, 'ui-ios__app-bar__inner', parentClasses.inner),
|
|
125
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
126
|
+
className: cx(classes.side, classes.left, 'ui-ios__app-bar__left'),
|
|
127
|
+
children: [/*#__PURE__*/_jsx(Left, {
|
|
128
|
+
elements: left
|
|
129
|
+
}), leftEnd]
|
|
130
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
131
|
+
className: cx(classes.center, 'ui-ios__app-bar__center'),
|
|
132
|
+
children: /*#__PURE__*/_jsx(Center, {
|
|
133
|
+
elements: center
|
|
134
|
+
})
|
|
135
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
136
|
+
className: cx(classes.side, classes.right, 'ui-ios__app-bar__right'),
|
|
137
|
+
children: [rightStart, /*#__PURE__*/_jsx(Right, {
|
|
138
|
+
elements: right
|
|
139
|
+
})]
|
|
94
140
|
})]
|
|
95
141
|
})
|
|
96
142
|
}), /*#__PURE__*/_jsx(Below, {
|
|
@@ -100,16 +146,19 @@ const AppBar = ({
|
|
|
100
146
|
};
|
|
101
147
|
AppBar.defaultProps = {
|
|
102
148
|
'aria-hidden': null,
|
|
103
|
-
backgroundColor:
|
|
149
|
+
backgroundColor: undefined,
|
|
104
150
|
below: null,
|
|
105
151
|
center: null,
|
|
106
152
|
classes: {
|
|
107
153
|
inner: '',
|
|
108
154
|
outer: ''
|
|
109
155
|
},
|
|
156
|
+
inert: false,
|
|
110
157
|
left: null,
|
|
158
|
+
leftEnd: null,
|
|
111
159
|
right: null,
|
|
112
|
-
|
|
160
|
+
rightStart: null,
|
|
161
|
+
textColor: undefined
|
|
113
162
|
};
|
|
114
163
|
AppBar.Field = Field;
|
|
115
164
|
AppBar.Icon = Icon;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-ui-ios",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.34.0-beta.1",
|
|
4
4
|
"description": "Shopgate's iOS UI components.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"directory": "libraries/ui-ios"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@shopgate/pwa-common": "7.
|
|
13
|
+
"@shopgate/pwa-common": "7.34.0-beta.1",
|
|
14
14
|
"react": "^17.0.2"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|