@magic-spells/dialog-panel 0.3.0 → 1.0.1
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 +163 -114
- package/dist/dialog-panel.cjs.js +287 -219
- package/dist/dialog-panel.cjs.js.map +1 -1
- package/dist/dialog-panel.css +105 -59
- package/dist/dialog-panel.esm.js +287 -215
- package/dist/dialog-panel.esm.js.map +1 -1
- package/dist/dialog-panel.js +276 -405
- package/dist/dialog-panel.js.map +1 -1
- package/dist/dialog-panel.min.css +1 -1
- package/dist/dialog-panel.min.js +1 -1
- package/package.json +8 -17
- package/src/dialog-panel.css +117 -0
- package/src/dialog-panel.js +288 -216
- package/dist/dialog-panel.scss +0 -2
- package/dist/scss/dialog-panel.scss +0 -78
- package/dist/scss/variables.scss +0 -40
- package/src/index.scss +0 -2
- package/src/scss/dialog-panel.scss +0 -78
- package/src/scss/variables.scss +0 -40
package/dist/dialog-panel.css
CHANGED
|
@@ -1,71 +1,117 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
--dp-content-background: white;
|
|
8
|
-
--dp-content-z-index: 1001;
|
|
9
|
-
--dp-content-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
|
|
10
|
-
--dp-content-border-radius: 8px;
|
|
11
|
-
--dp-transition-duration: 400ms;
|
|
12
|
-
--dp-transition-timing: ease-out;
|
|
13
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* dialog-panel basic centered modal styles
|
|
3
|
+
*
|
|
4
|
+
* This provides a simple fade in/out animation for a centered modal dialog.
|
|
5
|
+
* Developers can customize or replace these styles to match their design.
|
|
6
|
+
*/
|
|
14
7
|
|
|
8
|
+
/* Wrapper doesn't affect layout */
|
|
15
9
|
dialog-panel {
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
display: contents;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* Base dialog styles with transitions */
|
|
14
|
+
dialog-panel > dialog {
|
|
15
|
+
border: none;
|
|
16
|
+
border-radius: 0.5rem;
|
|
17
|
+
padding: 0;
|
|
18
|
+
max-width: 32rem;
|
|
19
|
+
width: 90vw;
|
|
20
|
+
max-height: 85vh;
|
|
21
|
+
overflow: visible;
|
|
22
|
+
background: white;
|
|
23
|
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
|
|
24
|
+
|
|
25
|
+
/* Start hidden */
|
|
26
|
+
opacity: 0;
|
|
27
|
+
transform: scale(0.95);
|
|
28
|
+
|
|
29
|
+
/* Transition always defined on base */
|
|
30
|
+
transition:
|
|
31
|
+
opacity 0.3s ease-out,
|
|
32
|
+
transform 0.3s ease-out;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* When using dialog-backdrop element, make native ::backdrop transparent
|
|
36
|
+
but keep it clickable (clicks detected via bounding rect check) */
|
|
37
|
+
dialog-panel:has(dialog-backdrop) > dialog::backdrop {
|
|
38
|
+
background: transparent;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Native backdrop (when not using dialog-backdrop) */
|
|
42
|
+
dialog-panel:not(:has(dialog-backdrop)) > dialog::backdrop {
|
|
43
|
+
background: rgba(0, 0, 0, 0.3);
|
|
44
|
+
opacity: 0;
|
|
45
|
+
transition: opacity 0.3s ease-out;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Custom dialog-backdrop element */
|
|
49
|
+
dialog-backdrop {
|
|
50
|
+
position: fixed;
|
|
51
|
+
background: rgba(0, 0, 0, 0.3);
|
|
52
|
+
opacity: 0;
|
|
53
|
+
transition: opacity 0.3s ease-out;
|
|
54
|
+
pointer-events: none;
|
|
55
|
+
z-index: 9999999;
|
|
56
|
+
top: 50%;
|
|
57
|
+
left: 50%;
|
|
58
|
+
width: 200vw;
|
|
59
|
+
height: 200dvh;
|
|
60
|
+
transform: translateY(-50%) translateX(-50%);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Showing state - dialog is open but still at initial values
|
|
64
|
+
(this is the starting point for the fade-in animation) */
|
|
65
|
+
dialog-panel[state='showing'] > dialog {
|
|
66
|
+
opacity: 0;
|
|
67
|
+
transform: scale(0.95);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
dialog-panel:not(:has(dialog-backdrop))[state='showing']
|
|
71
|
+
> dialog::backdrop {
|
|
72
|
+
opacity: 0;
|
|
18
73
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
filter: blur(0px);
|
|
74
|
+
|
|
75
|
+
/* Shown state - fully visible (animates from showing → shown) */
|
|
76
|
+
dialog-panel[state='shown'] > dialog {
|
|
77
|
+
opacity: 1;
|
|
78
|
+
transform: scale(1);
|
|
25
79
|
}
|
|
26
80
|
|
|
27
|
-
|
|
28
|
-
dialog
|
|
29
|
-
|
|
30
|
-
top: 0;
|
|
31
|
-
left: 0;
|
|
32
|
-
width: 100vw;
|
|
33
|
-
height: 100vh;
|
|
34
|
-
opacity: 0;
|
|
35
|
-
pointer-events: none;
|
|
36
|
-
z-index: var(--dp-overlay-z-index, 1000);
|
|
37
|
-
transition: var(--dp-overlay-transition, all 300ms ease-out);
|
|
38
|
-
background-color: var(--dp-overlay-background, rgba(20, 23, 26, 0.4));
|
|
39
|
-
backdrop-filter: var(--dp-overlay-backdrop-filter, blur(2px) saturate(120%));
|
|
81
|
+
dialog-panel:not(:has(dialog-backdrop))[state='shown']
|
|
82
|
+
> dialog::backdrop {
|
|
83
|
+
opacity: 1;
|
|
40
84
|
}
|
|
41
85
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
display: var(--dp-content-display, block);
|
|
50
|
-
opacity: 0;
|
|
51
|
-
background: var(--dp-content-background, white);
|
|
52
|
-
pointer-events: none;
|
|
53
|
-
z-index: var(--dp-content-z-index, 1001);
|
|
54
|
-
box-shadow: var(--dp-content-shadow, 0 10px 25px rgba(0, 0, 0, 0.15));
|
|
55
|
-
border-radius: var(--dp-content-border-radius, 8px);
|
|
56
|
-
overflow: auto;
|
|
57
|
-
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);
|
|
58
|
-
/* When shown, reset transform to center */
|
|
86
|
+
/* Hiding state - faster exit animation */
|
|
87
|
+
dialog-panel[state='hiding'] > dialog {
|
|
88
|
+
opacity: 0;
|
|
89
|
+
transform: scale(0.95);
|
|
90
|
+
transition:
|
|
91
|
+
opacity 0.2s ease-in,
|
|
92
|
+
transform 0.2s ease-in;
|
|
59
93
|
}
|
|
60
|
-
|
|
61
|
-
|
|
94
|
+
|
|
95
|
+
dialog-panel:not(:has(dialog-backdrop))[state='hiding']
|
|
96
|
+
> dialog::backdrop {
|
|
97
|
+
opacity: 0;
|
|
98
|
+
transition: opacity 0.2s ease-in;
|
|
62
99
|
}
|
|
63
100
|
|
|
64
|
-
/*
|
|
65
|
-
dialog-
|
|
66
|
-
|
|
101
|
+
/* dialog-backdrop state animations */
|
|
102
|
+
dialog-panel[state='showing'] > dialog-backdrop,
|
|
103
|
+
dialog-panel[state='hidden'] > dialog-backdrop {
|
|
104
|
+
opacity: 0;
|
|
105
|
+
pointer-events: none;
|
|
67
106
|
}
|
|
68
107
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
108
|
+
dialog-panel[state='shown'] > dialog-backdrop {
|
|
109
|
+
opacity: 1;
|
|
110
|
+
pointer-events: auto;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
dialog-panel[state='hiding'] > dialog-backdrop {
|
|
114
|
+
opacity: 0;
|
|
115
|
+
pointer-events: none;
|
|
116
|
+
transition: opacity 0.2s ease-in;
|
|
117
|
+
}
|