@fluentui/web-components 3.0.0-rc.16 → 3.0.0-rc.17

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +12 -2
  2. package/custom-elements.json +124 -2
  3. package/dist/esm/anchor-button/anchor-button.base.js +1 -2
  4. package/dist/esm/anchor-button/anchor-button.base.js.map +1 -1
  5. package/dist/esm/button/button.base.js +1 -2
  6. package/dist/esm/button/button.base.js.map +1 -1
  7. package/dist/esm/divider/divider.options.js +1 -1
  8. package/dist/esm/divider/divider.options.js.map +1 -1
  9. package/dist/esm/field/field.base.js +1 -1
  10. package/dist/esm/field/field.base.js.map +1 -1
  11. package/dist/esm/index.d.ts +2 -1
  12. package/dist/esm/index.js +2 -1
  13. package/dist/esm/index.js.map +1 -1
  14. package/dist/esm/menu/menu.js +4 -5
  15. package/dist/esm/menu/menu.js.map +1 -1
  16. package/dist/esm/menu-item/menu-item.js +4 -5
  17. package/dist/esm/menu-item/menu-item.js.map +1 -1
  18. package/dist/esm/menu-list/menu-list.base.js +1 -1
  19. package/dist/esm/menu-list/menu-list.base.js.map +1 -1
  20. package/dist/esm/radio-group/radio-group.base.js +8 -9
  21. package/dist/esm/radio-group/radio-group.base.js.map +1 -1
  22. package/dist/esm/radio-group/radio-group.options.js +1 -1
  23. package/dist/esm/radio-group/radio-group.options.js.map +1 -1
  24. package/dist/esm/slider/slider-utilities.d.ts +1 -1
  25. package/dist/esm/slider/slider-utilities.js +2 -1
  26. package/dist/esm/slider/slider-utilities.js.map +1 -1
  27. package/dist/esm/slider/slider.d.ts +2 -1
  28. package/dist/esm/slider/slider.js +9 -7
  29. package/dist/esm/slider/slider.js.map +1 -1
  30. package/dist/esm/slider/slider.options.d.ts +1 -1
  31. package/dist/esm/slider/slider.options.js +1 -1
  32. package/dist/esm/slider/slider.options.js.map +1 -1
  33. package/dist/esm/tablist/tablist.base.js +1 -1
  34. package/dist/esm/tablist/tablist.base.js.map +1 -1
  35. package/dist/esm/tablist/tablist.options.js +1 -1
  36. package/dist/esm/tablist/tablist.options.js.map +1 -1
  37. package/dist/esm/theme/set-theme.js +1 -1
  38. package/dist/esm/theme/set-theme.js.map +1 -1
  39. package/dist/esm/tooltip/tooltip.js +1 -1
  40. package/dist/esm/tooltip/tooltip.js.map +1 -1
  41. package/dist/esm/tree/tree.base.js +4 -5
  42. package/dist/esm/tree/tree.base.js.map +1 -1
  43. package/dist/esm/utils/direction.d.ts +13 -1
  44. package/dist/esm/utils/direction.js +8 -1
  45. package/dist/esm/utils/direction.js.map +1 -1
  46. package/dist/esm/utils/index.d.ts +2 -0
  47. package/dist/esm/utils/index.js +2 -0
  48. package/dist/esm/utils/index.js.map +1 -1
  49. package/dist/esm/utils/numbers.d.ts +5 -0
  50. package/dist/esm/utils/numbers.js +9 -0
  51. package/dist/esm/utils/numbers.js.map +1 -0
  52. package/dist/esm/utils/orientation.d.ts +13 -0
  53. package/dist/esm/utils/orientation.js +10 -0
  54. package/dist/esm/utils/orientation.js.map +1 -0
  55. package/dist/esm/utils/typings.d.ts +4 -0
  56. package/dist/esm/utils/typings.js +6 -0
  57. package/dist/esm/utils/typings.js.map +1 -1
  58. package/dist/web-components.d.ts +30 -2
  59. package/dist/web-components.js +61 -125
  60. package/dist/web-components.min.js +177 -177
  61. package/package.json +3 -5
@@ -1,12 +1,10 @@
1
1
  import { CaptureType } from '@microsoft/fast-element';
2
2
  import { CSSDirective } from '@microsoft/fast-element';
3
- import { Direction } from '@microsoft/fast-web-utilities';
4
3
  import { ElementStyles } from '@microsoft/fast-element';
5
4
  import { ElementViewTemplate } from '@microsoft/fast-element';
6
5
  import { FASTElement } from '@microsoft/fast-element';
7
6
  import { FASTElementDefinition } from '@microsoft/fast-element';
8
7
  import { HTMLDirective } from '@microsoft/fast-element';
9
- import { Orientation } from '@microsoft/fast-web-utilities';
10
8
  import { SyntheticViewTemplate } from '@microsoft/fast-element';
11
9
  import { ViewTemplate } from '@microsoft/fast-element';
12
10
 
@@ -6806,6 +6804,21 @@ export declare const DialogType: {
6806
6804
 
6807
6805
  export declare type DialogType = ValuesOf<typeof DialogType>;
6808
6806
 
6807
+ /**
6808
+ * Expose ltr and rtl strings
6809
+ * @public
6810
+ */
6811
+ export declare const Direction: {
6812
+ readonly ltr: "ltr";
6813
+ readonly rtl: "rtl";
6814
+ };
6815
+
6816
+ /**
6817
+ * The direction type
6818
+ * @public
6819
+ */
6820
+ export declare type Direction = (typeof Direction)[keyof typeof Direction];
6821
+
6809
6822
  /**
6810
6823
  * Applies a CSS display property.
6811
6824
  * Also adds CSS rules to not display the element when the [hidden] attribute is applied to the element.
@@ -9018,6 +9031,21 @@ export declare const MessageBarStyles: ElementStyles;
9018
9031
  */
9019
9032
  export declare const MessageBarTemplate: ElementViewTemplate<MessageBar>;
9020
9033
 
9034
+ /**
9035
+ * Standard orientation values
9036
+ * @public
9037
+ */
9038
+ export declare const Orientation: {
9039
+ readonly horizontal: "horizontal";
9040
+ readonly vertical: "vertical";
9041
+ };
9042
+
9043
+ /**
9044
+ * The orientation type
9045
+ * @public
9046
+ */
9047
+ export declare type Orientation = (typeof Orientation)[keyof typeof Orientation];
9048
+
9021
9049
  /**
9022
9050
  * A Progress HTML Element.
9023
9051
  * Based on BaseProgressBar and includes style and layout specific attributes
@@ -12,6 +12,9 @@ function isCustomElement(tagSuffix) {
12
12
  return element.tagName.toLowerCase().endsWith(tagSuffix);
13
13
  };
14
14
  }
15
+ function isHTMLElement(...args) {
16
+ return args.every(arg => arg instanceof HTMLElement);
17
+ }
15
18
 
16
19
  function isAccordionItem(element, tagName2 = "-accordion-item") {
17
20
  return isCustomElement(tagName2)(element);
@@ -4646,81 +4649,6 @@ function swapStates(elementInternals, prev = "", next = "", States, prefix = "")
4646
4649
  }
4647
4650
  }
4648
4651
 
4649
- /**
4650
- * Standard orientation values
4651
- */
4652
- const Orientation = {
4653
- horizontal: "horizontal",
4654
- vertical: "vertical"
4655
- };
4656
-
4657
- /**
4658
- * Returns the index of the last element in the array where predicate is true, and -1 otherwise.
4659
- *
4660
- * @param array - the array to test
4661
- * @param predicate - find calls predicate once for each element of the array, in descending order, until it finds one where predicate returns true. If such an element is found, findLastIndex immediately returns that element index. Otherwise, findIndex returns -1.
4662
- */
4663
- function findLastIndex(array, predicate) {
4664
- let k = array.length;
4665
- while (k--) {
4666
- if (predicate(array[k], k, array)) {
4667
- return k;
4668
- }
4669
- }
4670
- return -1;
4671
- }
4672
-
4673
- /**
4674
- * A test that ensures that all arguments are HTML Elements
4675
- */
4676
- function isHTMLElement(...args) {
4677
- return args.every(arg => arg instanceof HTMLElement);
4678
- }
4679
-
4680
- /**
4681
- * String values for use with KeyboardEvent.key
4682
- */
4683
- const keyArrowDown = "ArrowDown";
4684
- const keyArrowLeft = "ArrowLeft";
4685
- const keyArrowRight = "ArrowRight";
4686
- const keyArrowUp = "ArrowUp";
4687
- const keyEnd = "End";
4688
- const keyEnter = "Enter";
4689
- const keyEscape = "Escape";
4690
- const keyHome = "Home";
4691
- const keySpace = " ";
4692
- const keyTab = "Tab";
4693
-
4694
- /**
4695
- * Expose ltr and rtl strings
4696
- */
4697
- var Direction;
4698
- (function (Direction) {
4699
- Direction["ltr"] = "ltr";
4700
- Direction["rtl"] = "rtl";
4701
- })(Direction || (Direction = {}));
4702
-
4703
- /**
4704
- * This method keeps a given value within the bounds of a min and max value. If the value
4705
- * is larger than the max, the minimum value will be returned. If the value is smaller than the minimum,
4706
- * the maximum will be returned. Otherwise, the value is returned un-changed.
4707
- */
4708
- /**
4709
- * Ensures that a value is between a min and max value. If value is lower than min, min will be returned.
4710
- * If value is greater than max, max will be returned.
4711
- */
4712
- function limit(min, max, value) {
4713
- return Math.min(Math.max(value, min), max);
4714
- }
4715
-
4716
- let uniqueIdCounter$1 = 0;
4717
- /**
4718
- * Generates a unique ID based on incrementing a counter.
4719
- */
4720
- function uniqueId$1(prefix = "") {
4721
- return `${prefix}${uniqueIdCounter$1++}`;
4722
- }
4723
-
4724
4652
  var __defProp$L = Object.defineProperty;
4725
4653
  var __getOwnPropDesc$L = Object.getOwnPropertyDescriptor;
4726
4654
  var __decorateClass$L = (decorators, target, key, kind) => {
@@ -4803,7 +4731,7 @@ class BaseAnchor extends FASTElement {
4803
4731
  */
4804
4732
  keydownHandler(e) {
4805
4733
  if (this.href) {
4806
- if (e.key === keyEnter) {
4734
+ if (e.key === "Enter") {
4807
4735
  const newTab = !this.isMac ? e.ctrlKey : e.metaKey || e.ctrlKey;
4808
4736
  this.handleNavigation(newTab);
4809
4737
  return;
@@ -5706,7 +5634,7 @@ class BaseButton extends FASTElement {
5706
5634
  e.stopImmediatePropagation();
5707
5635
  return;
5708
5636
  }
5709
- if (e.key === keyEnter || e.key === keySpace) {
5637
+ if (e.key === "Enter" || e.key === " ") {
5710
5638
  this.click();
5711
5639
  return;
5712
5640
  }
@@ -6641,6 +6569,11 @@ const definition$v = DialogBody.compose({
6641
6569
 
6642
6570
  definition$v.define(FluentDesignSystem.registry);
6643
6571
 
6572
+ const Orientation = {
6573
+ horizontal: "horizontal",
6574
+ vertical: "vertical"
6575
+ };
6576
+
6644
6577
  const DividerRole = {
6645
6578
  /**
6646
6579
  * The divider semantically separates content
@@ -7087,6 +7020,10 @@ function isDropdownOption(value, tagName2 = "-option") {
7087
7020
  }
7088
7021
  const tagName$p = `${FluentDesignSystem.prefix}-option`;
7089
7022
 
7023
+ const Direction = {
7024
+ ltr: "ltr",
7025
+ rtl: "rtl"
7026
+ };
7090
7027
  const getDirection = rootNode => {
7091
7028
  return rootNode.closest("[dir]")?.dir === "rtl" ? Direction.rtl : Direction.ltr;
7092
7029
  };
@@ -8094,7 +8031,7 @@ class BaseField extends FASTElement {
8094
8031
  */
8095
8032
  setLabelProperties() {
8096
8033
  if (this.$fastController.isConnected) {
8097
- this.input.id = this.input.id || uniqueId$1("input");
8034
+ this.input.id = this.input.id || uniqueId("input");
8098
8035
  this.labelSlot?.forEach(label => {
8099
8036
  if (label instanceof HTMLLabelElement) {
8100
8037
  label.htmlFor = label.htmlFor || this.input.id;
@@ -8558,17 +8495,17 @@ class MenuItem extends FASTElement {
8558
8495
  return false;
8559
8496
  }
8560
8497
  switch (e.key) {
8561
- case keyEnter:
8562
- case keySpace:
8498
+ case "Enter":
8499
+ case " ":
8563
8500
  this.invoke();
8564
8501
  return false;
8565
- case keyArrowRight:
8502
+ case "ArrowRight":
8566
8503
  if (!this.disabled) {
8567
8504
  this.submenu?.togglePopover(true);
8568
8505
  this.submenu?.focus();
8569
8506
  }
8570
8507
  return false;
8571
- case keyArrowLeft:
8508
+ case "ArrowLeft":
8572
8509
  if (this.parentElement?.hasAttribute("popover")) {
8573
8510
  this.parentElement.togglePopover(false);
8574
8511
  this.parentElement.parentElement?.focus();
@@ -9109,7 +9046,6 @@ var FocusGroup = class {
9109
9046
  const current = evt.composedPath()[0];
9110
9047
  if (evt.defaultPrevented || current === this.#owner) return;
9111
9048
  if (!this.#items.contains(current)) return;
9112
- evt.stopPropagation();
9113
9049
  let target;
9114
9050
  switch (getNavigationDirection(evt, current, this.#axis)) {
9115
9051
  case "start":
@@ -9159,25 +9095,21 @@ var FocusGroup = class {
9159
9095
  const tabStop = this.#memory ? this.#current || this.#start : this.#start;
9160
9096
  if (tabStop) this.#enableFocusabilityProxy(tabStop);
9161
9097
  }
9162
- if (evt.relatedTarget && this.#owner.contains(evt.relatedTarget) || this.#memory || !this.#start) return;
9163
- if (!this.#memory && this.#start) {
9164
- const prev = this.#current;
9165
- this.#current = null;
9166
- const nextStart = this.#items.start ?? this.#items.first?.() ?? null;
9167
- if (prev !== this.#start || nextStart !== this.#start) {
9168
- for (const {
9169
- element,
9170
- segmentBoundary
9171
- } of this.#items.items()) element.tabIndex = segmentBoundary ? 0 : -1;
9172
- if (nextStart) {
9173
- nextStart.tabIndex = 0;
9174
- this.#start = nextStart;
9175
- }
9176
- this.#items.flush?.();
9098
+ if (evt.relatedTarget && nodeContains(this.#owner, evt.relatedTarget) || this.#memory || !this.#start) return;
9099
+ const prev = this.#current;
9100
+ this.#current = null;
9101
+ const nextStart = this.#items.start ?? this.#items.first?.() ?? null;
9102
+ if (prev !== this.#start || nextStart !== this.#start) {
9103
+ for (const {
9104
+ element,
9105
+ segmentBoundary
9106
+ } of this.#items.items()) element.tabIndex = segmentBoundary ? 0 : -1;
9107
+ if (nextStart) {
9108
+ nextStart.tabIndex = 0;
9109
+ this.#start = nextStart;
9177
9110
  }
9111
+ this.#items.flush?.();
9178
9112
  }
9179
- const tabStop = this.#memory ? this.#current || this.#start : this.#start;
9180
- if (tabStop) this.#enableFocusabilityProxy(tabStop);
9181
9113
  }
9182
9114
  /**
9183
9115
  * If the tab stop is inside a shadow DOM, sets `tabindex=0` on the
@@ -9513,8 +9445,8 @@ class Menu extends FASTElement {
9513
9445
  }
9514
9446
  const key = e.key;
9515
9447
  switch (key) {
9516
- case keySpace:
9517
- case keyEnter:
9448
+ case " ":
9449
+ case "Enter":
9518
9450
  e.preventDefault();
9519
9451
  this.toggleMenu();
9520
9452
  break;
@@ -9731,14 +9663,14 @@ class Menu extends FASTElement {
9731
9663
  }
9732
9664
  const key = e.key;
9733
9665
  switch (key) {
9734
- case keyEscape:
9666
+ case "Escape":
9735
9667
  e.preventDefault();
9736
9668
  if (this._open) {
9737
9669
  this.closeMenu();
9738
9670
  this.focusTrigger();
9739
9671
  }
9740
9672
  break;
9741
- case keyTab:
9673
+ case "Tab":
9742
9674
  if (this._open) this.closeMenu();
9743
9675
  if (e.shiftKey && e.composedPath()[0] !== this._trigger && e.composedPath()[0].assignedSlot !== this.primaryAction) {
9744
9676
  this.focusTrigger();
@@ -10396,7 +10328,7 @@ class BaseRadioGroup extends FASTElement {
10396
10328
  if (!this.name && next.every(x => x.name === next[0].name)) {
10397
10329
  this.name = next[0].name;
10398
10330
  }
10399
- const checkedIndex = findLastIndex(this.enabledRadios, x => x.initialChecked);
10331
+ const checkedIndex = this.enabledRadios.findLastIndex(x => x.initialChecked);
10400
10332
  next.forEach((radio, index) => {
10401
10333
  radio.ariaPosInSet = `${index + 1}`;
10402
10334
  radio.ariaSetSize = `${setSize}`;
@@ -10605,15 +10537,15 @@ class BaseRadioGroup extends FASTElement {
10605
10537
  */
10606
10538
  keydownHandler(e) {
10607
10539
  switch (e.key) {
10608
- case keyArrowUp:
10609
- case keyArrowDown:
10610
- case keyArrowLeft:
10611
- case keyArrowRight:
10612
- case keyHome:
10613
- case keyEnd:
10540
+ case "ArrowUp":
10541
+ case "ArrowDown":
10542
+ case "ArrowLeft":
10543
+ case "ArrowRight":
10544
+ case "Home":
10545
+ case "End":
10614
10546
  this.isNavigating = true;
10615
10547
  break;
10616
- case keySpace:
10548
+ case " ":
10617
10549
  this.checkRadio();
10618
10550
  break;
10619
10551
  }
@@ -11025,6 +10957,10 @@ const SliderMode = {
11025
10957
  };
11026
10958
  const tagName$b = `${FluentDesignSystem.prefix}-slider`;
11027
10959
 
10960
+ function limit(min, max, value) {
10961
+ return Math.min(Math.max(value, min), max);
10962
+ }
10963
+
11028
10964
  const numberLikeStringConverter = {
11029
10965
  fromView(value) {
11030
10966
  const valueAsNumber = parseFloat(value);
@@ -11490,23 +11426,23 @@ class Slider extends FASTElement {
11490
11426
  return true;
11491
11427
  }
11492
11428
  switch (event.key) {
11493
- case keyHome:
11429
+ case "Home":
11494
11430
  event.preventDefault();
11495
11431
  this.value = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical ? `${this.minAsNumber}` : `${this.maxAsNumber}`;
11496
11432
  break;
11497
- case keyEnd:
11433
+ case "End":
11498
11434
  event.preventDefault();
11499
11435
  this.value = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical ? `${this.maxAsNumber}` : `${this.minAsNumber}`;
11500
11436
  break;
11501
- case keyArrowRight:
11502
- case keyArrowUp:
11437
+ case "ArrowRight":
11438
+ case "ArrowUp":
11503
11439
  if (!event.shiftKey) {
11504
11440
  event.preventDefault();
11505
11441
  this.increment();
11506
11442
  }
11507
11443
  break;
11508
- case keyArrowLeft:
11509
- case keyArrowDown:
11444
+ case "ArrowLeft":
11445
+ case "ArrowDown":
11510
11446
  if (!event.shiftKey) {
11511
11447
  event.preventDefault();
11512
11448
  this.decrement();
@@ -11867,7 +11803,7 @@ class BaseTablist extends FASTElement {
11867
11803
  if (tab.slot !== "tab") {
11868
11804
  continue;
11869
11805
  }
11870
- tab.id || (tab.id = uniqueId$1("tab-"));
11806
+ tab.id || (tab.id = uniqueId("tab-"));
11871
11807
  if (forceDisabled) {
11872
11808
  tab.disabled = this.disabled;
11873
11809
  } else {
@@ -13138,7 +13074,7 @@ class Tooltip extends FASTElement {
13138
13074
  * The attached element internals
13139
13075
  */
13140
13076
  this.elementInternals = this.attachInternals();
13141
- this.id = uniqueId$1("tooltip-");
13077
+ this.id = uniqueId("tooltip-");
13142
13078
  /**
13143
13079
  * The default delay for the tooltip
13144
13080
  * @internal
@@ -13389,7 +13325,7 @@ class BaseTree extends FASTElement {
13389
13325
  return true;
13390
13326
  }
13391
13327
  switch (e.key) {
13392
- case keyArrowLeft:
13328
+ case "ArrowLeft":
13393
13329
  {
13394
13330
  if (item?.childTreeItems?.length && item.expanded) {
13395
13331
  item.expanded = false;
@@ -13398,7 +13334,7 @@ class BaseTree extends FASTElement {
13398
13334
  }
13399
13335
  return;
13400
13336
  }
13401
- case keyArrowRight:
13337
+ case "ArrowRight":
13402
13338
  {
13403
13339
  if (item?.childTreeItems?.length) {
13404
13340
  if (!item.expanded) {
@@ -13407,12 +13343,12 @@ class BaseTree extends FASTElement {
13407
13343
  }
13408
13344
  return;
13409
13345
  }
13410
- case keyEnter:
13346
+ case "Enter":
13411
13347
  {
13412
13348
  this.clickHandler(e);
13413
13349
  return;
13414
13350
  }
13415
- case keySpace:
13351
+ case " ":
13416
13352
  {
13417
13353
  item.selected = true;
13418
13354
  return;
@@ -13887,7 +13823,7 @@ function getShadowAdoptedStyleSheet(element) {
13887
13823
  }
13888
13824
  function getScopedThemeKey(theme) {
13889
13825
  if (!scopedThemeKeyMap.has(theme)) {
13890
- const themeKey = uniqueId$1("fluent-theme-");
13826
+ const themeKey = uniqueId("fluent-theme-");
13891
13827
  const scopedThemeStyleSheet = new CSSStyleSheet();
13892
13828
  scopedThemeKeyMap.set(theme, themeKey);
13893
13829
  scopedThemeStyleSheet.replaceSync(`