analytica-frontend-lib 1.0.75 → 1.0.77

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.d.mts CHANGED
@@ -27,7 +27,7 @@ export { AlertDialog } from './AlertDialog/index.mjs';
27
27
  export { default as DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, MenuLabel, ProfileMenuFooter, ProfileMenuHeader, ProfileMenuSection, ProfileMenuTrigger } from './DropdownMenu/index.mjs';
28
28
  export { default as Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './Select/index.mjs';
29
29
  export { default as Menu, MenuContent, MenuItem, MenuOverflow } from './Menu/index.mjs';
30
- export { CardActivitiesResults, CardPerformance, CardProgress, CardQuestions, CardResults, CardSimulado, CardStatus, CardTopic } from './Card/index.mjs';
30
+ export { CardActivitiesResults, CardPerformance, CardProgress, CardQuestions, CardResults, CardSimulado, CardStatus, CardTest, CardTopic } from './Card/index.mjs';
31
31
  export { Skeleton, SkeletonCard, SkeletonCircle, SkeletonList, SkeletonRectangle, SkeletonRounded, SkeletonTable, SkeletonText } from './Skeleton/index.mjs';
32
32
  export { AuthProvider, ProtectedRoute, PublicRoute, getRootDomain, useAuth, useAuthGuard, useRouteAuth, withAuth } from './Auth/index.mjs';
33
33
  export { createZustandAuthAdapter } from './Auth/zustandAuthAdapter/index.mjs';
package/dist/index.d.ts CHANGED
@@ -27,7 +27,7 @@ export { AlertDialog } from './AlertDialog/index.js';
27
27
  export { default as DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, MenuLabel, ProfileMenuFooter, ProfileMenuHeader, ProfileMenuSection, ProfileMenuTrigger } from './DropdownMenu/index.js';
28
28
  export { default as Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './Select/index.js';
29
29
  export { default as Menu, MenuContent, MenuItem, MenuOverflow } from './Menu/index.js';
30
- export { CardActivitiesResults, CardPerformance, CardProgress, CardQuestions, CardResults, CardSimulado, CardStatus, CardTopic } from './Card/index.js';
30
+ export { CardActivitiesResults, CardPerformance, CardProgress, CardQuestions, CardResults, CardSimulado, CardStatus, CardTest, CardTopic } from './Card/index.js';
31
31
  export { Skeleton, SkeletonCard, SkeletonCircle, SkeletonList, SkeletonRectangle, SkeletonRounded, SkeletonTable, SkeletonText } from './Skeleton/index.js';
32
32
  export { AuthProvider, ProtectedRoute, PublicRoute, getRootDomain, useAuth, useAuthGuard, useRouteAuth, withAuth } from './Auth/index.js';
33
33
  export { createZustandAuthAdapter } from './Auth/zustandAuthAdapter/index.js';
package/dist/index.js CHANGED
@@ -35,6 +35,7 @@ __export(src_exports, {
35
35
  CardResults: () => CardResults,
36
36
  CardSimulado: () => CardSimulado,
37
37
  CardStatus: () => CardStatus,
38
+ CardTest: () => CardTest,
38
39
  CardTopic: () => CardTopic,
39
40
  CheckBox: () => CheckBox_default,
40
41
  Chips: () => Chips_default,
@@ -4218,7 +4219,7 @@ var import_phosphor_react11 = require("phosphor-react");
4218
4219
  var import_jsx_runtime24 = require("react/jsx-runtime");
4219
4220
  var CardAccordation = (0, import_react12.forwardRef)(
4220
4221
  ({
4221
- title,
4222
+ trigger,
4222
4223
  children,
4223
4224
  className,
4224
4225
  defaultExpanded = false,
@@ -4232,6 +4233,12 @@ var CardAccordation = (0, import_react12.forwardRef)(
4232
4233
  setIsExpanded(newExpanded);
4233
4234
  onToggleExpanded?.(newExpanded);
4234
4235
  };
4236
+ const handleKeyDown = (event) => {
4237
+ if (event.key === "Enter" || event.key === " ") {
4238
+ event.preventDefault();
4239
+ handleToggle();
4240
+ }
4241
+ };
4235
4242
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
4236
4243
  CardBase,
4237
4244
  {
@@ -4246,19 +4253,12 @@ var CardAccordation = (0, import_react12.forwardRef)(
4246
4253
  "button",
4247
4254
  {
4248
4255
  onClick: handleToggle,
4249
- className: "w-full cursor-pointer p-4 flex items-center justify-between gap-3 text-left transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-inset",
4256
+ onKeyDown: handleKeyDown,
4257
+ className: "w-full cursor-pointer text-text-950 not-aria-expanded:rounded-xl aria-expanded:rounded-t-xl p-4 flex items-center justify-between gap-3 text-left transition-colors duration-200 focus:outline-none focus:border-2 focus:border-primary-950 focus:ring-inset",
4250
4258
  "aria-expanded": isExpanded,
4251
4259
  "aria-controls": "accordion-content",
4252
4260
  children: [
4253
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4254
- Text_default,
4255
- {
4256
- size: "sm",
4257
- weight: "bold",
4258
- className: "text-text-950 truncate flex-1",
4259
- children: title
4260
- }
4261
- ),
4261
+ trigger,
4262
4262
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4263
4263
  import_phosphor_react11.CaretRight,
4264
4264
  {
@@ -4303,6 +4303,7 @@ var AlternativesList = ({
4303
4303
  }) => {
4304
4304
  const uniqueId = (0, import_react13.useId)();
4305
4305
  const groupName = name || `alternatives-${uniqueId}`;
4306
+ const [actualValue, setActualValue] = (0, import_react13.useState)(value);
4306
4307
  const isReadonly = mode === "readonly";
4307
4308
  const getStatusStyles = (status, isReadonly2) => {
4308
4309
  const hoverClass = isReadonly2 ? "" : "hover:bg-background-50";
@@ -4361,7 +4362,13 @@ var AlternativesList = ({
4361
4362
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-start gap-3 flex-1", children: [
4362
4363
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "mt-1", children: renderRadio() }),
4363
4364
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex-1", children: [
4364
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "block font-medium text-text-950", children: alternative.label }),
4365
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4366
+ "p",
4367
+ {
4368
+ className: `block font-medium ${selectedValue === alternative.value || statusBadge ? "text-primary-950" : "text-text-600"}`,
4369
+ children: alternative.label
4370
+ }
4371
+ ),
4365
4372
  alternative.description && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm text-text-600 mt-1", children: alternative.description })
4366
4373
  ] })
4367
4374
  ] }),
@@ -4378,7 +4385,13 @@ var AlternativesList = ({
4378
4385
  children: [
4379
4386
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2 flex-1", children: [
4380
4387
  renderRadio(),
4381
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "flex-1", children: alternative.label })
4388
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4389
+ "span",
4390
+ {
4391
+ className: `flex-1 ${selectedValue === alternative.value || statusBadge ? "text-primary-950" : "text-text-600"}`,
4392
+ children: alternative.label
4393
+ }
4394
+ )
4382
4395
  ] }),
4383
4396
  statusBadge && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
4384
4397
  ]
@@ -4403,7 +4416,10 @@ var AlternativesList = ({
4403
4416
  name: groupName,
4404
4417
  defaultValue,
4405
4418
  value,
4406
- onValueChange,
4419
+ onValueChange: (value2) => {
4420
+ setActualValue(value2);
4421
+ onValueChange?.(value2);
4422
+ },
4407
4423
  disabled,
4408
4424
  className: `flex flex-col ${getLayoutClasses()} ${className}`,
4409
4425
  children: alternatives.map((alternative, index) => {
@@ -4431,7 +4447,9 @@ var AlternativesList = ({
4431
4447
  "label",
4432
4448
  {
4433
4449
  htmlFor: alternativeId,
4434
- className: `block font-medium text-text-950 ${alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"}`,
4450
+ className: `block font-medium
4451
+ ${actualValue === alternative.value ? "text-primary-950" : "text-text-600"}
4452
+ ${alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"}`,
4435
4453
  children: alternative.label
4436
4454
  }
4437
4455
  ),
@@ -4462,7 +4480,9 @@ var AlternativesList = ({
4462
4480
  "label",
4463
4481
  {
4464
4482
  htmlFor: alternativeId,
4465
- className: `flex-1 ${alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"}`,
4483
+ className: `flex-1
4484
+ ${actualValue === alternative.value ? "text-primary-950" : "text-text-600"}
4485
+ ${alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"}`,
4466
4486
  children: alternative.label
4467
4487
  }
4468
4488
  )
@@ -4508,38 +4528,27 @@ var SIZE_CLASSES11 = {
4508
4528
  };
4509
4529
  var AlertDialog = (0, import_react14.forwardRef)(
4510
4530
  ({
4511
- trigger,
4512
4531
  description,
4513
4532
  cancelButtonLabel = "Cancelar",
4514
4533
  submitButtonLabel = "Deletar",
4515
4534
  title,
4516
- isOpen: controlledIsOpen,
4517
- onOpen,
4518
- onClose,
4535
+ isOpen,
4519
4536
  closeOnBackdropClick = true,
4520
4537
  closeOnEscape = true,
4521
4538
  className = "",
4522
4539
  onSubmit,
4540
+ onChangeOpen,
4523
4541
  submitValue,
4524
4542
  onCancel,
4525
4543
  cancelValue,
4526
4544
  size = "medium",
4527
4545
  ...props
4528
4546
  }, ref) => {
4529
- const [internalIsOpen, setInternalIsOpen] = (0, import_react14.useState)(false);
4530
- const isOpen = controlledIsOpen ?? internalIsOpen;
4531
- const setIsOpen = (open) => {
4532
- if (controlledIsOpen === void 0) {
4533
- setInternalIsOpen(open);
4534
- }
4535
- if (open && onOpen) onOpen();
4536
- if (!open && onClose) onClose();
4537
- };
4538
4547
  (0, import_react14.useEffect)(() => {
4539
4548
  if (!isOpen || !closeOnEscape) return;
4540
4549
  const handleEscape = (event) => {
4541
4550
  if (event.key === "Escape") {
4542
- setIsOpen(false);
4551
+ onChangeOpen(false);
4543
4552
  }
4544
4553
  };
4545
4554
  document.addEventListener("keydown", handleEscape);
@@ -4557,86 +4566,71 @@ var AlertDialog = (0, import_react14.forwardRef)(
4557
4566
  }, [isOpen]);
4558
4567
  const handleBackdropClick = (event) => {
4559
4568
  if (event.target === event.currentTarget && closeOnBackdropClick) {
4560
- setIsOpen(false);
4569
+ onChangeOpen(false);
4561
4570
  }
4562
4571
  };
4563
4572
  const handleBackdropKeyDown = (event) => {
4564
4573
  if (event.key === "Escape" && closeOnEscape) {
4565
- setIsOpen(false);
4574
+ onChangeOpen(false);
4566
4575
  }
4567
4576
  };
4568
- const handleTriggerClick = () => {
4569
- setIsOpen(true);
4570
- };
4571
4577
  const handleSubmit = () => {
4572
- setIsOpen(false);
4578
+ onChangeOpen(false);
4573
4579
  onSubmit?.(submitValue);
4574
4580
  };
4575
4581
  const handleCancel = () => {
4576
- setIsOpen(false);
4582
+ onChangeOpen(false);
4577
4583
  onCancel?.(cancelValue);
4578
4584
  };
4579
4585
  const sizeClasses = SIZE_CLASSES11[size];
4580
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
4581
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4582
- "button",
4583
- {
4584
- onClick: handleTriggerClick,
4585
- "aria-label": "Open dialog",
4586
- type: "button",
4587
- className: "border-none bg-transparent p-0 cursor-pointer",
4588
- children: trigger
4589
- }
4590
- ),
4591
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4592
- "div",
4593
- {
4594
- className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",
4595
- onClick: handleBackdropClick,
4596
- onKeyDown: handleBackdropKeyDown,
4597
- "data-testid": "alert-dialog-overlay",
4598
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
4599
- "div",
4600
- {
4601
- ref,
4602
- className: `bg-background border border-border-100 rounded-lg shadow-lg p-6 m-3 ${sizeClasses} ${className}`,
4603
- ...props,
4604
- children: [
4605
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4606
- "h2",
4607
- {
4608
- id: "alert-dialog-title",
4609
- className: "pb-3 text-xl font-semibold",
4610
- children: title
4611
- }
4612
- ),
4586
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: isOpen && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4587
+ "div",
4588
+ {
4589
+ className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",
4590
+ onClick: handleBackdropClick,
4591
+ onKeyDown: handleBackdropKeyDown,
4592
+ "data-testid": "alert-dialog-overlay",
4593
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
4594
+ "div",
4595
+ {
4596
+ ref,
4597
+ className: `bg-background border border-border-100 rounded-lg shadow-lg p-6 m-3 ${sizeClasses} ${className}`,
4598
+ ...props,
4599
+ children: [
4600
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4601
+ "h2",
4602
+ {
4603
+ id: "alert-dialog-title",
4604
+ className: "pb-3 text-xl font-semibold",
4605
+ children: title
4606
+ }
4607
+ ),
4608
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4609
+ "p",
4610
+ {
4611
+ id: "alert-dialog-description",
4612
+ className: "text-text-700 text-sm",
4613
+ children: description
4614
+ }
4615
+ ),
4616
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-row items-center justify-end pt-4 gap-3", children: [
4617
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button_default, { variant: "outline", size: "small", onClick: handleCancel, children: cancelButtonLabel }),
4613
4618
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4614
- "p",
4619
+ Button_default,
4615
4620
  {
4616
- id: "alert-dialog-description",
4617
- className: "text-text-700 text-sm",
4618
- children: description
4621
+ variant: "solid",
4622
+ size: "small",
4623
+ action: "negative",
4624
+ onClick: handleSubmit,
4625
+ children: submitButtonLabel
4619
4626
  }
4620
- ),
4621
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-row items-center justify-end pt-4 gap-3", children: [
4622
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button_default, { variant: "outline", size: "small", onClick: handleCancel, children: cancelButtonLabel }),
4623
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4624
- Button_default,
4625
- {
4626
- variant: "solid",
4627
- size: "small",
4628
- action: "negative",
4629
- onClick: handleSubmit,
4630
- children: submitButtonLabel
4631
- }
4632
- )
4633
- ] })
4634
- ]
4635
- }
4636
- )
4637
- }
4638
- )
4639
- ] });
4627
+ )
4628
+ ] })
4629
+ ]
4630
+ }
4631
+ )
4632
+ }
4633
+ ) });
4640
4634
  }
4641
4635
  );
4642
4636
  AlertDialog.displayName = "AlertDialog";
@@ -6066,6 +6060,7 @@ function useUrlAuthentication(options) {
6066
6060
  CardResults,
6067
6061
  CardSimulado,
6068
6062
  CardStatus,
6063
+ CardTest,
6069
6064
  CardTopic,
6070
6065
  CheckBox,
6071
6066
  Chips,