lkd-web-kit 0.3.7 → 0.3.9

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.
@@ -10,6 +10,7 @@ const MyMonthPickerInput = (props) => /* @__PURE__ */ jsxRuntime.jsx(
10
10
  dates.MonthPickerInput,
11
11
  {
12
12
  leftSection: /* @__PURE__ */ jsxRuntime.jsx(CalendarIcon, { size: props.size }),
13
+ leftSectionPointerEvents: "none",
13
14
  variant: props.readOnly ? "filled" : "default",
14
15
  ...props
15
16
  }
@@ -4,9 +4,41 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const jsxRuntime = require('react/jsx-runtime');
6
6
  const core = require('@mantine/core');
7
+ const hooks = require('@mantine/hooks');
8
+ const clsx = require('clsx');
9
+ const react = require('react');
7
10
 
8
- const InfinityLoader = ({ infinity, loaderProps, ...props }) => {
9
- return /* @__PURE__ */ jsxRuntime.jsx(core.Center, { ...props, children: infinity.isFetching ? /* @__PURE__ */ jsxRuntime.jsx(core.Loader, { ...loaderProps }) : !infinity.hasNextPage && (infinity.data?.pages.length ?? 0) > 1 && /* @__PURE__ */ jsxRuntime.jsx("p", { children: "No hay más resultados" }) });
11
+ const InfinityLoader = ({
12
+ root,
13
+ infinity,
14
+ rootMargin = "0px 0px 0px 0px",
15
+ endMessage = "No hay más resultados",
16
+ loaderProps,
17
+ className,
18
+ ...props
19
+ }) => {
20
+ const { entry, ref } = hooks.useIntersection({
21
+ root: root?.current,
22
+ rootMargin
23
+ });
24
+ react.useEffect(() => {
25
+ if (entry?.isIntersecting && infinity.hasNextPage) infinity.fetchNextPage();
26
+ }, [entry?.isIntersecting]);
27
+ react.useEffect(() => {
28
+ if (!entry?.isIntersecting) return;
29
+ const el = root?.current ?? document.documentElement;
30
+ const hasScroll = el?.scrollHeight > el?.clientHeight;
31
+ if (!hasScroll) infinity.fetchNextPage();
32
+ }, [entry?.isIntersecting, infinity.data?.pages.length]);
33
+ return /* @__PURE__ */ jsxRuntime.jsx(
34
+ core.Center,
35
+ {
36
+ ref,
37
+ className: clsx("min-h-4 text-sm", className),
38
+ ...props,
39
+ children: infinity.isFetching ? /* @__PURE__ */ jsxRuntime.jsx(core.Loader, { ...loaderProps }) : infinity.data && infinity.data.pages.length > 1 && !infinity.hasNextPage ? endMessage : null
40
+ }
41
+ );
10
42
  };
11
43
 
12
44
  exports.InfinityLoader = InfinityLoader;
@@ -10,6 +10,7 @@ const MyDatePickerInput = (props) => /* @__PURE__ */ jsxRuntime.jsx(
10
10
  dates.DatePickerInput,
11
11
  {
12
12
  leftSection: /* @__PURE__ */ jsxRuntime.jsx(CalendarIcon, { size: props.size }),
13
+ leftSectionPointerEvents: "none",
13
14
  variant: props.readOnly ? "filled" : "default",
14
15
  ...props
15
16
  }
@@ -10,6 +10,7 @@ const MyDateTimePicker = (props) => /* @__PURE__ */ jsxRuntime.jsx(
10
10
  dates.DateTimePicker,
11
11
  {
12
12
  leftSection: /* @__PURE__ */ jsxRuntime.jsx(CalendarIcon, { size: props.size }),
13
+ leftSectionPointerEvents: "none",
13
14
  variant: props.readOnly ? "filled" : "default",
14
15
  ...props
15
16
  }
package/dist/index.d.ts CHANGED
@@ -119,7 +119,7 @@ export declare type FormDateTimePickerProps = WithFormProps & MyDateTimePickerPr
119
119
  export declare type FormFieldProps<T = unknown> = Parameters<ControllerProps['render']>[0] & {
120
120
  props: T;
121
121
  field: {
122
- label?: React.ReactNode;
122
+ label?: ReactNode;
123
123
  placeholder?: string;
124
124
  description?: React.ReactNode;
125
125
  error?: string;
@@ -259,12 +259,15 @@ export declare function indexBy<T, K, C extends string>(arr: T[], getKey: (item:
259
259
 
260
260
  export declare type IndexByResult<T> = Record<string, T | undefined>;
261
261
 
262
- export declare const InfinityLoader: ({ infinity, loaderProps, ...props }: InfinityLoaderProps) => JSX.Element;
262
+ export declare const InfinityLoader: ({ root, infinity, rootMargin, endMessage, loaderProps, className, ...props }: InfinityLoaderProps) => JSX.Element;
263
263
 
264
264
  export declare interface InfinityLoaderProps extends CenterProps {
265
265
  infinity: InfiniteQueryHookResult<InfiniteData<{
266
266
  data: unknown[];
267
- }>, unknown>;
267
+ }, number>, Error>;
268
+ root?: RefObject<HTMLElement | null>;
269
+ rootMargin?: string;
270
+ endMessage?: React.ReactNode;
268
271
  loaderProps?: LoaderProps;
269
272
  }
270
273
 
@@ -508,9 +511,9 @@ export declare const withForm: <P extends unknown>(WrappedComponent: React.Compo
508
511
 
509
512
  export declare interface WithFormProps {
510
513
  name?: string;
511
- label?: React.ReactNode;
514
+ label?: ReactNode;
512
515
  placeholder?: string;
513
- description?: React.ReactNode;
516
+ description?: ReactNode;
514
517
  validate?: ZodTypeAny;
515
518
  disabled?: boolean;
516
519
  }
@@ -6,6 +6,7 @@ const MyMonthPickerInput = (props) => /* @__PURE__ */ jsx(
6
6
  MonthPickerInput,
7
7
  {
8
8
  leftSection: /* @__PURE__ */ jsx(CalendarIcon, { size: props.size }),
9
+ leftSectionPointerEvents: "none",
9
10
  variant: props.readOnly ? "filled" : "default",
10
11
  ...props
11
12
  }
package/dist/index.es3.js CHANGED
@@ -1,8 +1,40 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { Center, Loader } from '@mantine/core';
3
+ import { useIntersection } from '@mantine/hooks';
4
+ import clsx from 'clsx';
5
+ import { useEffect } from 'react';
3
6
 
4
- const InfinityLoader = ({ infinity, loaderProps, ...props }) => {
5
- return /* @__PURE__ */ jsx(Center, { ...props, children: infinity.isFetching ? /* @__PURE__ */ jsx(Loader, { ...loaderProps }) : !infinity.hasNextPage && (infinity.data?.pages.length ?? 0) > 1 && /* @__PURE__ */ jsx("p", { children: "No hay más resultados" }) });
7
+ const InfinityLoader = ({
8
+ root,
9
+ infinity,
10
+ rootMargin = "0px 0px 0px 0px",
11
+ endMessage = "No hay más resultados",
12
+ loaderProps,
13
+ className,
14
+ ...props
15
+ }) => {
16
+ const { entry, ref } = useIntersection({
17
+ root: root?.current,
18
+ rootMargin
19
+ });
20
+ useEffect(() => {
21
+ if (entry?.isIntersecting && infinity.hasNextPage) infinity.fetchNextPage();
22
+ }, [entry?.isIntersecting]);
23
+ useEffect(() => {
24
+ if (!entry?.isIntersecting) return;
25
+ const el = root?.current ?? document.documentElement;
26
+ const hasScroll = el?.scrollHeight > el?.clientHeight;
27
+ if (!hasScroll) infinity.fetchNextPage();
28
+ }, [entry?.isIntersecting, infinity.data?.pages.length]);
29
+ return /* @__PURE__ */ jsx(
30
+ Center,
31
+ {
32
+ ref,
33
+ className: clsx("min-h-4 text-sm", className),
34
+ ...props,
35
+ children: infinity.isFetching ? /* @__PURE__ */ jsx(Loader, { ...loaderProps }) : infinity.data && infinity.data.pages.length > 1 && !infinity.hasNextPage ? endMessage : null
36
+ }
37
+ );
6
38
  };
7
39
 
8
40
  export { InfinityLoader };
package/dist/index.es6.js CHANGED
@@ -6,6 +6,7 @@ const MyDatePickerInput = (props) => /* @__PURE__ */ jsx(
6
6
  DatePickerInput,
7
7
  {
8
8
  leftSection: /* @__PURE__ */ jsx(CalendarIcon, { size: props.size }),
9
+ leftSectionPointerEvents: "none",
9
10
  variant: props.readOnly ? "filled" : "default",
10
11
  ...props
11
12
  }
package/dist/index.es7.js CHANGED
@@ -6,6 +6,7 @@ const MyDateTimePicker = (props) => /* @__PURE__ */ jsx(
6
6
  DateTimePicker,
7
7
  {
8
8
  leftSection: /* @__PURE__ */ jsx(CalendarIcon, { size: props.size }),
9
+ leftSectionPointerEvents: "none",
9
10
  variant: props.readOnly ? "filled" : "default",
10
11
  ...props
11
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkd-web-kit",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "description": "A template for creating React component libraries with Vite.",
5
5
  "author": "LKD",
6
6
  "license": "MIT",
@@ -31,14 +31,14 @@
31
31
  "@testing-library/jest-dom": "^6.6.3",
32
32
  "@testing-library/react": "^16.3.0",
33
33
  "@testing-library/user-event": "^14.6.1",
34
- "@types/node": "^22.15.18",
35
- "@types/react": "^19.1.4",
34
+ "@types/node": "^22.15.21",
35
+ "@types/react": "^19.1.5",
36
36
  "@types/react-dom": "^19.1.5",
37
37
  "@typescript-eslint/eslint-plugin": "^8.32.1",
38
38
  "@typescript-eslint/parser": "^8.32.1",
39
39
  "@vitejs/plugin-react-swc": "^3.9.0",
40
- "@vitest/coverage-v8": "^3.1.3",
41
- "eslint": "^9.26.0",
40
+ "@vitest/coverage-v8": "^3.1.4",
41
+ "eslint": "^9.27.0",
42
42
  "eslint-config-prettier": "^10.1.5",
43
43
  "eslint-plugin-jest-dom": "^5.5.0",
44
44
  "eslint-plugin-react": "^7.37.5",
@@ -50,7 +50,7 @@
50
50
  "typescript": "^5.8.3",
51
51
  "vite": "^6.3.5",
52
52
  "vite-plugin-dts": "^4.5.4",
53
- "vitest": "^3.1.3"
53
+ "vitest": "^3.1.4"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@mantine/core": "^8.0.1",
@@ -61,11 +61,11 @@
61
61
  "clsx": "^2.1.1",
62
62
  "ky": "^1.8.1",
63
63
  "next": "^15.3.2",
64
- "query-string": "^9.1.2",
64
+ "query-string": "^9.2.0",
65
65
  "react": "^19.1.0",
66
66
  "react-dom": "^19.1.0",
67
- "react-hook-form": "^7.56.3",
67
+ "react-hook-form": "^7.56.4",
68
68
  "react-query-kit": "^3.3.1",
69
- "zod": "^3.24.4"
69
+ "zod": "^3.25.20"
70
70
  }
71
71
  }