@charlesgomes/leafcode-shared-lib-react 1.0.95 → 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.
@@ -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: "#D4D4D8",
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: `box-button ${disabled || loading ? "button-disabled" : color === "danger" ? "button-secundary" : "button-primary"}`,
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.jsxs)(
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 import_react4 = require("react");
348
+ var import_react5 = require("react");
286
349
 
287
350
  // src/components/Tooltips/TooltipErrorInput.tsx
288
- var import_react2 = require("@phosphor-icons/react");
289
- var import_react3 = require("react");
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, import_react3.useState)(true);
373
+ const [isTooltipOpen, setIsTooltipOpen] = (0, import_react4.useState)(true);
311
374
  const handleClose = () => setIsTooltipOpen(false);
312
- (0, import_react3.useEffect)(() => {
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)(import_react2.WarningCircle, { size: 22, className: "tooltip-icon" })
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)(import_react2.X, { size: 16, weight: "bold" })
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 import_react5 = require("@phosphor-icons/react");
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, import_react4.useState)(false);
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)(import_react5.Eye, { size: 21 }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react5.EyeSlash, { size: 21 })
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, import_react4.forwardRef)(InputBase);
537
+ var Input = (0, import_react5.forwardRef)(InputBase);
475
538
 
476
539
  // src/components/Input/TextArea.tsx
477
- var import_react6 = require("react");
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, import_react6.forwardRef)(
612
+ var TextArea = (0, import_react7.forwardRef)(
550
613
  TextAreaBase
551
614
  );
552
615
 
553
616
  // src/components/Input/InputSelect.tsx
554
- var import_react7 = require("react");
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, import_react7.useState)(
663
+ const [menuPortalTarget, setMenuPortalTarget] = (0, import_react8.useState)(
601
664
  null
602
665
  );
603
- (0, import_react7.useEffect)(() => {
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, import_react7.forwardRef)(InputBase2);
740
+ var InputSelect = (0, import_react8.forwardRef)(InputBase2);
678
741
 
679
742
  // src/components/ModalBase/ModalBase.tsx
680
- var import_react8 = require("@phosphor-icons/react");
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 import_react9 = require("react");
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, import_react9.useEffect)(() => {
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)(import_react8.X, { size: 18, className: "button-close" }) })
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 import_react11 = require("@phosphor-icons/react");
827
+ var import_react12 = require("@phosphor-icons/react");
765
828
  var import_lodash2 = __toESM(require("lodash"));
766
- var import_react12 = require("react");
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 import_react10 = require("react");
833
+ var import_react11 = require("react");
771
834
  var import_jsx_runtime10 = require("react/jsx-runtime");
772
- var LoadingSpinner = (0, import_react10.memo)(({ size = 20 }) => {
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, import_react12.useRef)(null);
815
- const [placement, setPlacement] = (0, import_react12.useState)("bottom");
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, import_react12.useState)([]);
836
- const [pageNumber, setPageNumber] = (0, import_react12.useState)(1);
837
- const [search, setSearch] = (0, import_react12.useState)("");
838
- const [isOpen, setIsOpen] = (0, import_react12.useState)(false);
839
- const listRef = (0, import_react12.useRef)(null);
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, import_react12.useEffect)(() => {
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, import_react12.useEffect)(() => {
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, import_react12.useEffect)(() => {
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)(import_react11.X, { size: 16, color: "#bf1717" })
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, import_react12.forwardRef)(AutoCompleteInner);
1052
+ var InputAutoComplete = (0, import_react13.forwardRef)(AutoCompleteInner);
990
1053
 
991
1054
  // src/components/DataTableAdvancedFilter/DataTableAdvancedFilter.tsx
992
- var import_react19 = require("react");
1055
+ var import_react20 = require("react");
993
1056
 
994
1057
  // src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
995
- var import_react17 = require("react");
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 import_react13 = require("@phosphor-icons/react");
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)(import_react13.X, { size: 16, className: "close-search", onClick: limparCampo })
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 import_react18 = require("@phosphor-icons/react");
1098
+ var import_react19 = require("@phosphor-icons/react");
1036
1099
 
1037
1100
  // src/components/DataTableAdvancedFilter/TableActions.tsx
1038
- var import_react14 = require("@phosphor-icons/react");
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)(import_react14.Plus, { size: 18 })
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)(import_react14.PencilSimple, { size: 18 }),
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)(import_react14.Trash, { size: 18 }),
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 import_react15 = require("@phosphor-icons/react");
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,
@@ -1179,7 +1242,7 @@ function ActionsColumn({
1179
1242
  onEdit && onEdit([row]);
1180
1243
  },
1181
1244
  children: [
1182
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react15.PencilSimple, { size: 17, weight: "regular" }),
1245
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react16.PencilSimple, { size: 17, weight: "regular" }),
1183
1246
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1184
1247
  TooltipCustom,
1185
1248
  {
@@ -1201,7 +1264,7 @@ function ActionsColumn({
1201
1264
  onDelete && onDelete([row]);
1202
1265
  },
1203
1266
  children: [
1204
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react15.Trash, { size: 17, weight: "regular" }),
1267
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react16.Trash, { size: 17, weight: "regular" }),
1205
1268
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1206
1269
  TooltipCustom,
1207
1270
  {
@@ -1318,10 +1381,10 @@ function DynamicColumns({
1318
1381
  }
1319
1382
 
1320
1383
  // src/hooks/use-debounce.ts
1321
- var import_react16 = require("react");
1384
+ var import_react17 = require("react");
1322
1385
  var useDebounce = (value, delay) => {
1323
- const [debouncedValue, setDebouncedValue] = (0, import_react16.useState)(value);
1324
- (0, import_react16.useEffect)(() => {
1386
+ const [debouncedValue, setDebouncedValue] = (0, import_react17.useState)(value);
1387
+ (0, import_react17.useEffect)(() => {
1325
1388
  const timer = setTimeout(() => {
1326
1389
  setDebouncedValue(value);
1327
1390
  }, delay || 500);
@@ -1353,8 +1416,8 @@ function DataTableAdvancedFilterWrapper({
1353
1416
  state,
1354
1417
  onStateChange
1355
1418
  }) {
1356
- const [isClient, setIsClient] = (0, import_react17.useState)(false);
1357
- (0, import_react17.useEffect)(() => {
1419
+ const [isClient, setIsClient] = (0, import_react18.useState)(false);
1420
+ (0, import_react18.useEffect)(() => {
1358
1421
  setIsClient(true);
1359
1422
  }, []);
1360
1423
  const initialState = state ?? {
@@ -1364,30 +1427,30 @@ function DataTableAdvancedFilterWrapper({
1364
1427
  sortOrder: sortOrderInitial,
1365
1428
  filter: ""
1366
1429
  };
1367
- const [page, setPage] = (0, import_react17.useState)(initialState.page);
1368
- const [rows, setRows] = (0, import_react17.useState)(initialState.rows);
1369
- const [first, setFirst] = (0, import_react17.useState)(
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)(
1370
1433
  (initialState.page - 1) * initialState.rows
1371
1434
  );
1372
- const [sortField, setSortField] = (0, import_react17.useState)(initialState.sortField);
1373
- const [sortOrder, setSortOrder] = (0, import_react17.useState)(
1435
+ const [sortField, setSortField] = (0, import_react18.useState)(initialState.sortField);
1436
+ const [sortOrder, setSortOrder] = (0, import_react18.useState)(
1374
1437
  initialState.sortOrder ?? 1
1375
1438
  );
1376
- const [searchText, setSearchText] = (0, import_react17.useState)(initialState.filter ?? "");
1377
- const [filters, setFilters] = (0, import_react17.useState)({
1439
+ const [searchText, setSearchText] = (0, import_react18.useState)(initialState.filter ?? "");
1440
+ const [filters, setFilters] = (0, import_react18.useState)({
1378
1441
  ...initFilters,
1379
1442
  global: { value: initialState.filter, matchMode: "contains" }
1380
1443
  });
1381
- const [selectedRowsData, setSelectedRowsData] = (0, import_react17.useState)([]);
1444
+ const [selectedRowsData, setSelectedRowsData] = (0, import_react18.useState)([]);
1382
1445
  const debouncedSearch = useDebounce(searchText, 500);
1383
- const debouncedFilters = (0, import_react17.useMemo)(() => {
1446
+ const debouncedFilters = (0, import_react18.useMemo)(() => {
1384
1447
  const f = { ...filters };
1385
1448
  if (!f.global) f.global = { value: "", matchMode: "contains" };
1386
1449
  f.global.value = debouncedSearch;
1387
1450
  return f;
1388
1451
  }, [filters, debouncedSearch]);
1389
1452
  const filtersKey = JSON.stringify(debouncedFilters);
1390
- const globalFilterFields = (0, import_react17.useMemo)(() => {
1453
+ const globalFilterFields = (0, import_react18.useMemo)(() => {
1391
1454
  return columns?.filter(
1392
1455
  (col) => col.filterGlobal === true && (col.field !== "acoes" || col.field !== "actions")
1393
1456
  ).map((col) => col.field) ?? [];
@@ -1403,7 +1466,7 @@ function DataTableAdvancedFilterWrapper({
1403
1466
  globalFilterFields
1404
1467
  )
1405
1468
  });
1406
- (0, import_react17.useEffect)(() => {
1469
+ (0, import_react18.useEffect)(() => {
1407
1470
  if (!state) return;
1408
1471
  setPage(state.page);
1409
1472
  setRows(state.rows);
@@ -1459,7 +1522,7 @@ function DataTableAdvancedFilterWrapper({
1459
1522
  filter: searchText
1460
1523
  });
1461
1524
  };
1462
- (0, import_react17.useEffect)(() => {
1525
+ (0, import_react18.useEffect)(() => {
1463
1526
  emitStateChange({
1464
1527
  page,
1465
1528
  rows,
@@ -1468,7 +1531,7 @@ function DataTableAdvancedFilterWrapper({
1468
1531
  filter: debouncedSearch
1469
1532
  });
1470
1533
  }, [debouncedSearch]);
1471
- (0, import_react17.useEffect)(() => {
1534
+ (0, import_react18.useEffect)(() => {
1472
1535
  if (customers?.items && selectedRowsData.length > 0) {
1473
1536
  const currentIds = new Set(customers.items.map((item) => item.id));
1474
1537
  const filteredSelection = selectedRowsData.filter(
@@ -1479,7 +1542,7 @@ function DataTableAdvancedFilterWrapper({
1479
1542
  }
1480
1543
  }
1481
1544
  }, [customers?.items, selectedRowsData]);
1482
- const TableHeaderAndTableActions = (0, import_react17.useMemo)(
1545
+ const TableHeaderAndTableActions = (0, import_react18.useMemo)(
1483
1546
  () => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
1484
1547
  globalFilterFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1485
1548
  TableHeader_default,
@@ -1540,7 +1603,7 @@ function DataTableAdvancedFilterWrapper({
1540
1603
  "--p-datepicker-prev-next": theme.colors.primary,
1541
1604
  "--p-datepicker-button": theme.colors.primary
1542
1605
  };
1543
- (0, import_react17.useEffect)(() => {
1606
+ (0, import_react18.useEffect)(() => {
1544
1607
  const root = document.documentElement;
1545
1608
  root.style.setProperty(
1546
1609
  "--p-column-filter-add-button-color",
@@ -1609,7 +1672,7 @@ function DataTableAdvancedFilterWrapper({
1609
1672
  onClick: options.onClick,
1610
1673
  disabled: options.disabled,
1611
1674
  className: `PrevPage ${options.disabled ? "PrevPageDisabled" : "PrevPageEnabled"}`,
1612
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react18.CaretLeft, { size: 18, color: "#fff" })
1675
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react19.CaretLeft, { size: 18, color: "#fff" })
1613
1676
  }
1614
1677
  ),
1615
1678
  CurrentPageReport: (options) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "pageReport", children: [
@@ -1632,7 +1695,7 @@ function DataTableAdvancedFilterWrapper({
1632
1695
  onClick: options.onClick,
1633
1696
  disabled: options.disabled,
1634
1697
  className: `NextPage ${options.disabled ? "NextPageDisabled" : "NextPageEnabled"}`,
1635
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react18.CaretRight, { size: 18, color: "#fff" })
1698
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react19.CaretRight, { size: 18, color: "#fff" })
1636
1699
  }
1637
1700
  )
1638
1701
  },
@@ -1858,14 +1921,14 @@ function DataTableAdvancedFilter({
1858
1921
  state,
1859
1922
  onStateChange
1860
1923
  }) {
1861
- const [isClient, setIsClient] = (0, import_react19.useState)(false);
1862
- (0, import_react19.useEffect)(() => {
1924
+ const [isClient, setIsClient] = (0, import_react20.useState)(false);
1925
+ (0, import_react20.useEffect)(() => {
1863
1926
  (0, import_api2.addLocale)("pt", localePtBr);
1864
1927
  }, []);
1865
- (0, import_react19.useEffect)(() => {
1928
+ (0, import_react20.useEffect)(() => {
1866
1929
  (0, import_api2.locale)(isLanguagePtBr ? "pt" : "en");
1867
1930
  }, [isLanguagePtBr]);
1868
- (0, import_react19.useEffect)(() => {
1931
+ (0, import_react20.useEffect)(() => {
1869
1932
  setIsClient(true);
1870
1933
  }, []);
1871
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: "#D4D4D8",
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: `box-button ${disabled || loading ? "button-disabled" : color === "danger" ? "button-secundary" : "button-primary"}`,
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__ */ jsxs(
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 useState2
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] = useState(true);
310
+ const [isTooltipOpen, setIsTooltipOpen] = useState2(true);
249
311
  const handleClose = () => setIsTooltipOpen(false);
250
- useEffect(() => {
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] = useState2(false);
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 useEffect2,
495
- useState as useState3
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] = useState3(
604
+ const [menuPortalTarget, setMenuPortalTarget] = useState4(
543
605
  null
544
606
  );
545
- useEffect2(() => {
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 useEffect3 } from "react";
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
- useEffect3(() => {
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 useEffect4,
772
+ useEffect as useEffect5,
711
773
  useRef,
712
- useState as useState4
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] = useState4("bottom");
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] = useState4([]);
783
- const [pageNumber, setPageNumber] = useState4(1);
784
- const [search, setSearch] = useState4("");
785
- const [isOpen, setIsOpen] = useState4(false);
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
- useEffect4(() => {
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
- useEffect4(() => {
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
- useEffect4(() => {
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 useEffect7, useState as useState7 } from "react";
1001
+ import { useEffect as useEffect8, useState as useState8 } from "react";
940
1002
 
941
1003
  // src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
942
- import { useEffect as useEffect6, useMemo, useState as useState6 } from "react";
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
@@ -1265,10 +1327,10 @@ function DynamicColumns({
1265
1327
  }
1266
1328
 
1267
1329
  // src/hooks/use-debounce.ts
1268
- import { useEffect as useEffect5, useState as useState5 } from "react";
1330
+ import { useEffect as useEffect6, useState as useState6 } from "react";
1269
1331
  var useDebounce = (value, delay) => {
1270
- const [debouncedValue, setDebouncedValue] = useState5(value);
1271
- useEffect5(() => {
1332
+ const [debouncedValue, setDebouncedValue] = useState6(value);
1333
+ useEffect6(() => {
1272
1334
  const timer = setTimeout(() => {
1273
1335
  setDebouncedValue(value);
1274
1336
  }, delay || 500);
@@ -1300,8 +1362,8 @@ function DataTableAdvancedFilterWrapper({
1300
1362
  state,
1301
1363
  onStateChange
1302
1364
  }) {
1303
- const [isClient, setIsClient] = useState6(false);
1304
- useEffect6(() => {
1365
+ const [isClient, setIsClient] = useState7(false);
1366
+ useEffect7(() => {
1305
1367
  setIsClient(true);
1306
1368
  }, []);
1307
1369
  const initialState = state ?? {
@@ -1311,21 +1373,21 @@ function DataTableAdvancedFilterWrapper({
1311
1373
  sortOrder: sortOrderInitial,
1312
1374
  filter: ""
1313
1375
  };
1314
- const [page, setPage] = useState6(initialState.page);
1315
- const [rows, setRows] = useState6(initialState.rows);
1316
- const [first, setFirst] = useState6(
1376
+ const [page, setPage] = useState7(initialState.page);
1377
+ const [rows, setRows] = useState7(initialState.rows);
1378
+ const [first, setFirst] = useState7(
1317
1379
  (initialState.page - 1) * initialState.rows
1318
1380
  );
1319
- const [sortField, setSortField] = useState6(initialState.sortField);
1320
- const [sortOrder, setSortOrder] = useState6(
1381
+ const [sortField, setSortField] = useState7(initialState.sortField);
1382
+ const [sortOrder, setSortOrder] = useState7(
1321
1383
  initialState.sortOrder ?? 1
1322
1384
  );
1323
- const [searchText, setSearchText] = useState6(initialState.filter ?? "");
1324
- const [filters, setFilters] = useState6({
1385
+ const [searchText, setSearchText] = useState7(initialState.filter ?? "");
1386
+ const [filters, setFilters] = useState7({
1325
1387
  ...initFilters,
1326
1388
  global: { value: initialState.filter, matchMode: "contains" }
1327
1389
  });
1328
- const [selectedRowsData, setSelectedRowsData] = useState6([]);
1390
+ const [selectedRowsData, setSelectedRowsData] = useState7([]);
1329
1391
  const debouncedSearch = useDebounce(searchText, 500);
1330
1392
  const debouncedFilters = useMemo(() => {
1331
1393
  const f = { ...filters };
@@ -1350,7 +1412,7 @@ function DataTableAdvancedFilterWrapper({
1350
1412
  globalFilterFields
1351
1413
  )
1352
1414
  });
1353
- useEffect6(() => {
1415
+ useEffect7(() => {
1354
1416
  if (!state) return;
1355
1417
  setPage(state.page);
1356
1418
  setRows(state.rows);
@@ -1406,7 +1468,7 @@ function DataTableAdvancedFilterWrapper({
1406
1468
  filter: searchText
1407
1469
  });
1408
1470
  };
1409
- useEffect6(() => {
1471
+ useEffect7(() => {
1410
1472
  emitStateChange({
1411
1473
  page,
1412
1474
  rows,
@@ -1415,7 +1477,7 @@ function DataTableAdvancedFilterWrapper({
1415
1477
  filter: debouncedSearch
1416
1478
  });
1417
1479
  }, [debouncedSearch]);
1418
- useEffect6(() => {
1480
+ useEffect7(() => {
1419
1481
  if (customers?.items && selectedRowsData.length > 0) {
1420
1482
  const currentIds = new Set(customers.items.map((item) => item.id));
1421
1483
  const filteredSelection = selectedRowsData.filter(
@@ -1487,7 +1549,7 @@ function DataTableAdvancedFilterWrapper({
1487
1549
  "--p-datepicker-prev-next": theme.colors.primary,
1488
1550
  "--p-datepicker-button": theme.colors.primary
1489
1551
  };
1490
- useEffect6(() => {
1552
+ useEffect7(() => {
1491
1553
  const root = document.documentElement;
1492
1554
  root.style.setProperty(
1493
1555
  "--p-column-filter-add-button-color",
@@ -1805,14 +1867,14 @@ function DataTableAdvancedFilter({
1805
1867
  state,
1806
1868
  onStateChange
1807
1869
  }) {
1808
- const [isClient, setIsClient] = useState7(false);
1809
- useEffect7(() => {
1870
+ const [isClient, setIsClient] = useState8(false);
1871
+ useEffect8(() => {
1810
1872
  addLocale("pt", localePtBr);
1811
1873
  }, []);
1812
- useEffect7(() => {
1874
+ useEffect8(() => {
1813
1875
  locale(isLanguagePtBr ? "pt" : "en");
1814
1876
  }, [isLanguagePtBr]);
1815
- useEffect7(() => {
1877
+ useEffect8(() => {
1816
1878
  setIsClient(true);
1817
1879
  }, []);
1818
1880
  return /* @__PURE__ */ jsx17(Fragment7, { children: isClient && /* @__PURE__ */ jsx17(
@@ -79,9 +79,21 @@
79
79
  }
80
80
 
81
81
  .animate-spin {
82
- height: 1.25rem;
83
- width: 1.25rem;
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.95",
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
+ }