@planningcenter/sweetest-alert 0.3.3 → 0.3.5
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 +25 -25
- package/dist/style.css +8 -7
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("react-dom"),h=require("@planningcenter/tapestry");var o={},_;function C(){if(_)return o;_=1;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("react-dom"),h=require("@planningcenter/tapestry");var o={},_;function C(){if(_)return o;_=1;var n=v;if(process.env.NODE_ENV==="production")o.createRoot=n.createRoot,o.hydrateRoot=n.hydrateRoot;else{var c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;o.createRoot=function(l,r){c.usingClientEntryPoint=!0;try{return n.createRoot(l,r)}finally{c.usingClientEntryPoint=!1}},o.hydrateRoot=function(l,r,s){c.usingClientEntryPoint=!0;try{return n.hydrateRoot(l,r,s)}finally{c.usingClientEntryPoint=!1}}}return o}var f=C();const p="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",w="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",E="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",R="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 x({onCancel:n,onConfirm:c,confirmButton:l="Okay",content:r,hideCancel:s=!1,title:y,type:a="warning"}){const t=document.createElement("dialog");t.className="pco-sweetest-alert",document.body.appendChild(t);const d=f.createRoot(t),i=()=>{d.unmount(),document.body.removeChild(t)},g=()=>{i(),c?.()},u=()=>{i(),n?.()},m=()=>{switch(a){case"success":return p;case"error":return R;case"info":return E;case"danger":case"warning":return w}};return d.render(e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:`pco-sweetest-alert__icon pco-sweetest-alert--${a}`,width:"48",height:"48",viewBox:"0 0 16 16","aria-hidden":"true",children:e.jsx("path",{d:m()})}),e.jsx("h2",{className:"pco-sweetest-alert__title",children:y}),e.jsx("div",{className:"pco-sweetest-alert__body",children:typeof r=="string"?e.jsx("p",{children:r}):r}),e.jsxs("div",{className:"pco-sweetest-alert__actions",children:[!s&&e.jsx(h.Button,{label:"Cancel",kind:"ghost",onClick:u}),e.jsx(h.Button,{label:l,kind:a==="danger"?"delete":"primary",onClick:g})]})]})),t.showModal(),t.addEventListener("close",u),{show:()=>t.showModal(),close:()=>t.close(),cleanup:i}}exports.SweetestAlert=x;
|
package/dist/index.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { jsxs as u, Fragment as g, jsx as
|
|
1
|
+
import { jsxs as u, Fragment as g, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import v from "react-dom";
|
|
3
3
|
import { Button as m } from "@planningcenter/tapestry";
|
|
4
4
|
var o = {}, _;
|
|
5
5
|
function y() {
|
|
6
6
|
if (_) return o;
|
|
7
7
|
_ = 1;
|
|
8
|
-
var
|
|
8
|
+
var t = v;
|
|
9
9
|
if (process.env.NODE_ENV === "production")
|
|
10
|
-
o.createRoot =
|
|
10
|
+
o.createRoot = t.createRoot, o.hydrateRoot = t.hydrateRoot;
|
|
11
11
|
else {
|
|
12
|
-
var
|
|
13
|
-
o.createRoot = function(l,
|
|
14
|
-
|
|
12
|
+
var c = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
13
|
+
o.createRoot = function(l, r) {
|
|
14
|
+
c.usingClientEntryPoint = !0;
|
|
15
15
|
try {
|
|
16
|
-
return
|
|
16
|
+
return t.createRoot(l, r);
|
|
17
17
|
} finally {
|
|
18
|
-
|
|
18
|
+
c.usingClientEntryPoint = !1;
|
|
19
19
|
}
|
|
20
|
-
}, o.hydrateRoot = function(l,
|
|
21
|
-
|
|
20
|
+
}, o.hydrateRoot = function(l, r, a) {
|
|
21
|
+
c.usingClientEntryPoint = !0;
|
|
22
22
|
try {
|
|
23
|
-
return
|
|
23
|
+
return t.hydrateRoot(l, r, a);
|
|
24
24
|
} finally {
|
|
25
|
-
|
|
25
|
+
c.usingClientEntryPoint = !1;
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
return o;
|
|
30
30
|
}
|
|
31
31
|
var w = y();
|
|
32
|
-
const E = "M8,
|
|
32
|
+
const E = "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", R = "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", M = "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", N = "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";
|
|
33
33
|
function O({
|
|
34
34
|
// Optional: Callback function executed when cancel button is clicked
|
|
35
|
-
onCancel:
|
|
35
|
+
onCancel: t,
|
|
36
36
|
// Optional: Callback function executed when confirm button is clicked
|
|
37
|
-
onConfirm:
|
|
37
|
+
onConfirm: c,
|
|
38
38
|
// Optional: Text for the confirm button. Defaults to "Okay".
|
|
39
39
|
confirmButton: l = "Okay",
|
|
40
40
|
// Required: The body content explaining the alert.
|
|
41
41
|
// Accepts a React fragment or a string of text.
|
|
42
|
-
content:
|
|
42
|
+
content: r,
|
|
43
43
|
// Optional: When true, hides the cancel button for simple notifications.
|
|
44
44
|
// Defaults to "false".
|
|
45
45
|
hideCancel: a = !1,
|
|
@@ -54,15 +54,15 @@ function O({
|
|
|
54
54
|
const d = w.createRoot(e), i = () => {
|
|
55
55
|
d.unmount(), document.body.removeChild(e);
|
|
56
56
|
}, p = () => {
|
|
57
|
-
i(), n?.();
|
|
58
|
-
}, h = () => {
|
|
59
57
|
i(), c?.();
|
|
58
|
+
}, h = () => {
|
|
59
|
+
i(), t?.();
|
|
60
60
|
}, C = () => {
|
|
61
61
|
switch (s) {
|
|
62
62
|
case "success":
|
|
63
63
|
return E;
|
|
64
64
|
case "error":
|
|
65
|
-
return
|
|
65
|
+
return N;
|
|
66
66
|
case "info":
|
|
67
67
|
return M;
|
|
68
68
|
case "danger":
|
|
@@ -72,7 +72,7 @@ function O({
|
|
|
72
72
|
};
|
|
73
73
|
return d.render(
|
|
74
74
|
/* @__PURE__ */ u(g, { children: [
|
|
75
|
-
/* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ n(
|
|
76
76
|
"svg",
|
|
77
77
|
{
|
|
78
78
|
className: `pco-sweetest-alert__icon pco-sweetest-alert--${s}`,
|
|
@@ -80,14 +80,14 @@ function O({
|
|
|
80
80
|
height: "48",
|
|
81
81
|
viewBox: "0 0 16 16",
|
|
82
82
|
"aria-hidden": "true",
|
|
83
|
-
children: /* @__PURE__ */
|
|
83
|
+
children: /* @__PURE__ */ n("path", { d: C() })
|
|
84
84
|
}
|
|
85
85
|
),
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ n("h2", { className: "pco-sweetest-alert__title", children: f }),
|
|
87
|
+
/* @__PURE__ */ n("div", { className: "pco-sweetest-alert__body", children: typeof r == "string" ? /* @__PURE__ */ n("p", { children: r }) : r }),
|
|
88
88
|
/* @__PURE__ */ u("div", { className: "pco-sweetest-alert__actions", children: [
|
|
89
|
-
!a && /* @__PURE__ */
|
|
90
|
-
/* @__PURE__ */
|
|
89
|
+
!a && /* @__PURE__ */ n(m, { label: "Cancel", kind: "ghost", onClick: h }),
|
|
90
|
+
/* @__PURE__ */ n(
|
|
91
91
|
m,
|
|
92
92
|
{
|
|
93
93
|
label: l,
|
package/dist/style.css
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
border-radius: var(--t-border-radius-lg);
|
|
5
5
|
box-shadow: 0 0 var(--t-spacing-3) var(--t-fill-color-transparency-dark-020);
|
|
6
6
|
font-size: var(--t-font-size-md);
|
|
7
|
+
inset: var(--t-spacing-2);
|
|
7
8
|
margin: auto;
|
|
8
9
|
max-width: 600px;
|
|
9
10
|
padding: var(--t-spacing-4) var(--t-spacing-4) 0;
|
|
@@ -21,31 +22,31 @@
|
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
.pco-sweetest-alert__icon.pco-sweetest-alert--info {
|
|
24
|
-
fill: var(--t-icon-color-status-info
|
|
25
|
+
fill: var(--t-icon-color-status-info);
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
.pco-sweetest-alert__icon.pco-sweetest-alert--success {
|
|
28
|
-
fill: var(--t-icon-color-status-success
|
|
29
|
+
fill: var(--t-icon-color-status-success);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
.pco-sweetest-alert__icon.pco-sweetest-alert--warning {
|
|
32
|
-
fill: var(--t-icon-color-status-warning
|
|
33
|
+
fill: var(--t-icon-color-status-warning);
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
.pco-sweetest-alert__icon.pco-sweetest-alert--danger,
|
|
36
37
|
.pco-sweetest-alert__icon.pco-sweetest-alert--error {
|
|
37
|
-
fill: var(--t-icon-color-status-error
|
|
38
|
+
fill: var(--t-icon-color-status-error);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
.pco-sweetest-alert__title {
|
|
41
|
-
color: var(--t-text-color-
|
|
42
|
+
color: var(--t-text-color-headline);
|
|
42
43
|
font-size: var(--t-font-size-2xl);
|
|
43
44
|
font-weight: var(--t-font-weight-semibold);
|
|
44
45
|
margin-block: var(--t-spacing-2);
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
.pco-sweetest-alert__body {
|
|
48
|
-
color: var(--t-text-color
|
|
49
|
+
color: var(--t-text-color);
|
|
49
50
|
font-weight: var(--t-font-weight-normal);
|
|
50
51
|
line-height: 1.4;
|
|
51
52
|
margin-bottom: var(--t-spacing-4);
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
|
|
54
55
|
.pco-sweetest-alert__actions {
|
|
55
56
|
align-items: center;
|
|
56
|
-
border-top: var(--t-border-width
|
|
57
|
+
border-top: var(--t-border-width) solid var(--t-border-color);
|
|
57
58
|
display: flex;
|
|
58
59
|
flex-wrap: wrap;
|
|
59
60
|
gap: var(--t-spacing-1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/sweetest-alert",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "The sweetest alert ever",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "yarn@1.22.22",
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@planningcenter/icons": "^15.26.0",
|
|
44
|
-
"@planningcenter/tapestry": "^2.
|
|
44
|
+
"@planningcenter/tapestry": "^2.7.0",
|
|
45
45
|
"react": "^18.3.1 <19",
|
|
46
46
|
"react-dom": "^18.3.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@eslint/js": "^9.37.0",
|
|
50
50
|
"@planningcenter/icons": "^15.26.0",
|
|
51
|
-
"@planningcenter/stylelint-config-pco": "^0.0.
|
|
52
|
-
"@planningcenter/tapestry": "^2.
|
|
51
|
+
"@planningcenter/stylelint-config-pco": "^0.0.8",
|
|
52
|
+
"@planningcenter/tapestry": "^2.7.0",
|
|
53
53
|
"@testing-library/dom": "^10.4.1",
|
|
54
54
|
"@testing-library/jest-dom": "^6.9.1",
|
|
55
55
|
"@testing-library/react": "^16.3.0",
|