@ni/nimble-components 8.2.0 → 8.4.0

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 (40) hide show
  1. package/dist/all-components-bundle.js +107 -48
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +831 -793
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/all-components.d.ts +1 -0
  6. package/dist/esm/all-components.js +1 -0
  7. package/dist/esm/all-components.js.map +1 -1
  8. package/dist/esm/anchored-region/index.d.ts +11 -0
  9. package/dist/esm/anchored-region/index.js +24 -0
  10. package/dist/esm/anchored-region/index.js.map +1 -0
  11. package/dist/esm/anchored-region/styles.d.ts +1 -0
  12. package/dist/esm/anchored-region/styles.js +9 -0
  13. package/dist/esm/anchored-region/styles.js.map +1 -0
  14. package/dist/esm/button/index.d.ts +2 -7
  15. package/dist/esm/button/index.js +0 -6
  16. package/dist/esm/button/index.js.map +1 -1
  17. package/dist/esm/nimble-components/src/all-components.d.ts +1 -0
  18. package/dist/esm/nimble-components/src/anchored-region/index.d.ts +11 -0
  19. package/dist/esm/nimble-components/src/anchored-region/styles.d.ts +1 -0
  20. package/dist/esm/nimble-components/src/button/index.d.ts +2 -7
  21. package/dist/esm/nimble-components/src/patterns/button/types.d.ts +20 -0
  22. package/dist/esm/nimble-components/src/theme-provider/design-tokens.d.ts +1 -0
  23. package/dist/esm/nimble-components/src/toggle-button/index.d.ts +6 -9
  24. package/dist/esm/patterns/button/types.d.ts +20 -0
  25. package/dist/esm/patterns/button/types.js.map +1 -1
  26. package/dist/esm/theme-provider/design-token-comments.js +1 -0
  27. package/dist/esm/theme-provider/design-token-comments.js.map +1 -1
  28. package/dist/esm/theme-provider/design-token-names.js +1 -0
  29. package/dist/esm/theme-provider/design-token-names.js.map +1 -1
  30. package/dist/esm/theme-provider/design-tokens.d.ts +1 -0
  31. package/dist/esm/theme-provider/design-tokens.js +5 -1
  32. package/dist/esm/theme-provider/design-tokens.js.map +1 -1
  33. package/dist/esm/toggle-button/index.d.ts +6 -9
  34. package/dist/esm/toggle-button/index.js +3 -9
  35. package/dist/esm/toggle-button/index.js.map +1 -1
  36. package/dist/esm/toggle-button/template.js +29 -5
  37. package/dist/esm/toggle-button/template.js.map +1 -1
  38. package/dist/tokens-internal.scss +6 -0
  39. package/dist/tokens.scss +3 -0
  40. package/package.json +1 -1
@@ -4730,6 +4730,18 @@
4730
4730
  applyMixins(DelegatesARIALink, ARIAGlobalStatesAndProperties);
4731
4731
  applyMixins(Anchor, StartEnd, DelegatesARIALink);
4732
4732
 
4733
+ /**
4734
+ * The template for the {@link @microsoft/fast-foundation#(AnchoredRegion:class)} component.
4735
+ * @public
4736
+ */
4737
+ const anchoredRegionTemplate = (context, definition) => html `
4738
+ <template class="${x => (x.initialLayoutComplete ? "loaded" : "")}">
4739
+ ${when(x => x.initialLayoutComplete, html `
4740
+ <slot></slot>
4741
+ `)}
4742
+ </template>
4743
+ `;
4744
+
4733
4745
  /**
4734
4746
  * a method to determine the current localization direction of the view
4735
4747
  * @param rootNode - the HTMLElement to begin the query from, usually "this" when used in a component controller
@@ -4836,7 +4848,7 @@
4836
4848
  *
4837
4849
  * @public
4838
4850
  */
4839
- class AnchoredRegion extends FoundationElement {
4851
+ class AnchoredRegion$1 extends FoundationElement {
4840
4852
  constructor() {
4841
4853
  super(...arguments);
4842
4854
  /**
@@ -5022,10 +5034,10 @@
5022
5034
  if (this.anchorElement === null || this.pendingPositioningUpdate) {
5023
5035
  return;
5024
5036
  }
5025
- AnchoredRegion.intersectionService.requestPosition(this, this.handleIntersection);
5026
- AnchoredRegion.intersectionService.requestPosition(this.anchorElement, this.handleIntersection);
5037
+ AnchoredRegion$1.intersectionService.requestPosition(this, this.handleIntersection);
5038
+ AnchoredRegion$1.intersectionService.requestPosition(this.anchorElement, this.handleIntersection);
5027
5039
  if (this.viewportElement !== null) {
5028
- AnchoredRegion.intersectionService.requestPosition(this.viewportElement, this.handleIntersection);
5040
+ AnchoredRegion$1.intersectionService.requestPosition(this.viewportElement, this.handleIntersection);
5029
5041
  }
5030
5042
  this.pendingPositioningUpdate = true;
5031
5043
  };
@@ -5035,12 +5047,12 @@
5035
5047
  this.stopObservers = () => {
5036
5048
  if (this.pendingPositioningUpdate) {
5037
5049
  this.pendingPositioningUpdate = false;
5038
- AnchoredRegion.intersectionService.cancelRequestPosition(this, this.handleIntersection);
5050
+ AnchoredRegion$1.intersectionService.cancelRequestPosition(this, this.handleIntersection);
5039
5051
  if (this.anchorElement !== null) {
5040
- AnchoredRegion.intersectionService.cancelRequestPosition(this.anchorElement, this.handleIntersection);
5052
+ AnchoredRegion$1.intersectionService.cancelRequestPosition(this.anchorElement, this.handleIntersection);
5041
5053
  }
5042
5054
  if (this.viewportElement !== null) {
5043
- AnchoredRegion.intersectionService.cancelRequestPosition(this.viewportElement, this.handleIntersection);
5055
+ AnchoredRegion$1.intersectionService.cancelRequestPosition(this.viewportElement, this.handleIntersection);
5044
5056
  }
5045
5057
  }
5046
5058
  if (this.resizeDetector !== null) {
@@ -5723,64 +5735,64 @@
5723
5735
  this.updateRegionStyle();
5724
5736
  }
5725
5737
  }
5726
- AnchoredRegion.intersectionService = new IntersectionService();
5738
+ AnchoredRegion$1.intersectionService = new IntersectionService();
5727
5739
  __decorate$1([
5728
5740
  attr
5729
- ], AnchoredRegion.prototype, "anchor", void 0);
5741
+ ], AnchoredRegion$1.prototype, "anchor", void 0);
5730
5742
  __decorate$1([
5731
5743
  attr
5732
- ], AnchoredRegion.prototype, "viewport", void 0);
5744
+ ], AnchoredRegion$1.prototype, "viewport", void 0);
5733
5745
  __decorate$1([
5734
5746
  attr({ attribute: "horizontal-positioning-mode" })
5735
- ], AnchoredRegion.prototype, "horizontalPositioningMode", void 0);
5747
+ ], AnchoredRegion$1.prototype, "horizontalPositioningMode", void 0);
5736
5748
  __decorate$1([
5737
5749
  attr({ attribute: "horizontal-default-position" })
5738
- ], AnchoredRegion.prototype, "horizontalDefaultPosition", void 0);
5750
+ ], AnchoredRegion$1.prototype, "horizontalDefaultPosition", void 0);
5739
5751
  __decorate$1([
5740
5752
  attr({ attribute: "horizontal-viewport-lock", mode: "boolean" })
5741
- ], AnchoredRegion.prototype, "horizontalViewportLock", void 0);
5753
+ ], AnchoredRegion$1.prototype, "horizontalViewportLock", void 0);
5742
5754
  __decorate$1([
5743
5755
  attr({ attribute: "horizontal-inset", mode: "boolean" })
5744
- ], AnchoredRegion.prototype, "horizontalInset", void 0);
5756
+ ], AnchoredRegion$1.prototype, "horizontalInset", void 0);
5745
5757
  __decorate$1([
5746
5758
  attr({ attribute: "horizontal-threshold" })
5747
- ], AnchoredRegion.prototype, "horizontalThreshold", void 0);
5759
+ ], AnchoredRegion$1.prototype, "horizontalThreshold", void 0);
5748
5760
  __decorate$1([
5749
5761
  attr({ attribute: "horizontal-scaling" })
5750
- ], AnchoredRegion.prototype, "horizontalScaling", void 0);
5762
+ ], AnchoredRegion$1.prototype, "horizontalScaling", void 0);
5751
5763
  __decorate$1([
5752
5764
  attr({ attribute: "vertical-positioning-mode" })
5753
- ], AnchoredRegion.prototype, "verticalPositioningMode", void 0);
5765
+ ], AnchoredRegion$1.prototype, "verticalPositioningMode", void 0);
5754
5766
  __decorate$1([
5755
5767
  attr({ attribute: "vertical-default-position" })
5756
- ], AnchoredRegion.prototype, "verticalDefaultPosition", void 0);
5768
+ ], AnchoredRegion$1.prototype, "verticalDefaultPosition", void 0);
5757
5769
  __decorate$1([
5758
5770
  attr({ attribute: "vertical-viewport-lock", mode: "boolean" })
5759
- ], AnchoredRegion.prototype, "verticalViewportLock", void 0);
5771
+ ], AnchoredRegion$1.prototype, "verticalViewportLock", void 0);
5760
5772
  __decorate$1([
5761
5773
  attr({ attribute: "vertical-inset", mode: "boolean" })
5762
- ], AnchoredRegion.prototype, "verticalInset", void 0);
5774
+ ], AnchoredRegion$1.prototype, "verticalInset", void 0);
5763
5775
  __decorate$1([
5764
5776
  attr({ attribute: "vertical-threshold" })
5765
- ], AnchoredRegion.prototype, "verticalThreshold", void 0);
5777
+ ], AnchoredRegion$1.prototype, "verticalThreshold", void 0);
5766
5778
  __decorate$1([
5767
5779
  attr({ attribute: "vertical-scaling" })
5768
- ], AnchoredRegion.prototype, "verticalScaling", void 0);
5780
+ ], AnchoredRegion$1.prototype, "verticalScaling", void 0);
5769
5781
  __decorate$1([
5770
5782
  attr({ attribute: "fixed-placement", mode: "boolean" })
5771
- ], AnchoredRegion.prototype, "fixedPlacement", void 0);
5783
+ ], AnchoredRegion$1.prototype, "fixedPlacement", void 0);
5772
5784
  __decorate$1([
5773
5785
  attr({ attribute: "auto-update-mode" })
5774
- ], AnchoredRegion.prototype, "autoUpdateMode", void 0);
5786
+ ], AnchoredRegion$1.prototype, "autoUpdateMode", void 0);
5775
5787
  __decorate$1([
5776
5788
  observable
5777
- ], AnchoredRegion.prototype, "anchorElement", void 0);
5789
+ ], AnchoredRegion$1.prototype, "anchorElement", void 0);
5778
5790
  __decorate$1([
5779
5791
  observable
5780
- ], AnchoredRegion.prototype, "viewportElement", void 0);
5792
+ ], AnchoredRegion$1.prototype, "viewportElement", void 0);
5781
5793
  __decorate$1([
5782
5794
  observable
5783
- ], AnchoredRegion.prototype, "initialLayoutComplete", void 0);
5795
+ ], AnchoredRegion$1.prototype, "initialLayoutComplete", void 0);
5784
5796
 
5785
5797
  /**
5786
5798
  * The template for the {@link @microsoft/fast-foundation#(BreadcrumbItem:class)} component.
@@ -9429,7 +9441,7 @@
9429
9441
  </div>
9430
9442
  `)}
9431
9443
  ${when(x => x.expanded, html `
9432
- <${context.tagFor(AnchoredRegion)}
9444
+ <${context.tagFor(AnchoredRegion$1)}
9433
9445
  :anchorElement="${x => x}"
9434
9446
  vertical-positioning-mode="dynamic"
9435
9447
  vertical-default-position="bottom"
@@ -9443,7 +9455,7 @@
9443
9455
  part="submenu-region"
9444
9456
  >
9445
9457
  <slot name="submenu"></slot>
9446
- </${context.tagFor(AnchoredRegion)}>
9458
+ </${context.tagFor(AnchoredRegion$1)}>
9447
9459
  `)}
9448
9460
  </template>
9449
9461
  `;
@@ -12188,6 +12200,36 @@
12188
12200
  observable
12189
12201
  ], TreeView$1.prototype, "slottedTreeItems", void 0);
12190
12202
 
12203
+ const styles$o = css `
12204
+ :host {
12205
+ contain: layout;
12206
+ display: block;
12207
+ z-index: 1000;
12208
+ }
12209
+ `;
12210
+
12211
+ // When the anchor element changes position on the page, it is the client's responsibility to update the position
12212
+ // of the anchored region by calling update() on the anchored region.
12213
+ //
12214
+ // When the anchor element is recreated on the page, it is the client's responsibility to reset the reference the
12215
+ // anchored region has to the anchor element. This can be done by either recreating the anchor element with a new
12216
+ // ID that is also set as the \`anchor\` attribute on the anchored region or by explicitly setting the value of
12217
+ // anchorElement on the anchored region to the new anchor element.
12218
+ /**
12219
+ * A nimble-styled anchored region control.
12220
+ */
12221
+ class AnchoredRegion extends AnchoredRegion$1 {
12222
+ }
12223
+ const nimbleAnchoredRegion = AnchoredRegion.compose({
12224
+ baseName: 'anchored-region',
12225
+ baseClass: AnchoredRegion$1,
12226
+ template: anchoredRegionTemplate,
12227
+ styles: styles$o
12228
+ });
12229
+ DesignSystem.getOrCreate()
12230
+ .withPrefix('nimble')
12231
+ .register(nimbleAnchoredRegion());
12232
+
12191
12233
  /**
12192
12234
  * Do not edit directly
12193
12235
  * Generated on Tue, 01 Mar 2022 15:26:47 GMT
@@ -12342,6 +12384,7 @@
12342
12384
  fillSelectedRgbPartialColor: 'fill-selected-rgb-partial-color',
12343
12385
  fillHoverSelectedColor: 'fill-hover-selected-color',
12344
12386
  fillHoverColor: 'fill-hover-color',
12387
+ fillDownColor: 'fill-down-color',
12345
12388
  borderColor: 'border-color',
12346
12389
  borderRgbPartialColor: 'border-rgb-partial-color',
12347
12390
  failColor: 'fail-color',
@@ -12598,10 +12641,11 @@
12598
12641
  const applicationBackgroundColor = DesignToken.create(styleNameFromTokenName(tokenNames.applicationBackgroundColor)).withDefault((element) => getColorForTheme(element, White, Black85, ForestGreen));
12599
12642
  DesignToken.create(styleNameFromTokenName(tokenNames.headerBackgroundColor)).withDefault((element) => getColorForTheme(element, Black7, Black80, ForestGreen));
12600
12643
  DesignToken.create(styleNameFromTokenName(tokenNames.sectionBackgroundColor)).withDefault((element) => getColorForTheme(element, Black30, Black91, ForestGreen));
12601
- const fillSelectedColor = DesignToken.create(styleNameFromTokenName(tokenNames.fillSelectedColor)).withDefault((element) => hexToRgbaCssColor(getFillSelectedColorForTheme(element), 0.3));
12644
+ const fillSelectedColor = DesignToken.create(styleNameFromTokenName(tokenNames.fillSelectedColor)).withDefault((element) => hexToRgbaCssColor(getFillSelectedColorForTheme(element), 0.2));
12602
12645
  const fillSelectedRgbPartialColor = DesignToken.create(styleNameFromTokenName(tokenNames.fillSelectedRgbPartialColor)).withDefault((element) => hexToRgbPartial(getFillSelectedColorForTheme(element)));
12603
12646
  const fillHoverSelectedColor = DesignToken.create(styleNameFromTokenName(tokenNames.fillHoverSelectedColor)).withDefault((element) => hexToRgbaCssColor(getFillSelectedColorForTheme(element), 0.15));
12604
12647
  const fillHoverColor = DesignToken.create(styleNameFromTokenName(tokenNames.fillHoverColor)).withDefault((element) => hexToRgbaCssColor(getFillHoverColorForTheme(element), 0.1));
12648
+ DesignToken.create(styleNameFromTokenName(tokenNames.fillDownColor)).withDefault((element) => hexToRgbaCssColor(getFillDownColorForTheme(element), 0.15));
12605
12649
  const borderColor = DesignToken.create(styleNameFromTokenName(tokenNames.borderColor)).withDefault((element) => getDefaultLineColorForTheme(element));
12606
12650
  const borderRgbPartialColor = DesignToken.create(styleNameFromTokenName(tokenNames.borderRgbPartialColor)).withDefault((element) => hexToRgbPartial(getDefaultLineColorForTheme(element)));
12607
12651
  const failColor = DesignToken.create(styleNameFromTokenName(tokenNames.failColor)).withDefault((element) => getFailColorForTheme(element));
@@ -12714,6 +12758,9 @@
12714
12758
  function getFillHoverColorForTheme(element) {
12715
12759
  return getColorForTheme(element, Black91, Black15, White);
12716
12760
  }
12761
+ function getFillDownColorForTheme(element) {
12762
+ return getColorForTheme(element, Black91, Black15, White);
12763
+ }
12717
12764
 
12718
12765
  /* eslint-disable max-classes-per-file */
12719
12766
  /**
@@ -13864,18 +13911,12 @@
13864
13911
  constructor() {
13865
13912
  super(...arguments);
13866
13913
  /**
13867
- * The appearance the button should have.
13868
- *
13869
13914
  * @public
13870
13915
  * @remarks
13871
13916
  * HTML Attribute: appearance
13872
13917
  */
13873
13918
  this.appearance = ButtonAppearance.Outline;
13874
13919
  /**
13875
- * Specify as 'true' to hide the text content of the button. The button will
13876
- * become square, and the text content will be used as the label of the button
13877
- * for accessibility purposes.
13878
- *
13879
13920
  * @public
13880
13921
  * @remarks
13881
13922
  * HTML Attribute: content-hidden
@@ -18506,14 +18547,38 @@
18506
18547
  <div
18507
18548
  role="button"
18508
18549
  part="control"
18509
- aria-pressed="${(x) => x.checked}"
18510
- aria-disabled="${(x) => x.disabled}"
18511
- aria-readonly="${(x) => x.readOnly}"
18512
- tabindex="${(x) => (x.disabled ? null : 0)}"
18550
+ tabindex="${x => (x.disabled ? null : 0)}"
18513
18551
  @keypress="${(x, c) => x.keypressHandler(c.event)}"
18514
18552
  @click="${(x, c) => x.clickHandler(c.event)}"
18515
- class="control ${(x) => (x.checked ? 'checked' : '')}"
18553
+ class="control ${x => (x.checked ? 'checked' : '')}"
18516
18554
  ?disabled="${x => x.disabled}"
18555
+ ${'' /* Configure aria-disabled, aria-readonly, and aria-pressed based on the
18556
+ toggle button's state to keep the ARIA attributes consistent with the component's
18557
+ state without a client having to configure ARIA attributes directly */}
18558
+ aria-disabled="${x => x.disabled}"
18559
+ aria-readonly="${x => x.readOnly}"
18560
+ aria-pressed="${x => x.checked}"
18561
+ ${'' /* Configure all other ARIA attributes based on the aria attributes
18562
+ configured on the toggle button */}
18563
+ aria-atomic="${x => x.ariaAtomic}"
18564
+ aria-busy="${x => x.ariaBusy}"
18565
+ aria-controls="${x => x.ariaControls}"
18566
+ aria-current="${x => x.ariaCurrent}"
18567
+ aria-describedby="${x => x.ariaDescribedby}"
18568
+ aria-details="${x => x.ariaDetails}"
18569
+ aria-errormessage="${x => x.ariaErrormessage}"
18570
+ aria-expanded="${x => x.ariaExpanded}"
18571
+ aria-flowto="${x => x.ariaFlowto}"
18572
+ aria-haspopup="${x => x.ariaHaspopup}"
18573
+ aria-hidden="${x => x.ariaHidden}"
18574
+ aria-invalid="${x => x.ariaInvalid}"
18575
+ aria-keyshortcuts="${x => x.ariaKeyshortcuts}"
18576
+ aria-label="${x => x.ariaLabel}"
18577
+ aria-labelledby="${x => x.ariaLabelledby}"
18578
+ aria-live="${x => x.ariaLive}"
18579
+ aria-owns="${x => x.ariaOwns}"
18580
+ aria-relevant="${x => x.ariaRelevant}"
18581
+ aria-roledescription="${x => x.ariaRoledescription}"
18517
18582
  ${ref('control')}
18518
18583
  >
18519
18584
  ${startSlotTemplate(context, definition)}
@@ -18531,18 +18596,12 @@
18531
18596
  constructor() {
18532
18597
  super(...arguments);
18533
18598
  /**
18534
- * The appearance the button should have.
18535
- *
18536
18599
  * @public
18537
18600
  * @remarks
18538
18601
  * HTML Attribute: appearance
18539
18602
  */
18540
18603
  this.appearance = ButtonAppearance.Outline;
18541
18604
  /**
18542
- * Specify as 'true' to hide the text content of the button. The button will
18543
- * become square, and the text content will be used as the label of the button
18544
- * for accessibility purposes.
18545
- *
18546
18605
  * @public
18547
18606
  * @remarks
18548
18607
  * HTML Attribute: content-hidden
@@ -18556,7 +18615,7 @@
18556
18615
  __decorate([
18557
18616
  attr({ attribute: 'content-hidden', mode: 'boolean' })
18558
18617
  ], ToggleButton.prototype, "contentHidden", void 0);
18559
- applyMixins(ToggleButton, StartEnd);
18618
+ applyMixins(ToggleButton, StartEnd, DelegatesARIAButton);
18560
18619
  const nimbleToggleButton = ToggleButton.compose({
18561
18620
  baseName: 'toggle-button',
18562
18621
  template,