analytica-frontend-lib 1.0.19 → 1.0.21

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.d.mts CHANGED
@@ -141,7 +141,7 @@ type BaseTextProps = {
141
141
  /** Font weight variant */
142
142
  weight?: 'hairline' | 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black';
143
143
  /** Color variant - white for light backgrounds, black for dark backgrounds */
144
- color?: 'white' | 'black';
144
+ color?: string;
145
145
  /** Additional CSS classes to apply */
146
146
  className?: string;
147
147
  };
@@ -162,7 +162,7 @@ type TextProps<T extends ElementType = 'p'> = BaseTextProps & {
162
162
  * @param children - The content to display
163
163
  * @param size - The text size variant (2xs, xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl, 6xl)
164
164
  * @param weight - The font weight variant (hairline, light, normal, medium, semibold, bold, extrabold, black)
165
- * @param color - The color variant (white, black) - adapts to theme
165
+ * @param color - The color variant - adapts to theme
166
166
  * @param as - The HTML tag to render - determines allowed attributes via TypeScript
167
167
  * @param className - Additional CSS classes
168
168
  * @param props - HTML attributes valid for the chosen tag only
@@ -170,7 +170,7 @@ type TextProps<T extends ElementType = 'p'> = BaseTextProps & {
170
170
  *
171
171
  * @example
172
172
  * ```tsx
173
- * <Text size="lg" weight="bold" color="black">
173
+ * <Text size="lg" weight="bold" color="text-info-800">
174
174
  * This is a large, bold text
175
175
  * </Text>
176
176
  *
package/dist/index.d.ts CHANGED
@@ -141,7 +141,7 @@ type BaseTextProps = {
141
141
  /** Font weight variant */
142
142
  weight?: 'hairline' | 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black';
143
143
  /** Color variant - white for light backgrounds, black for dark backgrounds */
144
- color?: 'white' | 'black';
144
+ color?: string;
145
145
  /** Additional CSS classes to apply */
146
146
  className?: string;
147
147
  };
@@ -162,7 +162,7 @@ type TextProps<T extends ElementType = 'p'> = BaseTextProps & {
162
162
  * @param children - The content to display
163
163
  * @param size - The text size variant (2xs, xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl, 6xl)
164
164
  * @param weight - The font weight variant (hairline, light, normal, medium, semibold, bold, extrabold, black)
165
- * @param color - The color variant (white, black) - adapts to theme
165
+ * @param color - The color variant - adapts to theme
166
166
  * @param as - The HTML tag to render - determines allowed attributes via TypeScript
167
167
  * @param className - Additional CSS classes
168
168
  * @param props - HTML attributes valid for the chosen tag only
@@ -170,7 +170,7 @@ type TextProps<T extends ElementType = 'p'> = BaseTextProps & {
170
170
  *
171
171
  * @example
172
172
  * ```tsx
173
- * <Text size="lg" weight="bold" color="black">
173
+ * <Text size="lg" weight="bold" color="text-info-800">
174
174
  * This is a large, bold text
175
175
  * </Text>
176
176
  *
package/dist/index.js CHANGED
@@ -207,14 +207,13 @@ var Text = ({
207
207
  children,
208
208
  size = "md",
209
209
  weight = "normal",
210
- color = "black",
210
+ color = "text-text-950",
211
211
  as,
212
212
  className = "",
213
213
  ...props
214
214
  }) => {
215
215
  let sizeClasses = "";
216
216
  let weightClasses = "";
217
- let colorClasses = "";
218
217
  const sizeClassMap = {
219
218
  "2xs": "text-2xs",
220
219
  xs: "text-xs",
@@ -240,17 +239,12 @@ var Text = ({
240
239
  black: "font-black"
241
240
  };
242
241
  weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
243
- const colorClassMap = {
244
- white: "text-text",
245
- black: "text-text-950"
246
- };
247
- colorClasses = colorClassMap[color] ?? colorClassMap.black;
248
242
  const baseClasses = "font-primary";
249
243
  const Component = as ?? "p";
250
244
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
251
245
  Component,
252
246
  {
253
- className: `${baseClasses} ${sizeClasses} ${weightClasses} ${colorClasses} ${className}`,
247
+ className: `${baseClasses} ${sizeClasses} ${weightClasses} ${color} ${className}`,
254
248
  ...props,
255
249
  children
256
250
  }
@@ -276,10 +270,10 @@ var VARIANT_ACTION_CLASSES2 = {
276
270
  muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
277
271
  },
278
272
  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"
273
+ exam1: "bg-exam-1 text-info-200 focus-visible:outline-none",
274
+ exam2: "bg-exam-2 text-typography-1 focus-visible:outline-none",
275
+ exam3: "bg-exam-3 text-typography-2 focus-visible:outline-none",
276
+ exam4: "bg-exam-4 text-success-700 focus-visible:outline-none"
283
277
  },
284
278
  resultStatus: {
285
279
  negative: "bg-error text-error-800 focus-visible:outline-none",
@@ -497,7 +491,6 @@ var CheckBox = (0, import_react2.forwardRef)(
497
491
  htmlFor: inputId,
498
492
  size: sizeClasses.textSize,
499
493
  weight: "normal",
500
- color: "black",
501
494
  className: `cursor-pointer select-none leading-[150%] flex items-center font-roboto ${labelClassName}`,
502
495
  children: label
503
496
  }
@@ -507,8 +500,26 @@ var CheckBox = (0, import_react2.forwardRef)(
507
500
  ]
508
501
  }
509
502
  ),
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 })
503
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
504
+ Text,
505
+ {
506
+ size: "sm",
507
+ weight: "normal",
508
+ className: "mt-1.5",
509
+ color: "text-error-600",
510
+ children: errorMessage
511
+ }
512
+ ),
513
+ helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
514
+ Text,
515
+ {
516
+ size: "sm",
517
+ weight: "normal",
518
+ className: "mt-1.5",
519
+ color: "text-text-500",
520
+ children: helperText
521
+ }
522
+ )
512
523
  ] });
513
524
  }
514
525
  );
@@ -630,9 +641,32 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
630
641
  [isControlled, onOpenChange]
631
642
  );
632
643
  const menuRef = (0, import_react4.useRef)(null);
633
- const handleEscape = (event) => {
644
+ const handleArrowDownOrArrowUp = (event) => {
645
+ const menuContent = menuRef.current?.querySelector('[role="menu"]');
646
+ if (menuContent) {
647
+ event.preventDefault();
648
+ const items = Array.from(
649
+ menuContent.querySelectorAll(
650
+ '[role="menuitem"]:not([aria-disabled="true"])'
651
+ )
652
+ ).filter((el) => el instanceof HTMLElement);
653
+ if (items.length === 0) return;
654
+ const focusedItem = document.activeElement;
655
+ const currentIndex = items.findIndex((item) => item === focusedItem);
656
+ let nextIndex;
657
+ if (event.key === "ArrowDown") {
658
+ nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
659
+ } else {
660
+ nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
661
+ }
662
+ items[nextIndex]?.focus();
663
+ }
664
+ };
665
+ const handleDownkey = (event) => {
634
666
  if (event.key === "Escape") {
635
667
  setOpen(false);
668
+ } else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
669
+ handleArrowDownOrArrowUp(event);
636
670
  }
637
671
  };
638
672
  const handleClickOutside = (event) => {
@@ -643,11 +677,11 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
643
677
  (0, import_react4.useEffect)(() => {
644
678
  if (currentOpen) {
645
679
  document.addEventListener("mousedown", handleClickOutside);
646
- document.addEventListener("keydown", handleEscape);
680
+ document.addEventListener("keydown", handleDownkey);
647
681
  }
648
682
  return () => {
649
683
  document.removeEventListener("mousedown", handleClickOutside);
650
- document.removeEventListener("keydown", handleEscape);
684
+ document.removeEventListener("keydown", handleDownkey);
651
685
  };
652
686
  }, [currentOpen]);
653
687
  const value = (0, import_react4.useMemo)(
@@ -780,6 +814,7 @@ var MenuItem = (0, import_react4.forwardRef)(
780
814
  role: "menuitem",
781
815
  "aria-disabled": disabled,
782
816
  className: `
817
+ focus-visible:bg-background-50
783
818
  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
819
  ${inset && "pl-8"}
785
820
  ${sizeClasses}
package/dist/index.mjs CHANGED
@@ -156,14 +156,13 @@ var Text = ({
156
156
  children,
157
157
  size = "md",
158
158
  weight = "normal",
159
- color = "black",
159
+ color = "text-text-950",
160
160
  as,
161
161
  className = "",
162
162
  ...props
163
163
  }) => {
164
164
  let sizeClasses = "";
165
165
  let weightClasses = "";
166
- let colorClasses = "";
167
166
  const sizeClassMap = {
168
167
  "2xs": "text-2xs",
169
168
  xs: "text-xs",
@@ -189,17 +188,12 @@ var Text = ({
189
188
  black: "font-black"
190
189
  };
191
190
  weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
192
- const colorClassMap = {
193
- white: "text-text",
194
- black: "text-text-950"
195
- };
196
- colorClasses = colorClassMap[color] ?? colorClassMap.black;
197
191
  const baseClasses = "font-primary";
198
192
  const Component = as ?? "p";
199
193
  return /* @__PURE__ */ jsx4(
200
194
  Component,
201
195
  {
202
- className: `${baseClasses} ${sizeClasses} ${weightClasses} ${colorClasses} ${className}`,
196
+ className: `${baseClasses} ${sizeClasses} ${weightClasses} ${color} ${className}`,
203
197
  ...props,
204
198
  children
205
199
  }
@@ -225,10 +219,10 @@ var VARIANT_ACTION_CLASSES2 = {
225
219
  muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
226
220
  },
227
221
  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"
222
+ exam1: "bg-exam-1 text-info-200 focus-visible:outline-none",
223
+ exam2: "bg-exam-2 text-typography-1 focus-visible:outline-none",
224
+ exam3: "bg-exam-3 text-typography-2 focus-visible:outline-none",
225
+ exam4: "bg-exam-4 text-success-700 focus-visible:outline-none"
232
226
  },
233
227
  resultStatus: {
234
228
  negative: "bg-error text-error-800 focus-visible:outline-none",
@@ -450,7 +444,6 @@ var CheckBox = forwardRef2(
450
444
  htmlFor: inputId,
451
445
  size: sizeClasses.textSize,
452
446
  weight: "normal",
453
- color: "black",
454
447
  className: `cursor-pointer select-none leading-[150%] flex items-center font-roboto ${labelClassName}`,
455
448
  children: label
456
449
  }
@@ -460,8 +453,26 @@ var CheckBox = forwardRef2(
460
453
  ]
461
454
  }
462
455
  ),
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 })
456
+ errorMessage && /* @__PURE__ */ jsx6(
457
+ Text,
458
+ {
459
+ size: "sm",
460
+ weight: "normal",
461
+ className: "mt-1.5",
462
+ color: "text-error-600",
463
+ children: errorMessage
464
+ }
465
+ ),
466
+ helperText && !errorMessage && /* @__PURE__ */ jsx6(
467
+ Text,
468
+ {
469
+ size: "sm",
470
+ weight: "normal",
471
+ className: "mt-1.5",
472
+ color: "text-text-500",
473
+ children: helperText
474
+ }
475
+ )
465
476
  ] });
466
477
  }
467
478
  );
@@ -592,9 +603,32 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
592
603
  [isControlled, onOpenChange]
593
604
  );
594
605
  const menuRef = useRef(null);
595
- const handleEscape = (event) => {
606
+ const handleArrowDownOrArrowUp = (event) => {
607
+ const menuContent = menuRef.current?.querySelector('[role="menu"]');
608
+ if (menuContent) {
609
+ event.preventDefault();
610
+ const items = Array.from(
611
+ menuContent.querySelectorAll(
612
+ '[role="menuitem"]:not([aria-disabled="true"])'
613
+ )
614
+ ).filter((el) => el instanceof HTMLElement);
615
+ if (items.length === 0) return;
616
+ const focusedItem = document.activeElement;
617
+ const currentIndex = items.findIndex((item) => item === focusedItem);
618
+ let nextIndex;
619
+ if (event.key === "ArrowDown") {
620
+ nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
621
+ } else {
622
+ nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
623
+ }
624
+ items[nextIndex]?.focus();
625
+ }
626
+ };
627
+ const handleDownkey = (event) => {
596
628
  if (event.key === "Escape") {
597
629
  setOpen(false);
630
+ } else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
631
+ handleArrowDownOrArrowUp(event);
598
632
  }
599
633
  };
600
634
  const handleClickOutside = (event) => {
@@ -605,11 +639,11 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
605
639
  useEffect(() => {
606
640
  if (currentOpen) {
607
641
  document.addEventListener("mousedown", handleClickOutside);
608
- document.addEventListener("keydown", handleEscape);
642
+ document.addEventListener("keydown", handleDownkey);
609
643
  }
610
644
  return () => {
611
645
  document.removeEventListener("mousedown", handleClickOutside);
612
- document.removeEventListener("keydown", handleEscape);
646
+ document.removeEventListener("keydown", handleDownkey);
613
647
  };
614
648
  }, [currentOpen]);
615
649
  const value = useMemo(
@@ -742,6 +776,7 @@ var MenuItem = forwardRef4(
742
776
  role: "menuitem",
743
777
  "aria-disabled": disabled,
744
778
  className: `
779
+ focus-visible:bg-background-50
745
780
  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
781
  ${inset && "pl-8"}
747
782
  ${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.21",
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",