1
- import { AuIcon } from ' @appuniversum/ ember-appuniversum ' ;
1
+ import type { TOC } from ' @ember/component/template-only ' ;
2
2
import { assert } from ' @ember/debug' ;
3
3
import { concat , hash } from ' @ember/helper' ;
4
4
import { on } from ' @ember/modifier' ;
@@ -7,20 +7,49 @@ import Component from '@glimmer/component';
7
7
import { focusTrap } from ' ember-focus-trap' ;
8
8
import { CrossIcon } from ' ./icons/cross' ;
9
9
import { cn } from ' ../private/helpers/class-names' ;
10
+ import AuIcon from ' ./au-icon' ;
10
11
11
12
// TODO: replace these with the named imports from ember-truth-helpers v4 once our dependencies support that version
12
13
import not from ' ember-truth-helpers/helpers/not' ;
13
14
import or from ' ember-truth-helpers/helpers/or' ;
14
15
15
16
const FOCUS_TRAP_ADDITIONAL_ELEMENTS = [' #ember-basic-dropdown-wormhole' ];
16
17
17
- export default class AuModal extends Component {
18
- constructor () {
19
- super (... arguments );
18
+ export interface AuModalSignature {
19
+ Args: {
20
+ closable? : boolean ;
21
+ closeModal? : () => void ;
22
+ id? : string ;
23
+ initialFocus? : string ;
24
+ modalOpen? : boolean ;
25
+ overflow? : boolean ;
26
+ padding? : ' none' ;
27
+ size? : ' large' | ' fullscreen' ;
28
+ title? : string ;
29
+ };
30
+ Blocks: {
31
+ body: [];
32
+ footer: [];
33
+ title: [];
34
+ default: [
35
+ {
36
+ Body: typeof Body ;
37
+ Footer: typeof Footer ;
38
+ },
39
+ ];
40
+ };
41
+ Element: HTMLDivElement ;
42
+ }
43
+
44
+ export default class AuModal extends Component <AuModalSignature > {
45
+ destinationElement: HTMLElement ;
46
+
47
+ constructor (owner : unknown , args : AuModalSignature [' Args' ]) {
48
+ super (owner , args );
20
49
21
50
this .destinationElement = document .querySelector (
22
51
' [data-au-modal-container]' ,
23
- );
52
+ ) as HTMLElement ;
24
53
25
54
assert (
26
55
' au-modal: No target element was found. Please add the `<AuModalContainer />` component where appropriate.' ,
@@ -161,13 +190,13 @@ export default class AuModal extends Component {
161
190
{{/if }}
162
191
</template >
163
192
}
164
- const Body = <template >
193
+ const Body: TOC <{ Blocks : { default : [] } }> = <template >
165
194
<div class =" au-c-modal__body" data-test-modal-body >
166
195
{{ yield }}
167
196
</div >
168
197
</template >;
169
198
170
- const Footer = <template >
199
+ const Footer: TOC <{ Blocks : { default : [] } }> = <template >
171
200
<div class =" au-c-modal__footer" data-test-modal-footer >
172
201
{{ yield }}
173
202
</div >
0 commit comments