@eclass/ui-kit 1.56.0 → 1.57.0

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 = {
@@ -7261,6 +7261,7 @@ const handleTime = (message) => {
7261
7261
  const totalMs = Math.round(baseMinutes * 60 * 1e3);
7262
7262
  return Math.max(3e3, totalMs);
7263
7263
  };
7264
+ const GLOBAL_TOASTER_FLAG = "_eclass_ui_kit_toaster_mounted";
7264
7265
  function FlashNotification({
7265
7266
  message,
7266
7267
  state,
@@ -7268,6 +7269,13 @@ function FlashNotification({
7268
7269
  m: m2,
7269
7270
  width
7270
7271
  }) {
7272
+ const [shouldRenderToaster, setShouldRenderToaster] = useState(false);
7273
+ useEffect(() => {
7274
+ if (typeof window !== "undefined" && !window[GLOBAL_TOASTER_FLAG]) {
7275
+ window[GLOBAL_TOASTER_FLAG] = true;
7276
+ setShouldRenderToaster(true);
7277
+ }
7278
+ }, []);
7271
7279
  const showToast = useCallback(() => {
7272
7280
  n((t2) => /* @__PURE__ */ jsx(Alert, {
7273
7281
  isFlash: true,
@@ -7275,6 +7283,7 @@ function FlashNotification({
7275
7283
  canDismiss: true,
7276
7284
  onClick: () => n.dismiss(t2.id),
7277
7285
  width,
7286
+ maxContent: !width,
7278
7287
  m: m2,
7279
7288
  children: message
7280
7289
  }), {
@@ -7287,25 +7296,21 @@ function FlashNotification({
7287
7296
  showToast();
7288
7297
  }
7289
7298
  }, [show, showToast]);
7290
- return /* @__PURE__ */ jsx(Portal, {
7291
- children: /* @__PURE__ */ jsx(Ie, {
7299
+ return /* @__PURE__ */ jsx(Fragment, {
7300
+ children: shouldRenderToaster && /* @__PURE__ */ jsx(Ie, {
7292
7301
  position: "top-center",
7293
7302
  toastOptions: {
7294
7303
  className: "toastContainer",
7295
7304
  style: {
7296
7305
  background: "transparent",
7297
- boxShadow: "none"
7306
+ boxShadow: "none",
7307
+ maxWidth: width != null ? width : "max-content"
7298
7308
  }
7299
7309
  }
7300
7310
  })
7301
7311
  });
7302
7312
  }
7303
- const useFlashNotification = ({
7304
- state,
7305
- message,
7306
- maxContent,
7307
- width
7308
- }) => {
7313
+ const useFlashNotification = ({ state, message, width }) => {
7309
7314
  const [show, setShow] = useState(false);
7310
7315
  useEffect(() => {
7311
7316
  if (show) {
@@ -7327,7 +7332,6 @@ const useFlashNotification = ({
7327
7332
  config: {
7328
7333
  state,
7329
7334
  message,
7330
- maxContent,
7331
7335
  width
7332
7336
  }
7333
7337
  };
@@ -7463,15 +7467,27 @@ const Modal = ({
7463
7467
  scrollBehavior: isInside ? "inside" : "outside",
7464
7468
  autoFocus,
7465
7469
  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
7470
+ children: [/* @__PURE__ */ jsx(ModalOverlay, {}), /* @__PURE__ */ jsx(Box, {
7471
+ sx: {
7472
+ ...isInside && {
7473
+ ".uikit-modalContent": {
7474
+ pb: "16px !important"
7475
+ },
7476
+ ".uikit-modalButtons": {
7477
+ boxShadow: "0px 4px 16px 0px #5C5C5C33"
7478
+ }
7479
+ }
7480
+ },
7481
+ children: /* @__PURE__ */ jsx(ModalContent$1, {
7482
+ ...modalConfig.contentProps,
7483
+ children: /* @__PURE__ */ jsx(ModalContentBase, {
7484
+ fixedButtons,
7485
+ withoutMargin,
7486
+ title,
7487
+ closeOnOverlayClick,
7488
+ fixedSubtitle,
7489
+ children
7490
+ })
7475
7491
  })
7476
7492
  })]
7477
7493
  });