@planningcenter/organization-avatars 1.8.4 → 1.10.1

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"),c=require("react"),P=require("react-dom"),$=require("@planningcenter/url"),y=require("@planningcenter/tapestry"),I=require("@planningcenter/sweetest-alert"),x=require("@planningcenter/icons/paths/general"),L=require("@planningcenter/icons/paths/services"),E=require("react-dropzone");function B(a){var r,t,o="";if(typeof a=="string"||typeof a=="number")o+=a;else if(typeof a=="object")if(Array.isArray(a)){var d=a.length;for(r=0;r<d;r++)a[r]&&(t=B(a[r]))&&(o&&(o+=" "),o+=t)}else for(t in a)a[t]&&(o&&(o+=" "),o+=t);return o}function W(){for(var a,r,t=0,o="",d=arguments.length;t<d;t++)(a=arguments[t])&&(r=B(a))&&(o&&(o+=" "),o+=r);return o}function G(){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 J(a){const r=a.split("");return[r.shift()?.toUpperCase(),r.join("")].join("")}const X=a=>a==="dark_mode_avatar"?"dark":"light",U=({open:a})=>e.jsxs("h2",{className:"pco-org-avatar__instructions",children:["Drag & drop your logo file to upload, or"," ",e.jsx(y.Button,{label:"browse",kind:"inline-text",onClick:r=>{r.stopPropagation(),a()}})]});function z({avatarUrl:a,organization:r,mode:t,pcoEnv:o,readOnly:d,onAvatarUpdate:f,fallbackAvatarUrl:b}){const[n,_]=c.useState(null),[l,w]=c.useState(!1),[i,p]=c.useState(!1),[g,k]=c.useState(""),q=c.useId(),m=c.useRef(null),u=X(t),v=a||b,T=h=>{const[s]=h;s&&_(Object.assign(s,{preview:URL.createObjectURL(s)}))};c.useEffect(()=>()=>{n?.preview&&(URL.revokeObjectURL(n.preview),k(""))},[n]);const R=async h=>{const s=await fetch($.pcoApiUrl("accounts",{env:o}),{method:"PATCH",headers:{"Content-Type":"application/json","X-CSRF-Token":G(),Accept:"application/json"},body:JSON.stringify({data:{attributes:h}})}),j=await s.json();if(!s.ok)throw j;return j},D=async h=>{if(h.preventDefault(),!(!n||l||i)){w(!0);try{const s=new FileReader,j=await new Promise((C,N)=>{s.onloadend=()=>C(s.result),s.onerror=N,s.readAsDataURL(n)}),A=await R({[t]:j,[`${t}_cache`]:""});_(null),f(t,A.data.attributes[t].url),m.current?.close()}catch{k("We were unable to save your avatar.")}finally{w(!1)}}},S=async()=>{l||i||(p(!0),I.SweetestAlert({type:"danger",title:"Remove this logo?",content:u==="light"?"Removing this logo means no logo will appear in light mode. This cannot be undone.":b?"Removing this logo means your light mode logo will appear in dark mode. This cannot be undone.":"Removing this logo means no logo will appear in dark mode. This cannot be undone.",confirmButton:"Remove logo",onConfirm:async()=>{try{await R({[`remove_${t}`]:"1"}),f(t,""),m.current?.close()}catch{k("We were unable to delete your avatar.")}finally{p(!1)}},onCancel:()=>{p(!1)}}))},M=()=>{_(null),k("")};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pco-org-avatar",children:[e.jsx("button",{type:"button",onClick:()=>m.current?.showModal(),disabled:d,className:`pco-org-avatar__button pco-org-avatar__button--${u}`,children:v?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:v,alt:`Church logo for ${r}`}),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:x.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:L.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:x.pencil})})})]})}),e.jsxs("div",{className:"pco-org-avatar__label",children:[J(u)," mode"]})]}),P.createPortal(e.jsx("dialog",{id:q,ref:m,className:"pco-org-avatar__dialog",onClose:M,children:e.jsxs("form",{onSubmit:D,children:[e.jsxs("div",{className:"pco-org-avatar__dialog-header",children:[e.jsxs("h1",{className:"pco-org-avatar__dialog-title",children:["Church logo — ",u," mode"]}),e.jsx("button",{type:"button",onClick:()=>m.current?.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:x.smallX})})})]}),e.jsxs("div",{className:"pco-org-avatar__dialog-body",children:[g&&e.jsxs("div",{role:"alert",className:"pco-org-avatar-alert 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:x.exclamationTriangle})}),e.jsx("p",{children:g})]}),e.jsx(E,{accept:{"image/*":[".jpg",".jpeg",".png"]},multiple:!1,onDropAccepted:T,children:({getRootProps:h,getInputProps:s,isFocused:j,isDragAccept:A,isDragReject:C,isDragActive:N,open:F})=>{const O=W("pco-org-avatar__dialog-dropzone",`pco-org-avatar__dialog-dropzone--${u}`,{"pco-org-avatar__dialog-dropzone--image":n||v,"pco-org-avatar__dialog-dropzone--focused":j,"pco-org-avatar__dialog-dropzone--accepted":A,"pco-org-avatar__dialog-dropzone--rejected":N&&C});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{...h({className:O}),children:[e.jsx("input",{...s()}),n?e.jsx("img",{src:n.preview,alt:`Church logo for ${r}`}):v?e.jsx("img",{src:v,alt:`Church logo for ${r}`}):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:x.toCloudArrow})}),N&&C?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(U,{open:F}),e.jsx("p",{className:"pco-org-avatar__instructions-sub",children:"Use a high-quality image (up to 20mb) with a transparent background."})]})]})]}),(n||v)&&e.jsx(U,{open:F})]})}})]}),e.jsxs("div",{className:"pco-org-avatar__dialog-actions",children:[a&&u==="light"&&e.jsx(y.Button,{label:"Remove logo",kind:"secondary-delete",onClick:S,loading:i,disabled:i||l,className:"pco-org-avatar__dialog-delete"}),a&&u==="dark"&&e.jsx(y.Button,{label:"Use light mode logo",kind:"secondary",onClick:S,loading:i,disabled:i||l,className:"pco-org-avatar__dialog-delete"}),e.jsx(y.Button,{type:"button",label:"Cancel",onClick:()=>m.current?.close(),disabled:l||i}),e.jsx(y.Button,{type:"submit",label:"Update logo",kind:"primary",loading:l,disabled:!n||l||i})]})]})}),document.body)]})}function H({avatarUrl:a,darkModeAvatarUrl:r,orgName:t,onAvatarUpdate:o,pcoEnv:d,readOnly:f,showDarkModeAvatar:b=!1}){const[n,_]=c.useState(a),[l,w]=c.useState(r),i=(p,g)=>{p==="avatar"?(_(g),o?.("avatar",g)):p==="dark_mode_avatar"&&(w(g),o?.("dark_mode_avatar",g))};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pco-org-avatars",children:[e.jsx(z,{avatarUrl:n,organization:t,mode:"avatar",pcoEnv:d,readOnly:f,onAvatarUpdate:i}),b&&e.jsx(z,{avatarUrl:l,organization:t,mode:"dark_mode_avatar",pcoEnv:d,readOnly:f,onAvatarUpdate:i,fallbackAvatarUrl:n})]}),b&&n&&!l&&e.jsxs("div",{className:"pco-org-avatar-alert",children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",className:"symbol","aria-hidden":"true",children:e.jsx("path",{d:x.infoCircle})}),e.jsx("p",{children:"The same logo is being used for both light and dark modes."})]})]})}exports.OrganizationAvatars=H;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`react`),l=require(`react-dom`),u=require(`@planningcenter/url`),d=require(`@planningcenter/tapestry`),f=require(`@planningcenter/sweetest-alert`),p=require(`@planningcenter/icons/paths/general`),m=require(`@planningcenter/icons/paths/services`),h=require(`react-dropzone`);h=s(h,1);let g=require(`react/jsx-runtime`);function _(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=_(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function v(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=_(e))&&(r&&(r+=` `),r+=t);return r}function y(){let e=document.querySelector(`meta[name="csrf-token"]`);if(!e||!e.content)throw Error(`CSRF token not found. Ensure your Rails application includes <meta name="csrf-token" content="..."> in the document head.`);return e.content}function b(e){let t=e.split(``);return[t.shift()?.toUpperCase(),t.join(``)].join(``)}var x=e=>e===`dark_mode_avatar`?`dark`:`light`,S=({open:e})=>(0,g.jsxs)(`h2`,{className:`pco-org-avatar__instructions`,children:[`Drag & drop your logo file to upload, or`,` `,(0,g.jsx)(d.Button,{label:`browse`,kind:`inline-text`,onClick:t=>{t.stopPropagation(),e()}})]});function C({avatarUrl:e,organization:t,mode:n,pcoEnv:r,readOnly:i,onAvatarUpdate:a,fallbackAvatarUrl:o}){let[s,_]=(0,c.useState)(null),[C,w]=(0,c.useState)(!1),[T,E]=(0,c.useState)(!1),[D,O]=(0,c.useState)(``),k=(0,c.useId)(),A=(0,c.useRef)(null),j=x(n),M=e||o,N=e=>{let[t]=e;t&&_(Object.assign(t,{preview:URL.createObjectURL(t)}))};(0,c.useEffect)(()=>()=>{s?.preview&&(URL.revokeObjectURL(s.preview),O(``))},[s]);let P=async e=>{let t=await fetch((0,u.pcoApiUrl)(`accounts`,{env:r}),{method:`PATCH`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":y(),Accept:`application/json`},body:JSON.stringify({data:{attributes:e}})}),n=await t.json();if(!t.ok)throw n;return n},F=async e=>{if(e.preventDefault(),!(!s||C||T)){w(!0);try{let e=new FileReader,t=await new Promise((t,n)=>{e.onloadend=()=>t(e.result),e.onerror=n,e.readAsDataURL(s)}),r=await P({[n]:t,[`${n}_cache`]:``});_(null),a(n,r.data.attributes[n].url),A.current?.close()}catch{O(`We were unable to save your avatar.`)}finally{w(!1)}}},I=async()=>{C||T||(E(!0),(0,f.SweetestAlert)({type:`danger`,title:`Remove this logo?`,content:j===`light`?`Removing this logo means no logo will appear in light mode. This cannot be undone.`:o?`Removing this logo means your light mode logo will appear in dark mode. This cannot be undone.`:`Removing this logo means no logo will appear in dark mode. This cannot be undone.`,confirmButton:`Remove logo`,onConfirm:async()=>{try{await P({[`remove_${n}`]:`1`}),a(n,``),A.current?.close()}catch{O(`We were unable to delete your avatar.`)}finally{E(!1)}},onCancel:()=>{E(!1)}}))};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{className:`pco-org-avatar`,children:[(0,g.jsx)(`button`,{type:`button`,onClick:()=>A.current?.showModal(),disabled:i,className:`pco-org-avatar__button pco-org-avatar__button--${j}`,children:M?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`img`,{src:M,alt:`Church logo for ${t}`}),(0,g.jsx)(`div`,{className:`tds-btn tds-btn--interaction tds-btn--icononly`,children:(0,g.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,children:(0,g.jsx)(`path`,{d:p.pencil})})})]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`svg`,{width:`48`,height:`48`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,children:(0,g.jsx)(`path`,{d:m.image})}),(0,g.jsx)(`div`,{className:`tds-btn tds-btn--interaction tds-btn--icononly`,children:(0,g.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,children:(0,g.jsx)(`path`,{d:p.pencil})})})]})}),(0,g.jsxs)(`div`,{className:`pco-org-avatar__label`,children:[b(j),` mode`]})]}),(0,l.createPortal)((0,g.jsx)(`dialog`,{id:k,ref:A,className:`pco-org-avatar__dialog`,onClose:()=>{_(null),O(``)},children:(0,g.jsxs)(`form`,{onSubmit:F,children:[(0,g.jsxs)(`div`,{className:`pco-org-avatar__dialog-header`,children:[(0,g.jsxs)(`h1`,{className:`pco-org-avatar__dialog-title`,children:[`Church logo — `,j,` mode`]}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>A.current?.close(),className:`pco-org-avatar__dialog-close`,"aria-label":`Close modal`,children:(0,g.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,children:(0,g.jsx)(`path`,{d:p.smallX})})})]}),(0,g.jsxs)(`div`,{className:`pco-org-avatar__dialog-body`,children:[D&&(0,g.jsxs)(`div`,{role:`alert`,className:`pco-org-avatar-alert pco-org-avatar__dialog-alert`,children:[(0,g.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,className:`symbol`,"aria-hidden":`true`,children:(0,g.jsx)(`path`,{d:p.exclamationTriangle})}),(0,g.jsx)(`p`,{children:D})]}),(0,g.jsx)(h.default,{accept:{"image/*":[`.jpg`,`.jpeg`,`.png`]},multiple:!1,onDropAccepted:N,children:({getRootProps:e,getInputProps:n,isFocused:r,isDragAccept:i,isDragReject:a,isDragActive:o,open:c})=>(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{...e({className:v(`pco-org-avatar__dialog-dropzone`,`pco-org-avatar__dialog-dropzone--${j}`,{"pco-org-avatar__dialog-dropzone--image":s||M,"pco-org-avatar__dialog-dropzone--focused":r,"pco-org-avatar__dialog-dropzone--accepted":i,"pco-org-avatar__dialog-dropzone--rejected":o&&a})}),children:[(0,g.jsx)(`input`,{...n()}),s?(0,g.jsx)(`img`,{src:s.preview,alt:`Church logo for ${t}`}):M?(0,g.jsx)(`img`,{src:M,alt:`Church logo for ${t}`}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`svg`,{width:`64`,height:`64`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,g.jsx)(`path`,{d:p.toCloudArrow})}),o&&a?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`h2`,{children:`Wrong file type`}),(0,g.jsx)(`p`,{children:`Please upload a PNG or JPG file.`})]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(S,{open:c}),(0,g.jsx)(`p`,{className:`pco-org-avatar__instructions-sub`,children:`Use a high-quality image (up to 20mb) with a transparent background.`})]})]})]}),(s||M)&&(0,g.jsx)(S,{open:c})]})})]}),(0,g.jsxs)(`div`,{className:`pco-org-avatar__dialog-actions`,children:[e&&j===`light`&&(0,g.jsx)(d.Button,{label:`Remove logo`,kind:`secondary-delete`,onClick:I,loading:T,disabled:T||C,className:`pco-org-avatar__dialog-delete`}),e&&j===`dark`&&(0,g.jsx)(d.Button,{label:`Use light mode logo`,kind:`secondary`,onClick:I,loading:T,disabled:T||C,className:`pco-org-avatar__dialog-delete`}),(0,g.jsx)(d.Button,{type:`button`,label:`Cancel`,onClick:()=>A.current?.close(),disabled:C||T}),(0,g.jsx)(d.Button,{type:`submit`,label:`Update logo`,kind:`primary`,loading:C,disabled:!s||C||T})]})]})}),document.body)]})}function w({avatarUrl:e,darkModeAvatarUrl:t,orgName:n,onAvatarUpdate:r,pcoEnv:i,readOnly:a,showDarkModeAvatar:o=!1}){let[s,l]=(0,c.useState)(e),[u,d]=(0,c.useState)(t),f=(e,t)=>{e===`avatar`?(l(t),r?.(`avatar`,t)):e===`dark_mode_avatar`&&(d(t),r?.(`dark_mode_avatar`,t))};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{className:`pco-org-avatars`,children:[(0,g.jsx)(C,{avatarUrl:s,organization:n,mode:`avatar`,pcoEnv:i,readOnly:a,onAvatarUpdate:f}),o&&(0,g.jsx)(C,{avatarUrl:u,organization:n,mode:`dark_mode_avatar`,pcoEnv:i,readOnly:a,onAvatarUpdate:f,fallbackAvatarUrl:s})]}),o&&s&&!u&&(0,g.jsxs)(`div`,{className:`pco-org-avatar-alert`,children:[(0,g.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,className:`symbol`,"aria-hidden":`true`,children:(0,g.jsx)(`path`,{d:p.infoCircle})}),(0,g.jsx)(`p`,{children:`The same logo is being used for both light and dark modes.`})]})]})}exports.OrganizationAvatars=w;
package/dist/index.js CHANGED
@@ -1,404 +1,306 @@
1
- import { jsxs as r, Fragment as h, jsx as e } from "react/jsx-runtime";
2
- import { useState as _, useId as L, useRef as E, useEffect as W } from "react";
3
- import { createPortal as q } from "react-dom";
4
- import { pcoApiUrl as G } from "@planningcenter/url";
5
- import { Button as C } from "@planningcenter/tapestry";
6
- import { SweetestAlert as J } from "@planningcenter/sweetest-alert";
7
- import { pencil as T, smallX as X, exclamationTriangle as H, toCloudArrow as K, infoCircle as Q } from "@planningcenter/icons/paths/general";
8
- import { image as V } from "@planningcenter/icons/paths/services";
9
- import Y from "react-dropzone";
10
- function D(a) {
11
- var t, o, n = "";
12
- if (typeof a == "string" || typeof a == "number") n += a;
13
- else if (typeof a == "object") if (Array.isArray(a)) {
14
- var s = a.length;
15
- for (t = 0; t < s; t++) a[t] && (o = D(a[t])) && (n && (n += " "), n += o);
16
- } else for (o in a) a[o] && (n && (n += " "), n += o);
17
- return n;
1
+ import { useEffect as e, useId as t, useRef as n, useState as r } from "react";
2
+ import { createPortal as i } from "react-dom";
3
+ import { pcoApiUrl as a } from "@planningcenter/url";
4
+ import { Button as o } from "@planningcenter/tapestry";
5
+ import { SweetestAlert as s } from "@planningcenter/sweetest-alert";
6
+ import { exclamationTriangle as c, infoCircle as l, pencil as u, smallX as d, toCloudArrow as f } from "@planningcenter/icons/paths/general";
7
+ import { image as p } from "@planningcenter/icons/paths/services";
8
+ import m from "react-dropzone";
9
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
10
+ //#region node_modules/clsx/dist/clsx.mjs
11
+ function v(e) {
12
+ var t, n, r = "";
13
+ if (typeof e == "string" || typeof e == "number") r += e;
14
+ else if (typeof e == "object") if (Array.isArray(e)) {
15
+ var i = e.length;
16
+ for (t = 0; t < i; t++) e[t] && (n = v(e[t])) && (r && (r += " "), r += n);
17
+ } else for (n in e) e[n] && (r && (r += " "), r += n);
18
+ return r;
18
19
  }
19
- function Z() {
20
- for (var a, t, o = 0, n = "", s = arguments.length; o < s; o++) (a = arguments[o]) && (t = D(a)) && (n && (n += " "), n += t);
21
- return n;
20
+ function y() {
21
+ for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = v(e)) && (r && (r += " "), r += t);
22
+ return r;
22
23
  }
23
- function ee() {
24
- const a = document.querySelector('meta[name="csrf-token"]');
25
- if (!a || !a.content)
26
- throw new Error(
27
- 'CSRF token not found. Ensure your Rails application includes <meta name="csrf-token" content="..."> in the document head.'
28
- );
29
- return a.content;
24
+ //#endregion
25
+ //#region src/utils.ts
26
+ function b() {
27
+ let e = document.querySelector("meta[name=\"csrf-token\"]");
28
+ if (!e || !e.content) throw Error("CSRF token not found. Ensure your Rails application includes <meta name=\"csrf-token\" content=\"...\"> in the document head.");
29
+ return e.content;
30
30
  }
31
- function ae(a) {
32
- const t = a.split("");
33
- return [t.shift()?.toUpperCase(), t.join("")].join("");
31
+ function x(e) {
32
+ let t = e.split("");
33
+ return [t.shift()?.toUpperCase(), t.join("")].join("");
34
34
  }
35
- const oe = (a) => a === "dark_mode_avatar" ? "dark" : "light", B = ({ open: a }) => /* @__PURE__ */ r("h2", { className: "pco-org-avatar__instructions", children: [
36
- "Drag & drop your logo file to upload, or",
37
- " ",
38
- /* @__PURE__ */ e(
39
- C,
40
- {
41
- label: "browse",
42
- kind: "inline-text",
43
- onClick: (t) => {
44
- t.stopPropagation(), a();
45
- }
46
- }
47
- )
48
- ] });
49
- function F({
50
- avatarUrl: a,
51
- organization: t,
52
- mode: o,
53
- pcoEnv: n,
54
- readOnly: s,
55
- onAvatarUpdate: y,
56
- fallbackAvatarUrl: w
57
- }) {
58
- const [i, k] = _(null), [d, N] = _(!1), [c, m] = _(!1), [g, A] = _(""), M = L(), v = E(null), p = oe(o), f = a || w, P = (u) => {
59
- const [l] = u;
60
- l && k(
61
- Object.assign(l, {
62
- preview: URL.createObjectURL(l)
63
- })
64
- );
65
- };
66
- W(() => () => {
67
- i?.preview && (URL.revokeObjectURL(i.preview), A(""));
68
- }, [i]);
69
- const x = async (u) => {
70
- const l = await fetch(G("accounts", { env: n }), {
71
- method: "PATCH",
72
- headers: {
73
- "Content-Type": "application/json",
74
- "X-CSRF-Token": ee(),
75
- Accept: "application/json"
76
- },
77
- body: JSON.stringify({
78
- data: {
79
- attributes: u
80
- }
81
- })
82
- }), b = await l.json();
83
- if (!l.ok) throw b;
84
- return b;
85
- }, $ = async (u) => {
86
- if (u.preventDefault(), !(!i || d || c)) {
87
- N(!0);
88
- try {
89
- const l = new FileReader(), b = await new Promise((R, U) => {
90
- l.onloadend = () => R(l.result), l.onerror = U, l.readAsDataURL(i);
91
- }), j = await x({
92
- [o]: b,
93
- [`${o}_cache`]: ""
94
- });
95
- k(null), y(o, j.data.attributes[o].url), v.current?.close();
96
- } catch {
97
- A("We were unable to save your avatar.");
98
- } finally {
99
- N(!1);
100
- }
101
- }
102
- }, z = async () => {
103
- d || c || (m(!0), J({
104
- type: "danger",
105
- title: "Remove this logo?",
106
- content: p === "light" ? "Removing this logo means no logo will appear in light mode. This cannot be undone." : w ? "Removing this logo means your light mode logo will appear in dark mode. This cannot be undone." : "Removing this logo means no logo will appear in dark mode. This cannot be undone.",
107
- confirmButton: "Remove logo",
108
- onConfirm: async () => {
109
- try {
110
- await x({
111
- [`remove_${o}`]: "1"
112
- }), y(o, ""), v.current?.close();
113
- } catch {
114
- A("We were unable to delete your avatar.");
115
- } finally {
116
- m(!1);
117
- }
118
- },
119
- onCancel: () => {
120
- m(!1);
121
- }
122
- }));
123
- }, O = () => {
124
- k(null), A("");
125
- };
126
- return /* @__PURE__ */ r(h, { children: [
127
- /* @__PURE__ */ r("div", { className: "pco-org-avatar", children: [
128
- /* @__PURE__ */ e(
129
- "button",
130
- {
131
- type: "button",
132
- onClick: () => v.current?.showModal(),
133
- disabled: s,
134
- className: `pco-org-avatar__button pco-org-avatar__button--${p}`,
135
- children: f ? /* @__PURE__ */ r(h, { children: [
136
- /* @__PURE__ */ e("img", { src: f, alt: `Church logo for ${t}` }),
137
- /* @__PURE__ */ e("div", { className: "tds-btn tds-btn--interaction tds-btn--icononly", children: /* @__PURE__ */ e(
138
- "svg",
139
- {
140
- width: "14",
141
- height: "14",
142
- viewBox: "0 0 16 16",
143
- fill: "currentColor",
144
- "aria-hidden": "true",
145
- children: /* @__PURE__ */ e("path", { d: T })
146
- }
147
- ) })
148
- ] }) : /* @__PURE__ */ r(h, { children: [
149
- /* @__PURE__ */ e(
150
- "svg",
151
- {
152
- width: "48",
153
- height: "48",
154
- viewBox: "0 0 16 16",
155
- fill: "currentColor",
156
- "aria-hidden": "true",
157
- children: /* @__PURE__ */ e("path", { d: V })
158
- }
159
- ),
160
- /* @__PURE__ */ e("div", { className: "tds-btn tds-btn--interaction tds-btn--icononly", children: /* @__PURE__ */ e(
161
- "svg",
162
- {
163
- width: "14",
164
- height: "14",
165
- viewBox: "0 0 16 16",
166
- fill: "currentColor",
167
- "aria-hidden": "true",
168
- children: /* @__PURE__ */ e("path", { d: T })
169
- }
170
- ) })
171
- ] })
172
- }
173
- ),
174
- /* @__PURE__ */ r("div", { className: "pco-org-avatar__label", children: [
175
- ae(p),
176
- " mode"
177
- ] })
178
- ] }),
179
- q(
180
- /* @__PURE__ */ e(
181
- "dialog",
182
- {
183
- id: M,
184
- ref: v,
185
- className: "pco-org-avatar__dialog",
186
- onClose: O,
187
- children: /* @__PURE__ */ r("form", { onSubmit: $, children: [
188
- /* @__PURE__ */ r("div", { className: "pco-org-avatar__dialog-header", children: [
189
- /* @__PURE__ */ r("h1", { className: "pco-org-avatar__dialog-title", children: [
190
- "Church logo — ",
191
- p,
192
- " mode"
193
- ] }),
194
- /* @__PURE__ */ e(
195
- "button",
196
- {
197
- type: "button",
198
- onClick: () => v.current?.close(),
199
- className: "pco-org-avatar__dialog-close",
200
- "aria-label": "Close modal",
201
- children: /* @__PURE__ */ e(
202
- "svg",
203
- {
204
- width: "16",
205
- height: "16",
206
- viewBox: "0 0 16 16",
207
- fill: "currentColor",
208
- "aria-hidden": "true",
209
- children: /* @__PURE__ */ e("path", { d: X })
210
- }
211
- )
212
- }
213
- )
214
- ] }),
215
- /* @__PURE__ */ r("div", { className: "pco-org-avatar__dialog-body", children: [
216
- g && /* @__PURE__ */ r("div", { role: "alert", className: "pco-org-avatar-alert pco-org-avatar__dialog-alert", children: [
217
- /* @__PURE__ */ e(
218
- "svg",
219
- {
220
- width: "16",
221
- height: "16",
222
- viewBox: "0 0 16 16",
223
- className: "symbol",
224
- "aria-hidden": "true",
225
- children: /* @__PURE__ */ e("path", { d: H })
226
- }
227
- ),
228
- /* @__PURE__ */ e("p", { children: g })
229
- ] }),
230
- /* @__PURE__ */ e(
231
- Y,
232
- {
233
- accept: { "image/*": [".jpg", ".jpeg", ".png"] },
234
- multiple: !1,
235
- onDropAccepted: P,
236
- children: ({
237
- getRootProps: u,
238
- getInputProps: l,
239
- isFocused: b,
240
- isDragAccept: j,
241
- isDragReject: R,
242
- isDragActive: U,
243
- open: S
244
- }) => {
245
- const I = Z(
246
- "pco-org-avatar__dialog-dropzone",
247
- `pco-org-avatar__dialog-dropzone--${p}`,
248
- {
249
- "pco-org-avatar__dialog-dropzone--image": i || f,
250
- "pco-org-avatar__dialog-dropzone--focused": b,
251
- "pco-org-avatar__dialog-dropzone--accepted": j,
252
- "pco-org-avatar__dialog-dropzone--rejected": U && R
253
- }
254
- );
255
- return /* @__PURE__ */ r(h, { children: [
256
- /* @__PURE__ */ r("div", { ...u({ className: I }), children: [
257
- /* @__PURE__ */ e("input", { ...l() }),
258
- i ? /* @__PURE__ */ e(
259
- "img",
260
- {
261
- src: i.preview,
262
- alt: `Church logo for ${t}`
263
- }
264
- ) : f ? /* @__PURE__ */ e(
265
- "img",
266
- {
267
- src: f,
268
- alt: `Church logo for ${t}`
269
- }
270
- ) : /* @__PURE__ */ r(h, { children: [
271
- /* @__PURE__ */ e(
272
- "svg",
273
- {
274
- width: "64",
275
- height: "64",
276
- viewBox: "0 0 16 16",
277
- "aria-hidden": "true",
278
- children: /* @__PURE__ */ e("path", { d: K })
279
- }
280
- ),
281
- U && R ? /* @__PURE__ */ r(h, { children: [
282
- /* @__PURE__ */ e("h2", { children: "Wrong file type" }),
283
- /* @__PURE__ */ e("p", { children: "Please upload a PNG or JPG file." })
284
- ] }) : /* @__PURE__ */ r(h, { children: [
285
- /* @__PURE__ */ e(B, { open: S }),
286
- /* @__PURE__ */ e("p", { className: "pco-org-avatar__instructions-sub", children: "Use a high-quality image (up to 20mb) with a transparent background." })
287
- ] })
288
- ] })
289
- ] }),
290
- (i || f) && /* @__PURE__ */ e(B, { open: S })
291
- ] });
292
- }
293
- }
294
- )
295
- ] }),
296
- /* @__PURE__ */ r("div", { className: "pco-org-avatar__dialog-actions", children: [
297
- a && p === "light" && /* @__PURE__ */ e(
298
- C,
299
- {
300
- label: "Remove logo",
301
- kind: "secondary-delete",
302
- onClick: z,
303
- loading: c,
304
- disabled: c || d,
305
- className: "pco-org-avatar__dialog-delete"
306
- }
307
- ),
308
- a && p === "dark" && /* @__PURE__ */ e(
309
- C,
310
- {
311
- label: "Use light mode logo",
312
- kind: "secondary",
313
- onClick: z,
314
- loading: c,
315
- disabled: c || d,
316
- className: "pco-org-avatar__dialog-delete"
317
- }
318
- ),
319
- /* @__PURE__ */ e(
320
- C,
321
- {
322
- type: "button",
323
- label: "Cancel",
324
- onClick: () => v.current?.close(),
325
- disabled: d || c
326
- }
327
- ),
328
- /* @__PURE__ */ e(
329
- C,
330
- {
331
- type: "submit",
332
- label: "Update logo",
333
- kind: "primary",
334
- loading: d,
335
- disabled: !i || d || c
336
- }
337
- )
338
- ] })
339
- ] })
340
- }
341
- ),
342
- document.body
343
- )
344
- ] });
35
+ //#endregion
36
+ //#region src/organization_avatar.tsx
37
+ var S = (e) => e === "dark_mode_avatar" ? "dark" : "light", C = ({ open: e }) => /* @__PURE__ */ _("h2", {
38
+ className: "pco-org-avatar__instructions",
39
+ children: [
40
+ "Drag & drop your logo file to upload, or",
41
+ " ",
42
+ /* @__PURE__ */ g(o, {
43
+ label: "browse",
44
+ kind: "inline-text",
45
+ onClick: (t) => {
46
+ t.stopPropagation(), e();
47
+ }
48
+ })
49
+ ]
50
+ });
51
+ function w({ avatarUrl: l, organization: v, mode: w, pcoEnv: T, readOnly: E, onAvatarUpdate: D, fallbackAvatarUrl: O }) {
52
+ let [k, A] = r(null), [j, M] = r(!1), [N, P] = r(!1), [F, I] = r(""), L = t(), R = n(null), z = S(w), B = l || O, V = (e) => {
53
+ let [t] = e;
54
+ t && A(Object.assign(t, { preview: URL.createObjectURL(t) }));
55
+ };
56
+ e(() => () => {
57
+ k?.preview && (URL.revokeObjectURL(k.preview), I(""));
58
+ }, [k]);
59
+ let H = async (e) => {
60
+ let t = await fetch(a("accounts", { env: T }), {
61
+ method: "PATCH",
62
+ headers: {
63
+ "Content-Type": "application/json",
64
+ "X-CSRF-Token": b(),
65
+ Accept: "application/json"
66
+ },
67
+ body: JSON.stringify({ data: { attributes: e } })
68
+ }), n = await t.json();
69
+ if (!t.ok) throw n;
70
+ return n;
71
+ }, U = async (e) => {
72
+ if (e.preventDefault(), !(!k || j || N)) {
73
+ M(!0);
74
+ try {
75
+ let e = new FileReader(), t = await new Promise((t, n) => {
76
+ e.onloadend = () => t(e.result), e.onerror = n, e.readAsDataURL(k);
77
+ }), n = await H({
78
+ [w]: t,
79
+ [`${w}_cache`]: ""
80
+ });
81
+ A(null), D(w, n.data.attributes[w].url), R.current?.close();
82
+ } catch {
83
+ I("We were unable to save your avatar.");
84
+ } finally {
85
+ M(!1);
86
+ }
87
+ }
88
+ }, W = async () => {
89
+ j || N || (P(!0), s({
90
+ type: "danger",
91
+ title: "Remove this logo?",
92
+ content: z === "light" ? "Removing this logo means no logo will appear in light mode. This cannot be undone." : O ? "Removing this logo means your light mode logo will appear in dark mode. This cannot be undone." : "Removing this logo means no logo will appear in dark mode. This cannot be undone.",
93
+ confirmButton: "Remove logo",
94
+ onConfirm: async () => {
95
+ try {
96
+ await H({ [`remove_${w}`]: "1" }), D(w, ""), R.current?.close();
97
+ } catch {
98
+ I("We were unable to delete your avatar.");
99
+ } finally {
100
+ P(!1);
101
+ }
102
+ },
103
+ onCancel: () => {
104
+ P(!1);
105
+ }
106
+ }));
107
+ };
108
+ return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _("div", {
109
+ className: "pco-org-avatar",
110
+ children: [/* @__PURE__ */ g("button", {
111
+ type: "button",
112
+ onClick: () => R.current?.showModal(),
113
+ disabled: E,
114
+ className: `pco-org-avatar__button pco-org-avatar__button--${z}`,
115
+ children: B ? /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("img", {
116
+ src: B,
117
+ alt: `Church logo for ${v}`
118
+ }), /* @__PURE__ */ g("div", {
119
+ className: "tds-btn tds-btn--interaction tds-btn--icononly",
120
+ children: /* @__PURE__ */ g("svg", {
121
+ width: "14",
122
+ height: "14",
123
+ viewBox: "0 0 16 16",
124
+ fill: "currentColor",
125
+ "aria-hidden": "true",
126
+ children: /* @__PURE__ */ g("path", { d: u })
127
+ })
128
+ })] }) : /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("svg", {
129
+ width: "48",
130
+ height: "48",
131
+ viewBox: "0 0 16 16",
132
+ fill: "currentColor",
133
+ "aria-hidden": "true",
134
+ children: /* @__PURE__ */ g("path", { d: p })
135
+ }), /* @__PURE__ */ g("div", {
136
+ className: "tds-btn tds-btn--interaction tds-btn--icononly",
137
+ children: /* @__PURE__ */ g("svg", {
138
+ width: "14",
139
+ height: "14",
140
+ viewBox: "0 0 16 16",
141
+ fill: "currentColor",
142
+ "aria-hidden": "true",
143
+ children: /* @__PURE__ */ g("path", { d: u })
144
+ })
145
+ })] })
146
+ }), /* @__PURE__ */ _("div", {
147
+ className: "pco-org-avatar__label",
148
+ children: [x(z), " mode"]
149
+ })]
150
+ }), i(/* @__PURE__ */ g("dialog", {
151
+ id: L,
152
+ ref: R,
153
+ className: "pco-org-avatar__dialog",
154
+ onClose: () => {
155
+ A(null), I("");
156
+ },
157
+ children: /* @__PURE__ */ _("form", {
158
+ onSubmit: U,
159
+ children: [
160
+ /* @__PURE__ */ _("div", {
161
+ className: "pco-org-avatar__dialog-header",
162
+ children: [/* @__PURE__ */ _("h1", {
163
+ className: "pco-org-avatar__dialog-title",
164
+ children: [
165
+ "Church logo ",
166
+ z,
167
+ " mode"
168
+ ]
169
+ }), /* @__PURE__ */ g("button", {
170
+ type: "button",
171
+ onClick: () => R.current?.close(),
172
+ className: "pco-org-avatar__dialog-close",
173
+ "aria-label": "Close modal",
174
+ children: /* @__PURE__ */ g("svg", {
175
+ width: "16",
176
+ height: "16",
177
+ viewBox: "0 0 16 16",
178
+ fill: "currentColor",
179
+ "aria-hidden": "true",
180
+ children: /* @__PURE__ */ g("path", { d })
181
+ })
182
+ })]
183
+ }),
184
+ /* @__PURE__ */ _("div", {
185
+ className: "pco-org-avatar__dialog-body",
186
+ children: [F && /* @__PURE__ */ _("div", {
187
+ role: "alert",
188
+ className: "pco-org-avatar-alert pco-org-avatar__dialog-alert",
189
+ children: [/* @__PURE__ */ g("svg", {
190
+ width: "16",
191
+ height: "16",
192
+ viewBox: "0 0 16 16",
193
+ className: "symbol",
194
+ "aria-hidden": "true",
195
+ children: /* @__PURE__ */ g("path", { d: c })
196
+ }), /* @__PURE__ */ g("p", { children: F })]
197
+ }), /* @__PURE__ */ g(m, {
198
+ accept: { "image/*": [
199
+ ".jpg",
200
+ ".jpeg",
201
+ ".png"
202
+ ] },
203
+ multiple: !1,
204
+ onDropAccepted: V,
205
+ children: ({ getRootProps: e, getInputProps: t, isFocused: n, isDragAccept: r, isDragReject: i, isDragActive: a, open: o }) => /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _("div", {
206
+ ...e({ className: y("pco-org-avatar__dialog-dropzone", `pco-org-avatar__dialog-dropzone--${z}`, {
207
+ "pco-org-avatar__dialog-dropzone--image": k || B,
208
+ "pco-org-avatar__dialog-dropzone--focused": n,
209
+ "pco-org-avatar__dialog-dropzone--accepted": r,
210
+ "pco-org-avatar__dialog-dropzone--rejected": a && i
211
+ }) }),
212
+ children: [/* @__PURE__ */ g("input", { ...t() }), k ? /* @__PURE__ */ g("img", {
213
+ src: k.preview,
214
+ alt: `Church logo for ${v}`
215
+ }) : B ? /* @__PURE__ */ g("img", {
216
+ src: B,
217
+ alt: `Church logo for ${v}`
218
+ }) : /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("svg", {
219
+ width: "64",
220
+ height: "64",
221
+ viewBox: "0 0 16 16",
222
+ "aria-hidden": "true",
223
+ children: /* @__PURE__ */ g("path", { d: f })
224
+ }), a && i ? /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("h2", { children: "Wrong file type" }), /* @__PURE__ */ g("p", { children: "Please upload a PNG or JPG file." })] }) : /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(C, { open: o }), /* @__PURE__ */ g("p", {
225
+ className: "pco-org-avatar__instructions-sub",
226
+ children: "Use a high-quality image (up to 20mb) with a transparent background."
227
+ })] })] })]
228
+ }), (k || B) && /* @__PURE__ */ g(C, { open: o })] })
229
+ })]
230
+ }),
231
+ /* @__PURE__ */ _("div", {
232
+ className: "pco-org-avatar__dialog-actions",
233
+ children: [
234
+ l && z === "light" && /* @__PURE__ */ g(o, {
235
+ label: "Remove logo",
236
+ kind: "secondary-delete",
237
+ onClick: W,
238
+ loading: N,
239
+ disabled: N || j,
240
+ className: "pco-org-avatar__dialog-delete"
241
+ }),
242
+ l && z === "dark" && /* @__PURE__ */ g(o, {
243
+ label: "Use light mode logo",
244
+ kind: "secondary",
245
+ onClick: W,
246
+ loading: N,
247
+ disabled: N || j,
248
+ className: "pco-org-avatar__dialog-delete"
249
+ }),
250
+ /* @__PURE__ */ g(o, {
251
+ type: "button",
252
+ label: "Cancel",
253
+ onClick: () => R.current?.close(),
254
+ disabled: j || N
255
+ }),
256
+ /* @__PURE__ */ g(o, {
257
+ type: "submit",
258
+ label: "Update logo",
259
+ kind: "primary",
260
+ loading: j,
261
+ disabled: !k || j || N
262
+ })
263
+ ]
264
+ })
265
+ ]
266
+ })
267
+ }), document.body)] });
345
268
  }
346
- function ge({
347
- avatarUrl: a,
348
- darkModeAvatarUrl: t,
349
- orgName: o,
350
- onAvatarUpdate: n,
351
- pcoEnv: s,
352
- readOnly: y,
353
- showDarkModeAvatar: w = !1
354
- }) {
355
- const [i, k] = _(a), [d, N] = _(
356
- t
357
- ), c = (m, g) => {
358
- m === "avatar" ? (k(g), n?.("avatar", g)) : m === "dark_mode_avatar" && (N(g), n?.("dark_mode_avatar", g));
359
- };
360
- return /* @__PURE__ */ r(h, { children: [
361
- /* @__PURE__ */ r("div", { className: "pco-org-avatars", children: [
362
- /* @__PURE__ */ e(
363
- F,
364
- {
365
- avatarUrl: i,
366
- organization: o,
367
- mode: "avatar",
368
- pcoEnv: s,
369
- readOnly: y,
370
- onAvatarUpdate: c
371
- }
372
- ),
373
- w && /* @__PURE__ */ e(
374
- F,
375
- {
376
- avatarUrl: d,
377
- organization: o,
378
- mode: "dark_mode_avatar",
379
- pcoEnv: s,
380
- readOnly: y,
381
- onAvatarUpdate: c,
382
- fallbackAvatarUrl: i
383
- }
384
- )
385
- ] }),
386
- w && i && !d && /* @__PURE__ */ r("div", { className: "pco-org-avatar-alert", children: [
387
- /* @__PURE__ */ e(
388
- "svg",
389
- {
390
- width: "16",
391
- height: "16",
392
- viewBox: "0 0 16 16",
393
- className: "symbol",
394
- "aria-hidden": "true",
395
- children: /* @__PURE__ */ e("path", { d: Q })
396
- }
397
- ),
398
- /* @__PURE__ */ e("p", { children: "The same logo is being used for both light and dark modes." })
399
- ] })
400
- ] });
269
+ //#endregion
270
+ //#region src/organization_avatars.tsx
271
+ function T({ avatarUrl: e, darkModeAvatarUrl: t, orgName: n, onAvatarUpdate: i, pcoEnv: a, readOnly: o, showDarkModeAvatar: s = !1 }) {
272
+ let [c, u] = r(e), [d, f] = r(t), p = (e, t) => {
273
+ e === "avatar" ? (u(t), i?.("avatar", t)) : e === "dark_mode_avatar" && (f(t), i?.("dark_mode_avatar", t));
274
+ };
275
+ return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _("div", {
276
+ className: "pco-org-avatars",
277
+ children: [/* @__PURE__ */ g(w, {
278
+ avatarUrl: c,
279
+ organization: n,
280
+ mode: "avatar",
281
+ pcoEnv: a,
282
+ readOnly: o,
283
+ onAvatarUpdate: p
284
+ }), s && /* @__PURE__ */ g(w, {
285
+ avatarUrl: d,
286
+ organization: n,
287
+ mode: "dark_mode_avatar",
288
+ pcoEnv: a,
289
+ readOnly: o,
290
+ onAvatarUpdate: p,
291
+ fallbackAvatarUrl: c
292
+ })]
293
+ }), s && c && !d && /* @__PURE__ */ _("div", {
294
+ className: "pco-org-avatar-alert",
295
+ children: [/* @__PURE__ */ g("svg", {
296
+ width: "16",
297
+ height: "16",
298
+ viewBox: "0 0 16 16",
299
+ className: "symbol",
300
+ "aria-hidden": "true",
301
+ children: /* @__PURE__ */ g("path", { d: l })
302
+ }), /* @__PURE__ */ g("p", { children: "The same logo is being used for both light and dark modes." })]
303
+ })] });
401
304
  }
402
- export {
403
- ge as OrganizationAvatars
404
- };
305
+ //#endregion
306
+ export { T as OrganizationAvatars };
@@ -0,0 +1 @@
1
+ import "@testing-library/jest-dom/vitest";
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@planningcenter/organization-avatars",
3
- "version": "1.8.4",
3
+ "version": "1.10.1",
4
4
  "description": "Organization avatar upload components for Planning Center apps",
5
5
  "type": "module",
6
- "packageManager": "yarn@1.22.22",
6
+ "packageManager": "yarn@4.16.0+sha512.5374c94eb4ef6aa8188fb112f20c1aa6569f248d676c5e576e1fd2a1a4d8d87a96df65d9dfe1c2a0252cbe38bda46cf18d955005b81b43cc7607a5c9d56fd2b6",
7
7
  "main": "./dist/index.cjs",
8
8
  "module": "./dist/index.js",
9
9
  "types": "./dist/index.d.ts",
@@ -24,15 +24,15 @@
24
24
  "build": "rm -rf dist/ && vite build && tsc && cp src/organization_avatar.css dist/style.css",
25
25
  "lint": "eslint src",
26
26
  "lint:fix": "eslint src --fix",
27
- "test": "exit 0"
27
+ "test": "vitest run"
28
28
  },
29
29
  "dependencies": {
30
30
  "clsx": "^2.1.1"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@planningcenter/icons": "^15.29.1",
34
- "@planningcenter/sweetest-alert": "^1.0.1",
35
- "@planningcenter/tapestry": "^2.10.1",
34
+ "@planningcenter/sweetest-alert": "^1.2.0",
35
+ "@planningcenter/tapestry": "^3.2.1",
36
36
  "@planningcenter/url": "^3.2.0",
37
37
  "react": "^18.3.0",
38
38
  "react-dom": "^18.3.0",
@@ -43,18 +43,25 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@planningcenter/icons": "^15.29.1",
46
- "@planningcenter/sweetest-alert": "^1.0.1",
47
- "@planningcenter/tapestry": "^2.10.1",
46
+ "@planningcenter/sweetest-alert": "^1.2.0",
47
+ "@planningcenter/tapestry": "^3.2.1",
48
48
  "@planningcenter/url": "^3.2.0",
49
+ "@testing-library/dom": "^10.4.1",
50
+ "@testing-library/jest-dom": "^6.9.1",
51
+ "@testing-library/react": "^16.3.2",
52
+ "@testing-library/user-event": "^14.6.1",
49
53
  "@types/react": "^18.3.0",
50
54
  "@types/react-dom": "^18.3.0",
51
- "@typescript-eslint/eslint-plugin": "^8.54.0",
52
- "@typescript-eslint/parser": "^8.54.0",
53
- "eslint": "^9.39.2",
55
+ "@typescript-eslint/eslint-plugin": "^8.58.1",
56
+ "@typescript-eslint/parser": "^8.58.1",
57
+ "@vitejs/plugin-react": "^6.0.1",
58
+ "eslint": "^10.2.0",
59
+ "jsdom": "^29.0.2",
54
60
  "react": "^18.3.0",
55
61
  "react-dom": "^18.3.0",
56
62
  "react-dropzone": "^14.0.0",
57
63
  "typescript": "^5.9.3",
58
- "vite": "^7.3.1"
64
+ "vite": "^8.0.7",
65
+ "vitest": "^4.1.4"
59
66
  }
60
67
  }