@muibook/components 2.0.0 → 3.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.
Files changed (97) hide show
  1. package/dist/esm/agent/keywords/index.js +104 -4
  2. package/dist/esm/agent/prompts/index.js +518 -162
  3. package/dist/esm/components/mui-accordion/block/index.js +2 -6
  4. package/dist/esm/components/mui-accordion/group/index.js +1 -1
  5. package/dist/esm/components/mui-accordion/inline/index.js +2 -6
  6. package/dist/esm/components/mui-addon/index.js +1 -1
  7. package/dist/esm/components/mui-alert/index.js +10 -5
  8. package/dist/esm/components/mui-badge/index.js +4 -4
  9. package/dist/esm/components/mui-body/index.js +4 -4
  10. package/dist/esm/components/mui-button/index.js +5 -7
  11. package/dist/esm/components/mui-button-group/index.js +1 -1
  12. package/dist/esm/components/mui-card/body/index.js +22 -18
  13. package/dist/esm/components/mui-card/card/index.js +1 -1
  14. package/dist/esm/components/mui-card/footer/index.js +1 -1
  15. package/dist/esm/components/mui-card/header/index.js +1 -1
  16. package/dist/esm/components/mui-carousel/controller/index.js +1 -1
  17. package/dist/esm/components/mui-carousel/panel/index.js +2 -2
  18. package/dist/esm/components/mui-checkbox/index.js +186 -0
  19. package/dist/esm/components/mui-code/index.js +9 -6
  20. package/dist/esm/components/mui-container/index.js +1 -1
  21. package/dist/esm/components/mui-field/index.js +14 -7
  22. package/dist/esm/components/mui-file-upload/index.js +5 -4
  23. package/dist/esm/components/mui-grid/index.js +1 -1
  24. package/dist/esm/components/mui-heading/index.js +1 -1
  25. package/dist/esm/components/mui-icons/accessibility/index.js +4 -4
  26. package/dist/esm/components/mui-icons/add/index.js +5 -5
  27. package/dist/esm/components/mui-icons/attention/index.js +5 -5
  28. package/dist/esm/components/mui-icons/check/index.js +6 -6
  29. package/dist/esm/components/mui-icons/close/index.js +2 -2
  30. package/dist/esm/components/mui-icons/down-arrow-circle/index.js +55 -0
  31. package/dist/esm/components/mui-icons/down-chevron/index.js +2 -2
  32. package/dist/esm/components/mui-icons/ellipsis/index.js +55 -0
  33. package/dist/esm/components/mui-icons/globe/index.js +5 -5
  34. package/dist/esm/components/mui-icons/grid/index.js +1 -1
  35. package/dist/esm/components/mui-icons/index.js +2 -0
  36. package/dist/esm/components/mui-icons/info/index.js +2 -2
  37. package/dist/esm/components/mui-icons/left-arrow/index.js +1 -1
  38. package/dist/esm/components/mui-icons/left-chevron/index.js +1 -1
  39. package/dist/esm/components/mui-icons/left-sidebar/index.js +6 -6
  40. package/dist/esm/components/mui-icons/menu/index.js +6 -6
  41. package/dist/esm/components/mui-icons/message/index.js +6 -6
  42. package/dist/esm/components/mui-icons/moon/index.js +2 -2
  43. package/dist/esm/components/mui-icons/notification/index.js +2 -2
  44. package/dist/esm/components/mui-icons/right-chevron/index.js +5 -5
  45. package/dist/esm/components/mui-icons/stop/index.js +2 -2
  46. package/dist/esm/components/mui-icons/subtract/index.js +7 -7
  47. package/dist/esm/components/mui-icons/sun/index.js +6 -6
  48. package/dist/esm/components/mui-icons/toggle/index.js +1 -1
  49. package/dist/esm/components/mui-icons/up-arrow/index.js +4 -4
  50. package/dist/esm/components/mui-icons/up-chevron/index.js +1 -1
  51. package/dist/esm/components/mui-icons/warning/index.js +2 -2
  52. package/dist/esm/components/mui-image/index.js +1 -1
  53. package/dist/esm/components/mui-input/index.js +21 -27
  54. package/dist/esm/components/mui-link/index.js +13 -17
  55. package/dist/esm/components/mui-list/item/index.js +1 -1
  56. package/dist/esm/components/mui-list/list/index.js +1 -1
  57. package/dist/esm/components/mui-message/index.js +14 -9
  58. package/dist/esm/components/mui-quote/index.js +1 -1
  59. package/dist/esm/components/mui-responsive/index.js +1 -1
  60. package/dist/esm/components/mui-rule/index.js +5 -5
  61. package/dist/esm/components/mui-select/index.js +28 -27
  62. package/dist/esm/components/mui-slat/accessory/index.js +29 -0
  63. package/dist/esm/components/mui-slat/index.js +2 -21
  64. package/dist/esm/components/mui-slat/slat/index.js +139 -0
  65. package/dist/esm/components/mui-smart-card/index.js +14 -15
  66. package/dist/esm/components/mui-stack/hstack/index.js +1 -1
  67. package/dist/esm/components/mui-stack/vstack/index.js +1 -1
  68. package/dist/esm/components/mui-switch/index.js +3 -9
  69. package/dist/esm/components/mui-table/cell/index.js +1 -1
  70. package/dist/esm/components/mui-table/row/index.js +1 -1
  71. package/dist/esm/components/mui-table/row-group/index.js +1 -1
  72. package/dist/esm/components/mui-table/table/index.js +1 -1
  73. package/dist/esm/components/mui-tabs/controller/index.js +1 -1
  74. package/dist/esm/components/mui-tabs/item/index.js +2 -2
  75. package/dist/esm/components/mui-tabs/panel/index.js +1 -1
  76. package/dist/esm/components/mui-tabs/tab-bar/index.js +1 -1
  77. package/dist/esm/css/mui-base.css +27 -27
  78. package/dist/esm/css/mui-tokens.css +38 -1
  79. package/dist/esm/index.js +9 -5
  80. package/dist/types/components/mui-accordion/block/index.d.ts +1 -1
  81. package/dist/types/components/mui-accordion/inline/index.d.ts +1 -1
  82. package/dist/types/components/mui-alert/index.d.ts +5 -1
  83. package/dist/types/components/mui-checkbox/index.d.ts +1 -0
  84. package/dist/types/components/mui-field/index.d.ts +3 -1
  85. package/dist/types/components/mui-file-upload/index.d.ts +1 -1
  86. package/dist/types/components/mui-icons/down-arrow-circle.d.ts +1 -0
  87. package/dist/types/components/mui-icons/ellipsis.d.ts +1 -0
  88. package/dist/types/components/mui-icons/index.d.ts +2 -0
  89. package/dist/types/components/mui-message/index.d.ts +6 -1
  90. package/dist/types/components/mui-select/index.d.ts +1 -1
  91. package/dist/types/components/mui-slat/accessory/index.d.ts +1 -0
  92. package/dist/types/components/mui-slat/index.d.ts +2 -1
  93. package/dist/types/components/mui-slat/slat/index.d.ts +3 -0
  94. package/dist/types/components/mui-smart-card/index.d.ts +2 -1
  95. package/dist/types/index.d.ts +5 -1
  96. package/package.json +21 -1
  97. package/readme.md +19 -0
@@ -8,30 +8,30 @@ class m extends HTMLElement {
8
8
  connectedCallback() {
9
9
  this.render(), this.setupListener();
10
10
  }
11
- attributeChangedCallback(e, a, t) {
11
+ attributeChangedCallback(e, s, r) {
12
12
  var o;
13
- const r = (o = this.shadowRoot) == null ? void 0 : o.querySelector("input");
14
- r && (e === "value" && (r.value = t ?? ""), e === "disabled" && (t === null || t === "false" ? r.removeAttribute("disabled") : r.setAttribute("disabled", "")), (e === "type" || e === "placeholder" || e === "label" || e === "hide-label") && (this.render(), this.setupListener()));
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 t, r;
18
- const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("input");
17
+ var r, t;
18
+ const e = (r = this.shadowRoot) == null ? void 0 : r.querySelector("input");
19
19
  if (!e) return;
20
- const a = e.cloneNode(!0);
21
- (r = e.parentNode) == null || r.replaceChild(a, e), a.addEventListener("input", (o) => {
22
- const s = o.target;
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: s.value },
25
+ detail: { value: a.value },
26
26
  bubbles: !0,
27
27
  composed: !0
28
28
  })
29
29
  );
30
- }), a.addEventListener("change", (o) => {
31
- const s = o.target;
30
+ }), s.addEventListener("change", (o) => {
31
+ const a = o.target;
32
32
  this.dispatchEvent(
33
33
  new CustomEvent("change", {
34
- detail: { value: s.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"], a = this.getAttribute("type") || "text", t = e.includes(a) ? a : "text", r = this.getAttribute("name") || "", o = this.getAttribute("value") || "", s = this.getAttribute("placeholder") || "", n = this.getAttribute("id") || `mui-input-${Math.random().toString(36).substr(2, 9)}`, i = this.getAttribute("label") || "", l = this.hasAttribute("hide-label"), u = this.hasAttribute("disabled"), d = l && i ? `aria-label="${i}"` : "", c = this.getAttribute("variant") || "", b = c || "", h = this.querySelector('[slot="before"]') !== null, p = this.querySelector('[slot="after"]') !== null, v = [b, h ? "before" : "", p ? "after" : ""].filter(Boolean).join(" ");
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="${n}" class="${l ? "vh" : ""}">${i}</label>` : ""}
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="${t}"
193
- name="${r}"
194
- id="${n}"
186
+ type="${r}"
187
+ name="${t}"
188
+ id="${l}"
195
189
  value="${o}"
196
- placeholder="${s}"
197
- ${u ? 'disabled aria-disabled="true"' : ""}
198
- ${d}
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);
@@ -10,17 +10,17 @@ class u extends HTMLElement {
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(), requestAnimationFrame(() => this.updateSlotState());
11
11
  }
12
12
  updateSlotState() {
13
- const t = this.shadowRoot, o = t.querySelector("slot:not([name])"), c = t.querySelector('slot[name="before"]'), l = t.querySelector('slot[name="after"]'), i = (a) => !!a && a.assignedNodes({ flatten: !0 }).some(
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
14
  (r) => {
15
15
  var s;
16
16
  return r.nodeType === Node.ELEMENT_NODE || r.nodeType === Node.TEXT_NODE && !!((s = r.textContent) != null && s.trim());
17
17
  }
18
18
  ), d = i(c), v = i(l);
19
19
  this.classList.toggle("has-before", d), this.classList.toggle("has-after", v);
20
- const n = (o == null ? void 0 : o.assignedNodes({ flatten: !0 })) ?? [], h = n.length > 0 && n.every(
21
- (a) => {
20
+ const n = (a == null ? void 0 : a.assignedNodes({ flatten: !0 })) ?? [], h = n.length > 0 && n.every(
21
+ (o) => {
22
22
  var r;
23
- return a.nodeType === Node.ELEMENT_NODE ? a.classList.contains("mui-icon") || a.tagName.toLowerCase() === "svg" : !((r = a.textContent) != null && r.trim());
23
+ return o.nodeType === Node.ELEMENT_NODE ? o.classList.contains("mui-icon") || o.tagName.toLowerCase() === "svg" : !((r = o.textContent) != null && r.trim());
24
24
  }
25
25
  );
26
26
  this.toggleAttribute("icon-only", h);
@@ -96,7 +96,7 @@ class u extends HTMLElement {
96
96
  text-align: inherit;
97
97
  width: 100%;
98
98
  text-decoration: none;
99
- padding: var(--space-200) var(--space-500);
99
+ padding: var(--action-padding);
100
100
  border-radius: var(--action-radius);
101
101
  font-size: var(--action-font-size);
102
102
  font-weight: var(--action-font-weight);
@@ -310,22 +310,18 @@ class u extends HTMLElement {
310
310
  }
311
311
 
312
312
  :host(.has-after.has-before[variant]) a {
313
- padding-right: var(--space-300);
314
- padding-left: var(--space-300);
313
+ padding-right: var(--action-after-slot-padding);
314
+ padding-left: var(--action-before-slot-padding);
315
315
  }
316
316
 
317
317
  :host(.has-after[variant]) a {
318
- padding-right: var(--space-300);
319
- padding-left: var(--space-400);
318
+ padding-right: var(--action-after-slot-padding);
320
319
  }
321
320
 
322
321
  :host(.has-before[variant]) a {
323
- padding-right: var(--space-400);
324
- padding-left: var(--space-300);
322
+ padding-left: var(--action-before-slot-padding);
325
323
  }
326
324
 
327
-
328
-
329
325
  </style>
330
326
 
331
327
  <a
@@ -342,11 +338,11 @@ class u extends HTMLElement {
342
338
  waitForPartMap() {
343
339
  return new Promise((t) => {
344
340
  if (typeof e == "function") return t();
345
- const o = () => {
346
- typeof e == "function" ? t() : requestAnimationFrame(o);
341
+ const a = () => {
342
+ typeof e == "function" ? t() : requestAnimationFrame(a);
347
343
  };
348
- o();
344
+ a();
349
345
  });
350
346
  }
351
347
  }
352
- customElements.define("mui-link", u);
348
+ customElements.get("mui-link") || customElements.define("mui-link", u);
@@ -65,4 +65,4 @@ class e extends HTMLElement {
65
65
  `);
66
66
  }
67
67
  }
68
- customElements.define("mui-list-item", e);
68
+ customElements.get("mui-list-item") || customElements.define("mui-list-item", e);
@@ -28,4 +28,4 @@ class t extends HTMLElement {
28
28
  `);
29
29
  }
30
30
  }
31
- customElements.define("mui-list", t);
31
+ customElements.get("mui-list") || customElements.define("mui-list", t);
@@ -1,10 +1,17 @@
1
- const l = ["neutral", "positive", "info", "warning", "attention"], b = {
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
- }, g = {
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 p extends HTMLElement {
45
+ class m extends HTMLElement {
39
46
  constructor() {
40
47
  super(), this.attachShadow({ mode: "open" });
41
48
  }
42
49
  connectedCallback() {
43
- const a = this.getAttribute("variant") || "neutral", e = l.includes(a) ? a : "neutral", t = this.getAttribute("heading") || "Heading...", o = this.getAttribute("icon") || k[e], n = v[e], i = f[e], r = b[e], s = g[e], c = u[e], d = (
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">${t}</div>
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", p);
95
+ customElements.get("mui-message") || customElements.define("mui-message", m);
@@ -23,4 +23,4 @@ class t extends HTMLElement {
23
23
  this.shadowRoot && (this.shadowRoot.innerHTML = e);
24
24
  }
25
25
  }
26
- customElements.define("mui-quote", t);
26
+ customElements.get("mui-quote") || customElements.define("mui-quote", t);
@@ -39,4 +39,4 @@ class c extends HTMLElement {
39
39
  }
40
40
  }
41
41
  }
42
- customElements.define("mui-responsive", c);
42
+ customElements.get("mui-responsive") || customElements.define("mui-responsive", c);
@@ -5,9 +5,9 @@ class r extends HTMLElement {
5
5
  constructor() {
6
6
  super();
7
7
  const i = this.attachShadow({ mode: "open" });
8
- let h = "horizontal", t = "100%", e = "1px";
9
- this.setAttribute("role", "presentation"), this.setAttribute("direction", this.getAttribute("direction") || h), this.setAttribute("length", this.getAttribute("length") || t), this.setAttribute("weight", this.getAttribute("weight") || e);
10
- const s = (
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>${s}</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 i } from "../../utils/part-map/index.js";
2
- class f extends HTMLElement {
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 = i("text", "visual"), this.render(), this.setupListener();
11
+ await this.waitForPartMap(), this.partMap = s("text", "visual"), this.render(), this.setupListener();
11
12
  }
12
- attributeChangedCallback(e, o) {
13
+ attributeChangedCallback(e, r) {
13
14
  if (!this.shadowRoot) return;
14
- const r = (
15
+ const o = (
15
16
  /** @type {HTMLSelectElement | null} */
16
17
  this.shadowRoot.querySelector("select")
17
18
  );
18
- e === "value" && r && (r.value = o || ""), e === "disabled" && r && (o === null || o === "false" ? r.removeAttribute("disabled") : r.setAttribute("disabled", "")), ["options", "label", "hide-label"].includes(e) && (this.render(), this.setupListener());
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 o = e.cloneNode(!0);
25
- e.parentNode && e.parentNode.replaceChild(o, e), o.addEventListener("change", (r) => {
26
- const a = r.target;
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") || "", o = this.getAttribute("id") || `mui-select-${Math.random().toString(36).substr(2, 9)}`, r = this.getAttribute("label") || "", a = this.getAttribute("value") || "", s = this.hasAttribute("hide-label"), c = this.hasAttribute("disabled"), d = this.getAttribute("options") || "[]", b = this.getAttribute("aria-label") || "", l = this.getAttribute("variant") || "", h = l || "";
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 v = n.map((t) => `<option value="${t.value}" ${t.value === a ? "selected" : ""}>${t.label}</option>`).join(""), p = (
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
- ${r ? (
182
+ ${o ? (
182
183
  /*html*/
183
- `<label for="${o}" class="${s ? "vh" : ""}">${r}</label>`
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="${o}" ${u}
187
+ <select class="${h}" part="${this.partMap || ""}" name="${e}" id="${r}" ${b}
187
188
  ${c ? "disabled" : ""}>
188
- ${v}
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 = p;
195
+ this.shadowRoot.innerHTML = v;
195
196
  }
196
197
  waitForPartMap() {
197
198
  return new Promise((e) => {
198
- if (typeof i == "function") return e();
199
- const o = () => {
200
- typeof i == "function" ? e() : requestAnimationFrame(o);
199
+ if (typeof s == "function") return e();
200
+ const r = () => {
201
+ typeof s == "function" ? e() : requestAnimationFrame(r);
201
202
  };
202
- o();
203
+ r();
203
204
  });
204
205
  }
205
206
  }
206
- customElements.define("mui-select", f);
207
+ customElements.get("mui-select") || customElements.define("mui-select", p);
@@ -0,0 +1,29 @@
1
+ class e extends HTMLElement {
2
+ constructor() {
3
+ super(), this.attachShadow({ mode: "open" });
4
+ }
5
+ connectedCallback() {
6
+ this.render();
7
+ }
8
+ render() {
9
+ const s = (
10
+ /*css*/
11
+ `
12
+ :host {
13
+ display: flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ background: var(--slat-accessory-background);
17
+ padding: var(--space-200);
18
+ border-radius: var(--radius-400);
19
+ }
20
+ `
21
+ );
22
+ this.shadowRoot.innerHTML = /*html*/
23
+ `
24
+ <style>${s}</style>
25
+ <slot></slot>
26
+ `;
27
+ }
28
+ }
29
+ customElements.get("mui-slat-accessory") || customElements.define("mui-slat-accessory", e);
@@ -1,21 +1,2 @@
1
- class t extends HTMLElement {
2
- constructor() {
3
- super(), this.attachShadow({ mode: "open" });
4
- }
5
- connectedCallback() {
6
- this.setAttribute("role", "table"), this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
7
- `
8
- <style>
9
- :host {
10
- display: grid;
11
- grid-template-columns: 1fr 1fr;
12
- gap: var(--space-500);
13
- box-sizing: border-box;
14
- }
15
- </style>
16
- <slot name="start"></slot>
17
- <slot name="end"></slot>
18
- `);
19
- }
20
- }
21
- customElements.define("mui-slat", t);
1
+ import "./slat/index.js";
2
+ import "./accessory/index.js";
@@ -0,0 +1,139 @@
1
+ import "../../mui-button/index.js";
2
+ import "../../mui-icons/right-chevron/index.js";
3
+ import "../../mui-stack/hstack/index.js";
4
+ import "../../mui-stack/vstack/index.js";
5
+ class i extends HTMLElement {
6
+ constructor() {
7
+ super(), this.variant = "", this.attachShadow({ mode: "open" });
8
+ }
9
+ static get observedAttributes() {
10
+ return ["variant", "col", "space"];
11
+ }
12
+ attributeChangedCallback(t, a, r) {
13
+ t === "variant" && (this.variant = r), this.render();
14
+ }
15
+ connectedCallback() {
16
+ this.variant = this.getAttribute("variant") || "", this.setAttribute("role", "row"), this.render();
17
+ }
18
+ applyCellRoles() {
19
+ var a;
20
+ const t = (a = this.shadowRoot) == null ? void 0 : a.querySelectorAll("slot");
21
+ t == null || t.forEach((r) => {
22
+ r.assignedElements({ flatten: !0 }).forEach((s) => {
23
+ s.setAttribute("role", "cell");
24
+ });
25
+ });
26
+ }
27
+ hasAccessorySlot() {
28
+ return this.querySelector('[slot="accessory"]') !== null;
29
+ }
30
+ render() {
31
+ const t = this.variant === "action", a = this.getAttribute("col") || "1fr 1fr", r = this.getAttribute("space") || "var(--space-500)", e = this.hasAccessorySlot(), s = (
32
+ /*css*/
33
+ `
34
+ :host {
35
+ display: grid;
36
+ grid-template-columns: ${a};
37
+ align-items: center;
38
+ gap: ${r};
39
+ box-sizing: border-box;
40
+ }
41
+
42
+ :host([variant="row"]) {
43
+ padding: var(--space-300) var(--space-400);
44
+ background: var(--slat-background);
45
+ border-radius: var(--slat-radius);
46
+ }
47
+
48
+ :host([variant="header"]) {
49
+ padding: var(--space-200) var(--space-400);
50
+ padding-top: var(--space-400);
51
+ }
52
+
53
+ :host([variant="action"]) {
54
+ display: grid;
55
+ grid-template-columns: 1fr;
56
+ align-items: center;
57
+ width: 100%;
58
+ }
59
+
60
+ .action::part(text-align) {
61
+ text-align: left;
62
+ }
63
+
64
+ .action:focus {
65
+ z-index: 1;
66
+ }
67
+
68
+ .action::part(padding) {
69
+ padding: var(--space-300) var(--space-400);
70
+ }
71
+
72
+ .action::part(border) {
73
+ border: var(--space-000);
74
+ }
75
+
76
+ .action::part(background) {
77
+ background: var(--slat-background);
78
+ }
79
+
80
+ .action:hover::part(background) {
81
+ background: var(--slat-background-hover);
82
+ }
83
+
84
+ .action::part(border-radius) {
85
+ border-radius: var(--slat-radius);
86
+ }
87
+
88
+ .end {
89
+ display: flex;
90
+ align-items: center;
91
+ gap: var(--space-300);
92
+ text-align: right;
93
+ }
94
+
95
+ :host(.card-slot) {
96
+ --slat-background: var(--slat-card-background);
97
+ --slat-background-hover: var(--slat-card-background-hover);
98
+ }
99
+
100
+ :host(.condensed-slot) .action::part(border-radius) {
101
+ border-radius: 0;
102
+ }
103
+
104
+ :host(.condensed-slot:last-of-type) .action::part(border-radius) {
105
+ border-bottom-left-radius: var(--card-radius);
106
+ border-bottom-right-radius: var(--card-radius);
107
+ }
108
+
109
+ `
110
+ ), o = e ? `
111
+ <mui-h-stack alignY="center" space="var(--space-400)">
112
+ <slot name="accessory"></slot>
113
+ <slot name="start"></slot>
114
+ </mui-h-stack>
115
+ ` : '<slot name="start"></slot>';
116
+ this.shadowRoot.innerHTML = t ? (
117
+ /*html*/
118
+ `
119
+ <style>${s}</style>
120
+ <mui-button variant="tertiary" class="action">
121
+ ${o}
122
+ <div class="end" slot="after">
123
+ <slot name="end"></slot>
124
+ <mui-icon-right-chevron size="x-small"></mui-icon-right-chevron>
125
+ </div>
126
+
127
+ </mui-button>
128
+ `
129
+ ) : (
130
+ /*html*/
131
+ `
132
+ <style>${s}</style>
133
+ ${o}
134
+ <slot name="end"></slot>
135
+ `
136
+ ), requestAnimationFrame(() => this.applyCellRoles());
137
+ }
138
+ }
139
+ customElements.get("mui-slat") || customElements.define("mui-slat", i);