@scania/tegel 1.26.0-value-prop-fix.beta.0 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/tds-banner.cjs.entry.js +1 -1
- package/dist/cjs/tds-checkbox.cjs.entry.js +10 -3
- package/dist/cjs/tds-chip.cjs.entry.js +7 -2
- package/dist/cjs/tds-dropdown_2.cjs.entry.js +36 -31
- package/dist/cjs/tds-folder-tab.cjs.entry.js +21 -2
- package/dist/cjs/tds-folder-tabs.cjs.entry.js +4 -2
- package/dist/cjs/tds-icon.cjs.entry.js +1 -1
- package/dist/cjs/tds-inline-tab.cjs.entry.js +21 -2
- package/dist/cjs/tds-inline-tabs.cjs.entry.js +4 -2
- package/dist/cjs/tds-link.cjs.entry.js +17 -3
- package/dist/cjs/tds-message.cjs.entry.js +15 -3
- package/dist/cjs/tds-navigation-tab.cjs.entry.js +21 -2
- package/dist/cjs/tds-navigation-tabs.cjs.entry.js +6 -4
- package/dist/cjs/tds-popover-core.cjs.entry.js +1 -1
- package/dist/cjs/tds-text-field.cjs.entry.js +13 -7
- package/dist/cjs/tds-textarea.cjs.entry.js +3 -3
- package/dist/cjs/tds-toast.cjs.entry.js +4 -4
- package/dist/cjs/tds-toggle.cjs.entry.js +2 -2
- package/dist/cjs/tds-tooltip.cjs.entry.js +14 -4
- package/dist/cjs/tegel.cjs.js +1 -1
- package/dist/collection/components/banner/banner.css +1 -1
- package/dist/collection/components/banner/banner.js +1 -1
- package/dist/collection/components/checkbox/checkbox.js +44 -3
- package/dist/collection/components/chip/chip.js +24 -2
- package/dist/collection/components/dropdown/dropdown-option/dropdown-option.js +2 -2
- package/dist/collection/components/dropdown/dropdown.js +51 -29
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/icon/iconsArray.js +96 -1
- package/dist/collection/components/link/link.js +17 -3
- package/dist/collection/components/message/message.css +44 -26
- package/dist/collection/components/message/message.js +49 -2
- package/dist/collection/components/popover-core/tds-popover-core.css +530 -53
- package/dist/collection/components/tabs/folder-tabs/folder-tab/folder-tab.js +21 -2
- package/dist/collection/components/tabs/folder-tabs/folder-tabs.js +40 -2
- package/dist/collection/components/tabs/inline-tabs/inline-tab/inline-tab.js +21 -2
- package/dist/collection/components/tabs/inline-tabs/inline-tabs.js +40 -2
- package/dist/collection/components/tabs/navigation-tabs/navigation-tab/navigation-tab.js +21 -2
- package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.js +42 -4
- package/dist/collection/components/text-field/text-field.js +31 -8
- package/dist/collection/components/textarea/textarea.js +3 -3
- package/dist/collection/components/toast/toast.css +1 -1
- package/dist/collection/components/toast/toast.js +3 -3
- package/dist/collection/components/toggle/toggle.js +2 -2
- package/dist/collection/components/tooltip/tooltip.js +40 -4
- package/dist/collection/utils/axeHelpers.js +1 -1
- package/dist/components/{p-c65351ab.js → p-14ab9663.js} +12 -3
- package/dist/components/{p-98730c19.js → p-2d93a742.js} +4 -4
- package/dist/components/p-4487c541.js +65 -0
- package/dist/components/{p-29d19dc8.js → p-53e4cdcf.js} +1 -1
- package/dist/components/{p-3cd8af42.js → p-663b8e51.js} +36 -30
- package/dist/components/{p-4c1e3344.js → p-83db8b35.js} +1 -1
- package/dist/components/p-90dbeab3.js +2052 -0
- package/dist/components/tds-accordion-item.js +1 -1
- package/dist/components/tds-banner.js +2 -2
- package/dist/components/tds-checkbox.js +1 -1
- package/dist/components/tds-chip.js +9 -3
- package/dist/components/tds-datetime.js +1 -1
- package/dist/components/tds-dropdown-option.js +1 -1
- package/dist/components/tds-dropdown.js +1 -1
- package/dist/components/tds-folder-tab.js +21 -2
- package/dist/components/tds-folder-tabs.js +7 -3
- package/dist/components/tds-footer-group.js +1 -1
- package/dist/components/tds-header-cell.js +1 -1
- package/dist/components/tds-header-dropdown.js +3 -3
- package/dist/components/tds-header-hamburger.js +1 -1
- package/dist/components/tds-header-launcher-button.js +1 -1
- package/dist/components/tds-header-launcher.js +4 -4
- package/dist/components/tds-icon.js +1 -1
- package/dist/components/tds-inline-tab.js +21 -2
- package/dist/components/tds-inline-tabs.js +7 -3
- package/dist/components/tds-link.js +17 -3
- package/dist/components/tds-message.js +19 -5
- package/dist/components/tds-modal.js +1 -1
- package/dist/components/tds-navigation-tab.js +21 -2
- package/dist/components/tds-navigation-tabs.js +9 -5
- package/dist/components/tds-popover-canvas.js +1 -1
- package/dist/components/tds-popover-core.js +1 -1
- package/dist/components/tds-popover-menu.js +1 -1
- package/dist/components/tds-side-menu-close-button.js +1 -1
- package/dist/components/tds-side-menu-dropdown.js +1 -1
- package/dist/components/tds-slider.js +1 -1
- package/dist/components/tds-step.js +1 -1
- package/dist/components/tds-table-body-input-wrapper.js +1 -1
- package/dist/components/tds-table-body-row.js +1 -1
- package/dist/components/tds-table-footer.js +4 -4
- package/dist/components/tds-table-header-input-wrapper.js +1 -1
- package/dist/components/tds-table-header.js +1 -1
- package/dist/components/tds-table-toolbar.js +1 -1
- package/dist/components/tds-text-field.js +15 -8
- package/dist/components/tds-textarea.js +4 -4
- package/dist/components/tds-toast.js +5 -5
- package/dist/components/tds-toggle.js +2 -2
- package/dist/components/tds-tooltip.js +18 -7
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tds-banner.entry.js +1 -1
- package/dist/esm/tds-checkbox.entry.js +10 -3
- package/dist/esm/tds-chip.entry.js +7 -2
- package/dist/esm/tds-dropdown_2.entry.js +36 -31
- package/dist/esm/tds-folder-tab.entry.js +22 -3
- package/dist/esm/tds-folder-tabs.entry.js +4 -2
- package/dist/esm/tds-icon.entry.js +1 -1
- package/dist/esm/tds-inline-tab.entry.js +22 -3
- package/dist/esm/tds-inline-tabs.entry.js +4 -2
- package/dist/esm/tds-link.entry.js +17 -3
- package/dist/esm/tds-message.entry.js +15 -3
- package/dist/esm/tds-navigation-tab.entry.js +22 -3
- package/dist/esm/tds-navigation-tabs.entry.js +6 -4
- package/dist/esm/tds-popover-core.entry.js +1 -1
- package/dist/esm/tds-text-field.entry.js +13 -7
- package/dist/esm/tds-textarea.entry.js +3 -3
- package/dist/esm/tds-toast.entry.js +4 -4
- package/dist/esm/tds-toggle.entry.js +2 -2
- package/dist/esm/tds-tooltip.entry.js +14 -4
- package/dist/esm/tegel.js +1 -1
- package/dist/tegel/p-0f2c9507.entry.js +1 -0
- package/dist/tegel/p-22c592eb.entry.js +1 -0
- package/dist/tegel/p-2af57972.entry.js +1 -0
- package/dist/tegel/{p-be1d1345.entry.js → p-4465f687.entry.js} +1 -1
- package/dist/tegel/p-668b7662.entry.js +1 -0
- package/dist/tegel/{p-4e298888.entry.js → p-66f394a2.entry.js} +1 -1
- package/dist/tegel/{p-b35e7208.entry.js → p-727f873f.entry.js} +1 -1
- package/dist/tegel/p-746e2927.entry.js +1 -0
- package/dist/tegel/p-754a4921.entry.js +1 -0
- package/dist/tegel/{p-46205cfb.entry.js → p-769d0503.entry.js} +1 -1
- package/dist/tegel/p-97f10223.entry.js +1 -0
- package/dist/tegel/p-a21250b8.entry.js +1 -0
- package/dist/tegel/p-aadb2553.entry.js +1 -0
- package/dist/tegel/p-b08886e3.entry.js +1 -0
- package/dist/tegel/p-b114ec3d.entry.js +1 -0
- package/dist/tegel/p-c3607f10.entry.js +1 -0
- package/dist/tegel/p-ddda64eb.entry.js +1 -0
- package/dist/tegel/p-eaa279dd.entry.js +1 -0
- package/dist/tegel/p-ee960089.entry.js +1 -0
- package/dist/tegel/tegel.css +13 -3
- package/dist/tegel/tegel.esm.js +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +5 -0
- package/dist/types/components/chip/chip.d.ts +3 -0
- package/dist/types/components/dropdown/dropdown.d.ts +5 -0
- package/dist/types/components/message/message.d.ts +5 -0
- package/dist/types/components/tabs/folder-tabs/folder-tab/folder-tab.d.ts +2 -0
- package/dist/types/components/tabs/folder-tabs/folder-tabs.d.ts +4 -0
- package/dist/types/components/tabs/inline-tabs/inline-tab/inline-tab.d.ts +2 -0
- package/dist/types/components/tabs/inline-tabs/inline-tabs.d.ts +4 -0
- package/dist/types/components/tabs/navigation-tabs/navigation-tab/navigation-tab.d.ts +2 -0
- package/dist/types/components/tabs/navigation-tabs/navigation-tabs.d.ts +4 -0
- package/dist/types/components/text-field/text-field.d.ts +4 -1
- package/dist/types/components/tooltip/tooltip.d.ts +3 -0
- package/dist/types/components.d.ts +114 -2
- package/dist/types/types/Icons.d.ts +1 -1
- package/dist/types/utils/axeHelpers.d.ts +1 -2
- package/package.json +1 -1
- package/dist/components/p-4764a1d5.js +0 -2052
- package/dist/components/p-a2b7bdef.js +0 -65
- package/dist/tegel/p-065d6f83.entry.js +0 -1
- package/dist/tegel/p-0c1e632d.entry.js +0 -1
- package/dist/tegel/p-168122a7.entry.js +0 -1
- package/dist/tegel/p-19eb4ae1.entry.js +0 -1
- package/dist/tegel/p-4e33cbda.entry.js +0 -1
- package/dist/tegel/p-4ee344e5.entry.js +0 -1
- package/dist/tegel/p-64c80f14.entry.js +0 -1
- package/dist/tegel/p-72fd0083.entry.js +0 -1
- package/dist/tegel/p-93a4bd11.entry.js +0 -1
- package/dist/tegel/p-a0fc0cc2.entry.js +0 -1
- package/dist/tegel/p-b6526302.entry.js +0 -1
- package/dist/tegel/p-cca85da0.entry.js +0 -1
- package/dist/tegel/p-d0abf078.entry.js +0 -1
- package/dist/tegel/p-dcbc35af.entry.js +0 -1
- package/dist/tegel/p-f43278f0.entry.js +0 -1
|
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement
|
|
|
2
2
|
import { g as generateUniqueId } from './generateUniqueId-7934d315.js';
|
|
3
3
|
import { h as hasSlot } from './hasSlot-d52114d0.js';
|
|
4
4
|
|
|
5
|
-
const bannerCss = ":host(.hide){display:none;visibility:hidden}:host(.error){background-color:var(--tds-banner-background-error)}:host(.information){background-color:var(--tds-banner-background-info)}:host{display:flex;background-color:var(--tds-banner-background-default);z-index:400;padding-left:16px}:host .banner-icon{padding-left:4px;padding-top:14px;padding-right:12px;color:var(--tds-banner-prefix-default-color)}:host .banner-icon.error{color:var(--tds-banner-prefix-error-color)}:host .banner-icon.information{color:var(--tds-banner-prefix-info-color)}:host .content{color:var(--tds-banner-text-color);display:flex;flex-direction:column;flex-grow:1;padding:16px 0}:host .content.no-icon{padding-left:16px}:host .header-subheader{display:flex;flex-direction:column;gap:4px}:host .header,:host slot[name=header]{font:var(--tds-headline-06);letter-spacing:var(--tds-headline-06-ls)}:host .subheader,:host slot[name=subheader]{display:block;font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls)}:host slot[name=actions]::slotted(*){display:block;width:fit-content;
|
|
5
|
+
const bannerCss = ":host(.hide){display:none;visibility:hidden}:host(.error){background-color:var(--tds-banner-background-error)}:host(.information){background-color:var(--tds-banner-background-info)}:host{display:flex;background-color:var(--tds-banner-background-default);z-index:400;padding-left:16px}:host .banner-icon{padding-left:4px;padding-top:14px;padding-right:12px;color:var(--tds-banner-prefix-default-color)}:host .banner-icon.error{color:var(--tds-banner-prefix-error-color)}:host .banner-icon.information{color:var(--tds-banner-prefix-info-color)}:host .content{color:var(--tds-banner-text-color);display:flex;flex-direction:column;flex-grow:1;padding:16px 0}:host .content.no-icon{padding-left:16px}:host .header-subheader{display:flex;flex-direction:column;gap:4px}:host .header,:host slot[name=header]{font:var(--tds-headline-06);letter-spacing:var(--tds-headline-06-ls)}:host .subheader,:host slot[name=subheader]{display:block;font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls)}:host slot[name=actions]::slotted(*){display:block;width:fit-content;padding-top:12px}:host .banner-close{color:var(--tds-banner-x-color)}:host .banner-close button{padding-right:16px;padding-top:14px;background-color:transparent;border:none;color:var(--tds-banner-x-color)}:host .banner-close button:hover{cursor:pointer}:host .banner-close button:focus-visible{outline:none}:host .banner-close button:focus-visible tds-icon{outline:2px solid var(--tds-blue-400);outline-offset:-2px}";
|
|
6
6
|
const TdsBannerStyle0 = bannerCss;
|
|
7
7
|
|
|
8
8
|
const TdsBanner = class {
|
|
@@ -27,6 +27,8 @@ const TdsCheckbox = class {
|
|
|
27
27
|
this.checked = false;
|
|
28
28
|
this.indeterminate = false;
|
|
29
29
|
this.value = undefined;
|
|
30
|
+
this.tdsAriaLabel = undefined;
|
|
31
|
+
this.tdsAriaDescribedby = undefined;
|
|
30
32
|
}
|
|
31
33
|
/** Toggles the checked value of the component. */
|
|
32
34
|
async toggleCheckbox() {
|
|
@@ -55,12 +57,17 @@ const TdsCheckbox = class {
|
|
|
55
57
|
this.indeterminate = false;
|
|
56
58
|
}
|
|
57
59
|
}
|
|
60
|
+
connectedCallback() {
|
|
61
|
+
if (!this.tdsAriaLabel) {
|
|
62
|
+
console.warn('Tegel Checkbox component: tdsAriaLabel prop is missing');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
58
65
|
render() {
|
|
59
|
-
return (h("div", { key: '
|
|
66
|
+
return (h("div", { key: '26c1c30edd11f3d1dc76beffa496b93841a7dac5', class: "tds-checkbox" }, h("input", { key: 'ebb9d474d9f726248f7a0c9079c5474431d18104',
|
|
60
67
|
// eslint-disable-next-line no-return-assign
|
|
61
|
-
ref: (inputElement) => (this.inputElement = inputElement), indeterminate: this.indeterminate, "aria-checked": this.checked, "aria-required": this.required, "aria-
|
|
68
|
+
ref: (inputElement) => (this.inputElement = inputElement), indeterminate: this.indeterminate, "aria-checked": this.checked, "aria-required": this.required, "aria-label": this.tdsAriaLabel, "aria-describedby": this.tdsAriaDescribedby, required: this.required, type: "checkbox", name: this.name, value: this.value, id: this.checkboxId, checked: this.checked, disabled: this.disabled, onFocus: (event) => this.handleFocus(event), onBlur: (event) => this.handleBlur(event), onChange: () => {
|
|
62
69
|
this.handleChange();
|
|
63
|
-
} }), h("label", { key: '
|
|
70
|
+
} }), h("label", { key: '68e89bdc35cc5f37756cdbde5f563bf64e334310', htmlFor: this.checkboxId }, h("slot", { key: 'f5122194e84705f82c8f148feadfc2787577c346', name: "label" }))));
|
|
64
71
|
}
|
|
65
72
|
get host() { return getElement(this); }
|
|
66
73
|
static get watchers() { return {
|
|
@@ -50,6 +50,7 @@ const TdsChip = class {
|
|
|
50
50
|
this.name = undefined;
|
|
51
51
|
this.value = undefined;
|
|
52
52
|
this.disabled = false;
|
|
53
|
+
this.tdsAriaLabel = undefined;
|
|
53
54
|
}
|
|
54
55
|
handleInternaRadioChange(event) {
|
|
55
56
|
const { chipId, checked, groupName } = event.detail;
|
|
@@ -70,12 +71,16 @@ const TdsChip = class {
|
|
|
70
71
|
}
|
|
71
72
|
return Object.assign(Object.assign({}, commonAttributes), { onClick: () => this.handleClick() });
|
|
72
73
|
}
|
|
74
|
+
connectedCallback() {
|
|
75
|
+
if (!this.tdsAriaLabel) {
|
|
76
|
+
console.warn('Tegel Chip component: tdsAriaLabel prop is missing');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
73
79
|
render() {
|
|
74
80
|
const inputAttributes = this.renderInputAttributes();
|
|
75
81
|
const hasPrefixSlot = hasSlot('prefix', this.host);
|
|
76
82
|
const hasLabelSlot = hasSlot('label', this.host);
|
|
77
83
|
const hasSuffixSlot = hasSlot('suffix', this.host);
|
|
78
|
-
const textInsideLabel = this.host.querySelector(`[slot="label"]`).innerHTML;
|
|
79
84
|
const chipClasses = {
|
|
80
85
|
'tds-chip-component': true,
|
|
81
86
|
'sm': this.size === 'sm',
|
|
@@ -84,7 +89,7 @@ const TdsChip = class {
|
|
|
84
89
|
'suffix': hasSuffixSlot,
|
|
85
90
|
'disabled': this.disabled,
|
|
86
91
|
};
|
|
87
|
-
return (h(Host, { key: '
|
|
92
|
+
return (h(Host, { key: 'c5e27b57accf13ea6af61b6544050b64c16a745c' }, h("div", { key: 'b4f3b429a307cfab3e7dd8356951d19fc5a01293', class: "component" }, h("div", { key: '273c7437e97862fc03c7d93386d07cc425437458', class: chipClasses }, h("input", Object.assign({ key: 'a143b14527b00c255a7205fc86a2473bb8b8c000', type: this.type, id: this.chipId, "aria-checked": this.type === 'button' ? undefined : String(this.checked), role: this.type, "aria-label": this.tdsAriaLabel }, inputAttributes)), h("label", { key: 'a86d26d9f9fe805e84fad6b9c79b24da48efa2f1', onClick: (event) => event.stopPropagation(), htmlFor: this.chipId }, hasPrefixSlot && h("slot", { key: 'ca7e6af86cbac4fc87ac3815fc414f2952d851d0', name: "prefix" }), hasLabelSlot && h("slot", { key: '986cd743afd9f6014cb08e21d5c6c192e579b087', name: "label" }), hasSuffixSlot && h("slot", { key: '1cbbd42853fe0edc52da713f23b9ef3f99d8f4b2', name: "suffix" }))))));
|
|
88
93
|
}
|
|
89
94
|
get host() { return getElement(this); }
|
|
90
95
|
};
|
|
@@ -89,7 +89,7 @@ const TdsDropdown = class {
|
|
|
89
89
|
const defaultValues = this.multiselect
|
|
90
90
|
? this.internalDefaultValue.split(',')
|
|
91
91
|
: [this.internalDefaultValue];
|
|
92
|
-
this.
|
|
92
|
+
this.updateDropdownStateInternal(defaultValues);
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
95
|
this.getChildren = () => {
|
|
@@ -224,6 +224,7 @@ const TdsDropdown = class {
|
|
|
224
224
|
this.noResultText = 'No result';
|
|
225
225
|
this.defaultValue = undefined;
|
|
226
226
|
this.value = null;
|
|
227
|
+
this.tdsAriaLabel = undefined;
|
|
227
228
|
this.open = false;
|
|
228
229
|
this.internalValue = undefined;
|
|
229
230
|
this.filterResult = undefined;
|
|
@@ -232,14 +233,11 @@ const TdsDropdown = class {
|
|
|
232
233
|
this.selectedOptions = [];
|
|
233
234
|
}
|
|
234
235
|
handleValueChange(newValue) {
|
|
235
|
-
console.log('Value changed:', newValue); // Debug
|
|
236
236
|
// Normalize to array
|
|
237
237
|
const normalizedValue = this.normalizeValue(newValue);
|
|
238
|
-
console.log('Normalized value:', normalizedValue); // Debug
|
|
239
238
|
// Only update if actually changed
|
|
240
239
|
if (this.hasValueChanged(normalizedValue, this.selectedOptions)) {
|
|
241
|
-
|
|
242
|
-
this.updateDropdownState(normalizedValue);
|
|
240
|
+
this.updateDropdownStateFromUser(normalizedValue);
|
|
243
241
|
}
|
|
244
242
|
}
|
|
245
243
|
normalizeValue(value) {
|
|
@@ -268,11 +266,15 @@ const TdsDropdown = class {
|
|
|
268
266
|
return true;
|
|
269
267
|
return newValue.some((val) => !currentValue.includes(val));
|
|
270
268
|
}
|
|
271
|
-
|
|
272
|
-
|
|
269
|
+
updateDropdownStateInternal(values) {
|
|
270
|
+
this.updateDropdownState(values, false);
|
|
271
|
+
}
|
|
272
|
+
updateDropdownStateFromUser(values) {
|
|
273
|
+
this.updateDropdownState(values, true);
|
|
274
|
+
}
|
|
275
|
+
updateDropdownState(values, emitChange = true) {
|
|
273
276
|
// Validate the values first
|
|
274
277
|
const validValues = this.validateValues(values);
|
|
275
|
-
console.log('Valid values:', validValues); // Debug
|
|
276
278
|
// Update internal state
|
|
277
279
|
this.selectedOptions = [...validValues];
|
|
278
280
|
// Update the value prop
|
|
@@ -283,8 +285,9 @@ const TdsDropdown = class {
|
|
|
283
285
|
this.updateOptionElements();
|
|
284
286
|
// Update display value
|
|
285
287
|
this.updateDisplayValue();
|
|
286
|
-
// Emit change event
|
|
287
|
-
|
|
288
|
+
// Emit change event only if value has changed by user
|
|
289
|
+
if (emitChange)
|
|
290
|
+
this.emitChange();
|
|
288
291
|
// Update value attribute
|
|
289
292
|
this.setValueAttribute();
|
|
290
293
|
}
|
|
@@ -292,7 +295,7 @@ const TdsDropdown = class {
|
|
|
292
295
|
// Make sure we have children before validation
|
|
293
296
|
const children = this.getChildren();
|
|
294
297
|
if (!children || children.length === 0) {
|
|
295
|
-
console.warn('No dropdown options found');
|
|
298
|
+
console.warn('No dropdown options found');
|
|
296
299
|
return values; // Return original values if no children yet
|
|
297
300
|
}
|
|
298
301
|
return values.filter((val) => {
|
|
@@ -333,18 +336,18 @@ const TdsDropdown = class {
|
|
|
333
336
|
else {
|
|
334
337
|
normalizedValue = [convertToString(value)];
|
|
335
338
|
}
|
|
336
|
-
this.
|
|
339
|
+
this.updateDropdownStateFromUser(normalizedValue);
|
|
337
340
|
return this.getSelectedChildren().map((element) => ({
|
|
338
341
|
value: element.value,
|
|
339
342
|
label: element.textContent.trim(),
|
|
340
343
|
}));
|
|
341
344
|
}
|
|
342
345
|
async reset() {
|
|
343
|
-
this.
|
|
346
|
+
this.updateDropdownStateFromUser([]);
|
|
344
347
|
}
|
|
345
348
|
async removeValue(oldValue) {
|
|
346
349
|
const newValues = this.selectedOptions.filter((v) => v !== oldValue);
|
|
347
|
-
this.
|
|
350
|
+
this.updateDropdownStateFromUser(newValues);
|
|
348
351
|
}
|
|
349
352
|
/** Method that forces focus on the input element. */
|
|
350
353
|
async focusElement() {
|
|
@@ -424,10 +427,8 @@ const TdsDropdown = class {
|
|
|
424
427
|
componentWillLoad() {
|
|
425
428
|
// First handle the value prop if it exists
|
|
426
429
|
if (this.value !== null && this.value !== undefined) {
|
|
427
|
-
console.log('Initial value:', this.value); // Debug
|
|
428
430
|
const normalizedValue = this.normalizeValue(this.value);
|
|
429
|
-
|
|
430
|
-
this.updateDropdownState(normalizedValue);
|
|
431
|
+
this.updateDropdownStateInternal(normalizedValue);
|
|
431
432
|
return; // Exit early if we handled the value prop
|
|
432
433
|
}
|
|
433
434
|
// Only use defaultValue if no value prop was provided
|
|
@@ -436,7 +437,7 @@ const TdsDropdown = class {
|
|
|
436
437
|
const initialValue = this.multiselect
|
|
437
438
|
? defaultValueStr.split(',').map(convertToString)
|
|
438
439
|
: [convertToString(this.defaultValue)];
|
|
439
|
-
this.
|
|
440
|
+
this.updateDropdownStateInternal(initialValue);
|
|
440
441
|
}
|
|
441
442
|
}
|
|
442
443
|
/** Method to handle slot changes */
|
|
@@ -452,10 +453,10 @@ const TdsDropdown = class {
|
|
|
452
453
|
*/
|
|
453
454
|
async appendValue(value) {
|
|
454
455
|
if (this.multiselect) {
|
|
455
|
-
this.
|
|
456
|
+
this.updateDropdownStateFromUser([...this.selectedOptions, value]);
|
|
456
457
|
}
|
|
457
458
|
else {
|
|
458
|
-
this.
|
|
459
|
+
this.updateDropdownStateFromUser([value]);
|
|
459
460
|
}
|
|
460
461
|
}
|
|
461
462
|
componentDidRender() {
|
|
@@ -470,11 +471,16 @@ const TdsDropdown = class {
|
|
|
470
471
|
form.removeEventListener('reset', this.resetInput);
|
|
471
472
|
}
|
|
472
473
|
}
|
|
474
|
+
connectedCallback() {
|
|
475
|
+
if (!this.tdsAriaLabel) {
|
|
476
|
+
console.warn('Tegel Dropdown component: tdsAriaLabel prop is missing');
|
|
477
|
+
}
|
|
478
|
+
}
|
|
473
479
|
render() {
|
|
474
480
|
appendHiddenInput(this.host, this.name, this.selectedOptions.join(','), this.disabled);
|
|
475
|
-
return (h(Host, { key: '
|
|
481
|
+
return (h(Host, { key: 'dbd588020c5f634d489ca464c2a4fd568e9b905a', class: {
|
|
476
482
|
[`tds-mode-variant-${this.modeVariant}`]: Boolean(this.modeVariant),
|
|
477
|
-
} }, this.label && this.labelPosition === 'outside' && (h("div", { key: '
|
|
483
|
+
} }, this.label && this.labelPosition === 'outside' && (h("div", { key: 'e0b7d8efe2206136140695647f7b0656de6f4559', class: `label-outside ${this.disabled ? 'disabled' : ''}` }, this.label)), h("div", { key: 'abc333e48a6ecc7d89f2ddeec0ff587371baf78c', class: {
|
|
478
484
|
'dropdown-select': true,
|
|
479
485
|
[this.size]: true,
|
|
480
486
|
'disabled': this.disabled,
|
|
@@ -487,7 +493,7 @@ const TdsDropdown = class {
|
|
|
487
493
|
label-inside-as-placeholder
|
|
488
494
|
${this.size}
|
|
489
495
|
${this.selectedOptions.length ? 'selected' : ''}
|
|
490
|
-
` }, this.label)), h("input", {
|
|
496
|
+
` }, this.label)), h("input", { "aria-label": this.tdsAriaLabel, "aria-disabled": this.disabled,
|
|
491
497
|
// eslint-disable-next-line no-return-assign
|
|
492
498
|
ref: (inputEl) => (this.inputElement = inputEl), class: {
|
|
493
499
|
placeholder: this.labelPosition === 'inside',
|
|
@@ -501,8 +507,7 @@ const TdsDropdown = class {
|
|
|
501
507
|
if (event.key === 'Escape') {
|
|
502
508
|
this.open = false;
|
|
503
509
|
}
|
|
504
|
-
}
|
|
505
|
-
})), h("tds-icon", { tabIndex: 0, role: "button", "aria-label": "Clear filter", svgTitle: "Clear filter", onClick: this.handleFilterReset, onKeyDown: (event) => {
|
|
510
|
+
} })), h("tds-icon", { tabIndex: 0, role: "button", "aria-label": "Clear filter", svgTitle: "Clear filter", onClick: this.handleFilterReset, onKeyDown: (event) => {
|
|
506
511
|
if (event.key === 'Enter') {
|
|
507
512
|
this.handleFilterReset();
|
|
508
513
|
}
|
|
@@ -513,7 +518,7 @@ const TdsDropdown = class {
|
|
|
513
518
|
if (event.key === 'Enter') {
|
|
514
519
|
this.handleToggleOpen();
|
|
515
520
|
}
|
|
516
|
-
}, class: `menu-icon ${this.open ? 'open' : 'closed'}`, name: "chevron_down", size: "16px" }))) : (h("button", { onClick: () => this.handleToggleOpen(), onKeyDown: (event) => {
|
|
521
|
+
}, class: `menu-icon ${this.open ? 'open' : 'closed'}`, name: "chevron_down", size: "16px" }))) : (h("button", { "aria-label": this.tdsAriaLabel, "aria-disabled": this.disabled, onClick: () => this.handleToggleOpen(), onKeyDown: (event) => {
|
|
517
522
|
if (event.key === 'Escape') {
|
|
518
523
|
this.open = false;
|
|
519
524
|
}
|
|
@@ -525,7 +530,7 @@ const TdsDropdown = class {
|
|
|
525
530
|
label-inside-as-placeholder
|
|
526
531
|
${this.size}
|
|
527
532
|
${this.selectedOptions.length ? 'selected' : ''}
|
|
528
|
-
` }, this.label)), h("div", { class: `placeholder ${this.size}` }, this.selectedOptions.length ? this.getValue() : this.placeholder), h("tds-icon", { "aria-label": "Open/Close dropdown", svgTitle: "Open/Close dropdown", class: `menu-icon ${this.open ? 'open' : 'closed'}`, name: "chevron_down", size: "16px" }))))), h("div", { key: '
|
|
533
|
+
` }, this.label)), h("div", { class: `placeholder ${this.size}` }, this.selectedOptions.length ? this.getValue() : this.placeholder), h("tds-icon", { "aria-label": "Open/Close dropdown", svgTitle: "Open/Close dropdown", class: `menu-icon ${this.open ? 'open' : 'closed'}`, name: "chevron_down", size: "16px" }))))), h("div", { key: 'd83c66bf81a1d2878827d5ed71cdeee73625cbd0', role: "listbox", "aria-label": this.tdsAriaLabel, "aria-orientation": "vertical", "aria-multiselectable": this.multiselect, ref: (element) => {
|
|
529
534
|
this.dropdownList = element;
|
|
530
535
|
}, class: {
|
|
531
536
|
'dropdown-list': true,
|
|
@@ -536,11 +541,11 @@ const TdsDropdown = class {
|
|
|
536
541
|
'closed': !this.open,
|
|
537
542
|
[`animation-enter-${this.animation}`]: this.animation !== 'none' && this.open,
|
|
538
543
|
[`animation-exit-${this.animation}`]: this.animation !== 'none' && !this.open,
|
|
539
|
-
} }, h("slot", { key: '
|
|
544
|
+
} }, h("slot", { key: '0133acc19540fb2ebfd44611fb906b5895d300d6', onSlotchange: () => this.handleSlotChange() }), this.filterResult === 0 && this.noResultText !== '' && (h("div", { key: '3cdf4874c3e5f593850b3238b9f87508ad67c312', class: `no-result ${this.size}` }, this.noResultText))), this.helper && (h("div", { key: 'a51e0a23e67f22427010ee9c965ab7535c46176e', class: {
|
|
540
545
|
helper: true,
|
|
541
546
|
error: this.error,
|
|
542
547
|
disabled: this.disabled,
|
|
543
|
-
} }, this.error && h("tds-icon", { key: '
|
|
548
|
+
} }, this.error && h("tds-icon", { key: '719a9da93ed73509c1a0694d3011f8e304d73cf9', name: "error", size: "16px" }), this.helper))));
|
|
544
549
|
}
|
|
545
550
|
get host() { return getElement(this); }
|
|
546
551
|
static get watchers() { return {
|
|
@@ -635,7 +640,7 @@ const TdsDropdownOption = class {
|
|
|
635
640
|
this.internalValue = convertToString(this.value);
|
|
636
641
|
}
|
|
637
642
|
render() {
|
|
638
|
-
return (h(Host, { key: '
|
|
643
|
+
return (h(Host, { key: 'f471d5238869b3a522b36d99d7549c1229cd83a2' }, h("div", { key: 'da9edccba96999b0ee40f8c599325774593de814', class: `dropdown-option
|
|
639
644
|
${this.size}
|
|
640
645
|
${this.selected ? 'selected' : ''}
|
|
641
646
|
${this.disabled ? 'disabled' : ''}
|
|
@@ -647,7 +652,7 @@ const TdsDropdownOption = class {
|
|
|
647
652
|
this.handleMultiselect(event);
|
|
648
653
|
}, disabled: this.disabled, checked: this.selected, class: {
|
|
649
654
|
[this.size]: true,
|
|
650
|
-
} }, h("div", { slot: "label" }, h("slot", null))))) : (h("button", { onClick: () => {
|
|
655
|
+
} }, h("div", { slot: "label" }, h("slot", null))))) : (h("button", { role: "option", "aria-disabled": this.disabled, "aria-selected": this.selected, onClick: () => {
|
|
651
656
|
this.handleSingleSelect();
|
|
652
657
|
}, onFocus: (event) => this.handleFocus(event), onBlur: (event) => this.handleBlur(event), disabled: this.disabled, class: this.size }, h("div", { class: "single-select" }, h("slot", null), this.selected && h("tds-icon", { name: "tick", size: "16px" })))))));
|
|
653
658
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host } from './index-51d04e39.js';
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement } from './index-51d04e39.js';
|
|
2
2
|
|
|
3
3
|
const folderTabCss = ":host{box-sizing:border-box;position:relative}:host *{box-sizing:border-box}:host ::slotted(*){all:unset;min-width:142px;display:block;width:calc(100% - 32px);font:var(--tds-headline-07) !important;letter-spacing:var(--tds-headline-07-ls) !important;cursor:pointer;padding:16px;white-space:nowrap;text-decoration:none;text-align:left;outline:none;border:none;border-left:1px solid;border-left-color:transparent}:host ::slotted(*:focus-visible){outline:2px solid var(--tds-blue-400);outline-offset:-2px}:host div:not(.selected){background-color:var(--tds-folder-tab-background)}:host div:not(.selected) ::slotted(*){border-left-color:var(--tds-folder-tab-divider-color);border-top:2px solid var(--tds-folder-tab-background);color:var(--tds-folder-tab-item-color)}:host div:not(.selected):hover:not(.disabled){background-color:var(--tds-folder-tab-background-hover);cursor:pointer}:host div:not(.selected):hover:not(.disabled) ::slotted(*){border-top-color:var(--tds-folder-tab-background-hover);color:var(--tds-folder-tab-color)}:host div:not(.selected).disabled ::slotted(*){color:var(--tds-folder-tab-item-color-disabled)}:host div:not(.selected).disabled ::slotted(*:focus-visible){outline:none}:host div:not(.selected).disabled ::slotted(*:hover){cursor:not-allowed}:host div:not(.selected).disabled ::slotted(*::after){content:none}:host .selected{background-color:var(--tds-folder-tab-background-selected);border-top:2px solid var(--tds-folder-tab-border-selected)}:host .selected::after{content:\" \";background-color:var(--tds-folder-tab-background-selected);width:1px;top:0;bottom:0;right:-1px;display:block;position:absolute;z-index:1}:host .selected ::slotted(*){color:var(--tds-folder-tab-color)}:host(.first) :not(.selected) ::slotted(*){border-left-color:transparent}";
|
|
4
4
|
const TdsFolderTabStyle0 = folderTabCss;
|
|
@@ -18,12 +18,31 @@ const TdsFolderTab = class {
|
|
|
18
18
|
async setSelected(selected) {
|
|
19
19
|
this.selected = selected;
|
|
20
20
|
}
|
|
21
|
+
connectedCallback() {
|
|
22
|
+
const elements = this.host.querySelectorAll('button, a');
|
|
23
|
+
for (let index = 0; index < elements.length; index++) {
|
|
24
|
+
const element = elements[index];
|
|
25
|
+
if (!element.getAttribute('aria-controls')) {
|
|
26
|
+
console.warn('Tegel folder-tab component: Interactive elements should have aria-controls attribute to link the tab to its corresponding panel');
|
|
27
|
+
}
|
|
28
|
+
if (element.getAttribute('role') !== 'tab') {
|
|
29
|
+
console.warn('Tegel folder-tab component: Interactive elements should have attribute role="tab"');
|
|
30
|
+
}
|
|
31
|
+
if (this.disabled) {
|
|
32
|
+
element.setAttribute('aria-disabled', 'true');
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
element.removeAttribute('aria-disabled');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
21
39
|
render() {
|
|
22
|
-
return (h(Host, { key: '
|
|
40
|
+
return (h(Host, { key: '9290c4ab2f7d051bba9fec4dad9a7d07790ed5b7', "aria-selected": this.selected }, h("div", { key: '36225101c510f2d77282fd600c4ee00085791109', class: {
|
|
23
41
|
selected: this.selected,
|
|
24
42
|
disabled: this.disabled,
|
|
25
|
-
}, style: { width: `${this.tabWidth}px` } }, h("slot", { key: '
|
|
43
|
+
}, style: { width: `${this.tabWidth}px` } }, h("slot", { key: '05954c498b9fbd6a2a1231d84bf2657a0616db36' }))));
|
|
26
44
|
}
|
|
45
|
+
get host() { return getElement(this); }
|
|
27
46
|
};
|
|
28
47
|
TdsFolderTab.style = TdsFolderTabStyle0;
|
|
29
48
|
|
|
@@ -63,6 +63,8 @@ const TdsFolderTabs = class {
|
|
|
63
63
|
this.modeVariant = null;
|
|
64
64
|
this.defaultSelectedIndex = 0;
|
|
65
65
|
this.selectedIndex = undefined;
|
|
66
|
+
this.tdsScrollLeftAriaLabel = 'Scroll left';
|
|
67
|
+
this.tdsScrollRightAriaLabel = 'Scroll right';
|
|
66
68
|
this.buttonWidth = 0;
|
|
67
69
|
this.showLeftScroll = false;
|
|
68
70
|
this.showRightScroll = false;
|
|
@@ -163,9 +165,9 @@ const TdsFolderTabs = class {
|
|
|
163
165
|
this.removeEventListenerFromTabs();
|
|
164
166
|
}
|
|
165
167
|
render() {
|
|
166
|
-
return (h(Host, { key: '
|
|
168
|
+
return (h(Host, { key: '54a3cceed49387a8f0dbe74eecb96ae284882ff9', role: "tablist", class: `${this.modeVariant ? `tds-mode-variant-${this.modeVariant}` : ''}` }, h("div", { key: '170e5256bde8efdce412bbab1a674b23159d02d1', class: "wrapper", ref: (el) => {
|
|
167
169
|
this.navWrapperElement = el;
|
|
168
|
-
} }, h("button", { key: '
|
|
170
|
+
} }, h("button", { key: '1c74ef8c81361bfa6ff5d227c145a3371fb2f66f', "aria-label": this.tdsScrollLeftAriaLabel, class: `scroll-left-button ${this.showLeftScroll ? 'show' : ''}`, disabled: !this.showLeftScroll, onClick: () => this.scrollLeft() }, h("tds-icon", { key: '94ddd85d4107c89487db727f13a9c443fd160fc6', name: "chevron_left", size: "20px" })), h("slot", { key: '63978c3c62482bc0a251377756630f555f10dfef', onSlotchange: () => this.handleSlotChange() }), h("button", { key: 'aeb86fbdb365e62df37b72daa0b53f51486834a9', "aria-label": this.tdsScrollRightAriaLabel, class: `scroll-right-button ${this.showRightScroll ? 'show' : ''}`, disabled: !this.showRightScroll, onClick: () => this.scrollRight() }, h("tds-icon", { key: '2cc4d301a4490d6b8d8f2373fc2450c93922a814', name: "chevron_right", size: "20px" })))));
|
|
169
171
|
}
|
|
170
172
|
get host() { return getElement(this); }
|
|
171
173
|
static get watchers() { return {
|