lkd-web-kit 0.3.21 → 0.4.1
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/InfinityLoader/index.cjs +3 -3
- package/dist/components/SelectInfinity/index.cjs +118 -74
- package/dist/components/SelectInfinity/index.js +119 -75
- package/dist/contexts/NavigationHistoryContext/index.cjs +5 -5
- package/dist/contexts/PageDataContext/index.cjs +3 -3
- package/dist/dist/components/InfinityLoader/index.cjs +46 -0
- package/dist/dist/components/InfinityLoader/index.js +42 -0
- package/dist/dist/form/utils/zodValidator.cjs +15 -0
- package/dist/dist/form/utils/zodValidator.js +11 -0
- package/dist/dist/hocs/withForm.cjs +51 -0
- package/dist/dist/hocs/withForm.js +47 -0
- package/dist/form/base/FormSelectInfinity.cjs +15 -9
- package/dist/form/base/FormSelectInfinity.js +16 -10
- package/dist/hocs/withModalManager.cjs +3 -3
- package/dist/hooks/useOnScrollProgress.cjs +2 -2
- package/dist/index.cjs +5 -4
- package/dist/index.d.ts +46 -39
- package/dist/index.js +3 -3
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.cjs +71 -0
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +42 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.cjs +744 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +730 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.cjs +71 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +64 -0
- package/dist/utils/virtual-styles.cjs +30 -0
- package/dist/utils/virtual-styles.js +25 -0
- package/package.json +21 -20
- package/dist/utils/newHref.cjs +0 -23
- package/dist/utils/newHref.js +0 -19
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const reactHookForm = require('react-hook-form');
|
|
8
|
+
const zodValidator = require('../form/utils/zodValidator.cjs');
|
|
9
|
+
|
|
10
|
+
const withForm = (WrappedComponent, getControllerProps) => {
|
|
11
|
+
const FormField = (props) => {
|
|
12
|
+
const { validate, name = "", placeholder, label, description, ...withFormRestProps } = props;
|
|
13
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14
|
+
reactHookForm.Controller,
|
|
15
|
+
{
|
|
16
|
+
name,
|
|
17
|
+
defaultValue: "",
|
|
18
|
+
rules: {
|
|
19
|
+
validate: validate && !props.disabled ? zodValidator.zodValidator(validate) : void 0
|
|
20
|
+
},
|
|
21
|
+
disabled: props.disabled,
|
|
22
|
+
...getControllerProps?.(props),
|
|
23
|
+
render: (renderProps) => {
|
|
24
|
+
const {
|
|
25
|
+
fieldState: { error }
|
|
26
|
+
} = renderProps;
|
|
27
|
+
const fieldProps = {
|
|
28
|
+
...renderProps,
|
|
29
|
+
props: {
|
|
30
|
+
...props,
|
|
31
|
+
validate: void 0
|
|
32
|
+
},
|
|
33
|
+
field: {
|
|
34
|
+
...renderProps.field,
|
|
35
|
+
label,
|
|
36
|
+
placeholder,
|
|
37
|
+
description,
|
|
38
|
+
error: error?.message
|
|
39
|
+
},
|
|
40
|
+
...withFormRestProps
|
|
41
|
+
};
|
|
42
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WrappedComponent, { ...fieldProps });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
FormField.displayName = `WithForm(${WrappedComponent.displayName})`;
|
|
48
|
+
return FormField;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports.withForm = withForm;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Controller } from 'react-hook-form';
|
|
4
|
+
import { zodValidator } from '../form/utils/zodValidator.js';
|
|
5
|
+
|
|
6
|
+
const withForm = (WrappedComponent, getControllerProps) => {
|
|
7
|
+
const FormField = (props) => {
|
|
8
|
+
const { validate, name = "", placeholder, label, description, ...withFormRestProps } = props;
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
Controller,
|
|
11
|
+
{
|
|
12
|
+
name,
|
|
13
|
+
defaultValue: "",
|
|
14
|
+
rules: {
|
|
15
|
+
validate: validate && !props.disabled ? zodValidator(validate) : void 0
|
|
16
|
+
},
|
|
17
|
+
disabled: props.disabled,
|
|
18
|
+
...getControllerProps?.(props),
|
|
19
|
+
render: (renderProps) => {
|
|
20
|
+
const {
|
|
21
|
+
fieldState: { error }
|
|
22
|
+
} = renderProps;
|
|
23
|
+
const fieldProps = {
|
|
24
|
+
...renderProps,
|
|
25
|
+
props: {
|
|
26
|
+
...props,
|
|
27
|
+
validate: void 0
|
|
28
|
+
},
|
|
29
|
+
field: {
|
|
30
|
+
...renderProps.field,
|
|
31
|
+
label,
|
|
32
|
+
placeholder,
|
|
33
|
+
description,
|
|
34
|
+
error: error?.message
|
|
35
|
+
},
|
|
36
|
+
...withFormRestProps
|
|
37
|
+
};
|
|
38
|
+
return /* @__PURE__ */ jsx(WrappedComponent, { ...fieldProps });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
FormField.displayName = `WithForm(${WrappedComponent.displayName})`;
|
|
44
|
+
return FormField;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { withForm };
|
|
@@ -3,15 +3,21 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
const withForm = require('../../dist/hocs/withForm.cjs');
|
|
6
7
|
const index = require('../../components/SelectInfinity/index.cjs');
|
|
7
|
-
const withForm = require('../../hocs/withForm.cjs');
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
)
|
|
9
|
+
const FormInfinitySelect = withForm.withForm(({ field, props }) => {
|
|
10
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11
|
+
index.InfinitySelect,
|
|
12
|
+
{
|
|
13
|
+
...field,
|
|
14
|
+
...props,
|
|
15
|
+
onChange: (e) => {
|
|
16
|
+
field.onChange(e);
|
|
17
|
+
props.onChange?.(e);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
});
|
|
16
22
|
|
|
17
|
-
exports.
|
|
23
|
+
exports.FormInfinitySelect = FormInfinitySelect;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { withForm } from '../../dist/hocs/withForm.js';
|
|
3
|
+
import { InfinitySelect } from '../../components/SelectInfinity/index.js';
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
)
|
|
5
|
+
const FormInfinitySelect = withForm(({ field, props }) => {
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
InfinitySelect,
|
|
8
|
+
{
|
|
9
|
+
...field,
|
|
10
|
+
...props,
|
|
11
|
+
onChange: (e) => {
|
|
12
|
+
field.onChange(e);
|
|
13
|
+
props.onChange?.(e);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
});
|
|
12
18
|
|
|
13
|
-
export {
|
|
19
|
+
export { FormInfinitySelect };
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
5
|
|
|
6
6
|
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
const
|
|
7
|
+
const React = require('react');
|
|
8
8
|
|
|
9
9
|
const withModalManager = (WrappedComponent) => {
|
|
10
10
|
const Component = ({
|
|
@@ -12,13 +12,13 @@ const withModalManager = (WrappedComponent) => {
|
|
|
12
12
|
opened,
|
|
13
13
|
...props
|
|
14
14
|
}) => {
|
|
15
|
-
const [isOpen, setIsOpen] =
|
|
15
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
16
16
|
const onClose = () => {
|
|
17
17
|
setIsOpen(false);
|
|
18
18
|
setTimeout(() => removeModal(), 200);
|
|
19
19
|
props.onClose?.();
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
React.useEffect(() => {
|
|
22
22
|
if (opened) setTimeout(() => setIsOpen(true), 0);
|
|
23
23
|
else onClose();
|
|
24
24
|
}, [opened]);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const React = require('react');
|
|
7
7
|
|
|
8
8
|
const useOnScrollProgress = ({
|
|
9
9
|
triggerPercentage,
|
|
@@ -13,7 +13,7 @@ const useOnScrollProgress = ({
|
|
|
13
13
|
}) => {
|
|
14
14
|
if (triggerPercentage < 0 || triggerPercentage > 1)
|
|
15
15
|
throw new Error("El porcentaje debe estar entre 0 y 1");
|
|
16
|
-
|
|
16
|
+
React.useEffect(() => {
|
|
17
17
|
if (disabled || scrollRef && scrollRef.current === null) return;
|
|
18
18
|
let hasTriggered = false;
|
|
19
19
|
const handleScroll = () => {
|
package/dist/index.cjs
CHANGED
|
@@ -52,10 +52,10 @@ const addBodyJsonHook = require('./utils/ky/addBodyJsonHook.cjs');
|
|
|
52
52
|
const parseJson = require('./utils/ky/parseJson.cjs');
|
|
53
53
|
const groupBy = require('./utils/array/groupBy.cjs');
|
|
54
54
|
const shuffleArray = require('./utils/array/shuffleArray.cjs');
|
|
55
|
-
const newHref = require('./utils/newHref.cjs');
|
|
56
55
|
const isInfinityEmpty = require('./utils/isInfinityEmpty.cjs');
|
|
57
56
|
const queryStringify = require('./utils/query-stringify.cjs');
|
|
58
57
|
const newRoute = require('./utils/new-route.cjs');
|
|
58
|
+
const virtualStyles = require('./utils/virtual-styles.cjs');
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
|
|
@@ -71,7 +71,7 @@ exports.MySelect = index$6.MySelect;
|
|
|
71
71
|
exports.MyTextarea = index$7.MyTextarea;
|
|
72
72
|
exports.MyTextInput = index$8.MyTextInput;
|
|
73
73
|
exports.MyTimeInput = index$9.MyTimeInput;
|
|
74
|
-
exports.
|
|
74
|
+
exports.InfinitySelect = index$a.InfinitySelect;
|
|
75
75
|
exports.MyMultiSelect = index$b.MyMultiSelect;
|
|
76
76
|
exports.MyMonthPickerInput = index$c.MyMonthPickerInput;
|
|
77
77
|
exports.HttpStatus = httpStatus.HttpStatus;
|
|
@@ -92,7 +92,7 @@ exports.FormDateTimePicker = FormDateTimePicker.FormDateTimePicker;
|
|
|
92
92
|
exports.FormNumberInput = FormNumberInput.FormNumberInput;
|
|
93
93
|
exports.FormRadioGroup = FormRadioGroup.FormRadioGroup;
|
|
94
94
|
exports.FormSelect = FormSelect.FormSelect;
|
|
95
|
-
exports.
|
|
95
|
+
exports.FormInfinitySelect = FormSelectInfinity.FormInfinitySelect;
|
|
96
96
|
exports.FormTextarea = FormTextarea.FormTextarea;
|
|
97
97
|
exports.FormTextInput = FormTextInput.FormTextInput;
|
|
98
98
|
exports.FormTimeInput = FormTimeInput.FormTimeInput;
|
|
@@ -115,8 +115,9 @@ exports.parseJSON = parseJson.parseJSON;
|
|
|
115
115
|
exports.groupBy = groupBy.groupBy;
|
|
116
116
|
exports.indexBy = groupBy.indexBy;
|
|
117
117
|
exports.shuffleArray = shuffleArray.shuffleArray;
|
|
118
|
-
exports.newHref = newHref.newHref;
|
|
119
118
|
exports.isInfinityEmpty = isInfinityEmpty.isInfinityEmpty;
|
|
120
119
|
exports.queryStringify = queryStringify.queryStringify;
|
|
121
120
|
exports.createNewRoute = newRoute.createNewRoute;
|
|
122
121
|
exports.newRoute = newRoute.newRoute;
|
|
122
|
+
exports.getVirtualContainerProps = virtualStyles.getVirtualContainerProps;
|
|
123
|
+
exports.getVirtualItemProps = virtualStyles.getVirtualItemProps;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { BoxProps } from '@mantine/core';
|
|
|
3
3
|
import { ButtonProps } from '@mantine/core';
|
|
4
4
|
import { CenterProps } from '@mantine/core';
|
|
5
5
|
import { CheckboxProps } from '@mantine/core';
|
|
6
|
-
import {
|
|
6
|
+
import { ComboboxProps } from '@mantine/core';
|
|
7
|
+
import { ComboboxStore } from '@mantine/core';
|
|
7
8
|
import { ComponentProps } from 'react';
|
|
8
9
|
import { ComponentPropsWithoutRef } from 'react';
|
|
9
10
|
import { ControllerProps } from 'react-hook-form';
|
|
@@ -43,6 +44,7 @@ import { TextareaProps } from '@mantine/core';
|
|
|
43
44
|
import { TextInputProps } from '@mantine/core';
|
|
44
45
|
import { TimeInputProps } from '@mantine/dates';
|
|
45
46
|
import { UseFormReturn } from 'react-hook-form';
|
|
47
|
+
import { VirtualItem } from '@tanstack/react-virtual';
|
|
46
48
|
import { z } from 'zod';
|
|
47
49
|
import { ZodTypeAny } from 'zod';
|
|
48
50
|
|
|
@@ -56,13 +58,6 @@ export declare interface ApiPagination<T> {
|
|
|
56
58
|
data: T[];
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
export declare type Args<T, S> = {
|
|
60
|
-
params?: T;
|
|
61
|
-
searchParams?: S & {
|
|
62
|
-
[QP_BACK_URL_NAME]?: string;
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
|
|
66
61
|
export declare const breakpointsWithPx: {
|
|
67
62
|
xs: string;
|
|
68
63
|
sm: string;
|
|
@@ -138,6 +133,10 @@ export declare type FormFieldProps<T = unknown> = Parameters<ControllerProps['re
|
|
|
138
133
|
};
|
|
139
134
|
};
|
|
140
135
|
|
|
136
|
+
export declare const FormInfinitySelect: <T>(props: FormInfinitySelectProps<T>) => ReactNode;
|
|
137
|
+
|
|
138
|
+
export declare type FormInfinitySelectProps<T = unknown> = InfinitySelectProps<T> & WithFormProps;
|
|
139
|
+
|
|
141
140
|
export declare const FormMonthPickerInput: FC<MyMonthPickerInputProps & WithFormProps>;
|
|
142
141
|
|
|
143
142
|
export declare type FormMonthPickerInputProps = WithFormProps & MyMonthPickerInputProps;
|
|
@@ -162,10 +161,6 @@ export declare type FormRadioGroupProps = RadioGroupProps & WithFormProps;
|
|
|
162
161
|
|
|
163
162
|
export declare const FormSelect: FC<MySelectProps & WithFormProps>;
|
|
164
163
|
|
|
165
|
-
export declare const FormSelectInfinity: FC<SelectInfinityProps & WithFormProps>;
|
|
166
|
-
|
|
167
|
-
export declare type FormSelectInfinityProps = SelectInfinityProps & WithFormProps;
|
|
168
|
-
|
|
169
164
|
export declare type FormSelectProps = MySelectProps & WithFormProps;
|
|
170
165
|
|
|
171
166
|
export declare const FormTextarea: FC<TextareaProps & WithFormProps>;
|
|
@@ -180,6 +175,19 @@ export declare type FormTimeInput = MyTimeInputProps & WithFormProps;
|
|
|
180
175
|
|
|
181
176
|
export declare const FormTimeInput: FC<TimeInputProps & WithFormProps>;
|
|
182
177
|
|
|
178
|
+
export declare const getVirtualContainerProps: (virtualizer: {
|
|
179
|
+
getTotalSize: () => number;
|
|
180
|
+
}) => ComponentProps<"div">;
|
|
181
|
+
|
|
182
|
+
export declare const getVirtualItemProps: (item: VirtualItem, virtualizer: {
|
|
183
|
+
options: {
|
|
184
|
+
scrollMargin: number;
|
|
185
|
+
};
|
|
186
|
+
measureElement: (element: Element | null) => void;
|
|
187
|
+
}) => ComponentProps<"div"> & {
|
|
188
|
+
["data-index"]: number;
|
|
189
|
+
};
|
|
190
|
+
|
|
183
191
|
export declare const groupBy: <T extends any>(arr: T[], getKey: (item: T) => string | string[] | null) => Record<string, T[] | undefined>;
|
|
184
192
|
|
|
185
193
|
export declare type GroupByResult<T> = Record<string, T[] | undefined>;
|
|
@@ -283,6 +291,32 @@ export declare interface InfinityLoaderProps extends CenterProps {
|
|
|
283
291
|
loaderProps?: LoaderProps;
|
|
284
292
|
}
|
|
285
293
|
|
|
294
|
+
export declare function InfinitySelect<T = unknown>({ value, searchValue, defaultSearchValue, nothingFoundMessage, infinity, defaultValue, onChange, onSearchChange, renderOption, onOptionSubmit, getOptionLabel, getOptionValue, onSelectedOptionChange, selectedOption, comboboxProps, ...props }: InfinitySelectProps<T>): JSX.Element;
|
|
295
|
+
|
|
296
|
+
export declare interface InfinitySelectProps<T = unknown> extends InputBaseProps, ElementProps<'input', keyof InputBaseProps | 'value' | 'onChange'> {
|
|
297
|
+
value?: string | null;
|
|
298
|
+
defaultValue?: string;
|
|
299
|
+
searchValue?: string;
|
|
300
|
+
defaultSearchValue?: string;
|
|
301
|
+
nothingFoundMessage?: ReactNode | ((data: {
|
|
302
|
+
combobox: ComboboxStore;
|
|
303
|
+
}) => ReactNode);
|
|
304
|
+
infinity: InfiniteQueryHookResult<InfiniteData<{
|
|
305
|
+
data: T[];
|
|
306
|
+
}, number>, Error>;
|
|
307
|
+
selectedOption?: T | null;
|
|
308
|
+
onSelectedOptionChange?: (option: T | null) => void;
|
|
309
|
+
onSearchChange?: (value: string) => void;
|
|
310
|
+
onChange?: (value: string | null) => void;
|
|
311
|
+
renderOption?: (args: {
|
|
312
|
+
option: T;
|
|
313
|
+
}) => React.ReactNode;
|
|
314
|
+
onOptionSubmit?: (value: string, option: T) => void;
|
|
315
|
+
getOptionLabel: (option: T) => string;
|
|
316
|
+
getOptionValue: (option: T) => string;
|
|
317
|
+
comboboxProps?: ComboboxProps;
|
|
318
|
+
}
|
|
319
|
+
|
|
286
320
|
export declare const isInfinityEmpty: (data: InfiniteData<{
|
|
287
321
|
data: unknown[];
|
|
288
322
|
}> | undefined) => boolean;
|
|
@@ -385,8 +419,6 @@ export declare interface NavItemsProps {
|
|
|
385
419
|
activeStrategy?: 'equals' | 'includes';
|
|
386
420
|
}
|
|
387
421
|
|
|
388
|
-
export declare const newHref: <T extends TParams, S extends TSearchParams = TSearchParams>(fn: string | ((args: Args<T, S>) => string)) => (args?: Args<T, S>) => string;
|
|
389
|
-
|
|
390
422
|
export declare const newRoute: {
|
|
391
423
|
<LocalQuery extends object = {}, Path extends string = string>(path: Path, options?: RouteOptions<LocalQuery, ExtractPathParams<Path>> | undefined): (params?: RouteInput<ExtractPathParams<Path>, LocalQuery> | undefined) => string;
|
|
392
424
|
<LocalQuery extends object = {}, PathParams extends Params = {}>(path: string, options?: RouteOptions<LocalQuery, PathParams> | undefined): (params?: RouteInput<PathParams, LocalQuery> | undefined) => string;
|
|
@@ -456,25 +488,6 @@ declare type RouteOptions<Query, PathParams> = {
|
|
|
456
488
|
pathBuilder?: (params: PathParams) => string;
|
|
457
489
|
};
|
|
458
490
|
|
|
459
|
-
export declare function SelectInfinity({ value, onChange, data, searchValue, onSearchChange, renderOption, onOptionSubmit, nothingFoundMessage, infinity, placeholder, ...props }: SelectInfinityProps): JSX.Element;
|
|
460
|
-
|
|
461
|
-
export declare interface SelectInfinityProps extends InputBaseProps, ElementProps<'button', keyof InputBaseProps | 'value' | 'onChange'> {
|
|
462
|
-
value?: string | null;
|
|
463
|
-
onChange?: (value: string | null) => void;
|
|
464
|
-
data?: ComboboxItem[];
|
|
465
|
-
searchValue?: string;
|
|
466
|
-
onSearchChange?: (value: string) => void;
|
|
467
|
-
renderOption?: (args: {
|
|
468
|
-
option: ComboboxItem;
|
|
469
|
-
}) => React.ReactNode;
|
|
470
|
-
onOptionSubmit?: (value: string) => void;
|
|
471
|
-
nothingFoundMessage?: ReactNode;
|
|
472
|
-
infinity: InfiniteQueryHookResult<InfiniteData<{
|
|
473
|
-
data: unknown[];
|
|
474
|
-
}, number>, Error>;
|
|
475
|
-
placeholder?: string;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
491
|
export declare type Setter<T> = Dispatch<SetStateAction<T>>;
|
|
479
492
|
|
|
480
493
|
export declare const shuffleArray: <T>(array: T[]) => T[];
|
|
@@ -510,12 +523,6 @@ export declare const timeInputToNumber: (timeInput: string) => number;
|
|
|
510
523
|
|
|
511
524
|
export declare const toTailwindColors: (colors: MantineThemeColors) => Record<DefaultMantineColor, Record<MantineColorShade, string>>;
|
|
512
525
|
|
|
513
|
-
export declare type TParams = Record<string, any> | unknown;
|
|
514
|
-
|
|
515
|
-
export declare type TSearchParams = {
|
|
516
|
-
[x: string]: any;
|
|
517
|
-
};
|
|
518
|
-
|
|
519
526
|
export declare const useBreakpoint: (breakpoint: keyof typeof breakpointsWithPx) => boolean;
|
|
520
527
|
|
|
521
528
|
export declare const useFetchNextPageOnScroll: ({ infinity, scrollRef, disabled, }: FetchNextPageOnScrollOptions) => void;
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ export { MySelect } from './components/MySelect/index.js';
|
|
|
10
10
|
export { MyTextarea } from './components/MyTextarea/index.js';
|
|
11
11
|
export { MyTextInput } from './components/MyTextInput/index.js';
|
|
12
12
|
export { MyTimeInput } from './components/MyTimeInput/index.js';
|
|
13
|
-
export {
|
|
13
|
+
export { InfinitySelect } from './components/SelectInfinity/index.js';
|
|
14
14
|
export { MyMultiSelect } from './components/MyMultiSelect/index.js';
|
|
15
15
|
export { MyMonthPickerInput } from './components/MyMonthPickerInput/index.js';
|
|
16
16
|
export { HttpStatus } from './consts/http-status.js';
|
|
@@ -28,7 +28,7 @@ export { FormDateTimePicker } from './form/base/FormDateTimePicker.js';
|
|
|
28
28
|
export { FormNumberInput } from './form/base/FormNumberInput.js';
|
|
29
29
|
export { FormRadioGroup } from './form/base/FormRadioGroup.js';
|
|
30
30
|
export { FormSelect } from './form/base/FormSelect.js';
|
|
31
|
-
export {
|
|
31
|
+
export { FormInfinitySelect } from './form/base/FormSelectInfinity.js';
|
|
32
32
|
export { FormTextarea } from './form/base/FormTextarea.js';
|
|
33
33
|
export { FormTextInput } from './form/base/FormTextInput.js';
|
|
34
34
|
export { FormTimeInput, numberToTimeInput, timeInputToNumber } from './form/base/FormTimeInput.js';
|
|
@@ -48,7 +48,7 @@ export { addBodyJsonHook } from './utils/ky/addBodyJsonHook.js';
|
|
|
48
48
|
export { parseJSON } from './utils/ky/parseJson.js';
|
|
49
49
|
export { groupBy, indexBy } from './utils/array/groupBy.js';
|
|
50
50
|
export { shuffleArray } from './utils/array/shuffleArray.js';
|
|
51
|
-
export { newHref } from './utils/newHref.js';
|
|
52
51
|
export { isInfinityEmpty } from './utils/isInfinityEmpty.js';
|
|
53
52
|
export { queryStringify } from './utils/query-stringify.js';
|
|
54
53
|
export { createNewRoute, newRoute } from './utils/new-route.js';
|
|
54
|
+
export { getVirtualContainerProps, getVirtualItemProps } from './utils/virtual-styles.js';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const React = require('react');
|
|
6
|
+
const reactDom = require('react-dom');
|
|
7
|
+
const index = require('../../../virtual-core/dist/esm/index.cjs');
|
|
8
|
+
|
|
9
|
+
function _interopNamespaceDefault(e) {
|
|
10
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
11
|
+
if (e) {
|
|
12
|
+
for (const k in e) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: () => e[k]
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
27
|
+
|
|
28
|
+
const useIsomorphicLayoutEffect = typeof document !== "undefined" ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
29
|
+
function useVirtualizerBase(options) {
|
|
30
|
+
const rerender = React__namespace.useReducer(() => ({}), {})[1];
|
|
31
|
+
const resolvedOptions = {
|
|
32
|
+
...options,
|
|
33
|
+
onChange: (instance2, sync) => {
|
|
34
|
+
var _a;
|
|
35
|
+
if (sync) {
|
|
36
|
+
reactDom.flushSync(rerender);
|
|
37
|
+
} else {
|
|
38
|
+
rerender();
|
|
39
|
+
}
|
|
40
|
+
(_a = options.onChange) == null ? void 0 : _a.call(options, instance2, sync);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const [instance] = React__namespace.useState(
|
|
44
|
+
() => new index.Virtualizer(resolvedOptions)
|
|
45
|
+
);
|
|
46
|
+
instance.setOptions(resolvedOptions);
|
|
47
|
+
useIsomorphicLayoutEffect(() => {
|
|
48
|
+
return instance._didMount();
|
|
49
|
+
}, []);
|
|
50
|
+
useIsomorphicLayoutEffect(() => {
|
|
51
|
+
return instance._willUpdate();
|
|
52
|
+
});
|
|
53
|
+
return instance;
|
|
54
|
+
}
|
|
55
|
+
function useVirtualizer(options) {
|
|
56
|
+
return useVirtualizerBase({
|
|
57
|
+
observeElementRect: index.observeElementRect,
|
|
58
|
+
observeElementOffset: index.observeElementOffset,
|
|
59
|
+
scrollToFn: index.elementScroll,
|
|
60
|
+
...options
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
exports.Virtualizer = index.Virtualizer;
|
|
65
|
+
exports.defaultKeyExtractor = index.defaultKeyExtractor;
|
|
66
|
+
exports.defaultRangeExtractor = index.defaultRangeExtractor;
|
|
67
|
+
exports.elementScroll = index.elementScroll;
|
|
68
|
+
exports.measureElement = index.measureElement;
|
|
69
|
+
exports.observeElementOffset = index.observeElementOffset;
|
|
70
|
+
exports.observeElementRect = index.observeElementRect;
|
|
71
|
+
exports.useVirtualizer = useVirtualizer;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { flushSync } from 'react-dom';
|
|
3
|
+
import { Virtualizer, elementScroll, observeElementOffset, observeElementRect } from '../../../virtual-core/dist/esm/index.js';
|
|
4
|
+
export { defaultKeyExtractor, defaultRangeExtractor, measureElement } from '../../../virtual-core/dist/esm/index.js';
|
|
5
|
+
|
|
6
|
+
const useIsomorphicLayoutEffect = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
7
|
+
function useVirtualizerBase(options) {
|
|
8
|
+
const rerender = React.useReducer(() => ({}), {})[1];
|
|
9
|
+
const resolvedOptions = {
|
|
10
|
+
...options,
|
|
11
|
+
onChange: (instance2, sync) => {
|
|
12
|
+
var _a;
|
|
13
|
+
if (sync) {
|
|
14
|
+
flushSync(rerender);
|
|
15
|
+
} else {
|
|
16
|
+
rerender();
|
|
17
|
+
}
|
|
18
|
+
(_a = options.onChange) == null ? void 0 : _a.call(options, instance2, sync);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const [instance] = React.useState(
|
|
22
|
+
() => new Virtualizer(resolvedOptions)
|
|
23
|
+
);
|
|
24
|
+
instance.setOptions(resolvedOptions);
|
|
25
|
+
useIsomorphicLayoutEffect(() => {
|
|
26
|
+
return instance._didMount();
|
|
27
|
+
}, []);
|
|
28
|
+
useIsomorphicLayoutEffect(() => {
|
|
29
|
+
return instance._willUpdate();
|
|
30
|
+
});
|
|
31
|
+
return instance;
|
|
32
|
+
}
|
|
33
|
+
function useVirtualizer(options) {
|
|
34
|
+
return useVirtualizerBase({
|
|
35
|
+
observeElementRect,
|
|
36
|
+
observeElementOffset,
|
|
37
|
+
scrollToFn: elementScroll,
|
|
38
|
+
...options
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { Virtualizer, elementScroll, observeElementOffset, observeElementRect, useVirtualizer };
|