@ni/nimble-components 18.9.1 → 18.10.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.
@@ -16744,9 +16744,9 @@
16744
16744
  return `${prefix}${uniqueIdCounter++}`;
16745
16745
  }
16746
16746
 
16747
- const template$n = html `<slot></slot>`;
16747
+ const template$o = html `<slot></slot>`;
16748
16748
 
16749
- const styles$L = css `
16749
+ const styles$M = css `
16750
16750
  :host {
16751
16751
  display: contents;
16752
16752
  }
@@ -16802,8 +16802,8 @@
16802
16802
  ], ThemeProvider.prototype, "theme", void 0);
16803
16803
  const nimbleDesignSystemProvider = ThemeProvider.compose({
16804
16804
  baseName: 'theme-provider',
16805
- styles: styles$L,
16806
- template: template$n
16805
+ styles: styles$M,
16806
+ template: template$o
16807
16807
  });
16808
16808
  DesignSystem.getOrCreate()
16809
16809
  .withPrefix('nimble')
@@ -16987,7 +16987,7 @@
16987
16987
  }
16988
16988
  }
16989
16989
 
16990
- const styles$K = css `
16990
+ const styles$L = css `
16991
16991
  ${display('inline')}
16992
16992
 
16993
16993
  :host {
@@ -17070,7 +17070,7 @@
17070
17070
  `;
17071
17071
 
17072
17072
  // prettier-ignore
17073
- const template$m = (context, definition) => html `
17073
+ const template$n = (context, definition) => html `
17074
17074
  <a
17075
17075
  class="control"
17076
17076
  part="control"
@@ -17140,11 +17140,12 @@
17140
17140
  __decorate$1([
17141
17141
  attr
17142
17142
  ], Anchor.prototype, "appearance", void 0);
17143
+ // FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
17143
17144
  const nimbleAnchor = Anchor.compose({
17144
17145
  baseName: 'anchor',
17145
17146
  baseClass: Anchor$1,
17146
- template: template$m,
17147
- styles: styles$K,
17147
+ template: template$n,
17148
+ styles: styles$L,
17148
17149
  shadowOptions: {
17149
17150
  delegatesFocus: true
17150
17151
  }
@@ -17230,7 +17231,7 @@
17230
17231
  return new MultivaluePropertyStyleSheetBehavior('appearance', value, styles);
17231
17232
  }
17232
17233
 
17233
- const styles$J = css `
17234
+ const styles$K = css `
17234
17235
  ${display('inline-flex')}
17235
17236
 
17236
17237
  :host {
@@ -17511,8 +17512,8 @@
17511
17512
  }
17512
17513
  `));
17513
17514
 
17514
- const styles$I = css `
17515
- ${styles$J}
17515
+ const styles$J = css `
17516
+ ${styles$K}
17516
17517
  ${buttonAppearanceVariantStyles}
17517
17518
 
17518
17519
  .control {
@@ -17520,7 +17521,7 @@
17520
17521
  }
17521
17522
  `;
17522
17523
 
17523
- const template$l = (context, definition) => html `
17524
+ const template$m = (context, definition) => html `
17524
17525
  <a
17525
17526
  class="control"
17526
17527
  part="control"
@@ -17602,8 +17603,8 @@
17602
17603
  ], AnchorButton.prototype, "disabled", void 0);
17603
17604
  const nimbleAnchorButton = AnchorButton.compose({
17604
17605
  baseName: 'anchor-button',
17605
- template: template$l,
17606
- styles: styles$I,
17606
+ template: template$m,
17607
+ styles: styles$J,
17607
17608
  shadowOptions: {
17608
17609
  delegatesFocus: true
17609
17610
  }
@@ -17611,7 +17612,7 @@
17611
17612
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleAnchorButton());
17612
17613
  DesignSystem.tagFor(AnchorButton);
17613
17614
 
17614
- const styles$H = css `
17615
+ const styles$I = css `
17615
17616
  ${display('grid')}
17616
17617
 
17617
17618
  :host {
@@ -17688,7 +17689,7 @@
17688
17689
  }
17689
17690
  `;
17690
17691
 
17691
- const template$k = (context, definition) => html `
17692
+ const template$l = (context, definition) => html `
17692
17693
  <template
17693
17694
  role="menuitem"
17694
17695
  class="${x => (typeof x.startColumnCount === 'number'
@@ -17791,15 +17792,15 @@
17791
17792
  __decorate$1([
17792
17793
  observable
17793
17794
  ], AnchorMenuItem.prototype, "startColumnCount", void 0);
17795
+ // FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
17794
17796
  const nimbleAnchorMenuItem = AnchorMenuItem.compose({
17795
17797
  baseName: 'anchor-menu-item',
17796
- template: template$k,
17797
- styles: styles$H,
17798
+ template: template$l,
17799
+ styles: styles$I,
17798
17800
  shadowOptions: {
17799
17801
  delegatesFocus: true
17800
17802
  }
17801
17803
  });
17802
- applyMixins(AnchorMenuItem, StartEnd);
17803
17804
  DesignSystem.getOrCreate()
17804
17805
  .withPrefix('nimble')
17805
17806
  .register(nimbleAnchorMenuItem());
@@ -17819,7 +17820,7 @@
17819
17820
  }
17820
17821
  });
17821
17822
 
17822
- const styles$G = css `
17823
+ const styles$H = css `
17823
17824
  ${display('inline-flex')}
17824
17825
 
17825
17826
  :host {
@@ -17925,8 +17926,8 @@
17925
17926
  }
17926
17927
  `;
17927
17928
 
17928
- const styles$F = css `
17929
- ${styles$G}
17929
+ const styles$G = css `
17930
+ ${styles$H}
17930
17931
 
17931
17932
  a {
17932
17933
  text-decoration: none;
@@ -17934,9 +17935,17 @@
17934
17935
  cursor: inherit;
17935
17936
  outline: none;
17936
17937
  }
17938
+
17939
+ [part='start'] {
17940
+ display: none;
17941
+ }
17942
+
17943
+ [part='end'] {
17944
+ display: none;
17945
+ }
17937
17946
  `;
17938
17947
 
17939
- const template$j = () => html `
17948
+ const template$k = (context, definition) => html `
17940
17949
  <template slot="anchortab" role="tab" aria-disabled="${x => x.disabled}">
17941
17950
  <a
17942
17951
  download="${x => x.download}"
@@ -17949,7 +17958,9 @@
17949
17958
  type="${x => x.type}"
17950
17959
  tabindex="-1"
17951
17960
  >
17961
+ ${startSlotTemplate(context, definition)}
17952
17962
  <slot></slot>
17963
+ ${endSlotTemplate(context, definition)}
17953
17964
  </a>
17954
17965
  </template>
17955
17966
  `;
@@ -17972,15 +17983,16 @@
17972
17983
  __decorate$1([
17973
17984
  attr({ mode: 'boolean' })
17974
17985
  ], AnchorTab.prototype, "disabled", void 0);
17986
+ // FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
17975
17987
  const nimbleAnchorTab = AnchorTab.compose({
17976
17988
  baseName: 'anchor-tab',
17977
- template: template$j,
17978
- styles: styles$F
17989
+ template: template$k,
17990
+ styles: styles$G
17979
17991
  });
17980
17992
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleAnchorTab());
17981
17993
  DesignSystem.tagFor(AnchorTab);
17982
17994
 
17983
- const styles$E = css `
17995
+ const styles$F = css `
17984
17996
  ${display('grid')}
17985
17997
 
17986
17998
  :host {
@@ -17998,7 +18010,7 @@
17998
18010
  }
17999
18011
  `;
18000
18012
 
18001
- const template$i = (context, definition) => html `
18013
+ const template$j = (context, definition) => html `
18002
18014
  ${startSlotTemplate(context, definition)}
18003
18015
  <div ${ref('tablist')} class="tablist" part="tablist" role="tablist">
18004
18016
  <slot name="anchortab" ${slotted('tabs')}></slot>
@@ -18195,8 +18207,8 @@
18195
18207
  applyMixins(AnchorTabs, StartEnd);
18196
18208
  const nimbleAnchorTabs = AnchorTabs.compose({
18197
18209
  baseName: 'anchor-tabs',
18198
- template: template$i,
18199
- styles: styles$E,
18210
+ template: template$j,
18211
+ styles: styles$F,
18200
18212
  shadowOptions: {
18201
18213
  delegatesFocus: false
18202
18214
  }
@@ -18204,6 +18216,258 @@
18204
18216
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleAnchorTabs());
18205
18217
  DesignSystem.tagFor(AnchorTabs);
18206
18218
 
18219
+ const styles$E = css `
18220
+ ${display('block')}
18221
+
18222
+ :host {
18223
+ ${
18224
+ /* don't set font-size here or else it overrides what we set on .items */ ''}
18225
+ font-family: ${bodyFontFamily};
18226
+ font-weight: ${bodyFontWeight};
18227
+ contain: content;
18228
+ position: relative;
18229
+ outline: none;
18230
+ color: ${bodyFontColor};
18231
+ cursor: pointer;
18232
+ --ni-private-tree-item-nested-width: 0;
18233
+ }
18234
+
18235
+ .control {
18236
+ display: flex;
18237
+ text-decoration: none;
18238
+ color: ${bodyFontColor};
18239
+ }
18240
+
18241
+ .control${focusVisible} {
18242
+ box-shadow: 0px 0px 0px ${borderWidth} ${borderHoverColor} inset;
18243
+ outline: ${borderWidth} solid ${borderHoverColor};
18244
+ outline-offset: -2px;
18245
+ }
18246
+
18247
+ :host([disabled]) .control {
18248
+ cursor: not-allowed;
18249
+ }
18250
+
18251
+ .positioning-region {
18252
+ display: flex;
18253
+ position: relative;
18254
+ box-sizing: border-box;
18255
+ height: calc(${iconSize} * 2);
18256
+ width: 100%;
18257
+ }
18258
+
18259
+ .positioning-region:hover {
18260
+ background: ${fillHoverColor};
18261
+ }
18262
+
18263
+ :host([selected]) .positioning-region {
18264
+ background: ${fillSelectedColor};
18265
+ }
18266
+
18267
+ :host([selected]) .positioning-region:hover {
18268
+ background: ${fillHoverSelectedColor};
18269
+ }
18270
+
18271
+ .positioning-region::before {
18272
+ content: '';
18273
+ display: block;
18274
+ width: var(--ni-private-tree-item-nested-width);
18275
+ flex-shrink: 0;
18276
+ }
18277
+
18278
+ .content-region {
18279
+ display: inline-flex;
18280
+ align-items: center;
18281
+ white-space: nowrap;
18282
+ width: 100%;
18283
+ padding-left: 10px;
18284
+ font: inherit;
18285
+ font-size: ${bodyFontSize};
18286
+ user-select: none;
18287
+ position: relative;
18288
+ margin-inline-start: ${iconSize};
18289
+ }
18290
+
18291
+ :host([disabled]) .content-region {
18292
+ opacity: 0.5;
18293
+ cursor: not-allowed;
18294
+ }
18295
+
18296
+ ${
18297
+ /* this rule keeps children without an icon text aligned with parents */ ''}
18298
+ span[part="start"] {
18299
+ width: ${iconSize};
18300
+ }
18301
+
18302
+ ${ /* the start class is applied when the corresponding slot is filled */''}
18303
+ .start {
18304
+ display: flex;
18305
+ fill: currentcolor;
18306
+ margin-inline-start: ${iconSize};
18307
+ margin-inline-end: ${iconSize};
18308
+ }
18309
+
18310
+ slot[name='start']::slotted(*) {
18311
+ width: ${iconSize};
18312
+ height: ${iconSize};
18313
+ }
18314
+
18315
+ ${ /* the end class is applied when the corresponding slot is filled */''}
18316
+ .end {
18317
+ display: flex;
18318
+ fill: currentcolor;
18319
+ margin-inline-start: ${iconSize};
18320
+ }
18321
+ `;
18322
+
18323
+ const template$i = (context, definition) => html `
18324
+ <template
18325
+ role="treeitem"
18326
+ slot="${x => (x.isNestedItem() ? 'item' : null)}"
18327
+ tabindex="-1"
18328
+ aria-disabled="${x => x.disabled}"
18329
+ aria-selected="${x => x.selected}"
18330
+ @focusin="${(x, c) => x.handleFocus(c.event)}"
18331
+ @focusout="${(x, c) => x.handleBlur(c.event)}"
18332
+ @keydown="${(x, c) => x.keydownHandler(c.event)}"
18333
+ @click="${(x, c) => x.clickHandler(c.event)}"
18334
+ >
18335
+ <a
18336
+ class="control"
18337
+ part="control"
18338
+ tabindex="0"
18339
+ download="${x => x.download}"
18340
+ href=${x => (x.disabled ? null : x.href)}
18341
+ hreflang="${x => x.hreflang}"
18342
+ ping="${x => x.ping}"
18343
+ referrerpolicy="${x => x.referrerpolicy}"
18344
+ rel="${x => x.rel}"
18345
+ target="${x => x.target}"
18346
+ type="${x => x.type}"
18347
+ ${ref('control')}
18348
+ >
18349
+ <div class="positioning-region" part="positioning-region">
18350
+ <div class="content-region" part="content-region">
18351
+ ${startSlotTemplate(context, definition)}
18352
+ <span class="content" part="content">
18353
+ <slot></slot>
18354
+ </span>
18355
+ ${endSlotTemplate(context, definition)}
18356
+ </div>
18357
+ </div>
18358
+ </a>
18359
+ </template>
18360
+ `;
18361
+
18362
+ /**
18363
+ * A nimble-styled anchor tree item
18364
+ */
18365
+ class AnchorTreeItem extends AnchorBase {
18366
+ constructor() {
18367
+ super(...arguments);
18368
+ /**
18369
+ * When true, the control will appear selected by user interaction.
18370
+ * @public
18371
+ * @remarks
18372
+ * HTML Attribute: selected
18373
+ */
18374
+ this.selected = false;
18375
+ /**
18376
+ * When true, the control will be immutable by user interaction. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled | disabled HTML attribute} for more information.
18377
+ * @public
18378
+ * @remarks
18379
+ * HTML Attribute: disabled
18380
+ */
18381
+ this.disabled = false;
18382
+ }
18383
+ /**
18384
+ * Whether the tree is nested
18385
+ *
18386
+ * @public
18387
+ */
18388
+ isNestedItem() {
18389
+ return isTreeItemElement(this.parentElement);
18390
+ }
18391
+ /**
18392
+ * Handle focus events
18393
+ *
18394
+ * @internal
18395
+ */
18396
+ handleFocus(_e) {
18397
+ this.setAttribute('tabindex', '0');
18398
+ }
18399
+ /**
18400
+ * Handle blur events
18401
+ *
18402
+ * @internal
18403
+ */
18404
+ handleBlur(_e) {
18405
+ this.setAttribute('tabindex', '-1');
18406
+ }
18407
+ /**
18408
+ * @internal
18409
+ */
18410
+ keydownHandler(e) {
18411
+ if (e.defaultPrevented) {
18412
+ return false;
18413
+ }
18414
+ switch (e.key) {
18415
+ case keyEnter:
18416
+ // Do not let the event bubble up to the FAST tree, or it will
18417
+ // prevent the default action.
18418
+ e.stopPropagation();
18419
+ break;
18420
+ case keyArrowLeft:
18421
+ // For FAST tree items, the FAST tree view handles this navigation,
18422
+ // but since our anchor tree item is not "instanceof FASTTreeItem",
18423
+ // the FAST tree view won't do this for us. We do it ourselves.
18424
+ if (this.parentElement && this.isNestedItem()) {
18425
+ TreeItem$1.focusItem(this.parentElement);
18426
+ }
18427
+ break;
18428
+ }
18429
+ return true;
18430
+ }
18431
+ /**
18432
+ * Activating the anchor by pressing the Enter key results in a click event.
18433
+ * This bubbles up to the Nimble tree-view's click handler, causing the tree item
18434
+ * to be selected. We don't want that for anchor tree items. We'll stop propagation
18435
+ * of the event to prevent that.
18436
+ * @internal
18437
+ */
18438
+ clickHandler(e) {
18439
+ if (e.defaultPrevented) {
18440
+ return false;
18441
+ }
18442
+ e.stopPropagation();
18443
+ return true;
18444
+ }
18445
+ selectedChanged(_prev, _next) {
18446
+ if (this.$fastController.isConnected) {
18447
+ this.$emit('selected-change', this);
18448
+ }
18449
+ }
18450
+ }
18451
+ __decorate$1([
18452
+ attr({ mode: 'boolean' })
18453
+ ], AnchorTreeItem.prototype, "selected", void 0);
18454
+ __decorate$1([
18455
+ attr({ mode: 'boolean' })
18456
+ ], AnchorTreeItem.prototype, "disabled", void 0);
18457
+ // FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
18458
+ const nimbleAnchorTreeItem = AnchorTreeItem.compose({
18459
+ baseName: 'anchor-tree-item',
18460
+ template: template$i,
18461
+ styles: styles$E,
18462
+ shadowOptions: {
18463
+ delegatesFocus: true
18464
+ }
18465
+ });
18466
+ DesignSystem.getOrCreate()
18467
+ .withPrefix('nimble')
18468
+ .register(nimbleAnchorTreeItem());
18469
+ DesignSystem.tagFor(AnchorTreeItem);
18470
+
18207
18471
  const styles$D = css `
18208
18472
  :host {
18209
18473
  contain: layout;
@@ -18467,7 +18731,7 @@
18467
18731
  `));
18468
18732
 
18469
18733
  const styles$B = css `
18470
- ${styles$J}
18734
+ ${styles$K}
18471
18735
  ${buttonAppearanceVariantStyles}
18472
18736
  `;
18473
18737
 
@@ -19809,7 +20073,7 @@
19809
20073
  DesignSystem.tagFor(Checkbox);
19810
20074
 
19811
20075
  const styles$v = css `
19812
- ${styles$J}
20076
+ ${styles$K}
19813
20077
 
19814
20078
  .control[aria-pressed='true'] {
19815
20079
  background-color: ${fillSelectedColor};
@@ -24234,7 +24498,7 @@
24234
24498
  baseName: 'tab',
24235
24499
  baseClass: Tab$1,
24236
24500
  template: tabTemplate,
24237
- styles: styles$G
24501
+ styles: styles$H
24238
24502
  });
24239
24503
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTab());
24240
24504
  DesignSystem.tagFor(Tab);