@planningcenter/organization-avatars 1.6.1 → 1.6.2
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/index.cjs +1 -1
- package/dist/index.js +133 -135
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),B=require("react-dom"),M=require("@planningcenter/url"),C=require("@planningcenter/tapestry"),j=require("@planningcenter/icons/paths/general"),O=require("@planningcenter/icons/paths/services"),P=require("react-dropzone");function z(a){var o,t,r="";if(typeof a=="string"||typeof a=="number")r+=a;else if(typeof a=="object")if(Array.isArray(a)){var c=a.length;for(o=0;o<c;o++)a[o]&&(t=z(a[o]))&&(r&&(r+=" "),r+=t)}else for(t in a)a[t]&&(r&&(r+=" "),r+=t);return r}function T(){for(var a,o,t=0,r="",c=arguments.length;t<c;t++)(a=arguments[t])&&(o=z(a))&&(r&&(r+=" "),r+=o);return r}function $(){const a=document.querySelector('meta[name="csrf-token"]');if(!a||!a.content)throw new Error('CSRF token not found. Ensure your Rails application includes <meta name="csrf-token" content="..."> in the document head.');return a.content}function L(a){const o=a.split("");return[o.shift()?.toUpperCase(),o.join("")].join("")}const I=a=>a==="dark_mode_avatar"?"dark":"light";function S({avatarUrl:a,organization:o,mode:t,pcoEnv:r,readOnly:c,onAvatarUpdate:v}){const[s,p]=l.useState(null),[d,x]=l.useState(!1),[u,f]=l.useState(!1),[_,h]=l.useState(""),i=l.useId(),k=l.useRef(null),b=I(t),F=g=>{const[n]=g;n&&p(Object.assign(n,{preview:URL.createObjectURL(n)}))};l.useEffect(()=>()=>{s?.preview&&(URL.revokeObjectURL(s.preview),h(""))},[s]);const N=async g=>{const n=await fetch(M.pcoApiUrl("accounts",{env:r}),{method:"PATCH",headers:{"Content-Type":"application/json","X-CSRF-Token":$(),Accept:"application/json"},body:JSON.stringify({data:{attributes:g}})}),m=await n.json();if(!n.ok)throw m;return m},R=async g=>{if(g.preventDefault(),!(!s||d||u)){x(!0);try{const n=new FileReader,m=await new Promise((y,w)=>{n.onloadend=()=>y(n.result),n.onerror=w,n.readAsDataURL(s)}),A=await N({[t]:m,[`${t}_cache`]:""});p(null),v(t,A.data.attributes[t].url),k.current?.close()}catch{h("We were unable to save your avatar.")}finally{x(!1)}}},U=async()=>{if(!(d||u)){f(!0);try{await N({[`remove_${t}`]:"1"}),v(t,""),k.current?.close()}catch{h("We were unable to delete your avatar.")}finally{f(!1)}}},q=()=>{p(null),h("")};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pco-org-avatar",children:[e.jsx("button",{type:"button",commandfor:i,command:"show-modal",disabled:c,className:`pco-org-avatar__button pco-org-avatar__button--${b}`,children:a?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:a,alt:`Church logo for ${o}`}),e.jsx("div",{className:"tds-btn tds-btn--interaction tds-btn--icononly",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:j.pencil})})})]}):e.jsxs(e.Fragment,{children:[e.jsx("svg",{width:"48",height:"48",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:O.image})}),e.jsx("div",{className:"tds-btn tds-btn--interaction tds-btn--icononly",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:j.pencil})})})]})}),e.jsxs("div",{className:"pco-org-avatar__label",children:[L(b)," mode"]})]}),B.createPortal(e.jsx("dialog",{id:i,ref:k,className:"pco-org-avatar__dialog",onClose:q,children:e.jsxs("form",{onSubmit:R,children:[e.jsxs("div",{className:"pco-org-avatar__dialog-header",children:[e.jsxs("h1",{className:"pco-org-avatar__dialog-title",children:["Church logo — ",b," mode"]}),e.jsx("button",{type:"button",commandfor:i,command:"close",className:"pco-org-avatar__dialog-close","aria-label":"Close modal",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:j.smallX})})})]}),e.jsxs("div",{className:"pco-org-avatar__dialog-body",children:[_&&e.jsxs("div",{role:"alert",className:"pco-org-avatar__dialog-alert",children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",className:"symbol","aria-hidden":"true",children:e.jsx("path",{d:j.exclamationTriangle})}),e.jsx("p",{children:_})]}),e.jsx(P,{accept:{"image/*":[".jpg",".jpeg",".png"]},multiple:!1,onDropAccepted:F,children:({getRootProps:g,getInputProps:n,isFocused:m,isDragAccept:A,isDragReject:y,isDragActive:w})=>{const D=T("pco-org-avatar__dialog-dropzone",`pco-org-avatar__dialog-dropzone--${b}`,{"pco-org-avatar__dialog-dropzone--image":s||a,"pco-org-avatar__dialog-dropzone--focused":m,"pco-org-avatar__dialog-dropzone--accepted":A,"pco-org-avatar__dialog-dropzone--rejected":w&&y});return e.jsxs("div",{...g({className:D}),children:[e.jsx("input",{...n()}),s?e.jsx("img",{src:s.preview,alt:`Church logo for ${o}`}):a?e.jsx("img",{src:a,alt:`Church logo for ${o}`}):e.jsxs(e.Fragment,{children:[e.jsx("svg",{width:"64",height:"64",viewBox:"0 0 16 16","aria-hidden":"true",children:e.jsx("path",{d:j.toCloudArrow})}),w&&y?e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:"Wrong file type"}),e.jsx("p",{children:"Please upload a PNG or JPG file."})]}):e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:"Add church logo"}),e.jsx("p",{children:"Use a high-quality image (up to 20mb) with a transparent background."})]})]})]})}})]}),e.jsxs("div",{className:"pco-org-avatar__dialog-actions",children:[a&&e.jsx(C.Button,{label:"Delete logo",kind:"delete",onClick:U,loading:u,disabled:u||d,className:"pco-org-avatar__dialog-delete"}),e.jsx(C.Button,{type:"button",label:"Cancel",commandfor:i,command:"close",disabled:d||u}),e.jsx(C.Button,{type:"submit",label:"Update logo",kind:"primary",loading:d,disabled:!s||d||u})]})]})}),document.body)]})}function E({avatarUrl:a,darkModeAvatarUrl:o,orgName:t,onAvatarUpdate:r,pcoEnv:c,readOnly:v,showDarkModeAvatar:s=!1}){const[p,d]=l.useState(a),[x,u]=l.useState(o),f=(h,i)=>{h==="avatar"?(d(i),r?.("avatar",i)):h==="dark_mode_avatar"&&(u(i),r?.("dark_mode_avatar",i))},_=x||p;return e.jsxs("div",{className:"pco-org-avatars",children:[e.jsx(S,{avatarUrl:p,organization:t,mode:"avatar",pcoEnv:c,readOnly:v,onAvatarUpdate:f}),s&&e.jsx(S,{avatarUrl:_,organization:t,mode:"dark_mode_avatar",pcoEnv:c,readOnly:v,onAvatarUpdate:f})]})}exports.OrganizationAvatars=E;
|
package/dist/index.js
CHANGED
|
@@ -1,120 +1,118 @@
|
|
|
1
|
-
import { jsxs as n, Fragment as f, jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { pcoApiUrl as
|
|
5
|
-
import { Button as
|
|
6
|
-
import { pencil as
|
|
7
|
-
import { image as
|
|
8
|
-
import
|
|
9
|
-
function
|
|
1
|
+
import { jsxs as n, Fragment as f, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as v, useId as O, useRef as P, useEffect as T } from "react";
|
|
3
|
+
import { createPortal as L } from "react-dom";
|
|
4
|
+
import { pcoApiUrl as I } from "@planningcenter/url";
|
|
5
|
+
import { Button as z } from "@planningcenter/tapestry";
|
|
6
|
+
import { pencil as x, smallX as E, exclamationTriangle as W, toCloudArrow as q } from "@planningcenter/icons/paths/general";
|
|
7
|
+
import { image as G } from "@planningcenter/icons/paths/services";
|
|
8
|
+
import J from "react-dropzone";
|
|
9
|
+
function R(a) {
|
|
10
10
|
var o, r, t = "";
|
|
11
|
-
if (typeof
|
|
12
|
-
else if (typeof
|
|
13
|
-
var
|
|
14
|
-
for (o = 0; o <
|
|
15
|
-
} else for (r in
|
|
11
|
+
if (typeof a == "string" || typeof a == "number") t += a;
|
|
12
|
+
else if (typeof a == "object") if (Array.isArray(a)) {
|
|
13
|
+
var d = a.length;
|
|
14
|
+
for (o = 0; o < d; o++) a[o] && (r = R(a[o])) && (t && (t += " "), t += r);
|
|
15
|
+
} else for (r in a) a[r] && (t && (t += " "), t += r);
|
|
16
16
|
return t;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
for (var
|
|
18
|
+
function X() {
|
|
19
|
+
for (var a, o, r = 0, t = "", d = arguments.length; r < d; r++) (a = arguments[r]) && (o = R(a)) && (t && (t += " "), t += o);
|
|
20
20
|
return t;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const
|
|
24
|
-
if (!
|
|
22
|
+
function H() {
|
|
23
|
+
const a = document.querySelector('meta[name="csrf-token"]');
|
|
24
|
+
if (!a || !a.content)
|
|
25
25
|
throw new Error(
|
|
26
26
|
'CSRF token not found. Ensure your Rails application includes <meta name="csrf-token" content="..."> in the document head.'
|
|
27
27
|
);
|
|
28
|
-
return
|
|
28
|
+
return a.content;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
const o =
|
|
30
|
+
function K(a) {
|
|
31
|
+
const o = a.split("");
|
|
32
32
|
return [o.shift()?.toUpperCase(), o.join("")].join("");
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
function
|
|
36
|
-
avatarUrl:
|
|
34
|
+
const Q = (a) => a === "dark_mode_avatar" ? "dark" : "light";
|
|
35
|
+
function D({
|
|
36
|
+
avatarUrl: a,
|
|
37
37
|
organization: o,
|
|
38
38
|
mode: r,
|
|
39
39
|
pcoEnv: t,
|
|
40
|
-
readOnly:
|
|
40
|
+
readOnly: d,
|
|
41
41
|
onAvatarUpdate: _
|
|
42
42
|
}) {
|
|
43
|
-
const [l,
|
|
44
|
-
const [i] =
|
|
45
|
-
i &&
|
|
43
|
+
const [l, u] = v(null), [s, y] = v(!1), [h, b] = v(!1), [A, p] = v(""), c = O(), N = P(null), w = Q(r), M = (g) => {
|
|
44
|
+
const [i] = g;
|
|
45
|
+
i && u(
|
|
46
46
|
Object.assign(i, {
|
|
47
47
|
preview: URL.createObjectURL(i)
|
|
48
48
|
})
|
|
49
49
|
);
|
|
50
50
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}, [e]), R(() => () => {
|
|
54
|
-
l?.preview && (URL.revokeObjectURL(l.preview), k(""));
|
|
51
|
+
T(() => () => {
|
|
52
|
+
l?.preview && (URL.revokeObjectURL(l.preview), p(""));
|
|
55
53
|
}, [l]);
|
|
56
|
-
const
|
|
57
|
-
const i = await fetch(
|
|
54
|
+
const U = async (g) => {
|
|
55
|
+
const i = await fetch(I("accounts", { env: t }), {
|
|
58
56
|
method: "PATCH",
|
|
59
57
|
headers: {
|
|
60
58
|
"Content-Type": "application/json",
|
|
61
|
-
"X-CSRF-Token":
|
|
59
|
+
"X-CSRF-Token": H(),
|
|
62
60
|
Accept: "application/json"
|
|
63
61
|
},
|
|
64
62
|
body: JSON.stringify({
|
|
65
63
|
data: {
|
|
66
|
-
attributes:
|
|
64
|
+
attributes: g
|
|
67
65
|
}
|
|
68
66
|
})
|
|
69
|
-
}),
|
|
70
|
-
if (!i.ok) throw
|
|
71
|
-
return
|
|
72
|
-
},
|
|
73
|
-
if (
|
|
67
|
+
}), m = await i.json();
|
|
68
|
+
if (!i.ok) throw m;
|
|
69
|
+
return m;
|
|
70
|
+
}, S = async (g) => {
|
|
71
|
+
if (g.preventDefault(), !(!l || s || h)) {
|
|
74
72
|
y(!0);
|
|
75
73
|
try {
|
|
76
|
-
const i = new FileReader(),
|
|
77
|
-
i.onloadend = () =>
|
|
78
|
-
}),
|
|
79
|
-
[r]:
|
|
74
|
+
const i = new FileReader(), m = await new Promise((k, C) => {
|
|
75
|
+
i.onloadend = () => k(i.result), i.onerror = C, i.readAsDataURL(l);
|
|
76
|
+
}), j = await U({
|
|
77
|
+
[r]: m,
|
|
80
78
|
[`${r}_cache`]: ""
|
|
81
79
|
});
|
|
82
|
-
|
|
80
|
+
u(null), _(r, j.data.attributes[r].url), N.current?.close();
|
|
83
81
|
} catch {
|
|
84
|
-
|
|
82
|
+
p("We were unable to save your avatar.");
|
|
85
83
|
} finally {
|
|
86
84
|
y(!1);
|
|
87
85
|
}
|
|
88
86
|
}
|
|
89
|
-
},
|
|
87
|
+
}, F = async () => {
|
|
90
88
|
if (!(s || h)) {
|
|
91
|
-
|
|
89
|
+
b(!0);
|
|
92
90
|
try {
|
|
93
|
-
await
|
|
91
|
+
await U({
|
|
94
92
|
[`remove_${r}`]: "1"
|
|
95
|
-
}),
|
|
93
|
+
}), _(r, ""), N.current?.close();
|
|
96
94
|
} catch {
|
|
97
|
-
|
|
95
|
+
p("We were unable to delete your avatar.");
|
|
98
96
|
} finally {
|
|
99
|
-
|
|
97
|
+
b(!1);
|
|
100
98
|
}
|
|
101
99
|
}
|
|
102
|
-
},
|
|
103
|
-
|
|
100
|
+
}, B = () => {
|
|
101
|
+
u(null), p("");
|
|
104
102
|
};
|
|
105
103
|
return /* @__PURE__ */ n(f, { children: [
|
|
106
104
|
/* @__PURE__ */ n("div", { className: "pco-org-avatar", children: [
|
|
107
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ e(
|
|
108
106
|
"button",
|
|
109
107
|
{
|
|
110
108
|
type: "button",
|
|
111
|
-
commandfor:
|
|
109
|
+
commandfor: c,
|
|
112
110
|
command: "show-modal",
|
|
113
|
-
disabled:
|
|
114
|
-
className: `pco-org-avatar__button pco-org-avatar__button--${
|
|
115
|
-
children:
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
/* @__PURE__ */
|
|
111
|
+
disabled: d,
|
|
112
|
+
className: `pco-org-avatar__button pco-org-avatar__button--${w}`,
|
|
113
|
+
children: a ? /* @__PURE__ */ n(f, { children: [
|
|
114
|
+
/* @__PURE__ */ e("img", { src: a, alt: `Church logo for ${o}` }),
|
|
115
|
+
/* @__PURE__ */ e("div", { className: "tds-btn tds-btn--interaction tds-btn--icononly", children: /* @__PURE__ */ e(
|
|
118
116
|
"svg",
|
|
119
117
|
{
|
|
120
118
|
width: "14",
|
|
@@ -122,11 +120,11 @@ function S({
|
|
|
122
120
|
viewBox: "0 0 16 16",
|
|
123
121
|
fill: "currentColor",
|
|
124
122
|
"aria-hidden": "true",
|
|
125
|
-
children: /* @__PURE__ */
|
|
123
|
+
children: /* @__PURE__ */ e("path", { d: x })
|
|
126
124
|
}
|
|
127
125
|
) })
|
|
128
126
|
] }) : /* @__PURE__ */ n(f, { children: [
|
|
129
|
-
/* @__PURE__ */
|
|
127
|
+
/* @__PURE__ */ e(
|
|
130
128
|
"svg",
|
|
131
129
|
{
|
|
132
130
|
width: "48",
|
|
@@ -134,10 +132,10 @@ function S({
|
|
|
134
132
|
viewBox: "0 0 16 16",
|
|
135
133
|
fill: "currentColor",
|
|
136
134
|
"aria-hidden": "true",
|
|
137
|
-
children: /* @__PURE__ */
|
|
135
|
+
children: /* @__PURE__ */ e("path", { d: G })
|
|
138
136
|
}
|
|
139
137
|
),
|
|
140
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ e("div", { className: "tds-btn tds-btn--interaction tds-btn--icononly", children: /* @__PURE__ */ e(
|
|
141
139
|
"svg",
|
|
142
140
|
{
|
|
143
141
|
width: "14",
|
|
@@ -145,41 +143,41 @@ function S({
|
|
|
145
143
|
viewBox: "0 0 16 16",
|
|
146
144
|
fill: "currentColor",
|
|
147
145
|
"aria-hidden": "true",
|
|
148
|
-
children: /* @__PURE__ */
|
|
146
|
+
children: /* @__PURE__ */ e("path", { d: x })
|
|
149
147
|
}
|
|
150
148
|
) })
|
|
151
149
|
] })
|
|
152
150
|
}
|
|
153
151
|
),
|
|
154
152
|
/* @__PURE__ */ n("div", { className: "pco-org-avatar__label", children: [
|
|
155
|
-
|
|
153
|
+
K(w),
|
|
156
154
|
" mode"
|
|
157
155
|
] })
|
|
158
156
|
] }),
|
|
159
|
-
|
|
160
|
-
/* @__PURE__ */
|
|
157
|
+
L(
|
|
158
|
+
/* @__PURE__ */ e(
|
|
161
159
|
"dialog",
|
|
162
160
|
{
|
|
163
|
-
id:
|
|
164
|
-
ref:
|
|
161
|
+
id: c,
|
|
162
|
+
ref: N,
|
|
165
163
|
className: "pco-org-avatar__dialog",
|
|
166
|
-
onClose:
|
|
167
|
-
children: /* @__PURE__ */ n("form", { onSubmit:
|
|
164
|
+
onClose: B,
|
|
165
|
+
children: /* @__PURE__ */ n("form", { onSubmit: S, children: [
|
|
168
166
|
/* @__PURE__ */ n("div", { className: "pco-org-avatar__dialog-header", children: [
|
|
169
167
|
/* @__PURE__ */ n("h1", { className: "pco-org-avatar__dialog-title", children: [
|
|
170
168
|
"Church logo — ",
|
|
171
|
-
|
|
169
|
+
w,
|
|
172
170
|
" mode"
|
|
173
171
|
] }),
|
|
174
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ e(
|
|
175
173
|
"button",
|
|
176
174
|
{
|
|
177
175
|
type: "button",
|
|
178
|
-
commandfor:
|
|
176
|
+
commandfor: c,
|
|
179
177
|
command: "close",
|
|
180
178
|
className: "pco-org-avatar__dialog-close",
|
|
181
179
|
"aria-label": "Close modal",
|
|
182
|
-
children: /* @__PURE__ */
|
|
180
|
+
children: /* @__PURE__ */ e(
|
|
183
181
|
"svg",
|
|
184
182
|
{
|
|
185
183
|
width: "16",
|
|
@@ -187,15 +185,15 @@ function S({
|
|
|
187
185
|
viewBox: "0 0 16 16",
|
|
188
186
|
fill: "currentColor",
|
|
189
187
|
"aria-hidden": "true",
|
|
190
|
-
children: /* @__PURE__ */
|
|
188
|
+
children: /* @__PURE__ */ e("path", { d: E })
|
|
191
189
|
}
|
|
192
190
|
)
|
|
193
191
|
}
|
|
194
192
|
)
|
|
195
193
|
] }),
|
|
196
194
|
/* @__PURE__ */ n("div", { className: "pco-org-avatar__dialog-body", children: [
|
|
197
|
-
|
|
198
|
-
/* @__PURE__ */
|
|
195
|
+
A && /* @__PURE__ */ n("div", { role: "alert", className: "pco-org-avatar__dialog-alert", children: [
|
|
196
|
+
/* @__PURE__ */ e(
|
|
199
197
|
"svg",
|
|
200
198
|
{
|
|
201
199
|
width: "16",
|
|
@@ -203,66 +201,66 @@ function S({
|
|
|
203
201
|
viewBox: "0 0 16 16",
|
|
204
202
|
className: "symbol",
|
|
205
203
|
"aria-hidden": "true",
|
|
206
|
-
children: /* @__PURE__ */
|
|
204
|
+
children: /* @__PURE__ */ e("path", { d: W })
|
|
207
205
|
}
|
|
208
206
|
),
|
|
209
|
-
/* @__PURE__ */
|
|
207
|
+
/* @__PURE__ */ e("p", { children: A })
|
|
210
208
|
] }),
|
|
211
|
-
/* @__PURE__ */
|
|
212
|
-
|
|
209
|
+
/* @__PURE__ */ e(
|
|
210
|
+
J,
|
|
213
211
|
{
|
|
214
212
|
accept: { "image/*": [".jpg", ".jpeg", ".png"] },
|
|
215
213
|
multiple: !1,
|
|
216
|
-
onDropAccepted:
|
|
214
|
+
onDropAccepted: M,
|
|
217
215
|
children: ({
|
|
218
|
-
getRootProps:
|
|
216
|
+
getRootProps: g,
|
|
219
217
|
getInputProps: i,
|
|
220
|
-
isFocused:
|
|
221
|
-
isDragAccept:
|
|
222
|
-
isDragReject:
|
|
223
|
-
isDragActive:
|
|
218
|
+
isFocused: m,
|
|
219
|
+
isDragAccept: j,
|
|
220
|
+
isDragReject: k,
|
|
221
|
+
isDragActive: C
|
|
224
222
|
}) => {
|
|
225
|
-
const
|
|
223
|
+
const $ = X(
|
|
226
224
|
"pco-org-avatar__dialog-dropzone",
|
|
227
|
-
`pco-org-avatar__dialog-dropzone--${
|
|
225
|
+
`pco-org-avatar__dialog-dropzone--${w}`,
|
|
228
226
|
{
|
|
229
|
-
"pco-org-avatar__dialog-dropzone--image": l ||
|
|
230
|
-
"pco-org-avatar__dialog-dropzone--focused":
|
|
231
|
-
"pco-org-avatar__dialog-dropzone--accepted":
|
|
232
|
-
"pco-org-avatar__dialog-dropzone--rejected":
|
|
227
|
+
"pco-org-avatar__dialog-dropzone--image": l || a,
|
|
228
|
+
"pco-org-avatar__dialog-dropzone--focused": m,
|
|
229
|
+
"pco-org-avatar__dialog-dropzone--accepted": j,
|
|
230
|
+
"pco-org-avatar__dialog-dropzone--rejected": C && k
|
|
233
231
|
}
|
|
234
232
|
);
|
|
235
|
-
return /* @__PURE__ */ n("div", { ...
|
|
236
|
-
/* @__PURE__ */
|
|
237
|
-
l ? /* @__PURE__ */
|
|
233
|
+
return /* @__PURE__ */ n("div", { ...g({ className: $ }), children: [
|
|
234
|
+
/* @__PURE__ */ e("input", { ...i() }),
|
|
235
|
+
l ? /* @__PURE__ */ e(
|
|
238
236
|
"img",
|
|
239
237
|
{
|
|
240
238
|
src: l.preview,
|
|
241
239
|
alt: `Church logo for ${o}`
|
|
242
240
|
}
|
|
243
|
-
) :
|
|
241
|
+
) : a ? /* @__PURE__ */ e(
|
|
244
242
|
"img",
|
|
245
243
|
{
|
|
246
|
-
src:
|
|
244
|
+
src: a,
|
|
247
245
|
alt: `Church logo for ${o}`
|
|
248
246
|
}
|
|
249
247
|
) : /* @__PURE__ */ n(f, { children: [
|
|
250
|
-
/* @__PURE__ */
|
|
248
|
+
/* @__PURE__ */ e(
|
|
251
249
|
"svg",
|
|
252
250
|
{
|
|
253
251
|
width: "64",
|
|
254
252
|
height: "64",
|
|
255
253
|
viewBox: "0 0 16 16",
|
|
256
254
|
"aria-hidden": "true",
|
|
257
|
-
children: /* @__PURE__ */
|
|
255
|
+
children: /* @__PURE__ */ e("path", { d: q })
|
|
258
256
|
}
|
|
259
257
|
),
|
|
260
|
-
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
/* @__PURE__ */
|
|
258
|
+
C && k ? /* @__PURE__ */ n(f, { children: [
|
|
259
|
+
/* @__PURE__ */ e("h2", { children: "Wrong file type" }),
|
|
260
|
+
/* @__PURE__ */ e("p", { children: "Please upload a PNG or JPG file." })
|
|
263
261
|
] }) : /* @__PURE__ */ n(f, { children: [
|
|
264
|
-
/* @__PURE__ */
|
|
265
|
-
/* @__PURE__ */
|
|
262
|
+
/* @__PURE__ */ e("h2", { children: "Add church logo" }),
|
|
263
|
+
/* @__PURE__ */ e("p", { children: "Use a high-quality image (up to 20mb) with a transparent background." })
|
|
266
264
|
] })
|
|
267
265
|
] })
|
|
268
266
|
] });
|
|
@@ -271,29 +269,29 @@ function S({
|
|
|
271
269
|
)
|
|
272
270
|
] }),
|
|
273
271
|
/* @__PURE__ */ n("div", { className: "pco-org-avatar__dialog-actions", children: [
|
|
274
|
-
|
|
275
|
-
|
|
272
|
+
a && /* @__PURE__ */ e(
|
|
273
|
+
z,
|
|
276
274
|
{
|
|
277
275
|
label: "Delete logo",
|
|
278
276
|
kind: "delete",
|
|
279
|
-
onClick:
|
|
277
|
+
onClick: F,
|
|
280
278
|
loading: h,
|
|
281
279
|
disabled: h || s,
|
|
282
280
|
className: "pco-org-avatar__dialog-delete"
|
|
283
281
|
}
|
|
284
282
|
),
|
|
285
|
-
/* @__PURE__ */
|
|
286
|
-
|
|
283
|
+
/* @__PURE__ */ e(
|
|
284
|
+
z,
|
|
287
285
|
{
|
|
288
286
|
type: "button",
|
|
289
287
|
label: "Cancel",
|
|
290
|
-
commandfor:
|
|
288
|
+
commandfor: c,
|
|
291
289
|
command: "close",
|
|
292
290
|
disabled: s || h
|
|
293
291
|
}
|
|
294
292
|
),
|
|
295
|
-
/* @__PURE__ */
|
|
296
|
-
|
|
293
|
+
/* @__PURE__ */ e(
|
|
294
|
+
z,
|
|
297
295
|
{
|
|
298
296
|
type: "submit",
|
|
299
297
|
label: "Update logo",
|
|
@@ -310,45 +308,45 @@ function S({
|
|
|
310
308
|
)
|
|
311
309
|
] });
|
|
312
310
|
}
|
|
313
|
-
function
|
|
314
|
-
avatarUrl:
|
|
311
|
+
function ne({
|
|
312
|
+
avatarUrl: a,
|
|
315
313
|
darkModeAvatarUrl: o,
|
|
316
314
|
orgName: r,
|
|
317
315
|
onAvatarUpdate: t,
|
|
318
|
-
pcoEnv:
|
|
316
|
+
pcoEnv: d,
|
|
319
317
|
readOnly: _,
|
|
320
318
|
showDarkModeAvatar: l = !1
|
|
321
319
|
}) {
|
|
322
|
-
const [
|
|
320
|
+
const [u, s] = v(a), [y, h] = v(
|
|
323
321
|
o
|
|
324
|
-
),
|
|
325
|
-
|
|
322
|
+
), b = (p, c) => {
|
|
323
|
+
p === "avatar" ? (s(c), t?.("avatar", c)) : p === "dark_mode_avatar" && (h(c), t?.("dark_mode_avatar", c));
|
|
326
324
|
};
|
|
327
325
|
return /* @__PURE__ */ n("div", { className: "pco-org-avatars", children: [
|
|
328
|
-
/* @__PURE__ */
|
|
329
|
-
|
|
326
|
+
/* @__PURE__ */ e(
|
|
327
|
+
D,
|
|
330
328
|
{
|
|
331
|
-
avatarUrl:
|
|
329
|
+
avatarUrl: u,
|
|
332
330
|
organization: r,
|
|
333
331
|
mode: "avatar",
|
|
334
|
-
pcoEnv:
|
|
332
|
+
pcoEnv: d,
|
|
335
333
|
readOnly: _,
|
|
336
|
-
onAvatarUpdate:
|
|
334
|
+
onAvatarUpdate: b
|
|
337
335
|
}
|
|
338
336
|
),
|
|
339
|
-
l && /* @__PURE__ */
|
|
340
|
-
|
|
337
|
+
l && /* @__PURE__ */ e(
|
|
338
|
+
D,
|
|
341
339
|
{
|
|
342
|
-
avatarUrl:
|
|
340
|
+
avatarUrl: y || u,
|
|
343
341
|
organization: r,
|
|
344
342
|
mode: "dark_mode_avatar",
|
|
345
|
-
pcoEnv:
|
|
343
|
+
pcoEnv: d,
|
|
346
344
|
readOnly: _,
|
|
347
|
-
onAvatarUpdate:
|
|
345
|
+
onAvatarUpdate: b
|
|
348
346
|
}
|
|
349
347
|
)
|
|
350
348
|
] });
|
|
351
349
|
}
|
|
352
350
|
export {
|
|
353
|
-
|
|
351
|
+
ne as OrganizationAvatars
|
|
354
352
|
};
|