@ni/nimble-components 7.8.2 → 8.0.1

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 (31) hide show
  1. package/dist/all-components-bundle.js +436 -104
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +657 -637
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/all-components.d.ts +2 -1
  6. package/dist/esm/all-components.js +2 -1
  7. package/dist/esm/all-components.js.map +1 -1
  8. package/dist/esm/{listbox-option → list-option}/index.d.ts +2 -2
  9. package/dist/esm/{listbox-option → list-option}/index.js +4 -4
  10. package/dist/esm/list-option/index.js.map +1 -0
  11. package/dist/esm/{listbox-option → list-option}/styles.d.ts +0 -0
  12. package/dist/esm/{listbox-option → list-option}/styles.js +0 -0
  13. package/dist/esm/list-option/styles.js.map +1 -0
  14. package/dist/esm/nimble-components/src/all-components.d.ts +2 -1
  15. package/dist/esm/nimble-components/src/{listbox-option → list-option}/index.d.ts +2 -2
  16. package/dist/esm/nimble-components/src/{listbox-option → list-option}/styles.d.ts +0 -0
  17. package/dist/esm/nimble-components/src/select/index.d.ts +0 -1
  18. package/dist/esm/nimble-components/src/tree-item/index.d.ts +0 -4
  19. package/dist/esm/nimble-components/src/tree-view/index.d.ts +3 -0
  20. package/dist/esm/select/index.d.ts +0 -1
  21. package/dist/esm/select/index.js +0 -5
  22. package/dist/esm/select/index.js.map +1 -1
  23. package/dist/esm/tree-item/index.d.ts +0 -4
  24. package/dist/esm/tree-item/index.js +2 -45
  25. package/dist/esm/tree-item/index.js.map +1 -1
  26. package/dist/esm/tree-view/index.d.ts +3 -0
  27. package/dist/esm/tree-view/index.js +38 -1
  28. package/dist/esm/tree-view/index.js.map +1 -1
  29. package/package.json +1 -1
  30. package/dist/esm/listbox-option/index.js.map +0 -1
  31. package/dist/esm/listbox-option/styles.js.map +0 -1
@@ -4305,6 +4305,12 @@
4305
4305
  });
4306
4306
  }
4307
4307
 
4308
+ var Orientation;
4309
+ (function (Orientation) {
4310
+ Orientation["horizontal"] = "horizontal";
4311
+ Orientation["vertical"] = "vertical";
4312
+ })(Orientation || (Orientation = {}));
4313
+
4308
4314
  /**
4309
4315
  * Returns the index of the last element in the array where predicate is true, and -1 otherwise.
4310
4316
  *
@@ -4490,6 +4496,12 @@
4490
4496
  const keyEnd = "End";
4491
4497
  const keySpace = " ";
4492
4498
  const keyTab = "Tab";
4499
+ const ArrowKeys = {
4500
+ ArrowDown: keyArrowDown,
4501
+ ArrowLeft: keyArrowLeft,
4502
+ ArrowRight: keyArrowRight,
4503
+ ArrowUp: keyArrowUp,
4504
+ };
4493
4505
 
4494
4506
  /**
4495
4507
  * Expose ltr and rtl strings
@@ -4514,6 +4526,13 @@
4514
4526
  }
4515
4527
  return value;
4516
4528
  }
4529
+ /**
4530
+ * Ensures that a value is between a min and max value. If value is lower than min, min will be returned.
4531
+ * If value is greater than max, max will be returned.
4532
+ */
4533
+ function limit(min, max, value) {
4534
+ return Math.min(Math.max(value, min), max);
4535
+ }
4517
4536
 
4518
4537
  let uniqueIdCounter = 0;
4519
4538
  /**
@@ -6699,7 +6718,7 @@
6699
6718
  *
6700
6719
  * @public
6701
6720
  */
6702
- class ListboxOption$1 extends FoundationElement {
6721
+ class ListboxOption extends FoundationElement {
6703
6722
  constructor(text, value, defaultSelected, selected) {
6704
6723
  super();
6705
6724
  /**
@@ -6815,22 +6834,22 @@
6815
6834
  }
6816
6835
  __decorate$1([
6817
6836
  observable
6818
- ], ListboxOption$1.prototype, "checked", void 0);
6837
+ ], ListboxOption.prototype, "checked", void 0);
6819
6838
  __decorate$1([
6820
6839
  observable
6821
- ], ListboxOption$1.prototype, "defaultSelected", void 0);
6840
+ ], ListboxOption.prototype, "defaultSelected", void 0);
6822
6841
  __decorate$1([
6823
6842
  attr({ mode: "boolean" })
6824
- ], ListboxOption$1.prototype, "disabled", void 0);
6843
+ ], ListboxOption.prototype, "disabled", void 0);
6825
6844
  __decorate$1([
6826
6845
  attr({ attribute: "selected", mode: "boolean" })
6827
- ], ListboxOption$1.prototype, "selectedAttribute", void 0);
6846
+ ], ListboxOption.prototype, "selectedAttribute", void 0);
6828
6847
  __decorate$1([
6829
6848
  observable
6830
- ], ListboxOption$1.prototype, "selected", void 0);
6849
+ ], ListboxOption.prototype, "selected", void 0);
6831
6850
  __decorate$1([
6832
6851
  attr({ attribute: "value", mode: "fromView" })
6833
- ], ListboxOption$1.prototype, "initialValue", void 0);
6852
+ ], ListboxOption.prototype, "initialValue", void 0);
6834
6853
  /**
6835
6854
  * States and properties relating to the ARIA `option` role.
6836
6855
  *
@@ -6851,7 +6870,7 @@
6851
6870
  observable
6852
6871
  ], DelegatesARIAListboxOption.prototype, "ariaSetSize", void 0);
6853
6872
  applyMixins(DelegatesARIAListboxOption, ARIAGlobalStatesAndProperties);
6854
- applyMixins(ListboxOption$1, StartEnd, DelegatesARIAListboxOption);
6873
+ applyMixins(ListboxOption, StartEnd, DelegatesARIAListboxOption);
6855
6874
 
6856
6875
  /**
6857
6876
  * A Listbox Custom HTML Element.
@@ -8797,6 +8816,22 @@
8797
8816
  return isNodeMatchingSelectorTabbable(options, node);
8798
8817
  };
8799
8818
 
8819
+ var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe').join(',');
8820
+
8821
+ var isFocusable = function isFocusable(node, options) {
8822
+ options = options || {};
8823
+
8824
+ if (!node) {
8825
+ throw new Error('No node provided');
8826
+ }
8827
+
8828
+ if (matches.call(node, focusableCandidateSelector) === false) {
8829
+ return false;
8830
+ }
8831
+
8832
+ return isNodeMatchingSelectorFocusable(options, node);
8833
+ };
8834
+
8800
8835
  /**
8801
8836
  * A Switch Custom HTML Element.
8802
8837
  * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#dialog | ARIA dialog }.
@@ -11434,6 +11469,272 @@
11434
11469
  </template>
11435
11470
  `;
11436
11471
 
11472
+ /**
11473
+ * The template for the {@link @microsoft/fast-foundation#(Toolbar:class)} component.
11474
+ *
11475
+ * @public
11476
+ */
11477
+ const toolbarTemplate = (context, definition) => html `
11478
+ <template
11479
+ aria-label="${x => x.ariaLabel}"
11480
+ aria-labelledby="${x => x.ariaLabelledby}"
11481
+ aria-orientation="${x => x.orientation}"
11482
+ orientation="${x => x.orientation}"
11483
+ role="toolbar"
11484
+ @click="${(x, c) => x.clickHandler(c.event)}"
11485
+ @focusin="${(x, c) => x.focusinHandler(c.event)}"
11486
+ @keydown="${(x, c) => x.keydownHandler(c.event)}"
11487
+ >
11488
+ <slot name="label"></slot>
11489
+ <div class="positioning-region" part="positioning-region">
11490
+ ${startSlotTemplate(context, definition)}
11491
+ <slot
11492
+ ${slotted({
11493
+ filter: elements(),
11494
+ property: "slottedItems",
11495
+ })}
11496
+ ></slot>
11497
+ ${endSlotTemplate(context, definition)}
11498
+ </div>
11499
+ </template>
11500
+ `;
11501
+
11502
+ /**
11503
+ * A map for directionality derived from keyboard input strings,
11504
+ * visual orientation, and text direction.
11505
+ *
11506
+ * @internal
11507
+ */
11508
+ const ToolbarArrowKeyMap = Object.freeze({
11509
+ [ArrowKeys.ArrowUp]: {
11510
+ [Orientation.vertical]: -1,
11511
+ },
11512
+ [ArrowKeys.ArrowDown]: {
11513
+ [Orientation.vertical]: 1,
11514
+ },
11515
+ [ArrowKeys.ArrowLeft]: {
11516
+ [Orientation.horizontal]: {
11517
+ [Direction.ltr]: -1,
11518
+ [Direction.rtl]: 1,
11519
+ },
11520
+ },
11521
+ [ArrowKeys.ArrowRight]: {
11522
+ [Orientation.horizontal]: {
11523
+ [Direction.ltr]: 1,
11524
+ [Direction.rtl]: -1,
11525
+ },
11526
+ },
11527
+ });
11528
+ /**
11529
+ * A Toolbar Custom HTML Element.
11530
+ * Implements the {@link https://w3c.github.io/aria-practices/#Toolbar|ARIA Toolbar}.
11531
+ *
11532
+ * @public
11533
+ */
11534
+ class Toolbar$1 extends FoundationElement {
11535
+ constructor() {
11536
+ super(...arguments);
11537
+ /**
11538
+ * The internal index of the currently focused element.
11539
+ *
11540
+ * @internal
11541
+ */
11542
+ this._activeIndex = 0;
11543
+ /**
11544
+ * The text direction of the toolbar.
11545
+ *
11546
+ * @internal
11547
+ */
11548
+ this.direction = Direction.ltr;
11549
+ /**
11550
+ * The orientation of the toolbar.
11551
+ *
11552
+ * @public
11553
+ * @remarks
11554
+ * HTML Attribute: `orientation`
11555
+ */
11556
+ this.orientation = Orientation.horizontal;
11557
+ }
11558
+ /**
11559
+ * The index of the currently focused element, clamped between 0 and the last element.
11560
+ *
11561
+ * @internal
11562
+ */
11563
+ get activeIndex() {
11564
+ Observable.track(this, "activeIndex");
11565
+ return this._activeIndex;
11566
+ }
11567
+ set activeIndex(value) {
11568
+ if (this.$fastController.isConnected) {
11569
+ this._activeIndex = limit(0, this.focusableElements.length - 1, value);
11570
+ Observable.notify(this, "activeIndex");
11571
+ }
11572
+ }
11573
+ slottedItemsChanged() {
11574
+ if (this.$fastController.isConnected) {
11575
+ this.reduceFocusableElements();
11576
+ }
11577
+ }
11578
+ /**
11579
+ * Set the activeIndex when a focusable element in the toolbar is clicked.
11580
+ *
11581
+ * @internal
11582
+ */
11583
+ clickHandler(e) {
11584
+ var _a;
11585
+ const activeIndex = (_a = this.focusableElements) === null || _a === void 0 ? void 0 : _a.indexOf(e.target);
11586
+ if (activeIndex > -1 && this.activeIndex !== activeIndex) {
11587
+ this.setFocusedElement(activeIndex);
11588
+ }
11589
+ return true;
11590
+ }
11591
+ /**
11592
+ * @internal
11593
+ */
11594
+ connectedCallback() {
11595
+ super.connectedCallback();
11596
+ this.direction = getDirection(this);
11597
+ }
11598
+ /**
11599
+ * When the toolbar receives focus, set the currently active element as focused.
11600
+ *
11601
+ * @internal
11602
+ */
11603
+ focusinHandler(e) {
11604
+ const relatedTarget = e.relatedTarget;
11605
+ if (!relatedTarget || this.contains(relatedTarget)) {
11606
+ return;
11607
+ }
11608
+ this.setFocusedElement();
11609
+ }
11610
+ /**
11611
+ * Determines a value that can be used to iterate a list with the arrow keys.
11612
+ *
11613
+ * @param this - An element with an orientation and direction
11614
+ * @param key - The event key value
11615
+ * @internal
11616
+ */
11617
+ getDirectionalIncrementer(key) {
11618
+ var _a, _b, _c, _d, _e;
11619
+ return ((_e = (_c = (_b = (_a = ToolbarArrowKeyMap[key]) === null || _a === void 0 ? void 0 : _a[this.orientation]) === null || _b === void 0 ? void 0 : _b[this.direction]) !== null && _c !== void 0 ? _c : (_d = ToolbarArrowKeyMap[key]) === null || _d === void 0 ? void 0 : _d[this.orientation]) !== null && _e !== void 0 ? _e : 0);
11620
+ }
11621
+ /**
11622
+ * Handle keyboard events for the toolbar.
11623
+ *
11624
+ * @internal
11625
+ */
11626
+ keydownHandler(e) {
11627
+ const key = e.key;
11628
+ if (!(key in ArrowKeys) || e.defaultPrevented || e.shiftKey) {
11629
+ return true;
11630
+ }
11631
+ const incrementer = this.getDirectionalIncrementer(key);
11632
+ if (!incrementer) {
11633
+ return !e.target.closest("[role=radiogroup]");
11634
+ }
11635
+ const nextIndex = this.activeIndex + incrementer;
11636
+ if (this.focusableElements[nextIndex]) {
11637
+ e.preventDefault();
11638
+ }
11639
+ this.setFocusedElement(nextIndex);
11640
+ return true;
11641
+ }
11642
+ /**
11643
+ * get all the slotted elements
11644
+ * @internal
11645
+ */
11646
+ get allSlottedItems() {
11647
+ return [
11648
+ ...this.start.assignedElements(),
11649
+ ...this.slottedItems,
11650
+ ...this.end.assignedElements(),
11651
+ ];
11652
+ }
11653
+ /**
11654
+ * Prepare the slotted elements which can be focusable.
11655
+ *
11656
+ * @internal
11657
+ */
11658
+ reduceFocusableElements() {
11659
+ this.focusableElements = this.allSlottedItems.reduce(Toolbar$1.reduceFocusableItems, []);
11660
+ this.setFocusableElements();
11661
+ }
11662
+ /**
11663
+ * Set the activeIndex and focus the corresponding control.
11664
+ *
11665
+ * @param activeIndex - The new index to set
11666
+ * @internal
11667
+ */
11668
+ setFocusedElement(activeIndex = this.activeIndex) {
11669
+ var _a;
11670
+ this.activeIndex = activeIndex;
11671
+ this.setFocusableElements();
11672
+ (_a = this.focusableElements[this.activeIndex]) === null || _a === void 0 ? void 0 : _a.focus();
11673
+ }
11674
+ /**
11675
+ * Reduce a collection to only its focusable elements.
11676
+ *
11677
+ * @param elements - Collection of elements to reduce
11678
+ * @param element - The current element
11679
+ *
11680
+ * @internal
11681
+ */
11682
+ static reduceFocusableItems(elements, element) {
11683
+ var _a, _b, _c, _d;
11684
+ const isRoleRadio = element.getAttribute("role") === "radio";
11685
+ const isFocusableFastElement = (_b = (_a = element.$fastController) === null || _a === void 0 ? void 0 : _a.definition.shadowOptions) === null || _b === void 0 ? void 0 : _b.delegatesFocus;
11686
+ 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));
11687
+ if (isFocusable(element) ||
11688
+ isRoleRadio ||
11689
+ isFocusableFastElement ||
11690
+ hasFocusableShadow) {
11691
+ elements.push(element);
11692
+ return elements;
11693
+ }
11694
+ if (element.childElementCount) {
11695
+ return elements.concat(Array.from(element.children).reduce(Toolbar$1.reduceFocusableItems, []));
11696
+ }
11697
+ return elements;
11698
+ }
11699
+ /**
11700
+ * @internal
11701
+ */
11702
+ setFocusableElements() {
11703
+ if (this.$fastController.isConnected && this.focusableElements.length > 0) {
11704
+ this.focusableElements.forEach((element, index) => {
11705
+ element.tabIndex = this.activeIndex === index ? 0 : -1;
11706
+ });
11707
+ }
11708
+ }
11709
+ }
11710
+ __decorate$1([
11711
+ observable
11712
+ ], Toolbar$1.prototype, "direction", void 0);
11713
+ __decorate$1([
11714
+ attr
11715
+ ], Toolbar$1.prototype, "orientation", void 0);
11716
+ __decorate$1([
11717
+ observable
11718
+ ], Toolbar$1.prototype, "slottedItems", void 0);
11719
+ __decorate$1([
11720
+ observable
11721
+ ], Toolbar$1.prototype, "slottedLabel", void 0);
11722
+ /**
11723
+ * Includes ARIA states and properties relating to the ARIA toolbar role
11724
+ *
11725
+ * @public
11726
+ */
11727
+ class DelegatesARIAToolbar {
11728
+ }
11729
+ __decorate$1([
11730
+ attr({ attribute: "aria-labelledby" })
11731
+ ], DelegatesARIAToolbar.prototype, "ariaLabelledby", void 0);
11732
+ __decorate$1([
11733
+ attr({ attribute: "aria-label" })
11734
+ ], DelegatesARIAToolbar.prototype, "ariaLabel", void 0);
11735
+ applyMixins(DelegatesARIAToolbar, ARIAGlobalStatesAndProperties);
11736
+ applyMixins(Toolbar$1, StartEnd, DelegatesARIAToolbar);
11737
+
11437
11738
  /**
11438
11739
  * The template for the {@link @microsoft/fast-foundation#(TreeItem:class)} component.
11439
11740
  * @public
@@ -12217,7 +12518,7 @@
12217
12518
 
12218
12519
  const template$4 = html `<slot></slot>`;
12219
12520
 
12220
- const styles$m = css `
12521
+ const styles$n = css `
12221
12522
  :host {
12222
12523
  display: contents;
12223
12524
  }
@@ -12273,7 +12574,7 @@
12273
12574
  ], ThemeProvider.prototype, "theme", void 0);
12274
12575
  const nimbleDesignSystemProvider = ThemeProvider.compose({
12275
12576
  baseName: 'theme-provider',
12276
- styles: styles$m,
12577
+ styles: styles$n,
12277
12578
  template: template$4
12278
12579
  });
12279
12580
  DesignSystem.getOrCreate()
@@ -12518,7 +12819,7 @@
12518
12819
  */
12519
12820
  const themeBehavior = (lightStyle, darkStyleOrAlias, colorStyleOrAlias) => new ThemeStyleSheetBehavior(lightStyle, darkStyleOrAlias, colorStyleOrAlias);
12520
12821
 
12521
- const styles$l = css `
12822
+ const styles$m = css `
12522
12823
  ${display('inline-block')}
12523
12824
 
12524
12825
  :host {
@@ -12581,7 +12882,7 @@
12581
12882
  baseName: 'breadcrumb',
12582
12883
  baseClass: Breadcrumb$1,
12583
12884
  template: breadcrumbTemplate,
12584
- styles: styles$l
12885
+ styles: styles$m
12585
12886
  });
12586
12887
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleBreadcrumb());
12587
12888
 
@@ -13167,7 +13468,7 @@
13167
13468
  */
13168
13469
  const focusVisible = `:${focusVisible$1}`;
13169
13470
 
13170
- const styles$k = css `
13471
+ const styles$l = css `
13171
13472
  ${display('inline-flex')}
13172
13473
 
13173
13474
  :host {
@@ -13247,7 +13548,7 @@
13247
13548
  baseName: 'breadcrumb-item',
13248
13549
  baseClass: BreadcrumbItem$1,
13249
13550
  template: breadcrumbItemTemplate,
13250
- styles: styles$k,
13551
+ styles: styles$l,
13251
13552
  separator: forwardSlash16X16.data
13252
13553
  });
13253
13554
  DesignSystem.getOrCreate()
@@ -13278,7 +13579,7 @@
13278
13579
  ButtonAppearance["Block"] = "block";
13279
13580
  })(ButtonAppearance || (ButtonAppearance = {}));
13280
13581
 
13281
- const styles$j = css `
13582
+ const styles$k = css `
13282
13583
  ${display('inline-flex')}
13283
13584
 
13284
13585
  :host {
@@ -13481,7 +13782,7 @@
13481
13782
  `));
13482
13783
 
13483
13784
  // prettier-ignore
13484
- const styles$i = styles$j
13785
+ const styles$j = styles$k
13485
13786
  .withBehaviors(appearanceBehavior(ButtonAppearance.Outline, css `
13486
13787
  :host(.primary) .control {
13487
13788
  box-shadow: 0px 0px 0px ${borderWidth} rgba(${actionRgbPartialColor}, 0.3) inset;
@@ -13601,14 +13902,14 @@
13601
13902
  baseName: 'button',
13602
13903
  baseClass: Button$1,
13603
13904
  template: buttonTemplate,
13604
- styles: styles$i,
13905
+ styles: styles$j,
13605
13906
  shadowOptions: {
13606
13907
  delegatesFocus: true
13607
13908
  }
13608
13909
  });
13609
13910
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleButton());
13610
13911
 
13611
- const styles$h = css `
13912
+ const styles$i = css `
13612
13913
  ${display('inline-flex')}
13613
13914
 
13614
13915
  :host {
@@ -13726,7 +14027,7 @@
13726
14027
  baseName: 'checkbox',
13727
14028
  baseClass: Checkbox$1,
13728
14029
  template: checkboxTemplate,
13729
- styles: styles$h,
14030
+ styles: styles$i,
13730
14031
  checkedIndicator: check16X16.data,
13731
14032
  indeterminateIndicator: minus16X16.data
13732
14033
  });
@@ -14811,7 +15112,7 @@
14811
15112
  slideOutOptions
14812
15113
  };
14813
15114
 
14814
- const styles$g = css `
15115
+ const styles$h = css `
14815
15116
  ${display('block')}
14816
15117
 
14817
15118
  :host {
@@ -15118,7 +15419,7 @@
15118
15419
  const nimbleDrawer = Drawer.compose({
15119
15420
  baseName: 'drawer',
15120
15421
  template: dialogTemplate,
15121
- styles: styles$g
15422
+ styles: styles$h
15122
15423
  });
15123
15424
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleDrawer());
15124
15425
 
@@ -15128,7 +15429,7 @@
15128
15429
  </template
15129
15430
  `;
15130
15431
 
15131
- const styles$f = css `
15432
+ const styles$g = css `
15132
15433
  ${display('inline-flex')}
15133
15434
 
15134
15435
  :host {
@@ -15175,7 +15476,7 @@
15175
15476
  const composedIcon = iconClass.compose({
15176
15477
  baseName,
15177
15478
  template: template$3,
15178
- styles: styles$f,
15479
+ styles: styles$g,
15179
15480
  baseClass: iconClass
15180
15481
  });
15181
15482
  DesignSystem.getOrCreate().withPrefix('nimble').register(composedIcon());
@@ -16743,7 +17044,7 @@
16743
17044
  }
16744
17045
  registerIcon('xmark-check-icon', XmarkCheckIcon);
16745
17046
 
16746
- const styles$e = css `
17047
+ const styles$f = css `
16747
17048
  ${display('flex')}
16748
17049
 
16749
17050
  :host {
@@ -16801,7 +17102,7 @@
16801
17102
  /**
16802
17103
  * A nimble-styled HTML listbox option
16803
17104
  */
16804
- class ListboxOption extends ListboxOption$1 {
17105
+ class ListOption extends ListboxOption {
16805
17106
  // Workaround for https://github.com/microsoft/fast/issues/5219
16806
17107
  get value() {
16807
17108
  return super.value;
@@ -16818,15 +17119,15 @@
16818
17119
  this.setAttribute('value', this.value);
16819
17120
  }
16820
17121
  }
16821
- const nimbleListboxOption = ListboxOption.compose({
16822
- baseName: 'listbox-option',
16823
- baseClass: ListboxOption$1,
17122
+ const nimbleListOption = ListOption.compose({
17123
+ baseName: 'list-option',
17124
+ baseClass: ListboxOption,
16824
17125
  template: listboxOptionTemplate,
16825
- styles: styles$e
17126
+ styles: styles$f
16826
17127
  });
16827
- DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleListboxOption());
17128
+ DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleListOption());
16828
17129
 
16829
- const styles$d = css `
17130
+ const styles$e = css `
16830
17131
  ${display('grid')}
16831
17132
 
16832
17133
  :host {
@@ -16878,11 +17179,11 @@
16878
17179
  baseName: 'menu',
16879
17180
  baseClass: Menu$1,
16880
17181
  template: menuTemplate,
16881
- styles: styles$d
17182
+ styles: styles$e
16882
17183
  });
16883
17184
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleMenu());
16884
17185
 
16885
- const styles$c = css `
17186
+ const styles$d = css `
16886
17187
  ${display('grid')}
16887
17188
 
16888
17189
  :host {
@@ -16959,11 +17260,11 @@
16959
17260
  baseName: 'menu-item',
16960
17261
  baseClass: MenuItem$1,
16961
17262
  template: menuItemTemplate,
16962
- styles: styles$c
17263
+ styles: styles$d
16963
17264
  });
16964
17265
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleMenuItem());
16965
17266
 
16966
- const styles$b = css `
17267
+ const styles$c = css `
16967
17268
  ${display('inline-block')}
16968
17269
 
16969
17270
  :host {
@@ -17089,7 +17390,7 @@
17089
17390
  baseName: 'number-field',
17090
17391
  baseClass: NumberField$1,
17091
17392
  template: numberFieldTemplate,
17092
- styles: styles$b,
17393
+ styles: styles$c,
17093
17394
  shadowOptions: {
17094
17395
  delegatesFocus: true
17095
17396
  },
@@ -17098,7 +17399,7 @@
17098
17399
  });
17099
17400
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleNumberField());
17100
17401
 
17101
- const styles$a = css `
17402
+ const styles$b = css `
17102
17403
  ${display('inline-flex')}
17103
17404
 
17104
17405
  :host {
@@ -17253,11 +17554,6 @@
17253
17554
  }
17254
17555
  super.setPositioning();
17255
17556
  }
17256
- connectedCallback() {
17257
- super.connectedCallback();
17258
- // Call setPositioning() after this.forcedPosition is initialized.
17259
- this.setPositioning();
17260
- }
17261
17557
  // Workaround for https://github.com/microsoft/fast/issues/5773
17262
17558
  slottedOptionsChanged(prev, next) {
17263
17559
  const value = this.value;
@@ -17271,12 +17567,12 @@
17271
17567
  baseName: 'select',
17272
17568
  baseClass: Select$1,
17273
17569
  template: selectTemplate,
17274
- styles: styles$a,
17570
+ styles: styles$b,
17275
17571
  indicator: arrowExpanderDown16X16.data
17276
17572
  });
17277
17573
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleSelect());
17278
17574
 
17279
- const styles$9 = css `
17575
+ const styles$a = css `
17280
17576
  ${display('inline-flex')}
17281
17577
 
17282
17578
  :host {
@@ -17489,11 +17785,11 @@
17489
17785
  baseClass: Switch$1,
17490
17786
  baseName: 'switch',
17491
17787
  template: template$2,
17492
- styles: styles$9
17788
+ styles: styles$a
17493
17789
  });
17494
17790
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleSwitch());
17495
17791
 
17496
- const styles$8 = css `
17792
+ const styles$9 = css `
17497
17793
  ${display('inline-flex')}
17498
17794
 
17499
17795
  :host {
@@ -17550,11 +17846,11 @@
17550
17846
  baseName: 'tab',
17551
17847
  baseClass: Tab$1,
17552
17848
  template: tabTemplate,
17553
- styles: styles$8
17849
+ styles: styles$9
17554
17850
  });
17555
17851
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTab());
17556
17852
 
17557
- const styles$7 = css `
17853
+ const styles$8 = css `
17558
17854
  ${display('block')}
17559
17855
 
17560
17856
  :host {
@@ -17574,11 +17870,11 @@
17574
17870
  baseName: 'tab-panel',
17575
17871
  baseClass: TabPanel$1,
17576
17872
  template: tabPanelTemplate,
17577
- styles: styles$7
17873
+ styles: styles$8
17578
17874
  });
17579
17875
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTabPanel());
17580
17876
 
17581
- const styles$6 = css `
17877
+ const styles$7 = css `
17582
17878
  ${display('grid')}
17583
17879
 
17584
17880
  :host {
@@ -17627,11 +17923,11 @@
17627
17923
  baseName: 'tabs',
17628
17924
  baseClass: Tabs$1,
17629
17925
  template: tabsTemplate,
17630
- styles: styles$6
17926
+ styles: styles$7
17631
17927
  });
17632
17928
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTabs());
17633
17929
 
17634
- const styles$5 = css `
17930
+ const styles$6 = css `
17635
17931
  ${display('flex')}
17636
17932
 
17637
17933
  :host {
@@ -17666,7 +17962,7 @@
17666
17962
  const nimbleTabsToolbar = TabsToolbar.compose({
17667
17963
  baseName: 'tabs-toolbar',
17668
17964
  template: template$1,
17669
- styles: styles$5
17965
+ styles: styles$6
17670
17966
  });
17671
17967
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTabsToolbar());
17672
17968
 
@@ -17676,7 +17972,7 @@
17676
17972
  TextAreaAppearance["Block"] = "block";
17677
17973
  })(TextAreaAppearance || (TextAreaAppearance = {}));
17678
17974
 
17679
- const styles$4 = css `
17975
+ const styles$5 = css `
17680
17976
  ${display('inline-flex')}
17681
17977
 
17682
17978
  :host {
@@ -17818,7 +18114,7 @@
17818
18114
  baseName: 'text-area',
17819
18115
  baseClass: TextArea$1,
17820
18116
  template: textAreaTemplate,
17821
- styles: styles$4,
18117
+ styles: styles$5,
17822
18118
  shadowOptions: {
17823
18119
  delegatesFocus: true
17824
18120
  }
@@ -17835,7 +18131,7 @@
17835
18131
  TextFieldAppearance["Block"] = "block";
17836
18132
  })(TextFieldAppearance || (TextFieldAppearance = {}));
17837
18133
 
17838
- const styles$3 = css `
18134
+ const styles$4 = css `
17839
18135
  ${display('inline-block')}
17840
18136
 
17841
18137
  :host {
@@ -18127,7 +18423,7 @@
18127
18423
  baseName: 'text-field',
18128
18424
  baseClass: TextField$1,
18129
18425
  template: textFieldTemplate,
18130
- styles: styles$3,
18426
+ styles: styles$4,
18131
18427
  shadowOptions: {
18132
18428
  delegatesFocus: true
18133
18429
  },
@@ -18148,8 +18444,8 @@
18148
18444
  });
18149
18445
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTextField());
18150
18446
 
18151
- const styles$2 = css `
18152
- ${styles$j}
18447
+ const styles$3 = css `
18448
+ ${styles$k}
18153
18449
 
18154
18450
  .control[aria-pressed='true'] {
18155
18451
  background-color: ${fillSelectedColor};
@@ -18233,13 +18529,55 @@
18233
18529
  const nimbleToggleButton = ToggleButton.compose({
18234
18530
  baseName: 'toggle-button',
18235
18531
  template,
18236
- styles: styles$2,
18532
+ styles: styles$3,
18237
18533
  shadowOptions: {
18238
18534
  delegatesFocus: true
18239
18535
  }
18240
18536
  });
18241
18537
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleToggleButton());
18242
18538
 
18539
+ const styles$2 = css `
18540
+ .positioning-region {
18541
+ display: flex;
18542
+ padding: ${smallPadding} ${standardPadding};
18543
+ align-items: center;
18544
+ gap: ${standardPadding};
18545
+ background: ${applicationBackgroundColor};
18546
+ }
18547
+
18548
+ slot[name='label'] {
18549
+ display: none;
18550
+ }
18551
+
18552
+ [part='start'] {
18553
+ display: flex;
18554
+ gap: ${standardPadding};
18555
+ margin-right: auto;
18556
+ }
18557
+
18558
+ [part='end'] {
18559
+ display: flex;
18560
+ gap: ${standardPadding};
18561
+ margin-left: auto;
18562
+ }
18563
+ `;
18564
+
18565
+ /**
18566
+ * A nimble-styled Toolbar
18567
+ */
18568
+ class Toolbar extends Toolbar$1 {
18569
+ }
18570
+ const nimbleToolbar = Toolbar.compose({
18571
+ baseName: 'toolbar',
18572
+ baseClass: Toolbar$1,
18573
+ template: toolbarTemplate,
18574
+ styles: styles$2,
18575
+ shadowOptions: {
18576
+ delegatesFocus: true
18577
+ }
18578
+ });
18579
+ DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleToolbar());
18580
+
18243
18581
  const groupSelectedAttribute = 'group-selected';
18244
18582
  var TreeViewSelectionMode;
18245
18583
  (function (TreeViewSelectionMode) {
@@ -18528,37 +18866,8 @@
18528
18866
  */
18529
18867
  class TreeItem extends TreeItem$1 {
18530
18868
  constructor() {
18531
- super();
18869
+ super(...arguments);
18532
18870
  this.treeView = null;
18533
- this.handleClickOverride = (event) => {
18534
- if (event.composedPath().includes(this.expandCollapseButton)) {
18535
- // just have base class handle click event for glyph
18536
- return;
18537
- }
18538
- const treeItem = this.getImmediateTreeItem(event.target);
18539
- if (treeItem?.disabled || treeItem !== this) {
18540
- // don't allow base TreeItem to emit a 'selected-change' event when a disabled item is clicked
18541
- event.stopImmediatePropagation();
18542
- return;
18543
- }
18544
- const leavesOnly = this.treeView?.selectionMode === TreeViewSelectionMode.LeavesOnly;
18545
- const all = this.treeView?.selectionMode === TreeViewSelectionMode.All;
18546
- const hasChildren = this.hasChildTreeItems();
18547
- if ((leavesOnly && !hasChildren) || all) {
18548
- const selectedTreeItem = this.getImmediateTreeItem(this.treeView?.currentSelected);
18549
- // deselect currently selected item if different than this instance
18550
- if (selectedTreeItem && this !== this.treeView?.currentSelected) {
18551
- selectedTreeItem.selected = false;
18552
- }
18553
- this.selected = true;
18554
- }
18555
- else {
18556
- // implicit (hasChildren && leavesOnly) || none, so only allow expand/collapse, not select
18557
- this.expanded = !this.expanded;
18558
- }
18559
- // don't allow base class to process click event
18560
- event.stopImmediatePropagation();
18561
- };
18562
18871
  // This prevents the toggling of selected state when a TreeItem is clicked multiple times,
18563
18872
  // which is what the FAST TreeItem allows
18564
18873
  this.handleSelectedChange = (event) => {
@@ -18567,7 +18876,6 @@
18567
18876
  this.setGroupSelectionOnRootParentTreeItem(this);
18568
18877
  }
18569
18878
  };
18570
- this.addEventListener('click', this.handleClickOverride);
18571
18879
  }
18572
18880
  connectedCallback() {
18573
18881
  super.connectedCallback();
@@ -18579,14 +18887,9 @@
18579
18887
  }
18580
18888
  disconnectedCallback() {
18581
18889
  super.disconnectedCallback();
18582
- this.removeEventListener('click', this.handleClickOverride);
18583
18890
  this.removeEventListener('selected-change', this.handleSelectedChange);
18584
18891
  this.treeView = null;
18585
18892
  }
18586
- hasChildTreeItems() {
18587
- const treeItemChild = this.querySelector('[role="treeitem"]');
18588
- return treeItemChild !== null;
18589
- }
18590
18893
  clearTreeGroupSelection() {
18591
18894
  const currentGroupSelection = this.treeView?.querySelectorAll(`[${groupSelectedAttribute}]`);
18592
18895
  currentGroupSelection?.forEach(treeItem => treeItem.removeAttribute(groupSelectedAttribute));
@@ -18601,14 +18904,6 @@
18601
18904
  currentItem.setAttribute(groupSelectedAttribute, 'true');
18602
18905
  }
18603
18906
  }
18604
- getImmediateTreeItem(element) {
18605
- let foundElement = element;
18606
- while (foundElement
18607
- && !(foundElement?.getAttribute('role') === 'treeitem')) {
18608
- foundElement = foundElement?.parentElement;
18609
- }
18610
- return foundElement;
18611
- }
18612
18907
  /**
18613
18908
  * This was copied directly from the FAST TreeItem implementation
18614
18909
  * @returns the root tree view
@@ -18656,6 +18951,43 @@
18656
18951
  super(...arguments);
18657
18952
  this.selectionMode = TreeViewSelectionMode.All;
18658
18953
  }
18954
+ handleClick(e) {
18955
+ if (e.defaultPrevented) {
18956
+ // handled, do nothing
18957
+ return false;
18958
+ }
18959
+ if (!(e.target instanceof Element) || !isTreeItemElement(e.target)) {
18960
+ // not a tree item, ignore
18961
+ return true;
18962
+ }
18963
+ const item = e.target;
18964
+ if (item.disabled) {
18965
+ return false;
18966
+ }
18967
+ if (this.canSelect(item)) {
18968
+ item.selected = true;
18969
+ }
18970
+ else if (this.itemHasChildren(item)) {
18971
+ item.expanded = !item.expanded;
18972
+ }
18973
+ return true;
18974
+ }
18975
+ canSelect(item) {
18976
+ switch (this.selectionMode) {
18977
+ case TreeViewSelectionMode.All:
18978
+ return true;
18979
+ case TreeViewSelectionMode.None:
18980
+ return false;
18981
+ case TreeViewSelectionMode.LeavesOnly:
18982
+ return !this.itemHasChildren(item);
18983
+ default:
18984
+ return true;
18985
+ }
18986
+ }
18987
+ itemHasChildren(item) {
18988
+ const treeItemChild = item.querySelector('[role="treeitem"]');
18989
+ return treeItemChild !== null;
18990
+ }
18659
18991
  }
18660
18992
  __decorate([
18661
18993
  attr({ attribute: 'selection-mode' })