@scania/tegel 1.27.0 → 1.27.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.
Files changed (205) hide show
  1. package/dist/cjs/index-ca8040ad.js +4 -4
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/tds-dropdown_2.cjs.entry.js +8 -8
  4. package/dist/cjs/tds-footer-group.cjs.entry.js +27 -5
  5. package/dist/cjs/tds-footer-item.cjs.entry.js +2 -2
  6. package/dist/cjs/tds-footer.cjs.entry.js +1 -1
  7. package/dist/cjs/tds-header-brand-symbol.cjs.entry.js +6 -2
  8. package/dist/cjs/tds-header-dropdown.cjs.entry.js +26 -3
  9. package/dist/cjs/tds-header-hamburger.cjs.entry.js +7 -1
  10. package/dist/cjs/tds-header-launcher-button.cjs.entry.js +2 -1
  11. package/dist/cjs/tds-header-launcher.cjs.entry.js +23 -2
  12. package/dist/cjs/tds-icon.cjs.entry.js +3 -2
  13. package/dist/cjs/tds-inline-tabs.cjs.entry.js +1 -1
  14. package/dist/cjs/tds-modal.cjs.entry.js +75 -3
  15. package/dist/cjs/tds-navigation-tabs.cjs.entry.js +1 -1
  16. package/dist/cjs/tds-popover-canvas.cjs.entry.js +3 -2
  17. package/dist/cjs/tds-popover-core.cjs.entry.js +55 -11
  18. package/dist/cjs/tds-popover-menu-item.cjs.entry.js +2 -2
  19. package/dist/cjs/tds-popover-menu.cjs.entry.js +1 -1
  20. package/dist/cjs/tds-radio-button.cjs.entry.js +3 -1
  21. package/dist/cjs/tds-spinner.cjs.entry.js +1 -1
  22. package/dist/cjs/tds-step.cjs.entry.js +2 -1
  23. package/dist/cjs/tds-stepper.cjs.entry.js +2 -1
  24. package/dist/cjs/tds-text-field.cjs.entry.js +31 -16
  25. package/dist/cjs/tds-textarea.cjs.entry.js +27 -9
  26. package/dist/cjs/tds-toast.cjs.entry.js +10 -3
  27. package/dist/cjs/tds-toggle.cjs.entry.js +2 -2
  28. package/dist/cjs/tds-tooltip.cjs.entry.js +2 -2
  29. package/dist/cjs/tegel.cjs.js +1 -1
  30. package/dist/collection/components/dropdown/dropdown.js +8 -8
  31. package/dist/collection/components/footer/footer-group/footer-group.css +23 -21
  32. package/dist/collection/components/footer/footer-group/footer-group.js +55 -5
  33. package/dist/collection/components/footer/footer-item/footer-item.css +17 -17
  34. package/dist/collection/components/footer/footer-item/footer-item.js +2 -2
  35. package/dist/collection/components/footer/footer.css +1 -1
  36. package/dist/collection/components/header/header-brand-symbol/header-brand-symbol.css +1 -1
  37. package/dist/collection/components/header/header-brand-symbol/header-brand-symbol.js +6 -2
  38. package/dist/collection/components/header/header-dropdown/header-dropdown.js +49 -3
  39. package/dist/collection/components/header/header-hamburger/header-hamburger.js +30 -1
  40. package/dist/collection/components/header/header-launcher/header-launcher.js +50 -2
  41. package/dist/collection/components/header/header-launcher-button/header-launcher-button.js +19 -1
  42. package/dist/collection/components/icon/icon.js +21 -2
  43. package/dist/collection/components/modal/modal.css +48 -43
  44. package/dist/collection/components/modal/modal.js +103 -3
  45. package/dist/collection/components/popover-canvas/popover-canvas.js +21 -2
  46. package/dist/collection/components/popover-core/popover-core.js +63 -10
  47. package/dist/collection/components/popover-core/tds-popover-core.css +123 -66
  48. package/dist/collection/components/popover-menu/popover-menu-item/popover-menu-item.js +2 -2
  49. package/dist/collection/components/popover-menu/popover-menu.js +1 -1
  50. package/dist/collection/components/radio-button/radio-button.js +37 -1
  51. package/dist/collection/components/spinner/spinner.css +62 -39
  52. package/dist/collection/components/stepper/step/step.js +19 -1
  53. package/dist/collection/components/stepper/stepper.js +20 -1
  54. package/dist/collection/components/tabs/inline-tabs/inline-tabs.css +0 -1
  55. package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.css +2 -3
  56. package/dist/collection/components/text-field/text-field.css +21 -9
  57. package/dist/collection/components/text-field/text-field.js +48 -15
  58. package/dist/collection/components/textarea/textarea.css +11 -6
  59. package/dist/collection/components/textarea/textarea.js +61 -8
  60. package/dist/collection/components/toast/toast.js +45 -3
  61. package/dist/collection/components/toggle/toggle.js +2 -2
  62. package/dist/collection/components/tooltip/tooltip.js +2 -2
  63. package/dist/components/{p-2d93a742.js → p-1c606f82.js} +1 -1
  64. package/dist/components/p-252f3d4d.js +2098 -0
  65. package/dist/components/p-3dcfe1f4.js +115 -0
  66. package/dist/components/{p-53e4cdcf.js → p-789bb453.js} +5 -3
  67. package/dist/components/{p-4487c541.js → p-92fb75a7.js} +4 -2
  68. package/dist/components/{p-663b8e51.js → p-c0b84c59.js} +9 -9
  69. package/dist/components/{p-83db8b35.js → p-f8a36676.js} +5 -3
  70. package/dist/components/tds-accordion-item.js +1 -1
  71. package/dist/components/tds-banner.js +1 -1
  72. package/dist/components/tds-datetime.js +1 -1
  73. package/dist/components/tds-dropdown-option.js +1 -1
  74. package/dist/components/tds-dropdown.js +1 -1
  75. package/dist/components/tds-folder-tabs.js +1 -1
  76. package/dist/components/tds-footer-group.js +32 -8
  77. package/dist/components/tds-footer-item.js +3 -3
  78. package/dist/components/tds-footer.js +1 -1
  79. package/dist/components/tds-header-brand-symbol.js +6 -2
  80. package/dist/components/tds-header-cell.js +1 -1
  81. package/dist/components/tds-header-dropdown.js +31 -7
  82. package/dist/components/tds-header-hamburger.js +11 -3
  83. package/dist/components/tds-header-launcher-button.js +1 -1
  84. package/dist/components/tds-header-launcher.js +29 -7
  85. package/dist/components/tds-icon.js +1 -1
  86. package/dist/components/tds-inline-tabs.js +2 -2
  87. package/dist/components/tds-message.js +1 -1
  88. package/dist/components/tds-modal.js +79 -5
  89. package/dist/components/tds-navigation-tabs.js +2 -2
  90. package/dist/components/tds-popover-canvas.js +1 -1
  91. package/dist/components/tds-popover-core.js +1 -1
  92. package/dist/components/tds-popover-menu-item.js +2 -2
  93. package/dist/components/tds-popover-menu.js +2 -2
  94. package/dist/components/tds-radio-button.js +6 -2
  95. package/dist/components/tds-side-menu-close-button.js +1 -1
  96. package/dist/components/tds-side-menu-dropdown.js +1 -1
  97. package/dist/components/tds-slider.js +1 -1
  98. package/dist/components/tds-spinner.js +1 -1
  99. package/dist/components/tds-step.js +4 -2
  100. package/dist/components/tds-stepper.js +4 -2
  101. package/dist/components/tds-table-body-input-wrapper.js +1 -1
  102. package/dist/components/tds-table-footer.js +3 -3
  103. package/dist/components/tds-table-header-input-wrapper.js +1 -1
  104. package/dist/components/tds-table-toolbar.js +1 -1
  105. package/dist/components/tds-text-field.js +33 -17
  106. package/dist/components/tds-textarea.js +43 -11
  107. package/dist/components/tds-toast.js +13 -4
  108. package/dist/components/tds-toggle.js +2 -2
  109. package/dist/components/tds-tooltip.js +1 -113
  110. package/dist/esm/index-51d04e39.js +4 -4
  111. package/dist/esm/loader.js +1 -1
  112. package/dist/esm/tds-dropdown_2.entry.js +8 -8
  113. package/dist/esm/tds-footer-group.entry.js +27 -5
  114. package/dist/esm/tds-footer-item.entry.js +3 -3
  115. package/dist/esm/tds-footer.entry.js +1 -1
  116. package/dist/esm/tds-header-brand-symbol.entry.js +6 -2
  117. package/dist/esm/tds-header-dropdown.entry.js +26 -3
  118. package/dist/esm/tds-header-hamburger.entry.js +7 -1
  119. package/dist/esm/tds-header-launcher-button.entry.js +2 -1
  120. package/dist/esm/tds-header-launcher.entry.js +23 -2
  121. package/dist/esm/tds-icon.entry.js +3 -2
  122. package/dist/esm/tds-inline-tabs.entry.js +1 -1
  123. package/dist/esm/tds-modal.entry.js +75 -3
  124. package/dist/esm/tds-navigation-tabs.entry.js +1 -1
  125. package/dist/esm/tds-popover-canvas.entry.js +3 -2
  126. package/dist/esm/tds-popover-core.entry.js +55 -11
  127. package/dist/esm/tds-popover-menu-item.entry.js +2 -2
  128. package/dist/esm/tds-popover-menu.entry.js +1 -1
  129. package/dist/esm/tds-radio-button.entry.js +3 -1
  130. package/dist/esm/tds-spinner.entry.js +1 -1
  131. package/dist/esm/tds-step.entry.js +2 -1
  132. package/dist/esm/tds-stepper.entry.js +2 -1
  133. package/dist/esm/tds-text-field.entry.js +31 -16
  134. package/dist/esm/tds-textarea.entry.js +27 -9
  135. package/dist/esm/tds-toast.entry.js +10 -3
  136. package/dist/esm/tds-toggle.entry.js +2 -2
  137. package/dist/esm/tds-tooltip.entry.js +2 -2
  138. package/dist/esm/tegel.js +1 -1
  139. package/dist/tegel/p-033d991e.entry.js +1 -0
  140. package/dist/tegel/p-24db6b5b.entry.js +1 -0
  141. package/dist/tegel/p-27a4a7d0.entry.js +1 -0
  142. package/dist/tegel/p-28cf7204.entry.js +1 -0
  143. package/dist/tegel/p-302fea99.entry.js +1 -0
  144. package/dist/tegel/p-31bc440c.entry.js +1 -0
  145. package/dist/tegel/p-3e9ca19a.entry.js +1 -0
  146. package/dist/tegel/p-44ac6a20.entry.js +1 -0
  147. package/dist/tegel/{p-769d0503.entry.js → p-46205cfb.entry.js} +1 -1
  148. package/dist/tegel/p-54a20280.entry.js +1 -0
  149. package/dist/tegel/p-5a3ff0d3.entry.js +1 -0
  150. package/dist/tegel/p-660176d6.entry.js +1 -0
  151. package/dist/tegel/p-68e10acc.entry.js +1 -0
  152. package/dist/tegel/{p-eaa279dd.entry.js → p-81111221.entry.js} +1 -1
  153. package/dist/tegel/{p-668b7662.entry.js → p-8d7bf652.entry.js} +1 -1
  154. package/dist/tegel/p-b58f68f0.entry.js +1 -0
  155. package/dist/tegel/{p-5ba254ee.entry.js → p-c10be10e.entry.js} +1 -1
  156. package/dist/tegel/p-c71acb02.entry.js +1 -0
  157. package/dist/tegel/p-e1abd593.entry.js +1 -0
  158. package/dist/tegel/p-e3c3bdac.entry.js +1 -0
  159. package/dist/tegel/p-e46744bc.entry.js +1 -0
  160. package/dist/tegel/p-ea9e7345.entry.js +1 -0
  161. package/dist/tegel/{p-97f10223.entry.js → p-eec22b6b.entry.js} +1 -1
  162. package/dist/tegel/p-f034fc0c.entry.js +1 -0
  163. package/dist/tegel/p-fa342278.entry.js +1 -0
  164. package/dist/tegel/{p-b9f81e53.entry.js → p-fc6196c4.entry.js} +1 -1
  165. package/dist/tegel/tegel.css +4 -4
  166. package/dist/tegel/tegel.esm.js +1 -1
  167. package/dist/types/components/footer/footer-group/footer-group.d.ts +7 -0
  168. package/dist/types/components/header/header-brand-symbol/header-brand-symbol.d.ts +1 -1
  169. package/dist/types/components/header/header-dropdown/header-dropdown.d.ts +4 -0
  170. package/dist/types/components/header/header-hamburger/header-hamburger.d.ts +3 -0
  171. package/dist/types/components/header/header-launcher/header-launcher.d.ts +4 -0
  172. package/dist/types/components/header/header-launcher-button/header-launcher-button.d.ts +2 -0
  173. package/dist/types/components/icon/icon.d.ts +2 -0
  174. package/dist/types/components/modal/modal.d.ts +6 -0
  175. package/dist/types/components/popover-canvas/popover-canvas.d.ts +2 -0
  176. package/dist/types/components/popover-core/popover-core.d.ts +4 -0
  177. package/dist/types/components/radio-button/radio-button.d.ts +4 -0
  178. package/dist/types/components/stepper/step/step.d.ts +1 -0
  179. package/dist/types/components/stepper/stepper.d.ts +2 -0
  180. package/dist/types/components/text-field/text-field.d.ts +6 -4
  181. package/dist/types/components/textarea/textarea.d.ts +10 -4
  182. package/dist/types/components/toast/toast.d.ts +5 -0
  183. package/dist/types/components.d.ts +130 -0
  184. package/package.json +1 -1
  185. package/dist/components/p-90dbeab3.js +0 -2052
  186. package/dist/tegel/p-035e58e6.entry.js +0 -1
  187. package/dist/tegel/p-22c592eb.entry.js +0 -1
  188. package/dist/tegel/p-288a09ef.entry.js +0 -1
  189. package/dist/tegel/p-4f5f152a.entry.js +0 -1
  190. package/dist/tegel/p-542d7b3e.entry.js +0 -1
  191. package/dist/tegel/p-5a7110b8.entry.js +0 -1
  192. package/dist/tegel/p-5db5c8f4.entry.js +0 -1
  193. package/dist/tegel/p-654785d2.entry.js +0 -1
  194. package/dist/tegel/p-66f394a2.entry.js +0 -1
  195. package/dist/tegel/p-727f873f.entry.js +0 -1
  196. package/dist/tegel/p-746e2927.entry.js +0 -1
  197. package/dist/tegel/p-754a4921.entry.js +0 -1
  198. package/dist/tegel/p-aef6b130.entry.js +0 -1
  199. package/dist/tegel/p-b114ec3d.entry.js +0 -1
  200. package/dist/tegel/p-b39ffad4.entry.js +0 -1
  201. package/dist/tegel/p-b686f1ad.entry.js +0 -1
  202. package/dist/tegel/p-c56be8d1.entry.js +0 -1
  203. package/dist/tegel/p-dfbbaefd.entry.js +0 -1
  204. package/dist/tegel/p-ea3e071f.entry.js +0 -1
  205. package/dist/tegel/p-ee7f07ae.entry.js +0 -1
@@ -1,9 +1,17 @@
1
1
  import { h, Host } from "@stencil/core";
2
2
  import inheritAriaAttributes from "../../../utils/inheritAriaAttributes";
3
3
  export class TdsHeaderHamburger {
4
+ constructor() {
5
+ this.tdsAriaLabel = undefined;
6
+ }
7
+ connectedCallback() {
8
+ if (!this.tdsAriaLabel) {
9
+ console.warn('Tegel Header Hamburger component: missing tdsAriaLabel prop');
10
+ }
11
+ }
4
12
  render() {
5
13
  const inheritedButtonProps = Object.assign({}, inheritAriaAttributes(this.host));
6
- return (h(Host, { key: 'f2f230c8349ca3b5fdcfd7de67555b12888bd9d9' }, h("tds-header-item", { key: '7db87ae4ad59bea1040399a33fdf77aa490ae1ca' }, h("button", Object.assign({ key: 'bf5e3103c23c02e42db7e99a423348efb4488ed7' }, inheritedButtonProps), h("tds-icon", { key: '306b78525304ac2f30a4bcb0be37c0ed7998b01f', class: "icon", name: "burger", size: "20px" })))));
14
+ return (h(Host, { key: '774d1727624bfe4f8606d2efea75236532f2e9b2' }, h("tds-header-item", { key: '70cbf14a6b7ea638465d56780780ef3e9b5e0f4e' }, h("button", Object.assign({ key: 'af50f354dca1b518b13216ae0ce6cc85488f7df3' }, inheritedButtonProps, { "aria-label": this.tdsAriaLabel }), h("tds-icon", { key: '7978cd71ad41001dee4dbdb12894e22e716f3164', class: "icon", name: "burger", size: "20px" })))));
7
15
  }
8
16
  static get is() { return "tds-header-hamburger"; }
9
17
  static get encapsulation() { return "shadow"; }
@@ -17,5 +25,26 @@ export class TdsHeaderHamburger {
17
25
  "$": ["header-hamburger.css"]
18
26
  };
19
27
  }
28
+ static get properties() {
29
+ return {
30
+ "tdsAriaLabel": {
31
+ "type": "string",
32
+ "mutable": false,
33
+ "complexType": {
34
+ "original": "string",
35
+ "resolved": "string",
36
+ "references": {}
37
+ },
38
+ "required": false,
39
+ "optional": false,
40
+ "docs": {
41
+ "tags": [],
42
+ "text": "Value to be used by the aria-label attribute"
43
+ },
44
+ "attribute": "tds-aria-label",
45
+ "reflect": false
46
+ }
47
+ };
48
+ }
20
49
  static get elementRef() { return "host"; }
21
50
  }
@@ -10,6 +10,7 @@ export class TdsHeaderLauncher {
10
10
  this.open = false;
11
11
  this.buttonEl = undefined;
12
12
  this.hasListTypeMenu = false;
13
+ this.tdsAriaLabel = undefined;
13
14
  }
14
15
  onAnyClick(event) {
15
16
  // Source: https://lamplightdev.com/blog/2021/04/10/how-to-detect-clicks-outside-of-a-web-component/
@@ -18,12 +19,32 @@ export class TdsHeaderLauncher {
18
19
  this.open = false;
19
20
  }
20
21
  }
22
+ handleKeyDown(event) {
23
+ if (event.key === 'Escape' && this.open) {
24
+ this.open = false;
25
+ this.buttonEl.shadowRoot.querySelector('button').focus();
26
+ }
27
+ }
21
28
  componentDidLoad() {
22
29
  const hasListTypeMenu = !!this.host.querySelector('tds-header-launcher-list');
23
30
  this.hasListTypeMenu = hasListTypeMenu;
24
31
  }
25
32
  toggleLauncher() {
26
33
  this.open = !this.open;
34
+ if (this.open) {
35
+ requestAnimationFrame(() => {
36
+ const selectors = "a, [tabindex='0']";
37
+ const firstFocusableElement = this.host.shadowRoot.querySelector(selectors) || this.host.querySelector(selectors);
38
+ if (firstFocusableElement instanceof HTMLElement) {
39
+ firstFocusableElement.focus();
40
+ }
41
+ });
42
+ }
43
+ }
44
+ connectedCallback() {
45
+ if (!this.tdsAriaLabel) {
46
+ console.warn('Tegel Header Launcher component: missing tdsAriaLabel prop');
47
+ }
27
48
  }
28
49
  render() {
29
50
  this.ariaAttributes = Object.assign(Object.assign({}, this.ariaAttributes), inheritAriaAttributes(this.host, ['role']));
@@ -32,11 +53,11 @@ export class TdsHeaderLauncher {
32
53
  }, 'ref': (el) => {
33
54
  this.buttonEl = el;
34
55
  } });
35
- return (h(Host, { key: 'd886168b8834ced8a2705b30b9982726dc72f8b6' }, h("div", { key: '0c4b9b27e82cf91c000619ef8d0593f8b664b605', class: {
56
+ return (h(Host, { key: '3a0100f1429a1e09a5745c6b74835bddb6ba5157' }, h("div", { key: '50220e92372ac5496a4b589441e4920375169e79', class: {
36
57
  'wrapper': true,
37
58
  'state-open': this.open,
38
59
  'state-list-type-menu': this.hasListTypeMenu,
39
- } }, h("tds-header-launcher-button", Object.assign({ key: 'd0ff7205bf79ef4744d65dcf98734aff5520b004' }, buttonAttributes)), this.buttonEl && (h("tds-popover-canvas", { key: 'c337c31282b08c5add95b16271bdfc147fd16c5c', id: `tds-launcher-${this.uuid}`, class: "menu", referenceEl: this.buttonEl, placement: "bottom-start", show: this.open, offsetDistance: 0, modifiers: [
60
+ } }, h("tds-header-launcher-button", Object.assign({ key: 'd58c3ba5f08809487eeca1e6ce8a31879f0c52d9' }, buttonAttributes, { "tds-aria-label": this.tdsAriaLabel })), this.buttonEl && (h("tds-popover-canvas", { key: '4806b02e07aef32a640eedc1f0f76285950ec384', id: `tds-launcher-${this.uuid}`, class: "menu", referenceEl: this.buttonEl, placement: "bottom-start", show: this.open, offsetDistance: 0, modifiers: [
40
61
  {
41
62
  name: 'flip',
42
63
  options: {
@@ -57,6 +78,27 @@ export class TdsHeaderLauncher {
57
78
  "$": ["header-launcher.css"]
58
79
  };
59
80
  }
81
+ static get properties() {
82
+ return {
83
+ "tdsAriaLabel": {
84
+ "type": "string",
85
+ "mutable": false,
86
+ "complexType": {
87
+ "original": "string",
88
+ "resolved": "string",
89
+ "references": {}
90
+ },
91
+ "required": false,
92
+ "optional": false,
93
+ "docs": {
94
+ "tags": [],
95
+ "text": "Value to be used by the aria-label attribute of the launcher button"
96
+ },
97
+ "attribute": "tds-aria-label",
98
+ "reflect": false
99
+ }
100
+ };
101
+ }
60
102
  static get states() {
61
103
  return {
62
104
  "open": {},
@@ -72,6 +114,12 @@ export class TdsHeaderLauncher {
72
114
  "target": "window",
73
115
  "capture": false,
74
116
  "passive": false
117
+ }, {
118
+ "name": "keydown",
119
+ "method": "handleKeyDown",
120
+ "target": "window",
121
+ "capture": false,
122
+ "passive": false
75
123
  }];
76
124
  }
77
125
  }
@@ -3,11 +3,12 @@ import inheritAriaAttributes from "../../../utils/inheritAriaAttributes";
3
3
  export class TdsHeaderLauncherButton {
4
4
  constructor() {
5
5
  this.active = false;
6
+ this.tdsAriaLabel = undefined;
6
7
  }
7
8
  render() {
8
9
  this.ariaAttributes = Object.assign(Object.assign({}, this.ariaAttributes), inheritAriaAttributes(this.host));
9
10
  const buttonProps = Object.assign({}, this.ariaAttributes);
10
- return (h(Host, { key: '335cfea4d8b36b95639985dc4a67f6ccc891d122' }, h("tds-header-item", { key: '0b497a3b369d43dd3c43f4471e9e9d825f2b5bd1', active: this.active }, h("button", Object.assign({ key: '84aaba13ed00d3515f98d81b419ab2898bca4910' }, buttonProps), h("tds-icon", { key: 'f65b047f5c36222b20c73ffd2340eebca0f47d33', class: "icon", name: "bento", size: "20px" })))));
11
+ return (h(Host, { key: '445f5863dd96c417c99e460248bd0f2c2a224f0a' }, h("tds-header-item", { key: '792692a34c1192d37e81322a8e75387e51954ebe', active: this.active }, h("button", Object.assign({ key: '7be3e9e148ceab7b361f37b1029dfad474db7b16' }, buttonProps, { "aria-label": this.tdsAriaLabel }), h("tds-icon", { key: '5001f19dfa40ade6a9c64052caa4c38de901a5d4', class: "icon", name: "bento", size: "20px", "svg-title": this.tdsAriaLabel })))));
11
12
  }
12
13
  static get is() { return "tds-header-launcher-button"; }
13
14
  static get encapsulation() { return "shadow"; }
@@ -40,6 +41,23 @@ export class TdsHeaderLauncherButton {
40
41
  "attribute": "active",
41
42
  "reflect": false,
42
43
  "defaultValue": "false"
44
+ },
45
+ "tdsAriaLabel": {
46
+ "type": "string",
47
+ "mutable": false,
48
+ "complexType": {
49
+ "original": "string",
50
+ "resolved": "string",
51
+ "references": {}
52
+ },
53
+ "required": false,
54
+ "optional": false,
55
+ "docs": {
56
+ "tags": [],
57
+ "text": "Value to be used by the aria-label attribute"
58
+ },
59
+ "attribute": "tds-aria-label",
60
+ "reflect": false
43
61
  }
44
62
  };
45
63
  }
@@ -5,12 +5,13 @@ export class Icon {
5
5
  constructor() {
6
6
  this.setIcons = () => this.arrayOfIcons.map((element) => {
7
7
  if (element.name === this.name) {
8
- return (h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", "aria-labelledby": this.svgTitle ? `title-${this.name}` : undefined, "aria-describedby": this.svgDescription ? `desc-${this.name}` : undefined, role: "img", style: { fontSize: this.size }, height: this.size, width: this.size }, this.svgTitle && h("title", { id: `title-${this.name}` }, this.svgTitle), this.svgDescription && h("desc", { id: `desc-${this.name}` }, this.svgDescription), h("path", { fill: "currentColor", d: element.definition })));
8
+ return (h("svg", { "aria-hidden": this.tdsAriaHidden, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", "aria-labelledby": this.svgTitle ? `title-${this.name}` : undefined, "aria-describedby": this.svgDescription ? `desc-${this.name}` : undefined, role: "img", style: { fontSize: this.size }, height: this.size, width: this.size }, this.svgTitle && h("title", { id: `title-${this.name}` }, this.svgTitle), this.svgDescription && h("desc", { id: `desc-${this.name}` }, this.svgDescription), h("path", { fill: "currentColor", d: element.definition })));
9
9
  }
10
10
  });
11
11
  this.name = 'truck';
12
12
  this.size = '16px';
13
13
  this.svgTitle = undefined;
14
+ this.tdsAriaHidden = false;
14
15
  this.svgDescription = undefined;
15
16
  this.icons_object = iconsCollection;
16
17
  this.arrayOfIcons = [];
@@ -28,7 +29,7 @@ export class Icon {
28
29
  this.arrayOfIcons = [...this.arrayOfIcons];
29
30
  }
30
31
  render() {
31
- return h(Host, { key: '7501bac4e182e5b44030b140b4c2c68e0fd2522b' }, this.setIcons());
32
+ return h(Host, { key: 'd19a1de2f0267b93717324d424b9c89e19bbcb21' }, this.setIcons());
32
33
  }
33
34
  static get is() { return "tds-icon"; }
34
35
  static get encapsulation() { return "shadow"; }
@@ -103,6 +104,24 @@ export class Icon {
103
104
  "attribute": "svg-title",
104
105
  "reflect": false
105
106
  },
107
+ "tdsAriaHidden": {
108
+ "type": "boolean",
109
+ "mutable": false,
110
+ "complexType": {
111
+ "original": "boolean",
112
+ "resolved": "boolean",
113
+ "references": {}
114
+ },
115
+ "required": false,
116
+ "optional": false,
117
+ "docs": {
118
+ "tags": [],
119
+ "text": "Set aria-hidden attribute on svg"
120
+ },
121
+ "attribute": "tds-aria-hidden",
122
+ "reflect": false,
123
+ "defaultValue": "false"
124
+ },
106
125
  "svgDescription": {
107
126
  "type": "string",
108
127
  "mutable": false,
@@ -1,34 +1,31 @@
1
+ /* Typography Usage mixins */
2
+ /* Centralized map of typography types */
3
+ /* Utility mixin */
1
4
  /* MIXINS */
2
5
  /* MODAL STYLING */
3
6
  .tds-modal {
4
7
  box-sizing: border-box;
5
- background-color: var(--tds-modal-background);
8
+ background-color: var(--background-elevation-layer-02);
6
9
  margin: auto;
7
10
  position: relative;
8
- border-radius: 4px;
11
+ border-radius: var(--radius-narrow);
9
12
  max-height: 85vh;
10
13
  overflow-y: auto;
11
14
  pointer-events: auto;
12
- /* SCROLL STUFF */
13
- /* width */
14
- /* Track */
15
- /* Handle */
16
15
  }
17
16
  .tds-modal * {
18
17
  box-sizing: border-box;
19
18
  }
20
19
  .tds-modal::-webkit-scrollbar {
21
- width: 5px;
22
- background-color: var(--tds-grey-300);
23
- border-radius: 0 1em 1em 0;
20
+ width: 6px;
21
+ background-color: transparent;
24
22
  }
25
23
  .tds-modal::-webkit-scrollbar-track {
26
- background-color: var(--tds-grey-300);
27
- border-radius: 0 1em 1em 0;
24
+ background-color: transparent;
28
25
  }
29
26
  .tds-modal::-webkit-scrollbar-thumb {
30
- background-color: var(--tds-grey-500);
31
- border-radius: 0 1em 1em 0;
27
+ background-color: var(--foreground-elements-transparparent-discrete);
28
+ border-radius: 3px;
32
29
  }
33
30
  .tds-modal__actions-sticky {
34
31
  overflow: hidden;
@@ -36,8 +33,12 @@
36
33
  flex-direction: column;
37
34
  }
38
35
  .tds-modal__actions-sticky .body {
39
- font: var(--tds-body-01);
40
- letter-spacing: var(--tds-body-01-ls);
36
+ font-family: var(--body-01-font-family);
37
+ font-size: var(--body-01-font-size);
38
+ line-height: var(--body-01-line-height);
39
+ font-weight: var(--body-01-font-weight);
40
+ letter-spacing: var(--body-01-letter-spacing);
41
+ text-transform: var(--body-01-text-transform);
41
42
  max-height: calc(85vh - 36px);
42
43
  overflow-y: auto;
43
44
  }
@@ -45,13 +46,13 @@
45
46
  bottom: -1px;
46
47
  left: 0;
47
48
  right: 0;
48
- background-color: var(--tds-modal-background);
49
- padding: var(--tds-spacing-element-24) var(--tds-spacing-element-16) var(--tds-spacing-element-16);
49
+ background-color: var(--background-elevation-layer-02);
50
+ padding: 24px 16px 16px;
50
51
  display: flex;
51
52
  gap: 16px;
52
53
  }
53
54
  .tds-modal__actions-static slot[name=actions] {
54
- background-color: var(--tds-modal-background);
55
+ background-color: var(--background-elevation-layer-02);
55
56
  display: flex;
56
57
  gap: 16px;
57
58
  padding: 24px 16px 16px;
@@ -142,43 +143,47 @@
142
143
  /* MODAL SUB ELEMENTS */
143
144
  .header {
144
145
  display: flex;
145
- padding: var(--tds-spacing-element-16);
146
+ padding: 16px;
146
147
  position: sticky;
147
148
  top: 0;
148
- background-color: var(--tds-modal-background);
149
+ background-color: var(--background-elevation-layer-02);
149
150
  z-index: 1;
150
151
  }
151
152
 
152
153
  .header,
153
154
  slot[name=header]::slotted(*) {
154
- color: var(--tds-modal-text);
155
- /* !important is needed here to prevent this from being overwritten by our CSS-reset. */
156
- font: var(--tds-headline-05) !important;
157
- letter-spacing: var(--tds-headline-05-ls) !important;
155
+ font-family: var(--headline-05-font-family);
156
+ font-size: var(--headline-05-font-size);
157
+ line-height: var(--headline-05-line-height);
158
+ font-weight: var(--headline-05-font-weight);
159
+ letter-spacing: var(--headline-05-letter-spacing);
160
+ text-transform: var(--headline-05-text-transform);
161
+ color: var(--foreground-text-strong);
158
162
  margin: 0;
159
163
  flex: 1;
160
164
  }
161
165
 
162
166
  .body {
163
- color: var(--tds-modal-text);
164
- font: var(--tds-body-01);
165
- letter-spacing: var(--tds-body-01-ls);
167
+ font-family: var(--body-01-font-family);
168
+ font-size: var(--body-01-font-size);
169
+ line-height: var(--body-01-line-height);
170
+ font-weight: var(--body-01-font-weight);
171
+ letter-spacing: var(--body-01-letter-spacing);
172
+ text-transform: var(--body-01-text-transform);
173
+ color: var(--foreground-text-strong);
166
174
  overflow-y: visible;
167
- padding: 0 var(--tds-spacing-element-16) var(--tds-spacing-element-16);
168
- /* SCROLL STUFF */
169
- /* width */
170
- /* Track */
171
- /* Handle */
175
+ padding: 0 16px 16px;
172
176
  }
173
177
  .body::-webkit-scrollbar {
174
- width: 5px;
175
- background-color: var(--tds-grey-300);
178
+ width: 6px;
179
+ background-color: transparent;
176
180
  }
177
181
  .body::-webkit-scrollbar-track {
178
- background-color: var(--tds-grey-300);
182
+ background-color: transparent;
179
183
  }
180
184
  .body::-webkit-scrollbar-thumb {
181
- background-color: var(--tds-grey-500);
185
+ background-color: var(--foreground-elements-transparparent-discrete);
186
+ border-radius: 3px;
182
187
  }
183
188
 
184
189
  .tds-modal-backdrop {
@@ -188,7 +193,7 @@ slot[name=header]::slotted(*) {
188
193
  right: 0;
189
194
  bottom: 0;
190
195
  left: 0;
191
- background-color: var(--tds-modal-backdrop);
196
+ background-color: var(--background-elevation-scrim);
192
197
  pointer-events: auto;
193
198
  }
194
199
  .tds-modal-backdrop * {
@@ -206,7 +211,7 @@ button.tds-modal-close {
206
211
  .tds-modal-close {
207
212
  display: inline-block;
208
213
  height: auto;
209
- color: var(--tds-modal-icon);
214
+ color: var(--foreground-text-strong);
210
215
  cursor: pointer;
211
216
  }
212
217
  .tds-modal-close:focus {
@@ -215,12 +220,12 @@ button.tds-modal-close {
215
220
  }
216
221
  @media (min-width: 320px) {
217
222
  .tds-modal-close {
218
- margin-left: var(--tds-spacing-element-16);
223
+ margin-left: 16px;
219
224
  }
220
225
  }
221
226
  @media (min-width: 1056px) {
222
227
  .tds-modal-close {
223
- margin-left: var(--tds-spacing-element-48);
228
+ margin-left: 48px;
224
229
  }
225
230
  }
226
231
 
@@ -232,16 +237,16 @@ button.tds-modal-close {
232
237
  }
233
238
  @media (min-width: 320px) {
234
239
  .tds-modal-close-btn {
235
- margin-left: var(--tds-spacing-element-16);
240
+ margin-left: 16px;
236
241
  }
237
242
  }
238
243
  @media (min-width: 1056px) {
239
244
  .tds-modal-close-btn {
240
- margin-left: var(--tds-spacing-element-48);
245
+ margin-left: 48px;
241
246
  }
242
247
  }
243
248
  .tds-modal-close-btn svg {
244
- fill: var(--tds-modal-icon);
249
+ fill: var(--foreground-text-strong);
245
250
  }
246
251
 
247
252
  .tds-modal-overflow {
@@ -1,5 +1,6 @@
1
1
  import { h, Host, } from "@stencil/core";
2
2
  import hasSlot from "../../utils/hasSlot";
3
+ import generateUniqueId from "../../utils/generateUniqueId";
3
4
  /**
4
5
  * @slot header - Slot for header text
5
6
  * @slot body - Slot for main content of modal
@@ -9,6 +10,7 @@ export class TdsModal {
9
10
  constructor() {
10
11
  this.handleClose = (event) => {
11
12
  const closeEvent = this.tdsClose.emit(event);
13
+ this.returnFocusOnClose();
12
14
  if (!closeEvent.defaultPrevented) {
13
15
  this.isShown = false;
14
16
  }
@@ -57,15 +59,26 @@ export class TdsModal {
57
59
  this.referenceEl = undefined;
58
60
  this.show = undefined;
59
61
  this.closable = true;
62
+ this.tdsAlertDialog = 'dialog';
60
63
  this.isShown = false;
64
+ this.activeElementIndex = 0;
61
65
  }
62
66
  /** Shows the Modal. */
63
67
  async showModal() {
64
68
  this.isShown = true;
69
+ // Set focus on first element when opened
70
+ requestAnimationFrame(() => {
71
+ const focusableElements = this.getFocusableElements();
72
+ if (focusableElements.length > 0) {
73
+ focusableElements[0].focus();
74
+ this.activeElementIndex = 0;
75
+ }
76
+ });
65
77
  }
66
78
  /** Closes the Modal. */
67
79
  async closeModal() {
68
80
  this.isShown = false;
81
+ this.returnFocusOnClose();
69
82
  }
70
83
  connectedCallback() {
71
84
  if (this.closable === undefined) {
@@ -103,6 +116,63 @@ export class TdsModal {
103
116
  dismissButton.removeEventListener('click', this.handleClose);
104
117
  });
105
118
  }
119
+ returnFocusOnClose() {
120
+ var _a;
121
+ let referenceEl = (_a = this.referenceEl) !== null && _a !== void 0 ? _a : document.querySelector(this.selector);
122
+ const potentialReferenceElements = ['BUTTON', 'A', 'INPUT'];
123
+ // If referenced element is a custom element eg: tds-button we find the interactive element inside
124
+ if (potentialReferenceElements.indexOf(referenceEl.tagName) < 0) {
125
+ referenceEl = referenceEl.querySelectorAll(potentialReferenceElements.join(','))[0];
126
+ }
127
+ referenceEl.focus();
128
+ }
129
+ getFocusableElements() {
130
+ const focusableSelectors = [
131
+ 'a[href]',
132
+ 'button:not([disabled])',
133
+ 'textarea:not([disabled])',
134
+ 'input:not([disabled])',
135
+ 'select:not([disabled])',
136
+ '[tabindex]:not([tabindex="-1"])',
137
+ ].join(',');
138
+ const focusableInShadowRoot = Array.from(this.host.shadowRoot.querySelectorAll(focusableSelectors));
139
+ const focusableInSlots = Array.from(this.host.querySelectorAll(focusableSelectors));
140
+ /** Focusable elements */
141
+ return [...focusableInShadowRoot, ...focusableInSlots];
142
+ }
143
+ handleFocusTrap(event) {
144
+ if (event.key === 'Escape' && this.isShown && !this.prevent) {
145
+ this.handleClose(event);
146
+ return;
147
+ }
148
+ // Only trap focus if the modal is open
149
+ if (!this.isShown)
150
+ return;
151
+ // We care only about the Tab key
152
+ if (event.key !== 'Tab')
153
+ return;
154
+ const focusableElements = this.getFocusableElements();
155
+ // If there are no focusable elements
156
+ if (focusableElements.length === 0)
157
+ return;
158
+ event.preventDefault();
159
+ // Going backwards (Shift + Tab) on the first element => move to last
160
+ if (event.shiftKey) {
161
+ this.activeElementIndex -= 1;
162
+ if (this.activeElementIndex === -1) {
163
+ this.activeElementIndex = focusableElements.length - 1;
164
+ }
165
+ }
166
+ // // Going forwards (Tab) on the last element => move to first
167
+ if (!event.shiftKey) {
168
+ this.activeElementIndex += 1;
169
+ if (this.activeElementIndex === focusableElements.length) {
170
+ this.activeElementIndex = 0;
171
+ }
172
+ }
173
+ const nextElement = focusableElements[this.activeElementIndex];
174
+ nextElement.focus();
175
+ }
106
176
  /** Adds an event listener to the dismiss buttons that closes the Modal. */
107
177
  setDismissButtons() {
108
178
  this.host.querySelectorAll('[data-dismiss-modal]').forEach((dismissButton) => {
@@ -112,10 +182,12 @@ export class TdsModal {
112
182
  render() {
113
183
  const usesHeaderSlot = hasSlot('header', this.host);
114
184
  const usesActionsSlot = hasSlot('actions', this.host);
115
- return (h(Host, { key: '3b815395be0ccab91eebda3ca785528de624d17e', class: {
185
+ const headerId = this.header ? `tds-modal-header-${generateUniqueId()}` : undefined;
186
+ const bodyId = `tds-modal-body-${generateUniqueId()}`;
187
+ return (h(Host, { key: '398809ea45126dd70b95422f2f7a08a481a22d53', role: this.tdsAlertDialog, "aria-modal": "true", "aria-describedby": bodyId, "aria-labelledby": headerId, class: {
116
188
  show: this.isShown,
117
189
  hide: !this.isShown,
118
- }, onClick: (event) => this.handleOverlayClick(event) }, h("div", { key: '84c9952f862e5defe06c04040e7031e08c5caca3', class: "tds-modal-backdrop" }), h("div", { key: '42b3ea985203a582b3a3dee5250b4a4468a23d6f', class: `tds-modal tds-modal__actions-${this.actionsPosition} tds-modal-${this.size}` }, h("div", { key: '06e005618aeab759c01f7d556cc4357f0aed0e1d', class: "header" }, this.header && h("div", { key: 'bff8080a479c4ecef96eae35dc0f33cc3fadaa8c', class: "header-text" }, this.header), usesHeaderSlot && h("slot", { key: 'dbec4b999fcda87c5c751a8cf3eb7b9f66e1ec43', name: "header" }), this.closable && (h("button", { key: 'bfbfe0d3419aa5e2a5fcbab7691560ed5619dd05', class: "tds-modal-close", "aria-label": "close", onClick: (event) => this.handleClose(event) }, h("tds-icon", { key: '3bcd38d4234a689acd63bb82e21b270c2b0825f9', name: "cross", size: "20px" })))), h("div", { key: '2fc5756d3261dfa354ce3025dc9d8ff213c49ba1', class: "body" }, h("slot", { key: '389ac6e307873c9de7c36c0960ce578cdfaf88e4', name: "body" })), usesActionsSlot && h("slot", { key: 'c964f9d3999f26995543187c553adcc9ac392f2a', name: "actions" }))));
190
+ }, 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" }))));
119
191
  }
120
192
  static get is() { return "tds-modal"; }
121
193
  static get encapsulation() { return "shadow"; }
@@ -273,12 +345,31 @@ export class TdsModal {
273
345
  "attribute": "closable",
274
346
  "reflect": false,
275
347
  "defaultValue": "true"
348
+ },
349
+ "tdsAlertDialog": {
350
+ "type": "string",
351
+ "mutable": false,
352
+ "complexType": {
353
+ "original": "'alertdialog' | 'dialog'",
354
+ "resolved": "\"alertdialog\" | \"dialog\"",
355
+ "references": {}
356
+ },
357
+ "required": false,
358
+ "optional": false,
359
+ "docs": {
360
+ "tags": [],
361
+ "text": "Role of the modal component. Can be either 'alertdialog' for important messages that require immediate attention, or 'dialog' for regular messages."
362
+ },
363
+ "attribute": "tds-alert-dialog",
364
+ "reflect": false,
365
+ "defaultValue": "'dialog'"
276
366
  }
277
367
  };
278
368
  }
279
369
  static get states() {
280
370
  return {
281
- "isShown": {}
371
+ "isShown": {},
372
+ "activeElementIndex": {}
282
373
  };
283
374
  }
284
375
  static get events() {
@@ -372,4 +463,13 @@ export class TdsModal {
372
463
  };
373
464
  }
374
465
  static get elementRef() { return "host"; }
466
+ static get listeners() {
467
+ return [{
468
+ "name": "keydown",
469
+ "method": "handleFocusTrap",
470
+ "target": "window",
471
+ "capture": true,
472
+ "passive": false
473
+ }];
474
+ }
375
475
  }
@@ -15,6 +15,7 @@ export class TdsPopoverCanvas {
15
15
  this.animation = 'none';
16
16
  this.offsetDistance = 8;
17
17
  this.modifiers = [];
18
+ this.tdsAlertDialog = 'dialog';
18
19
  this.childRef = undefined;
19
20
  }
20
21
  /** Property for closing popover programmatically */
@@ -27,12 +28,12 @@ export class TdsPopoverCanvas {
27
28
  }
28
29
  render() {
29
30
  var _a;
30
- return (h(Host, { key: '68de2e7161c5060c98b1c0c78050f41a716228ee' }, h("tds-popover-core", Object.assign({ key: 'f50ae36ac2b76445d78cbe4750820d3c684e862a' }, this.inheritedAttributes, { class: {
31
+ return (h(Host, { key: '65f267d001dc720000b13f6b46010781ccd3119c' }, h("tds-popover-core", Object.assign({ key: '5a3df2dbc918a330f895fbfb4bbf1a5a6ebe2c21', role: this.tdsAlertDialog }, this.inheritedAttributes, { class: {
31
32
  'tds-popover-canvas': true,
32
33
  [(_a = this.inheritedAttributes.class) !== null && _a !== void 0 ? _a : '']: true,
33
34
  }, selector: this.selector, referenceEl: this.referenceEl, show: this.show, placement: this.placement, offsetSkidding: this.offsetSkidding, offsetDistance: this.offsetDistance, modifiers: this.modifiers, trigger: 'click', ref: (el) => {
34
35
  this.childRef = el;
35
- }, defaultShow: this.defaultShow, animation: this.animation }), h("div", { key: '1dac1d925ab9673219449d3885cd7430a3e3f188' }, h("slot", { key: '9c5d3c152b63e0afd8c30e4960edbd2aa3418fd2' })))));
36
+ }, defaultShow: this.defaultShow, animation: this.animation }), h("div", { key: '3c24d23c70824186c971ce3cfe79d2d14ac472a1' }, h("slot", { key: 'ca58b5e939aabdbe80ca92d747c191f08ad34b4d' })))));
36
37
  }
37
38
  static get is() { return "tds-popover-canvas"; }
38
39
  static get encapsulation() { return "scoped"; }
@@ -219,6 +220,24 @@ export class TdsPopoverCanvas {
219
220
  "text": "Array of modifier objects to pass to popper.js. See https://popper.js.org/docs/v2/modifiers/"
220
221
  },
221
222
  "defaultValue": "[]"
223
+ },
224
+ "tdsAlertDialog": {
225
+ "type": "string",
226
+ "mutable": false,
227
+ "complexType": {
228
+ "original": "'alertdialog' | 'dialog'",
229
+ "resolved": "\"alertdialog\" | \"dialog\"",
230
+ "references": {}
231
+ },
232
+ "required": false,
233
+ "optional": false,
234
+ "docs": {
235
+ "tags": [],
236
+ "text": "Role of the popover canvas component. Can be either 'alertdialog' for important messages that require immediate attention, or 'dialog' for regular messages."
237
+ },
238
+ "attribute": "tds-alert-dialog",
239
+ "reflect": false,
240
+ "defaultValue": "'dialog'"
222
241
  }
223
242
  };
224
243
  }