@telia-ace/widget-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +6 -0
- package/README.md +3 -0
- package/lib/components/anchor-link.d.ts +4 -0
- package/lib/components/anchor-link.js +7 -0
- package/lib/components/button.d.ts +4 -0
- package/lib/components/button.js +64 -0
- package/lib/components/checkbox.d.ts +7 -0
- package/lib/components/checkbox.js +39 -0
- package/lib/components/drawer/drawer.d.ts +21 -0
- package/lib/components/drawer/drawer.js +150 -0
- package/lib/components/drawer/index.d.ts +3 -0
- package/lib/components/drawer/index.js +29 -0
- package/lib/components/dropdown/dropdown.d.ts +9 -0
- package/lib/components/dropdown/dropdown.js +155 -0
- package/lib/components/dropdown/index.d.ts +4 -0
- package/lib/components/dropdown/index.js +10 -0
- package/lib/components/dropdown/use-position.d.ts +5 -0
- package/lib/components/dropdown/use-position.js +57 -0
- package/lib/components/empty.d.ts +4 -0
- package/lib/components/empty.js +40 -0
- package/lib/components/grid.d.ts +7 -0
- package/lib/components/grid.js +64 -0
- package/lib/components/html.d.ts +12 -0
- package/lib/components/html.js +78 -0
- package/lib/components/icon.d.ts +7 -0
- package/lib/components/icon.js +35 -0
- package/lib/components/index.d.ts +58 -0
- package/lib/components/index.js +69 -0
- package/lib/components/input.d.ts +10 -0
- package/lib/components/input.js +94 -0
- package/lib/components/item-list.d.ts +10 -0
- package/lib/components/item-list.js +62 -0
- package/lib/components/item-tree.d.ts +13 -0
- package/lib/components/item-tree.js +55 -0
- package/lib/components/lightbox.d.ts +6 -0
- package/lib/components/lightbox.js +92 -0
- package/lib/components/link.d.ts +11 -0
- package/lib/components/link.js +99 -0
- package/lib/components/list.d.ts +9 -0
- package/lib/components/list.js +56 -0
- package/lib/components/modal/confirm.d.ts +12 -0
- package/lib/components/modal/confirm.js +61 -0
- package/lib/components/modal/index.d.ts +4 -0
- package/lib/components/modal/index.js +10 -0
- package/lib/components/modal/modal.d.ts +10 -0
- package/lib/components/modal/modal.js +127 -0
- package/lib/components/not-found.d.ts +9 -0
- package/lib/components/not-found.js +55 -0
- package/lib/components/overlay.d.ts +8 -0
- package/lib/components/overlay.js +73 -0
- package/lib/components/paragraph.d.ts +11 -0
- package/lib/components/paragraph.js +66 -0
- package/lib/components/portal.d.ts +7 -0
- package/lib/components/portal.js +61 -0
- package/lib/components/route-link.d.ts +11 -0
- package/lib/components/route-link.js +115 -0
- package/lib/components/symbol-badge.d.ts +15 -0
- package/lib/components/symbol-badge.js +197 -0
- package/lib/components/tab-stop.d.ts +18 -0
- package/lib/components/tab-stop.js +100 -0
- package/lib/components/text-link.d.ts +8 -0
- package/lib/components/text-link.js +62 -0
- package/lib/components/text.d.ts +4 -0
- package/lib/components/text.js +35 -0
- package/lib/components/timestamp.d.ts +13 -0
- package/lib/components/timestamp.js +39 -0
- package/lib/components/tooltip.d.ts +8 -0
- package/lib/components/tooltip.js +127 -0
- package/lib/components/transition-component.d.ts +30 -0
- package/lib/components/transition-component.js +77 -0
- package/lib/components/typography.d.ts +9 -0
- package/lib/components/typography.js +43 -0
- package/lib/components/widget-link.d.ts +10 -0
- package/lib/components/widget-link.js +116 -0
- package/lib/contexts/index.d.ts +9 -0
- package/lib/contexts/index.js +15 -0
- package/lib/create-react-component.d.ts +11 -0
- package/lib/create-react-component.js +18 -0
- package/lib/hooks/index.d.ts +27 -0
- package/lib/hooks/index.js +58 -0
- package/lib/hooks/use-action.d.ts +4 -0
- package/lib/hooks/use-action.js +21 -0
- package/lib/hooks/use-children.d.ts +4 -0
- package/lib/hooks/use-children.js +70 -0
- package/lib/hooks/use-columns.d.ts +2 -0
- package/lib/hooks/use-columns.js +6 -0
- package/lib/hooks/use-component-descriptor.d.ts +2 -0
- package/lib/hooks/use-component-descriptor.js +6 -0
- package/lib/hooks/use-component-node.d.ts +6 -0
- package/lib/hooks/use-component-node.js +37 -0
- package/lib/hooks/use-component-platform.d.ts +4 -0
- package/lib/hooks/use-component-platform.js +39 -0
- package/lib/hooks/use-component.d.ts +3 -0
- package/lib/hooks/use-component.js +57 -0
- package/lib/hooks/use-container.d.ts +2 -0
- package/lib/hooks/use-container.js +6 -0
- package/lib/hooks/use-context.d.ts +3 -0
- package/lib/hooks/use-context.js +50 -0
- package/lib/hooks/use-dispatch.d.ts +3 -0
- package/lib/hooks/use-dispatch.js +64 -0
- package/lib/hooks/use-event-listener.d.ts +2 -0
- package/lib/hooks/use-event-listener.js +21 -0
- package/lib/hooks/use-events.d.ts +3 -0
- package/lib/hooks/use-events.js +12 -0
- package/lib/hooks/use-is-mounted.d.ts +3 -0
- package/lib/hooks/use-is-mounted.js +14 -0
- package/lib/hooks/use-key-press.d.ts +2 -0
- package/lib/hooks/use-key-press.js +46 -0
- package/lib/hooks/use-layout.d.ts +3 -0
- package/lib/hooks/use-layout.js +50 -0
- package/lib/hooks/use-previous.d.ts +2 -0
- package/lib/hooks/use-previous.js +11 -0
- package/lib/hooks/use-properties.d.ts +6 -0
- package/lib/hooks/use-properties.js +9 -0
- package/lib/hooks/use-render-state.d.ts +4 -0
- package/lib/hooks/use-render-state.js +66 -0
- package/lib/hooks/use-route-data.d.ts +4 -0
- package/lib/hooks/use-route-data.js +54 -0
- package/lib/hooks/use-router.d.ts +3 -0
- package/lib/hooks/use-router.js +9 -0
- package/lib/hooks/use-scroll.d.ts +2 -0
- package/lib/hooks/use-scroll.js +71 -0
- package/lib/hooks/use-settings.d.ts +3 -0
- package/lib/hooks/use-settings.js +38 -0
- package/lib/hooks/use-toggle.d.ts +2 -0
- package/lib/hooks/use-toggle.js +28 -0
- package/lib/hooks/use-transition-end.d.ts +2 -0
- package/lib/hooks/use-transition-end.js +62 -0
- package/lib/hooks/use-unique-menu.d.ts +2 -0
- package/lib/hooks/use-unique-menu.js +15 -0
- package/lib/hooks/use-widget-event.d.ts +3 -0
- package/lib/hooks/use-widget-event.js +21 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +92 -0
- package/lib/styles.d.ts +19 -0
- package/lib/styles.js +53 -0
- package/lib/utils/animations.d.ts +18 -0
- package/lib/utils/animations.js +104 -0
- package/lib/utils/browser.d.ts +12 -0
- package/lib/utils/browser.js +54 -0
- package/lib/utils/convert-to-string-attributes.d.ts +2 -0
- package/lib/utils/convert-to-string-attributes.js +23 -0
- package/lib/utils/create-empty-component.d.ts +4 -0
- package/lib/utils/create-empty-component.js +25 -0
- package/lib/utils/embedded-link-mapper.d.ts +4 -0
- package/lib/utils/embedded-link-mapper.js +62 -0
- package/lib/utils/filter-css-props.d.ts +8 -0
- package/lib/utils/filter-css-props.js +28 -0
- package/lib/utils/generic-hash-link.d.ts +8 -0
- package/lib/utils/generic-hash-link.js +70 -0
- package/lib/utils/heading-styles.d.ts +1 -0
- package/lib/utils/heading-styles.js +48 -0
- package/lib/utils/index.d.ts +12 -0
- package/lib/utils/index.js +28 -0
- package/lib/utils/process-html-string.d.ts +4 -0
- package/lib/utils/process-html-string.js +16 -0
- package/lib/utils/render-instructions.d.ts +8 -0
- package/lib/utils/render-instructions.js +19 -0
- package/lib-esm/components/anchor-link.d.ts +4 -0
- package/lib-esm/components/anchor-link.js +5 -0
- package/lib-esm/components/button.d.ts +4 -0
- package/lib-esm/components/button.js +36 -0
- package/lib-esm/components/checkbox.d.ts +7 -0
- package/lib-esm/components/checkbox.js +34 -0
- package/lib-esm/components/drawer/drawer.d.ts +21 -0
- package/lib-esm/components/drawer/drawer.js +121 -0
- package/lib-esm/components/drawer/index.d.ts +3 -0
- package/lib-esm/components/drawer/index.js +3 -0
- package/lib-esm/components/dropdown/dropdown.d.ts +9 -0
- package/lib-esm/components/dropdown/dropdown.js +127 -0
- package/lib-esm/components/dropdown/index.d.ts +4 -0
- package/lib-esm/components/dropdown/index.js +3 -0
- package/lib-esm/components/dropdown/use-position.d.ts +5 -0
- package/lib-esm/components/dropdown/use-position.js +53 -0
- package/lib-esm/components/empty.d.ts +4 -0
- package/lib-esm/components/empty.js +35 -0
- package/lib-esm/components/grid.d.ts +7 -0
- package/lib-esm/components/grid.js +36 -0
- package/lib-esm/components/html.d.ts +12 -0
- package/lib-esm/components/html.js +53 -0
- package/lib-esm/components/icon.d.ts +7 -0
- package/lib-esm/components/icon.js +30 -0
- package/lib-esm/components/index.d.ts +58 -0
- package/lib-esm/components/index.js +30 -0
- package/lib-esm/components/input.d.ts +10 -0
- package/lib-esm/components/input.js +69 -0
- package/lib-esm/components/item-list.d.ts +10 -0
- package/lib-esm/components/item-list.js +34 -0
- package/lib-esm/components/item-tree.d.ts +13 -0
- package/lib-esm/components/item-tree.js +50 -0
- package/lib-esm/components/lightbox.d.ts +6 -0
- package/lib-esm/components/lightbox.js +64 -0
- package/lib-esm/components/link.d.ts +11 -0
- package/lib-esm/components/link.js +71 -0
- package/lib-esm/components/list.d.ts +9 -0
- package/lib-esm/components/list.js +31 -0
- package/lib-esm/components/modal/confirm.d.ts +12 -0
- package/lib-esm/components/modal/confirm.js +33 -0
- package/lib-esm/components/modal/index.d.ts +4 -0
- package/lib-esm/components/modal/index.js +3 -0
- package/lib-esm/components/modal/modal.d.ts +10 -0
- package/lib-esm/components/modal/modal.js +99 -0
- package/lib-esm/components/not-found.d.ts +9 -0
- package/lib-esm/components/not-found.js +27 -0
- package/lib-esm/components/overlay.d.ts +8 -0
- package/lib-esm/components/overlay.js +45 -0
- package/lib-esm/components/paragraph.d.ts +11 -0
- package/lib-esm/components/paragraph.js +38 -0
- package/lib-esm/components/portal.d.ts +7 -0
- package/lib-esm/components/portal.js +36 -0
- package/lib-esm/components/route-link.d.ts +11 -0
- package/lib-esm/components/route-link.js +90 -0
- package/lib-esm/components/symbol-badge.d.ts +15 -0
- package/lib-esm/components/symbol-badge.js +192 -0
- package/lib-esm/components/tab-stop.d.ts +18 -0
- package/lib-esm/components/tab-stop.js +75 -0
- package/lib-esm/components/text-link.d.ts +8 -0
- package/lib-esm/components/text-link.js +34 -0
- package/lib-esm/components/text.d.ts +4 -0
- package/lib-esm/components/text.js +30 -0
- package/lib-esm/components/timestamp.d.ts +13 -0
- package/lib-esm/components/timestamp.js +33 -0
- package/lib-esm/components/tooltip.d.ts +8 -0
- package/lib-esm/components/tooltip.js +99 -0
- package/lib-esm/components/transition-component.d.ts +30 -0
- package/lib-esm/components/transition-component.js +72 -0
- package/lib-esm/components/typography.d.ts +9 -0
- package/lib-esm/components/typography.js +38 -0
- package/lib-esm/components/widget-link.d.ts +10 -0
- package/lib-esm/components/widget-link.js +88 -0
- package/lib-esm/contexts/index.d.ts +9 -0
- package/lib-esm/contexts/index.js +12 -0
- package/lib-esm/create-react-component.d.ts +11 -0
- package/lib-esm/create-react-component.js +16 -0
- package/lib-esm/hooks/index.d.ts +27 -0
- package/lib-esm/hooks/index.js +26 -0
- package/lib-esm/hooks/use-action.d.ts +4 -0
- package/lib-esm/hooks/use-action.js +14 -0
- package/lib-esm/hooks/use-children.d.ts +4 -0
- package/lib-esm/hooks/use-children.js +65 -0
- package/lib-esm/hooks/use-columns.d.ts +2 -0
- package/lib-esm/hooks/use-columns.js +4 -0
- package/lib-esm/hooks/use-component-descriptor.d.ts +2 -0
- package/lib-esm/hooks/use-component-descriptor.js +4 -0
- package/lib-esm/hooks/use-component-node.d.ts +6 -0
- package/lib-esm/hooks/use-component-node.js +35 -0
- package/lib-esm/hooks/use-component-platform.d.ts +4 -0
- package/lib-esm/hooks/use-component-platform.js +34 -0
- package/lib-esm/hooks/use-component.d.ts +3 -0
- package/lib-esm/hooks/use-component.js +52 -0
- package/lib-esm/hooks/use-container.d.ts +2 -0
- package/lib-esm/hooks/use-container.js +4 -0
- package/lib-esm/hooks/use-context.d.ts +3 -0
- package/lib-esm/hooks/use-context.js +45 -0
- package/lib-esm/hooks/use-dispatch.d.ts +3 -0
- package/lib-esm/hooks/use-dispatch.js +59 -0
- package/lib-esm/hooks/use-event-listener.d.ts +2 -0
- package/lib-esm/hooks/use-event-listener.js +19 -0
- package/lib-esm/hooks/use-events.d.ts +3 -0
- package/lib-esm/hooks/use-events.js +7 -0
- package/lib-esm/hooks/use-is-mounted.d.ts +3 -0
- package/lib-esm/hooks/use-is-mounted.js +12 -0
- package/lib-esm/hooks/use-key-press.d.ts +2 -0
- package/lib-esm/hooks/use-key-press.js +41 -0
- package/lib-esm/hooks/use-layout.d.ts +3 -0
- package/lib-esm/hooks/use-layout.js +45 -0
- package/lib-esm/hooks/use-previous.d.ts +2 -0
- package/lib-esm/hooks/use-previous.js +9 -0
- package/lib-esm/hooks/use-properties.d.ts +6 -0
- package/lib-esm/hooks/use-properties.js +7 -0
- package/lib-esm/hooks/use-render-state.d.ts +4 -0
- package/lib-esm/hooks/use-render-state.js +61 -0
- package/lib-esm/hooks/use-route-data.d.ts +4 -0
- package/lib-esm/hooks/use-route-data.js +49 -0
- package/lib-esm/hooks/use-router.d.ts +3 -0
- package/lib-esm/hooks/use-router.js +7 -0
- package/lib-esm/hooks/use-scroll.d.ts +2 -0
- package/lib-esm/hooks/use-scroll.js +66 -0
- package/lib-esm/hooks/use-settings.d.ts +3 -0
- package/lib-esm/hooks/use-settings.js +33 -0
- package/lib-esm/hooks/use-toggle.d.ts +2 -0
- package/lib-esm/hooks/use-toggle.js +26 -0
- package/lib-esm/hooks/use-transition-end.d.ts +2 -0
- package/lib-esm/hooks/use-transition-end.js +60 -0
- package/lib-esm/hooks/use-unique-menu.d.ts +2 -0
- package/lib-esm/hooks/use-unique-menu.js +10 -0
- package/lib-esm/hooks/use-widget-event.d.ts +3 -0
- package/lib-esm/hooks/use-widget-event.js +16 -0
- package/lib-esm/index.d.ts +9 -0
- package/lib-esm/index.js +7 -0
- package/lib-esm/styles.d.ts +19 -0
- package/lib-esm/styles.js +26 -0
- package/lib-esm/utils/animations.d.ts +18 -0
- package/lib-esm/utils/animations.js +101 -0
- package/lib-esm/utils/browser.d.ts +12 -0
- package/lib-esm/utils/browser.js +51 -0
- package/lib-esm/utils/convert-to-string-attributes.d.ts +2 -0
- package/lib-esm/utils/convert-to-string-attributes.js +21 -0
- package/lib-esm/utils/create-empty-component.d.ts +4 -0
- package/lib-esm/utils/create-empty-component.js +20 -0
- package/lib-esm/utils/embedded-link-mapper.d.ts +4 -0
- package/lib-esm/utils/embedded-link-mapper.js +57 -0
- package/lib-esm/utils/filter-css-props.d.ts +8 -0
- package/lib-esm/utils/filter-css-props.js +25 -0
- package/lib-esm/utils/generic-hash-link.d.ts +8 -0
- package/lib-esm/utils/generic-hash-link.js +63 -0
- package/lib-esm/utils/heading-styles.d.ts +1 -0
- package/lib-esm/utils/heading-styles.js +44 -0
- package/lib-esm/utils/index.d.ts +12 -0
- package/lib-esm/utils/index.js +10 -0
- package/lib-esm/utils/process-html-string.d.ts +4 -0
- package/lib-esm/utils/process-html-string.js +10 -0
- package/lib-esm/utils/render-instructions.d.ts +8 -0
- package/lib-esm/utils/render-instructions.js +12 -0
- package/package.json +47 -0
|
@@ -0,0 +1,71 @@
|
|
|
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 { appendClassNames } from '@telia-ace/widget-utilities';
|
|
28
|
+
import React, { forwardRef } from 'react';
|
|
29
|
+
import styled from 'styled-components';
|
|
30
|
+
import { convertToStringAttributes } from '../utils';
|
|
31
|
+
import RouteLink from './route-link';
|
|
32
|
+
export default forwardRef(function (_a, ref) {
|
|
33
|
+
var className = _a.className, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.role, role = _c === void 0 ? 'link' : _c, _d = _a.tabIndex, tabIndex = _d === void 0 ? 0 : _d, _e = _a.onClick, onClick = _e === void 0 ? function () { } : _e, _f = _a.onKeyDown, onKeyDown = _f === void 0 ? function () { } : _f, title = _a.title, href = _a.href, children = _a.children, target = _a.target, routeName = _a.routeName, params = _a.params, other = __rest(_a, ["className", "disabled", "role", "tabIndex", "onClick", "onKeyDown", "title", "href", "children", "target", "routeName", "params"]);
|
|
34
|
+
var props = {
|
|
35
|
+
title: title,
|
|
36
|
+
disabled: disabled,
|
|
37
|
+
role: role,
|
|
38
|
+
tabIndex: tabIndex,
|
|
39
|
+
className: appendClassNames(className, 'humany-link', [!!disabled, 'humany-disabled']),
|
|
40
|
+
onClick: function (e) {
|
|
41
|
+
e.persist();
|
|
42
|
+
if (disabled) {
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
onClick(e);
|
|
47
|
+
},
|
|
48
|
+
onKeyDown: function (e) {
|
|
49
|
+
e.persist();
|
|
50
|
+
if (disabled) {
|
|
51
|
+
if (e.key !== 'Tab') {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
}
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
onKeyDown(e);
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
return routeName ? (React.createElement(StyledRouteLink, __assign({ name: routeName, params: params }, props, convertToStringAttributes(other), { ref: ref }), children)) : (React.createElement(StyledLink, __assign({ href: href, target: target }, props, convertToStringAttributes(other), { ref: ref }), children));
|
|
60
|
+
});
|
|
61
|
+
var StyledRouteLink = styled(RouteLink)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (p) {
|
|
62
|
+
return p.disabled
|
|
63
|
+
? "\n pointer-events: none;\n opacity: .7;\n "
|
|
64
|
+
: 'cursor: pointer;';
|
|
65
|
+
});
|
|
66
|
+
var StyledLink = styled.a(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (p) {
|
|
67
|
+
return p.disabled
|
|
68
|
+
? "\n pointer-events: none;\n opacity: .7;\n "
|
|
69
|
+
: 'cursor: pointer;';
|
|
70
|
+
});
|
|
71
|
+
var templateObject_1, templateObject_2;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type ItemRenderer = (item: any, index: number, items: any[], defaultRenderer?: ItemRenderer) => React.ReactNode;
|
|
3
|
+
export declare type Props = Merge<React.ComponentProps<'ul'>, {
|
|
4
|
+
renderItem: ItemRenderer;
|
|
5
|
+
items: any[];
|
|
6
|
+
renderLi?: boolean;
|
|
7
|
+
}>;
|
|
8
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "key" | keyof React.HTMLAttributes<HTMLUListElement> | "renderItem" | "items" | "renderLi"> & React.RefAttributes<HTMLUListElement>>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
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 { appendClassNames } from '@telia-ace/widget-utilities';
|
|
24
|
+
import React, { forwardRef } from 'react';
|
|
25
|
+
import { convertToStringAttributes } from '../utils';
|
|
26
|
+
export default forwardRef(function (_a, ref) {
|
|
27
|
+
var className = _a.className, items = _a.items, renderItem = _a.renderItem, _b = _a.renderLi, renderLi = _b === void 0 ? false : _b, other = __rest(_a, ["className", "items", "renderItem", "renderLi"]);
|
|
28
|
+
return (React.createElement("ul", __assign({ className: appendClassNames(className, 'humany-list'), "data-item-count": items.length }, convertToStringAttributes(other), { ref: ref }), items.map(function (item, index, items) {
|
|
29
|
+
return renderLi ? (React.createElement("li", { className: "humany-list-item", key: item.id }, renderItem(item, index, items))) : (renderItem(item, index, items));
|
|
30
|
+
})));
|
|
31
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Props as ModalProps } from './modal';
|
|
3
|
+
declare type Props = Merge<{
|
|
4
|
+
header?: string;
|
|
5
|
+
text?: string;
|
|
6
|
+
onCancel?: () => void;
|
|
7
|
+
onConfirm?: () => void;
|
|
8
|
+
cancelLabel?: string;
|
|
9
|
+
confirmLabel?: string;
|
|
10
|
+
}, ModalProps>;
|
|
11
|
+
declare const Confirm: React.FC<Props>;
|
|
12
|
+
export default Confirm;
|
|
@@ -0,0 +1,33 @@
|
|
|
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 React, { useCallback, useRef } from 'react';
|
|
6
|
+
import styled from 'styled-components';
|
|
7
|
+
import { Button } from '..';
|
|
8
|
+
import { borderTabStyle, StyledText } from '../../styles';
|
|
9
|
+
import Modal from './modal';
|
|
10
|
+
var Confirm = function (_a) {
|
|
11
|
+
var className = _a.className, trigger = _a.trigger, _b = _a.header, header = _b === void 0 ? '' : _b, _c = _a.text, text = _c === void 0 ? '' : _c, _d = _a.onCancel, onCancel = _d === void 0 ? function () { } : _d, _e = _a.onConfirm, onConfirm = _e === void 0 ? function () { } : _e, _f = _a.cancelLabel, cancelLabel = _f === void 0 ? '' : _f, _g = _a.confirmLabel, confirmLabel = _g === void 0 ? '' : _g;
|
|
12
|
+
var ref = useRef();
|
|
13
|
+
var cancel = useCallback(function () {
|
|
14
|
+
var _a;
|
|
15
|
+
onCancel();
|
|
16
|
+
(_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
17
|
+
}, [onCancel]);
|
|
18
|
+
var confirm = useCallback(function () {
|
|
19
|
+
var _a;
|
|
20
|
+
onConfirm();
|
|
21
|
+
(_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
22
|
+
}, [onConfirm]);
|
|
23
|
+
return (React.createElement(StyledModal, { className: className, trigger: trigger, ref: ref, onOverlayClick: cancel },
|
|
24
|
+
header && React.createElement(StyledText, null, header),
|
|
25
|
+
text && React.createElement(StyledText, null, text),
|
|
26
|
+
confirmLabel && (React.createElement(StyledConfirmButton, { onClick: confirm }, confirmLabel)),
|
|
27
|
+
cancelLabel && React.createElement(StyledCancelButton, { onClick: cancel }, cancelLabel)));
|
|
28
|
+
};
|
|
29
|
+
export default Confirm;
|
|
30
|
+
var StyledModal = styled(Modal)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: block;\n\n span {\n display: block;\n margin: 0 0 ", ";\n\n &:first-of-type:not(:only-of-type) {\n font-weight: 700;\n margin: 0 0 ", ";\n }\n }\n"], ["\n display: block;\n\n span {\n display: block;\n margin: 0 0 ", ";\n\n &:first-of-type:not(:only-of-type) {\n font-weight: 700;\n margin: 0 0 ", ";\n }\n }\n"])), 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.small; });
|
|
31
|
+
var StyledConfirmButton = styled(Button)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: inline-block;\n min-width: 50px;\n ", "\n ", "\n color: #FFFFFF;\n background-color: ", ";\n border: 1px solid ", ";\n\n margin: 0 ", " 0 0;\n\n &:focus {\n ", ";\n background-color: transparent;\n }\n"], ["\n display: inline-block;\n min-width: 50px;\n ", "\n ", "\n color: #FFFFFF;\n background-color: ", ";\n border: 1px solid ", ";\n\n margin: 0 ", " 0 0;\n\n &:focus {\n ", ";\n background-color: transparent;\n }\n"])), function (p) { var _a, _b; return "padding: ".concat((_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small, " ").concat((_b = p.theme.sizes) === null || _b === void 0 ? void 0 : _b.normal, ";"); }, function (p) { return p.theme.borderRadius && "border-radius: ".concat(p.theme.borderRadius, ";"); }, 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.colors) === null || _a === void 0 ? void 0 : _a.primary; }, 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.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && borderTabStyle; });
|
|
32
|
+
var StyledCancelButton = styled(Button)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: inline-block;\n min-width: 50px;\n ", "\n ", "\n background-color: transparent;\n color: ", ";\n border: 1px solid ", ";\n\n &:focus {\n ", ";\n }\n"], ["\n display: inline-block;\n min-width: 50px;\n ", "\n ", "\n background-color: transparent;\n color: ", ";\n border: 1px solid ", ";\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.small, " ").concat((_b = p.theme.sizes) === null || _b === void 0 ? void 0 : _b.normal, ";"); }, function (p) { return p.theme.borderRadius && "border-radius: ".concat(p.theme.borderRadius, ";"); }, 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; }, function (p) { var _a; return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && borderTabStyle; });
|
|
33
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type Props = Merge<{
|
|
3
|
+
trigger: React.ReactElement;
|
|
4
|
+
className?: string;
|
|
5
|
+
onOverlayClick?: (e: React.MouseEvent) => void;
|
|
6
|
+
close?: boolean;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}, React.ComponentProps<'div'>>;
|
|
9
|
+
declare const Modal: React.ForwardRefExoticComponent<Pick<Props, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "close" | "trigger" | "onOverlayClick"> & React.RefAttributes<any>>;
|
|
10
|
+
export default Modal;
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
28
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
29
|
+
if (!m) return o;
|
|
30
|
+
var i = m.call(o), r, ar = [], e;
|
|
31
|
+
try {
|
|
32
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
33
|
+
}
|
|
34
|
+
catch (error) { e = { error: error }; }
|
|
35
|
+
finally {
|
|
36
|
+
try {
|
|
37
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
38
|
+
}
|
|
39
|
+
finally { if (e) throw e.error; }
|
|
40
|
+
}
|
|
41
|
+
return ar;
|
|
42
|
+
};
|
|
43
|
+
import { appendClassNames, uuid } from '@telia-ace/widget-utilities';
|
|
44
|
+
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef } from 'react';
|
|
45
|
+
import styled from 'styled-components';
|
|
46
|
+
import { useKeyPress, useScroll, useToggle, useUniqueMenu, useWidgetEvent } from '../../hooks';
|
|
47
|
+
import { CloseButton, contentBox } from '../../styles';
|
|
48
|
+
import Overlay from '../overlay';
|
|
49
|
+
import SymbolBadge from '../symbol-badge';
|
|
50
|
+
var Modal = forwardRef(function (_a, ref) {
|
|
51
|
+
var className = _a.className, children = _a.children, trigger = _a.trigger, _b = _a.onOverlayClick, onOverlayClick = _b === void 0 ? function () { } : _b, _c = _a.close, close = _c === void 0 ? false : _c, other = __rest(_a, ["className", "children", "trigger", "onOverlayClick", "close"]);
|
|
52
|
+
var _d = __read(useToggle(), 2), visible = _d[0], toggleVisible = _d[1];
|
|
53
|
+
var _e = __read(useScroll(true), 2), css = _e[0], innerRef = _e[1];
|
|
54
|
+
var closeButtonRef = useRef();
|
|
55
|
+
var id = useRef(uuid());
|
|
56
|
+
var esc = useKeyPress('Escape');
|
|
57
|
+
useEffect(function () {
|
|
58
|
+
if (esc || close) {
|
|
59
|
+
toggleVisible(false);
|
|
60
|
+
}
|
|
61
|
+
}, [esc, close]);
|
|
62
|
+
useEffect(function () {
|
|
63
|
+
if (visible && closeButtonRef.current) {
|
|
64
|
+
closeButtonRef.current.focus();
|
|
65
|
+
}
|
|
66
|
+
}, [visible, closeButtonRef.current]);
|
|
67
|
+
useWidgetEvent('router:changed', function () {
|
|
68
|
+
toggleVisible(false);
|
|
69
|
+
});
|
|
70
|
+
var overlayClick = useCallback(function (e) {
|
|
71
|
+
toggleVisible(false);
|
|
72
|
+
onOverlayClick(e);
|
|
73
|
+
}, [onOverlayClick, toggleVisible]);
|
|
74
|
+
useImperativeHandle(ref, function () { return ({
|
|
75
|
+
close: function () {
|
|
76
|
+
toggleVisible(false);
|
|
77
|
+
},
|
|
78
|
+
}); });
|
|
79
|
+
var closeMenus = useCallback(function () {
|
|
80
|
+
return useUniqueMenu(id.current, function () {
|
|
81
|
+
toggleVisible(false);
|
|
82
|
+
});
|
|
83
|
+
}, [id.current]);
|
|
84
|
+
return (React.createElement(React.Fragment, null,
|
|
85
|
+
React.createElement(Overlay, { visible: visible, onClick: overlayClick },
|
|
86
|
+
React.createElement(Wrapper, __assign({ className: appendClassNames(className, 'humany-modal', "humany-modal-".concat(id.current)), css: css, tabIndex: -1 }, other, { ref: innerRef }),
|
|
87
|
+
React.createElement(CloseButton, { onClick: function () { return toggleVisible(false); }, tabIndex: 0, ref: closeButtonRef },
|
|
88
|
+
React.createElement(SymbolBadge, { symbol: { type: 'Svg', content: 'close' } })),
|
|
89
|
+
children)),
|
|
90
|
+
React.cloneElement(trigger, {
|
|
91
|
+
onClick: function (event) {
|
|
92
|
+
toggleVisible();
|
|
93
|
+
closeMenus();
|
|
94
|
+
},
|
|
95
|
+
})));
|
|
96
|
+
});
|
|
97
|
+
export default Modal;
|
|
98
|
+
var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n position: relative;\n max-width: 50%;\n min-width: 200px;\n padding: ", ";\n ", "\n ", "\n outline: none;\n"], ["\n font-family: ", ";\n font-size: ", ";\n position: relative;\n max-width: 50%;\n min-width: 200px;\n padding: ", ";\n ", "\n ", "\n outline: none;\n"])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.type; }, 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.sizes) === null || _a === void 0 ? void 0 : _a.medium; }, contentBox, function (p) { return p.css && p.css; });
|
|
99
|
+
var templateObject_1;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 React from 'react';
|
|
6
|
+
import styled, { css } from 'styled-components';
|
|
7
|
+
import { TextLink, Typography } from '../components';
|
|
8
|
+
import { headingElement } from '../utils/heading-styles';
|
|
9
|
+
var NotFound = function (_a) {
|
|
10
|
+
var _b = _a.header, header = _b === void 0 ? '' : _b, _c = _a.link, link = _c === void 0 ? '' : _c, _d = _a.suggestionHeader, suggestionHeader = _d === void 0 ? '' : _d, _e = _a.suggestion, suggestion = _e === void 0 ? '' : _e;
|
|
11
|
+
return (React.createElement(Wrapper, null,
|
|
12
|
+
React.createElement(Status, null,
|
|
13
|
+
React.createElement(Typography, { variant: "h2" }, "404")),
|
|
14
|
+
React.createElement(Header, null,
|
|
15
|
+
React.createElement(Typography, { variant: "h3" }, header),
|
|
16
|
+
React.createElement(TextLink, { routeName: "index", "aria-label": link, text: link })),
|
|
17
|
+
React.createElement(Content, null,
|
|
18
|
+
React.createElement("span", null, suggestionHeader),
|
|
19
|
+
React.createElement("ul", null,
|
|
20
|
+
React.createElement("li", null, suggestion)))));
|
|
21
|
+
};
|
|
22
|
+
export default NotFound;
|
|
23
|
+
var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-wrap: wrap;\n"], ["\n display: flex;\n flex-wrap: wrap;\n"])));
|
|
24
|
+
var Status = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), headingElement('h2', css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: 0;\n margin: 0;\n color: gray;\n font-size: 7em;\n "], ["\n padding: 0;\n margin: 0;\n color: gray;\n font-size: 7em;\n "])))));
|
|
25
|
+
var Header = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-left: ", ";\n\n ", "\n\n a {\n color: ", ";\n font-size: ", ";\n }\n"], ["\n margin-left: ", ";\n\n ", "\n\n a {\n color: ", ";\n font-size: ", ";\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; }, headingElement('h3', css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n text-transform: uppercase;\n font-size: ", ";\n "], ["\n text-transform: uppercase;\n font-size: ", ";\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.link; }, function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.small; });
|
|
26
|
+
var Content = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin-top: ", ";\n min-width: 100%;\n\n span {\n font-weight: bold;\n }\n"], ["\n margin-top: ", ";\n min-width: 100%;\n\n span {\n font-weight: bold;\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; });
|
|
27
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -0,0 +1,45 @@
|
|
|
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 React, { useCallback, useRef } from 'react';
|
|
28
|
+
import { CSSTransition } from 'react-transition-group';
|
|
29
|
+
import styled from 'styled-components';
|
|
30
|
+
import Portal from './portal';
|
|
31
|
+
var Overlay = function (_a) {
|
|
32
|
+
var visible = _a.visible, _b = _a.duration, duration = _b === void 0 ? 500 : _b, children = _a.children, _c = _a.onClick, onClick = _c === void 0 ? function () { } : _c, other = __rest(_a, ["visible", "duration", "children", "onClick"]);
|
|
33
|
+
var ref = useRef();
|
|
34
|
+
var onOverlayClick = useCallback(function (e) {
|
|
35
|
+
if (e.target === ref.current) {
|
|
36
|
+
onClick(e);
|
|
37
|
+
}
|
|
38
|
+
}, [onClick]);
|
|
39
|
+
return (React.createElement(CSSTransition, { in: visible, className: "humany-overlay-transition", classNames: "humany-overlay-transition", unmountOnExit: true, timeout: duration },
|
|
40
|
+
React.createElement(Portal, null,
|
|
41
|
+
React.createElement(Wrapper, __assign({ className: "humany-overlay", duration: duration, ref: ref, onClick: onOverlayClick }, other), children))));
|
|
42
|
+
};
|
|
43
|
+
var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: rgba(0, 0, 0, 0.6);\n min-width: 100%;\n min-height: 100%;\n position: fixed;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 7;\n\n transition: ", "ms;\n opacity: 0;\n\n &.humany-overlay-transition-enter {\n opacity: 0.1;\n }\n &.humany-overlay-transition-enter-active,\n &.humany-overlay-transition-enter-done,\n &.humany-overlay-transition-exit {\n opacity: 1;\n }\n\n &.humany-overlay-transition-exit-active,\n &.humany-overlay-transition-exit-done {\n opacity: 0;\n }\n"], ["\n background: rgba(0, 0, 0, 0.6);\n min-width: 100%;\n min-height: 100%;\n position: fixed;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 7;\n\n transition: ", "ms;\n opacity: 0;\n\n &.humany-overlay-transition-enter {\n opacity: 0.1;\n }\n &.humany-overlay-transition-enter-active,\n &.humany-overlay-transition-enter-done,\n &.humany-overlay-transition-exit {\n opacity: 1;\n }\n\n &.humany-overlay-transition-exit-active,\n &.humany-overlay-transition-exit-done {\n opacity: 0;\n }\n"])), function (p) { return p.duration; });
|
|
44
|
+
export default Overlay;
|
|
45
|
+
var templateObject_1;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Props as HtmlProps } from './html';
|
|
3
|
+
import { Symbol } from './symbol-badge';
|
|
4
|
+
export declare type Props = Merge<HtmlProps, {
|
|
5
|
+
text?: string;
|
|
6
|
+
html?: string;
|
|
7
|
+
header?: string;
|
|
8
|
+
symbol?: Symbol;
|
|
9
|
+
}>;
|
|
10
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "symbol" | "header" | "html" | "text" | "key" | keyof React.HTMLAttributes<HTMLDivElement> | "htmlParseInstruction"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
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 { appendClassNames } from '@telia-ace/widget-utilities';
|
|
24
|
+
import React, { forwardRef } from 'react';
|
|
25
|
+
import { convertToStringAttributes } from '../utils';
|
|
26
|
+
import Html from './html';
|
|
27
|
+
import SymbolBadge from './symbol-badge';
|
|
28
|
+
import Text from './text';
|
|
29
|
+
import Typography from './typography';
|
|
30
|
+
export default forwardRef(function (_a, ref) {
|
|
31
|
+
var text = _a.text, html = _a.html, header = _a.header, className = _a.className, htmlParseInstruction = _a.htmlParseInstruction, symbol = _a.symbol, other = __rest(_a, ["text", "html", "header", "className", "htmlParseInstruction", "symbol"]);
|
|
32
|
+
return (React.createElement("div", __assign({ className: appendClassNames(className, 'humany-paragraph') }, convertToStringAttributes(other), { ref: ref }),
|
|
33
|
+
header ? (React.createElement(Typography, { variant: "h1" },
|
|
34
|
+
symbol ? React.createElement(SymbolBadge, { symbol: symbol }) : null,
|
|
35
|
+
header)) : null,
|
|
36
|
+
html ? React.createElement(Html, { html: html, htmlParseInstruction: htmlParseInstruction }) : null,
|
|
37
|
+
text ? React.createElement(Text, null, text) : null));
|
|
38
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
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 React, { useEffect } from 'react';
|
|
18
|
+
import { createPortal } from 'react-dom';
|
|
19
|
+
var Portal = function (_a) {
|
|
20
|
+
var _b = _a.elementId, elementId = _b === void 0 ? 'humany-portal-elements' : _b, children = _a.children;
|
|
21
|
+
var _c = __read(React.useState(function () {
|
|
22
|
+
var el = document.getElementById(elementId) || document.createElement('div');
|
|
23
|
+
el.id = elementId;
|
|
24
|
+
return el;
|
|
25
|
+
}), 1), container = _c[0];
|
|
26
|
+
useEffect(function () {
|
|
27
|
+
document.body.appendChild(container);
|
|
28
|
+
return function () {
|
|
29
|
+
if (container.childElementCount <= 1) {
|
|
30
|
+
document.body.removeChild(container);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}, [container]);
|
|
34
|
+
return createPortal(children, container);
|
|
35
|
+
};
|
|
36
|
+
export default Portal;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type Props = Merge<React.ComponentProps<'a'>, {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
name?: string;
|
|
5
|
+
params?: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
to?: string;
|
|
9
|
+
}>;
|
|
10
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "name" | "to" | "key" | keyof React.AnchorHTMLAttributes<HTMLAnchorElement> | "disabled" | "params"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,90 @@
|
|
|
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 { getSpecificWidgetPath, HistoryMode } from '@telia-ace/widget-routing';
|
|
24
|
+
import { appendClassNames, Logger } from '@telia-ace/widget-utilities';
|
|
25
|
+
import React, { forwardRef } from 'react';
|
|
26
|
+
import { Link } from 'react-router-dom';
|
|
27
|
+
import { useContainer, useRouter } from '../hooks';
|
|
28
|
+
export default forwardRef(function (_a, forwardedRef) {
|
|
29
|
+
var className = _a.className, _b = _a.onClick, onClick = _b === void 0 ? function () { } : _b, _c = _a.name, name = _c === void 0 ? '' : _c, _d = _a.to, to = _d === void 0 ? '' : _d, _e = _a.params, params = _e === void 0 ? {} : _e, children = _a.children, other = __rest(_a, ["className", "onClick", "name", "to", "params", "children"]);
|
|
30
|
+
var router = useRouter();
|
|
31
|
+
var container = useContainer();
|
|
32
|
+
if (!router) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
var path = '';
|
|
36
|
+
var props = __assign(__assign({ onClick: onClick, className: appendClassNames(className, 'humany-route-link'), to: path, innerRef: forwardedRef }, other), { ref: null });
|
|
37
|
+
if (name) {
|
|
38
|
+
var routes = router.routes || [];
|
|
39
|
+
var route = routes.find(function (r) { return r.name === name; });
|
|
40
|
+
if (!route) {
|
|
41
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
42
|
+
Logger.warn("Unable to create route. No route named \"".concat(name, "\" exist."));
|
|
43
|
+
}
|
|
44
|
+
return (React.createElement(Link, __assign({}, props, { onClick: function (e) {
|
|
45
|
+
onClick(e);
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
48
|
+
Logger.warn("Unable to navigate. No route named \"".concat(name, "\" exist."));
|
|
49
|
+
}
|
|
50
|
+
} }), children));
|
|
51
|
+
}
|
|
52
|
+
var encodedParams = Object.keys(params).reduce(function (acc, key) {
|
|
53
|
+
acc[key] =
|
|
54
|
+
typeof params[key] === 'string' ? encodeURIComponent(params[key]) : params[key];
|
|
55
|
+
return acc;
|
|
56
|
+
}, {});
|
|
57
|
+
try {
|
|
58
|
+
path = router.generate(name, encodedParams || {});
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
return React.createElement(Link, __assign({}, props), children);
|
|
62
|
+
}
|
|
63
|
+
if (path &&
|
|
64
|
+
router.settings.mode &&
|
|
65
|
+
router.settings.mode === HistoryMode.browser &&
|
|
66
|
+
path[0] !== '/') {
|
|
67
|
+
path = "/".concat(path);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else if (to && router.history) {
|
|
71
|
+
path = router.history.createHref({
|
|
72
|
+
hash: '',
|
|
73
|
+
pathname: to,
|
|
74
|
+
search: '',
|
|
75
|
+
state: undefined,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
80
|
+
Logger.warn('Unable to generate path for route link. Either specify route name or use the "to" prop.');
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
// Get the path for the specific widget
|
|
85
|
+
if (router.settings && router.settings.mode === HistoryMode.scopedHash) {
|
|
86
|
+
var widgetName = container.get('$widget').name;
|
|
87
|
+
path = getSpecificWidgetPath(path, widgetName);
|
|
88
|
+
}
|
|
89
|
+
return (React.createElement(Link, __assign({}, props, { to: path }), children));
|
|
90
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type Symbol = {
|
|
3
|
+
type: 'Uri' | 'Svg' | 'FontAwesome' | 'Text' | string;
|
|
4
|
+
content: string;
|
|
5
|
+
};
|
|
6
|
+
export declare type HtmlIconProps = Merge<React.ComponentProps<'i'>, React.ComponentProps<'svg'>>;
|
|
7
|
+
export declare type Props = Merge<HtmlIconProps, {
|
|
8
|
+
symbol: Symbol;
|
|
9
|
+
backgroundSize?: string;
|
|
10
|
+
size?: number;
|
|
11
|
+
text?: string;
|
|
12
|
+
elementStyle?: Object;
|
|
13
|
+
}>;
|
|
14
|
+
declare const SymbolBadge: React.SFC<Props>;
|
|
15
|
+
export default SymbolBadge;
|