@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.
Files changed (34) hide show
  1. package/dist/all-components-bundle.js +412 -1798
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +1772 -1809
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/dialog/index.d.ts +21 -8
  6. package/dist/esm/dialog/index.js +35 -9
  7. package/dist/esm/dialog/index.js.map +1 -1
  8. package/dist/esm/dialog/styles.js +96 -8
  9. package/dist/esm/dialog/styles.js.map +1 -1
  10. package/dist/esm/dialog/template.js +20 -4
  11. package/dist/esm/dialog/template.js.map +1 -1
  12. package/dist/esm/drawer/index.d.ts +34 -33
  13. package/dist/esm/drawer/index.js +73 -167
  14. package/dist/esm/drawer/index.js.map +1 -1
  15. package/dist/esm/drawer/styles.js +99 -48
  16. package/dist/esm/drawer/styles.js.map +1 -1
  17. package/dist/esm/drawer/template.d.ts +2 -0
  18. package/dist/esm/drawer/template.js +13 -0
  19. package/dist/esm/drawer/template.js.map +1 -0
  20. package/dist/esm/drawer/types.d.ts +0 -7
  21. package/dist/esm/drawer/types.js +0 -6
  22. package/dist/esm/drawer/types.js.map +1 -1
  23. package/dist/esm/patterns/dialog/types.d.ts +6 -0
  24. package/dist/esm/patterns/dialog/types.js +6 -0
  25. package/dist/esm/patterns/dialog/types.js.map +1 -0
  26. package/dist/esm/theme-provider/design-tokens-static.d.ts +10 -3
  27. package/dist/esm/theme-provider/design-tokens-static.js +11 -4
  28. package/dist/esm/theme-provider/design-tokens-static.js.map +1 -1
  29. package/dist/esm/theme-provider/design-tokens.js +5 -5
  30. package/dist/esm/theme-provider/design-tokens.js.map +1 -1
  31. package/package.json +1 -2
  32. package/dist/esm/drawer/animations.d.ts +0 -14
  33. package/dist/esm/drawer/animations.js +0 -52
  34. package/dist/esm/drawer/animations.js.map +0 -1
@@ -1,201 +1,107 @@
1
1
  import { __decorate } from "tslib";
2
- import { AnimateGroup, AnimateTo } from '@microsoft/fast-animation';
3
- import { attr, Observable } from '@microsoft/fast-element';
4
- import { DesignSystem, Dialog as FoundationDialog, dialogTemplate as template } from '@microsoft/fast-foundation';
5
- import { largeDelay } from '../theme-provider/design-tokens';
6
- import { prefersReducedMotionMediaQuery } from '../utilities/style/prefers-reduced-motion';
7
- import { animationConfig } from './animations';
2
+ import { attr } from '@microsoft/fast-element';
3
+ import { applyMixins, ARIAGlobalStatesAndProperties, DesignSystem, FoundationElement } from '@microsoft/fast-foundation';
4
+ import { eventAnimationEnd } from '@microsoft/fast-web-utilities';
5
+ import { UserDismissed } from '../patterns/dialog/types';
8
6
  import { styles } from './styles';
9
- import { DrawerLocation, DrawerState } from './types';
10
- const animationDurationWhenDisabledMilliseconds = 0.001;
7
+ import { template } from './template';
8
+ import { DrawerLocation } from './types';
9
+ export { UserDismissed };
11
10
  /**
12
- * Drawer/Sidenav control. Shows content in a panel on the left / right side of the screen,
11
+ * Drawer control. Shows content in a panel on the left / right side of the screen,
13
12
  * which animates to be visible with a slide-in / slide-out animation.
14
- * Configured via 'location', 'state', 'modal', 'preventDismiss' properties.
15
13
  */
16
- export class Drawer extends FoundationDialog {
14
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
15
+ export class Drawer extends FoundationElement {
17
16
  constructor() {
18
17
  super(...arguments);
19
- this.location = DrawerLocation.left;
20
- this.state = DrawerState.closed;
21
- /**
22
- * True to prevent dismissing the drawer when the overlay outside the drawer is clicked.
23
- * Only applicable when 'modal' is set to true (i.e. when the overlay is used).
24
- * HTML Attribute: prevent-dismiss
25
- */
18
+ this.location = DrawerLocation.right;
26
19
  this.preventDismiss = false;
27
- this.propertiesToWatch = ['hidden', 'location', 'state'];
28
- this.animationDurationMilliseconds = animationDurationWhenDisabledMilliseconds;
29
- }
30
- /** @internal */
31
- connectedCallback() {
32
- // disable trapFocus before super.connectedCallback as FAST Dialog will immediately queue work to
33
- // change focus if it's true before connectedCallback
34
- this.trapFocus = false;
35
- super.connectedCallback();
36
- this.updateAnimationDuration();
37
- this.animationsEnabledChangedHandler = () => this.updateAnimationDuration();
38
- prefersReducedMotionMediaQuery.addEventListener('change', this.animationsEnabledChangedHandler);
39
- this.onStateChanged();
40
- const notifier = Observable.getNotifier(this);
41
- const subscriber = {
42
- handleChange: (_source, propertyName) => this.onPropertyChange(propertyName)
43
- };
44
- this.propertiesToWatch.forEach(propertyName => notifier.subscribe(subscriber, propertyName));
45
- this.propertyChangeSubscriber = subscriber;
46
- this.propertyChangeNotifier = notifier;
47
- }
48
- /** @internal */
49
- disconnectedCallback() {
50
- super.disconnectedCallback();
51
- this.cancelCurrentAnimation();
52
- if (this.propertyChangeNotifier && this.propertyChangeSubscriber) {
53
- this.propertiesToWatch.forEach(propertyName => this.propertyChangeNotifier.unsubscribe(this.propertyChangeSubscriber, propertyName));
54
- this.propertyChangeNotifier = undefined;
55
- this.propertyChangeSubscriber = undefined;
56
- }
57
- if (this.animationsEnabledChangedHandler) {
58
- prefersReducedMotionMediaQuery.removeEventListener('change', this.animationsEnabledChangedHandler);
59
- this.animationsEnabledChangedHandler = undefined;
60
- }
61
- }
62
- show() {
63
- // Not calling super.show() as that will immediately show the drawer, whereas 'Opening' state will animate
64
- this.state = DrawerState.opening;
65
- }
66
- hide() {
67
- // Not calling super.hide() as that will immediately hide the drawer, whereas 'Closing' state will animate
68
- this.state = DrawerState.closing;
20
+ this.closing = false;
21
+ this.animationEndHandlerFunction = () => this.animationEndHandler();
69
22
  }
70
23
  /**
71
- * Handler for overlay clicks (user-initiated dismiss requests) only.
72
- * @internal
24
+ * True if the drawer is open, opening, or closing. Otherwise, false.
73
25
  */
74
- dismiss() {
75
- // Note: intentionally not calling super() in this function in order to implement custom preventDismiss behavior
76
- const shouldDismiss = this.$emit('cancel', {},
77
- // Aligned with the configuration of HTMLDialogElement cancel event:
78
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/cancel_event
79
- { bubbles: false, cancelable: true, composed: false });
80
- if (shouldDismiss && !this.preventDismiss) {
81
- this.$emit('dismiss');
82
- this.hide();
83
- }
26
+ get open() {
27
+ return this.resolveShow !== undefined;
84
28
  }
85
- onPropertyChange(propertyName) {
86
- switch (propertyName) {
87
- case 'hidden':
88
- this.onHiddenChanged();
89
- break;
90
- case 'location':
91
- this.onLocationChanged();
92
- break;
93
- case 'state':
94
- this.onStateChanged();
95
- break;
96
- default:
97
- break;
29
+ /**
30
+ * Opens the drawer
31
+ * @returns Promise that is resolved when the drawer finishes closing. The value of the resolved
32
+ * Promise is the reason value passed to the close() method, or UserDismissed if the drawer was
33
+ * closed via the ESC key.
34
+ */
35
+ async show() {
36
+ if (this.open) {
37
+ throw new Error('Drawer is already open');
98
38
  }
39
+ this.openDialog();
40
+ return new Promise((resolve, _reject) => {
41
+ this.resolveShow = resolve;
42
+ });
99
43
  }
100
- onHiddenChanged() {
101
- if (this.hidden && this.state !== DrawerState.closed) {
102
- this.state = DrawerState.closed;
103
- }
104
- else if (!this.hidden && this.state === DrawerState.closed) {
105
- this.state = DrawerState.opened;
44
+ /**
45
+ * Closes the drawer
46
+ * @param reason An optional value indicating how/why the drawer was closed.
47
+ */
48
+ close(reason) {
49
+ if (!this.open || this.closing) {
50
+ throw new Error('Drawer is not open or already closing');
106
51
  }
52
+ this.closeReason = reason;
53
+ this.closeDialog();
107
54
  }
108
- onLocationChanged() {
109
- this.cancelCurrentAnimation();
110
- }
111
- onStateChanged() {
112
- if (this.isConnected) {
113
- this.cancelCurrentAnimation();
114
- switch (this.state) {
115
- case DrawerState.opening:
116
- this.animateOpening();
117
- this.hidden = false;
118
- break;
119
- case DrawerState.opened:
120
- this.hidden = false;
121
- break;
122
- case DrawerState.closing:
123
- this.hidden = false;
124
- this.animateClosing();
125
- break;
126
- case DrawerState.closed:
127
- this.hidden = true;
128
- break;
129
- default:
130
- throw new Error('Unsupported state value. Expected: opening/opened/closing/closed');
131
- }
132
- this.$emit('state-change');
55
+ /**
56
+ * @internal
57
+ */
58
+ cancelHandler(event) {
59
+ // Allowing the dialog to close itself bypasses the drawer's animation logic, so we
60
+ // should close the drawer ourselves when preventDismiss is false.
61
+ event.preventDefault();
62
+ if (!this.preventDismiss) {
63
+ this.closeReason = UserDismissed;
64
+ this.closeDialog();
133
65
  }
66
+ return true;
134
67
  }
135
- updateAnimationDuration() {
136
- const disableAnimations = prefersReducedMotionMediaQuery.matches;
137
- if (disableAnimations) {
138
- this.animationDurationMilliseconds = animationDurationWhenDisabledMilliseconds;
139
- }
140
- else {
141
- // string ends in 's' unit specifier
142
- const secondsString = largeDelay.getValueFor(this);
143
- const secondsNumber = parseFloat(secondsString);
144
- this.animationDurationMilliseconds = 1000 * secondsNumber;
145
- }
68
+ openDialog() {
69
+ this.dialog.showModal();
70
+ this.triggerAnimation();
146
71
  }
147
- animateOpening() {
148
- this.animateOpenClose(true);
72
+ closeDialog() {
73
+ this.closing = true;
74
+ this.triggerAnimation();
149
75
  }
150
- animateClosing() {
151
- if (!this.hidden) {
152
- this.animateOpenClose(false);
153
- }
154
- else {
155
- this.state = DrawerState.closed;
76
+ triggerAnimation() {
77
+ this.dialog.classList.add('animating');
78
+ if (this.closing) {
79
+ this.dialog.classList.add('closing');
156
80
  }
81
+ this.dialog.addEventListener(eventAnimationEnd, this.animationEndHandlerFunction);
157
82
  }
158
- animateOpenClose(drawerOpening) {
159
- const options = {
160
- ...(drawerOpening
161
- ? animationConfig.slideInOptions
162
- : animationConfig.slideOutOptions),
163
- duration: this.animationDurationMilliseconds
164
- };
165
- const drawerKeyframes = this.location === DrawerLocation.right
166
- ? animationConfig.slideRightKeyframes
167
- : animationConfig.slideLeftKeyframes;
168
- const dialogAnimation = new AnimateTo(this.dialog, undefined, options);
169
- dialogAnimation.addKeyframes(drawerKeyframes);
170
- const animations = [dialogAnimation];
171
- const overlay = this.shadowRoot?.querySelector('.overlay');
172
- if (overlay) {
173
- const overlayAnimation = new AnimateTo(overlay, undefined, options);
174
- overlayAnimation.addKeyframes(animationConfig.fadeOverlayKeyframes);
175
- animations.push(overlayAnimation);
83
+ animationEndHandler() {
84
+ this.dialog.removeEventListener(eventAnimationEnd, this.animationEndHandlerFunction);
85
+ this.dialog.classList.remove('animating');
86
+ if (this.closing) {
87
+ this.dialog.classList.remove('closing');
88
+ this.dialog.close();
89
+ this.closing = false;
90
+ this.resolveShow(this.closeReason);
91
+ this.resolveShow = undefined;
176
92
  }
177
- const animationGroup = new AnimateGroup(animations);
178
- animationGroup.onFinish = () => {
179
- this.state = drawerOpening
180
- ? DrawerState.opened
181
- : DrawerState.closed;
182
- };
183
- this.animationGroup = animationGroup;
184
- animationGroup.play();
185
- }
186
- cancelCurrentAnimation() {
187
- this.animationGroup?.cancel();
188
93
  }
189
94
  }
95
+ // We want the member to match the name of the constant
96
+ // eslint-disable-next-line @typescript-eslint/naming-convention
97
+ Drawer.UserDismissed = UserDismissed;
190
98
  __decorate([
191
99
  attr
192
100
  ], Drawer.prototype, "location", void 0);
193
- __decorate([
194
- attr
195
- ], Drawer.prototype, "state", void 0);
196
101
  __decorate([
197
102
  attr({ attribute: 'prevent-dismiss', mode: 'boolean' })
198
103
  ], Drawer.prototype, "preventDismiss", void 0);
104
+ applyMixins(Drawer, ARIAGlobalStatesAndProperties);
199
105
  const nimbleDrawer = Drawer.compose({
200
106
  baseName: 'drawer',
201
107
  template,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drawer/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACH,IAAI,EAEJ,UAAU,EAEb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,YAAY,EACZ,MAAM,IAAI,gBAAgB,EAC1B,cAAc,IAAI,QAAQ,EAC7B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OA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AAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACxC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACpB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;YACrB,IAAI,CAAC,WAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACpC,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;SAChC;IACL,CAAC;;AAvGD,uDAAuD;AACvD,gEAAgE;AACzC,oBAAa,GAAG,aAAa,CAAC;AAGrD;IADC,IAAI;wCACkD;AAGvD;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;8CAC1B;AAoGlC,WAAW,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;AAEnD,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC;IAChC,QAAQ,EAAE,QAAQ;IAClB,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AACH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC"}
@@ -1,84 +1,118 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { display } from '@microsoft/fast-foundation';
3
- import { applicationBackgroundColor, bodyFont, bodyFontColor, borderWidth, popupBorderColor, popupBoxShadowColor, standardPadding, titlePlus1Font, drawerWidth, modalBackdropColor } from '../theme-provider/design-tokens';
3
+ import { applicationBackgroundColor, bodyFont, bodyFontColor, borderWidth, popupBorderColor, popupBoxShadowColor, standardPadding, titlePlus1Font, drawerWidth, largeDelay } from '../theme-provider/design-tokens';
4
+ import { modalBackdropColorThemeColorStatic, modalBackdropColorThemeDarkStatic, modalBackdropColorThemeLightStatic, largeDelayStatic } from '../theme-provider/design-tokens-static';
5
+ import { Theme } from '../theme-provider/types';
6
+ import { themeBehavior } from '../utilities/style/theme';
4
7
  export const styles = css `
5
8
  ${display('block')}
6
9
 
7
10
  :host {
8
- position: relative;
9
- top: 0;
10
- bottom: 0;
11
- width: fit-content;
11
+ position: absolute;
12
+ width: auto;
12
13
  height: 100%;
13
14
  outline: none;
14
15
  font: ${bodyFont};
15
16
  color: ${bodyFontColor};
16
17
  }
17
18
 
18
- :host([modal]) {
19
- position: absolute;
20
- }
21
-
22
- :host([location='left']) {
23
- left: 0px;
24
- }
25
-
26
- :host([location='right']) {
27
- right: 0px;
28
- }
29
-
30
- .positioning-region {
31
- display: block;
32
- position: relative;
33
- justify-content: center;
34
- width: fit-content;
19
+ dialog {
20
+ color: inherit;
21
+ font: inherit;
22
+ background-color: transparent;
23
+ width: auto;
24
+ top: 0px;
25
+ bottom: 0px;
26
+ border-radius: 0px;
27
+ border-width: 0px;
35
28
  height: 100%;
36
- inset: 0px;
29
+ margin: 0px;
30
+ padding: 0px;
31
+ max-width: none;
32
+ max-height: none;
37
33
  overflow: hidden;
38
- z-index: 999;
39
34
  }
40
35
 
41
- :host([modal]) .positioning-region {
42
- width: 100%;
43
- position: fixed;
44
- display: flex;
36
+ @keyframes ni-private-drawer-fade-in-keyframes {
37
+ 0% {
38
+ opacity: 0;
39
+ }
40
+ 100% {
41
+ opacity: 1;
42
+ }
45
43
  }
46
44
 
47
- ${ /* Note: overlay is only present in the DOM when modal=true */''}
48
- .overlay {
49
- position: fixed;
50
- inset: 0px;
51
- background: ${modalBackdropColor};
52
- touch-action: none;
45
+ dialog.animating::backdrop {
46
+ animation: ni-private-drawer-fade-in-keyframes ${largeDelayStatic}
47
+ ease-in;
53
48
  }
54
49
 
55
- .control {
56
- position: relative;
57
- top: 0px;
58
- bottom: 0px;
50
+ dialog.closing::backdrop {
51
+ animation-direction: reverse;
52
+ }
53
+
54
+ .dialog-contents {
55
+ box-sizing: border-box;
59
56
  display: flex;
60
57
  flex-direction: column;
61
- box-sizing: border-box;
62
- border-radius: 0px;
63
- border-width: 0px;
58
+ position: absolute;
64
59
  width: ${drawerWidth};
65
60
  height: 100%;
66
61
  background-color: ${applicationBackgroundColor};
67
62
  }
68
63
 
69
- :host([modal]) .control {
70
- position: absolute;
71
- height: 100%;
64
+ @keyframes ni-private-drawer-slide-in-left-keyframes {
65
+ 0% {
66
+ transform: translate(-100%);
67
+ }
68
+ 100% {
69
+ transform: translate(0%);
70
+ }
72
71
  }
73
72
 
74
- :host([location='left']) .control {
75
- left: 0px;
73
+ :host([location='left']) .dialog-contents {
76
74
  border-right: ${borderWidth} solid ${popupBoxShadowColor};
75
+ box-shadow: 3px 0px 8px ${popupBoxShadowColor};
76
+ }
77
+
78
+ :host([location='left']) dialog.animating .dialog-contents {
79
+ animation: ni-private-drawer-slide-in-left-keyframes ${largeDelay}
80
+ ease-in;
81
+ }
82
+
83
+ :host([location='left']) dialog.closing .dialog-contents {
84
+ animation-direction: reverse;
77
85
  }
78
86
 
79
- :host([location='right']) .control {
87
+ @keyframes ni-private-drawer-slide-in-right-keyframes {
88
+ 0% {
89
+ transform: translate(100%);
90
+ }
91
+ 100% {
92
+ transform: translate(0%);
93
+ }
94
+ }
95
+
96
+ :host([location='right']) .dialog-contents {
80
97
  right: 0px;
81
98
  border-left: ${borderWidth} solid ${popupBoxShadowColor};
99
+ box-shadow: -3px 0px 8px ${popupBoxShadowColor};
100
+ }
101
+
102
+ :host([location='right']) dialog.animating .dialog-contents {
103
+ animation: ni-private-drawer-slide-in-right-keyframes ${largeDelay}
104
+ ease-in;
105
+ }
106
+
107
+ :host([location='right']) dialog.closing .dialog-contents {
108
+ animation-direction: reverse;
109
+ }
110
+
111
+ @media (prefers-reduced-motion) {
112
+ :host([location='left']) dialog.animating .dialog-contents,
113
+ :host([location='right']) dialog.animating .dialog-contents {
114
+ animation-duration: 1ms;
115
+ }
82
116
  }
83
117
 
84
118
  ${
@@ -106,5 +140,22 @@ export const styles = css `
106
140
  justify-content: flex-end;
107
141
  border-top: ${borderWidth} solid ${popupBorderColor};
108
142
  }
109
- `;
143
+ `.withBehaviors(
144
+ /*
145
+ * We cannot use the modalBackdropColor token directly because the backdrop
146
+ * element is not a descendant of the nimble-theme-provider element.
147
+ */
148
+ themeBehavior(Theme.light, css `
149
+ dialog::backdrop {
150
+ background: ${modalBackdropColorThemeLightStatic};
151
+ }
152
+ `), themeBehavior(Theme.dark, css `
153
+ dialog::backdrop {
154
+ background: ${modalBackdropColorThemeDarkStatic};
155
+ }
156
+ `), themeBehavior(Theme.color, css `
157
+ dialog::backdrop {
158
+ background: ${modalBackdropColorThemeColorStatic};
159
+ }
160
+ `));
110
161
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/drawer/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACH,0BAA0B,EAC1B,QAAQ,EACR,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,WAAW,EACX,kBAAkB,EACrB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,OAAO,CAAC;;;;;;;;;gBASN,QAAQ;iBACP,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAgCxB,CAAA,8DAA+D,EAAE;;;;sBAIjD,kBAAkB;;;;;;;;;;;;;iBAavB,WAAW;;4BAEA,0BAA0B;;;;;;;;;;wBAU9B,WAAW,UAAU,mBAAmB;;;;;uBAKzC,WAAW,UAAU,mBAAmB;;;MAGzD;AACE;;;EAGE,CAAC,EACP;;;mBAGe,eAAe;;gBAElB,cAAc;;;;mBAIX,eAAe;;;;;;mBAMf,eAAe;;;;sBAIZ,WAAW,UAAU,gBAAgB;;CAE1D,CAAC"}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/drawer/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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EvD,CACJ,CACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { Drawer } from '.';
2
+ export declare const template: import("@microsoft/fast-element").ViewTemplate<Drawer<void>, any>;
@@ -0,0 +1,13 @@
1
+ import { html, ref } from '@microsoft/fast-element';
2
+ export const template = html `
3
+ <dialog
4
+ ${ref('dialog')}
5
+ aria-label="${x => x.ariaLabel}"
6
+ @cancel="${(x, c) => x.cancelHandler(c.event)}"
7
+ >
8
+ <div class="dialog-contents">
9
+ <slot></slot>
10
+ </div>
11
+ </dialog>
12
+ `;
13
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/drawer/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAGpD,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAQ;;UAE1B,GAAG,CAAC,QAAQ,CAAC;sBACD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;mBACnB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC;;;;;;CAMpD,CAAC"}
@@ -3,10 +3,3 @@ export declare const DrawerLocation: {
3
3
  readonly right: "right";
4
4
  };
5
5
  export declare type DrawerLocation = typeof DrawerLocation[keyof typeof DrawerLocation];
6
- export declare const DrawerState: {
7
- readonly opening: "opening";
8
- readonly opened: "opened";
9
- readonly closing: "closing";
10
- readonly closed: "closed";
11
- };
12
- export declare type DrawerState = typeof DrawerState[keyof typeof DrawerState];
@@ -2,10 +2,4 @@ export const DrawerLocation = {
2
2
  left: 'left',
3
3
  right: 'right'
4
4
  };
5
- export const DrawerState = {
6
- opening: 'opening',
7
- opened: 'opened',
8
- closing: 'closing',
9
- closed: 'closed'
10
- };
11
5
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/drawer/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;CACR,CAAC;AAGX,MAAM,CAAC,MAAM,WAAW,GAAG;IACvB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;CACV,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/drawer/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;CACR,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Symbol that is returned as the close reason (from the Promise returned by show()) when
3
+ * the dialog or drawer was closed by pressing the ESC key (vs. calling the close() function).
4
+ */
5
+ export declare const UserDismissed: unique symbol;
6
+ export declare type UserDismissed = typeof UserDismissed;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Symbol that is returned as the close reason (from the Promise returned by show()) when
3
+ * the dialog or drawer was closed by pressing the ESC key (vs. calling the close() function).
4
+ */
5
+ export const UserDismissed = Symbol('user dismissed');
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/patterns/dialog/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAkB,MAAM,CAAC,gBAAgB,CAAC,CAAC"}
@@ -1,3 +1,10 @@
1
- export declare const modalBackdropColorThemeLight: string;
2
- export declare const modalBackdropColorThemeDark: string;
3
- export declare const modalBackdropColorThemeColor: string;
1
+ /**
2
+ * Static tokens to use for styling the `::backdrop` pseduo-element of an HTML dialog, which
3
+ * does not have access to CSS custom properties.
4
+ *
5
+ * See https://github.com/whatwg/fullscreen/issues/124
6
+ */
7
+ export declare const modalBackdropColorThemeLightStatic: string;
8
+ export declare const modalBackdropColorThemeDarkStatic: string;
9
+ export declare const modalBackdropColorThemeColorStatic: string;
10
+ export declare const largeDelayStatic: string;
@@ -1,6 +1,13 @@
1
- import { Black } from '@ni/nimble-tokens/dist/styledictionary/js/tokens';
1
+ import { Black, LargeDelay } from '@ni/nimble-tokens/dist/styledictionary/js/tokens';
2
2
  import { hexToRgbaCssColor } from '../utilities/style/colors';
3
- export const modalBackdropColorThemeLight = hexToRgbaCssColor(Black, 0.3);
4
- export const modalBackdropColorThemeDark = hexToRgbaCssColor(Black, 0.6);
5
- export const modalBackdropColorThemeColor = hexToRgbaCssColor(Black, 0.6);
3
+ /**
4
+ * Static tokens to use for styling the `::backdrop` pseduo-element of an HTML dialog, which
5
+ * does not have access to CSS custom properties.
6
+ *
7
+ * See https://github.com/whatwg/fullscreen/issues/124
8
+ */
9
+ export const modalBackdropColorThemeLightStatic = hexToRgbaCssColor(Black, 0.3);
10
+ export const modalBackdropColorThemeDarkStatic = hexToRgbaCssColor(Black, 0.6);
11
+ export const modalBackdropColorThemeColorStatic = hexToRgbaCssColor(Black, 0.6);
12
+ export const largeDelayStatic = LargeDelay;
6
13
  //# sourceMappingURL=design-tokens-static.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"design-tokens-static.js","sourceRoot":"","sources":["../../../src/theme-provider/design-tokens-static.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kDAAkD,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,MAAM,CAAC,MAAM,4BAA4B,GAAG,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC1E,MAAM,CAAC,MAAM,2BAA2B,GAAG,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,4BAA4B,GAAG,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"design-tokens-static.js","sourceRoot":"","sources":["../../../src/theme-provider/design-tokens-static.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EACL,UAAU,EACb,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,kCAAkC,GAAG,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAChF,MAAM,CAAC,MAAM,iCAAiC,GAAG,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC/E,MAAM,CAAC,MAAM,kCAAkC,GAAG,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAEhF,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { DesignToken } from '@microsoft/fast-foundation';
2
2
  import hexRgb from 'hex-rgb';
3
3
  import { Black7, Black91, Black85, Black15, Black75, Black80, Black88, White, ForestGreen, DigitalGreenLight, Fail100LightUi, SmallDelay, MediumDelay, LargeDelay, Fail100DarkUi, Warning100LightUi, Warning100DarkUi, Pass100LightUi, Pass100DarkUi, BodyFamily, BodySize, BodyWeight, ControlLabel1Family, ControlLabel1Size, ControlLabel1Weight, GroupLabel1Family, GroupLabel1Size, GroupLabel1Weight, Headline2Size, Headline2Family, Headline2Weight, Headline1Size, Headline1Family, Headline1Weight, Title3Size, Title3Family, Title3Weight, Title2Size, Title2Family, Title2Weight, Title1Size, Title1Family, Title1Weight, Subtitle2Size, Subtitle2Family, Subtitle2Weight, Subtitle1Size, Subtitle1Family, Subtitle1Weight, LinkLightUiSize, LinkLightUiFamily, LinkLightUiWeight, PlaceholderSize, PlaceholderFamily, PlaceholderWeight, BodyEmphasizedSize, BodyEmphasizedFamily, BodyEmphasizedWeight, ButtonLabel1Size, ButtonLabel1Family, ButtonLabel1Weight, TooltipCaptionSize, TooltipCaptionFamily, TooltipCaptionWeight, ErrorLightUiSize, ErrorLightUiFamily, ErrorLightUiWeight, Headline2LineHeight, Headline1LineHeight, Title3LineHeight, Title2LineHeight, Title1LineHeight, Subtitle2LineHeight, Subtitle1LineHeight, LinkLineHeight, PlaceholderLineHeight, BodyEmphasizedLineHeight, BodyLineHeight, GroupLabel1LineHeight, ControlLabel1LineHeight, ButtonLabel1LineHeight, TooltipCaptionLineHeight, Information100LightUi, Information100DarkUi } from '@ni/nimble-tokens/dist/styledictionary/js/tokens';
4
- import { modalBackdropColorThemeColor, modalBackdropColorThemeDark, modalBackdropColorThemeLight } from './design-tokens-static';
4
+ import { modalBackdropColorThemeColorStatic, modalBackdropColorThemeDarkStatic, modalBackdropColorThemeLightStatic } from './design-tokens-static';
5
5
  import { Theme } from './types';
6
6
  import { tokenNames, styleNameFromTokenName } from './design-token-names';
7
7
  import { theme } from '.';
@@ -141,13 +141,13 @@ function getFillDownColorForTheme(element) {
141
141
  function getModalBackdropForTheme(element) {
142
142
  switch (theme.getValueFor(element)) {
143
143
  case Theme.light:
144
- return modalBackdropColorThemeLight;
144
+ return modalBackdropColorThemeLightStatic;
145
145
  case Theme.dark:
146
- return modalBackdropColorThemeDark;
146
+ return modalBackdropColorThemeDarkStatic;
147
147
  case Theme.color:
148
- return modalBackdropColorThemeColor;
148
+ return modalBackdropColorThemeColorStatic;
149
149
  default:
150
- return modalBackdropColorThemeLight;
150
+ return modalBackdropColorThemeLightStatic;
151
151
  }
152
152
  }
153
153
  //# sourceMappingURL=design-tokens.js.map