@muibook/components 10.0.1 → 11.0.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/LICENSE +27 -11
- package/README.md +4 -0
- package/dist/esm/components/mui-accordion/block/index.js +9 -5
- package/dist/esm/components/mui-alert/index.js +88 -52
- package/dist/esm/components/mui-badge/index.js +61 -16
- package/dist/esm/components/mui-body/index.js +76 -10
- package/dist/esm/components/mui-button/index.js +152 -32
- package/dist/esm/components/mui-card/card/index.js +13 -8
- package/dist/esm/components/mui-checkbox/index.js +64 -30
- package/dist/esm/components/mui-chip/index.js +153 -33
- package/dist/esm/components/mui-chip-input/index.js +407 -0
- package/dist/esm/components/mui-code/index.js +11 -9
- package/dist/esm/components/mui-dialog/index.js +17 -8
- package/dist/esm/components/mui-dropdown/index.js +44 -44
- package/dist/esm/components/mui-field/index.js +56 -21
- package/dist/esm/components/mui-form-group/index.js +88 -0
- package/dist/esm/components/mui-form-hint/index.js +1 -0
- package/dist/esm/components/mui-form-message/index.js +72 -0
- package/dist/esm/components/mui-form-section/index.js +108 -0
- package/dist/esm/components/mui-form-section-footer/index.js +46 -0
- package/dist/esm/components/mui-hint/index.js +146 -0
- package/dist/esm/components/mui-icons/accessibility/index.js +5 -4
- package/dist/esm/components/mui-icons/add/index.js +1 -0
- package/dist/esm/components/mui-icons/ai/index.js +5 -4
- package/dist/esm/components/mui-icons/attention/index.js +1 -0
- package/dist/esm/components/mui-icons/calendar/index.js +5 -4
- package/dist/esm/components/mui-icons/check/index.js +6 -5
- package/dist/esm/components/mui-icons/checkmark/index.js +9 -8
- package/dist/esm/components/mui-icons/close/index.js +6 -5
- package/dist/esm/components/mui-icons/down-arrow-circle/index.js +9 -8
- package/dist/esm/components/mui-icons/down-chevron/index.js +8 -7
- package/dist/esm/components/mui-icons/ellipsis/index.js +1 -0
- package/dist/esm/components/mui-icons/exclamationmark/index.js +49 -0
- package/dist/esm/components/mui-icons/game-controller/index.js +8 -7
- package/dist/esm/components/mui-icons/gear/index.js +5 -4
- package/dist/esm/components/mui-icons/globe/index.js +8 -7
- package/dist/esm/components/mui-icons/grid/index.js +1 -0
- package/dist/esm/components/mui-icons/home/index.js +9 -8
- package/dist/esm/components/mui-icons/index.js +3 -0
- package/dist/esm/components/mui-icons/info/index.js +3 -2
- package/dist/esm/components/mui-icons/left-arrow/index.js +1 -0
- package/dist/esm/components/mui-icons/left-chevron/index.js +6 -5
- package/dist/esm/components/mui-icons/left-sidebar/index.js +6 -5
- package/dist/esm/components/mui-icons/list-and-film/index.js +1 -0
- package/dist/esm/components/mui-icons/menu/index.js +8 -7
- package/dist/esm/components/mui-icons/message/index.js +5 -4
- package/dist/esm/components/mui-icons/moon/index.js +3 -2
- package/dist/esm/components/mui-icons/movie-clapper/index.js +5 -4
- package/dist/esm/components/mui-icons/music-microphone/index.js +6 -5
- package/dist/esm/components/mui-icons/music-quarter-note/index.js +1 -0
- package/dist/esm/components/mui-icons/notification/index.js +5 -4
- package/dist/esm/components/mui-icons/pin/index.js +3 -2
- package/dist/esm/components/mui-icons/pin-slash/index.js +6 -5
- package/dist/esm/components/mui-icons/play-rectangle/index.js +9 -8
- package/dist/esm/components/mui-icons/play-stack/index.js +5 -4
- package/dist/esm/components/mui-icons/rectangle/index.js +6 -5
- package/dist/esm/components/mui-icons/rectangle-bottom-panel/index.js +1 -0
- package/dist/esm/components/mui-icons/rectangle-dashed/index.js +1 -0
- package/dist/esm/components/mui-icons/rectangle-left-drawer/index.js +1 -0
- package/dist/esm/components/mui-icons/rectangle-media-text/index.js +6 -5
- package/dist/esm/components/mui-icons/right-chevron/index.js +1 -0
- package/dist/esm/components/mui-icons/search/index.js +6 -5
- package/dist/esm/components/mui-icons/spinner/index.js +56 -0
- package/dist/esm/components/mui-icons/stop/index.js +3 -2
- package/dist/esm/components/mui-icons/subtract/index.js +1 -0
- package/dist/esm/components/mui-icons/sun/index.js +1 -0
- package/dist/esm/components/mui-icons/text-below-folder/index.js +55 -0
- package/dist/esm/components/mui-icons/toggle/index.js +8 -6
- package/dist/esm/components/mui-icons/translate/index.js +5 -4
- package/dist/esm/components/mui-icons/up-arrow/index.js +5 -4
- package/dist/esm/components/mui-icons/up-chevron/index.js +6 -5
- package/dist/esm/components/mui-icons/warning/index.js +7 -6
- package/dist/esm/components/mui-input/index.js +298 -47
- package/dist/esm/components/mui-link/index.js +187 -59
- package/dist/esm/components/mui-list/item/index.js +3 -0
- package/dist/esm/components/mui-markdown/index.js +149 -0
- package/dist/esm/components/mui-media-player/index.js +184 -0
- package/dist/esm/components/mui-message/index.js +50 -20
- package/dist/esm/components/mui-progress/index.js +15 -15
- package/dist/esm/components/mui-prompt/index.js +1461 -0
- package/dist/esm/components/mui-prompt-message/index.js +114 -0
- package/dist/esm/components/mui-prompt-preview/index.js +497 -0
- package/dist/esm/components/mui-prompt-toggle/index.js +48 -0
- package/dist/esm/components/mui-radio/index.js +155 -0
- package/dist/esm/components/mui-radio-group/index.js +104 -0
- package/dist/esm/components/mui-range-input/index.js +122 -0
- package/dist/esm/components/mui-rule/index.js +11 -3
- package/dist/esm/components/mui-select/index.js +89 -30
- package/dist/esm/components/mui-spinner/index.js +70 -0
- package/dist/esm/components/mui-stepper/step/index.js +255 -18
- package/dist/esm/components/mui-stepper/stepper/index.js +68 -72
- package/dist/esm/components/mui-table/row/index.js +16 -3
- package/dist/esm/components/mui-tabs/controller/index.js +21 -14
- package/dist/esm/components/mui-tabs/item/index.js +285 -29
- package/dist/esm/components/mui-tabs/panel/index.js +3 -0
- package/dist/esm/components/mui-tabs/tab-bar/index.js +85 -34
- package/dist/esm/components/mui-textarea/index.js +257 -0
- package/dist/esm/css/mui-base.css +27 -0
- package/dist/esm/css/mui-brand.css +3 -1
- package/dist/esm/css/mui-tokens.css +234 -7
- package/dist/esm/custom-elements.json +5113 -1702
- package/dist/esm/index.js +24 -4
- package/dist/esm/tokens/js/index.js +107 -105
- package/dist/types/components/mui-agent-bubble/doc.d.ts +2 -0
- package/dist/types/components/mui-agent-bubble/index.d.ts +1 -0
- package/dist/types/components/mui-agent-prompt/doc.d.ts +2 -0
- package/dist/types/components/mui-agent-prompt/index.d.ts +1 -0
- package/dist/types/components/mui-chip-input/doc.d.ts +2 -0
- package/dist/types/components/mui-chip-input/index.d.ts +3 -0
- package/dist/types/components/mui-form-group/doc.d.ts +2 -0
- package/dist/types/components/mui-form-group/index.d.ts +2 -0
- package/dist/types/components/mui-form-group-horizontal/index.d.ts +1 -0
- package/dist/types/components/mui-form-hint/doc.d.ts +2 -0
- package/dist/types/components/mui-form-hint/index.d.ts +1 -0
- package/dist/types/components/mui-form-message/index.d.ts +2 -0
- package/dist/types/components/mui-form-section/doc.d.ts +2 -0
- package/dist/types/components/mui-form-section/index.d.ts +1 -0
- package/dist/types/components/mui-form-section-footer/doc.d.ts +2 -0
- package/dist/types/components/mui-form-section-footer/index.d.ts +1 -0
- package/dist/types/components/mui-hint/doc.d.ts +2 -0
- package/dist/types/components/mui-hint/index.d.ts +1 -0
- package/dist/types/components/mui-icons/exclamationmark.d.ts +1 -0
- package/dist/types/components/mui-icons/index.d.ts +3 -0
- package/dist/types/components/mui-icons/spinner.d.ts +1 -0
- package/dist/types/components/mui-icons/text-below-folder.d.ts +1 -0
- package/dist/types/components/mui-markdown/doc.d.ts +2 -0
- package/dist/types/components/mui-markdown/index.d.ts +1 -0
- package/dist/types/components/mui-media-player/doc.d.ts +2 -0
- package/dist/types/components/mui-media-player/index.d.ts +8 -0
- package/dist/types/components/mui-prompt/doc.d.ts +2 -0
- package/dist/types/components/mui-prompt/index.d.ts +18 -0
- package/dist/types/components/mui-prompt-chip/index.d.ts +1 -0
- package/dist/types/components/mui-prompt-message/doc.d.ts +2 -0
- package/dist/types/components/mui-prompt-message/index.d.ts +1 -0
- package/dist/types/components/mui-prompt-preview/doc.d.ts +2 -0
- package/dist/types/components/mui-prompt-preview/index.d.ts +7 -0
- package/dist/types/components/mui-prompt-toggle/index.d.ts +1 -0
- package/dist/types/components/mui-radio/doc.d.ts +2 -0
- package/dist/types/components/mui-radio/index.d.ts +1 -0
- package/dist/types/components/mui-radio-group/index.d.ts +1 -0
- package/dist/types/components/mui-range-input/doc.d.ts +2 -0
- package/dist/types/components/mui-range-input/index.d.ts +1 -0
- package/dist/types/components/mui-spinner/doc.d.ts +2 -0
- package/dist/types/components/mui-spinner/index.d.ts +1 -0
- package/dist/types/components/mui-stepper/step/index.d.ts +4 -1
- package/dist/types/components/mui-textarea/doc.d.ts +2 -0
- package/dist/types/components/mui-textarea/index.d.ts +1 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/tokens/js/index.d.ts +2 -0
- package/package.json +88 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
Muibook Source-Available License
|
|
2
|
+
Version 1.0 — 2026-02-04
|
|
2
3
|
|
|
3
|
-
Copyright (c)
|
|
4
|
+
Copyright (c) 2026 Michael Trilford
|
|
4
5
|
|
|
5
|
-
Permission is
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
6
|
+
Permission is granted to view, copy, and use the Software for personal,
|
|
7
|
+
educational, and internal business purposes, provided that you do not
|
|
8
|
+
redistribute it.
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
You MAY:
|
|
11
|
+
- Use the Software internally within your organization.
|
|
12
|
+
- Study, modify, and experiment with the Software for learning or internal use.
|
|
14
13
|
|
|
14
|
+
You MAY NOT:
|
|
15
|
+
- Redistribute, repackage, or sublicense the Software (in whole or in part),
|
|
16
|
+
including publishing it to public registries, package managers, app stores,
|
|
17
|
+
or similar distribution channels.
|
|
18
|
+
- Sell, license, or commercialize the Software or any derivative works.
|
|
19
|
+
- Offer the Software as a hosted service or product feature that competes with
|
|
20
|
+
@muibook/components or Muibook products.
|
|
21
|
+
|
|
22
|
+
Attribution:
|
|
23
|
+
- If you use or modify the Software internally, you must retain this license
|
|
24
|
+
and any copyright notices.
|
|
25
|
+
|
|
26
|
+
Trademarks:
|
|
27
|
+
- "Muibook", "MichaelUI", and associated logos/marks are trademarks of
|
|
28
|
+
Michael Trilford. This license does not grant any rights to use trademarks.
|
|
29
|
+
|
|
30
|
+
Disclaimer:
|
|
15
31
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
32
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
33
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
34
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
35
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
36
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
37
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
Leverage reusable vanilla Web Components built with the Mui (MichaelUI) Design System in your project. Simply install the [@muibook/components](https://www.npmjs.com/package/@muibook/components?activeTab=readme) package to access a framework-agnostic, accessible, and customizable component library.
|
|
6
6
|
|
|
7
|
+
## Usage Policy (Summary)
|
|
8
|
+
|
|
9
|
+
This repository is **source-available for education and internal use**. Redistribution, repackaging, or resale is **not permitted**. The intended public distribution channel is the NPM package: `@muibook/components`. See `LICENSE` for full terms.
|
|
10
|
+
|
|
7
11
|
```bash
|
|
8
12
|
npm install @muibook/components
|
|
9
13
|
```
|
|
@@ -9,9 +9,9 @@ class u extends HTMLElement {
|
|
|
9
9
|
return this.detailEl || (this.detailEl = ((e = this.shadowRoot) == null ? void 0 : e.querySelector(".accordion-detail")) || null), this.detailEl;
|
|
10
10
|
}
|
|
11
11
|
connectedCallback() {
|
|
12
|
-
var
|
|
12
|
+
var s, n;
|
|
13
13
|
if (!this.shadowRoot) return;
|
|
14
|
-
const e = this.getAttribute("heading") || "Heading...", t = this.getAttribute("size") || "medium", i = this.getAttribute("level") || "3",
|
|
14
|
+
const e = this.getAttribute("heading") || "Heading...", t = this.getAttribute("size") || "medium", i = this.getAttribute("level") || "3", r = this.getAttribute("detail-space"), h = r ? `detail-space-${r}` : "";
|
|
15
15
|
let m = (
|
|
16
16
|
/*html*/
|
|
17
17
|
`
|
|
@@ -102,6 +102,7 @@ class u extends HTMLElement {
|
|
|
102
102
|
:host([card-slot]) .accordion-summary {
|
|
103
103
|
padding-left: var(--space-500);
|
|
104
104
|
padding-right: var(--space-500);
|
|
105
|
+
border-top-color: color-mix(in srgb, var(--border-color) 50%, transparent);
|
|
105
106
|
}
|
|
106
107
|
@media (min-width: 768px) {
|
|
107
108
|
:host([card-slot]) .accordion-summary {
|
|
@@ -113,6 +114,9 @@ class u extends HTMLElement {
|
|
|
113
114
|
padding-left: var(--space-500);
|
|
114
115
|
padding-right: var(--space-500);
|
|
115
116
|
}
|
|
117
|
+
:host([card-slot]) .accordion-detail {
|
|
118
|
+
box-shadow: inset 0 1px 0 0 color-mix(in srgb, var(--border-color) 50%, transparent);
|
|
119
|
+
}
|
|
116
120
|
@media (min-width: 768px) {
|
|
117
121
|
:host([card-slot]) .accordion-detail-inner {
|
|
118
122
|
padding-left: var(--space-600);
|
|
@@ -164,7 +168,7 @@ class u extends HTMLElement {
|
|
|
164
168
|
console.error("Accordion elements not found");
|
|
165
169
|
return;
|
|
166
170
|
}
|
|
167
|
-
(
|
|
171
|
+
(s = this.summaryEl) == null || s.addEventListener("click", () => this.toggleAccordion()), (n = this.summaryEl) == null || n.addEventListener("keydown", (a) => {
|
|
168
172
|
(a.key === "Enter" || a.key === " ") && (a.preventDefault(), this.toggleAccordion());
|
|
169
173
|
});
|
|
170
174
|
}
|
|
@@ -173,8 +177,8 @@ class u extends HTMLElement {
|
|
|
173
177
|
if (!e) return;
|
|
174
178
|
const i = !e.hasAttribute("open");
|
|
175
179
|
if (this.setOpen(i), i) {
|
|
176
|
-
const
|
|
177
|
-
e.style.maxHeight =
|
|
180
|
+
const r = e.scrollHeight;
|
|
181
|
+
e.style.maxHeight = r + "px";
|
|
178
182
|
} else
|
|
179
183
|
e.style.maxHeight = "0";
|
|
180
184
|
}
|
|
@@ -3,29 +3,29 @@ import "../mui-icons/check/index.js";
|
|
|
3
3
|
import "../mui-icons/info/index.js";
|
|
4
4
|
import "../mui-icons/warning/index.js";
|
|
5
5
|
import "../mui-icons/attention/index.js";
|
|
6
|
-
function
|
|
7
|
-
return ["positive", "info", "warning", "attention"].includes(
|
|
6
|
+
function y(m) {
|
|
7
|
+
return ["positive", "info", "warning", "attention"].includes(m);
|
|
8
8
|
}
|
|
9
|
-
class
|
|
9
|
+
class $ extends HTMLElement {
|
|
10
10
|
constructor() {
|
|
11
|
-
super(), this.actionSlotListener = null, this.attachShadow({ mode: "open" });
|
|
11
|
+
super(), this.actionSlotListener = null, this.contentSlotListener = null, this.attachShadow({ mode: "open" });
|
|
12
12
|
}
|
|
13
13
|
static get observedAttributes() {
|
|
14
|
-
return ["variant"];
|
|
14
|
+
return ["variant", "label", "hide-label", "size"];
|
|
15
15
|
}
|
|
16
16
|
connectedCallback() {
|
|
17
17
|
this.render();
|
|
18
18
|
}
|
|
19
|
-
attributeChangedCallback(
|
|
20
|
-
|
|
19
|
+
attributeChangedCallback(t, n, i) {
|
|
20
|
+
(t === "variant" || t === "label" || t === "hide-label" || t === "size") && n !== i && this.shadowRoot && this.render();
|
|
21
21
|
}
|
|
22
22
|
render() {
|
|
23
|
-
const
|
|
23
|
+
const t = this.getAttribute("variant") || "positive", n = {
|
|
24
24
|
success: "positive",
|
|
25
25
|
error: "attention"
|
|
26
|
-
},
|
|
27
|
-
if (
|
|
28
|
-
this.setAttribute("variant",
|
|
26
|
+
}, i = y(t) ? t : n[t] || "positive";
|
|
27
|
+
if (t !== i) {
|
|
28
|
+
this.setAttribute("variant", i);
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
const c = {
|
|
@@ -34,28 +34,28 @@ class v extends HTMLElement {
|
|
|
34
34
|
warning: "assertive",
|
|
35
35
|
attention: "assertive"
|
|
36
36
|
};
|
|
37
|
-
this.setAttribute("role", "alert"), this.setAttribute("aria-live", c[
|
|
38
|
-
const
|
|
37
|
+
this.setAttribute("role", "alert"), this.setAttribute("aria-live", c[i] || "polite");
|
|
38
|
+
const d = {
|
|
39
39
|
positive: "mui-icon-check",
|
|
40
40
|
info: "mui-icon-info",
|
|
41
41
|
warning: "mui-icon-warning",
|
|
42
42
|
attention: "mui-icon-attention"
|
|
43
|
-
},
|
|
43
|
+
}, u = {
|
|
44
44
|
positive: "--feedback-positive-icon",
|
|
45
45
|
info: "--feedback-info-icon",
|
|
46
46
|
warning: "--feedback-warning-icon",
|
|
47
47
|
attention: "--feedback-attention-icon"
|
|
48
|
-
},
|
|
48
|
+
}, r = {
|
|
49
49
|
positive: "--feedback-positive-text",
|
|
50
50
|
info: "--feedback-info-text",
|
|
51
51
|
warning: "--feedback-warning-text",
|
|
52
52
|
attention: "--feedback-attention-text"
|
|
53
|
-
},
|
|
53
|
+
}, a = {
|
|
54
54
|
positive: "Success!",
|
|
55
55
|
info: "Info:",
|
|
56
56
|
warning: "Warning!",
|
|
57
57
|
attention: "Error!"
|
|
58
|
-
},
|
|
58
|
+
}, s = d[i], g = u[i], o = r[i], l = this.getAttribute("label"), p = l && l.trim().length > 0 ? l : a[i], h = this.hasAttribute("hide-label"), e = this.getAlertSize(), A = e === "large" ? "medium" : "small", S = e === "large" ? "medium" : "small", w = e === "large" ? "var(--alert-padding-large)" : e === "medium" ? "var(--alert-padding-medium)" : "var(--alert-padding-small)", z = e === "large" ? "var(--alert-padding-large)" : e === "medium" ? "var(--alert-padding-medium)" : "var(--alert-padding-small)", b = e === "large" ? "var(--alert-padding-large)" : e === "medium" ? "var(--alert-padding-medium)" : "var(--alert-padding-small)", v = e === "large" ? "var(--alert-padding-large)" : e === "medium" ? "var(--alert-padding-medium)" : "var(--alert-padding-small)", k = e === "large" ? "var(--alert-gap-horizontal-mobile)" : "var(--space-200)", f = e === "small" || e === "large" ? "var(--space-100)" : "calc(var(--space-050) + var(--space-025))", L = (
|
|
59
59
|
/*css*/
|
|
60
60
|
`
|
|
61
61
|
|
|
@@ -67,49 +67,57 @@ class v extends HTMLElement {
|
|
|
67
67
|
|
|
68
68
|
section {
|
|
69
69
|
border-radius: var(--alert-radius);
|
|
70
|
-
padding-left:
|
|
71
|
-
padding-right:
|
|
70
|
+
padding-left: ${v};
|
|
71
|
+
padding-right: ${v};
|
|
72
72
|
background: var(--white);
|
|
73
73
|
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.05);
|
|
74
74
|
display: grid;
|
|
75
75
|
grid-template-columns: auto 1fr;
|
|
76
76
|
align-items: start;
|
|
77
|
-
gap:
|
|
77
|
+
gap: ${k};
|
|
78
78
|
box-sizing: border-box;
|
|
79
|
-
border: var(--feedback-${
|
|
80
|
-
background: var(--feedback-${
|
|
79
|
+
border: var(--feedback-${i}-border);
|
|
80
|
+
background: var(--feedback-${i}-background);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.icon {
|
|
84
|
+
padding-top: ${b};
|
|
85
|
+
padding-bottom: ${b};
|
|
81
86
|
}
|
|
82
87
|
|
|
83
|
-
.icon,
|
|
84
88
|
mui-body {
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
display: inline-flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
flex-wrap: wrap;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
mui-body::part(padding) {
|
|
95
|
+
padding-top: ${w};
|
|
96
|
+
padding-bottom: ${z};
|
|
87
97
|
}
|
|
88
98
|
|
|
89
99
|
section[has-action] {
|
|
90
|
-
padding-right:
|
|
100
|
+
padding-right: ${f};
|
|
91
101
|
grid-template-columns: auto 1fr auto;
|
|
92
102
|
}
|
|
93
103
|
|
|
94
104
|
::slotted(mui-button[slot="action"]),
|
|
95
|
-
::slotted(mui-link[slot="action"]) {
|
|
105
|
+
::slotted(mui-link[slot="action"]) {
|
|
106
|
+
padding-top: var(--space-100);
|
|
107
|
+
}
|
|
96
108
|
|
|
97
109
|
@media (min-width: 600px) {
|
|
98
110
|
:section { gap: var(--alert-gap-horizontal-desktop); }
|
|
99
|
-
:section([has-action]) { padding-right:
|
|
111
|
+
:section([has-action]) { padding-right: ${f}; }
|
|
100
112
|
::slotted(mui-button[slot="action"]),
|
|
101
113
|
::slotted(mui-link[slot="action"]) { align-self: center; padding-top: var(--space-000); }
|
|
102
114
|
}
|
|
103
115
|
|
|
104
116
|
.label {
|
|
105
|
-
color: var(${
|
|
117
|
+
color: var(${o});
|
|
106
118
|
font-weight: var(--font-weight-bold);
|
|
107
119
|
}
|
|
108
120
|
|
|
109
|
-
mui-body::part(display) {
|
|
110
|
-
display: inline;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
121
|
mui-body::part(gap) {
|
|
114
122
|
gap: var(--space-000);
|
|
115
123
|
}
|
|
@@ -118,35 +126,63 @@ class v extends HTMLElement {
|
|
|
118
126
|
);
|
|
119
127
|
this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
|
|
120
128
|
`
|
|
121
|
-
<style>${
|
|
129
|
+
<style>${L}</style>
|
|
122
130
|
<section>
|
|
123
|
-
<${
|
|
124
|
-
<mui-body>
|
|
125
|
-
|
|
131
|
+
<${s} size="${A}" color="var(${g})" class="icon"></${s}>
|
|
132
|
+
<mui-body size="${S}">
|
|
133
|
+
${h ? "" : `<span class="label">${p}</span>`}
|
|
126
134
|
<slot></slot>
|
|
127
135
|
</mui-body>
|
|
128
136
|
<slot name="action"></slot>
|
|
129
137
|
</section>
|
|
130
|
-
`, this.setupActionSlot());
|
|
138
|
+
`, this.setupActionSlot(), this.setupContentSlot());
|
|
139
|
+
}
|
|
140
|
+
getAlertSize() {
|
|
141
|
+
const t = this.getAttribute("size");
|
|
142
|
+
return t === "small" || t === "large" ? t : "medium";
|
|
143
|
+
}
|
|
144
|
+
getInlineContentSize(t) {
|
|
145
|
+
return t === "small" || t === "medium" ? "small" : "medium";
|
|
146
|
+
}
|
|
147
|
+
getActionControlSize(t) {
|
|
148
|
+
return t === "small" ? "x-small" : t === "medium" ? "small" : "medium";
|
|
131
149
|
}
|
|
132
150
|
setupActionSlot() {
|
|
133
|
-
var
|
|
134
|
-
const
|
|
135
|
-
if (
|
|
136
|
-
this.actionSlotListener &&
|
|
137
|
-
const
|
|
138
|
-
var
|
|
139
|
-
const c = this.getAttribute("variant") || "positive",
|
|
151
|
+
var n;
|
|
152
|
+
const t = (n = this.shadowRoot) == null ? void 0 : n.querySelector('slot[name="action"]');
|
|
153
|
+
if (t) {
|
|
154
|
+
this.actionSlotListener && t.removeEventListener("slotchange", this.actionSlotListener);
|
|
155
|
+
const i = () => {
|
|
156
|
+
var g;
|
|
157
|
+
const c = this.getAttribute("variant") || "positive", d = this.getAlertSize(), u = this.getActionControlSize(d), r = t.assignedElements();
|
|
140
158
|
let a = !1;
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
(
|
|
159
|
+
r.forEach((o) => {
|
|
160
|
+
const l = o.tagName;
|
|
161
|
+
(l === "MUI-BUTTON" || l === "MUI-LINK") && (a = !0, o.setAttribute("variant", "tertiary"), o.setAttribute("size", u), o.hasAttribute("icon-only") && Array.from(o.querySelectorAll("*")).filter(
|
|
162
|
+
(e) => e.tagName.toLowerCase().startsWith("mui-icon-")
|
|
163
|
+
).forEach((e) => {
|
|
164
|
+
e.setAttribute("size", u);
|
|
165
|
+
}), o.removeAttribute("alert-slot"), o.removeAttribute("alert-positive-slot"), o.removeAttribute("alert-info-slot"), o.removeAttribute("alert-warning-slot"), o.removeAttribute("alert-attention-slot"), o.setAttribute("alert-slot", ""), o.setAttribute(`alert-${c}-slot`, ""));
|
|
144
166
|
});
|
|
145
|
-
const
|
|
146
|
-
|
|
167
|
+
const s = (g = this.shadowRoot) == null ? void 0 : g.querySelector("section");
|
|
168
|
+
s && (a ? s.setAttribute("has-action", "") : s.removeAttribute("has-action"));
|
|
147
169
|
};
|
|
148
|
-
this.actionSlotListener =
|
|
170
|
+
this.actionSlotListener = i, t.addEventListener("slotchange", this.actionSlotListener), requestAnimationFrame(i);
|
|
149
171
|
}
|
|
150
172
|
}
|
|
173
|
+
setupContentSlot() {
|
|
174
|
+
var i;
|
|
175
|
+
const t = (i = this.shadowRoot) == null ? void 0 : i.querySelector("slot:not([name])");
|
|
176
|
+
if (!t) return;
|
|
177
|
+
this.contentSlotListener && t.removeEventListener("slotchange", this.contentSlotListener);
|
|
178
|
+
const n = () => {
|
|
179
|
+
const c = this.getAlertSize(), d = this.getInlineContentSize(c);
|
|
180
|
+
t.assignedElements({ flatten: !0 }).forEach((r) => {
|
|
181
|
+
const a = r.tagName.toLowerCase();
|
|
182
|
+
(a === "mui-link" || a === "mui-body") && r.setAttribute("size", d);
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
this.contentSlotListener = n, t.addEventListener("slotchange", this.contentSlotListener), requestAnimationFrame(n);
|
|
186
|
+
}
|
|
151
187
|
}
|
|
152
|
-
customElements.get("mui-alert") || customElements.define("mui-alert",
|
|
188
|
+
customElements.get("mui-alert") || customElements.define("mui-alert", $);
|
|
@@ -1,28 +1,71 @@
|
|
|
1
|
-
class
|
|
1
|
+
class b extends HTMLElement {
|
|
2
2
|
constructor() {
|
|
3
3
|
super(), this.attachShadow({ mode: "open" });
|
|
4
4
|
}
|
|
5
5
|
static get observedAttributes() {
|
|
6
|
-
return ["variant"];
|
|
6
|
+
return ["variant", "size"];
|
|
7
7
|
}
|
|
8
8
|
connectedCallback() {
|
|
9
|
-
this.hasAttribute("variant") || this.setAttribute("variant", "neutral"), this.setAttribute("role", "status"), this.render();
|
|
9
|
+
this.hasAttribute("variant") || this.setAttribute("variant", "neutral"), this.hasAttribute("size") || this.setAttribute("size", "medium"), this.setAttribute("role", "status"), this.render();
|
|
10
10
|
}
|
|
11
11
|
attributeChangedCallback() {
|
|
12
12
|
this.render();
|
|
13
13
|
}
|
|
14
14
|
render() {
|
|
15
|
-
const t = this.getAttribute("variant") || "neutral",
|
|
15
|
+
const t = this.getAttribute("variant") || "neutral", i = this.getAttribute("size") || "medium", n = {
|
|
16
16
|
neutral: "var(--badge-background-neutral)",
|
|
17
17
|
positive: "var(--badge-background-positive)",
|
|
18
18
|
warning: "var(--badge-background-warning)",
|
|
19
|
-
attention: "var(--badge-background-attention)"
|
|
20
|
-
|
|
19
|
+
attention: "var(--badge-background-attention)",
|
|
20
|
+
overlay: "var(--badge-background-overlay)"
|
|
21
|
+
}, r = {
|
|
22
|
+
neutral: "var(--badge-text-color)",
|
|
23
|
+
positive: "var(--badge-text-color)",
|
|
24
|
+
warning: "var(--badge-text-color)",
|
|
25
|
+
attention: "var(--badge-text-color)",
|
|
26
|
+
overlay: "var(--badge-text-color-overlay)"
|
|
27
|
+
}, s = {
|
|
28
|
+
neutral: "none",
|
|
29
|
+
positive: "none",
|
|
30
|
+
warning: "none",
|
|
31
|
+
attention: "none",
|
|
32
|
+
overlay: "var(--badge-border-overlay)"
|
|
33
|
+
}, o = {
|
|
21
34
|
neutral: "off",
|
|
22
35
|
positive: "polite",
|
|
23
36
|
warning: "assertive",
|
|
24
|
-
attention: "assertive"
|
|
25
|
-
|
|
37
|
+
attention: "assertive",
|
|
38
|
+
overlay: "off"
|
|
39
|
+
}, d = n[t], g = r[t], l = s[t], c = o[t], a = {
|
|
40
|
+
"xx-small": {
|
|
41
|
+
fontSize: "var(--font-size-15)",
|
|
42
|
+
lineHeight: "1",
|
|
43
|
+
padding: "0 var(--space-050)",
|
|
44
|
+
minHeight: "1.6rem"
|
|
45
|
+
},
|
|
46
|
+
"x-small": {
|
|
47
|
+
fontSize: "var(--font-size-15)",
|
|
48
|
+
lineHeight: "1",
|
|
49
|
+
padding: "0 var(--space-100)",
|
|
50
|
+
minHeight: "2rem"
|
|
51
|
+
},
|
|
52
|
+
small: {
|
|
53
|
+
fontSize: "var(--font-size-15)",
|
|
54
|
+
lineHeight: "1",
|
|
55
|
+
padding: "0 var(--space-200)",
|
|
56
|
+
minHeight: "2.2rem"
|
|
57
|
+
},
|
|
58
|
+
medium: {
|
|
59
|
+
fontSize: "var(--text-font-size-xs)",
|
|
60
|
+
lineHeight: "1",
|
|
61
|
+
padding: "var(--space-100) var(--space-200)"
|
|
62
|
+
},
|
|
63
|
+
large: {
|
|
64
|
+
fontSize: "var(--font-size-50)",
|
|
65
|
+
lineHeight: "1",
|
|
66
|
+
padding: "var(--space-100) var(--space-300)"
|
|
67
|
+
}
|
|
68
|
+
}, e = a[i] || a.medium, v = (
|
|
26
69
|
/*css*/
|
|
27
70
|
`
|
|
28
71
|
:host {
|
|
@@ -34,12 +77,14 @@ class n extends HTMLElement {
|
|
|
34
77
|
display: inline-flex;
|
|
35
78
|
align-items: center;
|
|
36
79
|
border-radius: var(--badge-radius);
|
|
37
|
-
background: ${
|
|
38
|
-
|
|
80
|
+
background: ${d};
|
|
81
|
+
border: ${l};
|
|
82
|
+
font-size: ${e.fontSize};
|
|
83
|
+
line-height: ${e.lineHeight};
|
|
39
84
|
font-weight: var(--badge-font-weight);
|
|
40
|
-
color:
|
|
41
|
-
padding:
|
|
42
|
-
|
|
85
|
+
color: ${g};
|
|
86
|
+
padding: ${e.padding};
|
|
87
|
+
min-height: ${e.minHeight || "auto"};
|
|
43
88
|
}
|
|
44
89
|
|
|
45
90
|
:host([usage="slat-end"]) {
|
|
@@ -47,13 +92,13 @@ class n extends HTMLElement {
|
|
|
47
92
|
}
|
|
48
93
|
`
|
|
49
94
|
);
|
|
50
|
-
this.setAttribute("role", "status"), this.setAttribute("aria-live",
|
|
95
|
+
this.setAttribute("role", "status"), this.setAttribute("aria-live", c), this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
|
|
51
96
|
`
|
|
52
|
-
<style>${
|
|
97
|
+
<style>${v}</style>
|
|
53
98
|
<span class="badge">
|
|
54
99
|
<slot></slot>
|
|
55
100
|
</span>
|
|
56
101
|
`);
|
|
57
102
|
}
|
|
58
103
|
}
|
|
59
|
-
customElements.get("mui-badge") || customElements.define("mui-badge",
|
|
104
|
+
customElements.get("mui-badge") || customElements.define("mui-badge", b);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getPartMap as
|
|
2
|
-
class
|
|
1
|
+
import { getPartMap as r } from "../../utils/part-map/index.js";
|
|
2
|
+
class l extends HTMLElement {
|
|
3
3
|
static get observedAttributes() {
|
|
4
4
|
return ["size", "weight", "variant"];
|
|
5
5
|
}
|
|
@@ -9,16 +9,20 @@ class r extends HTMLElement {
|
|
|
9
9
|
async connectedCallback() {
|
|
10
10
|
this.hasAttribute("size") || this.setAttribute("size", "medium"), this.hasAttribute("weight") || this.setAttribute("weight", "regular"), this.hasAttribute("variant") || this.setAttribute("variant", "default"), await this.waitForPartMap(), this.render();
|
|
11
11
|
}
|
|
12
|
-
attributeChangedCallback(t, e,
|
|
13
|
-
e !==
|
|
12
|
+
attributeChangedCallback(t, e, s) {
|
|
13
|
+
e !== s && this.shadowRoot && this.render();
|
|
14
14
|
}
|
|
15
15
|
render() {
|
|
16
16
|
if (!this.shadowRoot) return;
|
|
17
|
-
const t =
|
|
17
|
+
const t = r("text", "spacing", "layout", "visual");
|
|
18
18
|
this.shadowRoot.innerHTML = /*html*/
|
|
19
19
|
`
|
|
20
20
|
<style>
|
|
21
21
|
:host { display: block; }
|
|
22
|
+
:host([has-before]),
|
|
23
|
+
:host([has-after]) {
|
|
24
|
+
display: inline-flex;
|
|
25
|
+
}
|
|
22
26
|
|
|
23
27
|
:host p {
|
|
24
28
|
color: var(--text-color);
|
|
@@ -27,6 +31,40 @@ class r extends HTMLElement {
|
|
|
27
31
|
width: 100%;
|
|
28
32
|
}
|
|
29
33
|
|
|
34
|
+
:host([has-before]) p,
|
|
35
|
+
:host([has-after]) p {
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
align-items: flex-start;
|
|
38
|
+
gap: var(--space-100);
|
|
39
|
+
width: auto;
|
|
40
|
+
max-width: 100%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.content {
|
|
44
|
+
min-width: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
::slotted([slot="before"]),
|
|
48
|
+
::slotted([slot="after"]) {
|
|
49
|
+
flex-shrink: 0;
|
|
50
|
+
margin-top: var(--body-inline-icon-offset-medium, var(--body-inline-icon-offset, var(--stroke-size-100)));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:host([size="x-small"]) ::slotted([slot="before"]),
|
|
54
|
+
:host([size="x-small"]) ::slotted([slot="after"]) {
|
|
55
|
+
margin-top: var(--body-inline-icon-offset-x-small, var(--body-inline-icon-offset, var(--stroke-size-100)));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:host([size="small"]) ::slotted([slot="before"]),
|
|
59
|
+
:host([size="small"]) ::slotted([slot="after"]) {
|
|
60
|
+
margin-top: var(--body-inline-icon-offset-small, var(--body-inline-icon-offset, var(--stroke-size-100)));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:host([size="large"]) ::slotted([slot="before"]),
|
|
64
|
+
:host([size="large"]) ::slotted([slot="after"]) {
|
|
65
|
+
margin-top: var(--body-inline-icon-offset-large, var(--body-inline-icon-offset, var(--stroke-size-100)));
|
|
66
|
+
}
|
|
67
|
+
|
|
30
68
|
:host([size="x-small"]) p {
|
|
31
69
|
font-size: var(--text-font-size-xs);
|
|
32
70
|
line-height: var(--text-line-height-xs);
|
|
@@ -88,17 +126,45 @@ class r extends HTMLElement {
|
|
|
88
126
|
|
|
89
127
|
</style>
|
|
90
128
|
|
|
91
|
-
<p part="${t}"
|
|
92
|
-
|
|
129
|
+
<p part="${t}">
|
|
130
|
+
<slot name="before"></slot>
|
|
131
|
+
<span class="content"><slot></slot></span>
|
|
132
|
+
<slot name="after"></slot>
|
|
133
|
+
</p>
|
|
134
|
+
`, this.setupSlotBehavior();
|
|
135
|
+
}
|
|
136
|
+
setupSlotBehavior() {
|
|
137
|
+
if (!this.shadowRoot) return;
|
|
138
|
+
const t = this.shadowRoot.querySelector('slot[name="before"]'), e = this.shadowRoot.querySelector('slot[name="after"]'), s = () => {
|
|
139
|
+
const a = (t == null ? void 0 : t.assignedElements({ flatten: !0 })) ?? [], i = (e == null ? void 0 : e.assignedElements({ flatten: !0 })) ?? [];
|
|
140
|
+
a.length > 0 ? this.setAttribute("has-before", "") : this.removeAttribute("has-before"), i.length > 0 ? this.setAttribute("has-after", "") : this.removeAttribute("has-after"), this.syncInlineSlotSizes([...a, ...i]);
|
|
141
|
+
};
|
|
142
|
+
t == null || t.addEventListener("slotchange", s), e == null || e.addEventListener("slotchange", s), s();
|
|
143
|
+
}
|
|
144
|
+
syncInlineSlotSizes(t) {
|
|
145
|
+
const s = {
|
|
146
|
+
"x-small": "x-small",
|
|
147
|
+
small: "small",
|
|
148
|
+
medium: "small",
|
|
149
|
+
large: "medium"
|
|
150
|
+
}[this.getAttribute("size") || "medium"] || "small", i = {
|
|
151
|
+
"x-small": "xx-small",
|
|
152
|
+
small: "x-small",
|
|
153
|
+
medium: "small",
|
|
154
|
+
large: "medium"
|
|
155
|
+
}[this.getAttribute("size") || "medium"] || "small";
|
|
156
|
+
t.forEach((o) => {
|
|
157
|
+
o.tagName.startsWith("MUI-ICON-") && o.setAttribute("size", s), o.tagName === "MUI-BADGE" && o.setAttribute("size", i);
|
|
158
|
+
});
|
|
93
159
|
}
|
|
94
160
|
waitForPartMap() {
|
|
95
161
|
return new Promise((t) => {
|
|
96
|
-
if (typeof
|
|
162
|
+
if (typeof r == "function") return t();
|
|
97
163
|
const e = () => {
|
|
98
|
-
typeof
|
|
164
|
+
typeof r == "function" ? t() : requestAnimationFrame(e);
|
|
99
165
|
};
|
|
100
166
|
e();
|
|
101
167
|
});
|
|
102
168
|
}
|
|
103
169
|
}
|
|
104
|
-
customElements.get("mui-body") || customElements.define("mui-body",
|
|
170
|
+
customElements.get("mui-body") || customElements.define("mui-body", l);
|