lkd-web-kit 0.0.0 → 0.0.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/README.md CHANGED
@@ -1,32 +1,27 @@
1
- # Vite React Component Library Starter
2
-
3
- This is a starter template for creating React component libraries using Vite. It includes a robust set of features to help you develop, test, and build your library efficiently.
1
+ # LKD WebKit
4
2
 
5
3
  ## Features
6
4
 
7
5
  - React: A JavaScript library for web and native user interfaces.
8
6
  - TypeScript: A strongly typed superset of JavaScript.
9
- - Tailwind: A utility-first CSS framework.
10
- - Storybook: A frontend workshop for building UI components and pages in isolation.
7
+ <!-- - Storybook: A frontend workshop for building UI components and pages in isolation. -->
11
8
  - Vite: A next generation frontend tooling that runs and builds your library incredibly fast.
12
9
  - Vitest: A next generation testing framework.
13
10
  - ESLint: A tool that finds and fixes problems in your code.
14
11
  - Prettier: A code formatter.
15
- - Husky: A pre-commit hook.
16
- - Github Action: A tool that deploys your Storybook to GitHub page automatically.
17
12
 
18
13
  ## Get Started
19
14
 
20
15
  1. Clone this repository
21
- 2. Install dependencies using `pnpm i` (or `npm i` if you like)
16
+ 2. Install dependencies using `npm i`
22
17
 
23
18
  ## Scripts
24
19
 
25
- - `dev`: Starts the local Storybook server, use this to develop and preview your components.
20
+ <!-- - `dev`: Starts the local Storybook server, use this to develop and preview your components. -->
21
+
26
22
  - `test`: Runs all your tests with vitest.
27
23
  - `test:watch`: Runs tests in watch mode.
28
- - `build`: Builds your Storybook as a static web application.
29
- - `build:lib`: Builds your component library with Vite.
24
+ - `build`: Builds your component library with Vite.
30
25
  - `lint`: Runs ESLint.
31
26
  - `format`: Formats your code with Prettier.
32
27
 
@@ -0,0 +1,116 @@
1
+ import { CenterProps } from '@mantine/core';
2
+ import { ComboboxItem } from '@mantine/core';
3
+ import { ComponentProps } from 'react';
4
+ import { ComponentPropsWithoutRef } from 'react';
5
+ import { default as default_2 } from 'react';
6
+ import { ElementProps } from '@mantine/core';
7
+ import { InfiniteData } from '@tanstack/react-query';
8
+ import { InfiniteQueryHookResult } from 'react-query-kit';
9
+ import { InputBaseProps } from '@mantine/core';
10
+ import { JSX } from 'react/jsx-runtime';
11
+ import { LoaderProps } from '@mantine/core';
12
+ import { MouseEvent as MouseEvent_2 } from 'react';
13
+ import { ReactNode } from 'react';
14
+
15
+ export declare interface EmptyProps extends ComponentProps<'div'> {
16
+ label: ReactNode;
17
+ action?: ReactNode;
18
+ icon: IconFC;
19
+ size?: keyof typeof pxBySize;
20
+ }
21
+
22
+ export declare const EmptyState: ({ label, action, icon, className, size, ...props }: EmptyProps) => JSX.Element;
23
+
24
+ export declare type IconFC = default_2.FC<ComponentPropsWithoutRef<"svg">>;
25
+
26
+ export declare interface IconProps extends ComponentPropsWithoutRef<"svg"> {
27
+ i: IconFC;
28
+ /**
29
+ * @property xs: 16px
30
+ * @property sm: 20px
31
+ * @property md: 24px
32
+ * @property lg: 28px
33
+ * @property xl: 32px
34
+ * @property 2xl: 40px
35
+ */
36
+ size?: keyof typeof stylesBySize | number;
37
+ }
38
+
39
+ export declare const InfinityLoader: ({ infinity, loaderProps, ...props }: InfinityLoaderProps) => JSX.Element;
40
+
41
+ export declare interface InfinityLoaderProps extends CenterProps {
42
+ infinity: InfiniteQueryHookResult<InfiniteData<{
43
+ data: unknown[];
44
+ }>, unknown>;
45
+ loaderProps?: LoaderProps;
46
+ }
47
+
48
+ export declare const NavItems: ({ items }: NavItemsProps) => JSX.Element;
49
+
50
+ export declare interface NavItemsProps {
51
+ items: {
52
+ leftSection?: ReactNode;
53
+ rightSection?: ReactNode;
54
+ onClick?: (e: MouseEvent_2<Element>) => void;
55
+ disabled?: boolean;
56
+ className?: string;
57
+ children?: ReactNode;
58
+ label: string;
59
+ href?: string;
60
+ isActive?: boolean;
61
+ }[];
62
+ }
63
+
64
+ declare const pxBySize: {
65
+ sm: number;
66
+ md: number;
67
+ lg: number;
68
+ };
69
+
70
+ export declare function SelectInfinity({ value, onChange, data, searchValue, onSearchChange, renderOption, onOptionSubmit, nothingFoundMessage, infinity, placeholder, ...props }: SelectInfinityProps): JSX.Element;
71
+
72
+ export declare interface SelectInfinityProps extends InputBaseProps, ElementProps<'button', keyof InputBaseProps | 'value' | 'onChange'> {
73
+ value?: string | null;
74
+ onChange?: (value: string | null) => void;
75
+ data?: ComboboxItem[];
76
+ searchValue?: string;
77
+ onSearchChange?: (value: string) => void;
78
+ renderOption?: (args: {
79
+ option: ComboboxItem;
80
+ }) => React.ReactNode;
81
+ onOptionSubmit?: (value: string) => void;
82
+ nothingFoundMessage?: ReactNode;
83
+ infinity: InfiniteQueryHookResult<InfiniteData<{
84
+ data: unknown[];
85
+ }, number>, Error>;
86
+ placeholder?: string;
87
+ }
88
+
89
+ declare const stylesBySize: {
90
+ xs: {
91
+ height: number;
92
+ width: number;
93
+ };
94
+ sm: {
95
+ height: number;
96
+ width: number;
97
+ };
98
+ md: {
99
+ height: number;
100
+ width: number;
101
+ };
102
+ lg: {
103
+ height: number;
104
+ width: number;
105
+ };
106
+ xl: {
107
+ height: number;
108
+ width: number;
109
+ };
110
+ "2xl": {
111
+ height: number;
112
+ width: number;
113
+ };
114
+ };
115
+
116
+ export { }
@@ -0,0 +1,73 @@
1
+ export declare enum HttpStatus {
2
+ Continue = 100,
3
+ SwitchingProtocols = 101,
4
+ Processing = 102,
5
+ EarlyHints = 103,
6
+ Ok = 200,
7
+ Created = 201,
8
+ Accepted = 202,
9
+ NonAuthoritativeInformation = 203,
10
+ NoContent = 204,
11
+ ResetContent = 205,
12
+ PartialContent = 206,
13
+ MultiStatus = 207,
14
+ AlreadyReported = 208,
15
+ ImUsed = 226,
16
+ MultipleChoices = 300,
17
+ MovedPermanently = 301,
18
+ Found = 302,
19
+ SeeOther = 303,
20
+ NotModified = 304,
21
+ UseProxy = 305,
22
+ TemporaryRedirect = 307,
23
+ PermanentRedirect = 308,
24
+ BadRequest = 400,
25
+ Unauthorized = 401,
26
+ PaymentRequired = 402,
27
+ Forbidden = 403,
28
+ NotFound = 404,
29
+ MethodNotAllowed = 405,
30
+ NotAcceptable = 406,
31
+ ProxyAuthenticationRequired = 407,
32
+ RequestTimeout = 408,
33
+ Conflict = 409,
34
+ Gone = 410,
35
+ LengthRequired = 411,
36
+ PreconditionFailed = 412,
37
+ PayloadTooLarge = 413,
38
+ UriTooLong = 414,
39
+ UnsupportedMediaType = 415,
40
+ RangeNotSatisfiable = 416,
41
+ ExpectationFailed = 417,
42
+ MisdirectedRequest = 421,
43
+ UnprocessableEntity = 422,
44
+ Locked = 423,
45
+ FailedDependency = 424,
46
+ TooEarly = 425,
47
+ UpgradeRequired = 426,
48
+ PreconditionRequired = 428,
49
+ TooManyRequests = 429,
50
+ RequestHeaderFieldsTooLarge = 431,
51
+ UnavailableForLegalReasons = 451,
52
+ InternalServerError = 500,
53
+ NotImplemented = 501,
54
+ BadGateway = 502,
55
+ ServiceUnavailable = 503,
56
+ GatewayTimeout = 504,
57
+ HttpVersionNotSupported = 505,
58
+ VariantAlsoNegotiates = 506,
59
+ InsufficientStorage = 507,
60
+ LoopDetected = 508,
61
+ NotExtended = 510,
62
+ NetworkAuthenticationRequired = 511
63
+ }
64
+
65
+ export declare enum Revalidate {
66
+ OneHour = 3600,
67
+ OneDay = 86400,
68
+ OneWeek = 604800,
69
+ OneMonth = 2592000,
70
+ OneYear = 31536000
71
+ }
72
+
73
+ export { }
@@ -0,0 +1,39 @@
1
+ import { JSX } from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ declare interface NavigationHistoryHook {
5
+ history: string[];
6
+ goBack: (fallback?: string) => void;
7
+ currentRoute: string | null;
8
+ hasPreviousRoute: boolean;
9
+ getPreviousRoute: () => string | null;
10
+ }
11
+
12
+ /**
13
+ * Proveedor de historial de navegación
14
+ * Solo se encarga de registrar las rutas visitadas
15
+ */
16
+ export declare function NavigationHistoryProvider({ children }: NavigationHistoryProviderProps): JSX.Element;
17
+
18
+ declare interface NavigationHistoryProviderProps {
19
+ children: ReactNode;
20
+ }
21
+
22
+ export declare const PageDataProvider: ({ value, children }: PageDataProviderProps) => JSX.Element;
23
+
24
+ declare interface PageDataProviderProps {
25
+ children: React.ReactNode;
26
+ value: any;
27
+ }
28
+
29
+ export declare const QP_BACK_URL_NAME = "backUrl";
30
+
31
+ /**
32
+ * Hook para usar el historial de navegación
33
+ * @returns {NavigationHistoryHook} Objeto con el historial y la función goBack
34
+ */
35
+ export declare function useNavigationHistory(): NavigationHistoryHook;
36
+
37
+ export declare const usePageData: <T>() => T;
38
+
39
+ export { }
@@ -6,6 +6,8 @@ import { JSX } from 'react/jsx-runtime';
6
6
  import { SubmitErrorHandler } from 'react-hook-form';
7
7
  import { SubmitHandler } from 'react-hook-form';
8
8
  import { UseFormReturn } from 'react-hook-form';
9
+ import { z } from 'zod';
10
+ import { ZodTypeAny } from 'zod';
9
11
 
10
12
  export declare const Form: <T extends FieldValues>({ methods, onSubmit, onSubmitError, ...rest }: FormProps<T>) => JSX.Element;
11
13
 
@@ -20,4 +22,8 @@ declare interface FormProps<T extends FieldValues> extends BoxProps, ElementProp
20
22
  onSubmitError?: SubmitErrorHandler<any>;
21
23
  }
22
24
 
25
+ export declare const nullableInput: <T extends ZodTypeAny>(schema: T, message?: string) => z.ZodEffects<z.ZodNullable<T>, (T["_output"] & undefined) | (T["_output"] & {}), T["_input"] | null>;
26
+
27
+ export declare const zodValidator: (schema: ZodTypeAny) => (values: any) => string | undefined;
28
+
23
29
  export { }
package/dist/hocs.d.ts ADDED
@@ -0,0 +1,34 @@
1
+ import { ControllerProps } from 'react-hook-form';
2
+ import { FC } from 'react';
3
+ import { ModalProps } from '@mantine/core';
4
+ import { ZodTypeAny } from 'zod';
5
+
6
+ export declare type FormFieldProps<T = unknown> = Parameters<ControllerProps['render']>[0] & {
7
+ props: T;
8
+ field: {
9
+ label?: React.ReactNode;
10
+ placeholder?: string;
11
+ description?: React.ReactNode;
12
+ error?: string;
13
+ };
14
+ };
15
+
16
+ export declare const withForm: <P extends unknown>(WrappedComponent: React.ComponentType<FormFieldProps<P>>, getControllerProps?: (props: P) => Omit<Partial<ControllerProps>, "render">) => FC<P & WithFormProps>;
17
+
18
+ export declare interface WithFormProps {
19
+ name?: string;
20
+ label?: React.ReactNode;
21
+ placeholder?: string;
22
+ description?: React.ReactNode;
23
+ validate?: ZodTypeAny;
24
+ disabled?: boolean;
25
+ }
26
+
27
+ export declare const withModalManager: <P extends Object>(WrappedComponent: React.ComponentType<P & ModalProps>) => FC<P & WithModalManagerProps & ModalProps>;
28
+
29
+ export declare interface WithModalManagerProps {
30
+ removeModal: () => void;
31
+ opened: boolean;
32
+ }
33
+
34
+ export { }
@@ -0,0 +1,11 @@
1
+ import { InfiniteData } from '@tanstack/react-query';
2
+ import { InfiniteQueryHookResult } from 'react-query-kit';
3
+ import { RefObject } from 'react';
4
+
5
+ export declare const useFetchNextPageOnScroll: (infinity: InfiniteQueryHookResult<InfiniteData<{
6
+ data: unknown[];
7
+ }, number>, Error>, elementRef?: RefObject<HTMLElement | null>) => void;
8
+
9
+ export declare const useOnScrollProgress: (triggerPercentage: number, callback: () => void, elementRef?: RefObject<HTMLElement | null>) => void;
10
+
11
+ export { }
package/dist/index.cjs CHANGED
@@ -2,39 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const jsxRuntime = require('react/jsx-runtime');
6
- const core = require('@mantine/core');
7
- const reactHookForm = require('react-hook-form');
5
+ const useFetchNextPageOnScroll = require('./useFetchNextPageOnScroll-Fqj7Vp-O.cjs');
8
6
 
9
- const Form = ({
10
- methods,
11
- onSubmit = () => {
12
- },
13
- onSubmitError,
14
- ...rest
15
- }) => {
16
- return /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.FormProvider, { ...methods, children: /* @__PURE__ */ jsxRuntime.jsx(
17
- core.Box,
18
- {
19
- component: "form",
20
- onSubmit: methods.handleSubmit(onSubmit, onSubmitError),
21
- ...rest
22
- }
23
- ) });
24
- };
25
7
 
26
- const FormButtonSubmit = (props) => {
27
- const { formState } = reactHookForm.useFormContext();
28
- const { isSubmitting } = formState;
29
- return /* @__PURE__ */ jsxRuntime.jsx(
30
- core.Button,
31
- {
32
- loading: isSubmitting,
33
- type: "submit",
34
- ...props
35
- }
36
- );
37
- };
38
8
 
39
- exports.Form = Form;
40
- exports.FormButtonSubmit = FormButtonSubmit;
9
+ exports.useFetchNextPageOnScroll = useFetchNextPageOnScroll.useFetchNextPageOnScroll;
10
+ exports.useOnScrollProgress = useFetchNextPageOnScroll.useOnScrollProgress;
package/dist/index.js CHANGED
@@ -1,35 +1 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { Box, Button } from '@mantine/core';
3
- import { FormProvider, useFormContext } from 'react-hook-form';
4
-
5
- const Form = ({
6
- methods,
7
- onSubmit = () => {
8
- },
9
- onSubmitError,
10
- ...rest
11
- }) => {
12
- return /* @__PURE__ */ jsx(FormProvider, { ...methods, children: /* @__PURE__ */ jsx(
13
- Box,
14
- {
15
- component: "form",
16
- onSubmit: methods.handleSubmit(onSubmit, onSubmitError),
17
- ...rest
18
- }
19
- ) });
20
- };
21
-
22
- const FormButtonSubmit = (props) => {
23
- const { formState } = useFormContext();
24
- const { isSubmitting } = formState;
25
- return /* @__PURE__ */ jsx(
26
- Button,
27
- {
28
- loading: isSubmitting,
29
- type: "submit",
30
- ...props
31
- }
32
- );
33
- };
34
-
35
- export { Form, FormButtonSubmit };
1
+ export { u as useFetchNextPageOnScroll, a as useOnScrollProgress } from './useFetchNextPageOnScroll-08q9N5OE.js';
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
package/dist/index2.js ADDED
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,80 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ var HttpStatus = /* @__PURE__ */ ((HttpStatus2) => {
6
+ HttpStatus2[HttpStatus2["Continue"] = 100] = "Continue";
7
+ HttpStatus2[HttpStatus2["SwitchingProtocols"] = 101] = "SwitchingProtocols";
8
+ HttpStatus2[HttpStatus2["Processing"] = 102] = "Processing";
9
+ HttpStatus2[HttpStatus2["EarlyHints"] = 103] = "EarlyHints";
10
+ HttpStatus2[HttpStatus2["Ok"] = 200] = "Ok";
11
+ HttpStatus2[HttpStatus2["Created"] = 201] = "Created";
12
+ HttpStatus2[HttpStatus2["Accepted"] = 202] = "Accepted";
13
+ HttpStatus2[HttpStatus2["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
14
+ HttpStatus2[HttpStatus2["NoContent"] = 204] = "NoContent";
15
+ HttpStatus2[HttpStatus2["ResetContent"] = 205] = "ResetContent";
16
+ HttpStatus2[HttpStatus2["PartialContent"] = 206] = "PartialContent";
17
+ HttpStatus2[HttpStatus2["MultiStatus"] = 207] = "MultiStatus";
18
+ HttpStatus2[HttpStatus2["AlreadyReported"] = 208] = "AlreadyReported";
19
+ HttpStatus2[HttpStatus2["ImUsed"] = 226] = "ImUsed";
20
+ HttpStatus2[HttpStatus2["MultipleChoices"] = 300] = "MultipleChoices";
21
+ HttpStatus2[HttpStatus2["MovedPermanently"] = 301] = "MovedPermanently";
22
+ HttpStatus2[HttpStatus2["Found"] = 302] = "Found";
23
+ HttpStatus2[HttpStatus2["SeeOther"] = 303] = "SeeOther";
24
+ HttpStatus2[HttpStatus2["NotModified"] = 304] = "NotModified";
25
+ HttpStatus2[HttpStatus2["UseProxy"] = 305] = "UseProxy";
26
+ HttpStatus2[HttpStatus2["TemporaryRedirect"] = 307] = "TemporaryRedirect";
27
+ HttpStatus2[HttpStatus2["PermanentRedirect"] = 308] = "PermanentRedirect";
28
+ HttpStatus2[HttpStatus2["BadRequest"] = 400] = "BadRequest";
29
+ HttpStatus2[HttpStatus2["Unauthorized"] = 401] = "Unauthorized";
30
+ HttpStatus2[HttpStatus2["PaymentRequired"] = 402] = "PaymentRequired";
31
+ HttpStatus2[HttpStatus2["Forbidden"] = 403] = "Forbidden";
32
+ HttpStatus2[HttpStatus2["NotFound"] = 404] = "NotFound";
33
+ HttpStatus2[HttpStatus2["MethodNotAllowed"] = 405] = "MethodNotAllowed";
34
+ HttpStatus2[HttpStatus2["NotAcceptable"] = 406] = "NotAcceptable";
35
+ HttpStatus2[HttpStatus2["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
36
+ HttpStatus2[HttpStatus2["RequestTimeout"] = 408] = "RequestTimeout";
37
+ HttpStatus2[HttpStatus2["Conflict"] = 409] = "Conflict";
38
+ HttpStatus2[HttpStatus2["Gone"] = 410] = "Gone";
39
+ HttpStatus2[HttpStatus2["LengthRequired"] = 411] = "LengthRequired";
40
+ HttpStatus2[HttpStatus2["PreconditionFailed"] = 412] = "PreconditionFailed";
41
+ HttpStatus2[HttpStatus2["PayloadTooLarge"] = 413] = "PayloadTooLarge";
42
+ HttpStatus2[HttpStatus2["UriTooLong"] = 414] = "UriTooLong";
43
+ HttpStatus2[HttpStatus2["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
44
+ HttpStatus2[HttpStatus2["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
45
+ HttpStatus2[HttpStatus2["ExpectationFailed"] = 417] = "ExpectationFailed";
46
+ HttpStatus2[HttpStatus2["MisdirectedRequest"] = 421] = "MisdirectedRequest";
47
+ HttpStatus2[HttpStatus2["UnprocessableEntity"] = 422] = "UnprocessableEntity";
48
+ HttpStatus2[HttpStatus2["Locked"] = 423] = "Locked";
49
+ HttpStatus2[HttpStatus2["FailedDependency"] = 424] = "FailedDependency";
50
+ HttpStatus2[HttpStatus2["TooEarly"] = 425] = "TooEarly";
51
+ HttpStatus2[HttpStatus2["UpgradeRequired"] = 426] = "UpgradeRequired";
52
+ HttpStatus2[HttpStatus2["PreconditionRequired"] = 428] = "PreconditionRequired";
53
+ HttpStatus2[HttpStatus2["TooManyRequests"] = 429] = "TooManyRequests";
54
+ HttpStatus2[HttpStatus2["RequestHeaderFieldsTooLarge"] = 431] = "RequestHeaderFieldsTooLarge";
55
+ HttpStatus2[HttpStatus2["UnavailableForLegalReasons"] = 451] = "UnavailableForLegalReasons";
56
+ HttpStatus2[HttpStatus2["InternalServerError"] = 500] = "InternalServerError";
57
+ HttpStatus2[HttpStatus2["NotImplemented"] = 501] = "NotImplemented";
58
+ HttpStatus2[HttpStatus2["BadGateway"] = 502] = "BadGateway";
59
+ HttpStatus2[HttpStatus2["ServiceUnavailable"] = 503] = "ServiceUnavailable";
60
+ HttpStatus2[HttpStatus2["GatewayTimeout"] = 504] = "GatewayTimeout";
61
+ HttpStatus2[HttpStatus2["HttpVersionNotSupported"] = 505] = "HttpVersionNotSupported";
62
+ HttpStatus2[HttpStatus2["VariantAlsoNegotiates"] = 506] = "VariantAlsoNegotiates";
63
+ HttpStatus2[HttpStatus2["InsufficientStorage"] = 507] = "InsufficientStorage";
64
+ HttpStatus2[HttpStatus2["LoopDetected"] = 508] = "LoopDetected";
65
+ HttpStatus2[HttpStatus2["NotExtended"] = 510] = "NotExtended";
66
+ HttpStatus2[HttpStatus2["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
67
+ return HttpStatus2;
68
+ })(HttpStatus || {});
69
+
70
+ var Revalidate = /* @__PURE__ */ ((Revalidate2) => {
71
+ Revalidate2[Revalidate2["OneHour"] = 3600] = "OneHour";
72
+ Revalidate2[Revalidate2["OneDay"] = 86400] = "OneDay";
73
+ Revalidate2[Revalidate2["OneWeek"] = 604800] = "OneWeek";
74
+ Revalidate2[Revalidate2["OneMonth"] = 2592e3] = "OneMonth";
75
+ Revalidate2[Revalidate2["OneYear"] = 31536e3] = "OneYear";
76
+ return Revalidate2;
77
+ })(Revalidate || {});
78
+
79
+ exports.HttpStatus = HttpStatus;
80
+ exports.Revalidate = Revalidate;
package/dist/index3.js ADDED
@@ -0,0 +1,75 @@
1
+ var HttpStatus = /* @__PURE__ */ ((HttpStatus2) => {
2
+ HttpStatus2[HttpStatus2["Continue"] = 100] = "Continue";
3
+ HttpStatus2[HttpStatus2["SwitchingProtocols"] = 101] = "SwitchingProtocols";
4
+ HttpStatus2[HttpStatus2["Processing"] = 102] = "Processing";
5
+ HttpStatus2[HttpStatus2["EarlyHints"] = 103] = "EarlyHints";
6
+ HttpStatus2[HttpStatus2["Ok"] = 200] = "Ok";
7
+ HttpStatus2[HttpStatus2["Created"] = 201] = "Created";
8
+ HttpStatus2[HttpStatus2["Accepted"] = 202] = "Accepted";
9
+ HttpStatus2[HttpStatus2["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
10
+ HttpStatus2[HttpStatus2["NoContent"] = 204] = "NoContent";
11
+ HttpStatus2[HttpStatus2["ResetContent"] = 205] = "ResetContent";
12
+ HttpStatus2[HttpStatus2["PartialContent"] = 206] = "PartialContent";
13
+ HttpStatus2[HttpStatus2["MultiStatus"] = 207] = "MultiStatus";
14
+ HttpStatus2[HttpStatus2["AlreadyReported"] = 208] = "AlreadyReported";
15
+ HttpStatus2[HttpStatus2["ImUsed"] = 226] = "ImUsed";
16
+ HttpStatus2[HttpStatus2["MultipleChoices"] = 300] = "MultipleChoices";
17
+ HttpStatus2[HttpStatus2["MovedPermanently"] = 301] = "MovedPermanently";
18
+ HttpStatus2[HttpStatus2["Found"] = 302] = "Found";
19
+ HttpStatus2[HttpStatus2["SeeOther"] = 303] = "SeeOther";
20
+ HttpStatus2[HttpStatus2["NotModified"] = 304] = "NotModified";
21
+ HttpStatus2[HttpStatus2["UseProxy"] = 305] = "UseProxy";
22
+ HttpStatus2[HttpStatus2["TemporaryRedirect"] = 307] = "TemporaryRedirect";
23
+ HttpStatus2[HttpStatus2["PermanentRedirect"] = 308] = "PermanentRedirect";
24
+ HttpStatus2[HttpStatus2["BadRequest"] = 400] = "BadRequest";
25
+ HttpStatus2[HttpStatus2["Unauthorized"] = 401] = "Unauthorized";
26
+ HttpStatus2[HttpStatus2["PaymentRequired"] = 402] = "PaymentRequired";
27
+ HttpStatus2[HttpStatus2["Forbidden"] = 403] = "Forbidden";
28
+ HttpStatus2[HttpStatus2["NotFound"] = 404] = "NotFound";
29
+ HttpStatus2[HttpStatus2["MethodNotAllowed"] = 405] = "MethodNotAllowed";
30
+ HttpStatus2[HttpStatus2["NotAcceptable"] = 406] = "NotAcceptable";
31
+ HttpStatus2[HttpStatus2["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
32
+ HttpStatus2[HttpStatus2["RequestTimeout"] = 408] = "RequestTimeout";
33
+ HttpStatus2[HttpStatus2["Conflict"] = 409] = "Conflict";
34
+ HttpStatus2[HttpStatus2["Gone"] = 410] = "Gone";
35
+ HttpStatus2[HttpStatus2["LengthRequired"] = 411] = "LengthRequired";
36
+ HttpStatus2[HttpStatus2["PreconditionFailed"] = 412] = "PreconditionFailed";
37
+ HttpStatus2[HttpStatus2["PayloadTooLarge"] = 413] = "PayloadTooLarge";
38
+ HttpStatus2[HttpStatus2["UriTooLong"] = 414] = "UriTooLong";
39
+ HttpStatus2[HttpStatus2["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
40
+ HttpStatus2[HttpStatus2["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
41
+ HttpStatus2[HttpStatus2["ExpectationFailed"] = 417] = "ExpectationFailed";
42
+ HttpStatus2[HttpStatus2["MisdirectedRequest"] = 421] = "MisdirectedRequest";
43
+ HttpStatus2[HttpStatus2["UnprocessableEntity"] = 422] = "UnprocessableEntity";
44
+ HttpStatus2[HttpStatus2["Locked"] = 423] = "Locked";
45
+ HttpStatus2[HttpStatus2["FailedDependency"] = 424] = "FailedDependency";
46
+ HttpStatus2[HttpStatus2["TooEarly"] = 425] = "TooEarly";
47
+ HttpStatus2[HttpStatus2["UpgradeRequired"] = 426] = "UpgradeRequired";
48
+ HttpStatus2[HttpStatus2["PreconditionRequired"] = 428] = "PreconditionRequired";
49
+ HttpStatus2[HttpStatus2["TooManyRequests"] = 429] = "TooManyRequests";
50
+ HttpStatus2[HttpStatus2["RequestHeaderFieldsTooLarge"] = 431] = "RequestHeaderFieldsTooLarge";
51
+ HttpStatus2[HttpStatus2["UnavailableForLegalReasons"] = 451] = "UnavailableForLegalReasons";
52
+ HttpStatus2[HttpStatus2["InternalServerError"] = 500] = "InternalServerError";
53
+ HttpStatus2[HttpStatus2["NotImplemented"] = 501] = "NotImplemented";
54
+ HttpStatus2[HttpStatus2["BadGateway"] = 502] = "BadGateway";
55
+ HttpStatus2[HttpStatus2["ServiceUnavailable"] = 503] = "ServiceUnavailable";
56
+ HttpStatus2[HttpStatus2["GatewayTimeout"] = 504] = "GatewayTimeout";
57
+ HttpStatus2[HttpStatus2["HttpVersionNotSupported"] = 505] = "HttpVersionNotSupported";
58
+ HttpStatus2[HttpStatus2["VariantAlsoNegotiates"] = 506] = "VariantAlsoNegotiates";
59
+ HttpStatus2[HttpStatus2["InsufficientStorage"] = 507] = "InsufficientStorage";
60
+ HttpStatus2[HttpStatus2["LoopDetected"] = 508] = "LoopDetected";
61
+ HttpStatus2[HttpStatus2["NotExtended"] = 510] = "NotExtended";
62
+ HttpStatus2[HttpStatus2["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
63
+ return HttpStatus2;
64
+ })(HttpStatus || {});
65
+
66
+ var Revalidate = /* @__PURE__ */ ((Revalidate2) => {
67
+ Revalidate2[Revalidate2["OneHour"] = 3600] = "OneHour";
68
+ Revalidate2[Revalidate2["OneDay"] = 86400] = "OneDay";
69
+ Revalidate2[Revalidate2["OneWeek"] = 604800] = "OneWeek";
70
+ Revalidate2[Revalidate2["OneMonth"] = 2592e3] = "OneMonth";
71
+ Revalidate2[Revalidate2["OneYear"] = 31536e3] = "OneYear";
72
+ return Revalidate2;
73
+ })(Revalidate || {});
74
+
75
+ export { HttpStatus, Revalidate };
@@ -0,0 +1,78 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const require$$1 = require('react/jsx-runtime');
6
+ const navigation = require('./navigation-DnFkn_t2.cjs');
7
+ const require$$0 = require('react');
8
+
9
+ const NavigationHistoryContext = require$$0.createContext(null);
10
+ function NavigationHistoryProvider({ children }) {
11
+ const pathname = navigation.navigationExports.usePathname();
12
+ const searchParams = navigation.navigationExports.useSearchParams();
13
+ const [history, setHistory] = require$$0.useState([]);
14
+ require$$0.useEffect(() => {
15
+ const fullPath = searchParams?.size ? `${pathname}?${searchParams.toString()}` : pathname;
16
+ if (fullPath) {
17
+ setHistory((prev) => {
18
+ if (prev.length > 0 && prev[prev.length - 1] === fullPath) {
19
+ return prev;
20
+ }
21
+ return [...prev, fullPath];
22
+ });
23
+ }
24
+ }, [pathname, searchParams]);
25
+ return /* @__PURE__ */ require$$1.jsx(NavigationHistoryContext.Provider, { value: { history }, children });
26
+ }
27
+ const QP_BACK_URL_NAME = "backUrl";
28
+ function useNavigationHistory() {
29
+ const context = require$$0.useContext(NavigationHistoryContext);
30
+ const router = navigation.navigationExports.useRouter();
31
+ if (!context) {
32
+ throw new Error("useNavigationHistory debe usarse dentro de un NavigationHistoryProvider");
33
+ }
34
+ const searchParams = navigation.navigationExports.useSearchParams();
35
+ const { history } = context;
36
+ const goBack = (fallback) => {
37
+ const returnUrl = searchParams.get(QP_BACK_URL_NAME);
38
+ if (returnUrl) {
39
+ router.push(returnUrl);
40
+ return;
41
+ }
42
+ if (history.length <= 1) {
43
+ router.push(fallback ?? "/");
44
+ return;
45
+ }
46
+ const previousRoute = history[history.length - 2];
47
+ const currentRoute = history[history.length - 1];
48
+ if (history.length >= 3 && history[history.length - 3] === currentRoute) {
49
+ router.push(fallback ?? "/");
50
+ return;
51
+ }
52
+ router.push(previousRoute ?? "/");
53
+ };
54
+ return {
55
+ history,
56
+ goBack,
57
+ currentRoute: history.length > 0 ? history[history.length - 1] : null,
58
+ hasPreviousRoute: history.length > 1,
59
+ getPreviousRoute: () => history.length >= 2 ? history[history.length - 2] : null
60
+ };
61
+ }
62
+
63
+ const PageData = require$$0.createContext(void 0);
64
+ const PageDataProvider = ({
65
+ value,
66
+ children
67
+ }) => /* @__PURE__ */ require$$1.jsx(PageData.Provider, { value, children });
68
+ const usePageData = () => {
69
+ const data = require$$0.useContext(PageData);
70
+ if (data === void 0) throw new Error("Out of context: usePageData");
71
+ return data;
72
+ };
73
+
74
+ exports.NavigationHistoryProvider = NavigationHistoryProvider;
75
+ exports.PageDataProvider = PageDataProvider;
76
+ exports.QP_BACK_URL_NAME = QP_BACK_URL_NAME;
77
+ exports.useNavigationHistory = useNavigationHistory;
78
+ exports.usePageData = usePageData;