@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,53 @@
|
|
|
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 { useCallback, useEffect, useState } from 'react';
|
|
18
|
+
export var usePosition = function (visible, id, element) {
|
|
19
|
+
var _a = __read(useState(0), 2), posX = _a[0], setPosX = _a[1];
|
|
20
|
+
var _b = __read(useState(0), 2), posY = _b[0], setPosY = _b[1];
|
|
21
|
+
var set = useCallback(function (event, trigger) {
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
if (trigger) {
|
|
24
|
+
var clientRect = trigger.getBoundingClientRect();
|
|
25
|
+
setPosX(Math.max(document.body.clientWidth - clientRect.right, 1));
|
|
26
|
+
setPosY(clientRect.bottom + window.scrollY);
|
|
27
|
+
}
|
|
28
|
+
}, [posX, posY, setPosX, setPosY]);
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
if (!element || !visible) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
var clientRect = element.getBoundingClientRect();
|
|
34
|
+
var newPos = {
|
|
35
|
+
x: posX,
|
|
36
|
+
y: posY,
|
|
37
|
+
};
|
|
38
|
+
if (clientRect.left < 0) {
|
|
39
|
+
newPos.x = 0;
|
|
40
|
+
}
|
|
41
|
+
if (clientRect.bottom > window.innerHeight) {
|
|
42
|
+
newPos.y = 0;
|
|
43
|
+
}
|
|
44
|
+
if (newPos.x !== posX) {
|
|
45
|
+
setPosX(newPos.x);
|
|
46
|
+
}
|
|
47
|
+
if (newPos.y !== posY) {
|
|
48
|
+
setPosY(newPos.y);
|
|
49
|
+
}
|
|
50
|
+
}, [element, visible, id]);
|
|
51
|
+
return [{ x: posX, y: posY }, set];
|
|
52
|
+
};
|
|
53
|
+
export default usePosition;
|
|
@@ -0,0 +1,35 @@
|
|
|
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 from 'react';
|
|
28
|
+
import styled from 'styled-components';
|
|
29
|
+
var Empty = function (_a) {
|
|
30
|
+
var other = __rest(_a, []);
|
|
31
|
+
return React.createElement(Wrapper, __assign({}, other));
|
|
32
|
+
};
|
|
33
|
+
export default Empty;
|
|
34
|
+
var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
|
|
35
|
+
var templateObject_1;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type Props = Merge<React.ComponentProps<'div'>, {
|
|
3
|
+
columns: number;
|
|
4
|
+
gap: string;
|
|
5
|
+
}>;
|
|
6
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "columns" | "gap"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
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, filterCssProps, filterCssPropsStyle } from '../utils';
|
|
31
|
+
export default forwardRef(function (_a, ref) {
|
|
32
|
+
var children = _a.children, columns = _a.columns, gap = _a.gap, className = _a.className, other = __rest(_a, ["children", "columns", "gap", "className"]);
|
|
33
|
+
return (React.createElement(Div, __assign({ className: appendClassNames(className, 'humany-grid'), "data-columns": columns, "data-gap": gap }, filterCssProps(other), convertToStringAttributes(other), { ref: ref }), children));
|
|
34
|
+
});
|
|
35
|
+
var Div = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: grid;\n grid-template-columns: repeat(", ", 1fr);\n grid-gap: ", ";\n justify-content: center;\n grid-auto-rows: max-content;\n ", "\n"], ["\n display: grid;\n grid-template-columns: repeat(", ", 1fr);\n grid-gap: ", ";\n justify-content: center;\n grid-auto-rows: max-content;\n ", "\n"])), function (p) { return p['data-columns']; }, function (p) { return p['data-gap']; }, filterCssPropsStyle);
|
|
36
|
+
var templateObject_1;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type HtmlParseInstruction = {
|
|
3
|
+
transform: {
|
|
4
|
+
[htmlTag: string]: (props: any) => JSX.Element;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export declare type Props = Merge<React.ComponentProps<'div'>, {
|
|
8
|
+
html: string;
|
|
9
|
+
htmlParseInstruction?: HtmlParseInstruction;
|
|
10
|
+
}>;
|
|
11
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "html" | "key" | keyof React.HTMLAttributes<HTMLDivElement> | "htmlParseInstruction"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
24
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
25
|
+
if (!m) return o;
|
|
26
|
+
var i = m.call(o), r, ar = [], e;
|
|
27
|
+
try {
|
|
28
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
29
|
+
}
|
|
30
|
+
catch (error) { e = { error: error }; }
|
|
31
|
+
finally {
|
|
32
|
+
try {
|
|
33
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
34
|
+
}
|
|
35
|
+
finally { if (e) throw e.error; }
|
|
36
|
+
}
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
39
|
+
import { appendClassNames } from '@telia-ace/widget-utilities';
|
|
40
|
+
import React, { forwardRef, useEffect, useState } from 'react';
|
|
41
|
+
import { useContainer } from '../hooks';
|
|
42
|
+
import { convertToStringAttributes, defaultRenderInstructions, processHtmlString } from '../utils';
|
|
43
|
+
export default forwardRef(function (_a, ref) {
|
|
44
|
+
var _b = _a.htmlParseInstruction, htmlParseInstruction = _b === void 0 ? null : _b, className = _a.className, html = _a.html, other = __rest(_a, ["htmlParseInstruction", "className", "html"]);
|
|
45
|
+
var container = useContainer();
|
|
46
|
+
var _c = __read(useState(), 2), processedHtml = _c[0], setProcessedHtml = _c[1];
|
|
47
|
+
useEffect(function () {
|
|
48
|
+
var instructions = htmlParseInstruction || defaultRenderInstructions(container);
|
|
49
|
+
var processed = processHtmlString(html, instructions);
|
|
50
|
+
setProcessedHtml(processed);
|
|
51
|
+
}, [html, htmlParseInstruction]);
|
|
52
|
+
return (React.createElement("div", __assign({ className: appendClassNames(className, 'humany-html') }, convertToStringAttributes(other), { ref: ref }), processedHtml));
|
|
53
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
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 Icon = function (_a) {
|
|
27
|
+
var faIcon = _a.faIcon, title = _a.title, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.role, role = _c === void 0 ? 'presentation' : _c, other = __rest(_a, ["faIcon", "title", "className", "role"]);
|
|
28
|
+
return (React.createElement("i", __assign({ className: appendClassNames(className, "fa fa-".concat(faIcon)), title: title, role: role }, convertToStringAttributes(other))));
|
|
29
|
+
};
|
|
30
|
+
export default Icon;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export { default as AnchorLink } from './anchor-link';
|
|
2
|
+
export { default as Button } from './button';
|
|
3
|
+
export type { Props as ButtonProps } from './button';
|
|
4
|
+
export { default as Checkbox } from './checkbox';
|
|
5
|
+
export type { Props as CheckboxProps } from './checkbox';
|
|
6
|
+
export { AnimationType as DrawerAnimationType, default as Drawer } from './drawer';
|
|
7
|
+
export { default as Dropdown } from './dropdown';
|
|
8
|
+
export type { Props as DropdownProps } from './dropdown';
|
|
9
|
+
export { default as Empty } from './empty';
|
|
10
|
+
export type { Props as EmptyProps } from './empty';
|
|
11
|
+
export { default as Grid } from './grid';
|
|
12
|
+
export type { Props as GridProps } from './grid';
|
|
13
|
+
export { default as Html } from './html';
|
|
14
|
+
export type { HtmlParseInstruction, Props as HtmlProps } from './html';
|
|
15
|
+
export { default as Icon } from './icon';
|
|
16
|
+
export type { Props as IconProps } from './icon';
|
|
17
|
+
export { default as Input } from './input';
|
|
18
|
+
export type { Props as InputProps } from './input';
|
|
19
|
+
export { default as ItemList } from './item-list';
|
|
20
|
+
export type { Props as ItemListProps } from './item-list';
|
|
21
|
+
export { default as ItemTree } from './item-tree';
|
|
22
|
+
export type { Props as ItemTreeProps } from './item-tree';
|
|
23
|
+
export { default as Lightbox } from './lightbox';
|
|
24
|
+
export type { Props as LightboxProps } from './lightbox';
|
|
25
|
+
export { default as Link } from './link';
|
|
26
|
+
export type { Props as LinkProps } from './link';
|
|
27
|
+
export { default as List } from './list';
|
|
28
|
+
export type { ItemRenderer, Props as ListProps } from './list';
|
|
29
|
+
export { Confirm, default as Modal } from './modal';
|
|
30
|
+
export type { ModalProps } from './modal';
|
|
31
|
+
export { default as NotFound } from './not-found';
|
|
32
|
+
export type { Props as NotFoundProps } from './not-found';
|
|
33
|
+
export { default as Overlay } from './overlay';
|
|
34
|
+
export type { Props as OverlayProps } from './overlay';
|
|
35
|
+
export { default as Paragraph } from './paragraph';
|
|
36
|
+
export type { Props as ParagraphProps } from './paragraph';
|
|
37
|
+
export { default as Portal } from './portal';
|
|
38
|
+
export type { Props as PortalProps } from './portal';
|
|
39
|
+
export { default as RouteLink } from './route-link';
|
|
40
|
+
export type { Props as RouteLinkProps } from './route-link';
|
|
41
|
+
export { default as SymbolBadge } from './symbol-badge';
|
|
42
|
+
export type { HtmlIconProps, Props as SymbolBadgeProps, Symbol } from './symbol-badge';
|
|
43
|
+
export { default as TabStop } from './tab-stop';
|
|
44
|
+
export type { Props as TabStopProps } from './tab-stop';
|
|
45
|
+
export { default as Text } from './text';
|
|
46
|
+
export type { Props as TextProps } from './text';
|
|
47
|
+
export { default as TextLink } from './text-link';
|
|
48
|
+
export type { Props as TextLinkProps } from './text-link';
|
|
49
|
+
export { DateFormats, default as Timestamp } from './timestamp';
|
|
50
|
+
export type { Props as TimestampProps } from './timestamp';
|
|
51
|
+
export { default as Tooltip } from './tooltip';
|
|
52
|
+
export type { Props as TooltipProps } from './tooltip';
|
|
53
|
+
export { default as TransitionComponent } from './transition-component';
|
|
54
|
+
export type { Props as TransitionComponentProps } from './transition-component';
|
|
55
|
+
export { default as Typography } from './typography';
|
|
56
|
+
export type { Props as TypographyProps } from './typography';
|
|
57
|
+
export { default as WidgetLink } from './widget-link';
|
|
58
|
+
export type { Props as WidgetLinkProps } from './widget-link';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export { default as AnchorLink } from './anchor-link';
|
|
2
|
+
export { default as Button } from './button';
|
|
3
|
+
export { default as Checkbox } from './checkbox';
|
|
4
|
+
export { AnimationType as DrawerAnimationType, default as Drawer } from './drawer';
|
|
5
|
+
export { default as Dropdown } from './dropdown';
|
|
6
|
+
export { default as Empty } from './empty';
|
|
7
|
+
export { default as Grid } from './grid';
|
|
8
|
+
export { default as Html } from './html';
|
|
9
|
+
export { default as Icon } from './icon';
|
|
10
|
+
export { default as Input } from './input';
|
|
11
|
+
export { default as ItemList } from './item-list';
|
|
12
|
+
export { default as ItemTree } from './item-tree';
|
|
13
|
+
export { default as Lightbox } from './lightbox';
|
|
14
|
+
export { default as Link } from './link';
|
|
15
|
+
export { default as List } from './list';
|
|
16
|
+
export { Confirm, default as Modal } from './modal';
|
|
17
|
+
export { default as NotFound } from './not-found';
|
|
18
|
+
export { default as Overlay } from './overlay';
|
|
19
|
+
export { default as Paragraph } from './paragraph';
|
|
20
|
+
export { default as Portal } from './portal';
|
|
21
|
+
export { default as RouteLink } from './route-link';
|
|
22
|
+
export { default as SymbolBadge } from './symbol-badge';
|
|
23
|
+
export { default as TabStop } from './tab-stop';
|
|
24
|
+
export { default as Text } from './text';
|
|
25
|
+
export { default as TextLink } from './text-link';
|
|
26
|
+
export { DateFormats, default as Timestamp } from './timestamp';
|
|
27
|
+
export { default as Tooltip } from './tooltip';
|
|
28
|
+
export { default as TransitionComponent } from './transition-component';
|
|
29
|
+
export { default as Typography } from './typography';
|
|
30
|
+
export { default as WidgetLink } from './widget-link';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type Props = Merge<React.ComponentProps<'input'>, {
|
|
3
|
+
onChange?: (value: string) => void;
|
|
4
|
+
onEnter?: (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
5
|
+
onEscape?: (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
6
|
+
onFocusChange?: (focused: boolean) => void;
|
|
7
|
+
selectAllOnFocus?: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "form" | "slot" | "style" | "title" | "pattern" | "type" | "name" | "className" | "color" | "height" | "id" | "lang" | "max" | "min" | "width" | "role" | "tabIndex" | "crossOrigin" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "list" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "alt" | "src" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "autoComplete" | "accept" | "capture" | "checked" | "enterKeyHint" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "size" | "step" | "onEnter" | "onEscape" | "onFocusChange" | "selectAllOnFocus"> & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
24
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
25
|
+
if (!m) return o;
|
|
26
|
+
var i = m.call(o), r, ar = [], e;
|
|
27
|
+
try {
|
|
28
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
29
|
+
}
|
|
30
|
+
catch (error) { e = { error: error }; }
|
|
31
|
+
finally {
|
|
32
|
+
try {
|
|
33
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
34
|
+
}
|
|
35
|
+
finally { if (e) throw e.error; }
|
|
36
|
+
}
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
39
|
+
import { appendClassNames } from '@telia-ace/widget-utilities';
|
|
40
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
41
|
+
import { convertToStringAttributes } from '../utils';
|
|
42
|
+
export default forwardRef(function (_a, ref) {
|
|
43
|
+
var _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.autoFocus, autoFocus = _c === void 0 ? false : _c, _d = _a.onFocusChange, onFocusChange = _d === void 0 ? function () { } : _d, _e = _a.onEnter, onEnter = _e === void 0 ? function () { } : _e, _f = _a.onEscape, onEscape = _f === void 0 ? function () { } : _f, selectAllOnFocus = _a.selectAllOnFocus, _g = _a.onChange, onChange = _g === void 0 ? function () { } : _g, _h = _a.disabled, disabled = _h === void 0 ? false : _h, type = _a.type, other = __rest(_a, ["className", "autoFocus", "onFocusChange", "onEnter", "onEscape", "selectAllOnFocus", "onChange", "disabled", "type"]);
|
|
44
|
+
var _j = __read(useState(autoFocus), 2), hasFocus = _j[0], setHasFocus = _j[1];
|
|
45
|
+
var innerRef = useRef();
|
|
46
|
+
useImperativeHandle(ref, function () { return innerRef.current; });
|
|
47
|
+
useEffect(function () {
|
|
48
|
+
var _a;
|
|
49
|
+
if (autoFocus) {
|
|
50
|
+
(_a = innerRef === null || innerRef === void 0 ? void 0 : innerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
51
|
+
}
|
|
52
|
+
}, [autoFocus, ref, innerRef]);
|
|
53
|
+
var handleFocus = function (inFocus, event) {
|
|
54
|
+
setHasFocus(inFocus);
|
|
55
|
+
onFocusChange && onFocusChange(inFocus);
|
|
56
|
+
if (selectAllOnFocus && inFocus) {
|
|
57
|
+
event.target.select();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var props = __assign(__assign({}, convertToStringAttributes(other)), { disabled: disabled, autoFocus: autoFocus, type: type, onKeyDown: function (e) {
|
|
61
|
+
if (e.key === 'Enter' && hasFocus) {
|
|
62
|
+
onEnter(e);
|
|
63
|
+
}
|
|
64
|
+
if (e.key === 'Escape' && hasFocus) {
|
|
65
|
+
onEscape(e);
|
|
66
|
+
}
|
|
67
|
+
}, onFocus: function (e) { return handleFocus(true, e); }, onBlur: function (e) { return handleFocus(false, e); }, onChange: function (e) { return onChange(e.target.value || ''); }, className: appendClassNames(className, 'humany-input'), 'data-type': type });
|
|
68
|
+
return type !== 'textarea' ? (React.createElement("input", __assign({}, props, { ref: innerRef }))) : (React.createElement("textarea", __assign({}, props, { ref: innerRef })));
|
|
69
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Props as ListProps } from './list';
|
|
3
|
+
import { Props as ParagraphProps } from './paragraph';
|
|
4
|
+
export declare type ItemListProps = {
|
|
5
|
+
customHeader?: any;
|
|
6
|
+
ulProps?: any;
|
|
7
|
+
};
|
|
8
|
+
export declare type Props = Merge<ListProps, ParagraphProps> & ItemListProps;
|
|
9
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "symbol" | "header" | "html" | "text" | "key" | keyof React.HTMLAttributes<HTMLDivElement> | "htmlParseInstruction" | "renderItem" | "items" | "renderLi" | keyof ItemListProps> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
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 List from './list';
|
|
27
|
+
import Paragraph from './paragraph';
|
|
28
|
+
export default forwardRef(function (_a, ref) {
|
|
29
|
+
var header = _a.header, customHeader = _a.customHeader, text = _a.text, html = _a.html, className = _a.className, children = _a.children, symbol = _a.symbol, items = _a.items, renderItem = _a.renderItem, renderLi = _a.renderLi, ulProps = _a.ulProps, other = __rest(_a, ["header", "customHeader", "text", "html", "className", "children", "symbol", "items", "renderItem", "renderLi", "ulProps"]);
|
|
30
|
+
return (React.createElement("div", __assign({ className: appendClassNames(className, 'humany-item-list'), "data-item-count": items.length }, convertToStringAttributes(other), { ref: ref }),
|
|
31
|
+
customHeader ? (customHeader) : header || text || html ? (React.createElement(Paragraph, { symbol: symbol, header: header, text: text, html: html })) : null,
|
|
32
|
+
items.length ? (React.createElement(List, __assign({ items: items, renderItem: renderItem, renderLi: renderLi }, ulProps))) : null,
|
|
33
|
+
children));
|
|
34
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type Props = {
|
|
3
|
+
className?: string;
|
|
4
|
+
tree?: any[];
|
|
5
|
+
rootItem?: any;
|
|
6
|
+
renderUnselected?: boolean;
|
|
7
|
+
renderItem: (props: any, level: number, isSelected: boolean) => JSX.Element;
|
|
8
|
+
renderEmpty?: boolean;
|
|
9
|
+
ulProps?: any;
|
|
10
|
+
liProps?: any;
|
|
11
|
+
};
|
|
12
|
+
declare const ItemTree: React.FC<Props>;
|
|
13
|
+
export default ItemTree;
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
import { appendClassNames } from '@telia-ace/widget-utilities';
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { ItemList } from '.';
|
|
15
|
+
import { convertToStringAttributes } from '../utils';
|
|
16
|
+
var ItemTree = function (_a) {
|
|
17
|
+
var _b = _a.className, className = _b === void 0 ? '' : _b, tree = _a.tree, renderItem = _a.renderItem, rootItem = _a.rootItem, _c = _a.renderUnselected, renderUnselected = _c === void 0 ? true : _c, _d = _a.renderEmpty, renderEmpty = _d === void 0 ? true : _d, ulProps = _a.ulProps, liProps = _a.liProps;
|
|
18
|
+
var hasSelectedChildren = function (items) {
|
|
19
|
+
return !checkIfSelected(items);
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Checks if the selected item is actually selected or just expanded by
|
|
23
|
+
* checking if any of its immediate children has selection active
|
|
24
|
+
* @param items
|
|
25
|
+
*/
|
|
26
|
+
var checkIfSelected = function (items) {
|
|
27
|
+
if (!items || items.length < 1) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
return !items.some(function (item) { return !!item.selected; });
|
|
31
|
+
};
|
|
32
|
+
var renderTreeItems = function (treeItems, level) {
|
|
33
|
+
return (React.createElement(ItemList, { className: appendClassNames("humany-item-tree-level-".concat(level)), items: treeItems, ulProps: ulProps, renderItem: function (itemProps) {
|
|
34
|
+
var id = itemProps.id, selected = itemProps.selected, items = itemProps.items, matches = itemProps.matches;
|
|
35
|
+
var isSelected = selected && checkIfSelected(items);
|
|
36
|
+
if (!renderEmpty && !matches) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return (React.createElement("li", __assign({}, convertToStringAttributes(liProps), { key: id, className: 'humany-item-tree-item' }),
|
|
40
|
+
renderItem && renderItem(itemProps, level, isSelected),
|
|
41
|
+
items &&
|
|
42
|
+
(renderUnselected || isSelected) &&
|
|
43
|
+
renderTreeItems(items, level + 1)));
|
|
44
|
+
} }));
|
|
45
|
+
};
|
|
46
|
+
return (React.createElement("div", { className: appendClassNames(className, 'humany-item-tree') },
|
|
47
|
+
rootItem && rootItem(!hasSelectedChildren(tree || [])),
|
|
48
|
+
tree && renderTreeItems(tree, 1)));
|
|
49
|
+
};
|
|
50
|
+
export default ItemTree;
|
|
@@ -0,0 +1,64 @@
|
|
|
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 __read = (this && this.__read) || function (o, n) {
|
|
17
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
18
|
+
if (!m) return o;
|
|
19
|
+
var i = m.call(o), r, ar = [], e;
|
|
20
|
+
try {
|
|
21
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
22
|
+
}
|
|
23
|
+
catch (error) { e = { error: error }; }
|
|
24
|
+
finally {
|
|
25
|
+
try {
|
|
26
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
27
|
+
}
|
|
28
|
+
finally { if (e) throw e.error; }
|
|
29
|
+
}
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
import React, { useCallback, useEffect } from 'react';
|
|
33
|
+
import styled from 'styled-components';
|
|
34
|
+
import { useKeyPress, useToggle } from '../hooks';
|
|
35
|
+
import Button from './button';
|
|
36
|
+
import Overlay from './overlay';
|
|
37
|
+
import SymbolBadge from './symbol-badge';
|
|
38
|
+
var Lightbox = function (_a) {
|
|
39
|
+
var attrs = _a.attrs;
|
|
40
|
+
var _b = __read(useToggle(false), 2), visible = _b[0], toggleVisible = _b[1];
|
|
41
|
+
var esc = useKeyPress('Escape');
|
|
42
|
+
useEffect(function () {
|
|
43
|
+
if (esc) {
|
|
44
|
+
toggleVisible(false);
|
|
45
|
+
}
|
|
46
|
+
}, [esc]);
|
|
47
|
+
var overlayClick = useCallback(function (e) {
|
|
48
|
+
toggleVisible(false);
|
|
49
|
+
}, [toggleVisible]);
|
|
50
|
+
return (React.createElement(React.Fragment, null,
|
|
51
|
+
React.createElement(Overlay, { visible: visible, onClick: overlayClick },
|
|
52
|
+
React.createElement(CloseButton, { onClick: function () { return toggleVisible(false); } },
|
|
53
|
+
React.createElement(StyledSymbolBadge, { size: 24, symbol: { type: 'Svg', content: 'close' } })),
|
|
54
|
+
React.createElement(Content, null,
|
|
55
|
+
React.createElement("img", __assign({}, attrs)))),
|
|
56
|
+
React.createElement("a", { onClick: function () { return toggleVisible(); } },
|
|
57
|
+
React.createElement(Thumbnail, __assign({}, attrs)))));
|
|
58
|
+
};
|
|
59
|
+
var Content = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: ", ";\n max-width: 80%;\n max-height: 80%;\n\n img {\n width: auto !important;\n height: auto !important;\n max-width: 100%;\n max-height: 100%;\n }\n"], ["\n padding: ", ";\n max-width: 80%;\n max-height: 80%;\n\n img {\n width: auto !important;\n height: auto !important;\n max-width: 100%;\n max-height: 100%;\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; });
|
|
60
|
+
var CloseButton = styled(Button)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: fixed;\n top: 50px;\n right: 50px;\n transition: opacity 300ms ease-in-out;\n opacity: 0.7;\n\n &:hover {\n opacity: 1;\n }\n"], ["\n position: fixed;\n top: 50px;\n right: 50px;\n transition: opacity 300ms ease-in-out;\n opacity: 0.7;\n\n &:hover {\n opacity: 1;\n }\n"])));
|
|
61
|
+
var StyledSymbolBadge = styled(SymbolBadge)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n path {\n stroke: #ffffff;\n }\n"], ["\n path {\n stroke: #ffffff;\n }\n"])));
|
|
62
|
+
var Thumbnail = styled.img(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n cursor: pointer;\n"], ["\n cursor: pointer;\n"])));
|
|
63
|
+
export default Lightbox;
|
|
64
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type Props = Merge<React.ComponentProps<'a'>, {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
routeName?: string;
|
|
5
|
+
params?: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
to?: string;
|
|
9
|
+
}>;
|
|
10
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "to" | "key" | keyof React.AnchorHTMLAttributes<HTMLAnchorElement> | "disabled" | "routeName" | "params"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
11
|
+
export default _default;
|