@ni/nimble-components 12.0.1 → 13.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 +214 -1733
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +1675 -1805
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/dialog/index.d.ts +4 -8
- package/dist/esm/dialog/index.js +5 -8
- package/dist/esm/dialog/index.js.map +1 -1
- package/dist/esm/dialog/styles.js +4 -4
- package/dist/esm/dialog/styles.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 +3 -4
- 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));
|
|
@@ -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,6 +17297,12 @@
|
|
|
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
|
|
|
@@ -17706,19 +17319,19 @@
|
|
|
17706
17319
|
*/
|
|
17707
17320
|
themeBehavior(Theme.light, css `
|
|
17708
17321
|
dialog::backdrop {
|
|
17709
|
-
background: ${
|
|
17322
|
+
background: ${modalBackdropColorThemeLightStatic};
|
|
17710
17323
|
}
|
|
17711
17324
|
`), themeBehavior(Theme.dark, css `
|
|
17712
17325
|
dialog::backdrop {
|
|
17713
|
-
background: ${
|
|
17326
|
+
background: ${modalBackdropColorThemeDarkStatic};
|
|
17714
17327
|
}
|
|
17715
17328
|
`), themeBehavior(Theme.color, css `
|
|
17716
17329
|
dialog::backdrop {
|
|
17717
|
-
background: ${
|
|
17330
|
+
background: ${modalBackdropColorThemeColorStatic};
|
|
17718
17331
|
}
|
|
17719
17332
|
`));
|
|
17720
17333
|
|
|
17721
|
-
const template$
|
|
17334
|
+
const template$5 = html `
|
|
17722
17335
|
<template>
|
|
17723
17336
|
<dialog
|
|
17724
17337
|
${ref('dialogElement')}
|
|
@@ -17731,11 +17344,6 @@
|
|
|
17731
17344
|
</template>
|
|
17732
17345
|
`;
|
|
17733
17346
|
|
|
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
17347
|
/**
|
|
17740
17348
|
* A nimble-styled dialog.
|
|
17741
17349
|
*/
|
|
@@ -17758,7 +17366,7 @@
|
|
|
17758
17366
|
}
|
|
17759
17367
|
/**
|
|
17760
17368
|
* 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
|
|
17369
|
+
* @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.
|
|
17762
17370
|
*/
|
|
17763
17371
|
async show() {
|
|
17764
17372
|
if (this.open) {
|
|
@@ -17789,7 +17397,7 @@
|
|
|
17789
17397
|
event.preventDefault();
|
|
17790
17398
|
}
|
|
17791
17399
|
else {
|
|
17792
|
-
this.resolveShow(
|
|
17400
|
+
this.resolveShow(UserDismissed);
|
|
17793
17401
|
this.resolveShow = undefined;
|
|
17794
17402
|
}
|
|
17795
17403
|
return true;
|
|
@@ -17797,1186 +17405,128 @@
|
|
|
17797
17405
|
}
|
|
17798
17406
|
// We want the member to match the name of the constant
|
|
17799
17407
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
17800
|
-
Dialog.
|
|
17408
|
+
Dialog.UserDismissed = UserDismissed;
|
|
17801
17409
|
__decorate([
|
|
17802
17410
|
attr({ attribute: 'prevent-dismiss', mode: 'boolean' })
|
|
17803
17411
|
], Dialog.prototype, "preventDismiss", void 0);
|
|
17804
17412
|
applyMixins(Dialog, ARIAGlobalStatesAndProperties);
|
|
17805
17413
|
const nimbleDialog = Dialog.compose({
|
|
17806
17414
|
baseName: 'dialog',
|
|
17807
|
-
template: template$
|
|
17415
|
+
template: template$5,
|
|
17808
17416
|
styles: styles$k,
|
|
17809
17417
|
baseClass: Dialog
|
|
17810
17418
|
});
|
|
17811
17419
|
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleDialog());
|
|
17812
17420
|
|
|
17813
|
-
|
|
17421
|
+
const styles$j = css `
|
|
17422
|
+
${display('block')}
|
|
17814
17423
|
|
|
17815
|
-
|
|
17424
|
+
:host {
|
|
17425
|
+
position: absolute;
|
|
17426
|
+
width: auto;
|
|
17427
|
+
height: 100%;
|
|
17428
|
+
outline: none;
|
|
17429
|
+
font: ${bodyFont};
|
|
17430
|
+
color: ${bodyFontColor};
|
|
17431
|
+
}
|
|
17816
17432
|
|
|
17817
|
-
|
|
17433
|
+
dialog {
|
|
17434
|
+
color: inherit;
|
|
17435
|
+
font: inherit;
|
|
17436
|
+
background-color: transparent;
|
|
17437
|
+
width: auto;
|
|
17438
|
+
top: 0px;
|
|
17439
|
+
bottom: 0px;
|
|
17440
|
+
border-radius: 0px;
|
|
17441
|
+
border-width: 0px;
|
|
17442
|
+
height: 100%;
|
|
17443
|
+
margin: 0px;
|
|
17444
|
+
padding: 0px;
|
|
17445
|
+
max-width: none;
|
|
17446
|
+
max-height: none;
|
|
17447
|
+
overflow: hidden;
|
|
17448
|
+
}
|
|
17818
17449
|
|
|
17819
|
-
|
|
17820
|
-
|
|
17821
|
-
|
|
17822
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17823
|
-
exports.AnimationMode = void 0;
|
|
17824
|
-
/**
|
|
17825
|
-
* Animation mode describes if an animation should animate toward an elements natural position or away from it
|
|
17826
|
-
*
|
|
17827
|
-
* @internal
|
|
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 || {};
|
|
17450
|
+
@keyframes ni-private-drawer-fade-in-keyframes {
|
|
17451
|
+
0% {
|
|
17452
|
+
opacity: 0;
|
|
17908
17453
|
}
|
|
17909
|
-
|
|
17910
|
-
|
|
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;
|
|
17454
|
+
100% {
|
|
17455
|
+
opacity: 1;
|
|
18228
17456
|
}
|
|
18229
|
-
return AnimateFrom;
|
|
18230
|
-
}(animate_1.default));
|
|
18231
|
-
animateFrom.default = AnimateFrom;
|
|
18232
|
-
|
|
18233
|
-
var animateGroup = {};
|
|
18234
|
-
|
|
18235
|
-
var invokeFunctionForEach$1 = {};
|
|
18236
|
-
|
|
18237
|
-
Object.defineProperty(invokeFunctionForEach$1, "__esModule", { value: true });
|
|
18238
|
-
invokeFunctionForEach$1.invokeFunctionForEach = void 0;
|
|
18239
|
-
/**
|
|
18240
|
-
* For each item in an array, invoke a function
|
|
18241
|
-
*/
|
|
18242
|
-
function invokeFunctionForEach(arr, name) {
|
|
18243
|
-
arr.forEach(function (arrItem) { return arrItem[name](); });
|
|
18244
17457
|
}
|
|
18245
|
-
invokeFunctionForEach$1.invokeFunctionForEach = invokeFunctionForEach;
|
|
18246
|
-
|
|
18247
|
-
Object.defineProperty(animateGroup, "__esModule", { value: true });
|
|
18248
|
-
var invokeFunctionForEach_1$1 = invokeFunctionForEach$1;
|
|
18249
|
-
/**
|
|
18250
|
-
* Groups {@link @microsoft/fast-animation#AnimateTo} and {@link @microsoft/fast-animation#AnimateFrom} instances, providing a single API to operate on all of them.
|
|
18251
|
-
* @public
|
|
18252
|
-
*/
|
|
18253
|
-
var AnimateGroup = /** @class */ (function () {
|
|
18254
|
-
function AnimateGroup(animations) {
|
|
18255
|
-
var _this = this;
|
|
18256
|
-
/**
|
|
18257
|
-
* Pauses all animations in the group
|
|
18258
|
-
*/
|
|
18259
|
-
this.pause = function () {
|
|
18260
|
-
(0, invokeFunctionForEach_1$1.invokeFunctionForEach)(_this.animations, "pause");
|
|
18261
|
-
};
|
|
18262
|
-
/**
|
|
18263
|
-
* Finishes all animations in the group
|
|
18264
|
-
*/
|
|
18265
|
-
this.finish = function () {
|
|
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;
|
|
18338
17458
|
|
|
18339
|
-
|
|
18340
|
-
|
|
18341
|
-
|
|
18342
|
-
var invokeFunctionForEach_1 = invokeFunctionForEach$1;
|
|
18343
|
-
/**
|
|
18344
|
-
* Animate a collection of {@link @microsoft/fast-animation#AnimateTo} and {@link @microsoft/fast-animation#AnimateFrom} in sequence.
|
|
18345
|
-
* @public
|
|
18346
|
-
*/
|
|
18347
|
-
var AnimateSequence = /** @class */ (function () {
|
|
18348
|
-
function AnimateSequence(animations) {
|
|
18349
|
-
var _this = this;
|
|
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
|
-
};
|
|
18368
|
-
/**
|
|
18369
|
-
* Finishes all animations in the sequence
|
|
18370
|
-
*/
|
|
18371
|
-
this.finish = function () {
|
|
18372
|
-
(0, invokeFunctionForEach_1.invokeFunctionForEach)(_this.animations, "finish");
|
|
18373
|
-
};
|
|
18374
|
-
/**
|
|
18375
|
-
* Cancels all animations in the sequence
|
|
18376
|
-
*/
|
|
18377
|
-
this.cancel = function () {
|
|
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]) : "";
|
|
17459
|
+
dialog.animating::backdrop {
|
|
17460
|
+
animation: ni-private-drawer-fade-in-keyframes ${largeDelayStatic}
|
|
17461
|
+
ease-in;
|
|
18554
17462
|
}
|
|
18555
|
-
curves.cubicBezier = cubicBezier;
|
|
18556
|
-
|
|
18557
|
-
var ScrollTrigger$2 = {};
|
|
18558
|
-
|
|
18559
|
-
var isElementInView$1 = {};
|
|
18560
17463
|
|
|
18561
|
-
|
|
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);
|
|
17464
|
+
dialog.closing::backdrop {
|
|
17465
|
+
animation-direction: reverse;
|
|
18571
17466
|
}
|
|
18572
|
-
isElementInView$1.default = isElementInView;
|
|
18573
|
-
|
|
18574
|
-
var ScrollBase = {};
|
|
18575
|
-
|
|
18576
|
-
var scrollY$1 = {};
|
|
18577
17467
|
|
|
18578
|
-
|
|
18579
|
-
|
|
18580
|
-
|
|
18581
|
-
|
|
18582
|
-
|
|
18583
|
-
|
|
18584
|
-
|
|
18585
|
-
}
|
|
18586
|
-
return typeof window.scrollY !== "undefined" ? window.scrollY : window.pageYOffset;
|
|
17468
|
+
.dialog-contents {
|
|
17469
|
+
box-sizing: border-box;
|
|
17470
|
+
display: flex;
|
|
17471
|
+
flex-direction: column;
|
|
17472
|
+
position: absolute;
|
|
17473
|
+
width: ${drawerWidth};
|
|
17474
|
+
height: 100%;
|
|
17475
|
+
background-color: ${applicationBackgroundColor};
|
|
18587
17476
|
}
|
|
18588
|
-
scrollY$1.default = scrollY;
|
|
18589
17477
|
|
|
18590
|
-
|
|
18591
|
-
|
|
18592
|
-
|
|
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;
|
|
18601
|
-
/**
|
|
18602
|
-
* Request's an animation frame if there are currently no open animation frame requests
|
|
18603
|
-
*/
|
|
18604
|
-
this.requestFrame = function () {
|
|
18605
|
-
if (_this.requestedFrame) {
|
|
18606
|
-
cancelAnimationFrame(_this.requestedFrame);
|
|
18607
|
-
}
|
|
18608
|
-
_this.requestedFrame = requestAnimationFrame(_this.update);
|
|
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);
|
|
18615
|
-
}
|
|
18616
|
-
/**
|
|
18617
|
-
* Subscribe an element and callback for scroll triggers
|
|
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.
|
|
18655
|
-
*/
|
|
18656
|
-
ScrollTrigger.prototype.isSubscribed = function (element, callback) {
|
|
18657
|
-
return !!this.subscriptions.filter(function (subscription) {
|
|
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;
|
|
18692
|
-
}
|
|
18693
|
-
/**
|
|
18694
|
-
* Check if elements are in view-port and apply scroll method if they are
|
|
18695
|
-
*/
|
|
18696
|
-
ScrollTrigger.prototype.update = function () {
|
|
18697
|
-
var _this = this;
|
|
18698
|
-
_super.prototype.update.call(this);
|
|
18699
|
-
this.subscriptions.forEach(function (subscription) {
|
|
18700
|
-
var inView = (0, isElementInView_1$2.default)(subscription.element);
|
|
18701
|
-
if (inView) {
|
|
18702
|
-
subscription.callback(_this.scrollDistance);
|
|
18703
|
-
}
|
|
18704
|
-
if (inView !== subscription.inView) {
|
|
18705
|
-
subscription.inView = inView;
|
|
18706
|
-
}
|
|
18707
|
-
});
|
|
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;
|
|
17478
|
+
@keyframes ni-private-drawer-slide-in-left-keyframes {
|
|
17479
|
+
0% {
|
|
17480
|
+
transform: translate(-100%);
|
|
18742
17481
|
}
|
|
18743
|
-
|
|
18744
|
-
|
|
18745
|
-
*/
|
|
18746
|
-
ViewEnterTrigger.prototype.update = function () {
|
|
18747
|
-
var _this = this;
|
|
18748
|
-
_super.prototype.update.call(this);
|
|
18749
|
-
this.subscriptions.forEach(
|
|
18750
|
-
/* eslint-disable-next-line */
|
|
18751
|
-
function (subscription, index) {
|
|
18752
|
-
var inView = (0, isElementInView_1$1.default)(subscription.element);
|
|
18753
|
-
// If the element is in view but previously wasn't
|
|
18754
|
-
if (inView && !subscription.inView) {
|
|
18755
|
-
subscription.callback(_this.scrollDistance);
|
|
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;
|
|
17482
|
+
100% {
|
|
17483
|
+
transform: translate(0%);
|
|
18795
17484
|
}
|
|
18796
|
-
/**
|
|
18797
|
-
* Check if elements are in view-port and apply scroll method if they are
|
|
18798
|
-
*/
|
|
18799
|
-
ViewExitTrigger.prototype.update = function () {
|
|
18800
|
-
var _this = this;
|
|
18801
|
-
_super.prototype.update.call(this);
|
|
18802
|
-
this.subscriptions.forEach(
|
|
18803
|
-
/* eslint-disable-next-line */
|
|
18804
|
-
function (subscription, index) {
|
|
18805
|
-
var inView = (0, isElementInView_1.default)(subscription.element);
|
|
18806
|
-
// If the element is out of view but previously was in view
|
|
18807
|
-
if (!inView && subscription.inView) {
|
|
18808
|
-
subscription.callback(_this.scrollDistance);
|
|
18809
|
-
}
|
|
18810
|
-
if (inView !== subscription.inView) {
|
|
18811
|
-
subscription.inView = inView;
|
|
18812
|
-
}
|
|
18813
|
-
});
|
|
18814
|
-
};
|
|
18815
|
-
return ViewExitTrigger;
|
|
18816
|
-
}(ScrollBase_1.default));
|
|
18817
|
-
ViewExitTrigger$1.default = ViewExitTrigger;
|
|
18818
|
-
|
|
18819
|
-
(function (exports) {
|
|
18820
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18821
|
-
exports.ViewExitTrigger = exports.ViewEnterTrigger = exports.ScrollTrigger = exports.fadeOut = exports.fadeIn = exports.cubicBezier = exports.AnimateTo = exports.AnimateSequence = exports.AnimateGroup = exports.AnimateFrom = exports.Animate = void 0;
|
|
18822
|
-
var animateTo_1 = animateTo;
|
|
18823
|
-
exports.AnimateTo = animateTo_1.default;
|
|
18824
|
-
var animateFrom_1 = animateFrom;
|
|
18825
|
-
exports.AnimateFrom = animateFrom_1.default;
|
|
18826
|
-
var animateGroup_1 = animateGroup;
|
|
18827
|
-
exports.AnimateGroup = animateGroup_1.default;
|
|
18828
|
-
var animateSequence_1 = animateSequence;
|
|
18829
|
-
exports.AnimateSequence = animateSequence_1.default;
|
|
18830
|
-
var animate_1 = animate;
|
|
18831
|
-
exports.Animate = animate_1.default;
|
|
18832
|
-
var fade_1 = fade;
|
|
18833
|
-
Object.defineProperty(exports, "fadeIn", { enumerable: true, get: function () { return fade_1.fadeIn; } });
|
|
18834
|
-
Object.defineProperty(exports, "fadeOut", { enumerable: true, get: function () { return fade_1.fadeOut; } });
|
|
18835
|
-
var curves_1 = curves;
|
|
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
|
-
};
|
|
18901
|
-
|
|
18902
|
-
const styles$j = css `
|
|
18903
|
-
${display('block')}
|
|
18904
|
-
|
|
18905
|
-
:host {
|
|
18906
|
-
position: relative;
|
|
18907
|
-
top: 0;
|
|
18908
|
-
bottom: 0;
|
|
18909
|
-
width: fit-content;
|
|
18910
|
-
height: 100%;
|
|
18911
|
-
outline: none;
|
|
18912
|
-
font: ${bodyFont};
|
|
18913
|
-
color: ${bodyFontColor};
|
|
18914
|
-
}
|
|
18915
|
-
|
|
18916
|
-
:host([modal]) {
|
|
18917
|
-
position: absolute;
|
|
18918
17485
|
}
|
|
18919
17486
|
|
|
18920
|
-
:host([location='left']) {
|
|
18921
|
-
|
|
17487
|
+
:host([location='left']) .dialog-contents {
|
|
17488
|
+
border-right: ${borderWidth} solid ${popupBoxShadowColor};
|
|
17489
|
+
box-shadow: 3px 0px 8px ${popupBoxShadowColor};
|
|
18922
17490
|
}
|
|
18923
17491
|
|
|
18924
|
-
:host([location='
|
|
18925
|
-
|
|
17492
|
+
:host([location='left']) dialog.animating .dialog-contents {
|
|
17493
|
+
animation: ni-private-drawer-slide-in-left-keyframes ${largeDelay}
|
|
17494
|
+
ease-in;
|
|
18926
17495
|
}
|
|
18927
17496
|
|
|
18928
|
-
.
|
|
18929
|
-
|
|
18930
|
-
position: relative;
|
|
18931
|
-
justify-content: center;
|
|
18932
|
-
width: fit-content;
|
|
18933
|
-
height: 100%;
|
|
18934
|
-
inset: 0px;
|
|
18935
|
-
overflow: hidden;
|
|
18936
|
-
z-index: 999;
|
|
17497
|
+
:host([location='left']) dialog.closing .dialog-contents {
|
|
17498
|
+
animation-direction: reverse;
|
|
18937
17499
|
}
|
|
18938
17500
|
|
|
18939
|
-
|
|
18940
|
-
|
|
18941
|
-
|
|
18942
|
-
|
|
18943
|
-
|
|
18944
|
-
|
|
18945
|
-
|
|
18946
|
-
.overlay {
|
|
18947
|
-
position: fixed;
|
|
18948
|
-
inset: 0px;
|
|
18949
|
-
background: ${modalBackdropColor};
|
|
18950
|
-
touch-action: none;
|
|
17501
|
+
@keyframes ni-private-drawer-slide-in-right-keyframes {
|
|
17502
|
+
0% {
|
|
17503
|
+
transform: translate(100%);
|
|
17504
|
+
}
|
|
17505
|
+
100% {
|
|
17506
|
+
transform: translate(0%);
|
|
17507
|
+
}
|
|
18951
17508
|
}
|
|
18952
17509
|
|
|
18953
|
-
.
|
|
18954
|
-
|
|
18955
|
-
|
|
18956
|
-
|
|
18957
|
-
display: flex;
|
|
18958
|
-
flex-direction: column;
|
|
18959
|
-
box-sizing: border-box;
|
|
18960
|
-
border-radius: 0px;
|
|
18961
|
-
border-width: 0px;
|
|
18962
|
-
width: ${drawerWidth};
|
|
18963
|
-
height: 100%;
|
|
18964
|
-
background-color: ${applicationBackgroundColor};
|
|
17510
|
+
:host([location='right']) .dialog-contents {
|
|
17511
|
+
right: 0px;
|
|
17512
|
+
border-left: ${borderWidth} solid ${popupBoxShadowColor};
|
|
17513
|
+
box-shadow: -3px 0px 8px ${popupBoxShadowColor};
|
|
18965
17514
|
}
|
|
18966
17515
|
|
|
18967
|
-
:host([
|
|
18968
|
-
|
|
18969
|
-
|
|
17516
|
+
:host([location='right']) dialog.animating .dialog-contents {
|
|
17517
|
+
animation: ni-private-drawer-slide-in-right-keyframes ${largeDelay}
|
|
17518
|
+
ease-in;
|
|
18970
17519
|
}
|
|
18971
17520
|
|
|
18972
|
-
:host([location='
|
|
18973
|
-
|
|
18974
|
-
border-right: ${borderWidth} solid ${popupBoxShadowColor};
|
|
17521
|
+
:host([location='right']) dialog.closing .dialog-contents {
|
|
17522
|
+
animation-direction: reverse;
|
|
18975
17523
|
}
|
|
18976
17524
|
|
|
18977
|
-
|
|
18978
|
-
|
|
18979
|
-
|
|
17525
|
+
@media (prefers-reduced-motion) {
|
|
17526
|
+
:host([location='left']) dialog.animating .dialog-contents,
|
|
17527
|
+
:host([location='right']) dialog.animating .dialog-contents {
|
|
17528
|
+
animation-duration: 1ms;
|
|
17529
|
+
}
|
|
18980
17530
|
}
|
|
18981
17531
|
|
|
18982
17532
|
${
|
|
@@ -19004,209 +17554,140 @@
|
|
|
19004
17554
|
justify-content: flex-end;
|
|
19005
17555
|
border-top: ${borderWidth} solid ${popupBorderColor};
|
|
19006
17556
|
}
|
|
17557
|
+
`.withBehaviors(
|
|
17558
|
+
/*
|
|
17559
|
+
* We cannot use the modalBackdropColor token directly because the backdrop
|
|
17560
|
+
* element is not a descendant of the nimble-theme-provider element.
|
|
17561
|
+
*/
|
|
17562
|
+
themeBehavior(Theme.light, css `
|
|
17563
|
+
dialog::backdrop {
|
|
17564
|
+
background: ${modalBackdropColorThemeLightStatic};
|
|
17565
|
+
}
|
|
17566
|
+
`), themeBehavior(Theme.dark, css `
|
|
17567
|
+
dialog::backdrop {
|
|
17568
|
+
background: ${modalBackdropColorThemeDarkStatic};
|
|
17569
|
+
}
|
|
17570
|
+
`), themeBehavior(Theme.color, css `
|
|
17571
|
+
dialog::backdrop {
|
|
17572
|
+
background: ${modalBackdropColorThemeColorStatic};
|
|
17573
|
+
}
|
|
17574
|
+
`));
|
|
17575
|
+
|
|
17576
|
+
const template$4 = html `
|
|
17577
|
+
<dialog
|
|
17578
|
+
${ref('dialog')}
|
|
17579
|
+
aria-label="${x => x.ariaLabel}"
|
|
17580
|
+
@cancel="${(x, c) => x.cancelHandler(c.event)}"
|
|
17581
|
+
>
|
|
17582
|
+
<div class="dialog-contents">
|
|
17583
|
+
<slot></slot>
|
|
17584
|
+
</div>
|
|
17585
|
+
</dialog>
|
|
19007
17586
|
`;
|
|
19008
17587
|
|
|
19009
17588
|
const DrawerLocation = {
|
|
19010
17589
|
left: 'left',
|
|
19011
17590
|
right: 'right'
|
|
19012
17591
|
};
|
|
19013
|
-
const DrawerState = {
|
|
19014
|
-
opening: 'opening',
|
|
19015
|
-
opened: 'opened',
|
|
19016
|
-
closing: 'closing',
|
|
19017
|
-
closed: 'closed'
|
|
19018
|
-
};
|
|
19019
17592
|
|
|
19020
|
-
const animationDurationWhenDisabledMilliseconds = 0.001;
|
|
19021
17593
|
/**
|
|
19022
|
-
* Drawer
|
|
17594
|
+
* Drawer control. Shows content in a panel on the left / right side of the screen,
|
|
19023
17595
|
* which animates to be visible with a slide-in / slide-out animation.
|
|
19024
|
-
* Configured via 'location', 'state', 'modal', 'preventDismiss' properties.
|
|
19025
17596
|
*/
|
|
19026
|
-
|
|
17597
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
17598
|
+
class Drawer extends FoundationElement {
|
|
19027
17599
|
constructor() {
|
|
19028
17600
|
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
|
-
*/
|
|
17601
|
+
this.location = DrawerLocation.right;
|
|
19036
17602
|
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;
|
|
17603
|
+
this.closing = false;
|
|
17604
|
+
this.animationEndHandlerFunction = () => this.animationEndHandler();
|
|
19079
17605
|
}
|
|
19080
17606
|
/**
|
|
19081
|
-
*
|
|
19082
|
-
* @internal
|
|
17607
|
+
* True if the drawer is open, opening, or closing. Otherwise, false.
|
|
19083
17608
|
*/
|
|
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
|
-
}
|
|
17609
|
+
get open() {
|
|
17610
|
+
return this.resolveShow !== undefined;
|
|
19107
17611
|
}
|
|
19108
|
-
|
|
19109
|
-
|
|
19110
|
-
|
|
19111
|
-
|
|
19112
|
-
|
|
19113
|
-
|
|
17612
|
+
/**
|
|
17613
|
+
* Opens the drawer
|
|
17614
|
+
* @returns Promise that is resolved when the drawer finishes closing. The value of the resolved
|
|
17615
|
+
* Promise is the reason value passed to the close() method, or UserDismissed if the drawer was
|
|
17616
|
+
* closed via the ESC key.
|
|
17617
|
+
*/
|
|
17618
|
+
async show() {
|
|
17619
|
+
if (this.open) {
|
|
17620
|
+
throw new Error('Drawer is already open');
|
|
19114
17621
|
}
|
|
17622
|
+
this.openDialog();
|
|
17623
|
+
return new Promise((resolve, _reject) => {
|
|
17624
|
+
this.resolveShow = resolve;
|
|
17625
|
+
});
|
|
19115
17626
|
}
|
|
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');
|
|
17627
|
+
/**
|
|
17628
|
+
* Closes the drawer
|
|
17629
|
+
* @param reason An optional value indicating how/why the drawer was closed.
|
|
17630
|
+
*/
|
|
17631
|
+
close(reason) {
|
|
17632
|
+
if (!this.open || this.closing) {
|
|
17633
|
+
throw new Error('Drawer is not open or already closing');
|
|
19141
17634
|
}
|
|
17635
|
+
this.closeReason = reason;
|
|
17636
|
+
this.closeDialog();
|
|
19142
17637
|
}
|
|
19143
|
-
|
|
19144
|
-
|
|
19145
|
-
|
|
19146
|
-
|
|
19147
|
-
|
|
19148
|
-
|
|
19149
|
-
|
|
19150
|
-
|
|
19151
|
-
|
|
19152
|
-
this.
|
|
17638
|
+
/**
|
|
17639
|
+
* @internal
|
|
17640
|
+
*/
|
|
17641
|
+
cancelHandler(event) {
|
|
17642
|
+
// Allowing the dialog to close itself bypasses the drawer's animation logic, so we
|
|
17643
|
+
// should close the drawer ourselves when preventDismiss is false.
|
|
17644
|
+
event.preventDefault();
|
|
17645
|
+
if (!this.preventDismiss) {
|
|
17646
|
+
this.closeReason = UserDismissed;
|
|
17647
|
+
this.closeDialog();
|
|
19153
17648
|
}
|
|
17649
|
+
return true;
|
|
19154
17650
|
}
|
|
19155
|
-
|
|
19156
|
-
this.
|
|
19157
|
-
|
|
19158
|
-
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
|
|
19162
|
-
|
|
19163
|
-
|
|
17651
|
+
openDialog() {
|
|
17652
|
+
this.dialog.showModal();
|
|
17653
|
+
this.triggerAnimation();
|
|
17654
|
+
}
|
|
17655
|
+
closeDialog() {
|
|
17656
|
+
this.closing = true;
|
|
17657
|
+
this.triggerAnimation();
|
|
17658
|
+
}
|
|
17659
|
+
triggerAnimation() {
|
|
17660
|
+
this.dialog.classList.add('animating');
|
|
17661
|
+
if (this.closing) {
|
|
17662
|
+
this.dialog.classList.add('closing');
|
|
17663
|
+
}
|
|
17664
|
+
this.dialog.addEventListener(eventAnimationEnd, this.animationEndHandlerFunction);
|
|
17665
|
+
}
|
|
17666
|
+
animationEndHandler() {
|
|
17667
|
+
this.dialog.removeEventListener(eventAnimationEnd, this.animationEndHandlerFunction);
|
|
17668
|
+
this.dialog.classList.remove('animating');
|
|
17669
|
+
if (this.closing) {
|
|
17670
|
+
this.dialog.classList.remove('closing');
|
|
17671
|
+
this.dialog.close();
|
|
17672
|
+
this.closing = false;
|
|
17673
|
+
this.resolveShow(this.closeReason);
|
|
17674
|
+
this.resolveShow = undefined;
|
|
19164
17675
|
}
|
|
19165
17676
|
}
|
|
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
17677
|
}
|
|
17678
|
+
// We want the member to match the name of the constant
|
|
17679
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
17680
|
+
Drawer.UserDismissed = UserDismissed;
|
|
19198
17681
|
__decorate([
|
|
19199
17682
|
attr
|
|
19200
17683
|
], Drawer.prototype, "location", void 0);
|
|
19201
|
-
__decorate([
|
|
19202
|
-
attr
|
|
19203
|
-
], Drawer.prototype, "state", void 0);
|
|
19204
17684
|
__decorate([
|
|
19205
17685
|
attr({ attribute: 'prevent-dismiss', mode: 'boolean' })
|
|
19206
17686
|
], Drawer.prototype, "preventDismiss", void 0);
|
|
17687
|
+
applyMixins(Drawer, ARIAGlobalStatesAndProperties);
|
|
19207
17688
|
const nimbleDrawer = Drawer.compose({
|
|
19208
17689
|
baseName: 'drawer',
|
|
19209
|
-
template:
|
|
17690
|
+
template: template$4,
|
|
19210
17691
|
styles: styles$j
|
|
19211
17692
|
});
|
|
19212
17693
|
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleDrawer());
|