@eclass/ui-kit 1.56.0 → 1.57.1

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.
@@ -1,4 +1,4 @@
1
- import { extendTheme, Box, CircularProgress, Icon, Button, useMediaQuery, Tooltip, Flex, Stack, Center, Image, Text as Text$1, HStack, Heading, List, ListItem, Link, Modal as Modal$1, ModalContent as ModalContent$1, ModalHeader, ModalCloseButton, ModalBody, ModalFooter, ModalOverlay, useDisclosure, LinkBox, LinkOverlay, Portal, MenuButton, MenuGroup, Menu, MenuList } from "@chakra-ui/react";
1
+ import { extendTheme, Box, CircularProgress, Icon, Button, useMediaQuery, Tooltip, Flex, Stack, Center, Image, Text as Text$1, HStack, Heading, List, ListItem, Link, Modal as Modal$1, ModalContent as ModalContent$1, ModalHeader, ModalCloseButton, ModalBody, ModalFooter, ModalOverlay, useDisclosure, LinkBox, LinkOverlay, MenuButton, MenuGroup, Menu, MenuList } from "@chakra-ui/react";
2
2
  import * as React$1 from "react";
3
3
  import React__default, { useEffect, useCallback, useState } from "react";
4
4
  const main = {
@@ -1763,6 +1763,7 @@ function BtnLink({
1763
1763
  fontSize = "0.875rem",
1764
1764
  href = "",
1765
1765
  id,
1766
+ isDisable = false,
1766
1767
  m: m2 = "0",
1767
1768
  onClick,
1768
1769
  role = "link",
@@ -1773,7 +1774,7 @@ function BtnLink({
1773
1774
  }) {
1774
1775
  const typeButton = {
1775
1776
  button: {
1776
- onClick,
1777
+ onClick: isDisable ? void 0 : onClick,
1777
1778
  target
1778
1779
  },
1779
1780
  a: {
@@ -1782,22 +1783,24 @@ function BtnLink({
1782
1783
  }
1783
1784
  };
1784
1785
  return /* @__PURE__ */ jsx(Box, {
1786
+ "aria-label": ariaLabel,
1785
1787
  as,
1786
1788
  autoFocus: false,
1787
- "aria-label": ariaLabel,
1788
- id,
1789
- role,
1790
1789
  backgroundColor: "transparent",
1791
1790
  borderStyle: "none",
1792
1791
  className: "linkButton",
1793
1792
  color: vars("colors-main-deepSkyBlue"),
1793
+ cursor: isDisable ? "not-allowed" : "pointer",
1794
1794
  fontFamily: "Roboto",
1795
+ fontSize,
1795
1796
  fontStyle: "normal",
1796
1797
  fontWeight: "500",
1797
- fontSize,
1798
+ id,
1798
1799
  lineHeight: "1rem",
1799
- onClick,
1800
+ onClick: isDisable ? void 0 : onClick,
1801
+ opacity: isDisable ? 0.5 : 1,
1800
1802
  padding: ".25em",
1803
+ role,
1801
1804
  tabIndex,
1802
1805
  textDecorationLine: textDecorationLine ? "underline" : "none",
1803
1806
  width: "fit-content",
@@ -7261,6 +7264,7 @@ const handleTime = (message) => {
7261
7264
  const totalMs = Math.round(baseMinutes * 60 * 1e3);
7262
7265
  return Math.max(3e3, totalMs);
7263
7266
  };
7267
+ const GLOBAL_TOASTER_FLAG = "_eclass_ui_kit_toaster_mounted";
7264
7268
  function FlashNotification({
7265
7269
  message,
7266
7270
  state,
@@ -7268,6 +7272,13 @@ function FlashNotification({
7268
7272
  m: m2,
7269
7273
  width
7270
7274
  }) {
7275
+ const [shouldRenderToaster, setShouldRenderToaster] = useState(false);
7276
+ useEffect(() => {
7277
+ if (typeof window !== "undefined" && !window[GLOBAL_TOASTER_FLAG]) {
7278
+ window[GLOBAL_TOASTER_FLAG] = true;
7279
+ setShouldRenderToaster(true);
7280
+ }
7281
+ }, []);
7271
7282
  const showToast = useCallback(() => {
7272
7283
  n((t2) => /* @__PURE__ */ jsx(Alert, {
7273
7284
  isFlash: true,
@@ -7275,6 +7286,7 @@ function FlashNotification({
7275
7286
  canDismiss: true,
7276
7287
  onClick: () => n.dismiss(t2.id),
7277
7288
  width,
7289
+ maxContent: !width,
7278
7290
  m: m2,
7279
7291
  children: message
7280
7292
  }), {
@@ -7287,25 +7299,21 @@ function FlashNotification({
7287
7299
  showToast();
7288
7300
  }
7289
7301
  }, [show, showToast]);
7290
- return /* @__PURE__ */ jsx(Portal, {
7291
- children: /* @__PURE__ */ jsx(Ie, {
7302
+ return /* @__PURE__ */ jsx(Fragment, {
7303
+ children: shouldRenderToaster && /* @__PURE__ */ jsx(Ie, {
7292
7304
  position: "top-center",
7293
7305
  toastOptions: {
7294
7306
  className: "toastContainer",
7295
7307
  style: {
7296
7308
  background: "transparent",
7297
- boxShadow: "none"
7309
+ boxShadow: "none",
7310
+ maxWidth: width != null ? width : "max-content"
7298
7311
  }
7299
7312
  }
7300
7313
  })
7301
7314
  });
7302
7315
  }
7303
- const useFlashNotification = ({
7304
- state,
7305
- message,
7306
- maxContent,
7307
- width
7308
- }) => {
7316
+ const useFlashNotification = ({ state, message, width }) => {
7309
7317
  const [show, setShow] = useState(false);
7310
7318
  useEffect(() => {
7311
7319
  if (show) {
@@ -7327,7 +7335,6 @@ const useFlashNotification = ({
7327
7335
  config: {
7328
7336
  state,
7329
7337
  message,
7330
- maxContent,
7331
7338
  width
7332
7339
  }
7333
7340
  };
@@ -7463,15 +7470,27 @@ const Modal = ({
7463
7470
  scrollBehavior: isInside ? "inside" : "outside",
7464
7471
  autoFocus,
7465
7472
  blockScrollOnMount: false,
7466
- children: [/* @__PURE__ */ jsx(ModalOverlay, {}), /* @__PURE__ */ jsx(ModalContent$1, {
7467
- ...modalConfig.contentProps,
7468
- children: /* @__PURE__ */ jsx(ModalContentBase, {
7469
- fixedButtons,
7470
- withoutMargin,
7471
- title,
7472
- closeOnOverlayClick,
7473
- fixedSubtitle,
7474
- children
7473
+ children: [/* @__PURE__ */ jsx(ModalOverlay, {}), /* @__PURE__ */ jsx(Box, {
7474
+ sx: {
7475
+ ...isInside && {
7476
+ ".uikit-modalContent": {
7477
+ pb: "16px !important"
7478
+ },
7479
+ ".uikit-modalButtons": {
7480
+ boxShadow: "0px 4px 16px 0px #5C5C5C33"
7481
+ }
7482
+ }
7483
+ },
7484
+ children: /* @__PURE__ */ jsx(ModalContent$1, {
7485
+ ...modalConfig.contentProps,
7486
+ children: /* @__PURE__ */ jsx(ModalContentBase, {
7487
+ fixedButtons,
7488
+ withoutMargin,
7489
+ title,
7490
+ closeOnOverlayClick,
7491
+ fixedSubtitle,
7492
+ children
7493
+ })
7475
7494
  })
7476
7495
  })]
7477
7496
  });
@@ -7563,6 +7582,7 @@ const ModalAlertContent = ({
7563
7582
  children
7564
7583
  }) => {
7565
7584
  const [isDesktop] = useMediaQuery("(min-width: 641px)");
7585
+ const descriptionParsed = typeof description === "string" ? ReactParser(purify.sanitize(description)) : description;
7566
7586
  return /* @__PURE__ */ jsxs(Fragment, {
7567
7587
  children: [/* @__PURE__ */ jsxs(ModalBody, {
7568
7588
  p: "32px",
@@ -7588,7 +7608,7 @@ const ModalAlertContent = ({
7588
7608
  fontSize: "16px",
7589
7609
  lineHeight: "24px",
7590
7610
  mb: 0,
7591
- children: description
7611
+ children: descriptionParsed
7592
7612
  })]
7593
7613
  }), type !== "loading" && children ? children : /* @__PURE__ */ jsx(Fragment, {})]
7594
7614
  });