@magento/pagebuilder 8.0.0 → 8.1.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.
@@ -303,12 +303,7 @@ exports[`renders a configured collage-left Banner component on mobile 1`] = `
303
303
  className="wrapper"
304
304
  style={
305
305
  Object {
306
- "backgroundAttachment": "scroll",
307
306
  "backgroundColor": "blue",
308
- "backgroundImage": "url(null)",
309
- "backgroundPosition": "center center",
310
- "backgroundRepeat": "no-repeat",
311
- "backgroundSize": "cover",
312
307
  "border": "solid",
313
308
  "borderColor": "rgb(0,0,0)",
314
309
  "borderRadius": "15px",
@@ -160,7 +160,7 @@ const Banner = props => {
160
160
  ]);
161
161
  /* eslint-enable react-hooks/exhaustive-deps */
162
162
 
163
- if (image) {
163
+ if (image && bgImageStyle) {
164
164
  wrapperStyles.backgroundImage = `url(${bgImageStyle})`;
165
165
  wrapperStyles.backgroundSize = backgroundSize;
166
166
  wrapperStyles.backgroundPosition = backgroundPosition;
@@ -0,0 +1,21 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`renders a ColumnLine component 1`] = `
4
+ <div
5
+ style={
6
+ Object {
7
+ "display": undefined,
8
+ }
9
+ }
10
+ />
11
+ `;
12
+
13
+ exports[`renders a ColumnLine component with all props configured 1`] = `
14
+ <div
15
+ style={
16
+ Object {
17
+ "display": "flex",
18
+ }
19
+ }
20
+ />
21
+ `;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { createTestInstance } from '@magento/peregrine';
3
+ import ColumnLine from '../columnLine';
4
+
5
+ test('renders a ColumnLine component', () => {
6
+ const component = createTestInstance(<ColumnLine />);
7
+
8
+ expect(component.toJSON()).toMatchSnapshot();
9
+ });
10
+
11
+ test('renders a ColumnLine component with all props configured', () => {
12
+ const columnLineProps = {
13
+ display: 'flex'
14
+ };
15
+ const component = createTestInstance(<ColumnLine {...columnLineProps} />);
16
+
17
+ expect(component.toJSON()).toMatchSnapshot();
18
+ });
@@ -0,0 +1,13 @@
1
+ import configAggregator from '../configAggregator';
2
+
3
+ test('columnLine config is aggregated correctly retrieving display property', () => {
4
+ const node = document.createElement('div');
5
+ node.innerHTML = `<div class="pagebuilder-column-line" style="display:flex;" data-content-type="column-line"
6
+ data-grid-size="12" data-element="main"></div>`;
7
+
8
+ expect(configAggregator(node.childNodes[0])).toEqual(
9
+ expect.objectContaining({
10
+ display: 'flex'
11
+ })
12
+ );
13
+ });
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import defaultClasses from './columnLine.module.css';
3
+ import { useStyle } from '@magento/venia-ui/lib/classify';
4
+ import { shape, string } from 'prop-types';
5
+
6
+ /**
7
+ * Page Builder ColumnLine component.
8
+ *
9
+ * This component is part of the Page Builder / PWA integration. It can be consumed without Page Builder.
10
+ *
11
+ * @typedef ColumnLine
12
+ * @kind functional component
13
+ *
14
+ * @param {props} props React component props
15
+ *
16
+ * @returns {React.Element} A React component that wraps {@link Column} components.
17
+ */
18
+ const ColumnLine = props => {
19
+ const classes = useStyle(defaultClasses, props.classes);
20
+ const { display, children } = props;
21
+ const dynamicStyles = {
22
+ display
23
+ };
24
+
25
+ return (
26
+ <div style={dynamicStyles} className={classes.root}>
27
+ {children}
28
+ </div>
29
+ );
30
+ };
31
+
32
+ /**
33
+ * Props for {@link ColumnLine}
34
+ *
35
+ * @typedef props
36
+ *
37
+ * @property {Object} classes An object containing the class names for the ColumnLine
38
+ * @property {String} classes.root CSS classes for the root container element
39
+ * @property {String} display CSS display property
40
+ */
41
+ ColumnLine.propTypes = {
42
+ classes: shape({
43
+ root: string
44
+ }),
45
+ display: string
46
+ };
47
+
48
+ export default ColumnLine;
@@ -0,0 +1,5 @@
1
+ @media only screen and (max-width: 768px) {
2
+ .root {
3
+ flex-wrap: wrap;
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ export default node => {
2
+ return {
3
+ display: node.style.display
4
+ };
5
+ };
@@ -0,0 +1 @@
1
+ export { default } from './columnLine';
package/lib/config.js CHANGED
@@ -5,6 +5,8 @@ import columnConfigAggregator from './ContentTypes/Column/configAggregator';
5
5
  import Column from './ContentTypes/Column';
6
6
  import columnGroupConfigAggregator from './ContentTypes/ColumnGroup/configAggregator';
7
7
  import ColumnGroup from './ContentTypes/ColumnGroup';
8
+ import columnLineConfigAggregator from './ContentTypes/ColumnLine/configAggregator';
9
+ import ColumnLine from './ContentTypes/ColumnLine';
8
10
  import imageConfigAggregator from './ContentTypes/Image/configAggregator';
9
11
  import { ImageShimmer } from './ContentTypes/Image';
10
12
  import headingConfigAggregator from './ContentTypes/Heading/configAggregator';
@@ -43,6 +45,10 @@ const contentTypesConfig = {
43
45
  configAggregator: columnGroupConfigAggregator,
44
46
  component: ColumnGroup
45
47
  },
48
+ 'column-line': {
49
+ configAggregator: columnLineConfigAggregator,
50
+ component: ColumnLine
51
+ },
46
52
  image: {
47
53
  configAggregator: imageConfigAggregator,
48
54
  component: React.lazy(() => import('./ContentTypes/Image')),
@@ -18,10 +18,10 @@ const handleHtmlContentClick = (history, event) => {
18
18
  event.preventDefault();
19
19
 
20
20
  const eventOrigin = event.view.location.origin;
21
-
22
21
  const {
23
22
  origin: linkOrigin,
24
23
  pathname: path,
24
+ search: query,
25
25
  target: tabTarget,
26
26
  href
27
27
  } = target;
@@ -29,7 +29,11 @@ const handleHtmlContentClick = (history, event) => {
29
29
  if (tabTarget && globalThis.open) {
30
30
  globalThis.open(href, '_blank');
31
31
  } else if (linkOrigin === eventOrigin) {
32
- history.push(path);
32
+ if (query) {
33
+ history.push(path + query);
34
+ } else {
35
+ history.push(path);
36
+ }
33
37
  } else {
34
38
  globalThis.location.assign(href);
35
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magento/pagebuilder",
3
- "version": "8.0.0",
3
+ "version": "8.1.0-alpha.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,9 +34,9 @@
34
34
  "homepage": "https://github.com/magento/pwa-studio/tree/main/packages/pagebuilder#readme",
35
35
  "dependencies": {},
36
36
  "devDependencies": {
37
- "@magento/peregrine": "~13.0.0",
37
+ "@magento/peregrine": "13.0.1-alpha.1",
38
38
  "@magento/pwa-buildpack": "~11.4.1",
39
- "@magento/venia-ui": "~10.0.0",
39
+ "@magento/venia-ui": "10.1.0-alpha.1",
40
40
  "@storybook/react": "~6.3.7",
41
41
  "jarallax": "~1.11.1",
42
42
  "load-google-maps-api": "~2.0.1",
@@ -50,9 +50,9 @@
50
50
  "peerDependencies": {
51
51
  "@apollo/client": "~3.5.0",
52
52
  "@magento/babel-preset-peregrine": "~1.2.2",
53
- "@magento/peregrine": "~13.0.0",
53
+ "@magento/peregrine": "13.0.1-alpha.1",
54
54
  "@magento/pwa-buildpack": "~11.4.1",
55
- "@magento/venia-ui": "~10.0.0",
55
+ "@magento/venia-ui": "10.1.0-alpha.1",
56
56
  "jarallax": "~1.11.1",
57
57
  "load-google-maps-api": "~2.0.1",
58
58
  "lodash.escape": "~4.0.1",