analytica-frontend-lib 1.0.18 → 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 +109 -0
- package/dist/index.d.mts +75 -32
- package/dist/index.d.ts +75 -32
- package/dist/index.js +221 -129
- package/dist/index.mjs +217 -126
- package/package.json +1 -1
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,
|
|
@@ -256,124 +257,101 @@ var Text = ({
|
|
|
256
257
|
);
|
|
257
258
|
};
|
|
258
259
|
|
|
259
|
-
// src/components/
|
|
260
|
+
// src/components/Badge/Badge.tsx
|
|
260
261
|
var import_phosphor_react = require("phosphor-react");
|
|
261
262
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
262
263
|
var VARIANT_ACTION_CLASSES2 = {
|
|
263
264
|
solid: {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
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"
|
|
267
270
|
},
|
|
268
271
|
outlined: {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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"
|
|
273
289
|
};
|
|
274
|
-
var
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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"
|
|
278
294
|
};
|
|
279
|
-
var
|
|
280
|
-
|
|
281
|
-
|
|
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",
|
|
282
307
|
className = "",
|
|
283
|
-
|
|
284
|
-
title,
|
|
285
|
-
description,
|
|
286
|
-
position = "default",
|
|
308
|
+
notificationActive = false,
|
|
287
309
|
...props
|
|
288
310
|
}) => {
|
|
289
|
-
const
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
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
|
+
}
|
|
301
336
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
302
337
|
"div",
|
|
303
338
|
{
|
|
304
|
-
|
|
305
|
-
"aria-live": "assertive",
|
|
306
|
-
"aria-atomic": "true",
|
|
307
|
-
className: `${baseClasses} ${positionClasses[position]} ${variantClasses} ${className}`,
|
|
339
|
+
className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
|
|
308
340
|
...props,
|
|
309
341
|
children: [
|
|
310
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "font-semibold text-md", children: title }),
|
|
314
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-md text-text-900", children: description })
|
|
315
|
-
] })
|
|
316
|
-
] }),
|
|
317
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
318
|
-
"button",
|
|
319
|
-
{
|
|
320
|
-
onClick: onClose,
|
|
321
|
-
"aria-label": "Dismiss notification",
|
|
322
|
-
className: "text-background-500 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity",
|
|
323
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react.X, {})
|
|
324
|
-
}
|
|
325
|
-
)
|
|
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 })
|
|
326
345
|
]
|
|
327
346
|
}
|
|
328
347
|
);
|
|
329
348
|
};
|
|
330
349
|
|
|
331
|
-
// src/components/Toast/utils/ToastStore.ts
|
|
332
|
-
var import_zustand = require("zustand");
|
|
333
|
-
var useToastStore = (0, import_zustand.create)((set) => ({
|
|
334
|
-
toasts: [],
|
|
335
|
-
addToast: (toast) => {
|
|
336
|
-
const id = crypto.randomUUID();
|
|
337
|
-
set((state) => ({
|
|
338
|
-
toasts: [...state.toasts, { id, ...toast }]
|
|
339
|
-
}));
|
|
340
|
-
},
|
|
341
|
-
removeToast: (id) => {
|
|
342
|
-
set((state) => ({
|
|
343
|
-
toasts: state.toasts.filter((t) => t.id !== id)
|
|
344
|
-
}));
|
|
345
|
-
}
|
|
346
|
-
}));
|
|
347
|
-
|
|
348
|
-
// src/components/Toast/utils/Toaster.tsx
|
|
349
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
350
|
-
var Toaster = () => {
|
|
351
|
-
const toasts = useToastStore((state) => state.toasts);
|
|
352
|
-
const removeToast = useToastStore((state) => state.removeToast);
|
|
353
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
354
|
-
Toast,
|
|
355
|
-
{
|
|
356
|
-
title: toast.title,
|
|
357
|
-
description: toast.description,
|
|
358
|
-
variant: toast.variant,
|
|
359
|
-
action: toast.action,
|
|
360
|
-
position: toast.position,
|
|
361
|
-
onClose: () => removeToast(toast.id)
|
|
362
|
-
},
|
|
363
|
-
toast.id
|
|
364
|
-
)) });
|
|
365
|
-
};
|
|
366
|
-
var useToast = () => {
|
|
367
|
-
const addToast = useToastStore((state) => state.addToast);
|
|
368
|
-
const removeToast = useToastStore((state) => state.removeToast);
|
|
369
|
-
return { addToast, removeToast };
|
|
370
|
-
};
|
|
371
|
-
|
|
372
350
|
// src/components/CheckBox/CheckBox.tsx
|
|
373
351
|
var import_react2 = require("react");
|
|
374
352
|
var import_phosphor_react2 = require("phosphor-react");
|
|
375
|
-
var
|
|
376
|
-
var
|
|
353
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
354
|
+
var SIZE_CLASSES3 = {
|
|
377
355
|
small: {
|
|
378
356
|
checkbox: "w-4 h-4",
|
|
379
357
|
// 16px x 16px
|
|
@@ -460,14 +438,14 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
460
438
|
onChange?.(event);
|
|
461
439
|
};
|
|
462
440
|
const currentState = disabled ? "disabled" : state;
|
|
463
|
-
const sizeClasses =
|
|
441
|
+
const sizeClasses = SIZE_CLASSES3[size];
|
|
464
442
|
const checkVariant = checked || indeterminate ? "checked" : "unchecked";
|
|
465
443
|
const stylingClasses = STATE_CLASSES[currentState][checkVariant];
|
|
466
444
|
const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
|
|
467
445
|
const checkboxClasses = `${BASE_CHECKBOX_CLASSES} ${sizeClasses.checkbox} ${borderWidthClass} ${stylingClasses} ${className}`;
|
|
468
446
|
const renderIcon = () => {
|
|
469
447
|
if (indeterminate) {
|
|
470
|
-
return /* @__PURE__ */ (0,
|
|
448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
471
449
|
import_phosphor_react2.Minus,
|
|
472
450
|
{
|
|
473
451
|
size: sizeClasses.iconSize,
|
|
@@ -477,7 +455,7 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
477
455
|
);
|
|
478
456
|
}
|
|
479
457
|
if (checked) {
|
|
480
|
-
return /* @__PURE__ */ (0,
|
|
458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
481
459
|
import_phosphor_react2.Check,
|
|
482
460
|
{
|
|
483
461
|
size: sizeClasses.iconSize,
|
|
@@ -488,13 +466,13 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
488
466
|
}
|
|
489
467
|
return null;
|
|
490
468
|
};
|
|
491
|
-
return /* @__PURE__ */ (0,
|
|
492
|
-
/* @__PURE__ */ (0,
|
|
469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col", children: [
|
|
470
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
493
471
|
"div",
|
|
494
472
|
{
|
|
495
473
|
className: `flex flex-row items-center ${sizeClasses.spacing} ${disabled ? "opacity-40" : ""}`,
|
|
496
474
|
children: [
|
|
497
|
-
/* @__PURE__ */ (0,
|
|
475
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
498
476
|
"input",
|
|
499
477
|
{
|
|
500
478
|
ref,
|
|
@@ -507,12 +485,12 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
507
485
|
...props
|
|
508
486
|
}
|
|
509
487
|
),
|
|
510
|
-
/* @__PURE__ */ (0,
|
|
511
|
-
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)(
|
|
512
490
|
"div",
|
|
513
491
|
{
|
|
514
492
|
className: `flex flex-row items-center ${sizeClasses.labelHeight}`,
|
|
515
|
-
children: /* @__PURE__ */ (0,
|
|
493
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
516
494
|
Text,
|
|
517
495
|
{
|
|
518
496
|
as: "label",
|
|
@@ -529,8 +507,8 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
529
507
|
]
|
|
530
508
|
}
|
|
531
509
|
),
|
|
532
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
533
|
-
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 })
|
|
534
512
|
] });
|
|
535
513
|
}
|
|
536
514
|
);
|
|
@@ -538,23 +516,23 @@ CheckBox.displayName = "CheckBox";
|
|
|
538
516
|
|
|
539
517
|
// src/components/Table/Table.tsx
|
|
540
518
|
var import_react3 = require("react");
|
|
541
|
-
var
|
|
519
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
542
520
|
var Table = (0, import_react3.forwardRef)(
|
|
543
|
-
({ 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)(
|
|
544
522
|
"table",
|
|
545
523
|
{
|
|
546
524
|
ref,
|
|
547
525
|
className: `w-full caption-bottom text-sm ${className ?? ""}`,
|
|
548
526
|
...props,
|
|
549
527
|
children: [
|
|
550
|
-
/* @__PURE__ */ (0,
|
|
528
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("caption", { className: "sr-only", children: "My Table" }),
|
|
551
529
|
children
|
|
552
530
|
]
|
|
553
531
|
}
|
|
554
532
|
) })
|
|
555
533
|
);
|
|
556
534
|
Table.displayName = "Table";
|
|
557
|
-
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)(
|
|
558
536
|
"thead",
|
|
559
537
|
{
|
|
560
538
|
ref,
|
|
@@ -563,7 +541,7 @@ var TableHeader = (0, import_react3.forwardRef)(({ className, ...props }, ref) =
|
|
|
563
541
|
}
|
|
564
542
|
));
|
|
565
543
|
TableHeader.displayName = "TableHeader";
|
|
566
|
-
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)(
|
|
567
545
|
"tbody",
|
|
568
546
|
{
|
|
569
547
|
ref,
|
|
@@ -572,7 +550,7 @@ var TableBody = (0, import_react3.forwardRef)(({ className, ...props }, ref) =>
|
|
|
572
550
|
}
|
|
573
551
|
));
|
|
574
552
|
TableBody.displayName = "TableBody";
|
|
575
|
-
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)(
|
|
576
554
|
"tfoot",
|
|
577
555
|
{
|
|
578
556
|
ref,
|
|
@@ -589,7 +567,7 @@ var VARIANT_STATES_ROW = {
|
|
|
589
567
|
};
|
|
590
568
|
var TableRow = (0, import_react3.forwardRef)(
|
|
591
569
|
({ state = "default", className, ...props }, ref) => {
|
|
592
|
-
return /* @__PURE__ */ (0,
|
|
570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
593
571
|
"tr",
|
|
594
572
|
{
|
|
595
573
|
ref,
|
|
@@ -606,7 +584,7 @@ var TableRow = (0, import_react3.forwardRef)(
|
|
|
606
584
|
}
|
|
607
585
|
);
|
|
608
586
|
TableRow.displayName = "TableRow";
|
|
609
|
-
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)(
|
|
610
588
|
"th",
|
|
611
589
|
{
|
|
612
590
|
ref,
|
|
@@ -615,7 +593,7 @@ var TableHead = (0, import_react3.forwardRef)(({ className, ...props }, ref) =>
|
|
|
615
593
|
}
|
|
616
594
|
));
|
|
617
595
|
TableHead.displayName = "TableHead";
|
|
618
|
-
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)(
|
|
619
597
|
"td",
|
|
620
598
|
{
|
|
621
599
|
ref,
|
|
@@ -624,7 +602,7 @@ var TableCell = (0, import_react3.forwardRef)(({ className, ...props }, ref) =>
|
|
|
624
602
|
}
|
|
625
603
|
));
|
|
626
604
|
TableCell.displayName = "TableCell";
|
|
627
|
-
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)(
|
|
628
606
|
"caption",
|
|
629
607
|
{
|
|
630
608
|
ref,
|
|
@@ -636,7 +614,7 @@ TableCaption.displayName = "TableCaption";
|
|
|
636
614
|
|
|
637
615
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
638
616
|
var import_react4 = require("react");
|
|
639
|
-
var
|
|
617
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
640
618
|
var DropdownMenuContext = (0, import_react4.createContext)(
|
|
641
619
|
void 0
|
|
642
620
|
);
|
|
@@ -676,14 +654,14 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
676
654
|
() => ({ open: currentOpen, setOpen }),
|
|
677
655
|
[currentOpen, setOpen]
|
|
678
656
|
);
|
|
679
|
-
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 }) });
|
|
680
658
|
};
|
|
681
659
|
var DropdownMenuTrigger = (0, import_react4.forwardRef)(({ className, children, onClick, ...props }, ref) => {
|
|
682
660
|
const context = (0, import_react4.useContext)(DropdownMenuContext);
|
|
683
661
|
if (!context)
|
|
684
662
|
throw new Error("DropdownMenuTrigger must be used within a DropdownMenu");
|
|
685
663
|
const { open, setOpen } = context;
|
|
686
|
-
return /* @__PURE__ */ (0,
|
|
664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
687
665
|
"button",
|
|
688
666
|
{
|
|
689
667
|
ref,
|
|
@@ -715,7 +693,7 @@ var ALIGN_CLASSES = {
|
|
|
715
693
|
center: "left-1/2 -translate-x-1/2",
|
|
716
694
|
end: "right-0"
|
|
717
695
|
};
|
|
718
|
-
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)(
|
|
719
697
|
"fieldset",
|
|
720
698
|
{
|
|
721
699
|
ref,
|
|
@@ -750,7 +728,7 @@ var MenuContent = (0, import_react4.forwardRef)(
|
|
|
750
728
|
const horizontal = ALIGN_CLASSES[align];
|
|
751
729
|
return `absolute ${vertical} ${horizontal}`;
|
|
752
730
|
};
|
|
753
|
-
return /* @__PURE__ */ (0,
|
|
731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
754
732
|
"div",
|
|
755
733
|
{
|
|
756
734
|
ref,
|
|
@@ -795,7 +773,7 @@ var MenuItem = (0, import_react4.forwardRef)(
|
|
|
795
773
|
}
|
|
796
774
|
onClick?.(e);
|
|
797
775
|
};
|
|
798
|
-
return /* @__PURE__ */ (0,
|
|
776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
799
777
|
"div",
|
|
800
778
|
{
|
|
801
779
|
ref,
|
|
@@ -824,7 +802,7 @@ var MenuItem = (0, import_react4.forwardRef)(
|
|
|
824
802
|
}
|
|
825
803
|
);
|
|
826
804
|
MenuItem.displayName = "MenuItem";
|
|
827
|
-
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)(
|
|
828
806
|
"div",
|
|
829
807
|
{
|
|
830
808
|
ref,
|
|
@@ -836,7 +814,7 @@ MenuSeparator.displayName = "MenuSeparator";
|
|
|
836
814
|
|
|
837
815
|
// src/components/NavButton/NavButton.tsx
|
|
838
816
|
var import_react5 = require("react");
|
|
839
|
-
var
|
|
817
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
840
818
|
var NavButton = (0, import_react5.forwardRef)(
|
|
841
819
|
({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
|
|
842
820
|
const baseClasses = [
|
|
@@ -864,7 +842,7 @@ var NavButton = (0, import_react5.forwardRef)(
|
|
|
864
842
|
];
|
|
865
843
|
const stateClasses = selected ? ["bg-primary-50", "text-primary-950"] : [];
|
|
866
844
|
const allClasses = [...baseClasses, ...stateClasses].join(" ");
|
|
867
|
-
return /* @__PURE__ */ (0,
|
|
845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
868
846
|
"button",
|
|
869
847
|
{
|
|
870
848
|
ref,
|
|
@@ -874,8 +852,8 @@ var NavButton = (0, import_react5.forwardRef)(
|
|
|
874
852
|
"aria-pressed": selected,
|
|
875
853
|
...props,
|
|
876
854
|
children: [
|
|
877
|
-
/* @__PURE__ */ (0,
|
|
878
|
-
/* @__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 })
|
|
879
857
|
]
|
|
880
858
|
}
|
|
881
859
|
);
|
|
@@ -885,7 +863,7 @@ NavButton.displayName = "NavButton";
|
|
|
885
863
|
|
|
886
864
|
// src/components/IconButton/IconButton.tsx
|
|
887
865
|
var import_react6 = require("react");
|
|
888
|
-
var
|
|
866
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
889
867
|
var IconButton = (0, import_react6.forwardRef)(
|
|
890
868
|
({ icon, size = "md", active = false, className = "", disabled, ...props }, ref) => {
|
|
891
869
|
const baseClasses = [
|
|
@@ -918,7 +896,7 @@ var IconButton = (0, import_react6.forwardRef)(
|
|
|
918
896
|
...activeClasses
|
|
919
897
|
].join(" ");
|
|
920
898
|
const ariaLabel = props["aria-label"] ?? "Bot\xE3o de a\xE7\xE3o";
|
|
921
|
-
return /* @__PURE__ */ (0,
|
|
899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
922
900
|
"button",
|
|
923
901
|
{
|
|
924
902
|
ref,
|
|
@@ -928,14 +906,128 @@ var IconButton = (0, import_react6.forwardRef)(
|
|
|
928
906
|
"aria-pressed": active,
|
|
929
907
|
"aria-label": ariaLabel,
|
|
930
908
|
...props,
|
|
931
|
-
children: /* @__PURE__ */ (0,
|
|
909
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "flex items-center justify-center", children: icon })
|
|
932
910
|
}
|
|
933
911
|
);
|
|
934
912
|
}
|
|
935
913
|
);
|
|
936
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
|
+
};
|
|
937
1028
|
// Annotate the CommonJS export names for ESM import in node:
|
|
938
1029
|
0 && (module.exports = {
|
|
1030
|
+
Badge,
|
|
939
1031
|
Button,
|
|
940
1032
|
CheckBox,
|
|
941
1033
|
DropdownMenu,
|