@ni/nimble-components 13.0.0 → 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 +140 -7
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +643 -550
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/dialog/index.d.ts +17 -0
- package/dist/esm/dialog/index.js +30 -1
- package/dist/esm/dialog/index.js.map +1 -1
- package/dist/esm/dialog/styles.js +92 -4
- 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/package.json +1 -1
|
@@ -26,12 +26,28 @@ export declare class Dialog<CloseReason = void> extends FoundationElement {
|
|
|
26
26
|
* Prevents dismissing the dialog via the Escape key
|
|
27
27
|
*/
|
|
28
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;
|
|
29
41
|
/**
|
|
30
42
|
* The ref to the internal dialog element.
|
|
31
43
|
*
|
|
32
44
|
* @internal
|
|
33
45
|
*/
|
|
34
46
|
readonly dialogElement: ExtendedDialog;
|
|
47
|
+
/** @internal */
|
|
48
|
+
footerIsEmpty: boolean;
|
|
49
|
+
/** @internal */
|
|
50
|
+
readonly slottedFooterElements?: HTMLElement[];
|
|
35
51
|
/**
|
|
36
52
|
* True if the dialog is open/showing, false otherwise
|
|
37
53
|
*/
|
|
@@ -47,6 +63,7 @@ export declare class Dialog<CloseReason = void> extends FoundationElement {
|
|
|
47
63
|
* @param reason An optional value indicating how/why the dialog was closed.
|
|
48
64
|
*/
|
|
49
65
|
close(reason: CloseReason): void;
|
|
66
|
+
slottedFooterElementsChanged(_prev: HTMLElement[] | undefined, next: HTMLElement[] | undefined): void;
|
|
50
67
|
/**
|
|
51
68
|
* @internal
|
|
52
69
|
*/
|
package/dist/esm/dialog/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
4
|
import { UserDismissed } from '../patterns/dialog/types';
|
|
5
5
|
import { styles } from './styles';
|
|
@@ -18,6 +18,20 @@ export class Dialog extends FoundationElement {
|
|
|
18
18
|
* Prevents dismissing the dialog via the Escape key
|
|
19
19
|
*/
|
|
20
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;
|
|
21
35
|
}
|
|
22
36
|
/**
|
|
23
37
|
* True if the dialog is open/showing, false otherwise
|
|
@@ -50,6 +64,9 @@ export class Dialog extends FoundationElement {
|
|
|
50
64
|
this.resolveShow(reason);
|
|
51
65
|
this.resolveShow = undefined;
|
|
52
66
|
}
|
|
67
|
+
slottedFooterElementsChanged(_prev, next) {
|
|
68
|
+
this.footerIsEmpty = !next?.length;
|
|
69
|
+
}
|
|
53
70
|
/**
|
|
54
71
|
* @internal
|
|
55
72
|
*/
|
|
@@ -70,6 +87,18 @@ Dialog.UserDismissed = UserDismissed;
|
|
|
70
87
|
__decorate([
|
|
71
88
|
attr({ attribute: 'prevent-dismiss', mode: 'boolean' })
|
|
72
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);
|
|
73
102
|
applyMixins(Dialog, ARIAGlobalStatesAndProperties);
|
|
74
103
|
const nimbleDialog = Dialog.compose({
|
|
75
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":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACH,WAAW,EACX,6BAA6B,EAC7B,YAAY,EACZ,iBAAiB,EACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,CAAC;AAkBzB;;GAEG;AACH,mEAAmE;AACnE,MAAM,OAAO,MAA2B,SAAQ,iBAAiB;IAAjE;;QAKI;;;;WAIG;QAEI,mBAAc,GAAG,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AC;;AAjGD,uDAAuD;AACvD,gEAAgE;AACzC,oBAAa,GAAG,aAAa,CAAC;AAQrD;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;8CAC1B;AAQ9B;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;4CAC1B;AAQ5B;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;4CAC1B;AAW5B;IADC,UAAU;6CACiB;AAI5B;IADC,UAAU;qDAC2C;AA6D1D,WAAW,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;AAEnD,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC;IAChC,QAAQ,EAAE,QAAQ;IAClB,QAAQ;IACR,MAAM;IACN,SAAS,EAAE,MAAM;CACpB,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from '@microsoft/fast-element';
|
|
2
2
|
import { display } from '@microsoft/fast-foundation';
|
|
3
|
-
import { applicationBackgroundColor,
|
|
3
|
+
import { applicationBackgroundColor, standardPadding, actionRgbPartialColor, bodyFont, bodyFontColor, titlePlus1Font, titlePlus1FontColor, smallPadding, subtitleFont, subtitleFontColor } from '../theme-provider/design-tokens';
|
|
4
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';
|
|
@@ -8,10 +8,98 @@ 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
|
/*
|
|
@@ -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":"AAA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
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ni/nimble-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0",
|
|
4
4
|
"description": "Styled web components for the NI Nimble Design System",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run generate-icons && npm run build-components && npm run bundle-components && npm run generate-scss && npm run build-storybook",
|