analytica-frontend-lib 1.0.74 → 1.0.76

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.
Files changed (81) hide show
  1. package/dist/Accordation/index.d.mts +1 -1
  2. package/dist/Accordation/index.d.ts +1 -1
  3. package/dist/Accordation/index.js +10 -11
  4. package/dist/Accordation/index.js.map +1 -1
  5. package/dist/Accordation/index.mjs +15 -12
  6. package/dist/Accordation/index.mjs.map +1 -1
  7. package/dist/AlertDialog/index.d.mts +4 -8
  8. package/dist/AlertDialog/index.d.ts +4 -8
  9. package/dist/AlertDialog/index.js +52 -78
  10. package/dist/AlertDialog/index.js.map +1 -1
  11. package/dist/AlertDialog/index.mjs +52 -79
  12. package/dist/AlertDialog/index.mjs.map +1 -1
  13. package/dist/Alternative/index.js +25 -5
  14. package/dist/Alternative/index.js.map +1 -1
  15. package/dist/Alternative/index.mjs +26 -6
  16. package/dist/Alternative/index.mjs.map +1 -1
  17. package/dist/Auth/AuthProvider/index.d.mts +1 -1
  18. package/dist/Auth/AuthProvider/index.d.ts +1 -1
  19. package/dist/Auth/AuthProvider/index.js +2 -0
  20. package/dist/Auth/AuthProvider/index.js.map +1 -1
  21. package/dist/Auth/AuthProvider/index.mjs +1 -0
  22. package/dist/Auth/AuthProvider/index.mjs.map +1 -1
  23. package/dist/Auth/ProtectedRoute/index.d.mts +1 -1
  24. package/dist/Auth/ProtectedRoute/index.d.ts +1 -1
  25. package/dist/Auth/ProtectedRoute/index.js +2 -0
  26. package/dist/Auth/ProtectedRoute/index.js.map +1 -1
  27. package/dist/Auth/ProtectedRoute/index.mjs +1 -0
  28. package/dist/Auth/ProtectedRoute/index.mjs.map +1 -1
  29. package/dist/Auth/PublicRoute/index.d.mts +1 -1
  30. package/dist/Auth/PublicRoute/index.d.ts +1 -1
  31. package/dist/Auth/PublicRoute/index.js +2 -0
  32. package/dist/Auth/PublicRoute/index.js.map +1 -1
  33. package/dist/Auth/PublicRoute/index.mjs +1 -0
  34. package/dist/Auth/PublicRoute/index.mjs.map +1 -1
  35. package/dist/Auth/getRootDomain/index.d.mts +3 -0
  36. package/dist/Auth/getRootDomain/index.d.ts +3 -0
  37. package/dist/Auth/getRootDomain/index.js +213 -0
  38. package/dist/Auth/getRootDomain/index.js.map +1 -0
  39. package/dist/Auth/getRootDomain/index.mjs +188 -0
  40. package/dist/Auth/getRootDomain/index.mjs.map +1 -0
  41. package/dist/Auth/index.d.mts +8 -1
  42. package/dist/Auth/index.d.ts +8 -1
  43. package/dist/Auth/index.js +2 -0
  44. package/dist/Auth/index.js.map +1 -1
  45. package/dist/Auth/index.mjs +1 -0
  46. package/dist/Auth/index.mjs.map +1 -1
  47. package/dist/Auth/useAuth/index.d.mts +1 -1
  48. package/dist/Auth/useAuth/index.d.ts +1 -1
  49. package/dist/Auth/useAuth/index.js +2 -0
  50. package/dist/Auth/useAuth/index.js.map +1 -1
  51. package/dist/Auth/useAuth/index.mjs +1 -0
  52. package/dist/Auth/useAuth/index.mjs.map +1 -1
  53. package/dist/Auth/useAuthGuard/index.d.mts +1 -1
  54. package/dist/Auth/useAuthGuard/index.d.ts +1 -1
  55. package/dist/Auth/useAuthGuard/index.js +2 -0
  56. package/dist/Auth/useAuthGuard/index.js.map +1 -1
  57. package/dist/Auth/useAuthGuard/index.mjs +1 -0
  58. package/dist/Auth/useAuthGuard/index.mjs.map +1 -1
  59. package/dist/Auth/useRouteAuth/index.d.mts +1 -1
  60. package/dist/Auth/useRouteAuth/index.d.ts +1 -1
  61. package/dist/Auth/useRouteAuth/index.js +2 -0
  62. package/dist/Auth/useRouteAuth/index.js.map +1 -1
  63. package/dist/Auth/useRouteAuth/index.mjs +1 -0
  64. package/dist/Auth/useRouteAuth/index.mjs.map +1 -1
  65. package/dist/Auth/withAuth/index.d.mts +1 -1
  66. package/dist/Auth/withAuth/index.d.ts +1 -1
  67. package/dist/Auth/withAuth/index.js +2 -0
  68. package/dist/Auth/withAuth/index.js.map +1 -1
  69. package/dist/Auth/withAuth/index.mjs +1 -0
  70. package/dist/Auth/withAuth/index.mjs.map +1 -1
  71. package/dist/index.css +11 -0
  72. package/dist/index.css.map +1 -1
  73. package/dist/index.d.mts +1 -1
  74. package/dist/index.d.ts +1 -1
  75. package/dist/index.js +89 -94
  76. package/dist/index.js.map +1 -1
  77. package/dist/index.mjs +94 -97
  78. package/dist/index.mjs.map +1 -1
  79. package/dist/styles.css +11 -0
  80. package/dist/styles.css.map +1 -1
  81. package/package.json +1 -1
package/dist/index.d.mts CHANGED
@@ -29,7 +29,7 @@ export { default as Select, SelectContent, SelectItem, SelectTrigger, SelectValu
29
29
  export { default as Menu, MenuContent, MenuItem, MenuOverflow } from './Menu/index.mjs';
30
30
  export { CardActivitiesResults, CardPerformance, CardProgress, CardQuestions, CardResults, CardSimulado, CardStatus, CardTopic } from './Card/index.mjs';
31
31
  export { Skeleton, SkeletonCard, SkeletonCircle, SkeletonList, SkeletonRectangle, SkeletonRounded, SkeletonTable, SkeletonText } from './Skeleton/index.mjs';
32
- export { AuthProvider, ProtectedRoute, PublicRoute, useAuth, useAuthGuard, useRouteAuth, withAuth } from './Auth/index.mjs';
32
+ export { AuthProvider, ProtectedRoute, PublicRoute, getRootDomain, useAuth, useAuthGuard, useRouteAuth, withAuth } from './Auth/index.mjs';
33
33
  export { createZustandAuthAdapter } from './Auth/zustandAuthAdapter/index.mjs';
34
34
  export { useUrlAuthentication } from './Auth/useUrlAuthentication/index.mjs';
35
35
  import 'react/jsx-runtime';
package/dist/index.d.ts CHANGED
@@ -29,7 +29,7 @@ export { default as Select, SelectContent, SelectItem, SelectTrigger, SelectValu
29
29
  export { default as Menu, MenuContent, MenuItem, MenuOverflow } from './Menu/index.js';
30
30
  export { CardActivitiesResults, CardPerformance, CardProgress, CardQuestions, CardResults, CardSimulado, CardStatus, CardTopic } from './Card/index.js';
31
31
  export { Skeleton, SkeletonCard, SkeletonCircle, SkeletonList, SkeletonRectangle, SkeletonRounded, SkeletonTable, SkeletonText } from './Skeleton/index.js';
32
- export { AuthProvider, ProtectedRoute, PublicRoute, useAuth, useAuthGuard, useRouteAuth, withAuth } from './Auth/index.js';
32
+ export { AuthProvider, ProtectedRoute, PublicRoute, getRootDomain, useAuth, useAuthGuard, useRouteAuth, withAuth } from './Auth/index.js';
33
33
  export { createZustandAuthAdapter } from './Auth/zustandAuthAdapter/index.js';
34
34
  export { useUrlAuthentication } from './Auth/useUrlAuthentication/index.js';
35
35
  import 'react/jsx-runtime';
package/dist/index.js CHANGED
@@ -86,6 +86,7 @@ __export(src_exports, {
86
86
  Toast: () => Toast_default,
87
87
  Toaster: () => Toaster_default,
88
88
  createZustandAuthAdapter: () => createZustandAuthAdapter,
89
+ getRootDomain: () => getRootDomain,
89
90
  useAuth: () => useAuth,
90
91
  useAuthGuard: () => useAuthGuard,
91
92
  useRouteAuth: () => useRouteAuth,
@@ -4217,7 +4218,7 @@ var import_phosphor_react11 = require("phosphor-react");
4217
4218
  var import_jsx_runtime24 = require("react/jsx-runtime");
4218
4219
  var CardAccordation = (0, import_react12.forwardRef)(
4219
4220
  ({
4220
- title,
4221
+ trigger,
4221
4222
  children,
4222
4223
  className,
4223
4224
  defaultExpanded = false,
@@ -4231,6 +4232,12 @@ var CardAccordation = (0, import_react12.forwardRef)(
4231
4232
  setIsExpanded(newExpanded);
4232
4233
  onToggleExpanded?.(newExpanded);
4233
4234
  };
4235
+ const handleKeyDown = (event) => {
4236
+ if (event.key === "Enter" || event.key === " ") {
4237
+ event.preventDefault();
4238
+ handleToggle();
4239
+ }
4240
+ };
4234
4241
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
4235
4242
  CardBase,
4236
4243
  {
@@ -4245,19 +4252,12 @@ var CardAccordation = (0, import_react12.forwardRef)(
4245
4252
  "button",
4246
4253
  {
4247
4254
  onClick: handleToggle,
4248
- 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",
4255
+ onKeyDown: handleKeyDown,
4256
+ 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",
4249
4257
  "aria-expanded": isExpanded,
4250
4258
  "aria-controls": "accordion-content",
4251
4259
  children: [
4252
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4253
- Text_default,
4254
- {
4255
- size: "sm",
4256
- weight: "bold",
4257
- className: "text-text-950 truncate flex-1",
4258
- children: title
4259
- }
4260
- ),
4260
+ trigger,
4261
4261
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4262
4262
  import_phosphor_react11.CaretRight,
4263
4263
  {
@@ -4302,6 +4302,7 @@ var AlternativesList = ({
4302
4302
  }) => {
4303
4303
  const uniqueId = (0, import_react13.useId)();
4304
4304
  const groupName = name || `alternatives-${uniqueId}`;
4305
+ const [actualValue, setActualValue] = (0, import_react13.useState)(value);
4305
4306
  const isReadonly = mode === "readonly";
4306
4307
  const getStatusStyles = (status, isReadonly2) => {
4307
4308
  const hoverClass = isReadonly2 ? "" : "hover:bg-background-50";
@@ -4360,7 +4361,13 @@ var AlternativesList = ({
4360
4361
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-start gap-3 flex-1", children: [
4361
4362
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "mt-1", children: renderRadio() }),
4362
4363
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex-1", children: [
4363
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "block font-medium text-text-950", children: alternative.label }),
4364
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4365
+ "p",
4366
+ {
4367
+ className: `block font-medium ${selectedValue === alternative.value || statusBadge ? "text-primary-950" : "text-text-600"}`,
4368
+ children: alternative.label
4369
+ }
4370
+ ),
4364
4371
  alternative.description && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm text-text-600 mt-1", children: alternative.description })
4365
4372
  ] })
4366
4373
  ] }),
@@ -4377,7 +4384,13 @@ var AlternativesList = ({
4377
4384
  children: [
4378
4385
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2 flex-1", children: [
4379
4386
  renderRadio(),
4380
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "flex-1", children: alternative.label })
4387
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4388
+ "span",
4389
+ {
4390
+ className: `flex-1 ${selectedValue === alternative.value || statusBadge ? "text-primary-950" : "text-text-600"}`,
4391
+ children: alternative.label
4392
+ }
4393
+ )
4381
4394
  ] }),
4382
4395
  statusBadge && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
4383
4396
  ]
@@ -4402,7 +4415,10 @@ var AlternativesList = ({
4402
4415
  name: groupName,
4403
4416
  defaultValue,
4404
4417
  value,
4405
- onValueChange,
4418
+ onValueChange: (value2) => {
4419
+ setActualValue(value2);
4420
+ onValueChange?.(value2);
4421
+ },
4406
4422
  disabled,
4407
4423
  className: `flex flex-col ${getLayoutClasses()} ${className}`,
4408
4424
  children: alternatives.map((alternative, index) => {
@@ -4430,7 +4446,9 @@ var AlternativesList = ({
4430
4446
  "label",
4431
4447
  {
4432
4448
  htmlFor: alternativeId,
4433
- className: `block font-medium text-text-950 ${alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"}`,
4449
+ className: `block font-medium
4450
+ ${actualValue === alternative.value ? "text-primary-950" : "text-text-600"}
4451
+ ${alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"}`,
4434
4452
  children: alternative.label
4435
4453
  }
4436
4454
  ),
@@ -4461,7 +4479,9 @@ var AlternativesList = ({
4461
4479
  "label",
4462
4480
  {
4463
4481
  htmlFor: alternativeId,
4464
- className: `flex-1 ${alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"}`,
4482
+ className: `flex-1
4483
+ ${actualValue === alternative.value ? "text-primary-950" : "text-text-600"}
4484
+ ${alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"}`,
4465
4485
  children: alternative.label
4466
4486
  }
4467
4487
  )
@@ -4507,38 +4527,27 @@ var SIZE_CLASSES11 = {
4507
4527
  };
4508
4528
  var AlertDialog = (0, import_react14.forwardRef)(
4509
4529
  ({
4510
- trigger,
4511
4530
  description,
4512
4531
  cancelButtonLabel = "Cancelar",
4513
4532
  submitButtonLabel = "Deletar",
4514
4533
  title,
4515
- isOpen: controlledIsOpen,
4516
- onOpen,
4517
- onClose,
4534
+ isOpen,
4518
4535
  closeOnBackdropClick = true,
4519
4536
  closeOnEscape = true,
4520
4537
  className = "",
4521
4538
  onSubmit,
4539
+ onChangeOpen,
4522
4540
  submitValue,
4523
4541
  onCancel,
4524
4542
  cancelValue,
4525
4543
  size = "medium",
4526
4544
  ...props
4527
4545
  }, ref) => {
4528
- const [internalIsOpen, setInternalIsOpen] = (0, import_react14.useState)(false);
4529
- const isOpen = controlledIsOpen ?? internalIsOpen;
4530
- const setIsOpen = (open) => {
4531
- if (controlledIsOpen === void 0) {
4532
- setInternalIsOpen(open);
4533
- }
4534
- if (open && onOpen) onOpen();
4535
- if (!open && onClose) onClose();
4536
- };
4537
4546
  (0, import_react14.useEffect)(() => {
4538
4547
  if (!isOpen || !closeOnEscape) return;
4539
4548
  const handleEscape = (event) => {
4540
4549
  if (event.key === "Escape") {
4541
- setIsOpen(false);
4550
+ onChangeOpen(false);
4542
4551
  }
4543
4552
  };
4544
4553
  document.addEventListener("keydown", handleEscape);
@@ -4556,86 +4565,71 @@ var AlertDialog = (0, import_react14.forwardRef)(
4556
4565
  }, [isOpen]);
4557
4566
  const handleBackdropClick = (event) => {
4558
4567
  if (event.target === event.currentTarget && closeOnBackdropClick) {
4559
- setIsOpen(false);
4568
+ onChangeOpen(false);
4560
4569
  }
4561
4570
  };
4562
4571
  const handleBackdropKeyDown = (event) => {
4563
4572
  if (event.key === "Escape" && closeOnEscape) {
4564
- setIsOpen(false);
4573
+ onChangeOpen(false);
4565
4574
  }
4566
4575
  };
4567
- const handleTriggerClick = () => {
4568
- setIsOpen(true);
4569
- };
4570
4576
  const handleSubmit = () => {
4571
- setIsOpen(false);
4577
+ onChangeOpen(false);
4572
4578
  onSubmit?.(submitValue);
4573
4579
  };
4574
4580
  const handleCancel = () => {
4575
- setIsOpen(false);
4581
+ onChangeOpen(false);
4576
4582
  onCancel?.(cancelValue);
4577
4583
  };
4578
4584
  const sizeClasses = SIZE_CLASSES11[size];
4579
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
4580
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4581
- "button",
4582
- {
4583
- onClick: handleTriggerClick,
4584
- "aria-label": "Open dialog",
4585
- type: "button",
4586
- className: "border-none bg-transparent p-0 cursor-pointer",
4587
- children: trigger
4588
- }
4589
- ),
4590
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4591
- "div",
4592
- {
4593
- className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",
4594
- onClick: handleBackdropClick,
4595
- onKeyDown: handleBackdropKeyDown,
4596
- "data-testid": "alert-dialog-overlay",
4597
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
4598
- "div",
4599
- {
4600
- ref,
4601
- className: `bg-background border border-border-100 rounded-lg shadow-lg p-6 m-3 ${sizeClasses} ${className}`,
4602
- ...props,
4603
- children: [
4604
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4605
- "h2",
4606
- {
4607
- id: "alert-dialog-title",
4608
- className: "pb-3 text-xl font-semibold",
4609
- children: title
4610
- }
4611
- ),
4585
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: isOpen && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4586
+ "div",
4587
+ {
4588
+ className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",
4589
+ onClick: handleBackdropClick,
4590
+ onKeyDown: handleBackdropKeyDown,
4591
+ "data-testid": "alert-dialog-overlay",
4592
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
4593
+ "div",
4594
+ {
4595
+ ref,
4596
+ className: `bg-background border border-border-100 rounded-lg shadow-lg p-6 m-3 ${sizeClasses} ${className}`,
4597
+ ...props,
4598
+ children: [
4599
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4600
+ "h2",
4601
+ {
4602
+ id: "alert-dialog-title",
4603
+ className: "pb-3 text-xl font-semibold",
4604
+ children: title
4605
+ }
4606
+ ),
4607
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4608
+ "p",
4609
+ {
4610
+ id: "alert-dialog-description",
4611
+ className: "text-text-700 text-sm",
4612
+ children: description
4613
+ }
4614
+ ),
4615
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-row items-center justify-end pt-4 gap-3", children: [
4616
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button_default, { variant: "outline", size: "small", onClick: handleCancel, children: cancelButtonLabel }),
4612
4617
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4613
- "p",
4618
+ Button_default,
4614
4619
  {
4615
- id: "alert-dialog-description",
4616
- className: "text-text-700 text-sm",
4617
- children: description
4620
+ variant: "solid",
4621
+ size: "small",
4622
+ action: "negative",
4623
+ onClick: handleSubmit,
4624
+ children: submitButtonLabel
4618
4625
  }
4619
- ),
4620
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-row items-center justify-end pt-4 gap-3", children: [
4621
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button_default, { variant: "outline", size: "small", onClick: handleCancel, children: cancelButtonLabel }),
4622
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4623
- Button_default,
4624
- {
4625
- variant: "solid",
4626
- size: "small",
4627
- action: "negative",
4628
- onClick: handleSubmit,
4629
- children: submitButtonLabel
4630
- }
4631
- )
4632
- ] })
4633
- ]
4634
- }
4635
- )
4636
- }
4637
- )
4638
- ] });
4626
+ )
4627
+ ] })
4628
+ ]
4629
+ }
4630
+ )
4631
+ }
4632
+ ) });
4639
4633
  }
4640
4634
  );
4641
4635
  AlertDialog.displayName = "AlertDialog";
@@ -6116,6 +6110,7 @@ function useUrlAuthentication(options) {
6116
6110
  Toast,
6117
6111
  Toaster,
6118
6112
  createZustandAuthAdapter,
6113
+ getRootDomain,
6119
6114
  useAuth,
6120
6115
  useAuthGuard,
6121
6116
  useRouteAuth,