analytica-frontend-lib 1.0.18 → 1.0.20

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.mjs CHANGED
@@ -206,119 +206,96 @@ var Text = ({
206
206
  );
207
207
  };
208
208
 
209
- // src/components/Toast/Toast.tsx
210
- import { CheckCircle, WarningCircle, Info, X } from "phosphor-react";
209
+ // src/components/Badge/Badge.tsx
210
+ import { Bell } from "phosphor-react";
211
211
  import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
212
212
  var VARIANT_ACTION_CLASSES2 = {
213
213
  solid: {
214
- warning: "bg-warning text-warning-800 border-none focus-visible:outline-none",
215
- success: "bg-success text-success-800 border-none focus-visible:outline-none",
216
- info: "bg-info text-info-800 border-none focus-visible:outline-none"
214
+ error: "bg-error text-error-700 focus-visible:outline-none",
215
+ warning: "bg-warning text-warning-800 focus-visible:outline-none",
216
+ success: "bg-success text-success-800 focus-visible:outline-none",
217
+ info: "bg-info text-info-800 focus-visible:outline-none",
218
+ muted: "bg-background-muted text-background-800 focus-visible:outline-none"
217
219
  },
218
220
  outlined: {
219
- warning: "bg-warning text-warning-800 border border-warning-200 focus-visible:outline-none",
220
- success: "bg-success text-success-800 border border-success-200 focus-visible:outline-none",
221
- info: "bg-info text-info-800 border border-info-200 focus-visible:outline-none"
222
- }
221
+ error: "bg-error text-error-700 border border-error-300 focus-visible:outline-none",
222
+ warning: "bg-warning text-warning-800 border border-warning-300 focus-visible:outline-none",
223
+ success: "bg-success text-success-800 border border-success-300 focus-visible:outline-none",
224
+ info: "bg-info text-info-800 border border-info-300 focus-visible:outline-none",
225
+ muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
226
+ },
227
+ exams: {
228
+ exam1: "bg-exam-1 text-info-200 focus-visible:outline-none",
229
+ exam2: "bg-exam-2 text-typography-1 focus-visible:outline-none",
230
+ exam3: "bg-exam-3 text-typography-2 focus-visible:outline-none",
231
+ exam4: "bg-exam-4 text-success-700 focus-visible:outline-none"
232
+ },
233
+ resultStatus: {
234
+ negative: "bg-error text-error-800 focus-visible:outline-none",
235
+ positive: "bg-success text-success-800 focus-visible:outline-none"
236
+ },
237
+ notification: "text-primary"
223
238
  };
224
- var iconMap = {
225
- success: CheckCircle,
226
- info: Info,
227
- warning: WarningCircle
239
+ var SIZE_CLASSES2 = {
240
+ small: "text-2xs px-2 py-1",
241
+ medium: "text-xs px-2 py-1",
242
+ large: "text-sm px-2 py-1"
228
243
  };
229
- var Toast = ({
230
- variant = "outlined",
231
- action = "success",
244
+ var SIZE_CLASSES_ICON = {
245
+ small: "size-3",
246
+ medium: "size-3.5",
247
+ large: "size-4"
248
+ };
249
+ var Badge = ({
250
+ children,
251
+ iconLeft,
252
+ iconRight,
253
+ size = "medium",
254
+ variant = "solid",
255
+ action = "error",
232
256
  className = "",
233
- onClose,
234
- title,
235
- description,
236
- position = "default",
257
+ notificationActive = false,
237
258
  ...props
238
259
  }) => {
239
- const variantClasses = VARIANT_ACTION_CLASSES2[variant][action];
240
- const positionClasses = {
241
- "top-left": "fixed top-4 left-4",
242
- "top-center": "fixed top-4 left-1/2 transform -translate-x-1/2",
243
- "top-right": "fixed top-4 right-4",
244
- "bottom-left": "fixed bottom-4 left-4",
245
- "bottom-center": "fixed bottom-4 left-1/2 transform -translate-x-1/2",
246
- "bottom-right": "fixed bottom-4 right-4",
247
- default: ""
248
- };
249
- const IconAction = iconMap[action] || iconMap["success"];
250
- const baseClasses = "max-w-[390px] w-full flex flex-row items-start justify-between shadow-lg rounded-lg border p-4 gap-6 group";
260
+ const sizeClasses = SIZE_CLASSES2[size];
261
+ const sizeClassesIcon = SIZE_CLASSES_ICON[size];
262
+ const variantActionMap = VARIANT_ACTION_CLASSES2[variant] || {};
263
+ const variantClasses = typeof variantActionMap === "string" ? variantActionMap : variantActionMap[action] ?? variantActionMap.muted ?? "";
264
+ const baseClasses = "inline-flex items-center justify-center rounded-xs font-medium gap-1 relative";
265
+ const baseClassesIcon = "flex items-center";
266
+ if (variant === "notification") {
267
+ return /* @__PURE__ */ jsxs3(
268
+ "div",
269
+ {
270
+ className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
271
+ ...props,
272
+ children: [
273
+ /* @__PURE__ */ jsx5(Bell, { size: 24, className: "text-primary-950" }),
274
+ notificationActive && /* @__PURE__ */ jsx5(
275
+ "span",
276
+ {
277
+ "data-testid": "notification-dot",
278
+ className: "absolute top-[5px] right-[10px] block h-2 w-2 rounded-full bg-indicator-error ring-2 ring-white"
279
+ }
280
+ )
281
+ ]
282
+ }
283
+ );
284
+ }
251
285
  return /* @__PURE__ */ jsxs3(
252
286
  "div",
253
287
  {
254
- role: "alert",
255
- "aria-live": "assertive",
256
- "aria-atomic": "true",
257
- className: `${baseClasses} ${positionClasses[position]} ${variantClasses} ${className}`,
288
+ className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
258
289
  ...props,
259
290
  children: [
260
- /* @__PURE__ */ jsxs3("div", { className: "flex flex-row items-start gap-3", children: [
261
- /* @__PURE__ */ jsx5("span", { className: "mt-1", "data-testid": `toast-icon-${action}`, children: /* @__PURE__ */ jsx5(IconAction, {}) }),
262
- /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-start justify-start", children: [
263
- /* @__PURE__ */ jsx5("p", { className: "font-semibold text-md", children: title }),
264
- description && /* @__PURE__ */ jsx5("p", { className: "text-md text-text-900", children: description })
265
- ] })
266
- ] }),
267
- /* @__PURE__ */ jsx5(
268
- "button",
269
- {
270
- onClick: onClose,
271
- "aria-label": "Dismiss notification",
272
- className: "text-background-500 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity",
273
- children: /* @__PURE__ */ jsx5(X, {})
274
- }
275
- )
291
+ iconLeft && /* @__PURE__ */ jsx5("span", { className: `${baseClassesIcon} ${sizeClassesIcon}`, children: iconLeft }),
292
+ children,
293
+ iconRight && /* @__PURE__ */ jsx5("span", { className: `${baseClassesIcon} ${sizeClassesIcon}`, children: iconRight })
276
294
  ]
277
295
  }
278
296
  );
279
297
  };
280
298
 
281
- // src/components/Toast/utils/ToastStore.ts
282
- import { create } from "zustand";
283
- var useToastStore = create((set) => ({
284
- toasts: [],
285
- addToast: (toast) => {
286
- const id = crypto.randomUUID();
287
- set((state) => ({
288
- toasts: [...state.toasts, { id, ...toast }]
289
- }));
290
- },
291
- removeToast: (id) => {
292
- set((state) => ({
293
- toasts: state.toasts.filter((t) => t.id !== id)
294
- }));
295
- }
296
- }));
297
-
298
- // src/components/Toast/utils/Toaster.tsx
299
- import { Fragment, jsx as jsx6 } from "react/jsx-runtime";
300
- var Toaster = () => {
301
- const toasts = useToastStore((state) => state.toasts);
302
- const removeToast = useToastStore((state) => state.removeToast);
303
- return /* @__PURE__ */ jsx6(Fragment, { children: toasts.map((toast) => /* @__PURE__ */ jsx6(
304
- Toast,
305
- {
306
- title: toast.title,
307
- description: toast.description,
308
- variant: toast.variant,
309
- action: toast.action,
310
- position: toast.position,
311
- onClose: () => removeToast(toast.id)
312
- },
313
- toast.id
314
- )) });
315
- };
316
- var useToast = () => {
317
- const addToast = useToastStore((state) => state.addToast);
318
- const removeToast = useToastStore((state) => state.removeToast);
319
- return { addToast, removeToast };
320
- };
321
-
322
299
  // src/components/CheckBox/CheckBox.tsx
323
300
  import {
324
301
  forwardRef as forwardRef2,
@@ -326,8 +303,8 @@ import {
326
303
  useId
327
304
  } from "react";
328
305
  import { Check, Minus } from "phosphor-react";
329
- import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
330
- var SIZE_CLASSES2 = {
306
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
307
+ var SIZE_CLASSES3 = {
331
308
  small: {
332
309
  checkbox: "w-4 h-4",
333
310
  // 16px x 16px
@@ -414,14 +391,14 @@ var CheckBox = forwardRef2(
414
391
  onChange?.(event);
415
392
  };
416
393
  const currentState = disabled ? "disabled" : state;
417
- const sizeClasses = SIZE_CLASSES2[size];
394
+ const sizeClasses = SIZE_CLASSES3[size];
418
395
  const checkVariant = checked || indeterminate ? "checked" : "unchecked";
419
396
  const stylingClasses = STATE_CLASSES[currentState][checkVariant];
420
397
  const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
421
398
  const checkboxClasses = `${BASE_CHECKBOX_CLASSES} ${sizeClasses.checkbox} ${borderWidthClass} ${stylingClasses} ${className}`;
422
399
  const renderIcon = () => {
423
400
  if (indeterminate) {
424
- return /* @__PURE__ */ jsx7(
401
+ return /* @__PURE__ */ jsx6(
425
402
  Minus,
426
403
  {
427
404
  size: sizeClasses.iconSize,
@@ -431,7 +408,7 @@ var CheckBox = forwardRef2(
431
408
  );
432
409
  }
433
410
  if (checked) {
434
- return /* @__PURE__ */ jsx7(
411
+ return /* @__PURE__ */ jsx6(
435
412
  Check,
436
413
  {
437
414
  size: sizeClasses.iconSize,
@@ -448,7 +425,7 @@ var CheckBox = forwardRef2(
448
425
  {
449
426
  className: `flex flex-row items-center ${sizeClasses.spacing} ${disabled ? "opacity-40" : ""}`,
450
427
  children: [
451
- /* @__PURE__ */ jsx7(
428
+ /* @__PURE__ */ jsx6(
452
429
  "input",
453
430
  {
454
431
  ref,
@@ -461,12 +438,12 @@ var CheckBox = forwardRef2(
461
438
  ...props
462
439
  }
463
440
  ),
464
- /* @__PURE__ */ jsx7("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
465
- label && /* @__PURE__ */ jsx7(
441
+ /* @__PURE__ */ jsx6("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
442
+ label && /* @__PURE__ */ jsx6(
466
443
  "div",
467
444
  {
468
445
  className: `flex flex-row items-center ${sizeClasses.labelHeight}`,
469
- children: /* @__PURE__ */ jsx7(
446
+ children: /* @__PURE__ */ jsx6(
470
447
  Text,
471
448
  {
472
449
  as: "label",
@@ -483,8 +460,8 @@ var CheckBox = forwardRef2(
483
460
  ]
484
461
  }
485
462
  ),
486
- errorMessage && /* @__PURE__ */ jsx7(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-error-600", children: errorMessage }),
487
- helperText && !errorMessage && /* @__PURE__ */ jsx7(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-text-500", children: helperText })
463
+ errorMessage && /* @__PURE__ */ jsx6(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-error-600", children: errorMessage }),
464
+ helperText && !errorMessage && /* @__PURE__ */ jsx6(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-text-500", children: helperText })
488
465
  ] });
489
466
  }
490
467
  );
@@ -492,23 +469,23 @@ CheckBox.displayName = "CheckBox";
492
469
 
493
470
  // src/components/Table/Table.tsx
494
471
  import { forwardRef as forwardRef3 } from "react";
495
- import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
472
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
496
473
  var Table = forwardRef3(
497
- ({ className, children, ...props }, ref) => /* @__PURE__ */ jsx8("div", { className: "border border-border-200 rounded-xl relative w-full overflow-hidden", children: /* @__PURE__ */ jsxs5(
474
+ ({ className, children, ...props }, ref) => /* @__PURE__ */ jsx7("div", { className: "border border-border-200 rounded-xl relative w-full overflow-hidden", children: /* @__PURE__ */ jsxs5(
498
475
  "table",
499
476
  {
500
477
  ref,
501
478
  className: `w-full caption-bottom text-sm ${className ?? ""}`,
502
479
  ...props,
503
480
  children: [
504
- /* @__PURE__ */ jsx8("caption", { className: "sr-only", children: "My Table" }),
481
+ /* @__PURE__ */ jsx7("caption", { className: "sr-only", children: "My Table" }),
505
482
  children
506
483
  ]
507
484
  }
508
485
  ) })
509
486
  );
510
487
  Table.displayName = "Table";
511
- var TableHeader = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
488
+ var TableHeader = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
512
489
  "thead",
513
490
  {
514
491
  ref,
@@ -517,7 +494,7 @@ var TableHeader = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */
517
494
  }
518
495
  ));
519
496
  TableHeader.displayName = "TableHeader";
520
- var TableBody = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
497
+ var TableBody = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
521
498
  "tbody",
522
499
  {
523
500
  ref,
@@ -526,7 +503,7 @@ var TableBody = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ js
526
503
  }
527
504
  ));
528
505
  TableBody.displayName = "TableBody";
529
- var TableFooter = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
506
+ var TableFooter = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
530
507
  "tfoot",
531
508
  {
532
509
  ref,
@@ -543,7 +520,7 @@ var VARIANT_STATES_ROW = {
543
520
  };
544
521
  var TableRow = forwardRef3(
545
522
  ({ state = "default", className, ...props }, ref) => {
546
- return /* @__PURE__ */ jsx8(
523
+ return /* @__PURE__ */ jsx7(
547
524
  "tr",
548
525
  {
549
526
  ref,
@@ -560,7 +537,7 @@ var TableRow = forwardRef3(
560
537
  }
561
538
  );
562
539
  TableRow.displayName = "TableRow";
563
- var TableHead = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
540
+ var TableHead = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
564
541
  "th",
565
542
  {
566
543
  ref,
@@ -569,7 +546,7 @@ var TableHead = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ js
569
546
  }
570
547
  ));
571
548
  TableHead.displayName = "TableHead";
572
- var TableCell = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
549
+ var TableCell = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
573
550
  "td",
574
551
  {
575
552
  ref,
@@ -578,7 +555,7 @@ var TableCell = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ js
578
555
  }
579
556
  ));
580
557
  TableCell.displayName = "TableCell";
581
- var TableCaption = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
558
+ var TableCaption = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
582
559
  "caption",
583
560
  {
584
561
  ref,
@@ -599,7 +576,7 @@ import {
599
576
  useRef,
600
577
  useMemo
601
578
  } from "react";
602
- import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
579
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
603
580
  var DropdownMenuContext = createContext(
604
581
  void 0
605
582
  );
@@ -615,9 +592,32 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
615
592
  [isControlled, onOpenChange]
616
593
  );
617
594
  const menuRef = useRef(null);
618
- const handleEscape = (event) => {
595
+ const handleArrowDownOrArrowUp = (event) => {
596
+ const menuContent = menuRef.current?.querySelector('[role="menu"]');
597
+ if (menuContent) {
598
+ event.preventDefault();
599
+ const items = Array.from(
600
+ menuContent.querySelectorAll(
601
+ '[role="menuitem"]:not([aria-disabled="true"])'
602
+ )
603
+ ).filter((el) => el instanceof HTMLElement);
604
+ if (items.length === 0) return;
605
+ const focusedItem = document.activeElement;
606
+ const currentIndex = items.findIndex((item) => item === focusedItem);
607
+ let nextIndex;
608
+ if (event.key === "ArrowDown") {
609
+ nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
610
+ } else {
611
+ nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
612
+ }
613
+ items[nextIndex]?.focus();
614
+ }
615
+ };
616
+ const handleDownkey = (event) => {
619
617
  if (event.key === "Escape") {
620
618
  setOpen(false);
619
+ } else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
620
+ handleArrowDownOrArrowUp(event);
621
621
  }
622
622
  };
623
623
  const handleClickOutside = (event) => {
@@ -628,25 +628,25 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
628
628
  useEffect(() => {
629
629
  if (currentOpen) {
630
630
  document.addEventListener("mousedown", handleClickOutside);
631
- document.addEventListener("keydown", handleEscape);
631
+ document.addEventListener("keydown", handleDownkey);
632
632
  }
633
633
  return () => {
634
634
  document.removeEventListener("mousedown", handleClickOutside);
635
- document.removeEventListener("keydown", handleEscape);
635
+ document.removeEventListener("keydown", handleDownkey);
636
636
  };
637
637
  }, [currentOpen]);
638
638
  const value = useMemo(
639
639
  () => ({ open: currentOpen, setOpen }),
640
640
  [currentOpen, setOpen]
641
641
  );
642
- return /* @__PURE__ */ jsx9(DropdownMenuContext.Provider, { value, children: /* @__PURE__ */ jsx9("div", { className: "relative", ref: menuRef, children }) });
642
+ return /* @__PURE__ */ jsx8(DropdownMenuContext.Provider, { value, children: /* @__PURE__ */ jsx8("div", { className: "relative", ref: menuRef, children }) });
643
643
  };
644
644
  var DropdownMenuTrigger = forwardRef4(({ className, children, onClick, ...props }, ref) => {
645
645
  const context = useContext(DropdownMenuContext);
646
646
  if (!context)
647
647
  throw new Error("DropdownMenuTrigger must be used within a DropdownMenu");
648
648
  const { open, setOpen } = context;
649
- return /* @__PURE__ */ jsx9(
649
+ return /* @__PURE__ */ jsx8(
650
650
  "button",
651
651
  {
652
652
  ref,
@@ -678,7 +678,7 @@ var ALIGN_CLASSES = {
678
678
  center: "left-1/2 -translate-x-1/2",
679
679
  end: "right-0"
680
680
  };
681
- var MenuLabel = forwardRef4(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx9(
681
+ var MenuLabel = forwardRef4(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx8(
682
682
  "fieldset",
683
683
  {
684
684
  ref,
@@ -713,7 +713,7 @@ var MenuContent = forwardRef4(
713
713
  const horizontal = ALIGN_CLASSES[align];
714
714
  return `absolute ${vertical} ${horizontal}`;
715
715
  };
716
- return /* @__PURE__ */ jsx9(
716
+ return /* @__PURE__ */ jsx8(
717
717
  "div",
718
718
  {
719
719
  ref,
@@ -765,6 +765,7 @@ var MenuItem = forwardRef4(
765
765
  role: "menuitem",
766
766
  "aria-disabled": disabled,
767
767
  className: `
768
+ focus-visible:bg-background-50
768
769
  relative flex select-none items-center gap-2 rounded-sm p-3 text-sm outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0
769
770
  ${inset && "pl-8"}
770
771
  ${sizeClasses}
@@ -787,7 +788,7 @@ var MenuItem = forwardRef4(
787
788
  }
788
789
  );
789
790
  MenuItem.displayName = "MenuItem";
790
- var MenuSeparator = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
791
+ var MenuSeparator = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
791
792
  "div",
792
793
  {
793
794
  ref,
@@ -799,7 +800,7 @@ MenuSeparator.displayName = "MenuSeparator";
799
800
 
800
801
  // src/components/NavButton/NavButton.tsx
801
802
  import { forwardRef as forwardRef5 } from "react";
802
- import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
803
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
803
804
  var NavButton = forwardRef5(
804
805
  ({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
805
806
  const baseClasses = [
@@ -837,8 +838,8 @@ var NavButton = forwardRef5(
837
838
  "aria-pressed": selected,
838
839
  ...props,
839
840
  children: [
840
- /* @__PURE__ */ jsx10("span", { className: "flex items-center justify-center w-5 h-5", children: icon }),
841
- /* @__PURE__ */ jsx10("span", { className: "whitespace-nowrap", children: label })
841
+ /* @__PURE__ */ jsx9("span", { className: "flex items-center justify-center w-5 h-5", children: icon }),
842
+ /* @__PURE__ */ jsx9("span", { className: "whitespace-nowrap", children: label })
842
843
  ]
843
844
  }
844
845
  );
@@ -848,7 +849,7 @@ NavButton.displayName = "NavButton";
848
849
 
849
850
  // src/components/IconButton/IconButton.tsx
850
851
  import { forwardRef as forwardRef6 } from "react";
851
- import { jsx as jsx11 } from "react/jsx-runtime";
852
+ import { jsx as jsx10 } from "react/jsx-runtime";
852
853
  var IconButton = forwardRef6(
853
854
  ({ icon, size = "md", active = false, className = "", disabled, ...props }, ref) => {
854
855
  const baseClasses = [
@@ -881,7 +882,7 @@ var IconButton = forwardRef6(
881
882
  ...activeClasses
882
883
  ].join(" ");
883
884
  const ariaLabel = props["aria-label"] ?? "Bot\xE3o de a\xE7\xE3o";
884
- return /* @__PURE__ */ jsx11(
885
+ return /* @__PURE__ */ jsx10(
885
886
  "button",
886
887
  {
887
888
  ref,
@@ -891,13 +892,127 @@ var IconButton = forwardRef6(
891
892
  "aria-pressed": active,
892
893
  "aria-label": ariaLabel,
893
894
  ...props,
894
- children: /* @__PURE__ */ jsx11("span", { className: "flex items-center justify-center", children: icon })
895
+ children: /* @__PURE__ */ jsx10("span", { className: "flex items-center justify-center", children: icon })
895
896
  }
896
897
  );
897
898
  }
898
899
  );
899
900
  IconButton.displayName = "IconButton";
901
+
902
+ // src/components/Toast/Toast.tsx
903
+ import { CheckCircle, WarningCircle, Info, X } from "phosphor-react";
904
+ import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
905
+ var VARIANT_ACTION_CLASSES3 = {
906
+ solid: {
907
+ warning: "bg-warning text-warning-800 border-none focus-visible:outline-none",
908
+ success: "bg-success text-success-800 border-none focus-visible:outline-none",
909
+ info: "bg-info text-info-800 border-none focus-visible:outline-none"
910
+ },
911
+ outlined: {
912
+ warning: "bg-warning text-warning-800 border border-warning-200 focus-visible:outline-none",
913
+ success: "bg-success text-success-800 border border-success-200 focus-visible:outline-none",
914
+ info: "bg-info text-info-800 border border-info-200 focus-visible:outline-none"
915
+ }
916
+ };
917
+ var iconMap = {
918
+ success: CheckCircle,
919
+ info: Info,
920
+ warning: WarningCircle
921
+ };
922
+ var Toast = ({
923
+ variant = "outlined",
924
+ action = "success",
925
+ className = "",
926
+ onClose,
927
+ title,
928
+ description,
929
+ position = "default",
930
+ ...props
931
+ }) => {
932
+ const variantClasses = VARIANT_ACTION_CLASSES3[variant][action];
933
+ const positionClasses = {
934
+ "top-left": "fixed top-4 left-4",
935
+ "top-center": "fixed top-4 left-1/2 transform -translate-x-1/2",
936
+ "top-right": "fixed top-4 right-4",
937
+ "bottom-left": "fixed bottom-4 left-4",
938
+ "bottom-center": "fixed bottom-4 left-1/2 transform -translate-x-1/2",
939
+ "bottom-right": "fixed bottom-4 right-4",
940
+ default: ""
941
+ };
942
+ const IconAction = iconMap[action] || iconMap["success"];
943
+ const baseClasses = "max-w-[390px] w-full flex flex-row items-start justify-between shadow-lg rounded-lg border p-4 gap-6 group";
944
+ return /* @__PURE__ */ jsxs8(
945
+ "div",
946
+ {
947
+ role: "alert",
948
+ "aria-live": "assertive",
949
+ "aria-atomic": "true",
950
+ className: `${baseClasses} ${positionClasses[position]} ${variantClasses} ${className}`,
951
+ ...props,
952
+ children: [
953
+ /* @__PURE__ */ jsxs8("div", { className: "flex flex-row items-start gap-3", children: [
954
+ /* @__PURE__ */ jsx11("span", { className: "mt-1", "data-testid": `toast-icon-${action}`, children: /* @__PURE__ */ jsx11(IconAction, {}) }),
955
+ /* @__PURE__ */ jsxs8("div", { className: "flex flex-col items-start justify-start", children: [
956
+ /* @__PURE__ */ jsx11("p", { className: "font-semibold text-md", children: title }),
957
+ description && /* @__PURE__ */ jsx11("p", { className: "text-md text-text-900", children: description })
958
+ ] })
959
+ ] }),
960
+ /* @__PURE__ */ jsx11(
961
+ "button",
962
+ {
963
+ onClick: onClose,
964
+ "aria-label": "Dismiss notification",
965
+ className: "text-background-500 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity",
966
+ children: /* @__PURE__ */ jsx11(X, {})
967
+ }
968
+ )
969
+ ]
970
+ }
971
+ );
972
+ };
973
+
974
+ // src/components/Toast/utils/ToastStore.ts
975
+ import { create } from "zustand";
976
+ var useToastStore = create((set) => ({
977
+ toasts: [],
978
+ addToast: (toast) => {
979
+ const id = crypto.randomUUID();
980
+ set((state) => ({
981
+ toasts: [...state.toasts, { id, ...toast }]
982
+ }));
983
+ },
984
+ removeToast: (id) => {
985
+ set((state) => ({
986
+ toasts: state.toasts.filter((t) => t.id !== id)
987
+ }));
988
+ }
989
+ }));
990
+
991
+ // src/components/Toast/utils/Toaster.tsx
992
+ import { Fragment, jsx as jsx12 } from "react/jsx-runtime";
993
+ var Toaster = () => {
994
+ const toasts = useToastStore((state) => state.toasts);
995
+ const removeToast = useToastStore((state) => state.removeToast);
996
+ return /* @__PURE__ */ jsx12(Fragment, { children: toasts.map((toast) => /* @__PURE__ */ jsx12(
997
+ Toast,
998
+ {
999
+ title: toast.title,
1000
+ description: toast.description,
1001
+ variant: toast.variant,
1002
+ action: toast.action,
1003
+ position: toast.position,
1004
+ onClose: () => removeToast(toast.id)
1005
+ },
1006
+ toast.id
1007
+ )) });
1008
+ };
1009
+ var useToast = () => {
1010
+ const addToast = useToastStore((state) => state.addToast);
1011
+ const removeToast = useToastStore((state) => state.removeToast);
1012
+ return { addToast, removeToast };
1013
+ };
900
1014
  export {
1015
+ Badge,
901
1016
  Button,
902
1017
  CheckBox,
903
1018
  DropdownMenu,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "analytica-frontend-lib",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "Repositório público dos componentes utilizados nas plataformas da Analytica Ensino",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "./dist/index.js",