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