@fluentui/web-components 3.0.0-beta.106 → 3.0.0-beta.107

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.
@@ -5961,7 +5961,7 @@ class BaseButton extends FASTElement {
5961
5961
  if (!this.elementInternals.form || this.disabled || this.type !== ButtonType.submit) {
5962
5962
  return;
5963
5963
  }
5964
- if (!this.name && !this.formAction && !this.formEnctype && !this.form && !this.formMethod && !this.formNoValidate && !this.formTarget) {
5964
+ if (!this.name && !this.formAction && !this.formEnctype && !this.formAttribute && !this.formMethod && !this.formNoValidate && !this.formTarget) {
5965
5965
  this.elementInternals.form.requestSubmit();
5966
5966
  return;
5967
5967
  }
@@ -6069,6 +6069,14 @@ class BaseCheckbox extends FASTElement {
6069
6069
  constructor() {
6070
6070
  super(...arguments);
6071
6071
  this.initialValue = "on";
6072
+ /**
6073
+ * Tracks whether the space key was pressed down while the checkbox was focused.
6074
+ * This is used to prevent inadvertently checking a required, unchecked checkbox when the space key is pressed on a
6075
+ * submit button and field validation is triggered.
6076
+ *
6077
+ * @internal
6078
+ */
6079
+ this._keydownPressed = false;
6072
6080
  /**
6073
6081
  * Indicates that the checked state has been changed by the user.
6074
6082
  *
@@ -6287,7 +6295,8 @@ class BaseCheckbox extends FASTElement {
6287
6295
  return true;
6288
6296
  }
6289
6297
  /**
6290
- * Prevents scrolling when the user presses the space key.
6298
+ * Prevents scrolling when the user presses the space key, and sets a flag to indicate that the space key was pressed
6299
+ * down while the checkbox was focused.
6291
6300
  *
6292
6301
  * @param e - the event object
6293
6302
  * @internal
@@ -6296,6 +6305,7 @@ class BaseCheckbox extends FASTElement {
6296
6305
  if (e.key !== " ") {
6297
6306
  return true;
6298
6307
  }
6308
+ this._keydownPressed = true;
6299
6309
  }
6300
6310
  /**
6301
6311
  * Toggles the checked state when the user releases the space key.
@@ -6304,9 +6314,10 @@ class BaseCheckbox extends FASTElement {
6304
6314
  * @internal
6305
6315
  */
6306
6316
  keyupHandler(e) {
6307
- if (e.key !== " ") {
6317
+ if (!this._keydownPressed || e.key !== " ") {
6308
6318
  return true;
6309
6319
  }
6320
+ this._keydownPressed = false;
6310
6321
  this.click();
6311
6322
  }
6312
6323
  /**
@@ -6481,7 +6492,7 @@ const disabledState = stateSelector("disabled");
6481
6492
  stateSelector("error");
6482
6493
  const flipBlockState = stateSelector("flip-block");
6483
6494
  const focusVisibleState = stateSelector("focus-visible");
6484
- const hasMessageState = stateSelector("has-message");
6495
+ stateSelector("has-message");
6485
6496
  const indeterminateState = stateSelector("indeterminate");
6486
6497
  const multipleState = stateSelector("multiple");
6487
6498
  const openState = stateSelector("open");
@@ -6490,6 +6501,7 @@ const placeholderShownState = stateSelector("placeholder-shown");
6490
6501
  const pressedState = stateSelector("pressed");
6491
6502
  const rangeOverflowState = stateSelector("range-overflow");
6492
6503
  const rangeUnderflowState = stateSelector("range-underflow");
6504
+ const requiredState = stateSelector("required");
6493
6505
  const selectedState = stateSelector("selected");
6494
6506
  const stepMismatchState = stateSelector("step-mismatch");
6495
6507
  const submenuState = stateSelector("submenu");
@@ -7209,6 +7221,7 @@ const _BaseDropdown = class _BaseDropdown extends FASTElement {
7209
7221
  if (next) {
7210
7222
  next.dropdown = this;
7211
7223
  next.popover = "manual";
7224
+ next.tabIndex = -1;
7212
7225
  this.listboxSlot.assign(next);
7213
7226
  const notifier = Observable.getNotifier(this);
7214
7227
  notifier.subscribe(next);
@@ -7895,15 +7908,6 @@ class BaseField extends FASTElement {
7895
7908
  */
7896
7909
  messageSlotChanged(prev, next) {
7897
7910
  toggleState(this.elementInternals, "has-message", !!next.length);
7898
- if (!next.length) {
7899
- this.removeEventListener("invalid", this.invalidHandler, {
7900
- capture: true
7901
- });
7902
- return;
7903
- }
7904
- this.addEventListener("invalid", this.invalidHandler, {
7905
- capture: true
7906
- });
7907
7911
  }
7908
7912
  /**
7909
7913
  * Sets the `input` property to the first slotted input.
@@ -7953,6 +7957,18 @@ class BaseField extends FASTElement {
7953
7957
  }
7954
7958
  return true;
7955
7959
  }
7960
+ connectedCallback() {
7961
+ super.connectedCallback();
7962
+ this.addEventListener("invalid", this.invalidHandler, {
7963
+ capture: true
7964
+ });
7965
+ }
7966
+ disconnectedCallback() {
7967
+ this.removeEventListener("invalid", this.invalidHandler, {
7968
+ capture: true
7969
+ });
7970
+ super.disconnectedCallback();
7971
+ }
7956
7972
  /**
7957
7973
  * Applies the `focus-visible` state to the element when the slotted input receives visible focus.
7958
7974
  *
@@ -8053,7 +8069,7 @@ __decorateClass$w([attr({
8053
8069
  const styles$r = css`
8054
8070
  ${display("inline-grid")}
8055
8071
 
8056
- :host{color:${colorNeutralForeground1};align-items:center;gap:0 ${spacingHorizontalM};justify-items:start;position:relative}:has([slot='message']){color:${colorNeutralForeground1};row-gap:${spacingVerticalS}}:not(::slotted([slot='label'])){gap:0}:host([label-position='before']){grid-template-areas:'label input' 'label message'}:host([label-position='after']){gap:0;grid-template-areas:'input label' 'message message';grid-template-columns:auto 1fr}:host([label-position='after']) ::slotted([slot='input']){margin-inline-end:${spacingHorizontalM}}:host([label-position='above']){grid-template-areas:'label' 'input' 'message';row-gap:${spacingVerticalXXS}}:host([label-position='below']){grid-template-areas:'input' 'label' 'message';justify-items:center}:host([label-position='below']) ::slotted([slot='label']){margin-block-start:${spacingVerticalM}}:host([label-position='below']:not(${hasMessageState})){grid-template-areas:'input' 'label'}::slotted([slot='label'])::after{content:'';display:block;position:absolute;inset:0}::slotted([slot='input']){grid-area:input;position:relative;z-index:1}::slotted([slot='message']){margin-block-start:${spacingVerticalXXS};grid-area:message}:host(${focusVisibleState}:focus-within){border-radius:${borderRadiusMedium};outline:${strokeWidthThick} solid ${colorStrokeFocus2}}::slotted(label),::slotted([slot='label']){cursor:inherit;display:inline-flex;font-family:${fontFamilyBase};font-size:${fontSizeBase300};font-weight:${fontWeightRegular};grid-area:label;line-height:${lineHeightBase300};user-select:none}:host([size='small']) ::slotted(label){font-size:${fontSizeBase200};line-height:${lineHeightBase200}}:host([size='large']) ::slotted(label){font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host([size='large']) ::slotted(label),:host([weight='semibold']) ::slotted(label){font-weight:${fontWeightSemibold}}:host(${disabledState}){cursor:default}::slotted([flag]){display:none}:host(${badInputState}) ::slotted([flag='${ValidationFlags.badInput}']),:host(${customErrorState}) ::slotted([flag='${ValidationFlags.customError}']),:host(${patternMismatchState}) ::slotted([flag='${ValidationFlags.patternMismatch}']),:host(${rangeOverflowState}) ::slotted([flag='${ValidationFlags.rangeOverflow}']),:host(${rangeUnderflowState}) ::slotted([flag='${ValidationFlags.rangeUnderflow}']),:host(${stepMismatchState}) ::slotted([flag='${ValidationFlags.stepMismatch}']),:host(${tooLongState}) ::slotted([flag='${ValidationFlags.tooLong}']),:host(${tooShortState}) ::slotted([flag='${ValidationFlags.tooShort}']),:host(${typeMismatchState}) ::slotted([flag='${ValidationFlags.typeMismatch}']),:host(${valueMissingState}) ::slotted([flag='${ValidationFlags.valueMissing}']),:host(${validState}) ::slotted([flag='${ValidationFlags.valid}']){display:block}`;
8072
+ :host{color:${colorNeutralForeground1};align-items:center;gap:0 ${spacingHorizontalM};justify-items:start;position:relative}:has([slot='message']){color:${colorNeutralForeground1};row-gap:${spacingVerticalS}}:not(::slotted([slot='label'])){gap:0}:host([label-position='before']){grid-template-areas:'label input' 'label message'}:host([label-position='after']){gap:0;grid-template-areas:'input label' 'message message';grid-template-columns:auto 1fr}:host([label-position='after']) ::slotted([slot='input']){margin-inline-end:${spacingHorizontalM}}:host([label-position='above']){grid-template-areas:'label' 'input' 'message';row-gap:${spacingVerticalXXS}}:host([label-position='below']){grid-template-areas:'input' 'label' 'message';justify-items:center}:host([label-position='below']) ::slotted([slot='label']){margin-block-start:${spacingVerticalM}}:host(${requiredState}) ::slotted([slot='label'])::after{content:'*' / '';color:${colorPaletteRedForeground1};margin-inline-start:${spacingHorizontalXS}}::slotted([slot='input']){grid-area:input;position:relative;z-index:1}::slotted([slot='message']){color:${colorNeutralForeground3};font-family:${fontFamilyBase};font-size:${fontSizeBase200};font-weight:${fontWeightRegular};grid-area:message;line-height:${lineHeightBase200};margin-block-start:${spacingVerticalXXS}}:host(${focusVisibleState}:focus-within){border-radius:${borderRadiusMedium};outline:${strokeWidthThick} solid ${colorStrokeFocus2}}::slotted(label),::slotted([slot='label']){cursor:inherit;display:inline-flex;font-family:${fontFamilyBase};font-size:${fontSizeBase300};font-weight:${fontWeightRegular};grid-area:label;line-height:${lineHeightBase300};justify-self:stretch;user-select:none}:host([size='small']) ::slotted(label){font-size:${fontSizeBase200};line-height:${lineHeightBase200}}:host([size='large']) ::slotted(label){font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host([size='large']) ::slotted(label),:host([weight='semibold']) ::slotted(label){font-weight:${fontWeightSemibold}}:host(${disabledState}){cursor:default}::slotted([flag]){display:none}:host(${badInputState}) ::slotted([flag='${ValidationFlags.badInput}']),:host(${customErrorState}) ::slotted([flag='${ValidationFlags.customError}']),:host(${patternMismatchState}) ::slotted([flag='${ValidationFlags.patternMismatch}']),:host(${rangeOverflowState}) ::slotted([flag='${ValidationFlags.rangeOverflow}']),:host(${rangeUnderflowState}) ::slotted([flag='${ValidationFlags.rangeUnderflow}']),:host(${stepMismatchState}) ::slotted([flag='${ValidationFlags.stepMismatch}']),:host(${tooLongState}) ::slotted([flag='${ValidationFlags.tooLong}']),:host(${tooShortState}) ::slotted([flag='${ValidationFlags.tooShort}']),:host(${typeMismatchState}) ::slotted([flag='${ValidationFlags.typeMismatch}']),:host(${valueMissingState}) ::slotted([flag='${ValidationFlags.valueMissing}']),:host(${validState}) ::slotted([flag='${ValidationFlags.valid}']){display:block}`;
8057
8073
 
8058
8074
  const template$s = html`<template @click="${(x, c) => x.clickHandler(c.event)}" @change="${(x, c) => x.changeHandler(c.event)}" @focusin="${(x, c) => x.focusinHandler(c.event)}" @focusout="${(x, c) => x.focusoutHandler(c.event)}" ${children({
8059
8075
  property: "slottedInputs",
@@ -8142,7 +8158,7 @@ const styles$p = css`
8142
8158
  :host{color:${colorNeutralForeground1};cursor:pointer;font-family:${fontFamilyBase};font-size:${fontSizeBase300};font-weight:${fontWeightRegular};line-height:${lineHeightBase300};user-select:none}.asterisk{color:${colorPaletteRedForeground1};margin-inline-start:${spacingHorizontalXS}}:host([size='small']){font-size:${fontSizeBase200};line-height:${lineHeightBase200}}:host([size='large']){font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host(:is([size='large'],[weight='semibold'])){font-weight:${fontWeightSemibold}}:host([disabled]),:host([disabled]) .asterisk{color:${colorNeutralForegroundDisabled}}`;
8143
8159
 
8144
8160
  function labelTemplate() {
8145
- return html`<slot></slot><span part="asterisk" class="asterisk" ?hidden="${x => !x.required}">*</span>`;
8161
+ return html`<slot></slot><span part="asterisk" class="asterisk" aria-hidden="true" ?hidden="${x => !x.required}">*</span>`;
8146
8162
  }
8147
8163
  const template$q = labelTemplate();
8148
8164
 
@@ -10206,7 +10222,7 @@ __decorateClass$k([attr({
10206
10222
  const styles$g = css`
10207
10223
  ${display("flex")}
10208
10224
 
10209
- :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}}`;
10225
+ :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}}`;
10210
10226
 
10211
10227
  function radioGroupTemplate() {
10212
10228
  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 @slotchange="${(x, c) => x.slotchangeHandler(c.event)}"></slot></template>`;
@@ -12965,7 +12981,7 @@ __decorateClass$6([attr], Text.prototype, "align", 2);
12965
12981
  const styles$4 = css`
12966
12982
  ${display("inline")}
12967
12983
 
12968
- :host{contain:content;font-family:${fontFamilyBase};font-size:${fontSizeBase300};line-height:${lineHeightBase300};font-weight:${fontWeightRegular};text-align:start}:host([nowrap]),:host([nowrap]) ::slotted(*){white-space:nowrap;overflow:hidden}:host([truncate]),:host([truncate]) ::slotted(*){text-overflow:ellipsis}:host([block]){display:block}:host([italic]){font-style:italic}:host([underline]){text-decoration-line:underline}:host([strikethrough]){text-decoration-line:line-through}:host([underline][strikethrough]){text-decoration-line:line-through underline}:host([size='100']){font-size:${fontSizeBase100};line-height:${lineHeightBase100}}:host([size='200']){font-size:${fontSizeBase200};line-height:${lineHeightBase200}}:host([size='400']){font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host([size='500']){font-size:${fontSizeBase500};line-height:${lineHeightBase500}}:host([size='600']){font-size:${fontSizeBase600};line-height:${lineHeightBase600}}:host([size='700']){font-size:${fontSizeHero700};line-height:${lineHeightHero700}}:host([size='800']){font-size:${fontSizeHero800};line-height:${lineHeightHero800}}:host([size='900']){font-size:${fontSizeHero900};line-height:${lineHeightHero900}}:host([size='1000']){font-size:${fontSizeHero1000};line-height:${lineHeightHero1000}}:host([font='monospace']){font-family:${fontFamilyMonospace}}:host([font='numeric']){font-family:${fontFamilyNumeric}}:host([weight='medium']){font-weight:${fontWeightMedium}}:host([weight='semibold']){font-weight:${fontWeightSemibold}}:host([weight='bold']){font-weight:${fontWeightBold}}:host([align='center']){text-align:center}:host([align='end']){text-align:end}:host([align='justify']){text-align:justify}::slotted(*){font:inherit;line-height:inherit;text-decoration-line:inherit;text-align:inherit;text-decoration-line:inherit;margin:0}`;
12984
+ :host{font-family:${fontFamilyBase};font-size:${fontSizeBase300};line-height:${lineHeightBase300};font-weight:${fontWeightRegular};text-align:start}:host([nowrap]),:host([nowrap]) ::slotted(*){white-space:nowrap;overflow:hidden}:host([truncate]),:host([truncate]) ::slotted(*){text-overflow:ellipsis}:host([block]){display:block}:host([italic]){font-style:italic}:host([underline]){text-decoration-line:underline}:host([strikethrough]){text-decoration-line:line-through}:host([underline][strikethrough]){text-decoration-line:line-through underline}:host([size='100']){font-size:${fontSizeBase100};line-height:${lineHeightBase100}}:host([size='200']){font-size:${fontSizeBase200};line-height:${lineHeightBase200}}:host([size='400']){font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host([size='500']){font-size:${fontSizeBase500};line-height:${lineHeightBase500}}:host([size='600']){font-size:${fontSizeBase600};line-height:${lineHeightBase600}}:host([size='700']){font-size:${fontSizeHero700};line-height:${lineHeightHero700}}:host([size='800']){font-size:${fontSizeHero800};line-height:${lineHeightHero800}}:host([size='900']){font-size:${fontSizeHero900};line-height:${lineHeightHero900}}:host([size='1000']){font-size:${fontSizeHero1000};line-height:${lineHeightHero1000}}:host([font='monospace']){font-family:${fontFamilyMonospace}}:host([font='numeric']){font-family:${fontFamilyNumeric}}:host([weight='medium']){font-weight:${fontWeightMedium}}:host([weight='semibold']){font-weight:${fontWeightSemibold}}:host([weight='bold']){font-weight:${fontWeightBold}}:host([align='center']){text-align:center}:host([align='end']){text-align:end}:host([align='justify']){text-align:justify}::slotted(*){font:inherit;line-height:inherit;text-decoration-line:inherit;text-align:inherit;text-decoration-line:inherit;margin:0}`;
12969
12985
 
12970
12986
  const template$4 = html`<slot></slot>`;
12971
12987