@onpe/ui 1.0.0
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 +263 -0
- package/dist/components/Button/Button.d.ts +23 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/Button.stories.d.ts +14 -0
- package/dist/components/Button/Button.stories.d.ts.map +1 -0
- package/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components.d.ts +24 -0
- package/dist/components.d.ts.map +1 -0
- package/dist/components.esm.js +68 -0
- package/dist/components.esm.js.map +1 -0
- package/dist/components.js +70 -0
- package/dist/components.js.map +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useDebounce.d.ts +8 -0
- package/dist/hooks/useDebounce.d.ts.map +1 -0
- package/dist/hooks/useLocalStorage.d.ts +8 -0
- package/dist/hooks/useLocalStorage.d.ts.map +1 -0
- package/dist/hooks.d.ts +17 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.esm.js +55 -0
- package/dist/hooks.esm.js.map +1 -0
- package/dist/hooks.js +58 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +97 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.css +1 -0
- package/dist/index.esm.js +315 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +324 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/api.d.ts +20 -0
- package/dist/lib/api.d.ts.map +1 -0
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/storage.d.ts +22 -0
- package/dist/lib/storage.d.ts.map +1 -0
- package/dist/lib.d.ts +43 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.esm.js +176 -0
- package/dist/lib.esm.js.map +1 -0
- package/dist/lib.js +180 -0
- package/dist/lib.js.map +1 -0
- package/dist/utils/formatDate.d.ts +8 -0
- package/dist/utils/formatDate.d.ts.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/validateEmail.d.ts +13 -0
- package/dist/utils/validateEmail.d.ts.map +1 -0
- package/dist/utils.d.ts +16 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.esm.js +45 -0
- package/dist/utils.esm.js.map +1 -0
- package/dist/utils.js +48 -0
- package/dist/utils.js.map +1 -0
- package/package.json +111 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebounce.d.ts","sourceRoot":"","sources":["../../src/hooks/useDebounce.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAczD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook personalizado para manejar localStorage
|
|
3
|
+
* @param key - Clave del localStorage
|
|
4
|
+
* @param initialValue - Valor inicial
|
|
5
|
+
* @returns [value, setValue] - Valor actual y función para actualizarlo
|
|
6
|
+
*/
|
|
7
|
+
export declare function useLocalStorage<T>(key: string, initialValue: T): readonly [T, (value: T | ((val: T) => T)) => void];
|
|
8
|
+
//# sourceMappingURL=useLocalStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocalStorage.d.ts","sourceRoot":"","sources":["../../src/hooks/useLocalStorage.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,wBAapC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,WAW7C"}
|
package/dist/hooks.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook para debounce de valores
|
|
3
|
+
* @param value - Valor a debounce
|
|
4
|
+
* @param delay - Delay en milisegundos
|
|
5
|
+
* @returns Valor debounced
|
|
6
|
+
*/
|
|
7
|
+
declare function useDebounce<T>(value: T, delay: number): T;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Hook personalizado para manejar localStorage
|
|
11
|
+
* @param key - Clave del localStorage
|
|
12
|
+
* @param initialValue - Valor inicial
|
|
13
|
+
* @returns [value, setValue] - Valor actual y función para actualizarlo
|
|
14
|
+
*/
|
|
15
|
+
declare function useLocalStorage<T>(key: string, initialValue: T): readonly [T, (value: T | ((val: T) => T)) => void];
|
|
16
|
+
|
|
17
|
+
export { useDebounce, useLocalStorage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hook para debounce de valores
|
|
5
|
+
* @param value - Valor a debounce
|
|
6
|
+
* @param delay - Delay en milisegundos
|
|
7
|
+
* @returns Valor debounced
|
|
8
|
+
*/
|
|
9
|
+
function useDebounce(value, delay) {
|
|
10
|
+
var _a = useState(value), debouncedValue = _a[0], setDebouncedValue = _a[1];
|
|
11
|
+
useEffect(function () {
|
|
12
|
+
var handler = setTimeout(function () {
|
|
13
|
+
setDebouncedValue(value);
|
|
14
|
+
}, delay);
|
|
15
|
+
return function () {
|
|
16
|
+
clearTimeout(handler);
|
|
17
|
+
};
|
|
18
|
+
}, [value, delay]);
|
|
19
|
+
return debouncedValue;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Hook personalizado para manejar localStorage
|
|
24
|
+
* @param key - Clave del localStorage
|
|
25
|
+
* @param initialValue - Valor inicial
|
|
26
|
+
* @returns [value, setValue] - Valor actual y función para actualizarlo
|
|
27
|
+
*/
|
|
28
|
+
function useLocalStorage(key, initialValue) {
|
|
29
|
+
// Estado para almacenar nuestro valor
|
|
30
|
+
var _a = useState(function () {
|
|
31
|
+
try {
|
|
32
|
+
var item = window.localStorage.getItem(key);
|
|
33
|
+
return item ? JSON.parse(item) : initialValue;
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
console.error("Error reading localStorage key \"".concat(key, "\":"), error);
|
|
37
|
+
return initialValue;
|
|
38
|
+
}
|
|
39
|
+
}), storedValue = _a[0], setStoredValue = _a[1];
|
|
40
|
+
// Función para actualizar el valor
|
|
41
|
+
var setValue = function (value) {
|
|
42
|
+
try {
|
|
43
|
+
var valueToStore = value instanceof Function ? value(storedValue) : value;
|
|
44
|
+
setStoredValue(valueToStore);
|
|
45
|
+
window.localStorage.setItem(key, JSON.stringify(valueToStore));
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
console.error("Error setting localStorage key \"".concat(key, "\":"), error);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
return [storedValue, setValue];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { useDebounce, useLocalStorage };
|
|
55
|
+
//# sourceMappingURL=hooks.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.esm.js","sources":["../src/hooks/useDebounce.ts","../src/hooks/useLocalStorage.ts"],"sourcesContent":["import { useState, useEffect } from \"react\";\r\n\r\n/**\r\n * Hook para debounce de valores\r\n * @param value - Valor a debounce\r\n * @param delay - Delay en milisegundos\r\n * @returns Valor debounced\r\n */\r\nexport function useDebounce<T>(value: T, delay: number): T {\r\n const [debouncedValue, setDebouncedValue] = useState<T>(value);\r\n\r\n useEffect(() => {\r\n const handler = setTimeout(() => {\r\n setDebouncedValue(value);\r\n }, delay);\r\n\r\n return () => {\r\n clearTimeout(handler);\r\n };\r\n }, [value, delay]);\r\n\r\n return debouncedValue;\r\n}\r\n","import { useState, useEffect } from \"react\";\r\n\r\n/**\r\n * Hook personalizado para manejar localStorage\r\n * @param key - Clave del localStorage\r\n * @param initialValue - Valor inicial\r\n * @returns [value, setValue] - Valor actual y función para actualizarlo\r\n */\r\nexport function useLocalStorage<T>(key: string, initialValue: T) {\r\n // Estado para almacenar nuestro valor\r\n const [storedValue, setStoredValue] = useState<T>(() => {\r\n try {\r\n const item = window.localStorage.getItem(key);\r\n return item ? JSON.parse(item) : initialValue;\r\n } catch (error) {\r\n console.error(`Error reading localStorage key \"${key}\":`, error);\r\n return initialValue;\r\n }\r\n });\r\n\r\n // Función para actualizar el valor\r\n const setValue = (value: T | ((val: T) => T)) => {\r\n try {\r\n const valueToStore = value instanceof Function ? value(storedValue) : value;\r\n setStoredValue(valueToStore);\r\n window.localStorage.setItem(key, JSON.stringify(valueToStore));\r\n } catch (error) {\r\n console.error(`Error setting localStorage key \"${key}\":`, error);\r\n }\r\n };\r\n\r\n return [storedValue, setValue] as const;\r\n}\r\n"],"names":[],"mappings":";;AAEA;;;;;AAKG;AACG,SAAU,WAAW,CAAI,KAAQ,EAAE,KAAa,EAAA;IAC9C,IAAA,EAAA,GAAsC,QAAQ,CAAI,KAAK,CAAC,EAAvD,cAAc,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,iBAAiB,GAAA,EAAA,CAAA,CAAA,CAAsB;AAE9D,IAAA,SAAS,CAAC,YAAA;QACR,IAAM,OAAO,GAAG,UAAU,CAAC,YAAA;YACzB,iBAAiB,CAAC,KAAK,CAAC;QAC1B,CAAC,EAAE,KAAK,CAAC;QAET,OAAO,YAAA;YACL,YAAY,CAAC,OAAO,CAAC;AACvB,QAAA,CAAC;AACH,IAAA,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAElB,IAAA,OAAO,cAAc;AACvB;;ACpBA;;;;;AAKG;AACG,SAAU,eAAe,CAAI,GAAW,EAAE,YAAe,EAAA;;IAEvD,IAAA,EAAA,GAAgC,QAAQ,CAAI,YAAA;AAChD,QAAA,IAAI;YACF,IAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC;AAC7C,YAAA,OAAO,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,YAAY;QAC/C;QAAE,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,mCAAA,CAAA,MAAA,CAAmC,GAAG,EAAA,KAAA,CAAI,EAAE,KAAK,CAAC;AAChE,YAAA,OAAO,YAAY;QACrB;AACF,IAAA,CAAC,CAAC,EARK,WAAW,QAAA,EAAE,cAAc,QAQhC;;IAGF,IAAM,QAAQ,GAAG,UAAC,KAA0B,EAAA;AAC1C,QAAA,IAAI;AACF,YAAA,IAAM,YAAY,GAAG,KAAK,YAAY,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,KAAK;YAC3E,cAAc,CAAC,YAAY,CAAC;AAC5B,YAAA,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAChE;QAAE,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,mCAAA,CAAA,MAAA,CAAmC,GAAG,EAAA,KAAA,CAAI,EAAE,KAAK,CAAC;QAClE;AACF,IAAA,CAAC;AAED,IAAA,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAU;AACzC;;;;"}
|
package/dist/hooks.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Hook para debounce de valores
|
|
7
|
+
* @param value - Valor a debounce
|
|
8
|
+
* @param delay - Delay en milisegundos
|
|
9
|
+
* @returns Valor debounced
|
|
10
|
+
*/
|
|
11
|
+
function useDebounce(value, delay) {
|
|
12
|
+
var _a = react.useState(value), debouncedValue = _a[0], setDebouncedValue = _a[1];
|
|
13
|
+
react.useEffect(function () {
|
|
14
|
+
var handler = setTimeout(function () {
|
|
15
|
+
setDebouncedValue(value);
|
|
16
|
+
}, delay);
|
|
17
|
+
return function () {
|
|
18
|
+
clearTimeout(handler);
|
|
19
|
+
};
|
|
20
|
+
}, [value, delay]);
|
|
21
|
+
return debouncedValue;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Hook personalizado para manejar localStorage
|
|
26
|
+
* @param key - Clave del localStorage
|
|
27
|
+
* @param initialValue - Valor inicial
|
|
28
|
+
* @returns [value, setValue] - Valor actual y función para actualizarlo
|
|
29
|
+
*/
|
|
30
|
+
function useLocalStorage(key, initialValue) {
|
|
31
|
+
// Estado para almacenar nuestro valor
|
|
32
|
+
var _a = react.useState(function () {
|
|
33
|
+
try {
|
|
34
|
+
var item = window.localStorage.getItem(key);
|
|
35
|
+
return item ? JSON.parse(item) : initialValue;
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error("Error reading localStorage key \"".concat(key, "\":"), error);
|
|
39
|
+
return initialValue;
|
|
40
|
+
}
|
|
41
|
+
}), storedValue = _a[0], setStoredValue = _a[1];
|
|
42
|
+
// Función para actualizar el valor
|
|
43
|
+
var setValue = function (value) {
|
|
44
|
+
try {
|
|
45
|
+
var valueToStore = value instanceof Function ? value(storedValue) : value;
|
|
46
|
+
setStoredValue(valueToStore);
|
|
47
|
+
window.localStorage.setItem(key, JSON.stringify(valueToStore));
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
console.error("Error setting localStorage key \"".concat(key, "\":"), error);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return [storedValue, setValue];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
exports.useDebounce = useDebounce;
|
|
57
|
+
exports.useLocalStorage = useLocalStorage;
|
|
58
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sources":["../src/hooks/useDebounce.ts","../src/hooks/useLocalStorage.ts"],"sourcesContent":["import { useState, useEffect } from \"react\";\r\n\r\n/**\r\n * Hook para debounce de valores\r\n * @param value - Valor a debounce\r\n * @param delay - Delay en milisegundos\r\n * @returns Valor debounced\r\n */\r\nexport function useDebounce<T>(value: T, delay: number): T {\r\n const [debouncedValue, setDebouncedValue] = useState<T>(value);\r\n\r\n useEffect(() => {\r\n const handler = setTimeout(() => {\r\n setDebouncedValue(value);\r\n }, delay);\r\n\r\n return () => {\r\n clearTimeout(handler);\r\n };\r\n }, [value, delay]);\r\n\r\n return debouncedValue;\r\n}\r\n","import { useState, useEffect } from \"react\";\r\n\r\n/**\r\n * Hook personalizado para manejar localStorage\r\n * @param key - Clave del localStorage\r\n * @param initialValue - Valor inicial\r\n * @returns [value, setValue] - Valor actual y función para actualizarlo\r\n */\r\nexport function useLocalStorage<T>(key: string, initialValue: T) {\r\n // Estado para almacenar nuestro valor\r\n const [storedValue, setStoredValue] = useState<T>(() => {\r\n try {\r\n const item = window.localStorage.getItem(key);\r\n return item ? JSON.parse(item) : initialValue;\r\n } catch (error) {\r\n console.error(`Error reading localStorage key \"${key}\":`, error);\r\n return initialValue;\r\n }\r\n });\r\n\r\n // Función para actualizar el valor\r\n const setValue = (value: T | ((val: T) => T)) => {\r\n try {\r\n const valueToStore = value instanceof Function ? value(storedValue) : value;\r\n setStoredValue(valueToStore);\r\n window.localStorage.setItem(key, JSON.stringify(valueToStore));\r\n } catch (error) {\r\n console.error(`Error setting localStorage key \"${key}\":`, error);\r\n }\r\n };\r\n\r\n return [storedValue, setValue] as const;\r\n}\r\n"],"names":["useState","useEffect"],"mappings":";;;;AAEA;;;;;AAKG;AACG,SAAU,WAAW,CAAI,KAAQ,EAAE,KAAa,EAAA;IAC9C,IAAA,EAAA,GAAsCA,cAAQ,CAAI,KAAK,CAAC,EAAvD,cAAc,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,iBAAiB,GAAA,EAAA,CAAA,CAAA,CAAsB;AAE9D,IAAAC,eAAS,CAAC,YAAA;QACR,IAAM,OAAO,GAAG,UAAU,CAAC,YAAA;YACzB,iBAAiB,CAAC,KAAK,CAAC;QAC1B,CAAC,EAAE,KAAK,CAAC;QAET,OAAO,YAAA;YACL,YAAY,CAAC,OAAO,CAAC;AACvB,QAAA,CAAC;AACH,IAAA,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAElB,IAAA,OAAO,cAAc;AACvB;;ACpBA;;;;;AAKG;AACG,SAAU,eAAe,CAAI,GAAW,EAAE,YAAe,EAAA;;IAEvD,IAAA,EAAA,GAAgCD,cAAQ,CAAI,YAAA;AAChD,QAAA,IAAI;YACF,IAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC;AAC7C,YAAA,OAAO,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,YAAY;QAC/C;QAAE,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,mCAAA,CAAA,MAAA,CAAmC,GAAG,EAAA,KAAA,CAAI,EAAE,KAAK,CAAC;AAChE,YAAA,OAAO,YAAY;QACrB;AACF,IAAA,CAAC,CAAC,EARK,WAAW,QAAA,EAAE,cAAc,QAQhC;;IAGF,IAAM,QAAQ,GAAG,UAAC,KAA0B,EAAA;AAC1C,QAAA,IAAI;AACF,YAAA,IAAM,YAAY,GAAG,KAAK,YAAY,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,KAAK;YAC3E,cAAc,CAAC,YAAY,CAAC;AAC5B,YAAA,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAChE;QAAE,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,mCAAA,CAAA,MAAA,CAAmC,GAAG,EAAA,KAAA,CAAI,EAAE,KAAK,CAAC;QAClE;AACF,IAAA,CAAC;AAED,IAAA,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAU;AACzC;;;;;"}
|
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */@layer theme, base, components, utilities;@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-white:#fff;--spacing:0.25rem;--text-sm:0.875rem;--text-sm--line-height:1.42857;--text-base:1rem;--text-base--line-height:1.5;--text-2xl:1.5rem;--text-2xl--line-height:1.33333;--text-4xl:2.25rem;--text-4xl--line-height:1.11111;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-md:0.375rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:150ms;--default-transition-timing-function:cubic-bezier(0.4,0,0.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-blue:var(--blue);--color-skyblue:var(--skyblue);--color-skyblue-light:var(--skyblue-light);--color-yellow:var(--yellow);--color-light-skyblue:var(--light-skyblue);--color-gray:var(--gray);--color-gray-light:var(--gray-light);--color-gray-extra-light:var(--gray-extra-light);--color-red:var(--red);--color-dark-gray:var(--dark-gray);--color-green:var(--green);--color-yellow-light:var(--yellow-light)}}@layer base{*,::backdrop,::file-selector-button,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:var(--default-font-feature-settings,normal);-webkit-tap-highlight-color:transparent;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:var(--default-mono-font-feature-settings,normal);font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}::file-selector-button,button,input,optgroup,select,textarea{font-feature-settings:inherit;background-color:transparent;border-radius:0;color:inherit;font:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::-moz-placeholder{opacity:1}::placeholder{opacity:1}@supports (not (-webkit-appearance:-apple-pay-button)) or (contain-intrinsic-size:1px){::-moz-placeholder{color:currentcolor;@supports (color:color-mix(in lab,red,red)){color:color-mix(in oklab,currentcolor 50%,transparent)}}::placeholder{color:currentcolor;@supports (color:color-mix(in lab,red,red)){color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}::file-selector-button,button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{.static{position:static}.container{width:100%;@media (width >= 640px){max-width:640px}@media (width >= 768px){max-width:768px}@media (width >= 1024px){max-width:1024px}@media (width >= 1200px){max-width:1200px}@media (width >= 1280px){max-width:1280px}@media (width >= 1536px){max-width:1536px}@media (width >= 1650px){max-width:1650px}}.mr-2{margin-right:calc(var(--spacing)*2)}.-ml-1{margin-left:calc(var(--spacing)*-1)}.inline-flex{display:inline-flex}.h-4{height:calc(var(--spacing)*4)}.w-4{width:calc(var(--spacing)*4)}.animate-spin{animation:var(--animate-spin)}.cursor-not-allowed{cursor:not-allowed}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-blue{border-color:var(--color-blue)}.bg-blue{background-color:var(--color-blue)}.bg-dark-gray{background-color:var(--color-dark-gray)}.bg-gray{background-color:var(--color-gray)}.bg-gray-extra-light{background-color:var(--color-gray-extra-light)}.bg-gray-light{background-color:var(--color-gray-light)}.bg-green{background-color:var(--color-green)}.bg-light-skyblue{background-color:var(--color-light-skyblue)}.bg-red{background-color:var(--color-red)}.bg-skyblue{background-color:var(--color-skyblue)}.bg-skyblue-light{background-color:var(--color-skyblue-light)}.bg-yellow{background-color:var(--color-yellow)}.bg-yellow-light{background-color:var(--color-yellow-light)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-blue{color:var(--color-blue)}.text-dark-gray{color:var(--color-dark-gray)}.text-gray{color:var(--color-gray)}.text-gray-light{color:var(--color-gray-light)}.text-green{color:var(--color-green)}.text-red{color:var(--color-red)}.text-skyblue{color:var(--color-skyblue)}.text-white{color:var(--color-white)}.text-yellow{color:var(--color-yellow)}.opacity-25{opacity:25%}.opacity-50{opacity:50%}.opacity-75{opacity:75%}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition-colors{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.hover\:bg-dark-gray{&:hover{@media (hover:hover){background-color:var(--color-dark-gray)}}}.hover\:bg-light-skyblue{&:hover{@media (hover:hover){background-color:var(--color-light-skyblue)}}}.hover\:bg-skyblue{&:hover{@media (hover:hover){background-color:var(--color-skyblue)}}}.focus\:ring-2{&:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\:ring-gray-light{&:focus{--tw-ring-color:var(--color-gray-light)}}.focus\:ring-skyblue-light{&:focus{--tw-ring-color:var(--color-skyblue-light)}}.focus\:ring-offset-2{&:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}}.focus\:outline-none{&:focus{--tw-outline-style:none;outline-style:none}}.disabled\:cursor-not-allowed{&:disabled{cursor:not-allowed}}.disabled\:opacity-50{&:disabled{opacity:50%}}}:root{--blue:#003770;--skyblue:#0073cf;--skyblue-light:#69b2e8;--yellow:#ffb81c;--light-skyblue:#aaeff6;--gray:#bcbcbc;--gray-light:#bdbdbd;--gray-extra-light:#f2f2f2;--red:#e3002b;--dark-gray:#4f4f4f;--green:#76bd43;--yellow-light:#fff1d2}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@keyframes spin{to{transform:rotate(1turn)}}@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-border-style:solid;--tw-font-weight:initial;--tw-outline-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Variante del botón
|
|
6
|
+
*/
|
|
7
|
+
variant?: "primary" | "secondary" | "outline" | "ghost";
|
|
8
|
+
/**
|
|
9
|
+
* Tamaño del botón
|
|
10
|
+
*/
|
|
11
|
+
size?: "sm" | "md" | "lg";
|
|
12
|
+
/**
|
|
13
|
+
* Si el botón está en estado de carga
|
|
14
|
+
*/
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Contenido del botón
|
|
18
|
+
*/
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
declare const Button: React.FC<ButtonProps>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Hook para debounce de valores
|
|
25
|
+
* @param value - Valor a debounce
|
|
26
|
+
* @param delay - Delay en milisegundos
|
|
27
|
+
* @returns Valor debounced
|
|
28
|
+
*/
|
|
29
|
+
declare function useDebounce<T>(value: T, delay: number): T;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Hook personalizado para manejar localStorage
|
|
33
|
+
* @param key - Clave del localStorage
|
|
34
|
+
* @param initialValue - Valor inicial
|
|
35
|
+
* @returns [value, setValue] - Valor actual y función para actualizarlo
|
|
36
|
+
*/
|
|
37
|
+
declare function useLocalStorage<T>(key: string, initialValue: T): readonly [T, (value: T | ((val: T) => T)) => void];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Formatea una fecha según el formato especificado
|
|
41
|
+
* @param date - Fecha a formatear
|
|
42
|
+
* @param format - Formato deseado ('short', 'long', 'time')
|
|
43
|
+
* @returns Fecha formateada
|
|
44
|
+
*/
|
|
45
|
+
declare function formatDate(date: Date | string, format?: "short" | "long" | "time"): string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Valida si un email tiene formato válido
|
|
49
|
+
* @param email - Email a validar
|
|
50
|
+
* @returns true si es válido, false si no
|
|
51
|
+
*/
|
|
52
|
+
declare function validateEmail(email: string): boolean;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Cliente API simple para ONPE
|
|
56
|
+
*/
|
|
57
|
+
declare class APIClient {
|
|
58
|
+
private baseURL;
|
|
59
|
+
constructor(baseURL?: string);
|
|
60
|
+
/**
|
|
61
|
+
* Realiza una petición GET
|
|
62
|
+
*/
|
|
63
|
+
get<T>(endpoint: string): Promise<T>;
|
|
64
|
+
/**
|
|
65
|
+
* Realiza una petición POST
|
|
66
|
+
*/
|
|
67
|
+
post<T>(endpoint: string, data: any): Promise<T>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Instancia por defecto del cliente API
|
|
71
|
+
*/
|
|
72
|
+
declare const apiClient: APIClient;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Utilidades para manejo de almacenamiento
|
|
76
|
+
*/
|
|
77
|
+
declare class StorageManager {
|
|
78
|
+
/**
|
|
79
|
+
* Guarda un valor en localStorage
|
|
80
|
+
*/
|
|
81
|
+
static setItem(key: string, value: any): void;
|
|
82
|
+
/**
|
|
83
|
+
* Obtiene un valor de localStorage
|
|
84
|
+
*/
|
|
85
|
+
static getItem<T>(key: string, defaultValue?: T): T | null;
|
|
86
|
+
/**
|
|
87
|
+
* Elimina un valor de localStorage
|
|
88
|
+
*/
|
|
89
|
+
static removeItem(key: string): void;
|
|
90
|
+
/**
|
|
91
|
+
* Limpia todo el localStorage
|
|
92
|
+
*/
|
|
93
|
+
static clear(): void;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export { APIClient, Button, StorageManager, apiClient, formatDate, useDebounce, useLocalStorage, validateEmail };
|
|
97
|
+
export type { ButtonProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAC;AAG7B,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,OAAO,CAAC;AAGtB,OAAO,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */@layer theme, base, components, utilities;@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-white:#fff;--spacing:0.25rem;--text-sm:0.875rem;--text-sm--line-height:1.42857;--text-base:1rem;--text-base--line-height:1.5;--text-2xl:1.5rem;--text-2xl--line-height:1.33333;--text-4xl:2.25rem;--text-4xl--line-height:1.11111;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-md:0.375rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:150ms;--default-transition-timing-function:cubic-bezier(0.4,0,0.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-blue:var(--blue);--color-skyblue:var(--skyblue);--color-skyblue-light:var(--skyblue-light);--color-yellow:var(--yellow);--color-light-skyblue:var(--light-skyblue);--color-gray:var(--gray);--color-gray-light:var(--gray-light);--color-gray-extra-light:var(--gray-extra-light);--color-red:var(--red);--color-dark-gray:var(--dark-gray);--color-green:var(--green);--color-yellow-light:var(--yellow-light)}}@layer base{*,::backdrop,::file-selector-button,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:var(--default-font-feature-settings,normal);-webkit-tap-highlight-color:transparent;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:var(--default-mono-font-feature-settings,normal);font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}::file-selector-button,button,input,optgroup,select,textarea{font-feature-settings:inherit;background-color:transparent;border-radius:0;color:inherit;font:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::-moz-placeholder{opacity:1}::placeholder{opacity:1}@supports (not (-webkit-appearance:-apple-pay-button)) or (contain-intrinsic-size:1px){::-moz-placeholder{color:currentcolor;@supports (color:color-mix(in lab,red,red)){color:color-mix(in oklab,currentcolor 50%,transparent)}}::placeholder{color:currentcolor;@supports (color:color-mix(in lab,red,red)){color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}::file-selector-button,button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{.static{position:static}.container{width:100%;@media (width >= 640px){max-width:640px}@media (width >= 768px){max-width:768px}@media (width >= 1024px){max-width:1024px}@media (width >= 1200px){max-width:1200px}@media (width >= 1280px){max-width:1280px}@media (width >= 1536px){max-width:1536px}@media (width >= 1650px){max-width:1650px}}.mr-2{margin-right:calc(var(--spacing)*2)}.-ml-1{margin-left:calc(var(--spacing)*-1)}.inline-flex{display:inline-flex}.h-4{height:calc(var(--spacing)*4)}.w-4{width:calc(var(--spacing)*4)}.animate-spin{animation:var(--animate-spin)}.cursor-not-allowed{cursor:not-allowed}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-blue{border-color:var(--color-blue)}.bg-blue{background-color:var(--color-blue)}.bg-dark-gray{background-color:var(--color-dark-gray)}.bg-gray{background-color:var(--color-gray)}.bg-gray-extra-light{background-color:var(--color-gray-extra-light)}.bg-gray-light{background-color:var(--color-gray-light)}.bg-green{background-color:var(--color-green)}.bg-light-skyblue{background-color:var(--color-light-skyblue)}.bg-red{background-color:var(--color-red)}.bg-skyblue{background-color:var(--color-skyblue)}.bg-skyblue-light{background-color:var(--color-skyblue-light)}.bg-yellow{background-color:var(--color-yellow)}.bg-yellow-light{background-color:var(--color-yellow-light)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-blue{color:var(--color-blue)}.text-dark-gray{color:var(--color-dark-gray)}.text-gray{color:var(--color-gray)}.text-gray-light{color:var(--color-gray-light)}.text-green{color:var(--color-green)}.text-red{color:var(--color-red)}.text-skyblue{color:var(--color-skyblue)}.text-white{color:var(--color-white)}.text-yellow{color:var(--color-yellow)}.opacity-25{opacity:25%}.opacity-50{opacity:50%}.opacity-75{opacity:75%}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition-colors{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.hover\:bg-dark-gray{&:hover{@media (hover:hover){background-color:var(--color-dark-gray)}}}.hover\:bg-light-skyblue{&:hover{@media (hover:hover){background-color:var(--color-light-skyblue)}}}.hover\:bg-skyblue{&:hover{@media (hover:hover){background-color:var(--color-skyblue)}}}.focus\:ring-2{&:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\:ring-gray-light{&:focus{--tw-ring-color:var(--color-gray-light)}}.focus\:ring-skyblue-light{&:focus{--tw-ring-color:var(--color-skyblue-light)}}.focus\:ring-offset-2{&:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}}.focus\:outline-none{&:focus{--tw-outline-style:none;outline-style:none}}.disabled\:cursor-not-allowed{&:disabled{cursor:not-allowed}}.disabled\:opacity-50{&:disabled{opacity:50%}}}:root{--blue:#003770;--skyblue:#0073cf;--skyblue-light:#69b2e8;--yellow:#ffb81c;--light-skyblue:#aaeff6;--gray:#bcbcbc;--gray-light:#bdbdbd;--gray-extra-light:#f2f2f2;--red:#e3002b;--dark-gray:#4f4f4f;--green:#76bd43;--yellow-light:#fff1d2}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@keyframes spin{to{transform:rotate(1turn)}}@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-border-style:solid;--tw-font-weight:initial;--tw-outline-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
/******************************************************************************
|
|
5
|
+
Copyright (c) Microsoft Corporation.
|
|
6
|
+
|
|
7
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
8
|
+
purpose with or without fee is hereby granted.
|
|
9
|
+
|
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
11
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
12
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
13
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
14
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
15
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
16
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
17
|
+
***************************************************************************** */
|
|
18
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var __assign = function() {
|
|
22
|
+
__assign = Object.assign || function __assign(t) {
|
|
23
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
24
|
+
s = arguments[i];
|
|
25
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
26
|
+
}
|
|
27
|
+
return t;
|
|
28
|
+
};
|
|
29
|
+
return __assign.apply(this, arguments);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
function __rest(s, e) {
|
|
33
|
+
var t = {};
|
|
34
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
35
|
+
t[p] = s[p];
|
|
36
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
37
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
38
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
39
|
+
t[p[i]] = s[p[i]];
|
|
40
|
+
}
|
|
41
|
+
return t;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
45
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
46
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
47
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
48
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
49
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
50
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function __generator(thisArg, body) {
|
|
55
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
56
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
57
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
58
|
+
function step(op) {
|
|
59
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
60
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
61
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
62
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
63
|
+
switch (op[0]) {
|
|
64
|
+
case 0: case 1: t = op; break;
|
|
65
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
66
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
67
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
68
|
+
default:
|
|
69
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
70
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
71
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
72
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
73
|
+
if (t[2]) _.ops.pop();
|
|
74
|
+
_.trys.pop(); continue;
|
|
75
|
+
}
|
|
76
|
+
op = body.call(thisArg, _);
|
|
77
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
78
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
83
|
+
var e = new Error(message);
|
|
84
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
88
|
+
|
|
89
|
+
var Button = function (_a) {
|
|
90
|
+
var _b = _a.variant, variant = _b === void 0 ? "primary" : _b, _c = _a.size, size = _c === void 0 ? "md" : _c, _d = _a.loading, loading = _d === void 0 ? false : _d, children = _a.children, className = _a.className, disabled = _a.disabled, props = __rest(_a, ["variant", "size", "loading", "children", "className", "disabled"]);
|
|
91
|
+
var baseClasses = "inline-flex items-center justify-center font-medium rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed";
|
|
92
|
+
var variantClasses = {
|
|
93
|
+
primary: "bg-blue text-white hover:bg-skyblue focus:ring-skyblue-light",
|
|
94
|
+
secondary: "bg-gray text-white hover:bg-dark-gray focus:ring-gray-light",
|
|
95
|
+
outline: "border border-blue text-blue hover:bg-light-skyblue focus:ring-skyblue-light",
|
|
96
|
+
ghost: "text-blue hover:bg-light-skyblue focus:ring-skyblue-light",
|
|
97
|
+
};
|
|
98
|
+
var sizeClasses = {
|
|
99
|
+
sm: "px-3 py-1.5 text-sm",
|
|
100
|
+
md: "px-4 py-2 text-sm",
|
|
101
|
+
lg: "px-6 py-3 text-base",
|
|
102
|
+
};
|
|
103
|
+
return (jsxs("button", __assign({ className: clsx(baseClasses, variantClasses[variant], sizeClasses[size], className), disabled: disabled || loading }, props, { children: [loading && (jsxs("svg", { className: "animate-spin -ml-1 mr-2 h-4 w-4", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] })), children] })));
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Hook para debounce de valores
|
|
108
|
+
* @param value - Valor a debounce
|
|
109
|
+
* @param delay - Delay en milisegundos
|
|
110
|
+
* @returns Valor debounced
|
|
111
|
+
*/
|
|
112
|
+
function useDebounce(value, delay) {
|
|
113
|
+
var _a = useState(value), debouncedValue = _a[0], setDebouncedValue = _a[1];
|
|
114
|
+
useEffect(function () {
|
|
115
|
+
var handler = setTimeout(function () {
|
|
116
|
+
setDebouncedValue(value);
|
|
117
|
+
}, delay);
|
|
118
|
+
return function () {
|
|
119
|
+
clearTimeout(handler);
|
|
120
|
+
};
|
|
121
|
+
}, [value, delay]);
|
|
122
|
+
return debouncedValue;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Hook personalizado para manejar localStorage
|
|
127
|
+
* @param key - Clave del localStorage
|
|
128
|
+
* @param initialValue - Valor inicial
|
|
129
|
+
* @returns [value, setValue] - Valor actual y función para actualizarlo
|
|
130
|
+
*/
|
|
131
|
+
function useLocalStorage(key, initialValue) {
|
|
132
|
+
// Estado para almacenar nuestro valor
|
|
133
|
+
var _a = useState(function () {
|
|
134
|
+
try {
|
|
135
|
+
var item = window.localStorage.getItem(key);
|
|
136
|
+
return item ? JSON.parse(item) : initialValue;
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
console.error("Error reading localStorage key \"".concat(key, "\":"), error);
|
|
140
|
+
return initialValue;
|
|
141
|
+
}
|
|
142
|
+
}), storedValue = _a[0], setStoredValue = _a[1];
|
|
143
|
+
// Función para actualizar el valor
|
|
144
|
+
var setValue = function (value) {
|
|
145
|
+
try {
|
|
146
|
+
var valueToStore = value instanceof Function ? value(storedValue) : value;
|
|
147
|
+
setStoredValue(valueToStore);
|
|
148
|
+
window.localStorage.setItem(key, JSON.stringify(valueToStore));
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
console.error("Error setting localStorage key \"".concat(key, "\":"), error);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
return [storedValue, setValue];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Formatea una fecha según el formato especificado
|
|
159
|
+
* @param date - Fecha a formatear
|
|
160
|
+
* @param format - Formato deseado ('short', 'long', 'time')
|
|
161
|
+
* @returns Fecha formateada
|
|
162
|
+
*/
|
|
163
|
+
function formatDate(date, format) {
|
|
164
|
+
if (format === void 0) { format = "short"; }
|
|
165
|
+
var dateObj = typeof date === "string" ? new Date(date) : date;
|
|
166
|
+
if (isNaN(dateObj.getTime())) {
|
|
167
|
+
return "Fecha inválida";
|
|
168
|
+
}
|
|
169
|
+
var options = {
|
|
170
|
+
short: {
|
|
171
|
+
year: "numeric",
|
|
172
|
+
month: "2-digit",
|
|
173
|
+
day: "2-digit",
|
|
174
|
+
},
|
|
175
|
+
long: {
|
|
176
|
+
year: "numeric",
|
|
177
|
+
month: "long",
|
|
178
|
+
day: "numeric",
|
|
179
|
+
weekday: "long",
|
|
180
|
+
},
|
|
181
|
+
time: {
|
|
182
|
+
hour: "2-digit",
|
|
183
|
+
minute: "2-digit",
|
|
184
|
+
second: "2-digit",
|
|
185
|
+
},
|
|
186
|
+
}[format];
|
|
187
|
+
return new Intl.DateTimeFormat("es-PE", options).format(dateObj);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Valida si un email tiene formato válido
|
|
192
|
+
* @param email - Email a validar
|
|
193
|
+
* @returns true si es válido, false si no
|
|
194
|
+
*/
|
|
195
|
+
function validateEmail(email) {
|
|
196
|
+
var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
197
|
+
return emailRegex.test(email);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Cliente API simple para ONPE
|
|
202
|
+
*/
|
|
203
|
+
var APIClient = /** @class */ (function () {
|
|
204
|
+
function APIClient(baseURL) {
|
|
205
|
+
if (baseURL === void 0) { baseURL = ""; }
|
|
206
|
+
this.baseURL = baseURL;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Realiza una petición GET
|
|
210
|
+
*/
|
|
211
|
+
APIClient.prototype.get = function (endpoint) {
|
|
212
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
213
|
+
var response;
|
|
214
|
+
return __generator(this, function (_a) {
|
|
215
|
+
switch (_a.label) {
|
|
216
|
+
case 0: return [4 /*yield*/, fetch("".concat(this.baseURL).concat(endpoint))];
|
|
217
|
+
case 1:
|
|
218
|
+
response = _a.sent();
|
|
219
|
+
if (!response.ok) {
|
|
220
|
+
throw new Error("HTTP error! status: ".concat(response.status));
|
|
221
|
+
}
|
|
222
|
+
return [2 /*return*/, response.json()];
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Realiza una petición POST
|
|
229
|
+
*/
|
|
230
|
+
APIClient.prototype.post = function (endpoint, data) {
|
|
231
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
232
|
+
var response;
|
|
233
|
+
return __generator(this, function (_a) {
|
|
234
|
+
switch (_a.label) {
|
|
235
|
+
case 0: return [4 /*yield*/, fetch("".concat(this.baseURL).concat(endpoint), {
|
|
236
|
+
method: "POST",
|
|
237
|
+
headers: {
|
|
238
|
+
"Content-Type": "application/json",
|
|
239
|
+
},
|
|
240
|
+
body: JSON.stringify(data),
|
|
241
|
+
})];
|
|
242
|
+
case 1:
|
|
243
|
+
response = _a.sent();
|
|
244
|
+
if (!response.ok) {
|
|
245
|
+
throw new Error("HTTP error! status: ".concat(response.status));
|
|
246
|
+
}
|
|
247
|
+
return [2 /*return*/, response.json()];
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
});
|
|
251
|
+
};
|
|
252
|
+
return APIClient;
|
|
253
|
+
}());
|
|
254
|
+
/**
|
|
255
|
+
* Instancia por defecto del cliente API
|
|
256
|
+
*/
|
|
257
|
+
var apiClient = new APIClient();
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Utilidades para manejo de almacenamiento
|
|
261
|
+
*/
|
|
262
|
+
var StorageManager = /** @class */ (function () {
|
|
263
|
+
function StorageManager() {
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Guarda un valor en localStorage
|
|
267
|
+
*/
|
|
268
|
+
StorageManager.setItem = function (key, value) {
|
|
269
|
+
try {
|
|
270
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
271
|
+
}
|
|
272
|
+
catch (error) {
|
|
273
|
+
console.error("Error saving to localStorage:", error);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* Obtiene un valor de localStorage
|
|
278
|
+
*/
|
|
279
|
+
StorageManager.getItem = function (key, defaultValue) {
|
|
280
|
+
try {
|
|
281
|
+
var item = localStorage.getItem(key);
|
|
282
|
+
return item ? JSON.parse(item) : defaultValue || null;
|
|
283
|
+
}
|
|
284
|
+
catch (error) {
|
|
285
|
+
console.error("Error reading from localStorage:", error);
|
|
286
|
+
return defaultValue || null;
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
290
|
+
* Elimina un valor de localStorage
|
|
291
|
+
*/
|
|
292
|
+
StorageManager.removeItem = function (key) {
|
|
293
|
+
try {
|
|
294
|
+
localStorage.removeItem(key);
|
|
295
|
+
}
|
|
296
|
+
catch (error) {
|
|
297
|
+
console.error("Error removing from localStorage:", error);
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* Limpia todo el localStorage
|
|
302
|
+
*/
|
|
303
|
+
StorageManager.clear = function () {
|
|
304
|
+
try {
|
|
305
|
+
localStorage.clear();
|
|
306
|
+
}
|
|
307
|
+
catch (error) {
|
|
308
|
+
console.error("Error clearing localStorage:", error);
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
return StorageManager;
|
|
312
|
+
}());
|
|
313
|
+
|
|
314
|
+
export { APIClient, Button, StorageManager, apiClient, formatDate, useDebounce, useLocalStorage, validateEmail };
|
|
315
|
+
//# sourceMappingURL=index.esm.js.map
|