@fluentui/web-components 3.0.0-beta.75 → 3.0.0-beta.76
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 +12 -2
- package/README.md +3 -1
- package/dist/dts/radio-group/radio-group.d.ts +1 -1
- package/dist/dts/tooltip/tooltip.d.ts +7 -0
- package/dist/esm/field/field.js +1 -1
- package/dist/esm/field/field.js.map +1 -1
- package/dist/esm/radio/radio.js +0 -1
- package/dist/esm/radio/radio.js.map +1 -1
- package/dist/esm/radio-group/radio-group.js +9 -2
- package/dist/esm/radio-group/radio-group.js.map +1 -1
- package/dist/esm/theme/set-theme.js +3 -3
- package/dist/esm/theme/set-theme.js.map +1 -1
- package/dist/esm/tooltip/tooltip.js +70 -54
- package/dist/esm/tooltip/tooltip.js.map +1 -1
- package/dist/web-components.d.ts +8 -1
- package/dist/web-components.js +78 -52
- package/dist/web-components.min.js +93 -92
- package/package.json +5 -3
- package/dist/dts/helpers.tests.d.ts +0 -30
- package/dist/esm/helpers.tests.js +0 -73
- package/dist/esm/helpers.tests.js.map +0 -1
package/dist/web-components.js
CHANGED
|
@@ -7510,7 +7510,7 @@ class BaseField extends FASTElement {
|
|
|
7510
7510
|
* @internal
|
|
7511
7511
|
*/
|
|
7512
7512
|
setStates() {
|
|
7513
|
-
if (this
|
|
7513
|
+
if (this.elementInternals && this.input) {
|
|
7514
7514
|
toggleState(this.elementInternals, "disabled", !!this.input.disabled);
|
|
7515
7515
|
toggleState(this.elementInternals, "readonly", !!this.input.readOnly);
|
|
7516
7516
|
toggleState(this.elementInternals, "required", !!this.input.required);
|
|
@@ -8895,7 +8895,6 @@ class Radio extends BaseCheckbox {
|
|
|
8895
8895
|
disabledChanged(prev, next) {
|
|
8896
8896
|
super.disabledChanged(prev, next);
|
|
8897
8897
|
if (next) {
|
|
8898
|
-
this.checked = false;
|
|
8899
8898
|
this.tabIndex = -1;
|
|
8900
8899
|
}
|
|
8901
8900
|
this.$emit("disabled", next, {
|
|
@@ -9166,6 +9165,9 @@ class RadioGroup extends FASTElement {
|
|
|
9166
9165
|
this.dirtyState = true;
|
|
9167
9166
|
const radioIndex = this.enabledRadios.indexOf(e.target);
|
|
9168
9167
|
this.checkRadio(radioIndex);
|
|
9168
|
+
this.radios?.filter(x => x.disabled)?.forEach(item => {
|
|
9169
|
+
item.checked = false;
|
|
9170
|
+
});
|
|
9169
9171
|
return true;
|
|
9170
9172
|
}
|
|
9171
9173
|
/**
|
|
@@ -9174,13 +9176,16 @@ class RadioGroup extends FASTElement {
|
|
|
9174
9176
|
* @param index - the index of the radio to check
|
|
9175
9177
|
* @internal
|
|
9176
9178
|
*/
|
|
9177
|
-
checkRadio(index = this.checkedIndex) {
|
|
9179
|
+
checkRadio(index = this.checkedIndex, shouldEmit = false) {
|
|
9178
9180
|
let checkedIndex = this.checkedIndex;
|
|
9179
9181
|
this.enabledRadios.forEach((item, i) => {
|
|
9180
9182
|
const shouldCheck = i === index;
|
|
9181
9183
|
item.checked = shouldCheck;
|
|
9182
9184
|
if (shouldCheck) {
|
|
9183
9185
|
checkedIndex = i;
|
|
9186
|
+
if (shouldEmit) {
|
|
9187
|
+
item.$emit("change");
|
|
9188
|
+
}
|
|
9184
9189
|
}
|
|
9185
9190
|
});
|
|
9186
9191
|
this.checkedIndex = checkedIndex;
|
|
@@ -9301,7 +9306,7 @@ class RadioGroup extends FASTElement {
|
|
|
9301
9306
|
return true;
|
|
9302
9307
|
}
|
|
9303
9308
|
const nextIndex = checkedIndex + increment;
|
|
9304
|
-
this.
|
|
9309
|
+
this.checkRadio(this.getEnabledIndexInBounds(nextIndex), true);
|
|
9305
9310
|
this.enabledRadios[this.checkedIndex]?.focus();
|
|
9306
9311
|
}
|
|
9307
9312
|
/**
|
|
@@ -12439,6 +12444,16 @@ class Tooltip extends FASTElement {
|
|
|
12439
12444
|
this.blurAnchorHandler = () => this.hideTooltip(0);
|
|
12440
12445
|
this.elementInternals.role = "tooltip";
|
|
12441
12446
|
}
|
|
12447
|
+
/**
|
|
12448
|
+
* Updates the fallback styles when the positioning changes.
|
|
12449
|
+
*
|
|
12450
|
+
* @internal
|
|
12451
|
+
*/
|
|
12452
|
+
positioningChanged() {
|
|
12453
|
+
if (!SUPPORTS_CSS_ANCHOR_POSITIONING) {
|
|
12454
|
+
this.setFallbackStyles();
|
|
12455
|
+
}
|
|
12456
|
+
}
|
|
12442
12457
|
/**
|
|
12443
12458
|
* Reference to the anchor element
|
|
12444
12459
|
* @internal
|
|
@@ -12455,60 +12470,18 @@ class Tooltip extends FASTElement {
|
|
|
12455
12470
|
const anchorName = this.anchorElement.style.anchorName || `--${this.anchor}`;
|
|
12456
12471
|
const describedBy = this.anchorElement.getAttribute("aria-describedby");
|
|
12457
12472
|
this.anchorElement.setAttribute("aria-describedby", describedBy ? `${describedBy} ${this.id}` : this.id);
|
|
12473
|
+
this.anchorElement.addEventListener("focus", this.focusAnchorHandler);
|
|
12474
|
+
this.anchorElement.addEventListener("blur", this.blurAnchorHandler);
|
|
12475
|
+
this.anchorElement.addEventListener("mouseenter", this.mouseenterAnchorHandler);
|
|
12476
|
+
this.anchorElement.addEventListener("mouseleave", this.mouseleaveAnchorHandler);
|
|
12458
12477
|
if (SUPPORTS_CSS_ANCHOR_POSITIONING) {
|
|
12459
12478
|
if (!SUPPORTS_HTML_ANCHOR_POSITIONING) {
|
|
12460
12479
|
this.anchorElement.style.anchorName = anchorName;
|
|
12461
12480
|
this.style.positionAnchor = anchorName;
|
|
12462
12481
|
}
|
|
12463
|
-
|
|
12464
|
-
if (!this.anchorPositioningStyleElement) {
|
|
12465
|
-
this.anchorPositioningStyleElement = document.createElement("style");
|
|
12466
|
-
document.head.append(this.anchorPositioningStyleElement);
|
|
12467
|
-
}
|
|
12468
|
-
let [direction, alignment] = this.positioning?.split("-") ?? [];
|
|
12469
|
-
if (alignment === void 0 && (direction === "above" || direction === "below")) {
|
|
12470
|
-
alignment = "centerX";
|
|
12471
|
-
}
|
|
12472
|
-
if (alignment === void 0 && (direction === "before" || direction === "after")) {
|
|
12473
|
-
alignment = "centerY";
|
|
12474
|
-
}
|
|
12475
|
-
const directionCSSMap = {
|
|
12476
|
-
above: `bottom: anchor(${anchorName} top);`,
|
|
12477
|
-
below: `top: anchor(${anchorName} bottom);`,
|
|
12478
|
-
before: `right: anchor(${anchorName} left);`,
|
|
12479
|
-
after: `left: anchor(${anchorName} right);`
|
|
12480
|
-
};
|
|
12481
|
-
const directionCSS = directionCSSMap[direction] ?? directionCSSMap.above;
|
|
12482
|
-
const alignmentCSSMap = {
|
|
12483
|
-
start: `left: anchor(${anchorName} left);`,
|
|
12484
|
-
end: `right: anchor(${anchorName} right);`,
|
|
12485
|
-
top: `top: anchor(${anchorName} top);`,
|
|
12486
|
-
bottom: `bottom: anchor(${anchorName} bottom);`,
|
|
12487
|
-
centerX: `left: anchor(${anchorName} center); translate: -50% 0;`,
|
|
12488
|
-
centerY: `top: anchor(${anchorName} center); translate: 0 -50%;`
|
|
12489
|
-
};
|
|
12490
|
-
const alignmentCSS = alignmentCSSMap[alignment] ?? alignmentCSSMap.centerX;
|
|
12491
|
-
this.anchorPositioningStyleElement.textContent = `
|
|
12492
|
-
#${this.anchor} {
|
|
12493
|
-
anchor-name: ${anchorName};
|
|
12494
|
-
}
|
|
12495
|
-
#${this.id} {
|
|
12496
|
-
inset: unset;
|
|
12497
|
-
${directionCSS}
|
|
12498
|
-
${alignmentCSS}
|
|
12499
|
-
position: absolute;
|
|
12500
|
-
}
|
|
12501
|
-
`;
|
|
12502
|
-
if (window.CSS_ANCHOR_POLYFILL) {
|
|
12503
|
-
window.CSS_ANCHOR_POLYFILL.call({
|
|
12504
|
-
element: this.anchorPositioningStyleElement
|
|
12505
|
-
});
|
|
12506
|
-
}
|
|
12482
|
+
return;
|
|
12507
12483
|
}
|
|
12508
|
-
|
|
12509
|
-
this.anchorElement.addEventListener("blur", this.blurAnchorHandler);
|
|
12510
|
-
this.anchorElement.addEventListener("mouseenter", this.mouseenterAnchorHandler);
|
|
12511
|
-
this.anchorElement.addEventListener("mouseleave", this.mouseleaveAnchorHandler);
|
|
12484
|
+
Updates.enqueue(() => this.setFallbackStyles());
|
|
12512
12485
|
}
|
|
12513
12486
|
disconnectedCallback() {
|
|
12514
12487
|
super.disconnectedCallback();
|
|
@@ -12543,6 +12516,59 @@ class Tooltip extends FASTElement {
|
|
|
12543
12516
|
this.hidePopover();
|
|
12544
12517
|
}, delay);
|
|
12545
12518
|
}
|
|
12519
|
+
setFallbackStyles() {
|
|
12520
|
+
if (!this.anchorElement) {
|
|
12521
|
+
return;
|
|
12522
|
+
}
|
|
12523
|
+
const anchorName = this.anchorElement.style.anchorName || `--${this.anchor}`;
|
|
12524
|
+
if (!this.anchorPositioningStyleElement) {
|
|
12525
|
+
this.anchorPositioningStyleElement = document.createElement("style");
|
|
12526
|
+
document.head.append(this.anchorPositioningStyleElement);
|
|
12527
|
+
}
|
|
12528
|
+
let [direction, alignment] = this.positioning?.split("-") ?? [];
|
|
12529
|
+
if (!alignment) {
|
|
12530
|
+
if (direction === "above" || direction === "below") {
|
|
12531
|
+
alignment = "centerX";
|
|
12532
|
+
}
|
|
12533
|
+
if (direction === "before" || direction === "after") {
|
|
12534
|
+
alignment = "centerY";
|
|
12535
|
+
}
|
|
12536
|
+
}
|
|
12537
|
+
const directionCSSMap = {
|
|
12538
|
+
above: `bottom: anchor(top);`,
|
|
12539
|
+
below: `top: anchor(bottom);`,
|
|
12540
|
+
before: `right: anchor(left);`,
|
|
12541
|
+
after: `left: anchor(right);`
|
|
12542
|
+
};
|
|
12543
|
+
const directionCSS = directionCSSMap[direction] ?? directionCSSMap.above;
|
|
12544
|
+
const alignmentCSSMap = {
|
|
12545
|
+
start: `left: anchor(left);`,
|
|
12546
|
+
end: `right: anchor(right);`,
|
|
12547
|
+
top: `top: anchor(top);`,
|
|
12548
|
+
bottom: `bottom: anchor(bottom);`,
|
|
12549
|
+
centerX: `left: anchor(center); translate: -50% 0;`,
|
|
12550
|
+
centerY: `top: anchor(center); translate: 0 -50%;`
|
|
12551
|
+
};
|
|
12552
|
+
const alignmentCSS = alignmentCSSMap[alignment] ?? alignmentCSSMap.centerX;
|
|
12553
|
+
this.anchorPositioningStyleElement.textContent = /* css */
|
|
12554
|
+
`
|
|
12555
|
+
#${this.anchor} {
|
|
12556
|
+
anchor-name: ${anchorName};
|
|
12557
|
+
}
|
|
12558
|
+
#${this.id} {
|
|
12559
|
+
inset: unset;
|
|
12560
|
+
position-anchor: ${anchorName};
|
|
12561
|
+
position: absolute;
|
|
12562
|
+
${directionCSS}
|
|
12563
|
+
${alignmentCSS}
|
|
12564
|
+
}
|
|
12565
|
+
`;
|
|
12566
|
+
if (window.CSS_ANCHOR_POLYFILL) {
|
|
12567
|
+
window.CSS_ANCHOR_POLYFILL.call({
|
|
12568
|
+
element: this.anchorPositioningStyleElement
|
|
12569
|
+
});
|
|
12570
|
+
}
|
|
12571
|
+
}
|
|
12546
12572
|
}
|
|
12547
12573
|
__decorateClass([attr], Tooltip.prototype, "id", 2);
|
|
12548
12574
|
__decorateClass([attr({
|