@itcase/ui 1.1.18 → 1.1.20

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 (156) hide show
  1. package/dist/{Accordion-uWRXripc.js → Accordion-DCk1_IOx.js} +1 -1
  2. package/dist/{Avatar-APOOlMd3.js → Avatar-EsnSFf8y.js} +1 -1
  3. package/dist/{Breadcrumbs-rRMuYnWJ.js → Breadcrumbs-lq8teNHv.js} +2 -2
  4. package/dist/{Button-DxZUKQ8I.js → Button-Dslt7OS2.js} +2 -2
  5. package/dist/{Cell-BJThS4YS.js → Cell-DtK-UEKE.js} +2 -2
  6. package/dist/{Choice-DVU4k0tu.js → Choice-CeVJI4H9.js} +1 -1
  7. package/dist/{ContextMenuItem-xssbnviQ.js → ContextMenuItem-BuJBuKmW.js} +1 -1
  8. package/dist/{CookiesWarning-Dcon4SS4.js → CookiesWarning-BQZ8f2hX.js} +2 -2
  9. package/dist/{DatePicker-D9UgOcue.js → DatePicker-DxTgMHIo.js} +3 -3
  10. package/dist/{DropdownItem-DB5nPIdl.js → DropdownItem-DftDKP1Y.js} +1 -1
  11. package/dist/{GridRow-CvYQDJ2W.js → GridRow-DRjyNWBh.js} +10 -19
  12. package/dist/{Group-DuHn_z2p.js → Group-BWwH31L7.js} +16 -4
  13. package/dist/{Icon-C0gtkmdU.js → Icon-DobrgUul.js} +2 -2
  14. package/dist/{InputPassword-D6OLQrVC.js → InputPassword-FuVE3fYp.js} +1 -1
  15. package/dist/{Label-0lMH0-AK.js → Label-Ch6YjDF4.js} +1 -1
  16. package/dist/{LanguageSelector-uOmIj9mJ.js → LanguageSelector-DrFlau3K.js} +1 -1
  17. package/dist/Link-CnzdHbwf.js +1864 -0
  18. package/dist/{ListItem-DMS6_Rtr.js → ListItem-CmWuDHgt.js} +1 -1
  19. package/dist/Logo-Dc9ImVCn.js +37 -0
  20. package/dist/{Menu-9u6BoWRL.js → Menu-D-C4q1An.js} +1 -1
  21. package/dist/{MenuItem-CXxL099U.js → MenuItem-Cs0KLPXi.js} +1 -1
  22. package/dist/{NotificationList-B48jz206.js → NotificationList-CaAYxwHB.js} +1 -1
  23. package/dist/{Pagination-Ch75clod.js → Pagination-z2n_5l-u.js} +2 -2
  24. package/dist/{Response-CgE3B1JS.js → Response-BXQPmdQr.js} +3 -3
  25. package/dist/{SearchResult-vA2t-ZGx.js → SearchResult-BsXiKcpx.js} +1 -1
  26. package/dist/{SiteMenuButton-CFPtqh_i.js → SiteMenuButton-DNMOi-I3.js} +1 -1
  27. package/dist/{Swiper-CP2ph4S3.js → Swiper-CXjE6qZR.js} +5 -5
  28. package/dist/{SwitchField-Cj0B7JdE.js → SwitchField-Djrsk1Th.js} +1 -1
  29. package/dist/{TabGroup-C4CbZgr7.js → TabGroup-c-myALzO.js} +1 -1
  30. package/dist/{Tile-B2HwgBDH.js → Tile-m0Q0UUPl.js} +1 -1
  31. package/dist/{Title-BAdU2oW_.js → Title-zpOK2AxL.js} +1 -1
  32. package/dist/{Tooltip-D46EmkZq.js → Tooltip-BYw26YRd.js} +1 -1
  33. package/dist/cjs/{Accordion-OI5oLjJY.js → Accordion-CGdZmC7z.js} +1 -1
  34. package/dist/cjs/{Avatar-BBAt1cKM.js → Avatar-CXkFUZni.js} +1 -1
  35. package/dist/cjs/{Breadcrumbs-DLTpOh1T.js → Breadcrumbs-GGwX18rz.js} +2 -2
  36. package/dist/cjs/{Button-C-K_KVjd.js → Button-DplZg-6U.js} +2 -2
  37. package/dist/cjs/{Cell-DpzvSs16.js → Cell-fldKcEHr.js} +2 -2
  38. package/dist/cjs/{Choice-nMRlWkpF.js → Choice-DwYPQwyf.js} +1 -1
  39. package/dist/cjs/{ContextMenuItem-D2wjhhzg.js → ContextMenuItem-D-wYq1Of.js} +1 -1
  40. package/dist/cjs/{CookiesWarning--Edz7Gcv.js → CookiesWarning-Cny73RI8.js} +2 -2
  41. package/dist/cjs/{DatePicker-vgeb1SWe.js → DatePicker-BvGVwQWT.js} +3 -3
  42. package/dist/cjs/{DropdownItem-CCuDjUjH.js → DropdownItem-BazQTndn.js} +1 -1
  43. package/dist/cjs/{GridRow-OxLsh_2P.js → GridRow-CAqZZGge.js} +10 -19
  44. package/dist/cjs/{Group-CtseVj34.js → Group-B3axMtEa.js} +16 -4
  45. package/dist/cjs/{Icon-BUwWk_dS.js → Icon-1nE_a40k.js} +2 -2
  46. package/dist/cjs/{InputPassword-BqbSnWDE.js → InputPassword-u30j02Bh.js} +1 -1
  47. package/dist/cjs/{Label-Bc4u2NRI.js → Label-Cgxxx2Ar.js} +1 -1
  48. package/dist/cjs/{LanguageSelector-BswZL8dZ.js → LanguageSelector-lyV39rdI.js} +1 -1
  49. package/dist/cjs/Link-D30saU5d.js +1877 -0
  50. package/dist/cjs/{ListItem-C3tWa-2I.js → ListItem-DBqD3_kT.js} +1 -1
  51. package/dist/cjs/{Logo-BjDQjs3w.js → Logo-CLwB8jrJ.js} +3 -3
  52. package/dist/cjs/{Menu-Bn0hqLr-.js → Menu-D4NCuPTA.js} +1 -1
  53. package/dist/cjs/{MenuItem-C-0vQBaj.js → MenuItem-D7TzAdrA.js} +1 -1
  54. package/dist/cjs/{NotificationList-D7rD4PAW.js → NotificationList-DuwcxJAs.js} +1 -1
  55. package/dist/cjs/{Pagination-XAVYtca1.js → Pagination-BaUSH8Q1.js} +2 -2
  56. package/dist/cjs/{Response-BmR09awR.js → Response-g-ogAxvP.js} +3 -3
  57. package/dist/cjs/{SearchResult-gHEwq0ay.js → SearchResult-CbJZk7jp.js} +1 -1
  58. package/dist/cjs/{SiteMenuButton-B6QISdea.js → SiteMenuButton-CbRuV0ju.js} +1 -1
  59. package/dist/cjs/{Swiper--idB5Ci6.js → Swiper-Zh5xaPu3.js} +5 -5
  60. package/dist/cjs/{SwitchField-CCHC2ZHS.js → SwitchField-C3TrW6fZ.js} +1 -1
  61. package/dist/cjs/{TabGroup-CYaefMap.js → TabGroup-C6d1YI0e.js} +1 -1
  62. package/dist/cjs/{Tile-By9iqne7.js → Tile-CatxYX82.js} +1 -1
  63. package/dist/cjs/{Title-BzopkHQY.js → Title-Ckp30YSI.js} +1 -1
  64. package/dist/cjs/{Tooltip-VrKQ8W1G.js → Tooltip-CYJGThOv.js} +1 -1
  65. package/dist/cjs/components/Accordion.js +7 -5
  66. package/dist/cjs/components/Avatar.js +7 -5
  67. package/dist/cjs/components/Breadcrumbs.js +7 -5
  68. package/dist/cjs/components/Button.js +7 -5
  69. package/dist/cjs/components/Cell.js +8 -6
  70. package/dist/cjs/components/Choice.js +7 -5
  71. package/dist/cjs/components/ContextMenu.js +7 -5
  72. package/dist/cjs/components/CookiesWarning.js +9 -7
  73. package/dist/cjs/components/DatePicker.js +8 -7
  74. package/dist/cjs/components/Dropdown.js +4 -2
  75. package/dist/cjs/components/FormField.js +7 -6
  76. package/dist/cjs/components/Grid/Grid.interface.d.ts +23 -31
  77. package/dist/cjs/components/Grid.js +1 -1
  78. package/dist/cjs/components/Group/Group.interface.d.ts +13 -12
  79. package/dist/cjs/components/Group.js +1 -1
  80. package/dist/cjs/components/Icon.js +6 -4
  81. package/dist/cjs/components/InputPassword.js +7 -5
  82. package/dist/cjs/components/Label.js +3 -3
  83. package/dist/cjs/components/LanguageSelector.js +7 -5
  84. package/dist/cjs/components/Link/Link.d.ts +2 -1
  85. package/dist/cjs/components/Link/index.d.ts +1 -1
  86. package/dist/cjs/components/Link.js +5 -2
  87. package/dist/cjs/components/List.js +4 -2
  88. package/dist/cjs/components/Logo/Logo.interface.d.ts +6 -1
  89. package/dist/cjs/components/Logo.js +4 -2
  90. package/dist/cjs/components/Menu.js +5 -3
  91. package/dist/cjs/components/MenuItem.js +4 -2
  92. package/dist/cjs/components/Notification.js +2 -2
  93. package/dist/cjs/components/Pagination.js +8 -6
  94. package/dist/cjs/components/Panel.js +1 -1
  95. package/dist/cjs/components/Response.js +9 -7
  96. package/dist/cjs/components/Search.js +7 -5
  97. package/dist/cjs/components/Select.js +6 -5
  98. package/dist/cjs/components/SiteMenu.js +7 -5
  99. package/dist/cjs/components/Swiper.js +2 -2
  100. package/dist/cjs/components/Tab.js +4 -2
  101. package/dist/cjs/components/Tile.js +2 -2
  102. package/dist/cjs/components/Title.js +1 -1
  103. package/dist/cjs/components/Tooltip.js +2 -2
  104. package/dist/cjs/components.js +33 -32
  105. package/dist/components/Accordion.js +7 -5
  106. package/dist/components/Avatar.js +7 -5
  107. package/dist/components/Breadcrumbs.js +7 -5
  108. package/dist/components/Button.js +7 -5
  109. package/dist/components/Cell.js +8 -6
  110. package/dist/components/Choice.js +7 -5
  111. package/dist/components/ContextMenu.js +7 -5
  112. package/dist/components/CookiesWarning.js +9 -7
  113. package/dist/components/DatePicker.js +8 -7
  114. package/dist/components/Dropdown.js +4 -2
  115. package/dist/components/FormField.js +7 -6
  116. package/dist/components/Grid/Grid.interface.d.ts +23 -31
  117. package/dist/components/Grid.js +1 -1
  118. package/dist/components/Group/Group.interface.d.ts +13 -12
  119. package/dist/components/Group.js +1 -1
  120. package/dist/components/Icon.js +6 -4
  121. package/dist/components/InputPassword.js +7 -5
  122. package/dist/components/Label.js +3 -3
  123. package/dist/components/LanguageSelector.js +7 -5
  124. package/dist/components/Link/Link.d.ts +2 -1
  125. package/dist/components/Link/index.d.ts +1 -1
  126. package/dist/components/Link.js +4 -2
  127. package/dist/components/List.js +4 -2
  128. package/dist/components/Logo/Logo.interface.d.ts +6 -1
  129. package/dist/components/Logo.js +4 -2
  130. package/dist/components/Menu.js +5 -3
  131. package/dist/components/MenuItem.js +4 -2
  132. package/dist/components/Notification.js +2 -2
  133. package/dist/components/Pagination.js +8 -6
  134. package/dist/components/Panel.js +1 -1
  135. package/dist/components/Response.js +9 -7
  136. package/dist/components/Search.js +7 -5
  137. package/dist/components/Select.js +6 -5
  138. package/dist/components/SiteMenu.js +7 -5
  139. package/dist/components/Swiper.js +2 -2
  140. package/dist/components/Tab.js +4 -2
  141. package/dist/components/Tile.js +2 -2
  142. package/dist/components/Title.js +1 -1
  143. package/dist/components/Tooltip.js +2 -2
  144. package/dist/components.js +33 -32
  145. package/dist/css/components/DadataHintField/DadataHintField.css +4 -1
  146. package/dist/css/components/Grid/Grid.css +12 -3
  147. package/dist/css/components/Group/Group.css +35 -0
  148. package/dist/css/components/Input/Input.css +2 -2
  149. package/dist/css/components/Swiper/Swiper.css +2 -2
  150. package/dist/css/styles/text-color/text-color.css +11 -7
  151. package/dist/css/styles/text-color/text-color_active.css +12 -10
  152. package/dist/css/styles/text-color/text-color_hover.css +16 -13
  153. package/package.json +13 -11
  154. package/dist/Link-Co6uspFK.js +0 -90
  155. package/dist/Logo-dRWwDqj-.js +0 -37
  156. package/dist/cjs/Link-B6Xq7PWn.js +0 -99
@@ -0,0 +1,1864 @@
1
+ import { a as __rest, _ as __assign } from './_tslib-S-VPg1Cw.js';
2
+ import { j as jsxRuntimeExports } from './jsx-runtime-C2uP7l8s.js';
3
+ import React__default from 'react';
4
+ import clsx from 'clsx';
5
+ import require$$0 from 'lodash.throttle';
6
+ import PropTypes$1 from 'prop-types';
7
+ import ReactDOM__default from 'react-dom';
8
+ import { useDeviceTargetClass } from './hooks/useDeviceTargetClass.js';
9
+ import { useStyles } from './hooks/useStyles.js';
10
+
11
+ var modules = {};
12
+
13
+ var Link$1 = {};
14
+
15
+ var scrollLink = {};
16
+
17
+ var scrollSpy$2 = {};
18
+
19
+ var passiveEventListeners = {};
20
+
21
+ Object.defineProperty(passiveEventListeners, "__esModule", {
22
+ value: true
23
+ });
24
+ /*
25
+ * Tell the browser that the event listener won't prevent a scroll.
26
+ * Allowing the browser to continue scrolling without having to
27
+ * to wait for the listener to return.
28
+ */
29
+ passiveEventListeners.addPassiveEventListener = function addPassiveEventListener(target, eventName, listener) {
30
+ var listenerName = listener.name;
31
+ if (!listenerName) {
32
+ listenerName = eventName;
33
+ console.warn('Listener must be a named function.');
34
+ }
35
+
36
+ if (!attachedListeners.has(eventName)) attachedListeners.set(eventName, new Set());
37
+ var listeners = attachedListeners.get(eventName);
38
+ if (listeners.has(listenerName)) return;
39
+
40
+ var supportsPassiveOption = function () {
41
+ var supportsPassiveOption = false;
42
+ try {
43
+ var opts = Object.defineProperty({}, 'passive', {
44
+ get: function get() {
45
+ supportsPassiveOption = true;
46
+ }
47
+ });
48
+ window.addEventListener('test', null, opts);
49
+ } catch (e) {}
50
+ return supportsPassiveOption;
51
+ }();
52
+ target.addEventListener(eventName, listener, supportsPassiveOption ? { passive: true } : false);
53
+ listeners.add(listenerName);
54
+ };
55
+
56
+ passiveEventListeners.removePassiveEventListener = function removePassiveEventListener(target, eventName, listener) {
57
+ target.removeEventListener(eventName, listener);
58
+ attachedListeners.get(eventName).delete(listener.name || eventName);
59
+ };
60
+
61
+ var attachedListeners = new Map();
62
+
63
+ Object.defineProperty(scrollSpy$2, "__esModule", {
64
+ value: true
65
+ });
66
+
67
+ var _lodash = require$$0;
68
+
69
+ var _lodash2 = _interopRequireDefault$9(_lodash);
70
+
71
+ var _passiveEventListeners$1 = passiveEventListeners;
72
+
73
+ function _interopRequireDefault$9(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
74
+
75
+ // The eventHandler will execute at a rate of 15fps by default
76
+ var eventThrottler = function eventThrottler(eventHandler) {
77
+ var throttleAmount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 66;
78
+ return (0, _lodash2.default)(eventHandler, throttleAmount);
79
+ };
80
+
81
+ var scrollSpy$1 = {
82
+
83
+ spyCallbacks: [],
84
+ spySetState: [],
85
+ scrollSpyContainers: [],
86
+
87
+ mount: function mount(scrollSpyContainer, throttle) {
88
+ if (scrollSpyContainer) {
89
+ var eventHandler = eventThrottler(function (event) {
90
+ scrollSpy$1.scrollHandler(scrollSpyContainer);
91
+ }, throttle);
92
+ scrollSpy$1.scrollSpyContainers.push(scrollSpyContainer);
93
+ (0, _passiveEventListeners$1.addPassiveEventListener)(scrollSpyContainer, 'scroll', eventHandler);
94
+ }
95
+ },
96
+ isMounted: function isMounted(scrollSpyContainer) {
97
+ return scrollSpy$1.scrollSpyContainers.indexOf(scrollSpyContainer) !== -1;
98
+ },
99
+ currentPositionX: function currentPositionX(scrollSpyContainer) {
100
+ if (scrollSpyContainer === document) {
101
+ var supportPageOffset = window.pageYOffset !== undefined;
102
+ var isCSS1Compat = (document.compatMode || "") === "CSS1Compat";
103
+ return supportPageOffset ? window.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft;
104
+ } else {
105
+ return scrollSpyContainer.scrollLeft;
106
+ }
107
+ },
108
+ currentPositionY: function currentPositionY(scrollSpyContainer) {
109
+ if (scrollSpyContainer === document) {
110
+ var supportPageOffset = window.pageXOffset !== undefined;
111
+ var isCSS1Compat = (document.compatMode || "") === "CSS1Compat";
112
+ return supportPageOffset ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;
113
+ } else {
114
+ return scrollSpyContainer.scrollTop;
115
+ }
116
+ },
117
+ scrollHandler: function scrollHandler(scrollSpyContainer) {
118
+ var callbacks = scrollSpy$1.scrollSpyContainers[scrollSpy$1.scrollSpyContainers.indexOf(scrollSpyContainer)].spyCallbacks || [];
119
+ callbacks.forEach(function (c) {
120
+ return c(scrollSpy$1.currentPositionX(scrollSpyContainer), scrollSpy$1.currentPositionY(scrollSpyContainer));
121
+ });
122
+ },
123
+ addStateHandler: function addStateHandler(handler) {
124
+ scrollSpy$1.spySetState.push(handler);
125
+ },
126
+ addSpyHandler: function addSpyHandler(handler, scrollSpyContainer) {
127
+ var container = scrollSpy$1.scrollSpyContainers[scrollSpy$1.scrollSpyContainers.indexOf(scrollSpyContainer)];
128
+
129
+ if (!container.spyCallbacks) {
130
+ container.spyCallbacks = [];
131
+ }
132
+
133
+ container.spyCallbacks.push(handler);
134
+
135
+ handler(scrollSpy$1.currentPositionX(scrollSpyContainer), scrollSpy$1.currentPositionY(scrollSpyContainer));
136
+ },
137
+ updateStates: function updateStates() {
138
+ scrollSpy$1.spySetState.forEach(function (s) {
139
+ return s();
140
+ });
141
+ },
142
+ unmount: function unmount(stateHandler, spyHandler) {
143
+ scrollSpy$1.scrollSpyContainers.forEach(function (c) {
144
+ return c.spyCallbacks && c.spyCallbacks.length && c.spyCallbacks.indexOf(spyHandler) > -1 && c.spyCallbacks.splice(c.spyCallbacks.indexOf(spyHandler), 1);
145
+ });
146
+
147
+ if (scrollSpy$1.spySetState && scrollSpy$1.spySetState.length && scrollSpy$1.spySetState.indexOf(stateHandler) > -1) {
148
+ scrollSpy$1.spySetState.splice(scrollSpy$1.spySetState.indexOf(stateHandler), 1);
149
+ }
150
+
151
+ document.removeEventListener('scroll', scrollSpy$1.scrollHandler);
152
+ },
153
+
154
+
155
+ update: function update() {
156
+ return scrollSpy$1.scrollSpyContainers.forEach(function (c) {
157
+ return scrollSpy$1.scrollHandler(c);
158
+ });
159
+ }
160
+ };
161
+
162
+ scrollSpy$2.default = scrollSpy$1;
163
+
164
+ var scroller = {};
165
+
166
+ var utils = {};
167
+
168
+ Object.defineProperty(utils, "__esModule", {
169
+ value: true
170
+ });
171
+ var updateHash = function updateHash(hash, historyUpdate) {
172
+ var hashVal = hash.indexOf("#") === 0 ? hash.substring(1) : hash;
173
+ var hashToUpdate = hashVal ? "#" + hashVal : "";
174
+ var curLoc = window && window.location;
175
+ var urlToPush = hashToUpdate ? curLoc.pathname + curLoc.search + hashToUpdate : curLoc.pathname + curLoc.search;
176
+ historyUpdate ? history.pushState(history.state, "", urlToPush) : history.replaceState(history.state, "", urlToPush);
177
+ };
178
+
179
+ var getHash = function getHash() {
180
+ return window.location.hash.replace(/^#/, "");
181
+ };
182
+
183
+ var filterElementInContainer = function filterElementInContainer(container) {
184
+ return function (element) {
185
+ return container.contains ? container != element && container.contains(element) : !!(container.compareDocumentPosition(element) & 16);
186
+ };
187
+ };
188
+
189
+ var isPositioned = function isPositioned(element) {
190
+ return getComputedStyle(element).position !== "static";
191
+ };
192
+
193
+ var getElementOffsetInfoUntil = function getElementOffsetInfoUntil(element, predicate) {
194
+ var offsetTop = element.offsetTop;
195
+ var currentOffsetParent = element.offsetParent;
196
+
197
+ while (currentOffsetParent && !predicate(currentOffsetParent)) {
198
+ offsetTop += currentOffsetParent.offsetTop;
199
+ currentOffsetParent = currentOffsetParent.offsetParent;
200
+ }
201
+
202
+ return { offsetTop: offsetTop, offsetParent: currentOffsetParent };
203
+ };
204
+
205
+ var scrollOffset = function scrollOffset(c, t, horizontal) {
206
+ if (horizontal) {
207
+ return c === document ? t.getBoundingClientRect().left + (window.scrollX || window.pageXOffset) : getComputedStyle(c).position !== "static" ? t.offsetLeft : t.offsetLeft - c.offsetLeft;
208
+ } else {
209
+ if (c === document) {
210
+ return t.getBoundingClientRect().top + (window.scrollY || window.pageYOffset);
211
+ }
212
+
213
+ // The offsetParent of an element, according to MDN, is its nearest positioned
214
+ // (an element whose position is anything other than static) ancestor. The offsetTop
215
+ // of an element is taken with respect to its offsetParent which may not neccessarily
216
+ // be its parentElement except the parent itself is positioned.
217
+
218
+ // So if containerElement is positioned, then it must be an offsetParent somewhere
219
+ // If it happens that targetElement is a descendant of the containerElement, and there
220
+ // is not intermediate positioned element between the two of them, i.e.
221
+ // targetElement"s offsetParent is the same as the containerElement, then the
222
+ // distance between the two will be the offsetTop of the targetElement.
223
+ // If, on the other hand, there are intermediate positioned elements between the
224
+ // two entities, the distance between the targetElement and the containerElement
225
+ // will be the accumulation of the offsetTop of the element and that of its
226
+ // subsequent offsetParent until the containerElement is reached, since it
227
+ // will also be an offsetParent at some point due to the fact that it is positioned.
228
+
229
+ // If the containerElement is not positioned, then it can"t be an offsetParent,
230
+ // which means that the offsetTop of the targetElement would not be with respect to it.
231
+ // However, if the two of them happen to have the same offsetParent, then
232
+ // the distance between them will be the difference between their offsetTop
233
+ // since they are both taken with respect to the same entity.
234
+ // The last resort would be to accumulate their offsetTop until a common
235
+ // offsetParent is reached (usually the document) and taking the difference
236
+ // between the accumulated offsetTops
237
+
238
+ if (isPositioned(c)) {
239
+ if (t.offsetParent !== c) {
240
+ var isContainerElementOrDocument = function isContainerElementOrDocument(e) {
241
+ return e === c || e === document;
242
+ };
243
+
244
+ var _getElementOffsetInfo = getElementOffsetInfoUntil(t, isContainerElementOrDocument),
245
+ offsetTop = _getElementOffsetInfo.offsetTop,
246
+ offsetParent = _getElementOffsetInfo.offsetParent;
247
+
248
+ if (offsetParent !== c) {
249
+ throw new Error("Seems containerElement is not an ancestor of the Element");
250
+ }
251
+
252
+ return offsetTop;
253
+ }
254
+
255
+ return t.offsetTop;
256
+ }
257
+
258
+ if (t.offsetParent === c.offsetParent) {
259
+ return t.offsetTop - c.offsetTop;
260
+ }
261
+
262
+ var isDocument = function isDocument(e) {
263
+ return e === document;
264
+ };
265
+ return getElementOffsetInfoUntil(t, isDocument).offsetTop - getElementOffsetInfoUntil(c, isDocument).offsetTop;
266
+ }
267
+ };
268
+
269
+ utils.default = {
270
+ updateHash: updateHash,
271
+ getHash: getHash,
272
+ filterElementInContainer: filterElementInContainer,
273
+ scrollOffset: scrollOffset
274
+ };
275
+
276
+ var animateScroll$1 = {};
277
+
278
+ var smooth = {};
279
+
280
+ Object.defineProperty(smooth, "__esModule", {
281
+ value: true
282
+ });
283
+ smooth.default = {
284
+ /*
285
+ * https://github.com/oblador/angular-scroll (duScrollDefaultEasing)
286
+ */
287
+ defaultEasing: function defaultEasing(x) {
288
+ if (x < 0.5) {
289
+ return Math.pow(x * 2, 2) / 2;
290
+ }
291
+ return 1 - Math.pow((1 - x) * 2, 2) / 2;
292
+ },
293
+ /*
294
+ * https://gist.github.com/gre/1650294
295
+ */
296
+ // no easing, no acceleration
297
+ linear: function linear(x) {
298
+ return x;
299
+ },
300
+ // accelerating from zero velocity
301
+ easeInQuad: function easeInQuad(x) {
302
+ return x * x;
303
+ },
304
+ // decelerating to zero velocity
305
+ easeOutQuad: function easeOutQuad(x) {
306
+ return x * (2 - x);
307
+ },
308
+ // acceleration until halfway, then deceleration
309
+ easeInOutQuad: function easeInOutQuad(x) {
310
+ return x < .5 ? 2 * x * x : -1 + (4 - 2 * x) * x;
311
+ },
312
+ // accelerating from zero velocity
313
+ easeInCubic: function easeInCubic(x) {
314
+ return x * x * x;
315
+ },
316
+ // decelerating to zero velocity π
317
+ easeOutCubic: function easeOutCubic(x) {
318
+ return --x * x * x + 1;
319
+ },
320
+ // acceleration until halfway, then deceleration
321
+ easeInOutCubic: function easeInOutCubic(x) {
322
+ return x < .5 ? 4 * x * x * x : (x - 1) * (2 * x - 2) * (2 * x - 2) + 1;
323
+ },
324
+ // accelerating from zero velocity
325
+ easeInQuart: function easeInQuart(x) {
326
+ return x * x * x * x;
327
+ },
328
+ // decelerating to zero velocity
329
+ easeOutQuart: function easeOutQuart(x) {
330
+ return 1 - --x * x * x * x;
331
+ },
332
+ // acceleration until halfway, then deceleration
333
+ easeInOutQuart: function easeInOutQuart(x) {
334
+ return x < .5 ? 8 * x * x * x * x : 1 - 8 * --x * x * x * x;
335
+ },
336
+ // accelerating from zero velocity
337
+ easeInQuint: function easeInQuint(x) {
338
+ return x * x * x * x * x;
339
+ },
340
+ // decelerating to zero velocity
341
+ easeOutQuint: function easeOutQuint(x) {
342
+ return 1 + --x * x * x * x * x;
343
+ },
344
+ // acceleration until halfway, then deceleration
345
+ easeInOutQuint: function easeInOutQuint(x) {
346
+ return x < .5 ? 16 * x * x * x * x * x : 1 + 16 * --x * x * x * x * x;
347
+ }
348
+ };
349
+
350
+ var cancelEvents = {};
351
+
352
+ Object.defineProperty(cancelEvents, "__esModule", {
353
+ value: true
354
+ });
355
+
356
+ var _passiveEventListeners = passiveEventListeners;
357
+
358
+ var events = ['mousedown', 'mousewheel', 'touchmove', 'keydown'];
359
+
360
+ cancelEvents.default = {
361
+ subscribe: function subscribe(cancelEvent) {
362
+ return typeof document !== 'undefined' && events.forEach(function (event) {
363
+ return (0, _passiveEventListeners.addPassiveEventListener)(document, event, cancelEvent);
364
+ });
365
+ }
366
+ };
367
+
368
+ var scrollEvents = {};
369
+
370
+ Object.defineProperty(scrollEvents, "__esModule", {
371
+ value: true
372
+ });
373
+
374
+ var Events = {
375
+ registered: {},
376
+ scrollEvent: {
377
+ register: function register(evtName, callback) {
378
+ Events.registered[evtName] = callback;
379
+ },
380
+ remove: function remove(evtName) {
381
+ Events.registered[evtName] = null;
382
+ }
383
+ }
384
+ };
385
+
386
+ scrollEvents.default = Events;
387
+
388
+ Object.defineProperty(animateScroll$1, "__esModule", {
389
+ value: true
390
+ });
391
+
392
+ var _extends$5 = 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; };
393
+
394
+ var _utils$2 = utils;
395
+
396
+ _interopRequireDefault$8(_utils$2);
397
+
398
+ var _smooth = smooth;
399
+
400
+ var _smooth2 = _interopRequireDefault$8(_smooth);
401
+
402
+ var _cancelEvents = cancelEvents;
403
+
404
+ var _cancelEvents2 = _interopRequireDefault$8(_cancelEvents);
405
+
406
+ var _scrollEvents$2 = scrollEvents;
407
+
408
+ var _scrollEvents2$2 = _interopRequireDefault$8(_scrollEvents$2);
409
+
410
+ function _interopRequireDefault$8(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
411
+
412
+ /*
413
+ * Gets the easing type from the smooth prop within options.
414
+ */
415
+ var getAnimationType = function getAnimationType(options) {
416
+ return _smooth2.default[options.smooth] || _smooth2.default.defaultEasing;
417
+ };
418
+ /*
419
+ * Function helper
420
+ */
421
+ var functionWrapper = function functionWrapper(value) {
422
+ return typeof value === 'function' ? value : function () {
423
+ return value;
424
+ };
425
+ };
426
+ /*
427
+ * Wraps window properties to allow server side rendering
428
+ */
429
+ var currentWindowProperties = function currentWindowProperties() {
430
+ if (typeof window !== 'undefined') {
431
+ return window.requestAnimationFrame || window.webkitRequestAnimationFrame;
432
+ }
433
+ };
434
+
435
+ /*
436
+ * Helper function to never extend 60fps on the webpage.
437
+ */
438
+ var requestAnimationFrameHelper = function () {
439
+ return currentWindowProperties() || function (callback, element, delay) {
440
+ window.setTimeout(callback, delay || 1000 / 60, new Date().getTime());
441
+ };
442
+ }();
443
+
444
+ var makeData = function makeData() {
445
+ return {
446
+ currentPosition: 0,
447
+ startPosition: 0,
448
+ targetPosition: 0,
449
+ progress: 0,
450
+ duration: 0,
451
+ cancel: false,
452
+
453
+ target: null,
454
+ containerElement: null,
455
+ to: null,
456
+ start: null,
457
+ delta: null,
458
+ percent: null,
459
+ delayTimeout: null
460
+ };
461
+ };
462
+
463
+ var currentPositionX = function currentPositionX(options) {
464
+ var containerElement = options.data.containerElement;
465
+ if (containerElement && containerElement !== document && containerElement !== document.body) {
466
+ return containerElement.scrollLeft;
467
+ } else {
468
+ var supportPageOffset = window.pageXOffset !== undefined;
469
+ var isCSS1Compat = (document.compatMode || "") === "CSS1Compat";
470
+ return supportPageOffset ? window.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft;
471
+ }
472
+ };
473
+
474
+ var currentPositionY = function currentPositionY(options) {
475
+ var containerElement = options.data.containerElement;
476
+ if (containerElement && containerElement !== document && containerElement !== document.body) {
477
+ return containerElement.scrollTop;
478
+ } else {
479
+ var supportPageOffset = window.pageXOffset !== undefined;
480
+ var isCSS1Compat = (document.compatMode || "") === "CSS1Compat";
481
+ return supportPageOffset ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;
482
+ }
483
+ };
484
+
485
+ var scrollContainerWidth = function scrollContainerWidth(options) {
486
+ var containerElement = options.data.containerElement;
487
+ if (containerElement && containerElement !== document && containerElement !== document.body) {
488
+ return containerElement.scrollWidth - containerElement.offsetWidth;
489
+ } else {
490
+ var body = document.body;
491
+ var html = document.documentElement;
492
+
493
+ return Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
494
+ }
495
+ };
496
+
497
+ var scrollContainerHeight = function scrollContainerHeight(options) {
498
+ var containerElement = options.data.containerElement;
499
+ if (containerElement && containerElement !== document && containerElement !== document.body) {
500
+ return containerElement.scrollHeight - containerElement.offsetHeight;
501
+ } else {
502
+ var body = document.body;
503
+ var html = document.documentElement;
504
+
505
+ return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
506
+ }
507
+ };
508
+
509
+ var animateScroll = function animateScroll(easing, options, timestamp) {
510
+ var data = options.data;
511
+
512
+ // Cancel on specific events
513
+ if (!options.ignoreCancelEvents && data.cancel) {
514
+ if (_scrollEvents2$2.default.registered['end']) {
515
+ _scrollEvents2$2.default.registered['end'](data.to, data.target, data.currentPositionY);
516
+ }
517
+ return;
518
+ }
519
+ data.delta = Math.round(data.targetPosition - data.startPosition);
520
+
521
+ if (data.start === null) {
522
+ data.start = timestamp;
523
+ }
524
+
525
+ data.progress = timestamp - data.start;
526
+
527
+ data.percent = data.progress >= data.duration ? 1 : easing(data.progress / data.duration);
528
+
529
+ data.currentPosition = data.startPosition + Math.ceil(data.delta * data.percent);
530
+
531
+ if (data.containerElement && data.containerElement !== document && data.containerElement !== document.body) {
532
+ if (options.horizontal) {
533
+ data.containerElement.scrollLeft = data.currentPosition;
534
+ } else {
535
+ data.containerElement.scrollTop = data.currentPosition;
536
+ }
537
+ } else {
538
+ if (options.horizontal) {
539
+ window.scrollTo(data.currentPosition, 0);
540
+ } else {
541
+ window.scrollTo(0, data.currentPosition);
542
+ }
543
+ }
544
+
545
+ if (data.percent < 1) {
546
+ var easedAnimate = animateScroll.bind(null, easing, options);
547
+ requestAnimationFrameHelper.call(window, easedAnimate);
548
+ return;
549
+ }
550
+
551
+ if (_scrollEvents2$2.default.registered['end']) {
552
+ _scrollEvents2$2.default.registered['end'](data.to, data.target, data.currentPosition);
553
+ }
554
+ };
555
+
556
+ var setContainer = function setContainer(options) {
557
+ options.data.containerElement = !options ? null : options.containerId ? document.getElementById(options.containerId) : options.container && options.container.nodeType ? options.container : document;
558
+ };
559
+
560
+ var animateTopScroll = function animateTopScroll(scrollOffset, options, to, target) {
561
+ options.data = options.data || makeData();
562
+
563
+ window.clearTimeout(options.data.delayTimeout);
564
+
565
+ var setCancel = function setCancel() {
566
+ options.data.cancel = true;
567
+ };
568
+ _cancelEvents2.default.subscribe(setCancel);
569
+
570
+ setContainer(options);
571
+
572
+ options.data.start = null;
573
+ options.data.cancel = false;
574
+ options.data.startPosition = options.horizontal ? currentPositionX(options) : currentPositionY(options);
575
+ options.data.targetPosition = options.absolute ? scrollOffset : scrollOffset + options.data.startPosition;
576
+
577
+ if (options.data.startPosition === options.data.targetPosition) {
578
+ if (_scrollEvents2$2.default.registered['end']) {
579
+ _scrollEvents2$2.default.registered['end'](options.data.to, options.data.target, options.data.currentPosition);
580
+ }
581
+ return;
582
+ }
583
+
584
+ options.data.delta = Math.round(options.data.targetPosition - options.data.startPosition);
585
+
586
+ options.data.duration = functionWrapper(options.duration)(options.data.delta);
587
+ options.data.duration = isNaN(parseFloat(options.data.duration)) ? 1000 : parseFloat(options.data.duration);
588
+ options.data.to = to;
589
+ options.data.target = target;
590
+
591
+ var easing = getAnimationType(options);
592
+ var easedAnimate = animateScroll.bind(null, easing, options);
593
+
594
+ if (options && options.delay > 0) {
595
+ options.data.delayTimeout = window.setTimeout(function () {
596
+ if (_scrollEvents2$2.default.registered['begin']) {
597
+ _scrollEvents2$2.default.registered['begin'](options.data.to, options.data.target);
598
+ }
599
+ requestAnimationFrameHelper.call(window, easedAnimate);
600
+ }, options.delay);
601
+ return;
602
+ }
603
+
604
+ if (_scrollEvents2$2.default.registered['begin']) {
605
+ _scrollEvents2$2.default.registered['begin'](options.data.to, options.data.target);
606
+ }
607
+ requestAnimationFrameHelper.call(window, easedAnimate);
608
+ };
609
+
610
+ var proceedOptions = function proceedOptions(options) {
611
+ options = _extends$5({}, options);
612
+ options.data = options.data || makeData();
613
+ options.absolute = true;
614
+ return options;
615
+ };
616
+
617
+ var scrollToTop = function scrollToTop(options) {
618
+ animateTopScroll(0, proceedOptions(options));
619
+ };
620
+
621
+ var scrollTo = function scrollTo(toPosition, options) {
622
+ animateTopScroll(toPosition, proceedOptions(options));
623
+ };
624
+
625
+ var scrollToBottom = function scrollToBottom(options) {
626
+ options = proceedOptions(options);
627
+ setContainer(options);
628
+ animateTopScroll(options.horizontal ? scrollContainerWidth(options) : scrollContainerHeight(options), options);
629
+ };
630
+
631
+ var scrollMore = function scrollMore(toPosition, options) {
632
+ options = proceedOptions(options);
633
+ setContainer(options);
634
+ var currentPosition = options.horizontal ? currentPositionX(options) : currentPositionY(options);
635
+ animateTopScroll(toPosition + currentPosition, options);
636
+ };
637
+
638
+ animateScroll$1.default = {
639
+ animateTopScroll: animateTopScroll,
640
+ getAnimationType: getAnimationType,
641
+ scrollToTop: scrollToTop,
642
+ scrollToBottom: scrollToBottom,
643
+ scrollTo: scrollTo,
644
+ scrollMore: scrollMore
645
+ };
646
+
647
+ Object.defineProperty(scroller, "__esModule", {
648
+ value: true
649
+ });
650
+
651
+ var _extends$4 = 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; };
652
+
653
+ var _utils$1 = utils;
654
+
655
+ var _utils2$1 = _interopRequireDefault$7(_utils$1);
656
+
657
+ var _animateScroll$1 = animateScroll$1;
658
+
659
+ var _animateScroll2$1 = _interopRequireDefault$7(_animateScroll$1);
660
+
661
+ var _scrollEvents$1 = scrollEvents;
662
+
663
+ var _scrollEvents2$1 = _interopRequireDefault$7(_scrollEvents$1);
664
+
665
+ function _interopRequireDefault$7(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
666
+
667
+ var __mapped = {};
668
+ var __activeLink = void 0;
669
+
670
+ scroller.default = {
671
+
672
+ unmount: function unmount() {
673
+ __mapped = {};
674
+ },
675
+
676
+ register: function register(name, element) {
677
+ __mapped[name] = element;
678
+ },
679
+
680
+ unregister: function unregister(name) {
681
+ delete __mapped[name];
682
+ },
683
+
684
+ get: function get(name) {
685
+ return __mapped[name] || document.getElementById(name) || document.getElementsByName(name)[0] || document.getElementsByClassName(name)[0];
686
+ },
687
+
688
+ setActiveLink: function setActiveLink(link) {
689
+ return __activeLink = link;
690
+ },
691
+
692
+ getActiveLink: function getActiveLink() {
693
+ return __activeLink;
694
+ },
695
+
696
+ scrollTo: function scrollTo(to, props) {
697
+
698
+ var target = this.get(to);
699
+
700
+ if (!target) {
701
+ console.warn("target Element not found");
702
+ return;
703
+ }
704
+
705
+ props = _extends$4({}, props, { absolute: false });
706
+
707
+ var containerId = props.containerId;
708
+ var container = props.container;
709
+
710
+ var containerElement = void 0;
711
+ if (containerId) {
712
+ containerElement = document.getElementById(containerId);
713
+ } else if (container && container.nodeType) {
714
+ containerElement = container;
715
+ } else {
716
+ containerElement = document;
717
+ }
718
+
719
+ props.absolute = true;
720
+
721
+ var horizontal = props.horizontal;
722
+ var scrollOffset = _utils2$1.default.scrollOffset(containerElement, target, horizontal) + (props.offset || 0);
723
+
724
+ /*
725
+ * if animate is not provided just scroll into the view
726
+ */
727
+ if (!props.smooth) {
728
+ if (_scrollEvents2$1.default.registered['begin']) {
729
+ _scrollEvents2$1.default.registered['begin'](to, target);
730
+ }
731
+
732
+ if (containerElement === document) {
733
+ if (props.horizontal) {
734
+ window.scrollTo(scrollOffset, 0);
735
+ } else {
736
+ window.scrollTo(0, scrollOffset);
737
+ }
738
+ } else {
739
+ containerElement.scrollTop = scrollOffset;
740
+ }
741
+
742
+ if (_scrollEvents2$1.default.registered['end']) {
743
+ _scrollEvents2$1.default.registered['end'](to, target);
744
+ }
745
+
746
+ return;
747
+ }
748
+
749
+ /*
750
+ * Animate scrolling
751
+ */
752
+
753
+ _animateScroll2$1.default.animateTopScroll(scrollOffset, props, to, target);
754
+ }
755
+ };
756
+
757
+ var scrollHash$2 = {};
758
+
759
+ Object.defineProperty(scrollHash$2, "__esModule", {
760
+ value: true
761
+ });
762
+
763
+ var _utils = utils;
764
+
765
+ var _utils2 = _interopRequireDefault$6(_utils);
766
+
767
+ function _interopRequireDefault$6(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
768
+
769
+ var scrollHash$1 = {
770
+ mountFlag: false,
771
+ initialized: false,
772
+ scroller: null,
773
+ containers: {},
774
+
775
+ mount: function mount(scroller) {
776
+ this.scroller = scroller;
777
+
778
+ this.handleHashChange = this.handleHashChange.bind(this);
779
+ window.addEventListener('hashchange', this.handleHashChange);
780
+
781
+ this.initStateFromHash();
782
+ this.mountFlag = true;
783
+ },
784
+ mapContainer: function mapContainer(to, container) {
785
+ this.containers[to] = container;
786
+ },
787
+ isMounted: function isMounted() {
788
+ return this.mountFlag;
789
+ },
790
+ isInitialized: function isInitialized() {
791
+ return this.initialized;
792
+ },
793
+ initStateFromHash: function initStateFromHash() {
794
+ var _this = this;
795
+
796
+ var hash = this.getHash();
797
+ if (hash) {
798
+ window.setTimeout(function () {
799
+ _this.scrollTo(hash, true);
800
+ _this.initialized = true;
801
+ }, 10);
802
+ } else {
803
+ this.initialized = true;
804
+ }
805
+ },
806
+ scrollTo: function scrollTo(to, isInit) {
807
+ var scroller = this.scroller;
808
+ var element = scroller.get(to);
809
+ if (element && (isInit || to !== scroller.getActiveLink())) {
810
+ var container = this.containers[to] || document;
811
+ scroller.scrollTo(to, { container: container });
812
+ }
813
+ },
814
+ getHash: function getHash() {
815
+ return _utils2.default.getHash();
816
+ },
817
+ changeHash: function changeHash(to, saveHashHistory) {
818
+ if (this.isInitialized() && _utils2.default.getHash() !== to) {
819
+ _utils2.default.updateHash(to, saveHashHistory);
820
+ }
821
+ },
822
+ handleHashChange: function handleHashChange() {
823
+ this.scrollTo(this.getHash());
824
+ },
825
+ unmount: function unmount() {
826
+ this.scroller = null;
827
+ this.containers = null;
828
+ window.removeEventListener('hashchange', this.handleHashChange);
829
+ }
830
+ };
831
+
832
+ scrollHash$2.default = scrollHash$1;
833
+
834
+ Object.defineProperty(scrollLink, "__esModule", {
835
+ value: true
836
+ });
837
+
838
+ var _extends$3 = 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; };
839
+
840
+ var _createClass$4 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
841
+
842
+ var _react$4 = React__default;
843
+
844
+ var _react2$4 = _interopRequireDefault$5(_react$4);
845
+
846
+ var _scrollSpy$1 = scrollSpy$2;
847
+
848
+ var _scrollSpy2$1 = _interopRequireDefault$5(_scrollSpy$1);
849
+
850
+ var _scroller$2 = scroller;
851
+
852
+ var _scroller2$2 = _interopRequireDefault$5(_scroller$2);
853
+
854
+ var _propTypes$2 = PropTypes$1;
855
+
856
+ var _propTypes2$2 = _interopRequireDefault$5(_propTypes$2);
857
+
858
+ var _scrollHash = scrollHash$2;
859
+
860
+ var _scrollHash2 = _interopRequireDefault$5(_scrollHash);
861
+
862
+ function _interopRequireDefault$5(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
863
+
864
+ function _classCallCheck$5(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
865
+
866
+ function _possibleConstructorReturn$5(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
867
+
868
+ function _inherits$5(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
869
+
870
+ var protoTypes$1 = {
871
+ to: _propTypes2$2.default.string.isRequired,
872
+ containerId: _propTypes2$2.default.string,
873
+ container: _propTypes2$2.default.object,
874
+ activeClass: _propTypes2$2.default.string,
875
+ activeStyle: _propTypes2$2.default.object,
876
+ spy: _propTypes2$2.default.bool,
877
+ horizontal: _propTypes2$2.default.bool,
878
+ smooth: _propTypes2$2.default.oneOfType([_propTypes2$2.default.bool, _propTypes2$2.default.string]),
879
+ offset: _propTypes2$2.default.number,
880
+ delay: _propTypes2$2.default.number,
881
+ isDynamic: _propTypes2$2.default.bool,
882
+ onClick: _propTypes2$2.default.func,
883
+ duration: _propTypes2$2.default.oneOfType([_propTypes2$2.default.number, _propTypes2$2.default.func]),
884
+ absolute: _propTypes2$2.default.bool,
885
+ onSetActive: _propTypes2$2.default.func,
886
+ onSetInactive: _propTypes2$2.default.func,
887
+ ignoreCancelEvents: _propTypes2$2.default.bool,
888
+ hashSpy: _propTypes2$2.default.bool,
889
+ saveHashHistory: _propTypes2$2.default.bool,
890
+ spyThrottle: _propTypes2$2.default.number
891
+ };
892
+
893
+ scrollLink.default = function (Component, customScroller) {
894
+
895
+ var scroller = customScroller || _scroller2$2.default;
896
+
897
+ var Link = function (_React$PureComponent) {
898
+ _inherits$5(Link, _React$PureComponent);
899
+
900
+ function Link(props) {
901
+ _classCallCheck$5(this, Link);
902
+
903
+ var _this = _possibleConstructorReturn$5(this, (Link.__proto__ || Object.getPrototypeOf(Link)).call(this, props));
904
+
905
+ _initialiseProps.call(_this);
906
+
907
+ _this.state = {
908
+ active: false
909
+ };
910
+ return _this;
911
+ }
912
+
913
+ _createClass$4(Link, [{
914
+ key: 'getScrollSpyContainer',
915
+ value: function getScrollSpyContainer() {
916
+ var containerId = this.props.containerId;
917
+ var container = this.props.container;
918
+
919
+ if (containerId && !container) {
920
+ return document.getElementById(containerId);
921
+ }
922
+
923
+ if (container && container.nodeType) {
924
+ return container;
925
+ }
926
+
927
+ return document;
928
+ }
929
+ }, {
930
+ key: 'componentDidMount',
931
+ value: function componentDidMount() {
932
+ if (this.props.spy || this.props.hashSpy) {
933
+ var scrollSpyContainer = this.getScrollSpyContainer();
934
+
935
+ if (!_scrollSpy2$1.default.isMounted(scrollSpyContainer)) {
936
+ _scrollSpy2$1.default.mount(scrollSpyContainer, this.props.spyThrottle);
937
+ }
938
+
939
+ if (this.props.hashSpy) {
940
+ if (!_scrollHash2.default.isMounted()) {
941
+ _scrollHash2.default.mount(scroller);
942
+ }
943
+ _scrollHash2.default.mapContainer(this.props.to, scrollSpyContainer);
944
+ }
945
+
946
+ _scrollSpy2$1.default.addSpyHandler(this.spyHandler, scrollSpyContainer);
947
+
948
+ this.setState({
949
+ container: scrollSpyContainer
950
+ });
951
+ }
952
+ }
953
+ }, {
954
+ key: 'componentWillUnmount',
955
+ value: function componentWillUnmount() {
956
+ _scrollSpy2$1.default.unmount(this.stateHandler, this.spyHandler);
957
+ }
958
+ }, {
959
+ key: 'render',
960
+ value: function render() {
961
+ var className = "";
962
+
963
+ if (this.state && this.state.active) {
964
+ className = ((this.props.className || "") + " " + (this.props.activeClass || "active")).trim();
965
+ } else {
966
+ className = this.props.className;
967
+ }
968
+
969
+ var style = {};
970
+
971
+ if (this.state && this.state.active) {
972
+ style = _extends$3({}, this.props.style, this.props.activeStyle);
973
+ } else {
974
+ style = _extends$3({}, this.props.style);
975
+ }
976
+
977
+ var props = _extends$3({}, this.props);
978
+
979
+ for (var prop in protoTypes$1) {
980
+ if (props.hasOwnProperty(prop)) {
981
+ delete props[prop];
982
+ }
983
+ }
984
+
985
+ props.className = className;
986
+ props.style = style;
987
+ props.onClick = this.handleClick;
988
+
989
+ return _react2$4.default.createElement(Component, props);
990
+ }
991
+ }]);
992
+
993
+ return Link;
994
+ }(_react2$4.default.PureComponent);
995
+
996
+ var _initialiseProps = function _initialiseProps() {
997
+ var _this2 = this;
998
+
999
+ this.scrollTo = function (to, props) {
1000
+ scroller.scrollTo(to, _extends$3({}, _this2.state, props));
1001
+ };
1002
+
1003
+ this.handleClick = function (event) {
1004
+
1005
+ /*
1006
+ * give the posibility to override onClick
1007
+ */
1008
+
1009
+ if (_this2.props.onClick) {
1010
+ _this2.props.onClick(event);
1011
+ }
1012
+
1013
+ /*
1014
+ * dont bubble the navigation
1015
+ */
1016
+
1017
+ if (event.stopPropagation) event.stopPropagation();
1018
+ if (event.preventDefault) event.preventDefault();
1019
+
1020
+ /*
1021
+ * do the magic!
1022
+ */
1023
+ _this2.scrollTo(_this2.props.to, _this2.props);
1024
+ };
1025
+
1026
+ this.spyHandler = function (x, y) {
1027
+ var scrollSpyContainer = _this2.getScrollSpyContainer();
1028
+
1029
+ if (_scrollHash2.default.isMounted() && !_scrollHash2.default.isInitialized()) {
1030
+ return;
1031
+ }
1032
+
1033
+ var horizontal = _this2.props.horizontal;
1034
+
1035
+ var to = _this2.props.to;
1036
+ var element = null;
1037
+ var isInside = void 0;
1038
+ var isOutside = void 0;
1039
+
1040
+ if (horizontal) {
1041
+ var elemLeftBound = 0;
1042
+ var elemRightBound = 0;
1043
+ var containerLeft = 0;
1044
+
1045
+ if (scrollSpyContainer.getBoundingClientRect) {
1046
+ var containerCords = scrollSpyContainer.getBoundingClientRect();
1047
+ containerLeft = containerCords.left;
1048
+ }
1049
+
1050
+ if (!element || _this2.props.isDynamic) {
1051
+ element = scroller.get(to);
1052
+ if (!element) {
1053
+ return;
1054
+ }
1055
+
1056
+ var cords = element.getBoundingClientRect();
1057
+ elemLeftBound = cords.left - containerLeft + x;
1058
+ elemRightBound = elemLeftBound + cords.width;
1059
+ }
1060
+
1061
+ var offsetX = x - _this2.props.offset;
1062
+ isInside = offsetX >= Math.floor(elemLeftBound) && offsetX < Math.floor(elemRightBound);
1063
+ isOutside = offsetX < Math.floor(elemLeftBound) || offsetX >= Math.floor(elemRightBound);
1064
+ } else {
1065
+ var elemTopBound = 0;
1066
+ var elemBottomBound = 0;
1067
+ var containerTop = 0;
1068
+
1069
+ if (scrollSpyContainer.getBoundingClientRect) {
1070
+ var _containerCords = scrollSpyContainer.getBoundingClientRect();
1071
+ containerTop = _containerCords.top;
1072
+ }
1073
+
1074
+ if (!element || _this2.props.isDynamic) {
1075
+ element = scroller.get(to);
1076
+ if (!element) {
1077
+ return;
1078
+ }
1079
+
1080
+ var _cords = element.getBoundingClientRect();
1081
+ elemTopBound = _cords.top - containerTop + y;
1082
+ elemBottomBound = elemTopBound + _cords.height;
1083
+ }
1084
+
1085
+ var offsetY = y - _this2.props.offset;
1086
+ isInside = offsetY >= Math.floor(elemTopBound) && offsetY < Math.floor(elemBottomBound);
1087
+ isOutside = offsetY < Math.floor(elemTopBound) || offsetY >= Math.floor(elemBottomBound);
1088
+ }
1089
+
1090
+ var activeLink = scroller.getActiveLink();
1091
+
1092
+ if (isOutside) {
1093
+ if (to === activeLink) {
1094
+ scroller.setActiveLink(void 0);
1095
+ }
1096
+
1097
+ if (_this2.props.hashSpy && _scrollHash2.default.getHash() === to) {
1098
+ var _props$saveHashHistor = _this2.props.saveHashHistory,
1099
+ saveHashHistory = _props$saveHashHistor === undefined ? false : _props$saveHashHistor;
1100
+
1101
+ _scrollHash2.default.changeHash("", saveHashHistory);
1102
+ }
1103
+
1104
+ if (_this2.props.spy && _this2.state.active) {
1105
+ _this2.setState({ active: false });
1106
+ _this2.props.onSetInactive && _this2.props.onSetInactive(to, element);
1107
+ }
1108
+ }
1109
+
1110
+ if (isInside && (activeLink !== to || _this2.state.active === false)) {
1111
+ scroller.setActiveLink(to);
1112
+
1113
+ var _props$saveHashHistor2 = _this2.props.saveHashHistory,
1114
+ _saveHashHistory = _props$saveHashHistor2 === undefined ? false : _props$saveHashHistor2;
1115
+
1116
+ _this2.props.hashSpy && _scrollHash2.default.changeHash(to, _saveHashHistory);
1117
+
1118
+ if (_this2.props.spy) {
1119
+ _this2.setState({ active: true });
1120
+ _this2.props.onSetActive && _this2.props.onSetActive(to, element);
1121
+ }
1122
+ }
1123
+ };
1124
+ };
1125
+
1126
+ Link.propTypes = protoTypes$1;
1127
+
1128
+ Link.defaultProps = { offset: 0 };
1129
+
1130
+ return Link;
1131
+ };
1132
+
1133
+ Object.defineProperty(Link$1, "__esModule", {
1134
+ value: true
1135
+ });
1136
+
1137
+ var _react$3 = React__default;
1138
+
1139
+ var _react2$3 = _interopRequireDefault$4(_react$3);
1140
+
1141
+ var _scrollLink$2 = scrollLink;
1142
+
1143
+ var _scrollLink2$2 = _interopRequireDefault$4(_scrollLink$2);
1144
+
1145
+ function _interopRequireDefault$4(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1146
+
1147
+ function _classCallCheck$4(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1148
+
1149
+ function _possibleConstructorReturn$4(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
1150
+
1151
+ function _inherits$4(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1152
+
1153
+ var LinkElement = function (_React$Component) {
1154
+ _inherits$4(LinkElement, _React$Component);
1155
+
1156
+ function LinkElement() {
1157
+ var _ref;
1158
+
1159
+ var _temp, _this, _ret;
1160
+
1161
+ _classCallCheck$4(this, LinkElement);
1162
+
1163
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
1164
+ args[_key] = arguments[_key];
1165
+ }
1166
+
1167
+ return _ret = (_temp = (_this = _possibleConstructorReturn$4(this, (_ref = LinkElement.__proto__ || Object.getPrototypeOf(LinkElement)).call.apply(_ref, [this].concat(args))), _this), _this.render = function () {
1168
+ return _react2$3.default.createElement(
1169
+ 'a',
1170
+ _this.props,
1171
+ _this.props.children
1172
+ );
1173
+ }, _temp), _possibleConstructorReturn$4(_this, _ret);
1174
+ }
1175
+
1176
+ return LinkElement;
1177
+ }(_react2$3.default.Component);
1178
+
1179
+ Link$1.default = (0, _scrollLink2$2.default)(LinkElement);
1180
+
1181
+ var Button = {};
1182
+
1183
+ Object.defineProperty(Button, "__esModule", {
1184
+ value: true
1185
+ });
1186
+
1187
+ var _createClass$3 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
1188
+
1189
+ var _react$2 = React__default;
1190
+
1191
+ var _react2$2 = _interopRequireDefault$3(_react$2);
1192
+
1193
+ var _scrollLink$1 = scrollLink;
1194
+
1195
+ var _scrollLink2$1 = _interopRequireDefault$3(_scrollLink$1);
1196
+
1197
+ function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1198
+
1199
+ function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1200
+
1201
+ function _possibleConstructorReturn$3(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
1202
+
1203
+ function _inherits$3(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1204
+
1205
+ var ButtonElement = function (_React$Component) {
1206
+ _inherits$3(ButtonElement, _React$Component);
1207
+
1208
+ function ButtonElement() {
1209
+ _classCallCheck$3(this, ButtonElement);
1210
+
1211
+ return _possibleConstructorReturn$3(this, (ButtonElement.__proto__ || Object.getPrototypeOf(ButtonElement)).apply(this, arguments));
1212
+ }
1213
+
1214
+ _createClass$3(ButtonElement, [{
1215
+ key: 'render',
1216
+ value: function render() {
1217
+ return _react2$2.default.createElement(
1218
+ 'button',
1219
+ this.props,
1220
+ this.props.children
1221
+ );
1222
+ }
1223
+ }]);
1224
+
1225
+ return ButtonElement;
1226
+ }(_react2$2.default.Component);
1227
+
1228
+ Button.default = (0, _scrollLink2$1.default)(ButtonElement);
1229
+
1230
+ var Element = {};
1231
+
1232
+ var scrollElement = {};
1233
+
1234
+ Object.defineProperty(scrollElement, "__esModule", {
1235
+ value: true
1236
+ });
1237
+
1238
+ var _extends$2 = 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; };
1239
+
1240
+ var _createClass$2 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
1241
+
1242
+ var _react$1 = React__default;
1243
+
1244
+ var _react2$1 = _interopRequireDefault$2(_react$1);
1245
+
1246
+ var _reactDom = ReactDOM__default;
1247
+
1248
+ _interopRequireDefault$2(_reactDom);
1249
+
1250
+ var _scroller$1 = scroller;
1251
+
1252
+ var _scroller2$1 = _interopRequireDefault$2(_scroller$1);
1253
+
1254
+ var _propTypes$1 = PropTypes$1;
1255
+
1256
+ var _propTypes2$1 = _interopRequireDefault$2(_propTypes$1);
1257
+
1258
+ function _interopRequireDefault$2(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1259
+
1260
+ function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1261
+
1262
+ function _possibleConstructorReturn$2(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
1263
+
1264
+ function _inherits$2(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1265
+
1266
+ scrollElement.default = function (Component) {
1267
+ var Element = function (_React$Component) {
1268
+ _inherits$2(Element, _React$Component);
1269
+
1270
+ function Element(props) {
1271
+ _classCallCheck$2(this, Element);
1272
+
1273
+ var _this = _possibleConstructorReturn$2(this, (Element.__proto__ || Object.getPrototypeOf(Element)).call(this, props));
1274
+
1275
+ _this.childBindings = {
1276
+ domNode: null
1277
+ };
1278
+ return _this;
1279
+ }
1280
+
1281
+ _createClass$2(Element, [{
1282
+ key: 'componentDidMount',
1283
+ value: function componentDidMount() {
1284
+ if (typeof window === 'undefined') {
1285
+ return false;
1286
+ }
1287
+ this.registerElems(this.props.name);
1288
+ }
1289
+ }, {
1290
+ key: 'componentDidUpdate',
1291
+ value: function componentDidUpdate(prevProps) {
1292
+ if (this.props.name !== prevProps.name) {
1293
+ this.registerElems(this.props.name);
1294
+ }
1295
+ }
1296
+ }, {
1297
+ key: 'componentWillUnmount',
1298
+ value: function componentWillUnmount() {
1299
+ if (typeof window === 'undefined') {
1300
+ return false;
1301
+ }
1302
+ _scroller2$1.default.unregister(this.props.name);
1303
+ }
1304
+ }, {
1305
+ key: 'registerElems',
1306
+ value: function registerElems(name) {
1307
+ _scroller2$1.default.register(name, this.childBindings.domNode);
1308
+ }
1309
+ }, {
1310
+ key: 'render',
1311
+ value: function render() {
1312
+ return _react2$1.default.createElement(Component, _extends$2({}, this.props, { parentBindings: this.childBindings }));
1313
+ }
1314
+ }]);
1315
+
1316
+ return Element;
1317
+ }(_react2$1.default.Component);
1318
+
1319
+ Element.propTypes = {
1320
+ name: _propTypes2$1.default.string,
1321
+ id: _propTypes2$1.default.string
1322
+ };
1323
+
1324
+ return Element;
1325
+ };
1326
+
1327
+ Object.defineProperty(Element, "__esModule", {
1328
+ value: true
1329
+ });
1330
+
1331
+ var _extends$1 = 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; };
1332
+
1333
+ var _createClass$1 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
1334
+
1335
+ var _react = React__default;
1336
+
1337
+ var _react2 = _interopRequireDefault$1(_react);
1338
+
1339
+ var _scrollElement$1 = scrollElement;
1340
+
1341
+ var _scrollElement2$1 = _interopRequireDefault$1(_scrollElement$1);
1342
+
1343
+ var _propTypes = PropTypes$1;
1344
+
1345
+ var _propTypes2 = _interopRequireDefault$1(_propTypes);
1346
+
1347
+ function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1348
+
1349
+ function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1350
+
1351
+ function _possibleConstructorReturn$1(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
1352
+
1353
+ function _inherits$1(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1354
+
1355
+ var ElementWrapper = function (_React$Component) {
1356
+ _inherits$1(ElementWrapper, _React$Component);
1357
+
1358
+ function ElementWrapper() {
1359
+ _classCallCheck$1(this, ElementWrapper);
1360
+
1361
+ return _possibleConstructorReturn$1(this, (ElementWrapper.__proto__ || Object.getPrototypeOf(ElementWrapper)).apply(this, arguments));
1362
+ }
1363
+
1364
+ _createClass$1(ElementWrapper, [{
1365
+ key: 'render',
1366
+ value: function render() {
1367
+ var _this2 = this;
1368
+
1369
+ // Remove `parentBindings` and `name` from props
1370
+ var newProps = _extends$1({}, this.props);
1371
+ delete newProps.name;
1372
+ if (newProps.parentBindings) {
1373
+ delete newProps.parentBindings;
1374
+ }
1375
+
1376
+ return _react2.default.createElement(
1377
+ 'div',
1378
+ _extends$1({}, newProps, { ref: function ref(el) {
1379
+ _this2.props.parentBindings.domNode = el;
1380
+ } }),
1381
+ this.props.children
1382
+ );
1383
+ }
1384
+ }]);
1385
+
1386
+ return ElementWrapper;
1387
+ }(_react2.default.Component);
1388
+
1389
+ ElementWrapper.propTypes = {
1390
+ name: _propTypes2.default.string,
1391
+ id: _propTypes2.default.string
1392
+ };
1393
+
1394
+ Element.default = (0, _scrollElement2$1.default)(ElementWrapper);
1395
+
1396
+ /* DEPRECATED */
1397
+
1398
+ var _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; };
1399
+
1400
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
1401
+
1402
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1403
+
1404
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
1405
+
1406
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1407
+
1408
+ var React = React__default;
1409
+ var scrollSpy = scrollSpy$2;
1410
+ var defaultScroller = scroller;
1411
+ var PropTypes = PropTypes$1;
1412
+ var scrollHash = scrollHash$2;
1413
+
1414
+ var protoTypes = {
1415
+ to: PropTypes.string.isRequired,
1416
+ containerId: PropTypes.string,
1417
+ container: PropTypes.object,
1418
+ activeClass: PropTypes.string,
1419
+ spy: PropTypes.bool,
1420
+ smooth: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
1421
+ offset: PropTypes.number,
1422
+ delay: PropTypes.number,
1423
+ isDynamic: PropTypes.bool,
1424
+ onClick: PropTypes.func,
1425
+ duration: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
1426
+ absolute: PropTypes.bool,
1427
+ onSetActive: PropTypes.func,
1428
+ onSetInactive: PropTypes.func,
1429
+ ignoreCancelEvents: PropTypes.bool,
1430
+ hashSpy: PropTypes.bool,
1431
+ spyThrottle: PropTypes.number
1432
+ };
1433
+
1434
+ var Helpers = {
1435
+ Scroll: function Scroll(Component, customScroller) {
1436
+
1437
+ console.warn("Helpers.Scroll is deprecated since v1.7.0");
1438
+
1439
+ var scroller = customScroller || defaultScroller;
1440
+
1441
+ var Scroll = function (_React$Component) {
1442
+ _inherits(Scroll, _React$Component);
1443
+
1444
+ function Scroll(props) {
1445
+ _classCallCheck(this, Scroll);
1446
+
1447
+ var _this = _possibleConstructorReturn(this, (Scroll.__proto__ || Object.getPrototypeOf(Scroll)).call(this, props));
1448
+
1449
+ _initialiseProps.call(_this);
1450
+
1451
+ _this.state = {
1452
+ active: false
1453
+ };
1454
+ return _this;
1455
+ }
1456
+
1457
+ _createClass(Scroll, [{
1458
+ key: 'getScrollSpyContainer',
1459
+ value: function getScrollSpyContainer() {
1460
+ var containerId = this.props.containerId;
1461
+ var container = this.props.container;
1462
+
1463
+ if (containerId) {
1464
+ return document.getElementById(containerId);
1465
+ }
1466
+
1467
+ if (container && container.nodeType) {
1468
+ return container;
1469
+ }
1470
+
1471
+ return document;
1472
+ }
1473
+ }, {
1474
+ key: 'componentDidMount',
1475
+ value: function componentDidMount() {
1476
+ if (this.props.spy || this.props.hashSpy) {
1477
+ var scrollSpyContainer = this.getScrollSpyContainer();
1478
+
1479
+ if (!scrollSpy.isMounted(scrollSpyContainer)) {
1480
+ scrollSpy.mount(scrollSpyContainer, this.props.spyThrottle);
1481
+ }
1482
+
1483
+ if (this.props.hashSpy) {
1484
+ if (!scrollHash.isMounted()) {
1485
+ scrollHash.mount(scroller);
1486
+ }
1487
+ scrollHash.mapContainer(this.props.to, scrollSpyContainer);
1488
+ }
1489
+
1490
+ if (this.props.spy) {
1491
+ scrollSpy.addStateHandler(this.stateHandler);
1492
+ }
1493
+
1494
+ scrollSpy.addSpyHandler(this.spyHandler, scrollSpyContainer);
1495
+
1496
+ this.setState({
1497
+ container: scrollSpyContainer
1498
+ });
1499
+ }
1500
+ }
1501
+ }, {
1502
+ key: 'componentWillUnmount',
1503
+ value: function componentWillUnmount() {
1504
+ scrollSpy.unmount(this.stateHandler, this.spyHandler);
1505
+ }
1506
+ }, {
1507
+ key: 'render',
1508
+ value: function render() {
1509
+ var className = "";
1510
+
1511
+ if (this.state && this.state.active) {
1512
+ className = ((this.props.className || "") + " " + (this.props.activeClass || "active")).trim();
1513
+ } else {
1514
+ className = this.props.className;
1515
+ }
1516
+
1517
+ var props = _extends({}, this.props);
1518
+
1519
+ for (var prop in protoTypes) {
1520
+ if (props.hasOwnProperty(prop)) {
1521
+ delete props[prop];
1522
+ }
1523
+ }
1524
+
1525
+ props.className = className;
1526
+ props.onClick = this.handleClick;
1527
+
1528
+ return React.createElement(Component, props);
1529
+ }
1530
+ }]);
1531
+
1532
+ return Scroll;
1533
+ }(React.Component);
1534
+
1535
+ var _initialiseProps = function _initialiseProps() {
1536
+ var _this2 = this;
1537
+
1538
+ this.scrollTo = function (to, props) {
1539
+ scroller.scrollTo(to, _extends({}, _this2.state, props));
1540
+ };
1541
+
1542
+ this.handleClick = function (event) {
1543
+
1544
+ /*
1545
+ * give the posibility to override onClick
1546
+ */
1547
+
1548
+ if (_this2.props.onClick) {
1549
+ _this2.props.onClick(event);
1550
+ }
1551
+
1552
+ /*
1553
+ * dont bubble the navigation
1554
+ */
1555
+
1556
+ if (event.stopPropagation) event.stopPropagation();
1557
+ if (event.preventDefault) event.preventDefault();
1558
+
1559
+ /*
1560
+ * do the magic!
1561
+ */
1562
+ _this2.scrollTo(_this2.props.to, _this2.props);
1563
+ };
1564
+
1565
+ this.stateHandler = function () {
1566
+ if (scroller.getActiveLink() !== _this2.props.to) {
1567
+ if (_this2.state !== null && _this2.state.active && _this2.props.onSetInactive) {
1568
+ _this2.props.onSetInactive();
1569
+ }
1570
+ _this2.setState({ active: false });
1571
+ }
1572
+ };
1573
+
1574
+ this.spyHandler = function (y) {
1575
+
1576
+ var scrollSpyContainer = _this2.getScrollSpyContainer();
1577
+
1578
+ if (scrollHash.isMounted() && !scrollHash.isInitialized()) {
1579
+ return;
1580
+ }
1581
+
1582
+ var to = _this2.props.to;
1583
+ var element = null;
1584
+ var elemTopBound = 0;
1585
+ var elemBottomBound = 0;
1586
+ var containerTop = 0;
1587
+
1588
+ if (scrollSpyContainer.getBoundingClientRect) {
1589
+ var containerCords = scrollSpyContainer.getBoundingClientRect();
1590
+ containerTop = containerCords.top;
1591
+ }
1592
+
1593
+ if (!element || _this2.props.isDynamic) {
1594
+ element = scroller.get(to);
1595
+ if (!element) {
1596
+ return;
1597
+ }
1598
+
1599
+ var cords = element.getBoundingClientRect();
1600
+ elemTopBound = cords.top - containerTop + y;
1601
+ elemBottomBound = elemTopBound + cords.height;
1602
+ }
1603
+
1604
+ var offsetY = y - _this2.props.offset;
1605
+ var isInside = offsetY >= Math.floor(elemTopBound) && offsetY < Math.floor(elemBottomBound);
1606
+ var isOutside = offsetY < Math.floor(elemTopBound) || offsetY >= Math.floor(elemBottomBound);
1607
+ var activeLink = scroller.getActiveLink();
1608
+
1609
+ if (isOutside) {
1610
+ if (to === activeLink) {
1611
+ scroller.setActiveLink(void 0);
1612
+ }
1613
+
1614
+ if (_this2.props.hashSpy && scrollHash.getHash() === to) {
1615
+ scrollHash.changeHash();
1616
+ }
1617
+
1618
+ if (_this2.props.spy && _this2.state.active) {
1619
+ _this2.setState({ active: false });
1620
+ _this2.props.onSetInactive && _this2.props.onSetInactive();
1621
+ }
1622
+
1623
+ return scrollSpy.updateStates();
1624
+ }
1625
+
1626
+ if (isInside && activeLink !== to) {
1627
+ scroller.setActiveLink(to);
1628
+
1629
+ _this2.props.hashSpy && scrollHash.changeHash(to);
1630
+
1631
+ if (_this2.props.spy) {
1632
+ _this2.setState({ active: true });
1633
+ _this2.props.onSetActive && _this2.props.onSetActive(to);
1634
+ }
1635
+ return scrollSpy.updateStates();
1636
+ }
1637
+ };
1638
+ };
1639
+
1640
+ Scroll.propTypes = protoTypes;
1641
+
1642
+ Scroll.defaultProps = { offset: 0 };
1643
+
1644
+ return Scroll;
1645
+ },
1646
+ Element: function Element(Component) {
1647
+
1648
+ console.warn("Helpers.Element is deprecated since v1.7.0");
1649
+
1650
+ var Element = function (_React$Component2) {
1651
+ _inherits(Element, _React$Component2);
1652
+
1653
+ function Element(props) {
1654
+ _classCallCheck(this, Element);
1655
+
1656
+ var _this3 = _possibleConstructorReturn(this, (Element.__proto__ || Object.getPrototypeOf(Element)).call(this, props));
1657
+
1658
+ _this3.childBindings = {
1659
+ domNode: null
1660
+ };
1661
+ return _this3;
1662
+ }
1663
+
1664
+ _createClass(Element, [{
1665
+ key: 'componentDidMount',
1666
+ value: function componentDidMount() {
1667
+ if (typeof window === 'undefined') {
1668
+ return false;
1669
+ }
1670
+ this.registerElems(this.props.name);
1671
+ }
1672
+ }, {
1673
+ key: 'componentDidUpdate',
1674
+ value: function componentDidUpdate(prevProps) {
1675
+ if (this.props.name !== prevProps.name) {
1676
+ this.registerElems(this.props.name);
1677
+ }
1678
+ }
1679
+ }, {
1680
+ key: 'componentWillUnmount',
1681
+ value: function componentWillUnmount() {
1682
+ if (typeof window === 'undefined') {
1683
+ return false;
1684
+ }
1685
+ defaultScroller.unregister(this.props.name);
1686
+ }
1687
+ }, {
1688
+ key: 'registerElems',
1689
+ value: function registerElems(name) {
1690
+ defaultScroller.register(name, this.childBindings.domNode);
1691
+ }
1692
+ }, {
1693
+ key: 'render',
1694
+ value: function render() {
1695
+ return React.createElement(Component, _extends({}, this.props, { parentBindings: this.childBindings }));
1696
+ }
1697
+ }]);
1698
+
1699
+ return Element;
1700
+ }(React.Component);
1701
+
1702
+ Element.propTypes = {
1703
+ name: PropTypes.string,
1704
+ id: PropTypes.string
1705
+ };
1706
+
1707
+ return Element;
1708
+ }
1709
+ };
1710
+
1711
+ var Helpers_1 = Helpers;
1712
+
1713
+ Object.defineProperty(modules, "__esModule", {
1714
+ value: true
1715
+ });
1716
+ modules.Helpers = modules.ScrollElement = ScrollLink = modules.ScrollLink = modules.animateScroll = modules.scrollSpy = modules.Events = modules.scroller = modules.Element = modules.Button = modules.Link = undefined;
1717
+
1718
+ var _Link = Link$1;
1719
+
1720
+ var _Link2 = _interopRequireDefault(_Link);
1721
+
1722
+ var _Button = Button;
1723
+
1724
+ var _Button2 = _interopRequireDefault(_Button);
1725
+
1726
+ var _Element = Element;
1727
+
1728
+ var _Element2 = _interopRequireDefault(_Element);
1729
+
1730
+ var _scroller = scroller;
1731
+
1732
+ var _scroller2 = _interopRequireDefault(_scroller);
1733
+
1734
+ var _scrollEvents = scrollEvents;
1735
+
1736
+ var _scrollEvents2 = _interopRequireDefault(_scrollEvents);
1737
+
1738
+ var _scrollSpy = scrollSpy$2;
1739
+
1740
+ var _scrollSpy2 = _interopRequireDefault(_scrollSpy);
1741
+
1742
+ var _animateScroll = animateScroll$1;
1743
+
1744
+ var _animateScroll2 = _interopRequireDefault(_animateScroll);
1745
+
1746
+ var _scrollLink = scrollLink;
1747
+
1748
+ var _scrollLink2 = _interopRequireDefault(_scrollLink);
1749
+
1750
+ var _scrollElement = scrollElement;
1751
+
1752
+ var _scrollElement2 = _interopRequireDefault(_scrollElement);
1753
+
1754
+ var _Helpers = Helpers_1;
1755
+
1756
+ var _Helpers2 = _interopRequireDefault(_Helpers);
1757
+
1758
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1759
+
1760
+ modules.Link = _Link2.default;
1761
+ modules.Button = _Button2.default;
1762
+ modules.Element = _Element2.default;
1763
+ modules.scroller = _scroller2.default;
1764
+ modules.Events = _scrollEvents2.default;
1765
+ modules.scrollSpy = _scrollSpy2.default;
1766
+ modules.animateScroll = _animateScroll2.default;
1767
+ var ScrollLink = modules.ScrollLink = _scrollLink2.default;
1768
+ modules.ScrollElement = _scrollElement2.default;
1769
+ modules.Helpers = _Helpers2.default;
1770
+ modules.default = { Link: _Link2.default, Button: _Button2.default, Element: _Element2.default, scroller: _scroller2.default, Events: _scrollEvents2.default, scrollSpy: _scrollSpy2.default, animateScroll: _animateScroll2.default, ScrollLink: _scrollLink2.default, ScrollElement: _scrollElement2.default, Helpers: _Helpers2.default };
1771
+
1772
+ var linkConfig = {
1773
+ LinkComponent: 'a',
1774
+ setLinkComponent: function (newComponent) {
1775
+ linkConfig.LinkComponent = newComponent;
1776
+ },
1777
+ };
1778
+ function Link(props) {
1779
+ var after = props.after, before = props.before, children = props.children, className = props.className, LinkComponent = props.LinkComponent, href = props.href, link = props.link, target = props.target, rel = props.rel, text = props.text, _a = props.underline, underline = _a === void 0 ? 'underline' : _a, onClick = props.onClick, onMouseDown = props.onMouseDown;
1780
+ var directionClass = useDeviceTargetClass(props, {
1781
+ prefix: 'link_direction_',
1782
+ propsKey: 'direction',
1783
+ });
1784
+ var sizeClass = useDeviceTargetClass(props, {
1785
+ prefix: 'text_size_',
1786
+ propsKey: 'size',
1787
+ });
1788
+ var textColorClass = useDeviceTargetClass(props, {
1789
+ prefix: 'text-color_',
1790
+ propsKey: 'textColor',
1791
+ });
1792
+ var fillClass = useDeviceTargetClass(props, {
1793
+ prefix: 'fill_',
1794
+ propsKey: 'fill',
1795
+ });
1796
+ var svgFillClass = useDeviceTargetClass(props, {
1797
+ prefix: 'svg_fill_',
1798
+ propsKey: 'svgFill',
1799
+ });
1800
+ var svgFillHoverClass = useDeviceTargetClass(props, {
1801
+ prefix: 'svg_fill_hover_',
1802
+ propsKey: 'svgFillHover',
1803
+ });
1804
+ var weightClass = useDeviceTargetClass(props, {
1805
+ prefix: 'text-weight_',
1806
+ propsKey: 'textWeight',
1807
+ });
1808
+ var textColorHoverClass = useDeviceTargetClass(props, {
1809
+ prefix: 'text-color_hover_',
1810
+ propsKey: 'textColorHover',
1811
+ });
1812
+ var textStyleClass = useDeviceTargetClass(props, {
1813
+ prefix: 'text-style_',
1814
+ propsKey: 'textColorHover',
1815
+ });
1816
+ var textGradientClass = useDeviceTargetClass(props, {
1817
+ prefix: 'text-gradient_',
1818
+ propsKey: 'textGradient',
1819
+ });
1820
+ var widthClass = useDeviceTargetClass(props, {
1821
+ prefix: 'width_',
1822
+ propsKey: 'width',
1823
+ });
1824
+ var heightClass = useDeviceTargetClass(props, {
1825
+ prefix: 'height_',
1826
+ propsKey: 'height',
1827
+ });
1828
+ // @ts-expect-error
1829
+ var styles = useStyles(props).styles;
1830
+ return (jsxRuntimeExports.jsxs(LinkWrapper, { className: clsx(className, 'link', widthClass, heightClass, directionClass, sizeClass, svgFillClass, svgFillHoverClass, underline && "link_underline_".concat(underline), 'text', (textColorClass ||
1831
+ textColorHoverClass ||
1832
+ textGradientClass ||
1833
+ textStyleClass ||
1834
+ weightClass) &&
1835
+ 'text', textColorClass, textColorHoverClass, textGradientClass, textStyleClass, weightClass, fillClass), Component: LinkComponent, href: href || link, rel: rel, style: styles, target: target, onClick: onClick, onMouseDown: onMouseDown, children: [before, children || text, after] }));
1836
+ }
1837
+ Link.defaultProps = {
1838
+ underline: 'underline',
1839
+ };
1840
+ // Wrapper with "Link" by condition
1841
+ function LinkWrapper(props) {
1842
+ var children = props.children, Component = props.Component, DefaultComponent = props.DefaultComponent, href = props.href, target = props.target, rel = props.rel, otherProps = __rest(props, ["children", "Component", "DefaultComponent", "href", "target", "rel"]);
1843
+ if (href) {
1844
+ // If href passed, make link-wrapper
1845
+ var LinkComponent = Component || linkConfig.LinkComponent;
1846
+ if (LinkComponent) {
1847
+ return (jsxRuntimeExports.jsx(LinkComponent, __assign({ href: href, rel: rel, target: target }, otherProps, { children: children })));
1848
+ }
1849
+ }
1850
+ else if (DefaultComponent) {
1851
+ // If has default "Component" - render it
1852
+ return jsxRuntimeExports.jsx(DefaultComponent, __assign({}, otherProps, { children: children }));
1853
+ }
1854
+ // Return children and pass current props to
1855
+ return React__default.Children.toArray(children)
1856
+ .filter(Boolean)
1857
+ .map(function (child) {
1858
+ return React__default.isValidElement(child) ? React__default.cloneElement(child, otherProps) : child;
1859
+ });
1860
+ }
1861
+ // @ts-expect-error
1862
+ var LinkScrollable = ScrollLink(Link);
1863
+
1864
+ export { Link as L, LinkWrapper as a, LinkScrollable as b, linkConfig as l };