@planningcenter/sweetest-alert 1.6.4 → 1.8.0

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/README.md CHANGED
@@ -19,8 +19,8 @@ In your product’s main CSS file (ex. `app/assets/stylesheets/application.css`)
19
19
 
20
20
  This package requires the following peer dependencies:
21
21
 
22
- - `react` ^18.3.1
23
- - `react-dom` ^18.3.1
22
+ - `react` ^18.3.1 || ^19.0.0
23
+ - `react-dom` ^18.3.1 || ^19.0.0
24
24
  - `@planningcenter/tapestry` ^2.10.1 || ^3.0.0
25
25
  - `@planningcenter/icons` ^15.29.1
26
26
 
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);require("react");let t=require("@planningcenter/tapestry"),n=require("react/jsx-runtime");var r=e((e=>{var t=require("react-dom");if(process.env.NODE_ENV===`production`)e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot;else{var n=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;e.createRoot=function(e,r){n.usingClientEntryPoint=!0;try{return t.createRoot(e,r)}finally{n.usingClientEntryPoint=!1}},e.hydrateRoot=function(e,r,i){n.usingClientEntryPoint=!0;try{return t.hydrateRoot(e,r,i)}finally{n.usingClientEntryPoint=!1}}}}))(),i=`M8,0c4.41828,0 8,3.58172 8,8c0,4.41828 -3.58172,8 -8,8c-4.41828,0 -8,-3.58172 -8,-8c0,-4.41828 3.58172,-8 8,-8M12.57,6.07l-1.14,-1.14l-4.43,4.44l-2.43,-2.44l-1.14,1.14l3.57,3.56z`,a=`M15.669,13.676c0.13528,0.2343 0.13541,0.52294 0.00036,0.75737c-0.13505,0.23443 -0.38481,0.37911 -0.65536,0.37963h-14.028c-0.27081,0.0001 -0.52105,-0.14447 -0.65623,-0.37913c-0.13518,-0.23466 -0.13471,-0.52366 0.00123,-0.75787l7.014,-12.115c0.13497,-0.23419 0.3847,-0.37849 0.655,-0.37849c0.2703,0 0.52003,0.14431 0.655,0.37849l7.014,12.115M8.757,11.028h-1.514v1.514h1.514zM8.757,6.485h-1.514v3.029h1.514z`,o=`M8.8,4h-1.6v1.6h1.6zM8.8,7.2h-1.6v4.8h1.6zM8,0c4.41828,0 8,3.58172 8,8c0,4.41828 -3.58172,8 -8,8c-4.41828,0 -8,-3.58172 -8,-8c0,-4.41828 3.58172,-8 8,-8`,s=`M11.395,10.262l-2.262,-2.262l2.262,-2.262l-1.132,-1.132l-2.262,2.262l-2.263,-2.262l-1.131,1.132l2.262,2.262l-2.262,2.262l1.131,1.132l2.263,-2.262l2.262,2.262zM13.659,2.343c3.12218,3.12514 3.12218,8.18886 0,11.314c-2.28834,2.28863 -5.73017,2.97305 -8.72,1.734c-2.99134,-1.23749 -4.94222,-4.15558 -4.94244,-7.39278c-0.00022,-3.2372 1.95027,-6.15555 4.94143,-7.39345c2.99117,-1.2379 6.43353,-0.55139 8.72101,1.73923`;function c(){let e;return{promise:new Promise(t=>{e=t}),resolve:e}}function l({onCancel:e,onConfirm:l,confirmButton:u=`Okay`,content:d,hideCancel:f=!1,title:p,type:m=`warning`}){let h=document.createElement(`dialog`);h.className=`pco-sweetest-alert`,document.body.appendChild(h);let g=(0,r.createRoot)(h),_=!1,{promise:v,resolve:y}=c(),b=()=>{_||(_=!0,y({isConfirmed:!1,isDismissed:!0}),g.unmount(),document.body.removeChild(h))},x=()=>{_||(y({isConfirmed:!0,isDismissed:!1}),b(),l?.())},S=()=>{_||(y({isConfirmed:!1,isDismissed:!0}),b(),e?.())};return g.render((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`svg`,{className:`pco-sweetest-alert__icon pco-sweetest-alert--${m}`,width:`48`,height:`48`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,n.jsx)(`path`,{d:(()=>{switch(m){case`success`:return i;case`error`:return s;case`info`:return o;case`danger`:case`warning`:return a}})()})}),(0,n.jsx)(`h2`,{className:`pco-sweetest-alert__title`,children:p}),(0,n.jsx)(`div`,{className:`pco-sweetest-alert__body`,children:typeof d==`string`?(0,n.jsx)(`p`,{children:d}):d}),(0,n.jsxs)(`div`,{className:`pco-sweetest-alert__actions`,children:[!f&&(0,n.jsx)(t.Button,{label:`Cancel`,kind:`ghost`,onClick:S}),(0,n.jsx)(t.Button,{label:u,kind:m===`danger`?`delete`:`primary`,onClick:x})]})]})),h.showModal(),h.addEventListener(`close`,S),Object.assign(v,{show:()=>h.showModal(),close:()=>h.close(),cleanup:b})}exports.SweetestAlert=l;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("react");let e=require("react-dom/client"),t=require("@planningcenter/tapestry"),n=require("react/jsx-runtime");var r=`M8,0c4.41828,0 8,3.58172 8,8c0,4.41828 -3.58172,8 -8,8c-4.41828,0 -8,-3.58172 -8,-8c0,-4.41828 3.58172,-8 8,-8M12.57,6.07l-1.14,-1.14l-4.43,4.44l-2.43,-2.44l-1.14,1.14l3.57,3.56z`,i=`M15.669,13.676c0.13528,0.2343 0.13541,0.52294 0.00036,0.75737c-0.13505,0.23443 -0.38481,0.37911 -0.65536,0.37963h-14.028c-0.27081,0.0001 -0.52105,-0.14447 -0.65623,-0.37913c-0.13518,-0.23466 -0.13471,-0.52366 0.00123,-0.75787l7.014,-12.115c0.13497,-0.23419 0.3847,-0.37849 0.655,-0.37849c0.2703,0 0.52003,0.14431 0.655,0.37849l7.014,12.115M8.757,11.028h-1.514v1.514h1.514zM8.757,6.485h-1.514v3.029h1.514z`,a=`M8.8,4h-1.6v1.6h1.6zM8.8,7.2h-1.6v4.8h1.6zM8,0c4.41828,0 8,3.58172 8,8c0,4.41828 -3.58172,8 -8,8c-4.41828,0 -8,-3.58172 -8,-8c0,-4.41828 3.58172,-8 8,-8`,o=`M11.395,10.262l-2.262,-2.262l2.262,-2.262l-1.132,-1.132l-2.262,2.262l-2.263,-2.262l-1.131,1.132l2.262,2.262l-2.262,2.262l1.131,1.132l2.263,-2.262l2.262,2.262zM13.659,2.343c3.12218,3.12514 3.12218,8.18886 0,11.314c-2.28834,2.28863 -5.73017,2.97305 -8.72,1.734c-2.99134,-1.23749 -4.94222,-4.15558 -4.94244,-7.39278c-0.00022,-3.2372 1.95027,-6.15555 4.94143,-7.39345c2.99117,-1.2379 6.43353,-0.55139 8.72101,1.73923`;function s(){let e;return{promise:new Promise(t=>{e=t}),resolve:e}}function c({onCancel:c,onConfirm:l,confirmButton:u=`Okay`,content:d,hideCancel:f=!1,title:p,type:m=`warning`}){let h=document.createElement(`dialog`);h.className=`pco-sweetest-alert`,document.body.appendChild(h);let g=(0,e.createRoot)(h),_=!1,{promise:v,resolve:y}=s(),b=()=>{_||(_=!0,y({isConfirmed:!1,isDismissed:!0}),g.unmount(),document.body.removeChild(h))},x=()=>{_||(y({isConfirmed:!0,isDismissed:!1}),b(),l?.())},S=()=>{_||(y({isConfirmed:!1,isDismissed:!0}),b(),c?.())};return g.render((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`svg`,{className:`pco-sweetest-alert__icon pco-sweetest-alert--${m}`,width:`48`,height:`48`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,n.jsx)(`path`,{d:(()=>{switch(m){case`success`:return r;case`error`:return o;case`info`:return a;case`danger`:case`warning`:return i}})()})}),(0,n.jsx)(`h2`,{className:`pco-sweetest-alert__title`,children:p}),(0,n.jsx)(`div`,{className:`pco-sweetest-alert__body`,children:typeof d==`string`?(0,n.jsx)(`p`,{children:d}):d}),(0,n.jsxs)(`div`,{className:`pco-sweetest-alert__actions`,children:[!f&&(0,n.jsx)(t.Button,{label:`Cancel`,kind:`ghost`,onClick:S}),(0,n.jsx)(t.Button,{label:u,kind:m===`danger`?`delete`:`primary`,onClick:x})]})]})),h.showModal(),h.addEventListener(`close`,S),Object.assign(v,{show:()=>h.showModal(),close:()=>h.close(),cleanup:b})}exports.SweetestAlert=c;
package/dist/index.js CHANGED
@@ -1,35 +1,12 @@
1
1
  import "react";
2
- import { Button as e } from "@planningcenter/tapestry";
3
- import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
4
- //#region \0rolldown/runtime.js
5
- var i = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), a = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
6
- if (typeof require < "u") return require.apply(this, arguments);
7
- throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
8
- }), o = (/* @__PURE__ */ i(((e) => {
9
- var t = a("react-dom");
10
- if (process.env.NODE_ENV === "production") e.createRoot = t.createRoot, e.hydrateRoot = t.hydrateRoot;
11
- else {
12
- var n = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
13
- e.createRoot = function(e, r) {
14
- n.usingClientEntryPoint = !0;
15
- try {
16
- return t.createRoot(e, r);
17
- } finally {
18
- n.usingClientEntryPoint = !1;
19
- }
20
- }, e.hydrateRoot = function(e, r, i) {
21
- n.usingClientEntryPoint = !0;
22
- try {
23
- return t.hydrateRoot(e, r, i);
24
- } finally {
25
- n.usingClientEntryPoint = !1;
26
- }
27
- };
28
- }
29
- })))(), s = "M8,0c4.41828,0 8,3.58172 8,8c0,4.41828 -3.58172,8 -8,8c-4.41828,0 -8,-3.58172 -8,-8c0,-4.41828 3.58172,-8 8,-8M12.57,6.07l-1.14,-1.14l-4.43,4.44l-2.43,-2.44l-1.14,1.14l3.57,3.56z", c = "M15.669,13.676c0.13528,0.2343 0.13541,0.52294 0.00036,0.75737c-0.13505,0.23443 -0.38481,0.37911 -0.65536,0.37963h-14.028c-0.27081,0.0001 -0.52105,-0.14447 -0.65623,-0.37913c-0.13518,-0.23466 -0.13471,-0.52366 0.00123,-0.75787l7.014,-12.115c0.13497,-0.23419 0.3847,-0.37849 0.655,-0.37849c0.2703,0 0.52003,0.14431 0.655,0.37849l7.014,12.115M8.757,11.028h-1.514v1.514h1.514zM8.757,6.485h-1.514v3.029h1.514z", l = "M8.8,4h-1.6v1.6h1.6zM8.8,7.2h-1.6v4.8h1.6zM8,0c4.41828,0 8,3.58172 8,8c0,4.41828 -3.58172,8 -8,8c-4.41828,0 -8,-3.58172 -8,-8c0,-4.41828 3.58172,-8 8,-8", u = "M11.395,10.262l-2.262,-2.262l2.262,-2.262l-1.132,-1.132l-2.262,2.262l-2.263,-2.262l-1.131,1.132l2.262,2.262l-2.262,2.262l1.131,1.132l2.263,-2.262l2.262,2.262zM13.659,2.343c3.12218,3.12514 3.12218,8.18886 0,11.314c-2.28834,2.28863 -5.73017,2.97305 -8.72,1.734c-2.99134,-1.23749 -4.94222,-4.15558 -4.94244,-7.39278c-0.00022,-3.2372 1.95027,-6.15555 4.94143,-7.39345c2.99117,-1.2379 6.43353,-0.55139 8.72101,1.73923";
2
+ import { createRoot as e } from "react-dom/client";
3
+ import { Button as t } from "@planningcenter/tapestry";
4
+ import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ //#region node_modules/@planningcenter/icons/paths/general.mjs
6
+ var a = "M8,0c4.41828,0 8,3.58172 8,8c0,4.41828 -3.58172,8 -8,8c-4.41828,0 -8,-3.58172 -8,-8c0,-4.41828 3.58172,-8 8,-8M12.57,6.07l-1.14,-1.14l-4.43,4.44l-2.43,-2.44l-1.14,1.14l3.57,3.56z", o = "M15.669,13.676c0.13528,0.2343 0.13541,0.52294 0.00036,0.75737c-0.13505,0.23443 -0.38481,0.37911 -0.65536,0.37963h-14.028c-0.27081,0.0001 -0.52105,-0.14447 -0.65623,-0.37913c-0.13518,-0.23466 -0.13471,-0.52366 0.00123,-0.75787l7.014,-12.115c0.13497,-0.23419 0.3847,-0.37849 0.655,-0.37849c0.2703,0 0.52003,0.14431 0.655,0.37849l7.014,12.115M8.757,11.028h-1.514v1.514h1.514zM8.757,6.485h-1.514v3.029h1.514z", s = "M8.8,4h-1.6v1.6h1.6zM8.8,7.2h-1.6v4.8h1.6zM8,0c4.41828,0 8,3.58172 8,8c0,4.41828 -3.58172,8 -8,8c-4.41828,0 -8,-3.58172 -8,-8c0,-4.41828 3.58172,-8 8,-8", c = "M11.395,10.262l-2.262,-2.262l2.262,-2.262l-1.132,-1.132l-2.262,2.262l-2.263,-2.262l-1.131,1.132l2.262,2.262l-2.262,2.262l1.131,1.132l2.263,-2.262l2.262,2.262zM13.659,2.343c3.12218,3.12514 3.12218,8.18886 0,11.314c-2.28834,2.28863 -5.73017,2.97305 -8.72,1.734c-2.99134,-1.23749 -4.94222,-4.15558 -4.94244,-7.39278c-0.00022,-3.2372 1.95027,-6.15555 4.94143,-7.39345c2.99117,-1.2379 6.43353,-0.55139 8.72101,1.73923";
30
7
  //#endregion
31
8
  //#region src/sweetest_alert.tsx
32
- function d() {
9
+ function l() {
33
10
  let e;
34
11
  return {
35
12
  promise: new Promise((t) => {
@@ -38,10 +15,10 @@ function d() {
38
15
  resolve: e
39
16
  };
40
17
  }
41
- function f({ onCancel: i, onConfirm: a, confirmButton: f = "Okay", content: p, hideCancel: m = !1, title: h, type: g = "warning" }) {
18
+ function u({ onCancel: u, onConfirm: d, confirmButton: f = "Okay", content: p, hideCancel: m = !1, title: h, type: g = "warning" }) {
42
19
  let _ = document.createElement("dialog");
43
20
  _.className = "pco-sweetest-alert", document.body.appendChild(_);
44
- let v = (0, o.createRoot)(_), y = !1, { promise: b, resolve: x } = d(), S = () => {
21
+ let v = e(_), y = !1, { promise: b, resolve: x } = l(), S = () => {
45
22
  y || (y = !0, x({
46
23
  isConfirmed: !1,
47
24
  isDismissed: !0
@@ -50,45 +27,45 @@ function f({ onCancel: i, onConfirm: a, confirmButton: f = "Okay", content: p, h
50
27
  y || (x({
51
28
  isConfirmed: !0,
52
29
  isDismissed: !1
53
- }), S(), a?.());
30
+ }), S(), d?.());
54
31
  }, w = () => {
55
32
  y || (x({
56
33
  isConfirmed: !1,
57
34
  isDismissed: !0
58
- }), S(), i?.());
35
+ }), S(), u?.());
59
36
  };
60
- return v.render(/* @__PURE__ */ r(t, { children: [
61
- /* @__PURE__ */ n("svg", {
37
+ return v.render(/* @__PURE__ */ i(n, { children: [
38
+ /* @__PURE__ */ r("svg", {
62
39
  className: `pco-sweetest-alert__icon pco-sweetest-alert--${g}`,
63
40
  width: "48",
64
41
  height: "48",
65
42
  viewBox: "0 0 16 16",
66
43
  "aria-hidden": "true",
67
- children: /* @__PURE__ */ n("path", { d: (() => {
44
+ children: /* @__PURE__ */ r("path", { d: (() => {
68
45
  switch (g) {
69
- case "success": return s;
70
- case "error": return u;
71
- case "info": return l;
46
+ case "success": return a;
47
+ case "error": return c;
48
+ case "info": return s;
72
49
  case "danger":
73
- case "warning": return c;
50
+ case "warning": return o;
74
51
  }
75
52
  })() })
76
53
  }),
77
- /* @__PURE__ */ n("h2", {
54
+ /* @__PURE__ */ r("h2", {
78
55
  className: "pco-sweetest-alert__title",
79
56
  children: h
80
57
  }),
81
- /* @__PURE__ */ n("div", {
58
+ /* @__PURE__ */ r("div", {
82
59
  className: "pco-sweetest-alert__body",
83
- children: typeof p == "string" ? /* @__PURE__ */ n("p", { children: p }) : p
60
+ children: typeof p == "string" ? /* @__PURE__ */ r("p", { children: p }) : p
84
61
  }),
85
- /* @__PURE__ */ r("div", {
62
+ /* @__PURE__ */ i("div", {
86
63
  className: "pco-sweetest-alert__actions",
87
- children: [!m && /* @__PURE__ */ n(e, {
64
+ children: [!m && /* @__PURE__ */ r(t, {
88
65
  label: "Cancel",
89
66
  kind: "ghost",
90
67
  onClick: w
91
- }), /* @__PURE__ */ n(e, {
68
+ }), /* @__PURE__ */ r(t, {
92
69
  label: f,
93
70
  kind: g === "danger" ? "delete" : "primary",
94
71
  onClick: C
@@ -101,4 +78,4 @@ function f({ onCancel: i, onConfirm: a, confirmButton: f = "Okay", content: p, h
101
78
  });
102
79
  }
103
80
  //#endregion
104
- export { f as SweetestAlert };
81
+ export { u as SweetestAlert };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/sweetest-alert",
3
- "version": "1.6.4",
3
+ "version": "1.8.0",
4
4
  "description": "The sweetest alert ever",
5
5
  "type": "module",
6
6
  "packageManager": "yarn@4.14.1+sha512.64df448055b2d37ba269d7db535a469b8da93f8ef1140c25fd7a83c00a8fbaacb214ca0e02553b92a2c54cef78bb67d0b4817fab02001df0e24fac0faccc3b42",
@@ -42,15 +42,15 @@
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@planningcenter/icons": "^15.29.1",
45
- "@planningcenter/tapestry": "^2.10.1 || ^3.0.0",
46
- "react": "^18.3.1 <19",
47
- "react-dom": "^18.3.1"
45
+ "@planningcenter/tapestry": ">=2.10.1",
46
+ "react": "^18.3.1 || ^19.0.0",
47
+ "react-dom": "^18.3.1 || ^19.0.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@eslint/js": "^9.37.0",
51
51
  "@planningcenter/icons": "^15.29.1",
52
52
  "@planningcenter/stylelint-config-pco": "^1.0.0",
53
- "@planningcenter/tapestry": "^3.4.0",
53
+ "@planningcenter/tapestry": ">=3.4.0",
54
54
  "@testing-library/dom": "^10.4.1",
55
55
  "@testing-library/jest-dom": "^6.9.1",
56
56
  "@testing-library/react": "^16.3.0",