lkd-web-kit 0.0.15 → 0.0.16

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 (113) hide show
  1. package/dist/components/EmptyState/index.cjs +2 -0
  2. package/dist/components/EmptyState/index.cjs.map +1 -0
  3. package/dist/components/EmptyState/index.mjs +37 -0
  4. package/dist/components/EmptyState/index.mjs.map +1 -0
  5. package/dist/components/Icon.cjs +2 -0
  6. package/dist/components/Icon.cjs.map +1 -0
  7. package/dist/components/Icon.mjs +55 -0
  8. package/dist/components/Icon.mjs.map +1 -0
  9. package/dist/components/InfinityLoader/index.cjs +2 -0
  10. package/dist/components/InfinityLoader/index.cjs.map +1 -0
  11. package/dist/components/InfinityLoader/index.mjs +7 -0
  12. package/dist/components/InfinityLoader/index.mjs.map +1 -0
  13. package/dist/components/NavItems.cjs +2 -0
  14. package/dist/components/NavItems.cjs.map +1 -0
  15. package/dist/components/NavItems.mjs +37 -0
  16. package/dist/components/NavItems.mjs.map +1 -0
  17. package/dist/components/SelectInfinity/index.cjs +2 -0
  18. package/dist/components/SelectInfinity/index.cjs.map +1 -0
  19. package/dist/components/SelectInfinity/index.mjs +107 -0
  20. package/dist/components/SelectInfinity/index.mjs.map +1 -0
  21. package/dist/consts/http-status.cjs +2 -0
  22. package/dist/consts/http-status.cjs.map +1 -0
  23. package/dist/consts/http-status.mjs +5 -0
  24. package/dist/consts/http-status.mjs.map +1 -0
  25. package/dist/consts/revalidate.cjs +2 -0
  26. package/dist/consts/revalidate.cjs.map +1 -0
  27. package/dist/consts/revalidate.mjs +5 -0
  28. package/dist/consts/revalidate.mjs.map +1 -0
  29. package/dist/contexts/NavigationHistoryContext/index.cjs +2 -0
  30. package/dist/contexts/NavigationHistoryContext/index.cjs.map +1 -0
  31. package/dist/contexts/NavigationHistoryContext/index.mjs +48 -0
  32. package/dist/contexts/NavigationHistoryContext/index.mjs.map +1 -0
  33. package/dist/contexts/PageDataContext/index.cjs +2 -0
  34. package/dist/contexts/PageDataContext/index.cjs.map +1 -0
  35. package/dist/contexts/PageDataContext/index.mjs +16 -0
  36. package/dist/contexts/PageDataContext/index.mjs.map +1 -0
  37. package/dist/form/Form.cjs +2 -0
  38. package/dist/form/Form.cjs.map +1 -0
  39. package/dist/form/Form.mjs +22 -0
  40. package/dist/form/Form.mjs.map +1 -0
  41. package/dist/form/FormButtonSubmit.cjs +2 -0
  42. package/dist/form/FormButtonSubmit.cjs.map +1 -0
  43. package/dist/form/FormButtonSubmit.mjs +19 -0
  44. package/dist/form/FormButtonSubmit.mjs.map +1 -0
  45. package/dist/form/utils/nullableInput.cjs +2 -0
  46. package/dist/form/utils/nullableInput.cjs.map +1 -0
  47. package/dist/form/utils/nullableInput.mjs +10 -0
  48. package/dist/form/utils/nullableInput.mjs.map +1 -0
  49. package/dist/form/utils/zodValidator.cjs +2 -0
  50. package/dist/form/utils/zodValidator.cjs.map +1 -0
  51. package/dist/form/utils/zodValidator.mjs +10 -0
  52. package/dist/form/utils/zodValidator.mjs.map +1 -0
  53. package/dist/hocs/withForm.cjs +2 -0
  54. package/dist/hocs/withForm.cjs.map +1 -0
  55. package/dist/hocs/withForm.mjs +48 -0
  56. package/dist/hocs/withForm.mjs.map +1 -0
  57. package/dist/hocs/withModalManager.cjs +2 -0
  58. package/dist/hocs/withModalManager.cjs.map +1 -0
  59. package/dist/hocs/withModalManager.mjs +29 -0
  60. package/dist/hocs/withModalManager.mjs.map +1 -0
  61. package/dist/hooks/useFetchNextPageOnScroll.cjs +2 -0
  62. package/dist/hooks/useFetchNextPageOnScroll.cjs.map +1 -0
  63. package/dist/hooks/useFetchNextPageOnScroll.mjs +18 -0
  64. package/dist/hooks/useFetchNextPageOnScroll.mjs.map +1 -0
  65. package/dist/hooks/useOnScrollProgress.cjs +2 -0
  66. package/dist/hooks/useOnScrollProgress.cjs.map +1 -0
  67. package/dist/hooks/useOnScrollProgress.mjs +19 -0
  68. package/dist/hooks/useOnScrollProgress.mjs.map +1 -0
  69. package/dist/index.cjs +2 -0
  70. package/dist/index.cjs.map +1 -0
  71. package/dist/index.mjs +61 -0
  72. package/dist/index.mjs.map +1 -0
  73. package/dist/mantine/breakpointsWithPx.cjs +2 -0
  74. package/dist/mantine/breakpointsWithPx.cjs.map +1 -0
  75. package/dist/mantine/breakpointsWithPx.mjs +12 -0
  76. package/dist/mantine/breakpointsWithPx.mjs.map +1 -0
  77. package/dist/mantine/toTailwindColors.cjs +2 -0
  78. package/dist/mantine/toTailwindColors.cjs.map +1 -0
  79. package/dist/mantine/toTailwindColors.mjs +11 -0
  80. package/dist/mantine/toTailwindColors.mjs.map +1 -0
  81. package/dist/utils/array/groupBy.cjs +2 -0
  82. package/dist/utils/array/groupBy.cjs.map +1 -0
  83. package/dist/utils/array/groupBy.mjs +35 -0
  84. package/dist/utils/array/groupBy.mjs.map +1 -0
  85. package/dist/utils/array/shuffleArray.cjs +2 -0
  86. package/dist/utils/array/shuffleArray.cjs.map +1 -0
  87. package/dist/utils/array/shuffleArray.mjs +14 -0
  88. package/dist/utils/array/shuffleArray.mjs.map +1 -0
  89. package/dist/utils/formatBytes.cjs +2 -0
  90. package/dist/utils/formatBytes.cjs.map +1 -0
  91. package/dist/utils/formatBytes.mjs +9 -0
  92. package/dist/utils/formatBytes.mjs.map +1 -0
  93. package/dist/utils/isInfinityEmpty.cjs +2 -0
  94. package/dist/utils/isInfinityEmpty.cjs.map +1 -0
  95. package/dist/utils/isInfinityEmpty.mjs +5 -0
  96. package/dist/utils/isInfinityEmpty.mjs.map +1 -0
  97. package/dist/utils/ky/addBodyJsonHook.cjs +2 -0
  98. package/dist/utils/ky/addBodyJsonHook.cjs.map +1 -0
  99. package/dist/utils/ky/addBodyJsonHook.mjs +6 -0
  100. package/dist/utils/ky/addBodyJsonHook.mjs.map +1 -0
  101. package/dist/utils/ky/parseJson.cjs +2 -0
  102. package/dist/utils/ky/parseJson.cjs.map +1 -0
  103. package/dist/utils/ky/parseJson.mjs +7 -0
  104. package/dist/utils/ky/parseJson.mjs.map +1 -0
  105. package/dist/utils/newHref.cjs +2 -0
  106. package/dist/utils/newHref.cjs.map +1 -0
  107. package/dist/utils/newHref.mjs +21 -0
  108. package/dist/utils/newHref.mjs.map +1 -0
  109. package/package.json +5 -5
  110. package/dist/lkd-web-kit.cjs +0 -33
  111. package/dist/lkd-web-kit.cjs.map +0 -1
  112. package/dist/lkd-web-kit.js +0 -4359
  113. package/dist/lkd-web-kit.js.map +0 -1
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { jsx as r } from "react/jsx-runtime";
3
+ import { Button as i } from "@mantine/core";
4
+ import { useFormContext as n } from "react-hook-form";
5
+ const p = (t) => {
6
+ const { formState: o } = n(), { isSubmitting: m } = o;
7
+ return /* @__PURE__ */ r(
8
+ i,
9
+ {
10
+ loading: m,
11
+ type: "submit",
12
+ ...t
13
+ }
14
+ );
15
+ };
16
+ export {
17
+ p as FormButtonSubmit
18
+ };
19
+ //# sourceMappingURL=FormButtonSubmit.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormButtonSubmit.mjs","sources":["../../src/form/FormButtonSubmit.tsx"],"sourcesContent":["'use client';\r\nimport { Button, ButtonProps, ElementProps } from '@mantine/core';\r\nimport { useFormContext } from 'react-hook-form';\r\n\r\nexport interface FormButtonSubmitProps\r\n extends ButtonProps,\r\n ElementProps<'button', keyof ButtonProps> {}\r\n\r\nexport const FormButtonSubmit = (props: FormButtonSubmitProps) => {\r\n const { formState } = useFormContext();\r\n\r\n const { isSubmitting } = formState;\r\n\r\n return (\r\n <Button\r\n // disabled={isSubmitSuccessful}\r\n loading={isSubmitting}\r\n type=\"submit\"\r\n {...props}\r\n />\r\n );\r\n};\r\n"],"names":["FormButtonSubmit","props","formState","useFormContext","isSubmitting","jsx","Button"],"mappings":";;;;AAQa,MAAAA,IAAmB,CAACC,MAAiC;AAC1D,QAAA,EAAE,WAAAC,EAAU,IAAIC,EAAe,GAE/B,EAAE,cAAAC,MAAiBF;AAGvB,SAAA,gBAAAG;AAAA,IAACC;AAAA,IAAA;AAAA,MAEC,SAASF;AAAA,MACT,MAAK;AAAA,MACJ,GAAGH;AAAA,IAAA;AAAA,EACN;AAEJ;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("zod"),n=(r,t="Campo requerido")=>r.nullable().transform((e,l)=>e===null?(l.addIssue({code:u.z.ZodIssueCode.custom,fatal:!0,message:t}),u.z.NEVER):e);exports.nullableInput=n;
2
+ //# sourceMappingURL=nullableInput.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nullableInput.cjs","sources":["../../../src/form/utils/nullableInput.ts"],"sourcesContent":["import { ZodTypeAny, z } from \"zod\";\r\n\r\nexport const nullableInput = <T extends ZodTypeAny>(\r\n schema: T,\r\n message = \"Campo requerido\"\r\n) => {\r\n return schema.nullable().transform((val, ctx) => {\r\n if (val === null) {\r\n ctx.addIssue({\r\n code: z.ZodIssueCode.custom,\r\n fatal: true,\r\n message\r\n });\r\n\r\n return z.NEVER;\r\n }\r\n\r\n return val;\r\n });\r\n};\r\n"],"names":["nullableInput","schema","message","val","ctx","z"],"mappings":"uGAEaA,EAAgB,CAC3BC,EACAC,EAAU,oBAEHD,EAAO,SAAS,EAAE,UAAU,CAACE,EAAKC,IACnCD,IAAQ,MACVC,EAAI,SAAS,CACX,KAAMC,EAAAA,EAAE,aAAa,OACrB,MAAO,GACP,QAAAH,CAAA,CACD,EAEMG,EAAE,EAAA,OAGJF,CACR"}
@@ -0,0 +1,10 @@
1
+ import { z as e } from "zod";
2
+ const l = (u, o = "Campo requerido") => u.nullable().transform((r, t) => r === null ? (t.addIssue({
3
+ code: e.ZodIssueCode.custom,
4
+ fatal: !0,
5
+ message: o
6
+ }), e.NEVER) : r);
7
+ export {
8
+ l as nullableInput
9
+ };
10
+ //# sourceMappingURL=nullableInput.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nullableInput.mjs","sources":["../../../src/form/utils/nullableInput.ts"],"sourcesContent":["import { ZodTypeAny, z } from \"zod\";\r\n\r\nexport const nullableInput = <T extends ZodTypeAny>(\r\n schema: T,\r\n message = \"Campo requerido\"\r\n) => {\r\n return schema.nullable().transform((val, ctx) => {\r\n if (val === null) {\r\n ctx.addIssue({\r\n code: z.ZodIssueCode.custom,\r\n fatal: true,\r\n message\r\n });\r\n\r\n return z.NEVER;\r\n }\r\n\r\n return val;\r\n });\r\n};\r\n"],"names":["nullableInput","schema","message","val","ctx","z"],"mappings":";AAEO,MAAMA,IAAgB,CAC3BC,GACAC,IAAU,sBAEHD,EAAO,SAAS,EAAE,UAAU,CAACE,GAAKC,MACnCD,MAAQ,QACVC,EAAI,SAAS;AAAA,EACX,MAAMC,EAAE,aAAa;AAAA,EACrB,OAAO;AAAA,EACP,SAAAH;AAAA,CACD,GAEMG,EAAE,SAGJF,CACR;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=s=>e=>{const r=s.safeParse(e);if(r.success)return;const{error:t}=r;return t.issues[0]?.message};exports.zodValidator=o;
2
+ //# sourceMappingURL=zodValidator.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zodValidator.cjs","sources":["../../../src/form/utils/zodValidator.ts"],"sourcesContent":["import { ZodTypeAny } from 'zod';\r\n\r\nexport const zodValidator = (schema: ZodTypeAny) => {\r\n return (values: any) => {\r\n const result = schema.safeParse(values);\r\n if (result.success) return;\r\n\r\n const { error } = result;\r\n const firstError = error.issues[0];\r\n\r\n return firstError?.message;\r\n };\r\n};\r\n"],"names":["zodValidator","schema","values","result","error"],"mappings":"gFAEa,MAAAA,EAAgBC,GACnBC,GAAgB,CAChB,MAAAC,EAASF,EAAO,UAAUC,CAAM,EACtC,GAAIC,EAAO,QAAS,OAEd,KAAA,CAAE,MAAAC,GAAUD,EAGlB,OAFmBC,EAAM,OAAO,CAAC,GAEd,OACrB"}
@@ -0,0 +1,10 @@
1
+ const n = (s) => (e) => {
2
+ const r = s.safeParse(e);
3
+ if (r.success) return;
4
+ const { error: t } = r;
5
+ return t.issues[0]?.message;
6
+ };
7
+ export {
8
+ n as zodValidator
9
+ };
10
+ //# sourceMappingURL=zodValidator.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zodValidator.mjs","sources":["../../../src/form/utils/zodValidator.ts"],"sourcesContent":["import { ZodTypeAny } from 'zod';\r\n\r\nexport const zodValidator = (schema: ZodTypeAny) => {\r\n return (values: any) => {\r\n const result = schema.safeParse(values);\r\n if (result.success) return;\r\n\r\n const { error } = result;\r\n const firstError = error.issues[0];\r\n\r\n return firstError?.message;\r\n };\r\n};\r\n"],"names":["zodValidator","schema","values","result","error"],"mappings":"AAEa,MAAAA,IAAe,CAACC,MACpB,CAACC,MAAgB;AAChB,QAAAC,IAASF,EAAO,UAAUC,CAAM;AACtC,MAAIC,EAAO,QAAS;AAEd,QAAA,EAAE,OAAAC,MAAUD;AAGlB,SAFmBC,EAAM,OAAO,CAAC,GAEd;AACrB;"}
@@ -0,0 +1,2 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),b=require("react-hook-form");require("@mantine/core");const f=require("../form/utils/zodValidator.cjs");require("zod");const h=(r,a)=>{const t=e=>{const{validate:l,name:d="",placeholder:s,label:u,description:c,...n}=e;return o.jsx(b.Controller,{name:d,defaultValue:"",rules:{validate:l&&!e.disabled?f.zodValidator(l):void 0},disabled:e.disabled,...a?.(e),render:i=>{const{fieldState:{isTouched:v,error:m}}=i,F={...i,props:{...e,validate:void 0},field:{...i.field,label:u,placeholder:s,description:c,error:m?.message},...n};return o.jsx(r,{...F})}})};return t.displayName=`withForm(${r.displayName})`,t};exports.withForm=h;
2
+ //# sourceMappingURL=withForm.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withForm.cjs","sources":["../../src/hocs/withForm.tsx"],"sourcesContent":["'use client';\r\nimport { Controller, ControllerProps } from 'react-hook-form';\r\nimport { ZodTypeAny } from 'zod';\r\nimport { zodValidator } from '../form';\r\n\r\nexport interface WithFormProps {\r\n name?: string;\r\n label?: React.ReactNode;\r\n placeholder?: string;\r\n description?: React.ReactNode;\r\n validate?: ZodTypeAny;\r\n disabled?: boolean;\r\n}\r\n\r\nexport type FormFieldProps<T = unknown> = Parameters<ControllerProps['render']>[0] & {\r\n props: T;\r\n field: {\r\n label?: React.ReactNode;\r\n placeholder?: string;\r\n description?: React.ReactNode;\r\n error?: string;\r\n };\r\n};\r\n\r\nexport const withForm = <P extends unknown>(\r\n WrappedComponent: React.ComponentType<FormFieldProps<P>>,\r\n getControllerProps?: (props: P) => Omit<Partial<ControllerProps>, 'render'>,\r\n) => {\r\n const FormField: React.FC<P & WithFormProps> = (props) => {\r\n const { validate, name = '', placeholder, label, description, ...withFormRestProps } = props;\r\n\r\n return (\r\n <Controller\r\n name={name}\r\n defaultValue={''}\r\n rules={{\r\n validate: validate && !props.disabled ? zodValidator(validate) : undefined,\r\n }}\r\n disabled={props.disabled}\r\n {...getControllerProps?.(props)}\r\n render={(renderProps) => {\r\n const {\r\n fieldState: { isTouched, error },\r\n } = renderProps;\r\n\r\n const fieldProps = {\r\n ...renderProps,\r\n props: {\r\n ...props,\r\n validate: undefined,\r\n },\r\n field: {\r\n ...renderProps.field,\r\n label,\r\n placeholder,\r\n description,\r\n error: error?.message,\r\n },\r\n ...withFormRestProps,\r\n } as FormFieldProps<P>;\r\n\r\n return <WrappedComponent {...fieldProps} />;\r\n }}\r\n />\r\n );\r\n };\r\n\r\n FormField.displayName = `withForm(${WrappedComponent.displayName})`;\r\n\r\n return FormField;\r\n};\r\n"],"names":["withForm","WrappedComponent","getControllerProps","FormField","props","validate","name","placeholder","label","description","withFormRestProps","jsx","Controller","zodValidator","renderProps","isTouched","error","fieldProps"],"mappings":"yPAwBa,MAAAA,EAAW,CACtBC,EACAC,IACG,CACG,MAAAC,EAA0CC,GAAU,CAClD,KAAA,CAAE,SAAAC,EAAU,KAAAC,EAAO,GAAI,YAAAC,EAAa,MAAAC,EAAO,YAAAC,EAAa,GAAGC,CAAA,EAAsBN,EAGrF,OAAAO,EAAA,IAACC,EAAA,WAAA,CACC,KAAAN,EACA,aAAc,GACd,MAAO,CACL,SAAUD,GAAY,CAACD,EAAM,SAAWS,EAAAA,aAAaR,CAAQ,EAAI,MACnE,EACA,SAAUD,EAAM,SACf,GAAGF,IAAqBE,CAAK,EAC9B,OAASU,GAAgB,CACjB,KAAA,CACJ,WAAY,CAAE,UAAAC,EAAW,MAAAC,CAAM,CAAA,EAC7BF,EAEEG,EAAa,CACjB,GAAGH,EACH,MAAO,CACL,GAAGV,EACH,SAAU,MACZ,EACA,MAAO,CACL,GAAGU,EAAY,MACf,MAAAN,EACA,YAAAD,EACA,YAAAE,EACA,MAAOO,GAAO,OAChB,EACA,GAAGN,CACL,EAEO,OAAAC,MAACV,EAAkB,CAAA,GAAGgB,CAAY,CAAA,CAAA,CAC3C,CACF,CAEJ,EAEU,OAAAd,EAAA,YAAc,YAAYF,EAAiB,WAAW,IAEzDE,CACT"}
@@ -0,0 +1,48 @@
1
+ "use client";
2
+ import { jsx as o } from "react/jsx-runtime";
3
+ import { Controller as h } from "react-hook-form";
4
+ import "@mantine/core";
5
+ import { zodValidator as v } from "../form/utils/zodValidator.mjs";
6
+ import "zod";
7
+ const V = (t, d) => {
8
+ const r = (e) => {
9
+ const { validate: l, name: a = "", placeholder: m, label: s, description: c, ...n } = e;
10
+ return /* @__PURE__ */ o(
11
+ h,
12
+ {
13
+ name: a,
14
+ defaultValue: "",
15
+ rules: {
16
+ validate: l && !e.disabled ? v(l) : void 0
17
+ },
18
+ disabled: e.disabled,
19
+ ...d?.(e),
20
+ render: (i) => {
21
+ const {
22
+ fieldState: { isTouched: F, error: f }
23
+ } = i, u = {
24
+ ...i,
25
+ props: {
26
+ ...e,
27
+ validate: void 0
28
+ },
29
+ field: {
30
+ ...i.field,
31
+ label: s,
32
+ placeholder: m,
33
+ description: c,
34
+ error: f?.message
35
+ },
36
+ ...n
37
+ };
38
+ return /* @__PURE__ */ o(t, { ...u });
39
+ }
40
+ }
41
+ );
42
+ };
43
+ return r.displayName = `withForm(${t.displayName})`, r;
44
+ };
45
+ export {
46
+ V as withForm
47
+ };
48
+ //# sourceMappingURL=withForm.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withForm.mjs","sources":["../../src/hocs/withForm.tsx"],"sourcesContent":["'use client';\r\nimport { Controller, ControllerProps } from 'react-hook-form';\r\nimport { ZodTypeAny } from 'zod';\r\nimport { zodValidator } from '../form';\r\n\r\nexport interface WithFormProps {\r\n name?: string;\r\n label?: React.ReactNode;\r\n placeholder?: string;\r\n description?: React.ReactNode;\r\n validate?: ZodTypeAny;\r\n disabled?: boolean;\r\n}\r\n\r\nexport type FormFieldProps<T = unknown> = Parameters<ControllerProps['render']>[0] & {\r\n props: T;\r\n field: {\r\n label?: React.ReactNode;\r\n placeholder?: string;\r\n description?: React.ReactNode;\r\n error?: string;\r\n };\r\n};\r\n\r\nexport const withForm = <P extends unknown>(\r\n WrappedComponent: React.ComponentType<FormFieldProps<P>>,\r\n getControllerProps?: (props: P) => Omit<Partial<ControllerProps>, 'render'>,\r\n) => {\r\n const FormField: React.FC<P & WithFormProps> = (props) => {\r\n const { validate, name = '', placeholder, label, description, ...withFormRestProps } = props;\r\n\r\n return (\r\n <Controller\r\n name={name}\r\n defaultValue={''}\r\n rules={{\r\n validate: validate && !props.disabled ? zodValidator(validate) : undefined,\r\n }}\r\n disabled={props.disabled}\r\n {...getControllerProps?.(props)}\r\n render={(renderProps) => {\r\n const {\r\n fieldState: { isTouched, error },\r\n } = renderProps;\r\n\r\n const fieldProps = {\r\n ...renderProps,\r\n props: {\r\n ...props,\r\n validate: undefined,\r\n },\r\n field: {\r\n ...renderProps.field,\r\n label,\r\n placeholder,\r\n description,\r\n error: error?.message,\r\n },\r\n ...withFormRestProps,\r\n } as FormFieldProps<P>;\r\n\r\n return <WrappedComponent {...fieldProps} />;\r\n }}\r\n />\r\n );\r\n };\r\n\r\n FormField.displayName = `withForm(${WrappedComponent.displayName})`;\r\n\r\n return FormField;\r\n};\r\n"],"names":["withForm","WrappedComponent","getControllerProps","FormField","props","validate","name","placeholder","label","description","withFormRestProps","jsx","Controller","zodValidator","renderProps","isTouched","error","fieldProps"],"mappings":";;;;;;AAwBa,MAAAA,IAAW,CACtBC,GACAC,MACG;AACG,QAAAC,IAAyC,CAACC,MAAU;AAClD,UAAA,EAAE,UAAAC,GAAU,MAAAC,IAAO,IAAI,aAAAC,GAAa,OAAAC,GAAO,aAAAC,GAAa,GAAGC,EAAA,IAAsBN;AAGrF,WAAA,gBAAAO;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAAN;AAAA,QACA,cAAc;AAAA,QACd,OAAO;AAAA,UACL,UAAUD,KAAY,CAACD,EAAM,WAAWS,EAAaR,CAAQ,IAAI;AAAA,QACnE;AAAA,QACA,UAAUD,EAAM;AAAA,QACf,GAAGF,IAAqBE,CAAK;AAAA,QAC9B,QAAQ,CAACU,MAAgB;AACjB,gBAAA;AAAA,YACJ,YAAY,EAAE,WAAAC,GAAW,OAAAC,EAAM;AAAA,UAAA,IAC7BF,GAEEG,IAAa;AAAA,YACjB,GAAGH;AAAA,YACH,OAAO;AAAA,cACL,GAAGV;AAAA,cACH,UAAU;AAAA,YACZ;AAAA,YACA,OAAO;AAAA,cACL,GAAGU,EAAY;AAAA,cACf,OAAAN;AAAA,cACA,aAAAD;AAAA,cACA,aAAAE;AAAA,cACA,OAAOO,GAAO;AAAA,YAChB;AAAA,YACA,GAAGN;AAAA,UACL;AAEO,iBAAA,gBAAAC,EAACV,GAAkB,EAAA,GAAGgB,EAAY,CAAA;AAAA,QAAA;AAAA,MAC3C;AAAA,IACF;AAAA,EAEJ;AAEU,SAAAd,EAAA,cAAc,YAAYF,EAAiB,WAAW,KAEzDE;AACT;"}
@@ -0,0 +1,2 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),i=require("react"),c=e=>{const t=({removeModal:r,opened:s,...n})=>{const[l,a]=i.useState(!1),o=()=>{a(!1),setTimeout(()=>r(),200),n.onClose?.()};return i.useEffect(()=>{s?setTimeout(()=>a(!0),0):o()},[s]),u.jsx(e,{...n,opened:l,onClose:o})};return t.displayName=`withModalManager(${e.displayName})`,t};exports.withModalManager=c;
2
+ //# sourceMappingURL=withModalManager.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withModalManager.cjs","sources":["../../src/hocs/withModalManager.tsx"],"sourcesContent":["'use client';\r\nimport { ModalProps } from '@mantine/core';\r\nimport { useEffect, useState } from 'react';\r\n\r\nexport interface WithModalManagerProps {\r\n removeModal: () => void;\r\n opened: boolean;\r\n}\r\n\r\nexport const withModalManager = <P extends Object>(\r\n WrappedComponent: React.ComponentType<P & ModalProps>,\r\n) => {\r\n const Component: React.FC<P & WithModalManagerProps & ModalProps> = ({\r\n removeModal,\r\n opened,\r\n ...props\r\n }) => {\r\n const [isOpen, setIsOpen] = useState(false);\r\n\r\n const onClose = () => {\r\n setIsOpen(false);\r\n setTimeout(() => removeModal(), 200);\r\n props.onClose?.();\r\n };\r\n\r\n useEffect(() => {\r\n if (opened) setTimeout(() => setIsOpen(true), 0);\r\n else onClose();\r\n }, [opened]);\r\n\r\n return (\r\n <WrappedComponent\r\n {...(props as P)}\r\n opened={isOpen}\r\n onClose={onClose}\r\n />\r\n );\r\n };\r\n\r\n Component.displayName = `withModalManager(${WrappedComponent.displayName})`;\r\n\r\n return Component;\r\n};\r\n"],"names":["withModalManager","WrappedComponent","Component","removeModal","opened","props","isOpen","setIsOpen","useState","onClose","useEffect","jsx"],"mappings":"qJASaA,EACXC,GACG,CACH,MAAMC,EAA8D,CAAC,CACnE,YAAAC,EACA,OAAAC,EACA,GAAGC,CAAA,IACC,CACJ,KAAM,CAACC,EAAQC,CAAS,EAAIC,EAAAA,SAAS,EAAK,EAEpCC,EAAU,IAAM,CACpBF,EAAU,EAAK,EACJ,WAAA,IAAMJ,EAAY,EAAG,GAAG,EACnCE,EAAM,UAAU,CAClB,EAEAK,OAAAA,EAAAA,UAAU,IAAM,CACVN,EAAmB,WAAA,IAAMG,EAAU,EAAI,EAAG,CAAC,EAClCE,EAAA,CAAA,EACZ,CAACL,CAAM,CAAC,EAGTO,EAAA,IAACV,EAAA,CACE,GAAII,EACL,OAAQC,EACR,QAAAG,CAAA,CACF,CAEJ,EAEU,OAAAP,EAAA,YAAc,oBAAoBD,EAAiB,WAAW,IAEjEC,CACT"}
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { jsx as r } from "react/jsx-runtime";
3
+ import { useState as m, useEffect as u } from "react";
4
+ const M = (e) => {
5
+ const t = ({
6
+ removeModal: i,
7
+ opened: s,
8
+ ...o
9
+ }) => {
10
+ const [l, n] = m(!1), a = () => {
11
+ n(!1), setTimeout(() => i(), 200), o.onClose?.();
12
+ };
13
+ return u(() => {
14
+ s ? setTimeout(() => n(!0), 0) : a();
15
+ }, [s]), /* @__PURE__ */ r(
16
+ e,
17
+ {
18
+ ...o,
19
+ opened: l,
20
+ onClose: a
21
+ }
22
+ );
23
+ };
24
+ return t.displayName = `withModalManager(${e.displayName})`, t;
25
+ };
26
+ export {
27
+ M as withModalManager
28
+ };
29
+ //# sourceMappingURL=withModalManager.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withModalManager.mjs","sources":["../../src/hocs/withModalManager.tsx"],"sourcesContent":["'use client';\r\nimport { ModalProps } from '@mantine/core';\r\nimport { useEffect, useState } from 'react';\r\n\r\nexport interface WithModalManagerProps {\r\n removeModal: () => void;\r\n opened: boolean;\r\n}\r\n\r\nexport const withModalManager = <P extends Object>(\r\n WrappedComponent: React.ComponentType<P & ModalProps>,\r\n) => {\r\n const Component: React.FC<P & WithModalManagerProps & ModalProps> = ({\r\n removeModal,\r\n opened,\r\n ...props\r\n }) => {\r\n const [isOpen, setIsOpen] = useState(false);\r\n\r\n const onClose = () => {\r\n setIsOpen(false);\r\n setTimeout(() => removeModal(), 200);\r\n props.onClose?.();\r\n };\r\n\r\n useEffect(() => {\r\n if (opened) setTimeout(() => setIsOpen(true), 0);\r\n else onClose();\r\n }, [opened]);\r\n\r\n return (\r\n <WrappedComponent\r\n {...(props as P)}\r\n opened={isOpen}\r\n onClose={onClose}\r\n />\r\n );\r\n };\r\n\r\n Component.displayName = `withModalManager(${WrappedComponent.displayName})`;\r\n\r\n return Component;\r\n};\r\n"],"names":["withModalManager","WrappedComponent","Component","removeModal","opened","props","isOpen","setIsOpen","useState","onClose","useEffect","jsx"],"mappings":";;;AASa,MAAAA,IAAmB,CAC9BC,MACG;AACH,QAAMC,IAA8D,CAAC;AAAA,IACnE,aAAAC;AAAA,IACA,QAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,MACC;AACJ,UAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GAEpCC,IAAU,MAAM;AACpB,MAAAF,EAAU,EAAK,GACJ,WAAA,MAAMJ,EAAY,GAAG,GAAG,GACnCE,EAAM,UAAU;AAAA,IAClB;AAEA,WAAAK,EAAU,MAAM;AACd,MAAIN,IAAmB,WAAA,MAAMG,EAAU,EAAI,GAAG,CAAC,IAClCE,EAAA;AAAA,IAAA,GACZ,CAACL,CAAM,CAAC,GAGT,gBAAAO;AAAA,MAACV;AAAA,MAAA;AAAA,QACE,GAAII;AAAA,QACL,QAAQC;AAAA,QACR,SAAAG;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ;AAEU,SAAAP,EAAA,cAAc,oBAAoBD,EAAiB,WAAW,KAEjEC;AACT;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),s=require("./useOnScrollProgress.cjs"),o=(e,t)=>{s.useOnScrollProgress(.9,()=>{e.hasNextPage&&e.fetchNextPage()},t),r.useEffect(()=>{const c=t?.current??document.documentElement;!(c.scrollHeight>c.clientHeight)&&e.hasNextPage&&e.fetchNextPage()},[e.data,t])};exports.useFetchNextPageOnScroll=o;
2
+ //# sourceMappingURL=useFetchNextPageOnScroll.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFetchNextPageOnScroll.cjs","sources":["../../src/hooks/useFetchNextPageOnScroll.ts"],"sourcesContent":["import { InfiniteData } from '@tanstack/react-query';\r\nimport { RefObject, useEffect } from 'react';\r\nimport { InfiniteQueryHookResult } from 'react-query-kit';\r\nimport { useOnScrollProgress } from './useOnScrollProgress';\r\n\r\nexport const useFetchNextPageOnScroll = (\r\n infinity: InfiniteQueryHookResult<InfiniteData<{ data: unknown[] }, number>, Error>,\r\n elementRef?: RefObject<HTMLElement | null>,\r\n) => {\r\n useOnScrollProgress(\r\n 0.9,\r\n () => {\r\n if (infinity.hasNextPage) {\r\n infinity.fetchNextPage();\r\n }\r\n },\r\n elementRef,\r\n );\r\n\r\n useEffect(() => {\r\n const el = elementRef?.current;\r\n const scrollTarget = el ?? document.documentElement;\r\n\r\n const hasScroll = scrollTarget.scrollHeight > scrollTarget.clientHeight;\r\n\r\n if (!hasScroll && infinity.hasNextPage) {\r\n infinity.fetchNextPage();\r\n }\r\n }, [infinity.data, elementRef]);\r\n};\r\n"],"names":["useFetchNextPageOnScroll","infinity","elementRef","useOnScrollProgress","useEffect","scrollTarget"],"mappings":"gJAKaA,EAA2B,CACtCC,EACAC,IACG,CACHC,EAAA,oBACE,GACA,IAAM,CACAF,EAAS,aACXA,EAAS,cAAc,CAE3B,EACAC,CACF,EAEAE,EAAAA,UAAU,IAAM,CAER,MAAAC,EADKH,GAAY,SACI,SAAS,gBAIhC,EAFcG,EAAa,aAAeA,EAAa,eAEzCJ,EAAS,aACzBA,EAAS,cAAc,CAExB,EAAA,CAACA,EAAS,KAAMC,CAAU,CAAC,CAChC"}
@@ -0,0 +1,18 @@
1
+ import { useEffect as o } from "react";
2
+ import { useOnScrollProgress as r } from "./useOnScrollProgress.mjs";
3
+ const h = (e, t) => {
4
+ r(
5
+ 0.9,
6
+ () => {
7
+ e.hasNextPage && e.fetchNextPage();
8
+ },
9
+ t
10
+ ), o(() => {
11
+ const c = t?.current ?? document.documentElement;
12
+ !(c.scrollHeight > c.clientHeight) && e.hasNextPage && e.fetchNextPage();
13
+ }, [e.data, t]);
14
+ };
15
+ export {
16
+ h as useFetchNextPageOnScroll
17
+ };
18
+ //# sourceMappingURL=useFetchNextPageOnScroll.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFetchNextPageOnScroll.mjs","sources":["../../src/hooks/useFetchNextPageOnScroll.ts"],"sourcesContent":["import { InfiniteData } from '@tanstack/react-query';\r\nimport { RefObject, useEffect } from 'react';\r\nimport { InfiniteQueryHookResult } from 'react-query-kit';\r\nimport { useOnScrollProgress } from './useOnScrollProgress';\r\n\r\nexport const useFetchNextPageOnScroll = (\r\n infinity: InfiniteQueryHookResult<InfiniteData<{ data: unknown[] }, number>, Error>,\r\n elementRef?: RefObject<HTMLElement | null>,\r\n) => {\r\n useOnScrollProgress(\r\n 0.9,\r\n () => {\r\n if (infinity.hasNextPage) {\r\n infinity.fetchNextPage();\r\n }\r\n },\r\n elementRef,\r\n );\r\n\r\n useEffect(() => {\r\n const el = elementRef?.current;\r\n const scrollTarget = el ?? document.documentElement;\r\n\r\n const hasScroll = scrollTarget.scrollHeight > scrollTarget.clientHeight;\r\n\r\n if (!hasScroll && infinity.hasNextPage) {\r\n infinity.fetchNextPage();\r\n }\r\n }, [infinity.data, elementRef]);\r\n};\r\n"],"names":["useFetchNextPageOnScroll","infinity","elementRef","useOnScrollProgress","useEffect","scrollTarget"],"mappings":";;AAKa,MAAAA,IAA2B,CACtCC,GACAC,MACG;AACH,EAAAC;AAAA,IACE;AAAA,IACA,MAAM;AACJ,MAAIF,EAAS,eACXA,EAAS,cAAc;AAAA,IAE3B;AAAA,IACAC;AAAA,EACF,GAEAE,EAAU,MAAM;AAER,UAAAC,IADKH,GAAY,WACI,SAAS;AAIhC,IAAA,EAFcG,EAAa,eAAeA,EAAa,iBAEzCJ,EAAS,eACzBA,EAAS,cAAc;AAAA,EAExB,GAAA,CAACA,EAAS,MAAMC,CAAU,CAAC;AAChC;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),h=(o,t,r)=>{if(o<0||o>1)throw new Error("El porcentaje debe estar entre 0 y 1");a.useEffect(()=>{let l=!1;const s=()=>{const n=r?.current,e=n??document.documentElement,i=e.scrollHeight-e.clientHeight,u=n?e.scrollTop:window.scrollY,d=i>0?Math.min(1,u/i):0;!l&&d>=o&&(t(),l=!0)},c=r?.current??window;return c.addEventListener("scroll",s),s(),()=>{c.removeEventListener("scroll",s)}},[o,t,r])};exports.useOnScrollProgress=h;
2
+ //# sourceMappingURL=useOnScrollProgress.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useOnScrollProgress.cjs","sources":["../../src/hooks/useOnScrollProgress.ts"],"sourcesContent":["import { RefObject, useEffect } from \"react\";\r\n\r\nexport const useOnScrollProgress = (\r\n triggerPercentage: number,\r\n callback: () => void,\r\n elementRef?: RefObject<HTMLElement | null>\r\n): void => {\r\n if (triggerPercentage < 0 || triggerPercentage > 1) {\r\n throw new Error(\"El porcentaje debe estar entre 0 y 1\");\r\n }\r\n\r\n useEffect(() => {\r\n let hasTriggered = false;\r\n\r\n const handleScroll = () => {\r\n const el = elementRef?.current;\r\n const target = el ?? document.documentElement;\r\n\r\n const scrollHeight = target.scrollHeight - target.clientHeight;\r\n const scrollTop = el ? target.scrollTop : window.scrollY;\r\n\r\n const scrollProgress =\r\n scrollHeight > 0 ? Math.min(1, scrollTop / scrollHeight) : 0;\r\n\r\n if (!hasTriggered && scrollProgress >= triggerPercentage) {\r\n callback();\r\n hasTriggered = true;\r\n }\r\n };\r\n\r\n const scrollTarget = elementRef?.current ?? window;\r\n scrollTarget.addEventListener(\"scroll\", handleScroll);\r\n handleScroll();\r\n\r\n return () => {\r\n scrollTarget.removeEventListener(\"scroll\", handleScroll);\r\n };\r\n }, [triggerPercentage, callback, elementRef]);\r\n};\r\n"],"names":["useOnScrollProgress","triggerPercentage","callback","elementRef","useEffect","hasTriggered","handleScroll","el","target","scrollHeight","scrollTop","scrollProgress","scrollTarget"],"mappings":"yGAEaA,EAAsB,CACjCC,EACAC,EACAC,IACS,CACL,GAAAF,EAAoB,GAAKA,EAAoB,EACzC,MAAA,IAAI,MAAM,sCAAsC,EAGxDG,EAAAA,UAAU,IAAM,CACd,IAAIC,EAAe,GAEnB,MAAMC,EAAe,IAAM,CACzB,MAAMC,EAAKJ,GAAY,QACjBK,EAASD,GAAM,SAAS,gBAExBE,EAAeD,EAAO,aAAeA,EAAO,aAC5CE,EAAYH,EAAKC,EAAO,UAAY,OAAO,QAE3CG,EACJF,EAAe,EAAI,KAAK,IAAI,EAAGC,EAAYD,CAAY,EAAI,EAEzD,CAACJ,GAAgBM,GAAkBV,IAC5BC,EAAA,EACMG,EAAA,GAEnB,EAEMO,EAAeT,GAAY,SAAW,OAC/B,OAAAS,EAAA,iBAAiB,SAAUN,CAAY,EACvCA,EAAA,EAEN,IAAM,CACEM,EAAA,oBAAoB,SAAUN,CAAY,CACzD,CACC,EAAA,CAACL,EAAmBC,EAAUC,CAAU,CAAC,CAC9C"}
@@ -0,0 +1,19 @@
1
+ import { useEffect as h } from "react";
2
+ const E = (o, l, r) => {
3
+ if (o < 0 || o > 1)
4
+ throw new Error("El porcentaje debe estar entre 0 y 1");
5
+ h(() => {
6
+ let e = !1;
7
+ const s = () => {
8
+ const c = r?.current, t = c ?? document.documentElement, i = t.scrollHeight - t.clientHeight, d = c ? t.scrollTop : window.scrollY, u = i > 0 ? Math.min(1, d / i) : 0;
9
+ !e && u >= o && (l(), e = !0);
10
+ }, n = r?.current ?? window;
11
+ return n.addEventListener("scroll", s), s(), () => {
12
+ n.removeEventListener("scroll", s);
13
+ };
14
+ }, [o, l, r]);
15
+ };
16
+ export {
17
+ E as useOnScrollProgress
18
+ };
19
+ //# sourceMappingURL=useOnScrollProgress.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useOnScrollProgress.mjs","sources":["../../src/hooks/useOnScrollProgress.ts"],"sourcesContent":["import { RefObject, useEffect } from \"react\";\r\n\r\nexport const useOnScrollProgress = (\r\n triggerPercentage: number,\r\n callback: () => void,\r\n elementRef?: RefObject<HTMLElement | null>\r\n): void => {\r\n if (triggerPercentage < 0 || triggerPercentage > 1) {\r\n throw new Error(\"El porcentaje debe estar entre 0 y 1\");\r\n }\r\n\r\n useEffect(() => {\r\n let hasTriggered = false;\r\n\r\n const handleScroll = () => {\r\n const el = elementRef?.current;\r\n const target = el ?? document.documentElement;\r\n\r\n const scrollHeight = target.scrollHeight - target.clientHeight;\r\n const scrollTop = el ? target.scrollTop : window.scrollY;\r\n\r\n const scrollProgress =\r\n scrollHeight > 0 ? Math.min(1, scrollTop / scrollHeight) : 0;\r\n\r\n if (!hasTriggered && scrollProgress >= triggerPercentage) {\r\n callback();\r\n hasTriggered = true;\r\n }\r\n };\r\n\r\n const scrollTarget = elementRef?.current ?? window;\r\n scrollTarget.addEventListener(\"scroll\", handleScroll);\r\n handleScroll();\r\n\r\n return () => {\r\n scrollTarget.removeEventListener(\"scroll\", handleScroll);\r\n };\r\n }, [triggerPercentage, callback, elementRef]);\r\n};\r\n"],"names":["useOnScrollProgress","triggerPercentage","callback","elementRef","useEffect","hasTriggered","handleScroll","el","target","scrollHeight","scrollTop","scrollProgress","scrollTarget"],"mappings":";AAEO,MAAMA,IAAsB,CACjCC,GACAC,GACAC,MACS;AACL,MAAAF,IAAoB,KAAKA,IAAoB;AACzC,UAAA,IAAI,MAAM,sCAAsC;AAGxD,EAAAG,EAAU,MAAM;AACd,QAAIC,IAAe;AAEnB,UAAMC,IAAe,MAAM;AACzB,YAAMC,IAAKJ,GAAY,SACjBK,IAASD,KAAM,SAAS,iBAExBE,IAAeD,EAAO,eAAeA,EAAO,cAC5CE,IAAYH,IAAKC,EAAO,YAAY,OAAO,SAE3CG,IACJF,IAAe,IAAI,KAAK,IAAI,GAAGC,IAAYD,CAAY,IAAI;AAEzD,MAAA,CAACJ,KAAgBM,KAAkBV,MAC5BC,EAAA,GACMG,IAAA;AAAA,IAEnB,GAEMO,IAAeT,GAAY,WAAW;AAC/B,WAAAS,EAAA,iBAAiB,UAAUN,CAAY,GACvCA,EAAA,GAEN,MAAM;AACE,MAAAM,EAAA,oBAAoB,UAAUN,CAAY;AAAA,IACzD;AAAA,EACC,GAAA,CAACL,GAAmBC,GAAUC,CAAU,CAAC;AAC9C;"}
package/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./components/EmptyState/index.cjs"),i=require("./components/InfinityLoader/index.cjs"),n=require("./components/SelectInfinity/index.cjs"),a=require("./components/NavItems.cjs");require("react/jsx-runtime");require("clsx");const s=require("./consts/http-status.cjs"),u=require("./consts/revalidate.cjs"),e=require("./contexts/NavigationHistoryContext/index.cjs"),r=require("./contexts/PageDataContext/index.cjs"),l=require("./form/Form.cjs"),d=require("./form/FormButtonSubmit.cjs"),c=require("./form/utils/zodValidator.cjs"),y=require("./form/utils/nullableInput.cjs"),q=require("./hocs/withForm.cjs"),m=require("./hocs/withModalManager.cjs");require("@mantine/core");const g=require("./hooks/useFetchNextPageOnScroll.cjs"),p=require("./hooks/useOnScrollProgress.cjs");require("next/navigation");const f=require("./mantine/breakpointsWithPx.cjs"),P=require("./mantine/toTailwindColors.cjs"),S=require("./utils/formatBytes.cjs"),h=require("./utils/ky/addBodyJsonHook.cjs"),B=require("./utils/ky/parseJson.cjs"),t=require("./utils/array/groupBy.cjs"),v=require("./utils/array/shuffleArray.cjs"),N=require("./utils/newHref.cjs"),x=require("./utils/isInfinityEmpty.cjs");exports.EmptyState=o.EmptyState;exports.InfinityLoader=i.InfinityLoader;exports.SelectInfinity=n.SelectInfinity;exports.NavItems=a.NavItems;exports.HttpStatus=s.HttpStatus;exports.Revalidate=u.Revalidate;exports.NavigationHistoryProvider=e.NavigationHistoryProvider;exports.QP_BACK_URL_NAME=e.QP_BACK_URL_NAME;exports.useNavigationHistory=e.useNavigationHistory;exports.PageDataProvider=r.PageDataProvider;exports.usePageData=r.usePageData;exports.Form=l.Form;exports.FormButtonSubmit=d.FormButtonSubmit;exports.zodValidator=c.zodValidator;exports.nullableInput=y.nullableInput;exports.withForm=q.withForm;exports.withModalManager=m.withModalManager;exports.useFetchNextPageOnScroll=g.useFetchNextPageOnScroll;exports.useOnScrollProgress=p.useOnScrollProgress;exports.breakpointsWithPx=f.breakpointsWithPx;exports.toTailwindColors=P.toTailwindColors;exports.formatBytes=S.formatBytes;exports.addBodyJsonHook=h.addBodyJsonHook;exports.parseJSON=B.parseJSON;exports.groupBy=t.groupBy;exports.indexBy=t.indexBy;exports.shuffleArray=v.shuffleArray;exports.newHref=N.newHref;exports.isInfinityEmpty=x.isInfinityEmpty;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/dist/index.mjs ADDED
@@ -0,0 +1,61 @@
1
+ import { EmptyState as f } from "./components/EmptyState/index.mjs";
2
+ import { InfinityLoader as i } from "./components/InfinityLoader/index.mjs";
3
+ import { SelectInfinity as n } from "./components/SelectInfinity/index.mjs";
4
+ import { NavItems as l } from "./components/NavItems.mjs";
5
+ import "react/jsx-runtime";
6
+ import "clsx";
7
+ import { HttpStatus as y } from "./consts/http-status.mjs";
8
+ import { Revalidate as g } from "./consts/revalidate.mjs";
9
+ import { NavigationHistoryProvider as S, QP_BACK_URL_NAME as v, useNavigationHistory as B } from "./contexts/NavigationHistoryContext/index.mjs";
10
+ import { PageDataProvider as h, usePageData as H } from "./contexts/PageDataContext/index.mjs";
11
+ import { Form as c } from "./form/Form.mjs";
12
+ import { FormButtonSubmit as F } from "./form/FormButtonSubmit.mjs";
13
+ import { zodValidator as A } from "./form/utils/zodValidator.mjs";
14
+ import { nullableInput as M } from "./form/utils/nullableInput.mjs";
15
+ import { withForm as _ } from "./hocs/withForm.mjs";
16
+ import { withModalManager as C } from "./hocs/withModalManager.mjs";
17
+ import "@mantine/core";
18
+ import { useFetchNextPageOnScroll as J } from "./hooks/useFetchNextPageOnScroll.mjs";
19
+ import { useOnScrollProgress as R } from "./hooks/useOnScrollProgress.mjs";
20
+ import "next/navigation";
21
+ import { breakpointsWithPx as K } from "./mantine/breakpointsWithPx.mjs";
22
+ import { toTailwindColors as T } from "./mantine/toTailwindColors.mjs";
23
+ import { formatBytes as V } from "./utils/formatBytes.mjs";
24
+ import { addBodyJsonHook as j } from "./utils/ky/addBodyJsonHook.mjs";
25
+ import { parseJSON as G } from "./utils/ky/parseJson.mjs";
26
+ import { groupBy as Y, indexBy as Z } from "./utils/array/groupBy.mjs";
27
+ import { shuffleArray as oo } from "./utils/array/shuffleArray.mjs";
28
+ import { newHref as to } from "./utils/newHref.mjs";
29
+ import { isInfinityEmpty as mo } from "./utils/isInfinityEmpty.mjs";
30
+ export {
31
+ f as EmptyState,
32
+ c as Form,
33
+ F as FormButtonSubmit,
34
+ y as HttpStatus,
35
+ i as InfinityLoader,
36
+ l as NavItems,
37
+ S as NavigationHistoryProvider,
38
+ h as PageDataProvider,
39
+ v as QP_BACK_URL_NAME,
40
+ g as Revalidate,
41
+ n as SelectInfinity,
42
+ j as addBodyJsonHook,
43
+ K as breakpointsWithPx,
44
+ V as formatBytes,
45
+ Y as groupBy,
46
+ Z as indexBy,
47
+ mo as isInfinityEmpty,
48
+ to as newHref,
49
+ M as nullableInput,
50
+ G as parseJSON,
51
+ oo as shuffleArray,
52
+ T as toTailwindColors,
53
+ J as useFetchNextPageOnScroll,
54
+ B as useNavigationHistory,
55
+ R as useOnScrollProgress,
56
+ H as usePageData,
57
+ _ as withForm,
58
+ C as withModalManager,
59
+ A as zodValidator
60
+ };
61
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t={xs:"576px",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};exports.breakpointsWithPx=t;
2
+ //# sourceMappingURL=breakpointsWithPx.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breakpointsWithPx.cjs","sources":["../../src/mantine/breakpointsWithPx.ts"],"sourcesContent":["export const breakpointsWithPx = {\r\n xs: '576px',\r\n sm: '640px',\r\n md: '768px',\r\n lg: '1024px',\r\n xl: '1280px',\r\n ['2xl']: '1536px',\r\n};\r\n"],"names":["breakpointsWithPx"],"mappings":"gFAAO,MAAMA,EAAoB,CAC/B,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,SACJ,GAAI,SACH,MAAQ,QACX"}
@@ -0,0 +1,12 @@
1
+ const x = {
2
+ xs: "576px",
3
+ sm: "640px",
4
+ md: "768px",
5
+ lg: "1024px",
6
+ xl: "1280px",
7
+ "2xl": "1536px"
8
+ };
9
+ export {
10
+ x as breakpointsWithPx
11
+ };
12
+ //# sourceMappingURL=breakpointsWithPx.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breakpointsWithPx.mjs","sources":["../../src/mantine/breakpointsWithPx.ts"],"sourcesContent":["export const breakpointsWithPx = {\r\n xs: '576px',\r\n sm: '640px',\r\n md: '768px',\r\n lg: '1024px',\r\n xl: '1280px',\r\n ['2xl']: '1536px',\r\n};\r\n"],"names":["breakpointsWithPx"],"mappings":"AAAO,MAAMA,IAAoB;AAAA,EAC/B,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACH,OAAQ;AACX;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=t=>Object.entries(t).reduce((e,[o,i])=>(e[o]=i.reduce((r,n,l)=>(r[l]=n,r),{}),e),{});exports.toTailwindColors=u;
2
+ //# sourceMappingURL=toTailwindColors.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toTailwindColors.cjs","sources":["../../src/mantine/toTailwindColors.ts"],"sourcesContent":["import { MantineColorShade, DefaultMantineColor, MantineThemeColors } from '@mantine/core';\r\n\r\nexport const toTailwindColors = (colors: MantineThemeColors) =>\r\n Object.entries(colors).reduce(\r\n (acc, [key, value]) => {\r\n acc[key] = value.reduce(\r\n (acc, color, index) => {\r\n acc[index as MantineColorShade] = color;\r\n return acc;\r\n },\r\n {} as Record<MantineColorShade, string>,\r\n );\r\n\r\n return acc;\r\n },\r\n {} as Record<DefaultMantineColor, Record<MantineColorShade, string>>,\r\n );\r\n"],"names":["toTailwindColors","colors","acc","key","value","color","index"],"mappings":"gFAEO,MAAMA,EAAoBC,GAC/B,OAAO,QAAQA,CAAM,EAAE,OACrB,CAACC,EAAK,CAACC,EAAKC,CAAK,KACXF,EAAAC,CAAG,EAAIC,EAAM,OACf,CAACF,EAAKG,EAAOC,KACXJ,EAAII,CAA0B,EAAID,EAC3BH,GAET,CAAA,CACF,EAEOA,GAET,CAAA,CACF"}
@@ -0,0 +1,11 @@
1
+ const i = (t) => Object.entries(t).reduce(
2
+ (e, [n, o]) => (e[n] = o.reduce(
3
+ (r, u, d) => (r[d] = u, r),
4
+ {}
5
+ ), e),
6
+ {}
7
+ );
8
+ export {
9
+ i as toTailwindColors
10
+ };
11
+ //# sourceMappingURL=toTailwindColors.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toTailwindColors.mjs","sources":["../../src/mantine/toTailwindColors.ts"],"sourcesContent":["import { MantineColorShade, DefaultMantineColor, MantineThemeColors } from '@mantine/core';\r\n\r\nexport const toTailwindColors = (colors: MantineThemeColors) =>\r\n Object.entries(colors).reduce(\r\n (acc, [key, value]) => {\r\n acc[key] = value.reduce(\r\n (acc, color, index) => {\r\n acc[index as MantineColorShade] = color;\r\n return acc;\r\n },\r\n {} as Record<MantineColorShade, string>,\r\n );\r\n\r\n return acc;\r\n },\r\n {} as Record<DefaultMantineColor, Record<MantineColorShade, string>>,\r\n );\r\n"],"names":["toTailwindColors","colors","acc","key","value","color","index"],"mappings":"AAEO,MAAMA,IAAmB,CAACC,MAC/B,OAAO,QAAQA,CAAM,EAAE;AAAA,EACrB,CAACC,GAAK,CAACC,GAAKC,CAAK,OACXF,EAAAC,CAAG,IAAIC,EAAM;AAAA,IACf,CAACF,GAAKG,GAAOC,OACXJ,EAAII,CAA0B,IAAID,GAC3BH;AAAAA,IAET,CAAA;AAAA,EACF,GAEOA;AAAA,EAET,CAAA;AACF;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function i(o,t,u){return u?o.reduce((n,r)=>{const e=t(r);return e===void 0||(n[e]=u(r)),n},{}):o.reduce((n,r)=>{const e=t(r);return e===void 0||(n[e]=r),n},{})}const f=(o,t)=>{const u={};return o?.forEach(n=>{const r=t(n);if(r!==null){if(Array.isArray(r)){r.forEach(e=>{u[e]||(u[e]=[]),u[e]?.push(n)});return}u[r]||(u[r]=[]),u[r]?.push(n)}}),u};exports.groupBy=f;exports.indexBy=i;
2
+ //# sourceMappingURL=groupBy.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groupBy.cjs","sources":["../../../src/utils/array/groupBy.ts"],"sourcesContent":["// getKey debe retorner un string o un array de strings o NULL <- ahora retorna undefined, no coicinde con groupBy\r\nexport function indexBy<T, K, C extends string>(\r\n arr: T[],\r\n getKey: (item: T) => C | undefined\r\n): Record<C, T | undefined>;\r\nexport function indexBy<T, K, C extends string>(\r\n arr: T[],\r\n getKey: (item: T) => C | undefined,\r\n getValue: (item: T) => K\r\n): Record<C, K | undefined>;\r\nexport function indexBy<T, K>(\r\n arr: T[],\r\n getKey: (item: T) => string | undefined,\r\n getValue?: (item: T) => K\r\n) {\r\n if (getValue)\r\n return arr.reduce(\r\n (acc, item) => {\r\n const key = getKey(item);\r\n if (key === undefined) return acc;\r\n acc[key] = getValue(item);\r\n return acc;\r\n },\r\n {} as Record<string, K>\r\n );\r\n\r\n return arr.reduce(\r\n (acc, item) => {\r\n const key = getKey(item);\r\n if (key === undefined) return acc;\r\n acc[key] = item;\r\n return acc;\r\n },\r\n {} as Record<string, T>\r\n );\r\n}\r\n\r\n// falta agregar getValue como tercer parametro opcional\r\nexport const groupBy = <T extends any>(\r\n arr: T[],\r\n getKey: (item: T) => string | string[] | null\r\n) => {\r\n const groups: Record<string, T[] | undefined> = {};\r\n\r\n arr?.forEach((item) => {\r\n const key = getKey(item);\r\n\r\n if (key === null) return;\r\n\r\n if (Array.isArray(key)) {\r\n key.forEach((k) => {\r\n if (!groups[k]) groups[k] = [];\r\n\r\n groups[k]?.push(item);\r\n });\r\n\r\n return;\r\n }\r\n\r\n if (!groups[key]) groups[key] = [];\r\n\r\n groups[key]?.push(item);\r\n });\r\n\r\n return groups;\r\n};\r\n\r\nexport type IndexByResult<T> = Record<string, T | undefined>;\r\n\r\nexport type GroupByResult<T> = Record<string, T[] | undefined>;\r\n"],"names":["indexBy","arr","getKey","getValue","acc","item","key","groupBy","groups","k"],"mappings":"gFAUgB,SAAAA,EACdC,EACAC,EACAC,EACA,CACI,OAAAA,EACKF,EAAI,OACT,CAACG,EAAKC,IAAS,CACP,MAAAC,EAAMJ,EAAOG,CAAI,EACnB,OAAAC,IAAQ,SACRF,EAAAE,CAAG,EAAIH,EAASE,CAAI,GACjBD,CACT,EACA,CAAA,CACF,EAEKH,EAAI,OACT,CAACG,EAAKC,IAAS,CACP,MAAAC,EAAMJ,EAAOG,CAAI,EACnB,OAAAC,IAAQ,SACZF,EAAIE,CAAG,EAAID,GACJD,CACT,EACA,CAAA,CACF,CACF,CAGa,MAAAG,EAAU,CACrBN,EACAC,IACG,CACH,MAAMM,EAA0C,CAAC,EAE5C,OAAAP,GAAA,QAASI,GAAS,CACf,MAAAC,EAAMJ,EAAOG,CAAI,EAEvB,GAAIC,IAAQ,KAER,IAAA,MAAM,QAAQA,CAAG,EAAG,CAClBA,EAAA,QAASG,GAAM,CACZD,EAAOC,CAAC,IAAUD,EAAAC,CAAC,EAAI,CAAC,GAEtBD,EAAAC,CAAC,GAAG,KAAKJ,CAAI,CAAA,CACrB,EAED,MAAA,CAGGG,EAAOF,CAAG,IAAUE,EAAAF,CAAG,EAAI,CAAC,GAE1BE,EAAAF,CAAG,GAAG,KAAKD,CAAI,EAAA,CACvB,EAEMG,CACT"}
@@ -0,0 +1,35 @@
1
+ function t(e, f, u) {
2
+ return u ? e.reduce(
3
+ (n, r) => {
4
+ const o = f(r);
5
+ return o === void 0 || (n[o] = u(r)), n;
6
+ },
7
+ {}
8
+ ) : e.reduce(
9
+ (n, r) => {
10
+ const o = f(r);
11
+ return o === void 0 || (n[o] = r), n;
12
+ },
13
+ {}
14
+ );
15
+ }
16
+ const s = (e, f) => {
17
+ const u = {};
18
+ return e?.forEach((n) => {
19
+ const r = f(n);
20
+ if (r !== null) {
21
+ if (Array.isArray(r)) {
22
+ r.forEach((o) => {
23
+ u[o] || (u[o] = []), u[o]?.push(n);
24
+ });
25
+ return;
26
+ }
27
+ u[r] || (u[r] = []), u[r]?.push(n);
28
+ }
29
+ }), u;
30
+ };
31
+ export {
32
+ s as groupBy,
33
+ t as indexBy
34
+ };
35
+ //# sourceMappingURL=groupBy.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groupBy.mjs","sources":["../../../src/utils/array/groupBy.ts"],"sourcesContent":["// getKey debe retorner un string o un array de strings o NULL <- ahora retorna undefined, no coicinde con groupBy\r\nexport function indexBy<T, K, C extends string>(\r\n arr: T[],\r\n getKey: (item: T) => C | undefined\r\n): Record<C, T | undefined>;\r\nexport function indexBy<T, K, C extends string>(\r\n arr: T[],\r\n getKey: (item: T) => C | undefined,\r\n getValue: (item: T) => K\r\n): Record<C, K | undefined>;\r\nexport function indexBy<T, K>(\r\n arr: T[],\r\n getKey: (item: T) => string | undefined,\r\n getValue?: (item: T) => K\r\n) {\r\n if (getValue)\r\n return arr.reduce(\r\n (acc, item) => {\r\n const key = getKey(item);\r\n if (key === undefined) return acc;\r\n acc[key] = getValue(item);\r\n return acc;\r\n },\r\n {} as Record<string, K>\r\n );\r\n\r\n return arr.reduce(\r\n (acc, item) => {\r\n const key = getKey(item);\r\n if (key === undefined) return acc;\r\n acc[key] = item;\r\n return acc;\r\n },\r\n {} as Record<string, T>\r\n );\r\n}\r\n\r\n// falta agregar getValue como tercer parametro opcional\r\nexport const groupBy = <T extends any>(\r\n arr: T[],\r\n getKey: (item: T) => string | string[] | null\r\n) => {\r\n const groups: Record<string, T[] | undefined> = {};\r\n\r\n arr?.forEach((item) => {\r\n const key = getKey(item);\r\n\r\n if (key === null) return;\r\n\r\n if (Array.isArray(key)) {\r\n key.forEach((k) => {\r\n if (!groups[k]) groups[k] = [];\r\n\r\n groups[k]?.push(item);\r\n });\r\n\r\n return;\r\n }\r\n\r\n if (!groups[key]) groups[key] = [];\r\n\r\n groups[key]?.push(item);\r\n });\r\n\r\n return groups;\r\n};\r\n\r\nexport type IndexByResult<T> = Record<string, T | undefined>;\r\n\r\nexport type GroupByResult<T> = Record<string, T[] | undefined>;\r\n"],"names":["indexBy","arr","getKey","getValue","acc","item","key","groupBy","groups","k"],"mappings":"AAUgB,SAAAA,EACdC,GACAC,GACAC,GACA;AACI,SAAAA,IACKF,EAAI;AAAA,IACT,CAACG,GAAKC,MAAS;AACP,YAAAC,IAAMJ,EAAOG,CAAI;AACnB,aAAAC,MAAQ,WACRF,EAAAE,CAAG,IAAIH,EAASE,CAAI,IACjBD;AAAA,IACT;AAAA,IACA,CAAA;AAAA,EACF,IAEKH,EAAI;AAAA,IACT,CAACG,GAAKC,MAAS;AACP,YAAAC,IAAMJ,EAAOG,CAAI;AACnB,aAAAC,MAAQ,WACZF,EAAIE,CAAG,IAAID,IACJD;AAAA,IACT;AAAA,IACA,CAAA;AAAA,EACF;AACF;AAGa,MAAAG,IAAU,CACrBN,GACAC,MACG;AACH,QAAMM,IAA0C,CAAC;AAE5C,SAAAP,GAAA,QAAQ,CAACI,MAAS;AACf,UAAAC,IAAMJ,EAAOG,CAAI;AAEvB,QAAIC,MAAQ,MAER;AAAA,UAAA,MAAM,QAAQA,CAAG,GAAG;AAClB,QAAAA,EAAA,QAAQ,CAACG,MAAM;AACjB,UAAKD,EAAOC,CAAC,MAAUD,EAAAC,CAAC,IAAI,CAAC,IAEtBD,EAAAC,CAAC,GAAG,KAAKJ,CAAI;AAAA,QAAA,CACrB;AAED;AAAA,MAAA;AAGF,MAAKG,EAAOF,CAAG,MAAUE,EAAAF,CAAG,IAAI,CAAC,IAE1BE,EAAAF,CAAG,GAAG,KAAKD,CAAI;AAAA;AAAA,EAAA,CACvB,GAEMG;AACT;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=n=>{const e=[...n];let r=e.length,t;for(;r>0;)t=Math.floor(Math.random()*r),r--,[e[r],e[t]]=[e[t],e[r]];return e};exports.shuffleArray=l;
2
+ //# sourceMappingURL=shuffleArray.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shuffleArray.cjs","sources":["../../../src/utils/array/shuffleArray.ts"],"sourcesContent":["export const shuffleArray = <T>(array: T[]) => {\r\n const shuffledArray = [...array];\r\n let currentIndex = shuffledArray.length,\r\n randomIndex;\r\n\r\n // While there remain elements to shuffle.\r\n while (currentIndex > 0) {\r\n // Pick a remaining element.\r\n randomIndex = Math.floor(Math.random() * currentIndex);\r\n currentIndex--;\r\n\r\n // And swap it with the current element.\r\n [shuffledArray[currentIndex], shuffledArray[randomIndex]] = [\r\n shuffledArray[randomIndex],\r\n shuffledArray[currentIndex],\r\n ];\r\n }\r\n\r\n return shuffledArray;\r\n};\r\n"],"names":["shuffleArray","array","shuffledArray","currentIndex","randomIndex"],"mappings":"gFAAa,MAAAA,EAAmBC,GAAe,CACvC,MAAAC,EAAgB,CAAC,GAAGD,CAAK,EAC3B,IAAAE,EAAeD,EAAc,OAC/BE,EAGF,KAAOD,EAAe,GAEpBC,EAAc,KAAK,MAAM,KAAK,OAAA,EAAWD,CAAY,EACrDA,IAGA,CAACD,EAAcC,CAAY,EAAGD,EAAcE,CAAW,CAAC,EAAI,CAC1DF,EAAcE,CAAW,EACzBF,EAAcC,CAAY,CAC5B,EAGK,OAAAD,CACT"}
@@ -0,0 +1,14 @@
1
+ const o = (t) => {
2
+ const r = [...t];
3
+ let e = r.length, n;
4
+ for (; e > 0; )
5
+ n = Math.floor(Math.random() * e), e--, [r[e], r[n]] = [
6
+ r[n],
7
+ r[e]
8
+ ];
9
+ return r;
10
+ };
11
+ export {
12
+ o as shuffleArray
13
+ };
14
+ //# sourceMappingURL=shuffleArray.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shuffleArray.mjs","sources":["../../../src/utils/array/shuffleArray.ts"],"sourcesContent":["export const shuffleArray = <T>(array: T[]) => {\r\n const shuffledArray = [...array];\r\n let currentIndex = shuffledArray.length,\r\n randomIndex;\r\n\r\n // While there remain elements to shuffle.\r\n while (currentIndex > 0) {\r\n // Pick a remaining element.\r\n randomIndex = Math.floor(Math.random() * currentIndex);\r\n currentIndex--;\r\n\r\n // And swap it with the current element.\r\n [shuffledArray[currentIndex], shuffledArray[randomIndex]] = [\r\n shuffledArray[randomIndex],\r\n shuffledArray[currentIndex],\r\n ];\r\n }\r\n\r\n return shuffledArray;\r\n};\r\n"],"names":["shuffleArray","array","shuffledArray","currentIndex","randomIndex"],"mappings":"AAAa,MAAAA,IAAe,CAAIC,MAAe;AACvC,QAAAC,IAAgB,CAAC,GAAGD,CAAK;AAC3B,MAAAE,IAAeD,EAAc,QAC/BE;AAGF,SAAOD,IAAe;AAEpB,IAAAC,IAAc,KAAK,MAAM,KAAK,OAAA,IAAWD,CAAY,GACrDA,KAGA,CAACD,EAAcC,CAAY,GAAGD,EAAcE,CAAW,CAAC,IAAI;AAAA,MAC1DF,EAAcE,CAAW;AAAA,MACzBF,EAAcC,CAAY;AAAA,IAC5B;AAGK,SAAAD;AACT;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function a(t,o=2){if(!+t)return"0 Bytes";const e=1024,n=o<0?0:o,s=["Bytes","KB","MB"],r=Math.floor(Math.log(t)/Math.log(e));return`${parseFloat((t/Math.pow(e,r)).toFixed(n))} ${s[r]}`}exports.formatBytes=a;
2
+ //# sourceMappingURL=formatBytes.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatBytes.cjs","sources":["../../src/utils/formatBytes.ts"],"sourcesContent":["export function formatBytes(bytes: number, decimals = 2) {\r\n if (!+bytes) return '0 Bytes';\r\n\r\n const k = 1024;\r\n const dm = decimals < 0 ? 0 : decimals;\r\n const sizes = ['Bytes', 'KB', 'MB'];\r\n\r\n const i = Math.floor(Math.log(bytes) / Math.log(k));\r\n\r\n return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;\r\n}\r\n"],"names":["formatBytes","bytes","decimals","k","dm","sizes","i"],"mappings":"gFAAgB,SAAAA,EAAYC,EAAeC,EAAW,EAAG,CACnD,GAAA,CAAC,CAACD,EAAc,MAAA,UAEpB,MAAME,EAAI,KACJC,EAAKF,EAAW,EAAI,EAAIA,EACxBG,EAAQ,CAAC,QAAS,KAAM,IAAI,EAE5BC,EAAI,KAAK,MAAM,KAAK,IAAIL,CAAK,EAAI,KAAK,IAAIE,CAAC,CAAC,EAElD,MAAO,GAAG,YAAYF,EAAQ,KAAK,IAAIE,EAAGG,CAAC,GAAG,QAAQF,CAAE,CAAC,CAAC,IAAIC,EAAMC,CAAC,CAAC,EACxE"}
@@ -0,0 +1,9 @@
1
+ function e(t, o = 2) {
2
+ if (!+t) return "0 Bytes";
3
+ const n = 1024, s = o < 0 ? 0 : o, a = ["Bytes", "KB", "MB"], r = Math.floor(Math.log(t) / Math.log(n));
4
+ return `${parseFloat((t / Math.pow(n, r)).toFixed(s))} ${a[r]}`;
5
+ }
6
+ export {
7
+ e as formatBytes
8
+ };
9
+ //# sourceMappingURL=formatBytes.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatBytes.mjs","sources":["../../src/utils/formatBytes.ts"],"sourcesContent":["export function formatBytes(bytes: number, decimals = 2) {\r\n if (!+bytes) return '0 Bytes';\r\n\r\n const k = 1024;\r\n const dm = decimals < 0 ? 0 : decimals;\r\n const sizes = ['Bytes', 'KB', 'MB'];\r\n\r\n const i = Math.floor(Math.log(bytes) / Math.log(k));\r\n\r\n return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;\r\n}\r\n"],"names":["formatBytes","bytes","decimals","k","dm","sizes","i"],"mappings":"AAAgB,SAAAA,EAAYC,GAAeC,IAAW,GAAG;AACnD,MAAA,CAAC,CAACD,EAAc,QAAA;AAEpB,QAAME,IAAI,MACJC,IAAKF,IAAW,IAAI,IAAIA,GACxBG,IAAQ,CAAC,SAAS,MAAM,IAAI,GAE5BC,IAAI,KAAK,MAAM,KAAK,IAAIL,CAAK,IAAI,KAAK,IAAIE,CAAC,CAAC;AAElD,SAAO,GAAG,YAAYF,IAAQ,KAAK,IAAIE,GAAGG,CAAC,GAAG,QAAQF,CAAE,CAAC,CAAC,IAAIC,EAAMC,CAAC,CAAC;AACxE;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=t=>t?.pages[0].data.length===0;exports.isInfinityEmpty=e;
2
+ //# sourceMappingURL=isInfinityEmpty.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isInfinityEmpty.cjs","sources":["../../src/utils/isInfinityEmpty.ts"],"sourcesContent":["import { InfiniteData } from '@tanstack/react-query';\r\n\r\nexport const isInfinityEmpty = (data: InfiniteData<{ data: unknown[] }> | undefined) =>\r\n data?.pages[0].data.length === 0;\r\n"],"names":["isInfinityEmpty","data"],"mappings":"gFAEa,MAAAA,EAAmBC,GAC9BA,GAAM,MAAM,CAAC,EAAE,KAAK,SAAW"}
@@ -0,0 +1,5 @@
1
+ const n = (t) => t?.pages[0].data.length === 0;
2
+ export {
3
+ n as isInfinityEmpty
4
+ };
5
+ //# sourceMappingURL=isInfinityEmpty.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isInfinityEmpty.mjs","sources":["../../src/utils/isInfinityEmpty.ts"],"sourcesContent":["import { InfiniteData } from '@tanstack/react-query';\r\n\r\nexport const isInfinityEmpty = (data: InfiniteData<{ data: unknown[] }> | undefined) =>\r\n data?.pages[0].data.length === 0;\r\n"],"names":["isInfinityEmpty","data"],"mappings":"AAEa,MAAAA,IAAkB,CAACC,MAC9BA,GAAM,MAAM,CAAC,EAAE,KAAK,WAAW;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./parseJson.cjs"),e=async o=>(o.response.bodyJson=await s.parseJSON(o.response),o);exports.addBodyJsonHook=e;
2
+ //# sourceMappingURL=addBodyJsonHook.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addBodyJsonHook.cjs","sources":["../../../src/utils/ky/addBodyJsonHook.ts"],"sourcesContent":["import { BeforeErrorHook, HTTPError } from 'ky';\r\nimport { parseJSON } from './parseJson';\r\n\r\nexport type KyError<T = unknown> = HTTPError<T> & {\r\n response: {\r\n bodyJson?: T;\r\n };\r\n};\r\n\r\nexport const addBodyJsonHook: BeforeErrorHook = async (error: KyError<unknown>) => {\r\n error.response.bodyJson = await parseJSON(error.response);\r\n return error;\r\n};\r\n"],"names":["addBodyJsonHook","error","parseJSON"],"mappings":"mHASaA,EAAmC,MAAOC,IACrDA,EAAM,SAAS,SAAW,MAAMC,EAAAA,UAAUD,EAAM,QAAQ,EACjDA"}
@@ -0,0 +1,6 @@
1
+ import { parseJSON as s } from "./parseJson.mjs";
2
+ const a = async (o) => (o.response.bodyJson = await s(o.response), o);
3
+ export {
4
+ a as addBodyJsonHook
5
+ };
6
+ //# sourceMappingURL=addBodyJsonHook.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addBodyJsonHook.mjs","sources":["../../../src/utils/ky/addBodyJsonHook.ts"],"sourcesContent":["import { BeforeErrorHook, HTTPError } from 'ky';\r\nimport { parseJSON } from './parseJson';\r\n\r\nexport type KyError<T = unknown> = HTTPError<T> & {\r\n response: {\r\n bodyJson?: T;\r\n };\r\n};\r\n\r\nexport const addBodyJsonHook: BeforeErrorHook = async (error: KyError<unknown>) => {\r\n error.response.bodyJson = await parseJSON(error.response);\r\n return error;\r\n};\r\n"],"names":["addBodyJsonHook","error","parseJSON"],"mappings":";AASa,MAAAA,IAAmC,OAAOC,OACrDA,EAAM,SAAS,WAAW,MAAMC,EAAUD,EAAM,QAAQ,GACjDA;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=async r=>r.text().then(function(e){return e?JSON.parse(e):{}});exports.parseJSON=t;
2
+ //# sourceMappingURL=parseJson.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseJson.cjs","sources":["../../../src/utils/ky/parseJson.ts"],"sourcesContent":["import { KyResponse } from \"ky\";\r\n\r\n// si el servidor responde vacio (no un json), entonces devuelve un objeto vacio, sino devuelve el json parseado\r\nexport const parseJSON = async (response: KyResponse) => {\r\n return response.text().then(function (text) {\r\n return text ? JSON.parse(text) : {};\r\n });\r\n};\r\n"],"names":["parseJSON","response","text"],"mappings":"gFAGa,MAAAA,EAAY,MAAOC,GACvBA,EAAS,KAAA,EAAO,KAAK,SAAUC,EAAM,CAC1C,OAAOA,EAAO,KAAK,MAAMA,CAAI,EAAI,CAAC,CAAA,CACnC"}
@@ -0,0 +1,7 @@
1
+ const e = async (r) => r.text().then(function(n) {
2
+ return n ? JSON.parse(n) : {};
3
+ });
4
+ export {
5
+ e as parseJSON
6
+ };
7
+ //# sourceMappingURL=parseJson.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseJson.mjs","sources":["../../../src/utils/ky/parseJson.ts"],"sourcesContent":["import { KyResponse } from \"ky\";\r\n\r\n// si el servidor responde vacio (no un json), entonces devuelve un objeto vacio, sino devuelve el json parseado\r\nexport const parseJSON = async (response: KyResponse) => {\r\n return response.text().then(function (text) {\r\n return text ? JSON.parse(text) : {};\r\n });\r\n};\r\n"],"names":["parseJSON","response","text"],"mappings":"AAGa,MAAAA,IAAY,OAAOC,MACvBA,EAAS,KAAA,EAAO,KAAK,SAAUC,GAAM;AAC1C,SAAOA,IAAO,KAAK,MAAMA,CAAI,IAAI,CAAC;AAAA,CACnC;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("query-string"),u=e=>e&&e.__esModule?e:{default:e},a=u(n),i=e=>r=>{const t=typeof e=="string"?e:e(r??{params:{},searchParams:{}});if(r?.searchParams){const s=a.default.stringify(r.searchParams,{skipEmptyString:!0,skipNull:!0});return`${t}${s?`?${s}`:""}`}return t};exports.newHref=i;
2
+ //# sourceMappingURL=newHref.cjs.map