@fluentui/web-components 3.0.0-rc.10 → 3.0.0-rc.12
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/CHANGELOG.md +20 -2
- package/custom-elements.json +241 -256
- package/dist/esm/accordion/accordion.d.ts +2 -1
- package/dist/esm/accordion/accordion.js +52 -49
- package/dist/esm/accordion/accordion.js.map +1 -1
- package/dist/esm/accordion-item/accordion-item.options.d.ts +11 -1
- package/dist/esm/accordion-item/accordion-item.options.js +12 -0
- package/dist/esm/accordion-item/accordion-item.options.js.map +1 -1
- package/dist/esm/anchor-button/anchor-button.base.js +1 -0
- package/dist/esm/anchor-button/anchor-button.base.js.map +1 -1
- package/dist/esm/avatar/avatar.base.d.ts +64 -10
- package/dist/esm/avatar/avatar.base.js +100 -27
- package/dist/esm/avatar/avatar.base.js.map +1 -1
- package/dist/esm/avatar/avatar.styles.js +20 -3
- package/dist/esm/avatar/avatar.styles.js.map +1 -1
- package/dist/esm/avatar/avatar.template.js +4 -3
- package/dist/esm/avatar/avatar.template.js.map +1 -1
- package/dist/esm/button/button.base.d.ts +15 -1
- package/dist/esm/button/button.base.js +27 -24
- package/dist/esm/button/button.base.js.map +1 -1
- package/dist/esm/button/button.template.d.ts +3 -3
- package/dist/esm/button/button.template.js.map +1 -1
- package/dist/esm/dialog/dialog.d.ts +8 -3
- package/dist/esm/dialog/dialog.js +26 -20
- package/dist/esm/dialog/dialog.js.map +1 -1
- package/dist/esm/drawer/drawer.js +0 -1
- package/dist/esm/drawer/drawer.js.map +1 -1
- package/dist/esm/dropdown/dropdown.base.d.ts +1 -0
- package/dist/esm/dropdown/dropdown.base.js +24 -15
- package/dist/esm/dropdown/dropdown.base.js.map +1 -1
- package/dist/esm/listbox/listbox.d.ts +12 -7
- package/dist/esm/listbox/listbox.js +27 -17
- package/dist/esm/listbox/listbox.js.map +1 -1
- package/dist/esm/listbox/listbox.template.js +2 -3
- package/dist/esm/listbox/listbox.template.js.map +1 -1
- package/dist/esm/menu/menu.d.ts +7 -0
- package/dist/esm/menu/menu.js +22 -17
- package/dist/esm/menu/menu.js.map +1 -1
- package/dist/esm/option/option.js +1 -1
- package/dist/esm/option/option.js.map +1 -1
- package/dist/esm/progress-bar/progress-bar.base.d.ts +19 -4
- package/dist/esm/progress-bar/progress-bar.base.js +37 -19
- package/dist/esm/progress-bar/progress-bar.base.js.map +1 -1
- package/dist/esm/radio/radio.options.d.ts +9 -0
- package/dist/esm/radio/radio.options.js +12 -1
- package/dist/esm/radio/radio.options.js.map +1 -1
- package/dist/esm/radio-group/radio-group.d.ts +13 -7
- package/dist/esm/radio-group/radio-group.js +14 -21
- package/dist/esm/radio-group/radio-group.js.map +1 -1
- package/dist/esm/radio-group/radio-group.template.js +2 -2
- package/dist/esm/radio-group/radio-group.template.js.map +1 -1
- package/dist/esm/rating-display/rating-display.base.d.ts +11 -1
- package/dist/esm/rating-display/rating-display.base.js +24 -11
- package/dist/esm/rating-display/rating-display.base.js.map +1 -1
- package/dist/esm/slider/slider.d.ts +7 -3
- package/dist/esm/slider/slider.js +46 -28
- package/dist/esm/slider/slider.js.map +1 -1
- package/dist/esm/tab/tab.d.ts +13 -1
- package/dist/esm/tab/tab.js +16 -2
- package/dist/esm/tab/tab.js.map +1 -1
- package/dist/esm/tablist/tablist.base.d.ts +2 -1
- package/dist/esm/tablist/tablist.base.js +109 -95
- package/dist/esm/tablist/tablist.base.js.map +1 -1
- package/dist/esm/tablist/tablist.d.ts +2 -1
- package/dist/esm/tablist/tablist.js +2 -2
- package/dist/esm/tablist/tablist.js.map +1 -1
- package/dist/esm/text-input/text-input.base.js +12 -5
- package/dist/esm/text-input/text-input.base.js.map +1 -1
- package/dist/esm/text-input/text-input.template.d.ts +1 -1
- package/dist/esm/text-input/text-input.template.js +2 -8
- package/dist/esm/text-input/text-input.template.js.map +1 -1
- package/dist/esm/textarea/textarea.base.d.ts +7 -3
- package/dist/esm/textarea/textarea.base.js +38 -23
- package/dist/esm/textarea/textarea.base.js.map +1 -1
- package/dist/esm/tree/tree.base.d.ts +8 -0
- package/dist/esm/tree/tree.base.js +16 -2
- package/dist/esm/tree/tree.base.js.map +1 -1
- package/dist/esm/tree-item/tree-item.base.d.ts +7 -0
- package/dist/esm/tree-item/tree-item.base.js +14 -12
- package/dist/esm/tree-item/tree-item.base.js.map +1 -1
- package/dist/esm/utils/focusable-element.js +2 -1
- package/dist/esm/utils/focusable-element.js.map +1 -1
- package/dist/esm/utils/request-idle-callback.js +4 -9
- package/dist/esm/utils/request-idle-callback.js.map +1 -1
- package/dist/esm/utils/typings.d.ts +8 -0
- package/dist/esm/utils/typings.js +15 -1
- package/dist/esm/utils/typings.js.map +1 -1
- package/dist/web-components.d.ts +198 -44
- package/dist/web-components.js +605 -368
- package/dist/web-components.min.js +224 -224
- package/package.json +1 -1
package/dist/web-components.js
CHANGED
|
@@ -4108,6 +4108,15 @@ const getDirection = rootNode => {
|
|
|
4108
4108
|
return rootNode.closest("[dir]")?.dir === "rtl" ? Direction.rtl : Direction.ltr;
|
|
4109
4109
|
};
|
|
4110
4110
|
|
|
4111
|
+
function isCustomElement(tagSuffix) {
|
|
4112
|
+
return element => {
|
|
4113
|
+
if (element?.nodeType !== Node.ELEMENT_NODE) {
|
|
4114
|
+
return false;
|
|
4115
|
+
}
|
|
4116
|
+
return element.tagName.toLowerCase().endsWith(tagSuffix);
|
|
4117
|
+
};
|
|
4118
|
+
}
|
|
4119
|
+
|
|
4111
4120
|
function staticallyCompose(item) {
|
|
4112
4121
|
if (!item) {
|
|
4113
4122
|
return InlineTemplateDirective.empty;
|
|
@@ -4627,6 +4636,38 @@ const definition$F = AccordionItem.compose({
|
|
|
4627
4636
|
|
|
4628
4637
|
definition$F.define(FluentDesignSystem.registry);
|
|
4629
4638
|
|
|
4639
|
+
function requestIdleCallback(callback, options) {
|
|
4640
|
+
if ("requestIdleCallback" in globalThis) {
|
|
4641
|
+
return globalThis.requestIdleCallback(callback, options);
|
|
4642
|
+
}
|
|
4643
|
+
const start = Date.now();
|
|
4644
|
+
return setTimeout(() => {
|
|
4645
|
+
callback({
|
|
4646
|
+
didTimeout: options?.timeout ? Date.now() - start >= options.timeout : false,
|
|
4647
|
+
timeRemaining: () => 0
|
|
4648
|
+
});
|
|
4649
|
+
}, 1);
|
|
4650
|
+
}
|
|
4651
|
+
function waitForConnectedDescendants(target, callback, options) {
|
|
4652
|
+
const shallow = options?.shallow ?? false;
|
|
4653
|
+
const timeout = options?.timeout ?? 50;
|
|
4654
|
+
const selector = `${shallow ? ":scope > " : ""}:not(:defined)`;
|
|
4655
|
+
const scheduleCheck = deadline => {
|
|
4656
|
+
if (target.querySelector(selector) === null || deadline && deadline.timeRemaining() <= 0) {
|
|
4657
|
+
requestAnimationFrame(callback);
|
|
4658
|
+
return;
|
|
4659
|
+
}
|
|
4660
|
+
requestIdleCallback(scheduleCheck, {
|
|
4661
|
+
timeout
|
|
4662
|
+
});
|
|
4663
|
+
};
|
|
4664
|
+
scheduleCheck();
|
|
4665
|
+
}
|
|
4666
|
+
|
|
4667
|
+
function isAccordionItem(element, tagName = "-accordion-item") {
|
|
4668
|
+
return isCustomElement(tagName)(element);
|
|
4669
|
+
}
|
|
4670
|
+
|
|
4630
4671
|
const AccordionExpandMode = {
|
|
4631
4672
|
single: "single",
|
|
4632
4673
|
multi: "multi"
|
|
@@ -4643,7 +4684,6 @@ var __decorateClass$M = (decorators, target, key, kind) => {
|
|
|
4643
4684
|
class Accordion extends FASTElement {
|
|
4644
4685
|
constructor() {
|
|
4645
4686
|
super(...arguments);
|
|
4646
|
-
this.expandmode = AccordionExpandMode.multi;
|
|
4647
4687
|
this.activeItemIndex = 0;
|
|
4648
4688
|
/**
|
|
4649
4689
|
* Resets event listeners and sets the `accordionItems` property
|
|
@@ -4651,21 +4691,23 @@ class Accordion extends FASTElement {
|
|
|
4651
4691
|
* @returns {void}
|
|
4652
4692
|
*/
|
|
4653
4693
|
this.setItems = () => {
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4694
|
+
waitForConnectedDescendants(this, () => {
|
|
4695
|
+
if (this.slottedAccordionItems.length === 0) {
|
|
4696
|
+
return;
|
|
4697
|
+
}
|
|
4698
|
+
const children = Array.from(this.children);
|
|
4699
|
+
this.removeItemListeners(children);
|
|
4700
|
+
children.forEach(child => Observable.getNotifier(child).subscribe(this, "disabled"));
|
|
4701
|
+
this.accordionItems = children.filter(child => !child.hasAttribute("disabled"));
|
|
4702
|
+
this.accordionItems.forEach((item, index) => {
|
|
4703
|
+
item.addEventListener("click", this.expandedChangedHandler);
|
|
4704
|
+
Observable.getNotifier(item).subscribe(this, "expanded");
|
|
4705
|
+
});
|
|
4706
|
+
if (this.isSingleExpandMode()) {
|
|
4707
|
+
const expandedItem = this.findExpandedItem();
|
|
4708
|
+
this.setSingleExpandMode(expandedItem);
|
|
4709
|
+
}
|
|
4664
4710
|
});
|
|
4665
|
-
if (this.isSingleExpandMode()) {
|
|
4666
|
-
const expandedItem = this.findExpandedItem();
|
|
4667
|
-
this.setSingleExpandMode(expandedItem);
|
|
4668
|
-
}
|
|
4669
4711
|
};
|
|
4670
4712
|
/**
|
|
4671
4713
|
* Removes event listeners from the previous accordion items
|
|
@@ -4685,7 +4727,7 @@ class Accordion extends FASTElement {
|
|
|
4685
4727
|
*/
|
|
4686
4728
|
this.expandedChangedHandler = evt => {
|
|
4687
4729
|
const item = evt.target;
|
|
4688
|
-
if (item
|
|
4730
|
+
if (isAccordionItem(item)) {
|
|
4689
4731
|
if (!this.isSingleExpandMode()) {
|
|
4690
4732
|
item.expanded = !item.expanded;
|
|
4691
4733
|
this.activeItemIndex = this.accordionItems.indexOf(item);
|
|
@@ -4736,10 +4778,10 @@ class Accordion extends FASTElement {
|
|
|
4736
4778
|
* @returns {void}
|
|
4737
4779
|
*/
|
|
4738
4780
|
findExpandedItem() {
|
|
4739
|
-
if (this.accordionItems.length === 0) {
|
|
4781
|
+
if (!this.accordionItems || this.accordionItems?.length === 0) {
|
|
4740
4782
|
return null;
|
|
4741
4783
|
}
|
|
4742
|
-
return this.accordionItems.find(item => item
|
|
4784
|
+
return this.accordionItems.find(item => isAccordionItem(item) && item.expanded) ?? this.accordionItems[0];
|
|
4743
4785
|
}
|
|
4744
4786
|
/**
|
|
4745
4787
|
* Checks if the accordion is in single expand mode
|
|
@@ -4754,23 +4796,32 @@ class Accordion extends FASTElement {
|
|
|
4754
4796
|
* @returns {void}
|
|
4755
4797
|
*/
|
|
4756
4798
|
setSingleExpandMode(expandedItem) {
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
if (
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
item.
|
|
4799
|
+
requestAnimationFrame(() => {
|
|
4800
|
+
if (this.accordionItems.length === 0) {
|
|
4801
|
+
return;
|
|
4802
|
+
}
|
|
4803
|
+
const currentItems = Array.from(this.accordionItems);
|
|
4804
|
+
this.activeItemIndex = currentItems.indexOf(expandedItem);
|
|
4805
|
+
currentItems.forEach((item, index) => {
|
|
4806
|
+
if (isAccordionItem(item)) {
|
|
4807
|
+
if (this.activeItemIndex === index) {
|
|
4808
|
+
item.expanded = true;
|
|
4809
|
+
item.expandbutton.setAttribute("aria-disabled", "true");
|
|
4810
|
+
} else {
|
|
4811
|
+
item.expanded = false;
|
|
4812
|
+
if (!item.hasAttribute("disabled")) {
|
|
4813
|
+
item.expandbutton.removeAttribute("aria-disabled");
|
|
4814
|
+
}
|
|
4771
4815
|
}
|
|
4772
4816
|
}
|
|
4773
|
-
}
|
|
4817
|
+
});
|
|
4818
|
+
});
|
|
4819
|
+
}
|
|
4820
|
+
connectedCallback() {
|
|
4821
|
+
super.connectedCallback();
|
|
4822
|
+
requestAnimationFrame(() => {
|
|
4823
|
+
this.expandmode = this.expandmode || AccordionExpandMode.multi;
|
|
4824
|
+
this.setItems();
|
|
4774
4825
|
});
|
|
4775
4826
|
}
|
|
4776
4827
|
}
|
|
@@ -4904,6 +4955,7 @@ class BaseAnchor extends FASTElement {
|
|
|
4904
4955
|
}
|
|
4905
4956
|
connectedCallback() {
|
|
4906
4957
|
super.connectedCallback();
|
|
4958
|
+
this.tabIndex = Number(this.getAttribute("tabindex") ?? 0) < 0 ? -1 : 0;
|
|
4907
4959
|
Observable.getNotifier(this).subscribe(this);
|
|
4908
4960
|
Object.keys(this.$fastController.definition.attributeLookup).forEach(key => {
|
|
4909
4961
|
this.handleChange(this, key);
|
|
@@ -5134,6 +5186,7 @@ var __decorateClass$J = (decorators, target, key, kind) => {
|
|
|
5134
5186
|
class BaseAvatar extends FASTElement {
|
|
5135
5187
|
constructor() {
|
|
5136
5188
|
super();
|
|
5189
|
+
this.slottedDefaults = [];
|
|
5137
5190
|
/**
|
|
5138
5191
|
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
5139
5192
|
*
|
|
@@ -5142,41 +5195,103 @@ class BaseAvatar extends FASTElement {
|
|
|
5142
5195
|
this.elementInternals = this.attachInternals();
|
|
5143
5196
|
this.elementInternals.role = "img";
|
|
5144
5197
|
}
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5198
|
+
/**
|
|
5199
|
+
* Handles changes to the default slot element reference.
|
|
5200
|
+
*
|
|
5201
|
+
* Toggles the `has-slotted` class on the slot element for browsers that do not
|
|
5202
|
+
* support the `:has-slotted` CSS selector. Defers cleanup using
|
|
5203
|
+
* `Updates.enqueue` to avoid DOM mutations during hydration that could
|
|
5204
|
+
* corrupt binding markers.
|
|
5205
|
+
*
|
|
5206
|
+
* @internal
|
|
5207
|
+
*/
|
|
5208
|
+
defaultSlotChanged() {
|
|
5209
|
+
if (!CSS.supports("selector(:has-slotted)")) {
|
|
5210
|
+
const elements = this.defaultSlot.assignedElements();
|
|
5211
|
+
this.defaultSlot.classList.toggle("has-slotted", elements.length > 0);
|
|
5212
|
+
}
|
|
5213
|
+
Updates.enqueue(() => {
|
|
5214
|
+
this.cleanupSlottedContent();
|
|
5215
|
+
});
|
|
5148
5216
|
}
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5217
|
+
/**
|
|
5218
|
+
* Updates the monogram text content when the ref is captured.
|
|
5219
|
+
*
|
|
5220
|
+
* @internal
|
|
5221
|
+
*/
|
|
5222
|
+
monogramChanged() {
|
|
5223
|
+
this.updateMonogram();
|
|
5153
5224
|
}
|
|
5154
5225
|
/**
|
|
5155
|
-
*
|
|
5226
|
+
* Handles changes to the slotted default content.
|
|
5227
|
+
*
|
|
5228
|
+
* Normalizes the DOM, toggles the `has-slotted` class on the default slot element
|
|
5229
|
+
* for browsers that do not support the `:has-slotted` CSS selector, and removes
|
|
5230
|
+
* empty text nodes from the default slot to keep the DOM clean.
|
|
5231
|
+
*
|
|
5232
|
+
* @internal
|
|
5233
|
+
*/
|
|
5234
|
+
slottedDefaultsChanged() {
|
|
5235
|
+
if (!this.defaultSlot) {
|
|
5236
|
+
return;
|
|
5237
|
+
}
|
|
5238
|
+
this.cleanupSlottedContent();
|
|
5239
|
+
}
|
|
5240
|
+
/**
|
|
5241
|
+
* Handles changes to the name attribute.
|
|
5242
|
+
* @internal
|
|
5243
|
+
*/
|
|
5244
|
+
nameChanged() {
|
|
5245
|
+
this.updateMonogram();
|
|
5246
|
+
}
|
|
5247
|
+
/**
|
|
5248
|
+
* Handles changes to the initials attribute.
|
|
5249
|
+
* @internal
|
|
5250
|
+
*/
|
|
5251
|
+
initialsChanged() {
|
|
5252
|
+
this.updateMonogram();
|
|
5253
|
+
}
|
|
5254
|
+
/**
|
|
5255
|
+
* Generates and sets the initials for the template.
|
|
5256
|
+
* Subclasses should override this to provide custom initials logic.
|
|
5257
|
+
*
|
|
5258
|
+
* @internal
|
|
5259
|
+
*/
|
|
5260
|
+
generateInitials() {
|
|
5261
|
+
return this.initials || getInitials(this.name, window.getComputedStyle(this).direction === "rtl");
|
|
5262
|
+
}
|
|
5263
|
+
/**
|
|
5264
|
+
* Updates the monogram element's text content with the generated initials.
|
|
5265
|
+
*
|
|
5266
|
+
* @internal
|
|
5267
|
+
*/
|
|
5268
|
+
updateMonogram() {
|
|
5269
|
+
if (this.monogram) {
|
|
5270
|
+
this.monogram.textContent = this.generateInitials() ?? "";
|
|
5271
|
+
}
|
|
5272
|
+
}
|
|
5273
|
+
/**
|
|
5274
|
+
* Normalizes the DOM and removes empty text nodes from the default slot.
|
|
5156
5275
|
*
|
|
5157
|
-
* @param e - The event object
|
|
5158
5276
|
* @internal
|
|
5159
5277
|
*/
|
|
5160
|
-
|
|
5278
|
+
cleanupSlottedContent() {
|
|
5161
5279
|
this.normalize();
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
const nodes = this.defaultSlot.assignedNodes();
|
|
5165
|
-
nodes.filter(node => node.nodeType === Node.TEXT_NODE).forEach(node => {
|
|
5166
|
-
this.removeChild(node);
|
|
5167
|
-
});
|
|
5280
|
+
if (!CSS.supports("selector(:has-slotted)")) {
|
|
5281
|
+
this.defaultSlot.classList.toggle("has-slotted", !!this.slottedDefaults.length);
|
|
5168
5282
|
}
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
once: true,
|
|
5175
|
-
signal: this.abortSignal.signal
|
|
5283
|
+
if (!this.innerText.trim()) {
|
|
5284
|
+
this.slottedDefaults.forEach(node => {
|
|
5285
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
5286
|
+
node.remove();
|
|
5287
|
+
}
|
|
5176
5288
|
});
|
|
5177
|
-
}
|
|
5289
|
+
}
|
|
5178
5290
|
}
|
|
5179
5291
|
}
|
|
5292
|
+
__decorateClass$J([observable], BaseAvatar.prototype, "defaultSlot", 2);
|
|
5293
|
+
__decorateClass$J([observable], BaseAvatar.prototype, "monogram", 2);
|
|
5294
|
+
__decorateClass$J([observable], BaseAvatar.prototype, "slottedDefaults", 2);
|
|
5180
5295
|
__decorateClass$J([attr], BaseAvatar.prototype, "name", 2);
|
|
5181
5296
|
__decorateClass$J([attr], BaseAvatar.prototype, "initials", 2);
|
|
5182
5297
|
|
|
@@ -5312,11 +5427,11 @@ const animations = {
|
|
|
5312
5427
|
nullEasing: curveLinear
|
|
5313
5428
|
};
|
|
5314
5429
|
const styles$A = css`
|
|
5315
|
-
${display("inline-
|
|
5430
|
+
${display("inline-grid")} :host{position:relative;place-items:center;place-content:center;grid-template:1fr / 1fr;flex-shrink:0;width:32px;height:32px;font-family:${fontFamilyBase};font-weight:${fontWeightSemibold};font-size:${fontSizeBase300};border-radius:${borderRadiusCircular};color:${colorNeutralForeground3};background-color:${colorNeutralBackground6};contain:layout style}.monogram,.default-icon{grid-area:1 / 1 / -1 / -1}.monogram:empty{display:none}.default-slot:is(.has-slotted,:has-slotted) ~ .default-icon,.default-slot:is(.has-slotted,:has-slotted) ~ .monogram,:host(:is([name]):not([name=''])) .default-icon,:host(:is([initials]):not([initials=''])) .default-icon{display:none}.default-icon,::slotted(svg){width:20px;height:20px;font-size:20px}::slotted(img){box-sizing:border-box;width:100%;height:100%;border-radius:${borderRadiusCircular}}::slotted([slot='badge']){position:absolute;bottom:0;right:0;box-shadow:0 0 0 ${strokeWidthThin} ${colorNeutralBackground1}}:host([size='64']) ::slotted([slot='badge']),:host([size='72']) ::slotted([slot='badge']),:host([size='96']) ::slotted([slot='badge']),:host([size='120']) ::slotted([slot='badge']),:host([size='128']) ::slotted([slot='badge']){box-shadow:0 0 0 ${strokeWidthThick} ${colorNeutralBackground1}}:host([size='16']),:host([size='20']),:host([size='24']){font-size:${fontSizeBase100};font-weight:${fontWeightRegular}}:host([size='16']){width:16px;height:16px}:host([size='20']){width:20px;height:20px}:host([size='24']){width:24px;height:24px}:host([size='16']) .default-icon,:host([size='16']) ::slotted(svg){width:12px;height:12px;font-size:12px}:host([size='20']) .default-icon,:host([size='24']) .default-icon,:host([size='20']) ::slotted(svg),:host([size='24']) ::slotted(svg){width:16px;height:16px;font-size:16px}:host([size='28']){width:28px;height:28px;font-size:${fontSizeBase200}}:host([size='36']){width:36px;height:36px}:host([size='40']){width:40px;height:40px}:host([size='48']),:host([size='56']){font-size:${fontSizeBase400}}:host([size='48']){width:48px;height:48px}:host([size='48']) .default-icon,:host([size='48']) ::slotted(svg){width:24px;height:24px;font-size:24px}:host([size='56']){width:56px;height:56px}:host([size='56']) .default-icon,:host([size='56']) ::slotted(svg){width:28px;height:28px;font-size:28px}:host([size='64']),:host([size='72']),:host([size='96']){font-size:${fontSizeBase500}}:host([size='64']) .default-icon,:host([size='72']) .default-icon,:host([size='64']) ::slotted(svg),:host([size='72']) ::slotted(svg){width:32px;height:32px;font-size:32px}:host([size='64']){width:64px;height:64px}:host([size='72']){width:72px;height:72px}:host([size='96']){width:96px;height:96px}:host([size='96']) .default-icon,:host([size='120']) .default-icon,:host([size='128']) .default-icon,:host([size='96']) ::slotted(svg),:host([size='120']) ::slotted(svg),:host([size='128']) ::slotted(svg){width:48px;height:48px;font-size:48px}:host([size='120']),:host([size='128']){font-size:${fontSizeBase600}}:host([size='120']){width:120px;height:120px}:host([size='128']){width:128px;height:128px}:host([shape='square']){border-radius:${borderRadiusMedium}}:host([shape='square'][size='20']),:host([shape='square'][size='24']){border-radius:${borderRadiusSmall}}:host([shape='square'][size='56']),:host([shape='square'][size='64']),:host([shape='square'][size='72']){border-radius:${borderRadiusLarge}}:host([shape='square'][size='96']),:host([shape='square'][size='120']),:host([shape='square'][size='128']){border-radius:${borderRadiusXLarge}}:host([data-color='brand']){color:${colorNeutralForegroundStaticInverted};background-color:${colorBrandBackgroundStatic}}:host([data-color='dark-red']){color:${colorPaletteDarkRedForeground2};background-color:${colorPaletteDarkRedBackground2}}:host([data-color='cranberry']){color:${colorPaletteCranberryForeground2};background-color:${colorPaletteCranberryBackground2}}:host([data-color='red']){color:${colorPaletteRedForeground2};background-color:${colorPaletteRedBackground2}}:host([data-color='pumpkin']){color:${colorPalettePumpkinForeground2};background-color:${colorPalettePumpkinBackground2}}:host([data-color='peach']){color:${colorPalettePeachForeground2};background-color:${colorPalettePeachBackground2}}:host([data-color='marigold']){color:${colorPaletteMarigoldForeground2};background-color:${colorPaletteMarigoldBackground2}}:host([data-color='gold']){color:${colorPaletteGoldForeground2};background-color:${colorPaletteGoldBackground2}}:host([data-color='brass']){color:${colorPaletteBrassForeground2};background-color:${colorPaletteBrassBackground2}}:host([data-color='brown']){color:${colorPaletteBrownForeground2};background-color:${colorPaletteBrownBackground2}}:host([data-color='forest']){color:${colorPaletteForestForeground2};background-color:${colorPaletteForestBackground2}}:host([data-color='seafoam']){color:${colorPaletteSeafoamForeground2};background-color:${colorPaletteSeafoamBackground2}}:host([data-color='dark-green']){color:${colorPaletteDarkGreenForeground2};background-color:${colorPaletteDarkGreenBackground2}}:host([data-color='light-teal']){color:${colorPaletteLightTealForeground2};background-color:${colorPaletteLightTealBackground2}}:host([data-color='teal']){color:${colorPaletteTealForeground2};background-color:${colorPaletteTealBackground2}}:host([data-color='steel']){color:${colorPaletteSteelForeground2};background-color:${colorPaletteSteelBackground2}}:host([data-color='blue']){color:${colorPaletteBlueForeground2};background-color:${colorPaletteBlueBackground2}}:host([data-color='royal-blue']){color:${colorPaletteRoyalBlueForeground2};background-color:${colorPaletteRoyalBlueBackground2}}:host([data-color='cornflower']){color:${colorPaletteCornflowerForeground2};background-color:${colorPaletteCornflowerBackground2}}:host([data-color='navy']){color:${colorPaletteNavyForeground2};background-color:${colorPaletteNavyBackground2}}:host([data-color='lavender']){color:${colorPaletteLavenderForeground2};background-color:${colorPaletteLavenderBackground2}}:host([data-color='purple']){color:${colorPalettePurpleForeground2};background-color:${colorPalettePurpleBackground2}}:host([data-color='grape']){color:${colorPaletteGrapeForeground2};background-color:${colorPaletteGrapeBackground2}}:host([data-color='lilac']){color:${colorPaletteLilacForeground2};background-color:${colorPaletteLilacBackground2}}:host([data-color='pink']){color:${colorPalettePinkForeground2};background-color:${colorPalettePinkBackground2}}:host([data-color='magenta']){color:${colorPaletteMagentaForeground2};background-color:${colorPaletteMagentaBackground2}}:host([data-color='plum']){color:${colorPalettePlumForeground2};background-color:${colorPalettePlumBackground2}}:host([data-color='beige']){color:${colorPaletteBeigeForeground2};background-color:${colorPaletteBeigeBackground2}}:host([data-color='mink']){color:${colorPaletteMinkForeground2};background-color:${colorPaletteMinkBackground2}}:host([data-color='platinum']){color:${colorPalettePlatinumForeground2};background-color:${colorPalettePlatinumBackground2}}:host([data-color='anchor']){color:${colorPaletteAnchorForeground2};background-color:${colorPaletteAnchorBackground2}}:host([active]){transform:perspective(1px);transition-property:transform,opacity;transition-duration:${durationUltraSlow},${durationFaster};transition-delay:${animations.fastEase},${animations.nullEasing}}:host([active])::before{content:'';position:absolute;top:0;left:0;bottom:0;right:0;border-radius:inherit;transition-property:margin,opacity;transition-duration:${durationUltraSlow},${durationSlower};transition-delay:${animations.fastEase},${animations.nullEasing}}:host([active])::before{box-shadow:${shadow8};border-style:solid;border-color:${colorBrandBackgroundStatic}}:host([active][appearance='shadow'])::before{border-style:none;border-color:none}:host([active]:not([appearance='shadow']))::before{margin:calc(-2 * ${strokeWidthThick});border-width:${strokeWidthThick}}:host([size='56'][active]:not([appearance='shadow']))::before,:host([size='64'][active]:not([appearance='shadow']))::before{margin:calc(-2 * ${strokeWidthThicker});border-width:${strokeWidthThicker}}:host([size='72'][active]:not([appearance='shadow']))::before,:host([size='96'][active]:not([appearance='shadow']))::before,:host([size='120'][active]:not([appearance='shadow']))::before,:host([size='128'][active]:not([appearance='shadow']))::before{margin:calc(-2 * ${strokeWidthThickest});border-width:${strokeWidthThickest}}:host([size='20'][active][appearance])::before,:host([size='24'][active][appearance])::before,:host([size='28'][active][appearance])::before{box-shadow:${shadow4}}:host([size='56'][active][appearance])::before,:host([size='64'][active][appearance])::before{box-shadow:${shadow16}}:host([size='72'][active][appearance])::before,:host([size='96'][active][appearance])::before,:host([size='120'][active][appearance])::before,:host([size='128'][active][appearance])::before{box-shadow:${shadow28}}:host([active][appearance='ring'])::before{box-shadow:none}:host([active='inactive']){opacity:0.8;transform:scale(0.875);transition-property:transform,opacity;transition-duration:${durationUltraSlow},${durationFaster};transition-delay:${animations.fastOutSlowInMin},${animations.nullEasing}}:host([active='inactive'])::before{margin:0;opacity:0;transition-property:margin,opacity;transition-duration:${durationUltraSlow},${durationSlower};transition-delay:${animations.fastOutSlowInMin},${animations.nullEasing}}@media screen and (prefers-reduced-motion:reduce){:host([active]){transition-duration:0.01ms}:host([active])::before{transition-duration:0.01ms;transition-delay:0.01ms}}`;
|
|
5316
5431
|
|
|
5317
|
-
const defaultIconTemplate = html`<svg width="1em" height="1em" viewBox="0 0 20 20"
|
|
5432
|
+
const defaultIconTemplate = html`<svg width="1em" height="1em" viewBox="0 0 20 20" class="default-icon" fill="currentcolor" aria-hidden="true"><path d="M10 2a4 4 0 100 8 4 4 0 000-8zM7 6a3 3 0 116 0 3 3 0 01-6 0zm-2 5a2 2 0 00-2 2c0 1.7.83 2.97 2.13 3.8A9.14 9.14 0 0010 18c1.85 0 3.58-.39 4.87-1.2A4.35 4.35 0 0017 13a2 2 0 00-2-2H5zm-1 2a1 1 0 011-1h10a1 1 0 011 1c0 1.3-.62 2.28-1.67 2.95A8.16 8.16 0 0110 17a8.16 8.16 0 01-4.33-1.05A3.36 3.36 0 014 13z"></path></svg>`;
|
|
5318
5433
|
function avatarTemplate() {
|
|
5319
|
-
return html`<slot ${ref("defaultSlot")}>${x => x.
|
|
5434
|
+
return html`<slot class="default-slot" ${slotted("slottedDefaults")} ${ref("defaultSlot")}></slot><span class="monogram" ${ref("monogram")}>${x => x.initials}</span>${defaultIconTemplate}<slot name="badge"></slot>`;
|
|
5320
5435
|
}
|
|
5321
5436
|
const template$C = avatarTemplate();
|
|
5322
5437
|
|
|
@@ -5751,7 +5866,6 @@ var __decorateClass$G = (decorators, target, key, kind) => {
|
|
|
5751
5866
|
class BaseButton extends FASTElement {
|
|
5752
5867
|
constructor() {
|
|
5753
5868
|
super();
|
|
5754
|
-
this.disabled = false;
|
|
5755
5869
|
this.disabledFocusable = false;
|
|
5756
5870
|
/**
|
|
5757
5871
|
* The internal {@link https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
@@ -5761,15 +5875,16 @@ class BaseButton extends FASTElement {
|
|
|
5761
5875
|
this.elementInternals = this.attachInternals();
|
|
5762
5876
|
this.elementInternals.role = "button";
|
|
5763
5877
|
}
|
|
5878
|
+
/**
|
|
5879
|
+
* Handles changes to the disabled attribute. If the button is disabled, it
|
|
5880
|
+
* should not be focusable.
|
|
5881
|
+
*
|
|
5882
|
+
* @param previous - the previous disabled value
|
|
5883
|
+
* @param next - the new disabled value
|
|
5884
|
+
* @internal
|
|
5885
|
+
*/
|
|
5764
5886
|
disabledChanged() {
|
|
5765
|
-
|
|
5766
|
-
return;
|
|
5767
|
-
}
|
|
5768
|
-
if (this.disabled) {
|
|
5769
|
-
this.removeAttribute("tabindex");
|
|
5770
|
-
} else {
|
|
5771
|
-
this.tabIndex = Number(this.getAttribute("tabindex") ?? 0) < 0 ? -1 : 0;
|
|
5772
|
-
}
|
|
5887
|
+
this.setTabIndex();
|
|
5773
5888
|
}
|
|
5774
5889
|
/**
|
|
5775
5890
|
* Sets the element's internal disabled state when the element is focusable while disabled.
|
|
@@ -5779,7 +5894,7 @@ class BaseButton extends FASTElement {
|
|
|
5779
5894
|
* @internal
|
|
5780
5895
|
*/
|
|
5781
5896
|
disabledFocusableChanged(previous, next) {
|
|
5782
|
-
if (this
|
|
5897
|
+
if (this.elementInternals) {
|
|
5783
5898
|
this.elementInternals.ariaDisabled = `${!!next}`;
|
|
5784
5899
|
}
|
|
5785
5900
|
}
|
|
@@ -5829,7 +5944,7 @@ class BaseButton extends FASTElement {
|
|
|
5829
5944
|
connectedCallback() {
|
|
5830
5945
|
super.connectedCallback();
|
|
5831
5946
|
this.elementInternals.ariaDisabled = `${!!this.disabledFocusable}`;
|
|
5832
|
-
this.
|
|
5947
|
+
this.setTabIndex();
|
|
5833
5948
|
}
|
|
5834
5949
|
/**
|
|
5835
5950
|
* This fallback creates a new slot, then creates a submit button to mirror the custom element's
|
|
@@ -5930,6 +6045,18 @@ class BaseButton extends FASTElement {
|
|
|
5930
6045
|
resetForm() {
|
|
5931
6046
|
this.elementInternals.form?.reset();
|
|
5932
6047
|
}
|
|
6048
|
+
/**
|
|
6049
|
+
* Sets the `tabindex` attribute based on the disabled state of the button.
|
|
6050
|
+
*
|
|
6051
|
+
* @internal
|
|
6052
|
+
*/
|
|
6053
|
+
setTabIndex() {
|
|
6054
|
+
if (this.disabled) {
|
|
6055
|
+
this.removeAttribute("tabindex");
|
|
6056
|
+
return;
|
|
6057
|
+
}
|
|
6058
|
+
this.tabIndex = Number(this.getAttribute("tabindex") ?? 0) < 0 ? -1 : 0;
|
|
6059
|
+
}
|
|
5933
6060
|
/**
|
|
5934
6061
|
* Submits the associated form.
|
|
5935
6062
|
*
|
|
@@ -6689,25 +6816,11 @@ class Dialog extends FASTElement {
|
|
|
6689
6816
|
});
|
|
6690
6817
|
};
|
|
6691
6818
|
}
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
return;
|
|
6695
|
-
}
|
|
6696
|
-
if (next === DialogType.alert) {
|
|
6697
|
-
this.dialog.setAttribute("role", "alertdialog");
|
|
6698
|
-
} else {
|
|
6699
|
-
this.dialog.removeAttribute("role");
|
|
6700
|
-
}
|
|
6701
|
-
if (next !== DialogType.nonModal) {
|
|
6702
|
-
this.dialog.setAttribute("aria-modal", "true");
|
|
6703
|
-
} else {
|
|
6704
|
-
this.dialog.removeAttribute("aria-modal");
|
|
6705
|
-
}
|
|
6819
|
+
dialogChanged() {
|
|
6820
|
+
this.updateDialogAttributes();
|
|
6706
6821
|
}
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
super.connectedCallback();
|
|
6710
|
-
this.typeChanged(void 0, this.type);
|
|
6822
|
+
typeChanged(prev, next) {
|
|
6823
|
+
this.updateDialogAttributes();
|
|
6711
6824
|
}
|
|
6712
6825
|
/**
|
|
6713
6826
|
* Method to show the dialog
|
|
@@ -6748,6 +6861,26 @@ class Dialog extends FASTElement {
|
|
|
6748
6861
|
}
|
|
6749
6862
|
return true;
|
|
6750
6863
|
}
|
|
6864
|
+
/**
|
|
6865
|
+
* Updates the internal dialog element's attributes based on its type.
|
|
6866
|
+
*
|
|
6867
|
+
* @internal
|
|
6868
|
+
*/
|
|
6869
|
+
updateDialogAttributes() {
|
|
6870
|
+
if (!this.dialog) {
|
|
6871
|
+
return;
|
|
6872
|
+
}
|
|
6873
|
+
if (this.type === DialogType.alert) {
|
|
6874
|
+
this.dialog.setAttribute("role", "alertdialog");
|
|
6875
|
+
} else {
|
|
6876
|
+
this.dialog.removeAttribute("role");
|
|
6877
|
+
}
|
|
6878
|
+
if (this.type !== DialogType.nonModal) {
|
|
6879
|
+
this.dialog.setAttribute("aria-modal", "true");
|
|
6880
|
+
} else {
|
|
6881
|
+
this.dialog.removeAttribute("aria-modal");
|
|
6882
|
+
}
|
|
6883
|
+
}
|
|
6751
6884
|
}
|
|
6752
6885
|
__decorateClass$B([observable], Dialog.prototype, "dialog", 2);
|
|
6753
6886
|
__decorateClass$B([attr({
|
|
@@ -7048,7 +7181,6 @@ class Drawer extends FASTElement {
|
|
|
7048
7181
|
});
|
|
7049
7182
|
}
|
|
7050
7183
|
updateDialogRole() {
|
|
7051
|
-
console.log(this.role);
|
|
7052
7184
|
if (!this.dialog) {
|
|
7053
7185
|
return;
|
|
7054
7186
|
}
|
|
@@ -7145,46 +7277,6 @@ function uniqueId(prefix = "id-") {
|
|
|
7145
7277
|
return document.getElementById(str) ? uniqueId(prefix) : str;
|
|
7146
7278
|
}
|
|
7147
7279
|
|
|
7148
|
-
function requestIdleCallback(callback, options) {
|
|
7149
|
-
if ("requestIdleCallback" in globalThis) {
|
|
7150
|
-
return globalThis.requestIdleCallback(callback, options);
|
|
7151
|
-
}
|
|
7152
|
-
const start = Date.now();
|
|
7153
|
-
return setTimeout(() => {
|
|
7154
|
-
callback({
|
|
7155
|
-
didTimeout: options?.timeout ? Date.now() - start >= options.timeout : false,
|
|
7156
|
-
timeRemaining: () => 0
|
|
7157
|
-
});
|
|
7158
|
-
}, 1);
|
|
7159
|
-
}
|
|
7160
|
-
function cancelIdleCallback(id) {
|
|
7161
|
-
if ("cancelIdleCallback" in globalThis) {
|
|
7162
|
-
globalThis.cancelIdleCallback(id);
|
|
7163
|
-
} else {
|
|
7164
|
-
clearTimeout(id);
|
|
7165
|
-
}
|
|
7166
|
-
}
|
|
7167
|
-
function waitForConnectedDescendants(target, callback, options) {
|
|
7168
|
-
let idleCallbackId;
|
|
7169
|
-
const shallow = options?.shallow ?? false;
|
|
7170
|
-
const query = `${shallow ? ":scope > " : ""}:not(:defined)`;
|
|
7171
|
-
const timeout = options?.timeout ?? 50;
|
|
7172
|
-
const scheduleCheck = deadline => {
|
|
7173
|
-
if (idleCallbackId) {
|
|
7174
|
-
cancelIdleCallback(idleCallbackId);
|
|
7175
|
-
idleCallbackId = void 0;
|
|
7176
|
-
}
|
|
7177
|
-
if (!target.querySelector(query) || deadline && deadline.timeRemaining() <= 0) {
|
|
7178
|
-
callback();
|
|
7179
|
-
return;
|
|
7180
|
-
}
|
|
7181
|
-
idleCallbackId = requestIdleCallback(scheduleCheck, {
|
|
7182
|
-
timeout
|
|
7183
|
-
});
|
|
7184
|
-
};
|
|
7185
|
-
scheduleCheck();
|
|
7186
|
-
}
|
|
7187
|
-
|
|
7188
7280
|
const DropdownAppearance = {
|
|
7189
7281
|
filledDarker: "filled-darker",
|
|
7190
7282
|
filledLighter: "filled-lighter",
|
|
@@ -7255,9 +7347,6 @@ const _BaseDropdown = class _BaseDropdown extends FASTElement {
|
|
|
7255
7347
|
*/
|
|
7256
7348
|
this.elementInternals = this.attachInternals();
|
|
7257
7349
|
this.elementInternals.role = "presentation";
|
|
7258
|
-
Updates.enqueue(() => {
|
|
7259
|
-
this.insertControl();
|
|
7260
|
-
});
|
|
7261
7350
|
}
|
|
7262
7351
|
get activeDescendant() {
|
|
7263
7352
|
if (this.open) {
|
|
@@ -7306,11 +7395,13 @@ const _BaseDropdown = class _BaseDropdown extends FASTElement {
|
|
|
7306
7395
|
* @param next - the current disabled state
|
|
7307
7396
|
*/
|
|
7308
7397
|
disabledChanged(prev, next) {
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7398
|
+
if (this.listbox) {
|
|
7399
|
+
Updates.enqueue(() => {
|
|
7400
|
+
this.options.forEach(option => {
|
|
7401
|
+
option.disabled = option.disabledAttribute || this.disabled;
|
|
7402
|
+
});
|
|
7312
7403
|
});
|
|
7313
|
-
}
|
|
7404
|
+
}
|
|
7314
7405
|
}
|
|
7315
7406
|
get displayValue() {
|
|
7316
7407
|
if (!this.$fastController.isConnected || !this.control || this.isCombobox && this.multiple) {
|
|
@@ -7348,10 +7439,12 @@ const _BaseDropdown = class _BaseDropdown extends FASTElement {
|
|
|
7348
7439
|
next.tabIndex = -1;
|
|
7349
7440
|
const notifier = Observable.getNotifier(this);
|
|
7350
7441
|
notifier.subscribe(next);
|
|
7351
|
-
|
|
7352
|
-
notifier.notify(key);
|
|
7353
|
-
}
|
|
7442
|
+
notifier.notify("multiple");
|
|
7354
7443
|
Updates.enqueue(() => {
|
|
7444
|
+
this.options.forEach(option => {
|
|
7445
|
+
option.disabled = option.disabledAttribute || this.disabled;
|
|
7446
|
+
option.name = this.name;
|
|
7447
|
+
});
|
|
7355
7448
|
this.enabledOptions.filter(x => x.defaultSelected).forEach((x, i) => {
|
|
7356
7449
|
x.selected = this.multiple || i === 0;
|
|
7357
7450
|
});
|
|
@@ -7383,11 +7476,13 @@ const _BaseDropdown = class _BaseDropdown extends FASTElement {
|
|
|
7383
7476
|
* @param next - the current name
|
|
7384
7477
|
*/
|
|
7385
7478
|
nameChanged(prev, next) {
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
option
|
|
7479
|
+
if (this.listbox) {
|
|
7480
|
+
Updates.enqueue(() => {
|
|
7481
|
+
this.options.forEach(option => {
|
|
7482
|
+
option.name = next;
|
|
7483
|
+
});
|
|
7389
7484
|
});
|
|
7390
|
-
}
|
|
7485
|
+
}
|
|
7391
7486
|
}
|
|
7392
7487
|
/**
|
|
7393
7488
|
* Handles the open state of the dropdown.
|
|
@@ -7865,6 +7960,12 @@ const _BaseDropdown = class _BaseDropdown extends FASTElement {
|
|
|
7865
7960
|
this.freeformOption.value = value;
|
|
7866
7961
|
this.freeformOption.hidden = false;
|
|
7867
7962
|
}
|
|
7963
|
+
connectedCallback() {
|
|
7964
|
+
super.connectedCallback();
|
|
7965
|
+
Updates.enqueue(() => {
|
|
7966
|
+
this.insertControl();
|
|
7967
|
+
});
|
|
7968
|
+
}
|
|
7868
7969
|
disconnectedCallback() {
|
|
7869
7970
|
_BaseDropdown.AnchorPositionFallbackObserver?.disconnect();
|
|
7870
7971
|
this.debounceController?.abort();
|
|
@@ -8366,7 +8467,6 @@ var __decorateClass$q = (decorators, target, key, kind) => {
|
|
|
8366
8467
|
class Listbox extends FASTElement {
|
|
8367
8468
|
constructor() {
|
|
8368
8469
|
super();
|
|
8369
|
-
this.id = uniqueId("listbox-");
|
|
8370
8470
|
/**
|
|
8371
8471
|
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
8372
8472
|
*
|
|
@@ -8375,6 +8475,15 @@ class Listbox extends FASTElement {
|
|
|
8375
8475
|
this.elementInternals = this.attachInternals();
|
|
8376
8476
|
this.elementInternals.role = "listbox";
|
|
8377
8477
|
}
|
|
8478
|
+
/**
|
|
8479
|
+
* Calls the `slotchangeHandler` when the `defaultSlot` element is assigned
|
|
8480
|
+
* via the `ref` directive in the template.
|
|
8481
|
+
*
|
|
8482
|
+
* @internal
|
|
8483
|
+
*/
|
|
8484
|
+
defaultSlotChanged() {
|
|
8485
|
+
this.slotchangeHandler();
|
|
8486
|
+
}
|
|
8378
8487
|
/**
|
|
8379
8488
|
* Updates the multiple selection state of the listbox and its options.
|
|
8380
8489
|
*
|
|
@@ -8454,6 +8563,14 @@ class Listbox extends FASTElement {
|
|
|
8454
8563
|
}
|
|
8455
8564
|
return true;
|
|
8456
8565
|
}
|
|
8566
|
+
connectedCallback() {
|
|
8567
|
+
super.connectedCallback();
|
|
8568
|
+
waitForConnectedDescendants(this, () => {
|
|
8569
|
+
this.id = this.id || uniqueId("listbox-");
|
|
8570
|
+
}, {
|
|
8571
|
+
shallow: true
|
|
8572
|
+
});
|
|
8573
|
+
}
|
|
8457
8574
|
/**
|
|
8458
8575
|
* Handles observable subscriptions for the listbox.
|
|
8459
8576
|
*
|
|
@@ -8501,17 +8618,15 @@ class Listbox extends FASTElement {
|
|
|
8501
8618
|
* @public
|
|
8502
8619
|
*/
|
|
8503
8620
|
slotchangeHandler(e) {
|
|
8504
|
-
const target = e.target;
|
|
8505
8621
|
waitForConnectedDescendants(this, () => {
|
|
8506
|
-
|
|
8507
|
-
|
|
8622
|
+
if (this.defaultSlot) {
|
|
8623
|
+
const options = this.defaultSlot.assignedElements().filter(option => isDropdownOption(option));
|
|
8624
|
+
this.options = options;
|
|
8625
|
+
}
|
|
8508
8626
|
});
|
|
8509
8627
|
}
|
|
8510
8628
|
}
|
|
8511
|
-
__decorateClass$q([
|
|
8512
|
-
attribute: "id",
|
|
8513
|
-
mode: "fromView"
|
|
8514
|
-
})], Listbox.prototype, "id", 2);
|
|
8629
|
+
__decorateClass$q([observable], Listbox.prototype, "defaultSlot", 2);
|
|
8515
8630
|
__decorateClass$q([observable], Listbox.prototype, "multiple", 2);
|
|
8516
8631
|
__decorateClass$q([observable], Listbox.prototype, "options", 2);
|
|
8517
8632
|
__decorateClass$q([observable], Listbox.prototype, "selectedIndex", 2);
|
|
@@ -8523,7 +8638,7 @@ const styles$l = css`
|
|
|
8523
8638
|
:host{background-color:${colorNeutralBackground1};border-radius:${borderRadiusMedium};border:${strokeWidthThin} solid ${colorTransparentStroke};box-shadow:${shadow16};box-sizing:border-box;flex-direction:column;margin:0;min-width:160px;padding:${spacingHorizontalXS};row-gap:${spacingHorizontalXXS};width:auto}:host([popover]){inset:unset;overflow:auto}@supports (anchor-name:--anchor){:host([popover]){position:absolute;margin-block-start:0;max-height:var(--listbox-max-height,calc(50vh - anchor-size(self-block)));min-width:anchor-size(width);position-anchor:--dropdown;position-area:block-end span-inline-end;position-try-fallbacks:flip-inline,flip-block,--flip-block,block-start}@position-try --flip-block{bottom:anchor(top);top:unset}}@supports not (anchor-name:--anchor){:host([popover]){margin-block-start:var(--margin-offset,0);max-height:var(--listbox-max-height,50vh);position:fixed}:host([popover]${flipBlockState}){margin-block-start:revert;translate:0 -100%}}`;
|
|
8524
8639
|
|
|
8525
8640
|
function listboxTemplate() {
|
|
8526
|
-
return html`<template
|
|
8641
|
+
return html`<template @beforetoggle="${(x, c) => x.beforetoggleHandler(c.event)}" @click="${(x, c) => x.clickHandler(c.event)}"><slot ${ref("defaultSlot")} @slotchange="${(x, c) => x.slotchangeHandler(c.event)}"></slot></template>`;
|
|
8527
8642
|
}
|
|
8528
8643
|
const template$m = listboxTemplate();
|
|
8529
8644
|
|
|
@@ -9065,8 +9180,6 @@ var __decorateClass$n = (decorators, target, key, kind) => {
|
|
|
9065
9180
|
class Menu extends FASTElement {
|
|
9066
9181
|
constructor() {
|
|
9067
9182
|
super(...arguments);
|
|
9068
|
-
this.slottedMenuList = [];
|
|
9069
|
-
this.slottedTriggers = [];
|
|
9070
9183
|
/**
|
|
9071
9184
|
* Defines whether the menu is open or not.
|
|
9072
9185
|
* @internal
|
|
@@ -9154,6 +9267,15 @@ class Menu extends FASTElement {
|
|
|
9154
9267
|
}
|
|
9155
9268
|
};
|
|
9156
9269
|
}
|
|
9270
|
+
/**
|
|
9271
|
+
* Sets up the component when the slotted menu list changes.
|
|
9272
|
+
* @param prev - The previous items in the slotted menu list.
|
|
9273
|
+
* @param next - The new items in the slotted menu list.
|
|
9274
|
+
* @internal
|
|
9275
|
+
*/
|
|
9276
|
+
slottedMenuListChanged(prev, next) {
|
|
9277
|
+
this.setComponent();
|
|
9278
|
+
}
|
|
9157
9279
|
/**
|
|
9158
9280
|
* Called when the element is connected to the DOM.
|
|
9159
9281
|
* Sets up the component.
|
|
@@ -9161,9 +9283,7 @@ class Menu extends FASTElement {
|
|
|
9161
9283
|
*/
|
|
9162
9284
|
connectedCallback() {
|
|
9163
9285
|
super.connectedCallback();
|
|
9164
|
-
|
|
9165
|
-
this.setComponent();
|
|
9166
|
-
});
|
|
9286
|
+
this.setComponent();
|
|
9167
9287
|
}
|
|
9168
9288
|
/**
|
|
9169
9289
|
* Called when the element is disconnected from the DOM.
|
|
@@ -9180,14 +9300,23 @@ class Menu extends FASTElement {
|
|
|
9180
9300
|
* @public
|
|
9181
9301
|
*/
|
|
9182
9302
|
setComponent() {
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9303
|
+
waitForConnectedDescendants(this, () => {
|
|
9304
|
+
const trigger = this.slottedTriggers?.[0];
|
|
9305
|
+
const menuList = this.slottedMenuList?.[0];
|
|
9306
|
+
if (!trigger || !menuList) {
|
|
9307
|
+
this.removeListeners();
|
|
9308
|
+
return;
|
|
9309
|
+
}
|
|
9310
|
+
this._trigger = trigger;
|
|
9311
|
+
this._menuList = menuList;
|
|
9186
9312
|
this._trigger.setAttribute("aria-haspopup", "true");
|
|
9187
9313
|
this._trigger.setAttribute("aria-expanded", `${this._open}`);
|
|
9188
9314
|
this._menuList.setAttribute("popover", this.openOnContext ? "manual" : "");
|
|
9315
|
+
this.removeListeners();
|
|
9189
9316
|
this.addListeners();
|
|
9190
|
-
}
|
|
9317
|
+
}, {
|
|
9318
|
+
shallow: true
|
|
9319
|
+
});
|
|
9191
9320
|
}
|
|
9192
9321
|
/**
|
|
9193
9322
|
* Focuses on the menu list.
|
|
@@ -9581,7 +9710,7 @@ class DropdownOption extends FASTElement {
|
|
|
9581
9710
|
set selected(next) {
|
|
9582
9711
|
this.currentSelected = next;
|
|
9583
9712
|
Updates.enqueue(() => {
|
|
9584
|
-
if (this
|
|
9713
|
+
if (this.elementInternals) {
|
|
9585
9714
|
this.setFormValue(next ? this.value : null);
|
|
9586
9715
|
this.elementInternals.ariaSelected = next ? "true" : "false";
|
|
9587
9716
|
toggleState(this.elementInternals, "selected", next);
|
|
@@ -9758,6 +9887,13 @@ class BaseProgressBar extends FASTElement {
|
|
|
9758
9887
|
this.validationState = null;
|
|
9759
9888
|
this.elementInternals.role = "progressbar";
|
|
9760
9889
|
}
|
|
9890
|
+
/**
|
|
9891
|
+
* Updates the indicator width after the element is connected to the DOM via the template.
|
|
9892
|
+
* @internal
|
|
9893
|
+
*/
|
|
9894
|
+
indicatorChanged() {
|
|
9895
|
+
this.setIndicatorWidth();
|
|
9896
|
+
}
|
|
9761
9897
|
/**
|
|
9762
9898
|
* Handles changes to validation-state attribute custom states
|
|
9763
9899
|
* @param prev - the previous state
|
|
@@ -9772,7 +9908,9 @@ class BaseProgressBar extends FASTElement {
|
|
|
9772
9908
|
* @internal
|
|
9773
9909
|
*/
|
|
9774
9910
|
valueChanged(prev, next) {
|
|
9775
|
-
this.elementInternals
|
|
9911
|
+
if (this.elementInternals) {
|
|
9912
|
+
this.elementInternals.ariaValueNow = typeof next === "number" ? `${next}` : null;
|
|
9913
|
+
}
|
|
9776
9914
|
this.setIndicatorWidth();
|
|
9777
9915
|
}
|
|
9778
9916
|
/**
|
|
@@ -9782,7 +9920,9 @@ class BaseProgressBar extends FASTElement {
|
|
|
9782
9920
|
* @param next - The current min value
|
|
9783
9921
|
*/
|
|
9784
9922
|
minChanged(prev, next) {
|
|
9785
|
-
this.elementInternals
|
|
9923
|
+
if (this.elementInternals) {
|
|
9924
|
+
this.elementInternals.ariaValueMin = typeof next === "number" ? `${next}` : null;
|
|
9925
|
+
}
|
|
9786
9926
|
this.setIndicatorWidth();
|
|
9787
9927
|
}
|
|
9788
9928
|
/**
|
|
@@ -9793,30 +9933,37 @@ class BaseProgressBar extends FASTElement {
|
|
|
9793
9933
|
* @internal
|
|
9794
9934
|
*/
|
|
9795
9935
|
maxChanged(prev, next) {
|
|
9796
|
-
this.elementInternals
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
connectedCallback() {
|
|
9800
|
-
super.connectedCallback();
|
|
9936
|
+
if (this.elementInternals) {
|
|
9937
|
+
this.elementInternals.ariaValueMax = typeof next === "number" ? `${next}` : null;
|
|
9938
|
+
}
|
|
9801
9939
|
this.setIndicatorWidth();
|
|
9802
9940
|
}
|
|
9941
|
+
/**
|
|
9942
|
+
* Sets the width of the indicator element based on the value, min, and max
|
|
9943
|
+
* properties. If the browser supports `width: attr(value)`, this method does
|
|
9944
|
+
* nothing and allows CSS to handle the width.
|
|
9945
|
+
*
|
|
9946
|
+
* @internal
|
|
9947
|
+
*/
|
|
9803
9948
|
setIndicatorWidth() {
|
|
9804
|
-
if (
|
|
9805
|
-
return;
|
|
9806
|
-
}
|
|
9807
|
-
if (typeof this.value !== "number") {
|
|
9808
|
-
this.indicator.style.removeProperty("width");
|
|
9949
|
+
if (CSS.supports("width: attr(value type(<number>))")) {
|
|
9809
9950
|
return;
|
|
9810
9951
|
}
|
|
9811
|
-
|
|
9812
|
-
|
|
9813
|
-
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
|
|
9819
|
-
|
|
9952
|
+
Updates.enqueue(() => {
|
|
9953
|
+
if (typeof this.value !== "number") {
|
|
9954
|
+
this.indicator?.style.removeProperty("width");
|
|
9955
|
+
return;
|
|
9956
|
+
}
|
|
9957
|
+
const min = this.min ?? 0;
|
|
9958
|
+
const max = this.max ?? 100;
|
|
9959
|
+
const value = this.value ?? 0;
|
|
9960
|
+
const range = max - min;
|
|
9961
|
+
const width = range === 0 ? 0 : Math.fround((value - min) / range * 100);
|
|
9962
|
+
this.indicator?.style.setProperty("width", `${width}%`);
|
|
9963
|
+
});
|
|
9964
|
+
}
|
|
9965
|
+
}
|
|
9966
|
+
__decorateClass$k([observable], BaseProgressBar.prototype, "indicator", 2);
|
|
9820
9967
|
__decorateClass$k([attr({
|
|
9821
9968
|
attribute: "validation-state"
|
|
9822
9969
|
})], BaseProgressBar.prototype, "validationState", 2);
|
|
@@ -9863,70 +10010,8 @@ const definition$f = ProgressBar.compose({
|
|
|
9863
10010
|
|
|
9864
10011
|
definition$f.define(FluentDesignSystem.registry);
|
|
9865
10012
|
|
|
9866
|
-
|
|
9867
|
-
|
|
9868
|
-
super();
|
|
9869
|
-
this.elementInternals.role = "radio";
|
|
9870
|
-
}
|
|
9871
|
-
/**
|
|
9872
|
-
* Toggles the disabled state when the user changes the `disabled` property.
|
|
9873
|
-
*
|
|
9874
|
-
* @param prev - the previous value of the `disabled` property
|
|
9875
|
-
* @param next - the current value of the `disabled` property
|
|
9876
|
-
* @internal
|
|
9877
|
-
* @override
|
|
9878
|
-
*/
|
|
9879
|
-
disabledChanged(prev, next) {
|
|
9880
|
-
super.disabledChanged(prev, next);
|
|
9881
|
-
this.$emit("disabled", next, {
|
|
9882
|
-
bubbles: true
|
|
9883
|
-
});
|
|
9884
|
-
}
|
|
9885
|
-
/**
|
|
9886
|
-
* This method is a no-op for the radio component.
|
|
9887
|
-
*
|
|
9888
|
-
* @internal
|
|
9889
|
-
* @override
|
|
9890
|
-
* @remarks
|
|
9891
|
-
* To make a group of radio controls required, see {@link RadioGroup.required}.
|
|
9892
|
-
*/
|
|
9893
|
-
requiredChanged() {
|
|
9894
|
-
return;
|
|
9895
|
-
}
|
|
9896
|
-
/**
|
|
9897
|
-
* This method is a no-op for the radio component.
|
|
9898
|
-
*
|
|
9899
|
-
* @internal
|
|
9900
|
-
* @override
|
|
9901
|
-
* @remarks
|
|
9902
|
-
* The radio form value is controlled by the `RadioGroup` component.
|
|
9903
|
-
*/
|
|
9904
|
-
setFormValue() {
|
|
9905
|
-
return;
|
|
9906
|
-
}
|
|
9907
|
-
/**
|
|
9908
|
-
* Sets the validity of the control.
|
|
9909
|
-
*
|
|
9910
|
-
* @internal
|
|
9911
|
-
* @override
|
|
9912
|
-
* @remarks
|
|
9913
|
-
* The radio component does not have a `required` attribute, so this method always sets the validity to `true`.
|
|
9914
|
-
*/
|
|
9915
|
-
setValidity() {
|
|
9916
|
-
this.elementInternals.setValidity({});
|
|
9917
|
-
}
|
|
9918
|
-
/**
|
|
9919
|
-
* Toggles the checked state of the control.
|
|
9920
|
-
*
|
|
9921
|
-
* @param force - Forces the element to be checked or unchecked
|
|
9922
|
-
* @public
|
|
9923
|
-
* @override
|
|
9924
|
-
* @remarks
|
|
9925
|
-
* The radio checked state is controlled by the `RadioGroup` component, so the `force` parameter defaults to `true`.
|
|
9926
|
-
*/
|
|
9927
|
-
toggleChecked(force = true) {
|
|
9928
|
-
super.toggleChecked(force);
|
|
9929
|
-
}
|
|
10013
|
+
function isRadio(element, tagName = "-radio") {
|
|
10014
|
+
return isCustomElement(tagName)(element);
|
|
9930
10015
|
}
|
|
9931
10016
|
|
|
9932
10017
|
function getRootActiveElement(element) {
|
|
@@ -9954,7 +10039,6 @@ class RadioGroup extends FASTElement {
|
|
|
9954
10039
|
* Indicates that the value has been changed by the user.
|
|
9955
10040
|
*/
|
|
9956
10041
|
this.dirtyState = false;
|
|
9957
|
-
this.disabled = false;
|
|
9958
10042
|
/**
|
|
9959
10043
|
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
9960
10044
|
*
|
|
@@ -9985,7 +10069,7 @@ class RadioGroup extends FASTElement {
|
|
|
9985
10069
|
* @internal
|
|
9986
10070
|
*/
|
|
9987
10071
|
disabledChanged(prev, next) {
|
|
9988
|
-
if (this
|
|
10072
|
+
if (this.radios) {
|
|
9989
10073
|
this.checkedIndex = -1;
|
|
9990
10074
|
this.radios?.forEach(radio => {
|
|
9991
10075
|
radio.disabled = !!radio.disabledAttribute || !!this.disabled;
|
|
@@ -10081,6 +10165,15 @@ class RadioGroup extends FASTElement {
|
|
|
10081
10165
|
this.elementInternals.ariaRequired = next ? "true" : null;
|
|
10082
10166
|
this.setValidity();
|
|
10083
10167
|
}
|
|
10168
|
+
/**
|
|
10169
|
+
* Updates the radios collection when the slotted radios change.
|
|
10170
|
+
*
|
|
10171
|
+
* @param prev - the previous slotted radios
|
|
10172
|
+
* @param next - the current slotted radios
|
|
10173
|
+
*/
|
|
10174
|
+
slottedRadiosChanged(prev, next) {
|
|
10175
|
+
this.radios = [...this.querySelectorAll("*")].filter(x => isRadio(x));
|
|
10176
|
+
}
|
|
10084
10177
|
/**
|
|
10085
10178
|
* A collection of child radios that are not disabled.
|
|
10086
10179
|
*
|
|
@@ -10388,17 +10481,6 @@ class RadioGroup extends FASTElement {
|
|
|
10388
10481
|
});
|
|
10389
10482
|
}
|
|
10390
10483
|
}
|
|
10391
|
-
/**
|
|
10392
|
-
* Updates the collection of child radios when the slot changes.
|
|
10393
|
-
*
|
|
10394
|
-
* @param e - the slot change event
|
|
10395
|
-
* @internal
|
|
10396
|
-
*/
|
|
10397
|
-
slotchangeHandler(e) {
|
|
10398
|
-
Updates.enqueue(() => {
|
|
10399
|
-
this.radios = [...this.querySelectorAll("*")].filter(x => x instanceof Radio);
|
|
10400
|
-
});
|
|
10401
|
-
}
|
|
10402
10484
|
}
|
|
10403
10485
|
/**
|
|
10404
10486
|
* The form-associated flag.
|
|
@@ -10422,6 +10504,7 @@ __decorateClass$i([observable], RadioGroup.prototype, "radios", 2);
|
|
|
10422
10504
|
__decorateClass$i([attr({
|
|
10423
10505
|
mode: "boolean"
|
|
10424
10506
|
})], RadioGroup.prototype, "required", 2);
|
|
10507
|
+
__decorateClass$i([observable], RadioGroup.prototype, "slottedRadios", 2);
|
|
10425
10508
|
|
|
10426
10509
|
const styles$e = css`
|
|
10427
10510
|
${display("flex")}
|
|
@@ -10429,7 +10512,7 @@ const styles$e = css`
|
|
|
10429
10512
|
:host{-webkit-tap-highlight-color:transparent;cursor:pointer;gap:${spacingVerticalL}}:host([orientation='vertical']){flex-direction:column;justify-content:flex-start}:host([orientation='horizontal']){flex-direction:row}::slotted(*){color:${colorNeutralForeground3}}::slotted(:hover){color:${colorNeutralForeground2}}::slotted(:active){color:${colorNeutralForeground1}}::slotted(${disabledState}){color:${colorNeutralForegroundDisabled}}::slotted(${checkedState}){color:${colorNeutralForeground1}}:host([slot='input']){margin:${spacingVerticalS} ${spacingHorizontalS}}`;
|
|
10430
10513
|
|
|
10431
10514
|
function radioGroupTemplate() {
|
|
10432
|
-
return html`<template @disabled="${(x, c) => x.disabledRadioHandler(c.event)}" @change="${(x, c) => x.changeHandler(c.event)}" @click="${(x, c) => x.clickHandler(c.event)}" @focusin="${(x, c) => x.focusinHandler(c.event)}" @focusout="${(x, c) => x.focusoutHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}"><slot
|
|
10515
|
+
return html`<template @disabled="${(x, c) => x.disabledRadioHandler(c.event)}" @change="${(x, c) => x.changeHandler(c.event)}" @click="${(x, c) => x.clickHandler(c.event)}" @focusin="${(x, c) => x.focusinHandler(c.event)}" @focusout="${(x, c) => x.focusoutHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}"><slot ${slotted("slottedRadios")}></slot></template>`;
|
|
10433
10516
|
}
|
|
10434
10517
|
const template$e = radioGroupTemplate();
|
|
10435
10518
|
|
|
@@ -10441,6 +10524,72 @@ const definition$e = RadioGroup.compose({
|
|
|
10441
10524
|
|
|
10442
10525
|
definition$e.define(FluentDesignSystem.registry);
|
|
10443
10526
|
|
|
10527
|
+
class Radio extends BaseCheckbox {
|
|
10528
|
+
constructor() {
|
|
10529
|
+
super();
|
|
10530
|
+
this.elementInternals.role = "radio";
|
|
10531
|
+
}
|
|
10532
|
+
/**
|
|
10533
|
+
* Toggles the disabled state when the user changes the `disabled` property.
|
|
10534
|
+
*
|
|
10535
|
+
* @param prev - the previous value of the `disabled` property
|
|
10536
|
+
* @param next - the current value of the `disabled` property
|
|
10537
|
+
* @internal
|
|
10538
|
+
* @override
|
|
10539
|
+
*/
|
|
10540
|
+
disabledChanged(prev, next) {
|
|
10541
|
+
super.disabledChanged(prev, next);
|
|
10542
|
+
this.$emit("disabled", next, {
|
|
10543
|
+
bubbles: true
|
|
10544
|
+
});
|
|
10545
|
+
}
|
|
10546
|
+
/**
|
|
10547
|
+
* This method is a no-op for the radio component.
|
|
10548
|
+
*
|
|
10549
|
+
* @internal
|
|
10550
|
+
* @override
|
|
10551
|
+
* @remarks
|
|
10552
|
+
* To make a group of radio controls required, see {@link RadioGroup.required}.
|
|
10553
|
+
*/
|
|
10554
|
+
requiredChanged() {
|
|
10555
|
+
return;
|
|
10556
|
+
}
|
|
10557
|
+
/**
|
|
10558
|
+
* This method is a no-op for the radio component.
|
|
10559
|
+
*
|
|
10560
|
+
* @internal
|
|
10561
|
+
* @override
|
|
10562
|
+
* @remarks
|
|
10563
|
+
* The radio form value is controlled by the `RadioGroup` component.
|
|
10564
|
+
*/
|
|
10565
|
+
setFormValue() {
|
|
10566
|
+
return;
|
|
10567
|
+
}
|
|
10568
|
+
/**
|
|
10569
|
+
* Sets the validity of the control.
|
|
10570
|
+
*
|
|
10571
|
+
* @internal
|
|
10572
|
+
* @override
|
|
10573
|
+
* @remarks
|
|
10574
|
+
* The radio component does not have a `required` attribute, so this method always sets the validity to `true`.
|
|
10575
|
+
*/
|
|
10576
|
+
setValidity() {
|
|
10577
|
+
this.elementInternals.setValidity({});
|
|
10578
|
+
}
|
|
10579
|
+
/**
|
|
10580
|
+
* Toggles the checked state of the control.
|
|
10581
|
+
*
|
|
10582
|
+
* @param force - Forces the element to be checked or unchecked
|
|
10583
|
+
* @public
|
|
10584
|
+
* @override
|
|
10585
|
+
* @remarks
|
|
10586
|
+
* The radio checked state is controlled by the `RadioGroup` component, so the `force` parameter defaults to `true`.
|
|
10587
|
+
*/
|
|
10588
|
+
toggleChecked(force = true) {
|
|
10589
|
+
super.toggleChecked(force);
|
|
10590
|
+
}
|
|
10591
|
+
}
|
|
10592
|
+
|
|
10444
10593
|
const styles$d = css`
|
|
10445
10594
|
${display("inline-flex")}
|
|
10446
10595
|
|
|
@@ -10500,6 +10649,14 @@ class BaseRatingDisplay extends FASTElement {
|
|
|
10500
10649
|
this.elementInternals.role = "img";
|
|
10501
10650
|
this.numberFormatter = new Intl.NumberFormat();
|
|
10502
10651
|
}
|
|
10652
|
+
/**
|
|
10653
|
+
* Updates the icon when the referenced slot is bound in the template.
|
|
10654
|
+
*
|
|
10655
|
+
* @internal
|
|
10656
|
+
*/
|
|
10657
|
+
iconSlotChanged() {
|
|
10658
|
+
this.handleSlotChange();
|
|
10659
|
+
}
|
|
10503
10660
|
maxChanged() {
|
|
10504
10661
|
this.setCustomPropertyValue("max");
|
|
10505
10662
|
}
|
|
@@ -10549,17 +10706,20 @@ class BaseRatingDisplay extends FASTElement {
|
|
|
10549
10706
|
this.display.style.setProperty(CUSTOM_PROPERTY_NAME.maskImageOutlined, `url(${svgToDataURI(customSvgOutlined)})`);
|
|
10550
10707
|
}
|
|
10551
10708
|
setCustomPropertyValue(propertyName) {
|
|
10552
|
-
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10709
|
+
requestAnimationFrame(() => {
|
|
10710
|
+
if (!this.display || SUPPORTS_ATTR_TYPE) {
|
|
10711
|
+
return;
|
|
10712
|
+
}
|
|
10713
|
+
const propertyValue = this[propertyName];
|
|
10714
|
+
if (typeof propertyValue !== "number" || Number.isNaN(propertyValue)) {
|
|
10715
|
+
this.display.style.removeProperty(CUSTOM_PROPERTY_NAME[propertyName]);
|
|
10716
|
+
} else {
|
|
10717
|
+
this.display.style.setProperty(CUSTOM_PROPERTY_NAME[propertyName], `${propertyValue}`);
|
|
10718
|
+
}
|
|
10719
|
+
});
|
|
10561
10720
|
}
|
|
10562
10721
|
}
|
|
10722
|
+
__decorateClass$h([observable], BaseRatingDisplay.prototype, "iconSlot", 2);
|
|
10563
10723
|
__decorateClass$h([attr({
|
|
10564
10724
|
converter: nullableNumberConverter
|
|
10565
10725
|
})], BaseRatingDisplay.prototype, "count", 2);
|
|
@@ -10625,11 +10785,6 @@ const definition$c = RatingDisplay.compose({
|
|
|
10625
10785
|
|
|
10626
10786
|
definition$c.define(FluentDesignSystem.registry);
|
|
10627
10787
|
|
|
10628
|
-
const SliderOrientation = Orientation;
|
|
10629
|
-
const SliderMode = {
|
|
10630
|
-
singleValue: "single-value"
|
|
10631
|
-
};
|
|
10632
|
-
|
|
10633
10788
|
function convertPixelToPercent(pixelPos, minPosition, maxPosition, direction) {
|
|
10634
10789
|
let pct = limit(0, 1, (pixelPos - minPosition) / (maxPosition - minPosition));
|
|
10635
10790
|
if (direction === Direction.rtl) {
|
|
@@ -10638,6 +10793,11 @@ function convertPixelToPercent(pixelPos, minPosition, maxPosition, direction) {
|
|
|
10638
10793
|
return pct;
|
|
10639
10794
|
}
|
|
10640
10795
|
|
|
10796
|
+
const SliderOrientation = Orientation;
|
|
10797
|
+
const SliderMode = {
|
|
10798
|
+
singleValue: "single-value"
|
|
10799
|
+
};
|
|
10800
|
+
|
|
10641
10801
|
var __defProp$f = Object.defineProperty;
|
|
10642
10802
|
var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
|
|
10643
10803
|
var __decorateClass$f = (decorators, target, key, kind) => {
|
|
@@ -10684,6 +10844,9 @@ class Slider extends FASTElement {
|
|
|
10684
10844
|
* If the event handler is null it removes the events
|
|
10685
10845
|
*/
|
|
10686
10846
|
this.handleThumbPointerDown = event => {
|
|
10847
|
+
if (this.isDisabled) {
|
|
10848
|
+
return true;
|
|
10849
|
+
}
|
|
10687
10850
|
const windowFn = event !== null ? window.addEventListener : window.removeEventListener;
|
|
10688
10851
|
windowFn("pointerup", this.handleWindowPointerUp);
|
|
10689
10852
|
windowFn("pointermove", this.handlePointerMove, {
|
|
@@ -10700,7 +10863,7 @@ class Slider extends FASTElement {
|
|
|
10700
10863
|
* Handle mouse moves during a thumb drag operation
|
|
10701
10864
|
*/
|
|
10702
10865
|
this.handlePointerMove = event => {
|
|
10703
|
-
if (this.
|
|
10866
|
+
if (this.isDisabled || event.defaultPrevented) {
|
|
10704
10867
|
return;
|
|
10705
10868
|
}
|
|
10706
10869
|
const sourceEvent = window.TouchEvent && event instanceof TouchEvent ? event.touches[0] : event;
|
|
@@ -10724,7 +10887,7 @@ class Slider extends FASTElement {
|
|
|
10724
10887
|
* @param event - PointerEvent or null. If there is no event handler it will remove the events
|
|
10725
10888
|
*/
|
|
10726
10889
|
this.handlePointerDown = event => {
|
|
10727
|
-
if (event === null || !this.
|
|
10890
|
+
if (event === null || !this.isDisabled) {
|
|
10728
10891
|
const windowFn = event !== null ? window.addEventListener : window.removeEventListener;
|
|
10729
10892
|
const documentFn = event !== null ? document.addEventListener : document.removeEventListener;
|
|
10730
10893
|
windowFn("pointerup", this.handleWindowPointerUp);
|
|
@@ -10859,7 +11022,7 @@ class Slider extends FASTElement {
|
|
|
10859
11022
|
*/
|
|
10860
11023
|
setValidity(flags, message, anchor) {
|
|
10861
11024
|
if (this.$fastController.isConnected) {
|
|
10862
|
-
if (this.
|
|
11025
|
+
if (this.isDisabled) {
|
|
10863
11026
|
this.elementInternals.setValidity({});
|
|
10864
11027
|
return;
|
|
10865
11028
|
}
|
|
@@ -10950,6 +11113,15 @@ class Slider extends FASTElement {
|
|
|
10950
11113
|
disabledChanged() {
|
|
10951
11114
|
this.setDisabledSideEffect(this.disabled);
|
|
10952
11115
|
}
|
|
11116
|
+
/**
|
|
11117
|
+
* Returns true if the component is disabled, taking into account the `disabled`
|
|
11118
|
+
* attribute, `aria-disabled` attribute, and the `:disabled` pseudo-class.
|
|
11119
|
+
*
|
|
11120
|
+
* @internal
|
|
11121
|
+
*/
|
|
11122
|
+
get isDisabled() {
|
|
11123
|
+
return this.disabled || this.elementInternals?.ariaDisabled === "true" || this.isConnected && this.matches(":disabled");
|
|
11124
|
+
}
|
|
10953
11125
|
minChanged() {
|
|
10954
11126
|
this.elementInternals.ariaValueMin = `${this.minAsNumber}`;
|
|
10955
11127
|
if (this.$fastController.isConnected && this.minAsNumber > this.valueAsNumber) {
|
|
@@ -11016,30 +11188,34 @@ class Slider extends FASTElement {
|
|
|
11016
11188
|
this.setSliderPosition();
|
|
11017
11189
|
}
|
|
11018
11190
|
}
|
|
11019
|
-
/**
|
|
11020
|
-
* @internal
|
|
11021
|
-
*/
|
|
11022
11191
|
connectedCallback() {
|
|
11023
11192
|
super.connectedCallback();
|
|
11024
|
-
|
|
11025
|
-
|
|
11026
|
-
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
|
|
11193
|
+
requestAnimationFrame(() => {
|
|
11194
|
+
if (!this.$fastController.isConnected) {
|
|
11195
|
+
return;
|
|
11196
|
+
}
|
|
11197
|
+
this.direction = getDirection(this);
|
|
11198
|
+
this.setDisabledSideEffect(this.disabled);
|
|
11199
|
+
this.updateStepMultiplier();
|
|
11200
|
+
this.setupTrackConstraints();
|
|
11201
|
+
this.setupDefaultValue();
|
|
11202
|
+
this.setSliderPosition();
|
|
11203
|
+
this.handleStepStyles();
|
|
11204
|
+
const notifier = Observable.getNotifier(this);
|
|
11205
|
+
notifier.subscribe(this, "max");
|
|
11206
|
+
notifier.subscribe(this, "min");
|
|
11207
|
+
notifier.subscribe(this, "step");
|
|
11208
|
+
});
|
|
11034
11209
|
}
|
|
11035
11210
|
/**
|
|
11036
11211
|
* @internal
|
|
11037
11212
|
*/
|
|
11038
11213
|
disconnectedCallback() {
|
|
11039
11214
|
super.disconnectedCallback();
|
|
11040
|
-
Observable.getNotifier(this)
|
|
11041
|
-
|
|
11042
|
-
|
|
11215
|
+
const notifier = Observable.getNotifier(this);
|
|
11216
|
+
notifier.unsubscribe(this, "max");
|
|
11217
|
+
notifier.unsubscribe(this, "min");
|
|
11218
|
+
notifier.unsubscribe(this, "step");
|
|
11043
11219
|
}
|
|
11044
11220
|
/**
|
|
11045
11221
|
* Increment the value by the step
|
|
@@ -11064,7 +11240,7 @@ class Slider extends FASTElement {
|
|
|
11064
11240
|
this.value = decrementedValString;
|
|
11065
11241
|
}
|
|
11066
11242
|
handleKeydown(event) {
|
|
11067
|
-
if (this.
|
|
11243
|
+
if (this.isDisabled) {
|
|
11068
11244
|
return true;
|
|
11069
11245
|
}
|
|
11070
11246
|
switch (event.key) {
|
|
@@ -11149,12 +11325,11 @@ class Slider extends FASTElement {
|
|
|
11149
11325
|
/**
|
|
11150
11326
|
* Makes sure the side effects of set up when the disabled state changes.
|
|
11151
11327
|
*/
|
|
11152
|
-
setDisabledSideEffect(disabled) {
|
|
11153
|
-
|
|
11154
|
-
|
|
11155
|
-
|
|
11156
|
-
|
|
11157
|
-
this.tabIndex = disabled ? -1 : 0;
|
|
11328
|
+
setDisabledSideEffect(disabled = this.isDisabled) {
|
|
11329
|
+
Updates.enqueue(() => {
|
|
11330
|
+
this.elementInternals.ariaDisabled = disabled.toString();
|
|
11331
|
+
this.tabIndex = disabled ? -1 : 0;
|
|
11332
|
+
});
|
|
11158
11333
|
}
|
|
11159
11334
|
}
|
|
11160
11335
|
/**
|
|
@@ -11296,9 +11471,23 @@ var __decorateClass$d = (decorators, target, key, kind) => {
|
|
|
11296
11471
|
return result;
|
|
11297
11472
|
};
|
|
11298
11473
|
class Tab extends FASTElement {
|
|
11474
|
+
constructor() {
|
|
11475
|
+
super();
|
|
11476
|
+
/**
|
|
11477
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
11478
|
+
*
|
|
11479
|
+
* @internal
|
|
11480
|
+
*/
|
|
11481
|
+
this.elementInternals = this.attachInternals();
|
|
11482
|
+
this.elementInternals.role = "tab";
|
|
11483
|
+
}
|
|
11299
11484
|
connectedCallback() {
|
|
11300
11485
|
super.connectedCallback();
|
|
11301
|
-
|
|
11486
|
+
this.slot || (this.slot = "tab");
|
|
11487
|
+
if (this.disabled) {
|
|
11488
|
+
this.setAttribute("aria-disabled", "true");
|
|
11489
|
+
}
|
|
11490
|
+
if (this.styles) {
|
|
11302
11491
|
this.$fastController.removeStyles(this.styles);
|
|
11303
11492
|
}
|
|
11304
11493
|
this.styles = css`
|
|
@@ -11330,8 +11519,15 @@ const definition$8 = Tab.compose({
|
|
|
11330
11519
|
|
|
11331
11520
|
definition$8.define(FluentDesignSystem.registry);
|
|
11332
11521
|
|
|
11522
|
+
function isTab(element, tagName = "-tab") {
|
|
11523
|
+
if (element?.nodeType !== Node.ELEMENT_NODE) {
|
|
11524
|
+
return false;
|
|
11525
|
+
}
|
|
11526
|
+
return element.tagName.toLowerCase().endsWith(tagName);
|
|
11527
|
+
}
|
|
11528
|
+
|
|
11333
11529
|
const isARIADisabledElement = el => {
|
|
11334
|
-
return el.getAttribute("aria-disabled") === "true";
|
|
11530
|
+
return el.getAttribute("aria-disabled") === "true" || el.elementInternals?.ariaDisabled === "true";
|
|
11335
11531
|
};
|
|
11336
11532
|
const isHiddenElement = el => {
|
|
11337
11533
|
return el.hasAttribute("hidden");
|
|
@@ -11340,13 +11536,6 @@ const isFocusableElement = el => {
|
|
|
11340
11536
|
return !isARIADisabledElement(el) && !isHiddenElement(el);
|
|
11341
11537
|
};
|
|
11342
11538
|
|
|
11343
|
-
function isTab(element, tagName = "-tab") {
|
|
11344
|
-
if (element?.nodeType !== Node.ELEMENT_NODE) {
|
|
11345
|
-
return false;
|
|
11346
|
-
}
|
|
11347
|
-
return element.tagName.toLowerCase().endsWith(tagName);
|
|
11348
|
-
}
|
|
11349
|
-
|
|
11350
11539
|
const TablistAppearance = {
|
|
11351
11540
|
subtle: "subtle",
|
|
11352
11541
|
transparent: "transparent"
|
|
@@ -11363,7 +11552,7 @@ var __decorateClass$c = (decorators, target, key, kind) => {
|
|
|
11363
11552
|
};
|
|
11364
11553
|
class BaseTablist extends FASTElement {
|
|
11365
11554
|
constructor() {
|
|
11366
|
-
super(
|
|
11555
|
+
super();
|
|
11367
11556
|
/**
|
|
11368
11557
|
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
11369
11558
|
*
|
|
@@ -11380,6 +11569,9 @@ class BaseTablist extends FASTElement {
|
|
|
11380
11569
|
};
|
|
11381
11570
|
this.handleTabClick = event => {
|
|
11382
11571
|
const selectedTab = event.currentTarget;
|
|
11572
|
+
if (selectedTab.disabled || this.disabled) {
|
|
11573
|
+
return;
|
|
11574
|
+
}
|
|
11383
11575
|
if (selectedTab.nodeType === Node.ELEMENT_NODE && isFocusableElement(selectedTab)) {
|
|
11384
11576
|
this.prevActiveTabIndex = this.activeTabIndex;
|
|
11385
11577
|
this.activeTabIndex = this.tabs.indexOf(selectedTab);
|
|
@@ -11387,6 +11579,9 @@ class BaseTablist extends FASTElement {
|
|
|
11387
11579
|
}
|
|
11388
11580
|
};
|
|
11389
11581
|
this.handleTabKeyDown = event => {
|
|
11582
|
+
if (this.disabled) {
|
|
11583
|
+
return;
|
|
11584
|
+
}
|
|
11390
11585
|
const dir = getDirection(this);
|
|
11391
11586
|
switch (event.key) {
|
|
11392
11587
|
case keyArrowLeft:
|
|
@@ -11427,6 +11622,8 @@ class BaseTablist extends FASTElement {
|
|
|
11427
11622
|
break;
|
|
11428
11623
|
}
|
|
11429
11624
|
};
|
|
11625
|
+
this.elementInternals.role = "tablist";
|
|
11626
|
+
this.elementInternals.ariaOrientation = this.orientation ?? TablistOrientation.horizontal;
|
|
11430
11627
|
}
|
|
11431
11628
|
/**
|
|
11432
11629
|
* Handles disabled changes
|
|
@@ -11437,25 +11634,23 @@ class BaseTablist extends FASTElement {
|
|
|
11437
11634
|
*/
|
|
11438
11635
|
disabledChanged(prev, next) {
|
|
11439
11636
|
toggleState(this.elementInternals, "disabled", next);
|
|
11440
|
-
|
|
11441
|
-
this.setTabs();
|
|
11442
|
-
}
|
|
11637
|
+
this.setTabs();
|
|
11443
11638
|
}
|
|
11444
11639
|
/**
|
|
11445
11640
|
* @internal
|
|
11446
11641
|
*/
|
|
11447
11642
|
orientationChanged(prev, next) {
|
|
11448
|
-
this.elementInternals
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
this.setTabs();
|
|
11643
|
+
if (this.elementInternals) {
|
|
11644
|
+
this.elementInternals.ariaOrientation = next ?? TablistOrientation.horizontal;
|
|
11645
|
+
swapStates(this.elementInternals, prev, next, TablistOrientation);
|
|
11452
11646
|
}
|
|
11647
|
+
this.setTabs();
|
|
11453
11648
|
}
|
|
11454
11649
|
/**
|
|
11455
11650
|
* @internal
|
|
11456
11651
|
*/
|
|
11457
11652
|
activeidChanged(oldValue, newValue) {
|
|
11458
|
-
if (this
|
|
11653
|
+
if (this.tabs?.length > 0) {
|
|
11459
11654
|
this.prevActiveTabIndex = this.tabs.findIndex(item => item.id === oldValue);
|
|
11460
11655
|
this.setTabs();
|
|
11461
11656
|
if (oldValue) {
|
|
@@ -11486,8 +11681,14 @@ class BaseTablist extends FASTElement {
|
|
|
11486
11681
|
/**
|
|
11487
11682
|
* @internal
|
|
11488
11683
|
*/
|
|
11489
|
-
tabsChanged() {
|
|
11490
|
-
if (
|
|
11684
|
+
tabsChanged(prev, next) {
|
|
11685
|
+
if (prev?.length) {
|
|
11686
|
+
prev.forEach(tab => {
|
|
11687
|
+
tab.removeEventListener("click", this.handleTabClick);
|
|
11688
|
+
tab.removeEventListener("keydown", this.handleTabKeyDown);
|
|
11689
|
+
});
|
|
11690
|
+
}
|
|
11691
|
+
if (this.tabs.length > 0) {
|
|
11491
11692
|
this.tabIds = this.getTabIds();
|
|
11492
11693
|
this.setTabs();
|
|
11493
11694
|
for (const tab of this.tabs) {
|
|
@@ -11517,12 +11718,11 @@ class BaseTablist extends FASTElement {
|
|
|
11517
11718
|
*/
|
|
11518
11719
|
setTabs() {
|
|
11519
11720
|
this.activeTabIndex = this.getActiveIndex();
|
|
11520
|
-
const hasStartSlot = this.tabs
|
|
11521
|
-
this.tabs
|
|
11721
|
+
const hasStartSlot = this.tabs?.some(tab => !!tab.querySelector("[slot='start']"));
|
|
11722
|
+
this.tabs?.forEach((tab, index) => {
|
|
11522
11723
|
if (tab.slot === "tab") {
|
|
11523
11724
|
const isActiveTab = this.activeTabIndex === index && isFocusableElement(tab);
|
|
11524
11725
|
const tabId = this.tabIds[index];
|
|
11525
|
-
console.log("disabled", this.disabled);
|
|
11526
11726
|
if (!tab.disabled) {
|
|
11527
11727
|
this.disabled ? tab.setAttribute("aria-disabled", "true") : tab.removeAttribute("aria-disabled");
|
|
11528
11728
|
}
|
|
@@ -11586,8 +11786,10 @@ class BaseTablist extends FASTElement {
|
|
|
11586
11786
|
*/
|
|
11587
11787
|
connectedCallback() {
|
|
11588
11788
|
super.connectedCallback();
|
|
11589
|
-
this
|
|
11590
|
-
|
|
11789
|
+
waitForConnectedDescendants(this, () => {
|
|
11790
|
+
this.tabIds = this.getTabIds();
|
|
11791
|
+
this.setTabs();
|
|
11792
|
+
});
|
|
11591
11793
|
}
|
|
11592
11794
|
}
|
|
11593
11795
|
__decorateClass$c([attr({
|
|
@@ -11737,8 +11939,8 @@ class Tablist extends BaseTablist {
|
|
|
11737
11939
|
/**
|
|
11738
11940
|
* Initiates the active tab indicator animation loop when tabs change.
|
|
11739
11941
|
*/
|
|
11740
|
-
tabsChanged() {
|
|
11741
|
-
super.tabsChanged();
|
|
11942
|
+
tabsChanged(prev, next) {
|
|
11943
|
+
super.tabsChanged(prev, next);
|
|
11742
11944
|
this.setTabData();
|
|
11743
11945
|
if (this.activetab) {
|
|
11744
11946
|
this.animationLoop(this.activetab);
|
|
@@ -11804,6 +12006,24 @@ class BaseTextArea extends FASTElement {
|
|
|
11804
12006
|
this.resize = TextAreaResize.none;
|
|
11805
12007
|
this.spellcheck = false;
|
|
11806
12008
|
}
|
|
12009
|
+
/**
|
|
12010
|
+
* Sets up a mutation observer to watch for changes to the control element's
|
|
12011
|
+
* attributes that could affect validity, and binds an input event listener to detect user interaction.
|
|
12012
|
+
*
|
|
12013
|
+
* @internal
|
|
12014
|
+
*/
|
|
12015
|
+
controlElChanged() {
|
|
12016
|
+
this.controlElAttrObserver = new MutationObserver(() => {
|
|
12017
|
+
this.setValidity();
|
|
12018
|
+
});
|
|
12019
|
+
this.controlElAttrObserver.observe(this.controlEl, {
|
|
12020
|
+
attributes: true,
|
|
12021
|
+
attributeFilter: ["disabled", "required", "readonly", "maxlength", "minlength"]
|
|
12022
|
+
});
|
|
12023
|
+
this.controlEl.addEventListener("input", () => this.userInteracted = true, {
|
|
12024
|
+
once: true
|
|
12025
|
+
});
|
|
12026
|
+
}
|
|
11807
12027
|
defaultSlottedNodesChanged() {
|
|
11808
12028
|
const next = this.getContent();
|
|
11809
12029
|
this.defaultValue = next;
|
|
@@ -11845,6 +12065,9 @@ class BaseTextArea extends FASTElement {
|
|
|
11845
12065
|
}
|
|
11846
12066
|
readOnlyChanged() {
|
|
11847
12067
|
this.elementInternals.ariaReadOnly = `${!!this.readOnly}`;
|
|
12068
|
+
if (this.$fastController.isConnected) {
|
|
12069
|
+
this.setValidity();
|
|
12070
|
+
}
|
|
11848
12071
|
}
|
|
11849
12072
|
requiredChanged() {
|
|
11850
12073
|
this.elementInternals.ariaRequired = `${!!this.required}`;
|
|
@@ -11945,10 +12168,19 @@ class BaseTextArea extends FASTElement {
|
|
|
11945
12168
|
*/
|
|
11946
12169
|
connectedCallback() {
|
|
11947
12170
|
super.connectedCallback();
|
|
11948
|
-
|
|
11949
|
-
|
|
11950
|
-
|
|
11951
|
-
|
|
12171
|
+
requestAnimationFrame(() => {
|
|
12172
|
+
if (!this.$fastController.isConnected) {
|
|
12173
|
+
return;
|
|
12174
|
+
}
|
|
12175
|
+
const preConnect = this.preConnectControlEl;
|
|
12176
|
+
const content = this.getContent();
|
|
12177
|
+
this.defaultValue = content || preConnect?.defaultValue || "";
|
|
12178
|
+
this.value = preConnect?.value || this.defaultValue;
|
|
12179
|
+
this.setFormValue(this.value);
|
|
12180
|
+
this.setValidity();
|
|
12181
|
+
this.preConnectControlEl = null;
|
|
12182
|
+
this.maybeCreateAutoSizerEl();
|
|
12183
|
+
});
|
|
11952
12184
|
}
|
|
11953
12185
|
/**
|
|
11954
12186
|
* @internal
|
|
@@ -12043,18 +12275,6 @@ class BaseTextArea extends FASTElement {
|
|
|
12043
12275
|
select() {
|
|
12044
12276
|
this.controlEl.select();
|
|
12045
12277
|
}
|
|
12046
|
-
setDefaultValue() {
|
|
12047
|
-
this.defaultValue = this.innerHTML.trim() || this.preConnectControlEl.defaultValue || "";
|
|
12048
|
-
this.value = this.preConnectControlEl.value || this.defaultValue;
|
|
12049
|
-
this.setFormValue(this.value);
|
|
12050
|
-
this.setValidity();
|
|
12051
|
-
this.preConnectControlEl = null;
|
|
12052
|
-
}
|
|
12053
|
-
bindEvents() {
|
|
12054
|
-
this.controlEl.addEventListener("input", () => this.userInteracted = true, {
|
|
12055
|
-
once: true
|
|
12056
|
-
});
|
|
12057
|
-
}
|
|
12058
12278
|
/**
|
|
12059
12279
|
* Gets the content inside the light DOM, if any HTML element is present, use its `outerHTML` value.
|
|
12060
12280
|
*/
|
|
@@ -12070,15 +12290,6 @@ class BaseTextArea extends FASTElement {
|
|
|
12070
12290
|
}
|
|
12071
12291
|
}).join("") || "";
|
|
12072
12292
|
}
|
|
12073
|
-
observeControlElAttrs() {
|
|
12074
|
-
this.controlElAttrObserver = new MutationObserver(() => {
|
|
12075
|
-
this.setValidity();
|
|
12076
|
-
});
|
|
12077
|
-
this.controlElAttrObserver.observe(this.controlEl, {
|
|
12078
|
-
attributes: true,
|
|
12079
|
-
attributeFilter: ["disabled", "required", "readonly", "maxlength", "minlength"]
|
|
12080
|
-
});
|
|
12081
|
-
}
|
|
12082
12293
|
setDisabledSideEffect(disabled) {
|
|
12083
12294
|
this.elementInternals.ariaDisabled = `${disabled}`;
|
|
12084
12295
|
if (this.controlEl) {
|
|
@@ -12152,6 +12363,7 @@ class BaseTextArea extends FASTElement {
|
|
|
12152
12363
|
* @public
|
|
12153
12364
|
*/
|
|
12154
12365
|
BaseTextArea.formAssociated = true;
|
|
12366
|
+
__decorateClass$a([observable], BaseTextArea.prototype, "controlEl", 2);
|
|
12155
12367
|
__decorateClass$a([observable], BaseTextArea.prototype, "defaultSlottedNodes", 2);
|
|
12156
12368
|
__decorateClass$a([observable], BaseTextArea.prototype, "labelSlottedNodes", 2);
|
|
12157
12369
|
__decorateClass$a([attr], BaseTextArea.prototype, "autocomplete", 2);
|
|
@@ -12324,9 +12536,11 @@ class BaseTextInput extends FASTElement {
|
|
|
12324
12536
|
* @internal
|
|
12325
12537
|
*/
|
|
12326
12538
|
defaultSlottedNodesChanged(prev, next) {
|
|
12327
|
-
|
|
12328
|
-
this.controlLabel
|
|
12329
|
-
|
|
12539
|
+
Updates.enqueue(() => {
|
|
12540
|
+
if (this.controlLabel) {
|
|
12541
|
+
this.controlLabel.hidden = !next?.some(node => node.nodeType === Node.ELEMENT_NODE || node.nodeType === Node.TEXT_NODE && !!node.textContent?.trim());
|
|
12542
|
+
}
|
|
12543
|
+
});
|
|
12330
12544
|
}
|
|
12331
12545
|
/**
|
|
12332
12546
|
* Sets the value of the element to the initial value.
|
|
@@ -12370,7 +12584,11 @@ class BaseTextInput extends FASTElement {
|
|
|
12370
12584
|
* @internal
|
|
12371
12585
|
*/
|
|
12372
12586
|
controlChanged(prev, next) {
|
|
12373
|
-
|
|
12587
|
+
Updates.enqueue(() => {
|
|
12588
|
+
if (this.$fastController.isConnected) {
|
|
12589
|
+
this.setValidity();
|
|
12590
|
+
}
|
|
12591
|
+
});
|
|
12374
12592
|
}
|
|
12375
12593
|
/**
|
|
12376
12594
|
* The element's validity state.
|
|
@@ -12479,6 +12697,7 @@ class BaseTextInput extends FASTElement {
|
|
|
12479
12697
|
}
|
|
12480
12698
|
connectedCallback() {
|
|
12481
12699
|
super.connectedCallback();
|
|
12700
|
+
this.tabIndex = Number(this.getAttribute("tabindex") ?? 0) < 0 ? -1 : 0;
|
|
12482
12701
|
this.setFormValue(this.value);
|
|
12483
12702
|
this.setValidity();
|
|
12484
12703
|
}
|
|
@@ -12692,10 +12911,7 @@ const styles$5 = css`
|
|
|
12692
12911
|
:host{font-family:${fontFamilyBase};font-size:${fontSizeBase300};font-weight:${fontWeightRegular};line-height:${lineHeightBase300};max-width:400px}.label{display:flex;color:${colorNeutralForeground1};padding-bottom:${spacingVerticalXS};flex-shrink:0;padding-inline-end:${spacingHorizontalXS}}.label[hidden],:host(:empty) .label{display:none}.root{align-items:center;background-color:${colorNeutralBackground1};border:${strokeWidthThin} solid ${colorNeutralStroke1};border-bottom-color:${colorNeutralStrokeAccessible};border-radius:${borderRadiusMedium};box-sizing:border-box;height:32px;display:inline-flex;flex-direction:row;gap:${spacingHorizontalXXS};padding:0 ${spacingHorizontalMNudge};position:relative;width:100%}:has(.control:user-invalid){border-color:${colorPaletteRedBorder2}}.root::after{box-sizing:border-box;content:'';position:absolute;left:-1px;bottom:0px;right:-1px;height:max(2px,${borderRadiusMedium});border-radius:0 0 ${borderRadiusMedium} ${borderRadiusMedium};border-bottom:2px solid ${colorCompoundBrandStroke};clip-path:inset(calc(100% - 2px) 1px 0px);transform:scaleX(0);transition-property:transform;transition-duration:${durationUltraFast};transition-delay:${curveAccelerateMid}}.control{width:100%;height:100%;box-sizing:border-box;color:${colorNeutralForeground1};border-radius:${borderRadiusMedium};background:${colorTransparentBackground};font-family:${fontFamilyBase};font-weight:${fontWeightRegular};font-size:${fontSizeBase300};border:none;vertical-align:center}.control:focus-visible{outline:0;border:0}.control::placeholder{color:${colorNeutralForeground4}}:host ::slotted([slot='start']),:host ::slotted([slot='end']){display:flex;align-items:center;justify-content:center;color:${colorNeutralForeground3};font-size:${fontSizeBase500}}:host ::slotted([slot='start']){padding-right:${spacingHorizontalXXS}}:host ::slotted([slot='end']){padding-left:${spacingHorizontalXXS};gap:${spacingHorizontalXS}}:host(:hover) .root{border-color:${colorNeutralStroke1Hover};border-bottom-color:${colorNeutralStrokeAccessibleHover}}:host(:active) .root{border-color:${colorNeutralStroke1Pressed}}:host(:focus-within) .root{outline:transparent solid 2px;border-bottom:0}:host(:focus-within) .root::after{transform:scaleX(1);transition-property:transform;transition-duration:${durationNormal};transition-delay:${curveDecelerateMid}}:host(:focus-within:active) .root:after{border-bottom-color:${colorCompoundBrandStrokePressed}}:host([appearance='outline']:focus-within) .root{border:${strokeWidthThin} solid ${colorNeutralStroke1}}:host(:focus-within) .control{color:${colorNeutralForeground1}}:host([disabled]) .root{background:${colorTransparentBackground};border:${strokeWidthThin} solid ${colorNeutralStrokeDisabled}}:host([disabled]) .control::placeholder,:host([disabled]) ::slotted([slot='start']),:host([disabled]) ::slotted([slot='end']){color:${colorNeutralForegroundDisabled}}::selection{color:${colorNeutralForegroundInverted};background-color:${colorNeutralBackgroundInverted}}:host([control-size='small']) .control{font-size:${fontSizeBase200};font-weight:${fontWeightRegular};line-height:${lineHeightBase200}}:host([control-size='small']) .root{height:24px;gap:${spacingHorizontalXXS};padding:0 ${spacingHorizontalSNudge}}:host([control-size='small']) ::slotted([slot='start']),:host([control-size='small']) ::slotted([slot='end']){font-size:${fontSizeBase400}}:host([control-size='large']) .control{font-size:${fontSizeBase400};font-weight:${fontWeightRegular};line-height:${lineHeightBase400}}:host([control-size='large']) .root{height:40px;gap:${spacingHorizontalS};padding:0 ${spacingHorizontalM}}:host([control-size='large']) ::slotted([slot='start']),:host([control-size='large']) ::slotted([slot='end']){font-size:${fontSizeBase600}}:host([appearance='underline']) .root{background:${colorTransparentBackground};border:0;border-radius:0;border-bottom:${strokeWidthThin} solid ${colorNeutralStrokeAccessible}}:host([appearance='underline']:hover) .root{border-bottom-color:${colorNeutralStrokeAccessibleHover}}:host([appearance='underline']:active) .root{border-bottom-color:${colorNeutralStrokeAccessiblePressed}}:host([appearance='underline']:focus-within) .root{border:0;border-bottom-color:${colorNeutralStrokeAccessiblePressed}}:host([appearance='underline'][disabled]) .root{border-bottom-color:${colorNeutralStrokeDisabled}}:host([appearance='filled-lighter']) .root,:host([appearance='filled-darker']) .root{border:${strokeWidthThin} solid ${colorTransparentStroke};box-shadow:${shadow2}}:host([appearance='filled-lighter']) .root{background:${colorNeutralBackground1}}:host([appearance='filled-darker']) .root{background:${colorNeutralBackground3}}:host([appearance='filled-lighter']:hover) .root,:host([appearance='filled-darker']:hover) .root{border-color:${colorTransparentStrokeInteractive}}:host([appearance='filled-lighter']:active) .root,:host([appearance='filled-darker']:active) .root{border-color:${colorTransparentStrokeInteractive};background:${colorNeutralBackground3}}`;
|
|
12693
12912
|
|
|
12694
12913
|
function textInputTemplate(options = {}) {
|
|
12695
|
-
return html`<template @beforeinput="${(x, c) => x.beforeinputHandler(c.event)}" @focusin="${(x, c) => x.focusinHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}"><label part="label" for="control" class="label" ${ref("controlLabel")}><slot ${slotted({
|
|
12696
|
-
property: "defaultSlottedNodes",
|
|
12697
|
-
filter: whitespaceFilter
|
|
12698
|
-
})}></slot></label><div class="root" part="root">${startSlotTemplate(options)}<input class="control" part="control" id="control" @change="${(x, c) => x.changeHandler(c.event)}" @input="${(x, c) => x.inputHandler(c.event)}" ?autofocus="${x => x.autofocus}" autocomplete="${x => x.autocomplete}" ?disabled="${x => x.disabled}" list="${x => x.list}" maxlength="${x => x.maxlength}" minlength="${x => x.minlength}" ?multiple="${x => x.multiple}" name="${x => x.name}" pattern="${x => x.pattern}" placeholder="${x => x.placeholder}" ?readonly="${x => x.readOnly}" ?required="${x => x.required}" size="${x => x.size}" spellcheck="${x => x.spellcheck}" type="${x => x.type}" value="${x => x.initialValue}" ${ref("control")} />${endSlotTemplate(options)}</div></template>`;
|
|
12914
|
+
return html`<template @beforeinput="${(x, c) => x.beforeinputHandler(c.event)}" @focusin="${(x, c) => x.focusinHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}"><label part="label" for="control" class="label" ${ref("controlLabel")}><slot ${slotted("defaultSlottedNodes")}></slot></label><div class="root" part="root">${startSlotTemplate(options)}<input class="control" part="control" id="control" @change="${(x, c) => x.changeHandler(c.event)}" @input="${(x, c) => x.inputHandler(c.event)}" ?autofocus="${x => x.autofocus}" autocomplete="${x => x.autocomplete}" ?disabled="${x => x.disabled}" list="${x => x.list}" maxlength="${x => x.maxlength}" minlength="${x => x.minlength}" ?multiple="${x => x.multiple}" name="${x => x.name}" pattern="${x => x.pattern}" placeholder="${x => x.placeholder}" ?readonly="${x => x.readOnly}" ?required="${x => x.required}" size="${x => x.size}" spellcheck="${x => x.spellcheck}" type="${x => x.type}" value="${x => x.initialValue}" ${ref("control")} />${endSlotTemplate(options)}</div></template>`;
|
|
12699
12915
|
}
|
|
12700
12916
|
const template$5 = textInputTemplate();
|
|
12701
12917
|
|
|
@@ -13098,9 +13314,21 @@ class BaseTree extends FASTElement {
|
|
|
13098
13314
|
* @internal
|
|
13099
13315
|
*/
|
|
13100
13316
|
this.elementInternals = this.attachInternals();
|
|
13101
|
-
this.childTreeItems = [];
|
|
13102
13317
|
this.elementInternals.role = "tree";
|
|
13103
13318
|
}
|
|
13319
|
+
/**
|
|
13320
|
+
* Calls the slot change handler when the `defaultSlot` reference is updated
|
|
13321
|
+
* by the template binding.
|
|
13322
|
+
*
|
|
13323
|
+
* @internal
|
|
13324
|
+
*/
|
|
13325
|
+
defaultSlotChanged() {
|
|
13326
|
+
this.handleDefaultSlotChange();
|
|
13327
|
+
}
|
|
13328
|
+
connectedCallback() {
|
|
13329
|
+
super.connectedCallback();
|
|
13330
|
+
this.tabIndex = Number(this.getAttribute("tabindex") ?? 0) < 0 ? -1 : 0;
|
|
13331
|
+
}
|
|
13104
13332
|
/** @internal */
|
|
13105
13333
|
childTreeItemsChanged() {
|
|
13106
13334
|
this.updateCurrentSelected();
|
|
@@ -13294,6 +13522,7 @@ class BaseTree extends FASTElement {
|
|
|
13294
13522
|
}
|
|
13295
13523
|
}
|
|
13296
13524
|
__decorateClass$3([observable], BaseTree.prototype, "currentSelected", 2);
|
|
13525
|
+
__decorateClass$3([observable], BaseTree.prototype, "defaultSlot", 2);
|
|
13297
13526
|
__decorateClass$3([observable], BaseTree.prototype, "childTreeItems", 2);
|
|
13298
13527
|
|
|
13299
13528
|
var __defProp$2 = Object.defineProperty;
|
|
@@ -13374,11 +13603,19 @@ class BaseTreeItem extends FASTElement {
|
|
|
13374
13603
|
*/
|
|
13375
13604
|
this.elementInternals = this.attachInternals();
|
|
13376
13605
|
this.expanded = false;
|
|
13377
|
-
this.selected = false;
|
|
13378
13606
|
this.empty = false;
|
|
13379
13607
|
this.childTreeItems = [];
|
|
13380
13608
|
this.elementInternals.role = "treeitem";
|
|
13381
13609
|
}
|
|
13610
|
+
/**
|
|
13611
|
+
* Calls the slot change handler when the `itemSlot` reference is updated
|
|
13612
|
+
* by the template binding.
|
|
13613
|
+
*
|
|
13614
|
+
* @internal
|
|
13615
|
+
*/
|
|
13616
|
+
itemSlotChanged() {
|
|
13617
|
+
this.handleItemSlotChange();
|
|
13618
|
+
}
|
|
13382
13619
|
/**
|
|
13383
13620
|
* Handles changes to the expanded attribute
|
|
13384
13621
|
* @param prev - the previous state
|
|
@@ -13428,7 +13665,9 @@ class BaseTreeItem extends FASTElement {
|
|
|
13428
13665
|
}
|
|
13429
13666
|
connectedCallback() {
|
|
13430
13667
|
super.connectedCallback();
|
|
13431
|
-
|
|
13668
|
+
Updates.enqueue(() => {
|
|
13669
|
+
this.updateTabindexBySelected();
|
|
13670
|
+
});
|
|
13432
13671
|
}
|
|
13433
13672
|
/**
|
|
13434
13673
|
* Updates the childrens indent
|
|
@@ -13471,9 +13710,7 @@ class BaseTreeItem extends FASTElement {
|
|
|
13471
13710
|
return isTreeItem(this.parentElement);
|
|
13472
13711
|
}
|
|
13473
13712
|
updateTabindexBySelected() {
|
|
13474
|
-
|
|
13475
|
-
this.tabIndex = this.selected ? 0 : -1;
|
|
13476
|
-
}
|
|
13713
|
+
this.tabIndex = this.selected ? 0 : -1;
|
|
13477
13714
|
}
|
|
13478
13715
|
/** @internal */
|
|
13479
13716
|
handleItemSlotChange() {
|