@luzmo/lucero 2.4.2 → 2.5.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 (116) hide show
  1. package/components/action-menu/index.cjs +1 -1
  2. package/components/action-menu/index.js +1 -1
  3. package/components/{action-menu-CwzRbF61.cjs → action-menu-BNZWjeDd.cjs} +1 -1
  4. package/components/{action-menu-C0sHNsjG.js → action-menu-D1hTsg9A.js} +1 -1
  5. package/components/checkbox/index.cjs +1 -1
  6. package/components/checkbox/index.js +1 -1
  7. package/components/{checkbox-BEjvkjfc.js → checkbox-CydI9yXG.js} +1 -1
  8. package/components/{checkbox-ClVrkeLp.cjs → checkbox-JCvBro0K.cjs} +1 -1
  9. package/components/index.cjs +1 -1
  10. package/components/index.js +11 -10
  11. package/components/match-media-B_0cVVtk.cjs +18 -0
  12. package/components/match-media-C5X2OZiD.js +34 -0
  13. package/components/picker/index.cjs +1 -1
  14. package/components/picker/index.js +1 -1
  15. package/components/picker-COeWCv60.cjs +124 -0
  16. package/components/{picker-D0fMBZLb.js → picker-uKcRswTQ.js} +6 -5
  17. package/components/question-box/index.cjs +1 -1
  18. package/components/question-box/index.js +1 -1
  19. package/components/{question-box-D7YSi_6c.js → question-box-Bcm-P-UV.js} +1 -1
  20. package/components/{question-box-Bdtsgv1k.cjs → question-box-DZnuGMBB.cjs} +1 -1
  21. package/components/select/index.cjs +1 -1
  22. package/components/select/index.js +1 -1
  23. package/components/{select-BUgHi69P.js → select-B86uAHme.js} +5 -4
  24. package/components/select-CKMCEJf7.cjs +158 -0
  25. package/components/strategies-Bb7zEjrU.cjs +18 -0
  26. package/components/{strategies-Cl59wdNZ.js → strategies-COS7mShJ.js} +11 -24
  27. package/components/table/controllers/table-announcer.d.ts +12 -0
  28. package/components/table/controllers/table-column-resize.d.ts +41 -0
  29. package/components/table/controllers/table-grid-navigation.d.ts +28 -0
  30. package/components/table/controllers/table-layout.d.ts +55 -0
  31. package/components/table/controllers/table-row-expansion.d.ts +45 -0
  32. package/components/table/controllers/table-virtualizer.d.ts +42 -0
  33. package/components/table/index.cjs +18 -0
  34. package/components/table/index.d.ts +32 -0
  35. package/components/table/index.js +20 -0
  36. package/components/table/table-body.d.ts +24 -0
  37. package/components/table/table-cell.d.ts +27 -0
  38. package/components/table/table-checkbox-cell.d.ts +41 -0
  39. package/components/table/table-columns.d.ts +45 -0
  40. package/components/table/table-disclosure-cell.d.ts +21 -0
  41. package/components/table/table-head-cell.d.ts +77 -0
  42. package/components/table/table-head.d.ts +34 -0
  43. package/components/table/table-model.d.ts +56 -0
  44. package/components/table/table-row-details.d.ts +29 -0
  45. package/components/table/table-row.d.ts +64 -0
  46. package/components/table/table-styles.d.ts +9 -0
  47. package/components/table/table-templates.d.ts +41 -0
  48. package/components/table/table.d.ts +197 -0
  49. package/components/table/types.d.ts +81 -0
  50. package/components/table-B75GjBhD.js +1592 -0
  51. package/components/table-CHrAaVU1.cjs +180 -0
  52. package/custom-elements.json +1 -1
  53. package/index.d.ts +1 -0
  54. package/package.json +9 -1
  55. package/standalone/accordion.js +1 -1
  56. package/standalone/action-bar.js +1 -1
  57. package/standalone/action-button.js +1 -1
  58. package/standalone/action-menu.js +1 -1
  59. package/standalone/avatar.js +1 -1
  60. package/standalone/calendar.js +1 -1
  61. package/standalone/checkbox.js +1 -1
  62. package/standalone/chunks/{action-button-BzzPBqt5.js → action-button-FSsfXYe9.js} +1 -1
  63. package/standalone/chunks/{button-Dykw3TSO.js → button-Q1n9DH9a.js} +1 -1
  64. package/standalone/chunks/{calendar-ZwUYkzVq.js → calendar-DcFjY2tw.js} +1 -1
  65. package/standalone/chunks/{checkbox-OQtakoP8.js → checkbox-DQ4wPgG_.js} +2 -2
  66. package/standalone/chunks/{clear-button-pVGfwye8.js → clear-button-3zpCVxG5.js} +1 -1
  67. package/standalone/chunks/{close-button-RpPiwBdf.js → close-button-C96dazyi.js} +1 -1
  68. package/standalone/chunks/{color-field-CrCF4kqZ.js → color-field-BFvUGE4L.js} +1 -1
  69. package/standalone/chunks/{color-menu-B5UOMYmX.js → color-menu-BIKuitbH.js} +2 -2
  70. package/standalone/chunks/{icon-Dy6J1QeX.js → icon-BypO7M7G.js} +1 -1
  71. package/standalone/chunks/luzmo-icons-B-pCv-xg.js +13 -0
  72. package/standalone/chunks/match-media-BMi7j6hf.js +2 -0
  73. package/standalone/chunks/{menu-nolJetlp.js → menu-DSMoQt1w.js} +1 -1
  74. package/standalone/chunks/{number-field-C3DYfl1s.js → number-field-B6BDXkL7.js} +3 -3
  75. package/standalone/chunks/{options-BjRSj630.js → options-CkmITqgV.js} +5 -5
  76. package/standalone/chunks/picker-FCQK0vdE.js +108 -0
  77. package/standalone/chunks/{picker-button-BeXTIgUt.js → picker-button-BZWqDoNQ.js} +1 -1
  78. package/standalone/chunks/{segments-factory-Ch3AAizU.js → segments-factory-eS38mJRz.js} +1 -1
  79. package/standalone/chunks/strategies-C-vW4MlK.js +2 -0
  80. package/standalone/chunks/{swatch-m_4GcO2_.js → swatch-CGR_GWqO.js} +1 -1
  81. package/standalone/chunks/{text-field-BnZtyodU.js → text-field-4OKvLOXG.js} +1 -1
  82. package/standalone/chunks/{text-field-BrlDeJsx.js → text-field-C2oROxum.js} +1 -1
  83. package/standalone/clear-button.js +1 -1
  84. package/standalone/close-button.js +1 -1
  85. package/standalone/color-field.js +1 -1
  86. package/standalone/color-menu.js +1 -1
  87. package/standalone/color-picker.js +1 -1
  88. package/standalone/date-range-picker.js +1 -1
  89. package/standalone/date-time-picker.js +1 -1
  90. package/standalone/icon.js +1 -1
  91. package/standalone/manifest.json +22 -20
  92. package/standalone/menu.js +1 -1
  93. package/standalone/multi-language-field.js +1 -1
  94. package/standalone/notice.js +1 -1
  95. package/standalone/number-field.js +1 -1
  96. package/standalone/options.js +1 -1
  97. package/standalone/picker-button.js +1 -1
  98. package/standalone/picker.js +1 -1
  99. package/standalone/progress-steps.js +1 -1
  100. package/standalone/prompt-box.js +9 -9
  101. package/standalone/question-box.js +1 -1
  102. package/standalone/search.js +1 -1
  103. package/standalone/select.js +2 -2
  104. package/standalone/slider.js +1 -1
  105. package/standalone/swatch.js +1 -1
  106. package/standalone/table.js +185 -0
  107. package/standalone/tabs.js +1 -1
  108. package/standalone/tags.js +1 -1
  109. package/standalone/text-field.js +1 -1
  110. package/standalone/toast.js +1 -1
  111. package/components/picker-BliQJlY_.cjs +0 -124
  112. package/components/select-DsGVB01K.cjs +0 -158
  113. package/components/strategies-BwNbUXYS.cjs +0 -18
  114. package/standalone/chunks/luzmo-icons-CJa-aByT.js +0 -13
  115. package/standalone/chunks/picker-hbMQOkUX.js +0 -108
  116. package/standalone/chunks/strategies-kad_0dTB.js +0 -2
@@ -0,0 +1,1592 @@
1
+ /*! * Lucero - The design system for Luzmo.
2
+ *
3
+ * Copyright © 2026 Luzmo
4
+ * All rights reserved.
5
+ * Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
6
+ * This license allows users with a current active Luzmo account to use Lucero.
7
+ * This license terminates automatically if a user no longer has an active Luzmo account.
8
+ * Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
9
+ *
10
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
15
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
16
+ * SOFTWARE.
17
+ * */
18
+ import "./tokens.js";
19
+ import { n as e, t } from "./decorate-CkCg3wfh.js";
20
+ import { n } from "./sized-mixin-DzQTebN-.js";
21
+ import { t as r } from "./roving-tabindex-pomAn3z-.js";
22
+ import { r as i, t as a } from "./language-resolution-BaKYDD1a.js";
23
+ import { r as o } from "./match-media-C5X2OZiD.js";
24
+ import "./checkbox-CydI9yXG.js";
25
+ import { html as s, nothing as c, unsafeCSS as l } from "lit";
26
+ import { property as u, query as d, state as f } from "lit/decorators.js";
27
+ import { luzmoAngleDown as p, luzmoArrowDown as m, luzmoArrowUp as h, luzmoIcon as g } from "@luzmo/icons";
28
+ import { ifDefined as _ } from "lit/directives/if-defined.js";
29
+ import { classMap as v } from "lit/directives/class-map.js";
30
+ import { styleMap as y } from "lit/directives/style-map.js";
31
+ import { repeat as ee } from "lit/directives/repeat.js";
32
+ import { createTable as te, getCoreRowModel as ne, getSortedRowModel as re } from "@tanstack/table-core";
33
+ import { Virtualizer as ie, elementScroll as b, observeElementOffset as ae, observeElementRect as oe } from "@tanstack/virtual-core";
34
+ //#region src/components/table/controllers/table-announcer.ts
35
+ var se = "data-luzmo-table-announcer", x, S = 0, C = 0, ce = () => {
36
+ let e = document.createElement("div");
37
+ return e.setAttribute(se, ""), e.setAttribute("aria-live", "polite"), e.setAttribute("aria-atomic", "true"), Object.assign(e.style, {
38
+ position: "absolute",
39
+ inlineSize: "1px",
40
+ blockSize: "1px",
41
+ margin: "-1px",
42
+ padding: "0",
43
+ border: "0",
44
+ overflow: "hidden",
45
+ clipPath: "inset(50%)",
46
+ whiteSpace: "nowrap"
47
+ }), e;
48
+ }, le = class {
49
+ constructor(e) {
50
+ e.addController(this);
51
+ }
52
+ announce(e) {
53
+ if (typeof document > "u" || !C) return;
54
+ x ??= ce(), x.isConnected || document.body.append(x);
55
+ let t = x;
56
+ t.textContent = "", cancelAnimationFrame(S), S = requestAnimationFrame(() => {
57
+ t.textContent = e;
58
+ });
59
+ }
60
+ hostConnected() {
61
+ C += 1;
62
+ }
63
+ hostDisconnected() {
64
+ --C, C === 0 && (cancelAnimationFrame(S), x?.remove(), x = void 0);
65
+ }
66
+ }, w = (e) => typeof e == "number" && Number.isFinite(e) ? e : void 0, T = (e) => `luzmo-table-details-${[...e].map((e) => /^[A-Za-z0-9]$/.test(e) ? e : `_${e.codePointAt(0).toString(16)}_`).join("")}`, E = (e) => w(e.minWidth) ?? (e.resizable ? 48 : 0), D = (e) => w(e.maxWidth) ?? 1e4, O = (e, t) => Math.min(D(t), Math.max(E(t), Math.round(e))), ue = (e, t) => {
67
+ let n = w(t) ?? w(e.width);
68
+ if (n !== void 0) return `${O(n, e)}px`;
69
+ let r = w(e.minWidth) ?? (e.resizable ? 48 : 0), i = w(e.maxWidth);
70
+ return i === void 0 ? r > 0 ? `minmax(${r}px, 1fr)` : "minmax(0px, 1fr)" : `minmax(${r}px, ${i}px)`;
71
+ }, de = (e, t, n) => {
72
+ let r = [];
73
+ n.selects && r.push("var(--table-checkbox-cell-inline-size)"), n.expandable && r.push("var(--table-disclosure-cell-inline-size)");
74
+ for (let n of e) r.push(ue(n, w(t[n.id])));
75
+ return r.join(" ");
76
+ }, fe = (e, t) => {
77
+ let n = w(t) ?? w(e.width);
78
+ return n === void 0 ? w(e.minWidth) ?? (e.resizable ? 48 : 0) : O(n, e);
79
+ }, pe = (e, t, n) => {
80
+ let r = [];
81
+ n.selects && r.push("var(--table-checkbox-cell-inline-size)"), n.expandable && r.push("var(--table-disclosure-cell-inline-size)");
82
+ let i = e.reduce((e, n) => e + fe(n, w(t[n.id])), 0);
83
+ return r.push(`${i}px`), `calc(${r.join(" + ")})`;
84
+ }, me = (e) => ({
85
+ id: e.id,
86
+ header: typeof e.header == "string" ? e.header : e.id,
87
+ width: w(e.width),
88
+ minWidth: w(e.minWidth),
89
+ maxWidth: w(e.maxWidth),
90
+ resizable: e.resizable !== !1,
91
+ lineClamp: w(e.lineClamp)
92
+ }), he = (e, t) => {
93
+ let n = e === "PageDown" || e === "PageUp";
94
+ switch (e) {
95
+ case "ArrowRight":
96
+ case "PageDown": return {
97
+ action: t ? "increase" : "decrease",
98
+ amount: n ? 64 : 16
99
+ };
100
+ case "ArrowLeft":
101
+ case "PageUp": return {
102
+ action: t ? "decrease" : "increase",
103
+ amount: n ? 64 : 16
104
+ };
105
+ case "Home": return {
106
+ action: "min",
107
+ amount: 0
108
+ };
109
+ case "End": return {
110
+ action: "max",
111
+ amount: 0
112
+ };
113
+ default: return;
114
+ }
115
+ }, ge = (e, t, n) => t.action === "min" ? E(n) : t.action === "max" ? D(n) : O(e + (t.action === "increase" ? 1 : -1) * t.amount, n), k = {
116
+ selectAll: "Select All",
117
+ selectRow: "Select row {index}",
118
+ sortAscending: "Sorted by {column}, ascending",
119
+ sortDescending: "Sorted by {column}, descending",
120
+ expandRow: "Expand {label}",
121
+ collapseRow: "Collapse {label}",
122
+ resizeColumn: "Resize {column}",
123
+ columnWidth: "{column}, {width} pixels"
124
+ }, _e = (e) => e.rowType === "information" || e._$rowType$ === 1, ve = (e) => e === "asc" ? "ascending" : e === "desc" ? "descending" : "none", ye = (e) => e === "asc" ? "desc" : "asc", A = (e = {}, t) => {
125
+ let n = Object.fromEntries(Object.entries(e).filter(([, e]) => typeof e == "string" && e !== "")), r = {
126
+ ...k,
127
+ ...n
128
+ };
129
+ return t && (r.selectAll = t), r;
130
+ }, j = (e, t) => {
131
+ let n = e;
132
+ for (let [e, r] of Object.entries(t)) n = n.replaceAll(`{${e}}`, r);
133
+ return n;
134
+ }, be = (e, t) => e.map((e, n) => ({
135
+ item: e,
136
+ value: t ? t(e, n) : String(n),
137
+ index: n,
138
+ information: _e(e)
139
+ })), xe = (e, t) => typeof e == "function" ? e(t) : e, Se = class {
140
+ constructor() {
141
+ this.records = [], this.sorting = [], this.manualSorting = !1, this.rowSelection = {}, this.selectedOrder = [], this.columns = [], this.table = te({
142
+ data: [],
143
+ columns: [],
144
+ state: {},
145
+ onStateChange: () => {},
146
+ renderFallbackValue: null,
147
+ getCoreRowModel: ne(),
148
+ getSortedRowModel: re(),
149
+ getRowId: (e) => e.value,
150
+ enableRowSelection: (e) => !!this.selects && !e.original.information,
151
+ enableMultiRowSelection: () => this.selects === "multiple",
152
+ onRowSelectionChange: (e) => {
153
+ this.pendingSelection = xe(e, this.rowSelection);
154
+ }
155
+ }), this.compare = (e, t) => typeof e == "number" && typeof t == "number" ? e - t : ((!this.collator || this.collatorLocale !== this.locale) && (this.collatorLocale = this.locale, this.collator = new Intl.Collator(this.locale, {
156
+ numeric: !0,
157
+ sensitivity: "base"
158
+ })), this.collator.compare(String(e), String(t)));
159
+ }
160
+ setRecords(e) {
161
+ this.records = e;
162
+ }
163
+ setSelected(e) {
164
+ this.selectedOrder = [...e], this.rowSelection = Object.fromEntries(e.map((e) => [e, !0]));
165
+ }
166
+ setSorting(e, t = !1) {
167
+ if (this.manualSorting = t, !e) {
168
+ this.sorting = [];
169
+ return;
170
+ }
171
+ this.columns.some((t) => t.id === e.key) || (this.columns = [...this.columns, this.createSortColumn(e.key)]), this.sorting = [{
172
+ id: e.key,
173
+ desc: e.direction === "desc"
174
+ }];
175
+ }
176
+ get rows() {
177
+ this.sync();
178
+ let e = this.table.getRowModel().rows.map((e) => e.original).filter((e) => !e.information);
179
+ return e.length === this.records.length ? e : this.records.map((t) => t.information ? t : e.shift());
180
+ }
181
+ isSelected(e) {
182
+ return !!this.rowSelection[e];
183
+ }
184
+ get allSelected() {
185
+ let e = this.selectableRecords;
186
+ return e.length > 0 && e.every((e) => this.isSelected(e.value));
187
+ }
188
+ get someSelected() {
189
+ return this.selectableRecords.some((e) => this.isSelected(e.value));
190
+ }
191
+ toggle(e) {
192
+ this.sync();
193
+ let t = this.findRow(e);
194
+ if (t?.getCanSelect()) return this.capture(() => t.toggleSelected());
195
+ }
196
+ toggleAll(e) {
197
+ return this.sync(), this.capture(() => this.table.toggleAllRowsSelected(e));
198
+ }
199
+ get selectableRecords() {
200
+ return this.selects ? this.records.filter((e) => !e.information) : [];
201
+ }
202
+ findRow(e) {
203
+ return this.table.getCoreRowModel().rows.find((t) => t.original.value === e);
204
+ }
205
+ capture(e) {
206
+ this.pendingSelection = void 0, e();
207
+ let t = this.pendingSelection ?? this.rowSelection;
208
+ this.pendingSelection = void 0;
209
+ let n = this.selectedOrder.filter((e) => t[e]), r = [.../* @__PURE__ */ new Set([...this.records.map((e) => e.value), ...Object.keys(t)])].filter((e) => t[e] && !n.includes(e));
210
+ return [...n, ...r];
211
+ }
212
+ createSortColumn(e) {
213
+ return {
214
+ id: e,
215
+ accessorFn: (t) => t.item[e],
216
+ sortUndefined: "last",
217
+ sortingFn: (e, t, n) => this.compare(e.getValue(n), t.getValue(n))
218
+ };
219
+ }
220
+ sync() {
221
+ this.table.setOptions((e) => ({
222
+ ...e,
223
+ data: this.records,
224
+ columns: this.columns,
225
+ manualSorting: this.manualSorting,
226
+ state: {
227
+ ...this.table.initialState,
228
+ sorting: this.sorting,
229
+ rowSelection: this.rowSelection
230
+ }
231
+ }));
232
+ }
233
+ }, Ce = /* @__PURE__ */ new Set([
234
+ "luzmo-table-cell",
235
+ "luzmo-table-head-cell",
236
+ "luzmo-table-checkbox-cell"
237
+ ]), M = (e) => e.find((e) => e instanceof HTMLElement && e.classList.contains("resize-handle")), we = class {
238
+ constructor(e, t) {
239
+ this.handlePointerDown = (e) => {
240
+ if (!this.options.owns(e) || e.button !== 0) return;
241
+ let t = e.composedPath(), n = M(t), r = this.cellFromPath(t);
242
+ if (!n || r?.localName !== "luzmo-table-head-cell" || !r.resizable) return;
243
+ let i = r;
244
+ e.preventDefault();
245
+ let a = this.options.headCells().indexOf(i), o = i.toLayout(Math.max(a, 0));
246
+ this.drag = {
247
+ id: o.id,
248
+ pointerId: e.pointerId,
249
+ startWidth: i.getBoundingClientRect().width,
250
+ startX: e.clientX
251
+ };
252
+ try {
253
+ n.setPointerCapture(e.pointerId);
254
+ } catch {}
255
+ }, this.handlePointerMove = (e) => {
256
+ let t = this.drag;
257
+ if (!t || e.pointerId !== t.pointerId) return;
258
+ let n = this.options.layouts().find((e) => e.id === t.id);
259
+ if (!n) return;
260
+ let r = (e.clientX - t.startX) * (this.options.isLTR() ? 1 : -1);
261
+ this.setColumnWidth(n, t.startWidth + r, !1);
262
+ }, this.handlePointerUp = (e) => {
263
+ let t = this.drag;
264
+ if (!t || e.pointerId !== t.pointerId) return;
265
+ let n = this.options.layouts().find((e) => e.id === t.id);
266
+ if (this.drag = void 0, !n) return;
267
+ let r = (e.clientX - t.startX) * (this.options.isLTR() ? 1 : -1);
268
+ this.setColumnWidth(n, t.startWidth + r, !0);
269
+ }, this.host = e, this.options = t, e.addController(this);
270
+ }
271
+ hostConnected() {
272
+ this.host.addEventListener("pointerdown", this.handlePointerDown), this.host.addEventListener("pointermove", this.handlePointerMove), this.host.addEventListener("pointerup", this.handlePointerUp), this.host.addEventListener("pointercancel", this.handlePointerUp);
273
+ }
274
+ hostDisconnected() {
275
+ this.host.removeEventListener("pointerdown", this.handlePointerDown), this.host.removeEventListener("pointermove", this.handlePointerMove), this.host.removeEventListener("pointerup", this.handlePointerUp), this.host.removeEventListener("pointercancel", this.handlePointerUp), this.drag = void 0;
276
+ }
277
+ handleKeydown(e) {
278
+ if (e.defaultPrevented || !this.options.owns(e)) return;
279
+ let t = e.composedPath();
280
+ if (!M(t)) return;
281
+ let n = he(e.code, this.options.isLTR()), r = this.cellFromPath(t);
282
+ n && r?.localName === "luzmo-table-head-cell" && (e.preventDefault(), e.stopPropagation(), this.resizeColumn(r, n));
283
+ }
284
+ resizeColumn(e, t) {
285
+ let n = this.options.headCells().indexOf(e), r = e.toLayout(Math.max(n, 0)), i = e.currentWidth || Math.round(e.getBoundingClientRect().width);
286
+ this.setColumnWidth(r, ge(i, t, r), !0);
287
+ }
288
+ setColumnWidth(e, t, n) {
289
+ let r = O(t, e), i = {
290
+ ...this.host.columnWidths,
291
+ [e.id]: r
292
+ };
293
+ this.host.columnWidths = i;
294
+ let a = this.options.headCells().find((t, n) => t.toLayout(n).id === e.id);
295
+ if (a && (a.currentWidth = r), !n) return;
296
+ let o = A(this.options.labels(), this.options.selectAllLabel());
297
+ this.host.dispatchEvent(new CustomEvent("luzmo-column-resized", {
298
+ bubbles: !0,
299
+ composed: !0,
300
+ detail: {
301
+ columnId: e.id,
302
+ width: r,
303
+ columnWidths: { ...i }
304
+ }
305
+ })), this.options.announce(j(o.columnWidth, {
306
+ column: e.header,
307
+ width: this.formatWidth(r)
308
+ }));
309
+ }
310
+ formatWidth(e) {
311
+ let t = this.options.language();
312
+ return (!this.widthFormatter || this.formatterLanguage !== t) && (this.formatterLanguage = t, this.widthFormatter = new Intl.NumberFormat(t)), this.widthFormatter.format(e);
313
+ }
314
+ cellFromPath(e) {
315
+ return e.find((e) => e instanceof HTMLElement && Ce.has(e.localName));
316
+ }
317
+ }, Te = "textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"], input:not([type=\"checkbox\"]):not([type=\"radio\"]):not([type=\"button\"]):not([type=\"submit\"]):not([type=\"reset\"])", Ee = class extends r {
318
+ constructor(e, { rows: t, isLTR: n, ...r }) {
319
+ super(e, r), this.handleFocusout = (e) => {
320
+ let t = e.relatedTarget;
321
+ t instanceof HTMLElement && (this.elements.includes(t) || this.elements.some((e) => e.contains(t))) || queueMicrotask(() => {
322
+ this.activeGridCell() || this.hostNoLongerContainsFocus();
323
+ });
324
+ }, this.handleKeydown = (e) => {
325
+ if (e.defaultPrevented || !this.acceptsEventCode(e.code) || !this.owns(e)) return;
326
+ let t = e.composedPath()[0];
327
+ if (t instanceof HTMLElement && t.matches(Te)) return;
328
+ let n = this.cellFromPath(e.composedPath());
329
+ if (!n) return;
330
+ let r = this.navigationTarget(n, e);
331
+ r && (e.preventDefault(), this.focusElement(r));
332
+ }, this.rows = t, this.isLTR = n;
333
+ }
334
+ acceptsEventCode(e) {
335
+ return e === "ArrowLeft" || e === "ArrowRight" || e === "ArrowUp" || e === "ArrowDown" || e === "Home" || e === "End";
336
+ }
337
+ focusElement(e, t) {
338
+ let n = this.elements.indexOf(e);
339
+ if (n === -1) return;
340
+ let r = this.elements[this.currentIndex];
341
+ r && r !== e && (r.tabIndex = -1), this.currentIndex = n, this.focus(t);
342
+ }
343
+ owns(e) {
344
+ for (let t of e.composedPath()) if (t instanceof HTMLElement && t.localName === "luzmo-table") return t === this.host;
345
+ return !0;
346
+ }
347
+ cellFromPath(e) {
348
+ let t = new Set(this.rows().flat());
349
+ return e.find((e) => e instanceof HTMLElement && t.has(e));
350
+ }
351
+ activeGridCell() {
352
+ let e = this.host.ownerDocument.activeElement;
353
+ for (; e instanceof HTMLElement && e.shadowRoot?.activeElement;) e = e.shadowRoot.activeElement;
354
+ return e instanceof HTMLElement && this.rows().flat().includes(e) ? e : void 0;
355
+ }
356
+ navigationTarget(e, t) {
357
+ let n = this.rows(), r = n.findIndex((t) => t.includes(e));
358
+ if (r === -1) return;
359
+ let i = n[r].indexOf(e), a = n.length - 1, o = (e, t) => {
360
+ let r = n[Math.min(Math.max(e, 0), a)];
361
+ return r[Math.min(Math.max(t, 0), r.length - 1)];
362
+ }, s = (t) => {
363
+ let i = n[Math.min(Math.max(t, 0), a)];
364
+ return this.cellForKey(i, this.columnKey(n[r], e));
365
+ }, c = this.isLTR() ? 1 : -1, l = t.ctrlKey || t.metaKey;
366
+ switch (t.code) {
367
+ case "ArrowRight": return o(r, i + c);
368
+ case "ArrowLeft": return o(r, i - c);
369
+ case "ArrowDown": return s(r + 1);
370
+ case "ArrowUp": return s(r - 1);
371
+ case "Home": return o(l ? 0 : r, 0);
372
+ case "End": return l ? o(a, n[a].length - 1) : o(r, n[r].length - 1);
373
+ default: return;
374
+ }
375
+ }
376
+ columnKey(e, t) {
377
+ if (t.classList.contains("resize-handle")) {
378
+ let n = e[e.indexOf(t) - 1];
379
+ return n ? this.columnKey(e, n) : "data:0";
380
+ }
381
+ if (t.localName === "luzmo-table-checkbox-cell") return "select";
382
+ if (t.localName === "luzmo-table-disclosure-cell") return "expand";
383
+ if (t.classList.contains("cell")) return "details";
384
+ let n = e.filter((e) => e.localName === "luzmo-table-cell" || e.localName === "luzmo-table-head-cell");
385
+ return `data:${Math.max(n.indexOf(t), 0)}`;
386
+ }
387
+ cellForKey(e, t) {
388
+ return t === "expand" ? e.find((e) => e.localName === "luzmo-table-disclosure-cell") ?? this.cellForKey(e, "data:0") : t === "details" ? this.cellForKey(e, "data:0") : e.find((n) => !n.classList.contains("resize-handle") && this.columnKey(e, n) === t) ?? e[0];
389
+ }
390
+ }, N = Symbol("table-details-closing"), P = (e) => {
391
+ let t = e.nextElementSibling;
392
+ return t?.localName === "luzmo-table-row-details" ? t : null;
393
+ }, F = (e) => e instanceof HTMLElement, De = class {
394
+ constructor(e, t) {
395
+ this.closingDetails = /* @__PURE__ */ new Set(), this.handleDetailsCollapsed = (e) => {
396
+ if (!this.options.owns(e)) return;
397
+ let t = e.target, n = [...this.closingDetails].find((e) => T(e) === t?.id);
398
+ if (!n) return;
399
+ let r = new Set(this.closingDetails);
400
+ r.delete(n), this.closingDetails = r, this.host.requestUpdate(N);
401
+ }, this.host = e, this.options = t, e.addController(this);
402
+ }
403
+ get closing() {
404
+ return this.closingDetails;
405
+ }
406
+ hostConnected() {
407
+ this.host.addEventListener("luzmo-table-details-collapsed", this.handleDetailsCollapsed);
408
+ }
409
+ hostDisconnected() {
410
+ this.host.removeEventListener("luzmo-table-details-collapsed", this.handleDetailsCollapsed);
411
+ }
412
+ clear() {
413
+ this.closingDetails = /* @__PURE__ */ new Set(), this.host.requestUpdate(N);
414
+ }
415
+ toggle(e) {
416
+ if (!e.expandable && !P(e)) return;
417
+ let t = this.isDataMode(), n = t ? e.value : e.value || String(this.declarativeRows().indexOf(e)), r = t ? !this.host.expanded.includes(n) : !e.expanded;
418
+ if (t) {
419
+ let e = this.host.expanded;
420
+ this.setClosing(n, !r), this.host.expanded = r ? [...e, n] : e.filter((e) => e !== n), this.dispatchToggle(n, r) || (this.host.expanded = e, this.setClosing(n, !1));
421
+ return;
422
+ }
423
+ if (e.expanded = r, !this.dispatchToggle(n, r)) {
424
+ e.expanded = !r;
425
+ return;
426
+ }
427
+ let i = P(e);
428
+ i && (i.open = r), e.disclosureLabel = this.expandLabel(n, e.checkboxLabel || e.querySelector(":scope > luzmo-table-cell")?.textContent?.trim() || n, this.declarativeRows().indexOf(e));
429
+ }
430
+ collapseFromPath(e) {
431
+ let t = e.find((e) => F(e) && e.localName === "luzmo-table-row-details"), n = (t?.previousElementSibling?.localName === "luzmo-table-row" ? t.previousElementSibling : void 0) ?? e.find((e) => F(e) && e.localName === "luzmo-table-row");
432
+ if (!n?.expanded) return;
433
+ this.toggle(n);
434
+ let r = n.shadowRoot?.querySelector("luzmo-table-disclosure-cell");
435
+ r && this.options.focusDisclosure(r);
436
+ }
437
+ setClosing(e, t) {
438
+ let n = new Set([...this.closingDetails].filter((t) => t !== e));
439
+ t && n.add(e), this.closingDetails = n, this.host.requestUpdate(N);
440
+ }
441
+ dispatchToggle(e, t) {
442
+ return this.host.dispatchEvent(new CustomEvent("luzmo-table-row-toggle", {
443
+ bubbles: !0,
444
+ composed: !0,
445
+ cancelable: !0,
446
+ detail: {
447
+ value: e,
448
+ expanded: t
449
+ }
450
+ }));
451
+ }
452
+ expandLabel(e, t, n) {
453
+ let r = A(this.host.labels, this.host.selectAllLabel);
454
+ return j(this.host.expanded.includes(e) || this.rowByValue(e)?.expanded ? r.collapseRow : r.expandRow, {
455
+ label: t,
456
+ index: String(n + 1)
457
+ });
458
+ }
459
+ rowByValue(e) {
460
+ return this.rows().find((t) => t.value === e);
461
+ }
462
+ isDataMode() {
463
+ return Array.isArray(this.host.items);
464
+ }
465
+ declarativeRows() {
466
+ return [...this.host.querySelectorAll(":scope > luzmo-table-body > luzmo-table-row")];
467
+ }
468
+ rows() {
469
+ return this.isDataMode() ? [...this.host.shadowRoot?.querySelectorAll("luzmo-table-row") ?? []] : this.declarativeRows();
470
+ }
471
+ }, I = (e) => e instanceof HTMLElement, Oe = class {
472
+ constructor(e, t) {
473
+ this.handleBodyScroll = (e) => {
474
+ this.options.owns(e) && e.composedPath().find((e) => I(e) && e.localName === "luzmo-table-body") && this.host.requestUpdate();
475
+ }, this.host = e, this.options = t, e.addController(this);
476
+ }
477
+ hostConnected() {
478
+ this.host.addEventListener("luzmo-table-body-scroll", this.handleBodyScroll);
479
+ }
480
+ hostDisconnected() {
481
+ this.host.removeEventListener("luzmo-table-body-scroll", this.handleBodyScroll), this.bodyObserver?.disconnect(), this.observedBody = void 0;
482
+ }
483
+ hostUpdated() {
484
+ this.syncHeadScroll(), this.watchBodyScrollbar();
485
+ }
486
+ hasExpansion() {
487
+ return this.isDataMode() ? typeof this.host.renderDetails == "function" : this.declarativeRows().some((e) => e.nextElementSibling?.localName === "luzmo-table-row-details");
488
+ }
489
+ layouts() {
490
+ return this.isDataMode() && !this.slottedHead() ? this.host.columns.map(me) : this.headCells().map((e, t) => e.toLayout(t));
491
+ }
492
+ headCells() {
493
+ return [...this.head()?.querySelectorAll(":scope > luzmo-table-head-cell") ?? []];
494
+ }
495
+ applyGridMetrics() {
496
+ let e = {
497
+ selects: !!this.host.selects,
498
+ expandable: this.hasExpansion()
499
+ }, t = this.layouts();
500
+ this.host.style.setProperty("--table-grid-columns", de(t, this.host.columnWidths, e) || "none"), this.host.style.setProperty("--table-min-inline-size", pe(t, this.host.columnWidths, e));
501
+ }
502
+ syncPresentation() {
503
+ this.syncHead(), this.syncColumns(), this.isDataMode() || this.syncDeclarativeRows();
504
+ }
505
+ syncHeadTabStops() {
506
+ let e = this.head();
507
+ if (!e) return;
508
+ let t = e.shadowRoot?.querySelector("luzmo-table-checkbox-cell");
509
+ t && t.getAttribute("aria-hidden") !== "true" && t.tabIndex !== 0 && (t.tabIndex = 0);
510
+ for (let e of this.headCells()) e.tabIndex !== 0 && (e.tabIndex = 0);
511
+ }
512
+ syncHead() {
513
+ let e = this.body();
514
+ e && this.syncGridColumns(e);
515
+ let t = this.head();
516
+ if (!t) return;
517
+ this.syncGridColumns(t), this.syncHeadScroll(e, t);
518
+ let n = A(this.host.labels, this.host.selectAllLabel), r = this.options.model.allSelected, i = this.options.model.someSelected, a = this.host.selects === "multiple";
519
+ t.selects = this.host.selects, t.checked = a && r, t.indeterminate = a && i && !r, t.selected = i, t.emphasized = this.host.emphasized, t.checkboxLabel = n.selectAll, t.checkboxSize = this.host.size, t.expandable = this.hasExpansion();
520
+ }
521
+ watchBodyScrollbar() {
522
+ let e = this.body();
523
+ !e || e === this.observedBody || (this.bodyObserver?.disconnect(), this.observedBody = e, this.bodyObserver ??= new ResizeObserver(() => {
524
+ this.syncHeadScroll();
525
+ }), this.bodyObserver.observe(e, { box: "content-box" }));
526
+ }
527
+ syncHeadScroll(e = this.body(), t = this.head()) {
528
+ if (!e || !t) return;
529
+ let n = Math.max(0, e.offsetWidth - e.clientWidth), r = e.scrollWidth > e.clientWidth + 1;
530
+ t.style.paddingInlineEnd = n > 0 && !r ? `${n}px` : "", t.style.transform = `translateX(${-e.scrollLeft}px)`;
531
+ }
532
+ syncColumns() {
533
+ let e = this.layouts(), t = A(this.host.labels, this.host.selectAllLabel);
534
+ this.headCells().forEach((n, r) => {
535
+ let i = e[r];
536
+ if (!i) return;
537
+ let a = n.textContent?.trim() || i.header;
538
+ if (n.resizeLabel = j(t.resizeColumn, { column: a }), !n.resizable) return;
539
+ let o = w(this.host.columnWidths[i.id]) ?? i.width, s = Math.round(n.getBoundingClientRect().width), c = o ?? s;
540
+ c > 0 && n.currentWidth !== c && (n.currentWidth = c);
541
+ });
542
+ for (let t of this.rows()) {
543
+ this.syncGridColumns(t);
544
+ let n = P(t);
545
+ n && this.syncGridColumns(n), !t.spanAll && [...t.children].filter((e) => I(e) && e.localName === "luzmo-table-cell").forEach((t, n) => {
546
+ let r = e[n]?.lineClamp;
547
+ t.columnLineClamp !== r && (t.columnLineClamp = r);
548
+ });
549
+ }
550
+ }
551
+ syncDeclarativeRows() {
552
+ let e = this.host.selects, t = A(this.host.labels, this.host.selectAllLabel), n = this.hasExpansion(), r = this.declarativeRows();
553
+ r.forEach((i, a) => {
554
+ this.syncGridColumns(i);
555
+ let o = i.value || String(a), s = P(i), c = a === r.length - 1;
556
+ i.toggleAttribute("data-last-row", c), s && (this.syncGridColumns(s), s.toggleAttribute("data-last-row", c));
557
+ let l = i.querySelector(":scope > luzmo-table-cell")?.textContent?.trim() || o;
558
+ i.selectable = !!e, i.selectionColumn = !!e, i.selected = !!e && this.options.model.isSelected(o), i.selectsSingle = e === "single", i.emphasized = this.host.emphasized, i.checkboxSize = this.host.size, i.checkboxLabel = l, i.expandable = !!s, i.expansionColumn = n && !s, i.detailsId = s?.id ?? "", i.disclosureLabel = j(i.expanded ? t.collapseRow : t.expandRow, {
559
+ label: l,
560
+ index: String(a + 1)
561
+ }), s && (s.id || (s.id = T(o), i.detailsId = s.id), s.open = i.expanded);
562
+ });
563
+ }
564
+ syncGridColumns(e) {
565
+ for (let t of ["--table-grid-columns", "--table-min-inline-size"]) e.style.setProperty(t, this.host.style.getPropertyValue(t));
566
+ }
567
+ isDataMode() {
568
+ return Array.isArray(this.host.items);
569
+ }
570
+ slottedHead() {
571
+ return this.host.querySelector(":scope > luzmo-table-head");
572
+ }
573
+ head() {
574
+ return this.slottedHead() ?? (this.isDataMode() ? this.host.shadowRoot?.querySelector("luzmo-table-head") ?? null : null);
575
+ }
576
+ body() {
577
+ return this.isDataMode() ? this.host.shadowRoot?.querySelector("luzmo-table-body") ?? null : this.host.querySelector(":scope > luzmo-table-body");
578
+ }
579
+ declarativeRows() {
580
+ return [...this.host.querySelectorAll(":scope > luzmo-table-body > luzmo-table-row")];
581
+ }
582
+ rows() {
583
+ return this.isDataMode() ? [...this.host.shadowRoot?.querySelectorAll("luzmo-table-row") ?? []] : this.declarativeRows();
584
+ }
585
+ }, L = Symbol("table-virtual-range-updated"), ke = 40, Ae = 4, R = (e) => e.getBoundingClientRect().height, je = class {
586
+ constructor(e, t) {
587
+ this.connected = !1, this.keys = [], this.estimatedSize = ke, this.host = e, this.options = t, e.addController(this);
588
+ }
589
+ get enabled() {
590
+ return !!this.virtualizer;
591
+ }
592
+ set enabled(e) {
593
+ if (e !== this.enabled) {
594
+ if (e) {
595
+ this.virtualizer = new ie(this.createOptions()), this.connected && (this.cleanup = this.virtualizer._didMount());
596
+ return;
597
+ }
598
+ this.cleanup?.(), this.cleanup = void 0, this.virtualizer = void 0, this.range = void 0;
599
+ }
600
+ }
601
+ sync(e) {
602
+ return this.virtualizer ? (e !== this.keys && (this.keys = e, this.virtualizer.setOptions(this.createOptions())), this.virtualizer.getVirtualItems()) : [];
603
+ }
604
+ get totalSize() {
605
+ return this.virtualizer?.getTotalSize() ?? 0;
606
+ }
607
+ scrollToIndex(e) {
608
+ this.virtualizer?.scrollToIndex(e, { align: "start" });
609
+ }
610
+ hostConnected() {
611
+ this.connected = !0, this.virtualizer && !this.cleanup && (this.cleanup = this.virtualizer._didMount());
612
+ }
613
+ hostUpdated() {
614
+ if (!this.virtualizer) return;
615
+ this.virtualizer._willUpdate();
616
+ let e = this.options.getRowElements();
617
+ this.syncEstimate(e);
618
+ for (let t of e) this.virtualizer.measureElement(t);
619
+ }
620
+ hostDisconnected() {
621
+ this.connected = !1, this.cleanup?.(), this.cleanup = void 0;
622
+ }
623
+ syncEstimate(e) {
624
+ let t = e.filter((e) => this.options.isRendered(e)).map((e) => R(e)).filter(Boolean).sort((e, t) => e - t);
625
+ if (t.length === 0) return;
626
+ let n = t[Math.floor(t.length / 2)];
627
+ Math.abs(n - this.estimatedSize) >= .5 && (this.estimatedSize = n, this.virtualizer?.measure());
628
+ }
629
+ createOptions() {
630
+ return {
631
+ count: this.keys.length,
632
+ getScrollElement: this.options.getScrollElement,
633
+ estimateSize: () => this.estimatedSize,
634
+ getItemKey: (e) => this.keys[e] ?? e,
635
+ overscan: Ae,
636
+ useAnimationFrameWithResizeObserver: !0,
637
+ scrollToFn: b,
638
+ observeElementRect: oe,
639
+ observeElementOffset: ae,
640
+ measureElement: (e) => this.options.isRendered(e) && R(e) || this.estimatedSize,
641
+ onChange: (e) => {
642
+ let t = this.reportRange(e);
643
+ queueMicrotask(() => {
644
+ t ? this.host.requestUpdate(L, !1) : this.host.requestUpdate();
645
+ });
646
+ }
647
+ };
648
+ }
649
+ reportRange(e) {
650
+ let t = e.range;
651
+ if (!t || t.endIndex < t.startIndex) return !1;
652
+ let n = t.startIndex, r = t.endIndex;
653
+ return this.range?.first === n && this.range.last === r ? !1 : (this.range = {
654
+ first: n,
655
+ last: r
656
+ }, this.options.onRangeChanged({
657
+ first: n,
658
+ last: r
659
+ }), !0);
660
+ }
661
+ }, Me = ":host{grid-template-columns:var(--table-grid-columns);min-inline-size:var(--table-min-inline-size,0);box-sizing:border-box;display:grid;overflow:hidden;border-block-start:none!important;border-inline:none!important;border-block-end-width:var(--table-row-divider-width)!important;border-block-end-style:solid!important;border-block-end-color:var(--highcontrast-table-row-divider-color,var(--luzmo-table-border-color,var(--table-row-divider-color)))!important}:host([data-last-row]){border-block-end-width:0!important}:host([hidden]){display:none!important}.cell{outline:none;grid-column:1/-1;grid-template-rows:1fr;min-inline-size:0;display:grid;overflow:hidden}:host([data-last-row]) .cell{--table-focus-end-start-radius:var(--table-corner-radius);--table-focus-end-end-radius:var(--table-corner-radius)}.cell:focus-visible{outline:var(--luzmo-indicator-width,2px) solid var(--highcontrast-table-details-focus-indicator-color,var(--luzmo-indicator-color,currentColor));outline-offset:calc(var(--luzmo-indicator-width,2px) * -1);border-start-start-radius:var(--table-focus-start-start-radius,0);border-start-end-radius:var(--table-focus-start-end-radius,0);border-end-end-radius:var(--table-focus-end-end-radius,0);border-end-start-radius:var(--table-focus-end-start-radius,0)}.content{padding-block:var(--table-details-padding-block);padding-inline:var(--table-details-padding-inline);overflow:hidden}:host([opening]) .content,:host([closing]) .content{min-block-size:0}:host([opening]) .cell{animation:table-details-open var(--luzmo-animation-duration) ease-out}:host([closing]) .cell{animation:table-details-close var(--luzmo-animation-duration) ease-in}@keyframes table-details-open{0%{opacity:0;grid-template-rows:0fr}}@keyframes table-details-close{to{opacity:0;grid-template-rows:0fr}}@media (prefers-reduced-motion:reduce){:host([opening]) .cell,:host([closing]) .cell{animation:none}}:host{--table-row-divider-color:var(--luzmo-border-color);--table-row-divider-width:var(--luzmo-border-width);--table-details-padding-block:var(--luzmo-spacing-4);--table-details-padding-inline:var(--luzmo-table-cell-padding-inline,var(--table-cell-padding-inline))}@media (forced-colors:active){:host{--highcontrast-table-row-divider-color:CanvasText;--highcontrast-table-details-focus-indicator-color:Highlight}}";
662
+ //#endregion
663
+ //#region src/components/table/table-styles.ts
664
+ function z(e, t) {
665
+ return [...Array.isArray(e) ? e : e ? [e] : [], l(t)];
666
+ }
667
+ //#endregion
668
+ //#region src/components/table/table-row-details.ts
669
+ var B = class extends e {
670
+ constructor(...e) {
671
+ super(...e), this.role = "row", this.open = !1, this._phase = "closed", this.reducedMotion = new o(this, "(prefers-reduced-motion: reduce)"), this.handleAnimationEnd = (e) => {
672
+ e.target === this.renderRoot.querySelector(".cell") && (this._phase === "closing" ? this._finishClosing() : this._phase === "opening" && (this._phase = "open"), this.requestUpdate());
673
+ }, this._finishClosing = () => {
674
+ this._phase === "closing" && (window.clearTimeout(this._closeFallback), this._phase = "closed", this.hidden = !0, this.dispatchEvent(new Event("luzmo-table-details-collapsed", {
675
+ bubbles: !0,
676
+ composed: !0
677
+ })), this.requestUpdate());
678
+ };
679
+ }
680
+ static get styles() {
681
+ return z(super.styles, Me);
682
+ }
683
+ disconnectedCallback() {
684
+ window.clearTimeout(this._closeFallback), super.disconnectedCallback();
685
+ }
686
+ willUpdate(e) {
687
+ if (super.willUpdate(e), !(!e.has("open") && this.hasUpdated)) {
688
+ if (this.open) {
689
+ this.hidden = !1, this._phase = this.hasUpdated && !this.reducedMotion.matches ? "opening" : "open";
690
+ return;
691
+ }
692
+ if (!this.hasUpdated || this.reducedMotion.matches || this._phase === "closed") {
693
+ this._phase = "closed", this.hidden = !0;
694
+ return;
695
+ }
696
+ this._phase = "closing";
697
+ }
698
+ }
699
+ render() {
700
+ return s`
701
+ <div
702
+ class="cell"
703
+ role="gridcell"
704
+ @animationend=${this.handleAnimationEnd}
705
+ >
706
+ <div class="content"><slot></slot></div>
707
+ </div>
708
+ `;
709
+ }
710
+ updated(e) {
711
+ super.updated(e), e.has("_phase") && (this.toggleAttribute("opening", this._phase === "opening"), this.toggleAttribute("closing", this._phase === "closing"), window.clearTimeout(this._closeFallback), this._phase === "closing" && (this._closeFallback = window.setTimeout(this._finishClosing, 200)));
712
+ }
713
+ };
714
+ t([u({ reflect: !0 })], B.prototype, "role", void 0), t([u({
715
+ type: Boolean,
716
+ reflect: !0
717
+ })], B.prototype, "open", void 0), t([f()], B.prototype, "_phase", void 0);
718
+ //#endregion
719
+ //#region src/components/table/table-templates.ts
720
+ var V = (e) => e.sortKey ?? e.accessorKey ?? e.id, H = (e, t) => {
721
+ let n = t[e.accessorKey ?? e.id];
722
+ return typeof n == "string" || typeof n == "number" ? String(n) : "";
723
+ }, Ne = (e, t, n) => {
724
+ let r = e.map((e) => {
725
+ let r = V(e), i = typeof e.header == "string" ? e.header : e.id;
726
+ return s`
727
+ <luzmo-table-head-cell
728
+ column-id=${e.id}
729
+ ?sortable=${!!e.sortable}
730
+ .resizable=${e.resizable !== !1}
731
+ sort-key=${r}
732
+ .sortDirection=${t?.key === r ? t.direction : void 0}
733
+ .width=${e.width}
734
+ .minWidth=${e.minWidth}
735
+ .maxWidth=${e.maxWidth}
736
+ .lineClamp=${e.lineClamp}
737
+ .resizeLabel=${n.resizeLabel(i)}
738
+ >${e.header}</luzmo-table-head-cell
739
+ >
740
+ `;
741
+ });
742
+ return s`
743
+ <luzmo-table-head .expandable=${n.expandable}
744
+ >${r}</luzmo-table-head
745
+ >
746
+ `;
747
+ }, Pe = (e, t, n) => {
748
+ let { item: r, index: i } = e;
749
+ return n ? n(r, i) : e.information ? s`<luzmo-table-cell span-all
750
+ >${t[0] ? H(t[0], r) : ""}</luzmo-table-cell
751
+ >` : t.map((e) => s`
752
+ <luzmo-table-cell .columnLineClamp=${e.lineClamp}
753
+ >${e.cell ? e.cell(r, i) : H(e, r)}</luzmo-table-cell
754
+ >
755
+ `);
756
+ }, Fe = (e, t, { columns: n, renderItem: r, itemLabel: i, selectRowLabel: a }) => i ? i(e.item, e.index) : (!r && n[0] ? H(n[0], e.item) : "") || j(a, { index: String(t + 1) }), U = (e) => s`
757
+ <div
758
+ class="virtual-spacer"
759
+ aria-hidden="true"
760
+ style=${y({ blockSize: `${e}px` })}
761
+ ></div>
762
+ `, Ie = (e) => {
763
+ let { rows: t, columns: n, renderItem: r, selects: i, rowIndexOffset: a } = e, o = a !== void 0;
764
+ return s`
765
+ <luzmo-table-body>
766
+ ${o ? U(e.paddingStart) : c}
767
+ ${ee(t, ({ record: e }) => e.value, ({ record: t, position: l }) => {
768
+ let u = !!i && !t.information, d = e.expandable && !t.information, f = d && e.isExpanded(t.value), p = l === e.rowCount - 1, m = e.ariaIndexes?.get(t.value), h = m?.row ?? (a === void 0 ? void 0 : l + a), g = s`${s`
769
+ <luzmo-table-row
770
+ value=${t.value}
771
+ data-index=${_(o ? void 0 : l)}
772
+ aria-rowindex=${_(h)}
773
+ ?data-last-row=${p}
774
+ .selectable=${u}
775
+ .selected=${u && e.isSelected(t.value)}
776
+ .selectionColumn=${!!i}
777
+ .selectsSingle=${i === "single"}
778
+ .emphasized=${e.emphasized}
779
+ .checkboxLabel=${u ? Fe(t, l, e) : ""}
780
+ .checkboxSize=${e.checkboxSize}
781
+ .expandable=${d}
782
+ .expanded=${f}
783
+ .expansionColumn=${e.expandable && !d}
784
+ .spanAll=${t.information}
785
+ .disclosureLabel=${d ? e.expandLabel(t, l) : ""}
786
+ .detailsId=${d ? T(t.value) : ""}
787
+ >${Pe(t, n, r)}</luzmo-table-row
788
+ >
789
+ `}${d ? s`
790
+ <luzmo-table-row-details
791
+ id=${T(t.value)}
792
+ .open=${f}
793
+ aria-rowindex=${_(m?.details)}
794
+ ?data-last-row=${p}
795
+ >${e.renderDetails?.(t.item, t.index)}</luzmo-table-row-details
796
+ >
797
+ ` : c}`;
798
+ return o ? s`<div class="row-group" data-index=${l}>${g}</div>` : g;
799
+ })}
800
+ ${o ? U(e.paddingEnd) : c}
801
+ </luzmo-table-body>
802
+ `;
803
+ }, Le = ":host{box-sizing:border-box;font-family:var(--luzmo-font-family);font-size:var(--table-font-size);line-height:var(--luzmo-line-height);color:var(--table-font-color);background-color:var(--luzmo-table-background-color,var(--table-background-color));border-radius:var(--luzmo-table-border-radius,var(--table-border-radius));flex-direction:column;display:flex;position:relative;overflow:hidden;border-width:var(--table-border-width)!important;border-style:solid!important;border-color:var(--highcontrast-table-border-color,var(--luzmo-table-border-color,var(--table-border-color)))!important}slot.data::slotted(luzmo-table-body){display:none}:host{--table-font-size:var(--luzmo-font-size-m);--table-font-color:var(--luzmo-font-color);--table-background-color:var(--luzmo-background-color);--table-border-width:var(--luzmo-border-width);--table-border-color:var(--luzmo-border-color);--table-column-divider-width:0px;--table-column-divider-color:var(--table-border-color);--table-border-radius:var(--luzmo-border-radius);--table-row-min-block-size:calc(var(--luzmo-component-height) + var(--luzmo-spacing-3));--table-row-density-offset:0px;--table-cell-padding-block:var(--luzmo-spacing-2);--table-cell-padding-inline:var(--luzmo-spacing-4);--table-checkbox-cell-inline-size:calc(var(--luzmo-icon-size-m) + var(--luzmo-spacing-4) * 2);--table-disclosure-cell-inline-size:var(--table-checkbox-cell-inline-size);--table-sort-icon-size:var(--luzmo-icon-size-m);--table-row-selected-background-color:var(--luzmo-background-color-highlight);--table-row-selected-hover-background-color:var(--luzmo-background-color-highlight-hover);--table-body-overflow:hidden;--table-corner-radius:max(0px, calc(var(--luzmo-table-border-radius,var(--table-border-radius)) - var(--table-border-width)))}:host([size=s]){--table-font-size:var(--luzmo-font-size-s);--table-row-min-block-size:calc(var(--luzmo-component-height-s) + var(--luzmo-spacing-2));--table-cell-padding-inline:var(--luzmo-spacing-3);--table-checkbox-cell-inline-size:calc(var(--luzmo-icon-size-s) + var(--luzmo-spacing-3) * 2);--table-sort-icon-size:var(--luzmo-icon-size-s)}:host([size=l]){--table-font-size:var(--luzmo-font-size-l);--table-row-min-block-size:calc(var(--luzmo-component-height-l) + var(--luzmo-spacing-3));--table-cell-padding-inline:var(--luzmo-spacing-5);--table-checkbox-cell-inline-size:calc(var(--luzmo-icon-size-l) + var(--luzmo-spacing-5) * 2);--table-sort-icon-size:var(--luzmo-icon-size-l)}:host([size=xl]){--table-font-size:var(--luzmo-font-size-xl);--table-row-min-block-size:calc(var(--luzmo-component-height-xl) + var(--luzmo-spacing-5));--table-cell-padding-inline:var(--luzmo-spacing-5);--table-checkbox-cell-inline-size:calc(var(--luzmo-icon-size-xl) + var(--luzmo-spacing-5) * 2);--table-sort-icon-size:var(--luzmo-icon-size-xl)}:host([density=compact]){--table-row-density-offset:calc(var(--luzmo-spacing-3) * -1);--table-cell-padding-block:var(--luzmo-spacing-1)}:host([density=spacious]){--table-row-density-offset:var(--luzmo-spacing-3);--table-cell-padding-block:var(--luzmo-spacing-3)}:host([emphasized]){--table-row-selected-background-color:rgba(var(--luzmo-primary-rgb), .1);--table-row-selected-hover-background-color:rgba(var(--luzmo-primary-rgb), .16)}:host([quiet]){--table-border-width:0px;--table-background-color:rgba(var(--luzmo-background-color-rgb), 0);--table-border-radius:0px}:host([scroller]),:host([virtualized]){--table-body-overflow:auto}@media (forced-colors:active){:host{--highcontrast-table-border-color:CanvasText;--highcontrast-table-column-divider-color:CanvasText}}", Re = [
804
+ "items",
805
+ "itemValue",
806
+ "selects",
807
+ "selected",
808
+ "columns",
809
+ "expanded",
810
+ "renderDetails",
811
+ "columnWidths",
812
+ "_sort",
813
+ "_clientSort",
814
+ "_lightDomVersion",
815
+ N,
816
+ i
817
+ ], ze = [
818
+ "labels",
819
+ "selectAllLabel",
820
+ "emphasized",
821
+ "size"
822
+ ], W = /* @__PURE__ */ new Set([
823
+ "luzmo-table-cell",
824
+ "luzmo-table-head-cell",
825
+ "luzmo-table-checkbox-cell"
826
+ ]), Be = [
827
+ "a[href]",
828
+ "button",
829
+ "input",
830
+ "select",
831
+ "textarea",
832
+ "label",
833
+ "summary",
834
+ "[contenteditable=\"\"]",
835
+ "[contenteditable=\"true\"]",
836
+ "[role=\"button\"]",
837
+ "[role=\"link\"]",
838
+ "[role=\"checkbox\"]",
839
+ "[role=\"switch\"]",
840
+ "[role=\"menuitem\"]"
841
+ ].join(","), Ve = "textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"], input:not([type=\"checkbox\"]):not([type=\"radio\"]):not([type=\"button\"]):not([type=\"submit\"]):not([type=\"reset\"])", He = [
842
+ "columns",
843
+ "columnWidths",
844
+ "selects",
845
+ "items",
846
+ "renderDetails",
847
+ "_lightDomVersion"
848
+ ], G = (e) => e instanceof HTMLElement, K = class extends n(e) {
849
+ static get styles() {
850
+ return z(super.styles, Le);
851
+ }
852
+ constructor() {
853
+ super(), this.role = "grid", this.emphasized = !1, this.quiet = !1, this.scroller = !1, this.selected = [], this.expanded = [], this.columnWidths = {}, this.columns = [], this.virtualized = !1, this.labels = {}, this._clientSort = !0, this._mode = "declarative", this._rows = [], this._rowKeys = [], this._warnedSlottedRows = !1, this.model = new Se(), this.language = new a(this), this.announcer = new le(this), this.layout = new Oe(this, {
854
+ model: this.model,
855
+ owns: (e) => this._owns(e)
856
+ }), this.resize = new we(this, {
857
+ owns: (e) => this._owns(e),
858
+ isLTR: () => this.isLTR,
859
+ language: () => this.language.language,
860
+ labels: () => this.labels,
861
+ selectAllLabel: () => this.selectAllLabel,
862
+ layouts: () => this.layout.layouts(),
863
+ headCells: () => this.layout.headCells(),
864
+ announce: (e) => {
865
+ this.announcer.announce(e);
866
+ }
867
+ }), this.expansion = new De(this, {
868
+ owns: (e) => this._owns(e),
869
+ focusDisclosure: (e) => {
870
+ this._activeCell = e, this.navigation.focusElement(e);
871
+ }
872
+ }), this._lightDomVersion = 0, this._modelSynced = !1, this.lightObserver = new MutationObserver(() => {
873
+ this._lightDomVersion += 1;
874
+ }), this.directionManaged = /* @__PURE__ */ new Set(), this.directionObserver = new MutationObserver(() => {
875
+ for (let e of this.directionManaged) this._syncDirection(e);
876
+ }), this.navigation = new Ee(this, {
877
+ direction: "grid",
878
+ elements: () => this._gridRows().flat(),
879
+ rows: () => this._gridRows(),
880
+ isLTR: () => this.isLTR,
881
+ focusInIndex: (e) => this._gridEntryIndex(e)
882
+ }), this.virtualizer = new je(this, {
883
+ getScrollElement: () => this.shadowRoot?.querySelector("luzmo-table-body") ?? null,
884
+ getRowElements: () => this.virtualizer.enabled ? [...this.shadowRoot?.querySelectorAll(".row-group") ?? []] : this._rowElements(),
885
+ isRendered: (e) => !!e.querySelector("luzmo-table-row")?.hasUpdated,
886
+ onRangeChanged: (e) => this.dispatchEvent(new CustomEvent("luzmo-range-changed", {
887
+ bubbles: !0,
888
+ composed: !0,
889
+ detail: e
890
+ }))
891
+ }), this.handleChange = (e) => {
892
+ if (!this._owns(e)) return;
893
+ let t = e.composedPath(), n = t.find((e) => G(e) && e.localName === "luzmo-table-checkbox-cell");
894
+ if (!n) return;
895
+ if (e.stopPropagation(), e.preventDefault(), n.headCell) {
896
+ this._toggleAll();
897
+ return;
898
+ }
899
+ let r = t.find((e) => G(e) && e.localName === "luzmo-table-row");
900
+ r && this._toggleRow(r);
901
+ }, this.handleClick = (e) => {
902
+ if (!this._owns(e)) return;
903
+ let t = e.composedPath(), n = t.some((e) => G(e) && e.localName === "luzmo-table-disclosure-cell"), r = t.find((e) => G(e) && e.localName === "luzmo-table-row");
904
+ if (n && r) {
905
+ this.expansion.toggle(r);
906
+ return;
907
+ }
908
+ if (!r) return;
909
+ let i = t.indexOf(r);
910
+ if (!t.slice(0, i).some((e) => G(e) && (e.localName === "luzmo-table-checkbox-cell" || e.localName === "luzmo-table-disclosure-cell" || e.matches(Be)))) {
911
+ if (this.selects) {
912
+ this._toggleRow(r);
913
+ return;
914
+ }
915
+ r.expandable && this.expansion.toggle(r);
916
+ }
917
+ }, this.handleFocusin = (e) => {
918
+ if (!this._owns(e)) return;
919
+ let t = this._gridElementFromPath(e.composedPath());
920
+ t && this.navigation.elements.includes(t) && (this._activeCell = t);
921
+ }, this.handleKeydown = (e) => {
922
+ if (e.defaultPrevented || !this._owns(e)) return;
923
+ let t = e.composedPath(), n = this._cellFromPath(t), r = this._gridElementFromPath(t), i = t[0], a = i === r;
924
+ if (!a && G(i) && i.matches(Ve)) return;
925
+ if (e.code === "Escape") {
926
+ this.expansion.collapseFromPath(t);
927
+ return;
928
+ }
929
+ if (M(t)) {
930
+ this.resize.handleKeydown(e);
931
+ return;
932
+ }
933
+ let o = this._virtualNavigationTarget(e);
934
+ if (o) {
935
+ e.preventDefault(), e.stopImmediatePropagation(), this._focusVirtualCell(o.index, o.column);
936
+ return;
937
+ }
938
+ if (r && (e.code === "Space" || e.code === "Enter" || e.code === "NumpadEnter")) {
939
+ if (e.repeat) {
940
+ a && e.preventDefault();
941
+ return;
942
+ }
943
+ if (a && r.localName === "luzmo-table-disclosure-cell") {
944
+ e.preventDefault();
945
+ let n = t.find((e) => G(e) && e.localName === "luzmo-table-row");
946
+ n && this.expansion.toggle(n);
947
+ return;
948
+ }
949
+ a && n && n.localName !== "luzmo-table-head-cell" && this.selects && (e.preventDefault(), this._activateCell(n));
950
+ }
951
+ }, this.handleSorted = (e) => {
952
+ if (!this._owns(e)) return;
953
+ let { sortKey: t, sortDirection: n } = e.detail, r = this._cellFromPath(e.composedPath())?.textContent?.trim() || t;
954
+ queueMicrotask(() => {
955
+ let i = A(this.labels, this.selectAllLabel);
956
+ this._sort = {
957
+ key: t,
958
+ direction: n
959
+ }, this._clientSort = !e.defaultPrevented, this.announcer.announce(j(n === "asc" ? i.sortAscending : i.sortDescending, { column: r }));
960
+ });
961
+ }, this.addEventListener("change", this.handleChange, { capture: !0 }), this.addEventListener("click", this.handleClick), this.addEventListener("keydown", this.handleKeydown), this.addEventListener("focusin", this.handleFocusin), this.addEventListener("luzmo-table-sorted", this.handleSorted);
962
+ }
963
+ get _isDataMode() {
964
+ return this._mode === "data";
965
+ }
966
+ focus(e) {
967
+ let t = this.navigation.elements, n = (this._activeCell && t.includes(this._activeCell) ? this._activeCell : void 0) ?? t[this._gridEntryIndex(t)];
968
+ n && this.navigation.focusElement(n, e);
969
+ }
970
+ scrollToIndex(e) {
971
+ if (this.virtualizer.enabled) {
972
+ this.virtualizer.scrollToIndex(e);
973
+ return;
974
+ }
975
+ this._rowElements()[e]?.scrollIntoView({ block: "nearest" });
976
+ }
977
+ startManagingContentDirection(e) {
978
+ this.directionManaged.add(e), this._syncDirection(e);
979
+ }
980
+ stopManagingContentDirection(e) {
981
+ this.directionManaged.delete(e);
982
+ }
983
+ connectedCallback() {
984
+ super.connectedCallback(), this.directionObserver.observe(this, {
985
+ attributes: !0,
986
+ attributeFilter: ["dir"]
987
+ }), this.lightObserver.observe(this, {
988
+ childList: !0,
989
+ subtree: !0,
990
+ characterData: !0,
991
+ attributes: !0,
992
+ attributeFilter: [
993
+ "value",
994
+ "expanded",
995
+ "line-clamp",
996
+ "width",
997
+ "min-width",
998
+ "max-width",
999
+ "resizable",
1000
+ "column-id",
1001
+ "sort-key"
1002
+ ]
1003
+ });
1004
+ }
1005
+ disconnectedCallback() {
1006
+ this.lightObserver.disconnect(), this.directionObserver.disconnect(), super.disconnectedCallback();
1007
+ }
1008
+ willUpdate(e) {
1009
+ super.willUpdate(e);
1010
+ let t = e;
1011
+ e.has("selects") && this.selects !== "single" && this.selects !== "multiple" && (this.selects = void 0);
1012
+ let n = Array.isArray(this.items) ? "data" : "declarative", r = n !== this._mode;
1013
+ if (r && (this._mode = n, this._sort = void 0, this._clientSort = !0, this._activeCell = void 0, this._warnedSlottedRows = !1, this.hasUpdated && !e.has("selected") && (this.selected = []), this.hasUpdated && !e.has("expanded") && (this.expanded = []), this.expansion.clear()), this._isDataMode && !this._sort && (this._sort = this._initialSort()), this.virtualizer.enabled = this._isDataMode && this.virtualized, (!this.hasUpdated || r || He.some((e) => t.has(e))) && this.layout.applyGridMetrics(), this._modelSynced = !this.hasUpdated || r || Re.some((e) => t.has(e)), !this._modelSynced) return;
1014
+ this.model.selects = this.selects, this.model.locale = this.language.language, this.model.setRecords(this._createRecords()), this.model.setSelected(this.selected), this.model.setSorting(this._isDataMode ? this._sort : void 0, !this._clientSort);
1015
+ let i = this.model.rows;
1016
+ (i.length !== this._rows.length || i.some((e, t) => e.value !== this._rows[t]?.value)) && (this._rowKeys = i.map((e) => e.value)), this._rows = i;
1017
+ }
1018
+ render() {
1019
+ return s`
1020
+ <slot class=${this._mode}></slot>
1021
+ ${this._isDataMode ? this._renderData() : c}
1022
+ `;
1023
+ }
1024
+ updated(e) {
1025
+ super.updated(e), e.has("selects") && (this.selects === "multiple" ? this.setAttribute("aria-multiselectable", "true") : this.removeAttribute("aria-multiselectable"));
1026
+ let t = this._modelSynced;
1027
+ if (this._modelSynced = !1, t || e.has("virtualized")) if (this.virtualizer.enabled) {
1028
+ let e = this._rows.filter((e) => this.expanded.includes(e.value)).length;
1029
+ this.setAttribute("aria-rowcount", String(this._rows.length + e + +!!this._head()));
1030
+ } else this.removeAttribute("aria-rowcount");
1031
+ let n = e;
1032
+ (t || ze.some((e) => n.has(e))) && (this.layout.syncPresentation(), this._isDataMode && this._warnSlottedRows()), (t || n.has("columnWidths") || n.has("virtualized") || n.has("renderItem") || n.has(L)) && this._refreshNavigation();
1033
+ }
1034
+ _renderData() {
1035
+ let e = A(this.labels, this.selectAllLabel), t = this._slottedHead(), n = !!t || this.columns.length > 0, r = this.virtualizer.enabled ? this.virtualizer.sync(this._rowKeys) : void 0, i = r ? r.filter((e) => this._rows[e.index]).map((e) => ({
1036
+ record: this._rows[e.index],
1037
+ position: e.index
1038
+ })) : this._rows.map((e, t) => ({
1039
+ record: e,
1040
+ position: t
1041
+ })), a = r?.[0], o = r?.at(-1);
1042
+ return s`
1043
+ ${t || this.columns.length === 0 ? c : Ne(this.columns, this._sort, {
1044
+ expandable: this.layout.hasExpansion(),
1045
+ resizeLabel: (t) => j(e.resizeColumn, { column: t })
1046
+ })}
1047
+ ${Ie({
1048
+ rows: i,
1049
+ rowCount: this._rows.length,
1050
+ columns: this.columns,
1051
+ renderItem: this.renderItem,
1052
+ itemLabel: this.itemLabel,
1053
+ selectRowLabel: e.selectRow,
1054
+ selects: this.selects,
1055
+ isSelected: (e) => this.model.isSelected(e),
1056
+ emphasized: this.emphasized,
1057
+ checkboxSize: this.size,
1058
+ rowIndexOffset: r ? n ? 2 : 1 : void 0,
1059
+ paddingStart: a?.start ?? 0,
1060
+ paddingEnd: o ? this.virtualizer.totalSize - o.end : 0,
1061
+ expandable: this.layout.hasExpansion(),
1062
+ isExpanded: (e) => this.expanded.includes(e),
1063
+ expandLabel: (t, n) => j(this.expanded.includes(t.value) ? e.collapseRow : e.expandRow, {
1064
+ label: this._rowLabel(t, n),
1065
+ index: String(n + 1)
1066
+ }),
1067
+ renderDetails: this.renderDetails,
1068
+ closing: this.expansion.closing,
1069
+ ariaIndexes: r ? this._ariaIndexes(n) : void 0
1070
+ })}
1071
+ `;
1072
+ }
1073
+ _syncDirection(e) {
1074
+ e.dir !== this.dir && (e.dir = this.dir);
1075
+ }
1076
+ _rowLabel(e, t) {
1077
+ if (this.itemLabel) return this.itemLabel(e.item, e.index);
1078
+ let n = this.columns[0], r = n ? e.item[n.accessorKey ?? n.id] : void 0;
1079
+ return typeof r == "string" || typeof r == "number" ? String(r) : e.value || String(t + 1);
1080
+ }
1081
+ _ariaIndexes(e) {
1082
+ let t = /* @__PURE__ */ new Map(), n = e ? 2 : 1;
1083
+ for (let e of this._rows) {
1084
+ let r = { row: n };
1085
+ n += 1, this.expanded.includes(e.value) && (r.details = n, n += 1), t.set(e.value, r);
1086
+ }
1087
+ return t;
1088
+ }
1089
+ _owns(e) {
1090
+ for (let t of e.composedPath()) if (t instanceof HTMLElement && t.localName === "luzmo-table") return t === this;
1091
+ return !0;
1092
+ }
1093
+ _initialSort() {
1094
+ let e = this.columns.find((e) => e.sortable && e.sortDirection);
1095
+ if (e?.sortDirection) return {
1096
+ key: V(e),
1097
+ direction: e.sortDirection
1098
+ };
1099
+ let t = this._slottedHead()?.querySelector(":scope > luzmo-table-head-cell[sortable][sort-direction]"), n = t?.getAttribute("sort-direction");
1100
+ if (t && (n === "asc" || n === "desc")) return {
1101
+ key: t.getAttribute("sort-key") ?? "",
1102
+ direction: n
1103
+ };
1104
+ }
1105
+ _createRecords() {
1106
+ return this._isDataMode ? be(this.items ?? [], this.itemValue) : this._declarativeRows().map((e, t) => ({
1107
+ item: {},
1108
+ value: e.value || String(t),
1109
+ index: t,
1110
+ information: !1
1111
+ }));
1112
+ }
1113
+ _slottedHead() {
1114
+ return this.querySelector(":scope > luzmo-table-head");
1115
+ }
1116
+ _declarativeRows() {
1117
+ return [...this.querySelectorAll(":scope > luzmo-table-body > luzmo-table-row")];
1118
+ }
1119
+ _head() {
1120
+ return this._slottedHead() ?? (this._isDataMode ? this.shadowRoot?.querySelector("luzmo-table-head") ?? null : null);
1121
+ }
1122
+ _rowElements() {
1123
+ return this._isDataMode ? [...this.shadowRoot?.querySelectorAll("luzmo-table-row") ?? []] : this._declarativeRows();
1124
+ }
1125
+ _gridRows() {
1126
+ let e = [];
1127
+ for (let t of this._rowElements()) {
1128
+ let n = this._gridCells(t);
1129
+ n.length > 0 && e.push(n);
1130
+ let r = P(t), i = r && !r.hidden ? r.shadowRoot?.querySelector(".cell[role=\"gridcell\"]") : void 0;
1131
+ i && e.push([i]);
1132
+ }
1133
+ return e;
1134
+ }
1135
+ _gridEntryIndex(e) {
1136
+ let t = this._activeCell ? e.indexOf(this._activeCell) : -1;
1137
+ return Math.max(t, 0);
1138
+ }
1139
+ _virtualNavigationTarget(e) {
1140
+ if (!this.virtualizer.enabled || this._rows.length === 0) return;
1141
+ let t = this._gridElementFromPath(e.composedPath()), n = this._gridRows(), r = t ? n.findIndex((e) => e.includes(t)) : -1;
1142
+ if (!t || r === -1) return;
1143
+ let i = this._virtualDataIndex(t);
1144
+ if (i === void 0) return;
1145
+ let a = n[r].indexOf(t), o = e.ctrlKey || e.metaKey, s = this._rows.length - 1;
1146
+ if (o && e.code === "End") return {
1147
+ index: s,
1148
+ column: 2 ** 53 - 1
1149
+ };
1150
+ if (o && e.code === "Home") return {
1151
+ index: 0,
1152
+ column: 0
1153
+ };
1154
+ if (e.code === "ArrowDown" && r === n.length - 1 && i < s) return {
1155
+ index: i + 1,
1156
+ column: a
1157
+ };
1158
+ if (e.code === "ArrowUp" && r === 0 && i > 0) return {
1159
+ index: i - 1,
1160
+ column: a
1161
+ };
1162
+ }
1163
+ _virtualDataIndex(e) {
1164
+ let t = e.getRootNode(), n = (t instanceof ShadowRoot && t.host !== this ? t.host : e).closest(".row-group")?.dataset.index;
1165
+ if (!n) return;
1166
+ let r = Number(n);
1167
+ return Number.isInteger(r) ? r : void 0;
1168
+ }
1169
+ async _focusVirtualCell(e, t) {
1170
+ let n = await this._mountedVirtualRow(e);
1171
+ if (!n) return;
1172
+ await n.updateComplete, await this._refreshNavigation();
1173
+ let r = this._gridCells(n), i = r[Math.min(t, Math.max(r.length - 1, 0))];
1174
+ i && (this._activeCell = i, this.navigation.focusElement(i));
1175
+ }
1176
+ async _mountedVirtualRow(e) {
1177
+ let t = () => this._rowElements().find((t) => Number(t.closest(".row-group")?.dataset.index) === e);
1178
+ for (let n = 0; n < 8; n += 1) {
1179
+ this.virtualizer.scrollToIndex(e), await this.updateComplete, await new Promise((e) => {
1180
+ requestAnimationFrame(() => {
1181
+ e();
1182
+ });
1183
+ });
1184
+ let n = t();
1185
+ if (n) return n;
1186
+ }
1187
+ }
1188
+ _gridCells(e) {
1189
+ return [
1190
+ e.shadowRoot?.querySelector("luzmo-table-checkbox-cell"),
1191
+ e.shadowRoot?.querySelector("luzmo-table-disclosure-cell"),
1192
+ ...[...e.children].filter((e) => G(e) && W.has(e.localName))
1193
+ ].filter((e) => e ? e.getAttribute("aria-hidden") !== "true" : !1);
1194
+ }
1195
+ _warnSlottedRows() {
1196
+ this._warnedSlottedRows || this._declarativeRows().length === 0 || (this._warnedSlottedRows = !0, console.warn("luzmo-table renders rows from `items`; slotted luzmo-table-row elements are ignored while `items` is set."));
1197
+ }
1198
+ async _refreshNavigation() {
1199
+ let e = this._head(), t = this._rowElements().map((e) => P(e)).filter((e) => !!e);
1200
+ await Promise.all([
1201
+ ...e ? [e] : [],
1202
+ ...this._rowElements(),
1203
+ ...t
1204
+ ].map((e) => e.updateComplete)), e && this.layout.syncHeadTabStops(), this.navigation.clearElementCache();
1205
+ let n = this._activeCell ? this.navigation.elements.indexOf(this._activeCell) : -1;
1206
+ n > -1 && (this.navigation.currentIndex = n);
1207
+ }
1208
+ _commitSelection(e) {
1209
+ let t = this.selected;
1210
+ this.selected = e, this.dispatchEvent(new Event("change", {
1211
+ bubbles: !0,
1212
+ composed: !0,
1213
+ cancelable: !0
1214
+ })) || (this.selected = t);
1215
+ }
1216
+ _toggleRow(e) {
1217
+ if (!e.selectable) return;
1218
+ let t = this._isDataMode ? e.value : e.value || String(this._declarativeRows().indexOf(e)), n = this.model.toggle(t);
1219
+ n && this._commitSelection(n);
1220
+ }
1221
+ _toggleAll() {
1222
+ this.selects === "multiple" && this._commitSelection(this.model.toggleAll(!this.model.allSelected));
1223
+ }
1224
+ _activateCell(e) {
1225
+ if (e.localName === "luzmo-table-head-cell" || !this.selects) return;
1226
+ let t = e;
1227
+ if (e.localName === "luzmo-table-checkbox-cell" && t.headCell) {
1228
+ this._toggleAll();
1229
+ return;
1230
+ }
1231
+ let n = e.parentElement ?? e.getRootNode().host;
1232
+ n?.localName === "luzmo-table-row" && this._toggleRow(n);
1233
+ }
1234
+ _cellFromPath(e) {
1235
+ return e.find((e) => G(e) && W.has(e.localName));
1236
+ }
1237
+ _gridElementFromPath(e) {
1238
+ return M(e) ?? e.find((e) => G(e) && (e.localName === "luzmo-table-disclosure-cell" || e.classList.contains("cell") && e.getAttribute("role") === "gridcell")) ?? this._cellFromPath(e);
1239
+ }
1240
+ };
1241
+ t([u({ reflect: !0 })], K.prototype, "role", void 0), t([u({ reflect: !0 })], K.prototype, "density", void 0), t([u({
1242
+ type: Boolean,
1243
+ reflect: !0
1244
+ })], K.prototype, "emphasized", void 0), t([u({
1245
+ type: Boolean,
1246
+ reflect: !0
1247
+ })], K.prototype, "quiet", void 0), t([u({
1248
+ type: Boolean,
1249
+ reflect: !0
1250
+ })], K.prototype, "scroller", void 0), t([u({ reflect: !0 })], K.prototype, "selects", void 0), t([u({ attribute: !1 })], K.prototype, "selected", void 0), t([u({
1251
+ reflect: !0,
1252
+ attribute: "select-all-label"
1253
+ })], K.prototype, "selectAllLabel", void 0), t([u({ attribute: !1 })], K.prototype, "items", void 0), t([u({ attribute: !1 })], K.prototype, "itemValue", void 0), t([u({ attribute: !1 })], K.prototype, "itemLabel", void 0), t([u({ attribute: !1 })], K.prototype, "renderItem", void 0), t([u({ attribute: !1 })], K.prototype, "expanded", void 0), t([u({ attribute: !1 })], K.prototype, "renderDetails", void 0), t([u({ attribute: !1 })], K.prototype, "columnWidths", void 0), t([u({ attribute: !1 })], K.prototype, "columns", void 0), t([u({
1254
+ type: Boolean,
1255
+ reflect: !0
1256
+ })], K.prototype, "virtualized", void 0), t([u({ attribute: !1 })], K.prototype, "labels", void 0), t([f()], K.prototype, "_sort", void 0), t([f()], K.prototype, "_clientSort", void 0), t([f()], K.prototype, "_lightDomVersion", void 0);
1257
+ //#endregion
1258
+ //#region src/components/table/table-body.module.scss?inline
1259
+ var Ue = ":host{box-sizing:border-box;min-block-size:0;min-inline-size:0;overflow-x:auto;overflow-y:var(--table-body-overflow,visible);overflow-anchor:none;outline:none;flex:auto;display:block}:host::-webkit-scrollbar{width:var(--luzmo-table-scrollbar-width,var(--table-body-scrollbar-width));height:var(--luzmo-table-scrollbar-width,var(--table-body-scrollbar-width))}:host::-webkit-scrollbar-track{background:var(--luzmo-table-scrollbar-track-background,var(--table-body-scrollbar-track-background));border-radius:var(--luzmo-table-scrollbar-track-border-radius,var(--table-body-scrollbar-track-border-radius))}:host::-webkit-scrollbar-thumb{background:var(--luzmo-table-scrollbar-thumb-background,var(--table-body-scrollbar-thumb-background));border-radius:var(--luzmo-table-scrollbar-thumb-border-radius,var(--table-body-scrollbar-thumb-border-radius))}:host::-webkit-scrollbar-thumb:hover{background:var(--luzmo-table-scrollbar-thumb-hover-background,var(--table-body-scrollbar-thumb-hover-background))}:host{scrollbar-width:var(--luzmo-scrollbar-width,thin);scrollbar-color:var(--luzmo-table-scrollbar-thumb-background,var(--table-body-scrollbar-thumb-background)) var(--luzmo-table-scrollbar-track-background,var(--table-body-scrollbar-track-background))}::slotted(.row-group),::slotted(.virtual-spacer){min-inline-size:var(--table-min-inline-size,0);overflow-anchor:none;display:flow-root}:host(:focus-visible){outline:var(--table-body-focus-indicator-width) solid var(--highcontrast-table-body-focus-indicator-color,var(--table-body-focus-indicator-color));outline-offset:calc(var(--table-body-focus-indicator-width) * -1);border-end-end-radius:var(--table-corner-radius,0);border-end-start-radius:var(--table-corner-radius,0)}:host{--table-body-scrollbar-width:var(--luzmo-scrollbar-size);--table-body-scrollbar-track-background:var(--luzmo-scrollbar-track-background);--table-body-scrollbar-track-border-radius:var(--luzmo-scrollbar-track-border-radius);--table-body-scrollbar-thumb-background:var(--luzmo-scrollbar-thumb-background);--table-body-scrollbar-thumb-border-radius:var(--luzmo-scrollbar-thumb-border-radius);--table-body-scrollbar-thumb-hover-background:var(--luzmo-scrollbar-thumb-hover-background);--table-body-focus-indicator-width:calc(var(--luzmo-indicator-width) * 2);--table-body-focus-indicator-color:var(--luzmo-indicator-color)}@media (forced-colors:active){:host{--highcontrast-table-body-focus-indicator-color:Highlight}}", q = class extends e {
1260
+ static get styles() {
1261
+ return z(super.styles, Ue);
1262
+ }
1263
+ constructor() {
1264
+ super(), this.role = "rowgroup", this._handleScroll = () => {
1265
+ this.dispatchEvent(new Event("luzmo-table-body-scroll", {
1266
+ bubbles: !0,
1267
+ composed: !0
1268
+ }));
1269
+ }, this.addEventListener("scroll", this._handleScroll);
1270
+ }
1271
+ connectedCallback() {
1272
+ super.connectedCallback(), this.resizeObserver ??= new ResizeObserver(() => this._syncTabStop()), this.mutationObserver ??= new MutationObserver(() => this._syncTabStop()), this.resizeObserver.observe(this), this.mutationObserver.observe(this, { childList: !0 });
1273
+ }
1274
+ disconnectedCallback() {
1275
+ this.resizeObserver?.disconnect(), this.mutationObserver?.disconnect(), super.disconnectedCallback();
1276
+ }
1277
+ render() {
1278
+ return s`<slot @slotchange=${this._syncTabStop}></slot>`;
1279
+ }
1280
+ _syncTabStop() {
1281
+ this.scrollHeight > this.clientHeight || this.scrollWidth > this.clientWidth ? this.setAttribute("tabindex", "0") : this.removeAttribute("tabindex");
1282
+ }
1283
+ };
1284
+ t([u({ reflect: !0 })], q.prototype, "role", void 0);
1285
+ //#endregion
1286
+ //#region src/components/table/table-cell.module.scss?inline
1287
+ var We = ":host{box-sizing:border-box;min-inline-size:0;padding-block:var(--table-cell-padding-block);padding-inline:var(--luzmo-table-cell-padding-inline,var(--table-cell-padding-inline));outline:none;align-self:stretch;align-items:center;display:flex;border-block:none!important;border-inline-start:none!important;border-inline-end-width:var(--luzmo-table-column-divider-width,var(--table-column-divider-width))!important;border-inline-end-style:solid!important;border-inline-end-color:var(--highcontrast-table-column-divider-color,var(--luzmo-table-column-divider-color,var(--table-column-divider-color)))!important}:host([span-all]){grid-column:1/-1;border-inline-end-width:0!important}:host(:last-of-type){border-inline-end-width:0!important}.content{overflow-wrap:anywhere;min-inline-size:0;overflow:hidden}.content.clamped{-webkit-line-clamp:var(--table-cell-line-clamp);line-clamp:var(--table-cell-line-clamp);-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}:host(:focus-visible){outline:var(--luzmo-indicator-width,2px) solid var(--highcontrast-table-cell-focus-indicator-color,var(--luzmo-indicator-color,currentColor));outline-offset:calc(var(--luzmo-indicator-width,2px) * -1);border-start-start-radius:var(--table-focus-start-start-radius,0);border-start-end-radius:var(--table-focus-start-end-radius,0);border-end-end-radius:var(--table-focus-end-end-radius,0);border-end-start-radius:var(--table-focus-end-start-radius,0)}:host{--table-cell-focus-indicator-width:var(--luzmo-indicator-width);--table-cell-focus-indicator-color:var(--luzmo-indicator-color)}@media (forced-colors:active){:host{--highcontrast-table-cell-focus-indicator-color:Highlight}}", J = class extends e {
1288
+ constructor(...e) {
1289
+ super(...e), this.role = "gridcell", this.spanAll = !1;
1290
+ }
1291
+ static get styles() {
1292
+ return z(super.styles, We);
1293
+ }
1294
+ willUpdate(e) {
1295
+ super.willUpdate(e), e.has("lineClamp") && !w(this.lineClamp) && (this.lineClamp = void 0);
1296
+ }
1297
+ render() {
1298
+ let e = w(this.lineClamp) ?? w(this.columnLineClamp);
1299
+ return s`
1300
+ <div
1301
+ class=${v({
1302
+ content: !0,
1303
+ clamped: e !== void 0
1304
+ })}
1305
+ style=${y(e ? { "--table-cell-line-clamp": String(e) } : {})}
1306
+ >
1307
+ <slot></slot>
1308
+ </div>
1309
+ `;
1310
+ }
1311
+ };
1312
+ t([u({ reflect: !0 })], J.prototype, "role", void 0), t([u({
1313
+ type: Number,
1314
+ reflect: !0,
1315
+ attribute: "line-clamp"
1316
+ })], J.prototype, "lineClamp", void 0), t([u({
1317
+ type: Boolean,
1318
+ reflect: !0,
1319
+ attribute: "span-all"
1320
+ })], J.prototype, "spanAll", void 0), t([f()], J.prototype, "columnLineClamp", void 0);
1321
+ //#endregion
1322
+ //#region src/components/table/table-checkbox-cell.module.scss?inline
1323
+ var Ge = ":host{flex:0 0 var(--table-checkbox-cell-inline-size);box-sizing:border-box;padding-block:var(--table-cell-padding-block);outline:none;justify-content:center;align-self:stretch;align-items:center;display:flex;border-block:none!important;border-inline-start:none!important;border-inline-end-width:var(--luzmo-table-column-divider-width,var(--table-column-divider-width))!important;border-inline-end-style:solid!important;border-inline-end-color:var(--highcontrast-table-column-divider-color,var(--luzmo-table-column-divider-color,var(--table-column-divider-color)))!important}:host(:focus-visible){outline:var(--luzmo-indicator-width,2px) solid var(--highcontrast-table-checkbox-cell-focus-indicator-color,var(--luzmo-indicator-color,currentColor));outline-offset:calc(var(--luzmo-indicator-width,2px) * -1);border-start-start-radius:var(--table-focus-start-start-radius,0);border-start-end-radius:var(--table-focus-start-end-radius,0);border-end-end-radius:var(--table-focus-end-end-radius,0);border-end-start-radius:var(--table-focus-end-start-radius,0)}.checkbox{margin:0}.label{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}:host{--table-checkbox-cell-focus-indicator-width:var(--luzmo-indicator-width);--table-checkbox-cell-focus-indicator-color:var(--luzmo-indicator-color)}@media (forced-colors:active){:host{--highcontrast-table-checkbox-cell-focus-indicator-color:Highlight}}", Y = class extends e {
1324
+ static get styles() {
1325
+ return z(super.styles, Ge);
1326
+ }
1327
+ constructor() {
1328
+ super(), this.role = "gridcell", this.headCell = !1, this.checked = !1, this.indeterminate = !1, this.disabled = !1, this.selectsSingle = !1, this.emphasized = !1, this.label = "", this.size = "m", this.handleClick = (e) => {
1329
+ !this.checkbox || e.composedPath().includes(this.checkbox) || this.checkbox.click();
1330
+ }, this.addEventListener("click", this.handleClick);
1331
+ }
1332
+ render() {
1333
+ return this.headCell && this.selectsSingle ? c : s`
1334
+ <luzmo-checkbox
1335
+ class="checkbox"
1336
+ tabindex="-1"
1337
+ size=${this.size}
1338
+ .checked=${this.checked}
1339
+ .indeterminate=${this.indeterminate}
1340
+ ?disabled=${this.disabled}
1341
+ ?emphasized=${this.emphasized}
1342
+ aria-hidden=${_(this.selectsSingle ? "true" : void 0)}
1343
+ >
1344
+ ${this.label ? s`<span class="label">${this.label}</span>` : c}
1345
+ </luzmo-checkbox>
1346
+ `;
1347
+ }
1348
+ willUpdate(e) {
1349
+ super.willUpdate(e), (e.has("headCell") || e.has("selectsSingle")) && (this.role = this.headCell && !this.selectsSingle ? "columnheader" : "gridcell"), e.has("selectsSingle") && (this.selectsSingle ? (this.setAttribute("aria-hidden", "true"), this.tabIndex = -1) : this.removeAttribute("aria-hidden"));
1350
+ }
1351
+ };
1352
+ t([u({ reflect: !0 })], Y.prototype, "role", void 0), t([u({
1353
+ type: Boolean,
1354
+ reflect: !0,
1355
+ attribute: "head-cell"
1356
+ })], Y.prototype, "headCell", void 0), t([u({
1357
+ type: Boolean,
1358
+ reflect: !0
1359
+ })], Y.prototype, "checked", void 0), t([u({
1360
+ type: Boolean,
1361
+ reflect: !0
1362
+ })], Y.prototype, "indeterminate", void 0), t([u({
1363
+ type: Boolean,
1364
+ reflect: !0
1365
+ })], Y.prototype, "disabled", void 0), t([u({
1366
+ type: Boolean,
1367
+ reflect: !0,
1368
+ attribute: "selects-single"
1369
+ })], Y.prototype, "selectsSingle", void 0), t([u({
1370
+ type: Boolean,
1371
+ reflect: !0
1372
+ })], Y.prototype, "emphasized", void 0), t([u({ reflect: !0 })], Y.prototype, "label", void 0), t([f()], Y.prototype, "size", void 0), t([d("luzmo-checkbox")], Y.prototype, "checkbox", void 0);
1373
+ //#endregion
1374
+ //#region src/components/table/table-head.module.scss?inline
1375
+ var Ke = ":host{grid-template-columns:var(--table-grid-columns);min-inline-size:var(--table-min-inline-size,0);box-sizing:border-box;min-block-size:calc(var(--luzmo-table-row-min-block-size,var(--table-row-min-block-size)) + var(--table-row-density-offset));background-color:var(--table-head-background-color);flex:none;align-items:stretch;display:grid;border-block-start:none!important;border-inline:none!important;border-block-end-width:var(--table-head-divider-width)!important;border-block-end-style:solid!important;border-block-end-color:var(--highcontrast-table-head-divider-color,var(--luzmo-table-border-color,var(--table-head-divider-color)))!important}luzmo-table-checkbox-cell,.leading::slotted(luzmo-table-head-cell:first-of-type){--table-focus-start-start-radius:var(--table-corner-radius)}.disclosure-spacer{box-sizing:border-box;inline-size:var(--table-disclosure-cell-inline-size);align-self:stretch;border-block:none!important;border-inline-start:none!important;border-inline-end-width:var(--luzmo-table-column-divider-width,var(--table-column-divider-width))!important;border-inline-end-style:solid!important;border-inline-end-color:var(--highcontrast-table-column-divider-color,var(--luzmo-table-column-divider-color,var(--table-column-divider-color)))!important}:host{--table-head-background-color:rgba(var(--luzmo-background-color-rgb), 0);--table-head-divider-color:var(--luzmo-border-color);--table-head-divider-width:var(--luzmo-border-width)}@media (forced-colors:active){:host{--highcontrast-table-head-divider-color:CanvasText}}", X = class extends e {
1376
+ static get styles() {
1377
+ return z(super.styles, Ke);
1378
+ }
1379
+ constructor() {
1380
+ super(), this.role = "row", this.selected = !1, this.checked = !1, this.indeterminate = !1, this.emphasized = !1, this.checkboxLabel = "", this.checkboxSize = "m", this.expandable = !1, this.handleSorted = (e) => {
1381
+ if (e.defaultPrevented) return;
1382
+ let t = e.target;
1383
+ for (let e of this.querySelectorAll(":scope > luzmo-table-head-cell")) e !== t && (e.sortDirection = void 0);
1384
+ }, this.addEventListener("luzmo-table-sorted", this.handleSorted);
1385
+ }
1386
+ render() {
1387
+ return s`${this.selects ? s`
1388
+ <luzmo-table-checkbox-cell
1389
+ head-cell
1390
+ .checked=${this.checked}
1391
+ .indeterminate=${this.indeterminate}
1392
+ .selectsSingle=${this.selects === "single"}
1393
+ .emphasized=${this.emphasized}
1394
+ .label=${this.checkboxLabel}
1395
+ .size=${this.checkboxSize}
1396
+ ></luzmo-table-checkbox-cell>
1397
+ ` : c}${this.expandable ? s`<span class="disclosure-spacer" role="gridcell"></span>` : c}<slot
1398
+ class=${!this.selects && !this.expandable ? "leading" : ""}
1399
+ ></slot>`;
1400
+ }
1401
+ };
1402
+ t([u({ reflect: !0 })], X.prototype, "role", void 0), t([u({
1403
+ type: Boolean,
1404
+ reflect: !0
1405
+ })], X.prototype, "selected", void 0), t([f()], X.prototype, "selects", void 0), t([f()], X.prototype, "checked", void 0), t([f()], X.prototype, "indeterminate", void 0), t([f()], X.prototype, "emphasized", void 0), t([f()], X.prototype, "checkboxLabel", void 0), t([f()], X.prototype, "checkboxSize", void 0), t([f()], X.prototype, "expandable", void 0);
1406
+ //#endregion
1407
+ //#region src/components/table/table-head-cell.module.scss?inline
1408
+ var qe = ":host{align-self:stretch;align-items:center;gap:var(--luzmo-spacing-2);box-sizing:border-box;min-inline-size:0;padding-block:var(--table-cell-padding-block);padding-inline:var(--luzmo-table-cell-padding-inline,var(--table-cell-padding-inline));font-weight:var(--table-head-cell-font-weight);color:var(--table-head-cell-font-color);text-align:start;outline:none;display:flex;position:relative;border-block:none!important;border-inline-start:none!important;border-inline-end-width:var(--luzmo-table-column-divider-width,var(--table-column-divider-width))!important;border-inline-end-style:solid!important;border-inline-end-color:var(--highcontrast-table-column-divider-color,var(--luzmo-table-column-divider-color,var(--table-column-divider-color)))!important}:host(:last-of-type){--table-focus-start-end-radius:var(--table-corner-radius);border-inline-end-width:0!important}.content{overflow-wrap:anywhere;flex:auto;min-inline-size:0;overflow:hidden}.content.clamped{-webkit-line-clamp:var(--table-cell-line-clamp);line-clamp:var(--table-cell-line-clamp);-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.resize-handle{z-index:1;inline-size:var(--luzmo-component-height-xs);box-sizing:border-box;cursor:col-resize;touch-action:none;justify-content:center;align-items:stretch;display:flex;position:absolute;inset-block:0;inset-inline-end:calc(var(--luzmo-spacing-4) * -1)}.resize-handle:before{content:\"\";inline-size:var(--luzmo-indicator-gap,2px);background:var(--luzmo-indicator-color,currentColor);opacity:0}.resize-handle:hover:before,.resize-handle:active:before,.resize-handle:focus-visible:before{opacity:1}:host(:last-of-type) .resize-handle{justify-content:flex-end;inset-inline-end:0}.resize-handle:focus,.resize-handle:focus-visible{outline:none}:host([sortable]){cursor:pointer;-webkit-user-select:none;user-select:none}:host([sortable]:hover){color:var(--table-head-cell-font-color-hover)}:host([active]){color:var(--table-head-cell-font-color-down)}:host(:focus-visible){outline:var(--luzmo-indicator-width,2px) solid var(--highcontrast-table-head-cell-focus-indicator-color,var(--luzmo-indicator-color,currentColor));outline-offset:calc(var(--luzmo-indicator-width,2px) * -1);border-start-start-radius:var(--table-focus-start-start-radius,0);border-start-end-radius:var(--table-focus-start-end-radius,0);border-end-end-radius:var(--table-focus-end-end-radius,0);border-end-start-radius:var(--table-focus-end-start-radius,0)}.sort-icon{inline-size:var(--table-sort-icon-size);block-size:var(--table-sort-icon-size);flex:none;display:inline-flex}.sort-icon svg{fill:currentColor;block-size:100%;inline-size:100%}@media (forced-colors:active){.resize-handle:before{background:canvastext}}:host{--table-head-cell-font-weight:var(--luzmo-font-weight-bold);--table-head-cell-font-color:var(--luzmo-font-color);--table-head-cell-font-color-hover:var(--luzmo-font-color-hover);--table-head-cell-font-color-down:var(--luzmo-font-color-down);--table-head-cell-focus-indicator-width:var(--luzmo-indicator-width);--table-head-cell-focus-indicator-color:var(--luzmo-indicator-color)}@media (forced-colors:active){:host{--highcontrast-table-head-cell-focus-indicator-color:Highlight}}", Z = class extends e {
1409
+ static get styles() {
1410
+ return z(super.styles, qe);
1411
+ }
1412
+ constructor() {
1413
+ super(), this.role = "columnheader", this.active = !1, this.sortable = !1, this.sortKey = "", this.columnId = "", this.resizable = !1, this.currentWidth = 0, this.resizeLabel = "", this.handleClick = (e) => {
1414
+ e.composedPath().some((e) => e instanceof HTMLElement && e.classList.contains("resize-handle")) || this._sort();
1415
+ }, this.handleKeydown = (e) => {
1416
+ !this.sortable || e.composedPath()[0] !== this || (e.code === "Enter" || e.code === "NumpadEnter" ? (e.preventDefault(), this._sort()) : e.code === "Space" && (e.preventDefault(), this.active = !0));
1417
+ }, this.handleKeyup = (e) => {
1418
+ e.code !== "Space" || !this.active || (this.active = !1, this._sort());
1419
+ }, this.handleBlur = () => {
1420
+ this.active = !1;
1421
+ }, this.addEventListener("click", this.handleClick), this.addEventListener("keydown", this.handleKeydown), this.addEventListener("keyup", this.handleKeyup), this.addEventListener("blur", this.handleBlur);
1422
+ }
1423
+ toLayout(e) {
1424
+ return {
1425
+ id: this.columnId || this.sortKey || `column-${e}`,
1426
+ header: this.textContent?.trim() || this.columnId || this.sortKey,
1427
+ width: w(this.width),
1428
+ minWidth: w(this.minWidth),
1429
+ maxWidth: w(this.maxWidth),
1430
+ resizable: this.resizable,
1431
+ lineClamp: w(this.lineClamp)
1432
+ };
1433
+ }
1434
+ render() {
1435
+ let e = w(this.lineClamp), t = this.sortable && this.sortDirection ? s`<span class="sort-icon" aria-hidden="true"
1436
+ >${g(this.sortDirection === "asc" ? h : m)}</span
1437
+ >` : c, n = this.toLayout(0), r = this.resizable ? s`
1438
+ <div
1439
+ class="resize-handle"
1440
+ tabindex="0"
1441
+ role="separator"
1442
+ aria-orientation="vertical"
1443
+ aria-valuemin=${E(n)}
1444
+ aria-valuemax=${D(n)}
1445
+ aria-valuenow=${Math.round(this.currentWidth)}
1446
+ aria-label=${_(this.resizeLabel || void 0)}
1447
+ aria-keyshortcuts="ArrowLeft ArrowRight PageUp PageDown Home End"
1448
+ ></div>
1449
+ ` : c;
1450
+ return s`
1451
+ <div
1452
+ class=${v({
1453
+ content: !0,
1454
+ clamped: e !== void 0
1455
+ })}
1456
+ style=${y(e ? { "--table-cell-line-clamp": String(e) } : {})}
1457
+ >
1458
+ <slot></slot>
1459
+ </div>
1460
+ ${t}${r}
1461
+ `;
1462
+ }
1463
+ updated(e) {
1464
+ super.updated(e), (e.has("sortable") || e.has("sortDirection")) && (this.sortable ? this.setAttribute("aria-sort", ve(this.sortDirection)) : this.removeAttribute("aria-sort"));
1465
+ }
1466
+ _sort() {
1467
+ this.sortable && (this.sortDirection = ye(this.sortDirection), this.dispatchEvent(new CustomEvent("luzmo-table-sorted", {
1468
+ bubbles: !0,
1469
+ composed: !0,
1470
+ cancelable: !0,
1471
+ detail: {
1472
+ sortKey: this.sortKey,
1473
+ sortDirection: this.sortDirection
1474
+ }
1475
+ })));
1476
+ }
1477
+ };
1478
+ t([u({ reflect: !0 })], Z.prototype, "role", void 0), t([u({
1479
+ type: Boolean,
1480
+ reflect: !0
1481
+ })], Z.prototype, "active", void 0), t([u({
1482
+ type: Boolean,
1483
+ reflect: !0
1484
+ })], Z.prototype, "sortable", void 0), t([u({
1485
+ reflect: !0,
1486
+ attribute: "sort-direction"
1487
+ })], Z.prototype, "sortDirection", void 0), t([u({
1488
+ reflect: !0,
1489
+ attribute: "sort-key"
1490
+ })], Z.prototype, "sortKey", void 0), t([u({
1491
+ reflect: !0,
1492
+ attribute: "column-id"
1493
+ })], Z.prototype, "columnId", void 0), t([u({
1494
+ type: Number,
1495
+ reflect: !0
1496
+ })], Z.prototype, "width", void 0), t([u({
1497
+ type: Number,
1498
+ reflect: !0,
1499
+ attribute: "min-width"
1500
+ })], Z.prototype, "minWidth", void 0), t([u({
1501
+ type: Number,
1502
+ reflect: !0,
1503
+ attribute: "max-width"
1504
+ })], Z.prototype, "maxWidth", void 0), t([u({
1505
+ type: Boolean,
1506
+ reflect: !0
1507
+ })], Z.prototype, "resizable", void 0), t([u({
1508
+ type: Number,
1509
+ reflect: !0,
1510
+ attribute: "line-clamp"
1511
+ })], Z.prototype, "lineClamp", void 0), t([f()], Z.prototype, "currentWidth", void 0), t([f()], Z.prototype, "resizeLabel", void 0);
1512
+ //#endregion
1513
+ //#region src/components/table/table-disclosure-cell.module.scss?inline
1514
+ var Je = ":host{flex:0 0 var(--table-disclosure-cell-inline-size);box-sizing:border-box;min-inline-size:var(--table-disclosure-cell-inline-size);outline:none;justify-content:center;align-self:stretch;align-items:center;display:flex;border-block:none!important;border-inline-start:none!important;border-inline-end-width:var(--luzmo-table-column-divider-width,var(--table-column-divider-width))!important;border-inline-end-style:solid!important;border-inline-end-color:var(--highcontrast-table-column-divider-color,var(--luzmo-table-column-divider-color,var(--table-column-divider-color)))!important}:host(:focus-visible){outline:var(--luzmo-indicator-width,2px) solid var(--highcontrast-table-disclosure-cell-focus-indicator-color,var(--luzmo-indicator-color,currentColor));outline-offset:calc(var(--luzmo-indicator-width,2px) * -1);border-start-start-radius:var(--table-focus-start-start-radius,0);border-start-end-radius:var(--table-focus-start-end-radius,0);border-end-end-radius:var(--table-focus-end-end-radius,0);border-end-start-radius:var(--table-focus-end-start-radius,0)}.button{block-size:100%;inline-size:100%;min-inline-size:var(--luzmo-component-height-xs);min-block-size:var(--luzmo-component-height-xs);background:rgba(var(--luzmo-background-color-rgb), 0);color:inherit;cursor:pointer;border:0;outline:none;justify-content:center;align-items:center;margin:0;padding:0;display:inline-flex}.icon{inline-size:var(--table-sort-icon-size);block-size:var(--table-sort-icon-size);display:inline-flex;transform:rotate(-90deg)}.icon svg{fill:currentColor;block-size:100%;inline-size:100%}:host([expanded]) .icon{transform:rotate(0)}:host([dir=rtl]:not([expanded])) .icon{transform:rotate(90deg)}@media (prefers-reduced-motion:no-preference){.icon{transition:transform var(--luzmo-animation-duration) ease}}:host{--table-disclosure-cell-focus-indicator-width:var(--luzmo-indicator-width);--table-disclosure-cell-focus-indicator-color:var(--luzmo-indicator-color)}@media (forced-colors:active){:host{--highcontrast-table-disclosure-cell-focus-indicator-color:Highlight}}", Q = class extends e {
1515
+ constructor(...e) {
1516
+ super(...e), this.role = "gridcell", this.expanded = !1, this.label = "";
1517
+ }
1518
+ static get styles() {
1519
+ return z(super.styles, Je);
1520
+ }
1521
+ render() {
1522
+ return s`
1523
+ <button
1524
+ type="button"
1525
+ class="button"
1526
+ tabindex="-1"
1527
+ aria-expanded=${String(this.expanded)}
1528
+ aria-label=${_(this.label || void 0)}
1529
+ >
1530
+ <span class="icon" aria-hidden="true"
1531
+ >${g(p)}</span
1532
+ >
1533
+ </button>
1534
+ `;
1535
+ }
1536
+ };
1537
+ t([u({ reflect: !0 })], Q.prototype, "role", void 0), t([u({
1538
+ type: Boolean,
1539
+ reflect: !0
1540
+ })], Q.prototype, "expanded", void 0), t([u({ reflect: !0 })], Q.prototype, "label", void 0);
1541
+ //#endregion
1542
+ //#region src/components/table/table-row.module.scss?inline
1543
+ var Ye = ":host{grid-template-columns:var(--table-grid-columns);min-inline-size:var(--table-min-inline-size,0);box-sizing:border-box;min-block-size:calc(var(--luzmo-table-row-min-block-size,var(--table-row-min-block-size)) + var(--table-row-density-offset));align-items:stretch;display:grid;border-block-start:none!important;border-inline:none!important;border-block-end-width:var(--table-row-divider-width)!important;border-block-end-style:solid!important;border-block-end-color:var(--highcontrast-table-row-divider-color,var(--luzmo-table-border-color,var(--table-row-divider-color)))!important}:host([data-last-row]:not([expanded])){border-block-end-width:0!important}:host([data-last-row]:not([expanded])) .leading:not(slot),:host([data-last-row]:not([expanded])) slot.leading::slotted(luzmo-table-cell:first-of-type){--table-focus-end-start-radius:var(--table-corner-radius)}:host([data-last-row]:not([expanded])) ::slotted(luzmo-table-cell:last-of-type){--table-focus-end-end-radius:var(--table-corner-radius)}:host([selectable]){cursor:pointer}:host([selectable]:hover){background-color:var(--table-row-hover-background-color)}:host([selected]){background-color:var(--luzmo-table-row-selected-background-color,var(--table-row-selected-background-color))}:host([selected]:hover){background-color:var(--luzmo-table-row-selected-background-color,var(--table-row-selected-hover-background-color))}.selection-spacer{inline-size:var(--table-checkbox-cell-inline-size)}.selection-spacer,.disclosure-spacer{box-sizing:border-box;align-self:stretch;border-block:none!important;border-inline-start:none!important;border-inline-end-width:var(--luzmo-table-column-divider-width,var(--table-column-divider-width))!important;border-inline-end-style:solid!important;border-inline-end-color:var(--highcontrast-table-column-divider-color,var(--luzmo-table-column-divider-color,var(--table-column-divider-color)))!important}.disclosure-spacer{inline-size:var(--table-disclosure-cell-inline-size)}@media (forced-colors:active){:host([selected]){forced-color-adjust:none;color:highlighttext;background-color:highlight}}:host{--table-row-divider-color:var(--luzmo-border-color);--table-row-divider-width:var(--luzmo-border-width);--table-row-hover-background-color:var(--luzmo-background-color-hover)}@media (forced-colors:active){:host{--highcontrast-table-row-divider-color:CanvasText}}", $ = class extends e {
1544
+ constructor(...e) {
1545
+ super(...e), this.role = "row", this.value = "", this.selected = !1, this.selectable = !1, this.expanded = !1, this.expandable = !1, this.selectsSingle = !1, this.emphasized = !1, this.selectionColumn = !1, this.expansionColumn = !1, this.spanAll = !1, this.checkboxLabel = "", this.disclosureLabel = "", this.detailsId = "", this.checkboxSize = "m";
1546
+ }
1547
+ static get styles() {
1548
+ return z(super.styles, Ye);
1549
+ }
1550
+ render() {
1551
+ if (this.spanAll) return s`<slot class="leading"></slot>`;
1552
+ let e = this.selectable || this.selectionColumn, t = !e && (this.expandable || this.expansionColumn), n = c;
1553
+ this.selectable ? n = s`
1554
+ <luzmo-table-checkbox-cell
1555
+ class="leading"
1556
+ .checked=${this.selected}
1557
+ .selectsSingle=${this.selectsSingle}
1558
+ .emphasized=${this.emphasized}
1559
+ .label=${this.checkboxLabel}
1560
+ .size=${this.checkboxSize}
1561
+ ></luzmo-table-checkbox-cell>
1562
+ ` : this.selectionColumn && (n = s`<span class="selection-spacer"></span>`);
1563
+ let r = c;
1564
+ return this.expandable ? r = s`
1565
+ <luzmo-table-disclosure-cell
1566
+ class=${t ? "leading" : ""}
1567
+ .expanded=${this.expanded}
1568
+ .label=${this.disclosureLabel}
1569
+ ></luzmo-table-disclosure-cell>
1570
+ ` : this.expansionColumn && (r = s`<span class="disclosure-spacer"></span>`), s`${n}${r}<slot
1571
+ class=${!e && !t ? "leading" : ""}
1572
+ ></slot>`;
1573
+ }
1574
+ updated(e) {
1575
+ super.updated(e), (e.has("selectable") || e.has("selected")) && (this.selectable ? this.setAttribute("aria-selected", String(this.selected)) : this.removeAttribute("aria-selected")), (e.has("expandable") || e.has("expanded") || e.has("detailsId")) && (this.expandable && this.detailsId ? this.setAttribute("aria-controls", this.detailsId) : this.removeAttribute("aria-controls"));
1576
+ }
1577
+ };
1578
+ t([u({ reflect: !0 })], $.prototype, "role", void 0), t([u({ reflect: !0 })], $.prototype, "value", void 0), t([u({
1579
+ type: Boolean,
1580
+ reflect: !0
1581
+ })], $.prototype, "selected", void 0), t([u({
1582
+ type: Boolean,
1583
+ reflect: !0
1584
+ })], $.prototype, "selectable", void 0), t([u({
1585
+ type: Boolean,
1586
+ reflect: !0
1587
+ })], $.prototype, "expanded", void 0), t([u({
1588
+ type: Boolean,
1589
+ reflect: !0
1590
+ })], $.prototype, "expandable", void 0), t([f()], $.prototype, "selectsSingle", void 0), t([f()], $.prototype, "emphasized", void 0), t([f()], $.prototype, "selectionColumn", void 0), t([f()], $.prototype, "expansionColumn", void 0), t([f()], $.prototype, "spanAll", void 0), t([f()], $.prototype, "checkboxLabel", void 0), t([f()], $.prototype, "disclosureLabel", void 0), t([f()], $.prototype, "detailsId", void 0), t([f()], $.prototype, "checkboxSize", void 0), typeof customElements < "u" && !customElements.get("luzmo-table") && customElements.define("luzmo-table", K), typeof customElements < "u" && !customElements.get("luzmo-table-head") && customElements.define("luzmo-table-head", X), typeof customElements < "u" && !customElements.get("luzmo-table-head-cell") && customElements.define("luzmo-table-head-cell", Z), typeof customElements < "u" && !customElements.get("luzmo-table-body") && customElements.define("luzmo-table-body", q), typeof customElements < "u" && !customElements.get("luzmo-table-row") && customElements.define("luzmo-table-row", $), typeof customElements < "u" && !customElements.get("luzmo-table-cell") && customElements.define("luzmo-table-cell", J), typeof customElements < "u" && !customElements.get("luzmo-table-checkbox-cell") && customElements.define("luzmo-table-checkbox-cell", Y), typeof customElements < "u" && !customElements.get("luzmo-table-disclosure-cell") && customElements.define("luzmo-table-disclosure-cell", Q), typeof customElements < "u" && !customElements.get("luzmo-table-row-details") && customElements.define("luzmo-table-row-details", B);
1591
+ //#endregion
1592
+ export { Y as a, K as c, X as i, B as l, Q as n, J as o, Z as r, q as s, $ as t, k as u };