@keenmate/pure-admin-core 2.3.6 → 2.5.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 +23 -29
- package/dist/css/main.css +68 -148
- package/package.json +1 -5
- package/snippets/AUDIT.md +94 -0
- package/snippets/alerts.html +264 -89
- package/snippets/badges.html +193 -61
- package/snippets/buttons.html +178 -0
- package/snippets/callouts.html +210 -129
- package/snippets/cards.html +383 -200
- package/snippets/checkbox-lists.html +199 -65
- package/snippets/code.html +55 -11
- package/snippets/command-palette.html +401 -111
- package/snippets/comparison.html +144 -93
- package/snippets/customization.html +311 -104
- package/snippets/data-display.html +584 -0
- package/snippets/detail-panel.html +470 -138
- package/snippets/filter-card.html +246 -0
- package/snippets/forms.html +408 -308
- package/snippets/grid.html +253 -141
- package/snippets/layout.html +379 -480
- package/snippets/lists.html +144 -47
- package/snippets/loaders.html +64 -39
- package/snippets/manifest.json +330 -280
- package/snippets/modal-dialogs.html +137 -64
- package/snippets/modals.html +221 -151
- package/snippets/notifications.html +285 -0
- package/snippets/popconfirm.html +213 -19
- package/snippets/profile.html +290 -330
- package/snippets/statistics.html +247 -0
- package/snippets/tables.html +359 -150
- package/snippets/tabs.html +129 -45
- package/snippets/timeline.html +123 -56
- package/snippets/toasts.html +179 -31
- package/snippets/tooltips.html +199 -81
- package/snippets/typography.html +183 -58
- package/snippets/utilities.html +511 -415
- package/snippets/virtual-scroll.html +201 -75
- package/snippets/web-daterangepicker.html +369 -189
- package/snippets/web-multiselect.html +360 -124
- package/src/scss/core-components/_alerts.scss +51 -12
- package/src/scss/core-components/_pagers.scss +1 -1
- package/src/scss/core-components/_popconfirm.scss +35 -13
- package/src/scss/core-components/_profile.scss +18 -8
- package/src/scss/core-components/_statistics.scss +12 -12
- package/src/scss/core-components/_tables.scss +2 -134
- package/src/scss/variables/_components.scss +17 -2
- package/scripts/download-themes.js +0 -351
|
@@ -17,13 +17,16 @@ Perfect for:
|
|
|
17
17
|
- No HTML boilerplate needed
|
|
18
18
|
|
|
19
19
|
JAVASCRIPT FILE:
|
|
20
|
-
- src/js/modal-dialogs.js
|
|
20
|
+
- src/js/modal-dialogs.js attaches to window.PureAdmin on load.
|
|
21
|
+
- Include it once in your page shell before calling PureAdmin.*:
|
|
22
|
+
|
|
23
|
+
<script src="/src/js/modal-dialogs.js"></script>
|
|
21
24
|
|
|
22
25
|
AVAILABLE METHODS:
|
|
23
|
-
- PureAdmin.confirm(options) → Promise<boolean>
|
|
24
|
-
- PureAdmin.alert(options)
|
|
25
|
-
- PureAdmin.prompt(options)
|
|
26
|
-
- PureAdmin.custom(options)
|
|
26
|
+
- PureAdmin.confirm(options) → Promise<boolean> (true on confirm, false on cancel)
|
|
27
|
+
- PureAdmin.alert(options) → Promise<void> (resolves when dismissed)
|
|
28
|
+
- PureAdmin.prompt(options) → Promise<string | null> (string on submit, null on cancel)
|
|
29
|
+
- PureAdmin.custom(options) → Promise<any> (whatever you pass to close())
|
|
27
30
|
-->
|
|
28
31
|
|
|
29
32
|
|
|
@@ -199,33 +202,43 @@ async function customDialog() {
|
|
|
199
202
|
================================ -->
|
|
200
203
|
|
|
201
204
|
<!--
|
|
205
|
+
Shared enum-like options (same across all four methods):
|
|
206
|
+
variant → 'primary' | 'success' | 'warning' | 'danger'
|
|
207
|
+
Default: 'primary'. Maps directly to pa-modal--{variant}
|
|
208
|
+
on the root; see modals.html for the visual result.
|
|
209
|
+
size → 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | 'fw'
|
|
210
|
+
The value is string-interpolated into pa-modal__container--
|
|
211
|
+
{size}, so any size class defined in _modals.scss works.
|
|
212
|
+
Default: 'sm' for confirm/alert/prompt, 'md' for custom.
|
|
213
|
+
position → 'center' | 'top'
|
|
214
|
+
Default: 'center'. 'top' adds pa-modal--top (5vh offset).
|
|
215
|
+
|
|
216
|
+
|
|
202
217
|
CONFIRM OPTIONS:
|
|
203
218
|
{
|
|
204
219
|
title: string // Modal title (default: 'Confirm')
|
|
205
220
|
message: string // Message text (default: 'Are you sure?')
|
|
206
221
|
confirmText: string // OK button text (default: 'OK')
|
|
207
222
|
cancelText: string // Cancel button text (default: 'Cancel')
|
|
208
|
-
variant: string //
|
|
223
|
+
variant: string // (default: 'primary')
|
|
209
224
|
confirmVariant: string // Confirm button color (default: same as variant)
|
|
210
|
-
size: string //
|
|
211
|
-
position: string //
|
|
225
|
+
size: string // (default: 'sm')
|
|
226
|
+
position: string // (default: 'center')
|
|
212
227
|
closeOnBackdrop: bool // Allow closing by clicking backdrop (default: true)
|
|
213
228
|
}
|
|
214
|
-
|
|
215
|
-
Returns: Promise<boolean> - true if confirmed, false if cancelled
|
|
229
|
+
Returns: Promise<boolean> — true on confirm, false on cancel/backdrop/Esc.
|
|
216
230
|
|
|
217
231
|
ALERT OPTIONS:
|
|
218
232
|
{
|
|
219
233
|
title: string // Modal title (default: 'Alert')
|
|
220
234
|
message: string // Message text (default: '')
|
|
221
235
|
okText: string // Button text (default: 'OK')
|
|
222
|
-
variant: string // 'primary'
|
|
223
|
-
size: string //
|
|
224
|
-
position: string //
|
|
225
|
-
closeOnBackdrop: bool //
|
|
236
|
+
variant: string // (default: 'primary')
|
|
237
|
+
size: string // (default: 'sm')
|
|
238
|
+
position: string // (default: 'center')
|
|
239
|
+
closeOnBackdrop: bool // (default: true)
|
|
226
240
|
}
|
|
227
|
-
|
|
228
|
-
Returns: Promise<void> - resolves when user clicks OK
|
|
241
|
+
Returns: Promise<void> — resolves when the user dismisses the dialog.
|
|
229
242
|
|
|
230
243
|
PROMPT OPTIONS:
|
|
231
244
|
{
|
|
@@ -235,35 +248,32 @@ PROMPT OPTIONS:
|
|
|
235
248
|
placeholder: string // Input placeholder (default: '')
|
|
236
249
|
confirmText: string // Submit button text (default: 'OK')
|
|
237
250
|
cancelText: string // Cancel button text (default: 'Cancel')
|
|
238
|
-
variant: string // 'primary'
|
|
239
|
-
size: string //
|
|
240
|
-
position: string //
|
|
241
|
-
validator: function //
|
|
242
|
-
closeOnBackdrop: bool //
|
|
251
|
+
variant: string // (default: 'primary')
|
|
252
|
+
size: string // (default: 'sm')
|
|
253
|
+
position: string // (default: 'center')
|
|
254
|
+
validator: function // (value: string) => true | errorMessage
|
|
255
|
+
closeOnBackdrop: bool // (default: true — same as the other methods;
|
|
256
|
+
// if the user clicks backdrop it resolves null
|
|
257
|
+
// just like Cancel)
|
|
243
258
|
}
|
|
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
|
|
259
|
+
Returns: Promise<string | null> — string on submit, null on cancel.
|
|
250
260
|
|
|
251
261
|
CUSTOM OPTIONS:
|
|
252
262
|
{
|
|
253
263
|
title: string // Modal title (default: 'Dialog')
|
|
254
|
-
size: string //
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
264
|
+
size: string // (default: 'md' — note: different from the
|
|
265
|
+
// other methods, which default to 'sm')
|
|
266
|
+
variant: string // (default: 'primary')
|
|
267
|
+
position: string // (default: 'center')
|
|
268
|
+
closeOnBackdrop: bool // (default: true)
|
|
269
|
+
render: function // REQUIRED — (container, close) => void
|
|
270
|
+
// container: the .pa-modal__container element.
|
|
271
|
+
// The JS pre-renders __header; append
|
|
272
|
+
// __body and __footer yourself.
|
|
273
|
+
// close(value): resolve the promise with `value`
|
|
274
|
+
// and tear the modal down.
|
|
259
275
|
}
|
|
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()
|
|
276
|
+
Returns: Promise<any> — whatever value you pass to close().
|
|
267
277
|
-->
|
|
268
278
|
|
|
269
279
|
|
|
@@ -378,34 +388,97 @@ document.querySelector('#deleteForm').addEventListener('submit', async function(
|
|
|
378
388
|
|
|
379
389
|
|
|
380
390
|
<!-- ================================
|
|
381
|
-
|
|
391
|
+
COMPONENT REFERENCE
|
|
382
392
|
================================ -->
|
|
383
393
|
|
|
384
394
|
<!--
|
|
385
|
-
|
|
386
|
-
-
|
|
387
|
-
-
|
|
388
|
-
|
|
389
|
-
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
-
|
|
393
|
-
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
-
|
|
399
|
-
-
|
|
400
|
-
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
-
|
|
395
|
+
MODULE CONTRACT:
|
|
396
|
+
- Loaded via <script src="/src/js/modal-dialogs.js"></script>.
|
|
397
|
+
- Attaches onto window.PureAdmin. If another script already set
|
|
398
|
+
window.PureAdmin, the file extends it non-destructively.
|
|
399
|
+
- Each method appends a fresh .pa-modal element to <body>, runs the
|
|
400
|
+
interaction, resolves the returned Promise, then removes the
|
|
401
|
+
element from the DOM.
|
|
402
|
+
- The DOM it produces is the same as the markup in modals.html — the
|
|
403
|
+
same pa-modal / pa-modal__backdrop / pa-modal__container / __header /
|
|
404
|
+
__body / __footer shell — so any custom styles that target those
|
|
405
|
+
classes apply here too.
|
|
406
|
+
|
|
407
|
+
KEYBOARD / BEHAVIOUR BASELINES (built in, not configurable):
|
|
408
|
+
- Enter confirm / submit (where applicable)
|
|
409
|
+
- Esc cancel (resolves false / null / Promise)
|
|
410
|
+
- Backdrop click close (honours closeOnBackdrop; always dismisses
|
|
411
|
+
with the same value as Esc)
|
|
412
|
+
- Focus auto-focused on the primary button or input
|
|
413
|
+
after open
|
|
414
|
+
- Scrollbar gutter body gets padding-right compensation so the
|
|
415
|
+
layout doesn't shift when the scrollbar hides
|
|
416
|
+
|
|
417
|
+
SECURITY:
|
|
418
|
+
- title / message / button text / placeholder / defaultValue are all
|
|
419
|
+
escaped through textContent → innerHTML before being inserted.
|
|
420
|
+
- Anything you inject via the custom() render(container, close)
|
|
421
|
+
callback is YOUR responsibility — build it from DOM nodes or escape
|
|
422
|
+
it yourself.
|
|
405
423
|
|
|
406
424
|
ACCESSIBILITY:
|
|
407
|
-
-
|
|
408
|
-
-
|
|
409
|
-
|
|
410
|
-
|
|
425
|
+
- role="dialog", aria-modal="true", aria-labelledby pointing at the
|
|
426
|
+
title. Trap-focus and focus-return-on-close are handled by the JS.
|
|
427
|
+
|
|
428
|
+
VS STATIC MODALS (modals.html):
|
|
429
|
+
- modals.html: markup is in the page; JS toggles --show.
|
|
430
|
+
- modal-dialogs.html: JS creates the markup per call; no page shell.
|
|
431
|
+
- Prefer modal-dialogs for confirm/alert/prompt/custom flows where
|
|
432
|
+
you'd otherwise juggle pre-built HTML and ad-hoc event wiring.
|
|
433
|
+
Prefer static modals when the dialog has rich, persistent content
|
|
434
|
+
(long forms, tab panels) that benefits from SSR or living in the
|
|
435
|
+
markup.
|
|
436
|
+
|
|
437
|
+
BROWSER SUPPORT:
|
|
438
|
+
- ES2017 (async/await), Promise, const/let, template literals.
|
|
439
|
+
Chrome / Firefox / Safari / Edge — evergreen only.
|
|
440
|
+
|
|
441
|
+
STRUCTURE PATTERNS:
|
|
442
|
+
|
|
443
|
+
Confirm:
|
|
444
|
+
const ok = await PureAdmin.confirm({
|
|
445
|
+
title: 'Delete item?',
|
|
446
|
+
message: 'Cannot be undone.',
|
|
447
|
+
variant: 'danger', confirmVariant: 'danger',
|
|
448
|
+
confirmText: 'Delete', cancelText: 'Keep',
|
|
449
|
+
closeOnBackdrop: false
|
|
450
|
+
});
|
|
451
|
+
if (!ok) return;
|
|
452
|
+
|
|
453
|
+
Alert:
|
|
454
|
+
await PureAdmin.alert({ title: 'Saved', variant: 'success' });
|
|
455
|
+
|
|
456
|
+
Prompt with validation:
|
|
457
|
+
const email = await PureAdmin.prompt({
|
|
458
|
+
title: 'Email', placeholder: 'you@example.com',
|
|
459
|
+
validator: (v) => v.includes('@') || 'Must be a valid email'
|
|
460
|
+
});
|
|
461
|
+
if (email === null) return;
|
|
462
|
+
|
|
463
|
+
Custom (promise resolves with whatever close() is called with):
|
|
464
|
+
const result = await PureAdmin.custom({
|
|
465
|
+
title: 'Preferences', size: 'lg',
|
|
466
|
+
render: (container, close) => {
|
|
467
|
+
const body = document.createElement('div');
|
|
468
|
+
body.className = 'pa-modal__body';
|
|
469
|
+
body.innerHTML = '<p>Custom content here.</p>';
|
|
470
|
+
|
|
471
|
+
const footer = document.createElement('div');
|
|
472
|
+
footer.className = 'pa-modal__footer';
|
|
473
|
+
footer.innerHTML = `
|
|
474
|
+
<button class="pa-btn pa-btn--secondary" data-cancel>Cancel</button>
|
|
475
|
+
<button class="pa-btn pa-btn--primary" data-save>Save</button>
|
|
476
|
+
`;
|
|
477
|
+
|
|
478
|
+
container.append(body, footer);
|
|
479
|
+
footer.querySelector('[data-cancel]').onclick = () => close(null);
|
|
480
|
+
footer.querySelector('[data-save]').onclick = () => close({ ok: true });
|
|
481
|
+
}
|
|
482
|
+
});
|
|
411
483
|
-->
|
|
484
|
+
|