@scania/tegel 1.21.1 → 1.22.0-feat-dropdown-allow-numbers-testing-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-button.cjs.entry.js +5 -3
- package/dist/cjs/tds-dropdown_2.cjs.entry.js +26 -12
- package/dist/cjs/tds-header-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/tds-icon.cjs.entry.js +1 -1
- package/dist/cjs/tds-popover-canvas.cjs.entry.js +3 -2
- package/dist/cjs/tds-popover-core.cjs.entry.js +44 -6
- package/dist/cjs/tds-popover-menu-item.cjs.entry.js +1 -1
- package/dist/cjs/tds-popover-menu.cjs.entry.js +3 -2
- package/dist/cjs/tds-slider.cjs.entry.js +25 -16
- package/dist/cjs/tds-text-field.cjs.entry.js +12 -6
- package/dist/cjs/tds-toggle.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/button/button.css +3 -0
- package/dist/collection/components/button/button.js +22 -2
- package/dist/collection/components/dropdown/dropdown-option/dropdown-option.css +1 -0
- package/dist/collection/components/dropdown/dropdown-option/dropdown-option.js +6 -6
- package/dist/collection/components/dropdown/dropdown.css +19 -3
- package/dist/collection/components/dropdown/dropdown.js +49 -17
- package/dist/collection/components/header/header-dropdown/header-dropdown.css +1 -1
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/icon/iconsArray.js +2 -1
- package/dist/collection/components/popover-canvas/popover-canvas.js +21 -2
- package/dist/collection/components/popover-core/popover-core.js +48 -7
- package/dist/collection/components/popover-core/tds-popover-core.css +6965 -0
- package/dist/collection/components/popover-menu/popover-menu-item/popover-menu-item.css +1 -0
- package/dist/collection/components/popover-menu/popover-menu.js +21 -2
- package/dist/collection/components/slider/slider.css +4 -0
- package/dist/collection/components/slider/slider.js +24 -15
- package/dist/collection/components/text-field/text-field.js +34 -7
- package/dist/collection/components/toggle/toggle.css +1 -1
- package/dist/collection/utils/classList.js +22 -0
- package/dist/collection/utils/testConfiguration.js +65 -0
- package/dist/components/{p-d39c122f.js → p-4449e91e.js} +26 -11
- package/dist/components/{p-00352218.js → p-6d69bf43.js} +4 -4
- package/dist/components/{p-8a5ff20b.js → p-a32f9097.js} +1 -1
- package/dist/components/{p-88cff290.js → p-ad93662a.js} +1 -1
- package/dist/components/{p-cc6e8a0d.js → p-dcfecf4d.js} +5 -3
- package/dist/components/p-e02b091c.js +2052 -0
- package/dist/components/tds-accordion-item.js +1 -1
- package/dist/components/tds-banner.js +1 -1
- package/dist/components/tds-button.js +6 -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-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 +4 -4
- 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-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-item.js +1 -1
- package/dist/components/tds-popover-menu.js +5 -3
- 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 +26 -17
- 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 +15 -8
- package/dist/components/tds-textarea.js +1 -1
- package/dist/components/tds-toast.js +1 -1
- package/dist/components/tds-toggle.js +1 -1
- package/dist/components/tds-tooltip.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tds-button.entry.js +5 -3
- package/dist/esm/tds-dropdown_2.entry.js +26 -12
- package/dist/esm/tds-header-dropdown.entry.js +1 -1
- package/dist/esm/tds-icon.entry.js +1 -1
- package/dist/esm/tds-popover-canvas.entry.js +3 -2
- package/dist/esm/tds-popover-core.entry.js +44 -6
- package/dist/esm/tds-popover-menu-item.entry.js +1 -1
- package/dist/esm/tds-popover-menu.entry.js +3 -2
- package/dist/esm/tds-slider.entry.js +25 -16
- package/dist/esm/tds-text-field.entry.js +12 -6
- package/dist/esm/tds-toggle.entry.js +1 -1
- package/dist/esm/tegel.js +1 -1
- package/dist/tegel/p-062adc6d.entry.js +1 -0
- package/dist/tegel/{p-cee33647.entry.js → p-07825c63.entry.js} +1 -1
- package/dist/tegel/p-23ddcd21.entry.js +1 -0
- package/dist/tegel/p-590b5f55.entry.js +1 -0
- package/dist/tegel/{p-588a05aa.entry.js → p-7097a39a.entry.js} +1 -1
- package/dist/tegel/p-7d39487c.entry.js +1 -0
- package/dist/tegel/p-845e1fca.entry.js +1 -0
- package/dist/tegel/p-dd060c11.entry.js +1 -0
- package/dist/tegel/p-e1df12b3.entry.js +1 -0
- package/dist/tegel/p-f45d905c.entry.js +1 -0
- package/dist/tegel/p-f91c6e9d.entry.js +1 -0
- package/dist/tegel/tegel.css +45 -28
- package/dist/tegel/tegel.esm.js +1 -1
- package/dist/types/components/button/button.d.ts +2 -0
- package/dist/types/components/dropdown/dropdown-option/dropdown-option.d.ts +2 -2
- package/dist/types/components/dropdown/dropdown.d.ts +7 -6
- package/dist/types/components/popover-canvas/popover-canvas.d.ts +2 -0
- package/dist/types/components/popover-core/popover-core.d.ts +3 -0
- package/dist/types/components/popover-menu/popover-menu.d.ts +2 -0
- package/dist/types/components/text-field/text-field.d.ts +2 -0
- package/dist/types/components.d.ts +45 -7
- package/dist/types/types/Icons.d.ts +1 -1
- package/dist/types/utils/classList.d.ts +18 -0
- package/dist/types/utils/testConfiguration.d.ts +13 -0
- package/package.json +1 -1
- package/dist/components/p-1e1cf7f4.js +0 -2012
- package/dist/tegel/p-0fe204ed.entry.js +0 -1
- package/dist/tegel/p-19571a64.entry.js +0 -1
- package/dist/tegel/p-66282839.entry.js +0 -1
- package/dist/tegel/p-945439c9.entry.js +0 -1
- package/dist/tegel/p-b21eb276.entry.js +0 -1
- package/dist/tegel/p-b810cf07.entry.js +0 -1
- package/dist/tegel/p-b8f8a973.entry.js +0 -1
- package/dist/tegel/p-bb86ab14.entry.js +0 -1
- package/dist/tegel/p-f04a31b1.entry.js +0 -1
|
@@ -11,6 +11,7 @@ export class TdsPopoverMenu {
|
|
|
11
11
|
this.show = null;
|
|
12
12
|
this.defaultShow = false;
|
|
13
13
|
this.placement = 'auto';
|
|
14
|
+
this.animation = 'none';
|
|
14
15
|
this.offsetSkidding = 0;
|
|
15
16
|
this.offsetDistance = 8;
|
|
16
17
|
this.fluidWidth = false;
|
|
@@ -26,13 +27,13 @@ export class TdsPopoverMenu {
|
|
|
26
27
|
}
|
|
27
28
|
render() {
|
|
28
29
|
var _a;
|
|
29
|
-
return (h(Host, { key: '
|
|
30
|
+
return (h(Host, { key: '51845cbec6357e794a8bc4a9be6fba399f6cfd65' }, h("tds-popover-core", { key: 'ff9deb3164f9e80efb10bcb2bb0e2022d0df2254', class: {
|
|
30
31
|
'tds-popover-menu': true,
|
|
31
32
|
[(_a = this.inheritedAttributes.class) !== null && _a !== void 0 ? _a : '']: true,
|
|
32
33
|
'fluid-width': this.fluidWidth,
|
|
33
34
|
}, selector: this.selector, referenceEl: this.referenceEl, show: this.show, placement: this.placement, offsetSkidding: this.offsetSkidding, offsetDistance: this.offsetDistance, ref: (el) => {
|
|
34
35
|
this.childRef = el;
|
|
35
|
-
}, defaultShow: this.defaultShow }, h("div", { key: '
|
|
36
|
+
}, defaultShow: this.defaultShow, animation: this.animation }, h("div", { key: 'b5bc5851c06ce2bc874c76d9229b3efa3effd33a', role: "list" }, h("slot", { key: '1628c60e504a749863c3f000ec12a6e25a0a2da8' })))));
|
|
36
37
|
}
|
|
37
38
|
static get is() { return "tds-popover-menu"; }
|
|
38
39
|
static get encapsulation() { return "scoped"; }
|
|
@@ -145,6 +146,24 @@ export class TdsPopoverMenu {
|
|
|
145
146
|
"reflect": false,
|
|
146
147
|
"defaultValue": "'auto'"
|
|
147
148
|
},
|
|
149
|
+
"animation": {
|
|
150
|
+
"type": "string",
|
|
151
|
+
"mutable": false,
|
|
152
|
+
"complexType": {
|
|
153
|
+
"original": "'none' | 'fade' | string",
|
|
154
|
+
"resolved": "string",
|
|
155
|
+
"references": {}
|
|
156
|
+
},
|
|
157
|
+
"required": false,
|
|
158
|
+
"optional": false,
|
|
159
|
+
"docs": {
|
|
160
|
+
"tags": [],
|
|
161
|
+
"text": "Whether the popover should animate when being opened/closed or not"
|
|
162
|
+
},
|
|
163
|
+
"attribute": "animation",
|
|
164
|
+
"reflect": false,
|
|
165
|
+
"defaultValue": "'none'"
|
|
166
|
+
},
|
|
148
167
|
"offsetSkidding": {
|
|
149
168
|
"type": "number",
|
|
150
169
|
"mutable": false,
|
|
@@ -189,6 +189,7 @@ tds-slider input[type=range].tds-slider-native-element {
|
|
|
189
189
|
border-radius: 1px;
|
|
190
190
|
background-color: var(--tds-slider-track-color);
|
|
191
191
|
position: relative;
|
|
192
|
+
cursor: pointer;
|
|
192
193
|
}
|
|
193
194
|
.tds-slider .tds-slider__track:focus {
|
|
194
195
|
outline: 0;
|
|
@@ -237,6 +238,9 @@ tds-slider input[type=range].tds-slider-native-element {
|
|
|
237
238
|
.tds-slider.disabled .tds-slider__value {
|
|
238
239
|
display: none;
|
|
239
240
|
}
|
|
241
|
+
.tds-slider.disabled .tds-slider__track {
|
|
242
|
+
cursor: not-allowed;
|
|
243
|
+
}
|
|
240
244
|
.tds-slider.disabled .tds-slider__track .tds-slider__track-fill {
|
|
241
245
|
background-color: var(--tds-slider-disabled);
|
|
242
246
|
}
|
|
@@ -56,6 +56,11 @@ export class TdsSlider {
|
|
|
56
56
|
}
|
|
57
57
|
handleRelease(event) {
|
|
58
58
|
if (!this.thumbGrabbed) {
|
|
59
|
+
const clickedOnTrack = event.target === this.trackElement || event.target === this.trackFillElement;
|
|
60
|
+
if (clickedOnTrack) {
|
|
61
|
+
this.thumbCore(event);
|
|
62
|
+
this.trackElement.focus();
|
|
63
|
+
}
|
|
59
64
|
return;
|
|
60
65
|
}
|
|
61
66
|
this.thumbGrabbed = false;
|
|
@@ -96,7 +101,7 @@ export class TdsSlider {
|
|
|
96
101
|
const numTicks = parseInt(this.ticks);
|
|
97
102
|
const trackRect = this.trackElement.getBoundingClientRect();
|
|
98
103
|
let localLeft = 0;
|
|
99
|
-
if (event.type === 'mousemove') {
|
|
104
|
+
if (event.type === 'mousemove' || event.type === 'mouseup') {
|
|
100
105
|
localLeft = event.clientX - trackRect.left;
|
|
101
106
|
}
|
|
102
107
|
else if (event.type === 'touchmove') {
|
|
@@ -121,16 +126,20 @@ export class TdsSlider {
|
|
|
121
126
|
}
|
|
122
127
|
updateValue(event) {
|
|
123
128
|
const trackWidth = this.getTrackWidth();
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
const min = parseFloat(this.min);
|
|
130
|
+
const max = parseFloat(this.max);
|
|
131
|
+
// If snapping is enabled and a valid supposedValueSlot is available,
|
|
132
|
+
// snap the value to the closest tick. Use the snapped value to update
|
|
133
|
+
// the slider's thumb position and internal value.
|
|
134
|
+
if (this.useSnapping && this.supposedValueSlot >= 0) {
|
|
135
|
+
const snappedValue = this.tickValues[this.supposedValueSlot];
|
|
136
|
+
this.value = snappedValue.toString();
|
|
137
|
+
this.calculateThumbLeftFromValue(snappedValue);
|
|
130
138
|
}
|
|
131
139
|
else {
|
|
132
140
|
const percentage = this.thumbLeft / trackWidth;
|
|
133
|
-
|
|
141
|
+
const calculatedValue = min + percentage * (max - min);
|
|
142
|
+
this.value = Math.round(calculatedValue).toString();
|
|
134
143
|
}
|
|
135
144
|
this.updateTrack();
|
|
136
145
|
this.tdsInput.emit({ value: this.value });
|
|
@@ -288,24 +297,24 @@ export class TdsSlider {
|
|
|
288
297
|
this.updateTrack();
|
|
289
298
|
}
|
|
290
299
|
render() {
|
|
291
|
-
return (h("div", { key: '
|
|
300
|
+
return (h("div", { key: 'fd7d051192c33b19e8c68cbeaa50ea43149457bb', class: {
|
|
292
301
|
'tds-slider-wrapper': true,
|
|
293
302
|
'read-only': this.readOnly,
|
|
294
|
-
} }, h("input", { key: '
|
|
303
|
+
} }, h("input", { key: 'd2fe02893f865f5791736cb5f05b5bcd2494e471', class: "tds-slider-native-element", type: "range", name: this.name, min: this.min, max: this.max, value: this.value, disabled: this.disabled }), h("div", { key: '2d436a5654cb20923cd20ed61f9449bd0705edd2', class: {
|
|
295
304
|
'tds-slider': true,
|
|
296
305
|
'disabled': this.disabled,
|
|
297
306
|
'tds-slider-small': this.useSmall,
|
|
298
307
|
}, ref: (el) => {
|
|
299
308
|
this.wrapperElement = el;
|
|
300
|
-
} }, h("label", { key: '
|
|
309
|
+
} }, h("label", { key: 'd9d444d15acabbbc23c7b7633e5312f405ff9120', class: this.showTickNumbers && 'offset' }, this.label), this.useInput && (h("div", { key: '2f0d0419138851724891e2ab04fef2f3b3e099f1', class: "tds-slider__input-values" }, h("div", { key: '7f23007c0f4a1aa6358ffa7c5aaae027d0927b63', class: "tds-slider__input-value min-value" }, this.min))), this.useControls && (h("div", { key: 'df4a00a40c541b83aa8459dfcdaf22c348e2c80a', class: "tds-slider__controls" }, h("div", { key: '96cc419d369098137895b725f97a8fa3d7d50dfc', class: "tds-slider__control tds-slider__control-minus", onClick: (event) => this.stepLeft(event) }, h("tds-icon", { key: '09ed43c9f2fe81baeada6a07e4cba18027f04ba1', name: "minus", size: "16px" })))), h("div", { key: '402647683b57076bd4ac3ce3d754585a89a48e08', class: "tds-slider-inner" }, this.tickValues.length > 0 && (h("div", { key: 'd80c648eca47c7e52725e967a32fe4a4692a5729', class: "tds-slider__value-dividers-wrapper" }, h("div", { key: '030106df49f12a55c1b32a9c1c257f449629644a', class: "tds-slider__value-dividers" }, this.tickValues.map((value) => (h("div", { class: "tds-slider__value-divider" }, this.showTickNumbers && h("span", null, value))))))), h("div", { key: 'fef7013f82a191c32bc3a4d297f5e10a4db127a1', class: "tds-slider__track", ref: (el) => {
|
|
301
310
|
this.trackElement = el;
|
|
302
|
-
}, tabindex: this.disabled ? '-1' : '0' }, h("div", { key: '
|
|
311
|
+
}, tabindex: this.disabled ? '-1' : '0' }, h("div", { key: '24a583182c45114d1e011bffef0f81f1e4f93a36', class: "tds-slider__track-fill", ref: (el) => {
|
|
303
312
|
this.trackFillElement = el;
|
|
304
|
-
} }), h("div", { key: '
|
|
313
|
+
} }), h("div", { key: '3bea53237beb92f41264386fb5ac181d1e9966a4', class: "tds-slider__thumb", ref: (el) => {
|
|
305
314
|
this.thumbElement = el;
|
|
306
|
-
}, onMouseDown: () => this.grabThumb(), onTouchStart: () => this.grabThumb() }, this.tooltip && (h("div", { key: '
|
|
315
|
+
}, onMouseDown: () => this.grabThumb(), onTouchStart: () => this.grabThumb() }, this.tooltip && (h("div", { key: '3ac44629cad3b03524602f9babe7fa4582b38660', class: "tds-slider__value" }, this.value, h("svg", { key: '5adbbcc274555d14454c5329f0eea8c072a3db2c', width: "18", height: "14", viewBox: "0 0 18 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: '248b1f8521b89be4214631e411c0ba9c7bcc07a8', d: "M8.15882 12.6915L0.990487 1.54076C0.562658 0.875246 1.0405 0 1.83167 0H16.1683C16.9595 0 17.4373 0.875246 17.0095 1.54076L9.84118 12.6915C9.44754 13.3038 8.55246 13.3038 8.15882 12.6915Z", fill: "currentColor" })))), h("div", { key: 'bc778a9ccd25a5229aa7685cc6c22ed5385b9d98', class: "tds-slider__thumb-inner", ref: (el) => {
|
|
307
316
|
this.thumbInnerElement = el;
|
|
308
|
-
} })))), this.useInput && (h("div", { key: '
|
|
317
|
+
} })))), this.useInput && (h("div", { key: '077ffffeb0986504a2c9fc4e1b08095ec689402c', class: "tds-slider__input-values" }, h("div", { key: '74a528a286e2b49a6739c5817cca8a0436b908b9', class: "tds-slider__input-value", onClick: (event) => this.stepLeft(event) }, this.max), h("div", { key: 'af2a647636c8eecba19637aa92ddda37adc52a1b', class: "tds-slider__input-field-wrapper" }, h("input", { key: '02701d15de6119994f7be13b9c9ac69ae6f2269b', size: this.calculateInputSizeFromMax(), class: "tds-slider__input-field", value: this.value, readOnly: this.readOnly, onBlur: (event) => this.updateSliderValueOnInputChange(event), onKeyDown: (event) => this.handleInputFieldEnterPress(event), type: "number", min: this.min, max: this.max })))), this.useControls && (h("div", { key: 'ef215ef613c381601674d4bb7dbea583a3ddde2a', class: "tds-slider__controls" }, h("div", { key: '4e553194348daf32529c9c8cedc32b0686ac32ff', class: "tds-slider__control tds-slider__control-plus", onClick: (event) => this.stepRight(event) }, h("tds-icon", { key: 'd5d67ea7ff64ed19d28bd078acad56ebda742f93', name: "plus", size: "16px" })))))));
|
|
309
318
|
}
|
|
310
319
|
static get is() { return "tds-slider"; }
|
|
311
320
|
static get originalStyleUrls() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h } from "@stencil/core";
|
|
2
1
|
import hasSlot from "../../utils/hasSlot";
|
|
2
|
+
import { h } from "@stencil/core";
|
|
3
3
|
/**
|
|
4
4
|
* @slot prefix - Slot for the prefix in the component.
|
|
5
5
|
* @slot suffix - Slot for the suffix in the component. Suffix is hidden when the input is in readonly state.
|
|
@@ -44,11 +44,17 @@ export class TdsTextField {
|
|
|
44
44
|
this.focusInput = false;
|
|
45
45
|
this.tdsBlur.emit(event);
|
|
46
46
|
}
|
|
47
|
+
/** Method to handle focus */
|
|
48
|
+
async focusElement() {
|
|
49
|
+
if (this.textInput) {
|
|
50
|
+
this.textInput.focus();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
47
53
|
render() {
|
|
48
54
|
var _a;
|
|
49
55
|
const usesPrefixSlot = hasSlot('prefix', this.host);
|
|
50
56
|
const usesSuffixSlot = hasSlot('suffix', this.host);
|
|
51
|
-
return (h("div", { key: '
|
|
57
|
+
return (h("div", { key: 'fbbf85f381d4322a3806e26fd0d5fc99f418798d', class: {
|
|
52
58
|
'form-text-field': true,
|
|
53
59
|
'form-text-field-nomin': this.noMinWidth,
|
|
54
60
|
'text-field-focus': this.focusInput && !this.disabled,
|
|
@@ -62,12 +68,12 @@ export class TdsTextField {
|
|
|
62
68
|
'form-text-field-sm': this.size === 'sm',
|
|
63
69
|
'form-text-field-error': this.state === 'error',
|
|
64
70
|
'form-text-field-success': this.state === 'success',
|
|
65
|
-
} }, this.labelPosition === 'outside' && (h("div", { key: '
|
|
71
|
+
} }, this.labelPosition === 'outside' && (h("div", { key: '56af5e0e26cd43abbbea49de990bc07c6bb5b18c', class: "text-field-label-outside" }, h("div", { key: '874e3561ccf253e30f6b09902d76174293a1f332' }, this.label))), h("div", { key: 'fc43c855f7f374a2761feda34a6374be1a37ff90', onClick: () => this.textInput.focus(), class: "text-field-container" }, usesPrefixSlot && (h("div", { key: '7b5590cf8cb856942e30fd80c3115bf133062998', class: {
|
|
66
72
|
'text-field-slot-wrap-prefix': true,
|
|
67
73
|
'text-field-error': this.state === 'error',
|
|
68
74
|
'text-field-success': this.state === 'success',
|
|
69
75
|
'text-field-default': this.state === 'default',
|
|
70
|
-
} }, h("slot", { key: '
|
|
76
|
+
} }, h("slot", { key: 'df3ff67a7f8195e3317c6bef103ee19b98628fe3', name: "prefix" }))), h("div", { key: '7727642d6c2bc664785043f730d652a2ca21657c', class: "text-field-input-container" }, h("input", { key: '58ec947e5d401cc40224be16bd987c9d1a31237f', ref: (inputEl) => (this.textInput = inputEl), class: {
|
|
71
77
|
'text-field-input': true,
|
|
72
78
|
'text-field-input-sm': this.size === 'sm',
|
|
73
79
|
'text-field-input-md': this.size === 'md',
|
|
@@ -80,16 +86,16 @@ export class TdsTextField {
|
|
|
80
86
|
if (!this.readOnly) {
|
|
81
87
|
this.handleBlur(event);
|
|
82
88
|
}
|
|
83
|
-
} }), this.labelPosition === 'inside' && this.size !== 'sm' && (h("label", { key: '
|
|
89
|
+
} }), this.labelPosition === 'inside' && this.size !== 'sm' && (h("label", { key: '4ff4a198eea2803a08f3336c860a07788a4f7ca1', class: "text-field-label-inside" }, this.label))), h("div", { key: '734de1fb01e8f9c0a270af04d567b2fe0d891172', class: "text-field-bar" }), usesSuffixSlot && (h("div", { key: 'acd385a1e926ac1c66e4185e156ab47f796d3c5f', class: {
|
|
84
90
|
'text-field-slot-wrap-suffix': true,
|
|
85
91
|
'text-field-error': this.state === 'error',
|
|
86
92
|
'text-field-success': this.state === 'success',
|
|
87
93
|
'text-field-default': this.state === 'default',
|
|
88
94
|
'tds-u-display-none': this.readOnly,
|
|
89
|
-
} }, h("slot", { key: '
|
|
95
|
+
} }, h("slot", { key: '98e3ad6a1083ace81fd102a4386236321372158f', name: "suffix" }))), h("span", { key: 'c1020a1fb2ea2ec06f1cc3478328ff09f5dde12f', class: "text-field-icon__readonly" }, h("tds-icon", { key: '2fa99d139b21034cff9699f8ca359b85333c048b', name: "edit_inactive", size: "20px" })), h("span", { key: '1bef6d45afd4586fca10e188b2ccadd4504750fc', class: "text-field-icon__readonly-label" }, "This field is non-editable")), (this.helper || this.maxLength > 0) && (h("div", { key: 'b43c0ed2778672b5ea587214f45f353425030a45', class: "text-field-helper" }, this.state === 'error' && (h("div", { key: '6943b70f8ee2fe98a7ade493f62b1be9245c053b', class: "text-field-helper-error-state" }, h("tds-icon", { key: '1e4a5820aa41c0918aee84488476afa2d9bb27c4', name: "error", size: "16px" }), this.helper)), this.state !== 'error' && this.helper, this.maxLength > 0 && (h("div", { key: 'e0f6a4ba6b781e1307f5abba906abba9a6631a74', class: {
|
|
90
96
|
'text-field-textcounter': true,
|
|
91
97
|
'text-field-textcounter-disabled': this.disabled,
|
|
92
|
-
} }, this.value === null ? 0 : (_a = this.value) === null || _a === void 0 ? void 0 : _a.length, h("span", { key: '
|
|
98
|
+
} }, this.value === null ? 0 : (_a = this.value) === null || _a === void 0 ? void 0 : _a.length, h("span", { key: 'ae2a52268ca86705b853043fb35bc0da19c7e2ae', class: {
|
|
93
99
|
'text-field-textcounter-divider': true,
|
|
94
100
|
'text-field-textcounter-disabled': this.disabled,
|
|
95
101
|
} }, ' ', "/", ' '), this.maxLength))))));
|
|
@@ -495,5 +501,26 @@ export class TdsTextField {
|
|
|
495
501
|
}
|
|
496
502
|
}];
|
|
497
503
|
}
|
|
504
|
+
static get methods() {
|
|
505
|
+
return {
|
|
506
|
+
"focusElement": {
|
|
507
|
+
"complexType": {
|
|
508
|
+
"signature": "() => Promise<void>",
|
|
509
|
+
"parameters": [],
|
|
510
|
+
"references": {
|
|
511
|
+
"Promise": {
|
|
512
|
+
"location": "global",
|
|
513
|
+
"id": "global::Promise"
|
|
514
|
+
}
|
|
515
|
+
},
|
|
516
|
+
"return": "Promise<void>"
|
|
517
|
+
},
|
|
518
|
+
"docs": {
|
|
519
|
+
"text": "Method to handle focus",
|
|
520
|
+
"tags": []
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
}
|
|
498
525
|
static get elementRef() { return "host"; }
|
|
499
526
|
}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
content: "";
|
|
25
25
|
position: absolute;
|
|
26
26
|
box-sizing: border-box;
|
|
27
|
-
transition: all
|
|
27
|
+
transition: all var(--tds-motion-duration-moderate-01) var(--tds-motion-easing-scania);
|
|
28
28
|
}
|
|
29
29
|
.tds-toggle input[type=checkbox]::before {
|
|
30
30
|
/* Slider */
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a string of class names by filtering out keys from the `classes` object
|
|
3
|
+
* whose values evaluate to `false`. The keys that remain will be joined with a space.
|
|
4
|
+
*
|
|
5
|
+
* @param classes - An object where keys represent class names and values are boolean
|
|
6
|
+
* flags indicating whether to include the class name.
|
|
7
|
+
* @returns A string of class names separated by spaces.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const classes = {
|
|
11
|
+
* 'active': true,
|
|
12
|
+
* 'disabled': false,
|
|
13
|
+
* 'highlighted': true,
|
|
14
|
+
* };
|
|
15
|
+
* const classList = generateClassList(classes);
|
|
16
|
+
* console.log(classList); // Output: "active highlighted"
|
|
17
|
+
*/
|
|
18
|
+
export const generateClassList = (classes) => {
|
|
19
|
+
return Object.keys(classes)
|
|
20
|
+
.filter((key) => classes[key])
|
|
21
|
+
.join(' ');
|
|
22
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { expect } from "@playwright/test";
|
|
2
|
+
const themeClasses = {
|
|
3
|
+
lightmode: 'tds-mode-light',
|
|
4
|
+
darkmode: 'tds-mode-dark',
|
|
5
|
+
};
|
|
6
|
+
export const testConfigurations = {
|
|
7
|
+
withModeVariants: [
|
|
8
|
+
{
|
|
9
|
+
modeVariant: 'primary',
|
|
10
|
+
theme: 'lightmode',
|
|
11
|
+
backgroundColor: 'white',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
modeVariant: 'primary',
|
|
15
|
+
theme: 'darkmode',
|
|
16
|
+
backgroundColor: 'var(--tds-grey-958)',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
modeVariant: 'secondary',
|
|
20
|
+
theme: 'lightmode',
|
|
21
|
+
backgroundColor: 'var(--tds-grey-50)',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
modeVariant: 'secondary',
|
|
25
|
+
theme: 'darkmode',
|
|
26
|
+
backgroundColor: 'var(--tds-grey-900)',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
basic: [
|
|
30
|
+
{
|
|
31
|
+
theme: 'lightmode',
|
|
32
|
+
backgroundColor: 'white',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
theme: 'darkmode',
|
|
36
|
+
backgroundColor: 'var(--tds-grey-958)',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
export const setupPage = async (page, config, componentTestPath, componentName) => {
|
|
41
|
+
await page.goto(componentTestPath);
|
|
42
|
+
const evaluateData = {
|
|
43
|
+
className: themeClasses[config.theme],
|
|
44
|
+
backgroundColor: config.backgroundColor,
|
|
45
|
+
};
|
|
46
|
+
await page.evaluate(({ className, backgroundColor }) => {
|
|
47
|
+
document.body.classList.add(className);
|
|
48
|
+
const currentStyle = document.body.getAttribute('style');
|
|
49
|
+
document.body.setAttribute('style', `${currentStyle}; background-color: ${backgroundColor}; padding-top: 20px; padding-bottom: 20px;`);
|
|
50
|
+
}, evaluateData);
|
|
51
|
+
if (config.modeVariant) {
|
|
52
|
+
const elementLocator = page.locator(componentName);
|
|
53
|
+
const count = await elementLocator.count();
|
|
54
|
+
await expect(count).toBeGreaterThanOrEqual(1);
|
|
55
|
+
const elements = await elementLocator.all();
|
|
56
|
+
elements.forEach(async (element) => {
|
|
57
|
+
await element.evaluate((elem, modeVariant) => {
|
|
58
|
+
elem.setAttribute('mode-variant', modeVariant);
|
|
59
|
+
}, config.modeVariant);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
export const getTestDescribeText = (config, testDescription) => config.modeVariant
|
|
64
|
+
? `${testDescription}-${config.modeVariant}-${config.theme}`
|
|
65
|
+
: `${testDescription}-${config.theme}`;
|
|
@@ -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-a32f9097.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Find the next focusable element index in a list of focusable elements.
|
|
@@ -59,7 +59,7 @@ const appendHiddenInput = (element, name, value, disabled, additionalAttributes)
|
|
|
59
59
|
input.value = value || '';
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
const dropdownCss = "@charset \"UTF-8\";:host button{all:unset;height:100%;width:100%;background-color:var(--tds-dropdown-bg);border-bottom:1px solid var(--tds-dropdown-border-bottom);border-radius:var(--tds-dropdown-border-radius)}:host button:hover{border-bottom:1px solid var(--tds-dropdown-border-bottom-hover)}:host button .value-wrapper{padding:0 16px;display:flex;align-items:center;justify-content:space-between}:host button.placeholder{color:var(--tds-dropdown-placeholder-color);line-height:1.3}:host button.value{color:var(--tds-dropdown-value-color);font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls);line-height:1.3}:host button:focus{border-bottom-color:var(--tds-dropdown-border-bottom-open)}:host button:focus::before{content:\"\";position:absolute;bottom:0;left:0;width:100%;height:1px;background:var(--tds-dropdown-border-bottom-open)}:host button.error{border-bottom:1px solid var(--tds-negative)}:host button.error:focus{border-bottom-color:transparent}:host button.error:focus::before{content:\"\";position:absolute;bottom:0;left:0;width:100%;height:2px;background:var(--tds-negative)}:host button:disabled{color:var(--tds-dropdown-disabled-color);border-bottom:1px solid transparent}:host button .menu-icon{margin-right:0}:host .filter{display:flex;align-items:center;justify-content:space-between;height:100%;background-color:var(--tds-dropdown-bg);border-bottom:1px solid var(--tds-dropdown-border-bottom);padding-left:16px;border-radius:4px 4px 0 0}:host .filter:hover{border-bottom:1px solid var(--tds-dropdown-border-bottom-hover)}:host .filter.disabled{color:var(--tds-dropdown-disabled-color);border-bottom:1px solid transparent}:host .filter .value-wrapper{display:flex;width:100%;height:100%}:host .filter .value-wrapper input{color:var(--tds-dropdown-filter-input-color)}:host .filter .label-inside-as-placeholder{position:absolute;font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls);line-height:1.3;color:var(--tds-dropdown-placeholder-color)}:host .filter .label-inside-as-placeholder.lg{top:20px}:host .filter .label-inside-as-placeholder.md{top:16px}:host .filter .label-inside-as-placeholder.sm{display:none}:host .filter .label-inside-as-placeholder.selected{font:var(--tds-detail-07);letter-spacing:var(--tds-detail-07-ls);transition:all 0.2s ease-in-out}:host .filter .label-inside-as-placeholder.selected.lg{top:12px}:host .filter .label-inside-as-placeholder.selected.md{top:8px}:host .filter .label-inside-as-placeholder.selected.sm{display:none}:host .filter .label-inside-as-placeholder.selected+.placeholder:not(.sm){margin-top:8px}:host .filter.focus{border-bottom-color:transparent}:host .filter.focus::before{content:\"\";position:absolute;bottom:0;left:0;width:100%;height:2px;background:var(--tds-dropdown-border-bottom-open)}:host .filter.error{border-bottom:1px solid var(--tds-negative)}:host .filter.error.focus{border-bottom-color:transparent}:host .filter.error.focus::before{content:\"\";position:absolute;bottom:0;left:0;width:100%;height:2px;background:var(--tds-negative)}:host .filter input{flex:1;all:unset;width:100%}:host .filter input::placeholder{color:var(--tds-dropdown-placeholder-color)}:host .filter input:disabled::placeholder{color:var(--tds-dropdown-disabled-color)}:host .filter tds-icon{cursor:pointer}:host .filter .menu-icon{margin-right:16px}:host .filter .clear-icon{margin:0 8px;color:var(--tds-dropdown-clear-icon-color);padding-right:8px;border-right:1px solid var(--tds-dropdown-clear-icon-color)}:host .filter .clear-icon:hover{color:var(--tds-dropdown-clear-icon-hover-color)}:host .filter .clear-icon.hide{display:none;visibility:hidden}:host{--tds-scrollbar-width-standard:thin;--tds-scrollbar-width:10px;--tds-scrollbar-height:10px;--tds-scrollbar-thumb-border-width:3px;--tds-scrollbar-thumb-border-hover-width:2px}body{scrollbar-width:thin}:host{display:block;position:relative;font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls)}:host .label-outside{font:var(--tds-detail-05);letter-spacing:var(--tds-detail-05-ls);color:var(--tds-dropdown-label-color);margin-bottom:8px}:host .label-outside.disabled{color:var(--tds-dropdown-disabled-color)}:host .dropdown-select{position:relative}:host .dropdown-select button:focus{border-bottom-color:var(--tds-dropdown-border-bottom)}:host .dropdown-select button{border-bottom-color:var(--tds-dropdown-border-bottom)}:host .dropdown-select button.error{border-bottom-color:var(--tds-negative)}:host .dropdown-select button.error:focus{border-bottom-color:transparent}:host .dropdown-select.disabled .label-inside,:host .dropdown-select.disabled .placeholder,:host .dropdown-select.disabled .label-inside-as-placeholder,:host .dropdown-select.disabled .value-wrapper{color:var(--tds-dropdown-disabled-color)}:host .dropdown-select.disabled button{border:none}:host .dropdown-select .label-inside{position:absolute;font:var(--tds-detail-07);letter-spacing:var(--tds-detail-07-ls);color:var(--tds-dropdown-label-inside-color)}:host .dropdown-select .label-inside.lg{top:12px;left:16px}:host .dropdown-select .label-inside.md{top:8px;left:16px}:host .dropdown-select .label-inside.sm{display:none}:host .dropdown-select .label-inside.xs{display:none}:host .dropdown-select .label-inside+.placeholder:not(.sm){margin-top:8px}:host .dropdown-select .placeholder{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-right:var(--tds-placeholder-margin);}:host .dropdown-select .placeholder.xs{line-height:1}:host .dropdown-select .label-inside-as-placeholder{color:var(--tds-dropdown-placeholder-color)}:host .dropdown-select .label-inside-as-placeholder.selected{position:absolute;font:var(--tds-detail-07);letter-spacing:var(--tds-detail-07-ls);transition:all 0.2s ease-in-out}:host .dropdown-select .label-inside-as-placeholder.selected.lg{top:12px}:host .dropdown-select .label-inside-as-placeholder.selected.md{top:8px}:host .dropdown-select .label-inside-as-placeholder.selected.sm{display:none}:host .dropdown-select .label-inside-as-placeholder.selected+.placeholder:not(.sm){margin-top:8px}:host .dropdown-select.lg{height:55px}:host .dropdown-select.md{height:47px}:host .dropdown-select.sm{height:39px}:host .dropdown-select.xs{height:29px}:host .helper{margin-top:4px;color:var(--tds-dropdown-helper-color);font:var(--tds-detail-05);letter-spacing:var(--tds-detail-05-ls);display:flex;align-items:center;gap:8px}:host .helper.error{color:var(--tds-negative)}:host .helper.disabled{color:var(--tds-dropdown-disabled-color)}:host .dropdown-list{z-index:100;position:absolute;margin-top:1px;width:100%;transform-origin:top;
|
|
62
|
+
const dropdownCss = "@charset \"UTF-8\";:host button{all:unset;height:100%;width:100%;background-color:var(--tds-dropdown-bg);border-bottom:1px solid var(--tds-dropdown-border-bottom);border-radius:var(--tds-dropdown-border-radius)}:host button:hover{border-bottom:1px solid var(--tds-dropdown-border-bottom-hover)}:host button .value-wrapper{padding:0 16px;display:flex;align-items:center;justify-content:space-between}:host button.placeholder{color:var(--tds-dropdown-placeholder-color);line-height:1.3}:host button.value{color:var(--tds-dropdown-value-color);font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls);line-height:1.3}:host button:focus{border-bottom-color:var(--tds-dropdown-border-bottom-open)}:host button:focus::before{content:\"\";position:absolute;bottom:0;left:0;width:100%;height:1px;background:var(--tds-dropdown-border-bottom-open)}:host button.error{border-bottom:1px solid var(--tds-negative)}:host button.error:focus{border-bottom-color:transparent}:host button.error:focus::before{content:\"\";position:absolute;bottom:0;left:0;width:100%;height:2px;background:var(--tds-negative)}:host button:disabled{color:var(--tds-dropdown-disabled-color);border-bottom:1px solid transparent}:host button .menu-icon{margin-right:0}:host .filter{display:flex;align-items:center;justify-content:space-between;height:100%;background-color:var(--tds-dropdown-bg);border-bottom:1px solid var(--tds-dropdown-border-bottom);padding-left:16px;border-radius:4px 4px 0 0}:host .filter:hover{border-bottom:1px solid var(--tds-dropdown-border-bottom-hover)}:host .filter.disabled{color:var(--tds-dropdown-disabled-color);border-bottom:1px solid transparent}:host .filter .value-wrapper{display:flex;width:100%;height:100%}:host .filter .value-wrapper input{color:var(--tds-dropdown-filter-input-color)}:host .filter .label-inside-as-placeholder{position:absolute;font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls);line-height:1.3;color:var(--tds-dropdown-placeholder-color)}:host .filter .label-inside-as-placeholder.lg{top:20px}:host .filter .label-inside-as-placeholder.md{top:16px}:host .filter .label-inside-as-placeholder.sm{display:none}:host .filter .label-inside-as-placeholder.selected{font:var(--tds-detail-07);letter-spacing:var(--tds-detail-07-ls);transition:all 0.2s ease-in-out}:host .filter .label-inside-as-placeholder.selected.lg{top:12px}:host .filter .label-inside-as-placeholder.selected.md{top:8px}:host .filter .label-inside-as-placeholder.selected.sm{display:none}:host .filter .label-inside-as-placeholder.selected+.placeholder:not(.sm){margin-top:8px}:host .filter.focus{border-bottom-color:transparent}:host .filter.focus::before{content:\"\";position:absolute;bottom:0;left:0;width:100%;height:2px;background:var(--tds-dropdown-border-bottom-open)}:host .filter.error{border-bottom:1px solid var(--tds-negative)}:host .filter.error.focus{border-bottom-color:transparent}:host .filter.error.focus::before{content:\"\";position:absolute;bottom:0;left:0;width:100%;height:2px;background:var(--tds-negative)}:host .filter input{flex:1;all:unset;width:100%}:host .filter input::placeholder{color:var(--tds-dropdown-placeholder-color)}:host .filter input:disabled::placeholder{color:var(--tds-dropdown-disabled-color)}:host .filter tds-icon{cursor:pointer}:host .filter .menu-icon{margin-right:16px}:host .filter .clear-icon{margin:0 8px;color:var(--tds-dropdown-clear-icon-color);padding-right:8px;border-right:1px solid var(--tds-dropdown-clear-icon-color)}:host .filter .clear-icon:hover{color:var(--tds-dropdown-clear-icon-hover-color)}:host .filter .clear-icon.hide{display:none;visibility:hidden}:host{--tds-scrollbar-width-standard:thin;--tds-scrollbar-width:10px;--tds-scrollbar-height:10px;--tds-scrollbar-thumb-border-width:3px;--tds-scrollbar-thumb-border-hover-width:2px}body{scrollbar-width:thin}:host{display:block;position:relative;font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls)}:host .label-outside{font:var(--tds-detail-05);letter-spacing:var(--tds-detail-05-ls);color:var(--tds-dropdown-label-color);margin-bottom:8px}:host .label-outside.disabled{color:var(--tds-dropdown-disabled-color)}:host .dropdown-select{position:relative}:host .dropdown-select button{transition:border-bottom-color var(--tds-motion-duration-fast-02) var(--tds-motion-easing-scania)}:host .dropdown-select button:focus{border-bottom-color:var(--tds-dropdown-border-bottom)}:host .dropdown-select button:hover{border-bottom-color:var(--tds-dropdown-border-bottom-hover)}:host .dropdown-select button{border-bottom-color:var(--tds-dropdown-border-bottom)}:host .dropdown-select button.error{border-bottom-color:var(--tds-negative)}:host .dropdown-select button.error:focus{border-bottom-color:transparent}:host .dropdown-select.disabled .label-inside,:host .dropdown-select.disabled .placeholder,:host .dropdown-select.disabled .label-inside-as-placeholder,:host .dropdown-select.disabled .value-wrapper{color:var(--tds-dropdown-disabled-color)}:host .dropdown-select.disabled button{border:none}:host .dropdown-select .label-inside{position:absolute;font:var(--tds-detail-07);letter-spacing:var(--tds-detail-07-ls);color:var(--tds-dropdown-label-inside-color)}:host .dropdown-select .label-inside.lg{top:12px;left:16px}:host .dropdown-select .label-inside.md{top:8px;left:16px}:host .dropdown-select .label-inside.sm{display:none}:host .dropdown-select .label-inside.xs{display:none}:host .dropdown-select .label-inside+.placeholder:not(.sm){margin-top:8px}:host .dropdown-select .placeholder{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-right:var(--tds-placeholder-margin);}:host .dropdown-select .placeholder.xs{line-height:1}:host .dropdown-select .label-inside-as-placeholder{color:var(--tds-dropdown-placeholder-color)}:host .dropdown-select .label-inside-as-placeholder.selected{position:absolute;font:var(--tds-detail-07);letter-spacing:var(--tds-detail-07-ls);transition:all 0.2s ease-in-out}:host .dropdown-select .label-inside-as-placeholder.selected.lg{top:12px}:host .dropdown-select .label-inside-as-placeholder.selected.md{top:8px}:host .dropdown-select .label-inside-as-placeholder.selected.sm{display:none}:host .dropdown-select .label-inside-as-placeholder.selected+.placeholder:not(.sm){margin-top:8px}:host .dropdown-select.lg{height:55px}:host .dropdown-select.md{height:47px}:host .dropdown-select.sm{height:39px}:host .dropdown-select.xs{height:29px}:host .helper{margin-top:4px;color:var(--tds-dropdown-helper-color);font:var(--tds-detail-05);letter-spacing:var(--tds-detail-05-ls);display:flex;align-items:center;gap:8px}:host .helper.error{color:var(--tds-negative)}:host .helper.disabled{color:var(--tds-dropdown-disabled-color)}:host .dropdown-list{z-index:100;position:absolute;margin-top:1px;width:100%;transform-origin:top;box-shadow:rgba(0, 0, 0, 0.1) 0 2px 3px 0;border-radius:var(--tds-dropdown-list-border-radius-down);overflow-y:auto;transform:scaleY(0);pointer-events:none}:host .dropdown-list:hover::-webkit-scrollbar-thumb{border:var(--tds-scrollbar-thumb-border-hover-width) solid transparent;background:var(--tds-scrollbar-hover-thumb-color);background-clip:padding-box}:host .dropdown-list::-webkit-scrollbar{width:var(--tds-scrollbar-width)}:host .dropdown-list::-webkit-scrollbar-track{background:var(--tds-scrollbar-track-color)}:host .dropdown-list::-webkit-scrollbar-thumb{border-radius:40px;background:var(--tds-scrollbar-thumb-color);border:var(--tds-scrollbar-thumb-border-width) solid transparent;background-clip:padding-box}:host .dropdown-list::-webkit-scrollbar-button{height:0;width:0}@supports not selector(::-webkit-scrollbar){:host .dropdown-list{scrollbar-color:var(--tds-scrollbar-thumb-color) var(--tds-scrollbar-track-color);scrollbar-width:var(--tds-scrollbar-width-standard)}}:host .dropdown-list.lg{max-height:312px}:host .dropdown-list.md{max-height:312px}:host .dropdown-list.sm{max-height:260px}:host .dropdown-list.xs{max-height:260px}:host .dropdown-list.up{bottom:100%;margin-top:0;margin-bottom:1px;transform-origin:bottom;display:flex;flex-direction:column-reverse;box-shadow:rgba(0, 0, 0, 0.1) 0 -1px 3px 0;border-radius:var(--tds-dropdown-list-border-radius-up)}:host .dropdown-list.up.label-outside{bottom:calc(100% - 24px)}:host .dropdown-list.closed{transform:scaleY(0);pointer-events:none}:host .dropdown-list.open{transform:scaleY(1);visibility:visible;opacity:1;pointer-events:auto}:host .dropdown-list.animation-enter-slide{transition:transform var(--tds-motion-duration-moderate-01) var(--tds-motion-easing-enter)}:host .dropdown-list.animation-exit-slide{transition:transform var(--tds-motion-duration-moderate-01) var(--tds-motion-easing-exit)}:host .dropdown-list .no-result{font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls);display:flex;align-items:center;padding:0 16px;background-color:var(--tds-dropdown-bg)}:host .dropdown-list .no-result.lg{height:56px}:host .dropdown-list .no-result.md{height:48px}:host .dropdown-list .no-result.sm{height:40px}:host .dropdown-list .no-result.xs{height:40px}:host .menu-icon{color:var(--tds-dropdown-menu-icon-color)}:host tds-icon{transition:transform var(--tds-motion-duration-fast-02) var(--tds-motion-easing-scania)}:host tds-icon.open{transform:rotateZ(180deg)}";
|
|
63
63
|
const TdsDropdownStyle0 = dropdownCss;
|
|
64
64
|
|
|
65
65
|
const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H {
|
|
@@ -151,7 +151,7 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
151
151
|
if (!labels) {
|
|
152
152
|
return '';
|
|
153
153
|
}
|
|
154
|
-
return
|
|
154
|
+
return labels === null || labels === void 0 ? void 0 : labels.join(', ');
|
|
155
155
|
};
|
|
156
156
|
this.setValueAttribute = () => {
|
|
157
157
|
var _a;
|
|
@@ -223,6 +223,7 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
223
223
|
this.openDirection = 'auto';
|
|
224
224
|
this.placeholder = undefined;
|
|
225
225
|
this.size = 'lg';
|
|
226
|
+
this.animation = 'slide';
|
|
226
227
|
this.error = false;
|
|
227
228
|
this.multiselect = false;
|
|
228
229
|
this.filter = false;
|
|
@@ -264,7 +265,7 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
264
265
|
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
|
265
266
|
async setValue(value, label) {
|
|
266
267
|
let nextValue;
|
|
267
|
-
if (typeof value === 'string')
|
|
268
|
+
if (typeof value === 'string' || typeof value === 'number')
|
|
268
269
|
nextValue = [value];
|
|
269
270
|
else
|
|
270
271
|
nextValue = value;
|
|
@@ -420,7 +421,7 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
420
421
|
render() {
|
|
421
422
|
var _a, _b, _c, _d;
|
|
422
423
|
appendHiddenInput(this.host, this.name, (_a = this.value) === null || _a === void 0 ? void 0 : _a.map((value) => value).toString(), this.disabled);
|
|
423
|
-
return (h(Host, { key: '
|
|
424
|
+
return (h(Host, { key: '1413334384ceeef946524daa4957df0584f58bc4', role: "select", class: `${this.modeVariant ? `tds-mode-variant-${this.modeVariant}` : ''}` }, this.label && this.labelPosition === 'outside' && (h("div", { key: '5bb2c77f26f9b6a3166d3ee28ff8607998d96157', class: `label-outside ${this.disabled ? 'disabled' : ''}` }, this.label)), h("div", { key: 'c67f62dfa39b04f7eba6622cf5b712042fed6257', class: `dropdown-select ${this.size} ${this.disabled ? 'disabled' : ''}` }, this.filter ? (h("div", { class: {
|
|
424
425
|
filter: true,
|
|
425
426
|
focus: this.filterFocus,
|
|
426
427
|
disabled: this.disabled,
|
|
@@ -437,7 +438,15 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
437
438
|
this.inputElement.value = this.getValue();
|
|
438
439
|
}
|
|
439
440
|
this.handleBlur(event);
|
|
440
|
-
}, onFocus: (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) => {
|
|
441
450
|
if (event.key === 'Escape') {
|
|
442
451
|
this.open = false;
|
|
443
452
|
}
|
|
@@ -462,11 +471,16 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
462
471
|
label-inside-as-placeholder
|
|
463
472
|
${this.size}
|
|
464
473
|
${((_c = this.value) === null || _c === void 0 ? void 0 : _c.length) ? 'selected' : ''}
|
|
465
|
-
` }, this.label)), h("div", { class: `placeholder ${this.size}` }, ((_d = this.value) === null || _d === void 0 ? void 0 : _d.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: '
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
474
|
+
` }, this.label)), h("div", { class: `placeholder ${this.size}` }, ((_d = this.value) === null || _d === void 0 ? void 0 : _d.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: '4b5c10d679c6f875d215b1a88897a6a83de1dbff', ref: (element) => (this.dropdownList = element), class: {
|
|
475
|
+
'dropdown-list': true,
|
|
476
|
+
[this.size]: true,
|
|
477
|
+
[this.getOpenDirection()]: true,
|
|
478
|
+
'label-outside': this.label && this.labelPosition === 'outside',
|
|
479
|
+
'open': this.open,
|
|
480
|
+
'closed': !this.open,
|
|
481
|
+
[`animation-enter-${this.animation}`]: this.animation !== 'none' && this.open,
|
|
482
|
+
[`animation-exit-${this.animation}`]: this.animation !== 'none' && !this.open,
|
|
483
|
+
} }, h("slot", { key: '248b8dfb71396fecd8b8c03ac6633d663de2d012', onSlotchange: () => this.handleSlotChange() }), this.filterResult === 0 && this.noResultText !== '' && (h("div", { key: 'ad73c3f117a0ea667aeb37f35575af1909cc52fd', class: `no-result ${this.size}` }, this.noResultText))), this.helper && (h("div", { key: 'e05aeddbe8bb2d445b7539914be7bf6b36863c67', class: `helper ${this.error ? 'error' : ''} ${this.disabled ? 'disabled' : ''}` }, this.error && h("tds-icon", { key: '668995fb1c364c3ae89e7f1f9a9f89a7978cabe3', name: "error", size: "16px" }), this.helper))));
|
|
470
484
|
}
|
|
471
485
|
get host() { return this; }
|
|
472
486
|
static get watchers() { return {
|
|
@@ -483,6 +497,7 @@ const TdsDropdown = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends H
|
|
|
483
497
|
"openDirection": [1, "open-direction"],
|
|
484
498
|
"placeholder": [1],
|
|
485
499
|
"size": [1],
|
|
500
|
+
"animation": [1],
|
|
486
501
|
"error": [4],
|
|
487
502
|
"multiselect": [4],
|
|
488
503
|
"filter": [4],
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, d as createEvent, h, c as Host } from './p-28ef5186.js';
|
|
2
2
|
import { d as defineCustomElement$2 } from './p-e4d7c655.js';
|
|
3
|
-
import { d as defineCustomElement$1 } from './p-
|
|
3
|
+
import { d as defineCustomElement$1 } from './p-a32f9097.js';
|
|
4
4
|
|
|
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}: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}";
|
|
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}";
|
|
6
6
|
const TdsDropdownOptionStyle0 = dropdownOptionCss;
|
|
7
7
|
|
|
8
8
|
const TdsDropdownOption = /*@__PURE__*/ proxyCustomElement(class TdsDropdownOption extends H {
|
|
@@ -71,7 +71,7 @@ const TdsDropdownOption = /*@__PURE__*/ proxyCustomElement(class TdsDropdownOpti
|
|
|
71
71
|
this.selected = selected;
|
|
72
72
|
}
|
|
73
73
|
render() {
|
|
74
|
-
return (h(Host, { key: '
|
|
74
|
+
return (h(Host, { key: '98f57bb76aa504cbacbd40cbd1c76648f678b58f', role: "option", "aria-disabled": this.disabled, "aria-selected": this.selected }, h("div", { key: 'd22f24e290fc61c14c8b9ca1c908bafd466f6d97', class: `dropdown-option
|
|
75
75
|
${this.size}
|
|
76
76
|
${this.selected ? 'selected' : ''}
|
|
77
77
|
${this.disabled ? 'disabled' : ''}
|
|
@@ -91,7 +91,7 @@ const TdsDropdownOption = /*@__PURE__*/ proxyCustomElement(class TdsDropdownOpti
|
|
|
91
91
|
get host() { return this; }
|
|
92
92
|
static get style() { return TdsDropdownOptionStyle0; }
|
|
93
93
|
}, [17, "tds-dropdown-option", {
|
|
94
|
-
"value": [
|
|
94
|
+
"value": [8],
|
|
95
95
|
"disabled": [4],
|
|
96
96
|
"selected": [32],
|
|
97
97
|
"multiselect": [32],
|