@fluentui/web-components 2.5.2 → 2.5.5

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.
@@ -321,36 +321,6 @@ const DOM = Object.freeze({
321
321
 
322
322
  });
323
323
 
324
- function spilloverSubscribe(subscriber) {
325
- const spillover = this.spillover;
326
- const index = spillover.indexOf(subscriber);
327
-
328
- if (index === -1) {
329
- spillover.push(subscriber);
330
- }
331
- }
332
-
333
- function spilloverUnsubscribe(subscriber) {
334
- const spillover = this.spillover;
335
- const index = spillover.indexOf(subscriber);
336
-
337
- if (index !== -1) {
338
- spillover.splice(index, 1);
339
- }
340
- }
341
-
342
- function spilloverNotifySubscribers(args) {
343
- const spillover = this.spillover;
344
- const source = this.source;
345
-
346
- for (let i = 0, ii = spillover.length; i < ii; ++i) {
347
- spillover[i].handleChange(source, args);
348
- }
349
- }
350
-
351
- function spilloverHas(subscriber) {
352
- return this.spillover.indexOf(subscriber) !== -1;
353
- }
354
324
  /**
355
325
  * An implementation of {@link Notifier} that efficiently keeps track of
356
326
  * subscribers interested in a specific change notification on an
@@ -362,8 +332,6 @@ function spilloverHas(subscriber) {
362
332
  * If the set ever exceeds two subscribers, it upgrades to an array automatically.
363
333
  * @public
364
334
  */
365
-
366
-
367
335
  class SubscriberSet {
368
336
  /**
369
337
  * Creates an instance of SubscriberSet for the specified source.
@@ -384,7 +352,7 @@ class SubscriberSet {
384
352
 
385
353
 
386
354
  has(subscriber) {
387
- return this.sub1 === subscriber || this.sub2 === subscriber;
355
+ return this.spillover === void 0 ? this.sub1 === subscriber || this.sub2 === subscriber : this.spillover.indexOf(subscriber) !== -1;
388
356
  }
389
357
  /**
390
358
  * Subscribes to notification of changes in an object's state.
@@ -393,27 +361,33 @@ class SubscriberSet {
393
361
 
394
362
 
395
363
  subscribe(subscriber) {
396
- if (this.has(subscriber)) {
397
- return;
398
- }
364
+ const spillover = this.spillover;
399
365
 
400
- if (this.sub1 === void 0) {
401
- this.sub1 = subscriber;
402
- return;
403
- }
366
+ if (spillover === void 0) {
367
+ if (this.has(subscriber)) {
368
+ return;
369
+ }
404
370
 
405
- if (this.sub2 === void 0) {
406
- this.sub2 = subscriber;
407
- return;
408
- }
371
+ if (this.sub1 === void 0) {
372
+ this.sub1 = subscriber;
373
+ return;
374
+ }
409
375
 
410
- this.spillover = [this.sub1, this.sub2, subscriber];
411
- this.subscribe = spilloverSubscribe;
412
- this.unsubscribe = spilloverUnsubscribe;
413
- this.notify = spilloverNotifySubscribers;
414
- this.has = spilloverHas;
415
- this.sub1 = void 0;
416
- this.sub2 = void 0;
376
+ if (this.sub2 === void 0) {
377
+ this.sub2 = subscriber;
378
+ return;
379
+ }
380
+
381
+ this.spillover = [this.sub1, this.sub2, subscriber];
382
+ this.sub1 = void 0;
383
+ this.sub2 = void 0;
384
+ } else {
385
+ const index = spillover.indexOf(subscriber);
386
+
387
+ if (index === -1) {
388
+ spillover.push(subscriber);
389
+ }
390
+ }
417
391
  }
418
392
  /**
419
393
  * Unsubscribes from notification of changes in an object's state.
@@ -422,10 +396,20 @@ class SubscriberSet {
422
396
 
423
397
 
424
398
  unsubscribe(subscriber) {
425
- if (this.sub1 === subscriber) {
426
- this.sub1 = void 0;
427
- } else if (this.sub2 === subscriber) {
428
- this.sub2 = void 0;
399
+ const spillover = this.spillover;
400
+
401
+ if (spillover === void 0) {
402
+ if (this.sub1 === subscriber) {
403
+ this.sub1 = void 0;
404
+ } else if (this.sub2 === subscriber) {
405
+ this.sub2 = void 0;
406
+ }
407
+ } else {
408
+ const index = spillover.indexOf(subscriber);
409
+
410
+ if (index !== -1) {
411
+ spillover.splice(index, 1);
412
+ }
429
413
  }
430
414
  }
431
415
  /**
@@ -435,16 +419,24 @@ class SubscriberSet {
435
419
 
436
420
 
437
421
  notify(args) {
438
- const sub1 = this.sub1;
439
- const sub2 = this.sub2;
422
+ const spillover = this.spillover;
440
423
  const source = this.source;
441
424
 
442
- if (sub1 !== void 0) {
443
- sub1.handleChange(source, args);
444
- }
425
+ if (spillover === void 0) {
426
+ const sub1 = this.sub1;
427
+ const sub2 = this.sub2;
428
+
429
+ if (sub1 !== void 0) {
430
+ sub1.handleChange(source, args);
431
+ }
445
432
 
446
- if (sub2 !== void 0) {
447
- sub2.handleChange(source, args);
433
+ if (sub2 !== void 0) {
434
+ sub2.handleChange(source, args);
435
+ }
436
+ } else {
437
+ for (let i = 0, ii = spillover.length; i < ii; ++i) {
438
+ spillover[i].handleChange(source, args);
439
+ }
448
440
  }
449
441
  }
450
442
 
@@ -677,6 +669,8 @@ const Observable = FAST.getById(2
677
669
  /* eslint-disable-next-line */
678
670
 
679
671
  prevValue = prev.propertySource[prev.propertyName];
672
+ /* eslint-disable-next-line @typescript-eslint/no-this-alias */
673
+
680
674
  watcher = this;
681
675
 
682
676
  if (propertySource === prevValue) {
@@ -1362,6 +1356,7 @@ class CompilationContext {
1362
1356
  }
1363
1357
 
1364
1358
  release() {
1359
+ /* eslint-disable-next-line @typescript-eslint/no-this-alias */
1365
1360
  sharedContext = this;
1366
1361
  }
1367
1362
 
@@ -1929,9 +1924,6 @@ function html(strings, ...values) {
1929
1924
  class ElementStyles {
1930
1925
  constructor() {
1931
1926
  this.targets = new WeakSet();
1932
- /** @internal */
1933
-
1934
- this.behaviors = null;
1935
1927
  }
1936
1928
  /** @internal */
1937
1929
 
@@ -3505,6 +3497,11 @@ class ArrayObserver extends SubscriberSet {
3505
3497
  });
3506
3498
  }
3507
3499
 
3500
+ subscribe(subscriber) {
3501
+ this.flush();
3502
+ super.subscribe(subscriber);
3503
+ }
3504
+
3508
3505
  addSplice(splice) {
3509
3506
  if (this.splices === void 0) {
3510
3507
  this.splices = [splice];
@@ -3864,37 +3861,54 @@ class RepeatBehavior {
3864
3861
  updateViews(splices) {
3865
3862
  const childContext = this.childContext;
3866
3863
  const views = this.views;
3867
- const totalRemoved = [];
3868
3864
  const bindView = this.bindView;
3869
- let removeDelta = 0;
3870
-
3871
- for (let i = 0, ii = splices.length; i < ii; ++i) {
3872
- const splice = splices[i];
3873
- const removed = splice.removed;
3874
- totalRemoved.push(...views.splice(splice.index + removeDelta, removed.length));
3875
- removeDelta -= splice.addedCount;
3876
- }
3877
-
3878
3865
  const items = this.items;
3879
3866
  const template = this.template;
3867
+ const recycle = this.options.recycle;
3868
+ const leftoverViews = [];
3869
+ let leftoverIndex = 0;
3870
+ let availableViews = 0;
3880
3871
 
3881
3872
  for (let i = 0, ii = splices.length; i < ii; ++i) {
3882
3873
  const splice = splices[i];
3874
+ const removed = splice.removed;
3875
+ let removeIndex = 0;
3883
3876
  let addIndex = splice.index;
3884
3877
  const end = addIndex + splice.addedCount;
3878
+ const removedViews = views.splice(splice.index, removed.length);
3879
+ availableViews = leftoverViews.length + removedViews.length;
3885
3880
 
3886
3881
  for (; addIndex < end; ++addIndex) {
3887
3882
  const neighbor = views[addIndex];
3888
3883
  const location = neighbor ? neighbor.firstChild : this.location;
3889
- const view = this.options.recycle && totalRemoved.length > 0 ? totalRemoved.shift() : template.create();
3884
+ let view;
3885
+
3886
+ if (recycle && availableViews > 0) {
3887
+ if (removeIndex <= availableViews && removedViews.length > 0) {
3888
+ view = removedViews[removeIndex];
3889
+ removeIndex++;
3890
+ } else {
3891
+ view = leftoverViews[leftoverIndex];
3892
+ leftoverIndex++;
3893
+ }
3894
+
3895
+ availableViews--;
3896
+ } else {
3897
+ view = template.create();
3898
+ }
3899
+
3890
3900
  views.splice(addIndex, 0, view);
3891
3901
  bindView(view, items, addIndex, childContext);
3892
3902
  view.insertBefore(location);
3893
3903
  }
3904
+
3905
+ if (removedViews[removeIndex]) {
3906
+ leftoverViews.push(...removedViews.slice(removeIndex));
3907
+ }
3894
3908
  }
3895
3909
 
3896
- for (let i = 0, ii = totalRemoved.length; i < ii; ++i) {
3897
- totalRemoved[i].dispose();
3910
+ for (let i = leftoverIndex, ii = leftoverViews.length; i < ii; ++i) {
3911
+ leftoverViews[i].dispose();
3898
3912
  }
3899
3913
 
3900
3914
  if (this.options.positioning) {
@@ -3916,7 +3930,7 @@ class RepeatBehavior {
3916
3930
  let views = this.views;
3917
3931
  let viewsLength = views.length;
3918
3932
 
3919
- if (itemsLength === 0 || templateChanged) {
3933
+ if (itemsLength === 0 || templateChanged || !this.options.recycle) {
3920
3934
  // all views need to be removed
3921
3935
  HTMLView.disposeContiguousBatch(views);
3922
3936
  viewsLength = 0;
@@ -4014,7 +4028,7 @@ class RepeatDirective extends HTMLDirective {
4014
4028
 
4015
4029
  function repeat(itemsBinding, templateOrTemplateBinding, options = defaultRepeatOptions) {
4016
4030
  const templateBinding = typeof templateOrTemplateBinding === "function" ? templateOrTemplateBinding : () => templateOrTemplateBinding;
4017
- return new RepeatDirective(itemsBinding, templateBinding, options);
4031
+ return new RepeatDirective(itemsBinding, templateBinding, Object.assign(Object.assign({}, defaultRepeatOptions), options));
4018
4032
  }
4019
4033
 
4020
4034
  /**
@@ -5951,6 +5965,22 @@ function applyMixins(derivedCtor, ...baseCtors) {
5951
5965
 
5952
5966
  /**
5953
5967
  * An individual item in an {@link @microsoft/fast-foundation#(Accordion:class) }.
5968
+ *
5969
+ * @slot start - Content which can be provided between the heading and the icon
5970
+ * @slot end - Content which can be provided between the start slot and icon
5971
+ * @slot heading - Content which serves as the accordion item heading and text of the expand button
5972
+ * @slot - The default slot for accordion item content
5973
+ * @slot expanded-icon - The expanded icon
5974
+ * @slot collapsed-icon - The collapsed icon
5975
+ * @fires change - Fires a custom 'change' event when the button is invoked
5976
+ * @csspart heading - Wraps the button
5977
+ * @csspart button - The button which serves to invoke the item
5978
+ * @csspart heading-content - Wraps the slot for the heading content within the button
5979
+ * @csspart icon - The icon container
5980
+ * @csspart expanded-icon - The expanded icon slot
5981
+ * @csspart collapsed-icon - The collapsed icon
5982
+ * @csspart region - The wrapper for the accordion item content
5983
+ *
5954
5984
  * @public
5955
5985
  */
5956
5986
 
@@ -6019,12 +6049,13 @@ html`<template><slot ${slotted({
6019
6049
  filter: elements()
6020
6050
  })}></slot><slot name="item" part="item" ${slotted("accordionItems")}></slot></template>`;
6021
6051
 
6022
- var Orientation;
6023
-
6024
- (function (Orientation) {
6025
- Orientation["horizontal"] = "horizontal";
6026
- Orientation["vertical"] = "vertical";
6027
- })(Orientation || (Orientation = {}));
6052
+ /**
6053
+ * Standard orientation values
6054
+ */
6055
+ const Orientation = {
6056
+ horizontal: "horizontal",
6057
+ vertical: "vertical"
6058
+ };
6028
6059
 
6029
6060
  /**
6030
6061
  * Returns the index of the last element in the array where predicate is true, and -1 otherwise.
@@ -6321,29 +6352,29 @@ var SystemColors;
6321
6352
  * @public
6322
6353
  */
6323
6354
 
6324
- var AccordionExpandMode;
6325
-
6326
- (function (AccordionExpandMode) {
6355
+ const AccordionExpandMode = {
6327
6356
  /**
6328
6357
  * Designates only a single {@link @microsoft/fast-foundation#(AccordionItem:class) } can be open a time.
6329
6358
  */
6330
- AccordionExpandMode["single"] = "single";
6359
+ single: "single",
6360
+
6331
6361
  /**
6332
6362
  * Designates multiple {@link @microsoft/fast-foundation#(AccordionItem:class) | AccordionItems} can be open simultaneously.
6333
6363
  */
6334
-
6335
- AccordionExpandMode["multi"] = "multi";
6336
- })(AccordionExpandMode || (AccordionExpandMode = {}));
6364
+ multi: "multi"
6365
+ };
6337
6366
  /**
6338
6367
  * An Accordion Custom HTML Element
6339
6368
  * Implements {@link https://www.w3.org/TR/wai-aria-practices-1.1/#accordion | ARIA Accordion}.
6369
+ *
6370
+ * @fires change - Fires a custom 'change' event when the active item changes
6371
+ * @csspart item - The slot for the accordion items
6340
6372
  * @public
6341
6373
  *
6342
6374
  * @remarks
6343
6375
  * Designed to be used with {@link @microsoft/fast-foundation#accordionTemplate} and {@link @microsoft/fast-foundation#(AccordionItem:class)}.
6344
6376
  */
6345
6377
 
6346
-
6347
6378
  class Accordion extends FoundationElement {
6348
6379
  constructor() {
6349
6380
  super(...arguments);
@@ -6402,6 +6433,11 @@ class Accordion extends FoundationElement {
6402
6433
  };
6403
6434
 
6404
6435
  this.activeItemChange = event => {
6436
+ if (event.defaultPrevented || event.target !== event.currentTarget) {
6437
+ return;
6438
+ }
6439
+
6440
+ event.preventDefault();
6405
6441
  const selectedItem = event.target;
6406
6442
  this.activeid = selectedItem.getAttribute("id");
6407
6443
 
@@ -6624,6 +6660,12 @@ __decorate$1([attr({
6624
6660
  * An Anchor Custom HTML Element.
6625
6661
  * Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element }.
6626
6662
  *
6663
+ * @slot start - Content which can be provided before the anchor content
6664
+ * @slot end - Content which can be provided after the anchor content
6665
+ * @slot - The default slot for anchor content
6666
+ * @csspart control - The anchor element
6667
+ * @csspart content - The element wrapping anchor content
6668
+ *
6627
6669
  * @public
6628
6670
  */
6629
6671
 
@@ -6825,6 +6867,10 @@ class IntersectionService {
6825
6867
  /**
6826
6868
  * An anchored region Custom HTML Element.
6827
6869
  *
6870
+ * @slot - The default slot for the content
6871
+ * @fires loaded - Fires a custom 'loaded' event when the region is loaded and visible
6872
+ * @fires positionchange - Fires a custom 'positionchange' event when the position has changed
6873
+ *
6828
6874
  * @public
6829
6875
  */
6830
6876
 
@@ -7357,7 +7403,7 @@ class AnchoredRegion extends FoundationElement {
7357
7403
  switch (this.horizontalScaling) {
7358
7404
  case "anchor":
7359
7405
  case "fill":
7360
- nextRegionWidth = nextPositionerDimension.width;
7406
+ nextRegionWidth = this.horizontalViewportLock ? this.viewportRect.width : nextPositionerDimension.width;
7361
7407
  this.regionWidth = `${nextRegionWidth}px`;
7362
7408
  break;
7363
7409
 
@@ -7441,7 +7487,7 @@ class AnchoredRegion extends FoundationElement {
7441
7487
  switch (this.verticalScaling) {
7442
7488
  case "anchor":
7443
7489
  case "fill":
7444
- nextRegionHeight = nextPositionerDimension.height;
7490
+ nextRegionHeight = this.verticalViewportLock ? this.viewportRect.height : nextPositionerDimension.height;
7445
7491
  this.regionHeight = `${nextRegionHeight}px`;
7446
7492
  break;
7447
7493
 
@@ -7894,6 +7940,8 @@ const badgeTemplate = (context, definition) => html`<template class="${x => x.ci
7894
7940
 
7895
7941
  /**
7896
7942
  * A Badge Custom HTML Element.
7943
+ * @slot - The default slot for the badge
7944
+ * @csspart control - The element representing the badge, which wraps the default slot
7897
7945
  *
7898
7946
  * @public
7899
7947
  */
@@ -7975,6 +8023,8 @@ const breadcrumbTemplate = (context, definition) => html`<template role="navigat
7975
8023
 
7976
8024
  /**
7977
8025
  * A Breadcrumb Custom HTML Element.
8026
+ * @slot - The default slot for the breadcrumb items
8027
+ * @csspart list - The element wrapping the slotted items
7978
8028
  *
7979
8029
  * @public
7980
8030
  */
@@ -8422,15 +8472,12 @@ function FormAssociated(BaseCtor) {
8422
8472
  this.removeChild(this.proxy);
8423
8473
  (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.removeChild(this.proxySlot);
8424
8474
  }
8425
- /**
8426
- * Sets the validity of the custom element. By default this uses the proxy element to determine
8427
- * validity, but this can be extended or replaced in implementation.
8428
- */
8475
+ /** {@inheritDoc (FormAssociated:interface).validate} */
8429
8476
 
8430
8477
 
8431
- validate() {
8478
+ validate(anchor) {
8432
8479
  if (this.proxy instanceof HTMLElement) {
8433
- this.setValidity(this.proxy.validity, this.proxy.validationMessage);
8480
+ this.setValidity(this.proxy.validity, this.proxy.validationMessage, anchor);
8434
8481
  }
8435
8482
  }
8436
8483
  /**
@@ -8617,6 +8664,12 @@ class FormAssociatedButton extends FormAssociated(_Button) {
8617
8664
  * A Button Custom HTML Element.
8618
8665
  * Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element }.
8619
8666
  *
8667
+ * @slot start - Content which can be provided before the button content
8668
+ * @slot end - Content which can be provided after the button content
8669
+ * @slot - The default slot for button content
8670
+ * @csspart control - The button element
8671
+ * @csspart content - The element wrapping button content
8672
+ *
8620
8673
  * @public
8621
8674
  */
8622
8675
 
@@ -8728,6 +8781,12 @@ class Button$1 extends FormAssociatedButton {
8728
8781
  next === "reset" && this.addEventListener("click", this.handleFormReset);
8729
8782
  previous === "reset" && this.removeEventListener("click", this.handleFormReset);
8730
8783
  }
8784
+ /** {@inheritDoc (FormAssociated:interface).validate} */
8785
+
8786
+
8787
+ validate() {
8788
+ super.validate(this.control);
8789
+ }
8731
8790
  /**
8732
8791
  * @internal
8733
8792
  */
@@ -9000,6 +9059,10 @@ class DateFormatter {
9000
9059
 
9001
9060
  /**
9002
9061
  * Calendar component
9062
+ *
9063
+ * @slot - The default slot for calendar content
9064
+ * @fires dateselected - Fires a custom 'dateselected' event when Enter is invoked via keyboard on a date
9065
+ *
9003
9066
  * @public
9004
9067
  */
9005
9068
 
@@ -9326,50 +9389,44 @@ __decorate$1([attr({
9326
9389
  })], Calendar$1.prototype, "selectedDates", void 0);
9327
9390
 
9328
9391
  /**
9329
- * Enumerates auto generated header options
9392
+ * Enumerates the data grid auto generated header options
9330
9393
  * default option generates a non-sticky header row
9331
9394
  *
9332
9395
  * @public
9333
9396
  */
9334
- var GenerateHeaderOptions;
9335
-
9336
- (function (GenerateHeaderOptions) {
9337
- GenerateHeaderOptions["none"] = "none";
9338
- GenerateHeaderOptions["default"] = "default";
9339
- GenerateHeaderOptions["sticky"] = "sticky";
9340
- })(GenerateHeaderOptions || (GenerateHeaderOptions = {}));
9397
+ const GenerateHeaderOptions = {
9398
+ none: "none",
9399
+ default: "default",
9400
+ sticky: "sticky"
9401
+ };
9341
9402
  /**
9342
- * Enumerates possible cell types.
9403
+ * Enumerates possible data grid cell types.
9343
9404
  *
9344
9405
  * @public
9345
9406
  */
9346
9407
 
9347
-
9348
- var DataGridCellTypes;
9349
-
9350
- (function (DataGridCellTypes) {
9351
- DataGridCellTypes["default"] = "default";
9352
- DataGridCellTypes["columnHeader"] = "columnheader";
9353
- DataGridCellTypes["rowHeader"] = "rowheader";
9354
- })(DataGridCellTypes || (DataGridCellTypes = {}));
9408
+ const DataGridCellTypes = {
9409
+ default: "default",
9410
+ columnHeader: "columnheader",
9411
+ rowHeader: "rowheader"
9412
+ };
9355
9413
  /**
9356
- * Enumerates possible row types
9414
+ * Enumerates possible data grid row types
9357
9415
  *
9358
9416
  * @public
9359
9417
  */
9360
9418
 
9361
-
9362
- var DataGridRowTypes;
9363
-
9364
- (function (DataGridRowTypes) {
9365
- DataGridRowTypes["default"] = "default";
9366
- DataGridRowTypes["header"] = "header";
9367
- DataGridRowTypes["stickyHeader"] = "sticky-header";
9368
- })(DataGridRowTypes || (DataGridRowTypes = {}));
9419
+ const DataGridRowTypes = {
9420
+ default: "default",
9421
+ header: "header",
9422
+ stickyHeader: "sticky-header"
9423
+ };
9369
9424
 
9370
9425
  /**
9371
9426
  * A Data Grid Row Custom HTML Element.
9372
9427
  *
9428
+ * @fires row-focused - Fires a custom 'row-focused' event when focus is on an element (usually a cell or its contents) in the row
9429
+ * @slot - The default slot for custom cell elements
9373
9430
  * @public
9374
9431
  */
9375
9432
 
@@ -9605,6 +9662,7 @@ const dataGridTemplate = (context, definition) => {
9605
9662
  /**
9606
9663
  * A Data Grid Custom HTML Element.
9607
9664
  *
9665
+ * @slot - The default slot for custom row elements
9608
9666
  * @public
9609
9667
  */
9610
9668
 
@@ -10103,6 +10161,8 @@ const defaultHeaderCellContentsTemplate = html`<template>${x => x.columnDefiniti
10103
10161
  /**
10104
10162
  * A Data Grid Cell Custom HTML Element.
10105
10163
  *
10164
+ * @fires cell-focused - Fires a custom 'cell-focused' event when focus is on the cell or its contents
10165
+ * @slot - The default slot for cell contents. The "cell contents template" renders here.
10106
10166
  * @public
10107
10167
  */
10108
10168
 
@@ -10473,6 +10533,8 @@ const cardTemplate = (context, definition) => html`<slot></slot>`;
10473
10533
  /**
10474
10534
  * An Card Custom HTML Element.
10475
10535
  *
10536
+ * @slot - The default slot for the card content
10537
+ *
10476
10538
  * @public
10477
10539
  */
10478
10540
 
@@ -10505,6 +10567,13 @@ class FormAssociatedCheckbox extends CheckableFormAssociated(_Checkbox) {
10505
10567
  * A Checkbox Custom HTML Element.
10506
10568
  * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#checkbox | ARIA checkbox }.
10507
10569
  *
10570
+ * @slot checked-indicator - The checked indicator
10571
+ * @slot indeterminate-indicator - The indeterminate indicator
10572
+ * @slot - The default slot for the label
10573
+ * @csspart control - The element representing the visual checkbox control
10574
+ * @csspart label - The label
10575
+ * @fires change - Emits a custom change event when the checked state changes
10576
+ *
10508
10577
  * @public
10509
10578
  */
10510
10579
 
@@ -10529,8 +10598,16 @@ class Checkbox extends FormAssociatedCheckbox {
10529
10598
  */
10530
10599
 
10531
10600
  this.keypressHandler = e => {
10601
+ if (this.readOnly) {
10602
+ return;
10603
+ }
10604
+
10532
10605
  switch (e.key) {
10533
10606
  case keySpace:
10607
+ if (this.indeterminate) {
10608
+ this.indeterminate = false;
10609
+ }
10610
+
10534
10611
  this.checked = !this.checked;
10535
10612
  break;
10536
10613
  }
@@ -10542,6 +10619,10 @@ class Checkbox extends FormAssociatedCheckbox {
10542
10619
 
10543
10620
  this.clickHandler = e => {
10544
10621
  if (!this.disabled && !this.readOnly) {
10622
+ if (this.indeterminate) {
10623
+ this.indeterminate = false;
10624
+ }
10625
+
10545
10626
  this.checked = !this.checked;
10546
10627
  }
10547
10628
  };
@@ -10580,6 +10661,11 @@ function isListboxOption(el) {
10580
10661
  * An Option Custom HTML Element.
10581
10662
  * Implements {@link https://www.w3.org/TR/wai-aria-1.1/#option | ARIA option }.
10582
10663
  *
10664
+ * @slot start - Content which can be provided before the listbox option content
10665
+ * @slot end - Content which can be provided after the listbox option content
10666
+ * @slot - The default slot for listbox option content
10667
+ * @csspart content - Wraps the listbox option content
10668
+ *
10583
10669
  * @public
10584
10670
  */
10585
10671
 
@@ -10646,7 +10732,25 @@ class ListboxOption extends FoundationElement {
10646
10732
  return;
10647
10733
  }
10648
10734
 
10649
- this.ariaChecked = undefined;
10735
+ this.ariaChecked = null;
10736
+ }
10737
+ /**
10738
+ * Updates the proxy's text content when the default slot changes.
10739
+ * @param prev - the previous content value
10740
+ * @param next - the current content value
10741
+ *
10742
+ * @internal
10743
+ */
10744
+
10745
+
10746
+ contentChanged(prev, next) {
10747
+ if (this.proxy instanceof HTMLOptionElement) {
10748
+ this.proxy.textContent = this.textContent;
10749
+ }
10750
+
10751
+ this.$emit("contentchange", null, {
10752
+ bubbles: true
10753
+ });
10650
10754
  }
10651
10755
 
10652
10756
  defaultSelectedChanged() {
@@ -10697,31 +10801,34 @@ class ListboxOption extends FoundationElement {
10697
10801
  }
10698
10802
 
10699
10803
  get label() {
10700
- var _a, _b;
10804
+ var _a;
10701
10805
 
10702
- return (_b = (_a = this.value) !== null && _a !== void 0 ? _a : this.textContent) !== null && _b !== void 0 ? _b : "";
10806
+ return (_a = this.value) !== null && _a !== void 0 ? _a : this.text;
10703
10807
  }
10704
10808
 
10705
10809
  get text() {
10706
- return this.textContent;
10810
+ var _a, _b;
10811
+
10812
+ return (_b = (_a = this.textContent) === null || _a === void 0 ? void 0 : _a.replace(/\s+/g, " ").trim()) !== null && _b !== void 0 ? _b : "";
10707
10813
  }
10708
10814
 
10709
10815
  set value(next) {
10710
- this._value = next;
10816
+ const newValue = `${next !== null && next !== void 0 ? next : ""}`;
10817
+ this._value = newValue;
10711
10818
  this.dirtyValue = true;
10712
10819
 
10713
- if (this.proxy instanceof HTMLElement) {
10714
- this.proxy.value = next;
10820
+ if (this.proxy instanceof HTMLOptionElement) {
10821
+ this.proxy.value = newValue;
10715
10822
  }
10716
10823
 
10717
10824
  Observable.notify(this, "value");
10718
10825
  }
10719
10826
 
10720
10827
  get value() {
10721
- var _a, _b;
10828
+ var _a;
10722
10829
 
10723
10830
  Observable.track(this, "value");
10724
- return (_b = (_a = this._value) !== null && _a !== void 0 ? _a : this.textContent) !== null && _b !== void 0 ? _b : "";
10831
+ return (_a = this._value) !== null && _a !== void 0 ? _a : this.text;
10725
10832
  }
10726
10833
 
10727
10834
  get form() {
@@ -10732,6 +10839,8 @@ class ListboxOption extends FoundationElement {
10732
10839
 
10733
10840
  __decorate$1([observable], ListboxOption.prototype, "checked", void 0);
10734
10841
 
10842
+ __decorate$1([observable], ListboxOption.prototype, "content", void 0);
10843
+
10735
10844
  __decorate$1([observable], ListboxOption.prototype, "defaultSelected", void 0);
10736
10845
 
10737
10846
  __decorate$1([attr({
@@ -10773,6 +10882,8 @@ applyMixins(ListboxOption, StartEnd, DelegatesARIAListboxOption);
10773
10882
  * A Listbox Custom HTML Element.
10774
10883
  * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#listbox | ARIA listbox }.
10775
10884
  *
10885
+ * @slot - The default slot for the listbox options
10886
+ *
10776
10887
  * @public
10777
10888
  */
10778
10889
 
@@ -11140,6 +11251,19 @@ class Listbox$1 extends FoundationElement {
11140
11251
  this.shouldSkipFocus = !this.contains(document.activeElement);
11141
11252
  return true;
11142
11253
  }
11254
+ /**
11255
+ * Switches between single-selection and multi-selection mode.
11256
+ *
11257
+ * @param prev - the previous value of the `multiple` attribute
11258
+ * @param next - the next value of the `multiple` attribute
11259
+ *
11260
+ * @internal
11261
+ */
11262
+
11263
+
11264
+ multipleChanged(prev, next) {
11265
+ this.ariaMultiSelectable = next ? "true" : null;
11266
+ }
11143
11267
  /**
11144
11268
  * Updates the list of selected options when the `selectedIndex` changes.
11145
11269
  *
@@ -11338,7 +11462,7 @@ class Listbox$1 extends FoundationElement {
11338
11462
  * @public
11339
11463
  */
11340
11464
 
11341
- Listbox$1.slottedOptionFilter = n => isListboxOption(n) && !n.disabled && !n.hidden;
11465
+ Listbox$1.slottedOptionFilter = n => isListboxOption(n) && !n.hidden;
11342
11466
  /**
11343
11467
  * Typeahead timeout in milliseconds.
11344
11468
  *
@@ -11383,12 +11507,10 @@ applyMixins(Listbox$1, DelegatesARIAListbox);
11383
11507
  * Positioning directions for the listbox when a select is open.
11384
11508
  * @public
11385
11509
  */
11386
- var SelectPosition;
11387
-
11388
- (function (SelectPosition) {
11389
- SelectPosition["above"] = "above";
11390
- SelectPosition["below"] = "below";
11391
- })(SelectPosition || (SelectPosition = {}));
11510
+ const SelectPosition = {
11511
+ above: "above",
11512
+ below: "below"
11513
+ };
11392
11514
 
11393
11515
  class _Combobox extends Listbox$1 {}
11394
11516
  /**
@@ -11410,19 +11532,28 @@ class FormAssociatedCombobox extends FormAssociated(_Combobox) {
11410
11532
  * Autocomplete values for combobox.
11411
11533
  * @public
11412
11534
  */
11413
- var ComboboxAutocomplete;
11414
-
11415
- (function (ComboboxAutocomplete) {
11416
- ComboboxAutocomplete["inline"] = "inline";
11417
- ComboboxAutocomplete["list"] = "list";
11418
- ComboboxAutocomplete["both"] = "both";
11419
- ComboboxAutocomplete["none"] = "none";
11420
- })(ComboboxAutocomplete || (ComboboxAutocomplete = {}));
11535
+ const ComboboxAutocomplete = {
11536
+ inline: "inline",
11537
+ list: "list",
11538
+ both: "both",
11539
+ none: "none"
11540
+ };
11421
11541
 
11422
11542
  /**
11423
11543
  * A Combobox Custom HTML Element.
11424
11544
  * Implements the {@link https://w3c.github.io/aria-practices/#combobox | ARIA combobox }.
11425
11545
  *
11546
+ * @slot start - Content which can be provided before the input
11547
+ * @slot end - Content which can be provided after the input
11548
+ * @slot control - Used to replace the input element representing the combobox
11549
+ * @slot indicator - The visual indicator representing the expanded state
11550
+ * @slot - The default slot for the options
11551
+ * @csspart control - The wrapper element containing the input area, including start and end
11552
+ * @csspart selected-value - The input element representing the selected value
11553
+ * @csspart indicator - The element wrapping the indicator slot
11554
+ * @csspart listbox - The wrapper for the listbox slotted options
11555
+ * @fires change - Fires a custom 'change' event when the value updates
11556
+ *
11426
11557
  * @public
11427
11558
  */
11428
11559
 
@@ -11480,13 +11611,6 @@ class Combobox$1 extends FormAssociatedCombobox {
11480
11611
  */
11481
11612
 
11482
11613
  this.open = false;
11483
- /**
11484
- * The current state of the calculated position of the listbox.
11485
- *
11486
- * @public
11487
- */
11488
-
11489
- this.position = SelectPosition.below;
11490
11614
  }
11491
11615
  /**
11492
11616
  * Reset the element to its first selectable option when its parent form is reset.
@@ -11500,6 +11624,12 @@ class Combobox$1 extends FormAssociatedCombobox {
11500
11624
  this.setDefaultSelectedOption();
11501
11625
  this.updateValue();
11502
11626
  }
11627
+ /** {@inheritDoc (FormAssociated:interface).validate} */
11628
+
11629
+
11630
+ validate() {
11631
+ super.validate(this.control);
11632
+ }
11503
11633
 
11504
11634
  get isAutocompleteInline() {
11505
11635
  return this.autocomplete === ComboboxAutocomplete.inline || this.isAutocompleteBoth;
@@ -11566,8 +11696,8 @@ class Combobox$1 extends FormAssociatedCombobox {
11566
11696
  }
11567
11697
  }
11568
11698
 
11569
- positionChanged() {
11570
- this.positionAttribute = this.position;
11699
+ positionChanged(prev, next) {
11700
+ this.positionAttribute = next;
11571
11701
  this.setPositioning();
11572
11702
  }
11573
11703
  /**
@@ -11623,6 +11753,7 @@ class Combobox$1 extends FormAssociatedCombobox {
11623
11753
 
11624
11754
  this.selectedOptions = [captured];
11625
11755
  this.control.value = captured.text;
11756
+ this.clearSelectionRange();
11626
11757
  this.updateValue(true);
11627
11758
  }
11628
11759
 
@@ -11718,7 +11849,7 @@ class Combobox$1 extends FormAssociatedCombobox {
11718
11849
 
11719
11850
 
11720
11851
  focusoutHandler(e) {
11721
- this.updateValue();
11852
+ this.syncValue();
11722
11853
 
11723
11854
  if (!this.open) {
11724
11855
  return true;
@@ -11747,7 +11878,11 @@ class Combobox$1 extends FormAssociatedCombobox {
11747
11878
  this.filter = this.control.value;
11748
11879
  this.filterOptions();
11749
11880
 
11750
- if (e.inputType === "deleteContentBackward" || !this.filter.length) {
11881
+ if (!this.isAutocompleteInline) {
11882
+ this.selectedIndex = this.options.map(option => option.text).indexOf(this.control.value);
11883
+ }
11884
+
11885
+ if (e.inputType.includes("deleteContent") || !this.filter.length) {
11751
11886
  return true;
11752
11887
  }
11753
11888
 
@@ -11755,10 +11890,14 @@ class Combobox$1 extends FormAssociatedCombobox {
11755
11890
  this.open = true;
11756
11891
  }
11757
11892
 
11758
- if (this.isAutocompleteInline && this.filteredOptions.length) {
11759
- this.selectedOptions = [this.filteredOptions[0]];
11760
- this.selectedIndex = this.options.indexOf(this.firstSelectedOption);
11761
- this.setInlineSelection();
11893
+ if (this.isAutocompleteInline) {
11894
+ if (this.filteredOptions.length) {
11895
+ this.selectedOptions = [this.filteredOptions[0]];
11896
+ this.selectedIndex = this.options.indexOf(this.firstSelectedOption);
11897
+ this.setInlineSelection();
11898
+ } else {
11899
+ this.selectedIndex = -1;
11900
+ }
11762
11901
  }
11763
11902
 
11764
11903
  return;
@@ -11781,15 +11920,14 @@ class Combobox$1 extends FormAssociatedCombobox {
11781
11920
  switch (key) {
11782
11921
  case "Enter":
11783
11922
  {
11784
- this.updateValue(true);
11923
+ this.syncValue();
11785
11924
 
11786
11925
  if (this.isAutocompleteInline) {
11787
11926
  this.filter = this.value;
11788
11927
  }
11789
11928
 
11790
11929
  this.open = false;
11791
- const controlValueLength = this.control.value.length;
11792
- this.control.setSelectionRange(controlValueLength, controlValueLength);
11930
+ this.clearSelectionRange();
11793
11931
  break;
11794
11932
  }
11795
11933
 
@@ -11813,7 +11951,7 @@ class Combobox$1 extends FormAssociatedCombobox {
11813
11951
 
11814
11952
  case "Tab":
11815
11953
  {
11816
- this.updateValue();
11954
+ this.setInputToSelection();
11817
11955
 
11818
11956
  if (!this.open) {
11819
11957
  return true;
@@ -11839,7 +11977,6 @@ class Combobox$1 extends FormAssociatedCombobox {
11839
11977
  }
11840
11978
 
11841
11979
  if (this.isAutocompleteInline) {
11842
- this.updateValue();
11843
11980
  this.setInlineSelection();
11844
11981
  }
11845
11982
 
@@ -11936,20 +12073,44 @@ class Combobox$1 extends FormAssociatedCombobox {
11936
12073
  }
11937
12074
  }
11938
12075
  /**
11939
- * Focus and select the content of the control based on the first selected option.
12076
+ * Focus and set the content of the control based on the first selected option.
11940
12077
  *
11941
- * @param start - The index for the starting range
11942
12078
  * @internal
11943
12079
  */
11944
12080
 
11945
12081
 
11946
- setInlineSelection() {
12082
+ setInputToSelection() {
11947
12083
  if (this.firstSelectedOption) {
11948
12084
  this.control.value = this.firstSelectedOption.text;
11949
12085
  this.control.focus();
12086
+ }
12087
+ }
12088
+ /**
12089
+ * Focus, set and select the content of the control based on the first selected option.
12090
+ *
12091
+ * @internal
12092
+ */
12093
+
12094
+
12095
+ setInlineSelection() {
12096
+ if (this.firstSelectedOption) {
12097
+ this.setInputToSelection();
11950
12098
  this.control.setSelectionRange(this.filter.length, this.control.value.length, "backward");
11951
12099
  }
11952
12100
  }
12101
+ /**
12102
+ * Determines if a value update should involve emitting a change event, then updates the value.
12103
+ *
12104
+ * @internal
12105
+ */
12106
+
12107
+
12108
+ syncValue() {
12109
+ var _a;
12110
+
12111
+ const newValue = this.selectedIndex > -1 ? (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text : this.control.value;
12112
+ this.updateValue(this.value !== newValue);
12113
+ }
11953
12114
  /**
11954
12115
  * Calculate and apply listbox positioning based on available viewport space.
11955
12116
  *
@@ -12013,12 +12174,22 @@ class Combobox$1 extends FormAssociatedCombobox {
12013
12174
 
12014
12175
  if (this.$fastController.isConnected) {
12015
12176
  this.value = ((_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text) || this.control.value;
12177
+ this.control.value = this.value;
12016
12178
  }
12017
12179
 
12018
12180
  if (shouldEmit) {
12019
12181
  this.$emit("change");
12020
12182
  }
12021
12183
  }
12184
+ /**
12185
+ * @internal
12186
+ */
12187
+
12188
+
12189
+ clearSelectionRange() {
12190
+ const controlValueLength = this.control.value.length;
12191
+ this.control.setSelectionRange(controlValueLength, controlValueLength);
12192
+ }
12022
12193
 
12023
12194
  }
12024
12195
 
@@ -13586,6 +13757,13 @@ var isFocusable = function isFocusable(node, options) {
13586
13757
  * A Switch Custom HTML Element.
13587
13758
  * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#dialog | ARIA dialog }.
13588
13759
  *
13760
+ * @slot - The default slot for the dialog content
13761
+ * @csspart positioning-region - A wrapping element used to center the dialog and position the modal overlay
13762
+ * @csspart overlay - The modal dialog overlay
13763
+ * @csspart control - The dialog element
13764
+ * @fires cancel - Fires a custom 'cancel' event when the modal overlay is clicked
13765
+ * @fires close - Fires a custom 'close' event when the dialog is hidden
13766
+ *
13589
13767
  * @public
13590
13768
  */
13591
13769
 
@@ -13912,19 +14090,17 @@ const dividerTemplate = (context, definition) => html`<template role="${x => x.r
13912
14090
  * Divider roles
13913
14091
  * @public
13914
14092
  */
13915
- var DividerRole;
13916
-
13917
- (function (DividerRole) {
14093
+ const DividerRole = {
13918
14094
  /**
13919
14095
  * The divider semantically separates content
13920
14096
  */
13921
- DividerRole["separator"] = "separator";
14097
+ separator: "separator",
14098
+
13922
14099
  /**
13923
14100
  * The divider has no semantic value and is for visual presentation only.
13924
14101
  */
13925
-
13926
- DividerRole["presentation"] = "presentation";
13927
- })(DividerRole || (DividerRole = {}));
14102
+ presentation: "presentation"
14103
+ };
13928
14104
 
13929
14105
  /**
13930
14106
  * A Divider Custom HTML Element.
@@ -13940,7 +14116,6 @@ class Divider extends FoundationElement {
13940
14116
  * The role of the element.
13941
14117
  *
13942
14118
  * @public
13943
- * @defaultValue - {@link DividerRole.separator}
13944
14119
  * @remarks
13945
14120
  * HTML Attribute: role
13946
14121
  */
@@ -13967,12 +14142,10 @@ __decorate$1([attr], Divider.prototype, "orientation", void 0);
13967
14142
  * The direction options for flipper.
13968
14143
  * @public
13969
14144
  */
13970
- var FlipperDirection;
13971
-
13972
- (function (FlipperDirection) {
13973
- FlipperDirection["next"] = "next";
13974
- FlipperDirection["previous"] = "previous";
13975
- })(FlipperDirection || (FlipperDirection = {}));
14145
+ const FlipperDirection = {
14146
+ next: "next",
14147
+ previous: "previous"
14148
+ };
13976
14149
 
13977
14150
  /**
13978
14151
  * The template for the {@link @microsoft/fast-foundation#Flipper} component.
@@ -13985,6 +14158,12 @@ const flipperTemplate = (context, definition) => html`<template role="button" ar
13985
14158
  * A Flipper Custom HTML Element.
13986
14159
  * Flippers are a form of button that implies directional content navigation, such as in a carousel.
13987
14160
  *
14161
+ * @slot next - The next flipper content
14162
+ * @slot previous - The previous flipper content
14163
+ * @csspart next - Wraps the next flipper content
14164
+ * @csspart previous - Wraps the previous flipper content
14165
+ * @fires click - Fires a custom 'click' event when Enter or Space is invoked via keyboard and the flipper is exposed to assistive technologies.
14166
+ *
13988
14167
  * @public
13989
14168
  */
13990
14169
 
@@ -14023,7 +14202,7 @@ class Flipper extends FoundationElement {
14023
14202
  if (!this.hiddenFromAT) {
14024
14203
  const key = e.key;
14025
14204
 
14026
- if (key === "Enter") {
14205
+ if (key === "Enter" || key === "Space") {
14027
14206
  this.$emit("click", e);
14028
14207
  }
14029
14208
 
@@ -14051,7 +14230,7 @@ __decorate$1([attr], Flipper.prototype, "direction", void 0);
14051
14230
  * @public
14052
14231
  */
14053
14232
 
14054
- const listboxOptionTemplate = (context, definition) => html`<template aria-checked="${x => x.ariaChecked}" aria-disabled="${x => x.ariaDisabled}" aria-posinset="${x => x.ariaPosInSet}" aria-selected="${x => x.ariaSelected}" aria-setsize="${x => x.ariaSetSize}" class="${x => [x.checked && "checked", x.selected && "selected", x.disabled && "disabled"].filter(Boolean).join(" ")}" role="option">${startSlotTemplate(context, definition)}<span class="content" part="content"><slot></slot></span>${endSlotTemplate(context, definition)}</template>`;
14233
+ const listboxOptionTemplate = (context, definition) => html`<template aria-checked="${x => x.ariaChecked}" aria-disabled="${x => x.ariaDisabled}" aria-posinset="${x => x.ariaPosInSet}" aria-selected="${x => x.ariaSelected}" aria-setsize="${x => x.ariaSetSize}" class="${x => [x.checked && "checked", x.selected && "selected", x.disabled && "disabled"].filter(Boolean).join(" ")}" role="option">${startSlotTemplate(context, definition)}<span class="content" part="content"><slot ${slotted("content")}></slot></span>${endSlotTemplate(context, definition)}</template>`;
14055
14234
 
14056
14235
  /**
14057
14236
  * A Listbox Custom HTML Element.
@@ -14475,7 +14654,7 @@ class ListboxElement extends Listbox$1 {
14475
14654
  multipleChanged(prev, next) {
14476
14655
  var _a;
14477
14656
 
14478
- this.ariaMultiSelectable = next ? "true" : undefined;
14657
+ this.ariaMultiSelectable = next ? "true" : null;
14479
14658
  (_a = this.options) === null || _a === void 0 ? void 0 : _a.forEach(o => {
14480
14659
  o.checked = next ? false : undefined;
14481
14660
  });
@@ -14609,29 +14788,26 @@ const listboxTemplate = (context, definition) => html`<template aria-activedesce
14609
14788
  * Menu items roles.
14610
14789
  * @public
14611
14790
  */
14612
- var MenuItemRole;
14613
-
14614
- (function (MenuItemRole) {
14791
+ const MenuItemRole = {
14615
14792
  /**
14616
14793
  * The menu item has a "menuitem" role
14617
14794
  */
14618
- MenuItemRole["menuitem"] = "menuitem";
14795
+ menuitem: "menuitem",
14796
+
14619
14797
  /**
14620
14798
  * The menu item has a "menuitemcheckbox" role
14621
14799
  */
14800
+ menuitemcheckbox: "menuitemcheckbox",
14622
14801
 
14623
- MenuItemRole["menuitemcheckbox"] = "menuitemcheckbox";
14624
14802
  /**
14625
14803
  * The menu item has a "menuitemradio" role
14626
14804
  */
14627
-
14628
- MenuItemRole["menuitemradio"] = "menuitemradio";
14629
- })(MenuItemRole || (MenuItemRole = {}));
14805
+ menuitemradio: "menuitemradio"
14806
+ };
14630
14807
  /**
14631
14808
  * @internal
14632
14809
  */
14633
14810
 
14634
-
14635
14811
  const roleForMenuItem = {
14636
14812
  [MenuItemRole.menuitem]: "menuitem",
14637
14813
  [MenuItemRole.menuitemcheckbox]: "menuitemcheckbox",
@@ -14642,6 +14818,23 @@ const roleForMenuItem = {
14642
14818
  * A Switch Custom HTML Element.
14643
14819
  * Implements {@link https://www.w3.org/TR/wai-aria-1.1/#menuitem | ARIA menuitem }, {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemcheckbox | ARIA menuitemcheckbox}, or {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemradio | ARIA menuitemradio }.
14644
14820
  *
14821
+ * @slot checked-indicator - The checked indicator
14822
+ * @slot radio-indicator - The radio indicator
14823
+ * @slot start - Content which can be provided before the menu item content
14824
+ * @slot end - Content which can be provided after the menu item content
14825
+ * @slot - The default slot for menu item content
14826
+ * @slot expand-collapse-indicator - The expand/collapse indicator
14827
+ * @slot submenu - Used to nest menu's within menu items
14828
+ * @csspart input-container - The element representing the visual checked or radio indicator
14829
+ * @csspart checkbox - The element wrapping the `menuitemcheckbox` indicator
14830
+ * @csspart radio - The element wrapping the `menuitemradio` indicator
14831
+ * @csspart content - The element wrapping the menu item content
14832
+ * @csspart expand-collapse-glyph-container - The element wrapping the expand collapse element
14833
+ * @csspart expand-collapse - The expand/collapse element
14834
+ * @csspart submenu-region - The container for the submenu, used for positioning
14835
+ * @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
14836
+ * @fires change - Fires a custom 'change' event when a non-submenu item with a role of `menuitemcheckbox`, `menuitemradio`, or `menuitem` is invoked
14837
+ *
14645
14838
  * @public
14646
14839
  */
14647
14840
 
@@ -14932,6 +15125,8 @@ const menuTemplate = (context, definition) => html`<template slot="${x => x.slot
14932
15125
  * A Menu Custom HTML Element.
14933
15126
  * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#menu | ARIA menu }.
14934
15127
  *
15128
+ * @slot - The default slot for the menu items
15129
+ *
14935
15130
  * @public
14936
15131
  */
14937
15132
 
@@ -15280,39 +15475,45 @@ class FormAssociatedTextField extends FormAssociated(_TextField) {
15280
15475
  * Text field sub-types
15281
15476
  * @public
15282
15477
  */
15283
- var TextFieldType;
15284
-
15285
- (function (TextFieldType) {
15478
+ const TextFieldType = {
15286
15479
  /**
15287
15480
  * An email TextField
15288
15481
  */
15289
- TextFieldType["email"] = "email";
15482
+ email: "email",
15483
+
15290
15484
  /**
15291
15485
  * A password TextField
15292
15486
  */
15487
+ password: "password",
15293
15488
 
15294
- TextFieldType["password"] = "password";
15295
15489
  /**
15296
15490
  * A telephone TextField
15297
15491
  */
15492
+ tel: "tel",
15298
15493
 
15299
- TextFieldType["tel"] = "tel";
15300
15494
  /**
15301
15495
  * A text TextField
15302
15496
  */
15497
+ text: "text",
15303
15498
 
15304
- TextFieldType["text"] = "text";
15305
15499
  /**
15306
15500
  * A URL TextField
15307
15501
  */
15308
-
15309
- TextFieldType["url"] = "url";
15310
- })(TextFieldType || (TextFieldType = {}));
15502
+ url: "url"
15503
+ };
15311
15504
 
15312
15505
  /**
15313
15506
  * A Text Field Custom HTML Element.
15314
15507
  * Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/text | <input type="text" /> element }.
15315
15508
  *
15509
+ * @slot start - Content which can be provided before the number field input
15510
+ * @slot end - Content which can be provided after the number field input
15511
+ * @slot - The default slot for the label
15512
+ * @csspart label - The label
15513
+ * @csspart root - The element wrapping the control, including start and end slots
15514
+ * @csspart control - The text field element
15515
+ * @fires change - Fires a custom 'change' event when the value has changed
15516
+ *
15316
15517
  * @public
15317
15518
  */
15318
15519
 
@@ -15411,6 +15612,24 @@ class TextField$1 extends FormAssociatedTextField {
15411
15612
  });
15412
15613
  }
15413
15614
  }
15615
+ /**
15616
+ * Selects all the text in the text field
15617
+ *
15618
+ * @public
15619
+ */
15620
+
15621
+
15622
+ select() {
15623
+ this.control.select();
15624
+ /**
15625
+ * The select event does not permeate the shadow DOM boundary.
15626
+ * This fn effectively proxies the select event,
15627
+ * emitting a `select` event whenever the internal
15628
+ * control emits a `select` event
15629
+ */
15630
+
15631
+ this.$emit("select");
15632
+ }
15414
15633
  /**
15415
15634
  * Handles the internal control's `input` event
15416
15635
  * @internal
@@ -15434,6 +15653,12 @@ class TextField$1 extends FormAssociatedTextField {
15434
15653
  handleChange() {
15435
15654
  this.$emit("change");
15436
15655
  }
15656
+ /** {@inheritDoc (FormAssociated:interface).validate} */
15657
+
15658
+
15659
+ validate() {
15660
+ super.validate(this.control);
15661
+ }
15437
15662
 
15438
15663
  }
15439
15664
 
@@ -15502,6 +15727,20 @@ class FormAssociatedNumberField extends FormAssociated(_NumberField) {
15502
15727
  * A Number Field Custom HTML Element.
15503
15728
  * Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number | <input type="number" /> element }.
15504
15729
  *
15730
+ * @slot start - Content which can be provided before the number field input
15731
+ * @slot end - Content which can be provided after the number field input
15732
+ * @slot - The default slot for the label
15733
+ * @slot step-up-glyph - The glyph for the step up control
15734
+ * @slot step-down-glyph - The glyph for the step down control
15735
+ * @csspart label - The label
15736
+ * @csspart root - The element wrapping the control, including start and end slots
15737
+ * @csspart control - The element representing the input
15738
+ * @csspart controls - The step up and step down controls
15739
+ * @csspart step-up - The step up control
15740
+ * @csspart step-down - The step down control
15741
+ * @fires input - Fires a custom 'input' event when the value has changed
15742
+ * @fires change - Fires a custom 'change' event when the value has changed
15743
+ *
15505
15744
  * @public
15506
15745
  */
15507
15746
 
@@ -15618,6 +15857,12 @@ class NumberField$1 extends FormAssociatedNumberField {
15618
15857
 
15619
15858
  this.isUserInput = false;
15620
15859
  }
15860
+ /** {@inheritDoc (FormAssociated:interface).validate} */
15861
+
15862
+
15863
+ validate() {
15864
+ super.validate(this.control);
15865
+ }
15621
15866
  /**
15622
15867
  * Sets the internal value to a valid number between the min and max properties
15623
15868
  * @param value - user input
@@ -15682,6 +15927,24 @@ class NumberField$1 extends FormAssociatedNumberField {
15682
15927
  });
15683
15928
  }
15684
15929
  }
15930
+ /**
15931
+ * Selects all the text in the number field
15932
+ *
15933
+ * @public
15934
+ */
15935
+
15936
+
15937
+ select() {
15938
+ this.control.select();
15939
+ /**
15940
+ * The select event does not permeate the shadow DOM boundary.
15941
+ * This fn effectively proxies the select event,
15942
+ * emitting a `select` event whenever the internal
15943
+ * control emits a `select` event
15944
+ */
15945
+
15946
+ this.$emit("select");
15947
+ }
15685
15948
  /**
15686
15949
  * Handles the internal control's `input` event
15687
15950
  * @internal
@@ -15799,6 +16062,11 @@ const progressRingTemplate = (context, definition) => html`<template role="progr
15799
16062
  * An Progress HTML Element.
15800
16063
  * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#progressbar | ARIA progressbar }.
15801
16064
  *
16065
+ * @slot indeterminate - The slot for a custom indeterminate indicator
16066
+ * @csspart progress - Represents the progress element
16067
+ * @csspart determinate - The determinate indicator
16068
+ * @csspart indeterminate - The indeterminate indicator
16069
+ *
15802
16070
  * @public
15803
16071
  */
15804
16072
 
@@ -15889,6 +16157,11 @@ const radioGroupTemplate = (context, definition) => html`<template role="radiogr
15889
16157
  * An Radio Group Custom HTML Element.
15890
16158
  * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#radiogroup | ARIA radiogroup }.
15891
16159
  *
16160
+ * @slot label - The slot for the label
16161
+ * @slot - The default slot for radio buttons
16162
+ * @csspart positioning-region - The positioning region for laying out the radios
16163
+ * @fires change - Fires a custom 'change' event when the value changes
16164
+ *
15892
16165
  * @public
15893
16166
  */
15894
16167
 
@@ -16188,7 +16461,7 @@ class RadioGroup extends FoundationElement {
16188
16461
  valueChanged() {
16189
16462
  if (this.slottedRadioButtons) {
16190
16463
  this.slottedRadioButtons.forEach(radio => {
16191
- if (radio.getAttribute("value") === this.value) {
16464
+ if (radio.value === this.value) {
16192
16465
  radio.checked = true;
16193
16466
  this.selectedRadio = radio;
16194
16467
  }
@@ -16345,6 +16618,12 @@ class FormAssociatedRadio extends CheckableFormAssociated(_Radio) {
16345
16618
  * A Radio Custom HTML Element.
16346
16619
  * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#radio | ARIA radio }.
16347
16620
  *
16621
+ * @slot checked-indicator - The checked indicator
16622
+ * @slot - The default slot for the label
16623
+ * @csspart control - The element representing the visual radio control
16624
+ * @csspart label - The label
16625
+ * @fires change - Emits a custom change event when the checked state changes
16626
+ *
16348
16627
  * @public
16349
16628
  */
16350
16629
 
@@ -16460,6 +16739,19 @@ __decorate$1([observable], Radio.prototype, "defaultSlottedNodes", void 0);
16460
16739
 
16461
16740
  /**
16462
16741
  * A HorizontalScroll Custom HTML Element
16742
+ *
16743
+ * @slot start - Content which can be provided before the scroll area
16744
+ * @slot end - Content which can be provided after the scroll area
16745
+ * @csspart scroll-area - Wraps the entire scrollable region
16746
+ * @csspart scroll-view - The visible scroll area
16747
+ * @csspart content-container - The container for the content
16748
+ * @csspart scroll-prev - The previous flipper container
16749
+ * @csspart scroll-action-previous - The element wrapping the previous flipper
16750
+ * @csspart scroll-next - The next flipper container
16751
+ * @csspart scroll-action-next - The element wrapping the next flipper
16752
+ * @fires scrollstart - Fires a custom 'scrollstart' event when scrolling
16753
+ * @fires scrollend - Fires a custom 'scrollend' event when scrolling stops
16754
+ *
16463
16755
  * @public
16464
16756
  */
16465
16757
 
@@ -16613,20 +16905,32 @@ class HorizontalScroll$1 extends FoundationElement {
16613
16905
 
16614
16906
  setStops() {
16615
16907
  this.updateScrollStops();
16616
- this.width = this.offsetWidth;
16908
+ const {
16909
+ scrollContainer: container
16910
+ } = this;
16911
+ const {
16912
+ scrollLeft
16913
+ } = container;
16914
+ const {
16915
+ width: containerWidth,
16916
+ left: containerLeft
16917
+ } = container.getBoundingClientRect();
16918
+ this.width = containerWidth;
16617
16919
  let lastStop = 0;
16618
- let stops = this.scrollItems.map(({
16619
- offsetLeft: left,
16620
- offsetWidth: width
16621
- }, index) => {
16622
- const right = left + width;
16920
+ let stops = this.scrollItems.map((item, index) => {
16921
+ const {
16922
+ left,
16923
+ width
16924
+ } = item.getBoundingClientRect();
16925
+ const leftPosition = Math.round(left + scrollLeft - containerLeft);
16926
+ const right = Math.round(leftPosition + width);
16623
16927
 
16624
16928
  if (this.isRtl) {
16625
16929
  return -right;
16626
16930
  }
16627
16931
 
16628
16932
  lastStop = right;
16629
- return index === 0 ? 0 : left;
16933
+ return index === 0 ? 0 : leftPosition;
16630
16934
  }).concat(lastStop);
16631
16935
  /* Fixes a FireFox bug where it doesn't scroll to the start */
16632
16936
 
@@ -16668,6 +16972,50 @@ class HorizontalScroll$1 extends FoundationElement {
16668
16972
  (_b = this.nextFlipperContainer) === null || _b === void 0 ? void 0 : _b.classList.toggle("disabled", Math.abs(position) + this.width >= lastStop);
16669
16973
  }
16670
16974
  }
16975
+ /**
16976
+ * Function that can scroll an item into view.
16977
+ * @param item - An item index, a scroll item or a child of one of the scroll items
16978
+ * @param padding - Padding of the viewport where the active item shouldn't be
16979
+ * @param rightPadding - Optional right padding. Uses the padding if not defined
16980
+ *
16981
+ * @public
16982
+ */
16983
+
16984
+
16985
+ scrollInView(item, padding = 0, rightPadding) {
16986
+ var _a;
16987
+
16988
+ if (typeof item !== "number" && item) {
16989
+ item = this.scrollItems.findIndex(scrollItem => scrollItem === item || scrollItem.contains(item));
16990
+ }
16991
+
16992
+ if (item !== undefined) {
16993
+ rightPadding = rightPadding !== null && rightPadding !== void 0 ? rightPadding : padding;
16994
+ const {
16995
+ scrollContainer: container,
16996
+ scrollStops,
16997
+ scrollItems: items
16998
+ } = this;
16999
+ const {
17000
+ scrollLeft
17001
+ } = this.scrollContainer;
17002
+ const {
17003
+ width: containerWidth
17004
+ } = container.getBoundingClientRect();
17005
+ const itemStart = scrollStops[item];
17006
+ const {
17007
+ width
17008
+ } = items[item].getBoundingClientRect();
17009
+ const itemEnd = itemStart + width;
17010
+ const isBefore = scrollLeft + padding > itemStart;
17011
+
17012
+ if (isBefore || scrollLeft + containerWidth - rightPadding < itemEnd) {
17013
+ const stops = [...scrollStops].sort((a, b) => isBefore ? b - a : a - b);
17014
+ const scrollTo = (_a = stops.find(position => isBefore ? position + padding < itemStart : position + containerWidth - (rightPadding !== null && rightPadding !== void 0 ? rightPadding : 0) > itemEnd)) !== null && _a !== void 0 ? _a : 0;
17015
+ this.scrollToPosition(scrollTo);
17016
+ }
17017
+ }
17018
+ }
16671
17019
  /**
16672
17020
  * Lets the user arrow left and right through the horizontal scroll
16673
17021
  * @param e - Keyboard event
@@ -16789,7 +17137,7 @@ class HorizontalScroll$1 extends FoundationElement {
16789
17137
  }
16790
17138
 
16791
17139
  this.resizeTimeout = setTimeout(() => {
16792
- this.width = this.offsetWidth;
17140
+ this.width = this.scrollContainer.offsetWidth;
16793
17141
  this.setFlippers();
16794
17142
  }, this.frameTime);
16795
17143
  }
@@ -16877,6 +17225,16 @@ class FormAssociatedSearch extends FormAssociated(_Search) {
16877
17225
  * A Search Custom HTML Element.
16878
17226
  * Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/search | <input type="search" /> element }.
16879
17227
  *
17228
+ * @slot start - Content which can be provided before the search input
17229
+ * @slot end - Content which can be provided after the search clear button
17230
+ * @slot - The default slot for the label
17231
+ * @slot close-button - The clear button
17232
+ * @slot close-glyph - The clear glyph
17233
+ * @csspart label - The label
17234
+ * @csspart root - The element wrapping the control, including start and end slots
17235
+ * @csspart control - The element representing the input
17236
+ * @csspart clear-button - The button to clear the input
17237
+ *
16880
17238
  * @public
16881
17239
  */
16882
17240
 
@@ -16955,6 +17313,12 @@ class Search$1 extends FormAssociatedSearch {
16955
17313
  });
16956
17314
  }
16957
17315
  }
17316
+ /** {@inheritDoc (FormAssociated:interface).validate} */
17317
+
17318
+
17319
+ validate() {
17320
+ super.validate(this.control);
17321
+ }
16958
17322
  /**
16959
17323
  * Handles the internal control's `input` event
16960
17324
  * @internal
@@ -16973,6 +17337,7 @@ class Search$1 extends FormAssociatedSearch {
16973
17337
  handleClearInput() {
16974
17338
  this.value = "";
16975
17339
  this.control.focus();
17340
+ this.handleChange();
16976
17341
  }
16977
17342
  /**
16978
17343
  * Change event handler for inner control.
@@ -17054,6 +17419,19 @@ class FormAssociatedSelect extends FormAssociated(_Select) {
17054
17419
  * A Select Custom HTML Element.
17055
17420
  * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#select | ARIA select }.
17056
17421
  *
17422
+ * @slot start - Content which can be provided before the button content
17423
+ * @slot end - Content which can be provided after the button content
17424
+ * @slot button-container - The element representing the select button
17425
+ * @slot selected-value - The selected value
17426
+ * @slot indicator - The visual indicator for the expand/collapse state of the button
17427
+ * @slot - The default slot for slotted options
17428
+ * @csspart control - The element representing the select invoking element
17429
+ * @csspart selected-value - The element wrapping the selected value
17430
+ * @csspart indicator - The element wrapping the visual indicator
17431
+ * @csspart listbox - The listbox element
17432
+ * @fires input - Fires a custom 'input' event when the value updates
17433
+ * @fires change - Fires a custom 'change' event when the value updates
17434
+ *
17057
17435
  * @public
17058
17436
  */
17059
17437
 
@@ -17076,13 +17454,6 @@ class Select$1 extends FormAssociatedSelect {
17076
17454
  */
17077
17455
 
17078
17456
  this.forcedPosition = false;
17079
- /**
17080
- * Holds the current state for the calculated position of the listbox.
17081
- *
17082
- * @public
17083
- */
17084
-
17085
- this.position = SelectPosition.below;
17086
17457
  /**
17087
17458
  * The unique id for the internal listbox element.
17088
17459
  *
@@ -17097,13 +17468,6 @@ class Select$1 extends FormAssociatedSelect {
17097
17468
  */
17098
17469
 
17099
17470
  this.maxHeight = 0;
17100
- /**
17101
- * The value displayed on the button.
17102
- *
17103
- * @public
17104
- */
17105
-
17106
- this.displayValue = "";
17107
17471
  }
17108
17472
  /**
17109
17473
  * Sets focus and synchronizes ARIA attributes when the open property changes.
@@ -17157,31 +17521,29 @@ class Select$1 extends FormAssociatedSelect {
17157
17521
  }
17158
17522
 
17159
17523
  set value(next) {
17160
- var _a;
17524
+ var _a, _b, _c, _d, _e, _f, _g;
17161
17525
 
17162
17526
  const prev = `${this._value}`;
17163
17527
 
17164
- if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.length) {
17165
- const selectedIndex = this.options.findIndex(el => el.value === next);
17166
- const prevSelectedOption = this.options[this.selectedIndex];
17167
- const nextSelectedOption = this.options[selectedIndex];
17168
- const prevSelectedValue = prevSelectedOption ? prevSelectedOption.value : null;
17169
- const nextSelectedValue = nextSelectedOption ? nextSelectedOption.value : null;
17528
+ if ((_a = this._options) === null || _a === void 0 ? void 0 : _a.length) {
17529
+ const selectedIndex = this._options.findIndex(el => el.value === next);
17530
+
17531
+ const prevSelectedValue = (_c = (_b = this._options[this.selectedIndex]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : null;
17532
+ const nextSelectedValue = (_e = (_d = this._options[selectedIndex]) === null || _d === void 0 ? void 0 : _d.value) !== null && _e !== void 0 ? _e : null;
17170
17533
 
17171
17534
  if (selectedIndex === -1 || prevSelectedValue !== nextSelectedValue) {
17172
17535
  next = "";
17173
17536
  this.selectedIndex = selectedIndex;
17174
17537
  }
17175
17538
 
17176
- if (this.firstSelectedOption) {
17177
- next = this.firstSelectedOption.value;
17178
- }
17539
+ next = (_g = (_f = this.firstSelectedOption) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : next;
17179
17540
  }
17180
17541
 
17181
17542
  if (prev !== next) {
17182
17543
  this._value = next;
17183
17544
  super.valueChanged(prev, next);
17184
17545
  Observable.notify(this, "value");
17546
+ this.updateDisplayValue();
17185
17547
  }
17186
17548
  }
17187
17549
  /**
@@ -17194,9 +17556,10 @@ class Select$1 extends FormAssociatedSelect {
17194
17556
 
17195
17557
 
17196
17558
  updateValue(shouldEmit) {
17559
+ var _a, _b;
17560
+
17197
17561
  if (this.$fastController.isConnected) {
17198
- this.value = this.firstSelectedOption ? this.firstSelectedOption.value : "";
17199
- this.displayValue = this.firstSelectedOption ? this.firstSelectedOption.textContent || this.firstSelectedOption.value : this.value;
17562
+ this.value = (_b = (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
17200
17563
  }
17201
17564
 
17202
17565
  if (shouldEmit) {
@@ -17222,8 +17585,8 @@ class Select$1 extends FormAssociatedSelect {
17222
17585
  this.updateValue();
17223
17586
  }
17224
17587
 
17225
- positionChanged() {
17226
- this.positionAttribute = this.position;
17588
+ positionChanged(prev, next) {
17589
+ this.positionAttribute = next;
17227
17590
  this.setPositioning();
17228
17591
  }
17229
17592
  /**
@@ -17241,6 +17604,19 @@ class Select$1 extends FormAssociatedSelect {
17241
17604
  this.positionAttribute = this.forcedPosition ? this.positionAttribute : this.position;
17242
17605
  this.maxHeight = this.position === SelectPosition.above ? ~~currentBox.top : ~~availableBottom;
17243
17606
  }
17607
+ /**
17608
+ * The value displayed on the button.
17609
+ *
17610
+ * @public
17611
+ */
17612
+
17613
+
17614
+ get displayValue() {
17615
+ var _a, _b;
17616
+
17617
+ Observable.track(this, "displayValue");
17618
+ return (_b = (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : "";
17619
+ }
17244
17620
  /**
17245
17621
  * Synchronize the `aria-disabled` property when the `disabled` property changes.
17246
17622
  *
@@ -17338,6 +17714,24 @@ class Select$1 extends FormAssociatedSelect {
17338
17714
  }
17339
17715
  }
17340
17716
  }
17717
+ /**
17718
+ * Updates the value when an option's value changes.
17719
+ *
17720
+ * @param source - the source object
17721
+ * @param propertyName - the property to evaluate
17722
+ *
17723
+ * @internal
17724
+ * @override
17725
+ */
17726
+
17727
+
17728
+ handleChange(source, propertyName) {
17729
+ super.handleChange(source, propertyName);
17730
+
17731
+ if (propertyName === "value") {
17732
+ this.updateValue();
17733
+ }
17734
+ }
17341
17735
  /**
17342
17736
  * Synchronize the form-associated proxy and updates the value property of the element.
17343
17737
  *
@@ -17349,7 +17743,15 @@ class Select$1 extends FormAssociatedSelect {
17349
17743
 
17350
17744
 
17351
17745
  slottedOptionsChanged(prev, next) {
17746
+ this.options.forEach(o => {
17747
+ const notifier = Observable.getNotifier(o);
17748
+ notifier.unsubscribe(this, "value");
17749
+ });
17352
17750
  super.slottedOptionsChanged(prev, next);
17751
+ this.options.forEach(o => {
17752
+ const notifier = Observable.getNotifier(o);
17753
+ notifier.subscribe(this, "value");
17754
+ });
17353
17755
  this.setProxyOptions();
17354
17756
  this.updateValue();
17355
17757
  }
@@ -17517,12 +17919,18 @@ class Select$1 extends FormAssociatedSelect {
17517
17919
  this.indexWhenOpened = this.selectedIndex;
17518
17920
  }
17519
17921
 
17520
- return !(key in ArrowKeys);
17922
+ return !(key === keyArrowDown || key === keyArrowUp);
17521
17923
  }
17522
17924
 
17523
17925
  connectedCallback() {
17524
17926
  super.connectedCallback();
17525
17927
  this.forcedPosition = !!this.positionAttribute;
17928
+ this.addEventListener("contentchange", this.updateDisplayValue);
17929
+ }
17930
+
17931
+ disconnectedCallback() {
17932
+ this.removeEventListener("contentchange", this.updateDisplayValue);
17933
+ super.disconnectedCallback();
17526
17934
  }
17527
17935
  /**
17528
17936
  * Updates the proxy's size property when the size attribute changes.
@@ -17542,6 +17950,17 @@ class Select$1 extends FormAssociatedSelect {
17542
17950
  this.proxy.size = next;
17543
17951
  }
17544
17952
  }
17953
+ /**
17954
+ *
17955
+ * @internal
17956
+ */
17957
+
17958
+
17959
+ updateDisplayValue() {
17960
+ if (this.collapsible) {
17961
+ Observable.notify(this, "displayValue");
17962
+ }
17963
+ }
17545
17964
 
17546
17965
  }
17547
17966
 
@@ -17561,8 +17980,6 @@ __decorate$1([attr({
17561
17980
  __decorate$1([observable], Select$1.prototype, "position", void 0);
17562
17981
 
17563
17982
  __decorate$1([observable], Select$1.prototype, "maxHeight", void 0);
17564
-
17565
- __decorate$1([observable], Select$1.prototype, "displayValue", void 0);
17566
17983
  /**
17567
17984
  * Includes ARIA states and properties relating to the ARIA select role.
17568
17985
  *
@@ -17598,6 +18015,8 @@ const skeletonTemplate = (context, definition) => html`<template class="${x => x
17598
18015
  /**
17599
18016
  * A Skeleton Custom HTML Element.
17600
18017
  *
18018
+ * @slot - The default slot
18019
+ *
17601
18020
  * @public
17602
18021
  */
17603
18022
 
@@ -17658,6 +18077,9 @@ const defaultConfig = {
17658
18077
  /**
17659
18078
  * A label element intended to be used with the {@link @microsoft/fast-foundation#(Slider:class)} component.
17660
18079
  *
18080
+ * @slot - The default slot for the label content
18081
+ * @csspart root - The element wrapping the label mark and text
18082
+ *
17661
18083
  * @public
17662
18084
  */
17663
18085
 
@@ -17682,7 +18104,7 @@ class SliderLabel extends FoundationElement {
17682
18104
  this.getSliderConfiguration = () => {
17683
18105
  if (!this.isSliderConfig(this.parentNode)) {
17684
18106
  this.sliderDirection = defaultConfig.direction || Direction.ltr;
17685
- this.sliderOrientation = defaultConfig.orientation || Orientation.horizontal;
18107
+ this.sliderOrientation = defaultConfig.orientation ;
17686
18108
  this.sliderMaxPosition = defaultConfig.max;
17687
18109
  this.sliderMinPosition = defaultConfig.min;
17688
18110
  } else {
@@ -17778,7 +18200,7 @@ class SliderLabel extends FoundationElement {
17778
18200
  break;
17779
18201
 
17780
18202
  case "max":
17781
- this.sliderMinPosition = source.max;
18203
+ this.sliderMaxPosition = source.max;
17782
18204
  break;
17783
18205
 
17784
18206
  case "min":
@@ -17845,19 +18267,26 @@ class FormAssociatedSlider extends FormAssociated(_Slider) {
17845
18267
  * @public
17846
18268
  */
17847
18269
 
17848
- var SliderMode;
17849
-
17850
- (function (SliderMode) {
17851
- SliderMode["singleValue"] = "single-value";
17852
- })(SliderMode || (SliderMode = {}));
18270
+ const SliderMode = {
18271
+ singleValue: "single-value"
18272
+ };
17853
18273
  /**
17854
18274
  * A Slider Custom HTML Element.
17855
18275
  * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#slider | ARIA slider }.
17856
18276
  *
18277
+ * @slot track - The track of the slider
18278
+ * @slot track-start - The track-start visual indicator
18279
+ * @slot thumb - The slider thumb
18280
+ * @slot - The default slot for labels
18281
+ * @csspart positioning-region - The region used to position the elements of the slider
18282
+ * @csspart track-container - The region containing the track elements
18283
+ * @csspart track-start - The element wrapping the track start slot
18284
+ * @csspart thumb-container - The thumb container element which is programatically positioned
18285
+ * @fires change - Fires a custom 'change' event when the slider value changes
18286
+ *
17857
18287
  * @public
17858
18288
  */
17859
18289
 
17860
-
17861
18290
  class Slider extends FormAssociatedSlider {
17862
18291
  constructor() {
17863
18292
  super(...arguments);
@@ -17956,6 +18385,10 @@ class Slider extends FormAssociatedSlider {
17956
18385
  this.mode = SliderMode.singleValue;
17957
18386
 
17958
18387
  this.keypressHandler = e => {
18388
+ if (this.readOnly) {
18389
+ return;
18390
+ }
18391
+
17959
18392
  if (e.key === keyHome) {
17960
18393
  e.preventDefault();
17961
18394
  this.value = `${this.min}`;
@@ -18348,6 +18781,16 @@ class FormAssociatedSwitch extends CheckableFormAssociated(_Switch) {
18348
18781
  * A Switch Custom HTML Element.
18349
18782
  * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#switch | ARIA switch }.
18350
18783
  *
18784
+ * @slot - The deafult slot for the label
18785
+ * @slot checked-message - The message when in a checked state
18786
+ * @slot unchecked-message - The message when in an unchecked state
18787
+ * @csspart label - The label
18788
+ * @csspart switch - The element representing the switch, which wraps the indicator
18789
+ * @csspart status-message - The wrapper for the status messages
18790
+ * @csspart checked-message - The checked message
18791
+ * @csspart unchecked-message - The unchecked message
18792
+ * @fires change - Emits a custom change event when the checked state changes
18793
+ *
18351
18794
  * @public
18352
18795
  */
18353
18796
 
@@ -18367,6 +18810,10 @@ class Switch extends FormAssociatedSwitch {
18367
18810
  */
18368
18811
 
18369
18812
  this.keypressHandler = e => {
18813
+ if (this.readOnly) {
18814
+ return;
18815
+ }
18816
+
18370
18817
  switch (e.key) {
18371
18818
  case keyEnter:
18372
18819
  case keySpace:
@@ -18427,6 +18874,9 @@ const tabPanelTemplate = (context, definition) => html`<template slot="tabpanel"
18427
18874
 
18428
18875
  /**
18429
18876
  * A TabPanel Component to be used with {@link @microsoft/fast-foundation#(Tabs:class)}
18877
+ *
18878
+ * @slot - The default slot for the tabpanel content
18879
+ *
18430
18880
  * @public
18431
18881
  */
18432
18882
 
@@ -18441,6 +18891,9 @@ const tabTemplate = (context, definition) => html`<template slot="tab" role="tab
18441
18891
 
18442
18892
  /**
18443
18893
  * A Tab Component to be used with {@link @microsoft/fast-foundation#(Tabs:class)}
18894
+ *
18895
+ * @slot - The default slot for the tab content
18896
+ *
18444
18897
  * @public
18445
18898
  */
18446
18899
 
@@ -18462,20 +18915,27 @@ const tabsTemplate = (context, definition) => html`<template class="${x => x.ori
18462
18915
  * @public
18463
18916
  */
18464
18917
 
18465
- var TabsOrientation;
18466
-
18467
- (function (TabsOrientation) {
18468
- TabsOrientation["vertical"] = "vertical";
18469
- TabsOrientation["horizontal"] = "horizontal";
18470
- })(TabsOrientation || (TabsOrientation = {}));
18918
+ const TabsOrientation = {
18919
+ vertical: "vertical",
18920
+ horizontal: "horizontal"
18921
+ };
18471
18922
  /**
18472
18923
  * A Tabs Custom HTML Element.
18473
18924
  * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#tablist | ARIA tablist }.
18474
18925
  *
18926
+ * @slot start - Content which can be provided before the tablist element
18927
+ * @slot end - Content which can be provided after the tablist element
18928
+ * @slot tab - The slot for tabs
18929
+ * @slot tabpanel - The slot for tabpanels
18930
+ * @csspart tablist - The element wrapping for the tabs
18931
+ * @csspart tab - The tab slot
18932
+ * @csspart activeIndicator - The visual indicator
18933
+ * @csspart tabpanel - The tabpanel slot
18934
+ * @fires change - Fires a custom 'change' event when a tab is clicked or during keyboard navigation
18935
+ *
18475
18936
  * @public
18476
18937
  */
18477
18938
 
18478
-
18479
18939
  class Tabs extends FoundationElement {
18480
18940
  constructor() {
18481
18941
  super(...arguments);
@@ -18520,8 +18980,6 @@ class Tabs extends FoundationElement {
18520
18980
  const gridHorizontalProperty = "gridColumn";
18521
18981
  const gridVerticalProperty = "gridRow";
18522
18982
  const gridProperty = this.isHorizontal() ? gridHorizontalProperty : gridVerticalProperty;
18523
- this.tabIds = this.getTabIds();
18524
- this.tabpanelIds = this.getTabPanelIds();
18525
18983
  this.activeTabIndex = this.getActiveIndex();
18526
18984
  this.showActiveIndicator = false;
18527
18985
  this.tabs.forEach((tab, index) => {
@@ -18556,8 +19014,6 @@ class Tabs extends FoundationElement {
18556
19014
  };
18557
19015
 
18558
19016
  this.setTabPanels = () => {
18559
- this.tabIds = this.getTabIds();
18560
- this.tabpanelIds = this.getTabPanelIds();
18561
19017
  this.tabpanels.forEach((tabpanel, index) => {
18562
19018
  const tabId = this.tabIds[index];
18563
19019
  const tabpanelId = this.tabpanelIds[index];
@@ -18699,6 +19155,8 @@ class Tabs extends FoundationElement {
18699
19155
 
18700
19156
  tabsChanged() {
18701
19157
  if (this.$fastController.isConnected && this.tabs.length <= this.tabpanels.length) {
19158
+ this.tabIds = this.getTabIds();
19159
+ this.tabpanelIds = this.getTabPanelIds();
18702
19160
  this.setTabs();
18703
19161
  this.setTabPanels();
18704
19162
  this.handleActiveIndicatorPosition();
@@ -18711,6 +19169,8 @@ class Tabs extends FoundationElement {
18711
19169
 
18712
19170
  tabpanelsChanged() {
18713
19171
  if (this.$fastController.isConnected && this.tabpanels.length <= this.tabs.length) {
19172
+ this.tabIds = this.getTabIds();
19173
+ this.tabpanelIds = this.getTabPanelIds();
18714
19174
  this.setTabs();
18715
19175
  this.setTabPanels();
18716
19176
  this.handleActiveIndicatorPosition();
@@ -18855,34 +19315,38 @@ class FormAssociatedTextArea extends FormAssociated(_TextArea) {
18855
19315
  * Resize mode for a TextArea
18856
19316
  * @public
18857
19317
  */
18858
- var TextAreaResize;
18859
-
18860
- (function (TextAreaResize) {
19318
+ const TextAreaResize = {
18861
19319
  /**
18862
19320
  * No resize.
18863
19321
  */
18864
- TextAreaResize["none"] = "none";
19322
+ none: "none",
19323
+
18865
19324
  /**
18866
19325
  * Resize vertically and horizontally.
18867
19326
  */
19327
+ both: "both",
18868
19328
 
18869
- TextAreaResize["both"] = "both";
18870
19329
  /**
18871
19330
  * Resize horizontally.
18872
19331
  */
19332
+ horizontal: "horizontal",
18873
19333
 
18874
- TextAreaResize["horizontal"] = "horizontal";
18875
19334
  /**
18876
19335
  * Resize vertically.
18877
19336
  */
18878
-
18879
- TextAreaResize["vertical"] = "vertical";
18880
- })(TextAreaResize || (TextAreaResize = {}));
19337
+ vertical: "vertical"
19338
+ };
18881
19339
 
18882
19340
  /**
18883
19341
  * A Text Area Custom HTML Element.
18884
19342
  * Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea | <textarea> element }.
18885
19343
  *
19344
+ * @slot - The default slot for the label
19345
+ * @csspart label - The label
19346
+ * @csspart root - The element wrapping the control
19347
+ * @csspart control - The textarea element
19348
+ * @fires change - Emits a custom 'change' event when the textarea emits a change event
19349
+ *
18886
19350
  * @public
18887
19351
  */
18888
19352
 
@@ -18950,6 +19414,24 @@ class TextArea$1 extends FormAssociatedTextArea {
18950
19414
  this.proxy.spellcheck = this.spellcheck;
18951
19415
  }
18952
19416
  }
19417
+ /**
19418
+ * Selects all the text in the text area
19419
+ *
19420
+ * @public
19421
+ */
19422
+
19423
+
19424
+ select() {
19425
+ this.control.select();
19426
+ /**
19427
+ * The select event does not permeate the shadow DOM boundary.
19428
+ * This fn effectively proxies the select event,
19429
+ * emitting a `select` event whenever the internal
19430
+ * control emits a `select` event
19431
+ */
19432
+
19433
+ this.$emit("select");
19434
+ }
18953
19435
  /**
18954
19436
  * Change event handler for inner control.
18955
19437
  * @remarks
@@ -18964,6 +19446,12 @@ class TextArea$1 extends FormAssociatedTextArea {
18964
19446
  handleChange() {
18965
19447
  this.$emit("change");
18966
19448
  }
19449
+ /** {@inheritDoc (FormAssociated:interface).validate} */
19450
+
19451
+
19452
+ validate() {
19453
+ super.validate(this.control);
19454
+ }
18967
19455
 
18968
19456
  }
18969
19457
 
@@ -19036,7 +19524,12 @@ const textFieldTemplate = (context, definition) => html`<template class=" ${x =>
19036
19524
  * @public
19037
19525
  */
19038
19526
 
19039
- const toolbarTemplate = (context, definition) => html`<template aria-label="${x => x.ariaLabel}" aria-labelledby="${x => x.ariaLabelledby}" aria-orientation="${x => x.orientation}" orientation="${x => x.orientation}" role="toolbar" @click="${(x, c) => x.clickHandler(c.event)}" @focusin="${(x, c) => x.focusinHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}"><slot name="label"></slot><div class="positioning-region" part="positioning-region">${startSlotTemplate(context, definition)}<slot ${slotted({
19527
+ const toolbarTemplate = (context, definition) => html`<template aria-label="${x => x.ariaLabel}" aria-labelledby="${x => x.ariaLabelledby}" aria-orientation="${x => x.orientation}" orientation="${x => x.orientation}" role="toolbar" @click="${(x, c) => x.clickHandler(c.event)}" @focusin="${(x, c) => x.focusinHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}" ${children({
19528
+ property: "childItems",
19529
+ attributeFilter: ["disabled", "hidden"],
19530
+ filter: elements(),
19531
+ subtree: true
19532
+ })}><slot name="label"></slot><div class="positioning-region" part="positioning-region">${startSlotTemplate(context, definition)}<slot ${slotted({
19040
19533
  filter: elements(),
19041
19534
  property: "slottedItems"
19042
19535
  })}></slot>${endSlotTemplate(context, definition)}</div></template>`;
@@ -19072,6 +19565,12 @@ const ToolbarArrowKeyMap = Object.freeze({
19072
19565
  * A Toolbar Custom HTML Element.
19073
19566
  * Implements the {@link https://w3c.github.io/aria-practices/#Toolbar|ARIA Toolbar}.
19074
19567
  *
19568
+ * @slot start - Content which can be provided before the slotted items
19569
+ * @slot end - Content which can be provided after the slotted items
19570
+ * @slot - The default slot for slotted items
19571
+ * @slot label - The toolbar label
19572
+ * @csspart positioning-region - The element containing the items, start and end slots
19573
+ *
19075
19574
  * @public
19076
19575
  */
19077
19576
 
@@ -19101,12 +19600,6 @@ class Toolbar$1 extends FoundationElement {
19101
19600
  */
19102
19601
 
19103
19602
  this.orientation = Orientation.horizontal;
19104
-
19105
- this.startEndSlotChange = () => {
19106
- if (this.$fastController.isConnected) {
19107
- this.reduceFocusableElements();
19108
- }
19109
- };
19110
19603
  }
19111
19604
  /**
19112
19605
  * The index of the currently focused element, clamped between 0 and the last element.
@@ -19150,6 +19643,12 @@ class Toolbar$1 extends FoundationElement {
19150
19643
 
19151
19644
  return true;
19152
19645
  }
19646
+
19647
+ childItemsChanged(prev, next) {
19648
+ if (this.$fastController.isConnected) {
19649
+ this.reduceFocusableElements();
19650
+ }
19651
+ }
19153
19652
  /**
19154
19653
  * @internal
19155
19654
  */
@@ -19158,18 +19657,6 @@ class Toolbar$1 extends FoundationElement {
19158
19657
  connectedCallback() {
19159
19658
  super.connectedCallback();
19160
19659
  this.direction = getDirection(this);
19161
- this.start.addEventListener("slotchange", this.startEndSlotChange);
19162
- this.end.addEventListener("slotchange", this.startEndSlotChange);
19163
- }
19164
- /**
19165
- * @internal
19166
- */
19167
-
19168
-
19169
- disconnectedCallback() {
19170
- super.disconnectedCallback();
19171
- this.start.removeEventListener("slotchange", this.startEndSlotChange);
19172
- this.end.removeEventListener("slotchange", this.startEndSlotChange);
19173
19660
  }
19174
19661
  /**
19175
19662
  * When the toolbar receives focus, set the currently active element as focused.
@@ -19247,7 +19734,14 @@ class Toolbar$1 extends FoundationElement {
19247
19734
 
19248
19735
 
19249
19736
  reduceFocusableElements() {
19250
- this.focusableElements = this.allSlottedItems.reduce(Toolbar$1.reduceFocusableItems, []);
19737
+ var _a;
19738
+
19739
+ const previousFocusedElement = (_a = this.focusableElements) === null || _a === void 0 ? void 0 : _a[this.activeIndex];
19740
+ this.focusableElements = this.allSlottedItems.reduce(Toolbar$1.reduceFocusableItems, []); // If the previously active item is still focusable, adjust the active index to the
19741
+ // index of that item.
19742
+
19743
+ const adjustedActiveIndex = this.focusableElements.indexOf(previousFocusedElement);
19744
+ this.activeIndex = Math.max(0, adjustedActiveIndex);
19251
19745
  this.setFocusableElements();
19252
19746
  }
19253
19747
  /**
@@ -19282,7 +19776,7 @@ class Toolbar$1 extends FoundationElement {
19282
19776
  const isFocusableFastElement = (_b = (_a = element.$fastController) === null || _a === void 0 ? void 0 : _a.definition.shadowOptions) === null || _b === void 0 ? void 0 : _b.delegatesFocus;
19283
19777
  const hasFocusableShadow = Array.from((_d = (_c = element.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelectorAll("*")) !== null && _d !== void 0 ? _d : []).some(x => isFocusable(x));
19284
19778
 
19285
- if (isFocusable(element) || isRoleRadio || isFocusableFastElement || hasFocusableShadow) {
19779
+ if (!element.hasAttribute("disabled") && !element.hasAttribute("hidden") && (isFocusable(element) || isRoleRadio || isFocusableFastElement || hasFocusableShadow)) {
19286
19780
  elements.push(element);
19287
19781
  return elements;
19288
19782
  }
@@ -19315,6 +19809,8 @@ __decorate$1([attr], Toolbar$1.prototype, "orientation", void 0);
19315
19809
  __decorate$1([observable], Toolbar$1.prototype, "slottedItems", void 0);
19316
19810
 
19317
19811
  __decorate$1([observable], Toolbar$1.prototype, "slottedLabel", void 0);
19812
+
19813
+ __decorate$1([observable], Toolbar$1.prototype, "childItems", void 0);
19318
19814
  /**
19319
19815
  * Includes ARIA states and properties relating to the ARIA toolbar role
19320
19816
  *
@@ -19349,83 +19845,85 @@ const tooltipTemplate = (context, definition) => {
19349
19845
  *
19350
19846
  * @public
19351
19847
  */
19352
- var TooltipPosition;
19353
-
19354
- (function (TooltipPosition) {
19848
+ const TooltipPosition = {
19355
19849
  /**
19356
19850
  * The tooltip is positioned above the element
19357
19851
  */
19358
- TooltipPosition["top"] = "top";
19852
+ top: "top",
19853
+
19359
19854
  /**
19360
19855
  * The tooltip is positioned to the right of the element
19361
19856
  */
19857
+ right: "right",
19362
19858
 
19363
- TooltipPosition["right"] = "right";
19364
19859
  /**
19365
19860
  * The tooltip is positioned below the element
19366
19861
  */
19862
+ bottom: "bottom",
19367
19863
 
19368
- TooltipPosition["bottom"] = "bottom";
19369
19864
  /**
19370
19865
  * The tooltip is positioned to the left of the element
19371
19866
  */
19867
+ left: "left",
19372
19868
 
19373
- TooltipPosition["left"] = "left";
19374
19869
  /**
19375
19870
  * The tooltip is positioned before the element
19376
19871
  */
19872
+ start: "start",
19377
19873
 
19378
- TooltipPosition["start"] = "start";
19379
19874
  /**
19380
19875
  * The tooltip is positioned after the element
19381
19876
  */
19877
+ end: "end",
19382
19878
 
19383
- TooltipPosition["end"] = "end";
19384
19879
  /**
19385
19880
  * The tooltip is positioned above the element and to the left
19386
19881
  */
19882
+ topLeft: "top-left",
19387
19883
 
19388
- TooltipPosition["topLeft"] = "top-left";
19389
19884
  /**
19390
19885
  * The tooltip is positioned above the element and to the right
19391
19886
  */
19887
+ topRight: "top-right",
19392
19888
 
19393
- TooltipPosition["topRight"] = "top-right";
19394
19889
  /**
19395
19890
  * The tooltip is positioned below the element and to the left
19396
19891
  */
19892
+ bottomLeft: "bottom-left",
19397
19893
 
19398
- TooltipPosition["bottomLeft"] = "bottom-left";
19399
19894
  /**
19400
19895
  * The tooltip is positioned below the element and to the right
19401
19896
  */
19897
+ bottomRight: "bottom-right",
19402
19898
 
19403
- TooltipPosition["bottomRight"] = "bottom-right";
19404
19899
  /**
19405
19900
  * The tooltip is positioned above the element and to the left
19406
19901
  */
19902
+ topStart: "top-start",
19407
19903
 
19408
- TooltipPosition["topStart"] = "top-start";
19409
19904
  /**
19410
19905
  * The tooltip is positioned above the element and to the right
19411
19906
  */
19907
+ topEnd: "top-end",
19412
19908
 
19413
- TooltipPosition["topEnd"] = "top-end";
19414
19909
  /**
19415
19910
  * The tooltip is positioned below the element and to the left
19416
19911
  */
19912
+ bottomStart: "bottom-start",
19417
19913
 
19418
- TooltipPosition["bottomStart"] = "bottom-start";
19419
19914
  /**
19420
19915
  * The tooltip is positioned below the element and to the right
19421
19916
  */
19422
-
19423
- TooltipPosition["bottomEnd"] = "bottom-end";
19424
- })(TooltipPosition || (TooltipPosition = {}));
19917
+ bottomEnd: "bottom-end"
19918
+ };
19425
19919
 
19426
19920
  /**
19427
19921
  * An Tooltip Custom HTML Element.
19428
19922
  *
19923
+ * @slot - The default slot for the tooltip content
19924
+ * @csspart tooltip - The tooltip element
19925
+ * @fires dismiss - Fires a custom 'dismiss' event when the tooltip is visible and escape key is pressed
19926
+ *
19429
19927
  * @public
19430
19928
  */
19431
19929
 
@@ -20030,6 +20528,18 @@ function isTreeItemElement(el) {
20030
20528
  /**
20031
20529
  * A Tree item Custom HTML Element.
20032
20530
  *
20531
+ * @slot start - Content which can be provided before the tree item content
20532
+ * @slot end - Content which can be provided after the tree item content
20533
+ * @slot - The default slot for tree item text content
20534
+ * @slot item - The slot for tree items (fast tree items manage this assignment themselves)
20535
+ * @slot expand-collapse-button - The expand/collapse button
20536
+ * @csspart positioning-region - The element used to position the tree item content with exception of any child nodes
20537
+ * @csspart content-region - The element containing the expand/collapse, start, and end slots
20538
+ * @csspart items - The element wrapping any child items
20539
+ * @csspart expand-collapse-button - The expand/collapse button
20540
+ * @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
20541
+ * @fires selected-change - Fires a custom 'selected-change' event when the selected state changes
20542
+ *
20033
20543
  * @public
20034
20544
  */
20035
20545
 
@@ -20179,6 +20689,8 @@ const treeViewTemplate = (context, definition) => html`<template role="tree" ${r
20179
20689
  * A Tree view Custom HTML Element.
20180
20690
  * Implements the {@link https://w3c.github.io/aria-practices/#TreeView | ARIA TreeView }.
20181
20691
  *
20692
+ * @slot - The default slot for tree items
20693
+ *
20182
20694
  * @public
20183
20695
  */
20184
20696
 
@@ -20270,8 +20782,10 @@ class TreeView extends FoundationElement {
20270
20782
  if (e.target && this.isFocusableElement(e.target)) {
20271
20783
  const item = e.target;
20272
20784
 
20273
- if (item instanceof TreeItem && item.childItemLength() > 0) {
20785
+ if (item instanceof TreeItem && item.childItemLength() > 0 && item.expanded) {
20274
20786
  item.expanded = false;
20787
+ } else if (item instanceof TreeItem && item.parentElement instanceof TreeItem) {
20788
+ TreeItem.focusItem(item.parentElement);
20275
20789
  }
20276
20790
  }
20277
20791
 
@@ -20281,8 +20795,10 @@ class TreeView extends FoundationElement {
20281
20795
  if (e.target && this.isFocusableElement(e.target)) {
20282
20796
  const item = e.target;
20283
20797
 
20284
- if (item instanceof TreeItem && item.childItemLength() > 0) {
20798
+ if (item instanceof TreeItem && item.childItemLength() > 0 && !item.expanded) {
20285
20799
  item.expanded = true;
20800
+ } else if (item instanceof TreeItem && item.childItemLength() > 0) {
20801
+ this.focusNextNode(1, e.target);
20286
20802
  }
20287
20803
  }
20288
20804