@prosopo/procaptcha-react 0.2.39 → 0.2.40
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/cjs/components/CaptchaWidget.cjs +3 -1
- package/dist/cjs/components/Modal.cjs +6 -25
- package/dist/cjs/style/Modal.css +41 -0
- package/dist/components/Button.js +65 -55
- package/dist/components/CaptchaComponent.js +156 -59
- package/dist/components/CaptchaPlaceholder.js +97 -42
- package/dist/components/CaptchaWidget.js +144 -65
- package/dist/components/Checkbox.js +45 -31
- package/dist/components/ExtensionAccountSelect.js +47 -30
- package/dist/components/LoadingSpinner.js +12 -10
- package/dist/components/Modal.js +16 -34
- package/dist/components/Procaptcha.js +8 -7
- package/dist/components/ProcaptchaWidget.js +221 -130
- package/dist/components/collector.js +24 -23
- package/dist/components/index.js +11 -7
- package/dist/components/theme.js +38 -35
- package/dist/index.d.ts +42 -3
- package/dist/index.js +12 -3
- package/dist/style/Modal.css +41 -0
- package/dist/util/index.js +12 -7
- package/package.json +9 -8
- package/public/style/Modal.css +41 -0
- package/vite.config.ts +22 -0
- package/dist/components/Button.d.ts +0 -10
- package/dist/components/Button.d.ts.map +0 -1
- package/dist/components/Button.js.map +0 -1
- package/dist/components/CaptchaComponent.d.ts +0 -14
- package/dist/components/CaptchaComponent.d.ts.map +0 -1
- package/dist/components/CaptchaComponent.js.map +0 -1
- package/dist/components/CaptchaPlaceholder.d.ts +0 -6
- package/dist/components/CaptchaPlaceholder.d.ts.map +0 -1
- package/dist/components/CaptchaPlaceholder.js.map +0 -1
- package/dist/components/CaptchaWidget.d.ts +0 -9
- package/dist/components/CaptchaWidget.d.ts.map +0 -1
- package/dist/components/CaptchaWidget.js.map +0 -1
- package/dist/components/Checkbox.d.ts +0 -9
- package/dist/components/Checkbox.d.ts.map +0 -1
- package/dist/components/Checkbox.js.map +0 -1
- package/dist/components/ExtensionAccountSelect.d.ts +0 -7
- package/dist/components/ExtensionAccountSelect.d.ts.map +0 -1
- package/dist/components/ExtensionAccountSelect.js.map +0 -1
- package/dist/components/LoadingSpinner.d.ts +0 -6
- package/dist/components/LoadingSpinner.d.ts.map +0 -1
- package/dist/components/LoadingSpinner.js.map +0 -1
- package/dist/components/Modal.d.ts +0 -8
- package/dist/components/Modal.d.ts.map +0 -1
- package/dist/components/Modal.js.map +0 -1
- package/dist/components/Procaptcha.d.ts +0 -6
- package/dist/components/Procaptcha.d.ts.map +0 -1
- package/dist/components/Procaptcha.js.map +0 -1
- package/dist/components/ProcaptchaWidget.d.ts +0 -8
- package/dist/components/ProcaptchaWidget.d.ts.map +0 -1
- package/dist/components/ProcaptchaWidget.js.map +0 -1
- package/dist/components/collector.d.ts +0 -8
- package/dist/components/collector.d.ts.map +0 -1
- package/dist/components/collector.js.map +0 -1
- package/dist/components/index.d.ts +0 -7
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/components/theme.d.ts +0 -51
- package/dist/components/theme.d.ts.map +0 -1
- package/dist/components/theme.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/util/index.d.ts +0 -9
- package/dist/util/index.d.ts.map +0 -1
- package/dist/util/index.js.map +0 -1
|
@@ -1,69 +1,148 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { ProsopoDatasetError } from
|
|
3
|
-
import {
|
|
4
|
-
import { useMemo } from
|
|
1
|
+
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { ProsopoDatasetError } from "@prosopo/common";
|
|
3
|
+
import { lightTheme, darkTheme } from "./theme.js";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
5
|
const getHash = (item) => {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
if (!item.hash) {
|
|
7
|
+
throw new ProsopoDatasetError("CAPTCHA.MISSING_ITEM_HASH", { context: { item } });
|
|
8
|
+
}
|
|
9
|
+
return item.hash;
|
|
10
|
+
};
|
|
11
|
+
const CaptchaWidget = ({ challenge, solution, onClick, themeColor }) => {
|
|
12
|
+
const items = challenge.captcha.items;
|
|
13
|
+
const theme = useMemo(() => themeColor === "light" ? lightTheme : darkTheme, [themeColor]);
|
|
14
|
+
const isTouchDevice = "ontouchstart" in window;
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
style: {
|
|
19
|
+
paddingRight: 0.5,
|
|
20
|
+
paddingBottom: 0.5,
|
|
21
|
+
// expand to full height / width of parent
|
|
22
|
+
width: "100%",
|
|
23
|
+
height: "100%",
|
|
24
|
+
// display children in flex, spreading them evenly and wrapping when row length exceeded
|
|
25
|
+
display: "flex",
|
|
26
|
+
flexDirection: "row",
|
|
27
|
+
flexWrap: "wrap"
|
|
28
|
+
},
|
|
29
|
+
children: items.map((item, index) => {
|
|
30
|
+
const hash = getHash(item);
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
style: {
|
|
35
|
+
paddingTop: "4px",
|
|
36
|
+
paddingLeft: "4px",
|
|
37
|
+
// enable the items in the grid to grow in width to use up excess space
|
|
38
|
+
flexGrow: 1,
|
|
39
|
+
// make the width of each item 1/3rd of the width overall, i.e. 3 columns
|
|
40
|
+
flexBasis: "33.3333%",
|
|
41
|
+
// include the padding / margin / border in the width
|
|
42
|
+
boxSizing: "border-box"
|
|
43
|
+
},
|
|
44
|
+
children: /* @__PURE__ */ jsxs(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
style: { cursor: "pointer", height: "100%", width: "100%" },
|
|
48
|
+
onClick: isTouchDevice ? void 0 : () => onClick(hash),
|
|
49
|
+
onTouchStart: isTouchDevice ? () => onClick(hash) : void 0,
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsx("div", { style: { border: 1, borderColor: theme.palette.grey[300] }, children: /* @__PURE__ */ jsx(
|
|
52
|
+
"img",
|
|
53
|
+
{
|
|
54
|
+
style: {
|
|
55
|
+
width: "100%",
|
|
56
|
+
// image should be full width / height of the item
|
|
57
|
+
backgroundColor: theme.palette.grey[300],
|
|
58
|
+
// colour of the bands when letterboxing and image
|
|
59
|
+
opacity: solution.includes(hash) && isTouchDevice ? "50%" : "100%",
|
|
60
|
+
// iphone workaround
|
|
61
|
+
display: "block",
|
|
62
|
+
// removes whitespace below imgs
|
|
63
|
+
objectFit: "contain",
|
|
64
|
+
// contain the entire image in the img tag
|
|
65
|
+
aspectRatio: "1/1",
|
|
66
|
+
// force AR to be 1, letterboxing images with different aspect ratios
|
|
67
|
+
height: "auto"
|
|
68
|
+
// make the img tag responsive to its container
|
|
69
|
+
},
|
|
70
|
+
src: item.data,
|
|
71
|
+
alt: `Captcha image ${index + 1}`
|
|
72
|
+
}
|
|
73
|
+
) }),
|
|
74
|
+
/* @__PURE__ */ jsx(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
style: {
|
|
78
|
+
// relative to where the element _should_ be positioned
|
|
79
|
+
position: "relative",
|
|
80
|
+
// make the overlay the full height/width of an item
|
|
81
|
+
width: "100%",
|
|
82
|
+
height: "100%",
|
|
83
|
+
// shift it up 100% to overlay the item element
|
|
84
|
+
top: "-100%",
|
|
85
|
+
visibility: solution.includes(hash) ? "visible" : "hidden",
|
|
86
|
+
// transition on opacity upon (de)selection
|
|
87
|
+
transition: "opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
|
|
88
|
+
opacity: 1
|
|
89
|
+
},
|
|
90
|
+
children: /* @__PURE__ */ jsx(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
style: {
|
|
94
|
+
// make the overlay absolute positioned compare to its container
|
|
95
|
+
position: "absolute",
|
|
96
|
+
// spread across 100% width/height of the item box
|
|
97
|
+
top: 0,
|
|
98
|
+
left: 0,
|
|
99
|
+
bottom: 0,
|
|
100
|
+
right: 0,
|
|
101
|
+
height: "100%",
|
|
102
|
+
width: "100%",
|
|
103
|
+
// display overlays in center
|
|
104
|
+
display: "flex",
|
|
105
|
+
alignItems: "center",
|
|
106
|
+
justifyContent: "center",
|
|
107
|
+
// make bg half opacity, i.e. shadowing the item's img
|
|
108
|
+
backgroundColor: "rgba(0,0,0,0.5)"
|
|
109
|
+
},
|
|
110
|
+
children: /* @__PURE__ */ jsx(
|
|
111
|
+
"svg",
|
|
112
|
+
{
|
|
113
|
+
style: {
|
|
114
|
+
backgroundColor: "transparent",
|
|
115
|
+
// img must be displayed as block otherwise gets a bottom whitespace border
|
|
116
|
+
display: "block",
|
|
117
|
+
// how big the overlay icon is
|
|
118
|
+
width: "35%",
|
|
119
|
+
height: "35%",
|
|
120
|
+
transition: "fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
|
|
121
|
+
userSelect: "none",
|
|
122
|
+
fill: "currentcolor"
|
|
123
|
+
},
|
|
124
|
+
focusable: "false",
|
|
125
|
+
color: "#fff",
|
|
126
|
+
"aria-hidden": "true",
|
|
127
|
+
viewBox: "0 0 24 24",
|
|
128
|
+
"data-testid": "CheckIcon",
|
|
129
|
+
children: /* @__PURE__ */ jsx("path", { d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" })
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
},
|
|
140
|
+
index
|
|
141
|
+
);
|
|
142
|
+
})
|
|
8
143
|
}
|
|
9
|
-
|
|
144
|
+
);
|
|
10
145
|
};
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
const theme = useMemo(() => (themeColor === 'light' ? lightTheme : darkTheme), [themeColor]);
|
|
14
|
-
const isTouchDevice = 'ontouchstart' in window;
|
|
15
|
-
return (_jsx("div", { style: {
|
|
16
|
-
paddingRight: 0.5,
|
|
17
|
-
paddingBottom: 0.5,
|
|
18
|
-
width: '100%',
|
|
19
|
-
height: '100%',
|
|
20
|
-
display: 'flex',
|
|
21
|
-
flexDirection: 'row',
|
|
22
|
-
flexWrap: 'wrap',
|
|
23
|
-
}, children: items.map((item, index) => {
|
|
24
|
-
const hash = getHash(item);
|
|
25
|
-
return (_jsx("div", { style: {
|
|
26
|
-
paddingTop: '4px',
|
|
27
|
-
paddingLeft: '4px',
|
|
28
|
-
flexGrow: 1,
|
|
29
|
-
flexBasis: '33.3333%',
|
|
30
|
-
boxSizing: 'border-box',
|
|
31
|
-
}, children: _jsxs("div", { style: { cursor: 'pointer', height: '100%', width: '100%' }, onClick: isTouchDevice ? undefined : () => onClick(hash), onTouchStart: isTouchDevice ? () => onClick(hash) : undefined, children: [_jsx("div", { style: { border: 1, borderColor: theme.palette.grey[300] }, children: _jsx("img", { style: {
|
|
32
|
-
width: '100%',
|
|
33
|
-
backgroundColor: theme.palette.grey[300],
|
|
34
|
-
opacity: solution.includes(hash) && isTouchDevice ? '50%' : '100%',
|
|
35
|
-
display: 'block',
|
|
36
|
-
objectFit: 'contain',
|
|
37
|
-
aspectRatio: '1/1',
|
|
38
|
-
}, src: item.data, alt: `Captcha image ${index + 1}` }) }), _jsx("div", { style: {
|
|
39
|
-
position: 'relative',
|
|
40
|
-
width: '100%',
|
|
41
|
-
height: '100%',
|
|
42
|
-
top: '-100%',
|
|
43
|
-
visibility: solution.includes(hash) ? 'visible' : 'hidden',
|
|
44
|
-
transition: 'opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',
|
|
45
|
-
opacity: 1,
|
|
46
|
-
}, children: _jsx("div", { style: {
|
|
47
|
-
position: 'absolute',
|
|
48
|
-
top: 0,
|
|
49
|
-
left: 0,
|
|
50
|
-
bottom: 0,
|
|
51
|
-
right: 0,
|
|
52
|
-
height: '100%',
|
|
53
|
-
width: '100%',
|
|
54
|
-
display: 'flex',
|
|
55
|
-
alignItems: 'center',
|
|
56
|
-
justifyContent: 'center',
|
|
57
|
-
backgroundColor: 'rgba(0,0,0,0.5)',
|
|
58
|
-
}, children: _jsx("svg", { style: {
|
|
59
|
-
backgroundColor: 'transparent',
|
|
60
|
-
display: 'block',
|
|
61
|
-
width: '35%',
|
|
62
|
-
height: '35%',
|
|
63
|
-
transition: 'fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',
|
|
64
|
-
userSelect: 'none',
|
|
65
|
-
fill: 'currentcolor',
|
|
66
|
-
}, focusable: "false", color: "#fff", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "CheckIcon", children: _jsx("path", { d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" }) }) }) })] }) }, index));
|
|
67
|
-
}) }));
|
|
146
|
+
export {
|
|
147
|
+
CaptchaWidget
|
|
68
148
|
};
|
|
69
|
-
//# sourceMappingURL=CaptchaWidget.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { css } from
|
|
3
|
-
import {
|
|
4
|
-
import { useMemo, useState } from
|
|
5
|
-
const checkboxBefore = css
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { css } from "@emotion/react";
|
|
3
|
+
import { lightTheme, darkTheme } from "./theme.js";
|
|
4
|
+
import { useMemo, useState } from "react";
|
|
5
|
+
const checkboxBefore = css`{
|
|
6
6
|
&:before {
|
|
7
7
|
content: '""';
|
|
8
8
|
position: absolute;
|
|
@@ -11,33 +11,47 @@ const checkboxBefore = css `{
|
|
|
11
11
|
}
|
|
12
12
|
}`;
|
|
13
13
|
const baseStyle = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
width: "2.2em",
|
|
15
|
+
height: "2.2em",
|
|
16
|
+
top: "auto",
|
|
17
|
+
left: "auto",
|
|
18
|
+
opacity: "1",
|
|
19
|
+
borderRadius: "12.5%",
|
|
20
|
+
appearance: "none",
|
|
21
|
+
cursor: "pointer",
|
|
22
|
+
margin: "0",
|
|
23
|
+
borderStyle: "solid",
|
|
24
|
+
borderWidth: "1px"
|
|
25
25
|
};
|
|
26
26
|
const Checkbox = ({ themeColor, onChange, checked }) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
const theme = useMemo(() => themeColor === "light" ? lightTheme : darkTheme, [themeColor]);
|
|
28
|
+
const checkboxStyleBase = {
|
|
29
|
+
...baseStyle,
|
|
30
|
+
border: `1px solid ${theme.palette.background.contrastText}`
|
|
31
|
+
};
|
|
32
|
+
const [hover, setHover] = useState(false);
|
|
33
|
+
const checkboxStyle = useMemo(() => {
|
|
34
|
+
return {
|
|
35
|
+
...checkboxStyleBase,
|
|
36
|
+
borderColor: hover ? theme.palette.background.contrastText : theme.palette.grey[400],
|
|
37
|
+
appearance: checked ? "auto" : "none"
|
|
31
38
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
}, [hover, theme, checked]);
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
"input",
|
|
42
|
+
{
|
|
43
|
+
onMouseEnter: () => setHover(true),
|
|
44
|
+
onMouseLeave: () => setHover(false),
|
|
45
|
+
css: checkboxBefore,
|
|
46
|
+
type: "checkbox",
|
|
47
|
+
"aria-live": "assertive",
|
|
48
|
+
"aria-haspopup": "true",
|
|
49
|
+
onChange,
|
|
50
|
+
checked,
|
|
51
|
+
style: checkboxStyle
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
Checkbox as default
|
|
41
57
|
};
|
|
42
|
-
export default Checkbox;
|
|
43
|
-
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -1,31 +1,48 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import {
|
|
3
|
-
import { useTranslation } from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { useTranslation } from "@prosopo/common";
|
|
4
|
+
import { web3Enable, web3AccountsSubscribe } from "@polkadot/extension-dapp";
|
|
5
|
+
const ExtensionAccountSelect = ({
|
|
6
|
+
value,
|
|
7
|
+
dappName,
|
|
8
|
+
onChange
|
|
9
|
+
}) => {
|
|
10
|
+
const { t } = useTranslation();
|
|
11
|
+
const [accounts, setAccounts] = useState([]);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const prom = web3Enable(dappName).then(() => {
|
|
14
|
+
return web3AccountsSubscribe(setAccounts);
|
|
15
|
+
});
|
|
16
|
+
return () => {
|
|
17
|
+
prom.then((unsub) => unsub());
|
|
18
|
+
};
|
|
19
|
+
}, []);
|
|
20
|
+
const account = accounts.find((a) => a.address === value) || null;
|
|
21
|
+
return (
|
|
22
|
+
// react select box
|
|
23
|
+
/* @__PURE__ */ jsx(
|
|
24
|
+
"select",
|
|
25
|
+
{
|
|
26
|
+
id: "select-account",
|
|
27
|
+
onChange: (e) => {
|
|
28
|
+
const value2 = e.target.value;
|
|
29
|
+
const account2 = accounts.find((a) => a.address === value2) || null;
|
|
30
|
+
if (account2) {
|
|
31
|
+
console.log("Selected account:", value2);
|
|
32
|
+
onChange(account2.address);
|
|
33
|
+
} else {
|
|
34
|
+
console.log("Deselected account");
|
|
35
|
+
onChange("");
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
value: accounts.length > 0 && account ? account.address : void 0,
|
|
39
|
+
style: { width: "550px" },
|
|
40
|
+
children: accounts.map(({ address, meta: { name } }) => /* @__PURE__ */ jsx("option", { value: address, children: name }))
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
ExtensionAccountSelect,
|
|
47
|
+
ExtensionAccountSelect as default
|
|
29
48
|
};
|
|
30
|
-
export default ExtensionAccountSelect;
|
|
31
|
-
//# sourceMappingURL=ExtensionAccountSelect.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import {
|
|
3
|
-
import { useMemo } from
|
|
4
|
-
import styled from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { lightTheme, darkTheme } from "./theme.js";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import styled from "@emotion/styled";
|
|
5
|
+
const LoadingSpinner = ({ themeColor }) => {
|
|
6
|
+
const theme = useMemo(() => themeColor === "light" ? lightTheme : darkTheme, [themeColor]);
|
|
7
|
+
const StyledDiv = styled.div`
|
|
8
8
|
width: 2em;
|
|
9
9
|
height: 2em;
|
|
10
10
|
border: 4px solid ${theme.palette.background.contrastText};
|
|
@@ -22,7 +22,9 @@ export const LoadingSpinner = ({ themeColor }) => {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
`;
|
|
25
|
-
|
|
25
|
+
return /* @__PURE__ */ jsx(StyledDiv, {});
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
LoadingSpinner,
|
|
29
|
+
LoadingSpinner as default
|
|
26
30
|
};
|
|
27
|
-
export default LoadingSpinner;
|
|
28
|
-
//# sourceMappingURL=LoadingSpinner.js.map
|
package/dist/components/Modal.js
CHANGED
|
@@ -1,36 +1,18 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import
|
|
1
|
+
import { jsxs, jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import "../style/Modal.css";
|
|
3
|
+
import React from "react";
|
|
3
4
|
const ModalComponent = React.memo((props, nextProps) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
height: '100%',
|
|
15
|
-
background: 'rgba(0, 0, 0, 0.6)',
|
|
16
|
-
zIndex: '2147483646',
|
|
17
|
-
transition: 'all 0.5s',
|
|
18
|
-
display: display,
|
|
19
|
-
};
|
|
20
|
-
const ModalInnerDivCSS = {
|
|
21
|
-
maxWidth: '500px',
|
|
22
|
-
margin: 'auto',
|
|
23
|
-
position: 'fixed',
|
|
24
|
-
background: 'white',
|
|
25
|
-
height: '100%',
|
|
26
|
-
maxHeight: '100%',
|
|
27
|
-
top: '50%',
|
|
28
|
-
left: '50%',
|
|
29
|
-
transform: 'translate(-50%, -50%)',
|
|
30
|
-
zIndex: '2147483647',
|
|
31
|
-
transition: 'all 0.5s',
|
|
32
|
-
};
|
|
33
|
-
return (_jsx("div", { style: ModalOuterDivCss, children: _jsx("div", { style: ModalInnerDivCSS, children: children }) }));
|
|
5
|
+
const { show, children } = props;
|
|
6
|
+
console.log("rendering modal with show: ", show);
|
|
7
|
+
const display = show ? "block" : "none";
|
|
8
|
+
const ModalOuterDivCss = {
|
|
9
|
+
display
|
|
10
|
+
};
|
|
11
|
+
return /* @__PURE__ */ jsxs("div", { className: "modalOuter", style: ModalOuterDivCss, children: [
|
|
12
|
+
/* @__PURE__ */ jsx("div", { className: "modalBackground" }),
|
|
13
|
+
/* @__PURE__ */ jsx("div", { className: "modalInner", children })
|
|
14
|
+
] });
|
|
34
15
|
});
|
|
35
|
-
export
|
|
36
|
-
|
|
16
|
+
export {
|
|
17
|
+
ModalComponent as default
|
|
18
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { ProcaptchaPlaceholder } from
|
|
3
|
-
import {
|
|
4
|
-
const ProcaptchaWidget = lazy(async () => import(
|
|
5
|
-
const Procaptcha = (props) => (
|
|
6
|
-
export
|
|
7
|
-
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { ProcaptchaPlaceholder } from "./CaptchaPlaceholder.js";
|
|
3
|
+
import { lazy, Suspense } from "react";
|
|
4
|
+
const ProcaptchaWidget = lazy(async () => import("./ProcaptchaWidget.js"));
|
|
5
|
+
const Procaptcha = (props) => /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(ProcaptchaPlaceholder, { darkMode: props.config.theme }), children: /* @__PURE__ */ jsx(ProcaptchaWidget, { config: props.config, callbacks: props.callbacks }) });
|
|
6
|
+
export {
|
|
7
|
+
Procaptcha as default
|
|
8
|
+
};
|