@planningcenter/sweetest-alert 0.1.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/.editorconfig ADDED
@@ -0,0 +1,8 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ indent_size = 2
7
+ indent_style = space
8
+ insert_final_newline = true
@@ -0,0 +1 @@
1
+ * @starzonmyarmz
@@ -0,0 +1,24 @@
1
+ name: PCO-Release - Release Automation
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ permissions:
9
+ contents: write
10
+ pull-requests: write
11
+
12
+ jobs:
13
+ release-automation:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-node@v4
18
+ with:
19
+ node-version: "20"
20
+ cache: "yarn"
21
+ - uses: planningcenter/pco-release-action/release-by-pr@v1
22
+ with:
23
+ app-id: ${{ secrets.PCO_DEPENDENCIES_APP_ID }}
24
+ private-key: ${{ secrets.PCO_DEPENDENCIES_PRIVATE_KEY}}
@@ -0,0 +1,17 @@
1
+ name: PCO-Release - Create Release on Merge
2
+
3
+ on:
4
+ pull_request:
5
+ types: [closed]
6
+ branches:
7
+ - main
8
+
9
+ jobs:
10
+ create-release:
11
+ runs-on: ubuntu-latest
12
+ if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'pco-release-pending')
13
+ steps:
14
+ - uses: planningcenter/pco-release-action/create-release-on-merge@v1
15
+ with:
16
+ app-id: ${{ secrets.PCO_DEPENDENCIES_APP_ID }}
17
+ private-key: ${{ secrets.PCO_DEPENDENCIES_PRIVATE_KEY}}
@@ -0,0 +1,15 @@
1
+ name: PCO-Release - Dependabot Automation (Update changelog)
2
+
3
+ on: pull_request
4
+
5
+ jobs:
6
+ update-dependabot-pr-changelog:
7
+ if: github.actor == 'dependabot[bot]'
8
+ runs-on: ubuntu-latest
9
+ permissions:
10
+ contents: write
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ with:
14
+ ref: ${{ github.event.pull_request.head.ref }}
15
+ - uses: planningcenter/pco-release-action/dependabot-automation@v1
@@ -0,0 +1,22 @@
1
+ name: PCO-Release - Require Changelog Update
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+
7
+ jobs:
8
+ require-changelog-update:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ pull-requests: read
12
+ contents: read
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - id: changed-files
16
+ uses: tj-actions/changed-files@v44
17
+ with:
18
+ files: CHANGELOG.md
19
+ - if: steps.changed-files.outputs.any_changed == 'false'
20
+ run: |
21
+ echo "Pull Requests require an update to the CHANGELOG.md file."
22
+ exit 1
@@ -0,0 +1,18 @@
1
+ on:
2
+ pull_request:
3
+ types: [labeled]
4
+
5
+ permissions:
6
+ contents: write
7
+ pull-requests: write
8
+
9
+ name: PCO-Release - Sync With Labels
10
+
11
+ jobs:
12
+ sync-with-labels:
13
+ if: ${{ github.event.pull_request.head.ref == 'pco-release--internal' && (github.event.label.name == 'pco-release-patch' || github.event.label.name == 'pco-release-minor' || github.event.label.name == 'pco-release-major') }}
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: planningcenter/pco-release-action/sync-with-labels@v1
17
+ with:
18
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "@planningcenter/stylelint-config-pco",
3
+ "rules": {
4
+ "number-leading-zero": "always",
5
+ "order/properties-order": null,
6
+ "order/properties-alphabetical-order": true
7
+ }
8
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+
2
+
3
+ ### Dependencies
4
+
5
+ - Bump vite from 7.1.10 to 7.1.11
6
+
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Planning Center
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,165 @@
1
+ # sweetest-alert
2
+
3
+ > **⚠️ Not Production Ready**
4
+ > This package is currently under development and not yet ready for production use. APIs may change without notice.
5
+
6
+ A lightweight, React alert/modal dialog component that replaces SweetAlert2 with a custom implementation using native HTML dialog elements.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ yarn add @planningcenter/sweetest-alert
12
+ ```
13
+
14
+ ### Peer Dependencies
15
+
16
+ This package requires the following peer dependencies:
17
+
18
+ - `react` ^18.3.1
19
+ - `react-dom` ^18.3.1
20
+ - `@planningcenter/tapestry` ^2.3.0
21
+ - `@planningcenter/icons` ^15.25.0
22
+
23
+ ## Usage
24
+
25
+ ### Basic Example
26
+
27
+ ```jsx
28
+ import { SweetestAlert } from '@planningcenter/sweetest-alert'
29
+
30
+ // Simple notification
31
+ SweetestAlert({
32
+ title: "Warning!",
33
+ content: "Watch out, he’s coming to get you!",
34
+ })
35
+ ```
36
+
37
+ ### Confirmation Dialog
38
+
39
+ ```jsx
40
+ SweetestAlert({
41
+ type: "danger",
42
+ title: "Delete Item",
43
+ content: "Are you sure you want to delete this item?",
44
+ confirm: () => console.log("Confirmed"),
45
+ cancel: () => console.log("Cancelled")
46
+ })
47
+ ```
48
+
49
+ ### Alert Types
50
+
51
+ The component supports five visual types:
52
+
53
+ ```jsx
54
+ // Info alert
55
+ SweetestAlert({
56
+ type: "info",
57
+ title: "Information",
58
+ content: "This is an informational message."
59
+ })
60
+
61
+ // Success alert
62
+ SweetestAlert({
63
+ type: "success",
64
+ title: "Success!",
65
+ content: "Operation completed successfully."
66
+ })
67
+
68
+ // Warning alert (default)
69
+ SweetestAlert({
70
+ type: "warning",
71
+ title: "Warning",
72
+ content: "Please proceed with caution."
73
+ })
74
+
75
+ // Error alert
76
+ SweetestAlert({
77
+ type: "error",
78
+ title: "Error",
79
+ content: "Something went wrong."
80
+ })
81
+
82
+ // Danger alert (for destructive actions)
83
+ SweetestAlert({
84
+ type: "danger",
85
+ title: "Delete Account",
86
+ content: "This action cannot be undone.",
87
+ confirmButton: "Delete"
88
+ })
89
+ ```
90
+
91
+ ### Custom Content
92
+
93
+ You can pass React components as content for rich formatting:
94
+
95
+ ```jsx
96
+ SweetestAlert({
97
+ title: "Custom Content",
98
+ content: (
99
+ <>
100
+ <p>You can include any React elements:</p>
101
+ <ul>
102
+ <li>Lists</li>
103
+ <li>Links</li>
104
+ <li>Formatted text</li>
105
+ </ul>
106
+ </>
107
+ )
108
+ })
109
+ ```
110
+
111
+ ## API
112
+
113
+ ### Parameters
114
+
115
+ | Parameter | Type | Required | Default | Description |
116
+ |-----------|------|----------|---------|-------------|
117
+ | `title` | `string` | Yes | - | The main heading text displayed at the top of the modal |
118
+ | `content` | `string \| React.ReactNode` | Yes | - | The body content. Accepts plain text or React components |
119
+ | `type` | `"info" \| "success" \| "error" \| "danger" \| "warning"` | No | `"warning"` | The visual type of alert, affects icon and styling |
120
+ | `confirm` | `() => void` | No | - | Callback executed when confirm button is clicked |
121
+ | `cancel` | `() => void` | No | - | Callback executed when cancel button is clicked |
122
+ | `confirmButton` | `string` | No | `"Okay"` | Custom text for the confirm button |
123
+ | `hideCancel` | `boolean` | No | `false` | When true, hides the cancel button for simple notifications |
124
+
125
+ ## Development
126
+
127
+ ### Running the Demo
128
+
129
+ To run the interactive demo locally:
130
+
131
+ ```bash
132
+ # Install dependencies
133
+ yarn install
134
+
135
+ # Start the development server
136
+ yarn dev
137
+ ```
138
+
139
+ Then open your browser to the URL shown in the terminal (typically `http://localhost:5173`). The demo showcases all alert types and features with interactive buttons.
140
+
141
+ ### Running Tests
142
+
143
+ The project uses Vitest for testing:
144
+
145
+ ```bash
146
+ # Run tests once
147
+ yarn test
148
+
149
+ # Run tests in watch mode
150
+ yarn test --watch
151
+ ```
152
+
153
+ ### Linting
154
+
155
+ ```bash
156
+ # Lint JavaScript/TypeScript files
157
+ yarn lint:js
158
+
159
+ # Lint CSS files
160
+ yarn lint:css
161
+ ```
162
+
163
+ ## License
164
+
165
+ MIT
package/docs/demo.css ADDED
@@ -0,0 +1,198 @@
1
+ * {
2
+ box-sizing: border-box;
3
+ margin: 0;
4
+ padding: 0;
5
+ }
6
+
7
+ #root {
8
+ display: contents;
9
+ }
10
+
11
+ body {
12
+ background: linear-gradient(135deg, var(--t-fill-color-tag-blue-040) 0%, var(--t-fill-color-tag-purple-030) 100%);
13
+ color: var(--t-text-color-default-primary);
14
+ display: grid;
15
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
16
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
17
+ sans-serif;
18
+ line-height: 1.4;
19
+ min-height: 100vh;
20
+ padding: var(--t-spacing-3);
21
+ place-items: center;
22
+ text-wrap: pretty;
23
+ gap:32px;
24
+ }
25
+
26
+ .container {
27
+ background: var(--t-surface-color-card);
28
+ border-radius: var(--t-border-radius-xl);
29
+ box-shadow: 0 var(--t-spacing-3) var(--t-spacing-6) var(--t-fill-color-transparency-dark-030);
30
+ max-width: 960px;
31
+ padding: var(--t-spacing-6);
32
+ width: 100%;
33
+ }
34
+
35
+ h1 {
36
+ color: var(--t-text-color-default-headline);
37
+ font-size: 2.5rem;
38
+ margin: 0;
39
+ text-align: center;
40
+ }
41
+
42
+ h2 {
43
+ color: var(--t-text-color-default-secondary);
44
+ font-size: 1.2rem;
45
+ font-weight: var(--t-font-weight-normal);
46
+ margin-bottom: var(--t-spacing-5);
47
+ text-align: center;
48
+ }
49
+
50
+ ul {
51
+ margin: 1rem;
52
+ padding-left: 2ch;
53
+ }
54
+
55
+ table {
56
+ border-collapse: collapse;
57
+ }
58
+
59
+ th, td {
60
+ border-bottom: var(--t-border-width-default) solid var(--t-border-color-default-base);
61
+ text-align: left;
62
+ padding: var(--t-spacing-1);
63
+ }
64
+
65
+ tr:last-child :is(th, td) {
66
+ border: 0;
67
+ }
68
+
69
+ .button-grid {
70
+ display: grid;
71
+ gap: var(--t-spacing-2);
72
+ grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
73
+ margin-bottom: var(--t-spacing-4);
74
+ }
75
+
76
+ .demo-button {
77
+ background: var(--t-surface-color-card);
78
+ border: var(--t-border-width-thick) solid var(--t-border-color-default-base);
79
+ border-radius: 12px;
80
+ color: var(--t-text-color-default-secondary);
81
+ cursor: pointer;
82
+ display: flex;
83
+ flex-direction: column;
84
+ font-family: inherit;
85
+ font-size: 1rem;
86
+ gap: var(--t-spacing-half);
87
+ padding: var(--t-spacing-3);
88
+ text-align: left;
89
+ transition: all .2s ease;
90
+
91
+ &:hover {
92
+ box-shadow: 0 var(--t-spacing-half) var(--t-spacing-1) var(--t-fill-color-transparency-dark-010);
93
+ translate: 0 -2px;
94
+ }
95
+
96
+ &:active {
97
+ translate: 0;
98
+ }
99
+
100
+ h3 {
101
+ color: var(--t-text-color-default-headline);
102
+ font-size: 1.1rem;
103
+ font-weight: var(--t-font-weight-semibold);
104
+ }
105
+ }
106
+
107
+ .info {
108
+ border-color: var(--t-border-color-status-info);
109
+
110
+ &:hover {
111
+ background: var(--t-fill-color-status-info-dim);
112
+ border-color: var(--t-border-color-status-info);
113
+ }
114
+ }
115
+
116
+ .success {
117
+ border-color: var(--t-border-color-status-success);
118
+
119
+ &:hover {
120
+ background: var(--t-fill-color-status-success-ghost);
121
+ border-color: var(--t-border-color-status-success);
122
+ }
123
+ }
124
+
125
+ .warning {
126
+ border-color: var(--t-border-color-status-warning);
127
+
128
+ &:hover {
129
+ background: var(--t-fill-color-status-warning-ghost);
130
+ border-color: var(--t-border-color-status-warning);
131
+ }
132
+ }
133
+
134
+ .error, .danger {
135
+ border-color: var(--t-border-color-status-error);
136
+
137
+ &:hover {
138
+ background: var(--t-fill-color-status-error-ghost);
139
+ border-color: var(--t-border-color-status-error);
140
+ }
141
+ }
142
+
143
+ .custom {
144
+ border-color: var(--t-border-color-default-darker);
145
+
146
+ &:hover {
147
+ background: var(--t-fill-color-tag-purple-010);
148
+ border-color: var(--t-border-color-default-darkest);
149
+ }
150
+ }
151
+
152
+ .tip {
153
+ background: var(--t-fill-color-neutral-090);
154
+ border: var(--t-border-width-default) solid var(--t-border-color-default-base);
155
+ border-radius: var(--t-border-radius-lg);
156
+ color: var(--t-text-color-default-secondary);
157
+ font-size: 1rem;
158
+ padding: var(--t-spacing-2) var(--t-spacing-3);
159
+
160
+ strong {
161
+ color: var(--t-text-color-default-primary);
162
+ }
163
+ }
164
+
165
+ .codeblock {
166
+ background: #2d2d2d;
167
+ border-radius: var(--t-border-radius-lg);
168
+ margin: var(--t-spacing-3) 0 var(--t-spacing-6);
169
+ overflow-x: auto;
170
+ padding: 0;
171
+
172
+ pre {
173
+ margin: 0;
174
+ padding: 0;
175
+ }
176
+
177
+ code {
178
+ display: block;
179
+ font-family: 'Fira Code', 'Monaco', 'Menlo', 'Courier New', monospace;
180
+ font-size: 0.9rem;
181
+ line-height: 1.5;
182
+ padding: var(--t-spacing-3);
183
+ }
184
+ }
185
+
186
+ @media (max-width: 640px) {
187
+ .demo-container {
188
+ padding: var(--t-spacing-4) var(--t-spacing-3);
189
+ }
190
+
191
+ h1 {
192
+ font-size: 2rem;
193
+ }
194
+
195
+ .button-grid {
196
+ grid-template-columns: 1fr;
197
+ }
198
+ }