@scania/tegel 1.26.0 → 1.27.0-allow-numbers-and-zero-values-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/index-ca8040ad.js +4 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/tds-banner.cjs.entry.js +1 -1
- package/dist/cjs/tds-checkbox.cjs.entry.js +10 -3
- package/dist/cjs/tds-chip.cjs.entry.js +7 -2
- package/dist/cjs/tds-dropdown_2.cjs.entry.js +74 -45
- package/dist/cjs/tds-folder-tab.cjs.entry.js +21 -2
- package/dist/cjs/tds-folder-tabs.cjs.entry.js +4 -2
- package/dist/cjs/tds-icon.cjs.entry.js +1 -1
- package/dist/cjs/tds-inline-tab.cjs.entry.js +21 -2
- package/dist/cjs/tds-inline-tabs.cjs.entry.js +4 -2
- package/dist/cjs/tds-link.cjs.entry.js +17 -3
- package/dist/cjs/tds-message.cjs.entry.js +15 -3
- package/dist/cjs/tds-modal.cjs.entry.js +74 -2
- package/dist/cjs/tds-navigation-tab.cjs.entry.js +21 -2
- package/dist/cjs/tds-navigation-tabs.cjs.entry.js +6 -4
- package/dist/cjs/tds-popover-core.cjs.entry.js +1 -1
- package/dist/cjs/tds-text-field.cjs.entry.js +13 -7
- package/dist/cjs/tds-textarea.cjs.entry.js +21 -9
- package/dist/cjs/tds-toast.cjs.entry.js +4 -4
- package/dist/cjs/tds-toggle.cjs.entry.js +2 -2
- package/dist/cjs/tds-tooltip.cjs.entry.js +14 -4
- package/dist/cjs/tegel.cjs.js +1 -1
- package/dist/collection/components/banner/banner.css +1 -1
- package/dist/collection/components/banner/banner.js +1 -1
- package/dist/collection/components/checkbox/checkbox.js +44 -3
- package/dist/collection/components/chip/chip.js +24 -2
- package/dist/collection/components/dropdown/dropdown-option/dropdown-option.js +2 -2
- package/dist/collection/components/dropdown/dropdown.js +89 -43
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/icon/iconsArray.js +96 -1
- package/dist/collection/components/link/link.js +17 -3
- package/dist/collection/components/message/message.css +44 -26
- package/dist/collection/components/message/message.js +49 -2
- package/dist/collection/components/modal/modal.js +103 -3
- package/dist/collection/components/popover-core/tds-popover-core.css +596 -53
- package/dist/collection/components/tabs/folder-tabs/folder-tab/folder-tab.js +21 -2
- package/dist/collection/components/tabs/folder-tabs/folder-tabs.js +40 -2
- package/dist/collection/components/tabs/inline-tabs/inline-tab/inline-tab.js +21 -2
- package/dist/collection/components/tabs/inline-tabs/inline-tabs.js +40 -2
- package/dist/collection/components/tabs/navigation-tabs/navigation-tab/navigation-tab.js +21 -2
- package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.js +42 -4
- package/dist/collection/components/text-field/text-field.js +31 -8
- package/dist/collection/components/textarea/textarea.css +11 -6
- package/dist/collection/components/textarea/textarea.js +38 -8
- package/dist/collection/components/toast/toast.css +1 -1
- package/dist/collection/components/toast/toast.js +3 -3
- package/dist/collection/components/toggle/toggle.js +2 -2
- package/dist/collection/components/tooltip/tooltip.js +40 -4
- package/dist/collection/utils/axeHelpers.js +1 -1
- package/dist/components/{p-c65351ab.js → p-14ab9663.js} +12 -3
- package/dist/components/p-17338bcb.js +115 -0
- package/dist/components/{p-2a43e410.js → p-2d93a742.js} +5 -5
- package/dist/components/p-4487c541.js +65 -0
- package/dist/components/{p-29d19dc8.js → p-60ff84f2.js} +1 -1
- package/dist/components/{p-a64dc22e.js → p-797c8dce.js} +75 -45
- package/dist/components/{p-4c1e3344.js → p-83db8b35.js} +1 -1
- package/dist/components/{p-b1d21573.js → p-a1181b1f.js} +1 -1
- package/dist/components/p-e71e3b2e.js +2052 -0
- package/dist/components/tds-accordion-item.js +1 -1
- package/dist/components/tds-banner.js +2 -2
- package/dist/components/tds-checkbox.js +1 -1
- package/dist/components/tds-chip.js +9 -3
- package/dist/components/tds-datetime.js +1 -1
- package/dist/components/tds-dropdown-option.js +1 -1
- package/dist/components/tds-dropdown.js +1 -1
- package/dist/components/tds-folder-tab.js +21 -2
- package/dist/components/tds-folder-tabs.js +7 -3
- package/dist/components/tds-footer-group.js +1 -1
- package/dist/components/tds-header-cell.js +1 -1
- package/dist/components/tds-header-dropdown.js +3 -3
- package/dist/components/tds-header-hamburger.js +1 -1
- package/dist/components/tds-header-launcher-button.js +1 -1
- package/dist/components/tds-header-launcher.js +4 -4
- package/dist/components/tds-icon.js +1 -1
- package/dist/components/tds-inline-tab.js +21 -2
- package/dist/components/tds-inline-tabs.js +7 -3
- package/dist/components/tds-link.js +17 -3
- package/dist/components/tds-message.js +19 -5
- package/dist/components/tds-modal.js +78 -4
- package/dist/components/tds-navigation-tab.js +21 -2
- package/dist/components/tds-navigation-tabs.js +9 -5
- package/dist/components/tds-popover-canvas.js +1 -1
- package/dist/components/tds-popover-core.js +1 -1
- package/dist/components/tds-popover-menu.js +1 -1
- package/dist/components/tds-side-menu-close-button.js +1 -1
- package/dist/components/tds-side-menu-dropdown.js +1 -1
- package/dist/components/tds-slider.js +1 -1
- package/dist/components/tds-step.js +1 -1
- package/dist/components/tds-table-body-input-wrapper.js +1 -1
- package/dist/components/tds-table-body-row.js +1 -1
- package/dist/components/tds-table-footer.js +4 -4
- package/dist/components/tds-table-header-input-wrapper.js +1 -1
- package/dist/components/tds-table-header.js +1 -1
- package/dist/components/tds-table-toolbar.js +1 -1
- package/dist/components/tds-text-field.js +15 -8
- package/dist/components/tds-textarea.js +36 -11
- package/dist/components/tds-toast.js +5 -5
- package/dist/components/tds-toggle.js +2 -2
- package/dist/components/tds-tooltip.js +1 -102
- package/dist/esm/index-51d04e39.js +4 -4
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tds-banner.entry.js +1 -1
- package/dist/esm/tds-checkbox.entry.js +10 -3
- package/dist/esm/tds-chip.entry.js +7 -2
- package/dist/esm/tds-dropdown_2.entry.js +74 -45
- package/dist/esm/tds-folder-tab.entry.js +22 -3
- package/dist/esm/tds-folder-tabs.entry.js +4 -2
- package/dist/esm/tds-icon.entry.js +1 -1
- package/dist/esm/tds-inline-tab.entry.js +22 -3
- package/dist/esm/tds-inline-tabs.entry.js +4 -2
- package/dist/esm/tds-link.entry.js +17 -3
- package/dist/esm/tds-message.entry.js +15 -3
- package/dist/esm/tds-modal.entry.js +74 -2
- package/dist/esm/tds-navigation-tab.entry.js +22 -3
- package/dist/esm/tds-navigation-tabs.entry.js +6 -4
- package/dist/esm/tds-popover-core.entry.js +1 -1
- package/dist/esm/tds-text-field.entry.js +13 -7
- package/dist/esm/tds-textarea.entry.js +21 -9
- package/dist/esm/tds-toast.entry.js +4 -4
- package/dist/esm/tds-toggle.entry.js +2 -2
- package/dist/esm/tds-tooltip.entry.js +14 -4
- package/dist/esm/tegel.js +1 -1
- package/dist/tegel/p-0f2c9507.entry.js +1 -0
- package/dist/tegel/p-125a6b06.entry.js +1 -0
- package/dist/tegel/p-28517288.entry.js +1 -0
- package/dist/tegel/p-2af57972.entry.js +1 -0
- package/dist/tegel/p-3e9ca19a.entry.js +1 -0
- package/dist/tegel/{p-be1d1345.entry.js → p-4465f687.entry.js} +1 -1
- package/dist/tegel/p-668b7662.entry.js +1 -0
- package/dist/tegel/{p-4e298888.entry.js → p-66f394a2.entry.js} +1 -1
- package/dist/tegel/p-754a4921.entry.js +1 -0
- package/dist/tegel/{p-46205cfb.entry.js → p-769d0503.entry.js} +1 -1
- package/dist/tegel/p-843413ba.entry.js +1 -0
- package/dist/tegel/p-97f10223.entry.js +1 -0
- package/dist/tegel/p-a21250b8.entry.js +1 -0
- package/dist/tegel/p-aadb2553.entry.js +1 -0
- package/dist/tegel/p-b08886e3.entry.js +1 -0
- package/dist/tegel/p-b114ec3d.entry.js +1 -0
- package/dist/tegel/p-c3607f10.entry.js +1 -0
- package/dist/tegel/p-ddda64eb.entry.js +1 -0
- package/dist/tegel/p-eaa279dd.entry.js +1 -0
- package/dist/tegel/p-ee960089.entry.js +1 -0
- package/dist/tegel/tegel.css +13 -3
- package/dist/tegel/tegel.esm.js +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +5 -0
- package/dist/types/components/chip/chip.d.ts +3 -0
- package/dist/types/components/dropdown/dropdown.d.ts +5 -0
- package/dist/types/components/message/message.d.ts +5 -0
- package/dist/types/components/modal/modal.d.ts +6 -0
- package/dist/types/components/tabs/folder-tabs/folder-tab/folder-tab.d.ts +2 -0
- package/dist/types/components/tabs/folder-tabs/folder-tabs.d.ts +4 -0
- package/dist/types/components/tabs/inline-tabs/inline-tab/inline-tab.d.ts +2 -0
- package/dist/types/components/tabs/inline-tabs/inline-tabs.d.ts +4 -0
- package/dist/types/components/tabs/navigation-tabs/navigation-tab/navigation-tab.d.ts +2 -0
- package/dist/types/components/tabs/navigation-tabs/navigation-tabs.d.ts +4 -0
- package/dist/types/components/text-field/text-field.d.ts +4 -1
- package/dist/types/components/textarea/textarea.d.ts +7 -4
- package/dist/types/components/tooltip/tooltip.d.ts +3 -0
- package/dist/types/components.d.ts +130 -2
- package/dist/types/types/Icons.d.ts +1 -1
- package/dist/types/utils/axeHelpers.d.ts +1 -2
- package/package.json +1 -1
- package/dist/components/p-4764a1d5.js +0 -2052
- package/dist/components/p-a2b7bdef.js +0 -65
- package/dist/tegel/p-065d6f83.entry.js +0 -1
- package/dist/tegel/p-0c1e632d.entry.js +0 -1
- package/dist/tegel/p-168122a7.entry.js +0 -1
- package/dist/tegel/p-19eb4ae1.entry.js +0 -1
- package/dist/tegel/p-4e33cbda.entry.js +0 -1
- package/dist/tegel/p-4ee344e5.entry.js +0 -1
- package/dist/tegel/p-64c80f14.entry.js +0 -1
- package/dist/tegel/p-72fd0083.entry.js +0 -1
- package/dist/tegel/p-93a4bd11.entry.js +0 -1
- package/dist/tegel/p-9e0b31a1.entry.js +0 -1
- package/dist/tegel/p-a0fc0cc2.entry.js +0 -1
- package/dist/tegel/p-b35e7208.entry.js +0 -1
- package/dist/tegel/p-b6526302.entry.js +0 -1
- package/dist/tegel/p-b686f1ad.entry.js +0 -1
- package/dist/tegel/p-cca85da0.entry.js +0 -1
- package/dist/tegel/p-d0abf078.entry.js +0 -1
- package/dist/tegel/p-dcbc35af.entry.js +0 -1
|
@@ -11,14 +11,28 @@ const TdsLink = class {
|
|
|
11
11
|
this.standalone = false;
|
|
12
12
|
}
|
|
13
13
|
connectedCallback() {
|
|
14
|
-
this.host.
|
|
14
|
+
const links = this.host.querySelectorAll('a');
|
|
15
|
+
if (links.length > 1) {
|
|
16
|
+
console.warn('tds-link is only intended to wrap one <a> tag');
|
|
17
|
+
}
|
|
18
|
+
const link = links[0];
|
|
19
|
+
if (link) {
|
|
20
|
+
if (this.disabled) {
|
|
21
|
+
link.setAttribute('tabindex', '-1');
|
|
22
|
+
link.setAttribute('aria-disabled', 'true');
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
link.removeAttribute('tabindex');
|
|
26
|
+
link.removeAttribute('aria-disabled');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
15
29
|
}
|
|
16
30
|
render() {
|
|
17
|
-
return (h("span", { key: '
|
|
31
|
+
return (h("span", { key: '1183de952c2fd6cb1193e9e0dec419f37bf07dee', class: {
|
|
18
32
|
'disabled': this.disabled,
|
|
19
33
|
'no-underline': !this.underline,
|
|
20
34
|
'standalone': this.standalone,
|
|
21
|
-
} }, h("slot", { key: '
|
|
35
|
+
} }, h("slot", { key: 'e019a83d2335cd0a7d682e79a6bf0148452c3e71' })));
|
|
22
36
|
}
|
|
23
37
|
get host() { return getElement(this); }
|
|
24
38
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host } from './index-51d04e39.js';
|
|
2
|
+
import { g as generateUniqueId } from './generateUniqueId-7934d315.js';
|
|
2
3
|
|
|
3
|
-
const messageCss = ":host .wrapper{display:flex;padding:16px;background-color:var(--tds-message-background);border-radius:4px}:host .wrapper.information{border-left:4px solid var(--
|
|
4
|
+
const messageCss = ":host{--tds-message-background:var(--background-elevation-layer-03);}:host .tds-mode-variant-primary{--tds-message-background:var(--background-elevation-layer-03)}:host .tds-mode-variant-secondary{--tds-message-background:var(--background-elevation-layer-02)}:host .wrapper{display:flex;padding:16px;background-color:var(--tds-message-background);border-radius:4px}:host .wrapper.information{border-left:4px solid var(--system-info-default)}:host .wrapper.information tds-icon{color:var(--system-info-default)}:host .wrapper.success{border-left:4px solid var(--system-success-default)}:host .wrapper.success tds-icon{color:var(--system-success-default)}:host .wrapper.error{background-color:var(--system-danger-subtle);border-left:4px solid var(--system-danger-default)}:host .wrapper.error tds-icon{color:var(--system-danger-default)}:host .wrapper.warning{border-left:4px solid var(--system-warning-default)}:host .wrapper.warning tds-icon{color:var(--system-warning-default)}:host .wrapper.minimal{border:none;padding:0;background-color:transparent}:host .wrapper.minimal .header{font-family:var(--detail-02-font-family);font-size:var(--detail-02-font-size);line-height:var(--detail-02-line-height);font-weight:var(--detail-02-font-weight);letter-spacing:var(--detail-02-letter-spacing);text-transform:var(--detail-02-text-transform)}:host .wrapper.minimal.error .header{color:var(--system-danger-default)}:host tds-icon{padding-right:16px}:host .content{display:flex;flex-direction:column;gap:4px;color:var(--foreground-text-strong);padding:2px 0}:host .content .header{font-family:var(--headline-07-font-family);font-size:var(--headline-07-font-size);line-height:var(--headline-07-line-height);font-weight:var(--headline-07-font-weight);letter-spacing:var(--headline-07-letter-spacing);text-transform:var(--headline-07-text-transform)}:host .content .extended-message{color:var(--foreground-text-strong);font-family:var(--detail-02-font-family);font-size:var(--detail-02-font-size);line-height:var(--detail-02-line-height);font-weight:var(--detail-02-font-weight);letter-spacing:var(--detail-02-letter-spacing);text-transform:var(--detail-02-text-transform)}";
|
|
4
5
|
const TdsMessageStyle0 = messageCss;
|
|
5
6
|
|
|
6
7
|
const TdsMessage = class {
|
|
@@ -25,14 +26,25 @@ const TdsMessage = class {
|
|
|
25
26
|
this.variant = 'information';
|
|
26
27
|
this.noIcon = false;
|
|
27
28
|
this.minimal = false;
|
|
29
|
+
this.tdsAlertDialog = 'dialog';
|
|
30
|
+
this.tdsAriaLabel = undefined;
|
|
31
|
+
}
|
|
32
|
+
getAriaLabel() {
|
|
33
|
+
if (this.header) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
const variantLabel = `${this.variant} message`;
|
|
37
|
+
return this.tdsAriaLabel || variantLabel;
|
|
28
38
|
}
|
|
29
39
|
render() {
|
|
30
|
-
|
|
40
|
+
const headerId = this.header ? `tds-message-header-${generateUniqueId()}` : undefined;
|
|
41
|
+
const contentId = !this.minimal ? `tds-message-content-${generateUniqueId()}` : undefined;
|
|
42
|
+
return (h(Host, { key: 'b28d7e5de5b3cb612e78f83650fa5c0621107dda', role: this.tdsAlertDialog, "aria-labelledby": headerId, "aria-describedby": contentId, "aria-label": this.getAriaLabel() }, h("div", { key: 'a3d7470a99af752df3516009d39f7e1c4bbed096', class: {
|
|
31
43
|
wrapper: true,
|
|
32
44
|
[this.variant]: true,
|
|
33
45
|
minimal: this.minimal,
|
|
34
46
|
[`tds-mode-variant-${this.modeVariant}`]: this.modeVariant !== null,
|
|
35
|
-
} }, !this.noIcon && h("tds-icon", { key: '
|
|
47
|
+
} }, !this.noIcon && (h("tds-icon", { key: '5ce066cccec225e2707e660f73396f24197d024d', "aria-label": `${this.variant}`, svgTitle: `${this.variant}`, name: this.getIconName(), size: "20px" })), h("div", { key: 'ec0101d39dd0354b163219b732fd9dfa9cd66e60', class: `content` }, this.header && (h("div", { key: '434be3923b805cc8bd77d232a8cdbf847f9793c8', class: "header", id: headerId }, this.header)), !this.minimal && (h("div", { key: '14f5ead963e55d7e3bad6abc69e97ba9f994316f', class: "extended-message", id: contentId }, h("slot", { key: '37c61ef3a396e37a7cb130951d44af9454163699' })))))));
|
|
36
48
|
}
|
|
37
49
|
};
|
|
38
50
|
TdsMessage.style = TdsMessageStyle0;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-51d04e39.js';
|
|
2
2
|
import { h as hasSlot } from './hasSlot-d52114d0.js';
|
|
3
|
+
import { g as generateUniqueId } from './generateUniqueId-7934d315.js';
|
|
3
4
|
|
|
4
5
|
const modalCss = ".tds-modal{box-sizing:border-box;background-color:var(--tds-modal-background);margin:auto;position:relative;border-radius:4px;max-height:85vh;overflow-y:auto;pointer-events:auto;}.tds-modal *{box-sizing:border-box}.tds-modal::-webkit-scrollbar{width:5px;background-color:var(--tds-grey-300);border-radius:0 1em 1em 0}.tds-modal::-webkit-scrollbar-track{background-color:var(--tds-grey-300);border-radius:0 1em 1em 0}.tds-modal::-webkit-scrollbar-thumb{background-color:var(--tds-grey-500);border-radius:0 1em 1em 0}.tds-modal__actions-sticky{overflow:hidden;display:flex;flex-direction:column}.tds-modal__actions-sticky .body{font:var(--tds-body-01);letter-spacing:var(--tds-body-01-ls);max-height:calc(85vh - 36px);overflow-y:auto}.tds-modal__actions-sticky slot[name=actions]{bottom:-1px;left:0;right:0;background-color:var(--tds-modal-background);padding:var(--tds-spacing-element-24) var(--tds-spacing-element-16) var(--tds-spacing-element-16);display:flex;gap:16px}.tds-modal__actions-static slot[name=actions]{background-color:var(--tds-modal-background);display:flex;gap:16px;padding:24px 16px 16px}@media (min-width: 320px){.tds-modal-xs{width:100%}.tds-modal-sm{width:100%}.tds-modal-md{width:100%}.tds-modal-lg{width:100%}}@media (min-width: 672px){.tds-modal-xs{width:50%}.tds-modal-sm{width:62.5%}.tds-modal-md{width:75%}.tds-modal-lg{width:100%}}@media (min-width: 1056px){.tds-modal-xs{width:31.25%}.tds-modal-sm{width:43.75%}.tds-modal-md{width:62.5%}.tds-modal-lg{width:75%}}@media (min-width: 1312px){.tds-modal-xs{width:31.25%}.tds-modal-sm{width:37.5%}.tds-modal-md{width:62.5%}.tds-modal-lg{width:75%}}@media (min-width: 1584px){.tds-modal-xs{width:25%}.tds-modal-sm{width:37.5%}.tds-modal-md{width:50%}.tds-modal-lg{width:75%}}@media (max-width: 320px){.tds-modal-md,.tds-modal-lg,.tds-modal-sm{height:100%}.tds-modal-md slot[name=actions]::slotted(*),.tds-modal-lg slot[name=actions]::slotted(*),.tds-modal-sm slot[name=actions]::slotted(*){display:flex}}.header{display:flex;padding:var(--tds-spacing-element-16);position:sticky;top:0;background-color:var(--tds-modal-background);z-index:1}.header,slot[name=header]::slotted(*){color:var(--tds-modal-text);font:var(--tds-headline-05) !important;letter-spacing:var(--tds-headline-05-ls) !important;margin:0;flex:1}.body{color:var(--tds-modal-text);font:var(--tds-body-01);letter-spacing:var(--tds-body-01-ls);overflow-y:visible;padding:0 var(--tds-spacing-element-16) var(--tds-spacing-element-16);}.body::-webkit-scrollbar{width:5px;background-color:var(--tds-grey-300)}.body::-webkit-scrollbar-track{background-color:var(--tds-grey-300)}.body::-webkit-scrollbar-thumb{background-color:var(--tds-grey-500)}.tds-modal-backdrop{box-sizing:border-box;position:fixed;top:0;right:0;bottom:0;left:0;background-color:var(--tds-modal-backdrop);pointer-events:auto}.tds-modal-backdrop *{box-sizing:border-box}button.tds-modal-close{margin:0 0 auto auto;background-color:transparent;border:0;padding:0;appearance:unset}.tds-modal-close{display:inline-block;height:auto;color:var(--tds-modal-icon);cursor:pointer}.tds-modal-close:focus{outline:2px solid var(--tds-blue-400);outline-offset:-2px}@media (min-width: 320px){.tds-modal-close{margin-left:var(--tds-spacing-element-16)}}@media (min-width: 1056px){.tds-modal-close{margin-left:var(--tds-spacing-element-48)}}.tds-modal-close-btn{display:inline-block;height:auto;background-repeat:no-repeat;cursor:pointer}@media (min-width: 320px){.tds-modal-close-btn{margin-left:var(--tds-spacing-element-16)}}@media (min-width: 1056px){.tds-modal-close-btn{margin-left:var(--tds-spacing-element-48)}}.tds-modal-close-btn svg{fill:var(--tds-modal-icon)}.tds-modal-overflow{overflow:hidden}:host{box-sizing:border-box;position:fixed;top:0;right:0;bottom:0;left:0;padding:0 16px;z-index:700;pointer-events:none}:host *{box-sizing:border-box}:host .tds-modal-close{border:none;background-color:transparent}:host .tds-modal-close-btn{border:none;background-color:transparent}@media (max-width: 320px){:host{padding:0}}:host.show{display:flex}:host.hide{display:none}:host(.show){display:flex}:host(.hide){display:none}";
|
|
5
6
|
const TdsModalStyle0 = modalCss;
|
|
@@ -10,6 +11,7 @@ const TdsModal = class {
|
|
|
10
11
|
this.tdsClose = createEvent(this, "tdsClose", 7);
|
|
11
12
|
this.handleClose = (event) => {
|
|
12
13
|
const closeEvent = this.tdsClose.emit(event);
|
|
14
|
+
this.returnFocusOnClose();
|
|
13
15
|
if (!closeEvent.defaultPrevented) {
|
|
14
16
|
this.isShown = false;
|
|
15
17
|
}
|
|
@@ -58,15 +60,26 @@ const TdsModal = class {
|
|
|
58
60
|
this.referenceEl = undefined;
|
|
59
61
|
this.show = undefined;
|
|
60
62
|
this.closable = true;
|
|
63
|
+
this.tdsAlertDialog = 'dialog';
|
|
61
64
|
this.isShown = false;
|
|
65
|
+
this.activeElementIndex = 0;
|
|
62
66
|
}
|
|
63
67
|
/** Shows the Modal. */
|
|
64
68
|
async showModal() {
|
|
65
69
|
this.isShown = true;
|
|
70
|
+
// Set focus on first element when opened
|
|
71
|
+
requestAnimationFrame(() => {
|
|
72
|
+
const focusableElements = this.getFocusableElements();
|
|
73
|
+
if (focusableElements.length > 0) {
|
|
74
|
+
focusableElements[0].focus();
|
|
75
|
+
this.activeElementIndex = 0;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
66
78
|
}
|
|
67
79
|
/** Closes the Modal. */
|
|
68
80
|
async closeModal() {
|
|
69
81
|
this.isShown = false;
|
|
82
|
+
this.returnFocusOnClose();
|
|
70
83
|
}
|
|
71
84
|
connectedCallback() {
|
|
72
85
|
if (this.closable === undefined) {
|
|
@@ -104,6 +117,63 @@ const TdsModal = class {
|
|
|
104
117
|
dismissButton.removeEventListener('click', this.handleClose);
|
|
105
118
|
});
|
|
106
119
|
}
|
|
120
|
+
returnFocusOnClose() {
|
|
121
|
+
var _a;
|
|
122
|
+
let referenceEl = (_a = this.referenceEl) !== null && _a !== void 0 ? _a : document.querySelector(this.selector);
|
|
123
|
+
const potentialReferenceElements = ['BUTTON', 'A', 'INPUT'];
|
|
124
|
+
// If referenced element is a custom element eg: tds-button we find the interactive element inside
|
|
125
|
+
if (potentialReferenceElements.indexOf(referenceEl.tagName) < 0) {
|
|
126
|
+
referenceEl = referenceEl.querySelectorAll(potentialReferenceElements.join(','))[0];
|
|
127
|
+
}
|
|
128
|
+
referenceEl.focus();
|
|
129
|
+
}
|
|
130
|
+
getFocusableElements() {
|
|
131
|
+
const focusableSelectors = [
|
|
132
|
+
'a[href]',
|
|
133
|
+
'button:not([disabled])',
|
|
134
|
+
'textarea:not([disabled])',
|
|
135
|
+
'input:not([disabled])',
|
|
136
|
+
'select:not([disabled])',
|
|
137
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
138
|
+
].join(',');
|
|
139
|
+
const focusableInShadowRoot = Array.from(this.host.shadowRoot.querySelectorAll(focusableSelectors));
|
|
140
|
+
const focusableInSlots = Array.from(this.host.querySelectorAll(focusableSelectors));
|
|
141
|
+
/** Focusable elements */
|
|
142
|
+
return [...focusableInShadowRoot, ...focusableInSlots];
|
|
143
|
+
}
|
|
144
|
+
handleFocusTrap(event) {
|
|
145
|
+
if (event.key === 'Escape' && this.isShown && !this.prevent) {
|
|
146
|
+
this.handleClose(event);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
// Only trap focus if the modal is open
|
|
150
|
+
if (!this.isShown)
|
|
151
|
+
return;
|
|
152
|
+
// We care only about the Tab key
|
|
153
|
+
if (event.key !== 'Tab')
|
|
154
|
+
return;
|
|
155
|
+
const focusableElements = this.getFocusableElements();
|
|
156
|
+
// If there are no focusable elements
|
|
157
|
+
if (focusableElements.length === 0)
|
|
158
|
+
return;
|
|
159
|
+
event.preventDefault();
|
|
160
|
+
// Going backwards (Shift + Tab) on the first element => move to last
|
|
161
|
+
if (event.shiftKey) {
|
|
162
|
+
this.activeElementIndex -= 1;
|
|
163
|
+
if (this.activeElementIndex === -1) {
|
|
164
|
+
this.activeElementIndex = focusableElements.length - 1;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// // Going forwards (Tab) on the last element => move to first
|
|
168
|
+
if (!event.shiftKey) {
|
|
169
|
+
this.activeElementIndex += 1;
|
|
170
|
+
if (this.activeElementIndex === focusableElements.length) {
|
|
171
|
+
this.activeElementIndex = 0;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const nextElement = focusableElements[this.activeElementIndex];
|
|
175
|
+
nextElement.focus();
|
|
176
|
+
}
|
|
107
177
|
/** Adds an event listener to the dismiss buttons that closes the Modal. */
|
|
108
178
|
setDismissButtons() {
|
|
109
179
|
this.host.querySelectorAll('[data-dismiss-modal]').forEach((dismissButton) => {
|
|
@@ -113,10 +183,12 @@ const TdsModal = class {
|
|
|
113
183
|
render() {
|
|
114
184
|
const usesHeaderSlot = hasSlot('header', this.host);
|
|
115
185
|
const usesActionsSlot = hasSlot('actions', this.host);
|
|
116
|
-
|
|
186
|
+
const headerId = this.header ? `tds-modal-header-${generateUniqueId()}` : undefined;
|
|
187
|
+
const bodyId = `tds-modal-body-${generateUniqueId()}`;
|
|
188
|
+
return (h(Host, { key: '398809ea45126dd70b95422f2f7a08a481a22d53', role: this.tdsAlertDialog, "aria-modal": "true", "aria-describedby": bodyId, "aria-labelledby": headerId, class: {
|
|
117
189
|
show: this.isShown,
|
|
118
190
|
hide: !this.isShown,
|
|
119
|
-
}, onClick: (event) => this.handleOverlayClick(event) }, h("div", { key: '
|
|
191
|
+
}, onClick: (event) => this.handleOverlayClick(event) }, h("div", { key: '96e964cc4f3c6d9613fb53e340e0aa5dcd8b6d81', class: "tds-modal-backdrop" }), h("div", { key: 'af7ddc896ef35b6116ae70524d10c4b7b952e20a', class: `tds-modal tds-modal__actions-${this.actionsPosition} tds-modal-${this.size}` }, h("div", { key: '9dfcf95fcc8925cd5c97f10f29edc6cef183a0ca', id: headerId, class: "header" }, this.header && h("div", { key: '42533c25b07e696a0c61504556150018f8d3583a', class: "header-text" }, this.header), usesHeaderSlot && h("slot", { key: 'd9855a20e1763ad17d6c8b80df85796d8f6027a8', name: "header" }), this.closable && (h("button", { key: '3e99b76da7bcf39eaecbe2906e0674fd20ebe9a6', class: "tds-modal-close", "aria-label": "close", onClick: (event) => this.handleClose(event) }, h("tds-icon", { key: 'f6463437fb98ae280afe358d50a2f960914014ea', name: "cross", size: "20px" })))), h("div", { key: 'ba8ca2e65f5eac8103e6f3c431e3ae9aab2b5f72', id: bodyId, class: "body" }, h("slot", { key: '9e08cbdd00e1a60826588b15cb6ed23fc4b5b0d7', name: "body" })), usesActionsSlot && h("slot", { key: 'aeb50dfcbf6c12e80a8904d149bb15892c691d88', name: "actions" }))));
|
|
120
192
|
}
|
|
121
193
|
get host() { return getElement(this); }
|
|
122
194
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host } from './index-51d04e39.js';
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement } from './index-51d04e39.js';
|
|
2
2
|
|
|
3
3
|
const navigationTabCss = ":host{box-sizing:border-box;display:block}:host *{box-sizing:border-box}:host ::slotted(*){all:unset;font:var(--tds-headline-07) !important;letter-spacing:var(--tds-headline-07-ls) !important;color:var(--tds-navigation-tabs-tab-color) !important;text-decoration:none;display:block;position:relative;transition:color 0.15s ease-in-out 0s;white-space:nowrap;background-color:transparent;border:0;width:100%;padding:26px 4px}:host ::slotted(*:focus-visible)::before{content:\"\";position:absolute;left:0;right:0;top:26px;bottom:26px;outline:2px solid var(--tds-blue-400)}:host .navigation-tab-item:not(.selected)::after{width:0%;transition:width 0.15s ease-in-out 0s}:host .navigation-tab-item{position:relative;margin-right:32px}:host .navigation-tab-item:hover{cursor:pointer}:host .navigation-tab-item:hover::after{width:100%}:host .navigation-tab-item::after{content:\" \";position:absolute;bottom:0;right:0;left:0;margin-left:auto;width:0%;margin-right:auto;height:2px;background-color:var(--tds-navigation-tabs-tab-indicator-background-hover);z-index:1}:host .selected ::slotted(*){color:var(--tds-navigation-tabs-tab-color-selected)}:host .selected::after{width:100%;background-color:var(--tds-navigation-tabs-tab-indicator-background-active)}:host .disabled{color:var(--tds-navigation-tabs-tab-color-disabled)}:host .disabled ::slotted(*){opacity:var(--tds-navigation-tabs-tab-color-opacity-disabled)}:host .disabled::after{content:none}:host .disabled ::slotted(*:hover){cursor:not-allowed}:host .disabled ::slotted(*:focus-visible){outline:none}:host(.last){margin-right:32px}";
|
|
4
4
|
const TdsNavigationTabStyle0 = navigationTabCss;
|
|
@@ -13,10 +13,29 @@ const TdsNavigationTab = class {
|
|
|
13
13
|
async setSelected(selected) {
|
|
14
14
|
this.selected = selected;
|
|
15
15
|
}
|
|
16
|
+
connectedCallback() {
|
|
17
|
+
const elements = this.host.querySelectorAll('button, a');
|
|
18
|
+
for (let index = 0; index < elements.length; index++) {
|
|
19
|
+
const element = elements[index];
|
|
20
|
+
if (!element.getAttribute('aria-controls')) {
|
|
21
|
+
console.warn('Tegel navigation-tab component: Interactive elements should have aria-controls attribute to link the tab to its corresponding panel');
|
|
22
|
+
}
|
|
23
|
+
if (element.getAttribute('role') !== 'tab') {
|
|
24
|
+
console.warn('Tegel navigation-tab component: Interactive elements should have attribute role="tab"');
|
|
25
|
+
}
|
|
26
|
+
if (this.disabled) {
|
|
27
|
+
element.setAttribute('aria-disabled', 'true');
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
element.removeAttribute('aria-disabled');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
16
34
|
render() {
|
|
17
|
-
return (h(Host, { key: '
|
|
18
|
-
${this.disabled ? 'disabled' : ''}` }, h("slot", { key: '
|
|
35
|
+
return (h(Host, { key: '51152bf313a84cb937e7f49e87cc8dcd74ab0612' }, h("div", { key: '5d55db68f75e042dafe40da1b9e84d74f1cd8849', class: `navigation-tab-item ${this.selected ? 'selected' : ''}
|
|
36
|
+
${this.disabled ? 'disabled' : ''}` }, h("slot", { key: '174108daa16d6fa68c04244af1843771a4df91f5' }))));
|
|
19
37
|
}
|
|
38
|
+
get host() { return getElement(this); }
|
|
20
39
|
};
|
|
21
40
|
TdsNavigationTab.style = TdsNavigationTabStyle0;
|
|
22
41
|
|
|
@@ -64,6 +64,8 @@ const TdsNavigationTabs = class {
|
|
|
64
64
|
this.defaultSelectedIndex = 0;
|
|
65
65
|
this.selectedIndex = undefined;
|
|
66
66
|
this.leftPadding = 32;
|
|
67
|
+
this.tdsScrollLeftAriaLabel = 'Scroll left';
|
|
68
|
+
this.tdsScrollRightAriaLabel = 'Scroll right';
|
|
67
69
|
this.showLeftScroll = false;
|
|
68
70
|
this.showRightScroll = false;
|
|
69
71
|
}
|
|
@@ -170,15 +172,15 @@ const TdsNavigationTabs = class {
|
|
|
170
172
|
this.removeEventListenerFromTabs();
|
|
171
173
|
}
|
|
172
174
|
render() {
|
|
173
|
-
return (h(Host, { key: '
|
|
175
|
+
return (h(Host, { key: '809fe9d34b03949edae1708b6dea7f0406afee80', role: "tablist", class: { [`tds-mode-variant-${this.modeVariant}`]: this.modeVariant !== null } }, h("div", { key: '866605f8695441d7817c07895bdffd5e3e7ba5ac', class: "wrapper", ref: (el) => {
|
|
174
176
|
this.navWrapperElement = el;
|
|
175
|
-
}, style: { paddingLeft: `${this.leftPadding}px` } }, h("button", { key: '
|
|
177
|
+
}, style: { paddingLeft: `${this.leftPadding}px` } }, h("button", { key: '2d394ecb940cee024174932676c2a6c22622c853', "aria-label": this.tdsScrollLeftAriaLabel, class: {
|
|
176
178
|
'scroll-left-button': true,
|
|
177
179
|
'show': this.showLeftScroll,
|
|
178
|
-
}, onClick: () => this.scrollLeft(), disabled: !this.showLeftScroll }, h("tds-icon", { key: '
|
|
180
|
+
}, onClick: () => this.scrollLeft(), disabled: !this.showLeftScroll }, h("tds-icon", { key: '09386162127467a545e00f44130352afb9cfed03', name: "chevron_left", size: "20px" })), h("slot", { key: '3b3cd70ed645318d0661a3acbee3d2bc748314cf', onSlotchange: () => this.handleSlotChange() }), h("button", { key: '1afb2dc9b261626db800593548d7e023e14cd39b', "aria-label": this.tdsScrollRightAriaLabel, class: {
|
|
179
181
|
'scroll-right-button': true,
|
|
180
182
|
'show': this.showRightScroll,
|
|
181
|
-
}, onClick: () => this.scrollRight(), disabled: !this.showRightScroll }, h("tds-icon", { key: '
|
|
183
|
+
}, onClick: () => this.scrollRight(), disabled: !this.showRightScroll }, h("tds-icon", { key: '451a8ddc680799fd86e390d8aeab5c22c73f31ee', name: "chevron_right", size: "20px" })))));
|
|
182
184
|
}
|
|
183
185
|
get host() { return getElement(this); }
|
|
184
186
|
static get watchers() { return {
|