@charlesgomes/leafcode-shared-lib-react 1.0.95 → 1.0.97
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 +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +149 -78
- package/dist/index.mjs +117 -47
- 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;
|
|
@@ -340,6 +344,11 @@ interface LeafcodeTheme {
|
|
|
340
344
|
minWidth: string | number;
|
|
341
345
|
radius: string;
|
|
342
346
|
};
|
|
347
|
+
|
|
348
|
+
lottie?: {
|
|
349
|
+
basePath?: string;
|
|
350
|
+
fileName?: string;
|
|
351
|
+
};
|
|
343
352
|
};
|
|
344
353
|
table: {
|
|
345
354
|
colors: {
|
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;
|
|
@@ -340,6 +344,11 @@ interface LeafcodeTheme {
|
|
|
340
344
|
minWidth: string | number;
|
|
341
345
|
radius: string;
|
|
342
346
|
};
|
|
347
|
+
|
|
348
|
+
lottie?: {
|
|
349
|
+
basePath?: string;
|
|
350
|
+
fileName?: string;
|
|
351
|
+
};
|
|
343
352
|
};
|
|
344
353
|
table: {
|
|
345
354
|
colors: {
|
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",
|
|
@@ -141,6 +145,9 @@ var defaultTheme = {
|
|
|
141
145
|
height: "2.5rem",
|
|
142
146
|
minWidth: "8rem",
|
|
143
147
|
radius: "6px"
|
|
148
|
+
},
|
|
149
|
+
lottie: {
|
|
150
|
+
basePath: "/lotties"
|
|
144
151
|
}
|
|
145
152
|
},
|
|
146
153
|
table: {
|
|
@@ -192,6 +199,20 @@ var useLeafcodeTheme = () => (0, import_react.useContext)(ThemeContext);
|
|
|
192
199
|
|
|
193
200
|
// src/components/Button/Button.tsx
|
|
194
201
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
202
|
+
var import_meta = {};
|
|
203
|
+
var DEFAULT_LOTTIE_BASE_PATH = "/lotties";
|
|
204
|
+
function normalizeLottieFileName(fileName) {
|
|
205
|
+
return fileName.endsWith(".json") ? fileName : `${fileName}.json`;
|
|
206
|
+
}
|
|
207
|
+
function resolveLottieFileUrl(basePath, fileName) {
|
|
208
|
+
const normalizedBasePath = basePath.endsWith("/") ? basePath.slice(0, -1) : basePath;
|
|
209
|
+
const normalizedFileName = normalizeLottieFileName(fileName);
|
|
210
|
+
const fullPath = `${normalizedBasePath}/${normalizedFileName}`;
|
|
211
|
+
if (normalizedBasePath.startsWith("./") || normalizedBasePath.startsWith("../")) {
|
|
212
|
+
return new URL(fullPath, import_meta.url).href;
|
|
213
|
+
}
|
|
214
|
+
return fullPath;
|
|
215
|
+
}
|
|
195
216
|
function Button({
|
|
196
217
|
disabled,
|
|
197
218
|
loading,
|
|
@@ -199,9 +220,46 @@ function Button({
|
|
|
199
220
|
type,
|
|
200
221
|
onClick,
|
|
201
222
|
title,
|
|
223
|
+
className,
|
|
224
|
+
loadingLottieFileName,
|
|
225
|
+
loadingLottieBasePath,
|
|
226
|
+
loadingLottieData,
|
|
202
227
|
...rest
|
|
203
228
|
}) {
|
|
204
229
|
const theme = useLeafcodeTheme();
|
|
230
|
+
const themeButtonLottie = theme.components.button.lottie;
|
|
231
|
+
const [resolvedLottieData, setResolvedLottieData] = (0, import_react2.useState)(loadingLottieData ?? null);
|
|
232
|
+
const resolvedLottieFileName = loadingLottieFileName ?? themeButtonLottie?.fileName;
|
|
233
|
+
const resolvedLottieBasePath = loadingLottieBasePath ?? themeButtonLottie?.basePath ?? DEFAULT_LOTTIE_BASE_PATH;
|
|
234
|
+
(0, import_react2.useEffect)(() => {
|
|
235
|
+
if (loadingLottieData) {
|
|
236
|
+
setResolvedLottieData(loadingLottieData);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
if (!resolvedLottieFileName) {
|
|
240
|
+
setResolvedLottieData(null);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const controller = new AbortController();
|
|
244
|
+
const lottieUrl = resolveLottieFileUrl(
|
|
245
|
+
resolvedLottieBasePath,
|
|
246
|
+
resolvedLottieFileName
|
|
247
|
+
);
|
|
248
|
+
fetch(lottieUrl, { signal: controller.signal }).then((response) => {
|
|
249
|
+
if (!response.ok) {
|
|
250
|
+
throw new Error(`Failed to load lottie file: ${lottieUrl}`);
|
|
251
|
+
}
|
|
252
|
+
return response.json();
|
|
253
|
+
}).then((data) => {
|
|
254
|
+
setResolvedLottieData(data);
|
|
255
|
+
}).catch((error) => {
|
|
256
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
setResolvedLottieData(null);
|
|
260
|
+
});
|
|
261
|
+
return () => controller.abort();
|
|
262
|
+
}, [loadingLottieData, resolvedLottieFileName, resolvedLottieBasePath]);
|
|
205
263
|
const styleVars = {
|
|
206
264
|
"--button-font-family": theme.components.button.fonts.family,
|
|
207
265
|
"--button-font-weight": theme.components.button.fonts.weight,
|
|
@@ -217,16 +275,29 @@ function Button({
|
|
|
217
275
|
"--button-min-width": theme.components.button.sizes.minWidth,
|
|
218
276
|
"--button-border-radius": theme.components.button.sizes.radius
|
|
219
277
|
};
|
|
278
|
+
const resolvedClassName = [
|
|
279
|
+
"box-button",
|
|
280
|
+
disabled || loading ? "button-disabled" : color === "danger" ? "button-secundary" : "button-primary",
|
|
281
|
+
className
|
|
282
|
+
].filter(Boolean).join(" ");
|
|
220
283
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
221
284
|
"button",
|
|
222
285
|
{
|
|
223
286
|
type,
|
|
224
287
|
style: styleVars,
|
|
225
|
-
className:
|
|
288
|
+
className: resolvedClassName,
|
|
226
289
|
onClick: !loading ? onClick : void 0,
|
|
227
290
|
disabled: disabled || loading,
|
|
228
291
|
...rest,
|
|
229
|
-
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "box-loading", children: /* @__PURE__ */ (0, import_jsx_runtime2.
|
|
292
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "box-loading", children: resolvedLottieData ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
293
|
+
import_lottie_react.default,
|
|
294
|
+
{
|
|
295
|
+
animationData: resolvedLottieData,
|
|
296
|
+
autoplay: true,
|
|
297
|
+
loop: true,
|
|
298
|
+
className: "button-lottie-loading"
|
|
299
|
+
}
|
|
300
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
230
301
|
"svg",
|
|
231
302
|
{
|
|
232
303
|
className: "animate-spin",
|
|
@@ -282,11 +353,11 @@ function TooltipCustom({ label, id }) {
|
|
|
282
353
|
}
|
|
283
354
|
|
|
284
355
|
// src/components/Input/Input.tsx
|
|
285
|
-
var
|
|
356
|
+
var import_react5 = require("react");
|
|
286
357
|
|
|
287
358
|
// src/components/Tooltips/TooltipErrorInput.tsx
|
|
288
|
-
var
|
|
289
|
-
var
|
|
359
|
+
var import_react3 = require("@phosphor-icons/react");
|
|
360
|
+
var import_react4 = require("react");
|
|
290
361
|
var import_react_tooltip2 = require("react-tooltip");
|
|
291
362
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
292
363
|
function TooltipErrorInput({
|
|
@@ -307,9 +378,9 @@ function TooltipErrorInput({
|
|
|
307
378
|
"--input-error-border": theme.colors.danger,
|
|
308
379
|
"--input-font-size-tooltip": theme.components.tooltip.fonts.TooltipSize
|
|
309
380
|
};
|
|
310
|
-
const [isTooltipOpen, setIsTooltipOpen] = (0,
|
|
381
|
+
const [isTooltipOpen, setIsTooltipOpen] = (0, import_react4.useState)(true);
|
|
311
382
|
const handleClose = () => setIsTooltipOpen(false);
|
|
312
|
-
(0,
|
|
383
|
+
(0, import_react4.useEffect)(() => {
|
|
313
384
|
setIsTooltipOpen(true);
|
|
314
385
|
}, [error]);
|
|
315
386
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -325,7 +396,7 @@ function TooltipErrorInput({
|
|
|
325
396
|
"data-tooltip-content": "",
|
|
326
397
|
"data-tooltip-place": "top-end",
|
|
327
398
|
onClick: () => setIsTooltipOpen(true),
|
|
328
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
399
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react3.WarningCircle, { size: 22, className: "tooltip-icon" })
|
|
329
400
|
}
|
|
330
401
|
),
|
|
331
402
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -356,7 +427,7 @@ function TooltipErrorInput({
|
|
|
356
427
|
background: "transparent",
|
|
357
428
|
cursor: "pointer"
|
|
358
429
|
},
|
|
359
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
430
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react3.X, { size: 16, weight: "bold" })
|
|
360
431
|
}
|
|
361
432
|
)
|
|
362
433
|
] })
|
|
@@ -368,7 +439,7 @@ function TooltipErrorInput({
|
|
|
368
439
|
}
|
|
369
440
|
|
|
370
441
|
// src/components/Input/Input.tsx
|
|
371
|
-
var
|
|
442
|
+
var import_react6 = require("@phosphor-icons/react");
|
|
372
443
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
373
444
|
var InputBase = ({
|
|
374
445
|
name,
|
|
@@ -422,7 +493,7 @@ var InputBase = ({
|
|
|
422
493
|
e.target.value = val;
|
|
423
494
|
onChange?.(e);
|
|
424
495
|
};
|
|
425
|
-
const [show, setShow] = (0,
|
|
496
|
+
const [show, setShow] = (0, import_react5.useState)(false);
|
|
426
497
|
const isPassword = showPasswordToggle;
|
|
427
498
|
const handleClick = () => setShow(!show);
|
|
428
499
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
@@ -462,7 +533,7 @@ var InputBase = ({
|
|
|
462
533
|
{
|
|
463
534
|
onClick: () => handleClick(),
|
|
464
535
|
className: `password-toggle ${error ? "error" : "no-error"}`,
|
|
465
|
-
children: show ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
536
|
+
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
537
|
}
|
|
467
538
|
)
|
|
468
539
|
] }),
|
|
@@ -471,10 +542,10 @@ var InputBase = ({
|
|
|
471
542
|
}
|
|
472
543
|
);
|
|
473
544
|
};
|
|
474
|
-
var Input = (0,
|
|
545
|
+
var Input = (0, import_react5.forwardRef)(InputBase);
|
|
475
546
|
|
|
476
547
|
// src/components/Input/TextArea.tsx
|
|
477
|
-
var
|
|
548
|
+
var import_react7 = require("react");
|
|
478
549
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
479
550
|
var TextAreaBase = ({
|
|
480
551
|
name,
|
|
@@ -546,12 +617,12 @@ var TextAreaBase = ({
|
|
|
546
617
|
}
|
|
547
618
|
);
|
|
548
619
|
};
|
|
549
|
-
var TextArea = (0,
|
|
620
|
+
var TextArea = (0, import_react7.forwardRef)(
|
|
550
621
|
TextAreaBase
|
|
551
622
|
);
|
|
552
623
|
|
|
553
624
|
// src/components/Input/InputSelect.tsx
|
|
554
|
-
var
|
|
625
|
+
var import_react8 = require("react");
|
|
555
626
|
var import_react_hook_form = require("react-hook-form");
|
|
556
627
|
var import_react_select = __toESM(require("react-select"));
|
|
557
628
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
@@ -597,10 +668,10 @@ var InputBase2 = ({
|
|
|
597
668
|
"--input-height": theme.components.input.sizes.height,
|
|
598
669
|
"--input-border-radius": theme.components.input.sizes.radius
|
|
599
670
|
};
|
|
600
|
-
const [menuPortalTarget, setMenuPortalTarget] = (0,
|
|
671
|
+
const [menuPortalTarget, setMenuPortalTarget] = (0, import_react8.useState)(
|
|
601
672
|
null
|
|
602
673
|
);
|
|
603
|
-
(0,
|
|
674
|
+
(0, import_react8.useEffect)(() => {
|
|
604
675
|
setMenuPortalTarget(document.body);
|
|
605
676
|
}, []);
|
|
606
677
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "input-wrapper", style: styleVars, children: [
|
|
@@ -674,10 +745,10 @@ var InputBase2 = ({
|
|
|
674
745
|
)
|
|
675
746
|
] });
|
|
676
747
|
};
|
|
677
|
-
var InputSelect = (0,
|
|
748
|
+
var InputSelect = (0, import_react8.forwardRef)(InputBase2);
|
|
678
749
|
|
|
679
750
|
// src/components/ModalBase/ModalBase.tsx
|
|
680
|
-
var
|
|
751
|
+
var import_react9 = require("@phosphor-icons/react");
|
|
681
752
|
|
|
682
753
|
// src/components/ModalBase/FooterButtons.tsx
|
|
683
754
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
@@ -686,7 +757,7 @@ function FooterButtons({ children }) {
|
|
|
686
757
|
}
|
|
687
758
|
|
|
688
759
|
// src/components/ModalBase/ModalBase.tsx
|
|
689
|
-
var
|
|
760
|
+
var import_react10 = require("react");
|
|
690
761
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
691
762
|
function ModalBase({
|
|
692
763
|
show,
|
|
@@ -716,7 +787,7 @@ function ModalBase({
|
|
|
716
787
|
// Sizes
|
|
717
788
|
"--modal-max-width": theme.components.modalBase.sizes.modalMaxWidth
|
|
718
789
|
};
|
|
719
|
-
(0,
|
|
790
|
+
(0, import_react10.useEffect)(() => {
|
|
720
791
|
const handleKeyDown = (event) => {
|
|
721
792
|
if (event.key === "Escape") {
|
|
722
793
|
onHide();
|
|
@@ -731,7 +802,7 @@ function ModalBase({
|
|
|
731
802
|
/* @__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
803
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "modal-header", children: [
|
|
733
804
|
/* @__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)(
|
|
805
|
+
/* @__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
806
|
] }),
|
|
736
807
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "modal-body", children }),
|
|
737
808
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(FooterButtons, { children: [
|
|
@@ -761,15 +832,15 @@ function ModalBase({
|
|
|
761
832
|
}
|
|
762
833
|
|
|
763
834
|
// src/components/Input/InputAutocomplete.tsx
|
|
764
|
-
var
|
|
835
|
+
var import_react12 = require("@phosphor-icons/react");
|
|
765
836
|
var import_lodash2 = __toESM(require("lodash"));
|
|
766
|
-
var
|
|
837
|
+
var import_react13 = require("react");
|
|
767
838
|
var import_react_query = require("@tanstack/react-query");
|
|
768
839
|
|
|
769
840
|
// src/components/Loading/Loading.tsx
|
|
770
|
-
var
|
|
841
|
+
var import_react11 = require("react");
|
|
771
842
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
772
|
-
var LoadingSpinner = (0,
|
|
843
|
+
var LoadingSpinner = (0, import_react11.memo)(({ size = 20 }) => {
|
|
773
844
|
const theme = useLeafcodeTheme();
|
|
774
845
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
775
846
|
"span",
|
|
@@ -811,8 +882,8 @@ function AutoCompleteInner(props, ref) {
|
|
|
811
882
|
...inputProps
|
|
812
883
|
} = props;
|
|
813
884
|
const theme = useLeafcodeTheme();
|
|
814
|
-
const inputRef = (0,
|
|
815
|
-
const [placement, setPlacement] = (0,
|
|
885
|
+
const inputRef = (0, import_react13.useRef)(null);
|
|
886
|
+
const [placement, setPlacement] = (0, import_react13.useState)("bottom");
|
|
816
887
|
const styleVars = {
|
|
817
888
|
// Fonts
|
|
818
889
|
"--label-font-family": theme.components.input.fonts.label,
|
|
@@ -832,11 +903,11 @@ function AutoCompleteInner(props, ref) {
|
|
|
832
903
|
"--input-height": theme.components.input.sizes.height,
|
|
833
904
|
"--input-border-radius": theme.components.input.sizes.radius
|
|
834
905
|
};
|
|
835
|
-
const [items, setItems] = (0,
|
|
836
|
-
const [pageNumber, setPageNumber] = (0,
|
|
837
|
-
const [search, setSearch] = (0,
|
|
838
|
-
const [isOpen, setIsOpen] = (0,
|
|
839
|
-
const listRef = (0,
|
|
906
|
+
const [items, setItems] = (0, import_react13.useState)([]);
|
|
907
|
+
const [pageNumber, setPageNumber] = (0, import_react13.useState)(1);
|
|
908
|
+
const [search, setSearch] = (0, import_react13.useState)("");
|
|
909
|
+
const [isOpen, setIsOpen] = (0, import_react13.useState)(false);
|
|
910
|
+
const listRef = (0, import_react13.useRef)(null);
|
|
840
911
|
const calculatePlacement = () => {
|
|
841
912
|
const input = inputRef.current;
|
|
842
913
|
if (!input) return;
|
|
@@ -850,7 +921,7 @@ function AutoCompleteInner(props, ref) {
|
|
|
850
921
|
setPlacement("bottom");
|
|
851
922
|
}
|
|
852
923
|
};
|
|
853
|
-
(0,
|
|
924
|
+
(0, import_react13.useEffect)(() => {
|
|
854
925
|
if (!isOpen) return;
|
|
855
926
|
calculatePlacement();
|
|
856
927
|
window.addEventListener("resize", calculatePlacement);
|
|
@@ -883,13 +954,13 @@ function AutoCompleteInner(props, ref) {
|
|
|
883
954
|
enabled: isOpen
|
|
884
955
|
});
|
|
885
956
|
const { data, isLoading } = query;
|
|
886
|
-
(0,
|
|
957
|
+
(0, import_react13.useEffect)(() => {
|
|
887
958
|
if (!data) return;
|
|
888
959
|
setItems(
|
|
889
960
|
(prev) => pageNumber === 1 ? data.items : [...prev, ...data.items]
|
|
890
961
|
);
|
|
891
962
|
}, [data, pageNumber]);
|
|
892
|
-
(0,
|
|
963
|
+
(0, import_react13.useEffect)(() => {
|
|
893
964
|
const debounced = import_lodash2.default.debounce(() => {
|
|
894
965
|
setPageNumber(1);
|
|
895
966
|
setSearch(value ?? "");
|
|
@@ -964,7 +1035,7 @@ function AutoCompleteInner(props, ref) {
|
|
|
964
1035
|
onChange?.("");
|
|
965
1036
|
onSelect(null);
|
|
966
1037
|
},
|
|
967
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1038
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react12.X, { size: 16, color: "#bf1717" })
|
|
968
1039
|
}
|
|
969
1040
|
),
|
|
970
1041
|
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 +1057,13 @@ function AutoCompleteInner(props, ref) {
|
|
|
986
1057
|
}
|
|
987
1058
|
);
|
|
988
1059
|
}
|
|
989
|
-
var InputAutoComplete = (0,
|
|
1060
|
+
var InputAutoComplete = (0, import_react13.forwardRef)(AutoCompleteInner);
|
|
990
1061
|
|
|
991
1062
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilter.tsx
|
|
992
|
-
var
|
|
1063
|
+
var import_react20 = require("react");
|
|
993
1064
|
|
|
994
1065
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
|
|
995
|
-
var
|
|
1066
|
+
var import_react18 = require("react");
|
|
996
1067
|
var import_react_query2 = require("@tanstack/react-query");
|
|
997
1068
|
|
|
998
1069
|
// src/primereact-compat.ts
|
|
@@ -1004,7 +1075,7 @@ var import_calendar = require("primereact/calendar");
|
|
|
1004
1075
|
var import_api = require("primereact/api");
|
|
1005
1076
|
|
|
1006
1077
|
// src/components/DataTableAdvancedFilter/TableHeader.tsx
|
|
1007
|
-
var
|
|
1078
|
+
var import_react14 = require("@phosphor-icons/react");
|
|
1008
1079
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1009
1080
|
var TableHeader = ({
|
|
1010
1081
|
globalFilterValue,
|
|
@@ -1026,16 +1097,16 @@ var TableHeader = ({
|
|
|
1026
1097
|
className: "custom-input input-search"
|
|
1027
1098
|
}
|
|
1028
1099
|
),
|
|
1029
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1100
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react14.X, { size: 16, className: "close-search", onClick: limparCampo })
|
|
1030
1101
|
] });
|
|
1031
1102
|
};
|
|
1032
1103
|
var TableHeader_default = TableHeader;
|
|
1033
1104
|
|
|
1034
1105
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
|
|
1035
|
-
var
|
|
1106
|
+
var import_react19 = require("@phosphor-icons/react");
|
|
1036
1107
|
|
|
1037
1108
|
// src/components/DataTableAdvancedFilter/TableActions.tsx
|
|
1038
|
-
var
|
|
1109
|
+
var import_react15 = require("@phosphor-icons/react");
|
|
1039
1110
|
|
|
1040
1111
|
// src/utils/utils.ts
|
|
1041
1112
|
var import_clsx = require("clsx");
|
|
@@ -1079,7 +1150,7 @@ function TableActions({
|
|
|
1079
1150
|
enableButtonsNotMultiplesSelecteds && "disable-button-table-actions"
|
|
1080
1151
|
),
|
|
1081
1152
|
disabled: enableButtonsNotMultiplesSelecteds,
|
|
1082
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1153
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react15.Plus, { size: 18 })
|
|
1083
1154
|
}
|
|
1084
1155
|
),
|
|
1085
1156
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
@@ -1102,7 +1173,7 @@ function TableActions({
|
|
|
1102
1173
|
),
|
|
1103
1174
|
disabled: disableButtonsNotMultiplesSelecteds,
|
|
1104
1175
|
children: [
|
|
1105
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1176
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react15.PencilSimple, { size: 18 }),
|
|
1106
1177
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1107
1178
|
TooltipCustom,
|
|
1108
1179
|
{
|
|
@@ -1125,7 +1196,7 @@ function TableActions({
|
|
|
1125
1196
|
),
|
|
1126
1197
|
disabled: !enableButtonsNotMultiplesSelecteds,
|
|
1127
1198
|
children: [
|
|
1128
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1199
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react15.Trash, { size: 18 }),
|
|
1129
1200
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1130
1201
|
TooltipCustom,
|
|
1131
1202
|
{
|
|
@@ -1157,7 +1228,7 @@ function TableActions({
|
|
|
1157
1228
|
}
|
|
1158
1229
|
|
|
1159
1230
|
// src/components/DataTableAdvancedFilter/ActionsColumn.tsx
|
|
1160
|
-
var
|
|
1231
|
+
var import_react16 = require("@phosphor-icons/react");
|
|
1161
1232
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1162
1233
|
function ActionsColumn({
|
|
1163
1234
|
row,
|
|
@@ -1179,7 +1250,7 @@ function ActionsColumn({
|
|
|
1179
1250
|
onEdit && onEdit([row]);
|
|
1180
1251
|
},
|
|
1181
1252
|
children: [
|
|
1182
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1253
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react16.PencilSimple, { size: 17, weight: "regular" }),
|
|
1183
1254
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1184
1255
|
TooltipCustom,
|
|
1185
1256
|
{
|
|
@@ -1201,7 +1272,7 @@ function ActionsColumn({
|
|
|
1201
1272
|
onDelete && onDelete([row]);
|
|
1202
1273
|
},
|
|
1203
1274
|
children: [
|
|
1204
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1275
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react16.Trash, { size: 17, weight: "regular" }),
|
|
1205
1276
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1206
1277
|
TooltipCustom,
|
|
1207
1278
|
{
|
|
@@ -1318,10 +1389,10 @@ function DynamicColumns({
|
|
|
1318
1389
|
}
|
|
1319
1390
|
|
|
1320
1391
|
// src/hooks/use-debounce.ts
|
|
1321
|
-
var
|
|
1392
|
+
var import_react17 = require("react");
|
|
1322
1393
|
var useDebounce = (value, delay) => {
|
|
1323
|
-
const [debouncedValue, setDebouncedValue] = (0,
|
|
1324
|
-
(0,
|
|
1394
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react17.useState)(value);
|
|
1395
|
+
(0, import_react17.useEffect)(() => {
|
|
1325
1396
|
const timer = setTimeout(() => {
|
|
1326
1397
|
setDebouncedValue(value);
|
|
1327
1398
|
}, delay || 500);
|
|
@@ -1353,8 +1424,8 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1353
1424
|
state,
|
|
1354
1425
|
onStateChange
|
|
1355
1426
|
}) {
|
|
1356
|
-
const [isClient, setIsClient] = (0,
|
|
1357
|
-
(0,
|
|
1427
|
+
const [isClient, setIsClient] = (0, import_react18.useState)(false);
|
|
1428
|
+
(0, import_react18.useEffect)(() => {
|
|
1358
1429
|
setIsClient(true);
|
|
1359
1430
|
}, []);
|
|
1360
1431
|
const initialState = state ?? {
|
|
@@ -1364,30 +1435,30 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1364
1435
|
sortOrder: sortOrderInitial,
|
|
1365
1436
|
filter: ""
|
|
1366
1437
|
};
|
|
1367
|
-
const [page, setPage] = (0,
|
|
1368
|
-
const [rows, setRows] = (0,
|
|
1369
|
-
const [first, setFirst] = (0,
|
|
1438
|
+
const [page, setPage] = (0, import_react18.useState)(initialState.page);
|
|
1439
|
+
const [rows, setRows] = (0, import_react18.useState)(initialState.rows);
|
|
1440
|
+
const [first, setFirst] = (0, import_react18.useState)(
|
|
1370
1441
|
(initialState.page - 1) * initialState.rows
|
|
1371
1442
|
);
|
|
1372
|
-
const [sortField, setSortField] = (0,
|
|
1373
|
-
const [sortOrder, setSortOrder] = (0,
|
|
1443
|
+
const [sortField, setSortField] = (0, import_react18.useState)(initialState.sortField);
|
|
1444
|
+
const [sortOrder, setSortOrder] = (0, import_react18.useState)(
|
|
1374
1445
|
initialState.sortOrder ?? 1
|
|
1375
1446
|
);
|
|
1376
|
-
const [searchText, setSearchText] = (0,
|
|
1377
|
-
const [filters, setFilters] = (0,
|
|
1447
|
+
const [searchText, setSearchText] = (0, import_react18.useState)(initialState.filter ?? "");
|
|
1448
|
+
const [filters, setFilters] = (0, import_react18.useState)({
|
|
1378
1449
|
...initFilters,
|
|
1379
1450
|
global: { value: initialState.filter, matchMode: "contains" }
|
|
1380
1451
|
});
|
|
1381
|
-
const [selectedRowsData, setSelectedRowsData] = (0,
|
|
1452
|
+
const [selectedRowsData, setSelectedRowsData] = (0, import_react18.useState)([]);
|
|
1382
1453
|
const debouncedSearch = useDebounce(searchText, 500);
|
|
1383
|
-
const debouncedFilters = (0,
|
|
1454
|
+
const debouncedFilters = (0, import_react18.useMemo)(() => {
|
|
1384
1455
|
const f = { ...filters };
|
|
1385
1456
|
if (!f.global) f.global = { value: "", matchMode: "contains" };
|
|
1386
1457
|
f.global.value = debouncedSearch;
|
|
1387
1458
|
return f;
|
|
1388
1459
|
}, [filters, debouncedSearch]);
|
|
1389
1460
|
const filtersKey = JSON.stringify(debouncedFilters);
|
|
1390
|
-
const globalFilterFields = (0,
|
|
1461
|
+
const globalFilterFields = (0, import_react18.useMemo)(() => {
|
|
1391
1462
|
return columns?.filter(
|
|
1392
1463
|
(col) => col.filterGlobal === true && (col.field !== "acoes" || col.field !== "actions")
|
|
1393
1464
|
).map((col) => col.field) ?? [];
|
|
@@ -1403,7 +1474,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1403
1474
|
globalFilterFields
|
|
1404
1475
|
)
|
|
1405
1476
|
});
|
|
1406
|
-
(0,
|
|
1477
|
+
(0, import_react18.useEffect)(() => {
|
|
1407
1478
|
if (!state) return;
|
|
1408
1479
|
setPage(state.page);
|
|
1409
1480
|
setRows(state.rows);
|
|
@@ -1459,7 +1530,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1459
1530
|
filter: searchText
|
|
1460
1531
|
});
|
|
1461
1532
|
};
|
|
1462
|
-
(0,
|
|
1533
|
+
(0, import_react18.useEffect)(() => {
|
|
1463
1534
|
emitStateChange({
|
|
1464
1535
|
page,
|
|
1465
1536
|
rows,
|
|
@@ -1468,7 +1539,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1468
1539
|
filter: debouncedSearch
|
|
1469
1540
|
});
|
|
1470
1541
|
}, [debouncedSearch]);
|
|
1471
|
-
(0,
|
|
1542
|
+
(0, import_react18.useEffect)(() => {
|
|
1472
1543
|
if (customers?.items && selectedRowsData.length > 0) {
|
|
1473
1544
|
const currentIds = new Set(customers.items.map((item) => item.id));
|
|
1474
1545
|
const filteredSelection = selectedRowsData.filter(
|
|
@@ -1479,7 +1550,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1479
1550
|
}
|
|
1480
1551
|
}
|
|
1481
1552
|
}, [customers?.items, selectedRowsData]);
|
|
1482
|
-
const TableHeaderAndTableActions = (0,
|
|
1553
|
+
const TableHeaderAndTableActions = (0, import_react18.useMemo)(
|
|
1483
1554
|
() => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
1484
1555
|
globalFilterFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1485
1556
|
TableHeader_default,
|
|
@@ -1540,7 +1611,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1540
1611
|
"--p-datepicker-prev-next": theme.colors.primary,
|
|
1541
1612
|
"--p-datepicker-button": theme.colors.primary
|
|
1542
1613
|
};
|
|
1543
|
-
(0,
|
|
1614
|
+
(0, import_react18.useEffect)(() => {
|
|
1544
1615
|
const root = document.documentElement;
|
|
1545
1616
|
root.style.setProperty(
|
|
1546
1617
|
"--p-column-filter-add-button-color",
|
|
@@ -1609,7 +1680,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1609
1680
|
onClick: options.onClick,
|
|
1610
1681
|
disabled: options.disabled,
|
|
1611
1682
|
className: `PrevPage ${options.disabled ? "PrevPageDisabled" : "PrevPageEnabled"}`,
|
|
1612
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1683
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react19.CaretLeft, { size: 18, color: "#fff" })
|
|
1613
1684
|
}
|
|
1614
1685
|
),
|
|
1615
1686
|
CurrentPageReport: (options) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "pageReport", children: [
|
|
@@ -1632,7 +1703,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1632
1703
|
onClick: options.onClick,
|
|
1633
1704
|
disabled: options.disabled,
|
|
1634
1705
|
className: `NextPage ${options.disabled ? "NextPageDisabled" : "NextPageEnabled"}`,
|
|
1635
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1706
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react19.CaretRight, { size: 18, color: "#fff" })
|
|
1636
1707
|
}
|
|
1637
1708
|
)
|
|
1638
1709
|
},
|
|
@@ -1858,14 +1929,14 @@ function DataTableAdvancedFilter({
|
|
|
1858
1929
|
state,
|
|
1859
1930
|
onStateChange
|
|
1860
1931
|
}) {
|
|
1861
|
-
const [isClient, setIsClient] = (0,
|
|
1862
|
-
(0,
|
|
1932
|
+
const [isClient, setIsClient] = (0, import_react20.useState)(false);
|
|
1933
|
+
(0, import_react20.useEffect)(() => {
|
|
1863
1934
|
(0, import_api2.addLocale)("pt", localePtBr);
|
|
1864
1935
|
}, []);
|
|
1865
|
-
(0,
|
|
1936
|
+
(0, import_react20.useEffect)(() => {
|
|
1866
1937
|
(0, import_api2.locale)(isLanguagePtBr ? "pt" : "en");
|
|
1867
1938
|
}, [isLanguagePtBr]);
|
|
1868
|
-
(0,
|
|
1939
|
+
(0, import_react20.useEffect)(() => {
|
|
1869
1940
|
setIsClient(true);
|
|
1870
1941
|
}, []);
|
|
1871
1942
|
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",
|
|
@@ -76,6 +80,9 @@ var defaultTheme = {
|
|
|
76
80
|
height: "2.5rem",
|
|
77
81
|
minWidth: "8rem",
|
|
78
82
|
radius: "6px"
|
|
83
|
+
},
|
|
84
|
+
lottie: {
|
|
85
|
+
basePath: "/lotties"
|
|
79
86
|
}
|
|
80
87
|
},
|
|
81
88
|
table: {
|
|
@@ -127,6 +134,19 @@ var useLeafcodeTheme = () => useContext(ThemeContext);
|
|
|
127
134
|
|
|
128
135
|
// src/components/Button/Button.tsx
|
|
129
136
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
137
|
+
var DEFAULT_LOTTIE_BASE_PATH = "/lotties";
|
|
138
|
+
function normalizeLottieFileName(fileName) {
|
|
139
|
+
return fileName.endsWith(".json") ? fileName : `${fileName}.json`;
|
|
140
|
+
}
|
|
141
|
+
function resolveLottieFileUrl(basePath, fileName) {
|
|
142
|
+
const normalizedBasePath = basePath.endsWith("/") ? basePath.slice(0, -1) : basePath;
|
|
143
|
+
const normalizedFileName = normalizeLottieFileName(fileName);
|
|
144
|
+
const fullPath = `${normalizedBasePath}/${normalizedFileName}`;
|
|
145
|
+
if (normalizedBasePath.startsWith("./") || normalizedBasePath.startsWith("../")) {
|
|
146
|
+
return new URL(fullPath, import.meta.url).href;
|
|
147
|
+
}
|
|
148
|
+
return fullPath;
|
|
149
|
+
}
|
|
130
150
|
function Button({
|
|
131
151
|
disabled,
|
|
132
152
|
loading,
|
|
@@ -134,9 +154,46 @@ function Button({
|
|
|
134
154
|
type,
|
|
135
155
|
onClick,
|
|
136
156
|
title,
|
|
157
|
+
className,
|
|
158
|
+
loadingLottieFileName,
|
|
159
|
+
loadingLottieBasePath,
|
|
160
|
+
loadingLottieData,
|
|
137
161
|
...rest
|
|
138
162
|
}) {
|
|
139
163
|
const theme = useLeafcodeTheme();
|
|
164
|
+
const themeButtonLottie = theme.components.button.lottie;
|
|
165
|
+
const [resolvedLottieData, setResolvedLottieData] = useState(loadingLottieData ?? null);
|
|
166
|
+
const resolvedLottieFileName = loadingLottieFileName ?? themeButtonLottie?.fileName;
|
|
167
|
+
const resolvedLottieBasePath = loadingLottieBasePath ?? themeButtonLottie?.basePath ?? DEFAULT_LOTTIE_BASE_PATH;
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
if (loadingLottieData) {
|
|
170
|
+
setResolvedLottieData(loadingLottieData);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (!resolvedLottieFileName) {
|
|
174
|
+
setResolvedLottieData(null);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const controller = new AbortController();
|
|
178
|
+
const lottieUrl = resolveLottieFileUrl(
|
|
179
|
+
resolvedLottieBasePath,
|
|
180
|
+
resolvedLottieFileName
|
|
181
|
+
);
|
|
182
|
+
fetch(lottieUrl, { signal: controller.signal }).then((response) => {
|
|
183
|
+
if (!response.ok) {
|
|
184
|
+
throw new Error(`Failed to load lottie file: ${lottieUrl}`);
|
|
185
|
+
}
|
|
186
|
+
return response.json();
|
|
187
|
+
}).then((data) => {
|
|
188
|
+
setResolvedLottieData(data);
|
|
189
|
+
}).catch((error) => {
|
|
190
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
setResolvedLottieData(null);
|
|
194
|
+
});
|
|
195
|
+
return () => controller.abort();
|
|
196
|
+
}, [loadingLottieData, resolvedLottieFileName, resolvedLottieBasePath]);
|
|
140
197
|
const styleVars = {
|
|
141
198
|
"--button-font-family": theme.components.button.fonts.family,
|
|
142
199
|
"--button-font-weight": theme.components.button.fonts.weight,
|
|
@@ -152,16 +209,29 @@ function Button({
|
|
|
152
209
|
"--button-min-width": theme.components.button.sizes.minWidth,
|
|
153
210
|
"--button-border-radius": theme.components.button.sizes.radius
|
|
154
211
|
};
|
|
212
|
+
const resolvedClassName = [
|
|
213
|
+
"box-button",
|
|
214
|
+
disabled || loading ? "button-disabled" : color === "danger" ? "button-secundary" : "button-primary",
|
|
215
|
+
className
|
|
216
|
+
].filter(Boolean).join(" ");
|
|
155
217
|
return /* @__PURE__ */ jsx2(
|
|
156
218
|
"button",
|
|
157
219
|
{
|
|
158
220
|
type,
|
|
159
221
|
style: styleVars,
|
|
160
|
-
className:
|
|
222
|
+
className: resolvedClassName,
|
|
161
223
|
onClick: !loading ? onClick : void 0,
|
|
162
224
|
disabled: disabled || loading,
|
|
163
225
|
...rest,
|
|
164
|
-
children: loading ? /* @__PURE__ */ jsx2("span", { className: "box-loading", children: /* @__PURE__ */
|
|
226
|
+
children: loading ? /* @__PURE__ */ jsx2("span", { className: "box-loading", children: resolvedLottieData ? /* @__PURE__ */ jsx2(
|
|
227
|
+
Lottie,
|
|
228
|
+
{
|
|
229
|
+
animationData: resolvedLottieData,
|
|
230
|
+
autoplay: true,
|
|
231
|
+
loop: true,
|
|
232
|
+
className: "button-lottie-loading"
|
|
233
|
+
}
|
|
234
|
+
) : /* @__PURE__ */ jsxs(
|
|
165
235
|
"svg",
|
|
166
236
|
{
|
|
167
237
|
className: "animate-spin",
|
|
@@ -219,12 +289,12 @@ function TooltipCustom({ label, id }) {
|
|
|
219
289
|
// src/components/Input/Input.tsx
|
|
220
290
|
import {
|
|
221
291
|
forwardRef,
|
|
222
|
-
useState as
|
|
292
|
+
useState as useState3
|
|
223
293
|
} from "react";
|
|
224
294
|
|
|
225
295
|
// src/components/Tooltips/TooltipErrorInput.tsx
|
|
226
296
|
import { WarningCircle, X } from "@phosphor-icons/react";
|
|
227
|
-
import { useEffect, useState } from "react";
|
|
297
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
228
298
|
import { Tooltip as Tooltip2 } from "react-tooltip";
|
|
229
299
|
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
230
300
|
function TooltipErrorInput({
|
|
@@ -245,9 +315,9 @@ function TooltipErrorInput({
|
|
|
245
315
|
"--input-error-border": theme.colors.danger,
|
|
246
316
|
"--input-font-size-tooltip": theme.components.tooltip.fonts.TooltipSize
|
|
247
317
|
};
|
|
248
|
-
const [isTooltipOpen, setIsTooltipOpen] =
|
|
318
|
+
const [isTooltipOpen, setIsTooltipOpen] = useState2(true);
|
|
249
319
|
const handleClose = () => setIsTooltipOpen(false);
|
|
250
|
-
|
|
320
|
+
useEffect2(() => {
|
|
251
321
|
setIsTooltipOpen(true);
|
|
252
322
|
}, [error]);
|
|
253
323
|
return /* @__PURE__ */ jsx4(
|
|
@@ -360,7 +430,7 @@ var InputBase = ({
|
|
|
360
430
|
e.target.value = val;
|
|
361
431
|
onChange?.(e);
|
|
362
432
|
};
|
|
363
|
-
const [show, setShow] =
|
|
433
|
+
const [show, setShow] = useState3(false);
|
|
364
434
|
const isPassword = showPasswordToggle;
|
|
365
435
|
const handleClick = () => setShow(!show);
|
|
366
436
|
return /* @__PURE__ */ jsxs3(
|
|
@@ -491,8 +561,8 @@ var TextArea = forwardRef2(
|
|
|
491
561
|
// src/components/Input/InputSelect.tsx
|
|
492
562
|
import {
|
|
493
563
|
forwardRef as forwardRef3,
|
|
494
|
-
useEffect as
|
|
495
|
-
useState as
|
|
564
|
+
useEffect as useEffect3,
|
|
565
|
+
useState as useState4
|
|
496
566
|
} from "react";
|
|
497
567
|
import { Controller } from "react-hook-form";
|
|
498
568
|
import Select, { components } from "react-select";
|
|
@@ -539,10 +609,10 @@ var InputBase2 = ({
|
|
|
539
609
|
"--input-height": theme.components.input.sizes.height,
|
|
540
610
|
"--input-border-radius": theme.components.input.sizes.radius
|
|
541
611
|
};
|
|
542
|
-
const [menuPortalTarget, setMenuPortalTarget] =
|
|
612
|
+
const [menuPortalTarget, setMenuPortalTarget] = useState4(
|
|
543
613
|
null
|
|
544
614
|
);
|
|
545
|
-
|
|
615
|
+
useEffect3(() => {
|
|
546
616
|
setMenuPortalTarget(document.body);
|
|
547
617
|
}, []);
|
|
548
618
|
return /* @__PURE__ */ jsxs5("div", { className: "input-wrapper", style: styleVars, children: [
|
|
@@ -628,7 +698,7 @@ function FooterButtons({ children }) {
|
|
|
628
698
|
}
|
|
629
699
|
|
|
630
700
|
// src/components/ModalBase/ModalBase.tsx
|
|
631
|
-
import { useEffect as
|
|
701
|
+
import { useEffect as useEffect4 } from "react";
|
|
632
702
|
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
633
703
|
function ModalBase({
|
|
634
704
|
show,
|
|
@@ -658,7 +728,7 @@ function ModalBase({
|
|
|
658
728
|
// Sizes
|
|
659
729
|
"--modal-max-width": theme.components.modalBase.sizes.modalMaxWidth
|
|
660
730
|
};
|
|
661
|
-
|
|
731
|
+
useEffect4(() => {
|
|
662
732
|
const handleKeyDown = (event) => {
|
|
663
733
|
if (event.key === "Escape") {
|
|
664
734
|
onHide();
|
|
@@ -707,9 +777,9 @@ import { X as X3 } from "@phosphor-icons/react";
|
|
|
707
777
|
import _ from "lodash";
|
|
708
778
|
import {
|
|
709
779
|
forwardRef as forwardRef4,
|
|
710
|
-
useEffect as
|
|
780
|
+
useEffect as useEffect5,
|
|
711
781
|
useRef,
|
|
712
|
-
useState as
|
|
782
|
+
useState as useState5
|
|
713
783
|
} from "react";
|
|
714
784
|
import { useQuery } from "@tanstack/react-query";
|
|
715
785
|
|
|
@@ -759,7 +829,7 @@ function AutoCompleteInner(props, ref) {
|
|
|
759
829
|
} = props;
|
|
760
830
|
const theme = useLeafcodeTheme();
|
|
761
831
|
const inputRef = useRef(null);
|
|
762
|
-
const [placement, setPlacement] =
|
|
832
|
+
const [placement, setPlacement] = useState5("bottom");
|
|
763
833
|
const styleVars = {
|
|
764
834
|
// Fonts
|
|
765
835
|
"--label-font-family": theme.components.input.fonts.label,
|
|
@@ -779,10 +849,10 @@ function AutoCompleteInner(props, ref) {
|
|
|
779
849
|
"--input-height": theme.components.input.sizes.height,
|
|
780
850
|
"--input-border-radius": theme.components.input.sizes.radius
|
|
781
851
|
};
|
|
782
|
-
const [items, setItems] =
|
|
783
|
-
const [pageNumber, setPageNumber] =
|
|
784
|
-
const [search, setSearch] =
|
|
785
|
-
const [isOpen, setIsOpen] =
|
|
852
|
+
const [items, setItems] = useState5([]);
|
|
853
|
+
const [pageNumber, setPageNumber] = useState5(1);
|
|
854
|
+
const [search, setSearch] = useState5("");
|
|
855
|
+
const [isOpen, setIsOpen] = useState5(false);
|
|
786
856
|
const listRef = useRef(null);
|
|
787
857
|
const calculatePlacement = () => {
|
|
788
858
|
const input = inputRef.current;
|
|
@@ -797,7 +867,7 @@ function AutoCompleteInner(props, ref) {
|
|
|
797
867
|
setPlacement("bottom");
|
|
798
868
|
}
|
|
799
869
|
};
|
|
800
|
-
|
|
870
|
+
useEffect5(() => {
|
|
801
871
|
if (!isOpen) return;
|
|
802
872
|
calculatePlacement();
|
|
803
873
|
window.addEventListener("resize", calculatePlacement);
|
|
@@ -830,13 +900,13 @@ function AutoCompleteInner(props, ref) {
|
|
|
830
900
|
enabled: isOpen
|
|
831
901
|
});
|
|
832
902
|
const { data, isLoading } = query;
|
|
833
|
-
|
|
903
|
+
useEffect5(() => {
|
|
834
904
|
if (!data) return;
|
|
835
905
|
setItems(
|
|
836
906
|
(prev) => pageNumber === 1 ? data.items : [...prev, ...data.items]
|
|
837
907
|
);
|
|
838
908
|
}, [data, pageNumber]);
|
|
839
|
-
|
|
909
|
+
useEffect5(() => {
|
|
840
910
|
const debounced = _.debounce(() => {
|
|
841
911
|
setPageNumber(1);
|
|
842
912
|
setSearch(value ?? "");
|
|
@@ -936,10 +1006,10 @@ function AutoCompleteInner(props, ref) {
|
|
|
936
1006
|
var InputAutoComplete = forwardRef4(AutoCompleteInner);
|
|
937
1007
|
|
|
938
1008
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilter.tsx
|
|
939
|
-
import { useEffect as
|
|
1009
|
+
import { useEffect as useEffect8, useState as useState8 } from "react";
|
|
940
1010
|
|
|
941
1011
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
|
|
942
|
-
import { useEffect as
|
|
1012
|
+
import { useEffect as useEffect7, useMemo, useState as useState7 } from "react";
|
|
943
1013
|
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
944
1014
|
|
|
945
1015
|
// src/primereact-compat.ts
|
|
@@ -1265,10 +1335,10 @@ function DynamicColumns({
|
|
|
1265
1335
|
}
|
|
1266
1336
|
|
|
1267
1337
|
// src/hooks/use-debounce.ts
|
|
1268
|
-
import { useEffect as
|
|
1338
|
+
import { useEffect as useEffect6, useState as useState6 } from "react";
|
|
1269
1339
|
var useDebounce = (value, delay) => {
|
|
1270
|
-
const [debouncedValue, setDebouncedValue] =
|
|
1271
|
-
|
|
1340
|
+
const [debouncedValue, setDebouncedValue] = useState6(value);
|
|
1341
|
+
useEffect6(() => {
|
|
1272
1342
|
const timer = setTimeout(() => {
|
|
1273
1343
|
setDebouncedValue(value);
|
|
1274
1344
|
}, delay || 500);
|
|
@@ -1300,8 +1370,8 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1300
1370
|
state,
|
|
1301
1371
|
onStateChange
|
|
1302
1372
|
}) {
|
|
1303
|
-
const [isClient, setIsClient] =
|
|
1304
|
-
|
|
1373
|
+
const [isClient, setIsClient] = useState7(false);
|
|
1374
|
+
useEffect7(() => {
|
|
1305
1375
|
setIsClient(true);
|
|
1306
1376
|
}, []);
|
|
1307
1377
|
const initialState = state ?? {
|
|
@@ -1311,21 +1381,21 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1311
1381
|
sortOrder: sortOrderInitial,
|
|
1312
1382
|
filter: ""
|
|
1313
1383
|
};
|
|
1314
|
-
const [page, setPage] =
|
|
1315
|
-
const [rows, setRows] =
|
|
1316
|
-
const [first, setFirst] =
|
|
1384
|
+
const [page, setPage] = useState7(initialState.page);
|
|
1385
|
+
const [rows, setRows] = useState7(initialState.rows);
|
|
1386
|
+
const [first, setFirst] = useState7(
|
|
1317
1387
|
(initialState.page - 1) * initialState.rows
|
|
1318
1388
|
);
|
|
1319
|
-
const [sortField, setSortField] =
|
|
1320
|
-
const [sortOrder, setSortOrder] =
|
|
1389
|
+
const [sortField, setSortField] = useState7(initialState.sortField);
|
|
1390
|
+
const [sortOrder, setSortOrder] = useState7(
|
|
1321
1391
|
initialState.sortOrder ?? 1
|
|
1322
1392
|
);
|
|
1323
|
-
const [searchText, setSearchText] =
|
|
1324
|
-
const [filters, setFilters] =
|
|
1393
|
+
const [searchText, setSearchText] = useState7(initialState.filter ?? "");
|
|
1394
|
+
const [filters, setFilters] = useState7({
|
|
1325
1395
|
...initFilters,
|
|
1326
1396
|
global: { value: initialState.filter, matchMode: "contains" }
|
|
1327
1397
|
});
|
|
1328
|
-
const [selectedRowsData, setSelectedRowsData] =
|
|
1398
|
+
const [selectedRowsData, setSelectedRowsData] = useState7([]);
|
|
1329
1399
|
const debouncedSearch = useDebounce(searchText, 500);
|
|
1330
1400
|
const debouncedFilters = useMemo(() => {
|
|
1331
1401
|
const f = { ...filters };
|
|
@@ -1350,7 +1420,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1350
1420
|
globalFilterFields
|
|
1351
1421
|
)
|
|
1352
1422
|
});
|
|
1353
|
-
|
|
1423
|
+
useEffect7(() => {
|
|
1354
1424
|
if (!state) return;
|
|
1355
1425
|
setPage(state.page);
|
|
1356
1426
|
setRows(state.rows);
|
|
@@ -1406,7 +1476,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1406
1476
|
filter: searchText
|
|
1407
1477
|
});
|
|
1408
1478
|
};
|
|
1409
|
-
|
|
1479
|
+
useEffect7(() => {
|
|
1410
1480
|
emitStateChange({
|
|
1411
1481
|
page,
|
|
1412
1482
|
rows,
|
|
@@ -1415,7 +1485,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1415
1485
|
filter: debouncedSearch
|
|
1416
1486
|
});
|
|
1417
1487
|
}, [debouncedSearch]);
|
|
1418
|
-
|
|
1488
|
+
useEffect7(() => {
|
|
1419
1489
|
if (customers?.items && selectedRowsData.length > 0) {
|
|
1420
1490
|
const currentIds = new Set(customers.items.map((item) => item.id));
|
|
1421
1491
|
const filteredSelection = selectedRowsData.filter(
|
|
@@ -1487,7 +1557,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1487
1557
|
"--p-datepicker-prev-next": theme.colors.primary,
|
|
1488
1558
|
"--p-datepicker-button": theme.colors.primary
|
|
1489
1559
|
};
|
|
1490
|
-
|
|
1560
|
+
useEffect7(() => {
|
|
1491
1561
|
const root = document.documentElement;
|
|
1492
1562
|
root.style.setProperty(
|
|
1493
1563
|
"--p-column-filter-add-button-color",
|
|
@@ -1805,14 +1875,14 @@ function DataTableAdvancedFilter({
|
|
|
1805
1875
|
state,
|
|
1806
1876
|
onStateChange
|
|
1807
1877
|
}) {
|
|
1808
|
-
const [isClient, setIsClient] =
|
|
1809
|
-
|
|
1878
|
+
const [isClient, setIsClient] = useState8(false);
|
|
1879
|
+
useEffect8(() => {
|
|
1810
1880
|
addLocale("pt", localePtBr);
|
|
1811
1881
|
}, []);
|
|
1812
|
-
|
|
1882
|
+
useEffect8(() => {
|
|
1813
1883
|
locale(isLanguagePtBr ? "pt" : "en");
|
|
1814
1884
|
}, [isLanguagePtBr]);
|
|
1815
|
-
|
|
1885
|
+
useEffect8(() => {
|
|
1816
1886
|
setIsClient(true);
|
|
1817
1887
|
}, []);
|
|
1818
1888
|
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.97",
|
|
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
|
+
}
|