@telia-ace/widget-ui 1.0.14 → 1.0.17
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/dist/components/lightbox.d.ts +3 -2
- package/dist/components/loader.d.ts +10 -0
- package/dist/components/zoomable-img.d.ts +6 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +751 -155
- package/dist/index.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/render-instructions.d.ts +2 -1
- package/package.json +5 -4
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";
|
|
@@ -327,14 +327,15 @@ function parseHtmlString(html, instruction) {
|
|
|
327
327
|
}
|
|
328
328
|
return convert(html);
|
|
329
329
|
}
|
|
330
|
-
const imageLightboxRenderer = (attrs) => /* @__PURE__ */ React.createElement(Lightbox, {
|
|
331
|
-
attrs
|
|
330
|
+
const imageLightboxRenderer = (htmlBody) => (attrs) => /* @__PURE__ */ React.createElement(Lightbox, {
|
|
331
|
+
attrs,
|
|
332
|
+
htmlBody
|
|
332
333
|
});
|
|
333
|
-
const defaultRenderInstructions = (container) => {
|
|
334
|
+
const defaultRenderInstructions = (container, htmlBody) => {
|
|
334
335
|
return {
|
|
335
336
|
transform: {
|
|
336
337
|
a: embeddedLinkMapper(container),
|
|
337
|
-
img: imageLightboxRenderer
|
|
338
|
+
img: imageLightboxRenderer(htmlBody)
|
|
338
339
|
}
|
|
339
340
|
};
|
|
340
341
|
};
|
|
@@ -983,7 +984,7 @@ const paddedBorderTabStyle = css`
|
|
|
983
984
|
return (_a = p.theme.sizes) == null ? void 0 : _a.small;
|
|
984
985
|
}};
|
|
985
986
|
`;
|
|
986
|
-
const CloseButton
|
|
987
|
+
const CloseButton = styled(Button)`
|
|
987
988
|
position: absolute;
|
|
988
989
|
top: ${(p) => {
|
|
989
990
|
var _a;
|
|
@@ -1601,6 +1602,30 @@ const SymbolBadge = (_g) => {
|
|
|
1601
1602
|
fill: "white"
|
|
1602
1603
|
}));
|
|
1603
1604
|
}
|
|
1605
|
+
case "video": {
|
|
1606
|
+
if (style.minWidth && typeof style.minWidth === "number") {
|
|
1607
|
+
style.minWidth = `${style.minWidth}px`;
|
|
1608
|
+
}
|
|
1609
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadProps(__spreadValues({
|
|
1610
|
+
viewBox: "0 0 25 25"
|
|
1611
|
+
}, svgProps), {
|
|
1612
|
+
style
|
|
1613
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1614
|
+
d: "M16.8245 10.0758C18.7392 8.55799 21.3085 7.08973 21.7947 7.61552C22.5982 8.47863 22.5288 16.6929 21.7947 17.4766C21.3482 17.9627 18.7589 16.4945 16.8245 14.9866",
|
|
1615
|
+
stroke: "currentColor",
|
|
1616
|
+
strokeWidth: "1.5",
|
|
1617
|
+
strokeLinecap: "round",
|
|
1618
|
+
strokeLinejoin: "round"
|
|
1619
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1620
|
+
fillRule: "evenodd",
|
|
1621
|
+
clipRule: "evenodd",
|
|
1622
|
+
d: "M2.61914 12.5385C2.61914 7.12973 4.41578 5.32715 9.80764 5.32715C15.1985 5.32715 16.9952 7.12973 16.9952 12.5385C16.9952 17.9462 15.1985 19.7497 9.80764 19.7497C4.41578 19.7497 2.61914 17.9462 2.61914 12.5385Z",
|
|
1623
|
+
stroke: "currentColor",
|
|
1624
|
+
strokeWidth: "1.5",
|
|
1625
|
+
strokeLinecap: "round",
|
|
1626
|
+
strokeLinejoin: "round"
|
|
1627
|
+
}));
|
|
1628
|
+
}
|
|
1604
1629
|
case "star-empty": {
|
|
1605
1630
|
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1606
1631
|
viewBox: "0 0 13 12"
|
|
@@ -1628,6 +1653,79 @@ const SymbolBadge = (_g) => {
|
|
|
1628
1653
|
fill: "black"
|
|
1629
1654
|
}));
|
|
1630
1655
|
}
|
|
1656
|
+
case "zoom-in": {
|
|
1657
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1658
|
+
viewBox: "0 0 24 24"
|
|
1659
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1660
|
+
fillRule: "evenodd",
|
|
1661
|
+
clipRule: "evenodd",
|
|
1662
|
+
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",
|
|
1663
|
+
fill: "white"
|
|
1664
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1665
|
+
fillRule: "evenodd",
|
|
1666
|
+
clipRule: "evenodd",
|
|
1667
|
+
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",
|
|
1668
|
+
fill: "white"
|
|
1669
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1670
|
+
fillRule: "evenodd",
|
|
1671
|
+
clipRule: "evenodd",
|
|
1672
|
+
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",
|
|
1673
|
+
fill: "white"
|
|
1674
|
+
}));
|
|
1675
|
+
}
|
|
1676
|
+
case "zoom-out": {
|
|
1677
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1678
|
+
viewBox: "0 0 24 24"
|
|
1679
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1680
|
+
fillRule: "evenodd",
|
|
1681
|
+
clipRule: "evenodd",
|
|
1682
|
+
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",
|
|
1683
|
+
fill: "white"
|
|
1684
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
1685
|
+
fillRule: "evenodd",
|
|
1686
|
+
clipRule: "evenodd",
|
|
1687
|
+
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",
|
|
1688
|
+
fill: "white"
|
|
1689
|
+
}));
|
|
1690
|
+
}
|
|
1691
|
+
case "download": {
|
|
1692
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1693
|
+
viewBox: "0 0 24 24"
|
|
1694
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1695
|
+
fillRule: "evenodd",
|
|
1696
|
+
clipRule: "evenodd",
|
|
1697
|
+
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",
|
|
1698
|
+
fill: "white"
|
|
1699
|
+
}));
|
|
1700
|
+
}
|
|
1701
|
+
case "lightbox-close": {
|
|
1702
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1703
|
+
viewBox: "0 0 24 24"
|
|
1704
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1705
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1706
|
+
fillRule: "evenodd",
|
|
1707
|
+
clipRule: "evenodd",
|
|
1708
|
+
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",
|
|
1709
|
+
fill: "white"
|
|
1710
|
+
}));
|
|
1711
|
+
}
|
|
1712
|
+
case "pagination-left": {
|
|
1713
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1714
|
+
viewBox: "0 0 24 24"
|
|
1715
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1716
|
+
fillRule: "evenodd",
|
|
1717
|
+
clipRule: "evenodd",
|
|
1718
|
+
d: "M15.7935 18.7087C16.0092 18.9029 16.105 19.1974 16.0447 19.4813C15.9844 19.7652 15.7772 19.9954 15.5012 20.0852C15.2251 20.1749 14.9222 20.1105 14.7065 19.9164L6.58148 12.6039C6.41027 12.4498 6.3125 12.2303 6.3125 12C6.3125 11.7697 6.41027 11.5503 6.58148 11.3962L14.7065 4.08372C15.04 3.78354 15.5536 3.81054 15.8538 4.14402C16.154 4.4775 16.127 4.99119 15.7935 5.29136L8.33939 12L15.7935 18.7087Z",
|
|
1719
|
+
fill: "#222222"
|
|
1720
|
+
}));
|
|
1721
|
+
}
|
|
1722
|
+
case "pagination-right": {
|
|
1723
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
1724
|
+
viewBox: "0 0 24 24"
|
|
1725
|
+
}, svgProps), /* @__PURE__ */ React.createElement("path", {
|
|
1726
|
+
d: "M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"
|
|
1727
|
+
}));
|
|
1728
|
+
}
|
|
1631
1729
|
}
|
|
1632
1730
|
return null;
|
|
1633
1731
|
}
|
|
@@ -1744,7 +1842,7 @@ const Drawer = ({
|
|
|
1744
1842
|
clientHeight: document.body.clientHeight,
|
|
1745
1843
|
css: css2,
|
|
1746
1844
|
ref
|
|
1747
|
-
}, /* @__PURE__ */ React.createElement(CloseButton
|
|
1845
|
+
}, /* @__PURE__ */ React.createElement(CloseButton, {
|
|
1748
1846
|
onClick: () => toggleVisible(false),
|
|
1749
1847
|
tabIndex: 0,
|
|
1750
1848
|
ref: closeButtonRef,
|
|
@@ -1764,7 +1862,7 @@ const Drawer = ({
|
|
|
1764
1862
|
"aria-expanded": visible
|
|
1765
1863
|
}));
|
|
1766
1864
|
};
|
|
1767
|
-
const Wrapper$
|
|
1865
|
+
const Wrapper$6 = styled.div`
|
|
1768
1866
|
font-family: ${(p) => {
|
|
1769
1867
|
var _a;
|
|
1770
1868
|
return (_a = p.theme.fonts) == null ? void 0 : _a.type;
|
|
@@ -1806,7 +1904,7 @@ const Header$1 = styled(Typography)`
|
|
|
1806
1904
|
const AnimationBase = css`
|
|
1807
1905
|
transition: ${(p) => p.duration}ms;
|
|
1808
1906
|
`;
|
|
1809
|
-
const WrapperWithSlideInBottom = styled(Wrapper$
|
|
1907
|
+
const WrapperWithSlideInBottom = styled(Wrapper$6)`
|
|
1810
1908
|
max-height: 0;
|
|
1811
1909
|
${AnimationBase}
|
|
1812
1910
|
|
|
@@ -1824,7 +1922,7 @@ const WrapperWithSlideInBottom = styled(Wrapper$5)`
|
|
|
1824
1922
|
max-height: 0;
|
|
1825
1923
|
}
|
|
1826
1924
|
`;
|
|
1827
|
-
const WrapperWithSlideInRight = styled(Wrapper$
|
|
1925
|
+
const WrapperWithSlideInRight = styled(Wrapper$6)`
|
|
1828
1926
|
${AnimationBase}
|
|
1829
1927
|
transform: translateX(100%);
|
|
1830
1928
|
height: ${(p) => p.fullScreen ? "100%" : "auto"};
|
|
@@ -1843,7 +1941,7 @@ const WrapperWithSlideInRight = styled(Wrapper$5)`
|
|
|
1843
1941
|
transform: translateX(100%);
|
|
1844
1942
|
}
|
|
1845
1943
|
`;
|
|
1846
|
-
const WrapperWithSlideInLeft = styled(Wrapper$
|
|
1944
|
+
const WrapperWithSlideInLeft = styled(Wrapper$6)`
|
|
1847
1945
|
${AnimationBase}
|
|
1848
1946
|
transform: translateX(-100%);
|
|
1849
1947
|
height: ${(p) => p.fullScreen ? "100%" : "auto"};
|
|
@@ -1862,7 +1960,7 @@ const WrapperWithSlideInLeft = styled(Wrapper$5)`
|
|
|
1862
1960
|
transform: translateX(-100%);
|
|
1863
1961
|
}
|
|
1864
1962
|
`;
|
|
1865
|
-
const WrapperWithSlideInTop = styled(Wrapper$
|
|
1963
|
+
const WrapperWithSlideInTop = styled(Wrapper$6)`
|
|
1866
1964
|
${AnimationBase}
|
|
1867
1965
|
bottom: unset;
|
|
1868
1966
|
top: 0;
|
|
@@ -1973,7 +2071,7 @@ const Dropdown = React.forwardRef((_i, ref) => {
|
|
|
1973
2071
|
x,
|
|
1974
2072
|
y,
|
|
1975
2073
|
ref: innerRef
|
|
1976
|
-
}), /* @__PURE__ */ React.createElement(CloseButton
|
|
2074
|
+
}), /* @__PURE__ */ React.createElement(CloseButton, {
|
|
1977
2075
|
onClick: () => setVisible(false),
|
|
1978
2076
|
tabIndex: 0,
|
|
1979
2077
|
ref: closeButtonRef,
|
|
@@ -2015,9 +2113,9 @@ const StyledDropdown = styled.div`
|
|
|
2015
2113
|
`;
|
|
2016
2114
|
const Empty = (_k) => {
|
|
2017
2115
|
var other = __objRest(_k, []);
|
|
2018
|
-
return /* @__PURE__ */ React.createElement(Wrapper$
|
|
2116
|
+
return /* @__PURE__ */ React.createElement(Wrapper$5, __spreadValues({}, other));
|
|
2019
2117
|
};
|
|
2020
|
-
const Wrapper$
|
|
2118
|
+
const Wrapper$5 = styled.div`
|
|
2021
2119
|
display: none;
|
|
2022
2120
|
`;
|
|
2023
2121
|
var grid = forwardRef((_l, ref) => {
|
|
@@ -2043,7 +2141,10 @@ var Html = forwardRef((_n, ref) => {
|
|
|
2043
2141
|
const container = useContainer();
|
|
2044
2142
|
const [processedHtml, setProcessedHtml] = useState();
|
|
2045
2143
|
useEffect(() => {
|
|
2046
|
-
const
|
|
2144
|
+
const defaultInstructions = defaultRenderInstructions(container, html);
|
|
2145
|
+
const instructions = __spreadProps(__spreadValues(__spreadValues({}, defaultInstructions), htmlParseInstruction), {
|
|
2146
|
+
transform: __spreadValues(__spreadValues({}, defaultInstructions.transform), htmlParseInstruction == null ? void 0 : htmlParseInstruction.transform)
|
|
2147
|
+
});
|
|
2047
2148
|
const processed = parseHtmlString(html, instructions);
|
|
2048
2149
|
setProcessedHtml(processed);
|
|
2049
2150
|
}, [html, htmlParseInstruction]);
|
|
@@ -2247,129 +2348,9 @@ const ItemTree = ({
|
|
|
2247
2348
|
className: appendClassNames(className, "humany-item-tree")
|
|
2248
2349
|
}, rootItem && rootItem(!hasSelectedChildren(tree || [])), tree && renderTreeItems(tree, 1));
|
|
2249
2350
|
};
|
|
2250
|
-
|
|
2251
|
-
var _A = _z, {
|
|
2252
|
-
|
|
2253
|
-
duration = 500,
|
|
2254
|
-
children,
|
|
2255
|
-
onClick = () => {
|
|
2256
|
-
}
|
|
2257
|
-
} = _A, other = __objRest(_A, [
|
|
2258
|
-
"visible",
|
|
2259
|
-
"duration",
|
|
2260
|
-
"children",
|
|
2261
|
-
"onClick"
|
|
2262
|
-
]);
|
|
2263
|
-
const ref = useRef();
|
|
2264
|
-
const onOverlayClick = useCallback((e) => {
|
|
2265
|
-
if (e.target === ref.current) {
|
|
2266
|
-
onClick(e);
|
|
2267
|
-
}
|
|
2268
|
-
}, [onClick]);
|
|
2269
|
-
return /* @__PURE__ */ React.createElement(CSSTransition, {
|
|
2270
|
-
in: visible,
|
|
2271
|
-
className: "humany-overlay-transition",
|
|
2272
|
-
classNames: "humany-overlay-transition",
|
|
2273
|
-
unmountOnExit: true,
|
|
2274
|
-
timeout: duration
|
|
2275
|
-
}, /* @__PURE__ */ React.createElement(Portal, null, /* @__PURE__ */ React.createElement(Wrapper$3, __spreadValues({
|
|
2276
|
-
className: "humany-overlay",
|
|
2277
|
-
duration,
|
|
2278
|
-
ref,
|
|
2279
|
-
onClick: onOverlayClick
|
|
2280
|
-
}, other), children)));
|
|
2281
|
-
};
|
|
2282
|
-
const Wrapper$3 = styled.div`
|
|
2283
|
-
background: rgba(0, 0, 0, 0.6);
|
|
2284
|
-
min-width: 100%;
|
|
2285
|
-
min-height: 100%;
|
|
2286
|
-
position: fixed;
|
|
2287
|
-
top: 0;
|
|
2288
|
-
bottom: 0;
|
|
2289
|
-
right: 0;
|
|
2290
|
-
left: 0;
|
|
2291
|
-
display: flex;
|
|
2292
|
-
justify-content: center;
|
|
2293
|
-
align-items: center;
|
|
2294
|
-
z-index: 7;
|
|
2295
|
-
|
|
2296
|
-
transition: ${(p) => p.duration}ms;
|
|
2297
|
-
opacity: 0;
|
|
2298
|
-
|
|
2299
|
-
&.humany-overlay-transition-enter {
|
|
2300
|
-
opacity: 0.1;
|
|
2301
|
-
}
|
|
2302
|
-
&.humany-overlay-transition-enter-active,
|
|
2303
|
-
&.humany-overlay-transition-enter-done,
|
|
2304
|
-
&.humany-overlay-transition-exit {
|
|
2305
|
-
opacity: 1;
|
|
2306
|
-
}
|
|
2307
|
-
|
|
2308
|
-
&.humany-overlay-transition-exit-active,
|
|
2309
|
-
&.humany-overlay-transition-exit-done {
|
|
2310
|
-
opacity: 0;
|
|
2311
|
-
}
|
|
2312
|
-
`;
|
|
2313
|
-
const Lightbox = ({ attrs }) => {
|
|
2314
|
-
const [visible, toggleVisible] = useToggle(false);
|
|
2315
|
-
const esc = useKeyPress("Escape");
|
|
2316
|
-
useEffect(() => {
|
|
2317
|
-
if (esc) {
|
|
2318
|
-
toggleVisible(false);
|
|
2319
|
-
}
|
|
2320
|
-
}, [esc]);
|
|
2321
|
-
const overlayClick = useCallback((e) => {
|
|
2322
|
-
toggleVisible(false);
|
|
2323
|
-
}, [toggleVisible]);
|
|
2324
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Overlay, {
|
|
2325
|
-
visible,
|
|
2326
|
-
onClick: overlayClick
|
|
2327
|
-
}, /* @__PURE__ */ React.createElement(CloseButton, {
|
|
2328
|
-
onClick: () => toggleVisible(false)
|
|
2329
|
-
}, /* @__PURE__ */ React.createElement(StyledSymbolBadge, {
|
|
2330
|
-
size: 24,
|
|
2331
|
-
symbol: { type: "Svg", content: "close" }
|
|
2332
|
-
})), /* @__PURE__ */ React.createElement(Content$1, null, /* @__PURE__ */ React.createElement("img", __spreadValues({}, attrs)))), /* @__PURE__ */ React.createElement("a", {
|
|
2333
|
-
onClick: () => toggleVisible()
|
|
2334
|
-
}, /* @__PURE__ */ React.createElement(Thumbnail, __spreadValues({}, attrs))));
|
|
2335
|
-
};
|
|
2336
|
-
const Content$1 = styled.div`
|
|
2337
|
-
padding: ${(p) => {
|
|
2338
|
-
var _a;
|
|
2339
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
2340
|
-
}};
|
|
2341
|
-
max-width: 80%;
|
|
2342
|
-
max-height: 80%;
|
|
2343
|
-
|
|
2344
|
-
img {
|
|
2345
|
-
width: auto !important;
|
|
2346
|
-
height: auto !important;
|
|
2347
|
-
max-width: 100%;
|
|
2348
|
-
max-height: 100%;
|
|
2349
|
-
}
|
|
2350
|
-
`;
|
|
2351
|
-
const CloseButton = styled(Button)`
|
|
2352
|
-
position: fixed;
|
|
2353
|
-
top: 50px;
|
|
2354
|
-
right: 50px;
|
|
2355
|
-
transition: opacity 300ms ease-in-out;
|
|
2356
|
-
opacity: 0.7;
|
|
2357
|
-
|
|
2358
|
-
&:hover {
|
|
2359
|
-
opacity: 1;
|
|
2360
|
-
}
|
|
2361
|
-
`;
|
|
2362
|
-
const StyledSymbolBadge = styled(SymbolBadge)`
|
|
2363
|
-
path {
|
|
2364
|
-
stroke: #ffffff;
|
|
2365
|
-
}
|
|
2366
|
-
`;
|
|
2367
|
-
const Thumbnail = styled.img`
|
|
2368
|
-
cursor: pointer;
|
|
2369
|
-
`;
|
|
2370
|
-
var RouteLink = forwardRef((_B, forwardedRef) => {
|
|
2371
|
-
var _C = _B, { className, onClick = () => {
|
|
2372
|
-
}, name = "", to = "", params = {}, children } = _C, other = __objRest(_C, ["className", "onClick", "name", "to", "params", "children"]);
|
|
2351
|
+
var RouteLink = forwardRef((_z, forwardedRef) => {
|
|
2352
|
+
var _A = _z, { className, onClick = () => {
|
|
2353
|
+
}, name = "", to = "", params = {}, children } = _A, other = __objRest(_A, ["className", "onClick", "name", "to", "params", "children"]);
|
|
2373
2354
|
const router = useRouter();
|
|
2374
2355
|
const container = useContainer();
|
|
2375
2356
|
if (!router) {
|
|
@@ -2425,8 +2406,8 @@ var RouteLink = forwardRef((_B, forwardedRef) => {
|
|
|
2425
2406
|
to: path
|
|
2426
2407
|
}), children);
|
|
2427
2408
|
});
|
|
2428
|
-
var Link = forwardRef((
|
|
2429
|
-
var
|
|
2409
|
+
var Link = forwardRef((_B, ref) => {
|
|
2410
|
+
var _C = _B, {
|
|
2430
2411
|
className,
|
|
2431
2412
|
disabled = false,
|
|
2432
2413
|
role = "link",
|
|
@@ -2441,7 +2422,7 @@ var Link = forwardRef((_D, ref) => {
|
|
|
2441
2422
|
target,
|
|
2442
2423
|
routeName,
|
|
2443
2424
|
params
|
|
2444
|
-
} =
|
|
2425
|
+
} = _C, other = __objRest(_C, [
|
|
2445
2426
|
"className",
|
|
2446
2427
|
"disabled",
|
|
2447
2428
|
"role",
|
|
@@ -2504,9 +2485,624 @@ const StyledLink = styled.a`
|
|
|
2504
2485
|
opacity: .7;
|
|
2505
2486
|
` : "cursor: pointer;"}
|
|
2506
2487
|
`;
|
|
2507
|
-
const
|
|
2508
|
-
var
|
|
2509
|
-
|
|
2488
|
+
const Overlay = (_D) => {
|
|
2489
|
+
var _E = _D, {
|
|
2490
|
+
visible,
|
|
2491
|
+
duration = 500,
|
|
2492
|
+
children,
|
|
2493
|
+
onClick = () => {
|
|
2494
|
+
}
|
|
2495
|
+
} = _E, other = __objRest(_E, [
|
|
2496
|
+
"visible",
|
|
2497
|
+
"duration",
|
|
2498
|
+
"children",
|
|
2499
|
+
"onClick"
|
|
2500
|
+
]);
|
|
2501
|
+
const ref = useRef();
|
|
2502
|
+
const onOverlayClick = useCallback((e) => {
|
|
2503
|
+
if (e.target === ref.current) {
|
|
2504
|
+
onClick(e);
|
|
2505
|
+
}
|
|
2506
|
+
}, [onClick]);
|
|
2507
|
+
return /* @__PURE__ */ React.createElement(CSSTransition, {
|
|
2508
|
+
in: visible,
|
|
2509
|
+
className: "humany-overlay-transition",
|
|
2510
|
+
classNames: "humany-overlay-transition",
|
|
2511
|
+
unmountOnExit: true,
|
|
2512
|
+
timeout: duration
|
|
2513
|
+
}, /* @__PURE__ */ React.createElement(Portal, null, /* @__PURE__ */ React.createElement(Wrapper$4, __spreadValues({
|
|
2514
|
+
className: "humany-overlay",
|
|
2515
|
+
duration,
|
|
2516
|
+
ref,
|
|
2517
|
+
onClick: onOverlayClick
|
|
2518
|
+
}, other), children)));
|
|
2519
|
+
};
|
|
2520
|
+
const Wrapper$4 = styled.div`
|
|
2521
|
+
background: rgba(0, 0, 0, 0.6);
|
|
2522
|
+
min-width: 100%;
|
|
2523
|
+
min-height: 100%;
|
|
2524
|
+
position: fixed;
|
|
2525
|
+
top: 0;
|
|
2526
|
+
bottom: 0;
|
|
2527
|
+
right: 0;
|
|
2528
|
+
left: 0;
|
|
2529
|
+
display: flex;
|
|
2530
|
+
justify-content: center;
|
|
2531
|
+
align-items: center;
|
|
2532
|
+
z-index: 7;
|
|
2533
|
+
|
|
2534
|
+
transition: ${(p) => p.duration}ms;
|
|
2535
|
+
opacity: 0;
|
|
2536
|
+
|
|
2537
|
+
&.humany-overlay-transition-enter {
|
|
2538
|
+
opacity: 0.1;
|
|
2539
|
+
}
|
|
2540
|
+
&.humany-overlay-transition-enter-active,
|
|
2541
|
+
&.humany-overlay-transition-enter-done,
|
|
2542
|
+
&.humany-overlay-transition-exit {
|
|
2543
|
+
opacity: 1;
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2546
|
+
&.humany-overlay-transition-exit-active,
|
|
2547
|
+
&.humany-overlay-transition-exit-done {
|
|
2548
|
+
opacity: 0;
|
|
2549
|
+
}
|
|
2550
|
+
`;
|
|
2551
|
+
const spin = keyframes`
|
|
2552
|
+
100% {
|
|
2553
|
+
transform: rotate(360deg);
|
|
2554
|
+
}
|
|
2555
|
+
`;
|
|
2556
|
+
const dash = keyframes`
|
|
2557
|
+
0% {
|
|
2558
|
+
stroke-dasharray: 1, 200;
|
|
2559
|
+
stroke-dashoffset: 0;
|
|
2560
|
+
}
|
|
2561
|
+
50% {
|
|
2562
|
+
stroke-dasharray: 89, 200;
|
|
2563
|
+
stroke-dashoffset: -35px;
|
|
2564
|
+
}
|
|
2565
|
+
100% {
|
|
2566
|
+
stroke-dasharray: 89, 200;
|
|
2567
|
+
stroke-dashoffset: -124px;
|
|
2568
|
+
}
|
|
2569
|
+
`;
|
|
2570
|
+
const SpinnerSvg = styled.svg`
|
|
2571
|
+
animation: ${spin} 2s linear infinite;
|
|
2572
|
+
height: 100%;
|
|
2573
|
+
transform-origin: center center;
|
|
2574
|
+
width: 100%;
|
|
2575
|
+
position: absolute;
|
|
2576
|
+
top: 0;
|
|
2577
|
+
bottom: 0;
|
|
2578
|
+
left: 0;
|
|
2579
|
+
right: 0;
|
|
2580
|
+
margin: auto;
|
|
2581
|
+
transition: 200ms ease-out opacity;
|
|
2582
|
+
`;
|
|
2583
|
+
const Wrapper$3 = styled.div`
|
|
2584
|
+
position: absolute;
|
|
2585
|
+
top: 0;
|
|
2586
|
+
bottom: 0;
|
|
2587
|
+
left: 0;
|
|
2588
|
+
right: 0;
|
|
2589
|
+
height: 100%;
|
|
2590
|
+
width: 100%;
|
|
2591
|
+
pointer-events: ${(p) => p["data-loading"] ? "all" : "none"}
|
|
2592
|
+
display: flex;
|
|
2593
|
+
flex-direction: column;
|
|
2594
|
+
justify-content: center;
|
|
2595
|
+
transition: 200ms ease-out opacity;
|
|
2596
|
+
box-sizing: border-box;
|
|
2597
|
+
overflow: hidden;
|
|
2598
|
+
${SpinnerSvg} {
|
|
2599
|
+
opacity: ${(p) => p["data-loading"] ? "1" : "0"}
|
|
2600
|
+
}
|
|
2601
|
+
`;
|
|
2602
|
+
const Spinner = styled.div`
|
|
2603
|
+
position: relative;
|
|
2604
|
+
margin: 0 auto;
|
|
2605
|
+
width: 100px;
|
|
2606
|
+
&:before {
|
|
2607
|
+
content: '';
|
|
2608
|
+
display: block;
|
|
2609
|
+
padding-top: 100%;
|
|
2610
|
+
}
|
|
2611
|
+
`;
|
|
2612
|
+
const SpinnerCircle = styled.circle`
|
|
2613
|
+
stroke-dasharray: 1, 200;
|
|
2614
|
+
stroke-dashoffset: 0;
|
|
2615
|
+
animation: ${dash} 1.5s ease-in-out infinite;
|
|
2616
|
+
stroke-linecap: round;
|
|
2617
|
+
stroke: ${(p) => {
|
|
2618
|
+
var _a;
|
|
2619
|
+
return (_a = p.theme.colors) == null ? void 0 : _a.primary;
|
|
2620
|
+
}};
|
|
2621
|
+
stroke-width: 2px;
|
|
2622
|
+
`;
|
|
2623
|
+
const Loader = ({ className, loading = false }) => {
|
|
2624
|
+
return /* @__PURE__ */ React.createElement(Wrapper$3, {
|
|
2625
|
+
className: appendClassNames("humany-loader", className),
|
|
2626
|
+
"data-loading": loading
|
|
2627
|
+
}, /* @__PURE__ */ React.createElement(Spinner, {
|
|
2628
|
+
className: "humany-spinner"
|
|
2629
|
+
}, /* @__PURE__ */ React.createElement(SpinnerSvg, {
|
|
2630
|
+
viewBox: "25 25 50 50"
|
|
2631
|
+
}, /* @__PURE__ */ React.createElement(SpinnerCircle, {
|
|
2632
|
+
cx: "50",
|
|
2633
|
+
cy: "50",
|
|
2634
|
+
r: "20",
|
|
2635
|
+
fill: "none",
|
|
2636
|
+
"stroke-width": "2",
|
|
2637
|
+
"stroke-miterlimit": "10"
|
|
2638
|
+
}))));
|
|
2639
|
+
};
|
|
2640
|
+
const ZoomImg = (_F) => {
|
|
2641
|
+
var _G = _F, { zoomState, src } = _G, attrs = __objRest(_G, ["zoomState", "src"]);
|
|
2642
|
+
var _b;
|
|
2643
|
+
const ref = useRef(null);
|
|
2644
|
+
const [loaded, setLoaded] = useState(false);
|
|
2645
|
+
const _a = attrs.style || {}, { width, height } = _a, restStyle = __objRest(_a, ["width", "height"]);
|
|
2646
|
+
const imageSize = useMemo(() => {
|
|
2647
|
+
const img = ref.current;
|
|
2648
|
+
if (img) {
|
|
2649
|
+
if (img.width >= img.height) {
|
|
2650
|
+
return [`${zoomState}vw`, "auto"];
|
|
2651
|
+
} else {
|
|
2652
|
+
return ["auto", `${zoomState}vh`];
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
return null;
|
|
2656
|
+
}, [zoomState, ref, loaded, src]);
|
|
2657
|
+
useEffect(() => {
|
|
2658
|
+
setLoaded(false);
|
|
2659
|
+
}, [src]);
|
|
2660
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(StyledLoader, {
|
|
2661
|
+
loading: !loaded
|
|
2662
|
+
}), /* @__PURE__ */ React.createElement(Img, __spreadProps(__spreadValues({
|
|
2663
|
+
onLoad: () => {
|
|
2664
|
+
setLoaded(true);
|
|
2665
|
+
},
|
|
2666
|
+
ref,
|
|
2667
|
+
imageSize,
|
|
2668
|
+
draggable: "false"
|
|
2669
|
+
}, attrs), {
|
|
2670
|
+
alt: ((_b = attrs.alt) == null ? void 0 : _b.toString()) || "",
|
|
2671
|
+
style: restStyle,
|
|
2672
|
+
src,
|
|
2673
|
+
loaded
|
|
2674
|
+
})), /* @__PURE__ */ React.createElement(EmptyDiv, null));
|
|
2675
|
+
};
|
|
2676
|
+
const StyledLoader = styled(Loader)`
|
|
2677
|
+
svg circle {
|
|
2678
|
+
stroke: #ffffff;
|
|
2679
|
+
}
|
|
2680
|
+
`;
|
|
2681
|
+
const Img = styled.img`
|
|
2682
|
+
transform: none;
|
|
2683
|
+
|
|
2684
|
+
${(props) => props.imageSize && css`
|
|
2685
|
+
width: ${props.imageSize[0]};
|
|
2686
|
+
height: ${props.imageSize[1]};
|
|
2687
|
+
display: inline-block;
|
|
2688
|
+
`}
|
|
2689
|
+
vertical-align: middle;
|
|
2690
|
+
position: relative;
|
|
2691
|
+
${(props) => !props.loaded && "display:none;"}
|
|
2692
|
+
`;
|
|
2693
|
+
const EmptyDiv = styled.div`
|
|
2694
|
+
height: 100%;
|
|
2695
|
+
display: inline-block;
|
|
2696
|
+
vertical-align: middle;
|
|
2697
|
+
`;
|
|
2698
|
+
const useFadeOut = () => {
|
|
2699
|
+
const timeOut = useRef();
|
|
2700
|
+
const [show, setShow] = useState(true);
|
|
2701
|
+
const triggerChange = useCallback(() => {
|
|
2702
|
+
if (!show)
|
|
2703
|
+
setShow(true);
|
|
2704
|
+
if (timeOut.current) {
|
|
2705
|
+
clearTimeout(timeOut.current);
|
|
2706
|
+
}
|
|
2707
|
+
timeOut.current = setTimeout(() => {
|
|
2708
|
+
setShow(false);
|
|
2709
|
+
}, 3e3);
|
|
2710
|
+
return () => {
|
|
2711
|
+
if (timeOut.current) {
|
|
2712
|
+
clearTimeout(timeOut.current);
|
|
2713
|
+
}
|
|
2714
|
+
};
|
|
2715
|
+
}, [show, timeOut]);
|
|
2716
|
+
return [show, triggerChange];
|
|
2717
|
+
};
|
|
2718
|
+
const Lightbox = ({ attrs, htmlBody }) => {
|
|
2719
|
+
var _a;
|
|
2720
|
+
const esc = useKeyPress("Escape");
|
|
2721
|
+
const [zoomState, setZoomState] = useState(80);
|
|
2722
|
+
const [scroll, setScroll] = useState({ top: 0, left: 0, x: 0, y: 0 });
|
|
2723
|
+
const [scrolling, setScrolling] = useState(false);
|
|
2724
|
+
const [show, triggerFadeOut] = useFadeOut();
|
|
2725
|
+
const [openImage, setOpenImage] = useState(null);
|
|
2726
|
+
const imageLinkRef = useRef(null);
|
|
2727
|
+
const topButtonsRef = useRef(null);
|
|
2728
|
+
const contentRef = useRef(null);
|
|
2729
|
+
useEffect(() => {
|
|
2730
|
+
if (esc) {
|
|
2731
|
+
setOpenImage(null);
|
|
2732
|
+
}
|
|
2733
|
+
}, [esc]);
|
|
2734
|
+
useEffect(() => {
|
|
2735
|
+
setZoomState(80);
|
|
2736
|
+
}, [openImage]);
|
|
2737
|
+
useEffect(() => {
|
|
2738
|
+
if (openImage === null || topButtonsRef.current === null) {
|
|
2739
|
+
return;
|
|
2740
|
+
}
|
|
2741
|
+
const firstButton = topButtonsRef.current.firstElementChild;
|
|
2742
|
+
if (!firstButton) {
|
|
2743
|
+
return;
|
|
2744
|
+
}
|
|
2745
|
+
firstButton.focus();
|
|
2746
|
+
}, [openImage, topButtonsRef]);
|
|
2747
|
+
useEffect(() => {
|
|
2748
|
+
if (openImage !== null || imageLinkRef.current === null) {
|
|
2749
|
+
return;
|
|
2750
|
+
}
|
|
2751
|
+
imageLinkRef.current.focus();
|
|
2752
|
+
}, [openImage, imageLinkRef]);
|
|
2753
|
+
const imageList = useMemo(() => {
|
|
2754
|
+
const div = document.createElement("div");
|
|
2755
|
+
div.innerHTML = htmlBody || "";
|
|
2756
|
+
const images = div.getElementsByTagName("img");
|
|
2757
|
+
const list2 = Array.from(images).reduce((acc, imgElement) => {
|
|
2758
|
+
const src = imgElement.getAttribute("src");
|
|
2759
|
+
if (src) {
|
|
2760
|
+
acc.push(src);
|
|
2761
|
+
}
|
|
2762
|
+
return acc;
|
|
2763
|
+
}, []);
|
|
2764
|
+
return list2;
|
|
2765
|
+
}, [htmlBody]);
|
|
2766
|
+
const toggleVisible = useCallback(() => {
|
|
2767
|
+
const { src } = attrs;
|
|
2768
|
+
if (src) {
|
|
2769
|
+
const position = imageList.indexOf(src);
|
|
2770
|
+
setOpenImage(position);
|
|
2771
|
+
}
|
|
2772
|
+
}, [imageList, attrs]);
|
|
2773
|
+
const overlayClick = useCallback((e) => {
|
|
2774
|
+
setOpenImage(null);
|
|
2775
|
+
}, [toggleVisible]);
|
|
2776
|
+
const changeZoomState = useCallback((zoomIn) => {
|
|
2777
|
+
if (zoomIn) {
|
|
2778
|
+
setZoomState(zoomState + 10);
|
|
2779
|
+
} else {
|
|
2780
|
+
setZoomState(zoomState - 10);
|
|
2781
|
+
}
|
|
2782
|
+
}, [setZoomState, zoomState]);
|
|
2783
|
+
const downloadImage = useCallback(() => {
|
|
2784
|
+
const { src } = attrs;
|
|
2785
|
+
if (src) {
|
|
2786
|
+
window.open(src, "_blank");
|
|
2787
|
+
}
|
|
2788
|
+
}, [attrs]);
|
|
2789
|
+
const mouseDownHandler = useCallback((e) => {
|
|
2790
|
+
const ele = contentRef.current;
|
|
2791
|
+
if (ele) {
|
|
2792
|
+
setScroll({ top: ele.scrollTop, left: ele.scrollLeft, x: e.clientX, y: e.clientY });
|
|
2793
|
+
setScrolling(true);
|
|
2794
|
+
}
|
|
2795
|
+
}, [contentRef]);
|
|
2796
|
+
const mouseDragHandler = useCallback((e) => {
|
|
2797
|
+
const ele = contentRef.current;
|
|
2798
|
+
if (ele && scrolling) {
|
|
2799
|
+
const dx = e.clientX - scroll.x;
|
|
2800
|
+
const dy = e.clientY - scroll.y;
|
|
2801
|
+
ele.scrollTop = scroll.top - dy;
|
|
2802
|
+
ele.scrollLeft = scroll.left - dx;
|
|
2803
|
+
}
|
|
2804
|
+
}, [scrolling, scroll]);
|
|
2805
|
+
const mouseStopDragHandler = (e) => {
|
|
2806
|
+
e.preventDefault();
|
|
2807
|
+
setScrolling(false);
|
|
2808
|
+
};
|
|
2809
|
+
const isDraggable = useMemo(() => {
|
|
2810
|
+
if (contentRef.current) {
|
|
2811
|
+
const imageElements = contentRef.current.getElementsByTagName("img");
|
|
2812
|
+
if (imageElements && imageElements.length) {
|
|
2813
|
+
const imgElement = imageElements[0];
|
|
2814
|
+
return imgElement.width > window.innerWidth || imgElement.height > window.innerHeight;
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
return false;
|
|
2818
|
+
}, [contentRef, zoomState]);
|
|
2819
|
+
const navLeft = () => {
|
|
2820
|
+
if (openImage !== null)
|
|
2821
|
+
setOpenImage(openImage - 1);
|
|
2822
|
+
};
|
|
2823
|
+
const navRight = () => {
|
|
2824
|
+
if (openImage !== null)
|
|
2825
|
+
setOpenImage(openImage + 1);
|
|
2826
|
+
};
|
|
2827
|
+
const canNavigateLeft = openImage !== null && openImage > 0 && imageList.length > 1;
|
|
2828
|
+
const canNavigateRight = openImage !== null && imageList.length - 1 > openImage;
|
|
2829
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Overlay, {
|
|
2830
|
+
visible: openImage !== null,
|
|
2831
|
+
onClick: overlayClick
|
|
2832
|
+
}, /* @__PURE__ */ React.createElement(DraggableArea, {
|
|
2833
|
+
onMouseDown: () => triggerFadeOut(),
|
|
2834
|
+
onMouseMove: () => triggerFadeOut(),
|
|
2835
|
+
onTouchStart: () => triggerFadeOut(),
|
|
2836
|
+
onKeyDown: () => triggerFadeOut()
|
|
2837
|
+
}, /* @__PURE__ */ React.createElement(TransparentBarTop, {
|
|
2838
|
+
show: show.toString()
|
|
2839
|
+
}, /* @__PURE__ */ React.createElement(TopRightButtons, {
|
|
2840
|
+
ref: topButtonsRef,
|
|
2841
|
+
buttons: [
|
|
2842
|
+
{
|
|
2843
|
+
id: "download",
|
|
2844
|
+
onClick: downloadImage,
|
|
2845
|
+
icon: "download"
|
|
2846
|
+
},
|
|
2847
|
+
{
|
|
2848
|
+
id: "lightbox-close",
|
|
2849
|
+
onClick: () => setOpenImage(null),
|
|
2850
|
+
icon: "lightbox-close"
|
|
2851
|
+
}
|
|
2852
|
+
]
|
|
2853
|
+
})), /* @__PURE__ */ React.createElement(Content$1, {
|
|
2854
|
+
scrolling: scrolling.toString(),
|
|
2855
|
+
isDraggable: isDraggable.toString(),
|
|
2856
|
+
ref: contentRef,
|
|
2857
|
+
onMouseMove: mouseDragHandler,
|
|
2858
|
+
onMouseDown: mouseDownHandler,
|
|
2859
|
+
onMouseUp: mouseStopDragHandler
|
|
2860
|
+
}, openImage !== null && /* @__PURE__ */ React.createElement(ZoomImg, __spreadProps(__spreadValues({
|
|
2861
|
+
zoomState
|
|
2862
|
+
}, attrs), {
|
|
2863
|
+
src: imageList[openImage]
|
|
2864
|
+
}))), /* @__PURE__ */ React.createElement(CenterEdgeButtons, {
|
|
2865
|
+
show: show.toString(),
|
|
2866
|
+
buttons: [
|
|
2867
|
+
{
|
|
2868
|
+
id: "previous",
|
|
2869
|
+
onClick: navLeft,
|
|
2870
|
+
icon: "caret-left",
|
|
2871
|
+
circle: true,
|
|
2872
|
+
show: canNavigateLeft
|
|
2873
|
+
},
|
|
2874
|
+
{
|
|
2875
|
+
id: "next",
|
|
2876
|
+
onClick: navRight,
|
|
2877
|
+
icon: "caret-right",
|
|
2878
|
+
circle: true,
|
|
2879
|
+
show: canNavigateRight
|
|
2880
|
+
}
|
|
2881
|
+
]
|
|
2882
|
+
}), /* @__PURE__ */ React.createElement(TransparentBarBottom, {
|
|
2883
|
+
show: show.toString()
|
|
2884
|
+
}, /* @__PURE__ */ React.createElement(BottomCenterButtons, {
|
|
2885
|
+
buttons: [
|
|
2886
|
+
{
|
|
2887
|
+
id: "zoom-out",
|
|
2888
|
+
onClick: () => changeZoomState(false),
|
|
2889
|
+
icon: "zoom-out"
|
|
2890
|
+
},
|
|
2891
|
+
{
|
|
2892
|
+
id: "zoom-in",
|
|
2893
|
+
onClick: () => changeZoomState(true),
|
|
2894
|
+
icon: "zoom-in"
|
|
2895
|
+
}
|
|
2896
|
+
]
|
|
2897
|
+
}), /* @__PURE__ */ React.createElement(ZoomLevel, {
|
|
2898
|
+
variant: "span"
|
|
2899
|
+
}, zoomState, "%")))), /* @__PURE__ */ React.createElement(Link, {
|
|
2900
|
+
ref: imageLinkRef,
|
|
2901
|
+
onClick: toggleVisible,
|
|
2902
|
+
onKeyDown: (e) => {
|
|
2903
|
+
if (e.key !== "Enter") {
|
|
2904
|
+
return;
|
|
2905
|
+
}
|
|
2906
|
+
e.preventDefault();
|
|
2907
|
+
toggleVisible();
|
|
2908
|
+
},
|
|
2909
|
+
tabIndex: 0
|
|
2910
|
+
}, /* @__PURE__ */ React.createElement(Thumbnail, __spreadProps(__spreadValues({}, attrs), {
|
|
2911
|
+
alt: ((_a = attrs.alt) == null ? void 0 : _a.toString()) || ""
|
|
2912
|
+
}))));
|
|
2913
|
+
};
|
|
2914
|
+
const ButtonSet = forwardRef(({ show = "true", buttons, className }, ref) => {
|
|
2915
|
+
return /* @__PURE__ */ React.createElement(ButtonSetWrapper, {
|
|
2916
|
+
ref,
|
|
2917
|
+
show,
|
|
2918
|
+
className: appendClassNames("humany-button-set", className)
|
|
2919
|
+
}, buttons.map(({ id, circle = false, show: show2 = true, onClick, icon }, index) => /* @__PURE__ */ React.createElement(ButtonSetButton, {
|
|
2920
|
+
key: id + index.toString(),
|
|
2921
|
+
circle: circle.toString(),
|
|
2922
|
+
onClick,
|
|
2923
|
+
tabIndex: !show2 ? -1 : void 0,
|
|
2924
|
+
show: show2.toString(),
|
|
2925
|
+
icon
|
|
2926
|
+
}, /* @__PURE__ */ React.createElement(SymbolBadge, {
|
|
2927
|
+
size: 24,
|
|
2928
|
+
symbol: { type: "Svg", content: icon }
|
|
2929
|
+
}))));
|
|
2930
|
+
});
|
|
2931
|
+
const FadingDiv = styled.div`
|
|
2932
|
+
transition: opacity 0.3s ease 0s;
|
|
2933
|
+
z-index: 5;
|
|
2934
|
+
${(p) => p.show === "true" ? "opacity: 1;" : css`
|
|
2935
|
+
opacity: 0;
|
|
2936
|
+
pointer-events: none;
|
|
2937
|
+
`}
|
|
2938
|
+
`;
|
|
2939
|
+
const ButtonSetWrapper = styled(FadingDiv)`
|
|
2940
|
+
position: fixed;
|
|
2941
|
+
display: flex;
|
|
2942
|
+
gap: ${(p) => {
|
|
2943
|
+
var _a;
|
|
2944
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
2945
|
+
}};
|
|
2946
|
+
`;
|
|
2947
|
+
const BUTTON_SIZE = "39px";
|
|
2948
|
+
const ButtonSetButton = styled(Button)`
|
|
2949
|
+
width: ${BUTTON_SIZE};
|
|
2950
|
+
height: ${BUTTON_SIZE};
|
|
2951
|
+
display: flex;
|
|
2952
|
+
justify-content: center;
|
|
2953
|
+
align-items: center;
|
|
2954
|
+
|
|
2955
|
+
${(p) => p.icon === "caret-left" && css`
|
|
2956
|
+
svg {
|
|
2957
|
+
position: relative;
|
|
2958
|
+
left: -2px;
|
|
2959
|
+
}
|
|
2960
|
+
`}
|
|
2961
|
+
|
|
2962
|
+
${(p) => {
|
|
2963
|
+
var _a, _b, _c;
|
|
2964
|
+
return p.circle === "true" ? css`
|
|
2965
|
+
background-color: #ffffff;
|
|
2966
|
+
border-radius: 50%;
|
|
2967
|
+
|
|
2968
|
+
svg {
|
|
2969
|
+
path,
|
|
2970
|
+
line {
|
|
2971
|
+
stroke: ${(_a = p.theme.colors) == null ? void 0 : _a.text};
|
|
2972
|
+
}
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2975
|
+
&:focus {
|
|
2976
|
+
${((_b = p.theme.accessibility) == null ? void 0 : _b.isTabbing) && css`
|
|
2977
|
+
${borderTabStyle}
|
|
2978
|
+
outline-color: #ffffff;
|
|
2979
|
+
background-color: transparent;
|
|
2980
|
+
|
|
2981
|
+
svg {
|
|
2982
|
+
path,
|
|
2983
|
+
line {
|
|
2984
|
+
stroke: #ffffff;
|
|
2985
|
+
}
|
|
2986
|
+
}
|
|
2987
|
+
`}
|
|
2988
|
+
}
|
|
2989
|
+
` : css`
|
|
2990
|
+
svg {
|
|
2991
|
+
path,
|
|
2992
|
+
line {
|
|
2993
|
+
stroke: #ffffff;
|
|
2994
|
+
}
|
|
2995
|
+
}
|
|
2996
|
+
&:focus {
|
|
2997
|
+
${((_c = p.theme.accessibility) == null ? void 0 : _c.isTabbing) && borderTabStyle};
|
|
2998
|
+
outline-color: #ffffff;
|
|
2999
|
+
}
|
|
3000
|
+
`;
|
|
3001
|
+
}}
|
|
3002
|
+
|
|
3003
|
+
${(p) => p.show === "true" ? css`
|
|
3004
|
+
opacity: 0.8;
|
|
3005
|
+
transition: opacity 0.3s ease 0s;
|
|
3006
|
+
&:hover {
|
|
3007
|
+
opacity: 1;
|
|
3008
|
+
}
|
|
3009
|
+
` : css`
|
|
3010
|
+
opacity: 0;
|
|
3011
|
+
pointer-events: none;
|
|
3012
|
+
`}
|
|
3013
|
+
`;
|
|
3014
|
+
const TopRightButtons = styled(ButtonSet)`
|
|
3015
|
+
top: ${(p) => {
|
|
3016
|
+
var _a;
|
|
3017
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.large;
|
|
3018
|
+
}};
|
|
3019
|
+
right: ${(p) => {
|
|
3020
|
+
var _a;
|
|
3021
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.large;
|
|
3022
|
+
}};
|
|
3023
|
+
`;
|
|
3024
|
+
const BottomCenterButtons = styled(ButtonSet)`
|
|
3025
|
+
bottom: ${(p) => {
|
|
3026
|
+
var _a;
|
|
3027
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.large;
|
|
3028
|
+
}};
|
|
3029
|
+
width: 100%;
|
|
3030
|
+
align-items: center;
|
|
3031
|
+
justify-content: center;
|
|
3032
|
+
`;
|
|
3033
|
+
const CenterEdgeButtons = styled(ButtonSet)`
|
|
3034
|
+
display: block;
|
|
3035
|
+
button {
|
|
3036
|
+
position: fixed;
|
|
3037
|
+
top: calc(50% - calc(${BUTTON_SIZE} / 2));
|
|
3038
|
+
&:first-child {
|
|
3039
|
+
left: ${(p) => {
|
|
3040
|
+
var _a;
|
|
3041
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.large;
|
|
3042
|
+
}};
|
|
3043
|
+
}
|
|
3044
|
+
&:last-child {
|
|
3045
|
+
right: ${(p) => {
|
|
3046
|
+
var _a;
|
|
3047
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.large;
|
|
3048
|
+
}};
|
|
3049
|
+
}
|
|
3050
|
+
}
|
|
3051
|
+
`;
|
|
3052
|
+
const ZoomLevel = styled(Typography)`
|
|
3053
|
+
position: fixed;
|
|
3054
|
+
bottom: ${(p) => {
|
|
3055
|
+
var _a;
|
|
3056
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.large;
|
|
3057
|
+
}};
|
|
3058
|
+
right: ${(p) => {
|
|
3059
|
+
var _a;
|
|
3060
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.large;
|
|
3061
|
+
}};
|
|
3062
|
+
color: #ffffff;
|
|
3063
|
+
font-size: ${(p) => {
|
|
3064
|
+
var _a;
|
|
3065
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.medium;
|
|
3066
|
+
}};
|
|
3067
|
+
font-family: ${(p) => {
|
|
3068
|
+
var _a;
|
|
3069
|
+
return (_a = p.theme.fonts) == null ? void 0 : _a.type;
|
|
3070
|
+
}};
|
|
3071
|
+
`;
|
|
3072
|
+
const TransparentBar = styled(FadingDiv)`
|
|
3073
|
+
position: absolute;
|
|
3074
|
+
width: 100vw;
|
|
3075
|
+
height: 88px;
|
|
3076
|
+
left: 0px;
|
|
3077
|
+
z-index: 5;
|
|
3078
|
+
`;
|
|
3079
|
+
const DraggableArea = styled.div`
|
|
3080
|
+
width: 100%;
|
|
3081
|
+
`;
|
|
3082
|
+
const TransparentBarTop = styled(TransparentBar)`
|
|
3083
|
+
top: 0px;
|
|
3084
|
+
background-image: linear-gradient(to bottom, rgb(34, 34, 34, 0.8), rgba(34, 34, 34, 0));
|
|
3085
|
+
`;
|
|
3086
|
+
const TransparentBarBottom = styled(TransparentBar)`
|
|
3087
|
+
bottom: 0px;
|
|
3088
|
+
background-image: linear-gradient(to top, rgb(34, 34, 34, 0.8), rgba(34, 34, 34, 0));
|
|
3089
|
+
`;
|
|
3090
|
+
const Content$1 = styled.div`
|
|
3091
|
+
width: 100%;
|
|
3092
|
+
height: 100vh;
|
|
3093
|
+
overflow: auto;
|
|
3094
|
+
text-align: center;
|
|
3095
|
+
vertical-align: middle;
|
|
3096
|
+
white-space: nowrap;
|
|
3097
|
+
justify-content: center;
|
|
3098
|
+
cursor: ${(p) => p.isDraggable === "true" ? p.scrolling === "true" ? "grabbing" : "grab" : "auto"};
|
|
3099
|
+
`;
|
|
3100
|
+
const Thumbnail = styled.img`
|
|
3101
|
+
cursor: pointer;
|
|
3102
|
+
`;
|
|
3103
|
+
const Modal = forwardRef((_H, ref) => {
|
|
3104
|
+
var _I = _H, { className, children, trigger, onOverlayClick = () => {
|
|
3105
|
+
}, close = false } = _I, other = __objRest(_I, ["className", "children", "trigger", "onOverlayClick", "close"]);
|
|
2510
3106
|
const [visible, toggleVisible] = useToggle();
|
|
2511
3107
|
const [css2, innerRef] = useScroll(true);
|
|
2512
3108
|
const closeButtonRef = useRef();
|
|
@@ -2548,7 +3144,7 @@ const Modal = forwardRef((_F, ref) => {
|
|
|
2548
3144
|
tabIndex: -1
|
|
2549
3145
|
}, other), {
|
|
2550
3146
|
ref: innerRef
|
|
2551
|
-
}), /* @__PURE__ */ React.createElement(CloseButton
|
|
3147
|
+
}), /* @__PURE__ */ React.createElement(CloseButton, {
|
|
2552
3148
|
onClick: () => toggleVisible(false),
|
|
2553
3149
|
tabIndex: 0,
|
|
2554
3150
|
ref: closeButtonRef
|
|
@@ -2812,8 +3408,8 @@ class TabStop extends Component {
|
|
|
2812
3408
|
});
|
|
2813
3409
|
}
|
|
2814
3410
|
}
|
|
2815
|
-
var TextLink = forwardRef((
|
|
2816
|
-
var
|
|
3411
|
+
var TextLink = forwardRef((_J, ref) => {
|
|
3412
|
+
var _K = _J, { className, description, text, children } = _K, other = __objRest(_K, ["className", "description", "text", "children"]);
|
|
2817
3413
|
return /* @__PURE__ */ React.createElement(Link, __spreadProps(__spreadValues({
|
|
2818
3414
|
className: appendClassNames(className, "humany-text-link")
|
|
2819
3415
|
}, other), {
|
|
@@ -2853,8 +3449,8 @@ function formatDate(unformattedDate, format) {
|
|
|
2853
3449
|
}
|
|
2854
3450
|
return `${dateString} ${timeString}`;
|
|
2855
3451
|
}
|
|
2856
|
-
const Tooltip = (
|
|
2857
|
-
var
|
|
3452
|
+
const Tooltip = (_L) => {
|
|
3453
|
+
var _M = _L, { className, children, content, sticky = false } = _M, other = __objRest(_M, ["className", "children", "content", "sticky"]);
|
|
2858
3454
|
const [open, setOpen] = useState(false);
|
|
2859
3455
|
const id = useRef(uuid());
|
|
2860
3456
|
const ref = useRef();
|
|
@@ -2999,9 +3595,9 @@ const TransitionComponent = (props) => {
|
|
|
2999
3595
|
onEnter: (node) => node.clientHeight
|
|
3000
3596
|
}, (state) => children && children(state, def && transitionComposer.compose(state, def)));
|
|
3001
3597
|
};
|
|
3002
|
-
var WidgetLink = forwardRef((
|
|
3003
|
-
var
|
|
3004
|
-
}, widgetName, activationOptions } =
|
|
3598
|
+
var WidgetLink = forwardRef((_N, ref) => {
|
|
3599
|
+
var _O = _N, { className, children, onClick = () => {
|
|
3600
|
+
}, widgetName, activationOptions } = _O, other = __objRest(_O, ["className", "children", "onClick", "widgetName", "activationOptions"]);
|
|
3005
3601
|
const container = useContainer();
|
|
3006
3602
|
const getWidget = () => {
|
|
3007
3603
|
const { implementation } = container.get("$widget");
|
|
@@ -3094,5 +3690,5 @@ const createReactComponent = (container, type, reactComponent, fn, options) => {
|
|
|
3094
3690
|
}), type, options);
|
|
3095
3691
|
});
|
|
3096
3692
|
};
|
|
3097
|
-
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, WidgetOverlayOutlet, borderTabStyle, browser, buttonCss, contentBox, convertToStringAttributes, createEmptyComponent, createReactComponent, defaultRenderInstructions, embeddedLinkMapper, filterCssProps, filterCssPropsStyle, genericHashLink, genericHtml, 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 };
|
|
3693
|
+
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, WidgetOverlayOutlet, borderTabStyle, browser, buttonCss, contentBox, convertToStringAttributes, createEmptyComponent, createReactComponent, defaultRenderInstructions, embeddedLinkMapper, filterCssProps, filterCssPropsStyle, genericHashLink, genericHtml, headingElement, imageLightboxRenderer, 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 };
|
|
3098
3694
|
//# sourceMappingURL=index.js.map
|