@shopgate/pwa-ui-material 7.31.3 → 7.32.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.
@@ -8,7 +8,7 @@ import { makeStyles, responsiveMediaQuery } from '@shopgate/engage/styles';
8
8
  import AccordionContent from "./components/AccordionContent";
9
9
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
10
10
  import { createElement as _createElement } from "react";
11
- const useStyles = makeStyles()({
11
+ const useStyles = makeStyles()(theme => ({
12
12
  toggle: {
13
13
  padding: '12px 16px',
14
14
  position: 'relative',
@@ -27,7 +27,7 @@ const useStyles = makeStyles()({
27
27
  chevronContainer: {
28
28
  display: 'flex',
29
29
  flexShrink: 0,
30
- fontSize: '1.5rem',
30
+ fontSize: theme.components.icon.medium,
31
31
  [responsiveMediaQuery('>sm', {
32
32
  webOnly: true
33
33
  })]: {
@@ -54,7 +54,7 @@ const useStyles = makeStyles()({
54
54
  transition: 'transform 250ms cubic-bezier(0.25, 0.1, 0.25, 1)',
55
55
  transform: 'rotateZ(90deg)'
56
56
  }
57
- });
57
+ }));
58
58
 
59
59
  /**
60
60
  * Accordion component
@@ -2,12 +2,12 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { makeStyles } from '@shopgate/engage/styles';
4
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
- const useStyles = makeStyles()({
5
+ const useStyles = makeStyles()(theme => ({
6
6
  root: {
7
7
  color: 'inherit',
8
8
  display: 'flex',
9
9
  flexShrink: 0,
10
- fontSize: 24,
10
+ fontSize: theme.components.icon.medium,
11
11
  height: 56,
12
12
  justifyContent: 'center',
13
13
  alignItems: 'center',
@@ -16,7 +16,7 @@ const useStyles = makeStyles()({
16
16
  position: 'relative',
17
17
  width: 56
18
18
  }
19
- });
19
+ }));
20
20
 
21
21
  /**
22
22
  * The AppBarIcon component.
@@ -1,17 +1,14 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import { Typography } from '@shopgate/engage/components';
3
4
  import { makeStyles } from '@shopgate/engage/styles';
4
5
  import { jsx as _jsx } from "react/jsx-runtime";
5
6
  const useStyles = makeStyles()({
6
7
  root: {
7
- fontSize: 20,
8
- fontWeight: 500,
9
8
  flexGrow: 1,
10
- lineHeight: '56px',
11
- overflow: 'hidden',
12
9
  padding: '0 16px',
13
- textOverflow: 'ellipsis',
14
- whiteSpace: 'nowrap'
10
+ display: 'flex',
11
+ alignItems: 'center'
15
12
  }
16
13
  });
17
14
 
@@ -31,7 +28,10 @@ const AppBarTitle = ({
31
28
  if (!title) {
32
29
  return null;
33
30
  }
34
- return /*#__PURE__*/_jsx("div", {
31
+ return /*#__PURE__*/_jsx(Typography, {
32
+ variant: "h3",
33
+ component: "div",
34
+ noWrap: true,
35
35
  className: cx(classes.root, 'theme__app-bar__title'),
36
36
  role: "heading",
37
37
  "aria-labelledby": "titleLabel",
package/AppBar/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  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
- import { themeShadows, themeColors } from '@shopgate/pwa-common/helpers/config';
5
4
  import { makeStyles, setCSSCustomProp } from '@shopgate/engage/styles';
6
5
  import { SurroundPortals } from '@shopgate/engage/components';
7
6
  import { APP_BAR_CONTENT } from '@shopgate/engage/core/constants';
@@ -26,6 +25,7 @@ const useStyles = makeStyles()({
26
25
  inner: {
27
26
  background: 'inherit',
28
27
  display: 'flex',
28
+ alignItems: 'center',
29
29
  justifyContent: 'space-between',
30
30
  position: 'relative',
31
31
  zIndex: 14
@@ -65,7 +65,7 @@ const AppBar = ({
65
65
  const style = useMemo(() => ({
66
66
  background: backgroundColor,
67
67
  color: textColor,
68
- boxShadow: !shadow ? 'none' : themeShadows.material
68
+ boxShadow: !shadow ? 'none' : '0 1px 6px rgba(0, 0, 0, .117647), 0 1px 4px rgba(0, 0, 0, .117647)'
69
69
  }), [backgroundColor, shadow, textColor]);
70
70
  const observer = useMemo(() => new MutationObserver(() => {
71
71
  updateAppBarHeight(contentRef);
@@ -103,13 +103,13 @@ const AppBar = ({
103
103
  });
104
104
  };
105
105
  AppBar.defaultProps = {
106
- backgroundColor: themeColors.light,
106
+ backgroundColor: 'var(--sg-palette-common-white)',
107
107
  below: null,
108
108
  center: null,
109
109
  left: null,
110
110
  right: null,
111
111
  shadow: true,
112
- textColor: themeColors.dark
112
+ textColor: 'var(--sg-palette-common-black)'
113
113
  };
114
114
  AppBar.Field = Field;
115
115
  AppBar.Icon = Icon;
@@ -1,15 +1,14 @@
1
1
  import React, { memo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { themeConfig } from '@shopgate/pwa-common/helpers/config';
4
3
  import { makeStyles } from '@shopgate/engage/styles';
5
4
  import { jsx as _jsx } from "react/jsx-runtime";
6
- const useStyles = makeStyles()({
5
+ const useStyles = makeStyles()(theme => ({
7
6
  body: {
8
- color: themeConfig.colors.shade6,
7
+ color: theme.palette.grey.dark,
9
8
  flexGrow: 1,
10
9
  overflow: 'auto'
11
10
  }
12
- });
11
+ }));
13
12
 
14
13
  /**
15
14
  * @param {Object} props The component props.
@@ -1,14 +1,12 @@
1
1
  import React, { memo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { I18n, Ellipsis } from '@shopgate/engage/components';
3
+ import { I18n, Ellipsis, Typography } from '@shopgate/engage/components';
4
4
  import { themeConfig } from '@shopgate/engage';
5
5
  import { makeStyles } from '@shopgate/engage/styles';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  const useStyles = makeStyles()(theme => ({
8
8
  title: {
9
- fontSize: '1.25em',
10
9
  lineHeight: themeConfig.typography.lineHeight,
11
- fontWeight: 500,
12
10
  paddingBottom: theme.spacing(1),
13
11
  marginTop: '-.25em'
14
12
  }
@@ -27,7 +25,9 @@ const Title = ({
27
25
  if (!title) {
28
26
  return null;
29
27
  }
30
- return /*#__PURE__*/_jsx("div", {
28
+ return /*#__PURE__*/_jsx(Typography, {
29
+ variant: "h3",
30
+ component: "div",
31
31
  className: classes.title,
32
32
  id: "basicDialogTitle",
33
33
  role: "heading",
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { FocusTrap } from '@shopgate/engage/a11y/components';
4
- import { themeConfig } from '@shopgate/pwa-common/helpers/config';
5
4
  import { makeStyles, responsiveMediaQuery } from '@shopgate/engage/styles';
6
5
  import Title from "./components/Title";
7
6
  import Content from "./components/Content";
@@ -16,8 +15,8 @@ const useStyles = makeStyles()(theme => ({
16
15
  width: `calc(100vw - ${outerGap * 2}px)`,
17
16
  maxHeight: `calc(100vh - ${outerGap * 2}px)`,
18
17
  borderRadius: 2,
19
- boxShadow: themeConfig.shadows.dialog,
20
- background: themeConfig.colors.light,
18
+ boxShadow: '0 0.75em 3em 0 rgba(0, 0, 0, 0.5)',
19
+ background: theme.palette.background.surface,
21
20
  [responsiveMediaQuery('>xs', {
22
21
  webOnly: true
23
22
  })]: {
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { themeConfig } from '@shopgate/pwa-common/helpers/config';
4
3
  import { makeStyles } from '@shopgate/engage/styles';
5
4
  import { jsx as _jsx } from "react/jsx-runtime";
6
5
  const SIZE_BIG = 'big';
@@ -26,7 +25,7 @@ const useStyles = makeStyles()({
26
25
  width: 56
27
26
  },
28
27
  buttonShadow: {
29
- boxShadow: themeConfig.shadows.buttons.elevated
28
+ boxShadow: '0 8px 13px rgba(0, 0, 0, 0.25)'
30
29
  }
31
30
  });
32
31
 
@@ -1,19 +1,18 @@
1
1
  import React from 'react';
2
- import { themeColors } from '@shopgate/pwa-common/helpers/config';
3
2
  import { makeStyles } from '@shopgate/engage/styles';
4
3
  import { jsx as _jsx } from "react/jsx-runtime";
5
- const useStyles = makeStyles()({
4
+ const useStyles = makeStyles()(theme => ({
6
5
  root: {
7
6
  // prevent two consecutive dividers
8
7
  '& + hr': {
9
8
  display: 'none'
10
9
  },
11
- background: themeColors.darkGray,
10
+ background: theme.components.separatorLine,
12
11
  border: 0,
13
12
  height: 1,
14
13
  margin: '16px 0'
15
14
  }
16
- });
15
+ }));
17
16
 
18
17
  /**
19
18
  * @returns {JSX}
@@ -3,10 +3,9 @@ import PropTypes from 'prop-types';
3
3
  import { UIEvents } from '@shopgate/pwa-core';
4
4
  import { withForwardedRef } from '@shopgate/engage/core';
5
5
  import { I18n } from '@shopgate/engage/components';
6
- import { themeColors } from '@shopgate/pwa-common/helpers/config';
7
6
  import { makeStyles } from '@shopgate/engage/styles';
8
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
- const useStyles = makeStyles()({
8
+ const useStyles = makeStyles()(theme => ({
10
9
  srOnly: {
11
10
  clip: 'rect(1px, 1px, 1px, 1px)',
12
11
  height: '1px',
@@ -25,7 +24,7 @@ const useStyles = makeStyles()({
25
24
  alignItems: 'flex-start',
26
25
  color: 'inherit',
27
26
  display: 'flex',
28
- fontWeight: 500,
27
+ fontWeight: theme.typography.fontWeightMedium,
29
28
  outline: 0,
30
29
  padding: '16px 8px 16px 0',
31
30
  position: 'relative',
@@ -44,10 +43,10 @@ const useStyles = makeStyles()({
44
43
  },
45
44
  icon: {
46
45
  boxSizing: 'content-box',
47
- color: themeColors.gray,
46
+ color: theme.palette.grey.dark,
48
47
  padding: '0 32px 0 16px'
49
48
  }
50
- });
49
+ }));
51
50
 
52
51
  /**
53
52
  * The NavDrawerItem component.
@@ -1,17 +1,14 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { I18n } from '@shopgate/engage/components';
4
- import { themeColors } from '@shopgate/pwa-common/helpers/config';
3
+ import { I18n, Typography } from '@shopgate/engage/components';
5
4
  import { makeStyles } from '@shopgate/engage/styles';
6
5
  import { jsx as _jsx } from "react/jsx-runtime";
7
- const useStyles = makeStyles()({
6
+ const useStyles = makeStyles()(theme => ({
8
7
  root: {
9
- color: themeColors.shade11,
10
- fontSize: '0.875rem',
11
- fontWeight: 500,
8
+ color: theme.palette.grey.dark,
12
9
  margin: '16px 0 0 16px'
13
10
  }
14
- });
11
+ }));
15
12
 
16
13
  /**
17
14
  * @param {Object} props The component props.
@@ -26,7 +23,9 @@ const NavDrawerTitle = ({
26
23
  if (!text.length) {
27
24
  return null;
28
25
  }
29
- return /*#__PURE__*/_jsx("div", {
26
+ return /*#__PURE__*/_jsx(Typography, {
27
+ variant: "subtitle2",
28
+ component: "div",
30
29
  className: classes.root,
31
30
  children: /*#__PURE__*/_jsx(I18n.Text, {
32
31
  string: text
@@ -5,7 +5,6 @@ import Transition from 'react-transition-group/Transition';
5
5
  import { Backdrop } from '@shopgate/engage/components';
6
6
  import { ModalStateTracker } from '@shopgate/engage/a11y/components';
7
7
  import { UIEvents } from '@shopgate/pwa-core';
8
- import { themeShadows, themeColors } from '@shopgate/pwa-common/helpers/config';
9
8
  import { makeStyles } from '@shopgate/engage/styles';
10
9
  import Divider from "./components/Divider";
11
10
  import Item from "./components/Item";
@@ -15,18 +14,18 @@ import transition from "./transition";
15
14
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
16
15
  const OPEN = 'navdrawer_open';
17
16
  const CLOSE = 'navdrawer_close';
18
- const useStyles = makeStyles()({
17
+ const useStyles = makeStyles()(theme => ({
19
18
  content: {
20
- fontSize: 14,
19
+ fontSize: theme.typography.body2.fontSize,
21
20
  height: '100%',
22
21
  overflowY: 'scroll',
23
22
  paddingBottom: 'var(--safe-area-inset-bottom)',
24
23
  WebkitOverflowScrolling: 'touch'
25
24
  },
26
25
  drawer: {
27
- background: themeColors.light,
28
- boxShadow: themeShadows.navDrawer,
29
- color: themeColors.dark,
26
+ background: theme.palette.background.surface,
27
+ boxShadow: '0 0 15px rgba(0, 0, 0, .24)',
28
+ color: theme.palette.text.primary,
30
29
  height: '100vh',
31
30
  left: 0,
32
31
  maxWidth: '300px',
@@ -40,7 +39,7 @@ const useStyles = makeStyles()({
40
39
  maxWidth: '67vw'
41
40
  }
42
41
  }
43
- });
42
+ }));
44
43
 
45
44
  /**
46
45
  * Material navigation drawer; opens/closes via `NavDrawer.open()` / `NavDrawer.close()` (UIEvents).
package/SnackBar/index.js CHANGED
@@ -1,19 +1,13 @@
1
1
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import Color from 'color';
4
3
  import { config } from 'react-spring';
5
4
  import { Spring } from 'react-spring/renderprops.cjs';
6
5
  import Ellipsis from '@shopgate/pwa-common/components/Ellipsis';
7
6
  import { i18n } from '@shopgate/engage/core/helpers';
8
- import { themeColors, themeShadows } from '@shopgate/pwa-common/helpers/config';
9
7
  import { makeStyles } from '@shopgate/engage/styles';
10
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
9
  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()({
10
+ const useStyles = makeStyles()(theme => ({
17
11
  container: {
18
12
  position: 'fixed',
19
13
  height: 'var(--snack-bar-height, 80px)',
@@ -34,12 +28,12 @@ const useStyles = makeStyles()({
34
28
  },
35
29
  box: {
36
30
  alignItems: 'center',
37
- background: backgroundColor,
31
+ background: theme.components.snackbar.background,
38
32
  borderRadius: 3,
39
- boxShadow: themeShadows.toast,
40
- color: themeColors.light,
33
+ boxShadow: '0 3px 1px -2px rgba(0, 0, 0, .2), 0 2px 2px 0 rgba(0, 0, 0, .14), 0 1px 5px 0 rgba(0, 0, 0, .12)',
34
+ color: theme.contrastColor(theme.components.snackbar.background),
41
35
  display: 'flex',
42
- fontSize: '0.875rem',
36
+ fontSize: theme.typography.body2.fontSize,
43
37
  justifyContent: 'space-between',
44
38
  letterSpacing: 0.5,
45
39
  margin: 16,
@@ -54,8 +48,8 @@ const useStyles = makeStyles()({
54
48
  overflow: 'hidden'
55
49
  },
56
50
  actionButton: {
57
- color: safeButtonColor,
58
- fontWeight: 500,
51
+ color: theme.palette.secondary.main,
52
+ fontWeight: theme.typography.fontWeightMedium,
59
53
  height: 36,
60
54
  letterSpacing: 'inherit',
61
55
  margin: '0 -8px 0 8px',
@@ -63,7 +57,7 @@ const useStyles = makeStyles()({
63
57
  padding: '0 8px',
64
58
  textTransform: 'uppercase'
65
59
  }
66
- });
60
+ }));
67
61
 
68
62
  /**
69
63
  * Calculates the required amount of rows for the snack bar.
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@shopgate/pwa-ui-material",
3
- "version": "7.31.3",
3
+ "version": "7.32.0-beta.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.31.3",
8
+ "@shopgate/pwa-common": "7.32.0-beta.1",
9
9
  "@types/color": "^4.2.0",
10
10
  "@types/react-transition-group": "^4.4.12",
11
11
  "react": "^17.0.2",