lkd-web-kit 0.0.2 → 0.0.3
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.cjs.js → index.cjs.js} +2965 -34
- package/dist/index.d.ts +358 -0
- package/dist/{components.es.js → index.es.js} +2940 -32
- package/package.json +6 -50
- package/dist/components.d.ts +0 -116
- package/dist/consts.cjs.js +0 -80
- package/dist/consts.d.ts +0 -73
- package/dist/consts.es.js +0 -75
- package/dist/contexts.cjs.js +0 -78
- package/dist/contexts.d.ts +0 -39
- package/dist/contexts.es.js +0 -70
- package/dist/form.cjs.js +0 -58
- package/dist/form.d.ts +0 -29
- package/dist/form.es.js +0 -51
- package/dist/hocs.cjs.js +0 -76
- package/dist/hocs.d.ts +0 -34
- package/dist/hocs.es.js +0 -71
- package/dist/hooks.cjs.js +0 -12
- package/dist/hooks.d.ts +0 -11
- package/dist/hooks.es.js +0 -3
- package/dist/mantine.cjs.js +0 -29
- package/dist/mantine.d.ts +0 -16
- package/dist/mantine.es.js +0 -24
- package/dist/navigation-DnFkn_t2.cjs +0 -2518
- package/dist/navigation-sZaWnl2V.js +0 -2513
- package/dist/types.cjs.js +0 -2
- package/dist/types.d.ts +0 -33
- package/dist/types.es.js +0 -1
- package/dist/useFetchNextPageOnScroll-08q9N5OE.js +0 -49
- package/dist/useFetchNextPageOnScroll-Fqj7Vp-O.cjs +0 -52
- package/dist/utils.cjs.js +0 -83
- package/dist/utils.d.ts +0 -29
- package/dist/utils.es.js +0 -74
- package/dist/zodValidator-Bx6RMGoL.cjs +0 -13
- package/dist/zodValidator-ChEQ3cmF.js +0 -11
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import { BeforeErrorHook } from 'ky';
|
|
2
|
+
import { BoxProps } from '@mantine/core';
|
|
3
|
+
import { ButtonProps } from '@mantine/core';
|
|
4
|
+
import { CenterProps } from '@mantine/core';
|
|
5
|
+
import { ComboboxItem } from '@mantine/core';
|
|
6
|
+
import { ComponentProps } from 'react';
|
|
7
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
8
|
+
import { ControllerProps } from 'react-hook-form';
|
|
9
|
+
import { default as default_2 } from 'react';
|
|
10
|
+
import { DefaultMantineColor } from '@mantine/core';
|
|
11
|
+
import { Dispatch } from 'react';
|
|
12
|
+
import { ElementProps } from '@mantine/core';
|
|
13
|
+
import { FC } from 'react';
|
|
14
|
+
import { FieldValues } from 'react-hook-form';
|
|
15
|
+
import { HTTPError } from 'ky';
|
|
16
|
+
import { InfiniteData } from '@tanstack/react-query';
|
|
17
|
+
import { InfiniteQueryHookResult } from 'react-query-kit';
|
|
18
|
+
import { InputBaseProps } from '@mantine/core';
|
|
19
|
+
import { JSX } from 'react/jsx-runtime';
|
|
20
|
+
import { KyResponse } from 'ky';
|
|
21
|
+
import { LoaderProps } from '@mantine/core';
|
|
22
|
+
import { MantineColorShade } from '@mantine/core';
|
|
23
|
+
import { MantineThemeColors } from '@mantine/core';
|
|
24
|
+
import { ModalProps } from '@mantine/core';
|
|
25
|
+
import { MouseEvent as MouseEvent_2 } from 'react';
|
|
26
|
+
import { ReactNode } from 'react';
|
|
27
|
+
import { RefObject } from 'react';
|
|
28
|
+
import { SetStateAction } from 'react';
|
|
29
|
+
import { SubmitErrorHandler } from 'react-hook-form';
|
|
30
|
+
import { SubmitHandler } from 'react-hook-form';
|
|
31
|
+
import { UseFormReturn } from 'react-hook-form';
|
|
32
|
+
import { z } from 'zod';
|
|
33
|
+
import { ZodTypeAny } from 'zod';
|
|
34
|
+
|
|
35
|
+
export declare const addBodyJsonHook: BeforeErrorHook;
|
|
36
|
+
|
|
37
|
+
export declare interface ApiList<T = unknown> {
|
|
38
|
+
data: T[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export declare interface ApiPagination<T> {
|
|
42
|
+
data: T[];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export declare const breakpointsWithPx: {
|
|
46
|
+
xs: string;
|
|
47
|
+
sm: string;
|
|
48
|
+
md: string;
|
|
49
|
+
lg: string;
|
|
50
|
+
xl: string;
|
|
51
|
+
"2xl": string;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export declare type DeepPartial<T> = {
|
|
55
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export declare interface EmptyProps extends ComponentProps<'div'> {
|
|
59
|
+
label: ReactNode;
|
|
60
|
+
action?: ReactNode;
|
|
61
|
+
icon: IconFC;
|
|
62
|
+
size?: keyof typeof pxBySize;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export declare const EmptyState: ({ label, action, icon, className, size, ...props }: EmptyProps) => JSX.Element;
|
|
66
|
+
|
|
67
|
+
export declare const Form: <T extends FieldValues>({ methods, onSubmit, onSubmitError, ...rest }: FormProps<T>) => JSX.Element;
|
|
68
|
+
|
|
69
|
+
export declare function formatBytes(bytes: number, decimals?: number): string;
|
|
70
|
+
|
|
71
|
+
export declare const FormButtonSubmit: (props: FormButtonSubmitProps) => JSX.Element;
|
|
72
|
+
|
|
73
|
+
export declare interface FormButtonSubmitProps extends ButtonProps, ElementProps<"button", keyof ButtonProps> {
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export declare type FormFieldProps<T = unknown> = Parameters<ControllerProps['render']>[0] & {
|
|
77
|
+
props: T;
|
|
78
|
+
field: {
|
|
79
|
+
label?: React.ReactNode;
|
|
80
|
+
placeholder?: string;
|
|
81
|
+
description?: React.ReactNode;
|
|
82
|
+
error?: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
declare interface FormProps<T extends FieldValues> extends BoxProps, ElementProps<'form', 'onSubmit'> {
|
|
87
|
+
methods: UseFormReturn<T, any, any>;
|
|
88
|
+
onSubmit?: SubmitHandler<T>;
|
|
89
|
+
onSubmitError?: SubmitErrorHandler<any>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export declare const groupBy: <T extends any>(arr: T[], getKey: (item: T) => string | string[] | null) => Record<string, T[] | undefined>;
|
|
93
|
+
|
|
94
|
+
export declare type GroupByResult<T> = Record<string, T[] | undefined>;
|
|
95
|
+
|
|
96
|
+
export declare enum HttpStatus {
|
|
97
|
+
Continue = 100,
|
|
98
|
+
SwitchingProtocols = 101,
|
|
99
|
+
Processing = 102,
|
|
100
|
+
EarlyHints = 103,
|
|
101
|
+
Ok = 200,
|
|
102
|
+
Created = 201,
|
|
103
|
+
Accepted = 202,
|
|
104
|
+
NonAuthoritativeInformation = 203,
|
|
105
|
+
NoContent = 204,
|
|
106
|
+
ResetContent = 205,
|
|
107
|
+
PartialContent = 206,
|
|
108
|
+
MultiStatus = 207,
|
|
109
|
+
AlreadyReported = 208,
|
|
110
|
+
ImUsed = 226,
|
|
111
|
+
MultipleChoices = 300,
|
|
112
|
+
MovedPermanently = 301,
|
|
113
|
+
Found = 302,
|
|
114
|
+
SeeOther = 303,
|
|
115
|
+
NotModified = 304,
|
|
116
|
+
UseProxy = 305,
|
|
117
|
+
TemporaryRedirect = 307,
|
|
118
|
+
PermanentRedirect = 308,
|
|
119
|
+
BadRequest = 400,
|
|
120
|
+
Unauthorized = 401,
|
|
121
|
+
PaymentRequired = 402,
|
|
122
|
+
Forbidden = 403,
|
|
123
|
+
NotFound = 404,
|
|
124
|
+
MethodNotAllowed = 405,
|
|
125
|
+
NotAcceptable = 406,
|
|
126
|
+
ProxyAuthenticationRequired = 407,
|
|
127
|
+
RequestTimeout = 408,
|
|
128
|
+
Conflict = 409,
|
|
129
|
+
Gone = 410,
|
|
130
|
+
LengthRequired = 411,
|
|
131
|
+
PreconditionFailed = 412,
|
|
132
|
+
PayloadTooLarge = 413,
|
|
133
|
+
UriTooLong = 414,
|
|
134
|
+
UnsupportedMediaType = 415,
|
|
135
|
+
RangeNotSatisfiable = 416,
|
|
136
|
+
ExpectationFailed = 417,
|
|
137
|
+
MisdirectedRequest = 421,
|
|
138
|
+
UnprocessableEntity = 422,
|
|
139
|
+
Locked = 423,
|
|
140
|
+
FailedDependency = 424,
|
|
141
|
+
TooEarly = 425,
|
|
142
|
+
UpgradeRequired = 426,
|
|
143
|
+
PreconditionRequired = 428,
|
|
144
|
+
TooManyRequests = 429,
|
|
145
|
+
RequestHeaderFieldsTooLarge = 431,
|
|
146
|
+
UnavailableForLegalReasons = 451,
|
|
147
|
+
InternalServerError = 500,
|
|
148
|
+
NotImplemented = 501,
|
|
149
|
+
BadGateway = 502,
|
|
150
|
+
ServiceUnavailable = 503,
|
|
151
|
+
GatewayTimeout = 504,
|
|
152
|
+
HttpVersionNotSupported = 505,
|
|
153
|
+
VariantAlsoNegotiates = 506,
|
|
154
|
+
InsufficientStorage = 507,
|
|
155
|
+
LoopDetected = 508,
|
|
156
|
+
NotExtended = 510,
|
|
157
|
+
NetworkAuthenticationRequired = 511
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export declare type IconFC = default_2.FC<ComponentPropsWithoutRef<"svg">>;
|
|
161
|
+
|
|
162
|
+
export declare interface IconProps extends ComponentPropsWithoutRef<"svg"> {
|
|
163
|
+
i: IconFC;
|
|
164
|
+
/**
|
|
165
|
+
* @property xs: 16px
|
|
166
|
+
* @property sm: 20px
|
|
167
|
+
* @property md: 24px
|
|
168
|
+
* @property lg: 28px
|
|
169
|
+
* @property xl: 32px
|
|
170
|
+
* @property 2xl: 40px
|
|
171
|
+
*/
|
|
172
|
+
size?: keyof typeof stylesBySize | number;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export declare function indexBy<T, K, C extends string>(arr: T[], getKey: (item: T) => C | undefined): Record<C, T | undefined>;
|
|
176
|
+
|
|
177
|
+
export declare function indexBy<T, K, C extends string>(arr: T[], getKey: (item: T) => C | undefined, getValue: (item: T) => K): Record<C, K | undefined>;
|
|
178
|
+
|
|
179
|
+
export declare type IndexByResult<T> = Record<string, T | undefined>;
|
|
180
|
+
|
|
181
|
+
export declare const InfinityLoader: ({ infinity, loaderProps, ...props }: InfinityLoaderProps) => JSX.Element;
|
|
182
|
+
|
|
183
|
+
export declare interface InfinityLoaderProps extends CenterProps {
|
|
184
|
+
infinity: InfiniteQueryHookResult<InfiniteData<{
|
|
185
|
+
data: unknown[];
|
|
186
|
+
}>, unknown>;
|
|
187
|
+
loaderProps?: LoaderProps;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export declare type KyError<T = unknown> = HTTPError<T> & {
|
|
191
|
+
response: {
|
|
192
|
+
bodyJson?: T;
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export declare interface LayoutProps {
|
|
197
|
+
children: React.ReactNode;
|
|
198
|
+
params: Promise<PageParams>;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
declare interface NavigationHistoryHook {
|
|
202
|
+
history: string[];
|
|
203
|
+
goBack: (fallback?: string) => void;
|
|
204
|
+
currentRoute: string | null;
|
|
205
|
+
hasPreviousRoute: boolean;
|
|
206
|
+
getPreviousRoute: () => string | null;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Proveedor de historial de navegación
|
|
211
|
+
* Solo se encarga de registrar las rutas visitadas
|
|
212
|
+
*/
|
|
213
|
+
export declare function NavigationHistoryProvider({ children }: NavigationHistoryProviderProps): JSX.Element;
|
|
214
|
+
|
|
215
|
+
declare interface NavigationHistoryProviderProps {
|
|
216
|
+
children: ReactNode;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export declare const NavItems: ({ items }: NavItemsProps) => JSX.Element;
|
|
220
|
+
|
|
221
|
+
export declare interface NavItemsProps {
|
|
222
|
+
items: {
|
|
223
|
+
leftSection?: ReactNode;
|
|
224
|
+
rightSection?: ReactNode;
|
|
225
|
+
onClick?: (e: MouseEvent_2<Element>) => void;
|
|
226
|
+
disabled?: boolean;
|
|
227
|
+
className?: string;
|
|
228
|
+
children?: ReactNode;
|
|
229
|
+
label: string;
|
|
230
|
+
href?: string;
|
|
231
|
+
isActive?: boolean;
|
|
232
|
+
}[];
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export declare const nullableInput: <T extends ZodTypeAny>(schema: T, message?: string) => z.ZodEffects<z.ZodNullable<T>, (T["_output"] & undefined) | (T["_output"] & {}), T["_input"] | null>;
|
|
236
|
+
|
|
237
|
+
export declare const PageDataProvider: ({ value, children }: PageDataProviderProps) => JSX.Element;
|
|
238
|
+
|
|
239
|
+
declare interface PageDataProviderProps {
|
|
240
|
+
children: React.ReactNode;
|
|
241
|
+
value: any;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
declare interface PageParams extends Record<string, string | string[] | undefined> {
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export declare interface PageProps {
|
|
248
|
+
params: Promise<PageParams>;
|
|
249
|
+
searchParams: Promise<{
|
|
250
|
+
[key: string]: string | string[] | undefined;
|
|
251
|
+
}>;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export declare const parseJSON: (response: KyResponse) => Promise<any>;
|
|
255
|
+
|
|
256
|
+
declare const pxBySize: {
|
|
257
|
+
sm: number;
|
|
258
|
+
md: number;
|
|
259
|
+
lg: number;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
export declare const QP_BACK_URL_NAME = "backUrl";
|
|
263
|
+
|
|
264
|
+
export declare enum Revalidate {
|
|
265
|
+
OneHour = 3600,
|
|
266
|
+
OneDay = 86400,
|
|
267
|
+
OneWeek = 604800,
|
|
268
|
+
OneMonth = 2592000,
|
|
269
|
+
OneYear = 31536000
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export declare function SelectInfinity({ value, onChange, data, searchValue, onSearchChange, renderOption, onOptionSubmit, nothingFoundMessage, infinity, placeholder, ...props }: SelectInfinityProps): JSX.Element;
|
|
273
|
+
|
|
274
|
+
export declare interface SelectInfinityProps extends InputBaseProps, ElementProps<'button', keyof InputBaseProps | 'value' | 'onChange'> {
|
|
275
|
+
value?: string | null;
|
|
276
|
+
onChange?: (value: string | null) => void;
|
|
277
|
+
data?: ComboboxItem[];
|
|
278
|
+
searchValue?: string;
|
|
279
|
+
onSearchChange?: (value: string) => void;
|
|
280
|
+
renderOption?: (args: {
|
|
281
|
+
option: ComboboxItem;
|
|
282
|
+
}) => React.ReactNode;
|
|
283
|
+
onOptionSubmit?: (value: string) => void;
|
|
284
|
+
nothingFoundMessage?: ReactNode;
|
|
285
|
+
infinity: InfiniteQueryHookResult<InfiniteData<{
|
|
286
|
+
data: unknown[];
|
|
287
|
+
}, number>, Error>;
|
|
288
|
+
placeholder?: string;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export declare type Setter<T> = Dispatch<SetStateAction<T>>;
|
|
292
|
+
|
|
293
|
+
export declare const shuffleArray: <T>(array: T[]) => T[];
|
|
294
|
+
|
|
295
|
+
declare const stylesBySize: {
|
|
296
|
+
xs: {
|
|
297
|
+
height: number;
|
|
298
|
+
width: number;
|
|
299
|
+
};
|
|
300
|
+
sm: {
|
|
301
|
+
height: number;
|
|
302
|
+
width: number;
|
|
303
|
+
};
|
|
304
|
+
md: {
|
|
305
|
+
height: number;
|
|
306
|
+
width: number;
|
|
307
|
+
};
|
|
308
|
+
lg: {
|
|
309
|
+
height: number;
|
|
310
|
+
width: number;
|
|
311
|
+
};
|
|
312
|
+
xl: {
|
|
313
|
+
height: number;
|
|
314
|
+
width: number;
|
|
315
|
+
};
|
|
316
|
+
"2xl": {
|
|
317
|
+
height: number;
|
|
318
|
+
width: number;
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
export declare const toTailwindColors: (colors: MantineThemeColors) => Record<DefaultMantineColor, Record<MantineColorShade, string>>;
|
|
323
|
+
|
|
324
|
+
export declare const useFetchNextPageOnScroll: (infinity: InfiniteQueryHookResult<InfiniteData<{
|
|
325
|
+
data: unknown[];
|
|
326
|
+
}, number>, Error>, elementRef?: RefObject<HTMLElement | null>) => void;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Hook para usar el historial de navegación
|
|
330
|
+
* @returns {NavigationHistoryHook} Objeto con el historial y la función goBack
|
|
331
|
+
*/
|
|
332
|
+
export declare function useNavigationHistory(): NavigationHistoryHook;
|
|
333
|
+
|
|
334
|
+
export declare const useOnScrollProgress: (triggerPercentage: number, callback: () => void, elementRef?: RefObject<HTMLElement | null>) => void;
|
|
335
|
+
|
|
336
|
+
export declare const usePageData: <T>() => T;
|
|
337
|
+
|
|
338
|
+
export declare const withForm: <P extends unknown>(WrappedComponent: React.ComponentType<FormFieldProps<P>>, getControllerProps?: (props: P) => Omit<Partial<ControllerProps>, "render">) => FC<P & WithFormProps>;
|
|
339
|
+
|
|
340
|
+
export declare interface WithFormProps {
|
|
341
|
+
name?: string;
|
|
342
|
+
label?: React.ReactNode;
|
|
343
|
+
placeholder?: string;
|
|
344
|
+
description?: React.ReactNode;
|
|
345
|
+
validate?: ZodTypeAny;
|
|
346
|
+
disabled?: boolean;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export declare const withModalManager: <P extends Object>(WrappedComponent: React.ComponentType<P & ModalProps>) => FC<P & WithModalManagerProps & ModalProps>;
|
|
350
|
+
|
|
351
|
+
export declare interface WithModalManagerProps {
|
|
352
|
+
removeModal: () => void;
|
|
353
|
+
opened: boolean;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export declare const zodValidator: (schema: ZodTypeAny) => (values: any) => string | undefined;
|
|
357
|
+
|
|
358
|
+
export { }
|