@scania/tegel 1.22.0 → 1.23.0-beta.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-chip.cjs.entry.js +13 -1
- package/dist/cjs/tds-dropdown_2.cjs.entry.js +128 -159
- package/dist/cjs/tds-header.cjs.entry.js +1 -1
- package/dist/cjs/tds-icon.cjs.entry.js +1 -1
- package/dist/cjs/tds-popover-core.cjs.entry.js +1 -1
- package/dist/cjs/tds-slider.cjs.entry.js +18 -14
- package/dist/cjs/tds-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/tegel.cjs.js +1 -1
- package/dist/collection/components/banner/banner.js +1 -1
- package/dist/collection/components/chip/chip.js +39 -1
- package/dist/collection/components/dropdown/dropdown.js +200 -209
- package/dist/collection/components/header/header.css +4 -0
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/icon/iconsArray.js +26 -1
- package/dist/collection/components/popover-core/tds-popover-core.css +1 -1
- package/dist/collection/components/slider/slider.js +18 -14
- package/dist/collection/components/tooltip/tooltip.css +5 -0
- package/dist/collection/utils/testConfiguration.js +65 -0
- package/dist/components/p-18c1245b.js +65 -0
- package/dist/components/{p-9411c8ea.js → p-462b77e8.js} +1 -1
- package/dist/components/{p-ad93662a.js → p-c48c68b3.js} +1 -1
- package/dist/components/{p-8bc36666.js → p-ca4b945d.js} +136 -165
- package/dist/components/{p-7f87740b.js → p-dcfecf4d.js} +1 -1
- package/dist/components/{p-3191ad55.js → p-e02b091c.js} +1 -1
- package/dist/components/tds-accordion-item.js +1 -1
- package/dist/components/tds-banner.js +1 -1
- package/dist/components/tds-chip.js +14 -2
- 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-tabs.js +1 -1
- 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-header.js +1 -1
- package/dist/components/tds-icon.js +1 -1
- package/dist/components/tds-inline-tabs.js +1 -1
- package/dist/components/tds-message.js +1 -1
- package/dist/components/tds-modal.js +1 -1
- package/dist/components/tds-navigation-tabs.js +1 -1
- 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 +19 -15
- package/dist/components/tds-step.js +1 -1
- package/dist/components/tds-table-body-input-wrapper.js +1 -1
- package/dist/components/tds-table-footer.js +3 -3
- package/dist/components/tds-table-header-input-wrapper.js +1 -1
- package/dist/components/tds-table-toolbar.js +1 -1
- package/dist/components/tds-text-field.js +1 -1
- package/dist/components/tds-textarea.js +1 -1
- package/dist/components/tds-toast.js +1 -1
- package/dist/components/tds-tooltip.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tds-chip.entry.js +13 -1
- package/dist/esm/tds-dropdown_2.entry.js +128 -159
- package/dist/esm/tds-header.entry.js +1 -1
- package/dist/esm/tds-icon.entry.js +1 -1
- package/dist/esm/tds-popover-core.entry.js +1 -1
- package/dist/esm/tds-slider.entry.js +18 -14
- package/dist/esm/tds-tooltip.entry.js +1 -1
- package/dist/esm/tegel.js +1 -1
- package/dist/tegel/{p-443d8501.entry.js → p-220affa9.entry.js} +1 -1
- package/dist/tegel/{p-89235968.entry.js → p-590b5f55.entry.js} +1 -1
- package/dist/tegel/{p-7cb43ebe.entry.js → p-ac46b0a4.entry.js} +1 -1
- package/dist/tegel/p-e0ce5daa.entry.js +1 -0
- package/dist/tegel/p-e252ba6e.entry.js +1 -0
- package/dist/tegel/p-f91c6e9d.entry.js +1 -0
- package/dist/tegel/p-fc0079d2.entry.js +1 -0
- package/dist/tegel/tegel.css +1 -1
- package/dist/tegel/tegel.esm.js +1 -1
- package/dist/types/components/chip/chip.d.ts +11 -0
- package/dist/types/components/dropdown/dropdown.d.ts +20 -36
- package/dist/types/components.d.ts +26 -11
- package/dist/types/types/Icons.d.ts +1 -1
- package/dist/types/utils/testConfiguration.d.ts +13 -0
- package/package.json +4 -2
- package/dist/components/p-a32f9097.js +0 -65
- package/dist/tegel/p-07825c63.entry.js +0 -1
- package/dist/tegel/p-85d1ec5b.entry.js +0 -1
- package/dist/tegel/p-c64f2fba.entry.js +0 -1
- package/dist/tegel/p-fe9b385f.entry.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, d as createEvent, h, c as Host } from './p-28ef5186.js';
|
|
2
|
-
import { d as defineCustomElement$1 } from './p-
|
|
2
|
+
import { d as defineCustomElement$1 } from './p-18c1245b.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Find the next focusable element index in a list of focusable elements.
|
|
@@ -71,6 +71,14 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
71
71
|
this.tdsFocus = createEvent(this, "tdsFocus", 6);
|
|
72
72
|
this.tdsBlur = createEvent(this, "tdsBlur", 6);
|
|
73
73
|
this.tdsInput = createEvent(this, "tdsInput", 6);
|
|
74
|
+
this.tdsValueChange = createEvent(this, "tdsValueChange", 6);
|
|
75
|
+
this.handleChange = () => {
|
|
76
|
+
const value = Array.isArray(this.value) ? this.value.join(',') : this.value;
|
|
77
|
+
this.tdsChange.emit({
|
|
78
|
+
name: this.name,
|
|
79
|
+
value: value !== null && value !== void 0 ? value : null,
|
|
80
|
+
});
|
|
81
|
+
};
|
|
74
82
|
this.setDefaultOption = () => {
|
|
75
83
|
if (this.defaultValue) {
|
|
76
84
|
const children = Array.from(this.host.children).filter((element) => element.tagName === 'TDS-DROPDOWN-OPTION');
|
|
@@ -99,7 +107,6 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
99
107
|
}
|
|
100
108
|
}
|
|
101
109
|
};
|
|
102
|
-
/* Returns a list of all children that are tds-dropdown-option elements */
|
|
103
110
|
this.getChildren = () => {
|
|
104
111
|
const tdsDropdownOptions = Array.from(this.host.children).filter((element) => element.tagName === 'TDS-DROPDOWN-OPTION');
|
|
105
112
|
if (tdsDropdownOptions.length === 0) {
|
|
@@ -108,6 +115,38 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
108
115
|
else
|
|
109
116
|
return tdsDropdownOptions;
|
|
110
117
|
};
|
|
118
|
+
this.getSelectedChildren = () => {
|
|
119
|
+
if (!this.value)
|
|
120
|
+
return [];
|
|
121
|
+
const valueArray = Array.isArray(this.value) ? this.value : [this.value];
|
|
122
|
+
return valueArray
|
|
123
|
+
.map((stringValue) => {
|
|
124
|
+
const matchingElement = this.getChildren().find((element) => element.value === stringValue);
|
|
125
|
+
return matchingElement;
|
|
126
|
+
})
|
|
127
|
+
.filter(Boolean);
|
|
128
|
+
};
|
|
129
|
+
this.getSelectedChildrenLabels = () => {
|
|
130
|
+
var _a;
|
|
131
|
+
return (_a = this.getSelectedChildren()) === null || _a === void 0 ? void 0 : _a.map((element) => element.textContent.trim());
|
|
132
|
+
};
|
|
133
|
+
this.getValue = () => {
|
|
134
|
+
const labels = this.getSelectedChildrenLabels();
|
|
135
|
+
if (!labels) {
|
|
136
|
+
return '';
|
|
137
|
+
}
|
|
138
|
+
return labels === null || labels === void 0 ? void 0 : labels.join(', ');
|
|
139
|
+
};
|
|
140
|
+
this.setValueAttribute = () => {
|
|
141
|
+
var _a;
|
|
142
|
+
if (!this.value || ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString()) === '') {
|
|
143
|
+
this.host.removeAttribute('value');
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
const valueArray = Array.isArray(this.value) ? this.value : [this.value];
|
|
147
|
+
this.host.setAttribute('value', valueArray.map((val) => val).toString());
|
|
148
|
+
}
|
|
149
|
+
};
|
|
111
150
|
this.getOpenDirection = () => {
|
|
112
151
|
var _a, _b, _c, _d, _e;
|
|
113
152
|
if (this.openDirection === 'auto' || !this.openDirection) {
|
|
@@ -121,7 +160,6 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
121
160
|
}
|
|
122
161
|
return this.openDirection;
|
|
123
162
|
};
|
|
124
|
-
/* Toggles the open state of the Dropdown and sets focus to the input element */
|
|
125
163
|
this.handleToggleOpen = () => {
|
|
126
164
|
if (!this.disabled) {
|
|
127
165
|
this.open = !this.open;
|
|
@@ -130,38 +168,10 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
130
168
|
}
|
|
131
169
|
}
|
|
132
170
|
};
|
|
133
|
-
/* Focuses the input element in the Dropdown, if the reference is present. */
|
|
134
171
|
this.focusInputElement = () => {
|
|
135
172
|
if (this.inputElement)
|
|
136
173
|
this.inputElement.focus();
|
|
137
174
|
};
|
|
138
|
-
this.getSelectedChildren = () => {
|
|
139
|
-
var _a;
|
|
140
|
-
return (_a = this.value) === null || _a === void 0 ? void 0 : _a.map((stringValue) => {
|
|
141
|
-
const matchingElement = this.getChildren().find((element) => element.value === stringValue);
|
|
142
|
-
return matchingElement;
|
|
143
|
-
}).filter(Boolean);
|
|
144
|
-
};
|
|
145
|
-
this.getSelectedChildrenLabels = () => {
|
|
146
|
-
var _a;
|
|
147
|
-
return (_a = this.getSelectedChildren()) === null || _a === void 0 ? void 0 : _a.map((element) => element.textContent.trim());
|
|
148
|
-
};
|
|
149
|
-
this.getValue = () => {
|
|
150
|
-
const labels = this.getSelectedChildrenLabels();
|
|
151
|
-
if (!labels) {
|
|
152
|
-
return '';
|
|
153
|
-
}
|
|
154
|
-
return this.filter ? labels === null || labels === void 0 ? void 0 : labels.join(', ') : labels === null || labels === void 0 ? void 0 : labels.toString();
|
|
155
|
-
};
|
|
156
|
-
this.setValueAttribute = () => {
|
|
157
|
-
var _a;
|
|
158
|
-
if (!this.value || ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString()) === '') {
|
|
159
|
-
this.host.removeAttribute('value');
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
this.host.setAttribute('value', this.value.map((val) => val).toString());
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
175
|
this.handleFilter = (event) => {
|
|
166
176
|
this.tdsInput.emit(event);
|
|
167
177
|
const query = event.target.value.toLowerCase();
|
|
@@ -207,13 +217,6 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
207
217
|
this.handleBlur = (event) => {
|
|
208
218
|
this.tdsBlur.emit(event);
|
|
209
219
|
};
|
|
210
|
-
this.handleChange = () => {
|
|
211
|
-
var _a, _b;
|
|
212
|
-
this.tdsChange.emit({
|
|
213
|
-
name: this.name,
|
|
214
|
-
value: (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.map((value) => value).toString()) !== null && _b !== void 0 ? _b : null,
|
|
215
|
-
});
|
|
216
|
-
};
|
|
217
220
|
this.name = undefined;
|
|
218
221
|
this.disabled = false;
|
|
219
222
|
this.helper = undefined;
|
|
@@ -230,107 +233,92 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
230
233
|
this.normalizeText = true;
|
|
231
234
|
this.noResultText = 'No result';
|
|
232
235
|
this.defaultValue = undefined;
|
|
233
|
-
this.open = false;
|
|
234
236
|
this.value = undefined;
|
|
237
|
+
this.open = false;
|
|
238
|
+
this.internalValue = undefined;
|
|
235
239
|
this.filterResult = undefined;
|
|
236
240
|
this.filterFocus = undefined;
|
|
237
241
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
async focusElement() {
|
|
246
|
-
this.focusInputElement();
|
|
247
|
-
this.handleFocus({});
|
|
248
|
-
}
|
|
249
|
-
/** Method for setting the value of the Dropdown.
|
|
250
|
-
*
|
|
251
|
-
* Single selection example:
|
|
252
|
-
*
|
|
253
|
-
* <code>
|
|
254
|
-
* dropdown.setValue('option-1', 'Option 1');
|
|
255
|
-
* </code>
|
|
256
|
-
*
|
|
257
|
-
* Multiselect example:
|
|
258
|
-
*
|
|
259
|
-
* <code>
|
|
260
|
-
* dropdown.setValue(['option-1', 'option-2']);
|
|
261
|
-
* </code>
|
|
262
|
-
*/
|
|
263
|
-
// The label is optional here ONLY to not break the API. Should be removed for 2.0.
|
|
264
|
-
// @ts-ignore
|
|
265
|
-
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
|
266
|
-
async setValue(value, label) {
|
|
267
|
-
let nextValue;
|
|
268
|
-
if (typeof value === 'string')
|
|
269
|
-
nextValue = [value];
|
|
270
|
-
else
|
|
271
|
-
nextValue = value;
|
|
272
|
-
if (!this.multiselect && nextValue.length > 1) {
|
|
242
|
+
handleValueChange(newValue) {
|
|
243
|
+
if (newValue === undefined)
|
|
244
|
+
return;
|
|
245
|
+
// Ensure consistent internal array representation
|
|
246
|
+
const valueArray = Array.isArray(newValue) ? newValue : newValue ? [newValue] : null;
|
|
247
|
+
// Handle multiselect validation
|
|
248
|
+
if (!this.multiselect && Array.isArray(valueArray) && valueArray.length > 1) {
|
|
273
249
|
console.warn('Tried to select multiple items, but multiselect is not enabled.');
|
|
274
|
-
|
|
250
|
+
// Coerce to single value for non-multiselect
|
|
251
|
+
this.value = valueArray[0];
|
|
252
|
+
return;
|
|
275
253
|
}
|
|
276
|
-
|
|
277
|
-
this.
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
254
|
+
// Ensure value is always array internally for backward compatibility
|
|
255
|
+
this.updateSelections(valueArray);
|
|
256
|
+
this.handleChange();
|
|
257
|
+
}
|
|
258
|
+
updateSelections(valueArray) {
|
|
259
|
+
// Reset current selections
|
|
260
|
+
this.getChildren().forEach((element) => {
|
|
261
|
+
element.setSelected(false);
|
|
262
|
+
});
|
|
263
|
+
if (valueArray) {
|
|
264
|
+
// Validate and filter values
|
|
265
|
+
const validValues = valueArray.filter((val) => {
|
|
266
|
+
const optionExists = this.getChildren().some((element) => element.value === val);
|
|
267
|
+
if (!optionExists) {
|
|
268
|
+
console.warn(`Option with value "${val}" does not exist`);
|
|
269
|
+
}
|
|
270
|
+
return optionExists;
|
|
271
|
+
});
|
|
272
|
+
// Update internal state and selections
|
|
273
|
+
this.internalValue = validValues.join(', ');
|
|
274
|
+
this.getChildren().forEach((element) => {
|
|
275
|
+
if (validValues.includes(element.value)) {
|
|
276
|
+
element.setSelected(true);
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
// Update value prop with validated values
|
|
280
|
+
if (this.multiselect) {
|
|
281
|
+
this.value = validValues;
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
this.value = validValues[0] || null;
|
|
282
285
|
}
|
|
283
286
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
+
else {
|
|
288
|
+
// Handle null/undefined case
|
|
289
|
+
this.internalValue = '';
|
|
290
|
+
this.value = this.multiselect ? [] : null;
|
|
291
|
+
}
|
|
292
|
+
// Emit change events
|
|
287
293
|
this.handleChange();
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
294
|
+
// Update filter input if present
|
|
295
|
+
if (this.filter && this.inputElement) {
|
|
296
|
+
this.inputElement.value = this.internalValue;
|
|
297
|
+
}
|
|
298
|
+
this.setValueAttribute();
|
|
299
|
+
}
|
|
300
|
+
async setValue(value) {
|
|
301
|
+
this.value = value;
|
|
302
|
+
return this.getSelectedChildren().map((element) => ({
|
|
291
303
|
value: element.value,
|
|
292
304
|
label: element.textContent.trim(),
|
|
293
305
|
}));
|
|
294
|
-
// Update inputElement value and placeholder text
|
|
295
|
-
if (this.filter) {
|
|
296
|
-
this.inputElement.value = this.getValue();
|
|
297
|
-
}
|
|
298
|
-
return selection;
|
|
299
306
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
*/
|
|
303
|
-
async appendValue(value) {
|
|
304
|
-
if (this.multiselect && this.value) {
|
|
305
|
-
this.setValue([...this.value, value]);
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
this.setValue(value);
|
|
309
|
-
}
|
|
307
|
+
async reset() {
|
|
308
|
+
this.value = this.multiselect ? [] : null;
|
|
310
309
|
}
|
|
311
|
-
/** Method for removing a selected value in the Dropdown. */
|
|
312
310
|
async removeValue(oldValue) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
if (this.multiselect) {
|
|
316
|
-
(_a = this.getChildren()) === null || _a === void 0 ? void 0 : _a.forEach((element) => {
|
|
317
|
-
var _a;
|
|
318
|
-
if (element.value === oldValue) {
|
|
319
|
-
this.value = (_a = this.value) === null || _a === void 0 ? void 0 : _a.filter((value) => value !== element.value);
|
|
320
|
-
label = element.textContent.trim();
|
|
321
|
-
element.setSelected(false);
|
|
322
|
-
}
|
|
323
|
-
return element;
|
|
324
|
-
});
|
|
311
|
+
if (this.multiselect && Array.isArray(this.value)) {
|
|
312
|
+
this.value = this.value.filter((v) => v !== oldValue);
|
|
325
313
|
}
|
|
326
314
|
else {
|
|
327
|
-
this.
|
|
315
|
+
this.value = null;
|
|
328
316
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
317
|
+
}
|
|
318
|
+
/** Method that forces focus on the input element. */
|
|
319
|
+
async focusElement() {
|
|
320
|
+
this.focusInputElement();
|
|
321
|
+
this.handleFocus({});
|
|
334
322
|
}
|
|
335
323
|
/** Method for closing the Dropdown. */
|
|
336
324
|
async close() {
|
|
@@ -384,6 +372,9 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
384
372
|
}
|
|
385
373
|
}
|
|
386
374
|
componentWillLoad() {
|
|
375
|
+
if (this.defaultValue && !this.value) {
|
|
376
|
+
this.value = this.defaultValue;
|
|
377
|
+
}
|
|
387
378
|
this.setDefaultOption();
|
|
388
379
|
}
|
|
389
380
|
/** Method to handle slot changes */
|
|
@@ -394,34 +385,19 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
394
385
|
normalizeString(text) {
|
|
395
386
|
return this.normalizeText ? text.normalize('NFD').replace(/\p{Diacritic}/gu, '') : text;
|
|
396
387
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
this.setValueAttribute();
|
|
405
|
-
}
|
|
406
|
-
selectChildrenAsSelectedBasedOnSelectionProp() {
|
|
407
|
-
this.getChildren().forEach((element) => {
|
|
408
|
-
this.value.forEach((selection) => {
|
|
409
|
-
if (element.value !== selection) {
|
|
410
|
-
// If not multiselect, we need to unselect all other options.
|
|
411
|
-
if (!this.multiselect) {
|
|
412
|
-
element.setSelected(false);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
else {
|
|
416
|
-
element.setSelected(true);
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
});
|
|
388
|
+
async appendValue(value) {
|
|
389
|
+
if (this.multiselect) {
|
|
390
|
+
this.value = Array.isArray(this.value) ? [...this.value, value] : [value];
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
this.value = value;
|
|
394
|
+
}
|
|
420
395
|
}
|
|
421
396
|
render() {
|
|
422
|
-
var _a, _b, _c
|
|
423
|
-
|
|
424
|
-
|
|
397
|
+
var _a, _b, _c;
|
|
398
|
+
const valueArray = Array.isArray(this.value) ? this.value : this.value ? [this.value] : [];
|
|
399
|
+
appendHiddenInput(this.host, this.name, valueArray.map((value) => value).toString(), this.disabled);
|
|
400
|
+
return (h(Host, { key: '2d1d0d7551c4f5a3197538a21b245b06abb95a5b', role: "select", class: `${this.modeVariant ? `tds-mode-variant-${this.modeVariant}` : ''}` }, this.label && this.labelPosition === 'outside' && (h("div", { key: '44bf815fc834febcf5bf90aeabeb4ff75ca74e0b', class: `label-outside ${this.disabled ? 'disabled' : ''}` }, this.label)), h("div", { key: 'fe8bddaad6f52c6860a8a3b02db796d927553c64', class: `dropdown-select ${this.size} ${this.disabled ? 'disabled' : ''}` }, this.filter ? (h("div", { class: {
|
|
425
401
|
filter: true,
|
|
426
402
|
focus: this.filterFocus,
|
|
427
403
|
disabled: this.disabled,
|
|
@@ -429,7 +405,7 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
429
405
|
} }, h("div", { class: "value-wrapper" }, this.label && this.labelPosition === 'inside' && this.placeholder && (h("div", { class: `label-inside ${this.size}` }, this.label)), this.label && this.labelPosition === 'inside' && !this.placeholder && (h("div", { class: `
|
|
430
406
|
label-inside-as-placeholder
|
|
431
407
|
${this.size}
|
|
432
|
-
${((
|
|
408
|
+
${((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) ? 'selected' : ''}
|
|
433
409
|
` }, this.label)), h("input", {
|
|
434
410
|
// eslint-disable-next-line no-return-assign
|
|
435
411
|
ref: (inputEl) => (this.inputElement = inputEl), class: `${this.labelPosition === 'inside' ? 'placeholder' : ''}`, type: "text", placeholder: this.filterFocus ? '' : this.placeholder, value: this.multiselect && this.filterFocus ? '' : this.getValue(), disabled: this.disabled, onInput: (event) => this.handleFilter(event), onBlur: (event) => {
|
|
@@ -438,15 +414,7 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
438
414
|
this.inputElement.value = this.getValue();
|
|
439
415
|
}
|
|
440
416
|
this.handleBlur(event);
|
|
441
|
-
}, onFocus: (event) => {
|
|
442
|
-
this.open = true;
|
|
443
|
-
this.filterFocus = true;
|
|
444
|
-
if (this.multiselect) {
|
|
445
|
-
this.inputElement.value = '';
|
|
446
|
-
}
|
|
447
|
-
this.handleFocus(event);
|
|
448
|
-
this.handleFilter({ target: { value: '' } });
|
|
449
|
-
}, onKeyDown: (event) => {
|
|
417
|
+
}, onFocus: (event) => this.handleFocus(event), onKeyDown: (event) => {
|
|
450
418
|
if (event.key === 'Escape') {
|
|
451
419
|
this.open = false;
|
|
452
420
|
}
|
|
@@ -470,8 +438,8 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
470
438
|
`, disabled: this.disabled }, h("div", { class: `value-wrapper ${this.size}` }, this.label && this.labelPosition === 'inside' && this.placeholder && (h("div", { class: `label-inside ${this.size}` }, this.label)), this.label && this.labelPosition === 'inside' && !this.placeholder && (h("div", { class: `
|
|
471
439
|
label-inside-as-placeholder
|
|
472
440
|
${this.size}
|
|
473
|
-
${((
|
|
474
|
-
` }, this.label)), h("div", { class: `placeholder ${this.size}` }, ((
|
|
441
|
+
${((_b = this.value) === null || _b === void 0 ? void 0 : _b.length) ? 'selected' : ''}
|
|
442
|
+
` }, this.label)), h("div", { class: `placeholder ${this.size}` }, ((_c = this.value) === null || _c === void 0 ? void 0 : _c.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: '5a725e0e42ada175ff588849debe814f4558f907', ref: (element) => (this.dropdownList = element), class: {
|
|
475
443
|
'dropdown-list': true,
|
|
476
444
|
[this.size]: true,
|
|
477
445
|
[this.getOpenDirection()]: true,
|
|
@@ -480,10 +448,11 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
480
448
|
'closed': !this.open,
|
|
481
449
|
[`animation-enter-${this.animation}`]: this.animation !== 'none' && this.open,
|
|
482
450
|
[`animation-exit-${this.animation}`]: this.animation !== 'none' && !this.open,
|
|
483
|
-
} }, h("slot", { key: '
|
|
451
|
+
} }, h("slot", { key: '7cece8ee2247cf1249719673734408216b1b9ad6', onSlotchange: () => this.handleSlotChange() }), this.filterResult === 0 && this.noResultText !== '' && (h("div", { key: 'c8e1bfb413f6247710b34707e6e86e454b04739c', class: `no-result ${this.size}` }, this.noResultText))), this.helper && (h("div", { key: '90dcb3ed5268866c95f88bb53a9a066451ebc505', class: `helper ${this.error ? 'error' : ''} ${this.disabled ? 'disabled' : ''}` }, this.error && h("tds-icon", { key: 'a216d63de9d7d6011c4bce0ee0b64f6ea90fa4e4', name: "error", size: "16px" }), this.helper))));
|
|
484
452
|
}
|
|
485
453
|
get host() { return this; }
|
|
486
454
|
static get watchers() { return {
|
|
455
|
+
"value": ["handleValueChange"],
|
|
487
456
|
"open": ["handleOpenState"]
|
|
488
457
|
}; }
|
|
489
458
|
static get style() { return TdsDropdownStyle0; }
|
|
@@ -504,17 +473,19 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
504
473
|
"normalizeText": [4, "normalize-text"],
|
|
505
474
|
"noResultText": [1, "no-result-text"],
|
|
506
475
|
"defaultValue": [1, "default-value"],
|
|
476
|
+
"value": [1025],
|
|
507
477
|
"open": [32],
|
|
508
|
-
"
|
|
478
|
+
"internalValue": [32],
|
|
509
479
|
"filterResult": [32],
|
|
510
480
|
"filterFocus": [32],
|
|
511
|
-
"reset": [64],
|
|
512
|
-
"focusElement": [64],
|
|
513
481
|
"setValue": [64],
|
|
514
|
-
"
|
|
482
|
+
"reset": [64],
|
|
515
483
|
"removeValue": [64],
|
|
516
|
-
"
|
|
484
|
+
"focusElement": [64],
|
|
485
|
+
"close": [64],
|
|
486
|
+
"appendValue": [64]
|
|
517
487
|
}, [[9, "mousedown", "onAnyClick"], [0, "keydown", "onKeyDown"]], {
|
|
488
|
+
"value": ["handleValueChange"],
|
|
518
489
|
"open": ["handleOpenState"]
|
|
519
490
|
}]);
|
|
520
491
|
function defineCustomElement() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h, c as Host } from './p-28ef5186.js';
|
|
2
2
|
import { i as inheritAttributes } from './p-3fe9cbbf.js';
|
|
3
|
-
import { d as defineCustomElement$1 } from './p-
|
|
3
|
+
import { d as defineCustomElement$1 } from './p-e02b091c.js';
|
|
4
4
|
|
|
5
5
|
const popoverCanvasCss = ".tds-popover-canvas.sc-tds-popover-canvas{box-sizing:border-box;display:inline-block;color:var(--tds-popover-canvas-color);background-color:var(--tds-popover-canvas-background);box-shadow:0 3px 3px rgba(0, 0, 0, 0.15), 0 -1px 1px rgba(0, 0, 0, 0.1);border-radius:4px;z-index:900}.tds-popover-canvas.sc-tds-popover-canvas *.sc-tds-popover-canvas{box-sizing:border-box}";
|
|
6
6
|
const TdsPopoverCanvasStyle0 = popoverCanvasCss;
|