@pelatform/ui 1.6.0 → 2.1.0

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 (126) hide show
  1. package/README.md +360 -5
  2. package/dist/animation.d.ts +6 -379
  3. package/dist/animation.js +2 -1750
  4. package/dist/base.d.ts +1 -651
  5. package/dist/base.js +2 -5554
  6. package/dist/components.d.ts +1 -2944
  7. package/dist/components.js +2 -2719
  8. package/dist/css/color/gray.css +105 -0
  9. package/dist/css/color/neutral.css +105 -0
  10. package/dist/css/color/slate.css +105 -0
  11. package/dist/css/color/stone.css +105 -0
  12. package/dist/css/color/zinc.css +105 -0
  13. package/dist/css/styles/style-lyra.css +1335 -0
  14. package/dist/css/styles/style-maia.css +1360 -0
  15. package/dist/css/styles/style-mira.css +1362 -0
  16. package/dist/css/styles/style-nova.css +1360 -0
  17. package/dist/css/styles/style-vega.css +1356 -0
  18. package/dist/hooks.d.ts +1 -1172
  19. package/dist/hooks.js +2 -664
  20. package/dist/index.d.ts +1 -318
  21. package/dist/index.js +3 -229
  22. package/dist/radix.d.ts +1 -0
  23. package/dist/radix.js +4 -0
  24. package/dist/style.css +2 -0
  25. package/package.json +82 -136
  26. package/LICENSE +0 -21
  27. package/css/components/apexcharts.css +0 -101
  28. package/css/components/book.css +0 -19
  29. package/css/components/extra.css +0 -12
  30. package/css/components/image-input.css +0 -51
  31. package/css/components/leaflet.css +0 -25
  32. package/css/components/patterns.css +0 -34
  33. package/css/components/rating.css +0 -89
  34. package/css/components/scrollable.css +0 -118
  35. package/css/components/theme-transition.css +0 -51
  36. package/css/theme.css +0 -238
  37. package/dist/animation.cjs +0 -1752
  38. package/dist/animation.d.cts +0 -379
  39. package/dist/aria.cjs +0 -139
  40. package/dist/aria.d.cts +0 -31
  41. package/dist/aria.d.ts +0 -31
  42. package/dist/aria.js +0 -139
  43. package/dist/badge-BtI4BMea.d.cts +0 -33
  44. package/dist/badge-BtI4BMea.d.ts +0 -33
  45. package/dist/base.cjs +0 -5556
  46. package/dist/base.d.cts +0 -651
  47. package/dist/chunk-3N75YA6Q.cjs +0 -60
  48. package/dist/chunk-7472NIIL.cjs +0 -40
  49. package/dist/chunk-BXUKTDPN.cjs +0 -576
  50. package/dist/chunk-CD2BCCQU.js +0 -180
  51. package/dist/chunk-CJXIPSTG.cjs +0 -10
  52. package/dist/chunk-CTHRAJQZ.js +0 -1522
  53. package/dist/chunk-D373YKDA.js +0 -196
  54. package/dist/chunk-EZW5GNS4.js +0 -6
  55. package/dist/chunk-HILACSFA.cjs +0 -1522
  56. package/dist/chunk-HR3R6KKM.js +0 -40
  57. package/dist/chunk-HW52LCWN.js +0 -22
  58. package/dist/chunk-I46SELBA.cjs +0 -22
  59. package/dist/chunk-J4JGE3U5.cjs +0 -180
  60. package/dist/chunk-RQHJBTEU.js +0 -10
  61. package/dist/chunk-SK6SSJHC.js +0 -9
  62. package/dist/chunk-T74DBLYY.js +0 -60
  63. package/dist/chunk-TB6DU23O.js +0 -576
  64. package/dist/chunk-UP53DCYH.cjs +0 -6
  65. package/dist/chunk-ZBO5IAMA.cjs +0 -196
  66. package/dist/chunk-ZDR3OZ7Z.cjs +0 -9
  67. package/dist/colors-CUDWvz1g.d.cts +0 -42
  68. package/dist/colors-CUDWvz1g.d.ts +0 -42
  69. package/dist/components-CidsRcc3.d.cts +0 -46
  70. package/dist/components-CidsRcc3.d.ts +0 -46
  71. package/dist/components.cjs +0 -2721
  72. package/dist/components.d.cts +0 -2944
  73. package/dist/default.cjs +0 -8931
  74. package/dist/default.d.cts +0 -1322
  75. package/dist/default.d.ts +0 -1322
  76. package/dist/default.js +0 -8931
  77. package/dist/hooks.cjs +0 -666
  78. package/dist/hooks.d.cts +0 -1172
  79. package/dist/index.cjs +0 -230
  80. package/dist/index.d.cts +0 -318
  81. package/dist/input-AwYIskrX.d.cts +0 -22
  82. package/dist/input-AwYIskrX.d.ts +0 -22
  83. package/dist/menu-GmSRfRGB.d.cts +0 -43
  84. package/dist/menu-GmSRfRGB.d.ts +0 -43
  85. package/dist/metafile-cjs.json +0 -1
  86. package/dist/metafile-esm.json +0 -1
  87. package/dist/re-export/cva.cjs +0 -6
  88. package/dist/re-export/cva.d.cts +0 -10
  89. package/dist/re-export/cva.d.ts +0 -10
  90. package/dist/re-export/cva.js +0 -6
  91. package/dist/re-export/motion.cjs +0 -2
  92. package/dist/re-export/motion.d.cts +0 -1
  93. package/dist/re-export/motion.d.ts +0 -1
  94. package/dist/re-export/motion.js +0 -2
  95. package/dist/re-export/next-themes.cjs +0 -2
  96. package/dist/re-export/next-themes.d.cts +0 -1
  97. package/dist/re-export/next-themes.d.ts +0 -1
  98. package/dist/re-export/next-themes.js +0 -2
  99. package/dist/re-export/react-day-picker.cjs +0 -2
  100. package/dist/re-export/react-day-picker.d.cts +0 -1
  101. package/dist/re-export/react-day-picker.d.ts +0 -1
  102. package/dist/re-export/react-day-picker.js +0 -2
  103. package/dist/re-export/react-hook-form.cjs +0 -2
  104. package/dist/re-export/react-hook-form.d.cts +0 -1
  105. package/dist/re-export/react-hook-form.d.ts +0 -1
  106. package/dist/re-export/react-hook-form.js +0 -2
  107. package/dist/re-export/resolver.cjs +0 -2
  108. package/dist/re-export/resolver.d.cts +0 -1
  109. package/dist/re-export/resolver.d.ts +0 -1
  110. package/dist/re-export/resolver.js +0 -2
  111. package/dist/re-export/sonner.cjs +0 -2
  112. package/dist/re-export/sonner.d.cts +0 -1
  113. package/dist/re-export/sonner.d.ts +0 -1
  114. package/dist/re-export/sonner.js +0 -2
  115. package/dist/re-export/tanstack-query.cjs +0 -2
  116. package/dist/re-export/tanstack-query.d.cts +0 -1
  117. package/dist/re-export/tanstack-query.d.ts +0 -1
  118. package/dist/re-export/tanstack-query.js +0 -2
  119. package/dist/re-export/tanstack-table.cjs +0 -2
  120. package/dist/re-export/tanstack-table.d.cts +0 -1
  121. package/dist/re-export/tanstack-table.d.ts +0 -1
  122. package/dist/re-export/tanstack-table.js +0 -2
  123. package/dist/re-export/zod.cjs +0 -2
  124. package/dist/re-export/zod.d.cts +0 -1
  125. package/dist/re-export/zod.d.ts +0 -1
  126. package/dist/re-export/zod.js +0 -2
package/dist/hooks.cjs DELETED
@@ -1,666 +0,0 @@
1
- "use client";
2
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
3
-
4
-
5
- var _chunkZDR3OZ7Zcjs = require('./chunk-ZDR3OZ7Z.cjs');
6
-
7
-
8
-
9
- var _chunkJ4JGE3U5cjs = require('./chunk-J4JGE3U5.cjs');
10
-
11
-
12
-
13
- var _chunk3N75YA6Qcjs = require('./chunk-3N75YA6Q.cjs');
14
- require('./chunk-I46SELBA.cjs');
15
-
16
- // src/hooks/use-analytics.ts
17
- var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react);
18
- var useAnalytics = () => {
19
- const trackEvent = _react.useCallback.call(void 0,
20
- ({
21
- event_name,
22
- module,
23
- submodule,
24
- item_type,
25
- item_id,
26
- action,
27
- delete_type
28
- }) => {
29
- if (typeof window !== "undefined" && window.gtag) {
30
- window.gtag("event", event_name, {
31
- module,
32
- submodule,
33
- module_path: `${module}/${submodule}`,
34
- item_type,
35
- item_id,
36
- action,
37
- delete_type,
38
- category: "crud",
39
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
40
- });
41
- }
42
- },
43
- []
44
- );
45
- const trackCreate = _react.useCallback.call(void 0,
46
- (module, submodule, itemType, itemId) => {
47
- trackEvent({
48
- event_name: "crud_create",
49
- module,
50
- submodule,
51
- item_type: itemType,
52
- item_id: itemId,
53
- action: "create"
54
- });
55
- },
56
- [trackEvent]
57
- );
58
- const trackUpdate = _react.useCallback.call(void 0,
59
- (module, submodule, itemType, itemId) => {
60
- trackEvent({
61
- event_name: "crud_update",
62
- module,
63
- submodule,
64
- item_type: itemType,
65
- item_id: itemId,
66
- action: "update"
67
- });
68
- },
69
- [trackEvent]
70
- );
71
- const trackDelete = _react.useCallback.call(void 0,
72
- (module, submodule, itemType, itemId, isHardDelete = false) => {
73
- trackEvent({
74
- event_name: "crud_delete",
75
- module,
76
- submodule,
77
- item_type: itemType,
78
- item_id: itemId,
79
- action: "delete",
80
- delete_type: isHardDelete ? "hard" : "soft"
81
- });
82
- },
83
- [trackEvent]
84
- );
85
- return {
86
- trackCreate,
87
- trackUpdate,
88
- trackDelete
89
- };
90
- };
91
-
92
- // src/hooks/use-body-class.ts
93
-
94
- var useBodyClasses = (className) => {
95
- _react.useEffect.call(void 0, () => {
96
- if (!className.trim()) return;
97
- const classList = className.split(/\s+/).filter(Boolean);
98
- classList.forEach((cls) => {
99
- document.body.classList.add(cls);
100
- });
101
- return () => {
102
- classList.forEach((cls) => {
103
- document.body.classList.remove(cls);
104
- });
105
- };
106
- }, [className]);
107
- };
108
-
109
- // src/hooks/use-file-upload.ts
110
-
111
-
112
-
113
-
114
-
115
- var useFileUpload = (options = {}) => {
116
- const {
117
- maxFiles = Number.POSITIVE_INFINITY,
118
- maxSize = Number.POSITIVE_INFINITY,
119
- accept = "*",
120
- multiple = false,
121
- initialFiles = [],
122
- onFilesChange,
123
- onFilesAdded,
124
- onError
125
- } = options;
126
- const [state, setState] = _react.useState.call(void 0, {
127
- files: initialFiles.map((file) => ({
128
- file,
129
- id: file.id,
130
- preview: file.url
131
- })),
132
- isDragging: false,
133
- errors: []
134
- });
135
- const inputRef = _react.useRef.call(void 0, null);
136
- const validateFile = _react.useCallback.call(void 0,
137
- (file) => {
138
- if (file instanceof File) {
139
- if (file.size > maxSize) {
140
- return `File "${file.name}" exceeds the maximum size of ${formatBytes(maxSize)}.`;
141
- }
142
- } else {
143
- if (file.size > maxSize) {
144
- return `File "${file.name}" exceeds the maximum size of ${formatBytes(maxSize)}.`;
145
- }
146
- }
147
- if (accept !== "*") {
148
- const acceptedTypes = accept.split(",").map((type) => type.trim());
149
- const fileType = file instanceof File ? file.type || "" : file.type;
150
- const fileExtension = `.${file instanceof File ? file.name.split(".").pop() : file.name.split(".").pop()}`;
151
- const isAccepted = acceptedTypes.some((type) => {
152
- if (type.startsWith(".")) {
153
- return fileExtension.toLowerCase() === type.toLowerCase();
154
- }
155
- if (type.endsWith("/*")) {
156
- const baseType = type.split("/")[0];
157
- return fileType.startsWith(`${baseType}/`);
158
- }
159
- return fileType === type;
160
- });
161
- if (!isAccepted) {
162
- return `File "${file instanceof File ? file.name : file.name}" is not an accepted file type.`;
163
- }
164
- }
165
- return null;
166
- },
167
- [accept, maxSize]
168
- );
169
- const createPreview = _react.useCallback.call(void 0, (file) => {
170
- if (file instanceof File) {
171
- return URL.createObjectURL(file);
172
- }
173
- return file.url;
174
- }, []);
175
- const generateUniqueId = _react.useCallback.call(void 0, (file) => {
176
- if (file instanceof File) {
177
- return `${file.name}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
178
- }
179
- return file.id;
180
- }, []);
181
- const clearFiles = _react.useCallback.call(void 0, () => {
182
- setState((prev) => {
183
- for (const file of prev.files) {
184
- if (file.preview && file.file instanceof File && file.file.type.startsWith("image/")) {
185
- URL.revokeObjectURL(file.preview);
186
- }
187
- }
188
- if (inputRef.current) {
189
- inputRef.current.value = "";
190
- }
191
- const newState = {
192
- ...prev,
193
- files: [],
194
- errors: []
195
- };
196
- _optionalChain([onFilesChange, 'optionalCall', _ => _(newState.files)]);
197
- return newState;
198
- });
199
- }, [onFilesChange]);
200
- const addFiles = _react.useCallback.call(void 0,
201
- (newFiles) => {
202
- if (!newFiles || newFiles.length === 0) return;
203
- const newFilesArray = Array.from(newFiles);
204
- const errors = [];
205
- setState((prev) => ({ ...prev, errors: [] }));
206
- if (!multiple) {
207
- clearFiles();
208
- }
209
- if (multiple && maxFiles !== Number.POSITIVE_INFINITY && state.files.length + newFilesArray.length > maxFiles) {
210
- errors.push(`You can only upload a maximum of ${maxFiles} files.`);
211
- _optionalChain([onError, 'optionalCall', _2 => _2(errors)]);
212
- setState((prev) => ({ ...prev, errors }));
213
- return;
214
- }
215
- const validFiles = [];
216
- for (const file of newFilesArray) {
217
- if (multiple) {
218
- const isDuplicate = state.files.some(
219
- (existingFile) => existingFile.file.name === file.name && existingFile.file.size === file.size
220
- );
221
- if (isDuplicate) {
222
- return;
223
- }
224
- }
225
- if (file.size > maxSize) {
226
- errors.push(
227
- multiple ? `Some files exceed the maximum size of ${formatBytes(maxSize)}.` : `File exceeds the maximum size of ${formatBytes(maxSize)}.`
228
- );
229
- continue;
230
- }
231
- const error = validateFile(file);
232
- if (error) {
233
- errors.push(error);
234
- } else {
235
- validFiles.push({
236
- file,
237
- id: generateUniqueId(file),
238
- preview: createPreview(file)
239
- });
240
- }
241
- }
242
- if (validFiles.length > 0) {
243
- _optionalChain([onFilesAdded, 'optionalCall', _3 => _3(validFiles)]);
244
- setState((prev) => {
245
- const newFiles2 = !multiple ? validFiles : [...prev.files, ...validFiles];
246
- _optionalChain([onFilesChange, 'optionalCall', _4 => _4(newFiles2)]);
247
- return {
248
- ...prev,
249
- files: newFiles2,
250
- errors
251
- };
252
- });
253
- } else if (errors.length > 0) {
254
- _optionalChain([onError, 'optionalCall', _5 => _5(errors)]);
255
- setState((prev) => ({
256
- ...prev,
257
- errors
258
- }));
259
- }
260
- if (inputRef.current) {
261
- inputRef.current.value = "";
262
- }
263
- },
264
- [
265
- state.files,
266
- maxFiles,
267
- multiple,
268
- maxSize,
269
- validateFile,
270
- createPreview,
271
- generateUniqueId,
272
- clearFiles,
273
- onFilesChange,
274
- onFilesAdded,
275
- onError
276
- ]
277
- );
278
- const removeFile = _react.useCallback.call(void 0,
279
- (id) => {
280
- setState((prev) => {
281
- const fileToRemove = prev.files.find((file) => file.id === id);
282
- if (_optionalChain([fileToRemove, 'optionalAccess', _6 => _6.preview]) && fileToRemove.file instanceof File && fileToRemove.file.type.startsWith("image/")) {
283
- URL.revokeObjectURL(fileToRemove.preview);
284
- }
285
- const newFiles = prev.files.filter((file) => file.id !== id);
286
- _optionalChain([onFilesChange, 'optionalCall', _7 => _7(newFiles)]);
287
- return {
288
- ...prev,
289
- files: newFiles,
290
- errors: []
291
- };
292
- });
293
- },
294
- [onFilesChange]
295
- );
296
- const clearErrors = _react.useCallback.call(void 0, () => {
297
- setState((prev) => ({
298
- ...prev,
299
- errors: []
300
- }));
301
- }, []);
302
- const handleDragEnter = _react.useCallback.call(void 0, (e) => {
303
- e.preventDefault();
304
- e.stopPropagation();
305
- setState((prev) => ({ ...prev, isDragging: true }));
306
- }, []);
307
- const handleDragLeave = _react.useCallback.call(void 0, (e) => {
308
- e.preventDefault();
309
- e.stopPropagation();
310
- if (e.currentTarget.contains(e.relatedTarget)) {
311
- return;
312
- }
313
- setState((prev) => ({ ...prev, isDragging: false }));
314
- }, []);
315
- const handleDragOver = _react.useCallback.call(void 0, (e) => {
316
- e.preventDefault();
317
- e.stopPropagation();
318
- }, []);
319
- const handleDrop = _react.useCallback.call(void 0,
320
- (e) => {
321
- e.preventDefault();
322
- e.stopPropagation();
323
- setState((prev) => ({ ...prev, isDragging: false }));
324
- if (_optionalChain([inputRef, 'access', _8 => _8.current, 'optionalAccess', _9 => _9.disabled])) {
325
- return;
326
- }
327
- if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {
328
- if (!multiple) {
329
- const file = e.dataTransfer.files[0];
330
- addFiles([file]);
331
- } else {
332
- addFiles(e.dataTransfer.files);
333
- }
334
- }
335
- },
336
- [addFiles, multiple]
337
- );
338
- const handleFileChange = _react.useCallback.call(void 0,
339
- (e) => {
340
- if (e.target.files && e.target.files.length > 0) {
341
- addFiles(e.target.files);
342
- }
343
- },
344
- [addFiles]
345
- );
346
- const openFileDialog = _react.useCallback.call(void 0, () => {
347
- if (inputRef.current) {
348
- inputRef.current.click();
349
- }
350
- }, []);
351
- const getInputProps = _react.useCallback.call(void 0,
352
- (props = {}) => {
353
- return {
354
- ...props,
355
- type: "file",
356
- onChange: handleFileChange,
357
- accept: props.accept || accept,
358
- multiple: props.multiple !== void 0 ? props.multiple : multiple,
359
- ref: inputRef
360
- };
361
- },
362
- [accept, multiple, handleFileChange]
363
- );
364
- return [
365
- state,
366
- {
367
- addFiles,
368
- removeFile,
369
- clearFiles,
370
- clearErrors,
371
- handleDragEnter,
372
- handleDragLeave,
373
- handleDragOver,
374
- handleDrop,
375
- handleFileChange,
376
- openFileDialog,
377
- getInputProps
378
- }
379
- ];
380
- };
381
- var formatBytes = (bytes, decimals = 2) => {
382
- if (bytes === 0) return "0 Bytes";
383
- const k = 1024;
384
- const dm = decimals < 0 ? 0 : decimals;
385
- const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
386
- const i = Math.floor(Math.log(bytes) / Math.log(k));
387
- return Number.parseFloat((bytes / k ** i).toFixed(dm)) + sizes[i];
388
- };
389
-
390
- // src/hooks/use-media-query.ts
391
-
392
- var getMatches = (query) => {
393
- if (typeof window !== "undefined") {
394
- return window.matchMedia(query).matches;
395
- }
396
- return false;
397
- };
398
- var useMediaQuery = (query) => {
399
- const [matches, setMatches] = _react.useState.call(void 0, getMatches(query));
400
- _react.useEffect.call(void 0, () => {
401
- function handleChange() {
402
- setMatches(getMatches(query));
403
- }
404
- const matchMedia = window.matchMedia(query);
405
- handleChange();
406
- matchMedia.addEventListener("change", handleChange);
407
- return () => {
408
- matchMedia.removeEventListener("change", handleChange);
409
- };
410
- }, [query]);
411
- return matches;
412
- };
413
-
414
- // src/hooks/use-menu.ts
415
- var useMenu = (pathname) => {
416
- const isActive = (path) => {
417
- if (path && path === "/") {
418
- return path === pathname;
419
- } else {
420
- return !!path && pathname.startsWith(path);
421
- }
422
- };
423
- const hasActiveChild = (children) => {
424
- if (!children || !Array.isArray(children)) return false;
425
- return children.some(
426
- (child) => child.path && isActive(child.path) || child.children && hasActiveChild(child.children)
427
- );
428
- };
429
- const isItemActive = (item) => {
430
- return (item.path ? isActive(item.path) : false) || (item.children ? hasActiveChild(item.children) : false);
431
- };
432
- const getCurrentItem = (items) => {
433
- for (const item of items) {
434
- if (item.path && isActive(item.path)) {
435
- if (item.children && item.children.length > 0) {
436
- const childMatch = getCurrentItem(item.children);
437
- return childMatch || item;
438
- }
439
- return item;
440
- }
441
- if (item.children && item.children.length > 0) {
442
- const childMatch = getCurrentItem(item.children);
443
- if (childMatch) {
444
- return childMatch;
445
- }
446
- }
447
- }
448
- return void 0;
449
- };
450
- const getBreadcrumb = (items) => {
451
- const findBreadcrumb = (nodes, breadcrumb2 = []) => {
452
- for (const item of nodes) {
453
- const currentBreadcrumb = [...breadcrumb2, item];
454
- if (item.path && isActive(item.path)) {
455
- return currentBreadcrumb;
456
- }
457
- if (item.children && item.children.length > 0) {
458
- const childBreadcrumb = findBreadcrumb(item.children, currentBreadcrumb);
459
- if (childBreadcrumb.length > currentBreadcrumb.length) {
460
- return childBreadcrumb;
461
- }
462
- }
463
- }
464
- return breadcrumb2;
465
- };
466
- const breadcrumb = findBreadcrumb(items);
467
- return breadcrumb.length > 0 ? breadcrumb : [];
468
- };
469
- const getChildren = (items, level) => {
470
- const hasActiveChildAtLevel = (items2) => {
471
- for (const item of items2) {
472
- if (item.path && (item.path === pathname || item.path !== "/" && item.path !== "" && pathname.startsWith(item.path)) || item.children && hasActiveChildAtLevel(item.children)) {
473
- return true;
474
- }
475
- }
476
- return false;
477
- };
478
- const findChildren = (items2, targetLevel, currentLevel = 0) => {
479
- for (const item of items2) {
480
- if (item.children) {
481
- if (targetLevel === currentLevel && hasActiveChildAtLevel(item.children)) {
482
- return item.children;
483
- }
484
- const children = findChildren(item.children, targetLevel, currentLevel + 1);
485
- if (children) {
486
- return children;
487
- }
488
- } else if (targetLevel === currentLevel && item.path && (item.path === pathname || item.path !== "/" && item.path !== "" && pathname.startsWith(item.path))) {
489
- return items2;
490
- }
491
- }
492
- return null;
493
- };
494
- return findChildren(items, level);
495
- };
496
- return {
497
- isActive,
498
- hasActiveChild,
499
- isItemActive,
500
- getCurrentItem,
501
- getBreadcrumb,
502
- getChildren
503
- };
504
- };
505
-
506
- // src/hooks/use-mounted.ts
507
-
508
- function useMounted() {
509
- const [mounted, setMounted] = React.useState(false);
510
- React.useEffect(() => {
511
- setMounted(true);
512
- }, []);
513
- return mounted;
514
- }
515
-
516
- // src/hooks/use-mutation-observer.ts
517
-
518
- var DEFAULT_OPTIONS = {
519
- /** Watch for attribute changes */
520
- attributes: true,
521
- /** Watch for text content changes */
522
- characterData: true,
523
- /** Watch for child element additions/removals */
524
- childList: true,
525
- /** Watch for changes in descendant elements */
526
- subtree: true
527
- };
528
- var useMutationObserver = (ref, callback, options = DEFAULT_OPTIONS) => {
529
- React2.useEffect(() => {
530
- if (ref.current) {
531
- const observer = new MutationObserver(callback);
532
- observer.observe(ref.current, options);
533
- return () => {
534
- observer.disconnect();
535
- };
536
- }
537
- }, [ref, callback, options]);
538
- };
539
-
540
- // src/hooks/use-remove-ga-params.ts
541
-
542
- function useRemoveGAParams() {
543
- _react.useEffect.call(void 0, () => {
544
- const url = new URL(window.location.href);
545
- if (url.searchParams.has("_gl")) {
546
- const timer = setTimeout(() => {
547
- url.searchParams.delete("_gl");
548
- window.history.replaceState({}, "", url.toString());
549
- }, 2e3);
550
- return () => clearTimeout(timer);
551
- }
552
- }, []);
553
- }
554
-
555
- // src/hooks/use-scroll-position.ts
556
-
557
- var useScrollPosition = ({ targetRef } = {}) => {
558
- const [scrollPosition, setScrollPosition] = _react.useState.call(void 0, 0);
559
- _react.useEffect.call(void 0, () => {
560
- const target = _optionalChain([targetRef, 'optionalAccess', _10 => _10.current]) || document;
561
- const scrollable = target === document ? window : target;
562
- const updatePosition = () => {
563
- const scrollY = target === document ? window.scrollY || window.pageYOffset : target.scrollTop;
564
- setScrollPosition(scrollY);
565
- };
566
- scrollable.addEventListener("scroll", updatePosition, { passive: true });
567
- updatePosition();
568
- return () => {
569
- scrollable.removeEventListener("scroll", updatePosition);
570
- };
571
- }, [targetRef]);
572
- return scrollPosition;
573
- };
574
-
575
- // src/hooks/use-slider-input.ts
576
-
577
- function useSliderInput({ minValue, maxValue, initialValue }) {
578
- const [sliderValues, setSliderValues] = _react.useState.call(void 0, initialValue);
579
- const [inputValues, setInputValues] = _react.useState.call(void 0, initialValue);
580
- const handleSliderChange = _react.useCallback.call(void 0, (values) => {
581
- setSliderValues(values);
582
- setInputValues(values);
583
- }, []);
584
- const handleInputChange = _react.useCallback.call(void 0,
585
- (e, index) => {
586
- const newValue = parseFloat(e.target.value);
587
- if (!Number.isNaN(newValue)) {
588
- const updatedInputs = [...inputValues];
589
- updatedInputs[index] = newValue;
590
- setInputValues(updatedInputs);
591
- }
592
- },
593
- [inputValues]
594
- );
595
- const validateAndUpdateValue = _react.useCallback.call(void 0,
596
- (value, index) => {
597
- const updatedSlider = [...sliderValues];
598
- if (index === 0) {
599
- updatedSlider[0] = Math.max(minValue, Math.min(value, sliderValues[1]));
600
- } else {
601
- updatedSlider[1] = Math.min(maxValue, Math.max(value, sliderValues[0]));
602
- }
603
- setSliderValues(updatedSlider);
604
- setInputValues(updatedSlider);
605
- },
606
- [sliderValues, minValue, maxValue]
607
- );
608
- return {
609
- /** Function to manually set slider values */
610
- setSliderValues,
611
- /** Function to manually set input values */
612
- setInputValues,
613
- /** Current slider values [min, max] */
614
- sliderValues,
615
- /** Current input values [min, max] */
616
- inputValues,
617
- /** Handler for slider value changes */
618
- handleSliderChange,
619
- /** Handler for input field changes */
620
- handleInputChange,
621
- /** Function to validate and update values from inputs */
622
- validateAndUpdateValue
623
- };
624
- }
625
-
626
- // src/hooks/use-viewport.ts
627
-
628
- var useViewport = () => {
629
- const [dimensions, setDimensions] = _react.useState.call(void 0, () => {
630
- if (typeof window !== "undefined") {
631
- return [window.innerHeight, window.innerWidth];
632
- }
633
- return [0, 0];
634
- });
635
- _react.useEffect.call(void 0, () => {
636
- const handleResize = () => {
637
- setDimensions([window.innerHeight, window.innerWidth]);
638
- };
639
- handleResize();
640
- window.addEventListener("resize", handleResize, { passive: true });
641
- return () => {
642
- window.removeEventListener("resize", handleResize);
643
- };
644
- }, []);
645
- return dimensions;
646
- };
647
-
648
-
649
-
650
-
651
-
652
-
653
-
654
-
655
-
656
-
657
-
658
-
659
-
660
-
661
-
662
-
663
-
664
-
665
-
666
- exports.formatBytes = formatBytes; exports.toastManager = _chunkZDR3OZ7Zcjs.toastManager; exports.useAnalytics = useAnalytics; exports.useBodyClasses = useBodyClasses; exports.useCopyToClipboard = _chunk3N75YA6Qcjs.useCopyToClipboard; exports.useFileUpload = useFileUpload; exports.useIsMobile = _chunk3N75YA6Qcjs.useIsMobile; exports.useMediaQuery = useMediaQuery; exports.useMenu = useMenu; exports.useMetaColor = _chunkJ4JGE3U5cjs.useMetaColor; exports.useMounted = useMounted; exports.useMutationObserver = useMutationObserver; exports.useRecaptchaV2 = _chunkJ4JGE3U5cjs.useRecaptchaV2; exports.useRemoveGAParams = useRemoveGAParams; exports.useScrollPosition = useScrollPosition; exports.useSliderInput = useSliderInput; exports.useToast = _chunkZDR3OZ7Zcjs.useToast; exports.useViewport = useViewport;