@telia-ace/knowledge-widget-ui 1.0.8 → 1.0.11

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.
Files changed (91) hide show
  1. package/{lib-esm → dist}/components/dialog-link.d.ts +0 -0
  2. package/{lib → dist}/components/dialog-list.d.ts +1 -1
  3. package/{lib-esm → dist}/components/drawer-list.d.ts +0 -0
  4. package/{lib-esm → dist}/components/dropdown-actions.d.ts +0 -0
  5. package/{lib-esm → dist}/components/dropdown-list.d.ts +0 -0
  6. package/{lib-esm → dist}/components/favorite-button.d.ts +0 -0
  7. package/{lib-esm → dist}/components/feedback.d.ts +1 -1
  8. package/{lib-esm → dist}/components/guide-list.d.ts +1 -1
  9. package/{lib-esm → dist}/components/index.d.ts +0 -0
  10. package/{lib-esm → dist}/components/loader.d.ts +0 -0
  11. package/{lib-esm → dist}/components/metadata.d.ts +0 -0
  12. package/{lib-esm → dist}/hooks/index.d.ts +0 -0
  13. package/{lib-esm → dist}/hooks/use-arrow-keys.d.ts +0 -0
  14. package/{lib-esm → dist}/hooks/use-debounce.d.ts +0 -0
  15. package/{lib-esm → dist}/hooks/use-favorites.d.ts +0 -0
  16. package/{lib-esm → dist}/hooks/use-hover.d.ts +0 -0
  17. package/{lib-esm → dist}/index.d.ts +0 -0
  18. package/dist/index.js +1385 -0
  19. package/dist/index.js.map +1 -0
  20. package/{lib-esm → dist}/missing-type-exports.d.ts +0 -0
  21. package/{lib-esm → dist}/styles.d.ts +0 -1
  22. package/{lib-esm → dist}/utils/embedded-link-mapper.d.ts +0 -0
  23. package/{lib-esm → dist}/utils/guide-render-instructions.d.ts +0 -0
  24. package/{lib-esm → dist}/utils/index.d.ts +0 -0
  25. package/package.json +11 -12
  26. package/lib/components/dialog-link.d.ts +0 -12
  27. package/lib/components/dialog-link.js +0 -40
  28. package/lib/components/dialog-list.js +0 -72
  29. package/lib/components/drawer-list.d.ts +0 -5
  30. package/lib/components/drawer-list.js +0 -43
  31. package/lib/components/dropdown-actions.d.ts +0 -11
  32. package/lib/components/dropdown-actions.js +0 -25
  33. package/lib/components/dropdown-list.d.ts +0 -5
  34. package/lib/components/dropdown-list.js +0 -66
  35. package/lib/components/favorite-button.d.ts +0 -17
  36. package/lib/components/favorite-button.js +0 -65
  37. package/lib/components/feedback.d.ts +0 -11
  38. package/lib/components/feedback.js +0 -84
  39. package/lib/components/guide-list.d.ts +0 -46
  40. package/lib/components/guide-list.js +0 -202
  41. package/lib/components/index.d.ts +0 -10
  42. package/lib/components/index.js +0 -28
  43. package/lib/components/loader.d.ts +0 -9
  44. package/lib/components/loader.js +0 -50
  45. package/lib/components/metadata.d.ts +0 -17
  46. package/lib/components/metadata.js +0 -35
  47. package/lib/hooks/index.d.ts +0 -5
  48. package/lib/hooks/index.js +0 -14
  49. package/lib/hooks/use-arrow-keys.d.ts +0 -3
  50. package/lib/hooks/use-arrow-keys.js +0 -48
  51. package/lib/hooks/use-debounce.d.ts +0 -2
  52. package/lib/hooks/use-debounce.js +0 -41
  53. package/lib/hooks/use-favorites.d.ts +0 -8
  54. package/lib/hooks/use-favorites.js +0 -81
  55. package/lib/hooks/use-hover.d.ts +0 -2
  56. package/lib/hooks/use-hover.js +0 -29
  57. package/lib/index.d.ts +0 -7
  58. package/lib/index.js +0 -44
  59. package/lib/missing-type-exports.d.ts +0 -47
  60. package/lib/missing-type-exports.js +0 -3
  61. package/lib/styles.d.ts +0 -8
  62. package/lib/styles.js +0 -50
  63. package/lib/utils/embedded-link-mapper.d.ts +0 -3
  64. package/lib/utils/embedded-link-mapper.js +0 -62
  65. package/lib/utils/guide-render-instructions.d.ts +0 -9
  66. package/lib/utils/guide-render-instructions.js +0 -56
  67. package/lib/utils/index.d.ts +0 -1
  68. package/lib/utils/index.js +0 -8
  69. package/lib-esm/components/dialog-link.js +0 -35
  70. package/lib-esm/components/dialog-list.d.ts +0 -7
  71. package/lib-esm/components/dialog-list.js +0 -44
  72. package/lib-esm/components/drawer-list.js +0 -38
  73. package/lib-esm/components/dropdown-actions.js +0 -20
  74. package/lib-esm/components/dropdown-list.js +0 -38
  75. package/lib-esm/components/favorite-button.js +0 -40
  76. package/lib-esm/components/feedback.js +0 -59
  77. package/lib-esm/components/guide-list.js +0 -173
  78. package/lib-esm/components/index.js +0 -10
  79. package/lib-esm/components/loader.js +0 -21
  80. package/lib-esm/components/metadata.js +0 -30
  81. package/lib-esm/hooks/index.js +0 -4
  82. package/lib-esm/hooks/use-arrow-keys.js +0 -46
  83. package/lib-esm/hooks/use-debounce.js +0 -39
  84. package/lib-esm/hooks/use-favorites.js +0 -79
  85. package/lib-esm/hooks/use-hover.js +0 -27
  86. package/lib-esm/index.js +0 -6
  87. package/lib-esm/missing-type-exports.js +0 -2
  88. package/lib-esm/styles.js +0 -24
  89. package/lib-esm/utils/embedded-link-mapper.js +0 -57
  90. package/lib-esm/utils/guide-render-instructions.js +0 -51
  91. package/lib-esm/utils/index.js +0 -1
@@ -1,79 +0,0 @@
1
- var __read = (this && this.__read) || function (o, n) {
2
- var m = typeof Symbol === "function" && o[Symbol.iterator];
3
- if (!m) return o;
4
- var i = m.call(o), r, ar = [], e;
5
- try {
6
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7
- }
8
- catch (error) { e = { error: error }; }
9
- finally {
10
- try {
11
- if (r && !r.done && (m = i["return"])) m.call(i);
12
- }
13
- finally { if (e) throw e.error; }
14
- }
15
- return ar;
16
- };
17
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
18
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
19
- if (ar || !(i in from)) {
20
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
21
- ar[i] = from[i];
22
- }
23
- }
24
- return to.concat(ar || Array.prototype.slice.call(from));
25
- };
26
- import { useContainer } from '@telia-ace/widget-ui';
27
- import { useCallback, useEffect, useMemo, useState } from 'react';
28
- var useFavorites = function () {
29
- var container = useContainer();
30
- var _a = __read(useState([]), 2), favorites = _a[0], setFavorites = _a[1];
31
- var platform = container.get('favorites');
32
- useEffect(function () {
33
- if (platform) {
34
- setFavorites(platform.get());
35
- var events = container.get('$widget').events;
36
- var unsubscribe = events.subscribe('widget:favorites-updated', function (_, _a) {
37
- var updated = _a.updated;
38
- setFavorites(__spreadArray([], __read(updated), false));
39
- });
40
- return unsubscribe;
41
- }
42
- }, []);
43
- var add = function (guideId) {
44
- if (!platform) {
45
- return Promise.resolve([]);
46
- }
47
- return platform.add(guideId);
48
- };
49
- var remove = function (guideId) {
50
- if (!platform) {
51
- return Promise.resolve([]);
52
- }
53
- return platform.remove(guideId);
54
- };
55
- var clear = function () {
56
- if (!platform) {
57
- return Promise.resolve([]);
58
- }
59
- return platform.clear();
60
- };
61
- var toggle = useCallback(function (guideId) {
62
- if (favorites.indexOf(guideId) > -1) {
63
- return remove(guideId);
64
- }
65
- else {
66
- return add(guideId);
67
- }
68
- }, [favorites]);
69
- return [
70
- favorites,
71
- useMemo(function () { return ({
72
- addFavorite: add,
73
- removeFavorite: remove,
74
- clearFavorites: clear,
75
- toggleFavorite: toggle,
76
- }); }, [favorites]),
77
- ];
78
- };
79
- export default useFavorites;
@@ -1,27 +0,0 @@
1
- var __read = (this && this.__read) || function (o, n) {
2
- var m = typeof Symbol === "function" && o[Symbol.iterator];
3
- if (!m) return o;
4
- var i = m.call(o), r, ar = [], e;
5
- try {
6
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7
- }
8
- catch (error) { e = { error: error }; }
9
- finally {
10
- try {
11
- if (r && !r.done && (m = i["return"])) m.call(i);
12
- }
13
- finally { if (e) throw e.error; }
14
- }
15
- return ar;
16
- };
17
- import { useEventListener } from '@telia-ace/widget-ui';
18
- import { useCallback, useRef, useState } from 'react';
19
- export default (function () {
20
- var _a = __read(useState(false), 2), hovering = _a[0], setHovering = _a[1];
21
- var elem = useRef();
22
- var onMouseEnter = useCallback(function () { return setHovering(true); }, [setHovering]);
23
- var onMouseLeave = useCallback(function () { return setHovering(false); }, [setHovering]);
24
- useEventListener('mouseenter', onMouseEnter, elem.current);
25
- useEventListener('mouseleave', onMouseLeave, elem.current);
26
- return [hovering, elem];
27
- });
package/lib-esm/index.js DELETED
@@ -1,6 +0,0 @@
1
- import { AccordionListItem, DialogLink, DialogList, DrawerList, DropdownActions, DropdownList, FavoriteButton, Feedback, GuideList, Loader, LoaderWrapper, Metadata, } from './components';
2
- import { useArrowKeys, useDebounce, useFavorites, useHover } from './hooks';
3
- import { genericHtml, loadingOpacity, SmallCaret, StyledHeaderText, StyledListButton, } from './styles';
4
- import { guideRenderInstructions } from './utils';
5
- export * from '@telia-ace/widget-ui';
6
- export { useFavorites, useDebounce, useArrowKeys, useHover, guideRenderInstructions, Metadata, AccordionListItem, GuideList, DialogLink, DialogList, FavoriteButton, Feedback, Loader, LoaderWrapper, DrawerList, DropdownActions, DropdownList, genericHtml, SmallCaret, StyledHeaderText, StyledListButton, loadingOpacity, };
@@ -1,2 +0,0 @@
1
- export {};
2
- // SHOULD BE EXPORTED FROM @telia-ace/widget-ui
package/lib-esm/styles.js DELETED
@@ -1,24 +0,0 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
- import { Button, Icon, linkTabStyle, paddedBorderTabStyle, Text } from '@telia-ace/widget-ui';
6
- import styled, { css } from 'styled-components';
7
- import { Wrapper as LoaderWrapper } from './components/loader';
8
- export var loadingOpacity = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", ";\n ", "\n > * {\n transition: 200ms ease-out opacity;\n opacity: ", ";\n }\n ", " {\n opacity: ", ";\n }\n"], ["\n ", ";\n ", "\n > * {\n transition: 200ms ease-out opacity;\n opacity: ", ";\n }\n ", " {\n opacity: ", ";\n }\n"])), function (p) { return p['data-loading'] && 'position: relative;'; }, function (p) { return p['data-loading'] && 'min-height: 150px;'; }, function (p) { return (p['data-loading'] ? '0.5' : '1'); }, LoaderWrapper, function (p) { return (p['data-loading'] ? '1' : '0'); });
9
- export var genericHtml = css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-size: ", ";\n font-weight: 300;\n line-height: 1.5em;\n color: ", ";\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n word-break: break-word;\n &:first-child {\n margin-top: 0;\n }\n &:only-child {\n margin: 0;\n }\n &:last-child {\n margin-bottom: 0;\n }\n }\n\n a {\n color: ", ";\n &:focus {\n ", ";\n }\n }\n\n img {\n max-width: 100% !important;\n height: auto !important;\n }\n\n p {\n word-break: break-word;\n margin: ", " 0;\n }\n\n p:first-child {\n margin: 0 0 ", ";\n }\n\n p:last-child {\n margin: ", " 0 0;\n }\n\n p:only-child {\n margin: 0;\n }\n"], ["\n font-size: ", ";\n font-weight: 300;\n line-height: 1.5em;\n color: ", ";\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n word-break: break-word;\n &:first-child {\n margin-top: 0;\n }\n &:only-child {\n margin: 0;\n }\n &:last-child {\n margin-bottom: 0;\n }\n }\n\n a {\n color: ", ";\n &:focus {\n ", ";\n }\n }\n\n img {\n max-width: 100% !important;\n height: auto !important;\n }\n\n p {\n word-break: break-word;\n margin: ", " 0;\n }\n\n p:first-child {\n margin: 0 0 ", ";\n }\n\n p:last-child {\n margin: ", " 0 0;\n }\n\n p:only-child {\n margin: 0;\n }\n"])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.text; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.link; }, function (p) { var _a; return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && linkTabStyle; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; });
10
- export var SmallCaret = styled(Icon)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n && {\n font-size: ", ";\n }\n width: 1.2em;\n"], ["\n && {\n font-size: ", ";\n }\n width: 1.2em;\n"])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.small; });
11
- export var StyledHeaderText = styled(Text)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: ", ";\n font-weight: normal;\n line-height: 1.2em;\n color: ", ";\n"], ["\n font-size: ", ";\n font-weight: normal;\n line-height: 1.2em;\n color: ", ";\n"])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.medium; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.text; });
12
- export var StyledListButton = styled(Button)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n\n ", "\n\n &:focus {\n ", ";\n }\n\n span {\n flex: 1;\n font-weight: 300;\n }\n"], ["\n display: flex;\n align-items: center;\n\n ", "\n\n &:focus {\n ", ";\n }\n\n span {\n flex: 1;\n font-weight: 300;\n }\n"])), function (p) {
13
- var _a;
14
- return p['data-has-label'] === 'true' &&
15
- p['data-has-symbol'] === 'true' &&
16
- "\n svg, i {\n margin: 0 ".concat((_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small, " 0 0;\n }\n ");
17
- }, function (p) {
18
- var _a;
19
- return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n\n svg, i {\n ", "\n }\n "], ["\n ", "\n\n svg, i {\n ", "\n }\n "])), function (p) { return p['data-has-label'] === 'true' && paddedBorderTabStyle; }, function (p) {
20
- return p['data-has-label'] === 'false' &&
21
- p['data-has-symbol'] === 'true' && css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", "\n box-sizing: content-box;\n "], ["\n ", "\n box-sizing: content-box;\n "])), paddedBorderTabStyle);
22
- });
23
- });
24
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
@@ -1,57 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
- import { AnchorLink, WidgetLink } from '@telia-ace/widget-ui';
24
- import React from 'react';
25
- // Determine if href starts with a hashtag
26
- var isAnchorLink = function (href) {
27
- var re = new RegExp('^#', 'i');
28
- var match = re.test(href);
29
- return match;
30
- };
31
- var embeddedLinkMapper = function (container) {
32
- return function (_a) {
33
- var children = _a.children, props = __rest(_a, ["children"]);
34
- var _b = container.get('$widget'), implementation = _b.implementation, currentWidgetName = _b.name;
35
- var _c = props.href, href = _c === void 0 ? '' : _c;
36
- if (isAnchorLink(href)) {
37
- return (React.createElement(AnchorLink, { smooth: true, to: href }, children));
38
- }
39
- var escapedBindings = implementation.bindings
40
- .map(function (binding) { return binding.replace(/\./g, '\\.'); })
41
- .join('|');
42
- var regexp = new RegExp("^((http[s]?:)?//)?(".concat(escapedBindings, ")/([^\\s]+)"));
43
- var expArray = regexp.exec(href);
44
- if (expArray && expArray.length >= 4) {
45
- var targetWidgetName = expArray[4];
46
- var targetWidget = implementation.widgets.get(targetWidgetName);
47
- // blob links should not be treated as a widget link
48
- if (targetWidget &&
49
- !targetWidgetName.startsWith('blob?') &&
50
- !targetWidgetName.startsWith(currentWidgetName)) {
51
- return React.createElement(WidgetLink, { widgetName: targetWidgetName }, children);
52
- }
53
- }
54
- return React.createElement("a", __assign({}, props), children);
55
- };
56
- };
57
- export default embeddedLinkMapper;
@@ -1,51 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
- import { Lightbox } from '@telia-ace/widget-ui';
24
- import React from 'react';
25
- import { DialogLink } from '../components';
26
- import embeddedLinkMapper from './embedded-link-mapper';
27
- var imageLightboxRenderer = function (attrs) { return React.createElement(Lightbox, { attrs: attrs }); };
28
- var guideRenderInstructions = function (container, dialog) {
29
- if (dialog === void 0) { dialog = []; }
30
- return {
31
- transform: {
32
- img: imageLightboxRenderer,
33
- a: function (attr) {
34
- var children = attr.children, otherAttr = __rest(attr, ["children"]);
35
- var connectionId = otherAttr['data-target'];
36
- if (connectionId && dialog.length) {
37
- var item = dialog.find(function (_a) {
38
- var connection = _a.connection;
39
- return connection === connectionId;
40
- });
41
- if (item) {
42
- return React.createElement(DialogLink, __assign({}, item), children);
43
- }
44
- }
45
- var defaultInstructions = embeddedLinkMapper(container);
46
- return defaultInstructions(attr);
47
- },
48
- },
49
- };
50
- };
51
- export default guideRenderInstructions;
@@ -1 +0,0 @@
1
- export { default as guideRenderInstructions } from './guide-render-instructions';