@scania/tegel 1.30.0-beta-enhance-focus-dropdown.0 → 1.31.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.
Files changed (46) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/tds-accordion-item.cjs.entry.js +25 -3
  3. package/dist/cjs/tds-dropdown_2.cjs.entry.js +9 -30
  4. package/dist/cjs/tds-modal.cjs.entry.js +14 -4
  5. package/dist/cjs/tds-popover-core.cjs.entry.js +1 -1
  6. package/dist/cjs/tegel.cjs.js +1 -1
  7. package/dist/collection/components/accordion/accordion-item/accordion-item.js +77 -4
  8. package/dist/collection/components/dropdown/dropdown.js +9 -30
  9. package/dist/collection/components/modal/modal.js +45 -4
  10. package/dist/collection/components/popover-core/tds-popover-core.css +359 -89
  11. package/dist/components/{p-e7d40d15.js → p-4420365f.js} +1 -1
  12. package/dist/components/{p-c54d2efe.js → p-516d8085.js} +1 -1
  13. package/dist/components/p-96e83134.js +2098 -0
  14. package/dist/components/{p-0f58e26f.js → p-adbf32b9.js} +9 -30
  15. package/dist/components/tds-accordion-item.js +30 -5
  16. package/dist/components/tds-dropdown.js +1 -1
  17. package/dist/components/tds-header-dropdown.js +2 -2
  18. package/dist/components/tds-header-launcher.js +2 -2
  19. package/dist/components/tds-modal.js +15 -4
  20. package/dist/components/tds-popover-canvas.js +1 -1
  21. package/dist/components/tds-popover-core.js +1 -1
  22. package/dist/components/tds-popover-menu.js +1 -1
  23. package/dist/components/tds-table-footer.js +1 -1
  24. package/dist/components/tds-textarea.js +2 -2
  25. package/dist/components/tds-tooltip.js +1 -1
  26. package/dist/esm/loader.js +1 -1
  27. package/dist/esm/tds-accordion-item.entry.js +25 -3
  28. package/dist/esm/tds-dropdown_2.entry.js +9 -30
  29. package/dist/esm/tds-modal.entry.js +14 -4
  30. package/dist/esm/tds-popover-core.entry.js +1 -1
  31. package/dist/esm/tegel.js +1 -1
  32. package/dist/tegel/p-2b8e97e1.entry.js +1 -0
  33. package/dist/tegel/p-3e4707fb.entry.js +1 -0
  34. package/dist/tegel/p-ae0fed95.entry.js +1 -0
  35. package/dist/tegel/p-b58c7bed.entry.js +1 -0
  36. package/dist/tegel/tegel.css +1 -3
  37. package/dist/tegel/tegel.esm.js +1 -1
  38. package/dist/types/components/accordion/accordion-item/accordion-item.d.ts +6 -0
  39. package/dist/types/components/modal/modal.d.ts +6 -2
  40. package/dist/types/components.d.ts +21 -0
  41. package/package.json +1 -1
  42. package/dist/components/p-405c5512.js +0 -2098
  43. package/dist/tegel/p-acdd29b8.entry.js +0 -1
  44. package/dist/tegel/p-c3d91dfa.entry.js +0 -1
  45. package/dist/tegel/p-d56f426f.entry.js +0 -1
  46. package/dist/tegel/p-f71c3fca.entry.js +0 -1
@@ -9,14 +9,20 @@ const TdsModal = class {
9
9
  constructor(hostRef) {
10
10
  registerInstance(this, hostRef);
11
11
  this.tdsClose = createEvent(this, "tdsClose", 7);
12
+ this.tdsOpen = createEvent(this, "tdsOpen", 7);
12
13
  this.handleClose = (event) => {
13
14
  const closeEvent = this.tdsClose.emit(event);
14
15
  this.returnFocusOnClose();
15
- if (!closeEvent.defaultPrevented) {
16
- this.isShown = false;
16
+ if (closeEvent.defaultPrevented) {
17
+ return;
17
18
  }
19
+ this.isShown = false;
18
20
  };
19
21
  this.handleShow = () => {
22
+ const showEvent = this.tdsOpen.emit();
23
+ if (showEvent.defaultPrevented) {
24
+ return;
25
+ }
20
26
  this.isShown = true;
21
27
  };
22
28
  /** Checks if click on Modal is on overlay, if so it closes the Modal if prevent is not true. */
@@ -81,6 +87,10 @@ const TdsModal = class {
81
87
  this.isShown = false;
82
88
  this.returnFocusOnClose();
83
89
  }
90
+ /** Returns the current open state of the Modal. */
91
+ async isOpen() {
92
+ return this.isShown;
93
+ }
84
94
  connectedCallback() {
85
95
  if (this.closable === undefined) {
86
96
  this.closable = true;
@@ -197,10 +207,10 @@ const TdsModal = class {
197
207
  const usesActionsSlot = hasSlot('actions', this.host);
198
208
  const headerId = this.header ? `tds-modal-header-${generateUniqueId()}` : undefined;
199
209
  const bodyId = `tds-modal-body-${generateUniqueId()}`;
200
- return (h(Host, { key: 'b6fb1dda221f31cf3491d6f00c94c0afc71f202d', role: this.tdsAlertDialog, "aria-modal": "true", "aria-describedby": bodyId, "aria-labelledby": headerId, class: {
210
+ return (h(Host, { key: '2d39760de58fd957585e4370aa88447d85249eca', role: this.tdsAlertDialog, "aria-modal": "true", "aria-describedby": bodyId, "aria-labelledby": headerId, class: {
201
211
  show: this.isShown,
202
212
  hide: !this.isShown,
203
- }, onClick: (event) => this.handleOverlayClick(event) }, h("div", { key: 'c684d1abcbf62e14ab2ea677c99d5da262aa7796', class: "tds-modal-backdrop" }), h("div", { key: '4f6c74bba05c15ff7c5e63759b71e8414b122d01', class: `tds-modal tds-modal__actions-${this.actionsPosition} tds-modal-${this.size}` }, h("div", { key: '2c8d39f0ff25d0e2496039c90793fd76897d8c8f', id: headerId, class: "header" }, this.header && h("div", { key: '35947f6bd06b54a2ea6f8cdbfde9d8374b17f250', class: "header-text" }, this.header), usesHeaderSlot && h("slot", { key: '3149db0af6218f90723e95345da1fd705c3d121e', name: "header" }), this.closable && (h("button", { key: 'e0f1c8afdbb2e4e7bd08933f7becf6b7b042267b', class: "tds-modal-close", "aria-label": "close", onClick: (event) => this.handleClose(event) }, h("tds-icon", { key: 'b650bf57c65e3314ce5e73963393f9b53fe7e191', name: "cross", size: "20px" })))), h("div", { key: '94992a62e1d75d0decf7583e5d97d498a8f0ce16', id: bodyId, class: "body" }, h("slot", { key: '3d7efacca7e0124c8344050e9d34523971e77448', name: "body" })), usesActionsSlot && h("slot", { key: '735a622c7218961ec631585595485e7722907c6b', name: "actions" }))));
213
+ }, onClick: (event) => this.handleOverlayClick(event) }, h("div", { key: '5eeaf5c29529bf77ddde4892067f13d312d1bba7', class: "tds-modal-backdrop" }), h("div", { key: '8a6ccd911dfec947a809320a0631d5f9904ef78d', class: `tds-modal tds-modal__actions-${this.actionsPosition} tds-modal-${this.size}` }, h("div", { key: 'b7c760ebded4e98319cec75c161002a579316902', id: headerId, class: "header" }, this.header && h("div", { key: 'db14e71913052ba5367ab95a41a366c7f2dea4a3', class: "header-text" }, this.header), usesHeaderSlot && h("slot", { key: '62b394718c78e564fd50e7ff3328e637a63679e6', name: "header" }), this.closable && (h("button", { key: '9ff8ad81be4f72ee6a298a9ba39a1024269d3ec2', class: "tds-modal-close", "aria-label": "close", onClick: (event) => this.handleClose(event) }, h("tds-icon", { key: 'b34b8a55c7f5c65ce7a3fdee6114c66ee4ab82c3', name: "cross", size: "20px" })))), h("div", { key: 'ab04e506dd94c69d8f91fb774fa85f355f3629d4', id: bodyId, class: "body" }, h("slot", { key: 'f4a8e2377b4cae3a9c4fa1032e896b0b0c58a06a', name: "body" })), usesActionsSlot && h("slot", { key: '09137d7c8b81f91dbf419b10c8a085de25df1272', name: "actions" }))));
204
214
  }
205
215
  get host() { return getElement(this); }
206
216
  };