@muibook/components 1.6.0 → 3.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/dist/esm/agent/keywords/index.js +104 -4
- package/dist/esm/agent/prompts/index.js +392 -37
- package/dist/esm/components/mui-accordion/block/index.js +2 -6
- package/dist/esm/components/mui-accordion/group/index.js +1 -1
- package/dist/esm/components/mui-accordion/inline/index.js +2 -6
- package/dist/esm/components/mui-addon/index.js +1 -1
- package/dist/esm/components/mui-alert/index.js +10 -5
- package/dist/esm/components/mui-badge/index.js +10 -7
- package/dist/esm/components/mui-body/index.js +4 -4
- package/dist/esm/components/mui-button/index.js +23 -25
- package/dist/esm/components/mui-button-group/index.js +1 -1
- package/dist/esm/components/mui-card/body/index.js +22 -18
- package/dist/esm/components/mui-card/card/index.js +1 -1
- package/dist/esm/components/mui-card/footer/index.js +1 -1
- package/dist/esm/components/mui-card/header/index.js +1 -1
- package/dist/esm/components/mui-carousel/controller/index.js +14 -11
- package/dist/esm/components/mui-carousel/panel/index.js +2 -2
- package/dist/esm/components/mui-code/index.js +20 -10
- package/dist/esm/components/mui-container/index.js +1 -1
- package/dist/esm/components/mui-field/index.js +10 -7
- package/dist/esm/components/mui-file-upload/index.js +5 -4
- package/dist/esm/components/mui-grid/index.js +1 -1
- package/dist/esm/components/mui-heading/index.js +1 -1
- package/dist/esm/components/mui-icons/accessibility/index.js +4 -4
- package/dist/esm/components/mui-icons/add/index.js +5 -5
- package/dist/esm/components/mui-icons/attention/index.js +5 -5
- package/dist/esm/components/mui-icons/check/index.js +6 -6
- package/dist/esm/components/mui-icons/close/index.js +2 -2
- package/dist/esm/components/mui-icons/down-arrow-circle/index.js +55 -0
- package/dist/esm/components/mui-icons/down-chevron/index.js +2 -2
- package/dist/esm/components/mui-icons/ellipsis/index.js +55 -0
- package/dist/esm/components/mui-icons/globe/index.js +5 -5
- package/dist/esm/components/mui-icons/grid/index.js +1 -1
- package/dist/esm/components/mui-icons/index.js +2 -0
- package/dist/esm/components/mui-icons/info/index.js +2 -2
- 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 +6 -6
- package/dist/esm/components/mui-icons/menu/index.js +6 -6
- package/dist/esm/components/mui-icons/message/index.js +6 -6
- package/dist/esm/components/mui-icons/moon/index.js +2 -2
- package/dist/esm/components/mui-icons/notification/index.js +2 -2
- package/dist/esm/components/mui-icons/right-chevron/index.js +5 -5
- package/dist/esm/components/mui-icons/stop/index.js +2 -2
- package/dist/esm/components/mui-icons/subtract/index.js +7 -7
- package/dist/esm/components/mui-icons/sun/index.js +6 -6
- package/dist/esm/components/mui-icons/toggle/index.js +39 -30
- package/dist/esm/components/mui-icons/up-arrow/index.js +4 -4
- package/dist/esm/components/mui-icons/up-chevron/index.js +1 -1
- package/dist/esm/components/mui-icons/warning/index.js +2 -2
- package/dist/esm/components/mui-image/index.js +1 -1
- package/dist/esm/components/mui-input/index.js +21 -27
- package/dist/esm/components/mui-link/index.js +52 -57
- package/dist/esm/components/mui-list/item/index.js +5 -2
- package/dist/esm/components/mui-list/list/index.js +1 -1
- package/dist/esm/components/mui-message/index.js +14 -9
- package/dist/esm/components/mui-quote/index.js +1 -1
- package/dist/esm/components/mui-responsive/index.js +1 -1
- package/dist/esm/components/mui-rule/index.js +5 -5
- package/dist/esm/components/mui-select/index.js +28 -27
- package/dist/esm/components/mui-slat/accessory/index.js +29 -0
- package/dist/esm/components/mui-slat/index.js +2 -21
- package/dist/esm/components/mui-slat/slat/index.js +139 -0
- package/dist/esm/components/mui-smart-card/index.js +14 -15
- package/dist/esm/components/mui-stack/hstack/index.js +1 -1
- package/dist/esm/components/mui-stack/vstack/index.js +1 -1
- package/dist/esm/components/mui-switch/index.js +3 -9
- package/dist/esm/components/mui-table/cell/index.js +16 -14
- package/dist/esm/components/mui-table/row/index.js +1 -1
- package/dist/esm/components/mui-table/row-group/index.js +1 -1
- package/dist/esm/components/mui-table/table/index.js +1 -1
- package/dist/esm/components/mui-tabs/controller/index.js +1 -1
- package/dist/esm/components/mui-tabs/item/index.js +2 -2
- package/dist/esm/components/mui-tabs/panel/index.js +1 -1
- package/dist/esm/components/mui-tabs/tab-bar/index.js +1 -1
- package/dist/esm/css/mui-tokens.css +74 -38
- package/dist/esm/index.js +8 -5
- package/dist/types/components/mui-accordion/block/index.d.ts +1 -1
- package/dist/types/components/mui-accordion/inline/index.d.ts +1 -1
- package/dist/types/components/mui-alert/index.d.ts +5 -1
- package/dist/types/components/mui-field/index.d.ts +3 -1
- package/dist/types/components/mui-file-upload/index.d.ts +1 -1
- package/dist/types/components/mui-icons/down-arrow-circle.d.ts +1 -0
- package/dist/types/components/mui-icons/ellipsis.d.ts +1 -0
- package/dist/types/components/mui-icons/index.d.ts +2 -0
- package/dist/types/components/mui-message/index.d.ts +6 -1
- package/dist/types/components/mui-select/index.d.ts +1 -1
- package/dist/types/components/mui-slat/accessory/index.d.ts +1 -0
- package/dist/types/components/mui-slat/index.d.ts +2 -1
- package/dist/types/components/mui-slat/slat/index.d.ts +3 -0
- package/dist/types/components/mui-smart-card/index.d.ts +2 -1
- package/dist/types/index.d.ts +4 -1
- package/package.json +17 -1
- package/readme.md +25 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class l extends HTMLElement {
|
|
2
2
|
static get observedAttributes() {
|
|
3
3
|
return ["size", "color"];
|
|
4
4
|
}
|
|
@@ -12,7 +12,7 @@ class r extends HTMLElement {
|
|
|
12
12
|
(e === "size" || e === "color") && t !== o && this.render();
|
|
13
13
|
}
|
|
14
14
|
render() {
|
|
15
|
-
const e = this.getAttribute("size") || "small", t = this.getAttribute("color"),
|
|
15
|
+
const e = this.getAttribute("size") || "small", t = this.getAttribute("color"), r = t && {
|
|
16
16
|
default: "var(--icon-color-default)",
|
|
17
17
|
inverted: "var(--icon-color-inverted)"
|
|
18
18
|
}[t] || t || "var(--icon-color-default)", i = {
|
|
@@ -30,7 +30,7 @@ class r extends HTMLElement {
|
|
|
30
30
|
display: inline-flex;
|
|
31
31
|
align-items: center;
|
|
32
32
|
justify-content: center;
|
|
33
|
-
fill: ${
|
|
33
|
+
fill: ${r};
|
|
34
34
|
}
|
|
35
35
|
svg {
|
|
36
36
|
width: 100%;
|
|
@@ -52,4 +52,4 @@ class r extends HTMLElement {
|
|
|
52
52
|
`);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
customElements.define("mui-icon-up-arrow",
|
|
55
|
+
customElements.get("mui-icon-up-arrow") || customElements.define("mui-icon-up-arrow", l);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class n extends HTMLElement {
|
|
2
2
|
static get observedAttributes() {
|
|
3
3
|
return ["size", "color"];
|
|
4
4
|
}
|
|
@@ -52,4 +52,4 @@ class r extends HTMLElement {
|
|
|
52
52
|
`);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
customElements.define("mui-icon-warning",
|
|
55
|
+
customElements.get("mui-icon-warning") || customElements.define("mui-icon-warning", n);
|
|
@@ -8,30 +8,30 @@ class m extends HTMLElement {
|
|
|
8
8
|
connectedCallback() {
|
|
9
9
|
this.render(), this.setupListener();
|
|
10
10
|
}
|
|
11
|
-
attributeChangedCallback(e,
|
|
11
|
+
attributeChangedCallback(e, s, r) {
|
|
12
12
|
var o;
|
|
13
|
-
const
|
|
14
|
-
|
|
13
|
+
const t = (o = this.shadowRoot) == null ? void 0 : o.querySelector("input");
|
|
14
|
+
t && (e === "value" && (t.value = r ?? ""), e === "disabled" && (r === null || r === "false" ? t.removeAttribute("disabled") : t.setAttribute("disabled", "")), (e === "type" || e === "placeholder" || e === "label" || e === "hide-label") && (this.render(), this.setupListener()));
|
|
15
15
|
}
|
|
16
16
|
setupListener() {
|
|
17
|
-
var
|
|
18
|
-
const e = (
|
|
17
|
+
var r, t;
|
|
18
|
+
const e = (r = this.shadowRoot) == null ? void 0 : r.querySelector("input");
|
|
19
19
|
if (!e) return;
|
|
20
|
-
const
|
|
21
|
-
(
|
|
22
|
-
const
|
|
20
|
+
const s = e.cloneNode(!0);
|
|
21
|
+
(t = e.parentNode) == null || t.replaceChild(s, e), s.addEventListener("input", (o) => {
|
|
22
|
+
const a = o.target;
|
|
23
23
|
this.dispatchEvent(
|
|
24
24
|
new CustomEvent("input", {
|
|
25
|
-
detail: { value:
|
|
25
|
+
detail: { value: a.value },
|
|
26
26
|
bubbles: !0,
|
|
27
27
|
composed: !0
|
|
28
28
|
})
|
|
29
29
|
);
|
|
30
|
-
}),
|
|
31
|
-
const
|
|
30
|
+
}), s.addEventListener("change", (o) => {
|
|
31
|
+
const a = o.target;
|
|
32
32
|
this.dispatchEvent(
|
|
33
33
|
new CustomEvent("change", {
|
|
34
|
-
detail: { value:
|
|
34
|
+
detail: { value: a.value },
|
|
35
35
|
bubbles: !0,
|
|
36
36
|
composed: !0
|
|
37
37
|
})
|
|
@@ -39,13 +39,7 @@ class m extends HTMLElement {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
render() {
|
|
42
|
-
const e = ["text", "password", "email", "number", "search", "tel", "url", "date", "time"],
|
|
43
|
-
l && !i && console.warn(
|
|
44
|
-
"mui-input Accessibility warning: When using 'hide-label', please provide a 'label' attribute so an 'aria-label' can be generated for screen reader support."
|
|
45
|
-
), !i && !d && console.warn(
|
|
46
|
-
"mui-input Accessibility warning: A 'label' or 'aria-label' attribute is required for screen reader accessibility."
|
|
47
|
-
);
|
|
48
|
-
const f = (
|
|
42
|
+
const e = ["text", "password", "email", "number", "search", "tel", "url", "date", "time"], s = this.getAttribute("type") || "text", r = e.includes(s) ? s : "text", t = this.getAttribute("name") || "", o = this.getAttribute("value") || "", a = this.getAttribute("placeholder") || "", l = this.getAttribute("id") || `mui-input-${Math.random().toString(36).substr(2, 9)}`, i = this.getAttribute("label") || "", n = this.hasAttribute("hide-label"), c = this.hasAttribute("disabled"), u = n && i ? `aria-label="${i}"` : "", d = this.getAttribute("variant") || "", b = d || "", h = this.querySelector('[slot="before"]') !== null, p = this.querySelector('[slot="after"]') !== null, v = [b, h ? "before" : "", p ? "after" : ""].filter(Boolean).join(" "), f = (
|
|
49
43
|
/*html*/
|
|
50
44
|
`
|
|
51
45
|
<style>
|
|
@@ -184,18 +178,18 @@ class m extends HTMLElement {
|
|
|
184
178
|
|
|
185
179
|
|
|
186
180
|
</style>
|
|
187
|
-
${i ? `<label for="${
|
|
181
|
+
${i ? `<label for="${l}" class="${n ? "vh" : ""}">${i}</label>` : ""}
|
|
188
182
|
<div class="input-wrapper">
|
|
189
183
|
<slot name="before"></slot>
|
|
190
184
|
<input
|
|
191
185
|
class="${v}"
|
|
192
|
-
type="${
|
|
193
|
-
name="${
|
|
194
|
-
id="${
|
|
186
|
+
type="${r}"
|
|
187
|
+
name="${t}"
|
|
188
|
+
id="${l}"
|
|
195
189
|
value="${o}"
|
|
196
|
-
placeholder="${
|
|
197
|
-
${
|
|
198
|
-
${
|
|
190
|
+
placeholder="${a}"
|
|
191
|
+
${c ? 'disabled aria-disabled="true"' : ""}
|
|
192
|
+
${u}
|
|
199
193
|
/>
|
|
200
194
|
<slot name="after"></slot>
|
|
201
195
|
</div>
|
|
@@ -204,4 +198,4 @@ class m extends HTMLElement {
|
|
|
204
198
|
this.shadowRoot && (this.shadowRoot.innerHTML = f);
|
|
205
199
|
}
|
|
206
200
|
}
|
|
207
|
-
customElements.define("mui-input", m);
|
|
201
|
+
customElements.get("mui-input") || customElements.define("mui-input", m);
|
|
@@ -1,19 +1,35 @@
|
|
|
1
|
-
import { getPartMap as
|
|
1
|
+
import { getPartMap as e } from "../../utils/part-map/index.js";
|
|
2
2
|
class u extends HTMLElement {
|
|
3
3
|
static get observedAttributes() {
|
|
4
4
|
return ["target", "href", "variant", "weight", "size"];
|
|
5
5
|
}
|
|
6
6
|
constructor() {
|
|
7
7
|
super(), this.attachShadow({ mode: "open" });
|
|
8
|
-
const r = this.getAttribute("size") || "medium", o = this.getAttribute("weight") || "regular";
|
|
9
|
-
this.setAttribute("size", r), this.setAttribute("weight", o);
|
|
10
8
|
}
|
|
11
9
|
async connectedCallback() {
|
|
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(), requestAnimationFrame(() => this.updateSlotState());
|
|
11
|
+
}
|
|
12
|
+
updateSlotState() {
|
|
13
|
+
const t = this.shadowRoot, a = t.querySelector("slot:not([name])"), c = t.querySelector('slot[name="before"]'), l = t.querySelector('slot[name="after"]'), i = (o) => !!o && o.assignedNodes({ flatten: !0 }).some(
|
|
14
|
+
(r) => {
|
|
15
|
+
var s;
|
|
16
|
+
return r.nodeType === Node.ELEMENT_NODE || r.nodeType === Node.TEXT_NODE && !!((s = r.textContent) != null && s.trim());
|
|
17
|
+
}
|
|
18
|
+
), d = i(c), v = i(l);
|
|
19
|
+
this.classList.toggle("has-before", d), this.classList.toggle("has-after", v);
|
|
20
|
+
const n = (a == null ? void 0 : a.assignedNodes({ flatten: !0 })) ?? [], h = n.length > 0 && n.every(
|
|
21
|
+
(o) => {
|
|
22
|
+
var r;
|
|
23
|
+
return o.nodeType === Node.ELEMENT_NODE ? o.classList.contains("mui-icon") || o.tagName.toLowerCase() === "svg" : !((r = o.textContent) != null && r.trim());
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
this.toggleAttribute("icon-only", h);
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
12
29
|
if (!this.shadowRoot) return;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
`
|
|
30
|
+
const t = e("text", "spacing", "layout", "visual");
|
|
31
|
+
this.shadowRoot.innerHTML = /*html*/
|
|
32
|
+
`
|
|
17
33
|
<style>
|
|
18
34
|
|
|
19
35
|
:host { display: inline-flex; width: auto; text-align: initial }
|
|
@@ -80,7 +96,7 @@ class u extends HTMLElement {
|
|
|
80
96
|
text-align: inherit;
|
|
81
97
|
width: 100%;
|
|
82
98
|
text-decoration: none;
|
|
83
|
-
padding: var(--
|
|
99
|
+
padding: var(--action-padding);
|
|
84
100
|
border-radius: var(--action-radius);
|
|
85
101
|
font-size: var(--action-font-size);
|
|
86
102
|
font-weight: var(--action-font-weight);
|
|
@@ -95,25 +111,25 @@ class u extends HTMLElement {
|
|
|
95
111
|
:host([variant="primary"]) a {
|
|
96
112
|
background: var(--action-primary-background);
|
|
97
113
|
color: var(--action-primary-text-color);
|
|
98
|
-
border: var(--action-primary-
|
|
114
|
+
border: var(--action-primary-border);
|
|
99
115
|
}
|
|
100
116
|
|
|
101
117
|
:host([variant="primary"]) a:hover {
|
|
102
118
|
background: var(--action-primary-background-hover);
|
|
103
119
|
color: var(--action-primary-text-color-hover);
|
|
104
|
-
border: var(--action-primary-
|
|
120
|
+
border: var(--action-primary-border-hover);
|
|
105
121
|
}
|
|
106
122
|
|
|
107
123
|
:host([variant="primary"]) a:focus-visible {
|
|
108
124
|
background: var(--action-primary-background-focus);
|
|
109
125
|
color: var(--action-primary-text-color-focus);
|
|
110
|
-
border: var(--action-primary-
|
|
126
|
+
border: var(--action-primary-border-focus);
|
|
111
127
|
}
|
|
112
128
|
|
|
113
129
|
:host([variant="primary"]) a:disabled {
|
|
114
130
|
background: var(--action-primary-background-disabled);
|
|
115
131
|
color: var(--action-primary-text-color-disabled);
|
|
116
|
-
border: var(--action-primary-
|
|
132
|
+
border: var(--action-primary-border-disabled);
|
|
117
133
|
cursor: not-allowed;
|
|
118
134
|
}
|
|
119
135
|
|
|
@@ -127,25 +143,25 @@ class u extends HTMLElement {
|
|
|
127
143
|
:host([variant="secondary"]) a {
|
|
128
144
|
background: var(--action-secondary-background);
|
|
129
145
|
color: var(--action-secondary-text-color);
|
|
130
|
-
border: var(--action-secondary-
|
|
146
|
+
border: var(--action-secondary-border);
|
|
131
147
|
}
|
|
132
148
|
|
|
133
149
|
:host([variant="secondary"]) a:hover {
|
|
134
150
|
background: var(--action-secondary-background-hover);
|
|
135
151
|
color: var(--action-secondary-text-color-hover);
|
|
136
|
-
border: var(--action-secondary-
|
|
152
|
+
border: var(--action-secondary-border-hover);
|
|
137
153
|
}
|
|
138
154
|
|
|
139
155
|
:host([variant="secondary"]) a:focus-visible {
|
|
140
156
|
background: var(--action-secondary-background-focus);
|
|
141
157
|
color: var(--action-secondary-text-color-focus);
|
|
142
|
-
border: var(--action-secondary-
|
|
158
|
+
border: var(--action-secondary-border-focus);
|
|
143
159
|
}
|
|
144
160
|
|
|
145
161
|
:host([variant="secondary"]) a:disabled {
|
|
146
162
|
background: var(--action-secondary-background-disabled);
|
|
147
163
|
color: var(--action-secondary-text-color-disabled);
|
|
148
|
-
border: var(--action-secondary-
|
|
164
|
+
border: var(--action-secondary-border-disabled);
|
|
149
165
|
cursor: not-allowed;
|
|
150
166
|
}
|
|
151
167
|
|
|
@@ -159,25 +175,25 @@ class u extends HTMLElement {
|
|
|
159
175
|
:host([variant="tertiary"]) a {
|
|
160
176
|
background: var(--action-tertiary-background);
|
|
161
177
|
color: var(--action-tertiary-text-color);
|
|
162
|
-
border: var(--action-tertiary-
|
|
178
|
+
border: var(--action-tertiary-border);
|
|
163
179
|
}
|
|
164
180
|
|
|
165
181
|
:host([variant="tertiary"]) a:hover {
|
|
166
182
|
color: var(--action-tertiary-text-color-hover);
|
|
167
183
|
background: var(--action-tertiary-background-hover);
|
|
168
|
-
border: var(--action-tertiary-
|
|
184
|
+
border: var(--action-tertiary-border-hover);
|
|
169
185
|
}
|
|
170
186
|
|
|
171
187
|
:host([variant="tertiary"]) a:focus-visible {
|
|
172
188
|
color: var(--action-tertiary-text-color-focus);
|
|
173
189
|
background: var(--action-tertiary-background-focus);
|
|
174
|
-
border: var(--action-tertiary-
|
|
190
|
+
border: var(--action-tertiary-border-focus);
|
|
175
191
|
}
|
|
176
192
|
|
|
177
193
|
:host([variant="tertiary"]) a:disabled {
|
|
178
194
|
background: var(--action-tertiary-background-disabled);
|
|
179
195
|
color: var(--action-tertiary-text-color-disabled);
|
|
180
|
-
border: var(--action-tertiary-
|
|
196
|
+
border: var(--action-tertiary-border-disabled);
|
|
181
197
|
cursor: not-allowed;
|
|
182
198
|
}
|
|
183
199
|
|
|
@@ -191,25 +207,25 @@ class u extends HTMLElement {
|
|
|
191
207
|
:host([variant="attention"]) a {
|
|
192
208
|
background: var(--action-attention-background);
|
|
193
209
|
color: var(--action-attention-text-color);
|
|
194
|
-
border: var(--action-attention-
|
|
210
|
+
border: var(--action-attention-border);
|
|
195
211
|
}
|
|
196
212
|
|
|
197
213
|
:host([variant="attention"]) a:hover {
|
|
198
214
|
background: var(--action-attention-background-hover);
|
|
199
215
|
color: var(--action-attention-text-color-hover);
|
|
200
|
-
border: var(--action-attention-
|
|
216
|
+
border: var(--action-attention-border-hover);
|
|
201
217
|
}
|
|
202
218
|
|
|
203
219
|
:host([variant="attention"]) a:focus-visible {
|
|
204
220
|
background: var(--action-attention-background-focus);
|
|
205
221
|
color: var(--action-attention-text-color-focus);
|
|
206
|
-
border: var(--action-attention-
|
|
222
|
+
border: var(--action-attention-border-focus);
|
|
207
223
|
}
|
|
208
224
|
|
|
209
225
|
:host([variant="attention"]) a:disabled {
|
|
210
226
|
background: var(--action-attention-background-disabled);
|
|
211
227
|
color: var(--action-attention-text-color-disabled);
|
|
212
|
-
border: var(--action-attention-
|
|
228
|
+
border: var(--action-attention-border-disabled);
|
|
213
229
|
cursor: not-allowed;
|
|
214
230
|
}
|
|
215
231
|
|
|
@@ -294,26 +310,22 @@ class u extends HTMLElement {
|
|
|
294
310
|
}
|
|
295
311
|
|
|
296
312
|
:host(.has-after.has-before[variant]) a {
|
|
297
|
-
padding-right: var(--
|
|
298
|
-
padding-left: var(--
|
|
313
|
+
padding-right: var(--action-after-slot-padding);
|
|
314
|
+
padding-left: var(--action-before-slot-padding);
|
|
299
315
|
}
|
|
300
316
|
|
|
301
317
|
:host(.has-after[variant]) a {
|
|
302
|
-
padding-right: var(--
|
|
303
|
-
padding-left: var(--space-400);
|
|
318
|
+
padding-right: var(--action-after-slot-padding);
|
|
304
319
|
}
|
|
305
320
|
|
|
306
321
|
:host(.has-before[variant]) a {
|
|
307
|
-
padding-
|
|
308
|
-
padding-left: var(--space-300);
|
|
322
|
+
padding-left: var(--action-before-slot-padding);
|
|
309
323
|
}
|
|
310
324
|
|
|
311
|
-
|
|
312
|
-
|
|
313
325
|
</style>
|
|
314
326
|
|
|
315
327
|
<a
|
|
316
|
-
part="${
|
|
328
|
+
part="${t}"
|
|
317
329
|
target="${this.getAttribute("target") || "_self"}"
|
|
318
330
|
href="${this.getAttribute("href") || "#"}"
|
|
319
331
|
>
|
|
@@ -321,33 +333,16 @@ class u extends HTMLElement {
|
|
|
321
333
|
<slot></slot>
|
|
322
334
|
<slot name="after"></slot>
|
|
323
335
|
</a>
|
|
324
|
-
|
|
325
|
-
);
|
|
326
|
-
this.shadowRoot.innerHTML = o, await customElements.whenDefined("mui-link"), requestAnimationFrame(() => {
|
|
327
|
-
const i = this.shadowRoot;
|
|
328
|
-
if (!i) return;
|
|
329
|
-
const n = i.querySelector("slot:not([name]"), l = i.querySelector('slot[name="before"]'), d = i.querySelector('slot[name="after"]'), c = (t) => t ? t.assignedNodes({ flatten: !0 }).some((a) => {
|
|
330
|
-
var e;
|
|
331
|
-
return a.nodeType === Node.ELEMENT_NODE || a.nodeType === Node.TEXT_NODE && !!((e = a.textContent) != null && e.trim());
|
|
332
|
-
}) : !1, v = c(l), h = c(d);
|
|
333
|
-
this.classList.toggle("has-before", v), this.classList.toggle("has-after", h), ((n == null ? void 0 : n.assignedNodes({ flatten: !0 })) ?? []).every((t) => {
|
|
334
|
-
var a;
|
|
335
|
-
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
336
|
-
const e = t;
|
|
337
|
-
return e.tagName.toLowerCase() === "svg" || e.classList.contains("mui-icon");
|
|
338
|
-
}
|
|
339
|
-
return t.nodeType === Node.TEXT_NODE && !((a = t.textContent) != null && a.trim());
|
|
340
|
-
}) ? this.setAttribute("icon-only", "") : this.removeAttribute("icon-only");
|
|
341
|
-
});
|
|
336
|
+
`;
|
|
342
337
|
}
|
|
343
338
|
waitForPartMap() {
|
|
344
|
-
return new Promise((
|
|
345
|
-
if (typeof
|
|
346
|
-
const
|
|
347
|
-
typeof
|
|
339
|
+
return new Promise((t) => {
|
|
340
|
+
if (typeof e == "function") return t();
|
|
341
|
+
const a = () => {
|
|
342
|
+
typeof e == "function" ? t() : requestAnimationFrame(a);
|
|
348
343
|
};
|
|
349
|
-
|
|
344
|
+
a();
|
|
350
345
|
});
|
|
351
346
|
}
|
|
352
347
|
}
|
|
353
|
-
customElements.define("mui-link", u);
|
|
348
|
+
customElements.get("mui-link") || customElements.define("mui-link", u);
|
|
@@ -3,7 +3,10 @@ class e extends HTMLElement {
|
|
|
3
3
|
return ["variant", "size", "weight"];
|
|
4
4
|
}
|
|
5
5
|
constructor() {
|
|
6
|
-
super(), this.attachShadow({ mode: "open" })
|
|
6
|
+
super(), this.attachShadow({ mode: "open" });
|
|
7
|
+
}
|
|
8
|
+
connectedCallback() {
|
|
9
|
+
this.setAttribute("role", "listitem"), this.hasAttribute("size") || this.setAttribute("size", "medium"), this.hasAttribute("weight") || this.setAttribute("weight", "regular"), this.hasAttribute("variant") || this.setAttribute("variant", "default"), this.render();
|
|
7
10
|
}
|
|
8
11
|
attributeChangedCallback() {
|
|
9
12
|
this.render();
|
|
@@ -62,4 +65,4 @@ class e extends HTMLElement {
|
|
|
62
65
|
`);
|
|
63
66
|
}
|
|
64
67
|
}
|
|
65
|
-
customElements.define("mui-list-item", e);
|
|
68
|
+
customElements.get("mui-list-item") || customElements.define("mui-list-item", e);
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import "../mui-stack/hstack/index.js";
|
|
2
|
+
import "../mui-stack/vstack/index.js";
|
|
3
|
+
import "../mui-icons/message/index.js";
|
|
4
|
+
import "../mui-icons/check/index.js";
|
|
5
|
+
import "../mui-icons/info/index.js";
|
|
6
|
+
import "../mui-icons/warning/index.js";
|
|
7
|
+
import "../mui-icons/attention/index.js";
|
|
8
|
+
const l = ["neutral", "positive", "info", "warning", "attention"], g = {
|
|
2
9
|
neutral: "background-color: var(--feedback-neutral-background); border: var(--feedback-neutral-border);",
|
|
3
10
|
positive: "background-color: var(--feedback-positive-background); border: var(--feedback-positive-border);",
|
|
4
11
|
info: "background-color: var(--feedback-info-background); border: var(--feedback-info-border);",
|
|
5
12
|
warning: "background-color: var(--feedback-warning-background); border: var(--feedback-warning-border);",
|
|
6
13
|
attention: "background-color: var(--feedback-attention-background); border: var(--feedback-attention-border);"
|
|
7
|
-
},
|
|
14
|
+
}, b = {
|
|
8
15
|
neutral: "polite",
|
|
9
16
|
positive: "polite",
|
|
10
17
|
info: "polite",
|
|
@@ -35,12 +42,12 @@ const l = ["neutral", "positive", "info", "warning", "attention"], b = {
|
|
|
35
42
|
warning: "mui-icon-warning",
|
|
36
43
|
attention: "mui-icon-attention"
|
|
37
44
|
};
|
|
38
|
-
class
|
|
45
|
+
class m extends HTMLElement {
|
|
39
46
|
constructor() {
|
|
40
47
|
super(), this.attachShadow({ mode: "open" });
|
|
41
48
|
}
|
|
42
49
|
connectedCallback() {
|
|
43
|
-
const
|
|
50
|
+
const t = this.getAttribute("variant") || "neutral", e = l.includes(t) ? t : "neutral", a = this.getAttribute("heading") || "Heading...", o = this.getAttribute("icon") || k[e], n = v[e], i = f[e], r = g[e], s = b[e], c = u[e], d = (
|
|
44
51
|
/*css*/
|
|
45
52
|
`
|
|
46
53
|
:host {
|
|
@@ -77,14 +84,12 @@ class p extends HTMLElement {
|
|
|
77
84
|
<${o} color="var(${n})"></${o}>
|
|
78
85
|
</div>
|
|
79
86
|
<mui-v-stack space="var(--message-gap-vertical)">
|
|
80
|
-
<div class="heading" id="message-heading">${
|
|
81
|
-
<slot>
|
|
82
|
-
<mui-body>Body content...</mui-body>
|
|
83
|
-
</slot>
|
|
87
|
+
<div class="heading" id="message-heading">${a}</div>
|
|
88
|
+
<slot></slot>
|
|
84
89
|
</mui-v-stack>
|
|
85
90
|
</mui-h-stack>
|
|
86
91
|
</section>
|
|
87
92
|
`);
|
|
88
93
|
}
|
|
89
94
|
}
|
|
90
|
-
customElements.define("mui-message",
|
|
95
|
+
customElements.get("mui-message") || customElements.define("mui-message", m);
|
|
@@ -5,9 +5,9 @@ class r extends HTMLElement {
|
|
|
5
5
|
constructor() {
|
|
6
6
|
super();
|
|
7
7
|
const i = this.attachShadow({ mode: "open" });
|
|
8
|
-
let
|
|
9
|
-
this.setAttribute("role", "presentation"), this.setAttribute("direction", this.getAttribute("direction") ||
|
|
10
|
-
const
|
|
8
|
+
let s = "horizontal", t = "100%", e = "1px";
|
|
9
|
+
this.setAttribute("role", "presentation"), this.setAttribute("direction", this.getAttribute("direction") || s), this.setAttribute("length", this.getAttribute("length") || t), this.setAttribute("weight", this.getAttribute("weight") || e);
|
|
10
|
+
const h = (
|
|
11
11
|
/*css*/
|
|
12
12
|
`
|
|
13
13
|
:host {
|
|
@@ -25,8 +25,8 @@ class r extends HTMLElement {
|
|
|
25
25
|
`
|
|
26
26
|
);
|
|
27
27
|
i.innerHTML = `
|
|
28
|
-
<style>${
|
|
28
|
+
<style>${h}</style>
|
|
29
29
|
`;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
customElements.define("mui-rule", r);
|
|
32
|
+
customElements.get("mui-rule") || customElements.define("mui-rule", r);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { getPartMap as
|
|
2
|
-
|
|
1
|
+
import { getPartMap as s } from "../../utils/part-map/index.js";
|
|
2
|
+
import "../mui-icons/down-chevron/index.js";
|
|
3
|
+
class p extends HTMLElement {
|
|
3
4
|
constructor() {
|
|
4
5
|
super(), this.partMap = "", this.attachShadow({ mode: "open" });
|
|
5
6
|
}
|
|
@@ -7,23 +8,23 @@ class f extends HTMLElement {
|
|
|
7
8
|
return ["name", "value", "id", "label", "options", "disabled", "hide-label", "variant"];
|
|
8
9
|
}
|
|
9
10
|
async connectedCallback() {
|
|
10
|
-
await this.waitForPartMap(), this.partMap =
|
|
11
|
+
await this.waitForPartMap(), this.partMap = s("text", "visual"), this.render(), this.setupListener();
|
|
11
12
|
}
|
|
12
|
-
attributeChangedCallback(e,
|
|
13
|
+
attributeChangedCallback(e, r) {
|
|
13
14
|
if (!this.shadowRoot) return;
|
|
14
|
-
const
|
|
15
|
+
const o = (
|
|
15
16
|
/** @type {HTMLSelectElement | null} */
|
|
16
17
|
this.shadowRoot.querySelector("select")
|
|
17
18
|
);
|
|
18
|
-
e === "value" &&
|
|
19
|
+
e === "value" && o && (o.value = r || ""), e === "disabled" && o && (r === null || r === "false" ? o.removeAttribute("disabled") : o.setAttribute("disabled", "")), ["options", "label", "hide-label"].includes(e) && (this.render(), this.setupListener());
|
|
19
20
|
}
|
|
20
21
|
setupListener() {
|
|
21
22
|
if (!this.shadowRoot) return;
|
|
22
23
|
const e = this.shadowRoot.querySelector("select");
|
|
23
24
|
if (e) {
|
|
24
|
-
const
|
|
25
|
-
e.parentNode && e.parentNode.replaceChild(
|
|
26
|
-
const a =
|
|
25
|
+
const r = e.cloneNode(!0);
|
|
26
|
+
e.parentNode && e.parentNode.replaceChild(r, e), r.addEventListener("change", (o) => {
|
|
27
|
+
const a = o.target;
|
|
27
28
|
a && this.dispatchEvent(
|
|
28
29
|
new CustomEvent("change", {
|
|
29
30
|
detail: { value: a.value },
|
|
@@ -36,20 +37,14 @@ class f extends HTMLElement {
|
|
|
36
37
|
}
|
|
37
38
|
render() {
|
|
38
39
|
if (!this.shadowRoot) return;
|
|
39
|
-
const e = this.getAttribute("name") || "",
|
|
40
|
-
s && !r && console.warn(
|
|
41
|
-
"mui-select Accessibility warning: When using 'hide-label', please provide a 'label' attribute so an 'aria-label' can be generated for screen reader support."
|
|
42
|
-
), !r && !b && console.warn(
|
|
43
|
-
"mui-select Accessibility warning: A 'label' or 'aria-label' attribute is required for screen reader accessibility."
|
|
44
|
-
);
|
|
45
|
-
const u = s && r ? `aria-label="${r}"` : "";
|
|
40
|
+
const e = this.getAttribute("name") || "", r = this.getAttribute("id") || `mui-select-${Math.random().toString(36).substr(2, 9)}`, o = this.getAttribute("label") || "", a = this.getAttribute("value") || "", i = this.hasAttribute("hide-label"), c = this.hasAttribute("disabled"), d = this.getAttribute("options") || "[]", l = this.getAttribute("variant") || "", h = l || "", b = i && o ? `aria-label="${o}"` : "";
|
|
46
41
|
let n = [];
|
|
47
42
|
try {
|
|
48
43
|
n = JSON.parse(d);
|
|
49
44
|
} catch (t) {
|
|
50
45
|
console.error("Invalid JSON in options attribute", t);
|
|
51
46
|
}
|
|
52
|
-
const
|
|
47
|
+
const u = n.map((t) => `<option value="${t.value}" ${t.value === a ? "selected" : ""}>${t.label}</option>`).join(""), v = (
|
|
53
48
|
/*html*/
|
|
54
49
|
`
|
|
55
50
|
<style>
|
|
@@ -143,6 +138,12 @@ class f extends HTMLElement {
|
|
|
143
138
|
pointer-events: none;
|
|
144
139
|
}
|
|
145
140
|
|
|
141
|
+
select:disabled + .chevron {
|
|
142
|
+
background: transparent;
|
|
143
|
+
box-shadow: none;
|
|
144
|
+
opacity: 0.4;
|
|
145
|
+
}
|
|
146
|
+
|
|
146
147
|
/* ========================================================================== */
|
|
147
148
|
/* STYLE ADJUSTMENTS WHEN SELECT IS SLOTTED WITHIN INPUT */
|
|
148
149
|
/* Related styles unique to this usage is found in the mui-input/index.js */
|
|
@@ -178,29 +179,29 @@ class f extends HTMLElement {
|
|
|
178
179
|
/* ========================================================================== */
|
|
179
180
|
|
|
180
181
|
</style>
|
|
181
|
-
${
|
|
182
|
+
${o ? (
|
|
182
183
|
/*html*/
|
|
183
|
-
`<label for="${
|
|
184
|
+
`<label for="${r}" class="${i ? "vh" : ""}">${o}</label>`
|
|
184
185
|
) : ""}
|
|
185
186
|
<div style="position: relative;">
|
|
186
|
-
<select class="${h}" part="${this.partMap || ""}" name="${e}" id="${
|
|
187
|
+
<select class="${h}" part="${this.partMap || ""}" name="${e}" id="${r}" ${b}
|
|
187
188
|
${c ? "disabled" : ""}>
|
|
188
|
-
${
|
|
189
|
+
${u}
|
|
189
190
|
</select>
|
|
190
191
|
<mui-icon-down-chevron class="chevron" size="x-small"></mui-icon-down-chevron>
|
|
191
192
|
</div>
|
|
192
193
|
`
|
|
193
194
|
);
|
|
194
|
-
this.shadowRoot.innerHTML =
|
|
195
|
+
this.shadowRoot.innerHTML = v;
|
|
195
196
|
}
|
|
196
197
|
waitForPartMap() {
|
|
197
198
|
return new Promise((e) => {
|
|
198
|
-
if (typeof
|
|
199
|
-
const
|
|
200
|
-
typeof
|
|
199
|
+
if (typeof s == "function") return e();
|
|
200
|
+
const r = () => {
|
|
201
|
+
typeof s == "function" ? e() : requestAnimationFrame(r);
|
|
201
202
|
};
|
|
202
|
-
|
|
203
|
+
r();
|
|
203
204
|
});
|
|
204
205
|
}
|
|
205
206
|
}
|
|
206
|
-
customElements.define("mui-select",
|
|
207
|
+
customElements.get("mui-select") || customElements.define("mui-select", p);
|