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

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 (118) hide show
  1. package/dist/Context/withMapping.js +1 -6
  2. package/dist/components/AbbreviationAnnotation/index.js +47 -0
  3. package/dist/components/AbbreviationAnnotation/stories.js +23 -0
  4. package/dist/components/AbbreviationAnnotation/stories.scss +39 -0
  5. package/dist/components/AbbreviationAnnotation/style.scss +33 -0
  6. package/dist/components/Accordion/AccordionItem/index.js +0 -5
  7. package/dist/components/Accordion/AccordionItemVariant/index.js +0 -5
  8. package/dist/components/Accordion/index.js +0 -2
  9. package/dist/components/ApiAutocomplete/index.js +6 -12
  10. package/dist/components/Button/index.js +4 -10
  11. package/dist/components/Cookie/Checkbox/index.js +0 -2
  12. package/dist/components/Cookie/index.js +39 -34
  13. package/dist/components/FontSizeSwitcher/index.js +2 -8
  14. package/dist/components/Form/Checkbox/index.js +1 -4
  15. package/dist/components/Form/Checkbox/stories.js +0 -2
  16. package/dist/components/Form/Checkboxes/index.js +1 -7
  17. package/dist/components/Form/Checkboxes/index.test.js +8 -4
  18. package/dist/components/Form/Checkboxes/stories.js +1 -4
  19. package/dist/components/Form/Date/index.js +1 -4
  20. package/dist/components/Form/Date/stories.js +0 -2
  21. package/dist/components/Form/DatePicker/index.js +0 -2
  22. package/dist/components/Form/DatePicker/stories.js +0 -2
  23. package/dist/components/Form/DateSelect/index.js +110 -85
  24. package/dist/components/Form/DateSelect/stories.js +24 -15
  25. package/dist/components/Form/DateSelect/style.scss +10 -4
  26. package/dist/components/Form/Email/index.js +1 -4
  27. package/dist/components/Form/Email/stories.js +0 -2
  28. package/dist/components/Form/FormikWrapper/index.js +9 -15
  29. package/dist/components/Form/GenericFormElement/index.js +0 -2
  30. package/dist/components/Form/Number/index.js +12 -13
  31. package/dist/components/Form/Number/stories.js +0 -2
  32. package/dist/components/Form/RadioButtons/index.js +1 -7
  33. package/dist/components/Form/RadioButtons/index.test.js +8 -4
  34. package/dist/components/Form/RadioButtons/stories.js +1 -4
  35. package/dist/components/Form/SearchField/index.js +0 -2
  36. package/dist/components/Form/Select/Input/index.js +6 -14
  37. package/dist/components/Form/Select/index.js +1 -4
  38. package/dist/components/Form/Select/stories.js +0 -4
  39. package/dist/components/Form/TextField/index.js +0 -6
  40. package/dist/components/Form/TextField/index.test.js +8 -4
  41. package/dist/components/Form/TextField/stories.js +1 -4
  42. package/dist/components/Form/Textarea/index.js +0 -2
  43. package/dist/components/Form/Textarea/stories.js +0 -2
  44. package/dist/components/Hamburger/index.js +0 -2
  45. package/dist/components/Header/index.js +4 -9
  46. package/dist/components/Image/Background/index.js +1 -7
  47. package/dist/components/Image/LazyLoadWrapper/index.js +0 -12
  48. package/dist/components/Image/Picture/index.js +4 -19
  49. package/dist/components/Image/index.js +0 -4
  50. package/dist/components/InlineMenu/index.js +0 -9
  51. package/dist/components/Layout/Container/index.js +1 -4
  52. package/dist/components/Layout/Container/stories.js +0 -3
  53. package/dist/components/Layout/QuickLayout/Auto/index.js +0 -2
  54. package/dist/components/Layout/QuickLayout/Center/index.js +0 -2
  55. package/dist/components/Layout/QuickLayout/Clamp/index.js +0 -2
  56. package/dist/components/Layout/QuickLayout/Sidebar/index.js +0 -2
  57. package/dist/components/Layout/QuickLayout/SpaceBetween/index.js +0 -2
  58. package/dist/components/Layout/QuickLayout/Stack/index.js +1 -4
  59. package/dist/components/Layout/QuickLayout/Wrap/index.js +0 -2
  60. package/dist/components/Layout/QuickLayout/index.js +0 -9
  61. package/dist/components/Lottie/LottieAnimation/index.js +12 -17
  62. package/dist/components/Lottie/LottieAnimationWithMousePosition.js +8 -9
  63. package/dist/components/Lottie/index.js +3 -3
  64. package/dist/components/Lottie/stories.js +10 -5
  65. package/dist/components/MagicLine/index.js +0 -14
  66. package/dist/components/MagicLine/stories.js +0 -2
  67. package/dist/components/NavigationScroll/index.js +2 -12
  68. package/dist/components/Pagination/index.js +0 -7
  69. package/dist/components/SearchKit/Facets/ChipFacet/index.js +0 -2
  70. package/dist/components/SearchKit/Facets/HierarchicalFilterFacet/index.js +0 -2
  71. package/dist/components/SearchKit/Facets/HierarchicalMenuFacet/index.js +0 -2
  72. package/dist/components/SearchKit/Facets/SelectFacet/index.js +0 -6
  73. package/dist/components/SearchKit/Query/index.js +3 -6
  74. package/dist/components/SearchKit/SearchFacets/index.js +0 -7
  75. package/dist/components/SearchKit/SearchField/index.js +0 -9
  76. package/dist/components/SearchKit/SearchLoadMore/index.js +0 -7
  77. package/dist/components/SearchKit/SearchPage/index.js +3 -9
  78. package/dist/components/SearchKit/SearchPagination/index.js +0 -5
  79. package/dist/components/SearchKit/SearchReset/index.js +0 -2
  80. package/dist/components/SearchKit/SearchResults/index.js +9 -16
  81. package/dist/components/SearchKit/SearchSelectedFilters/index.js +0 -4
  82. package/dist/components/SearchKit/SearchSorting/index.js +2 -4
  83. package/dist/components/SearchKit/index.js +0 -3
  84. package/dist/components/SearchKit/stories.js +2 -7
  85. package/dist/components/Share/index.js +0 -3
  86. package/dist/components/Sliders/SliderRelated/index.js +1 -6
  87. package/dist/components/Sliders/SliderRelated/stories.js +1 -4
  88. package/dist/components/Webform/WebformActions/index.js +0 -2
  89. package/dist/components/Webform/WebformCheckbox/index.js +1 -8
  90. package/dist/components/Webform/WebformCheckboxes/index.js +1 -9
  91. package/dist/components/Webform/WebformContainer/index.js +5 -6
  92. package/dist/components/Webform/WebformDate/index.js +12 -18
  93. package/dist/components/Webform/WebformMapper/index.js +1 -18
  94. package/dist/components/Webform/WebformNumber/index.js +1 -4
  95. package/dist/components/Webform/WebformRadioButtons/index.js +1 -9
  96. package/dist/components/Webform/WebformSelect/index.js +1 -9
  97. package/dist/components/Webform/WebformTextField/index.js +1 -8
  98. package/dist/components/Webform/WebformTextarea/index.js +1 -8
  99. package/dist/components/Webform/WebformWizardPage/index.js +6 -8
  100. package/dist/components/Webform/index.js +1 -8
  101. package/dist/components/Webform/withStates.js +6 -19
  102. package/dist/components/WysiwygField/index.js +1 -8
  103. package/dist/components/WysiwygField/stories.js +4 -14
  104. package/dist/config/constants.js +3 -4
  105. package/dist/config/i18next/index.js +23 -0
  106. package/dist/config/i18next/locales/en.json +22 -0
  107. package/dist/config/i18next/locales/nl.json +22 -0
  108. package/dist/helpers/gtm.js +11 -15
  109. package/dist/helpers/link.js +0 -4
  110. package/dist/helpers/useValueForCurrentViewPort.js +20 -14
  111. package/dist/hooks/useOnScreen.js +2 -2
  112. package/dist/hooks/usePrevious.js +3 -2
  113. package/dist/hooks/useScrollPosition.js +0 -3
  114. package/dist/hooks/useWindowDimensions.js +0 -3
  115. package/dist/index.js +2 -1
  116. package/dist/styles/assets/_base.scss +0 -1
  117. package/package.json +14 -5
  118. package/dist/pages/api/graphql.js +0 -25
@@ -1,12 +1,10 @@
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 Immutable from 'immutable';
5
4
  import path from 'path';
6
5
  import mimeTypes from './data/ext-to-mime-types.json';
7
6
  import './style.scss';
8
7
  const FALLBACK_MIME_TYPE = 'image/jpg';
9
-
10
8
  const Picture = ({
11
9
  src,
12
10
  className,
@@ -29,26 +27,21 @@ const Picture = ({
29
27
  alt,
30
28
  title
31
29
  };
32
-
33
30
  const getImageExtension = url => {
34
31
  const sanitizedUrl = url.replace(/\?.*/, '');
35
32
  return path.extname(sanitizedUrl).toLowerCase();
36
33
  };
37
-
38
34
  const getMimeType = url => {
39
35
  const extension = getImageExtension(url);
40
36
  return mimeTypes[extension] ? mimeTypes[extension] : FALLBACK_MIME_TYPE;
41
37
  };
42
-
43
38
  const isValidImage = url => {
44
39
  if (!url) {
45
40
  return false;
46
41
  }
47
-
48
42
  const extension = getImageExtension(url);
49
43
  return Object.keys(mimeTypes).includes(extension);
50
44
  };
51
-
52
45
  if (Immutable.Iterable.isIterable(Immutable.fromJS(src))) {
53
46
  // Sources have to be defined in a descending order.
54
47
  // We sort them from best to worst quality.
@@ -61,20 +54,17 @@ const Picture = ({
61
54
  if (image !== false) {
62
55
  return image;
63
56
  }
64
-
65
57
  ;
66
58
  return null;
67
- }); // Only render if all our image sources are valid
59
+ });
68
60
 
61
+ // Only render if all our image sources are valid
69
62
  const hasValidSources = sources.count() > 0;
70
-
71
63
  if (!hasValidSources) {
72
64
  return null;
73
65
  }
74
-
75
66
  const fallback = sources.valueSeq().first();
76
67
  let renderedSourcesWebP = [];
77
-
78
68
  if (includeWebP) {
79
69
  /* eslint-disable react/no-array-index-key */
80
70
  renderedSourcesWebP = sources.map((url, breakpoint) => {
@@ -87,9 +77,8 @@ const Picture = ({
87
77
  });
88
78
  }).valueSeq();
89
79
  }
90
- /* eslint-disable react/no-array-index-key */
91
-
92
80
 
81
+ /* eslint-disable react/no-array-index-key */
93
82
  const renderedSources = sources.map((url, breakpoint) => /*#__PURE__*/React.createElement("source", {
94
83
  key: breakpoint,
95
84
  srcSet: url,
@@ -103,7 +92,6 @@ const Picture = ({
103
92
  src: fallback
104
93
  })));
105
94
  }
106
-
107
95
  if (src && isValidImage(src)) {
108
96
  if (includeWebP) {
109
97
  const webpUrl = src.replace(/\.(png|gif|jp(e?)g)/, '.webp');
@@ -120,17 +108,14 @@ const Picture = ({
120
108
  src: src
121
109
  })));
122
110
  }
123
-
124
111
  return /*#__PURE__*/React.createElement("img", _extends({}, attrs, {
125
112
  onLoad: e => onLoad(e),
126
113
  ref: imageRef,
127
114
  src: src
128
115
  }));
129
116
  }
130
-
131
117
  return null;
132
118
  };
133
-
134
119
  Picture.defaultProps = {
135
120
  onLoad: () => {}
136
121
  };
@@ -3,21 +3,17 @@ import PropTypes from 'prop-types';
3
3
  import ImmutablePropTypes from 'react-immutable-proptypes';
4
4
  import LazyLoadWrapper from './LazyLoadWrapper';
5
5
  import Picture from './Picture';
6
-
7
6
  const Image = props => {
8
7
  const {
9
8
  lazyload
10
9
  } = props;
11
-
12
10
  if (lazyload) {
13
11
  return /*#__PURE__*/React.createElement(LazyLoadWrapper, {
14
12
  lazyload: lazyload
15
13
  }, /*#__PURE__*/React.createElement(Picture, props));
16
14
  }
17
-
18
15
  return /*#__PURE__*/React.createElement(Picture, props);
19
16
  };
20
-
21
17
  Image.propTypes = {
22
18
  src: PropTypes.oneOfType([PropTypes.string, ImmutablePropTypes.map]).isRequired,
23
19
  lazyload: PropTypes.bool
@@ -1,18 +1,15 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import './style.scss';
4
-
5
4
  const InlineMenu = ({
6
5
  items,
7
6
  scrollToTopOffset
8
7
  }) => {
9
8
  const [scrollPosition, setSrollPosition] = useState(0);
10
-
11
9
  const handleScroll = () => {
12
10
  const position = window.pageYOffset;
13
11
  setSrollPosition(position);
14
12
  };
15
-
16
13
  useEffect(() => {
17
14
  window.addEventListener('scroll', handleScroll);
18
15
  return () => {
@@ -20,7 +17,6 @@ const InlineMenu = ({
20
17
  };
21
18
  }, []);
22
19
  if (!items) return null;
23
-
24
20
  const offset = el => {
25
21
  const rect = el.getBoundingClientRect();
26
22
  const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
@@ -30,7 +26,6 @@ const InlineMenu = ({
30
26
  left: rect.left + scrollLeft
31
27
  };
32
28
  };
33
-
34
29
  const handleClick = id => {
35
30
  const element = document.getElementById(id);
36
31
  if (!element) return null;
@@ -39,20 +34,17 @@ const InlineMenu = ({
39
34
  behavior: "smooth"
40
35
  });
41
36
  };
42
-
43
37
  const handleActiveState = (currentId, nextId, activeByDefault) => {
44
38
  const element = document.getElementById(currentId);
45
39
  const nextElement = document.getElementById(nextId);
46
40
  if (!element && activeByDefault) return true;
47
41
  if (!element) return null;
48
-
49
42
  if (!nextElement) {
50
43
  return scrollPosition > offset(element).top - (scrollToTopOffset + 10);
51
44
  } else {
52
45
  return (scrollPosition > offset(element).top - (scrollToTopOffset + 10) || activeByDefault) && scrollPosition < offset(nextElement).top - (scrollToTopOffset + 10);
53
46
  }
54
47
  };
55
-
56
48
  return /*#__PURE__*/React.createElement("nav", {
57
49
  className: "InlineMenu"
58
50
  }, /*#__PURE__*/React.createElement("ul", {
@@ -67,7 +59,6 @@ const InlineMenu = ({
67
59
  key: elementId
68
60
  }, menuItemName || 'missing menuItemName'))));
69
61
  };
70
-
71
62
  InlineMenu.defaultProps = {
72
63
  items: [],
73
64
  scrollToTopOffset: 0,
@@ -1,10 +1,8 @@
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
4
  import classNames from 'classnames';
6
5
  import './style.scss';
7
-
8
6
  const Container = ({
9
7
  className,
10
8
  fluid,
@@ -27,7 +25,6 @@ const Container = ({
27
25
  className: classes
28
26
  }, props), children);
29
27
  };
30
-
31
28
  Container.defaultProps = {
32
29
  small: false,
33
30
  large: false,
@@ -4,11 +4,9 @@ import './stories.scss';
4
4
  export default {
5
5
  title: 'Templates/Grid'
6
6
  };
7
-
8
7
  const Filler = () => /*#__PURE__*/React.createElement("div", {
9
8
  className: "Filler"
10
9
  });
11
-
12
10
  const Columns = () => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
13
11
  className: "row"
14
12
  }, /*#__PURE__*/React.createElement("div", {
@@ -78,7 +76,6 @@ const Columns = () => /*#__PURE__*/React.createElement(React.Fragment, null, /*#
78
76
  }, /*#__PURE__*/React.createElement(Filler, null)), /*#__PURE__*/React.createElement("div", {
79
77
  class: "col-1"
80
78
  }, /*#__PURE__*/React.createElement(Filler, null))));
81
-
82
79
  export const Default = () => /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Columns, null));
83
80
  export const Small = () => /*#__PURE__*/React.createElement(Container, {
84
81
  small: true
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import c from 'classnames';
3
-
4
3
  const QuickLayoutAuto = ({
5
4
  children,
6
5
  min,
@@ -17,7 +16,6 @@ const QuickLayoutAuto = ({
17
16
  }
18
17
  }, children);
19
18
  };
20
-
21
19
  QuickLayoutAuto.defaultProps = {
22
20
  min: '150px',
23
21
  gap: '1rem'
@@ -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 QuickLayoutCentered = ({
6
5
  children,
7
6
  className
@@ -11,5 +10,4 @@ const QuickLayoutCentered = ({
11
10
  className: classes
12
11
  }, children);
13
12
  };
14
-
15
13
  export default QuickLayoutCentered;
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import c from 'classnames';
3
-
4
3
  const QuickLayoutClamp = ({
5
4
  children,
6
5
  min,
@@ -16,7 +15,6 @@ const QuickLayoutClamp = ({
16
15
  }
17
16
  }, children);
18
17
  };
19
-
20
18
  QuickLayoutClamp.defaultProps = {
21
19
  min: '1rem',
22
20
  value: '2.5vw',
@@ -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
  });