@eclass/ui-kit 1.64.2 → 1.64.4
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.
- package/dist/eclass-ui-kit.es.js +124 -124
- package/dist/eclass-ui-kit.es.js.map +1 -1
- package/dist/eclass-ui-kit.umd.js +13 -13
- package/dist/eclass-ui-kit.umd.js.map +1 -1
- package/dist/molecules/Buttons/BtnLink.d.ts +2 -2
- package/dist/molecules/Buttons/BtnLink.d.ts.map +1 -1
- package/dist/organisms/CourseList/components/Section.d.ts.map +1 -1
- package/dist/organisms/Modals/Modal/Modal.d.ts.map +1 -1
- package/dist/organisms/SimpleCourseBox/SimpleCourseBox.d.ts.map +1 -1
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/eclass-ui-kit.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { extendTheme, Box, CircularProgress, Icon, Button, useMediaQuery, Tooltip, Flex, Stack, Center, Image, Text as Text$1, HStack, Heading, List, ListItem,
|
|
1
|
+
import { extendTheme, Box, CircularProgress, Icon, Button, useMediaQuery, Tooltip, Flex, Stack, Center, Image, Text as Text$1, HStack, Heading, List, ListItem, Modal as Modal$1, ModalContent as ModalContent$1, ModalHeader, ModalCloseButton, ModalBody, ModalFooter, ModalOverlay, useDisclosure, LinkBox, LinkOverlay, Link, MenuButton, MenuGroup, Menu, MenuList, MenuItem, Divider, IconButton } from "@chakra-ui/react";
|
|
2
2
|
import * as React$1 from "react";
|
|
3
|
-
import React__default, {
|
|
3
|
+
import React__default, { useState, useEffect, useCallback, useRef } from "react";
|
|
4
4
|
const main = {
|
|
5
5
|
deepSkyBlue: "#0189FF",
|
|
6
6
|
azureRadiance: "#017BE5",
|
|
@@ -1849,6 +1849,7 @@ function BtnLink({
|
|
|
1849
1849
|
isDisable = false,
|
|
1850
1850
|
m: m2 = "0",
|
|
1851
1851
|
onClick,
|
|
1852
|
+
p: p2,
|
|
1852
1853
|
role = "link",
|
|
1853
1854
|
tabIndex,
|
|
1854
1855
|
target = "_blank",
|
|
@@ -1876,6 +1877,7 @@ function BtnLink({
|
|
|
1876
1877
|
id,
|
|
1877
1878
|
onClick: isDisable ? void 0 : onClick,
|
|
1878
1879
|
opacity: isDisable ? 0.5 : 1,
|
|
1880
|
+
padding: p2 != null ? p2 : ".25em",
|
|
1879
1881
|
role,
|
|
1880
1882
|
tabIndex,
|
|
1881
1883
|
textDecorationLine: textDecorationLine ? "underline" : "none",
|
|
@@ -1895,7 +1897,6 @@ const stylesBtnLink = {
|
|
|
1895
1897
|
fontStyle: "normal",
|
|
1896
1898
|
fontWeight: "500",
|
|
1897
1899
|
lineHeight: "1rem",
|
|
1898
|
-
padding: ".25em",
|
|
1899
1900
|
textDecorationLine: "underline",
|
|
1900
1901
|
width: "fit-content",
|
|
1901
1902
|
_hover: {
|
|
@@ -2238,20 +2239,104 @@ function Header$1() {
|
|
|
2238
2239
|
});
|
|
2239
2240
|
}
|
|
2240
2241
|
Header$1.displayName = "Header";
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2242
|
+
const AVATAR_COLORS = ["#0076ba", "#229f9c", "#2cb26b", "#30baed", "#95569e", "#9bc03a", "#d84315", "#f5a623", "#f6712f", "#ff6363"];
|
|
2243
|
+
const getColorIndex = (fullName) => {
|
|
2244
|
+
var _a;
|
|
2245
|
+
const trimmedNameLength = (_a = fullName == null ? void 0 : fullName.trim().length) != null ? _a : 0;
|
|
2246
|
+
return trimmedNameLength % 10;
|
|
2247
|
+
};
|
|
2248
|
+
const getAvatarColor = (fullName) => {
|
|
2249
|
+
const position = getColorIndex(fullName);
|
|
2250
|
+
return AVATAR_COLORS[position];
|
|
2251
|
+
};
|
|
2252
|
+
const getInitials = (fullName) => fullName.split(" ").map((word) => word[0]).slice(0, 2).join("").toUpperCase();
|
|
2253
|
+
const Avatar = ({
|
|
2254
|
+
fullName,
|
|
2255
|
+
picture,
|
|
2256
|
+
size = 50,
|
|
2257
|
+
fontSize = 14,
|
|
2258
|
+
alt = "Avatar",
|
|
2259
|
+
id,
|
|
2260
|
+
borderDecoration = false
|
|
2261
|
+
}) => {
|
|
2262
|
+
const [bgColor, setBgColor] = useState("");
|
|
2263
|
+
const [imageValid, setImageValid] = useState(false);
|
|
2264
|
+
useEffect(() => {
|
|
2265
|
+
setBgColor(getAvatarColor(fullName));
|
|
2266
|
+
}, [fullName]);
|
|
2267
|
+
const wrapperStyle = {
|
|
2268
|
+
alignItems: "center",
|
|
2269
|
+
backgroundColor: (fullName == null ? void 0 : fullName.length) === 0 ? "#fff" : bgColor,
|
|
2270
|
+
border: borderDecoration ? `3px solid #0189FF` : "none",
|
|
2271
|
+
borderRadius: "50%",
|
|
2272
|
+
display: "flex",
|
|
2273
|
+
flexShrink: 0,
|
|
2274
|
+
height: `${size}px`,
|
|
2275
|
+
justifyContent: "center",
|
|
2276
|
+
margin: 0,
|
|
2277
|
+
overflow: "hidden",
|
|
2278
|
+
width: `${size}px`,
|
|
2279
|
+
boxSizing: "border-box"
|
|
2280
|
+
};
|
|
2281
|
+
const initialsStyle = {
|
|
2282
|
+
color: "#fff",
|
|
2283
|
+
fontFamily: "Roboto, sans-serif",
|
|
2284
|
+
fontSize: `${fontSize}px`,
|
|
2285
|
+
fontWeight: "bold",
|
|
2286
|
+
lineHeight: "30px",
|
|
2287
|
+
textTransform: "uppercase"
|
|
2288
|
+
};
|
|
2289
|
+
const imgStyle = {
|
|
2290
|
+
height: "100%",
|
|
2291
|
+
width: "100%",
|
|
2292
|
+
objectFit: "cover",
|
|
2293
|
+
display: "block"
|
|
2294
|
+
};
|
|
2295
|
+
if (!fullName || fullName.length === 0) {
|
|
2296
|
+
return /* @__PURE__ */ jsx("figure", {
|
|
2297
|
+
style: wrapperStyle,
|
|
2298
|
+
"data-testid": "Avatar",
|
|
2299
|
+
"aria-hidden": "true",
|
|
2300
|
+
id
|
|
2301
|
+
});
|
|
2246
2302
|
}
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2303
|
+
if (picture) {
|
|
2304
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
2305
|
+
style: wrapperStyle,
|
|
2306
|
+
"data-testid": "Avatar",
|
|
2307
|
+
role: "presentation",
|
|
2308
|
+
children: [!imageValid && /* @__PURE__ */ jsx("span", {
|
|
2309
|
+
style: initialsStyle,
|
|
2310
|
+
id,
|
|
2311
|
+
"aria-hidden": "true",
|
|
2312
|
+
children: getInitials(fullName)
|
|
2313
|
+
}), /* @__PURE__ */ jsx("img", {
|
|
2314
|
+
src: picture,
|
|
2315
|
+
alt,
|
|
2316
|
+
id: imageValid ? id : void 0,
|
|
2317
|
+
role: "presentation",
|
|
2318
|
+
style: {
|
|
2319
|
+
...imgStyle,
|
|
2320
|
+
display: imageValid ? "block" : "none"
|
|
2321
|
+
},
|
|
2322
|
+
onLoad: () => setImageValid(true),
|
|
2323
|
+
onError: () => setImageValid(false)
|
|
2324
|
+
})]
|
|
2325
|
+
});
|
|
2326
|
+
}
|
|
2327
|
+
return /* @__PURE__ */ jsx("figure", {
|
|
2328
|
+
style: wrapperStyle,
|
|
2329
|
+
"data-testid": "Avatar",
|
|
2330
|
+
role: "presentation",
|
|
2331
|
+
children: bgColor ? /* @__PURE__ */ jsx("span", {
|
|
2332
|
+
style: initialsStyle,
|
|
2333
|
+
id,
|
|
2334
|
+
"aria-hidden": "true",
|
|
2335
|
+
children: getInitials(fullName)
|
|
2336
|
+
}) : null
|
|
2252
2337
|
});
|
|
2253
|
-
}
|
|
2254
|
-
|
|
2338
|
+
};
|
|
2339
|
+
Avatar.displayName = "Avatar";
|
|
2255
2340
|
function IconSelection({
|
|
2256
2341
|
type,
|
|
2257
2342
|
progressValue = 0
|
|
@@ -2300,6 +2385,20 @@ function CourseStatus({
|
|
|
2300
2385
|
})]
|
|
2301
2386
|
});
|
|
2302
2387
|
}
|
|
2388
|
+
function DateStatus({
|
|
2389
|
+
date
|
|
2390
|
+
}) {
|
|
2391
|
+
if (date == null || date.length === 0) {
|
|
2392
|
+
return null;
|
|
2393
|
+
}
|
|
2394
|
+
return /* @__PURE__ */ jsx(Text$1, {
|
|
2395
|
+
fontSize: ".75rem",
|
|
2396
|
+
color: vars("colors-neutral-darkCharcoal"),
|
|
2397
|
+
m: "0",
|
|
2398
|
+
children: date
|
|
2399
|
+
});
|
|
2400
|
+
}
|
|
2401
|
+
DateStatus.displayName = "DateStatus";
|
|
2303
2402
|
function Section() {
|
|
2304
2403
|
const {
|
|
2305
2404
|
name,
|
|
@@ -2360,13 +2459,10 @@ function Section() {
|
|
|
2360
2459
|
}), /* @__PURE__ */ jsx(Box, {
|
|
2361
2460
|
display: "inline-block",
|
|
2362
2461
|
ml: ".625rem",
|
|
2363
|
-
children: item.href !== void 0 && ((_a = item.href) == null ? void 0 : _a.length) > 0 ? /* @__PURE__ */ jsx(
|
|
2364
|
-
isExternal: true,
|
|
2462
|
+
children: item.href !== void 0 && ((_a = item.href) == null ? void 0 : _a.length) > 0 ? /* @__PURE__ */ jsx(BtnLink, {
|
|
2365
2463
|
href: item.href,
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
fontWeight: "500",
|
|
2369
|
-
fontSize: ".75rem",
|
|
2464
|
+
p: "0",
|
|
2465
|
+
target: "_self",
|
|
2370
2466
|
children: item.text
|
|
2371
2467
|
}) : /* @__PURE__ */ jsx(Text$1, {
|
|
2372
2468
|
m: "0",
|
|
@@ -6862,104 +6958,6 @@ function skipAttributesToProps(node2) {
|
|
|
6862
6958
|
})(lib$3);
|
|
6863
6959
|
var HTMLReactParser = /* @__PURE__ */ getDefaultExportFromCjs(lib$3);
|
|
6864
6960
|
var ReactParser = HTMLReactParser.default || HTMLReactParser;
|
|
6865
|
-
const AVATAR_COLORS = ["#0076ba", "#229f9c", "#2cb26b", "#30baed", "#95569e", "#9bc03a", "#d84315", "#f5a623", "#f6712f", "#ff6363"];
|
|
6866
|
-
const getColorIndex = (fullName) => {
|
|
6867
|
-
var _a;
|
|
6868
|
-
const trimmedNameLength = (_a = fullName == null ? void 0 : fullName.trim().length) != null ? _a : 0;
|
|
6869
|
-
return trimmedNameLength % 10;
|
|
6870
|
-
};
|
|
6871
|
-
const getAvatarColor = (fullName) => {
|
|
6872
|
-
const position = getColorIndex(fullName);
|
|
6873
|
-
return AVATAR_COLORS[position];
|
|
6874
|
-
};
|
|
6875
|
-
const getInitials = (fullName) => fullName.split(" ").map((word) => word[0]).slice(0, 2).join("").toUpperCase();
|
|
6876
|
-
const Avatar = ({
|
|
6877
|
-
fullName,
|
|
6878
|
-
picture,
|
|
6879
|
-
size = 50,
|
|
6880
|
-
fontSize = 14,
|
|
6881
|
-
alt = "Avatar",
|
|
6882
|
-
id,
|
|
6883
|
-
borderDecoration = false
|
|
6884
|
-
}) => {
|
|
6885
|
-
const [bgColor, setBgColor] = useState("");
|
|
6886
|
-
const [imageValid, setImageValid] = useState(false);
|
|
6887
|
-
useEffect(() => {
|
|
6888
|
-
setBgColor(getAvatarColor(fullName));
|
|
6889
|
-
}, [fullName]);
|
|
6890
|
-
const wrapperStyle = {
|
|
6891
|
-
alignItems: "center",
|
|
6892
|
-
backgroundColor: (fullName == null ? void 0 : fullName.length) === 0 ? "#fff" : bgColor,
|
|
6893
|
-
border: borderDecoration ? `3px solid #0189FF` : "none",
|
|
6894
|
-
borderRadius: "50%",
|
|
6895
|
-
display: "flex",
|
|
6896
|
-
flexShrink: 0,
|
|
6897
|
-
height: `${size}px`,
|
|
6898
|
-
justifyContent: "center",
|
|
6899
|
-
margin: 0,
|
|
6900
|
-
overflow: "hidden",
|
|
6901
|
-
width: `${size}px`,
|
|
6902
|
-
boxSizing: "border-box"
|
|
6903
|
-
};
|
|
6904
|
-
const initialsStyle = {
|
|
6905
|
-
color: "#fff",
|
|
6906
|
-
fontFamily: "Roboto, sans-serif",
|
|
6907
|
-
fontSize: `${fontSize}px`,
|
|
6908
|
-
fontWeight: "bold",
|
|
6909
|
-
lineHeight: "30px",
|
|
6910
|
-
textTransform: "uppercase"
|
|
6911
|
-
};
|
|
6912
|
-
const imgStyle = {
|
|
6913
|
-
height: "100%",
|
|
6914
|
-
width: "100%",
|
|
6915
|
-
objectFit: "cover",
|
|
6916
|
-
display: "block"
|
|
6917
|
-
};
|
|
6918
|
-
if (!fullName || fullName.length === 0) {
|
|
6919
|
-
return /* @__PURE__ */ jsx("figure", {
|
|
6920
|
-
style: wrapperStyle,
|
|
6921
|
-
"data-testid": "Avatar",
|
|
6922
|
-
"aria-hidden": "true",
|
|
6923
|
-
id
|
|
6924
|
-
});
|
|
6925
|
-
}
|
|
6926
|
-
if (picture) {
|
|
6927
|
-
return /* @__PURE__ */ jsxs("figure", {
|
|
6928
|
-
style: wrapperStyle,
|
|
6929
|
-
"data-testid": "Avatar",
|
|
6930
|
-
role: "presentation",
|
|
6931
|
-
children: [!imageValid && /* @__PURE__ */ jsx("span", {
|
|
6932
|
-
style: initialsStyle,
|
|
6933
|
-
id,
|
|
6934
|
-
"aria-hidden": "true",
|
|
6935
|
-
children: getInitials(fullName)
|
|
6936
|
-
}), /* @__PURE__ */ jsx("img", {
|
|
6937
|
-
src: picture,
|
|
6938
|
-
alt,
|
|
6939
|
-
id: imageValid ? id : void 0,
|
|
6940
|
-
role: "presentation",
|
|
6941
|
-
style: {
|
|
6942
|
-
...imgStyle,
|
|
6943
|
-
display: imageValid ? "block" : "none"
|
|
6944
|
-
},
|
|
6945
|
-
onLoad: () => setImageValid(true),
|
|
6946
|
-
onError: () => setImageValid(false)
|
|
6947
|
-
})]
|
|
6948
|
-
});
|
|
6949
|
-
}
|
|
6950
|
-
return /* @__PURE__ */ jsx("figure", {
|
|
6951
|
-
style: wrapperStyle,
|
|
6952
|
-
"data-testid": "Avatar",
|
|
6953
|
-
role: "presentation",
|
|
6954
|
-
children: bgColor ? /* @__PURE__ */ jsx("span", {
|
|
6955
|
-
style: initialsStyle,
|
|
6956
|
-
id,
|
|
6957
|
-
"aria-hidden": "true",
|
|
6958
|
-
children: getInitials(fullName)
|
|
6959
|
-
}) : null
|
|
6960
|
-
});
|
|
6961
|
-
};
|
|
6962
|
-
Avatar.displayName = "Avatar";
|
|
6963
6961
|
const alertStates = {
|
|
6964
6962
|
success: {
|
|
6965
6963
|
icon: /* @__PURE__ */ jsx(SuccessWhite, {}),
|
|
@@ -7719,6 +7717,7 @@ const useModalConfig = ({
|
|
|
7719
7717
|
}
|
|
7720
7718
|
};
|
|
7721
7719
|
};
|
|
7720
|
+
const StyledModalContent$1 = ModalContent$1;
|
|
7722
7721
|
const uiKitModalIsDesktop = 641;
|
|
7723
7722
|
const ModalPadding = {
|
|
7724
7723
|
py: "32px",
|
|
@@ -7773,7 +7772,7 @@ const Modal = ({
|
|
|
7773
7772
|
}
|
|
7774
7773
|
}
|
|
7775
7774
|
},
|
|
7776
|
-
children: /* @__PURE__ */ jsx(
|
|
7775
|
+
children: /* @__PURE__ */ jsx(StyledModalContent$1, {
|
|
7777
7776
|
...modalConfig.contentProps,
|
|
7778
7777
|
children: /* @__PURE__ */ jsx(ModalContentBase, {
|
|
7779
7778
|
fixedButtons,
|
|
@@ -11556,8 +11555,9 @@ const SimpleCourseBox = ({
|
|
|
11556
11555
|
noBorder = false
|
|
11557
11556
|
}) => {
|
|
11558
11557
|
const link = !isEnabled || !href || href === "" ? void 0 : href;
|
|
11558
|
+
const [isDesktop] = useMediaQuery("(min-width: 768px)");
|
|
11559
11559
|
return /* @__PURE__ */ jsx(StyledLinkBox, {
|
|
11560
|
-
p: "16px
|
|
11560
|
+
p: isDesktop ? "16px 24px" : "16px",
|
|
11561
11561
|
borderBottom: noBorder ? "none" : `1px solid ${vars("colors-neutral-platinum")}`,
|
|
11562
11562
|
_hover: {
|
|
11563
11563
|
backgroundColor: link ? vars("colors-neutral-cultured2") : "none",
|
|
@@ -11575,10 +11575,10 @@ const SimpleCourseBox = ({
|
|
|
11575
11575
|
gap: "24px",
|
|
11576
11576
|
alignItems: "center",
|
|
11577
11577
|
justifyContent: "space-between",
|
|
11578
|
-
pr: "8px",
|
|
11579
11578
|
children: [/* @__PURE__ */ jsxs(StyledFlex, {
|
|
11580
|
-
gap: "24px",
|
|
11581
|
-
alignItems: "center",
|
|
11579
|
+
gap: isDesktop ? "24px" : "16px",
|
|
11580
|
+
alignItems: isDesktop ? "center" : "flex-start",
|
|
11581
|
+
flexDir: isDesktop ? "row" : "column",
|
|
11582
11582
|
children: [/* @__PURE__ */ jsx(StyledImage, {
|
|
11583
11583
|
src: img,
|
|
11584
11584
|
w: "150px",
|