@ni/nimble-components 8.6.0 → 8.6.3
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 +1380 -468
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +1094 -1014
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/drawer/index.js +11 -4
- package/dist/esm/drawer/index.js.map +1 -1
- package/dist/esm/nimble-components/src/tabs/index.d.ts +1 -0
- package/dist/esm/nimble-components/src/theme-provider/design-tokens.d.ts +1 -1
- package/dist/esm/tab/styles.js +60 -13
- package/dist/esm/tab/styles.js.map +1 -1
- package/dist/esm/tabs/index.d.ts +1 -0
- package/dist/esm/tabs/index.js +5 -0
- package/dist/esm/tabs/index.js.map +1 -1
- package/dist/esm/tabs/styles.js +0 -17
- package/dist/esm/tabs/styles.js.map +1 -1
- package/dist/esm/theme-provider/design-tokens.d.ts +1 -1
- package/dist/esm/theme-provider/design-tokens.js +2 -2
- package/dist/esm/theme-provider/design-tokens.js.map +1 -1
- package/package.json +6 -6
|
@@ -427,7 +427,8 @@
|
|
|
427
427
|
subscribers.subscribe(subscriber);
|
|
428
428
|
}
|
|
429
429
|
else {
|
|
430
|
-
this.sourceSubscribers =
|
|
430
|
+
this.sourceSubscribers =
|
|
431
|
+
(_a = this.sourceSubscribers) !== null && _a !== void 0 ? _a : new SubscriberSet(this.source);
|
|
431
432
|
this.sourceSubscribers.subscribe(subscriber);
|
|
432
433
|
}
|
|
433
434
|
}
|
|
@@ -571,6 +572,7 @@
|
|
|
571
572
|
watcher = void 0;
|
|
572
573
|
/* eslint-disable-next-line */
|
|
573
574
|
prevValue = prev.propertySource[prev.propertyName];
|
|
575
|
+
/* eslint-disable-next-line @typescript-eslint/no-this-alias */
|
|
574
576
|
watcher = this;
|
|
575
577
|
if (propertySource === prevValue) {
|
|
576
578
|
this.needsRefresh = true;
|
|
@@ -710,6 +712,21 @@
|
|
|
710
712
|
function observable(target, nameOrAccessor) {
|
|
711
713
|
Observable.defineProperty(target, nameOrAccessor);
|
|
712
714
|
}
|
|
715
|
+
/**
|
|
716
|
+
* Decorator: Marks a property getter as having volatile observable dependencies.
|
|
717
|
+
* @param target - The target that the property is defined on.
|
|
718
|
+
* @param name - The property name.
|
|
719
|
+
* @param name - The existing descriptor.
|
|
720
|
+
* @public
|
|
721
|
+
*/
|
|
722
|
+
function volatile(target, name, descriptor) {
|
|
723
|
+
return Object.assign({}, descriptor, {
|
|
724
|
+
get: function () {
|
|
725
|
+
Observable.trackVolatile();
|
|
726
|
+
return descriptor.get.apply(this);
|
|
727
|
+
},
|
|
728
|
+
});
|
|
729
|
+
}
|
|
713
730
|
const contextEvent = FAST.getById(3 /* contextEvent */, () => {
|
|
714
731
|
let current = null;
|
|
715
732
|
return {
|
|
@@ -1131,6 +1148,7 @@
|
|
|
1131
1148
|
this.targetIndex = -1;
|
|
1132
1149
|
}
|
|
1133
1150
|
release() {
|
|
1151
|
+
/* eslint-disable-next-line @typescript-eslint/no-this-alias */
|
|
1134
1152
|
sharedContext = this;
|
|
1135
1153
|
}
|
|
1136
1154
|
static borrow(directives) {
|
|
@@ -1609,8 +1627,6 @@
|
|
|
1609
1627
|
class ElementStyles {
|
|
1610
1628
|
constructor() {
|
|
1611
1629
|
this.targets = new WeakSet();
|
|
1612
|
-
/** @internal */
|
|
1613
|
-
this.behaviors = null;
|
|
1614
1630
|
}
|
|
1615
1631
|
/** @internal */
|
|
1616
1632
|
addStylesTo(target) {
|
|
@@ -4305,11 +4321,13 @@
|
|
|
4305
4321
|
});
|
|
4306
4322
|
}
|
|
4307
4323
|
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4324
|
+
/**
|
|
4325
|
+
* Standard orientation values
|
|
4326
|
+
*/
|
|
4327
|
+
const Orientation = {
|
|
4328
|
+
horizontal: "horizontal",
|
|
4329
|
+
vertical: "vertical",
|
|
4330
|
+
};
|
|
4313
4331
|
|
|
4314
4332
|
/**
|
|
4315
4333
|
* Returns the index of the last element in the array where predicate is true, and -1 otherwise.
|
|
@@ -4533,6 +4551,17 @@
|
|
|
4533
4551
|
function limit(min, max, value) {
|
|
4534
4552
|
return Math.min(Math.max(value, min), max);
|
|
4535
4553
|
}
|
|
4554
|
+
/**
|
|
4555
|
+
* Determines if a number value is within a specified range.
|
|
4556
|
+
*
|
|
4557
|
+
* @param value - the value to check
|
|
4558
|
+
* @param min - the range start
|
|
4559
|
+
* @param max - the range end
|
|
4560
|
+
*/
|
|
4561
|
+
function inRange(value, min, max = 0) {
|
|
4562
|
+
[min, max] = [min, max].sort((a, b) => a - b);
|
|
4563
|
+
return min <= value && value < max;
|
|
4564
|
+
}
|
|
4536
4565
|
|
|
4537
4566
|
let uniqueIdCounter = 0;
|
|
4538
4567
|
/**
|
|
@@ -4600,67 +4629,73 @@
|
|
|
4600
4629
|
class ARIAGlobalStatesAndProperties {
|
|
4601
4630
|
}
|
|
4602
4631
|
__decorate$1([
|
|
4603
|
-
attr({ attribute: "aria-atomic"
|
|
4632
|
+
attr({ attribute: "aria-atomic" })
|
|
4604
4633
|
], ARIAGlobalStatesAndProperties.prototype, "ariaAtomic", void 0);
|
|
4605
4634
|
__decorate$1([
|
|
4606
|
-
attr({ attribute: "aria-busy"
|
|
4635
|
+
attr({ attribute: "aria-busy" })
|
|
4607
4636
|
], ARIAGlobalStatesAndProperties.prototype, "ariaBusy", void 0);
|
|
4608
4637
|
__decorate$1([
|
|
4609
|
-
attr({ attribute: "aria-controls"
|
|
4638
|
+
attr({ attribute: "aria-controls" })
|
|
4610
4639
|
], ARIAGlobalStatesAndProperties.prototype, "ariaControls", void 0);
|
|
4611
4640
|
__decorate$1([
|
|
4612
|
-
attr({ attribute: "aria-current"
|
|
4641
|
+
attr({ attribute: "aria-current" })
|
|
4613
4642
|
], ARIAGlobalStatesAndProperties.prototype, "ariaCurrent", void 0);
|
|
4614
4643
|
__decorate$1([
|
|
4615
|
-
attr({ attribute: "aria-describedby"
|
|
4644
|
+
attr({ attribute: "aria-describedby" })
|
|
4616
4645
|
], ARIAGlobalStatesAndProperties.prototype, "ariaDescribedby", void 0);
|
|
4617
4646
|
__decorate$1([
|
|
4618
|
-
attr({ attribute: "aria-details"
|
|
4647
|
+
attr({ attribute: "aria-details" })
|
|
4619
4648
|
], ARIAGlobalStatesAndProperties.prototype, "ariaDetails", void 0);
|
|
4620
4649
|
__decorate$1([
|
|
4621
|
-
attr({ attribute: "aria-disabled"
|
|
4650
|
+
attr({ attribute: "aria-disabled" })
|
|
4622
4651
|
], ARIAGlobalStatesAndProperties.prototype, "ariaDisabled", void 0);
|
|
4623
4652
|
__decorate$1([
|
|
4624
|
-
attr({ attribute: "aria-errormessage"
|
|
4653
|
+
attr({ attribute: "aria-errormessage" })
|
|
4625
4654
|
], ARIAGlobalStatesAndProperties.prototype, "ariaErrormessage", void 0);
|
|
4626
4655
|
__decorate$1([
|
|
4627
|
-
attr({ attribute: "aria-flowto"
|
|
4656
|
+
attr({ attribute: "aria-flowto" })
|
|
4628
4657
|
], ARIAGlobalStatesAndProperties.prototype, "ariaFlowto", void 0);
|
|
4629
4658
|
__decorate$1([
|
|
4630
|
-
attr({ attribute: "aria-haspopup"
|
|
4659
|
+
attr({ attribute: "aria-haspopup" })
|
|
4631
4660
|
], ARIAGlobalStatesAndProperties.prototype, "ariaHaspopup", void 0);
|
|
4632
4661
|
__decorate$1([
|
|
4633
|
-
attr({ attribute: "aria-hidden"
|
|
4662
|
+
attr({ attribute: "aria-hidden" })
|
|
4634
4663
|
], ARIAGlobalStatesAndProperties.prototype, "ariaHidden", void 0);
|
|
4635
4664
|
__decorate$1([
|
|
4636
|
-
attr({ attribute: "aria-invalid"
|
|
4665
|
+
attr({ attribute: "aria-invalid" })
|
|
4637
4666
|
], ARIAGlobalStatesAndProperties.prototype, "ariaInvalid", void 0);
|
|
4638
4667
|
__decorate$1([
|
|
4639
|
-
attr({ attribute: "aria-keyshortcuts"
|
|
4668
|
+
attr({ attribute: "aria-keyshortcuts" })
|
|
4640
4669
|
], ARIAGlobalStatesAndProperties.prototype, "ariaKeyshortcuts", void 0);
|
|
4641
4670
|
__decorate$1([
|
|
4642
|
-
attr({ attribute: "aria-label"
|
|
4671
|
+
attr({ attribute: "aria-label" })
|
|
4643
4672
|
], ARIAGlobalStatesAndProperties.prototype, "ariaLabel", void 0);
|
|
4644
4673
|
__decorate$1([
|
|
4645
|
-
attr({ attribute: "aria-labelledby"
|
|
4674
|
+
attr({ attribute: "aria-labelledby" })
|
|
4646
4675
|
], ARIAGlobalStatesAndProperties.prototype, "ariaLabelledby", void 0);
|
|
4647
4676
|
__decorate$1([
|
|
4648
|
-
attr({ attribute: "aria-live"
|
|
4677
|
+
attr({ attribute: "aria-live" })
|
|
4649
4678
|
], ARIAGlobalStatesAndProperties.prototype, "ariaLive", void 0);
|
|
4650
4679
|
__decorate$1([
|
|
4651
|
-
attr({ attribute: "aria-owns"
|
|
4680
|
+
attr({ attribute: "aria-owns" })
|
|
4652
4681
|
], ARIAGlobalStatesAndProperties.prototype, "ariaOwns", void 0);
|
|
4653
4682
|
__decorate$1([
|
|
4654
|
-
attr({ attribute: "aria-relevant"
|
|
4683
|
+
attr({ attribute: "aria-relevant" })
|
|
4655
4684
|
], ARIAGlobalStatesAndProperties.prototype, "ariaRelevant", void 0);
|
|
4656
4685
|
__decorate$1([
|
|
4657
|
-
attr({ attribute: "aria-roledescription"
|
|
4686
|
+
attr({ attribute: "aria-roledescription" })
|
|
4658
4687
|
], ARIAGlobalStatesAndProperties.prototype, "ariaRoledescription", void 0);
|
|
4659
4688
|
|
|
4660
4689
|
/**
|
|
4661
4690
|
* An Anchor Custom HTML Element.
|
|
4662
4691
|
* Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element }.
|
|
4663
4692
|
*
|
|
4693
|
+
* @slot start - Content which can be provided before the anchor content
|
|
4694
|
+
* @slot end - Content which can be provided after the anchor content
|
|
4695
|
+
* @slot - The default slot for anchor content
|
|
4696
|
+
* @csspart control - The anchor element
|
|
4697
|
+
* @csspart content - The element wrapping anchor content
|
|
4698
|
+
*
|
|
4664
4699
|
* @public
|
|
4665
4700
|
*/
|
|
4666
4701
|
class Anchor extends FoundationElement {
|
|
@@ -4675,7 +4710,8 @@
|
|
|
4675
4710
|
var _a;
|
|
4676
4711
|
// Check to see if delegatesFocus is supported
|
|
4677
4712
|
if (window.ShadowRoot &&
|
|
4678
|
-
!window.ShadowRoot.prototype.hasOwnProperty("delegatesFocus") &&
|
|
4713
|
+
!window.ShadowRoot.prototype.hasOwnProperty("delegatesFocus") &&
|
|
4714
|
+
((_a = this.$fastController.definition.shadowOptions) === null || _a === void 0 ? void 0 : _a.delegatesFocus)) {
|
|
4679
4715
|
this.focus = () => {
|
|
4680
4716
|
this.control.focus();
|
|
4681
4717
|
};
|
|
@@ -4725,7 +4761,7 @@
|
|
|
4725
4761
|
class DelegatesARIALink {
|
|
4726
4762
|
}
|
|
4727
4763
|
__decorate$1([
|
|
4728
|
-
attr({ attribute: "aria-expanded"
|
|
4764
|
+
attr({ attribute: "aria-expanded" })
|
|
4729
4765
|
], DelegatesARIALink.prototype, "ariaExpanded", void 0);
|
|
4730
4766
|
applyMixins(DelegatesARIALink, ARIAGlobalStatesAndProperties);
|
|
4731
4767
|
applyMixins(Anchor, StartEnd, DelegatesARIALink);
|
|
@@ -4846,6 +4882,10 @@
|
|
|
4846
4882
|
/**
|
|
4847
4883
|
* An anchored region Custom HTML Element.
|
|
4848
4884
|
*
|
|
4885
|
+
* @slot - The default slot for the content
|
|
4886
|
+
* @fires loaded - Fires a custom 'loaded' event when the region is loaded and visible
|
|
4887
|
+
* @fires positionchange - Fires a custom 'positionchange' event when the position has changed
|
|
4888
|
+
*
|
|
4849
4889
|
* @public
|
|
4850
4890
|
*/
|
|
4851
4891
|
class AnchoredRegion$1 extends FoundationElement {
|
|
@@ -5342,7 +5382,9 @@
|
|
|
5342
5382
|
switch (this.horizontalScaling) {
|
|
5343
5383
|
case "anchor":
|
|
5344
5384
|
case "fill":
|
|
5345
|
-
nextRegionWidth =
|
|
5385
|
+
nextRegionWidth = this.horizontalViewportLock
|
|
5386
|
+
? this.viewportRect.width
|
|
5387
|
+
: nextPositionerDimension.width;
|
|
5346
5388
|
this.regionWidth = `${nextRegionWidth}px`;
|
|
5347
5389
|
break;
|
|
5348
5390
|
case "content":
|
|
@@ -5423,7 +5465,9 @@
|
|
|
5423
5465
|
switch (this.verticalScaling) {
|
|
5424
5466
|
case "anchor":
|
|
5425
5467
|
case "fill":
|
|
5426
|
-
nextRegionHeight =
|
|
5468
|
+
nextRegionHeight = this.verticalViewportLock
|
|
5469
|
+
? this.viewportRect.height
|
|
5470
|
+
: nextPositionerDimension.height;
|
|
5427
5471
|
this.regionHeight = `${nextRegionHeight}px`;
|
|
5428
5472
|
break;
|
|
5429
5473
|
case "content":
|
|
@@ -5851,6 +5895,8 @@
|
|
|
5851
5895
|
|
|
5852
5896
|
/**
|
|
5853
5897
|
* A Breadcrumb Custom HTML Element.
|
|
5898
|
+
* @slot - The default slot for the breadcrumb items
|
|
5899
|
+
* @csspart list - The element wrapping the slotted items
|
|
5854
5900
|
*
|
|
5855
5901
|
* @public
|
|
5856
5902
|
*/
|
|
@@ -5862,22 +5908,19 @@
|
|
|
5862
5908
|
return;
|
|
5863
5909
|
}
|
|
5864
5910
|
const lastNode = this.slottedBreadcrumbItems[this.slottedBreadcrumbItems.length - 1];
|
|
5865
|
-
this.
|
|
5866
|
-
|
|
5911
|
+
this.slottedBreadcrumbItems.forEach((item) => {
|
|
5912
|
+
const itemIsLastNode = item === lastNode;
|
|
5913
|
+
this.setItemSeparator(item, itemIsLastNode);
|
|
5914
|
+
this.setAriaCurrent(item, itemIsLastNode);
|
|
5915
|
+
});
|
|
5867
5916
|
}
|
|
5868
5917
|
}
|
|
5869
|
-
setItemSeparator(
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
item.separator = true;
|
|
5873
|
-
}
|
|
5874
|
-
});
|
|
5875
|
-
if (lastNode instanceof BreadcrumbItem$1) {
|
|
5876
|
-
lastNode.separator = false;
|
|
5918
|
+
setItemSeparator(item, isLastNode) {
|
|
5919
|
+
if (item instanceof BreadcrumbItem$1) {
|
|
5920
|
+
item.separator = !isLastNode;
|
|
5877
5921
|
}
|
|
5878
5922
|
}
|
|
5879
5923
|
/**
|
|
5880
|
-
* @internal
|
|
5881
5924
|
* Finds href on childnodes in the light DOM or shadow DOM.
|
|
5882
5925
|
* We look in the shadow DOM because we insert an anchor when breadcrumb-item has an href.
|
|
5883
5926
|
*/
|
|
@@ -5893,17 +5936,23 @@
|
|
|
5893
5936
|
return null;
|
|
5894
5937
|
}
|
|
5895
5938
|
/**
|
|
5896
|
-
*
|
|
5939
|
+
* Sets ARIA Current for the current node
|
|
5940
|
+
* If child node with an anchor tag and with href is found then set aria-current to correct value for the child node,
|
|
5941
|
+
* otherwise apply aria-current to the host element, with an href
|
|
5897
5942
|
*/
|
|
5898
|
-
|
|
5899
|
-
const childNodeWithHref = this.findChildWithHref(
|
|
5943
|
+
setAriaCurrent(item, isLastNode) {
|
|
5944
|
+
const childNodeWithHref = this.findChildWithHref(item);
|
|
5900
5945
|
if (childNodeWithHref === null &&
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5946
|
+
item.hasAttribute("href") &&
|
|
5947
|
+
item instanceof BreadcrumbItem$1) {
|
|
5948
|
+
isLastNode
|
|
5949
|
+
? item.setAttribute("aria-current", "page")
|
|
5950
|
+
: item.removeAttribute("aria-current");
|
|
5904
5951
|
}
|
|
5905
5952
|
else if (childNodeWithHref !== null) {
|
|
5906
|
-
|
|
5953
|
+
isLastNode
|
|
5954
|
+
? childNodeWithHref.setAttribute("aria-current", "page")
|
|
5955
|
+
: childNodeWithHref.removeAttribute("aria-current");
|
|
5907
5956
|
}
|
|
5908
5957
|
}
|
|
5909
5958
|
}
|
|
@@ -6444,6 +6493,12 @@
|
|
|
6444
6493
|
* A Button Custom HTML Element.
|
|
6445
6494
|
* Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element }.
|
|
6446
6495
|
*
|
|
6496
|
+
* @slot start - Content which can be provided before the button content
|
|
6497
|
+
* @slot end - Content which can be provided after the button content
|
|
6498
|
+
* @slot - The default slot for button content
|
|
6499
|
+
* @csspart control - The button element
|
|
6500
|
+
* @csspart content - The element wrapping button content
|
|
6501
|
+
*
|
|
6447
6502
|
* @public
|
|
6448
6503
|
*/
|
|
6449
6504
|
class Button$1 extends FormAssociatedButton {
|
|
@@ -6495,7 +6550,8 @@
|
|
|
6495
6550
|
var _a;
|
|
6496
6551
|
// Check to see if delegatesFocus is supported
|
|
6497
6552
|
if (window.ShadowRoot &&
|
|
6498
|
-
!window.ShadowRoot.prototype.hasOwnProperty("delegatesFocus") &&
|
|
6553
|
+
!window.ShadowRoot.prototype.hasOwnProperty("delegatesFocus") &&
|
|
6554
|
+
((_a = this.$fastController.definition.shadowOptions) === null || _a === void 0 ? void 0 : _a.delegatesFocus)) {
|
|
6499
6555
|
this.focus = () => {
|
|
6500
6556
|
this.control.focus();
|
|
6501
6557
|
};
|
|
@@ -6600,10 +6656,10 @@
|
|
|
6600
6656
|
class DelegatesARIAButton {
|
|
6601
6657
|
}
|
|
6602
6658
|
__decorate$1([
|
|
6603
|
-
attr({ attribute: "aria-expanded"
|
|
6659
|
+
attr({ attribute: "aria-expanded" })
|
|
6604
6660
|
], DelegatesARIAButton.prototype, "ariaExpanded", void 0);
|
|
6605
6661
|
__decorate$1([
|
|
6606
|
-
attr({ attribute: "aria-pressed"
|
|
6662
|
+
attr({ attribute: "aria-pressed" })
|
|
6607
6663
|
], DelegatesARIAButton.prototype, "ariaPressed", void 0);
|
|
6608
6664
|
applyMixins(DelegatesARIAButton, ARIAGlobalStatesAndProperties);
|
|
6609
6665
|
applyMixins(Button$1, StartEnd, DelegatesARIAButton);
|
|
@@ -6661,6 +6717,13 @@
|
|
|
6661
6717
|
* A Checkbox Custom HTML Element.
|
|
6662
6718
|
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#checkbox | ARIA checkbox }.
|
|
6663
6719
|
*
|
|
6720
|
+
* @slot checked-indicator - The checked indicator
|
|
6721
|
+
* @slot indeterminate-indicator - The indeterminate indicator
|
|
6722
|
+
* @slot - The default slot for the label
|
|
6723
|
+
* @csspart control - The element representing the visual checkbox control
|
|
6724
|
+
* @csspart label - The label
|
|
6725
|
+
* @fires change - Emits a custom change event when the checked state changes
|
|
6726
|
+
*
|
|
6664
6727
|
* @public
|
|
6665
6728
|
*/
|
|
6666
6729
|
class Checkbox$1 extends FormAssociatedCheckbox {
|
|
@@ -6728,6 +6791,11 @@
|
|
|
6728
6791
|
* An Option Custom HTML Element.
|
|
6729
6792
|
* Implements {@link https://www.w3.org/TR/wai-aria-1.1/#option | ARIA option }.
|
|
6730
6793
|
*
|
|
6794
|
+
* @slot start - Content which can be provided before the listbox option content
|
|
6795
|
+
* @slot end - Content which can be provided after the listbox option content
|
|
6796
|
+
* @slot - The default slot for listbox option content
|
|
6797
|
+
* @csspart content - Wraps the listbox option content
|
|
6798
|
+
*
|
|
6731
6799
|
* @public
|
|
6732
6800
|
*/
|
|
6733
6801
|
class ListboxOption extends FoundationElement {
|
|
@@ -6781,7 +6849,20 @@
|
|
|
6781
6849
|
this.ariaChecked = next ? "true" : "false";
|
|
6782
6850
|
return;
|
|
6783
6851
|
}
|
|
6784
|
-
this.ariaChecked =
|
|
6852
|
+
this.ariaChecked = null;
|
|
6853
|
+
}
|
|
6854
|
+
/**
|
|
6855
|
+
* Updates the proxy's text content when the default slot changes.
|
|
6856
|
+
* @param prev - the previous content value
|
|
6857
|
+
* @param next - the current content value
|
|
6858
|
+
*
|
|
6859
|
+
* @internal
|
|
6860
|
+
*/
|
|
6861
|
+
contentChanged(prev, next) {
|
|
6862
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
6863
|
+
this.proxy.textContent = this.textContent;
|
|
6864
|
+
}
|
|
6865
|
+
this.$emit("contentchange", null, { bubbles: true });
|
|
6785
6866
|
}
|
|
6786
6867
|
defaultSelectedChanged() {
|
|
6787
6868
|
if (!this.dirtySelected) {
|
|
@@ -6821,24 +6902,26 @@
|
|
|
6821
6902
|
}
|
|
6822
6903
|
}
|
|
6823
6904
|
get label() {
|
|
6824
|
-
var _a
|
|
6825
|
-
return (
|
|
6905
|
+
var _a;
|
|
6906
|
+
return (_a = this.value) !== null && _a !== void 0 ? _a : this.text;
|
|
6826
6907
|
}
|
|
6827
6908
|
get text() {
|
|
6828
|
-
|
|
6909
|
+
var _a, _b;
|
|
6910
|
+
return (_b = (_a = this.textContent) === null || _a === void 0 ? void 0 : _a.replace(/\s+/g, " ").trim()) !== null && _b !== void 0 ? _b : "";
|
|
6829
6911
|
}
|
|
6830
6912
|
set value(next) {
|
|
6831
|
-
|
|
6913
|
+
const newValue = `${next !== null && next !== void 0 ? next : ""}`;
|
|
6914
|
+
this._value = newValue;
|
|
6832
6915
|
this.dirtyValue = true;
|
|
6833
|
-
if (this.proxy instanceof
|
|
6834
|
-
this.proxy.value =
|
|
6916
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
6917
|
+
this.proxy.value = newValue;
|
|
6835
6918
|
}
|
|
6836
6919
|
Observable.notify(this, "value");
|
|
6837
6920
|
}
|
|
6838
6921
|
get value() {
|
|
6839
|
-
var _a
|
|
6922
|
+
var _a;
|
|
6840
6923
|
Observable.track(this, "value");
|
|
6841
|
-
return (
|
|
6924
|
+
return (_a = this._value) !== null && _a !== void 0 ? _a : this.text;
|
|
6842
6925
|
}
|
|
6843
6926
|
get form() {
|
|
6844
6927
|
return this.proxy ? this.proxy.form : null;
|
|
@@ -6847,6 +6930,9 @@
|
|
|
6847
6930
|
__decorate$1([
|
|
6848
6931
|
observable
|
|
6849
6932
|
], ListboxOption.prototype, "checked", void 0);
|
|
6933
|
+
__decorate$1([
|
|
6934
|
+
observable
|
|
6935
|
+
], ListboxOption.prototype, "content", void 0);
|
|
6850
6936
|
__decorate$1([
|
|
6851
6937
|
observable
|
|
6852
6938
|
], ListboxOption.prototype, "defaultSelected", void 0);
|
|
@@ -6888,6 +6974,8 @@
|
|
|
6888
6974
|
* A Listbox Custom HTML Element.
|
|
6889
6975
|
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#listbox | ARIA listbox }.
|
|
6890
6976
|
*
|
|
6977
|
+
* @slot - The default slot for the listbox options
|
|
6978
|
+
*
|
|
6891
6979
|
* @public
|
|
6892
6980
|
*/
|
|
6893
6981
|
class Listbox extends FoundationElement {
|
|
@@ -7197,7 +7285,7 @@
|
|
|
7197
7285
|
* @internal
|
|
7198
7286
|
*/
|
|
7199
7287
|
multipleChanged(prev, next) {
|
|
7200
|
-
this.ariaMultiSelectable = next ? "true" :
|
|
7288
|
+
this.ariaMultiSelectable = next ? "true" : null;
|
|
7201
7289
|
}
|
|
7202
7290
|
/**
|
|
7203
7291
|
* Updates the list of selected options when the `selectedIndex` changes.
|
|
@@ -7360,7 +7448,7 @@
|
|
|
7360
7448
|
* @param n - element to filter
|
|
7361
7449
|
* @public
|
|
7362
7450
|
*/
|
|
7363
|
-
Listbox.slottedOptionFilter = (n) => isListboxOption(n) && !n.
|
|
7451
|
+
Listbox.slottedOptionFilter = (n) => isListboxOption(n) && !n.hidden;
|
|
7364
7452
|
/**
|
|
7365
7453
|
* Typeahead timeout in milliseconds.
|
|
7366
7454
|
*
|
|
@@ -7370,9 +7458,6 @@
|
|
|
7370
7458
|
__decorate$1([
|
|
7371
7459
|
attr({ mode: "boolean" })
|
|
7372
7460
|
], Listbox.prototype, "disabled", void 0);
|
|
7373
|
-
__decorate$1([
|
|
7374
|
-
attr({ mode: "boolean" })
|
|
7375
|
-
], Listbox.prototype, "multiple", void 0);
|
|
7376
7461
|
__decorate$1([
|
|
7377
7462
|
observable
|
|
7378
7463
|
], Listbox.prototype, "selectedIndex", void 0);
|
|
@@ -7411,11 +7496,10 @@
|
|
|
7411
7496
|
* Positioning directions for the listbox when a select is open.
|
|
7412
7497
|
* @public
|
|
7413
7498
|
*/
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
})(SelectPosition || (SelectPosition = {}));
|
|
7499
|
+
const SelectPosition = {
|
|
7500
|
+
above: "above",
|
|
7501
|
+
below: "below",
|
|
7502
|
+
};
|
|
7419
7503
|
|
|
7420
7504
|
/**
|
|
7421
7505
|
* Retrieves the "composed parent" element of a node, ignoring DOM tree boundaries.
|
|
@@ -7463,96 +7547,6 @@
|
|
|
7463
7547
|
return false;
|
|
7464
7548
|
}
|
|
7465
7549
|
|
|
7466
|
-
/**
|
|
7467
|
-
* A behavior to add or remove a stylesheet from an element based on a property. The behavior ensures that
|
|
7468
|
-
* styles are applied while the property matches and that styles are not applied if the property does
|
|
7469
|
-
* not match.
|
|
7470
|
-
*
|
|
7471
|
-
* @public
|
|
7472
|
-
*/
|
|
7473
|
-
class PropertyStyleSheetBehavior {
|
|
7474
|
-
/**
|
|
7475
|
-
* Constructs a {@link PropertyStyleSheetBehavior} instance.
|
|
7476
|
-
* @param propertyName - The property name to operate from.
|
|
7477
|
-
* @param value - The property value to operate from.
|
|
7478
|
-
* @param styles - The styles to coordinate with the property.
|
|
7479
|
-
*/
|
|
7480
|
-
constructor(propertyName, value, styles) {
|
|
7481
|
-
this.propertyName = propertyName;
|
|
7482
|
-
this.value = value;
|
|
7483
|
-
this.styles = styles;
|
|
7484
|
-
}
|
|
7485
|
-
/**
|
|
7486
|
-
* Binds the behavior to the element.
|
|
7487
|
-
* @param elementInstance - The element for which the property is applied.
|
|
7488
|
-
*/
|
|
7489
|
-
bind(elementInstance) {
|
|
7490
|
-
Observable.getNotifier(elementInstance).subscribe(this, this.propertyName);
|
|
7491
|
-
this.handleChange(elementInstance, this.propertyName);
|
|
7492
|
-
}
|
|
7493
|
-
/**
|
|
7494
|
-
* Unbinds the behavior from the element.
|
|
7495
|
-
* @param source - The element for which the behavior is unbinding.
|
|
7496
|
-
* @internal
|
|
7497
|
-
*/
|
|
7498
|
-
unbind(source) {
|
|
7499
|
-
Observable.getNotifier(source).unsubscribe(this, this.propertyName);
|
|
7500
|
-
source.$fastController.removeStyles(this.styles);
|
|
7501
|
-
}
|
|
7502
|
-
/**
|
|
7503
|
-
* Change event for the provided element.
|
|
7504
|
-
* @param source - the element for which to attach or detach styles.
|
|
7505
|
-
* @param key - the key to lookup to know if the element already has the styles
|
|
7506
|
-
* @internal
|
|
7507
|
-
*/
|
|
7508
|
-
handleChange(source, key) {
|
|
7509
|
-
if (source[key] === this.value) {
|
|
7510
|
-
source.$fastController.addStyles(this.styles);
|
|
7511
|
-
}
|
|
7512
|
-
else {
|
|
7513
|
-
source.$fastController.removeStyles(this.styles);
|
|
7514
|
-
}
|
|
7515
|
-
}
|
|
7516
|
-
}
|
|
7517
|
-
|
|
7518
|
-
/**
|
|
7519
|
-
* A CSS fragment to set `display: none;` when the host is hidden using the [hidden] attribute.
|
|
7520
|
-
* @public
|
|
7521
|
-
*/
|
|
7522
|
-
const hidden = `:host([hidden]){display:none}`;
|
|
7523
|
-
/**
|
|
7524
|
-
* Applies a CSS display property.
|
|
7525
|
-
* Also adds CSS rules to not display the element when the [hidden] attribute is applied to the element.
|
|
7526
|
-
* @param display - The CSS display property value
|
|
7527
|
-
* @public
|
|
7528
|
-
*/
|
|
7529
|
-
function display(displayValue) {
|
|
7530
|
-
return `${hidden}:host{display:${displayValue}}`;
|
|
7531
|
-
}
|
|
7532
|
-
|
|
7533
|
-
/**
|
|
7534
|
-
* The string representing the focus selector to be used. Value
|
|
7535
|
-
* will be "focus-visible" when https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo
|
|
7536
|
-
* is supported and "focus" when it is not.
|
|
7537
|
-
*
|
|
7538
|
-
* @public
|
|
7539
|
-
*/
|
|
7540
|
-
const focusVisible$1 = canUseFocusVisible() ? "focus-visible" : "focus";
|
|
7541
|
-
|
|
7542
|
-
/**
|
|
7543
|
-
* a method to filter out any whitespace _only_ nodes, to be used inside a template
|
|
7544
|
-
* @param value - The Node that is being inspected
|
|
7545
|
-
* @param index - The index of the node within the array
|
|
7546
|
-
* @param array - The Node array that is being filtered
|
|
7547
|
-
*
|
|
7548
|
-
* @public
|
|
7549
|
-
*/
|
|
7550
|
-
function whitespaceFilter(value, index, array) {
|
|
7551
|
-
return value.nodeType !== Node.TEXT_NODE
|
|
7552
|
-
? true
|
|
7553
|
-
: typeof value.nodeValue === "string" && !!value.nodeValue.trim().length;
|
|
7554
|
-
}
|
|
7555
|
-
|
|
7556
7550
|
const defaultElement = document.createElement("div");
|
|
7557
7551
|
function isFastElement(element) {
|
|
7558
7552
|
return element instanceof FASTElement;
|
|
@@ -8848,6 +8842,13 @@
|
|
|
8848
8842
|
* A Switch Custom HTML Element.
|
|
8849
8843
|
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#dialog | ARIA dialog }.
|
|
8850
8844
|
*
|
|
8845
|
+
* @slot - The default slot for the dialog content
|
|
8846
|
+
* @csspart positioning-region - A wrapping element used to center the dialog and position the modal overlay
|
|
8847
|
+
* @csspart overlay - The modal dialog overlay
|
|
8848
|
+
* @csspart control - The dialog element
|
|
8849
|
+
* @fires cancel - Fires a custom 'cancel' event when the modal overlay is clicked
|
|
8850
|
+
* @fires close - Fires a custom 'close' event when the dialog is hidden
|
|
8851
|
+
*
|
|
8851
8852
|
* @public
|
|
8852
8853
|
*/
|
|
8853
8854
|
class Dialog extends FoundationElement {
|
|
@@ -8993,6 +8994,8 @@
|
|
|
8993
8994
|
*/
|
|
8994
8995
|
dismiss() {
|
|
8995
8996
|
this.$emit("dismiss");
|
|
8997
|
+
// implement `<dialog>` interface
|
|
8998
|
+
this.$emit("cancel");
|
|
8996
8999
|
}
|
|
8997
9000
|
/**
|
|
8998
9001
|
* The method to show the dialog.
|
|
@@ -9009,6 +9012,8 @@
|
|
|
9009
9012
|
*/
|
|
9010
9013
|
hide() {
|
|
9011
9014
|
this.hidden = true;
|
|
9015
|
+
// implement `<dialog>` interface
|
|
9016
|
+
this.$emit("close");
|
|
9012
9017
|
}
|
|
9013
9018
|
/**
|
|
9014
9019
|
* @internal
|
|
@@ -9125,95 +9130,556 @@
|
|
|
9125
9130
|
>
|
|
9126
9131
|
${startSlotTemplate(context, definition)}
|
|
9127
9132
|
<span class="content" part="content">
|
|
9128
|
-
<slot></slot>
|
|
9133
|
+
<slot ${slotted("content")}></slot>
|
|
9129
9134
|
</span>
|
|
9130
9135
|
${endSlotTemplate(context, definition)}
|
|
9131
9136
|
</template>
|
|
9132
9137
|
`;
|
|
9133
9138
|
|
|
9134
9139
|
/**
|
|
9135
|
-
*
|
|
9136
|
-
* @
|
|
9137
|
-
*/
|
|
9138
|
-
var MenuItemRole;
|
|
9139
|
-
(function (MenuItemRole) {
|
|
9140
|
-
/**
|
|
9141
|
-
* The menu item has a "menuitem" role
|
|
9142
|
-
*/
|
|
9143
|
-
MenuItemRole["menuitem"] = "menuitem";
|
|
9144
|
-
/**
|
|
9145
|
-
* The menu item has a "menuitemcheckbox" role
|
|
9146
|
-
*/
|
|
9147
|
-
MenuItemRole["menuitemcheckbox"] = "menuitemcheckbox";
|
|
9148
|
-
/**
|
|
9149
|
-
* The menu item has a "menuitemradio" role
|
|
9150
|
-
*/
|
|
9151
|
-
MenuItemRole["menuitemradio"] = "menuitemradio";
|
|
9152
|
-
})(MenuItemRole || (MenuItemRole = {}));
|
|
9153
|
-
/**
|
|
9154
|
-
* @internal
|
|
9155
|
-
*/
|
|
9156
|
-
const roleForMenuItem = {
|
|
9157
|
-
[MenuItemRole.menuitem]: "menuitem",
|
|
9158
|
-
[MenuItemRole.menuitemcheckbox]: "menuitemcheckbox",
|
|
9159
|
-
[MenuItemRole.menuitemradio]: "menuitemradio",
|
|
9160
|
-
};
|
|
9161
|
-
|
|
9162
|
-
/**
|
|
9163
|
-
* A Switch Custom HTML Element.
|
|
9164
|
-
* Implements {@link https://www.w3.org/TR/wai-aria-1.1/#menuitem | ARIA menuitem }, {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemcheckbox | ARIA menuitemcheckbox}, or {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemradio | ARIA menuitemradio }.
|
|
9140
|
+
* A Listbox Custom HTML Element.
|
|
9141
|
+
* Implements the {@link https://w3c.github.io/aria/#listbox | ARIA listbox }.
|
|
9165
9142
|
*
|
|
9166
9143
|
* @public
|
|
9167
9144
|
*/
|
|
9168
|
-
class
|
|
9145
|
+
class ListboxElement extends Listbox {
|
|
9169
9146
|
constructor() {
|
|
9170
9147
|
super(...arguments);
|
|
9171
9148
|
/**
|
|
9172
|
-
* The
|
|
9149
|
+
* The index of the most recently checked option.
|
|
9173
9150
|
*
|
|
9174
|
-
* @public
|
|
9175
|
-
* @remarks
|
|
9176
|
-
* HTML Attribute: role
|
|
9177
|
-
*/
|
|
9178
|
-
this.role = MenuItemRole.menuitem;
|
|
9179
|
-
/**
|
|
9180
9151
|
* @internal
|
|
9152
|
+
* @remarks
|
|
9153
|
+
* Multiple-selection mode only.
|
|
9181
9154
|
*/
|
|
9182
|
-
this.
|
|
9155
|
+
this.activeIndex = -1;
|
|
9183
9156
|
/**
|
|
9184
|
-
*
|
|
9157
|
+
* The start index when checking a range of options.
|
|
9185
9158
|
*
|
|
9186
9159
|
* @internal
|
|
9187
9160
|
*/
|
|
9188
|
-
this.
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9161
|
+
this.rangeStartIndex = -1;
|
|
9162
|
+
}
|
|
9163
|
+
/**
|
|
9164
|
+
* Returns the last checked option.
|
|
9165
|
+
*
|
|
9166
|
+
* @internal
|
|
9167
|
+
*/
|
|
9168
|
+
get activeOption() {
|
|
9169
|
+
return this.options[this.activeIndex];
|
|
9170
|
+
}
|
|
9171
|
+
/**
|
|
9172
|
+
* Returns the list of checked options.
|
|
9173
|
+
*
|
|
9174
|
+
* @internal
|
|
9175
|
+
*/
|
|
9176
|
+
get checkedOptions() {
|
|
9177
|
+
var _a;
|
|
9178
|
+
return (_a = this.options) === null || _a === void 0 ? void 0 : _a.filter(o => o.checked);
|
|
9179
|
+
}
|
|
9180
|
+
/**
|
|
9181
|
+
* Returns the index of the first selected option.
|
|
9182
|
+
*
|
|
9183
|
+
* @internal
|
|
9184
|
+
*/
|
|
9185
|
+
get firstSelectedOptionIndex() {
|
|
9186
|
+
return this.options.indexOf(this.firstSelectedOption);
|
|
9187
|
+
}
|
|
9188
|
+
/**
|
|
9189
|
+
* Updates the `ariaActiveDescendant` property when the active index changes.
|
|
9190
|
+
*
|
|
9191
|
+
* @param prev - the previous active index
|
|
9192
|
+
* @param next - the next active index
|
|
9193
|
+
*
|
|
9194
|
+
* @internal
|
|
9195
|
+
*/
|
|
9196
|
+
activeIndexChanged(prev, next) {
|
|
9197
|
+
var _a, _b;
|
|
9198
|
+
this.ariaActiveDescendant = (_b = (_a = this.options[next]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : "";
|
|
9199
|
+
this.focusAndScrollOptionIntoView();
|
|
9200
|
+
}
|
|
9201
|
+
/**
|
|
9202
|
+
* Toggles the checked state for the currently active option.
|
|
9203
|
+
*
|
|
9204
|
+
* @remarks
|
|
9205
|
+
* Multiple-selection mode only.
|
|
9206
|
+
*
|
|
9207
|
+
* @internal
|
|
9208
|
+
*/
|
|
9209
|
+
checkActiveIndex() {
|
|
9210
|
+
if (!this.multiple) {
|
|
9211
|
+
return;
|
|
9212
|
+
}
|
|
9213
|
+
const activeItem = this.activeOption;
|
|
9214
|
+
if (activeItem) {
|
|
9215
|
+
activeItem.checked = true;
|
|
9216
|
+
}
|
|
9217
|
+
}
|
|
9218
|
+
/**
|
|
9219
|
+
* Sets the active index to the first option and marks it as checked.
|
|
9220
|
+
*
|
|
9221
|
+
* @remarks
|
|
9222
|
+
* Multi-selection mode only.
|
|
9223
|
+
*
|
|
9224
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
9225
|
+
*
|
|
9226
|
+
* @internal
|
|
9227
|
+
*/
|
|
9228
|
+
checkFirstOption(preserveChecked = false) {
|
|
9229
|
+
if (preserveChecked) {
|
|
9230
|
+
if (this.rangeStartIndex === -1) {
|
|
9231
|
+
this.rangeStartIndex = this.activeIndex + 1;
|
|
9196
9232
|
}
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
|
|
9202
|
-
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
|
-
|
|
9207
|
-
|
|
9208
|
-
|
|
9209
|
-
|
|
9210
|
-
|
|
9211
|
-
|
|
9212
|
-
|
|
9233
|
+
this.options.forEach((o, i) => {
|
|
9234
|
+
o.checked = inRange(i, this.rangeStartIndex);
|
|
9235
|
+
});
|
|
9236
|
+
}
|
|
9237
|
+
else {
|
|
9238
|
+
this.uncheckAllOptions();
|
|
9239
|
+
}
|
|
9240
|
+
this.activeIndex = 0;
|
|
9241
|
+
this.checkActiveIndex();
|
|
9242
|
+
}
|
|
9243
|
+
/**
|
|
9244
|
+
* Decrements the active index and sets the matching option as checked.
|
|
9245
|
+
*
|
|
9246
|
+
* @remarks
|
|
9247
|
+
* Multi-selection mode only.
|
|
9248
|
+
*
|
|
9249
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
9250
|
+
*
|
|
9251
|
+
* @internal
|
|
9252
|
+
*/
|
|
9253
|
+
checkLastOption(preserveChecked = false) {
|
|
9254
|
+
if (preserveChecked) {
|
|
9255
|
+
if (this.rangeStartIndex === -1) {
|
|
9256
|
+
this.rangeStartIndex = this.activeIndex;
|
|
9213
9257
|
}
|
|
9214
|
-
|
|
9215
|
-
|
|
9216
|
-
|
|
9258
|
+
this.options.forEach((o, i) => {
|
|
9259
|
+
o.checked = inRange(i, this.rangeStartIndex, this.options.length);
|
|
9260
|
+
});
|
|
9261
|
+
}
|
|
9262
|
+
else {
|
|
9263
|
+
this.uncheckAllOptions();
|
|
9264
|
+
}
|
|
9265
|
+
this.activeIndex = this.options.length - 1;
|
|
9266
|
+
this.checkActiveIndex();
|
|
9267
|
+
}
|
|
9268
|
+
/**
|
|
9269
|
+
* @override
|
|
9270
|
+
* @internal
|
|
9271
|
+
*/
|
|
9272
|
+
connectedCallback() {
|
|
9273
|
+
super.connectedCallback();
|
|
9274
|
+
this.addEventListener("focusout", this.focusoutHandler);
|
|
9275
|
+
}
|
|
9276
|
+
/**
|
|
9277
|
+
* @override
|
|
9278
|
+
* @internal
|
|
9279
|
+
*/
|
|
9280
|
+
disconnectedCallback() {
|
|
9281
|
+
this.removeEventListener("focusout", this.focusoutHandler);
|
|
9282
|
+
super.disconnectedCallback();
|
|
9283
|
+
}
|
|
9284
|
+
/**
|
|
9285
|
+
* Increments the active index and marks the matching option as checked.
|
|
9286
|
+
*
|
|
9287
|
+
* @remarks
|
|
9288
|
+
* Multiple-selection mode only.
|
|
9289
|
+
*
|
|
9290
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
9291
|
+
*
|
|
9292
|
+
* @internal
|
|
9293
|
+
*/
|
|
9294
|
+
checkNextOption(preserveChecked = false) {
|
|
9295
|
+
if (preserveChecked) {
|
|
9296
|
+
if (this.rangeStartIndex === -1) {
|
|
9297
|
+
this.rangeStartIndex = this.activeIndex;
|
|
9298
|
+
}
|
|
9299
|
+
this.options.forEach((o, i) => {
|
|
9300
|
+
o.checked = inRange(i, this.rangeStartIndex, this.activeIndex + 1);
|
|
9301
|
+
});
|
|
9302
|
+
}
|
|
9303
|
+
else {
|
|
9304
|
+
this.uncheckAllOptions();
|
|
9305
|
+
}
|
|
9306
|
+
this.activeIndex += this.activeIndex < this.options.length - 1 ? 1 : 0;
|
|
9307
|
+
this.checkActiveIndex();
|
|
9308
|
+
}
|
|
9309
|
+
/**
|
|
9310
|
+
* Decrements the active index and marks the matching option as checked.
|
|
9311
|
+
*
|
|
9312
|
+
* @remarks
|
|
9313
|
+
* Multiple-selection mode only.
|
|
9314
|
+
*
|
|
9315
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
9316
|
+
*
|
|
9317
|
+
* @internal
|
|
9318
|
+
*/
|
|
9319
|
+
checkPreviousOption(preserveChecked = false) {
|
|
9320
|
+
if (preserveChecked) {
|
|
9321
|
+
if (this.rangeStartIndex === -1) {
|
|
9322
|
+
this.rangeStartIndex = this.activeIndex;
|
|
9323
|
+
}
|
|
9324
|
+
if (this.checkedOptions.length === 1) {
|
|
9325
|
+
this.rangeStartIndex += 1;
|
|
9326
|
+
}
|
|
9327
|
+
this.options.forEach((o, i) => {
|
|
9328
|
+
o.checked = inRange(i, this.activeIndex, this.rangeStartIndex);
|
|
9329
|
+
});
|
|
9330
|
+
}
|
|
9331
|
+
else {
|
|
9332
|
+
this.uncheckAllOptions();
|
|
9333
|
+
}
|
|
9334
|
+
this.activeIndex -= this.activeIndex > 0 ? 1 : 0;
|
|
9335
|
+
this.checkActiveIndex();
|
|
9336
|
+
}
|
|
9337
|
+
/**
|
|
9338
|
+
* Handles click events for listbox options.
|
|
9339
|
+
*
|
|
9340
|
+
* @param e - the event object
|
|
9341
|
+
*
|
|
9342
|
+
* @override
|
|
9343
|
+
* @internal
|
|
9344
|
+
*/
|
|
9345
|
+
clickHandler(e) {
|
|
9346
|
+
var _a;
|
|
9347
|
+
if (!this.multiple) {
|
|
9348
|
+
return super.clickHandler(e);
|
|
9349
|
+
}
|
|
9350
|
+
const captured = (_a = e.target) === null || _a === void 0 ? void 0 : _a.closest(`[role=option]`);
|
|
9351
|
+
if (!captured || captured.disabled) {
|
|
9352
|
+
return;
|
|
9353
|
+
}
|
|
9354
|
+
this.uncheckAllOptions();
|
|
9355
|
+
this.activeIndex = this.options.indexOf(captured);
|
|
9356
|
+
this.checkActiveIndex();
|
|
9357
|
+
this.toggleSelectedForAllCheckedOptions();
|
|
9358
|
+
return true;
|
|
9359
|
+
}
|
|
9360
|
+
/**
|
|
9361
|
+
* @override
|
|
9362
|
+
* @internal
|
|
9363
|
+
*/
|
|
9364
|
+
focusAndScrollOptionIntoView() {
|
|
9365
|
+
super.focusAndScrollOptionIntoView(this.activeOption);
|
|
9366
|
+
}
|
|
9367
|
+
/**
|
|
9368
|
+
* In multiple-selection mode:
|
|
9369
|
+
* If any options are selected, the first selected option is checked when
|
|
9370
|
+
* the listbox receives focus. If no options are selected, the first
|
|
9371
|
+
* selectable option is checked.
|
|
9372
|
+
*
|
|
9373
|
+
* @override
|
|
9374
|
+
* @internal
|
|
9375
|
+
*/
|
|
9376
|
+
focusinHandler(e) {
|
|
9377
|
+
if (!this.multiple) {
|
|
9378
|
+
return super.focusinHandler(e);
|
|
9379
|
+
}
|
|
9380
|
+
if (!this.shouldSkipFocus && e.target === e.currentTarget) {
|
|
9381
|
+
this.uncheckAllOptions();
|
|
9382
|
+
if (this.activeIndex === -1) {
|
|
9383
|
+
this.activeIndex =
|
|
9384
|
+
this.firstSelectedOptionIndex !== -1
|
|
9385
|
+
? this.firstSelectedOptionIndex
|
|
9386
|
+
: 0;
|
|
9387
|
+
}
|
|
9388
|
+
this.checkActiveIndex();
|
|
9389
|
+
this.setSelectedOptions();
|
|
9390
|
+
this.focusAndScrollOptionIntoView();
|
|
9391
|
+
}
|
|
9392
|
+
this.shouldSkipFocus = false;
|
|
9393
|
+
}
|
|
9394
|
+
/**
|
|
9395
|
+
* Unchecks all options when the listbox loses focus.
|
|
9396
|
+
*
|
|
9397
|
+
* @internal
|
|
9398
|
+
*/
|
|
9399
|
+
focusoutHandler(e) {
|
|
9400
|
+
if (this.multiple) {
|
|
9401
|
+
this.uncheckAllOptions();
|
|
9402
|
+
}
|
|
9403
|
+
}
|
|
9404
|
+
/**
|
|
9405
|
+
* Handles keydown actions for listbox navigation and typeahead
|
|
9406
|
+
*
|
|
9407
|
+
* @override
|
|
9408
|
+
* @internal
|
|
9409
|
+
*/
|
|
9410
|
+
keydownHandler(e) {
|
|
9411
|
+
if (!this.multiple) {
|
|
9412
|
+
return super.keydownHandler(e);
|
|
9413
|
+
}
|
|
9414
|
+
if (this.disabled) {
|
|
9415
|
+
return true;
|
|
9416
|
+
}
|
|
9417
|
+
const { key, shiftKey } = e;
|
|
9418
|
+
this.shouldSkipFocus = false;
|
|
9419
|
+
switch (key) {
|
|
9420
|
+
// Select the first available option
|
|
9421
|
+
case keyHome: {
|
|
9422
|
+
this.checkFirstOption(shiftKey);
|
|
9423
|
+
return;
|
|
9424
|
+
}
|
|
9425
|
+
// Select the next selectable option
|
|
9426
|
+
case keyArrowDown: {
|
|
9427
|
+
this.checkNextOption(shiftKey);
|
|
9428
|
+
return;
|
|
9429
|
+
}
|
|
9430
|
+
// Select the previous selectable option
|
|
9431
|
+
case keyArrowUp: {
|
|
9432
|
+
this.checkPreviousOption(shiftKey);
|
|
9433
|
+
return;
|
|
9434
|
+
}
|
|
9435
|
+
// Select the last available option
|
|
9436
|
+
case keyEnd: {
|
|
9437
|
+
this.checkLastOption(shiftKey);
|
|
9438
|
+
return;
|
|
9439
|
+
}
|
|
9440
|
+
case keyTab: {
|
|
9441
|
+
this.focusAndScrollOptionIntoView();
|
|
9442
|
+
return true;
|
|
9443
|
+
}
|
|
9444
|
+
case keyEscape: {
|
|
9445
|
+
this.uncheckAllOptions();
|
|
9446
|
+
this.checkActiveIndex();
|
|
9447
|
+
return true;
|
|
9448
|
+
}
|
|
9449
|
+
case keySpace: {
|
|
9450
|
+
e.preventDefault();
|
|
9451
|
+
if (this.typeAheadExpired) {
|
|
9452
|
+
this.toggleSelectedForAllCheckedOptions();
|
|
9453
|
+
return;
|
|
9454
|
+
}
|
|
9455
|
+
}
|
|
9456
|
+
// Send key to Typeahead handler
|
|
9457
|
+
default: {
|
|
9458
|
+
if (key.length === 1) {
|
|
9459
|
+
this.handleTypeAhead(`${key}`);
|
|
9460
|
+
}
|
|
9461
|
+
return true;
|
|
9462
|
+
}
|
|
9463
|
+
}
|
|
9464
|
+
}
|
|
9465
|
+
/**
|
|
9466
|
+
* Prevents `focusin` events from firing before `click` events when the
|
|
9467
|
+
* element is unfocused.
|
|
9468
|
+
*
|
|
9469
|
+
* @override
|
|
9470
|
+
* @internal
|
|
9471
|
+
*/
|
|
9472
|
+
mousedownHandler(e) {
|
|
9473
|
+
if (e.offsetX >= 0 && e.offsetX <= this.scrollWidth) {
|
|
9474
|
+
return super.mousedownHandler(e);
|
|
9475
|
+
}
|
|
9476
|
+
}
|
|
9477
|
+
/**
|
|
9478
|
+
* Switches between single-selection and multi-selection mode.
|
|
9479
|
+
*
|
|
9480
|
+
* @internal
|
|
9481
|
+
*/
|
|
9482
|
+
multipleChanged(prev, next) {
|
|
9483
|
+
var _a;
|
|
9484
|
+
this.ariaMultiSelectable = next ? "true" : null;
|
|
9485
|
+
(_a = this.options) === null || _a === void 0 ? void 0 : _a.forEach(o => {
|
|
9486
|
+
o.checked = next ? false : undefined;
|
|
9487
|
+
});
|
|
9488
|
+
this.setSelectedOptions();
|
|
9489
|
+
}
|
|
9490
|
+
/**
|
|
9491
|
+
* Sets an option as selected and gives it focus.
|
|
9492
|
+
*
|
|
9493
|
+
* @override
|
|
9494
|
+
* @public
|
|
9495
|
+
*/
|
|
9496
|
+
setSelectedOptions() {
|
|
9497
|
+
if (!this.multiple) {
|
|
9498
|
+
super.setSelectedOptions();
|
|
9499
|
+
return;
|
|
9500
|
+
}
|
|
9501
|
+
if (this.$fastController.isConnected && this.options) {
|
|
9502
|
+
this.selectedOptions = this.options.filter(o => o.selected);
|
|
9503
|
+
this.focusAndScrollOptionIntoView();
|
|
9504
|
+
}
|
|
9505
|
+
}
|
|
9506
|
+
/**
|
|
9507
|
+
* Ensures the size is a positive integer when the property is updated.
|
|
9508
|
+
*
|
|
9509
|
+
* @param prev - the previous size value
|
|
9510
|
+
* @param next - the current size value
|
|
9511
|
+
*
|
|
9512
|
+
* @internal
|
|
9513
|
+
*/
|
|
9514
|
+
sizeChanged(prev, next) {
|
|
9515
|
+
var _a;
|
|
9516
|
+
const size = Math.max(0, parseInt((_a = next === null || next === void 0 ? void 0 : next.toFixed()) !== null && _a !== void 0 ? _a : "", 10));
|
|
9517
|
+
if (size !== next) {
|
|
9518
|
+
DOM.queueUpdate(() => {
|
|
9519
|
+
this.size = size;
|
|
9520
|
+
});
|
|
9521
|
+
}
|
|
9522
|
+
}
|
|
9523
|
+
/**
|
|
9524
|
+
* Toggles the selected state of the provided options. If any provided items
|
|
9525
|
+
* are in an unselected state, all items are set to selected. If every
|
|
9526
|
+
* provided item is selected, they are all unselected.
|
|
9527
|
+
*
|
|
9528
|
+
* @internal
|
|
9529
|
+
*/
|
|
9530
|
+
toggleSelectedForAllCheckedOptions() {
|
|
9531
|
+
const enabledCheckedOptions = this.checkedOptions.filter(o => !o.disabled);
|
|
9532
|
+
const force = !enabledCheckedOptions.every(o => o.selected);
|
|
9533
|
+
enabledCheckedOptions.forEach(o => (o.selected = force));
|
|
9534
|
+
this.selectedIndex = this.options.indexOf(enabledCheckedOptions[enabledCheckedOptions.length - 1]);
|
|
9535
|
+
this.setSelectedOptions();
|
|
9536
|
+
}
|
|
9537
|
+
/**
|
|
9538
|
+
* @override
|
|
9539
|
+
* @internal
|
|
9540
|
+
*/
|
|
9541
|
+
typeaheadBufferChanged(prev, next) {
|
|
9542
|
+
if (!this.multiple) {
|
|
9543
|
+
super.typeaheadBufferChanged(prev, next);
|
|
9544
|
+
return;
|
|
9545
|
+
}
|
|
9546
|
+
if (this.$fastController.isConnected) {
|
|
9547
|
+
const typeaheadMatches = this.getTypeaheadMatches();
|
|
9548
|
+
const activeIndex = this.options.indexOf(typeaheadMatches[0]);
|
|
9549
|
+
if (activeIndex > -1) {
|
|
9550
|
+
this.activeIndex = activeIndex;
|
|
9551
|
+
this.uncheckAllOptions();
|
|
9552
|
+
this.checkActiveIndex();
|
|
9553
|
+
}
|
|
9554
|
+
this.typeAheadExpired = false;
|
|
9555
|
+
}
|
|
9556
|
+
}
|
|
9557
|
+
/**
|
|
9558
|
+
* Unchecks all options.
|
|
9559
|
+
*
|
|
9560
|
+
* @remarks
|
|
9561
|
+
* Multiple-selection mode only.
|
|
9562
|
+
*
|
|
9563
|
+
* @param preserveChecked - reset the rangeStartIndex
|
|
9564
|
+
*
|
|
9565
|
+
* @internal
|
|
9566
|
+
*/
|
|
9567
|
+
uncheckAllOptions(preserveChecked = false) {
|
|
9568
|
+
this.options.forEach(o => (o.checked = this.multiple ? false : undefined));
|
|
9569
|
+
if (!preserveChecked) {
|
|
9570
|
+
this.rangeStartIndex = -1;
|
|
9571
|
+
}
|
|
9572
|
+
}
|
|
9573
|
+
}
|
|
9574
|
+
__decorate$1([
|
|
9575
|
+
observable
|
|
9576
|
+
], ListboxElement.prototype, "activeIndex", void 0);
|
|
9577
|
+
__decorate$1([
|
|
9578
|
+
attr({ mode: "boolean" })
|
|
9579
|
+
], ListboxElement.prototype, "multiple", void 0);
|
|
9580
|
+
__decorate$1([
|
|
9581
|
+
attr({ converter: nullableNumberConverter })
|
|
9582
|
+
], ListboxElement.prototype, "size", void 0);
|
|
9583
|
+
|
|
9584
|
+
/**
|
|
9585
|
+
* Menu items roles.
|
|
9586
|
+
* @public
|
|
9587
|
+
*/
|
|
9588
|
+
const MenuItemRole = {
|
|
9589
|
+
/**
|
|
9590
|
+
* The menu item has a "menuitem" role
|
|
9591
|
+
*/
|
|
9592
|
+
menuitem: "menuitem",
|
|
9593
|
+
/**
|
|
9594
|
+
* The menu item has a "menuitemcheckbox" role
|
|
9595
|
+
*/
|
|
9596
|
+
menuitemcheckbox: "menuitemcheckbox",
|
|
9597
|
+
/**
|
|
9598
|
+
* The menu item has a "menuitemradio" role
|
|
9599
|
+
*/
|
|
9600
|
+
menuitemradio: "menuitemradio",
|
|
9601
|
+
};
|
|
9602
|
+
/**
|
|
9603
|
+
* @internal
|
|
9604
|
+
*/
|
|
9605
|
+
const roleForMenuItem = {
|
|
9606
|
+
[MenuItemRole.menuitem]: "menuitem",
|
|
9607
|
+
[MenuItemRole.menuitemcheckbox]: "menuitemcheckbox",
|
|
9608
|
+
[MenuItemRole.menuitemradio]: "menuitemradio",
|
|
9609
|
+
};
|
|
9610
|
+
|
|
9611
|
+
/**
|
|
9612
|
+
* A Switch Custom HTML Element.
|
|
9613
|
+
* Implements {@link https://www.w3.org/TR/wai-aria-1.1/#menuitem | ARIA menuitem }, {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemcheckbox | ARIA menuitemcheckbox}, or {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemradio | ARIA menuitemradio }.
|
|
9614
|
+
*
|
|
9615
|
+
* @slot checked-indicator - The checked indicator
|
|
9616
|
+
* @slot radio-indicator - The radio indicator
|
|
9617
|
+
* @slot start - Content which can be provided before the menu item content
|
|
9618
|
+
* @slot end - Content which can be provided after the menu item content
|
|
9619
|
+
* @slot - The default slot for menu item content
|
|
9620
|
+
* @slot expand-collapse-indicator - The expand/collapse indicator
|
|
9621
|
+
* @slot submenu - Used to nest menu's within menu items
|
|
9622
|
+
* @csspart input-container - The element representing the visual checked or radio indicator
|
|
9623
|
+
* @csspart checkbox - The element wrapping the `menuitemcheckbox` indicator
|
|
9624
|
+
* @csspart radio - The element wrapping the `menuitemradio` indicator
|
|
9625
|
+
* @csspart content - The element wrapping the menu item content
|
|
9626
|
+
* @csspart expand-collapse-glyph-container - The element wrapping the expand collapse element
|
|
9627
|
+
* @csspart expand-collapse - The expand/collapse element
|
|
9628
|
+
* @csspart submenu-region - The container for the submenu, used for positioning
|
|
9629
|
+
* @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
|
|
9630
|
+
* @fires change - Fires a custom 'change' event when a non-submenu item with a role of `menuitemcheckbox`, `menuitemradio`, or `menuitem` is invoked
|
|
9631
|
+
*
|
|
9632
|
+
* @public
|
|
9633
|
+
*/
|
|
9634
|
+
class MenuItem$1 extends FoundationElement {
|
|
9635
|
+
constructor() {
|
|
9636
|
+
super(...arguments);
|
|
9637
|
+
/**
|
|
9638
|
+
* The role of the element.
|
|
9639
|
+
*
|
|
9640
|
+
* @public
|
|
9641
|
+
* @remarks
|
|
9642
|
+
* HTML Attribute: role
|
|
9643
|
+
*/
|
|
9644
|
+
this.role = MenuItemRole.menuitem;
|
|
9645
|
+
/**
|
|
9646
|
+
* @internal
|
|
9647
|
+
*/
|
|
9648
|
+
this.hasSubmenu = false;
|
|
9649
|
+
/**
|
|
9650
|
+
* Track current direction to pass to the anchored region
|
|
9651
|
+
*
|
|
9652
|
+
* @internal
|
|
9653
|
+
*/
|
|
9654
|
+
this.currentDirection = Direction.ltr;
|
|
9655
|
+
this.focusSubmenuOnLoad = false;
|
|
9656
|
+
/**
|
|
9657
|
+
* @internal
|
|
9658
|
+
*/
|
|
9659
|
+
this.handleMenuItemKeyDown = (e) => {
|
|
9660
|
+
if (e.defaultPrevented) {
|
|
9661
|
+
return false;
|
|
9662
|
+
}
|
|
9663
|
+
switch (e.key) {
|
|
9664
|
+
case keyEnter:
|
|
9665
|
+
case keySpace:
|
|
9666
|
+
this.invoke();
|
|
9667
|
+
return false;
|
|
9668
|
+
case keyArrowRight:
|
|
9669
|
+
//open/focus on submenu
|
|
9670
|
+
this.expandAndFocus();
|
|
9671
|
+
return false;
|
|
9672
|
+
case keyArrowLeft:
|
|
9673
|
+
//close submenu
|
|
9674
|
+
if (this.expanded) {
|
|
9675
|
+
this.expanded = false;
|
|
9676
|
+
this.focus();
|
|
9677
|
+
return false;
|
|
9678
|
+
}
|
|
9679
|
+
}
|
|
9680
|
+
return true;
|
|
9681
|
+
};
|
|
9682
|
+
/**
|
|
9217
9683
|
* @internal
|
|
9218
9684
|
*/
|
|
9219
9685
|
this.handleMenuItemClick = (e) => {
|
|
@@ -9353,7 +9819,7 @@
|
|
|
9353
9819
|
* get an array of valid DOM children
|
|
9354
9820
|
*/
|
|
9355
9821
|
domChildren() {
|
|
9356
|
-
return Array.from(this.children);
|
|
9822
|
+
return Array.from(this.children).filter(child => !child.hasAttribute("hidden"));
|
|
9357
9823
|
}
|
|
9358
9824
|
}
|
|
9359
9825
|
__decorate$1([
|
|
@@ -9479,6 +9945,8 @@
|
|
|
9479
9945
|
* A Menu Custom HTML Element.
|
|
9480
9946
|
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#menu | ARIA menu }.
|
|
9481
9947
|
*
|
|
9948
|
+
* @slot - The default slot for the menu items
|
|
9949
|
+
*
|
|
9482
9950
|
* @public
|
|
9483
9951
|
*/
|
|
9484
9952
|
class Menu$1 extends FoundationElement {
|
|
@@ -9728,7 +10196,7 @@
|
|
|
9728
10196
|
* get an array of valid DOM children
|
|
9729
10197
|
*/
|
|
9730
10198
|
domChildren() {
|
|
9731
|
-
return Array.from(this.children);
|
|
10199
|
+
return Array.from(this.children).filter(child => !child.hasAttribute("hidden"));
|
|
9732
10200
|
}
|
|
9733
10201
|
setFocus(focusIndex, adjustment) {
|
|
9734
10202
|
if (this.menuItems === undefined) {
|
|
@@ -9842,74 +10310,6 @@
|
|
|
9842
10310
|
</template>
|
|
9843
10311
|
`;
|
|
9844
10312
|
|
|
9845
|
-
/**
|
|
9846
|
-
* The template for the {@link @microsoft/fast-foundation#(TextField:class)} component.
|
|
9847
|
-
* @public
|
|
9848
|
-
*/
|
|
9849
|
-
const textFieldTemplate = (context, definition) => html `
|
|
9850
|
-
<template
|
|
9851
|
-
class="
|
|
9852
|
-
${x => (x.readOnly ? "readonly" : "")}
|
|
9853
|
-
"
|
|
9854
|
-
>
|
|
9855
|
-
<label
|
|
9856
|
-
part="label"
|
|
9857
|
-
for="control"
|
|
9858
|
-
class="${x => x.defaultSlottedNodes && x.defaultSlottedNodes.length
|
|
9859
|
-
? "label"
|
|
9860
|
-
: "label label__hidden"}"
|
|
9861
|
-
>
|
|
9862
|
-
<slot
|
|
9863
|
-
${slotted({ property: "defaultSlottedNodes", filter: whitespaceFilter })}
|
|
9864
|
-
></slot>
|
|
9865
|
-
</label>
|
|
9866
|
-
<div class="root" part="root">
|
|
9867
|
-
${startSlotTemplate(context, definition)}
|
|
9868
|
-
<input
|
|
9869
|
-
class="control"
|
|
9870
|
-
part="control"
|
|
9871
|
-
id="control"
|
|
9872
|
-
@input="${x => x.handleTextInput()}"
|
|
9873
|
-
@change="${x => x.handleChange()}"
|
|
9874
|
-
?autofocus="${x => x.autofocus}"
|
|
9875
|
-
?disabled="${x => x.disabled}"
|
|
9876
|
-
list="${x => x.list}"
|
|
9877
|
-
maxlength="${x => x.maxlength}"
|
|
9878
|
-
minlength="${x => x.minlength}"
|
|
9879
|
-
pattern="${x => x.pattern}"
|
|
9880
|
-
placeholder="${x => x.placeholder}"
|
|
9881
|
-
?readonly="${x => x.readOnly}"
|
|
9882
|
-
?required="${x => x.required}"
|
|
9883
|
-
size="${x => x.size}"
|
|
9884
|
-
?spellcheck="${x => x.spellcheck}"
|
|
9885
|
-
:value="${x => x.value}"
|
|
9886
|
-
type="${x => x.type}"
|
|
9887
|
-
aria-atomic="${x => x.ariaAtomic}"
|
|
9888
|
-
aria-busy="${x => x.ariaBusy}"
|
|
9889
|
-
aria-controls="${x => x.ariaControls}"
|
|
9890
|
-
aria-current="${x => x.ariaCurrent}"
|
|
9891
|
-
aria-describedby="${x => x.ariaDescribedby}"
|
|
9892
|
-
aria-details="${x => x.ariaDetails}"
|
|
9893
|
-
aria-disabled="${x => x.ariaDisabled}"
|
|
9894
|
-
aria-errormessage="${x => x.ariaErrormessage}"
|
|
9895
|
-
aria-flowto="${x => x.ariaFlowto}"
|
|
9896
|
-
aria-haspopup="${x => x.ariaHaspopup}"
|
|
9897
|
-
aria-hidden="${x => x.ariaHidden}"
|
|
9898
|
-
aria-invalid="${x => x.ariaInvalid}"
|
|
9899
|
-
aria-keyshortcuts="${x => x.ariaKeyshortcuts}"
|
|
9900
|
-
aria-label="${x => x.ariaLabel}"
|
|
9901
|
-
aria-labelledby="${x => x.ariaLabelledby}"
|
|
9902
|
-
aria-live="${x => x.ariaLive}"
|
|
9903
|
-
aria-owns="${x => x.ariaOwns}"
|
|
9904
|
-
aria-relevant="${x => x.ariaRelevant}"
|
|
9905
|
-
aria-roledescription="${x => x.ariaRoledescription}"
|
|
9906
|
-
${ref("control")}
|
|
9907
|
-
/>
|
|
9908
|
-
${endSlotTemplate(context, definition)}
|
|
9909
|
-
</div>
|
|
9910
|
-
</template>
|
|
9911
|
-
`;
|
|
9912
|
-
|
|
9913
10313
|
class _TextField extends FoundationElement {
|
|
9914
10314
|
}
|
|
9915
10315
|
/**
|
|
@@ -9928,34 +10328,41 @@
|
|
|
9928
10328
|
* Text field sub-types
|
|
9929
10329
|
* @public
|
|
9930
10330
|
*/
|
|
9931
|
-
|
|
9932
|
-
(function (TextFieldType) {
|
|
10331
|
+
const TextFieldType = {
|
|
9933
10332
|
/**
|
|
9934
10333
|
* An email TextField
|
|
9935
10334
|
*/
|
|
9936
|
-
|
|
10335
|
+
email: "email",
|
|
9937
10336
|
/**
|
|
9938
10337
|
* A password TextField
|
|
9939
10338
|
*/
|
|
9940
|
-
|
|
10339
|
+
password: "password",
|
|
9941
10340
|
/**
|
|
9942
10341
|
* A telephone TextField
|
|
9943
10342
|
*/
|
|
9944
|
-
|
|
10343
|
+
tel: "tel",
|
|
9945
10344
|
/**
|
|
9946
10345
|
* A text TextField
|
|
9947
10346
|
*/
|
|
9948
|
-
|
|
10347
|
+
text: "text",
|
|
9949
10348
|
/**
|
|
9950
10349
|
* A URL TextField
|
|
9951
10350
|
*/
|
|
9952
|
-
|
|
9953
|
-
}
|
|
10351
|
+
url: "url",
|
|
10352
|
+
};
|
|
9954
10353
|
|
|
9955
10354
|
/**
|
|
9956
10355
|
* A Text Field Custom HTML Element.
|
|
9957
10356
|
* Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/text | <input type="text" /> element }.
|
|
9958
10357
|
*
|
|
10358
|
+
* @slot start - Content which can be provided before the number field input
|
|
10359
|
+
* @slot end - Content which can be provided after the number field input
|
|
10360
|
+
* @slot - The default slot for the label
|
|
10361
|
+
* @csspart label - The label
|
|
10362
|
+
* @csspart root - The element wrapping the control, including start and end slots
|
|
10363
|
+
* @csspart control - The text field element
|
|
10364
|
+
* @fires change - Fires a custom 'change' event when the value has changed
|
|
10365
|
+
*
|
|
9959
10366
|
* @public
|
|
9960
10367
|
*/
|
|
9961
10368
|
class TextField$1 extends FormAssociatedTextField {
|
|
@@ -10039,6 +10446,21 @@
|
|
|
10039
10446
|
});
|
|
10040
10447
|
}
|
|
10041
10448
|
}
|
|
10449
|
+
/**
|
|
10450
|
+
* Selects all the text in the text field
|
|
10451
|
+
*
|
|
10452
|
+
* @public
|
|
10453
|
+
*/
|
|
10454
|
+
select() {
|
|
10455
|
+
this.control.select();
|
|
10456
|
+
/**
|
|
10457
|
+
* The select event does not permeate the shadow DOM boundary.
|
|
10458
|
+
* This fn effectively proxies the select event,
|
|
10459
|
+
* emitting a `select` event whenever the internal
|
|
10460
|
+
* control emits a `select` event
|
|
10461
|
+
*/
|
|
10462
|
+
this.$emit("select");
|
|
10463
|
+
}
|
|
10042
10464
|
/**
|
|
10043
10465
|
* Handles the internal control's `input` event
|
|
10044
10466
|
* @internal
|
|
@@ -10120,6 +10542,20 @@
|
|
|
10120
10542
|
* A Number Field Custom HTML Element.
|
|
10121
10543
|
* Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number | <input type="number" /> element }.
|
|
10122
10544
|
*
|
|
10545
|
+
* @slot start - Content which can be provided before the number field input
|
|
10546
|
+
* @slot end - Content which can be provided after the number field input
|
|
10547
|
+
* @slot - The default slot for the label
|
|
10548
|
+
* @slot step-up-glyph - The glyph for the step up control
|
|
10549
|
+
* @slot step-down-glyph - The glyph for the step down control
|
|
10550
|
+
* @csspart label - The label
|
|
10551
|
+
* @csspart root - The element wrapping the control, including start and end slots
|
|
10552
|
+
* @csspart control - The element representing the input
|
|
10553
|
+
* @csspart controls - The step up and step down controls
|
|
10554
|
+
* @csspart step-up - The step up control
|
|
10555
|
+
* @csspart step-down - The step down control
|
|
10556
|
+
* @fires input - Fires a custom 'input' event when the value has changed
|
|
10557
|
+
* @fires change - Fires a custom 'change' event when the value has changed
|
|
10558
|
+
*
|
|
10123
10559
|
* @public
|
|
10124
10560
|
*/
|
|
10125
10561
|
class NumberField$1 extends FormAssociatedNumberField {
|
|
@@ -10281,6 +10717,21 @@
|
|
|
10281
10717
|
});
|
|
10282
10718
|
}
|
|
10283
10719
|
}
|
|
10720
|
+
/**
|
|
10721
|
+
* Selects all the text in the number field
|
|
10722
|
+
*
|
|
10723
|
+
* @public
|
|
10724
|
+
*/
|
|
10725
|
+
select() {
|
|
10726
|
+
this.control.select();
|
|
10727
|
+
/**
|
|
10728
|
+
* The select event does not permeate the shadow DOM boundary.
|
|
10729
|
+
* This fn effectively proxies the select event,
|
|
10730
|
+
* emitting a `select` event whenever the internal
|
|
10731
|
+
* control emits a `select` event
|
|
10732
|
+
*/
|
|
10733
|
+
this.$emit("select");
|
|
10734
|
+
}
|
|
10284
10735
|
/**
|
|
10285
10736
|
* Handles the internal control's `input` event
|
|
10286
10737
|
* @internal
|
|
@@ -10365,7 +10816,21 @@
|
|
|
10365
10816
|
], NumberField$1.prototype, "defaultSlottedNodes", void 0);
|
|
10366
10817
|
applyMixins(NumberField$1, StartEnd, DelegatesARIATextbox);
|
|
10367
10818
|
|
|
10368
|
-
|
|
10819
|
+
/**
|
|
10820
|
+
* a method to filter out any whitespace _only_ nodes, to be used inside a template
|
|
10821
|
+
* @param value - The Node that is being inspected
|
|
10822
|
+
* @param index - The index of the node within the array
|
|
10823
|
+
* @param array - The Node array that is being filtered
|
|
10824
|
+
*
|
|
10825
|
+
* @public
|
|
10826
|
+
*/
|
|
10827
|
+
function whitespaceFilter(value, index, array) {
|
|
10828
|
+
return value.nodeType !== Node.TEXT_NODE
|
|
10829
|
+
? true
|
|
10830
|
+
: typeof value.nodeValue === "string" && !!value.nodeValue.trim().length;
|
|
10831
|
+
}
|
|
10832
|
+
|
|
10833
|
+
class _Select extends ListboxElement {
|
|
10369
10834
|
}
|
|
10370
10835
|
/**
|
|
10371
10836
|
* A form-associated base class for the {@link @microsoft/fast-foundation#(Select:class)} component.
|
|
@@ -10383,6 +10848,19 @@
|
|
|
10383
10848
|
* A Select Custom HTML Element.
|
|
10384
10849
|
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#select | ARIA select }.
|
|
10385
10850
|
*
|
|
10851
|
+
* @slot start - Content which can be provided before the button content
|
|
10852
|
+
* @slot end - Content which can be provided after the button content
|
|
10853
|
+
* @slot button-container - The element representing the select button
|
|
10854
|
+
* @slot selected-value - The selected value
|
|
10855
|
+
* @slot indicator - The visual indicator for the expand/collapse state of the button
|
|
10856
|
+
* @slot - The default slot for slotted options
|
|
10857
|
+
* @csspart control - The element representing the select invoking element
|
|
10858
|
+
* @csspart selected-value - The element wrapping the selected value
|
|
10859
|
+
* @csspart indicator - The element wrapping the visual indicator
|
|
10860
|
+
* @csspart listbox - The listbox element
|
|
10861
|
+
* @fires input - Fires a custom 'input' event when the value updates
|
|
10862
|
+
* @fires change - Fires a custom 'change' event when the value updates
|
|
10863
|
+
*
|
|
10386
10864
|
* @public
|
|
10387
10865
|
*/
|
|
10388
10866
|
class Select$1 extends FormAssociatedSelect {
|
|
@@ -10391,7 +10869,9 @@
|
|
|
10391
10869
|
/**
|
|
10392
10870
|
* The open attribute.
|
|
10393
10871
|
*
|
|
10394
|
-
* @
|
|
10872
|
+
* @public
|
|
10873
|
+
* @remarks
|
|
10874
|
+
* HTML Attribute: open
|
|
10395
10875
|
*/
|
|
10396
10876
|
this.open = false;
|
|
10397
10877
|
/**
|
|
@@ -10400,12 +10880,6 @@
|
|
|
10400
10880
|
* @internal
|
|
10401
10881
|
*/
|
|
10402
10882
|
this.forcedPosition = false;
|
|
10403
|
-
/**
|
|
10404
|
-
* Holds the current state for the calculated position of the listbox.
|
|
10405
|
-
*
|
|
10406
|
-
* @public
|
|
10407
|
-
*/
|
|
10408
|
-
this.position = SelectPosition.below;
|
|
10409
10883
|
/**
|
|
10410
10884
|
* The unique id for the internal listbox element.
|
|
10411
10885
|
*
|
|
@@ -10418,14 +10892,19 @@
|
|
|
10418
10892
|
* @internal
|
|
10419
10893
|
*/
|
|
10420
10894
|
this.maxHeight = 0;
|
|
10421
|
-
/**
|
|
10422
|
-
* The value displayed on the button.
|
|
10423
|
-
*
|
|
10424
|
-
* @public
|
|
10425
|
-
*/
|
|
10426
|
-
this.displayValue = "";
|
|
10427
10895
|
}
|
|
10428
|
-
|
|
10896
|
+
/**
|
|
10897
|
+
* Sets focus and synchronizes ARIA attributes when the open property changes.
|
|
10898
|
+
*
|
|
10899
|
+
* @param prev - the previous open value
|
|
10900
|
+
* @param next - the current open value
|
|
10901
|
+
*
|
|
10902
|
+
* @internal
|
|
10903
|
+
*/
|
|
10904
|
+
openChanged(prev, next) {
|
|
10905
|
+
if (!this.collapsible) {
|
|
10906
|
+
return;
|
|
10907
|
+
}
|
|
10429
10908
|
if (this.open) {
|
|
10430
10909
|
this.ariaControls = this.listboxId;
|
|
10431
10910
|
this.ariaExpanded = "true";
|
|
@@ -10439,6 +10918,14 @@
|
|
|
10439
10918
|
this.ariaControls = "";
|
|
10440
10919
|
this.ariaExpanded = "false";
|
|
10441
10920
|
}
|
|
10921
|
+
/**
|
|
10922
|
+
* The component is collapsible when in single-selection mode with no size attribute.
|
|
10923
|
+
*
|
|
10924
|
+
* @internal
|
|
10925
|
+
*/
|
|
10926
|
+
get collapsible() {
|
|
10927
|
+
return !(this.multiple || typeof this.size === "number");
|
|
10928
|
+
}
|
|
10442
10929
|
/**
|
|
10443
10930
|
* The value property.
|
|
10444
10931
|
*
|
|
@@ -10449,38 +10936,36 @@
|
|
|
10449
10936
|
return this._value;
|
|
10450
10937
|
}
|
|
10451
10938
|
set value(next) {
|
|
10452
|
-
var _a;
|
|
10939
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
10453
10940
|
const prev = `${this._value}`;
|
|
10454
|
-
if ((_a = this.
|
|
10455
|
-
const selectedIndex = this.
|
|
10456
|
-
const
|
|
10457
|
-
const
|
|
10458
|
-
const prevSelectedValue = prevSelectedOption
|
|
10459
|
-
? prevSelectedOption.value
|
|
10460
|
-
: null;
|
|
10461
|
-
const nextSelectedValue = nextSelectedOption
|
|
10462
|
-
? nextSelectedOption.value
|
|
10463
|
-
: null;
|
|
10941
|
+
if ((_a = this._options) === null || _a === void 0 ? void 0 : _a.length) {
|
|
10942
|
+
const selectedIndex = this._options.findIndex(el => el.value === next);
|
|
10943
|
+
const prevSelectedValue = (_c = (_b = this._options[this.selectedIndex]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : null;
|
|
10944
|
+
const nextSelectedValue = (_e = (_d = this._options[selectedIndex]) === null || _d === void 0 ? void 0 : _d.value) !== null && _e !== void 0 ? _e : null;
|
|
10464
10945
|
if (selectedIndex === -1 || prevSelectedValue !== nextSelectedValue) {
|
|
10465
10946
|
next = "";
|
|
10466
10947
|
this.selectedIndex = selectedIndex;
|
|
10467
10948
|
}
|
|
10468
|
-
|
|
10469
|
-
next = this.firstSelectedOption.value;
|
|
10470
|
-
}
|
|
10949
|
+
next = (_g = (_f = this.firstSelectedOption) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : next;
|
|
10471
10950
|
}
|
|
10472
10951
|
if (prev !== next) {
|
|
10473
10952
|
this._value = next;
|
|
10474
10953
|
super.valueChanged(prev, next);
|
|
10475
10954
|
Observable.notify(this, "value");
|
|
10955
|
+
this.updateDisplayValue();
|
|
10476
10956
|
}
|
|
10477
10957
|
}
|
|
10958
|
+
/**
|
|
10959
|
+
* Sets the value and display value to match the first selected option.
|
|
10960
|
+
*
|
|
10961
|
+
* @param shouldEmit - if true, the input and change events will be emitted
|
|
10962
|
+
*
|
|
10963
|
+
* @internal
|
|
10964
|
+
*/
|
|
10478
10965
|
updateValue(shouldEmit) {
|
|
10966
|
+
var _a, _b;
|
|
10479
10967
|
if (this.$fastController.isConnected) {
|
|
10480
|
-
this.value = this.firstSelectedOption ?
|
|
10481
|
-
this.displayValue = this.firstSelectedOption
|
|
10482
|
-
? this.firstSelectedOption.textContent || this.firstSelectedOption.value
|
|
10483
|
-
: this.value;
|
|
10968
|
+
this.value = (_b = (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
|
|
10484
10969
|
}
|
|
10485
10970
|
if (shouldEmit) {
|
|
10486
10971
|
this.$emit("input");
|
|
@@ -10502,14 +10987,13 @@
|
|
|
10502
10987
|
super.selectedIndexChanged(prev, next);
|
|
10503
10988
|
this.updateValue();
|
|
10504
10989
|
}
|
|
10505
|
-
positionChanged() {
|
|
10506
|
-
this.positionAttribute =
|
|
10990
|
+
positionChanged(prev, next) {
|
|
10991
|
+
this.positionAttribute = next;
|
|
10507
10992
|
this.setPositioning();
|
|
10508
10993
|
}
|
|
10509
10994
|
/**
|
|
10510
10995
|
* Calculate and apply listbox positioning based on available viewport space.
|
|
10511
10996
|
*
|
|
10512
|
-
* @param force - direction to force the listbox to display
|
|
10513
10997
|
* @public
|
|
10514
10998
|
*/
|
|
10515
10999
|
setPositioning() {
|
|
@@ -10527,10 +11011,15 @@
|
|
|
10527
11011
|
this.maxHeight =
|
|
10528
11012
|
this.position === SelectPosition.above ? ~~currentBox.top : ~~availableBottom;
|
|
10529
11013
|
}
|
|
10530
|
-
|
|
10531
|
-
|
|
10532
|
-
|
|
10533
|
-
|
|
11014
|
+
/**
|
|
11015
|
+
* The value displayed on the button.
|
|
11016
|
+
*
|
|
11017
|
+
* @public
|
|
11018
|
+
*/
|
|
11019
|
+
get displayValue() {
|
|
11020
|
+
var _a, _b;
|
|
11021
|
+
Observable.track(this, "displayValue");
|
|
11022
|
+
return (_b = (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : "";
|
|
10534
11023
|
}
|
|
10535
11024
|
/**
|
|
10536
11025
|
* Synchronize the `aria-disabled` property when the `disabled` property changes.
|
|
@@ -10578,20 +11067,21 @@
|
|
|
10578
11067
|
}
|
|
10579
11068
|
}
|
|
10580
11069
|
super.clickHandler(e);
|
|
10581
|
-
this.open = !this.open;
|
|
11070
|
+
this.open = this.collapsible && !this.open;
|
|
10582
11071
|
if (!this.open && this.indexWhenOpened !== this.selectedIndex) {
|
|
10583
11072
|
this.updateValue(true);
|
|
10584
11073
|
}
|
|
10585
11074
|
return true;
|
|
10586
11075
|
}
|
|
10587
11076
|
/**
|
|
10588
|
-
*
|
|
11077
|
+
* Handles focus state when the element or its children lose focus.
|
|
10589
11078
|
*
|
|
10590
11079
|
* @param e - The focus event
|
|
10591
11080
|
* @internal
|
|
10592
11081
|
*/
|
|
10593
11082
|
focusoutHandler(e) {
|
|
10594
11083
|
var _a;
|
|
11084
|
+
super.focusoutHandler(e);
|
|
10595
11085
|
if (!this.open) {
|
|
10596
11086
|
return true;
|
|
10597
11087
|
}
|
|
@@ -10608,7 +11098,22 @@
|
|
|
10608
11098
|
}
|
|
10609
11099
|
}
|
|
10610
11100
|
/**
|
|
10611
|
-
*
|
|
11101
|
+
* Updates the value when an option's value changes.
|
|
11102
|
+
*
|
|
11103
|
+
* @param source - the source object
|
|
11104
|
+
* @param propertyName - the property to evaluate
|
|
11105
|
+
*
|
|
11106
|
+
* @internal
|
|
11107
|
+
* @override
|
|
11108
|
+
*/
|
|
11109
|
+
handleChange(source, propertyName) {
|
|
11110
|
+
super.handleChange(source, propertyName);
|
|
11111
|
+
if (propertyName === "value") {
|
|
11112
|
+
this.updateValue();
|
|
11113
|
+
}
|
|
11114
|
+
}
|
|
11115
|
+
/**
|
|
11116
|
+
* Synchronize the form-associated proxy and updates the value property of the element.
|
|
10612
11117
|
*
|
|
10613
11118
|
* @param prev - the previous collection of slotted option elements
|
|
10614
11119
|
* @param next - the next collection of slotted option elements
|
|
@@ -10616,10 +11121,72 @@
|
|
|
10616
11121
|
* @internal
|
|
10617
11122
|
*/
|
|
10618
11123
|
slottedOptionsChanged(prev, next) {
|
|
11124
|
+
this.options.forEach(o => {
|
|
11125
|
+
const notifier = Observable.getNotifier(o);
|
|
11126
|
+
notifier.unsubscribe(this, "value");
|
|
11127
|
+
});
|
|
10619
11128
|
super.slottedOptionsChanged(prev, next);
|
|
11129
|
+
this.options.forEach(o => {
|
|
11130
|
+
const notifier = Observable.getNotifier(o);
|
|
11131
|
+
notifier.subscribe(this, "value");
|
|
11132
|
+
});
|
|
10620
11133
|
this.setProxyOptions();
|
|
10621
11134
|
this.updateValue();
|
|
10622
11135
|
}
|
|
11136
|
+
/**
|
|
11137
|
+
* Prevents focus when size is set and a scrollbar is clicked.
|
|
11138
|
+
*
|
|
11139
|
+
* @param e - the mouse event object
|
|
11140
|
+
*
|
|
11141
|
+
* @override
|
|
11142
|
+
* @internal
|
|
11143
|
+
*/
|
|
11144
|
+
mousedownHandler(e) {
|
|
11145
|
+
var _a;
|
|
11146
|
+
if (e.offsetX >= 0 && e.offsetX <= ((_a = this.listbox) === null || _a === void 0 ? void 0 : _a.scrollWidth)) {
|
|
11147
|
+
return super.mousedownHandler(e);
|
|
11148
|
+
}
|
|
11149
|
+
return this.collapsible;
|
|
11150
|
+
}
|
|
11151
|
+
/**
|
|
11152
|
+
* Sets the multiple property on the proxy element.
|
|
11153
|
+
*
|
|
11154
|
+
* @param prev - the previous multiple value
|
|
11155
|
+
* @param next - the current multiple value
|
|
11156
|
+
*/
|
|
11157
|
+
multipleChanged(prev, next) {
|
|
11158
|
+
super.multipleChanged(prev, next);
|
|
11159
|
+
if (this.proxy) {
|
|
11160
|
+
this.proxy.multiple = next;
|
|
11161
|
+
}
|
|
11162
|
+
}
|
|
11163
|
+
/**
|
|
11164
|
+
* Updates the selectedness of each option when the list of selected options changes.
|
|
11165
|
+
*
|
|
11166
|
+
* @param prev - the previous list of selected options
|
|
11167
|
+
* @param next - the current list of selected options
|
|
11168
|
+
*
|
|
11169
|
+
* @override
|
|
11170
|
+
* @internal
|
|
11171
|
+
*/
|
|
11172
|
+
selectedOptionsChanged(prev, next) {
|
|
11173
|
+
var _a;
|
|
11174
|
+
super.selectedOptionsChanged(prev, next);
|
|
11175
|
+
(_a = this.options) === null || _a === void 0 ? void 0 : _a.forEach((o, i) => {
|
|
11176
|
+
var _a;
|
|
11177
|
+
const proxyOption = (_a = this.proxy) === null || _a === void 0 ? void 0 : _a.options.item(i);
|
|
11178
|
+
if (proxyOption) {
|
|
11179
|
+
proxyOption.selected = o.selected;
|
|
11180
|
+
}
|
|
11181
|
+
});
|
|
11182
|
+
}
|
|
11183
|
+
/**
|
|
11184
|
+
* Sets the selected index to match the first option with the selected attribute, or
|
|
11185
|
+
* the first selectable option.
|
|
11186
|
+
*
|
|
11187
|
+
* @override
|
|
11188
|
+
* @internal
|
|
11189
|
+
*/
|
|
10623
11190
|
setDefaultSelectedOption() {
|
|
10624
11191
|
var _a;
|
|
10625
11192
|
const options = (_a = this.options) !== null && _a !== void 0 ? _a : Array.from(this.children).filter(Listbox.slottedOptionFilter);
|
|
@@ -10631,7 +11198,7 @@
|
|
|
10631
11198
|
this.selectedIndex = 0;
|
|
10632
11199
|
}
|
|
10633
11200
|
/**
|
|
10634
|
-
*
|
|
11201
|
+
* Resets and fills the proxy to match the component's options.
|
|
10635
11202
|
*
|
|
10636
11203
|
* @internal
|
|
10637
11204
|
*/
|
|
@@ -10642,7 +11209,7 @@
|
|
|
10642
11209
|
const proxyOption = option.proxy ||
|
|
10643
11210
|
(option instanceof HTMLOptionElement ? option.cloneNode() : null);
|
|
10644
11211
|
if (proxyOption) {
|
|
10645
|
-
this.proxy.
|
|
11212
|
+
this.proxy.options.add(proxyOption);
|
|
10646
11213
|
}
|
|
10647
11214
|
});
|
|
10648
11215
|
}
|
|
@@ -10657,47 +11224,87 @@
|
|
|
10657
11224
|
super.keydownHandler(e);
|
|
10658
11225
|
const key = e.key || e.key.charCodeAt(0);
|
|
10659
11226
|
switch (key) {
|
|
10660
|
-
case
|
|
10661
|
-
|
|
10662
|
-
|
|
11227
|
+
case keySpace: {
|
|
11228
|
+
e.preventDefault();
|
|
11229
|
+
if (this.collapsible && this.typeAheadExpired) {
|
|
10663
11230
|
this.open = !this.open;
|
|
10664
11231
|
}
|
|
10665
11232
|
break;
|
|
10666
11233
|
}
|
|
10667
|
-
case
|
|
11234
|
+
case keyHome:
|
|
11235
|
+
case keyEnd: {
|
|
11236
|
+
e.preventDefault();
|
|
11237
|
+
break;
|
|
11238
|
+
}
|
|
11239
|
+
case keyEnter: {
|
|
10668
11240
|
e.preventDefault();
|
|
10669
11241
|
this.open = !this.open;
|
|
10670
11242
|
break;
|
|
10671
11243
|
}
|
|
10672
|
-
case
|
|
10673
|
-
if (this.open) {
|
|
11244
|
+
case keyEscape: {
|
|
11245
|
+
if (this.collapsible && this.open) {
|
|
10674
11246
|
e.preventDefault();
|
|
10675
11247
|
this.open = false;
|
|
10676
11248
|
}
|
|
10677
11249
|
break;
|
|
10678
11250
|
}
|
|
10679
|
-
case
|
|
10680
|
-
if (
|
|
10681
|
-
|
|
11251
|
+
case keyTab: {
|
|
11252
|
+
if (this.collapsible && this.open) {
|
|
11253
|
+
e.preventDefault();
|
|
11254
|
+
this.open = false;
|
|
10682
11255
|
}
|
|
10683
|
-
|
|
10684
|
-
this.open = false;
|
|
11256
|
+
return true;
|
|
10685
11257
|
}
|
|
10686
11258
|
}
|
|
10687
11259
|
if (!this.open && this.indexWhenOpened !== this.selectedIndex) {
|
|
10688
11260
|
this.updateValue(true);
|
|
10689
11261
|
this.indexWhenOpened = this.selectedIndex;
|
|
10690
11262
|
}
|
|
10691
|
-
return
|
|
11263
|
+
return !(key in ArrowKeys);
|
|
10692
11264
|
}
|
|
10693
11265
|
connectedCallback() {
|
|
10694
11266
|
super.connectedCallback();
|
|
10695
11267
|
this.forcedPosition = !!this.positionAttribute;
|
|
11268
|
+
this.addEventListener("contentchange", this.updateDisplayValue);
|
|
11269
|
+
}
|
|
11270
|
+
disconnectedCallback() {
|
|
11271
|
+
this.removeEventListener("contentchange", this.updateDisplayValue);
|
|
11272
|
+
super.disconnectedCallback();
|
|
11273
|
+
}
|
|
11274
|
+
/**
|
|
11275
|
+
* Updates the proxy's size property when the size attribute changes.
|
|
11276
|
+
*
|
|
11277
|
+
* @param prev - the previous size
|
|
11278
|
+
* @param next - the current size
|
|
11279
|
+
*
|
|
11280
|
+
* @override
|
|
11281
|
+
* @internal
|
|
11282
|
+
*/
|
|
11283
|
+
sizeChanged(prev, next) {
|
|
11284
|
+
super.sizeChanged(prev, next);
|
|
11285
|
+
if (this.proxy) {
|
|
11286
|
+
this.proxy.size = next;
|
|
11287
|
+
}
|
|
11288
|
+
}
|
|
11289
|
+
/**
|
|
11290
|
+
*
|
|
11291
|
+
* @internal
|
|
11292
|
+
*/
|
|
11293
|
+
updateDisplayValue() {
|
|
11294
|
+
if (this.collapsible) {
|
|
11295
|
+
Observable.notify(this, "displayValue");
|
|
11296
|
+
}
|
|
10696
11297
|
}
|
|
10697
11298
|
}
|
|
10698
11299
|
__decorate$1([
|
|
10699
11300
|
attr({ attribute: "open", mode: "boolean" })
|
|
10700
11301
|
], Select$1.prototype, "open", void 0);
|
|
11302
|
+
__decorate$1([
|
|
11303
|
+
volatile
|
|
11304
|
+
], Select$1.prototype, "collapsible", null);
|
|
11305
|
+
__decorate$1([
|
|
11306
|
+
observable
|
|
11307
|
+
], Select$1.prototype, "control", void 0);
|
|
10701
11308
|
__decorate$1([
|
|
10702
11309
|
attr({ attribute: "position" })
|
|
10703
11310
|
], Select$1.prototype, "positionAttribute", void 0);
|
|
@@ -10706,10 +11313,7 @@
|
|
|
10706
11313
|
], Select$1.prototype, "position", void 0);
|
|
10707
11314
|
__decorate$1([
|
|
10708
11315
|
observable
|
|
10709
|
-
], Select$1.prototype, "maxHeight", void 0);
|
|
10710
|
-
__decorate$1([
|
|
10711
|
-
observable
|
|
10712
|
-
], Select$1.prototype, "displayValue", void 0);
|
|
11316
|
+
], Select$1.prototype, "maxHeight", void 0);
|
|
10713
11317
|
/**
|
|
10714
11318
|
* Includes ARIA states and properties relating to the ARIA select role.
|
|
10715
11319
|
*
|
|
@@ -10729,40 +11333,57 @@
|
|
|
10729
11333
|
*/
|
|
10730
11334
|
const selectTemplate = (context, definition) => html `
|
|
10731
11335
|
<template
|
|
10732
|
-
class="${x =>
|
|
11336
|
+
class="${x => [
|
|
11337
|
+
x.collapsible && "collapsible",
|
|
11338
|
+
x.collapsible && x.open && "open",
|
|
11339
|
+
x.disabled && "disabled",
|
|
11340
|
+
x.collapsible && x.position,
|
|
11341
|
+
]
|
|
11342
|
+
.filter(Boolean)
|
|
11343
|
+
.join(" ")}"
|
|
10733
11344
|
aria-activedescendant="${x => x.ariaActiveDescendant}"
|
|
10734
11345
|
aria-controls="${x => x.ariaControls}"
|
|
10735
11346
|
aria-disabled="${x => x.ariaDisabled}"
|
|
10736
11347
|
aria-expanded="${x => x.ariaExpanded}"
|
|
10737
|
-
aria-haspopup="listbox"
|
|
11348
|
+
aria-haspopup="${x => (x.collapsible ? "listbox" : null)}"
|
|
11349
|
+
aria-multiselectable="${x => x.ariaMultiSelectable}"
|
|
10738
11350
|
?open="${x => x.open}"
|
|
10739
11351
|
role="combobox"
|
|
10740
11352
|
tabindex="${x => (!x.disabled ? "0" : null)}"
|
|
10741
11353
|
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
11354
|
+
@focusin="${(x, c) => x.focusinHandler(c.event)}"
|
|
10742
11355
|
@focusout="${(x, c) => x.focusoutHandler(c.event)}"
|
|
10743
11356
|
@keydown="${(x, c) => x.keydownHandler(c.event)}"
|
|
11357
|
+
@mousedown="${(x, c) => x.mousedownHandler(c.event)}"
|
|
10744
11358
|
>
|
|
10745
|
-
|
|
10746
|
-
|
|
10747
|
-
|
|
10748
|
-
|
|
10749
|
-
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
11359
|
+
${when(x => x.collapsible, html `
|
|
11360
|
+
<div
|
|
11361
|
+
class="control"
|
|
11362
|
+
part="control"
|
|
11363
|
+
?disabled="${x => x.disabled}"
|
|
11364
|
+
${ref("control")}
|
|
11365
|
+
>
|
|
11366
|
+
${startSlotTemplate(context, definition)}
|
|
11367
|
+
<slot name="button-container">
|
|
11368
|
+
<div class="selected-value" part="selected-value">
|
|
11369
|
+
<slot name="selected-value">${x => x.displayValue}</slot>
|
|
11370
|
+
</div>
|
|
11371
|
+
<div aria-hidden="true" class="indicator" part="indicator">
|
|
11372
|
+
<slot name="indicator">
|
|
11373
|
+
${definition.indicator || ""}
|
|
11374
|
+
</slot>
|
|
11375
|
+
</div>
|
|
10754
11376
|
</slot>
|
|
11377
|
+
${endSlotTemplate(context, definition)}
|
|
10755
11378
|
</div>
|
|
10756
|
-
|
|
10757
|
-
${endSlotTemplate(context, definition)}
|
|
10758
|
-
</div>
|
|
11379
|
+
`)}
|
|
10759
11380
|
<div
|
|
10760
11381
|
class="listbox"
|
|
10761
11382
|
id="${x => x.listboxId}"
|
|
10762
11383
|
part="listbox"
|
|
10763
11384
|
role="listbox"
|
|
10764
11385
|
?disabled="${x => x.disabled}"
|
|
10765
|
-
?hidden="${x => !x.open}"
|
|
11386
|
+
?hidden="${x => (x.collapsible ? !x.open : false)}"
|
|
10766
11387
|
${ref("listbox")}
|
|
10767
11388
|
>
|
|
10768
11389
|
<slot
|
|
@@ -10794,6 +11415,16 @@
|
|
|
10794
11415
|
* A Switch Custom HTML Element.
|
|
10795
11416
|
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#switch | ARIA switch }.
|
|
10796
11417
|
*
|
|
11418
|
+
* @slot - The deafult slot for the label
|
|
11419
|
+
* @slot checked-message - The message when in a checked state
|
|
11420
|
+
* @slot unchecked-message - The message when in an unchecked state
|
|
11421
|
+
* @csspart label - The label
|
|
11422
|
+
* @csspart switch - The element representing the switch, which wraps the indicator
|
|
11423
|
+
* @csspart status-message - The wrapper for the status messages
|
|
11424
|
+
* @csspart checked-message - The checked message
|
|
11425
|
+
* @csspart unchecked-message - The unchecked message
|
|
11426
|
+
* @fires change - Emits a custom change event when the checked state changes
|
|
11427
|
+
*
|
|
10797
11428
|
* @public
|
|
10798
11429
|
*/
|
|
10799
11430
|
class Switch$1 extends FormAssociatedSwitch {
|
|
@@ -10865,6 +11496,9 @@
|
|
|
10865
11496
|
|
|
10866
11497
|
/**
|
|
10867
11498
|
* A TabPanel Component to be used with {@link @microsoft/fast-foundation#(Tabs:class)}
|
|
11499
|
+
*
|
|
11500
|
+
* @slot - The default slot for the tabpanel content
|
|
11501
|
+
*
|
|
10868
11502
|
* @public
|
|
10869
11503
|
*/
|
|
10870
11504
|
class TabPanel$1 extends FoundationElement {
|
|
@@ -10882,6 +11516,9 @@
|
|
|
10882
11516
|
|
|
10883
11517
|
/**
|
|
10884
11518
|
* A Tab Component to be used with {@link @microsoft/fast-foundation#(Tabs:class)}
|
|
11519
|
+
*
|
|
11520
|
+
* @slot - The default slot for the tab content
|
|
11521
|
+
*
|
|
10885
11522
|
* @public
|
|
10886
11523
|
*/
|
|
10887
11524
|
class Tab$1 extends FoundationElement {
|
|
@@ -10919,15 +11556,24 @@
|
|
|
10919
11556
|
* The orientation of the {@link @microsoft/fast-foundation#(Tabs:class)} component
|
|
10920
11557
|
* @public
|
|
10921
11558
|
*/
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
})(TabsOrientation || (TabsOrientation = {}));
|
|
11559
|
+
const TabsOrientation = {
|
|
11560
|
+
vertical: "vertical",
|
|
11561
|
+
horizontal: "horizontal",
|
|
11562
|
+
};
|
|
10927
11563
|
/**
|
|
10928
11564
|
* A Tabs Custom HTML Element.
|
|
10929
11565
|
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#tablist | ARIA tablist }.
|
|
10930
11566
|
*
|
|
11567
|
+
* @slot start - Content which can be provided before the tablist element
|
|
11568
|
+
* @slot end - Content which can be provided after the tablist element
|
|
11569
|
+
* @slot tab - The slot for tabs
|
|
11570
|
+
* @slot tabpanel - The slot for tabpanels
|
|
11571
|
+
* @csspart tablist - The element wrapping for the tabs
|
|
11572
|
+
* @csspart tab - The tab slot
|
|
11573
|
+
* @csspart activeIndicator - The visual indicator
|
|
11574
|
+
* @csspart tabpanel - The tabpanel slot
|
|
11575
|
+
* @fires change - Fires a custom 'change' event when a tab is clicked or during keyboard navigation
|
|
11576
|
+
*
|
|
10931
11577
|
* @public
|
|
10932
11578
|
*/
|
|
10933
11579
|
class Tabs$1 extends FoundationElement {
|
|
@@ -10969,8 +11615,6 @@
|
|
|
10969
11615
|
const gridProperty = this.isHorizontal()
|
|
10970
11616
|
? gridHorizontalProperty
|
|
10971
11617
|
: gridVerticalProperty;
|
|
10972
|
-
this.tabIds = this.getTabIds();
|
|
10973
|
-
this.tabpanelIds = this.getTabPanelIds();
|
|
10974
11618
|
this.activeTabIndex = this.getActiveIndex();
|
|
10975
11619
|
this.showActiveIndicator = false;
|
|
10976
11620
|
this.tabs.forEach((tab, index) => {
|
|
@@ -10981,9 +11625,9 @@
|
|
|
10981
11625
|
}
|
|
10982
11626
|
const tabId = this.tabIds[index];
|
|
10983
11627
|
const tabpanelId = this.tabpanelIds[index];
|
|
10984
|
-
tab.setAttribute("id",
|
|
11628
|
+
tab.setAttribute("id", tabId);
|
|
10985
11629
|
tab.setAttribute("aria-selected", isActiveTab ? "true" : "false");
|
|
10986
|
-
tab.setAttribute("aria-controls",
|
|
11630
|
+
tab.setAttribute("aria-controls", tabpanelId);
|
|
10987
11631
|
tab.addEventListener("click", this.handleTabClick);
|
|
10988
11632
|
tab.addEventListener("keydown", this.handleTabKeyDown);
|
|
10989
11633
|
tab.setAttribute("tabindex", isActiveTab ? "0" : "-1");
|
|
@@ -11002,13 +11646,11 @@
|
|
|
11002
11646
|
});
|
|
11003
11647
|
};
|
|
11004
11648
|
this.setTabPanels = () => {
|
|
11005
|
-
this.tabIds = this.getTabIds();
|
|
11006
|
-
this.tabpanelIds = this.getTabPanelIds();
|
|
11007
11649
|
this.tabpanels.forEach((tabpanel, index) => {
|
|
11008
11650
|
const tabId = this.tabIds[index];
|
|
11009
11651
|
const tabpanelId = this.tabpanelIds[index];
|
|
11010
|
-
tabpanel.setAttribute("id",
|
|
11011
|
-
tabpanel.setAttribute("aria-labelledby",
|
|
11652
|
+
tabpanel.setAttribute("id", tabpanelId);
|
|
11653
|
+
tabpanel.setAttribute("aria-labelledby", tabId);
|
|
11012
11654
|
this.activeTabIndex !== index
|
|
11013
11655
|
? tabpanel.setAttribute("hidden", "")
|
|
11014
11656
|
: tabpanel.removeAttribute("hidden");
|
|
@@ -11136,6 +11778,8 @@
|
|
|
11136
11778
|
tabsChanged() {
|
|
11137
11779
|
if (this.$fastController.isConnected &&
|
|
11138
11780
|
this.tabs.length <= this.tabpanels.length) {
|
|
11781
|
+
this.tabIds = this.getTabIds();
|
|
11782
|
+
this.tabpanelIds = this.getTabPanelIds();
|
|
11139
11783
|
this.setTabs();
|
|
11140
11784
|
this.setTabPanels();
|
|
11141
11785
|
this.handleActiveIndicatorPosition();
|
|
@@ -11147,6 +11791,8 @@
|
|
|
11147
11791
|
tabpanelsChanged() {
|
|
11148
11792
|
if (this.$fastController.isConnected &&
|
|
11149
11793
|
this.tabpanels.length <= this.tabs.length) {
|
|
11794
|
+
this.tabIds = this.getTabIds();
|
|
11795
|
+
this.tabpanelIds = this.getTabPanelIds();
|
|
11150
11796
|
this.setTabs();
|
|
11151
11797
|
this.setTabPanels();
|
|
11152
11798
|
this.handleActiveIndicatorPosition();
|
|
@@ -11165,12 +11811,14 @@
|
|
|
11165
11811
|
}
|
|
11166
11812
|
getTabIds() {
|
|
11167
11813
|
return this.tabs.map((tab) => {
|
|
11168
|
-
|
|
11814
|
+
var _a;
|
|
11815
|
+
return (_a = tab.getAttribute("id")) !== null && _a !== void 0 ? _a : `tab-${uniqueId()}`;
|
|
11169
11816
|
});
|
|
11170
11817
|
}
|
|
11171
11818
|
getTabPanelIds() {
|
|
11172
11819
|
return this.tabpanels.map((tabPanel) => {
|
|
11173
|
-
|
|
11820
|
+
var _a;
|
|
11821
|
+
return (_a = tabPanel.getAttribute("id")) !== null && _a !== void 0 ? _a : `panel-${uniqueId()}`;
|
|
11174
11822
|
});
|
|
11175
11823
|
}
|
|
11176
11824
|
setComponent() {
|
|
@@ -11283,30 +11931,35 @@
|
|
|
11283
11931
|
* Resize mode for a TextArea
|
|
11284
11932
|
* @public
|
|
11285
11933
|
*/
|
|
11286
|
-
|
|
11287
|
-
(function (TextAreaResize) {
|
|
11934
|
+
const TextAreaResize = {
|
|
11288
11935
|
/**
|
|
11289
11936
|
* No resize.
|
|
11290
11937
|
*/
|
|
11291
|
-
|
|
11938
|
+
none: "none",
|
|
11292
11939
|
/**
|
|
11293
11940
|
* Resize vertically and horizontally.
|
|
11294
11941
|
*/
|
|
11295
|
-
|
|
11942
|
+
both: "both",
|
|
11296
11943
|
/**
|
|
11297
11944
|
* Resize horizontally.
|
|
11298
11945
|
*/
|
|
11299
|
-
|
|
11946
|
+
horizontal: "horizontal",
|
|
11300
11947
|
/**
|
|
11301
11948
|
* Resize vertically.
|
|
11302
11949
|
*/
|
|
11303
|
-
|
|
11304
|
-
}
|
|
11950
|
+
vertical: "vertical",
|
|
11951
|
+
};
|
|
11305
11952
|
|
|
11306
11953
|
/**
|
|
11307
11954
|
* A Text Area Custom HTML Element.
|
|
11308
11955
|
* Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea | <textarea> element }.
|
|
11309
11956
|
*
|
|
11957
|
+
* @slot - The default slot for the label
|
|
11958
|
+
* @csspart label - The label
|
|
11959
|
+
* @csspart root - The element wrapping the control
|
|
11960
|
+
* @csspart control - The textarea element
|
|
11961
|
+
* @fires change - Emits a custom 'change' event when the textarea emits a change event
|
|
11962
|
+
*
|
|
11310
11963
|
* @public
|
|
11311
11964
|
*/
|
|
11312
11965
|
class TextArea$1 extends FormAssociatedTextArea {
|
|
@@ -11364,6 +12017,21 @@
|
|
|
11364
12017
|
this.proxy.spellcheck = this.spellcheck;
|
|
11365
12018
|
}
|
|
11366
12019
|
}
|
|
12020
|
+
/**
|
|
12021
|
+
* Selects all the text in the text area
|
|
12022
|
+
*
|
|
12023
|
+
* @public
|
|
12024
|
+
*/
|
|
12025
|
+
select() {
|
|
12026
|
+
this.control.select();
|
|
12027
|
+
/**
|
|
12028
|
+
* The select event does not permeate the shadow DOM boundary.
|
|
12029
|
+
* This fn effectively proxies the select event,
|
|
12030
|
+
* emitting a `select` event whenever the internal
|
|
12031
|
+
* control emits a `select` event
|
|
12032
|
+
*/
|
|
12033
|
+
this.$emit("select");
|
|
12034
|
+
}
|
|
11367
12035
|
/**
|
|
11368
12036
|
* Change event handler for inner control.
|
|
11369
12037
|
* @remarks
|
|
@@ -11481,6 +12149,74 @@
|
|
|
11481
12149
|
</template>
|
|
11482
12150
|
`;
|
|
11483
12151
|
|
|
12152
|
+
/**
|
|
12153
|
+
* The template for the {@link @microsoft/fast-foundation#(TextField:class)} component.
|
|
12154
|
+
* @public
|
|
12155
|
+
*/
|
|
12156
|
+
const textFieldTemplate = (context, definition) => html `
|
|
12157
|
+
<template
|
|
12158
|
+
class="
|
|
12159
|
+
${x => (x.readOnly ? "readonly" : "")}
|
|
12160
|
+
"
|
|
12161
|
+
>
|
|
12162
|
+
<label
|
|
12163
|
+
part="label"
|
|
12164
|
+
for="control"
|
|
12165
|
+
class="${x => x.defaultSlottedNodes && x.defaultSlottedNodes.length
|
|
12166
|
+
? "label"
|
|
12167
|
+
: "label label__hidden"}"
|
|
12168
|
+
>
|
|
12169
|
+
<slot
|
|
12170
|
+
${slotted({ property: "defaultSlottedNodes", filter: whitespaceFilter })}
|
|
12171
|
+
></slot>
|
|
12172
|
+
</label>
|
|
12173
|
+
<div class="root" part="root">
|
|
12174
|
+
${startSlotTemplate(context, definition)}
|
|
12175
|
+
<input
|
|
12176
|
+
class="control"
|
|
12177
|
+
part="control"
|
|
12178
|
+
id="control"
|
|
12179
|
+
@input="${x => x.handleTextInput()}"
|
|
12180
|
+
@change="${x => x.handleChange()}"
|
|
12181
|
+
?autofocus="${x => x.autofocus}"
|
|
12182
|
+
?disabled="${x => x.disabled}"
|
|
12183
|
+
list="${x => x.list}"
|
|
12184
|
+
maxlength="${x => x.maxlength}"
|
|
12185
|
+
minlength="${x => x.minlength}"
|
|
12186
|
+
pattern="${x => x.pattern}"
|
|
12187
|
+
placeholder="${x => x.placeholder}"
|
|
12188
|
+
?readonly="${x => x.readOnly}"
|
|
12189
|
+
?required="${x => x.required}"
|
|
12190
|
+
size="${x => x.size}"
|
|
12191
|
+
?spellcheck="${x => x.spellcheck}"
|
|
12192
|
+
:value="${x => x.value}"
|
|
12193
|
+
type="${x => x.type}"
|
|
12194
|
+
aria-atomic="${x => x.ariaAtomic}"
|
|
12195
|
+
aria-busy="${x => x.ariaBusy}"
|
|
12196
|
+
aria-controls="${x => x.ariaControls}"
|
|
12197
|
+
aria-current="${x => x.ariaCurrent}"
|
|
12198
|
+
aria-describedby="${x => x.ariaDescribedby}"
|
|
12199
|
+
aria-details="${x => x.ariaDetails}"
|
|
12200
|
+
aria-disabled="${x => x.ariaDisabled}"
|
|
12201
|
+
aria-errormessage="${x => x.ariaErrormessage}"
|
|
12202
|
+
aria-flowto="${x => x.ariaFlowto}"
|
|
12203
|
+
aria-haspopup="${x => x.ariaHaspopup}"
|
|
12204
|
+
aria-hidden="${x => x.ariaHidden}"
|
|
12205
|
+
aria-invalid="${x => x.ariaInvalid}"
|
|
12206
|
+
aria-keyshortcuts="${x => x.ariaKeyshortcuts}"
|
|
12207
|
+
aria-label="${x => x.ariaLabel}"
|
|
12208
|
+
aria-labelledby="${x => x.ariaLabelledby}"
|
|
12209
|
+
aria-live="${x => x.ariaLive}"
|
|
12210
|
+
aria-owns="${x => x.ariaOwns}"
|
|
12211
|
+
aria-relevant="${x => x.ariaRelevant}"
|
|
12212
|
+
aria-roledescription="${x => x.ariaRoledescription}"
|
|
12213
|
+
${ref("control")}
|
|
12214
|
+
/>
|
|
12215
|
+
${endSlotTemplate(context, definition)}
|
|
12216
|
+
</div>
|
|
12217
|
+
</template>
|
|
12218
|
+
`;
|
|
12219
|
+
|
|
11484
12220
|
/**
|
|
11485
12221
|
* The template for the {@link @microsoft/fast-foundation#(Toolbar:class)} component.
|
|
11486
12222
|
*
|
|
@@ -11541,6 +12277,12 @@
|
|
|
11541
12277
|
* A Toolbar Custom HTML Element.
|
|
11542
12278
|
* Implements the {@link https://w3c.github.io/aria-practices/#Toolbar|ARIA Toolbar}.
|
|
11543
12279
|
*
|
|
12280
|
+
* @slot start - Content which can be provided before the slotted items
|
|
12281
|
+
* @slot end - Content which can be provided after the slotted items
|
|
12282
|
+
* @slot - The default slot for slotted items
|
|
12283
|
+
* @slot label - The toolbar label
|
|
12284
|
+
* @csspart positioning-region - The element containing the items, start and end slots
|
|
12285
|
+
*
|
|
11544
12286
|
* @public
|
|
11545
12287
|
*/
|
|
11546
12288
|
class Toolbar$1 extends FoundationElement {
|
|
@@ -11566,6 +12308,11 @@
|
|
|
11566
12308
|
* HTML Attribute: `orientation`
|
|
11567
12309
|
*/
|
|
11568
12310
|
this.orientation = Orientation.horizontal;
|
|
12311
|
+
this.startEndSlotChange = () => {
|
|
12312
|
+
if (this.$fastController.isConnected) {
|
|
12313
|
+
this.reduceFocusableElements();
|
|
12314
|
+
}
|
|
12315
|
+
};
|
|
11569
12316
|
}
|
|
11570
12317
|
/**
|
|
11571
12318
|
* The index of the currently focused element, clamped between 0 and the last element.
|
|
@@ -11606,6 +12353,16 @@
|
|
|
11606
12353
|
connectedCallback() {
|
|
11607
12354
|
super.connectedCallback();
|
|
11608
12355
|
this.direction = getDirection(this);
|
|
12356
|
+
this.start.addEventListener("slotchange", this.startEndSlotChange);
|
|
12357
|
+
this.end.addEventListener("slotchange", this.startEndSlotChange);
|
|
12358
|
+
}
|
|
12359
|
+
/**
|
|
12360
|
+
* @internal
|
|
12361
|
+
*/
|
|
12362
|
+
disconnectedCallback() {
|
|
12363
|
+
super.disconnectedCallback();
|
|
12364
|
+
this.start.removeEventListener("slotchange", this.startEndSlotChange);
|
|
12365
|
+
this.end.removeEventListener("slotchange", this.startEndSlotChange);
|
|
11609
12366
|
}
|
|
11610
12367
|
/**
|
|
11611
12368
|
* When the toolbar receives focus, set the currently active element as focused.
|
|
@@ -11810,6 +12567,18 @@
|
|
|
11810
12567
|
/**
|
|
11811
12568
|
* A Tree item Custom HTML Element.
|
|
11812
12569
|
*
|
|
12570
|
+
* @slot start - Content which can be provided before the tree item content
|
|
12571
|
+
* @slot end - Content which can be provided after the tree item content
|
|
12572
|
+
* @slot - The default slot for tree item text content
|
|
12573
|
+
* @slot item - The slot for tree items (fast tree items manage this assignment themselves)
|
|
12574
|
+
* @slot expand-collapse-button - The expand/collapse button
|
|
12575
|
+
* @csspart positioning-region - The element used to position the tree item content with exception of any child nodes
|
|
12576
|
+
* @csspart content-region - The element containing the expand/collapse, start, and end slots
|
|
12577
|
+
* @csspart items - The element wrapping any child items
|
|
12578
|
+
* @csspart expand-collapse-button - The expand/collapse button
|
|
12579
|
+
* @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
|
|
12580
|
+
* @fires selected-change - Fires a custom 'selected-change' event when the selected state changes
|
|
12581
|
+
*
|
|
11813
12582
|
* @public
|
|
11814
12583
|
*/
|
|
11815
12584
|
class TreeItem$1 extends FoundationElement {
|
|
@@ -11953,6 +12722,8 @@
|
|
|
11953
12722
|
* A Tree view Custom HTML Element.
|
|
11954
12723
|
* Implements the {@link https://w3c.github.io/aria-practices/#TreeView | ARIA TreeView }.
|
|
11955
12724
|
*
|
|
12725
|
+
* @slot - The default slot for tree items
|
|
12726
|
+
*
|
|
11956
12727
|
* @public
|
|
11957
12728
|
*/
|
|
11958
12729
|
class TreeView$1 extends FoundationElement {
|
|
@@ -12026,17 +12797,28 @@
|
|
|
12026
12797
|
case keyArrowLeft:
|
|
12027
12798
|
if (e.target && this.isFocusableElement(e.target)) {
|
|
12028
12799
|
const item = e.target;
|
|
12029
|
-
if (item instanceof TreeItem$1 &&
|
|
12800
|
+
if (item instanceof TreeItem$1 &&
|
|
12801
|
+
item.childItemLength() > 0 &&
|
|
12802
|
+
item.expanded) {
|
|
12030
12803
|
item.expanded = false;
|
|
12031
12804
|
}
|
|
12805
|
+
else if (item instanceof TreeItem$1 &&
|
|
12806
|
+
item.parentElement instanceof TreeItem$1) {
|
|
12807
|
+
TreeItem$1.focusItem(item.parentElement);
|
|
12808
|
+
}
|
|
12032
12809
|
}
|
|
12033
12810
|
return false;
|
|
12034
12811
|
case keyArrowRight:
|
|
12035
12812
|
if (e.target && this.isFocusableElement(e.target)) {
|
|
12036
12813
|
const item = e.target;
|
|
12037
|
-
if (item instanceof TreeItem$1 &&
|
|
12814
|
+
if (item instanceof TreeItem$1 &&
|
|
12815
|
+
item.childItemLength() > 0 &&
|
|
12816
|
+
!item.expanded) {
|
|
12038
12817
|
item.expanded = true;
|
|
12039
12818
|
}
|
|
12819
|
+
else if (item instanceof TreeItem$1 && item.childItemLength() > 0) {
|
|
12820
|
+
this.focusNextNode(1, e.target);
|
|
12821
|
+
}
|
|
12040
12822
|
}
|
|
12041
12823
|
return;
|
|
12042
12824
|
case keyArrowDown:
|
|
@@ -12200,6 +12982,82 @@
|
|
|
12200
12982
|
observable
|
|
12201
12983
|
], TreeView$1.prototype, "slottedTreeItems", void 0);
|
|
12202
12984
|
|
|
12985
|
+
/**
|
|
12986
|
+
* A behavior to add or remove a stylesheet from an element based on a property. The behavior ensures that
|
|
12987
|
+
* styles are applied while the property matches and that styles are not applied if the property does
|
|
12988
|
+
* not match.
|
|
12989
|
+
*
|
|
12990
|
+
* @public
|
|
12991
|
+
*/
|
|
12992
|
+
class PropertyStyleSheetBehavior {
|
|
12993
|
+
/**
|
|
12994
|
+
* Constructs a {@link PropertyStyleSheetBehavior} instance.
|
|
12995
|
+
* @param propertyName - The property name to operate from.
|
|
12996
|
+
* @param value - The property value to operate from.
|
|
12997
|
+
* @param styles - The styles to coordinate with the property.
|
|
12998
|
+
*/
|
|
12999
|
+
constructor(propertyName, value, styles) {
|
|
13000
|
+
this.propertyName = propertyName;
|
|
13001
|
+
this.value = value;
|
|
13002
|
+
this.styles = styles;
|
|
13003
|
+
}
|
|
13004
|
+
/**
|
|
13005
|
+
* Binds the behavior to the element.
|
|
13006
|
+
* @param elementInstance - The element for which the property is applied.
|
|
13007
|
+
*/
|
|
13008
|
+
bind(elementInstance) {
|
|
13009
|
+
Observable.getNotifier(elementInstance).subscribe(this, this.propertyName);
|
|
13010
|
+
this.handleChange(elementInstance, this.propertyName);
|
|
13011
|
+
}
|
|
13012
|
+
/**
|
|
13013
|
+
* Unbinds the behavior from the element.
|
|
13014
|
+
* @param source - The element for which the behavior is unbinding.
|
|
13015
|
+
* @internal
|
|
13016
|
+
*/
|
|
13017
|
+
unbind(source) {
|
|
13018
|
+
Observable.getNotifier(source).unsubscribe(this, this.propertyName);
|
|
13019
|
+
source.$fastController.removeStyles(this.styles);
|
|
13020
|
+
}
|
|
13021
|
+
/**
|
|
13022
|
+
* Change event for the provided element.
|
|
13023
|
+
* @param source - the element for which to attach or detach styles.
|
|
13024
|
+
* @param key - the key to lookup to know if the element already has the styles
|
|
13025
|
+
* @internal
|
|
13026
|
+
*/
|
|
13027
|
+
handleChange(source, key) {
|
|
13028
|
+
if (source[key] === this.value) {
|
|
13029
|
+
source.$fastController.addStyles(this.styles);
|
|
13030
|
+
}
|
|
13031
|
+
else {
|
|
13032
|
+
source.$fastController.removeStyles(this.styles);
|
|
13033
|
+
}
|
|
13034
|
+
}
|
|
13035
|
+
}
|
|
13036
|
+
|
|
13037
|
+
/**
|
|
13038
|
+
* A CSS fragment to set `display: none;` when the host is hidden using the [hidden] attribute.
|
|
13039
|
+
* @public
|
|
13040
|
+
*/
|
|
13041
|
+
const hidden = `:host([hidden]){display:none}`;
|
|
13042
|
+
/**
|
|
13043
|
+
* Applies a CSS display property.
|
|
13044
|
+
* Also adds CSS rules to not display the element when the [hidden] attribute is applied to the element.
|
|
13045
|
+
* @param display - The CSS display property value
|
|
13046
|
+
* @public
|
|
13047
|
+
*/
|
|
13048
|
+
function display(displayValue) {
|
|
13049
|
+
return `${hidden}:host{display:${displayValue}}`;
|
|
13050
|
+
}
|
|
13051
|
+
|
|
13052
|
+
/**
|
|
13053
|
+
* The string representing the focus selector to be used. Value
|
|
13054
|
+
* will be "focus-visible" when https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo
|
|
13055
|
+
* is supported and "focus" when it is not.
|
|
13056
|
+
*
|
|
13057
|
+
* @public
|
|
13058
|
+
*/
|
|
13059
|
+
const focusVisible$1 = canUseFocusVisible() ? "focus-visible" : "focus";
|
|
13060
|
+
|
|
12203
13061
|
const styles$o = css `
|
|
12204
13062
|
:host {
|
|
12205
13063
|
contain: layout;
|
|
@@ -12232,7 +13090,7 @@
|
|
|
12232
13090
|
|
|
12233
13091
|
/**
|
|
12234
13092
|
* Do not edit directly
|
|
12235
|
-
* Generated on Tue,
|
|
13093
|
+
* Generated on Tue, 10 May 2022 14:21:51 GMT
|
|
12236
13094
|
*/
|
|
12237
13095
|
const Warning100DarkUi = "#ff8126";
|
|
12238
13096
|
const Pass100LightUi = "#009921";
|
|
@@ -12315,8 +13173,9 @@
|
|
|
12315
13173
|
const BodyEmphasizedLineHeight = "18px";
|
|
12316
13174
|
const ButtonLabel1LineHeight = "16px";
|
|
12317
13175
|
const TooltipCaptionLineHeight = "14px";
|
|
12318
|
-
const SmallDelay = "0.
|
|
13176
|
+
const SmallDelay = "0.075s"; // Short animation delay used for control state change animation
|
|
12319
13177
|
const MediumDelay = "0.15s"; // Medium animation delay for control state change animation
|
|
13178
|
+
const LargeDelay = "0.25s"; // Long animation delay used for control state change animation
|
|
12320
13179
|
|
|
12321
13180
|
const hexCharacters = 'a-f\\d';
|
|
12322
13181
|
const match3or4Hex = `#?[${hexCharacters}]{3}[${hexCharacters}]?`;
|
|
@@ -12685,8 +13544,8 @@
|
|
|
12685
13544
|
const groupHeaderTextTransform = DesignToken.create(styleNameFromTokenName(tokenNames.groupHeaderTextTransform)).withDefault('uppercase');
|
|
12686
13545
|
// Animation Tokens
|
|
12687
13546
|
const smallDelay = DesignToken.create(styleNameFromTokenName(tokenNames.smallDelay)).withDefault(SmallDelay);
|
|
12688
|
-
|
|
12689
|
-
const largeDelay = DesignToken.create(styleNameFromTokenName(tokenNames.largeDelay)).withDefault(
|
|
13547
|
+
DesignToken.create(styleNameFromTokenName(tokenNames.mediumDelay)).withDefault(MediumDelay);
|
|
13548
|
+
const largeDelay = DesignToken.create(styleNameFromTokenName(tokenNames.largeDelay)).withDefault(LargeDelay);
|
|
12690
13549
|
// Private helpers functions
|
|
12691
13550
|
function hexToRgbPartial(hexValue) {
|
|
12692
13551
|
const { red, green, blue } = hexRgb(hexValue);
|
|
@@ -14244,7 +15103,7 @@
|
|
|
14244
15103
|
? coercedReturn
|
|
14245
15104
|
: matchedValue;
|
|
14246
15105
|
});
|
|
14247
|
-
return "matrix("
|
|
15106
|
+
return "matrix(".concat(normalizedValues.join(","), ")");
|
|
14248
15107
|
}
|
|
14249
15108
|
break;
|
|
14250
15109
|
case "opacity":
|
|
@@ -14280,12 +15139,12 @@
|
|
|
14280
15139
|
switch (functionType) {
|
|
14281
15140
|
case "x":
|
|
14282
15141
|
case "y":
|
|
14283
|
-
functionType = "translate"
|
|
15142
|
+
functionType = "translate".concat(functionType.toUpperCase());
|
|
14284
15143
|
value =
|
|
14285
15144
|
typeof value === "number" ? (value = this.pixelify(value)) : value;
|
|
14286
15145
|
break;
|
|
14287
15146
|
case "rotate":
|
|
14288
|
-
value = value.toString()
|
|
15147
|
+
value = "".concat(value.toString(), "deg");
|
|
14289
15148
|
break;
|
|
14290
15149
|
case "scale":
|
|
14291
15150
|
if (value === 0) {
|
|
@@ -14296,13 +15155,13 @@
|
|
|
14296
15155
|
if (typeof value !== "string") {
|
|
14297
15156
|
value = value.toString();
|
|
14298
15157
|
}
|
|
14299
|
-
return functionType
|
|
15158
|
+
return "".concat(functionType, "(").concat(value, ")");
|
|
14300
15159
|
};
|
|
14301
15160
|
/**
|
|
14302
15161
|
* Converts a number to a pixel string
|
|
14303
15162
|
*/
|
|
14304
15163
|
Animate.prototype.pixelify = function (num) {
|
|
14305
|
-
return num
|
|
15164
|
+
return "".concat(num, "px");
|
|
14306
15165
|
};
|
|
14307
15166
|
/**
|
|
14308
15167
|
* Returns keyframe values based on option configuration
|
|
@@ -14429,10 +15288,12 @@
|
|
|
14429
15288
|
var extendStatics = function (d, b) {
|
|
14430
15289
|
extendStatics = Object.setPrototypeOf ||
|
|
14431
15290
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
14432
|
-
function (d, b) { for (var p in b) if (
|
|
15291
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
14433
15292
|
return extendStatics(d, b);
|
|
14434
15293
|
};
|
|
14435
15294
|
return function (d, b) {
|
|
15295
|
+
if (typeof b !== "function" && b !== null)
|
|
15296
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
14436
15297
|
extendStatics(d, b);
|
|
14437
15298
|
function __() { this.constructor = d; }
|
|
14438
15299
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -14462,10 +15323,12 @@
|
|
|
14462
15323
|
var extendStatics = function (d, b) {
|
|
14463
15324
|
extendStatics = Object.setPrototypeOf ||
|
|
14464
15325
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
14465
|
-
function (d, b) { for (var p in b) if (
|
|
15326
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
14466
15327
|
return extendStatics(d, b);
|
|
14467
15328
|
};
|
|
14468
15329
|
return function (d, b) {
|
|
15330
|
+
if (typeof b !== "function" && b !== null)
|
|
15331
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
14469
15332
|
extendStatics(d, b);
|
|
14470
15333
|
function __() { this.constructor = d; }
|
|
14471
15334
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -14517,19 +15380,19 @@
|
|
|
14517
15380
|
* Pauses all animations in the group
|
|
14518
15381
|
*/
|
|
14519
15382
|
this.pause = function () {
|
|
14520
|
-
invokeFunctionForEach_1$1.invokeFunctionForEach(_this.animations, "pause");
|
|
15383
|
+
(0, invokeFunctionForEach_1$1.invokeFunctionForEach)(_this.animations, "pause");
|
|
14521
15384
|
};
|
|
14522
15385
|
/**
|
|
14523
15386
|
* Finishes all animations in the group
|
|
14524
15387
|
*/
|
|
14525
15388
|
this.finish = function () {
|
|
14526
|
-
invokeFunctionForEach_1$1.invokeFunctionForEach(_this.animations, "finish");
|
|
15389
|
+
(0, invokeFunctionForEach_1$1.invokeFunctionForEach)(_this.animations, "finish");
|
|
14527
15390
|
};
|
|
14528
15391
|
/**
|
|
14529
15392
|
* Cancels all animations in the group
|
|
14530
15393
|
*/
|
|
14531
15394
|
this.cancel = function () {
|
|
14532
|
-
invokeFunctionForEach_1$1.invokeFunctionForEach(_this.animations, "cancel");
|
|
15395
|
+
(0, invokeFunctionForEach_1$1.invokeFunctionForEach)(_this.animations, "cancel");
|
|
14533
15396
|
};
|
|
14534
15397
|
this.animations = animations;
|
|
14535
15398
|
}
|
|
@@ -14562,13 +15425,13 @@
|
|
|
14562
15425
|
* Play the group of animations
|
|
14563
15426
|
*/
|
|
14564
15427
|
AnimateGroup.prototype.play = function () {
|
|
14565
|
-
invokeFunctionForEach_1$1.invokeFunctionForEach(this.animations, "play");
|
|
15428
|
+
(0, invokeFunctionForEach_1$1.invokeFunctionForEach)(this.animations, "play");
|
|
14566
15429
|
};
|
|
14567
15430
|
/**
|
|
14568
15431
|
* Reverses all animations in the group
|
|
14569
15432
|
*/
|
|
14570
15433
|
AnimateGroup.prototype.reverse = function () {
|
|
14571
|
-
invokeFunctionForEach_1$1.invokeFunctionForEach(this.animations, "reverse");
|
|
15434
|
+
(0, invokeFunctionForEach_1$1.invokeFunctionForEach)(this.animations, "reverse");
|
|
14572
15435
|
};
|
|
14573
15436
|
/**
|
|
14574
15437
|
* Returns the longest running animation in the group
|
|
@@ -14623,19 +15486,19 @@
|
|
|
14623
15486
|
* Pauses all animations in the sequence
|
|
14624
15487
|
*/
|
|
14625
15488
|
this.pause = function () {
|
|
14626
|
-
invokeFunctionForEach_1.invokeFunctionForEach(_this.animations, "pause");
|
|
15489
|
+
(0, invokeFunctionForEach_1.invokeFunctionForEach)(_this.animations, "pause");
|
|
14627
15490
|
};
|
|
14628
15491
|
/**
|
|
14629
15492
|
* Finishes all animations in the sequence
|
|
14630
15493
|
*/
|
|
14631
15494
|
this.finish = function () {
|
|
14632
|
-
invokeFunctionForEach_1.invokeFunctionForEach(_this.animations, "finish");
|
|
15495
|
+
(0, invokeFunctionForEach_1.invokeFunctionForEach)(_this.animations, "finish");
|
|
14633
15496
|
};
|
|
14634
15497
|
/**
|
|
14635
15498
|
* Cancels all animations in the sequence
|
|
14636
15499
|
*/
|
|
14637
15500
|
this.cancel = function () {
|
|
14638
|
-
invokeFunctionForEach_1.invokeFunctionForEach(_this.animations, "cancel");
|
|
15501
|
+
(0, invokeFunctionForEach_1.invokeFunctionForEach)(_this.animations, "cancel");
|
|
14639
15502
|
};
|
|
14640
15503
|
this.animations = animations;
|
|
14641
15504
|
}
|
|
@@ -14800,7 +15663,7 @@
|
|
|
14800
15663
|
}
|
|
14801
15664
|
var p0 = points[0];
|
|
14802
15665
|
var p1 = points[1];
|
|
14803
|
-
return "cubic-bezier("
|
|
15666
|
+
return "cubic-bezier(".concat(p0[0], ", ").concat(p0[1], ", ").concat(p1[0], ", ").concat(p1[1], ")");
|
|
14804
15667
|
}
|
|
14805
15668
|
curves.formatCubicBezier = formatCubicBezier;
|
|
14806
15669
|
/**
|
|
@@ -14867,7 +15730,7 @@
|
|
|
14867
15730
|
}
|
|
14868
15731
|
_this.requestedFrame = requestAnimationFrame(_this.update);
|
|
14869
15732
|
};
|
|
14870
|
-
this.lastScrollY = scrollY_1.default();
|
|
15733
|
+
this.lastScrollY = (0, scrollY_1.default)();
|
|
14871
15734
|
// We need to use .bind instead of lambda (fat-arrow) syntax here because
|
|
14872
15735
|
// protected methods declared as lambda functions cannot be invoked by
|
|
14873
15736
|
// extending classes via the `super` object
|
|
@@ -14888,7 +15751,7 @@
|
|
|
14888
15751
|
this.subscriptions.push({
|
|
14889
15752
|
element: element,
|
|
14890
15753
|
callback: callback,
|
|
14891
|
-
inView: isElementInView_1$3.default(element),
|
|
15754
|
+
inView: (0, isElementInView_1$3.default)(element),
|
|
14892
15755
|
});
|
|
14893
15756
|
};
|
|
14894
15757
|
/**
|
|
@@ -14906,7 +15769,7 @@
|
|
|
14906
15769
|
* Make any arbitrary updates to UI
|
|
14907
15770
|
*/
|
|
14908
15771
|
ScrollTrigger.prototype.update = function () {
|
|
14909
|
-
var yOffset = scrollY_1.default();
|
|
15772
|
+
var yOffset = (0, scrollY_1.default)();
|
|
14910
15773
|
this.scrollDistance = yOffset - this.lastScrollY;
|
|
14911
15774
|
this.lastScrollY = yOffset;
|
|
14912
15775
|
};
|
|
@@ -14926,10 +15789,12 @@
|
|
|
14926
15789
|
var extendStatics = function (d, b) {
|
|
14927
15790
|
extendStatics = Object.setPrototypeOf ||
|
|
14928
15791
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
14929
|
-
function (d, b) { for (var p in b) if (
|
|
15792
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
14930
15793
|
return extendStatics(d, b);
|
|
14931
15794
|
};
|
|
14932
15795
|
return function (d, b) {
|
|
15796
|
+
if (typeof b !== "function" && b !== null)
|
|
15797
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
14933
15798
|
extendStatics(d, b);
|
|
14934
15799
|
function __() { this.constructor = d; }
|
|
14935
15800
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -14955,7 +15820,7 @@
|
|
|
14955
15820
|
var _this = this;
|
|
14956
15821
|
_super.prototype.update.call(this);
|
|
14957
15822
|
this.subscriptions.forEach(function (subscription) {
|
|
14958
|
-
var inView = isElementInView_1$2.default(subscription.element);
|
|
15823
|
+
var inView = (0, isElementInView_1$2.default)(subscription.element);
|
|
14959
15824
|
if (inView) {
|
|
14960
15825
|
subscription.callback(_this.scrollDistance);
|
|
14961
15826
|
}
|
|
@@ -14974,10 +15839,12 @@
|
|
|
14974
15839
|
var extendStatics = function (d, b) {
|
|
14975
15840
|
extendStatics = Object.setPrototypeOf ||
|
|
14976
15841
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
14977
|
-
function (d, b) { for (var p in b) if (
|
|
15842
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
14978
15843
|
return extendStatics(d, b);
|
|
14979
15844
|
};
|
|
14980
15845
|
return function (d, b) {
|
|
15846
|
+
if (typeof b !== "function" && b !== null)
|
|
15847
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
14981
15848
|
extendStatics(d, b);
|
|
14982
15849
|
function __() { this.constructor = d; }
|
|
14983
15850
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -15005,7 +15872,7 @@
|
|
|
15005
15872
|
this.subscriptions.forEach(
|
|
15006
15873
|
/* eslint-disable-next-line */
|
|
15007
15874
|
function (subscription, index) {
|
|
15008
|
-
var inView = isElementInView_1$1.default(subscription.element);
|
|
15875
|
+
var inView = (0, isElementInView_1$1.default)(subscription.element);
|
|
15009
15876
|
// If the element is in view but previously wasn't
|
|
15010
15877
|
if (inView && !subscription.inView) {
|
|
15011
15878
|
subscription.callback(_this.scrollDistance);
|
|
@@ -15025,10 +15892,12 @@
|
|
|
15025
15892
|
var extendStatics = function (d, b) {
|
|
15026
15893
|
extendStatics = Object.setPrototypeOf ||
|
|
15027
15894
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
15028
|
-
function (d, b) { for (var p in b) if (
|
|
15895
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
15029
15896
|
return extendStatics(d, b);
|
|
15030
15897
|
};
|
|
15031
15898
|
return function (d, b) {
|
|
15899
|
+
if (typeof b !== "function" && b !== null)
|
|
15900
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
15032
15901
|
extendStatics(d, b);
|
|
15033
15902
|
function __() { this.constructor = d; }
|
|
15034
15903
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -15056,7 +15925,7 @@
|
|
|
15056
15925
|
this.subscriptions.forEach(
|
|
15057
15926
|
/* eslint-disable-next-line */
|
|
15058
15927
|
function (subscription, index) {
|
|
15059
|
-
var inView = isElementInView_1.default(subscription.element);
|
|
15928
|
+
var inView = (0, isElementInView_1.default)(subscription.element);
|
|
15060
15929
|
// If the element is out of view but previously was in view
|
|
15061
15930
|
if (!inView && subscription.inView) {
|
|
15062
15931
|
subscription.callback(_this.scrollDistance);
|
|
@@ -15342,12 +16211,13 @@
|
|
|
15342
16211
|
* @internal
|
|
15343
16212
|
*/
|
|
15344
16213
|
dismiss() {
|
|
16214
|
+
// Note: intentionally not calling super() in this function in order to implement custom preventDismiss behavior
|
|
15345
16215
|
const shouldDismiss = this.$emit('cancel', {},
|
|
15346
16216
|
// Aligned with the configuration of HTMLDialogElement cancel event:
|
|
15347
16217
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/cancel_event
|
|
15348
16218
|
{ bubbles: false, cancelable: true, composed: false });
|
|
15349
16219
|
if (shouldDismiss && !this.preventDismiss) {
|
|
15350
|
-
|
|
16220
|
+
this.$emit('dismiss');
|
|
15351
16221
|
this.hide();
|
|
15352
16222
|
}
|
|
15353
16223
|
}
|
|
@@ -15401,9 +16271,15 @@
|
|
|
15401
16271
|
}
|
|
15402
16272
|
updateAnimationDuration() {
|
|
15403
16273
|
const disableAnimations = prefersReducedMotionMediaQuery.matches;
|
|
15404
|
-
|
|
15405
|
-
|
|
15406
|
-
|
|
16274
|
+
if (disableAnimations) {
|
|
16275
|
+
this.animationDurationMilliseconds = animationDurationWhenDisabledMilliseconds;
|
|
16276
|
+
}
|
|
16277
|
+
else {
|
|
16278
|
+
// string ends in 's' unit specifier
|
|
16279
|
+
const secondsString = largeDelay.getValueFor(this);
|
|
16280
|
+
const secondsNumber = parseFloat(secondsString);
|
|
16281
|
+
this.animationDurationMilliseconds = 1000 * secondsNumber;
|
|
16282
|
+
}
|
|
15407
16283
|
}
|
|
15408
16284
|
animateOpening() {
|
|
15409
16285
|
this.animateOpenClose(true);
|
|
@@ -17834,17 +18710,17 @@
|
|
|
17834
18710
|
${display('inline-flex')}
|
|
17835
18711
|
|
|
17836
18712
|
:host {
|
|
18713
|
+
position: relative;
|
|
17837
18714
|
box-sizing: border-box;
|
|
17838
18715
|
font: ${bodyFont};
|
|
17839
18716
|
height: ${controlHeight};
|
|
17840
|
-
padding: calc(${standardPadding} / 2) ${standardPadding}
|
|
17841
|
-
calc(${standardPadding} / 2 - ${borderWidth});
|
|
17842
18717
|
color: ${bodyFontColor};
|
|
17843
18718
|
align-items: center;
|
|
17844
18719
|
justify-content: center;
|
|
17845
18720
|
cursor: pointer;
|
|
17846
|
-
|
|
17847
|
-
|
|
18721
|
+
--ni-private-active-indicator-width: 2px;
|
|
18722
|
+
--ni-private-focus-indicator-width: 1px;
|
|
18723
|
+
--ni-private-indicator-lines-gap: 1px;
|
|
17848
18724
|
}
|
|
17849
18725
|
|
|
17850
18726
|
:host(:hover) {
|
|
@@ -17855,16 +18731,12 @@
|
|
|
17855
18731
|
outline: none;
|
|
17856
18732
|
}
|
|
17857
18733
|
|
|
17858
|
-
:host(
|
|
17859
|
-
|
|
17860
|
-
box-shadow: 0 calc(${borderWidth} * -1) ${borderHoverColor} inset;
|
|
17861
|
-
transition: box-shadow ${mediumDelay} ease-in-out;
|
|
18734
|
+
:host(:focus:hover) {
|
|
18735
|
+
background-color: ${fillHoverSelectedColor};
|
|
17862
18736
|
}
|
|
17863
18737
|
|
|
17864
|
-
|
|
17865
|
-
:
|
|
17866
|
-
transition-duration: 0.01s;
|
|
17867
|
-
}
|
|
18738
|
+
:host(${focusVisible}) {
|
|
18739
|
+
outline: none;
|
|
17868
18740
|
}
|
|
17869
18741
|
|
|
17870
18742
|
:host(:active) {
|
|
@@ -17876,6 +18748,57 @@
|
|
|
17876
18748
|
color: ${bodyDisabledFontColor};
|
|
17877
18749
|
background: none;
|
|
17878
18750
|
}
|
|
18751
|
+
|
|
18752
|
+
slot {
|
|
18753
|
+
display: block;
|
|
18754
|
+
padding: calc(${standardPadding} / 2) ${standardPadding}
|
|
18755
|
+
calc(${standardPadding} / 2 - ${borderWidth});
|
|
18756
|
+
}
|
|
18757
|
+
|
|
18758
|
+
:host::before {
|
|
18759
|
+
content: '';
|
|
18760
|
+
position: absolute;
|
|
18761
|
+
bottom: calc(
|
|
18762
|
+
var(--ni-private-active-indicator-width) +
|
|
18763
|
+
var(--ni-private-indicator-lines-gap)
|
|
18764
|
+
);
|
|
18765
|
+
width: 0px;
|
|
18766
|
+
height: 0px;
|
|
18767
|
+
border-bottom: ${borderHoverColor}
|
|
18768
|
+
var(--ni-private-focus-indicator-width) solid;
|
|
18769
|
+
transition: width ${smallDelay} ease-in;
|
|
18770
|
+
}
|
|
18771
|
+
|
|
18772
|
+
@media (prefers-reduced-motion) {
|
|
18773
|
+
:host::before {
|
|
18774
|
+
transition-duration: 0.01s;
|
|
18775
|
+
}
|
|
18776
|
+
}
|
|
18777
|
+
|
|
18778
|
+
:host(${focusVisible})::before {
|
|
18779
|
+
width: 100%;
|
|
18780
|
+
}
|
|
18781
|
+
|
|
18782
|
+
:host::after {
|
|
18783
|
+
content: '';
|
|
18784
|
+
position: absolute;
|
|
18785
|
+
bottom: 0px;
|
|
18786
|
+
width: 0px;
|
|
18787
|
+
height: 0px;
|
|
18788
|
+
border-bottom: ${borderHoverColor}
|
|
18789
|
+
var(--ni-private-active-indicator-width) solid;
|
|
18790
|
+
transition: width ${smallDelay} ease-in;
|
|
18791
|
+
}
|
|
18792
|
+
|
|
18793
|
+
@media (prefers-reduced-motion) {
|
|
18794
|
+
:host::after {
|
|
18795
|
+
transition-duration: 0.01s;
|
|
18796
|
+
}
|
|
18797
|
+
}
|
|
18798
|
+
|
|
18799
|
+
:host([aria-selected='true'])::after {
|
|
18800
|
+
width: 100%;
|
|
18801
|
+
}
|
|
17879
18802
|
`;
|
|
17880
18803
|
|
|
17881
18804
|
/**
|
|
@@ -17932,22 +18855,6 @@
|
|
|
17932
18855
|
align-self: end;
|
|
17933
18856
|
}
|
|
17934
18857
|
|
|
17935
|
-
.activeIndicator {
|
|
17936
|
-
grid-row: 2;
|
|
17937
|
-
height: calc(${borderWidth} * 2);
|
|
17938
|
-
background-color: ${borderHoverColor};
|
|
17939
|
-
}
|
|
17940
|
-
|
|
17941
|
-
.activeIndicatorTransition {
|
|
17942
|
-
transition: transform ${smallDelay} ease-in-out;
|
|
17943
|
-
}
|
|
17944
|
-
|
|
17945
|
-
@media (prefers-reduced-motion) {
|
|
17946
|
-
.activeIndicatorTransition {
|
|
17947
|
-
transition: transform 0.01s;
|
|
17948
|
-
}
|
|
17949
|
-
}
|
|
17950
|
-
|
|
17951
18858
|
.tabpanel {
|
|
17952
18859
|
grid-row: 2;
|
|
17953
18860
|
grid-column-start: 1;
|
|
@@ -17959,6 +18866,11 @@
|
|
|
17959
18866
|
* A nimble-styled tabs control
|
|
17960
18867
|
*/
|
|
17961
18868
|
class Tabs extends Tabs$1 {
|
|
18869
|
+
constructor() {
|
|
18870
|
+
super();
|
|
18871
|
+
// We disable the built-in active indicator so that we can implement our own
|
|
18872
|
+
this.activeindicator = false;
|
|
18873
|
+
}
|
|
17962
18874
|
}
|
|
17963
18875
|
const nimbleTabs = Tabs.compose({
|
|
17964
18876
|
baseName: 'tabs',
|