@outbook/webcomponents-modal-dialog 1.0.3 → 1.0.4

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/modal-dialog.js CHANGED
@@ -5,7 +5,6 @@ import { Scrollable } from '@outbook/webcomponents-scrollable';
5
5
  import { TypeIcon } from '@outbook/webcomponents-type-icon/shadow';
6
6
  import { close } from '@outbook/icons';
7
7
  import { DialogBase } from './_lib/dialog-base.js';
8
- import { tmplSlot } from './_lib/tmpl-slot.js';
9
8
  import { Tabs } from '@outbook/webcomponents-tabs';
10
9
  import { getI18n } from './_i18n/i18n.js';
11
10
  import styleComponent from './_style/modal-dialog.style.js';
@@ -27,6 +26,13 @@ function DialogUi(props) {
27
26
  view = null,
28
27
  tabs = []
29
28
  } = props;
29
+ const dialogContent =
30
+ view !== null
31
+ ? view({ closeDialog: handlers.close })
32
+ : tabs.length
33
+ ? Tabs({ items: tabs, isInDialog: true })
34
+ : nothing;
35
+
30
36
  return html`
31
37
  <outbook-modal-dialog
32
38
  class="dialog--host"
@@ -35,16 +41,10 @@ function DialogUi(props) {
35
41
  literals,
36
42
  handlers,
37
43
  dialogId: baseId,
38
- portalWrapperId,
39
- content: () => {
40
- return view !== null
41
- ? view({ closeDialog: handlers.close })
42
- : tabs.length
43
- ? Tabs({ items: tabs, isInDialog: true })
44
- : nothing;
45
- }
44
+ portalWrapperId
46
45
  }}"
47
- ></outbook-modal-dialog>
46
+ >${dialogContent}</outbook-modal-dialog
47
+ >
48
48
  `;
49
49
  }
50
50
 
@@ -91,6 +91,16 @@ function DialogUiComponent(element) {
91
91
  'dialog--scroll': hasScroll
92
92
  });
93
93
 
94
+ function contentSlot() {
95
+ return html`
96
+ <div class="dialog__content-wrapper">
97
+ <div class="dialog__content" id="${dialogId}-view">
98
+ <slot>${content ? content() : nothing}</slot>
99
+ </div>
100
+ </div>
101
+ `;
102
+ }
103
+
94
104
  return html`
95
105
  <div tabindex="0" @focus="${refocusEnd}"></div>
96
106
  <div
@@ -137,9 +147,9 @@ function DialogUiComponent(element) {
137
147
  ${hasScroll
138
148
  ? Scrollable({
139
149
  extraClasses: 'dialog__content-scroll',
140
- content: () => tmplSlot({ dialogId, content })
150
+ content: contentSlot
141
151
  })
142
- : tmplSlot({ dialogId, content })}
152
+ : contentSlot()}
143
153
  </div>
144
154
  </div>
145
155
  <div tabindex="0" @focus="${refocusStart}"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outbook/webcomponents-modal-dialog",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "main": "modal-dialog.js",
5
5
  "type": "module",
6
6
  "private": false,
package/_lib/tmpl-slot.js DELETED
@@ -1,9 +0,0 @@
1
- import { html } from 'lit';
2
-
3
- export function tmplSlot({ dialogId, content }) {
4
- return html`
5
- <div class="dialog__content-wrapper">
6
- <div class="dialog__content" id="${dialogId}-view">${content()}</div>
7
- </div>
8
- `;
9
- }