@uncinc/uncinc-react-kitchen-sink 2.3.3 → 2.3.4

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/dist/Context/withMapping.js +1 -6
  2. package/dist/components/Accordion/AccordionItem/index.js +0 -5
  3. package/dist/components/Accordion/AccordionItemVariant/index.js +0 -5
  4. package/dist/components/Accordion/index.js +0 -2
  5. package/dist/components/ApiAutocomplete/index.js +6 -12
  6. package/dist/components/Button/index.js +4 -10
  7. package/dist/components/Cookie/Checkbox/index.js +0 -2
  8. package/dist/components/Cookie/index.js +39 -34
  9. package/dist/components/FontSizeSwitcher/index.js +2 -8
  10. package/dist/components/Form/Checkbox/index.js +1 -4
  11. package/dist/components/Form/Checkbox/stories.js +0 -2
  12. package/dist/components/Form/Checkboxes/index.js +1 -7
  13. package/dist/components/Form/Checkboxes/index.test.js +8 -4
  14. package/dist/components/Form/Checkboxes/stories.js +1 -4
  15. package/dist/components/Form/Date/index.js +1 -4
  16. package/dist/components/Form/Date/stories.js +0 -2
  17. package/dist/components/Form/DatePicker/index.js +0 -2
  18. package/dist/components/Form/DatePicker/stories.js +0 -2
  19. package/dist/components/Form/DateSelect/index.js +110 -85
  20. package/dist/components/Form/DateSelect/stories.js +24 -15
  21. package/dist/components/Form/DateSelect/style.scss +10 -4
  22. package/dist/components/Form/Email/index.js +1 -4
  23. package/dist/components/Form/Email/stories.js +0 -2
  24. package/dist/components/Form/FormikWrapper/index.js +9 -15
  25. package/dist/components/Form/GenericFormElement/index.js +0 -2
  26. package/dist/components/Form/Number/index.js +1 -10
  27. package/dist/components/Form/Number/stories.js +0 -2
  28. package/dist/components/Form/RadioButtons/index.js +1 -7
  29. package/dist/components/Form/RadioButtons/index.test.js +8 -4
  30. package/dist/components/Form/RadioButtons/stories.js +1 -4
  31. package/dist/components/Form/SearchField/index.js +0 -2
  32. package/dist/components/Form/Select/Input/index.js +4 -14
  33. package/dist/components/Form/Select/index.js +1 -4
  34. package/dist/components/Form/Select/stories.js +0 -4
  35. package/dist/components/Form/TextField/index.js +0 -6
  36. package/dist/components/Form/TextField/index.test.js +8 -4
  37. package/dist/components/Form/TextField/stories.js +1 -4
  38. package/dist/components/Form/Textarea/index.js +0 -2
  39. package/dist/components/Form/Textarea/stories.js +0 -2
  40. package/dist/components/Hamburger/index.js +0 -2
  41. package/dist/components/Header/index.js +4 -9
  42. package/dist/components/Image/Background/index.js +1 -7
  43. package/dist/components/Image/LazyLoadWrapper/index.js +0 -12
  44. package/dist/components/Image/Picture/index.js +4 -19
  45. package/dist/components/Image/index.js +0 -4
  46. package/dist/components/InlineMenu/index.js +0 -9
  47. package/dist/components/Layout/Container/index.js +1 -4
  48. package/dist/components/Layout/Container/stories.js +0 -3
  49. package/dist/components/Layout/QuickLayout/Auto/index.js +0 -2
  50. package/dist/components/Layout/QuickLayout/Center/index.js +0 -2
  51. package/dist/components/Layout/QuickLayout/Clamp/index.js +0 -2
  52. package/dist/components/Layout/QuickLayout/Sidebar/index.js +0 -2
  53. package/dist/components/Layout/QuickLayout/SpaceBetween/index.js +0 -2
  54. package/dist/components/Layout/QuickLayout/Stack/index.js +1 -4
  55. package/dist/components/Layout/QuickLayout/Wrap/index.js +0 -2
  56. package/dist/components/Layout/QuickLayout/index.js +0 -9
  57. package/dist/components/Lottie/LottieAnimation/index.js +12 -17
  58. package/dist/components/Lottie/LottieAnimationWithMousePosition.js +8 -9
  59. package/dist/components/Lottie/index.js +3 -3
  60. package/dist/components/Lottie/stories.js +10 -5
  61. package/dist/components/MagicLine/index.js +0 -14
  62. package/dist/components/MagicLine/stories.js +0 -2
  63. package/dist/components/NavigationScroll/index.js +2 -12
  64. package/dist/components/Pagination/index.js +0 -7
  65. package/dist/components/SearchKit/Facets/ChipFacet/index.js +0 -2
  66. package/dist/components/SearchKit/Facets/HierarchicalFilterFacet/index.js +0 -2
  67. package/dist/components/SearchKit/Facets/HierarchicalMenuFacet/index.js +0 -2
  68. package/dist/components/SearchKit/Facets/SelectFacet/index.js +0 -6
  69. package/dist/components/SearchKit/Query/index.js +3 -6
  70. package/dist/components/SearchKit/SearchFacets/index.js +0 -7
  71. package/dist/components/SearchKit/SearchField/index.js +0 -9
  72. package/dist/components/SearchKit/SearchLoadMore/index.js +0 -7
  73. package/dist/components/SearchKit/SearchPage/index.js +3 -9
  74. package/dist/components/SearchKit/SearchPagination/index.js +0 -5
  75. package/dist/components/SearchKit/SearchReset/index.js +0 -2
  76. package/dist/components/SearchKit/SearchResults/index.js +6 -11
  77. package/dist/components/SearchKit/SearchSelectedFilters/index.js +0 -4
  78. package/dist/components/SearchKit/SearchSorting/index.js +0 -2
  79. package/dist/components/SearchKit/index.js +0 -3
  80. package/dist/components/SearchKit/stories.js +2 -7
  81. package/dist/components/Share/index.js +0 -3
  82. package/dist/components/Sliders/SliderRelated/index.js +1 -6
  83. package/dist/components/Sliders/SliderRelated/stories.js +1 -4
  84. package/dist/components/Webform/WebformActions/index.js +0 -2
  85. package/dist/components/Webform/WebformCheckbox/index.js +1 -8
  86. package/dist/components/Webform/WebformCheckboxes/index.js +1 -9
  87. package/dist/components/Webform/WebformContainer/index.js +5 -6
  88. package/dist/components/Webform/WebformDate/index.js +12 -18
  89. package/dist/components/Webform/WebformMapper/index.js +1 -18
  90. package/dist/components/Webform/WebformNumber/index.js +1 -4
  91. package/dist/components/Webform/WebformRadioButtons/index.js +1 -9
  92. package/dist/components/Webform/WebformSelect/index.js +1 -9
  93. package/dist/components/Webform/WebformTextField/index.js +1 -8
  94. package/dist/components/Webform/WebformTextarea/index.js +1 -8
  95. package/dist/components/Webform/WebformWizardPage/index.js +6 -8
  96. package/dist/components/Webform/index.js +1 -8
  97. package/dist/components/Webform/withStates.js +6 -19
  98. package/dist/components/WysiwygField/index.js +1 -8
  99. package/dist/components/WysiwygField/stories.js +0 -3
  100. package/dist/config/constants.js +3 -4
  101. package/dist/config/i18next/index.js +23 -0
  102. package/dist/config/i18next/locales/en.json +22 -0
  103. package/dist/config/i18next/locales/nl.json +22 -0
  104. package/dist/helpers/gtm.js +11 -15
  105. package/dist/helpers/link.js +0 -4
  106. package/dist/helpers/useValueForCurrentViewPort.js +20 -14
  107. package/dist/hooks/useOnScreen.js +2 -2
  108. package/dist/hooks/usePrevious.js +3 -2
  109. package/dist/hooks/useScrollPosition.js +0 -3
  110. package/dist/hooks/useWindowDimensions.js +0 -3
  111. package/package.json +14 -5
  112. package/dist/pages/api/graphql.js +0 -25
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import c from 'classnames';
3
3
  import './style.scss';
4
-
5
4
  const QuickLayoutSidebar = ({
6
5
  children,
7
6
  min,
@@ -17,7 +16,6 @@ const QuickLayoutSidebar = ({
17
16
  }
18
17
  }, children);
19
18
  };
20
-
21
19
  QuickLayoutSidebar.defaultProps = {
22
20
  min: '2.5rem',
23
21
  max: '25%'
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import c from 'classnames';
3
3
  import './style.scss';
4
-
5
4
  const QuickLayoutSpaceBetween = ({
6
5
  children,
7
6
  gap,
@@ -17,7 +16,6 @@ const QuickLayoutSpaceBetween = ({
17
16
  }
18
17
  }, children);
19
18
  };
20
-
21
19
  QuickLayoutSpaceBetween.defaultProps = {
22
20
  gap: '2.5rem',
23
21
  items: '3'
@@ -1,9 +1,7 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
2
  import React from 'react';
4
3
  import c from 'classnames';
5
4
  import './style.scss';
6
-
7
5
  const QuickLayoutStack = ({
8
6
  children,
9
7
  className,
@@ -14,5 +12,4 @@ const QuickLayoutStack = ({
14
12
  className: classes
15
13
  }, props), children);
16
14
  };
17
-
18
15
  export default QuickLayoutStack;
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import c from 'classnames';
3
3
  import './style.scss';
4
-
5
4
  const QuickLayoutWrap = ({
6
5
  children,
7
6
  min,
@@ -21,7 +20,6 @@ const QuickLayoutWrap = ({
21
20
  }, child);
22
21
  }));
23
22
  };
24
-
25
23
  QuickLayoutWrap.defaultProps = {
26
24
  min: '2.5rem',
27
25
  stretched: true
@@ -6,7 +6,6 @@ import QuickLayoutStack from './Stack';
6
6
  import QuickLayoutAuto from './Auto';
7
7
  import QuickLayoutSpaceBetween from './SpaceBetween';
8
8
  import QuickLayoutClamp from './Clamp';
9
-
10
9
  const QuickLayout = ({
11
10
  type,
12
11
  children,
@@ -31,7 +30,6 @@ const QuickLayout = ({
31
30
  * @param {string} className - A classname to be added for extra control, if needed.
32
31
  * @param {boolean} stretched - if the children can stretch over the parent width.
33
32
  */
34
-
35
33
  case 'wrap':
36
34
  {
37
35
  return /*#__PURE__*/React.createElement(QuickLayoutWrap, props, children);
@@ -46,7 +44,6 @@ const QuickLayout = ({
46
44
  * @param {string} className - A classname to be added for extra control, if needed.
47
45
  * @param {string} max - The maximal width of the sidebar.
48
46
  */
49
-
50
47
  case 'sidebar':
51
48
  {
52
49
  return /*#__PURE__*/React.createElement(QuickLayoutSidebar, props, children);
@@ -60,7 +57,6 @@ const QuickLayout = ({
60
57
  *
61
58
  * @param {string} className - A classname to be added for extra control, if needed.
62
59
  */
63
-
64
60
  case 'stack':
65
61
  {
66
62
  return /*#__PURE__*/React.createElement(QuickLayoutStack, props, children);
@@ -72,7 +68,6 @@ const QuickLayout = ({
72
68
  * @param {string} gap - The space between items.
73
69
  * @param {string} className - A classname to be added for extra control, if needed.
74
70
  */
75
-
76
71
  case 'auto':
77
72
  {
78
73
  return /*#__PURE__*/React.createElement(QuickLayoutAuto, props, children);
@@ -88,7 +83,6 @@ const QuickLayout = ({
88
83
  *
89
84
  * @note Only use this when the amount of items is known to you. Use QuickLayoutAuto otherwise.
90
85
  */
91
-
92
86
  case 'spaceBetween':
93
87
  {
94
88
  return /*#__PURE__*/React.createElement(QuickLayoutSpaceBetween, props, children);
@@ -101,19 +95,16 @@ const QuickLayout = ({
101
95
  * @param {string} max - The maximal font-size.
102
96
  * @param {string} className - A classname to be added for extra control, if needed.
103
97
  */
104
-
105
98
  case 'clamp':
106
99
  {
107
100
  return /*#__PURE__*/React.createElement(QuickLayoutClamp, props, children);
108
101
  }
109
-
110
102
  default:
111
103
  {
112
104
  return 'No type selected.';
113
105
  }
114
106
  }
115
107
  };
116
-
117
108
  QuickLayout.defaultProps = {
118
109
  type: ''
119
110
  };
@@ -15,10 +15,10 @@ const LottieAnimation = /*#__PURE__*/React.forwardRef((props, ref) => {
15
15
  const refInternal = useRef(null);
16
16
  const lottieAnimation = ref || refInternal;
17
17
  const lottieId = id || (data ? data.nm : null);
18
+
18
19
  /*
19
20
  * Initial load of the Lottie animation
20
21
  */
21
-
22
22
  const loadAnimation = useCallback(() => {
23
23
  const {
24
24
  renderer,
@@ -43,59 +43,54 @@ const LottieAnimation = /*#__PURE__*/React.forwardRef((props, ref) => {
43
43
  autoplay: activateOnHover ? false : autoPlay,
44
44
  path
45
45
  });
46
- onInit(lottieAnimation.current); // Set the default speed.
47
-
48
- lottieAnimation.current.setSpeed(speed); // Play segments if we have them.
46
+ onInit(lottieAnimation.current);
49
47
 
48
+ // Set the default speed.
49
+ lottieAnimation.current.setSpeed(speed);
50
+ // Play segments if we have them.
50
51
  if (segments) {
51
52
  lottieAnimation.current.playSegments(segments);
52
- } // If startPosition is defined use it as a starting frame, startPosition should be between 0 and 1.
53
-
54
-
53
+ }
54
+ // If startPosition is defined use it as a starting frame, startPosition should be between 0 and 1.
55
55
  if (startPosition) {
56
56
  const startingFrame = Math.round(lottieAnimation.current.totalFrames * startPosition);
57
57
  lottieAnimation.current.goToAndStop(startingFrame, true);
58
58
  }
59
59
  }, [data, lottieAnimation, lottieId, props]);
60
+
60
61
  /*
61
62
  * Reverse direction on Mouse enter.
62
63
  */
63
-
64
64
  const onMouseEnter = e => {
65
65
  const {
66
66
  activateOnHover
67
67
  } = props;
68
-
69
68
  if (activateOnHover) {
70
69
  lottieAnimation.current.setDirection(DIRECTION_FORWARD);
71
70
  lottieAnimation.current.play();
72
71
  }
73
72
  };
73
+
74
74
  /*
75
75
  * Reverse direction on Mouse leave
76
76
  */
77
-
78
-
79
77
  const onMouseLeave = () => {
80
78
  const {
81
79
  activateOnHover
82
80
  } = props;
83
-
84
81
  if (activateOnHover) {
85
82
  lottieAnimation.current.setDirection(DIRECTION_BACKWARDS);
86
83
  lottieAnimation.current.play();
87
84
  }
88
85
  };
86
+
89
87
  /*
90
88
  * Toggle the animation on click
91
89
  */
92
-
93
-
94
90
  const onClick = () => {
95
91
  const {
96
92
  pauseOnClick
97
93
  } = props;
98
-
99
94
  if (pauseOnClick) {
100
95
  if (lottieAnimation.current.isPaused) {
101
96
  lottieAnimation.current.play();
@@ -103,9 +98,9 @@ const LottieAnimation = /*#__PURE__*/React.forwardRef((props, ref) => {
103
98
  lottieAnimation.current.pause();
104
99
  }
105
100
  }
106
- }; // Init the Lottie animation.
107
-
101
+ };
108
102
 
103
+ // Init the Lottie animation.
109
104
  useEffect(() => {
110
105
  const {
111
106
  onDestroy
@@ -1,36 +1,36 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
2
  import React, { useRef } from 'react';
4
3
  import Lottie from './';
5
4
  import Ola from "ola";
6
-
7
5
  const LottieAnimationWithMousePosition = ({
8
6
  olaTime,
9
7
  ...props
10
8
  }) => {
11
9
  // Create our own ref that we pass to the component so that we can use lottie functions.
12
- const ref = useRef(null); // Create an Ola instance for frame interpolation.
10
+ const ref = useRef(null);
13
11
 
12
+ // Create an Ola instance for frame interpolation.
14
13
  const interpolatedFrame = Ola(0, olaTime);
14
+
15
15
  /*
16
16
  * Follow mouse position for animation on Mouse move.
17
17
  */
18
-
19
18
  const onMouseMove = e => {
20
19
  if (ref && ref.current) {
21
20
  // Determine the mouse position relative to the current Lottie.
22
21
  const clientRect = ref.current.wrapper.getBoundingClientRect();
23
22
  const mousePositionRelative = e.type === 'touchmove' ? (e.touches[0].clientX - clientRect.left) / clientRect.width : (e.clientX - clientRect.left) / clientRect.width;
24
- const lottiePosition = Math.max(0, Math.min(1, mousePositionRelative)); // Round the frame, clamp it, and pass it to Ola for frame interpolation.
23
+ const lottiePosition = Math.max(0, Math.min(1, mousePositionRelative));
25
24
 
25
+ // Round the frame, clamp it, and pass it to Ola for frame interpolation.
26
26
  const rawFrame = Math.round(ref.current.totalFrames * lottiePosition);
27
27
  const frame = Math.min(ref.current.totalFrames - 1, Math.max(1, rawFrame));
28
- interpolatedFrame.set(frame); // Go to the frame we just calculated using the Ola value.
28
+ interpolatedFrame.set(frame);
29
29
 
30
+ // Go to the frame we just calculated using the Ola value.
30
31
  ref.current.goToAndStop(interpolatedFrame.value, true);
31
32
  }
32
33
  };
33
-
34
34
  return /*#__PURE__*/React.createElement("div", {
35
35
  onMouseMove: onMouseMove,
36
36
  onTouchMove: onMouseMove
@@ -38,5 +38,4 @@ const LottieAnimationWithMousePosition = ({
38
38
  ref: ref
39
39
  }, props)));
40
40
  };
41
-
42
41
  export default LottieAnimationWithMousePosition;
@@ -1,9 +1,9 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
2
  import React from 'react';
4
3
  import PropTypes from 'prop-types';
5
- import loadable from '@loadable/component'; // Lazy-load Lottie animations with a delay.
4
+ import loadable from '@loadable/component';
6
5
 
6
+ // Lazy-load Lottie animations with a delay.
7
7
  const Lottie = /*#__PURE__*/React.forwardRef((props, ref) => {
8
8
  const {
9
9
  delay
@@ -5,32 +5,37 @@ import exampleLottie from '../../assets/lottie/example.json';
5
5
  import exampleLottieEspero from '../../assets/lottie/data.json';
6
6
  export default {
7
7
  title: 'Atoms/Lottie'
8
- }; // Default animation
8
+ };
9
9
 
10
+ // Default animation
10
11
  export const DefaultAnimation = () => /*#__PURE__*/React.createElement(Lottie, {
11
12
  id: "example",
12
13
  data: exampleLottie,
13
14
  onInit: lottie => console.log(lottie)
14
- }); // Animation active on hover
15
+ });
15
16
 
17
+ // Animation active on hover
16
18
  export const activateOnHoverAnimation = () => /*#__PURE__*/React.createElement(Lottie, {
17
19
  data: exampleLottie,
18
20
  activateOnHover: true
19
- }); // Animation plays on mouse position
21
+ });
20
22
 
23
+ // Animation plays on mouse position
21
24
  export const playAnimationOnMousePosition = () => /*#__PURE__*/React.createElement(LottieAnimationWithMousePosition, {
22
25
  loop: false,
23
26
  autoplay: false,
24
27
  data: exampleLottieEspero,
25
28
  olaTime: 100,
26
29
  startPosition: 0.5
27
- }); // Pause animation on click
30
+ });
28
31
 
32
+ // Pause animation on click
29
33
  export const pauseOnClickAnimation = () => /*#__PURE__*/React.createElement(Lottie, {
30
34
  data: exampleLottie,
31
35
  pauseOnClick: true
32
- }); // Via path load
36
+ });
33
37
 
38
+ // Via path load
34
39
  export const PathLoad = () => /*#__PURE__*/React.createElement(Lottie, {
35
40
  path: "https://maxst.icons8.com/vue-static/landings/animated-icons/icons/checkmark-ok/checkmark-ok.json"
36
41
  });
@@ -1,6 +1,5 @@
1
1
  import React, { useRef, useState, useEffect } from 'react';
2
2
  import c from 'classnames';
3
-
4
3
  const MagicLine = ({
5
4
  activeClassName = "Menu__item--active",
6
5
  children
@@ -10,17 +9,14 @@ const MagicLine = ({
10
9
  const currentActiveItem = useRef(null);
11
10
  const [loaded, setLoaded] = useState(false);
12
11
  const [activeItemInNavigation, _setActiveItemInNavigation] = useState(false);
13
-
14
12
  const setActiveItemInNavigation = value => {
15
13
  if (value !== activeItemInNavigation) {
16
14
  _setActiveItemInNavigation(value);
17
15
  }
18
16
  };
19
-
20
17
  const MagicLineRefClasses = c('MagicLine__magic_line', {
21
18
  'MagicLine__magic_line--visible': activeItemInNavigation && loaded
22
19
  });
23
-
24
20
  const alignMagicLine = () => {
25
21
  if (magicLineRef.current && currentActiveItem.current) {
26
22
  const left = currentActiveItem.current.getBoundingClientRect().left - magicLineParentRef.current.getBoundingClientRect().left;
@@ -30,34 +26,25 @@ const MagicLine = ({
30
26
  setLoaded(true);
31
27
  }
32
28
  };
33
-
34
29
  const hoverMagicLine = e => {
35
30
  currentActiveItem.current = e.target;
36
-
37
31
  _setActiveItemInNavigation(true);
38
-
39
32
  alignMagicLine();
40
33
  };
41
-
42
34
  const setInitialMagicLine = () => {
43
35
  currentActiveItem.current = document.getElementsByClassName(activeClassName)[0];
44
-
45
36
  if (!currentActiveItem.current) {
46
37
  _setActiveItemInNavigation(false);
47
38
  }
48
-
49
39
  alignMagicLine();
50
40
  };
51
-
52
41
  useEffect(() => {
53
42
  const initialize = () => {
54
43
  setInitialMagicLine();
55
44
  };
56
-
57
45
  const handleResize = () => {
58
46
  alignMagicLine();
59
47
  };
60
-
61
48
  document.fonts.ready.then(initialize);
62
49
  window.addEventListener('load', initialize);
63
50
  window.addEventListener("resize", handleResize);
@@ -74,5 +61,4 @@ const MagicLine = ({
74
61
  className: MagicLineRefClasses
75
62
  }), children(setInitialMagicLine, hoverMagicLine, setActiveItemInNavigation));
76
63
  };
77
-
78
64
  export default MagicLine;
@@ -11,11 +11,9 @@ export const Default = () => /*#__PURE__*/React.createElement(MagicLine, null, (
11
11
  className: "Menu"
12
12
  }, items.map(item => {
13
13
  const active = item === "three";
14
-
15
14
  if (active) {
16
15
  setActiveItemInNavigation(true);
17
16
  }
18
-
19
17
  const classes = c('Menu__item', {
20
18
  'Menu__item--active': active
21
19
  });
@@ -2,7 +2,6 @@ import React, { useState, useEffect, useRef } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import PropTypes from 'prop-types';
4
4
  import './style.scss';
5
-
6
5
  const NavigationScroll = props => {
7
6
  const node = useRef(null);
8
7
  const [state, setState] = useState({
@@ -18,41 +17,34 @@ const NavigationScroll = props => {
18
17
  window.removeEventListener('scroll', handleScroll);
19
18
  };
20
19
  });
21
-
22
20
  const getScrollPos = element => {
23
21
  if (typeof element.pageYOffset !== 'undefined') {
24
22
  return element.pageYOffset;
25
23
  }
26
-
27
24
  return element.scrollTop;
28
25
  };
29
-
30
26
  const getElementHeight = element => {
31
27
  let deductHeight = 0;
32
-
33
28
  if (document.getElementsByClassName('Header__subMenu').length !== 0) {
34
29
  deductHeight = document.getElementsByClassName('Header__subMenu')[0].clientHeight;
35
30
  }
36
-
37
31
  return element.offsetHeight - deductHeight;
38
32
  };
39
-
40
33
  const handleScroll = () => {
41
34
  const scrollPos = getScrollPos(window);
42
35
  let elementHeight = getElementHeight(node.current);
43
36
  let newPos = 0;
44
-
45
37
  if (scrollPos > 0) {
46
38
  const diff = state._previousPos - scrollPos;
47
39
  newPos = state.pos + diff;
48
40
  newPos = Math.max(-elementHeight, Math.min(0, newPos));
49
41
  }
50
-
51
42
  const isVisible = newPos > -elementHeight;
52
43
  const hasReachedTop = scrollPos < 5 && isVisible;
53
44
  const hasReachedBottom = Math.round(scrollPos + window.innerHeight) >= document.body.clientHeight;
54
45
  const scrolledPastNavHeight = scrollPos > elementHeight;
55
- setState(prevState => ({ ...prevState,
46
+ setState(prevState => ({
47
+ ...prevState,
56
48
  pos: hasReachedBottom ? 0 : newPos,
57
49
  reachedTop: hasReachedTop,
58
50
  scrolledPastNavHeight,
@@ -60,7 +52,6 @@ const NavigationScroll = props => {
60
52
  _previousPos: scrollPos
61
53
  }));
62
54
  };
63
-
64
55
  const {
65
56
  reachedTop,
66
57
  reachedBottom,
@@ -85,7 +76,6 @@ const NavigationScroll = props => {
85
76
  }
86
77
  }, children);
87
78
  };
88
-
89
79
  NavigationScroll.propTypes = {
90
80
  children: PropTypes.element.isRequired,
91
81
  onUpdate: PropTypes.func
@@ -4,7 +4,6 @@ import c from 'classnames';
4
4
  import './style.scss';
5
5
  import PropTypes from 'prop-types';
6
6
  import withMapping from '../../Context/withMapping';
7
-
8
7
  const Pagination = ({
9
8
  currentPage,
10
9
  totalPages,
@@ -24,19 +23,15 @@ const Pagination = ({
24
23
  setCurrentPage(data.selected + 1);
25
24
  }
26
25
  };
27
-
28
26
  if (totalPages === 0) {
29
27
  return null;
30
28
  }
31
-
32
29
  if (totalPages === 1 && !showWhenOnePage) {
33
30
  return null;
34
31
  }
35
-
36
32
  if (currentPage > totalPages) {
37
33
  currentPage = totalPages;
38
34
  }
39
-
40
35
  if (!previousLabel || !nextLabel) {
41
36
  previousLabel = /*#__PURE__*/React.createElement("a", {
42
37
  className: "Pagination__previous__icon"
@@ -45,7 +40,6 @@ const Pagination = ({
45
40
  className: "Pagination__next__icon"
46
41
  });
47
42
  }
48
-
49
43
  const containerClasses = c('Pagination__container', containerClassName);
50
44
  const breakClasses = c('Pagination__break', breakClassName);
51
45
  const disabledClasses = c('disabled', disabledClassName);
@@ -67,7 +61,6 @@ const Pagination = ({
67
61
  activeClassName: activeClasses
68
62
  }));
69
63
  };
70
-
71
64
  Pagination.propTypes = {
72
65
  currentPage: PropTypes.number.isRequired,
73
66
  totalPages: PropTypes.number.isRequired,
@@ -2,11 +2,9 @@ import React from 'react';
2
2
  import { useSearchkit } from '@searchkit/client';
3
3
  import Button from '../../../Button';
4
4
  import classNames from 'classnames';
5
-
6
5
  const makeSafeForCSS = value => {
7
6
  return encodeURIComponent(value).replace(/\.|%[0-9a-z]{2}/gi, '');
8
7
  };
9
-
10
8
  export const ChipFacet = ({
11
9
  facet
12
10
  }) => {
@@ -1,7 +1,6 @@
1
1
  import React, { Fragment, useRef } from 'react';
2
2
  import { EuiFacetGroup, EuiTitle, EuiFacetButton } from '@elastic/eui';
3
3
  import { useSearchkit, FilterLink } from '@searchkit/client';
4
-
5
4
  const EntriesList = ({
6
5
  entries,
7
6
  loading,
@@ -48,7 +47,6 @@ const EntriesList = ({
48
47
  });
49
48
  return /*#__PURE__*/React.createElement(EuiFacetGroup, null, entriesElements);
50
49
  };
51
-
52
50
  export const HierarchicalFilterFacet = ({
53
51
  facet,
54
52
  loading
@@ -1,7 +1,6 @@
1
1
  import React, { Fragment, useRef } from 'react';
2
2
  import { EuiFacetGroup, EuiTitle, EuiFacetButton } from '@elastic/eui';
3
3
  import { useSearchkit, FilterLink } from '@searchkit/client';
4
-
5
4
  const EntriesList = ({
6
5
  entries,
7
6
  loading,
@@ -48,7 +47,6 @@ const EntriesList = ({
48
47
  });
49
48
  return /*#__PURE__*/React.createElement(EuiFacetGroup, null, entriesElements);
50
49
  };
51
-
52
50
  export const HierarchicalMenuFacet = ({
53
51
  facet,
54
52
  loading
@@ -4,20 +4,16 @@ import Select from '../../../Form/Select';
4
4
  import FormikWrapper from '../../../Form/FormikWrapper';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import classNames from 'classnames';
7
-
8
7
  const useInitialValues = () => {
9
8
  const parsed = useSearchkitVariables();
10
9
  const filters = {};
11
-
12
10
  if (parsed.filters) {
13
11
  parsed.filters.forEach(filter => {
14
12
  filters[filter.identifier] = filter.value;
15
13
  });
16
14
  }
17
-
18
15
  return filters;
19
16
  };
20
-
21
17
  export const SelectFacet = ({
22
18
  facet
23
19
  }) => {
@@ -49,14 +45,12 @@ export const SelectFacet = ({
49
45
  api.setPage({
50
46
  from: 0
51
47
  });
52
-
53
48
  if (value) {
54
49
  api.addFilter({
55
50
  identifier: facet.identifier,
56
51
  value: value
57
52
  });
58
53
  }
59
-
60
54
  api.search();
61
55
  }
62
56
  })));
@@ -2,7 +2,6 @@ import React, { useMemo, useState, useEffect } from 'react';
2
2
  import { gql, useQuery } from '@apollo/client';
3
3
  import { useSearchkitVariables } from '@searchkit/client';
4
4
  import SearchPage from '../SearchPage';
5
-
6
5
  function Query({
7
6
  query,
8
7
  useRouting,
@@ -21,21 +20,19 @@ function Query({
21
20
  loading
22
21
  } = useQuery(graphQuery, {
23
22
  variables
24
- }); // In between searches, Searchkit will empty it's results, resulting
25
- // in a re-render with an empty screen. Use a local state to prevent this.
23
+ });
26
24
 
25
+ // In between searches, Searchkit will empty it's results, resulting
26
+ // in a re-render with an empty screen. Use a local state to prevent this.
27
27
  const [dataLoaded, setDataLoaded] = useState(null);
28
28
  useEffect(() => {
29
29
  if (data) {
30
30
  setDataLoaded(data);
31
31
  }
32
32
  }, [data]);
33
-
34
33
  if (!useRouting) {
35
34
  return /*#__PURE__*/React.createElement("div", null, children(dataLoaded, loading));
36
35
  }
37
-
38
36
  return /*#__PURE__*/React.createElement(SearchPage, null, children(dataLoaded, loading));
39
37
  }
40
-
41
38
  export default Query;
@@ -4,7 +4,6 @@ import { ListFacet } from '../Facets/ListFacet';
4
4
  import { ChipFacet } from '../Facets/ChipFacet';
5
5
  import { HierarchicalFilterFacet } from '../Facets/HierarchicalFilterFacet';
6
6
  import { HierarchicalMenuFacet } from '../Facets/HierarchicalMenuFacet';
7
-
8
7
  const FacetList = (components = []) => {
9
8
  const FacetsMapper = [HierarchicalFilterFacet, HierarchicalMenuFacet, SelectFacet, ChipFacet, ListFacet, ...components].reduce((sum, component) => {
10
9
  sum[component.DISPLAY] = component;
@@ -18,11 +17,9 @@ const FacetList = (components = []) => {
18
17
  className: "SearchFacets"
19
18
  }, data && data.facets && data.facets.map(facet => {
20
19
  const Facet = FacetsMapper[facet.display];
21
-
22
20
  if (!Facet) {
23
21
  throw new Error(facet.display + ' not available');
24
22
  }
25
-
26
23
  return /*#__PURE__*/React.createElement(Facet, {
27
24
  facet: facet,
28
25
  loading: loading
@@ -30,18 +27,15 @@ const FacetList = (components = []) => {
30
27
  }));
31
28
  };
32
29
  };
33
-
34
30
  const SearchFacets = ({
35
31
  data,
36
32
  loading,
37
33
  facets
38
34
  }) => {
39
35
  const Facets = FacetList(facets);
40
-
41
36
  if (!data) {
42
37
  return null;
43
38
  }
44
-
45
39
  return /*#__PURE__*/React.createElement("div", {
46
40
  className: "SearchFacets"
47
41
  }, /*#__PURE__*/React.createElement(Facets, {
@@ -49,7 +43,6 @@ const SearchFacets = ({
49
43
  loading: loading
50
44
  }));
51
45
  };
52
-
53
46
  SearchFacets.defaultProps = {
54
47
  data: null,
55
48
  loading: false,