@charlesgomes/leafcode-shared-lib-react 1.0.94 → 1.0.96
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/assets/lotties/RezzutSmartLab.json +1 -0
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +147 -79
- package/dist/index.mjs +115 -48
- package/dist/styles/button.css +14 -2
- package/package.json +6 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"nm":"Main Scene","ddd":0,"h":135,"w":120,"meta":{"g":"@lottiefiles/creator 1.77.0"},"layers":[{"ty":3,"nm":"Group Layer 1","sr":1,"st":0,"op":280,"ip":0,"hd":false,"ddd":0,"bm":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[191.62,81]},"s":{"a":0,"k":[19.285714,19.285714]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[120,135]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}},"ind":1},{"ty":4,"nm":"Shape Layer 5","sr":1,"st":0,"op":280,"ip":0,"hd":false,"ddd":0,"bm":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[60,67.5]},"s":{"a":0,"k":[100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[60,67.5]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}},"shapes":[{"ty":"gr","bm":0,"hd":false,"nm":"Group 20","it":[{"ty":"gr","bm":0,"hd":false,"nm":"Group 9","it":[{"ty":"sh","bm":0,"hd":false,"nm":"Path 30","d":1,"ks":{"a":0,"k":{"c":true,"i":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[100,45],[80,56.25],[60,45],[40,56.25],[20,45],[40,33.75],[60,22.5],[80,33.75],[100,45]]}}},{"ty":"fl","bm":0,"hd":false,"nm":"Fill","c":{"a":0,"k":[0.0471,0.5529,0.9333]},"r":2,"o":{"a":0,"k":100}},{"ty":"tr","a":{"a":0,"k":[60,39.375]},"s":{"a":0,"k":[100,100]},"sk":{"a":0,"k":0},"p":{"a":1,"k":[{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[60,39.375],"t":0},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[60,39.375],"t":50},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[60,16.875],"t":100},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[60,16.875],"t":150},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[60,17.101202],"t":180},{"s":[60,39.375],"t":229.99999999999997}]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}}]},{"ty":"gr","bm":0,"hd":false,"nm":"Group 10","it":[{"ty":"sh","bm":0,"hd":false,"nm":"Path 31","d":1,"ks":{"a":0,"k":{"c":true,"i":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[40,78.75],[60,90],[60,112.5],[60,135],[40,123.75],[40,101.25],[40,78.75]]}}},{"ty":"fl","bm":0,"hd":false,"nm":"Fill","c":{"a":0,"k":[0.7137,0.7255,0.8275]},"r":2,"o":{"a":0,"k":100}},{"ty":"tr","a":{"a":0,"k":[50,106.875]},"s":{"a":0,"k":[100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[50,106.875]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}}]},{"ty":"gr","bm":0,"hd":false,"nm":"Group 11","it":[{"ty":"sh","bm":0,"hd":false,"nm":"Path 32","d":1,"ks":{"a":0,"k":{"c":true,"i":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[20,45],[40,56.25],[40,78.75],[40,101.25],[40,123.75],[20,112.5],[20,90],[20,67.5],[20,45]]}}},{"ty":"fl","bm":0,"hd":false,"nm":"Fill","c":{"a":0,"k":[0.0392,0.4392,0.7412]},"r":2,"o":{"a":0,"k":100}},{"ty":"tr","a":{"a":0,"k":[30,84.375]},"s":{"a":0,"k":[100,100]},"sk":{"a":0,"k":0},"p":{"a":1,"k":[{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[30,84.375],"t":0},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[30,84.375],"t":50},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[30,84.375],"t":70,"ti":[0,0],"to":[0,0]},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[10,73.125],"t":120,"ti":[0,0],"to":[0,0]},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[10,73.351202],"t":180,"ti":[0,0],"to":[0,0]},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[10,73.125],"t":200,"ti":[0,0],"to":[0,0]},{"s":[30,84.375],"t":260}]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}}]},{"ty":"gr","bm":0,"hd":false,"nm":"Group 12","it":[{"ty":"sh","bm":0,"hd":false,"nm":"Path 33","d":1,"ks":{"a":0,"k":{"c":true,"i":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[120,33.75],[100,45],[80,33.75],[60,22.5],[40,33.75],[20,45],[0,33.75],[20,22.5],[40,11.25],[60,0],[80,11.25],[100,22.5],[120,33.75]]}}},{"ty":"fl","bm":0,"hd":false,"nm":"Fill","c":{"a":0,"k":[0.8392,0.8431,0.902]},"r":2,"o":{"a":0,"k":100}},{"ty":"tr","a":{"a":0,"k":[60,22.5]},"s":{"a":0,"k":[100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[60,22.5]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}}]},{"ty":"gr","bm":0,"hd":false,"nm":"Group 13","it":[{"ty":"sh","bm":0,"hd":false,"nm":"Path 34","d":1,"ks":{"a":0,"k":{"c":true,"i":[[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[60,45],[80,56.25],[80,78.75],[60,67.5],[60,45]]}}},{"ty":"fl","bm":0,"hd":false,"nm":"Fill","c":{"a":0,"k":[0.7137,0.7255,0.8275]},"r":2,"o":{"a":0,"k":100}},{"ty":"tr","a":{"a":0,"k":[70,61.875]},"s":{"a":0,"k":[100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[70,61.875]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}}]},{"ty":"gr","bm":0,"hd":false,"nm":"Group 14","it":[{"ty":"sh","bm":0,"hd":false,"nm":"Path 35","d":1,"ks":{"a":0,"k":{"c":true,"i":[[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[60,67.5],[40,78.75],[40,56.25],[60,45],[60,67.5]]}}},{"ty":"fl","bm":0,"hd":false,"nm":"Fill","c":{"a":0,"k":[0.7804,0.7882,0.8667]},"r":2,"o":{"a":0,"k":100}},{"ty":"tr","a":{"a":0,"k":[50,61.875]},"s":{"a":0,"k":[100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[50,61.875]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}}]},{"ty":"gr","bm":0,"hd":false,"nm":"Group 15","it":[{"ty":"sh","bm":0,"hd":false,"nm":"Path 36","d":1,"ks":{"a":0,"k":{"c":true,"i":[[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[60,90],[40,78.75],[60,67.5],[80,78.75],[60,90]]}}},{"ty":"fl","bm":0,"hd":false,"nm":"Fill","c":{"a":0,"k":[0.8392,0.8431,0.902]},"r":2,"o":{"a":0,"k":100}},{"ty":"tr","a":{"a":0,"k":[60,78.75]},"s":{"a":0,"k":[100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[60,78.75]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}}]},{"ty":"gr","bm":0,"hd":false,"nm":"Group 16","it":[{"ty":"sh","bm":0,"hd":false,"nm":"Path 37","d":1,"ks":{"a":0,"k":{"c":true,"i":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[0,33.75],[20,45],[20,67.5],[20,90],[20,112.5],[0,101.25],[0,78.75],[0,56.25],[0,33.75]]}}},{"ty":"fl","bm":0,"hd":false,"nm":"Fill","c":{"a":0,"k":[0.7137,0.7255,0.8275]},"r":2,"o":{"a":0,"k":100}},{"ty":"tr","a":{"a":0,"k":[10,73.125]},"s":{"a":0,"k":[100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[10,73.125]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}}]},{"ty":"gr","bm":0,"hd":false,"nm":"Group 17","it":[{"ty":"sh","bm":0,"hd":false,"nm":"Path 38","d":1,"ks":{"a":0,"k":{"c":true,"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[80,123.75],[60,135],[60,112.5],[80,123.75]]}}},{"ty":"fl","bm":0,"hd":false,"nm":"Fill","c":{"a":0,"k":[0.7804,0.7882,0.8667]},"r":2,"o":{"a":0,"k":100}},{"ty":"tr","a":{"a":0,"k":[70,123.75]},"s":{"a":0,"k":[100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[70,123.75]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}}]},{"ty":"gr","bm":0,"hd":false,"nm":"Group 18","it":[{"ty":"sh","bm":0,"hd":false,"nm":"Path 39","d":1,"ks":{"a":0,"k":{"c":true,"i":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[60,90],[80,78.75],[80,56.25],[100,45],[100,67.5],[100,90],[80,101.25],[100,112.5],[80,123.75],[60,112.5],[60,90]]}}},{"ty":"fl","bm":0,"hd":false,"nm":"Fill","c":{"a":0,"k":[0.0431,0.4902,0.8275]},"r":2,"o":{"a":0,"k":100}},{"ty":"tr","a":{"a":0,"k":[80,84.375]},"s":{"a":0,"k":[100,100]},"sk":{"a":0,"k":0},"p":{"a":1,"k":[{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[80,84.375],"t":0},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[80,84.375],"t":50},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[80,84.375],"t":90,"ti":[0,0],"to":[1.863486,-1.027135]},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[100,73.351202],"t":150,"ti":[0,0],"to":[0,0]},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[100,73.125],"t":200,"ti":[0,0],"to":[0,0]},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[100,73.125],"t":220.00000000000003,"ti":[0,0],"to":[0,0]},{"s":[80,84.375],"t":280}]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}}]},{"ty":"gr","bm":0,"hd":false,"nm":"Group 19","it":[{"ty":"sh","bm":0,"hd":false,"nm":"Path 40","d":1,"ks":{"a":0,"k":{"c":true,"i":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[100,45],[120,33.75],[120,56.25],[120,78.75],[120,101.25],[100,112.5],[80,101.25],[100,90],[100,67.5],[100,45]]}}},{"ty":"fl","bm":0,"hd":false,"nm":"Fill","c":{"a":0,"k":[0.7804,0.7882,0.8667]},"r":2,"o":{"a":0,"k":100}},{"ty":"tr","a":{"a":0,"k":[100,73.125]},"s":{"a":0,"k":[100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[100,73.125]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}}]},{"ty":"tr","a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[0,0]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}}]}],"ind":2}],"v":"5.7.0","fr":100,"op":280,"ip":0,"assets":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -6,6 +6,7 @@ export { DataTableProps } from 'primereact/datatable';
|
|
|
6
6
|
export { ColumnProps } from 'primereact/column';
|
|
7
7
|
export { FilterMatchMode, FilterOperator } from 'primereact/api';
|
|
8
8
|
|
|
9
|
+
type LottieAnimationData = Record<string, unknown>;
|
|
9
10
|
interface ButtonProps {
|
|
10
11
|
disabled?: boolean;
|
|
11
12
|
loading?: boolean;
|
|
@@ -14,8 +15,11 @@ interface ButtonProps {
|
|
|
14
15
|
type?: "button" | "reset" | "submit";
|
|
15
16
|
color?: "danger";
|
|
16
17
|
onClick?: () => void;
|
|
18
|
+
loadingLottieFileName?: string;
|
|
19
|
+
loadingLottieBasePath?: string;
|
|
20
|
+
loadingLottieData?: LottieAnimationData;
|
|
17
21
|
}
|
|
18
|
-
declare function Button({ disabled, loading, color, type, onClick, title, ...rest }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
22
|
+
declare function Button({ disabled, loading, color, type, onClick, title, className, loadingLottieFileName, loadingLottieBasePath, loadingLottieData, ...rest }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
19
23
|
|
|
20
24
|
interface Props$1 {
|
|
21
25
|
id: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { DataTableProps } from 'primereact/datatable';
|
|
|
6
6
|
export { ColumnProps } from 'primereact/column';
|
|
7
7
|
export { FilterMatchMode, FilterOperator } from 'primereact/api';
|
|
8
8
|
|
|
9
|
+
type LottieAnimationData = Record<string, unknown>;
|
|
9
10
|
interface ButtonProps {
|
|
10
11
|
disabled?: boolean;
|
|
11
12
|
loading?: boolean;
|
|
@@ -14,8 +15,11 @@ interface ButtonProps {
|
|
|
14
15
|
type?: "button" | "reset" | "submit";
|
|
15
16
|
color?: "danger";
|
|
16
17
|
onClick?: () => void;
|
|
18
|
+
loadingLottieFileName?: string;
|
|
19
|
+
loadingLottieBasePath?: string;
|
|
20
|
+
loadingLottieData?: LottieAnimationData;
|
|
17
21
|
}
|
|
18
|
-
declare function Button({ disabled, loading, color, type, onClick, title, ...rest }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
22
|
+
declare function Button({ disabled, loading, color, type, onClick, title, className, loadingLottieFileName, loadingLottieBasePath, loadingLottieData, ...rest }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
19
23
|
|
|
20
24
|
interface Props$1 {
|
|
21
25
|
id: string;
|
package/dist/index.js
CHANGED
|
@@ -63,6 +63,10 @@ __export(index_exports, {
|
|
|
63
63
|
});
|
|
64
64
|
module.exports = __toCommonJS(index_exports);
|
|
65
65
|
|
|
66
|
+
// src/components/Button/Button.tsx
|
|
67
|
+
var import_react2 = require("react");
|
|
68
|
+
var import_lottie_react = __toESM(require("lottie-react"));
|
|
69
|
+
|
|
66
70
|
// src/provider/ThemeProvider.tsx
|
|
67
71
|
var import_lodash = __toESM(require("lodash.merge"));
|
|
68
72
|
var import_react = require("react");
|
|
@@ -76,7 +80,7 @@ var defaultTheme = {
|
|
|
76
80
|
secundaryHover: "",
|
|
77
81
|
danger: "#ED202E",
|
|
78
82
|
dangerHover: "#f35353",
|
|
79
|
-
borderDisabledBg: "#
|
|
83
|
+
borderDisabledBg: "#ebebeb",
|
|
80
84
|
text: "#18181B",
|
|
81
85
|
light: "#FFFFFF",
|
|
82
86
|
background: "#FFFFFF",
|
|
@@ -192,6 +196,20 @@ var useLeafcodeTheme = () => (0, import_react.useContext)(ThemeContext);
|
|
|
192
196
|
|
|
193
197
|
// src/components/Button/Button.tsx
|
|
194
198
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
199
|
+
var import_meta = {};
|
|
200
|
+
var DEFAULT_LOTTIE_BASE_PATH = "/lotties";
|
|
201
|
+
function normalizeLottieFileName(fileName) {
|
|
202
|
+
return fileName.endsWith(".json") ? fileName : `${fileName}.json`;
|
|
203
|
+
}
|
|
204
|
+
function resolveLottieFileUrl(basePath, fileName) {
|
|
205
|
+
const normalizedBasePath = basePath.endsWith("/") ? basePath.slice(0, -1) : basePath;
|
|
206
|
+
const normalizedFileName = normalizeLottieFileName(fileName);
|
|
207
|
+
const fullPath = `${normalizedBasePath}/${normalizedFileName}`;
|
|
208
|
+
if (normalizedBasePath.startsWith("./") || normalizedBasePath.startsWith("../")) {
|
|
209
|
+
return new URL(fullPath, import_meta.url).href;
|
|
210
|
+
}
|
|
211
|
+
return fullPath;
|
|
212
|
+
}
|
|
195
213
|
function Button({
|
|
196
214
|
disabled,
|
|
197
215
|
loading,
|
|
@@ -199,9 +217,41 @@ function Button({
|
|
|
199
217
|
type,
|
|
200
218
|
onClick,
|
|
201
219
|
title,
|
|
220
|
+
className,
|
|
221
|
+
loadingLottieFileName,
|
|
222
|
+
loadingLottieBasePath,
|
|
223
|
+
loadingLottieData,
|
|
202
224
|
...rest
|
|
203
225
|
}) {
|
|
204
226
|
const theme = useLeafcodeTheme();
|
|
227
|
+
const [resolvedLottieData, setResolvedLottieData] = (0, import_react2.useState)(loadingLottieData ?? null);
|
|
228
|
+
(0, import_react2.useEffect)(() => {
|
|
229
|
+
if (loadingLottieData) {
|
|
230
|
+
setResolvedLottieData(loadingLottieData);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (!loadingLottieFileName) {
|
|
234
|
+
setResolvedLottieData(null);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
const controller = new AbortController();
|
|
238
|
+
const basePath = loadingLottieBasePath ?? DEFAULT_LOTTIE_BASE_PATH;
|
|
239
|
+
const lottieUrl = resolveLottieFileUrl(basePath, loadingLottieFileName);
|
|
240
|
+
fetch(lottieUrl, { signal: controller.signal }).then((response) => {
|
|
241
|
+
if (!response.ok) {
|
|
242
|
+
throw new Error(`Failed to load lottie file: ${lottieUrl}`);
|
|
243
|
+
}
|
|
244
|
+
return response.json();
|
|
245
|
+
}).then((data) => {
|
|
246
|
+
setResolvedLottieData(data);
|
|
247
|
+
}).catch((error) => {
|
|
248
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
setResolvedLottieData(null);
|
|
252
|
+
});
|
|
253
|
+
return () => controller.abort();
|
|
254
|
+
}, [loadingLottieData, loadingLottieFileName, loadingLottieBasePath]);
|
|
205
255
|
const styleVars = {
|
|
206
256
|
"--button-font-family": theme.components.button.fonts.family,
|
|
207
257
|
"--button-font-weight": theme.components.button.fonts.weight,
|
|
@@ -217,16 +267,29 @@ function Button({
|
|
|
217
267
|
"--button-min-width": theme.components.button.sizes.minWidth,
|
|
218
268
|
"--button-border-radius": theme.components.button.sizes.radius
|
|
219
269
|
};
|
|
270
|
+
const resolvedClassName = [
|
|
271
|
+
"box-button",
|
|
272
|
+
disabled || loading ? "button-disabled" : color === "danger" ? "button-secundary" : "button-primary",
|
|
273
|
+
className
|
|
274
|
+
].filter(Boolean).join(" ");
|
|
220
275
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
221
276
|
"button",
|
|
222
277
|
{
|
|
223
278
|
type,
|
|
224
279
|
style: styleVars,
|
|
225
|
-
className:
|
|
280
|
+
className: resolvedClassName,
|
|
226
281
|
onClick: !loading ? onClick : void 0,
|
|
227
282
|
disabled: disabled || loading,
|
|
228
283
|
...rest,
|
|
229
|
-
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "box-loading", children: /* @__PURE__ */ (0, import_jsx_runtime2.
|
|
284
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "box-loading", children: resolvedLottieData ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
285
|
+
import_lottie_react.default,
|
|
286
|
+
{
|
|
287
|
+
animationData: resolvedLottieData,
|
|
288
|
+
autoplay: true,
|
|
289
|
+
loop: true,
|
|
290
|
+
className: "button-lottie-loading"
|
|
291
|
+
}
|
|
292
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
230
293
|
"svg",
|
|
231
294
|
{
|
|
232
295
|
className: "animate-spin",
|
|
@@ -282,11 +345,11 @@ function TooltipCustom({ label, id }) {
|
|
|
282
345
|
}
|
|
283
346
|
|
|
284
347
|
// src/components/Input/Input.tsx
|
|
285
|
-
var
|
|
348
|
+
var import_react5 = require("react");
|
|
286
349
|
|
|
287
350
|
// src/components/Tooltips/TooltipErrorInput.tsx
|
|
288
|
-
var
|
|
289
|
-
var
|
|
351
|
+
var import_react3 = require("@phosphor-icons/react");
|
|
352
|
+
var import_react4 = require("react");
|
|
290
353
|
var import_react_tooltip2 = require("react-tooltip");
|
|
291
354
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
292
355
|
function TooltipErrorInput({
|
|
@@ -307,9 +370,9 @@ function TooltipErrorInput({
|
|
|
307
370
|
"--input-error-border": theme.colors.danger,
|
|
308
371
|
"--input-font-size-tooltip": theme.components.tooltip.fonts.TooltipSize
|
|
309
372
|
};
|
|
310
|
-
const [isTooltipOpen, setIsTooltipOpen] = (0,
|
|
373
|
+
const [isTooltipOpen, setIsTooltipOpen] = (0, import_react4.useState)(true);
|
|
311
374
|
const handleClose = () => setIsTooltipOpen(false);
|
|
312
|
-
(0,
|
|
375
|
+
(0, import_react4.useEffect)(() => {
|
|
313
376
|
setIsTooltipOpen(true);
|
|
314
377
|
}, [error]);
|
|
315
378
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -325,7 +388,7 @@ function TooltipErrorInput({
|
|
|
325
388
|
"data-tooltip-content": "",
|
|
326
389
|
"data-tooltip-place": "top-end",
|
|
327
390
|
onClick: () => setIsTooltipOpen(true),
|
|
328
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
391
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react3.WarningCircle, { size: 22, className: "tooltip-icon" })
|
|
329
392
|
}
|
|
330
393
|
),
|
|
331
394
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -356,7 +419,7 @@ function TooltipErrorInput({
|
|
|
356
419
|
background: "transparent",
|
|
357
420
|
cursor: "pointer"
|
|
358
421
|
},
|
|
359
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
422
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react3.X, { size: 16, weight: "bold" })
|
|
360
423
|
}
|
|
361
424
|
)
|
|
362
425
|
] })
|
|
@@ -368,7 +431,7 @@ function TooltipErrorInput({
|
|
|
368
431
|
}
|
|
369
432
|
|
|
370
433
|
// src/components/Input/Input.tsx
|
|
371
|
-
var
|
|
434
|
+
var import_react6 = require("@phosphor-icons/react");
|
|
372
435
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
373
436
|
var InputBase = ({
|
|
374
437
|
name,
|
|
@@ -422,7 +485,7 @@ var InputBase = ({
|
|
|
422
485
|
e.target.value = val;
|
|
423
486
|
onChange?.(e);
|
|
424
487
|
};
|
|
425
|
-
const [show, setShow] = (0,
|
|
488
|
+
const [show, setShow] = (0, import_react5.useState)(false);
|
|
426
489
|
const isPassword = showPasswordToggle;
|
|
427
490
|
const handleClick = () => setShow(!show);
|
|
428
491
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
@@ -462,7 +525,7 @@ var InputBase = ({
|
|
|
462
525
|
{
|
|
463
526
|
onClick: () => handleClick(),
|
|
464
527
|
className: `password-toggle ${error ? "error" : "no-error"}`,
|
|
465
|
-
children: show ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
528
|
+
children: show ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react6.Eye, { size: 21 }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react6.EyeSlash, { size: 21 })
|
|
466
529
|
}
|
|
467
530
|
)
|
|
468
531
|
] }),
|
|
@@ -471,10 +534,10 @@ var InputBase = ({
|
|
|
471
534
|
}
|
|
472
535
|
);
|
|
473
536
|
};
|
|
474
|
-
var Input = (0,
|
|
537
|
+
var Input = (0, import_react5.forwardRef)(InputBase);
|
|
475
538
|
|
|
476
539
|
// src/components/Input/TextArea.tsx
|
|
477
|
-
var
|
|
540
|
+
var import_react7 = require("react");
|
|
478
541
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
479
542
|
var TextAreaBase = ({
|
|
480
543
|
name,
|
|
@@ -546,12 +609,12 @@ var TextAreaBase = ({
|
|
|
546
609
|
}
|
|
547
610
|
);
|
|
548
611
|
};
|
|
549
|
-
var TextArea = (0,
|
|
612
|
+
var TextArea = (0, import_react7.forwardRef)(
|
|
550
613
|
TextAreaBase
|
|
551
614
|
);
|
|
552
615
|
|
|
553
616
|
// src/components/Input/InputSelect.tsx
|
|
554
|
-
var
|
|
617
|
+
var import_react8 = require("react");
|
|
555
618
|
var import_react_hook_form = require("react-hook-form");
|
|
556
619
|
var import_react_select = __toESM(require("react-select"));
|
|
557
620
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
@@ -597,10 +660,10 @@ var InputBase2 = ({
|
|
|
597
660
|
"--input-height": theme.components.input.sizes.height,
|
|
598
661
|
"--input-border-radius": theme.components.input.sizes.radius
|
|
599
662
|
};
|
|
600
|
-
const [menuPortalTarget, setMenuPortalTarget] = (0,
|
|
663
|
+
const [menuPortalTarget, setMenuPortalTarget] = (0, import_react8.useState)(
|
|
601
664
|
null
|
|
602
665
|
);
|
|
603
|
-
(0,
|
|
666
|
+
(0, import_react8.useEffect)(() => {
|
|
604
667
|
setMenuPortalTarget(document.body);
|
|
605
668
|
}, []);
|
|
606
669
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "input-wrapper", style: styleVars, children: [
|
|
@@ -674,10 +737,10 @@ var InputBase2 = ({
|
|
|
674
737
|
)
|
|
675
738
|
] });
|
|
676
739
|
};
|
|
677
|
-
var InputSelect = (0,
|
|
740
|
+
var InputSelect = (0, import_react8.forwardRef)(InputBase2);
|
|
678
741
|
|
|
679
742
|
// src/components/ModalBase/ModalBase.tsx
|
|
680
|
-
var
|
|
743
|
+
var import_react9 = require("@phosphor-icons/react");
|
|
681
744
|
|
|
682
745
|
// src/components/ModalBase/FooterButtons.tsx
|
|
683
746
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
@@ -686,7 +749,7 @@ function FooterButtons({ children }) {
|
|
|
686
749
|
}
|
|
687
750
|
|
|
688
751
|
// src/components/ModalBase/ModalBase.tsx
|
|
689
|
-
var
|
|
752
|
+
var import_react10 = require("react");
|
|
690
753
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
691
754
|
function ModalBase({
|
|
692
755
|
show,
|
|
@@ -716,7 +779,7 @@ function ModalBase({
|
|
|
716
779
|
// Sizes
|
|
717
780
|
"--modal-max-width": theme.components.modalBase.sizes.modalMaxWidth
|
|
718
781
|
};
|
|
719
|
-
(0,
|
|
782
|
+
(0, import_react10.useEffect)(() => {
|
|
720
783
|
const handleKeyDown = (event) => {
|
|
721
784
|
if (event.key === "Escape") {
|
|
722
785
|
onHide();
|
|
@@ -731,7 +794,7 @@ function ModalBase({
|
|
|
731
794
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "modal-overlay", style: styleVars, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "modal-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "modal-content", children: [
|
|
732
795
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "modal-header", children: [
|
|
733
796
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: "modal-title", children: title }),
|
|
734
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { className: "modal-close", type: "button", onClick: onHide, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
797
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { className: "modal-close", type: "button", onClick: onHide, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react9.X, { size: 18, className: "button-close" }) })
|
|
735
798
|
] }),
|
|
736
799
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "modal-body", children }),
|
|
737
800
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(FooterButtons, { children: [
|
|
@@ -761,15 +824,15 @@ function ModalBase({
|
|
|
761
824
|
}
|
|
762
825
|
|
|
763
826
|
// src/components/Input/InputAutocomplete.tsx
|
|
764
|
-
var
|
|
827
|
+
var import_react12 = require("@phosphor-icons/react");
|
|
765
828
|
var import_lodash2 = __toESM(require("lodash"));
|
|
766
|
-
var
|
|
829
|
+
var import_react13 = require("react");
|
|
767
830
|
var import_react_query = require("@tanstack/react-query");
|
|
768
831
|
|
|
769
832
|
// src/components/Loading/Loading.tsx
|
|
770
|
-
var
|
|
833
|
+
var import_react11 = require("react");
|
|
771
834
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
772
|
-
var LoadingSpinner = (0,
|
|
835
|
+
var LoadingSpinner = (0, import_react11.memo)(({ size = 20 }) => {
|
|
773
836
|
const theme = useLeafcodeTheme();
|
|
774
837
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
775
838
|
"span",
|
|
@@ -811,8 +874,8 @@ function AutoCompleteInner(props, ref) {
|
|
|
811
874
|
...inputProps
|
|
812
875
|
} = props;
|
|
813
876
|
const theme = useLeafcodeTheme();
|
|
814
|
-
const inputRef = (0,
|
|
815
|
-
const [placement, setPlacement] = (0,
|
|
877
|
+
const inputRef = (0, import_react13.useRef)(null);
|
|
878
|
+
const [placement, setPlacement] = (0, import_react13.useState)("bottom");
|
|
816
879
|
const styleVars = {
|
|
817
880
|
// Fonts
|
|
818
881
|
"--label-font-family": theme.components.input.fonts.label,
|
|
@@ -832,11 +895,11 @@ function AutoCompleteInner(props, ref) {
|
|
|
832
895
|
"--input-height": theme.components.input.sizes.height,
|
|
833
896
|
"--input-border-radius": theme.components.input.sizes.radius
|
|
834
897
|
};
|
|
835
|
-
const [items, setItems] = (0,
|
|
836
|
-
const [pageNumber, setPageNumber] = (0,
|
|
837
|
-
const [search, setSearch] = (0,
|
|
838
|
-
const [isOpen, setIsOpen] = (0,
|
|
839
|
-
const listRef = (0,
|
|
898
|
+
const [items, setItems] = (0, import_react13.useState)([]);
|
|
899
|
+
const [pageNumber, setPageNumber] = (0, import_react13.useState)(1);
|
|
900
|
+
const [search, setSearch] = (0, import_react13.useState)("");
|
|
901
|
+
const [isOpen, setIsOpen] = (0, import_react13.useState)(false);
|
|
902
|
+
const listRef = (0, import_react13.useRef)(null);
|
|
840
903
|
const calculatePlacement = () => {
|
|
841
904
|
const input = inputRef.current;
|
|
842
905
|
if (!input) return;
|
|
@@ -850,7 +913,7 @@ function AutoCompleteInner(props, ref) {
|
|
|
850
913
|
setPlacement("bottom");
|
|
851
914
|
}
|
|
852
915
|
};
|
|
853
|
-
(0,
|
|
916
|
+
(0, import_react13.useEffect)(() => {
|
|
854
917
|
if (!isOpen) return;
|
|
855
918
|
calculatePlacement();
|
|
856
919
|
window.addEventListener("resize", calculatePlacement);
|
|
@@ -883,13 +946,13 @@ function AutoCompleteInner(props, ref) {
|
|
|
883
946
|
enabled: isOpen
|
|
884
947
|
});
|
|
885
948
|
const { data, isLoading } = query;
|
|
886
|
-
(0,
|
|
949
|
+
(0, import_react13.useEffect)(() => {
|
|
887
950
|
if (!data) return;
|
|
888
951
|
setItems(
|
|
889
952
|
(prev) => pageNumber === 1 ? data.items : [...prev, ...data.items]
|
|
890
953
|
);
|
|
891
954
|
}, [data, pageNumber]);
|
|
892
|
-
(0,
|
|
955
|
+
(0, import_react13.useEffect)(() => {
|
|
893
956
|
const debounced = import_lodash2.default.debounce(() => {
|
|
894
957
|
setPageNumber(1);
|
|
895
958
|
setSearch(value ?? "");
|
|
@@ -964,7 +1027,7 @@ function AutoCompleteInner(props, ref) {
|
|
|
964
1027
|
onChange?.("");
|
|
965
1028
|
onSelect(null);
|
|
966
1029
|
},
|
|
967
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1030
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react12.X, { size: 16, color: "#bf1717" })
|
|
968
1031
|
}
|
|
969
1032
|
),
|
|
970
1033
|
isOpen && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `dropdown-container dropdown-${placement}`, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("ul", { ref: listRef, onScroll: handleScroll, className: "dropdown-list", children: [
|
|
@@ -986,13 +1049,13 @@ function AutoCompleteInner(props, ref) {
|
|
|
986
1049
|
}
|
|
987
1050
|
);
|
|
988
1051
|
}
|
|
989
|
-
var InputAutoComplete = (0,
|
|
1052
|
+
var InputAutoComplete = (0, import_react13.forwardRef)(AutoCompleteInner);
|
|
990
1053
|
|
|
991
1054
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilter.tsx
|
|
992
|
-
var
|
|
1055
|
+
var import_react20 = require("react");
|
|
993
1056
|
|
|
994
1057
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
|
|
995
|
-
var
|
|
1058
|
+
var import_react18 = require("react");
|
|
996
1059
|
var import_react_query2 = require("@tanstack/react-query");
|
|
997
1060
|
|
|
998
1061
|
// src/primereact-compat.ts
|
|
@@ -1004,7 +1067,7 @@ var import_calendar = require("primereact/calendar");
|
|
|
1004
1067
|
var import_api = require("primereact/api");
|
|
1005
1068
|
|
|
1006
1069
|
// src/components/DataTableAdvancedFilter/TableHeader.tsx
|
|
1007
|
-
var
|
|
1070
|
+
var import_react14 = require("@phosphor-icons/react");
|
|
1008
1071
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1009
1072
|
var TableHeader = ({
|
|
1010
1073
|
globalFilterValue,
|
|
@@ -1026,16 +1089,16 @@ var TableHeader = ({
|
|
|
1026
1089
|
className: "custom-input input-search"
|
|
1027
1090
|
}
|
|
1028
1091
|
),
|
|
1029
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1092
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react14.X, { size: 16, className: "close-search", onClick: limparCampo })
|
|
1030
1093
|
] });
|
|
1031
1094
|
};
|
|
1032
1095
|
var TableHeader_default = TableHeader;
|
|
1033
1096
|
|
|
1034
1097
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
|
|
1035
|
-
var
|
|
1098
|
+
var import_react19 = require("@phosphor-icons/react");
|
|
1036
1099
|
|
|
1037
1100
|
// src/components/DataTableAdvancedFilter/TableActions.tsx
|
|
1038
|
-
var
|
|
1101
|
+
var import_react15 = require("@phosphor-icons/react");
|
|
1039
1102
|
|
|
1040
1103
|
// src/utils/utils.ts
|
|
1041
1104
|
var import_clsx = require("clsx");
|
|
@@ -1079,7 +1142,7 @@ function TableActions({
|
|
|
1079
1142
|
enableButtonsNotMultiplesSelecteds && "disable-button-table-actions"
|
|
1080
1143
|
),
|
|
1081
1144
|
disabled: enableButtonsNotMultiplesSelecteds,
|
|
1082
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1145
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react15.Plus, { size: 18 })
|
|
1083
1146
|
}
|
|
1084
1147
|
),
|
|
1085
1148
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
@@ -1102,7 +1165,7 @@ function TableActions({
|
|
|
1102
1165
|
),
|
|
1103
1166
|
disabled: disableButtonsNotMultiplesSelecteds,
|
|
1104
1167
|
children: [
|
|
1105
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1168
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react15.PencilSimple, { size: 18 }),
|
|
1106
1169
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1107
1170
|
TooltipCustom,
|
|
1108
1171
|
{
|
|
@@ -1125,7 +1188,7 @@ function TableActions({
|
|
|
1125
1188
|
),
|
|
1126
1189
|
disabled: !enableButtonsNotMultiplesSelecteds,
|
|
1127
1190
|
children: [
|
|
1128
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1191
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react15.Trash, { size: 18 }),
|
|
1129
1192
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1130
1193
|
TooltipCustom,
|
|
1131
1194
|
{
|
|
@@ -1157,7 +1220,7 @@ function TableActions({
|
|
|
1157
1220
|
}
|
|
1158
1221
|
|
|
1159
1222
|
// src/components/DataTableAdvancedFilter/ActionsColumn.tsx
|
|
1160
|
-
var
|
|
1223
|
+
var import_react16 = require("@phosphor-icons/react");
|
|
1161
1224
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1162
1225
|
function ActionsColumn({
|
|
1163
1226
|
row,
|
|
@@ -1175,10 +1238,11 @@ function ActionsColumn({
|
|
|
1175
1238
|
type: "button",
|
|
1176
1239
|
className: "btn-icone-actions-column",
|
|
1177
1240
|
onClick: (e) => {
|
|
1241
|
+
e.stopPropagation();
|
|
1178
1242
|
onEdit && onEdit([row]);
|
|
1179
1243
|
},
|
|
1180
1244
|
children: [
|
|
1181
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1245
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react16.PencilSimple, { size: 17, weight: "regular" }),
|
|
1182
1246
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1183
1247
|
TooltipCustom,
|
|
1184
1248
|
{
|
|
@@ -1196,10 +1260,11 @@ function ActionsColumn({
|
|
|
1196
1260
|
type: "button",
|
|
1197
1261
|
className: "btn-icone-actions-column",
|
|
1198
1262
|
onClick: (e) => {
|
|
1263
|
+
e.stopPropagation();
|
|
1199
1264
|
onDelete && onDelete([row]);
|
|
1200
1265
|
},
|
|
1201
1266
|
children: [
|
|
1202
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1267
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react16.Trash, { size: 17, weight: "regular" }),
|
|
1203
1268
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1204
1269
|
TooltipCustom,
|
|
1205
1270
|
{
|
|
@@ -1217,7 +1282,10 @@ function ActionsColumn({
|
|
|
1217
1282
|
{
|
|
1218
1283
|
id,
|
|
1219
1284
|
type: "button",
|
|
1220
|
-
onClick: () =>
|
|
1285
|
+
onClick: (e) => {
|
|
1286
|
+
e.stopPropagation();
|
|
1287
|
+
action.onClick([row]);
|
|
1288
|
+
},
|
|
1221
1289
|
className: cn("btn-icone-actions-column", action.className),
|
|
1222
1290
|
children: [
|
|
1223
1291
|
action.icon,
|
|
@@ -1313,10 +1381,10 @@ function DynamicColumns({
|
|
|
1313
1381
|
}
|
|
1314
1382
|
|
|
1315
1383
|
// src/hooks/use-debounce.ts
|
|
1316
|
-
var
|
|
1384
|
+
var import_react17 = require("react");
|
|
1317
1385
|
var useDebounce = (value, delay) => {
|
|
1318
|
-
const [debouncedValue, setDebouncedValue] = (0,
|
|
1319
|
-
(0,
|
|
1386
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react17.useState)(value);
|
|
1387
|
+
(0, import_react17.useEffect)(() => {
|
|
1320
1388
|
const timer = setTimeout(() => {
|
|
1321
1389
|
setDebouncedValue(value);
|
|
1322
1390
|
}, delay || 500);
|
|
@@ -1348,8 +1416,8 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1348
1416
|
state,
|
|
1349
1417
|
onStateChange
|
|
1350
1418
|
}) {
|
|
1351
|
-
const [isClient, setIsClient] = (0,
|
|
1352
|
-
(0,
|
|
1419
|
+
const [isClient, setIsClient] = (0, import_react18.useState)(false);
|
|
1420
|
+
(0, import_react18.useEffect)(() => {
|
|
1353
1421
|
setIsClient(true);
|
|
1354
1422
|
}, []);
|
|
1355
1423
|
const initialState = state ?? {
|
|
@@ -1359,30 +1427,30 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1359
1427
|
sortOrder: sortOrderInitial,
|
|
1360
1428
|
filter: ""
|
|
1361
1429
|
};
|
|
1362
|
-
const [page, setPage] = (0,
|
|
1363
|
-
const [rows, setRows] = (0,
|
|
1364
|
-
const [first, setFirst] = (0,
|
|
1430
|
+
const [page, setPage] = (0, import_react18.useState)(initialState.page);
|
|
1431
|
+
const [rows, setRows] = (0, import_react18.useState)(initialState.rows);
|
|
1432
|
+
const [first, setFirst] = (0, import_react18.useState)(
|
|
1365
1433
|
(initialState.page - 1) * initialState.rows
|
|
1366
1434
|
);
|
|
1367
|
-
const [sortField, setSortField] = (0,
|
|
1368
|
-
const [sortOrder, setSortOrder] = (0,
|
|
1435
|
+
const [sortField, setSortField] = (0, import_react18.useState)(initialState.sortField);
|
|
1436
|
+
const [sortOrder, setSortOrder] = (0, import_react18.useState)(
|
|
1369
1437
|
initialState.sortOrder ?? 1
|
|
1370
1438
|
);
|
|
1371
|
-
const [searchText, setSearchText] = (0,
|
|
1372
|
-
const [filters, setFilters] = (0,
|
|
1439
|
+
const [searchText, setSearchText] = (0, import_react18.useState)(initialState.filter ?? "");
|
|
1440
|
+
const [filters, setFilters] = (0, import_react18.useState)({
|
|
1373
1441
|
...initFilters,
|
|
1374
1442
|
global: { value: initialState.filter, matchMode: "contains" }
|
|
1375
1443
|
});
|
|
1376
|
-
const [selectedRowsData, setSelectedRowsData] = (0,
|
|
1444
|
+
const [selectedRowsData, setSelectedRowsData] = (0, import_react18.useState)([]);
|
|
1377
1445
|
const debouncedSearch = useDebounce(searchText, 500);
|
|
1378
|
-
const debouncedFilters = (0,
|
|
1446
|
+
const debouncedFilters = (0, import_react18.useMemo)(() => {
|
|
1379
1447
|
const f = { ...filters };
|
|
1380
1448
|
if (!f.global) f.global = { value: "", matchMode: "contains" };
|
|
1381
1449
|
f.global.value = debouncedSearch;
|
|
1382
1450
|
return f;
|
|
1383
1451
|
}, [filters, debouncedSearch]);
|
|
1384
1452
|
const filtersKey = JSON.stringify(debouncedFilters);
|
|
1385
|
-
const globalFilterFields = (0,
|
|
1453
|
+
const globalFilterFields = (0, import_react18.useMemo)(() => {
|
|
1386
1454
|
return columns?.filter(
|
|
1387
1455
|
(col) => col.filterGlobal === true && (col.field !== "acoes" || col.field !== "actions")
|
|
1388
1456
|
).map((col) => col.field) ?? [];
|
|
@@ -1398,7 +1466,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1398
1466
|
globalFilterFields
|
|
1399
1467
|
)
|
|
1400
1468
|
});
|
|
1401
|
-
(0,
|
|
1469
|
+
(0, import_react18.useEffect)(() => {
|
|
1402
1470
|
if (!state) return;
|
|
1403
1471
|
setPage(state.page);
|
|
1404
1472
|
setRows(state.rows);
|
|
@@ -1454,7 +1522,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1454
1522
|
filter: searchText
|
|
1455
1523
|
});
|
|
1456
1524
|
};
|
|
1457
|
-
(0,
|
|
1525
|
+
(0, import_react18.useEffect)(() => {
|
|
1458
1526
|
emitStateChange({
|
|
1459
1527
|
page,
|
|
1460
1528
|
rows,
|
|
@@ -1463,7 +1531,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1463
1531
|
filter: debouncedSearch
|
|
1464
1532
|
});
|
|
1465
1533
|
}, [debouncedSearch]);
|
|
1466
|
-
(0,
|
|
1534
|
+
(0, import_react18.useEffect)(() => {
|
|
1467
1535
|
if (customers?.items && selectedRowsData.length > 0) {
|
|
1468
1536
|
const currentIds = new Set(customers.items.map((item) => item.id));
|
|
1469
1537
|
const filteredSelection = selectedRowsData.filter(
|
|
@@ -1474,7 +1542,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1474
1542
|
}
|
|
1475
1543
|
}
|
|
1476
1544
|
}, [customers?.items, selectedRowsData]);
|
|
1477
|
-
const TableHeaderAndTableActions = (0,
|
|
1545
|
+
const TableHeaderAndTableActions = (0, import_react18.useMemo)(
|
|
1478
1546
|
() => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
1479
1547
|
globalFilterFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1480
1548
|
TableHeader_default,
|
|
@@ -1535,7 +1603,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1535
1603
|
"--p-datepicker-prev-next": theme.colors.primary,
|
|
1536
1604
|
"--p-datepicker-button": theme.colors.primary
|
|
1537
1605
|
};
|
|
1538
|
-
(0,
|
|
1606
|
+
(0, import_react18.useEffect)(() => {
|
|
1539
1607
|
const root = document.documentElement;
|
|
1540
1608
|
root.style.setProperty(
|
|
1541
1609
|
"--p-column-filter-add-button-color",
|
|
@@ -1604,7 +1672,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1604
1672
|
onClick: options.onClick,
|
|
1605
1673
|
disabled: options.disabled,
|
|
1606
1674
|
className: `PrevPage ${options.disabled ? "PrevPageDisabled" : "PrevPageEnabled"}`,
|
|
1607
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1675
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react19.CaretLeft, { size: 18, color: "#fff" })
|
|
1608
1676
|
}
|
|
1609
1677
|
),
|
|
1610
1678
|
CurrentPageReport: (options) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "pageReport", children: [
|
|
@@ -1627,7 +1695,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1627
1695
|
onClick: options.onClick,
|
|
1628
1696
|
disabled: options.disabled,
|
|
1629
1697
|
className: `NextPage ${options.disabled ? "NextPageDisabled" : "NextPageEnabled"}`,
|
|
1630
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1698
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react19.CaretRight, { size: 18, color: "#fff" })
|
|
1631
1699
|
}
|
|
1632
1700
|
)
|
|
1633
1701
|
},
|
|
@@ -1853,14 +1921,14 @@ function DataTableAdvancedFilter({
|
|
|
1853
1921
|
state,
|
|
1854
1922
|
onStateChange
|
|
1855
1923
|
}) {
|
|
1856
|
-
const [isClient, setIsClient] = (0,
|
|
1857
|
-
(0,
|
|
1924
|
+
const [isClient, setIsClient] = (0, import_react20.useState)(false);
|
|
1925
|
+
(0, import_react20.useEffect)(() => {
|
|
1858
1926
|
(0, import_api2.addLocale)("pt", localePtBr);
|
|
1859
1927
|
}, []);
|
|
1860
|
-
(0,
|
|
1928
|
+
(0, import_react20.useEffect)(() => {
|
|
1861
1929
|
(0, import_api2.locale)(isLanguagePtBr ? "pt" : "en");
|
|
1862
1930
|
}, [isLanguagePtBr]);
|
|
1863
|
-
(0,
|
|
1931
|
+
(0, import_react20.useEffect)(() => {
|
|
1864
1932
|
setIsClient(true);
|
|
1865
1933
|
}, []);
|
|
1866
1934
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, { children: isClient && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// src/components/Button/Button.tsx
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import Lottie from "lottie-react";
|
|
4
|
+
|
|
1
5
|
// src/provider/ThemeProvider.tsx
|
|
2
6
|
import merge from "lodash.merge";
|
|
3
7
|
import { createContext, useContext } from "react";
|
|
@@ -11,7 +15,7 @@ var defaultTheme = {
|
|
|
11
15
|
secundaryHover: "",
|
|
12
16
|
danger: "#ED202E",
|
|
13
17
|
dangerHover: "#f35353",
|
|
14
|
-
borderDisabledBg: "#
|
|
18
|
+
borderDisabledBg: "#ebebeb",
|
|
15
19
|
text: "#18181B",
|
|
16
20
|
light: "#FFFFFF",
|
|
17
21
|
background: "#FFFFFF",
|
|
@@ -127,6 +131,19 @@ var useLeafcodeTheme = () => useContext(ThemeContext);
|
|
|
127
131
|
|
|
128
132
|
// src/components/Button/Button.tsx
|
|
129
133
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
134
|
+
var DEFAULT_LOTTIE_BASE_PATH = "/lotties";
|
|
135
|
+
function normalizeLottieFileName(fileName) {
|
|
136
|
+
return fileName.endsWith(".json") ? fileName : `${fileName}.json`;
|
|
137
|
+
}
|
|
138
|
+
function resolveLottieFileUrl(basePath, fileName) {
|
|
139
|
+
const normalizedBasePath = basePath.endsWith("/") ? basePath.slice(0, -1) : basePath;
|
|
140
|
+
const normalizedFileName = normalizeLottieFileName(fileName);
|
|
141
|
+
const fullPath = `${normalizedBasePath}/${normalizedFileName}`;
|
|
142
|
+
if (normalizedBasePath.startsWith("./") || normalizedBasePath.startsWith("../")) {
|
|
143
|
+
return new URL(fullPath, import.meta.url).href;
|
|
144
|
+
}
|
|
145
|
+
return fullPath;
|
|
146
|
+
}
|
|
130
147
|
function Button({
|
|
131
148
|
disabled,
|
|
132
149
|
loading,
|
|
@@ -134,9 +151,41 @@ function Button({
|
|
|
134
151
|
type,
|
|
135
152
|
onClick,
|
|
136
153
|
title,
|
|
154
|
+
className,
|
|
155
|
+
loadingLottieFileName,
|
|
156
|
+
loadingLottieBasePath,
|
|
157
|
+
loadingLottieData,
|
|
137
158
|
...rest
|
|
138
159
|
}) {
|
|
139
160
|
const theme = useLeafcodeTheme();
|
|
161
|
+
const [resolvedLottieData, setResolvedLottieData] = useState(loadingLottieData ?? null);
|
|
162
|
+
useEffect(() => {
|
|
163
|
+
if (loadingLottieData) {
|
|
164
|
+
setResolvedLottieData(loadingLottieData);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (!loadingLottieFileName) {
|
|
168
|
+
setResolvedLottieData(null);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const controller = new AbortController();
|
|
172
|
+
const basePath = loadingLottieBasePath ?? DEFAULT_LOTTIE_BASE_PATH;
|
|
173
|
+
const lottieUrl = resolveLottieFileUrl(basePath, loadingLottieFileName);
|
|
174
|
+
fetch(lottieUrl, { signal: controller.signal }).then((response) => {
|
|
175
|
+
if (!response.ok) {
|
|
176
|
+
throw new Error(`Failed to load lottie file: ${lottieUrl}`);
|
|
177
|
+
}
|
|
178
|
+
return response.json();
|
|
179
|
+
}).then((data) => {
|
|
180
|
+
setResolvedLottieData(data);
|
|
181
|
+
}).catch((error) => {
|
|
182
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
setResolvedLottieData(null);
|
|
186
|
+
});
|
|
187
|
+
return () => controller.abort();
|
|
188
|
+
}, [loadingLottieData, loadingLottieFileName, loadingLottieBasePath]);
|
|
140
189
|
const styleVars = {
|
|
141
190
|
"--button-font-family": theme.components.button.fonts.family,
|
|
142
191
|
"--button-font-weight": theme.components.button.fonts.weight,
|
|
@@ -152,16 +201,29 @@ function Button({
|
|
|
152
201
|
"--button-min-width": theme.components.button.sizes.minWidth,
|
|
153
202
|
"--button-border-radius": theme.components.button.sizes.radius
|
|
154
203
|
};
|
|
204
|
+
const resolvedClassName = [
|
|
205
|
+
"box-button",
|
|
206
|
+
disabled || loading ? "button-disabled" : color === "danger" ? "button-secundary" : "button-primary",
|
|
207
|
+
className
|
|
208
|
+
].filter(Boolean).join(" ");
|
|
155
209
|
return /* @__PURE__ */ jsx2(
|
|
156
210
|
"button",
|
|
157
211
|
{
|
|
158
212
|
type,
|
|
159
213
|
style: styleVars,
|
|
160
|
-
className:
|
|
214
|
+
className: resolvedClassName,
|
|
161
215
|
onClick: !loading ? onClick : void 0,
|
|
162
216
|
disabled: disabled || loading,
|
|
163
217
|
...rest,
|
|
164
|
-
children: loading ? /* @__PURE__ */ jsx2("span", { className: "box-loading", children: /* @__PURE__ */
|
|
218
|
+
children: loading ? /* @__PURE__ */ jsx2("span", { className: "box-loading", children: resolvedLottieData ? /* @__PURE__ */ jsx2(
|
|
219
|
+
Lottie,
|
|
220
|
+
{
|
|
221
|
+
animationData: resolvedLottieData,
|
|
222
|
+
autoplay: true,
|
|
223
|
+
loop: true,
|
|
224
|
+
className: "button-lottie-loading"
|
|
225
|
+
}
|
|
226
|
+
) : /* @__PURE__ */ jsxs(
|
|
165
227
|
"svg",
|
|
166
228
|
{
|
|
167
229
|
className: "animate-spin",
|
|
@@ -219,12 +281,12 @@ function TooltipCustom({ label, id }) {
|
|
|
219
281
|
// src/components/Input/Input.tsx
|
|
220
282
|
import {
|
|
221
283
|
forwardRef,
|
|
222
|
-
useState as
|
|
284
|
+
useState as useState3
|
|
223
285
|
} from "react";
|
|
224
286
|
|
|
225
287
|
// src/components/Tooltips/TooltipErrorInput.tsx
|
|
226
288
|
import { WarningCircle, X } from "@phosphor-icons/react";
|
|
227
|
-
import { useEffect, useState } from "react";
|
|
289
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
228
290
|
import { Tooltip as Tooltip2 } from "react-tooltip";
|
|
229
291
|
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
230
292
|
function TooltipErrorInput({
|
|
@@ -245,9 +307,9 @@ function TooltipErrorInput({
|
|
|
245
307
|
"--input-error-border": theme.colors.danger,
|
|
246
308
|
"--input-font-size-tooltip": theme.components.tooltip.fonts.TooltipSize
|
|
247
309
|
};
|
|
248
|
-
const [isTooltipOpen, setIsTooltipOpen] =
|
|
310
|
+
const [isTooltipOpen, setIsTooltipOpen] = useState2(true);
|
|
249
311
|
const handleClose = () => setIsTooltipOpen(false);
|
|
250
|
-
|
|
312
|
+
useEffect2(() => {
|
|
251
313
|
setIsTooltipOpen(true);
|
|
252
314
|
}, [error]);
|
|
253
315
|
return /* @__PURE__ */ jsx4(
|
|
@@ -360,7 +422,7 @@ var InputBase = ({
|
|
|
360
422
|
e.target.value = val;
|
|
361
423
|
onChange?.(e);
|
|
362
424
|
};
|
|
363
|
-
const [show, setShow] =
|
|
425
|
+
const [show, setShow] = useState3(false);
|
|
364
426
|
const isPassword = showPasswordToggle;
|
|
365
427
|
const handleClick = () => setShow(!show);
|
|
366
428
|
return /* @__PURE__ */ jsxs3(
|
|
@@ -491,8 +553,8 @@ var TextArea = forwardRef2(
|
|
|
491
553
|
// src/components/Input/InputSelect.tsx
|
|
492
554
|
import {
|
|
493
555
|
forwardRef as forwardRef3,
|
|
494
|
-
useEffect as
|
|
495
|
-
useState as
|
|
556
|
+
useEffect as useEffect3,
|
|
557
|
+
useState as useState4
|
|
496
558
|
} from "react";
|
|
497
559
|
import { Controller } from "react-hook-form";
|
|
498
560
|
import Select, { components } from "react-select";
|
|
@@ -539,10 +601,10 @@ var InputBase2 = ({
|
|
|
539
601
|
"--input-height": theme.components.input.sizes.height,
|
|
540
602
|
"--input-border-radius": theme.components.input.sizes.radius
|
|
541
603
|
};
|
|
542
|
-
const [menuPortalTarget, setMenuPortalTarget] =
|
|
604
|
+
const [menuPortalTarget, setMenuPortalTarget] = useState4(
|
|
543
605
|
null
|
|
544
606
|
);
|
|
545
|
-
|
|
607
|
+
useEffect3(() => {
|
|
546
608
|
setMenuPortalTarget(document.body);
|
|
547
609
|
}, []);
|
|
548
610
|
return /* @__PURE__ */ jsxs5("div", { className: "input-wrapper", style: styleVars, children: [
|
|
@@ -628,7 +690,7 @@ function FooterButtons({ children }) {
|
|
|
628
690
|
}
|
|
629
691
|
|
|
630
692
|
// src/components/ModalBase/ModalBase.tsx
|
|
631
|
-
import { useEffect as
|
|
693
|
+
import { useEffect as useEffect4 } from "react";
|
|
632
694
|
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
633
695
|
function ModalBase({
|
|
634
696
|
show,
|
|
@@ -658,7 +720,7 @@ function ModalBase({
|
|
|
658
720
|
// Sizes
|
|
659
721
|
"--modal-max-width": theme.components.modalBase.sizes.modalMaxWidth
|
|
660
722
|
};
|
|
661
|
-
|
|
723
|
+
useEffect4(() => {
|
|
662
724
|
const handleKeyDown = (event) => {
|
|
663
725
|
if (event.key === "Escape") {
|
|
664
726
|
onHide();
|
|
@@ -707,9 +769,9 @@ import { X as X3 } from "@phosphor-icons/react";
|
|
|
707
769
|
import _ from "lodash";
|
|
708
770
|
import {
|
|
709
771
|
forwardRef as forwardRef4,
|
|
710
|
-
useEffect as
|
|
772
|
+
useEffect as useEffect5,
|
|
711
773
|
useRef,
|
|
712
|
-
useState as
|
|
774
|
+
useState as useState5
|
|
713
775
|
} from "react";
|
|
714
776
|
import { useQuery } from "@tanstack/react-query";
|
|
715
777
|
|
|
@@ -759,7 +821,7 @@ function AutoCompleteInner(props, ref) {
|
|
|
759
821
|
} = props;
|
|
760
822
|
const theme = useLeafcodeTheme();
|
|
761
823
|
const inputRef = useRef(null);
|
|
762
|
-
const [placement, setPlacement] =
|
|
824
|
+
const [placement, setPlacement] = useState5("bottom");
|
|
763
825
|
const styleVars = {
|
|
764
826
|
// Fonts
|
|
765
827
|
"--label-font-family": theme.components.input.fonts.label,
|
|
@@ -779,10 +841,10 @@ function AutoCompleteInner(props, ref) {
|
|
|
779
841
|
"--input-height": theme.components.input.sizes.height,
|
|
780
842
|
"--input-border-radius": theme.components.input.sizes.radius
|
|
781
843
|
};
|
|
782
|
-
const [items, setItems] =
|
|
783
|
-
const [pageNumber, setPageNumber] =
|
|
784
|
-
const [search, setSearch] =
|
|
785
|
-
const [isOpen, setIsOpen] =
|
|
844
|
+
const [items, setItems] = useState5([]);
|
|
845
|
+
const [pageNumber, setPageNumber] = useState5(1);
|
|
846
|
+
const [search, setSearch] = useState5("");
|
|
847
|
+
const [isOpen, setIsOpen] = useState5(false);
|
|
786
848
|
const listRef = useRef(null);
|
|
787
849
|
const calculatePlacement = () => {
|
|
788
850
|
const input = inputRef.current;
|
|
@@ -797,7 +859,7 @@ function AutoCompleteInner(props, ref) {
|
|
|
797
859
|
setPlacement("bottom");
|
|
798
860
|
}
|
|
799
861
|
};
|
|
800
|
-
|
|
862
|
+
useEffect5(() => {
|
|
801
863
|
if (!isOpen) return;
|
|
802
864
|
calculatePlacement();
|
|
803
865
|
window.addEventListener("resize", calculatePlacement);
|
|
@@ -830,13 +892,13 @@ function AutoCompleteInner(props, ref) {
|
|
|
830
892
|
enabled: isOpen
|
|
831
893
|
});
|
|
832
894
|
const { data, isLoading } = query;
|
|
833
|
-
|
|
895
|
+
useEffect5(() => {
|
|
834
896
|
if (!data) return;
|
|
835
897
|
setItems(
|
|
836
898
|
(prev) => pageNumber === 1 ? data.items : [...prev, ...data.items]
|
|
837
899
|
);
|
|
838
900
|
}, [data, pageNumber]);
|
|
839
|
-
|
|
901
|
+
useEffect5(() => {
|
|
840
902
|
const debounced = _.debounce(() => {
|
|
841
903
|
setPageNumber(1);
|
|
842
904
|
setSearch(value ?? "");
|
|
@@ -936,10 +998,10 @@ function AutoCompleteInner(props, ref) {
|
|
|
936
998
|
var InputAutoComplete = forwardRef4(AutoCompleteInner);
|
|
937
999
|
|
|
938
1000
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilter.tsx
|
|
939
|
-
import { useEffect as
|
|
1001
|
+
import { useEffect as useEffect8, useState as useState8 } from "react";
|
|
940
1002
|
|
|
941
1003
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
|
|
942
|
-
import { useEffect as
|
|
1004
|
+
import { useEffect as useEffect7, useMemo, useState as useState7 } from "react";
|
|
943
1005
|
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
944
1006
|
|
|
945
1007
|
// src/primereact-compat.ts
|
|
@@ -1122,6 +1184,7 @@ function ActionsColumn({
|
|
|
1122
1184
|
type: "button",
|
|
1123
1185
|
className: "btn-icone-actions-column",
|
|
1124
1186
|
onClick: (e) => {
|
|
1187
|
+
e.stopPropagation();
|
|
1125
1188
|
onEdit && onEdit([row]);
|
|
1126
1189
|
},
|
|
1127
1190
|
children: [
|
|
@@ -1143,6 +1206,7 @@ function ActionsColumn({
|
|
|
1143
1206
|
type: "button",
|
|
1144
1207
|
className: "btn-icone-actions-column",
|
|
1145
1208
|
onClick: (e) => {
|
|
1209
|
+
e.stopPropagation();
|
|
1146
1210
|
onDelete && onDelete([row]);
|
|
1147
1211
|
},
|
|
1148
1212
|
children: [
|
|
@@ -1164,7 +1228,10 @@ function ActionsColumn({
|
|
|
1164
1228
|
{
|
|
1165
1229
|
id,
|
|
1166
1230
|
type: "button",
|
|
1167
|
-
onClick: () =>
|
|
1231
|
+
onClick: (e) => {
|
|
1232
|
+
e.stopPropagation();
|
|
1233
|
+
action.onClick([row]);
|
|
1234
|
+
},
|
|
1168
1235
|
className: cn("btn-icone-actions-column", action.className),
|
|
1169
1236
|
children: [
|
|
1170
1237
|
action.icon,
|
|
@@ -1260,10 +1327,10 @@ function DynamicColumns({
|
|
|
1260
1327
|
}
|
|
1261
1328
|
|
|
1262
1329
|
// src/hooks/use-debounce.ts
|
|
1263
|
-
import { useEffect as
|
|
1330
|
+
import { useEffect as useEffect6, useState as useState6 } from "react";
|
|
1264
1331
|
var useDebounce = (value, delay) => {
|
|
1265
|
-
const [debouncedValue, setDebouncedValue] =
|
|
1266
|
-
|
|
1332
|
+
const [debouncedValue, setDebouncedValue] = useState6(value);
|
|
1333
|
+
useEffect6(() => {
|
|
1267
1334
|
const timer = setTimeout(() => {
|
|
1268
1335
|
setDebouncedValue(value);
|
|
1269
1336
|
}, delay || 500);
|
|
@@ -1295,8 +1362,8 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1295
1362
|
state,
|
|
1296
1363
|
onStateChange
|
|
1297
1364
|
}) {
|
|
1298
|
-
const [isClient, setIsClient] =
|
|
1299
|
-
|
|
1365
|
+
const [isClient, setIsClient] = useState7(false);
|
|
1366
|
+
useEffect7(() => {
|
|
1300
1367
|
setIsClient(true);
|
|
1301
1368
|
}, []);
|
|
1302
1369
|
const initialState = state ?? {
|
|
@@ -1306,21 +1373,21 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1306
1373
|
sortOrder: sortOrderInitial,
|
|
1307
1374
|
filter: ""
|
|
1308
1375
|
};
|
|
1309
|
-
const [page, setPage] =
|
|
1310
|
-
const [rows, setRows] =
|
|
1311
|
-
const [first, setFirst] =
|
|
1376
|
+
const [page, setPage] = useState7(initialState.page);
|
|
1377
|
+
const [rows, setRows] = useState7(initialState.rows);
|
|
1378
|
+
const [first, setFirst] = useState7(
|
|
1312
1379
|
(initialState.page - 1) * initialState.rows
|
|
1313
1380
|
);
|
|
1314
|
-
const [sortField, setSortField] =
|
|
1315
|
-
const [sortOrder, setSortOrder] =
|
|
1381
|
+
const [sortField, setSortField] = useState7(initialState.sortField);
|
|
1382
|
+
const [sortOrder, setSortOrder] = useState7(
|
|
1316
1383
|
initialState.sortOrder ?? 1
|
|
1317
1384
|
);
|
|
1318
|
-
const [searchText, setSearchText] =
|
|
1319
|
-
const [filters, setFilters] =
|
|
1385
|
+
const [searchText, setSearchText] = useState7(initialState.filter ?? "");
|
|
1386
|
+
const [filters, setFilters] = useState7({
|
|
1320
1387
|
...initFilters,
|
|
1321
1388
|
global: { value: initialState.filter, matchMode: "contains" }
|
|
1322
1389
|
});
|
|
1323
|
-
const [selectedRowsData, setSelectedRowsData] =
|
|
1390
|
+
const [selectedRowsData, setSelectedRowsData] = useState7([]);
|
|
1324
1391
|
const debouncedSearch = useDebounce(searchText, 500);
|
|
1325
1392
|
const debouncedFilters = useMemo(() => {
|
|
1326
1393
|
const f = { ...filters };
|
|
@@ -1345,7 +1412,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1345
1412
|
globalFilterFields
|
|
1346
1413
|
)
|
|
1347
1414
|
});
|
|
1348
|
-
|
|
1415
|
+
useEffect7(() => {
|
|
1349
1416
|
if (!state) return;
|
|
1350
1417
|
setPage(state.page);
|
|
1351
1418
|
setRows(state.rows);
|
|
@@ -1401,7 +1468,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1401
1468
|
filter: searchText
|
|
1402
1469
|
});
|
|
1403
1470
|
};
|
|
1404
|
-
|
|
1471
|
+
useEffect7(() => {
|
|
1405
1472
|
emitStateChange({
|
|
1406
1473
|
page,
|
|
1407
1474
|
rows,
|
|
@@ -1410,7 +1477,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1410
1477
|
filter: debouncedSearch
|
|
1411
1478
|
});
|
|
1412
1479
|
}, [debouncedSearch]);
|
|
1413
|
-
|
|
1480
|
+
useEffect7(() => {
|
|
1414
1481
|
if (customers?.items && selectedRowsData.length > 0) {
|
|
1415
1482
|
const currentIds = new Set(customers.items.map((item) => item.id));
|
|
1416
1483
|
const filteredSelection = selectedRowsData.filter(
|
|
@@ -1482,7 +1549,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1482
1549
|
"--p-datepicker-prev-next": theme.colors.primary,
|
|
1483
1550
|
"--p-datepicker-button": theme.colors.primary
|
|
1484
1551
|
};
|
|
1485
|
-
|
|
1552
|
+
useEffect7(() => {
|
|
1486
1553
|
const root = document.documentElement;
|
|
1487
1554
|
root.style.setProperty(
|
|
1488
1555
|
"--p-column-filter-add-button-color",
|
|
@@ -1800,14 +1867,14 @@ function DataTableAdvancedFilter({
|
|
|
1800
1867
|
state,
|
|
1801
1868
|
onStateChange
|
|
1802
1869
|
}) {
|
|
1803
|
-
const [isClient, setIsClient] =
|
|
1804
|
-
|
|
1870
|
+
const [isClient, setIsClient] = useState8(false);
|
|
1871
|
+
useEffect8(() => {
|
|
1805
1872
|
addLocale("pt", localePtBr);
|
|
1806
1873
|
}, []);
|
|
1807
|
-
|
|
1874
|
+
useEffect8(() => {
|
|
1808
1875
|
locale(isLanguagePtBr ? "pt" : "en");
|
|
1809
1876
|
}, [isLanguagePtBr]);
|
|
1810
|
-
|
|
1877
|
+
useEffect8(() => {
|
|
1811
1878
|
setIsClient(true);
|
|
1812
1879
|
}, []);
|
|
1813
1880
|
return /* @__PURE__ */ jsx17(Fragment7, { children: isClient && /* @__PURE__ */ jsx17(
|
package/dist/styles/button.css
CHANGED
|
@@ -79,9 +79,21 @@
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
.animate-spin {
|
|
82
|
-
height: 1.
|
|
83
|
-
width: 1.
|
|
82
|
+
height: 1.5rem;
|
|
83
|
+
width: 1.5rem;
|
|
84
84
|
color: var(--button-color, #ffffff);
|
|
85
|
+
animation: button-spin 1s linear infinite;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.button-lottie-loading {
|
|
89
|
+
height: 1.5rem;
|
|
90
|
+
width: 1.5rem;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@keyframes button-spin {
|
|
94
|
+
to {
|
|
95
|
+
transform: rotate(360deg);
|
|
96
|
+
}
|
|
85
97
|
}
|
|
86
98
|
|
|
87
99
|
.opacity-01 {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@charlesgomes/leafcode-shared-lib-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.96",
|
|
4
4
|
"description": "Lib de componentes react",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@tanstack/react-query": "^5.85.9",
|
|
40
40
|
"primereact": "^10.9.7",
|
|
41
|
-
"react-hook-form": "^7.70.0",
|
|
42
41
|
"react": ">=17",
|
|
43
|
-
"react-dom": ">=17"
|
|
42
|
+
"react-dom": ">=17",
|
|
43
|
+
"react-hook-form": "^7.70.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@tailwindcss/postcss": "^4.1.12",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"@types/react": "^19.1.12",
|
|
51
51
|
"@types/react-dom": "^19.1.9",
|
|
52
52
|
"@vitejs/plugin-react": "^5.0.2",
|
|
53
|
-
"react-hook-form": "^7.70.0",
|
|
54
53
|
"postcss": "^8.5.6",
|
|
55
54
|
"react": "^19.1.1",
|
|
56
55
|
"react-dom": "^19.1.1",
|
|
56
|
+
"react-hook-form": "^7.70.0",
|
|
57
57
|
"tailwindcss": "^4.1.12",
|
|
58
58
|
"tsup": "^8.5.0",
|
|
59
59
|
"typescript": "^5.9.2",
|
|
@@ -64,10 +64,11 @@
|
|
|
64
64
|
"clsx": "^2.1.1",
|
|
65
65
|
"lodash": "^4.17.21",
|
|
66
66
|
"lodash.merge": "^4.6.2",
|
|
67
|
+
"lottie-react": "^2.4.1",
|
|
67
68
|
"moment": "^2.30.1",
|
|
68
69
|
"primereact": "^10.9.7",
|
|
69
70
|
"react-select": "^5.10.2",
|
|
70
71
|
"react-tooltip": "^5.29.1",
|
|
71
72
|
"tailwind-merge": "^3.3.1"
|
|
72
73
|
}
|
|
73
|
-
}
|
|
74
|
+
}
|