@telia-ace/widget-ui 1.0.6 → 1.0.9
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/{lib-esm → dist}/components/anchor-link.d.ts +0 -0
- package/{lib-esm → dist}/components/button.d.ts +0 -0
- package/{lib-esm → dist}/components/checkbox.d.ts +0 -0
- package/{lib-esm → dist}/components/drawer/drawer.d.ts +0 -0
- package/{lib-esm → dist}/components/drawer/index.d.ts +0 -0
- package/{lib-esm → dist}/components/dropdown/dropdown.d.ts +0 -0
- package/{lib-esm → dist}/components/dropdown/index.d.ts +0 -0
- package/{lib-esm → dist}/components/dropdown/use-position.d.ts +0 -0
- package/{lib-esm → dist}/components/empty.d.ts +0 -0
- package/{lib-esm → dist}/components/grid.d.ts +0 -0
- package/{lib-esm → dist}/components/html.d.ts +0 -0
- package/{lib-esm → dist}/components/icon.d.ts +0 -0
- package/{lib-esm → dist}/components/index.d.ts +0 -0
- package/{lib-esm → dist}/components/input.d.ts +0 -0
- package/{lib-esm → dist}/components/item-list.d.ts +0 -0
- package/{lib-esm → dist}/components/item-tree.d.ts +0 -0
- package/{lib-esm → dist}/components/lightbox.d.ts +0 -0
- package/{lib-esm → dist}/components/link.d.ts +0 -0
- package/{lib-esm → dist}/components/list.d.ts +0 -0
- package/{lib-esm → dist}/components/modal/confirm.d.ts +0 -0
- package/{lib-esm → dist}/components/modal/index.d.ts +0 -0
- package/{lib-esm → dist}/components/modal/modal.d.ts +0 -0
- package/{lib-esm → dist}/components/not-found.d.ts +0 -0
- package/{lib-esm → dist}/components/overlay.d.ts +0 -0
- package/{lib-esm → dist}/components/paragraph.d.ts +0 -0
- package/{lib-esm → dist}/components/portal.d.ts +0 -0
- package/{lib-esm → dist}/components/route-link.d.ts +0 -0
- package/{lib-esm → dist}/components/symbol-badge.d.ts +0 -0
- package/{lib-esm → dist}/components/tab-stop.d.ts +0 -0
- package/{lib-esm → dist}/components/text-link.d.ts +0 -0
- package/{lib-esm → dist}/components/text.d.ts +0 -0
- package/{lib-esm → dist}/components/timestamp.d.ts +0 -0
- package/{lib-esm → dist}/components/tooltip.d.ts +0 -0
- package/{lib-esm → dist}/components/transition-component.d.ts +0 -0
- package/{lib-esm → dist}/components/typography.d.ts +0 -0
- package/{lib-esm → dist}/components/widget-link.d.ts +0 -0
- package/{lib-esm → dist}/contexts/index.d.ts +0 -0
- package/{lib-esm → dist}/create-react-component.d.ts +0 -0
- package/{lib-esm → dist}/hooks/index.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-action.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-children.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-columns.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-component-descriptor.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-component-node.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-component-platform.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-component.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-container.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-context.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-dispatch.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-event-listener.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-events.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-is-mounted.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-key-press.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-layout.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-previous.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-properties.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-render-state.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-route-data.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-router.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-scroll.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-settings.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-toggle.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-transition-end.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-unique-menu.d.ts +0 -0
- package/{lib-esm → dist}/hooks/use-widget-event.d.ts +0 -0
- package/{lib-esm → dist}/index.d.ts +0 -0
- package/dist/index.js +2988 -0
- package/dist/index.js.map +1 -0
- package/{lib-esm → dist}/styles.d.ts +0 -0
- package/{lib-esm → dist}/utils/animations.d.ts +0 -0
- package/{lib-esm → dist}/utils/browser.d.ts +0 -0
- package/{lib-esm → dist}/utils/convert-to-string-attributes.d.ts +0 -0
- package/{lib-esm → dist}/utils/create-empty-component.d.ts +0 -0
- package/{lib-esm → dist}/utils/embedded-link-mapper.d.ts +0 -0
- package/{lib-esm → dist}/utils/filter-css-props.d.ts +0 -0
- package/{lib-esm → dist}/utils/generic-hash-link.d.ts +0 -0
- package/{lib-esm → dist}/utils/heading-styles.d.ts +0 -0
- package/{lib-esm → dist}/utils/index.d.ts +0 -0
- package/{lib-esm → dist}/utils/process-html-string.d.ts +0 -0
- package/{lib-esm → dist}/utils/render-instructions.d.ts +0 -0
- package/package.json +10 -11
- package/lib/components/anchor-link.d.ts +0 -4
- package/lib/components/anchor-link.js +0 -7
- package/lib/components/button.d.ts +0 -4
- package/lib/components/button.js +0 -64
- package/lib/components/checkbox.d.ts +0 -7
- package/lib/components/checkbox.js +0 -39
- package/lib/components/drawer/drawer.d.ts +0 -21
- package/lib/components/drawer/drawer.js +0 -150
- package/lib/components/drawer/index.d.ts +0 -3
- package/lib/components/drawer/index.js +0 -29
- package/lib/components/dropdown/dropdown.d.ts +0 -9
- package/lib/components/dropdown/dropdown.js +0 -155
- package/lib/components/dropdown/index.d.ts +0 -4
- package/lib/components/dropdown/index.js +0 -10
- package/lib/components/dropdown/use-position.d.ts +0 -5
- package/lib/components/dropdown/use-position.js +0 -57
- package/lib/components/empty.d.ts +0 -4
- package/lib/components/empty.js +0 -40
- package/lib/components/grid.d.ts +0 -7
- package/lib/components/grid.js +0 -64
- package/lib/components/html.d.ts +0 -12
- package/lib/components/html.js +0 -78
- package/lib/components/icon.d.ts +0 -7
- package/lib/components/icon.js +0 -35
- package/lib/components/index.d.ts +0 -58
- package/lib/components/index.js +0 -69
- package/lib/components/input.d.ts +0 -10
- package/lib/components/input.js +0 -94
- package/lib/components/item-list.d.ts +0 -10
- package/lib/components/item-list.js +0 -62
- package/lib/components/item-tree.d.ts +0 -13
- package/lib/components/item-tree.js +0 -55
- package/lib/components/lightbox.d.ts +0 -6
- package/lib/components/lightbox.js +0 -92
- package/lib/components/link.d.ts +0 -11
- package/lib/components/link.js +0 -99
- package/lib/components/list.d.ts +0 -9
- package/lib/components/list.js +0 -56
- package/lib/components/modal/confirm.d.ts +0 -12
- package/lib/components/modal/confirm.js +0 -61
- package/lib/components/modal/index.d.ts +0 -4
- package/lib/components/modal/index.js +0 -10
- package/lib/components/modal/modal.d.ts +0 -10
- package/lib/components/modal/modal.js +0 -127
- package/lib/components/not-found.d.ts +0 -9
- package/lib/components/not-found.js +0 -55
- package/lib/components/overlay.d.ts +0 -8
- package/lib/components/overlay.js +0 -73
- package/lib/components/paragraph.d.ts +0 -11
- package/lib/components/paragraph.js +0 -66
- package/lib/components/portal.d.ts +0 -7
- package/lib/components/portal.js +0 -61
- package/lib/components/route-link.d.ts +0 -11
- package/lib/components/route-link.js +0 -115
- package/lib/components/symbol-badge.d.ts +0 -15
- package/lib/components/symbol-badge.js +0 -197
- package/lib/components/tab-stop.d.ts +0 -18
- package/lib/components/tab-stop.js +0 -100
- package/lib/components/text-link.d.ts +0 -8
- package/lib/components/text-link.js +0 -62
- package/lib/components/text.d.ts +0 -4
- package/lib/components/text.js +0 -35
- package/lib/components/timestamp.d.ts +0 -13
- package/lib/components/timestamp.js +0 -39
- package/lib/components/tooltip.d.ts +0 -8
- package/lib/components/tooltip.js +0 -127
- package/lib/components/transition-component.d.ts +0 -30
- package/lib/components/transition-component.js +0 -77
- package/lib/components/typography.d.ts +0 -9
- package/lib/components/typography.js +0 -43
- package/lib/components/widget-link.d.ts +0 -10
- package/lib/components/widget-link.js +0 -116
- package/lib/contexts/index.d.ts +0 -9
- package/lib/contexts/index.js +0 -15
- package/lib/create-react-component.d.ts +0 -11
- package/lib/create-react-component.js +0 -18
- package/lib/hooks/index.d.ts +0 -27
- package/lib/hooks/index.js +0 -58
- package/lib/hooks/use-action.d.ts +0 -4
- package/lib/hooks/use-action.js +0 -21
- package/lib/hooks/use-children.d.ts +0 -4
- package/lib/hooks/use-children.js +0 -70
- package/lib/hooks/use-columns.d.ts +0 -2
- package/lib/hooks/use-columns.js +0 -6
- package/lib/hooks/use-component-descriptor.d.ts +0 -2
- package/lib/hooks/use-component-descriptor.js +0 -6
- package/lib/hooks/use-component-node.d.ts +0 -6
- package/lib/hooks/use-component-node.js +0 -37
- package/lib/hooks/use-component-platform.d.ts +0 -4
- package/lib/hooks/use-component-platform.js +0 -39
- package/lib/hooks/use-component.d.ts +0 -3
- package/lib/hooks/use-component.js +0 -57
- package/lib/hooks/use-container.d.ts +0 -2
- package/lib/hooks/use-container.js +0 -6
- package/lib/hooks/use-context.d.ts +0 -3
- package/lib/hooks/use-context.js +0 -50
- package/lib/hooks/use-dispatch.d.ts +0 -3
- package/lib/hooks/use-dispatch.js +0 -64
- package/lib/hooks/use-event-listener.d.ts +0 -2
- package/lib/hooks/use-event-listener.js +0 -21
- package/lib/hooks/use-events.d.ts +0 -3
- package/lib/hooks/use-events.js +0 -12
- package/lib/hooks/use-is-mounted.d.ts +0 -3
- package/lib/hooks/use-is-mounted.js +0 -14
- package/lib/hooks/use-key-press.d.ts +0 -2
- package/lib/hooks/use-key-press.js +0 -46
- package/lib/hooks/use-layout.d.ts +0 -3
- package/lib/hooks/use-layout.js +0 -50
- package/lib/hooks/use-previous.d.ts +0 -2
- package/lib/hooks/use-previous.js +0 -11
- package/lib/hooks/use-properties.d.ts +0 -6
- package/lib/hooks/use-properties.js +0 -9
- package/lib/hooks/use-render-state.d.ts +0 -4
- package/lib/hooks/use-render-state.js +0 -70
- package/lib/hooks/use-route-data.d.ts +0 -4
- package/lib/hooks/use-route-data.js +0 -58
- package/lib/hooks/use-router.d.ts +0 -3
- package/lib/hooks/use-router.js +0 -9
- package/lib/hooks/use-scroll.d.ts +0 -2
- package/lib/hooks/use-scroll.js +0 -71
- package/lib/hooks/use-settings.d.ts +0 -3
- package/lib/hooks/use-settings.js +0 -38
- package/lib/hooks/use-toggle.d.ts +0 -2
- package/lib/hooks/use-toggle.js +0 -28
- package/lib/hooks/use-transition-end.d.ts +0 -2
- package/lib/hooks/use-transition-end.js +0 -62
- package/lib/hooks/use-unique-menu.d.ts +0 -2
- package/lib/hooks/use-unique-menu.js +0 -15
- package/lib/hooks/use-widget-event.d.ts +0 -3
- package/lib/hooks/use-widget-event.js +0 -21
- package/lib/index.d.ts +0 -9
- package/lib/index.js +0 -98
- package/lib/styles.d.ts +0 -19
- package/lib/styles.js +0 -53
- package/lib/utils/animations.d.ts +0 -18
- package/lib/utils/animations.js +0 -104
- package/lib/utils/browser.d.ts +0 -12
- package/lib/utils/browser.js +0 -54
- package/lib/utils/convert-to-string-attributes.d.ts +0 -2
- package/lib/utils/convert-to-string-attributes.js +0 -23
- package/lib/utils/create-empty-component.d.ts +0 -3
- package/lib/utils/create-empty-component.js +0 -25
- package/lib/utils/embedded-link-mapper.d.ts +0 -3
- package/lib/utils/embedded-link-mapper.js +0 -62
- package/lib/utils/filter-css-props.d.ts +0 -8
- package/lib/utils/filter-css-props.js +0 -28
- package/lib/utils/generic-hash-link.d.ts +0 -8
- package/lib/utils/generic-hash-link.js +0 -70
- package/lib/utils/heading-styles.d.ts +0 -1
- package/lib/utils/heading-styles.js +0 -48
- package/lib/utils/index.d.ts +0 -12
- package/lib/utils/index.js +0 -28
- package/lib/utils/process-html-string.d.ts +0 -4
- package/lib/utils/process-html-string.js +0 -16
- package/lib/utils/render-instructions.d.ts +0 -8
- package/lib/utils/render-instructions.js +0 -19
- package/lib-esm/components/anchor-link.js +0 -5
- package/lib-esm/components/button.js +0 -36
- package/lib-esm/components/checkbox.js +0 -34
- package/lib-esm/components/drawer/drawer.js +0 -121
- package/lib-esm/components/drawer/index.js +0 -3
- package/lib-esm/components/dropdown/dropdown.js +0 -127
- package/lib-esm/components/dropdown/index.js +0 -3
- package/lib-esm/components/dropdown/use-position.js +0 -53
- package/lib-esm/components/empty.js +0 -35
- package/lib-esm/components/grid.js +0 -36
- package/lib-esm/components/html.js +0 -53
- package/lib-esm/components/icon.js +0 -30
- package/lib-esm/components/index.js +0 -30
- package/lib-esm/components/input.js +0 -69
- package/lib-esm/components/item-list.js +0 -34
- package/lib-esm/components/item-tree.js +0 -50
- package/lib-esm/components/lightbox.js +0 -64
- package/lib-esm/components/link.js +0 -71
- package/lib-esm/components/list.js +0 -31
- package/lib-esm/components/modal/confirm.js +0 -33
- package/lib-esm/components/modal/index.js +0 -3
- package/lib-esm/components/modal/modal.js +0 -99
- package/lib-esm/components/not-found.js +0 -27
- package/lib-esm/components/overlay.js +0 -45
- package/lib-esm/components/paragraph.js +0 -38
- package/lib-esm/components/portal.js +0 -36
- package/lib-esm/components/route-link.js +0 -90
- package/lib-esm/components/symbol-badge.js +0 -192
- package/lib-esm/components/tab-stop.js +0 -75
- package/lib-esm/components/text-link.js +0 -34
- package/lib-esm/components/text.js +0 -30
- package/lib-esm/components/timestamp.js +0 -33
- package/lib-esm/components/tooltip.js +0 -99
- package/lib-esm/components/transition-component.js +0 -72
- package/lib-esm/components/typography.js +0 -38
- package/lib-esm/components/widget-link.js +0 -88
- package/lib-esm/contexts/index.js +0 -12
- package/lib-esm/create-react-component.js +0 -16
- package/lib-esm/hooks/index.js +0 -26
- package/lib-esm/hooks/use-action.js +0 -14
- package/lib-esm/hooks/use-children.js +0 -65
- package/lib-esm/hooks/use-columns.js +0 -4
- package/lib-esm/hooks/use-component-descriptor.js +0 -4
- package/lib-esm/hooks/use-component-node.js +0 -35
- package/lib-esm/hooks/use-component-platform.js +0 -34
- package/lib-esm/hooks/use-component.js +0 -52
- package/lib-esm/hooks/use-container.js +0 -4
- package/lib-esm/hooks/use-context.js +0 -45
- package/lib-esm/hooks/use-dispatch.js +0 -59
- package/lib-esm/hooks/use-event-listener.js +0 -19
- package/lib-esm/hooks/use-events.js +0 -7
- package/lib-esm/hooks/use-is-mounted.js +0 -12
- package/lib-esm/hooks/use-key-press.js +0 -41
- package/lib-esm/hooks/use-layout.js +0 -45
- package/lib-esm/hooks/use-previous.js +0 -9
- package/lib-esm/hooks/use-properties.js +0 -7
- package/lib-esm/hooks/use-render-state.js +0 -65
- package/lib-esm/hooks/use-route-data.js +0 -53
- package/lib-esm/hooks/use-router.js +0 -7
- package/lib-esm/hooks/use-scroll.js +0 -66
- package/lib-esm/hooks/use-settings.js +0 -33
- package/lib-esm/hooks/use-toggle.js +0 -26
- package/lib-esm/hooks/use-transition-end.js +0 -60
- package/lib-esm/hooks/use-unique-menu.js +0 -10
- package/lib-esm/hooks/use-widget-event.js +0 -16
- package/lib-esm/index.js +0 -7
- package/lib-esm/styles.js +0 -26
- package/lib-esm/utils/animations.js +0 -101
- package/lib-esm/utils/browser.js +0 -51
- package/lib-esm/utils/convert-to-string-attributes.js +0 -21
- package/lib-esm/utils/create-empty-component.js +0 -20
- package/lib-esm/utils/embedded-link-mapper.js +0 -57
- package/lib-esm/utils/filter-css-props.js +0 -25
- package/lib-esm/utils/generic-hash-link.js +0 -63
- package/lib-esm/utils/heading-styles.js +0 -44
- package/lib-esm/utils/index.js +0 -10
- package/lib-esm/utils/process-html-string.js +0 -10
- package/lib-esm/utils/render-instructions.js +0 -12
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { appendClassNames } from '@telia-ace/widget-utilities';
|
|
24
|
-
import React, { forwardRef } from 'react';
|
|
25
|
-
import Html from './html';
|
|
26
|
-
import Link from './link';
|
|
27
|
-
import Text from './text';
|
|
28
|
-
export default forwardRef(function (_a, ref) {
|
|
29
|
-
var className = _a.className, description = _a.description, text = _a.text, children = _a.children, other = __rest(_a, ["className", "description", "text", "children"]);
|
|
30
|
-
return (React.createElement(Link, __assign({ className: appendClassNames(className, 'humany-text-link') }, other, { ref: ref }),
|
|
31
|
-
children,
|
|
32
|
-
React.createElement(Text, null, text),
|
|
33
|
-
description ? React.createElement(Html, { html: description, className: "humany-description" }) : null));
|
|
34
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { appendClassNames } from '@telia-ace/widget-utilities';
|
|
24
|
-
import React from 'react';
|
|
25
|
-
import { convertToStringAttributes } from '../utils';
|
|
26
|
-
var Text = function (_a) {
|
|
27
|
-
var className = _a.className, children = _a.children, other = __rest(_a, ["className", "children"]);
|
|
28
|
-
return (React.createElement("span", __assign({ className: appendClassNames(className, 'humany-text') }, convertToStringAttributes(other)), children));
|
|
29
|
-
};
|
|
30
|
-
export default Text;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { appendClassNames } from '@telia-ace/widget-utilities';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export var DateFormats;
|
|
4
|
-
(function (DateFormats) {
|
|
5
|
-
DateFormats["HH_MM"] = "hh:mm";
|
|
6
|
-
DateFormats["YYYY_MM_DD"] = "yyyy-mm-dd";
|
|
7
|
-
DateFormats["YYYY_MM_DD_HH_MM"] = "yyyy-mm-dd hh:mm";
|
|
8
|
-
})(DateFormats || (DateFormats = {}));
|
|
9
|
-
var Timestamp = function (_a) {
|
|
10
|
-
var _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.format, format = _c === void 0 ? DateFormats.HH_MM : _c, timestamp = _a.timestamp;
|
|
11
|
-
return (React.createElement("span", { className: appendClassNames(className, 'humany-timestamp') }, formatDate(timestamp, format)));
|
|
12
|
-
};
|
|
13
|
-
export default Timestamp;
|
|
14
|
-
var asTwoDigitString = function (input) {
|
|
15
|
-
return "0".concat(input).slice(-2);
|
|
16
|
-
};
|
|
17
|
-
/* formats date to hh:mm, yyyy-mm-dd or yyyy-mm-dd hh:mm format */
|
|
18
|
-
function formatDate(unformattedDate, format) {
|
|
19
|
-
var date = new Date(unformattedDate);
|
|
20
|
-
var dateArray = date.toTimeString().split(' ')[0].split(':');
|
|
21
|
-
var timeString = dateArray.length > 1 ? "".concat(dateArray[0], ":").concat(dateArray[1]) : dateArray[0];
|
|
22
|
-
var year = date.getFullYear();
|
|
23
|
-
var month = date.getMonth() + 1;
|
|
24
|
-
var day = date.getDate();
|
|
25
|
-
var dateString = "".concat(year, "-").concat(asTwoDigitString(month), "-").concat(asTwoDigitString(day));
|
|
26
|
-
if (format === DateFormats.YYYY_MM_DD) {
|
|
27
|
-
return dateString;
|
|
28
|
-
}
|
|
29
|
-
if (format === DateFormats.HH_MM) {
|
|
30
|
-
return timeString;
|
|
31
|
-
}
|
|
32
|
-
return "".concat(dateString, " ").concat(timeString);
|
|
33
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
-
return cooked;
|
|
4
|
-
};
|
|
5
|
-
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, { useCallback, useEffect, useRef, useState } from 'react';
|
|
45
|
-
import styled from 'styled-components';
|
|
46
|
-
import { useCursorPosition } from './dropdown';
|
|
47
|
-
import Portal from './portal';
|
|
48
|
-
var Tooltip = function (_a) {
|
|
49
|
-
var className = _a.className, children = _a.children, content = _a.content, _b = _a.sticky, sticky = _b === void 0 ? false : _b, other = __rest(_a, ["className", "children", "content", "sticky"]);
|
|
50
|
-
var _c = __read(useState(false), 2), open = _c[0], setOpen = _c[1];
|
|
51
|
-
var id = useRef(uuid());
|
|
52
|
-
var ref = useRef();
|
|
53
|
-
var _d = __read(useCursorPosition(open, id.current, ref.current), 2), _e = _d[0], x = _e.x, y = _e.y, set = _d[1];
|
|
54
|
-
var clickHandler = function (event) {
|
|
55
|
-
var target = event.target;
|
|
56
|
-
if (!ref.current || !target) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (ref.current !== target && !ref.current.contains(target)) {
|
|
60
|
-
setOpen(false);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
useEffect(function () {
|
|
64
|
-
if (!sticky) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
window.addEventListener('click', clickHandler);
|
|
68
|
-
return function () {
|
|
69
|
-
window.removeEventListener('click', clickHandler);
|
|
70
|
-
};
|
|
71
|
-
}, [open, sticky]);
|
|
72
|
-
var handleMouseEvent = useCallback(function (e, value) {
|
|
73
|
-
set(e, ref.current);
|
|
74
|
-
setOpen(value);
|
|
75
|
-
}, [set, setOpen]);
|
|
76
|
-
return (React.createElement(Trigger, { ref: ref, className: "humany-tooltip-trigger", onMouseEnter: !sticky ? function (e) { return handleMouseEvent(e, true); } : undefined, onMouseLeave: !sticky ? function (e) { return handleMouseEvent(e, false); } : undefined, onTouchEnd: sticky ? function (e) { return handleMouseEvent(e, !open); } : undefined, onClick: sticky ? function (e) { return handleMouseEvent(e, !open); } : undefined },
|
|
77
|
-
children,
|
|
78
|
-
open && (React.createElement(Portal, null,
|
|
79
|
-
React.createElement(TooltipContainer, __assign({ className: appendClassNames(className, 'humany-tooltip-container'), x: x, y: y }, other), content)))));
|
|
80
|
-
};
|
|
81
|
-
var Trigger = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n"], ["\n display: flex;\n align-items: center;\n"])));
|
|
82
|
-
var TooltipContainer = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n color: #ffffff;\n background: #161616;\n border-radius: ", ";\n padding: calc(", " * 2);\n font-size: ", ";\n font-family: ", ";\n position: absolute;\n z-index: 10;\n\n a {\n color: ", ";\n text-decoration: none;\n }\n\n i,\n svg {\n margin-right: ", ";\n }\n\n ", ";\n"], ["\n color: #ffffff;\n background: #161616;\n border-radius: ", ";\n padding: calc(", " * 2);\n font-size: ", ";\n font-family: ", ";\n position: absolute;\n z-index: 10;\n\n a {\n color: ", ";\n text-decoration: none;\n }\n\n i,\n svg {\n margin-right: ", ";\n }\n\n ", ";\n"])), function (p) { return p.theme.borderRadius; }, 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.fonts) === null || _a === void 0 ? void 0 : _a.type; }, function (p) { return (p.color ? p.color : 'inherit'); }, function (p) { return p.theme.sizes.small; }, function (p) {
|
|
83
|
-
var css = '';
|
|
84
|
-
if (p.y > 0) {
|
|
85
|
-
css += "top: calc(2px + ".concat(p.y || '0', "px);");
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
css += "bottom: 2px;";
|
|
89
|
-
}
|
|
90
|
-
if (p.x > 0) {
|
|
91
|
-
css += "right: calc(2px + ".concat(p.x || '0', "px);");
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
css += "left: 2px;";
|
|
95
|
-
}
|
|
96
|
-
return css;
|
|
97
|
-
});
|
|
98
|
-
export default Tooltip;
|
|
99
|
-
var templateObject_1, templateObject_2;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Transition } from 'react-transition-group';
|
|
3
|
-
import { transitionComposer } from '../utils';
|
|
4
|
-
/**
|
|
5
|
-
* Wrapper component for Transition from 'react-transition-group'
|
|
6
|
-
* Controls animated enter/exit transitions of a child component bu dynamically creating
|
|
7
|
-
* css that is forwarded to the child component.
|
|
8
|
-
*
|
|
9
|
-
* TODO:
|
|
10
|
-
* Extend to accept more specific transitions (TransitionStateSettings) to enable different
|
|
11
|
-
* enter and exit animations, timings and easings
|
|
12
|
-
*/
|
|
13
|
-
var TransitionComponent = function (props) {
|
|
14
|
-
var inState = props.in, _a = props.mountOnEnter, mountOnEnter = _a === void 0 ? true : _a, _b = props.unmountOnExit, unmountOnExit = _b === void 0 ? true : _b, timeout = props.timeout, children = props.children, transitions = props.transitions;
|
|
15
|
-
var generateTransitionDefinition = function () {
|
|
16
|
-
var _a, _b;
|
|
17
|
-
if (!transitions || transitions === 'none') {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
if (typeof transitions === 'string') {
|
|
21
|
-
return {
|
|
22
|
-
enter: {
|
|
23
|
-
transitionKeys: transitions,
|
|
24
|
-
duration: !!timeout
|
|
25
|
-
? typeof timeout === 'number'
|
|
26
|
-
? timeout
|
|
27
|
-
: timeout.enter
|
|
28
|
-
: 200,
|
|
29
|
-
easing: 'ease-in',
|
|
30
|
-
},
|
|
31
|
-
exit: {
|
|
32
|
-
transitionKeys: transitions,
|
|
33
|
-
duration: !!timeout
|
|
34
|
-
? typeof timeout === 'number'
|
|
35
|
-
? timeout
|
|
36
|
-
: timeout.exit
|
|
37
|
-
: 200,
|
|
38
|
-
easing: 'ease-out',
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
if (typeof transitions === 'object') {
|
|
43
|
-
var enter = transitions.enter, exit = transitions.exit;
|
|
44
|
-
return {
|
|
45
|
-
enter: {
|
|
46
|
-
transitionKeys: (_a = transitions.enter) === null || _a === void 0 ? void 0 : _a.type,
|
|
47
|
-
duration: !!timeout
|
|
48
|
-
? typeof timeout === 'number'
|
|
49
|
-
? timeout
|
|
50
|
-
: timeout.enter
|
|
51
|
-
: 200,
|
|
52
|
-
easing: !!enter.easing ? enter.easing : 'ease-in',
|
|
53
|
-
},
|
|
54
|
-
exit: {
|
|
55
|
-
transitionKeys: (_b = transitions.enter) === null || _b === void 0 ? void 0 : _b.type,
|
|
56
|
-
duration: !!timeout
|
|
57
|
-
? typeof timeout === 'number'
|
|
58
|
-
? timeout
|
|
59
|
-
: timeout.enter
|
|
60
|
-
: 200,
|
|
61
|
-
easing: !!exit.easing ? exit.easing : 'ease-out',
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
var def = generateTransitionDefinition();
|
|
67
|
-
return (React.createElement(Transition, { timeout: {
|
|
68
|
-
enter: (def && def.enter.duration) || 0,
|
|
69
|
-
exit: (def && def.exit.duration) || 0,
|
|
70
|
-
}, in: inState, appear: true, mountOnEnter: mountOnEnter, unmountOnExit: unmountOnExit, onEnter: function (node) { return node.clientHeight; } }, function (state) { return children && children(state, def && transitionComposer.compose(state, def)); }));
|
|
71
|
-
};
|
|
72
|
-
export default TransitionComponent;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
-
return cooked;
|
|
4
|
-
};
|
|
5
|
-
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 React from 'react';
|
|
17
|
-
import styled from 'styled-components';
|
|
18
|
-
import { useContext } from '../hooks';
|
|
19
|
-
var defaultVariantMapping = {
|
|
20
|
-
h1: 'h1',
|
|
21
|
-
h2: 'h2',
|
|
22
|
-
h3: 'h3',
|
|
23
|
-
h4: 'h4',
|
|
24
|
-
h5: 'h5',
|
|
25
|
-
h6: 'h6',
|
|
26
|
-
p: 'p',
|
|
27
|
-
span: 'span',
|
|
28
|
-
};
|
|
29
|
-
var Typography = function (_a) {
|
|
30
|
-
var variant = _a.variant, component = _a.component, className = _a.className, children = _a.children;
|
|
31
|
-
var _b = useContext().typographyVariantMapping, typographyVariantMapping = _b === void 0 ? {} : _b;
|
|
32
|
-
var variantMapping = __assign(__assign({}, defaultVariantMapping), typographyVariantMapping);
|
|
33
|
-
var Component = component || variantMapping[variant] || 'span';
|
|
34
|
-
return (React.createElement(Base, { className: className, as: Component }, children));
|
|
35
|
-
};
|
|
36
|
-
var Base = styled.span(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
37
|
-
export default Typography;
|
|
38
|
-
var templateObject_1;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { WidgetRenderState } from '@telia-ace/widget-core';
|
|
24
|
-
import { appendClassNames } from '@telia-ace/widget-utilities';
|
|
25
|
-
import { WidgetState } from '@webprovisions/platform';
|
|
26
|
-
import React, { forwardRef, useEffect } from 'react';
|
|
27
|
-
import { useContainer } from '../hooks';
|
|
28
|
-
import Link from './link';
|
|
29
|
-
export default forwardRef(function (_a, ref) {
|
|
30
|
-
var className = _a.className, children = _a.children, _b = _a.onClick, onClick = _b === void 0 ? function () { } : _b, widgetName = _a.widgetName, activationOptions = _a.activationOptions, other = __rest(_a, ["className", "children", "onClick", "widgetName", "activationOptions"]);
|
|
31
|
-
var container = useContainer();
|
|
32
|
-
var getWidget = function () {
|
|
33
|
-
var implementation = container.get('$widget').implementation;
|
|
34
|
-
return implementation.widgets.get(widgetName);
|
|
35
|
-
};
|
|
36
|
-
useEffect(function () {
|
|
37
|
-
var widget = getWidget();
|
|
38
|
-
widget === null || widget === void 0 ? void 0 : widget.activate(activationOptions).then(function () { return widget.invoke('attach'); });
|
|
39
|
-
return function () {
|
|
40
|
-
widget === null || widget === void 0 ? void 0 : widget.deactivate();
|
|
41
|
-
};
|
|
42
|
-
}, [widgetName]);
|
|
43
|
-
var openWidget = function (e) {
|
|
44
|
-
var widget = getWidget();
|
|
45
|
-
var target = e.currentTarget;
|
|
46
|
-
if (widget) {
|
|
47
|
-
var toggle = function () {
|
|
48
|
-
widget
|
|
49
|
-
.invoke('renderState')
|
|
50
|
-
.then(function (renderState) {
|
|
51
|
-
return renderState === WidgetRenderState.open
|
|
52
|
-
? widget.invoke('close')
|
|
53
|
-
: widget.invoke('open');
|
|
54
|
-
})
|
|
55
|
-
.then(function () {
|
|
56
|
-
widget.events.subscribeOnce('widget:area-rendered', function (event, data) {
|
|
57
|
-
var widgetDOMElement = container.get('widgetDOMElement');
|
|
58
|
-
if (widgetDOMElement) {
|
|
59
|
-
widget.events.dispatch('widget:modal-opened', {
|
|
60
|
-
name: widget.name,
|
|
61
|
-
ref: target,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
if (widget.state === WidgetState.Deactivated) {
|
|
68
|
-
widget
|
|
69
|
-
.activate(activationOptions)
|
|
70
|
-
.then(function () { return widget.invoke('attach'); })
|
|
71
|
-
.then(toggle);
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
toggle();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
var onEnter = function (e) {
|
|
79
|
-
if (e.key === 'Enter') {
|
|
80
|
-
e.preventDefault();
|
|
81
|
-
openWidget(e);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
return (React.createElement(Link, __assign({ className: appendClassNames(className, 'humany-widget-link'), onKeyDown: onEnter, onClick: function (e) {
|
|
85
|
-
onClick(e);
|
|
86
|
-
openWidget(e);
|
|
87
|
-
} }, other, { ref: ref }), children));
|
|
88
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Container } from '@webprovisions/platform';
|
|
2
|
-
import { createContext } from 'react';
|
|
3
|
-
export var ContainerContext = createContext(new Container());
|
|
4
|
-
export var ColumnContext = createContext(1);
|
|
5
|
-
export var ComponentNodeContext = createContext({
|
|
6
|
-
id: '',
|
|
7
|
-
type: '',
|
|
8
|
-
name: '',
|
|
9
|
-
branch: '',
|
|
10
|
-
});
|
|
11
|
-
export var ComponentPropertyContext = createContext({});
|
|
12
|
-
export var RoutingContext = createContext(null);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { extendComponent, } from '@telia-ace/widget-core';
|
|
2
|
-
import { lazy } from 'react';
|
|
3
|
-
/**
|
|
4
|
-
* Registers a React component on the component platform.
|
|
5
|
-
* @param container Container to register the component on.
|
|
6
|
-
* @param type Type name to resolve the component from configuration.
|
|
7
|
-
* @param reactComponent Promise resolving to the React component for rendering.
|
|
8
|
-
* @param fn Handler for controlling the component.
|
|
9
|
-
*/
|
|
10
|
-
var createReactComponent = function (container, type, reactComponent, fn, options) {
|
|
11
|
-
return container.getAsync('componentResolver').then(function (componentResolver) {
|
|
12
|
-
componentResolver.registerComponent(type, lazy(function () { return reactComponent; }));
|
|
13
|
-
return extendComponent(container, type, fn || (function () { }), type, options);
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
export default createReactComponent;
|
package/lib-esm/hooks/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export { default as useAction } from './use-action';
|
|
2
|
-
export { default as useChildren } from './use-children';
|
|
3
|
-
export { default as useColumns } from './use-columns';
|
|
4
|
-
export { default as useComponent } from './use-component';
|
|
5
|
-
export { default as useComponentDescriptor } from './use-component-descriptor';
|
|
6
|
-
export { default as useComponentNode } from './use-component-node';
|
|
7
|
-
export { default as useComponentPlatform } from './use-component-platform';
|
|
8
|
-
export { default as useContainer } from './use-container';
|
|
9
|
-
export { default as useContext } from './use-context';
|
|
10
|
-
export { default as useDispatch } from './use-dispatch';
|
|
11
|
-
export { default as useEventListener } from './use-event-listener';
|
|
12
|
-
export { default as useEvents } from './use-events';
|
|
13
|
-
export { default as useIsMounted } from './use-is-mounted';
|
|
14
|
-
export { default as useKeyPress } from './use-key-press';
|
|
15
|
-
export { default as useLayout } from './use-layout';
|
|
16
|
-
export { default as usePrevious } from './use-previous';
|
|
17
|
-
export { default as useProperties } from './use-properties';
|
|
18
|
-
export { default as useRenderState } from './use-render-state';
|
|
19
|
-
export { default as useRouteData } from './use-route-data';
|
|
20
|
-
export { default as useRouter } from './use-router';
|
|
21
|
-
export { default as useScroll } from './use-scroll';
|
|
22
|
-
export { default as useSettings } from './use-settings';
|
|
23
|
-
export { default as useToggle } from './use-toggle';
|
|
24
|
-
export { default as useTransitionEnd } from './use-transition-end';
|
|
25
|
-
export { default as useUniqueMenu } from './use-unique-menu';
|
|
26
|
-
export { default as useWidgetEvent } from './use-widget-event';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import useComponentDescriptor from './use-component-descriptor';
|
|
2
|
-
import useContainer from './use-container';
|
|
3
|
-
export var useAction = function (passedOrigin, passedContainer) {
|
|
4
|
-
var origin = useComponentDescriptor().id;
|
|
5
|
-
var container = useContainer();
|
|
6
|
-
return function (action, value) {
|
|
7
|
-
(passedContainer || container)
|
|
8
|
-
.getAsync('actionResolver')
|
|
9
|
-
.then(function (resolver) {
|
|
10
|
-
resolver.action(passedOrigin || origin, action, value);
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export default useAction;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
-
if (!m) return o;
|
|
4
|
-
var i = m.call(o), r, ar = [], e;
|
|
5
|
-
try {
|
|
6
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
-
}
|
|
8
|
-
catch (error) { e = { error: error }; }
|
|
9
|
-
finally {
|
|
10
|
-
try {
|
|
11
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
-
}
|
|
13
|
-
finally { if (e) throw e.error; }
|
|
14
|
-
}
|
|
15
|
-
return ar;
|
|
16
|
-
};
|
|
17
|
-
import { asDescriptor, createEventSubscriber, } from '@telia-ace/widget-core';
|
|
18
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
19
|
-
import useComponentNode from './use-component-node';
|
|
20
|
-
import useComponentPlatform from './use-component-platform';
|
|
21
|
-
import useIsMounted from './use-is-mounted';
|
|
22
|
-
var useChildren = function () {
|
|
23
|
-
var node = useComponentNode();
|
|
24
|
-
var components = useComponentPlatform();
|
|
25
|
-
var _a = __read(useState([]), 2), children = _a[0], setChildren = _a[1];
|
|
26
|
-
var isMounted = useIsMounted();
|
|
27
|
-
var updateChildren = useCallback(function (node) {
|
|
28
|
-
if (components && isMounted.current) {
|
|
29
|
-
var branch = components.getBranch(node);
|
|
30
|
-
var children_1 = node.getChildren(branch).map(function (child) { return asDescriptor(child); });
|
|
31
|
-
setChildren(children_1);
|
|
32
|
-
}
|
|
33
|
-
}, [isMounted, components, setChildren]);
|
|
34
|
-
useEffect(function () {
|
|
35
|
-
if (node) {
|
|
36
|
-
updateChildren(node);
|
|
37
|
-
}
|
|
38
|
-
}, [node, components]);
|
|
39
|
-
useEffect(function () {
|
|
40
|
-
if (components) {
|
|
41
|
-
var _a = __read(createEventSubscriber(components.events), 2), subscribe = _a[0], unsubscribe_1 = _a[1];
|
|
42
|
-
subscribe('components:set-layout', function (event, data) {
|
|
43
|
-
if (node === data.node.parent || data.node.parent === components.nodes.root) {
|
|
44
|
-
updateChildren(data.node.parent);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
subscribe('components:node-appended', function (event, data) {
|
|
48
|
-
if (node === data.node.parent || data.node.parent === components.nodes.root) {
|
|
49
|
-
updateChildren(data.node.parent);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
subscribe('components:node-removed', function (event, _a) {
|
|
53
|
-
var parentNode = _a.parentNode;
|
|
54
|
-
if (parentNode === node || parentNode === components.nodes.root) {
|
|
55
|
-
updateChildren(parentNode);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
return function () {
|
|
59
|
-
unsubscribe_1();
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
}, [node, components, updateChildren]);
|
|
63
|
-
return children;
|
|
64
|
-
};
|
|
65
|
-
export default useChildren;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
-
if (!m) return o;
|
|
4
|
-
var i = m.call(o), r, ar = [], e;
|
|
5
|
-
try {
|
|
6
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
-
}
|
|
8
|
-
catch (error) { e = { error: error }; }
|
|
9
|
-
finally {
|
|
10
|
-
try {
|
|
11
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
-
}
|
|
13
|
-
finally { if (e) throw e.error; }
|
|
14
|
-
}
|
|
15
|
-
return ar;
|
|
16
|
-
};
|
|
17
|
-
import { useContext, useEffect, useState } from 'react';
|
|
18
|
-
import { useComponentPlatform } from '.';
|
|
19
|
-
import { ComponentNodeContext } from '../contexts';
|
|
20
|
-
/**
|
|
21
|
-
* Provides the `ComponentNode` for the current context.
|
|
22
|
-
*/
|
|
23
|
-
var useComponentNode = function (id) {
|
|
24
|
-
var descriptor = useContext(ComponentNodeContext);
|
|
25
|
-
var components = useComponentPlatform();
|
|
26
|
-
var _a = __read(useState(), 2), node = _a[0], setNode = _a[1];
|
|
27
|
-
useEffect(function () {
|
|
28
|
-
if ((id || descriptor.id) && components) {
|
|
29
|
-
var node_1 = components.nodes.get(id || descriptor.id);
|
|
30
|
-
setNode(node_1);
|
|
31
|
-
}
|
|
32
|
-
}, [id, descriptor.id, components]);
|
|
33
|
-
return node;
|
|
34
|
-
};
|
|
35
|
-
export default useComponentNode;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
-
if (!m) return o;
|
|
4
|
-
var i = m.call(o), r, ar = [], e;
|
|
5
|
-
try {
|
|
6
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
-
}
|
|
8
|
-
catch (error) { e = { error: error }; }
|
|
9
|
-
finally {
|
|
10
|
-
try {
|
|
11
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
-
}
|
|
13
|
-
finally { if (e) throw e.error; }
|
|
14
|
-
}
|
|
15
|
-
return ar;
|
|
16
|
-
};
|
|
17
|
-
import { ComponentPlatform } from '@telia-ace/widget-core';
|
|
18
|
-
import { useEffect, useState } from 'react';
|
|
19
|
-
import useContainer from './use-container';
|
|
20
|
-
import useIsMounted from './use-is-mounted';
|
|
21
|
-
var useComponentPlatform = function (passedContainer) {
|
|
22
|
-
var container = useContainer();
|
|
23
|
-
var _a = __read(useState(null), 2), componentPlatform = _a[0], setComponentPlatform = _a[1];
|
|
24
|
-
var isMounted = useIsMounted();
|
|
25
|
-
useEffect(function () {
|
|
26
|
-
ComponentPlatform.getInstance(passedContainer || container).then(function (platform) {
|
|
27
|
-
if (isMounted.current) {
|
|
28
|
-
setComponentPlatform(platform);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}, [isMounted]);
|
|
32
|
-
return componentPlatform;
|
|
33
|
-
};
|
|
34
|
-
export default useComponentPlatform;
|