@ssa-ui-kit/hooks 2.32.0-canary-d213a33-20251219 → 2.32.0-canary-f90c17a-20251231

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssa-ui-kit/hooks",
3
- "version": "2.32.0-canary-d213a33-20251219",
3
+ "version": "2.32.0-canary-f90c17a-20251231",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "private": false,
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "usehooks-ts": "3.1.1",
26
- "@ssa-ui-kit/utils": "^2.32.0-canary-d213a33-20251219"
26
+ "@ssa-ui-kit/utils": "^2.32.0-canary-f90c17a-20251231"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "react": "18.x || 19.x"
@@ -39,7 +39,7 @@
39
39
  "not op_mini all"
40
40
  ],
41
41
  "scripts": {
42
- "build": "webpack --mode=production --node-env=production && tsc --build --force && resolve-tspaths",
42
+ "build": "tsc --build --force && resolve-tspaths",
43
43
  "ts-show-config": "tsc --showConfig -p ./tsconfig.json",
44
44
  "ts-check": "tsc -p ./tsconfig.json"
45
45
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
package/dist/index.js DELETED
@@ -1,465 +0,0 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory();
4
- else if(typeof define === 'function' && define.amd)
5
- define([], factory);
6
- else if(typeof exports === 'object')
7
- exports["SSAHooks"] = factory();
8
- else
9
- root["SSAHooks"] = factory();
10
- })(self, () => {
11
- return /******/ (() => { // webpackBootstrap
12
- /******/ "use strict";
13
- /******/ // The require scope
14
- /******/ var __webpack_require__ = {};
15
- /******/
16
- /************************************************************************/
17
- /******/ /* webpack/runtime/define property getters */
18
- /******/ (() => {
19
- /******/ // define getter functions for harmony exports
20
- /******/ __webpack_require__.d = (exports, definition) => {
21
- /******/ for(var key in definition) {
22
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
23
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
24
- /******/ }
25
- /******/ }
26
- /******/ };
27
- /******/ })();
28
- /******/
29
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
30
- /******/ (() => {
31
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
32
- /******/ })();
33
- /******/
34
- /******/ /* webpack/runtime/make namespace object */
35
- /******/ (() => {
36
- /******/ // define __esModule on exports
37
- /******/ __webpack_require__.r = (exports) => {
38
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
39
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
40
- /******/ }
41
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
42
- /******/ };
43
- /******/ })();
44
- /******/
45
- /************************************************************************/
46
- var __webpack_exports__ = {};
47
- // ESM COMPAT FLAG
48
- __webpack_require__.r(__webpack_exports__);
49
-
50
- // EXPORTS
51
- __webpack_require__.d(__webpack_exports__, {
52
- createSafeContext: () => (/* reexport */ createSafeContext),
53
- useApi: () => (/* reexport */ useApi),
54
- useCallbackRef: () => (/* reexport */ useCallbackRef),
55
- useClickOutside: () => (/* reexport */ useClickOutside),
56
- useClipboard: () => (/* reexport */ useClipboard),
57
- useDebouncedCallback: () => (/* reexport */ useDebouncedCallback),
58
- useDeviceType: () => (/* reexport */ useDeviceType),
59
- useElementSize: () => (/* reexport */ useElementSize),
60
- useMinLGMediaQuery: () => (/* reexport */ useMinLGMediaQuery),
61
- useMinMDMediaQuery: () => (/* reexport */ useMinMDMediaQuery),
62
- useMinXLGMediaQuery: () => (/* reexport */ useMinXLGMediaQuery),
63
- usePaginationRange: () => (/* reexport */ usePaginationRange),
64
- useResizeObserver: () => (/* reexport */ useResizeObserver),
65
- useSMMediaQuery: () => (/* reexport */ useSMMediaQuery),
66
- useTextSizeDecrease: () => (/* reexport */ useTextSizeDecrease),
67
- useThrottledCallback: () => (/* reexport */ useThrottledCallback),
68
- useThrottledCallbackWithClearTimeout: () => (/* reexport */ useThrottledCallbackWithClearTimeout),
69
- useToggle: () => (/* reexport */ useToggle),
70
- useUncontrolled: () => (/* reexport */ useUncontrolled),
71
- useUpToMDMediaQuery: () => (/* reexport */ useUpToMDMediaQuery),
72
- useWindowSize: () => (/* reexport */ useWindowSize),
73
- useXSMediaQuery: () => (/* reexport */ useXSMediaQuery)
74
- });
75
-
76
- ;// external "react"
77
- const external_react_namespaceObject = require("react");
78
- ;// ./src/hooks/useApi.tsx
79
-
80
- function useApi(fetcherFn, initialValue) {
81
- const [isLoading, setIsLoading] = (0,external_react_namespaceObject.useState)(false);
82
- const [error, setError] = (0,external_react_namespaceObject.useState)(null);
83
- const [data, setData] = (0,external_react_namespaceObject.useState)(initialValue);
84
- const query = async (...args) => {
85
- setIsLoading(true);
86
- setError(null);
87
- try {
88
- const respData = await fetcherFn(...args);
89
- setData(respData);
90
- } catch (err) {
91
- setError(err);
92
- } finally {
93
- setIsLoading(false);
94
- }
95
- };
96
- return {
97
- isLoading,
98
- error,
99
- // TODO: useApi users should use type guards instead of "data as D"
100
- data: data,
101
- query
102
- };
103
- }
104
- ;// ./src/hooks/useWindowResize.tsx
105
-
106
- const useWindowSize = () => {
107
- const [windowSize, setWindowSize] = (0,external_react_namespaceObject.useState)({
108
- width: window.innerWidth,
109
- height: window.innerHeight
110
- });
111
- (0,external_react_namespaceObject.useEffect)(() => {
112
- function handleResize() {
113
- setWindowSize({
114
- width: window.innerWidth,
115
- height: window.innerHeight
116
- });
117
- }
118
- window.addEventListener('resize', handleResize);
119
- handleResize();
120
- return () => window.removeEventListener('resize', handleResize);
121
- }, []);
122
- return windowSize;
123
- };
124
- ;// ./src/hooks/useClickOutside.tsx
125
-
126
- const useClickOutside = (ref, onClickOutside) => {
127
- const events = ['mousedown', 'touchstart'];
128
- (0,external_react_namespaceObject.useEffect)(() => {
129
- const handler = e => {
130
- if (ref.current == null || ref.current.contains(e.target)) {
131
- return;
132
- }
133
- onClickOutside(e);
134
- };
135
- events.forEach(eventName => document.addEventListener(eventName, handler));
136
- return () => events.forEach(eventName => document.removeEventListener(eventName, handler));
137
- }, [ref, onClickOutside]);
138
- };
139
- ;// external "@ssa-ui-kit/utils"
140
- const utils_namespaceObject = require("@ssa-ui-kit/utils");
141
- ;// ./src/hooks/pagination/usePaginationRange.tsx
142
-
143
-
144
- const usePaginationRange = ({
145
- pagesCount,
146
- selectedPage
147
- }) => {
148
- return (0,external_react_namespaceObject.useMemo)(() => (0,utils_namespaceObject.generateRange)(pagesCount, selectedPage), [pagesCount, selectedPage]);
149
- };
150
-
151
- ;// ./src/hooks/text/useTextSizeDecrease.ts
152
-
153
-
154
- const FONT_SIZE_REG_EXP = /(\d+\.?\d+)(\S+)/;
155
- const isOverflowing = (el, container) => el.scrollWidth > Number(container?.clientWidth);
156
- const resize = (el, step) => {
157
- const fontSize = window.getComputedStyle(el).fontSize;
158
- const matchResults = fontSize.match(FONT_SIZE_REG_EXP);
159
- if (matchResults) {
160
- const [, fsValue, fsUnit] = matchResults;
161
- el.style.fontSize = `${Number(fsValue) - step}${fsUnit}`;
162
- }
163
- };
164
-
165
- /**
166
- * The hook does N attempts to decrease the font size
167
- * if its text content doesn't fit its parent's width.
168
- * If the text still overflows, it sets the `word-break` css rule.
169
- * The hook doesn't enlarge the font size if the parent's
170
- * width becomes wider.
171
- * */
172
- const useTextSizeDecrease = (maxAttempts = 5, step = 1) => {
173
- const textContainerRef = (0,external_react_namespaceObject.useRef)(null);
174
- const attemptsRef = (0,external_react_namespaceObject.useRef)(0);
175
- const {
176
- width
177
- } = useWindowSize();
178
- const checkAndResize = () => {
179
- if (textContainerRef.current == null) {
180
- return;
181
- }
182
- const node = textContainerRef.current;
183
- const parentNode = node.parentNode;
184
- let isLarger = isOverflowing(node, parentNode);
185
- while (attemptsRef.current < maxAttempts && isLarger) {
186
- resize(node, step);
187
- isLarger = isOverflowing(node, parentNode);
188
- ++attemptsRef.current;
189
- }
190
- if (isLarger) {
191
- node.style.wordBreak = 'break-all';
192
- }
193
- };
194
- (0,external_react_namespaceObject.useEffect)(() => {
195
- checkAndResize();
196
- }, [textContainerRef, width]);
197
- return textContainerRef;
198
- };
199
- ;// external "usehooks-ts"
200
- const external_usehooks_ts_namespaceObject = require("usehooks-ts");
201
- ;// ./src/hooks/useDeviceType.ts
202
-
203
- const useDeviceType = () => {
204
- const isMD = (0,external_usehooks_ts_namespaceObject.useMediaQuery)('(min-width: 900px)');
205
- const isLG = (0,external_usehooks_ts_namespaceObject.useMediaQuery)('(min-width: 1440px)');
206
- const isXLG = (0,external_usehooks_ts_namespaceObject.useMediaQuery)('(min-width: 1920px)');
207
- if (isXLG) {
208
- return 'xlg';
209
- }
210
- if (isLG) {
211
- return 'lg';
212
- }
213
- if (isMD) {
214
- return 'md';
215
- }
216
- return 'mobile';
217
- };
218
- ;// ./src/hooks/useToggle.ts
219
-
220
- function useToggle(options = [false, true]) {
221
- const [[option], toggle] = (0,external_react_namespaceObject.useReducer)((state, action) => {
222
- const value = action instanceof Function ? action(state[0]) : action;
223
- const index = Math.abs(state.indexOf(value));
224
- return state.slice(index).concat(state.slice(0, index));
225
- }, options);
226
- return [option, toggle];
227
- }
228
- ;// ./src/hooks/useUncontrolled.ts
229
-
230
- function useUncontrolled({
231
- value,
232
- defaultValue,
233
- finalValue,
234
- onChange = () => {}
235
- }) {
236
- const [uncontrolledValue, setUncontrolledValue] = (0,external_react_namespaceObject.useState)(defaultValue !== undefined ? defaultValue : finalValue);
237
- const handleUncontrolledChange = (val, ...payload) => {
238
- setUncontrolledValue(val);
239
- onChange?.(val, ...payload);
240
- };
241
- if (value !== undefined) {
242
- return [value, onChange, true];
243
- }
244
- return [uncontrolledValue, handleUncontrolledChange, false];
245
- }
246
- ;// ./src/hooks/useSafeContext.tsx
247
-
248
- function createSafeContext(errorMessage) {
249
- const Context = /*#__PURE__*/(0,external_react_namespaceObject.createContext)(null);
250
- const useSafeContext = () => {
251
- const ctx = (0,external_react_namespaceObject.useContext)(Context);
252
- if (ctx === null) {
253
- throw new Error(errorMessage);
254
- }
255
- return ctx;
256
- };
257
- const Provider = ({
258
- children,
259
- value
260
- }) => {
261
- return /*#__PURE__*/(0,external_react_namespaceObject.createElement)(Context.Provider, {
262
- value
263
- }, children);
264
- };
265
- return [Provider, useSafeContext];
266
- }
267
- ;// ./src/hooks/useResizeObserver.tsx
268
-
269
- const defaultState = {
270
- x: 0,
271
- y: 0,
272
- width: 0,
273
- height: 0,
274
- top: 0,
275
- left: 0,
276
- bottom: 0,
277
- right: 0
278
- };
279
- function useResizeObserver(options) {
280
- const frameID = (0,external_react_namespaceObject.useRef)(0);
281
- const ref = (0,external_react_namespaceObject.useRef)(null);
282
- const [rect, setRect] = (0,external_react_namespaceObject.useState)(defaultState);
283
- const observer = (0,external_react_namespaceObject.useMemo)(() => typeof window !== 'undefined' ? new ResizeObserver(entries => {
284
- const entry = entries[0];
285
- if (entry) {
286
- cancelAnimationFrame(frameID.current);
287
- frameID.current = requestAnimationFrame(() => {
288
- if (ref.current) {
289
- setRect(entry.contentRect);
290
- }
291
- });
292
- }
293
- }) : null, []);
294
- (0,external_react_namespaceObject.useEffect)(() => {
295
- if (ref.current) {
296
- observer?.observe(ref.current, options);
297
- }
298
- return () => {
299
- observer?.disconnect();
300
- if (frameID.current) {
301
- cancelAnimationFrame(frameID.current);
302
- }
303
- };
304
- }, [ref.current]);
305
- return [ref, rect];
306
- }
307
- function useElementSize(options) {
308
- const [ref, {
309
- width,
310
- height
311
- }] = useResizeObserver(options);
312
- return {
313
- ref,
314
- width,
315
- height
316
- };
317
- }
318
- ;// ./src/hooks/useCallbackRef.ts
319
-
320
- const useCallbackRef = callback => {
321
- const callbackRef = (0,external_react_namespaceObject.useRef)(callback);
322
- (0,external_react_namespaceObject.useEffect)(() => {
323
- callbackRef.current = callback;
324
- });
325
- return (0,external_react_namespaceObject.useMemo)(() => (...args) => callbackRef.current?.(...args), []);
326
- };
327
- ;// ./src/hooks/useDebouncedCallback.ts
328
-
329
-
330
- const useDebouncedCallback = (func, wait = 200) => {
331
- const timeoutRef = (0,external_react_namespaceObject.useRef)(null);
332
- const handleCallback = useCallbackRef(func);
333
- const executedFunction = (...args) => {
334
- if (timeoutRef.current) {
335
- clearTimeout(timeoutRef.current);
336
- }
337
- timeoutRef.current = setTimeout(() => {
338
- timeoutRef.current = null;
339
- handleCallback(...args);
340
- }, wait);
341
- };
342
- const cancel = function () {
343
- if (timeoutRef.current) {
344
- clearTimeout(timeoutRef.current);
345
- timeoutRef.current = null;
346
- }
347
- };
348
- return [executedFunction, cancel, timeoutRef.current];
349
- };
350
- ;// ./src/hooks/useClipboard.ts
351
-
352
- function useClipboard({
353
- timeout = 2000
354
- } = {}) {
355
- const [error, setError] = (0,external_react_namespaceObject.useState)(null);
356
- const [copied, setCopied] = (0,external_react_namespaceObject.useState)(false);
357
- const [copyTimeout, setCopyTimeout] = (0,external_react_namespaceObject.useState)(null);
358
- const handleCopyResult = value => {
359
- window.clearTimeout(copyTimeout);
360
- setCopyTimeout(window.setTimeout(() => setCopied(false), timeout));
361
- setCopied(value);
362
- };
363
- const copy = valueToCopy => {
364
- if ('clipboard' in navigator) {
365
- navigator.clipboard.writeText(valueToCopy).then(() => handleCopyResult(true)).catch(err => setError(err));
366
- } else {
367
- setError(new Error('useClipboard: navigator.clipboard is not supported'));
368
- }
369
- };
370
- const reset = () => {
371
- setCopied(false);
372
- setError(null);
373
- window.clearTimeout(copyTimeout);
374
- };
375
- return {
376
- copy,
377
- reset,
378
- error,
379
- copied
380
- };
381
- }
382
- ;// ./src/hooks/useThrottledCallback.ts
383
-
384
-
385
- function useThrottledCallbackWithClearTimeout(callback, wait) {
386
- const handleCallback = useCallbackRef(callback);
387
- const latestInArgsRef = (0,external_react_namespaceObject.useRef)(null);
388
- const latestOutArgsRef = (0,external_react_namespaceObject.useRef)(null);
389
- const active = (0,external_react_namespaceObject.useRef)(true);
390
- const waitRef = (0,external_react_namespaceObject.useRef)(wait);
391
- const timeoutRef = (0,external_react_namespaceObject.useRef)(-1);
392
- const clearTimeout = () => window.clearTimeout(timeoutRef.current);
393
- const callThrottledCallback = (0,external_react_namespaceObject.useCallback)((...args) => {
394
- handleCallback(...args);
395
- latestInArgsRef.current = args;
396
- latestOutArgsRef.current = args;
397
- active.current = false;
398
- }, [handleCallback]);
399
- const timerCallback = (0,external_react_namespaceObject.useCallback)(() => {
400
- if (latestInArgsRef.current && latestInArgsRef.current !== latestOutArgsRef.current) {
401
- callThrottledCallback(...latestInArgsRef.current);
402
- timeoutRef.current = window.setTimeout(timerCallback, waitRef.current);
403
- } else {
404
- active.current = true;
405
- }
406
- }, [callThrottledCallback]);
407
- const throttled = (0,external_react_namespaceObject.useCallback)((...args) => {
408
- if (active.current) {
409
- callThrottledCallback(...args);
410
- timeoutRef.current = window.setTimeout(timerCallback, waitRef.current);
411
- } else {
412
- latestInArgsRef.current = args;
413
- }
414
- }, [callThrottledCallback, timerCallback]);
415
- (0,external_react_namespaceObject.useEffect)(() => {
416
- waitRef.current = wait;
417
- }, [wait]);
418
- return [throttled, clearTimeout];
419
- }
420
- function useThrottledCallback(callback, wait) {
421
- return useThrottledCallbackWithClearTimeout(callback, wait)[0];
422
- }
423
- ;// ./src/hooks/mediaQueries.ts
424
-
425
- const useXSMediaQuery = () => {
426
- return (0,external_usehooks_ts_namespaceObject.useMediaQuery)('(max-width: 389.99px)');
427
- };
428
- const useSMMediaQuery = () => {
429
- return (0,external_usehooks_ts_namespaceObject.useMediaQuery)('(min-width: 390px)');
430
- };
431
- const useUpToMDMediaQuery = () => {
432
- return (0,external_usehooks_ts_namespaceObject.useMediaQuery)('(max-width: 899.99px)');
433
- };
434
- const useMinMDMediaQuery = () => {
435
- return (0,external_usehooks_ts_namespaceObject.useMediaQuery)('(min-width: 900px)');
436
- };
437
- const useMinLGMediaQuery = () => {
438
- return (0,external_usehooks_ts_namespaceObject.useMediaQuery)('(min-width: 1440px)');
439
- };
440
- const useMinXLGMediaQuery = () => {
441
- return (0,external_usehooks_ts_namespaceObject.useMediaQuery)('(min-width: 1920px)');
442
- };
443
- ;// ./src/hooks/index.ts
444
-
445
-
446
-
447
-
448
-
449
-
450
-
451
-
452
-
453
-
454
-
455
-
456
-
457
-
458
-
459
- ;// ./src/index.ts
460
-
461
- /******/ return __webpack_exports__;
462
- /******/ })()
463
- ;
464
- });
465
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;UCVA;UACA;;;;;WCDA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA,E;;;;;WCPA,wF;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D,E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACNA,MAAM,8BAA4B,oB;;ACAD;AAE1B,SAASC,MAAMA,CACpBC,SAAqC,EACrCC,YAAgB,EAChB;EACA,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGL,2CAAQ,CAAU,KAAK,CAAC;EAC1D,MAAM,CAACM,KAAK,EAAEC,QAAQ,CAAC,GAAGP,2CAAQ,CAAiB,IAAI,CAAC;EACxD,MAAM,CAACQ,IAAI,EAAEC,OAAO,CAAC,GAAGT,2CAAQ,CAAgBG,YAAY,CAAC;EAE7D,MAAMO,KAAK,GAAG,MAAAA,CAAO,GAAGC,IAAkC,KAAK;IAC7DN,YAAY,CAAC,IAAI,CAAC;IAClBE,QAAQ,CAAC,IAAI,CAAC;IAEd,I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GwG,IAAI;EACxB,CAAC,EAAE,CAACA,IAAI,CAAC,CAAC;EAEV,OAAO,CAAC8B,SAAS,EAAE1B,YAAY,CAAC;AAClC;AAEO,SAAS2B,oBAAoBA,CAClCnC,QAAW,EACXI,IAAY,EACZ;EACA,OAAOuB,oCAAoC,CAAC3B,QAAQ,EAAEI,IAAI,CAAC,CAAC,CAAC,CAAC;AAChE,C;;AC9D4C;AAErC,MAAMgC,eAAe,GAAGA,CAAA,KAAM;EACnC,OAAOnG,sDAAa,CAAC,uBAAuB,CAAC;AAC/C,CAAC;AAEM,MAAMoG,eAAe,GAAGA,CAAA,KAAM;EACnC,OAAOpG,sDAAa,CAAC,oBAAoB,CAAC;AAC5C,CAAC;AAEM,MAAMqG,mBAAmB,GAAGA,CAAA,KAAM;EACvC,OAAOrG,sDAAa,CAAC,uBAAuB,CAAC;AAC/C,CAAC;AAEM,MAAMsG,kBAAkB,GAAGA,CAAA,KAAM;EACtC,OAAOtG,sDAAa,CAAC,oBAAoB,CAAC;AAC5C,CAAC;AAEM,MAAMuG,kBAAkB,GAAGA,CAAA,KAAM;EACtC,OAAOvG,sDAAa,CAAC,qBAAqB,CAAC;AAC7C,CAAC;AAEM,MAAMwG,mBAAmB,GAAGA,CAAA,KAAM;EACvC,OAAOxG,sDAAa,CAAC,qBAAqB,CAAC;AAC7C,CAAC,C;;ACxBiC;AACgB;AACE;AACiB;AACJ;AACjB;AACR;AACY;AACC;AACmB;AACtB;AACY;AAChB;AAId","sources":["webpack://SSAHooks/webpack/universalModuleDefinition","webpack://SSAHooks/webpack/bootstrap","webpack://SSAHooks/webpack/runtime/define property getters","webpack://SSAHooks/webpack/runtime/hasOwnProperty shorthand","webpack://SSAHooks/webpack/runtime/make namespace object","webpack://SSAHooks/external commonjs \"react\"","webpack://SSAHooks/./src/hooks/useApi.tsx","webpack://SSAHooks/./src/hooks/useWindowResize.tsx","webpack://SSAHooks/./src/hooks/useClickOutside.tsx","webpack://SSAHooks/external commonjs \"@ssa-ui-kit/utils\"","webpack://SSAHooks/./src/hooks/pagination/usePaginationRange.tsx","webpack://SSAHooks/./src/hooks/text/useTextSizeDecrease.ts","webpack://SSAHooks/external commonjs \"usehooks-ts\"","webpack://SSAHooks/./src/hooks/useDeviceType.ts","webpack://SSAHooks/./src/hooks/useToggle.ts","webpack://SSAHooks/./src/hooks/useUncontrolled.ts","webpack://SSAHooks/./src/hooks/useSafeContext.tsx","webpack://SSAHooks/./src/hooks/useResizeObserver.tsx","webpack://SSAHooks/./src/hooks/useCallbackRef.ts","webpack://SSAHooks/./src/hooks/useDebouncedCallback.ts","webpack://SSAHooks/./src/hooks/useClipboard.ts","webpack://SSAHooks/./src/hooks/useThrottledCallback.ts","webpack://SSAHooks/./src/hooks/mediaQueries.ts","webpack://SSAHooks/./src/hooks/index.ts","webpack://SSAHooks/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"SSAHooks\"] = factory();\n\telse\n\t\troot[\"SSAHooks\"] = factory();\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react\");","import { useState } from 'react';\n\nexport function useApi<T extends unknown[], D>(\n fetcherFn: (...args: T) => Promise<D>,\n initialValue?: D,\n) {\n const [isLoading, setIsLoading] = useState<boolean>(false);\n const [error, setError] = useState<unknown | null>(null);\n const [data, setData] = useState<D | undefined>(initialValue);\n\n const query = async (...args: Parameters<typeof fetcherFn>) => {\n setIsLoading(true);\n setError(null);\n\n try {\n const respData = await fetcherFn(...args);\n setData(respData);\n } catch (err) {\n setError(err);\n } finally {\n setIsLoading(false);\n }\n };\n\n return {\n isLoading,\n error,\n // TODO: useApi users should use type guards instead of \"data as D\"\n data: data as D,\n query,\n };\n}\n","import { useEffect, useState } from 'react';\n\nexport const useWindowSize = () => {\n const [windowSize, setWindowSize] = useState({\n width: window.innerWidth,\n height: window.innerHeight,\n });\n\n useEffect(() => {\n function handleResize() {\n setWindowSize({ width: window.innerWidth, height: window.innerHeight });\n }\n\n window.addEventListener('resize', handleResize);\n\n handleResize();\n\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n return windowSize;\n};\n","import { useEffect } from 'react';\n\ntype UseClickOutsideType = (\n ref: React.RefObject<HTMLElement | null>,\n fn: (e: Event) => void,\n) => void;\n\nexport const useClickOutside: UseClickOutsideType = (ref, onClickOutside) => {\n const events = ['mousedown', 'touchstart'];\n\n useEffect(() => {\n const handler = (e: Event) => {\n if (\n ref.current == null ||\n ref.current.contains(e.target as HTMLElement)\n ) {\n return;\n }\n onClickOutside(e);\n };\n\n events.forEach((eventName) =>\n document.addEventListener(eventName, handler),\n );\n\n return () =>\n events.forEach((eventName) =>\n document.removeEventListener(eventName, handler),\n );\n }, [ref, onClickOutside]);\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@ssa-ui-kit/utils\");","import { useMemo } from 'react';\nimport { generateRange } from '@ssa-ui-kit/utils';\nimport { UsePaginationRangeProps } from './types';\n\nconst usePaginationRange = ({\n pagesCount,\n selectedPage,\n}: UsePaginationRangeProps) => {\n return useMemo(\n () => generateRange(pagesCount, selectedPage),\n [pagesCount, selectedPage],\n );\n};\n\nexport { usePaginationRange };\n","import { useEffect, useRef } from 'react';\nimport { useWindowSize } from '@hooks/useWindowResize';\n\nconst FONT_SIZE_REG_EXP = /(\\d+\\.?\\d+)(\\S+)/;\n\nconst isOverflowing = (\n el: HTMLElement,\n container: HTMLElement | null,\n): boolean => el.scrollWidth > Number(container?.clientWidth);\n\nconst resize = (el: HTMLElement, step: number) => {\n const fontSize = window.getComputedStyle(el).fontSize;\n const matchResults = fontSize.match(FONT_SIZE_REG_EXP);\n\n if (matchResults) {\n const [, fsValue, fsUnit] = matchResults;\n el.style.fontSize = `${Number(fsValue) - step}${fsUnit}`;\n }\n};\n\n/**\n * The hook does N attempts to decrease the font size\n * if its text content doesn't fit its parent's width.\n * If the text still overflows, it sets the `word-break` css rule.\n * The hook doesn't enlarge the font size if the parent's\n * width becomes wider.\n * */\nexport const useTextSizeDecrease = (maxAttempts = 5, step = 1) => {\n const textContainerRef = useRef<HTMLElement>(null);\n const attemptsRef = useRef<number>(0);\n const { width } = useWindowSize();\n\n const checkAndResize = () => {\n if (textContainerRef.current == null) {\n return;\n }\n\n const node = textContainerRef.current;\n const parentNode = node.parentNode as unknown as HTMLElement;\n\n let isLarger = isOverflowing(node, parentNode);\n\n while (attemptsRef.current < maxAttempts && isLarger) {\n resize(node, step);\n isLarger = isOverflowing(node, parentNode);\n ++attemptsRef.current;\n }\n\n if (isLarger) {\n node.style.wordBreak = 'break-all';\n }\n };\n\n useEffect(() => {\n checkAndResize();\n }, [textContainerRef, width]);\n\n return textContainerRef;\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"usehooks-ts\");","import { useMediaQuery } from 'usehooks-ts';\n\nexport const useDeviceType = () => {\n const isMD = useMediaQuery('(min-width: 900px)');\n const isLG = useMediaQuery('(min-width: 1440px)');\n const isXLG = useMediaQuery('(min-width: 1920px)');\n if (isXLG) {\n return 'xlg';\n }\n if (isLG) {\n return 'lg';\n }\n if (isMD) {\n return 'md';\n }\n return 'mobile';\n};\n","import { useReducer } from 'react';\n\nexport function useToggle<T = boolean>(\n options: readonly T[] = [false, true] as T[],\n) {\n const [[option], toggle] = useReducer(\n (state: T[], action: React.SetStateAction<T>) => {\n const value = action instanceof Function ? action(state[0]) : action;\n const index = Math.abs(state.indexOf(value));\n\n return state.slice(index).concat(state.slice(0, index));\n },\n options as T[],\n );\n\n return [option, toggle as (value?: React.SetStateAction<T>) => void] as const;\n}\n","import { useState } from 'react';\n\ninterface UseUncontrolledInput<T, P extends unknown[]> {\n value?: T;\n defaultValue?: T;\n finalValue?: T;\n onChange?: (value: T, ...payload: P) => void;\n}\n\nexport function useUncontrolled<T, P extends unknown[]>({\n value,\n defaultValue,\n finalValue,\n onChange = () => {},\n}: UseUncontrolledInput<T, P>): [\n T,\n (value: T, ...payload: P) => void,\n boolean,\n] {\n const [uncontrolledValue, setUncontrolledValue] = useState(\n defaultValue !== undefined ? defaultValue : finalValue,\n );\n\n const handleUncontrolledChange = (val: T, ...payload: P) => {\n setUncontrolledValue(val);\n onChange?.(val, ...payload);\n };\n\n if (value !== undefined) {\n return [value as T, onChange, true];\n }\n\n return [uncontrolledValue as T, handleUncontrolledChange, false];\n}\n","import { createContext, useContext, createElement } from 'react';\n\nexport function createSafeContext<ContextValue>(errorMessage: string) {\n const Context = createContext<ContextValue | null>(null);\n\n const useSafeContext = () => {\n const ctx = useContext(Context);\n if (ctx === null) {\n throw new Error(errorMessage);\n }\n return ctx;\n };\n\n const Provider = ({\n children,\n value,\n }: {\n value: ContextValue;\n children: React.ReactNode;\n }) => {\n return createElement(\n Context.Provider,\n {\n value,\n },\n children,\n );\n };\n\n return [Provider, useSafeContext] as const;\n}\n","import { useEffect, useMemo, useRef, useState } from 'react';\n\ntype ObserverRect = Omit<DOMRectReadOnly, 'toJSON'>;\n\nconst defaultState: ObserverRect = {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n};\n\nexport function useResizeObserver<T extends HTMLElement>(\n options?: ResizeObserverOptions,\n) {\n const frameID = useRef(0);\n const ref = useRef<T>(null);\n\n const [rect, setRect] = useState<ObserverRect>(defaultState);\n\n const observer = useMemo(\n () =>\n typeof window !== 'undefined'\n ? new ResizeObserver((entries) => {\n const entry = entries[0];\n\n if (entry) {\n cancelAnimationFrame(frameID.current);\n\n frameID.current = requestAnimationFrame(() => {\n if (ref.current) {\n setRect(entry.contentRect);\n }\n });\n }\n })\n : null,\n [],\n );\n\n useEffect(() => {\n if (ref.current) {\n observer?.observe(ref.current, options);\n }\n\n return () => {\n observer?.disconnect();\n\n if (frameID.current) {\n cancelAnimationFrame(frameID.current);\n }\n };\n }, [ref.current]);\n\n return [ref, rect] as const;\n}\n\nexport function useElementSize<T extends HTMLElement>(\n options?: ResizeObserverOptions,\n) {\n const [ref, { width, height }] = useResizeObserver<T>(options);\n return { ref, width, height };\n}\n","import { useEffect, useMemo, useRef } from 'react';\n\nexport const useCallbackRef = <A extends unknown[], R>(\n callback: ((...args: A) => R) | undefined,\n): ((...args: A) => R) => {\n const callbackRef = useRef(callback);\n\n useEffect(() => {\n callbackRef.current = callback;\n });\n\n return useMemo(\n () => ((...args: A) => callbackRef.current?.(...args)) as (...args: A) => R,\n [],\n );\n};\n","import { useRef } from 'react';\nimport { useCallbackRef } from './useCallbackRef';\n\nexport const useDebouncedCallback = <T extends unknown[]>(\n func: (...args: T) => unknown,\n wait = 200,\n) => {\n const timeoutRef = useRef<NodeJS.Timeout>(null);\n const handleCallback = useCallbackRef(func);\n\n const executedFunction = (...args: T) => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n timeoutRef.current = setTimeout(() => {\n timeoutRef.current = null;\n handleCallback(...args);\n }, wait);\n };\n\n const cancel = function () {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n };\n return [executedFunction, cancel, timeoutRef.current] as const;\n};\n","import { useState } from 'react';\n\nexport function useClipboard({ timeout = 2000 } = {}) {\n const [error, setError] = useState<Error | null>(null);\n const [copied, setCopied] = useState(false);\n const [copyTimeout, setCopyTimeout] = useState<number | null>(null);\n\n const handleCopyResult = (value: boolean) => {\n window.clearTimeout(copyTimeout!);\n setCopyTimeout(window.setTimeout(() => setCopied(false), timeout));\n setCopied(value);\n };\n\n const copy = (valueToCopy: string) => {\n if ('clipboard' in navigator) {\n navigator.clipboard\n .writeText(valueToCopy)\n .then(() => handleCopyResult(true))\n .catch((err) => setError(err));\n } else {\n setError(new Error('useClipboard: navigator.clipboard is not supported'));\n }\n };\n\n const reset = () => {\n setCopied(false);\n setError(null);\n window.clearTimeout(copyTimeout!);\n };\n\n return { copy, reset, error, copied };\n}\n","import { useCallback, useEffect, useRef } from 'react';\nimport { useCallbackRef } from './useCallbackRef';\n\nexport function useThrottledCallbackWithClearTimeout<\n T extends (...args: never[]) => unknown,\n>(callback: T, wait: number) {\n const handleCallback = useCallbackRef(callback);\n const latestInArgsRef = useRef<Parameters<T> | null>(null);\n const latestOutArgsRef = useRef<Parameters<T> | null>(null);\n const active = useRef(true);\n const waitRef = useRef(wait);\n const timeoutRef = useRef<number>(-1);\n\n const clearTimeout = () => window.clearTimeout(timeoutRef.current);\n\n const callThrottledCallback = useCallback(\n (...args: Parameters<T>) => {\n handleCallback(...args);\n latestInArgsRef.current = args;\n latestOutArgsRef.current = args;\n active.current = false;\n },\n [handleCallback],\n );\n\n const timerCallback = useCallback(() => {\n if (\n latestInArgsRef.current &&\n latestInArgsRef.current !== latestOutArgsRef.current\n ) {\n callThrottledCallback(...latestInArgsRef.current);\n\n timeoutRef.current = window.setTimeout(timerCallback, waitRef.current);\n } else {\n active.current = true;\n }\n }, [callThrottledCallback]);\n\n const throttled = useCallback(\n (...args: Parameters<T>) => {\n if (active.current) {\n callThrottledCallback(...args);\n timeoutRef.current = window.setTimeout(timerCallback, waitRef.current);\n } else {\n latestInArgsRef.current = args;\n }\n },\n [callThrottledCallback, timerCallback],\n );\n\n useEffect(() => {\n waitRef.current = wait;\n }, [wait]);\n\n return [throttled, clearTimeout] as const;\n}\n\nexport function useThrottledCallback<T extends (...args: never[]) => unknown>(\n callback: T,\n wait: number,\n) {\n return useThrottledCallbackWithClearTimeout(callback, wait)[0];\n}\n","import { useMediaQuery } from 'usehooks-ts';\n\nexport const useXSMediaQuery = () => {\n return useMediaQuery('(max-width: 389.99px)');\n};\n\nexport const useSMMediaQuery = () => {\n return useMediaQuery('(min-width: 390px)');\n};\n\nexport const useUpToMDMediaQuery = () => {\n return useMediaQuery('(max-width: 899.99px)');\n};\n\nexport const useMinMDMediaQuery = () => {\n return useMediaQuery('(min-width: 900px)');\n};\n\nexport const useMinLGMediaQuery = () => {\n return useMediaQuery('(min-width: 1440px)');\n};\n\nexport const useMinXLGMediaQuery = () => {\n return useMediaQuery('(min-width: 1920px)');\n};\n","export { useApi } from './useApi';\nexport { useWindowSize } from './useWindowResize';\nexport { useClickOutside } from './useClickOutside';\nexport { usePaginationRange } from './pagination/usePaginationRange';\nexport { useTextSizeDecrease } from './text/useTextSizeDecrease';\nexport { useDeviceType } from './useDeviceType';\nexport { useToggle } from './useToggle';\nexport { useUncontrolled } from './useUncontrolled';\nexport { createSafeContext } from './useSafeContext';\nexport { useResizeObserver, useElementSize } from './useResizeObserver';\nexport { useCallbackRef } from './useCallbackRef';\nexport { useDebouncedCallback } from './useDebouncedCallback';\nexport { useClipboard } from './useClipboard';\nexport {\n useThrottledCallback,\n useThrottledCallbackWithClearTimeout,\n} from './useThrottledCallback';\nexport * from './mediaQueries';\n","export * from './hooks';\n"],"names":["useState","useApi","fetcherFn","initialValue","isLoading","setIsLoading","error","setError","data","setData","query","args","respData","err","useEffect","useWindowSize","windowSize","setWindowSize","width","window","innerWidth","height","innerHeight","handleResize","addEventListener","removeEventListener","useClickOutside","ref","onClickOutside","events","handler","e","current","contains","target","forEach","eventName","document","useMemo","generateRange","usePaginationRange","pagesCount","selectedPage","useRef","FONT_SIZE_REG_EXP","isOverflowing","el","container","scrollWidth","Number","clientWidth","resize","step","fontSize","getComputedStyle","matchResults","match","fsValue","fsUnit","style","useTextSizeDecrease","maxAttempts","textContainerRef","attemptsRef","checkAndResize","node","parentNode","isLarger","wordBreak","useMediaQuery","useDeviceType","isMD","isLG","isXLG","useReducer","useToggle","options","option","toggle","state","action","value","Function","index","Math","abs","indexOf","slice","concat","useUncontrolled","defaultValue","finalValue","onChange","uncontrolledValue","setUncontrolledValue","undefined","handleUncontrolledChange","val","payload","createContext","useContext","createElement","createSafeContext","errorMessage","Context","useSafeContext","ctx","Error","Provider","children","defaultState","x","y","top","left","bottom","right","useResizeObserver","frameID","rect","setRect","observer","ResizeObserver","entries","entry","cancelAnimationFrame","requestAnimationFrame","contentRect","observe","disconnect","useElementSize","useCallbackRef","callback","callbackRef","useDebouncedCallback","func","wait","timeoutRef","handleCallback","executedFunction","clearTimeout","setTimeout","cancel","useClipboard","timeout","copied","setCopied","copyTimeout","setCopyTimeout","handleCopyResult","copy","valueToCopy","navigator","clipboard","writeText","then","catch","reset","useCallback","useThrottledCallbackWithClearTimeout","latestInArgsRef","latestOutArgsRef","active","waitRef","callThrottledCallback","timerCallback","throttled","useThrottledCallback","useXSMediaQuery","useSMMediaQuery","useUpToMDMediaQuery","useMinMDMediaQuery","useMinLGMediaQuery","useMinXLGMediaQuery"],"ignoreList":[],"sourceRoot":""}