tyrell-components 1.0.0-TC55 → 1.0.0-TC57
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 +53 -53
- package/css/tyrell-theme.css +7 -2
- package/css/tyrell.css +9 -18
- package/dist/tyrell-theme.css +1 -1
- package/dist/tyrell.css +1 -1
- package/dist/tyrell.js +1 -1
- package/lib/base/ty-component.d.ts +17 -0
- package/lib/base/ty-component.d.ts.map +1 -0
- package/lib/base/ty-component.js +32 -1
- package/lib/base/ty-component.js.map +1 -0
- package/lib/components/button.d.ts.map +1 -0
- package/lib/components/button.js +7 -0
- package/lib/components/button.js.map +1 -0
- package/lib/components/calendar-month.d.ts.map +1 -0
- package/lib/components/calendar-month.js +3 -2
- package/lib/components/calendar-month.js.map +1 -0
- package/lib/components/calendar-navigation.d.ts +11 -0
- package/lib/components/calendar-navigation.d.ts.map +1 -0
- package/lib/components/calendar-navigation.js +51 -40
- package/lib/components/calendar-navigation.js.map +1 -0
- package/lib/components/calendar.d.ts +28 -0
- package/lib/components/calendar.d.ts.map +1 -0
- package/lib/components/calendar.js +186 -4
- package/lib/components/calendar.js.map +1 -0
- package/lib/components/checkbox.d.ts +2 -0
- package/lib/components/checkbox.d.ts.map +1 -0
- package/lib/components/checkbox.js +10 -3
- package/lib/components/checkbox.js.map +1 -0
- package/lib/components/copy.d.ts.map +1 -0
- package/lib/components/copy.js +9 -2
- package/lib/components/copy.js.map +1 -0
- package/lib/components/date-picker.d.ts +17 -16
- package/lib/components/date-picker.d.ts.map +1 -0
- package/lib/components/date-picker.js +182 -249
- package/lib/components/date-picker.js.map +1 -0
- package/lib/components/dropdown.d.ts +403 -0
- package/lib/components/dropdown.d.ts.map +1 -0
- package/lib/components/dropdown.js +1315 -0
- package/lib/components/dropdown.js.map +1 -0
- package/lib/components/file-upload.d.ts +6 -0
- package/lib/components/file-upload.js +29 -2
- package/lib/components/icon.d.ts.map +1 -0
- package/lib/components/icon.js.map +1 -0
- package/lib/components/input.d.ts +74 -2
- package/lib/components/input.d.ts.map +1 -0
- package/lib/components/input.js +168 -8
- package/lib/components/input.js.map +1 -0
- package/lib/components/modal.d.ts +4 -8
- package/lib/components/modal.d.ts.map +1 -0
- package/lib/components/modal.js +18 -25
- package/lib/components/modal.js.map +1 -0
- package/lib/components/multiselect.d.ts +389 -0
- package/lib/components/multiselect.d.ts.map +1 -0
- package/lib/components/multiselect.js +1301 -0
- package/lib/components/multiselect.js.map +1 -0
- package/lib/components/option.d.ts.map +1 -0
- package/lib/components/option.js +5 -0
- package/lib/components/option.js.map +1 -0
- package/lib/components/popup.d.ts.map +1 -0
- package/lib/components/popup.js +19 -4
- package/lib/components/popup.js.map +1 -0
- package/lib/components/radio.d.ts +17 -0
- package/lib/components/radio.js +42 -4
- package/lib/components/resize-observer.d.ts.map +1 -0
- package/lib/components/resize-observer.js.map +1 -0
- package/lib/components/scroll-container.d.ts +3 -2
- package/lib/components/scroll-container.d.ts.map +1 -0
- package/lib/components/scroll-container.js +5 -8
- package/lib/components/scroll-container.js.map +1 -0
- package/lib/components/select.d.ts +16 -6
- package/lib/components/select.js +73 -19
- package/lib/components/selected-tags.d.ts +7 -1
- package/lib/components/selected-tags.js +10 -1
- package/lib/components/step.d.ts.map +1 -0
- package/lib/components/step.js.map +1 -0
- package/lib/components/switch.d.ts +2 -0
- package/lib/components/switch.js +10 -3
- package/lib/components/tab.d.ts +49 -1
- package/lib/components/tab.d.ts.map +1 -0
- package/lib/components/tab.js +151 -10
- package/lib/components/tab.js.map +1 -0
- package/lib/components/tabs.d.ts +14 -2
- package/lib/components/tabs.d.ts.map +1 -0
- package/lib/components/tabs.js +184 -135
- package/lib/components/tabs.js.map +1 -0
- package/lib/components/tag.d.ts +4 -7
- package/lib/components/tag.d.ts.map +1 -0
- package/lib/components/tag.js +6 -7
- package/lib/components/tag.js.map +1 -0
- package/lib/components/textarea.d.ts +8 -3
- package/lib/components/textarea.d.ts.map +1 -0
- package/lib/components/textarea.js +23 -15
- package/lib/components/textarea.js.map +1 -0
- package/lib/components/tooltip.d.ts +4 -3
- package/lib/components/tooltip.d.ts.map +1 -0
- package/lib/components/tooltip.js +34 -24
- package/lib/components/tooltip.js.map +1 -0
- package/lib/components/wizard.d.ts +5 -4
- package/lib/components/wizard.d.ts.map +1 -0
- package/lib/components/wizard.js +120 -156
- package/lib/components/wizard.js.map +1 -0
- package/lib/icons/fontawesome/brands.d.ts.map +1 -0
- package/lib/icons/fontawesome/brands.js.map +1 -0
- package/lib/icons/fontawesome/regular.d.ts.map +1 -0
- package/lib/icons/fontawesome/regular.js.map +1 -0
- package/lib/icons/fontawesome/solid.d.ts.map +1 -0
- package/lib/icons/fontawesome/solid.js.map +1 -0
- package/lib/icons/heroicons/micro.d.ts.map +1 -0
- package/lib/icons/heroicons/micro.js.map +1 -0
- package/lib/icons/heroicons/mini.d.ts.map +1 -0
- package/lib/icons/heroicons/mini.js.map +1 -0
- package/lib/icons/heroicons/outline.d.ts.map +1 -0
- package/lib/icons/heroicons/outline.js.map +1 -0
- package/lib/icons/heroicons/solid.d.ts.map +1 -0
- package/lib/icons/heroicons/solid.js.map +1 -0
- package/lib/icons/lucide.d.ts.map +1 -0
- package/lib/icons/lucide.js.map +1 -0
- package/lib/icons/material/filled.d.ts.map +1 -0
- package/lib/icons/material/filled.js.map +1 -0
- package/lib/icons/material/outlined.d.ts.map +1 -0
- package/lib/icons/material/outlined.js.map +1 -0
- package/lib/icons/material/round.d.ts.map +1 -0
- package/lib/icons/material/round.js.map +1 -0
- package/lib/icons/material/sharp.d.ts.map +1 -0
- package/lib/icons/material/sharp.js.map +1 -0
- package/lib/icons/material/two-tone.d.ts.map +1 -0
- package/lib/icons/material/two-tone.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js.map +1 -0
- package/lib/styles/button.d.ts.map +1 -0
- package/lib/styles/button.js +68 -58
- package/lib/styles/button.js.map +1 -0
- package/lib/styles/calendar-month.d.ts +3 -0
- package/lib/styles/calendar-month.d.ts.map +1 -0
- package/lib/styles/calendar-month.js +43 -27
- package/lib/styles/calendar-month.js.map +1 -0
- package/lib/styles/calendar-navigation.d.ts +1 -1
- package/lib/styles/calendar-navigation.d.ts.map +1 -0
- package/lib/styles/calendar-navigation.js +55 -26
- package/lib/styles/calendar-navigation.js.map +1 -0
- package/lib/styles/calendar.d.ts +3 -2
- package/lib/styles/calendar.d.ts.map +1 -0
- package/lib/styles/calendar.js +74 -0
- package/lib/styles/calendar.js.map +1 -0
- package/lib/styles/checkbox.js +22 -10
- package/lib/styles/copy.d.ts.map +1 -0
- package/lib/styles/copy.js +5 -1
- package/lib/styles/copy.js.map +1 -0
- package/lib/styles/date-picker.d.ts.map +1 -0
- package/lib/styles/date-picker.js +53 -23
- package/lib/styles/date-picker.js.map +1 -0
- package/lib/styles/dropdown.d.ts +12 -0
- package/lib/styles/dropdown.d.ts.map +1 -0
- package/lib/styles/dropdown.js +725 -0
- package/lib/styles/dropdown.js.map +1 -0
- package/lib/styles/file-upload.d.ts +1 -1
- package/lib/styles/file-upload.js +3 -3
- package/lib/styles/icon.d.ts +1 -1
- package/lib/styles/icon.d.ts.map +1 -0
- package/lib/styles/icon.js +2 -2
- package/lib/styles/icon.js.map +1 -0
- package/lib/styles/input.d.ts.map +1 -0
- package/lib/styles/input.js +1 -1
- package/lib/styles/input.js.map +1 -0
- package/lib/styles/modal.d.ts.map +1 -0
- package/lib/styles/modal.js.map +1 -0
- package/lib/styles/multiselect.d.ts +6 -0
- package/lib/styles/multiselect.d.ts.map +1 -0
- package/lib/styles/multiselect.js +568 -0
- package/lib/styles/multiselect.js.map +1 -0
- package/lib/styles/option.d.ts +1 -1
- package/lib/styles/option.d.ts.map +1 -0
- package/lib/styles/option.js +3 -3
- package/lib/styles/option.js.map +1 -0
- package/lib/styles/popup.d.ts +1 -1
- package/lib/styles/popup.d.ts.map +1 -0
- package/lib/styles/popup.js +8 -5
- package/lib/styles/popup.js.map +1 -0
- package/lib/styles/radio.js +10 -4
- package/lib/styles/resize-observer.d.ts.map +1 -0
- package/lib/styles/resize-observer.js.map +1 -0
- package/lib/styles/scroll-container.d.ts +1 -1
- package/lib/styles/scroll-container.d.ts.map +1 -0
- package/lib/styles/scroll-container.js +1 -1
- package/lib/styles/scroll-container.js.map +1 -0
- package/lib/styles/select.d.ts +1 -1
- package/lib/styles/select.js +6 -0
- package/lib/styles/step.d.ts +1 -1
- package/lib/styles/step.d.ts.map +1 -0
- package/lib/styles/step.js +1 -9
- package/lib/styles/step.js.map +1 -0
- package/lib/styles/switch.js +6 -3
- package/lib/styles/tab.d.ts +1 -1
- package/lib/styles/tab.d.ts.map +1 -0
- package/lib/styles/tab.js +67 -3
- package/lib/styles/tab.js.map +1 -0
- package/lib/styles/tabs.d.ts +1 -1
- package/lib/styles/tabs.d.ts.map +1 -0
- package/lib/styles/tabs.js +7 -3
- package/lib/styles/tabs.js.map +1 -0
- package/lib/styles/tag.d.ts.map +1 -0
- package/lib/styles/tag.js +1 -2
- package/lib/styles/tag.js.map +1 -0
- package/lib/styles/textarea.d.ts.map +1 -0
- package/lib/styles/textarea.js.map +1 -0
- package/lib/styles/tooltip.d.ts.map +1 -0
- package/lib/styles/tooltip.js.map +1 -0
- package/lib/styles/wizard.d.ts +9 -5
- package/lib/styles/wizard.d.ts.map +1 -0
- package/lib/styles/wizard.js +211 -99
- package/lib/styles/wizard.js.map +1 -0
- package/lib/types/common.d.ts +2 -2
- package/lib/types/common.d.ts.map +1 -0
- package/lib/types/common.js.map +1 -0
- package/lib/utils/calendar-utils.d.ts.map +1 -0
- package/lib/utils/calendar-utils.js.map +1 -0
- package/lib/utils/icon-registry.d.ts.map +1 -0
- package/lib/utils/icon-registry.js.map +1 -0
- package/lib/utils/locale.d.ts.map +1 -0
- package/lib/utils/locale.js.map +1 -0
- package/lib/utils/number-format.d.ts.map +1 -0
- package/lib/utils/number-format.js.map +1 -0
- package/lib/utils/parse-boolean.d.ts +39 -0
- package/lib/utils/parse-boolean.d.ts.map +1 -0
- package/lib/utils/parse-boolean.js +23 -0
- package/lib/utils/parse-boolean.js.map +1 -0
- package/lib/utils/positioning.d.ts.map +1 -0
- package/lib/utils/positioning.js.map +1 -0
- package/lib/utils/property-capture.d.ts.map +1 -0
- package/lib/utils/property-capture.js.map +1 -0
- package/lib/utils/property-manager.d.ts +7 -1
- package/lib/utils/property-manager.d.ts.map +1 -0
- package/lib/utils/property-manager.js +16 -4
- package/lib/utils/property-manager.js.map +1 -0
- package/lib/utils/resize-observer.d.ts.map +1 -0
- package/lib/utils/resize-observer.js.map +1 -0
- package/lib/utils/scroll-lock.d.ts.map +1 -0
- package/lib/utils/scroll-lock.js.map +1 -0
- package/lib/utils/styles.d.ts.map +1 -0
- package/lib/utils/styles.js.map +1 -0
- package/lib/utils/validity.d.ts +38 -0
- package/lib/utils/validity.js +116 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.d.ts.map +1 -0
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -0
- package/package.json +26 -5
package/lib/components/select.js
CHANGED
|
@@ -96,6 +96,7 @@ dialog.close();
|
|
|
96
96
|
});
|
|
97
97
|
this.render();
|
|
98
98
|
this.initializeState();
|
|
99
|
+
this.updateFormValue();
|
|
99
100
|
this._childObserver = new MutationObserver(() => {
|
|
100
101
|
this.ensureOptionRoles();
|
|
101
102
|
if (this._state.selectedValues.length > 0) {
|
|
@@ -178,8 +179,8 @@ break;
|
|
|
178
179
|
case "required":
|
|
179
180
|
this._required = newValue;
|
|
180
181
|
break;
|
|
181
|
-
case "
|
|
182
|
-
this._clearable = newValue;
|
|
182
|
+
case "noClear":
|
|
183
|
+
this._clearable = !newValue;
|
|
183
184
|
if (this.isConnected && this.shadowRoot)
|
|
184
185
|
this.updateSelectionDisplay();
|
|
185
186
|
break;
|
|
@@ -250,8 +251,19 @@ formData.append(this._name, value);
|
|
|
250
251
|
});
|
|
251
252
|
return formData;
|
|
252
253
|
}
|
|
254
|
+
if (this._name && !this._multiple)
|
|
255
|
+
return "";
|
|
253
256
|
return null;
|
|
254
257
|
}
|
|
258
|
+
focus(options) {
|
|
259
|
+
const trigger = this.querySelector(':scope > [slot="trigger"]');
|
|
260
|
+
const stub = this.shadowRoot?.querySelector(".select-stub");
|
|
261
|
+
const target = trigger ?? stub;
|
|
262
|
+
if (target)
|
|
263
|
+
target.focus(options);
|
|
264
|
+
else
|
|
265
|
+
super.focus(options);
|
|
266
|
+
}
|
|
255
267
|
parseValue(value) {
|
|
256
268
|
if (!value || typeof value !== "string" || value.trim() === "")
|
|
257
269
|
return [];
|
|
@@ -881,19 +893,58 @@ this.renderDesktop();
|
|
|
881
893
|
}
|
|
882
894
|
this.updateSearchVisibility();
|
|
883
895
|
this.applyLoadingState();
|
|
896
|
+
this.syncFieldChrome();
|
|
884
897
|
this.updateValidity();
|
|
885
898
|
}
|
|
899
|
+
syncFieldChrome() {
|
|
900
|
+
const shadow = this.shadowRoot;
|
|
901
|
+
const container = shadow?.querySelector(".select-container");
|
|
902
|
+
if (!shadow || !container)
|
|
903
|
+
return;
|
|
904
|
+
const labelId = `select-label-${getElementHash(this)}`;
|
|
905
|
+
let label = container.querySelector(":scope > .ty-field-label");
|
|
906
|
+
if (this._label) {
|
|
907
|
+
if (!label) {
|
|
908
|
+
label = document.createElement("label");
|
|
909
|
+
label.className = "ty-field-label";
|
|
910
|
+
label.id = labelId;
|
|
911
|
+
container.prepend(label);
|
|
912
|
+
}
|
|
913
|
+
label.innerHTML = `${this._label}${this._required ? `<span class="required-icon">${REQUIRED_ICON_SVG}</span>` : ""}`;
|
|
914
|
+
}
|
|
915
|
+
else {
|
|
916
|
+
label?.remove();
|
|
917
|
+
}
|
|
918
|
+
const stub = shadow.querySelector(".select-stub");
|
|
919
|
+
if (stub) {
|
|
920
|
+
stub.classList.toggle("disabled", this._disabled);
|
|
921
|
+
stub.classList.toggle("compact", this._compact);
|
|
922
|
+
stub.tabIndex = this._disabled ? -1 : 0;
|
|
923
|
+
stub.toggleAttribute("disabled", this._disabled);
|
|
924
|
+
if (this._disabled)
|
|
925
|
+
stub.setAttribute("aria-disabled", "true");
|
|
926
|
+
else
|
|
927
|
+
stub.removeAttribute("aria-disabled");
|
|
928
|
+
if (this._label)
|
|
929
|
+
stub.setAttribute("aria-labelledby", labelId);
|
|
930
|
+
else
|
|
931
|
+
stub.removeAttribute("aria-labelledby");
|
|
932
|
+
}
|
|
933
|
+
shadow
|
|
934
|
+
.querySelectorAll(".dropdown-search-input, .mobile-search-input")
|
|
935
|
+
.forEach((input) => (input.disabled = this._disabled));
|
|
936
|
+
}
|
|
886
937
|
updateValidity() {
|
|
887
938
|
if (this.disabled) {
|
|
888
|
-
this.
|
|
939
|
+
this.applyValidity({});
|
|
889
940
|
return;
|
|
890
941
|
}
|
|
891
942
|
if (this.required && this.getSelectedValues().length === 0) {
|
|
892
943
|
const stub = this.shadowRoot?.querySelector(".select-stub");
|
|
893
|
-
this.
|
|
944
|
+
this.applyValidity({ valueMissing: true }, "Please select a value", stub ?? undefined);
|
|
894
945
|
}
|
|
895
946
|
else {
|
|
896
|
-
this.
|
|
947
|
+
this.applyValidity({});
|
|
897
948
|
}
|
|
898
949
|
}
|
|
899
950
|
setupTriggerSlot() {
|
|
@@ -1111,7 +1162,7 @@ ${CHEVRON_DOWN_SVG}
|
|
|
1111
1162
|
<!-- AVAILABLE LIST (always visible, takes remaining space) -->
|
|
1112
1163
|
<div class="mobile-available-section" data-empty="false">
|
|
1113
1164
|
<button class="section-header" type="button" data-section="available" aria-expanded="true">
|
|
1114
|
-
<span class="section-title">${this._availableLabel}
|
|
1165
|
+
<span class="section-title">${this._availableLabel} <span class="section-count"></span></span>
|
|
1115
1166
|
${CHEVRON_DOWN_SVG}
|
|
1116
1167
|
</button>
|
|
1117
1168
|
<div class="section-content dropdown-options-wrapper" id="${listboxId}" role="listbox" ${this._multiple ? 'aria-multiselectable="true"' : ""}>
|
|
@@ -1205,11 +1256,17 @@ const availableSection = shadow.querySelector(".mobile-available-section");
|
|
|
1205
1256
|
if (availableSection) {
|
|
1206
1257
|
const visibleAvailable = this.getTagElements().filter((tag) => !tag.hasAttribute("hidden") && !tag.hasAttribute("selected")).length;
|
|
1207
1258
|
availableSection.setAttribute("data-empty", String(visibleAvailable === 0));
|
|
1208
|
-
|
|
1209
|
-
if (availableTitleSpan) {
|
|
1210
|
-
availableTitleSpan.textContent = `${this._availableLabel} (${visibleAvailable})`;
|
|
1259
|
+
this.setMobileSectionTitle(availableSection, this._availableLabel, visibleAvailable);
|
|
1211
1260
|
}
|
|
1212
1261
|
}
|
|
1262
|
+
setMobileSectionTitle(section, label, n) {
|
|
1263
|
+
const title = section.querySelector(".section-title");
|
|
1264
|
+
if (!title)
|
|
1265
|
+
return;
|
|
1266
|
+
const count = document.createElement("span");
|
|
1267
|
+
count.className = "section-count";
|
|
1268
|
+
count.textContent = `(${n})`;
|
|
1269
|
+
title.replaceChildren(`${label} `, count);
|
|
1213
1270
|
}
|
|
1214
1271
|
expandMobileSection(section) {
|
|
1215
1272
|
const shadow = this.shadowRoot;
|
|
@@ -1232,9 +1289,7 @@ if (!section || !host)
|
|
|
1232
1289
|
return;
|
|
1233
1290
|
const selected = this._state.selectedValues;
|
|
1234
1291
|
section.setAttribute("data-empty", String(selected.length === 0));
|
|
1235
|
-
|
|
1236
|
-
if (count)
|
|
1237
|
-
count.textContent = `(${selected.length})`;
|
|
1292
|
+
this.setMobileSectionTitle(section, this._selectedLabel, selected.length);
|
|
1238
1293
|
if (selected.length === 0)
|
|
1239
1294
|
this.expandMobileSection("available");
|
|
1240
1295
|
const labelFor = (value) => {
|
|
@@ -1422,11 +1477,11 @@ return this.getProperty("readonly");
|
|
|
1422
1477
|
set readonly(value) {
|
|
1423
1478
|
this.setProperty("readonly", value);
|
|
1424
1479
|
}
|
|
1425
|
-
get
|
|
1426
|
-
return this.getProperty("
|
|
1480
|
+
get noClear() {
|
|
1481
|
+
return this.getProperty("noClear");
|
|
1427
1482
|
}
|
|
1428
|
-
set
|
|
1429
|
-
this.setProperty("
|
|
1483
|
+
set noClear(value) {
|
|
1484
|
+
this.setProperty("noClear", value);
|
|
1430
1485
|
}
|
|
1431
1486
|
get required() {
|
|
1432
1487
|
return this.getProperty("required");
|
|
@@ -1537,11 +1592,10 @@ type: "boolean",
|
|
|
1537
1592
|
visual: true,
|
|
1538
1593
|
default: false,
|
|
1539
1594
|
},
|
|
1540
|
-
|
|
1595
|
+
noClear: {
|
|
1541
1596
|
type: "boolean",
|
|
1542
1597
|
visual: true,
|
|
1543
|
-
default:
|
|
1544
|
-
aliases: { "not-clearable": false },
|
|
1598
|
+
default: false,
|
|
1545
1599
|
},
|
|
1546
1600
|
externalSearch: {
|
|
1547
1601
|
type: "boolean",
|
|
@@ -28,6 +28,8 @@ export declare class TySelectedOptions extends HTMLElement {
|
|
|
28
28
|
* Interpolation context for a value: value, label, flavor plus every
|
|
29
29
|
* data-* attribute of the picker's matching option.
|
|
30
30
|
*/
|
|
31
|
+
/** The picker's option for a value (never its display clone). */
|
|
32
|
+
private option;
|
|
31
33
|
private context;
|
|
32
34
|
/**
|
|
33
35
|
* The template's blueprint fragment. HTML-parsed templates carry children in
|
|
@@ -42,7 +44,11 @@ export declare class TySelectedOptions extends HTMLElement {
|
|
|
42
44
|
* no flavor on the option).
|
|
43
45
|
*/
|
|
44
46
|
private stampTemplate;
|
|
45
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Default chip when no template is provided: the option's own content,
|
|
49
|
+
* cloned, so a rich option makes a rich chip. An explicit `label` on the
|
|
50
|
+
* option replaces it with that text; a <template> child replaces it entirely.
|
|
51
|
+
*/
|
|
46
52
|
private defaultChip;
|
|
47
53
|
private renderChips;
|
|
48
54
|
/** Remove a value from the picker; picker re-emits change → chips re-render. */
|
|
@@ -93,8 +93,11 @@ return parseValues(this._picker?.value ?? '');
|
|
|
93
93
|
template() {
|
|
94
94
|
return this.querySelector(':scope > template');
|
|
95
95
|
}
|
|
96
|
+
option(value) {
|
|
97
|
+
return this._picker?.querySelector(`[value="${CSS.escape(value)}"]:not([cloned])`);
|
|
98
|
+
}
|
|
96
99
|
context(value) {
|
|
97
|
-
const opt = this.
|
|
100
|
+
const opt = this.option(value);
|
|
98
101
|
const ctx = {
|
|
99
102
|
value,
|
|
100
103
|
label: opt?.getAttribute('label') || opt?.textContent?.trim() || value,
|
|
@@ -150,12 +153,18 @@ return clone;
|
|
|
150
153
|
}
|
|
151
154
|
defaultChip(value) {
|
|
152
155
|
const ctx = this.context(value);
|
|
156
|
+
const opt = this.option(value);
|
|
153
157
|
const tag = document.createElement('ty-tag');
|
|
154
158
|
tag.setAttribute('value', value);
|
|
155
159
|
tag.setAttribute('dismissible', 'true');
|
|
156
160
|
if (ctx.flavor)
|
|
157
161
|
tag.setAttribute('flavor', ctx.flavor);
|
|
162
|
+
if (opt && !opt.hasAttribute('label') && opt.hasChildNodes()) {
|
|
163
|
+
opt.childNodes.forEach(n => tag.appendChild(n.cloneNode(true)));
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
158
166
|
tag.textContent = ctx.label;
|
|
167
|
+
}
|
|
159
168
|
tag.addEventListener('dismiss', () => this.deselect(value));
|
|
160
169
|
return tag;
|
|
161
170
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/components/step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AASH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;CAC3B;AAiED;;GAEG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC,0BAA0B;IAC1B,MAAM,KAAK,kBAAkB,aAE5B;;IAOD,iBAAiB;IAIjB,oBAAoB;IAIpB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;CAG3F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step.js","sourceRoot":"","sources":["../../src/components/step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAsB/C,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;GAEG;AACH,SAAS,iBAAiB,CAAC,EAAU;IACnC,MAAM,UAAU,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,aAAa,GAAiB,CAAC,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAEhF,OAAO;QACL,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC;QACzB,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC;QAC/B,WAAW,EAAE,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC;QAC3C,QAAQ,EAAE,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC;QACrC,MAAM,EAAE,UAAU,IAAI,aAAa,CAAC,QAAQ,CAAC,UAAwB,CAAC;YACpE,CAAC,CAAE,UAAyB;YAC5B,CAAC,CAAC,IAAI;KACT,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E;;;GAGG;AACH,SAAS,MAAM,CAAC,EAAU;IACxB,MAAM,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC;IACjC,IAAI,CAAC,UAAU;QAAE,OAAO;IAExB,MAAM,EAAE,EAAE,EAAE,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAC;IAErC,2BAA2B;IAC3B,YAAY,CAAC,UAAU,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;IAE7D,mEAAmE;IACnE,4EAA4E;IAC5E,UAAU,CAAC,SAAS,GAAG;;;WAGd,EAAE,CAAC,CAAC,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE;WAC5B,EAAE,CAAC,CAAC,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE;;;;GAIhD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,OAAO,CAAC,GAAW;IAC1B,6BAA6B;AAC/B,CAAC;AAED,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC,0BAA0B;IAC1B,MAAM,KAAK,kBAAkB;QAC3B,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC9D,CAAC;IAED;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,iBAAiB;QACf,MAAM,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IAED,oBAAoB;QAClB,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED,wBAAwB,CAAC,KAAa,EAAE,SAAwB,EAAE,SAAwB;QACxF,MAAM,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;CACF;AAED,8BAA8B;AAC9B,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;IACnC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -82,6 +82,8 @@ export declare class TySwitch extends TyComponent<SwitchState> implements TySwit
|
|
|
82
82
|
private removeEventListeners;
|
|
83
83
|
private setupEventListeners;
|
|
84
84
|
protected render(): void;
|
|
85
|
+
/** Focus the switch itself (the host is not focusable; its role element is). */
|
|
86
|
+
focus(options?: FocusOptions): void;
|
|
85
87
|
/** required + unchecked => valueMissing; otherwise valid. */
|
|
86
88
|
private updateValidity;
|
|
87
89
|
get checked(): boolean;
|
package/lib/components/switch.js
CHANGED
|
@@ -145,17 +145,24 @@ this.setupEventListeners();
|
|
|
145
145
|
this.applyLabelName(switchEl);
|
|
146
146
|
this.updateValidity();
|
|
147
147
|
}
|
|
148
|
+
focus(options) {
|
|
149
|
+
const el = this.shadowRoot?.querySelector(".switch-container");
|
|
150
|
+
if (el)
|
|
151
|
+
el.focus(options);
|
|
152
|
+
else
|
|
153
|
+
super.focus(options);
|
|
154
|
+
}
|
|
148
155
|
updateValidity() {
|
|
149
156
|
const anchor = this.shadowRoot?.querySelector(".switch-container");
|
|
150
157
|
if (this.disabled) {
|
|
151
|
-
this.
|
|
158
|
+
this.applyValidity({});
|
|
152
159
|
return;
|
|
153
160
|
}
|
|
154
161
|
if (this.required && !this.checked) {
|
|
155
|
-
this.
|
|
162
|
+
this.applyValidity({ valueMissing: true }, "Please turn this on", anchor ?? undefined);
|
|
156
163
|
}
|
|
157
164
|
else {
|
|
158
|
-
this.
|
|
165
|
+
this.applyValidity({});
|
|
159
166
|
}
|
|
160
167
|
}
|
|
161
168
|
get checked() { return this.getProperty("checked"); }
|
package/lib/components/tab.d.ts
CHANGED
|
@@ -3,15 +3,63 @@ export interface TabAttributes {
|
|
|
3
3
|
id: string | null;
|
|
4
4
|
label: string | null;
|
|
5
5
|
disabled: boolean;
|
|
6
|
+
lazy: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* `ty-tab-load`: a lazy tab with no content was shown. Fired on the ty-tab
|
|
10
|
+
* and doesn't bubble, so a lazy tab nested in another doesn't trigger the
|
|
11
|
+
* outer one's listener. Listen on the tab, or on ty-tabs with capture.
|
|
12
|
+
*/
|
|
13
|
+
export interface TabLoadDetail {
|
|
14
|
+
id: string;
|
|
15
|
+
index: number;
|
|
6
16
|
}
|
|
7
17
|
export declare class TyTab extends HTMLElement {
|
|
8
18
|
private _scrollbar;
|
|
19
|
+
private _panelLabel;
|
|
20
|
+
private _shown;
|
|
21
|
+
private _load;
|
|
22
|
+
private _contentObserver;
|
|
23
|
+
private _contentChanged;
|
|
9
24
|
static get observedAttributes(): string[];
|
|
10
25
|
constructor();
|
|
11
26
|
connectedCallback(): void;
|
|
27
|
+
/** Accessible name. Set by ty-tabs, which also knows rich `label-{id}` slots. */
|
|
28
|
+
setPanelLabel(label: string): void;
|
|
29
|
+
/** Set by ty-tabs: a panel that isn't shown is inert. */
|
|
30
|
+
setShown(shown: boolean): void;
|
|
12
31
|
disconnectedCallback(): void;
|
|
13
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Called by ty-tabs when this tab becomes the shown one — never for the
|
|
34
|
+
* tab shown first, whose content the page is expected to carry. A lazy
|
|
35
|
+
* tab with no content (or whose load failed) asks for it.
|
|
36
|
+
*/
|
|
37
|
+
_requestLoad(index: number): void;
|
|
38
|
+
/**
|
|
39
|
+
* Report that loading this tab's content failed: shows `slot="error"`
|
|
40
|
+
* (default "Couldn't load.") with a Retry button. Retry, or showing the
|
|
41
|
+
* tab again, fires `ty-tab-load` once more. Content arriving clears it.
|
|
42
|
+
*/
|
|
43
|
+
loadFailed(): void;
|
|
44
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
14
45
|
private _render;
|
|
46
|
+
/** Lazy tabs track whether they have content; others don't watch. */
|
|
47
|
+
private _watchContent;
|
|
48
|
+
private _hasContent;
|
|
49
|
+
/**
|
|
50
|
+
* `mutated`: content changed under a connected tab. Content that goes away
|
|
51
|
+
* (a morph with the server's empty markup) loads again — right away when
|
|
52
|
+
* this tab is the one shown, otherwise the next time it's shown.
|
|
53
|
+
*/
|
|
54
|
+
private _checkContent;
|
|
55
|
+
private _fireLoad;
|
|
56
|
+
/**
|
|
57
|
+
* Placeholder and error, built the first time a tab loads: tabs that never
|
|
58
|
+
* do carry no hidden "Couldn't load / Retry" text.
|
|
59
|
+
*/
|
|
60
|
+
private _ensureStatus;
|
|
61
|
+
private _setLoad;
|
|
62
|
+
private _syncPanel;
|
|
15
63
|
private _setupScrollbar;
|
|
16
64
|
private _destroyScrollbar;
|
|
17
65
|
resetScroll(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../src/components/tab.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AASH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;CACnB;AA0DD;;GAEG;AACH,qBAAa,KAAM,SAAQ,WAAW;IACpC,0BAA0B;IAC1B,MAAM,KAAK,kBAAkB,aAE5B;;IAOD,iBAAiB;IAIjB,oBAAoB;IAIpB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;CAG3F"}
|
package/lib/components/tab.js
CHANGED
|
@@ -1,44 +1,185 @@
|
|
|
1
1
|
import { ensureStyles } from '../utils/styles.js';
|
|
2
2
|
import { tabStyles } from '../styles/tab.js';
|
|
3
3
|
import { CustomScrollbar, isCustomScrollbarEnabled } from '../utils/custom-scrollbar.js';
|
|
4
|
+
import { getLoaderSvg } from '../utils/loader-registry.js';
|
|
5
|
+
const STATUS_SLOTS = new Set(['loading', 'error']);
|
|
6
|
+
const INERT_ELEMENTS = new Set(['template', 'script', 'style']);
|
|
4
7
|
export class TyTab extends HTMLElement {
|
|
5
8
|
static get observedAttributes() {
|
|
6
|
-
return ['id', 'label', 'disabled'];
|
|
9
|
+
return ['id', 'label', 'disabled', 'lazy'];
|
|
7
10
|
}
|
|
8
11
|
constructor() {
|
|
9
12
|
super();
|
|
10
13
|
this._scrollbar = null;
|
|
14
|
+
this._panelLabel = null;
|
|
15
|
+
this._shown = true;
|
|
16
|
+
this._load = 'idle';
|
|
17
|
+
this._contentObserver = null;
|
|
18
|
+
this._contentChanged = false;
|
|
11
19
|
this.attachShadow({ mode: 'open' });
|
|
12
20
|
}
|
|
13
21
|
connectedCallback() {
|
|
14
22
|
this._render();
|
|
23
|
+
if (!this._scrollbar)
|
|
24
|
+
this._setupScrollbar();
|
|
25
|
+
this._watchContent();
|
|
26
|
+
}
|
|
27
|
+
setPanelLabel(label) {
|
|
28
|
+
this._panelLabel = label;
|
|
29
|
+
this._syncPanel();
|
|
30
|
+
}
|
|
31
|
+
setShown(shown) {
|
|
32
|
+
this._shown = shown;
|
|
33
|
+
this._syncPanel();
|
|
15
34
|
}
|
|
16
35
|
disconnectedCallback() {
|
|
17
36
|
this._destroyScrollbar();
|
|
37
|
+
this._contentChanged = !!this._contentObserver?.takeRecords().length;
|
|
38
|
+
this._contentObserver?.disconnect();
|
|
39
|
+
this._contentObserver = null;
|
|
40
|
+
}
|
|
41
|
+
_requestLoad(index) {
|
|
42
|
+
if (this._contentObserver?.takeRecords().length)
|
|
43
|
+
this._checkContent(false);
|
|
44
|
+
if (this._load === 'empty' || this._load === 'failed')
|
|
45
|
+
this._fireLoad(index);
|
|
46
|
+
}
|
|
47
|
+
loadFailed() {
|
|
48
|
+
if (this._load === 'loading' || this._load === 'empty')
|
|
49
|
+
this._setLoad('failed');
|
|
18
50
|
}
|
|
19
|
-
attributeChangedCallback(
|
|
51
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
20
52
|
this._render();
|
|
53
|
+
if (name === 'lazy') {
|
|
54
|
+
if (this.isConnected)
|
|
55
|
+
this._watchContent();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const tabs = this.parentElement;
|
|
59
|
+
if (oldValue !== newValue && this.isConnected && tabs?.localName === 'ty-tabs') {
|
|
60
|
+
tabs._queueUpdate?.(true);
|
|
61
|
+
}
|
|
21
62
|
}
|
|
22
63
|
_render() {
|
|
23
64
|
const shadowRoot = this.shadowRoot;
|
|
24
65
|
if (!shadowRoot)
|
|
25
66
|
return;
|
|
26
|
-
const id = this.getAttribute('id');
|
|
27
67
|
if (!shadowRoot.querySelector('.tab-wrapper')) {
|
|
28
68
|
ensureStyles(shadowRoot, { css: tabStyles, id: 'ty-tab' });
|
|
29
69
|
shadowRoot.innerHTML = `
|
|
30
|
-
<div class="tab-wrapper"
|
|
31
|
-
role="tabpanel"
|
|
32
|
-
${id ? `id="panel-${id}"` : ''}
|
|
33
|
-
${id ? `aria-labelledby="tab-${id}"` : ''}
|
|
34
|
-
>
|
|
35
|
-
<div class="tab-panel">
|
|
70
|
+
<div class="tab-wrapper">
|
|
71
|
+
<div class="tab-panel" role="tabpanel" tabindex="0">
|
|
36
72
|
<slot></slot>
|
|
37
73
|
</div>
|
|
38
74
|
</div>
|
|
39
75
|
`;
|
|
40
|
-
this._setupScrollbar();
|
|
41
76
|
}
|
|
77
|
+
this._syncPanel();
|
|
78
|
+
}
|
|
79
|
+
_watchContent() {
|
|
80
|
+
const lazy = this.hasAttribute('lazy');
|
|
81
|
+
if (lazy && !this._contentObserver) {
|
|
82
|
+
this._contentObserver = new MutationObserver(() => this._checkContent(true));
|
|
83
|
+
this._contentObserver.observe(this, { childList: true, characterData: true, subtree: true });
|
|
84
|
+
}
|
|
85
|
+
else if (!lazy && this._contentObserver) {
|
|
86
|
+
this._contentObserver.disconnect();
|
|
87
|
+
this._contentObserver = null;
|
|
88
|
+
}
|
|
89
|
+
const changed = this._contentChanged;
|
|
90
|
+
this._contentChanged = false;
|
|
91
|
+
this._checkContent(changed);
|
|
92
|
+
}
|
|
93
|
+
_hasContent() {
|
|
94
|
+
for (const node of Array.from(this.childNodes)) {
|
|
95
|
+
if (node.nodeType === Node.TEXT_NODE && node.textContent.trim())
|
|
96
|
+
return true;
|
|
97
|
+
if (node.nodeType !== Node.ELEMENT_NODE)
|
|
98
|
+
continue;
|
|
99
|
+
const el = node;
|
|
100
|
+
if (!STATUS_SLOTS.has(el.getAttribute('slot') ?? '') && !INERT_ELEMENTS.has(el.localName))
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
_checkContent(mutated) {
|
|
106
|
+
if (!this.hasAttribute('lazy') || this._hasContent()) {
|
|
107
|
+
this._setLoad('idle');
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (this._load !== 'idle')
|
|
111
|
+
return;
|
|
112
|
+
this._setLoad('empty');
|
|
113
|
+
if (!mutated)
|
|
114
|
+
return;
|
|
115
|
+
queueMicrotask(() => {
|
|
116
|
+
if (this._load === 'empty' && this._shown && this.parentElement?.localName === 'ty-tabs')
|
|
117
|
+
this._fireLoad();
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
_fireLoad(index) {
|
|
121
|
+
const tabs = this.parentElement;
|
|
122
|
+
if (index === undefined) {
|
|
123
|
+
index = tabs?.localName === 'ty-tabs'
|
|
124
|
+
? Array.from(tabs.querySelectorAll(':scope > ty-tab')).indexOf(this)
|
|
125
|
+
: 0;
|
|
126
|
+
}
|
|
127
|
+
this._setLoad('loading');
|
|
128
|
+
this.dispatchEvent(new CustomEvent('ty-tab-load', { detail: { id: this.id, index } }));
|
|
129
|
+
}
|
|
130
|
+
_ensureStatus(panel) {
|
|
131
|
+
if (panel.querySelector('.tab-loading'))
|
|
132
|
+
return;
|
|
133
|
+
panel.insertAdjacentHTML('beforeend', `
|
|
134
|
+
<div class="tab-loading" part="loading">
|
|
135
|
+
<slot name="loading"><span class="tab-spinner" part="spinner" aria-hidden="true"></span></slot>
|
|
136
|
+
</div>
|
|
137
|
+
<div class="tab-error" part="error" role="alert">
|
|
138
|
+
<slot name="error">Couldn't load.</slot>
|
|
139
|
+
<button type="button" class="tab-retry" part="retry">Retry</button>
|
|
140
|
+
</div>
|
|
141
|
+
`);
|
|
142
|
+
panel.querySelector('.tab-retry').addEventListener('click', () => {
|
|
143
|
+
panel.focus({ preventScroll: true });
|
|
144
|
+
this._fireLoad();
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
_setLoad(state) {
|
|
148
|
+
if (state === this._load)
|
|
149
|
+
return;
|
|
150
|
+
this._load = state;
|
|
151
|
+
const panel = this.shadowRoot?.querySelector('.tab-panel');
|
|
152
|
+
if (!panel)
|
|
153
|
+
return;
|
|
154
|
+
if (state === 'loading' || state === 'failed') {
|
|
155
|
+
this._ensureStatus(panel);
|
|
156
|
+
panel.dataset.load = state;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
delete panel.dataset.load;
|
|
160
|
+
}
|
|
161
|
+
if (state === 'loading') {
|
|
162
|
+
panel.setAttribute('aria-busy', 'true');
|
|
163
|
+
panel.querySelector('.tab-spinner').innerHTML = getLoaderSvg();
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
panel.removeAttribute('aria-busy');
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
_syncPanel() {
|
|
170
|
+
const panel = this.shadowRoot?.querySelector('.tab-panel');
|
|
171
|
+
if (!panel)
|
|
172
|
+
return;
|
|
173
|
+
const tabs = this.parentElement;
|
|
174
|
+
const rich = !this._panelLabel && this.id && tabs?.localName === 'ty-tabs'
|
|
175
|
+
? tabs.querySelector(`:scope > [slot="label-${CSS.escape(this.id)}"]`)
|
|
176
|
+
: null;
|
|
177
|
+
const label = this._panelLabel || rich?.textContent?.trim() || this.getAttribute('label');
|
|
178
|
+
if (label)
|
|
179
|
+
panel.setAttribute('aria-label', label);
|
|
180
|
+
else
|
|
181
|
+
panel.removeAttribute('aria-label');
|
|
182
|
+
panel.parentElement.inert = !this._shown;
|
|
42
183
|
}
|
|
43
184
|
_setupScrollbar() {
|
|
44
185
|
const panel = this.shadowRoot?.querySelector('.tab-panel');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tab.js","sourceRoot":"","sources":["../../src/components/tab.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAe7C,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;GAEG;AACH,SAAS,gBAAgB,CAAC,EAAS;IACjC,OAAO;QACL,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC;QACzB,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC;QAC/B,QAAQ,EAAE,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC;KACtC,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E;;;GAGG;AACH,SAAS,MAAM,CAAC,EAAS;IACvB,MAAM,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC;IACjC,IAAI,CAAC,UAAU;QAAE,OAAO;IAExB,MAAM,EAAE,EAAE,EAAE,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAEpC,2BAA2B;IAC3B,YAAY,CAAC,UAAU,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IAE3D,mEAAmE;IACnE,0EAA0E;IAC1E,UAAU,CAAC,SAAS,GAAG;;;WAGd,EAAE,CAAC,CAAC,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE;WAC5B,EAAE,CAAC,CAAC,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE;;;;GAI/C,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,OAAO,CAAC,GAAU;IACzB,6BAA6B;AAC/B,CAAC;AAED,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC,0BAA0B;IAC1B,MAAM,KAAK,kBAAkB;QAC3B,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IACrC,CAAC;IAED;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,iBAAiB;QACf,MAAM,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IAED,oBAAoB;QAClB,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED,wBAAwB,CAAC,KAAa,EAAE,SAAwB,EAAE,SAAwB;QACxF,MAAM,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;CACF;AAED,8BAA8B;AAC9B,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;IAClC,cAAc,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACzC,CAAC"}
|
package/lib/components/tabs.d.ts
CHANGED
|
@@ -14,7 +14,8 @@ export interface TabsAttributes {
|
|
|
14
14
|
fixed: boolean;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* Tab change event detail
|
|
17
|
+
* Tab change event detail. Fired whenever the shown tab changes after the
|
|
18
|
+
* first one is shown — never for the initial tab.
|
|
18
19
|
*/
|
|
19
20
|
export interface TabChangeDetail {
|
|
20
21
|
activeId: string;
|
|
@@ -29,8 +30,19 @@ export declare class TyTabs extends HTMLElement {
|
|
|
29
30
|
static get observedAttributes(): string[];
|
|
30
31
|
constructor();
|
|
31
32
|
private _childObserver;
|
|
32
|
-
private
|
|
33
|
+
private _updateQueued;
|
|
34
|
+
private _structureDirty;
|
|
35
|
+
/** ID of the tab currently shown (`active` may be stale or missing after a morph). */
|
|
36
|
+
get activeTab(): string | null;
|
|
33
37
|
connectedCallback(): void;
|
|
34
38
|
disconnectedCallback(): void;
|
|
39
|
+
/**
|
|
40
|
+
* External changes (`active` set by app or server, children added or
|
|
41
|
+
* removed, a ty-tab's id/label/disabled changed — ty-tab reports those)
|
|
42
|
+
* settle in one microtask: a morph sets attributes and swaps children in
|
|
43
|
+
* one go, and the shown tab must be decided once the whole batch has
|
|
44
|
+
* landed — `active` may name a tab that is appended after it.
|
|
45
|
+
*/
|
|
46
|
+
_queueUpdate(structure: boolean): void;
|
|
35
47
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
36
48
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/components/tabs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AASH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,KAAK,GAAG,QAAQ,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AA8pBD;;GAEG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC,0BAA0B;IAC1B,MAAM,KAAK,kBAAkB,aAE5B;;IAOD,iBAAiB;IAIjB,oBAAoB;IAIpB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;CAcxF"}
|