@scania/tegel 1.8.0 → 1.8.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-body-cell.cjs.entry.js +15 -4
- package/dist/cjs/tds-dropdown.cjs.entry.js +39 -25
- package/dist/cjs/tds-header-cell.cjs.entry.js +1 -1
- package/dist/cjs/tds-header-dropdown.cjs.entry.js +10 -4
- package/dist/cjs/tds-header-launcher.cjs.entry.js +4 -8
- package/dist/cjs/tds-popover-core.cjs.entry.js +15 -5
- package/dist/cjs/tegel.cjs.js +1 -1
- package/dist/collection/components/dropdown/dropdown.js +39 -25
- package/dist/collection/components/header/header-dropdown/header-dropdown.js +10 -4
- package/dist/collection/components/header/header-launcher/header-launcher.js +4 -8
- package/dist/collection/components/popover-core/popover-core.js +22 -6
- package/dist/collection/components/table/table-body-cell/table-body-cell.css +0 -4
- package/dist/collection/components/table/table-body-cell/table-body-cell.js +14 -3
- package/dist/collection/components/table/table-header-cell/table-header-cell.css +1 -1
- package/dist/components/popover-core.js +16 -6
- package/dist/components/tds-body-cell.js +15 -4
- package/dist/components/tds-dropdown.js +39 -25
- package/dist/components/tds-header-cell.js +1 -1
- package/dist/components/tds-header-dropdown.js +10 -4
- package/dist/components/tds-header-launcher.js +4 -8
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tds-body-cell.entry.js +15 -4
- package/dist/esm/tds-dropdown.entry.js +39 -25
- package/dist/esm/tds-header-cell.entry.js +1 -1
- package/dist/esm/tds-header-dropdown.entry.js +10 -4
- package/dist/esm/tds-header-launcher.entry.js +4 -8
- package/dist/esm/tds-popover-core.entry.js +15 -5
- package/dist/esm/tegel.js +1 -1
- package/dist/tegel/p-05704939.entry.js +1 -0
- package/dist/tegel/p-1fcf69c3.entry.js +1 -0
- package/dist/tegel/p-a06e00e1.entry.js +1 -0
- package/dist/tegel/p-d362d26c.entry.js +1 -0
- package/dist/tegel/{p-052901a5.entry.js → p-dd082e5f.entry.js} +1 -1
- package/dist/tegel/p-e12e62cf.entry.js +1 -0
- package/dist/tegel/tegel.esm.js +1 -1
- package/dist/types/components/dropdown/dropdown.d.ts +2 -0
- package/dist/types/components/header/header-dropdown/header-dropdown.d.ts +1 -0
- package/dist/types/components/popover-core/popover-core.d.ts +4 -2
- package/package.json +1 -1
- package/dist/tegel/p-450eabc1.entry.js +0 -1
- package/dist/tegel/p-50b0f2ff.entry.js +0 -1
- package/dist/tegel/p-540a83e5.entry.js +0 -1
- package/dist/tegel/p-669f7646.entry.js +0 -1
- package/dist/tegel/p-ebbe0131.entry.js +0 -1
|
@@ -8,29 +8,41 @@ import appendHiddenInput from "../../utils/appendHiddenInput";
|
|
|
8
8
|
export class TdsDropdown {
|
|
9
9
|
constructor() {
|
|
10
10
|
this.setDefaultOption = () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
// Ensure this.host.children is not empty
|
|
12
|
+
if (this.host.children.length === 0) {
|
|
13
|
+
console.warn('TDS DROPDOWN: Data missing. Disregard if loading data asynchronously.');
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (this.defaultValue) {
|
|
17
|
+
const children = Array.from(this.host.children).filter((element) => element.tagName === 'TDS-DROPDOWN-OPTION');
|
|
18
|
+
let matched = false;
|
|
19
|
+
children.forEach((element) => {
|
|
20
|
+
if (this.multiselect) {
|
|
21
|
+
this.defaultValue.split(',').forEach((value) => {
|
|
22
|
+
if (value === element.value) {
|
|
23
|
+
element.setSelected(true);
|
|
24
|
+
this.value = this.value ? [...this.value, element.value] : [element.value];
|
|
25
|
+
matched = true;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
26
28
|
}
|
|
27
29
|
else {
|
|
28
|
-
element.
|
|
30
|
+
if (this.defaultValue === element.value) {
|
|
31
|
+
element.setSelected(true);
|
|
32
|
+
this.value = [element.value];
|
|
33
|
+
matched = true;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
element.setSelected(false);
|
|
37
|
+
}
|
|
29
38
|
}
|
|
39
|
+
this.setValueAttribute();
|
|
40
|
+
return element;
|
|
41
|
+
});
|
|
42
|
+
if (!matched) {
|
|
43
|
+
console.warn(`TDS DROPDOWN: No matching option found for defaultValue "${this.defaultValue}"`);
|
|
30
44
|
}
|
|
31
|
-
|
|
32
|
-
return element;
|
|
33
|
-
});
|
|
45
|
+
}
|
|
34
46
|
};
|
|
35
47
|
/* Returns a list of all children that are tds-dropdown-option elements */
|
|
36
48
|
this.getChildren = () => {
|
|
@@ -300,9 +312,11 @@ export class TdsDropdown {
|
|
|
300
312
|
}
|
|
301
313
|
}
|
|
302
314
|
componentWillLoad() {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
315
|
+
this.setDefaultOption();
|
|
316
|
+
}
|
|
317
|
+
/** Method to handle slot changes */
|
|
318
|
+
handleSlotChange() {
|
|
319
|
+
this.setDefaultOption();
|
|
306
320
|
}
|
|
307
321
|
/** Method to check if we should normalize text */
|
|
308
322
|
normalizeString(text) {
|
|
@@ -335,7 +349,7 @@ export class TdsDropdown {
|
|
|
335
349
|
render() {
|
|
336
350
|
var _a, _b, _c, _d;
|
|
337
351
|
appendHiddenInput(this.host, this.name, (_a = this.value) === null || _a === void 0 ? void 0 : _a.map((value) => value).toString(), this.disabled);
|
|
338
|
-
return (h(Host, { key: '
|
|
352
|
+
return (h(Host, { key: '451edf7c5eaa096500d8d989bd9cddc60a5fd5d8', role: "select", class: `${this.modeVariant ? `tds-mode-variant-${this.modeVariant}` : ''}` }, this.label && this.labelPosition === 'outside' && (h("div", { class: `label-outside ${this.disabled ? 'disabled' : ''}` }, this.label)), h("div", { key: 'c7e3d77ba79b6e135aa960bc8e56c2d41ae3ec2e', class: `dropdown-select ${this.size} ${this.disabled ? 'disabled' : ''}` }, this.filter ? (h("div", { class: {
|
|
339
353
|
filter: true,
|
|
340
354
|
focus: this.filterFocus,
|
|
341
355
|
disabled: this.disabled,
|
|
@@ -378,11 +392,11 @@ export class TdsDropdown {
|
|
|
378
392
|
label-inside-as-placeholder
|
|
379
393
|
${this.size}
|
|
380
394
|
${((_c = this.value) === null || _c === void 0 ? void 0 : _c.length) ? 'selected' : ''}
|
|
381
|
-
` }, 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: '
|
|
395
|
+
` }, 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: 'cd63a354addfbcbfb2bb355b1e053b93dd9d3864', ref: (element) => (this.dropdownList = element), class: `dropdown-list
|
|
382
396
|
${this.size}
|
|
383
397
|
${this.open ? 'open' : 'closed'}
|
|
384
398
|
${this.getOpenDirection()}
|
|
385
|
-
${this.label && this.labelPosition === 'outside' ? 'label-outside' : ''}` }, h("slot", { key: '
|
|
399
|
+
${this.label && this.labelPosition === 'outside' ? 'label-outside' : ''}` }, h("slot", { key: '9a4feeed475bde225d19e01f17e4eadc292c6f41', onSlotchange: () => this.handleSlotChange() }), this.filterResult === 0 && this.noResultText !== '' && (h("div", { class: `no-result ${this.size}` }, this.noResultText))), this.helper && (h("div", { class: `helper ${this.error ? 'error' : ''} ${this.disabled ? 'disabled' : ''}` }, this.error && h("tds-icon", { name: "error", size: "16px" }), this.helper))));
|
|
386
400
|
}
|
|
387
401
|
static get is() { return "tds-dropdown"; }
|
|
388
402
|
static get encapsulation() { return "shadow"; }
|
|
@@ -8,6 +8,12 @@ import generateUniqueId from "../../../utils/generateUniqueId";
|
|
|
8
8
|
export class TdsHeaderDropdown {
|
|
9
9
|
constructor() {
|
|
10
10
|
this.uuid = generateUniqueId();
|
|
11
|
+
this.handleSlottedItemClick = (event) => {
|
|
12
|
+
const eventSource = event.target.tagName.toLowerCase();
|
|
13
|
+
if (['a', 'button'].includes(eventSource)) {
|
|
14
|
+
this.open = false;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
11
17
|
this.label = undefined;
|
|
12
18
|
this.noDropdownIcon = false;
|
|
13
19
|
this.selected = false;
|
|
@@ -25,20 +31,20 @@ export class TdsHeaderDropdown {
|
|
|
25
31
|
this.open = !this.open;
|
|
26
32
|
}
|
|
27
33
|
render() {
|
|
28
|
-
return (h(Host, { key: '
|
|
34
|
+
return (h(Host, { key: 'd72add7a12c105e83c0300dc4c6727775dfe10e5' }, h("div", { key: 'b323560bd8b13b6643eafca2ad9deb9bea53689e', class: {
|
|
29
35
|
'state-open': this.open,
|
|
30
|
-
} }, h("tds-header-item", { key: '
|
|
36
|
+
} }, h("tds-header-item", { key: '48af537f7b05f31fcbcb0c0aae311d2ccd69819d', class: "button", active: this.open, selected: this.selected }, h("button", { key: '324b1965706b0a3413c9e8ddcc37345c387519cc', ref: (el) => {
|
|
31
37
|
this.buttonEl = el;
|
|
32
38
|
}, "aria-expanded": `${this.open}`, "aria-controls": `launcher-${this.uuid}`, "aria-current": this.selected ? 'location' : 'false', onClick: () => {
|
|
33
39
|
this.toggleDropdown();
|
|
34
|
-
} }, h("slot", { key: '
|
|
40
|
+
} }, h("slot", { key: '56a3064075c135677f59e58c4be831c66230a7c2', name: "icon" }), this.label, h("slot", { key: '729e1901342405daf3655dac940310e64e6683f0', name: "label" }), !this.noDropdownIcon && (h("tds-icon", { class: "dropdown-icon", name: "chevron_down", size: "16px" })))), this.buttonEl && (h("tds-popover-canvas", { id: `tds-dropdown-${this.uuid}`, class: "menu", referenceEl: this.buttonEl, placement: "bottom-start", show: this.open, offsetDistance: 0, modifiers: [
|
|
35
41
|
{
|
|
36
42
|
name: 'flip',
|
|
37
43
|
options: {
|
|
38
44
|
fallbackPlacements: [],
|
|
39
45
|
},
|
|
40
46
|
},
|
|
41
|
-
] }, this.open ? h("slot", null) : null)))));
|
|
47
|
+
] }, this.open ? (h("span", { onClick: (e) => this.handleSlottedItemClick(e), onKeyDown: (e) => e.key === 'Enter' && this.handleSlottedItemClick(e) }, h("slot", null))) : null)))));
|
|
42
48
|
}
|
|
43
49
|
static get is() { return "tds-header-dropdown"; }
|
|
44
50
|
static get encapsulation() { return "shadow"; }
|
|
@@ -19,12 +19,8 @@ export class TdsHeaderLauncher {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
componentDidLoad() {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const hasListTypeMenu = slottedElements.some((element) => element.tagName.toLowerCase() === 'tds-header-launcher-list');
|
|
25
|
-
if (hasListTypeMenu) {
|
|
26
|
-
this.hasListTypeMenu = true;
|
|
27
|
-
}
|
|
22
|
+
const hasListTypeMenu = !!this.host.querySelector('tds-header-launcher-list');
|
|
23
|
+
this.hasListTypeMenu = hasListTypeMenu;
|
|
28
24
|
}
|
|
29
25
|
toggleLauncher() {
|
|
30
26
|
this.open = !this.open;
|
|
@@ -36,11 +32,11 @@ export class TdsHeaderLauncher {
|
|
|
36
32
|
}, 'ref': (el) => {
|
|
37
33
|
this.buttonEl = el;
|
|
38
34
|
} });
|
|
39
|
-
return (h(Host, { key: '
|
|
35
|
+
return (h(Host, { key: '337abddb77f5d7b2ce7c1a8bcfe2dd5e60cc934c' }, h("div", { key: '3652f71bd52be2fcbae7bfde3dab0b0c1c0c5d56', class: {
|
|
40
36
|
'wrapper': true,
|
|
41
37
|
'state-open': this.open,
|
|
42
38
|
'state-list-type-menu': this.hasListTypeMenu,
|
|
43
|
-
} }, h("tds-header-launcher-button", Object.assign({ key: '
|
|
39
|
+
} }, h("tds-header-launcher-button", Object.assign({ key: 'ffae6f54b57dcc0c44fae751f9da1025512b8f4b' }, buttonAttributes)), this.buttonEl && (h("tds-popover-canvas", { id: `tds-launcher-${this.uuid}`, class: "menu", referenceEl: this.buttonEl, placement: "bottom-start", show: this.open, offsetDistance: 0, modifiers: [
|
|
44
40
|
{
|
|
45
41
|
name: 'flip',
|
|
46
42
|
options: {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Host, h, } from "@stencil/core";
|
|
2
2
|
import { createPopper } from "@popperjs/core";
|
|
3
|
+
import generateUniqueId from "../../utils/generateUniqueId";
|
|
3
4
|
export class TdsPopoverCore {
|
|
4
5
|
constructor() {
|
|
6
|
+
this.uuid = generateUniqueId();
|
|
5
7
|
this.setIsShown = function setIsShown(isShown) {
|
|
6
8
|
if (typeof isShown === 'function') {
|
|
7
9
|
this.isShown = isShown(this.isShown);
|
|
@@ -10,10 +12,10 @@ export class TdsPopoverCore {
|
|
|
10
12
|
this.isShown = isShown;
|
|
11
13
|
}
|
|
12
14
|
if (this.isShown) {
|
|
13
|
-
this.
|
|
15
|
+
this.internalTdsShow.emit();
|
|
14
16
|
}
|
|
15
17
|
else {
|
|
16
|
-
this.
|
|
18
|
+
this.internalTdsClose.emit();
|
|
17
19
|
}
|
|
18
20
|
}.bind(this);
|
|
19
21
|
this.onClickTarget = function onClickTarget(event) {
|
|
@@ -51,6 +53,14 @@ export class TdsPopoverCore {
|
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
}
|
|
56
|
+
onTdsShow(event) {
|
|
57
|
+
if (this.show === null) {
|
|
58
|
+
const target = event.target;
|
|
59
|
+
if (target.id !== `tds-popover-core-${this.uuid}`) {
|
|
60
|
+
this.setIsShown(false);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
54
64
|
/* To enable initial loading of a component if user controls show prop*/
|
|
55
65
|
componentWillLoad() {
|
|
56
66
|
this.setIsShown(this.show);
|
|
@@ -145,7 +155,7 @@ export class TdsPopoverCore {
|
|
|
145
155
|
if (this.autoHide) {
|
|
146
156
|
hostStyle = { display: this.isShown ? 'block' : 'none' };
|
|
147
157
|
}
|
|
148
|
-
return (h(Host, { key: '
|
|
158
|
+
return (h(Host, { key: '0d42974eadfea68c642b5d4a6e1206f2d41d79ea', style: hostStyle, id: `tds-popover-core-${this.uuid}` }, h("slot", { key: '7f44ef8ccc3b4e8028cc1c612fb9102bfa84ff39' })));
|
|
149
159
|
}
|
|
150
160
|
static get is() { return "tds-popover-core"; }
|
|
151
161
|
static get encapsulation() { return "scoped"; }
|
|
@@ -336,9 +346,9 @@ export class TdsPopoverCore {
|
|
|
336
346
|
}
|
|
337
347
|
static get events() {
|
|
338
348
|
return [{
|
|
339
|
-
"method": "
|
|
349
|
+
"method": "internalTdsShow",
|
|
340
350
|
"name": "internalTdsShow",
|
|
341
|
-
"bubbles":
|
|
351
|
+
"bubbles": true,
|
|
342
352
|
"cancelable": false,
|
|
343
353
|
"composed": false,
|
|
344
354
|
"docs": {
|
|
@@ -354,7 +364,7 @@ export class TdsPopoverCore {
|
|
|
354
364
|
"references": {}
|
|
355
365
|
}
|
|
356
366
|
}, {
|
|
357
|
-
"method": "
|
|
367
|
+
"method": "internalTdsClose",
|
|
358
368
|
"name": "internalTdsClose",
|
|
359
369
|
"bubbles": false,
|
|
360
370
|
"cancelable": false,
|
|
@@ -393,6 +403,12 @@ export class TdsPopoverCore {
|
|
|
393
403
|
"target": "window",
|
|
394
404
|
"capture": false,
|
|
395
405
|
"passive": false
|
|
406
|
+
}, {
|
|
407
|
+
"name": "internalTdsShow",
|
|
408
|
+
"method": "onTdsShow",
|
|
409
|
+
"target": "window",
|
|
410
|
+
"capture": false,
|
|
411
|
+
"passive": false
|
|
396
412
|
}];
|
|
397
413
|
}
|
|
398
414
|
}
|
|
@@ -69,14 +69,25 @@ export class TdsTableBodyCell {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
render() {
|
|
72
|
-
|
|
72
|
+
let paddingStyle = 'var(--tds-spacing-element-16)'; // Default padding
|
|
73
|
+
if (this.disablePadding) {
|
|
74
|
+
paddingStyle = '0';
|
|
75
|
+
}
|
|
76
|
+
else if (this.compactDesign) {
|
|
77
|
+
paddingStyle = 'var(--tds-spacing-element-8) var(--tds-spacing-element-16)';
|
|
78
|
+
}
|
|
79
|
+
const dynamicStyles = {
|
|
80
|
+
textAlign: this.textAlignState,
|
|
81
|
+
// Conditionally set padding style
|
|
82
|
+
padding: paddingStyle,
|
|
83
|
+
};
|
|
84
|
+
return (h(Host, { key: '56fe770734dd720139eb614489283e2ec81cc596', class: {
|
|
73
85
|
'tds-table__body-cell': true,
|
|
74
86
|
'tds-table__body-cell--hover': this.activeSorting,
|
|
75
87
|
'tds-table__compact': this.compactDesign,
|
|
76
88
|
'tds-table--divider': this.verticalDividers,
|
|
77
89
|
'tds-table--no-min-width': this.noMinWidth,
|
|
78
|
-
|
|
79
|
-
}, style: { textAlign: this.textAlignState } }, this.cellValue, h("slot", { key: '41cfdbf142362f1dd298ed9f4c622775d543b64b' })));
|
|
90
|
+
}, style: dynamicStyles }, this.cellValue, h("slot", { key: '490a5caabb4a2ae94769875edb0743b474716e42' })));
|
|
80
91
|
}
|
|
81
92
|
static get is() { return "tds-body-cell"; }
|
|
82
93
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement as HTMLElement$1, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { g as generateUniqueId } from './generateUniqueId.js';
|
|
2
3
|
|
|
3
4
|
var top = 'top';
|
|
4
5
|
var bottom = 'bottom';
|
|
@@ -1795,8 +1796,9 @@ const TdsPopoverCore = /*@__PURE__*/ proxyCustomElement(class TdsPopoverCore ext
|
|
|
1795
1796
|
constructor() {
|
|
1796
1797
|
super();
|
|
1797
1798
|
this.__registerHost();
|
|
1798
|
-
this.
|
|
1799
|
-
this.
|
|
1799
|
+
this.internalTdsShow = createEvent(this, "internalTdsShow", 4);
|
|
1800
|
+
this.internalTdsClose = createEvent(this, "internalTdsClose", 0);
|
|
1801
|
+
this.uuid = generateUniqueId();
|
|
1800
1802
|
this.setIsShown = function setIsShown(isShown) {
|
|
1801
1803
|
if (typeof isShown === 'function') {
|
|
1802
1804
|
this.isShown = isShown(this.isShown);
|
|
@@ -1805,10 +1807,10 @@ const TdsPopoverCore = /*@__PURE__*/ proxyCustomElement(class TdsPopoverCore ext
|
|
|
1805
1807
|
this.isShown = isShown;
|
|
1806
1808
|
}
|
|
1807
1809
|
if (this.isShown) {
|
|
1808
|
-
this.
|
|
1810
|
+
this.internalTdsShow.emit();
|
|
1809
1811
|
}
|
|
1810
1812
|
else {
|
|
1811
|
-
this.
|
|
1813
|
+
this.internalTdsClose.emit();
|
|
1812
1814
|
}
|
|
1813
1815
|
}.bind(this);
|
|
1814
1816
|
this.onClickTarget = function onClickTarget(event) {
|
|
@@ -1846,6 +1848,14 @@ const TdsPopoverCore = /*@__PURE__*/ proxyCustomElement(class TdsPopoverCore ext
|
|
|
1846
1848
|
}
|
|
1847
1849
|
}
|
|
1848
1850
|
}
|
|
1851
|
+
onTdsShow(event) {
|
|
1852
|
+
if (this.show === null) {
|
|
1853
|
+
const target = event.target;
|
|
1854
|
+
if (target.id !== `tds-popover-core-${this.uuid}`) {
|
|
1855
|
+
this.setIsShown(false);
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1849
1859
|
/* To enable initial loading of a component if user controls show prop*/
|
|
1850
1860
|
componentWillLoad() {
|
|
1851
1861
|
this.setIsShown(this.show);
|
|
@@ -1940,7 +1950,7 @@ const TdsPopoverCore = /*@__PURE__*/ proxyCustomElement(class TdsPopoverCore ext
|
|
|
1940
1950
|
if (this.autoHide) {
|
|
1941
1951
|
hostStyle = { display: this.isShown ? 'block' : 'none' };
|
|
1942
1952
|
}
|
|
1943
|
-
return (h(Host, { key: '
|
|
1953
|
+
return (h(Host, { key: '0d42974eadfea68c642b5d4a6e1206f2d41d79ea', style: hostStyle, id: `tds-popover-core-${this.uuid}` }, h("slot", { key: '7f44ef8ccc3b4e8028cc1c612fb9102bfa84ff39' })));
|
|
1944
1954
|
}
|
|
1945
1955
|
get host() { return this; }
|
|
1946
1956
|
static get watchers() { return {
|
|
@@ -1962,7 +1972,7 @@ const TdsPopoverCore = /*@__PURE__*/ proxyCustomElement(class TdsPopoverCore ext
|
|
|
1962
1972
|
"popperInstance": [32],
|
|
1963
1973
|
"target": [32],
|
|
1964
1974
|
"isShown": [32]
|
|
1965
|
-
}, [[8, "click", "onAnyClick"]], {
|
|
1975
|
+
}, [[8, "click", "onAnyClick"], [8, "internalTdsShow", "onTdsShow"]], {
|
|
1966
1976
|
"show": ["onShowChange"],
|
|
1967
1977
|
"referenceEl": ["onReferenceElChanged"],
|
|
1968
1978
|
"trigger": ["onTriggerChanged"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
|
|
3
|
-
const tableBodyCellCss = ":host(.tds-table__body-cell){box-sizing:border-box;font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls);display:table-cell;box-sizing:border-box;color:var(--tds-table-color);padding:var(--tds-spacing-element-16);min-width:192px;vertical-align:top;background-color:transparent;transition:background-color 200ms ease}:host(.tds-table__body-cell) *{box-sizing:border-box}:host(.tds-table__body-cell--
|
|
3
|
+
const tableBodyCellCss = ":host(.tds-table__body-cell){box-sizing:border-box;font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls);display:table-cell;box-sizing:border-box;color:var(--tds-table-color);padding:var(--tds-spacing-element-16);min-width:192px;vertical-align:top;background-color:transparent;transition:background-color 200ms ease}:host(.tds-table__body-cell) *{box-sizing:border-box}:host(.tds-table__body-cell--hover){background-color:var(--tds-table-body-cell-background-hover)}:host(.tds-table__compact){padding:var(--tds-spacing-element-8) var(--tds-spacing-element-16)}:host(.tds-table--divider){border-right:1px solid var(--tds-table-divider)}:host(.tds-table--divider:last-of-type){border-right:none}:host(.tds-table--no-min-width){min-width:unset}";
|
|
4
4
|
const TdsBodyCellStyle0 = tableBodyCellCss;
|
|
5
5
|
|
|
6
6
|
const relevantTableProps = [
|
|
@@ -73,14 +73,25 @@ const TdsTableBodyCell = /*@__PURE__*/ proxyCustomElement(class TdsTableBodyCell
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
render() {
|
|
76
|
-
|
|
76
|
+
let paddingStyle = 'var(--tds-spacing-element-16)'; // Default padding
|
|
77
|
+
if (this.disablePadding) {
|
|
78
|
+
paddingStyle = '0';
|
|
79
|
+
}
|
|
80
|
+
else if (this.compactDesign) {
|
|
81
|
+
paddingStyle = 'var(--tds-spacing-element-8) var(--tds-spacing-element-16)';
|
|
82
|
+
}
|
|
83
|
+
const dynamicStyles = {
|
|
84
|
+
textAlign: this.textAlignState,
|
|
85
|
+
// Conditionally set padding style
|
|
86
|
+
padding: paddingStyle,
|
|
87
|
+
};
|
|
88
|
+
return (h(Host, { key: '56fe770734dd720139eb614489283e2ec81cc596', class: {
|
|
77
89
|
'tds-table__body-cell': true,
|
|
78
90
|
'tds-table__body-cell--hover': this.activeSorting,
|
|
79
91
|
'tds-table__compact': this.compactDesign,
|
|
80
92
|
'tds-table--divider': this.verticalDividers,
|
|
81
93
|
'tds-table--no-min-width': this.noMinWidth,
|
|
82
|
-
|
|
83
|
-
}, style: { textAlign: this.textAlignState } }, this.cellValue, h("slot", { key: '41cfdbf142362f1dd298ed9f4c622775d543b64b' })));
|
|
94
|
+
}, style: dynamicStyles }, this.cellValue, h("slot", { key: '490a5caabb4a2ae94769875edb0743b474716e42' })));
|
|
84
95
|
}
|
|
85
96
|
get host() { return this; }
|
|
86
97
|
static get style() { return TdsBodyCellStyle0; }
|
|
@@ -72,29 +72,41 @@ const TdsDropdown$1 = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends
|
|
|
72
72
|
this.tdsBlur = createEvent(this, "tdsBlur", 6);
|
|
73
73
|
this.tdsInput = createEvent(this, "tdsInput", 6);
|
|
74
74
|
this.setDefaultOption = () => {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
75
|
+
// Ensure this.host.children is not empty
|
|
76
|
+
if (this.host.children.length === 0) {
|
|
77
|
+
console.warn('TDS DROPDOWN: Data missing. Disregard if loading data asynchronously.');
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (this.defaultValue) {
|
|
81
|
+
const children = Array.from(this.host.children).filter((element) => element.tagName === 'TDS-DROPDOWN-OPTION');
|
|
82
|
+
let matched = false;
|
|
83
|
+
children.forEach((element) => {
|
|
84
|
+
if (this.multiselect) {
|
|
85
|
+
this.defaultValue.split(',').forEach((value) => {
|
|
86
|
+
if (value === element.value) {
|
|
87
|
+
element.setSelected(true);
|
|
88
|
+
this.value = this.value ? [...this.value, element.value] : [element.value];
|
|
89
|
+
matched = true;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
90
92
|
}
|
|
91
93
|
else {
|
|
92
|
-
element.
|
|
94
|
+
if (this.defaultValue === element.value) {
|
|
95
|
+
element.setSelected(true);
|
|
96
|
+
this.value = [element.value];
|
|
97
|
+
matched = true;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
element.setSelected(false);
|
|
101
|
+
}
|
|
93
102
|
}
|
|
103
|
+
this.setValueAttribute();
|
|
104
|
+
return element;
|
|
105
|
+
});
|
|
106
|
+
if (!matched) {
|
|
107
|
+
console.warn(`TDS DROPDOWN: No matching option found for defaultValue "${this.defaultValue}"`);
|
|
94
108
|
}
|
|
95
|
-
|
|
96
|
-
return element;
|
|
97
|
-
});
|
|
109
|
+
}
|
|
98
110
|
};
|
|
99
111
|
/* Returns a list of all children that are tds-dropdown-option elements */
|
|
100
112
|
this.getChildren = () => {
|
|
@@ -364,9 +376,11 @@ const TdsDropdown$1 = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends
|
|
|
364
376
|
}
|
|
365
377
|
}
|
|
366
378
|
componentWillLoad() {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
379
|
+
this.setDefaultOption();
|
|
380
|
+
}
|
|
381
|
+
/** Method to handle slot changes */
|
|
382
|
+
handleSlotChange() {
|
|
383
|
+
this.setDefaultOption();
|
|
370
384
|
}
|
|
371
385
|
/** Method to check if we should normalize text */
|
|
372
386
|
normalizeString(text) {
|
|
@@ -399,7 +413,7 @@ const TdsDropdown$1 = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends
|
|
|
399
413
|
render() {
|
|
400
414
|
var _a, _b, _c, _d;
|
|
401
415
|
appendHiddenInput(this.host, this.name, (_a = this.value) === null || _a === void 0 ? void 0 : _a.map((value) => value).toString(), this.disabled);
|
|
402
|
-
return (h(Host, { key: '
|
|
416
|
+
return (h(Host, { key: '451edf7c5eaa096500d8d989bd9cddc60a5fd5d8', role: "select", class: `${this.modeVariant ? `tds-mode-variant-${this.modeVariant}` : ''}` }, this.label && this.labelPosition === 'outside' && (h("div", { class: `label-outside ${this.disabled ? 'disabled' : ''}` }, this.label)), h("div", { key: 'c7e3d77ba79b6e135aa960bc8e56c2d41ae3ec2e', class: `dropdown-select ${this.size} ${this.disabled ? 'disabled' : ''}` }, this.filter ? (h("div", { class: {
|
|
403
417
|
filter: true,
|
|
404
418
|
focus: this.filterFocus,
|
|
405
419
|
disabled: this.disabled,
|
|
@@ -442,11 +456,11 @@ const TdsDropdown$1 = /*@__PURE__*/ proxyCustomElement(class TdsDropdown extends
|
|
|
442
456
|
label-inside-as-placeholder
|
|
443
457
|
${this.size}
|
|
444
458
|
${((_c = this.value) === null || _c === void 0 ? void 0 : _c.length) ? 'selected' : ''}
|
|
445
|
-
` }, 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: '
|
|
459
|
+
` }, 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: 'cd63a354addfbcbfb2bb355b1e053b93dd9d3864', ref: (element) => (this.dropdownList = element), class: `dropdown-list
|
|
446
460
|
${this.size}
|
|
447
461
|
${this.open ? 'open' : 'closed'}
|
|
448
462
|
${this.getOpenDirection()}
|
|
449
|
-
${this.label && this.labelPosition === 'outside' ? 'label-outside' : ''}` }, h("slot", { key: '
|
|
463
|
+
${this.label && this.labelPosition === 'outside' ? 'label-outside' : ''}` }, h("slot", { key: '9a4feeed475bde225d19e01f17e4eadc292c6f41', onSlotchange: () => this.handleSlotChange() }), this.filterResult === 0 && this.noResultText !== '' && (h("div", { class: `no-result ${this.size}` }, this.noResultText))), this.helper && (h("div", { class: `helper ${this.error ? 'error' : ''} ${this.disabled ? 'disabled' : ''}` }, this.error && h("tds-icon", { name: "error", size: "16px" }), this.helper))));
|
|
450
464
|
}
|
|
451
465
|
get host() { return this; }
|
|
452
466
|
static get watchers() { return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
|
|
3
|
-
const tableHeaderCellCss = ":host(.tds-table__header-cell){box-sizing:border-box;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-header-background-hover);padding:0;height:48px;min-width:192px;box-sizing:border-box;vertical-align:middle;overflow:hidden;transition:background-color 200ms ease}:host(.tds-table__header-cell) *{box-sizing:border-box}:host(.tds-table__header-cell) .tds-table__header-text{padding:
|
|
3
|
+
const tableHeaderCellCss = ":host(.tds-table__header-cell){box-sizing:border-box;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-header-background-hover);padding:0;height:48px;min-width:192px;box-sizing:border-box;vertical-align:middle;overflow:hidden;transition:background-color 200ms ease}:host(.tds-table__header-cell) *{box-sizing:border-box}:host(.tds-table__header-cell) .tds-table__header-text{padding:8px 16px;margin:0}:host(.tds-table__header-cell--sortable) .tds-table__header-button{display:flex;align-items:center;gap:8px;justify-content:start;flex-direction:row;width:100%;height:100%;padding:0 16px;background-color:transparent;border:none;cursor:pointer;transition:background-color 200ms ease}:host(.tds-table__header-cell--sortable) .tds-table__header-button:focus{outline:2px solid var(--tds-table-header-btn-focus);outline-offset:-2px}:host(.tds-table__header-cell--sortable) .tds-table__header-button:focus .tds-table__header-button-icon{opacity:1}:host(.tds-table__header-cell--sortable) .tds-table__header-button .tds-table__header-button-text{font:var(--tds-headline-07);letter-spacing:var(--tds-headline-07-ls);text-align:left;color:var(--tds-table-header-btn-color)}:host(.tds-table__header-cell--sortable) .tds-table__header-button .tds-table__header-button-icon{flex:0 0 16px;height:16px;width:16px;opacity:0;transform-origin:center;transition:opacity 200ms ease-in, transform 200ms ease;fill:var(--tds-table-color)}:host(.tds-table__header-cell--sortable) .tds-table__header-button:hover .tds-table__header-button-icon{opacity:1}:host(.tds-table__header-cell--is-sorted) .tds-table__header-button{background-color:var(--tds-table-header-btn-background)}:host(.tds-table__header-cell--is-sorted) .tds-table__header-button:hover{background-color:var(--tds-table-header-btn-background-hover)}:host(.tds-table__header-cell--is-sorted) .tds-table__header-button .tds-table__header-button-icon{opacity:1}:host(.tds-table__header-cell--is-sorted) .tds-table__header-button .tds-table__header-button-icon--rotate{transform:rotate(180deg)}:host(.tds-table--compact){height:33px}:host(.tds-table--divider){border-right:1px solid var(--tds-table-divider)}:host(.tds-table--divider:last-of-type){border-right:none}:host(.tds-table--no-min-width){min-width:unset}:host(.tds-table__header-cell:first-of-type){border-top-left-radius:4px}:host(.tds-table__header-cell:last-of-type){border-top-right-radius:4px}:host(.tds-table--extra-column:first-of-type){border-top-left-radius:0}:host(.tds-table--toolbar-available){border-radius:0}:host(.tds-table--extra-column.tds-table--toolbar-available){border-radius:0}:host(.tds-table__header-cell.tds-table--toolbar-available:first-of-type){border-top-left-radius:0}:host(.tds-table__header-cell.tds-table--toolbar-available:last-of-type){border-top-right-radius:0}";
|
|
4
4
|
const TdsHeaderCellStyle0 = tableHeaderCellCss;
|
|
5
5
|
|
|
6
6
|
const relevantTableProps = [
|
|
@@ -15,6 +15,12 @@ const TdsHeaderDropdown$1 = /*@__PURE__*/ proxyCustomElement(class TdsHeaderDrop
|
|
|
15
15
|
this.__registerHost();
|
|
16
16
|
this.__attachShadow();
|
|
17
17
|
this.uuid = generateUniqueId();
|
|
18
|
+
this.handleSlottedItemClick = (event) => {
|
|
19
|
+
const eventSource = event.target.tagName.toLowerCase();
|
|
20
|
+
if (['a', 'button'].includes(eventSource)) {
|
|
21
|
+
this.open = false;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
18
24
|
this.label = undefined;
|
|
19
25
|
this.noDropdownIcon = false;
|
|
20
26
|
this.selected = false;
|
|
@@ -32,20 +38,20 @@ const TdsHeaderDropdown$1 = /*@__PURE__*/ proxyCustomElement(class TdsHeaderDrop
|
|
|
32
38
|
this.open = !this.open;
|
|
33
39
|
}
|
|
34
40
|
render() {
|
|
35
|
-
return (h(Host, { key: '
|
|
41
|
+
return (h(Host, { key: 'd72add7a12c105e83c0300dc4c6727775dfe10e5' }, h("div", { key: 'b323560bd8b13b6643eafca2ad9deb9bea53689e', class: {
|
|
36
42
|
'state-open': this.open,
|
|
37
|
-
} }, h("tds-header-item", { key: '
|
|
43
|
+
} }, h("tds-header-item", { key: '48af537f7b05f31fcbcb0c0aae311d2ccd69819d', class: "button", active: this.open, selected: this.selected }, h("button", { key: '324b1965706b0a3413c9e8ddcc37345c387519cc', ref: (el) => {
|
|
38
44
|
this.buttonEl = el;
|
|
39
45
|
}, "aria-expanded": `${this.open}`, "aria-controls": `launcher-${this.uuid}`, "aria-current": this.selected ? 'location' : 'false', onClick: () => {
|
|
40
46
|
this.toggleDropdown();
|
|
41
|
-
} }, h("slot", { key: '
|
|
47
|
+
} }, h("slot", { key: '56a3064075c135677f59e58c4be831c66230a7c2', name: "icon" }), this.label, h("slot", { key: '729e1901342405daf3655dac940310e64e6683f0', name: "label" }), !this.noDropdownIcon && (h("tds-icon", { class: "dropdown-icon", name: "chevron_down", size: "16px" })))), this.buttonEl && (h("tds-popover-canvas", { id: `tds-dropdown-${this.uuid}`, class: "menu", referenceEl: this.buttonEl, placement: "bottom-start", show: this.open, offsetDistance: 0, modifiers: [
|
|
42
48
|
{
|
|
43
49
|
name: 'flip',
|
|
44
50
|
options: {
|
|
45
51
|
fallbackPlacements: [],
|
|
46
52
|
},
|
|
47
53
|
},
|
|
48
|
-
] }, this.open ? h("slot", null) : null)))));
|
|
54
|
+
] }, this.open ? (h("span", { onClick: (e) => this.handleSlottedItemClick(e), onKeyDown: (e) => e.key === 'Enter' && this.handleSlottedItemClick(e) }, h("slot", null))) : null)))));
|
|
49
55
|
}
|
|
50
56
|
get host() { return this; }
|
|
51
57
|
static get style() { return TdsHeaderDropdownStyle0; }
|
|
@@ -29,12 +29,8 @@ const TdsHeaderLauncher$1 = /*@__PURE__*/ proxyCustomElement(class TdsHeaderLaun
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
componentDidLoad() {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
const hasListTypeMenu = slottedElements.some((element) => element.tagName.toLowerCase() === 'tds-header-launcher-list');
|
|
35
|
-
if (hasListTypeMenu) {
|
|
36
|
-
this.hasListTypeMenu = true;
|
|
37
|
-
}
|
|
32
|
+
const hasListTypeMenu = !!this.host.querySelector('tds-header-launcher-list');
|
|
33
|
+
this.hasListTypeMenu = hasListTypeMenu;
|
|
38
34
|
}
|
|
39
35
|
toggleLauncher() {
|
|
40
36
|
this.open = !this.open;
|
|
@@ -46,11 +42,11 @@ const TdsHeaderLauncher$1 = /*@__PURE__*/ proxyCustomElement(class TdsHeaderLaun
|
|
|
46
42
|
}, 'ref': (el) => {
|
|
47
43
|
this.buttonEl = el;
|
|
48
44
|
} });
|
|
49
|
-
return (h(Host, { key: '
|
|
45
|
+
return (h(Host, { key: '337abddb77f5d7b2ce7c1a8bcfe2dd5e60cc934c' }, h("div", { key: '3652f71bd52be2fcbae7bfde3dab0b0c1c0c5d56', class: {
|
|
50
46
|
'wrapper': true,
|
|
51
47
|
'state-open': this.open,
|
|
52
48
|
'state-list-type-menu': this.hasListTypeMenu,
|
|
53
|
-
} }, h("tds-header-launcher-button", Object.assign({ key: '
|
|
49
|
+
} }, h("tds-header-launcher-button", Object.assign({ key: 'ffae6f54b57dcc0c44fae751f9da1025512b8f4b' }, buttonAttributes)), this.buttonEl && (h("tds-popover-canvas", { id: `tds-launcher-${this.uuid}`, class: "menu", referenceEl: this.buttonEl, placement: "bottom-start", show: this.open, offsetDistance: 0, modifiers: [
|
|
54
50
|
{
|
|
55
51
|
name: 'flip',
|
|
56
52
|
options: {
|