@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
package/dist/index.js
ADDED
|
@@ -0,0 +1,2988 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import styled, { css } from "styled-components";
|
|
33
|
+
import { kebabCase, appendClassNames, uuid, removeNullAndUndefinedValues } from "@telia-ace/widget-utilities";
|
|
34
|
+
import React, { forwardRef, createContext, useContext as useContext$1, useState, useEffect, useRef, useCallback, useImperativeHandle, Component, lazy } from "react";
|
|
35
|
+
import { CSSTransition, Transition } from "react-transition-group";
|
|
36
|
+
import { Container, WidgetState } from "@webprovisions/platform";
|
|
37
|
+
import { ComponentPlatform, asDescriptor, createEventSubscriber, ComponentQuery, WidgetRenderState, extendComponent } from "@telia-ace/widget-core";
|
|
38
|
+
import { createPortal } from "react-dom";
|
|
39
|
+
import convert from "htmr";
|
|
40
|
+
import { HistoryMode, getSpecificWidgetPath } from "@telia-ace/widget-routing";
|
|
41
|
+
import { Link as Link$1 } from "react-router-dom";
|
|
42
|
+
const inEnteringState = (status) => {
|
|
43
|
+
return status === "entering" || status === "entered";
|
|
44
|
+
};
|
|
45
|
+
const inExitingState = (status) => {
|
|
46
|
+
return status === "exiting" || status === "exited";
|
|
47
|
+
};
|
|
48
|
+
const partials = {
|
|
49
|
+
fade: {
|
|
50
|
+
in: "opacity: 1;",
|
|
51
|
+
out: "opacity: 0;"
|
|
52
|
+
},
|
|
53
|
+
"slide-left": {
|
|
54
|
+
in: "transform: translateX(0);",
|
|
55
|
+
out: "transform: translateX(-100%);"
|
|
56
|
+
},
|
|
57
|
+
"slide-right": {
|
|
58
|
+
in: "transform: translateX(0);",
|
|
59
|
+
out: "transform: translateX(100%);"
|
|
60
|
+
},
|
|
61
|
+
"slide-up": {
|
|
62
|
+
in: "transform: translateY(0);",
|
|
63
|
+
out: "transform: translateY(100%);"
|
|
64
|
+
},
|
|
65
|
+
"slide-down": {
|
|
66
|
+
in: "transform: translateY(0);",
|
|
67
|
+
out: "transform: translateY(-100%);"
|
|
68
|
+
},
|
|
69
|
+
scale: {
|
|
70
|
+
in: "transform: scale(1);",
|
|
71
|
+
out: "transform: scale(0);"
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const transformTransitions = ["slide-up", "slide-down", "slide-left", "slide-right", "scale"];
|
|
75
|
+
const transitionComposer = {
|
|
76
|
+
compose: (status = "exited", definitions) => {
|
|
77
|
+
const { enter, exit } = definitions;
|
|
78
|
+
const inKeys = enter.transitionKeys.split(" ");
|
|
79
|
+
const transitionProperty = transformTransitions.indexOf(inKeys[0]) > -1 ? "transform" : "opacity";
|
|
80
|
+
if (inEnteringState(status)) {
|
|
81
|
+
if (inKeys && inKeys.length > 0) {
|
|
82
|
+
return css`
|
|
83
|
+
${inKeys && inKeys.length > 0 && inKeys.map((key) => partials[key] ? partials[key].in : "")}
|
|
84
|
+
transition: ${transitionProperty} ${enter.duration}ms ${enter.easing};
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
87
|
+
return "";
|
|
88
|
+
}
|
|
89
|
+
const inBase = inKeys && inKeys.length > 0 && css`
|
|
90
|
+
${inKeys.map((key) => partials[key] ? partials[key].out : "")}
|
|
91
|
+
`;
|
|
92
|
+
if (inExitingState(status)) {
|
|
93
|
+
const outKeys = exit.transitionKeys.split(" ");
|
|
94
|
+
if (outKeys && outKeys.length > 0 && status === "exiting") {
|
|
95
|
+
return css`
|
|
96
|
+
${inBase};
|
|
97
|
+
${outKeys.map((key) => partials[key] ? partials[key].out : "")}
|
|
98
|
+
transition: ${transitionProperty} ${exit.duration}ms ${exit.easing};
|
|
99
|
+
`;
|
|
100
|
+
}
|
|
101
|
+
return inBase;
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
composeViewTransition: (status, type, direction) => {
|
|
105
|
+
if (type === "slide") {
|
|
106
|
+
return transitionComposer.compose(status, {
|
|
107
|
+
enter: {
|
|
108
|
+
transitionKeys: direction === "forth" ? "slide-right" : "slide-left",
|
|
109
|
+
duration: 500
|
|
110
|
+
},
|
|
111
|
+
exit: {
|
|
112
|
+
transitionKeys: direction === "forth" ? "slide-left" : "slide-right",
|
|
113
|
+
duration: 500
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
if (type === "fade") {
|
|
118
|
+
return transitionComposer.compose(status, {
|
|
119
|
+
enter: {
|
|
120
|
+
transitionKeys: "fade",
|
|
121
|
+
duration: 500
|
|
122
|
+
},
|
|
123
|
+
exit: {
|
|
124
|
+
transitionKeys: "fade",
|
|
125
|
+
duration: 500
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
get: (title) => {
|
|
131
|
+
return partials[title];
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
var Browsers = /* @__PURE__ */ ((Browsers2) => {
|
|
135
|
+
Browsers2["Opera"] = "opera";
|
|
136
|
+
Browsers2["Chrome"] = "chrome";
|
|
137
|
+
Browsers2["Firefox"] = "firefox";
|
|
138
|
+
Browsers2["Safari"] = "safari";
|
|
139
|
+
Browsers2["Edge"] = "edge";
|
|
140
|
+
Browsers2["EdgeChromium"] = "edge-chromium";
|
|
141
|
+
Browsers2["Blink"] = "blink";
|
|
142
|
+
Browsers2["IE"] = "internet-explorer";
|
|
143
|
+
return Browsers2;
|
|
144
|
+
})(Browsers || {});
|
|
145
|
+
var browser = () => {
|
|
146
|
+
const {
|
|
147
|
+
opr,
|
|
148
|
+
opera,
|
|
149
|
+
InstallTrigger,
|
|
150
|
+
HTMLElement,
|
|
151
|
+
safari,
|
|
152
|
+
documentMode,
|
|
153
|
+
StyleMedia,
|
|
154
|
+
chrome,
|
|
155
|
+
CSS
|
|
156
|
+
} = window;
|
|
157
|
+
const isOpera = !!opr && !!opr.addons || !!opera || navigator.userAgent.indexOf(" OPR/") >= 0;
|
|
158
|
+
if (isOpera) {
|
|
159
|
+
return "opera";
|
|
160
|
+
}
|
|
161
|
+
if (InstallTrigger) {
|
|
162
|
+
return "firefox";
|
|
163
|
+
}
|
|
164
|
+
const safariCheck = ((p) => {
|
|
165
|
+
return p.toString() === "[object SafariRemoteNotification]";
|
|
166
|
+
})(!safari || typeof safari !== "undefined" && safari.pushNotification);
|
|
167
|
+
if (/constructor/i.test(HTMLElement) || safariCheck) {
|
|
168
|
+
return "safari";
|
|
169
|
+
}
|
|
170
|
+
const isIE = !!documentMode;
|
|
171
|
+
if (isIE) {
|
|
172
|
+
return "internet-explorer";
|
|
173
|
+
}
|
|
174
|
+
if (!isIE && !!StyleMedia) {
|
|
175
|
+
return "edge";
|
|
176
|
+
}
|
|
177
|
+
const isChrome = !!chrome && (!!chrome.webstore || !!chrome.runtime);
|
|
178
|
+
if (isChrome) {
|
|
179
|
+
return "chrome";
|
|
180
|
+
}
|
|
181
|
+
if (isChrome && navigator.userAgent.indexOf("Edg") !== -1) {
|
|
182
|
+
return "edge-chromium";
|
|
183
|
+
}
|
|
184
|
+
if ((isChrome || isOpera) && !!CSS) {
|
|
185
|
+
return "blink";
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
const types = ["string", "number"];
|
|
189
|
+
var convertToStringAttributes = (props) => {
|
|
190
|
+
return Object.keys(props).reduce((result, key) => {
|
|
191
|
+
const value = typeof props[key] === "undefined" ? "" : props[key];
|
|
192
|
+
const type = typeof value;
|
|
193
|
+
if (types.indexOf(type) > -1) {
|
|
194
|
+
const sub = key.substring(0, 5);
|
|
195
|
+
if (sub === "data-" || sub === "aria-") {
|
|
196
|
+
result[kebabCase(key)] = value.toString();
|
|
197
|
+
} else if (key.substring(0, 4) !== "css-") {
|
|
198
|
+
result[key] = value.toString();
|
|
199
|
+
}
|
|
200
|
+
} else {
|
|
201
|
+
result[key] = value;
|
|
202
|
+
}
|
|
203
|
+
return result;
|
|
204
|
+
}, {});
|
|
205
|
+
};
|
|
206
|
+
const createEmptyComponent = (container, props) => {
|
|
207
|
+
if (container.get("seoConfiguration")) {
|
|
208
|
+
return /* @__PURE__ */ React.createElement(Empty, __spreadValues({}, props));
|
|
209
|
+
}
|
|
210
|
+
return null;
|
|
211
|
+
};
|
|
212
|
+
const isAnchorLink = (href) => {
|
|
213
|
+
const re = new RegExp("^#", "i");
|
|
214
|
+
const match = re.test(href);
|
|
215
|
+
return match;
|
|
216
|
+
};
|
|
217
|
+
const embeddedLinkMapper = (container) => (_a) => {
|
|
218
|
+
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
219
|
+
const {
|
|
220
|
+
implementation,
|
|
221
|
+
name: currentWidgetName
|
|
222
|
+
} = container.get("$widget");
|
|
223
|
+
const { href = "" } = props;
|
|
224
|
+
if (isAnchorLink(href)) {
|
|
225
|
+
return /* @__PURE__ */ React.createElement(AnchorLink, {
|
|
226
|
+
smooth: true,
|
|
227
|
+
to: href
|
|
228
|
+
}, children);
|
|
229
|
+
}
|
|
230
|
+
const escapedBindings = implementation.bindings.map((binding) => binding.replace(/\./g, "\\.")).join("|");
|
|
231
|
+
const regexp = new RegExp(`^((http[s]?:)?//)?(${escapedBindings})/([^\\s]+)`);
|
|
232
|
+
const expArray = regexp.exec(href);
|
|
233
|
+
if (expArray && expArray.length >= 4) {
|
|
234
|
+
const targetWidgetName = expArray[4];
|
|
235
|
+
const targetWidget = implementation.widgets.get(targetWidgetName);
|
|
236
|
+
if (targetWidget && !targetWidgetName.startsWith("blob?") && !targetWidgetName.startsWith(currentWidgetName)) {
|
|
237
|
+
return /* @__PURE__ */ React.createElement(WidgetLink, {
|
|
238
|
+
widgetName: targetWidgetName
|
|
239
|
+
}, children);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return /* @__PURE__ */ React.createElement("a", __spreadValues({}, props), children);
|
|
243
|
+
};
|
|
244
|
+
const filterCssProps = (props) => {
|
|
245
|
+
const cssProps = {};
|
|
246
|
+
Object.keys(props).forEach((key) => {
|
|
247
|
+
if (key.indexOf("css-") > -1) {
|
|
248
|
+
cssProps[key] = props[key];
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
return cssProps;
|
|
252
|
+
};
|
|
253
|
+
const filterCssPropsStyle = css`
|
|
254
|
+
${(p) => {
|
|
255
|
+
let css2 = "";
|
|
256
|
+
Object.keys(filterCssProps(p)).forEach((key) => {
|
|
257
|
+
if (key.indexOf("css-") > -1) {
|
|
258
|
+
css2 += `${key.replace("css-", "")}:${p[key]};`;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
return css2;
|
|
262
|
+
}}
|
|
263
|
+
`;
|
|
264
|
+
const genericHashLink = (props, As) => {
|
|
265
|
+
let hashFragment = "";
|
|
266
|
+
const reset = () => {
|
|
267
|
+
hashFragment = "";
|
|
268
|
+
};
|
|
269
|
+
const getElementAndScroll = (scrollFunction) => {
|
|
270
|
+
const element = document.getElementById(hashFragment);
|
|
271
|
+
if (element !== null) {
|
|
272
|
+
scrollFunction(element);
|
|
273
|
+
reset();
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
276
|
+
return false;
|
|
277
|
+
};
|
|
278
|
+
const handleClick = (e) => {
|
|
279
|
+
e.preventDefault();
|
|
280
|
+
reset();
|
|
281
|
+
if (props.onClick)
|
|
282
|
+
props.onClick(e);
|
|
283
|
+
if (typeof props.to === "string") {
|
|
284
|
+
hashFragment = props.to.split("#").slice(1).join("#");
|
|
285
|
+
}
|
|
286
|
+
if (hashFragment !== "") {
|
|
287
|
+
getElementAndScroll(props.scroll || ((el) => props.smooth ? el.scrollIntoView({ behavior: "smooth" }) : el.scrollIntoView()));
|
|
288
|
+
}
|
|
289
|
+
return false;
|
|
290
|
+
};
|
|
291
|
+
const _a = props, { scroll, smooth, to } = _a, filteredProps = __objRest(_a, ["scroll", "smooth", "to"]);
|
|
292
|
+
if (As === "a") {
|
|
293
|
+
filteredProps.href = "javascript:;";
|
|
294
|
+
}
|
|
295
|
+
return /* @__PURE__ */ React.createElement(As, __spreadProps(__spreadValues({}, filteredProps), {
|
|
296
|
+
onClick: handleClick
|
|
297
|
+
}), props.children);
|
|
298
|
+
};
|
|
299
|
+
const headingElement = (element, style) => {
|
|
300
|
+
let defaultTag = element;
|
|
301
|
+
let prefix = "";
|
|
302
|
+
if (["h1", "h2", "h3", "h4", "h5", "h6"].includes(element)) {
|
|
303
|
+
defaultTag = element;
|
|
304
|
+
} else {
|
|
305
|
+
const match = element.match(/h1|h2|h3|h4|h5|h6/);
|
|
306
|
+
if (match == null ? void 0 : match[0]) {
|
|
307
|
+
defaultTag = match[0];
|
|
308
|
+
const [pre] = element.split(defaultTag);
|
|
309
|
+
prefix = pre;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
const renderTag = (element2, pre, mapping) => {
|
|
313
|
+
if (mapping[element2]) {
|
|
314
|
+
return `${pre}${mapping[element2]}`;
|
|
315
|
+
}
|
|
316
|
+
return `${pre}${element2}`;
|
|
317
|
+
};
|
|
318
|
+
return css`
|
|
319
|
+
${(p) => renderTag(defaultTag, prefix, p.theme.typographyVariantMapping || {})} {
|
|
320
|
+
${style}
|
|
321
|
+
}
|
|
322
|
+
`;
|
|
323
|
+
};
|
|
324
|
+
function parseHtmlString(html, instruction) {
|
|
325
|
+
if (instruction) {
|
|
326
|
+
return convert(html, instruction);
|
|
327
|
+
}
|
|
328
|
+
return convert(html);
|
|
329
|
+
}
|
|
330
|
+
const imageLightboxRenderer = (attrs) => /* @__PURE__ */ React.createElement(Lightbox, {
|
|
331
|
+
attrs
|
|
332
|
+
});
|
|
333
|
+
const defaultRenderInstructions = (container) => {
|
|
334
|
+
return {
|
|
335
|
+
transform: {
|
|
336
|
+
a: embeddedLinkMapper(container),
|
|
337
|
+
img: imageLightboxRenderer
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
const AnchorLink = (props) => {
|
|
342
|
+
return genericHashLink(props, "a");
|
|
343
|
+
};
|
|
344
|
+
var Button = forwardRef((_a, ref) => {
|
|
345
|
+
var _b = _a, { className, children } = _b, other = __objRest(_b, ["className", "children"]);
|
|
346
|
+
return /* @__PURE__ */ React.createElement(StyledButton, __spreadProps(__spreadValues({
|
|
347
|
+
type: "button",
|
|
348
|
+
className: appendClassNames(className, "humany-button")
|
|
349
|
+
}, convertToStringAttributes(other)), {
|
|
350
|
+
ref
|
|
351
|
+
}), children);
|
|
352
|
+
});
|
|
353
|
+
const StyledButton = styled.button`
|
|
354
|
+
-webkit-appearance: button;
|
|
355
|
+
text-transform: none;
|
|
356
|
+
overflow: visible;
|
|
357
|
+
outline: none;
|
|
358
|
+
border: none;
|
|
359
|
+
background-color: transparent;
|
|
360
|
+
cursor: pointer;
|
|
361
|
+
font-family: inherit;
|
|
362
|
+
font-size: inherit;
|
|
363
|
+
line-height: normal;
|
|
364
|
+
margin: 0;
|
|
365
|
+
padding: 0;
|
|
366
|
+
`;
|
|
367
|
+
const Checkbox = (_c) => {
|
|
368
|
+
var _d = _c, {
|
|
369
|
+
onChange = () => {
|
|
370
|
+
},
|
|
371
|
+
onEnter = () => {
|
|
372
|
+
},
|
|
373
|
+
className
|
|
374
|
+
} = _d, other = __objRest(_d, [
|
|
375
|
+
"onChange",
|
|
376
|
+
"onEnter",
|
|
377
|
+
"className"
|
|
378
|
+
]);
|
|
379
|
+
return /* @__PURE__ */ React.createElement("input", __spreadValues({
|
|
380
|
+
className: appendClassNames(className, "humany-checkbox"),
|
|
381
|
+
onKeyDown: (e) => {
|
|
382
|
+
if (e.key === "Enter") {
|
|
383
|
+
onEnter(e);
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
onChange: (e) => onChange(e.target.value, e.currentTarget.checked)
|
|
387
|
+
}, convertToStringAttributes(other)));
|
|
388
|
+
};
|
|
389
|
+
const ContainerContext = createContext(new Container());
|
|
390
|
+
const ColumnContext = createContext(1);
|
|
391
|
+
const ComponentNodeContext = createContext({
|
|
392
|
+
id: "",
|
|
393
|
+
type: "",
|
|
394
|
+
name: "",
|
|
395
|
+
branch: ""
|
|
396
|
+
});
|
|
397
|
+
const ComponentPropertyContext = createContext({});
|
|
398
|
+
const RoutingContext = createContext(null);
|
|
399
|
+
const useComponentDescriptor = () => useContext$1(ComponentNodeContext);
|
|
400
|
+
const useContainer = () => useContext$1(ContainerContext);
|
|
401
|
+
const useAction = (passedOrigin, passedContainer) => {
|
|
402
|
+
const origin = useComponentDescriptor().id;
|
|
403
|
+
const container = useContainer();
|
|
404
|
+
return (action, value) => {
|
|
405
|
+
(passedContainer || container).getAsync("actionResolver").then((resolver) => {
|
|
406
|
+
resolver.action(passedOrigin || origin, action, value);
|
|
407
|
+
});
|
|
408
|
+
};
|
|
409
|
+
};
|
|
410
|
+
const useComponentNode = (id) => {
|
|
411
|
+
const descriptor = useContext$1(ComponentNodeContext);
|
|
412
|
+
const components = useComponentPlatform();
|
|
413
|
+
const [node, setNode] = useState();
|
|
414
|
+
useEffect(() => {
|
|
415
|
+
if ((id || descriptor.id) && components) {
|
|
416
|
+
const node2 = components.nodes.get(id || descriptor.id);
|
|
417
|
+
setNode(node2);
|
|
418
|
+
}
|
|
419
|
+
}, [id, descriptor.id, components]);
|
|
420
|
+
return node;
|
|
421
|
+
};
|
|
422
|
+
const useIsMounted = () => {
|
|
423
|
+
const isMounted = useRef(false);
|
|
424
|
+
useEffect(() => {
|
|
425
|
+
isMounted.current = true;
|
|
426
|
+
return () => {
|
|
427
|
+
isMounted.current = false;
|
|
428
|
+
};
|
|
429
|
+
}, []);
|
|
430
|
+
return isMounted;
|
|
431
|
+
};
|
|
432
|
+
const useComponentPlatform = (passedContainer) => {
|
|
433
|
+
const container = useContainer();
|
|
434
|
+
const [componentPlatform, setComponentPlatform] = useState(null);
|
|
435
|
+
const isMounted = useIsMounted();
|
|
436
|
+
useEffect(() => {
|
|
437
|
+
ComponentPlatform.getInstance(passedContainer || container).then((platform) => {
|
|
438
|
+
if (isMounted.current) {
|
|
439
|
+
setComponentPlatform(platform);
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
}, [isMounted]);
|
|
443
|
+
return componentPlatform;
|
|
444
|
+
};
|
|
445
|
+
const useChildren = () => {
|
|
446
|
+
const node = useComponentNode();
|
|
447
|
+
const components = useComponentPlatform();
|
|
448
|
+
const [children, setChildren] = useState([]);
|
|
449
|
+
const isMounted = useIsMounted();
|
|
450
|
+
const updateChildren = useCallback((node2) => {
|
|
451
|
+
if (components && isMounted.current) {
|
|
452
|
+
const branch = components.getBranch(node2);
|
|
453
|
+
const children2 = node2.getChildren(branch).map((child) => asDescriptor(child));
|
|
454
|
+
setChildren(children2);
|
|
455
|
+
}
|
|
456
|
+
}, [isMounted, components, setChildren]);
|
|
457
|
+
useEffect(() => {
|
|
458
|
+
if (node) {
|
|
459
|
+
updateChildren(node);
|
|
460
|
+
}
|
|
461
|
+
}, [node, components]);
|
|
462
|
+
useEffect(() => {
|
|
463
|
+
if (components) {
|
|
464
|
+
const [subscribe, unsubscribe] = createEventSubscriber(components.events);
|
|
465
|
+
subscribe("components:set-layout", (event, data) => {
|
|
466
|
+
if (node === data.node.parent || data.node.parent === components.nodes.root) {
|
|
467
|
+
updateChildren(data.node.parent);
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
subscribe("components:node-appended", (event, data) => {
|
|
471
|
+
if (node === data.node.parent || data.node.parent === components.nodes.root) {
|
|
472
|
+
updateChildren(data.node.parent);
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
subscribe("components:node-removed", (event, { parentNode }) => {
|
|
476
|
+
if (parentNode === node || parentNode === components.nodes.root) {
|
|
477
|
+
updateChildren(parentNode);
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
return () => {
|
|
481
|
+
unsubscribe();
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
}, [node, components, updateChildren]);
|
|
485
|
+
return children;
|
|
486
|
+
};
|
|
487
|
+
const useColumns = () => useContext$1(ColumnContext);
|
|
488
|
+
const useComponent = (passedType, passedContainer) => {
|
|
489
|
+
const descriptor = useComponentDescriptor();
|
|
490
|
+
const container = useContainer();
|
|
491
|
+
const [component, setComponent] = useState(void 0);
|
|
492
|
+
const isMounted = useIsMounted();
|
|
493
|
+
const type = passedType || descriptor.type || "";
|
|
494
|
+
useEffect(() => {
|
|
495
|
+
if (type) {
|
|
496
|
+
let unsubscribe;
|
|
497
|
+
(passedContainer || container).getAsync("componentResolver").then((resolver) => {
|
|
498
|
+
if (isMounted.current) {
|
|
499
|
+
const component2 = resolver.getComponent(type);
|
|
500
|
+
setComponent(component2);
|
|
501
|
+
}
|
|
502
|
+
unsubscribe = resolver.registerResolver(type, (component2) => {
|
|
503
|
+
if (isMounted.current) {
|
|
504
|
+
setComponent(component2);
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
});
|
|
508
|
+
return () => {
|
|
509
|
+
if (unsubscribe) {
|
|
510
|
+
unsubscribe();
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
}, [isMounted, type, passedContainer, container]);
|
|
515
|
+
return component;
|
|
516
|
+
};
|
|
517
|
+
const useContext = (id) => {
|
|
518
|
+
const node = useComponentNode(id);
|
|
519
|
+
const components = useComponentPlatform();
|
|
520
|
+
const [context, setContext] = useState({});
|
|
521
|
+
const isMounted = useIsMounted();
|
|
522
|
+
useEffect(() => {
|
|
523
|
+
if (node && isMounted.current) {
|
|
524
|
+
setContext(node.attributes.context);
|
|
525
|
+
}
|
|
526
|
+
}, [isMounted, node]);
|
|
527
|
+
useEffect(() => {
|
|
528
|
+
if (components) {
|
|
529
|
+
const unsubscribe = components.events.subscribe("components:context-changed", (event, data) => {
|
|
530
|
+
if (node === data.node && isMounted.current) {
|
|
531
|
+
setContext(data.node.attributes.context);
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
return () => {
|
|
535
|
+
unsubscribe();
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
}, [isMounted, components]);
|
|
539
|
+
return context;
|
|
540
|
+
};
|
|
541
|
+
const useDispatch = () => {
|
|
542
|
+
const components = useComponentPlatform();
|
|
543
|
+
const descriptor = useComponentDescriptor();
|
|
544
|
+
const [queue, setQueue] = useState([]);
|
|
545
|
+
const [actions, setActions] = useState();
|
|
546
|
+
useEffect(() => {
|
|
547
|
+
if (components && descriptor) {
|
|
548
|
+
const component = new ComponentQuery(components).withId(descriptor.id);
|
|
549
|
+
const actions2 = components.actions(component, descriptor.type || uuid());
|
|
550
|
+
setActions(actions2);
|
|
551
|
+
if (queue !== null) {
|
|
552
|
+
queue.forEach((item) => {
|
|
553
|
+
actions2.dispatch(item.key, item.data).then((value) => item.resolve(value)).catch((reason) => item.reject(reason));
|
|
554
|
+
});
|
|
555
|
+
setQueue(null);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}, [components, descriptor.id]);
|
|
559
|
+
return (key, data) => {
|
|
560
|
+
if (queue !== null) {
|
|
561
|
+
return new Promise((resolve, reject) => {
|
|
562
|
+
queue.push({
|
|
563
|
+
key,
|
|
564
|
+
data,
|
|
565
|
+
resolve,
|
|
566
|
+
reject
|
|
567
|
+
});
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
return actions.dispatch(key, data);
|
|
571
|
+
};
|
|
572
|
+
};
|
|
573
|
+
var useEventListener = (eventName, handler, element = window, condition = () => true) => {
|
|
574
|
+
const savedHandler = useRef(() => {
|
|
575
|
+
});
|
|
576
|
+
useEffect(() => {
|
|
577
|
+
savedHandler.current = handler;
|
|
578
|
+
}, [handler]);
|
|
579
|
+
useEffect(() => {
|
|
580
|
+
const isSupported = element && condition();
|
|
581
|
+
if (!isSupported)
|
|
582
|
+
return;
|
|
583
|
+
const eventListener = (event) => savedHandler.current(event);
|
|
584
|
+
element.addEventListener(eventName, eventListener);
|
|
585
|
+
return () => {
|
|
586
|
+
element.removeEventListener(eventName, eventListener);
|
|
587
|
+
};
|
|
588
|
+
}, [eventName, element]);
|
|
589
|
+
};
|
|
590
|
+
const useEvents = (passedContainer) => {
|
|
591
|
+
const container = useContainer();
|
|
592
|
+
const { events } = (passedContainer || container).get("$widget");
|
|
593
|
+
return events;
|
|
594
|
+
};
|
|
595
|
+
const useKeyPress = (targetKey, action) => {
|
|
596
|
+
const [keyPressed, setKeyPressed] = useState(false);
|
|
597
|
+
const onKeyDown = useCallback((event) => {
|
|
598
|
+
const { key } = event;
|
|
599
|
+
if (key === targetKey) {
|
|
600
|
+
setKeyPressed(true);
|
|
601
|
+
if (action) {
|
|
602
|
+
action(event);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}, [setKeyPressed, action]);
|
|
606
|
+
const onKeyUp = useCallback(({ key }) => {
|
|
607
|
+
if (key === targetKey) {
|
|
608
|
+
setKeyPressed(false);
|
|
609
|
+
}
|
|
610
|
+
}, [setKeyPressed]);
|
|
611
|
+
useEventListener("keydown", onKeyDown, window);
|
|
612
|
+
useEventListener("keyup", onKeyUp, window);
|
|
613
|
+
return keyPressed;
|
|
614
|
+
};
|
|
615
|
+
const useLayout = (id) => {
|
|
616
|
+
const node = useComponentNode(id);
|
|
617
|
+
const components = useComponentPlatform();
|
|
618
|
+
const [layout, setLayout] = useState({});
|
|
619
|
+
const isMounted = useIsMounted();
|
|
620
|
+
useEffect(() => {
|
|
621
|
+
if (node && isMounted.current) {
|
|
622
|
+
setLayout(node.attributes.layout);
|
|
623
|
+
}
|
|
624
|
+
}, [node, isMounted]);
|
|
625
|
+
useEffect(() => {
|
|
626
|
+
if (components) {
|
|
627
|
+
const unsubscribe = components.events.subscribe("components:layout-changed", (event, data) => {
|
|
628
|
+
if (node === data.node && isMounted.current) {
|
|
629
|
+
setLayout(data.node.attributes.layout);
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
return () => {
|
|
633
|
+
unsubscribe();
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
}, [components, isMounted]);
|
|
637
|
+
return layout;
|
|
638
|
+
};
|
|
639
|
+
const usePrevious = (value) => {
|
|
640
|
+
const ref = useRef();
|
|
641
|
+
useEffect(() => {
|
|
642
|
+
ref.current = value;
|
|
643
|
+
});
|
|
644
|
+
return ref.current;
|
|
645
|
+
};
|
|
646
|
+
const useProperties = () => {
|
|
647
|
+
const properties = useContext$1(ComponentPropertyContext);
|
|
648
|
+
return properties;
|
|
649
|
+
};
|
|
650
|
+
const useRenderState = (passedContainer) => {
|
|
651
|
+
const [renderState, setRenderState] = useState();
|
|
652
|
+
const container = useContainer();
|
|
653
|
+
const isMounted = useIsMounted();
|
|
654
|
+
useEffect(() => {
|
|
655
|
+
let unsubscribe;
|
|
656
|
+
const widget = (passedContainer || container).get("$widget");
|
|
657
|
+
if (!widget) {
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
const { name, invoke } = widget;
|
|
661
|
+
invoke("renderState").then((renderState2) => {
|
|
662
|
+
if (isMounted.current) {
|
|
663
|
+
setRenderState(renderState2);
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
(passedContainer || container).getAsync("actionResolver").then((actionResolver) => {
|
|
667
|
+
unsubscribe = actionResolver.subscribe(name, (origin, action) => {
|
|
668
|
+
switch (action) {
|
|
669
|
+
case "close":
|
|
670
|
+
case "open":
|
|
671
|
+
if (isMounted.current) {
|
|
672
|
+
setRenderState(action === "open" ? WidgetRenderState.open : WidgetRenderState.closed);
|
|
673
|
+
}
|
|
674
|
+
break;
|
|
675
|
+
case "hide":
|
|
676
|
+
if (isMounted.current) {
|
|
677
|
+
setRenderState(WidgetRenderState.hidden);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
});
|
|
681
|
+
});
|
|
682
|
+
return () => {
|
|
683
|
+
if (unsubscribe) {
|
|
684
|
+
unsubscribe();
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
}, [isMounted]);
|
|
688
|
+
return renderState;
|
|
689
|
+
};
|
|
690
|
+
const useRouter = () => {
|
|
691
|
+
const router = useContext$1(RoutingContext);
|
|
692
|
+
return router;
|
|
693
|
+
};
|
|
694
|
+
const useRouteData = (passedContainer) => {
|
|
695
|
+
const container = useContainer();
|
|
696
|
+
const router = useRouter();
|
|
697
|
+
const [routeData, setRouteData] = useState({ name: "", params: {} });
|
|
698
|
+
const isMounted = useIsMounted();
|
|
699
|
+
useEffect(() => {
|
|
700
|
+
const widget = (passedContainer || container).get("$widget");
|
|
701
|
+
if (!widget) {
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
const { events } = widget;
|
|
705
|
+
const unsubscribe = events.subscribe("router:change", (e, { next: { routeData: routeData2 } }) => {
|
|
706
|
+
if (isMounted.current) {
|
|
707
|
+
const { name, params } = routeData2;
|
|
708
|
+
removeNullAndUndefinedValues(params);
|
|
709
|
+
setRouteData({ name, params });
|
|
710
|
+
}
|
|
711
|
+
});
|
|
712
|
+
return unsubscribe;
|
|
713
|
+
}, [isMounted, passedContainer, container]);
|
|
714
|
+
useEffect(() => {
|
|
715
|
+
if (router && router.history && isMounted.current) {
|
|
716
|
+
const routeData2 = router.getRouteData();
|
|
717
|
+
const { name, params } = routeData2;
|
|
718
|
+
removeNullAndUndefinedValues(params);
|
|
719
|
+
setRouteData({ name, params });
|
|
720
|
+
}
|
|
721
|
+
}, [router, isMounted]);
|
|
722
|
+
return routeData;
|
|
723
|
+
};
|
|
724
|
+
var useScroll = (scrollable) => {
|
|
725
|
+
const elem = useRef();
|
|
726
|
+
const previousY = useRef(0);
|
|
727
|
+
let timeoutId;
|
|
728
|
+
const onScroll = useCallback(() => {
|
|
729
|
+
var _a;
|
|
730
|
+
(_a = elem.current) == null ? void 0 : _a.classList.add("humany-scrolling");
|
|
731
|
+
clearTimeout(timeoutId);
|
|
732
|
+
timeoutId = setTimeout(() => {
|
|
733
|
+
var _a2;
|
|
734
|
+
(_a2 = elem.current) == null ? void 0 : _a2.classList.remove("humany-scrolling");
|
|
735
|
+
}, 500);
|
|
736
|
+
}, [elem]);
|
|
737
|
+
const onTouchStart = useCallback((event) => {
|
|
738
|
+
previousY.current = event.touches[0].clientY;
|
|
739
|
+
}, [elem]);
|
|
740
|
+
const traverseScrollable = (element) => {
|
|
741
|
+
if (isScrollable(element)) {
|
|
742
|
+
if (element === elem.current) {
|
|
743
|
+
return element;
|
|
744
|
+
}
|
|
745
|
+
return null;
|
|
746
|
+
}
|
|
747
|
+
if (element.parentElement) {
|
|
748
|
+
return traverseScrollable(element.parentElement);
|
|
749
|
+
}
|
|
750
|
+
return null;
|
|
751
|
+
};
|
|
752
|
+
const isScrollable = (element) => {
|
|
753
|
+
return element.scrollWidth > element.clientWidth || element.scrollHeight > element.clientHeight;
|
|
754
|
+
};
|
|
755
|
+
const onTouchMove = useCallback((event) => {
|
|
756
|
+
if (!event.cancelable) {
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
const top = event.touches[0].clientY;
|
|
760
|
+
const firstScrollable = traverseScrollable(event.target);
|
|
761
|
+
if (!firstScrollable) {
|
|
762
|
+
return;
|
|
763
|
+
}
|
|
764
|
+
const scrollTop = firstScrollable.scrollTop;
|
|
765
|
+
const direction = previousY.current - top < 0 ? "up" : "down";
|
|
766
|
+
const isAtTop = scrollTop <= 0 && direction === "up";
|
|
767
|
+
const isAtBottom = scrollTop >= firstScrollable.scrollHeight - firstScrollable.offsetHeight && direction === "down";
|
|
768
|
+
if (isAtTop || isAtBottom) {
|
|
769
|
+
event.preventDefault();
|
|
770
|
+
}
|
|
771
|
+
previousY.current = top;
|
|
772
|
+
}, [elem, previousY]);
|
|
773
|
+
useEventListener("scroll", onScroll, elem.current, () => elem.current && scrollable);
|
|
774
|
+
useEventListener("touchstart", onTouchStart, elem.current, () => elem.current && scrollable);
|
|
775
|
+
useEventListener("touchmove", onTouchMove, elem.current, () => elem.current && scrollable);
|
|
776
|
+
if (!scrollable) {
|
|
777
|
+
return ["", elem];
|
|
778
|
+
}
|
|
779
|
+
return [styling, elem];
|
|
780
|
+
};
|
|
781
|
+
const styling = `
|
|
782
|
+
overflow-y: ${browser() === Browsers.Chrome || browser() === Browsers.EdgeChromium ? "overlay" : "auto"};
|
|
783
|
+
overflow-x: hidden;
|
|
784
|
+
-ms-overflow-style: none; /* IE 10+ */
|
|
785
|
+
scrollbar-width: thin; /* Firefox */
|
|
786
|
+
scrollbar-color: transparent transparent; /* Firefox */
|
|
787
|
+
|
|
788
|
+
::-webkit-scrollbar {
|
|
789
|
+
width: 3px !important;
|
|
790
|
+
background-color: transparent;
|
|
791
|
+
border-left: none;
|
|
792
|
+
}
|
|
793
|
+
::-webkit-scrollbar-thumb {
|
|
794
|
+
background-color: transparent;
|
|
795
|
+
}
|
|
796
|
+
::-webkit-scrollbar-track {
|
|
797
|
+
-webkit-box-shadow: none !important;
|
|
798
|
+
background-color: transparent;
|
|
799
|
+
}
|
|
800
|
+
&.humany-scrolling {
|
|
801
|
+
scrollbar-color: #7F7F7F transparent;
|
|
802
|
+
scrollbar-width: thin; /* Firefox */
|
|
803
|
+
-ms-overflow-style: none; /* IE 10+ */
|
|
804
|
+
|
|
805
|
+
::-webkit-scrollbar-thumb {
|
|
806
|
+
background-color: #7F7F7F;
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
`;
|
|
810
|
+
const useSettings = () => {
|
|
811
|
+
const [settings, setSettings] = useState(null);
|
|
812
|
+
const container = useContainer();
|
|
813
|
+
const isMounted = useIsMounted();
|
|
814
|
+
useEffect(() => {
|
|
815
|
+
container.get("settings").then((settings2) => {
|
|
816
|
+
if (isMounted.current) {
|
|
817
|
+
setSettings(settings2);
|
|
818
|
+
}
|
|
819
|
+
});
|
|
820
|
+
}, [isMounted]);
|
|
821
|
+
return settings;
|
|
822
|
+
};
|
|
823
|
+
const useToggle = (initialValue = false) => {
|
|
824
|
+
const [value, setValue] = useState(initialValue);
|
|
825
|
+
const toggle = useCallback((forced) => {
|
|
826
|
+
setValue(typeof forced === "boolean" ? forced : (v) => !v);
|
|
827
|
+
}, []);
|
|
828
|
+
return [value, toggle];
|
|
829
|
+
};
|
|
830
|
+
var useTransitionEnd = (handler) => {
|
|
831
|
+
const container = useContainer();
|
|
832
|
+
const components = useComponentPlatform();
|
|
833
|
+
const widgetDOMElement = container.get("widgetDOMElement");
|
|
834
|
+
const [viewDOMElement, setViewDOMElement] = useState(null);
|
|
835
|
+
const [rootDOMElement, setRootDOMElement] = useState(null);
|
|
836
|
+
const isMounted = useIsMounted();
|
|
837
|
+
useEffect(() => {
|
|
838
|
+
if (components && isMounted.current) {
|
|
839
|
+
const rootArea = components.nodes.all.find((n) => n.name === "root-area");
|
|
840
|
+
const view = components.nodes.all.find((n) => n.type === "view");
|
|
841
|
+
if (!(view == null ? void 0 : view.attributes.properties.animation) && !(rootArea == null ? void 0 : rootArea.attributes.properties.animation)) {
|
|
842
|
+
handler();
|
|
843
|
+
} else {
|
|
844
|
+
const getElement = (id = "") => widgetDOMElement == null ? void 0 : widgetDOMElement.querySelector(`[data-node-id="${id}"]`);
|
|
845
|
+
const viewDOMElement2 = getElement(view == null ? void 0 : view.id);
|
|
846
|
+
if (viewDOMElement2) {
|
|
847
|
+
setViewDOMElement(viewDOMElement2);
|
|
848
|
+
}
|
|
849
|
+
const rootDOMElement2 = getElement(rootArea == null ? void 0 : rootArea.id);
|
|
850
|
+
if (rootDOMElement2) {
|
|
851
|
+
setRootDOMElement(rootDOMElement2);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
}, [components, container, isMounted]);
|
|
856
|
+
const eventListener = useCallback((event) => {
|
|
857
|
+
if (isMounted.current && (event.target === viewDOMElement || event.target === rootDOMElement)) {
|
|
858
|
+
handler();
|
|
859
|
+
}
|
|
860
|
+
}, [handler, isMounted, viewDOMElement, rootDOMElement]);
|
|
861
|
+
useEventListener("transitionend", eventListener, viewDOMElement);
|
|
862
|
+
useEventListener("transitionend", eventListener, rootDOMElement);
|
|
863
|
+
};
|
|
864
|
+
const useWidgetEvent = (event, callback, dependencies = [], passedContainer) => {
|
|
865
|
+
const events = useEvents(passedContainer);
|
|
866
|
+
useEffect(() => {
|
|
867
|
+
if (events) {
|
|
868
|
+
const unsubscribe = events.subscribe(event, callback);
|
|
869
|
+
return () => {
|
|
870
|
+
unsubscribe();
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
}, [events].concat(dependencies));
|
|
874
|
+
return (data) => events == null ? void 0 : events.dispatch(event, data);
|
|
875
|
+
};
|
|
876
|
+
const useUniqueMenu = (id, callback) => {
|
|
877
|
+
const dispatch = useWidgetEvent("widget:menu-toggled", (_, triggeredId) => {
|
|
878
|
+
if (triggeredId !== id) {
|
|
879
|
+
callback();
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
return () => dispatch(id);
|
|
883
|
+
};
|
|
884
|
+
const Text = (_e) => {
|
|
885
|
+
var _f = _e, { className, children } = _f, other = __objRest(_f, ["className", "children"]);
|
|
886
|
+
return /* @__PURE__ */ React.createElement("span", __spreadValues({
|
|
887
|
+
className: appendClassNames(className, "humany-text")
|
|
888
|
+
}, convertToStringAttributes(other)), children);
|
|
889
|
+
};
|
|
890
|
+
const contentBox = css`
|
|
891
|
+
display: flex;
|
|
892
|
+
justify-content: center;
|
|
893
|
+
flex-direction: column;
|
|
894
|
+
background: #ffffff;
|
|
895
|
+
border-radius: ${(p) => p.theme.borderRadius};
|
|
896
|
+
border: ${(p) => p.theme.border};
|
|
897
|
+
box-shadow: ${(p) => p.theme.boxShadow || "none"};
|
|
898
|
+
${(p) => p["data-loading"] && "min-height: 150px;"}
|
|
899
|
+
`;
|
|
900
|
+
const buttonCss = css`
|
|
901
|
+
cursor: pointer;
|
|
902
|
+
text-align: center;
|
|
903
|
+
border: none;
|
|
904
|
+
padding: ${(p) => {
|
|
905
|
+
var _a;
|
|
906
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
907
|
+
}};
|
|
908
|
+
border-radius: ${(p) => p.theme.borderRadius};
|
|
909
|
+
font-family: ${(p) => {
|
|
910
|
+
var _a;
|
|
911
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.type;
|
|
912
|
+
}};
|
|
913
|
+
font-size: ${(p) => {
|
|
914
|
+
var _a;
|
|
915
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
|
|
916
|
+
}};
|
|
917
|
+
font-weight: 300;
|
|
918
|
+
`;
|
|
919
|
+
const invertedHoverButton = ({
|
|
920
|
+
primaryColor,
|
|
921
|
+
secondaryColor,
|
|
922
|
+
active
|
|
923
|
+
}) => css`
|
|
924
|
+
${buttonCss}
|
|
925
|
+
border: 1px solid ${active ? secondaryColor : primaryColor};
|
|
926
|
+
background-color: ${active ? primaryColor : secondaryColor};
|
|
927
|
+
|
|
928
|
+
color: ${active ? secondaryColor : primaryColor};
|
|
929
|
+
transition: background-color 200ms ease-out, color 200ms ease-out;
|
|
930
|
+
|
|
931
|
+
span,
|
|
932
|
+
i,
|
|
933
|
+
p,
|
|
934
|
+
a {
|
|
935
|
+
transition: color 200ms ease-out;
|
|
936
|
+
color: ${active ? secondaryColor : primaryColor};
|
|
937
|
+
font-size: ${(p) => {
|
|
938
|
+
var _a;
|
|
939
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
|
|
940
|
+
}};
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
${(p) => !p.disabled && css`
|
|
944
|
+
&:hover {
|
|
945
|
+
background-color: ${primaryColor};
|
|
946
|
+
color: ${secondaryColor};
|
|
947
|
+
|
|
948
|
+
span,
|
|
949
|
+
i,
|
|
950
|
+
p,
|
|
951
|
+
a {
|
|
952
|
+
color: ${secondaryColor};
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
&:focus {
|
|
957
|
+
${(p2) => {
|
|
958
|
+
var _a;
|
|
959
|
+
return ((_a = p2.theme.accessibility) == null ? void 0 : _a.isTabbing) && borderTabStyle;
|
|
960
|
+
}};
|
|
961
|
+
}
|
|
962
|
+
`}
|
|
963
|
+
`;
|
|
964
|
+
const borderTabStyle = css`
|
|
965
|
+
outline: ${(p) => {
|
|
966
|
+
var _a;
|
|
967
|
+
return (_a = p.theme.accessibility) == null ? void 0 : _a.border;
|
|
968
|
+
}};
|
|
969
|
+
color: ${(p) => {
|
|
970
|
+
var _a, _b;
|
|
971
|
+
return (_b = (_a = p.theme.accessibility) == null ? void 0 : _a.colors) == null ? void 0 : _b.inactiveText;
|
|
972
|
+
}};
|
|
973
|
+
border-color: transparent;
|
|
974
|
+
`;
|
|
975
|
+
const linkTabStyle = css`
|
|
976
|
+
${borderTabStyle}
|
|
977
|
+
text-decoration: underline;
|
|
978
|
+
`;
|
|
979
|
+
const paddedBorderTabStyle = css`
|
|
980
|
+
${borderTabStyle}
|
|
981
|
+
outline-offset: ${(p) => {
|
|
982
|
+
var _a;
|
|
983
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.small;
|
|
984
|
+
}};
|
|
985
|
+
`;
|
|
986
|
+
const CloseButton$1 = styled(Button)`
|
|
987
|
+
position: absolute;
|
|
988
|
+
top: ${(p) => {
|
|
989
|
+
var _a;
|
|
990
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
991
|
+
}};
|
|
992
|
+
right: ${(p) => {
|
|
993
|
+
var _a;
|
|
994
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
995
|
+
}};
|
|
996
|
+
z-index: 1;
|
|
997
|
+
|
|
998
|
+
svg {
|
|
999
|
+
stroke: ${(p) => {
|
|
1000
|
+
var _a;
|
|
1001
|
+
return (_a = p.theme.colors) == null ? void 0 : _a.text;
|
|
1002
|
+
}};
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
&:focus {
|
|
1006
|
+
${(p) => {
|
|
1007
|
+
var _a;
|
|
1008
|
+
return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && css`
|
|
1009
|
+
${borderTabStyle}
|
|
1010
|
+
padding: ${(p2) => {
|
|
1011
|
+
var _a2;
|
|
1012
|
+
return (_a2 = p2.theme.sizes) == null ? void 0 : _a2.small;
|
|
1013
|
+
}};
|
|
1014
|
+
height: 15px;
|
|
1015
|
+
box-sizing: content-box;
|
|
1016
|
+
`;
|
|
1017
|
+
}};
|
|
1018
|
+
}
|
|
1019
|
+
`;
|
|
1020
|
+
const StyledText = styled(Text)`
|
|
1021
|
+
font-size: ${(p) => {
|
|
1022
|
+
var _a;
|
|
1023
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
|
|
1024
|
+
}};
|
|
1025
|
+
font-weight: normal;
|
|
1026
|
+
line-height: 1.2em;
|
|
1027
|
+
color: ${(p) => {
|
|
1028
|
+
var _a;
|
|
1029
|
+
return (_a = p.theme.colors) == null ? void 0 : _a.text;
|
|
1030
|
+
}};
|
|
1031
|
+
`;
|
|
1032
|
+
const list = css`
|
|
1033
|
+
padding: 0;
|
|
1034
|
+
margin: 0;
|
|
1035
|
+
list-style: none;
|
|
1036
|
+
> li {
|
|
1037
|
+
margin: 0 0 ${(p) => {
|
|
1038
|
+
var _a;
|
|
1039
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
1040
|
+
}};
|
|
1041
|
+
white-space: nowrap;
|
|
1042
|
+
text-overflow: ellipsis;
|
|
1043
|
+
min-width: 0;
|
|
1044
|
+
&:focus {
|
|
1045
|
+
outline-offset: -2px;
|
|
1046
|
+
}
|
|
1047
|
+
> a {
|
|
1048
|
+
text-decoration: none;
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
> li:last-child {
|
|
1052
|
+
margin: 0;
|
|
1053
|
+
}
|
|
1054
|
+
`;
|
|
1055
|
+
const itemList = css`
|
|
1056
|
+
> div {
|
|
1057
|
+
${headingElement("> h1", css`
|
|
1058
|
+
margin: 0 0 ${(p) => {
|
|
1059
|
+
var _a;
|
|
1060
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
1061
|
+
}};
|
|
1062
|
+
font-size: ${(p) => {
|
|
1063
|
+
var _a;
|
|
1064
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.medium;
|
|
1065
|
+
}};
|
|
1066
|
+
font-weight: normal;
|
|
1067
|
+
line-height: 1.8em;
|
|
1068
|
+
color: ${(p) => {
|
|
1069
|
+
var _a;
|
|
1070
|
+
return (_a = p.theme.colors) == null ? void 0 : _a.text;
|
|
1071
|
+
}};
|
|
1072
|
+
`)}
|
|
1073
|
+
}
|
|
1074
|
+
> ul {
|
|
1075
|
+
${list}
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
${headingElement("h1", css`
|
|
1079
|
+
display: flex;
|
|
1080
|
+
align-items: center;
|
|
1081
|
+
|
|
1082
|
+
i {
|
|
1083
|
+
margin: 7px ${(p) => {
|
|
1084
|
+
var _a;
|
|
1085
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
1086
|
+
}} 0 0;
|
|
1087
|
+
width: 24px;
|
|
1088
|
+
display: inline-block;
|
|
1089
|
+
vertical-align: text-bottom;
|
|
1090
|
+
align-self: flex-start;
|
|
1091
|
+
min-width: 24px;
|
|
1092
|
+
min-height: 24px;
|
|
1093
|
+
text-align: center;
|
|
1094
|
+
}
|
|
1095
|
+
`)}
|
|
1096
|
+
`;
|
|
1097
|
+
const Portal = ({ elementId = "humany-portal-elements", children }) => {
|
|
1098
|
+
const [container] = React.useState(() => {
|
|
1099
|
+
const el = document.getElementById(elementId) || document.createElement("div");
|
|
1100
|
+
el.id = elementId;
|
|
1101
|
+
return el;
|
|
1102
|
+
});
|
|
1103
|
+
useEffect(() => {
|
|
1104
|
+
document.body.appendChild(container);
|
|
1105
|
+
return () => {
|
|
1106
|
+
if (container.childElementCount <= 1) {
|
|
1107
|
+
document.body.removeChild(container);
|
|
1108
|
+
}
|
|
1109
|
+
};
|
|
1110
|
+
}, [container]);
|
|
1111
|
+
return createPortal(children, container);
|
|
1112
|
+
};
|
|
1113
|
+
const SymbolBadge = (_g) => {
|
|
1114
|
+
var _h = _g, {
|
|
1115
|
+
text = "",
|
|
1116
|
+
backgroundSize = "contain",
|
|
1117
|
+
size = 12,
|
|
1118
|
+
symbol = {
|
|
1119
|
+
content: "",
|
|
1120
|
+
type: ""
|
|
1121
|
+
},
|
|
1122
|
+
elementStyle = {},
|
|
1123
|
+
className
|
|
1124
|
+
} = _h, other = __objRest(_h, [
|
|
1125
|
+
"text",
|
|
1126
|
+
"backgroundSize",
|
|
1127
|
+
"size",
|
|
1128
|
+
"symbol",
|
|
1129
|
+
"elementStyle",
|
|
1130
|
+
"className"
|
|
1131
|
+
]);
|
|
1132
|
+
const { type, content } = symbol;
|
|
1133
|
+
const sharedProps = {
|
|
1134
|
+
"aria-label": text,
|
|
1135
|
+
role: "presentation"
|
|
1136
|
+
};
|
|
1137
|
+
switch (type) {
|
|
1138
|
+
case "Uri": {
|
|
1139
|
+
const style = {
|
|
1140
|
+
backgroundSize,
|
|
1141
|
+
backgroundImage: `url('${content}')`,
|
|
1142
|
+
backgroundRepeat: "no-repeat",
|
|
1143
|
+
backgroundPosition: "center",
|
|
1144
|
+
backgroundAttachment: "center"
|
|
1145
|
+
};
|
|
1146
|
+
return /* @__PURE__ */ React.createElement("i", __spreadValues(__spreadValues({
|
|
1147
|
+
className: appendClassNames(className, "humany-icon", "humany-custom-icon"),
|
|
1148
|
+
title: text,
|
|
1149
|
+
style: __spreadValues(__spreadValues({}, style), elementStyle)
|
|
1150
|
+
}, sharedProps), other));
|
|
1151
|
+
}
|
|
1152
|
+
case "Svg": {
|
|
1153
|
+
const svgProps = __spreadProps(__spreadValues({
|
|
1154
|
+
className: appendClassNames(className, "humany-icon"),
|
|
1155
|
+
width: `${size}`,
|
|
1156
|
+
fill: "none",
|
|
1157
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1158
|
+
}, other), {
|
|
1159
|
+
ref: null
|
|
1160
|
+
});
|
|
1161
|
+
const style = { minWidth: `${size}` };
|
|
1162
|
+
switch (content) {
|
|
1163
|
+
case "search": {
|
|
1164
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1165
|
+
viewBox: "0 0 32 30"
|
|
1166
|
+
}, svgProps), /* @__PURE__ */ React.createElement("circle", {
|
|
1167
|
+
cx: "14.8457",
|
|
1168
|
+
cy: "14.5175",
|
|
1169
|
+
r: "8.14359",
|
|
1170
|
+
transform: "rotate(45 14.8457 14.5175)"
|
|
1171
|
+
}), /* @__PURE__ */ React.createElement("line", {
|
|
1172
|
+
x1: "21.1001",
|
|
1173
|
+
y1: "20.4865",
|
|
1174
|
+
x2: "26.5798",
|
|
1175
|
+
y2: "25.9661"
|
|
1176
|
+
}));
|
|
1177
|
+
}
|
|
1178
|
+
case "clear": {
|
|
1179
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1180
|
+
viewBox: "0 0 27 27"
|
|
1181
|
+
}, svgProps), /* @__PURE__ */ React.createElement("circle", {
|
|
1182
|
+
cx: "13.4351",
|
|
1183
|
+
cy: "13.435",
|
|
1184
|
+
r: "9",
|
|
1185
|
+
transform: "rotate(45 13.4351 13.435)",
|
|
1186
|
+
stroke: "black"
|
|
1187
|
+
}), /* @__PURE__ */ React.createElement("line", {
|
|
1188
|
+
x1: "16.6172",
|
|
1189
|
+
y1: "10.2531",
|
|
1190
|
+
x2: "10.2533",
|
|
1191
|
+
y2: "16.6171",
|
|
1192
|
+
stroke: "black"
|
|
1193
|
+
}), /* @__PURE__ */ React.createElement("line", {
|
|
1194
|
+
x1: "16.6171",
|
|
1195
|
+
y1: "16.617",
|
|
1196
|
+
x2: "10.2532",
|
|
1197
|
+
y2: "10.2531",
|
|
1198
|
+
stroke: "black"
|
|
1199
|
+
}));
|
|
1200
|
+
}
|
|
1201
|
+
case "close": {
|
|
1202
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1203
|
+
viewBox: "0 0 13 13"
|
|
1204
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1205
|
+
d: "M12.3068 0.50647L1.27246 11.7273",
|
|
1206
|
+
stroke: "black"
|
|
1207
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1208
|
+
d: "M12.2812 11.9473L1.24686 0.726451",
|
|
1209
|
+
stroke: "black"
|
|
1210
|
+
}));
|
|
1211
|
+
}
|
|
1212
|
+
case "caret-right": {
|
|
1213
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1214
|
+
viewBox: "0 0 14 14",
|
|
1215
|
+
style
|
|
1216
|
+
}, svgProps), /* @__PURE__ */ React.createElement("line", {
|
|
1217
|
+
x1: "4.13",
|
|
1218
|
+
y1: "1.05",
|
|
1219
|
+
x2: "10.13",
|
|
1220
|
+
y2: "7.05",
|
|
1221
|
+
stroke: "black"
|
|
1222
|
+
}), /* @__PURE__ */ React.createElement("line", {
|
|
1223
|
+
x1: "10.13",
|
|
1224
|
+
y1: "6.95",
|
|
1225
|
+
x2: "4.13",
|
|
1226
|
+
y2: "12.95",
|
|
1227
|
+
stroke: "black"
|
|
1228
|
+
}));
|
|
1229
|
+
}
|
|
1230
|
+
case "caret-left": {
|
|
1231
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1232
|
+
viewBox: "0 0 14 14",
|
|
1233
|
+
style
|
|
1234
|
+
}, svgProps), /* @__PURE__ */ React.createElement("line", {
|
|
1235
|
+
x1: "10.13",
|
|
1236
|
+
y1: "12.95",
|
|
1237
|
+
x2: "4.13",
|
|
1238
|
+
y2: "6.95",
|
|
1239
|
+
stroke: "black"
|
|
1240
|
+
}), /* @__PURE__ */ React.createElement("line", {
|
|
1241
|
+
x1: "4.13",
|
|
1242
|
+
y1: "7.05",
|
|
1243
|
+
x2: "10.13",
|
|
1244
|
+
y2: "1.05",
|
|
1245
|
+
stroke: "black"
|
|
1246
|
+
}));
|
|
1247
|
+
}
|
|
1248
|
+
case "caret-up": {
|
|
1249
|
+
return /* @__PURE__ */ React.createElement(CaretUp, __spreadValues({
|
|
1250
|
+
viewBox: "0 0 14 14",
|
|
1251
|
+
style
|
|
1252
|
+
}, svgProps), /* @__PURE__ */ React.createElement("line", {
|
|
1253
|
+
x1: "13.09",
|
|
1254
|
+
y1: "3.99",
|
|
1255
|
+
x2: "7.1",
|
|
1256
|
+
y2: "9.99",
|
|
1257
|
+
stroke: "black"
|
|
1258
|
+
}), /* @__PURE__ */ React.createElement("line", {
|
|
1259
|
+
x1: "7.19",
|
|
1260
|
+
y1: "9.99",
|
|
1261
|
+
x2: "1.19",
|
|
1262
|
+
y2: "3.99",
|
|
1263
|
+
stroke: "black"
|
|
1264
|
+
}));
|
|
1265
|
+
}
|
|
1266
|
+
case "caret-down": {
|
|
1267
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1268
|
+
viewBox: "0 0 14 14",
|
|
1269
|
+
style
|
|
1270
|
+
}, svgProps), /* @__PURE__ */ React.createElement("line", {
|
|
1271
|
+
x1: "13.09",
|
|
1272
|
+
y1: "3.99",
|
|
1273
|
+
x2: "7.1",
|
|
1274
|
+
y2: "9.99",
|
|
1275
|
+
stroke: "black"
|
|
1276
|
+
}), /* @__PURE__ */ React.createElement("line", {
|
|
1277
|
+
x1: "7.19",
|
|
1278
|
+
y1: "9.99",
|
|
1279
|
+
x2: "1.19",
|
|
1280
|
+
y2: "3.99",
|
|
1281
|
+
stroke: "black"
|
|
1282
|
+
}));
|
|
1283
|
+
}
|
|
1284
|
+
case "back": {
|
|
1285
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1286
|
+
viewBox: "0 0 18 18"
|
|
1287
|
+
}, svgProps), /* @__PURE__ */ React.createElement("line", {
|
|
1288
|
+
y1: "-0.5",
|
|
1289
|
+
x2: "11.724",
|
|
1290
|
+
y2: "-0.5",
|
|
1291
|
+
transform: "matrix(-0.682355 -0.731021 0.682355 -0.731021 13 16.9999)",
|
|
1292
|
+
stroke: "white"
|
|
1293
|
+
}), /* @__PURE__ */ React.createElement("line", {
|
|
1294
|
+
y1: "-0.5",
|
|
1295
|
+
x2: "11.724",
|
|
1296
|
+
y2: "-0.5",
|
|
1297
|
+
transform: "matrix(0.682355 -0.731021 0.682355 0.731021 5 9.5705)",
|
|
1298
|
+
stroke: "white"
|
|
1299
|
+
}));
|
|
1300
|
+
}
|
|
1301
|
+
case "alert": {
|
|
1302
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1303
|
+
viewBox: "0 0 19 19"
|
|
1304
|
+
}, svgProps), /* @__PURE__ */ React.createElement("circle", {
|
|
1305
|
+
cx: "9.5",
|
|
1306
|
+
cy: "9.5",
|
|
1307
|
+
r: "9.5",
|
|
1308
|
+
fill: "#CA0813"
|
|
1309
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1310
|
+
d: "M10.36 4.878V8.882C10.36 9.30667 10.339 9.72433 10.297 10.135C10.255 10.541 10.199 10.9727 10.129 11.43H8.96C8.89 10.9727 8.834 10.541 8.792 10.135C8.75 9.72433 8.729 9.30667 8.729 8.882V4.878H10.36ZM8.463 14.048C8.463 13.9033 8.48867 13.7657 8.54 13.635C8.596 13.5043 8.67067 13.3923 8.764 13.299C8.862 13.2057 8.97633 13.131 9.107 13.075C9.23767 13.019 9.37767 12.991 9.527 12.991C9.67167 12.991 9.80933 13.019 9.94 13.075C10.0707 13.131 10.1827 13.2057 10.276 13.299C10.3693 13.3923 10.444 13.5043 10.5 13.635C10.556 13.7657 10.584 13.9033 10.584 14.048C10.584 14.1973 10.556 14.3373 10.5 14.468C10.444 14.594 10.3693 14.7037 10.276 14.797C10.1827 14.8903 10.0707 14.9627 9.94 15.014C9.80933 15.07 9.67167 15.098 9.527 15.098C9.37767 15.098 9.23767 15.07 9.107 15.014C8.97633 14.9627 8.862 14.8903 8.764 14.797C8.67067 14.7037 8.596 14.594 8.54 14.468C8.48867 14.3373 8.463 14.1973 8.463 14.048Z",
|
|
1311
|
+
fill: "white"
|
|
1312
|
+
}));
|
|
1313
|
+
}
|
|
1314
|
+
case "send": {
|
|
1315
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1316
|
+
viewBox: "0 0 20 17"
|
|
1317
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1318
|
+
d: "M18.95 8.56428L0.949951 0.941406V7.02531L13.6351 8.47059L0.950001 9.92276L0.949951 15.9414L18.95 8.56428Z",
|
|
1319
|
+
fill: "#A6A6A6",
|
|
1320
|
+
stroke: "#A6A6A6",
|
|
1321
|
+
strokeWidth: "0.1"
|
|
1322
|
+
}));
|
|
1323
|
+
}
|
|
1324
|
+
case "chat": {
|
|
1325
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1326
|
+
viewBox: "-2 -3 40 40"
|
|
1327
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1328
|
+
strokeWidth: "0",
|
|
1329
|
+
fillRule: "evenodd",
|
|
1330
|
+
clipRule: "evenodd",
|
|
1331
|
+
d: "M16.9799 34C21.2676 34 25.1841 32.4256 28.1725 29.8285L34.9534 32.1994C35.7991 32.4951 36.553 31.5778 36.0892 30.8173L32.2559 24.5317C33.3474 22.3103 33.9598 19.8153 33.9598 17.1786C33.9598 7.88838 26.3576 0.357178 16.9799 0.357178C7.60216 0.357178 0 7.88838 0 17.1786C0 26.4688 7.60216 34 16.9799 34ZM30.7031 24.565C31.9094 22.3701 32.5948 19.8536 32.5948 17.1786C32.5948 8.6352 25.6038 1.70942 16.9799 1.70942C8.35601 1.70942 1.36498 8.6352 1.36498 17.1786C1.36498 25.722 8.35601 32.6478 16.9799 32.6478C21.1946 32.6478 25.0193 30.9935 27.8285 28.3047L34.3975 30.5798L30.7031 24.565Z",
|
|
1332
|
+
fill: "currentColor"
|
|
1333
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1334
|
+
strokeWidth: "0",
|
|
1335
|
+
d: "M12.9395 17.1786C12.9395 18.6079 11.7809 19.7665 10.3516 19.7665C8.92237 19.7665 7.76373 18.6079 7.76373 17.1786C7.76373 15.7493 8.92237 14.5907 10.3516 14.5907C11.7809 14.5907 12.9395 15.7493 12.9395 17.1786Z",
|
|
1336
|
+
fill: "currentColor"
|
|
1337
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1338
|
+
strokeWidth: "0",
|
|
1339
|
+
d: "M19.4093 17.1786C19.4093 18.6079 18.2507 19.7665 16.8214 19.7665C15.3921 19.7665 14.2335 18.6079 14.2335 17.1786C14.2335 15.7493 15.3921 14.5907 16.8214 14.5907C18.2507 14.5907 19.4093 15.7493 19.4093 17.1786Z",
|
|
1340
|
+
fill: "currentColor"
|
|
1341
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1342
|
+
strokeWidth: "0",
|
|
1343
|
+
d: "M25.8791 17.1786C25.8791 18.6079 24.7204 19.7665 23.2912 19.7665C21.8619 19.7665 20.7033 18.6079 20.7033 17.1786C20.7033 15.7493 21.8619 14.5907 23.2912 14.5907C24.7204 14.5907 25.8791 15.7493 25.8791 17.1786Z",
|
|
1344
|
+
fill: "currentColor"
|
|
1345
|
+
}));
|
|
1346
|
+
}
|
|
1347
|
+
case "chat-new": {
|
|
1348
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1349
|
+
viewBox: "0 0 26 24"
|
|
1350
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1351
|
+
d: "M22.1109 10.3813C22.3941 10.2876 22.6674 10.1722 22.9288 10.0371C23.1902 10.9797 23.33 11.9734 23.33 13C23.33 19.0751 18.4348 24 12.3962 24C9.6352 24 7.11325 22.9705 5.18893 21.2721L0.82251 22.8226C0.277922 23.0159 -0.207515 22.4161 0.0911259 21.9188L2.55952 17.8084C1.85665 16.3558 1.46233 14.7242 1.46233 13C1.46233 6.92487 6.35758 2 12.3962 2C13.4013 2 14.3747 2.13645 15.2992 2.39193C15.1628 2.65458 15.0464 2.92925 14.9519 3.21394C14.1358 2.99881 13.2793 2.88427 12.3962 2.88427C6.84301 2.88427 2.34128 7.41324 2.34128 13C2.34128 14.7493 2.78263 16.3949 3.5594 17.8302L1.18047 21.7634L5.41046 20.2757C7.21939 22.034 9.68221 23.1157 12.3962 23.1157C17.9493 23.1157 22.451 18.5868 22.451 13C22.451 12.0944 22.3328 11.2165 22.1109 10.3813Z",
|
|
1352
|
+
fill: "currentColor"
|
|
1353
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1354
|
+
d: "M25.6633 4C25.6633 6.20914 23.8724 8 21.6633 8C19.4541 8 17.6633 6.20914 17.6633 4C17.6633 1.79086 19.4541 0 21.6633 0C23.8724 0 25.6633 1.79086 25.6633 4Z",
|
|
1355
|
+
fill: "currentColor"
|
|
1356
|
+
}));
|
|
1357
|
+
}
|
|
1358
|
+
case "agent": {
|
|
1359
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1360
|
+
viewBox: "0 0 36 30"
|
|
1361
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1362
|
+
d: "M0.900024 15.3887C0.900024 12.9034 2.91474 10.8887 5.40002 10.8887H6.28179V20.0995H5.40002C2.91474 20.0995 0.900024 18.0848 0.900024 15.5995V15.3887Z",
|
|
1363
|
+
stroke: "white"
|
|
1364
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1365
|
+
d: "M34.65 15.5996C34.65 18.0849 32.6353 20.0996 30.15 20.0996L29.2683 20.0996L29.2683 10.8888L30.15 10.8888C32.6353 10.8888 34.65 12.9035 34.65 15.3888L34.65 15.5996Z",
|
|
1366
|
+
stroke: "white"
|
|
1367
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1368
|
+
d: "M29.2565 20.5974C29.2565 26.341 22.8747 26.9792 19.6838 26.9792",
|
|
1369
|
+
stroke: "white"
|
|
1370
|
+
}), /* @__PURE__ */ React.createElement("circle", {
|
|
1371
|
+
cx: "17.4074",
|
|
1372
|
+
cy: "26.9795",
|
|
1373
|
+
r: "2.05271",
|
|
1374
|
+
stroke: "white"
|
|
1375
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1376
|
+
d: "M6.28467 12.9396C6.28467 11.195 6.28686 18.0452 6.28467 8.47234C6.28248 -1.10049 29.2591 -1.10047 29.259 8.47234C29.259 18.0452 29.2569 11.6631 29.259 12.9396",
|
|
1377
|
+
stroke: "white"
|
|
1378
|
+
}));
|
|
1379
|
+
}
|
|
1380
|
+
case "minimize": {
|
|
1381
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1382
|
+
viewBox: "0 -10 22 22"
|
|
1383
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1384
|
+
d: "M0 1H22",
|
|
1385
|
+
stroke: "white"
|
|
1386
|
+
}));
|
|
1387
|
+
}
|
|
1388
|
+
case "sorting": {
|
|
1389
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1390
|
+
viewBox: "0 0 18 14"
|
|
1391
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1392
|
+
d: "M18 1H0M8 13H0M13 7H0"
|
|
1393
|
+
}));
|
|
1394
|
+
}
|
|
1395
|
+
case "copy": {
|
|
1396
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1397
|
+
viewBox: "0 0 19 17"
|
|
1398
|
+
}, svgProps), /* @__PURE__ */ React.createElement("rect", {
|
|
1399
|
+
x: "0.5",
|
|
1400
|
+
y: "0.5",
|
|
1401
|
+
width: "11.6667",
|
|
1402
|
+
height: "11.6014",
|
|
1403
|
+
rx: "1.5",
|
|
1404
|
+
fill: "white"
|
|
1405
|
+
}), /* @__PURE__ */ React.createElement("rect", {
|
|
1406
|
+
x: "6.83301",
|
|
1407
|
+
y: "4.89868",
|
|
1408
|
+
width: "11.6667",
|
|
1409
|
+
height: "11.6014",
|
|
1410
|
+
rx: "1.5",
|
|
1411
|
+
fill: "white"
|
|
1412
|
+
}));
|
|
1413
|
+
}
|
|
1414
|
+
case "print": {
|
|
1415
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1416
|
+
viewBox: "0 0 16 17"
|
|
1417
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1418
|
+
d: "M4.31592 0.999999C4.31592 0.723857 4.53977 0.5 4.81592 0.5H11.1845C11.4606 0.5 11.6845 0.723858 11.6845 1V4.53323H4.31592V0.999999Z",
|
|
1419
|
+
fill: "white",
|
|
1420
|
+
stroke: "black"
|
|
1421
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1422
|
+
d: "M0.5 4.84595C0.5 4.56981 0.723858 4.34595 1 4.34595H15C15.2761 4.34595 15.5 4.5698 15.5 4.84595V10.8399C15.5 11.116 15.2761 11.3399 15 11.3399H1C0.723858 11.3399 0.5 11.116 0.5 10.8399V4.84595Z",
|
|
1423
|
+
fill: "white",
|
|
1424
|
+
stroke: "black"
|
|
1425
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1426
|
+
d: "M4.31592 10.0061C4.31592 9.72996 4.53978 9.5061 4.81592 9.5061H11.1845C11.4606 9.5061 11.6845 9.72996 11.6845 10.0061V16.0001C11.6845 16.2762 11.4606 16.5001 11.1845 16.5001H4.81592C4.53978 16.5001 4.31592 16.2762 4.31592 16.0001V10.0061Z",
|
|
1427
|
+
fill: "white",
|
|
1428
|
+
stroke: "black"
|
|
1429
|
+
}), /* @__PURE__ */ React.createElement("line", {
|
|
1430
|
+
x1: "5.29004",
|
|
1431
|
+
y1: "10.8323",
|
|
1432
|
+
x2: "10.7101",
|
|
1433
|
+
y2: "10.8323",
|
|
1434
|
+
stroke: "black"
|
|
1435
|
+
}), /* @__PURE__ */ React.createElement("line", {
|
|
1436
|
+
x1: "5.29004",
|
|
1437
|
+
y1: "12.5242",
|
|
1438
|
+
x2: "10.7101",
|
|
1439
|
+
y2: "12.5242",
|
|
1440
|
+
stroke: "black"
|
|
1441
|
+
}), /* @__PURE__ */ React.createElement("line", {
|
|
1442
|
+
x1: "5.29004",
|
|
1443
|
+
y1: "14.2161",
|
|
1444
|
+
x2: "10.7101",
|
|
1445
|
+
y2: "14.2161",
|
|
1446
|
+
stroke: "black"
|
|
1447
|
+
}));
|
|
1448
|
+
}
|
|
1449
|
+
case "language": {
|
|
1450
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1451
|
+
viewBox: "0 0 19 19"
|
|
1452
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1453
|
+
d: "M9.5 18C14.1944 18 18 14.1944 18 9.5C18 4.80558 14.1944 1 9.5 1M9.5 18C4.80558 18 1 14.1944 1 9.5C1 4.80558 4.80558 1 9.5 1M9.5 18C11.823 18 13.7062 14.1944 13.7062 9.5C13.7062 4.80558 11.823 1 9.5 1M9.5 18C7.17699 18 5.29381 14.1944 5.29381 9.5C5.29381 4.80558 7.17699 1 9.5 1M1.44333 6.78351H17.4742M1.3088 11.7784H17.6912",
|
|
1454
|
+
stroke: "black"
|
|
1455
|
+
}));
|
|
1456
|
+
}
|
|
1457
|
+
case "information": {
|
|
1458
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1459
|
+
viewBox: "0 0 17 17"
|
|
1460
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1461
|
+
d: "M9.72182 5.99993C10.0524 5.99993 10.3203 5.73198 10.3203 5.40145C10.3203 5.07092 10.0524 4.80297 9.72182 4.80297C9.39129 4.80297 9.12335 5.07092 9.12335 5.40145C9.12335 5.73198 9.39129 5.99993 9.72182 5.99993Z",
|
|
1462
|
+
fill: "black"
|
|
1463
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1464
|
+
d: "M7.21887 6.67639C6.89117 6.71981 6.66072 7.02066 6.70414 7.34836C6.74756 7.67605 7.04841 7.9065 7.3761 7.86308L8.353 7.73364L7.17405 11.3945C7.11289 11.5844 7.15164 11.7825 7.26117 11.932C7.38068 12.1287 7.60875 12.2469 7.85155 12.2147L9.40669 12.0087C9.73436 11.9653 9.96479 11.6645 9.92137 11.3368C9.87795 11.0091 9.57713 10.7787 9.24947 10.8221L8.58762 10.9098L9.76774 7.24534C9.83038 7.05084 9.78821 6.84771 9.67254 6.69702C9.55085 6.50877 9.32791 6.39694 9.09093 6.42834L7.21887 6.67639Z",
|
|
1465
|
+
fill: "black"
|
|
1466
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1467
|
+
fillRule: "evenodd",
|
|
1468
|
+
clipRule: "evenodd",
|
|
1469
|
+
d: "M17 8.5C17 13.1944 13.1944 17 8.5 17C3.80558 17 0 13.1944 0 8.5C0 3.80558 3.80558 0 8.5 0C13.1944 0 17 3.80558 17 8.5ZM16 8.5C16 12.8454 12.8454 16 8.5 16C4.15461 16 1 12.8454 1 8.5C1 4.15461 4.15461 1 8.5 1C12.8454 1 16 4.15461 16 8.5Z",
|
|
1470
|
+
fill: "black"
|
|
1471
|
+
}));
|
|
1472
|
+
}
|
|
1473
|
+
case "options": {
|
|
1474
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1475
|
+
viewBox: "0 0 16 2"
|
|
1476
|
+
}, svgProps), /* @__PURE__ */ React.createElement("circle", {
|
|
1477
|
+
cx: "15",
|
|
1478
|
+
cy: "1",
|
|
1479
|
+
r: "1",
|
|
1480
|
+
transform: "rotate(90 15 1)",
|
|
1481
|
+
fill: "black"
|
|
1482
|
+
}), /* @__PURE__ */ React.createElement("circle", {
|
|
1483
|
+
cx: "1",
|
|
1484
|
+
cy: "1",
|
|
1485
|
+
r: "1",
|
|
1486
|
+
transform: "rotate(90 1 1)",
|
|
1487
|
+
fill: "black"
|
|
1488
|
+
}), /* @__PURE__ */ React.createElement("circle", {
|
|
1489
|
+
cx: "8",
|
|
1490
|
+
cy: "1",
|
|
1491
|
+
r: "1",
|
|
1492
|
+
transform: "rotate(90 8 1)",
|
|
1493
|
+
fill: "black"
|
|
1494
|
+
}));
|
|
1495
|
+
}
|
|
1496
|
+
case "browse": {
|
|
1497
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1498
|
+
viewBox: "0 0 24 24"
|
|
1499
|
+
}, svgProps), /* @__PURE__ */ React.createElement("circle", {
|
|
1500
|
+
cx: "12",
|
|
1501
|
+
cy: "12",
|
|
1502
|
+
r: "12",
|
|
1503
|
+
fill: "currentColor"
|
|
1504
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1505
|
+
"fill-rule": "evenodd",
|
|
1506
|
+
"clip-rule": "evenodd",
|
|
1507
|
+
d: "M6.16663 7.33334C6.16663 6.68901 6.68896 6.16667 7.33329 6.16667H10.25C10.8943 6.16667 11.4166 6.68901 11.4166 7.33334V10.25C11.4166 10.8943 10.8943 11.4167 10.25 11.4167H7.33329C6.68896 11.4167 6.16663 10.8943 6.16663 10.25V7.33334ZM7.33329 7.04167H10.25C10.411 7.04167 10.5416 7.17226 10.5416 7.33334V10.25C10.5416 10.4111 10.411 10.5417 10.25 10.5417H7.33329C7.17221 10.5417 7.04163 10.4111 7.04163 10.25V7.33334C7.04163 7.17226 7.17221 7.04167 7.33329 7.04167Z",
|
|
1508
|
+
fill: "white"
|
|
1509
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1510
|
+
"fill-rule": "evenodd",
|
|
1511
|
+
"clip-rule": "evenodd",
|
|
1512
|
+
d: "M6.16663 13.75C6.16663 13.1057 6.68896 12.5833 7.33329 12.5833H10.25C10.8943 12.5833 11.4166 13.1057 11.4166 13.75V16.6667C11.4166 17.311 10.8943 17.8333 10.25 17.8333H7.33329C6.68896 17.8333 6.16663 17.311 6.16663 16.6667V13.75ZM7.33329 13.4583H10.25C10.411 13.4583 10.5416 13.5889 10.5416 13.75V16.6667C10.5416 16.8278 10.411 16.9583 10.25 16.9583H7.33329C7.17221 16.9583 7.04163 16.8278 7.04163 16.6667V13.75C7.04163 13.5889 7.17221 13.4583 7.33329 13.4583Z",
|
|
1513
|
+
fill: "white"
|
|
1514
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1515
|
+
"fill-rule": "evenodd",
|
|
1516
|
+
"clip-rule": "evenodd",
|
|
1517
|
+
d: "M13.75 6.16667C13.1056 6.16667 12.5833 6.68901 12.5833 7.33334V10.25C12.5833 10.8943 13.1056 11.4167 13.75 11.4167H16.6666C17.311 11.4167 17.8333 10.8943 17.8333 10.25V7.33334C17.8333 6.68901 17.311 6.16667 16.6666 6.16667H13.75ZM16.6666 7.04167H13.75C13.5889 7.04167 13.4583 7.17226 13.4583 7.33334V10.25C13.4583 10.4111 13.5889 10.5417 13.75 10.5417H16.6666C16.8277 10.5417 16.9583 10.4111 16.9583 10.25V7.33334C16.9583 7.17226 16.8277 7.04167 16.6666 7.04167Z",
|
|
1518
|
+
fill: "white"
|
|
1519
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1520
|
+
"fill-rule": "evenodd",
|
|
1521
|
+
"clip-rule": "evenodd",
|
|
1522
|
+
d: "M17.8333 15.2083C17.8333 16.6581 16.658 17.8333 15.2083 17.8333C13.7585 17.8333 12.5833 16.6581 12.5833 15.2083C12.5833 13.7586 13.7585 12.5833 15.2083 12.5833C16.658 12.5833 17.8333 13.7586 17.8333 15.2083ZM16.9583 15.2083C16.9583 16.1748 16.1748 16.9583 15.2083 16.9583C14.2418 16.9583 13.4583 16.1748 13.4583 15.2083C13.4583 14.2418 14.2418 13.4583 15.2083 13.4583C16.1748 13.4583 16.9583 14.2418 16.9583 15.2083Z",
|
|
1523
|
+
fill: "white"
|
|
1524
|
+
}));
|
|
1525
|
+
}
|
|
1526
|
+
case "star-empty": {
|
|
1527
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1528
|
+
viewBox: "0 0 13 12"
|
|
1529
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1530
|
+
d: "M2 5.2767L5.11944 4.81796L6.70023 2L7.96487 4.81796L11 5.51699L8.75527 7.64684L9.18735 11L6.42623 9.40534L3.62295 10.7925L4.21311 7.64684L2 5.2767Z",
|
|
1531
|
+
stroke: "black"
|
|
1532
|
+
}));
|
|
1533
|
+
}
|
|
1534
|
+
case "star-filled": {
|
|
1535
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1536
|
+
viewBox: "0 0 13 12"
|
|
1537
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1538
|
+
d: "M2 5.2767L5.11944 4.81796L6.70023 2L7.96487 4.81796L11 5.51699L8.75527 7.64684L9.18735 11L6.42623 9.40534L3.62295 10.7925L4.21311 7.64684L2 5.2767Z",
|
|
1539
|
+
fill: "black",
|
|
1540
|
+
stroke: "black"
|
|
1541
|
+
}));
|
|
1542
|
+
}
|
|
1543
|
+
case "cog-wheel": {
|
|
1544
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1545
|
+
viewBox: "0 0 24 24"
|
|
1546
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1547
|
+
fillRule: "evenodd",
|
|
1548
|
+
clipRule: "evenodd",
|
|
1549
|
+
d: "M15.273 2.68498V1C15.273 0.447715 14.8253 0 14.273 0H9.72754C9.17525 0 8.72754 0.447715 8.72754 1V2.6852C8.72754 3.20708 8.09656 3.46843 7.72754 3.09941L6.53588 1.90775C6.14536 1.51723 5.51219 1.51723 5.12167 1.90775L1.90755 5.12187C1.51702 5.5124 1.51702 6.14556 1.90755 6.53609L3.09865 7.72719C3.46767 8.09621 3.20632 8.72719 2.68444 8.72719H1C0.447715 8.72719 0 9.1749 0 9.72719V14.2726C0 14.8249 0.447715 15.2726 1 15.2726H2.68534C3.20722 15.2726 3.46857 15.9036 3.09955 16.2726L1.90793 17.4643C1.51741 17.8548 1.51741 18.488 1.90793 18.8785L5.12205 22.0926C5.51258 22.4831 6.14574 22.4831 6.53627 22.0926L7.72754 20.9013C8.09656 20.5323 8.72754 20.7937 8.72754 21.3155V23C8.72754 23.5523 9.17525 24 9.72754 24H14.273C14.8253 24 15.273 23.5523 15.273 23V21.3158C15.273 20.7939 15.904 20.5325 16.273 20.9015L17.4639 22.0924C17.8544 22.483 18.4876 22.483 18.8781 22.0924L22.0922 18.8783C22.4828 18.4878 22.4828 17.8546 22.0922 17.4641L20.9008 16.2726C20.5317 15.9036 20.7931 15.2726 21.315 15.2726H23C23.5523 15.2726 24 14.8249 24 14.2726V9.72719C24 9.1749 23.5523 8.72719 23 8.72719H21.3159C20.794 8.72719 20.5326 8.09621 20.9017 7.72719L22.0926 6.53625C22.4831 6.14572 22.4831 5.51256 22.0926 5.12203L18.8785 1.90791C18.488 1.51739 17.8548 1.51739 17.4643 1.90791L16.273 3.0992C15.904 3.46822 15.273 3.20686 15.273 2.68498ZM16.5792 4.20716C16.263 4.52345 15.7775 4.58532 15.3687 4.40375C15.2439 4.34832 15.1174 4.29587 14.9895 4.2465C14.5723 4.08555 14.273 3.69861 14.273 3.25149V2C14.273 1.44771 13.8253 1 13.273 1H10.7275C10.1753 1 9.72754 1.44772 9.72754 2V3.25116C9.72754 3.69832 9.42816 4.08528 9.01096 4.2462C8.88288 4.29561 8.75633 4.34809 8.6314 4.40357C8.22262 4.58511 7.73715 4.52323 7.42087 4.20695L6.53588 3.32196C6.14536 2.93144 5.51219 2.93144 5.12167 3.32196L3.32176 5.12187C2.93124 5.5124 2.93124 6.14556 3.32176 6.53609L4.20676 7.42109C4.52303 7.73736 4.58491 8.22283 4.40338 8.63161C4.34797 8.75638 4.29555 8.88276 4.2462 9.01067C4.08526 9.42784 3.69831 9.72719 3.25118 9.72719H2C1.44772 9.72719 1 10.1749 1 10.7272V13.2726C1 13.8249 1.44772 14.2726 2 14.2726H3.2511C3.69825 14.2726 4.0852 14.572 4.24614 14.9892C4.29556 15.1173 4.34807 15.2439 4.40357 15.3688C4.58513 15.7776 4.52327 16.2631 4.20698 16.5794L3.32215 17.4643C2.93162 17.8548 2.93162 18.488 3.32215 18.8785L5.12205 20.6784C5.51258 21.0689 6.14574 21.0689 6.53627 20.6784L7.42136 19.7933C7.73762 19.477 8.22305 19.4151 8.63183 19.5966C8.75662 19.6521 8.88302 19.7045 9.01096 19.7538C9.42816 19.9147 9.72754 20.3017 9.72754 20.7489V22C9.72754 22.5523 10.1753 23 10.7275 23H13.273C13.8253 23 14.273 22.5523 14.273 22V20.7485C14.273 20.3014 14.5723 19.9145 14.9895 19.7535C15.1173 19.7042 15.2436 19.6518 15.3682 19.5965C15.777 19.4149 16.2625 19.4768 16.5788 19.7931L17.4639 20.6782C17.8544 21.0687 18.4876 21.0687 18.8781 20.6782L20.678 18.8783C21.0685 18.4878 21.0685 17.8546 20.678 17.4641L19.7929 16.579C19.4766 16.2627 19.4147 15.7772 19.5963 15.3684C19.6517 15.2436 19.7042 15.1172 19.7535 14.9892C19.9145 14.572 20.3014 14.2726 20.7486 14.2726H22C22.5523 14.2726 23 13.8249 23 13.2726V10.7272C23 10.1749 22.5523 9.72719 22 9.72719H20.7485C20.3013 9.72719 19.9144 9.42784 19.7535 9.01067C19.7042 8.8829 19.6518 8.75665 19.5965 8.63201C19.415 8.22324 19.4768 7.7378 19.7931 7.42154L20.6784 6.53625C21.0689 6.14572 21.0689 5.51256 20.6784 5.12203L18.8785 3.32213C18.488 2.9316 17.8548 2.9316 17.4643 3.32213L16.5792 4.20716ZM16.5999 12.0001C16.5999 14.5406 14.5404 16.6001 11.9999 16.6001C9.45939 16.6001 7.3999 14.5406 7.3999 12.0001C7.3999 9.45958 9.45939 7.40009 11.9999 7.40009C14.5404 7.40009 16.5999 9.45958 16.5999 12.0001ZM17.5999 12.0001C17.5999 15.0929 15.0927 17.6001 11.9999 17.6001C8.90711 17.6001 6.3999 15.0929 6.3999 12.0001C6.3999 8.90729 8.90711 6.40009 11.9999 6.40009C15.0927 6.40009 17.5999 8.90729 17.5999 12.0001Z",
|
|
1550
|
+
fill: "black"
|
|
1551
|
+
}));
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
return null;
|
|
1555
|
+
}
|
|
1556
|
+
case "FontAwesome": {
|
|
1557
|
+
return /* @__PURE__ */ React.createElement(Icon, __spreadValues({
|
|
1558
|
+
className,
|
|
1559
|
+
faIcon: content,
|
|
1560
|
+
title: text
|
|
1561
|
+
}, other));
|
|
1562
|
+
}
|
|
1563
|
+
default:
|
|
1564
|
+
case "Text": {
|
|
1565
|
+
return text ? /* @__PURE__ */ React.createElement("i", __spreadValues(__spreadValues({
|
|
1566
|
+
className: appendClassNames(className, "humany-letter-symbol"),
|
|
1567
|
+
title: text
|
|
1568
|
+
}, sharedProps), other), text.substring(0, 2)) : null;
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
};
|
|
1572
|
+
const CaretUp = styled.svg`
|
|
1573
|
+
transform: rotate(180deg);
|
|
1574
|
+
`;
|
|
1575
|
+
const defaultVariantMapping = {
|
|
1576
|
+
h1: "h1",
|
|
1577
|
+
h2: "h2",
|
|
1578
|
+
h3: "h3",
|
|
1579
|
+
h4: "h4",
|
|
1580
|
+
h5: "h5",
|
|
1581
|
+
h6: "h6",
|
|
1582
|
+
p: "p",
|
|
1583
|
+
span: "span"
|
|
1584
|
+
};
|
|
1585
|
+
const Typography = ({ variant, component, className, children }) => {
|
|
1586
|
+
const { typographyVariantMapping = {} } = useContext();
|
|
1587
|
+
const variantMapping = __spreadValues(__spreadValues({}, defaultVariantMapping), typographyVariantMapping);
|
|
1588
|
+
const Component2 = component || variantMapping[variant] || "span";
|
|
1589
|
+
return /* @__PURE__ */ React.createElement(Base, {
|
|
1590
|
+
className,
|
|
1591
|
+
as: Component2
|
|
1592
|
+
}, children);
|
|
1593
|
+
};
|
|
1594
|
+
const Base = styled.span``;
|
|
1595
|
+
var AnimationType = /* @__PURE__ */ ((AnimationType2) => {
|
|
1596
|
+
AnimationType2["SlideInLeft"] = "slide-in-left";
|
|
1597
|
+
AnimationType2["SlideInRight"] = "slide-in-right";
|
|
1598
|
+
AnimationType2["SlideInBottom"] = "slide-in-bottom";
|
|
1599
|
+
AnimationType2["SlideInTop"] = "slide-in-top";
|
|
1600
|
+
return AnimationType2;
|
|
1601
|
+
})(AnimationType || {});
|
|
1602
|
+
const defaultDuration = 300;
|
|
1603
|
+
const Drawer = ({
|
|
1604
|
+
className,
|
|
1605
|
+
children,
|
|
1606
|
+
header,
|
|
1607
|
+
onToggle,
|
|
1608
|
+
trigger,
|
|
1609
|
+
fullScreen = false,
|
|
1610
|
+
closeButtonAriaLabel,
|
|
1611
|
+
animation = {
|
|
1612
|
+
type: "slide-in-bottom"
|
|
1613
|
+
}
|
|
1614
|
+
}) => {
|
|
1615
|
+
const { duration = defaultDuration } = animation;
|
|
1616
|
+
const closeButtonRef = useRef();
|
|
1617
|
+
const triggerRef = useRef();
|
|
1618
|
+
const [css2, ref] = useScroll(true);
|
|
1619
|
+
const [visible, toggleVisible] = useToggle();
|
|
1620
|
+
const previousVisible = usePrevious(visible);
|
|
1621
|
+
const id = useRef(uuid());
|
|
1622
|
+
useEffect(() => {
|
|
1623
|
+
if (onToggle) {
|
|
1624
|
+
onToggle(visible);
|
|
1625
|
+
}
|
|
1626
|
+
}, [visible]);
|
|
1627
|
+
const esc = useKeyPress("Escape");
|
|
1628
|
+
useEffect(() => {
|
|
1629
|
+
if (esc) {
|
|
1630
|
+
toggleVisible(false);
|
|
1631
|
+
}
|
|
1632
|
+
}, [esc]);
|
|
1633
|
+
useEventListener("click", (event) => {
|
|
1634
|
+
const { target } = event;
|
|
1635
|
+
if (!triggerRef.current || !ref.current || !target) {
|
|
1636
|
+
return;
|
|
1637
|
+
}
|
|
1638
|
+
if (triggerRef.current !== target && ref.current !== target && !ref.current.contains(target) && !triggerRef.current.contains(target)) {
|
|
1639
|
+
toggleVisible(false);
|
|
1640
|
+
}
|
|
1641
|
+
}, window);
|
|
1642
|
+
const closeMenus = useUniqueMenu(id.current, () => {
|
|
1643
|
+
toggleVisible(false);
|
|
1644
|
+
});
|
|
1645
|
+
useWidgetEvent("router:changed", () => {
|
|
1646
|
+
toggleVisible(false);
|
|
1647
|
+
});
|
|
1648
|
+
useEffect(() => {
|
|
1649
|
+
if (visible && closeButtonRef.current) {
|
|
1650
|
+
closeButtonRef.current.focus();
|
|
1651
|
+
} else if (!visible && triggerRef.current && previousVisible) {
|
|
1652
|
+
triggerRef.current.focus();
|
|
1653
|
+
}
|
|
1654
|
+
}, [visible, closeButtonRef.current, triggerRef.current]);
|
|
1655
|
+
const WrapperWithAnimation = animations[animation.type];
|
|
1656
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(CSSTransition, {
|
|
1657
|
+
in: visible,
|
|
1658
|
+
className: "humany-drawer-transition",
|
|
1659
|
+
classNames: "humany-drawer-transition",
|
|
1660
|
+
unmountOnExit: true,
|
|
1661
|
+
timeout: duration
|
|
1662
|
+
}, /* @__PURE__ */ React.createElement(Portal, null, /* @__PURE__ */ React.createElement(WrapperWithAnimation, {
|
|
1663
|
+
duration,
|
|
1664
|
+
fullScreen,
|
|
1665
|
+
className: appendClassNames(className, "humany-drawer", `humany-drawer-${id.current}`),
|
|
1666
|
+
clientHeight: document.body.clientHeight,
|
|
1667
|
+
css: css2,
|
|
1668
|
+
ref
|
|
1669
|
+
}, /* @__PURE__ */ React.createElement(CloseButton$1, {
|
|
1670
|
+
onClick: () => toggleVisible(false),
|
|
1671
|
+
tabIndex: 0,
|
|
1672
|
+
ref: closeButtonRef,
|
|
1673
|
+
"aria-label": closeButtonAriaLabel
|
|
1674
|
+
}, /* @__PURE__ */ React.createElement(SymbolBadge, {
|
|
1675
|
+
symbol: { type: "Svg", content: "close" }
|
|
1676
|
+
})), !!header && /* @__PURE__ */ React.createElement(Header$1, {
|
|
1677
|
+
variant: "h1",
|
|
1678
|
+
className: "humany-drawer-header"
|
|
1679
|
+
}, header), children))), React.cloneElement(trigger, {
|
|
1680
|
+
onClick: (event) => {
|
|
1681
|
+
toggleVisible();
|
|
1682
|
+
closeMenus();
|
|
1683
|
+
},
|
|
1684
|
+
ref: triggerRef,
|
|
1685
|
+
"aria-label": trigger.props.title,
|
|
1686
|
+
"aria-expanded": visible
|
|
1687
|
+
}));
|
|
1688
|
+
};
|
|
1689
|
+
const Wrapper$4 = styled.div`
|
|
1690
|
+
font-family: ${(p) => {
|
|
1691
|
+
var _a;
|
|
1692
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.type;
|
|
1693
|
+
}};
|
|
1694
|
+
font-size: ${(p) => {
|
|
1695
|
+
var _a;
|
|
1696
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
|
|
1697
|
+
}};
|
|
1698
|
+
position: fixed;
|
|
1699
|
+
bottom: 0;
|
|
1700
|
+
left: 0;
|
|
1701
|
+
border: ${(p) => p.theme.border};
|
|
1702
|
+
width: 100%;
|
|
1703
|
+
box-shadow: ${(p) => p.theme.boxShadow};
|
|
1704
|
+
background: #ffffff;
|
|
1705
|
+
${(p) => p.css && p.css}
|
|
1706
|
+
`;
|
|
1707
|
+
const Header$1 = styled(Typography)`
|
|
1708
|
+
padding: ${(p) => p.theme.sizes.normal};
|
|
1709
|
+
margin: 0;
|
|
1710
|
+
text-align: center;
|
|
1711
|
+
border-bottom: #eeeeee 1px solid;
|
|
1712
|
+
background: #ffffff;
|
|
1713
|
+
position: relative;
|
|
1714
|
+
display: flex;
|
|
1715
|
+
justify-content: center;
|
|
1716
|
+
align-items: center;
|
|
1717
|
+
font-weight: bold;
|
|
1718
|
+
color: ${(p) => {
|
|
1719
|
+
var _a;
|
|
1720
|
+
return (_a = p.theme.colors) == null ? void 0 : _a.text;
|
|
1721
|
+
}};
|
|
1722
|
+
font-size: ${(p) => {
|
|
1723
|
+
var _a;
|
|
1724
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
|
|
1725
|
+
}};
|
|
1726
|
+
line-height: 1.2em;
|
|
1727
|
+
`;
|
|
1728
|
+
const AnimationBase = css`
|
|
1729
|
+
transition: ${(p) => p.duration}ms;
|
|
1730
|
+
`;
|
|
1731
|
+
const WrapperWithSlideInBottom = styled(Wrapper$4)`
|
|
1732
|
+
max-height: 0;
|
|
1733
|
+
${AnimationBase}
|
|
1734
|
+
|
|
1735
|
+
&.humany-drawer-transition-enter {
|
|
1736
|
+
max-height: 0;
|
|
1737
|
+
}
|
|
1738
|
+
&.humany-drawer-transition-enter-active,
|
|
1739
|
+
&.humany-drawer-transition-enter-done,
|
|
1740
|
+
&.humany-drawer-transition-exit {
|
|
1741
|
+
max-height: ${(p) => p.fullScreen ? "100%" : "400px"};
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
&.humany-drawer-transition-exit-active,
|
|
1745
|
+
&.humany-drawer-transition-exit-done {
|
|
1746
|
+
max-height: 0;
|
|
1747
|
+
}
|
|
1748
|
+
`;
|
|
1749
|
+
const WrapperWithSlideInRight = styled(Wrapper$4)`
|
|
1750
|
+
${AnimationBase}
|
|
1751
|
+
transform: translateX(100%);
|
|
1752
|
+
height: ${(p) => p.fullScreen ? "100%" : "auto"};
|
|
1753
|
+
|
|
1754
|
+
&.humany-drawer-transition-enter {
|
|
1755
|
+
transform: translateX(100%);
|
|
1756
|
+
}
|
|
1757
|
+
&.humany-drawer-transition-enter-active,
|
|
1758
|
+
&.humany-drawer-transition-enter-done,
|
|
1759
|
+
&.humany-drawer-transition-exit {
|
|
1760
|
+
transform: translateX(0);
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
&.humany-drawer-transition-exit-active,
|
|
1764
|
+
&.humany-drawer-transition-exit-done {
|
|
1765
|
+
transform: translateX(100%);
|
|
1766
|
+
}
|
|
1767
|
+
`;
|
|
1768
|
+
const WrapperWithSlideInLeft = styled(Wrapper$4)`
|
|
1769
|
+
${AnimationBase}
|
|
1770
|
+
transform: translateX(-100%);
|
|
1771
|
+
height: ${(p) => p.fullScreen ? "100%" : "auto"};
|
|
1772
|
+
|
|
1773
|
+
&.humany-drawer-transition-enter {
|
|
1774
|
+
transform: translateX(-100%);
|
|
1775
|
+
}
|
|
1776
|
+
&.humany-drawer-transition-enter-active,
|
|
1777
|
+
&.humany-drawer-transition-enter-done,
|
|
1778
|
+
&.humany-drawer-transition-exit {
|
|
1779
|
+
transform: translateX(0);
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
&.humany-drawer-transition-exit-active,
|
|
1783
|
+
&.humany-drawer-transition-exit-done {
|
|
1784
|
+
transform: translateX(-100%);
|
|
1785
|
+
}
|
|
1786
|
+
`;
|
|
1787
|
+
const WrapperWithSlideInTop = styled(Wrapper$4)`
|
|
1788
|
+
${AnimationBase}
|
|
1789
|
+
bottom: unset;
|
|
1790
|
+
top: 0;
|
|
1791
|
+
height: 0;
|
|
1792
|
+
|
|
1793
|
+
&.humany-drawer-transition-enter {
|
|
1794
|
+
height: 0;
|
|
1795
|
+
}
|
|
1796
|
+
&.humany-drawer-transition-enter-active,
|
|
1797
|
+
&.humany-drawer-transition-enter-done,
|
|
1798
|
+
&.humany-drawer-transition-exit {
|
|
1799
|
+
height: ${(p) => p.clientHeight}px;
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
&.humany-drawer-transition-exit-active,
|
|
1803
|
+
&.humany-drawer-transition-exit-done {
|
|
1804
|
+
height: 0;
|
|
1805
|
+
}
|
|
1806
|
+
`;
|
|
1807
|
+
const animations = {
|
|
1808
|
+
["slide-in-bottom"]: WrapperWithSlideInBottom,
|
|
1809
|
+
["slide-in-right"]: WrapperWithSlideInRight,
|
|
1810
|
+
["slide-in-left"]: WrapperWithSlideInLeft,
|
|
1811
|
+
["slide-in-top"]: WrapperWithSlideInTop
|
|
1812
|
+
};
|
|
1813
|
+
const usePosition = (visible, id, element) => {
|
|
1814
|
+
const [posX, setPosX] = useState(0);
|
|
1815
|
+
const [posY, setPosY] = useState(0);
|
|
1816
|
+
const set = useCallback((event, trigger) => {
|
|
1817
|
+
event.preventDefault();
|
|
1818
|
+
if (trigger) {
|
|
1819
|
+
const clientRect = trigger.getBoundingClientRect();
|
|
1820
|
+
setPosX(Math.max(document.body.clientWidth - clientRect.right, 1));
|
|
1821
|
+
setPosY(clientRect.bottom + window.scrollY);
|
|
1822
|
+
}
|
|
1823
|
+
}, [posX, posY, setPosX, setPosY]);
|
|
1824
|
+
useEffect(() => {
|
|
1825
|
+
if (!element || !visible) {
|
|
1826
|
+
return;
|
|
1827
|
+
}
|
|
1828
|
+
const clientRect = element.getBoundingClientRect();
|
|
1829
|
+
const newPos = {
|
|
1830
|
+
x: posX,
|
|
1831
|
+
y: posY
|
|
1832
|
+
};
|
|
1833
|
+
if (clientRect.left < 0) {
|
|
1834
|
+
newPos.x = 0;
|
|
1835
|
+
}
|
|
1836
|
+
if (clientRect.bottom > window.innerHeight) {
|
|
1837
|
+
newPos.y = 0;
|
|
1838
|
+
}
|
|
1839
|
+
if (newPos.x !== posX) {
|
|
1840
|
+
setPosX(newPos.x);
|
|
1841
|
+
}
|
|
1842
|
+
if (newPos.y !== posY) {
|
|
1843
|
+
setPosY(newPos.y);
|
|
1844
|
+
}
|
|
1845
|
+
}, [element, visible, id]);
|
|
1846
|
+
return [{ x: posX, y: posY }, set];
|
|
1847
|
+
};
|
|
1848
|
+
const Dropdown = React.forwardRef((_i, ref) => {
|
|
1849
|
+
var _j = _i, { className = "", children = null, trigger, closeButtonAriaLabel } = _j, props = __objRest(_j, ["className", "children", "trigger", "closeButtonAriaLabel"]);
|
|
1850
|
+
const closeButtonRef = useRef();
|
|
1851
|
+
const triggerRef = useRef();
|
|
1852
|
+
const innerRef = useRef();
|
|
1853
|
+
useImperativeHandle(ref, () => innerRef.current, [innerRef.current]);
|
|
1854
|
+
const id = useRef(uuid());
|
|
1855
|
+
const [visible, setVisible] = useState(false);
|
|
1856
|
+
const previousVisible = usePrevious(visible);
|
|
1857
|
+
const [{ x, y }, set] = usePosition(visible, id.current, innerRef.current);
|
|
1858
|
+
const esc = useKeyPress("Escape");
|
|
1859
|
+
useEffect(() => {
|
|
1860
|
+
if (esc) {
|
|
1861
|
+
setVisible(false);
|
|
1862
|
+
}
|
|
1863
|
+
}, [esc]);
|
|
1864
|
+
useEffect(() => {
|
|
1865
|
+
if (visible && closeButtonRef.current) {
|
|
1866
|
+
closeButtonRef.current.focus();
|
|
1867
|
+
} else if (!visible && triggerRef.current && previousVisible) {
|
|
1868
|
+
triggerRef.current.focus();
|
|
1869
|
+
}
|
|
1870
|
+
}, [visible, closeButtonRef.current, triggerRef.current]);
|
|
1871
|
+
useEventListener("click", (event) => {
|
|
1872
|
+
const { target } = event;
|
|
1873
|
+
if (!innerRef.current || !target) {
|
|
1874
|
+
return;
|
|
1875
|
+
}
|
|
1876
|
+
if (innerRef.current !== target && !innerRef.current.contains(target)) {
|
|
1877
|
+
setVisible(false);
|
|
1878
|
+
}
|
|
1879
|
+
}, window);
|
|
1880
|
+
useWidgetEvent("router:changed", () => {
|
|
1881
|
+
setVisible(false);
|
|
1882
|
+
});
|
|
1883
|
+
const closeMenus = useUniqueMenu(id.current, () => {
|
|
1884
|
+
setVisible(false);
|
|
1885
|
+
});
|
|
1886
|
+
const onTriggerClick = useCallback((event) => {
|
|
1887
|
+
event.stopPropagation();
|
|
1888
|
+
set(event, triggerRef.current);
|
|
1889
|
+
setVisible(!visible);
|
|
1890
|
+
closeMenus();
|
|
1891
|
+
}, [closeMenus, set, setVisible]);
|
|
1892
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, visible && /* @__PURE__ */ React.createElement(Portal, null, /* @__PURE__ */ React.createElement(StyledDropdown, __spreadProps(__spreadValues({
|
|
1893
|
+
className: appendClassNames("humany-dropdown", `humany-dropdown-${id.current}`, className)
|
|
1894
|
+
}, props), {
|
|
1895
|
+
x,
|
|
1896
|
+
y,
|
|
1897
|
+
ref: innerRef
|
|
1898
|
+
}), /* @__PURE__ */ React.createElement(CloseButton$1, {
|
|
1899
|
+
onClick: () => setVisible(false),
|
|
1900
|
+
tabIndex: 0,
|
|
1901
|
+
ref: closeButtonRef,
|
|
1902
|
+
"aria-label": closeButtonAriaLabel
|
|
1903
|
+
}, /* @__PURE__ */ React.createElement(SymbolBadge, {
|
|
1904
|
+
symbol: { type: "Svg", content: "close" }
|
|
1905
|
+
})), children)), React.cloneElement(trigger, {
|
|
1906
|
+
onClick: onTriggerClick,
|
|
1907
|
+
ref: triggerRef,
|
|
1908
|
+
"aria-label": trigger.props.title,
|
|
1909
|
+
"aria-expanded": visible
|
|
1910
|
+
}));
|
|
1911
|
+
});
|
|
1912
|
+
const StyledDropdown = styled.div`
|
|
1913
|
+
${contentBox}
|
|
1914
|
+
padding: ${(p) => {
|
|
1915
|
+
var _a;
|
|
1916
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
|
|
1917
|
+
}};
|
|
1918
|
+
min-width: 150px;
|
|
1919
|
+
position: absolute;
|
|
1920
|
+
box-shadow: ${(p) => p.theme.boxShadow};
|
|
1921
|
+
|
|
1922
|
+
${(p) => {
|
|
1923
|
+
var _a, _b, _c;
|
|
1924
|
+
let css2 = "";
|
|
1925
|
+
if (p.y > 0) {
|
|
1926
|
+
css2 += `top: calc(${((_a = p.theme.sizes) == null ? void 0 : _a.small) || "0px"} + ${p.y || "0"}px);`;
|
|
1927
|
+
} else {
|
|
1928
|
+
css2 += `bottom: ${((_b = p.theme.sizes) == null ? void 0 : _b.normal) || "0px"};`;
|
|
1929
|
+
}
|
|
1930
|
+
if (p.x > 0) {
|
|
1931
|
+
css2 += `right: ${p.x || "0"}px;`;
|
|
1932
|
+
} else {
|
|
1933
|
+
css2 += `left: ${((_c = p.theme.sizes) == null ? void 0 : _c.normal) || "0px"};`;
|
|
1934
|
+
}
|
|
1935
|
+
return css2;
|
|
1936
|
+
}};
|
|
1937
|
+
`;
|
|
1938
|
+
const Empty = (_k) => {
|
|
1939
|
+
var other = __objRest(_k, []);
|
|
1940
|
+
return /* @__PURE__ */ React.createElement(Wrapper$3, __spreadValues({}, other));
|
|
1941
|
+
};
|
|
1942
|
+
const Wrapper$3 = styled.div`
|
|
1943
|
+
display: none;
|
|
1944
|
+
`;
|
|
1945
|
+
var grid = forwardRef((_l, ref) => {
|
|
1946
|
+
var _m = _l, { children, columns, gap, className } = _m, other = __objRest(_m, ["children", "columns", "gap", "className"]);
|
|
1947
|
+
return /* @__PURE__ */ React.createElement(Div, __spreadProps(__spreadValues(__spreadValues({
|
|
1948
|
+
className: appendClassNames(className, "humany-grid"),
|
|
1949
|
+
"data-columns": columns,
|
|
1950
|
+
"data-gap": gap
|
|
1951
|
+
}, filterCssProps(other)), convertToStringAttributes(other)), {
|
|
1952
|
+
ref
|
|
1953
|
+
}), children);
|
|
1954
|
+
});
|
|
1955
|
+
const Div = styled.div`
|
|
1956
|
+
display: grid;
|
|
1957
|
+
grid-template-columns: repeat(${(p) => p["data-columns"]}, 1fr);
|
|
1958
|
+
grid-gap: ${(p) => p["data-gap"]};
|
|
1959
|
+
justify-content: center;
|
|
1960
|
+
grid-auto-rows: max-content;
|
|
1961
|
+
${filterCssPropsStyle}
|
|
1962
|
+
`;
|
|
1963
|
+
var Html = forwardRef((_n, ref) => {
|
|
1964
|
+
var _o = _n, { htmlParseInstruction = null, className, html } = _o, other = __objRest(_o, ["htmlParseInstruction", "className", "html"]);
|
|
1965
|
+
const container = useContainer();
|
|
1966
|
+
const [processedHtml, setProcessedHtml] = useState();
|
|
1967
|
+
useEffect(() => {
|
|
1968
|
+
const instructions = htmlParseInstruction || defaultRenderInstructions(container);
|
|
1969
|
+
const processed = parseHtmlString(html, instructions);
|
|
1970
|
+
setProcessedHtml(processed);
|
|
1971
|
+
}, [html, htmlParseInstruction]);
|
|
1972
|
+
return /* @__PURE__ */ React.createElement("div", __spreadProps(__spreadValues({
|
|
1973
|
+
className: appendClassNames(className, "humany-html")
|
|
1974
|
+
}, convertToStringAttributes(other)), {
|
|
1975
|
+
ref
|
|
1976
|
+
}), processedHtml);
|
|
1977
|
+
});
|
|
1978
|
+
const Icon = (_p) => {
|
|
1979
|
+
var _q = _p, {
|
|
1980
|
+
faIcon,
|
|
1981
|
+
title,
|
|
1982
|
+
className = "",
|
|
1983
|
+
role = "presentation"
|
|
1984
|
+
} = _q, other = __objRest(_q, [
|
|
1985
|
+
"faIcon",
|
|
1986
|
+
"title",
|
|
1987
|
+
"className",
|
|
1988
|
+
"role"
|
|
1989
|
+
]);
|
|
1990
|
+
return /* @__PURE__ */ React.createElement("i", __spreadValues({
|
|
1991
|
+
className: appendClassNames(className, `fa fa-${faIcon}`),
|
|
1992
|
+
title,
|
|
1993
|
+
role
|
|
1994
|
+
}, convertToStringAttributes(other)));
|
|
1995
|
+
};
|
|
1996
|
+
var input = forwardRef((_r, ref) => {
|
|
1997
|
+
var _s = _r, {
|
|
1998
|
+
className = "",
|
|
1999
|
+
autoFocus = false,
|
|
2000
|
+
onFocusChange = () => {
|
|
2001
|
+
},
|
|
2002
|
+
onEnter = () => {
|
|
2003
|
+
},
|
|
2004
|
+
onEscape = () => {
|
|
2005
|
+
},
|
|
2006
|
+
selectAllOnFocus,
|
|
2007
|
+
onChange = () => {
|
|
2008
|
+
},
|
|
2009
|
+
disabled = false,
|
|
2010
|
+
type
|
|
2011
|
+
} = _s, other = __objRest(_s, [
|
|
2012
|
+
"className",
|
|
2013
|
+
"autoFocus",
|
|
2014
|
+
"onFocusChange",
|
|
2015
|
+
"onEnter",
|
|
2016
|
+
"onEscape",
|
|
2017
|
+
"selectAllOnFocus",
|
|
2018
|
+
"onChange",
|
|
2019
|
+
"disabled",
|
|
2020
|
+
"type"
|
|
2021
|
+
]);
|
|
2022
|
+
const [hasFocus, setHasFocus] = useState(autoFocus);
|
|
2023
|
+
const innerRef = useRef();
|
|
2024
|
+
useImperativeHandle(ref, () => innerRef.current);
|
|
2025
|
+
useEffect(() => {
|
|
2026
|
+
var _a;
|
|
2027
|
+
if (autoFocus) {
|
|
2028
|
+
(_a = innerRef == null ? void 0 : innerRef.current) == null ? void 0 : _a.focus();
|
|
2029
|
+
}
|
|
2030
|
+
}, [autoFocus, ref, innerRef]);
|
|
2031
|
+
const handleFocus = (inFocus, event) => {
|
|
2032
|
+
setHasFocus(inFocus);
|
|
2033
|
+
onFocusChange && onFocusChange(inFocus);
|
|
2034
|
+
if (selectAllOnFocus && inFocus) {
|
|
2035
|
+
event.target.select();
|
|
2036
|
+
}
|
|
2037
|
+
};
|
|
2038
|
+
const props = __spreadProps(__spreadValues({}, convertToStringAttributes(other)), {
|
|
2039
|
+
disabled,
|
|
2040
|
+
autoFocus,
|
|
2041
|
+
type,
|
|
2042
|
+
onKeyDown: (e) => {
|
|
2043
|
+
if (e.key === "Enter" && hasFocus) {
|
|
2044
|
+
onEnter(e);
|
|
2045
|
+
}
|
|
2046
|
+
if (e.key === "Escape" && hasFocus) {
|
|
2047
|
+
onEscape(e);
|
|
2048
|
+
}
|
|
2049
|
+
},
|
|
2050
|
+
onFocus: (e) => handleFocus(true, e),
|
|
2051
|
+
onBlur: (e) => handleFocus(false, e),
|
|
2052
|
+
onChange: (e) => onChange(e.target.value || ""),
|
|
2053
|
+
className: appendClassNames(className, "humany-input"),
|
|
2054
|
+
"data-type": type
|
|
2055
|
+
});
|
|
2056
|
+
return type !== "textarea" ? /* @__PURE__ */ React.createElement("input", __spreadProps(__spreadValues({}, props), {
|
|
2057
|
+
ref: innerRef
|
|
2058
|
+
})) : /* @__PURE__ */ React.createElement("textarea", __spreadProps(__spreadValues({}, props), {
|
|
2059
|
+
ref: innerRef
|
|
2060
|
+
}));
|
|
2061
|
+
});
|
|
2062
|
+
var List = forwardRef((_t, ref) => {
|
|
2063
|
+
var _u = _t, { className, items, renderItem, renderLi = false } = _u, other = __objRest(_u, ["className", "items", "renderItem", "renderLi"]);
|
|
2064
|
+
return /* @__PURE__ */ React.createElement("ul", __spreadProps(__spreadValues({
|
|
2065
|
+
className: appendClassNames(className, "humany-list"),
|
|
2066
|
+
"data-item-count": items.length
|
|
2067
|
+
}, convertToStringAttributes(other)), {
|
|
2068
|
+
ref
|
|
2069
|
+
}), items.map((item, index, items2) => renderLi ? /* @__PURE__ */ React.createElement("li", {
|
|
2070
|
+
className: "humany-list-item",
|
|
2071
|
+
key: item.id
|
|
2072
|
+
}, renderItem(item, index, items2)) : renderItem(item, index, items2)));
|
|
2073
|
+
});
|
|
2074
|
+
var Paragraph = forwardRef((_v, ref) => {
|
|
2075
|
+
var _w = _v, { text, html, header, className, htmlParseInstruction, symbol } = _w, other = __objRest(_w, ["text", "html", "header", "className", "htmlParseInstruction", "symbol"]);
|
|
2076
|
+
return /* @__PURE__ */ React.createElement("div", __spreadProps(__spreadValues({
|
|
2077
|
+
className: appendClassNames(className, "humany-paragraph")
|
|
2078
|
+
}, convertToStringAttributes(other)), {
|
|
2079
|
+
ref
|
|
2080
|
+
}), header ? /* @__PURE__ */ React.createElement(Typography, {
|
|
2081
|
+
variant: "h1"
|
|
2082
|
+
}, symbol ? /* @__PURE__ */ React.createElement(SymbolBadge, {
|
|
2083
|
+
symbol
|
|
2084
|
+
}) : null, header) : null, html ? /* @__PURE__ */ React.createElement(Html, {
|
|
2085
|
+
html,
|
|
2086
|
+
htmlParseInstruction
|
|
2087
|
+
}) : null, text ? /* @__PURE__ */ React.createElement(Text, null, text) : null);
|
|
2088
|
+
});
|
|
2089
|
+
var ItemList = forwardRef((_x, ref) => {
|
|
2090
|
+
var _y = _x, {
|
|
2091
|
+
header,
|
|
2092
|
+
customHeader,
|
|
2093
|
+
text,
|
|
2094
|
+
html,
|
|
2095
|
+
className,
|
|
2096
|
+
children,
|
|
2097
|
+
symbol,
|
|
2098
|
+
items,
|
|
2099
|
+
renderItem,
|
|
2100
|
+
renderLi,
|
|
2101
|
+
ulProps
|
|
2102
|
+
} = _y, other = __objRest(_y, [
|
|
2103
|
+
"header",
|
|
2104
|
+
"customHeader",
|
|
2105
|
+
"text",
|
|
2106
|
+
"html",
|
|
2107
|
+
"className",
|
|
2108
|
+
"children",
|
|
2109
|
+
"symbol",
|
|
2110
|
+
"items",
|
|
2111
|
+
"renderItem",
|
|
2112
|
+
"renderLi",
|
|
2113
|
+
"ulProps"
|
|
2114
|
+
]);
|
|
2115
|
+
return /* @__PURE__ */ React.createElement("div", __spreadProps(__spreadValues({
|
|
2116
|
+
className: appendClassNames(className, "humany-item-list"),
|
|
2117
|
+
"data-item-count": items.length
|
|
2118
|
+
}, convertToStringAttributes(other)), {
|
|
2119
|
+
ref
|
|
2120
|
+
}), customHeader ? customHeader : header || text || html ? /* @__PURE__ */ React.createElement(Paragraph, {
|
|
2121
|
+
symbol,
|
|
2122
|
+
header,
|
|
2123
|
+
text,
|
|
2124
|
+
html
|
|
2125
|
+
}) : null, items.length ? /* @__PURE__ */ React.createElement(List, __spreadValues({
|
|
2126
|
+
items,
|
|
2127
|
+
renderItem,
|
|
2128
|
+
renderLi
|
|
2129
|
+
}, ulProps)) : null, children);
|
|
2130
|
+
});
|
|
2131
|
+
const ItemTree = ({
|
|
2132
|
+
className = "",
|
|
2133
|
+
tree,
|
|
2134
|
+
renderItem,
|
|
2135
|
+
rootItem,
|
|
2136
|
+
renderUnselected = true,
|
|
2137
|
+
renderEmpty = true,
|
|
2138
|
+
ulProps,
|
|
2139
|
+
liProps
|
|
2140
|
+
}) => {
|
|
2141
|
+
const hasSelectedChildren = (items) => {
|
|
2142
|
+
return !checkIfSelected(items);
|
|
2143
|
+
};
|
|
2144
|
+
const checkIfSelected = (items) => {
|
|
2145
|
+
if (!items || items.length < 1) {
|
|
2146
|
+
return true;
|
|
2147
|
+
}
|
|
2148
|
+
return !items.some((item) => !!item.selected);
|
|
2149
|
+
};
|
|
2150
|
+
const renderTreeItems = (treeItems, level) => {
|
|
2151
|
+
return /* @__PURE__ */ React.createElement(ItemList, {
|
|
2152
|
+
className: appendClassNames(`humany-item-tree-level-${level}`),
|
|
2153
|
+
items: treeItems,
|
|
2154
|
+
ulProps,
|
|
2155
|
+
renderItem: (itemProps) => {
|
|
2156
|
+
const { id, selected, items, matches } = itemProps;
|
|
2157
|
+
const isSelected = selected && checkIfSelected(items);
|
|
2158
|
+
if (!renderEmpty && !matches) {
|
|
2159
|
+
return null;
|
|
2160
|
+
}
|
|
2161
|
+
return /* @__PURE__ */ React.createElement("li", __spreadProps(__spreadValues({}, convertToStringAttributes(liProps)), {
|
|
2162
|
+
key: id,
|
|
2163
|
+
className: "humany-item-tree-item"
|
|
2164
|
+
}), renderItem && renderItem(itemProps, level, isSelected), items && (renderUnselected || isSelected) && renderTreeItems(items, level + 1));
|
|
2165
|
+
}
|
|
2166
|
+
});
|
|
2167
|
+
};
|
|
2168
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2169
|
+
className: appendClassNames(className, "humany-item-tree")
|
|
2170
|
+
}, rootItem && rootItem(!hasSelectedChildren(tree || [])), tree && renderTreeItems(tree, 1));
|
|
2171
|
+
};
|
|
2172
|
+
const Overlay = (_z) => {
|
|
2173
|
+
var _A = _z, {
|
|
2174
|
+
visible,
|
|
2175
|
+
duration = 500,
|
|
2176
|
+
children,
|
|
2177
|
+
onClick = () => {
|
|
2178
|
+
}
|
|
2179
|
+
} = _A, other = __objRest(_A, [
|
|
2180
|
+
"visible",
|
|
2181
|
+
"duration",
|
|
2182
|
+
"children",
|
|
2183
|
+
"onClick"
|
|
2184
|
+
]);
|
|
2185
|
+
const ref = useRef();
|
|
2186
|
+
const onOverlayClick = useCallback((e) => {
|
|
2187
|
+
if (e.target === ref.current) {
|
|
2188
|
+
onClick(e);
|
|
2189
|
+
}
|
|
2190
|
+
}, [onClick]);
|
|
2191
|
+
return /* @__PURE__ */ React.createElement(CSSTransition, {
|
|
2192
|
+
in: visible,
|
|
2193
|
+
className: "humany-overlay-transition",
|
|
2194
|
+
classNames: "humany-overlay-transition",
|
|
2195
|
+
unmountOnExit: true,
|
|
2196
|
+
timeout: duration
|
|
2197
|
+
}, /* @__PURE__ */ React.createElement(Portal, null, /* @__PURE__ */ React.createElement(Wrapper$2, __spreadValues({
|
|
2198
|
+
className: "humany-overlay",
|
|
2199
|
+
duration,
|
|
2200
|
+
ref,
|
|
2201
|
+
onClick: onOverlayClick
|
|
2202
|
+
}, other), children)));
|
|
2203
|
+
};
|
|
2204
|
+
const Wrapper$2 = styled.div`
|
|
2205
|
+
background: rgba(0, 0, 0, 0.6);
|
|
2206
|
+
min-width: 100%;
|
|
2207
|
+
min-height: 100%;
|
|
2208
|
+
position: fixed;
|
|
2209
|
+
top: 0;
|
|
2210
|
+
bottom: 0;
|
|
2211
|
+
right: 0;
|
|
2212
|
+
left: 0;
|
|
2213
|
+
display: flex;
|
|
2214
|
+
justify-content: center;
|
|
2215
|
+
align-items: center;
|
|
2216
|
+
z-index: 7;
|
|
2217
|
+
|
|
2218
|
+
transition: ${(p) => p.duration}ms;
|
|
2219
|
+
opacity: 0;
|
|
2220
|
+
|
|
2221
|
+
&.humany-overlay-transition-enter {
|
|
2222
|
+
opacity: 0.1;
|
|
2223
|
+
}
|
|
2224
|
+
&.humany-overlay-transition-enter-active,
|
|
2225
|
+
&.humany-overlay-transition-enter-done,
|
|
2226
|
+
&.humany-overlay-transition-exit {
|
|
2227
|
+
opacity: 1;
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2230
|
+
&.humany-overlay-transition-exit-active,
|
|
2231
|
+
&.humany-overlay-transition-exit-done {
|
|
2232
|
+
opacity: 0;
|
|
2233
|
+
}
|
|
2234
|
+
`;
|
|
2235
|
+
const Lightbox = ({ attrs }) => {
|
|
2236
|
+
const [visible, toggleVisible] = useToggle(false);
|
|
2237
|
+
const esc = useKeyPress("Escape");
|
|
2238
|
+
useEffect(() => {
|
|
2239
|
+
if (esc) {
|
|
2240
|
+
toggleVisible(false);
|
|
2241
|
+
}
|
|
2242
|
+
}, [esc]);
|
|
2243
|
+
const overlayClick = useCallback((e) => {
|
|
2244
|
+
toggleVisible(false);
|
|
2245
|
+
}, [toggleVisible]);
|
|
2246
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Overlay, {
|
|
2247
|
+
visible,
|
|
2248
|
+
onClick: overlayClick
|
|
2249
|
+
}, /* @__PURE__ */ React.createElement(CloseButton, {
|
|
2250
|
+
onClick: () => toggleVisible(false)
|
|
2251
|
+
}, /* @__PURE__ */ React.createElement(StyledSymbolBadge, {
|
|
2252
|
+
size: 24,
|
|
2253
|
+
symbol: { type: "Svg", content: "close" }
|
|
2254
|
+
})), /* @__PURE__ */ React.createElement(Content$1, null, /* @__PURE__ */ React.createElement("img", __spreadValues({}, attrs)))), /* @__PURE__ */ React.createElement("a", {
|
|
2255
|
+
onClick: () => toggleVisible()
|
|
2256
|
+
}, /* @__PURE__ */ React.createElement(Thumbnail, __spreadValues({}, attrs))));
|
|
2257
|
+
};
|
|
2258
|
+
const Content$1 = styled.div`
|
|
2259
|
+
padding: ${(p) => {
|
|
2260
|
+
var _a;
|
|
2261
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
2262
|
+
}};
|
|
2263
|
+
max-width: 80%;
|
|
2264
|
+
max-height: 80%;
|
|
2265
|
+
|
|
2266
|
+
img {
|
|
2267
|
+
width: auto !important;
|
|
2268
|
+
height: auto !important;
|
|
2269
|
+
max-width: 100%;
|
|
2270
|
+
max-height: 100%;
|
|
2271
|
+
}
|
|
2272
|
+
`;
|
|
2273
|
+
const CloseButton = styled(Button)`
|
|
2274
|
+
position: fixed;
|
|
2275
|
+
top: 50px;
|
|
2276
|
+
right: 50px;
|
|
2277
|
+
transition: opacity 300ms ease-in-out;
|
|
2278
|
+
opacity: 0.7;
|
|
2279
|
+
|
|
2280
|
+
&:hover {
|
|
2281
|
+
opacity: 1;
|
|
2282
|
+
}
|
|
2283
|
+
`;
|
|
2284
|
+
const StyledSymbolBadge = styled(SymbolBadge)`
|
|
2285
|
+
path {
|
|
2286
|
+
stroke: #ffffff;
|
|
2287
|
+
}
|
|
2288
|
+
`;
|
|
2289
|
+
const Thumbnail = styled.img`
|
|
2290
|
+
cursor: pointer;
|
|
2291
|
+
`;
|
|
2292
|
+
var RouteLink = forwardRef((_B, forwardedRef) => {
|
|
2293
|
+
var _C = _B, { className, onClick = () => {
|
|
2294
|
+
}, name = "", to = "", params = {}, children } = _C, other = __objRest(_C, ["className", "onClick", "name", "to", "params", "children"]);
|
|
2295
|
+
const router = useRouter();
|
|
2296
|
+
const container = useContainer();
|
|
2297
|
+
if (!router) {
|
|
2298
|
+
return null;
|
|
2299
|
+
}
|
|
2300
|
+
let path = "";
|
|
2301
|
+
const props = __spreadProps(__spreadValues({
|
|
2302
|
+
onClick,
|
|
2303
|
+
className: appendClassNames(className, "humany-route-link"),
|
|
2304
|
+
to: path,
|
|
2305
|
+
innerRef: forwardedRef
|
|
2306
|
+
}, other), {
|
|
2307
|
+
ref: null
|
|
2308
|
+
});
|
|
2309
|
+
if (name) {
|
|
2310
|
+
const routes = router.routes || [];
|
|
2311
|
+
const route = routes.find((r) => r.name === name);
|
|
2312
|
+
if (!route) {
|
|
2313
|
+
return /* @__PURE__ */ React.createElement(Link$1, __spreadProps(__spreadValues({}, props), {
|
|
2314
|
+
onClick: (e) => {
|
|
2315
|
+
onClick(e);
|
|
2316
|
+
e.preventDefault();
|
|
2317
|
+
}
|
|
2318
|
+
}), children);
|
|
2319
|
+
}
|
|
2320
|
+
const encodedParams = Object.keys(params).reduce((acc, key) => {
|
|
2321
|
+
acc[key] = typeof params[key] === "string" ? encodeURIComponent(params[key]) : params[key];
|
|
2322
|
+
return acc;
|
|
2323
|
+
}, {});
|
|
2324
|
+
try {
|
|
2325
|
+
path = router.generate(name, encodedParams || {});
|
|
2326
|
+
} catch (e) {
|
|
2327
|
+
return /* @__PURE__ */ React.createElement(Link$1, __spreadValues({}, props), children);
|
|
2328
|
+
}
|
|
2329
|
+
if (path && router.settings.mode && router.settings.mode === HistoryMode.browser && path[0] !== "/") {
|
|
2330
|
+
path = `/${path}`;
|
|
2331
|
+
}
|
|
2332
|
+
} else if (to && router.history) {
|
|
2333
|
+
path = router.history.createHref({
|
|
2334
|
+
hash: "",
|
|
2335
|
+
pathname: to,
|
|
2336
|
+
search: "",
|
|
2337
|
+
state: void 0
|
|
2338
|
+
});
|
|
2339
|
+
} else {
|
|
2340
|
+
return null;
|
|
2341
|
+
}
|
|
2342
|
+
if (router.settings && router.settings.mode === HistoryMode.scopedHash) {
|
|
2343
|
+
const widgetName = container.get("$widget").name;
|
|
2344
|
+
path = getSpecificWidgetPath(path, widgetName);
|
|
2345
|
+
}
|
|
2346
|
+
return /* @__PURE__ */ React.createElement(Link$1, __spreadProps(__spreadValues({}, props), {
|
|
2347
|
+
to: path
|
|
2348
|
+
}), children);
|
|
2349
|
+
});
|
|
2350
|
+
var Link = forwardRef((_D, ref) => {
|
|
2351
|
+
var _E = _D, {
|
|
2352
|
+
className,
|
|
2353
|
+
disabled = false,
|
|
2354
|
+
role = "link",
|
|
2355
|
+
tabIndex = 0,
|
|
2356
|
+
onClick = () => {
|
|
2357
|
+
},
|
|
2358
|
+
onKeyDown = () => {
|
|
2359
|
+
},
|
|
2360
|
+
title,
|
|
2361
|
+
href,
|
|
2362
|
+
children,
|
|
2363
|
+
target,
|
|
2364
|
+
routeName,
|
|
2365
|
+
params
|
|
2366
|
+
} = _E, other = __objRest(_E, [
|
|
2367
|
+
"className",
|
|
2368
|
+
"disabled",
|
|
2369
|
+
"role",
|
|
2370
|
+
"tabIndex",
|
|
2371
|
+
"onClick",
|
|
2372
|
+
"onKeyDown",
|
|
2373
|
+
"title",
|
|
2374
|
+
"href",
|
|
2375
|
+
"children",
|
|
2376
|
+
"target",
|
|
2377
|
+
"routeName",
|
|
2378
|
+
"params"
|
|
2379
|
+
]);
|
|
2380
|
+
const props = {
|
|
2381
|
+
title,
|
|
2382
|
+
disabled,
|
|
2383
|
+
role,
|
|
2384
|
+
tabIndex,
|
|
2385
|
+
className: appendClassNames(className, "humany-link", [!!disabled, "humany-disabled"]),
|
|
2386
|
+
onClick: (e) => {
|
|
2387
|
+
e.persist();
|
|
2388
|
+
if (disabled) {
|
|
2389
|
+
e.preventDefault();
|
|
2390
|
+
return;
|
|
2391
|
+
}
|
|
2392
|
+
onClick(e);
|
|
2393
|
+
},
|
|
2394
|
+
onKeyDown: (e) => {
|
|
2395
|
+
e.persist();
|
|
2396
|
+
if (disabled) {
|
|
2397
|
+
if (e.key !== "Tab") {
|
|
2398
|
+
e.preventDefault();
|
|
2399
|
+
}
|
|
2400
|
+
return;
|
|
2401
|
+
}
|
|
2402
|
+
onKeyDown(e);
|
|
2403
|
+
}
|
|
2404
|
+
};
|
|
2405
|
+
return routeName ? /* @__PURE__ */ React.createElement(StyledRouteLink, __spreadProps(__spreadValues(__spreadValues({
|
|
2406
|
+
name: routeName,
|
|
2407
|
+
params
|
|
2408
|
+
}, props), convertToStringAttributes(other)), {
|
|
2409
|
+
ref
|
|
2410
|
+
}), children) : /* @__PURE__ */ React.createElement(StyledLink, __spreadProps(__spreadValues(__spreadValues({
|
|
2411
|
+
href,
|
|
2412
|
+
target
|
|
2413
|
+
}, props), convertToStringAttributes(other)), {
|
|
2414
|
+
ref
|
|
2415
|
+
}), children);
|
|
2416
|
+
});
|
|
2417
|
+
const StyledRouteLink = styled(RouteLink)`
|
|
2418
|
+
${(p) => p.disabled ? `
|
|
2419
|
+
pointer-events: none;
|
|
2420
|
+
opacity: .7;
|
|
2421
|
+
` : "cursor: pointer;"}
|
|
2422
|
+
`;
|
|
2423
|
+
const StyledLink = styled.a`
|
|
2424
|
+
${(p) => p.disabled ? `
|
|
2425
|
+
pointer-events: none;
|
|
2426
|
+
opacity: .7;
|
|
2427
|
+
` : "cursor: pointer;"}
|
|
2428
|
+
`;
|
|
2429
|
+
const Modal = forwardRef((_F, ref) => {
|
|
2430
|
+
var _G = _F, { className, children, trigger, onOverlayClick = () => {
|
|
2431
|
+
}, close = false } = _G, other = __objRest(_G, ["className", "children", "trigger", "onOverlayClick", "close"]);
|
|
2432
|
+
const [visible, toggleVisible] = useToggle();
|
|
2433
|
+
const [css2, innerRef] = useScroll(true);
|
|
2434
|
+
const closeButtonRef = useRef();
|
|
2435
|
+
const id = useRef(uuid());
|
|
2436
|
+
const esc = useKeyPress("Escape");
|
|
2437
|
+
useEffect(() => {
|
|
2438
|
+
if (esc || close) {
|
|
2439
|
+
toggleVisible(false);
|
|
2440
|
+
}
|
|
2441
|
+
}, [esc, close]);
|
|
2442
|
+
useEffect(() => {
|
|
2443
|
+
if (visible && closeButtonRef.current) {
|
|
2444
|
+
closeButtonRef.current.focus();
|
|
2445
|
+
}
|
|
2446
|
+
}, [visible, closeButtonRef.current]);
|
|
2447
|
+
useWidgetEvent("router:changed", () => {
|
|
2448
|
+
toggleVisible(false);
|
|
2449
|
+
});
|
|
2450
|
+
const overlayClick = useCallback((e) => {
|
|
2451
|
+
toggleVisible(false);
|
|
2452
|
+
onOverlayClick(e);
|
|
2453
|
+
}, [onOverlayClick, toggleVisible]);
|
|
2454
|
+
useImperativeHandle(ref, () => ({
|
|
2455
|
+
close() {
|
|
2456
|
+
toggleVisible(false);
|
|
2457
|
+
}
|
|
2458
|
+
}));
|
|
2459
|
+
const closeMenus = useCallback(() => {
|
|
2460
|
+
return useUniqueMenu(id.current, () => {
|
|
2461
|
+
toggleVisible(false);
|
|
2462
|
+
});
|
|
2463
|
+
}, [id.current]);
|
|
2464
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Overlay, {
|
|
2465
|
+
visible,
|
|
2466
|
+
onClick: overlayClick
|
|
2467
|
+
}, /* @__PURE__ */ React.createElement(Wrapper$1, __spreadProps(__spreadValues({
|
|
2468
|
+
className: appendClassNames(className, "humany-modal", `humany-modal-${id.current}`),
|
|
2469
|
+
css: css2,
|
|
2470
|
+
tabIndex: -1
|
|
2471
|
+
}, other), {
|
|
2472
|
+
ref: innerRef
|
|
2473
|
+
}), /* @__PURE__ */ React.createElement(CloseButton$1, {
|
|
2474
|
+
onClick: () => toggleVisible(false),
|
|
2475
|
+
tabIndex: 0,
|
|
2476
|
+
ref: closeButtonRef
|
|
2477
|
+
}, /* @__PURE__ */ React.createElement(SymbolBadge, {
|
|
2478
|
+
symbol: { type: "Svg", content: "close" }
|
|
2479
|
+
})), children)), React.cloneElement(trigger, {
|
|
2480
|
+
onClick: (event) => {
|
|
2481
|
+
toggleVisible();
|
|
2482
|
+
closeMenus();
|
|
2483
|
+
}
|
|
2484
|
+
}));
|
|
2485
|
+
});
|
|
2486
|
+
const Wrapper$1 = styled.div`
|
|
2487
|
+
font-family: ${(p) => {
|
|
2488
|
+
var _a;
|
|
2489
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.type;
|
|
2490
|
+
}};
|
|
2491
|
+
font-size: ${(p) => {
|
|
2492
|
+
var _a;
|
|
2493
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
|
|
2494
|
+
}};
|
|
2495
|
+
position: relative;
|
|
2496
|
+
max-width: 50%;
|
|
2497
|
+
min-width: 200px;
|
|
2498
|
+
padding: ${(p) => {
|
|
2499
|
+
var _a;
|
|
2500
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
|
|
2501
|
+
}};
|
|
2502
|
+
${contentBox}
|
|
2503
|
+
${(p) => p.css && p.css}
|
|
2504
|
+
outline: none;
|
|
2505
|
+
`;
|
|
2506
|
+
const Confirm = ({
|
|
2507
|
+
className,
|
|
2508
|
+
trigger,
|
|
2509
|
+
header = "",
|
|
2510
|
+
text = "",
|
|
2511
|
+
onCancel = () => {
|
|
2512
|
+
},
|
|
2513
|
+
onConfirm = () => {
|
|
2514
|
+
},
|
|
2515
|
+
cancelLabel = "",
|
|
2516
|
+
confirmLabel = ""
|
|
2517
|
+
}) => {
|
|
2518
|
+
const ref = useRef();
|
|
2519
|
+
const cancel = useCallback(() => {
|
|
2520
|
+
var _a;
|
|
2521
|
+
onCancel();
|
|
2522
|
+
(_a = ref == null ? void 0 : ref.current) == null ? void 0 : _a.close();
|
|
2523
|
+
}, [onCancel]);
|
|
2524
|
+
const confirm = useCallback(() => {
|
|
2525
|
+
var _a;
|
|
2526
|
+
onConfirm();
|
|
2527
|
+
(_a = ref == null ? void 0 : ref.current) == null ? void 0 : _a.close();
|
|
2528
|
+
}, [onConfirm]);
|
|
2529
|
+
return /* @__PURE__ */ React.createElement(StyledModal, {
|
|
2530
|
+
className,
|
|
2531
|
+
trigger,
|
|
2532
|
+
ref,
|
|
2533
|
+
onOverlayClick: cancel
|
|
2534
|
+
}, header && /* @__PURE__ */ React.createElement(StyledText, null, header), text && /* @__PURE__ */ React.createElement(StyledText, null, text), confirmLabel && /* @__PURE__ */ React.createElement(StyledConfirmButton, {
|
|
2535
|
+
onClick: confirm
|
|
2536
|
+
}, confirmLabel), cancelLabel && /* @__PURE__ */ React.createElement(StyledCancelButton, {
|
|
2537
|
+
onClick: cancel
|
|
2538
|
+
}, cancelLabel));
|
|
2539
|
+
};
|
|
2540
|
+
const StyledModal = styled(Modal)`
|
|
2541
|
+
display: block;
|
|
2542
|
+
|
|
2543
|
+
span {
|
|
2544
|
+
display: block;
|
|
2545
|
+
margin: 0 0 ${(p) => {
|
|
2546
|
+
var _a;
|
|
2547
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
2548
|
+
}};
|
|
2549
|
+
|
|
2550
|
+
&:first-of-type:not(:only-of-type) {
|
|
2551
|
+
font-weight: 700;
|
|
2552
|
+
margin: 0 0 ${(p) => {
|
|
2553
|
+
var _a;
|
|
2554
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.small;
|
|
2555
|
+
}};
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
`;
|
|
2559
|
+
const StyledConfirmButton = styled(Button)`
|
|
2560
|
+
display: inline-block;
|
|
2561
|
+
min-width: 50px;
|
|
2562
|
+
${(p) => {
|
|
2563
|
+
var _a, _b;
|
|
2564
|
+
return `padding: ${(_a = p.theme.sizes) == null ? void 0 : _a.small} ${(_b = p.theme.sizes) == null ? void 0 : _b.normal};`;
|
|
2565
|
+
}}
|
|
2566
|
+
${(p) => p.theme.borderRadius && `border-radius: ${p.theme.borderRadius};`}
|
|
2567
|
+
color: #FFFFFF;
|
|
2568
|
+
background-color: ${(p) => {
|
|
2569
|
+
var _a;
|
|
2570
|
+
return (_a = p.theme.colors) == null ? void 0 : _a.primary;
|
|
2571
|
+
}};
|
|
2572
|
+
border: 1px solid ${(p) => {
|
|
2573
|
+
var _a;
|
|
2574
|
+
return (_a = p.theme.colors) == null ? void 0 : _a.primary;
|
|
2575
|
+
}};
|
|
2576
|
+
|
|
2577
|
+
margin: 0 ${(p) => {
|
|
2578
|
+
var _a;
|
|
2579
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.small;
|
|
2580
|
+
}} 0 0;
|
|
2581
|
+
|
|
2582
|
+
&:focus {
|
|
2583
|
+
${(p) => {
|
|
2584
|
+
var _a;
|
|
2585
|
+
return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && borderTabStyle;
|
|
2586
|
+
}};
|
|
2587
|
+
background-color: transparent;
|
|
2588
|
+
}
|
|
2589
|
+
`;
|
|
2590
|
+
const StyledCancelButton = styled(Button)`
|
|
2591
|
+
display: inline-block;
|
|
2592
|
+
min-width: 50px;
|
|
2593
|
+
${(p) => {
|
|
2594
|
+
var _a, _b;
|
|
2595
|
+
return `padding: ${(_a = p.theme.sizes) == null ? void 0 : _a.small} ${(_b = p.theme.sizes) == null ? void 0 : _b.normal};`;
|
|
2596
|
+
}}
|
|
2597
|
+
${(p) => p.theme.borderRadius && `border-radius: ${p.theme.borderRadius};`}
|
|
2598
|
+
background-color: transparent;
|
|
2599
|
+
color: ${(p) => {
|
|
2600
|
+
var _a;
|
|
2601
|
+
return (_a = p.theme.colors) == null ? void 0 : _a.text;
|
|
2602
|
+
}};
|
|
2603
|
+
border: 1px solid ${(p) => {
|
|
2604
|
+
var _a;
|
|
2605
|
+
return (_a = p.theme.colors) == null ? void 0 : _a.text;
|
|
2606
|
+
}};
|
|
2607
|
+
|
|
2608
|
+
&:focus {
|
|
2609
|
+
${(p) => {
|
|
2610
|
+
var _a;
|
|
2611
|
+
return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && borderTabStyle;
|
|
2612
|
+
}};
|
|
2613
|
+
}
|
|
2614
|
+
`;
|
|
2615
|
+
const NotFound = ({
|
|
2616
|
+
header = "",
|
|
2617
|
+
link = "",
|
|
2618
|
+
suggestionHeader = "",
|
|
2619
|
+
suggestion = ""
|
|
2620
|
+
}) => {
|
|
2621
|
+
return /* @__PURE__ */ React.createElement(Wrapper, null, /* @__PURE__ */ React.createElement(Status, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
2622
|
+
variant: "h2"
|
|
2623
|
+
}, "404")), /* @__PURE__ */ React.createElement(Header, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
2624
|
+
variant: "h3"
|
|
2625
|
+
}, header), /* @__PURE__ */ React.createElement(TextLink, {
|
|
2626
|
+
routeName: "index",
|
|
2627
|
+
"aria-label": link,
|
|
2628
|
+
text: link
|
|
2629
|
+
})), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement("span", null, suggestionHeader), /* @__PURE__ */ React.createElement("ul", null, /* @__PURE__ */ React.createElement("li", null, suggestion))));
|
|
2630
|
+
};
|
|
2631
|
+
const Wrapper = styled.div`
|
|
2632
|
+
display: flex;
|
|
2633
|
+
flex-wrap: wrap;
|
|
2634
|
+
`;
|
|
2635
|
+
const Status = styled.div`
|
|
2636
|
+
${headingElement("h2", css`
|
|
2637
|
+
padding: 0;
|
|
2638
|
+
margin: 0;
|
|
2639
|
+
color: gray;
|
|
2640
|
+
font-size: 7em;
|
|
2641
|
+
`)}
|
|
2642
|
+
`;
|
|
2643
|
+
const Header = styled.div`
|
|
2644
|
+
margin-left: ${(p) => {
|
|
2645
|
+
var _a;
|
|
2646
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
|
|
2647
|
+
}};
|
|
2648
|
+
|
|
2649
|
+
${headingElement("h3", css`
|
|
2650
|
+
text-transform: uppercase;
|
|
2651
|
+
font-size: ${(p) => {
|
|
2652
|
+
var _a;
|
|
2653
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
|
|
2654
|
+
}};
|
|
2655
|
+
`)}
|
|
2656
|
+
|
|
2657
|
+
a {
|
|
2658
|
+
color: ${(p) => {
|
|
2659
|
+
var _a;
|
|
2660
|
+
return (_a = p.theme.colors) == null ? void 0 : _a.link;
|
|
2661
|
+
}};
|
|
2662
|
+
font-size: ${(p) => {
|
|
2663
|
+
var _a;
|
|
2664
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.small;
|
|
2665
|
+
}};
|
|
2666
|
+
}
|
|
2667
|
+
`;
|
|
2668
|
+
const Content = styled.div`
|
|
2669
|
+
margin-top: ${(p) => {
|
|
2670
|
+
var _a;
|
|
2671
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
|
|
2672
|
+
}};
|
|
2673
|
+
min-width: 100%;
|
|
2674
|
+
|
|
2675
|
+
span {
|
|
2676
|
+
font-weight: bold;
|
|
2677
|
+
}
|
|
2678
|
+
`;
|
|
2679
|
+
class TabStop extends Component {
|
|
2680
|
+
constructor() {
|
|
2681
|
+
super(...arguments);
|
|
2682
|
+
this.state = {
|
|
2683
|
+
boundFocus: false
|
|
2684
|
+
};
|
|
2685
|
+
}
|
|
2686
|
+
componentWillMount() {
|
|
2687
|
+
const settings = this.props.container.get("accessibilitySettings");
|
|
2688
|
+
if (settings && settings.boundFocus) {
|
|
2689
|
+
this.setState({
|
|
2690
|
+
boundFocus: true
|
|
2691
|
+
});
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
componentDidMount() {
|
|
2695
|
+
if (!this.state.boundFocus) {
|
|
2696
|
+
return;
|
|
2697
|
+
}
|
|
2698
|
+
const widgetDOMElement = this.props.container.get("widgetDOMElement");
|
|
2699
|
+
if (this.node && widgetDOMElement) {
|
|
2700
|
+
this.onFocusListener = this.node.addEventListener("focus", () => {
|
|
2701
|
+
const focusable = widgetDOMElement.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
2702
|
+
const filtered = [].filter.call(focusable, (el) => {
|
|
2703
|
+
if (typeof window === "undefined") {
|
|
2704
|
+
return true;
|
|
2705
|
+
}
|
|
2706
|
+
const style = window.getComputedStyle(el);
|
|
2707
|
+
if (style.display === "none" || el.offsetWidth <= 0 && el.offsetHeight <= 0) {
|
|
2708
|
+
return false;
|
|
2709
|
+
}
|
|
2710
|
+
return true;
|
|
2711
|
+
});
|
|
2712
|
+
const firstFocusable = filtered[0];
|
|
2713
|
+
if (firstFocusable) {
|
|
2714
|
+
firstFocusable.focus();
|
|
2715
|
+
}
|
|
2716
|
+
});
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
componentWillUnmount() {
|
|
2720
|
+
if (this.node) {
|
|
2721
|
+
this.node.removeEventListener("focus", this.onFocusListener);
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
render() {
|
|
2725
|
+
if (!this.state.boundFocus) {
|
|
2726
|
+
return null;
|
|
2727
|
+
}
|
|
2728
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2729
|
+
style: { opacity: 0 },
|
|
2730
|
+
tabIndex: 0,
|
|
2731
|
+
ref: (node) => {
|
|
2732
|
+
this.node = node;
|
|
2733
|
+
}
|
|
2734
|
+
});
|
|
2735
|
+
}
|
|
2736
|
+
}
|
|
2737
|
+
var TextLink = forwardRef((_H, ref) => {
|
|
2738
|
+
var _I = _H, { className, description, text, children } = _I, other = __objRest(_I, ["className", "description", "text", "children"]);
|
|
2739
|
+
return /* @__PURE__ */ React.createElement(Link, __spreadProps(__spreadValues({
|
|
2740
|
+
className: appendClassNames(className, "humany-text-link")
|
|
2741
|
+
}, other), {
|
|
2742
|
+
ref
|
|
2743
|
+
}), children, /* @__PURE__ */ React.createElement(Text, null, text), description ? /* @__PURE__ */ React.createElement(Html, {
|
|
2744
|
+
html: description,
|
|
2745
|
+
className: "humany-description"
|
|
2746
|
+
}) : null);
|
|
2747
|
+
});
|
|
2748
|
+
var DateFormats = /* @__PURE__ */ ((DateFormats2) => {
|
|
2749
|
+
DateFormats2["HH_MM"] = "hh:mm";
|
|
2750
|
+
DateFormats2["YYYY_MM_DD"] = "yyyy-mm-dd";
|
|
2751
|
+
DateFormats2["YYYY_MM_DD_HH_MM"] = "yyyy-mm-dd hh:mm";
|
|
2752
|
+
return DateFormats2;
|
|
2753
|
+
})(DateFormats || {});
|
|
2754
|
+
const Timestamp = ({ className = "", format = "hh:mm", timestamp }) => {
|
|
2755
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
2756
|
+
className: appendClassNames(className, "humany-timestamp")
|
|
2757
|
+
}, formatDate(timestamp, format));
|
|
2758
|
+
};
|
|
2759
|
+
const asTwoDigitString = (input2) => {
|
|
2760
|
+
return `0${input2}`.slice(-2);
|
|
2761
|
+
};
|
|
2762
|
+
function formatDate(unformattedDate, format) {
|
|
2763
|
+
const date = new Date(unformattedDate);
|
|
2764
|
+
const dateArray = date.toTimeString().split(" ")[0].split(":");
|
|
2765
|
+
const timeString = dateArray.length > 1 ? `${dateArray[0]}:${dateArray[1]}` : dateArray[0];
|
|
2766
|
+
const year = date.getFullYear();
|
|
2767
|
+
const month = date.getMonth() + 1;
|
|
2768
|
+
const day = date.getDate();
|
|
2769
|
+
const dateString = `${year}-${asTwoDigitString(month)}-${asTwoDigitString(day)}`;
|
|
2770
|
+
if (format === "yyyy-mm-dd") {
|
|
2771
|
+
return dateString;
|
|
2772
|
+
}
|
|
2773
|
+
if (format === "hh:mm") {
|
|
2774
|
+
return timeString;
|
|
2775
|
+
}
|
|
2776
|
+
return `${dateString} ${timeString}`;
|
|
2777
|
+
}
|
|
2778
|
+
const Tooltip = (_J) => {
|
|
2779
|
+
var _K = _J, { className, children, content, sticky = false } = _K, other = __objRest(_K, ["className", "children", "content", "sticky"]);
|
|
2780
|
+
const [open, setOpen] = useState(false);
|
|
2781
|
+
const id = useRef(uuid());
|
|
2782
|
+
const ref = useRef();
|
|
2783
|
+
const [{ x, y }, set] = usePosition(open, id.current, ref.current);
|
|
2784
|
+
const clickHandler = (event) => {
|
|
2785
|
+
const { target } = event;
|
|
2786
|
+
if (!ref.current || !target) {
|
|
2787
|
+
return;
|
|
2788
|
+
}
|
|
2789
|
+
if (ref.current !== target && !ref.current.contains(target)) {
|
|
2790
|
+
setOpen(false);
|
|
2791
|
+
}
|
|
2792
|
+
};
|
|
2793
|
+
useEffect(() => {
|
|
2794
|
+
if (!sticky) {
|
|
2795
|
+
return;
|
|
2796
|
+
}
|
|
2797
|
+
window.addEventListener("click", clickHandler);
|
|
2798
|
+
return () => {
|
|
2799
|
+
window.removeEventListener("click", clickHandler);
|
|
2800
|
+
};
|
|
2801
|
+
}, [open, sticky]);
|
|
2802
|
+
const handleMouseEvent = useCallback((e, value) => {
|
|
2803
|
+
set(e, ref.current);
|
|
2804
|
+
setOpen(value);
|
|
2805
|
+
}, [set, setOpen]);
|
|
2806
|
+
return /* @__PURE__ */ React.createElement(Trigger, {
|
|
2807
|
+
ref,
|
|
2808
|
+
className: "humany-tooltip-trigger",
|
|
2809
|
+
onMouseEnter: !sticky ? (e) => handleMouseEvent(e, true) : void 0,
|
|
2810
|
+
onMouseLeave: !sticky ? (e) => handleMouseEvent(e, false) : void 0,
|
|
2811
|
+
onTouchEnd: sticky ? (e) => handleMouseEvent(e, !open) : void 0,
|
|
2812
|
+
onClick: sticky ? (e) => handleMouseEvent(e, !open) : void 0
|
|
2813
|
+
}, children, open && /* @__PURE__ */ React.createElement(Portal, null, /* @__PURE__ */ React.createElement(TooltipContainer, __spreadValues({
|
|
2814
|
+
className: appendClassNames(className, "humany-tooltip-container"),
|
|
2815
|
+
x,
|
|
2816
|
+
y
|
|
2817
|
+
}, other), content)));
|
|
2818
|
+
};
|
|
2819
|
+
const Trigger = styled.div`
|
|
2820
|
+
display: flex;
|
|
2821
|
+
align-items: center;
|
|
2822
|
+
`;
|
|
2823
|
+
const TooltipContainer = styled.div`
|
|
2824
|
+
color: #ffffff;
|
|
2825
|
+
background: #161616;
|
|
2826
|
+
border-radius: ${(p) => p.theme.borderRadius};
|
|
2827
|
+
padding: calc(${(p) => {
|
|
2828
|
+
var _a;
|
|
2829
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.small;
|
|
2830
|
+
}} * 2);
|
|
2831
|
+
font-size: ${(p) => {
|
|
2832
|
+
var _a;
|
|
2833
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
|
|
2834
|
+
}};
|
|
2835
|
+
font-family: ${(p) => {
|
|
2836
|
+
var _a;
|
|
2837
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.type;
|
|
2838
|
+
}};
|
|
2839
|
+
position: absolute;
|
|
2840
|
+
z-index: 10;
|
|
2841
|
+
|
|
2842
|
+
a {
|
|
2843
|
+
color: ${(p) => p.color ? p.color : "inherit"};
|
|
2844
|
+
text-decoration: none;
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2847
|
+
i,
|
|
2848
|
+
svg {
|
|
2849
|
+
margin-right: ${(p) => p.theme.sizes.small};
|
|
2850
|
+
}
|
|
2851
|
+
|
|
2852
|
+
${(p) => {
|
|
2853
|
+
let css2 = "";
|
|
2854
|
+
if (p.y > 0) {
|
|
2855
|
+
css2 += `top: calc(2px + ${p.y || "0"}px);`;
|
|
2856
|
+
} else {
|
|
2857
|
+
css2 += `bottom: 2px;`;
|
|
2858
|
+
}
|
|
2859
|
+
if (p.x > 0) {
|
|
2860
|
+
css2 += `right: calc(2px + ${p.x || "0"}px);`;
|
|
2861
|
+
} else {
|
|
2862
|
+
css2 += `left: 2px;`;
|
|
2863
|
+
}
|
|
2864
|
+
return css2;
|
|
2865
|
+
}};
|
|
2866
|
+
`;
|
|
2867
|
+
const TransitionComponent = (props) => {
|
|
2868
|
+
const {
|
|
2869
|
+
in: inState,
|
|
2870
|
+
mountOnEnter = true,
|
|
2871
|
+
unmountOnExit = true,
|
|
2872
|
+
timeout,
|
|
2873
|
+
children,
|
|
2874
|
+
transitions
|
|
2875
|
+
} = props;
|
|
2876
|
+
const generateTransitionDefinition = () => {
|
|
2877
|
+
var _a, _b;
|
|
2878
|
+
if (!transitions || transitions === "none") {
|
|
2879
|
+
return;
|
|
2880
|
+
}
|
|
2881
|
+
if (typeof transitions === "string") {
|
|
2882
|
+
return {
|
|
2883
|
+
enter: {
|
|
2884
|
+
transitionKeys: transitions,
|
|
2885
|
+
duration: !!timeout ? typeof timeout === "number" ? timeout : timeout.enter : 200,
|
|
2886
|
+
easing: "ease-in"
|
|
2887
|
+
},
|
|
2888
|
+
exit: {
|
|
2889
|
+
transitionKeys: transitions,
|
|
2890
|
+
duration: !!timeout ? typeof timeout === "number" ? timeout : timeout.exit : 200,
|
|
2891
|
+
easing: "ease-out"
|
|
2892
|
+
}
|
|
2893
|
+
};
|
|
2894
|
+
}
|
|
2895
|
+
if (typeof transitions === "object") {
|
|
2896
|
+
const { enter, exit } = transitions;
|
|
2897
|
+
return {
|
|
2898
|
+
enter: {
|
|
2899
|
+
transitionKeys: (_a = transitions.enter) == null ? void 0 : _a.type,
|
|
2900
|
+
duration: !!timeout ? typeof timeout === "number" ? timeout : timeout.enter : 200,
|
|
2901
|
+
easing: !!enter.easing ? enter.easing : "ease-in"
|
|
2902
|
+
},
|
|
2903
|
+
exit: {
|
|
2904
|
+
transitionKeys: (_b = transitions.enter) == null ? void 0 : _b.type,
|
|
2905
|
+
duration: !!timeout ? typeof timeout === "number" ? timeout : timeout.enter : 200,
|
|
2906
|
+
easing: !!exit.easing ? exit.easing : "ease-out"
|
|
2907
|
+
}
|
|
2908
|
+
};
|
|
2909
|
+
}
|
|
2910
|
+
};
|
|
2911
|
+
const def = generateTransitionDefinition();
|
|
2912
|
+
return /* @__PURE__ */ React.createElement(Transition, {
|
|
2913
|
+
timeout: {
|
|
2914
|
+
enter: def && def.enter.duration || 0,
|
|
2915
|
+
exit: def && def.exit.duration || 0
|
|
2916
|
+
},
|
|
2917
|
+
in: inState,
|
|
2918
|
+
appear: true,
|
|
2919
|
+
mountOnEnter,
|
|
2920
|
+
unmountOnExit,
|
|
2921
|
+
onEnter: (node) => node.clientHeight
|
|
2922
|
+
}, (state) => children && children(state, def && transitionComposer.compose(state, def)));
|
|
2923
|
+
};
|
|
2924
|
+
var WidgetLink = forwardRef((_L, ref) => {
|
|
2925
|
+
var _M = _L, { className, children, onClick = () => {
|
|
2926
|
+
}, widgetName, activationOptions } = _M, other = __objRest(_M, ["className", "children", "onClick", "widgetName", "activationOptions"]);
|
|
2927
|
+
const container = useContainer();
|
|
2928
|
+
const getWidget = () => {
|
|
2929
|
+
const { implementation } = container.get("$widget");
|
|
2930
|
+
return implementation.widgets.get(widgetName);
|
|
2931
|
+
};
|
|
2932
|
+
useEffect(() => {
|
|
2933
|
+
const widget = getWidget();
|
|
2934
|
+
widget == null ? void 0 : widget.activate(activationOptions).then(() => widget.invoke("attach"));
|
|
2935
|
+
return () => {
|
|
2936
|
+
widget == null ? void 0 : widget.deactivate();
|
|
2937
|
+
};
|
|
2938
|
+
}, [widgetName]);
|
|
2939
|
+
const openWidget = (e) => {
|
|
2940
|
+
const widget = getWidget();
|
|
2941
|
+
const target = e.currentTarget;
|
|
2942
|
+
if (widget) {
|
|
2943
|
+
const toggle = () => {
|
|
2944
|
+
widget.invoke("renderState").then((renderState) => renderState === WidgetRenderState.open ? widget.invoke("close") : widget.invoke("open")).then(() => {
|
|
2945
|
+
widget.events.subscribeOnce("widget:area-rendered", (event, data) => {
|
|
2946
|
+
const widgetDOMElement = container.get("widgetDOMElement");
|
|
2947
|
+
if (widgetDOMElement) {
|
|
2948
|
+
widget.events.dispatch("widget:modal-opened", {
|
|
2949
|
+
name: widget.name,
|
|
2950
|
+
ref: target
|
|
2951
|
+
});
|
|
2952
|
+
}
|
|
2953
|
+
});
|
|
2954
|
+
});
|
|
2955
|
+
};
|
|
2956
|
+
if (widget.state === WidgetState.Deactivated) {
|
|
2957
|
+
widget.activate(activationOptions).then(() => widget.invoke("attach")).then(toggle);
|
|
2958
|
+
} else {
|
|
2959
|
+
toggle();
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
};
|
|
2963
|
+
const onEnter = (e) => {
|
|
2964
|
+
if (e.key === "Enter") {
|
|
2965
|
+
e.preventDefault();
|
|
2966
|
+
openWidget(e);
|
|
2967
|
+
}
|
|
2968
|
+
};
|
|
2969
|
+
return /* @__PURE__ */ React.createElement(Link, __spreadProps(__spreadValues({
|
|
2970
|
+
className: appendClassNames(className, "humany-widget-link"),
|
|
2971
|
+
onKeyDown: onEnter,
|
|
2972
|
+
onClick: (e) => {
|
|
2973
|
+
onClick(e);
|
|
2974
|
+
openWidget(e);
|
|
2975
|
+
}
|
|
2976
|
+
}, other), {
|
|
2977
|
+
ref
|
|
2978
|
+
}), children);
|
|
2979
|
+
});
|
|
2980
|
+
const createReactComponent = (container, type, reactComponent, fn, options) => {
|
|
2981
|
+
return container.getAsync("componentResolver").then((componentResolver) => {
|
|
2982
|
+
componentResolver.registerComponent(type, lazy(() => reactComponent));
|
|
2983
|
+
return extendComponent(container, type, fn || (() => {
|
|
2984
|
+
}), type, options);
|
|
2985
|
+
});
|
|
2986
|
+
};
|
|
2987
|
+
export { AnchorLink, Button, Checkbox, ColumnContext, ComponentNodeContext, ComponentPropertyContext, Confirm, ContainerContext, DateFormats, Drawer, AnimationType as DrawerAnimationType, Dropdown, Empty, grid as Grid, Html, Icon, input as Input, ItemList, ItemTree, Lightbox, Link, List, Modal, NotFound, Overlay, Paragraph, Portal, RouteLink, RoutingContext, StyledText, SymbolBadge, TabStop, Text, TextLink, Timestamp, Tooltip, TransitionComponent, Typography, WidgetLink, borderTabStyle, browser, buttonCss, contentBox, convertToStringAttributes, createEmptyComponent, createReactComponent, defaultRenderInstructions, embeddedLinkMapper, filterCssProps, filterCssPropsStyle, genericHashLink, headingElement, invertedHoverButton, itemList, linkTabStyle, list, paddedBorderTabStyle, parseHtmlString as processHtmlString, transitionComposer, useAction, useChildren, useColumns, useComponent, useComponentDescriptor, useComponentNode, useComponentPlatform, useContainer, useContext, useDispatch, useEventListener, useEvents, useIsMounted, useKeyPress, useLayout, usePrevious, useProperties, useRenderState, useRouteData, useRouter, useScroll, useSettings, useToggle, useTransitionEnd, useUniqueMenu, useWidgetEvent };
|
|
2988
|
+
//# sourceMappingURL=index.js.map
|