@ni/nimble-components 12.0.2 → 14.0.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/all-components-bundle.js +412 -1798
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +1772 -1809
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/dialog/index.d.ts +21 -8
- package/dist/esm/dialog/index.js +35 -9
- package/dist/esm/dialog/index.js.map +1 -1
- package/dist/esm/dialog/styles.js +96 -8
- package/dist/esm/dialog/styles.js.map +1 -1
- package/dist/esm/dialog/template.js +20 -4
- package/dist/esm/dialog/template.js.map +1 -1
- package/dist/esm/drawer/index.d.ts +34 -33
- package/dist/esm/drawer/index.js +73 -167
- package/dist/esm/drawer/index.js.map +1 -1
- package/dist/esm/drawer/styles.js +99 -48
- package/dist/esm/drawer/styles.js.map +1 -1
- package/dist/esm/drawer/template.d.ts +2 -0
- package/dist/esm/drawer/template.js +13 -0
- package/dist/esm/drawer/template.js.map +1 -0
- package/dist/esm/drawer/types.d.ts +0 -7
- package/dist/esm/drawer/types.js +0 -6
- package/dist/esm/drawer/types.js.map +1 -1
- package/dist/esm/patterns/dialog/types.d.ts +6 -0
- package/dist/esm/patterns/dialog/types.js +6 -0
- package/dist/esm/patterns/dialog/types.js.map +1 -0
- package/dist/esm/theme-provider/design-tokens-static.d.ts +10 -3
- package/dist/esm/theme-provider/design-tokens-static.js +11 -4
- package/dist/esm/theme-provider/design-tokens-static.js.map +1 -1
- package/dist/esm/theme-provider/design-tokens.js +5 -5
- package/dist/esm/theme-provider/design-tokens.js.map +1 -1
- package/package.json +1 -2
- package/dist/esm/drawer/animations.d.ts +0 -14
- package/dist/esm/drawer/animations.js +0 -52
- package/dist/esm/drawer/animations.js.map +0 -1
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { ARIAGlobalStatesAndProperties, FoundationElement } from '@microsoft/fast-foundation';
|
|
2
|
+
import { UserDismissed } from '../patterns/dialog/types';
|
|
3
|
+
export { UserDismissed };
|
|
2
4
|
declare global {
|
|
3
5
|
interface HTMLElementTagNameMap {
|
|
4
6
|
'nimble-dialog': Dialog;
|
|
5
7
|
}
|
|
6
8
|
}
|
|
7
|
-
/**
|
|
8
|
-
* Symbol that is returned as the dialog close reason (from the Promise returned by show()) when
|
|
9
|
-
* the dialog was closed by pressing the ESC key (vs. calling the close() function).
|
|
10
|
-
*/
|
|
11
|
-
export declare const USER_DISMISSED: unique symbol;
|
|
12
|
-
export declare type UserDismissed = typeof USER_DISMISSED;
|
|
13
9
|
/**
|
|
14
10
|
* This is a workaround for an incomplete definition of the native dialog element:
|
|
15
11
|
* https://github.com/microsoft/TypeScript/issues/48267
|
|
@@ -23,19 +19,35 @@ export interface ExtendedDialog extends HTMLDialogElement {
|
|
|
23
19
|
* A nimble-styled dialog.
|
|
24
20
|
*/
|
|
25
21
|
export declare class Dialog<CloseReason = void> extends FoundationElement {
|
|
26
|
-
static readonly
|
|
22
|
+
static readonly UserDismissed: symbol;
|
|
27
23
|
/**
|
|
28
24
|
* @public
|
|
29
25
|
* @description
|
|
30
26
|
* Prevents dismissing the dialog via the Escape key
|
|
31
27
|
*/
|
|
32
28
|
preventDismiss: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* @public
|
|
31
|
+
* @description
|
|
32
|
+
* Hides the header of the dialog.
|
|
33
|
+
*/
|
|
34
|
+
headerHidden: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* @public
|
|
37
|
+
* @description
|
|
38
|
+
* Hides the footer of the dialog.
|
|
39
|
+
*/
|
|
40
|
+
footerHidden: boolean;
|
|
33
41
|
/**
|
|
34
42
|
* The ref to the internal dialog element.
|
|
35
43
|
*
|
|
36
44
|
* @internal
|
|
37
45
|
*/
|
|
38
46
|
readonly dialogElement: ExtendedDialog;
|
|
47
|
+
/** @internal */
|
|
48
|
+
footerIsEmpty: boolean;
|
|
49
|
+
/** @internal */
|
|
50
|
+
readonly slottedFooterElements?: HTMLElement[];
|
|
39
51
|
/**
|
|
40
52
|
* True if the dialog is open/showing, false otherwise
|
|
41
53
|
*/
|
|
@@ -43,7 +55,7 @@ export declare class Dialog<CloseReason = void> extends FoundationElement {
|
|
|
43
55
|
private resolveShow?;
|
|
44
56
|
/**
|
|
45
57
|
* Opens the dialog
|
|
46
|
-
* @returns Promise that is resolved when the dialog is closed. The value of the resolved Promise is the reason value passed to the close() method, or
|
|
58
|
+
* @returns Promise that is resolved when the dialog is closed. The value of the resolved Promise is the reason value passed to the close() method, or UserDismissed if the dialog was closed via the ESC key.
|
|
47
59
|
*/
|
|
48
60
|
show(): Promise<CloseReason | UserDismissed>;
|
|
49
61
|
/**
|
|
@@ -51,6 +63,7 @@ export declare class Dialog<CloseReason = void> extends FoundationElement {
|
|
|
51
63
|
* @param reason An optional value indicating how/why the dialog was closed.
|
|
52
64
|
*/
|
|
53
65
|
close(reason: CloseReason): void;
|
|
66
|
+
slottedFooterElementsChanged(_prev: HTMLElement[] | undefined, next: HTMLElement[] | undefined): void;
|
|
54
67
|
/**
|
|
55
68
|
* @internal
|
|
56
69
|
*/
|
package/dist/esm/dialog/index.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { attr } from '@microsoft/fast-element';
|
|
2
|
+
import { attr, observable } from '@microsoft/fast-element';
|
|
3
3
|
import { applyMixins, ARIAGlobalStatesAndProperties, DesignSystem, FoundationElement } from '@microsoft/fast-foundation';
|
|
4
|
+
import { UserDismissed } from '../patterns/dialog/types';
|
|
4
5
|
import { styles } from './styles';
|
|
5
6
|
import { template } from './template';
|
|
6
|
-
|
|
7
|
-
* Symbol that is returned as the dialog close reason (from the Promise returned by show()) when
|
|
8
|
-
* the dialog was closed by pressing the ESC key (vs. calling the close() function).
|
|
9
|
-
*/
|
|
10
|
-
export const USER_DISMISSED = Symbol('user dismissed');
|
|
7
|
+
export { UserDismissed };
|
|
11
8
|
/**
|
|
12
9
|
* A nimble-styled dialog.
|
|
13
10
|
*/
|
|
@@ -21,6 +18,20 @@ export class Dialog extends FoundationElement {
|
|
|
21
18
|
* Prevents dismissing the dialog via the Escape key
|
|
22
19
|
*/
|
|
23
20
|
this.preventDismiss = false;
|
|
21
|
+
/**
|
|
22
|
+
* @public
|
|
23
|
+
* @description
|
|
24
|
+
* Hides the header of the dialog.
|
|
25
|
+
*/
|
|
26
|
+
this.headerHidden = false;
|
|
27
|
+
/**
|
|
28
|
+
* @public
|
|
29
|
+
* @description
|
|
30
|
+
* Hides the footer of the dialog.
|
|
31
|
+
*/
|
|
32
|
+
this.footerHidden = false;
|
|
33
|
+
/** @internal */
|
|
34
|
+
this.footerIsEmpty = true;
|
|
24
35
|
}
|
|
25
36
|
/**
|
|
26
37
|
* True if the dialog is open/showing, false otherwise
|
|
@@ -30,7 +41,7 @@ export class Dialog extends FoundationElement {
|
|
|
30
41
|
}
|
|
31
42
|
/**
|
|
32
43
|
* Opens the dialog
|
|
33
|
-
* @returns Promise that is resolved when the dialog is closed. The value of the resolved Promise is the reason value passed to the close() method, or
|
|
44
|
+
* @returns Promise that is resolved when the dialog is closed. The value of the resolved Promise is the reason value passed to the close() method, or UserDismissed if the dialog was closed via the ESC key.
|
|
34
45
|
*/
|
|
35
46
|
async show() {
|
|
36
47
|
if (this.open) {
|
|
@@ -53,6 +64,9 @@ export class Dialog extends FoundationElement {
|
|
|
53
64
|
this.resolveShow(reason);
|
|
54
65
|
this.resolveShow = undefined;
|
|
55
66
|
}
|
|
67
|
+
slottedFooterElementsChanged(_prev, next) {
|
|
68
|
+
this.footerIsEmpty = !next?.length;
|
|
69
|
+
}
|
|
56
70
|
/**
|
|
57
71
|
* @internal
|
|
58
72
|
*/
|
|
@@ -61,7 +75,7 @@ export class Dialog extends FoundationElement {
|
|
|
61
75
|
event.preventDefault();
|
|
62
76
|
}
|
|
63
77
|
else {
|
|
64
|
-
this.resolveShow(
|
|
78
|
+
this.resolveShow(UserDismissed);
|
|
65
79
|
this.resolveShow = undefined;
|
|
66
80
|
}
|
|
67
81
|
return true;
|
|
@@ -69,10 +83,22 @@ export class Dialog extends FoundationElement {
|
|
|
69
83
|
}
|
|
70
84
|
// We want the member to match the name of the constant
|
|
71
85
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
72
|
-
Dialog.
|
|
86
|
+
Dialog.UserDismissed = UserDismissed;
|
|
73
87
|
__decorate([
|
|
74
88
|
attr({ attribute: 'prevent-dismiss', mode: 'boolean' })
|
|
75
89
|
], Dialog.prototype, "preventDismiss", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
attr({ attribute: 'header-hidden', mode: 'boolean' })
|
|
92
|
+
], Dialog.prototype, "headerHidden", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
attr({ attribute: 'footer-hidden', mode: 'boolean' })
|
|
95
|
+
], Dialog.prototype, "footerHidden", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
observable
|
|
98
|
+
], Dialog.prototype, "footerIsEmpty", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
observable
|
|
101
|
+
], Dialog.prototype, "slottedFooterElements", void 0);
|
|
76
102
|
applyMixins(Dialog, ARIAGlobalStatesAndProperties);
|
|
77
103
|
const nimbleDialog = Dialog.compose({
|
|
78
104
|
baseName: 'dialog',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dialog/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dialog/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,17 +1,105 @@
|
|
|
1
1
|
import { css } from '@microsoft/fast-element';
|
|
2
2
|
import { display } from '@microsoft/fast-foundation';
|
|
3
|
-
import { applicationBackgroundColor,
|
|
4
|
-
import {
|
|
3
|
+
import { applicationBackgroundColor, standardPadding, actionRgbPartialColor, bodyFont, bodyFontColor, titlePlus1Font, titlePlus1FontColor, smallPadding, subtitleFont, subtitleFontColor } from '../theme-provider/design-tokens';
|
|
4
|
+
import { modalBackdropColorThemeColorStatic, modalBackdropColorThemeDarkStatic, modalBackdropColorThemeLightStatic } from '../theme-provider/design-tokens-static';
|
|
5
5
|
import { Theme } from '../theme-provider/types';
|
|
6
6
|
import { themeBehavior } from '../utilities/style/theme';
|
|
7
7
|
export const styles = css `
|
|
8
8
|
${display('grid')}
|
|
9
9
|
|
|
10
10
|
dialog {
|
|
11
|
+
flex-direction: column;
|
|
11
12
|
background-color: ${applicationBackgroundColor};
|
|
12
|
-
border:
|
|
13
|
-
box-shadow: 0px
|
|
14
|
-
|
|
13
|
+
border: none;
|
|
14
|
+
box-shadow: 0px 4px 8px #0000004d;
|
|
15
|
+
padding: 0px;
|
|
16
|
+
width: 400px;
|
|
17
|
+
max-height: 600px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
dialog[open] {
|
|
21
|
+
display: flex;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
header {
|
|
25
|
+
min-height: 48px;
|
|
26
|
+
padding: 24px 24px 0px 24px;
|
|
27
|
+
flex: none;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
gap: ${smallPadding};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:host([header-hidden]) header {
|
|
34
|
+
${
|
|
35
|
+
/**
|
|
36
|
+
* Hide content visually while keeping it screen reader-accessible.
|
|
37
|
+
* Source: https://webaim.org/techniques/css/invisiblecontent/#techniques
|
|
38
|
+
* See discussion here: https://github.com/microsoft/fast/issues/5740#issuecomment-1068195035
|
|
39
|
+
*/
|
|
40
|
+
''}
|
|
41
|
+
display: inline-block;
|
|
42
|
+
height: 1px;
|
|
43
|
+
width: 1px;
|
|
44
|
+
position: absolute;
|
|
45
|
+
margin: -1px;
|
|
46
|
+
clip: rect(1px, 1px, 1px, 1px);
|
|
47
|
+
clip-path: inset(50%);
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
padding: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.title {
|
|
53
|
+
font: ${titlePlus1Font};
|
|
54
|
+
color: ${titlePlus1FontColor};
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
text-overflow: ellipsis;
|
|
57
|
+
white-space: nowrap;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.subtitle {
|
|
61
|
+
font: ${subtitleFont};
|
|
62
|
+
color: ${subtitleFontColor};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
section {
|
|
66
|
+
flex: auto;
|
|
67
|
+
overflow-y: auto;
|
|
68
|
+
font: ${bodyFont};
|
|
69
|
+
color: ${bodyFontColor};
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
gap: ${standardPadding};
|
|
73
|
+
|
|
74
|
+
${
|
|
75
|
+
/**
|
|
76
|
+
* Use padding on all sides except the top because the padding is within
|
|
77
|
+
* the scrollable area. The whole scrollable area, including the top of
|
|
78
|
+
* the scrollbar, should be 24px away from the header, so use a margin
|
|
79
|
+
* instead of padding for the top.
|
|
80
|
+
*/
|
|
81
|
+
''}
|
|
82
|
+
padding: 0px 24px 24px 24px;
|
|
83
|
+
margin-top: 24px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
footer {
|
|
87
|
+
border-top: 2px solid rgba(${actionRgbPartialColor}, 0.1);
|
|
88
|
+
padding: 24px;
|
|
89
|
+
flex: none;
|
|
90
|
+
display: flex;
|
|
91
|
+
justify-content: flex-end;
|
|
92
|
+
gap: ${standardPadding};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
footer.empty {
|
|
96
|
+
padding: 0px;
|
|
97
|
+
height: 72px;
|
|
98
|
+
border-top: none;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
:host([footer-hidden]) footer {
|
|
102
|
+
display: none;
|
|
15
103
|
}
|
|
16
104
|
`.withBehaviors(
|
|
17
105
|
/*
|
|
@@ -20,15 +108,15 @@ export const styles = css `
|
|
|
20
108
|
*/
|
|
21
109
|
themeBehavior(Theme.light, css `
|
|
22
110
|
dialog::backdrop {
|
|
23
|
-
background: ${
|
|
111
|
+
background: ${modalBackdropColorThemeLightStatic};
|
|
24
112
|
}
|
|
25
113
|
`), themeBehavior(Theme.dark, css `
|
|
26
114
|
dialog::backdrop {
|
|
27
|
-
background: ${
|
|
115
|
+
background: ${modalBackdropColorThemeDarkStatic};
|
|
28
116
|
}
|
|
29
117
|
`), themeBehavior(Theme.color, css `
|
|
30
118
|
dialog::backdrop {
|
|
31
|
-
background: ${
|
|
119
|
+
background: ${modalBackdropColorThemeColorStatic};
|
|
32
120
|
}
|
|
33
121
|
`));
|
|
34
122
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/dialog/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,OAAO,EACH,0BAA0B,EAC1B,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/dialog/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,OAAO,EACH,0BAA0B,EAC1B,eAAe,EACf,qBAAqB,EACrB,QAAQ,EACR,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,kCAAkC,EAClC,iCAAiC,EACjC,kCAAkC,EACrC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;;;;4BAIO,0BAA0B;;;;;;;;;;;;;;;;;;eAkBvC,YAAY;;;;UAIjB;AACE;;;;GAIG;AACH,EACJ;;;;;;;;;;;;;gBAaQ,cAAc;iBACb,mBAAmB;;;;;;;gBAOpB,YAAY;iBACX,iBAAiB;;;;;;gBAMlB,QAAQ;iBACP,aAAa;;;eAGf,eAAe;;UAEpB;AACE;;;;;GAKG;AACH,EACJ;;;;;;qCAM6B,qBAAqB;;;;;eAK3C,eAAe;;;;;;;;;;;;CAY7B,CAAC,aAAa;AACX;;;GAGG;AACH,aAAa,CACT,KAAK,CAAC,KAAK,EACX,GAAG,CAAA;;8BAEmB,kCAAkC;;SAEvD,CACJ,EACD,aAAa,CACT,KAAK,CAAC,IAAI,EACV,GAAG,CAAA;;8BAEmB,iCAAiC;;SAEtD,CACJ,EACD,aAAa,CACT,KAAK,CAAC,KAAK,EACX,GAAG,CAAA;;8BAEmB,kCAAkC;;SAEvD,CACJ,CACJ,CAAC"}
|
|
@@ -1,13 +1,29 @@
|
|
|
1
|
-
import { html, ref } from '@microsoft/fast-element';
|
|
1
|
+
import { html, ref, slotted } from '@microsoft/fast-element';
|
|
2
2
|
export const template = html `
|
|
3
3
|
<template>
|
|
4
4
|
<dialog
|
|
5
5
|
${ref('dialogElement')}
|
|
6
|
-
role="
|
|
7
|
-
aria-label="${x => x.ariaLabel}"
|
|
6
|
+
role="dialog"
|
|
8
7
|
@cancel="${(x, c) => x.cancelHandler(c.event)}"
|
|
8
|
+
aria-labelledby="header"
|
|
9
9
|
>
|
|
10
|
-
<
|
|
10
|
+
<header id="header">
|
|
11
|
+
<div class="title">
|
|
12
|
+
<slot name="title"></slot>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="subtitle">
|
|
15
|
+
<slot name="subtitle"></slot>
|
|
16
|
+
</div>
|
|
17
|
+
</header>
|
|
18
|
+
<section>
|
|
19
|
+
<slot></slot>
|
|
20
|
+
</section>
|
|
21
|
+
<footer class="${x => (x.footerIsEmpty ? 'empty' : '')}">
|
|
22
|
+
<slot
|
|
23
|
+
name="footer"
|
|
24
|
+
${slotted({ property: 'slottedFooterElements' })}
|
|
25
|
+
></slot>
|
|
26
|
+
</footer>
|
|
11
27
|
</dialog>
|
|
12
28
|
</template>
|
|
13
29
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/dialog/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/dialog/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAG7D,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAQ;;;cAGtB,GAAG,CAAC,eAAe,CAAC;;uBAEX,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC;;;;;;;;;;;;;;6BAc5B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;;;sBAG5C,OAAO,CAAC,EAAE,QAAQ,EAAE,uBAAuB,EAAE,CAAC;;;;;CAKnE,CAAC"}
|
|
@@ -1,48 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ARIAGlobalStatesAndProperties, FoundationElement } from '@microsoft/fast-foundation';
|
|
2
|
+
import { UserDismissed } from '../patterns/dialog/types';
|
|
3
|
+
import { DrawerLocation } from './types';
|
|
4
|
+
export { UserDismissed };
|
|
3
5
|
declare global {
|
|
4
6
|
interface HTMLElementTagNameMap {
|
|
5
7
|
'nimble-drawer': Drawer;
|
|
6
8
|
}
|
|
7
9
|
}
|
|
8
10
|
/**
|
|
9
|
-
* Drawer
|
|
11
|
+
* Drawer control. Shows content in a panel on the left / right side of the screen,
|
|
10
12
|
* which animates to be visible with a slide-in / slide-out animation.
|
|
11
|
-
* Configured via 'location', 'state', 'modal', 'preventDismiss' properties.
|
|
12
13
|
*/
|
|
13
|
-
export declare class Drawer extends
|
|
14
|
+
export declare class Drawer<CloseReason = void> extends FoundationElement {
|
|
15
|
+
static readonly UserDismissed: symbol;
|
|
14
16
|
location: DrawerLocation;
|
|
15
|
-
|
|
17
|
+
preventDismiss: boolean;
|
|
18
|
+
dialog: HTMLDialogElement;
|
|
19
|
+
private closing;
|
|
20
|
+
private resolveShow?;
|
|
21
|
+
private closeReason;
|
|
16
22
|
/**
|
|
17
|
-
* True
|
|
18
|
-
* Only applicable when 'modal' is set to true (i.e. when the overlay is used).
|
|
19
|
-
* HTML Attribute: prevent-dismiss
|
|
23
|
+
* True if the drawer is open, opening, or closing. Otherwise, false.
|
|
20
24
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
get open(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Opens the drawer
|
|
28
|
+
* @returns Promise that is resolved when the drawer finishes closing. The value of the resolved
|
|
29
|
+
* Promise is the reason value passed to the close() method, or UserDismissed if the drawer was
|
|
30
|
+
* closed via the ESC key.
|
|
31
|
+
*/
|
|
32
|
+
show(): Promise<CloseReason | UserDismissed>;
|
|
33
|
+
/**
|
|
34
|
+
* Closes the drawer
|
|
35
|
+
* @param reason An optional value indicating how/why the drawer was closed.
|
|
36
|
+
*/
|
|
37
|
+
close(reason: CloseReason): void;
|
|
34
38
|
/**
|
|
35
|
-
* Handler for overlay clicks (user-initiated dismiss requests) only.
|
|
36
39
|
* @internal
|
|
37
40
|
*/
|
|
38
|
-
|
|
39
|
-
private
|
|
40
|
-
private
|
|
41
|
-
private
|
|
42
|
-
private
|
|
43
|
-
private
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
private animateOpenClose;
|
|
47
|
-
private cancelCurrentAnimation;
|
|
41
|
+
cancelHandler(event: Event): boolean;
|
|
42
|
+
private readonly animationEndHandlerFunction;
|
|
43
|
+
private openDialog;
|
|
44
|
+
private closeDialog;
|
|
45
|
+
private triggerAnimation;
|
|
46
|
+
private animationEndHandler;
|
|
47
|
+
}
|
|
48
|
+
export interface Drawer extends ARIAGlobalStatesAndProperties {
|
|
48
49
|
}
|