@muibook/components 1.5.0 → 1.6.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.
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import "../../mui-icons/down-chevron/index.js";
|
|
2
2
|
import "../../mui-heading/index.js";
|
|
3
|
-
class
|
|
3
|
+
class c extends HTMLElement {
|
|
4
4
|
constructor() {
|
|
5
5
|
super(), this.summaryEl = null, this.detailEl = null, this.chevronEl = null, this.attachShadow({ mode: "open" }), this.accordionId = `accordion-detail-${Math.random().toString(36).substring(2, 9)}`;
|
|
6
6
|
}
|
|
7
7
|
connectedCallback() {
|
|
8
|
-
var o,
|
|
8
|
+
var o, r;
|
|
9
9
|
if (customElements.get("mui-icon-right-chevron") || console.warn(
|
|
10
10
|
"mui-accordion-block requires <mui-icon-right-chevron> to be defined. Please ensure it is imported and registered."
|
|
11
11
|
), customElements.get("mui-heading") || console.warn(
|
|
12
12
|
"[mui-accordion-block] Warning: <mui-heading> is not registered. Please import it to ensure proper functionality."
|
|
13
13
|
), !this.shadowRoot) return;
|
|
14
|
-
const i = this.getAttribute("heading") || "Heading...", e = this.getAttribute("size") || "medium",
|
|
15
|
-
let
|
|
14
|
+
const i = this.getAttribute("heading") || "Heading...", e = this.getAttribute("size") || "medium", s = this.getAttribute("level") || "3", a = this.getAttribute("detail-space"), n = a ? `detail-space-${a}` : "";
|
|
15
|
+
let d = (
|
|
16
16
|
/*html*/
|
|
17
17
|
`
|
|
18
18
|
<style>
|
|
@@ -94,6 +94,10 @@ class s extends HTMLElement {
|
|
|
94
94
|
padding: var(--space-600);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
.detail-space-none {
|
|
98
|
+
padding: 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
97
101
|
:host([first-child]) .accordion-summary {
|
|
98
102
|
border-top: none;
|
|
99
103
|
}
|
|
@@ -129,25 +133,25 @@ class s extends HTMLElement {
|
|
|
129
133
|
aria-expanded="false"
|
|
130
134
|
aria-controls="${this.accordionId}"
|
|
131
135
|
>
|
|
132
|
-
<mui-heading size="6" level="${
|
|
136
|
+
<mui-heading size="6" level="${s}">${i}</mui-heading>
|
|
133
137
|
<div class="icon">
|
|
134
138
|
<mui-icon-down-chevron size="x-small"></mui-icon-down-chevron>
|
|
135
139
|
</div>
|
|
136
140
|
</div>
|
|
137
141
|
|
|
138
142
|
<div id="${this.accordionId}" class="accordion-detail">
|
|
139
|
-
<div class="accordion-detail-inner size-${e}-detail" inert>
|
|
143
|
+
<div class="accordion-detail-inner size-${e}-detail ${n}" inert>
|
|
140
144
|
<slot name="detail">Insert Content</slot>
|
|
141
145
|
</div>
|
|
142
146
|
</div>
|
|
143
147
|
|
|
144
148
|
`
|
|
145
149
|
);
|
|
146
|
-
if (this.shadowRoot.innerHTML =
|
|
150
|
+
if (this.shadowRoot.innerHTML = d, this.summaryEl = this.shadowRoot.querySelector(".accordion-summary"), this.detailEl = this.shadowRoot.querySelector(".accordion-detail"), this.chevronEl = this.shadowRoot.querySelector("mui-icon-down-chevron"), !this.summaryEl || !this.detailEl || !this.chevronEl) {
|
|
147
151
|
console.error("Accordion elements not found");
|
|
148
152
|
return;
|
|
149
153
|
}
|
|
150
|
-
(o = this.summaryEl) == null || o.addEventListener("click", () => this.toggleAccordion()), (
|
|
154
|
+
(o = this.summaryEl) == null || o.addEventListener("click", () => this.toggleAccordion()), (r = this.summaryEl) == null || r.addEventListener("keydown", (t) => {
|
|
151
155
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.toggleAccordion());
|
|
152
156
|
});
|
|
153
157
|
}
|
|
@@ -165,4 +169,4 @@ class s extends HTMLElement {
|
|
|
165
169
|
this.setOpen(!1);
|
|
166
170
|
}
|
|
167
171
|
}
|
|
168
|
-
customElements.define("mui-accordion-block",
|
|
172
|
+
customElements.define("mui-accordion-block", c);
|
|
@@ -16,17 +16,19 @@ class v extends HTMLElement {
|
|
|
16
16
|
|
|
17
17
|
:host {
|
|
18
18
|
display: inline-block;
|
|
19
|
+
width: auto;
|
|
20
|
+
text-align: center;
|
|
19
21
|
}
|
|
20
22
|
button {
|
|
21
23
|
vertical-align: baseline;
|
|
22
24
|
border: none;
|
|
23
25
|
cursor: pointer;
|
|
24
|
-
width:
|
|
26
|
+
width: 100%;
|
|
25
27
|
border-radius: var(--action-radius);
|
|
26
28
|
padding: var(--action-padding);
|
|
27
29
|
text-decoration: none;
|
|
28
30
|
line-height: var(--action-line-height);
|
|
29
|
-
display:
|
|
31
|
+
display: inherit;
|
|
30
32
|
text-transform: none;
|
|
31
33
|
overflow: visible;
|
|
32
34
|
-webkit-appearance: button;
|
|
@@ -35,7 +37,8 @@ class v extends HTMLElement {
|
|
|
35
37
|
font-weight: var(--action-font-weight);
|
|
36
38
|
background: var(--action-primary-background);
|
|
37
39
|
color: var(--action-primary-text-color);
|
|
38
|
-
border: var(--action-primary-stroke);
|
|
40
|
+
border: var(--action-primary-stroke);
|
|
41
|
+
text-align: inherit;
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
// Turned back on for focus-visible
|
|
@@ -16,7 +16,7 @@ class u extends HTMLElement {
|
|
|
16
16
|
`
|
|
17
17
|
<style>
|
|
18
18
|
|
|
19
|
-
:host { display: inline-flex; }
|
|
19
|
+
:host { display: inline-flex; width: auto; text-align: initial }
|
|
20
20
|
|
|
21
21
|
a {
|
|
22
22
|
color: var(--link-text-color-default);
|
|
@@ -27,6 +27,8 @@ class u extends HTMLElement {
|
|
|
27
27
|
text-decoration: underline;
|
|
28
28
|
text-underline-offset: var(--space-050);
|
|
29
29
|
text-decoration-color: color-mix(in srgb, var(--text-color) 50%, transparent);
|
|
30
|
+
width: inherit;
|
|
31
|
+
display: inherit;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
/* Turned back on for focus-visible */
|
|
@@ -65,11 +67,18 @@ class u extends HTMLElement {
|
|
|
65
67
|
/* Button
|
|
66
68
|
========================================= */
|
|
67
69
|
|
|
70
|
+
:host([variant="primary"]),
|
|
71
|
+
:host([variant="secondary"]),
|
|
72
|
+
:host([variant="tertiary"]),
|
|
73
|
+
:host([variant="attention"]) { display: inline-block; text-align: center; }
|
|
74
|
+
|
|
68
75
|
:host([variant="primary"]) a,
|
|
69
76
|
:host([variant="secondary"]) a,
|
|
70
77
|
:host([variant="tertiary"]) a,
|
|
71
78
|
:host([variant="attention"]) a {
|
|
72
|
-
display:
|
|
79
|
+
display: inherit;
|
|
80
|
+
text-align: inherit;
|
|
81
|
+
width: 100%;
|
|
73
82
|
text-decoration: none;
|
|
74
83
|
padding: var(--space-200) var(--space-500);
|
|
75
84
|
border-radius: var(--action-radius);
|
|
@@ -78,10 +87,7 @@ class u extends HTMLElement {
|
|
|
78
87
|
line-height: var(--action-line-height);
|
|
79
88
|
}
|
|
80
89
|
|
|
81
|
-
|
|
82
|
-
:host([variant="secondary"])
|
|
83
|
-
:host([variant="tertiary"]),
|
|
84
|
-
:host([variant="attention"]) { display: inline-block; }
|
|
90
|
+
|
|
85
91
|
|
|
86
92
|
/* Button Primary
|
|
87
93
|
========================================= */
|