@telia-ace/knowledge-widget-ui 1.0.13 → 1.0.16
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/LICENSE.txt +5 -5
- package/README.md +3 -3
- package/dist/components/dialog-link.d.ts +12 -12
- package/dist/components/dialog-list.d.ts +7 -7
- package/dist/components/drawer-list.d.ts +5 -5
- package/dist/components/dropdown-actions.d.ts +11 -11
- package/dist/components/dropdown-list.d.ts +5 -5
- package/dist/components/favorite-button.d.ts +17 -17
- package/dist/components/feedback.d.ts +11 -11
- package/dist/components/guide-list.d.ts +46 -46
- package/dist/components/index.d.ts +11 -10
- package/dist/components/loader.d.ts +9 -9
- package/dist/components/metadata.d.ts +17 -17
- package/dist/components/notification-list.d.ts +19 -0
- package/dist/hooks/index.d.ts +5 -5
- package/dist/hooks/use-arrow-keys.d.ts +3 -3
- package/dist/hooks/use-debounce.d.ts +2 -2
- package/dist/hooks/use-favorites.d.ts +8 -8
- package/dist/hooks/use-hover.d.ts +2 -2
- package/dist/index.d.ts +7 -7
- package/dist/index.js +190 -88
- package/dist/index.js.map +1 -1
- package/dist/missing-type-exports.d.ts +47 -47
- package/dist/styles.d.ts +6 -8
- package/dist/utils/embedded-link-mapper.d.ts +3 -3
- package/dist/utils/guide-render-instructions.d.ts +9 -9
- package/dist/utils/index.d.ts +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
-
import { useRouteData, Link, Icon, List, list, invertedHoverButton, ItemList, itemList, Drawer, Dropdown, headingElement,
|
|
32
|
+
import { useRouteData, Link, Icon, List, list, invertedHoverButton, ItemList, itemList, Drawer, Dropdown, headingElement, Text, Button, paddedBorderTabStyle, Confirm, SymbolBadge, StyledText as StyledText$1, convertToStringAttributes, useKeyPress, useContainer, useEventListener, Timestamp, DateFormats, TextLink, usePrevious, borderTabStyle, Paragraph, genericHtml, AnchorLink, WidgetLink, Lightbox } from "@telia-ace/widget-ui";
|
|
33
33
|
export * from "@telia-ace/widget-ui";
|
|
34
34
|
import { createParams, formatUrl, appendClassNames, htmlParentContains } from "@telia-ace/widget-utilities";
|
|
35
35
|
import React, { forwardRef, useCallback, useState, useEffect, useMemo, useRef, useContext, useImperativeHandle } from "react";
|
|
@@ -135,9 +135,9 @@ const DrawerList = (_c) => {
|
|
|
135
135
|
fullScreen,
|
|
136
136
|
onToggle,
|
|
137
137
|
closeButtonAriaLabel
|
|
138
|
-
}, /* @__PURE__ */ React.createElement(StyledItemList$
|
|
138
|
+
}, /* @__PURE__ */ React.createElement(StyledItemList$3, __spreadValues({}, other), children));
|
|
139
139
|
};
|
|
140
|
-
const StyledItemList$
|
|
140
|
+
const StyledItemList$3 = styled(ItemList)`
|
|
141
141
|
${itemList}
|
|
142
142
|
font-family: ${(p) => {
|
|
143
143
|
var _a;
|
|
@@ -255,9 +255,9 @@ const DropdownList = (_e) => {
|
|
|
255
255
|
className: appendClassNames(className, "humany-dropdown-list"),
|
|
256
256
|
closeButtonAriaLabel,
|
|
257
257
|
trigger
|
|
258
|
-
}, /* @__PURE__ */ React.createElement(StyledItemList$
|
|
258
|
+
}, /* @__PURE__ */ React.createElement(StyledItemList$2, __spreadValues({}, other), children));
|
|
259
259
|
};
|
|
260
|
-
const StyledItemList$
|
|
260
|
+
const StyledItemList$2 = styled(ItemList)`
|
|
261
261
|
${itemList}
|
|
262
262
|
font-family: ${(p) => {
|
|
263
263
|
var _a;
|
|
@@ -391,80 +391,6 @@ const loadingOpacity = css`
|
|
|
391
391
|
opacity: ${(p) => p["data-loading"] ? "1" : "0"};
|
|
392
392
|
}
|
|
393
393
|
`;
|
|
394
|
-
const genericHtml = css`
|
|
395
|
-
font-size: ${(p) => {
|
|
396
|
-
var _a;
|
|
397
|
-
return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
|
|
398
|
-
}};
|
|
399
|
-
font-weight: 300;
|
|
400
|
-
line-height: 1.5em;
|
|
401
|
-
color: ${(p) => {
|
|
402
|
-
var _a;
|
|
403
|
-
return (_a = p.theme.colors) == null ? void 0 : _a.text;
|
|
404
|
-
}};
|
|
405
|
-
|
|
406
|
-
h1,
|
|
407
|
-
h2,
|
|
408
|
-
h3,
|
|
409
|
-
h4,
|
|
410
|
-
h5,
|
|
411
|
-
h6 {
|
|
412
|
-
word-break: break-word;
|
|
413
|
-
&:first-child {
|
|
414
|
-
margin-top: 0;
|
|
415
|
-
}
|
|
416
|
-
&:only-child {
|
|
417
|
-
margin: 0;
|
|
418
|
-
}
|
|
419
|
-
&:last-child {
|
|
420
|
-
margin-bottom: 0;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
a {
|
|
425
|
-
color: ${(p) => {
|
|
426
|
-
var _a;
|
|
427
|
-
return (_a = p.theme.colors) == null ? void 0 : _a.link;
|
|
428
|
-
}};
|
|
429
|
-
&:focus {
|
|
430
|
-
${(p) => {
|
|
431
|
-
var _a;
|
|
432
|
-
return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && linkTabStyle;
|
|
433
|
-
}};
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
img {
|
|
438
|
-
max-width: 100% !important;
|
|
439
|
-
height: auto !important;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
p {
|
|
443
|
-
word-break: break-word;
|
|
444
|
-
margin: ${(p) => {
|
|
445
|
-
var _a;
|
|
446
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
447
|
-
}} 0;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
p:first-child {
|
|
451
|
-
margin: 0 0 ${(p) => {
|
|
452
|
-
var _a;
|
|
453
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
454
|
-
}};
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
p:last-child {
|
|
458
|
-
margin: ${(p) => {
|
|
459
|
-
var _a;
|
|
460
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
461
|
-
}} 0 0;
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
p:only-child {
|
|
465
|
-
margin: 0;
|
|
466
|
-
}
|
|
467
|
-
`;
|
|
468
394
|
const SmallCaret = styled(Icon)`
|
|
469
395
|
&& {
|
|
470
396
|
font-size: ${(p) => {
|
|
@@ -541,7 +467,7 @@ const FavoriteButton = ({
|
|
|
541
467
|
}, [id, addFavorite]);
|
|
542
468
|
const tooltip = `${isFavorite ? removeFavoriteTooltip : addFavoriteTooltip}${guideTitle ? `: "${guideTitle}"` : ""}`;
|
|
543
469
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, isFavorite ? /* @__PURE__ */ React.createElement(Confirm, {
|
|
544
|
-
trigger: /* @__PURE__ */ React.createElement(StyledButton, {
|
|
470
|
+
trigger: /* @__PURE__ */ React.createElement(StyledButton$1, {
|
|
545
471
|
className: "humany-favorite-button",
|
|
546
472
|
title: tooltip,
|
|
547
473
|
"aria-label": tooltip,
|
|
@@ -557,7 +483,7 @@ const FavoriteButton = ({
|
|
|
557
483
|
confirmLabel: removeFavoriteConfirmLabel,
|
|
558
484
|
header: removeFavoriteHeader,
|
|
559
485
|
text: removeFavoriteLabel
|
|
560
|
-
}) : /* @__PURE__ */ React.createElement(StyledButton, {
|
|
486
|
+
}) : /* @__PURE__ */ React.createElement(StyledButton$1, {
|
|
561
487
|
className: "humany-favorite-button",
|
|
562
488
|
title: tooltip,
|
|
563
489
|
"aria-label": tooltip,
|
|
@@ -570,7 +496,7 @@ const FavoriteButton = ({
|
|
|
570
496
|
symbol: { type: "Svg", content: "star-empty" }
|
|
571
497
|
}), buttonLabel && /* @__PURE__ */ React.createElement(StyledText$1, null, buttonLabel)));
|
|
572
498
|
};
|
|
573
|
-
const StyledButton = styled(StyledListButton)`
|
|
499
|
+
const StyledButton$1 = styled(StyledListButton)`
|
|
574
500
|
grid-area: favorite;
|
|
575
501
|
|
|
576
502
|
&:focus {
|
|
@@ -857,11 +783,11 @@ const Metadata = ({
|
|
|
857
783
|
modified,
|
|
858
784
|
published
|
|
859
785
|
}) => {
|
|
860
|
-
const publishedTimestamp = showPublished && published ? /* @__PURE__ */ React.createElement(StyledTimestamp, {
|
|
786
|
+
const publishedTimestamp = showPublished && published ? /* @__PURE__ */ React.createElement(StyledTimestamp$1, {
|
|
861
787
|
format,
|
|
862
788
|
timestamp: published
|
|
863
789
|
}) : null;
|
|
864
|
-
const modifiedTimestamp = showModified && modified ? /* @__PURE__ */ React.createElement(StyledTimestamp, {
|
|
790
|
+
const modifiedTimestamp = showModified && modified ? /* @__PURE__ */ React.createElement(StyledTimestamp$1, {
|
|
865
791
|
format,
|
|
866
792
|
timestamp: modified
|
|
867
793
|
}) : null;
|
|
@@ -876,7 +802,7 @@ const Metadata = ({
|
|
|
876
802
|
className: "humany-modified"
|
|
877
803
|
}, publishedTimestamp && ", ", modifiedLabel, modifiedTimestamp, byLabel && modifiedBy && ` ${byLabel.replace("{{editor}}", modifiedBy)}`));
|
|
878
804
|
};
|
|
879
|
-
const StyledTimestamp = styled(Timestamp)`
|
|
805
|
+
const StyledTimestamp$1 = styled(Timestamp)`
|
|
880
806
|
&:not(:first-child) {
|
|
881
807
|
margin-left: 4px;
|
|
882
808
|
}
|
|
@@ -1090,7 +1016,7 @@ var guideList = forwardRef((_i, ref) => {
|
|
|
1090
1016
|
}
|
|
1091
1017
|
});
|
|
1092
1018
|
const hasMetaData = !!Object.keys(metadata).filter((k) => typeof metadata[k] !== "undefined").length;
|
|
1093
|
-
return /* @__PURE__ */ React.createElement(StyledItemList, __spreadProps(__spreadValues({
|
|
1019
|
+
return /* @__PURE__ */ React.createElement(StyledItemList$1, __spreadProps(__spreadValues({
|
|
1094
1020
|
className: appendClassNames(className, "humany-guide-list"),
|
|
1095
1021
|
"data-item-count": items.length,
|
|
1096
1022
|
items,
|
|
@@ -1112,7 +1038,7 @@ var guideList = forwardRef((_i, ref) => {
|
|
|
1112
1038
|
symbol: { type: "Svg", content: `caret-${pageCaret}` }
|
|
1113
1039
|
})) : null, children);
|
|
1114
1040
|
});
|
|
1115
|
-
const StyledItemList = styled(ItemList)`
|
|
1041
|
+
const StyledItemList$1 = styled(ItemList)`
|
|
1116
1042
|
${itemList}
|
|
1117
1043
|
padding: ${(p) => {
|
|
1118
1044
|
var _a;
|
|
@@ -1327,6 +1253,182 @@ const StyledMetadata = styled(Metadata)`
|
|
|
1327
1253
|
return typeof p.indent === "number" && `text-indent: calc(${(_a = p.theme.sizes) == null ? void 0 : _a.small} * 2 + ${p.indent}px);`;
|
|
1328
1254
|
}}
|
|
1329
1255
|
`;
|
|
1256
|
+
const NotificationList = (_k) => {
|
|
1257
|
+
var _l = _k, {
|
|
1258
|
+
className,
|
|
1259
|
+
showHeader,
|
|
1260
|
+
notificationList,
|
|
1261
|
+
loading
|
|
1262
|
+
} = _l, other = __objRest(_l, [
|
|
1263
|
+
"className",
|
|
1264
|
+
"showHeader",
|
|
1265
|
+
"notificationList",
|
|
1266
|
+
"loading"
|
|
1267
|
+
]);
|
|
1268
|
+
const [expanded, setExpanded] = useState(null);
|
|
1269
|
+
const {
|
|
1270
|
+
id,
|
|
1271
|
+
title,
|
|
1272
|
+
symbol,
|
|
1273
|
+
notifications = [],
|
|
1274
|
+
defaultHeaderOptions = { visible: true }
|
|
1275
|
+
} = notificationList || {};
|
|
1276
|
+
if (!notifications.length && !loading) {
|
|
1277
|
+
return null;
|
|
1278
|
+
}
|
|
1279
|
+
return /* @__PURE__ */ React.createElement(StyledItemList, __spreadProps(__spreadValues({}, other), {
|
|
1280
|
+
"data-loading": loading,
|
|
1281
|
+
"data-show-header": typeof showHeader === "boolean" ? showHeader : defaultHeaderOptions.visible,
|
|
1282
|
+
className: appendClassNames(className, "humany-notification-list"),
|
|
1283
|
+
"data-notification-category": id,
|
|
1284
|
+
header: title,
|
|
1285
|
+
symbol,
|
|
1286
|
+
items: notifications,
|
|
1287
|
+
renderItem: ({ id: id2, title: title2, body, modified, expandable }) => /* @__PURE__ */ React.createElement(StyledItem, {
|
|
1288
|
+
key: id2,
|
|
1289
|
+
"data-notification": id2,
|
|
1290
|
+
"data-expanded": expandable ? expanded === id2 : true
|
|
1291
|
+
}, expandable ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(StyledButton, {
|
|
1292
|
+
title: title2,
|
|
1293
|
+
"aria-label": title2,
|
|
1294
|
+
"aria-expanded": expanded === id2,
|
|
1295
|
+
onClick: () => setExpanded(expanded === id2 ? null : id2)
|
|
1296
|
+
}, /* @__PURE__ */ React.createElement("span", null, title2), /* @__PURE__ */ React.createElement(StyledSymbolBadge, {
|
|
1297
|
+
size: 11,
|
|
1298
|
+
symbol: {
|
|
1299
|
+
type: "Svg",
|
|
1300
|
+
content: `caret-${expanded === id2 ? "up" : "down"}`
|
|
1301
|
+
}
|
|
1302
|
+
})), /* @__PURE__ */ React.createElement(StyledParagraph, {
|
|
1303
|
+
html: body
|
|
1304
|
+
}), modified && /* @__PURE__ */ React.createElement(StyledTimestamp, {
|
|
1305
|
+
format: DateFormats.YYYY_MM_DD,
|
|
1306
|
+
timestamp: modified
|
|
1307
|
+
})) : /* @__PURE__ */ React.createElement(StyledParagraph, {
|
|
1308
|
+
html: body
|
|
1309
|
+
}))
|
|
1310
|
+
}), /* @__PURE__ */ React.createElement(Loader, {
|
|
1311
|
+
loading
|
|
1312
|
+
}));
|
|
1313
|
+
};
|
|
1314
|
+
const StyledButton = styled(Button)`
|
|
1315
|
+
display: flex;
|
|
1316
|
+
justify-content: space-between;
|
|
1317
|
+
align-items: center;
|
|
1318
|
+
width: 100%;
|
|
1319
|
+
text-align: left;
|
|
1320
|
+
svg,
|
|
1321
|
+
i {
|
|
1322
|
+
color: ${(p) => {
|
|
1323
|
+
var _a;
|
|
1324
|
+
return (_a = p.theme.colors) == null ? void 0 : _a.primary;
|
|
1325
|
+
}};
|
|
1326
|
+
}
|
|
1327
|
+
span {
|
|
1328
|
+
color: ${(p) => {
|
|
1329
|
+
var _a;
|
|
1330
|
+
return (_a = p.theme.colors) == null ? void 0 : _a.text;
|
|
1331
|
+
}};
|
|
1332
|
+
font-size: ${(p) => {
|
|
1333
|
+
var _a;
|
|
1334
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
|
|
1335
|
+
}};
|
|
1336
|
+
overflow: hidden;
|
|
1337
|
+
text-overflow: ellipsis;
|
|
1338
|
+
flex: 1;
|
|
1339
|
+
white-space: nowrap;
|
|
1340
|
+
}
|
|
1341
|
+
&:focus {
|
|
1342
|
+
${(p) => {
|
|
1343
|
+
var _a, _b;
|
|
1344
|
+
return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && css`
|
|
1345
|
+
${borderTabStyle}
|
|
1346
|
+
span {
|
|
1347
|
+
color: ${(_b = p.theme.colors) == null ? void 0 : _b.primary};
|
|
1348
|
+
text-decoration: underline;
|
|
1349
|
+
}
|
|
1350
|
+
`;
|
|
1351
|
+
}};
|
|
1352
|
+
}
|
|
1353
|
+
`;
|
|
1354
|
+
const StyledItemList = styled(ItemList)`
|
|
1355
|
+
${loadingOpacity}
|
|
1356
|
+
${itemList}
|
|
1357
|
+
overflow: hidden;
|
|
1358
|
+
justify-content: flex-start;
|
|
1359
|
+
padding: ${(p) => {
|
|
1360
|
+
var _a;
|
|
1361
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.large;
|
|
1362
|
+
}};
|
|
1363
|
+
${(p) => !p["data-show-header"] && css`
|
|
1364
|
+
> div {
|
|
1365
|
+
${headingElement("h1", css`
|
|
1366
|
+
display: none;
|
|
1367
|
+
`)}
|
|
1368
|
+
}
|
|
1369
|
+
`}
|
|
1370
|
+
|
|
1371
|
+
@media (hover: hover) {
|
|
1372
|
+
button:hover {
|
|
1373
|
+
text-decoration: underline;
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
`;
|
|
1377
|
+
const StyledParagraph = styled(Paragraph)`
|
|
1378
|
+
${genericHtml}
|
|
1379
|
+
font-weight: 300;
|
|
1380
|
+
|
|
1381
|
+
p {
|
|
1382
|
+
white-space: normal;
|
|
1383
|
+
}
|
|
1384
|
+
`;
|
|
1385
|
+
const StyledItem = styled.li`
|
|
1386
|
+
${StyledParagraph} {
|
|
1387
|
+
display: none;
|
|
1388
|
+
&:not(:only-child) {
|
|
1389
|
+
${(p) => {
|
|
1390
|
+
var _a, _b, _c;
|
|
1391
|
+
return ((_a = p.theme.sizes) == null ? void 0 : _a.cardinal) && ((_b = p.theme.sizes) == null ? void 0 : _b.normal) && css`
|
|
1392
|
+
margin: ${(_c = p.theme.sizes) == null ? void 0 : _c.normal} 0;
|
|
1393
|
+
`;
|
|
1394
|
+
}}
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
${(p) => p["data-expanded"] && css`
|
|
1399
|
+
${StyledParagraph} {
|
|
1400
|
+
display: block;
|
|
1401
|
+
}
|
|
1402
|
+
`}
|
|
1403
|
+
|
|
1404
|
+
> span {
|
|
1405
|
+
display: block;
|
|
1406
|
+
font-weight: 300;
|
|
1407
|
+
color: ${(p) => {
|
|
1408
|
+
var _a;
|
|
1409
|
+
return (_a = p.theme.colors) == null ? void 0 : _a.accent;
|
|
1410
|
+
}};
|
|
1411
|
+
}
|
|
1412
|
+
`;
|
|
1413
|
+
const StyledSymbolBadge = styled(SymbolBadge)`
|
|
1414
|
+
margin: 0 0 0 ${(p) => {
|
|
1415
|
+
var _a;
|
|
1416
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.small;
|
|
1417
|
+
}};
|
|
1418
|
+
line {
|
|
1419
|
+
stroke: ${(p) => {
|
|
1420
|
+
var _a;
|
|
1421
|
+
return (_a = p.theme.colors) == null ? void 0 : _a.primary;
|
|
1422
|
+
}};
|
|
1423
|
+
}
|
|
1424
|
+
`;
|
|
1425
|
+
const StyledTimestamp = styled(Timestamp)`
|
|
1426
|
+
font-size: ${(p) => {
|
|
1427
|
+
var _a;
|
|
1428
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.small;
|
|
1429
|
+
}};
|
|
1430
|
+
font-weight: 300;
|
|
1431
|
+
`;
|
|
1330
1432
|
const isAnchorLink = (href) => {
|
|
1331
1433
|
const re = new RegExp("^#", "i");
|
|
1332
1434
|
const match = re.test(href);
|
|
@@ -1381,5 +1483,5 @@ const guideRenderInstructions = (container, dialog = []) => {
|
|
|
1381
1483
|
}
|
|
1382
1484
|
};
|
|
1383
1485
|
};
|
|
1384
|
-
export { AccordionListItem, DialogLink, dialogList as DialogList, DrawerList, DropdownActions, DropdownList, FavoriteButton, feedback as Feedback, guideList as GuideList, Loader, Wrapper$1 as LoaderWrapper, Metadata, SmallCaret, StyledHeaderText, StyledListButton,
|
|
1486
|
+
export { AccordionListItem, DialogLink, dialogList as DialogList, DrawerList, DropdownActions, DropdownList, FavoriteButton, feedback as Feedback, guideList as GuideList, Loader, Wrapper$1 as LoaderWrapper, Metadata, NotificationList, SmallCaret, StyledHeaderText, StyledListButton, guideRenderInstructions, loadingOpacity, useArrowKeys, useDebounce, useFavorites, useHover };
|
|
1385
1487
|
//# sourceMappingURL=index.js.map
|