@keenmate/pure-admin-core 1.0.0-rc01

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.
Files changed (167) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +172 -0
  3. package/dist/css/main.css +11542 -0
  4. package/dist/fonts/Delivery/Delivery_W_Bd.woff2 +0 -0
  5. package/dist/fonts/Delivery/Delivery_W_BdIt.woff2 +0 -0
  6. package/dist/fonts/Delivery/Delivery_W_CdBlk.woff2 +0 -0
  7. package/dist/fonts/Delivery/Delivery_W_CdLt.woff2 +0 -0
  8. package/dist/fonts/Delivery/Delivery_W_It.woff2 +0 -0
  9. package/dist/fonts/Delivery/Delivery_W_Lt.woff2 +0 -0
  10. package/dist/fonts/Delivery/Delivery_W_LtIt.woff2 +0 -0
  11. package/dist/fonts/Delivery/Delivery_W_Rg.woff2 +0 -0
  12. package/dist/fonts/google/3y976aknfjLm_3lMKjiMgmUUYBs04Y8UH-qVHQ.woff2 +0 -0
  13. package/dist/fonts/google/3y976aknfjLm_3lMKjiMgmUUYBs04Y8UH-qVHQ.woff2.1 +0 -0
  14. package/dist/fonts/google/3y976aknfjLm_3lMKjiMgmUUYBs04Y8UH-qVHQ.woff2.2 +0 -0
  15. package/dist/fonts/google/3y976aknfjLm_3lMKjiMgmUUYBs04Y8VH-qVHQ.woff2 +0 -0
  16. package/dist/fonts/google/3y976aknfjLm_3lMKjiMgmUUYBs04Y8VH-qVHQ.woff2.1 +0 -0
  17. package/dist/fonts/google/3y976aknfjLm_3lMKjiMgmUUYBs04Y8VH-qVHQ.woff2.2 +0 -0
  18. package/dist/fonts/google/3y976aknfjLm_3lMKjiMgmUUYBs04Y8bH-o.woff2 +0 -0
  19. package/dist/fonts/google/3y976aknfjLm_3lMKjiMgmUUYBs04Y8bH-o.woff2.1 +0 -0
  20. package/dist/fonts/google/3y976aknfjLm_3lMKjiMgmUUYBs04Y8fH-qVHQ.woff2 +0 -0
  21. package/dist/fonts/google/3y976aknfjLm_3lMKjiMgmUUYBs04Y8fH-qVHQ.woff2.1 +0 -0
  22. package/dist/fonts/google/3y976aknfjLm_3lMKjiMgmUUYBs04Y8fH-qVHQ.woff2.2 +0 -0
  23. package/dist/fonts/google/6aez4K2oVqwIvtE2H68T.woff2 +0 -0
  24. package/dist/fonts/google/6aez4K2oVqwIvtU2Hw.woff2 +0 -0
  25. package/dist/fonts/google/6aez4K2oVqwIvtY2H68T.woff2 +0 -0
  26. package/dist/fonts/google/6aez4K2oVqwIvtg2H68T.woff2 +0 -0
  27. package/dist/fonts/google/6aez4K2oVqwIvto2H68T.woff2 +0 -0
  28. package/dist/fonts/google/6aez4K2oVqwIvts2H68T.woff2 +0 -0
  29. package/dist/fonts/google/7Auup_AqnyWWAxW2Wk3swUz56MS91Eww8SX21nejog.woff2 +0 -0
  30. package/dist/fonts/google/7Auup_AqnyWWAxW2Wk3swUz56MS91Eww8SX21nijogp5.woff2 +0 -0
  31. package/dist/fonts/google/7Auup_AqnyWWAxW2Wk3swUz56MS91Eww8SX21nmjogp5.woff2 +0 -0
  32. package/dist/fonts/google/PN_xRfK9oXHga0XdZ8g_vT0.woff2 +0 -0
  33. package/dist/fonts/google/PN_xRfK9oXHga0XdZsg_.woff2 +0 -0
  34. package/dist/fonts/google/PN_xRfK9oXHga0XdaMg_vT0.woff2 +0 -0
  35. package/dist/fonts/google/TK3tWkYFABsmjsphPho.woff2 +0 -0
  36. package/dist/fonts/google/TK3tWkYFABsmjspuPho7vA.woff2 +0 -0
  37. package/dist/fonts/google/TK3tWkYFABsmjspvPho7vA.woff2 +0 -0
  38. package/dist/fonts/google/dg45_pLmvrkcOkBnKsOzXyGWTBcmg-X6VjTYJwQj.woff2 +0 -0
  39. package/dist/fonts/google/dg45_pLmvrkcOkBnKsOzXyGWTBcmg-X6VjXYJwQj.woff2 +0 -0
  40. package/dist/fonts/google/dg45_pLmvrkcOkBnKsOzXyGWTBcmg-X6Vj_YJwQj.woff2 +0 -0
  41. package/dist/fonts/google/dg45_pLmvrkcOkBnKsOzXyGWTBcmg-X6VjbYJwQj.woff2 +0 -0
  42. package/dist/fonts/google/dg45_pLmvrkcOkBnKsOzXyGWTBcmg-X6VjvYJw.woff2 +0 -0
  43. package/dist/fonts/google/fonts-tracklist.txt +48 -0
  44. package/dist/fonts/google/vEFO2_JTCgwQ5ejvMV0O96D01E8J0tJXHKbBjM4.woff2 +0 -0
  45. package/dist/fonts/google/vEFO2_JTCgwQ5ejvMV0O96D01E8J0tJXHKbOjM7sfA.woff2 +0 -0
  46. package/dist/fonts/google/vEFO2_JTCgwQ5ejvMV0O96D01E8J0tJXHKbPjM7sfA.woff2 +0 -0
  47. package/dist/fonts/google/wEOhEADFm8hSaQTFG18FErVhsC9x-tarUfLtrftV.woff2 +0 -0
  48. package/dist/fonts/google/wEOhEADFm8hSaQTFG18FErVhsC9x-tarUfXtrftV.woff2 +0 -0
  49. package/dist/fonts/google/wEOhEADFm8hSaQTFG18FErVhsC9x-tarUfbtrQ.woff2 +0 -0
  50. package/dist/fonts/google/wEOhEADFm8hSaQTFG18FErVhsC9x-tarUfjtrftV.woff2 +0 -0
  51. package/dist/fonts/google/wEOhEADFm8hSaQTFG18FErVhsC9x-tarUfntrftV.woff2 +0 -0
  52. package/dist/fonts/google/wEOhEADFm8hSaQTFG18FErVhsC9x-tarUfrtrftV.woff2 +0 -0
  53. package/dist/fonts/google/wEOhEADFm8hSaQTFG18FErVhsC9x-tarUfvtrftV.woff2 +0 -0
  54. package/dist/fonts/google/xn7_YHE41ni1AdIRqAuZuw1Bx9mbZk79FN_B-bnBeA.woff2 +0 -0
  55. package/dist/fonts/google/xn7_YHE41ni1AdIRqAuZuw1Bx9mbZk79FN_C-bk.woff2 +0 -0
  56. package/dist/fonts/google/xn7_YHE41ni1AdIRqAuZuw1Bx9mbZk79FN_G-bnBeA.woff2 +0 -0
  57. package/dist/fonts/google/xn7_YHE41ni1AdIRqAuZuw1Bx9mbZk79FN_M-bnBeA.woff2 +0 -0
  58. package/dist/fonts/google/xn7_YHE41ni1AdIRqAuZuw1Bx9mbZk79FN_N-bnBeA.woff2 +0 -0
  59. package/dist/fonts/google/xn7_YHE41ni1AdIRqAuZuw1Bx9mbZk79FN_P-bnBeA.woff2 +0 -0
  60. package/package.json +60 -0
  61. package/snippets/alerts.html +281 -0
  62. package/snippets/badges.html +212 -0
  63. package/snippets/buttons.html +287 -0
  64. package/snippets/cards.html +393 -0
  65. package/snippets/checkbox-lists.html +490 -0
  66. package/snippets/code.html +225 -0
  67. package/snippets/command-palette.html +210 -0
  68. package/snippets/comparison.html +428 -0
  69. package/snippets/customization.html +142 -0
  70. package/snippets/forms.html +477 -0
  71. package/snippets/grid.html +338 -0
  72. package/snippets/layout.html +598 -0
  73. package/snippets/lists.html +232 -0
  74. package/snippets/loaders.html +183 -0
  75. package/snippets/manifest.json +388 -0
  76. package/snippets/modal-dialogs.html +411 -0
  77. package/snippets/modals.html +310 -0
  78. package/snippets/popconfirm.html +253 -0
  79. package/snippets/profile.html +264 -0
  80. package/snippets/tables.html +317 -0
  81. package/snippets/tabs.html +930 -0
  82. package/snippets/timeline.html +364 -0
  83. package/snippets/toasts.html +154 -0
  84. package/snippets/tooltips.html +411 -0
  85. package/snippets/typography.html +101 -0
  86. package/snippets/utilities.html +595 -0
  87. package/snippets/virtual-scroll.html +322 -0
  88. package/snippets/web-daterangepicker.html +634 -0
  89. package/snippets/web-multiselect.html +362 -0
  90. package/src/scss/.claude/settings.local.json +11 -0
  91. package/src/scss/_base-css-variables.scss +348 -0
  92. package/src/scss/_core.scss +99 -0
  93. package/src/scss/_fonts.scss +67 -0
  94. package/src/scss/_purecss-grid-responsive.scss +138 -0
  95. package/src/scss/_purecss-grid.scss +58 -0
  96. package/src/scss/_variables.scss +14 -0
  97. package/src/scss/core-components/_alerts.scss +212 -0
  98. package/src/scss/core-components/_badges.scss +16 -0
  99. package/src/scss/core-components/_base.scss +124 -0
  100. package/src/scss/core-components/_buttons.scss +473 -0
  101. package/src/scss/core-components/_cards.scss +285 -0
  102. package/src/scss/core-components/_checkbox-lists.scss +289 -0
  103. package/src/scss/core-components/_code.scss +141 -0
  104. package/src/scss/core-components/_command-palette.scss +518 -0
  105. package/src/scss/core-components/_comparison.scss +172 -0
  106. package/src/scss/core-components/_file-selector.scss +780 -0
  107. package/src/scss/core-components/_forms.scss +16 -0
  108. package/src/scss/core-components/_grid.scss +264 -0
  109. package/src/scss/core-components/_layout.scss +15 -0
  110. package/src/scss/core-components/_lists.scss +211 -0
  111. package/src/scss/core-components/_loaders.scss +277 -0
  112. package/src/scss/core-components/_logic-tree.scss +280 -0
  113. package/src/scss/core-components/_modals.scss +209 -0
  114. package/src/scss/core-components/_notifications.scss +253 -0
  115. package/src/scss/core-components/_pagers.scss +141 -0
  116. package/src/scss/core-components/_popconfirm.scss +170 -0
  117. package/src/scss/core-components/_profile.scss +281 -0
  118. package/src/scss/core-components/_settings-panel.scss +128 -0
  119. package/src/scss/core-components/_statistics.scss +200 -0
  120. package/src/scss/core-components/_tables.scss +555 -0
  121. package/src/scss/core-components/_tabs.scss +438 -0
  122. package/src/scss/core-components/_timeline.scss +589 -0
  123. package/src/scss/core-components/_toasts.scss +281 -0
  124. package/src/scss/core-components/_tooltips.scss +503 -0
  125. package/src/scss/core-components/_utilities.scss +241 -0
  126. package/src/scss/core-components/_web-components-theme.scss +294 -0
  127. package/src/scss/core-components/badges/_badge-base.scss +131 -0
  128. package/src/scss/core-components/badges/_badge-group.scss +25 -0
  129. package/src/scss/core-components/badges/_composite-badge-variants.scss +396 -0
  130. package/src/scss/core-components/badges/_composite-badge.scss +70 -0
  131. package/src/scss/core-components/badges/_index.scss +10 -0
  132. package/src/scss/core-components/badges/_labels.scss +155 -0
  133. package/src/scss/core-components/forms/_checkboxes-radios.scss +205 -0
  134. package/src/scss/core-components/forms/_form-inputs.scss +100 -0
  135. package/src/scss/core-components/forms/_form-layout.scss +66 -0
  136. package/src/scss/core-components/forms/_form-states.scss +89 -0
  137. package/src/scss/core-components/forms/_index.scss +12 -0
  138. package/src/scss/core-components/forms/_input-groups.scss +149 -0
  139. package/src/scss/core-components/forms/_input-wrapper.scss +89 -0
  140. package/src/scss/core-components/forms/_query-editor.scss +313 -0
  141. package/src/scss/core-components/layout/_index.scss +11 -0
  142. package/src/scss/core-components/layout/_layout-container.scss +105 -0
  143. package/src/scss/core-components/layout/_layout-responsive.scss +100 -0
  144. package/src/scss/core-components/layout/_navbar-elements.scss +238 -0
  145. package/src/scss/core-components/layout/_navbar.scss +71 -0
  146. package/src/scss/core-components/layout/_sidebar-states.scss +228 -0
  147. package/src/scss/core-components/layout/_sidebar.scss +177 -0
  148. package/src/scss/main.scss +7 -0
  149. package/src/scss/themes/_dark-base.scss +207 -0
  150. package/src/scss/themes/audi-light.scss +311 -0
  151. package/src/scss/themes/audi.scss +288 -0
  152. package/src/scss/themes/corporate.scss +203 -0
  153. package/src/scss/themes/dark-blue.scss +152 -0
  154. package/src/scss/themes/dark-green.scss +156 -0
  155. package/src/scss/themes/dark-red.scss +160 -0
  156. package/src/scss/themes/dark.scss +145 -0
  157. package/src/scss/themes/express.scss +281 -0
  158. package/src/scss/themes/minimal.scss +121 -0
  159. package/src/scss/utilities.scss +481 -0
  160. package/src/scss/variables/_base.scss +81 -0
  161. package/src/scss/variables/_colors.scss +148 -0
  162. package/src/scss/variables/_components.scss +509 -0
  163. package/src/scss/variables/_index.scss +13 -0
  164. package/src/scss/variables/_layout.scss +65 -0
  165. package/src/scss/variables/_spacing.scss +66 -0
  166. package/src/scss/variables/_system.scss +80 -0
  167. package/src/scss/variables/_typography.scss +37 -0
@@ -0,0 +1,411 @@
1
+ <!-- ================================
2
+ MODAL DIALOGS (PROGRAMMATIC)
3
+ Pure Admin Visual Framework
4
+ ================================ -->
5
+
6
+ <!--
7
+ PROGRAMMATIC MODAL DIALOGS
8
+
9
+ This is a Promise-based JavaScript API for creating modal dialogs programmatically.
10
+ Unlike static modals (see modals.html), these are created on-demand via JavaScript
11
+ and automatically cleaned up after use.
12
+
13
+ Perfect for:
14
+ - Async/await workflows
15
+ - Svelte/React/Vue components
16
+ - Programmatic confirmations, alerts, and prompts
17
+ - No HTML boilerplate needed
18
+
19
+ JAVASCRIPT FILE:
20
+ - src/js/modal-dialogs.js (must be included in your page)
21
+
22
+ AVAILABLE METHODS:
23
+ - PureAdmin.confirm(options) → Promise<boolean>
24
+ - PureAdmin.alert(options) → Promise<void>
25
+ - PureAdmin.prompt(options) → Promise<string | null>
26
+ - PureAdmin.custom(options) → Promise<any>
27
+ -->
28
+
29
+
30
+ <!-- ================================
31
+ USAGE EXAMPLES
32
+ ================================ -->
33
+
34
+ <!-- 1. CONFIRMATION DIALOG -->
35
+ <script>
36
+ // Basic confirm
37
+ async function deleteItem() {
38
+ const confirmed = await PureAdmin.confirm({
39
+ title: 'Delete Item?',
40
+ message: 'This action cannot be undone.',
41
+ });
42
+
43
+ if (confirmed) {
44
+ // User clicked OK
45
+ console.log('Item deleted');
46
+ } else {
47
+ // User clicked Cancel or Esc
48
+ console.log('Cancelled');
49
+ }
50
+ }
51
+
52
+ // Confirm with custom buttons and variant
53
+ async function dangerConfirm() {
54
+ const result = await PureAdmin.confirm({
55
+ title: 'Delete Account?',
56
+ message: 'This will permanently delete your account and all data.',
57
+ confirmText: 'Delete Forever',
58
+ cancelText: 'Keep Account',
59
+ variant: 'danger',
60
+ confirmVariant: 'danger',
61
+ size: 'md',
62
+ closeOnBackdrop: false // Require explicit button click
63
+ });
64
+
65
+ return result; // true or false
66
+ }
67
+ </script>
68
+
69
+
70
+ <!-- 2. ALERT DIALOG -->
71
+ <script>
72
+ // Basic alert
73
+ async function showSuccess() {
74
+ await PureAdmin.alert({
75
+ title: 'Success!',
76
+ message: 'Your changes have been saved.',
77
+ variant: 'success'
78
+ });
79
+
80
+ // Code here runs AFTER user clicks OK
81
+ console.log('Alert dismissed');
82
+ }
83
+
84
+ // Warning alert
85
+ async function showWarning() {
86
+ await PureAdmin.alert({
87
+ title: 'Warning',
88
+ message: 'Your session will expire in 5 minutes.',
89
+ okText: 'I Understand',
90
+ variant: 'warning',
91
+ size: 'sm'
92
+ });
93
+ }
94
+ </script>
95
+
96
+
97
+ <!-- 3. PROMPT DIALOG -->
98
+ <script>
99
+ // Basic prompt
100
+ async function askForName() {
101
+ const name = await PureAdmin.prompt({
102
+ title: 'Enter Your Name',
103
+ message: 'Please provide your full name:',
104
+ defaultValue: '',
105
+ placeholder: 'John Doe'
106
+ });
107
+
108
+ if (name !== null) {
109
+ console.log('User entered:', name);
110
+ } else {
111
+ console.log('User cancelled');
112
+ }
113
+ }
114
+
115
+ // Prompt with validation
116
+ async function askForEmail() {
117
+ const email = await PureAdmin.prompt({
118
+ title: 'Email Address',
119
+ message: 'Enter a valid email address:',
120
+ placeholder: 'user@example.com',
121
+ confirmText: 'Submit',
122
+ cancelText: 'Skip',
123
+ variant: 'primary',
124
+ validator: (value) => {
125
+ // Return true if valid, or error message string if invalid
126
+ if (!value) return 'Email is required';
127
+ if (!value.includes('@')) return 'Invalid email format';
128
+ return true;
129
+ }
130
+ });
131
+
132
+ return email; // string or null
133
+ }
134
+ </script>
135
+
136
+
137
+ <!-- 4. CUSTOM DIALOG -->
138
+ <script>
139
+ // Advanced custom modal with render function
140
+ async function customDialog() {
141
+ const result = await PureAdmin.custom({
142
+ title: 'Select Options',
143
+ size: 'lg',
144
+ variant: 'primary',
145
+ closeOnBackdrop: true,
146
+ render: (container, close) => {
147
+ // container is the .pa-modal__container element
148
+ // close is a callback function to close the modal with a value
149
+
150
+ // Create body
151
+ const body = document.createElement('div');
152
+ body.className = 'pa-modal__body';
153
+ body.innerHTML = `
154
+ <p>Choose your preferences:</p>
155
+ <div class="pa-form-group">
156
+ <label class="pa-checkbox">
157
+ <input type="checkbox" id="option1"> Enable notifications
158
+ </label>
159
+ </div>
160
+ <div class="pa-form-group">
161
+ <label class="pa-checkbox">
162
+ <input type="checkbox" id="option2"> Auto-save
163
+ </label>
164
+ </div>
165
+ `;
166
+
167
+ // Create footer
168
+ const footer = document.createElement('div');
169
+ footer.className = 'pa-modal__footer';
170
+ footer.innerHTML = `
171
+ <button class="pa-btn pa-btn--secondary" id="cancelBtn">Cancel</button>
172
+ <button class="pa-btn pa-btn--primary" id="saveBtn">Save</button>
173
+ `;
174
+
175
+ container.appendChild(body);
176
+ container.appendChild(footer);
177
+
178
+ // Attach event listeners
179
+ footer.querySelector('#cancelBtn').addEventListener('click', () => {
180
+ close(null); // Close with null value
181
+ });
182
+
183
+ footer.querySelector('#saveBtn').addEventListener('click', () => {
184
+ const option1 = body.querySelector('#option1').checked;
185
+ const option2 = body.querySelector('#option2').checked;
186
+ close({ option1, option2 }); // Close with custom data
187
+ });
188
+ }
189
+ });
190
+
191
+ console.log('User selected:', result);
192
+ // result = { option1: true, option2: false } or null
193
+ }
194
+ </script>
195
+
196
+
197
+ <!-- ================================
198
+ OPTIONS REFERENCE
199
+ ================================ -->
200
+
201
+ <!--
202
+ CONFIRM OPTIONS:
203
+ {
204
+ title: string // Modal title (default: 'Confirm')
205
+ message: string // Message text (default: 'Are you sure?')
206
+ confirmText: string // OK button text (default: 'OK')
207
+ cancelText: string // Cancel button text (default: 'Cancel')
208
+ variant: string // Modal header color: 'primary', 'success', 'warning', 'danger'
209
+ confirmVariant: string // Confirm button color (default: same as variant)
210
+ size: string // 'sm', 'md', 'lg', 'xl' (default: 'sm')
211
+ position: string // 'center' or 'top' (default: 'center')
212
+ closeOnBackdrop: bool // Allow closing by clicking backdrop (default: true)
213
+ }
214
+
215
+ Returns: Promise<boolean> - true if confirmed, false if cancelled
216
+
217
+ ALERT OPTIONS:
218
+ {
219
+ title: string // Modal title (default: 'Alert')
220
+ message: string // Message text (default: '')
221
+ okText: string // Button text (default: 'OK')
222
+ variant: string // 'primary', 'success', 'warning', 'danger'
223
+ size: string // 'sm', 'md', 'lg', 'xl' (default: 'sm')
224
+ position: string // 'center' or 'top' (default: 'center')
225
+ closeOnBackdrop: bool // Allow closing by clicking backdrop (default: true)
226
+ }
227
+
228
+ Returns: Promise<void> - resolves when user clicks OK
229
+
230
+ PROMPT OPTIONS:
231
+ {
232
+ title: string // Modal title (default: 'Input')
233
+ message: string // Message text (default: 'Enter value:')
234
+ defaultValue: string // Pre-filled input value (default: '')
235
+ placeholder: string // Input placeholder (default: '')
236
+ confirmText: string // Submit button text (default: 'OK')
237
+ cancelText: string // Cancel button text (default: 'Cancel')
238
+ variant: string // 'primary', 'success', 'warning', 'danger'
239
+ size: string // 'sm', 'md', 'lg', 'xl' (default: 'sm')
240
+ position: string // 'center' or 'top' (default: 'center')
241
+ validator: function // Validation function (optional)
242
+ closeOnBackdrop: bool // ALWAYS false for prompts
243
+ }
244
+
245
+ Validator function signature:
246
+ (value: string) => true | string
247
+ Return true if valid, or error message string if invalid
248
+
249
+ Returns: Promise<string | null> - string if submitted, null if cancelled
250
+
251
+ CUSTOM OPTIONS:
252
+ {
253
+ title: string // Modal title (default: 'Dialog')
254
+ size: string // 'sm', 'md', 'lg', 'xl' (default: 'md')
255
+ variant: string // 'primary', 'success', 'warning', 'danger'
256
+ position: string // 'center' or 'top' (default: 'center')
257
+ closeOnBackdrop: bool // Allow closing by clicking backdrop (default: true)
258
+ render: function // Render function (required)
259
+ }
260
+
261
+ Render function signature:
262
+ (container: HTMLElement, close: Function) => void
263
+ container: The .pa-modal__container element to append content to
264
+ close: Function to close modal with a value: close(value)
265
+
266
+ Returns: Promise<any> - whatever value you pass to close()
267
+ -->
268
+
269
+
270
+ <!-- ================================
271
+ SEQUENTIAL DIALOGS
272
+ ================================ -->
273
+
274
+ <script>
275
+ // Example: Multi-step wizard with dialogs
276
+ async function multiStepWizard() {
277
+ // Step 1: Confirm start
278
+ const start = await PureAdmin.confirm({
279
+ title: 'Start Wizard?',
280
+ message: 'This will guide you through the setup process.',
281
+ confirmText: 'Start',
282
+ variant: 'primary'
283
+ });
284
+
285
+ if (!start) return;
286
+
287
+ // Step 2: Get name
288
+ const name = await PureAdmin.prompt({
289
+ title: 'Step 1: Your Name',
290
+ message: 'Enter your name:',
291
+ validator: (v) => v.trim() ? true : 'Name is required'
292
+ });
293
+
294
+ if (!name) return;
295
+
296
+ // Step 3: Get email
297
+ const email = await PureAdmin.prompt({
298
+ title: 'Step 2: Email',
299
+ message: 'Enter your email:',
300
+ validator: (v) => v.includes('@') ? true : 'Invalid email'
301
+ });
302
+
303
+ if (!email) return;
304
+
305
+ // Step 4: Confirm
306
+ const confirm = await PureAdmin.confirm({
307
+ title: 'Review Information',
308
+ message: `Name: ${name}\nEmail: ${email}\n\nIs this correct?`,
309
+ confirmText: 'Submit',
310
+ variant: 'success'
311
+ });
312
+
313
+ if (confirm) {
314
+ await PureAdmin.alert({
315
+ title: 'Success!',
316
+ message: 'Your information has been saved.',
317
+ variant: 'success'
318
+ });
319
+ }
320
+ }
321
+ </script>
322
+
323
+
324
+ <!-- ================================
325
+ INTEGRATION WITH FORMS
326
+ ================================ -->
327
+
328
+ <script>
329
+ // Example: Confirm before form submission
330
+ document.querySelector('#deleteForm').addEventListener('submit', async function(e) {
331
+ e.preventDefault();
332
+
333
+ const confirmed = await PureAdmin.confirm({
334
+ title: 'Delete Item?',
335
+ message: 'This action cannot be undone.',
336
+ variant: 'danger',
337
+ confirmVariant: 'danger',
338
+ confirmText: 'Delete',
339
+ closeOnBackdrop: false
340
+ });
341
+
342
+ if (confirmed) {
343
+ // Submit the form
344
+ this.submit();
345
+ }
346
+ });
347
+ </script>
348
+
349
+
350
+ <!-- ================================
351
+ SVELTE INTEGRATION EXAMPLE
352
+ ================================ -->
353
+
354
+ <!--
355
+ <script>
356
+ import { onMount } from 'svelte';
357
+
358
+ // Make sure modal-dialogs.js is loaded globally
359
+ onMount(() => {
360
+ // Now you can use PureAdmin.confirm/alert/prompt anywhere
361
+ });
362
+
363
+ async function handleDelete() {
364
+ const result = await PureAdmin.confirm({
365
+ title: 'Delete Item?',
366
+ message: 'Are you sure?',
367
+ variant: 'danger'
368
+ });
369
+
370
+ if (result) {
371
+ // Delete the item
372
+ }
373
+ }
374
+ </script>
375
+
376
+ <button on:click={handleDelete}>Delete</button>
377
+ -->
378
+
379
+
380
+ <!-- ================================
381
+ NOTES
382
+ ================================ -->
383
+
384
+ <!--
385
+ KEY FEATURES:
386
+ - ✅ Promise-based API (works with async/await)
387
+ - ✅ No HTML boilerplate needed
388
+ - ✅ Automatic cleanup (modal removed from DOM after use)
389
+ - ✅ XSS protection (all text is escaped)
390
+ - ✅ Keyboard navigation (Enter confirms, Esc cancels)
391
+ - ✅ Auto-focus on inputs/buttons
392
+ - ✅ Backdrop click to close (configurable)
393
+ - ✅ Scrollbar compensation (prevents layout shift)
394
+ - ✅ Input validation for prompts
395
+
396
+ DIFFERENCES FROM STATIC MODALS:
397
+ - Static modals require pre-defined HTML in the page
398
+ - Dialog modals are created on-demand via JavaScript
399
+ - Dialog modals are automatically removed after use
400
+ - Dialog modals return Promise for easy async/await usage
401
+
402
+ BROWSER COMPATIBILITY:
403
+ - Requires ES6+ (async/await, Promise, const/let)
404
+ - Modern browsers (Chrome/Firefox/Safari/Edge)
405
+
406
+ ACCESSIBILITY:
407
+ - ARIA attributes (role="dialog", aria-modal, aria-labelledby)
408
+ - Keyboard support (Enter, Esc)
409
+ - Focus management (auto-focus first input/button)
410
+ - Proper modal structure for screen readers
411
+ -->