@ni/nimble-components 20.14.9 → 20.14.10

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.
@@ -10270,30 +10270,6 @@
10270
10270
  return isNodeMatchingSelectorFocusable(options, node);
10271
10271
  };
10272
10272
 
10273
- /**
10274
- * The template for the {@link @microsoft/fast-foundation#(ListboxOption:class)} component.
10275
- * @public
10276
- */
10277
- const listboxOptionTemplate = (context, definition) => html `
10278
- <template
10279
- aria-checked="${x => x.ariaChecked}"
10280
- aria-disabled="${x => x.ariaDisabled}"
10281
- aria-posinset="${x => x.ariaPosInSet}"
10282
- aria-selected="${x => x.ariaSelected}"
10283
- aria-setsize="${x => x.ariaSetSize}"
10284
- class="${x => [x.checked && "checked", x.selected && "selected", x.disabled && "disabled"]
10285
- .filter(Boolean)
10286
- .join(" ")}"
10287
- role="option"
10288
- >
10289
- ${startSlotTemplate(context, definition)}
10290
- <span class="content" part="content">
10291
- <slot ${slotted("content")}></slot>
10292
- </span>
10293
- ${endSlotTemplate(context, definition)}
10294
- </template>
10295
- `;
10296
-
10297
10273
  /**
10298
10274
  * A Listbox Custom HTML Element.
10299
10275
  * Implements the {@link https://w3c.github.io/aria/#listbox | ARIA listbox }.
@@ -16298,7 +16274,7 @@
16298
16274
 
16299
16275
  /**
16300
16276
  * Do not edit directly
16301
- * Generated on Thu, 23 Nov 2023 07:56:58 GMT
16277
+ * Generated on Mon, 27 Nov 2023 15:57:15 GMT
16302
16278
  */
16303
16279
 
16304
16280
  const Information100DarkUi = "#a46eff";
@@ -16698,7 +16674,7 @@
16698
16674
  return `${prefix}${uniqueIdCounter++}`;
16699
16675
  }
16700
16676
 
16701
- const template$B = html `<slot></slot>`;
16677
+ const template$C = html `<slot></slot>`;
16702
16678
 
16703
16679
  const styles$U = css `
16704
16680
  :host {
@@ -16818,7 +16794,7 @@
16818
16794
  const nimbleDesignSystemProvider = ThemeProvider.compose({
16819
16795
  baseName: 'theme-provider',
16820
16796
  styles: styles$U,
16821
- template: template$B
16797
+ template: template$C
16822
16798
  });
16823
16799
  DesignSystem.getOrCreate()
16824
16800
  .withPrefix('nimble')
@@ -17104,7 +17080,7 @@
17104
17080
  `;
17105
17081
 
17106
17082
  // prettier-ignore
17107
- const template$A = (_context, definition) => html `<a
17083
+ const template$B = (_context, definition) => html `<a
17108
17084
  class="control"
17109
17085
  part="control"
17110
17086
  download="${x => x.download}"
@@ -17194,7 +17170,7 @@
17194
17170
  const nimbleAnchor = Anchor.compose({
17195
17171
  baseName: 'anchor',
17196
17172
  baseClass: Anchor$1,
17197
- template: template$A,
17173
+ template: template$B,
17198
17174
  styles: styles$T,
17199
17175
  shadowOptions: {
17200
17176
  delegatesFocus: true
@@ -17584,7 +17560,7 @@
17584
17560
  }
17585
17561
  `;
17586
17562
 
17587
- const template$z = (context, definition) => html `
17563
+ const template$A = (context, definition) => html `
17588
17564
  <a
17589
17565
  class="control"
17590
17566
  part="control"
@@ -17666,7 +17642,7 @@
17666
17642
  ], AnchorButton.prototype, "disabled", void 0);
17667
17643
  const nimbleAnchorButton = AnchorButton.compose({
17668
17644
  baseName: 'anchor-button',
17669
- template: template$z,
17645
+ template: template$A,
17670
17646
  styles: styles$R,
17671
17647
  shadowOptions: {
17672
17648
  delegatesFocus: true
@@ -17752,7 +17728,7 @@
17752
17728
  }
17753
17729
  `;
17754
17730
 
17755
- const template$y = (context, definition) => html `
17731
+ const template$z = (context, definition) => html `
17756
17732
  <template
17757
17733
  role="menuitem"
17758
17734
  class="${x => (typeof x.startColumnCount === 'number'
@@ -17858,7 +17834,7 @@
17858
17834
  // FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
17859
17835
  const nimbleAnchorMenuItem = AnchorMenuItem.compose({
17860
17836
  baseName: 'anchor-menu-item',
17861
- template: template$y,
17837
+ template: template$z,
17862
17838
  styles: styles$Q,
17863
17839
  shadowOptions: {
17864
17840
  delegatesFocus: true
@@ -17999,7 +17975,7 @@
17999
17975
  }
18000
17976
  `;
18001
17977
 
18002
- const template$x = (context, definition) => html `
17978
+ const template$y = (context, definition) => html `
18003
17979
  <template slot="anchortab" role="tab" aria-disabled="${x => x.disabled}">
18004
17980
  <a
18005
17981
  download="${x => x.download}"
@@ -18051,7 +18027,7 @@
18051
18027
  // FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
18052
18028
  const nimbleAnchorTab = AnchorTab.compose({
18053
18029
  baseName: 'anchor-tab',
18054
- template: template$x,
18030
+ template: template$y,
18055
18031
  styles: styles$P,
18056
18032
  shadowOptions: {
18057
18033
  delegatesFocus: true
@@ -18082,7 +18058,7 @@
18082
18058
  }
18083
18059
  `;
18084
18060
 
18085
- const template$w = (context, definition) => html `
18061
+ const template$x = (context, definition) => html `
18086
18062
  ${startSlotTemplate(context, definition)}
18087
18063
  <div ${ref('tablist')} class="tablist" part="tablist" role="tablist">
18088
18064
  <slot name="anchortab" ${slotted('tabs')}></slot>
@@ -18288,7 +18264,7 @@
18288
18264
  applyMixins(AnchorTabs, StartEnd);
18289
18265
  const nimbleAnchorTabs = AnchorTabs.compose({
18290
18266
  baseName: 'anchor-tabs',
18291
- template: template$w,
18267
+ template: template$x,
18292
18268
  styles: styles$O,
18293
18269
  shadowOptions: {
18294
18270
  delegatesFocus: false
@@ -18407,7 +18383,7 @@
18407
18383
  }
18408
18384
  `;
18409
18385
 
18410
- const template$v = (context, definition) => html `
18386
+ const template$w = (context, definition) => html `
18411
18387
  <template
18412
18388
  role="treeitem"
18413
18389
  slot="${x => (x.isNestedItem() ? 'item' : null)}"
@@ -18544,7 +18520,7 @@
18544
18520
  // FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
18545
18521
  const nimbleAnchorTreeItem = AnchorTreeItem.compose({
18546
18522
  baseName: 'anchor-tree-item',
18547
- template: template$v,
18523
+ template: template$w,
18548
18524
  styles: styles$N,
18549
18525
  shadowOptions: {
18550
18526
  delegatesFocus: true
@@ -19540,7 +19516,7 @@
19540
19516
  };
19541
19517
 
19542
19518
  // Avoiding any whitespace in the template because this is an inline element
19543
- const template$u = html `<div
19519
+ const template$v = html `<div
19544
19520
  class="icon"
19545
19521
  aria-hidden="true"
19546
19522
  :innerHTML=${x => x.icon.data}
@@ -19599,7 +19575,7 @@
19599
19575
  const registerIcon = (baseName, iconClass) => {
19600
19576
  const composedIcon = iconClass.compose({
19601
19577
  baseName,
19602
- template: template$u,
19578
+ template: template$v,
19603
19579
  styles: styles$J,
19604
19580
  baseClass: iconClass
19605
19581
  });
@@ -19704,7 +19680,7 @@
19704
19680
  }).withDefault(coreLabelDefaults.informationIconLabel);
19705
19681
 
19706
19682
  // prettier-ignore
19707
- const template$t = html `
19683
+ const template$u = html `
19708
19684
  <div class="container"
19709
19685
  role="status"
19710
19686
  aria-atomic="${x => x.ariaAtomic}"
@@ -19820,7 +19796,7 @@
19820
19796
  applyMixins(Banner, ARIAGlobalStatesAndProperties);
19821
19797
  const nimbleBanner = Banner.compose({
19822
19798
  baseName: 'banner',
19823
- template: template$t,
19799
+ template: template$u,
19824
19800
  styles: styles$L
19825
19801
  });
19826
19802
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleBanner());
@@ -19977,7 +19953,7 @@
19977
19953
  }
19978
19954
  `;
19979
19955
 
19980
- const template$s = html `
19956
+ const template$t = html `
19981
19957
  ${'' /* Explicitly set role to work around Lighthouse error. See https://github.com/ni/nimble/issues/1650. */}
19982
19958
  <section role="region" aria-labelledby="title-slot">
19983
19959
  <slot name="title" id="title-slot"></slot>
@@ -19993,7 +19969,7 @@
19993
19969
  const nimbleCard = Card.compose({
19994
19970
  baseName: 'card',
19995
19971
  baseClass: Card$1,
19996
- template: template$s,
19972
+ template: template$t,
19997
19973
  styles: styles$G
19998
19974
  });
19999
19975
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleCard());
@@ -20371,7 +20347,7 @@
20371
20347
  }
20372
20348
  `;
20373
20349
 
20374
- const template$r = (context, definition) => html `
20350
+ const template$s = (context, definition) => html `
20375
20351
  <div
20376
20352
  role="button"
20377
20353
  part="control"
@@ -20446,7 +20422,7 @@
20446
20422
  applyMixins(ToggleButton, StartEnd, DelegatesARIAButton);
20447
20423
  const nimbleToggleButton = ToggleButton.compose({
20448
20424
  baseName: 'toggle-button',
20449
- template: template$r,
20425
+ template: template$s,
20450
20426
  styles: styles$D,
20451
20427
  shadowOptions: {
20452
20428
  delegatesFocus: true
@@ -20826,8 +20802,63 @@
20826
20802
  }
20827
20803
  `));
20828
20804
 
20805
+ /**
20806
+ * The runtime behavior for template overflow detection.
20807
+ * @public
20808
+ */
20809
+ class OverflowBehavior {
20810
+ /**
20811
+ * Creates an instance of OverflowBehavior.
20812
+ * @param target - The element to check for overflow.
20813
+ * @param propertyName - The name of the property to assign the overflow state to.
20814
+ */
20815
+ constructor(target, propertyName) {
20816
+ this.target = target;
20817
+ this.propertyName = propertyName;
20818
+ }
20819
+ /**
20820
+ * Bind this behavior to the source.
20821
+ * @param source - The source to bind to.
20822
+ * @param context - The execution context that the binding is operating within.
20823
+ */
20824
+ bind(source) {
20825
+ this.source = source;
20826
+ this.setSourceValue(false);
20827
+ this.mouseOverHandler = () => {
20828
+ const hasOverflow = this.target.offsetWidth < this.target.scrollWidth;
20829
+ this.setSourceValue(hasOverflow);
20830
+ };
20831
+ this.mouseOutHandler = () => {
20832
+ this.setSourceValue(false);
20833
+ };
20834
+ this.target.addEventListener('mouseover', this.mouseOverHandler);
20835
+ this.target.addEventListener('mouseout', this.mouseOutHandler);
20836
+ }
20837
+ /**
20838
+ * Unbinds this behavior from the source.
20839
+ * @param source - The source to unbind from.
20840
+ */
20841
+ unbind() {
20842
+ this.source = undefined;
20843
+ this.target.removeEventListener('mouseover', this.mouseOverHandler);
20844
+ this.target.removeEventListener('mouseout', this.mouseOutHandler);
20845
+ }
20846
+ setSourceValue(value) {
20847
+ // @ts-expect-error set property on source
20848
+ this.source[this.propertyName] = value;
20849
+ }
20850
+ }
20851
+ /**
20852
+ * A directive that observes if an element has overflow and sets a flag.
20853
+ * @param propertyName - The name of the property to assign the overflow flag.
20854
+ * @public
20855
+ */
20856
+ function overflow(propertyName) {
20857
+ return new AttachedBehaviorHTMLDirective('nimble-overflow', OverflowBehavior, propertyName);
20858
+ }
20859
+
20829
20860
  // prettier-ignore
20830
- const template$q = (context, definition) => html `
20861
+ const template$r = (context, definition) => html `
20831
20862
  <template
20832
20863
  aria-disabled="${x => x.ariaDisabled}"
20833
20864
  autocomplete="${x => x.autocomplete}"
@@ -20858,6 +20889,8 @@
20858
20889
  @input="${(x, c) => x.inputHandler(c.event)}"
20859
20890
  @keyup="${(x, c) => x.keyupHandler(c.event)}"
20860
20891
  ${ref('control')}
20892
+ ${overflow('hasOverflow')}
20893
+ title=${x => (x.hasOverflow && x.value ? x.value : null)}
20861
20894
  />
20862
20895
  <div class="indicator" part="indicator" aria-hidden="true">
20863
20896
  <slot name="indicator">
@@ -20906,6 +20939,8 @@
20906
20939
  super(...arguments);
20907
20940
  this.appearance = DropdownAppearance.underline;
20908
20941
  this.errorVisible = false;
20942
+ /** @internal */
20943
+ this.hasOverflow = false;
20909
20944
  this.valueUpdatedByInput = false;
20910
20945
  }
20911
20946
  get value() {
@@ -21095,10 +21130,13 @@
21095
21130
  __decorate$1([
21096
21131
  observable
21097
21132
  ], Combobox.prototype, "controlWrapper", void 0);
21133
+ __decorate$1([
21134
+ observable
21135
+ ], Combobox.prototype, "hasOverflow", void 0);
21098
21136
  const nimbleCombobox = Combobox.compose({
21099
21137
  baseName: 'combobox',
21100
21138
  baseClass: Combobox$1,
21101
- template: template$q,
21139
+ template: template$r,
21102
21140
  styles: styles$A,
21103
21141
  shadowOptions: {
21104
21142
  delegatesFocus: true
@@ -21246,7 +21284,7 @@
21246
21284
  }
21247
21285
  `));
21248
21286
 
21249
- const template$p = html `
21287
+ const template$q = html `
21250
21288
  <template>
21251
21289
  <dialog
21252
21290
  ${ref('dialogElement')}
@@ -21373,7 +21411,7 @@
21373
21411
  applyMixins(Dialog, ARIAGlobalStatesAndProperties);
21374
21412
  const nimbleDialog = Dialog.compose({
21375
21413
  baseName: 'dialog',
21376
- template: template$p,
21414
+ template: template$q,
21377
21415
  styles: styles$z,
21378
21416
  baseClass: Dialog
21379
21417
  });
@@ -21533,7 +21571,7 @@
21533
21571
  }
21534
21572
  `));
21535
21573
 
21536
- const template$o = html `
21574
+ const template$p = html `
21537
21575
  <dialog
21538
21576
  ${ref('dialog')}
21539
21577
  aria-label="${x => x.ariaLabel}"
@@ -21647,7 +21685,7 @@
21647
21685
  applyMixins(Drawer, ARIAGlobalStatesAndProperties);
21648
21686
  const nimbleDrawer = Drawer.compose({
21649
21687
  baseName: 'drawer',
21650
- template: template$o,
21688
+ template: template$p,
21651
21689
  styles: styles$y
21652
21690
  });
21653
21691
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleDrawer());
@@ -24031,6 +24069,9 @@
24031
24069
 
24032
24070
  .content {
24033
24071
  padding: 8px 4px;
24072
+ white-space: nowrap;
24073
+ overflow: hidden;
24074
+ text-overflow: ellipsis;
24034
24075
  }
24035
24076
 
24036
24077
  :host([aria-selected='true']) {
@@ -24079,30 +24120,61 @@
24079
24120
  }
24080
24121
  `;
24081
24122
 
24123
+ // Based on template in FAST repo: https://github.com/microsoft/fast/blob/2ea80697bc3a5193e6123fb08ac3be2a76571aeb/packages/web-components/fast-foundation/src/listbox-option/listbox-option.template.ts
24124
+ /**
24125
+ * The template for the {@link @microsoft/fast-foundation#(ListboxOption:class)} component.
24126
+ * @public
24127
+ */
24128
+ // prettier-ignore
24129
+ const template$o = (context, definition) => html `
24130
+ <template
24131
+ aria-checked="${x => x.ariaChecked}"
24132
+ aria-disabled="${x => x.ariaDisabled}"
24133
+ aria-posinset="${x => x.ariaPosInSet}"
24134
+ aria-selected="${x => x.ariaSelected}"
24135
+ aria-setsize="${x => x.ariaSetSize}"
24136
+ class="${x => [x.checked && 'checked', x.selected && 'selected', x.disabled && 'disabled']
24137
+ .filter(Boolean)
24138
+ .join(' ')}"
24139
+ role="option"
24140
+ >
24141
+ ${startSlotTemplate(context, definition)}
24142
+ <span
24143
+ class="content"
24144
+ part="content"
24145
+ ${overflow('hasOverflow')}
24146
+ title=${x => (x.hasOverflow && x.elementTextContent ? x.elementTextContent : null)}
24147
+ >
24148
+ <slot ${ref('contentSlot')} ${slotted('content')}></slot>
24149
+ </span>
24150
+ ${endSlotTemplate(context, definition)}
24151
+ </template>
24152
+ `;
24153
+
24082
24154
  /**
24083
24155
  * A nimble-styled HTML listbox option
24084
24156
  */
24085
24157
  class ListOption extends ListboxOption {
24086
- // Workaround for https://github.com/microsoft/fast/issues/5219
24087
- get value() {
24088
- return super.value;
24089
- }
24090
- set value(value) {
24091
- // Coerce value to string
24092
- super.value = `${value}`;
24093
- if (this.$fastController.isConnected) {
24094
- this.setAttribute('value', this.value);
24095
- }
24158
+ constructor() {
24159
+ super(...arguments);
24160
+ /** @internal */
24161
+ this.hasOverflow = false;
24096
24162
  }
24097
- connectedCallback() {
24098
- super.connectedCallback();
24099
- this.setAttribute('value', this.value);
24163
+ /** @internal */
24164
+ get elementTextContent() {
24165
+ return this.contentSlot
24166
+ .assignedNodes()
24167
+ .map(node => node.textContent?.trim())
24168
+ .join(' ');
24100
24169
  }
24101
24170
  }
24171
+ __decorate$1([
24172
+ observable
24173
+ ], ListOption.prototype, "hasOverflow", void 0);
24102
24174
  const nimbleListOption = ListOption.compose({
24103
24175
  baseName: 'list-option',
24104
24176
  baseClass: ListboxOption,
24105
- template: listboxOptionTemplate,
24177
+ template: template$o,
24106
24178
  styles: styles$x
24107
24179
  });
24108
24180
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleListOption());
@@ -59831,7 +59903,7 @@ img.ProseMirror-separator {
59831
59903
  >
59832
59904
  ${startSlotTemplate(context, definition)}
59833
59905
  <slot name="button-container">
59834
- <div class="selected-value" part="selected-value">
59906
+ <div class="selected-value" part="selected-value" ${overflow('hasOverflow')} title=${x => (x.hasOverflow && x.displayValue ? x.displayValue : null)}>
59835
59907
  <slot name="selected-value">${x => x.displayValue}</slot>
59836
59908
  </div>
59837
59909
  <div aria-hidden="true" class="indicator" part="indicator">
@@ -59882,6 +59954,8 @@ img.ProseMirror-separator {
59882
59954
  super(...arguments);
59883
59955
  this.appearance = DropdownAppearance.underline;
59884
59956
  this.errorVisible = false;
59957
+ /** @internal */
59958
+ this.hasOverflow = false;
59885
59959
  }
59886
59960
  // Workaround for https://github.com/microsoft/fast/issues/5123
59887
59961
  setPositioning() {
@@ -59932,6 +60006,9 @@ img.ProseMirror-separator {
59932
60006
  __decorate$1([
59933
60007
  observable
59934
60008
  ], Select.prototype, "region", void 0);
60009
+ __decorate$1([
60010
+ observable
60011
+ ], Select.prototype, "hasOverflow", void 0);
59935
60012
  const nimbleSelect = Select.compose({
59936
60013
  baseName: 'select',
59937
60014
  baseClass: Select$1,
@@ -67740,61 +67817,6 @@ img.ProseMirror-separator {
67740
67817
  }
67741
67818
  `;
67742
67819
 
67743
- /**
67744
- * The runtime behavior for template overflow detection.
67745
- * @public
67746
- */
67747
- class OverflowBehavior {
67748
- /**
67749
- * Creates an instance of OverflowBehavior.
67750
- * @param target - The element to check for overflow.
67751
- * @param propertyName - The name of the property to assign the overflow state to.
67752
- */
67753
- constructor(target, propertyName) {
67754
- this.target = target;
67755
- this.propertyName = propertyName;
67756
- }
67757
- /**
67758
- * Bind this behavior to the source.
67759
- * @param source - The source to bind to.
67760
- * @param context - The execution context that the binding is operating within.
67761
- */
67762
- bind(source) {
67763
- this.source = source;
67764
- this.setSourceValue(false);
67765
- this.mouseOverHandler = () => {
67766
- const hasOverflow = this.target.offsetWidth < this.target.scrollWidth;
67767
- this.setSourceValue(hasOverflow);
67768
- };
67769
- this.mouseOutHandler = () => {
67770
- this.setSourceValue(false);
67771
- };
67772
- this.target.addEventListener('mouseover', this.mouseOverHandler);
67773
- this.target.addEventListener('mouseout', this.mouseOutHandler);
67774
- }
67775
- /**
67776
- * Unbinds this behavior from the source.
67777
- * @param source - The source to unbind from.
67778
- */
67779
- unbind() {
67780
- this.source = undefined;
67781
- this.target.removeEventListener('mouseover', this.mouseOverHandler);
67782
- this.target.removeEventListener('mouseout', this.mouseOutHandler);
67783
- }
67784
- setSourceValue(value) {
67785
- // @ts-expect-error set property on source
67786
- this.source[this.propertyName] = value;
67787
- }
67788
- }
67789
- /**
67790
- * A directive that observes if an element has overflow and sets a flag.
67791
- * @param propertyName - The name of the property to assign the overflow flag.
67792
- * @public
67793
- */
67794
- function overflow(propertyName) {
67795
- return new AttachedBehaviorHTMLDirective('nimble-overflow', OverflowBehavior, propertyName);
67796
- }
67797
-
67798
67820
  // Avoiding a wrapping <template> and be careful about starting and ending whitspace
67799
67821
  // so the template can be composed into other column header templates
67800
67822
  // prettier-ignore