@muibook/components 4.0.0 → 5.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/{readme.md → README.md} +2 -0
- package/dist/esm/components/mui-accordion/block/index.js +29 -23
- package/dist/esm/components/mui-accordion/core/index.js +35 -26
- package/dist/esm/components/mui-accordion/group/index.js +7 -7
- package/dist/esm/components/mui-accordion/inline/index.js +12 -6
- package/dist/esm/components/mui-button/index.js +52 -22
- package/dist/esm/components/mui-dialog/index.js +103 -0
- package/dist/esm/components/mui-drawer/index.js +393 -0
- package/dist/esm/components/mui-dropdown/index.js +172 -0
- package/dist/esm/components/mui-icons/add/index.js +3 -3
- package/dist/esm/components/mui-icons/calendar/index.js +55 -0
- package/dist/esm/components/mui-icons/close/index.js +1 -1
- package/dist/esm/components/mui-icons/down-arrow-circle/index.js +1 -1
- package/dist/esm/components/mui-icons/down-chevron/index.js +1 -1
- package/dist/esm/components/mui-icons/ellipsis/index.js +1 -1
- package/dist/esm/components/mui-icons/gear/index.js +8 -8
- package/dist/esm/components/mui-icons/globe/index.js +3 -3
- package/dist/esm/components/mui-icons/grid/index.js +1 -1
- package/dist/esm/components/mui-icons/index.js +1 -0
- package/dist/esm/components/mui-icons/info/index.js +3 -3
- package/dist/esm/components/mui-icons/left-arrow/index.js +1 -1
- package/dist/esm/components/mui-icons/left-chevron/index.js +1 -1
- package/dist/esm/components/mui-icons/left-sidebar/index.js +1 -1
- package/dist/esm/components/mui-icons/moon/index.js +1 -1
- package/dist/esm/components/mui-icons/notification/index.js +1 -1
- package/dist/esm/components/mui-icons/right-chevron/index.js +1 -1
- package/dist/esm/components/mui-icons/stop/index.js +1 -1
- package/dist/esm/components/mui-icons/subtract/index.js +1 -1
- package/dist/esm/components/mui-icons/sun/index.js +1 -1
- package/dist/esm/components/mui-icons/translate/index.js +53 -0
- package/dist/esm/components/mui-icons/up-arrow/index.js +3 -3
- package/dist/esm/components/mui-icons/up-chevron/index.js +1 -1
- package/dist/esm/components/mui-link/index.js +39 -33
- package/dist/esm/components/mui-loader/index.js +99 -0
- package/dist/esm/components/mui-progress/index.js +75 -0
- package/dist/esm/components/mui-stepper/index.js +2 -0
- package/dist/esm/components/mui-stepper/step/index.js +157 -0
- package/dist/esm/components/mui-stepper/stepper/index.js +95 -0
- package/dist/esm/css/mui-tokens.css +47 -2
- package/dist/esm/index.js +13 -4
- package/dist/types/components/mui-dialog/index.d.ts +2 -0
- package/dist/types/components/mui-drawer/index.d.ts +2 -0
- package/dist/types/components/mui-dropdown/index.d.ts +1 -0
- package/dist/types/components/mui-icons/calendar.d.ts +1 -0
- package/dist/types/components/mui-icons/index.d.ts +1 -0
- package/dist/types/components/mui-icons/translate.d.ts +1 -0
- package/dist/types/components/mui-loader/index.d.ts +1 -0
- package/dist/types/components/mui-progress/index.d.ts +1 -0
- package/dist/types/components/mui-stepper/index.d.ts +2 -0
- package/dist/types/components/mui-stepper/step/index.d.ts +1 -0
- package/dist/types/components/mui-stepper/stepper/index.d.ts +1 -0
- package/dist/types/index.d.ts +9 -0
- package/package.json +41 -1
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import "../mui-icons/close/index.js";
|
|
2
|
+
import "../mui-button/index.js";
|
|
3
|
+
class p extends HTMLElement {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(), this.innerEl = null, this.overlayEl = null, this.footerEl = null, this.actionsSlot = null, this.pushLayout = null, this.outer = null, this.persistentLayout = null, this.headerEl = null, this.headerSlot = null, this._handleEscape = (t) => {
|
|
6
|
+
const e = this.getAttribute("variant") || "overlay";
|
|
7
|
+
t.key === "Escape" && (e === "overlay" || e === "push") && this.close();
|
|
8
|
+
}, this._computedSide = "left", this._handleResize = () => {
|
|
9
|
+
const t = this.getAttribute("variant") || "overlay";
|
|
10
|
+
if (t === "push" || t === "persistent") {
|
|
11
|
+
const e = this.hasAttribute("open");
|
|
12
|
+
this.updateLayout(t, e);
|
|
13
|
+
}
|
|
14
|
+
}, this.attachShadow({ mode: "open" });
|
|
15
|
+
}
|
|
16
|
+
static get observedAttributes() {
|
|
17
|
+
return ["open", "width", "side", "variant", "z-index", "drawer-space", "breakpoint"];
|
|
18
|
+
}
|
|
19
|
+
connectedCallback() {
|
|
20
|
+
this.render(), this.cacheEls(), this.attachEvents(), this.updateFooterVisibility(), this.updateHeaderVisibility(), this.syncOpenState(), document.addEventListener("keydown", this._handleEscape), window.addEventListener("resize", this._handleResize);
|
|
21
|
+
}
|
|
22
|
+
disconnectedCallback() {
|
|
23
|
+
document.removeEventListener("keydown", this._handleEscape), window.removeEventListener("resize", this._handleResize);
|
|
24
|
+
}
|
|
25
|
+
getBreakpoint() {
|
|
26
|
+
const t = this.getAttribute("breakpoint");
|
|
27
|
+
return t ? Number(t) : 768;
|
|
28
|
+
}
|
|
29
|
+
getDrawerTemplate(t = !0) {
|
|
30
|
+
const e = this.hasAttribute("drawer-space") ? "no-padding" : "";
|
|
31
|
+
return (
|
|
32
|
+
/*html*/
|
|
33
|
+
`
|
|
34
|
+
<div class="outer">
|
|
35
|
+
<div class="inner" role="complementary">
|
|
36
|
+
<header>
|
|
37
|
+
<slot name="title"></slot>
|
|
38
|
+
${t ? `
|
|
39
|
+
<mui-button class="close" variant="tertiary" aria-label="Close drawer">
|
|
40
|
+
<mui-icon-close></mui-icon-close>
|
|
41
|
+
</mui-button>` : "<span class='spacer'></span>"}
|
|
42
|
+
</header>
|
|
43
|
+
<main class="${e}"><slot></slot></main>
|
|
44
|
+
<footer hidden><slot name="actions"></slot></footer>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
`
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
render() {
|
|
51
|
+
if (!this.shadowRoot) return;
|
|
52
|
+
const t = this.getAttribute("width") || "400px", e = this.getAttribute("variant") || "overlay", i = !!this.querySelector('[slot="before"]');
|
|
53
|
+
this._computedSide = this.getAttribute("side") || (i ? "right" : "left"), this.getAttribute("side") !== this._computedSide && this.setAttribute("side", this._computedSide);
|
|
54
|
+
const a = (
|
|
55
|
+
/*css*/
|
|
56
|
+
`
|
|
57
|
+
header {
|
|
58
|
+
display: flex;
|
|
59
|
+
justify-content: space-between;
|
|
60
|
+
align-items: center;
|
|
61
|
+
padding: calc(var(--space-400) + env(safe-area-inset-top)) var(--space-400) var(--space-400) var(--space-500);
|
|
62
|
+
border-bottom: var(--border-thin);
|
|
63
|
+
box-sizing: border-box;
|
|
64
|
+
}
|
|
65
|
+
main {
|
|
66
|
+
overflow-y: auto;
|
|
67
|
+
height: 100%;
|
|
68
|
+
padding: var(--space-500);
|
|
69
|
+
box-sizing: border-box;
|
|
70
|
+
will-change: transform, opacity;
|
|
71
|
+
}
|
|
72
|
+
main.no-padding {
|
|
73
|
+
padding: 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
main.no-heading {
|
|
77
|
+
padding-top: calc(var(--space-500) + env(safe-area-inset-top));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
main.no-padding.no-heading {
|
|
81
|
+
padding-top: env(safe-area-inset-top);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
footer {
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: flex-end;
|
|
89
|
+
padding: var(--space-400) var(--space-500) calc(var(--space-400) + env(safe-area-inset-bottom));
|
|
90
|
+
border-top: var(--border-thin);
|
|
91
|
+
background: var(--surface-elevated-100);
|
|
92
|
+
gap: var(--space-300);
|
|
93
|
+
box-sizing: border-box;
|
|
94
|
+
position: fixed;
|
|
95
|
+
bottom: 0;
|
|
96
|
+
width: 100%;
|
|
97
|
+
}
|
|
98
|
+
header[hidden],
|
|
99
|
+
footer[hidden] {
|
|
100
|
+
display: none !important;
|
|
101
|
+
}
|
|
102
|
+
`
|
|
103
|
+
), s = (
|
|
104
|
+
/*css*/
|
|
105
|
+
`
|
|
106
|
+
:host([has-header]) main {
|
|
107
|
+
height: calc(100dvh - (7.7rem + env(safe-area-inset-top) ));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
:host([has-footer]) main {
|
|
111
|
+
height: calc(100dvh - (7.7rem + env(safe-area-inset-bottom) ));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:host([has-header][has-footer]) main {
|
|
115
|
+
height: calc(100dvh - ((7.7rem * 2) + (env(safe-area-inset-top) + env(safe-area-inset-bottom)) ));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.overlay {
|
|
119
|
+
position: fixed;
|
|
120
|
+
top: 0;
|
|
121
|
+
left: 0;
|
|
122
|
+
width: 100%;
|
|
123
|
+
height: 100%;
|
|
124
|
+
z-index: 101;
|
|
125
|
+
transition: opacity 0.3s ease, visibility 0.3s ease;
|
|
126
|
+
background: var(--backdrop-overlay);
|
|
127
|
+
opacity: 0;
|
|
128
|
+
visibility: hidden;
|
|
129
|
+
will-change: opacity, visibility;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.surface {
|
|
133
|
+
background: var(--surface);
|
|
134
|
+
width: 100%;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.inner {
|
|
138
|
+
position: fixed;
|
|
139
|
+
top: 0;
|
|
140
|
+
height: 100dvh;
|
|
141
|
+
z-index: 110;
|
|
142
|
+
transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
|
|
143
|
+
background: var(--surface-elevated-100);
|
|
144
|
+
border-left: var(--border-thin);
|
|
145
|
+
width: ${t};
|
|
146
|
+
transform: translateX(100%);
|
|
147
|
+
opacity: 0;
|
|
148
|
+
visibility: hidden;
|
|
149
|
+
display: flex;
|
|
150
|
+
flex-direction: column;
|
|
151
|
+
will-change: transform, opacity;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
:host([side="left"]) .inner {
|
|
155
|
+
left: 0;
|
|
156
|
+
right: auto;
|
|
157
|
+
border-left: none;
|
|
158
|
+
border-right: var(--border-thin);
|
|
159
|
+
transform: translateX(-100%);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
:host([side="right"]) .inner {
|
|
163
|
+
right: 0;
|
|
164
|
+
left: auto;
|
|
165
|
+
border-right: none;
|
|
166
|
+
border-left: var(--border-thin);
|
|
167
|
+
transform: translateX(100%);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
:host([open][side="right"]) .inner,
|
|
171
|
+
:host([open][side="left"]) .inner {
|
|
172
|
+
transform: translateX(0);
|
|
173
|
+
opacity: 1;
|
|
174
|
+
visibility: visible;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
:host([open]) .overlay {
|
|
178
|
+
opacity: 1;
|
|
179
|
+
visibility: visible;
|
|
180
|
+
}
|
|
181
|
+
`
|
|
182
|
+
), r = this._computedSide === "left" ? "border-right: var(--border-thin);" : "border-left: var(--border-thin);", l = (
|
|
183
|
+
/*css*/
|
|
184
|
+
`
|
|
185
|
+
.inner {
|
|
186
|
+
background: var(--surface-elevated-100);
|
|
187
|
+
width: ${t};
|
|
188
|
+
position: fixed;
|
|
189
|
+
top: 0;
|
|
190
|
+
left: 0;
|
|
191
|
+
height: 100%;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
main { height: 100%; }
|
|
195
|
+
|
|
196
|
+
:host([has-header]) main,
|
|
197
|
+
:host([has-footer]) main {
|
|
198
|
+
height: calc(100% - 7.7rem);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
:host([has-header][has-footer]) main {
|
|
202
|
+
height: calc(100% - (7.7rem * 2));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.outer {
|
|
206
|
+
overflow: hidden;
|
|
207
|
+
will-change: transform;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
/* Push */
|
|
212
|
+
:host([variant="push"]) .shell {
|
|
213
|
+
display: grid;
|
|
214
|
+
height: 100%;
|
|
215
|
+
overflow: hidden;
|
|
216
|
+
transition: grid-template-columns var(--speed-100) ease;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* Persistent */
|
|
220
|
+
:host([variant="persistent"]) .shell {
|
|
221
|
+
display: grid;
|
|
222
|
+
height: 100%;
|
|
223
|
+
overflow: hidden;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
:host([variant="persistent"]) header .spacer {
|
|
227
|
+
height: 4.4rem;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/* Hidden & Persistent */
|
|
231
|
+
:host([open]) .outer,
|
|
232
|
+
:host([variant="persistent"]) .outer { ${r} }
|
|
233
|
+
`
|
|
234
|
+
), n = (
|
|
235
|
+
/*css*/
|
|
236
|
+
`
|
|
237
|
+
@media (max-width: ${this.getBreakpoint()}px) {
|
|
238
|
+
.outer {
|
|
239
|
+
position: fixed;
|
|
240
|
+
left: 0;
|
|
241
|
+
right: 0;
|
|
242
|
+
bottom: 0;
|
|
243
|
+
top: 0;
|
|
244
|
+
width: 100%;
|
|
245
|
+
max-height: 100dvh;
|
|
246
|
+
transform: translateY(100%);
|
|
247
|
+
transition: none;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
:host([open]) .outer {
|
|
251
|
+
transform: translateY(0);
|
|
252
|
+
transition: transform 0.3s ease;
|
|
253
|
+
border: none;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
footer {
|
|
257
|
+
position: fixed;
|
|
258
|
+
bottom: 0;
|
|
259
|
+
width: 100%;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/* Overlay */
|
|
263
|
+
:host([variant="overlay"]) .inner {
|
|
264
|
+
max-width: ${t};
|
|
265
|
+
width: 90%;
|
|
266
|
+
height: 100%;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/* Push */
|
|
270
|
+
:host([variant="push"]) .inner {
|
|
271
|
+
width: 100%;
|
|
272
|
+
height: 100%;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/* Persistent */
|
|
276
|
+
:host([variant="persistent"]) .inner {
|
|
277
|
+
width: 100%;
|
|
278
|
+
position: static;
|
|
279
|
+
height: auto;
|
|
280
|
+
border-radius: var(--radius-200);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
:host([variant="persistent"]) .shell {
|
|
284
|
+
height: auto;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
:host([variant="persistent"]) .outer {
|
|
288
|
+
width: 100%;
|
|
289
|
+
position: static;
|
|
290
|
+
height: auto;
|
|
291
|
+
transform: none;
|
|
292
|
+
order: 1;
|
|
293
|
+
padding: calc(var(--space-700) / 2);
|
|
294
|
+
box-sizing: border-box;
|
|
295
|
+
max-height: initial;
|
|
296
|
+
z-index: initial;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
:host([variant="persistent"]) header {
|
|
300
|
+
padding-top: var(--space-400);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
:host([variant="persistent"]) main { height: auto; }
|
|
304
|
+
|
|
305
|
+
:host([variant="persistent"]) footer {
|
|
306
|
+
border-bottom-right-radius: var(--radius-200);
|
|
307
|
+
border-bottom-left-radius: var(--radius-200);
|
|
308
|
+
position: static;
|
|
309
|
+
width: 100%;
|
|
310
|
+
padding: var(--space-400) var(--space-500) var(--space-400);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
@media (max-width: 360px) {
|
|
316
|
+
:host([variant="persistent"]) .outer {
|
|
317
|
+
padding: calc(var(--space-400) / 2);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
`
|
|
322
|
+
), d = this.getAttribute("side") || this._computedSide, h = e === "overlay" || e === "push";
|
|
323
|
+
let o = "";
|
|
324
|
+
const c = this.hasAttribute("drawer-space") ? "no-padding" : "";
|
|
325
|
+
e === "overlay" ? o = /*html*/
|
|
326
|
+
`
|
|
327
|
+
<style>${a}${s}${n}</style>
|
|
328
|
+
<div class="overlay"></div>
|
|
329
|
+
<div class="inner" role="dialog" aria-modal="true">
|
|
330
|
+
<header hidden>
|
|
331
|
+
<slot name="title"></slot>
|
|
332
|
+
<mui-button class="close" variant="tertiary" aria-label="Close drawer">
|
|
333
|
+
<mui-icon-close></mui-icon-close>
|
|
334
|
+
</mui-button>
|
|
335
|
+
</header>
|
|
336
|
+
<main class="${c}">
|
|
337
|
+
<slot></slot>
|
|
338
|
+
</main>
|
|
339
|
+
<footer hidden>
|
|
340
|
+
<slot name="actions"></slot>
|
|
341
|
+
</footer>
|
|
342
|
+
</div>
|
|
343
|
+
` : (e === "push" || e === "persistent") && (o = /*html*/
|
|
344
|
+
`
|
|
345
|
+
<style>${a}${l}${n}</style>
|
|
346
|
+
<div class="shell">
|
|
347
|
+
${d === "left" ? this.getDrawerTemplate(h) + '<slot name="page"></slot>' : '<slot name="page"></slot>' + this.getDrawerTemplate(h)}
|
|
348
|
+
</div>
|
|
349
|
+
`), this.shadowRoot.innerHTML = o;
|
|
350
|
+
}
|
|
351
|
+
cacheEls() {
|
|
352
|
+
this.innerEl = this.shadowRoot.querySelector(".inner"), this.overlayEl = this.shadowRoot.querySelector(".overlay"), this.footerEl = this.shadowRoot.querySelector("footer"), this.actionsSlot = this.shadowRoot.querySelector('slot[name="actions"]'), this.outer = this.shadowRoot.querySelector(".outer"), this.pushLayout = this.shadowRoot.querySelector(".shell"), this.persistentLayout = this.shadowRoot.querySelector(".shell"), this.headerEl = this.shadowRoot.querySelector("header"), this.headerSlot = this.shadowRoot.querySelector('slot[name="title"]');
|
|
353
|
+
}
|
|
354
|
+
attachEvents() {
|
|
355
|
+
var t, e, i, a;
|
|
356
|
+
(t = this.shadowRoot.querySelector(".close")) == null || t.addEventListener("click", () => this.close()), (e = this.overlayEl) == null || e.addEventListener("click", () => this.close()), (i = this.actionsSlot) == null || i.addEventListener("slotchange", () => this.updateFooterVisibility()), (a = this.headerSlot) == null || a.addEventListener("slotchange", () => this.updateHeaderVisibility());
|
|
357
|
+
}
|
|
358
|
+
updateFooterVisibility() {
|
|
359
|
+
if (!this.footerEl || !this.actionsSlot) return;
|
|
360
|
+
const t = this.actionsSlot.assignedElements().length > 0;
|
|
361
|
+
this.footerEl.hidden = !t, this.toggleAttribute("has-footer", t);
|
|
362
|
+
}
|
|
363
|
+
updateHeaderVisibility() {
|
|
364
|
+
if (!this.headerEl || !this.headerSlot || !this.innerEl) return;
|
|
365
|
+
const t = this.headerSlot.assignedElements().length > 0;
|
|
366
|
+
this.headerEl.hidden = !t, this.toggleAttribute("has-header", t);
|
|
367
|
+
const e = this.innerEl.querySelector("main");
|
|
368
|
+
e && e.classList.toggle("no-heading", !t);
|
|
369
|
+
}
|
|
370
|
+
attributeChangedCallback(t, e, i) {
|
|
371
|
+
t === "open" && this.syncOpenState(), t === "width" && this.innerEl && (this.innerEl.style.width = i || "400px"), t === "side" && (this.render(), this.cacheEls(), this.attachEvents(), this.syncOpenState()), t === "variant" && (this.render(), this.cacheEls(), this.attachEvents(), this.syncOpenState());
|
|
372
|
+
}
|
|
373
|
+
syncOpenState() {
|
|
374
|
+
const t = this.hasAttribute("open"), e = this.getAttribute("variant") || "overlay", i = this.getAttribute("z-index"), a = i ? Number(i) : 10, s = i ? Number(i) + 1 : 11;
|
|
375
|
+
e === "overlay" && this.overlayEl && (this.overlayEl.style.visibility = t ? "visible" : "hidden", this.overlayEl.style.opacity = t ? "1" : "0", this.overlayEl.style.zIndex = a.toString(), this.innerEl.style.zIndex = s.toString(), this.inert = !t), e === "push" && this.outer && (this.updateLayout(e, t), this.outer.style.zIndex = s.toString(), this.outer.inert = !t), e === "persistent" && this.outer && (this.updateLayout(e, t), this.outer.inert = !1);
|
|
376
|
+
}
|
|
377
|
+
updateLayout(t, e) {
|
|
378
|
+
const i = this.getAttribute("width") || "300px", a = this.getAttribute("side") || this._computedSide, s = t === "push" ? this.pushLayout : t === "persistent" ? this.persistentLayout : null;
|
|
379
|
+
if (!s) return;
|
|
380
|
+
if (window.innerWidth <= this.getBreakpoint()) {
|
|
381
|
+
t === "push" ? s.style.removeProperty("grid-template-columns") : t === "persistent" && (s.style.display = "grid", s.style.removeProperty("grid-template-columns"));
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
s.style.display = "grid", t === "push" ? s.style.gridTemplateColumns = a === "left" ? e ? `${i} auto` : "0 auto" : e ? `auto ${i}` : "auto 0" : t === "persistent" && (s.style.gridTemplateColumns = a === "left" ? `${i} auto` : `auto ${i}`);
|
|
385
|
+
}
|
|
386
|
+
open() {
|
|
387
|
+
this.setAttribute("open", ""), this.dispatchEvent(new CustomEvent("mui-drawer-open", { bubbles: !0, composed: !0 }));
|
|
388
|
+
}
|
|
389
|
+
close() {
|
|
390
|
+
this.removeAttribute("open"), this.dispatchEvent(new CustomEvent("mui-drawer-close", { bubbles: !0, composed: !0 }));
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
customElements.get("mui-drawer") || customElements.define("mui-drawer", p);
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
const s = class s extends HTMLElement {
|
|
2
|
+
constructor() {
|
|
3
|
+
super(), this.button = null, this.menu = null, this.handleResize = () => {
|
|
4
|
+
var t;
|
|
5
|
+
(t = this.menu) != null && t.classList.contains("show") && this.adjustPosition();
|
|
6
|
+
}, this.handleScroll = () => {
|
|
7
|
+
var t;
|
|
8
|
+
(t = this.menu) != null && t.classList.contains("show") && this.adjustPosition();
|
|
9
|
+
}, this.handleFocusOut = (t) => {
|
|
10
|
+
var e;
|
|
11
|
+
this.persistent || this.contains(t.relatedTarget) || (this.closeWithAnimation(), (e = this.menu) == null || e.setAttribute("inert", "true"), s.openDropdown === this && (s.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 })));
|
|
12
|
+
}, this.attachShadow({ mode: "open" });
|
|
13
|
+
}
|
|
14
|
+
handleKeyDown(t) {
|
|
15
|
+
if (t.key === "Escape") {
|
|
16
|
+
if (!this.menu) return;
|
|
17
|
+
this.menu.classList.remove("show"), this.menu.setAttribute("inert", "true"), s.openDropdown === this && (s.openDropdown = null), this.dispatchEvent(
|
|
18
|
+
new CustomEvent("dropdown-toggle", {
|
|
19
|
+
detail: { open: !1 },
|
|
20
|
+
bubbles: !0
|
|
21
|
+
})
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
static get observedAttributes() {
|
|
26
|
+
return ["zindex", "position", "persistent"];
|
|
27
|
+
}
|
|
28
|
+
get persistent() {
|
|
29
|
+
return this.hasAttribute("persistent");
|
|
30
|
+
}
|
|
31
|
+
attributeChangedCallback(t, e, i) {
|
|
32
|
+
t === "zindex" && this.menu && (this.menu.style.zIndex = i ?? "1"), t === "position" && this.menu && this.adjustPosition();
|
|
33
|
+
}
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
var r, a, l, u, h;
|
|
36
|
+
this.render(), this.menu = (r = this.shadowRoot) == null ? void 0 : r.querySelector(".dropdown-menu");
|
|
37
|
+
const t = this.getAttribute("zindex") || "1";
|
|
38
|
+
this.menu && (this.menu.style.zIndex = t), this.menu && this.menu.setAttribute("inert", "true"), (a = this.menu) == null || a.addEventListener("focusout", this.handleFocusOut);
|
|
39
|
+
const e = (l = this.shadowRoot) == null ? void 0 : l.querySelector('slot[name="action"]'), i = (e == null ? void 0 : e.assignedNodes({ flatten: !0 })) || [];
|
|
40
|
+
this.button = i.find(
|
|
41
|
+
(o) => o instanceof HTMLElement && o.tagName.toLowerCase() === "mui-button"
|
|
42
|
+
);
|
|
43
|
+
const n = (u = this.shadowRoot) == null ? void 0 : u.querySelector("slot:not([name])");
|
|
44
|
+
if (n) {
|
|
45
|
+
const o = () => {
|
|
46
|
+
const c = n.assignedElements({ flatten: !0 });
|
|
47
|
+
c.forEach((d) => {
|
|
48
|
+
d.classList.remove("dropdown-slot", "dropdown-slot-first", "dropdown-slot-last");
|
|
49
|
+
}), c.forEach((d, p) => {
|
|
50
|
+
d.setAttribute("variant", "tertiary"), d.classList.add("dropdown-slot"), p === 0 && d.classList.add("dropdown-slot-first"), p === c.length - 1 && d.classList.add("dropdown-slot-last"), d._dropdownListenerAdded || (d.addEventListener("click", () => {
|
|
51
|
+
var w, f;
|
|
52
|
+
this.persistent || ((w = this.menu) == null || w.classList.remove("show"), (f = this.menu) == null || f.setAttribute("inert", "true"), s.openDropdown === this && (s.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 })));
|
|
53
|
+
}), d._dropdownListenerAdded = !0);
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
n.addEventListener("slotchange", o), o();
|
|
57
|
+
}
|
|
58
|
+
this.toggleMenu = this.toggleMenu.bind(this), this.closeMenu = this.closeMenu.bind(this), this.handleKeyDown = this.handleKeyDown.bind(this), (h = this.button) == null || h.addEventListener("click", this.toggleMenu), document.addEventListener("click", this.closeMenu), document.addEventListener("keydown", this.handleKeyDown), window.addEventListener("resize", this.handleResize), window.addEventListener("scroll", this.handleScroll, !0);
|
|
59
|
+
}
|
|
60
|
+
disconnectedCallback() {
|
|
61
|
+
var t, e;
|
|
62
|
+
(t = this.button) == null || t.removeEventListener("click", this.toggleMenu), document.removeEventListener("click", this.closeMenu), document.removeEventListener("keydown", this.handleKeyDown), window.removeEventListener("resize", this.handleResize), window.removeEventListener("scroll", this.handleScroll, !0), (e = this.menu) == null || e.removeEventListener("focusout", this.handleFocusOut);
|
|
63
|
+
}
|
|
64
|
+
closeWithAnimation() {
|
|
65
|
+
if (!this.menu) return;
|
|
66
|
+
this.menu.classList.remove("show"), setTimeout(() => {
|
|
67
|
+
this.menu && (this.menu.classList.contains("show") || (this.menu.style.display = "none"));
|
|
68
|
+
}, 150);
|
|
69
|
+
}
|
|
70
|
+
toggleMenu(t) {
|
|
71
|
+
var i;
|
|
72
|
+
if (t.stopPropagation(), !this.menu) return;
|
|
73
|
+
const e = this.menu.classList.contains("show");
|
|
74
|
+
!e && s.openDropdown && s.openDropdown !== this && s.openDropdown.closeWithAnimation(), e ? (this.closeWithAnimation(), (i = this.menu) == null || i.setAttribute("inert", "true"), s.openDropdown === this && (s.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 }))) : (this.menu.style.display = "block", requestAnimationFrame(() => {
|
|
75
|
+
var n, r;
|
|
76
|
+
(n = this.menu) == null || n.classList.add("show"), (r = this.menu) == null || r.removeAttribute("inert"), this.adjustPosition();
|
|
77
|
+
}), s.openDropdown = this, this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !0 }, bubbles: !0 })));
|
|
78
|
+
}
|
|
79
|
+
closeMenu(t) {
|
|
80
|
+
var i;
|
|
81
|
+
const e = t.composedPath();
|
|
82
|
+
this.menu && e.includes(this.menu) || this.button && e.includes(this.button) || (this.closeWithAnimation(), (i = this.menu) == null || i.setAttribute("inert", "true"), s.openDropdown === this && (s.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 })));
|
|
83
|
+
}
|
|
84
|
+
adjustPosition() {
|
|
85
|
+
if (!this.menu) return;
|
|
86
|
+
const t = this.menu, e = 8, i = 8;
|
|
87
|
+
t.style.top = "", t.style.bottom = "", t.style.left = "", t.style.right = "", t.style.maxWidth = "";
|
|
88
|
+
const n = this.getBoundingClientRect(), r = t.offsetWidth, a = t.offsetHeight, l = window.innerWidth, u = window.innerHeight;
|
|
89
|
+
let h = n.height + i;
|
|
90
|
+
u - n.bottom < a + i && n.top > u - n.bottom && (h = -(a + i));
|
|
91
|
+
let o = 0;
|
|
92
|
+
switch (this.getAttribute("position") || "left") {
|
|
93
|
+
case "left":
|
|
94
|
+
o = 0;
|
|
95
|
+
break;
|
|
96
|
+
case "center":
|
|
97
|
+
o = (n.width - r) / 2;
|
|
98
|
+
break;
|
|
99
|
+
case "right":
|
|
100
|
+
default:
|
|
101
|
+
o = n.width - r;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
const d = e - n.left, p = l - e - (n.left + r);
|
|
105
|
+
o = Math.max(d, Math.min(o, p)), r > l - e * 2 && (t.style.maxWidth = `${l - e * 2}px`), t.style.top = `${h}px`, t.style.left = `${o}px`;
|
|
106
|
+
}
|
|
107
|
+
render() {
|
|
108
|
+
this.shadowRoot.innerHTML = /*html*/
|
|
109
|
+
`
|
|
110
|
+
<style>
|
|
111
|
+
:host {
|
|
112
|
+
position: relative;
|
|
113
|
+
display: inline-block;
|
|
114
|
+
}
|
|
115
|
+
.dropdown-menu {
|
|
116
|
+
/* hidden state */
|
|
117
|
+
display: none;
|
|
118
|
+
opacity: 0;
|
|
119
|
+
transform: translateY(-0.25rem);
|
|
120
|
+
transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
|
|
121
|
+
/* End */
|
|
122
|
+
min-width: 150px;
|
|
123
|
+
position: absolute;
|
|
124
|
+
z-index: 1;
|
|
125
|
+
border: var(--border-thin);
|
|
126
|
+
/* Unique Styles */
|
|
127
|
+
background: var(--dropdown-background);
|
|
128
|
+
border-color: var(--dropdown-border-color);
|
|
129
|
+
box-shadow: 0 var(--space-100) var(--space-200) var(--dropdown-shadow-color);
|
|
130
|
+
border-radius: var(--dropdown-radius);
|
|
131
|
+
padding: 1px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.dropdown-menu.show {
|
|
135
|
+
/* visible state */
|
|
136
|
+
visibility: visible;
|
|
137
|
+
opacity: 1;
|
|
138
|
+
transform: translateY(0);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.dropdown-menu ::slotted(mui-button) {
|
|
142
|
+
width: 100%;
|
|
143
|
+
text-align: left;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.dropdown-menu ::slotted(mui-button:focus) {
|
|
147
|
+
z-index: 1;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.inner {
|
|
151
|
+
display: flex;
|
|
152
|
+
flex-direction: column;
|
|
153
|
+
gap: 1px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
</style>
|
|
157
|
+
|
|
158
|
+
<!-- Trigger button slot -->
|
|
159
|
+
<slot name="action"></slot>
|
|
160
|
+
|
|
161
|
+
<!-- Dropdown options slot -->
|
|
162
|
+
<div class="dropdown-menu">
|
|
163
|
+
<div class="inner">
|
|
164
|
+
<slot></slot>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
`;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
s.openDropdown = null;
|
|
171
|
+
let m = s;
|
|
172
|
+
customElements.get("mui-dropdown") || customElements.define("mui-dropdown", m);
|
|
@@ -43,9 +43,9 @@ class r extends HTMLElement {
|
|
|
43
43
|
xmlns="http://www.w3.org/2000/svg"
|
|
44
44
|
viewBox="0 0 36 36"
|
|
45
45
|
>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
<path
|
|
47
|
+
d="M6 18.007a2.536 2.536 0 0 1 2.522-2.536h6.95V8.536A2.54 2.54 0 0 1 18.006 6a2.536 2.536 0 0 1 2.522 2.536v6.935h6.949A2.536 2.536 0 0 1 30 18.007a2.524 2.524 0 0 1-2.522 2.522h-6.95v6.949A2.524 2.524 0 0 1 18.008 30a2.527 2.527 0 0 1-2.536-2.522v-6.95H8.522A2.524 2.524 0 0 1 6 18.008"
|
|
48
|
+
></path>
|
|
49
49
|
</svg>
|
|
50
50
|
|
|
51
51
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
class l extends HTMLElement {
|
|
2
|
+
static get observedAttributes() {
|
|
3
|
+
return ["size", "color"];
|
|
4
|
+
}
|
|
5
|
+
constructor() {
|
|
6
|
+
super(), this.attachShadow({ mode: "open" });
|
|
7
|
+
}
|
|
8
|
+
connectedCallback() {
|
|
9
|
+
this.render();
|
|
10
|
+
}
|
|
11
|
+
attributeChangedCallback(t, c, e) {
|
|
12
|
+
(t === "size" || t === "color") && c !== e && this.render();
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
const t = this.getAttribute("size") || "small", c = this.getAttribute("color"), s = c && {
|
|
16
|
+
default: "var(--icon-color-default)",
|
|
17
|
+
inverted: "var(--icon-color-inverted)"
|
|
18
|
+
}[c] || c || "var(--icon-color-default)", i = {
|
|
19
|
+
"x-small": "1.6rem",
|
|
20
|
+
small: "2.4rem",
|
|
21
|
+
medium: "3.6rem",
|
|
22
|
+
large: "4.8rem"
|
|
23
|
+
}, o = i[t] ?? i.small;
|
|
24
|
+
this.classList.add("mui-icon"), this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
|
|
25
|
+
`
|
|
26
|
+
<style>
|
|
27
|
+
:host {
|
|
28
|
+
width: ${o};
|
|
29
|
+
height: ${o};
|
|
30
|
+
display: inline-flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
fill: ${s};
|
|
34
|
+
}
|
|
35
|
+
svg {
|
|
36
|
+
width: 100%;
|
|
37
|
+
display: block;
|
|
38
|
+
fill: inherit;
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
41
|
+
|
|
42
|
+
<svg
|
|
43
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
44
|
+
viewBox="0 0 36 36"
|
|
45
|
+
>
|
|
46
|
+
<path
|
|
47
|
+
d="M8.207 31.5C4.893 31.5 3 29.63 3 26.335V9.665C3 6.369 4.893 4.5 8.207 4.5h19.587C31.12 4.5 33 6.37 33 9.665v16.67c0 3.296-1.88 5.165-5.206 5.165zm.5-4.279h18.571c.933 0 1.42-.415 1.42-1.412V13.888c0-.997-.487-1.413-1.42-1.413H8.708c-.933 0-1.406.416-1.406 1.413v11.921c0 .997.473 1.412 1.406 1.412m6.738-10.509c-.529 0-.71-.166-.71-.678v-.817c0-.526.181-.692.71-.692h.808c.529 0 .71.166.71.692v.817c0 .512-.181.678-.71.678zm4.316 0c-.529 0-.71-.166-.71-.678v-.817c0-.526.181-.692.71-.692h.821c.515 0 .71.166.71.692v.817c0 .512-.195.678-.71.678zm4.316 0c-.516 0-.71-.166-.71-.678v-.817c0-.526.194-.692.71-.692h.82c.516 0 .71.166.71.692v.817c0 .512-.194.678-.71.678zm-12.961 4.223c-.515 0-.71-.166-.71-.678v-.817c0-.526.195-.692.71-.692h.821c.53 0 .71.166.71.692v.817c0 .512-.18.678-.71.678zm4.33 0c-.53 0-.71-.166-.71-.678v-.817c0-.526.18-.692.71-.692h.807c.529 0 .71.166.71.692v.817c0 .512-.181.678-.71.678zm4.315 0c-.529 0-.71-.166-.71-.678v-.817c0-.526.181-.692.71-.692h.821c.515 0 .71.166.71.692v.817c0 .512-.195.678-.71.678zm4.316 0c-.516 0-.71-.166-.71-.678v-.817c0-.526.194-.692.71-.692h.82c.516 0 .71.166.71.692v.817c0 .512-.194.678-.71.678zm-12.961 4.237c-.515 0-.71-.18-.71-.692v-.817c0-.512.195-.692.71-.692h.821c.53 0 .71.18.71.692v.817c0 .512-.18.692-.71.692zm4.33 0c-.53 0-.71-.18-.71-.692v-.817c0-.512.18-.692.71-.692h.807c.529 0 .71.18.71.692v.817c0 .512-.181.692-.71.692zm4.315 0c-.529 0-.71-.18-.71-.692v-.817c0-.512.181-.692.71-.692h.821c.515 0 .71.18.71.692v.817c0 .512-.195.692-.71.692z"
|
|
48
|
+
></path>
|
|
49
|
+
</svg>
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
customElements.get("mui-icon-calendar") || customElements.define("mui-icon-calendar", l);
|
|
@@ -44,7 +44,7 @@ class c extends HTMLElement {
|
|
|
44
44
|
viewBox="0 0 36 36"
|
|
45
45
|
>
|
|
46
46
|
<path
|
|
47
|
-
d="M8.
|
|
47
|
+
d="M8.435 27.563c-.933-.933-.894-2.55-.026-3.405l6.169-6.168-6.169-6.155c-.868-.854-.894-2.458.026-3.391.934-.934 2.55-.894 3.406-.04l6.168 6.155 6.142-6.142c.907-.907 2.459-.894 3.392.04.934.92.947 2.484.04 3.391L21.44 17.99l6.143 6.155c.907.907.894 2.471-.04 3.405-.92.933-2.485.933-3.392.026l-6.142-6.155-6.168 6.168c-.855.855-2.472.894-3.406-.026"
|
|
48
48
|
></path>
|
|
49
49
|
</svg>
|
|
50
50
|
|
|
@@ -44,7 +44,7 @@ class l extends HTMLElement {
|
|
|
44
44
|
viewBox="0 0 36 36"
|
|
45
45
|
>
|
|
46
46
|
<path
|
|
47
|
-
d="M17.992
|
|
47
|
+
d="M17.992 35C8.65 35 1 27.35 1 18.008S8.65 1 17.992 1 35 8.666 35 18.008 27.334 35 17.992 35m0-4.932c6.686 0 12.06-5.39 12.06-12.06 0-6.686-5.39-12.06-12.06-12.06s-12.06 5.374-12.06 12.06c0 6.67 5.39 12.06 12.06 12.06m0-20.327c1.186 0 2.102.806 2.102 1.928v6.07l-.205 2.972.948-1.439 1.423-1.643c.3-.364.806-.585 1.312-.585 1.027 0 1.754.695 1.754 1.66 0 .553-.142.932-.553 1.375l-5.042 5.374c-.459.506-1.028.759-1.739.759-.695 0-1.249-.253-1.723-.76l-5.042-5.373c-.411-.443-.553-.822-.553-1.376 0-.964.71-1.66 1.754-1.66.522 0 1.012.222 1.312.585l1.438 1.692.933 1.39-.205-2.97v-6.07c0-1.123.916-1.929 2.086-1.929"
|
|
48
48
|
></path>
|
|
49
49
|
</svg>
|
|
50
50
|
|
|
@@ -44,7 +44,7 @@ class n extends HTMLElement {
|
|
|
44
44
|
viewBox="0 0 36 36"
|
|
45
45
|
>
|
|
46
46
|
<path
|
|
47
|
-
d="M18
|
|
47
|
+
d="M18 25c-.79 0-1.428-.269-2.091-.917L6.7 15.072C6.23 14.595 6 14.069 6 13.42 6 12.101 7.122 11 8.487 11c.688 0 1.326.281 1.849.795l7.69 7.617 7.65-7.617c.524-.526 1.161-.795 1.837-.795C28.878 11 30 12.1 30 13.421c0 .648-.217 1.186-.701 1.638l-9.195 9.024c-.663.636-1.288.917-2.104.917"
|
|
48
48
|
></path>
|
|
49
49
|
</svg>
|
|
50
50
|
|