lkd-web-kit 0.7.11 → 0.7.13
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.
- package/dist/components/InfinityLoadMoreButton/index.cjs +42 -0
- package/dist/components/InfinityLoadMoreButton/index.js +38 -0
- package/dist/components/SelectInfinity/index.cjs +7 -10
- package/dist/components/SelectInfinity/index.js +8 -11
- package/dist/index.cjs +9 -7
- package/dist/index.d.ts +16 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const require$$2 = require('react/jsx-runtime');
|
|
6
|
+
const core = require('@mantine/core');
|
|
7
|
+
const hooks = require('@mantine/hooks');
|
|
8
|
+
const React = require('react');
|
|
9
|
+
|
|
10
|
+
const InfinityLoadMoreButton = ({
|
|
11
|
+
infinity,
|
|
12
|
+
labels,
|
|
13
|
+
parentRef,
|
|
14
|
+
...props
|
|
15
|
+
}) => {
|
|
16
|
+
const { entry, ref } = hooks.useIntersection({
|
|
17
|
+
root: parentRef?.current ?? void 0
|
|
18
|
+
});
|
|
19
|
+
const {
|
|
20
|
+
loadMore = "Cargar más",
|
|
21
|
+
loading = "Cargando...",
|
|
22
|
+
end = "Fin de la lista"
|
|
23
|
+
} = labels || {};
|
|
24
|
+
const { hasNextPage, isFetchingNextPage, fetchNextPage } = infinity;
|
|
25
|
+
const isIntersecting = entry?.isIntersecting ?? false;
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
if (hasNextPage && !isFetchingNextPage && isIntersecting) fetchNextPage();
|
|
28
|
+
}, [hasNextPage, isFetchingNextPage, fetchNextPage, isIntersecting]);
|
|
29
|
+
return /* @__PURE__ */ require$$2.jsx(
|
|
30
|
+
core.Button,
|
|
31
|
+
{
|
|
32
|
+
ref,
|
|
33
|
+
onClick: () => fetchNextPage(),
|
|
34
|
+
disabled: !hasNextPage || isFetchingNextPage,
|
|
35
|
+
variant: "subtle",
|
|
36
|
+
...props,
|
|
37
|
+
children: isFetchingNextPage ? loading : hasNextPage ? loadMore : end
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
exports.InfinityLoadMoreButton = InfinityLoadMoreButton;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Button } from '@mantine/core';
|
|
3
|
+
import { useIntersection } from '@mantine/hooks';
|
|
4
|
+
import { useEffect } from 'react';
|
|
5
|
+
|
|
6
|
+
const InfinityLoadMoreButton = ({
|
|
7
|
+
infinity,
|
|
8
|
+
labels,
|
|
9
|
+
parentRef,
|
|
10
|
+
...props
|
|
11
|
+
}) => {
|
|
12
|
+
const { entry, ref } = useIntersection({
|
|
13
|
+
root: parentRef?.current ?? void 0
|
|
14
|
+
});
|
|
15
|
+
const {
|
|
16
|
+
loadMore = "Cargar más",
|
|
17
|
+
loading = "Cargando...",
|
|
18
|
+
end = "Fin de la lista"
|
|
19
|
+
} = labels || {};
|
|
20
|
+
const { hasNextPage, isFetchingNextPage, fetchNextPage } = infinity;
|
|
21
|
+
const isIntersecting = entry?.isIntersecting ?? false;
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (hasNextPage && !isFetchingNextPage && isIntersecting) fetchNextPage();
|
|
24
|
+
}, [hasNextPage, isFetchingNextPage, fetchNextPage, isIntersecting]);
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
Button,
|
|
27
|
+
{
|
|
28
|
+
ref,
|
|
29
|
+
onClick: () => fetchNextPage(),
|
|
30
|
+
disabled: !hasNextPage || isFetchingNextPage,
|
|
31
|
+
variant: "subtle",
|
|
32
|
+
...props,
|
|
33
|
+
children: isFetchingNextPage ? loading : hasNextPage ? loadMore : end
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { InfinityLoadMoreButton };
|
|
@@ -9,7 +9,7 @@ const core = require('@mantine/core');
|
|
|
9
9
|
const hooks = require('@mantine/hooks');
|
|
10
10
|
const index = require('../../node_modules/@tanstack/react-virtual/dist/esm/index.cjs');
|
|
11
11
|
const virtualStyles = require('../../utils/virtual-styles.cjs');
|
|
12
|
-
const index$1 = require('../
|
|
12
|
+
const index$1 = require('../InfinityLoadMoreButton/index.cjs');
|
|
13
13
|
|
|
14
14
|
function InfinitySelect({
|
|
15
15
|
value,
|
|
@@ -29,6 +29,7 @@ function InfinitySelect({
|
|
|
29
29
|
comboboxProps,
|
|
30
30
|
searchable = true,
|
|
31
31
|
defaultSelectedOption = null,
|
|
32
|
+
loadMoreButtonProps,
|
|
32
33
|
...props
|
|
33
34
|
}) {
|
|
34
35
|
const combobox = core.useCombobox();
|
|
@@ -147,18 +148,14 @@ function InfinitySelect({
|
|
|
147
148
|
renderOption ? renderOption({ option }) : getOptionLabel(option)
|
|
148
149
|
);
|
|
149
150
|
}) }) : !infinity.isFetching ? /* @__PURE__ */ require$$2.jsx(core.Combobox.Empty, { mih: 24, children: nothingFoundMessage ? typeof nothingFoundMessage === "function" ? nothingFoundMessage({ combobox }) : nothingFoundMessage : "No hay resultados" }) : null,
|
|
150
|
-
/* @__PURE__ */ require$$2.jsx(
|
|
151
|
-
index$1.
|
|
151
|
+
/* @__PURE__ */ require$$2.jsx(core.Center, { children: /* @__PURE__ */ require$$2.jsx(
|
|
152
|
+
index$1.InfinityLoadMoreButton,
|
|
152
153
|
{
|
|
153
|
-
root: scrollRef,
|
|
154
154
|
infinity,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
mb: 8,
|
|
158
|
-
size: "sm"
|
|
159
|
-
}
|
|
155
|
+
size: "compact-sm",
|
|
156
|
+
...loadMoreButtonProps
|
|
160
157
|
}
|
|
161
|
-
)
|
|
158
|
+
) })
|
|
162
159
|
]
|
|
163
160
|
}
|
|
164
161
|
) })
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useEffect, useRef, createElement } from 'react';
|
|
4
|
-
import { useCombobox, Combobox, InputBase, Input } from '@mantine/core';
|
|
4
|
+
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 {
|
|
8
|
+
import { InfinityLoadMoreButton } from '../InfinityLoadMoreButton/index.js';
|
|
9
9
|
|
|
10
10
|
function InfinitySelect({
|
|
11
11
|
value,
|
|
@@ -25,6 +25,7 @@ function InfinitySelect({
|
|
|
25
25
|
comboboxProps,
|
|
26
26
|
searchable = true,
|
|
27
27
|
defaultSelectedOption = null,
|
|
28
|
+
loadMoreButtonProps,
|
|
28
29
|
...props
|
|
29
30
|
}) {
|
|
30
31
|
const combobox = useCombobox();
|
|
@@ -143,18 +144,14 @@ function InfinitySelect({
|
|
|
143
144
|
renderOption ? renderOption({ option }) : getOptionLabel(option)
|
|
144
145
|
);
|
|
145
146
|
}) }) : !infinity.isFetching ? /* @__PURE__ */ jsx(Combobox.Empty, { mih: 24, children: nothingFoundMessage ? typeof nothingFoundMessage === "function" ? nothingFoundMessage({ combobox }) : nothingFoundMessage : "No hay resultados" }) : null,
|
|
146
|
-
/* @__PURE__ */ jsx(
|
|
147
|
-
|
|
147
|
+
/* @__PURE__ */ jsx(Center, { children: /* @__PURE__ */ jsx(
|
|
148
|
+
InfinityLoadMoreButton,
|
|
148
149
|
{
|
|
149
|
-
root: scrollRef,
|
|
150
150
|
infinity,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
mb: 8,
|
|
154
|
-
size: "sm"
|
|
155
|
-
}
|
|
151
|
+
size: "compact-sm",
|
|
152
|
+
...loadMoreButtonProps
|
|
156
153
|
}
|
|
157
|
-
)
|
|
154
|
+
) })
|
|
158
155
|
]
|
|
159
156
|
}
|
|
160
157
|
) })
|
package/dist/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@ 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/
|
|
9
|
+
const index$2 = require('./components/InfinityLoadMoreButton/index.cjs');
|
|
10
10
|
const index$3 = require('./components/MyDatePickerInput/index.cjs');
|
|
11
11
|
const index$4 = require('./components/MyDateTimePicker/index.cjs');
|
|
12
12
|
const index$5 = require('./components/MyNotifications/index.cjs');
|
|
@@ -20,11 +20,12 @@ const index$c = require('./components/MyMultiSelect/index.cjs');
|
|
|
20
20
|
const index$d = require('./components/MyMonthPickerInput/index.cjs');
|
|
21
21
|
const index$e = require('./components/MyDateInput/index.cjs');
|
|
22
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$
|
|
26
|
+
const index$h = require('./contexts/NavigationHistoryContext/index.cjs');
|
|
26
27
|
const hook = require('./contexts/NavigationHistoryContext/hook.cjs');
|
|
27
|
-
const index$
|
|
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,7 +71,7 @@ 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.
|
|
74
|
+
exports.InfinityLoadMoreButton = index$2.InfinityLoadMoreButton;
|
|
74
75
|
exports.MyDatePickerInput = index$3.MyDatePickerInput;
|
|
75
76
|
exports.MyDateTimePicker = index$4.MyDateTimePicker;
|
|
76
77
|
exports.MyNotifications = index$5.MyNotifications;
|
|
@@ -84,13 +85,14 @@ exports.MyMultiSelect = index$c.MyMultiSelect;
|
|
|
84
85
|
exports.MyMonthPickerInput = index$d.MyMonthPickerInput;
|
|
85
86
|
exports.MyDateInput = index$e.MyDateInput;
|
|
86
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$
|
|
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$
|
|
93
|
-
exports.usePageData = index$
|
|
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,7 +334,21 @@ export declare interface InfinityLoaderProps extends CenterProps {
|
|
|
334
334
|
loaderProps?: LoaderProps;
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
-
export declare
|
|
337
|
+
export declare const InfinityLoadMoreButton: <T>({ infinity, labels, parentRef, ...props }: InfinityLoadMoreButtonProps<T>) => JSX.Element;
|
|
338
|
+
|
|
339
|
+
export declare interface InfinityLoadMoreButtonProps<T> extends ButtonProps {
|
|
340
|
+
infinity: InfiniteQueryHookResult<InfiniteData<{
|
|
341
|
+
data: T[];
|
|
342
|
+
}, number>, Error>;
|
|
343
|
+
parentRef?: RefObject<HTMLElement>;
|
|
344
|
+
labels?: {
|
|
345
|
+
loadMore?: string;
|
|
346
|
+
loading?: string;
|
|
347
|
+
end?: string;
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export declare function InfinitySelect<T = unknown>({ value, searchValue, defaultSearchValue, nothingFoundMessage, infinity, defaultValue, onChange, onSearchChange, renderOption, onOptionSubmit, getOptionLabel, getOptionValue, onSelectedOptionChange, selectedOption, comboboxProps, searchable, defaultSelectedOption, loadMoreButtonProps, ...props }: InfinitySelectProps<T>): JSX.Element;
|
|
338
352
|
|
|
339
353
|
export declare interface InfinitySelectProps<T = unknown> extends InputBaseProps, ElementProps<'input', keyof InputBaseProps | 'value' | 'onChange'> {
|
|
340
354
|
value?: string | null;
|
|
@@ -361,6 +375,7 @@ export declare interface InfinitySelectProps<T = unknown> extends InputBaseProps
|
|
|
361
375
|
comboboxProps?: ComboboxProps;
|
|
362
376
|
searchable?: boolean;
|
|
363
377
|
ref?: React.Ref<HTMLInputElement>;
|
|
378
|
+
loadMoreButtonProps?: Partial<InfinityLoadMoreButtonProps<T>>;
|
|
364
379
|
}
|
|
365
380
|
|
|
366
381
|
export declare const isInfinityEmpty: (data: InfiniteData<{
|
package/dist/index.js
CHANGED
|
@@ -2,7 +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 {
|
|
5
|
+
export { InfinityLoadMoreButton } from './components/InfinityLoadMoreButton/index.js';
|
|
6
6
|
export { MyDatePickerInput } from './components/MyDatePickerInput/index.js';
|
|
7
7
|
export { MyDateTimePicker } from './components/MyDateTimePicker/index.js';
|
|
8
8
|
export { MyNotifications } from './components/MyNotifications/index.js';
|
|
@@ -16,6 +16,7 @@ export { MyMultiSelect } from './components/MyMultiSelect/index.js';
|
|
|
16
16
|
export { MyMonthPickerInput } from './components/MyMonthPickerInput/index.js';
|
|
17
17
|
export { MyDateInput } from './components/MyDateInput/index.js';
|
|
18
18
|
export { MyCheckboxGroup } from './components/MyCheckboxGroup/index.js';
|
|
19
|
+
export { MyRadioGroup } from './components/MyRadioGroup/index.js';
|
|
19
20
|
export { HttpStatus } from './consts/http-status.js';
|
|
20
21
|
export { Revalidate } from './consts/revalidate.js';
|
|
21
22
|
export { NavigationHistoryProvider } from './contexts/NavigationHistoryContext/index.js';
|