@blaze-cms/react-page-builder 0.141.0-core-variants.0 → 0.141.0-core-styles.10

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 (112) hide show
  1. package/CHANGELOG.md +66 -9
  2. package/lib/components/ContentGroup/ContentGroupTabs.js +8 -10
  3. package/lib/components/ContentGroup/ContentGroupTabs.js.map +1 -1
  4. package/lib/components/Menu/Menu.js +2 -4
  5. package/lib/components/Menu/Menu.js.map +1 -1
  6. package/lib/components/MenuItem/MenuItem.js +2 -1
  7. package/lib/components/MenuItem/MenuItem.js.map +1 -1
  8. package/lib/hooks/helpers/getVariant.js.map +1 -1
  9. package/lib/variants/index.js +1 -13
  10. package/lib/variants/index.js.map +1 -1
  11. package/lib-es/components/ContentGroup/ContentGroupTabs.js +8 -10
  12. package/lib-es/components/ContentGroup/ContentGroupTabs.js.map +1 -1
  13. package/lib-es/components/Menu/Menu.js +2 -4
  14. package/lib-es/components/Menu/Menu.js.map +1 -1
  15. package/lib-es/components/MenuItem/MenuItem.js +2 -1
  16. package/lib-es/components/MenuItem/MenuItem.js.map +1 -1
  17. package/lib-es/hooks/helpers/getVariant.js.map +1 -1
  18. package/lib-es/variants/index.js +1 -12
  19. package/lib-es/variants/index.js.map +1 -1
  20. package/package.json +10 -10
  21. package/src/components/ContentGroup/ContentGroupTabs.js +8 -11
  22. package/src/components/Menu/Menu.js +2 -4
  23. package/src/components/MenuItem/MenuItem.js +5 -2
  24. package/src/hooks/helpers/getVariant.js +0 -1
  25. package/src/variants/index.js +1 -13
  26. package/tests/unit/src/components/ContentGroup/__snapshots__/ContentGroupTabs.test.js.snap +0 -2
  27. package/tests/unit/src/components/MenuItem/__snapshots__/MenuItem.test.js.snap +2 -0
  28. package/tests/unit/src/components/PlaceholderIcon/__snapshots__/index.test.js.snap +2 -0
  29. package/lib/variants/HeroImage/index.js +0 -29
  30. package/lib/variants/HeroImage/index.js.map +0 -1
  31. package/lib/variants/Infographic/Infographic.js +0 -27
  32. package/lib/variants/Infographic/Infographic.js.map +0 -1
  33. package/lib/variants/Infographic/index.js +0 -29
  34. package/lib/variants/Infographic/index.js.map +0 -1
  35. package/lib/variants/Infographic/useInfographic.js +0 -43
  36. package/lib/variants/Infographic/useInfographic.js.map +0 -1
  37. package/lib/variants/LongformGallery/LongformGallery.js +0 -51
  38. package/lib/variants/LongformGallery/LongformGallery.js.map +0 -1
  39. package/lib/variants/LongformGallery/LongformGalleryImage.js +0 -68
  40. package/lib/variants/LongformGallery/LongformGalleryImage.js.map +0 -1
  41. package/lib/variants/LongformGallery/constants.js +0 -19
  42. package/lib/variants/LongformGallery/constants.js.map +0 -1
  43. package/lib/variants/LongformGallery/helpers/index.js +0 -29
  44. package/lib/variants/LongformGallery/helpers/index.js.map +0 -1
  45. package/lib/variants/LongformGallery/helpers/parseImageData.js +0 -42
  46. package/lib/variants/LongformGallery/helpers/parseImageData.js.map +0 -1
  47. package/lib/variants/LongformGallery/helpers/separateImages.js +0 -27
  48. package/lib/variants/LongformGallery/helpers/separateImages.js.map +0 -1
  49. package/lib/variants/LongformGallery/helpers/shouldSkip.js +0 -13
  50. package/lib/variants/LongformGallery/helpers/shouldSkip.js.map +0 -1
  51. package/lib/variants/LongformGallery/index.js +0 -31
  52. package/lib/variants/LongformGallery/index.js.map +0 -1
  53. package/lib/variants/LongformGallery/useLongformGallery.js +0 -63
  54. package/lib/variants/LongformGallery/useLongformGallery.js.map +0 -1
  55. package/lib/variants/LongformRow/index.js +0 -29
  56. package/lib/variants/LongformRow/index.js.map +0 -1
  57. package/lib/variants/ParallaxImageTextRight/index.js +0 -30
  58. package/lib/variants/ParallaxImageTextRight/index.js.map +0 -1
  59. package/lib-es/variants/HeroImage/index.js +0 -10
  60. package/lib-es/variants/HeroImage/index.js.map +0 -1
  61. package/lib-es/variants/Infographic/Infographic.js +0 -20
  62. package/lib-es/variants/Infographic/Infographic.js.map +0 -1
  63. package/lib-es/variants/Infographic/index.js +0 -10
  64. package/lib-es/variants/Infographic/index.js.map +0 -1
  65. package/lib-es/variants/Infographic/useInfographic.js +0 -23
  66. package/lib-es/variants/Infographic/useInfographic.js.map +0 -1
  67. package/lib-es/variants/LongformGallery/LongformGallery.js +0 -37
  68. package/lib-es/variants/LongformGallery/LongformGallery.js.map +0 -1
  69. package/lib-es/variants/LongformGallery/LongformGalleryImage.js +0 -56
  70. package/lib-es/variants/LongformGallery/LongformGalleryImage.js.map +0 -1
  71. package/lib-es/variants/LongformGallery/constants.js +0 -18
  72. package/lib-es/variants/LongformGallery/constants.js.map +0 -1
  73. package/lib-es/variants/LongformGallery/helpers/index.js +0 -5
  74. package/lib-es/variants/LongformGallery/helpers/index.js.map +0 -1
  75. package/lib-es/variants/LongformGallery/helpers/parseImageData.js +0 -26
  76. package/lib-es/variants/LongformGallery/helpers/parseImageData.js.map +0 -1
  77. package/lib-es/variants/LongformGallery/helpers/separateImages.js +0 -13
  78. package/lib-es/variants/LongformGallery/helpers/separateImages.js.map +0 -1
  79. package/lib-es/variants/LongformGallery/helpers/shouldSkip.js +0 -3
  80. package/lib-es/variants/LongformGallery/helpers/shouldSkip.js.map +0 -1
  81. package/lib-es/variants/LongformGallery/index.js +0 -12
  82. package/lib-es/variants/LongformGallery/index.js.map +0 -1
  83. package/lib-es/variants/LongformGallery/useLongformGallery.js +0 -48
  84. package/lib-es/variants/LongformGallery/useLongformGallery.js.map +0 -1
  85. package/lib-es/variants/LongformRow/index.js +0 -10
  86. package/lib-es/variants/LongformRow/index.js.map +0 -1
  87. package/lib-es/variants/ParallaxImageTextRight/index.js +0 -11
  88. package/lib-es/variants/ParallaxImageTextRight/index.js.map +0 -1
  89. package/src/variants/HeroImage/index.js +0 -8
  90. package/src/variants/Infographic/Infographic.js +0 -14
  91. package/src/variants/Infographic/index.js +0 -10
  92. package/src/variants/Infographic/useInfographic.js +0 -18
  93. package/src/variants/LongformGallery/LongformGallery.js +0 -48
  94. package/src/variants/LongformGallery/LongformGalleryImage.js +0 -62
  95. package/src/variants/LongformGallery/constants.js +0 -21
  96. package/src/variants/LongformGallery/helpers/index.js +0 -5
  97. package/src/variants/LongformGallery/helpers/parseImageData.js +0 -25
  98. package/src/variants/LongformGallery/helpers/separateImages.js +0 -22
  99. package/src/variants/LongformGallery/helpers/shouldSkip.js +0 -3
  100. package/src/variants/LongformGallery/index.js +0 -11
  101. package/src/variants/LongformGallery/useLongformGallery.js +0 -50
  102. package/src/variants/LongformRow/index.js +0 -8
  103. package/src/variants/ParallaxImageTextRight/index.js +0 -9
  104. package/tests/unit/src/variants/LongFormGallery/LongformGallery.test.js +0 -41
  105. package/tests/unit/src/variants/LongFormGallery/LongformGalleryImage.test.js +0 -44
  106. package/tests/unit/src/variants/LongFormGallery/__snapshots__/LongformGallery.test.js.snap +0 -102
  107. package/tests/unit/src/variants/LongFormGallery/__snapshots__/LongformGalleryImage.test.js.snap +0 -51
  108. package/tests/unit/src/variants/LongFormGallery/constants.js +0 -37
  109. package/tests/unit/src/variants/LongFormGallery/helpers/parseImageData.test.js +0 -53
  110. package/tests/unit/src/variants/LongFormGallery/helpers/separateImages.test.js +0 -54
  111. package/tests/unit/src/variants/LongFormGallery/helpers/shouldSkip.test.js +0 -23
  112. package/tests/unit/src/variants/LongFormGallery/useLongformGallery.test.js +0 -39
@@ -1,13 +0,0 @@
1
- import parseImageData from './parseImageData';
2
- const separateImages = (images, priorityLimit, shouldDisplayCaption) => {
3
- if (!images || !images.length) return [[], []];
4
- const mainImages = images.slice(0, 2).map((image, index) => parseImageData(image, index, priorityLimit, shouldDisplayCaption));
5
- const secondaryImages = [];
6
- for (let i = 2; i < images.length; i += 3) {
7
- const parsedImages = images.slice(i, i + 3).map((image, index) => parseImageData(image, index, priorityLimit, shouldDisplayCaption));
8
- secondaryImages.push(parsedImages);
9
- }
10
- return [mainImages, secondaryImages];
11
- };
12
- export default separateImages;
13
- //# sourceMappingURL=separateImages.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"separateImages.js","names":["parseImageData","separateImages","images","priorityLimit","shouldDisplayCaption","length","mainImages","slice","map","image","index","secondaryImages","i","parsedImages","push"],"sources":["../../../../src/variants/LongformGallery/helpers/separateImages.js"],"sourcesContent":["import parseImageData from './parseImageData';\n\nconst separateImages = (images, priorityLimit, shouldDisplayCaption) => {\n if (!images || !images.length) return [[], []];\n\n const mainImages = images\n .slice(0, 2)\n .map((image, index) => parseImageData(image, index, priorityLimit, shouldDisplayCaption));\n\n const secondaryImages = [];\n\n for (let i = 2; i < images.length; i += 3) {\n const parsedImages = images\n .slice(i, i + 3)\n .map((image, index) => parseImageData(image, index, priorityLimit, shouldDisplayCaption));\n secondaryImages.push(parsedImages);\n }\n\n return [mainImages, secondaryImages];\n};\n\nexport default separateImages;\n"],"mappings":"AAAA,OAAOA,cAAc,MAAM,kBAAkB;AAE7C,MAAMC,cAAc,GAAGA,CAACC,MAAM,EAAEC,aAAa,EAAEC,oBAAoB,KAAK;EACtE,IAAI,CAACF,MAAM,IAAI,CAACA,MAAM,CAACG,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC;EAE9C,MAAMC,UAAU,GAAGJ,MAAM,CACtBK,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CACXC,GAAG,CAAC,CAACC,KAAK,EAAEC,KAAK,KAAKV,cAAc,CAACS,KAAK,EAAEC,KAAK,EAAEP,aAAa,EAAEC,oBAAoB,CAAC,CAAC;EAE3F,MAAMO,eAAe,GAAG,EAAE;EAE1B,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGV,MAAM,CAACG,MAAM,EAAEO,CAAC,IAAI,CAAC,EAAE;IACzC,MAAMC,YAAY,GAAGX,MAAM,CACxBK,KAAK,CAACK,CAAC,EAAEA,CAAC,GAAG,CAAC,CAAC,CACfJ,GAAG,CAAC,CAACC,KAAK,EAAEC,KAAK,KAAKV,cAAc,CAACS,KAAK,EAAEC,KAAK,EAAEP,aAAa,EAAEC,oBAAoB,CAAC,CAAC;IAC3FO,eAAe,CAACG,IAAI,CAACD,YAAY,CAAC;EACpC;EAEA,OAAO,CAACP,UAAU,EAAEK,eAAe,CAAC;AACtC,CAAC;AAED,eAAeV,cAAc"}
@@ -1,3 +0,0 @@
1
- const shouldSkip = ids => !ids || Array.isArray(ids) && !ids.length;
2
- export default shouldSkip;
3
- //# sourceMappingURL=shouldSkip.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shouldSkip.js","names":["shouldSkip","ids","Array","isArray","length"],"sources":["../../../../src/variants/LongformGallery/helpers/shouldSkip.js"],"sourcesContent":["const shouldSkip = ids => !ids || (Array.isArray(ids) && !ids.length);\n\nexport default shouldSkip;\n"],"mappings":"AAAA,MAAMA,UAAU,GAAGC,GAAG,IAAI,CAACA,GAAG,IAAKC,KAAK,CAACC,OAAO,CAACF,GAAG,CAAC,IAAI,CAACA,GAAG,CAACG,MAAO;AAErE,eAAeJ,UAAU"}
@@ -1,12 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- import LongformGalleryComponent from './LongformGallery';
5
- const LongformGallery = {
6
- VariantComponent: LongformGalleryComponent,
7
- getSettings: componentSettings => _objectSpread(_objectSpread({}, componentSettings), {}, {
8
- modifier: 'longformGallery'
9
- })
10
- };
11
- export default LongformGallery;
12
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["LongformGalleryComponent","LongformGallery","VariantComponent","getSettings","componentSettings","_objectSpread","modifier"],"sources":["../../../src/variants/LongformGallery/index.js"],"sourcesContent":["import LongformGalleryComponent from './LongformGallery';\n\nconst LongformGallery = {\n VariantComponent: LongformGalleryComponent,\n getSettings: componentSettings => ({\n ...componentSettings,\n modifier: 'longformGallery'\n })\n};\n\nexport default LongformGallery;\n"],"mappings":";;;AAAA,OAAOA,wBAAwB,MAAM,mBAAmB;AAExD,MAAMC,eAAe,GAAG;EACtBC,gBAAgB,EAAEF,wBAAwB;EAC1CG,WAAW,EAAEC,iBAAiB,IAAAC,aAAA,CAAAA,aAAA,KACzBD,iBAAiB;IACpBE,QAAQ,EAAE;EAAiB;AAE/B,CAAC;AAED,eAAeL,eAAe"}
@@ -1,48 +0,0 @@
1
- import { useQuery } from '@apollo/client';
2
- import { GET_IMAGES_QUERY } from './constants';
3
- import { separateImages, shouldSkip } from './helpers';
4
- const useLongformGallery = ({
5
- imageIds = [],
6
- priorityLimit = 0,
7
- shouldDisplayCaption = false,
8
- enableLightbox = false,
9
- toggleModal = () => {},
10
- handleSelectedImage = () => {}
11
- }) => {
12
- const skip = shouldSkip(imageIds);
13
- const {
14
- data,
15
- loading,
16
- error
17
- } = useQuery(GET_IMAGES_QUERY, {
18
- variables: {
19
- where: {
20
- id: {
21
- _in: imageIds
22
- }
23
- }
24
- },
25
- skip
26
- });
27
- const {
28
- getImages
29
- } = data || {};
30
- const [mainImages, secondaryImages] = separateImages(getImages, priorityLimit, shouldDisplayCaption);
31
- const handleImageOnClick = clickedImageId => {
32
- if (!enableLightbox) return;
33
- toggleModal();
34
- handleSelectedImage(clickedImageId);
35
- };
36
- const secondaryImageClassname = imageIds.length === 4 ? 'longform-gallery__images__image secondary-image two-group' : 'longform-gallery__images__image secondary-image';
37
- return {
38
- data,
39
- loading,
40
- error,
41
- mainImages,
42
- secondaryImages,
43
- secondaryImageClassname,
44
- handleImageOnClick
45
- };
46
- };
47
- export default useLongformGallery;
48
- //# sourceMappingURL=useLongformGallery.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLongformGallery.js","names":["useQuery","GET_IMAGES_QUERY","separateImages","shouldSkip","useLongformGallery","imageIds","priorityLimit","shouldDisplayCaption","enableLightbox","toggleModal","handleSelectedImage","skip","data","loading","error","variables","where","id","_in","getImages","mainImages","secondaryImages","handleImageOnClick","clickedImageId","secondaryImageClassname","length"],"sources":["../../../src/variants/LongformGallery/useLongformGallery.js"],"sourcesContent":["import { useQuery } from '@apollo/client';\nimport { GET_IMAGES_QUERY } from './constants';\nimport { separateImages, shouldSkip } from './helpers';\n\nconst useLongformGallery = ({\n imageIds = [],\n priorityLimit = 0,\n shouldDisplayCaption = false,\n enableLightbox = false,\n toggleModal = () => {},\n handleSelectedImage = () => {}\n}) => {\n const skip = shouldSkip(imageIds);\n\n const { data, loading, error } = useQuery(GET_IMAGES_QUERY, {\n variables: { where: { id: { _in: imageIds } } },\n skip\n });\n\n const { getImages } = data || {};\n\n const [mainImages, secondaryImages] = separateImages(\n getImages,\n priorityLimit,\n shouldDisplayCaption\n );\n\n const handleImageOnClick = clickedImageId => {\n if (!enableLightbox) return;\n toggleModal();\n handleSelectedImage(clickedImageId);\n };\n\n const secondaryImageClassname =\n imageIds.length === 4\n ? 'longform-gallery__images__image secondary-image two-group'\n : 'longform-gallery__images__image secondary-image';\n\n return {\n data,\n loading,\n error,\n mainImages,\n secondaryImages,\n secondaryImageClassname,\n handleImageOnClick\n };\n};\n\nexport default useLongformGallery;\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,gBAAgB,QAAQ,aAAa;AAC9C,SAASC,cAAc,EAAEC,UAAU,QAAQ,WAAW;AAEtD,MAAMC,kBAAkB,GAAGA,CAAC;EAC1BC,QAAQ,GAAG,EAAE;EACbC,aAAa,GAAG,CAAC;EACjBC,oBAAoB,GAAG,KAAK;EAC5BC,cAAc,GAAG,KAAK;EACtBC,WAAW,GAAGA,CAAA,KAAM,CAAC,CAAC;EACtBC,mBAAmB,GAAGA,CAAA,KAAM,CAAC;AAC/B,CAAC,KAAK;EACJ,MAAMC,IAAI,GAAGR,UAAU,CAACE,QAAQ,CAAC;EAEjC,MAAM;IAAEO,IAAI;IAAEC,OAAO;IAAEC;EAAM,CAAC,GAAGd,QAAQ,CAACC,gBAAgB,EAAE;IAC1Dc,SAAS,EAAE;MAAEC,KAAK,EAAE;QAAEC,EAAE,EAAE;UAAEC,GAAG,EAAEb;QAAS;MAAE;IAAE,CAAC;IAC/CM;EACF,CAAC,CAAC;EAEF,MAAM;IAAEQ;EAAU,CAAC,GAAGP,IAAI,IAAI,CAAC,CAAC;EAEhC,MAAM,CAACQ,UAAU,EAAEC,eAAe,CAAC,GAAGnB,cAAc,CAClDiB,SAAS,EACTb,aAAa,EACbC,oBACF,CAAC;EAED,MAAMe,kBAAkB,GAAGC,cAAc,IAAI;IAC3C,IAAI,CAACf,cAAc,EAAE;IACrBC,WAAW,CAAC,CAAC;IACbC,mBAAmB,CAACa,cAAc,CAAC;EACrC,CAAC;EAED,MAAMC,uBAAuB,GAC3BnB,QAAQ,CAACoB,MAAM,KAAK,CAAC,GACjB,2DAA2D,GAC3D,iDAAiD;EAEvD,OAAO;IACLb,IAAI;IACJC,OAAO;IACPC,KAAK;IACLM,UAAU;IACVC,eAAe;IACfG,uBAAuB;IACvBF;EACF,CAAC;AACH,CAAC;AAED,eAAelB,kBAAkB"}
@@ -1,10 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- const LongformRow = {
5
- getSettings: componentSettings => _objectSpread(_objectSpread({}, componentSettings), {}, {
6
- modifier: 'longform-row'
7
- })
8
- };
9
- export default LongformRow;
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["LongformRow","getSettings","componentSettings","_objectSpread","modifier"],"sources":["../../../src/variants/LongformRow/index.js"],"sourcesContent":["const LongformRow = {\n getSettings: componentSettings => ({\n ...componentSettings,\n modifier: 'longform-row'\n })\n};\n\nexport default LongformRow;\n"],"mappings":";;;AAAA,MAAMA,WAAW,GAAG;EAClBC,WAAW,EAAEC,iBAAiB,IAAAC,aAAA,CAAAA,aAAA,KACzBD,iBAAiB;IACpBE,QAAQ,EAAE;EAAc;AAE5B,CAAC;AAED,eAAeJ,WAAW"}
@@ -1,11 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- const ParallaxImageTextRight = {
5
- getSettings: componentSettings => _objectSpread(_objectSpread({}, componentSettings), {}, {
6
- parallax: true,
7
- modifier: 'image-children-right'
8
- })
9
- };
10
- export default ParallaxImageTextRight;
11
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["ParallaxImageTextRight","getSettings","componentSettings","_objectSpread","parallax","modifier"],"sources":["../../../src/variants/ParallaxImageTextRight/index.js"],"sourcesContent":["const ParallaxImageTextRight = {\n getSettings: componentSettings => ({\n ...componentSettings,\n parallax: true,\n modifier: 'image-children-right'\n })\n};\n\nexport default ParallaxImageTextRight;\n"],"mappings":";;;AAAA,MAAMA,sBAAsB,GAAG;EAC7BC,WAAW,EAAEC,iBAAiB,IAAAC,aAAA,CAAAA,aAAA,KACzBD,iBAAiB;IACpBE,QAAQ,EAAE,IAAI;IACdC,QAAQ,EAAE;EAAsB;AAEpC,CAAC;AAED,eAAeL,sBAAsB"}
@@ -1,8 +0,0 @@
1
- const HeroImage = {
2
- getSettings: componentSettings => ({
3
- ...componentSettings,
4
- modifier: 'hero-image'
5
- })
6
- };
7
-
8
- export default HeroImage;
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import useInfographic from './useInfographic';
3
-
4
- const Infographic = props => {
5
- const { contentRef, id, className, tabId, children } = useInfographic(props);
6
-
7
- return (
8
- <div ref={contentRef} id={id} className={className} role="tabpanel" aria-labelledby={tabId}>
9
- {children}
10
- </div>
11
- );
12
- };
13
-
14
- export default Infographic;
@@ -1,10 +0,0 @@
1
- import InfographicComponent from './Infographic';
2
-
3
- const Infographic = {
4
- getSettings: componentSettings => ({
5
- ...componentSettings
6
- }),
7
- VariantComponent: InfographicComponent
8
- };
9
-
10
- export default Infographic;
@@ -1,18 +0,0 @@
1
- import { useInView } from '@blaze-react/utils/lib/customHooks';
2
-
3
- const useInfographic = ({ className: _className, ...props }) => {
4
- const [isIntersecting, contentRef] = useInView({
5
- once: true,
6
- offset: '200px'
7
- });
8
-
9
- const className = `${_className} infographic${isIntersecting ? ' infographic__active' : ''}`;
10
-
11
- return {
12
- ...props,
13
- className,
14
- contentRef
15
- };
16
- };
17
-
18
- export default useInfographic;
@@ -1,48 +0,0 @@
1
- import React from 'react';
2
- import useLongformGallery from './useLongformGallery';
3
- import LongformGalleryImage from './LongformGalleryImage';
4
-
5
- const LongformGallery = props => {
6
- const {
7
- error,
8
- mainImages,
9
- secondaryImages,
10
- secondaryImageClassname,
11
- handleImageOnClick
12
- } = useLongformGallery(props);
13
-
14
- if (error) return null;
15
-
16
- return (
17
- <div className="longform-gallery" data-testid="longform-gallery">
18
- <div className="longform-gallery__images main-images">
19
- {mainImages.map(mainImageData => (
20
- <LongformGalleryImage
21
- key={mainImageData.id}
22
- {...mainImageData}
23
- className="longform-gallery__images__image main-image"
24
- handleImageOnClick={handleImageOnClick}
25
- />
26
- ))}
27
- </div>
28
- {secondaryImages.map((secondaryImagesGroup, i) => (
29
- <div
30
- // eslint-disable-next-line react/no-array-index-key
31
- key={i}
32
- data-testid="secondary-images"
33
- className="longform-gallery__images secondary-images">
34
- {secondaryImagesGroup.map(secondaryImage => (
35
- <LongformGalleryImage
36
- key={secondaryImage.id}
37
- {...secondaryImage}
38
- className={secondaryImageClassname}
39
- handleImageOnClick={handleImageOnClick}
40
- />
41
- ))}
42
- </div>
43
- ))}
44
- </div>
45
- );
46
- };
47
-
48
- export default LongformGallery;
@@ -1,62 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import Head from 'next/head';
4
- import { useInView } from '@blaze-react/utils/lib/customHooks';
5
- import { ResponsiveImage } from '@blaze-cms/image-cdn-react';
6
- import { IN_VIEW_CONFIG } from './constants';
7
-
8
- const LongformGalleryImage = ({
9
- id,
10
- url,
11
- caption,
12
- altText,
13
- priority,
14
- className,
15
- handleImageOnClick,
16
- ...props
17
- }) => {
18
- const [isIntersecting, outerRef] = useInView(IN_VIEW_CONFIG);
19
- const shouldRender = priority || isIntersecting;
20
- const HeadComponent = priority ? Head : null;
21
-
22
- return (
23
- <div ref={outerRef} className={className}>
24
- <div
25
- role="button"
26
- className="longform-gallery__images__image__container"
27
- data-testid="longform-gallery__images__image__container"
28
- onClick={() => handleImageOnClick(id)}>
29
- {shouldRender && (
30
- <ResponsiveImage
31
- sizeKey="carousel"
32
- role="button"
33
- src={url}
34
- alt={altText}
35
- priority={priority}
36
- HeadComponent={HeadComponent}
37
- {...props}
38
- />
39
- )}
40
- </div>
41
- {!!caption && (
42
- <div
43
- className="longform-gallery__images__image__details"
44
- data-testid="longform-gallery__images__image__details">
45
- <div className="longform-gallery__images__image__details__caption">{caption}</div>
46
- </div>
47
- )}
48
- </div>
49
- );
50
- };
51
-
52
- LongformGalleryImage.propTypes = {
53
- id: PropTypes.string.isRequired,
54
- url: PropTypes.string.isRequired,
55
- caption: PropTypes.string.isRequired,
56
- altText: PropTypes.string.isRequired,
57
- priority: PropTypes.bool.isRequired,
58
- className: PropTypes.string.isRequired,
59
- handleImageOnClick: PropTypes.func.isRequired
60
- };
61
-
62
- export default LongformGalleryImage;
@@ -1,21 +0,0 @@
1
- import { gql } from '@apollo/client';
2
-
3
- const GET_IMAGES_QUERY = gql`
4
- query getImages($where: JSON!) {
5
- getImages: getFiles(where: $where) {
6
- id
7
- url
8
- data
9
- }
10
- }
11
- `;
12
-
13
- const PROPS_TO_CHECK = ['altText', 'caption', 'hrefUrl', 'credits'];
14
-
15
- const IN_VIEW_CONFIG = {
16
- once: true,
17
- offset: '200px',
18
- bottomOffset: '-200px'
19
- };
20
-
21
- export { GET_IMAGES_QUERY, IN_VIEW_CONFIG, PROPS_TO_CHECK };
@@ -1,5 +0,0 @@
1
- import parseImageData from './parseImageData';
2
- import separateImages from './separateImages';
3
- import shouldSkip from './shouldSkip';
4
-
5
- export { parseImageData, separateImages, shouldSkip };
@@ -1,25 +0,0 @@
1
- import parseHTML from 'html-react-parser';
2
- import { PROPS_TO_CHECK } from '../constants';
3
-
4
- const parseImageData = (image, index, priorityLimit, shouldDisplayCaption) => {
5
- const { data = {} } = image;
6
- const parsedData = {};
7
-
8
- PROPS_TO_CHECK.forEach(dataKey => {
9
- const value = data && data[dataKey];
10
- if (dataKey === 'caption') {
11
- parsedData[dataKey] = shouldDisplayCaption && !!value ? parseHTML(value) : '';
12
- return;
13
- }
14
- parsedData[dataKey] = value || '';
15
- });
16
-
17
- return {
18
- ...parsedData,
19
- id: image.id,
20
- url: image.url,
21
- priority: index < priorityLimit
22
- };
23
- };
24
-
25
- export default parseImageData;
@@ -1,22 +0,0 @@
1
- import parseImageData from './parseImageData';
2
-
3
- const separateImages = (images, priorityLimit, shouldDisplayCaption) => {
4
- if (!images || !images.length) return [[], []];
5
-
6
- const mainImages = images
7
- .slice(0, 2)
8
- .map((image, index) => parseImageData(image, index, priorityLimit, shouldDisplayCaption));
9
-
10
- const secondaryImages = [];
11
-
12
- for (let i = 2; i < images.length; i += 3) {
13
- const parsedImages = images
14
- .slice(i, i + 3)
15
- .map((image, index) => parseImageData(image, index, priorityLimit, shouldDisplayCaption));
16
- secondaryImages.push(parsedImages);
17
- }
18
-
19
- return [mainImages, secondaryImages];
20
- };
21
-
22
- export default separateImages;
@@ -1,3 +0,0 @@
1
- const shouldSkip = ids => !ids || (Array.isArray(ids) && !ids.length);
2
-
3
- export default shouldSkip;
@@ -1,11 +0,0 @@
1
- import LongformGalleryComponent from './LongformGallery';
2
-
3
- const LongformGallery = {
4
- VariantComponent: LongformGalleryComponent,
5
- getSettings: componentSettings => ({
6
- ...componentSettings,
7
- modifier: 'longformGallery'
8
- })
9
- };
10
-
11
- export default LongformGallery;
@@ -1,50 +0,0 @@
1
- import { useQuery } from '@apollo/client';
2
- import { GET_IMAGES_QUERY } from './constants';
3
- import { separateImages, shouldSkip } from './helpers';
4
-
5
- const useLongformGallery = ({
6
- imageIds = [],
7
- priorityLimit = 0,
8
- shouldDisplayCaption = false,
9
- enableLightbox = false,
10
- toggleModal = () => {},
11
- handleSelectedImage = () => {}
12
- }) => {
13
- const skip = shouldSkip(imageIds);
14
-
15
- const { data, loading, error } = useQuery(GET_IMAGES_QUERY, {
16
- variables: { where: { id: { _in: imageIds } } },
17
- skip
18
- });
19
-
20
- const { getImages } = data || {};
21
-
22
- const [mainImages, secondaryImages] = separateImages(
23
- getImages,
24
- priorityLimit,
25
- shouldDisplayCaption
26
- );
27
-
28
- const handleImageOnClick = clickedImageId => {
29
- if (!enableLightbox) return;
30
- toggleModal();
31
- handleSelectedImage(clickedImageId);
32
- };
33
-
34
- const secondaryImageClassname =
35
- imageIds.length === 4
36
- ? 'longform-gallery__images__image secondary-image two-group'
37
- : 'longform-gallery__images__image secondary-image';
38
-
39
- return {
40
- data,
41
- loading,
42
- error,
43
- mainImages,
44
- secondaryImages,
45
- secondaryImageClassname,
46
- handleImageOnClick
47
- };
48
- };
49
-
50
- export default useLongformGallery;
@@ -1,8 +0,0 @@
1
- const LongformRow = {
2
- getSettings: componentSettings => ({
3
- ...componentSettings,
4
- modifier: 'longform-row'
5
- })
6
- };
7
-
8
- export default LongformRow;
@@ -1,9 +0,0 @@
1
- const ParallaxImageTextRight = {
2
- getSettings: componentSettings => ({
3
- ...componentSettings,
4
- parallax: true,
5
- modifier: 'image-children-right'
6
- })
7
- };
8
-
9
- export default ParallaxImageTextRight;
@@ -1,41 +0,0 @@
1
- /**
2
- * @jest-environment jsdom
3
- */
4
- import React from 'react';
5
- import '@testing-library/jest-dom/extend-expect';
6
- import { render, screen, waitFor } from '@testing-library/react';
7
- import { MockedProvider } from '@apollo/client/testing';
8
- import LongformGallery from '../../../../../src/variants/LongformGallery/LongformGallery';
9
- import { IMAGE_MOCKS } from './constants';
10
-
11
- const mockedProps = {
12
- imageIds: ['1', '2', '3'],
13
- priorityLimit: [0]
14
- };
15
-
16
- describe('LongformGallery', () => {
17
- it('renders LongformGallery without error', async () => {
18
- const { asFragment } = render(
19
- <MockedProvider mocks={IMAGE_MOCKS}>
20
- <LongformGallery {...mockedProps} />
21
- </MockedProvider>
22
- );
23
- await waitFor(() => {
24
- expect(screen.getByTestId('secondary-images')).toBeInTheDocument();
25
- });
26
- expect(asFragment()).toMatchSnapshot();
27
- expect(screen.getByTestId('longform-gallery')).toBeInTheDocument();
28
- });
29
-
30
- it('renders LongformGallery with two-group modifier if images length is 4', async () => {
31
- const { asFragment } = render(
32
- <MockedProvider mocks={IMAGE_MOCKS}>
33
- <LongformGallery {...mockedProps} imageIds={['1', '2', '3', '4']} />
34
- </MockedProvider>
35
- );
36
- await waitFor(() => {
37
- expect(screen.getByTestId('secondary-images')).toBeInTheDocument();
38
- });
39
- expect(asFragment()).toMatchSnapshot();
40
- });
41
- });
@@ -1,44 +0,0 @@
1
- /**
2
- * @jest-environment jsdom
3
- */
4
- import React from 'react';
5
- import { render, screen, fireEvent } from '@testing-library/react';
6
- import '@testing-library/jest-dom/extend-expect';
7
- import LongformGalleryImage from '../../../../../src/variants/LongformGallery/LongformGalleryImage';
8
-
9
- const mockedProps = {
10
- url: 'https://mock-url/image-id-1.jpg',
11
- id: 'image-id-1',
12
- caption: '',
13
- altText: '',
14
- priority: true,
15
- className: 'longform-gallery__images__image main-image',
16
- handleImageOnClick: jest.fn()
17
- };
18
-
19
- describe('LongformGalleryImage component', () => {
20
- it('should be a function', () => {
21
- expect(typeof LongformGalleryImage).toEqual('function');
22
- });
23
-
24
- it('renders LongformGalleryImage component', () => {
25
- const { asFragment } = render(<LongformGalleryImage {...mockedProps} />);
26
- expect(asFragment()).toMatchSnapshot();
27
- expect(screen.getByTestId('longform-gallery__images__image__container')).toBeInTheDocument();
28
- });
29
-
30
- it('renders LongformGalleryImage component', () => {
31
- const { asFragment } = render(
32
- <LongformGalleryImage {...mockedProps} caption="some image caption" />
33
- );
34
- expect(asFragment()).toMatchSnapshot();
35
- expect(screen.getByTestId('longform-gallery__images__image__details')).toBeInTheDocument();
36
- });
37
-
38
- it('calls handleImageOnClick when image is clicked', () => {
39
- render(<LongformGalleryImage {...mockedProps} />);
40
- const image = screen.getByTestId('longform-gallery__images__image__container');
41
- fireEvent.click(image);
42
- expect(mockedProps.handleImageOnClick).toHaveBeenCalledWith(mockedProps.id);
43
- });
44
- });