lkd-web-kit 0.0.18 → 0.0.19

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.
@@ -0,0 +1,2 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@mantine/core"),r=e=>!!t.useMatches({[e]:!0});exports.useBreakpoint=r;
2
+ //# sourceMappingURL=useBreakpoint.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBreakpoint.cjs","sources":["../../src/hooks/useBreakpoint.ts"],"sourcesContent":["'use client';\r\nimport { useMatches } from '@mantine/core';\r\nimport { breakpointsWithPx } from '../mantine/breakpointsWithPx';\r\n\r\nexport const useBreakpoint = (breakpoint: keyof typeof breakpointsWithPx): boolean => {\r\n const result = useMatches({\r\n [breakpoint]: true,\r\n });\r\n\r\n return !!result;\r\n};\r\n"],"names":["useBreakpoint","breakpoint","useMatches"],"mappings":"8HAIaA,EAAiBC,GAKrB,CAAC,CAJOC,EAAAA,WAAW,CACxB,CAACD,CAAU,EAAG,EAAA,CACf"}
@@ -0,0 +1,9 @@
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
+ };
9
+ //# sourceMappingURL=useBreakpoint.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBreakpoint.mjs","sources":["../../src/hooks/useBreakpoint.ts"],"sourcesContent":["'use client';\r\nimport { useMatches } from '@mantine/core';\r\nimport { breakpointsWithPx } from '../mantine/breakpointsWithPx';\r\n\r\nexport const useBreakpoint = (breakpoint: keyof typeof breakpointsWithPx): boolean => {\r\n const result = useMatches({\r\n [breakpoint]: true,\r\n });\r\n\r\n return !!result;\r\n};\r\n"],"names":["useBreakpoint","breakpoint","useMatches"],"mappings":";;AAIa,MAAAA,IAAgB,CAACC,MAKrB,CAAC,CAJOC,EAAW;AAAA,EACxB,CAACD,CAAU,GAAG;AAAA,CACf;"}
@@ -0,0 +1,2 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("next/navigation"),c=()=>{const a=n.useSearchParams();return{updateSearchParams:s=>{const e=new URLSearchParams(a.toString());Object.entries(s).forEach(([r,t])=>{if(t===null){e.delete(r);return}e.set(r,String(t))}),window?.history?.pushState(null,"",`?${e.toString()}`)},searchParams:a}};exports.useUpdateSearchParams=c;
2
+ //# sourceMappingURL=useUpdateSearchParams.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUpdateSearchParams.cjs","sources":["../../src/hooks/useUpdateSearchParams.ts"],"sourcesContent":["'use client';\r\nimport { useSearchParams } from 'next/navigation';\r\n\r\nexport const useUpdateSearchParams = () => {\r\n const searchParams = useSearchParams();\r\n\r\n const updateSearchParams = (newSearchparams: Record<string, string | number | null>) => {\r\n const params = new URLSearchParams(searchParams.toString());\r\n\r\n Object.entries(newSearchparams).forEach(([key, value]) => {\r\n if (value === null) {\r\n params.delete(key);\r\n return;\r\n }\r\n params.set(key, String(value));\r\n });\r\n\r\n window?.history?.pushState(null, '', `?${params.toString()}`);\r\n };\r\n\r\n return { updateSearchParams, searchParams };\r\n};\r\n"],"names":["useUpdateSearchParams","searchParams","useSearchParams","newSearchparams","params","key","value"],"mappings":"gIAGaA,EAAwB,IAAM,CACzC,MAAMC,EAAeC,EAAAA,gBAAgB,EAgB9B,MAAA,CAAE,mBAdmBC,GAA4D,CACtF,MAAMC,EAAS,IAAI,gBAAgBH,EAAa,UAAU,EAEnD,OAAA,QAAQE,CAAe,EAAE,QAAQ,CAAC,CAACE,EAAKC,CAAK,IAAM,CACxD,GAAIA,IAAU,KAAM,CAClBF,EAAO,OAAOC,CAAG,EACjB,MAAA,CAEFD,EAAO,IAAIC,EAAK,OAAOC,CAAK,CAAC,CAAA,CAC9B,EAEO,QAAA,SAAS,UAAU,KAAM,GAAI,IAAIF,EAAO,SAAU,CAAA,EAAE,CAC9D,EAE6B,aAAAH,CAAa,CAC5C"}
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { useSearchParams as n } from "next/navigation";
3
+ const h = () => {
4
+ const a = n();
5
+ return { updateSearchParams: (s) => {
6
+ const r = new URLSearchParams(a.toString());
7
+ Object.entries(s).forEach(([t, e]) => {
8
+ if (e === null) {
9
+ r.delete(t);
10
+ return;
11
+ }
12
+ r.set(t, String(e));
13
+ }), window?.history?.pushState(null, "", `?${r.toString()}`);
14
+ }, searchParams: a };
15
+ };
16
+ export {
17
+ h as useUpdateSearchParams
18
+ };
19
+ //# sourceMappingURL=useUpdateSearchParams.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUpdateSearchParams.mjs","sources":["../../src/hooks/useUpdateSearchParams.ts"],"sourcesContent":["'use client';\r\nimport { useSearchParams } from 'next/navigation';\r\n\r\nexport const useUpdateSearchParams = () => {\r\n const searchParams = useSearchParams();\r\n\r\n const updateSearchParams = (newSearchparams: Record<string, string | number | null>) => {\r\n const params = new URLSearchParams(searchParams.toString());\r\n\r\n Object.entries(newSearchparams).forEach(([key, value]) => {\r\n if (value === null) {\r\n params.delete(key);\r\n return;\r\n }\r\n params.set(key, String(value));\r\n });\r\n\r\n window?.history?.pushState(null, '', `?${params.toString()}`);\r\n };\r\n\r\n return { updateSearchParams, searchParams };\r\n};\r\n"],"names":["useUpdateSearchParams","searchParams","useSearchParams","newSearchparams","params","key","value"],"mappings":";;AAGO,MAAMA,IAAwB,MAAM;AACzC,QAAMC,IAAeC,EAAgB;AAgB9B,SAAA,EAAE,oBAdkB,CAACC,MAA4D;AACtF,UAAMC,IAAS,IAAI,gBAAgBH,EAAa,UAAU;AAEnD,WAAA,QAAQE,CAAe,EAAE,QAAQ,CAAC,CAACE,GAAKC,CAAK,MAAM;AACxD,UAAIA,MAAU,MAAM;AAClB,QAAAF,EAAO,OAAOC,CAAG;AACjB;AAAA,MAAA;AAEF,MAAAD,EAAO,IAAIC,GAAK,OAAOC,CAAK,CAAC;AAAA,IAAA,CAC9B,GAEO,QAAA,SAAS,UAAU,MAAM,IAAI,IAAIF,EAAO,SAAU,CAAA,EAAE;AAAA,EAC9D,GAE6B,cAAAH,EAAa;AAC5C;"}
package/dist/index.cjs CHANGED
@@ -1,2 +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"),s=require("./components/Icon.cjs"),u=require("./consts/http-status.cjs"),l=require("./consts/revalidate.cjs"),e=require("./contexts/NavigationHistoryContext/index.cjs"),r=require("./contexts/PageDataContext/index.cjs"),c=require("./form/Form.cjs"),d=require("./form/FormButtonSubmit.cjs"),y=require("./form/utils/zodValidator.cjs"),q=require("./form/utils/nullableInput.cjs"),m=require("./hocs/withForm.cjs"),g=require("./hocs/withModalManager.cjs");require("@mantine/core");const p=require("./hooks/useFetchNextPageOnScroll.cjs"),f=require("./hooks/useOnScrollProgress.cjs");require("next/navigation");const P=require("./mantine/breakpointsWithPx.cjs"),S=require("./mantine/toTailwindColors.cjs"),h=require("./utils/formatBytes.cjs"),B=require("./utils/ky/addBodyJsonHook.cjs"),I=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.Icon=s.Icon;exports.HttpStatus=u.HttpStatus;exports.Revalidate=l.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=c.Form;exports.FormButtonSubmit=d.FormButtonSubmit;exports.zodValidator=y.zodValidator;exports.nullableInput=q.nullableInput;exports.withForm=m.withForm;exports.withModalManager=g.withModalManager;exports.useFetchNextPageOnScroll=p.useFetchNextPageOnScroll;exports.useOnScrollProgress=f.useOnScrollProgress;exports.breakpointsWithPx=P.breakpointsWithPx;exports.toTailwindColors=S.toTailwindColors;exports.formatBytes=h.formatBytes;exports.addBodyJsonHook=B.addBodyJsonHook;exports.parseJSON=I.parseJSON;exports.groupBy=t.groupBy;exports.indexBy=t.indexBy;exports.shuffleArray=v.shuffleArray;exports.newHref=N.newHref;exports.isInfinityEmpty=x.isInfinityEmpty;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./components/EmptyState/index.cjs"),i=require("./components/InfinityLoader/index.cjs"),a=require("./components/SelectInfinity/index.cjs"),n=require("./components/NavItems.cjs"),s=require("./components/Icon.cjs"),u=require("./consts/http-status.cjs"),c=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"),y=require("./form/utils/zodValidator.cjs"),q=require("./form/utils/nullableInput.cjs"),m=require("./hocs/withForm.cjs"),p=require("./hocs/withModalManager.cjs"),P=require("./hooks/useBreakpoint.cjs"),S=require("./hooks/useFetchNextPageOnScroll.cjs"),g=require("./hooks/useOnScrollProgress.cjs"),f=require("./hooks/useUpdateSearchParams.cjs"),h=require("./mantine/breakpointsWithPx.cjs"),B=require("./mantine/toTailwindColors.cjs"),I=require("./utils/formatBytes.cjs"),v=require("./utils/ky/addBodyJsonHook.cjs"),N=require("./utils/ky/parseJson.cjs"),t=require("./utils/array/groupBy.cjs"),x=require("./utils/array/shuffleArray.cjs"),w=require("./utils/newHref.cjs"),F=require("./utils/isInfinityEmpty.cjs");exports.EmptyState=o.EmptyState;exports.InfinityLoader=i.InfinityLoader;exports.SelectInfinity=a.SelectInfinity;exports.NavItems=n.NavItems;exports.Icon=s.Icon;exports.HttpStatus=u.HttpStatus;exports.Revalidate=c.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=y.zodValidator;exports.nullableInput=q.nullableInput;exports.withForm=m.withForm;exports.withModalManager=p.withModalManager;exports.useBreakpoint=P.useBreakpoint;exports.useFetchNextPageOnScroll=S.useFetchNextPageOnScroll;exports.useOnScrollProgress=g.useOnScrollProgress;exports.useUpdateSearchParams=f.useUpdateSearchParams;exports.breakpointsWithPx=h.breakpointsWithPx;exports.toTailwindColors=B.toTailwindColors;exports.formatBytes=I.formatBytes;exports.addBodyJsonHook=v.addBodyJsonHook;exports.parseJSON=N.parseJSON;exports.groupBy=t.groupBy;exports.indexBy=t.indexBy;exports.shuffleArray=x.shuffleArray;exports.newHref=w.newHref;exports.isInfinityEmpty=F.isInfinityEmpty;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.ts CHANGED
@@ -24,6 +24,7 @@ import { MantineThemeColors } from '@mantine/core';
24
24
  import { ModalProps } from '@mantine/core';
25
25
  import { MouseEvent as MouseEvent_2 } from 'react';
26
26
  import { ReactNode } from 'react';
27
+ import { ReadonlyURLSearchParams } from 'next/navigation';
27
28
  import { RefObject } from 'react';
28
29
  import { SetStateAction } from 'react';
29
30
  import { SubmitErrorHandler } from 'react-hook-form';
@@ -342,6 +343,8 @@ export declare type TSearchParams = {
342
343
  [x: string]: any;
343
344
  };
344
345
 
346
+ export declare const useBreakpoint: (breakpoint: keyof typeof breakpointsWithPx) => boolean;
347
+
345
348
  export declare const useFetchNextPageOnScroll: (infinity: InfiniteQueryHookResult<InfiniteData<{
346
349
  data: unknown[];
347
350
  }, number>, Error>, elementRef?: RefObject<HTMLElement | null>) => void;
@@ -356,6 +359,11 @@ export declare const useOnScrollProgress: (triggerPercentage: number, callback:
356
359
 
357
360
  export declare const usePageData: <T>() => T;
358
361
 
362
+ export declare const useUpdateSearchParams: () => {
363
+ updateSearchParams: (newSearchparams: Record<string, string | number | null>) => void;
364
+ searchParams: ReadonlyURLSearchParams;
365
+ };
366
+
359
367
  export declare const withForm: <P extends unknown>(WrappedComponent: React.ComponentType<FormFieldProps<P>>, getControllerProps?: (props: P) => Omit<Partial<ControllerProps>, "render">) => FC<P & WithFormProps>;
360
368
 
361
369
  export declare interface WithFormProps {
package/dist/index.mjs CHANGED
@@ -1,61 +1,63 @@
1
- import { EmptyState as m } from "./components/EmptyState/index.mjs";
2
- import { InfinityLoader as f } from "./components/InfinityLoader/index.mjs";
3
- import { SelectInfinity as x } from "./components/SelectInfinity/index.mjs";
4
- import { NavItems as n } from "./components/NavItems.mjs";
5
- import { Icon as l } from "./components/Icon.mjs";
6
- import { HttpStatus as y } from "./consts/http-status.mjs";
7
- import { Revalidate as g } from "./consts/revalidate.mjs";
8
- import { NavigationHistoryProvider as S, QP_BACK_URL_NAME as v, useNavigationHistory as B } from "./contexts/NavigationHistoryContext/index.mjs";
9
- import { PageDataProvider as N, usePageData as c } from "./contexts/PageDataContext/index.mjs";
10
- import { Form as H } from "./form/Form.mjs";
11
- import { FormButtonSubmit as F } from "./form/FormButtonSubmit.mjs";
12
- import { zodValidator as A } from "./form/utils/zodValidator.mjs";
13
- import { nullableInput as M } from "./form/utils/nullableInput.mjs";
14
- import { withForm as _ } from "./hocs/withForm.mjs";
15
- import { withModalManager as C } from "./hocs/withModalManager.mjs";
16
- import "@mantine/core";
1
+ import { EmptyState as t } from "./components/EmptyState/index.mjs";
2
+ import { InfinityLoader as m } from "./components/InfinityLoader/index.mjs";
3
+ import { SelectInfinity as f } from "./components/SelectInfinity/index.mjs";
4
+ import { NavItems as x } from "./components/NavItems.mjs";
5
+ import { Icon as n } from "./components/Icon.mjs";
6
+ import { HttpStatus as l } from "./consts/http-status.mjs";
7
+ import { Revalidate as u } from "./consts/revalidate.mjs";
8
+ import { NavigationHistoryProvider as P, QP_BACK_URL_NAME as g, useNavigationHistory as S } from "./contexts/NavigationHistoryContext/index.mjs";
9
+ import { PageDataProvider as c, usePageData as h } from "./contexts/PageDataContext/index.mjs";
10
+ import { Form as I } from "./form/Form.mjs";
11
+ import { FormButtonSubmit as H } from "./form/FormButtonSubmit.mjs";
12
+ import { zodValidator as F } from "./form/utils/zodValidator.mjs";
13
+ import { nullableInput as k } from "./form/utils/nullableInput.mjs";
14
+ import { withForm as E } from "./hocs/withForm.mjs";
15
+ import { withModalManager as O } from "./hocs/withModalManager.mjs";
16
+ import { useBreakpoint as C } from "./hooks/useBreakpoint.mjs";
17
17
  import { useFetchNextPageOnScroll as J } from "./hooks/useFetchNextPageOnScroll.mjs";
18
18
  import { useOnScrollProgress as R } from "./hooks/useOnScrollProgress.mjs";
19
- import "next/navigation";
20
- import { breakpointsWithPx as K } from "./mantine/breakpointsWithPx.mjs";
21
- import { toTailwindColors as T } from "./mantine/toTailwindColors.mjs";
22
- import { formatBytes as V } from "./utils/formatBytes.mjs";
23
- import { addBodyJsonHook as j } from "./utils/ky/addBodyJsonHook.mjs";
24
- import { parseJSON as G } from "./utils/ky/parseJson.mjs";
25
- import { groupBy as Y, indexBy as Z } from "./utils/array/groupBy.mjs";
26
- import { shuffleArray as oo } from "./utils/array/shuffleArray.mjs";
27
- import { newHref as to } from "./utils/newHref.mjs";
28
- import { isInfinityEmpty as mo } from "./utils/isInfinityEmpty.mjs";
19
+ import { useUpdateSearchParams as z } from "./hooks/useUpdateSearchParams.mjs";
20
+ import { breakpointsWithPx as Q } from "./mantine/breakpointsWithPx.mjs";
21
+ import { toTailwindColors as V } from "./mantine/toTailwindColors.mjs";
22
+ import { formatBytes as j } from "./utils/formatBytes.mjs";
23
+ import { addBodyJsonHook as G } from "./utils/ky/addBodyJsonHook.mjs";
24
+ import { parseJSON as Y } from "./utils/ky/parseJson.mjs";
25
+ import { groupBy as $, indexBy as oo } from "./utils/array/groupBy.mjs";
26
+ import { shuffleArray as to } from "./utils/array/shuffleArray.mjs";
27
+ import { newHref as mo } from "./utils/newHref.mjs";
28
+ import { isInfinityEmpty as fo } from "./utils/isInfinityEmpty.mjs";
29
29
  export {
30
- m as EmptyState,
31
- H as Form,
32
- F as FormButtonSubmit,
33
- y as HttpStatus,
34
- l as Icon,
35
- f as InfinityLoader,
36
- n as NavItems,
37
- S as NavigationHistoryProvider,
38
- N as PageDataProvider,
39
- v as QP_BACK_URL_NAME,
40
- g as Revalidate,
41
- x 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,
30
+ t as EmptyState,
31
+ I as Form,
32
+ H as FormButtonSubmit,
33
+ l as HttpStatus,
34
+ n as Icon,
35
+ m as InfinityLoader,
36
+ x as NavItems,
37
+ P as NavigationHistoryProvider,
38
+ c as PageDataProvider,
39
+ g as QP_BACK_URL_NAME,
40
+ u as Revalidate,
41
+ f as SelectInfinity,
42
+ G as addBodyJsonHook,
43
+ Q as breakpointsWithPx,
44
+ j as formatBytes,
45
+ $ as groupBy,
46
+ oo as indexBy,
47
+ fo as isInfinityEmpty,
48
+ mo as newHref,
49
+ k as nullableInput,
50
+ Y as parseJSON,
51
+ to as shuffleArray,
52
+ V as toTailwindColors,
53
+ C as useBreakpoint,
53
54
  J as useFetchNextPageOnScroll,
54
- B as useNavigationHistory,
55
+ S as useNavigationHistory,
55
56
  R as useOnScrollProgress,
56
- c as usePageData,
57
- _ as withForm,
58
- C as withModalManager,
59
- A as zodValidator
57
+ h as usePageData,
58
+ z as useUpdateSearchParams,
59
+ E as withForm,
60
+ O as withModalManager,
61
+ F as zodValidator
60
62
  };
61
63
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkd-web-kit",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "A template for creating React component libraries with Vite.",
5
5
  "author": "LKD",
6
6
  "license": "MIT",