@eclass/ui-kit 1.36.0 → 1.38.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.
@@ -9545,7 +9545,7 @@ function _objectWithoutPropertiesLoose$e(source, excluded) {
9545
9545
  }
9546
9546
  return target;
9547
9547
  }
9548
- var _excluded$g = ["containerRef"];
9548
+ var _excluded$h = ["containerRef"];
9549
9549
  var _createContext$5 = createContext({
9550
9550
  strict: false,
9551
9551
  name: "PortalContext"
@@ -9628,7 +9628,7 @@ var ContainerPortal = function ContainerPortal2(props) {
9628
9628
  return null;
9629
9629
  };
9630
9630
  function Portal(props) {
9631
- var containerRef = props.containerRef, rest = _objectWithoutPropertiesLoose$e(props, _excluded$g);
9631
+ var containerRef = props.containerRef, rest = _objectWithoutPropertiesLoose$e(props, _excluded$h);
9632
9632
  return containerRef ? /* @__PURE__ */ React.createElement(ContainerPortal, _extends$f({
9633
9633
  containerRef
9634
9634
  }, rest)) : /* @__PURE__ */ React.createElement(DefaultPortal, rest);
@@ -11401,7 +11401,7 @@ function _objectWithoutPropertiesLoose$d(source, excluded) {
11401
11401
  }
11402
11402
  return target;
11403
11403
  }
11404
- var _excluded$f = ["__cssMap", "__cssVars", "__breakpoints"];
11404
+ var _excluded$g = ["__cssMap", "__cssVars", "__breakpoints"];
11405
11405
  var tokens = ["colors", "borders", "borderWidths", "borderStyles", "fonts", "fontSizes", "fontWeights", "letterSpacings", "lineHeights", "radii", "space", "shadows", "sizes", "zIndices", "transition", "blur"];
11406
11406
  function extractTokens(theme2) {
11407
11407
  var _tokens = tokens;
@@ -11414,7 +11414,7 @@ function omitVars(rawTheme) {
11414
11414
  rawTheme.__cssMap;
11415
11415
  rawTheme.__cssVars;
11416
11416
  rawTheme.__breakpoints;
11417
- var cleanTheme = _objectWithoutPropertiesLoose$d(rawTheme, _excluded$f);
11417
+ var cleanTheme = _objectWithoutPropertiesLoose$d(rawTheme, _excluded$g);
11418
11418
  return cleanTheme;
11419
11419
  }
11420
11420
  function flattenTokens(_ref2) {
@@ -11917,7 +11917,7 @@ var validHTMLProps = /* @__PURE__ */ new Set(["htmlWidth", "htmlHeight", "htmlSi
11917
11917
  var shouldForwardProp = function shouldForwardProp2(prop2) {
11918
11918
  return validHTMLProps.has(prop2) || !allPropNames.has(prop2);
11919
11919
  };
11920
- var _excluded$1$4 = ["theme", "css", "__css", "sx"], _excluded2$4 = ["baseStyle"];
11920
+ var _excluded$1$4 = ["theme", "css", "__css", "sx"], _excluded2$5 = ["baseStyle"];
11921
11921
  var toCSSObject = function toCSSObject2(_ref2) {
11922
11922
  var baseStyle22 = _ref2.baseStyle;
11923
11923
  return function(props) {
@@ -11933,7 +11933,7 @@ var toCSSObject = function toCSSObject2(_ref2) {
11933
11933
  };
11934
11934
  };
11935
11935
  function styled(component, options) {
11936
- var _ref2 = options != null ? options : {}, baseStyle22 = _ref2.baseStyle, styledOptions = _objectWithoutPropertiesLoose$c(_ref2, _excluded2$4);
11936
+ var _ref2 = options != null ? options : {}, baseStyle22 = _ref2.baseStyle, styledOptions = _objectWithoutPropertiesLoose$c(_ref2, _excluded2$5);
11937
11937
  if (!styledOptions.shouldForwardProp) {
11938
11938
  styledOptions.shouldForwardProp = shouldForwardProp;
11939
11939
  }
@@ -11945,7 +11945,7 @@ function styled(component, options) {
11945
11945
  function forwardRef(component) {
11946
11946
  return /* @__PURE__ */ React.forwardRef(component);
11947
11947
  }
11948
- var _excluded$e = ["styleConfig"];
11948
+ var _excluded$f = ["styleConfig"];
11949
11949
  function useStyleConfig(themeKey, props, opts) {
11950
11950
  var _styleConfig$defaultP;
11951
11951
  if (props === void 0) {
@@ -11954,7 +11954,7 @@ function useStyleConfig(themeKey, props, opts) {
11954
11954
  if (opts === void 0) {
11955
11955
  opts = {};
11956
11956
  }
11957
- var _props = props, styleConfigProp = _props.styleConfig, rest = _objectWithoutPropertiesLoose$c(_props, _excluded$e);
11957
+ var _props = props, styleConfigProp = _props.styleConfig, rest = _objectWithoutPropertiesLoose$c(_props, _excluded$f);
11958
11958
  var _useChakra = useChakra(), theme2 = _useChakra.theme, colorMode = _useChakra.colorMode;
11959
11959
  var themeStyleConfig = memoizedGet(theme2, "components." + themeKey);
11960
11960
  var styleConfig = styleConfigProp || themeStyleConfig;
@@ -16581,7 +16581,7 @@ function _objectWithoutPropertiesLoose$b(source, excluded) {
16581
16581
  }
16582
16582
  return target;
16583
16583
  }
16584
- var _excluded$d = ["as", "viewBox", "color", "focusable", "children", "className", "__css"];
16584
+ var _excluded$e = ["as", "viewBox", "color", "focusable", "children", "className", "__css"];
16585
16585
  var fallbackIcon = {
16586
16586
  path: /* @__PURE__ */ React.createElement("g", {
16587
16587
  stroke: "currentColor",
@@ -16604,7 +16604,7 @@ var fallbackIcon = {
16604
16604
  viewBox: "0 0 24 24"
16605
16605
  };
16606
16606
  var Icon = /* @__PURE__ */ forwardRef(function(props, ref) {
16607
- var element = props.as, viewBox = props.viewBox, _props$color = props.color, color2 = _props$color === void 0 ? "currentColor" : _props$color, _props$focusable = props.focusable, focusable = _props$focusable === void 0 ? false : _props$focusable, children = props.children, className = props.className, __css = props.__css, rest = _objectWithoutPropertiesLoose$b(props, _excluded$d);
16607
+ var element = props.as, viewBox = props.viewBox, _props$color = props.color, color2 = _props$color === void 0 ? "currentColor" : _props$color, _props$focusable = props.focusable, focusable = _props$focusable === void 0 ? false : _props$focusable, children = props.children, className = props.className, __css = props.__css, rest = _objectWithoutPropertiesLoose$b(props, _excluded$e);
16608
16608
  var _className = cx("chakra-icon", className);
16609
16609
  var styles2 = _extends$a({
16610
16610
  w: "1em",
@@ -16917,22 +16917,22 @@ function getVelocity$1(visualElement2) {
16917
16917
  });
16918
16918
  return velocity;
16919
16919
  }
16920
- function resolveVariantFromProps(props, definition, custom, currentValues, currentVelocity) {
16920
+ function resolveVariantFromProps(props, definition, custom, currentValues2, currentVelocity) {
16921
16921
  var _a;
16922
- if (currentValues === void 0) {
16923
- currentValues = {};
16922
+ if (currentValues2 === void 0) {
16923
+ currentValues2 = {};
16924
16924
  }
16925
16925
  if (currentVelocity === void 0) {
16926
16926
  currentVelocity = {};
16927
16927
  }
16928
16928
  if (typeof definition === "function") {
16929
- definition = definition(custom !== null && custom !== void 0 ? custom : props.custom, currentValues, currentVelocity);
16929
+ definition = definition(custom !== null && custom !== void 0 ? custom : props.custom, currentValues2, currentVelocity);
16930
16930
  }
16931
16931
  if (typeof definition === "string") {
16932
16932
  definition = (_a = props.variants) === null || _a === void 0 ? void 0 : _a[definition];
16933
16933
  }
16934
16934
  if (typeof definition === "function") {
16935
- definition = definition(custom !== null && custom !== void 0 ? custom : props.custom, currentValues, currentVelocity);
16935
+ definition = definition(custom !== null && custom !== void 0 ? custom : props.custom, currentValues2, currentVelocity);
16936
16936
  }
16937
16937
  return definition;
16938
16938
  }
@@ -23322,9 +23322,9 @@ function useImage(props) {
23322
23322
  }, [status, load, ignoreFallback]);
23323
23323
  return ignoreFallback ? "loaded" : status;
23324
23324
  }
23325
- var _excluded$c = ["htmlWidth", "htmlHeight", "alt"], _excluded2$3 = ["fallbackSrc", "fallback", "src", "srcSet", "align", "fit", "loading", "ignoreFallback", "crossOrigin"];
23325
+ var _excluded$d = ["htmlWidth", "htmlHeight", "alt"], _excluded2$3 = ["fallbackSrc", "fallback", "src", "srcSet", "align", "fit", "loading", "ignoreFallback", "crossOrigin"];
23326
23326
  var NativeImage = /* @__PURE__ */ React.forwardRef(function(props, ref) {
23327
- var htmlWidth = props.htmlWidth, htmlHeight = props.htmlHeight, alt = props.alt, rest = _objectWithoutPropertiesLoose$9(props, _excluded$c);
23327
+ var htmlWidth = props.htmlWidth, htmlHeight = props.htmlHeight, alt = props.alt, rest = _objectWithoutPropertiesLoose$9(props, _excluded$d);
23328
23328
  return /* @__PURE__ */ React.createElement("img", _extends$8({
23329
23329
  width: htmlWidth,
23330
23330
  height: htmlHeight,
@@ -23406,7 +23406,7 @@ function _objectWithoutPropertiesLoose$8(source, excluded) {
23406
23406
  }
23407
23407
  return target;
23408
23408
  }
23409
- var _excluded$b = ["label", "thickness", "speed", "emptyColor", "className"];
23409
+ var _excluded$c = ["label", "thickness", "speed", "emptyColor", "className"];
23410
23410
  var spin$1 = keyframes$2({
23411
23411
  "0%": {
23412
23412
  transform: "rotate(0deg)"
@@ -23417,7 +23417,7 @@ var spin$1 = keyframes$2({
23417
23417
  });
23418
23418
  var Spinner = /* @__PURE__ */ forwardRef(function(props, ref) {
23419
23419
  var styles2 = useStyleConfig("Spinner", props);
23420
- var _omitThemingProps = omitThemingProps(props), _omitThemingProps$lab = _omitThemingProps.label, label = _omitThemingProps$lab === void 0 ? "Loading..." : _omitThemingProps$lab, _omitThemingProps$thi = _omitThemingProps.thickness, thickness = _omitThemingProps$thi === void 0 ? "2px" : _omitThemingProps$thi, _omitThemingProps$spe = _omitThemingProps.speed, speed = _omitThemingProps$spe === void 0 ? "0.45s" : _omitThemingProps$spe, _omitThemingProps$emp = _omitThemingProps.emptyColor, emptyColor = _omitThemingProps$emp === void 0 ? "transparent" : _omitThemingProps$emp, className = _omitThemingProps.className, rest = _objectWithoutPropertiesLoose$8(_omitThemingProps, _excluded$b);
23420
+ var _omitThemingProps = omitThemingProps(props), _omitThemingProps$lab = _omitThemingProps.label, label = _omitThemingProps$lab === void 0 ? "Loading..." : _omitThemingProps$lab, _omitThemingProps$thi = _omitThemingProps.thickness, thickness = _omitThemingProps$thi === void 0 ? "2px" : _omitThemingProps$thi, _omitThemingProps$spe = _omitThemingProps.speed, speed = _omitThemingProps$spe === void 0 ? "0.45s" : _omitThemingProps$spe, _omitThemingProps$emp = _omitThemingProps.emptyColor, emptyColor = _omitThemingProps$emp === void 0 ? "transparent" : _omitThemingProps$emp, className = _omitThemingProps.className, rest = _objectWithoutPropertiesLoose$8(_omitThemingProps, _excluded$c);
23421
23421
  var _className = cx("chakra-spinner", className);
23422
23422
  var spinnerStyles = _extends$7({
23423
23423
  display: "inline-block",
@@ -23677,6 +23677,32 @@ var Center = chakra("div", {
23677
23677
  justifyContent: "center"
23678
23678
  }
23679
23679
  });
23680
+ var _excluded$b = ["borderLeftWidth", "borderBottomWidth", "borderTopWidth", "borderRightWidth", "borderWidth", "borderStyle", "borderColor"], _excluded2$4 = ["className", "orientation", "__css"];
23681
+ var Divider = /* @__PURE__ */ forwardRef(function(props, ref) {
23682
+ var _useStyleConfig = useStyleConfig("Divider", props), borderLeftWidth = _useStyleConfig.borderLeftWidth, borderBottomWidth = _useStyleConfig.borderBottomWidth, borderTopWidth = _useStyleConfig.borderTopWidth, borderRightWidth = _useStyleConfig.borderRightWidth, borderWidth = _useStyleConfig.borderWidth, borderStyle = _useStyleConfig.borderStyle, borderColor = _useStyleConfig.borderColor, styles2 = _objectWithoutPropertiesLoose$5(_useStyleConfig, _excluded$b);
23683
+ var _omitThemingProps = omitThemingProps(props), className = _omitThemingProps.className, _omitThemingProps$ori = _omitThemingProps.orientation, orientation = _omitThemingProps$ori === void 0 ? "horizontal" : _omitThemingProps$ori, __css = _omitThemingProps.__css, rest = _objectWithoutPropertiesLoose$5(_omitThemingProps, _excluded2$4);
23684
+ var dividerStyles = {
23685
+ vertical: {
23686
+ borderLeftWidth: borderLeftWidth || borderRightWidth || borderWidth || "1px",
23687
+ height: "100%"
23688
+ },
23689
+ horizontal: {
23690
+ borderBottomWidth: borderBottomWidth || borderTopWidth || borderWidth || "1px",
23691
+ width: "100%"
23692
+ }
23693
+ };
23694
+ return /* @__PURE__ */ React.createElement(chakra.hr, _extends$4({
23695
+ ref,
23696
+ "aria-orientation": orientation
23697
+ }, rest, {
23698
+ __css: _extends$4({}, styles2, {
23699
+ border: "0",
23700
+ borderColor,
23701
+ borderStyle
23702
+ }, dividerStyles[orientation], __css),
23703
+ className: cx("chakra-divider", className)
23704
+ }));
23705
+ });
23680
23706
  var _excluded$a = ["direction", "align", "justify", "wrap", "basis", "grow", "shrink"];
23681
23707
  var Flex = /* @__PURE__ */ forwardRef(function(props, ref) {
23682
23708
  var direction2 = props.direction, align = props.align, justify = props.justify, wrap3 = props.wrap, basis = props.basis, grow = props.grow, shrink = props.shrink, rest = _objectWithoutPropertiesLoose$5(props, _excluded$a);
@@ -25834,12 +25860,33 @@ function useCallbackRef(initialValue, callback) {
25834
25860
  ref.callback = callback;
25835
25861
  return ref.facade;
25836
25862
  }
25863
+ var currentValues = /* @__PURE__ */ new WeakMap();
25837
25864
  function useMergeRefs(refs, defaultValue) {
25838
- return useCallbackRef(defaultValue || null, function(newValue) {
25865
+ var callbackRef = useCallbackRef(defaultValue || null, function(newValue) {
25839
25866
  return refs.forEach(function(ref) {
25840
25867
  return assignRef(ref, newValue);
25841
25868
  });
25842
25869
  });
25870
+ React.useLayoutEffect(function() {
25871
+ var oldValue = currentValues.get(callbackRef);
25872
+ if (oldValue) {
25873
+ var prevRefs_1 = new Set(oldValue);
25874
+ var nextRefs_1 = new Set(refs);
25875
+ var current_1 = callbackRef.current;
25876
+ prevRefs_1.forEach(function(ref) {
25877
+ if (!nextRefs_1.has(ref)) {
25878
+ assignRef(ref, null);
25879
+ }
25880
+ });
25881
+ nextRefs_1.forEach(function(ref) {
25882
+ if (!prevRefs_1.has(ref)) {
25883
+ assignRef(ref, current_1);
25884
+ }
25885
+ });
25886
+ }
25887
+ currentValues.set(callbackRef, refs);
25888
+ }, [refs]);
25889
+ return callbackRef;
25843
25890
  }
25844
25891
  var hiddenGuard = {
25845
25892
  width: "1px",
@@ -26100,24 +26147,24 @@ function _typeof(o2) {
26100
26147
  return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3;
26101
26148
  }, _typeof(o2);
26102
26149
  }
26103
- function _toPrimitive(input, hint) {
26104
- if (_typeof(input) !== "object" || input === null)
26105
- return input;
26106
- var prim = input[Symbol.toPrimitive];
26107
- if (prim !== void 0) {
26108
- var res = prim.call(input, hint || "default");
26109
- if (_typeof(res) !== "object")
26110
- return res;
26150
+ function toPrimitive(t2, r2) {
26151
+ if ("object" != _typeof(t2) || !t2)
26152
+ return t2;
26153
+ var e2 = t2[Symbol.toPrimitive];
26154
+ if (void 0 !== e2) {
26155
+ var i2 = e2.call(t2, r2 || "default");
26156
+ if ("object" != _typeof(i2))
26157
+ return i2;
26111
26158
  throw new TypeError("@@toPrimitive must return a primitive value.");
26112
26159
  }
26113
- return (hint === "string" ? String : Number)(input);
26160
+ return ("string" === r2 ? String : Number)(t2);
26114
26161
  }
26115
- function _toPropertyKey(arg) {
26116
- var key = _toPrimitive(arg, "string");
26117
- return _typeof(key) === "symbol" ? key : String(key);
26162
+ function toPropertyKey(t2) {
26163
+ var i2 = toPrimitive(t2, "string");
26164
+ return "symbol" == _typeof(i2) ? i2 : String(i2);
26118
26165
  }
26119
26166
  function _defineProperty(obj, key, value) {
26120
- key = _toPropertyKey(key);
26167
+ key = toPropertyKey(key);
26121
26168
  if (key in obj) {
26122
26169
  Object.defineProperty(obj, key, {
26123
26170
  value,
@@ -29654,10 +29701,23 @@ function BtnLink({
29654
29701
  children,
29655
29702
  m: m2 = "0",
29656
29703
  onClick,
29657
- id: id2
29704
+ id: id2,
29705
+ as = "button",
29706
+ href = "",
29707
+ textDecorationLine = true,
29708
+ fontSize = "0.875rem"
29658
29709
  }) {
29710
+ const typeButton = {
29711
+ button: {
29712
+ onClick
29713
+ },
29714
+ a: {
29715
+ href,
29716
+ target: "_blank"
29717
+ }
29718
+ };
29659
29719
  return /* @__PURE__ */ jsx(Box, {
29660
- as: "button",
29720
+ as,
29661
29721
  id: id2,
29662
29722
  backgroundColor: "transparent",
29663
29723
  borderStyle: "none",
@@ -29667,16 +29727,16 @@ function BtnLink({
29667
29727
  fontFamily: "Roboto",
29668
29728
  fontStyle: "normal",
29669
29729
  fontWeight: "500",
29670
- fontSize: ".875rem",
29730
+ fontSize,
29671
29731
  lineHeight: "1rem",
29672
- textDecorationLine: "underline",
29732
+ textDecorationLine: textDecorationLine ? "underline" : "none",
29673
29733
  color: vars("colors-main-deepSkyBlue"),
29674
29734
  m: m2,
29675
- onClick,
29676
29735
  _hover: {
29677
29736
  color: vars("colors-neutral-darkCharcoal"),
29678
29737
  cursor: "pointer"
29679
29738
  },
29739
+ ...typeButton[as],
29680
29740
  children
29681
29741
  });
29682
29742
  }
@@ -31131,7 +31191,9 @@ function Alert({
31131
31191
  isFlash = false,
31132
31192
  onClick,
31133
31193
  state: state2,
31134
- m: m2
31194
+ m: m2,
31195
+ endTextLink,
31196
+ onClickLink
31135
31197
  }) {
31136
31198
  const [isMobile] = useMediaQuery("(max-width: 425px)");
31137
31199
  const handleClick = () => {
@@ -31186,7 +31248,12 @@ function Alert({
31186
31248
  fontWeight: "400",
31187
31249
  lineHeight: "28px",
31188
31250
  color: vars("colors-neutral-darkCharcoal"),
31189
- children
31251
+ children: /* @__PURE__ */ jsxs("p", {
31252
+ children: [children, endTextLink && onClickLink && /* @__PURE__ */ jsx(BtnLink, {
31253
+ onClick: onClickLink,
31254
+ children: endTextLink
31255
+ })]
31256
+ })
31190
31257
  }), buttonType === "link" && /* @__PURE__ */ jsx(BtnLink, {
31191
31258
  onClick: handleClick,
31192
31259
  children: buttonText
@@ -31674,5 +31741,63 @@ const useFlashNotification = ({ state: state2, message }) => {
31674
31741
  }
31675
31742
  };
31676
31743
  };
31677
- export { Alert, Btn, BtnLink, BtnPrimary, BtnSecondary, BtnTertiary, CourseList, CourseStatus, FlashNotification, index as Icons, Label, NewTooltip, Progress, Ripples, TinyAlert, dataFake, maxWidthCoursesList, theme, useFlashNotification, vars };
31744
+ function ModalAlert({
31745
+ showModal,
31746
+ typeAlert,
31747
+ title,
31748
+ description,
31749
+ optionsButton
31750
+ }) {
31751
+ const [isDesktop] = useMediaQuery("(min-width: 650px)");
31752
+ const showBorder = optionsButton.length > 1;
31753
+ return /* @__PURE__ */ jsxs(Modal, {
31754
+ isOpen: showModal,
31755
+ onClose: () => {
31756
+ },
31757
+ closeOnEsc: false,
31758
+ closeOnOverlayClick: false,
31759
+ size: isDesktop ? "xl" : "sm",
31760
+ children: [/* @__PURE__ */ jsx(ModalOverlay, {}), /* @__PURE__ */ jsxs(ModalContent, {
31761
+ children: [/* @__PURE__ */ jsxs(Box, {
31762
+ alignItems: "center",
31763
+ justifyContent: "center",
31764
+ textAlign: "center",
31765
+ py: 8,
31766
+ children: [/* @__PURE__ */ jsx(Box, {
31767
+ display: "flex",
31768
+ justifyContent: "center",
31769
+ children: alertStates[typeAlert].icon
31770
+ }), /* @__PURE__ */ jsx(ModalHeader, {
31771
+ children: title
31772
+ }), /* @__PURE__ */ jsx(ModalBody, {
31773
+ children: description
31774
+ })]
31775
+ }), /* @__PURE__ */ jsx(Divider, {
31776
+ colorScheme: "E6E6E6",
31777
+ size: "2",
31778
+ opacity: "1"
31779
+ }), /* @__PURE__ */ jsx(ModalFooter, {
31780
+ justifyContent: "center",
31781
+ padding: "0",
31782
+ children: optionsButton.map((option, index2) => {
31783
+ return /* @__PURE__ */ jsx(Box, {
31784
+ width: "99%",
31785
+ textAlign: "center",
31786
+ padding: "4",
31787
+ borderLeftWidth: showBorder && option.id === optionsButton[1].id ? "1px" : "0",
31788
+ borderLeftColor: "#E6E6E6",
31789
+ children: /* @__PURE__ */ jsx(BtnLink, {
31790
+ textDecorationLine: false,
31791
+ fontSize: "1rem",
31792
+ onClick: () => option.action(),
31793
+ children: option.label
31794
+ })
31795
+ }, index2);
31796
+ })
31797
+ })]
31798
+ })]
31799
+ });
31800
+ }
31801
+ ModalAlert.displayName = "ModalAlert";
31802
+ export { Alert, Btn, BtnLink, BtnPrimary, BtnSecondary, BtnTertiary, CourseList, CourseStatus, FlashNotification, index as Icons, Label, ModalAlert, NewTooltip, Progress, Ripples, TinyAlert, dataFake, maxWidthCoursesList, theme, useFlashNotification, vars };
31678
31803
  //# sourceMappingURL=eclass-ui-kit.es.js.map