@blaze-cms/react-page-builder 0.114.1 → 0.116.0-alpha.2

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.
Files changed (83) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/lib/components/CarouselWrapper.js +4 -6
  3. package/lib/components/CarouselWrapper.js.map +1 -1
  4. package/lib/components/Image/GlobalLightbox/GlobalLightbox.js +3 -3
  5. package/lib/components/Image/GlobalLightbox/GlobalLightbox.js.map +1 -1
  6. package/lib/components/Menu/Menu.js +3 -3
  7. package/lib/components/Menu/Menu.js.map +1 -1
  8. package/lib/components/SearchFilter/SearchFilter/CloseMobileForm.js +3 -2
  9. package/lib/components/SearchFilter/SearchFilter/CloseMobileForm.js.map +1 -1
  10. package/lib/components/SearchFilter/SearchFilter/ResetDesktopForm.js +3 -3
  11. package/lib/components/SearchFilter/SearchFilter/ResetDesktopForm.js.map +1 -1
  12. package/lib/components/SearchFilter/components/Checkbox.js +7 -13
  13. package/lib/components/SearchFilter/components/Checkbox.js.map +1 -1
  14. package/lib/components/SearchFilter/components/TextSearch.js +3 -3
  15. package/lib/components/SearchFilter/components/TextSearch.js.map +1 -1
  16. package/lib/components/SearchFilter/constants.js +1 -5
  17. package/lib/components/SearchFilter/constants.js.map +1 -1
  18. package/lib/components/SocialFollow/SFItem.js +2 -4
  19. package/lib/components/SocialFollow/SFItem.js.map +1 -1
  20. package/lib/components/SocialFollow/sf.config.js +9 -6
  21. package/lib/components/SocialFollow/sf.config.js.map +1 -1
  22. package/lib/components/TextBlock/index.js +8 -8
  23. package/lib/components/TextBlock/index.js.map +1 -1
  24. package/lib/constants/index.js +6 -2
  25. package/lib/constants/index.js.map +1 -1
  26. package/lib/helpers/index.js +8 -0
  27. package/lib/helpers/index.js.map +1 -1
  28. package/lib/helpers/parse-TextBlock.js +65 -0
  29. package/lib/helpers/parse-TextBlock.js.map +1 -0
  30. package/lib-es/components/CarouselWrapper.js +3 -6
  31. package/lib-es/components/CarouselWrapper.js.map +1 -1
  32. package/lib-es/components/Image/GlobalLightbox/GlobalLightbox.js +2 -3
  33. package/lib-es/components/Image/GlobalLightbox/GlobalLightbox.js.map +1 -1
  34. package/lib-es/components/Menu/Menu.js +2 -3
  35. package/lib-es/components/Menu/Menu.js.map +1 -1
  36. package/lib-es/components/SearchFilter/SearchFilter/CloseMobileForm.js +2 -2
  37. package/lib-es/components/SearchFilter/SearchFilter/CloseMobileForm.js.map +1 -1
  38. package/lib-es/components/SearchFilter/SearchFilter/ResetDesktopForm.js +2 -3
  39. package/lib-es/components/SearchFilter/SearchFilter/ResetDesktopForm.js.map +1 -1
  40. package/lib-es/components/SearchFilter/components/Checkbox.js +7 -12
  41. package/lib-es/components/SearchFilter/components/Checkbox.js.map +1 -1
  42. package/lib-es/components/SearchFilter/components/TextSearch.js +2 -3
  43. package/lib-es/components/SearchFilter/components/TextSearch.js.map +1 -1
  44. package/lib-es/components/SearchFilter/constants.js +1 -3
  45. package/lib-es/components/SearchFilter/constants.js.map +1 -1
  46. package/lib-es/components/SocialFollow/SFItem.js +2 -4
  47. package/lib-es/components/SocialFollow/SFItem.js.map +1 -1
  48. package/lib-es/components/SocialFollow/sf.config.js +7 -6
  49. package/lib-es/components/SocialFollow/sf.config.js.map +1 -1
  50. package/lib-es/components/TextBlock/index.js +7 -7
  51. package/lib-es/components/TextBlock/index.js.map +1 -1
  52. package/lib-es/constants/index.js +3 -1
  53. package/lib-es/constants/index.js.map +1 -1
  54. package/lib-es/helpers/index.js +1 -0
  55. package/lib-es/helpers/index.js.map +1 -1
  56. package/lib-es/helpers/parse-TextBlock.js +34 -0
  57. package/lib-es/helpers/parse-TextBlock.js.map +1 -0
  58. package/package.json +4 -4
  59. package/src/components/CarouselWrapper.js +7 -2
  60. package/src/components/Image/GlobalLightbox/GlobalLightbox.js +4 -1
  61. package/src/components/Menu/Menu.js +4 -1
  62. package/src/components/SearchFilter/SearchFilter/CloseMobileForm.js +3 -2
  63. package/src/components/SearchFilter/SearchFilter/ResetDesktopForm.js +4 -1
  64. package/src/components/SearchFilter/components/Checkbox.js +17 -5
  65. package/src/components/SearchFilter/components/TextSearch.js +4 -1
  66. package/src/components/SearchFilter/constants.js +0 -4
  67. package/src/components/SocialFollow/SFItem.js +4 -2
  68. package/src/components/SocialFollow/sf.config.js +15 -6
  69. package/src/components/TextBlock/index.js +6 -6
  70. package/src/constants/index.js +6 -1
  71. package/src/helpers/index.js +1 -0
  72. package/src/helpers/parse-TextBlock.js +29 -0
  73. package/tests/unit/src/components/Image/GlobalLightbox/__snapshots__/GlobalLightbox.test.js.snap +15 -3
  74. package/tests/unit/src/components/SearchFilter/SearchFilter/__snapshots__/CloseMobileForm.test.js.snap +17 -2
  75. package/tests/unit/src/components/SearchFilter/SearchFilter/__snapshots__/ResetDesktopForm.test.js.snap +15 -3
  76. package/tests/unit/src/components/SearchFilter/SearchFilter/__snapshots__/SearchFilter.test.js.snap +196 -49
  77. package/tests/unit/src/components/SearchFilter/components/__snapshots__/TextSearch.test.js.snap +18 -4
  78. package/tests/unit/src/components/SocialFollow/__snapshots__/SFItem.test.js.snap +15 -3
  79. package/tests/unit/src/components/SocialFollow/__snapshots__/SocialFollow.test.js.snap +30 -6
  80. package/tests/unit/src/components/TextBlock/TextBlock.test.js +3 -4
  81. package/tests/unit/src/components/TextBlock/__snapshots__/TextBlock.test.js.snap +44 -12
  82. package/tests/unit/src/helpers/__snapshots__/parse-textBlock.test.js.snap +14 -0
  83. package/tests/unit/src/helpers/parse-textBlock.test.js +26 -0
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import { FaRedoAlt } from 'react-icons/fa';
3
4
  import { RESET } from '../constants';
4
5
 
5
6
  const ResetDesktopForm = ({ handleReset }) => (
@@ -10,7 +11,9 @@ const ResetDesktopForm = ({ handleReset }) => (
10
11
  title="reset--button"
11
12
  data-testid="reset-icon"
12
13
  onClick={handleReset}>
13
- <i className="fas fa-redo-alt" />
14
+ <i>
15
+ <FaRedoAlt />
16
+ </i>
14
17
  </button>
15
18
 
16
19
  <div role="button" onClick={handleReset} data-testid="reset-button">
@@ -2,11 +2,10 @@ import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import upperFirst from 'lodash.upperfirst';
4
4
  import { Checkboxes } from '@blaze-react/checkboxes';
5
+ import { FaChevronDown, FaChevronUp } from 'react-icons/fa';
5
6
  import { withTitle } from '../../../HOC';
6
7
  import { decodeValue } from '../helpers';
7
- import { LIMIT_MIN, LIMIT_MAX, MORE, LESS, DOWN, UP } from '../constants';
8
-
9
- const getButtonInfo = isMore => (isMore ? { icon: DOWN, text: MORE } : { icon: UP, text: LESS });
8
+ import { LIMIT_MIN, LIMIT_MAX, MORE, LESS } from '../constants';
10
9
 
11
10
  const Checkbox = ({ data, prop, updateFilterValues, filterValues, label, shouldSearch }) => {
12
11
  const [checkboxLimit, setCheckboxLimit] = useState(null);
@@ -69,8 +68,21 @@ const Checkbox = ({ data, prop, updateFilterValues, filterValues, label, shouldS
69
68
  />
70
69
  {data[prop].buckets.length > LIMIT_MIN && (
71
70
  <div role="button" className="see-more" onClick={handleCheckboxOptions}>
72
- <i className={`fas fa-chevron-${getButtonInfo(shouldDisplayMore).icon}`} />
73
- {` See ${getButtonInfo(shouldDisplayMore).text}`}
71
+ {shouldDisplayMore ? (
72
+ <>
73
+ <i>
74
+ <FaChevronDown className="inline-icon" />
75
+ </i>
76
+ {` See ${MORE}`}
77
+ </>
78
+ ) : (
79
+ <>
80
+ <i>
81
+ <FaChevronUp className="inline-icon" />
82
+ </i>
83
+ {` See ${LESS}`}
84
+ </>
85
+ )}
74
86
  </div>
75
87
  )}
76
88
  </>
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import Input from '@blaze-react/input';
4
+ import { MdSearch } from 'react-icons/md';
4
5
  import { withTitle } from '../../../HOC';
5
6
  import { SEARCH_TERM } from '../constants';
6
7
 
@@ -24,7 +25,9 @@ const TextSearch = ({ label, searchValue, updateFilterValues, handleSubmit, filt
24
25
  e.preventDefault();
25
26
  updateFilterValues({ [SEARCH_TERM]: searchValue }, true);
26
27
  }}>
27
- <i className="material-icons">search</i>
28
+ <i>
29
+ <MdSearch />
30
+ </i>
28
31
  </button>
29
32
  </div>
30
33
  </div>
@@ -13,8 +13,6 @@ const LIMIT_MIN = 5;
13
13
  const LIMIT_MAX = 1000;
14
14
  const MORE = 'more';
15
15
  const LESS = 'less';
16
- const DOWN = 'down';
17
- const UP = 'up';
18
16
  const UPDATED_RANGES = 'updated_ranges';
19
17
  const MIN_VALUE = 'min-value';
20
18
  const MAX_VALUE = 'max-value';
@@ -52,8 +50,6 @@ export {
52
50
  LIMIT_MAX,
53
51
  MORE,
54
52
  LESS,
55
- DOWN,
56
- UP,
57
53
  UPDATED_RANGES,
58
54
  MIN_VALUE,
59
55
  MAX_VALUE,
@@ -4,12 +4,14 @@ import PropTypes from 'prop-types';
4
4
  import { SOCIAL_NETWORKS, BASE_CLASS_NAME_FOLLOW } from './sf.config';
5
5
 
6
6
  const SFItem = ({ url, id }) => {
7
- const { name, className, icon, spanClassName } = SOCIAL_NETWORKS[id];
7
+ const { name, className, Icon, spanClassName } = SOCIAL_NETWORKS[id];
8
8
 
9
9
  return (
10
10
  <li className={BASE_CLASS_NAME_FOLLOW}>
11
11
  <a title={name} href={url} className={className} rel="noopener nofollow" target="_blank">
12
- <i className={`fab ${icon}`} />
12
+ <i>
13
+ <Icon />
14
+ </i>
13
15
  <span className={`social__network ${spanClassName}`}>{name}</span>
14
16
  </a>
15
17
  </li>
@@ -1,3 +1,12 @@
1
+ import {
2
+ FaFacebookF,
3
+ FaTwitter,
4
+ FaPinterestP,
5
+ FaInstagram,
6
+ FaLinkedinIn,
7
+ FaYoutube
8
+ } from 'react-icons/fa';
9
+
1
10
  export const BASE_CLASS_NAME_FOLLOW = 'social__list-item social__list-item--follow';
2
11
  export const PORTRAIT = 'portrait';
3
12
  export const LANDSCAPE = 'landscape';
@@ -6,37 +15,37 @@ export const SOCIAL_NETWORKS = {
6
15
  facebook: {
7
16
  name: 'Facebook',
8
17
  className: 'facebook',
9
- icon: 'fa-facebook-f',
18
+ Icon: FaFacebookF,
10
19
  spanClassName: 'hidden'
11
20
  },
12
21
  twitter: {
13
22
  name: 'Twitter',
14
23
  className: 'twitter',
15
- icon: 'fa-twitter',
24
+ Icon: FaTwitter,
16
25
  spanClassName: 'hidden'
17
26
  },
18
27
  pinterest: {
19
28
  name: 'Pinterest',
20
29
  className: 'pinterest',
21
- icon: 'fa-pinterest-p',
30
+ Icon: FaPinterestP,
22
31
  spanClassName: 'hidden'
23
32
  },
24
33
  instagram: {
25
34
  name: 'Instagram',
26
35
  className: 'instagram',
27
- icon: 'fa-instagram',
36
+ Icon: FaInstagram,
28
37
  spanClassName: 'hidden'
29
38
  },
30
39
  linkedin: {
31
40
  name: 'Linkedin',
32
41
  className: 'linkedin',
33
- icon: 'fa-linkedin-in',
42
+ Icon: FaLinkedinIn,
34
43
  spanClassName: 'hidden'
35
44
  },
36
45
  youtube: {
37
46
  name: 'YouTube',
38
47
  className: 'youtube',
39
- icon: 'fa-youtube',
48
+ Icon: FaYoutube,
40
49
  spanClassName: 'hidden'
41
50
  }
42
51
  };
@@ -1,16 +1,16 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { parseTextBlock } from '@blaze-react/drafteditor';
3
+ import { parseTextBlock } from '../../helpers';
4
4
  import Wrapper from '../Wrapper';
5
5
  import TextBlockRender from './TextBlockRender';
6
6
  import BlazeLink from '../BlazeLink';
7
7
 
8
8
  import getClassModifiers from '../../utils/get-class-modifiers';
9
9
 
10
- const TextBlock = ({ editor, modifier, ...variableProps }) => {
11
- if (!editor) return null;
10
+ const TextBlock = ({ html, modifier, ...variableProps }) => {
11
+ if (!html) return null;
12
12
 
13
- const parsedTextBlock = parseTextBlock({ editor, LinkWrapper: BlazeLink });
13
+ const parsedTextBlock = parseTextBlock({ html, LinkWrapper: BlazeLink });
14
14
  const modifiers = getClassModifiers('textBlock', { modifier, ...variableProps });
15
15
 
16
16
  // todo: the BLAZE_PB_TEXTBLOCK_WRAPPER_ENABLE flag is depreciated. Remove when appropriate
@@ -27,7 +27,7 @@ const TextBlock = ({ editor, modifier, ...variableProps }) => {
27
27
  };
28
28
 
29
29
  TextBlock.propTypes = {
30
- editor: PropTypes.string,
30
+ html: PropTypes.string,
31
31
  modifier: PropTypes.string,
32
32
  gtmClassName: PropTypes.string,
33
33
  elementTitle: PropTypes.string
@@ -37,7 +37,7 @@ TextBlock.defaultProps = {
37
37
  modifier: '',
38
38
  gtmClassName: '',
39
39
  elementTitle: '',
40
- editor: null
40
+ html: ''
41
41
  };
42
42
 
43
43
  export default TextBlock;
@@ -194,6 +194,9 @@ const ALL_AZ_SORT = {
194
194
 
195
195
  const SCROLL_OFFSET = process.env.BLAZE_SCROLL_OFFSET || 50;
196
196
 
197
+ const ANCHOR_TAG = 'a';
198
+ const TARGET_BLANK = '_blank';
199
+
197
200
  export {
198
201
  BLANK_SPACE_UNICODE_STRING,
199
202
  BOLD_TAG,
@@ -297,5 +300,7 @@ export {
297
300
  AZ_AGGS,
298
301
  ALL_AZ_SORT,
299
302
  AZ,
300
- SCROLL_OFFSET
303
+ SCROLL_OFFSET,
304
+ ANCHOR_TAG,
305
+ TARGET_BLANK
301
306
  };
@@ -50,3 +50,4 @@ export { default as removeExtraItems } from './remove-extra-items';
50
50
  export { default as getParsedPropValues } from './get-parsed-prop-values';
51
51
  export { default as getSanitizedPropValues } from './get-sanitized-prop-values';
52
52
  export { default as appendImages } from './append-images';
53
+ export { default as parseTextBlock } from './parse-TextBlock';
@@ -0,0 +1,29 @@
1
+ import parseHTML, { domToReact } from 'html-react-parser';
2
+ import React from 'react';
3
+ import { ANCHOR_TAG, TARGET_BLANK } from '../constants';
4
+
5
+ function parseTextBlock(config) {
6
+ const { html, LinkWrapper, useTargetBlank } = config;
7
+
8
+ const options = {
9
+ replace: domNode => {
10
+ const { attribs, children, name: tagName } = domNode;
11
+ if (tagName === ANCHOR_TAG) {
12
+ const target = useTargetBlank ? TARGET_BLANK : attribs.target;
13
+
14
+ return LinkWrapper ? (
15
+ <LinkWrapper {...attribs} target={target}>
16
+ {domToReact(children, options)}
17
+ </LinkWrapper>
18
+ ) : (
19
+ domNode
20
+ );
21
+ }
22
+ return null;
23
+ }
24
+ };
25
+
26
+ return parseHTML(html, options);
27
+ }
28
+
29
+ export default parseTextBlock;
@@ -19,9 +19,21 @@ exports[`GlobalLightbox component should match snapshot 1`] = `
19
19
  class="modal__close"
20
20
  role="button"
21
21
  >
22
- <i
23
- class="fas fa-times"
24
- />
22
+ <i>
23
+ <svg
24
+ fill="currentColor"
25
+ height="1em"
26
+ stroke="currentColor"
27
+ stroke-width="0"
28
+ viewBox="0 0 352 512"
29
+ width="1em"
30
+ xmlns="http://www.w3.org/2000/svg"
31
+ >
32
+ <path
33
+ d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"
34
+ />
35
+ </svg>
36
+ </i>
25
37
  </div>
26
38
  </header>
27
39
  <div
@@ -9,10 +9,25 @@ exports[`CloseMobileForm component should render without throwing error and matc
9
9
  Search refinement
10
10
  </p>
11
11
  <i
12
- class="material-icons"
13
12
  role="button"
14
13
  >
15
- close
14
+ <svg
15
+ fill="currentColor"
16
+ height="1em"
17
+ stroke="currentColor"
18
+ stroke-width="0"
19
+ viewBox="0 0 24 24"
20
+ width="1em"
21
+ xmlns="http://www.w3.org/2000/svg"
22
+ >
23
+ <path
24
+ d="M0 0h24v24H0z"
25
+ fill="none"
26
+ />
27
+ <path
28
+ d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
29
+ />
30
+ </svg>
16
31
  </i>
17
32
  </div>
18
33
  </DocumentFragment>
@@ -11,9 +11,21 @@ exports[`ResetDesktopForm component should render without throwing error and mat
11
11
  title="reset--button"
12
12
  type="button"
13
13
  >
14
- <i
15
- class="fas fa-redo-alt"
16
- />
14
+ <i>
15
+ <svg
16
+ fill="currentColor"
17
+ height="1em"
18
+ stroke="currentColor"
19
+ stroke-width="0"
20
+ viewBox="0 0 512 512"
21
+ width="1em"
22
+ xmlns="http://www.w3.org/2000/svg"
23
+ >
24
+ <path
25
+ d="M256.455 8c66.269.119 126.437 26.233 170.859 68.685l35.715-35.715C478.149 25.851 504 36.559 504 57.941V192c0 13.255-10.745 24-24 24H345.941c-21.382 0-32.09-25.851-16.971-40.971l41.75-41.75c-30.864-28.899-70.801-44.907-113.23-45.273-92.398-.798-170.283 73.977-169.484 169.442C88.764 348.009 162.184 424 256 424c41.127 0 79.997-14.678 110.629-41.556 4.743-4.161 11.906-3.908 16.368.553l39.662 39.662c4.872 4.872 4.631 12.815-.482 17.433C378.202 479.813 319.926 504 256 504 119.034 504 8.001 392.967 8 256.002 7.999 119.193 119.646 7.755 256.455 8z"
26
+ />
27
+ </svg>
28
+ </i>
17
29
  </button>
18
30
  <div
19
31
  data-testid="reset-button"