lkd-web-kit 0.7.12 → 0.7.14

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.
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
3
5
  const require$$2 = require('react/jsx-runtime');
4
6
  const core = require('@mantine/core');
5
7
  const hooks = require('@mantine/hooks');
@@ -8,18 +10,22 @@ const React = require('react');
8
10
  const InfinityLoadMoreButton = ({
9
11
  infinity,
10
12
  labels,
13
+ parentRef,
11
14
  ...props
12
15
  }) => {
13
- const { inViewport, ref } = hooks.useInViewport();
16
+ const { entry, ref } = hooks.useIntersection({
17
+ root: parentRef?.current ?? void 0
18
+ });
14
19
  const {
15
20
  loadMore = "Cargar más",
16
21
  loading = "Cargando...",
17
22
  end = "Fin de la lista"
18
23
  } = labels || {};
19
24
  const { hasNextPage, isFetchingNextPage, fetchNextPage } = infinity;
25
+ const isIntersecting = entry?.isIntersecting ?? false;
20
26
  React.useEffect(() => {
21
- if (inViewport && hasNextPage && !isFetchingNextPage) fetchNextPage();
22
- }, [inViewport, hasNextPage, isFetchingNextPage, fetchNextPage]);
27
+ if (hasNextPage && !isFetchingNextPage && isIntersecting) fetchNextPage();
28
+ }, [hasNextPage, isFetchingNextPage, fetchNextPage, isIntersecting]);
23
29
  return /* @__PURE__ */ require$$2.jsx(
24
30
  core.Button,
25
31
  {
@@ -33,4 +39,4 @@ const InfinityLoadMoreButton = ({
33
39
  );
34
40
  };
35
41
 
36
- module.exports = InfinityLoadMoreButton;
42
+ exports.InfinityLoadMoreButton = InfinityLoadMoreButton;
@@ -1,23 +1,27 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { Button } from '@mantine/core';
3
- import { useInViewport } from '@mantine/hooks';
3
+ import { useIntersection } from '@mantine/hooks';
4
4
  import { useEffect } from 'react';
5
5
 
6
6
  const InfinityLoadMoreButton = ({
7
7
  infinity,
8
8
  labels,
9
+ parentRef,
9
10
  ...props
10
11
  }) => {
11
- const { inViewport, ref } = useInViewport();
12
+ const { entry, ref } = useIntersection({
13
+ root: parentRef?.current ?? void 0
14
+ });
12
15
  const {
13
16
  loadMore = "Cargar más",
14
17
  loading = "Cargando...",
15
18
  end = "Fin de la lista"
16
19
  } = labels || {};
17
20
  const { hasNextPage, isFetchingNextPage, fetchNextPage } = infinity;
21
+ const isIntersecting = entry?.isIntersecting ?? false;
18
22
  useEffect(() => {
19
- if (inViewport && hasNextPage && !isFetchingNextPage) fetchNextPage();
20
- }, [inViewport, hasNextPage, isFetchingNextPage, fetchNextPage]);
23
+ if (hasNextPage && !isFetchingNextPage && isIntersecting) fetchNextPage();
24
+ }, [hasNextPage, isFetchingNextPage, fetchNextPage, isIntersecting]);
21
25
  return /* @__PURE__ */ jsx(
22
26
  Button,
23
27
  {
@@ -31,4 +35,4 @@ const InfinityLoadMoreButton = ({
31
35
  );
32
36
  };
33
37
 
34
- export { InfinityLoadMoreButton as default };
38
+ export { InfinityLoadMoreButton };
@@ -149,9 +149,10 @@ function InfinitySelect({
149
149
  );
150
150
  }) }) : !infinity.isFetching ? /* @__PURE__ */ require$$2.jsx(core.Combobox.Empty, { mih: 24, children: nothingFoundMessage ? typeof nothingFoundMessage === "function" ? nothingFoundMessage({ combobox }) : nothingFoundMessage : "No hay resultados" }) : null,
151
151
  /* @__PURE__ */ require$$2.jsx(core.Center, { children: /* @__PURE__ */ require$$2.jsx(
152
- index$1,
152
+ index$1.InfinityLoadMoreButton,
153
153
  {
154
154
  infinity,
155
+ parentRef: scrollRef,
155
156
  size: "compact-sm",
156
157
  ...loadMoreButtonProps
157
158
  }
@@ -5,7 +5,7 @@ import { useCombobox, Combobox, InputBase, Input, Center } from '@mantine/core';
5
5
  import { useUncontrolled } from '@mantine/hooks';
6
6
  import { useVirtualizer } from '../../node_modules/@tanstack/react-virtual/dist/esm/index.js';
7
7
  import { getVirtualContainerProps, getVirtualItemProps } from '../../utils/virtual-styles.js';
8
- import InfinityLoadMoreButton from '../InfinityLoadMoreButton/index.js';
8
+ import { InfinityLoadMoreButton } from '../InfinityLoadMoreButton/index.js';
9
9
 
10
10
  function InfinitySelect({
11
11
  value,
@@ -148,6 +148,7 @@ function InfinitySelect({
148
148
  InfinityLoadMoreButton,
149
149
  {
150
150
  infinity,
151
+ parentRef: scrollRef,
151
152
  size: "compact-sm",
152
153
  ...loadMoreButtonProps
153
154
  }
package/dist/index.cjs CHANGED
@@ -6,25 +6,26 @@ const index = require('./components/EmptyState/index.cjs');
6
6
  const index$1 = require('./components/InfinityLoader/index.cjs');
7
7
  const NavItems = require('./components/NavItems.cjs');
8
8
  const Icon = require('./components/Icon.cjs');
9
- const index$2 = require('./components/MyDatePickerInput/index.cjs');
10
- const index$3 = require('./components/MyDateTimePicker/index.cjs');
11
- const index$4 = require('./components/MyNotifications/index.cjs');
12
- const index$5 = require('./components/MyNumberInput/index.cjs');
13
- const index$6 = require('./components/MySelect/index.cjs');
14
- const index$7 = require('./components/MyTextarea/index.cjs');
15
- const index$8 = require('./components/MyTextInput/index.cjs');
16
- const index$9 = require('./components/MyTimeInput/index.cjs');
17
- const index$a = require('./components/SelectInfinity/index.cjs');
18
- const index$b = require('./components/MyMultiSelect/index.cjs');
19
- const index$c = require('./components/MyMonthPickerInput/index.cjs');
20
- const index$d = require('./components/MyDateInput/index.cjs');
21
- const index$e = require('./components/MyCheckboxGroup/index.cjs');
22
- const index$f = require('./components/MyRadioGroup/index.cjs');
9
+ const index$2 = require('./components/InfinityLoadMoreButton/index.cjs');
10
+ const index$3 = require('./components/MyDatePickerInput/index.cjs');
11
+ const index$4 = require('./components/MyDateTimePicker/index.cjs');
12
+ const index$5 = require('./components/MyNotifications/index.cjs');
13
+ const index$6 = require('./components/MyNumberInput/index.cjs');
14
+ const index$7 = require('./components/MySelect/index.cjs');
15
+ const index$8 = require('./components/MyTextarea/index.cjs');
16
+ const index$9 = require('./components/MyTextInput/index.cjs');
17
+ const index$a = require('./components/MyTimeInput/index.cjs');
18
+ const index$b = require('./components/SelectInfinity/index.cjs');
19
+ const index$c = require('./components/MyMultiSelect/index.cjs');
20
+ const index$d = require('./components/MyMonthPickerInput/index.cjs');
21
+ const index$e = require('./components/MyDateInput/index.cjs');
22
+ const index$f = require('./components/MyCheckboxGroup/index.cjs');
23
+ const index$g = require('./components/MyRadioGroup/index.cjs');
23
24
  const httpStatus = require('./consts/http-status.cjs');
24
25
  const revalidate = require('./consts/revalidate.cjs');
25
- const index$g = require('./contexts/NavigationHistoryContext/index.cjs');
26
+ const index$h = require('./contexts/NavigationHistoryContext/index.cjs');
26
27
  const hook = require('./contexts/NavigationHistoryContext/hook.cjs');
27
- const index$h = require('./contexts/PageDataContext/index.cjs');
28
+ const index$i = require('./contexts/PageDataContext/index.cjs');
28
29
  const Form = require('./form/Form.cjs');
29
30
  const FormButtonSubmit = require('./form/FormButtonSubmit.cjs');
30
31
  const zodValidator = require('./form/utils/zodValidator.cjs');
@@ -70,27 +71,28 @@ exports.EmptyState = index.EmptyState;
70
71
  exports.InfinityLoader = index$1.InfinityLoader;
71
72
  exports.NavItems = NavItems.NavItems;
72
73
  exports.Icon = Icon.Icon;
73
- exports.MyDatePickerInput = index$2.MyDatePickerInput;
74
- exports.MyDateTimePicker = index$3.MyDateTimePicker;
75
- exports.MyNotifications = index$4.MyNotifications;
76
- exports.MyNumberInput = index$5.MyNumberInput;
77
- exports.MySelect = index$6.MySelect;
78
- exports.MyTextarea = index$7.MyTextarea;
79
- exports.MyTextInput = index$8.MyTextInput;
80
- exports.MyTimeInput = index$9.MyTimeInput;
81
- exports.InfinitySelect = index$a.InfinitySelect;
82
- exports.MyMultiSelect = index$b.MyMultiSelect;
83
- exports.MyMonthPickerInput = index$c.MyMonthPickerInput;
84
- exports.MyDateInput = index$d.MyDateInput;
85
- exports.MyCheckboxGroup = index$e.MyCheckboxGroup;
86
- exports.MyRadioGroup = index$f.MyRadioGroup;
74
+ exports.InfinityLoadMoreButton = index$2.InfinityLoadMoreButton;
75
+ exports.MyDatePickerInput = index$3.MyDatePickerInput;
76
+ exports.MyDateTimePicker = index$4.MyDateTimePicker;
77
+ exports.MyNotifications = index$5.MyNotifications;
78
+ exports.MyNumberInput = index$6.MyNumberInput;
79
+ exports.MySelect = index$7.MySelect;
80
+ exports.MyTextarea = index$8.MyTextarea;
81
+ exports.MyTextInput = index$9.MyTextInput;
82
+ exports.MyTimeInput = index$a.MyTimeInput;
83
+ exports.InfinitySelect = index$b.InfinitySelect;
84
+ exports.MyMultiSelect = index$c.MyMultiSelect;
85
+ exports.MyMonthPickerInput = index$d.MyMonthPickerInput;
86
+ exports.MyDateInput = index$e.MyDateInput;
87
+ exports.MyCheckboxGroup = index$f.MyCheckboxGroup;
88
+ exports.MyRadioGroup = index$g.MyRadioGroup;
87
89
  exports.HttpStatus = httpStatus.HttpStatus;
88
90
  exports.Revalidate = revalidate.Revalidate;
89
- exports.NavigationHistoryProvider = index$g.NavigationHistoryProvider;
91
+ exports.NavigationHistoryProvider = index$h.NavigationHistoryProvider;
90
92
  exports.QP_BACK_URL_NAME = hook.QP_BACK_URL_NAME;
91
93
  exports.useNavigationHistory = hook.useNavigationHistory;
92
- exports.PageDataProvider = index$h.PageDataProvider;
93
- exports.usePageData = index$h.usePageData;
94
+ exports.PageDataProvider = index$i.PageDataProvider;
95
+ exports.usePageData = index$i.usePageData;
94
96
  exports.Form = Form.Form;
95
97
  exports.FormButtonSubmit = FormButtonSubmit.FormButtonSubmit;
96
98
  exports.zodValidator = zodValidator.zodValidator;
package/dist/index.d.ts CHANGED
@@ -334,10 +334,13 @@ export declare interface InfinityLoaderProps extends CenterProps {
334
334
  loaderProps?: LoaderProps;
335
335
  }
336
336
 
337
+ export declare const InfinityLoadMoreButton: <T>({ infinity, labels, parentRef, ...props }: InfinityLoadMoreButtonProps<T>) => JSX.Element;
338
+
337
339
  export declare interface InfinityLoadMoreButtonProps<T> extends ButtonProps {
338
340
  infinity: InfiniteQueryHookResult<InfiniteData<{
339
341
  data: T[];
340
342
  }, number>, Error>;
343
+ parentRef?: RefObject<HTMLElement | null>;
341
344
  labels?: {
342
345
  loadMore?: string;
343
346
  loading?: string;
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ export { EmptyState } from './components/EmptyState/index.js';
2
2
  export { InfinityLoader } from './components/InfinityLoader/index.js';
3
3
  export { NavItems } from './components/NavItems.js';
4
4
  export { Icon } from './components/Icon.js';
5
+ export { InfinityLoadMoreButton } from './components/InfinityLoadMoreButton/index.js';
5
6
  export { MyDatePickerInput } from './components/MyDatePickerInput/index.js';
6
7
  export { MyDateTimePicker } from './components/MyDateTimePicker/index.js';
7
8
  export { MyNotifications } from './components/MyNotifications/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkd-web-kit",
3
- "version": "0.7.12",
3
+ "version": "0.7.14",
4
4
  "description": "A template for creating React component libraries with Vite.",
5
5
  "author": "LKD",
6
6
  "license": "MIT",