analytica-frontend-lib 1.0.77 → 1.0.79

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
@@ -3549,7 +3549,7 @@ var CardResults = forwardRef9(
3549
3549
  layout: "horizontal",
3550
3550
  padding: "none",
3551
3551
  minHeight: "medium",
3552
- className: `items-center pr-4 ${className}`,
3552
+ className: `items-center cursor-pointer pr-4 ${className}`,
3553
3553
  ...props,
3554
3554
  children: [
3555
3555
  /* @__PURE__ */ jsx23(
@@ -3579,7 +3579,7 @@ var CardResults = forwardRef9(
3579
3579
  {
3580
3580
  action: "success",
3581
3581
  variant: "solid",
3582
- size: "medium",
3582
+ size: "large",
3583
3583
  iconLeft: /* @__PURE__ */ jsx23(CheckCircle3, {}),
3584
3584
  children: [
3585
3585
  correct_answers,
@@ -3592,7 +3592,7 @@ var CardResults = forwardRef9(
3592
3592
  {
3593
3593
  action: "error",
3594
3594
  variant: "solid",
3595
- size: "medium",
3595
+ size: "large",
3596
3596
  iconLeft: /* @__PURE__ */ jsx23(XCircle2, {}),
3597
3597
  children: [
3598
3598
  incorrect_answers,
@@ -3604,14 +3604,14 @@ var CardResults = forwardRef9(
3604
3604
  ]
3605
3605
  }
3606
3606
  ),
3607
- /* @__PURE__ */ jsx23(CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer" })
3607
+ /* @__PURE__ */ jsx23(CaretRight, { className: "min-w-6 min-h-6 text-text-800" })
3608
3608
  ]
3609
3609
  }
3610
3610
  );
3611
3611
  }
3612
3612
  );
3613
3613
  var CardStatus = forwardRef9(
3614
- ({ header, className, status, ...props }, ref) => {
3614
+ ({ header, className, status, label, ...props }, ref) => {
3615
3615
  return /* @__PURE__ */ jsx23(
3616
3616
  CardBase,
3617
3617
  {
@@ -3619,7 +3619,7 @@ var CardStatus = forwardRef9(
3619
3619
  layout: "horizontal",
3620
3620
  padding: "medium",
3621
3621
  minHeight: "medium",
3622
- className: `items-center ${className}`,
3622
+ className: `items-center cursor-pointer ${className}`,
3623
3623
  ...props,
3624
3624
  children: /* @__PURE__ */ jsxs18("div", { className: "flex justify-between w-full h-full flex-row items-center gap-2", children: [
3625
3625
  /* @__PURE__ */ jsx23("p", { className: "text-sm font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
@@ -3634,7 +3634,7 @@ var CardStatus = forwardRef9(
3634
3634
  children: status == "correct" ? "Correta" : "Incorreta"
3635
3635
  }
3636
3636
  ),
3637
- /* @__PURE__ */ jsx23("p", { className: "text-sm text-text-800", children: "Respondida" })
3637
+ label && /* @__PURE__ */ jsx23("p", { className: "text-sm text-text-800", children: label })
3638
3638
  ] }),
3639
3639
  /* @__PURE__ */ jsx23(CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer flex-shrink-0 ml-2" })
3640
3640
  ] })
@@ -4313,7 +4313,7 @@ var AlternativesList = ({
4313
4313
  /* @__PURE__ */ jsx25(
4314
4314
  "p",
4315
4315
  {
4316
- className: `block font-medium ${selectedValue === alternative.value || statusBadge ? "text-primary-950" : "text-text-600"}`,
4316
+ className: `block font-medium ${selectedValue === alternative.value || statusBadge ? "text-text-950" : "text-text-600"}`,
4317
4317
  children: alternative.label
4318
4318
  }
4319
4319
  ),
@@ -4336,7 +4336,7 @@ var AlternativesList = ({
4336
4336
  /* @__PURE__ */ jsx25(
4337
4337
  "span",
4338
4338
  {
4339
- className: `flex-1 ${selectedValue === alternative.value || statusBadge ? "text-primary-950" : "text-text-600"}`,
4339
+ className: `flex-1 ${selectedValue === alternative.value || statusBadge ? "text-text-950" : "text-text-600"}`,
4340
4340
  children: alternative.label
4341
4341
  }
4342
4342
  )
@@ -4396,7 +4396,7 @@ var AlternativesList = ({
4396
4396
  {
4397
4397
  htmlFor: alternativeId,
4398
4398
  className: `block font-medium
4399
- ${actualValue === alternative.value ? "text-primary-950" : "text-text-600"}
4399
+ ${actualValue === alternative.value ? "text-text-950" : "text-text-600"}
4400
4400
  ${alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"}`,
4401
4401
  children: alternative.label
4402
4402
  }
@@ -4429,7 +4429,7 @@ var AlternativesList = ({
4429
4429
  {
4430
4430
  htmlFor: alternativeId,
4431
4431
  className: `flex-1
4432
- ${actualValue === alternative.value ? "text-primary-950" : "text-text-600"}
4432
+ ${actualValue === alternative.value ? "text-text-950" : "text-text-600"}
4433
4433
  ${alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"}`,
4434
4434
  children: alternative.label
4435
4435
  }
@@ -5750,6 +5750,104 @@ var SkeletonTable = forwardRef16(
5750
5750
  }
5751
5751
  );
5752
5752
 
5753
+ // src/components/NotFound/NotFound.tsx
5754
+ import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
5755
+ var NotFound = ({
5756
+ title,
5757
+ description,
5758
+ buttonText = "Voltar",
5759
+ onButtonClick,
5760
+ className = "",
5761
+ errorType = "404",
5762
+ customErrorCode
5763
+ }) => {
5764
+ const getErrorCode = () => {
5765
+ if (errorType === "custom") {
5766
+ return customErrorCode?.trim() || "ERROR";
5767
+ }
5768
+ return errorType;
5769
+ };
5770
+ const getDefaultTitle = () => {
5771
+ switch (errorType) {
5772
+ case "404":
5773
+ return "P\xE1gina n\xE3o encontrada";
5774
+ case "500":
5775
+ return "Erro interno do servidor";
5776
+ default:
5777
+ return "Erro";
5778
+ }
5779
+ };
5780
+ const getDefaultDescription = () => {
5781
+ switch (errorType) {
5782
+ case "404":
5783
+ return "Oops! A p\xE1gina que voc\xEA est\xE1 procurando n\xE3o existe ou foi removida.";
5784
+ case "500":
5785
+ return "Algo deu errado em nossos servidores. Tente novamente mais tarde.";
5786
+ default:
5787
+ return "Ocorreu um erro inesperado.";
5788
+ }
5789
+ };
5790
+ const handleButtonClick = (event) => {
5791
+ event.preventDefault();
5792
+ onButtonClick?.();
5793
+ };
5794
+ const errorTitle = title || getDefaultTitle();
5795
+ const errorDescription = description || getDefaultDescription();
5796
+ const errorCode = getErrorCode();
5797
+ return /* @__PURE__ */ jsx31(
5798
+ "div",
5799
+ {
5800
+ className: `flex flex-col w-full h-screen items-center justify-center bg-background-50 px-4 ${className}`,
5801
+ children: /* @__PURE__ */ jsx31(
5802
+ "main",
5803
+ {
5804
+ role: "main",
5805
+ "aria-labelledby": "error-title",
5806
+ "aria-describedby": "error-description",
5807
+ className: "flex flex-col items-center text-center max-w-md space-y-6",
5808
+ children: /* @__PURE__ */ jsxs26("section", { "aria-label": `Erro ${errorCode}`, children: [
5809
+ /* @__PURE__ */ jsx31(
5810
+ "div",
5811
+ {
5812
+ className: "text-8xl font-bold text-primary-300 select-none",
5813
+ "aria-label": `C\xF3digo de erro: ${errorCode}`,
5814
+ children: errorCode
5815
+ }
5816
+ ),
5817
+ /* @__PURE__ */ jsxs26("header", { className: "space-y-2", children: [
5818
+ /* @__PURE__ */ jsx31(
5819
+ Text_default,
5820
+ {
5821
+ size: "xl",
5822
+ weight: "bold",
5823
+ className: "text-text-950",
5824
+ id: "error-title",
5825
+ "aria-level": 1,
5826
+ children: errorTitle
5827
+ }
5828
+ ),
5829
+ /* @__PURE__ */ jsx31(Text_default, { size: "md", className: "text-text-600", id: "error-description", children: errorDescription })
5830
+ ] }),
5831
+ onButtonClick && /* @__PURE__ */ jsx31("nav", { "aria-label": "Navega\xE7\xE3o de erro", children: /* @__PURE__ */ jsx31(
5832
+ Button_default,
5833
+ {
5834
+ onClick: handleButtonClick,
5835
+ variant: "solid",
5836
+ size: "medium",
5837
+ className: "mt-8",
5838
+ "aria-describedby": "error-description",
5839
+ "aria-label": `${buttonText}. ${errorDescription}`,
5840
+ children: buttonText
5841
+ }
5842
+ ) })
5843
+ ] })
5844
+ }
5845
+ )
5846
+ }
5847
+ );
5848
+ };
5849
+ var NotFound_default = NotFound;
5850
+
5753
5851
  // src/components/Auth/Auth.tsx
5754
5852
  import {
5755
5853
  createContext,
@@ -5760,7 +5858,7 @@ import {
5760
5858
  useMemo as useMemo3
5761
5859
  } from "react";
5762
5860
  import { useLocation, Navigate } from "react-router-dom";
5763
- import { Fragment as Fragment7, jsx as jsx31 } from "react/jsx-runtime";
5861
+ import { Fragment as Fragment7, jsx as jsx32 } from "react/jsx-runtime";
5764
5862
  var AuthContext = createContext(void 0);
5765
5863
  var AuthProvider = ({
5766
5864
  children,
@@ -5830,7 +5928,7 @@ var AuthProvider = ({
5830
5928
  }),
5831
5929
  [authState, checkAuth, signOut]
5832
5930
  );
5833
- return /* @__PURE__ */ jsx31(AuthContext.Provider, { value: contextValue, children });
5931
+ return /* @__PURE__ */ jsx32(AuthContext.Provider, { value: contextValue, children });
5834
5932
  };
5835
5933
  var useAuth = () => {
5836
5934
  const context = useContext(AuthContext);
@@ -5846,9 +5944,9 @@ var ProtectedRoute = ({
5846
5944
  additionalCheck
5847
5945
  }) => {
5848
5946
  const { isAuthenticated, isLoading, ...authState } = useAuth();
5849
- const defaultLoadingComponent = /* @__PURE__ */ jsx31("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsx31("div", { className: "text-text-950 text-lg", children: "Carregando..." }) });
5947
+ const defaultLoadingComponent = /* @__PURE__ */ jsx32("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsx32("div", { className: "text-text-950 text-lg", children: "Carregando..." }) });
5850
5948
  if (isLoading) {
5851
- return /* @__PURE__ */ jsx31(Fragment7, { children: loadingComponent || defaultLoadingComponent });
5949
+ return /* @__PURE__ */ jsx32(Fragment7, { children: loadingComponent || defaultLoadingComponent });
5852
5950
  }
5853
5951
  if (!isAuthenticated) {
5854
5952
  if (typeof window !== "undefined") {
@@ -5859,12 +5957,12 @@ var ProtectedRoute = ({
5859
5957
  return null;
5860
5958
  }
5861
5959
  }
5862
- return /* @__PURE__ */ jsx31(Navigate, { to: redirectTo, replace: true });
5960
+ return /* @__PURE__ */ jsx32(Navigate, { to: redirectTo, replace: true });
5863
5961
  }
5864
5962
  if (additionalCheck && !additionalCheck({ isAuthenticated, isLoading, ...authState })) {
5865
- return /* @__PURE__ */ jsx31(Navigate, { to: redirectTo, replace: true });
5963
+ return /* @__PURE__ */ jsx32(Navigate, { to: redirectTo, replace: true });
5866
5964
  }
5867
- return /* @__PURE__ */ jsx31(Fragment7, { children });
5965
+ return /* @__PURE__ */ jsx32(Fragment7, { children });
5868
5966
  };
5869
5967
  var PublicRoute = ({
5870
5968
  children,
@@ -5874,15 +5972,15 @@ var PublicRoute = ({
5874
5972
  }) => {
5875
5973
  const { isAuthenticated, isLoading } = useAuth();
5876
5974
  if (checkAuthBeforeRender && isLoading) {
5877
- return /* @__PURE__ */ jsx31("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsx31("div", { className: "text-text-950 text-lg", children: "Carregando..." }) });
5975
+ return /* @__PURE__ */ jsx32("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsx32("div", { className: "text-text-950 text-lg", children: "Carregando..." }) });
5878
5976
  }
5879
5977
  if (isAuthenticated && redirectIfAuthenticated) {
5880
- return /* @__PURE__ */ jsx31(Navigate, { to: redirectTo, replace: true });
5978
+ return /* @__PURE__ */ jsx32(Navigate, { to: redirectTo, replace: true });
5881
5979
  }
5882
- return /* @__PURE__ */ jsx31(Fragment7, { children });
5980
+ return /* @__PURE__ */ jsx32(Fragment7, { children });
5883
5981
  };
5884
5982
  var withAuth = (Component, options = {}) => {
5885
- return (props) => /* @__PURE__ */ jsx31(ProtectedRoute, { ...options, children: /* @__PURE__ */ jsx31(Component, { ...props }) });
5983
+ return (props) => /* @__PURE__ */ jsx32(ProtectedRoute, { ...options, children: /* @__PURE__ */ jsx32(Component, { ...props }) });
5886
5984
  };
5887
5985
  var useAuthGuard = (options = {}) => {
5888
5986
  const authState = useAuth();
@@ -5897,7 +5995,7 @@ var useAuthGuard = (options = {}) => {
5897
5995
  var useRouteAuth = (fallbackPath = "/") => {
5898
5996
  const { isAuthenticated, isLoading } = useAuth();
5899
5997
  const location = useLocation();
5900
- const redirectToLogin = () => /* @__PURE__ */ jsx31(Navigate, { to: fallbackPath, state: { from: location }, replace: true });
5998
+ const redirectToLogin = () => /* @__PURE__ */ jsx32(Navigate, { to: fallbackPath, state: { from: location }, replace: true });
5901
5999
  return {
5902
6000
  isAuthenticated,
5903
6001
  isLoading,
@@ -6025,6 +6123,17 @@ function useUrlAuthentication(options) {
6025
6123
  options.clearParamsFromURL
6026
6124
  ]);
6027
6125
  }
6126
+
6127
+ // src/components/Auth/useApiConfig.ts
6128
+ import { useMemo as useMemo4 } from "react";
6129
+ function useApiConfig(api) {
6130
+ return useMemo4(
6131
+ () => ({
6132
+ get: (endpoint, config) => api.get(endpoint, config)
6133
+ }),
6134
+ [api]
6135
+ );
6136
+ }
6028
6137
  export {
6029
6138
  Alert_default as Alert,
6030
6139
  AlertDialog,
@@ -6061,6 +6170,7 @@ export {
6061
6170
  MenuOverflow,
6062
6171
  Modal_default as Modal,
6063
6172
  NavButton_default as NavButton,
6173
+ NotFound_default as NotFound,
6064
6174
  ProfileMenuFooter,
6065
6175
  ProfileMenuHeader,
6066
6176
  ProfileMenuSection,
@@ -6094,6 +6204,7 @@ export {
6094
6204
  Toaster_default as Toaster,
6095
6205
  createZustandAuthAdapter,
6096
6206
  getRootDomain,
6207
+ useApiConfig,
6097
6208
  useAuth,
6098
6209
  useAuthGuard,
6099
6210
  useRouteAuth,