@eclass/ui-kit 1.57.9 → 1.58.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.
@@ -7331,7 +7331,7 @@ function FlashNotification({
7331
7331
  duration: ["success", "info"].includes(state) ? handleTime(message) : Infinity,
7332
7332
  id: alertStates[state].id
7333
7333
  });
7334
- }, [message, state, m2]);
7334
+ }, [message, state, m2, isMobile]);
7335
7335
  useEffect(() => {
7336
7336
  if (show) {
7337
7337
  showToast();
@@ -7622,6 +7622,25 @@ const Loading$1 = ({
7622
7622
  })]
7623
7623
  });
7624
7624
  };
7625
+ const sanitizeModalDescription = (description) => {
7626
+ const sanitizedDescription = purify.sanitize(description, {
7627
+ ADD_ATTR: ["target", "rel"]
7628
+ });
7629
+ const parsedDocument = new window.DOMParser().parseFromString(sanitizedDescription, "text/html");
7630
+ parsedDocument.querySelectorAll('a[target="_blank"]').forEach((anchor) => {
7631
+ var _a;
7632
+ const currentRel = (_a = anchor.getAttribute("rel")) != null ? _a : "";
7633
+ const relTokens = currentRel.split(/\s+/).filter(Boolean);
7634
+ if (!relTokens.includes("noopener")) {
7635
+ relTokens.push("noopener");
7636
+ }
7637
+ if (!relTokens.includes("noreferrer")) {
7638
+ relTokens.push("noreferrer");
7639
+ }
7640
+ anchor.setAttribute("rel", relTokens.join(" "));
7641
+ });
7642
+ return parsedDocument.body.innerHTML;
7643
+ };
7625
7644
  const ModalAlertContent = ({
7626
7645
  type,
7627
7646
  title,
@@ -7630,7 +7649,7 @@ const ModalAlertContent = ({
7630
7649
  children
7631
7650
  }) => {
7632
7651
  const [isDesktop] = useMediaQuery("(min-width: 641px)");
7633
- const descriptionParsed = typeof description === "string" ? ReactParser(purify.sanitize(description)) : description;
7652
+ const descriptionParsed = typeof description === "string" ? ReactParser(sanitizeModalDescription(description)) : description;
7634
7653
  return /* @__PURE__ */ jsxs(Fragment, {
7635
7654
  children: [/* @__PURE__ */ jsxs(ModalBody, {
7636
7655
  p: "32px",
@@ -9871,6 +9890,7 @@ const EventsGroup = ({
9871
9890
  colors: colors2,
9872
9891
  events,
9873
9892
  hasMoreNext,
9893
+ onClickEvent,
9874
9894
  title,
9875
9895
  redirect,
9876
9896
  text: text2,
@@ -9899,11 +9919,11 @@ const EventsGroup = ({
9899
9919
  return /* @__PURE__ */ jsx(Box, {
9900
9920
  bg: (_a2 = vars("colors-neutral-white")) != null ? _a2 : "#FFFFFF",
9901
9921
  border: "none",
9902
- cursor: "default",
9922
+ cursor: onClickEvent ? "pointer" : "default",
9903
9923
  padding: "0",
9904
9924
  _hover: {
9905
9925
  boxShadow: "none !important",
9906
- cursor: "default !important",
9926
+ cursor: onClickEvent ? "pointer !important" : "default !important",
9907
9927
  bg: "none !important"
9908
9928
  },
9909
9929
  _focus: {
@@ -9920,6 +9940,7 @@ const EventsGroup = ({
9920
9940
  text: text2,
9921
9941
  type: event.type,
9922
9942
  hasNotification: event.isNew,
9943
+ onClick: onClickEvent ? () => onClickEvent(event) : void 0,
9923
9944
  showCourse: true
9924
9945
  }, event.id)
9925
9946
  }, event.id);
@@ -9946,6 +9967,7 @@ const Events = ({
9946
9967
  events,
9947
9968
  hasMoreNext,
9948
9969
  isMobile,
9970
+ onClickEvent,
9949
9971
  redirecToCalendar,
9950
9972
  text: text2
9951
9973
  }) => {
@@ -9985,17 +10007,20 @@ const Events = ({
9985
10007
  }), /* @__PURE__ */ jsx(EventsGroup, {
9986
10008
  colors: colors2,
9987
10009
  events: today,
10010
+ onClickEvent,
9988
10011
  text: (_c = text2 == null ? void 0 : text2.course) != null ? _c : "",
9989
10012
  title: (_e = (_d = text2 == null ? void 0 : text2.events) == null ? void 0 : _d.today) != null ? _e : "Hoy"
9990
10013
  }), /* @__PURE__ */ jsx(EventsGroup, {
9991
10014
  colors: colors2,
9992
10015
  events: tomorrow,
10016
+ onClickEvent,
9993
10017
  text: (_f = text2 == null ? void 0 : text2.course) != null ? _f : "",
9994
10018
  title: (_h = (_g = text2 == null ? void 0 : text2.events) == null ? void 0 : _g.tomorrow) != null ? _h : "Ma\xF1ana"
9995
10019
  }), /* @__PURE__ */ jsx(EventsGroup, {
9996
10020
  colors: colors2,
9997
10021
  events: next,
9998
10022
  hasMoreNext,
10023
+ onClickEvent,
9999
10024
  redirect: redirecToCalendar,
10000
10025
  textSeeMore: (_i = text2 == null ? void 0 : text2.seeMore.see) != null ? _i : "Ver m\xE1s fechas en",
10001
10026
  textLinkMore: (_j = text2 == null ? void 0 : text2.seeMore.link) != null ? _j : "Mi calendario",
@@ -10005,6 +10030,7 @@ const Events = ({
10005
10030
  });
10006
10031
  };
10007
10032
  const CalendarDropdownContainer = ({
10033
+ onClickEvent,
10008
10034
  courseColors,
10009
10035
  events,
10010
10036
  loading,
@@ -10142,6 +10168,7 @@ const CalendarDropdownContainer = ({
10142
10168
  events: all,
10143
10169
  hasMoreNext,
10144
10170
  isMobile,
10171
+ onClickEvent,
10145
10172
  redirecToCalendar: redirectToCalendar,
10146
10173
  text: text2
10147
10174
  })
@@ -10159,6 +10186,7 @@ const Loading = ({
10159
10186
  });
10160
10187
  };
10161
10188
  const CalendarDropdown = ({
10189
+ onClickEvent,
10162
10190
  courseColors,
10163
10191
  events,
10164
10192
  loading,
@@ -10172,6 +10200,7 @@ const CalendarDropdown = ({
10172
10200
  const date = new Date(now);
10173
10201
  const isoDate = date.toISOString();
10174
10202
  return /* @__PURE__ */ jsx(CalendarDropdownContainer, {
10203
+ onClickEvent,
10175
10204
  courseColors,
10176
10205
  events,
10177
10206
  loading,
@@ -10203,6 +10232,7 @@ const EventsList = ({
10203
10232
  date,
10204
10233
  name,
10205
10234
  hasNotification,
10235
+ onClick,
10206
10236
  showCourse,
10207
10237
  showUnit,
10208
10238
  time,
@@ -10232,6 +10262,7 @@ const EventsList = ({
10232
10262
  p: "16px",
10233
10263
  display: "flex",
10234
10264
  gap: "12px",
10265
+ onClick,
10235
10266
  children: [/* @__PURE__ */ jsxs(Box, {
10236
10267
  bg: color,
10237
10268
  minW: "88px",