analytica-frontend-lib 1.0.19 → 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.css CHANGED
@@ -116,10 +116,10 @@
116
116
  --color-indicator-primary: #373737;
117
117
  --color-indicator-info: #5399ec;
118
118
  --color-indicator-error: #b91c1c;
119
- --color-exame-1: #e3f1fb;
120
- --color-exame-2: #fde5fa;
121
- --color-exame-3: #fff4d1;
122
- --color-exame-4: #ddf5e5;
119
+ --color-exam-1: #e3f1fb;
120
+ --color-exam-2: #fde5fa;
121
+ --color-exam-3: #fff4d1;
122
+ --color-exam-4: #ddf5e5;
123
123
  --color-typography-1: #b00c9e;
124
124
  --color-typography-2: #745A07;
125
125
  --font-weight-hairline: 100;
@@ -412,6 +412,9 @@
412
412
  .my-4 {
413
413
  margin-block: calc(var(--spacing) * 4);
414
414
  }
415
+ .mt-0\.5 {
416
+ margin-top: calc(var(--spacing) * 0.5);
417
+ }
415
418
  .mt-1 {
416
419
  margin-top: calc(var(--spacing) * 1);
417
420
  }
@@ -427,6 +430,9 @@
427
430
  .mr-2 {
428
431
  margin-right: calc(var(--spacing) * 2);
429
432
  }
433
+ .mb-0\.5 {
434
+ margin-bottom: calc(var(--spacing) * 0.5);
435
+ }
430
436
  .mb-2 {
431
437
  margin-bottom: calc(var(--spacing) * 2);
432
438
  }
@@ -517,6 +523,9 @@
517
523
  .w-10 {
518
524
  width: calc(var(--spacing) * 10);
519
525
  }
526
+ .w-\[384px\] {
527
+ width: 384px;
528
+ }
520
529
  .w-full {
521
530
  width: 100%;
522
531
  }
@@ -711,6 +720,9 @@
711
720
  .border-success-500 {
712
721
  border-color: var(--color-success-500);
713
722
  }
723
+ .border-transparent {
724
+ border-color: transparent;
725
+ }
714
726
  .border-warning-200 {
715
727
  border-color: var(--color-warning-200);
716
728
  }
@@ -738,17 +750,17 @@
738
750
  .bg-error-500 {
739
751
  background-color: var(--color-error-500);
740
752
  }
741
- .bg-exame-1 {
742
- background-color: var(--color-exame-1);
753
+ .bg-exam-1 {
754
+ background-color: var(--color-exam-1);
743
755
  }
744
- .bg-exame-2 {
745
- background-color: var(--color-exame-2);
756
+ .bg-exam-2 {
757
+ background-color: var(--color-exam-2);
746
758
  }
747
- .bg-exame-3 {
748
- background-color: var(--color-exame-3);
759
+ .bg-exam-3 {
760
+ background-color: var(--color-exam-3);
749
761
  }
750
- .bg-exame-4 {
751
- background-color: var(--color-exame-4);
762
+ .bg-exam-4 {
763
+ background-color: var(--color-exam-4);
752
764
  }
753
765
  .bg-indicator-error {
754
766
  background-color: var(--color-indicator-error);
@@ -1291,6 +1303,11 @@
1291
1303
  border-width: 0px;
1292
1304
  }
1293
1305
  }
1306
+ .focus-visible\:bg-background-50 {
1307
+ &:focus-visible {
1308
+ background-color: var(--color-background-50);
1309
+ }
1310
+ }
1294
1311
  .focus-visible\:bg-error-500 {
1295
1312
  &:focus-visible {
1296
1313
  background-color: var(--color-error-500);
@@ -1672,10 +1689,10 @@
1672
1689
  --color-indicator-primary: #f7f7f7;
1673
1690
  --color-indicator-info: #a1c7f5;
1674
1691
  --color-indicator-error: #e84645;
1675
- --color-exame-1: #e3f1fb;
1676
- --color-exame-2: #fde5fa;
1677
- --color-exame-3: #fff4d1;
1678
- --color-exame-4: #ddf5e5;
1692
+ --color-exam-1: #e3f1fb;
1693
+ --color-exam-2: #fde5fa;
1694
+ --color-exam-3: #fff4d1;
1695
+ --color-exam-4: #ddf5e5;
1679
1696
  --color-subject-1: #b7dfff;
1680
1697
  --color-subject-2: #fbd1a5;
1681
1698
  --color-subject-3: #b2e7e8;
@@ -1833,10 +1850,10 @@
1833
1850
  --color-indicator-primary: #373737;
1834
1851
  --color-indicator-info: #5399ec;
1835
1852
  --color-indicator-error: #b91c1c;
1836
- --color-exame-1: #e3f1fb;
1837
- --color-exame-2: #fde5fa;
1838
- --color-exame-3: #fff4d1;
1839
- --color-exame-4: #ddf5e5;
1853
+ --color-exam-1: #e3f1fb;
1854
+ --color-exam-2: #fde5fa;
1855
+ --color-exam-3: #fff4d1;
1856
+ --color-exam-4: #ddf5e5;
1840
1857
  --color-subject-1: #b7dfff;
1841
1858
  --color-subject-2: #fbd1a5;
1842
1859
  --color-subject-3: #b2e7e8;
package/dist/index.js CHANGED
@@ -276,10 +276,10 @@ var VARIANT_ACTION_CLASSES2 = {
276
276
  muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
277
277
  },
278
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"
279
+ exam1: "bg-exam-1 text-info-200 focus-visible:outline-none",
280
+ exam2: "bg-exam-2 text-typography-1 focus-visible:outline-none",
281
+ exam3: "bg-exam-3 text-typography-2 focus-visible:outline-none",
282
+ exam4: "bg-exam-4 text-success-700 focus-visible:outline-none"
283
283
  },
284
284
  resultStatus: {
285
285
  negative: "bg-error text-error-800 focus-visible:outline-none",
@@ -630,9 +630,32 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
630
630
  [isControlled, onOpenChange]
631
631
  );
632
632
  const menuRef = (0, import_react4.useRef)(null);
633
- const handleEscape = (event) => {
633
+ const handleArrowDownOrArrowUp = (event) => {
634
+ const menuContent = menuRef.current?.querySelector('[role="menu"]');
635
+ if (menuContent) {
636
+ event.preventDefault();
637
+ const items = Array.from(
638
+ menuContent.querySelectorAll(
639
+ '[role="menuitem"]:not([aria-disabled="true"])'
640
+ )
641
+ ).filter((el) => el instanceof HTMLElement);
642
+ if (items.length === 0) return;
643
+ const focusedItem = document.activeElement;
644
+ const currentIndex = items.findIndex((item) => item === focusedItem);
645
+ let nextIndex;
646
+ if (event.key === "ArrowDown") {
647
+ nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
648
+ } else {
649
+ nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
650
+ }
651
+ items[nextIndex]?.focus();
652
+ }
653
+ };
654
+ const handleDownkey = (event) => {
634
655
  if (event.key === "Escape") {
635
656
  setOpen(false);
657
+ } else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
658
+ handleArrowDownOrArrowUp(event);
636
659
  }
637
660
  };
638
661
  const handleClickOutside = (event) => {
@@ -643,11 +666,11 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
643
666
  (0, import_react4.useEffect)(() => {
644
667
  if (currentOpen) {
645
668
  document.addEventListener("mousedown", handleClickOutside);
646
- document.addEventListener("keydown", handleEscape);
669
+ document.addEventListener("keydown", handleDownkey);
647
670
  }
648
671
  return () => {
649
672
  document.removeEventListener("mousedown", handleClickOutside);
650
- document.removeEventListener("keydown", handleEscape);
673
+ document.removeEventListener("keydown", handleDownkey);
651
674
  };
652
675
  }, [currentOpen]);
653
676
  const value = (0, import_react4.useMemo)(
@@ -780,6 +803,7 @@ var MenuItem = (0, import_react4.forwardRef)(
780
803
  role: "menuitem",
781
804
  "aria-disabled": disabled,
782
805
  className: `
806
+ focus-visible:bg-background-50
783
807
  relative flex select-none items-center gap-2 rounded-sm p-3 text-sm outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0
784
808
  ${inset && "pl-8"}
785
809
  ${sizeClasses}
package/dist/index.mjs CHANGED
@@ -225,10 +225,10 @@ var VARIANT_ACTION_CLASSES2 = {
225
225
  muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
226
226
  },
227
227
  exams: {
228
- exam1: "bg-exame-1 text-info-200 focus-visible:outline-none",
229
- exam2: "bg-exame-2 text-typography-1 focus-visible:outline-none",
230
- exam3: "bg-exame-3 text-typography-2 focus-visible:outline-none",
231
- exam4: "bg-exame-4 text-success-700 focus-visible:outline-none"
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
232
  },
233
233
  resultStatus: {
234
234
  negative: "bg-error text-error-800 focus-visible:outline-none",
@@ -592,9 +592,32 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
592
592
  [isControlled, onOpenChange]
593
593
  );
594
594
  const menuRef = useRef(null);
595
- 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) => {
596
617
  if (event.key === "Escape") {
597
618
  setOpen(false);
619
+ } else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
620
+ handleArrowDownOrArrowUp(event);
598
621
  }
599
622
  };
600
623
  const handleClickOutside = (event) => {
@@ -605,11 +628,11 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
605
628
  useEffect(() => {
606
629
  if (currentOpen) {
607
630
  document.addEventListener("mousedown", handleClickOutside);
608
- document.addEventListener("keydown", handleEscape);
631
+ document.addEventListener("keydown", handleDownkey);
609
632
  }
610
633
  return () => {
611
634
  document.removeEventListener("mousedown", handleClickOutside);
612
- document.removeEventListener("keydown", handleEscape);
635
+ document.removeEventListener("keydown", handleDownkey);
613
636
  };
614
637
  }, [currentOpen]);
615
638
  const value = useMemo(
@@ -742,6 +765,7 @@ var MenuItem = forwardRef4(
742
765
  role: "menuitem",
743
766
  "aria-disabled": disabled,
744
767
  className: `
768
+ focus-visible:bg-background-50
745
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
746
770
  ${inset && "pl-8"}
747
771
  ${sizeClasses}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "analytica-frontend-lib",
3
- "version": "1.0.19",
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",