analytica-frontend-lib 1.0.17 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +201 -0
- package/dist/index.d.mts +81 -2
- package/dist/index.d.ts +81 -2
- package/dist/index.js +254 -41
- package/dist/index.mjs +246 -38
- package/package.json +5 -2
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
Badge: () => Badge,
|
|
23
24
|
Button: () => Button,
|
|
24
25
|
CheckBox: () => CheckBox,
|
|
25
26
|
DropdownMenu: () => DropdownMenu,
|
|
@@ -40,7 +41,11 @@ __export(index_exports, {
|
|
|
40
41
|
TableHead: () => TableHead,
|
|
41
42
|
TableHeader: () => TableHeader,
|
|
42
43
|
TableRow: () => TableRow,
|
|
43
|
-
Text: () => Text
|
|
44
|
+
Text: () => Text,
|
|
45
|
+
Toast: () => Toast,
|
|
46
|
+
Toaster: () => Toaster,
|
|
47
|
+
useToast: () => useToast,
|
|
48
|
+
useToastStore: () => useToastStore
|
|
44
49
|
});
|
|
45
50
|
module.exports = __toCommonJS(index_exports);
|
|
46
51
|
|
|
@@ -252,11 +257,101 @@ var Text = ({
|
|
|
252
257
|
);
|
|
253
258
|
};
|
|
254
259
|
|
|
255
|
-
// src/components/
|
|
256
|
-
var import_react2 = require("react");
|
|
260
|
+
// src/components/Badge/Badge.tsx
|
|
257
261
|
var import_phosphor_react = require("phosphor-react");
|
|
258
262
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
263
|
+
var VARIANT_ACTION_CLASSES2 = {
|
|
264
|
+
solid: {
|
|
265
|
+
error: "bg-error text-error-700 focus-visible:outline-none",
|
|
266
|
+
warning: "bg-warning text-warning-800 focus-visible:outline-none",
|
|
267
|
+
success: "bg-success text-success-800 focus-visible:outline-none",
|
|
268
|
+
info: "bg-info text-info-800 focus-visible:outline-none",
|
|
269
|
+
muted: "bg-background-muted text-background-800 focus-visible:outline-none"
|
|
270
|
+
},
|
|
271
|
+
outlined: {
|
|
272
|
+
error: "bg-error text-error-700 border border-error-300 focus-visible:outline-none",
|
|
273
|
+
warning: "bg-warning text-warning-800 border border-warning-300 focus-visible:outline-none",
|
|
274
|
+
success: "bg-success text-success-800 border border-success-300 focus-visible:outline-none",
|
|
275
|
+
info: "bg-info text-info-800 border border-info-300 focus-visible:outline-none",
|
|
276
|
+
muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
|
|
277
|
+
},
|
|
278
|
+
exams: {
|
|
279
|
+
exam1: "bg-exame-1 text-info-200 focus-visible:outline-none",
|
|
280
|
+
exam2: "bg-exame-2 text-typography-1 focus-visible:outline-none",
|
|
281
|
+
exam3: "bg-exame-3 text-typography-2 focus-visible:outline-none",
|
|
282
|
+
exam4: "bg-exame-4 text-success-700 focus-visible:outline-none"
|
|
283
|
+
},
|
|
284
|
+
resultStatus: {
|
|
285
|
+
negative: "bg-error text-error-800 focus-visible:outline-none",
|
|
286
|
+
positive: "bg-success text-success-800 focus-visible:outline-none"
|
|
287
|
+
},
|
|
288
|
+
notification: "text-primary"
|
|
289
|
+
};
|
|
259
290
|
var SIZE_CLASSES2 = {
|
|
291
|
+
small: "text-2xs px-2 py-1",
|
|
292
|
+
medium: "text-xs px-2 py-1",
|
|
293
|
+
large: "text-sm px-2 py-1"
|
|
294
|
+
};
|
|
295
|
+
var SIZE_CLASSES_ICON = {
|
|
296
|
+
small: "size-3",
|
|
297
|
+
medium: "size-3.5",
|
|
298
|
+
large: "size-4"
|
|
299
|
+
};
|
|
300
|
+
var Badge = ({
|
|
301
|
+
children,
|
|
302
|
+
iconLeft,
|
|
303
|
+
iconRight,
|
|
304
|
+
size = "medium",
|
|
305
|
+
variant = "solid",
|
|
306
|
+
action = "error",
|
|
307
|
+
className = "",
|
|
308
|
+
notificationActive = false,
|
|
309
|
+
...props
|
|
310
|
+
}) => {
|
|
311
|
+
const sizeClasses = SIZE_CLASSES2[size];
|
|
312
|
+
const sizeClassesIcon = SIZE_CLASSES_ICON[size];
|
|
313
|
+
const variantActionMap = VARIANT_ACTION_CLASSES2[variant] || {};
|
|
314
|
+
const variantClasses = typeof variantActionMap === "string" ? variantActionMap : variantActionMap[action] ?? variantActionMap.muted ?? "";
|
|
315
|
+
const baseClasses = "inline-flex items-center justify-center rounded-xs font-medium gap-1 relative";
|
|
316
|
+
const baseClassesIcon = "flex items-center";
|
|
317
|
+
if (variant === "notification") {
|
|
318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
319
|
+
"div",
|
|
320
|
+
{
|
|
321
|
+
className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
|
|
322
|
+
...props,
|
|
323
|
+
children: [
|
|
324
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react.Bell, { size: 24, className: "text-primary-950" }),
|
|
325
|
+
notificationActive && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
326
|
+
"span",
|
|
327
|
+
{
|
|
328
|
+
"data-testid": "notification-dot",
|
|
329
|
+
className: "absolute top-[5px] right-[10px] block h-2 w-2 rounded-full bg-indicator-error ring-2 ring-white"
|
|
330
|
+
}
|
|
331
|
+
)
|
|
332
|
+
]
|
|
333
|
+
}
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
337
|
+
"div",
|
|
338
|
+
{
|
|
339
|
+
className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
|
|
340
|
+
...props,
|
|
341
|
+
children: [
|
|
342
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: `${baseClassesIcon} ${sizeClassesIcon}`, children: iconLeft }),
|
|
343
|
+
children,
|
|
344
|
+
iconRight && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: `${baseClassesIcon} ${sizeClassesIcon}`, children: iconRight })
|
|
345
|
+
]
|
|
346
|
+
}
|
|
347
|
+
);
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
// src/components/CheckBox/CheckBox.tsx
|
|
351
|
+
var import_react2 = require("react");
|
|
352
|
+
var import_phosphor_react2 = require("phosphor-react");
|
|
353
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
354
|
+
var SIZE_CLASSES3 = {
|
|
260
355
|
small: {
|
|
261
356
|
checkbox: "w-4 h-4",
|
|
262
357
|
// 16px x 16px
|
|
@@ -343,15 +438,15 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
343
438
|
onChange?.(event);
|
|
344
439
|
};
|
|
345
440
|
const currentState = disabled ? "disabled" : state;
|
|
346
|
-
const sizeClasses =
|
|
441
|
+
const sizeClasses = SIZE_CLASSES3[size];
|
|
347
442
|
const checkVariant = checked || indeterminate ? "checked" : "unchecked";
|
|
348
443
|
const stylingClasses = STATE_CLASSES[currentState][checkVariant];
|
|
349
444
|
const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
|
|
350
445
|
const checkboxClasses = `${BASE_CHECKBOX_CLASSES} ${sizeClasses.checkbox} ${borderWidthClass} ${stylingClasses} ${className}`;
|
|
351
446
|
const renderIcon = () => {
|
|
352
447
|
if (indeterminate) {
|
|
353
|
-
return /* @__PURE__ */ (0,
|
|
354
|
-
|
|
448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
449
|
+
import_phosphor_react2.Minus,
|
|
355
450
|
{
|
|
356
451
|
size: sizeClasses.iconSize,
|
|
357
452
|
weight: "bold",
|
|
@@ -360,8 +455,8 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
360
455
|
);
|
|
361
456
|
}
|
|
362
457
|
if (checked) {
|
|
363
|
-
return /* @__PURE__ */ (0,
|
|
364
|
-
|
|
458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
459
|
+
import_phosphor_react2.Check,
|
|
365
460
|
{
|
|
366
461
|
size: sizeClasses.iconSize,
|
|
367
462
|
weight: "bold",
|
|
@@ -371,13 +466,13 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
371
466
|
}
|
|
372
467
|
return null;
|
|
373
468
|
};
|
|
374
|
-
return /* @__PURE__ */ (0,
|
|
375
|
-
/* @__PURE__ */ (0,
|
|
469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col", children: [
|
|
470
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
376
471
|
"div",
|
|
377
472
|
{
|
|
378
473
|
className: `flex flex-row items-center ${sizeClasses.spacing} ${disabled ? "opacity-40" : ""}`,
|
|
379
474
|
children: [
|
|
380
|
-
/* @__PURE__ */ (0,
|
|
475
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
381
476
|
"input",
|
|
382
477
|
{
|
|
383
478
|
ref,
|
|
@@ -390,12 +485,12 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
390
485
|
...props
|
|
391
486
|
}
|
|
392
487
|
),
|
|
393
|
-
/* @__PURE__ */ (0,
|
|
394
|
-
label && /* @__PURE__ */ (0,
|
|
488
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
|
|
489
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
395
490
|
"div",
|
|
396
491
|
{
|
|
397
492
|
className: `flex flex-row items-center ${sizeClasses.labelHeight}`,
|
|
398
|
-
children: /* @__PURE__ */ (0,
|
|
493
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
399
494
|
Text,
|
|
400
495
|
{
|
|
401
496
|
as: "label",
|
|
@@ -412,8 +507,8 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
412
507
|
]
|
|
413
508
|
}
|
|
414
509
|
),
|
|
415
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
416
|
-
helperText && !errorMessage && /* @__PURE__ */ (0,
|
|
510
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-error-600", children: errorMessage }),
|
|
511
|
+
helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-text-500", children: helperText })
|
|
417
512
|
] });
|
|
418
513
|
}
|
|
419
514
|
);
|
|
@@ -421,23 +516,23 @@ CheckBox.displayName = "CheckBox";
|
|
|
421
516
|
|
|
422
517
|
// src/components/Table/Table.tsx
|
|
423
518
|
var import_react3 = require("react");
|
|
424
|
-
var
|
|
519
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
425
520
|
var Table = (0, import_react3.forwardRef)(
|
|
426
|
-
({ className, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
521
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "border border-border-200 rounded-xl relative w-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
427
522
|
"table",
|
|
428
523
|
{
|
|
429
524
|
ref,
|
|
430
525
|
className: `w-full caption-bottom text-sm ${className ?? ""}`,
|
|
431
526
|
...props,
|
|
432
527
|
children: [
|
|
433
|
-
/* @__PURE__ */ (0,
|
|
528
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("caption", { className: "sr-only", children: "My Table" }),
|
|
434
529
|
children
|
|
435
530
|
]
|
|
436
531
|
}
|
|
437
532
|
) })
|
|
438
533
|
);
|
|
439
534
|
Table.displayName = "Table";
|
|
440
|
-
var TableHeader = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
535
|
+
var TableHeader = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
441
536
|
"thead",
|
|
442
537
|
{
|
|
443
538
|
ref,
|
|
@@ -446,7 +541,7 @@ var TableHeader = (0, import_react3.forwardRef)(({ className, ...props }, ref) =
|
|
|
446
541
|
}
|
|
447
542
|
));
|
|
448
543
|
TableHeader.displayName = "TableHeader";
|
|
449
|
-
var TableBody = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
544
|
+
var TableBody = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
450
545
|
"tbody",
|
|
451
546
|
{
|
|
452
547
|
ref,
|
|
@@ -455,7 +550,7 @@ var TableBody = (0, import_react3.forwardRef)(({ className, ...props }, ref) =>
|
|
|
455
550
|
}
|
|
456
551
|
));
|
|
457
552
|
TableBody.displayName = "TableBody";
|
|
458
|
-
var TableFooter = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
553
|
+
var TableFooter = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
459
554
|
"tfoot",
|
|
460
555
|
{
|
|
461
556
|
ref,
|
|
@@ -472,7 +567,7 @@ var VARIANT_STATES_ROW = {
|
|
|
472
567
|
};
|
|
473
568
|
var TableRow = (0, import_react3.forwardRef)(
|
|
474
569
|
({ state = "default", className, ...props }, ref) => {
|
|
475
|
-
return /* @__PURE__ */ (0,
|
|
570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
476
571
|
"tr",
|
|
477
572
|
{
|
|
478
573
|
ref,
|
|
@@ -489,7 +584,7 @@ var TableRow = (0, import_react3.forwardRef)(
|
|
|
489
584
|
}
|
|
490
585
|
);
|
|
491
586
|
TableRow.displayName = "TableRow";
|
|
492
|
-
var TableHead = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
587
|
+
var TableHead = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
493
588
|
"th",
|
|
494
589
|
{
|
|
495
590
|
ref,
|
|
@@ -498,7 +593,7 @@ var TableHead = (0, import_react3.forwardRef)(({ className, ...props }, ref) =>
|
|
|
498
593
|
}
|
|
499
594
|
));
|
|
500
595
|
TableHead.displayName = "TableHead";
|
|
501
|
-
var TableCell = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
596
|
+
var TableCell = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
502
597
|
"td",
|
|
503
598
|
{
|
|
504
599
|
ref,
|
|
@@ -507,7 +602,7 @@ var TableCell = (0, import_react3.forwardRef)(({ className, ...props }, ref) =>
|
|
|
507
602
|
}
|
|
508
603
|
));
|
|
509
604
|
TableCell.displayName = "TableCell";
|
|
510
|
-
var TableCaption = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
605
|
+
var TableCaption = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
511
606
|
"caption",
|
|
512
607
|
{
|
|
513
608
|
ref,
|
|
@@ -519,7 +614,7 @@ TableCaption.displayName = "TableCaption";
|
|
|
519
614
|
|
|
520
615
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
521
616
|
var import_react4 = require("react");
|
|
522
|
-
var
|
|
617
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
523
618
|
var DropdownMenuContext = (0, import_react4.createContext)(
|
|
524
619
|
void 0
|
|
525
620
|
);
|
|
@@ -559,14 +654,14 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
559
654
|
() => ({ open: currentOpen, setOpen }),
|
|
560
655
|
[currentOpen, setOpen]
|
|
561
656
|
);
|
|
562
|
-
return /* @__PURE__ */ (0,
|
|
657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "relative", ref: menuRef, children }) });
|
|
563
658
|
};
|
|
564
659
|
var DropdownMenuTrigger = (0, import_react4.forwardRef)(({ className, children, onClick, ...props }, ref) => {
|
|
565
660
|
const context = (0, import_react4.useContext)(DropdownMenuContext);
|
|
566
661
|
if (!context)
|
|
567
662
|
throw new Error("DropdownMenuTrigger must be used within a DropdownMenu");
|
|
568
663
|
const { open, setOpen } = context;
|
|
569
|
-
return /* @__PURE__ */ (0,
|
|
664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
570
665
|
"button",
|
|
571
666
|
{
|
|
572
667
|
ref,
|
|
@@ -598,7 +693,7 @@ var ALIGN_CLASSES = {
|
|
|
598
693
|
center: "left-1/2 -translate-x-1/2",
|
|
599
694
|
end: "right-0"
|
|
600
695
|
};
|
|
601
|
-
var MenuLabel = (0, import_react4.forwardRef)(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0,
|
|
696
|
+
var MenuLabel = (0, import_react4.forwardRef)(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
602
697
|
"fieldset",
|
|
603
698
|
{
|
|
604
699
|
ref,
|
|
@@ -633,7 +728,7 @@ var MenuContent = (0, import_react4.forwardRef)(
|
|
|
633
728
|
const horizontal = ALIGN_CLASSES[align];
|
|
634
729
|
return `absolute ${vertical} ${horizontal}`;
|
|
635
730
|
};
|
|
636
|
-
return /* @__PURE__ */ (0,
|
|
731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
637
732
|
"div",
|
|
638
733
|
{
|
|
639
734
|
ref,
|
|
@@ -678,7 +773,7 @@ var MenuItem = (0, import_react4.forwardRef)(
|
|
|
678
773
|
}
|
|
679
774
|
onClick?.(e);
|
|
680
775
|
};
|
|
681
|
-
return /* @__PURE__ */ (0,
|
|
776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
682
777
|
"div",
|
|
683
778
|
{
|
|
684
779
|
ref,
|
|
@@ -707,7 +802,7 @@ var MenuItem = (0, import_react4.forwardRef)(
|
|
|
707
802
|
}
|
|
708
803
|
);
|
|
709
804
|
MenuItem.displayName = "MenuItem";
|
|
710
|
-
var MenuSeparator = (0, import_react4.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
805
|
+
var MenuSeparator = (0, import_react4.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
711
806
|
"div",
|
|
712
807
|
{
|
|
713
808
|
ref,
|
|
@@ -719,7 +814,7 @@ MenuSeparator.displayName = "MenuSeparator";
|
|
|
719
814
|
|
|
720
815
|
// src/components/NavButton/NavButton.tsx
|
|
721
816
|
var import_react5 = require("react");
|
|
722
|
-
var
|
|
817
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
723
818
|
var NavButton = (0, import_react5.forwardRef)(
|
|
724
819
|
({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
|
|
725
820
|
const baseClasses = [
|
|
@@ -747,7 +842,7 @@ var NavButton = (0, import_react5.forwardRef)(
|
|
|
747
842
|
];
|
|
748
843
|
const stateClasses = selected ? ["bg-primary-50", "text-primary-950"] : [];
|
|
749
844
|
const allClasses = [...baseClasses, ...stateClasses].join(" ");
|
|
750
|
-
return /* @__PURE__ */ (0,
|
|
845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
751
846
|
"button",
|
|
752
847
|
{
|
|
753
848
|
ref,
|
|
@@ -757,8 +852,8 @@ var NavButton = (0, import_react5.forwardRef)(
|
|
|
757
852
|
"aria-pressed": selected,
|
|
758
853
|
...props,
|
|
759
854
|
children: [
|
|
760
|
-
/* @__PURE__ */ (0,
|
|
761
|
-
/* @__PURE__ */ (0,
|
|
855
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "flex items-center justify-center w-5 h-5", children: icon }),
|
|
856
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "whitespace-nowrap", children: label })
|
|
762
857
|
]
|
|
763
858
|
}
|
|
764
859
|
);
|
|
@@ -768,7 +863,7 @@ NavButton.displayName = "NavButton";
|
|
|
768
863
|
|
|
769
864
|
// src/components/IconButton/IconButton.tsx
|
|
770
865
|
var import_react6 = require("react");
|
|
771
|
-
var
|
|
866
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
772
867
|
var IconButton = (0, import_react6.forwardRef)(
|
|
773
868
|
({ icon, size = "md", active = false, className = "", disabled, ...props }, ref) => {
|
|
774
869
|
const baseClasses = [
|
|
@@ -801,7 +896,7 @@ var IconButton = (0, import_react6.forwardRef)(
|
|
|
801
896
|
...activeClasses
|
|
802
897
|
].join(" ");
|
|
803
898
|
const ariaLabel = props["aria-label"] ?? "Bot\xE3o de a\xE7\xE3o";
|
|
804
|
-
return /* @__PURE__ */ (0,
|
|
899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
805
900
|
"button",
|
|
806
901
|
{
|
|
807
902
|
ref,
|
|
@@ -811,14 +906,128 @@ var IconButton = (0, import_react6.forwardRef)(
|
|
|
811
906
|
"aria-pressed": active,
|
|
812
907
|
"aria-label": ariaLabel,
|
|
813
908
|
...props,
|
|
814
|
-
children: /* @__PURE__ */ (0,
|
|
909
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "flex items-center justify-center", children: icon })
|
|
815
910
|
}
|
|
816
911
|
);
|
|
817
912
|
}
|
|
818
913
|
);
|
|
819
914
|
IconButton.displayName = "IconButton";
|
|
915
|
+
|
|
916
|
+
// src/components/Toast/Toast.tsx
|
|
917
|
+
var import_phosphor_react3 = require("phosphor-react");
|
|
918
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
919
|
+
var VARIANT_ACTION_CLASSES3 = {
|
|
920
|
+
solid: {
|
|
921
|
+
warning: "bg-warning text-warning-800 border-none focus-visible:outline-none",
|
|
922
|
+
success: "bg-success text-success-800 border-none focus-visible:outline-none",
|
|
923
|
+
info: "bg-info text-info-800 border-none focus-visible:outline-none"
|
|
924
|
+
},
|
|
925
|
+
outlined: {
|
|
926
|
+
warning: "bg-warning text-warning-800 border border-warning-200 focus-visible:outline-none",
|
|
927
|
+
success: "bg-success text-success-800 border border-success-200 focus-visible:outline-none",
|
|
928
|
+
info: "bg-info text-info-800 border border-info-200 focus-visible:outline-none"
|
|
929
|
+
}
|
|
930
|
+
};
|
|
931
|
+
var iconMap = {
|
|
932
|
+
success: import_phosphor_react3.CheckCircle,
|
|
933
|
+
info: import_phosphor_react3.Info,
|
|
934
|
+
warning: import_phosphor_react3.WarningCircle
|
|
935
|
+
};
|
|
936
|
+
var Toast = ({
|
|
937
|
+
variant = "outlined",
|
|
938
|
+
action = "success",
|
|
939
|
+
className = "",
|
|
940
|
+
onClose,
|
|
941
|
+
title,
|
|
942
|
+
description,
|
|
943
|
+
position = "default",
|
|
944
|
+
...props
|
|
945
|
+
}) => {
|
|
946
|
+
const variantClasses = VARIANT_ACTION_CLASSES3[variant][action];
|
|
947
|
+
const positionClasses = {
|
|
948
|
+
"top-left": "fixed top-4 left-4",
|
|
949
|
+
"top-center": "fixed top-4 left-1/2 transform -translate-x-1/2",
|
|
950
|
+
"top-right": "fixed top-4 right-4",
|
|
951
|
+
"bottom-left": "fixed bottom-4 left-4",
|
|
952
|
+
"bottom-center": "fixed bottom-4 left-1/2 transform -translate-x-1/2",
|
|
953
|
+
"bottom-right": "fixed bottom-4 right-4",
|
|
954
|
+
default: ""
|
|
955
|
+
};
|
|
956
|
+
const IconAction = iconMap[action] || iconMap["success"];
|
|
957
|
+
const baseClasses = "max-w-[390px] w-full flex flex-row items-start justify-between shadow-lg rounded-lg border p-4 gap-6 group";
|
|
958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
959
|
+
"div",
|
|
960
|
+
{
|
|
961
|
+
role: "alert",
|
|
962
|
+
"aria-live": "assertive",
|
|
963
|
+
"aria-atomic": "true",
|
|
964
|
+
className: `${baseClasses} ${positionClasses[position]} ${variantClasses} ${className}`,
|
|
965
|
+
...props,
|
|
966
|
+
children: [
|
|
967
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-row items-start gap-3", children: [
|
|
968
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "mt-1", "data-testid": `toast-icon-${action}`, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconAction, {}) }),
|
|
969
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col items-start justify-start", children: [
|
|
970
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "font-semibold text-md", children: title }),
|
|
971
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-md text-text-900", children: description })
|
|
972
|
+
] })
|
|
973
|
+
] }),
|
|
974
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
975
|
+
"button",
|
|
976
|
+
{
|
|
977
|
+
onClick: onClose,
|
|
978
|
+
"aria-label": "Dismiss notification",
|
|
979
|
+
className: "text-background-500 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity",
|
|
980
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react3.X, {})
|
|
981
|
+
}
|
|
982
|
+
)
|
|
983
|
+
]
|
|
984
|
+
}
|
|
985
|
+
);
|
|
986
|
+
};
|
|
987
|
+
|
|
988
|
+
// src/components/Toast/utils/ToastStore.ts
|
|
989
|
+
var import_zustand = require("zustand");
|
|
990
|
+
var useToastStore = (0, import_zustand.create)((set) => ({
|
|
991
|
+
toasts: [],
|
|
992
|
+
addToast: (toast) => {
|
|
993
|
+
const id = crypto.randomUUID();
|
|
994
|
+
set((state) => ({
|
|
995
|
+
toasts: [...state.toasts, { id, ...toast }]
|
|
996
|
+
}));
|
|
997
|
+
},
|
|
998
|
+
removeToast: (id) => {
|
|
999
|
+
set((state) => ({
|
|
1000
|
+
toasts: state.toasts.filter((t) => t.id !== id)
|
|
1001
|
+
}));
|
|
1002
|
+
}
|
|
1003
|
+
}));
|
|
1004
|
+
|
|
1005
|
+
// src/components/Toast/utils/Toaster.tsx
|
|
1006
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1007
|
+
var Toaster = () => {
|
|
1008
|
+
const toasts = useToastStore((state) => state.toasts);
|
|
1009
|
+
const removeToast = useToastStore((state) => state.removeToast);
|
|
1010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1011
|
+
Toast,
|
|
1012
|
+
{
|
|
1013
|
+
title: toast.title,
|
|
1014
|
+
description: toast.description,
|
|
1015
|
+
variant: toast.variant,
|
|
1016
|
+
action: toast.action,
|
|
1017
|
+
position: toast.position,
|
|
1018
|
+
onClose: () => removeToast(toast.id)
|
|
1019
|
+
},
|
|
1020
|
+
toast.id
|
|
1021
|
+
)) });
|
|
1022
|
+
};
|
|
1023
|
+
var useToast = () => {
|
|
1024
|
+
const addToast = useToastStore((state) => state.addToast);
|
|
1025
|
+
const removeToast = useToastStore((state) => state.removeToast);
|
|
1026
|
+
return { addToast, removeToast };
|
|
1027
|
+
};
|
|
820
1028
|
// Annotate the CommonJS export names for ESM import in node:
|
|
821
1029
|
0 && (module.exports = {
|
|
1030
|
+
Badge,
|
|
822
1031
|
Button,
|
|
823
1032
|
CheckBox,
|
|
824
1033
|
DropdownMenu,
|
|
@@ -839,5 +1048,9 @@ IconButton.displayName = "IconButton";
|
|
|
839
1048
|
TableHead,
|
|
840
1049
|
TableHeader,
|
|
841
1050
|
TableRow,
|
|
842
|
-
Text
|
|
1051
|
+
Text,
|
|
1052
|
+
Toast,
|
|
1053
|
+
Toaster,
|
|
1054
|
+
useToast,
|
|
1055
|
+
useToastStore
|
|
843
1056
|
});
|