@scania/tegel 1.23.0-fix-form-components-slider-reset-beta.2 → 1.23.0-value-prop.beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/tds-checkbox.cjs.entry.js +9 -2
- package/dist/cjs/tds-dropdown_2.cjs.entry.js +146 -158
- package/dist/cjs/tegel.cjs.js +1 -1
- package/dist/collection/components/checkbox/checkbox.js +19 -3
- package/dist/collection/components/dropdown/dropdown.js +218 -208
- package/dist/components/{p-2523819c.js → p-097af62b.js} +153 -163
- package/dist/components/{p-e4d7c655.js → p-d921fe75.js} +10 -3
- package/dist/components/{p-462b77e8.js → p-e7868876.js} +1 -1
- package/dist/components/tds-checkbox.js +1 -1
- package/dist/components/tds-dropdown-option.js +1 -1
- package/dist/components/tds-dropdown.js +1 -1
- package/dist/components/tds-table-body-row.js +1 -1
- package/dist/components/tds-table-footer.js +3 -3
- package/dist/components/tds-table-header.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tds-checkbox.entry.js +9 -2
- package/dist/esm/tds-dropdown_2.entry.js +146 -158
- package/dist/esm/tegel.js +1 -1
- package/dist/tegel/p-6a52ed63.entry.js +1 -0
- package/dist/tegel/p-a0925278.entry.js +1 -0
- package/dist/tegel/tegel.esm.js +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +2 -0
- package/dist/types/components/dropdown/dropdown.d.ts +23 -36
- package/dist/types/components.d.ts +21 -11
- package/package.json +1 -1
- package/dist/tegel/p-979f5255.entry.js +0 -1
- package/dist/tegel/p-a464920f.entry.js +0 -1
|
@@ -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 labels === null || labels === void 0 ? void 0 : labels.join(', ');
|
|
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,12 +217,11 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
207
217
|
this.handleBlur = (event) => {
|
|
208
218
|
this.tdsBlur.emit(event);
|
|
209
219
|
};
|
|
210
|
-
this.
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
});
|
|
220
|
+
this.resetInput = () => {
|
|
221
|
+
const inputEl = this.host.querySelector('input');
|
|
222
|
+
if (inputEl) {
|
|
223
|
+
this.reset();
|
|
224
|
+
}
|
|
216
225
|
};
|
|
217
226
|
this.name = undefined;
|
|
218
227
|
this.disabled = false;
|
|
@@ -230,107 +239,93 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
230
239
|
this.normalizeText = true;
|
|
231
240
|
this.noResultText = 'No result';
|
|
232
241
|
this.defaultValue = undefined;
|
|
233
|
-
this.open = false;
|
|
234
242
|
this.value = undefined;
|
|
243
|
+
this.open = false;
|
|
244
|
+
this.internalValue = undefined;
|
|
235
245
|
this.filterResult = undefined;
|
|
236
246
|
this.filterFocus = undefined;
|
|
237
247
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
this.
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
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) {
|
|
273
|
-
console.warn('Tried to select multiple items, but multiselect is not enabled.');
|
|
274
|
-
nextValue = [nextValue[0]];
|
|
248
|
+
handleValueChange(newValue) {
|
|
249
|
+
// Convert both newValue and this.value to arrays for comparison
|
|
250
|
+
const newValueArray = Array.isArray(newValue) ? newValue : newValue ? [newValue] : [];
|
|
251
|
+
const currentValueArray = Array.isArray(this.value)
|
|
252
|
+
? this.value
|
|
253
|
+
: this.value
|
|
254
|
+
? [this.value]
|
|
255
|
+
: [];
|
|
256
|
+
// Check if the new value is different from the current value
|
|
257
|
+
const hasChanged = newValueArray.length !== currentValueArray.length ||
|
|
258
|
+
newValueArray.some((val, index) => val !== currentValueArray[index]);
|
|
259
|
+
if (hasChanged) {
|
|
260
|
+
// Proceed with updating selections and emitting changes
|
|
261
|
+
this.updateSelections(newValueArray);
|
|
262
|
+
this.handleChange();
|
|
275
263
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
264
|
+
}
|
|
265
|
+
updateSelections(valueArray) {
|
|
266
|
+
// Reset current selections
|
|
267
|
+
this.getChildren().forEach((element) => {
|
|
268
|
+
element.setSelected(false);
|
|
269
|
+
});
|
|
270
|
+
if (valueArray) {
|
|
271
|
+
// Validate and filter values
|
|
272
|
+
const validValues = valueArray.filter((val) => {
|
|
273
|
+
const optionExists = this.getChildren().some((element) => element.value === val);
|
|
274
|
+
if (!optionExists) {
|
|
275
|
+
console.warn(`Option with value "${val}" does not exist`);
|
|
276
|
+
}
|
|
277
|
+
return optionExists;
|
|
278
|
+
});
|
|
279
|
+
// Update internal state and selections
|
|
280
|
+
this.internalValue = validValues.join(', ');
|
|
281
|
+
this.getChildren().forEach((element) => {
|
|
282
|
+
if (validValues.includes(element.value)) {
|
|
283
|
+
element.setSelected(true);
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
// Update value prop with validated values
|
|
287
|
+
if (this.multiselect) {
|
|
288
|
+
this.value = validValues;
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
this.value = validValues[0] || null;
|
|
282
292
|
}
|
|
283
293
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
294
|
+
else {
|
|
295
|
+
// Handle null/undefined case
|
|
296
|
+
this.internalValue = '';
|
|
297
|
+
this.value = this.multiselect ? [] : null;
|
|
298
|
+
}
|
|
299
|
+
// Emit change events
|
|
287
300
|
this.handleChange();
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
301
|
+
// Update filter input if present
|
|
302
|
+
if (this.filter && this.inputElement) {
|
|
303
|
+
this.inputElement.value = this.internalValue;
|
|
304
|
+
}
|
|
305
|
+
this.setValueAttribute();
|
|
306
|
+
}
|
|
307
|
+
async setValue(value) {
|
|
308
|
+
this.value = value;
|
|
309
|
+
return this.getSelectedChildren().map((element) => ({
|
|
291
310
|
value: element.value,
|
|
292
311
|
label: element.textContent.trim(),
|
|
293
312
|
}));
|
|
294
|
-
// Update inputElement value and placeholder text
|
|
295
|
-
if (this.filter) {
|
|
296
|
-
this.inputElement.value = this.getValue();
|
|
297
|
-
}
|
|
298
|
-
return selection;
|
|
299
313
|
}
|
|
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
|
-
}
|
|
314
|
+
async reset() {
|
|
315
|
+
this.value = this.multiselect ? [] : null;
|
|
310
316
|
}
|
|
311
|
-
/** Method for removing a selected value in the Dropdown. */
|
|
312
317
|
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
|
-
});
|
|
318
|
+
if (this.multiselect && Array.isArray(this.value)) {
|
|
319
|
+
this.value = this.value.filter((v) => v !== oldValue);
|
|
325
320
|
}
|
|
326
321
|
else {
|
|
327
|
-
this.
|
|
322
|
+
this.value = null;
|
|
328
323
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
324
|
+
}
|
|
325
|
+
/** Method that forces focus on the input element. */
|
|
326
|
+
async focusElement() {
|
|
327
|
+
this.focusInputElement();
|
|
328
|
+
this.handleFocus({});
|
|
334
329
|
}
|
|
335
330
|
/** Method for closing the Dropdown. */
|
|
336
331
|
async close() {
|
|
@@ -384,6 +379,9 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
384
379
|
}
|
|
385
380
|
}
|
|
386
381
|
componentWillLoad() {
|
|
382
|
+
if (this.defaultValue && !this.value) {
|
|
383
|
+
this.value = this.defaultValue;
|
|
384
|
+
}
|
|
387
385
|
this.setDefaultOption();
|
|
388
386
|
}
|
|
389
387
|
/** Method to handle slot changes */
|
|
@@ -394,34 +392,31 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
394
392
|
normalizeString(text) {
|
|
395
393
|
return this.normalizeText ? text.normalize('NFD').replace(/\p{Diacritic}/gu, '') : text;
|
|
396
394
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
this.setValueAttribute();
|
|
395
|
+
async appendValue(value) {
|
|
396
|
+
if (this.multiselect) {
|
|
397
|
+
this.value = Array.isArray(this.value) ? [...this.value, value] : [value];
|
|
398
|
+
}
|
|
399
|
+
else {
|
|
400
|
+
this.value = value;
|
|
401
|
+
}
|
|
405
402
|
}
|
|
406
|
-
|
|
407
|
-
this.
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
});
|
|
403
|
+
componentDidRender() {
|
|
404
|
+
const form = this.host.closest('form');
|
|
405
|
+
if (form) {
|
|
406
|
+
form.addEventListener('reset', this.resetInput);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
disconnectedCallback() {
|
|
410
|
+
const form = this.host.closest('form');
|
|
411
|
+
if (form) {
|
|
412
|
+
form.removeEventListener('reset', this.resetInput);
|
|
413
|
+
}
|
|
420
414
|
}
|
|
421
415
|
render() {
|
|
422
|
-
var _a, _b, _c
|
|
423
|
-
|
|
424
|
-
|
|
416
|
+
var _a, _b, _c;
|
|
417
|
+
const valueArray = Array.isArray(this.value) ? this.value : this.value ? [this.value] : [];
|
|
418
|
+
appendHiddenInput(this.host, this.name, valueArray.map((value) => value).toString(), this.disabled);
|
|
419
|
+
return (h(Host, { key: '65dc50a4788d2fdade55db41bfc6cdfcad76b7d5', role: "select", class: `${this.modeVariant ? `tds-mode-variant-${this.modeVariant}` : ''}` }, this.label && this.labelPosition === 'outside' && (h("div", { key: '389e82159e7756782fc12af15d7efb43d8cfeafb', class: `label-outside ${this.disabled ? 'disabled' : ''}` }, this.label)), h("div", { key: 'e7e4585e630ebbab3ae178bbe7b0d3eb0793ba60', class: `dropdown-select ${this.size} ${this.disabled ? 'disabled' : ''}` }, this.filter ? (h("div", { class: {
|
|
425
420
|
filter: true,
|
|
426
421
|
focus: this.filterFocus,
|
|
427
422
|
disabled: this.disabled,
|
|
@@ -429,7 +424,7 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
429
424
|
} }, 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
425
|
label-inside-as-placeholder
|
|
431
426
|
${this.size}
|
|
432
|
-
${((
|
|
427
|
+
${((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) ? 'selected' : ''}
|
|
433
428
|
` }, this.label)), h("input", {
|
|
434
429
|
// eslint-disable-next-line no-return-assign
|
|
435
430
|
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 +433,7 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
438
433
|
this.inputElement.value = this.getValue();
|
|
439
434
|
}
|
|
440
435
|
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) => {
|
|
436
|
+
}, onFocus: (event) => this.handleFocus(event), onKeyDown: (event) => {
|
|
450
437
|
if (event.key === 'Escape') {
|
|
451
438
|
this.open = false;
|
|
452
439
|
}
|
|
@@ -470,8 +457,8 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
470
457
|
`, 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
458
|
label-inside-as-placeholder
|
|
472
459
|
${this.size}
|
|
473
|
-
${((
|
|
474
|
-
` }, this.label)), h("div", { class: `placeholder ${this.size}` }, ((
|
|
460
|
+
${((_b = this.value) === null || _b === void 0 ? void 0 : _b.length) ? 'selected' : ''}
|
|
461
|
+
` }, 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: 'c79561725649f2cda46d13e7290ec0ea698f930e', ref: (element) => (this.dropdownList = element), class: {
|
|
475
462
|
'dropdown-list': true,
|
|
476
463
|
[this.size]: true,
|
|
477
464
|
[this.getOpenDirection()]: true,
|
|
@@ -480,10 +467,11 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
480
467
|
'closed': !this.open,
|
|
481
468
|
[`animation-enter-${this.animation}`]: this.animation !== 'none' && this.open,
|
|
482
469
|
[`animation-exit-${this.animation}`]: this.animation !== 'none' && !this.open,
|
|
483
|
-
} }, h("slot", { key: '
|
|
470
|
+
} }, h("slot", { key: '958aa0e620a825c8d20ec4cfeae334c3c59e85dc', onSlotchange: () => this.handleSlotChange() }), this.filterResult === 0 && this.noResultText !== '' && (h("div", { key: '8138e3340cd62d46ea8938b2d9f0609c03951a1f', class: `no-result ${this.size}` }, this.noResultText))), this.helper && (h("div", { key: '3e7a1e9e8520eadc5b805d5512c6fbe177d69755', class: `helper ${this.error ? 'error' : ''} ${this.disabled ? 'disabled' : ''}` }, this.error && h("tds-icon", { key: '882c2152620d7d7c2ad576db12ecd65d04446600', name: "error", size: "16px" }), this.helper))));
|
|
484
471
|
}
|
|
485
472
|
get host() { return this; }
|
|
486
473
|
static get watchers() { return {
|
|
474
|
+
"value": ["handleValueChange"],
|
|
487
475
|
"open": ["handleOpenState"]
|
|
488
476
|
}; }
|
|
489
477
|
static get style() { return TdsDropdownStyle0; }
|
|
@@ -504,17 +492,19 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
504
492
|
"normalizeText": [4, "normalize-text"],
|
|
505
493
|
"noResultText": [1, "no-result-text"],
|
|
506
494
|
"defaultValue": [1, "default-value"],
|
|
495
|
+
"value": [1025],
|
|
507
496
|
"open": [32],
|
|
508
|
-
"
|
|
497
|
+
"internalValue": [32],
|
|
509
498
|
"filterResult": [32],
|
|
510
499
|
"filterFocus": [32],
|
|
511
|
-
"reset": [64],
|
|
512
|
-
"focusElement": [64],
|
|
513
500
|
"setValue": [64],
|
|
514
|
-
"
|
|
501
|
+
"reset": [64],
|
|
515
502
|
"removeValue": [64],
|
|
516
|
-
"
|
|
503
|
+
"focusElement": [64],
|
|
504
|
+
"close": [64],
|
|
505
|
+
"appendValue": [64]
|
|
517
506
|
}, [[9, "mousedown", "onAnyClick"], [0, "keydown", "onKeyDown"]], {
|
|
507
|
+
"value": ["handleValueChange"],
|
|
518
508
|
"open": ["handleOpenState"]
|
|
519
509
|
}]);
|
|
520
510
|
function defineCustomElement() {
|
|
@@ -49,12 +49,19 @@ const TdsCheckbox = /*@__PURE__*/ proxyCustomElement(class TdsCheckbox extends H
|
|
|
49
49
|
handleBlur(event) {
|
|
50
50
|
this.tdsBlur.emit(event);
|
|
51
51
|
}
|
|
52
|
+
/** Listens for a reset event inside a form */
|
|
53
|
+
handleFormReset(event) {
|
|
54
|
+
if (this.host.closest('form') === event.target) {
|
|
55
|
+
this.checked = false;
|
|
56
|
+
this.indeterminate = false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
52
59
|
render() {
|
|
53
|
-
return (h("div", { key: '
|
|
60
|
+
return (h("div", { key: '068b73081ab2b1b24d58fd2afd70f2b0e4308745', class: "tds-checkbox" }, h("input", { key: '97bd225b10dea56b8166ce3d5c2e4569a7dc76f9',
|
|
54
61
|
// eslint-disable-next-line no-return-assign
|
|
55
62
|
ref: (inputElement) => (this.inputElement = inputElement), indeterminate: this.indeterminate, "aria-checked": this.checked, "aria-required": this.required, "aria-describedby": this.host.getAttribute('aria-describedby'), "aria-labelledby": this.host.getAttribute('aria-labelledby'), 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: () => {
|
|
56
63
|
this.handleChange();
|
|
57
|
-
} }), h("label", { key: '
|
|
64
|
+
} }), h("label", { key: '9cfe0411c9b26d12229de7fdb9421b333da0199c', htmlFor: this.checkboxId }, h("slot", { key: '17d2e45ddf05aa409926f3df82caab7a4f110b72', name: "label" }))));
|
|
58
65
|
}
|
|
59
66
|
get host() { return this; }
|
|
60
67
|
static get watchers() { return {
|
|
@@ -70,7 +77,7 @@ const TdsCheckbox = /*@__PURE__*/ proxyCustomElement(class TdsCheckbox extends H
|
|
|
70
77
|
"indeterminate": [1028],
|
|
71
78
|
"value": [1],
|
|
72
79
|
"toggleCheckbox": [64]
|
|
73
|
-
},
|
|
80
|
+
}, [[4, "reset", "handleFormReset"]], {
|
|
74
81
|
"indeterminate": ["handleIndeterminateState"]
|
|
75
82
|
}]);
|
|
76
83
|
function defineCustomElement() {
|
|
@@ -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$2 } from './p-
|
|
2
|
+
import { d as defineCustomElement$2 } from './p-d921fe75.js';
|
|
3
3
|
import { d as defineCustomElement$1 } from './p-18c1245b.js';
|
|
4
4
|
|
|
5
5
|
const dropdownOptionCss = ":host{box-sizing:border-box;display:block;background-color:var(--tds-dropdown-option-background)}:host *{box-sizing:border-box}:host .dropdown-option{color:var(--tds-dropdown-option-color);border-bottom:1px solid var(--tds-dropdown-option-border);font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls);overflow-wrap:anywhere;transition:background-color var(--tds-motion-duration-fast-02) var(--tds-motion-easing-scania)}:host .dropdown-option.selected{background-color:var(--tds-dropdown-option-background-selected)}:host .dropdown-option.disabled{color:var(--tds-dropdown-option-color-disabled)}:host .dropdown-option button:focus{outline:2px solid var(--tds-blue-400);outline-offset:-2px}:host .dropdown-option button{all:unset;width:100%}:host .dropdown-option button.lg{padding:19px 0 20px}:host .dropdown-option button.md{padding:15px 0 16px}:host .dropdown-option button.sm{padding:11px 0 12px}:host .dropdown-option button.xs{padding:7px 0 8px}:host .dropdown-option button .single-select{display:flex;align-items:center;justify-content:space-between;padding:0 16px}:host .dropdown-option .multiselect{width:100%;height:100%}:host .dropdown-option .multiselect tds-checkbox{display:flex;height:100%;width:100%}:host .dropdown-option .multiselect tds-checkbox.lg{padding:15px 16px 16px}:host .dropdown-option .multiselect tds-checkbox.md{padding:11px 16px 12px}:host .dropdown-option .multiselect tds-checkbox.sm{padding:7px 16px 8px}:host .dropdown-option .multiselect tds-checkbox.xs{padding:7px 16px 8px}:host .dropdown-option:hover{background-color:var(--tds-dropdown-option-background-hover);cursor:pointer}:host .dropdown-option:hover.disabled{background-color:var(--tds-dropdown-option-background);cursor:not-allowed}:host([hidden]){display:none}";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TdsDropdownOption$1, d as defineCustomElement$1 } from './p-
|
|
1
|
+
import { T as TdsDropdownOption$1, d as defineCustomElement$1 } from './p-e7868876.js';
|
|
2
2
|
|
|
3
3
|
const TdsDropdownOption = TdsDropdownOption$1;
|
|
4
4
|
const defineCustomElement = defineCustomElement$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$2 } from './p-
|
|
2
|
+
import { d as defineCustomElement$2 } from './p-d921fe75.js';
|
|
3
3
|
|
|
4
4
|
const tableBodyRowCss = ":host(.tds-table__row){box-sizing:border-box;display:table-row;border-bottom:1px solid var(--tds-table-divider);background-color:var(--tds-table-body-row-background);transition:background-color 200ms ease;color:var(--tds-table-color)}:host(.tds-table__row) *{box-sizing:border-box}:host(.tds-table__row) .tds-table__body-cell--checkbox{min-width:48px;width:48px;padding:0}:host(.tds-table__row:hover){background-color:var(--tds-table-body-row-background-hover)}:host(.tds-table__row--selected){background-color:var(--tds-table-body-row-background-selected)}:host(.tds-table__row--selected:hover){background-color:var(--tds-table-body-row-background-selected-hover)}:host(.tds-table__row--hidden){display:none}:host(.tds-table__row--expended){width:100%;background-color:pink}:host .tds-form-label--table{width:100%;height:48px;display:flex;justify-content:center;align-items:center;cursor:pointer}:host(.tds-table__compact) .tds-form-label--table{height:32px}:host(.tds-table--divider) .tds-table__body-cell--checkbox{border-right:1px solid var(--tds-table-divider)}:host(.tds-table__row--clickable){cursor:pointer}:host(.tds-table__row--clickable:focus-visible){outline:var(--focus-outline, 2px solid blue)}";
|
|
5
5
|
const TdsTableBodyRowStyle0 = tableBodyRowCss;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, d as createEvent, h, c as Host } from './p-28ef5186.js';
|
|
2
|
-
import { d as defineCustomElement$5 } from './p-
|
|
3
|
-
import { d as defineCustomElement$4 } from './p-
|
|
4
|
-
import { d as defineCustomElement$3 } from './p-
|
|
2
|
+
import { d as defineCustomElement$5 } from './p-d921fe75.js';
|
|
3
|
+
import { d as defineCustomElement$4 } from './p-097af62b.js';
|
|
4
|
+
import { d as defineCustomElement$3 } from './p-e7868876.js';
|
|
5
5
|
import { d as defineCustomElement$2 } from './p-18c1245b.js';
|
|
6
6
|
|
|
7
7
|
const tableFooterCss = ":host{box-sizing:border-box;display:table-footer-group;height:var(--tds-spacing-element-48)}:host *{box-sizing:border-box}:host .tds-table__footer-row{background-color:var(--tds-table-footer-background);color:var(--tds-table-color)}:host .tds-table__footer-cell{padding:0 var(--tds-spacing-element-16)}:host .tds-table__footer-cell .tds-table__pagination{height:var(--tds-spacing-element-48);display:flex;align-items:center;justify-content:space-between}:host .tds-table__footer-cell .tds-table__pagination .tds-table__row-selector,:host .tds-table__footer-cell .tds-table__pagination .tds-table__page-selector{display:flex;align-items:center}:host .tds-table__footer-cell .tds-table__pagination .tds-table__row-selector .rows-per-page,:host .tds-table__footer-cell .tds-table__pagination .tds-table__page-selector .rows-per-page{display:flex;align-items:center;margin-right:var(--tds-spacing-element-16)}:host .tds-table__footer-cell .tds-table__pagination .tds-table__row-selector .rows-per-page p,:host .tds-table__footer-cell .tds-table__pagination .tds-table__page-selector .rows-per-page p{margin-right:var(--tds-spacing-element-8)}:host .tds-table__footer-cell .tds-table__pagination .tds-table__page-selector-input{font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls);background-color:var(--tds-table-footer-page-selector-input-background);color:var(--tds-table-color);width:74px;height:30px;border:none;border-radius:var(--tds-spacing-element-4);transition:background-color 250ms ease;margin-right:var(--tds-spacing-element-4);padding-left:var(--tds-spacing-element-16)}:host .tds-table__footer-cell .tds-table__pagination .tds-table__page-selector-input:hover{background-color:var(--tds-table-footer-page-selector-input-background-hover)}:host .tds-table__footer-cell .tds-table__pagination .tds-table__page-selector-input:disabled{color:var(--tds-table-footer-page-selector-input-color-disabled)}:host .tds-table__footer-cell .tds-table__pagination .tds-table__page-selector-input--shake{animation:tds-shake-animation 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;transform:translate3d(0, 0, 0);backface-visibility:hidden;perspective:1000px}:host .tds-table__footer-cell .tds-table__pagination .tds-table__footer-text{font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls);padding:1px 8px 0 0}:host .tds-table__footer-cell .tds-table__pagination .tds-table__footer-btn{display:flex;justify-content:center;align-items:center;border:none;background-color:transparent;cursor:pointer;height:var(--tds-spacing-element-32);width:var(--tds-spacing-element-32);border-radius:var(--tds-spacing-element-4);transition:background-color 250ms ease;color:var(--tds-table-footer-page-selector-icon)}:host .tds-table__footer-cell .tds-table__pagination .tds-table__footer-btn:hover{background-color:var(--tds-table-footer-btn-hover)}:host .tds-table__footer-cell .tds-table__pagination .tds-table__footer-btn:disabled{cursor:default;color:var(--tds-table-footer-page-selector-icon-disabled)}:host .tds-table__footer-cell .tds-table__pagination .tds-table__footer-btn:disabled:hover{background-color:transparent}:host .tds-table__footer-cell .tds-table__pagination .tds-table__footer-btn-svg{height:var(--tds-spacing-element-20);width:var(--tds-spacing-element-20);fill:var(--tds-table-color)}:host(.tds-table--compact){height:var(--tds-spacing-element-32)}:host(.tds-table--compact) .tds-table__footer-cell .tds-table__pagination{height:var(--tds-spacing-element-32)}:host(.tds-table--compact) .tds-table__footer-cell .tds-table__pagination .tds-table__page-selector-input{height:var(--tds-spacing-element-24)}:host(.tds-table--compact) .tds-table__footer-cell .tds-table__pagination .tds-table__footer-btn{height:28px;width:28px}:host(.footer__horizontal-scroll){display:inline-table;position:absolute;margin-top:10px}@keyframes tds-shake-animation{10%,90%{transform:translate3d(-1px, 0, 0)}20%,80%{transform:translate3d(2px, 0, 0)}30%,50%,70%{transform:translate3d(-4px, 0, 0)}40%,60%{transform:translate3d(4px, 0, 0)}}tds-dropdown:focus-within::after{content:\"\";position:absolute;bottom:0;left:0;height:100%;width:100%;background-color:transparent;border-radius:var(--tds-spacing-element-4);pointer-events:none;outline:2px solid var(--tds-blue-400);outline-offset:-2px}";
|
|
@@ -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$2 } from './p-
|
|
2
|
+
import { d as defineCustomElement$2 } from './p-d921fe75.js';
|
|
3
3
|
|
|
4
4
|
const tableHeaderCss = ":host{box-sizing:border-box;display:table-header-group}:host *{box-sizing:border-box}:host .tds-table__header-cell--checkbox{font:var(--tds-headline-07);letter-spacing:var(--tds-headline-07-ls);display:table-cell;text-align:left;color:var(--tds-table-color);background-color:var(--tds-table-header-background);border-bottom:1px solid var(--tds-table-divider);height:48px;box-sizing:border-box;overflow:hidden;transition:background-color 200ms ease;min-width:unset;width:48px;padding:0;border-top-left-radius:4px}:host .tds-form-label--table{width:100%;height:48px;display:flex;justify-content:center;align-items:center;cursor:pointer}:host .tds-table__expand-control-container{display:flex;justify-content:center;align-items:center;height:48px;cursor:pointer}:host .tds-table__expand-control-container .tds-table__expand-input{display:none}:host .tds-table__expand-control-container .tds-expandable-row-icon{height:20px;width:20px;transition:transform 200ms ease;transform:rotate(0)}:host .tds-table__expand-control-container .tds-expandable-row-icon--opened{transform:rotate(180deg)}:host ::slotted(tds-header-cell:hover){background-color:var(--tds-table-header-background-hover)}:host(.tds-table--compact) .tds-table__header-cell--checkbox{height:32px}:host(.tds-table--compact) .tds-form-label--table{height:32px}:host(.tds-table--divider) .tds-table__header-cell--checkbox{border-right:1px solid var(--tds-table-divider)}:host(.tds-table--toolbar-available) .tds-table__header-cell--checkbox{border-top-left-radius:0}";
|
|
5
5
|
const TdsTableHeaderStyle0 = tableHeaderCss;
|