@telia-ace/widget-ui 1.0.15 → 1.0.16
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.
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type Props = {
|
|
3
|
+
loading: boolean | undefined;
|
|
4
|
+
};
|
|
5
|
+
export declare const Wrapper: import("styled-components").StyledComponent<"div", any, {
|
|
6
|
+
'data-loading': boolean;
|
|
7
|
+
}, never>;
|
|
8
|
+
declare const Loader: React.SFC<Props>;
|
|
9
|
+
export default Loader;
|
package/dist/index.js
CHANGED
|
@@ -29,9 +29,9 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
-
import styled, { css } from "styled-components";
|
|
32
|
+
import styled, { css, keyframes } from "styled-components";
|
|
33
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,
|
|
34
|
+
import React, { forwardRef, createContext, useContext as useContext$1, useState, useEffect, useRef, useCallback, useImperativeHandle, useMemo, Component, lazy } from "react";
|
|
35
35
|
import { CSSTransition, Transition } from "react-transition-group";
|
|
36
36
|
import { Container, WidgetState } from "@webprovisions/platform";
|
|
37
37
|
import { ComponentPlatform, asDescriptor, createEventSubscriber, ComponentQuery, WidgetRenderState, extendComponent } from "@telia-ace/widget-core";
|
|
@@ -343,14 +343,14 @@ const AnchorLink = (props) => {
|
|
|
343
343
|
};
|
|
344
344
|
var Button = forwardRef((_a, ref) => {
|
|
345
345
|
var _b = _a, { className, children } = _b, other = __objRest(_b, ["className", "children"]);
|
|
346
|
-
return /* @__PURE__ */ React.createElement(StyledButton, __spreadProps(__spreadValues({
|
|
346
|
+
return /* @__PURE__ */ React.createElement(StyledButton$2, __spreadProps(__spreadValues({
|
|
347
347
|
type: "button",
|
|
348
348
|
className: appendClassNames(className, "humany-button")
|
|
349
349
|
}, convertToStringAttributes(other)), {
|
|
350
350
|
ref
|
|
351
351
|
}), children);
|
|
352
352
|
});
|
|
353
|
-
const StyledButton = styled.button`
|
|
353
|
+
const StyledButton$2 = styled.button`
|
|
354
354
|
-webkit-appearance: button;
|
|
355
355
|
text-transform: none;
|
|
356
356
|
overflow: visible;
|
|
@@ -1652,6 +1652,62 @@ const SymbolBadge = (_g) => {
|
|
|
1652
1652
|
fill: "black"
|
|
1653
1653
|
}));
|
|
1654
1654
|
}
|
|
1655
|
+
case "zoom-in": {
|
|
1656
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1657
|
+
viewBox: "0 0 24 24"
|
|
1658
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1659
|
+
fillRule: "evenodd",
|
|
1660
|
+
clipRule: "evenodd",
|
|
1661
|
+
d: "M21.9774 20.8287L17.9149 16.7662C17.8437 16.6957 17.76 16.639 17.668 16.5992C20.7612 12.9331 20.415 7.48045 16.883 4.23507C13.3509 0.989694 7.88848 1.10517 4.49673 4.49691C1.10499 7.88866 0.98951 13.3511 4.23489 16.8831C7.48027 20.4152 12.9329 20.7614 16.599 17.6682C16.6388 17.7601 16.6955 17.8439 16.766 17.9151L20.8285 21.9776C21.1457 22.2948 21.6601 22.2948 21.9774 21.9776C22.2947 21.6603 22.2947 21.1459 21.9774 20.8287ZM10.8404 18.1531C6.80186 18.1531 3.52794 14.8792 3.52794 10.8406C3.52794 6.80204 6.80186 3.52813 10.8404 3.52813C14.879 3.52813 18.1529 6.80204 18.1529 10.8406C18.1483 14.8773 14.8771 18.1484 10.8404 18.1531Z",
|
|
1662
|
+
fill: "white"
|
|
1663
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1664
|
+
fillRule: "evenodd",
|
|
1665
|
+
clipRule: "evenodd",
|
|
1666
|
+
d: "M10.8749 6.75003C11.2892 6.75003 11.6249 7.08581 11.6249 7.50003V14.25C11.6249 14.6642 11.2892 15 10.8749 15C10.4607 15 10.1249 14.6642 10.1249 14.25V7.50003C10.1249 7.08581 10.4607 6.75003 10.8749 6.75003Z",
|
|
1667
|
+
fill: "white"
|
|
1668
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1669
|
+
fillRule: "evenodd",
|
|
1670
|
+
clipRule: "evenodd",
|
|
1671
|
+
d: "M6.74994 10.875C6.74994 10.4608 7.08573 10.125 7.49994 10.125H14.2499C14.6642 10.125 14.9999 10.4608 14.9999 10.875C14.9999 11.2892 14.6642 11.625 14.2499 11.625H7.49994C7.08573 11.625 6.74994 11.2892 6.74994 10.875Z",
|
|
1672
|
+
fill: "white"
|
|
1673
|
+
}));
|
|
1674
|
+
}
|
|
1675
|
+
case "zoom-out": {
|
|
1676
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1677
|
+
viewBox: "0 0 24 24"
|
|
1678
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1679
|
+
fillRule: "evenodd",
|
|
1680
|
+
clipRule: "evenodd",
|
|
1681
|
+
d: "M22.1025 20.9536L18.04 16.8911C17.9688 16.8206 17.8851 16.764 17.7931 16.7241C20.8864 13.0581 20.5401 7.60539 17.0081 4.36001C13.476 1.11463 8.0136 1.23011 4.62185 4.62185C1.23011 8.0136 1.11463 13.476 4.36001 17.0081C7.60539 20.5401 13.0581 20.8864 16.7241 17.7931C16.764 17.8851 16.8206 17.9688 16.8911 18.04L20.9536 22.1025C21.2709 22.4198 21.7853 22.4198 22.1025 22.1025C22.4198 21.7853 22.4198 21.2709 22.1025 20.9536ZM10.9656 18.2781C6.92698 18.2781 3.65306 15.0041 3.65306 10.9656C3.65306 6.92698 6.92698 3.65306 10.9656 3.65306C15.0041 3.65306 18.2781 6.92698 18.2781 10.9656C18.2734 15.0022 15.0022 18.2734 10.9656 18.2781Z",
|
|
1682
|
+
fill: "white"
|
|
1683
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1684
|
+
fillRule: "evenodd",
|
|
1685
|
+
clipRule: "evenodd",
|
|
1686
|
+
d: "M6.87506 11C6.87506 10.5858 7.21085 10.25 7.62506 10.25H14.3751C14.7893 10.25 15.1251 10.5858 15.1251 11C15.1251 11.4142 14.7893 11.75 14.3751 11.75H7.62506C7.21085 11.75 6.87506 11.4142 6.87506 11Z",
|
|
1687
|
+
fill: "white"
|
|
1688
|
+
}));
|
|
1689
|
+
}
|
|
1690
|
+
case "download": {
|
|
1691
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1692
|
+
viewBox: "0 0 24 24"
|
|
1693
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1694
|
+
fillRule: "evenodd",
|
|
1695
|
+
clipRule: "evenodd",
|
|
1696
|
+
d: "M22.5 11.1346V18.4038C22.498 20.1873 21.0527 21.6326 19.2692 21.6346H4.73077C2.94731 21.6326 1.50204 20.1873 1.5 18.4038V11.1346C1.5 10.6885 1.86162 10.3269 2.30769 10.3269C2.75377 10.3269 3.11538 10.6885 3.11538 11.1346V18.4038C3.1164 19.2956 3.83904 20.0182 4.73077 20.0192H19.2692C20.161 20.0182 20.8836 19.2956 20.8846 18.4038V11.1346C20.8846 10.6885 21.2462 10.3269 21.6923 10.3269C22.1384 10.3269 22.5 10.6885 22.5 11.1346ZM11.1434 16.2663C11.6167 16.7388 12.3832 16.7388 12.8565 16.2663L17.4172 11.7057C17.7326 11.3903 17.7326 10.8789 17.4172 10.5635C17.1018 10.2481 16.5904 10.2481 16.275 10.5635L12.8076 14.0308V3.05769C12.8076 2.61162 12.446 2.25 11.9999 2.25C11.5539 2.25 11.1923 2.61162 11.1923 3.05769V14.0308L7.72485 10.5636C7.40946 10.2482 6.89812 10.2482 6.58273 10.5636C6.26734 10.8789 6.26734 11.3903 6.58273 11.7057L11.1434 16.2663Z",
|
|
1697
|
+
fill: "white"
|
|
1698
|
+
}));
|
|
1699
|
+
}
|
|
1700
|
+
case "lightbox-close": {
|
|
1701
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1702
|
+
viewBox: "0 0 24 24"
|
|
1703
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1704
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1705
|
+
fillRule: "evenodd",
|
|
1706
|
+
clipRule: "evenodd",
|
|
1707
|
+
d: "M19.2621 18.1129C19.4674 18.3182 19.5475 18.6173 19.4724 18.8977C19.3973 19.178 19.1783 19.397 18.8979 19.4721C18.6176 19.5472 18.3184 19.4671 18.1132 19.2619L12.1877 13.3363L6.26214 19.2619C6.0569 19.4671 5.75776 19.5472 5.47741 19.4721C5.19705 19.397 4.97807 19.178 4.90294 18.8977C4.82782 18.6173 4.90798 18.3182 5.11321 18.1129L11.0388 12.1874L5.11321 6.26186C4.90798 6.05663 4.82782 5.75749 4.90294 5.47713C4.97807 5.19678 5.19705 4.97779 5.47741 4.90267C5.75776 4.82755 6.0569 4.9077 6.26214 5.11294L12.1877 11.0385L18.1132 5.11294C18.4305 4.79567 18.9449 4.79567 19.2621 5.11294C19.5794 5.4302 19.5794 5.9446 19.2621 6.26186L13.3366 12.1874L19.2621 18.1129Z",
|
|
1708
|
+
fill: "white"
|
|
1709
|
+
}));
|
|
1710
|
+
}
|
|
1655
1711
|
}
|
|
1656
1712
|
return null;
|
|
1657
1713
|
}
|
|
@@ -1788,7 +1844,7 @@ const Drawer = ({
|
|
|
1788
1844
|
"aria-expanded": visible
|
|
1789
1845
|
}));
|
|
1790
1846
|
};
|
|
1791
|
-
const Wrapper$
|
|
1847
|
+
const Wrapper$7 = styled.div`
|
|
1792
1848
|
font-family: ${(p) => {
|
|
1793
1849
|
var _a;
|
|
1794
1850
|
return (_a = p.theme.fonts) == null ? void 0 : _a.type;
|
|
@@ -1830,7 +1886,7 @@ const Header$1 = styled(Typography)`
|
|
|
1830
1886
|
const AnimationBase = css`
|
|
1831
1887
|
transition: ${(p) => p.duration}ms;
|
|
1832
1888
|
`;
|
|
1833
|
-
const WrapperWithSlideInBottom = styled(Wrapper$
|
|
1889
|
+
const WrapperWithSlideInBottom = styled(Wrapper$7)`
|
|
1834
1890
|
max-height: 0;
|
|
1835
1891
|
${AnimationBase}
|
|
1836
1892
|
|
|
@@ -1848,7 +1904,7 @@ const WrapperWithSlideInBottom = styled(Wrapper$5)`
|
|
|
1848
1904
|
max-height: 0;
|
|
1849
1905
|
}
|
|
1850
1906
|
`;
|
|
1851
|
-
const WrapperWithSlideInRight = styled(Wrapper$
|
|
1907
|
+
const WrapperWithSlideInRight = styled(Wrapper$7)`
|
|
1852
1908
|
${AnimationBase}
|
|
1853
1909
|
transform: translateX(100%);
|
|
1854
1910
|
height: ${(p) => p.fullScreen ? "100%" : "auto"};
|
|
@@ -1867,7 +1923,7 @@ const WrapperWithSlideInRight = styled(Wrapper$5)`
|
|
|
1867
1923
|
transform: translateX(100%);
|
|
1868
1924
|
}
|
|
1869
1925
|
`;
|
|
1870
|
-
const WrapperWithSlideInLeft = styled(Wrapper$
|
|
1926
|
+
const WrapperWithSlideInLeft = styled(Wrapper$7)`
|
|
1871
1927
|
${AnimationBase}
|
|
1872
1928
|
transform: translateX(-100%);
|
|
1873
1929
|
height: ${(p) => p.fullScreen ? "100%" : "auto"};
|
|
@@ -1886,7 +1942,7 @@ const WrapperWithSlideInLeft = styled(Wrapper$5)`
|
|
|
1886
1942
|
transform: translateX(-100%);
|
|
1887
1943
|
}
|
|
1888
1944
|
`;
|
|
1889
|
-
const WrapperWithSlideInTop = styled(Wrapper$
|
|
1945
|
+
const WrapperWithSlideInTop = styled(Wrapper$7)`
|
|
1890
1946
|
${AnimationBase}
|
|
1891
1947
|
bottom: unset;
|
|
1892
1948
|
top: 0;
|
|
@@ -2039,9 +2095,9 @@ const StyledDropdown = styled.div`
|
|
|
2039
2095
|
`;
|
|
2040
2096
|
const Empty = (_k) => {
|
|
2041
2097
|
var other = __objRest(_k, []);
|
|
2042
|
-
return /* @__PURE__ */ React.createElement(Wrapper$
|
|
2098
|
+
return /* @__PURE__ */ React.createElement(Wrapper$6, __spreadValues({}, other));
|
|
2043
2099
|
};
|
|
2044
|
-
const Wrapper$
|
|
2100
|
+
const Wrapper$6 = styled.div`
|
|
2045
2101
|
display: none;
|
|
2046
2102
|
`;
|
|
2047
2103
|
var grid = forwardRef((_l, ref) => {
|
|
@@ -2296,14 +2352,14 @@ const Overlay = (_z) => {
|
|
|
2296
2352
|
classNames: "humany-overlay-transition",
|
|
2297
2353
|
unmountOnExit: true,
|
|
2298
2354
|
timeout: duration
|
|
2299
|
-
}, /* @__PURE__ */ React.createElement(Portal, null, /* @__PURE__ */ React.createElement(Wrapper$
|
|
2355
|
+
}, /* @__PURE__ */ React.createElement(Portal, null, /* @__PURE__ */ React.createElement(Wrapper$5, __spreadValues({
|
|
2300
2356
|
className: "humany-overlay",
|
|
2301
2357
|
duration,
|
|
2302
2358
|
ref,
|
|
2303
2359
|
onClick: onOverlayClick
|
|
2304
2360
|
}, other), children)));
|
|
2305
2361
|
};
|
|
2306
|
-
const Wrapper$
|
|
2362
|
+
const Wrapper$5 = styled.div`
|
|
2307
2363
|
background: rgba(0, 0, 0, 0.6);
|
|
2308
2364
|
min-width: 100%;
|
|
2309
2365
|
min-height: 100%;
|
|
@@ -2334,9 +2390,240 @@ const Wrapper$3 = styled.div`
|
|
|
2334
2390
|
opacity: 0;
|
|
2335
2391
|
}
|
|
2336
2392
|
`;
|
|
2393
|
+
const ZoomButtons = ({ zoom, zoomLevel }) => {
|
|
2394
|
+
return /* @__PURE__ */ React.createElement(Wrapper$4, null, /* @__PURE__ */ React.createElement(Buttons, null, /* @__PURE__ */ React.createElement(StyledButton$1, {
|
|
2395
|
+
"aria-label": "Zoom out",
|
|
2396
|
+
onClick: () => {
|
|
2397
|
+
zoom(false);
|
|
2398
|
+
}
|
|
2399
|
+
}, /* @__PURE__ */ React.createElement(StyledSymbolBadge$1, {
|
|
2400
|
+
size: 24,
|
|
2401
|
+
symbol: { type: "Svg", content: "zoom-out" }
|
|
2402
|
+
})), /* @__PURE__ */ React.createElement(StyledButton$1, {
|
|
2403
|
+
"aria-label": "Zoom in",
|
|
2404
|
+
onClick: () => {
|
|
2405
|
+
zoom(true);
|
|
2406
|
+
}
|
|
2407
|
+
}, /* @__PURE__ */ React.createElement(StyledSymbolBadge$1, {
|
|
2408
|
+
size: 24,
|
|
2409
|
+
symbol: { type: "Svg", content: "zoom-in" }
|
|
2410
|
+
}))), /* @__PURE__ */ React.createElement(ZoomLevel, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
2411
|
+
variant: "p"
|
|
2412
|
+
}, zoomLevel, "%")));
|
|
2413
|
+
};
|
|
2414
|
+
const Wrapper$4 = styled.div`
|
|
2415
|
+
width: 100vw;
|
|
2416
|
+
display: flex;
|
|
2417
|
+
position: absolute;
|
|
2418
|
+
bottom: 0;
|
|
2419
|
+
margin-bottom: ${(p) => {
|
|
2420
|
+
var _a;
|
|
2421
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
2422
|
+
}};
|
|
2423
|
+
justify-content: center;
|
|
2424
|
+
flex-direction: row;
|
|
2425
|
+
`;
|
|
2426
|
+
const ZoomLevel = styled.div`
|
|
2427
|
+
right: 45px;
|
|
2428
|
+
position: absolute;
|
|
2429
|
+
color: #fff;
|
|
2430
|
+
font-size: ${(p) => {
|
|
2431
|
+
var _a;
|
|
2432
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
|
|
2433
|
+
}};
|
|
2434
|
+
line-height: 1.5em;
|
|
2435
|
+
${(p) => {
|
|
2436
|
+
var _a, _b;
|
|
2437
|
+
return ((_a = p.theme.fonts) == null ? void 0 : _a.type) && `
|
|
2438
|
+
font-family: ${(_b = p.theme.fonts) == null ? void 0 : _b.type};
|
|
2439
|
+
`;
|
|
2440
|
+
}}
|
|
2441
|
+
`;
|
|
2442
|
+
const Buttons = styled.div`
|
|
2443
|
+
position: relative;
|
|
2444
|
+
margin: ${(p) => {
|
|
2445
|
+
var _a;
|
|
2446
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
2447
|
+
}};
|
|
2448
|
+
`;
|
|
2449
|
+
const StyledSymbolBadge$1 = styled(SymbolBadge)`
|
|
2450
|
+
path {
|
|
2451
|
+
stroke: #ffffff;
|
|
2452
|
+
}
|
|
2453
|
+
`;
|
|
2454
|
+
const StyledButton$1 = styled(Button)`
|
|
2455
|
+
transition: opacity 300ms ease-in-out;
|
|
2456
|
+
opacity: 0.7;
|
|
2457
|
+
&:hover {
|
|
2458
|
+
opacity: 1;
|
|
2459
|
+
}
|
|
2460
|
+
margin: ${(p) => {
|
|
2461
|
+
var _a;
|
|
2462
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.small;
|
|
2463
|
+
}};
|
|
2464
|
+
`;
|
|
2465
|
+
const spin = keyframes`
|
|
2466
|
+
100% {
|
|
2467
|
+
transform: rotate(360deg);
|
|
2468
|
+
}
|
|
2469
|
+
`;
|
|
2470
|
+
const dash = keyframes`
|
|
2471
|
+
0% {
|
|
2472
|
+
stroke-dasharray: 1, 200;
|
|
2473
|
+
stroke-dashoffset: 0;
|
|
2474
|
+
}
|
|
2475
|
+
50% {
|
|
2476
|
+
stroke-dasharray: 89, 200;
|
|
2477
|
+
stroke-dashoffset: -35px;
|
|
2478
|
+
}
|
|
2479
|
+
100% {
|
|
2480
|
+
stroke-dasharray: 89, 200;
|
|
2481
|
+
stroke-dashoffset: -124px;
|
|
2482
|
+
}
|
|
2483
|
+
`;
|
|
2484
|
+
const SpinnerSvg = styled.svg`
|
|
2485
|
+
animation: ${spin} 2s linear infinite;
|
|
2486
|
+
height: 100%;
|
|
2487
|
+
transform-origin: center center;
|
|
2488
|
+
width: 100%;
|
|
2489
|
+
position: absolute;
|
|
2490
|
+
top: 0;
|
|
2491
|
+
bottom: 0;
|
|
2492
|
+
left: 0;
|
|
2493
|
+
right: 0;
|
|
2494
|
+
margin: auto;
|
|
2495
|
+
transition: 200ms ease-out opacity;
|
|
2496
|
+
`;
|
|
2497
|
+
const Wrapper$3 = styled.div`
|
|
2498
|
+
position: absolute;
|
|
2499
|
+
top: 0;
|
|
2500
|
+
bottom: 0;
|
|
2501
|
+
left: 0;
|
|
2502
|
+
right: 0;
|
|
2503
|
+
height: 100%;
|
|
2504
|
+
width: 100%;
|
|
2505
|
+
pointer-events: ${(p) => p["data-loading"] ? "all" : "none"}
|
|
2506
|
+
display: flex;
|
|
2507
|
+
flex-direction: column;
|
|
2508
|
+
justify-content: center;
|
|
2509
|
+
transition: 200ms ease-out opacity;
|
|
2510
|
+
box-sizing: border-box;
|
|
2511
|
+
overflow: hidden;
|
|
2512
|
+
${SpinnerSvg} {
|
|
2513
|
+
opacity: ${(p) => p["data-loading"] ? "1" : "0"}
|
|
2514
|
+
}
|
|
2515
|
+
`;
|
|
2516
|
+
const Spinner = styled.div`
|
|
2517
|
+
position: relative;
|
|
2518
|
+
margin: 0 auto;
|
|
2519
|
+
width: 100px;
|
|
2520
|
+
&:before {
|
|
2521
|
+
content: '';
|
|
2522
|
+
display: block;
|
|
2523
|
+
padding-top: 100%;
|
|
2524
|
+
}
|
|
2525
|
+
`;
|
|
2526
|
+
const SpinnerCircle = styled.circle`
|
|
2527
|
+
stroke-dasharray: 1, 200;
|
|
2528
|
+
stroke-dashoffset: 0;
|
|
2529
|
+
animation: ${dash} 1.5s ease-in-out infinite;
|
|
2530
|
+
stroke-linecap: round;
|
|
2531
|
+
stroke: ${(p) => {
|
|
2532
|
+
var _a;
|
|
2533
|
+
return (_a = p.theme.colors) == null ? void 0 : _a.primary;
|
|
2534
|
+
}};
|
|
2535
|
+
stroke-width: 2px;
|
|
2536
|
+
`;
|
|
2537
|
+
const Loader = ({ loading = false }) => {
|
|
2538
|
+
return /* @__PURE__ */ React.createElement(Wrapper$3, {
|
|
2539
|
+
className: "humany-loader",
|
|
2540
|
+
"data-loading": loading
|
|
2541
|
+
}, /* @__PURE__ */ React.createElement(Spinner, {
|
|
2542
|
+
className: "humany-spinner"
|
|
2543
|
+
}, /* @__PURE__ */ React.createElement(SpinnerSvg, {
|
|
2544
|
+
viewBox: "25 25 50 50"
|
|
2545
|
+
}, /* @__PURE__ */ React.createElement(SpinnerCircle, {
|
|
2546
|
+
cx: "50",
|
|
2547
|
+
cy: "50",
|
|
2548
|
+
r: "20",
|
|
2549
|
+
fill: "none",
|
|
2550
|
+
"stroke-width": "2",
|
|
2551
|
+
"stroke-miterlimit": "10"
|
|
2552
|
+
}))));
|
|
2553
|
+
};
|
|
2554
|
+
const ZoomImg = (_B) => {
|
|
2555
|
+
var _C = _B, { zoomState } = _C, attrs = __objRest(_C, ["zoomState"]);
|
|
2556
|
+
const ref = useRef(null);
|
|
2557
|
+
const [loaded, setLoaded] = useState(false);
|
|
2558
|
+
const _a = attrs.style || {}, { width, height } = _a, restStyle = __objRest(_a, ["width", "height"]);
|
|
2559
|
+
const imageSize = useMemo(() => {
|
|
2560
|
+
const img = ref.current;
|
|
2561
|
+
if (img) {
|
|
2562
|
+
if (img.width >= img.height) {
|
|
2563
|
+
return [`${zoomState}vw`, "auto"];
|
|
2564
|
+
} else {
|
|
2565
|
+
return ["auto", `${zoomState}vh`];
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
return null;
|
|
2569
|
+
}, [zoomState, ref, loaded]);
|
|
2570
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Loader, {
|
|
2571
|
+
loading: !loaded
|
|
2572
|
+
}), /* @__PURE__ */ React.createElement(Img, __spreadProps(__spreadValues({
|
|
2573
|
+
onLoad: () => {
|
|
2574
|
+
setLoaded(true);
|
|
2575
|
+
},
|
|
2576
|
+
ref,
|
|
2577
|
+
imageSize,
|
|
2578
|
+
draggable: "false"
|
|
2579
|
+
}, attrs), {
|
|
2580
|
+
style: restStyle
|
|
2581
|
+
})), /* @__PURE__ */ React.createElement(EmptyDiv, null));
|
|
2582
|
+
};
|
|
2583
|
+
const Img = styled.img`
|
|
2584
|
+
transform: none;
|
|
2585
|
+
|
|
2586
|
+
${(props) => props.imageSize ? css`
|
|
2587
|
+
width: ${props.imageSize[0]};
|
|
2588
|
+
height: ${props.imageSize[1]};
|
|
2589
|
+
display: inline-block;
|
|
2590
|
+
` : "display:none;"}
|
|
2591
|
+
vertical-align: middle;
|
|
2592
|
+
position: relative;
|
|
2593
|
+
`;
|
|
2594
|
+
const EmptyDiv = styled.div`
|
|
2595
|
+
height: 100%;
|
|
2596
|
+
display: inline-block;
|
|
2597
|
+
vertical-align: middle;
|
|
2598
|
+
`;
|
|
2599
|
+
const useFadeOut = () => {
|
|
2600
|
+
const timeOut = useRef();
|
|
2601
|
+
const [show, setShow] = useState(true);
|
|
2602
|
+
const triggerChange = useCallback(() => {
|
|
2603
|
+
if (!show)
|
|
2604
|
+
setShow(true);
|
|
2605
|
+
if (timeOut.current) {
|
|
2606
|
+
clearTimeout(timeOut.current);
|
|
2607
|
+
}
|
|
2608
|
+
timeOut.current = setTimeout(() => {
|
|
2609
|
+
setShow(false);
|
|
2610
|
+
}, 3e3);
|
|
2611
|
+
return () => {
|
|
2612
|
+
if (timeOut.current) {
|
|
2613
|
+
clearTimeout(timeOut.current);
|
|
2614
|
+
}
|
|
2615
|
+
};
|
|
2616
|
+
}, [show, timeOut]);
|
|
2617
|
+
return [show, triggerChange];
|
|
2618
|
+
};
|
|
2337
2619
|
const Lightbox = ({ attrs }) => {
|
|
2338
2620
|
const [visible, toggleVisible] = useToggle(false);
|
|
2339
2621
|
const esc = useKeyPress("Escape");
|
|
2622
|
+
const [zoomState, setZoomState] = useState(80);
|
|
2623
|
+
const [scroll, setScroll] = useState({ top: 0, left: 0, x: 0, y: 0 });
|
|
2624
|
+
const [scrolling, setScrolling] = useState(false);
|
|
2625
|
+
const [show, triggerFadeOut] = useFadeOut();
|
|
2626
|
+
const ref = useRef(null);
|
|
2340
2627
|
useEffect(() => {
|
|
2341
2628
|
if (esc) {
|
|
2342
2629
|
toggleVisible(false);
|
|
@@ -2345,44 +2632,134 @@ const Lightbox = ({ attrs }) => {
|
|
|
2345
2632
|
const overlayClick = useCallback((e) => {
|
|
2346
2633
|
toggleVisible(false);
|
|
2347
2634
|
}, [toggleVisible]);
|
|
2635
|
+
const changeZoomState = useCallback((zoomIn) => {
|
|
2636
|
+
if (zoomIn) {
|
|
2637
|
+
setZoomState(zoomState + 10);
|
|
2638
|
+
} else {
|
|
2639
|
+
setZoomState(zoomState - 10);
|
|
2640
|
+
}
|
|
2641
|
+
}, [setZoomState, zoomState]);
|
|
2642
|
+
const downloadImage = useCallback(() => {
|
|
2643
|
+
const { src } = attrs;
|
|
2644
|
+
if (src) {
|
|
2645
|
+
window.open(src, "_blank");
|
|
2646
|
+
}
|
|
2647
|
+
}, [attrs]);
|
|
2648
|
+
const mouseDownHandler = useCallback((e) => {
|
|
2649
|
+
const ele = ref.current;
|
|
2650
|
+
if (ele) {
|
|
2651
|
+
setScroll({ top: ele.scrollTop, left: ele.scrollLeft, x: e.clientX, y: e.clientY });
|
|
2652
|
+
setScrolling(true);
|
|
2653
|
+
}
|
|
2654
|
+
}, [ref]);
|
|
2655
|
+
const mouseDragHandler = useCallback((e) => {
|
|
2656
|
+
const ele = ref.current;
|
|
2657
|
+
if (ele && scrolling) {
|
|
2658
|
+
const dx = e.clientX - scroll.x;
|
|
2659
|
+
const dy = e.clientY - scroll.y;
|
|
2660
|
+
ele.scrollTop = scroll.top - dy;
|
|
2661
|
+
ele.scrollLeft = scroll.left - dx;
|
|
2662
|
+
}
|
|
2663
|
+
}, [scrolling, scroll]);
|
|
2664
|
+
const mouseStopDragHandler = (e) => {
|
|
2665
|
+
e.preventDefault();
|
|
2666
|
+
setScrolling(false);
|
|
2667
|
+
};
|
|
2668
|
+
const isDraggable = useMemo(() => {
|
|
2669
|
+
if (ref.current) {
|
|
2670
|
+
const image = ref.current.getElementsByTagName("img");
|
|
2671
|
+
if (image) {
|
|
2672
|
+
const img = image[0];
|
|
2673
|
+
return img.width > window.innerWidth || img.height > window.innerHeight;
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
return false;
|
|
2677
|
+
}, [ref, zoomState]);
|
|
2348
2678
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Overlay, {
|
|
2349
2679
|
visible,
|
|
2350
2680
|
onClick: overlayClick
|
|
2351
|
-
}, /* @__PURE__ */ React.createElement(
|
|
2681
|
+
}, /* @__PURE__ */ React.createElement(DraggableArea, {
|
|
2682
|
+
onMouseDown: () => triggerFadeOut(),
|
|
2683
|
+
onMouseMove: () => triggerFadeOut(),
|
|
2684
|
+
onTouchStart: () => triggerFadeOut()
|
|
2685
|
+
}, /* @__PURE__ */ React.createElement(TransparentBarTop, {
|
|
2686
|
+
show
|
|
2687
|
+
}, /* @__PURE__ */ React.createElement(DownloadButton, {
|
|
2688
|
+
onClick: () => downloadImage()
|
|
2689
|
+
}, /* @__PURE__ */ React.createElement(StyledSymbolBadge, {
|
|
2690
|
+
size: 20,
|
|
2691
|
+
symbol: { type: "Svg", content: "download" }
|
|
2692
|
+
})), /* @__PURE__ */ React.createElement(CloseButton, {
|
|
2352
2693
|
onClick: () => toggleVisible(false)
|
|
2353
2694
|
}, /* @__PURE__ */ React.createElement(StyledSymbolBadge, {
|
|
2354
|
-
size:
|
|
2355
|
-
symbol: { type: "Svg", content: "close" }
|
|
2356
|
-
})), /* @__PURE__ */ React.createElement(Content$1,
|
|
2695
|
+
size: 20,
|
|
2696
|
+
symbol: { type: "Svg", content: "lightbox-close" }
|
|
2697
|
+
}))), /* @__PURE__ */ React.createElement(Content$1, {
|
|
2698
|
+
scrolling,
|
|
2699
|
+
isDraggable,
|
|
2700
|
+
ref,
|
|
2701
|
+
onMouseMove: mouseDragHandler,
|
|
2702
|
+
onMouseDown: mouseDownHandler,
|
|
2703
|
+
onMouseUp: mouseStopDragHandler
|
|
2704
|
+
}, /* @__PURE__ */ React.createElement(ZoomImg, __spreadValues({
|
|
2705
|
+
zoomState
|
|
2706
|
+
}, attrs))), /* @__PURE__ */ React.createElement(TransparentBarBottom, {
|
|
2707
|
+
show
|
|
2708
|
+
}, /* @__PURE__ */ React.createElement(ZoomButtons, {
|
|
2709
|
+
zoom: changeZoomState,
|
|
2710
|
+
zoomLevel: zoomState
|
|
2711
|
+
})))), /* @__PURE__ */ React.createElement("a", {
|
|
2357
2712
|
onClick: () => toggleVisible()
|
|
2358
2713
|
}, /* @__PURE__ */ React.createElement(Thumbnail, __spreadValues({}, attrs))));
|
|
2359
2714
|
};
|
|
2715
|
+
const TransparentBar = styled.div`
|
|
2716
|
+
position: absolute;
|
|
2717
|
+
width: 100vw;
|
|
2718
|
+
height: 88px;
|
|
2719
|
+
left: 0px;
|
|
2720
|
+
transition: opacity 0.3s ease 0s;
|
|
2721
|
+
z-index: 5;
|
|
2722
|
+
${(p) => p.show ? "opacity: 1;" : css`
|
|
2723
|
+
opacity: 0;
|
|
2724
|
+
pointer-events: none;
|
|
2725
|
+
`}
|
|
2726
|
+
`;
|
|
2727
|
+
const DraggableArea = styled.div`
|
|
2728
|
+
width: 100%;
|
|
2729
|
+
`;
|
|
2730
|
+
const TransparentBarTop = styled(TransparentBar)`
|
|
2731
|
+
top: 0px;
|
|
2732
|
+
background-image: linear-gradient(to bottom, rgb(15, 15, 15, 0.8), rgba(30, 30, 30, 0));
|
|
2733
|
+
`;
|
|
2734
|
+
const TransparentBarBottom = styled(TransparentBar)`
|
|
2735
|
+
bottom: 0px;
|
|
2736
|
+
background-image: linear-gradient(to top, rgb(15, 15, 15, 0.8), rgba(30, 30, 30, 0));
|
|
2737
|
+
`;
|
|
2360
2738
|
const Content$1 = styled.div`
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
width: auto !important;
|
|
2370
|
-
height: auto !important;
|
|
2371
|
-
max-width: 100%;
|
|
2372
|
-
max-height: 100%;
|
|
2373
|
-
}
|
|
2739
|
+
width: 100%;
|
|
2740
|
+
height: 100vh;
|
|
2741
|
+
overflow: auto;
|
|
2742
|
+
text-align: center;
|
|
2743
|
+
vertical-align: middle;
|
|
2744
|
+
white-space: nowrap;
|
|
2745
|
+
justify-content: center;
|
|
2746
|
+
cursor: ${(props) => props.isDraggable ? props.scrolling ? "grabbing" : "grab" : "auto"};
|
|
2374
2747
|
`;
|
|
2375
|
-
const
|
|
2748
|
+
const StyledButton = styled(Button)`
|
|
2376
2749
|
position: fixed;
|
|
2377
|
-
top:
|
|
2378
|
-
right: 50px;
|
|
2750
|
+
top: 34px;
|
|
2379
2751
|
transition: opacity 300ms ease-in-out;
|
|
2380
2752
|
opacity: 0.7;
|
|
2381
|
-
|
|
2382
2753
|
&:hover {
|
|
2383
2754
|
opacity: 1;
|
|
2384
2755
|
}
|
|
2385
2756
|
`;
|
|
2757
|
+
const CloseButton = styled(StyledButton)`
|
|
2758
|
+
right: 32px;
|
|
2759
|
+
`;
|
|
2760
|
+
const DownloadButton = styled(StyledButton)`
|
|
2761
|
+
right: 80px;
|
|
2762
|
+
`;
|
|
2386
2763
|
const StyledSymbolBadge = styled(SymbolBadge)`
|
|
2387
2764
|
path {
|
|
2388
2765
|
stroke: #ffffff;
|
|
@@ -2391,9 +2768,9 @@ const StyledSymbolBadge = styled(SymbolBadge)`
|
|
|
2391
2768
|
const Thumbnail = styled.img`
|
|
2392
2769
|
cursor: pointer;
|
|
2393
2770
|
`;
|
|
2394
|
-
var RouteLink = forwardRef((
|
|
2395
|
-
var
|
|
2396
|
-
}, name = "", to = "", params = {}, children } =
|
|
2771
|
+
var RouteLink = forwardRef((_D, forwardedRef) => {
|
|
2772
|
+
var _E = _D, { className, onClick = () => {
|
|
2773
|
+
}, name = "", to = "", params = {}, children } = _E, other = __objRest(_E, ["className", "onClick", "name", "to", "params", "children"]);
|
|
2397
2774
|
const router = useRouter();
|
|
2398
2775
|
const container = useContainer();
|
|
2399
2776
|
if (!router) {
|
|
@@ -2449,8 +2826,8 @@ var RouteLink = forwardRef((_B, forwardedRef) => {
|
|
|
2449
2826
|
to: path
|
|
2450
2827
|
}), children);
|
|
2451
2828
|
});
|
|
2452
|
-
var Link = forwardRef((
|
|
2453
|
-
var
|
|
2829
|
+
var Link = forwardRef((_F, ref) => {
|
|
2830
|
+
var _G = _F, {
|
|
2454
2831
|
className,
|
|
2455
2832
|
disabled = false,
|
|
2456
2833
|
role = "link",
|
|
@@ -2465,7 +2842,7 @@ var Link = forwardRef((_D, ref) => {
|
|
|
2465
2842
|
target,
|
|
2466
2843
|
routeName,
|
|
2467
2844
|
params
|
|
2468
|
-
} =
|
|
2845
|
+
} = _G, other = __objRest(_G, [
|
|
2469
2846
|
"className",
|
|
2470
2847
|
"disabled",
|
|
2471
2848
|
"role",
|
|
@@ -2528,9 +2905,9 @@ const StyledLink = styled.a`
|
|
|
2528
2905
|
opacity: .7;
|
|
2529
2906
|
` : "cursor: pointer;"}
|
|
2530
2907
|
`;
|
|
2531
|
-
const Modal = forwardRef((
|
|
2532
|
-
var
|
|
2533
|
-
}, close = false } =
|
|
2908
|
+
const Modal = forwardRef((_H, ref) => {
|
|
2909
|
+
var _I = _H, { className, children, trigger, onOverlayClick = () => {
|
|
2910
|
+
}, close = false } = _I, other = __objRest(_I, ["className", "children", "trigger", "onOverlayClick", "close"]);
|
|
2534
2911
|
const [visible, toggleVisible] = useToggle();
|
|
2535
2912
|
const [css2, innerRef] = useScroll(true);
|
|
2536
2913
|
const closeButtonRef = useRef();
|
|
@@ -2836,8 +3213,8 @@ class TabStop extends Component {
|
|
|
2836
3213
|
});
|
|
2837
3214
|
}
|
|
2838
3215
|
}
|
|
2839
|
-
var TextLink = forwardRef((
|
|
2840
|
-
var
|
|
3216
|
+
var TextLink = forwardRef((_J, ref) => {
|
|
3217
|
+
var _K = _J, { className, description, text, children } = _K, other = __objRest(_K, ["className", "description", "text", "children"]);
|
|
2841
3218
|
return /* @__PURE__ */ React.createElement(Link, __spreadProps(__spreadValues({
|
|
2842
3219
|
className: appendClassNames(className, "humany-text-link")
|
|
2843
3220
|
}, other), {
|
|
@@ -2877,8 +3254,8 @@ function formatDate(unformattedDate, format) {
|
|
|
2877
3254
|
}
|
|
2878
3255
|
return `${dateString} ${timeString}`;
|
|
2879
3256
|
}
|
|
2880
|
-
const Tooltip = (
|
|
2881
|
-
var
|
|
3257
|
+
const Tooltip = (_L) => {
|
|
3258
|
+
var _M = _L, { className, children, content, sticky = false } = _M, other = __objRest(_M, ["className", "children", "content", "sticky"]);
|
|
2882
3259
|
const [open, setOpen] = useState(false);
|
|
2883
3260
|
const id = useRef(uuid());
|
|
2884
3261
|
const ref = useRef();
|
|
@@ -3023,9 +3400,9 @@ const TransitionComponent = (props) => {
|
|
|
3023
3400
|
onEnter: (node) => node.clientHeight
|
|
3024
3401
|
}, (state) => children && children(state, def && transitionComposer.compose(state, def)));
|
|
3025
3402
|
};
|
|
3026
|
-
var WidgetLink = forwardRef((
|
|
3027
|
-
var
|
|
3028
|
-
}, widgetName, activationOptions } =
|
|
3403
|
+
var WidgetLink = forwardRef((_N, ref) => {
|
|
3404
|
+
var _O = _N, { className, children, onClick = () => {
|
|
3405
|
+
}, widgetName, activationOptions } = _O, other = __objRest(_O, ["className", "children", "onClick", "widgetName", "activationOptions"]);
|
|
3029
3406
|
const container = useContainer();
|
|
3030
3407
|
const getWidget = () => {
|
|
3031
3408
|
const { implementation } = container.get("$widget");
|