lkd-web-kit 0.3.3 → 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
@@ -0,0 +1,21 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import "clsx";
3
+ import "@mantine/core";
4
+ import "next/link";
5
+ import "next/navigation";
6
+ import "@mantine/dates";
7
+ import "@mantine/notifications";
8
+ /* empty css */
9
+ import { MyNumberInput as t } from "../../components/MyNumberInput/index.js";
10
+ import "react";
11
+ import { withForm as p } from "../../hocs/withForm.js";
12
+ const c = p(({ field: r, props: m }) => /* @__PURE__ */ o(
13
+ t,
14
+ {
15
+ ...r,
16
+ ...m
17
+ }
18
+ ));
19
+ export {
20
+ c as FormNumberInput
21
+ };
@@ -0,0 +1,14 @@
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { Radio as i } from "@mantine/core";
3
+ import { withForm as p } from "../../hocs/withForm.js";
4
+ import "react";
5
+ const s = p(({ field: o, props: r }) => /* @__PURE__ */ m(
6
+ i.Group,
7
+ {
8
+ ...o,
9
+ ...r
10
+ }
11
+ ));
12
+ export {
13
+ s as FormRadioGroup
14
+ };
@@ -0,0 +1,21 @@
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import "clsx";
3
+ import "@mantine/core";
4
+ import "next/link";
5
+ import "next/navigation";
6
+ import "@mantine/dates";
7
+ import "@mantine/notifications";
8
+ /* empty css */
9
+ import { MySelect as t } from "../../components/MySelect/index.js";
10
+ import "react";
11
+ import { withForm as i } from "../../hocs/withForm.js";
12
+ const n = i(({ field: o, props: r }) => /* @__PURE__ */ m(
13
+ t,
14
+ {
15
+ ...o,
16
+ ...r
17
+ }
18
+ ));
19
+ export {
20
+ n as FormSelect
21
+ };
@@ -0,0 +1,21 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import "clsx";
3
+ import "@mantine/core";
4
+ import "next/link";
5
+ import "next/navigation";
6
+ import "@mantine/dates";
7
+ import "@mantine/notifications";
8
+ /* empty css */
9
+ import { SelectInfinity as i } from "../../components/SelectInfinity/index.js";
10
+ import { withForm as m } from "../../hocs/withForm.js";
11
+ import "react";
12
+ const S = m(({ field: o, props: t }) => /* @__PURE__ */ r(
13
+ i,
14
+ {
15
+ ...o,
16
+ ...t
17
+ }
18
+ ));
19
+ export {
20
+ S as FormSelectInfinity
21
+ };
@@ -0,0 +1,21 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import "clsx";
3
+ import "@mantine/core";
4
+ import "next/link";
5
+ import "next/navigation";
6
+ import "@mantine/dates";
7
+ import "@mantine/notifications";
8
+ /* empty css */
9
+ import { MyTextInput as m } from "../../components/MyTextInput/index.js";
10
+ import "react";
11
+ import { withForm as p } from "../../hocs/withForm.js";
12
+ const h = p(({ field: o, props: t }) => /* @__PURE__ */ r(
13
+ m,
14
+ {
15
+ ...o,
16
+ ...t
17
+ }
18
+ ));
19
+ export {
20
+ h as FormTextInput
21
+ };
@@ -0,0 +1,21 @@
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import "clsx";
3
+ import "@mantine/core";
4
+ import "next/link";
5
+ import "next/navigation";
6
+ import "@mantine/dates";
7
+ import "@mantine/notifications";
8
+ /* empty css */
9
+ import { MyTextarea as t } from "../../components/MyTextarea/index.js";
10
+ import "react";
11
+ import { withForm as i } from "../../hocs/withForm.js";
12
+ const n = i(({ field: r, props: o }) => /* @__PURE__ */ m(
13
+ t,
14
+ {
15
+ ...r,
16
+ ...o
17
+ }
18
+ ));
19
+ export {
20
+ n as FormTextarea
21
+ };
@@ -0,0 +1,29 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import "clsx";
3
+ import "@mantine/core";
4
+ import "next/link";
5
+ import "next/navigation";
6
+ import "@mantine/dates";
7
+ import "@mantine/notifications";
8
+ /* empty css */
9
+ import { MyTimeInput as p } from "../../components/MyTimeInput/index.js";
10
+ import "react";
11
+ import { withForm as n } from "../../hocs/withForm.js";
12
+ const b = n(({ field: t, props: o }) => /* @__PURE__ */ i(
13
+ p,
14
+ {
15
+ ...t,
16
+ ...o
17
+ }
18
+ )), l = (t) => {
19
+ const [o, r] = t.split(":").map(Number), m = o + r / 60;
20
+ return Number(m.toFixed(2));
21
+ }, x = (t) => {
22
+ const o = Math.floor(t), r = Math.round((t - o) * 60);
23
+ return `${o.toString().padStart(2, "0")}:${r.toString().padStart(2, "0")}`;
24
+ };
25
+ export {
26
+ b as FormTimeInput,
27
+ x as numberToTimeInput,
28
+ l as timeInputToNumber
29
+ };
@@ -0,0 +1,10 @@
1
+ import { z as d } from "zod";
2
+ const s = (e, o = "Campo requerido") => e.nullable().superRefine((u, l) => {
3
+ u === null && l.addIssue({
4
+ code: d.ZodIssueCode.custom,
5
+ message: o
6
+ });
7
+ });
8
+ export {
9
+ s as nullableButRequired
10
+ };
@@ -0,0 +1,10 @@
1
+ import { z as r } from "zod";
2
+ const t = (o, e = "Campo requerido") => o.optional().superRefine((d, i) => {
3
+ d === void 0 && i.addIssue({
4
+ code: r.ZodIssueCode.custom,
5
+ message: e
6
+ });
7
+ });
8
+ export {
9
+ t as optionalButRequired
10
+ };
@@ -0,0 +1,9 @@
1
+ const o = (r) => (t) => {
2
+ const e = r.safeParse(t);
3
+ if (e.success) return;
4
+ const { error: n } = e, s = n.issues[0];
5
+ return s == null ? void 0 : s.message;
6
+ };
7
+ export {
8
+ o as zodValidator
9
+ };
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import { jsx as r } from "react/jsx-runtime";
3
+ import { Controller as n } from "react-hook-form";
4
+ import "@mantine/core";
5
+ import { zodValidator as v } from "../form/utils/zodValidator.js";
6
+ import "zod";
7
+ import "../form/base/FormCheckbox.js";
8
+ import "../form/base/FormDatePickerInput.js";
9
+ import "../form/base/FormDateTimePicker.js";
10
+ import "../form/base/FormNumberInput.js";
11
+ import "../form/base/FormRadioGroup.js";
12
+ import "../form/base/FormSelect.js";
13
+ import "../form/base/FormSelectInfinity.js";
14
+ import "../form/base/FormTextarea.js";
15
+ import "../form/base/FormTextInput.js";
16
+ import "../form/base/FormTimeInput.js";
17
+ import "../form/base/FormMultiSelect.js";
18
+ import "../form/base/FormMonthPickerInput.js";
19
+ const D = (d, t) => {
20
+ const o = (i) => {
21
+ const { validate: e, name: l = "", placeholder: s, label: p, description: c, ...f } = i;
22
+ return /* @__PURE__ */ r(
23
+ n,
24
+ {
25
+ name: l,
26
+ defaultValue: "",
27
+ rules: {
28
+ validate: e && !i.disabled ? v(e) : void 0
29
+ },
30
+ disabled: i.disabled,
31
+ ...t == null ? void 0 : t(i),
32
+ render: (m) => {
33
+ const {
34
+ fieldState: { error: a }
35
+ } = m, u = {
36
+ ...m,
37
+ props: {
38
+ ...i,
39
+ validate: void 0
40
+ },
41
+ field: {
42
+ ...m.field,
43
+ label: p,
44
+ placeholder: s,
45
+ description: c,
46
+ error: a == null ? void 0 : a.message
47
+ },
48
+ ...f
49
+ };
50
+ return /* @__PURE__ */ r(d, { ...u });
51
+ }
52
+ }
53
+ );
54
+ };
55
+ return o.displayName = `WithForm(${d.displayName})`, o;
56
+ };
57
+ export {
58
+ D as withForm
59
+ };
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { jsx as u } from "react/jsx-runtime";
3
+ import { useState as f, useEffect as c } from "react";
4
+ const d = (t) => {
5
+ const s = ({
6
+ removeModal: l,
7
+ opened: n,
8
+ ...e
9
+ }) => {
10
+ const [m, a] = f(!1), o = () => {
11
+ var i;
12
+ a(!1), setTimeout(() => l(), 200), (i = e.onClose) == null || i.call(e);
13
+ };
14
+ return c(() => {
15
+ n ? setTimeout(() => a(!0), 0) : o();
16
+ }, [n]), /* @__PURE__ */ u(
17
+ t,
18
+ {
19
+ ...e,
20
+ opened: m,
21
+ onClose: o
22
+ }
23
+ );
24
+ };
25
+ return s.displayName = `WithModalManager(${t.displayName})`, s;
26
+ };
27
+ export {
28
+ d as withModalManager
29
+ };
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import { useMatches as t } from "@mantine/core";
3
+ const u = (e) => !!t({
4
+ [e]: !0
5
+ });
6
+ export {
7
+ u as useBreakpoint
8
+ };
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { useOnScrollProgress as c } from "./useOnScrollProgress.js";
3
+ const l = ({
4
+ infinity: e,
5
+ scrollRef: r,
6
+ disabled: t = !1
7
+ }) => {
8
+ c({
9
+ triggerPercentage: 0.9,
10
+ callback: () => {
11
+ e.hasNextPage && e.fetchNextPage();
12
+ },
13
+ scrollRef: r,
14
+ disabled: t
15
+ });
16
+ };
17
+ export {
18
+ l as useFetchNextPageOnScroll
19
+ };
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import { useEffect as l } from "react";
3
+ const E = ({
4
+ triggerPercentage: n,
5
+ callback: r,
6
+ scrollRef: t,
7
+ disabled: s = !1
8
+ }) => {
9
+ if (n < 0 || n > 1)
10
+ throw new Error("El porcentaje debe estar entre 0 y 1");
11
+ l(() => {
12
+ if (s || t && t.current === null) return;
13
+ let u = !1;
14
+ const e = () => {
15
+ const i = t == null ? void 0 : t.current, o = i ?? document.documentElement, d = o.scrollHeight - o.clientHeight, h = i ? o.scrollTop : window.scrollY, m = d > 0 ? Math.min(1, h / d) : 0;
16
+ !u && m >= n && (r(), u = !0);
17
+ }, c = (t == null ? void 0 : t.current) ?? window;
18
+ return c.addEventListener("scroll", e), e(), () => {
19
+ c.removeEventListener("scroll", e);
20
+ };
21
+ }, [n, r, t, s]);
22
+ };
23
+ export {
24
+ E as useOnScrollProgress
25
+ };
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { useSearchParams as c } from "next/navigation";
3
+ const i = () => {
4
+ const a = c();
5
+ return { updateSearchParams: (n) => {
6
+ var t;
7
+ const r = new URLSearchParams(a.toString());
8
+ Object.entries(n).forEach(([e, s]) => {
9
+ if (s === null) {
10
+ r.delete(e);
11
+ return;
12
+ }
13
+ r.set(e, String(s));
14
+ }), (t = window == null ? void 0 : window.history) == null || t.pushState(null, "", `?${r.toString()}`);
15
+ }, searchParams: a };
16
+ };
17
+ export {
18
+ i as useUpdateSearchParams
19
+ };
@@ -0,0 +1,113 @@
1
+ import { EmptyState as e } from "./components/EmptyState/index.js";
2
+ import { InfinityLoader as m } from "./components/InfinityLoader/index.js";
3
+ import { NavItems as f } from "./components/NavItems.js";
4
+ import { Icon as i } from "./components/Icon.js";
5
+ import { MyDatePickerInput as n } from "./components/MyDatePickerInput/index.js";
6
+ import { MyDateTimePicker as y } from "./components/MyDateTimePicker/index.js";
7
+ import { MyNotifications as s } from "./components/MyNotifications/index.js";
8
+ import { MyNumberInput as I } from "./components/MyNumberInput/index.js";
9
+ import { MySelect as d } from "./components/MySelect/index.js";
10
+ import { MyTextarea as P } from "./components/MyTextarea/index.js";
11
+ import { MyTextInput as T } from "./components/MyTextInput/index.js";
12
+ import { MyTimeInput as k } from "./components/MyTimeInput/index.js";
13
+ import { SelectInfinity as B } from "./components/SelectInfinity/index.js";
14
+ import { MyMultiSelect as g } from "./components/MyMultiSelect/index.js";
15
+ import { MyMonthPickerInput as v } from "./components/MyMonthPickerInput/index.js";
16
+ import { HttpStatus as R } from "./consts/http-status.js";
17
+ import { Revalidate as E } from "./consts/revalidate.js";
18
+ import { NavigationHistoryProvider as C, QP_BACK_URL_NAME as O, useNavigationHistory as _ } from "./contexts/NavigationHistoryContext/index.js";
19
+ import { PageDataProvider as J, usePageData as K } from "./contexts/PageDataContext/index.js";
20
+ import { Form as U } from "./form/Form.js";
21
+ import { FormButtonSubmit as G } from "./form/FormButtonSubmit.js";
22
+ import { zodValidator as V } from "./form/utils/zodValidator.js";
23
+ import { nullableButRequired as j } from "./form/utils/nullable-but-required.js";
24
+ import { optionalButRequired as Y } from "./form/utils/optional-but-required.js";
25
+ import { FormCheckbox as $ } from "./form/base/FormCheckbox.js";
26
+ import { FormDatePickerInput as or } from "./form/base/FormDatePickerInput.js";
27
+ import { FormDateTimePicker as tr } from "./form/base/FormDateTimePicker.js";
28
+ import { FormNumberInput as pr } from "./form/base/FormNumberInput.js";
29
+ import { FormRadioGroup as xr } from "./form/base/FormRadioGroup.js";
30
+ import { FormSelect as ar } from "./form/base/FormSelect.js";
31
+ import { FormSelectInfinity as ur } from "./form/base/FormSelectInfinity.js";
32
+ import { FormTextarea as lr } from "./form/base/FormTextarea.js";
33
+ import { FormTextInput as cr } from "./form/base/FormTextInput.js";
34
+ import { FormTimeInput as Mr, numberToTimeInput as dr, timeInputToNumber as Fr } from "./form/base/FormTimeInput.js";
35
+ import { FormMultiSelect as Sr } from "./form/base/FormMultiSelect.js";
36
+ import { FormMonthPickerInput as hr } from "./form/base/FormMonthPickerInput.js";
37
+ import { withForm as Nr } from "./hocs/withForm.js";
38
+ import { withModalManager as br } from "./hocs/withModalManager.js";
39
+ import { useBreakpoint as Dr } from "./hooks/useBreakpoint.js";
40
+ import { useFetchNextPageOnScroll as Hr } from "./hooks/useFetchNextPageOnScroll.js";
41
+ import { useOnScrollProgress as wr } from "./hooks/useOnScrollProgress.js";
42
+ import { useUpdateSearchParams as Ar } from "./hooks/useUpdateSearchParams.js";
43
+ import { breakpointsWithPx as Or } from "./mantine/breakpoints-with-px.js";
44
+ import { toTailwindColors as qr } from "./mantine/to-tailwind-colors.js";
45
+ import { myDefaultTheme as Kr } from "./mantine/my-default-theme.js";
46
+ import { formatBytes as Ur } from "./utils/formatBytes.js";
47
+ import { KyError as Gr, addBodyJsonHook as Qr } from "./utils/ky/addBodyJsonHook.js";
48
+ import { parseJSON as Wr } from "./utils/ky/parseJson.js";
49
+ import { groupBy as Xr, indexBy as Yr } from "./utils/array/groupBy.js";
50
+ import { shuffleArray as $r } from "./utils/array/shuffleArray.js";
51
+ import { newHref as oo } from "./utils/newHref.js";
52
+ import { isInfinityEmpty as to } from "./utils/isInfinityEmpty.js";
53
+ export {
54
+ e as EmptyState,
55
+ U as Form,
56
+ G as FormButtonSubmit,
57
+ $ as FormCheckbox,
58
+ or as FormDatePickerInput,
59
+ tr as FormDateTimePicker,
60
+ hr as FormMonthPickerInput,
61
+ Sr as FormMultiSelect,
62
+ pr as FormNumberInput,
63
+ xr as FormRadioGroup,
64
+ ar as FormSelect,
65
+ ur as FormSelectInfinity,
66
+ cr as FormTextInput,
67
+ lr as FormTextarea,
68
+ Mr as FormTimeInput,
69
+ R as HttpStatus,
70
+ i as Icon,
71
+ m as InfinityLoader,
72
+ Gr as KyError,
73
+ n as MyDatePickerInput,
74
+ y as MyDateTimePicker,
75
+ v as MyMonthPickerInput,
76
+ g as MyMultiSelect,
77
+ s as MyNotifications,
78
+ I as MyNumberInput,
79
+ d as MySelect,
80
+ T as MyTextInput,
81
+ P as MyTextarea,
82
+ k as MyTimeInput,
83
+ f as NavItems,
84
+ C as NavigationHistoryProvider,
85
+ J as PageDataProvider,
86
+ O as QP_BACK_URL_NAME,
87
+ E as Revalidate,
88
+ B as SelectInfinity,
89
+ Qr as addBodyJsonHook,
90
+ Or as breakpointsWithPx,
91
+ Ur as formatBytes,
92
+ Xr as groupBy,
93
+ Yr as indexBy,
94
+ to as isInfinityEmpty,
95
+ Kr as myDefaultTheme,
96
+ oo as newHref,
97
+ j as nullableButRequired,
98
+ dr as numberToTimeInput,
99
+ Y as optionalButRequired,
100
+ Wr as parseJSON,
101
+ $r as shuffleArray,
102
+ Fr as timeInputToNumber,
103
+ qr as toTailwindColors,
104
+ Dr as useBreakpoint,
105
+ Hr as useFetchNextPageOnScroll,
106
+ _ as useNavigationHistory,
107
+ wr as useOnScrollProgress,
108
+ K as usePageData,
109
+ Ar as useUpdateSearchParams,
110
+ Nr as withForm,
111
+ br as withModalManager,
112
+ V as zodValidator
113
+ };
@@ -0,0 +1,11 @@
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
+ };
@@ -0,0 +1,39 @@
1
+ import { Tooltip as e, Menu as t, Select as o, AppShell as l, Notification as i } from "@mantine/core";
2
+ import { breakpointsWithPx as p } from "./breakpoints-with-px.js";
3
+ const a = {
4
+ breakpoints: p,
5
+ cursorType: "pointer",
6
+ components: {
7
+ Notification: i.extend({
8
+ defaultProps: {
9
+ withBorder: !0
10
+ }
11
+ }),
12
+ AppShell: l.extend({
13
+ defaultProps: {
14
+ padding: 0
15
+ }
16
+ }),
17
+ Select: o.extend({
18
+ defaultProps: {
19
+ allowDeselect: !1,
20
+ withCheckIcon: !1,
21
+ clearable: !0
22
+ }
23
+ }),
24
+ Menu: t.extend({
25
+ defaultProps: {
26
+ position: "bottom-end"
27
+ }
28
+ }),
29
+ Tooltip: e.extend({
30
+ defaultProps: {
31
+ multiline: !0,
32
+ w: 300
33
+ }
34
+ })
35
+ }
36
+ };
37
+ export {
38
+ a as myDefaultTheme
39
+ };
@@ -0,0 +1,10 @@
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
+ };
@@ -0,0 +1,36 @@
1
+ function i(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 y = (e, f) => {
17
+ const u = {};
18
+ return e == null || e.forEach((n) => {
19
+ var o;
20
+ const r = f(n);
21
+ if (r !== null) {
22
+ if (Array.isArray(r)) {
23
+ r.forEach((t) => {
24
+ var s;
25
+ u[t] || (u[t] = []), (s = u[t]) == null || s.push(n);
26
+ });
27
+ return;
28
+ }
29
+ u[r] || (u[r] = []), (o = u[r]) == null || o.push(n);
30
+ }
31
+ }), u;
32
+ };
33
+ export {
34
+ y as groupBy,
35
+ i as indexBy
36
+ };
@@ -0,0 +1,13 @@
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
+ };
@@ -0,0 +1,8 @@
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
+ };
@@ -0,0 +1,4 @@
1
+ const e = (n) => (n == null ? void 0 : n.pages[0].data.length) === 0;
2
+ export {
3
+ e as isInfinityEmpty
4
+ };
@@ -0,0 +1,12 @@
1
+ import { HTTPError as t } from "ky";
2
+ import { parseJSON as p } from "./parseJson.js";
3
+ class c extends t {
4
+ constructor(s, r, n, e) {
5
+ super(s, r, n), this.response.bodyJson = e;
6
+ }
7
+ }
8
+ const y = async (o) => (o.response.bodyJson = await p(o.response), o);
9
+ export {
10
+ c as KyError,
11
+ y as addBodyJsonHook
12
+ };
@@ -0,0 +1,6 @@
1
+ const e = async (r) => r.text().then(function(n) {
2
+ return n ? JSON.parse(n) : {};
3
+ });
4
+ export {
5
+ e as parseJSON
6
+ };
@@ -0,0 +1,20 @@
1
+ import s from "query-string";
2
+ const m = (t) => (r) => {
3
+ const e = typeof t == "string" ? t : t(
4
+ r ?? {
5
+ params: {},
6
+ searchParams: {}
7
+ }
8
+ );
9
+ if (r != null && r.searchParams) {
10
+ const i = s.stringify(r.searchParams, {
11
+ skipEmptyString: !0,
12
+ skipNull: !0
13
+ });
14
+ return `${e}${i ? `?${i}` : ""}`;
15
+ }
16
+ return e;
17
+ };
18
+ export {
19
+ m as newHref
20
+ };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "lkd-web-kit",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "A template for creating React component libraries with Vite.",
5
5
  "author": "LKD",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "files": ["dist"],
9
- "exports": "./dist/main.js",
10
- "module": "./dist/main.js",
9
+ "exports": "./dist/src/main.js",
10
+ "module": "./dist/src/main.js",
11
11
  "types": "./dist/main.d.ts",
12
12
  "scripts": {
13
13
  "test": "vitest run",