@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
|
@@ -4422,6 +4422,7 @@
|
|
|
4422
4422
|
* This set of exported strings reference https://developer.mozilla.org/en-US/docs/Web/Events
|
|
4423
4423
|
* and should include all non-deprecated and non-experimental Standard events
|
|
4424
4424
|
*/
|
|
4425
|
+
const eventAnimationEnd = "animationend";
|
|
4425
4426
|
const eventChange = "change";
|
|
4426
4427
|
const eventResize = "resize";
|
|
4427
4428
|
const eventScroll = "scroll";
|
|
@@ -9259,73 +9260,13 @@
|
|
|
9259
9260
|
}
|
|
9260
9261
|
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
9261
9262
|
|
|
9262
|
-
/**
|
|
9263
|
-
* The template for the {@link @microsoft/fast-foundation#Dialog} component.
|
|
9264
|
-
* @public
|
|
9265
|
-
*/
|
|
9266
|
-
const dialogTemplate = (context, definition) => html `
|
|
9267
|
-
<div class="positioning-region" part="positioning-region">
|
|
9268
|
-
${when(x => x.modal, html `
|
|
9269
|
-
<div
|
|
9270
|
-
class="overlay"
|
|
9271
|
-
part="overlay"
|
|
9272
|
-
role="presentation"
|
|
9273
|
-
@click="${x => x.dismiss()}"
|
|
9274
|
-
></div>
|
|
9275
|
-
`)}
|
|
9276
|
-
<div
|
|
9277
|
-
role="dialog"
|
|
9278
|
-
tabindex="-1"
|
|
9279
|
-
class="control"
|
|
9280
|
-
part="control"
|
|
9281
|
-
aria-modal="${x => x.modal}"
|
|
9282
|
-
aria-describedby="${x => x.ariaDescribedby}"
|
|
9283
|
-
aria-labelledby="${x => x.ariaLabelledby}"
|
|
9284
|
-
aria-label="${x => x.ariaLabel}"
|
|
9285
|
-
${ref("dialog")}
|
|
9286
|
-
>
|
|
9287
|
-
<slot></slot>
|
|
9288
|
-
</div>
|
|
9289
|
-
</div>
|
|
9290
|
-
`;
|
|
9291
|
-
|
|
9292
9263
|
/*!
|
|
9293
9264
|
* tabbable 5.2.1
|
|
9294
9265
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
9295
9266
|
*/
|
|
9296
9267
|
var candidateSelectors = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])', 'details>summary:first-of-type', 'details'];
|
|
9297
|
-
var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');
|
|
9298
9268
|
var matches = typeof Element === 'undefined' ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
9299
9269
|
|
|
9300
|
-
var isContentEditable = function isContentEditable(node) {
|
|
9301
|
-
return node.contentEditable === 'true';
|
|
9302
|
-
};
|
|
9303
|
-
|
|
9304
|
-
var getTabindex = function getTabindex(node) {
|
|
9305
|
-
var tabindexAttr = parseInt(node.getAttribute('tabindex'), 10);
|
|
9306
|
-
|
|
9307
|
-
if (!isNaN(tabindexAttr)) {
|
|
9308
|
-
return tabindexAttr;
|
|
9309
|
-
} // Browsers do not return `tabIndex` correctly for contentEditable nodes;
|
|
9310
|
-
// so if they don't have a tabindex attribute specifically set, assume it's 0.
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
if (isContentEditable(node)) {
|
|
9314
|
-
return 0;
|
|
9315
|
-
} // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
|
|
9316
|
-
// `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,
|
|
9317
|
-
// yet they are still part of the regular tab order; in FF, they get a default
|
|
9318
|
-
// `tabIndex` of 0; since Chrome still puts those elements in the regular tab
|
|
9319
|
-
// order, consider their tab index to be 0.
|
|
9320
|
-
|
|
9321
|
-
|
|
9322
|
-
if ((node.nodeName === 'AUDIO' || node.nodeName === 'VIDEO' || node.nodeName === 'DETAILS') && node.getAttribute('tabindex') === null) {
|
|
9323
|
-
return 0;
|
|
9324
|
-
}
|
|
9325
|
-
|
|
9326
|
-
return node.tabIndex;
|
|
9327
|
-
};
|
|
9328
|
-
|
|
9329
9270
|
var isInput = function isInput(node) {
|
|
9330
9271
|
return node.tagName === 'INPUT';
|
|
9331
9272
|
};
|
|
@@ -9341,51 +9282,6 @@
|
|
|
9341
9282
|
return r;
|
|
9342
9283
|
};
|
|
9343
9284
|
|
|
9344
|
-
var getCheckedRadio = function getCheckedRadio(nodes, form) {
|
|
9345
|
-
for (var i = 0; i < nodes.length; i++) {
|
|
9346
|
-
if (nodes[i].checked && nodes[i].form === form) {
|
|
9347
|
-
return nodes[i];
|
|
9348
|
-
}
|
|
9349
|
-
}
|
|
9350
|
-
};
|
|
9351
|
-
|
|
9352
|
-
var isTabbableRadio = function isTabbableRadio(node) {
|
|
9353
|
-
if (!node.name) {
|
|
9354
|
-
return true;
|
|
9355
|
-
}
|
|
9356
|
-
|
|
9357
|
-
var radioScope = node.form || node.ownerDocument;
|
|
9358
|
-
|
|
9359
|
-
var queryRadios = function queryRadios(name) {
|
|
9360
|
-
return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
|
|
9361
|
-
};
|
|
9362
|
-
|
|
9363
|
-
var radioSet;
|
|
9364
|
-
|
|
9365
|
-
if (typeof window !== 'undefined' && typeof window.CSS !== 'undefined' && typeof window.CSS.escape === 'function') {
|
|
9366
|
-
radioSet = queryRadios(window.CSS.escape(node.name));
|
|
9367
|
-
} else {
|
|
9368
|
-
try {
|
|
9369
|
-
radioSet = queryRadios(node.name);
|
|
9370
|
-
} catch (err) {
|
|
9371
|
-
// eslint-disable-next-line no-console
|
|
9372
|
-
console.error('Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s', err.message);
|
|
9373
|
-
return false;
|
|
9374
|
-
}
|
|
9375
|
-
}
|
|
9376
|
-
|
|
9377
|
-
var checked = getCheckedRadio(radioSet, node.form);
|
|
9378
|
-
return !checked || checked === node;
|
|
9379
|
-
};
|
|
9380
|
-
|
|
9381
|
-
var isRadio = function isRadio(node) {
|
|
9382
|
-
return isInput(node) && node.type === 'radio';
|
|
9383
|
-
};
|
|
9384
|
-
|
|
9385
|
-
var isNonTabbableRadio = function isNonTabbableRadio(node) {
|
|
9386
|
-
return isRadio(node) && !isTabbableRadio(node);
|
|
9387
|
-
};
|
|
9388
|
-
|
|
9389
9285
|
var isHidden = function isHidden(node, displayCheck) {
|
|
9390
9286
|
if (getComputedStyle(node).visibility === 'hidden') {
|
|
9391
9287
|
return true;
|
|
@@ -9467,28 +9363,6 @@
|
|
|
9467
9363
|
return true;
|
|
9468
9364
|
};
|
|
9469
9365
|
|
|
9470
|
-
var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) {
|
|
9471
|
-
if (!isNodeMatchingSelectorFocusable(options, node) || isNonTabbableRadio(node) || getTabindex(node) < 0) {
|
|
9472
|
-
return false;
|
|
9473
|
-
}
|
|
9474
|
-
|
|
9475
|
-
return true;
|
|
9476
|
-
};
|
|
9477
|
-
|
|
9478
|
-
var isTabbable = function isTabbable(node, options) {
|
|
9479
|
-
options = options || {};
|
|
9480
|
-
|
|
9481
|
-
if (!node) {
|
|
9482
|
-
throw new Error('No node provided');
|
|
9483
|
-
}
|
|
9484
|
-
|
|
9485
|
-
if (matches.call(node, candidateSelector) === false) {
|
|
9486
|
-
return false;
|
|
9487
|
-
}
|
|
9488
|
-
|
|
9489
|
-
return isNodeMatchingSelectorTabbable(options, node);
|
|
9490
|
-
};
|
|
9491
|
-
|
|
9492
9366
|
var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe').join(',');
|
|
9493
9367
|
|
|
9494
9368
|
var isFocusable = function isFocusable(node, options) {
|
|
@@ -9505,280 +9379,6 @@
|
|
|
9505
9379
|
return isNodeMatchingSelectorFocusable(options, node);
|
|
9506
9380
|
};
|
|
9507
9381
|
|
|
9508
|
-
/**
|
|
9509
|
-
* A Switch Custom HTML Element.
|
|
9510
|
-
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#dialog | ARIA dialog }.
|
|
9511
|
-
*
|
|
9512
|
-
* @slot - The default slot for the dialog content
|
|
9513
|
-
* @csspart positioning-region - A wrapping element used to center the dialog and position the modal overlay
|
|
9514
|
-
* @csspart overlay - The modal dialog overlay
|
|
9515
|
-
* @csspart control - The dialog element
|
|
9516
|
-
* @fires cancel - Fires a custom 'cancel' event when the modal overlay is clicked
|
|
9517
|
-
* @fires close - Fires a custom 'close' event when the dialog is hidden
|
|
9518
|
-
*
|
|
9519
|
-
* @public
|
|
9520
|
-
*/
|
|
9521
|
-
class Dialog$1 extends FoundationElement {
|
|
9522
|
-
constructor() {
|
|
9523
|
-
super(...arguments);
|
|
9524
|
-
/**
|
|
9525
|
-
* Indicates the element is modal. When modal, user mouse interaction will be limited to the contents of the element by a modal
|
|
9526
|
-
* overlay. Clicks on the overlay will cause the dialog to emit a "dismiss" event.
|
|
9527
|
-
* @public
|
|
9528
|
-
* @defaultValue - true
|
|
9529
|
-
* @remarks
|
|
9530
|
-
* HTML Attribute: modal
|
|
9531
|
-
*/
|
|
9532
|
-
this.modal = true;
|
|
9533
|
-
/**
|
|
9534
|
-
* The hidden state of the element.
|
|
9535
|
-
*
|
|
9536
|
-
* @public
|
|
9537
|
-
* @defaultValue - false
|
|
9538
|
-
* @remarks
|
|
9539
|
-
* HTML Attribute: hidden
|
|
9540
|
-
*/
|
|
9541
|
-
this.hidden = false;
|
|
9542
|
-
/**
|
|
9543
|
-
* Indicates that the dialog should trap focus.
|
|
9544
|
-
*
|
|
9545
|
-
* @public
|
|
9546
|
-
* @defaultValue - true
|
|
9547
|
-
* @remarks
|
|
9548
|
-
* HTML Attribute: trap-focus
|
|
9549
|
-
*/
|
|
9550
|
-
this.trapFocus = true;
|
|
9551
|
-
this.trapFocusChanged = () => {
|
|
9552
|
-
if (this.$fastController.isConnected) {
|
|
9553
|
-
this.updateTrapFocus();
|
|
9554
|
-
}
|
|
9555
|
-
};
|
|
9556
|
-
/**
|
|
9557
|
-
* @internal
|
|
9558
|
-
*/
|
|
9559
|
-
this.isTrappingFocus = false;
|
|
9560
|
-
this.handleDocumentKeydown = (e) => {
|
|
9561
|
-
if (!e.defaultPrevented && !this.hidden) {
|
|
9562
|
-
switch (e.key) {
|
|
9563
|
-
case keyEscape:
|
|
9564
|
-
this.dismiss();
|
|
9565
|
-
e.preventDefault();
|
|
9566
|
-
break;
|
|
9567
|
-
case keyTab:
|
|
9568
|
-
this.handleTabKeyDown(e);
|
|
9569
|
-
break;
|
|
9570
|
-
}
|
|
9571
|
-
}
|
|
9572
|
-
};
|
|
9573
|
-
this.handleDocumentFocus = (e) => {
|
|
9574
|
-
if (!e.defaultPrevented && this.shouldForceFocus(e.target)) {
|
|
9575
|
-
this.focusFirstElement();
|
|
9576
|
-
e.preventDefault();
|
|
9577
|
-
}
|
|
9578
|
-
};
|
|
9579
|
-
this.handleTabKeyDown = (e) => {
|
|
9580
|
-
if (!this.trapFocus || this.hidden) {
|
|
9581
|
-
return;
|
|
9582
|
-
}
|
|
9583
|
-
const bounds = this.getTabQueueBounds();
|
|
9584
|
-
if (bounds.length === 0) {
|
|
9585
|
-
return;
|
|
9586
|
-
}
|
|
9587
|
-
if (bounds.length === 1) {
|
|
9588
|
-
// keep focus on single element
|
|
9589
|
-
bounds[0].focus();
|
|
9590
|
-
e.preventDefault();
|
|
9591
|
-
return;
|
|
9592
|
-
}
|
|
9593
|
-
if (e.shiftKey && e.target === bounds[0]) {
|
|
9594
|
-
bounds[bounds.length - 1].focus();
|
|
9595
|
-
e.preventDefault();
|
|
9596
|
-
}
|
|
9597
|
-
else if (!e.shiftKey && e.target === bounds[bounds.length - 1]) {
|
|
9598
|
-
bounds[0].focus();
|
|
9599
|
-
e.preventDefault();
|
|
9600
|
-
}
|
|
9601
|
-
return;
|
|
9602
|
-
};
|
|
9603
|
-
this.getTabQueueBounds = () => {
|
|
9604
|
-
const bounds = [];
|
|
9605
|
-
return Dialog$1.reduceTabbableItems(bounds, this);
|
|
9606
|
-
};
|
|
9607
|
-
/**
|
|
9608
|
-
* focus on first element of tab queue
|
|
9609
|
-
*/
|
|
9610
|
-
this.focusFirstElement = () => {
|
|
9611
|
-
const bounds = this.getTabQueueBounds();
|
|
9612
|
-
if (bounds.length > 0) {
|
|
9613
|
-
bounds[0].focus();
|
|
9614
|
-
}
|
|
9615
|
-
else {
|
|
9616
|
-
if (this.dialog instanceof HTMLElement) {
|
|
9617
|
-
this.dialog.focus();
|
|
9618
|
-
}
|
|
9619
|
-
}
|
|
9620
|
-
};
|
|
9621
|
-
/**
|
|
9622
|
-
* we should only focus if focus has not already been brought to the dialog
|
|
9623
|
-
*/
|
|
9624
|
-
this.shouldForceFocus = (currentFocusElement) => {
|
|
9625
|
-
return this.isTrappingFocus && !this.contains(currentFocusElement);
|
|
9626
|
-
};
|
|
9627
|
-
/**
|
|
9628
|
-
* we should we be active trapping focus
|
|
9629
|
-
*/
|
|
9630
|
-
this.shouldTrapFocus = () => {
|
|
9631
|
-
return this.trapFocus && !this.hidden;
|
|
9632
|
-
};
|
|
9633
|
-
/**
|
|
9634
|
-
*
|
|
9635
|
-
*
|
|
9636
|
-
* @internal
|
|
9637
|
-
*/
|
|
9638
|
-
this.updateTrapFocus = (shouldTrapFocusOverride) => {
|
|
9639
|
-
const shouldTrapFocus = shouldTrapFocusOverride === undefined
|
|
9640
|
-
? this.shouldTrapFocus()
|
|
9641
|
-
: shouldTrapFocusOverride;
|
|
9642
|
-
if (shouldTrapFocus && !this.isTrappingFocus) {
|
|
9643
|
-
this.isTrappingFocus = true;
|
|
9644
|
-
// Add an event listener for focusin events if we are trapping focus
|
|
9645
|
-
document.addEventListener("focusin", this.handleDocumentFocus);
|
|
9646
|
-
DOM.queueUpdate(() => {
|
|
9647
|
-
if (this.shouldForceFocus(document.activeElement)) {
|
|
9648
|
-
this.focusFirstElement();
|
|
9649
|
-
}
|
|
9650
|
-
});
|
|
9651
|
-
}
|
|
9652
|
-
else if (!shouldTrapFocus && this.isTrappingFocus) {
|
|
9653
|
-
this.isTrappingFocus = false;
|
|
9654
|
-
// remove event listener if we are not trapping focus
|
|
9655
|
-
document.removeEventListener("focusin", this.handleDocumentFocus);
|
|
9656
|
-
}
|
|
9657
|
-
};
|
|
9658
|
-
}
|
|
9659
|
-
/**
|
|
9660
|
-
* @internal
|
|
9661
|
-
*/
|
|
9662
|
-
dismiss() {
|
|
9663
|
-
this.$emit("dismiss");
|
|
9664
|
-
// implement `<dialog>` interface
|
|
9665
|
-
this.$emit("cancel");
|
|
9666
|
-
}
|
|
9667
|
-
/**
|
|
9668
|
-
* The method to show the dialog.
|
|
9669
|
-
*
|
|
9670
|
-
* @public
|
|
9671
|
-
*/
|
|
9672
|
-
show() {
|
|
9673
|
-
this.hidden = false;
|
|
9674
|
-
}
|
|
9675
|
-
/**
|
|
9676
|
-
* The method to hide the dialog.
|
|
9677
|
-
*
|
|
9678
|
-
* @public
|
|
9679
|
-
*/
|
|
9680
|
-
hide() {
|
|
9681
|
-
this.hidden = true;
|
|
9682
|
-
// implement `<dialog>` interface
|
|
9683
|
-
this.$emit("close");
|
|
9684
|
-
}
|
|
9685
|
-
/**
|
|
9686
|
-
* @internal
|
|
9687
|
-
*/
|
|
9688
|
-
connectedCallback() {
|
|
9689
|
-
super.connectedCallback();
|
|
9690
|
-
document.addEventListener("keydown", this.handleDocumentKeydown);
|
|
9691
|
-
this.notifier = Observable.getNotifier(this);
|
|
9692
|
-
this.notifier.subscribe(this, "hidden");
|
|
9693
|
-
this.updateTrapFocus();
|
|
9694
|
-
}
|
|
9695
|
-
/**
|
|
9696
|
-
* @internal
|
|
9697
|
-
*/
|
|
9698
|
-
disconnectedCallback() {
|
|
9699
|
-
super.disconnectedCallback();
|
|
9700
|
-
// remove keydown event listener
|
|
9701
|
-
document.removeEventListener("keydown", this.handleDocumentKeydown);
|
|
9702
|
-
// if we are trapping focus remove the focusin listener
|
|
9703
|
-
this.updateTrapFocus(false);
|
|
9704
|
-
this.notifier.unsubscribe(this, "hidden");
|
|
9705
|
-
}
|
|
9706
|
-
/**
|
|
9707
|
-
* @internal
|
|
9708
|
-
*/
|
|
9709
|
-
handleChange(source, propertyName) {
|
|
9710
|
-
switch (propertyName) {
|
|
9711
|
-
case "hidden":
|
|
9712
|
-
this.updateTrapFocus();
|
|
9713
|
-
break;
|
|
9714
|
-
}
|
|
9715
|
-
}
|
|
9716
|
-
/**
|
|
9717
|
-
* Reduce a collection to only its focusable elements.
|
|
9718
|
-
*
|
|
9719
|
-
* @param elements - Collection of elements to reduce
|
|
9720
|
-
* @param element - The current element
|
|
9721
|
-
*
|
|
9722
|
-
* @internal
|
|
9723
|
-
*/
|
|
9724
|
-
static reduceTabbableItems(elements, element) {
|
|
9725
|
-
if (element.getAttribute("tabindex") === "-1") {
|
|
9726
|
-
return elements;
|
|
9727
|
-
}
|
|
9728
|
-
if (isTabbable(element) ||
|
|
9729
|
-
(Dialog$1.isFocusableFastElement(element) && Dialog$1.hasTabbableShadow(element))) {
|
|
9730
|
-
elements.push(element);
|
|
9731
|
-
return elements;
|
|
9732
|
-
}
|
|
9733
|
-
if (element.childElementCount) {
|
|
9734
|
-
return elements.concat(Array.from(element.children).reduce(Dialog$1.reduceTabbableItems, []));
|
|
9735
|
-
}
|
|
9736
|
-
return elements;
|
|
9737
|
-
}
|
|
9738
|
-
/**
|
|
9739
|
-
* Test if element is focusable fast element
|
|
9740
|
-
*
|
|
9741
|
-
* @param element - The element to check
|
|
9742
|
-
*
|
|
9743
|
-
* @internal
|
|
9744
|
-
*/
|
|
9745
|
-
static isFocusableFastElement(element) {
|
|
9746
|
-
var _a, _b;
|
|
9747
|
-
return !!((_b = (_a = element.$fastController) === null || _a === void 0 ? void 0 : _a.definition.shadowOptions) === null || _b === void 0 ? void 0 : _b.delegatesFocus);
|
|
9748
|
-
}
|
|
9749
|
-
/**
|
|
9750
|
-
* Test if the element has a focusable shadow
|
|
9751
|
-
*
|
|
9752
|
-
* @param element - The element to check
|
|
9753
|
-
*
|
|
9754
|
-
* @internal
|
|
9755
|
-
*/
|
|
9756
|
-
static hasTabbableShadow(element) {
|
|
9757
|
-
var _a, _b;
|
|
9758
|
-
return Array.from((_b = (_a = element.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll("*")) !== null && _b !== void 0 ? _b : []).some(x => {
|
|
9759
|
-
return isTabbable(x);
|
|
9760
|
-
});
|
|
9761
|
-
}
|
|
9762
|
-
}
|
|
9763
|
-
__decorate$1([
|
|
9764
|
-
attr({ mode: "boolean" })
|
|
9765
|
-
], Dialog$1.prototype, "modal", void 0);
|
|
9766
|
-
__decorate$1([
|
|
9767
|
-
attr({ mode: "boolean" })
|
|
9768
|
-
], Dialog$1.prototype, "hidden", void 0);
|
|
9769
|
-
__decorate$1([
|
|
9770
|
-
attr({ attribute: "trap-focus", mode: "boolean" })
|
|
9771
|
-
], Dialog$1.prototype, "trapFocus", void 0);
|
|
9772
|
-
__decorate$1([
|
|
9773
|
-
attr({ attribute: "aria-describedby" })
|
|
9774
|
-
], Dialog$1.prototype, "ariaDescribedby", void 0);
|
|
9775
|
-
__decorate$1([
|
|
9776
|
-
attr({ attribute: "aria-labelledby" })
|
|
9777
|
-
], Dialog$1.prototype, "ariaLabelledby", void 0);
|
|
9778
|
-
__decorate$1([
|
|
9779
|
-
attr({ attribute: "aria-label" })
|
|
9780
|
-
], Dialog$1.prototype, "ariaLabel", void 0);
|
|
9781
|
-
|
|
9782
9382
|
/**
|
|
9783
9383
|
* The template for the {@link @microsoft/fast-foundation#(ListboxOption:class)} component.
|
|
9784
9384
|
* @public
|
|
@@ -15017,9 +14617,16 @@
|
|
|
15017
14617
|
return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
|
|
15018
14618
|
}
|
|
15019
14619
|
|
|
15020
|
-
|
|
15021
|
-
|
|
15022
|
-
|
|
14620
|
+
/**
|
|
14621
|
+
* Static tokens to use for styling the `::backdrop` pseduo-element of an HTML dialog, which
|
|
14622
|
+
* does not have access to CSS custom properties.
|
|
14623
|
+
*
|
|
14624
|
+
* See https://github.com/whatwg/fullscreen/issues/124
|
|
14625
|
+
*/
|
|
14626
|
+
const modalBackdropColorThemeLightStatic = hexToRgbaCssColor(Black, 0.3);
|
|
14627
|
+
const modalBackdropColorThemeDarkStatic = hexToRgbaCssColor(Black, 0.6);
|
|
14628
|
+
const modalBackdropColorThemeColorStatic = hexToRgbaCssColor(Black, 0.6);
|
|
14629
|
+
const largeDelayStatic = LargeDelay;
|
|
15023
14630
|
|
|
15024
14631
|
const Theme = {
|
|
15025
14632
|
light: 'light',
|
|
@@ -15197,7 +14804,7 @@
|
|
|
15197
14804
|
const prefix = 'ni-nimble';
|
|
15198
14805
|
const styleNameFromTokenName = (tokenName) => `${prefix}-${tokenName}`;
|
|
15199
14806
|
|
|
15200
|
-
const template$
|
|
14807
|
+
const template$8 = html `<slot></slot>`;
|
|
15201
14808
|
|
|
15202
14809
|
const styles$w = css `
|
|
15203
14810
|
:host {
|
|
@@ -15256,7 +14863,7 @@
|
|
|
15256
14863
|
const nimbleDesignSystemProvider = ThemeProvider.compose({
|
|
15257
14864
|
baseName: 'theme-provider',
|
|
15258
14865
|
styles: styles$w,
|
|
15259
|
-
template: template$
|
|
14866
|
+
template: template$8
|
|
15260
14867
|
});
|
|
15261
14868
|
DesignSystem.getOrCreate()
|
|
15262
14869
|
.withPrefix('nimble')
|
|
@@ -15282,7 +14889,7 @@
|
|
|
15282
14889
|
const borderHoverColor = DesignToken.create(styleNameFromTokenName(tokenNames.borderHoverColor)).withDefault((element) => getColorForTheme(element, DigitalGreenLight, DigitalGreenLight, White));
|
|
15283
14890
|
// Component Color Tokens
|
|
15284
14891
|
const iconColor = DesignToken.create(styleNameFromTokenName(tokenNames.iconColor)).withDefault((element) => getColorForTheme(element, Black91, Black15, White));
|
|
15285
|
-
|
|
14892
|
+
DesignToken.create(styleNameFromTokenName(tokenNames.modalBackdropColor)).withDefault((element) => getModalBackdropForTheme(element));
|
|
15286
14893
|
const popupBoxShadowColor = DesignToken.create(styleNameFromTokenName(tokenNames.popupBoxShadowColor)).withDefault((element) => hexToRgbaCssColor(getColorForTheme(element, Black75, Black85, Black85), 0.3));
|
|
15287
14894
|
const popupBorderColor = DesignToken.create(styleNameFromTokenName(tokenNames.popupBorderColor)).withDefault((element) => hexToRgbaCssColor(getColorForTheme(element, Black91, Black15, White), 0.3));
|
|
15288
14895
|
DesignToken.create(styleNameFromTokenName(tokenNames.tooltipBackgroundColor)).withDefault((element) => getColorForTheme(element, Black15, Black85, ForestGreen));
|
|
@@ -15301,7 +14908,7 @@
|
|
|
15301
14908
|
const [titlePlus1Font, titlePlus1FontColor, titlePlus1DisabledFontColor, titlePlus1FontFamily, titlePlus1FontWeight, titlePlus1FontSize, titlePlus1FontLineHeight, titlePlus1FallbackFontFamily] = createFontTokens(tokenNames.titlePlus1Font, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), Title2Family, Title2Weight, Title2Size, Title2LineHeight, 'sans-serif');
|
|
15302
14909
|
createFontTokens(tokenNames.titleFont, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), Title1Family, Title1Weight, Title1Size, Title1LineHeight, 'sans-serif');
|
|
15303
14910
|
createFontTokens(tokenNames.subtitlePlus1Font, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), Subtitle2Family, Subtitle2Weight, Subtitle2Size, Subtitle2LineHeight, 'sans-serif');
|
|
15304
|
-
createFontTokens(tokenNames.subtitleFont, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), Subtitle1Family, Subtitle1Weight, Subtitle1Size, Subtitle1LineHeight, 'sans-serif');
|
|
14911
|
+
const [subtitleFont, subtitleFontColor, subtitleDisabledFontColor, subtitleFontFamily, subtitleFontWeight, subtitleFontSize, subtitleFontLineHeight, subtitleFallbackFontFamily] = createFontTokens(tokenNames.subtitleFont, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), Subtitle1Family, Subtitle1Weight, Subtitle1Size, Subtitle1LineHeight, 'sans-serif');
|
|
15305
14912
|
createFontTokens(tokenNames.linkStandardFont, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), LinkLightUiFamily, LinkLightUiWeight, LinkLightUiSize, LinkLineHeight, 'sans-serif');
|
|
15306
14913
|
const [placeholderFont, placeholderFontColor, placeholderDisabledFontColor, placeholderFontFamily, placeholderFontWeight, placeholderFontSize, placeholderFontLineHeight, placeholderFallbackFontFamily] = createFontTokens(tokenNames.placeholderFont, (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.6), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), PlaceholderFamily, PlaceholderWeight, PlaceholderSize, PlaceholderLineHeight, 'sans-serif');
|
|
15307
14914
|
const [bodyEmphasizedFont, bodyEmphasizedFontColor, bodyEmphasizedDisabledFontColor, bodyEmphasizedFontFamily, bodyEmphasizedFontWeight, bodyEmphasizedFontSize, bodyEmphasizedFontLineHeight, bodyEmphasizedFallbackFontFamily] = createFontTokens(tokenNames.bodyEmphasizedFont, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), BodyEmphasizedFamily, BodyEmphasizedWeight, BodyEmphasizedSize, BodyEmphasizedLineHeight, 'sans-serif');
|
|
@@ -15397,13 +15004,13 @@
|
|
|
15397
15004
|
function getModalBackdropForTheme(element) {
|
|
15398
15005
|
switch (theme.getValueFor(element)) {
|
|
15399
15006
|
case Theme.light:
|
|
15400
|
-
return
|
|
15007
|
+
return modalBackdropColorThemeLightStatic;
|
|
15401
15008
|
case Theme.dark:
|
|
15402
|
-
return
|
|
15009
|
+
return modalBackdropColorThemeDarkStatic;
|
|
15403
15010
|
case Theme.color:
|
|
15404
|
-
return
|
|
15011
|
+
return modalBackdropColorThemeColorStatic;
|
|
15405
15012
|
default:
|
|
15406
|
-
return
|
|
15013
|
+
return modalBackdropColorThemeLightStatic;
|
|
15407
15014
|
}
|
|
15408
15015
|
}
|
|
15409
15016
|
|
|
@@ -16962,7 +16569,7 @@
|
|
|
16962
16569
|
}
|
|
16963
16570
|
`;
|
|
16964
16571
|
|
|
16965
|
-
const template$
|
|
16572
|
+
const template$7 = (context, definition) => html `
|
|
16966
16573
|
<div
|
|
16967
16574
|
role="button"
|
|
16968
16575
|
part="control"
|
|
@@ -17037,7 +16644,7 @@
|
|
|
17037
16644
|
applyMixins(ToggleButton, StartEnd, DelegatesARIAButton);
|
|
17038
16645
|
const nimbleToggleButton = ToggleButton.compose({
|
|
17039
16646
|
baseName: 'toggle-button',
|
|
17040
|
-
template: template$
|
|
16647
|
+
template: template$7,
|
|
17041
16648
|
styles: styles$p,
|
|
17042
16649
|
shadowOptions: {
|
|
17043
16650
|
delegatesFocus: true
|
|
@@ -17051,7 +16658,7 @@
|
|
|
17051
16658
|
</div>
|
|
17052
16659
|
`;
|
|
17053
16660
|
|
|
17054
|
-
const template$
|
|
16661
|
+
const template$6 = html `
|
|
17055
16662
|
<template>
|
|
17056
16663
|
<div class="icon" :innerHTML=${x => x.icon.data}></div>
|
|
17057
16664
|
</template
|
|
@@ -17110,7 +16717,7 @@
|
|
|
17110
16717
|
const registerIcon = (baseName, iconClass) => {
|
|
17111
16718
|
const composedIcon = iconClass.compose({
|
|
17112
16719
|
baseName,
|
|
17113
|
-
template: template$
|
|
16720
|
+
template: template$6,
|
|
17114
16721
|
styles: styles$o,
|
|
17115
16722
|
baseClass: iconClass
|
|
17116
16723
|
});
|
|
@@ -17690,1293 +17297,369 @@
|
|
|
17690
17297
|
});
|
|
17691
17298
|
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleCombobox());
|
|
17692
17299
|
|
|
17300
|
+
/**
|
|
17301
|
+
* Symbol that is returned as the close reason (from the Promise returned by show()) when
|
|
17302
|
+
* the dialog or drawer was closed by pressing the ESC key (vs. calling the close() function).
|
|
17303
|
+
*/
|
|
17304
|
+
const UserDismissed = Symbol('user dismissed');
|
|
17305
|
+
|
|
17693
17306
|
const styles$k = css `
|
|
17694
17307
|
${display('grid')}
|
|
17695
17308
|
|
|
17696
17309
|
dialog {
|
|
17310
|
+
flex-direction: column;
|
|
17697
17311
|
background-color: ${applicationBackgroundColor};
|
|
17698
|
-
border:
|
|
17699
|
-
box-shadow: 0px
|
|
17700
|
-
|
|
17312
|
+
border: none;
|
|
17313
|
+
box-shadow: 0px 4px 8px #0000004d;
|
|
17314
|
+
padding: 0px;
|
|
17315
|
+
width: 400px;
|
|
17316
|
+
max-height: 600px;
|
|
17701
17317
|
}
|
|
17702
|
-
`.withBehaviors(
|
|
17703
|
-
/*
|
|
17704
|
-
* We cannot use the modalBackdropColor token directly because the backdrop
|
|
17705
|
-
* element is not a descendant of the nimble-theme-provider element.
|
|
17706
|
-
*/
|
|
17707
|
-
themeBehavior(Theme.light, css `
|
|
17708
|
-
dialog::backdrop {
|
|
17709
|
-
background: ${modalBackdropColorThemeLight};
|
|
17710
|
-
}
|
|
17711
|
-
`), themeBehavior(Theme.dark, css `
|
|
17712
|
-
dialog::backdrop {
|
|
17713
|
-
background: ${modalBackdropColorThemeDark};
|
|
17714
|
-
}
|
|
17715
|
-
`), themeBehavior(Theme.color, css `
|
|
17716
|
-
dialog::backdrop {
|
|
17717
|
-
background: ${modalBackdropColorThemeColor};
|
|
17718
|
-
}
|
|
17719
|
-
`));
|
|
17720
17318
|
|
|
17721
|
-
|
|
17722
|
-
|
|
17723
|
-
<dialog
|
|
17724
|
-
${ref('dialogElement')}
|
|
17725
|
-
role="alertdialog"
|
|
17726
|
-
aria-label="${x => x.ariaLabel}"
|
|
17727
|
-
@cancel="${(x, c) => x.cancelHandler(c.event)}"
|
|
17728
|
-
>
|
|
17729
|
-
<slot></slot>
|
|
17730
|
-
</dialog>
|
|
17731
|
-
</template>
|
|
17732
|
-
`;
|
|
17733
|
-
|
|
17734
|
-
/**
|
|
17735
|
-
* Symbol that is returned as the dialog close reason (from the Promise returned by show()) when
|
|
17736
|
-
* the dialog was closed by pressing the ESC key (vs. calling the close() function).
|
|
17737
|
-
*/
|
|
17738
|
-
const USER_DISMISSED = Symbol('user dismissed');
|
|
17739
|
-
/**
|
|
17740
|
-
* A nimble-styled dialog.
|
|
17741
|
-
*/
|
|
17742
|
-
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
17743
|
-
class Dialog extends FoundationElement {
|
|
17744
|
-
constructor() {
|
|
17745
|
-
super(...arguments);
|
|
17746
|
-
/**
|
|
17747
|
-
* @public
|
|
17748
|
-
* @description
|
|
17749
|
-
* Prevents dismissing the dialog via the Escape key
|
|
17750
|
-
*/
|
|
17751
|
-
this.preventDismiss = false;
|
|
17752
|
-
}
|
|
17753
|
-
/**
|
|
17754
|
-
* True if the dialog is open/showing, false otherwise
|
|
17755
|
-
*/
|
|
17756
|
-
get open() {
|
|
17757
|
-
return this.resolveShow !== undefined;
|
|
17758
|
-
}
|
|
17759
|
-
/**
|
|
17760
|
-
* Opens the dialog
|
|
17761
|
-
* @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 USER_DISMISSED if the dialog was closed via the ESC key.
|
|
17762
|
-
*/
|
|
17763
|
-
async show() {
|
|
17764
|
-
if (this.open) {
|
|
17765
|
-
throw new Error('Dialog is already open');
|
|
17766
|
-
}
|
|
17767
|
-
this.dialogElement.showModal();
|
|
17768
|
-
return new Promise((resolve, _reject) => {
|
|
17769
|
-
this.resolveShow = resolve;
|
|
17770
|
-
});
|
|
17771
|
-
}
|
|
17772
|
-
/**
|
|
17773
|
-
* Closes the dialog
|
|
17774
|
-
* @param reason An optional value indicating how/why the dialog was closed.
|
|
17775
|
-
*/
|
|
17776
|
-
close(reason) {
|
|
17777
|
-
if (!this.open) {
|
|
17778
|
-
throw new Error('Dialog is not open');
|
|
17779
|
-
}
|
|
17780
|
-
this.dialogElement.close();
|
|
17781
|
-
this.resolveShow(reason);
|
|
17782
|
-
this.resolveShow = undefined;
|
|
17783
|
-
}
|
|
17784
|
-
/**
|
|
17785
|
-
* @internal
|
|
17786
|
-
*/
|
|
17787
|
-
cancelHandler(event) {
|
|
17788
|
-
if (this.preventDismiss) {
|
|
17789
|
-
event.preventDefault();
|
|
17790
|
-
}
|
|
17791
|
-
else {
|
|
17792
|
-
this.resolveShow(USER_DISMISSED);
|
|
17793
|
-
this.resolveShow = undefined;
|
|
17794
|
-
}
|
|
17795
|
-
return true;
|
|
17796
|
-
}
|
|
17319
|
+
dialog[open] {
|
|
17320
|
+
display: flex;
|
|
17797
17321
|
}
|
|
17798
|
-
// We want the member to match the name of the constant
|
|
17799
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
17800
|
-
Dialog.USER_DISMISSED = USER_DISMISSED;
|
|
17801
|
-
__decorate([
|
|
17802
|
-
attr({ attribute: 'prevent-dismiss', mode: 'boolean' })
|
|
17803
|
-
], Dialog.prototype, "preventDismiss", void 0);
|
|
17804
|
-
applyMixins(Dialog, ARIAGlobalStatesAndProperties);
|
|
17805
|
-
const nimbleDialog = Dialog.compose({
|
|
17806
|
-
baseName: 'dialog',
|
|
17807
|
-
template: template$4,
|
|
17808
|
-
styles: styles$k,
|
|
17809
|
-
baseClass: Dialog
|
|
17810
|
-
});
|
|
17811
|
-
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleDialog());
|
|
17812
17322
|
|
|
17813
|
-
|
|
17323
|
+
header {
|
|
17324
|
+
min-height: 48px;
|
|
17325
|
+
padding: 24px 24px 0px 24px;
|
|
17326
|
+
flex: none;
|
|
17327
|
+
display: flex;
|
|
17328
|
+
flex-direction: column;
|
|
17329
|
+
gap: ${smallPadding};
|
|
17330
|
+
}
|
|
17814
17331
|
|
|
17815
|
-
|
|
17332
|
+
:host([header-hidden]) header {
|
|
17333
|
+
${
|
|
17334
|
+
/**
|
|
17335
|
+
* Hide content visually while keeping it screen reader-accessible.
|
|
17336
|
+
* Source: https://webaim.org/techniques/css/invisiblecontent/#techniques
|
|
17337
|
+
* See discussion here: https://github.com/microsoft/fast/issues/5740#issuecomment-1068195035
|
|
17338
|
+
*/
|
|
17339
|
+
''}
|
|
17340
|
+
display: inline-block;
|
|
17341
|
+
height: 1px;
|
|
17342
|
+
width: 1px;
|
|
17343
|
+
position: absolute;
|
|
17344
|
+
margin: -1px;
|
|
17345
|
+
clip: rect(1px, 1px, 1px, 1px);
|
|
17346
|
+
clip-path: inset(50%);
|
|
17347
|
+
overflow: hidden;
|
|
17348
|
+
padding: 0;
|
|
17349
|
+
}
|
|
17816
17350
|
|
|
17817
|
-
|
|
17351
|
+
.title {
|
|
17352
|
+
font: ${titlePlus1Font};
|
|
17353
|
+
color: ${titlePlus1FontColor};
|
|
17354
|
+
overflow: hidden;
|
|
17355
|
+
text-overflow: ellipsis;
|
|
17356
|
+
white-space: nowrap;
|
|
17357
|
+
}
|
|
17818
17358
|
|
|
17819
|
-
|
|
17359
|
+
.subtitle {
|
|
17360
|
+
font: ${subtitleFont};
|
|
17361
|
+
color: ${subtitleFontColor};
|
|
17362
|
+
}
|
|
17820
17363
|
|
|
17821
|
-
|
|
17822
|
-
|
|
17823
|
-
|
|
17824
|
-
|
|
17825
|
-
|
|
17826
|
-
|
|
17827
|
-
|
|
17828
|
-
|
|
17829
|
-
var AnimationMode;
|
|
17830
|
-
(function (AnimationMode) {
|
|
17831
|
-
AnimationMode[AnimationMode["animateTo"] = 0] = "animateTo";
|
|
17832
|
-
AnimationMode[AnimationMode["animateFrom"] = 1] = "animateFrom";
|
|
17833
|
-
})(AnimationMode = exports.AnimationMode || (exports.AnimationMode = {}));
|
|
17834
|
-
/**
|
|
17835
|
-
* Base animate type. This is extended by {@link @microsoft/fast-animation#AnimateTo} and {@link @microsoft/fast-animation#AnimateFrom}.
|
|
17836
|
-
*
|
|
17837
|
-
* @public
|
|
17838
|
-
*/
|
|
17839
|
-
var Animate = /** @class */ (function () {
|
|
17840
|
-
function Animate(element, options, effectTiming) {
|
|
17841
|
-
var _this = this;
|
|
17842
|
-
/**
|
|
17843
|
-
* Stores animation timing functions
|
|
17844
|
-
*/
|
|
17845
|
-
this.effectTiming = {
|
|
17846
|
-
fill: "forwards",
|
|
17847
|
-
iterations: 1,
|
|
17848
|
-
duration: 500,
|
|
17849
|
-
};
|
|
17850
|
-
/**
|
|
17851
|
-
* Stores animation keyframe sets and is accessed by a getter
|
|
17852
|
-
*/
|
|
17853
|
-
this._keyframes = [];
|
|
17854
|
-
/**
|
|
17855
|
-
* plays the animation
|
|
17856
|
-
*/
|
|
17857
|
-
this.play = function () {
|
|
17858
|
-
_this.ensureAnimationObjectExists();
|
|
17859
|
-
_this.animation.play();
|
|
17860
|
-
};
|
|
17861
|
-
/**
|
|
17862
|
-
* pauses the animation
|
|
17863
|
-
*/
|
|
17864
|
-
this.pause = function () {
|
|
17865
|
-
_this.ensureAnimationObjectExists();
|
|
17866
|
-
_this.animation.pause();
|
|
17867
|
-
};
|
|
17868
|
-
/**
|
|
17869
|
-
* finishes the animation
|
|
17870
|
-
*/
|
|
17871
|
-
this.finish = function () {
|
|
17872
|
-
_this.ensureAnimationObjectExists();
|
|
17873
|
-
_this.animation.finish();
|
|
17874
|
-
};
|
|
17875
|
-
/**
|
|
17876
|
-
* cancels the animation
|
|
17877
|
-
*/
|
|
17878
|
-
this.cancel = function () {
|
|
17879
|
-
_this.ensureAnimationObjectExists();
|
|
17880
|
-
_this.animation.cancel();
|
|
17881
|
-
};
|
|
17882
|
-
/**
|
|
17883
|
-
* reverses an animation
|
|
17884
|
-
*/
|
|
17885
|
-
this.reverse = function () {
|
|
17886
|
-
_this.ensureAnimationObjectExists();
|
|
17887
|
-
_this.animation.reverse();
|
|
17888
|
-
};
|
|
17889
|
-
/**
|
|
17890
|
-
* adds a set of keyframes to set of animation keyframes the animation should execute
|
|
17891
|
-
*/
|
|
17892
|
-
this.addKeyframes = function (keyframes) {
|
|
17893
|
-
_this._keyframes.push(keyframes);
|
|
17894
|
-
};
|
|
17895
|
-
this.animationTarget = element;
|
|
17896
|
-
if (effectTiming) {
|
|
17897
|
-
this.effectTiming = Object.assign({}, this.effectTiming, effectTiming);
|
|
17898
|
-
}
|
|
17899
|
-
if (options) {
|
|
17900
|
-
if (options.transformOrigin) {
|
|
17901
|
-
element.style.transformOrigin = options.transformOrigin;
|
|
17902
|
-
}
|
|
17903
|
-
if (options.transformStyle) {
|
|
17904
|
-
element.style.transformStyle = options.transformStyle;
|
|
17905
|
-
}
|
|
17906
|
-
}
|
|
17907
|
-
this.options = options || {};
|
|
17908
|
-
}
|
|
17909
|
-
Object.defineProperty(Animate.prototype, "onFinish", {
|
|
17910
|
-
get: function () {
|
|
17911
|
-
return this._onFinish;
|
|
17912
|
-
},
|
|
17913
|
-
set: function (callback) {
|
|
17914
|
-
this._onFinish = callback;
|
|
17915
|
-
if (this.animation) {
|
|
17916
|
-
this.animation.onfinish = callback;
|
|
17917
|
-
}
|
|
17918
|
-
},
|
|
17919
|
-
enumerable: false,
|
|
17920
|
-
configurable: true
|
|
17921
|
-
});
|
|
17922
|
-
/**
|
|
17923
|
-
* Ensure animation object
|
|
17924
|
-
*/
|
|
17925
|
-
Animate.prototype.ensureAnimationObjectExists = function () {
|
|
17926
|
-
if (typeof this.animation === "undefined") {
|
|
17927
|
-
this.createAnimationObject();
|
|
17928
|
-
}
|
|
17929
|
-
};
|
|
17930
|
-
/**
|
|
17931
|
-
* Creates the animation object
|
|
17932
|
-
*/
|
|
17933
|
-
Animate.prototype.createAnimationObject = function () {
|
|
17934
|
-
this.animation = new Animation(this.keyframeEffect, document.timeline);
|
|
17935
|
-
if (typeof this.onFinish !== "undefined") {
|
|
17936
|
-
this.animation.onfinish = this.onFinish;
|
|
17937
|
-
}
|
|
17938
|
-
if (typeof this.onCancel !== "undefined") {
|
|
17939
|
-
this.animation.oncancel = this.onCancel;
|
|
17940
|
-
}
|
|
17941
|
-
};
|
|
17942
|
-
/**
|
|
17943
|
-
* Returns a list of properties that will be animated based options
|
|
17944
|
-
*/
|
|
17945
|
-
Animate.prototype.getPropertiesToAnimate = function () {
|
|
17946
|
-
var _this = this;
|
|
17947
|
-
return Object.keys(Animate.propertyMap).filter(function (property) {
|
|
17948
|
-
// Filter out all properties that don't need to be set based on our options
|
|
17949
|
-
return Animate.propertyMap[property].reduce(function (hasProperty, animationProp) {
|
|
17950
|
-
return (typeof _this.options[animationProp] !== "undefined" || hasProperty);
|
|
17951
|
-
}, false);
|
|
17952
|
-
});
|
|
17953
|
-
};
|
|
17954
|
-
/**
|
|
17955
|
-
* Current implmentations of web animations seem to have trouble animating both scale and opacity
|
|
17956
|
-
* from a starting value of 0. This method detects when those values are 0 and alters them slightly
|
|
17957
|
-
* to known-working starting values
|
|
17958
|
-
*/
|
|
17959
|
-
Animate.prototype.normalizeInitialValue = function (property, value) {
|
|
17960
|
-
if (value === undefined) {
|
|
17961
|
-
return;
|
|
17962
|
-
}
|
|
17963
|
-
var coercedReturn = "0.01";
|
|
17964
|
-
switch (property) {
|
|
17965
|
-
case "transform":
|
|
17966
|
-
/* eslint-disable */
|
|
17967
|
-
var matrixValuesRegex = /matrix\((.+)\)/;
|
|
17968
|
-
var matrixValues = value.match(matrixValuesRegex);
|
|
17969
|
-
/* eslint-enable */
|
|
17970
|
-
if (Array.isArray(matrixValues)) {
|
|
17971
|
-
var normalizedValues = matrixValues[1]
|
|
17972
|
-
.split(",")
|
|
17973
|
-
.map(function (matchedValue, index) {
|
|
17974
|
-
var parsedValueIsZero = parseFloat(value) === 0;
|
|
17975
|
-
if (!parsedValueIsZero) {
|
|
17976
|
-
return matchedValue;
|
|
17977
|
-
}
|
|
17978
|
-
// If this is the scaleX index or the scaleY index, return the coerced value
|
|
17979
|
-
return index === 0 || index === 3
|
|
17980
|
-
? coercedReturn
|
|
17981
|
-
: matchedValue;
|
|
17982
|
-
});
|
|
17983
|
-
return "matrix(".concat(normalizedValues.join(","), ")");
|
|
17984
|
-
}
|
|
17985
|
-
break;
|
|
17986
|
-
case "opacity":
|
|
17987
|
-
return parseFloat(value) === 0 ? coercedReturn : value;
|
|
17988
|
-
}
|
|
17989
|
-
return value;
|
|
17990
|
-
};
|
|
17991
|
-
/**
|
|
17992
|
-
* Returns the initial values for all properties being animated
|
|
17993
|
-
*/
|
|
17994
|
-
Animate.prototype.getInitialKeyframeValues = function () {
|
|
17995
|
-
var _this = this;
|
|
17996
|
-
if (!(this.animationTarget instanceof HTMLElement) ||
|
|
17997
|
-
typeof window === "undefined") {
|
|
17998
|
-
return {};
|
|
17999
|
-
}
|
|
18000
|
-
var animatedProperties = this.getPropertiesToAnimate();
|
|
18001
|
-
var computedStyle = window.getComputedStyle(this.animationTarget);
|
|
18002
|
-
var initialKeyframeValues = {};
|
|
18003
|
-
animatedProperties.forEach(function (property) {
|
|
18004
|
-
initialKeyframeValues[property] = _this.normalizeInitialValue(property, computedStyle[property]);
|
|
18005
|
-
});
|
|
18006
|
-
return initialKeyframeValues;
|
|
18007
|
-
};
|
|
18008
|
-
/**
|
|
18009
|
-
* Formats a config option into a transform function
|
|
18010
|
-
*/
|
|
18011
|
-
Animate.prototype.formatTransformFunction = function (functionType, value) {
|
|
18012
|
-
// If `functionType` can't be converted into a transform function, just return empty string
|
|
18013
|
-
if (Animate.propertyMap.transform.indexOf(functionType) === -1) {
|
|
18014
|
-
return "";
|
|
18015
|
-
}
|
|
18016
|
-
switch (functionType) {
|
|
18017
|
-
case "x":
|
|
18018
|
-
case "y":
|
|
18019
|
-
functionType = "translate".concat(functionType.toUpperCase());
|
|
18020
|
-
value =
|
|
18021
|
-
typeof value === "number" ? (value = this.pixelify(value)) : value;
|
|
18022
|
-
break;
|
|
18023
|
-
case "rotate":
|
|
18024
|
-
value = "".concat(value.toString(), "deg");
|
|
18025
|
-
break;
|
|
18026
|
-
case "scale":
|
|
18027
|
-
if (value === 0) {
|
|
18028
|
-
// There is a strange bug where you can't animate from a scale 0
|
|
18029
|
-
value = 0.01;
|
|
18030
|
-
}
|
|
18031
|
-
}
|
|
18032
|
-
if (typeof value !== "string") {
|
|
18033
|
-
value = value.toString();
|
|
18034
|
-
}
|
|
18035
|
-
return "".concat(functionType, "(").concat(value, ")");
|
|
18036
|
-
};
|
|
18037
|
-
/**
|
|
18038
|
-
* Converts a number to a pixel string
|
|
18039
|
-
*/
|
|
18040
|
-
Animate.prototype.pixelify = function (num) {
|
|
18041
|
-
return "".concat(num, "px");
|
|
18042
|
-
};
|
|
18043
|
-
/**
|
|
18044
|
-
* Returns keyframe values based on option configuration
|
|
18045
|
-
*/
|
|
18046
|
-
Animate.prototype.getOptionKeyframeValues = function () {
|
|
18047
|
-
var _this = this;
|
|
18048
|
-
var animateProperties = this.getPropertiesToAnimate();
|
|
18049
|
-
var keyframeValues = {};
|
|
18050
|
-
animateProperties.forEach(function (property) {
|
|
18051
|
-
keyframeValues[property] = Animate.propertyMap[property]
|
|
18052
|
-
.map(function (option) {
|
|
18053
|
-
var value = _this.options[option];
|
|
18054
|
-
if (typeof value === "undefined") {
|
|
18055
|
-
return null;
|
|
18056
|
-
}
|
|
18057
|
-
switch (option) {
|
|
18058
|
-
case "opacity":
|
|
18059
|
-
return value.toString();
|
|
18060
|
-
case "top":
|
|
18061
|
-
case "right":
|
|
18062
|
-
case "bottom":
|
|
18063
|
-
case "left":
|
|
18064
|
-
return typeof value === "number"
|
|
18065
|
-
? _this.pixelify(value)
|
|
18066
|
-
: value;
|
|
18067
|
-
default:
|
|
18068
|
-
return _this.formatTransformFunction(option, value);
|
|
18069
|
-
}
|
|
18070
|
-
})
|
|
18071
|
-
.filter(function (option) { return Boolean(option); })
|
|
18072
|
-
.join(" ");
|
|
18073
|
-
});
|
|
18074
|
-
return keyframeValues;
|
|
18075
|
-
};
|
|
18076
|
-
/**
|
|
18077
|
-
* Gets all keyframes configured by options
|
|
18078
|
-
*/
|
|
18079
|
-
Animate.prototype.getOptionKeyframes = function () {
|
|
18080
|
-
var keyframes = [
|
|
18081
|
-
this.getInitialKeyframeValues(),
|
|
18082
|
-
this.getOptionKeyframeValues(),
|
|
18083
|
-
];
|
|
18084
|
-
return this.mode === AnimationMode.animateFrom ? keyframes.reverse() : keyframes;
|
|
18085
|
-
};
|
|
18086
|
-
/**
|
|
18087
|
-
* Sorts an array of offset keys in ascending order
|
|
18088
|
-
*/
|
|
18089
|
-
Animate.prototype.sortOffsets = function (offsets) {
|
|
18090
|
-
return offsets.sort(function (a, b) {
|
|
18091
|
-
var A = parseFloat(a);
|
|
18092
|
-
var B = parseFloat(b);
|
|
18093
|
-
if (A < B) {
|
|
18094
|
-
return -1;
|
|
18095
|
-
}
|
|
18096
|
-
else if (A > B) {
|
|
18097
|
-
return 1;
|
|
18098
|
-
}
|
|
18099
|
-
else {
|
|
18100
|
-
return 0;
|
|
18101
|
-
}
|
|
18102
|
-
});
|
|
18103
|
-
};
|
|
18104
|
-
/**
|
|
18105
|
-
* Consolidates all keyframe arrays into a single keyframe array
|
|
18106
|
-
*/
|
|
18107
|
-
Animate.prototype.consolidateKeyframes = function (keyframeSets) {
|
|
18108
|
-
var frames = [];
|
|
18109
|
-
// Merge all keyframes into a single frames object where each key is a keyframe offset
|
|
18110
|
-
keyframeSets.forEach(function (keyframeSet) {
|
|
18111
|
-
keyframeSet.forEach(function (keyframe, index) {
|
|
18112
|
-
var offset = keyframe.offset;
|
|
18113
|
-
if (typeof offset === "undefined") {
|
|
18114
|
-
offset = index === 0 ? 0 : 1;
|
|
18115
|
-
keyframe.offset = offset;
|
|
18116
|
-
}
|
|
18117
|
-
var offsetKey = offset.toString();
|
|
18118
|
-
frames[offsetKey] =
|
|
18119
|
-
typeof frames[offsetKey] === "undefined"
|
|
18120
|
-
? keyframe
|
|
18121
|
-
: Object.assign(frames[offsetKey], keyframe);
|
|
18122
|
-
});
|
|
18123
|
-
});
|
|
18124
|
-
return this.sortOffsets(Object.keys(frames)).map(function (offset) {
|
|
18125
|
-
return frames[offset];
|
|
18126
|
-
});
|
|
18127
|
-
};
|
|
18128
|
-
Object.defineProperty(Animate.prototype, "keyframes", {
|
|
18129
|
-
/**
|
|
18130
|
-
* Returns the animation's keyframes
|
|
18131
|
-
*/
|
|
18132
|
-
get: function () {
|
|
18133
|
-
return this.consolidateKeyframes(this._keyframes.concat([this.getOptionKeyframes()]));
|
|
18134
|
-
},
|
|
18135
|
-
enumerable: false,
|
|
18136
|
-
configurable: true
|
|
18137
|
-
});
|
|
18138
|
-
Object.defineProperty(Animate.prototype, "keyframeEffect", {
|
|
18139
|
-
/**
|
|
18140
|
-
* Returns the key frame effect object
|
|
18141
|
-
*/
|
|
18142
|
-
get: function () {
|
|
18143
|
-
return new KeyframeEffect(this.animationTarget, this.keyframes, this.effectTiming);
|
|
18144
|
-
},
|
|
18145
|
-
enumerable: false,
|
|
18146
|
-
configurable: true
|
|
18147
|
-
});
|
|
18148
|
-
/**
|
|
18149
|
-
* A mapping between animation options and the css property names they apply to
|
|
18150
|
-
*/
|
|
18151
|
-
Animate.propertyMap = {
|
|
18152
|
-
opacity: ["opacity"],
|
|
18153
|
-
transform: ["x", "y", "rotate", "scale"],
|
|
18154
|
-
top: ["top"],
|
|
18155
|
-
left: ["left"],
|
|
18156
|
-
bottom: ["bottom"],
|
|
18157
|
-
right: ["right"],
|
|
18158
|
-
};
|
|
18159
|
-
return Animate;
|
|
18160
|
-
}());
|
|
18161
|
-
exports.default = Animate;
|
|
18162
|
-
}(animate));
|
|
18163
|
-
|
|
18164
|
-
var __extends$4 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
18165
|
-
var extendStatics = function (d, b) {
|
|
18166
|
-
extendStatics = Object.setPrototypeOf ||
|
|
18167
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
18168
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
18169
|
-
return extendStatics(d, b);
|
|
18170
|
-
};
|
|
18171
|
-
return function (d, b) {
|
|
18172
|
-
if (typeof b !== "function" && b !== null)
|
|
18173
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
18174
|
-
extendStatics(d, b);
|
|
18175
|
-
function __() { this.constructor = d; }
|
|
18176
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
18177
|
-
};
|
|
18178
|
-
})();
|
|
18179
|
-
Object.defineProperty(animateTo, "__esModule", { value: true });
|
|
18180
|
-
var animate_1$1 = animate;
|
|
18181
|
-
/**
|
|
18182
|
-
* An animation to provided property values from the element's current values.
|
|
18183
|
-
* Extends {@link @microsoft/fast-animation#Animate}.
|
|
18184
|
-
* @public
|
|
18185
|
-
*/
|
|
18186
|
-
var AnimateTo = /** @class */ (function (_super) {
|
|
18187
|
-
__extends$4(AnimateTo, _super);
|
|
18188
|
-
function AnimateTo() {
|
|
18189
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
18190
|
-
_this.mode = animate_1$1.AnimationMode.animateTo;
|
|
18191
|
-
return _this;
|
|
18192
|
-
}
|
|
18193
|
-
return AnimateTo;
|
|
18194
|
-
}(animate_1$1.default));
|
|
18195
|
-
animateTo.default = AnimateTo;
|
|
18196
|
-
|
|
18197
|
-
var animateFrom = {};
|
|
18198
|
-
|
|
18199
|
-
var __extends$3 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
18200
|
-
var extendStatics = function (d, b) {
|
|
18201
|
-
extendStatics = Object.setPrototypeOf ||
|
|
18202
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
18203
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
18204
|
-
return extendStatics(d, b);
|
|
18205
|
-
};
|
|
18206
|
-
return function (d, b) {
|
|
18207
|
-
if (typeof b !== "function" && b !== null)
|
|
18208
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
18209
|
-
extendStatics(d, b);
|
|
18210
|
-
function __() { this.constructor = d; }
|
|
18211
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
18212
|
-
};
|
|
18213
|
-
})();
|
|
18214
|
-
Object.defineProperty(animateFrom, "__esModule", { value: true });
|
|
18215
|
-
var animate_1 = animate;
|
|
18216
|
-
/**
|
|
18217
|
-
* An animation from provided property values to the element's current values.
|
|
18218
|
-
* Extends {@link @microsoft/fast-animation#Animate}.
|
|
18219
|
-
*
|
|
18220
|
-
* @public
|
|
18221
|
-
*/
|
|
18222
|
-
var AnimateFrom = /** @class */ (function (_super) {
|
|
18223
|
-
__extends$3(AnimateFrom, _super);
|
|
18224
|
-
function AnimateFrom() {
|
|
18225
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
18226
|
-
_this.mode = animate_1.AnimationMode.animateFrom;
|
|
18227
|
-
return _this;
|
|
18228
|
-
}
|
|
18229
|
-
return AnimateFrom;
|
|
18230
|
-
}(animate_1.default));
|
|
18231
|
-
animateFrom.default = AnimateFrom;
|
|
17364
|
+
section {
|
|
17365
|
+
flex: auto;
|
|
17366
|
+
overflow-y: auto;
|
|
17367
|
+
font: ${bodyFont};
|
|
17368
|
+
color: ${bodyFontColor};
|
|
17369
|
+
display: flex;
|
|
17370
|
+
flex-direction: column;
|
|
17371
|
+
gap: ${standardPadding};
|
|
18232
17372
|
|
|
18233
|
-
|
|
17373
|
+
${
|
|
17374
|
+
/**
|
|
17375
|
+
* Use padding on all sides except the top because the padding is within
|
|
17376
|
+
* the scrollable area. The whole scrollable area, including the top of
|
|
17377
|
+
* the scrollbar, should be 24px away from the header, so use a margin
|
|
17378
|
+
* instead of padding for the top.
|
|
17379
|
+
*/
|
|
17380
|
+
''}
|
|
17381
|
+
padding: 0px 24px 24px 24px;
|
|
17382
|
+
margin-top: 24px;
|
|
17383
|
+
}
|
|
18234
17384
|
|
|
18235
|
-
|
|
17385
|
+
footer {
|
|
17386
|
+
border-top: 2px solid rgba(${actionRgbPartialColor}, 0.1);
|
|
17387
|
+
padding: 24px;
|
|
17388
|
+
flex: none;
|
|
17389
|
+
display: flex;
|
|
17390
|
+
justify-content: flex-end;
|
|
17391
|
+
gap: ${standardPadding};
|
|
17392
|
+
}
|
|
18236
17393
|
|
|
18237
|
-
|
|
18238
|
-
|
|
18239
|
-
|
|
18240
|
-
|
|
18241
|
-
*/
|
|
18242
|
-
function invokeFunctionForEach(arr, name) {
|
|
18243
|
-
arr.forEach(function (arrItem) { return arrItem[name](); });
|
|
17394
|
+
footer.empty {
|
|
17395
|
+
padding: 0px;
|
|
17396
|
+
height: 72px;
|
|
17397
|
+
border-top: none;
|
|
18244
17398
|
}
|
|
18245
|
-
invokeFunctionForEach$1.invokeFunctionForEach = invokeFunctionForEach;
|
|
18246
17399
|
|
|
18247
|
-
|
|
18248
|
-
|
|
18249
|
-
|
|
18250
|
-
|
|
18251
|
-
|
|
17400
|
+
:host([footer-hidden]) footer {
|
|
17401
|
+
display: none;
|
|
17402
|
+
}
|
|
17403
|
+
`.withBehaviors(
|
|
17404
|
+
/*
|
|
17405
|
+
* We cannot use the modalBackdropColor token directly because the backdrop
|
|
17406
|
+
* element is not a descendant of the nimble-theme-provider element.
|
|
18252
17407
|
*/
|
|
18253
|
-
|
|
18254
|
-
|
|
18255
|
-
|
|
18256
|
-
|
|
18257
|
-
|
|
18258
|
-
|
|
18259
|
-
|
|
18260
|
-
|
|
18261
|
-
|
|
18262
|
-
|
|
18263
|
-
|
|
18264
|
-
|
|
18265
|
-
|
|
18266
|
-
(0, invokeFunctionForEach_1$1.invokeFunctionForEach)(_this.animations, "finish");
|
|
18267
|
-
};
|
|
18268
|
-
/**
|
|
18269
|
-
* Cancels all animations in the group
|
|
18270
|
-
*/
|
|
18271
|
-
this.cancel = function () {
|
|
18272
|
-
(0, invokeFunctionForEach_1$1.invokeFunctionForEach)(_this.animations, "cancel");
|
|
18273
|
-
};
|
|
18274
|
-
this.animations = animations;
|
|
18275
|
-
}
|
|
18276
|
-
Object.defineProperty(AnimateGroup.prototype, "onFinish", {
|
|
18277
|
-
/**
|
|
18278
|
-
* The onFinish callback.
|
|
18279
|
-
*/
|
|
18280
|
-
get: function () {
|
|
18281
|
-
return this._onFinish;
|
|
18282
|
-
},
|
|
18283
|
-
set: function (callback) {
|
|
18284
|
-
var _this = this;
|
|
18285
|
-
this._onFinish = callback;
|
|
18286
|
-
var longestRunning = this.getLongestAnimation();
|
|
18287
|
-
if (typeof longestRunning.onFinish === "function") {
|
|
18288
|
-
var fn_1 = longestRunning.onFinish;
|
|
18289
|
-
longestRunning.onFinish = function () {
|
|
18290
|
-
fn_1();
|
|
18291
|
-
_this._onFinish();
|
|
18292
|
-
};
|
|
18293
|
-
}
|
|
18294
|
-
else {
|
|
18295
|
-
longestRunning.onFinish = this._onFinish;
|
|
18296
|
-
}
|
|
18297
|
-
},
|
|
18298
|
-
enumerable: false,
|
|
18299
|
-
configurable: true
|
|
18300
|
-
});
|
|
18301
|
-
/**
|
|
18302
|
-
* Play the group of animations
|
|
18303
|
-
*/
|
|
18304
|
-
AnimateGroup.prototype.play = function () {
|
|
18305
|
-
(0, invokeFunctionForEach_1$1.invokeFunctionForEach)(this.animations, "play");
|
|
18306
|
-
};
|
|
18307
|
-
/**
|
|
18308
|
-
* Reverses all animations in the group
|
|
18309
|
-
*/
|
|
18310
|
-
AnimateGroup.prototype.reverse = function () {
|
|
18311
|
-
(0, invokeFunctionForEach_1$1.invokeFunctionForEach)(this.animations, "reverse");
|
|
18312
|
-
};
|
|
18313
|
-
/**
|
|
18314
|
-
* Returns the longest running animation in the group
|
|
18315
|
-
*/
|
|
18316
|
-
AnimateGroup.prototype.getLongestAnimation = function () {
|
|
18317
|
-
var _this = this;
|
|
18318
|
-
return this.animations.reduce(function (previousValue, currentValue) {
|
|
18319
|
-
var previousDuration = _this.getAnimationDuration(previousValue.effectTiming);
|
|
18320
|
-
var currentDuration = _this.getAnimationDuration(currentValue.effectTiming);
|
|
18321
|
-
// If two durations in the group are equal, consider the higher index the
|
|
18322
|
-
// longest animation - this helps ensure the group onFinish callback
|
|
18323
|
-
// is fired after all individual animation onFinish callbacks have fired.
|
|
18324
|
-
return currentDuration >= previousDuration ? currentValue : previousValue;
|
|
18325
|
-
});
|
|
18326
|
-
};
|
|
18327
|
-
/**
|
|
18328
|
-
* Returns the cumulative time it will take to complete an animation
|
|
18329
|
-
*/
|
|
18330
|
-
AnimateGroup.prototype.getAnimationDuration = function (effectTiming) {
|
|
18331
|
-
var duration = effectTiming.duration;
|
|
18332
|
-
var sanitizedDuration = typeof duration === "string" ? parseFloat(duration) : duration;
|
|
18333
|
-
return (effectTiming.delay || 0) + (sanitizedDuration || 0);
|
|
18334
|
-
};
|
|
18335
|
-
return AnimateGroup;
|
|
18336
|
-
}());
|
|
18337
|
-
animateGroup.default = AnimateGroup;
|
|
17408
|
+
themeBehavior(Theme.light, css `
|
|
17409
|
+
dialog::backdrop {
|
|
17410
|
+
background: ${modalBackdropColorThemeLightStatic};
|
|
17411
|
+
}
|
|
17412
|
+
`), themeBehavior(Theme.dark, css `
|
|
17413
|
+
dialog::backdrop {
|
|
17414
|
+
background: ${modalBackdropColorThemeDarkStatic};
|
|
17415
|
+
}
|
|
17416
|
+
`), themeBehavior(Theme.color, css `
|
|
17417
|
+
dialog::backdrop {
|
|
17418
|
+
background: ${modalBackdropColorThemeColorStatic};
|
|
17419
|
+
}
|
|
17420
|
+
`));
|
|
18338
17421
|
|
|
18339
|
-
|
|
17422
|
+
const template$5 = html `
|
|
17423
|
+
<template>
|
|
17424
|
+
<dialog
|
|
17425
|
+
${ref('dialogElement')}
|
|
17426
|
+
role="dialog"
|
|
17427
|
+
@cancel="${(x, c) => x.cancelHandler(c.event)}"
|
|
17428
|
+
aria-labelledby="header"
|
|
17429
|
+
>
|
|
17430
|
+
<header id="header">
|
|
17431
|
+
<div class="title">
|
|
17432
|
+
<slot name="title"></slot>
|
|
17433
|
+
</div>
|
|
17434
|
+
<div class="subtitle">
|
|
17435
|
+
<slot name="subtitle"></slot>
|
|
17436
|
+
</div>
|
|
17437
|
+
</header>
|
|
17438
|
+
<section>
|
|
17439
|
+
<slot></slot>
|
|
17440
|
+
</section>
|
|
17441
|
+
<footer class="${x => (x.footerIsEmpty ? 'empty' : '')}">
|
|
17442
|
+
<slot
|
|
17443
|
+
name="footer"
|
|
17444
|
+
${slotted({ property: 'slottedFooterElements' })}
|
|
17445
|
+
></slot>
|
|
17446
|
+
</footer>
|
|
17447
|
+
</dialog>
|
|
17448
|
+
</template>
|
|
17449
|
+
`;
|
|
18340
17450
|
|
|
18341
|
-
Object.defineProperty(animateSequence, "__esModule", { value: true });
|
|
18342
|
-
var invokeFunctionForEach_1 = invokeFunctionForEach$1;
|
|
18343
17451
|
/**
|
|
18344
|
-
*
|
|
18345
|
-
* @public
|
|
17452
|
+
* A nimble-styled dialog.
|
|
18346
17453
|
*/
|
|
18347
|
-
|
|
18348
|
-
|
|
18349
|
-
|
|
18350
|
-
|
|
18351
|
-
* Play the sequence of animations
|
|
18352
|
-
*/
|
|
18353
|
-
this.play = function () {
|
|
18354
|
-
_this.applySequencedCallback(_this.animations, "play");
|
|
18355
|
-
};
|
|
18356
|
-
/**
|
|
18357
|
-
* Play the sequence in reverse
|
|
18358
|
-
*/
|
|
18359
|
-
this.reverse = function () {
|
|
18360
|
-
_this.applySequencedCallback(_this.animations.reverse(), "reverse");
|
|
18361
|
-
};
|
|
18362
|
-
/**
|
|
18363
|
-
* Pauses all animations in the sequence
|
|
18364
|
-
*/
|
|
18365
|
-
this.pause = function () {
|
|
18366
|
-
(0, invokeFunctionForEach_1.invokeFunctionForEach)(_this.animations, "pause");
|
|
18367
|
-
};
|
|
17454
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
17455
|
+
class Dialog extends FoundationElement {
|
|
17456
|
+
constructor() {
|
|
17457
|
+
super(...arguments);
|
|
18368
17458
|
/**
|
|
18369
|
-
*
|
|
17459
|
+
* @public
|
|
17460
|
+
* @description
|
|
17461
|
+
* Prevents dismissing the dialog via the Escape key
|
|
18370
17462
|
*/
|
|
18371
|
-
this.
|
|
18372
|
-
(0, invokeFunctionForEach_1.invokeFunctionForEach)(_this.animations, "finish");
|
|
18373
|
-
};
|
|
17463
|
+
this.preventDismiss = false;
|
|
18374
17464
|
/**
|
|
18375
|
-
*
|
|
17465
|
+
* @public
|
|
17466
|
+
* @description
|
|
17467
|
+
* Hides the header of the dialog.
|
|
18376
17468
|
*/
|
|
18377
|
-
this.
|
|
18378
|
-
(0, invokeFunctionForEach_1.invokeFunctionForEach)(_this.animations, "cancel");
|
|
18379
|
-
};
|
|
18380
|
-
this.animations = animations;
|
|
18381
|
-
}
|
|
18382
|
-
/**
|
|
18383
|
-
* Sequences a set of animations and calls the specified method
|
|
18384
|
-
*/
|
|
18385
|
-
AnimateSequence.prototype.applySequencedCallback = function (animations, method) {
|
|
18386
|
-
var _this = this;
|
|
18387
|
-
var animationCount = animations.length;
|
|
18388
|
-
if (animationCount <= 0) {
|
|
18389
|
-
return;
|
|
18390
|
-
}
|
|
18391
|
-
animations.forEach(function (animation, index) {
|
|
18392
|
-
// If this is not the last animation, format animation sequence chain
|
|
18393
|
-
if (index < animationCount - 1) {
|
|
18394
|
-
animation.onFinish = _this.animations[index + 1][method];
|
|
18395
|
-
}
|
|
18396
|
-
else {
|
|
18397
|
-
// Else attach onFinish or nullify any existing onFinish on the animation
|
|
18398
|
-
animation.onFinish = _this.onFinish || void 0;
|
|
18399
|
-
}
|
|
18400
|
-
});
|
|
18401
|
-
animations[0][method]();
|
|
18402
|
-
};
|
|
18403
|
-
return AnimateSequence;
|
|
18404
|
-
}());
|
|
18405
|
-
animateSequence.default = AnimateSequence;
|
|
18406
|
-
|
|
18407
|
-
var fade = {};
|
|
18408
|
-
|
|
18409
|
-
(function (exports) {
|
|
18410
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18411
|
-
exports.fadeOut = exports.fadeIn = exports.applyFade = exports.fadeEffectTiming = exports.fadeOutKeyframes = exports.fadeInKeyframes = void 0;
|
|
18412
|
-
var animateTo_1 = animateTo;
|
|
18413
|
-
/**
|
|
18414
|
-
* Key frame object for fade-in animations
|
|
18415
|
-
*/
|
|
18416
|
-
exports.fadeInKeyframes = [
|
|
18417
|
-
{ opacity: "0.01" },
|
|
18418
|
-
{ opacity: "1" },
|
|
18419
|
-
];
|
|
18420
|
-
/**
|
|
18421
|
-
* Key frame object for fade-out animations
|
|
18422
|
-
*/
|
|
18423
|
-
exports.fadeOutKeyframes = [
|
|
18424
|
-
{ opacity: "1" },
|
|
18425
|
-
{ opacity: "0" },
|
|
18426
|
-
];
|
|
18427
|
-
/**
|
|
18428
|
-
* EffectTiming defaults for fade animations
|
|
18429
|
-
*/
|
|
18430
|
-
exports.fadeEffectTiming = {
|
|
18431
|
-
easing: "linear",
|
|
18432
|
-
duration: 500,
|
|
18433
|
-
};
|
|
18434
|
-
function applyFade(element, keyframes, timing) {
|
|
18435
|
-
if (timing === void 0) { timing = {}; }
|
|
18436
|
-
var fadeAnimationTiming = Object.assign({}, exports.fadeEffectTiming, timing);
|
|
18437
|
-
var fadeAnimation = new animateTo_1.default(element, null, fadeAnimationTiming);
|
|
18438
|
-
fadeAnimation.addKeyframes(keyframes);
|
|
18439
|
-
return fadeAnimation;
|
|
18440
|
-
}
|
|
18441
|
-
exports.applyFade = applyFade;
|
|
18442
|
-
/**
|
|
18443
|
-
* Creates an animation to fade an element into view
|
|
18444
|
-
*
|
|
18445
|
-
* @public
|
|
18446
|
-
*/
|
|
18447
|
-
function fadeIn(element, effectTiming) {
|
|
18448
|
-
if (effectTiming === void 0) { effectTiming = {}; }
|
|
18449
|
-
return applyFade(element, exports.fadeInKeyframes, effectTiming);
|
|
18450
|
-
}
|
|
18451
|
-
exports.fadeIn = fadeIn;
|
|
18452
|
-
/**
|
|
18453
|
-
* Creates an animation to fade an element out of view
|
|
18454
|
-
*
|
|
18455
|
-
* @public
|
|
18456
|
-
*/
|
|
18457
|
-
function fadeOut(element, effectTiming) {
|
|
18458
|
-
if (effectTiming === void 0) { effectTiming = {}; }
|
|
18459
|
-
return applyFade(element, exports.fadeOutKeyframes, effectTiming);
|
|
18460
|
-
}
|
|
18461
|
-
exports.fadeOut = fadeOut;
|
|
18462
|
-
}(fade));
|
|
18463
|
-
|
|
18464
|
-
var curves = {};
|
|
18465
|
-
|
|
18466
|
-
var config = {};
|
|
18467
|
-
|
|
18468
|
-
Object.defineProperty(config, "__esModule", { value: true });
|
|
18469
|
-
config.navPane = config.exponentialReversed = config.fastInFortySevenPercent = config.exponential = config.fastInOut = config.fastOut = config.fastIn = config.appToApp = config.backToApp = config.drillIn = config.easeIn = config.easeOutSmooth = config.easeOut = config.linear = void 0;
|
|
18470
|
-
config.linear = [
|
|
18471
|
-
[0, 0],
|
|
18472
|
-
[1, 1],
|
|
18473
|
-
];
|
|
18474
|
-
config.easeOut = [
|
|
18475
|
-
[0, 0],
|
|
18476
|
-
[0.58, 1],
|
|
18477
|
-
];
|
|
18478
|
-
config.easeOutSmooth = [
|
|
18479
|
-
[0, 0.35],
|
|
18480
|
-
[0.15, 1],
|
|
18481
|
-
];
|
|
18482
|
-
config.easeIn = [
|
|
18483
|
-
[0.25, 0.1],
|
|
18484
|
-
[0.25, 1],
|
|
18485
|
-
];
|
|
18486
|
-
config.drillIn = [
|
|
18487
|
-
[0.17, 0.17],
|
|
18488
|
-
[0, 1],
|
|
18489
|
-
];
|
|
18490
|
-
config.backToApp = [
|
|
18491
|
-
[0.5, 0],
|
|
18492
|
-
[0.6, 1],
|
|
18493
|
-
];
|
|
18494
|
-
config.appToApp = [
|
|
18495
|
-
[0.5, 0],
|
|
18496
|
-
[1, 0.9],
|
|
18497
|
-
];
|
|
18498
|
-
config.fastIn = [
|
|
18499
|
-
[0.1, 0.9],
|
|
18500
|
-
[0.2, 1],
|
|
18501
|
-
];
|
|
18502
|
-
config.fastOut = [
|
|
18503
|
-
[0.9, 0.1],
|
|
18504
|
-
[1, 0.2],
|
|
18505
|
-
];
|
|
18506
|
-
config.fastInOut = [
|
|
18507
|
-
[0.8, 0],
|
|
18508
|
-
[0.2, 1],
|
|
18509
|
-
];
|
|
18510
|
-
config.exponential = [
|
|
18511
|
-
[0.1, 0.25],
|
|
18512
|
-
[0.75, 0.9],
|
|
18513
|
-
];
|
|
18514
|
-
config.fastInFortySevenPercent = [
|
|
18515
|
-
[0.11, 0.5],
|
|
18516
|
-
[0.24, 0.96],
|
|
18517
|
-
];
|
|
18518
|
-
config.exponentialReversed = [
|
|
18519
|
-
[0.25, 0.1],
|
|
18520
|
-
[0.9, 0.75],
|
|
18521
|
-
];
|
|
18522
|
-
config.navPane = [
|
|
18523
|
-
[0.1, 0.7],
|
|
18524
|
-
[0.1, 1],
|
|
18525
|
-
];
|
|
18526
|
-
|
|
18527
|
-
Object.defineProperty(curves, "__esModule", { value: true });
|
|
18528
|
-
curves.cubicBezier = curves.formatCubicBezier = void 0;
|
|
18529
|
-
var bezierCurves = config;
|
|
18530
|
-
/**
|
|
18531
|
-
* Formats a cubic bezier config into a cubic bezier string
|
|
18532
|
-
*
|
|
18533
|
-
* @public
|
|
18534
|
-
*/
|
|
18535
|
-
function formatCubicBezier(points) {
|
|
18536
|
-
if (!Array.isArray(points) ||
|
|
18537
|
-
!Array.isArray(points[0]) ||
|
|
18538
|
-
!Array.isArray(points[1])) {
|
|
18539
|
-
return "";
|
|
18540
|
-
}
|
|
18541
|
-
var p0 = points[0];
|
|
18542
|
-
var p1 = points[1];
|
|
18543
|
-
return "cubic-bezier(".concat(p0[0], ", ").concat(p0[1], ", ").concat(p1[0], ", ").concat(p1[1], ")");
|
|
18544
|
-
}
|
|
18545
|
-
curves.formatCubicBezier = formatCubicBezier;
|
|
18546
|
-
/**
|
|
18547
|
-
* Get a cubic bezier curve, formatted as a string, by name.
|
|
18548
|
-
* @param name - the name of the bezier curve to use.
|
|
18549
|
-
*
|
|
18550
|
-
* @public
|
|
18551
|
-
*/
|
|
18552
|
-
function cubicBezier(name) {
|
|
18553
|
-
return name in bezierCurves ? formatCubicBezier(bezierCurves[name]) : "";
|
|
18554
|
-
}
|
|
18555
|
-
curves.cubicBezier = cubicBezier;
|
|
18556
|
-
|
|
18557
|
-
var ScrollTrigger$2 = {};
|
|
18558
|
-
|
|
18559
|
-
var isElementInView$1 = {};
|
|
18560
|
-
|
|
18561
|
-
Object.defineProperty(isElementInView$1, "__esModule", { value: true });
|
|
18562
|
-
/**
|
|
18563
|
-
* Checks to see if any part of an element is within the viewport
|
|
18564
|
-
*/
|
|
18565
|
-
function isElementInView(el) {
|
|
18566
|
-
var rect = el.getBoundingClientRect();
|
|
18567
|
-
return (rect.bottom >= 0 &&
|
|
18568
|
-
rect.right >= 0 &&
|
|
18569
|
-
rect.top <= window.innerHeight &&
|
|
18570
|
-
rect.left <= window.innerWidth);
|
|
18571
|
-
}
|
|
18572
|
-
isElementInView$1.default = isElementInView;
|
|
18573
|
-
|
|
18574
|
-
var ScrollBase = {};
|
|
18575
|
-
|
|
18576
|
-
var scrollY$1 = {};
|
|
18577
|
-
|
|
18578
|
-
Object.defineProperty(scrollY$1, "__esModule", { value: true });
|
|
18579
|
-
/**
|
|
18580
|
-
* Gets the document's scrollY
|
|
18581
|
-
*/
|
|
18582
|
-
function scrollY() {
|
|
18583
|
-
if (typeof window === "undefined") {
|
|
18584
|
-
return NaN;
|
|
18585
|
-
}
|
|
18586
|
-
return typeof window.scrollY !== "undefined" ? window.scrollY : window.pageYOffset;
|
|
18587
|
-
}
|
|
18588
|
-
scrollY$1.default = scrollY;
|
|
18589
|
-
|
|
18590
|
-
Object.defineProperty(ScrollBase, "__esModule", { value: true });
|
|
18591
|
-
var isElementInView_1$3 = isElementInView$1;
|
|
18592
|
-
var scrollY_1 = scrollY$1;
|
|
18593
|
-
/**
|
|
18594
|
-
* Scroll trigger base-class that handles event binding and element/callback registration.
|
|
18595
|
-
*/
|
|
18596
|
-
var ScrollTrigger$1 = /** @class */ (function () {
|
|
18597
|
-
function ScrollTrigger() {
|
|
18598
|
-
var _this = this;
|
|
18599
|
-
this.subscriptions = [];
|
|
18600
|
-
this.scrollDistance = 0;
|
|
17469
|
+
this.headerHidden = false;
|
|
18601
17470
|
/**
|
|
18602
|
-
*
|
|
18603
|
-
|
|
18604
|
-
|
|
18605
|
-
|
|
18606
|
-
|
|
18607
|
-
|
|
18608
|
-
|
|
18609
|
-
};
|
|
18610
|
-
this.lastScrollY = (0, scrollY_1.default)();
|
|
18611
|
-
// We need to use .bind instead of lambda (fat-arrow) syntax here because
|
|
18612
|
-
// protected methods declared as lambda functions cannot be invoked by
|
|
18613
|
-
// extending classes via the `super` object
|
|
18614
|
-
this.update = this.update.bind(this);
|
|
17471
|
+
* @public
|
|
17472
|
+
* @description
|
|
17473
|
+
* Hides the footer of the dialog.
|
|
17474
|
+
*/
|
|
17475
|
+
this.footerHidden = false;
|
|
17476
|
+
/** @internal */
|
|
17477
|
+
this.footerIsEmpty = true;
|
|
18615
17478
|
}
|
|
18616
17479
|
/**
|
|
18617
|
-
*
|
|
18618
|
-
*/
|
|
18619
|
-
ScrollTrigger.prototype.subscribe = function (element, callback) {
|
|
18620
|
-
if (!(element instanceof HTMLElement) ||
|
|
18621
|
-
typeof callback !== "function" ||
|
|
18622
|
-
this.isSubscribed(element, callback)) {
|
|
18623
|
-
return;
|
|
18624
|
-
}
|
|
18625
|
-
if (this.subscriptions.length === 0) {
|
|
18626
|
-
window.addEventListener("scroll", this.requestFrame);
|
|
18627
|
-
}
|
|
18628
|
-
this.subscriptions.push({
|
|
18629
|
-
element: element,
|
|
18630
|
-
callback: callback,
|
|
18631
|
-
inView: (0, isElementInView_1$3.default)(element),
|
|
18632
|
-
});
|
|
18633
|
-
};
|
|
18634
|
-
/**
|
|
18635
|
-
* Unsubscribe an element and callback for scroll triggers
|
|
18636
|
-
*/
|
|
18637
|
-
ScrollTrigger.prototype.unsubscribe = function (element, callback) {
|
|
18638
|
-
this.subscriptions = this.subscriptions.filter(function (subscription) {
|
|
18639
|
-
return !(element === subscription.element && callback === subscription.callback);
|
|
18640
|
-
});
|
|
18641
|
-
if (this.subscriptions.length === 0) {
|
|
18642
|
-
window.removeEventListener("scroll", this.requestFrame);
|
|
18643
|
-
}
|
|
18644
|
-
};
|
|
18645
|
-
/**
|
|
18646
|
-
* Make any arbitrary updates to UI
|
|
18647
|
-
*/
|
|
18648
|
-
ScrollTrigger.prototype.update = function () {
|
|
18649
|
-
var yOffset = (0, scrollY_1.default)();
|
|
18650
|
-
this.scrollDistance = yOffset - this.lastScrollY;
|
|
18651
|
-
this.lastScrollY = yOffset;
|
|
18652
|
-
};
|
|
18653
|
-
/**
|
|
18654
|
-
* Checks to see if element/callback pairs have been registered so we don't duplicate registration.
|
|
17480
|
+
* True if the dialog is open/showing, false otherwise
|
|
18655
17481
|
*/
|
|
18656
|
-
|
|
18657
|
-
return
|
|
18658
|
-
return (element === subscription.element && callback === subscription.callback);
|
|
18659
|
-
}).length;
|
|
18660
|
-
};
|
|
18661
|
-
return ScrollTrigger;
|
|
18662
|
-
}());
|
|
18663
|
-
ScrollBase.default = ScrollTrigger$1;
|
|
18664
|
-
|
|
18665
|
-
var __extends$2 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
18666
|
-
var extendStatics = function (d, b) {
|
|
18667
|
-
extendStatics = Object.setPrototypeOf ||
|
|
18668
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
18669
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
18670
|
-
return extendStatics(d, b);
|
|
18671
|
-
};
|
|
18672
|
-
return function (d, b) {
|
|
18673
|
-
if (typeof b !== "function" && b !== null)
|
|
18674
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
18675
|
-
extendStatics(d, b);
|
|
18676
|
-
function __() { this.constructor = d; }
|
|
18677
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
18678
|
-
};
|
|
18679
|
-
})();
|
|
18680
|
-
Object.defineProperty(ScrollTrigger$2, "__esModule", { value: true });
|
|
18681
|
-
var isElementInView_1$2 = isElementInView$1;
|
|
18682
|
-
var ScrollBase_1$2 = ScrollBase;
|
|
18683
|
-
/**
|
|
18684
|
-
* Utility for registering element/callback pairs where the callback will be called on scroll while the element is in view.
|
|
18685
|
-
*
|
|
18686
|
-
* @public
|
|
18687
|
-
*/
|
|
18688
|
-
var ScrollTrigger = /** @class */ (function (_super) {
|
|
18689
|
-
__extends$2(ScrollTrigger, _super);
|
|
18690
|
-
function ScrollTrigger() {
|
|
18691
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
17482
|
+
get open() {
|
|
17483
|
+
return this.resolveShow !== undefined;
|
|
18692
17484
|
}
|
|
18693
17485
|
/**
|
|
18694
|
-
*
|
|
17486
|
+
* Opens the dialog
|
|
17487
|
+
* @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.
|
|
18695
17488
|
*/
|
|
18696
|
-
|
|
18697
|
-
|
|
18698
|
-
|
|
18699
|
-
|
|
18700
|
-
|
|
18701
|
-
|
|
18702
|
-
|
|
18703
|
-
}
|
|
18704
|
-
if (inView !== subscription.inView) {
|
|
18705
|
-
subscription.inView = inView;
|
|
18706
|
-
}
|
|
17489
|
+
async show() {
|
|
17490
|
+
if (this.open) {
|
|
17491
|
+
throw new Error('Dialog is already open');
|
|
17492
|
+
}
|
|
17493
|
+
this.dialogElement.showModal();
|
|
17494
|
+
return new Promise((resolve, _reject) => {
|
|
17495
|
+
this.resolveShow = resolve;
|
|
18707
17496
|
});
|
|
18708
|
-
};
|
|
18709
|
-
return ScrollTrigger;
|
|
18710
|
-
}(ScrollBase_1$2.default));
|
|
18711
|
-
ScrollTrigger$2.default = ScrollTrigger;
|
|
18712
|
-
|
|
18713
|
-
var ViewEnterTrigger$1 = {};
|
|
18714
|
-
|
|
18715
|
-
var __extends$1 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
18716
|
-
var extendStatics = function (d, b) {
|
|
18717
|
-
extendStatics = Object.setPrototypeOf ||
|
|
18718
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
18719
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
18720
|
-
return extendStatics(d, b);
|
|
18721
|
-
};
|
|
18722
|
-
return function (d, b) {
|
|
18723
|
-
if (typeof b !== "function" && b !== null)
|
|
18724
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
18725
|
-
extendStatics(d, b);
|
|
18726
|
-
function __() { this.constructor = d; }
|
|
18727
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
18728
|
-
};
|
|
18729
|
-
})();
|
|
18730
|
-
Object.defineProperty(ViewEnterTrigger$1, "__esModule", { value: true });
|
|
18731
|
-
var isElementInView_1$1 = isElementInView$1;
|
|
18732
|
-
var ScrollBase_1$1 = ScrollBase;
|
|
18733
|
-
/**
|
|
18734
|
-
* Utility for registering element/callback pairs where the callback will be called when the element enters the view-port
|
|
18735
|
-
*
|
|
18736
|
-
* @public
|
|
18737
|
-
*/
|
|
18738
|
-
var ViewEnterTrigger = /** @class */ (function (_super) {
|
|
18739
|
-
__extends$1(ViewEnterTrigger, _super);
|
|
18740
|
-
function ViewEnterTrigger() {
|
|
18741
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
18742
17497
|
}
|
|
18743
17498
|
/**
|
|
18744
|
-
*
|
|
17499
|
+
* Closes the dialog
|
|
17500
|
+
* @param reason An optional value indicating how/why the dialog was closed.
|
|
18745
17501
|
*/
|
|
18746
|
-
|
|
18747
|
-
|
|
18748
|
-
|
|
18749
|
-
|
|
18750
|
-
|
|
18751
|
-
|
|
18752
|
-
|
|
18753
|
-
|
|
18754
|
-
|
|
18755
|
-
|
|
18756
|
-
}
|
|
18757
|
-
if (inView !== subscription.inView) {
|
|
18758
|
-
subscription.inView = inView;
|
|
18759
|
-
}
|
|
18760
|
-
});
|
|
18761
|
-
};
|
|
18762
|
-
return ViewEnterTrigger;
|
|
18763
|
-
}(ScrollBase_1$1.default));
|
|
18764
|
-
ViewEnterTrigger$1.default = ViewEnterTrigger;
|
|
18765
|
-
|
|
18766
|
-
var ViewExitTrigger$1 = {};
|
|
18767
|
-
|
|
18768
|
-
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
18769
|
-
var extendStatics = function (d, b) {
|
|
18770
|
-
extendStatics = Object.setPrototypeOf ||
|
|
18771
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
18772
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
18773
|
-
return extendStatics(d, b);
|
|
18774
|
-
};
|
|
18775
|
-
return function (d, b) {
|
|
18776
|
-
if (typeof b !== "function" && b !== null)
|
|
18777
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
18778
|
-
extendStatics(d, b);
|
|
18779
|
-
function __() { this.constructor = d; }
|
|
18780
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
18781
|
-
};
|
|
18782
|
-
})();
|
|
18783
|
-
Object.defineProperty(ViewExitTrigger$1, "__esModule", { value: true });
|
|
18784
|
-
var isElementInView_1 = isElementInView$1;
|
|
18785
|
-
var ScrollBase_1 = ScrollBase;
|
|
18786
|
-
/**
|
|
18787
|
-
* Utility for registering element/callback pairs where the callback will be invoked when the element exits the view-port
|
|
18788
|
-
*
|
|
18789
|
-
* @public
|
|
18790
|
-
*/
|
|
18791
|
-
var ViewExitTrigger = /** @class */ (function (_super) {
|
|
18792
|
-
__extends(ViewExitTrigger, _super);
|
|
18793
|
-
function ViewExitTrigger() {
|
|
18794
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
17502
|
+
close(reason) {
|
|
17503
|
+
if (!this.open) {
|
|
17504
|
+
throw new Error('Dialog is not open');
|
|
17505
|
+
}
|
|
17506
|
+
this.dialogElement.close();
|
|
17507
|
+
this.resolveShow(reason);
|
|
17508
|
+
this.resolveShow = undefined;
|
|
17509
|
+
}
|
|
17510
|
+
slottedFooterElementsChanged(_prev, next) {
|
|
17511
|
+
this.footerIsEmpty = !next?.length;
|
|
18795
17512
|
}
|
|
18796
17513
|
/**
|
|
18797
|
-
*
|
|
17514
|
+
* @internal
|
|
18798
17515
|
*/
|
|
18799
|
-
|
|
18800
|
-
|
|
18801
|
-
|
|
18802
|
-
|
|
18803
|
-
|
|
18804
|
-
|
|
18805
|
-
|
|
18806
|
-
|
|
18807
|
-
|
|
18808
|
-
|
|
18809
|
-
|
|
18810
|
-
|
|
18811
|
-
|
|
18812
|
-
|
|
18813
|
-
|
|
18814
|
-
}
|
|
18815
|
-
|
|
18816
|
-
|
|
18817
|
-
|
|
18818
|
-
|
|
18819
|
-
(
|
|
18820
|
-
|
|
18821
|
-
|
|
18822
|
-
|
|
18823
|
-
|
|
18824
|
-
|
|
18825
|
-
|
|
18826
|
-
|
|
18827
|
-
|
|
18828
|
-
|
|
18829
|
-
|
|
18830
|
-
|
|
18831
|
-
|
|
18832
|
-
|
|
18833
|
-
|
|
18834
|
-
|
|
18835
|
-
|
|
18836
|
-
Object.defineProperty(exports, "cubicBezier", { enumerable: true, get: function () { return curves_1.cubicBezier; } });
|
|
18837
|
-
var ScrollTrigger_1 = ScrollTrigger$2;
|
|
18838
|
-
exports.ScrollTrigger = ScrollTrigger_1.default;
|
|
18839
|
-
var ViewEnterTrigger_1 = ViewEnterTrigger$1;
|
|
18840
|
-
exports.ViewEnterTrigger = ViewEnterTrigger_1.default;
|
|
18841
|
-
var ViewExitTrigger_1 = ViewExitTrigger$1;
|
|
18842
|
-
exports.ViewExitTrigger = ViewExitTrigger_1.default;
|
|
18843
|
-
}(dist));
|
|
18844
|
-
|
|
18845
|
-
/**
|
|
18846
|
-
* Singleton utility to watch the prefers-reduced-motion media value
|
|
18847
|
-
*/
|
|
18848
|
-
const prefersReducedMotionMediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
18849
|
-
|
|
18850
|
-
const slideLeftKeyframes = [
|
|
18851
|
-
{
|
|
18852
|
-
transform: 'translateX(-100%)',
|
|
18853
|
-
visibility: 'hidden',
|
|
18854
|
-
offset: 0
|
|
18855
|
-
},
|
|
18856
|
-
{
|
|
18857
|
-
transform: 'translateX(-100%)',
|
|
18858
|
-
visibility: 'visible',
|
|
18859
|
-
offset: 0.01
|
|
18860
|
-
},
|
|
18861
|
-
{
|
|
18862
|
-
transform: 'translateX(0%)',
|
|
18863
|
-
visibility: 'visible',
|
|
18864
|
-
offset: 1
|
|
18865
|
-
}
|
|
18866
|
-
];
|
|
18867
|
-
const slideRightKeyframes = [
|
|
18868
|
-
{
|
|
18869
|
-
transform: 'translateX(100%)',
|
|
18870
|
-
visibility: 'hidden',
|
|
18871
|
-
offset: 0
|
|
18872
|
-
},
|
|
18873
|
-
{
|
|
18874
|
-
transform: 'translateX(100%)',
|
|
18875
|
-
visibility: 'visible',
|
|
18876
|
-
offset: 0.01
|
|
18877
|
-
},
|
|
18878
|
-
{
|
|
18879
|
-
transform: 'translateX(0%)',
|
|
18880
|
-
visibility: 'visible',
|
|
18881
|
-
offset: 1
|
|
18882
|
-
}
|
|
18883
|
-
];
|
|
18884
|
-
const fadeOverlayKeyframes = [{ opacity: 0 }, { opacity: 1 }];
|
|
18885
|
-
const slideInOptions = {
|
|
18886
|
-
duration: 1,
|
|
18887
|
-
easing: 'ease-out'
|
|
18888
|
-
};
|
|
18889
|
-
const slideOutOptions = {
|
|
18890
|
-
duration: 1,
|
|
18891
|
-
easing: 'ease-in',
|
|
18892
|
-
direction: 'reverse'
|
|
18893
|
-
};
|
|
18894
|
-
const animationConfig = {
|
|
18895
|
-
slideLeftKeyframes,
|
|
18896
|
-
slideRightKeyframes,
|
|
18897
|
-
fadeOverlayKeyframes,
|
|
18898
|
-
slideInOptions,
|
|
18899
|
-
slideOutOptions
|
|
18900
|
-
};
|
|
17516
|
+
cancelHandler(event) {
|
|
17517
|
+
if (this.preventDismiss) {
|
|
17518
|
+
event.preventDefault();
|
|
17519
|
+
}
|
|
17520
|
+
else {
|
|
17521
|
+
this.resolveShow(UserDismissed);
|
|
17522
|
+
this.resolveShow = undefined;
|
|
17523
|
+
}
|
|
17524
|
+
return true;
|
|
17525
|
+
}
|
|
17526
|
+
}
|
|
17527
|
+
// We want the member to match the name of the constant
|
|
17528
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
17529
|
+
Dialog.UserDismissed = UserDismissed;
|
|
17530
|
+
__decorate([
|
|
17531
|
+
attr({ attribute: 'prevent-dismiss', mode: 'boolean' })
|
|
17532
|
+
], Dialog.prototype, "preventDismiss", void 0);
|
|
17533
|
+
__decorate([
|
|
17534
|
+
attr({ attribute: 'header-hidden', mode: 'boolean' })
|
|
17535
|
+
], Dialog.prototype, "headerHidden", void 0);
|
|
17536
|
+
__decorate([
|
|
17537
|
+
attr({ attribute: 'footer-hidden', mode: 'boolean' })
|
|
17538
|
+
], Dialog.prototype, "footerHidden", void 0);
|
|
17539
|
+
__decorate([
|
|
17540
|
+
observable
|
|
17541
|
+
], Dialog.prototype, "footerIsEmpty", void 0);
|
|
17542
|
+
__decorate([
|
|
17543
|
+
observable
|
|
17544
|
+
], Dialog.prototype, "slottedFooterElements", void 0);
|
|
17545
|
+
applyMixins(Dialog, ARIAGlobalStatesAndProperties);
|
|
17546
|
+
const nimbleDialog = Dialog.compose({
|
|
17547
|
+
baseName: 'dialog',
|
|
17548
|
+
template: template$5,
|
|
17549
|
+
styles: styles$k,
|
|
17550
|
+
baseClass: Dialog
|
|
17551
|
+
});
|
|
17552
|
+
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleDialog());
|
|
18901
17553
|
|
|
18902
17554
|
const styles$j = css `
|
|
18903
17555
|
${display('block')}
|
|
18904
17556
|
|
|
18905
17557
|
:host {
|
|
18906
|
-
position:
|
|
18907
|
-
|
|
18908
|
-
bottom: 0;
|
|
18909
|
-
width: fit-content;
|
|
17558
|
+
position: absolute;
|
|
17559
|
+
width: auto;
|
|
18910
17560
|
height: 100%;
|
|
18911
17561
|
outline: none;
|
|
18912
17562
|
font: ${bodyFont};
|
|
18913
17563
|
color: ${bodyFontColor};
|
|
18914
17564
|
}
|
|
18915
17565
|
|
|
18916
|
-
|
|
18917
|
-
|
|
18918
|
-
|
|
18919
|
-
|
|
18920
|
-
|
|
18921
|
-
|
|
18922
|
-
|
|
18923
|
-
|
|
18924
|
-
|
|
18925
|
-
right: 0px;
|
|
18926
|
-
}
|
|
18927
|
-
|
|
18928
|
-
.positioning-region {
|
|
18929
|
-
display: block;
|
|
18930
|
-
position: relative;
|
|
18931
|
-
justify-content: center;
|
|
18932
|
-
width: fit-content;
|
|
17566
|
+
dialog {
|
|
17567
|
+
color: inherit;
|
|
17568
|
+
font: inherit;
|
|
17569
|
+
background-color: transparent;
|
|
17570
|
+
width: auto;
|
|
17571
|
+
top: 0px;
|
|
17572
|
+
bottom: 0px;
|
|
17573
|
+
border-radius: 0px;
|
|
17574
|
+
border-width: 0px;
|
|
18933
17575
|
height: 100%;
|
|
18934
|
-
|
|
17576
|
+
margin: 0px;
|
|
17577
|
+
padding: 0px;
|
|
17578
|
+
max-width: none;
|
|
17579
|
+
max-height: none;
|
|
18935
17580
|
overflow: hidden;
|
|
18936
|
-
z-index: 999;
|
|
18937
17581
|
}
|
|
18938
17582
|
|
|
18939
|
-
|
|
18940
|
-
|
|
18941
|
-
|
|
18942
|
-
|
|
17583
|
+
@keyframes ni-private-drawer-fade-in-keyframes {
|
|
17584
|
+
0% {
|
|
17585
|
+
opacity: 0;
|
|
17586
|
+
}
|
|
17587
|
+
100% {
|
|
17588
|
+
opacity: 1;
|
|
17589
|
+
}
|
|
18943
17590
|
}
|
|
18944
17591
|
|
|
18945
|
-
|
|
18946
|
-
|
|
18947
|
-
|
|
18948
|
-
inset: 0px;
|
|
18949
|
-
background: ${modalBackdropColor};
|
|
18950
|
-
touch-action: none;
|
|
17592
|
+
dialog.animating::backdrop {
|
|
17593
|
+
animation: ni-private-drawer-fade-in-keyframes ${largeDelayStatic}
|
|
17594
|
+
ease-in;
|
|
18951
17595
|
}
|
|
18952
17596
|
|
|
18953
|
-
.
|
|
18954
|
-
|
|
18955
|
-
|
|
18956
|
-
|
|
17597
|
+
dialog.closing::backdrop {
|
|
17598
|
+
animation-direction: reverse;
|
|
17599
|
+
}
|
|
17600
|
+
|
|
17601
|
+
.dialog-contents {
|
|
17602
|
+
box-sizing: border-box;
|
|
18957
17603
|
display: flex;
|
|
18958
17604
|
flex-direction: column;
|
|
18959
|
-
|
|
18960
|
-
border-radius: 0px;
|
|
18961
|
-
border-width: 0px;
|
|
17605
|
+
position: absolute;
|
|
18962
17606
|
width: ${drawerWidth};
|
|
18963
17607
|
height: 100%;
|
|
18964
17608
|
background-color: ${applicationBackgroundColor};
|
|
18965
17609
|
}
|
|
18966
17610
|
|
|
18967
|
-
|
|
18968
|
-
|
|
18969
|
-
|
|
17611
|
+
@keyframes ni-private-drawer-slide-in-left-keyframes {
|
|
17612
|
+
0% {
|
|
17613
|
+
transform: translate(-100%);
|
|
17614
|
+
}
|
|
17615
|
+
100% {
|
|
17616
|
+
transform: translate(0%);
|
|
17617
|
+
}
|
|
18970
17618
|
}
|
|
18971
17619
|
|
|
18972
|
-
:host([location='left']) .
|
|
18973
|
-
left: 0px;
|
|
17620
|
+
:host([location='left']) .dialog-contents {
|
|
18974
17621
|
border-right: ${borderWidth} solid ${popupBoxShadowColor};
|
|
17622
|
+
box-shadow: 3px 0px 8px ${popupBoxShadowColor};
|
|
17623
|
+
}
|
|
17624
|
+
|
|
17625
|
+
:host([location='left']) dialog.animating .dialog-contents {
|
|
17626
|
+
animation: ni-private-drawer-slide-in-left-keyframes ${largeDelay}
|
|
17627
|
+
ease-in;
|
|
17628
|
+
}
|
|
17629
|
+
|
|
17630
|
+
:host([location='left']) dialog.closing .dialog-contents {
|
|
17631
|
+
animation-direction: reverse;
|
|
17632
|
+
}
|
|
17633
|
+
|
|
17634
|
+
@keyframes ni-private-drawer-slide-in-right-keyframes {
|
|
17635
|
+
0% {
|
|
17636
|
+
transform: translate(100%);
|
|
17637
|
+
}
|
|
17638
|
+
100% {
|
|
17639
|
+
transform: translate(0%);
|
|
17640
|
+
}
|
|
18975
17641
|
}
|
|
18976
17642
|
|
|
18977
|
-
:host([location='right']) .
|
|
17643
|
+
:host([location='right']) .dialog-contents {
|
|
18978
17644
|
right: 0px;
|
|
18979
17645
|
border-left: ${borderWidth} solid ${popupBoxShadowColor};
|
|
17646
|
+
box-shadow: -3px 0px 8px ${popupBoxShadowColor};
|
|
17647
|
+
}
|
|
17648
|
+
|
|
17649
|
+
:host([location='right']) dialog.animating .dialog-contents {
|
|
17650
|
+
animation: ni-private-drawer-slide-in-right-keyframes ${largeDelay}
|
|
17651
|
+
ease-in;
|
|
17652
|
+
}
|
|
17653
|
+
|
|
17654
|
+
:host([location='right']) dialog.closing .dialog-contents {
|
|
17655
|
+
animation-direction: reverse;
|
|
17656
|
+
}
|
|
17657
|
+
|
|
17658
|
+
@media (prefers-reduced-motion) {
|
|
17659
|
+
:host([location='left']) dialog.animating .dialog-contents,
|
|
17660
|
+
:host([location='right']) dialog.animating .dialog-contents {
|
|
17661
|
+
animation-duration: 1ms;
|
|
17662
|
+
}
|
|
18980
17663
|
}
|
|
18981
17664
|
|
|
18982
17665
|
${
|
|
@@ -19004,209 +17687,140 @@
|
|
|
19004
17687
|
justify-content: flex-end;
|
|
19005
17688
|
border-top: ${borderWidth} solid ${popupBorderColor};
|
|
19006
17689
|
}
|
|
17690
|
+
`.withBehaviors(
|
|
17691
|
+
/*
|
|
17692
|
+
* We cannot use the modalBackdropColor token directly because the backdrop
|
|
17693
|
+
* element is not a descendant of the nimble-theme-provider element.
|
|
17694
|
+
*/
|
|
17695
|
+
themeBehavior(Theme.light, css `
|
|
17696
|
+
dialog::backdrop {
|
|
17697
|
+
background: ${modalBackdropColorThemeLightStatic};
|
|
17698
|
+
}
|
|
17699
|
+
`), themeBehavior(Theme.dark, css `
|
|
17700
|
+
dialog::backdrop {
|
|
17701
|
+
background: ${modalBackdropColorThemeDarkStatic};
|
|
17702
|
+
}
|
|
17703
|
+
`), themeBehavior(Theme.color, css `
|
|
17704
|
+
dialog::backdrop {
|
|
17705
|
+
background: ${modalBackdropColorThemeColorStatic};
|
|
17706
|
+
}
|
|
17707
|
+
`));
|
|
17708
|
+
|
|
17709
|
+
const template$4 = html `
|
|
17710
|
+
<dialog
|
|
17711
|
+
${ref('dialog')}
|
|
17712
|
+
aria-label="${x => x.ariaLabel}"
|
|
17713
|
+
@cancel="${(x, c) => x.cancelHandler(c.event)}"
|
|
17714
|
+
>
|
|
17715
|
+
<div class="dialog-contents">
|
|
17716
|
+
<slot></slot>
|
|
17717
|
+
</div>
|
|
17718
|
+
</dialog>
|
|
19007
17719
|
`;
|
|
19008
17720
|
|
|
19009
17721
|
const DrawerLocation = {
|
|
19010
17722
|
left: 'left',
|
|
19011
17723
|
right: 'right'
|
|
19012
17724
|
};
|
|
19013
|
-
const DrawerState = {
|
|
19014
|
-
opening: 'opening',
|
|
19015
|
-
opened: 'opened',
|
|
19016
|
-
closing: 'closing',
|
|
19017
|
-
closed: 'closed'
|
|
19018
|
-
};
|
|
19019
17725
|
|
|
19020
|
-
const animationDurationWhenDisabledMilliseconds = 0.001;
|
|
19021
17726
|
/**
|
|
19022
|
-
* Drawer
|
|
17727
|
+
* Drawer control. Shows content in a panel on the left / right side of the screen,
|
|
19023
17728
|
* which animates to be visible with a slide-in / slide-out animation.
|
|
19024
|
-
* Configured via 'location', 'state', 'modal', 'preventDismiss' properties.
|
|
19025
17729
|
*/
|
|
19026
|
-
|
|
17730
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
17731
|
+
class Drawer extends FoundationElement {
|
|
19027
17732
|
constructor() {
|
|
19028
17733
|
super(...arguments);
|
|
19029
|
-
this.location = DrawerLocation.
|
|
19030
|
-
this.state = DrawerState.closed;
|
|
19031
|
-
/**
|
|
19032
|
-
* True to prevent dismissing the drawer when the overlay outside the drawer is clicked.
|
|
19033
|
-
* Only applicable when 'modal' is set to true (i.e. when the overlay is used).
|
|
19034
|
-
* HTML Attribute: prevent-dismiss
|
|
19035
|
-
*/
|
|
17734
|
+
this.location = DrawerLocation.right;
|
|
19036
17735
|
this.preventDismiss = false;
|
|
19037
|
-
this.
|
|
19038
|
-
this.
|
|
19039
|
-
}
|
|
19040
|
-
/** @internal */
|
|
19041
|
-
connectedCallback() {
|
|
19042
|
-
// disable trapFocus before super.connectedCallback as FAST Dialog will immediately queue work to
|
|
19043
|
-
// change focus if it's true before connectedCallback
|
|
19044
|
-
this.trapFocus = false;
|
|
19045
|
-
super.connectedCallback();
|
|
19046
|
-
this.updateAnimationDuration();
|
|
19047
|
-
this.animationsEnabledChangedHandler = () => this.updateAnimationDuration();
|
|
19048
|
-
prefersReducedMotionMediaQuery.addEventListener('change', this.animationsEnabledChangedHandler);
|
|
19049
|
-
this.onStateChanged();
|
|
19050
|
-
const notifier = Observable.getNotifier(this);
|
|
19051
|
-
const subscriber = {
|
|
19052
|
-
handleChange: (_source, propertyName) => this.onPropertyChange(propertyName)
|
|
19053
|
-
};
|
|
19054
|
-
this.propertiesToWatch.forEach(propertyName => notifier.subscribe(subscriber, propertyName));
|
|
19055
|
-
this.propertyChangeSubscriber = subscriber;
|
|
19056
|
-
this.propertyChangeNotifier = notifier;
|
|
19057
|
-
}
|
|
19058
|
-
/** @internal */
|
|
19059
|
-
disconnectedCallback() {
|
|
19060
|
-
super.disconnectedCallback();
|
|
19061
|
-
this.cancelCurrentAnimation();
|
|
19062
|
-
if (this.propertyChangeNotifier && this.propertyChangeSubscriber) {
|
|
19063
|
-
this.propertiesToWatch.forEach(propertyName => this.propertyChangeNotifier.unsubscribe(this.propertyChangeSubscriber, propertyName));
|
|
19064
|
-
this.propertyChangeNotifier = undefined;
|
|
19065
|
-
this.propertyChangeSubscriber = undefined;
|
|
19066
|
-
}
|
|
19067
|
-
if (this.animationsEnabledChangedHandler) {
|
|
19068
|
-
prefersReducedMotionMediaQuery.removeEventListener('change', this.animationsEnabledChangedHandler);
|
|
19069
|
-
this.animationsEnabledChangedHandler = undefined;
|
|
19070
|
-
}
|
|
19071
|
-
}
|
|
19072
|
-
show() {
|
|
19073
|
-
// Not calling super.show() as that will immediately show the drawer, whereas 'Opening' state will animate
|
|
19074
|
-
this.state = DrawerState.opening;
|
|
19075
|
-
}
|
|
19076
|
-
hide() {
|
|
19077
|
-
// Not calling super.hide() as that will immediately hide the drawer, whereas 'Closing' state will animate
|
|
19078
|
-
this.state = DrawerState.closing;
|
|
17736
|
+
this.closing = false;
|
|
17737
|
+
this.animationEndHandlerFunction = () => this.animationEndHandler();
|
|
19079
17738
|
}
|
|
19080
17739
|
/**
|
|
19081
|
-
*
|
|
19082
|
-
* @internal
|
|
17740
|
+
* True if the drawer is open, opening, or closing. Otherwise, false.
|
|
19083
17741
|
*/
|
|
19084
|
-
|
|
19085
|
-
|
|
19086
|
-
const shouldDismiss = this.$emit('cancel', {},
|
|
19087
|
-
// Aligned with the configuration of HTMLDialogElement cancel event:
|
|
19088
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/cancel_event
|
|
19089
|
-
{ bubbles: false, cancelable: true, composed: false });
|
|
19090
|
-
if (shouldDismiss && !this.preventDismiss) {
|
|
19091
|
-
this.$emit('dismiss');
|
|
19092
|
-
this.hide();
|
|
19093
|
-
}
|
|
19094
|
-
}
|
|
19095
|
-
onPropertyChange(propertyName) {
|
|
19096
|
-
switch (propertyName) {
|
|
19097
|
-
case 'hidden':
|
|
19098
|
-
this.onHiddenChanged();
|
|
19099
|
-
break;
|
|
19100
|
-
case 'location':
|
|
19101
|
-
this.onLocationChanged();
|
|
19102
|
-
break;
|
|
19103
|
-
case 'state':
|
|
19104
|
-
this.onStateChanged();
|
|
19105
|
-
break;
|
|
19106
|
-
}
|
|
17742
|
+
get open() {
|
|
17743
|
+
return this.resolveShow !== undefined;
|
|
19107
17744
|
}
|
|
19108
|
-
|
|
19109
|
-
|
|
19110
|
-
|
|
19111
|
-
|
|
19112
|
-
|
|
19113
|
-
|
|
17745
|
+
/**
|
|
17746
|
+
* Opens the drawer
|
|
17747
|
+
* @returns Promise that is resolved when the drawer finishes closing. The value of the resolved
|
|
17748
|
+
* Promise is the reason value passed to the close() method, or UserDismissed if the drawer was
|
|
17749
|
+
* closed via the ESC key.
|
|
17750
|
+
*/
|
|
17751
|
+
async show() {
|
|
17752
|
+
if (this.open) {
|
|
17753
|
+
throw new Error('Drawer is already open');
|
|
19114
17754
|
}
|
|
17755
|
+
this.openDialog();
|
|
17756
|
+
return new Promise((resolve, _reject) => {
|
|
17757
|
+
this.resolveShow = resolve;
|
|
17758
|
+
});
|
|
19115
17759
|
}
|
|
19116
|
-
|
|
19117
|
-
|
|
19118
|
-
|
|
19119
|
-
|
|
19120
|
-
|
|
19121
|
-
|
|
19122
|
-
|
|
19123
|
-
case DrawerState.opening:
|
|
19124
|
-
this.animateOpening();
|
|
19125
|
-
this.hidden = false;
|
|
19126
|
-
break;
|
|
19127
|
-
case DrawerState.opened:
|
|
19128
|
-
this.hidden = false;
|
|
19129
|
-
break;
|
|
19130
|
-
case DrawerState.closing:
|
|
19131
|
-
this.hidden = false;
|
|
19132
|
-
this.animateClosing();
|
|
19133
|
-
break;
|
|
19134
|
-
case DrawerState.closed:
|
|
19135
|
-
this.hidden = true;
|
|
19136
|
-
break;
|
|
19137
|
-
default:
|
|
19138
|
-
throw new Error('Unsupported state value. Expected: opening/opened/closing/closed');
|
|
19139
|
-
}
|
|
19140
|
-
this.$emit('state-change');
|
|
17760
|
+
/**
|
|
17761
|
+
* Closes the drawer
|
|
17762
|
+
* @param reason An optional value indicating how/why the drawer was closed.
|
|
17763
|
+
*/
|
|
17764
|
+
close(reason) {
|
|
17765
|
+
if (!this.open || this.closing) {
|
|
17766
|
+
throw new Error('Drawer is not open or already closing');
|
|
19141
17767
|
}
|
|
17768
|
+
this.closeReason = reason;
|
|
17769
|
+
this.closeDialog();
|
|
19142
17770
|
}
|
|
19143
|
-
|
|
19144
|
-
|
|
19145
|
-
|
|
19146
|
-
|
|
19147
|
-
|
|
19148
|
-
|
|
19149
|
-
|
|
19150
|
-
|
|
19151
|
-
|
|
19152
|
-
this.
|
|
17771
|
+
/**
|
|
17772
|
+
* @internal
|
|
17773
|
+
*/
|
|
17774
|
+
cancelHandler(event) {
|
|
17775
|
+
// Allowing the dialog to close itself bypasses the drawer's animation logic, so we
|
|
17776
|
+
// should close the drawer ourselves when preventDismiss is false.
|
|
17777
|
+
event.preventDefault();
|
|
17778
|
+
if (!this.preventDismiss) {
|
|
17779
|
+
this.closeReason = UserDismissed;
|
|
17780
|
+
this.closeDialog();
|
|
19153
17781
|
}
|
|
17782
|
+
return true;
|
|
19154
17783
|
}
|
|
19155
|
-
|
|
19156
|
-
this.
|
|
19157
|
-
|
|
19158
|
-
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
|
|
19162
|
-
|
|
19163
|
-
|
|
17784
|
+
openDialog() {
|
|
17785
|
+
this.dialog.showModal();
|
|
17786
|
+
this.triggerAnimation();
|
|
17787
|
+
}
|
|
17788
|
+
closeDialog() {
|
|
17789
|
+
this.closing = true;
|
|
17790
|
+
this.triggerAnimation();
|
|
17791
|
+
}
|
|
17792
|
+
triggerAnimation() {
|
|
17793
|
+
this.dialog.classList.add('animating');
|
|
17794
|
+
if (this.closing) {
|
|
17795
|
+
this.dialog.classList.add('closing');
|
|
17796
|
+
}
|
|
17797
|
+
this.dialog.addEventListener(eventAnimationEnd, this.animationEndHandlerFunction);
|
|
17798
|
+
}
|
|
17799
|
+
animationEndHandler() {
|
|
17800
|
+
this.dialog.removeEventListener(eventAnimationEnd, this.animationEndHandlerFunction);
|
|
17801
|
+
this.dialog.classList.remove('animating');
|
|
17802
|
+
if (this.closing) {
|
|
17803
|
+
this.dialog.classList.remove('closing');
|
|
17804
|
+
this.dialog.close();
|
|
17805
|
+
this.closing = false;
|
|
17806
|
+
this.resolveShow(this.closeReason);
|
|
17807
|
+
this.resolveShow = undefined;
|
|
19164
17808
|
}
|
|
19165
17809
|
}
|
|
19166
|
-
animateOpenClose(drawerOpening) {
|
|
19167
|
-
const options = {
|
|
19168
|
-
...(drawerOpening
|
|
19169
|
-
? animationConfig.slideInOptions
|
|
19170
|
-
: animationConfig.slideOutOptions),
|
|
19171
|
-
duration: this.animationDurationMilliseconds
|
|
19172
|
-
};
|
|
19173
|
-
const drawerKeyframes = this.location === DrawerLocation.right
|
|
19174
|
-
? animationConfig.slideRightKeyframes
|
|
19175
|
-
: animationConfig.slideLeftKeyframes;
|
|
19176
|
-
const dialogAnimation = new dist.AnimateTo(this.dialog, undefined, options);
|
|
19177
|
-
dialogAnimation.addKeyframes(drawerKeyframes);
|
|
19178
|
-
const animations = [dialogAnimation];
|
|
19179
|
-
const overlay = this.shadowRoot?.querySelector('.overlay');
|
|
19180
|
-
if (overlay) {
|
|
19181
|
-
const overlayAnimation = new dist.AnimateTo(overlay, undefined, options);
|
|
19182
|
-
overlayAnimation.addKeyframes(animationConfig.fadeOverlayKeyframes);
|
|
19183
|
-
animations.push(overlayAnimation);
|
|
19184
|
-
}
|
|
19185
|
-
const animationGroup = new dist.AnimateGroup(animations);
|
|
19186
|
-
animationGroup.onFinish = () => {
|
|
19187
|
-
this.state = drawerOpening
|
|
19188
|
-
? DrawerState.opened
|
|
19189
|
-
: DrawerState.closed;
|
|
19190
|
-
};
|
|
19191
|
-
this.animationGroup = animationGroup;
|
|
19192
|
-
animationGroup.play();
|
|
19193
|
-
}
|
|
19194
|
-
cancelCurrentAnimation() {
|
|
19195
|
-
this.animationGroup?.cancel();
|
|
19196
|
-
}
|
|
19197
17810
|
}
|
|
17811
|
+
// We want the member to match the name of the constant
|
|
17812
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
17813
|
+
Drawer.UserDismissed = UserDismissed;
|
|
19198
17814
|
__decorate([
|
|
19199
17815
|
attr
|
|
19200
17816
|
], Drawer.prototype, "location", void 0);
|
|
19201
|
-
__decorate([
|
|
19202
|
-
attr
|
|
19203
|
-
], Drawer.prototype, "state", void 0);
|
|
19204
17817
|
__decorate([
|
|
19205
17818
|
attr({ attribute: 'prevent-dismiss', mode: 'boolean' })
|
|
19206
17819
|
], Drawer.prototype, "preventDismiss", void 0);
|
|
17820
|
+
applyMixins(Drawer, ARIAGlobalStatesAndProperties);
|
|
19207
17821
|
const nimbleDrawer = Drawer.compose({
|
|
19208
17822
|
baseName: 'drawer',
|
|
19209
|
-
template:
|
|
17823
|
+
template: template$4,
|
|
19210
17824
|
styles: styles$j
|
|
19211
17825
|
});
|
|
19212
17826
|
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleDrawer());
|