@avento-space/ts-ui 1.2.2 → 1.2.4
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/README.md +7 -14
- package/dist/{card.wc-pFLgjfwm.d.ts → card.wc-83Ws3o27.d.ts} +33 -1
- package/dist/{chunk-RQZ7KDYP.js → chunk-2JEFDU25.js} +349 -81
- package/dist/chunk-2JEFDU25.js.map +1 -0
- package/dist/chunk-6SD5UBY6.js +4983 -0
- package/dist/chunk-6SD5UBY6.js.map +1 -0
- package/dist/chunk-AOFVLHAJ.js +2254 -0
- package/dist/chunk-AOFVLHAJ.js.map +1 -0
- package/dist/{chunk-QTANS5ZS.js → chunk-GJ6NMUKU.js} +4 -4
- package/dist/{chunk-QTANS5ZS.js.map → chunk-GJ6NMUKU.js.map} +1 -1
- package/dist/chunk-YRHQNIPK.js +3 -0
- package/dist/{chunk-T7QLIHHU.js.map → chunk-YRHQNIPK.js.map} +1 -1
- package/dist/components/index.d.ts +9 -10
- package/dist/components/index.js +3 -3
- package/dist/define.js +4 -4
- package/dist/icons/index.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/react/index.d.ts +4 -2
- package/dist/react/index.js +66 -8
- package/dist/react/index.js.map +1 -1
- package/dist/slot.wc-BvIJg5UJ.d.ts +11 -0
- package/package.json +7 -3
- package/dist/chunk-ICB6OBEZ.js +0 -2087
- package/dist/chunk-ICB6OBEZ.js.map +0 -1
- package/dist/chunk-RATTHYIP.js +0 -4855
- package/dist/chunk-RATTHYIP.js.map +0 -1
- package/dist/chunk-RQZ7KDYP.js.map +0 -1
- package/dist/chunk-T7QLIHHU.js +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UElement, buttonStyles, inputStyles, boxStyles, listStyles, textStyles, stackStyles, gridStyles, overlayStyles, fieldStyles, checkboxStyles, selectStyles, linkStyles, containerStyles, dialogStyles, tooltipStyles, textareaStyles, radioStyles, switchStyles, labelStyles, treeStyles, tableStyles, breadcrumbStyles, tabsStyles, visuallyHiddenStyles, presenceStyles, animateKeyframes, modalStyles, drawerStyles, popoverStyles, dropdownStyles, accordionStyles, comboboxStyles, calendarStyles, dataTableStyles, commandPaletteStyles, toastStyles, contextMenuStyles, sortableStyles, formStyles, badgeStyles, cardStyles } from './chunk-
|
|
1
|
+
import { UElement, buttonStyles, inputStyles, boxStyles, listStyles, textStyles, stackStyles, gridStyles, overlayStyles, fieldStyles, checkboxStyles, selectStyles, linkStyles, containerStyles, dialogStyles, tooltipStyles, textareaStyles, radioStyles, switchStyles, labelStyles, treeStyles, tableStyles, breadcrumbStyles, tabsStyles, visuallyHiddenStyles, presenceStyles, animateKeyframes, modalStyles, drawerStyles, popoverStyles, dropdownStyles, accordionStyles, comboboxStyles, calendarStyles, dataTableStyles, commandPaletteStyles, toastStyles, contextMenuStyles, sortableStyles, formStyles, badgeStyles, cardStyles } from './chunk-AOFVLHAJ.js';
|
|
2
2
|
import { signal, effect } from './chunk-Q5RCPPCF.js';
|
|
3
3
|
|
|
4
4
|
// src/components/button.wc.ts
|
|
@@ -12,7 +12,7 @@ var UButton = class extends UElement {
|
|
|
12
12
|
this._root.innerHTML = `<style>${buttonStyles}</style><button part="button"><slot></slot></button>`;
|
|
13
13
|
}
|
|
14
14
|
static get observedAttributes() {
|
|
15
|
-
return ["variant", "size", "disabled", "type"];
|
|
15
|
+
return ["variant", "size", "disabled", "type", "class"];
|
|
16
16
|
}
|
|
17
17
|
get variant() {
|
|
18
18
|
return this._variant;
|
|
@@ -73,7 +73,7 @@ var UButton = class extends UElement {
|
|
|
73
73
|
}
|
|
74
74
|
_sync() {
|
|
75
75
|
const btn = this._root.querySelector("button");
|
|
76
|
-
btn.className = `btn btn-${this._variant} btn-${this._size}
|
|
76
|
+
btn.className = `btn btn-${this._variant} btn-${this._size} ${this.className}`.trim();
|
|
77
77
|
btn.disabled = this._disabled;
|
|
78
78
|
btn.type = this._buttonType;
|
|
79
79
|
}
|
|
@@ -98,10 +98,10 @@ var UInput = class extends UElement {
|
|
|
98
98
|
this._readonly = false;
|
|
99
99
|
this._inputType = "text";
|
|
100
100
|
this._inputName = "";
|
|
101
|
-
this._root.innerHTML = `<style>${inputStyles}</style><div class="input-wrapper"><input part="input" /></div>`;
|
|
101
|
+
this._root.innerHTML = `<style>${inputStyles}</style><div part="wrapper" class="input-wrapper"><input part="input" /></div>`;
|
|
102
102
|
}
|
|
103
103
|
static get observedAttributes() {
|
|
104
|
-
return ["placeholder", "disabled", "readonly", "type", "name"];
|
|
104
|
+
return ["placeholder", "disabled", "readonly", "type", "name", "class"];
|
|
105
105
|
}
|
|
106
106
|
get value() {
|
|
107
107
|
return this._root.querySelector("input")?.value ?? "";
|
|
@@ -175,6 +175,7 @@ var UInput = class extends UElement {
|
|
|
175
175
|
_sync() {
|
|
176
176
|
const input = this._root.querySelector("input");
|
|
177
177
|
if (!input) return;
|
|
178
|
+
input.className = this.className;
|
|
178
179
|
input.placeholder = this._placeholder;
|
|
179
180
|
input.disabled = this._disabled;
|
|
180
181
|
input.readOnly = this._readonly;
|
|
@@ -237,7 +238,7 @@ var UBox = class extends UElement {
|
|
|
237
238
|
this._root.innerHTML = `<style>${boxStyles}</style><div part="box"><slot></slot></div>`;
|
|
238
239
|
}
|
|
239
240
|
static get observedAttributes() {
|
|
240
|
-
return ["as"];
|
|
241
|
+
return ["as", "class"];
|
|
241
242
|
}
|
|
242
243
|
get as() {
|
|
243
244
|
return this._as;
|
|
@@ -268,6 +269,7 @@ var UBox = class extends UElement {
|
|
|
268
269
|
}
|
|
269
270
|
const wrapper = document.createElement(this._as);
|
|
270
271
|
wrapper.setAttribute("part", "box");
|
|
272
|
+
wrapper.className = `box ${this.className}`.trim();
|
|
271
273
|
const newSlot = document.createElement("slot");
|
|
272
274
|
wrapper.appendChild(newSlot);
|
|
273
275
|
this._root.innerHTML = `<style>${boxStyles}</style>`;
|
|
@@ -277,6 +279,8 @@ var UBox = class extends UElement {
|
|
|
277
279
|
const inner = this._root.querySelector('[part="box"]');
|
|
278
280
|
if (!inner || inner.tagName.toLowerCase() !== this._as) {
|
|
279
281
|
this._rebuild();
|
|
282
|
+
} else {
|
|
283
|
+
inner.className = `box ${this.className}`.trim();
|
|
280
284
|
}
|
|
281
285
|
}
|
|
282
286
|
_mount() {
|
|
@@ -292,6 +296,9 @@ var UList = class extends UElement {
|
|
|
292
296
|
this._emptyText = "";
|
|
293
297
|
this._root.innerHTML = `<style>${listStyles}</style><ul part="list"><slot></slot></ul>`;
|
|
294
298
|
}
|
|
299
|
+
static get observedAttributes() {
|
|
300
|
+
return ["class"];
|
|
301
|
+
}
|
|
295
302
|
get items() {
|
|
296
303
|
return this._items;
|
|
297
304
|
}
|
|
@@ -333,6 +340,18 @@ var UList = class extends UElement {
|
|
|
333
340
|
ul.appendChild(li);
|
|
334
341
|
}
|
|
335
342
|
}
|
|
343
|
+
connectedCallback() {
|
|
344
|
+
super.connectedCallback();
|
|
345
|
+
this._sync();
|
|
346
|
+
}
|
|
347
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
348
|
+
if (oldVal === newVal) return;
|
|
349
|
+
if (name === "class") this._sync();
|
|
350
|
+
}
|
|
351
|
+
_sync() {
|
|
352
|
+
const ul = this._root.querySelector("ul");
|
|
353
|
+
ul.className = this.className;
|
|
354
|
+
}
|
|
336
355
|
_mount() {
|
|
337
356
|
}
|
|
338
357
|
};
|
|
@@ -351,7 +370,7 @@ var UVirtualList = class extends UElement {
|
|
|
351
370
|
</style><div class="viewport" part="viewport"></div>`;
|
|
352
371
|
}
|
|
353
372
|
static get observedAttributes() {
|
|
354
|
-
return ["item-height", "container-height", "overscan"];
|
|
373
|
+
return ["item-height", "container-height", "overscan", "class"];
|
|
355
374
|
}
|
|
356
375
|
get items() {
|
|
357
376
|
return this._items;
|
|
@@ -411,11 +430,13 @@ var UVirtualList = class extends UElement {
|
|
|
411
430
|
const visibleCount = Math.ceil(this._containerHeight / this._itemHeight) + this._overscan * 2;
|
|
412
431
|
const startIndex = Math.max(0, Math.floor(scrollTop / this._itemHeight) - this._overscan);
|
|
413
432
|
const endIndex = Math.min(this._items.length, startIndex + visibleCount);
|
|
433
|
+
viewport.className = `viewport ${this.className}`.trim();
|
|
414
434
|
viewport.style.height = `${totalHeight}px`;
|
|
415
435
|
viewport.innerHTML = "";
|
|
416
436
|
for (let i = startIndex; i < endIndex; i++) {
|
|
417
437
|
const div = document.createElement("div");
|
|
418
438
|
div.className = "item";
|
|
439
|
+
div.setAttribute("part", "item");
|
|
419
440
|
div.style.top = `${i * this._itemHeight}px`;
|
|
420
441
|
div.style.height = `${this._itemHeight}px`;
|
|
421
442
|
const content = this._renderItem(this._items[i], i);
|
|
@@ -515,7 +536,7 @@ var UText = class extends UElement {
|
|
|
515
536
|
this._root.innerHTML = `<style>${textStyles}</style><span part="text"><slot></slot></span>`;
|
|
516
537
|
}
|
|
517
538
|
static get observedAttributes() {
|
|
518
|
-
return ["size", "weight", "color", "as", "align", "truncate"];
|
|
539
|
+
return ["size", "weight", "color", "as", "align", "truncate", "class"];
|
|
519
540
|
}
|
|
520
541
|
get size() {
|
|
521
542
|
return this._size;
|
|
@@ -591,7 +612,7 @@ var UText = class extends UElement {
|
|
|
591
612
|
_sync() {
|
|
592
613
|
const el = this._root.querySelector('[part="text"]');
|
|
593
614
|
if (!el) return;
|
|
594
|
-
el.className = `text text-${this._size} text-${this._weight} text-${this._color} text-${this._align}
|
|
615
|
+
el.className = `text text-${this._size} text-${this._weight} text-${this._color} text-${this._align} ${this.className}`.trim();
|
|
595
616
|
if (this._truncate) el.classList.add("text-truncate");
|
|
596
617
|
}
|
|
597
618
|
_mount() {
|
|
@@ -606,10 +627,11 @@ var UStack = class extends UElement {
|
|
|
606
627
|
this._align = "stretch";
|
|
607
628
|
this._justify = "start";
|
|
608
629
|
this._wrap = false;
|
|
630
|
+
this._direction = "v";
|
|
609
631
|
this._root.innerHTML = `<style>${stackStyles}</style><div part="stack" class="stack stack-v"><slot></slot></div>`;
|
|
610
632
|
}
|
|
611
633
|
static get observedAttributes() {
|
|
612
|
-
return ["gap", "align", "justify", "wrap"];
|
|
634
|
+
return ["gap", "align", "justify", "wrap", "class"];
|
|
613
635
|
}
|
|
614
636
|
get gap() {
|
|
615
637
|
return this._gap;
|
|
@@ -653,6 +675,7 @@ var UStack = class extends UElement {
|
|
|
653
675
|
}
|
|
654
676
|
_sync() {
|
|
655
677
|
const el = this._root.querySelector('[part="stack"]');
|
|
678
|
+
el.className = `stack stack-${this._direction} ${this.className}`.trim();
|
|
656
679
|
el.style.gap = `${this._gap}px`;
|
|
657
680
|
el.style.alignItems = this._align === "stretch" ? "stretch" : `flex-${this._align === "start" ? "start" : this._align === "end" ? "end" : this._align}`;
|
|
658
681
|
el.style.justifyContent = this._justify === "start" ? "flex-start" : this._justify === "end" ? "flex-end" : this._justify === "between" ? "space-between" : this._justify === "around" ? "space-around" : "flex-start";
|
|
@@ -665,9 +688,7 @@ var UStack = class extends UElement {
|
|
|
665
688
|
var UHStack = class extends UStack {
|
|
666
689
|
constructor() {
|
|
667
690
|
super();
|
|
668
|
-
|
|
669
|
-
el.classList.remove("stack-v");
|
|
670
|
-
el.classList.add("stack-h");
|
|
691
|
+
this._direction = "h";
|
|
671
692
|
}
|
|
672
693
|
};
|
|
673
694
|
|
|
@@ -681,7 +702,7 @@ var UGrid = class extends UElement {
|
|
|
681
702
|
this._root.innerHTML = `<style>${gridStyles}</style><div part="grid" class="grid"><slot></slot></div>`;
|
|
682
703
|
}
|
|
683
704
|
static get observedAttributes() {
|
|
684
|
-
return ["columns", "gap", "align"];
|
|
705
|
+
return ["columns", "gap", "align", "class"];
|
|
685
706
|
}
|
|
686
707
|
get columns() {
|
|
687
708
|
return this._columns;
|
|
@@ -716,6 +737,7 @@ var UGrid = class extends UElement {
|
|
|
716
737
|
}
|
|
717
738
|
_sync() {
|
|
718
739
|
const el = this._root.querySelector('[part="grid"]');
|
|
740
|
+
el.className = `grid ${this.className}`.trim();
|
|
719
741
|
el.style.gridTemplateColumns = `repeat(${this._columns}, 1fr)`;
|
|
720
742
|
el.style.gap = `${this._gap}px`;
|
|
721
743
|
el.style.alignItems = this._align === "stretch" ? "stretch" : `flex-${this._align}`;
|
|
@@ -750,7 +772,7 @@ var UPressable = class extends UElement {
|
|
|
750
772
|
this._root.addEventListener("keyup", (e) => this._onKeyUp(e));
|
|
751
773
|
}
|
|
752
774
|
static get observedAttributes() {
|
|
753
|
-
return ["disabled"];
|
|
775
|
+
return ["disabled", "class"];
|
|
754
776
|
}
|
|
755
777
|
get disabled() {
|
|
756
778
|
return this._disabled;
|
|
@@ -773,9 +795,13 @@ var UPressable = class extends UElement {
|
|
|
773
795
|
if (name === "disabled") {
|
|
774
796
|
this._disabled = newVal !== null;
|
|
775
797
|
this._sync();
|
|
798
|
+
} else if (name === "class") {
|
|
799
|
+
this._sync();
|
|
776
800
|
}
|
|
777
801
|
}
|
|
778
802
|
_sync() {
|
|
803
|
+
const pressableEl = this._root.querySelector('[part="pressable"]');
|
|
804
|
+
pressableEl.className = `pressable ${this.className}`.trim();
|
|
779
805
|
if (this._disabled) {
|
|
780
806
|
this.setAttribute("aria-disabled", "true");
|
|
781
807
|
} else {
|
|
@@ -968,7 +994,7 @@ var UOverlay = class extends UElement {
|
|
|
968
994
|
this._root.innerHTML = `<style>${overlayStyles}</style><div part="overlay" class="overlay" hidden><slot></slot></div>`;
|
|
969
995
|
}
|
|
970
996
|
static get observedAttributes() {
|
|
971
|
-
return ["visible", "opacity", "blur"];
|
|
997
|
+
return ["visible", "opacity", "blur", "class"];
|
|
972
998
|
}
|
|
973
999
|
get visible() {
|
|
974
1000
|
return this._visible;
|
|
@@ -1005,6 +1031,7 @@ var UOverlay = class extends UElement {
|
|
|
1005
1031
|
}
|
|
1006
1032
|
_sync() {
|
|
1007
1033
|
const el = this._root.querySelector('[part="overlay"]');
|
|
1034
|
+
el.className = `overlay ${this.className}`.trim();
|
|
1008
1035
|
if (this._visible) {
|
|
1009
1036
|
el.removeAttribute("hidden");
|
|
1010
1037
|
el.style.opacity = String(this._opacity);
|
|
@@ -1044,7 +1071,7 @@ var UField = class extends UElement {
|
|
|
1044
1071
|
this._root.innerHTML = `<style>${fieldStyles}</style><div part="field" class="field"><label part="label" class="field-label"></label><div part="content" class="field-content"><slot></slot></div><div part="hint" class="field-hint"></div><div part="error" class="field-error" role="alert"></div></div>`;
|
|
1045
1072
|
}
|
|
1046
1073
|
static get observedAttributes() {
|
|
1047
|
-
return ["label", "error", "hint", "required"];
|
|
1074
|
+
return ["label", "error", "hint", "required", "class"];
|
|
1048
1075
|
}
|
|
1049
1076
|
get label() {
|
|
1050
1077
|
return this._label;
|
|
@@ -1095,6 +1122,8 @@ var UField = class extends UElement {
|
|
|
1095
1122
|
this._sync();
|
|
1096
1123
|
}
|
|
1097
1124
|
_sync() {
|
|
1125
|
+
const fieldEl = this._root.querySelector('[part="field"]');
|
|
1126
|
+
fieldEl.className = `field ${this.className}`.trim();
|
|
1098
1127
|
const labelEl = this._root.querySelector('[part="label"]');
|
|
1099
1128
|
labelEl.textContent = this._label;
|
|
1100
1129
|
if (this._required) labelEl.classList.add("field-label-required");
|
|
@@ -1117,10 +1146,10 @@ var UCheckbox = class extends UElement {
|
|
|
1117
1146
|
this._checked = false;
|
|
1118
1147
|
this._disabled = false;
|
|
1119
1148
|
this._value = "";
|
|
1120
|
-
this._root.innerHTML = `<style>${checkboxStyles}</style><label part="checkbox" class="checkbox"><input type="checkbox" part="input" /><span part="indicator" class="checkbox-indicator"><svg viewBox="0 0 12 12" width="12" height="12"><path d="M2.5 6L5 8.5L9.5 3.5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></span
|
|
1149
|
+
this._root.innerHTML = `<style>${checkboxStyles}</style><label part="checkbox" class="checkbox"><input type="checkbox" part="input" /><span part="indicator" class="checkbox-indicator"><svg viewBox="0 0 12 12" width="12" height="12"><path d="M2.5 6L5 8.5L9.5 3.5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></span><!-- @deprecated label-text \u2192 use part="label" --><span part="label-text label" class="checkbox-label"><slot></slot></span></label>`;
|
|
1121
1150
|
}
|
|
1122
1151
|
static get observedAttributes() {
|
|
1123
|
-
return ["checked", "disabled", "value"];
|
|
1152
|
+
return ["checked", "disabled", "value", "class"];
|
|
1124
1153
|
}
|
|
1125
1154
|
get checked() {
|
|
1126
1155
|
return this._checked;
|
|
@@ -1171,6 +1200,8 @@ var UCheckbox = class extends UElement {
|
|
|
1171
1200
|
const indicator = this._root.querySelector('[part="indicator"]');
|
|
1172
1201
|
if (this._checked) indicator.classList.add("checked");
|
|
1173
1202
|
else indicator.classList.remove("checked");
|
|
1203
|
+
const checkbox = this._root.querySelector('[part="checkbox"]');
|
|
1204
|
+
checkbox.className = `checkbox ${this.className}`.trim();
|
|
1174
1205
|
}
|
|
1175
1206
|
_mount() {
|
|
1176
1207
|
const input = this._root.querySelector("input");
|
|
@@ -1201,7 +1232,7 @@ var USelect = class extends UElement {
|
|
|
1201
1232
|
this._root.innerHTML = `<style>${selectStyles}</style><div part="select" class="select-wrapper"><select part="native-select" class="select"></select><span part="arrow" class="select-arrow"><svg viewBox="0 0 16 16" width="16" height="16"><path d="M4 6L8 10L12 6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></span></div>`;
|
|
1202
1233
|
}
|
|
1203
1234
|
static get observedAttributes() {
|
|
1204
|
-
return ["placeholder", "disabled", "value"];
|
|
1235
|
+
return ["placeholder", "disabled", "value", "class"];
|
|
1205
1236
|
}
|
|
1206
1237
|
get value() {
|
|
1207
1238
|
return this._value;
|
|
@@ -1274,6 +1305,8 @@ var USelect = class extends UElement {
|
|
|
1274
1305
|
const select = this._root.querySelector("select");
|
|
1275
1306
|
select.disabled = this._disabled;
|
|
1276
1307
|
if (this._value) select.value = this._value;
|
|
1308
|
+
const selectEl = this._root.querySelector('[part="select"]');
|
|
1309
|
+
selectEl.className = `select-wrapper ${this.className}`.trim();
|
|
1277
1310
|
}
|
|
1278
1311
|
_mount() {
|
|
1279
1312
|
const select = this._root.querySelector("select");
|
|
@@ -1306,7 +1339,7 @@ var ULink = class extends UElement {
|
|
|
1306
1339
|
this._root.innerHTML = `<style>${linkStyles}</style><a part="link" class="link"><slot></slot></a>`;
|
|
1307
1340
|
}
|
|
1308
1341
|
static get observedAttributes() {
|
|
1309
|
-
return ["href", "target", "rel", "disabled", "variant", "underline", "external", "download"];
|
|
1342
|
+
return ["href", "target", "rel", "disabled", "variant", "underline", "external", "download", "class"];
|
|
1310
1343
|
}
|
|
1311
1344
|
get href() {
|
|
1312
1345
|
return this._href;
|
|
@@ -1395,7 +1428,7 @@ var ULink = class extends UElement {
|
|
|
1395
1428
|
anchor.rel = this._rel || (anchor.target === "_blank" ? "noopener noreferrer" : "");
|
|
1396
1429
|
if (this._download) anchor.setAttribute("download", this._download);
|
|
1397
1430
|
else anchor.removeAttribute("download");
|
|
1398
|
-
anchor.className = `link link-${this._variant} link-underline-${this._underline}
|
|
1431
|
+
anchor.className = `link link-${this._variant} link-underline-${this._underline} ${this.className}`.trim();
|
|
1399
1432
|
if (this._disabled) {
|
|
1400
1433
|
anchor.classList.add("link-disabled");
|
|
1401
1434
|
anchor.setAttribute("aria-disabled", "true");
|
|
@@ -1424,7 +1457,7 @@ var USpacer = class extends UElement {
|
|
|
1424
1457
|
this._root.innerHTML = `<div part="spacer" style="flex:1"></div>`;
|
|
1425
1458
|
}
|
|
1426
1459
|
static get observedAttributes() {
|
|
1427
|
-
return ["size"];
|
|
1460
|
+
return ["size", "class"];
|
|
1428
1461
|
}
|
|
1429
1462
|
get size() {
|
|
1430
1463
|
return this._size;
|
|
@@ -1440,11 +1473,12 @@ var USpacer = class extends UElement {
|
|
|
1440
1473
|
if (oldVal === newVal) return;
|
|
1441
1474
|
if (name === "size") {
|
|
1442
1475
|
this._size = Number(newVal) || 0;
|
|
1443
|
-
this._sync();
|
|
1444
1476
|
}
|
|
1477
|
+
this._sync();
|
|
1445
1478
|
}
|
|
1446
1479
|
_sync() {
|
|
1447
1480
|
const el = this._root.querySelector('[part="spacer"]');
|
|
1481
|
+
el.className = `spacer ${this.className}`.trim();
|
|
1448
1482
|
if (this._size > 0) {
|
|
1449
1483
|
el.style.flex = "none";
|
|
1450
1484
|
el.style.width = `${this._size}px`;
|
|
@@ -1468,7 +1502,7 @@ var UContainer = class extends UElement {
|
|
|
1468
1502
|
this._root.innerHTML = `<style>${containerStyles}</style><div part="container" class="container"><slot></slot></div>`;
|
|
1469
1503
|
}
|
|
1470
1504
|
static get observedAttributes() {
|
|
1471
|
-
return ["max-width", "padding"];
|
|
1505
|
+
return ["max-width", "padding", "class"];
|
|
1472
1506
|
}
|
|
1473
1507
|
get maxWidth() {
|
|
1474
1508
|
return this._maxWidth;
|
|
@@ -1488,6 +1522,7 @@ var UContainer = class extends UElement {
|
|
|
1488
1522
|
}
|
|
1489
1523
|
_sync() {
|
|
1490
1524
|
const el = this._root.querySelector('[part="container"]');
|
|
1525
|
+
el.className = `container ${this.className}`.trim();
|
|
1491
1526
|
el.style.maxWidth = this._maxWidth;
|
|
1492
1527
|
el.style.padding = this._padding;
|
|
1493
1528
|
}
|
|
@@ -1959,10 +1994,10 @@ var UTooltipRoot = class extends UElement {
|
|
|
1959
1994
|
this._disabled = false;
|
|
1960
1995
|
this._showTimeout = null;
|
|
1961
1996
|
this._hideTimeout = null;
|
|
1962
|
-
this._root.innerHTML = `<style>${tooltipStyles}</style><div part="trigger" class="tooltip-trigger" style="display:inline-flex"><slot></slot></div><div part="tooltip" class="tooltip" role="tooltip" hidden
|
|
1997
|
+
this._root.innerHTML = `<style>${tooltipStyles}</style><div part="trigger" class="tooltip-trigger" style="display:inline-flex"><slot></slot></div><div part="tooltip" class="tooltip" role="tooltip" hidden><!-- @deprecated tooltip-content \u2192 use part="content" --><div part="tooltip-content content" class="tooltip-content"></div><div part="arrow" class="tooltip-arrow"></div></div>`;
|
|
1963
1998
|
}
|
|
1964
1999
|
static get observedAttributes() {
|
|
1965
|
-
return ["content", "placement", "delay", "disabled"];
|
|
2000
|
+
return ["content", "placement", "delay", "disabled", "class"];
|
|
1966
2001
|
}
|
|
1967
2002
|
get content() {
|
|
1968
2003
|
return this._content;
|
|
@@ -2005,7 +2040,9 @@ var UTooltipRoot = class extends UElement {
|
|
|
2005
2040
|
this._sync();
|
|
2006
2041
|
}
|
|
2007
2042
|
_sync() {
|
|
2008
|
-
const
|
|
2043
|
+
const triggerEl = this._root.querySelector('[part="trigger"]');
|
|
2044
|
+
triggerEl.className = `tooltip-trigger ${this.className}`.trim();
|
|
2045
|
+
const contentEl = this._root.querySelector('[part~="tooltip-content"]');
|
|
2009
2046
|
contentEl.textContent = this._content;
|
|
2010
2047
|
}
|
|
2011
2048
|
show() {
|
|
@@ -2061,10 +2098,10 @@ var UTextarea = class extends UElement {
|
|
|
2061
2098
|
this._rows = 3;
|
|
2062
2099
|
this._maxLength = -1;
|
|
2063
2100
|
this._name = "";
|
|
2064
|
-
this._root.innerHTML = `<style>${textareaStyles}</style><div class="textarea-wrapper"><textarea part="textarea"></textarea></div>`;
|
|
2101
|
+
this._root.innerHTML = `<style>${textareaStyles}</style><div part="wrapper" class="textarea-wrapper"><textarea part="textarea"></textarea></div>`;
|
|
2065
2102
|
}
|
|
2066
2103
|
static get observedAttributes() {
|
|
2067
|
-
return ["placeholder", "disabled", "readonly", "rows", "max-length", "name"];
|
|
2104
|
+
return ["placeholder", "disabled", "readonly", "rows", "max-length", "name", "class"];
|
|
2068
2105
|
}
|
|
2069
2106
|
get value() {
|
|
2070
2107
|
return this._root.querySelector("textarea")?.value ?? "";
|
|
@@ -2130,6 +2167,8 @@ var UTextarea = class extends UElement {
|
|
|
2130
2167
|
ta.rows = this._rows;
|
|
2131
2168
|
if (this._maxLength > 0) ta.maxLength = this._maxLength;
|
|
2132
2169
|
ta.name = this._name;
|
|
2170
|
+
const wrapper = this._root.querySelector(".textarea-wrapper");
|
|
2171
|
+
wrapper.className = `textarea-wrapper ${this.className}`.trim();
|
|
2133
2172
|
}
|
|
2134
2173
|
_mount() {
|
|
2135
2174
|
const ta = this._root.querySelector("textarea");
|
|
@@ -2165,7 +2204,7 @@ var URadioGroup = class extends UElement {
|
|
|
2165
2204
|
this._root.innerHTML = `<style>${radioStyles}</style><div part="group" class="radio-group" role="radiogroup"><slot></slot></div>`;
|
|
2166
2205
|
}
|
|
2167
2206
|
static get observedAttributes() {
|
|
2168
|
-
return ["value", "name", "disabled", "orientation"];
|
|
2207
|
+
return ["value", "name", "disabled", "orientation", "class"];
|
|
2169
2208
|
}
|
|
2170
2209
|
get value() {
|
|
2171
2210
|
return this._value;
|
|
@@ -2211,6 +2250,7 @@ var URadioGroup = class extends UElement {
|
|
|
2211
2250
|
}
|
|
2212
2251
|
_sync() {
|
|
2213
2252
|
const group = this._root.querySelector('[part="group"]');
|
|
2253
|
+
group.className = `radio-group ${this.className}`.trim();
|
|
2214
2254
|
group.style.flexDirection = this._orientation === "horizontal" ? "row" : "column";
|
|
2215
2255
|
group.style.gap = this._orientation === "horizontal" ? "16px" : "8px";
|
|
2216
2256
|
if (this._name) group.setAttribute("aria-labelledby", this._name);
|
|
@@ -2250,7 +2290,7 @@ var URadio = class extends UElement {
|
|
|
2250
2290
|
this._root.innerHTML = `<style>${radioStyles}</style><label part="radio" class="radio"><input type="radio" part="input" /><span part="circle" class="radio-circle"></span><span part="label" class="radio-label"><slot></slot></span></label>`;
|
|
2251
2291
|
}
|
|
2252
2292
|
static get observedAttributes() {
|
|
2253
|
-
return ["value", "disabled", "checked"];
|
|
2293
|
+
return ["value", "disabled", "checked", "class"];
|
|
2254
2294
|
}
|
|
2255
2295
|
get value() {
|
|
2256
2296
|
return this._value;
|
|
@@ -2301,6 +2341,8 @@ var URadio = class extends UElement {
|
|
|
2301
2341
|
const circle = this._root.querySelector('[part="circle"]');
|
|
2302
2342
|
if (this._checked) circle.classList.add("checked");
|
|
2303
2343
|
else circle.classList.remove("checked");
|
|
2344
|
+
const radio = this._root.querySelector('[part="radio"]');
|
|
2345
|
+
radio.className = `radio ${this.className}`.trim();
|
|
2304
2346
|
}
|
|
2305
2347
|
_mount() {
|
|
2306
2348
|
const input = this._root.querySelector("input");
|
|
@@ -2329,7 +2371,7 @@ var USwitch = class extends UElement {
|
|
|
2329
2371
|
this._root.innerHTML = `<style>${switchStyles}</style><label part="switch" class="switch"><input type="checkbox" part="input" role="switch" /><span part="track" class="switch-track"><span part="thumb" class="switch-thumb"></span></span></label>`;
|
|
2330
2372
|
}
|
|
2331
2373
|
static get observedAttributes() {
|
|
2332
|
-
return ["checked", "disabled"];
|
|
2374
|
+
return ["checked", "disabled", "class"];
|
|
2333
2375
|
}
|
|
2334
2376
|
get checked() {
|
|
2335
2377
|
return this._checked;
|
|
@@ -2370,6 +2412,8 @@ var USwitch = class extends UElement {
|
|
|
2370
2412
|
const track = this._root.querySelector('[part="track"]');
|
|
2371
2413
|
if (this._checked) track.classList.add("checked");
|
|
2372
2414
|
else track.classList.remove("checked");
|
|
2415
|
+
const switchEl = this._root.querySelector('[part="switch"]');
|
|
2416
|
+
switchEl.className = `switch ${this.className}`.trim();
|
|
2373
2417
|
}
|
|
2374
2418
|
_mount() {
|
|
2375
2419
|
const input = this._root.querySelector("input");
|
|
@@ -2396,7 +2440,7 @@ var ULabel = class extends UElement {
|
|
|
2396
2440
|
this._root.innerHTML = `<style>${labelStyles}</style><label part="label" class="label"><slot></slot></label>`;
|
|
2397
2441
|
}
|
|
2398
2442
|
static get observedAttributes() {
|
|
2399
|
-
return ["for", "required"];
|
|
2443
|
+
return ["for", "required", "class"];
|
|
2400
2444
|
}
|
|
2401
2445
|
get htmlFor() {
|
|
2402
2446
|
return this._for;
|
|
@@ -2424,10 +2468,9 @@ var ULabel = class extends UElement {
|
|
|
2424
2468
|
}
|
|
2425
2469
|
_sync() {
|
|
2426
2470
|
const label = this._root.querySelector("label");
|
|
2471
|
+
label.className = `label ${this._required ? "label-required" : ""} ${this.className}`.trim();
|
|
2427
2472
|
if (this._for) label.setAttribute("for", this._for);
|
|
2428
2473
|
else label.removeAttribute("for");
|
|
2429
|
-
if (this._required) label.classList.add("label-required");
|
|
2430
|
-
else label.classList.remove("label-required");
|
|
2431
2474
|
}
|
|
2432
2475
|
_mount() {
|
|
2433
2476
|
}
|
|
@@ -2443,7 +2486,7 @@ var UCollection = class extends UElement {
|
|
|
2443
2486
|
this._root.innerHTML = `<div part="collection" class="collection" role="listbox"><slot></slot></div>`;
|
|
2444
2487
|
}
|
|
2445
2488
|
static get observedAttributes() {
|
|
2446
|
-
return ["selection"];
|
|
2489
|
+
return ["selection", "class"];
|
|
2447
2490
|
}
|
|
2448
2491
|
get items() {
|
|
2449
2492
|
return this._items;
|
|
@@ -2489,12 +2532,18 @@ var UCollection = class extends UElement {
|
|
|
2489
2532
|
}
|
|
2490
2533
|
connectedCallback() {
|
|
2491
2534
|
super.connectedCallback();
|
|
2535
|
+
this._sync();
|
|
2492
2536
|
}
|
|
2493
2537
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
2494
2538
|
if (oldVal === newVal) return;
|
|
2495
2539
|
if (name === "selection") {
|
|
2496
2540
|
this._selection = newVal ?? "none";
|
|
2497
2541
|
}
|
|
2542
|
+
this._sync();
|
|
2543
|
+
}
|
|
2544
|
+
_sync() {
|
|
2545
|
+
const el = this._root.querySelector('[part="collection"]');
|
|
2546
|
+
el.className = `collection ${this.className}`.trim();
|
|
2498
2547
|
}
|
|
2499
2548
|
_updateItems() {
|
|
2500
2549
|
const slot = this._root.querySelector("slot");
|
|
@@ -2539,7 +2588,15 @@ var UTree = class extends UElement {
|
|
|
2539
2588
|
this._root.addEventListener("click", (e) => this._onClick(e));
|
|
2540
2589
|
}
|
|
2541
2590
|
static get observedAttributes() {
|
|
2542
|
-
return [];
|
|
2591
|
+
return ["class"];
|
|
2592
|
+
}
|
|
2593
|
+
connectedCallback() {
|
|
2594
|
+
super.connectedCallback();
|
|
2595
|
+
this._sync();
|
|
2596
|
+
}
|
|
2597
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
2598
|
+
if (oldVal === newVal) return;
|
|
2599
|
+
if (name === "class") this._sync();
|
|
2543
2600
|
}
|
|
2544
2601
|
get items() {
|
|
2545
2602
|
return this._items;
|
|
@@ -2548,6 +2605,10 @@ var UTree = class extends UElement {
|
|
|
2548
2605
|
this._items = val;
|
|
2549
2606
|
this._render();
|
|
2550
2607
|
}
|
|
2608
|
+
_sync() {
|
|
2609
|
+
const el = this._root.querySelector('[part="tree"]');
|
|
2610
|
+
el.className = `tree ${this.className}`.trim();
|
|
2611
|
+
}
|
|
2551
2612
|
_render() {
|
|
2552
2613
|
const container = this._root.querySelector('[part="tree"]');
|
|
2553
2614
|
container.innerHTML = "";
|
|
@@ -2558,33 +2619,39 @@ var UTree = class extends UElement {
|
|
|
2558
2619
|
_renderNode(node, depth) {
|
|
2559
2620
|
const li = document.createElement("li");
|
|
2560
2621
|
li.className = "tree-node";
|
|
2622
|
+
li.setAttribute("part", "node");
|
|
2561
2623
|
li.setAttribute("role", "treeitem");
|
|
2562
2624
|
li.setAttribute("data-id", node.id);
|
|
2563
2625
|
li.setAttribute("aria-expanded", String(node.expanded ?? false));
|
|
2564
2626
|
li.setAttribute("aria-level", String(depth + 1));
|
|
2565
2627
|
const row = document.createElement("div");
|
|
2566
2628
|
row.className = "tree-row";
|
|
2629
|
+
row.setAttribute("part", "row");
|
|
2567
2630
|
row.style.paddingLeft = `${depth * 20 + 8}px`;
|
|
2568
2631
|
const hasChildren = node.children && node.children.length > 0;
|
|
2569
2632
|
if (hasChildren) {
|
|
2570
2633
|
const toggle = document.createElement("span");
|
|
2571
2634
|
toggle.className = "tree-toggle";
|
|
2635
|
+
toggle.setAttribute("part", "toggle");
|
|
2572
2636
|
toggle.textContent = node.expanded ? "\u25BE" : "\u25B8";
|
|
2573
2637
|
toggle.setAttribute("aria-hidden", "true");
|
|
2574
2638
|
row.appendChild(toggle);
|
|
2575
2639
|
} else {
|
|
2576
2640
|
const spacer = document.createElement("span");
|
|
2577
2641
|
spacer.className = "tree-toggle-spacer";
|
|
2642
|
+
spacer.setAttribute("part", "toggle-spacer");
|
|
2578
2643
|
row.appendChild(spacer);
|
|
2579
2644
|
}
|
|
2580
2645
|
const label = document.createElement("span");
|
|
2581
2646
|
label.className = "tree-label";
|
|
2647
|
+
label.setAttribute("part", "label");
|
|
2582
2648
|
label.textContent = node.label;
|
|
2583
2649
|
row.appendChild(label);
|
|
2584
2650
|
li.appendChild(row);
|
|
2585
2651
|
if (hasChildren && node.expanded) {
|
|
2586
2652
|
const ul = document.createElement("ul");
|
|
2587
2653
|
ul.className = "tree-children";
|
|
2654
|
+
ul.setAttribute("part", "children");
|
|
2588
2655
|
ul.setAttribute("role", "group");
|
|
2589
2656
|
for (const child of node.children) {
|
|
2590
2657
|
ul.appendChild(this._renderNode(child, depth + 1));
|
|
@@ -2625,7 +2692,7 @@ var UTable = class extends UElement {
|
|
|
2625
2692
|
this._root.innerHTML = `<style>${tableStyles}</style><div part="table-wrapper" class="table-wrapper"><table part="table" class="table"><thead part="thead"><tr part="header-row"></tr></thead><tbody part="tbody"></tbody></table></div>`;
|
|
2626
2693
|
}
|
|
2627
2694
|
static get observedAttributes() {
|
|
2628
|
-
return ["sortable"];
|
|
2695
|
+
return ["sortable", "class"];
|
|
2629
2696
|
}
|
|
2630
2697
|
get columns() {
|
|
2631
2698
|
return this._columns;
|
|
@@ -2643,10 +2710,16 @@ var UTable = class extends UElement {
|
|
|
2643
2710
|
}
|
|
2644
2711
|
connectedCallback() {
|
|
2645
2712
|
super.connectedCallback();
|
|
2713
|
+
this._sync();
|
|
2646
2714
|
}
|
|
2647
2715
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
2648
2716
|
if (oldVal === newVal) return;
|
|
2649
2717
|
if (name === "sortable") this._sortable = newVal !== null;
|
|
2718
|
+
else if (name === "class") this._sync();
|
|
2719
|
+
}
|
|
2720
|
+
_sync() {
|
|
2721
|
+
const el = this._root.querySelector('[part="table-wrapper"]');
|
|
2722
|
+
el.className = `table-wrapper ${this.className}`.trim();
|
|
2650
2723
|
}
|
|
2651
2724
|
_render() {
|
|
2652
2725
|
this._renderHeader();
|
|
@@ -2657,6 +2730,7 @@ var UTable = class extends UElement {
|
|
|
2657
2730
|
headerRow.innerHTML = "";
|
|
2658
2731
|
for (const col of this._columns) {
|
|
2659
2732
|
const th = document.createElement("th");
|
|
2733
|
+
th.setAttribute("part", "header-cell");
|
|
2660
2734
|
th.textContent = col.label;
|
|
2661
2735
|
if (col.width) th.style.width = col.width;
|
|
2662
2736
|
if (this._sortable && col.sortable) {
|
|
@@ -2677,8 +2751,10 @@ var UTable = class extends UElement {
|
|
|
2677
2751
|
const data = this._sortKey ? this._sortedData() : this._rows;
|
|
2678
2752
|
for (const row of data) {
|
|
2679
2753
|
const tr = document.createElement("tr");
|
|
2754
|
+
tr.setAttribute("part", "row");
|
|
2680
2755
|
for (const col of this._columns) {
|
|
2681
2756
|
const td = document.createElement("td");
|
|
2757
|
+
td.setAttribute("part", "cell");
|
|
2682
2758
|
td.textContent = String(row[col.key] ?? "");
|
|
2683
2759
|
tr.appendChild(td);
|
|
2684
2760
|
}
|
|
@@ -2746,7 +2822,7 @@ var UBreadcrumb = class extends UElement {
|
|
|
2746
2822
|
this._root.innerHTML = `<style>${breadcrumbStyles}</style><nav part="breadcrumb" class="breadcrumb" aria-label="Breadcrumb"><ol part="list"></ol></nav>`;
|
|
2747
2823
|
}
|
|
2748
2824
|
static get observedAttributes() {
|
|
2749
|
-
return ["separator"];
|
|
2825
|
+
return ["separator", "class"];
|
|
2750
2826
|
}
|
|
2751
2827
|
get items() {
|
|
2752
2828
|
return this._items;
|
|
@@ -2763,14 +2839,21 @@ var UBreadcrumb = class extends UElement {
|
|
|
2763
2839
|
}
|
|
2764
2840
|
connectedCallback() {
|
|
2765
2841
|
super.connectedCallback();
|
|
2842
|
+
this._sync();
|
|
2766
2843
|
}
|
|
2767
2844
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
2768
2845
|
if (oldVal === newVal) return;
|
|
2769
2846
|
if (name === "separator") {
|
|
2770
2847
|
this._separator = newVal ?? "/";
|
|
2771
2848
|
this._render();
|
|
2849
|
+
} else if (name === "class") {
|
|
2850
|
+
this._sync();
|
|
2772
2851
|
}
|
|
2773
2852
|
}
|
|
2853
|
+
_sync() {
|
|
2854
|
+
const el = this._root.querySelector('[part="breadcrumb"]');
|
|
2855
|
+
el.className = `breadcrumb ${this.className}`.trim();
|
|
2856
|
+
}
|
|
2774
2857
|
_render() {
|
|
2775
2858
|
const list = this._root.querySelector("ol");
|
|
2776
2859
|
list.innerHTML = "";
|
|
@@ -2778,17 +2861,20 @@ var UBreadcrumb = class extends UElement {
|
|
|
2778
2861
|
const item = this._items[i];
|
|
2779
2862
|
const li = document.createElement("li");
|
|
2780
2863
|
li.className = "breadcrumb-item";
|
|
2864
|
+
li.setAttribute("part", "item");
|
|
2781
2865
|
if (i < this._items.length - 1) {
|
|
2782
2866
|
if (item.href) {
|
|
2783
2867
|
const a = document.createElement("a");
|
|
2784
2868
|
a.href = item.href;
|
|
2785
2869
|
a.textContent = item.label;
|
|
2870
|
+
a.setAttribute("part", "link");
|
|
2786
2871
|
li.appendChild(a);
|
|
2787
2872
|
} else {
|
|
2788
2873
|
li.textContent = item.label;
|
|
2789
2874
|
}
|
|
2790
2875
|
const sep = document.createElement("span");
|
|
2791
2876
|
sep.className = "breadcrumb-separator";
|
|
2877
|
+
sep.setAttribute("part", "separator");
|
|
2792
2878
|
sep.setAttribute("aria-hidden", "true");
|
|
2793
2879
|
sep.textContent = this._separator;
|
|
2794
2880
|
li.appendChild(sep);
|
|
@@ -2812,13 +2898,13 @@ var UTabs = class extends UElement {
|
|
|
2812
2898
|
this._variant = "underline";
|
|
2813
2899
|
this._fullWidth = false;
|
|
2814
2900
|
this._triggers = [];
|
|
2815
|
-
this._root.innerHTML = `<style>${tabsStyles}</style><div part="tabs" class="tabs"><div part="tablist" class="tablist tablist-underline" role="tablist"><div class="tab-indicator"></div></div><div part="tabpanels" class="tabpanels"></div></div>`;
|
|
2901
|
+
this._root.innerHTML = `<style>${tabsStyles}</style><div part="tabs" class="tabs"><div part="tablist" class="tablist tablist-underline" role="tablist"><div part="indicator" class="tab-indicator"></div></div><div part="tabpanels" class="tabpanels"></div></div>`;
|
|
2816
2902
|
this._tablistEl = this._root.querySelector('[part="tablist"]');
|
|
2817
2903
|
this._panelsContainer = this._root.querySelector('[part="tabpanels"]');
|
|
2818
2904
|
this._indicatorEl = this._tablistEl.querySelector(".tab-indicator");
|
|
2819
2905
|
}
|
|
2820
2906
|
static get observedAttributes() {
|
|
2821
|
-
return ["value", "orientation", "variant", "full-width"];
|
|
2907
|
+
return ["value", "orientation", "variant", "full-width", "class"];
|
|
2822
2908
|
}
|
|
2823
2909
|
get value() {
|
|
2824
2910
|
return this._value;
|
|
@@ -2882,6 +2968,7 @@ var UTabs = class extends UElement {
|
|
|
2882
2968
|
const disabled = tab.hasAttribute("disabled");
|
|
2883
2969
|
const btn = document.createElement("button");
|
|
2884
2970
|
btn.className = "tab-trigger";
|
|
2971
|
+
btn.setAttribute("part", "tab");
|
|
2885
2972
|
btn.setAttribute("role", "tab");
|
|
2886
2973
|
btn.setAttribute("aria-selected", String(key === this._value));
|
|
2887
2974
|
btn.setAttribute("data-value", key);
|
|
@@ -2891,6 +2978,7 @@ var UTabs = class extends UElement {
|
|
|
2891
2978
|
if (iconSlot) {
|
|
2892
2979
|
const iconSpan = document.createElement("span");
|
|
2893
2980
|
iconSpan.className = "tab-trigger-icon";
|
|
2981
|
+
iconSpan.setAttribute("part", "tab-icon");
|
|
2894
2982
|
iconSpan.appendChild(iconSlot.cloneNode(true));
|
|
2895
2983
|
btn.appendChild(iconSpan);
|
|
2896
2984
|
} else {
|
|
@@ -2898,6 +2986,7 @@ var UTabs = class extends UElement {
|
|
|
2898
2986
|
if (svgs.length > 0) {
|
|
2899
2987
|
const iconSpan = document.createElement("span");
|
|
2900
2988
|
iconSpan.className = "tab-trigger-icon";
|
|
2989
|
+
iconSpan.setAttribute("part", "tab-icon");
|
|
2901
2990
|
iconSpan.appendChild(svgs[0].cloneNode(true));
|
|
2902
2991
|
btn.appendChild(iconSpan);
|
|
2903
2992
|
}
|
|
@@ -2913,6 +3002,7 @@ var UTabs = class extends UElement {
|
|
|
2913
3002
|
const key = panel.getAttribute("data-value") || String(i);
|
|
2914
3003
|
const div = document.createElement("div");
|
|
2915
3004
|
div.className = "tab-panel";
|
|
3005
|
+
div.setAttribute("part", "panel");
|
|
2916
3006
|
div.setAttribute("role", "tabpanel");
|
|
2917
3007
|
if (key === this._value) {
|
|
2918
3008
|
div.removeAttribute("hidden");
|
|
@@ -2923,6 +3013,8 @@ var UTabs = class extends UElement {
|
|
|
2923
3013
|
this._panelsContainer.appendChild(div);
|
|
2924
3014
|
});
|
|
2925
3015
|
this._updateIndicator();
|
|
3016
|
+
const tabsEl = this._root.querySelector('[part="tabs"]');
|
|
3017
|
+
tabsEl.className = `tabs ${this.className}`.trim();
|
|
2926
3018
|
}
|
|
2927
3019
|
_updateIndicator() {
|
|
2928
3020
|
if (this._variant !== "underline" || !this._indicatorEl) return;
|
|
@@ -2988,10 +3080,25 @@ var UTabs = class extends UElement {
|
|
|
2988
3080
|
|
|
2989
3081
|
// src/components/visually-hidden.wc.ts
|
|
2990
3082
|
var UVisuallyHidden = class extends UElement {
|
|
3083
|
+
static get observedAttributes() {
|
|
3084
|
+
return ["class"];
|
|
3085
|
+
}
|
|
2991
3086
|
constructor() {
|
|
2992
3087
|
super();
|
|
2993
3088
|
this._root.innerHTML = `<style>${visuallyHiddenStyles}</style><span part="hidden" class="visually-hidden"><slot></slot></span>`;
|
|
2994
3089
|
}
|
|
3090
|
+
connectedCallback() {
|
|
3091
|
+
super.connectedCallback();
|
|
3092
|
+
this._sync();
|
|
3093
|
+
}
|
|
3094
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
3095
|
+
if (oldVal === newVal) return;
|
|
3096
|
+
if (name === "class") this._sync();
|
|
3097
|
+
}
|
|
3098
|
+
_sync() {
|
|
3099
|
+
const el = this._root.querySelector('[part="hidden"]');
|
|
3100
|
+
el.className = `visually-hidden ${this.className}`.trim();
|
|
3101
|
+
}
|
|
2995
3102
|
_mount() {
|
|
2996
3103
|
}
|
|
2997
3104
|
};
|
|
@@ -3005,7 +3112,7 @@ var ULiveRegion = class extends UElement {
|
|
|
3005
3112
|
this._root.innerHTML = `<div part="region" aria-live="polite" aria-atomic="false"><slot></slot></div>`;
|
|
3006
3113
|
}
|
|
3007
3114
|
static get observedAttributes() {
|
|
3008
|
-
return ["politeness", "atomic"];
|
|
3115
|
+
return ["politeness", "atomic", "class"];
|
|
3009
3116
|
}
|
|
3010
3117
|
get politeness() {
|
|
3011
3118
|
return this._politeness;
|
|
@@ -3028,10 +3135,12 @@ var ULiveRegion = class extends UElement {
|
|
|
3028
3135
|
if (oldVal === newVal) return;
|
|
3029
3136
|
if (name === "politeness") this._politeness = newVal ?? "polite";
|
|
3030
3137
|
else if (name === "atomic") this._atomic = newVal !== null;
|
|
3138
|
+
else ;
|
|
3031
3139
|
this._sync();
|
|
3032
3140
|
}
|
|
3033
3141
|
_sync() {
|
|
3034
3142
|
const el = this._root.querySelector('[part="region"]');
|
|
3143
|
+
el.className = this.className;
|
|
3035
3144
|
el.setAttribute("aria-live", this._politeness);
|
|
3036
3145
|
el.setAttribute("aria-atomic", String(this._atomic));
|
|
3037
3146
|
}
|
|
@@ -3178,7 +3287,7 @@ var UPresence = class extends UElement {
|
|
|
3178
3287
|
this._root.innerHTML = `<style>${presenceStyles}</style><div part="presence" class="presence"><slot></slot></div>`;
|
|
3179
3288
|
}
|
|
3180
3289
|
static get observedAttributes() {
|
|
3181
|
-
return ["present", "animation", "duration"];
|
|
3290
|
+
return ["present", "animation", "duration", "class"];
|
|
3182
3291
|
}
|
|
3183
3292
|
get present() {
|
|
3184
3293
|
return this._present;
|
|
@@ -3196,6 +3305,7 @@ var UPresence = class extends UElement {
|
|
|
3196
3305
|
}
|
|
3197
3306
|
connectedCallback() {
|
|
3198
3307
|
super.connectedCallback();
|
|
3308
|
+
this._sync();
|
|
3199
3309
|
this._present = this.hasAttribute("present");
|
|
3200
3310
|
this._mounted = true;
|
|
3201
3311
|
if (this._present) {
|
|
@@ -3220,8 +3330,15 @@ var UPresence = class extends UElement {
|
|
|
3220
3330
|
case "duration":
|
|
3221
3331
|
this._duration = Number(newVal) || 200;
|
|
3222
3332
|
break;
|
|
3333
|
+
case "class":
|
|
3334
|
+
this._sync();
|
|
3335
|
+
break;
|
|
3223
3336
|
}
|
|
3224
3337
|
}
|
|
3338
|
+
_sync() {
|
|
3339
|
+
const presenceEl = this._root.querySelector('[part="presence"]');
|
|
3340
|
+
presenceEl.className = `presence ${this.className}`.trim();
|
|
3341
|
+
}
|
|
3225
3342
|
_enter() {
|
|
3226
3343
|
const el = this._root.querySelector('[part="presence"]');
|
|
3227
3344
|
this.style.display = "";
|
|
@@ -3506,7 +3623,7 @@ var UModal = class extends UElement {
|
|
|
3506
3623
|
</div>`;
|
|
3507
3624
|
}
|
|
3508
3625
|
static get observedAttributes() {
|
|
3509
|
-
return ["open", "size", "title", "close-on-escape", "close-on-overlay"];
|
|
3626
|
+
return ["open", "size", "title", "close-on-escape", "close-on-overlay", "class"];
|
|
3510
3627
|
}
|
|
3511
3628
|
get open() {
|
|
3512
3629
|
return this._open;
|
|
@@ -3554,9 +3671,14 @@ var UModal = class extends UElement {
|
|
|
3554
3671
|
case "close-on-overlay":
|
|
3555
3672
|
this._closeOnOverlay = parseBooleanAttribute(newVal, true);
|
|
3556
3673
|
break;
|
|
3674
|
+
case "class":
|
|
3675
|
+
this._sync();
|
|
3676
|
+
break;
|
|
3557
3677
|
}
|
|
3558
3678
|
}
|
|
3559
3679
|
_sync() {
|
|
3680
|
+
const modalEl = this._root.querySelector('[part="modal"]');
|
|
3681
|
+
modalEl.className = `modal ${this.className}`.trim();
|
|
3560
3682
|
this._updateOpenState();
|
|
3561
3683
|
this._updateSize();
|
|
3562
3684
|
this._updateTitle();
|
|
@@ -3679,21 +3801,24 @@ var UDrawer = class extends UElement {
|
|
|
3679
3801
|
<div part="backdrop" class="drawer-backdrop" hidden></div>
|
|
3680
3802
|
<div part="drawer" class="drawer drawer-right" role="dialog" aria-modal="true" hidden>
|
|
3681
3803
|
<div part="drawer-content" class="drawer-content">
|
|
3682
|
-
|
|
3804
|
+
<!-- @deprecated drawer-header \u2192 use part="header" -->
|
|
3805
|
+
<div part="drawer-header header" class="drawer-header">
|
|
3683
3806
|
<slot name="header"></slot>
|
|
3684
3807
|
<button part="close-btn" class="drawer-close" aria-label="Close">×</button>
|
|
3685
3808
|
</div>
|
|
3686
|
-
|
|
3809
|
+
<!-- @deprecated drawer-body \u2192 use part="body" -->
|
|
3810
|
+
<div part="drawer-body body" class="drawer-body">
|
|
3687
3811
|
<slot></slot>
|
|
3688
3812
|
</div>
|
|
3689
|
-
|
|
3813
|
+
<!-- @deprecated drawer-footer \u2192 use part="footer" -->
|
|
3814
|
+
<div part="drawer-footer footer" class="drawer-footer">
|
|
3690
3815
|
<slot name="footer"></slot>
|
|
3691
3816
|
</div>
|
|
3692
3817
|
</div>
|
|
3693
3818
|
</div>`;
|
|
3694
3819
|
}
|
|
3695
3820
|
static get observedAttributes() {
|
|
3696
|
-
return ["open", "side", "size", "close-on-escape", "close-on-overlay"];
|
|
3821
|
+
return ["open", "side", "size", "close-on-escape", "close-on-overlay", "class"];
|
|
3697
3822
|
}
|
|
3698
3823
|
get open() {
|
|
3699
3824
|
return this._open;
|
|
@@ -3744,7 +3869,7 @@ var UDrawer = class extends UElement {
|
|
|
3744
3869
|
}
|
|
3745
3870
|
_sync() {
|
|
3746
3871
|
const drawer = this._root.querySelector('[part="drawer"]');
|
|
3747
|
-
drawer.className = `drawer drawer-${this._side}
|
|
3872
|
+
drawer.className = `drawer drawer-${this._side} ${this.className}`.trim();
|
|
3748
3873
|
const content = this._root.querySelector('[part="drawer-content"]');
|
|
3749
3874
|
this._applyDrawerSize(content);
|
|
3750
3875
|
this._updateOpenState();
|
|
@@ -3781,7 +3906,8 @@ var UDrawer = class extends UElement {
|
|
|
3781
3906
|
drawer.removeAttribute("hidden");
|
|
3782
3907
|
this._applyDrawerSize(content);
|
|
3783
3908
|
this._unlockScroll = lockScroll();
|
|
3784
|
-
|
|
3909
|
+
void drawer.offsetHeight;
|
|
3910
|
+
drawer.classList.add("drawer-open");
|
|
3785
3911
|
this._focusFirst();
|
|
3786
3912
|
} else {
|
|
3787
3913
|
drawer.classList.remove("drawer-open");
|
|
@@ -3879,7 +4005,7 @@ var UPopover = class extends UElement {
|
|
|
3879
4005
|
</div>`;
|
|
3880
4006
|
}
|
|
3881
4007
|
static get observedAttributes() {
|
|
3882
|
-
return ["open", "placement", "offset", "close-on-escape", "close-on-outside-click"];
|
|
4008
|
+
return ["open", "placement", "offset", "close-on-escape", "close-on-outside-click", "class"];
|
|
3883
4009
|
}
|
|
3884
4010
|
get open() {
|
|
3885
4011
|
return this._open;
|
|
@@ -3909,6 +4035,7 @@ var UPopover = class extends UElement {
|
|
|
3909
4035
|
}
|
|
3910
4036
|
connectedCallback() {
|
|
3911
4037
|
super.connectedCallback();
|
|
4038
|
+
this._sync();
|
|
3912
4039
|
}
|
|
3913
4040
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
3914
4041
|
if (oldVal === newVal) return;
|
|
@@ -3929,8 +4056,15 @@ var UPopover = class extends UElement {
|
|
|
3929
4056
|
case "close-on-outside-click":
|
|
3930
4057
|
this._closeOnOutsideClick = newVal !== null;
|
|
3931
4058
|
break;
|
|
4059
|
+
case "class":
|
|
4060
|
+
this._sync();
|
|
4061
|
+
break;
|
|
3932
4062
|
}
|
|
3933
4063
|
}
|
|
4064
|
+
_sync() {
|
|
4065
|
+
const popoverEl = this._root.querySelector('[part="popover"]');
|
|
4066
|
+
popoverEl.className = `popover ${this.className}`.trim();
|
|
4067
|
+
}
|
|
3934
4068
|
_updateOpenState() {
|
|
3935
4069
|
const popover = this._root.querySelector('[part="popover"]');
|
|
3936
4070
|
if (this._open) {
|
|
@@ -4042,7 +4176,7 @@ var UDropdown = class extends UElement {
|
|
|
4042
4176
|
this._triggerEl = this._root.querySelector('[part="trigger"]');
|
|
4043
4177
|
}
|
|
4044
4178
|
static get observedAttributes() {
|
|
4045
|
-
return ["open", "placement", "value"];
|
|
4179
|
+
return ["open", "placement", "value", "class"];
|
|
4046
4180
|
}
|
|
4047
4181
|
get open() {
|
|
4048
4182
|
return this._open;
|
|
@@ -4079,6 +4213,7 @@ var UDropdown = class extends UElement {
|
|
|
4079
4213
|
}
|
|
4080
4214
|
connectedCallback() {
|
|
4081
4215
|
super.connectedCallback();
|
|
4216
|
+
this._sync();
|
|
4082
4217
|
this._renderItems();
|
|
4083
4218
|
}
|
|
4084
4219
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
@@ -4095,8 +4230,15 @@ var UDropdown = class extends UElement {
|
|
|
4095
4230
|
this._value = newVal ?? "";
|
|
4096
4231
|
this._updateSelected();
|
|
4097
4232
|
break;
|
|
4233
|
+
case "class":
|
|
4234
|
+
this._sync();
|
|
4235
|
+
break;
|
|
4098
4236
|
}
|
|
4099
4237
|
}
|
|
4238
|
+
_sync() {
|
|
4239
|
+
const triggerEl = this._root.querySelector('[part="trigger"]');
|
|
4240
|
+
triggerEl.className = `dropdown-trigger ${this.className}`.trim();
|
|
4241
|
+
}
|
|
4100
4242
|
_renderItems() {
|
|
4101
4243
|
this._itemsContainer.innerHTML = "";
|
|
4102
4244
|
this._itemElements = [];
|
|
@@ -4106,17 +4248,20 @@ var UDropdown = class extends UElement {
|
|
|
4106
4248
|
lastGroup = item.group;
|
|
4107
4249
|
const label = document.createElement("div");
|
|
4108
4250
|
label.className = GROUP_HEADING_CLASS;
|
|
4251
|
+
label.setAttribute("part", "group-label");
|
|
4109
4252
|
label.textContent = item.group;
|
|
4110
4253
|
this._itemsContainer.appendChild(label);
|
|
4111
4254
|
}
|
|
4112
4255
|
if (item.divider) {
|
|
4113
4256
|
const div = document.createElement("div");
|
|
4114
4257
|
div.className = "dropdown-divider";
|
|
4258
|
+
div.setAttribute("part", "divider");
|
|
4115
4259
|
this._itemsContainer.appendChild(div);
|
|
4116
4260
|
continue;
|
|
4117
4261
|
}
|
|
4118
4262
|
const btn = document.createElement("button");
|
|
4119
4263
|
btn.className = ITEM_CLASS;
|
|
4264
|
+
btn.setAttribute("part", "item");
|
|
4120
4265
|
btn.setAttribute("role", "option");
|
|
4121
4266
|
btn.setAttribute("data-value", item.value);
|
|
4122
4267
|
btn.disabled = item.disabled ?? false;
|
|
@@ -4124,18 +4269,22 @@ var UDropdown = class extends UElement {
|
|
|
4124
4269
|
if (item.icon) {
|
|
4125
4270
|
const iconSpan = document.createElement("span");
|
|
4126
4271
|
iconSpan.className = "dropdown-item-icon";
|
|
4272
|
+
iconSpan.setAttribute("part", "item-icon");
|
|
4127
4273
|
iconSpan.innerHTML = item.icon;
|
|
4128
4274
|
btn.appendChild(iconSpan);
|
|
4129
4275
|
}
|
|
4130
4276
|
const textSpan = document.createElement("span");
|
|
4131
4277
|
textSpan.className = "dropdown-item-text";
|
|
4278
|
+
textSpan.setAttribute("part", "item-text");
|
|
4132
4279
|
const labelSpan = document.createElement("span");
|
|
4133
4280
|
labelSpan.className = "dropdown-item-label";
|
|
4281
|
+
labelSpan.setAttribute("part", "item-label");
|
|
4134
4282
|
labelSpan.textContent = item.label;
|
|
4135
4283
|
textSpan.appendChild(labelSpan);
|
|
4136
4284
|
if (item.description) {
|
|
4137
4285
|
const descSpan = document.createElement("span");
|
|
4138
4286
|
descSpan.className = "dropdown-item-desc";
|
|
4287
|
+
descSpan.setAttribute("part", "item-desc");
|
|
4139
4288
|
descSpan.textContent = item.description;
|
|
4140
4289
|
textSpan.appendChild(descSpan);
|
|
4141
4290
|
}
|
|
@@ -4143,6 +4292,7 @@ var UDropdown = class extends UElement {
|
|
|
4143
4292
|
if (item.shortcut) {
|
|
4144
4293
|
const shortcutSpan = document.createElement("span");
|
|
4145
4294
|
shortcutSpan.className = "dropdown-item-shortcut";
|
|
4295
|
+
shortcutSpan.setAttribute("part", "item-shortcut");
|
|
4146
4296
|
shortcutSpan.textContent = item.shortcut;
|
|
4147
4297
|
btn.appendChild(shortcutSpan);
|
|
4148
4298
|
}
|
|
@@ -4253,7 +4403,7 @@ var UAccordion = class extends UElement {
|
|
|
4253
4403
|
this._root.innerHTML = `<style>${accordionStyles}</style><div part="accordion" class="accordion"><slot></slot></div>`;
|
|
4254
4404
|
}
|
|
4255
4405
|
static get observedAttributes() {
|
|
4256
|
-
return ["collapsible", "multiple"];
|
|
4406
|
+
return ["collapsible", "multiple", "class"];
|
|
4257
4407
|
}
|
|
4258
4408
|
get value() {
|
|
4259
4409
|
return Array.from(this._value);
|
|
@@ -4276,12 +4426,18 @@ var UAccordion = class extends UElement {
|
|
|
4276
4426
|
}
|
|
4277
4427
|
connectedCallback() {
|
|
4278
4428
|
super.connectedCallback();
|
|
4429
|
+
this._sync();
|
|
4279
4430
|
this._initItems();
|
|
4280
4431
|
}
|
|
4281
4432
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
4282
4433
|
if (oldVal === newVal) return;
|
|
4283
4434
|
if (name === "collapsible") this._collapsible = newVal !== null;
|
|
4284
4435
|
else if (name === "multiple") this._multiple = newVal !== null;
|
|
4436
|
+
else if (name === "class") this._sync();
|
|
4437
|
+
}
|
|
4438
|
+
_sync() {
|
|
4439
|
+
const accordionEl = this._root.querySelector('[part="accordion"]');
|
|
4440
|
+
accordionEl.className = `accordion ${this.className}`.trim();
|
|
4285
4441
|
}
|
|
4286
4442
|
_initItems() {
|
|
4287
4443
|
const items = this.querySelectorAll(":scope > u-accordion-item");
|
|
@@ -4356,7 +4512,7 @@ var UAccordionItem = class extends UElement {
|
|
|
4356
4512
|
</div>`;
|
|
4357
4513
|
}
|
|
4358
4514
|
static get observedAttributes() {
|
|
4359
|
-
return ["value", "open"];
|
|
4515
|
+
return ["value", "open", "class"];
|
|
4360
4516
|
}
|
|
4361
4517
|
get value() {
|
|
4362
4518
|
return this._value;
|
|
@@ -4374,12 +4530,18 @@ var UAccordionItem = class extends UElement {
|
|
|
4374
4530
|
}
|
|
4375
4531
|
connectedCallback() {
|
|
4376
4532
|
super.connectedCallback();
|
|
4533
|
+
this._sync();
|
|
4377
4534
|
if (this.hasAttribute("open")) this._open = true;
|
|
4378
4535
|
}
|
|
4379
4536
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
4380
4537
|
if (oldVal === newVal) return;
|
|
4381
4538
|
if (name === "value") this._value = newVal ?? "";
|
|
4382
4539
|
else if (name === "open") this._open = newVal !== null;
|
|
4540
|
+
else if (name === "class") this._sync();
|
|
4541
|
+
}
|
|
4542
|
+
_sync() {
|
|
4543
|
+
const itemEl = this._root.querySelector('[part="accordion-item"]');
|
|
4544
|
+
itemEl.className = `accordion-item ${this.className}`.trim();
|
|
4383
4545
|
}
|
|
4384
4546
|
_mount() {
|
|
4385
4547
|
}
|
|
@@ -4414,7 +4576,7 @@ var UCombobox = class extends UElement {
|
|
|
4414
4576
|
</div>`;
|
|
4415
4577
|
}
|
|
4416
4578
|
static get observedAttributes() {
|
|
4417
|
-
return ["value", "placeholder", "disabled", "filterable"];
|
|
4579
|
+
return ["value", "placeholder", "disabled", "filterable", "class"];
|
|
4418
4580
|
}
|
|
4419
4581
|
get value() {
|
|
4420
4582
|
return this._value;
|
|
@@ -4450,9 +4612,14 @@ var UCombobox = class extends UElement {
|
|
|
4450
4612
|
case "filterable":
|
|
4451
4613
|
this._filterable = newVal !== null;
|
|
4452
4614
|
break;
|
|
4615
|
+
case "class":
|
|
4616
|
+
this._syncInput();
|
|
4617
|
+
break;
|
|
4453
4618
|
}
|
|
4454
4619
|
}
|
|
4455
4620
|
_syncInput() {
|
|
4621
|
+
const combobox = this._root.querySelector('[part="combobox"]');
|
|
4622
|
+
combobox.className = `combobox ${this.className}`.trim();
|
|
4456
4623
|
const input = this._root.querySelector("input");
|
|
4457
4624
|
input.placeholder = this._placeholder;
|
|
4458
4625
|
input.disabled = this._disabled;
|
|
@@ -4481,6 +4648,7 @@ var UCombobox = class extends UElement {
|
|
|
4481
4648
|
if (items.length === 0) {
|
|
4482
4649
|
const empty = document.createElement("div");
|
|
4483
4650
|
empty.className = "combobox-empty";
|
|
4651
|
+
empty.setAttribute("part", "empty");
|
|
4484
4652
|
empty.textContent = "No results";
|
|
4485
4653
|
listbox.appendChild(empty);
|
|
4486
4654
|
return;
|
|
@@ -4488,6 +4656,7 @@ var UCombobox = class extends UElement {
|
|
|
4488
4656
|
for (const opt of items) {
|
|
4489
4657
|
const btn = document.createElement("button");
|
|
4490
4658
|
btn.className = "combobox-option";
|
|
4659
|
+
btn.setAttribute("part", "option");
|
|
4491
4660
|
btn.setAttribute("role", "option");
|
|
4492
4661
|
btn.setAttribute("data-value", opt.value);
|
|
4493
4662
|
btn.textContent = opt.label;
|
|
@@ -4645,7 +4814,7 @@ var UCalendar = class extends UElement {
|
|
|
4645
4814
|
</div>`;
|
|
4646
4815
|
}
|
|
4647
4816
|
static get observedAttributes() {
|
|
4648
|
-
return ["value", "min", "max"];
|
|
4817
|
+
return ["value", "min", "max", "class"];
|
|
4649
4818
|
}
|
|
4650
4819
|
get value() {
|
|
4651
4820
|
return this._value;
|
|
@@ -4655,6 +4824,7 @@ var UCalendar = class extends UElement {
|
|
|
4655
4824
|
}
|
|
4656
4825
|
connectedCallback() {
|
|
4657
4826
|
super.connectedCallback();
|
|
4827
|
+
this._sync();
|
|
4658
4828
|
if (this._value) {
|
|
4659
4829
|
const d = new Date(this._value);
|
|
4660
4830
|
if (!isNaN(d.getTime())) {
|
|
@@ -4670,11 +4840,19 @@ var UCalendar = class extends UElement {
|
|
|
4670
4840
|
if (name === "value") this._value = newVal ?? "";
|
|
4671
4841
|
else if (name === "min") this._min = newVal ?? "";
|
|
4672
4842
|
else if (name === "max") this._max = newVal ?? "";
|
|
4843
|
+
else if (name === "class") {
|
|
4844
|
+
this._sync();
|
|
4845
|
+
return;
|
|
4846
|
+
}
|
|
4673
4847
|
this._render();
|
|
4674
4848
|
}
|
|
4849
|
+
_sync() {
|
|
4850
|
+
const el = this._root.querySelector('[part="calendar"]');
|
|
4851
|
+
el.className = `calendar ${this.className}`.trim();
|
|
4852
|
+
}
|
|
4675
4853
|
_renderDayNames() {
|
|
4676
4854
|
const container = this._root.querySelector('[part="day-names"]');
|
|
4677
|
-
container.innerHTML = DAYS.map((d) => `<span class="cal-day-name">${d}</span>`).join("");
|
|
4855
|
+
container.innerHTML = DAYS.map((d) => `<span part="day-name" class="cal-day-name">${d}</span>`).join("");
|
|
4678
4856
|
}
|
|
4679
4857
|
_render() {
|
|
4680
4858
|
const title = this._root.querySelector('[part="title"]');
|
|
@@ -4688,11 +4866,13 @@ var UCalendar = class extends UElement {
|
|
|
4688
4866
|
for (let i = 0; i < firstDay; i++) {
|
|
4689
4867
|
const empty = document.createElement("span");
|
|
4690
4868
|
empty.className = "cal-day cal-day-empty";
|
|
4869
|
+
empty.setAttribute("part", "day-empty");
|
|
4691
4870
|
grid.appendChild(empty);
|
|
4692
4871
|
}
|
|
4693
4872
|
for (let d = 1; d <= daysInMonth; d++) {
|
|
4694
4873
|
const dayEl = document.createElement("button");
|
|
4695
4874
|
dayEl.className = "cal-day";
|
|
4875
|
+
dayEl.setAttribute("part", "day");
|
|
4696
4876
|
dayEl.textContent = String(d);
|
|
4697
4877
|
const dateStr = `${this._viewYear}-${String(this._viewMonth + 1).padStart(2, "0")}-${String(d).padStart(2, "0")}`;
|
|
4698
4878
|
dayEl.setAttribute("data-date", dateStr);
|
|
@@ -4783,7 +4963,7 @@ var UDataTable = class extends UElement {
|
|
|
4783
4963
|
</div>`;
|
|
4784
4964
|
}
|
|
4785
4965
|
static get observedAttributes() {
|
|
4786
|
-
return ["page-size", "sortable", "selectable"];
|
|
4966
|
+
return ["page-size", "sortable", "selectable", "class"];
|
|
4787
4967
|
}
|
|
4788
4968
|
get columns() {
|
|
4789
4969
|
return this._columns;
|
|
@@ -4807,14 +4987,20 @@ var UDataTable = class extends UElement {
|
|
|
4807
4987
|
}
|
|
4808
4988
|
connectedCallback() {
|
|
4809
4989
|
super.connectedCallback();
|
|
4990
|
+
this._sync();
|
|
4810
4991
|
}
|
|
4811
4992
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
4812
4993
|
if (oldVal === newVal) return;
|
|
4813
4994
|
if (name === "page-size") this._pageSize = Number(newVal) || 10;
|
|
4814
4995
|
else if (name === "sortable") this._sortable = newVal !== null;
|
|
4815
4996
|
else if (name === "selectable") this._selectable = newVal !== null;
|
|
4997
|
+
else if (name === "class") return;
|
|
4816
4998
|
this._render();
|
|
4817
4999
|
}
|
|
5000
|
+
_sync() {
|
|
5001
|
+
const el = this._root.querySelector('[part="data-table"]');
|
|
5002
|
+
el.className = `data-table ${this.className}`.trim();
|
|
5003
|
+
}
|
|
4818
5004
|
_getProcessedData() {
|
|
4819
5005
|
let data = [...this._rows];
|
|
4820
5006
|
if (this._filterText) {
|
|
@@ -4851,8 +5037,10 @@ var UDataTable = class extends UElement {
|
|
|
4851
5037
|
if (this._selectable) {
|
|
4852
5038
|
const th = document.createElement("th");
|
|
4853
5039
|
th.className = "dt-col-check";
|
|
5040
|
+
th.setAttribute("part", "header-checkbox");
|
|
4854
5041
|
const cb = document.createElement("input");
|
|
4855
5042
|
cb.type = "checkbox";
|
|
5043
|
+
cb.setAttribute("part", "select-all");
|
|
4856
5044
|
cb.addEventListener("change", () => {
|
|
4857
5045
|
const data = this._getPageData();
|
|
4858
5046
|
if (cb.checked)
|
|
@@ -4889,6 +5077,7 @@ var UDataTable = class extends UElement {
|
|
|
4889
5077
|
const tr = document.createElement("tr");
|
|
4890
5078
|
const td = document.createElement("td");
|
|
4891
5079
|
td.className = "dt-empty";
|
|
5080
|
+
td.setAttribute("part", "empty");
|
|
4892
5081
|
td.colSpan = this._columns.length + (this._selectable ? 1 : 0);
|
|
4893
5082
|
td.textContent = "No data";
|
|
4894
5083
|
tr.appendChild(td);
|
|
@@ -4898,12 +5087,14 @@ var UDataTable = class extends UElement {
|
|
|
4898
5087
|
for (let i = 0; i < data.length; i++) {
|
|
4899
5088
|
const row = data[i];
|
|
4900
5089
|
const tr = document.createElement("tr");
|
|
5090
|
+
tr.setAttribute("part", "row");
|
|
4901
5091
|
const rowKey = row.id ?? row._key ?? String(i);
|
|
4902
5092
|
if (this._selected.has(rowKey)) tr.classList.add("dt-row-selected");
|
|
4903
5093
|
if (this._selectable) {
|
|
4904
5094
|
const td = document.createElement("td");
|
|
4905
5095
|
const cb = document.createElement("input");
|
|
4906
5096
|
cb.type = "checkbox";
|
|
5097
|
+
cb.setAttribute("part", "select-row");
|
|
4907
5098
|
cb.checked = this._selected.has(rowKey);
|
|
4908
5099
|
cb.addEventListener("change", () => {
|
|
4909
5100
|
if (cb.checked) this._selected.add(rowKey);
|
|
@@ -4916,6 +5107,7 @@ var UDataTable = class extends UElement {
|
|
|
4916
5107
|
}
|
|
4917
5108
|
for (const col of this._columns) {
|
|
4918
5109
|
const td = document.createElement("td");
|
|
5110
|
+
td.setAttribute("part", "cell");
|
|
4919
5111
|
const val = row[col.key];
|
|
4920
5112
|
td.innerHTML = col.render ? col.render(val, row, i) : String(val ?? "");
|
|
4921
5113
|
tr.appendChild(td);
|
|
@@ -4934,6 +5126,7 @@ var UDataTable = class extends UElement {
|
|
|
4934
5126
|
for (let i = 1; i <= totalPages; i++) {
|
|
4935
5127
|
const btn = document.createElement("button");
|
|
4936
5128
|
btn.className = `dt-page-num ${i === this._page ? "active" : ""}`;
|
|
5129
|
+
btn.setAttribute("part", "page-num");
|
|
4937
5130
|
btn.textContent = String(i);
|
|
4938
5131
|
btn.addEventListener("click", () => {
|
|
4939
5132
|
this._page = i;
|
|
@@ -5032,7 +5225,7 @@ var UCommandPalette = class extends UElement {
|
|
|
5032
5225
|
</div>`;
|
|
5033
5226
|
}
|
|
5034
5227
|
static get observedAttributes() {
|
|
5035
|
-
return ["open", "placeholder", "shortcut"];
|
|
5228
|
+
return ["open", "placeholder", "shortcut", "class"];
|
|
5036
5229
|
}
|
|
5037
5230
|
get open() {
|
|
5038
5231
|
return this._open;
|
|
@@ -5072,9 +5265,13 @@ var UCommandPalette = class extends UElement {
|
|
|
5072
5265
|
} else if (name === "shortcut") {
|
|
5073
5266
|
this._shortcut = newVal ?? "Ctrl+K";
|
|
5074
5267
|
this._sync();
|
|
5268
|
+
} else if (name === "class") {
|
|
5269
|
+
this._sync();
|
|
5075
5270
|
}
|
|
5076
5271
|
}
|
|
5077
5272
|
_sync() {
|
|
5273
|
+
const dialog = this._root.querySelector('[part="dialog"]');
|
|
5274
|
+
dialog.className = `cp-dialog ${this.className}`.trim();
|
|
5078
5275
|
const hint = this._root.querySelector('[part="shortcut-hint"]');
|
|
5079
5276
|
hint.textContent = this._shortcut;
|
|
5080
5277
|
const input = this._root.querySelector('[part="search-input"]');
|
|
@@ -5137,6 +5334,7 @@ var UCommandPalette = class extends UElement {
|
|
|
5137
5334
|
if (this._filtered.length === 0) {
|
|
5138
5335
|
const div = document.createElement("div");
|
|
5139
5336
|
div.className = "cp-empty";
|
|
5337
|
+
div.setAttribute("part", "empty");
|
|
5140
5338
|
div.textContent = "No results found";
|
|
5141
5339
|
container.appendChild(div);
|
|
5142
5340
|
return;
|
|
@@ -5151,30 +5349,36 @@ var UCommandPalette = class extends UElement {
|
|
|
5151
5349
|
for (const [groupName, groupItems] of groups) {
|
|
5152
5350
|
const groupEl = document.createElement("div");
|
|
5153
5351
|
groupEl.className = "cp-group";
|
|
5352
|
+
groupEl.setAttribute("part", "group");
|
|
5154
5353
|
const label = document.createElement("div");
|
|
5155
5354
|
label.className = "cp-group-label";
|
|
5355
|
+
label.setAttribute("part", "group-label");
|
|
5156
5356
|
label.textContent = groupName;
|
|
5157
5357
|
groupEl.appendChild(label);
|
|
5158
5358
|
for (const item of groupItems) {
|
|
5159
5359
|
const btn = document.createElement("button");
|
|
5160
5360
|
btn.className = "cp-item";
|
|
5361
|
+
btn.setAttribute("part", "item");
|
|
5161
5362
|
btn.setAttribute("role", "option");
|
|
5162
5363
|
btn.setAttribute("data-id", item.id);
|
|
5163
5364
|
btn.setAttribute("data-index", String(idx));
|
|
5164
5365
|
if (idx === this._selectedIndex) btn.classList.add("cp-item-active");
|
|
5165
5366
|
const labelSpan = document.createElement("span");
|
|
5166
5367
|
labelSpan.className = "cp-item-label";
|
|
5368
|
+
labelSpan.setAttribute("part", "item-label");
|
|
5167
5369
|
labelSpan.textContent = item.label;
|
|
5168
5370
|
btn.appendChild(labelSpan);
|
|
5169
5371
|
if (item.description) {
|
|
5170
5372
|
const desc = document.createElement("span");
|
|
5171
5373
|
desc.className = "cp-item-desc";
|
|
5374
|
+
desc.setAttribute("part", "item-desc");
|
|
5172
5375
|
desc.textContent = item.description;
|
|
5173
5376
|
btn.appendChild(desc);
|
|
5174
5377
|
}
|
|
5175
5378
|
if (item.shortcut) {
|
|
5176
5379
|
const kbd = document.createElement("kbd");
|
|
5177
5380
|
kbd.className = "cp-item-shortcut";
|
|
5381
|
+
kbd.setAttribute("part", "item-shortcut");
|
|
5178
5382
|
kbd.textContent = item.shortcut;
|
|
5179
5383
|
btn.appendChild(kbd);
|
|
5180
5384
|
}
|
|
@@ -5281,7 +5485,7 @@ var UToast = class extends UElement {
|
|
|
5281
5485
|
this._root.innerHTML = `<style>${toastStyles}</style><div part="container" class="toast-container toast-top-right"></div>`;
|
|
5282
5486
|
}
|
|
5283
5487
|
static get observedAttributes() {
|
|
5284
|
-
return ["placement"];
|
|
5488
|
+
return ["placement", "class"];
|
|
5285
5489
|
}
|
|
5286
5490
|
get placement() {
|
|
5287
5491
|
return this._placement;
|
|
@@ -5302,7 +5506,7 @@ var UToast = class extends UElement {
|
|
|
5302
5506
|
}
|
|
5303
5507
|
_updatePlacement() {
|
|
5304
5508
|
const container = this._root.querySelector('[part="container"]');
|
|
5305
|
-
container.className = `toast-container toast-${this._placement}
|
|
5509
|
+
container.className = `toast-container toast-${this._placement} ${this.className}`.trim();
|
|
5306
5510
|
}
|
|
5307
5511
|
show(opts) {
|
|
5308
5512
|
const id = `toast-${++toastId}`;
|
|
@@ -5310,16 +5514,20 @@ var UToast = class extends UElement {
|
|
|
5310
5514
|
const variant = opts.variant ?? "info";
|
|
5311
5515
|
const el = document.createElement("div");
|
|
5312
5516
|
el.className = `toast toast-${variant}`;
|
|
5517
|
+
el.setAttribute("part", "toast");
|
|
5313
5518
|
el.setAttribute("role", "alert");
|
|
5314
5519
|
const body = document.createElement("div");
|
|
5315
5520
|
body.className = "toast-body";
|
|
5521
|
+
body.setAttribute("part", "body");
|
|
5316
5522
|
const title = document.createElement("div");
|
|
5317
5523
|
title.className = "toast-title";
|
|
5524
|
+
title.setAttribute("part", "title");
|
|
5318
5525
|
title.textContent = opts.title;
|
|
5319
5526
|
body.appendChild(title);
|
|
5320
5527
|
if (opts.description) {
|
|
5321
5528
|
const desc = document.createElement("div");
|
|
5322
5529
|
desc.className = "toast-desc";
|
|
5530
|
+
desc.setAttribute("part", "description");
|
|
5323
5531
|
desc.textContent = opts.description;
|
|
5324
5532
|
body.appendChild(desc);
|
|
5325
5533
|
}
|
|
@@ -5327,6 +5535,7 @@ var UToast = class extends UElement {
|
|
|
5327
5535
|
if (opts.action) {
|
|
5328
5536
|
const btn = document.createElement("button");
|
|
5329
5537
|
btn.className = "toast-action";
|
|
5538
|
+
btn.setAttribute("part", "action");
|
|
5330
5539
|
btn.textContent = opts.action.label;
|
|
5331
5540
|
btn.addEventListener("click", () => {
|
|
5332
5541
|
opts.action.onClick();
|
|
@@ -5336,6 +5545,7 @@ var UToast = class extends UElement {
|
|
|
5336
5545
|
}
|
|
5337
5546
|
const close = document.createElement("button");
|
|
5338
5547
|
close.className = "toast-close";
|
|
5548
|
+
close.setAttribute("part", "close close-btn");
|
|
5339
5549
|
close.innerHTML = "×";
|
|
5340
5550
|
close.setAttribute("aria-label", "Dismiss");
|
|
5341
5551
|
close.addEventListener("click", () => this.dismiss(id));
|
|
@@ -5403,6 +5613,9 @@ var UContextMenu = class extends UElement {
|
|
|
5403
5613
|
<div part="items" class="cm-items"></div>
|
|
5404
5614
|
</div>`;
|
|
5405
5615
|
}
|
|
5616
|
+
static get observedAttributes() {
|
|
5617
|
+
return ["class"];
|
|
5618
|
+
}
|
|
5406
5619
|
get items() {
|
|
5407
5620
|
return this._items;
|
|
5408
5621
|
}
|
|
@@ -5414,6 +5627,11 @@ var UContextMenu = class extends UElement {
|
|
|
5414
5627
|
super.connectedCallback();
|
|
5415
5628
|
this._parseSlotItems();
|
|
5416
5629
|
this._renderItems();
|
|
5630
|
+
this._sync();
|
|
5631
|
+
}
|
|
5632
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
5633
|
+
if (oldVal === newVal) return;
|
|
5634
|
+
if (name === "class") this._sync();
|
|
5417
5635
|
}
|
|
5418
5636
|
_parseSlotItems() {
|
|
5419
5637
|
const slotItems = this.querySelectorAll("u-context-menu-item");
|
|
@@ -5433,11 +5651,13 @@ var UContextMenu = class extends UElement {
|
|
|
5433
5651
|
if (item.divider) {
|
|
5434
5652
|
const div = document.createElement("div");
|
|
5435
5653
|
div.className = "cm-divider";
|
|
5654
|
+
div.setAttribute("part", "divider");
|
|
5436
5655
|
container.appendChild(div);
|
|
5437
5656
|
return;
|
|
5438
5657
|
}
|
|
5439
5658
|
const btn = document.createElement("button");
|
|
5440
5659
|
btn.className = "cm-item";
|
|
5660
|
+
btn.setAttribute("part", "item");
|
|
5441
5661
|
btn.setAttribute("role", "menuitem");
|
|
5442
5662
|
btn.setAttribute("data-value", item.value);
|
|
5443
5663
|
btn.setAttribute("data-index", String(i));
|
|
@@ -5445,22 +5665,28 @@ var UContextMenu = class extends UElement {
|
|
|
5445
5665
|
if (item.icon) {
|
|
5446
5666
|
const icon = document.createElement("span");
|
|
5447
5667
|
icon.className = "cm-item-icon";
|
|
5668
|
+
icon.setAttribute("part", "item-icon");
|
|
5448
5669
|
icon.textContent = item.icon;
|
|
5449
5670
|
btn.appendChild(icon);
|
|
5450
5671
|
}
|
|
5451
5672
|
const label = document.createElement("span");
|
|
5452
5673
|
label.className = "cm-item-label";
|
|
5674
|
+
label.setAttribute("part", "item-label");
|
|
5453
5675
|
label.textContent = item.label;
|
|
5454
5676
|
btn.appendChild(label);
|
|
5455
5677
|
container.appendChild(btn);
|
|
5456
5678
|
});
|
|
5457
5679
|
}
|
|
5680
|
+
_sync() {
|
|
5681
|
+
const menu = this._root.querySelector('[part="menu"]');
|
|
5682
|
+
menu.className = `cm-menu ${this.className}`.trim();
|
|
5683
|
+
}
|
|
5458
5684
|
_openMenu(x, y) {
|
|
5459
5685
|
const menu = this._root.querySelector('[part="menu"]');
|
|
5460
5686
|
const itemsContainer = this._root.querySelector('[part="items"]');
|
|
5687
|
+
menu.style.animation = "none";
|
|
5461
5688
|
menu.removeAttribute("hidden");
|
|
5462
|
-
|
|
5463
|
-
this._open = true;
|
|
5689
|
+
void menu.offsetHeight;
|
|
5464
5690
|
const trigger = new DOMRect(x, y, 0, 0);
|
|
5465
5691
|
const result = computePosition(
|
|
5466
5692
|
trigger,
|
|
@@ -5471,6 +5697,11 @@ var UContextMenu = class extends UElement {
|
|
|
5471
5697
|
menu.style.top = `${result.top}px`;
|
|
5472
5698
|
menu.style.maxHeight = `${result.maxHeight ?? 320}px`;
|
|
5473
5699
|
itemsContainer.style.maxHeight = `${(result.maxHeight ?? 320) - 16}px`;
|
|
5700
|
+
void menu.offsetHeight;
|
|
5701
|
+
menu.style.animation = "";
|
|
5702
|
+
menu.style.transformOrigin = "top left";
|
|
5703
|
+
this._selectedIndex = -1;
|
|
5704
|
+
this._open = true;
|
|
5474
5705
|
this._focusFirst();
|
|
5475
5706
|
this.dispatchEvent(
|
|
5476
5707
|
new CustomEvent("u-context-menu-open", {
|
|
@@ -5577,7 +5808,7 @@ var USortable = class extends UElement {
|
|
|
5577
5808
|
this._placeholder.style.height = `${rect.height}px`;
|
|
5578
5809
|
this._dragClone = item.cloneNode(true);
|
|
5579
5810
|
this._dragClone.style.position = "fixed";
|
|
5580
|
-
this._dragClone.style.zIndex = "99999";
|
|
5811
|
+
this._dragClone.style.zIndex = getComputedStyle(this).getPropertyValue("--u-z-drag").trim() || "99999";
|
|
5581
5812
|
this._dragClone.style.width = `${rect.width}px`;
|
|
5582
5813
|
this._dragClone.style.height = `${rect.height}px`;
|
|
5583
5814
|
this._dragClone.style.left = `${rect.left}px`;
|
|
@@ -5653,7 +5884,11 @@ var USortable = class extends UElement {
|
|
|
5653
5884
|
</div>`;
|
|
5654
5885
|
}
|
|
5655
5886
|
static get observedAttributes() {
|
|
5656
|
-
return ["disabled"];
|
|
5887
|
+
return ["disabled", "class"];
|
|
5888
|
+
}
|
|
5889
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
5890
|
+
if (oldVal === newVal) return;
|
|
5891
|
+
if (name === "class") this._sync();
|
|
5657
5892
|
}
|
|
5658
5893
|
get disabled() {
|
|
5659
5894
|
return this._disabled;
|
|
@@ -5689,6 +5924,14 @@ var USortable = class extends UElement {
|
|
|
5689
5924
|
}
|
|
5690
5925
|
return null;
|
|
5691
5926
|
}
|
|
5927
|
+
connectedCallback() {
|
|
5928
|
+
super.connectedCallback();
|
|
5929
|
+
this._sync();
|
|
5930
|
+
}
|
|
5931
|
+
_sync() {
|
|
5932
|
+
const el = this._root.querySelector('[part="sortable"]');
|
|
5933
|
+
el.className = `sortable ${this.className}`.trim();
|
|
5934
|
+
}
|
|
5692
5935
|
_mount() {
|
|
5693
5936
|
this.addEventListener("pointerdown", this._onPointerDown);
|
|
5694
5937
|
}
|
|
@@ -5704,22 +5947,41 @@ var UForm = class extends UElement {
|
|
|
5704
5947
|
<slot></slot>
|
|
5705
5948
|
</form>`;
|
|
5706
5949
|
}
|
|
5950
|
+
static get observedAttributes() {
|
|
5951
|
+
return ["class"];
|
|
5952
|
+
}
|
|
5953
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
5954
|
+
if (oldVal === newVal) return;
|
|
5955
|
+
this._sync();
|
|
5956
|
+
}
|
|
5957
|
+
connectedCallback() {
|
|
5958
|
+
super.connectedCallback();
|
|
5959
|
+
this._sync();
|
|
5960
|
+
}
|
|
5707
5961
|
get form() {
|
|
5708
5962
|
return this._root.querySelector("form");
|
|
5709
5963
|
}
|
|
5964
|
+
_sync() {
|
|
5965
|
+
const form = this._root.querySelector("form");
|
|
5966
|
+
if (!form) return;
|
|
5967
|
+
form.className = `form ${this.className}`.trim();
|
|
5968
|
+
}
|
|
5710
5969
|
validate() {
|
|
5711
5970
|
let valid = true;
|
|
5712
5971
|
const errors = {};
|
|
5713
5972
|
this._fields.clear();
|
|
5714
|
-
const inputs = this.querySelectorAll(
|
|
5973
|
+
const inputs = this.querySelectorAll(
|
|
5974
|
+
"input, textarea, select, u-input, u-textarea, u-select, u-checkbox, u-radio-group"
|
|
5975
|
+
);
|
|
5715
5976
|
inputs.forEach((el) => {
|
|
5716
5977
|
const name = el.getAttribute("name") || "";
|
|
5717
5978
|
if (!name) return;
|
|
5718
5979
|
this._fields.set(name, el);
|
|
5719
|
-
|
|
5720
|
-
|
|
5980
|
+
const anyEl = el;
|
|
5981
|
+
if (typeof anyEl.checkValidity === "function") {
|
|
5982
|
+
if (!anyEl.checkValidity()) {
|
|
5721
5983
|
valid = false;
|
|
5722
|
-
errors[name] =
|
|
5984
|
+
errors[name] = anyEl.validationMessage || "Invalid";
|
|
5723
5985
|
const field = el.closest("u-field");
|
|
5724
5986
|
if (field) {
|
|
5725
5987
|
field.setAttribute("error", errors[name]);
|
|
@@ -5740,14 +6002,20 @@ var UForm = class extends UElement {
|
|
|
5740
6002
|
}
|
|
5741
6003
|
getValues() {
|
|
5742
6004
|
const values = {};
|
|
5743
|
-
const inputs = this.querySelectorAll(
|
|
6005
|
+
const inputs = this.querySelectorAll(
|
|
6006
|
+
"input, textarea, select, u-input, u-textarea, u-select, u-checkbox, u-radio-group"
|
|
6007
|
+
);
|
|
5744
6008
|
inputs.forEach((el) => {
|
|
5745
6009
|
const name = el.getAttribute("name") || "";
|
|
5746
6010
|
if (!name) return;
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
values[name] = String(
|
|
6011
|
+
const anyEl = el;
|
|
6012
|
+
const tag = el.tagName.toLowerCase();
|
|
6013
|
+
if (tag === "input" && anyEl.type === "checkbox") {
|
|
6014
|
+
values[name] = String(anyEl.checked);
|
|
6015
|
+
} else if (tag === "u-checkbox") {
|
|
6016
|
+
values[name] = String(anyEl.checked ?? false);
|
|
6017
|
+
} else if ("value" in anyEl) {
|
|
6018
|
+
values[name] = String(anyEl.value ?? "");
|
|
5751
6019
|
}
|
|
5752
6020
|
});
|
|
5753
6021
|
return values;
|
|
@@ -5786,7 +6054,7 @@ var UBadge = class extends UElement {
|
|
|
5786
6054
|
this._root.innerHTML = `<style>${badgeStyles}</style><span part="badge" class="badge badge-default badge-md badge-pill"><slot></slot></span>`;
|
|
5787
6055
|
}
|
|
5788
6056
|
static get observedAttributes() {
|
|
5789
|
-
return ["variant", "size", "dot", "pill"];
|
|
6057
|
+
return ["variant", "size", "dot", "pill", "class"];
|
|
5790
6058
|
}
|
|
5791
6059
|
get variant() {
|
|
5792
6060
|
return this._variant;
|
|
@@ -5838,7 +6106,7 @@ var UBadge = class extends UElement {
|
|
|
5838
6106
|
}
|
|
5839
6107
|
_sync() {
|
|
5840
6108
|
const el = this._root.querySelector('[part="badge"]');
|
|
5841
|
-
el.className = `badge badge-${this._variant} badge-${this._size}
|
|
6109
|
+
el.className = `badge badge-${this._variant} badge-${this._size} ${this.className}`.trim();
|
|
5842
6110
|
if (this._dot) {
|
|
5843
6111
|
el.classList.add("badge-dot");
|
|
5844
6112
|
} else if (this._pill) {
|
|
@@ -5875,7 +6143,7 @@ var UCard = class extends UElement {
|
|
|
5875
6143
|
</div>`;
|
|
5876
6144
|
}
|
|
5877
6145
|
static get observedAttributes() {
|
|
5878
|
-
return ["variant", "padding", "hoverable"];
|
|
6146
|
+
return ["variant", "padding", "hoverable", "class"];
|
|
5879
6147
|
}
|
|
5880
6148
|
get variant() {
|
|
5881
6149
|
return this._variant;
|
|
@@ -5917,7 +6185,7 @@ var UCard = class extends UElement {
|
|
|
5917
6185
|
}
|
|
5918
6186
|
_sync() {
|
|
5919
6187
|
const el = this._root.querySelector('[part="card"]');
|
|
5920
|
-
el.className = `card card-${this._variant} card-padding-${this._padding}
|
|
6188
|
+
el.className = `card card-${this._variant} card-padding-${this._padding} ${this.className}`.trim();
|
|
5921
6189
|
if (this._hoverable) el.classList.add("card-hoverable");
|
|
5922
6190
|
const imageSlot = this._root.querySelector('slot[name="image"]');
|
|
5923
6191
|
if (imageSlot) {
|
|
@@ -5937,5 +6205,5 @@ var UCard = class extends UElement {
|
|
|
5937
6205
|
};
|
|
5938
6206
|
|
|
5939
6207
|
export { UAccordion, UAccordionItem, UAnimate, UBadge, UBox, UBreadcrumb, UButton, UCalendar, UCard, UCheckbox, UCollection, UCombobox, UCommandPalette, UContainer, UContextMenu, UDataTable, UDialogRoot, UDismissableLayer, UDrawer, UDropdown, UField, UFocusManager, UFocusScope, UFocusTrap, UForm, UGrid, UHStack, UHoverable, UInput, UKeyboardNavigation, ULabel, ULink, UList, ULiveRegion, UModal, UOverlay, UPopover, UPopper, UPortal, UPresence, UPressable, URadio, URadioGroup, URouterView, USelect, USlot, USortable, USpacer, UStack, USwitch, UTable, UTabs, UText, UTextarea, UToast, UTooltipRoot, UTransition, UTree, UVirtualList, UVisuallyHidden, createControlledInput, setPortalRoot };
|
|
5940
|
-
//# sourceMappingURL=chunk-
|
|
5941
|
-
//# sourceMappingURL=chunk-
|
|
6208
|
+
//# sourceMappingURL=chunk-2JEFDU25.js.map
|
|
6209
|
+
//# sourceMappingURL=chunk-2JEFDU25.js.map
|