@eclass/ui-kit 1.21.0 → 1.21.2

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.
@@ -2760,13 +2760,13 @@ function getValidChildren(children) {
2760
2760
  return /* @__PURE__ */ React.isValidElement(child);
2761
2761
  });
2762
2762
  }
2763
- var useSafeLayoutEffect = isBrowser$1 ? React.useLayoutEffect : React.useEffect;
2763
+ var useSafeLayoutEffect$1 = isBrowser$1 ? React.useLayoutEffect : React.useEffect;
2764
2764
  function useCallbackRef$1(fn6, deps) {
2765
2765
  if (deps === void 0) {
2766
2766
  deps = [];
2767
2767
  }
2768
2768
  var ref = React.useRef(fn6);
2769
- useSafeLayoutEffect(function() {
2769
+ useSafeLayoutEffect$1(function() {
2770
2770
  ref.current = fn6;
2771
2771
  });
2772
2772
  return React.useCallback(function() {
@@ -9571,7 +9571,7 @@ var DefaultPortal = function DefaultPortal2(props) {
9571
9571
  var forceUpdate = useForceUpdate$1();
9572
9572
  var parentPortal = usePortalContext();
9573
9573
  var manager2 = usePortalManager();
9574
- useSafeLayoutEffect(function() {
9574
+ useSafeLayoutEffect$1(function() {
9575
9575
  if (!tempNode.current)
9576
9576
  return;
9577
9577
  var doc2 = tempNode.current.ownerDocument;
@@ -9609,10 +9609,10 @@ var ContainerPortal = function ContainerPortal2(props) {
9609
9609
  return node2;
9610
9610
  }, [containerEl]);
9611
9611
  var forceUpdate = useForceUpdate$1();
9612
- useSafeLayoutEffect(function() {
9612
+ useSafeLayoutEffect$1(function() {
9613
9613
  forceUpdate();
9614
9614
  }, []);
9615
- useSafeLayoutEffect(function() {
9615
+ useSafeLayoutEffect$1(function() {
9616
9616
  if (!portal || !host)
9617
9617
  return;
9618
9618
  host.appendChild(portal);
@@ -23310,7 +23310,7 @@ function useImage(props) {
23310
23310
  imageRef.current = null;
23311
23311
  }
23312
23312
  };
23313
- useSafeLayoutEffect(function() {
23313
+ useSafeLayoutEffect$1(function() {
23314
23314
  if (ignoreFallback)
23315
23315
  return void 0;
23316
23316
  if (status === "loading") {
@@ -23958,6 +23958,52 @@ var LinkBox = /* @__PURE__ */ forwardRef(function(props, ref) {
23958
23958
  }
23959
23959
  }));
23960
23960
  });
23961
+ var useSafeLayoutEffect = isBrowser$1 ? React.useLayoutEffect : React.useEffect;
23962
+ function useMediaQuery(query) {
23963
+ var env = useEnvironment();
23964
+ var queries2 = Array.isArray(query) ? query : [query];
23965
+ var isSupported = isBrowser$1 && "matchMedia" in env.window;
23966
+ var _React$useState = React.useState(queries2.map(function(query2) {
23967
+ return isSupported ? !!env.window.matchMedia(query2).matches : false;
23968
+ })), matches = _React$useState[0], setMatches = _React$useState[1];
23969
+ useSafeLayoutEffect(function() {
23970
+ if (!isSupported)
23971
+ return void 0;
23972
+ var mediaQueryList = queries2.map(function(query2) {
23973
+ return env.window.matchMedia(query2);
23974
+ });
23975
+ var listenerList = mediaQueryList.map(function(_2, index2) {
23976
+ var listener = function listener2(mqlEvent) {
23977
+ var queryIndex = mediaQueryList.findIndex(function(mediaQuery) {
23978
+ return mediaQuery.media === mqlEvent.media;
23979
+ });
23980
+ setMatches(function(matches2) {
23981
+ var currentMatches = matches2.map(function(x2) {
23982
+ return x2;
23983
+ });
23984
+ currentMatches[queryIndex] = mqlEvent.matches;
23985
+ return currentMatches;
23986
+ });
23987
+ };
23988
+ if (typeof mediaQueryList[index2].addEventListener === "function") {
23989
+ mediaQueryList[index2].addEventListener("change", listener);
23990
+ } else {
23991
+ mediaQueryList[index2].addListener(listener);
23992
+ }
23993
+ return listener;
23994
+ });
23995
+ return function() {
23996
+ mediaQueryList.forEach(function(_2, index2) {
23997
+ if (typeof mediaQueryList[index2].removeEventListener === "function") {
23998
+ mediaQueryList[index2].removeEventListener("change", listenerList[index2]);
23999
+ } else {
24000
+ mediaQueryList[index2].removeListener(listenerList[index2]);
24001
+ }
24002
+ });
24003
+ };
24004
+ }, []);
24005
+ return matches;
24006
+ }
23961
24007
  var top = "top";
23962
24008
  var bottom = "bottom";
23963
24009
  var right = "right";
@@ -31066,19 +31112,39 @@ function Alert({
31066
31112
  buttonText,
31067
31113
  buttonIcon,
31068
31114
  buttonLink = false,
31115
+ isFlash = false,
31069
31116
  onClick,
31070
31117
  state: state2,
31071
31118
  m: m2
31072
31119
  }) {
31073
- return /* @__PURE__ */ jsx(Box, {
31120
+ const [isMobile] = useMediaQuery("(max-width: 425px)");
31121
+ const handleClick = () => {
31122
+ if (onClick) {
31123
+ onClick();
31124
+ }
31125
+ };
31126
+ let buttonType;
31127
+ if (buttonText) {
31128
+ buttonType = buttonLink ? "link" : "normal";
31129
+ }
31130
+ return /* @__PURE__ */ jsxs(Box, {
31131
+ className: isFlash ? "flashNotification" : "embeddedAlert",
31132
+ alignItems: !isMobile ? "center" : "unset",
31074
31133
  backgroundColor: alertStates[state2].bg,
31075
31134
  borderRadius: "8px",
31076
- padding: canDismiss ? "16px 28px 16px 16px" : "16px",
31077
- width: "max-content",
31078
- maxWidth: "796px",
31135
+ display: "flex",
31136
+ flexFlow: isMobile ? "column" : "row",
31137
+ gap: !isFlash ? "16px" : "",
31138
+ justifyContent: !isMobile ? "space-between" : "",
31079
31139
  margin: m2,
31140
+ width: "100%",
31141
+ maxWidth: "796px",
31142
+ p: "1rem",
31143
+ pr: canDismiss ? "1.75rem" : "1rem",
31080
31144
  position: "relative",
31081
- children: /* @__PURE__ */ jsxs(HStack, {
31145
+ children: [/* @__PURE__ */ jsxs(HStack, {
31146
+ gap: "10px",
31147
+ className: "alertContent",
31082
31148
  sx: {
31083
31149
  ".linkButton": {
31084
31150
  fontSize: "16px"
@@ -31086,7 +31152,6 @@ function Alert({
31086
31152
  },
31087
31153
  children: [/* @__PURE__ */ jsx(Box, {
31088
31154
  className: "iconContainer",
31089
- marginRight: "10px",
31090
31155
  sx: {
31091
31156
  svg: {
31092
31157
  width: "auto"
@@ -31099,28 +31164,29 @@ function Alert({
31099
31164
  fontWeight: "400",
31100
31165
  lineHeight: "28px",
31101
31166
  color: vars("colors-neutral-darkCharcoal"),
31102
- children: [children, buttonText && onClick && buttonLink && /* @__PURE__ */ jsx(BtnLink, {
31103
- onClick,
31167
+ children: [children, buttonType === "link" && /* @__PURE__ */ jsx(BtnLink, {
31168
+ onClick: handleClick,
31104
31169
  children: buttonText
31105
31170
  })]
31106
- }), buttonText && onClick && !buttonLink && /* @__PURE__ */ jsx(BtnPrimary, {
31107
- leftIcon: buttonIcon,
31108
- onClick,
31109
- children: buttonText
31110
- }), canDismiss && /* @__PURE__ */ jsx(Box, {
31111
- cursor: "pointer",
31112
- marginLeft: "12px",
31113
- sx: {
31114
- svg: {
31115
- position: "absolute",
31116
- top: "16px",
31117
- right: "12px"
31118
- }
31119
- },
31120
- onClick,
31121
- children: /* @__PURE__ */ jsx(Close, {})
31122
31171
  })]
31123
- })
31172
+ }), buttonType === "normal" && /* @__PURE__ */ jsx(BtnPrimary, {
31173
+ isFullWidth: !!isMobile,
31174
+ leftIcon: buttonIcon,
31175
+ onClick: handleClick,
31176
+ children: buttonText
31177
+ }), canDismiss && /* @__PURE__ */ jsx(Box, {
31178
+ cursor: "pointer",
31179
+ marginLeft: "12px",
31180
+ sx: {
31181
+ svg: {
31182
+ position: "absolute",
31183
+ top: "16px",
31184
+ right: "12px"
31185
+ }
31186
+ },
31187
+ onClick,
31188
+ children: /* @__PURE__ */ jsx(Close, {})
31189
+ })]
31124
31190
  });
31125
31191
  }
31126
31192
  let e = { data: "" }, t = (t2) => "object" == typeof window ? ((t2 ? t2.querySelector("#_goober") : window._goober) || Object.assign((t2 || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : t2 || e, l = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, a = /\/\*[^]*?\*\/| +/g, n$1 = /\n+/g, o = (e2, t2) => {
@@ -31533,6 +31599,7 @@ function FlashNotification({
31533
31599
  }) {
31534
31600
  const showToast = useCallback(() => {
31535
31601
  n((t2) => /* @__PURE__ */ jsx(Alert, {
31602
+ isFlash: true,
31536
31603
  state: state2,
31537
31604
  canDismiss: true,
31538
31605
  onClick: () => n.dismiss(t2.id),