lkd-web-kit 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/src/components/EmptyState/index.js +36 -0
  2. package/dist/src/components/Icon.js +47 -0
  3. package/dist/src/components/InfinityLoader/index.js +9 -0
  4. package/dist/src/components/MyDatePickerInput/CalendarIcon.js +61 -0
  5. package/dist/src/components/MyDatePickerInput/index.js +14 -0
  6. package/dist/src/components/MyDateTimePicker/index.js +14 -0
  7. package/dist/src/components/MyMonthPickerInput/index.js +14 -0
  8. package/dist/src/components/MyMultiSelect/index.js +12 -0
  9. package/dist/src/components/MyNotifications/index.js +13 -0
  10. package/dist/src/components/MyNumberInput/index.js +12 -0
  11. package/dist/src/components/MySelect/index.js +12 -0
  12. package/dist/src/components/MyTextInput/index.js +12 -0
  13. package/dist/src/components/MyTextarea/index.js +12 -0
  14. package/dist/src/components/MyTimeInput/index.js +12 -0
  15. package/dist/src/components/NavItems.js +36 -0
  16. package/dist/src/components/SelectInfinity/index.js +106 -0
  17. package/dist/src/consts/http-status.js +4 -0
  18. package/dist/src/consts/revalidate.js +4 -0
  19. package/dist/src/contexts/NavigationHistoryContext/index.js +47 -0
  20. package/dist/src/contexts/PageDataContext/index.js +15 -0
  21. package/dist/src/form/Form.js +23 -0
  22. package/dist/src/form/FormButtonSubmit.js +18 -0
  23. package/dist/src/form/base/FormCheckbox.js +15 -0
  24. package/dist/src/form/base/FormDatePickerInput.js +21 -0
  25. package/dist/src/form/base/FormDateTimePicker.js +21 -0
  26. package/dist/src/form/base/FormMonthPickerInput.js +21 -0
  27. package/dist/src/form/base/FormMultiSelect.js +21 -0
  28. package/dist/src/form/base/FormNumberInput.js +21 -0
  29. package/dist/src/form/base/FormRadioGroup.js +14 -0
  30. package/dist/src/form/base/FormSelect.js +21 -0
  31. package/dist/src/form/base/FormSelectInfinity.js +21 -0
  32. package/dist/src/form/base/FormTextInput.js +21 -0
  33. package/dist/src/form/base/FormTextarea.js +21 -0
  34. package/dist/src/form/base/FormTimeInput.js +29 -0
  35. package/dist/src/form/utils/nullable-but-required.js +10 -0
  36. package/dist/src/form/utils/optional-but-required.js +10 -0
  37. package/dist/src/form/utils/zodValidator.js +9 -0
  38. package/dist/src/hocs/withForm.js +59 -0
  39. package/dist/src/hocs/withModalManager.js +29 -0
  40. package/dist/src/hooks/useBreakpoint.js +8 -0
  41. package/dist/src/hooks/useFetchNextPageOnScroll.js +19 -0
  42. package/dist/src/hooks/useOnScrollProgress.js +25 -0
  43. package/dist/src/hooks/useUpdateSearchParams.js +19 -0
  44. package/dist/src/main.js +113 -0
  45. package/dist/src/mantine/breakpoints-with-px.js +11 -0
  46. package/dist/src/mantine/my-default-theme.js +39 -0
  47. package/dist/src/mantine/to-tailwind-colors.js +10 -0
  48. package/dist/src/utils/array/groupBy.js +36 -0
  49. package/dist/src/utils/array/shuffleArray.js +13 -0
  50. package/dist/src/utils/formatBytes.js +8 -0
  51. package/dist/src/utils/isInfinityEmpty.js +4 -0
  52. package/dist/src/utils/ky/addBodyJsonHook.js +12 -0
  53. package/dist/src/utils/ky/parseJson.js +6 -0
  54. package/dist/src/utils/newHref.js +20 -0
  55. package/package.json +3 -3
  56. package/dist/main.js +0 -779
package/dist/main.js DELETED
@@ -1,779 +0,0 @@
1
- "use client";
2
- import { jsx as l, jsxs as g } from "react/jsx-runtime";
3
- import b from "clsx";
4
- import { Center as A, Loader as D, Stack as U, NavLink as w, NumberInput as L, Select as T, Textarea as p, TextInput as I, useCombobox as V, Combobox as h, InputBase as z, Input as $, ScrollArea as G, MultiSelect as Z, Box as j, Button as J, Checkbox as W, Radio as Y, useMatches as _, Tooltip as K, Menu as Q, AppShell as X, Notification as S } from "@mantine/core";
5
- import H from "next/link";
6
- import { usePathname as F, useSearchParams as v, useRouter as ee } from "next/navigation";
7
- import { DatePickerInput as oe, DateTimePicker as ne, MonthPickerInput as re } from "@mantine/dates";
8
- import { Notifications as ie } from "@mantine/notifications";
9
- import { useEffect as N, useRef as le, createContext as R, useState as k, useContext as E } from "react";
10
- import { FormProvider as ce, useFormContext as de, Controller as se } from "react-hook-form";
11
- import { z as O } from "zod";
12
- import { HTTPError as te } from "ky";
13
- import ae from "query-string";
14
- const ue = ({ i: e, size: o = "md", style: r, rotate: n, className: i, ...c }) => /* @__PURE__ */ l(
15
- e,
16
- {
17
- ...typeof o == "number" ? {
18
- height: o,
19
- width: o
20
- } : me[o],
21
- viewBox: "0 0 24 24",
22
- style: {
23
- ...r,
24
- transform: `rotate(${n}deg)`
25
- },
26
- className: b("shrink-0", i),
27
- ...c
28
- }
29
- ), me = {
30
- xs: {
31
- height: 16,
32
- width: 16
33
- },
34
- sm: {
35
- height: 20,
36
- width: 20
37
- },
38
- md: {
39
- height: 24,
40
- width: 24
41
- },
42
- lg: {
43
- height: 28,
44
- width: 28
45
- },
46
- xl: {
47
- height: 32,
48
- width: 32
49
- },
50
- "2xl": {
51
- height: 40,
52
- width: 40
53
- }
54
- }, he = {
55
- sm: 48,
56
- md: 60,
57
- lg: 84
58
- }, Je = ({
59
- label: e,
60
- action: o,
61
- icon: r,
62
- className: n,
63
- size: i = "md",
64
- ...c
65
- }) => /* @__PURE__ */ g(
66
- "div",
67
- {
68
- className: b("justfiy-center flex flex-col items-center gap-1", n),
69
- ...c,
70
- children: [
71
- r && /* @__PURE__ */ l(
72
- ue,
73
- {
74
- i: r,
75
- size: he[i],
76
- className: "text-gray-2"
77
- }
78
- ),
79
- /* @__PURE__ */ l("p", { className: "text-gray-6 text-sm font-semibold", children: e }),
80
- /* @__PURE__ */ l("div", { children: o })
81
- ]
82
- }
83
- ), fe = ({ infinity: e, loaderProps: o, ...r }) => {
84
- var n;
85
- return /* @__PURE__ */ l(A, { ...r, children: e.isFetching ? /* @__PURE__ */ l(D, { ...o }) : !e.hasNextPage && (((n = e.data) == null ? void 0 : n.pages.length) ?? 0) > 1 && /* @__PURE__ */ l("p", { children: "No hay más resultados" }) });
86
- }, We = ({ items: e, activeStrategy: o = "includes" }) => {
87
- const r = F();
88
- return /* @__PURE__ */ l(U, { gap: 0, children: e.map(({ href: n, isActive: i, ...c }) => {
89
- if (n) {
90
- const d = i ?? (o === "equals" ? n === r : n.includes(r));
91
- return /* @__PURE__ */ l(
92
- w,
93
- {
94
- active: d,
95
- component: H,
96
- prefetch: !1,
97
- href: n,
98
- ...c
99
- },
100
- c.label
101
- );
102
- }
103
- return /* @__PURE__ */ l(
104
- w,
105
- {
106
- active: i,
107
- component: "button",
108
- ...c
109
- },
110
- c.label
111
- );
112
- }) });
113
- }, C = ({ size: e = "sm", ...o }) => /* @__PURE__ */ g(
114
- "svg",
115
- {
116
- viewBox: "0 0 24 24",
117
- fill: "none",
118
- xmlns: "http://www.w3.org/2000/svg",
119
- width: e === "sm" ? 20 : 24,
120
- height: e === "sm" ? 20 : 24,
121
- children: [
122
- /* @__PURE__ */ l(
123
- "path",
124
- {
125
- fillRule: "evenodd",
126
- clipRule: "evenodd",
127
- d: "M6 5.5C5.66848 5.5 5.35054 5.6317 5.11612 5.86612C4.8817 6.10054 4.75 6.41848 4.75 6.75V18.75C4.75 19.0815 4.8817 19.3995 5.11612 19.6339C5.35054 19.8683 5.66848 20 6 20H18C18.3315 20 18.6495 19.8683 18.8839 19.6339C19.1183 19.3995 19.25 19.0815 19.25 18.75V6.75C19.25 6.41848 19.1183 6.10054 18.8839 5.86612C18.6495 5.6317 18.3315 5.5 18 5.5H6ZM4.05546 4.80546C4.57118 4.28973 5.27065 4 6 4H18C18.7293 4 19.4288 4.28973 19.9445 4.80546C20.4603 5.32118 20.75 6.02065 20.75 6.75V18.75C20.75 19.4793 20.4603 20.1788 19.9445 20.6945C19.4288 21.2103 18.7293 21.5 18 21.5H6C5.27065 21.5 4.57118 21.2103 4.05546 20.6945C3.53973 20.1788 3.25 19.4793 3.25 18.75V6.75C3.25 6.02065 3.53973 5.32118 4.05546 4.80546Z",
128
- fill: "currentColor"
129
- }
130
- ),
131
- /* @__PURE__ */ l(
132
- "path",
133
- {
134
- fillRule: "evenodd",
135
- clipRule: "evenodd",
136
- d: "M16 2C16.4142 2 16.75 2.33579 16.75 2.75V6.75C16.75 7.16421 16.4142 7.5 16 7.5C15.5858 7.5 15.25 7.16421 15.25 6.75V2.75C15.25 2.33579 15.5858 2 16 2Z",
137
- fill: "currentColor"
138
- }
139
- ),
140
- /* @__PURE__ */ l(
141
- "path",
142
- {
143
- fillRule: "evenodd",
144
- clipRule: "evenodd",
145
- d: "M8 2C8.41421 2 8.75 2.33579 8.75 2.75V6.75C8.75 7.16421 8.41421 7.5 8 7.5C7.58579 7.5 7.25 7.16421 7.25 6.75V2.75C7.25 2.33579 7.58579 2 8 2Z",
146
- fill: "currentColor"
147
- }
148
- ),
149
- /* @__PURE__ */ l(
150
- "path",
151
- {
152
- fillRule: "evenodd",
153
- clipRule: "evenodd",
154
- d: "M3.25 10.75C3.25 10.3358 3.58579 10 4 10H20C20.4142 10 20.75 10.3358 20.75 10.75C20.75 11.1642 20.4142 11.5 20 11.5H4C3.58579 11.5 3.25 11.1642 3.25 10.75Z",
155
- fill: "currentColor"
156
- }
157
- ),
158
- /* @__PURE__ */ l(
159
- "path",
160
- {
161
- fillRule: "evenodd",
162
- clipRule: "evenodd",
163
- d: "M7 14.3929C7 14.0378 7.28782 13.75 7.64286 13.75H9.35714C9.71218 13.75 10 14.0378 10 14.3929V16.1071C10 16.4622 9.71218 16.75 9.35714 16.75H7.64286C7.28782 16.75 7 16.4622 7 16.1071V14.3929Z",
164
- fill: "currentColor"
165
- }
166
- )
167
- ]
168
- }
169
- ), ye = (e) => /* @__PURE__ */ l(
170
- oe,
171
- {
172
- leftSection: /* @__PURE__ */ l(C, { size: e.size }),
173
- variant: e.readOnly ? "filled" : "default",
174
- ...e
175
- }
176
- ), ge = (e) => /* @__PURE__ */ l(
177
- ne,
178
- {
179
- leftSection: /* @__PURE__ */ l(C, { size: e.size }),
180
- variant: e.readOnly ? "filled" : "default",
181
- ...e
182
- }
183
- ), Ye = (e) => /* @__PURE__ */ l(
184
- ie,
185
- {
186
- position: "top-center",
187
- ...e
188
- }
189
- ), xe = (e) => /* @__PURE__ */ l(
190
- L,
191
- {
192
- variant: e.readOnly ? "filled" : "default",
193
- ...e
194
- }
195
- ), Pe = (e) => /* @__PURE__ */ l(
196
- T,
197
- {
198
- variant: e.readOnly ? "filled" : "default",
199
- ...e
200
- }
201
- ), ve = (e) => /* @__PURE__ */ l(
202
- p,
203
- {
204
- variant: e.readOnly ? "filled" : "default",
205
- ...e
206
- }
207
- ), Ne = (e) => /* @__PURE__ */ l(
208
- I,
209
- {
210
- variant: e.readOnly ? "filled" : "default",
211
- ...e
212
- }
213
- ), Ce = (e) => /* @__PURE__ */ l(
214
- I,
215
- {
216
- variant: e.readOnly ? "filled" : "default",
217
- ...e
218
- }
219
- ), Me = ({
220
- triggerPercentage: e,
221
- callback: o,
222
- scrollRef: r,
223
- disabled: n = !1
224
- }) => {
225
- if (e < 0 || e > 1)
226
- throw new Error("El porcentaje debe estar entre 0 y 1");
227
- N(() => {
228
- if (n || r && r.current === null) return;
229
- let i = !1;
230
- const c = () => {
231
- const s = r == null ? void 0 : r.current, t = s ?? document.documentElement, y = t.scrollHeight - t.clientHeight, f = s ? t.scrollTop : window.scrollY, a = y > 0 ? Math.min(1, f / y) : 0;
232
- !i && a >= e && (o(), i = !0);
233
- }, d = (r == null ? void 0 : r.current) ?? window;
234
- return d.addEventListener("scroll", c), c(), () => {
235
- d.removeEventListener("scroll", c);
236
- };
237
- }, [e, o, r, n]);
238
- }, we = ({
239
- infinity: e,
240
- scrollRef: o,
241
- disabled: r = !1
242
- }) => {
243
- Me({
244
- triggerPercentage: 0.9,
245
- callback: () => {
246
- e.hasNextPage && e.fetchNextPage();
247
- },
248
- scrollRef: o,
249
- disabled: r
250
- });
251
- };
252
- function be({
253
- value: e,
254
- onChange: o,
255
- data: r = [],
256
- searchValue: n,
257
- onSearchChange: i,
258
- renderOption: c,
259
- onOptionSubmit: d,
260
- nothingFoundMessage: s,
261
- infinity: t,
262
- placeholder: y,
263
- ...f
264
- }) {
265
- const a = V({
266
- onDropdownClose: () => {
267
- a.resetSelectedOption(), a.focusTarget(), i == null || i("");
268
- },
269
- onDropdownOpen: () => {
270
- a.focusSearchInput();
271
- }
272
- }), x = r.map((m) => /* @__PURE__ */ l(
273
- h.Option,
274
- {
275
- value: m.value,
276
- children: c ? c({ option: m }) : m.label
277
- },
278
- m.value
279
- )), P = r.find((m) => m.value === e), M = le(null);
280
- return we({ infinity: t, scrollRef: M }), /* @__PURE__ */ g(
281
- h,
282
- {
283
- store: a,
284
- middlewares: {
285
- shift: {
286
- crossAxis: !0
287
- }
288
- },
289
- onOptionSubmit: (m) => {
290
- o == null || o(m), d == null || d(m), a.closeDropdown();
291
- },
292
- children: [
293
- /* @__PURE__ */ l(h.Target, { children: /* @__PURE__ */ l(
294
- z,
295
- {
296
- component: "button",
297
- type: "button",
298
- pointer: !0,
299
- rightSection: /* @__PURE__ */ l(h.Chevron, {}),
300
- onClick: () => a.toggleDropdown(),
301
- rightSectionPointerEvents: "none",
302
- ...f,
303
- children: (P == null ? void 0 : P.label) || /* @__PURE__ */ l($.Placeholder, { children: y })
304
- }
305
- ) }),
306
- /* @__PURE__ */ g(h.Dropdown, { children: [
307
- /* @__PURE__ */ l(
308
- h.Search,
309
- {
310
- value: n,
311
- onChange: (m) => i == null ? void 0 : i(m.currentTarget.value),
312
- placeholder: "Escribe para buscar"
313
- }
314
- ),
315
- /* @__PURE__ */ l(h.Options, { children: /* @__PURE__ */ g(
316
- G.Autosize,
317
- {
318
- mah: 200,
319
- type: "scroll",
320
- viewportRef: M,
321
- children: [
322
- x.length > 0 ? x : t.isFetching ? null : /* @__PURE__ */ l(
323
- h.Empty,
324
- {
325
- onClick: () => a.closeDropdown(),
326
- className: "min-h-6",
327
- children: s ?? "Sin resultados"
328
- }
329
- ),
330
- /* @__PURE__ */ l(
331
- fe,
332
- {
333
- className: "text-sm",
334
- infinity: t,
335
- loaderProps: {
336
- size: "sm",
337
- className: "mt-1 mb-2"
338
- }
339
- }
340
- )
341
- ]
342
- }
343
- ) })
344
- ] })
345
- ]
346
- }
347
- );
348
- }
349
- const Te = (e) => /* @__PURE__ */ l(
350
- Z,
351
- {
352
- variant: e.readOnly ? "filled" : "default",
353
- ...e
354
- }
355
- ), Ie = (e) => /* @__PURE__ */ l(
356
- re,
357
- {
358
- leftSection: /* @__PURE__ */ l(C, { size: e.size }),
359
- variant: e.readOnly ? "filled" : "default",
360
- ...e
361
- }
362
- );
363
- var Fe = /* @__PURE__ */ ((e) => (e[e.Continue = 100] = "Continue", e[e.SwitchingProtocols = 101] = "SwitchingProtocols", e[e.Processing = 102] = "Processing", e[e.EarlyHints = 103] = "EarlyHints", e[e.Ok = 200] = "Ok", e[e.Created = 201] = "Created", e[e.Accepted = 202] = "Accepted", e[e.NonAuthoritativeInformation = 203] = "NonAuthoritativeInformation", e[e.NoContent = 204] = "NoContent", e[e.ResetContent = 205] = "ResetContent", e[e.PartialContent = 206] = "PartialContent", e[e.MultiStatus = 207] = "MultiStatus", e[e.AlreadyReported = 208] = "AlreadyReported", e[e.ImUsed = 226] = "ImUsed", e[e.MultipleChoices = 300] = "MultipleChoices", e[e.MovedPermanently = 301] = "MovedPermanently", e[e.Found = 302] = "Found", e[e.SeeOther = 303] = "SeeOther", e[e.NotModified = 304] = "NotModified", e[e.UseProxy = 305] = "UseProxy", e[e.TemporaryRedirect = 307] = "TemporaryRedirect", e[e.PermanentRedirect = 308] = "PermanentRedirect", e[e.BadRequest = 400] = "BadRequest", e[e.Unauthorized = 401] = "Unauthorized", e[e.PaymentRequired = 402] = "PaymentRequired", e[e.Forbidden = 403] = "Forbidden", e[e.NotFound = 404] = "NotFound", e[e.MethodNotAllowed = 405] = "MethodNotAllowed", e[e.NotAcceptable = 406] = "NotAcceptable", e[e.ProxyAuthenticationRequired = 407] = "ProxyAuthenticationRequired", e[e.RequestTimeout = 408] = "RequestTimeout", e[e.Conflict = 409] = "Conflict", e[e.Gone = 410] = "Gone", e[e.LengthRequired = 411] = "LengthRequired", e[e.PreconditionFailed = 412] = "PreconditionFailed", e[e.PayloadTooLarge = 413] = "PayloadTooLarge", e[e.UriTooLong = 414] = "UriTooLong", e[e.UnsupportedMediaType = 415] = "UnsupportedMediaType", e[e.RangeNotSatisfiable = 416] = "RangeNotSatisfiable", e[e.ExpectationFailed = 417] = "ExpectationFailed", e[e.MisdirectedRequest = 421] = "MisdirectedRequest", e[e.UnprocessableEntity = 422] = "UnprocessableEntity", e[e.Locked = 423] = "Locked", e[e.FailedDependency = 424] = "FailedDependency", e[e.TooEarly = 425] = "TooEarly", e[e.UpgradeRequired = 426] = "UpgradeRequired", e[e.PreconditionRequired = 428] = "PreconditionRequired", e[e.TooManyRequests = 429] = "TooManyRequests", e[e.RequestHeaderFieldsTooLarge = 431] = "RequestHeaderFieldsTooLarge", e[e.UnavailableForLegalReasons = 451] = "UnavailableForLegalReasons", e[e.InternalServerError = 500] = "InternalServerError", e[e.NotImplemented = 501] = "NotImplemented", e[e.BadGateway = 502] = "BadGateway", e[e.ServiceUnavailable = 503] = "ServiceUnavailable", e[e.GatewayTimeout = 504] = "GatewayTimeout", e[e.HttpVersionNotSupported = 505] = "HttpVersionNotSupported", e[e.VariantAlsoNegotiates = 506] = "VariantAlsoNegotiates", e[e.InsufficientStorage = 507] = "InsufficientStorage", e[e.LoopDetected = 508] = "LoopDetected", e[e.NotExtended = 510] = "NotExtended", e[e.NetworkAuthenticationRequired = 511] = "NetworkAuthenticationRequired", e))(Fe || {}), Re = /* @__PURE__ */ ((e) => (e[e.OneHour = 3600] = "OneHour", e[e.OneDay = 86400] = "OneDay", e[e.OneWeek = 604800] = "OneWeek", e[e.OneMonth = 2592e3] = "OneMonth", e[e.OneYear = 31536e3] = "OneYear", e))(Re || {});
364
- const q = R(null);
365
- function _e({ children: e }) {
366
- const o = F(), r = v(), [n, i] = k([]);
367
- return N(() => {
368
- const c = r != null && r.size ? `${o}?${r.toString()}` : o;
369
- c && i((d) => d.length > 0 && d[d.length - 1] === c ? d : [...d, c]);
370
- }, [o, r]), /* @__PURE__ */ l(q.Provider, { value: { history: n }, children: e });
371
- }
372
- const ke = "backUrl";
373
- function Ke() {
374
- const e = E(q), o = ee();
375
- if (!e)
376
- throw new Error("useNavigationHistory debe usarse dentro de un NavigationHistoryProvider");
377
- const r = v(), { history: n } = e;
378
- return {
379
- history: n,
380
- goBack: (c) => {
381
- const d = r.get(ke);
382
- if (d) {
383
- o.push(d);
384
- return;
385
- }
386
- if (n.length <= 1) {
387
- o.push(c ?? "/");
388
- return;
389
- }
390
- const s = n[n.length - 2], t = n[n.length - 1];
391
- if (n.length >= 3 && n[n.length - 3] === t) {
392
- o.push(c ?? "/");
393
- return;
394
- }
395
- o.push(s ?? "/");
396
- },
397
- currentRoute: n.length > 0 ? n[n.length - 1] : null,
398
- hasPreviousRoute: n.length > 1,
399
- getPreviousRoute: () => n.length >= 2 ? n[n.length - 2] : null
400
- };
401
- }
402
- const B = R(void 0), Qe = ({
403
- value: e,
404
- children: o
405
- }) => /* @__PURE__ */ l(B.Provider, { value: e, children: o }), Xe = () => {
406
- const e = E(B);
407
- if (e === void 0) throw new Error("Out of context: usePageData");
408
- return e;
409
- }, Se = ({
410
- methods: e,
411
- onSubmit: o = () => {
412
- },
413
- onSubmitError: r,
414
- ...n
415
- }) => /* @__PURE__ */ l(ce, { ...e, children: /* @__PURE__ */ l(
416
- j,
417
- {
418
- component: "form",
419
- onSubmit: (i) => {
420
- i.stopPropagation(), e.handleSubmit(o, r)(i);
421
- },
422
- ...n
423
- }
424
- ) }), He = (e) => {
425
- const { formState: o } = de(), { isSubmitting: r } = o;
426
- return /* @__PURE__ */ l(
427
- J,
428
- {
429
- loading: r,
430
- type: "submit",
431
- ...e
432
- }
433
- );
434
- }, Ee = (e) => (o) => {
435
- const r = e.safeParse(o);
436
- if (r.success) return;
437
- const { error: n } = r, i = n.issues[0];
438
- return i == null ? void 0 : i.message;
439
- }, eo = (e, o = "Campo requerido") => e.nullable().superRefine((r, n) => {
440
- r === null && n.addIssue({
441
- code: O.ZodIssueCode.custom,
442
- message: o
443
- });
444
- }), oo = (e, o = "Campo requerido") => e.optional().superRefine((r, n) => {
445
- r === void 0 && n.addIssue({
446
- code: O.ZodIssueCode.custom,
447
- message: o
448
- });
449
- }), u = (e, o) => {
450
- const r = (n) => {
451
- const { validate: i, name: c = "", placeholder: d, label: s, description: t, ...y } = n;
452
- return /* @__PURE__ */ l(
453
- se,
454
- {
455
- name: c,
456
- defaultValue: "",
457
- rules: {
458
- validate: i && !n.disabled ? Ee(i) : void 0
459
- },
460
- disabled: n.disabled,
461
- ...o == null ? void 0 : o(n),
462
- render: (f) => {
463
- const {
464
- fieldState: { error: a }
465
- } = f, x = {
466
- ...f,
467
- props: {
468
- ...n,
469
- validate: void 0
470
- },
471
- field: {
472
- ...f.field,
473
- label: s,
474
- placeholder: d,
475
- description: t,
476
- error: a == null ? void 0 : a.message
477
- },
478
- ...y
479
- };
480
- return /* @__PURE__ */ l(e, { ...x });
481
- }
482
- }
483
- );
484
- };
485
- return r.displayName = `WithForm(${e.displayName})`, r;
486
- }, no = (e) => {
487
- const o = ({
488
- removeModal: r,
489
- opened: n,
490
- ...i
491
- }) => {
492
- const [c, d] = k(!1), s = () => {
493
- var t;
494
- d(!1), setTimeout(() => r(), 200), (t = i.onClose) == null || t.call(i);
495
- };
496
- return N(() => {
497
- n ? setTimeout(() => d(!0), 0) : s();
498
- }, [n]), /* @__PURE__ */ l(
499
- e,
500
- {
501
- ...i,
502
- opened: c,
503
- onClose: s
504
- }
505
- );
506
- };
507
- return o.displayName = `WithModalManager(${e.displayName})`, o;
508
- }, ro = u(({ field: e, props: o }) => /* @__PURE__ */ l(
509
- W,
510
- {
511
- ...e,
512
- checked: e.value,
513
- ...o
514
- }
515
- )), io = u(({ field: e, props: o }) => /* @__PURE__ */ l(
516
- ye,
517
- {
518
- ...e,
519
- ...o
520
- }
521
- )), lo = u(({ field: e, props: o }) => /* @__PURE__ */ l(
522
- ge,
523
- {
524
- ...e,
525
- ...o
526
- }
527
- )), co = u(({ field: e, props: o }) => /* @__PURE__ */ l(
528
- xe,
529
- {
530
- ...e,
531
- ...o
532
- }
533
- )), so = u(({ field: e, props: o }) => /* @__PURE__ */ l(
534
- Y.Group,
535
- {
536
- ...e,
537
- ...o
538
- }
539
- )), to = u(({ field: e, props: o }) => /* @__PURE__ */ l(
540
- Pe,
541
- {
542
- ...e,
543
- ...o
544
- }
545
- )), ao = u(({ field: e, props: o }) => /* @__PURE__ */ l(
546
- be,
547
- {
548
- ...e,
549
- ...o
550
- }
551
- )), uo = u(({ field: e, props: o }) => /* @__PURE__ */ l(
552
- ve,
553
- {
554
- ...e,
555
- ...o
556
- }
557
- )), mo = u(({ field: e, props: o }) => /* @__PURE__ */ l(
558
- Ne,
559
- {
560
- ...e,
561
- ...o
562
- }
563
- )), ho = u(({ field: e, props: o }) => /* @__PURE__ */ l(
564
- Ce,
565
- {
566
- ...e,
567
- ...o
568
- }
569
- )), fo = (e) => {
570
- const [o, r] = e.split(":").map(Number), n = o + r / 60;
571
- return Number(n.toFixed(2));
572
- }, yo = (e) => {
573
- const o = Math.floor(e), r = Math.round((e - o) * 60);
574
- return `${o.toString().padStart(2, "0")}:${r.toString().padStart(2, "0")}`;
575
- }, go = u(({ field: e, props: o }) => /* @__PURE__ */ l(
576
- Te,
577
- {
578
- ...e,
579
- ...o
580
- }
581
- )), xo = u(({ field: e, props: o }) => /* @__PURE__ */ l(
582
- Ie,
583
- {
584
- ...e,
585
- ...o
586
- }
587
- )), Po = (e) => !!_({
588
- [e]: !0
589
- }), vo = () => {
590
- const e = v();
591
- return { updateSearchParams: (r) => {
592
- var i;
593
- const n = new URLSearchParams(e.toString());
594
- Object.entries(r).forEach(([c, d]) => {
595
- if (d === null) {
596
- n.delete(c);
597
- return;
598
- }
599
- n.set(c, String(d));
600
- }), (i = window == null ? void 0 : window.history) == null || i.pushState(null, "", `?${n.toString()}`);
601
- }, searchParams: e };
602
- }, Oe = {
603
- xs: "576px",
604
- sm: "640px",
605
- md: "768px",
606
- lg: "1024px",
607
- xl: "1280px",
608
- "2xl": "1536px"
609
- }, No = (e) => Object.entries(e).reduce(
610
- (o, [r, n]) => (o[r] = n.reduce(
611
- (i, c, d) => (i[d] = c, i),
612
- {}
613
- ), o),
614
- {}
615
- ), Co = {
616
- breakpoints: Oe,
617
- cursorType: "pointer",
618
- components: {
619
- Notification: S.extend({
620
- defaultProps: {
621
- withBorder: !0
622
- }
623
- }),
624
- AppShell: X.extend({
625
- defaultProps: {
626
- padding: 0
627
- }
628
- }),
629
- Select: T.extend({
630
- defaultProps: {
631
- allowDeselect: !1,
632
- withCheckIcon: !1,
633
- clearable: !0
634
- }
635
- }),
636
- Menu: Q.extend({
637
- defaultProps: {
638
- position: "bottom-end"
639
- }
640
- }),
641
- Tooltip: K.extend({
642
- defaultProps: {
643
- multiline: !0,
644
- w: 300
645
- }
646
- })
647
- }
648
- };
649
- function Mo(e, o = 2) {
650
- if (!+e) return "0 Bytes";
651
- const r = 1024, n = o < 0 ? 0 : o, i = ["Bytes", "KB", "MB"], c = Math.floor(Math.log(e) / Math.log(r));
652
- return `${parseFloat((e / Math.pow(r, c)).toFixed(n))} ${i[c]}`;
653
- }
654
- const qe = async (e) => e.text().then(function(o) {
655
- return o ? JSON.parse(o) : {};
656
- });
657
- class wo extends te {
658
- constructor(o, r, n, i) {
659
- super(o, r, n), this.response.bodyJson = i;
660
- }
661
- }
662
- const bo = async (e) => (e.response.bodyJson = await qe(e.response), e);
663
- function To(e, o, r) {
664
- return r ? e.reduce(
665
- (n, i) => {
666
- const c = o(i);
667
- return c === void 0 || (n[c] = r(i)), n;
668
- },
669
- {}
670
- ) : e.reduce(
671
- (n, i) => {
672
- const c = o(i);
673
- return c === void 0 || (n[c] = i), n;
674
- },
675
- {}
676
- );
677
- }
678
- const Io = (e, o) => {
679
- const r = {};
680
- return e == null || e.forEach((n) => {
681
- var c;
682
- const i = o(n);
683
- if (i !== null) {
684
- if (Array.isArray(i)) {
685
- i.forEach((d) => {
686
- var s;
687
- r[d] || (r[d] = []), (s = r[d]) == null || s.push(n);
688
- });
689
- return;
690
- }
691
- r[i] || (r[i] = []), (c = r[i]) == null || c.push(n);
692
- }
693
- }), r;
694
- }, Fo = (e) => {
695
- const o = [...e];
696
- let r = o.length, n;
697
- for (; r > 0; )
698
- n = Math.floor(Math.random() * r), r--, [o[r], o[n]] = [
699
- o[n],
700
- o[r]
701
- ];
702
- return o;
703
- }, Ro = (e) => (o) => {
704
- const r = typeof e == "string" ? e : e(
705
- o ?? {
706
- params: {},
707
- searchParams: {}
708
- }
709
- );
710
- if (o != null && o.searchParams) {
711
- const n = ae.stringify(o.searchParams, {
712
- skipEmptyString: !0,
713
- skipNull: !0
714
- });
715
- return `${r}${n ? `?${n}` : ""}`;
716
- }
717
- return r;
718
- }, ko = (e) => (e == null ? void 0 : e.pages[0].data.length) === 0;
719
- export {
720
- Je as EmptyState,
721
- Se as Form,
722
- He as FormButtonSubmit,
723
- ro as FormCheckbox,
724
- io as FormDatePickerInput,
725
- lo as FormDateTimePicker,
726
- xo as FormMonthPickerInput,
727
- go as FormMultiSelect,
728
- co as FormNumberInput,
729
- so as FormRadioGroup,
730
- to as FormSelect,
731
- ao as FormSelectInfinity,
732
- mo as FormTextInput,
733
- uo as FormTextarea,
734
- ho as FormTimeInput,
735
- Fe as HttpStatus,
736
- ue as Icon,
737
- fe as InfinityLoader,
738
- wo as KyError,
739
- ye as MyDatePickerInput,
740
- ge as MyDateTimePicker,
741
- Ie as MyMonthPickerInput,
742
- Te as MyMultiSelect,
743
- Ye as MyNotifications,
744
- xe as MyNumberInput,
745
- Pe as MySelect,
746
- Ne as MyTextInput,
747
- ve as MyTextarea,
748
- Ce as MyTimeInput,
749
- We as NavItems,
750
- _e as NavigationHistoryProvider,
751
- Qe as PageDataProvider,
752
- ke as QP_BACK_URL_NAME,
753
- Re as Revalidate,
754
- be as SelectInfinity,
755
- bo as addBodyJsonHook,
756
- Oe as breakpointsWithPx,
757
- Mo as formatBytes,
758
- Io as groupBy,
759
- To as indexBy,
760
- ko as isInfinityEmpty,
761
- Co as myDefaultTheme,
762
- Ro as newHref,
763
- eo as nullableButRequired,
764
- yo as numberToTimeInput,
765
- oo as optionalButRequired,
766
- qe as parseJSON,
767
- Fo as shuffleArray,
768
- fo as timeInputToNumber,
769
- No as toTailwindColors,
770
- Po as useBreakpoint,
771
- we as useFetchNextPageOnScroll,
772
- Ke as useNavigationHistory,
773
- Me as useOnScrollProgress,
774
- Xe as usePageData,
775
- vo as useUpdateSearchParams,
776
- u as withForm,
777
- no as withModalManager,
778
- Ee as zodValidator
779
- };