bord-frontend-utils 0.0.1 → 0.0.2
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/index.js +8 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,41 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
'use strict';
|
|
19
2
|
|
|
20
|
-
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
removeAccents: () => removeAccents,
|
|
24
|
-
useDebounce: () => useDebounce
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(index_exports);
|
|
3
|
+
var react = require('react');
|
|
27
4
|
|
|
28
5
|
// src/utils/removeAccents.ts
|
|
29
6
|
var removeAccents = (str) => {
|
|
30
7
|
if (!str) return str;
|
|
31
8
|
return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
32
9
|
};
|
|
33
|
-
|
|
34
|
-
// src/hooks/useDebounce.ts
|
|
35
|
-
var import_react = require("react");
|
|
36
10
|
var useDebounce = (value, delay) => {
|
|
37
|
-
const [debouncedValue, setDebouncedValue] =
|
|
38
|
-
|
|
11
|
+
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
12
|
+
react.useEffect(() => {
|
|
39
13
|
const handler = setTimeout(() => {
|
|
40
14
|
setDebouncedValue(value);
|
|
41
15
|
}, delay);
|
|
@@ -45,9 +19,8 @@ var useDebounce = (value, delay) => {
|
|
|
45
19
|
}, [value, delay]);
|
|
46
20
|
return debouncedValue;
|
|
47
21
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
22
|
+
|
|
23
|
+
exports.removeAccents = removeAccents;
|
|
24
|
+
exports.useDebounce = useDebounce;
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
53
26
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/
|
|
1
|
+
{"version":3,"sources":["../src/utils/removeAccents.ts","../src/hooks/useDebounce.ts"],"names":["useState","useEffect"],"mappings":";;;;;AAMO,IAAM,aAAA,GAAgB,CAAC,GAAA,KAAwB;AACpD,EAAA,IAAI,CAAC,KAAK,OAAO,GAAA;AACjB,EAAA,OAAO,IAAI,SAAA,CAAU,KAAK,CAAA,CAAE,OAAA,CAAQ,oBAAoB,EAAE,CAAA;AAC5D;ACPO,IAAM,WAAA,GAAc,CAAI,KAAA,EAAU,KAAA,KAAqB;AAC5D,EAAA,MAAM,CAAC,cAAA,EAAgB,iBAAiB,CAAA,GAAIA,eAAY,KAAK,CAAA;AAE7D,EAAAC,eAAA,CAAU,MAAM;AACd,IAAA,MAAM,OAAA,GAAU,WAAW,MAAM;AAC/B,MAAA,iBAAA,CAAkB,KAAK,CAAA;AAAA,IACzB,GAAG,KAAK,CAAA;AACR,IAAA,OAAO,MAAM;AACX,MAAA,YAAA,CAAa,OAAO,CAAA;AAAA,IACtB,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,KAAA,EAAO,KAAK,CAAC,CAAA;AAEjB,EAAA,OAAO,cAAA;AACT","file":"index.js","sourcesContent":["/**\n * Elimina los acentos de una cadena de texto\n * Usa normalize NFD para descomponer los caracteres y luego elimina los diacríticos\n * @param {string} str - Cadena de texto con posibles acentos\n * @returns {string} Cadena de texto sin acentos\n */\nexport const removeAccents = (str: string): string => {\n if (!str) return str;\n return str.normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\");\n};\n","import { useState, useEffect } from \"react\";\n\nexport const useDebounce = <T>(value: T, delay: number): T => {\n const [debouncedValue, setDebouncedValue] = useState<T>(value);\n\n useEffect(() => {\n const handler = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n return () => {\n clearTimeout(handler);\n };\n }, [value, delay]);\n\n return debouncedValue;\n};\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
1
3
|
// src/utils/removeAccents.ts
|
|
2
4
|
var removeAccents = (str) => {
|
|
3
5
|
if (!str) return str;
|
|
4
6
|
return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
5
7
|
};
|
|
6
|
-
|
|
7
|
-
// src/hooks/useDebounce.ts
|
|
8
|
-
import { useState, useEffect } from "react";
|
|
9
8
|
var useDebounce = (value, delay) => {
|
|
10
9
|
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
11
10
|
useEffect(() => {
|
|
@@ -18,8 +17,7 @@ var useDebounce = (value, delay) => {
|
|
|
18
17
|
}, [value, delay]);
|
|
19
18
|
return debouncedValue;
|
|
20
19
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
20
|
+
|
|
21
|
+
export { removeAccents, useDebounce };
|
|
22
|
+
//# sourceMappingURL=index.mjs.map
|
|
25
23
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/removeAccents.ts","../src/hooks/useDebounce.ts"],"sourcesContent":["/**\n * Elimina los acentos de una cadena de texto\n * Usa normalize NFD para descomponer los caracteres y luego elimina los diacríticos\n * @param {string} str - Cadena de texto con posibles acentos\n * @returns {string} Cadena de texto sin acentos\n */\nexport const removeAccents = (str: string): string => {\n if (!str) return str;\n return str.normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\");\n};\n","import { useState, useEffect } from \"react\";\n\nexport const useDebounce = <T>(value: T, delay: number): T => {\n const [debouncedValue, setDebouncedValue] = useState<T>(value);\n\n useEffect(() => {\n const handler = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n return () => {\n clearTimeout(handler);\n };\n }, [value, delay]);\n\n return debouncedValue;\n};\n"]
|
|
1
|
+
{"version":3,"sources":["../src/utils/removeAccents.ts","../src/hooks/useDebounce.ts"],"names":[],"mappings":";;;AAMO,IAAM,aAAA,GAAgB,CAAC,GAAA,KAAwB;AACpD,EAAA,IAAI,CAAC,KAAK,OAAO,GAAA;AACjB,EAAA,OAAO,IAAI,SAAA,CAAU,KAAK,CAAA,CAAE,OAAA,CAAQ,oBAAoB,EAAE,CAAA;AAC5D;ACPO,IAAM,WAAA,GAAc,CAAI,KAAA,EAAU,KAAA,KAAqB;AAC5D,EAAA,MAAM,CAAC,cAAA,EAAgB,iBAAiB,CAAA,GAAI,SAAY,KAAK,CAAA;AAE7D,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,OAAA,GAAU,WAAW,MAAM;AAC/B,MAAA,iBAAA,CAAkB,KAAK,CAAA;AAAA,IACzB,GAAG,KAAK,CAAA;AACR,IAAA,OAAO,MAAM;AACX,MAAA,YAAA,CAAa,OAAO,CAAA;AAAA,IACtB,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,KAAA,EAAO,KAAK,CAAC,CAAA;AAEjB,EAAA,OAAO,cAAA;AACT","file":"index.mjs","sourcesContent":["/**\n * Elimina los acentos de una cadena de texto\n * Usa normalize NFD para descomponer los caracteres y luego elimina los diacríticos\n * @param {string} str - Cadena de texto con posibles acentos\n * @returns {string} Cadena de texto sin acentos\n */\nexport const removeAccents = (str: string): string => {\n if (!str) return str;\n return str.normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\");\n};\n","import { useState, useEffect } from \"react\";\n\nexport const useDebounce = <T>(value: T, delay: number): T => {\n const [debouncedValue, setDebouncedValue] = useState<T>(value);\n\n useEffect(() => {\n const handler = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n return () => {\n clearTimeout(handler);\n };\n }, [value, delay]);\n\n return debouncedValue;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bord-frontend-utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Bord frontend utilities: reusable React hooks and helper functions for building scalable web applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
"author": "Bord",
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"engines": {
|
|
26
|
-
"node": ">=18"
|
|
26
|
+
"node": ">=18 <21"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"react": ">=18"
|
|
29
|
+
"react": ">=17 <=18.3.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/react": "^
|
|
32
|
+
"@types/react": "^18",
|
|
33
33
|
"tsup": "^8.5.1",
|
|
34
34
|
"typescript": "^6.0.3"
|
|
35
35
|
}
|