@fluentui/web-components 3.0.0-beta.75 → 3.0.0-beta.77

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.
@@ -7510,7 +7510,7 @@ class BaseField extends FASTElement {
7510
7510
  * @internal
7511
7511
  */
7512
7512
  setStates() {
7513
- if (this.$fastController.isConnected) {
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.checkedIndex = this.getEnabledIndexInBounds(nextIndex);
9309
+ this.checkRadio(this.getEnabledIndexInBounds(nextIndex), true);
9305
9310
  this.enabledRadios[this.checkedIndex]?.focus();
9306
9311
  }
9307
9312
  /**
@@ -10274,8 +10279,8 @@ __decorateClass$8([attr], Spinner.prototype, "appearance", 2);
10274
10279
  const styles$a = css`
10275
10280
  ${display("inline-flex")}
10276
10281
 
10277
- :host{--duration:1.5s;--indicatorSize:${strokeWidthThicker};--size:32px;height:var(--size);width:var(--size);contain:strict;content-visibility:auto}:host(${tinyState}){--indicatorSize:${strokeWidthThick};--size:20px}:host(${extraSmallState}){--indicatorSize:${strokeWidthThick};--size:24px}:host(${smallState}){--indicatorSize:${strokeWidthThick};--size:28px}:host(${largeState}){--indicatorSize:${strokeWidthThicker};--size:36px}:host(${extraLargeState}){--indicatorSize:${strokeWidthThicker};--size:40px}:host(${hugeState}){--indicatorSize:${strokeWidthThickest};--size:44px}.progress,.background,.spinner,.start,.end,.indicator{position:absolute;inset:0}.progress,.spinner,.indicator{animation:none var(--duration) infinite ${curveEasyEase}}.progress{animation-timing-function:linear;animation-name:spin-linear}.background{border:var(--indicatorSize) solid ${colorBrandStroke2};border-radius:50%}:host(${invertedState}) .background{border-color:rgba(255,255,255,0.2)}.spinner{animation-name:spin-swing}.start{overflow:hidden;inset-inline-end:50%}.end{overflow:hidden;inset-inline-start:50%}.indicator{color:${colorBrandStroke1};box-sizing:border-box;border-radius:50%;border:var(--indicatorSize) solid transparent;border-block-start-color:currentcolor;border-inline-end-color:currentcolor}:host(${invertedState}) .indicator{color:${colorNeutralStrokeOnBrand2}}.start .indicator{rotate:135deg;inset:0 -100% 0 0;animation-name:spin-start}.end .indicator{rotate:135deg;inset:0 0 0 -100%;animation-name:spin-end}@keyframes spin-linear{100%{transform:rotate(360deg)}}@keyframes spin-swing{0%{transform:rotate(-135deg)}50%{transform:rotate(0deg)}100%{transform:rotate(225deg)}}@keyframes spin-start{0%,100%{transform:rotate(0deg)}50%{transform:rotate(-80deg)}}@keyframes spin-end{0%,100%{transform:rotate(0deg)}50%{transform:rotate(70deg)}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
10278
- .background{display:none}.indicator{border-color:Canvas;border-block-start-color:Highlight;border-inline-end-color:Highlight}`));
10282
+ :host{--duration:1.5s;--indicatorSize:${strokeWidthThicker};--size:32px;height:var(--size);width:var(--size);contain:strict;content-visibility:auto}:host(${tinyState}){--indicatorSize:${strokeWidthThick};--size:20px}:host(${extraSmallState}){--indicatorSize:${strokeWidthThick};--size:24px}:host(${smallState}){--indicatorSize:${strokeWidthThick};--size:28px}:host(${largeState}){--indicatorSize:${strokeWidthThicker};--size:36px}:host(${extraLargeState}){--indicatorSize:${strokeWidthThicker};--size:40px}:host(${hugeState}){--indicatorSize:${strokeWidthThickest};--size:44px}.progress,.background,.spinner,.start,.end,.indicator{position:absolute;inset:0}.progress,.spinner,.indicator{animation:none var(--duration) infinite ${curveEasyEase}}.progress{animation-timing-function:linear;animation-name:spin-linear}.background{border:var(--indicatorSize) solid ${colorBrandStroke2};border-radius:50%}:host(${invertedState}) .background{border-color:rgba(255,255,255,0.2)}.spinner{animation-name:spin-swing}.start{overflow:hidden;right:50%}.end{overflow:hidden;left:50%}.indicator{color:${colorBrandStroke1};box-sizing:border-box;border-radius:50%;border:var(--indicatorSize) solid transparent;border-block-start-color:currentcolor;border-right-color:currentcolor}:host(${invertedState}) .indicator{color:${colorNeutralStrokeOnBrand2}}.start .indicator{rotate:135deg;inset:0 -100% 0 0;animation-name:spin-start}.end .indicator{rotate:135deg;inset:0 0 0 -100%;animation-name:spin-end}@keyframes spin-linear{100%{transform:rotate(360deg)}}@keyframes spin-swing{0%{transform:rotate(-135deg)}50%{transform:rotate(0deg)}100%{transform:rotate(225deg)}}@keyframes spin-start{0%,100%{transform:rotate(0deg)}50%{transform:rotate(-80deg)}}@keyframes spin-end{0%,100%{transform:rotate(0deg)}50%{transform:rotate(70deg)}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
10283
+ .background{display:none}.indicator{border-color:Canvas;border-block-start-color:Highlight;border-right-color:Highlight}`));
10279
10284
 
10280
10285
  const template$a = html`<slot name="indicator"><div class="background"></div><div class="progress"><div class="spinner"><div class="start"><div class="indicator"></div></div><div class="end"><div class="indicator"></div></div></div></div></slot>`;
10281
10286
 
@@ -10305,7 +10310,7 @@ const styles$9 = css`
10305
10310
  ${display("inline-flex")}
10306
10311
 
10307
10312
  :host{box-sizing:border-box;align-items:center;flex-direction:row;outline:none;user-select:none;contain:content;padding:0 ${spacingHorizontalXXS};width:40px;height:20px;background-color:${colorTransparentBackground};border:1px solid ${colorNeutralStrokeAccessible};border-radius:${borderRadiusCircular};cursor:pointer}:host(:hover){background:none;border-color:${colorNeutralStrokeAccessibleHover}}:host(:active){border-color:${colorNeutralStrokeAccessiblePressed}}:host(:disabled),:host([readonly]){border:1px solid ${colorNeutralStrokeDisabled};background-color:none;pointer:default}:host(${checkedState}){background:${colorCompoundBrandBackground};border-color:${colorCompoundBrandBackground}}:host(${checkedState}:hover){background:${colorCompoundBrandBackgroundHover};border-color:${colorCompoundBrandBackgroundHover}}:host(${checkedState}:active){background:${colorCompoundBrandBackgroundPressed};border-color:${colorCompoundBrandBackgroundPressed}}:host(${checkedState}:disabled){background:${colorNeutralBackgroundDisabled};border-color:${colorNeutralStrokeDisabled}}.checked-indicator{height:14px;width:14px;border-radius:50%;margin-inline-start:0;background-color:${colorNeutralForeground3};transition-duration:${durationNormal};transition-timing-function:${curveEasyEase};transition-property:margin-inline-start}:host(${checkedState}) .checked-indicator{background-color:${colorNeutralForegroundInverted};margin-inline-start:calc(100% - 14px)}:host(${checkedState}:hover) .checked-indicator{background:${colorNeutralForegroundInvertedHover}}:host(${checkedState}:active) .checked-indicator{background:${colorNeutralForegroundInvertedPressed}}:host(:hover) .checked-indicator{background-color:${colorNeutralForeground3Hover}}:host(:active) .checked-indicator{background-color:${colorNeutralForeground3Pressed}}:host(:disabled) .checked-indicator,:host([readonly]) .checked-indicator{background:${colorNeutralForegroundDisabled}}:host(${checkedState}:disabled) .checked-indicator{background:${colorNeutralForegroundDisabled}}:host(:focus-visible){outline:none}:host(:not([slot='input']):focus-visible){border-color:${colorTransparentStroke};outline:${strokeWidthThick} solid ${colorTransparentStroke};box-shadow:${shadow4},0 0 0 2px ${colorStrokeFocus2}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
10308
- :host{border-color:InactiveBorder}:host(${checkedState}),:host(${checkedState}:active),:host(${checkedState}:hover){background:Highlight;border-color:Highlight}.checked-indicator,:host(:hover) .checked-indicator,:host(:active) .checked-indicator{background-color:ActiveCaption}:host(${checkedState}) .checked-indicator,:host(${checkedState}:hover) .checked-indicator,:host(${checkedState}:active) .checked-indicator{background-color:ButtonFace}`));
10313
+ :host{border-color:InactiveBorder}:host(${checkedState}),:host(${checkedState}:active),:host(${checkedState}:hover){background:Highlight;border-color:Highlight}.checked-indicator,:host(:hover) .checked-indicator,:host(:active) .checked-indicator{background-color:ActiveCaption}:host(${checkedState}) .checked-indicator,:host(${checkedState}:hover) .checked-indicator,:host(${checkedState}:active) .checked-indicator{background-color:ButtonFace}:host(:disabled) .checked-indicator,:host(${checkedState}:disabled) .checked-indicator{background-color:GrayText}`));
10309
10314
 
10310
10315
  const definition$9 = Switch.compose({
10311
10316
  name: `${FluentDesignSystem.prefix}-switch`,
@@ -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
- } else {
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
- this.anchorElement.addEventListener("focus", this.focusAnchorHandler);
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({