@hypoth-ui/wc 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +60 -0
- package/dist/button-MKQKTC5Q.js +10 -0
- package/dist/button-MKQKTC5Q.js.map +1 -0
- package/dist/chunk-4HLM6DBG.js +910 -0
- package/dist/chunk-4HLM6DBG.js.map +1 -0
- package/dist/chunk-55ID7LJL.js +3602 -0
- package/dist/chunk-55ID7LJL.js.map +1 -0
- package/dist/chunk-66HFYJD7.js +86 -0
- package/dist/chunk-66HFYJD7.js.map +1 -0
- package/dist/chunk-CZOXIJVS.js +70 -0
- package/dist/chunk-CZOXIJVS.js.map +1 -0
- package/dist/chunk-DHUM4Q5Y.js +495 -0
- package/dist/chunk-DHUM4Q5Y.js.map +1 -0
- package/dist/chunk-DNNI5BDE.js +1842 -0
- package/dist/chunk-DNNI5BDE.js.map +1 -0
- package/dist/chunk-GXKZ6E6K.js +99 -0
- package/dist/chunk-GXKZ6E6K.js.map +1 -0
- package/dist/chunk-H4GJJZ3N.js +51 -0
- package/dist/chunk-H4GJJZ3N.js.map +1 -0
- package/dist/chunk-JMPTFALJ.js +175 -0
- package/dist/chunk-JMPTFALJ.js.map +1 -0
- package/dist/chunk-MYQWCLUJ.js +45 -0
- package/dist/chunk-MYQWCLUJ.js.map +1 -0
- package/dist/chunk-QZSPWT7L.js +183 -0
- package/dist/chunk-QZSPWT7L.js.map +1 -0
- package/dist/chunk-TSKBQCTR.js +5137 -0
- package/dist/chunk-TSKBQCTR.js.map +1 -0
- package/dist/chunk-TXIIUVL3.js +130 -0
- package/dist/chunk-TXIIUVL3.js.map +1 -0
- package/dist/chunk-UM7WRO7W.js +237 -0
- package/dist/chunk-UM7WRO7W.js.map +1 -0
- package/dist/chunk-VPXL4RB3.js +202 -0
- package/dist/chunk-VPXL4RB3.js.map +1 -0
- package/dist/chunk-VX5CKSMN.js +39 -0
- package/dist/chunk-VX5CKSMN.js.map +1 -0
- package/dist/chunk-WQ5BEP3E.js +2845 -0
- package/dist/chunk-WQ5BEP3E.js.map +1 -0
- package/dist/chunk-YDQ434UH.js +60 -0
- package/dist/chunk-YDQ434UH.js.map +1 -0
- package/dist/chunk-ZWV4VI6D.js +153 -0
- package/dist/chunk-ZWV4VI6D.js.map +1 -0
- package/dist/core.d.ts +127 -0
- package/dist/core.js +38 -0
- package/dist/core.js.map +1 -0
- package/dist/data-display.d.ts +872 -0
- package/dist/data-display.js +57 -0
- package/dist/data-display.js.map +1 -0
- package/dist/ds-element-Db0LMfxI.d.ts +43 -0
- package/dist/feedback.d.ts +292 -0
- package/dist/feedback.js +31 -0
- package/dist/feedback.js.map +1 -0
- package/dist/form-controls.d.ts +1713 -0
- package/dist/form-controls.js +63 -0
- package/dist/form-controls.js.map +1 -0
- package/dist/icon-7IZTJ5WT.js +8 -0
- package/dist/icon-7IZTJ5WT.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +423 -0
- package/dist/index.js.map +1 -0
- package/dist/input-LB6UR37A.js +10 -0
- package/dist/input-LB6UR37A.js.map +1 -0
- package/dist/layout.d.ts +504 -0
- package/dist/layout.js +34 -0
- package/dist/layout.js.map +1 -0
- package/dist/link-NHDJ6SFY.js +9 -0
- package/dist/link-NHDJ6SFY.js.map +1 -0
- package/dist/navigation.d.ts +255 -0
- package/dist/navigation.js +111 -0
- package/dist/navigation.js.map +1 -0
- package/dist/overlays.d.ts +1291 -0
- package/dist/overlays.js +106 -0
- package/dist/overlays.js.map +1 -0
- package/dist/primitives.d.ts +230 -0
- package/dist/primitives.js +26 -0
- package/dist/primitives.js.map +1 -0
- package/dist/registry-Bns0t11H.d.ts +233 -0
- package/dist/skeleton-MUdd2029.d.ts +109 -0
- package/dist/spinner-BWaNlc-Y.d.ts +45 -0
- package/dist/spinner-UIYDUVBZ.js +8 -0
- package/dist/spinner-UIYDUVBZ.js.map +1 -0
- package/dist/stepper-CCRwcQOe.d.ts +851 -0
- package/dist/text-MT3S3EMU.js +8 -0
- package/dist/text-MT3S3EMU.js.map +1 -0
- package/dist/visually-hidden-MW2XY4CS.js +8 -0
- package/dist/visually-hidden-MW2XY4CS.js.map +1 -0
- package/package.json +92 -0
|
@@ -0,0 +1,1842 @@
|
|
|
1
|
+
import {
|
|
2
|
+
emitEvent
|
|
3
|
+
} from "./chunk-YDQ434UH.js";
|
|
4
|
+
import {
|
|
5
|
+
DSElement,
|
|
6
|
+
__decorateClass,
|
|
7
|
+
define
|
|
8
|
+
} from "./chunk-H4GJJZ3N.js";
|
|
9
|
+
|
|
10
|
+
// src/components/table/table.ts
|
|
11
|
+
import { html, nothing } from "lit";
|
|
12
|
+
import { property } from "lit/decorators.js";
|
|
13
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
14
|
+
var DsTable = class extends DSElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.size = "default";
|
|
18
|
+
this.striped = false;
|
|
19
|
+
this.borderless = false;
|
|
20
|
+
this.fixed = false;
|
|
21
|
+
this.stickyHeader = false;
|
|
22
|
+
this.caption = "";
|
|
23
|
+
}
|
|
24
|
+
static {
|
|
25
|
+
this.styles = [];
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
const classes = {
|
|
29
|
+
"ds-table": true
|
|
30
|
+
};
|
|
31
|
+
return html`
|
|
32
|
+
<table
|
|
33
|
+
class=${classMap(classes)}
|
|
34
|
+
role="grid"
|
|
35
|
+
data-size=${this.size !== "default" ? this.size : nothing}
|
|
36
|
+
?data-striped=${this.striped}
|
|
37
|
+
?data-borderless=${this.borderless}
|
|
38
|
+
?data-fixed=${this.fixed}
|
|
39
|
+
?data-sticky-header=${this.stickyHeader}
|
|
40
|
+
>
|
|
41
|
+
${this.caption ? html`<caption class="ds-table__caption">${this.caption}</caption>` : nothing}
|
|
42
|
+
<slot></slot>
|
|
43
|
+
</table>
|
|
44
|
+
`;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
__decorateClass([
|
|
48
|
+
property({ type: String, reflect: true })
|
|
49
|
+
], DsTable.prototype, "size", 2);
|
|
50
|
+
__decorateClass([
|
|
51
|
+
property({ type: Boolean, reflect: true })
|
|
52
|
+
], DsTable.prototype, "striped", 2);
|
|
53
|
+
__decorateClass([
|
|
54
|
+
property({ type: Boolean, reflect: true })
|
|
55
|
+
], DsTable.prototype, "borderless", 2);
|
|
56
|
+
__decorateClass([
|
|
57
|
+
property({ type: Boolean, reflect: true })
|
|
58
|
+
], DsTable.prototype, "fixed", 2);
|
|
59
|
+
__decorateClass([
|
|
60
|
+
property({ type: Boolean, attribute: "sticky-header", reflect: true })
|
|
61
|
+
], DsTable.prototype, "stickyHeader", 2);
|
|
62
|
+
__decorateClass([
|
|
63
|
+
property({ type: String })
|
|
64
|
+
], DsTable.prototype, "caption", 2);
|
|
65
|
+
define("ds-table", DsTable);
|
|
66
|
+
|
|
67
|
+
// src/components/table/table-header.ts
|
|
68
|
+
import { html as html2 } from "lit";
|
|
69
|
+
var DsTableHeader = class extends DSElement {
|
|
70
|
+
static {
|
|
71
|
+
this.styles = [];
|
|
72
|
+
}
|
|
73
|
+
render() {
|
|
74
|
+
return html2`
|
|
75
|
+
<thead class="ds-table__header" role="rowgroup">
|
|
76
|
+
<slot></slot>
|
|
77
|
+
</thead>
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
define("ds-table-header", DsTableHeader);
|
|
82
|
+
|
|
83
|
+
// src/components/table/table-body.ts
|
|
84
|
+
import { html as html3 } from "lit";
|
|
85
|
+
var DsTableBody = class extends DSElement {
|
|
86
|
+
static {
|
|
87
|
+
this.styles = [];
|
|
88
|
+
}
|
|
89
|
+
render() {
|
|
90
|
+
return html3`
|
|
91
|
+
<tbody class="ds-table__body" role="rowgroup">
|
|
92
|
+
<slot></slot>
|
|
93
|
+
</tbody>
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
define("ds-table-body", DsTableBody);
|
|
98
|
+
|
|
99
|
+
// src/components/table/table-row.ts
|
|
100
|
+
import { html as html4, nothing as nothing2 } from "lit";
|
|
101
|
+
import { property as property2 } from "lit/decorators.js";
|
|
102
|
+
var DsTableRow = class extends DSElement {
|
|
103
|
+
constructor() {
|
|
104
|
+
super(...arguments);
|
|
105
|
+
this.rowId = "";
|
|
106
|
+
this.selected = false;
|
|
107
|
+
}
|
|
108
|
+
static {
|
|
109
|
+
this.styles = [];
|
|
110
|
+
}
|
|
111
|
+
render() {
|
|
112
|
+
return html4`
|
|
113
|
+
<tr
|
|
114
|
+
class="ds-table__row"
|
|
115
|
+
role="row"
|
|
116
|
+
?data-selected=${this.selected}
|
|
117
|
+
aria-selected=${this.selected ? "true" : nothing2}
|
|
118
|
+
>
|
|
119
|
+
<slot></slot>
|
|
120
|
+
</tr>
|
|
121
|
+
`;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
__decorateClass([
|
|
125
|
+
property2({ type: String, attribute: "row-id" })
|
|
126
|
+
], DsTableRow.prototype, "rowId", 2);
|
|
127
|
+
__decorateClass([
|
|
128
|
+
property2({ type: Boolean, reflect: true })
|
|
129
|
+
], DsTableRow.prototype, "selected", 2);
|
|
130
|
+
define("ds-table-row", DsTableRow);
|
|
131
|
+
|
|
132
|
+
// src/components/table/table-head.ts
|
|
133
|
+
import { html as html5, nothing as nothing3 } from "lit";
|
|
134
|
+
import { property as property3 } from "lit/decorators.js";
|
|
135
|
+
var sortIcon = html5`
|
|
136
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
137
|
+
<path d="M12 5v14M5 12l7-7 7 7" />
|
|
138
|
+
</svg>
|
|
139
|
+
`;
|
|
140
|
+
var DsTableHead = class extends DSElement {
|
|
141
|
+
constructor() {
|
|
142
|
+
super(...arguments);
|
|
143
|
+
this.column = "";
|
|
144
|
+
this.align = "left";
|
|
145
|
+
this.sortable = false;
|
|
146
|
+
this.sortDirection = "none";
|
|
147
|
+
this.width = "";
|
|
148
|
+
}
|
|
149
|
+
static {
|
|
150
|
+
this.styles = [];
|
|
151
|
+
}
|
|
152
|
+
handleClick() {
|
|
153
|
+
if (!this.sortable) return;
|
|
154
|
+
emitEvent(this, "sort", {
|
|
155
|
+
detail: {
|
|
156
|
+
column: this.column,
|
|
157
|
+
direction: this.getNextDirection()
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
handleKeyDown(event) {
|
|
162
|
+
if (!this.sortable) return;
|
|
163
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
164
|
+
event.preventDefault();
|
|
165
|
+
this.handleClick();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
getNextDirection() {
|
|
169
|
+
if (this.sortDirection === "none") return "asc";
|
|
170
|
+
if (this.sortDirection === "asc") return "desc";
|
|
171
|
+
return "none";
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Get the aria-sort attribute value.
|
|
175
|
+
* Per APG, sortable columns should always have aria-sort:
|
|
176
|
+
* - "ascending" for A-Z or low-high sort
|
|
177
|
+
* - "descending" for Z-A or high-low sort
|
|
178
|
+
* - "none" when sortable but not currently sorted
|
|
179
|
+
*/
|
|
180
|
+
getAriaSort() {
|
|
181
|
+
if (this.sortDirection === "asc") return "ascending";
|
|
182
|
+
if (this.sortDirection === "desc") return "descending";
|
|
183
|
+
return "none";
|
|
184
|
+
}
|
|
185
|
+
render() {
|
|
186
|
+
const style = this.width ? `width: ${this.width}` : "";
|
|
187
|
+
return html5`
|
|
188
|
+
<th
|
|
189
|
+
class="ds-table__head"
|
|
190
|
+
role="columnheader"
|
|
191
|
+
scope="col"
|
|
192
|
+
data-align=${this.align !== "left" ? this.align : nothing3}
|
|
193
|
+
?data-sortable=${this.sortable}
|
|
194
|
+
data-sort-direction=${this.sortable ? this.sortDirection : nothing3}
|
|
195
|
+
aria-sort=${this.sortable ? this.getAriaSort() : nothing3}
|
|
196
|
+
tabindex=${this.sortable ? 0 : nothing3}
|
|
197
|
+
style=${style || nothing3}
|
|
198
|
+
@click=${this.handleClick}
|
|
199
|
+
@keydown=${this.handleKeyDown}
|
|
200
|
+
>
|
|
201
|
+
<slot></slot>
|
|
202
|
+
${this.sortable ? html5`<span class="ds-table__sort-icon">${sortIcon}</span>` : nothing3}
|
|
203
|
+
</th>
|
|
204
|
+
`;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
__decorateClass([
|
|
208
|
+
property3({ type: String })
|
|
209
|
+
], DsTableHead.prototype, "column", 2);
|
|
210
|
+
__decorateClass([
|
|
211
|
+
property3({ type: String, reflect: true })
|
|
212
|
+
], DsTableHead.prototype, "align", 2);
|
|
213
|
+
__decorateClass([
|
|
214
|
+
property3({ type: Boolean, reflect: true })
|
|
215
|
+
], DsTableHead.prototype, "sortable", 2);
|
|
216
|
+
__decorateClass([
|
|
217
|
+
property3({ type: String, attribute: "sort-direction", reflect: true })
|
|
218
|
+
], DsTableHead.prototype, "sortDirection", 2);
|
|
219
|
+
__decorateClass([
|
|
220
|
+
property3({ type: String })
|
|
221
|
+
], DsTableHead.prototype, "width", 2);
|
|
222
|
+
define("ds-table-head", DsTableHead);
|
|
223
|
+
|
|
224
|
+
// src/components/table/table-cell.ts
|
|
225
|
+
import { html as html6, nothing as nothing4 } from "lit";
|
|
226
|
+
import { property as property4 } from "lit/decorators.js";
|
|
227
|
+
var DsTableCell = class extends DSElement {
|
|
228
|
+
constructor() {
|
|
229
|
+
super(...arguments);
|
|
230
|
+
this.align = "left";
|
|
231
|
+
this.colspan = 1;
|
|
232
|
+
this.rowspan = 1;
|
|
233
|
+
}
|
|
234
|
+
static {
|
|
235
|
+
this.styles = [];
|
|
236
|
+
}
|
|
237
|
+
render() {
|
|
238
|
+
return html6`
|
|
239
|
+
<td
|
|
240
|
+
class="ds-table__cell"
|
|
241
|
+
role="gridcell"
|
|
242
|
+
data-align=${this.align !== "left" ? this.align : nothing4}
|
|
243
|
+
colspan=${this.colspan > 1 ? this.colspan : nothing4}
|
|
244
|
+
rowspan=${this.rowspan > 1 ? this.rowspan : nothing4}
|
|
245
|
+
>
|
|
246
|
+
<slot></slot>
|
|
247
|
+
</td>
|
|
248
|
+
`;
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
__decorateClass([
|
|
252
|
+
property4({ type: String, reflect: true })
|
|
253
|
+
], DsTableCell.prototype, "align", 2);
|
|
254
|
+
__decorateClass([
|
|
255
|
+
property4({ type: Number })
|
|
256
|
+
], DsTableCell.prototype, "colspan", 2);
|
|
257
|
+
__decorateClass([
|
|
258
|
+
property4({ type: Number })
|
|
259
|
+
], DsTableCell.prototype, "rowspan", 2);
|
|
260
|
+
define("ds-table-cell", DsTableCell);
|
|
261
|
+
|
|
262
|
+
// src/components/data-table/data-table.ts
|
|
263
|
+
import { html as html7, nothing as nothing5 } from "lit";
|
|
264
|
+
import { property as property5, state } from "lit/decorators.js";
|
|
265
|
+
import { classMap as classMap2 } from "lit/directives/class-map.js";
|
|
266
|
+
var chevronIcon = html7`
|
|
267
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
268
|
+
<path d="M15 18l-6-6 6-6" />
|
|
269
|
+
</svg>
|
|
270
|
+
`;
|
|
271
|
+
var DsDataTable = class extends DSElement {
|
|
272
|
+
constructor() {
|
|
273
|
+
super(...arguments);
|
|
274
|
+
this.virtualized = false;
|
|
275
|
+
this.rowHeight = 48;
|
|
276
|
+
this.overscan = 5;
|
|
277
|
+
this.totalRows = 0;
|
|
278
|
+
this.page = 1;
|
|
279
|
+
this.pageSize = 10;
|
|
280
|
+
this.pageSizes = "10,25,50,100";
|
|
281
|
+
this.selectable = false;
|
|
282
|
+
this.selectionMode = "multiple";
|
|
283
|
+
this.loading = false;
|
|
284
|
+
this.sortColumn = "";
|
|
285
|
+
this.sortDirection = "none";
|
|
286
|
+
this.filter = "";
|
|
287
|
+
this.emptyMessage = "No data available";
|
|
288
|
+
this.selectedRows = /* @__PURE__ */ new Set();
|
|
289
|
+
this.sortAnnouncement = "";
|
|
290
|
+
}
|
|
291
|
+
static {
|
|
292
|
+
this.styles = [];
|
|
293
|
+
}
|
|
294
|
+
get pageSizeOptions() {
|
|
295
|
+
return this.pageSizes.split(",").map((s) => Number(s.trim()));
|
|
296
|
+
}
|
|
297
|
+
get totalPages() {
|
|
298
|
+
return Math.ceil(this.totalRows / this.pageSize);
|
|
299
|
+
}
|
|
300
|
+
get startRow() {
|
|
301
|
+
return (this.page - 1) * this.pageSize + 1;
|
|
302
|
+
}
|
|
303
|
+
get endRow() {
|
|
304
|
+
return Math.min(this.page * this.pageSize, this.totalRows);
|
|
305
|
+
}
|
|
306
|
+
handleSort(column) {
|
|
307
|
+
let newDirection = "asc";
|
|
308
|
+
if (this.sortColumn === column) {
|
|
309
|
+
if (this.sortDirection === "asc") {
|
|
310
|
+
newDirection = "desc";
|
|
311
|
+
} else if (this.sortDirection === "desc") {
|
|
312
|
+
newDirection = "none";
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
this.sortColumn = newDirection === "none" ? "" : column;
|
|
316
|
+
this.sortDirection = newDirection;
|
|
317
|
+
this.announceSortChange(column, newDirection);
|
|
318
|
+
emitEvent(this, "sort", {
|
|
319
|
+
detail: {
|
|
320
|
+
column: this.sortColumn,
|
|
321
|
+
direction: this.sortDirection
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Announce sort state changes to screen readers.
|
|
327
|
+
* Uses a live region to provide immediate feedback.
|
|
328
|
+
*/
|
|
329
|
+
announceSortChange(column, direction) {
|
|
330
|
+
if (direction === "asc") {
|
|
331
|
+
this.sortAnnouncement = `Sorted by ${column}, ascending`;
|
|
332
|
+
} else if (direction === "desc") {
|
|
333
|
+
this.sortAnnouncement = `Sorted by ${column}, descending`;
|
|
334
|
+
} else {
|
|
335
|
+
this.sortAnnouncement = "Sort cleared";
|
|
336
|
+
}
|
|
337
|
+
setTimeout(() => {
|
|
338
|
+
this.sortAnnouncement = "";
|
|
339
|
+
}, 1e3);
|
|
340
|
+
}
|
|
341
|
+
handlePageChange(newPage) {
|
|
342
|
+
if (newPage < 1 || newPage > this.totalPages) return;
|
|
343
|
+
this.page = newPage;
|
|
344
|
+
emitEvent(this, "page-change", { detail: { page: newPage } });
|
|
345
|
+
}
|
|
346
|
+
handlePageSizeChange(event) {
|
|
347
|
+
const select = event.target;
|
|
348
|
+
const newSize = Number(select.value);
|
|
349
|
+
this.pageSize = newSize;
|
|
350
|
+
this.page = 1;
|
|
351
|
+
emitEvent(this, "page-size-change", { detail: { pageSize: newSize } });
|
|
352
|
+
}
|
|
353
|
+
toggleRowSelection(rowId) {
|
|
354
|
+
if (!this.selectable) return;
|
|
355
|
+
if (this.selectionMode === "single") {
|
|
356
|
+
this.selectedRows.clear();
|
|
357
|
+
this.selectedRows.add(rowId);
|
|
358
|
+
} else {
|
|
359
|
+
if (this.selectedRows.has(rowId)) {
|
|
360
|
+
this.selectedRows.delete(rowId);
|
|
361
|
+
} else {
|
|
362
|
+
this.selectedRows.add(rowId);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
emitEvent(this, "selection-change", {
|
|
366
|
+
detail: { selectedRows: Array.from(this.selectedRows) }
|
|
367
|
+
});
|
|
368
|
+
this.requestUpdate();
|
|
369
|
+
}
|
|
370
|
+
clearSelection() {
|
|
371
|
+
this.selectedRows.clear();
|
|
372
|
+
emitEvent(this, "selection-change", { detail: { selectedRows: [] } });
|
|
373
|
+
this.requestUpdate();
|
|
374
|
+
}
|
|
375
|
+
isRowSelected(rowId) {
|
|
376
|
+
return this.selectedRows.has(rowId);
|
|
377
|
+
}
|
|
378
|
+
renderPagination() {
|
|
379
|
+
const pages = [];
|
|
380
|
+
const maxButtons = 5;
|
|
381
|
+
let start = Math.max(1, this.page - Math.floor(maxButtons / 2));
|
|
382
|
+
const end = Math.min(this.totalPages, start + maxButtons - 1);
|
|
383
|
+
if (end - start + 1 < maxButtons) {
|
|
384
|
+
start = Math.max(1, end - maxButtons + 1);
|
|
385
|
+
}
|
|
386
|
+
for (let i = start; i <= end; i++) {
|
|
387
|
+
pages.push(i);
|
|
388
|
+
}
|
|
389
|
+
return html7`
|
|
390
|
+
<div class="ds-data-table__pagination">
|
|
391
|
+
<button
|
|
392
|
+
type="button"
|
|
393
|
+
class="ds-data-table__page-button"
|
|
394
|
+
?disabled=${this.page === 1}
|
|
395
|
+
@click=${() => this.handlePageChange(this.page - 1)}
|
|
396
|
+
aria-label="Previous page"
|
|
397
|
+
>
|
|
398
|
+
${chevronIcon}
|
|
399
|
+
</button>
|
|
400
|
+
|
|
401
|
+
${pages.map(
|
|
402
|
+
(p) => html7`
|
|
403
|
+
<button
|
|
404
|
+
type="button"
|
|
405
|
+
class="ds-data-table__page-button"
|
|
406
|
+
?data-active=${p === this.page}
|
|
407
|
+
@click=${() => this.handlePageChange(p)}
|
|
408
|
+
aria-label="Page ${p}"
|
|
409
|
+
aria-current=${p === this.page ? "page" : nothing5}
|
|
410
|
+
>
|
|
411
|
+
${p}
|
|
412
|
+
</button>
|
|
413
|
+
`
|
|
414
|
+
)}
|
|
415
|
+
|
|
416
|
+
<button
|
|
417
|
+
type="button"
|
|
418
|
+
class="ds-data-table__page-button"
|
|
419
|
+
?disabled=${this.page === this.totalPages}
|
|
420
|
+
@click=${() => this.handlePageChange(this.page + 1)}
|
|
421
|
+
aria-label="Next page"
|
|
422
|
+
style="transform: rotate(180deg)"
|
|
423
|
+
>
|
|
424
|
+
${chevronIcon}
|
|
425
|
+
</button>
|
|
426
|
+
</div>
|
|
427
|
+
`;
|
|
428
|
+
}
|
|
429
|
+
render() {
|
|
430
|
+
const classes = {
|
|
431
|
+
"ds-data-table": true
|
|
432
|
+
};
|
|
433
|
+
return html7`
|
|
434
|
+
<div
|
|
435
|
+
class=${classMap2(classes)}
|
|
436
|
+
role="region"
|
|
437
|
+
aria-label="Data table"
|
|
438
|
+
aria-busy=${this.loading ? "true" : nothing5}
|
|
439
|
+
?data-loading=${this.loading}
|
|
440
|
+
>
|
|
441
|
+
<!-- Live region for sort announcements (APG compliance) -->
|
|
442
|
+
<div
|
|
443
|
+
class="ds-data-table__live-region"
|
|
444
|
+
role="status"
|
|
445
|
+
aria-live="polite"
|
|
446
|
+
aria-atomic="true"
|
|
447
|
+
style="position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;"
|
|
448
|
+
>
|
|
449
|
+
${this.sortAnnouncement}
|
|
450
|
+
</div>
|
|
451
|
+
${this.selectedRows.size > 0 ? html7`
|
|
452
|
+
<div class="ds-data-table__selection-info">
|
|
453
|
+
<span class="ds-data-table__selection-count">
|
|
454
|
+
${this.selectedRows.size} selected
|
|
455
|
+
</span>
|
|
456
|
+
<button
|
|
457
|
+
type="button"
|
|
458
|
+
class="ds-data-table__clear-selection"
|
|
459
|
+
@click=${this.clearSelection}
|
|
460
|
+
>
|
|
461
|
+
Clear
|
|
462
|
+
</button>
|
|
463
|
+
</div>
|
|
464
|
+
` : nothing5}
|
|
465
|
+
|
|
466
|
+
<div
|
|
467
|
+
class=${this.virtualized ? "ds-data-table__virtualized" : "ds-data-table__container"}
|
|
468
|
+
>
|
|
469
|
+
<slot></slot>
|
|
470
|
+
|
|
471
|
+
${this.loading ? html7`
|
|
472
|
+
<div class="ds-data-table__loading">
|
|
473
|
+
<ds-spinner size="lg"></ds-spinner>
|
|
474
|
+
</div>
|
|
475
|
+
` : nothing5}
|
|
476
|
+
</div>
|
|
477
|
+
|
|
478
|
+
${this.totalRows > 0 ? html7`
|
|
479
|
+
<div class="ds-data-table__footer">
|
|
480
|
+
<div class="ds-data-table__info">
|
|
481
|
+
Showing ${this.startRow}-${this.endRow} of ${this.totalRows}
|
|
482
|
+
</div>
|
|
483
|
+
|
|
484
|
+
<div class="ds-data-table__per-page">
|
|
485
|
+
<span>Rows per page:</span>
|
|
486
|
+
<select @change=${this.handlePageSizeChange}>
|
|
487
|
+
${this.pageSizeOptions.map(
|
|
488
|
+
(size) => html7`
|
|
489
|
+
<option value=${size} ?selected=${size === this.pageSize}>
|
|
490
|
+
${size}
|
|
491
|
+
</option>
|
|
492
|
+
`
|
|
493
|
+
)}
|
|
494
|
+
</select>
|
|
495
|
+
</div>
|
|
496
|
+
|
|
497
|
+
${this.renderPagination()}
|
|
498
|
+
</div>
|
|
499
|
+
` : nothing5}
|
|
500
|
+
</div>
|
|
501
|
+
`;
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
__decorateClass([
|
|
505
|
+
property5({ type: Boolean, reflect: true })
|
|
506
|
+
], DsDataTable.prototype, "virtualized", 2);
|
|
507
|
+
__decorateClass([
|
|
508
|
+
property5({ type: Number, attribute: "row-height" })
|
|
509
|
+
], DsDataTable.prototype, "rowHeight", 2);
|
|
510
|
+
__decorateClass([
|
|
511
|
+
property5({ type: Number })
|
|
512
|
+
], DsDataTable.prototype, "overscan", 2);
|
|
513
|
+
__decorateClass([
|
|
514
|
+
property5({ type: Number, attribute: "total-rows" })
|
|
515
|
+
], DsDataTable.prototype, "totalRows", 2);
|
|
516
|
+
__decorateClass([
|
|
517
|
+
property5({ type: Number })
|
|
518
|
+
], DsDataTable.prototype, "page", 2);
|
|
519
|
+
__decorateClass([
|
|
520
|
+
property5({ type: Number, attribute: "page-size" })
|
|
521
|
+
], DsDataTable.prototype, "pageSize", 2);
|
|
522
|
+
__decorateClass([
|
|
523
|
+
property5({ type: String, attribute: "page-sizes" })
|
|
524
|
+
], DsDataTable.prototype, "pageSizes", 2);
|
|
525
|
+
__decorateClass([
|
|
526
|
+
property5({ type: Boolean, reflect: true })
|
|
527
|
+
], DsDataTable.prototype, "selectable", 2);
|
|
528
|
+
__decorateClass([
|
|
529
|
+
property5({ type: String, attribute: "selection-mode" })
|
|
530
|
+
], DsDataTable.prototype, "selectionMode", 2);
|
|
531
|
+
__decorateClass([
|
|
532
|
+
property5({ type: Boolean, reflect: true })
|
|
533
|
+
], DsDataTable.prototype, "loading", 2);
|
|
534
|
+
__decorateClass([
|
|
535
|
+
property5({ type: String, attribute: "sort-column" })
|
|
536
|
+
], DsDataTable.prototype, "sortColumn", 2);
|
|
537
|
+
__decorateClass([
|
|
538
|
+
property5({ type: String, attribute: "sort-direction" })
|
|
539
|
+
], DsDataTable.prototype, "sortDirection", 2);
|
|
540
|
+
__decorateClass([
|
|
541
|
+
property5({ type: String })
|
|
542
|
+
], DsDataTable.prototype, "filter", 2);
|
|
543
|
+
__decorateClass([
|
|
544
|
+
property5({ type: String, attribute: "empty-message" })
|
|
545
|
+
], DsDataTable.prototype, "emptyMessage", 2);
|
|
546
|
+
__decorateClass([
|
|
547
|
+
state()
|
|
548
|
+
], DsDataTable.prototype, "selectedRows", 2);
|
|
549
|
+
__decorateClass([
|
|
550
|
+
state()
|
|
551
|
+
], DsDataTable.prototype, "sortAnnouncement", 2);
|
|
552
|
+
define("ds-data-table", DsDataTable);
|
|
553
|
+
|
|
554
|
+
// src/components/avatar/avatar.ts
|
|
555
|
+
import { html as html8, nothing as nothing6 } from "lit";
|
|
556
|
+
import { property as property6, state as state2 } from "lit/decorators.js";
|
|
557
|
+
import { classMap as classMap3 } from "lit/directives/class-map.js";
|
|
558
|
+
var defaultUserIcon = html8`
|
|
559
|
+
<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
560
|
+
<path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" />
|
|
561
|
+
</svg>
|
|
562
|
+
`;
|
|
563
|
+
var DsAvatar = class extends DSElement {
|
|
564
|
+
constructor() {
|
|
565
|
+
super(...arguments);
|
|
566
|
+
this.src = "";
|
|
567
|
+
this.alt = "";
|
|
568
|
+
this.name = "";
|
|
569
|
+
this.size = "md";
|
|
570
|
+
this.shape = "circle";
|
|
571
|
+
this.showStatus = false;
|
|
572
|
+
this.imageError = false;
|
|
573
|
+
}
|
|
574
|
+
static {
|
|
575
|
+
this.styles = [];
|
|
576
|
+
}
|
|
577
|
+
get initials() {
|
|
578
|
+
if (!this.name) return "";
|
|
579
|
+
const names = this.name.trim().split(/\s+/);
|
|
580
|
+
if (names.length === 0) return "";
|
|
581
|
+
if (names.length === 1) {
|
|
582
|
+
return (names[0] ?? "").charAt(0).toUpperCase();
|
|
583
|
+
}
|
|
584
|
+
const first = names[0] ?? "";
|
|
585
|
+
const last = names[names.length - 1] ?? "";
|
|
586
|
+
return (first.charAt(0) + last.charAt(0)).toUpperCase();
|
|
587
|
+
}
|
|
588
|
+
get showImage() {
|
|
589
|
+
return Boolean(this.src && !this.imageError);
|
|
590
|
+
}
|
|
591
|
+
get showInitials() {
|
|
592
|
+
return !this.showImage && Boolean(this.initials);
|
|
593
|
+
}
|
|
594
|
+
get showIcon() {
|
|
595
|
+
return !this.showImage && !this.showInitials;
|
|
596
|
+
}
|
|
597
|
+
handleImageError() {
|
|
598
|
+
this.imageError = true;
|
|
599
|
+
}
|
|
600
|
+
handleImageLoad() {
|
|
601
|
+
this.imageError = false;
|
|
602
|
+
}
|
|
603
|
+
render() {
|
|
604
|
+
const classes = {
|
|
605
|
+
"ds-avatar": true
|
|
606
|
+
};
|
|
607
|
+
return html8`
|
|
608
|
+
<span
|
|
609
|
+
class=${classMap3(classes)}
|
|
610
|
+
role="img"
|
|
611
|
+
aria-label=${this.alt || this.name || "Avatar"}
|
|
612
|
+
data-size=${this.size}
|
|
613
|
+
data-shape=${this.shape !== "circle" ? this.shape : nothing6}
|
|
614
|
+
>
|
|
615
|
+
${this.showImage ? html8`
|
|
616
|
+
<img
|
|
617
|
+
part="image"
|
|
618
|
+
class="ds-avatar__image"
|
|
619
|
+
src=${this.src}
|
|
620
|
+
alt=""
|
|
621
|
+
@error=${this.handleImageError}
|
|
622
|
+
@load=${this.handleImageLoad}
|
|
623
|
+
/>
|
|
624
|
+
` : nothing6}
|
|
625
|
+
${this.showInitials ? html8`
|
|
626
|
+
<span part="initials" class="ds-avatar__initials">
|
|
627
|
+
${this.initials}
|
|
628
|
+
</span>
|
|
629
|
+
` : nothing6}
|
|
630
|
+
${this.showIcon ? html8`
|
|
631
|
+
<span part="icon" class="ds-avatar__icon">
|
|
632
|
+
${defaultUserIcon}
|
|
633
|
+
</span>
|
|
634
|
+
` : nothing6}
|
|
635
|
+
${this.showStatus && this.status ? html8`
|
|
636
|
+
<span
|
|
637
|
+
part="status"
|
|
638
|
+
class="ds-avatar__status"
|
|
639
|
+
data-status=${this.status}
|
|
640
|
+
aria-label=${`Status: ${this.status}`}
|
|
641
|
+
></span>
|
|
642
|
+
` : nothing6}
|
|
643
|
+
</span>
|
|
644
|
+
`;
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
__decorateClass([
|
|
648
|
+
property6({ type: String })
|
|
649
|
+
], DsAvatar.prototype, "src", 2);
|
|
650
|
+
__decorateClass([
|
|
651
|
+
property6({ type: String })
|
|
652
|
+
], DsAvatar.prototype, "alt", 2);
|
|
653
|
+
__decorateClass([
|
|
654
|
+
property6({ type: String })
|
|
655
|
+
], DsAvatar.prototype, "name", 2);
|
|
656
|
+
__decorateClass([
|
|
657
|
+
property6({ type: String, reflect: true })
|
|
658
|
+
], DsAvatar.prototype, "size", 2);
|
|
659
|
+
__decorateClass([
|
|
660
|
+
property6({ type: String, reflect: true })
|
|
661
|
+
], DsAvatar.prototype, "shape", 2);
|
|
662
|
+
__decorateClass([
|
|
663
|
+
property6({ type: String })
|
|
664
|
+
], DsAvatar.prototype, "status", 2);
|
|
665
|
+
__decorateClass([
|
|
666
|
+
property6({ type: Boolean, attribute: "show-status" })
|
|
667
|
+
], DsAvatar.prototype, "showStatus", 2);
|
|
668
|
+
__decorateClass([
|
|
669
|
+
state2()
|
|
670
|
+
], DsAvatar.prototype, "imageError", 2);
|
|
671
|
+
define("ds-avatar", DsAvatar);
|
|
672
|
+
|
|
673
|
+
// src/components/avatar/avatar-group.ts
|
|
674
|
+
import { html as html9, nothing as nothing7 } from "lit";
|
|
675
|
+
import { property as property7, state as state3 } from "lit/decorators.js";
|
|
676
|
+
import { classMap as classMap4 } from "lit/directives/class-map.js";
|
|
677
|
+
var DsAvatarGroup = class extends DSElement {
|
|
678
|
+
constructor() {
|
|
679
|
+
super(...arguments);
|
|
680
|
+
this.max = 5;
|
|
681
|
+
this.size = "md";
|
|
682
|
+
this.overflowCount = 0;
|
|
683
|
+
this.visibleAvatars = [];
|
|
684
|
+
}
|
|
685
|
+
static {
|
|
686
|
+
this.styles = [];
|
|
687
|
+
}
|
|
688
|
+
connectedCallback() {
|
|
689
|
+
super.connectedCallback();
|
|
690
|
+
this.updateAvatarVisibility();
|
|
691
|
+
const observer = new MutationObserver(() => this.updateAvatarVisibility());
|
|
692
|
+
observer.observe(this, { childList: true });
|
|
693
|
+
}
|
|
694
|
+
updateAvatarVisibility() {
|
|
695
|
+
const avatars = Array.from(this.querySelectorAll("ds-avatar"));
|
|
696
|
+
const total = avatars.length;
|
|
697
|
+
if (total <= this.max) {
|
|
698
|
+
this.visibleAvatars = avatars;
|
|
699
|
+
this.overflowCount = 0;
|
|
700
|
+
} else {
|
|
701
|
+
this.visibleAvatars = avatars.slice(0, this.max);
|
|
702
|
+
this.overflowCount = total - this.max;
|
|
703
|
+
}
|
|
704
|
+
avatars.forEach((avatar, index) => {
|
|
705
|
+
if (index >= this.max) {
|
|
706
|
+
avatar.style.display = "none";
|
|
707
|
+
} else {
|
|
708
|
+
avatar.style.display = "";
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
this.requestUpdate();
|
|
712
|
+
}
|
|
713
|
+
render() {
|
|
714
|
+
const classes = {
|
|
715
|
+
"ds-avatar-group": true
|
|
716
|
+
};
|
|
717
|
+
return html9`
|
|
718
|
+
<div
|
|
719
|
+
class=${classMap4(classes)}
|
|
720
|
+
role="group"
|
|
721
|
+
aria-label="Avatar group"
|
|
722
|
+
data-size=${this.size}
|
|
723
|
+
>
|
|
724
|
+
${this.overflowCount > 0 ? html9`
|
|
725
|
+
<span
|
|
726
|
+
part="overflow"
|
|
727
|
+
class="ds-avatar-group__overflow"
|
|
728
|
+
aria-label="${this.overflowCount} more users"
|
|
729
|
+
>
|
|
730
|
+
+${this.overflowCount}
|
|
731
|
+
</span>
|
|
732
|
+
` : nothing7}
|
|
733
|
+
<slot @slotchange=${this.updateAvatarVisibility}></slot>
|
|
734
|
+
</div>
|
|
735
|
+
`;
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
__decorateClass([
|
|
739
|
+
property7({ type: Number })
|
|
740
|
+
], DsAvatarGroup.prototype, "max", 2);
|
|
741
|
+
__decorateClass([
|
|
742
|
+
property7({ type: String, reflect: true })
|
|
743
|
+
], DsAvatarGroup.prototype, "size", 2);
|
|
744
|
+
__decorateClass([
|
|
745
|
+
state3()
|
|
746
|
+
], DsAvatarGroup.prototype, "overflowCount", 2);
|
|
747
|
+
__decorateClass([
|
|
748
|
+
state3()
|
|
749
|
+
], DsAvatarGroup.prototype, "visibleAvatars", 2);
|
|
750
|
+
define("ds-avatar-group", DsAvatarGroup);
|
|
751
|
+
|
|
752
|
+
// src/components/badge/badge.ts
|
|
753
|
+
import { html as html10, nothing as nothing8 } from "lit";
|
|
754
|
+
import { property as property8 } from "lit/decorators.js";
|
|
755
|
+
import { classMap as classMap5 } from "lit/directives/class-map.js";
|
|
756
|
+
var DsBadge = class extends DSElement {
|
|
757
|
+
constructor() {
|
|
758
|
+
super(...arguments);
|
|
759
|
+
this.content = "";
|
|
760
|
+
this.variant = "primary";
|
|
761
|
+
this.size = "md";
|
|
762
|
+
this.outline = false;
|
|
763
|
+
this.dot = false;
|
|
764
|
+
this.position = "top-right";
|
|
765
|
+
this.pulse = false;
|
|
766
|
+
}
|
|
767
|
+
static {
|
|
768
|
+
this.styles = [];
|
|
769
|
+
}
|
|
770
|
+
get displayContent() {
|
|
771
|
+
if (this.dot) return "";
|
|
772
|
+
if (this.max !== void 0 && !Number.isNaN(Number(this.content))) {
|
|
773
|
+
const count = Number(this.content);
|
|
774
|
+
if (count > this.max) {
|
|
775
|
+
return `${this.max}+`;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
return this.content;
|
|
779
|
+
}
|
|
780
|
+
render() {
|
|
781
|
+
const classes = {
|
|
782
|
+
"ds-badge": true
|
|
783
|
+
};
|
|
784
|
+
return html10`
|
|
785
|
+
<span
|
|
786
|
+
class=${classMap5(classes)}
|
|
787
|
+
role="status"
|
|
788
|
+
data-variant=${this.variant}
|
|
789
|
+
data-size=${this.size !== "md" ? this.size : nothing8}
|
|
790
|
+
?data-outline=${this.outline}
|
|
791
|
+
?data-dot=${this.dot}
|
|
792
|
+
data-position=${this.position}
|
|
793
|
+
?data-pulse=${this.pulse}
|
|
794
|
+
aria-label=${this.dot ? "Notification indicator" : `${this.displayContent} notifications`}
|
|
795
|
+
>
|
|
796
|
+
${this.dot ? nothing8 : this.displayContent}
|
|
797
|
+
</span>
|
|
798
|
+
`;
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
__decorateClass([
|
|
802
|
+
property8({ type: String })
|
|
803
|
+
], DsBadge.prototype, "content", 2);
|
|
804
|
+
__decorateClass([
|
|
805
|
+
property8({ type: Number })
|
|
806
|
+
], DsBadge.prototype, "max", 2);
|
|
807
|
+
__decorateClass([
|
|
808
|
+
property8({ type: String, reflect: true })
|
|
809
|
+
], DsBadge.prototype, "variant", 2);
|
|
810
|
+
__decorateClass([
|
|
811
|
+
property8({ type: String, reflect: true })
|
|
812
|
+
], DsBadge.prototype, "size", 2);
|
|
813
|
+
__decorateClass([
|
|
814
|
+
property8({ type: Boolean, reflect: true })
|
|
815
|
+
], DsBadge.prototype, "outline", 2);
|
|
816
|
+
__decorateClass([
|
|
817
|
+
property8({ type: Boolean, reflect: true })
|
|
818
|
+
], DsBadge.prototype, "dot", 2);
|
|
819
|
+
__decorateClass([
|
|
820
|
+
property8({ type: String, reflect: true })
|
|
821
|
+
], DsBadge.prototype, "position", 2);
|
|
822
|
+
__decorateClass([
|
|
823
|
+
property8({ type: Boolean, reflect: true })
|
|
824
|
+
], DsBadge.prototype, "pulse", 2);
|
|
825
|
+
define("ds-badge", DsBadge);
|
|
826
|
+
|
|
827
|
+
// src/components/tag/tag.ts
|
|
828
|
+
import { html as html11, nothing as nothing9 } from "lit";
|
|
829
|
+
import { property as property9 } from "lit/decorators.js";
|
|
830
|
+
import { classMap as classMap6 } from "lit/directives/class-map.js";
|
|
831
|
+
var closeIcon = html11`
|
|
832
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
833
|
+
<path d="M18 6L6 18M6 6l12 12" />
|
|
834
|
+
</svg>
|
|
835
|
+
`;
|
|
836
|
+
var DsTag = class extends DSElement {
|
|
837
|
+
constructor() {
|
|
838
|
+
super(...arguments);
|
|
839
|
+
this.variant = "neutral";
|
|
840
|
+
this.size = "md";
|
|
841
|
+
this.solid = false;
|
|
842
|
+
this.removable = false;
|
|
843
|
+
this.clickable = false;
|
|
844
|
+
this.disabled = false;
|
|
845
|
+
this.value = "";
|
|
846
|
+
}
|
|
847
|
+
static {
|
|
848
|
+
this.styles = [];
|
|
849
|
+
}
|
|
850
|
+
handleRemove(event) {
|
|
851
|
+
event.stopPropagation();
|
|
852
|
+
if (this.disabled) return;
|
|
853
|
+
emitEvent(this, "remove", {
|
|
854
|
+
detail: { value: this.value }
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
handleClick() {
|
|
858
|
+
if (!this.clickable || this.disabled) return;
|
|
859
|
+
emitEvent(this, "click", {
|
|
860
|
+
detail: { value: this.value }
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
handleKeyDown(event) {
|
|
864
|
+
if (this.disabled) return;
|
|
865
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
866
|
+
if (this.clickable) {
|
|
867
|
+
event.preventDefault();
|
|
868
|
+
this.handleClick();
|
|
869
|
+
}
|
|
870
|
+
} else if (event.key === "Backspace" || event.key === "Delete") {
|
|
871
|
+
if (this.removable) {
|
|
872
|
+
event.preventDefault();
|
|
873
|
+
emitEvent(this, "remove", { detail: { value: this.value } });
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
render() {
|
|
878
|
+
const classes = {
|
|
879
|
+
"ds-tag": true
|
|
880
|
+
};
|
|
881
|
+
return html11`
|
|
882
|
+
<span
|
|
883
|
+
class=${classMap6(classes)}
|
|
884
|
+
role=${this.clickable ? "button" : "status"}
|
|
885
|
+
tabindex=${this.clickable && !this.disabled ? 0 : nothing9}
|
|
886
|
+
data-variant=${this.variant}
|
|
887
|
+
data-size=${this.size !== "md" ? this.size : nothing9}
|
|
888
|
+
?data-solid=${this.solid}
|
|
889
|
+
?data-clickable=${this.clickable}
|
|
890
|
+
?data-disabled=${this.disabled}
|
|
891
|
+
aria-disabled=${this.disabled ? "true" : nothing9}
|
|
892
|
+
@click=${this.handleClick}
|
|
893
|
+
@keydown=${this.handleKeyDown}
|
|
894
|
+
>
|
|
895
|
+
<slot name="icon"></slot>
|
|
896
|
+
<slot></slot>
|
|
897
|
+
${this.removable ? html11`
|
|
898
|
+
<button
|
|
899
|
+
type="button"
|
|
900
|
+
class="ds-tag__remove"
|
|
901
|
+
aria-label="Remove"
|
|
902
|
+
?disabled=${this.disabled}
|
|
903
|
+
@click=${this.handleRemove}
|
|
904
|
+
>
|
|
905
|
+
${closeIcon}
|
|
906
|
+
</button>
|
|
907
|
+
` : nothing9}
|
|
908
|
+
</span>
|
|
909
|
+
`;
|
|
910
|
+
}
|
|
911
|
+
};
|
|
912
|
+
__decorateClass([
|
|
913
|
+
property9({ type: String, reflect: true })
|
|
914
|
+
], DsTag.prototype, "variant", 2);
|
|
915
|
+
__decorateClass([
|
|
916
|
+
property9({ type: String, reflect: true })
|
|
917
|
+
], DsTag.prototype, "size", 2);
|
|
918
|
+
__decorateClass([
|
|
919
|
+
property9({ type: Boolean, reflect: true })
|
|
920
|
+
], DsTag.prototype, "solid", 2);
|
|
921
|
+
__decorateClass([
|
|
922
|
+
property9({ type: Boolean, reflect: true })
|
|
923
|
+
], DsTag.prototype, "removable", 2);
|
|
924
|
+
__decorateClass([
|
|
925
|
+
property9({ type: Boolean, reflect: true })
|
|
926
|
+
], DsTag.prototype, "clickable", 2);
|
|
927
|
+
__decorateClass([
|
|
928
|
+
property9({ type: Boolean, reflect: true })
|
|
929
|
+
], DsTag.prototype, "disabled", 2);
|
|
930
|
+
__decorateClass([
|
|
931
|
+
property9({ type: String })
|
|
932
|
+
], DsTag.prototype, "value", 2);
|
|
933
|
+
define("ds-tag", DsTag);
|
|
934
|
+
|
|
935
|
+
// src/components/calendar/calendar.ts
|
|
936
|
+
import { html as html12, nothing as nothing10 } from "lit";
|
|
937
|
+
import { property as property10, state as state4 } from "lit/decorators.js";
|
|
938
|
+
import { classMap as classMap7 } from "lit/directives/class-map.js";
|
|
939
|
+
var chevronLeftIcon = html12`
|
|
940
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
941
|
+
<path d="M15 18l-6-6 6-6" />
|
|
942
|
+
</svg>
|
|
943
|
+
`;
|
|
944
|
+
var chevronRightIcon = html12`
|
|
945
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
946
|
+
<path d="M9 18l6-6-6-6" />
|
|
947
|
+
</svg>
|
|
948
|
+
`;
|
|
949
|
+
var DsCalendar = class extends DSElement {
|
|
950
|
+
constructor() {
|
|
951
|
+
super(...arguments);
|
|
952
|
+
this.value = "";
|
|
953
|
+
this.min = "";
|
|
954
|
+
this.max = "";
|
|
955
|
+
this.disabledDates = "";
|
|
956
|
+
this.locale = "en-US";
|
|
957
|
+
this.size = "default";
|
|
958
|
+
this.firstDayOfWeek = 0;
|
|
959
|
+
this.viewDate = /* @__PURE__ */ new Date();
|
|
960
|
+
}
|
|
961
|
+
static {
|
|
962
|
+
this.styles = [];
|
|
963
|
+
}
|
|
964
|
+
get selectedDate() {
|
|
965
|
+
return this.value ? new Date(this.value) : null;
|
|
966
|
+
}
|
|
967
|
+
get minDate() {
|
|
968
|
+
return this.min ? new Date(this.min) : null;
|
|
969
|
+
}
|
|
970
|
+
get maxDate() {
|
|
971
|
+
return this.max ? new Date(this.max) : null;
|
|
972
|
+
}
|
|
973
|
+
get disabledDateSet() {
|
|
974
|
+
if (!this.disabledDates) return /* @__PURE__ */ new Set();
|
|
975
|
+
return new Set(this.disabledDates.split(",").map((d) => d.trim()));
|
|
976
|
+
}
|
|
977
|
+
get weekdayNames() {
|
|
978
|
+
const formatter = new Intl.DateTimeFormat(this.locale, { weekday: "short" });
|
|
979
|
+
const days = [];
|
|
980
|
+
const baseDate = new Date(2024, 0, 7);
|
|
981
|
+
for (let i = 0; i < 7; i++) {
|
|
982
|
+
const day = new Date(baseDate);
|
|
983
|
+
day.setDate(baseDate.getDate() + (i + this.firstDayOfWeek) % 7);
|
|
984
|
+
days.push(formatter.format(day));
|
|
985
|
+
}
|
|
986
|
+
return days;
|
|
987
|
+
}
|
|
988
|
+
get monthYearLabel() {
|
|
989
|
+
const formatter = new Intl.DateTimeFormat(this.locale, {
|
|
990
|
+
month: "long",
|
|
991
|
+
year: "numeric"
|
|
992
|
+
});
|
|
993
|
+
return formatter.format(this.viewDate);
|
|
994
|
+
}
|
|
995
|
+
get calendarDays() {
|
|
996
|
+
const days = [];
|
|
997
|
+
const year = this.viewDate.getFullYear();
|
|
998
|
+
const month = this.viewDate.getMonth();
|
|
999
|
+
const firstOfMonth = new Date(year, month, 1);
|
|
1000
|
+
const startDayOfWeek = firstOfMonth.getDay();
|
|
1001
|
+
const daysFromPrevMonth = (startDayOfWeek - this.firstDayOfWeek + 7) % 7;
|
|
1002
|
+
for (let i = daysFromPrevMonth; i > 0; i--) {
|
|
1003
|
+
const date = new Date(year, month, 1 - i);
|
|
1004
|
+
days.push({ date, isOutside: true });
|
|
1005
|
+
}
|
|
1006
|
+
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
|
1007
|
+
for (let i = 1; i <= daysInMonth; i++) {
|
|
1008
|
+
days.push({ date: new Date(year, month, i), isOutside: false });
|
|
1009
|
+
}
|
|
1010
|
+
const remaining = 42 - days.length;
|
|
1011
|
+
for (let i = 1; i <= remaining; i++) {
|
|
1012
|
+
const date = new Date(year, month + 1, i);
|
|
1013
|
+
days.push({ date, isOutside: true });
|
|
1014
|
+
}
|
|
1015
|
+
return days;
|
|
1016
|
+
}
|
|
1017
|
+
isToday(date) {
|
|
1018
|
+
const today = /* @__PURE__ */ new Date();
|
|
1019
|
+
return date.getDate() === today.getDate() && date.getMonth() === today.getMonth() && date.getFullYear() === today.getFullYear();
|
|
1020
|
+
}
|
|
1021
|
+
isSelected(date) {
|
|
1022
|
+
if (!this.selectedDate) return false;
|
|
1023
|
+
return date.getDate() === this.selectedDate.getDate() && date.getMonth() === this.selectedDate.getMonth() && date.getFullYear() === this.selectedDate.getFullYear();
|
|
1024
|
+
}
|
|
1025
|
+
isDisabled(date) {
|
|
1026
|
+
const dateStr = date.toISOString().split("T")[0] ?? "";
|
|
1027
|
+
if (dateStr && this.disabledDateSet.has(dateStr)) return true;
|
|
1028
|
+
if (this.minDate && date < this.minDate) return true;
|
|
1029
|
+
if (this.maxDate && date > this.maxDate) return true;
|
|
1030
|
+
return false;
|
|
1031
|
+
}
|
|
1032
|
+
formatDateISO(date) {
|
|
1033
|
+
return date.toISOString().split("T")[0] ?? "";
|
|
1034
|
+
}
|
|
1035
|
+
handlePrevMonth() {
|
|
1036
|
+
const newDate = new Date(this.viewDate);
|
|
1037
|
+
newDate.setMonth(newDate.getMonth() - 1);
|
|
1038
|
+
this.viewDate = newDate;
|
|
1039
|
+
emitEvent(this, "month-change", {
|
|
1040
|
+
detail: {
|
|
1041
|
+
month: newDate.getMonth() + 1,
|
|
1042
|
+
year: newDate.getFullYear()
|
|
1043
|
+
}
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
handleNextMonth() {
|
|
1047
|
+
const newDate = new Date(this.viewDate);
|
|
1048
|
+
newDate.setMonth(newDate.getMonth() + 1);
|
|
1049
|
+
this.viewDate = newDate;
|
|
1050
|
+
emitEvent(this, "month-change", {
|
|
1051
|
+
detail: {
|
|
1052
|
+
month: newDate.getMonth() + 1,
|
|
1053
|
+
year: newDate.getFullYear()
|
|
1054
|
+
}
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
handleDateSelect(date) {
|
|
1058
|
+
if (this.isDisabled(date)) return;
|
|
1059
|
+
this.value = this.formatDateISO(date);
|
|
1060
|
+
emitEvent(this, "change", {
|
|
1061
|
+
detail: {
|
|
1062
|
+
value: this.value,
|
|
1063
|
+
date: date.toISOString()
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
handleKeyDown(event, date) {
|
|
1068
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
1069
|
+
event.preventDefault();
|
|
1070
|
+
this.handleDateSelect(date);
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
render() {
|
|
1074
|
+
const classes = {
|
|
1075
|
+
"ds-calendar": true
|
|
1076
|
+
};
|
|
1077
|
+
return html12`
|
|
1078
|
+
<div
|
|
1079
|
+
class=${classMap7(classes)}
|
|
1080
|
+
role="application"
|
|
1081
|
+
aria-label="Calendar"
|
|
1082
|
+
data-size=${this.size !== "default" ? this.size : nothing10}
|
|
1083
|
+
>
|
|
1084
|
+
<div class="ds-calendar__header">
|
|
1085
|
+
<button
|
|
1086
|
+
type="button"
|
|
1087
|
+
class="ds-calendar__nav-button"
|
|
1088
|
+
aria-label="Previous month"
|
|
1089
|
+
@click=${this.handlePrevMonth}
|
|
1090
|
+
>
|
|
1091
|
+
${chevronLeftIcon}
|
|
1092
|
+
</button>
|
|
1093
|
+
<span class="ds-calendar__title" aria-live="polite">
|
|
1094
|
+
${this.monthYearLabel}
|
|
1095
|
+
</span>
|
|
1096
|
+
<button
|
|
1097
|
+
type="button"
|
|
1098
|
+
class="ds-calendar__nav-button"
|
|
1099
|
+
aria-label="Next month"
|
|
1100
|
+
@click=${this.handleNextMonth}
|
|
1101
|
+
>
|
|
1102
|
+
${chevronRightIcon}
|
|
1103
|
+
</button>
|
|
1104
|
+
</div>
|
|
1105
|
+
|
|
1106
|
+
<div class="ds-calendar__weekdays" role="row">
|
|
1107
|
+
${this.weekdayNames.map(
|
|
1108
|
+
(day) => html12`
|
|
1109
|
+
<div class="ds-calendar__weekday" role="columnheader">${day}</div>
|
|
1110
|
+
`
|
|
1111
|
+
)}
|
|
1112
|
+
</div>
|
|
1113
|
+
|
|
1114
|
+
<div class="ds-calendar__grid" role="grid">
|
|
1115
|
+
${this.calendarDays.map(({ date, isOutside }) => {
|
|
1116
|
+
const disabled = this.isDisabled(date);
|
|
1117
|
+
const selected = this.isSelected(date);
|
|
1118
|
+
const today = this.isToday(date);
|
|
1119
|
+
return html12`
|
|
1120
|
+
<button
|
|
1121
|
+
type="button"
|
|
1122
|
+
class="ds-calendar__day"
|
|
1123
|
+
role="gridcell"
|
|
1124
|
+
tabindex=${selected ? 0 : -1}
|
|
1125
|
+
aria-selected=${selected ? "true" : "false"}
|
|
1126
|
+
aria-disabled=${disabled ? "true" : nothing10}
|
|
1127
|
+
?data-outside=${isOutside}
|
|
1128
|
+
?data-selected=${selected}
|
|
1129
|
+
?data-today=${today}
|
|
1130
|
+
?data-disabled=${disabled}
|
|
1131
|
+
@click=${() => this.handleDateSelect(date)}
|
|
1132
|
+
@keydown=${(e) => this.handleKeyDown(e, date)}
|
|
1133
|
+
>
|
|
1134
|
+
${date.getDate()}
|
|
1135
|
+
</button>
|
|
1136
|
+
`;
|
|
1137
|
+
})}
|
|
1138
|
+
</div>
|
|
1139
|
+
</div>
|
|
1140
|
+
`;
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1143
|
+
__decorateClass([
|
|
1144
|
+
property10({ type: String })
|
|
1145
|
+
], DsCalendar.prototype, "value", 2);
|
|
1146
|
+
__decorateClass([
|
|
1147
|
+
property10({ type: String })
|
|
1148
|
+
], DsCalendar.prototype, "min", 2);
|
|
1149
|
+
__decorateClass([
|
|
1150
|
+
property10({ type: String })
|
|
1151
|
+
], DsCalendar.prototype, "max", 2);
|
|
1152
|
+
__decorateClass([
|
|
1153
|
+
property10({ type: String, attribute: "disabled-dates" })
|
|
1154
|
+
], DsCalendar.prototype, "disabledDates", 2);
|
|
1155
|
+
__decorateClass([
|
|
1156
|
+
property10({ type: String })
|
|
1157
|
+
], DsCalendar.prototype, "locale", 2);
|
|
1158
|
+
__decorateClass([
|
|
1159
|
+
property10({ type: String, reflect: true })
|
|
1160
|
+
], DsCalendar.prototype, "size", 2);
|
|
1161
|
+
__decorateClass([
|
|
1162
|
+
property10({ type: Number, attribute: "first-day-of-week" })
|
|
1163
|
+
], DsCalendar.prototype, "firstDayOfWeek", 2);
|
|
1164
|
+
__decorateClass([
|
|
1165
|
+
state4()
|
|
1166
|
+
], DsCalendar.prototype, "viewDate", 2);
|
|
1167
|
+
define("ds-calendar", DsCalendar);
|
|
1168
|
+
|
|
1169
|
+
// src/components/tree/tree.ts
|
|
1170
|
+
import { html as html13, nothing as nothing11 } from "lit";
|
|
1171
|
+
import { property as property11, state as state5 } from "lit/decorators.js";
|
|
1172
|
+
import { classMap as classMap8 } from "lit/directives/class-map.js";
|
|
1173
|
+
var DsTree = class extends DSElement {
|
|
1174
|
+
constructor() {
|
|
1175
|
+
super(...arguments);
|
|
1176
|
+
this.selectionMode = "single";
|
|
1177
|
+
this.size = "default";
|
|
1178
|
+
this.lines = false;
|
|
1179
|
+
this.label = "Tree";
|
|
1180
|
+
this.loading = false;
|
|
1181
|
+
this.loadingText = "Loading...";
|
|
1182
|
+
this.loadingNodes = /* @__PURE__ */ new Set();
|
|
1183
|
+
this.selectedItems = /* @__PURE__ */ new Set();
|
|
1184
|
+
}
|
|
1185
|
+
static {
|
|
1186
|
+
this.styles = [];
|
|
1187
|
+
}
|
|
1188
|
+
/**
|
|
1189
|
+
* Checks if a specific node is currently loading.
|
|
1190
|
+
*/
|
|
1191
|
+
isNodeLoading(nodeId) {
|
|
1192
|
+
if (this.loadingNodes instanceof Set) {
|
|
1193
|
+
return this.loadingNodes.has(nodeId);
|
|
1194
|
+
}
|
|
1195
|
+
return this.loadingNodes.includes(nodeId);
|
|
1196
|
+
}
|
|
1197
|
+
handleItemSelect(itemId) {
|
|
1198
|
+
if (this.loading) return;
|
|
1199
|
+
if (this.selectionMode === "none") return;
|
|
1200
|
+
if (this.selectionMode === "single") {
|
|
1201
|
+
this.selectedItems.clear();
|
|
1202
|
+
this.selectedItems.add(itemId);
|
|
1203
|
+
} else {
|
|
1204
|
+
if (this.selectedItems.has(itemId)) {
|
|
1205
|
+
this.selectedItems.delete(itemId);
|
|
1206
|
+
} else {
|
|
1207
|
+
this.selectedItems.add(itemId);
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
emitEvent(this, "selection-change", {
|
|
1211
|
+
detail: { selectedItems: Array.from(this.selectedItems) }
|
|
1212
|
+
});
|
|
1213
|
+
this.requestUpdate();
|
|
1214
|
+
}
|
|
1215
|
+
isItemSelected(itemId) {
|
|
1216
|
+
return this.selectedItems.has(itemId);
|
|
1217
|
+
}
|
|
1218
|
+
render() {
|
|
1219
|
+
const classes = {
|
|
1220
|
+
"ds-tree": true
|
|
1221
|
+
};
|
|
1222
|
+
return html13`
|
|
1223
|
+
<ul
|
|
1224
|
+
class=${classMap8(classes)}
|
|
1225
|
+
role="tree"
|
|
1226
|
+
aria-label=${this.label}
|
|
1227
|
+
aria-multiselectable=${this.selectionMode === "multiple" ? "true" : nothing11}
|
|
1228
|
+
aria-busy=${this.loading ? "true" : nothing11}
|
|
1229
|
+
data-size=${this.size !== "default" ? this.size : nothing11}
|
|
1230
|
+
?data-lines=${this.lines}
|
|
1231
|
+
?data-loading=${this.loading}
|
|
1232
|
+
>
|
|
1233
|
+
<slot></slot>
|
|
1234
|
+
</ul>
|
|
1235
|
+
`;
|
|
1236
|
+
}
|
|
1237
|
+
};
|
|
1238
|
+
__decorateClass([
|
|
1239
|
+
property11({ type: String, attribute: "selection-mode", reflect: true })
|
|
1240
|
+
], DsTree.prototype, "selectionMode", 2);
|
|
1241
|
+
__decorateClass([
|
|
1242
|
+
property11({ type: String, reflect: true })
|
|
1243
|
+
], DsTree.prototype, "size", 2);
|
|
1244
|
+
__decorateClass([
|
|
1245
|
+
property11({ type: Boolean, reflect: true })
|
|
1246
|
+
], DsTree.prototype, "lines", 2);
|
|
1247
|
+
__decorateClass([
|
|
1248
|
+
property11({ type: String })
|
|
1249
|
+
], DsTree.prototype, "label", 2);
|
|
1250
|
+
__decorateClass([
|
|
1251
|
+
property11({ type: Boolean, reflect: true })
|
|
1252
|
+
], DsTree.prototype, "loading", 2);
|
|
1253
|
+
__decorateClass([
|
|
1254
|
+
property11({ type: String, attribute: "loading-text" })
|
|
1255
|
+
], DsTree.prototype, "loadingText", 2);
|
|
1256
|
+
__decorateClass([
|
|
1257
|
+
property11({ attribute: false })
|
|
1258
|
+
], DsTree.prototype, "loadingNodes", 2);
|
|
1259
|
+
__decorateClass([
|
|
1260
|
+
state5()
|
|
1261
|
+
], DsTree.prototype, "selectedItems", 2);
|
|
1262
|
+
define("ds-tree", DsTree);
|
|
1263
|
+
|
|
1264
|
+
// src/components/tree/tree-item.ts
|
|
1265
|
+
import { html as html14, nothing as nothing12 } from "lit";
|
|
1266
|
+
import { property as property12, state as state6 } from "lit/decorators.js";
|
|
1267
|
+
import { classMap as classMap9 } from "lit/directives/class-map.js";
|
|
1268
|
+
|
|
1269
|
+
// src/components/tree/tree-utils.ts
|
|
1270
|
+
function calculateTreeItemPosition(element) {
|
|
1271
|
+
let level = 1;
|
|
1272
|
+
let parent = element.parentElement;
|
|
1273
|
+
while (parent) {
|
|
1274
|
+
if (parent.tagName?.toLowerCase() === "ds-tree-item") {
|
|
1275
|
+
level++;
|
|
1276
|
+
}
|
|
1277
|
+
if (parent.tagName?.toLowerCase() === "ds-tree") {
|
|
1278
|
+
break;
|
|
1279
|
+
}
|
|
1280
|
+
parent = parent.parentElement;
|
|
1281
|
+
}
|
|
1282
|
+
const siblings = getSiblingTreeItems(element);
|
|
1283
|
+
const setSize = siblings.length;
|
|
1284
|
+
const posInSet = siblings.indexOf(element) + 1;
|
|
1285
|
+
return { level, setSize, posInSet };
|
|
1286
|
+
}
|
|
1287
|
+
function getSiblingTreeItems(element) {
|
|
1288
|
+
let container = element.parentElement;
|
|
1289
|
+
if (container?.tagName?.toLowerCase() === "slot") {
|
|
1290
|
+
container = container.parentElement;
|
|
1291
|
+
}
|
|
1292
|
+
if (container?.getAttribute("role") === "group") {
|
|
1293
|
+
container = container.parentElement;
|
|
1294
|
+
}
|
|
1295
|
+
if (!container) {
|
|
1296
|
+
return [element];
|
|
1297
|
+
}
|
|
1298
|
+
const items = [];
|
|
1299
|
+
const checkChildren = (parent) => {
|
|
1300
|
+
for (const child of parent.children) {
|
|
1301
|
+
if (child.tagName?.toLowerCase() === "ds-tree-item") {
|
|
1302
|
+
items.push(child);
|
|
1303
|
+
} else if (child.tagName?.toLowerCase() === "slot") {
|
|
1304
|
+
const slot = child;
|
|
1305
|
+
for (const assigned of slot.assignedElements()) {
|
|
1306
|
+
if (assigned.tagName?.toLowerCase() === "ds-tree-item") {
|
|
1307
|
+
items.push(assigned);
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
};
|
|
1313
|
+
if (container.tagName?.toLowerCase() === "ds-tree") {
|
|
1314
|
+
checkChildren(container);
|
|
1315
|
+
} else if (container.tagName?.toLowerCase() === "ds-tree-item") {
|
|
1316
|
+
const childrenSlot = container.querySelector('[slot="children"]');
|
|
1317
|
+
if (childrenSlot) {
|
|
1318
|
+
for (const child of childrenSlot.children) {
|
|
1319
|
+
if (child.tagName?.toLowerCase() === "ds-tree-item") {
|
|
1320
|
+
items.push(child);
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
return items.length > 0 ? items : [element];
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
// src/components/tree/tree-item.ts
|
|
1329
|
+
var chevronIcon2 = html14`
|
|
1330
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
1331
|
+
<path d="M9 18l6-6-6-6" />
|
|
1332
|
+
</svg>
|
|
1333
|
+
`;
|
|
1334
|
+
var DsTreeItem = class extends DSElement {
|
|
1335
|
+
constructor() {
|
|
1336
|
+
super(...arguments);
|
|
1337
|
+
this.itemId = "";
|
|
1338
|
+
this.expanded = false;
|
|
1339
|
+
this.selected = false;
|
|
1340
|
+
this.disabled = false;
|
|
1341
|
+
this.loading = false;
|
|
1342
|
+
this.hasChildren = false;
|
|
1343
|
+
this._level = 1;
|
|
1344
|
+
this._setSize = 1;
|
|
1345
|
+
this._posInSet = 1;
|
|
1346
|
+
}
|
|
1347
|
+
static {
|
|
1348
|
+
this.styles = [];
|
|
1349
|
+
}
|
|
1350
|
+
get treeRoot() {
|
|
1351
|
+
return this.closest("ds-tree");
|
|
1352
|
+
}
|
|
1353
|
+
/**
|
|
1354
|
+
* Returns true if this item is loading (either directly or via tree's loadingNodes).
|
|
1355
|
+
*/
|
|
1356
|
+
get isLoading() {
|
|
1357
|
+
if (this.loading) return true;
|
|
1358
|
+
const tree = this.treeRoot;
|
|
1359
|
+
if (tree && this.itemId) {
|
|
1360
|
+
return tree.isNodeLoading(this.itemId);
|
|
1361
|
+
}
|
|
1362
|
+
return false;
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1365
|
+
* Returns true if the tree root is in a loading state.
|
|
1366
|
+
*/
|
|
1367
|
+
get isTreeLoading() {
|
|
1368
|
+
return this.treeRoot?.loading ?? false;
|
|
1369
|
+
}
|
|
1370
|
+
connectedCallback() {
|
|
1371
|
+
super.connectedCallback();
|
|
1372
|
+
this.updateHasChildren();
|
|
1373
|
+
requestAnimationFrame(() => {
|
|
1374
|
+
this.updateAriaPosition();
|
|
1375
|
+
});
|
|
1376
|
+
}
|
|
1377
|
+
/**
|
|
1378
|
+
* Update ARIA position attributes for APG compliance.
|
|
1379
|
+
* Provides screen readers with context like "Item 3 of 5, level 2".
|
|
1380
|
+
*/
|
|
1381
|
+
updateAriaPosition() {
|
|
1382
|
+
const position = calculateTreeItemPosition(this);
|
|
1383
|
+
this._level = position.level;
|
|
1384
|
+
this._setSize = position.setSize;
|
|
1385
|
+
this._posInSet = position.posInSet;
|
|
1386
|
+
}
|
|
1387
|
+
updateHasChildren() {
|
|
1388
|
+
const childrenSlot = this.querySelector("[slot=children]");
|
|
1389
|
+
this.hasChildren = childrenSlot !== null && childrenSlot.querySelector("ds-tree-item") !== null;
|
|
1390
|
+
}
|
|
1391
|
+
handleExpandClick(event) {
|
|
1392
|
+
event.stopPropagation();
|
|
1393
|
+
if (this.disabled || this.isTreeLoading || this.isLoading || !this.hasChildren) return;
|
|
1394
|
+
this.expanded = !this.expanded;
|
|
1395
|
+
emitEvent(this, "expand", {
|
|
1396
|
+
detail: {
|
|
1397
|
+
itemId: this.itemId,
|
|
1398
|
+
expanded: this.expanded
|
|
1399
|
+
}
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
handleContentClick() {
|
|
1403
|
+
if (this.disabled || this.isTreeLoading) return;
|
|
1404
|
+
const tree = this.treeRoot;
|
|
1405
|
+
if (tree) {
|
|
1406
|
+
tree.handleItemSelect(this.itemId);
|
|
1407
|
+
this.selected = tree.isItemSelected(this.itemId);
|
|
1408
|
+
}
|
|
1409
|
+
emitEvent(this, "select", {
|
|
1410
|
+
detail: {
|
|
1411
|
+
itemId: this.itemId,
|
|
1412
|
+
selected: this.selected
|
|
1413
|
+
}
|
|
1414
|
+
});
|
|
1415
|
+
}
|
|
1416
|
+
handleKeyDown(event) {
|
|
1417
|
+
if (this.disabled || this.isTreeLoading) return;
|
|
1418
|
+
switch (event.key) {
|
|
1419
|
+
case "ArrowRight":
|
|
1420
|
+
if (this.hasChildren && !this.expanded) {
|
|
1421
|
+
event.preventDefault();
|
|
1422
|
+
this.expanded = true;
|
|
1423
|
+
emitEvent(this, "expand", {
|
|
1424
|
+
detail: {
|
|
1425
|
+
itemId: this.itemId,
|
|
1426
|
+
expanded: true
|
|
1427
|
+
}
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1430
|
+
break;
|
|
1431
|
+
case "ArrowLeft":
|
|
1432
|
+
if (this.hasChildren && this.expanded) {
|
|
1433
|
+
event.preventDefault();
|
|
1434
|
+
this.expanded = false;
|
|
1435
|
+
emitEvent(this, "expand", {
|
|
1436
|
+
detail: {
|
|
1437
|
+
itemId: this.itemId,
|
|
1438
|
+
expanded: false
|
|
1439
|
+
}
|
|
1440
|
+
});
|
|
1441
|
+
}
|
|
1442
|
+
break;
|
|
1443
|
+
case "Enter":
|
|
1444
|
+
event.preventDefault();
|
|
1445
|
+
emitEvent(this, "activate", { detail: { itemId: this.itemId } });
|
|
1446
|
+
break;
|
|
1447
|
+
case " ":
|
|
1448
|
+
event.preventDefault();
|
|
1449
|
+
this.handleContentClick();
|
|
1450
|
+
break;
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
render() {
|
|
1454
|
+
const classes = {
|
|
1455
|
+
"ds-tree-item": true
|
|
1456
|
+
};
|
|
1457
|
+
this.updateHasChildren();
|
|
1458
|
+
const itemLoading = this.isLoading;
|
|
1459
|
+
return html14`
|
|
1460
|
+
<li
|
|
1461
|
+
class=${classMap9(classes)}
|
|
1462
|
+
role="treeitem"
|
|
1463
|
+
aria-expanded=${this.hasChildren ? this.expanded ? "true" : "false" : nothing12}
|
|
1464
|
+
aria-selected=${this.selected ? "true" : "false"}
|
|
1465
|
+
aria-busy=${itemLoading ? "true" : nothing12}
|
|
1466
|
+
aria-level=${this._level}
|
|
1467
|
+
aria-setsize=${this._setSize}
|
|
1468
|
+
aria-posinset=${this._posInSet}
|
|
1469
|
+
?data-expanded=${this.expanded}
|
|
1470
|
+
?data-selected=${this.selected}
|
|
1471
|
+
?data-disabled=${this.disabled}
|
|
1472
|
+
?data-loading=${itemLoading}
|
|
1473
|
+
>
|
|
1474
|
+
<div
|
|
1475
|
+
class="ds-tree-item__content"
|
|
1476
|
+
tabindex=${this.disabled ? -1 : 0}
|
|
1477
|
+
@click=${this.handleContentClick}
|
|
1478
|
+
@keydown=${this.handleKeyDown}
|
|
1479
|
+
>
|
|
1480
|
+
${this.hasChildren ? html14`
|
|
1481
|
+
<button
|
|
1482
|
+
type="button"
|
|
1483
|
+
class="ds-tree-item__expand"
|
|
1484
|
+
aria-label=${this.expanded ? "Collapse" : "Expand"}
|
|
1485
|
+
tabindex="-1"
|
|
1486
|
+
@click=${this.handleExpandClick}
|
|
1487
|
+
>
|
|
1488
|
+
${chevronIcon2}
|
|
1489
|
+
</button>
|
|
1490
|
+
` : html14`<span class="ds-tree-item__spacer"></span>`}
|
|
1491
|
+
<slot name="icon"></slot>
|
|
1492
|
+
<span class="ds-tree-item__label">
|
|
1493
|
+
<slot></slot>
|
|
1494
|
+
</span>
|
|
1495
|
+
</div>
|
|
1496
|
+
${this.hasChildren ? html14`
|
|
1497
|
+
<ul
|
|
1498
|
+
class="ds-tree-item__children ds-tree"
|
|
1499
|
+
role="group"
|
|
1500
|
+
?hidden=${!this.expanded}
|
|
1501
|
+
>
|
|
1502
|
+
<slot name="children" @slotchange=${this.updateHasChildren}></slot>
|
|
1503
|
+
</ul>
|
|
1504
|
+
` : nothing12}
|
|
1505
|
+
</li>
|
|
1506
|
+
`;
|
|
1507
|
+
}
|
|
1508
|
+
};
|
|
1509
|
+
__decorateClass([
|
|
1510
|
+
property12({ type: String, attribute: "item-id" })
|
|
1511
|
+
], DsTreeItem.prototype, "itemId", 2);
|
|
1512
|
+
__decorateClass([
|
|
1513
|
+
property12({ type: Boolean, reflect: true })
|
|
1514
|
+
], DsTreeItem.prototype, "expanded", 2);
|
|
1515
|
+
__decorateClass([
|
|
1516
|
+
property12({ type: Boolean, reflect: true })
|
|
1517
|
+
], DsTreeItem.prototype, "selected", 2);
|
|
1518
|
+
__decorateClass([
|
|
1519
|
+
property12({ type: Boolean, reflect: true })
|
|
1520
|
+
], DsTreeItem.prototype, "disabled", 2);
|
|
1521
|
+
__decorateClass([
|
|
1522
|
+
property12({ type: Boolean, reflect: true })
|
|
1523
|
+
], DsTreeItem.prototype, "loading", 2);
|
|
1524
|
+
__decorateClass([
|
|
1525
|
+
state6()
|
|
1526
|
+
], DsTreeItem.prototype, "hasChildren", 2);
|
|
1527
|
+
__decorateClass([
|
|
1528
|
+
state6()
|
|
1529
|
+
], DsTreeItem.prototype, "_level", 2);
|
|
1530
|
+
__decorateClass([
|
|
1531
|
+
state6()
|
|
1532
|
+
], DsTreeItem.prototype, "_setSize", 2);
|
|
1533
|
+
__decorateClass([
|
|
1534
|
+
state6()
|
|
1535
|
+
], DsTreeItem.prototype, "_posInSet", 2);
|
|
1536
|
+
define("ds-tree-item", DsTreeItem);
|
|
1537
|
+
|
|
1538
|
+
// src/components/list/list.ts
|
|
1539
|
+
import { html as html15, nothing as nothing13 } from "lit";
|
|
1540
|
+
import { property as property13, state as state7 } from "lit/decorators.js";
|
|
1541
|
+
import { classMap as classMap10 } from "lit/directives/class-map.js";
|
|
1542
|
+
var DsList = class extends DSElement {
|
|
1543
|
+
constructor() {
|
|
1544
|
+
super(...arguments);
|
|
1545
|
+
this.selectionMode = "single";
|
|
1546
|
+
this.orientation = "vertical";
|
|
1547
|
+
this.size = "default";
|
|
1548
|
+
this.bordered = false;
|
|
1549
|
+
this.label = "List";
|
|
1550
|
+
this.selectedItems = /* @__PURE__ */ new Set();
|
|
1551
|
+
}
|
|
1552
|
+
static {
|
|
1553
|
+
this.styles = [];
|
|
1554
|
+
}
|
|
1555
|
+
handleItemSelect(itemId) {
|
|
1556
|
+
if (this.selectionMode === "none") return;
|
|
1557
|
+
if (this.selectionMode === "single") {
|
|
1558
|
+
this.selectedItems.clear();
|
|
1559
|
+
this.selectedItems.add(itemId);
|
|
1560
|
+
} else {
|
|
1561
|
+
if (this.selectedItems.has(itemId)) {
|
|
1562
|
+
this.selectedItems.delete(itemId);
|
|
1563
|
+
} else {
|
|
1564
|
+
this.selectedItems.add(itemId);
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
emitEvent(this, "selection-change", {
|
|
1568
|
+
detail: { selectedItems: Array.from(this.selectedItems) }
|
|
1569
|
+
});
|
|
1570
|
+
this.requestUpdate();
|
|
1571
|
+
}
|
|
1572
|
+
isItemSelected(itemId) {
|
|
1573
|
+
return this.selectedItems.has(itemId);
|
|
1574
|
+
}
|
|
1575
|
+
render() {
|
|
1576
|
+
const classes = {
|
|
1577
|
+
"ds-list": true
|
|
1578
|
+
};
|
|
1579
|
+
return html15`
|
|
1580
|
+
<ul
|
|
1581
|
+
class=${classMap10(classes)}
|
|
1582
|
+
role="listbox"
|
|
1583
|
+
aria-label=${this.label}
|
|
1584
|
+
aria-multiselectable=${this.selectionMode === "multiple" ? "true" : nothing13}
|
|
1585
|
+
aria-orientation=${this.orientation}
|
|
1586
|
+
data-size=${this.size !== "default" ? this.size : nothing13}
|
|
1587
|
+
data-orientation=${this.orientation !== "vertical" ? this.orientation : nothing13}
|
|
1588
|
+
?data-bordered=${this.bordered}
|
|
1589
|
+
>
|
|
1590
|
+
<slot></slot>
|
|
1591
|
+
</ul>
|
|
1592
|
+
`;
|
|
1593
|
+
}
|
|
1594
|
+
};
|
|
1595
|
+
__decorateClass([
|
|
1596
|
+
property13({ type: String, attribute: "selection-mode", reflect: true })
|
|
1597
|
+
], DsList.prototype, "selectionMode", 2);
|
|
1598
|
+
__decorateClass([
|
|
1599
|
+
property13({ type: String, reflect: true })
|
|
1600
|
+
], DsList.prototype, "orientation", 2);
|
|
1601
|
+
__decorateClass([
|
|
1602
|
+
property13({ type: String, reflect: true })
|
|
1603
|
+
], DsList.prototype, "size", 2);
|
|
1604
|
+
__decorateClass([
|
|
1605
|
+
property13({ type: Boolean, reflect: true })
|
|
1606
|
+
], DsList.prototype, "bordered", 2);
|
|
1607
|
+
__decorateClass([
|
|
1608
|
+
property13({ type: String })
|
|
1609
|
+
], DsList.prototype, "label", 2);
|
|
1610
|
+
__decorateClass([
|
|
1611
|
+
state7()
|
|
1612
|
+
], DsList.prototype, "selectedItems", 2);
|
|
1613
|
+
define("ds-list", DsList);
|
|
1614
|
+
|
|
1615
|
+
// src/components/list/list-item.ts
|
|
1616
|
+
import { html as html16, nothing as nothing14 } from "lit";
|
|
1617
|
+
import { property as property14 } from "lit/decorators.js";
|
|
1618
|
+
import { classMap as classMap11 } from "lit/directives/class-map.js";
|
|
1619
|
+
var DsListItem = class extends DSElement {
|
|
1620
|
+
constructor() {
|
|
1621
|
+
super(...arguments);
|
|
1622
|
+
this.itemId = "";
|
|
1623
|
+
this.selected = false;
|
|
1624
|
+
this.disabled = false;
|
|
1625
|
+
this.value = "";
|
|
1626
|
+
}
|
|
1627
|
+
static {
|
|
1628
|
+
this.styles = [];
|
|
1629
|
+
}
|
|
1630
|
+
get listRoot() {
|
|
1631
|
+
return this.closest("ds-list");
|
|
1632
|
+
}
|
|
1633
|
+
handleClick() {
|
|
1634
|
+
if (this.disabled) return;
|
|
1635
|
+
const list = this.listRoot;
|
|
1636
|
+
if (list) {
|
|
1637
|
+
list.handleItemSelect(this.itemId || this.value);
|
|
1638
|
+
this.selected = list.isItemSelected(this.itemId || this.value);
|
|
1639
|
+
}
|
|
1640
|
+
emitEvent(this, "select", {
|
|
1641
|
+
detail: {
|
|
1642
|
+
itemId: this.itemId,
|
|
1643
|
+
value: this.value,
|
|
1644
|
+
selected: this.selected
|
|
1645
|
+
}
|
|
1646
|
+
});
|
|
1647
|
+
}
|
|
1648
|
+
handleKeyDown(event) {
|
|
1649
|
+
if (this.disabled) return;
|
|
1650
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
1651
|
+
event.preventDefault();
|
|
1652
|
+
this.handleClick();
|
|
1653
|
+
if (event.key === "Enter") {
|
|
1654
|
+
emitEvent(this, "activate", {
|
|
1655
|
+
detail: {
|
|
1656
|
+
itemId: this.itemId,
|
|
1657
|
+
value: this.value
|
|
1658
|
+
}
|
|
1659
|
+
});
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
render() {
|
|
1664
|
+
const classes = {
|
|
1665
|
+
"ds-list-item": true
|
|
1666
|
+
};
|
|
1667
|
+
return html16`
|
|
1668
|
+
<li
|
|
1669
|
+
class=${classMap11(classes)}
|
|
1670
|
+
role="option"
|
|
1671
|
+
tabindex=${this.disabled ? -1 : 0}
|
|
1672
|
+
aria-selected=${this.selected ? "true" : "false"}
|
|
1673
|
+
?data-selected=${this.selected}
|
|
1674
|
+
?data-disabled=${this.disabled}
|
|
1675
|
+
aria-disabled=${this.disabled ? "true" : nothing14}
|
|
1676
|
+
@click=${this.handleClick}
|
|
1677
|
+
@keydown=${this.handleKeyDown}
|
|
1678
|
+
>
|
|
1679
|
+
<slot name="leading"></slot>
|
|
1680
|
+
<div class="ds-list-item__content">
|
|
1681
|
+
<span class="ds-list-item__primary">
|
|
1682
|
+
<slot></slot>
|
|
1683
|
+
</span>
|
|
1684
|
+
<slot name="secondary"></slot>
|
|
1685
|
+
</div>
|
|
1686
|
+
<slot name="trailing"></slot>
|
|
1687
|
+
</li>
|
|
1688
|
+
`;
|
|
1689
|
+
}
|
|
1690
|
+
};
|
|
1691
|
+
__decorateClass([
|
|
1692
|
+
property14({ type: String, attribute: "item-id" })
|
|
1693
|
+
], DsListItem.prototype, "itemId", 2);
|
|
1694
|
+
__decorateClass([
|
|
1695
|
+
property14({ type: Boolean, reflect: true })
|
|
1696
|
+
], DsListItem.prototype, "selected", 2);
|
|
1697
|
+
__decorateClass([
|
|
1698
|
+
property14({ type: Boolean, reflect: true })
|
|
1699
|
+
], DsListItem.prototype, "disabled", 2);
|
|
1700
|
+
__decorateClass([
|
|
1701
|
+
property14({ type: String })
|
|
1702
|
+
], DsListItem.prototype, "value", 2);
|
|
1703
|
+
define("ds-list-item", DsListItem);
|
|
1704
|
+
|
|
1705
|
+
// src/components/card/card.ts
|
|
1706
|
+
import { html as html17 } from "lit";
|
|
1707
|
+
var DsCard = class extends DSElement {
|
|
1708
|
+
render() {
|
|
1709
|
+
return html17`<slot></slot>`;
|
|
1710
|
+
}
|
|
1711
|
+
};
|
|
1712
|
+
define("ds-card", DsCard);
|
|
1713
|
+
|
|
1714
|
+
// src/components/card/card-header.ts
|
|
1715
|
+
import { html as html18 } from "lit";
|
|
1716
|
+
var DsCardHeader = class extends DSElement {
|
|
1717
|
+
render() {
|
|
1718
|
+
return html18`<slot></slot>`;
|
|
1719
|
+
}
|
|
1720
|
+
};
|
|
1721
|
+
define("ds-card-header", DsCardHeader);
|
|
1722
|
+
|
|
1723
|
+
// src/components/card/card-content.ts
|
|
1724
|
+
import { html as html19 } from "lit";
|
|
1725
|
+
var DsCardContent = class extends DSElement {
|
|
1726
|
+
render() {
|
|
1727
|
+
return html19`<slot></slot>`;
|
|
1728
|
+
}
|
|
1729
|
+
};
|
|
1730
|
+
define("ds-card-content", DsCardContent);
|
|
1731
|
+
|
|
1732
|
+
// src/components/card/card-footer.ts
|
|
1733
|
+
import { html as html20 } from "lit";
|
|
1734
|
+
var DsCardFooter = class extends DSElement {
|
|
1735
|
+
render() {
|
|
1736
|
+
return html20`<slot></slot>`;
|
|
1737
|
+
}
|
|
1738
|
+
};
|
|
1739
|
+
define("ds-card-footer", DsCardFooter);
|
|
1740
|
+
|
|
1741
|
+
// src/components/separator/separator.ts
|
|
1742
|
+
import { html as html21 } from "lit";
|
|
1743
|
+
import { property as property15 } from "lit/decorators.js";
|
|
1744
|
+
var DsSeparator = class extends DSElement {
|
|
1745
|
+
constructor() {
|
|
1746
|
+
super(...arguments);
|
|
1747
|
+
this.orientation = "horizontal";
|
|
1748
|
+
this.decorative = false;
|
|
1749
|
+
}
|
|
1750
|
+
connectedCallback() {
|
|
1751
|
+
super.connectedCallback();
|
|
1752
|
+
this.updateAccessibility();
|
|
1753
|
+
}
|
|
1754
|
+
updated() {
|
|
1755
|
+
this.updateAccessibility();
|
|
1756
|
+
}
|
|
1757
|
+
updateAccessibility() {
|
|
1758
|
+
if (this.decorative) {
|
|
1759
|
+
this.setAttribute("role", "none");
|
|
1760
|
+
this.removeAttribute("aria-orientation");
|
|
1761
|
+
} else {
|
|
1762
|
+
this.setAttribute("role", "separator");
|
|
1763
|
+
this.setAttribute("aria-orientation", this.orientation);
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
render() {
|
|
1767
|
+
return html21``;
|
|
1768
|
+
}
|
|
1769
|
+
};
|
|
1770
|
+
__decorateClass([
|
|
1771
|
+
property15({ reflect: true })
|
|
1772
|
+
], DsSeparator.prototype, "orientation", 2);
|
|
1773
|
+
__decorateClass([
|
|
1774
|
+
property15({ type: Boolean, reflect: true })
|
|
1775
|
+
], DsSeparator.prototype, "decorative", 2);
|
|
1776
|
+
define("ds-separator", DsSeparator);
|
|
1777
|
+
|
|
1778
|
+
// src/components/aspect-ratio/aspect-ratio.ts
|
|
1779
|
+
import { html as html22 } from "lit";
|
|
1780
|
+
import { property as property16 } from "lit/decorators.js";
|
|
1781
|
+
var DsAspectRatio = class extends DSElement {
|
|
1782
|
+
constructor() {
|
|
1783
|
+
super(...arguments);
|
|
1784
|
+
this.ratio = "1/1";
|
|
1785
|
+
}
|
|
1786
|
+
updated() {
|
|
1787
|
+
this.updateCssVariable();
|
|
1788
|
+
}
|
|
1789
|
+
connectedCallback() {
|
|
1790
|
+
super.connectedCallback();
|
|
1791
|
+
this.updateCssVariable();
|
|
1792
|
+
}
|
|
1793
|
+
updateCssVariable() {
|
|
1794
|
+
const ratioValue = this.parseRatio(this.ratio);
|
|
1795
|
+
this.style.setProperty("--ds-aspect-ratio", String(ratioValue));
|
|
1796
|
+
}
|
|
1797
|
+
parseRatio(ratio) {
|
|
1798
|
+
if (ratio.includes("/")) {
|
|
1799
|
+
const parts = ratio.split("/").map(Number);
|
|
1800
|
+
const width = parts[0];
|
|
1801
|
+
const height = parts[1];
|
|
1802
|
+
if (width !== void 0 && height !== void 0 && !Number.isNaN(width) && !Number.isNaN(height) && height !== 0) {
|
|
1803
|
+
return width / height;
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
const parsed = Number.parseFloat(ratio);
|
|
1807
|
+
return Number.isNaN(parsed) ? 1 : parsed;
|
|
1808
|
+
}
|
|
1809
|
+
render() {
|
|
1810
|
+
return html22`<slot></slot>`;
|
|
1811
|
+
}
|
|
1812
|
+
};
|
|
1813
|
+
__decorateClass([
|
|
1814
|
+
property16({ reflect: true })
|
|
1815
|
+
], DsAspectRatio.prototype, "ratio", 2);
|
|
1816
|
+
define("ds-aspect-ratio", DsAspectRatio);
|
|
1817
|
+
|
|
1818
|
+
export {
|
|
1819
|
+
DsTable,
|
|
1820
|
+
DsTableHeader,
|
|
1821
|
+
DsTableBody,
|
|
1822
|
+
DsTableRow,
|
|
1823
|
+
DsTableHead,
|
|
1824
|
+
DsTableCell,
|
|
1825
|
+
DsDataTable,
|
|
1826
|
+
DsAvatar,
|
|
1827
|
+
DsAvatarGroup,
|
|
1828
|
+
DsBadge,
|
|
1829
|
+
DsTag,
|
|
1830
|
+
DsCalendar,
|
|
1831
|
+
DsTree,
|
|
1832
|
+
DsTreeItem,
|
|
1833
|
+
DsList,
|
|
1834
|
+
DsListItem,
|
|
1835
|
+
DsCard,
|
|
1836
|
+
DsCardHeader,
|
|
1837
|
+
DsCardContent,
|
|
1838
|
+
DsCardFooter,
|
|
1839
|
+
DsSeparator,
|
|
1840
|
+
DsAspectRatio
|
|
1841
|
+
};
|
|
1842
|
+
//# sourceMappingURL=chunk-DNNI5BDE.js.map
|