@magic-spells/dialog-panel 0.1.0 → 0.2.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 +85 -8
- package/dist/dialog-panel.cjs.js +151 -36
- package/dist/dialog-panel.cjs.js.map +1 -1
- package/dist/dialog-panel.css +71 -0
- package/dist/dialog-panel.esm.js +151 -36
- package/dist/dialog-panel.esm.js.map +1 -1
- package/dist/dialog-panel.js +492 -0
- package/dist/dialog-panel.js.map +1 -0
- package/dist/dialog-panel.min.css +1 -1
- package/dist/dialog-panel.min.js +1 -1
- package/dist/dialog-panel.scss +2 -0
- package/dist/scss/dialog-panel.scss +73 -0
- package/dist/scss/variables.scss +54 -0
- package/package.json +10 -4
- package/src/dialog-panel.js +152 -37
- package/src/index.scss +2 -0
- package/src/scss/dialog-panel.scss +73 -0
- package/src/scss/variables.scss +54 -0
- package/src/dialog-panel.css +0 -47
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A lightweight, customizable Web Component for creating accessible modal dialogs. Ideal for dialogs, alerts, cart panels, or content panels with smooth animations and accessibility features.
|
|
4
4
|
|
|
5
|
+
[**Live Demo**](https://magic-spells.github.io/dialog-panel/demo/)
|
|
6
|
+
|
|
5
7
|
## Features
|
|
6
8
|
|
|
7
9
|
- No dependencies
|
|
@@ -82,7 +84,55 @@ Or include directly in your HTML:
|
|
|
82
84
|
|
|
83
85
|
### Styling
|
|
84
86
|
|
|
85
|
-
|
|
87
|
+
#### Using CSS Custom Properties
|
|
88
|
+
|
|
89
|
+
You can style the Dialog Panel by overriding the CSS custom properties:
|
|
90
|
+
|
|
91
|
+
```css
|
|
92
|
+
:root {
|
|
93
|
+
/* Layout */
|
|
94
|
+
--dp-panel-z-index: 100;
|
|
95
|
+
|
|
96
|
+
/* Overlay */
|
|
97
|
+
--dp-overlay-background: rgba(0, 0, 0, 0.7);
|
|
98
|
+
--dp-overlay-backdrop-filter: blur(5px) saturate(120%);
|
|
99
|
+
|
|
100
|
+
/* Content */
|
|
101
|
+
--dp-content-background: #f8f8f8;
|
|
102
|
+
|
|
103
|
+
/* Animation */
|
|
104
|
+
--dp-transition-duration: 400ms;
|
|
105
|
+
--dp-transition-timing: cubic-bezier(0.4, 0, 0.2, 1);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### Using SCSS
|
|
110
|
+
|
|
111
|
+
For more advanced customization, you can import the SCSS directly:
|
|
112
|
+
|
|
113
|
+
```scss
|
|
114
|
+
// Option 1: Import the compiled CSS
|
|
115
|
+
@import '@magic-spells/dialog-panel/css';
|
|
116
|
+
|
|
117
|
+
// Option 2: Import the SCSS and override variables
|
|
118
|
+
@use '@magic-spells/dialog-panel/scss' with (
|
|
119
|
+
$overlay-background: rgba(0, 0, 0, 0.7),
|
|
120
|
+
$overlay-backdrop-filter: blur(5px) saturate(120%),
|
|
121
|
+
$content-background: #f8f8f8,
|
|
122
|
+
$transition-duration: 400ms,
|
|
123
|
+
$transition-timing: cubic-bezier(0.4, 0, 0.2, 1)
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
// Option 3: Import specific parts
|
|
127
|
+
@use '@magic-spells/dialog-panel/scss/variables' with (
|
|
128
|
+
$panel-z-index: 100
|
|
129
|
+
);
|
|
130
|
+
@use '@magic-spells/dialog-panel/scss/dialog-panel';
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
#### Direct Element Styling
|
|
134
|
+
|
|
135
|
+
You can also style the elements directly:
|
|
86
136
|
|
|
87
137
|
```css
|
|
88
138
|
dialog-panel {
|
|
@@ -92,19 +142,46 @@ dialog-panel {
|
|
|
92
142
|
dialog-overlay {
|
|
93
143
|
background-color: rgba(0, 0, 0, 0.5);
|
|
94
144
|
}
|
|
95
|
-
|
|
96
|
-
[data-action='hide-dialog'] {
|
|
97
|
-
font-size: 24px;
|
|
98
|
-
color: #333;
|
|
99
|
-
}
|
|
100
145
|
```
|
|
101
146
|
|
|
102
147
|
### JavaScript API
|
|
103
148
|
|
|
104
149
|
#### Methods
|
|
105
150
|
|
|
106
|
-
- `show()`: Opens the dialog panel
|
|
107
|
-
- `hide()`: Closes the dialog panel
|
|
151
|
+
- `show(triggerEl)`: Opens the dialog panel. Returns false if the action was prevented.
|
|
152
|
+
- `hide()`: Closes the dialog panel. Returns false if the action was prevented.
|
|
153
|
+
|
|
154
|
+
#### Events
|
|
155
|
+
|
|
156
|
+
The dialog panel emits the following events that you can listen for:
|
|
157
|
+
|
|
158
|
+
- `beforeShow`: Fired before the dialog starts to show. Cancelable - you can call `preventDefault()` to prevent the dialog from opening.
|
|
159
|
+
- `show`: Fired when the dialog has been shown (after transitions).
|
|
160
|
+
- `beforeHide`: Fired before the dialog starts to hide. Cancelable - you can call `preventDefault()` to prevent the dialog from closing.
|
|
161
|
+
- `hide`: Fired when the dialog has started hiding (transition begins).
|
|
162
|
+
- `afterHide`: Fired when the dialog has completed its hide transition.
|
|
163
|
+
|
|
164
|
+
Each event provides a `detail` object with the `triggerElement` that initiated the action (if any).
|
|
165
|
+
|
|
166
|
+
Example usage:
|
|
167
|
+
|
|
168
|
+
```javascript
|
|
169
|
+
const dialog = document.getElementById('my-dialog');
|
|
170
|
+
|
|
171
|
+
// Prevent dialog from closing based on some condition
|
|
172
|
+
dialog.addEventListener('beforeHide', (e) => {
|
|
173
|
+
if (someFormIsUnsaved) {
|
|
174
|
+
e.preventDefault(); // Prevents the dialog from closing
|
|
175
|
+
// Show a confirmation message instead
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// Do something after the dialog is fully hidden
|
|
180
|
+
dialog.addEventListener('afterHide', () => {
|
|
181
|
+
console.log('Dialog is now fully hidden');
|
|
182
|
+
// Clean up or reset form fields, etc.
|
|
183
|
+
});
|
|
184
|
+
```
|
|
108
185
|
|
|
109
186
|
## Browser Support
|
|
110
187
|
|
package/dist/dialog-panel.cjs.js
CHANGED
|
@@ -200,6 +200,50 @@ customElements.define('focus-trap-end', FocusTrapEnd);
|
|
|
200
200
|
* @extends HTMLElement
|
|
201
201
|
*/
|
|
202
202
|
class DialogPanel extends HTMLElement {
|
|
203
|
+
#handleTransitionEnd;
|
|
204
|
+
#scrollPosition = 0;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Clean up event listeners when component is removed from DOM
|
|
208
|
+
*/
|
|
209
|
+
disconnectedCallback() {
|
|
210
|
+
const _ = this;
|
|
211
|
+
if (_.contentPanel) {
|
|
212
|
+
_.contentPanel.removeEventListener('transitionend', _.#handleTransitionEnd);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Ensure body scroll is restored if component is removed while open
|
|
216
|
+
document.body.classList.remove('overflow-hidden');
|
|
217
|
+
this.#restoreScroll();
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Saves current scroll position and locks body scrolling
|
|
222
|
+
* @private
|
|
223
|
+
*/
|
|
224
|
+
#lockScroll() {
|
|
225
|
+
const _ = this;
|
|
226
|
+
// Save current scroll position
|
|
227
|
+
_.#scrollPosition = window.pageYOffset;
|
|
228
|
+
|
|
229
|
+
// Apply fixed position to body
|
|
230
|
+
document.body.classList.add('overflow-hidden');
|
|
231
|
+
document.body.style.top = `-${_.#scrollPosition}px`;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Restores scroll position when dialog is closed
|
|
236
|
+
* @private
|
|
237
|
+
*/
|
|
238
|
+
#restoreScroll() {
|
|
239
|
+
const _ = this;
|
|
240
|
+
// Remove fixed positioning
|
|
241
|
+
document.body.classList.remove('overflow-hidden');
|
|
242
|
+
document.body.style.removeProperty('top');
|
|
243
|
+
|
|
244
|
+
// Restore scroll position
|
|
245
|
+
window.scrollTo(0, _.#scrollPosition);
|
|
246
|
+
}
|
|
203
247
|
/**
|
|
204
248
|
* Initializes the dialog panel, sets up focus trap and overlay
|
|
205
249
|
*/
|
|
@@ -214,6 +258,19 @@ class DialogPanel extends HTMLElement {
|
|
|
214
258
|
_.contentPanel = _.querySelector('dialog-content');
|
|
215
259
|
_.focusTrap = document.createElement('focus-trap');
|
|
216
260
|
_.triggerEl = null;
|
|
261
|
+
|
|
262
|
+
// Create a handler for transition end events
|
|
263
|
+
_.#handleTransitionEnd = (e) => {
|
|
264
|
+
if (e.propertyName === 'opacity' && _.getAttribute('aria-hidden') === 'true') {
|
|
265
|
+
_.contentPanel.classList.add('hidden');
|
|
266
|
+
|
|
267
|
+
// Dispatch afterHide event - dialog has completed its transition
|
|
268
|
+
_.dispatchEvent(new CustomEvent('afterHide', {
|
|
269
|
+
bubbles: true,
|
|
270
|
+
detail: { triggerElement: _.triggerEl }
|
|
271
|
+
}));
|
|
272
|
+
}
|
|
273
|
+
};
|
|
217
274
|
|
|
218
275
|
// Ensure we have labelledby and describedby references
|
|
219
276
|
if (!_.getAttribute('aria-labelledby')) {
|
|
@@ -245,10 +302,12 @@ class DialogPanel extends HTMLElement {
|
|
|
245
302
|
* @private
|
|
246
303
|
*/
|
|
247
304
|
#bindUI() {
|
|
305
|
+
const _ = this;
|
|
306
|
+
|
|
248
307
|
// Handle trigger buttons
|
|
249
308
|
document.addEventListener('click', (e) => {
|
|
250
309
|
const trigger = e.target.closest(
|
|
251
|
-
`[aria-controls="${
|
|
310
|
+
`[aria-controls="${_.id}"]`
|
|
252
311
|
);
|
|
253
312
|
if (!trigger) return;
|
|
254
313
|
|
|
@@ -256,15 +315,17 @@ class DialogPanel extends HTMLElement {
|
|
|
256
315
|
e.preventDefault();
|
|
257
316
|
}
|
|
258
317
|
|
|
259
|
-
|
|
260
|
-
this.show(trigger);
|
|
318
|
+
_.show(trigger);
|
|
261
319
|
});
|
|
262
320
|
|
|
263
321
|
// Handle close buttons
|
|
264
|
-
|
|
322
|
+
_.addEventListener('click', (e) => {
|
|
265
323
|
if (!e.target.closest('[data-action="hide-dialog"]')) return;
|
|
266
|
-
|
|
324
|
+
_.hide();
|
|
267
325
|
});
|
|
326
|
+
|
|
327
|
+
// Add transition end listener
|
|
328
|
+
_.contentPanel.addEventListener('transitionend', _.#handleTransitionEnd);
|
|
268
329
|
}
|
|
269
330
|
|
|
270
331
|
/**
|
|
@@ -282,50 +343,104 @@ class DialogPanel extends HTMLElement {
|
|
|
282
343
|
/**
|
|
283
344
|
* Shows the dialog and traps focus within it
|
|
284
345
|
* @param {HTMLElement} [triggerEl=null] - The element that triggered the dialog
|
|
346
|
+
* @fires DialogPanel#beforeShow - Fired before the dialog starts to show
|
|
347
|
+
* @fires DialogPanel#show - Fired when the dialog has been shown
|
|
348
|
+
* @returns {boolean} False if the show was prevented by a beforeShow event handler
|
|
285
349
|
*/
|
|
286
350
|
show(triggerEl = null) {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
// Update ARIA states
|
|
290
|
-
this.setAttribute('aria-hidden', 'false');
|
|
291
|
-
if (this.triggerEl) {
|
|
292
|
-
this.triggerEl.setAttribute('aria-expanded', 'true');
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// prevent body from scrolling
|
|
296
|
-
document.body.classList.add('overflow-hidden');
|
|
351
|
+
const _ = this;
|
|
352
|
+
_.triggerEl = triggerEl || false;
|
|
297
353
|
|
|
298
|
-
//
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
354
|
+
// Dispatch beforeShow event - allows preventing the dialog from opening
|
|
355
|
+
const beforeShowEvent = new CustomEvent('beforeShow', {
|
|
356
|
+
bubbles: true,
|
|
357
|
+
cancelable: true,
|
|
358
|
+
detail: { triggerElement: _.triggerEl }
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
const showAllowed = _.dispatchEvent(beforeShowEvent);
|
|
362
|
+
|
|
363
|
+
// If event was canceled (preventDefault was called), don't show the dialog
|
|
364
|
+
if (!showAllowed) return false;
|
|
365
|
+
|
|
366
|
+
// Remove the hidden class first to ensure content is rendered
|
|
367
|
+
_.contentPanel.classList.remove('hidden');
|
|
368
|
+
|
|
369
|
+
// Give the browser a moment to process before starting animation
|
|
370
|
+
requestAnimationFrame(() => {
|
|
371
|
+
// Update ARIA states
|
|
372
|
+
_.setAttribute('aria-hidden', 'false');
|
|
373
|
+
if (_.triggerEl) {
|
|
374
|
+
_.triggerEl.setAttribute('aria-expanded', 'true');
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// Lock body scrolling and save scroll position
|
|
378
|
+
_.#lockScroll();
|
|
379
|
+
|
|
380
|
+
// Focus management
|
|
381
|
+
const firstFocusable = _.querySelector(
|
|
382
|
+
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
383
|
+
);
|
|
384
|
+
if (firstFocusable) {
|
|
385
|
+
requestAnimationFrame(() => {
|
|
386
|
+
firstFocusable.focus();
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// Dispatch show event - dialog is now visible
|
|
391
|
+
_.dispatchEvent(new CustomEvent('show', {
|
|
392
|
+
bubbles: true,
|
|
393
|
+
detail: { triggerElement: _.triggerEl }
|
|
394
|
+
}));
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
return true;
|
|
307
398
|
}
|
|
308
399
|
|
|
309
400
|
/**
|
|
310
401
|
* Hides the dialog and restores focus
|
|
402
|
+
* @fires DialogPanel#beforeHide - Fired before the dialog starts to hide
|
|
403
|
+
* @fires DialogPanel#hide - Fired when the dialog has started hiding (transition begins)
|
|
404
|
+
* @fires DialogPanel#afterHide - Fired when the dialog has completed its hide transition
|
|
405
|
+
* @returns {boolean} False if the hide was prevented by a beforeHide event handler
|
|
311
406
|
*/
|
|
312
407
|
hide() {
|
|
313
|
-
|
|
314
|
-
|
|
408
|
+
const _ = this;
|
|
409
|
+
|
|
410
|
+
// Dispatch beforeHide event - allows preventing the dialog from closing
|
|
411
|
+
const beforeHideEvent = new CustomEvent('beforeHide', {
|
|
412
|
+
bubbles: true,
|
|
413
|
+
cancelable: true,
|
|
414
|
+
detail: { triggerElement: _.triggerEl }
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
const hideAllowed = _.dispatchEvent(beforeHideEvent);
|
|
418
|
+
|
|
419
|
+
// If event was canceled (preventDefault was called), don't hide the dialog
|
|
420
|
+
if (!hideAllowed) return false;
|
|
421
|
+
|
|
422
|
+
// Restore body scroll and scroll position
|
|
423
|
+
_.#restoreScroll();
|
|
315
424
|
|
|
316
425
|
// Update ARIA states
|
|
317
|
-
if (
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
console.log('we need to blur focus');
|
|
426
|
+
if (_.triggerEl) {
|
|
427
|
+
// remove focus from modal panel first
|
|
428
|
+
_.triggerEl.focus();
|
|
429
|
+
// mark trigger as no longer expanded
|
|
430
|
+
_.triggerEl.setAttribute('aria-expanded', 'false');
|
|
323
431
|
}
|
|
324
432
|
|
|
325
|
-
//
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
433
|
+
// Set aria-hidden to start transition
|
|
434
|
+
// The transitionend event handler will add display:none when complete
|
|
435
|
+
_.setAttribute('aria-hidden', 'true');
|
|
436
|
+
|
|
437
|
+
// Dispatch hide event - dialog is now starting to hide
|
|
438
|
+
_.dispatchEvent(new CustomEvent('hide', {
|
|
439
|
+
bubbles: true,
|
|
440
|
+
detail: { triggerElement: _.triggerEl }
|
|
441
|
+
}));
|
|
442
|
+
|
|
443
|
+
return true;
|
|
329
444
|
}
|
|
330
445
|
}
|
|
331
446
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-panel.cjs.js","sources":["../node_modules/@magic-spells/focus-trap/dist/focus-trap.esm.js","../src/dialog-panel.js"],"sourcesContent":["/**\n * Retrieves all focusable elements within a given container.\n *\n * @param {HTMLElement} container - The container element to search for focusable elements.\n * @returns {HTMLElement[]} An array of focusable elements found within the container.\n */\nconst getFocusableElements = (container) => {\n\tconst focusableSelectors =\n\t\t'summary, a[href], button:not(:disabled), [tabindex]:not([tabindex^=\"-\"]):not(focus-trap-start):not(focus-trap-end), [draggable], area, input:not([type=hidden]):not(:disabled), select:not(:disabled), textarea:not(:disabled), object, iframe';\n\treturn Array.from(container.querySelectorAll(focusableSelectors));\n};\n\nclass FocusTrap extends HTMLElement {\n\t/** @type {boolean} Indicates whether the styles have been injected into the DOM. */\n\tstatic styleInjected = false;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.trapStart = null;\n\t\tthis.trapEnd = null;\n\n\t\t// Inject styles only once, when the first FocusTrap instance is created.\n\t\tif (!FocusTrap.styleInjected) {\n\t\t\tthis.injectStyles();\n\t\t\tFocusTrap.styleInjected = true;\n\t\t}\n\t}\n\n\t/**\n\t * Injects necessary styles for the focus trap into the document's head.\n\t * This ensures that focus-trap-start and focus-trap-end elements are hidden.\n\t */\n\tinjectStyles() {\n\t\tconst style = document.createElement('style');\n\t\tstyle.textContent = `\n focus-trap-start,\n focus-trap-end {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n border: 0;\n clip: rect(0, 0, 0, 0);\n overflow: hidden;\n white-space: nowrap;\n }\n `;\n\t\tdocument.head.appendChild(style);\n\t}\n\n\t/**\n\t * Called when the element is connected to the DOM.\n\t * Sets up the focus trap and adds the keydown event listener.\n\t */\n\tconnectedCallback() {\n\t\tthis.setupTrap();\n\t\tthis.addEventListener('keydown', this.handleKeyDown);\n\t}\n\n\t/**\n\t * Called when the element is disconnected from the DOM.\n\t * Removes the keydown event listener.\n\t */\n\tdisconnectedCallback() {\n\t\tthis.removeEventListener('keydown', this.handleKeyDown);\n\t}\n\n\t/**\n\t * Sets up the focus trap by adding trap start and trap end elements.\n\t * Focuses the trap start element to initiate the focus trap.\n\t */\n\tsetupTrap() {\n\t\t// check to see it there are any focusable children\n\t\tconst focusableElements = getFocusableElements(this);\n\t\t// exit if there aren't any\n\t\tif (focusableElements.length === 0) return;\n\n\t\t// create trap start and end elements\n\t\tthis.trapStart = document.createElement('focus-trap-start');\n\t\tthis.trapEnd = document.createElement('focus-trap-end');\n\n\t\t// add to DOM\n\t\tthis.prepend(this.trapStart);\n\t\tthis.append(this.trapEnd);\n\t}\n\n\t/**\n\t * Handles the keydown event. If the Escape key is pressed, the focus trap is exited.\n\t *\n\t * @param {KeyboardEvent} e - The keyboard event object.\n\t */\n\thandleKeyDown = (e) => {\n\t\tif (e.key === 'Escape') {\n\t\t\te.preventDefault();\n\t\t\tthis.exitTrap();\n\t\t}\n\t};\n\n\t/**\n\t * Exits the focus trap by hiding the current container and shifting focus\n\t * back to the trigger element that opened the trap.\n\t */\n\texitTrap() {\n\t\tconst container = this.closest('[aria-hidden=\"false\"]');\n\t\tif (!container) return;\n\n\t\tcontainer.setAttribute('aria-hidden', 'true');\n\n\t\tconst trigger = document.querySelector(\n\t\t\t`[aria-expanded=\"true\"][aria-controls=\"${container.id}\"]`\n\t\t);\n\t\tif (trigger) {\n\t\t\ttrigger.setAttribute('aria-expanded', 'false');\n\t\t\ttrigger.focus();\n\t\t}\n\t}\n}\n\nclass FocusTrapStart extends HTMLElement {\n\t/**\n\t * Called when the element is connected to the DOM.\n\t * Sets the tabindex and adds the focus event listener.\n\t */\n\tconnectedCallback() {\n\t\tthis.setAttribute('tabindex', '0');\n\t\tthis.addEventListener('focus', this.handleFocus);\n\t}\n\n\t/**\n\t * Called when the element is disconnected from the DOM.\n\t * Removes the focus event listener.\n\t */\n\tdisconnectedCallback() {\n\t\tthis.removeEventListener('focus', this.handleFocus);\n\t}\n\n\t/**\n\t * Handles the focus event. If focus moves backwards from the first focusable element,\n\t * it is cycled to the last focusable element, and vice versa.\n\t *\n\t * @param {FocusEvent} e - The focus event object.\n\t */\n\thandleFocus = (e) => {\n\t\tconst trap = this.closest('focus-trap');\n\t\tconst focusableElements = getFocusableElements(trap);\n\n\t\tif (focusableElements.length === 0) return;\n\n\t\tconst firstElement = focusableElements[0];\n\t\tconst lastElement =\n\t\t\tfocusableElements[focusableElements.length - 1];\n\n\t\tif (e.relatedTarget === firstElement) {\n\t\t\tlastElement.focus();\n\t\t} else {\n\t\t\tfirstElement.focus();\n\t\t}\n\t};\n}\n\nclass FocusTrapEnd extends HTMLElement {\n\t/**\n\t * Called when the element is connected to the DOM.\n\t * Sets the tabindex and adds the focus event listener.\n\t */\n\tconnectedCallback() {\n\t\tthis.setAttribute('tabindex', '0');\n\t\tthis.addEventListener('focus', this.handleFocus);\n\t}\n\n\t/**\n\t * Called when the element is disconnected from the DOM.\n\t * Removes the focus event listener.\n\t */\n\tdisconnectedCallback() {\n\t\tthis.removeEventListener('focus', this.handleFocus);\n\t}\n\n\t/**\n\t * Handles the focus event. When the trap end is focused, focus is shifted back to the trap start.\n\t */\n\thandleFocus = () => {\n\t\tconst trap = this.closest('focus-trap');\n\t\tconst trapStart = trap.querySelector('focus-trap-start');\n\t\ttrapStart.focus();\n\t};\n}\n\ncustomElements.define('focus-trap', FocusTrap);\ncustomElements.define('focus-trap-start', FocusTrapStart);\ncustomElements.define('focus-trap-end', FocusTrapEnd);\n//# sourceMappingURL=focus-trap.esm.js.map\n","import './dialog-panel.css';\nimport '@magic-spells/focus-trap';\n\n/**\n * Custom element that creates an accessible modal dialog panel with focus management\n * @extends HTMLElement\n */\nclass DialogPanel extends HTMLElement {\n\t/**\n\t * Initializes the dialog panel, sets up focus trap and overlay\n\t */\n\tconstructor() {\n\t\tsuper();\n\t\tconst _ = this;\n\t\t_.id = _.getAttribute('id');\n\t\t_.setAttribute('role', 'dialog');\n\t\t_.setAttribute('aria-modal', 'true');\n\t\t_.setAttribute('aria-hidden', 'true');\n\n\t\t_.contentPanel = _.querySelector('dialog-content');\n\t\t_.focusTrap = document.createElement('focus-trap');\n\t\t_.triggerEl = null;\n\n\t\t// Ensure we have labelledby and describedby references\n\t\tif (!_.getAttribute('aria-labelledby')) {\n\t\t\tconst heading = _.querySelector('h1, h2, h3');\n\t\t\tif (heading && !heading.id) {\n\t\t\t\theading.id = `${_.id}-title`;\n\t\t\t}\n\t\t\tif (heading?.id) {\n\t\t\t\t_.setAttribute('aria-labelledby', heading.id);\n\t\t\t}\n\t\t}\n\n\t\t_.contentPanel.parentNode.insertBefore(\n\t\t\t_.focusTrap,\n\t\t\t_.contentPanel\n\t\t);\n\t\t_.focusTrap.appendChild(_.contentPanel);\n\n\t\t_.focusTrap.setupTrap();\n\n\t\t// Add modal overlay\n\t\t_.prepend(document.createElement('dialog-overlay'));\n\t\t_.#bindUI();\n\t\t_.#bindKeyboard();\n\t}\n\n\t/**\n\t * Binds click events for showing and hiding the dialog\n\t * @private\n\t */\n\t#bindUI() {\n\t\t// Handle trigger buttons\n\t\tdocument.addEventListener('click', (e) => {\n\t\t\tconst trigger = e.target.closest(\n\t\t\t\t`[aria-controls=\"${this.id}\"]`\n\t\t\t);\n\t\t\tif (!trigger) return;\n\n\t\t\tif (trigger.getAttribute('data-prevent-default') === 'true') {\n\t\t\t\te.preventDefault();\n\t\t\t}\n\n\t\t\t// this.triggerEl = trigger;\n\t\t\tthis.show(trigger);\n\t\t});\n\n\t\t// Handle close buttons\n\t\tthis.addEventListener('click', (e) => {\n\t\t\tif (!e.target.closest('[data-action=\"hide-dialog\"]')) return;\n\t\t\tthis.hide();\n\t\t});\n\t}\n\n\t/**\n\t * Binds keyboard events for accessibility\n\t * @private\n\t */\n\t#bindKeyboard() {\n\t\tthis.addEventListener('keydown', (e) => {\n\t\t\tif (e.key === 'Escape') {\n\t\t\t\tthis.hide();\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Shows the dialog and traps focus within it\n\t * @param {HTMLElement} [triggerEl=null] - The element that triggered the dialog\n\t */\n\tshow(triggerEl = null) {\n\t\tthis.triggerEl = triggerEl || false;\n\n\t\t// Update ARIA states\n\t\tthis.setAttribute('aria-hidden', 'false');\n\t\tif (this.triggerEl) {\n\t\t\tthis.triggerEl.setAttribute('aria-expanded', 'true');\n\t\t}\n\n\t\t// prevent body from scrolling\n\t\tdocument.body.classList.add('overflow-hidden');\n\n\t\t// Focus management\n\t\tconst firstFocusable = this.querySelector(\n\t\t\t'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n\t\t);\n\t\tif (firstFocusable) {\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tfirstFocusable.focus();\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Hides the dialog and restores focus\n\t */\n\thide() {\n\t\t// allow body to scroll\n\t\tdocument.body.classList.remove('overflow-hidden');\n\n\t\t// Update ARIA states\n\t\tif (this.triggerEl) {\n\t\t\tthis.triggerEl.setAttribute('aria-expanded', 'false');\n\t\t\t// Restore focus to trigger element\n\t\t\tthis.triggerEl.focus();\n\t\t} else {\n\t\t\tconsole.log('we need to blur focus');\n\t\t}\n\n\t\t// hide dialog panel\n\t\tsetTimeout(() => {\n\t\t\tthis.setAttribute('aria-hidden', 'true');\n\t\t}, 1);\n\t}\n}\n\n/**\n * Custom element that creates a clickable overlay for the dialog\n * @extends HTMLElement\n */\nclass DialogOverlay extends HTMLElement {\n\tconstructor() {\n\t\tsuper();\n\t\tthis.setAttribute('tabindex', '-1'); // Changed to -1 as it shouldn't be focusable\n\t\tthis.setAttribute('aria-hidden', 'true');\n\t\tthis.dialogPanel = this.closest('dialog-panel');\n\t\tthis.#bindUI();\n\t}\n\n\t#bindUI() {\n\t\tthis.addEventListener('click', () => {\n\t\t\tthis.dialogPanel.hide();\n\t\t});\n\t}\n}\n\n/**\n * Custom element that wraps the content of the dialog\n * @extends HTMLElement\n */\nclass DialogContent extends HTMLElement {\n\tconstructor() {\n\t\tsuper();\n\t\tthis.setAttribute('role', 'document'); // Optional: helps with document structure\n\t}\n}\n\ncustomElements.define('dialog-panel', DialogPanel);\ncustomElements.define('dialog-overlay', DialogOverlay);\ncustomElements.define('dialog-content', DialogContent);\n\nexport { DialogPanel, DialogOverlay, DialogContent };\nexport default DialogPanel;\n"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,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CAAC;AAClD,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;AACjB,EAAE;AACF;AACA,CAAC,OAAO,GAAG;AACX,EAAE,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM;AACvC,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;AAC3B,GAAG,CAAC,CAAC;AACL,EAAE;AACF,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,MAAM,aAAa,SAAS,WAAW,CAAC;AACxC,CAAC,WAAW,GAAG;AACf,EAAE,KAAK,EAAE,CAAC;AACV,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AACxC,EAAE;AACF,CAAC;AACD;AACA,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;AACnD,cAAc,CAAC,MAAM,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;AACvD,cAAc,CAAC,MAAM,CAAC,gBAAgB,EAAE,aAAa,CAAC;;;;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"dialog-panel.cjs.js","sources":["../node_modules/@magic-spells/focus-trap/dist/focus-trap.esm.js","../src/dialog-panel.js"],"sourcesContent":["/**\n * Retrieves all focusable elements within a given container.\n *\n * @param {HTMLElement} container - The container element to search for focusable elements.\n * @returns {HTMLElement[]} An array of focusable elements found within the container.\n */\nconst getFocusableElements = (container) => {\n\tconst focusableSelectors =\n\t\t'summary, a[href], button:not(:disabled), [tabindex]:not([tabindex^=\"-\"]):not(focus-trap-start):not(focus-trap-end), [draggable], area, input:not([type=hidden]):not(:disabled), select:not(:disabled), textarea:not(:disabled), object, iframe';\n\treturn Array.from(container.querySelectorAll(focusableSelectors));\n};\n\nclass FocusTrap extends HTMLElement {\n\t/** @type {boolean} Indicates whether the styles have been injected into the DOM. */\n\tstatic styleInjected = false;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.trapStart = null;\n\t\tthis.trapEnd = null;\n\n\t\t// Inject styles only once, when the first FocusTrap instance is created.\n\t\tif (!FocusTrap.styleInjected) {\n\t\t\tthis.injectStyles();\n\t\t\tFocusTrap.styleInjected = true;\n\t\t}\n\t}\n\n\t/**\n\t * Injects necessary styles for the focus trap into the document's head.\n\t * This ensures that focus-trap-start and focus-trap-end elements are hidden.\n\t */\n\tinjectStyles() {\n\t\tconst style = document.createElement('style');\n\t\tstyle.textContent = `\n focus-trap-start,\n focus-trap-end {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n border: 0;\n clip: rect(0, 0, 0, 0);\n overflow: hidden;\n white-space: nowrap;\n }\n `;\n\t\tdocument.head.appendChild(style);\n\t}\n\n\t/**\n\t * Called when the element is connected to the DOM.\n\t * Sets up the focus trap and adds the keydown event listener.\n\t */\n\tconnectedCallback() {\n\t\tthis.setupTrap();\n\t\tthis.addEventListener('keydown', this.handleKeyDown);\n\t}\n\n\t/**\n\t * Called when the element is disconnected from the DOM.\n\t * Removes the keydown event listener.\n\t */\n\tdisconnectedCallback() {\n\t\tthis.removeEventListener('keydown', this.handleKeyDown);\n\t}\n\n\t/**\n\t * Sets up the focus trap by adding trap start and trap end elements.\n\t * Focuses the trap start element to initiate the focus trap.\n\t */\n\tsetupTrap() {\n\t\t// check to see it there are any focusable children\n\t\tconst focusableElements = getFocusableElements(this);\n\t\t// exit if there aren't any\n\t\tif (focusableElements.length === 0) return;\n\n\t\t// create trap start and end elements\n\t\tthis.trapStart = document.createElement('focus-trap-start');\n\t\tthis.trapEnd = document.createElement('focus-trap-end');\n\n\t\t// add to DOM\n\t\tthis.prepend(this.trapStart);\n\t\tthis.append(this.trapEnd);\n\t}\n\n\t/**\n\t * Handles the keydown event. If the Escape key is pressed, the focus trap is exited.\n\t *\n\t * @param {KeyboardEvent} e - The keyboard event object.\n\t */\n\thandleKeyDown = (e) => {\n\t\tif (e.key === 'Escape') {\n\t\t\te.preventDefault();\n\t\t\tthis.exitTrap();\n\t\t}\n\t};\n\n\t/**\n\t * Exits the focus trap by hiding the current container and shifting focus\n\t * back to the trigger element that opened the trap.\n\t */\n\texitTrap() {\n\t\tconst container = this.closest('[aria-hidden=\"false\"]');\n\t\tif (!container) return;\n\n\t\tcontainer.setAttribute('aria-hidden', 'true');\n\n\t\tconst trigger = document.querySelector(\n\t\t\t`[aria-expanded=\"true\"][aria-controls=\"${container.id}\"]`\n\t\t);\n\t\tif (trigger) {\n\t\t\ttrigger.setAttribute('aria-expanded', 'false');\n\t\t\ttrigger.focus();\n\t\t}\n\t}\n}\n\nclass FocusTrapStart extends HTMLElement {\n\t/**\n\t * Called when the element is connected to the DOM.\n\t * Sets the tabindex and adds the focus event listener.\n\t */\n\tconnectedCallback() {\n\t\tthis.setAttribute('tabindex', '0');\n\t\tthis.addEventListener('focus', this.handleFocus);\n\t}\n\n\t/**\n\t * Called when the element is disconnected from the DOM.\n\t * Removes the focus event listener.\n\t */\n\tdisconnectedCallback() {\n\t\tthis.removeEventListener('focus', this.handleFocus);\n\t}\n\n\t/**\n\t * Handles the focus event. If focus moves backwards from the first focusable element,\n\t * it is cycled to the last focusable element, and vice versa.\n\t *\n\t * @param {FocusEvent} e - The focus event object.\n\t */\n\thandleFocus = (e) => {\n\t\tconst trap = this.closest('focus-trap');\n\t\tconst focusableElements = getFocusableElements(trap);\n\n\t\tif (focusableElements.length === 0) return;\n\n\t\tconst firstElement = focusableElements[0];\n\t\tconst lastElement =\n\t\t\tfocusableElements[focusableElements.length - 1];\n\n\t\tif (e.relatedTarget === firstElement) {\n\t\t\tlastElement.focus();\n\t\t} else {\n\t\t\tfirstElement.focus();\n\t\t}\n\t};\n}\n\nclass FocusTrapEnd extends HTMLElement {\n\t/**\n\t * Called when the element is connected to the DOM.\n\t * Sets the tabindex and adds the focus event listener.\n\t */\n\tconnectedCallback() {\n\t\tthis.setAttribute('tabindex', '0');\n\t\tthis.addEventListener('focus', this.handleFocus);\n\t}\n\n\t/**\n\t * Called when the element is disconnected from the DOM.\n\t * Removes the focus event listener.\n\t */\n\tdisconnectedCallback() {\n\t\tthis.removeEventListener('focus', this.handleFocus);\n\t}\n\n\t/**\n\t * Handles the focus event. When the trap end is focused, focus is shifted back to the trap start.\n\t */\n\thandleFocus = () => {\n\t\tconst trap = this.closest('focus-trap');\n\t\tconst trapStart = trap.querySelector('focus-trap-start');\n\t\ttrapStart.focus();\n\t};\n}\n\ncustomElements.define('focus-trap', FocusTrap);\ncustomElements.define('focus-trap-start', FocusTrapStart);\ncustomElements.define('focus-trap-end', FocusTrapEnd);\n//# sourceMappingURL=focus-trap.esm.js.map\n","import './index.scss';\nimport '@magic-spells/focus-trap';\n\n/**\n * Custom element that creates an accessible modal dialog panel with focus management\n * @extends HTMLElement\n */\nclass DialogPanel extends HTMLElement {\n\t#handleTransitionEnd;\n\t#scrollPosition = 0;\n\t\n\t/**\n\t * Clean up event listeners when component is removed from DOM\n\t */\n\tdisconnectedCallback() {\n\t\tconst _ = this;\n\t\tif (_.contentPanel) {\n\t\t\t_.contentPanel.removeEventListener('transitionend', _.#handleTransitionEnd);\n\t\t}\n\t\t\n\t\t// Ensure body scroll is restored if component is removed while open\n\t\tdocument.body.classList.remove('overflow-hidden');\n\t\tthis.#restoreScroll();\n\t}\n\t\n\t/**\n\t * Saves current scroll position and locks body scrolling\n\t * @private\n\t */\n\t#lockScroll() {\n\t\tconst _ = this;\n\t\t// Save current scroll position\n\t\t_.#scrollPosition = window.pageYOffset;\n\t\t\n\t\t// Apply fixed position to body\n\t\tdocument.body.classList.add('overflow-hidden');\n\t\tdocument.body.style.top = `-${_.#scrollPosition}px`;\n\t}\n\t\n\t/**\n\t * Restores scroll position when dialog is closed\n\t * @private\n\t */\n\t#restoreScroll() {\n\t\tconst _ = this;\n\t\t// Remove fixed positioning\n\t\tdocument.body.classList.remove('overflow-hidden');\n\t\tdocument.body.style.removeProperty('top');\n\t\t\n\t\t// Restore scroll position\n\t\twindow.scrollTo(0, _.#scrollPosition);\n\t}\n\t/**\n\t * Initializes the dialog panel, sets up focus trap and overlay\n\t */\n\tconstructor() {\n\t\tsuper();\n\t\tconst _ = this;\n\t\t_.id = _.getAttribute('id');\n\t\t_.setAttribute('role', 'dialog');\n\t\t_.setAttribute('aria-modal', 'true');\n\t\t_.setAttribute('aria-hidden', 'true');\n\n\t\t_.contentPanel = _.querySelector('dialog-content');\n\t\t_.focusTrap = document.createElement('focus-trap');\n\t\t_.triggerEl = null;\n\t\t\n\t\t// Create a handler for transition end events\n\t\t_.#handleTransitionEnd = (e) => {\n\t\t\tif (e.propertyName === 'opacity' && _.getAttribute('aria-hidden') === 'true') {\n\t\t\t\t_.contentPanel.classList.add('hidden');\n\t\t\t\t\n\t\t\t\t// Dispatch afterHide event - dialog has completed its transition\n\t\t\t\t_.dispatchEvent(new CustomEvent('afterHide', {\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tdetail: { triggerElement: _.triggerEl }\n\t\t\t\t}));\n\t\t\t}\n\t\t};\n\n\t\t// Ensure we have labelledby and describedby references\n\t\tif (!_.getAttribute('aria-labelledby')) {\n\t\t\tconst heading = _.querySelector('h1, h2, h3');\n\t\t\tif (heading && !heading.id) {\n\t\t\t\theading.id = `${_.id}-title`;\n\t\t\t}\n\t\t\tif (heading?.id) {\n\t\t\t\t_.setAttribute('aria-labelledby', heading.id);\n\t\t\t}\n\t\t}\n\n\t\t_.contentPanel.parentNode.insertBefore(\n\t\t\t_.focusTrap,\n\t\t\t_.contentPanel\n\t\t);\n\t\t_.focusTrap.appendChild(_.contentPanel);\n\n\t\t_.focusTrap.setupTrap();\n\n\t\t// Add modal overlay\n\t\t_.prepend(document.createElement('dialog-overlay'));\n\t\t_.#bindUI();\n\t\t_.#bindKeyboard();\n\t}\n\n\t/**\n\t * Binds click events for showing and hiding the dialog\n\t * @private\n\t */\n\t#bindUI() {\n\t\tconst _ = this;\n\t\t\n\t\t// Handle trigger buttons\n\t\tdocument.addEventListener('click', (e) => {\n\t\t\tconst trigger = e.target.closest(\n\t\t\t\t`[aria-controls=\"${_.id}\"]`\n\t\t\t);\n\t\t\tif (!trigger) return;\n\n\t\t\tif (trigger.getAttribute('data-prevent-default') === 'true') {\n\t\t\t\te.preventDefault();\n\t\t\t}\n\n\t\t\t_.show(trigger);\n\t\t});\n\n\t\t// Handle close buttons\n\t\t_.addEventListener('click', (e) => {\n\t\t\tif (!e.target.closest('[data-action=\"hide-dialog\"]')) return;\n\t\t\t_.hide();\n\t\t});\n\t\t\n\t\t// Add transition end listener\n\t\t_.contentPanel.addEventListener('transitionend', _.#handleTransitionEnd);\n\t}\n\n\t/**\n\t * Binds keyboard events for accessibility\n\t * @private\n\t */\n\t#bindKeyboard() {\n\t\tthis.addEventListener('keydown', (e) => {\n\t\t\tif (e.key === 'Escape') {\n\t\t\t\tthis.hide();\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Shows the dialog and traps focus within it\n\t * @param {HTMLElement} [triggerEl=null] - The element that triggered the dialog\n\t * @fires DialogPanel#beforeShow - Fired before the dialog starts to show\n\t * @fires DialogPanel#show - Fired when the dialog has been shown\n\t * @returns {boolean} False if the show was prevented by a beforeShow event handler\n\t */\n\tshow(triggerEl = null) {\n\t\tconst _ = this;\n\t\t_.triggerEl = triggerEl || false;\n\n\t\t// Dispatch beforeShow event - allows preventing the dialog from opening\n\t\tconst beforeShowEvent = new CustomEvent('beforeShow', {\n\t\t\tbubbles: true,\n\t\t\tcancelable: true,\n\t\t\tdetail: { triggerElement: _.triggerEl }\n\t\t});\n\t\t\n\t\tconst showAllowed = _.dispatchEvent(beforeShowEvent);\n\t\t\n\t\t// If event was canceled (preventDefault was called), don't show the dialog\n\t\tif (!showAllowed) return false;\n\n\t\t// Remove the hidden class first to ensure content is rendered\n\t\t_.contentPanel.classList.remove('hidden');\n\t\t\n\t\t// Give the browser a moment to process before starting animation\n\t\trequestAnimationFrame(() => {\n\t\t\t// Update ARIA states\n\t\t\t_.setAttribute('aria-hidden', 'false');\n\t\t\tif (_.triggerEl) {\n\t\t\t\t_.triggerEl.setAttribute('aria-expanded', 'true');\n\t\t\t}\n\t\n\t\t\t// Lock body scrolling and save scroll position\n\t\t\t_.#lockScroll();\n\t\n\t\t\t// Focus management\n\t\t\tconst firstFocusable = _.querySelector(\n\t\t\t\t'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n\t\t\t);\n\t\t\tif (firstFocusable) {\n\t\t\t\trequestAnimationFrame(() => {\n\t\t\t\t\tfirstFocusable.focus();\n\t\t\t\t});\n\t\t\t}\n\t\t\t\n\t\t\t// Dispatch show event - dialog is now visible\n\t\t\t_.dispatchEvent(new CustomEvent('show', {\n\t\t\t\tbubbles: true,\n\t\t\t\tdetail: { triggerElement: _.triggerEl }\n\t\t\t}));\n\t\t});\n\t\t\n\t\treturn true;\n\t}\n\n\t/**\n\t * Hides the dialog and restores focus\n\t * @fires DialogPanel#beforeHide - Fired before the dialog starts to hide\n\t * @fires DialogPanel#hide - Fired when the dialog has started hiding (transition begins)\n\t * @fires DialogPanel#afterHide - Fired when the dialog has completed its hide transition\n\t * @returns {boolean} False if the hide was prevented by a beforeHide event handler\n\t */\n\thide() {\n\t\tconst _ = this;\n\t\t\n\t\t// Dispatch beforeHide event - allows preventing the dialog from closing\n\t\tconst beforeHideEvent = new CustomEvent('beforeHide', {\n\t\t\tbubbles: true,\n\t\t\tcancelable: true,\n\t\t\tdetail: { triggerElement: _.triggerEl }\n\t\t});\n\t\t\n\t\tconst hideAllowed = _.dispatchEvent(beforeHideEvent);\n\t\t\n\t\t// If event was canceled (preventDefault was called), don't hide the dialog\n\t\tif (!hideAllowed) return false;\n\t\t\n\t\t// Restore body scroll and scroll position\n\t\t_.#restoreScroll();\n\n\t\t// Update ARIA states\n\t\tif (_.triggerEl) {\n\t\t\t// remove focus from modal panel first\n\t\t\t_.triggerEl.focus();\n\t\t\t// mark trigger as no longer expanded\n\t\t\t_.triggerEl.setAttribute('aria-expanded', 'false');\n\t\t}\n\n\t\t// Set aria-hidden to start transition\n\t\t// The transitionend event handler will add display:none when complete\n\t\t_.setAttribute('aria-hidden', 'true');\n\t\t\n\t\t// Dispatch hide event - dialog is now starting to hide\n\t\t_.dispatchEvent(new CustomEvent('hide', {\n\t\t\tbubbles: true,\n\t\t\tdetail: { triggerElement: _.triggerEl }\n\t\t}));\n\t\t\n\t\treturn true;\n\t}\n}\n\n/**\n * Custom element that creates a clickable overlay for the dialog\n * @extends HTMLElement\n */\nclass DialogOverlay extends HTMLElement {\n\tconstructor() {\n\t\tsuper();\n\t\tthis.setAttribute('tabindex', '-1'); // Changed to -1 as it shouldn't be focusable\n\t\tthis.setAttribute('aria-hidden', 'true');\n\t\tthis.dialogPanel = this.closest('dialog-panel');\n\t\tthis.#bindUI();\n\t}\n\n\t#bindUI() {\n\t\tthis.addEventListener('click', () => {\n\t\t\tthis.dialogPanel.hide();\n\t\t});\n\t}\n}\n\n/**\n * Custom element that wraps the content of the dialog\n * @extends HTMLElement\n */\nclass DialogContent extends HTMLElement {\n\tconstructor() {\n\t\tsuper();\n\t\tthis.setAttribute('role', 'document'); // Optional: helps with document structure\n\t}\n}\n\ncustomElements.define('dialog-panel', DialogPanel);\ncustomElements.define('dialog-overlay', DialogOverlay);\ncustomElements.define('dialog-content', DialogContent);\n\nexport { DialogPanel, DialogOverlay, DialogContent };\nexport default DialogPanel;"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,oBAAoB,GAAG,CAAC,SAAS,KAAK;AAC5C,CAAC,MAAM,kBAAkB;AACzB,EAAE,gPAAgP,CAAC;AACnP,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,CAAC;AACnE,CAAC,CAAC;AACF;AACA,MAAM,SAAS,SAAS,WAAW,CAAC;AACpC;AACA,CAAC,OAAO,aAAa,GAAG,KAAK,CAAC;AAC9B;AACA,CAAC,WAAW,GAAG;AACf,EAAE,KAAK,EAAE,CAAC;AACV,EAAE,IAAI,CAAC,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AW,GAAG;AACf,EAAE,KAAK,EAAE,CAAC;AACV,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AACtC,EAAE,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AAC3C,EAAE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;AAClD,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;AACjB,EAAE;AACF;AACA,CAAC,OAAO,GAAG;AACX,EAAE,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM;AACvC,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;AAC3B,GAAG,CAAC,CAAC;AACL,EAAE;AACF,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,MAAM,aAAa,SAAS,WAAW,CAAC;AACxC,CAAC,WAAW,GAAG;AACf,EAAE,KAAK,EAAE,CAAC;AACV,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AACxC,EAAE;AACF,CAAC;AACD;AACA,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;AACnD,cAAc,CAAC,MAAM,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;AACvD,cAAc,CAAC,MAAM,CAAC,gBAAgB,EAAE,aAAa,CAAC;;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--dp-panel-top: 0;
|
|
3
|
+
--dp-panel-left: 0;
|
|
4
|
+
--dp-panel-width: 100vw;
|
|
5
|
+
--dp-panel-height: 100vh;
|
|
6
|
+
--dp-panel-z-index: 10;
|
|
7
|
+
--dp-overlay-z-index: 1000;
|
|
8
|
+
--dp-overlay-background: rgba(20, 23, 26, 0.4);
|
|
9
|
+
--dp-overlay-backdrop-filter: blur(2px) saturate(120%);
|
|
10
|
+
--dp-overlay-transition: all 400ms ease-out;
|
|
11
|
+
--dp-content-display: block;
|
|
12
|
+
--dp-content-background: white;
|
|
13
|
+
--dp-content-z-index: 1001;
|
|
14
|
+
--dp-content-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
|
|
15
|
+
--dp-content-border-radius: 8px;
|
|
16
|
+
--dp-transition-duration: 400ms;
|
|
17
|
+
--dp-transition-timing: ease-out;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
dialog-panel {
|
|
21
|
+
/* Make it take no space and be invisible in the document flow */
|
|
22
|
+
display: contents;
|
|
23
|
+
}
|
|
24
|
+
dialog-panel[aria-hidden=false] dialog-overlay,
|
|
25
|
+
dialog-panel[aria-hidden=false] dialog-content {
|
|
26
|
+
pointer-events: auto;
|
|
27
|
+
opacity: 1;
|
|
28
|
+
transform: scale(1);
|
|
29
|
+
filter: blur(0px);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Overlay background */
|
|
33
|
+
dialog-overlay {
|
|
34
|
+
position: fixed;
|
|
35
|
+
top: 0;
|
|
36
|
+
left: 0;
|
|
37
|
+
width: 100vw;
|
|
38
|
+
height: 100vh;
|
|
39
|
+
opacity: 0;
|
|
40
|
+
pointer-events: none;
|
|
41
|
+
z-index: var(--dp-overlay-z-index, 1000);
|
|
42
|
+
transition: var(--dp-overlay-transition, all 300ms ease-out);
|
|
43
|
+
background-color: var(--dp-overlay-background, rgba(20, 23, 26, 0.4));
|
|
44
|
+
backdrop-filter: var(--dp-overlay-backdrop-filter, blur(2px) saturate(120%));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
dialog-content {
|
|
48
|
+
position: fixed;
|
|
49
|
+
top: 50%;
|
|
50
|
+
left: 50%;
|
|
51
|
+
transform: translate(-50%, -50%) scale(0.95);
|
|
52
|
+
max-width: 90vw;
|
|
53
|
+
max-height: 85vh;
|
|
54
|
+
display: var(--dp-content-display, block);
|
|
55
|
+
opacity: 0;
|
|
56
|
+
background: var(--dp-content-background, white);
|
|
57
|
+
pointer-events: none;
|
|
58
|
+
z-index: var(--dp-content-z-index, 1001);
|
|
59
|
+
box-shadow: var(--dp-content-shadow, 0 10px 25px rgba(0, 0, 0, 0.15));
|
|
60
|
+
border-radius: var(--dp-content-border-radius, 8px);
|
|
61
|
+
overflow: auto;
|
|
62
|
+
transition: opacity var(--dp-transition-duration, 300ms) var(--dp-transition-timing, ease-out), transform var(--dp-transition-duration, 300ms) var(--dp-transition-timing, ease-out);
|
|
63
|
+
/* When shown, reset transform to center */
|
|
64
|
+
/* When explicitly hidden, remove from layout */
|
|
65
|
+
}
|
|
66
|
+
dialog-panel[aria-hidden=false] dialog-content {
|
|
67
|
+
transform: translate(-50%, -50%) scale(1);
|
|
68
|
+
}
|
|
69
|
+
dialog-content.hidden {
|
|
70
|
+
display: none;
|
|
71
|
+
}
|