@uncinc/uncinc-react-kitchen-sink 2.4.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/dist/Context/KitchenSinkComponentMapperContext.js +11 -3
  2. package/dist/Context/ViewportContext.js +27 -14
  3. package/dist/Context/withMapping.js +26 -15
  4. package/dist/components/AbbreviationAnnotation/index.js +49 -27
  5. package/dist/components/AbbreviationAnnotation/stories.js +32 -21
  6. package/dist/components/Accordion/AccordionItem/index.js +55 -36
  7. package/dist/components/Accordion/AccordionItemVariant/index.js +47 -25
  8. package/dist/components/Accordion/index.js +17 -10
  9. package/dist/components/Accordion/stories.js +38 -24
  10. package/dist/components/ApiAutocomplete/index.js +79 -51
  11. package/dist/components/ApiAutocomplete/stories.js +18 -9
  12. package/dist/components/Button/index.js +43 -33
  13. package/dist/components/Button/stories.js +52 -30
  14. package/dist/components/Cookie/Checkbox/index.js +23 -16
  15. package/dist/components/Cookie/index.js +146 -115
  16. package/dist/components/Cookie/stories.js +57 -39
  17. package/dist/components/Dialog/index.d.ts +38 -0
  18. package/dist/components/Dialog/index.js +63 -56
  19. package/dist/components/Dialog/stories.js +31 -17
  20. package/dist/components/FontSizeSwitcher/index.js +58 -32
  21. package/dist/components/FontSizeSwitcher/stories.js +23 -9
  22. package/dist/components/Form/Checkbox/index.js +43 -37
  23. package/dist/components/Form/Checkbox/stories.js +20 -11
  24. package/dist/components/Form/Checkboxes/index.js +62 -57
  25. package/dist/components/Form/Checkboxes/index.test.js +113 -62
  26. package/dist/components/Form/Checkboxes/stories.js +23 -12
  27. package/dist/components/Form/Date/index.js +13 -5
  28. package/dist/components/Form/Date/stories.js +18 -9
  29. package/dist/components/Form/DatePicker/index.js +39 -33
  30. package/dist/components/Form/DatePicker/stories.js +18 -9
  31. package/dist/components/Form/DateSelect/index.js +99 -62
  32. package/dist/components/Form/DateSelect/stories.js +32 -11
  33. package/dist/components/Form/Email/index.js +13 -5
  34. package/dist/components/Form/Email/stories.js +18 -9
  35. package/dist/components/Form/FormikWrapper/index.js +52 -45
  36. package/dist/components/Form/GenericFormElement/index.js +39 -34
  37. package/dist/components/Form/Number/index.js +23 -18
  38. package/dist/components/Form/Number/stories.js +18 -9
  39. package/dist/components/Form/RadioButtons/index.js +53 -49
  40. package/dist/components/Form/RadioButtons/index.test.js +106 -57
  41. package/dist/components/Form/RadioButtons/stories.js +23 -12
  42. package/dist/components/Form/SearchField/index.js +37 -30
  43. package/dist/components/Form/Select/Input/index.js +55 -49
  44. package/dist/components/Form/Select/index.js +32 -24
  45. package/dist/components/Form/Select/stories.js +25 -15
  46. package/dist/components/Form/TextField/index.js +38 -33
  47. package/dist/components/Form/TextField/index.test.js +104 -56
  48. package/dist/components/Form/TextField/stories.js +22 -11
  49. package/dist/components/Form/Textarea/index.js +34 -27
  50. package/dist/components/Form/Textarea/stories.js +18 -9
  51. package/dist/components/Hamburger/index.js +30 -19
  52. package/dist/components/Hamburger/stories.js +42 -16
  53. package/dist/components/Header/index.js +67 -39
  54. package/dist/components/Header/stories.js +48 -28
  55. package/dist/components/Image/Background/index.js +36 -21
  56. package/dist/components/Image/LazyLoadWrapper/index.js +101 -64
  57. package/dist/components/Image/Picture/index.js +83 -65
  58. package/dist/components/Image/index.js +21 -15
  59. package/dist/components/Image/stories.js +87 -64
  60. package/dist/components/InlineMenu/index.js +60 -38
  61. package/dist/components/InlineMenu/stories.js +66 -55
  62. package/dist/components/Layout/Container/index.js +29 -21
  63. package/dist/components/Layout/Container/stories.js +104 -83
  64. package/dist/components/Layout/QuickLayout/Auto/index.js +19 -12
  65. package/dist/components/Layout/QuickLayout/Center/index.js +17 -10
  66. package/dist/components/Layout/QuickLayout/Clamp/index.js +20 -13
  67. package/dist/components/Layout/QuickLayout/Sidebar/index.js +20 -13
  68. package/dist/components/Layout/QuickLayout/SpaceBetween/index.js +20 -13
  69. package/dist/components/Layout/QuickLayout/Stack/index.js +21 -11
  70. package/dist/components/Layout/QuickLayout/Wrap/index.js +21 -14
  71. package/dist/components/Layout/QuickLayout/index.js +31 -21
  72. package/dist/components/Layout/QuickLayout/stories.js +102 -70
  73. package/dist/components/Lottie/LottieAnimation/index.js +55 -56
  74. package/dist/components/Lottie/LottieAnimationWithMousePosition.js +31 -18
  75. package/dist/components/Lottie/index.js +47 -35
  76. package/dist/components/Lottie/stories.js +54 -31
  77. package/dist/components/MagicLine/index.js +50 -27
  78. package/dist/components/MagicLine/stories.js +60 -46
  79. package/dist/components/NavigationScroll/index.js +71 -49
  80. package/dist/components/NavigationScroll/stories.js +19 -8
  81. package/dist/components/Pagination/index.js +48 -41
  82. package/dist/components/Pagination/stories.js +51 -28
  83. package/dist/components/SearchKit/Facets/ChipFacet/index.js +24 -16
  84. package/dist/components/SearchKit/Facets/ListFacet/index.js +23 -15
  85. package/dist/components/SearchKit/Facets/SelectFacet/index.js +39 -30
  86. package/dist/components/SearchKit/Query/index.js +41 -23
  87. package/dist/components/SearchKit/SearchFacets/index.js +36 -23
  88. package/dist/components/SearchKit/SearchField/index.js +49 -25
  89. package/dist/components/SearchKit/SearchLoadMore/index.js +22 -15
  90. package/dist/components/SearchKit/SearchPage/index.js +22 -14
  91. package/dist/components/SearchKit/SearchPagination/index.js +17 -10
  92. package/dist/components/SearchKit/SearchReset/index.js +25 -16
  93. package/dist/components/SearchKit/SearchResults/index.js +108 -59
  94. package/dist/components/SearchKit/SearchSelectedFilters/Filters/CustomValue/index.js +17 -10
  95. package/dist/components/SearchKit/SearchSelectedFilters/Filters/DateRange/index.js +18 -11
  96. package/dist/components/SearchKit/SearchSelectedFilters/Filters/NumericRange/index.js +18 -11
  97. package/dist/components/SearchKit/SearchSelectedFilters/Filters/Value/index.js +22 -12
  98. package/dist/components/SearchKit/SearchSelectedFilters/index.js +34 -28
  99. package/dist/components/SearchKit/SearchSorting/index.js +29 -19
  100. package/dist/components/SearchKit/index.js +72 -53
  101. package/dist/components/SearchKit/stories.js +141 -186
  102. package/dist/components/Share/index.js +48 -40
  103. package/dist/components/Share/stories.js +16 -5
  104. package/dist/components/Sliders/SliderRelated/index.js +32 -25
  105. package/dist/components/Sliders/SliderRelated/stories.js +75 -57
  106. package/dist/components/Webform/WebformActions/index.js +19 -13
  107. package/dist/components/Webform/WebformCheckbox/index.js +32 -24
  108. package/dist/components/Webform/WebformCheckboxes/index.js +37 -29
  109. package/dist/components/Webform/WebformContainer/index.js +17 -11
  110. package/dist/components/Webform/WebformDate/index.js +76 -48
  111. package/dist/components/Webform/WebformMapper/index.js +53 -38
  112. package/dist/components/Webform/WebformNumber/index.js +31 -22
  113. package/dist/components/Webform/WebformRadioButtons/index.js +37 -29
  114. package/dist/components/Webform/WebformSelect/index.js +37 -29
  115. package/dist/components/Webform/WebformTextField/index.js +34 -26
  116. package/dist/components/Webform/WebformTextarea/index.js +32 -24
  117. package/dist/components/Webform/WebformWizardPage/index.js +56 -43
  118. package/dist/components/Webform/index.js +42 -20
  119. package/dist/components/Webform/stories.actions.js +19 -8
  120. package/dist/components/Webform/stories.checkboxes.js +19 -8
  121. package/dist/components/Webform/stories.checked.js +20 -9
  122. package/dist/components/Webform/stories.container.js +19 -8
  123. package/dist/components/Webform/stories.date.js +19 -8
  124. package/dist/components/Webform/stories.filled.js +20 -9
  125. package/dist/components/Webform/stories.number.js +19 -8
  126. package/dist/components/Webform/stories.radiobuttons.js +19 -8
  127. package/dist/components/Webform/stories.select.js +19 -8
  128. package/dist/components/Webform/stories.textarea.js +19 -8
  129. package/dist/components/Webform/stories.textfield.js +19 -8
  130. package/dist/components/Webform/stories.wizard.js +19 -8
  131. package/dist/components/Webform/withStates.js +49 -28
  132. package/dist/components/WysiwygField/index.js +30 -20
  133. package/dist/components/WysiwygField/stories.js +39 -29
  134. package/dist/components/index.js +111 -15
  135. package/dist/config/constants.js +38 -18
  136. package/dist/config/i18next/index.js +19 -11
  137. package/dist/helpers/date.js +13 -5
  138. package/dist/helpers/gtm.js +27 -17
  139. package/dist/helpers/link.js +15 -6
  140. package/dist/helpers/useValueForCurrentViewPort.js +27 -10
  141. package/dist/hooks/useBoolean.d.ts +8 -0
  142. package/dist/hooks/useBoolean.js +38 -0
  143. package/dist/hooks/useClickOutside.d.ts +8 -0
  144. package/dist/hooks/useClickOutside.js +35 -0
  145. package/dist/hooks/useDialog.d.ts +10 -0
  146. package/dist/hooks/useDialog.js +39 -0
  147. package/dist/hooks/useDialogHelpers.d.ts +20 -0
  148. package/dist/hooks/{useDialogHelpers.ts → useDialogHelpers.js} +33 -43
  149. package/dist/hooks/useEscape.d.ts +6 -0
  150. package/dist/hooks/useEscape.js +24 -0
  151. package/dist/hooks/useOnScreen.js +27 -6
  152. package/dist/hooks/usePrevious.js +10 -4
  153. package/dist/hooks/useScrollPosition.js +25 -7
  154. package/dist/hooks/useTrapFocus.d.ts +10 -0
  155. package/dist/hooks/useTrapFocus.js +63 -0
  156. package/dist/hooks/useWindowDimensions.js +27 -11
  157. package/dist/index.js +398 -56
  158. package/dist/setupTests.js +9 -5
  159. package/package.json +6 -3
  160. package/dist/hooks/useBoolean.ts +0 -20
  161. package/dist/hooks/useClickOutside.ts +0 -38
  162. package/dist/hooks/useDialog.ts +0 -29
  163. package/dist/hooks/useEscape.ts +0 -26
  164. package/dist/hooks/useTrapFocus.ts +0 -80
@@ -1,49 +1,63 @@
1
- import React from 'react';
2
- import c from 'classnames';
3
- import MagicLine from '.';
4
- import './stories.scss';
5
- export default {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.NoActiveItem = exports.Default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _classnames = _interopRequireDefault(require("classnames"));
9
+ var _ = _interopRequireDefault(require("."));
10
+ require("./stories.scss");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ var _default = {
6
13
  title: 'Molecules/MagicLine'
7
14
  };
8
- export const Default = () => /*#__PURE__*/React.createElement(MagicLine, null, (setInitialMagicLine, hoverMagicLine, setActiveItemInNavigation) => {
9
- const items = ['one', 'two with a longer name', 'three'];
10
- return /*#__PURE__*/React.createElement("div", {
11
- className: "Menu"
12
- }, items.map(item => {
13
- const active = item === 'three';
14
- if (active) {
15
- setActiveItemInNavigation(true);
16
- }
17
- const classes = c('Menu__item', {
18
- 'Menu__item--active': active
19
- });
20
- return /*#__PURE__*/React.createElement("div", {
21
- key: item,
22
- className: classes,
23
- onMouseEnter: e => {
24
- hoverMagicLine(e);
25
- },
26
- onMouseLeave: e => {
27
- setInitialMagicLine();
28
- }
29
- }, item);
30
- }));
31
- });
32
- export const NoActiveItem = () => /*#__PURE__*/React.createElement(MagicLine, null, (setInitialMagicLine, hoverMagicLine, setActiveItemInNavigation) => {
33
- const items = ['one', 'two with a longer name', 'three'];
34
- return /*#__PURE__*/React.createElement("div", {
35
- className: "Menu"
36
- }, items.map(item => {
37
- const classes = c('Menu__item');
38
- return /*#__PURE__*/React.createElement("div", {
39
- key: item,
40
- className: classes,
41
- onMouseEnter: e => {
42
- hoverMagicLine(e);
43
- },
44
- onMouseLeave: e => {
45
- setInitialMagicLine();
15
+ exports.default = _default;
16
+ var Default = function Default() {
17
+ return /*#__PURE__*/_react.default.createElement(_.default, null, function (setInitialMagicLine, hoverMagicLine, setActiveItemInNavigation) {
18
+ var items = ['one', 'two with a longer name', 'three'];
19
+ return /*#__PURE__*/_react.default.createElement("div", {
20
+ className: "Menu"
21
+ }, items.map(function (item) {
22
+ var active = item === 'three';
23
+ if (active) {
24
+ setActiveItemInNavigation(true);
46
25
  }
47
- }, item);
48
- }));
49
- });
26
+ var classes = (0, _classnames.default)('Menu__item', {
27
+ 'Menu__item--active': active
28
+ });
29
+ return /*#__PURE__*/_react.default.createElement("div", {
30
+ key: item,
31
+ className: classes,
32
+ onMouseEnter: function onMouseEnter(e) {
33
+ hoverMagicLine(e);
34
+ },
35
+ onMouseLeave: function onMouseLeave(e) {
36
+ setInitialMagicLine();
37
+ }
38
+ }, item);
39
+ }));
40
+ });
41
+ };
42
+ exports.Default = Default;
43
+ var NoActiveItem = function NoActiveItem() {
44
+ return /*#__PURE__*/_react.default.createElement(_.default, null, function (setInitialMagicLine, hoverMagicLine, setActiveItemInNavigation) {
45
+ var items = ['one', 'two with a longer name', 'three'];
46
+ return /*#__PURE__*/_react.default.createElement("div", {
47
+ className: "Menu"
48
+ }, items.map(function (item) {
49
+ var classes = (0, _classnames.default)('Menu__item');
50
+ return /*#__PURE__*/_react.default.createElement("div", {
51
+ key: item,
52
+ className: classes,
53
+ onMouseEnter: function onMouseEnter(e) {
54
+ hoverMagicLine(e);
55
+ },
56
+ onMouseLeave: function onMouseLeave(e) {
57
+ setInitialMagicLine();
58
+ }
59
+ }, item);
60
+ }));
61
+ });
62
+ };
63
+ exports.NoActiveItem = NoActiveItem;
@@ -1,74 +1,95 @@
1
- import React, { useState, useEffect, useRef } from 'react';
2
- import classNames from 'classnames';
3
- import PropTypes from 'prop-types';
4
- import './style.scss';
5
- const NavigationScroll = props => {
6
- const node = useRef(null);
7
- const [state, setState] = useState({
8
- pos: 0,
9
- reachedBottom: false,
10
- reachedTop: false,
11
- scrolledPastNavHeight: false,
12
- _previousPos: 0
13
- });
14
- const getScrollPos = element => {
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+ require("./style.scss");
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
19
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
20
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
21
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
22
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
23
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
24
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
25
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
+ var NavigationScroll = function NavigationScroll(props) {
27
+ var node = (0, _react.useRef)(null);
28
+ var _useState = (0, _react.useState)({
29
+ pos: 0,
30
+ reachedBottom: false,
31
+ reachedTop: false,
32
+ scrolledPastNavHeight: false,
33
+ _previousPos: 0
34
+ }),
35
+ _useState2 = _slicedToArray(_useState, 2),
36
+ state = _useState2[0],
37
+ setState = _useState2[1];
38
+ var getScrollPos = function getScrollPos(element) {
15
39
  if (typeof element.pageYOffset !== 'undefined') {
16
40
  return element.pageYOffset;
17
41
  }
18
42
  return element.scrollTop;
19
43
  };
20
- const getElementHeight = element => {
21
- let deductHeight = 0;
44
+ var getElementHeight = function getElementHeight(element) {
45
+ var deductHeight = 0;
22
46
  if (document.getElementsByClassName('Header__subMenu').length !== 0) {
23
47
  deductHeight = document.getElementsByClassName('Header__subMenu')[0].clientHeight;
24
48
  }
25
49
  return element.offsetHeight - deductHeight;
26
50
  };
27
- const handleScroll = () => {
28
- const scrollPos = getScrollPos(window);
29
- let elementHeight = getElementHeight(node.current);
30
- let newPos = 0;
51
+ var handleScroll = function handleScroll() {
52
+ var scrollPos = getScrollPos(window);
53
+ var elementHeight = getElementHeight(node.current);
54
+ var newPos = 0;
31
55
  if (scrollPos > 0) {
32
- const diff = state._previousPos - scrollPos;
56
+ var diff = state._previousPos - scrollPos;
33
57
  newPos = state.pos + diff;
34
58
  newPos = Math.max(-elementHeight, Math.min(0, newPos));
35
59
  }
36
- const isVisible = newPos > -elementHeight;
37
- const hasReachedTop = scrollPos < 5 && isVisible;
38
- const hasReachedBottom = Math.round(scrollPos + window.innerHeight) >= document.body.clientHeight;
39
- const scrolledPastNavHeight = scrollPos > elementHeight;
40
- setState(prevState => ({
41
- ...prevState,
42
- pos: hasReachedBottom ? 0 : newPos,
43
- reachedTop: hasReachedTop,
44
- scrolledPastNavHeight,
45
- reachedBottom: hasReachedBottom,
46
- _previousPos: scrollPos
47
- }));
60
+ var isVisible = newPos > -elementHeight;
61
+ var hasReachedTop = scrollPos < 5 && isVisible;
62
+ var hasReachedBottom = Math.round(scrollPos + window.innerHeight) >= document.body.clientHeight;
63
+ var scrolledPastNavHeight = scrollPos > elementHeight;
64
+ setState(function (prevState) {
65
+ return _objectSpread(_objectSpread({}, prevState), {}, {
66
+ pos: hasReachedBottom ? 0 : newPos,
67
+ reachedTop: hasReachedTop,
68
+ scrolledPastNavHeight: scrolledPastNavHeight,
69
+ reachedBottom: hasReachedBottom,
70
+ _previousPos: scrollPos
71
+ });
72
+ });
48
73
  };
49
- useEffect(() => {
74
+ (0, _react.useEffect)(function () {
50
75
  window.addEventListener('scroll', handleScroll);
51
- return () => {
76
+ return function () {
52
77
  window.removeEventListener('scroll', handleScroll);
53
78
  };
54
79
  });
55
- const {
56
- reachedTop,
57
- reachedBottom,
58
- pos,
59
- scrolledPastNavHeight
60
- } = state;
61
- const {
62
- children,
63
- hasBackground
64
- } = props;
65
- const classes = classNames('NavigationScroll', {
80
+ var reachedTop = state.reachedTop,
81
+ reachedBottom = state.reachedBottom,
82
+ pos = state.pos,
83
+ scrolledPastNavHeight = state.scrolledPastNavHeight;
84
+ var children = props.children,
85
+ hasBackground = props.hasBackground;
86
+ var classes = (0, _classnames.default)('NavigationScroll', {
66
87
  'NavigationScroll--hasBackground': hasBackground,
67
88
  's-scrolled-past-nav-height': scrolledPastNavHeight,
68
89
  's-reached-page-top': reachedTop,
69
90
  's-reached-page-bottom': reachedBottom
70
91
  });
71
- return /*#__PURE__*/React.createElement("div", {
92
+ return /*#__PURE__*/_react.default.createElement("div", {
72
93
  ref: node,
73
94
  className: classes,
74
95
  style: {
@@ -77,7 +98,8 @@ const NavigationScroll = props => {
77
98
  }, children);
78
99
  };
79
100
  NavigationScroll.propTypes = {
80
- children: PropTypes.element.isRequired
101
+ children: _propTypes.default.element.isRequired
81
102
  };
82
103
  NavigationScroll.defaultProps = {};
83
- export default NavigationScroll;
104
+ var _default = NavigationScroll;
105
+ exports.default = _default;
@@ -1,10 +1,21 @@
1
- import React from 'react';
2
- import c from 'classnames';
3
- import NavigationScroll from '.';
4
- import './stories.scss';
5
- export default {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.Default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _classnames = _interopRequireDefault(require("classnames"));
9
+ var _ = _interopRequireDefault(require("."));
10
+ require("./stories.scss");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ var _default = {
6
13
  title: 'Molecules/NavigationScroll'
7
14
  };
8
- export const Default = () => /*#__PURE__*/React.createElement("div", {
9
- className: "NavigationScrollExample"
10
- }, /*#__PURE__*/React.createElement(NavigationScroll, null, /*#__PURE__*/React.createElement("nav", null, /*#__PURE__*/React.createElement("div", null, "one"), /*#__PURE__*/React.createElement("div", null, "two"), /*#__PURE__*/React.createElement("div", null, "three"))));
15
+ exports.default = _default;
16
+ var Default = function Default() {
17
+ return /*#__PURE__*/_react.default.createElement("div", {
18
+ className: "NavigationScrollExample"
19
+ }, /*#__PURE__*/_react.default.createElement(_.default, null, /*#__PURE__*/_react.default.createElement("nav", null, /*#__PURE__*/_react.default.createElement("div", null, "one"), /*#__PURE__*/_react.default.createElement("div", null, "two"), /*#__PURE__*/_react.default.createElement("div", null, "three"))));
20
+ };
21
+ exports.Default = Default;
@@ -1,24 +1,30 @@
1
- import React from 'react';
2
- import ReactPaginate from 'react-paginate';
3
- import c from 'classnames';
4
- import './style.scss';
5
- import PropTypes from 'prop-types';
6
- import withMapping from '../../Context/withMapping';
7
- const Pagination = ({
8
- currentPage,
9
- totalPages,
10
- pageRangeDisplayed,
11
- marginPagesDisplayed,
12
- setCurrentPage,
13
- previousLabel,
14
- nextLabel,
15
- containerClassName,
16
- disabledClassName,
17
- activeClassName,
18
- breakClassName,
19
- showWhenOnePage
20
- }) => {
21
- const pageChange = data => {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactPaginate = _interopRequireDefault(require("react-paginate"));
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ require("./style.scss");
11
+ var _propTypes = _interopRequireDefault(require("prop-types"));
12
+ var _withMapping = _interopRequireDefault(require("../../Context/withMapping"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ var Pagination = function Pagination(_ref) {
15
+ var currentPage = _ref.currentPage,
16
+ totalPages = _ref.totalPages,
17
+ pageRangeDisplayed = _ref.pageRangeDisplayed,
18
+ marginPagesDisplayed = _ref.marginPagesDisplayed,
19
+ setCurrentPage = _ref.setCurrentPage,
20
+ previousLabel = _ref.previousLabel,
21
+ nextLabel = _ref.nextLabel,
22
+ containerClassName = _ref.containerClassName,
23
+ disabledClassName = _ref.disabledClassName,
24
+ activeClassName = _ref.activeClassName,
25
+ breakClassName = _ref.breakClassName,
26
+ showWhenOnePage = _ref.showWhenOnePage;
27
+ var pageChange = function pageChange(data) {
22
28
  if (setCurrentPage) {
23
29
  setCurrentPage(data.selected + 1);
24
30
  }
@@ -33,20 +39,20 @@ const Pagination = ({
33
39
  currentPage = totalPages;
34
40
  }
35
41
  if (!previousLabel || !nextLabel) {
36
- previousLabel = /*#__PURE__*/React.createElement("a", {
42
+ previousLabel = /*#__PURE__*/_react.default.createElement("a", {
37
43
  className: "Pagination__previous__icon"
38
44
  });
39
- nextLabel = /*#__PURE__*/React.createElement("a", {
45
+ nextLabel = /*#__PURE__*/_react.default.createElement("a", {
40
46
  className: "Pagination__next__icon"
41
47
  });
42
48
  }
43
- const containerClasses = c('Pagination__container', containerClassName);
44
- const breakClasses = c('Pagination__break', breakClassName);
45
- const disabledClasses = c('disabled', disabledClassName);
46
- const activeClasses = c('active', activeClassName);
47
- return /*#__PURE__*/React.createElement("div", {
49
+ var containerClasses = (0, _classnames.default)('Pagination__container', containerClassName);
50
+ var breakClasses = (0, _classnames.default)('Pagination__break', breakClassName);
51
+ var disabledClasses = (0, _classnames.default)('disabled', disabledClassName);
52
+ var activeClasses = (0, _classnames.default)('active', activeClassName);
53
+ return /*#__PURE__*/_react.default.createElement("div", {
48
54
  className: "Pagination"
49
- }, /*#__PURE__*/React.createElement(ReactPaginate, {
55
+ }, /*#__PURE__*/_react.default.createElement(_reactPaginate.default, {
50
56
  previousLabel: previousLabel,
51
57
  nextLabel: nextLabel,
52
58
  breakLabel: "...",
@@ -62,17 +68,17 @@ const Pagination = ({
62
68
  }));
63
69
  };
64
70
  Pagination.propTypes = {
65
- currentPage: PropTypes.number.isRequired,
66
- totalPages: PropTypes.number.isRequired,
67
- pageRangeDisplayed: PropTypes.number,
68
- marginPagesDisplayed: PropTypes.number,
69
- setCurrentPage: PropTypes.func,
70
- previousLabel: PropTypes.string,
71
- nextLabel: PropTypes.string,
72
- containerClassName: PropTypes.string,
73
- disabledClassName: PropTypes.string,
74
- activeClassName: PropTypes.string,
75
- showWhenOnePage: PropTypes.bool
71
+ currentPage: _propTypes.default.number.isRequired,
72
+ totalPages: _propTypes.default.number.isRequired,
73
+ pageRangeDisplayed: _propTypes.default.number,
74
+ marginPagesDisplayed: _propTypes.default.number,
75
+ setCurrentPage: _propTypes.default.func,
76
+ previousLabel: _propTypes.default.string,
77
+ nextLabel: _propTypes.default.string,
78
+ containerClassName: _propTypes.default.string,
79
+ disabledClassName: _propTypes.default.string,
80
+ activeClassName: _propTypes.default.string,
81
+ showWhenOnePage: _propTypes.default.bool
76
82
  };
77
83
  Pagination.defaultProps = {
78
84
  setCurrentPage: null,
@@ -85,4 +91,5 @@ Pagination.defaultProps = {
85
91
  marginPagesDisplayed: 1,
86
92
  showWhenOnePage: false
87
93
  };
88
- export default withMapping(Pagination);
94
+ var _default = (0, _withMapping.default)(Pagination);
95
+ exports.default = _default;
@@ -1,30 +1,53 @@
1
- import React from 'react';
2
- import Pagination from '.';
3
- import './stories.scss';
4
- export default {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.TextualButtons = exports.ManyPages = exports.LargePageRange = exports.FewPages = exports.Default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _ = _interopRequireDefault(require("."));
9
+ require("./stories.scss");
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ var _default = {
5
12
  title: 'Molecules/Pagination'
6
13
  };
7
- export const Default = () => /*#__PURE__*/React.createElement(Pagination, {
8
- currentPage: 1,
9
- totalPages: 10
10
- });
11
- export const FewPages = () => /*#__PURE__*/React.createElement(Pagination, {
12
- currentPage: 2,
13
- totalPages: 4
14
- });
15
- export const ManyPages = () => /*#__PURE__*/React.createElement(Pagination, {
16
- currentPage: 4000,
17
- totalPages: 9001
18
- });
19
- export const LargePageRange = () => /*#__PURE__*/React.createElement(Pagination, {
20
- currentPage: 20,
21
- totalPages: 100,
22
- pageRangeDisplayed: 15,
23
- marginPagesDisplayed: 3
24
- });
25
- export const TextualButtons = () => /*#__PURE__*/React.createElement(Pagination, {
26
- currentPage: 10,
27
- totalPages: 30,
28
- previousLabel: /*#__PURE__*/React.createElement("a", null, "Previous"),
29
- nextLabel: /*#__PURE__*/React.createElement("a", null, "Next")
30
- });
14
+ exports.default = _default;
15
+ var Default = function Default() {
16
+ return /*#__PURE__*/_react.default.createElement(_.default, {
17
+ currentPage: 1,
18
+ totalPages: 10
19
+ });
20
+ };
21
+ exports.Default = Default;
22
+ var FewPages = function FewPages() {
23
+ return /*#__PURE__*/_react.default.createElement(_.default, {
24
+ currentPage: 2,
25
+ totalPages: 4
26
+ });
27
+ };
28
+ exports.FewPages = FewPages;
29
+ var ManyPages = function ManyPages() {
30
+ return /*#__PURE__*/_react.default.createElement(_.default, {
31
+ currentPage: 4000,
32
+ totalPages: 9001
33
+ });
34
+ };
35
+ exports.ManyPages = ManyPages;
36
+ var LargePageRange = function LargePageRange() {
37
+ return /*#__PURE__*/_react.default.createElement(_.default, {
38
+ currentPage: 20,
39
+ totalPages: 100,
40
+ pageRangeDisplayed: 15,
41
+ marginPagesDisplayed: 3
42
+ });
43
+ };
44
+ exports.LargePageRange = LargePageRange;
45
+ var TextualButtons = function TextualButtons() {
46
+ return /*#__PURE__*/_react.default.createElement(_.default, {
47
+ currentPage: 10,
48
+ totalPages: 30,
49
+ previousLabel: /*#__PURE__*/_react.default.createElement("a", null, "Previous"),
50
+ nextLabel: /*#__PURE__*/_react.default.createElement("a", null, "Next")
51
+ });
52
+ };
53
+ exports.TextualButtons = TextualButtons;
@@ -1,29 +1,35 @@
1
- import React from 'react';
2
- import { useSearchkit } from '@searchkit/client';
3
- import classNames from 'classnames';
4
- import Button from '../../../Button';
5
- const makeSafeForCSS = value => {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.ChipFacet = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _client = require("@searchkit/client");
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _Button = _interopRequireDefault(require("../../../Button"));
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ var makeSafeForCSS = function makeSafeForCSS(value) {
6
13
  return encodeURIComponent(value).replace(/\.|%[0-9a-z]{2}/gi, '');
7
14
  };
8
- export const ChipFacet = ({
9
- facet
10
- }) => {
11
- const api = useSearchkit();
12
- return /*#__PURE__*/React.createElement("div", {
15
+ var ChipFacet = function ChipFacet(_ref) {
16
+ var facet = _ref.facet;
17
+ var api = (0, _client.useSearchkit)();
18
+ return /*#__PURE__*/_react.default.createElement("div", {
13
19
  className: "Facet ChipFacet",
14
20
  key: facet.identifier
15
- }, /*#__PURE__*/React.createElement("span", null, facet.label), /*#__PURE__*/React.createElement("div", null, facet.entries.map(entry => {
16
- const isSelected = api.isFilterSelected({
21
+ }, /*#__PURE__*/_react.default.createElement("span", null, facet.label), /*#__PURE__*/_react.default.createElement("div", null, facet.entries.map(function (entry) {
22
+ var isSelected = api.isFilterSelected({
17
23
  identifier: facet.identifier,
18
24
  value: entry.label
19
25
  });
20
- const classes = classNames('Button--Chip', makeSafeForCSS(`Button--${entry.label}`), {
26
+ var classes = (0, _classnames.default)('Button--Chip', makeSafeForCSS("Button--".concat(entry.label)), {
21
27
  'Button--selected': isSelected
22
28
  });
23
- return /*#__PURE__*/React.createElement(Button, {
29
+ return /*#__PURE__*/_react.default.createElement(_Button.default, {
24
30
  className: classes,
25
31
  disabled: parseInt(entry.count) === 0,
26
- onClick: () => {
32
+ onClick: function onClick() {
27
33
  api.toggleFilter({
28
34
  identifier: facet.identifier,
29
35
  value: entry.label
@@ -36,5 +42,7 @@ export const ChipFacet = ({
36
42
  }, entry.label);
37
43
  })));
38
44
  };
45
+ exports.ChipFacet = ChipFacet;
39
46
  ChipFacet.DISPLAY = 'ChipFacet';
40
- export default ChipFacet;
47
+ var _default = ChipFacet;
48
+ exports.default = _default;
@@ -1,28 +1,34 @@
1
- import React from 'react';
2
- import { useSearchkit } from '@searchkit/client';
3
- import classNames from 'classnames';
4
- export const ListFacet = ({
5
- facet
6
- }) => {
7
- const api = useSearchkit();
8
- return /*#__PURE__*/React.createElement("div", {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.ListFacet = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _client = require("@searchkit/client");
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ var ListFacet = function ListFacet(_ref) {
12
+ var facet = _ref.facet;
13
+ var api = (0, _client.useSearchkit)();
14
+ return /*#__PURE__*/_react.default.createElement("div", {
9
15
  className: "Facet ListFacet",
10
16
  key: facet.identifier
11
- }, /*#__PURE__*/React.createElement("span", null, facet.label), /*#__PURE__*/React.createElement("ul", null, facet.entries.map(entry => {
12
- const isSelected = api.isFilterSelected({
17
+ }, /*#__PURE__*/_react.default.createElement("span", null, facet.label), /*#__PURE__*/_react.default.createElement("ul", null, facet.entries.map(function (entry) {
18
+ var isSelected = api.isFilterSelected({
13
19
  identifier: facet.identifier,
14
20
  value: entry.label
15
21
  });
16
- const classes = classNames({
22
+ var classes = (0, _classnames.default)({
17
23
  selected: isSelected,
18
24
  disabled: parseInt(entry.count) === 0
19
25
  });
20
- return /*#__PURE__*/React.createElement("li", {
26
+ return /*#__PURE__*/_react.default.createElement("li", {
21
27
  className: classes,
22
28
  key: entry.label
23
- }, /*#__PURE__*/React.createElement("button", {
29
+ }, /*#__PURE__*/_react.default.createElement("button", {
24
30
  type: "button",
25
- onClick: () => {
31
+ onClick: function onClick() {
26
32
  api.toggleFilter({
27
33
  identifier: facet.identifier,
28
34
  value: entry.label
@@ -36,5 +42,7 @@ export const ListFacet = ({
36
42
  }, entry.label, " (", entry.count, ")"));
37
43
  })));
38
44
  };
45
+ exports.ListFacet = ListFacet;
39
46
  ListFacet.DISPLAY = 'ListFacet';
40
- export default ListFacet;
47
+ var _default = ListFacet;
48
+ exports.default = _default;