@telia-ace/knowledge-widget-components-guide 1.0.1
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 +6 -0
- package/README.md +3 -0
- package/lib/answer-version-picker.d.ts +10 -0
- package/lib/answer-version-picker.js +75 -0
- package/lib/categories.d.ts +8 -0
- package/lib/categories.js +80 -0
- package/lib/feedback.d.ts +7 -0
- package/lib/feedback.js +34 -0
- package/lib/functions.d.ts +29 -0
- package/lib/functions.js +129 -0
- package/lib/guide-component.d.ts +69 -0
- package/lib/guide-component.js +196 -0
- package/lib/guide.d.ts +7 -0
- package/lib/guide.js +117 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +7 -0
- package/lib/languages.d.ts +17 -0
- package/lib/languages.js +110 -0
- package/lib/toolbar.d.ts +8 -0
- package/lib/toolbar.js +62 -0
- package/lib/use-feedback.d.ts +4 -0
- package/lib/use-feedback.js +54 -0
- package/lib-esm/answer-version-picker.d.ts +10 -0
- package/lib-esm/answer-version-picker.js +50 -0
- package/lib-esm/categories.d.ts +8 -0
- package/lib-esm/categories.js +52 -0
- package/lib-esm/feedback.d.ts +7 -0
- package/lib-esm/feedback.js +29 -0
- package/lib-esm/functions.d.ts +29 -0
- package/lib-esm/functions.js +101 -0
- package/lib-esm/guide-component.d.ts +69 -0
- package/lib-esm/guide-component.js +166 -0
- package/lib-esm/guide.d.ts +7 -0
- package/lib-esm/guide.js +89 -0
- package/lib-esm/index.d.ts +2 -0
- package/lib-esm/index.js +2 -0
- package/lib-esm/languages.d.ts +17 -0
- package/lib-esm/languages.js +85 -0
- package/lib-esm/toolbar.d.ts +8 -0
- package/lib-esm/toolbar.js +57 -0
- package/lib-esm/use-feedback.d.ts +4 -0
- package/lib-esm/use-feedback.js +52 -0
- package/package.json +47 -0
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
var __assign = (this && this.__assign) || function () {
|
|
6
|
+
__assign = Object.assign || function(t) {
|
|
7
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
+
s = arguments[i];
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
+
t[p] = s[p];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
import { List, paddedBorderTabStyle, TextLink, useRouteData } from '@telia-ace/knowledge-widget-ui';
|
|
17
|
+
import { appendClassNames } from '@telia-ace/widget-utilities';
|
|
18
|
+
import React, { useMemo } from 'react';
|
|
19
|
+
import styled, { css } from 'styled-components';
|
|
20
|
+
var AnswerVersionPicker = function (_a) {
|
|
21
|
+
var className = _a.className, defaultAnswerVersionLabel = _a.defaultAnswerVersionLabel, _b = _a.guide, selectedPerspective = _b.perspective, guidePerspectives = _b.perspectives, _c = _a.availablePerspectives, availablePerspectives = _c === void 0 ? [] : _c;
|
|
22
|
+
var _d = useRouteData(), name = _d.name, params = _d.params;
|
|
23
|
+
var perspectives = useMemo(function () {
|
|
24
|
+
if (!guidePerspectives || !availablePerspectives.length) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
return availablePerspectives
|
|
28
|
+
.filter(function (_a) {
|
|
29
|
+
var name = _a.name;
|
|
30
|
+
return !!guidePerspectives[name];
|
|
31
|
+
})
|
|
32
|
+
.map(function (_a) {
|
|
33
|
+
var name = _a.name, title = _a.title;
|
|
34
|
+
return { label: title, connection: guidePerspectives[name] };
|
|
35
|
+
});
|
|
36
|
+
}, [guidePerspectives, availablePerspectives]);
|
|
37
|
+
return (React.createElement(StyledList, { className: appendClassNames(className, 'humany-guide-answer-version-picker'), items: perspectives, renderItem: function (perspective) {
|
|
38
|
+
var label = perspective.label === 'Default' ? defaultAnswerVersionLabel : perspective.label;
|
|
39
|
+
var selected = selectedPerspective === perspective.connection;
|
|
40
|
+
var isRoot = selected && (!params.connection || selectedPerspective === params.connection);
|
|
41
|
+
return (React.createElement("li", { key: perspective.connection, "data-version": perspective.connection },
|
|
42
|
+
React.createElement(VersionLink, { key: perspective.connection, forwardedAs: isRoot ? 'span' : undefined, text: label, routeName: name, selected: selected, "aria-label": label, title: label, params: __assign(__assign({}, params), { connection: perspective.connection }) })));
|
|
43
|
+
} }));
|
|
44
|
+
};
|
|
45
|
+
export default AnswerVersionPicker;
|
|
46
|
+
var StyledList = styled(List)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n\n list-style: none;\n padding: 0;\n margin: 0;\n\n li:not(:last-child) {\n margin: 0 calc(", " * 2) 0 0;\n }\n\n li > span {\n cursor: default;\n }\n"], ["\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n\n list-style: none;\n padding: 0;\n margin: 0;\n\n li:not(:last-child) {\n margin: 0 calc(", " * 2) 0 0;\n }\n\n li > span {\n cursor: default;\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small; });
|
|
47
|
+
var VersionLink = styled(TextLink)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-weight: 300;\n color: ", ";\n text-decoration: none;\n\n ", "\n\n &:focus {\n ", ";\n }\n"], ["\n font-weight: 300;\n color: ", ";\n text-decoration: none;\n\n ", "\n\n &:focus {\n ", ";\n }\n"])), function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.text; }, function (p) {
|
|
48
|
+
return p.selected && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-weight: bold;\n text-decoration: underline;\n "], ["\n font-weight: bold;\n text-decoration: underline;\n "])));
|
|
49
|
+
}, function (p) { var _a; return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && paddedBorderTabStyle; });
|
|
50
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
6
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
7
|
+
if (!m) return o;
|
|
8
|
+
var i = m.call(o), r, ar = [], e;
|
|
9
|
+
try {
|
|
10
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
11
|
+
}
|
|
12
|
+
catch (error) { e = { error: error }; }
|
|
13
|
+
finally {
|
|
14
|
+
try {
|
|
15
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
16
|
+
}
|
|
17
|
+
finally { if (e) throw e.error; }
|
|
18
|
+
}
|
|
19
|
+
return ar;
|
|
20
|
+
};
|
|
21
|
+
import { PickerTypes } from '@telia-ace/knowledge-widget-core';
|
|
22
|
+
import { StyledListButton, SymbolBadge, Text, Tooltip, useContainer, } from '@telia-ace/knowledge-widget-ui';
|
|
23
|
+
import { buildCategoryTrail } from '@telia-ace/widget-utilities';
|
|
24
|
+
import React, { useEffect, useState } from 'react';
|
|
25
|
+
import styled from 'styled-components';
|
|
26
|
+
var Categories = function (_a) {
|
|
27
|
+
var _b = _a.guide.categories, categories = _b === void 0 ? [] : _b, _c = _a.toolbar.picker, picker = _c === void 0 ? PickerTypes.NONE : _c;
|
|
28
|
+
var _d = __read(useState([]), 2), trail = _d[0], setTrail = _d[1];
|
|
29
|
+
var container = useContainer();
|
|
30
|
+
useEffect(function () {
|
|
31
|
+
buildCategoryTrail('index', categories.map(function (id) { return id.toString(); }), container).then(function (result) {
|
|
32
|
+
setTrail(result);
|
|
33
|
+
});
|
|
34
|
+
}, [categories]);
|
|
35
|
+
if (!trail.length) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return (React.createElement(Tooltip, { className: "humany-guide-category-tooltip", sticky: picker === PickerTypes.DRAWER, content: React.createElement(React.Fragment, null, trail.map(function (segments) {
|
|
39
|
+
return (React.createElement(CategoryTrail, { className: "humany-guide-category-trail", key: segments.map(function (c) { return c.id; }).join('.') }, segments.map(function (category, index) {
|
|
40
|
+
return (React.createElement(Text, { className: "humany-guide-category-trail-segment", key: category.id },
|
|
41
|
+
category.symbol && index === 0 && (React.createElement(SymbolBadge, { size: 14, symbol: category.symbol })),
|
|
42
|
+
category.title,
|
|
43
|
+
index !== segments.length - 1 && (React.createElement(CategorySeparator, { className: "humany-category-separator" }, "/"))));
|
|
44
|
+
})));
|
|
45
|
+
})) }, picker === PickerTypes.DRAWER ? (React.createElement(StyledListButton, { className: "humany-guide-category-tooltip-button", "data-has-label": "false", "data-has-symbol": "true" },
|
|
46
|
+
React.createElement(CategoriesSymbolBadge, { size: 19, symbol: { type: 'Svg', content: 'information' } }))) : (React.createElement(CategoriesSymbolBadge, { size: 19, symbol: { type: 'Svg', content: 'information' } }))));
|
|
47
|
+
};
|
|
48
|
+
export default Categories;
|
|
49
|
+
var CategoryTrail = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n i,\n svg {\n margin: 0 ", " 0 0;\n }\n\n &:not(:last-child) {\n margin: 0 0 ", ";\n }\n"], ["\n i,\n svg {\n margin: 0 ", " 0 0;\n }\n\n &:not(:last-child) {\n margin: 0 0 ", ";\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small; });
|
|
50
|
+
var CategorySeparator = styled(Text)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin: 0 ", ";\n"], ["\n margin: 0 ", ";\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small; });
|
|
51
|
+
var CategoriesSymbolBadge = styled(SymbolBadge)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: block;\n"], ["\n display: block;\n"])));
|
|
52
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -0,0 +1,29 @@
|
|
|
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 { ContactList } from '@telia-ace/knowledge-widget-adapters';
|
|
6
|
+
import { Feedback as FeedbackUi, StyledHeaderText, useDispatch, useProperties, } from '@telia-ace/knowledge-widget-ui';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import styled from 'styled-components';
|
|
9
|
+
var StyledContactList = styled(ContactList)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border-top: ", ";\n ", "\n"], ["\n border-top: ", ";\n ", "\n"])), function (p) { return p.theme.border; }, function (p) { return p.backButtonShown === 'true' && "border-bottom: ".concat(p.theme.border, ";"); });
|
|
10
|
+
var StyledFeedback = styled(FeedbackUi)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (p) { var _a, _b; return "padding: ".concat((_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.large, " ").concat((_b = p.theme.sizes) === null || _b === void 0 ? void 0 : _b.large, ";"); });
|
|
11
|
+
var Recognition = styled(StyledHeaderText)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n\n display: block;\n font-size: ", ";\n font-weight: bold;\n"], ["\n ", "\n\n display: block;\n font-size: ", ";\n font-weight: bold;\n"])), function (p) { var _a, _b; return "padding: ".concat((_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.large, " ").concat((_b = p.theme.sizes) === null || _b === void 0 ? void 0 : _b.large, ";"); }, function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.normal; });
|
|
12
|
+
var Feedback = function (_a) {
|
|
13
|
+
var _b = _a.backButtonShown, backButtonShown = _b === void 0 ? false : _b, _c = _a.accordion, accordion = _c === void 0 ? false : _c;
|
|
14
|
+
var dispatch = useDispatch();
|
|
15
|
+
var _d = useProperties(), _e = _d.loading, loading = _e === void 0 ? false : _e, _f = _d.dialog, dialog = _f === void 0 ? [] : _f, guide = _d.guide, _g = _d.handoverContactMethods, handoverContactMethods = _g === void 0 ? [] : _g, contactHeader = _d.contactHeader, showFeedback = _d.showFeedback, _h = _d.feedbackDirection, feedbackDirection = _h === void 0 ? 'horizontal' : _h, feedbackRecognitionLabel = _d.feedbackRecognitionLabel, feedbackGiven = _d.feedbackGiven, feedbackHeader = _d.feedbackHeader, positiveFeedbackLabel = _d.positiveFeedbackLabel, negativeFeedbackLabel = _d.negativeFeedbackLabel, contactFeedbackLabel = _d.contactFeedbackLabel;
|
|
16
|
+
if (!showFeedback ||
|
|
17
|
+
!guide ||
|
|
18
|
+
!guide.allowFeedback ||
|
|
19
|
+
(loading && !feedbackGiven) ||
|
|
20
|
+
dialog.length) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
if (feedbackGiven && feedbackRecognitionLabel && !handoverContactMethods.length) {
|
|
24
|
+
return (React.createElement(Recognition, { accordion: accordion ? 'true' : 'false' }, feedbackRecognitionLabel));
|
|
25
|
+
}
|
|
26
|
+
return guide.hasHandover && handoverContactMethods.length ? (React.createElement(StyledContactList, { backButtonShown: backButtonShown ? 'true' : 'false', accordion: accordion ? 'true' : 'false', header: contactHeader, contactMethods: handoverContactMethods, dispatch: dispatch })) : (React.createElement(StyledFeedback, { accordion: accordion ? 'true' : 'false', positive: positiveFeedbackLabel, negative: guide.hasHandover ? contactFeedbackLabel : negativeFeedbackLabel, header: feedbackHeader, selected: feedbackGiven, onFeedback: function (feedback) { return dispatch('feedback', feedback); }, direction: feedbackDirection }));
|
|
27
|
+
};
|
|
28
|
+
export default Feedback;
|
|
29
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PickerTypes } from '@telia-ace/knowledge-widget-core';
|
|
2
|
+
import { DispatchAction } from '@telia-ace/knowledge-widget-ui';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { GuideProps } from './guide-component';
|
|
5
|
+
export declare type FunctionListItem = {
|
|
6
|
+
type: string;
|
|
7
|
+
child: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
declare type Props = {
|
|
10
|
+
header?: string;
|
|
11
|
+
tooltip?: string;
|
|
12
|
+
printActionLabel?: string;
|
|
13
|
+
copyActionLabel?: string;
|
|
14
|
+
addFavoriteTooltip?: string;
|
|
15
|
+
removeFavoriteCancelLabel?: string;
|
|
16
|
+
removeFavoriteConfirmLabel?: string;
|
|
17
|
+
removeFavoriteHeader?: string;
|
|
18
|
+
removeFavoriteLabel?: string;
|
|
19
|
+
removeFavoriteTooltip?: string;
|
|
20
|
+
toolbarFunctionsCloseButtonAriaLabel?: string;
|
|
21
|
+
guide: GuideProps;
|
|
22
|
+
allowCopy?: boolean;
|
|
23
|
+
allowPrint?: boolean;
|
|
24
|
+
showFavoriteToggle?: boolean;
|
|
25
|
+
picker?: PickerTypes;
|
|
26
|
+
dispatch: DispatchAction;
|
|
27
|
+
};
|
|
28
|
+
declare const Functions: React.FC<Props>;
|
|
29
|
+
export default Functions;
|
|
@@ -0,0 +1,101 @@
|
|
|
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
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
6
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
7
|
+
if (!m) return o;
|
|
8
|
+
var i = m.call(o), r, ar = [], e;
|
|
9
|
+
try {
|
|
10
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
11
|
+
}
|
|
12
|
+
catch (error) { e = { error: error }; }
|
|
13
|
+
finally {
|
|
14
|
+
try {
|
|
15
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
16
|
+
}
|
|
17
|
+
finally { if (e) throw e.error; }
|
|
18
|
+
}
|
|
19
|
+
return ar;
|
|
20
|
+
};
|
|
21
|
+
import { PickerTypes } from '@telia-ace/knowledge-widget-core';
|
|
22
|
+
import { DrawerAnimationType, DrawerList, DropdownList, FavoriteButton, StyledListButton, StyledText, SymbolBadge, useFavorites, } from '@telia-ace/knowledge-widget-ui';
|
|
23
|
+
import React, { useCallback, useMemo } from 'react';
|
|
24
|
+
import styled from 'styled-components';
|
|
25
|
+
var Functions = function (_a) {
|
|
26
|
+
var header = _a.header, tooltip = _a.tooltip, printActionLabel = _a.printActionLabel, copyActionLabel = _a.copyActionLabel, addFavoriteTooltip = _a.addFavoriteTooltip, removeFavoriteCancelLabel = _a.removeFavoriteCancelLabel, removeFavoriteConfirmLabel = _a.removeFavoriteConfirmLabel, removeFavoriteHeader = _a.removeFavoriteHeader, removeFavoriteLabel = _a.removeFavoriteLabel, removeFavoriteTooltip = _a.removeFavoriteTooltip, toolbarFunctionsCloseButtonAriaLabel = _a.toolbarFunctionsCloseButtonAriaLabel, _b = _a.allowCopy, allowCopy = _b === void 0 ? false : _b, _c = _a.allowPrint, allowPrint = _c === void 0 ? false : _c, _d = _a.showFavoriteToggle, showFavoriteToggle = _d === void 0 ? false : _d, _e = _a.picker, picker = _e === void 0 ? PickerTypes.NONE : _e, guide = _a.guide, dispatch = _a.dispatch;
|
|
27
|
+
var _f = __read(useFavorites(), 2), favorites = _f[0], actions = _f[1];
|
|
28
|
+
var handleCopy = useCallback(function (event) {
|
|
29
|
+
if (guide) {
|
|
30
|
+
dispatch('copy', guide);
|
|
31
|
+
}
|
|
32
|
+
}, [guide, dispatch]);
|
|
33
|
+
var handlePrint = useCallback(function () {
|
|
34
|
+
if (guide) {
|
|
35
|
+
dispatch('print');
|
|
36
|
+
}
|
|
37
|
+
}, [guide, dispatch]);
|
|
38
|
+
var items = useMemo(function () {
|
|
39
|
+
var id = guide.id, title = guide.title;
|
|
40
|
+
var items = [];
|
|
41
|
+
if (allowCopy) {
|
|
42
|
+
items.push({
|
|
43
|
+
type: 'copy',
|
|
44
|
+
child: (React.createElement(StyledListButton, { "data-has-label": copyActionLabel ? 'true' : 'false', "data-has-symbol": "true", title: copyActionLabel, "aria-label": printActionLabel, onClick: handleCopy },
|
|
45
|
+
React.createElement(ColoredSymbolBadge, { size: 16, symbol: { type: 'Svg', content: 'copy' } }),
|
|
46
|
+
copyActionLabel && React.createElement(StyledText, null, copyActionLabel))),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (allowPrint) {
|
|
50
|
+
items.push({
|
|
51
|
+
type: 'print',
|
|
52
|
+
child: (React.createElement(StyledListButton, { "data-has-label": printActionLabel ? 'true' : 'false', "data-has-symbol": "true", title: printActionLabel, "aria-label": printActionLabel, onClick: handlePrint },
|
|
53
|
+
React.createElement(ColoredSymbolBadge, { size: 16, symbol: { type: 'Svg', content: 'print' } }),
|
|
54
|
+
printActionLabel && React.createElement(StyledText, null, printActionLabel))),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (showFavoriteToggle) {
|
|
58
|
+
var isFavorite = favorites.indexOf(id) > -1;
|
|
59
|
+
items.push({
|
|
60
|
+
type: 'favorite',
|
|
61
|
+
child: (React.createElement(FavoriteButton, { id: id, guideTitle: title, isFavorite: isFavorite, buttonLabel: isFavorite ? removeFavoriteTooltip : addFavoriteTooltip, addFavoriteTooltip: addFavoriteTooltip, removeFavoriteCancelLabel: removeFavoriteCancelLabel, removeFavoriteConfirmLabel: removeFavoriteConfirmLabel, removeFavoriteHeader: removeFavoriteHeader, removeFavoriteLabel: removeFavoriteLabel, removeFavoriteTooltip: removeFavoriteTooltip, actions: actions })),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return items;
|
|
65
|
+
}, [
|
|
66
|
+
favorites,
|
|
67
|
+
guide,
|
|
68
|
+
allowCopy,
|
|
69
|
+
allowPrint,
|
|
70
|
+
showFavoriteToggle,
|
|
71
|
+
printActionLabel,
|
|
72
|
+
copyActionLabel,
|
|
73
|
+
addFavoriteTooltip,
|
|
74
|
+
removeFavoriteCancelLabel,
|
|
75
|
+
removeFavoriteConfirmLabel,
|
|
76
|
+
removeFavoriteHeader,
|
|
77
|
+
removeFavoriteLabel,
|
|
78
|
+
removeFavoriteTooltip,
|
|
79
|
+
]);
|
|
80
|
+
if (!items.length) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
var trigger = (React.createElement(StyledTriggerButton, { tabIndex: 0, title: tooltip, "data-has-symbol": "true", "data-has-label": "false" },
|
|
84
|
+
React.createElement(ColoredSymbolBadge, { symbol: { type: 'Svg', content: 'options' }, size: 18 })));
|
|
85
|
+
var renderListItem = function (_a) {
|
|
86
|
+
var type = _a.type, child = _a.child;
|
|
87
|
+
return (React.createElement("li", { key: type, "data-function-type": type }, child));
|
|
88
|
+
};
|
|
89
|
+
if (picker === PickerTypes.DROPDOWN) {
|
|
90
|
+
return (React.createElement(StyledDropdownList, { className: "humany-guide-functions-dropdown-list", header: header, items: items, trigger: trigger, renderItem: renderListItem, closeButtonAriaLabel: toolbarFunctionsCloseButtonAriaLabel }));
|
|
91
|
+
}
|
|
92
|
+
if (picker === PickerTypes.DRAWER) {
|
|
93
|
+
return (React.createElement(DrawerList, { className: "humany-guide-functions-drawer-list", animation: { type: DrawerAnimationType.SlideInBottom }, header: header, items: items, trigger: trigger, renderItem: renderListItem, closeButtonAriaLabel: toolbarFunctionsCloseButtonAriaLabel }));
|
|
94
|
+
}
|
|
95
|
+
return null;
|
|
96
|
+
};
|
|
97
|
+
export default Functions;
|
|
98
|
+
var ColoredSymbolBadge = styled(SymbolBadge)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n circle {\n fill: ", ";\n }\n\n line,\n path,\n rect {\n stroke: ", ";\n }\n"], ["\n circle {\n fill: ", ";\n }\n\n line,\n path,\n rect {\n stroke: ", ";\n }\n"])), 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.text; });
|
|
99
|
+
var StyledDropdownList = styled(DropdownList)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: block;\n min-height: auto;\n"], ["\n display: block;\n min-height: auto;\n"])));
|
|
100
|
+
var StyledTriggerButton = styled(StyledListButton)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: calc(", " * 2) 0;\n"], ["\n padding: calc(", " * 2) 0;\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small; });
|
|
101
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ContactMethodType } from '@telia-ace/knowledge-widget-adapters';
|
|
2
|
+
import { FavoriteProperties, LanguageProperties, MetaDataProperties } from '@telia-ace/knowledge-widget-component-utilities';
|
|
3
|
+
import { DialogItem, PickerTypes } from '@telia-ace/knowledge-widget-core';
|
|
4
|
+
import { DataError } from '@telia-ace/knowledge-widget-types-grid';
|
|
5
|
+
import { FormComponentInstanceProperties } from '@telia-ace/widget-forms';
|
|
6
|
+
import { Container } from '@webprovisions/platform';
|
|
7
|
+
export declare type GuideProps = {
|
|
8
|
+
id: string;
|
|
9
|
+
title: string;
|
|
10
|
+
body: string;
|
|
11
|
+
connection: string;
|
|
12
|
+
categories: number[];
|
|
13
|
+
hasHandover: boolean;
|
|
14
|
+
allowFeedback: boolean;
|
|
15
|
+
perspectives: {
|
|
16
|
+
[key: string]: string;
|
|
17
|
+
};
|
|
18
|
+
translations?: {
|
|
19
|
+
[key: string]: string;
|
|
20
|
+
};
|
|
21
|
+
modified?: string;
|
|
22
|
+
published?: string;
|
|
23
|
+
publishedBy?: string | null;
|
|
24
|
+
modifiedBy?: string | null;
|
|
25
|
+
perspective: string | null;
|
|
26
|
+
};
|
|
27
|
+
export declare type AvailablePerspectives = {
|
|
28
|
+
name: string;
|
|
29
|
+
title: string;
|
|
30
|
+
};
|
|
31
|
+
export declare type GuideComponentProps = {
|
|
32
|
+
showHeader?: boolean;
|
|
33
|
+
showFeedback?: boolean;
|
|
34
|
+
feedbackDirection?: 'horizontal' | 'vertical';
|
|
35
|
+
feedbackGiven?: 'positive' | 'negative';
|
|
36
|
+
contactMethods?: ContactMethodType[];
|
|
37
|
+
handoverContactMethods?: ContactMethodType[];
|
|
38
|
+
showAnswerVersions?: boolean;
|
|
39
|
+
feedbackHeader?: string;
|
|
40
|
+
contactHeader?: string;
|
|
41
|
+
toolbarFunctionsHeader?: string;
|
|
42
|
+
toolbarLanguageHeader?: string;
|
|
43
|
+
positiveFeedbackLabel?: string;
|
|
44
|
+
negativeFeedbackLabel?: string;
|
|
45
|
+
contactFeedbackLabel?: string;
|
|
46
|
+
feedbackRecognitionLabel?: string;
|
|
47
|
+
defaultAnswerVersionLabel?: string;
|
|
48
|
+
backButtonLabel?: string;
|
|
49
|
+
toolbarFunctionsTooltip?: string;
|
|
50
|
+
toolbarFunctionsCloseButtonAriaLabel?: string;
|
|
51
|
+
copyActionLabel?: string;
|
|
52
|
+
printActionLabel?: string;
|
|
53
|
+
toolbarLanguageTooltip?: string;
|
|
54
|
+
toolbar?: ToolbarProps;
|
|
55
|
+
guide?: GuideProps;
|
|
56
|
+
dialog?: DialogItem[];
|
|
57
|
+
error?: DataError;
|
|
58
|
+
availablePerspectives?: AvailablePerspectives[];
|
|
59
|
+
} & FormComponentInstanceProperties & FavoriteProperties & MetaDataProperties & LanguageProperties;
|
|
60
|
+
export declare type ToolbarProps = {
|
|
61
|
+
language?: boolean;
|
|
62
|
+
guideCategories?: boolean;
|
|
63
|
+
allowCopy?: boolean;
|
|
64
|
+
allowPrint?: boolean;
|
|
65
|
+
showFavoriteToggle?: boolean;
|
|
66
|
+
picker?: PickerTypes;
|
|
67
|
+
};
|
|
68
|
+
export declare const GuideComponent: (container: Container) => Promise<void>;
|
|
69
|
+
export default GuideComponent;
|
|
@@ -0,0 +1,166 @@
|
|
|
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 __read = (this && this.__read) || function (o, n) {
|
|
13
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
+
if (!m) return o;
|
|
15
|
+
var i = m.call(o), r, ar = [], e;
|
|
16
|
+
try {
|
|
17
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
+
}
|
|
19
|
+
catch (error) { e = { error: error }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e) throw e.error; }
|
|
25
|
+
}
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
import { updateForm, useExpand, useForm, } from '@telia-ace/knowledge-widget-component-utilities';
|
|
29
|
+
import { createEventSubscriber, extendComponent, } from '@telia-ace/knowledge-widget-core';
|
|
30
|
+
import { DataType, } from '@telia-ace/knowledge-widget-types-grid';
|
|
31
|
+
import { createReactComponent } from '@telia-ace/knowledge-widget-ui';
|
|
32
|
+
import * as clipboard from 'clipboard-polyfill';
|
|
33
|
+
import useFeedback from './use-feedback';
|
|
34
|
+
var buildPlainText = function (_a) {
|
|
35
|
+
var title = _a.title, body = _a.body;
|
|
36
|
+
var processedHtml = '';
|
|
37
|
+
if (title && title.length) {
|
|
38
|
+
processedHtml = title.trim();
|
|
39
|
+
}
|
|
40
|
+
if (body && body.length) {
|
|
41
|
+
processedHtml = "".concat(processedHtml.trim(), "\n").concat(body.trim());
|
|
42
|
+
}
|
|
43
|
+
var div = document.createElement('div');
|
|
44
|
+
div.innerHTML = processedHtml;
|
|
45
|
+
var links = Array.from(div.getElementsByTagName('a'));
|
|
46
|
+
var plainText = div.innerText;
|
|
47
|
+
links.forEach(function (a) {
|
|
48
|
+
plainText = plainText.replace(a.innerText, "[".concat(a.href, "] (").concat(a.innerText, ")"));
|
|
49
|
+
});
|
|
50
|
+
return plainText;
|
|
51
|
+
};
|
|
52
|
+
var buildHtml = function (_a) {
|
|
53
|
+
var title = _a.title, body = _a.body;
|
|
54
|
+
var processedHtml = '';
|
|
55
|
+
if (title && title.length) {
|
|
56
|
+
processedHtml = "<h2>".concat(title.trim(), "</h2>");
|
|
57
|
+
}
|
|
58
|
+
if (body && body.length) {
|
|
59
|
+
processedHtml = "".concat(processedHtml.trim()).concat(body.trim());
|
|
60
|
+
}
|
|
61
|
+
return processedHtml.trim();
|
|
62
|
+
};
|
|
63
|
+
export var GuideComponent = function (container) {
|
|
64
|
+
var events = container.get('$widget').events;
|
|
65
|
+
var _a = __read(createEventSubscriber(events), 2), subscribe = _a[0], unsubscribe = _a[1];
|
|
66
|
+
return createReactComponent(container, 'guide', import('./guide'), function (component) {
|
|
67
|
+
var fetch = function (params) {
|
|
68
|
+
component.writeProperties({
|
|
69
|
+
loading: true,
|
|
70
|
+
error: undefined,
|
|
71
|
+
guide: undefined,
|
|
72
|
+
});
|
|
73
|
+
component.actions.dispatch('fetch', { params: params });
|
|
74
|
+
};
|
|
75
|
+
component.actions.create('copy', function (guide) {
|
|
76
|
+
var item = new clipboard.ClipboardItem({
|
|
77
|
+
'text/html': new Blob([buildHtml(guide)], { type: 'text/html' }),
|
|
78
|
+
'text/plain': new Blob([buildPlainText(guide)], { type: 'text/plain' }),
|
|
79
|
+
});
|
|
80
|
+
return clipboard.write([item]).then(function () {
|
|
81
|
+
events.dispatch('widget:menu-toggled', null);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
component.actions.create('print', function () {
|
|
85
|
+
var elem = document.querySelector('.humany-guide .humany-paragraph');
|
|
86
|
+
var a = window.open('', '', 'height=500, width=500');
|
|
87
|
+
events.dispatch('widget:menu-toggled', null);
|
|
88
|
+
if (elem && a) {
|
|
89
|
+
a.document.write("<html><body>".concat(elem.innerHTML, "</body></html>"));
|
|
90
|
+
a.document.close();
|
|
91
|
+
a.print();
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
component.actions.create('back', function (data, options) {
|
|
95
|
+
if (options.preventDefault) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
return container.getAsync('router').then(function (router) {
|
|
99
|
+
router.goBack();
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
component.actions.create('fetch', function (_a) {
|
|
103
|
+
var _b = _a.contactMethods, contactMethods = _b === void 0 ? [] : _b, _c = _a.dialog, dialog = _c === void 0 ? [] : _c, guide = _a.guide, error = _a.error;
|
|
104
|
+
if (error) {
|
|
105
|
+
return component.actions.dispatch('fetched', {
|
|
106
|
+
error: error,
|
|
107
|
+
guide: undefined,
|
|
108
|
+
contactMethods: [],
|
|
109
|
+
feedbackGiven: undefined,
|
|
110
|
+
handoverContactMethods: [],
|
|
111
|
+
showFeedback: false,
|
|
112
|
+
loading: true,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
var _d = component.properties(), _e = _d.showFeedback, showFeedback = _e === void 0 ? true : _e, _f = _d.submitButtonLabel, submitButtonLabel = _f === void 0 ? 'Submit' : _f;
|
|
116
|
+
var properties = {
|
|
117
|
+
showFeedback: showFeedback,
|
|
118
|
+
dialog: dialog,
|
|
119
|
+
guide: guide,
|
|
120
|
+
feedbackGiven: undefined,
|
|
121
|
+
handoverContactMethods: [],
|
|
122
|
+
contactMethods: contactMethods.map(function (cm) { return (__assign(__assign({}, cm), { body: updateForm(cm, { submit: submitButtonLabel }) })); }),
|
|
123
|
+
};
|
|
124
|
+
return component.actions.dispatch('fetched', __assign(__assign({}, properties), { loading: true }));
|
|
125
|
+
});
|
|
126
|
+
component.actions.create('fetched', function (input) {
|
|
127
|
+
return component.writeProperties(__assign(__assign({}, input), { loading: false }));
|
|
128
|
+
});
|
|
129
|
+
container.getAsync('router').then(function (router) {
|
|
130
|
+
var params = router.getRouteData().params;
|
|
131
|
+
fetch(params);
|
|
132
|
+
});
|
|
133
|
+
subscribe('router:changed', function (event, _a) {
|
|
134
|
+
var current = _a.current;
|
|
135
|
+
fetch(current.routeData.params);
|
|
136
|
+
});
|
|
137
|
+
useFeedback(container, component);
|
|
138
|
+
useForm(container, component);
|
|
139
|
+
useExpand(component);
|
|
140
|
+
})
|
|
141
|
+
.then(function () {
|
|
142
|
+
return extendComponent(container, 'guide', function (component) {
|
|
143
|
+
component.actions.watch('guide.fetch', function (input, next) {
|
|
144
|
+
var _a = input.params, guide = _a.guide, connection = _a.connection;
|
|
145
|
+
if (guide) {
|
|
146
|
+
return container
|
|
147
|
+
.getAsync('dataClient')
|
|
148
|
+
.then(function (dataClient) {
|
|
149
|
+
return dataClient.fetch(DataType.Guide, { connection: connection, guideId: guide });
|
|
150
|
+
})
|
|
151
|
+
.then(next)
|
|
152
|
+
.catch(function (error) {
|
|
153
|
+
if (error) {
|
|
154
|
+
return next(error);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return next(input);
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
})
|
|
162
|
+
.then(function () {
|
|
163
|
+
unsubscribe();
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
export default GuideComponent;
|
package/lib-esm/guide.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
var __assign = (this && this.__assign) || function () {
|
|
6
|
+
__assign = Object.assign || function(t) {
|
|
7
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
+
s = arguments[i];
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
+
t[p] = s[p];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
17
|
+
var t = {};
|
|
18
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
19
|
+
t[p] = s[p];
|
|
20
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
21
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
22
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
23
|
+
t[p[i]] = s[p[i]];
|
|
24
|
+
}
|
|
25
|
+
return t;
|
|
26
|
+
};
|
|
27
|
+
import { contactLink, ContactList } from '@telia-ace/knowledge-widget-adapters';
|
|
28
|
+
import { Component, NotFound } from '@telia-ace/knowledge-widget-types-grid';
|
|
29
|
+
import { Button, contentBox, createEmptyComponent, DialogList, genericHtml, guideRenderInstructions, headingElement, linkTabStyle, Loader, loadingOpacity, Metadata, Paragraph, useChildren, useContainer, useDispatch, useProperties, useRouteData, } from '@telia-ace/knowledge-widget-ui';
|
|
30
|
+
import { appendClassNames } from '@telia-ace/widget-utilities';
|
|
31
|
+
import React, { forwardRef, useCallback } from 'react';
|
|
32
|
+
import styled, { css } from 'styled-components';
|
|
33
|
+
import AnswerVersionPicker from './answer-version-picker';
|
|
34
|
+
import Feedback from './feedback';
|
|
35
|
+
import Toolbar from './toolbar';
|
|
36
|
+
var Guide = forwardRef(function (_a, ref) {
|
|
37
|
+
var className = _a.className, _b = _a.accordion, accordion = _b === void 0 ? false : _b, other = __rest(_a, ["className", "accordion"]);
|
|
38
|
+
var _c = useProperties(), _d = _c.loading, loading = _d === void 0 ? false : _d, _e = _c.dialog, dialog = _e === void 0 ? [] : _e, _f = _c.contactMethods, contactMethods = _f === void 0 ? [] : _f, _g = _c.showHeader, showHeader = _g === void 0 ? true : _g, _h = _c.showAnswerVersions, showAnswerVersions = _h === void 0 ? false : _h, _j = _c.defaultAnswerVersionLabel, defaultAnswerVersionLabel = _j === void 0 ? 'Default' : _j, backButtonLabel = _c.backButtonLabel, metadataByLabel = _c.metadataByLabel, metadataModifiedLabel = _c.metadataModifiedLabel, metadataPublishedLabel = _c.metadataPublishedLabel, availablePerspectives = _c.availablePerspectives, metadata = _c.metadata, toolbar = _c.toolbar, guide = _c.guide, error = _c.error;
|
|
39
|
+
var connection = useRouteData().params.connection;
|
|
40
|
+
var container = useContainer();
|
|
41
|
+
var children = useChildren();
|
|
42
|
+
var dispatch = useDispatch();
|
|
43
|
+
var handleBackButtonClick = useCallback(function () {
|
|
44
|
+
dispatch('back');
|
|
45
|
+
}, [dispatch]);
|
|
46
|
+
if (!guide && !error && !loading) {
|
|
47
|
+
return createEmptyComponent(container, __assign(__assign({}, other), { className: appendClassNames(className, 'humany-guide') }));
|
|
48
|
+
}
|
|
49
|
+
var _k = guide || {}, _l = _k.id, id = _l === void 0 ? '' : _l, _m = _k.title, title = _m === void 0 ? '' : _m, _o = _k.body, body = _o === void 0 ? '' : _o, _p = _k.translations, translations = _p === void 0 ? {} : _p;
|
|
50
|
+
if (error && error.status === 404) {
|
|
51
|
+
return React.createElement(NotFound, { showSearch: false });
|
|
52
|
+
}
|
|
53
|
+
var showBackButton = !!accordion && !!connection;
|
|
54
|
+
var language = Object.keys(translations).find(function (key) { return translations[key] === "".concat(id); });
|
|
55
|
+
return (React.createElement(Wrapper, __assign({ ref: ref }, other, { "data-loading": loading, className: appendClassNames(className, 'humany-guide') }),
|
|
56
|
+
React.createElement(Content, { "data-loading": loading, accordion: accordion ? 'true' : 'false', className: "humany-guide-content" },
|
|
57
|
+
((showAnswerVersions && guide) || !!toolbar) && (React.createElement(Top, { className: "humany-guide-top" },
|
|
58
|
+
showAnswerVersions && guide && (React.createElement(AnswerVersionPicker, { defaultAnswerVersionLabel: defaultAnswerVersionLabel, availablePerspectives: availablePerspectives, guide: guide })),
|
|
59
|
+
!!toolbar && React.createElement(Toolbar, { dispatch: dispatch }))),
|
|
60
|
+
!!(title || body) && (React.createElement(Body, { className: "humany-guide-body", accordion: accordion ? 'true' : 'false', header: (showHeader && title) || undefined, html: body, htmlParseInstruction: guideRenderInstructions(container, dialog), lang: language })),
|
|
61
|
+
dialog && body.indexOf('h-option-link') === -1 && (React.createElement(StyledDialogList, { dialog: dialog })),
|
|
62
|
+
React.createElement(StyledContactList, { backButtonShown: showBackButton ? 'true' : 'false', contactMethods: contactMethods, dispatch: dispatch, guideId: guide && guide.id }),
|
|
63
|
+
!contactMethods.length && (React.createElement(Feedback, { backButtonShown: showBackButton, accordion: accordion })),
|
|
64
|
+
showBackButton && (React.createElement(BackButton, { "aria-label": backButtonLabel, onClick: handleBackButtonClick },
|
|
65
|
+
React.createElement(Caret, { width: "7", height: "13", viewBox: "0 0 7 13", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
66
|
+
React.createElement("line", { x1: "6.64645", y1: "12.5513", x2: "0.648357", y2: "6.55319" }),
|
|
67
|
+
React.createElement("line", { x1: "0.646447", y1: "6.64455", x2: "6.64454", y2: "0.646465" })),
|
|
68
|
+
backButtonLabel && React.createElement("span", null, backButtonLabel))),
|
|
69
|
+
metadata && (React.createElement(StyledMetadata, __assign({}, metadata, { modified: guide === null || guide === void 0 ? void 0 : guide.modified, published: guide === null || guide === void 0 ? void 0 : guide.published, modifiedBy: guide === null || guide === void 0 ? void 0 : guide.modifiedBy, publishedBy: guide === null || guide === void 0 ? void 0 : guide.publishedBy, byLabel: metadataByLabel, modifiedLabel: metadataModifiedLabel, publishedLabel: metadataPublishedLabel }))),
|
|
70
|
+
children.map(function (child) { return (React.createElement(StyledComponents, __assign({ key: child.id, id: child.id, branch: "default" }, { embedded: true }))); })),
|
|
71
|
+
React.createElement(Loader, { loading: loading })));
|
|
72
|
+
});
|
|
73
|
+
export default Guide;
|
|
74
|
+
var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n min-width: 0;\n"], ["\n ", "\n min-width: 0;\n"])), loadingOpacity);
|
|
75
|
+
var Body = styled(Paragraph)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n ", "\n display: block;\n line-height: 1.6em;\n ", "\n\n p {\n font-weight: 300;\n font-size: ", ";\n color: ", ";\n a {\n display: inline;\n }\n }\n"], ["\n ", "\n ", "\n display: block;\n line-height: 1.6em;\n ", "\n\n p {\n font-weight: 300;\n font-size: ", ";\n color: ", ";\n a {\n display: inline;\n }\n }\n"])), genericHtml, function (p) { var _a; return "padding: ".concat((_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.large, ";"); }, headingElement('h1', css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-size: ", ";\n font-weight: normal;\n line-height: 1.6em;\n line-height: 1.6em;\n margin: 0 0 ", ";\n "], ["\n font-size: ", ";\n font-weight: normal;\n line-height: 1.6em;\n line-height: 1.6em;\n margin: 0 0 ", ";\n "])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.large; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small; })), 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; });
|
|
76
|
+
var StyledContactList = styled(ContactList)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n border-top: ", ";\n ", "\n"], ["\n border-top: ", ";\n ", "\n"])), function (p) { return p.theme.border; }, function (p) { return p.backButtonShown === 'true' && "border-bottom: ".concat(p.theme.border, ";"); });
|
|
77
|
+
var StyledDialogList = styled(DialogList)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", "\n display: block;\n"], ["\n ", "\n display: block;\n"])), function (p) { var _a, _b; return "padding: 0 ".concat((_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.large, " ").concat((_b = p.theme.sizes) === null || _b === void 0 ? void 0 : _b.large, ";"); });
|
|
78
|
+
var Top = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-bottom: ", ";\n border-radius: ", " 0 0;\n background-color: #ffffff;\n"], ["\n ", "\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-bottom: ", ";\n border-radius: ", " 0 0;\n background-color: #ffffff;\n"])), function (p) { var _a, _b; return "padding: calc(".concat((_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal, "*2) ").concat((_b = p.theme.sizes) === null || _b === void 0 ? void 0 : _b.large, ";"); }, function (p) { return p.theme.border; }, function (p) { return "".concat(p.theme.borderRadius, " ").concat(p.theme.borderRadius); });
|
|
79
|
+
var Content = styled.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n ", "\n display: block;\n > a {\n ", "\n }\n\n ", "\n"], ["\n ", "\n display: block;\n > a {\n ", "\n }\n\n ", "\n"])), contentBox, contactLink, function (p) {
|
|
80
|
+
return p.accordion === 'true' && css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n white-space: normal;\n box-shadow: none;\n background-color: #fafafa;\n "], ["\n white-space: normal;\n box-shadow: none;\n background-color: #fafafa;\n "])));
|
|
81
|
+
});
|
|
82
|
+
var StyledMetadata = styled(Metadata)(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n display: block;\n ", "\n font-weight: 300;\n font-size: ", ";\n color: ", ";\n border-top: ", ";\n"], ["\n display: block;\n ", "\n font-weight: 300;\n font-size: ", ";\n color: ", ";\n border-top: ", ";\n"])), function (p) { var _a, _b; return "padding: calc(".concat((_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal, "*2) ").concat((_b = p.theme.sizes) === null || _b === void 0 ? void 0 : _b.large, ";"); }, 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) { return p.theme.border; });
|
|
83
|
+
var StyledComponents = styled(Component)(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n border-top: ", ";\n"], ["\n border-top: ", ";\n"])), function (p) { return p.theme.border; });
|
|
84
|
+
var BackButton = styled(Button)(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n ", "\n color: ", ";\n text-decoration: underline;\n font-size: ", ";\n span {\n font-weight: 300;\n }\n &:focus {\n ", ";\n }\n"], ["\n ", "\n color: ", ";\n text-decoration: underline;\n font-size: ", ";\n span {\n font-weight: 300;\n }\n &:focus {\n ", ";\n }\n"])), function (p) { var _a, _b; return "padding: ".concat((_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal, " calc(").concat((_b = p.theme.sizes) === null || _b === void 0 ? void 0 : _b.normal, " * 2);"); }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.primary; }, function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) {
|
|
85
|
+
var _a;
|
|
86
|
+
return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n ", "\n padding: ", ";\n "], ["\n ", "\n padding: ", ";\n "])), linkTabStyle, function (p) { var _a, _b; return "calc(".concat((_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small, " / 2) ").concat((_b = p.theme.sizes) === null || _b === void 0 ? void 0 : _b.small); });
|
|
87
|
+
});
|
|
88
|
+
var Caret = styled.svg(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n margin-right: ", ";\n line {\n stroke: ", ";\n }\n"], ["\n margin-right: ", ";\n line {\n stroke: ", ";\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.primary; });
|
|
89
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13;
|