@muibook/components 18.1.1 → 19.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.
@@ -1,19 +1,19 @@
1
1
  class u extends HTMLElement {
2
2
  constructor() {
3
- super(), this.onKeyDown = (i) => {
4
- const s = this.steps;
5
- if (!s.length) return;
6
- const e = i.key, n = this.activeStepIndex;
7
- e === "ArrowRight" || e === "ArrowDown" ? (i.preventDefault(), this.setActiveStep(n + 1, "keyboard")) : e === "ArrowLeft" || e === "ArrowUp" ? (i.preventDefault(), this.setActiveStep(n - 1, "keyboard")) : e === "Home" ? (i.preventDefault(), this.setActiveStep(0, "keyboard")) : e === "End" && (i.preventDefault(), this.setActiveStep(s.length - 1, "keyboard"));
8
- }, this.attachShadow({ mode: "open" }), this.setAttribute("direction", this.getAttribute("direction") || "horizontal"), this.setAttribute("active-step", this.getAttribute("active-step") || "1");
9
- const t = this.getAttribute("size");
10
- this.setAttribute("size", t === "x-small" || t === "small" ? t : "medium");
3
+ super(), this.onKeyDown = (t) => {
4
+ const i = this.steps;
5
+ if (!i.length) return;
6
+ const s = t.key, e = this.activeStepIndex;
7
+ s === "ArrowRight" || s === "ArrowDown" ? (t.preventDefault(), this.setActiveStep(e + 1, "keyboard")) : s === "ArrowLeft" || s === "ArrowUp" ? (t.preventDefault(), this.setActiveStep(e - 1, "keyboard")) : s === "Home" ? (t.preventDefault(), this.setActiveStep(0, "keyboard")) : s === "End" && (t.preventDefault(), this.setActiveStep(i.length - 1, "keyboard"));
8
+ }, this.attachShadow({ mode: "open" });
11
9
  }
12
10
  static get observedAttributes() {
13
11
  return ["direction", "active-step", "linear", "interactive", "size"];
14
12
  }
15
13
  connectedCallback() {
16
- this.addEventListener("keydown", this.onKeyDown), this.render();
14
+ this.hasAttribute("direction") || this.setAttribute("direction", "horizontal"), this.hasAttribute("active-step") || this.setAttribute("active-step", "1");
15
+ const t = this.getAttribute("size");
16
+ t === "x-small" || t === "small" || t === "medium" || this.setAttribute("size", "medium"), this.addEventListener("keydown", this.onKeyDown), this.render();
17
17
  }
18
18
  disconnectedCallback() {
19
19
  this.removeEventListener("keydown", this.onKeyDown);
@@ -20,8 +20,17 @@ class t extends HTMLElement {
20
20
  justify-content: space-between;
21
21
  align-self: ${this.getAttribute("align-y") || "initial"};
22
22
  text-align: left;
23
+ font-size: var(--row-cell-font-size, var(--text-font-size-m));
24
+ line-height: var(--row-cell-line-height, var(--text-line-height-m));
23
25
 
24
26
  }
27
+ .inner {
28
+ display: inherit;
29
+ width: 100%;
30
+ min-width: 0;
31
+ align-items: inherit;
32
+ justify-content: inherit;
33
+ }
25
34
  :host(*:first-of-type) {
26
35
  padding-left: var(--space-400);
27
36
  }
@@ -56,11 +65,21 @@ class t extends HTMLElement {
56
65
  text-align: center;
57
66
  }
58
67
  :host([action]) {
59
- width: 4.4rem;
60
- height: 4.4rem;
68
+ display: inline-flex;
69
+ align-items: center;
70
+ justify-content: flex-end;
71
+ }
72
+ :host([action]) .inner {
73
+ width: var(--row-action-size);
74
+ height: var(--row-action-size);
75
+ display: inline-flex;
76
+ align-items: center;
77
+ justify-content: center;
78
+ box-sizing: border-box;
79
+ margin-left: auto;
61
80
  }
62
81
  </style>
63
- <slot></slot>
82
+ <div class="inner"><slot></slot></div>
64
83
  `;
65
84
  }
66
85
  }
@@ -1,12 +1,16 @@
1
- class e extends HTMLElement {
1
+ class a extends HTMLElement {
2
2
  static get observedAttributes() {
3
- return ["columns"];
3
+ return ["columns", "size"];
4
4
  }
5
5
  constructor() {
6
6
  super(), this.attachShadow({ mode: "open" });
7
7
  }
8
8
  connectedCallback() {
9
- this.setAttribute("role", "row"), this.syncContextAttributes(), this.render();
9
+ this.setAttribute("role", "row"), this.syncContextAttributes(), this.syncActionColumnState(), this.observeTableChanges(), this.render();
10
+ }
11
+ disconnectedCallback() {
12
+ var t;
13
+ (t = this.tableObserver) == null || t.disconnect(), this.tableObserver = void 0;
10
14
  }
11
15
  attributeChangedCallback() {
12
16
  this.render();
@@ -15,6 +19,48 @@ class e extends HTMLElement {
15
19
  const t = !!this.closest("mui-card");
16
20
  this.toggleAttribute("in-card", t);
17
21
  }
22
+ observeTableChanges() {
23
+ var e;
24
+ const t = this.closest("mui-table");
25
+ t && ((e = this.tableObserver) == null || e.disconnect(), this.tableObserver = new MutationObserver(() => {
26
+ this.syncActionColumnState();
27
+ }), this.tableObserver.observe(t, {
28
+ subtree: !0,
29
+ childList: !0,
30
+ attributes: !0,
31
+ attributeFilter: ["action"],
32
+ characterData: !0
33
+ }));
34
+ }
35
+ clearActionPlaceholderStyles(t) {
36
+ const e = t;
37
+ e.style.removeProperty("width"), e.style.removeProperty("height"), e.style.removeProperty("display"), e.style.removeProperty("align-items"), e.style.removeProperty("justify-content");
38
+ }
39
+ syncActionColumnState() {
40
+ const t = this.closest("mui-table");
41
+ if (!t) return;
42
+ const e = !!t.querySelector("mui-cell[action]");
43
+ this.toggleAttribute("has-action-column", e);
44
+ const o = Array.from(this.children).filter(
45
+ (i) => i.tagName.toLowerCase() === "mui-cell"
46
+ ), r = o[o.length - 1];
47
+ if (!r) return;
48
+ const s = o.some(
49
+ (i) => i.hasAttribute("action")
50
+ );
51
+ if (!e || s) {
52
+ this.clearActionPlaceholderStyles(r);
53
+ return;
54
+ }
55
+ const n = Array.from(r.children).some(
56
+ (i) => i.nodeType === Node.ELEMENT_NODE
57
+ ), l = (r.textContent || "").trim();
58
+ if (!(!n && l.length === 0)) {
59
+ this.clearActionPlaceholderStyles(r);
60
+ return;
61
+ }
62
+ r.style.width = "var(--row-action-size)", r.style.height = "var(--row-action-size)", r.style.display = "inline-flex", r.style.alignItems = "center", r.style.justifyContent = "center";
63
+ }
18
64
  render() {
19
65
  this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
20
66
  `
@@ -27,7 +73,43 @@ class e extends HTMLElement {
27
73
  padding: var(--space-300) var(--space-000);
28
74
  border-top: var(--border-thin);
29
75
  align-items: center;
30
- min-height: 4.4rem;
76
+ min-height: var(--row-min-height, var(--row-action-size, var(--row-action-xs)));
77
+ }
78
+ :host(:not([size])) {
79
+ --row-action-size: var(--row-action-m);
80
+ --row-cell-font-size: var(--text-font-size-m);
81
+ --row-cell-line-height: var(--text-line-height-m);
82
+ --row-min-height: var(--row-action-m);
83
+ }
84
+ :host([size="xx-small"]) {
85
+ --row-action-size: var(--row-action-xxs);
86
+ --row-cell-font-size: var(--text-font-size-xs);
87
+ --row-cell-line-height: var(--text-line-height-xs);
88
+ --row-min-height: var(--row-action-xxs);
89
+ }
90
+ :host([size="x-small"]) {
91
+ --row-action-size: var(--row-action-xs);
92
+ --row-cell-font-size: var(--text-font-size-xs);
93
+ --row-cell-line-height: var(--text-line-height-xs);
94
+ --row-min-height: var(--row-action-xs);
95
+ }
96
+ :host([size="small"]) {
97
+ --row-action-size: var(--row-action-s);
98
+ --row-cell-font-size: var(--text-font-size-s);
99
+ --row-cell-line-height: var(--text-line-height-s);
100
+ --row-min-height: var(--row-action-s);
101
+ }
102
+ :host([size="medium"]) {
103
+ --row-action-size: var(--row-action-m);
104
+ --row-cell-font-size: var(--text-font-size-m);
105
+ --row-cell-line-height: var(--text-line-height-m);
106
+ --row-min-height: var(--row-action-m);
107
+ }
108
+ :host([size="large"]) {
109
+ --row-action-size: var(--row-action-l);
110
+ --row-cell-font-size: var(--text-font-size-l);
111
+ --row-cell-line-height: var(--text-line-height-l);
112
+ --row-min-height: var(--row-action-l);
31
113
  }
32
114
  :host([in-card]) {
33
115
  border-top-color: color-mix(in srgb, var(--border-color) 50%, transparent);
@@ -37,4 +119,4 @@ class e extends HTMLElement {
37
119
  `);
38
120
  }
39
121
  }
40
- customElements.get("mui-row") || customElements.define("mui-row", e);
122
+ customElements.get("mui-row") || customElements.define("mui-row", a);
@@ -46,11 +46,11 @@ class l extends HTMLElement {
46
46
  h && (this.setActiveTab(h), h.focus());
47
47
  }), s.forEach((t, i) => {
48
48
  t.classList.remove("first", "middle", "last", "only"), s.length === 1 ? t.classList.add("only") : i === 0 ? t.classList.add("first") : i === s.length - 1 ? t.classList.add("last") : t.classList.add("middle");
49
- }), s.forEach((t) => {
50
- const i = t;
51
- i.addEventListener("click", () => {
52
- this.setActiveTab(i);
53
- });
49
+ }), this.addEventListener("click", (t) => {
50
+ const r = (typeof t.composedPath == "function" ? t.composedPath() : []).find(
51
+ (h) => h instanceof HTMLElement && h.tagName.toLowerCase() === "mui-tab-item"
52
+ ), n = t.target instanceof HTMLElement ? t.target.closest("mui-tab-item") : null, o = r || n;
53
+ !o || !this.contains(o) || this.setActiveTab(o);
54
54
  }), this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
55
55
  `
56
56
  <style>
@@ -1,6 +1,6 @@
1
1
 
2
2
  /* ================================================================================================== */
3
- /* Don't edit directly • Generated on Thu, 19 Mar 2026 13:50:01 GMT • muibook.com */
3
+ /* Don't edit directly • Generated on Mon, 23 Mar 2026 11:01:23 GMT • muibook.com */
4
4
  /* ================================================================================================== */
5
5
 
6
6
  /* ================================================================================================== */
@@ -172,6 +172,7 @@
172
172
  --stroke-size-300: 3px;
173
173
  --stroke-size-400: 4px;
174
174
  --stroke-size-500: 5px;
175
+ --stroke-size-050: 0.5px;
175
176
  --stroke-solid: solid;
176
177
  --stroke-outset: outset;
177
178
  --speed-100: 0.1s;
@@ -796,6 +796,11 @@ html[data-theme="dark"] {
796
796
  --action-after-slot-padding: var(--space-300);
797
797
  --action-icon-only-padding: var(--space-000);
798
798
  --action-icon-only-size: 4.4rem;
799
+ --row-action-xxs: calc(var(--action-icon-only-size-x-small) - var(--space-100));
800
+ --row-action-xs: var(--action-icon-only-size-x-small);
801
+ --row-action-s: var(--action-icon-only-size-small);
802
+ --row-action-m: var(--action-icon-only-size);
803
+ --row-action-l: var(--action-icon-only-size-large);
799
804
 
800
805
  /* SIZE: LARGE */
801
806
  --action-radius-large: var(--radius-300);