@ni/nimble-components 11.8.5 → 11.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.
@@ -9518,7 +9518,7 @@
9518
9518
  *
9519
9519
  * @public
9520
9520
  */
9521
- class Dialog extends FoundationElement {
9521
+ class Dialog$1 extends FoundationElement {
9522
9522
  constructor() {
9523
9523
  super(...arguments);
9524
9524
  /**
@@ -9602,7 +9602,7 @@
9602
9602
  };
9603
9603
  this.getTabQueueBounds = () => {
9604
9604
  const bounds = [];
9605
- return Dialog.reduceTabbableItems(bounds, this);
9605
+ return Dialog$1.reduceTabbableItems(bounds, this);
9606
9606
  };
9607
9607
  /**
9608
9608
  * focus on first element of tab queue
@@ -9726,12 +9726,12 @@
9726
9726
  return elements;
9727
9727
  }
9728
9728
  if (isTabbable(element) ||
9729
- (Dialog.isFocusableFastElement(element) && Dialog.hasTabbableShadow(element))) {
9729
+ (Dialog$1.isFocusableFastElement(element) && Dialog$1.hasTabbableShadow(element))) {
9730
9730
  elements.push(element);
9731
9731
  return elements;
9732
9732
  }
9733
9733
  if (element.childElementCount) {
9734
- return elements.concat(Array.from(element.children).reduce(Dialog.reduceTabbableItems, []));
9734
+ return elements.concat(Array.from(element.children).reduce(Dialog$1.reduceTabbableItems, []));
9735
9735
  }
9736
9736
  return elements;
9737
9737
  }
@@ -9762,22 +9762,22 @@
9762
9762
  }
9763
9763
  __decorate$1([
9764
9764
  attr({ mode: "boolean" })
9765
- ], Dialog.prototype, "modal", void 0);
9765
+ ], Dialog$1.prototype, "modal", void 0);
9766
9766
  __decorate$1([
9767
9767
  attr({ mode: "boolean" })
9768
- ], Dialog.prototype, "hidden", void 0);
9768
+ ], Dialog$1.prototype, "hidden", void 0);
9769
9769
  __decorate$1([
9770
9770
  attr({ attribute: "trap-focus", mode: "boolean" })
9771
- ], Dialog.prototype, "trapFocus", void 0);
9771
+ ], Dialog$1.prototype, "trapFocus", void 0);
9772
9772
  __decorate$1([
9773
9773
  attr({ attribute: "aria-describedby" })
9774
- ], Dialog.prototype, "ariaDescribedby", void 0);
9774
+ ], Dialog$1.prototype, "ariaDescribedby", void 0);
9775
9775
  __decorate$1([
9776
9776
  attr({ attribute: "aria-labelledby" })
9777
- ], Dialog.prototype, "ariaLabelledby", void 0);
9777
+ ], Dialog$1.prototype, "ariaLabelledby", void 0);
9778
9778
  __decorate$1([
9779
9779
  attr({ attribute: "aria-label" })
9780
- ], Dialog.prototype, "ariaLabel", void 0);
9780
+ ], Dialog$1.prototype, "ariaLabel", void 0);
9781
9781
 
9782
9782
  /**
9783
9783
  * The template for the {@link @microsoft/fast-foundation#(ListboxOption:class)} component.
@@ -14250,7 +14250,7 @@
14250
14250
  */
14251
14251
  const focusVisible$1 = canUseFocusVisible() ? "focus-visible" : "focus";
14252
14252
 
14253
- const styles$u = css `
14253
+ const styles$v = css `
14254
14254
  :host {
14255
14255
  contain: layout;
14256
14256
  display: block;
@@ -14274,7 +14274,7 @@
14274
14274
  baseName: 'anchored-region',
14275
14275
  baseClass: AnchoredRegion$1,
14276
14276
  template: anchoredRegionTemplate,
14277
- styles: styles$u
14277
+ styles: styles$v
14278
14278
  });
14279
14279
  DesignSystem.getOrCreate()
14280
14280
  .withPrefix('nimble')
@@ -14616,9 +14616,9 @@
14616
14616
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14617
14617
  }
14618
14618
 
14619
- const template$6 = html `<slot></slot>`;
14619
+ const template$7 = html `<slot></slot>`;
14620
14620
 
14621
- const styles$t = css `
14621
+ const styles$u = css `
14622
14622
  :host {
14623
14623
  display: contents;
14624
14624
  }
@@ -14674,8 +14674,8 @@
14674
14674
  ], ThemeProvider.prototype, "theme", void 0);
14675
14675
  const nimbleDesignSystemProvider = ThemeProvider.compose({
14676
14676
  baseName: 'theme-provider',
14677
- styles: styles$t,
14678
- template: template$6
14677
+ styles: styles$u,
14678
+ template: template$7
14679
14679
  });
14680
14680
  DesignSystem.getOrCreate()
14681
14681
  .withPrefix('nimble')
@@ -14898,7 +14898,7 @@
14898
14898
  */
14899
14899
  const themeBehavior = (theme, styles) => new ThemeStyleSheetBehavior(theme, styles);
14900
14900
 
14901
- const styles$s = css `
14901
+ const styles$t = css `
14902
14902
  ${display('inline-block')}
14903
14903
 
14904
14904
  :host {
@@ -14958,7 +14958,7 @@
14958
14958
  baseName: 'breadcrumb',
14959
14959
  baseClass: Breadcrumb$1,
14960
14960
  template: breadcrumbTemplate,
14961
- styles: styles$s
14961
+ styles: styles$t
14962
14962
  });
14963
14963
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleBreadcrumb());
14964
14964
 
@@ -15544,7 +15544,7 @@
15544
15544
  */
15545
15545
  const focusVisible = `:${focusVisible$1}`;
15546
15546
 
15547
- const styles$r = css `
15547
+ const styles$s = css `
15548
15548
  ${display('inline-flex')}
15549
15549
 
15550
15550
  :host {
@@ -15624,7 +15624,7 @@
15624
15624
  baseName: 'breadcrumb-item',
15625
15625
  baseClass: BreadcrumbItem$1,
15626
15626
  template: breadcrumbItemTemplate,
15627
- styles: styles$r,
15627
+ styles: styles$s,
15628
15628
  separator: forwardSlash16X16.data
15629
15629
  });
15630
15630
  DesignSystem.getOrCreate()
@@ -15709,7 +15709,7 @@
15709
15709
  block: 'block'
15710
15710
  };
15711
15711
 
15712
- const styles$q = css `
15712
+ const styles$r = css `
15713
15713
  ${display('inline-flex')}
15714
15714
 
15715
15715
  :host {
@@ -15916,7 +15916,7 @@
15916
15916
  `));
15917
15917
 
15918
15918
  // prettier-ignore
15919
- const styles$p = styles$q
15919
+ const styles$q = styles$r
15920
15920
  .withBehaviors(appearanceBehavior(ButtonAppearance.outline, css `
15921
15921
  :host(.primary) .control {
15922
15922
  box-shadow: 0px 0px 0px ${borderWidth} rgba(${actionRgbPartialColor}, 0.3) inset;
@@ -16030,7 +16030,7 @@
16030
16030
  baseName: 'button',
16031
16031
  baseClass: Button$1,
16032
16032
  template: buttonTemplate,
16033
- styles: styles$p,
16033
+ styles: styles$q,
16034
16034
  shadowOptions: {
16035
16035
  delegatesFocus: true
16036
16036
  }
@@ -16038,7 +16038,7 @@
16038
16038
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleButton());
16039
16039
 
16040
16040
  // prettier-ignore
16041
- const styles$o = css `
16041
+ const styles$p = css `
16042
16042
  ${display('inline-flex')}
16043
16043
 
16044
16044
  :host {
@@ -16201,14 +16201,14 @@
16201
16201
  const nimbleCardButton = CardButton.compose({
16202
16202
  baseName: 'card-button',
16203
16203
  template: buttonTemplate,
16204
- styles: styles$o,
16204
+ styles: styles$p,
16205
16205
  shadowOptions: {
16206
16206
  delegatesFocus: true
16207
16207
  }
16208
16208
  });
16209
16209
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleCardButton());
16210
16210
 
16211
- const styles$n = css `
16211
+ const styles$o = css `
16212
16212
  ${display('inline-flex')}
16213
16213
 
16214
16214
  :host {
@@ -16326,7 +16326,7 @@
16326
16326
  baseName: 'checkbox',
16327
16327
  baseClass: Checkbox$1,
16328
16328
  template: checkboxTemplate,
16329
- styles: styles$n,
16329
+ styles: styles$o,
16330
16330
  checkedIndicator: check16X16.data,
16331
16331
  indeterminateIndicator: minus16X16.data
16332
16332
  });
@@ -16338,13 +16338,13 @@
16338
16338
  </div>
16339
16339
  `;
16340
16340
 
16341
- const template$5 = html `
16341
+ const template$6 = html `
16342
16342
  <template>
16343
16343
  <div class="icon" :innerHTML=${x => x.icon.data}></div>
16344
16344
  </template
16345
16345
  `;
16346
16346
 
16347
- const styles$m = css `
16347
+ const styles$n = css `
16348
16348
  ${display('inline-flex')}
16349
16349
 
16350
16350
  :host {
@@ -16394,8 +16394,8 @@
16394
16394
  const registerIcon = (baseName, iconClass) => {
16395
16395
  const composedIcon = iconClass.compose({
16396
16396
  baseName,
16397
- template: template$5,
16398
- styles: styles$m,
16397
+ template: template$6,
16398
+ styles: styles$n,
16399
16399
  baseClass: iconClass
16400
16400
  });
16401
16401
  DesignSystem.getOrCreate().withPrefix('nimble').register(composedIcon());
@@ -16423,7 +16423,17 @@
16423
16423
  }
16424
16424
  registerIcon('icon-arrow-expander-down', IconArrowExpanderDown);
16425
16425
 
16426
- const styles$l = css `
16426
+ ({
16427
+ above: SelectPosition.above,
16428
+ below: SelectPosition.below
16429
+ });
16430
+ const DropdownAppearance = {
16431
+ underline: 'underline',
16432
+ outline: 'outline',
16433
+ block: 'block'
16434
+ };
16435
+
16436
+ const styles$m = css `
16427
16437
  ${display('inline-flex')}
16428
16438
 
16429
16439
  :host {
@@ -16476,10 +16486,6 @@
16476
16486
  transition: width ${smallDelay} ease-in;
16477
16487
  }
16478
16488
 
16479
- :host(.invalid)::after {
16480
- border-bottom-color: ${failColor};
16481
- }
16482
-
16483
16489
  @media (prefers-reduced-motion) {
16484
16490
  :host::after {
16485
16491
  transition-duration: 0s;
@@ -16502,10 +16508,9 @@
16502
16508
  display: flex;
16503
16509
  min-height: 100%;
16504
16510
  width: 100%;
16505
- border-bottom: ${borderWidth} solid ${bodyDisabledFontColor};
16511
+ border: 0px solid rgba(${borderRgbPartialColor}, 0.3);
16506
16512
  background-color: transparent;
16507
- padding-left: 8px;
16508
- padding-bottom: 1px;
16513
+ padding: ${borderWidth};
16509
16514
  }
16510
16515
 
16511
16516
  :host(.open:not(:hover)) .control {
@@ -16568,6 +16573,12 @@
16568
16573
  white-space: nowrap;
16569
16574
  text-overflow: ellipsis;
16570
16575
  overflow: hidden;
16576
+ padding: 0px;
16577
+ padding-left: calc(${standardPadding} / 2);
16578
+ }
16579
+
16580
+ .selected-value[disabled]::placeholder {
16581
+ color: ${bodyDisabledFontColor};
16571
16582
  }
16572
16583
 
16573
16584
  .indicator {
@@ -16607,9 +16618,36 @@
16607
16618
  ::slotted(option) {
16608
16619
  flex: none;
16609
16620
  }
16610
- `;
16621
+ `.withBehaviors(appearanceBehavior(DropdownAppearance.underline, css `
16622
+ .control {
16623
+ border-bottom-width: ${borderWidth};
16624
+ padding-bottom: 0;
16625
+ }
16611
16626
 
16612
- const styles$k = css `
16627
+ :host([disabled]) .control {
16628
+ border-color: rgba(${borderRgbPartialColor}, 0.1);
16629
+ }
16630
+ `), appearanceBehavior(DropdownAppearance.outline, css `
16631
+ .control {
16632
+ border-width: ${borderWidth};
16633
+ padding: 0;
16634
+ }
16635
+ `), appearanceBehavior(DropdownAppearance.block, css `
16636
+ .control {
16637
+ background-color: rgba(${borderRgbPartialColor}, 0.1);
16638
+ }
16639
+
16640
+ .control:focus-within {
16641
+ border-bottom-width: ${borderWidth};
16642
+ padding-bottom: 0;
16643
+ }
16644
+
16645
+ :host([disabled]) .control {
16646
+ background-color: rgba(${borderRgbPartialColor}, 0.07);
16647
+ }
16648
+ `));
16649
+
16650
+ const styles$l = css `
16613
16651
  .error-icon {
16614
16652
  display: none;
16615
16653
  }
@@ -16647,13 +16685,16 @@
16647
16685
  }
16648
16686
  `;
16649
16687
 
16650
- const styles$j = css `
16688
+ const styles$k = css `
16689
+ ${styles$m}
16651
16690
  ${styles$l}
16652
- ${styles$k}
16653
16691
 
16654
16692
  :host {
16655
16693
  --ni-private-hover-bottom-border-width: 2px;
16656
16694
  --ni-private-bottom-border-width: 1px;
16695
+ --ni-private-height-within-border: calc(
16696
+ ${controlHeight} - 2 * ${borderWidth}
16697
+ );
16657
16698
  }
16658
16699
 
16659
16700
  :host([disabled]) *,
@@ -16662,6 +16703,10 @@
16662
16703
  color: ${bodyDisabledFontColor};
16663
16704
  }
16664
16705
 
16706
+ :host(.invalid)::after {
16707
+ border-bottom-color: ${failColor};
16708
+ }
16709
+
16665
16710
  .control {
16666
16711
  bottom-border-width: var(--ni-private-bottom-border-width);
16667
16712
  }
@@ -16678,8 +16723,9 @@
16678
16723
  border-color: rgba(${borderRgbPartialColor}, 0.1);
16679
16724
  }
16680
16725
 
16681
- :host(.invalid[disabled]) .control {
16682
- border-color: ${failColor};
16726
+ :host(.invalid[disabled]) .control,
16727
+ :host(.open.invalid) .control {
16728
+ border-bottom-color: ${failColor};
16683
16729
  }
16684
16730
 
16685
16731
  .selected-value {
@@ -16690,7 +16736,7 @@
16690
16736
  margin: auto 0;
16691
16737
  width: 100%;
16692
16738
  font-size: inherit;
16693
- padding-left: 0px;
16739
+ height: var(--ni-private-height-within-border);
16694
16740
  }
16695
16741
 
16696
16742
  .selected-value:hover,
@@ -16731,7 +16777,12 @@
16731
16777
  :host(:empty) .listbox {
16732
16778
  display: none;
16733
16779
  }
16734
- `;
16780
+ `.withBehaviors(appearanceBehavior(DropdownAppearance.block, css `
16781
+ :host(.invalid) .control {
16782
+ border-bottom-width: ${borderWidth};
16783
+ padding-bottom: 0;
16784
+ }
16785
+ `));
16735
16786
 
16736
16787
  /**
16737
16788
  * A nimble-styed HTML combobox
@@ -16739,6 +16790,7 @@
16739
16790
  class Combobox extends Combobox$1 {
16740
16791
  constructor() {
16741
16792
  super(...arguments);
16793
+ this.appearance = DropdownAppearance.underline;
16742
16794
  this.valueUpdatedByInput = false;
16743
16795
  }
16744
16796
  // Workaround for https://github.com/microsoft/fast/issues/5123
@@ -16871,6 +16923,9 @@
16871
16923
  }
16872
16924
  }
16873
16925
  }
16926
+ __decorate([
16927
+ attr
16928
+ ], Combobox.prototype, "appearance", void 0);
16874
16929
  __decorate([
16875
16930
  observable
16876
16931
  ], Combobox.prototype, "dropdownButton", void 0);
@@ -16881,7 +16936,7 @@
16881
16936
  baseName: 'combobox',
16882
16937
  baseClass: Combobox$1,
16883
16938
  template: comboboxTemplate,
16884
- styles: styles$j,
16939
+ styles: styles$k,
16885
16940
  shadowOptions: {
16886
16941
  delegatesFocus: true
16887
16942
  },
@@ -16918,6 +16973,116 @@
16918
16973
  });
16919
16974
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleCombobox());
16920
16975
 
16976
+ const styles$j = css `
16977
+ ${display('grid')}
16978
+
16979
+ dialog {
16980
+ background-color: ${applicationBackgroundColor};
16981
+ border: ${borderWidth} solid ${popupBorderColor};
16982
+ box-shadow: 0px 2px 3px ${popupBoxShadowColor};
16983
+ max-width: 50%;
16984
+ }
16985
+ `;
16986
+
16987
+ const template$5 = html `
16988
+ <template>
16989
+ <dialog
16990
+ ${ref('dialogElement')}
16991
+ role="alertdialog"
16992
+ aria-label="${x => x.ariaLabel}"
16993
+ @cancel="${(x, c) => x.cancelHandler(c.event)}"
16994
+ @close="${x => x.closeHandler()}"
16995
+ >
16996
+ <slot></slot>
16997
+ </dialog>
16998
+ </template>
16999
+ `;
17000
+
17001
+ /**
17002
+ * Symbol that is returned as the dialog close reason (from the Promise returned by show()) when
17003
+ * the dialog was closed by pressing the ESC key (vs. calling the close() function).
17004
+ */
17005
+ const USER_DISMISSED = Symbol('user dismissed');
17006
+ /**
17007
+ * A nimble-styled dialog.
17008
+ */
17009
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
17010
+ class Dialog extends FoundationElement {
17011
+ constructor() {
17012
+ super(...arguments);
17013
+ /**
17014
+ * @public
17015
+ * @description
17016
+ * Prevents dismissing the dialog via the Escape key
17017
+ */
17018
+ this.preventDismiss = false;
17019
+ }
17020
+ /**
17021
+ * True if the dialog is open/showing, false otherwise
17022
+ */
17023
+ get open() {
17024
+ return this.resolveShow !== undefined;
17025
+ }
17026
+ /**
17027
+ * Opens the dialog
17028
+ * @returns Promise that is resolved when the dialog is closed. The value of the resolved Promise is the reason value passed to the close() method, or USER_DISMISSED if the dialog was closed via the ESC key.
17029
+ */
17030
+ async show() {
17031
+ if (this.open) {
17032
+ throw new Error('Dialog is already open');
17033
+ }
17034
+ this.dialogElement.showModal();
17035
+ return new Promise((resolve, _reject) => {
17036
+ this.resolveShow = resolve;
17037
+ });
17038
+ }
17039
+ /**
17040
+ * Closes the dialog
17041
+ * @param reason An optional value indicating how/why the dialog was closed.
17042
+ */
17043
+ close(reason) {
17044
+ if (!this.open) {
17045
+ throw new Error('Dialog is not open');
17046
+ }
17047
+ this.closeReason = reason;
17048
+ this.dialogElement.close();
17049
+ }
17050
+ /**
17051
+ * @internal
17052
+ */
17053
+ closeHandler() {
17054
+ this.resolveShow(this.closeReason);
17055
+ this.resolveShow = undefined;
17056
+ return true;
17057
+ }
17058
+ /**
17059
+ * @internal
17060
+ */
17061
+ cancelHandler(event) {
17062
+ if (this.preventDismiss) {
17063
+ event.preventDefault();
17064
+ }
17065
+ else {
17066
+ this.closeReason = USER_DISMISSED;
17067
+ }
17068
+ return true;
17069
+ }
17070
+ }
17071
+ __decorate([
17072
+ attr({ attribute: 'prevent-dismiss', mode: 'boolean' })
17073
+ ], Dialog.prototype, "preventDismiss", void 0);
17074
+ applyMixins(Dialog, ARIAGlobalStatesAndProperties);
17075
+ const nimbleDialog = Dialog.compose({
17076
+ baseName: 'dialog',
17077
+ template: template$5,
17078
+ styles: styles$j,
17079
+ baseClass: Dialog,
17080
+ shadowOptions: {
17081
+ delegatesFocus: true
17082
+ }
17083
+ });
17084
+ DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleDialog());
17085
+
16921
17086
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
16922
17087
 
16923
17088
  var dist = {};
@@ -18135,7 +18300,7 @@
18135
18300
  * which animates to be visible with a slide-in / slide-out animation.
18136
18301
  * Configured via 'location', 'state', 'modal', 'preventDismiss' properties.
18137
18302
  */
18138
- class Drawer extends Dialog {
18303
+ class Drawer extends Dialog$1 {
18139
18304
  constructor() {
18140
18305
  super(...arguments);
18141
18306
  this.location = DrawerLocation.left;
@@ -20025,7 +20190,7 @@
20025
20190
  `;
20026
20191
 
20027
20192
  const styles$e = css `
20028
- ${styles$q}
20193
+ ${styles$r}
20029
20194
 
20030
20195
  .control[aria-pressed='true'] {
20031
20196
  background-color: ${fillSelectedColor};
@@ -20465,7 +20630,7 @@
20465
20630
 
20466
20631
  const styles$c = css `
20467
20632
  ${display('inline-block')}
20468
- ${styles$k}
20633
+ ${styles$l}
20469
20634
 
20470
20635
  :host {
20471
20636
  font: ${bodyFont};
@@ -20710,50 +20875,9 @@
20710
20875
  });
20711
20876
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleNumberField());
20712
20877
 
20713
- ({
20714
- above: SelectPosition.above,
20715
- below: SelectPosition.below
20716
- });
20717
- const DropdownAppearance = {
20718
- underline: 'underline',
20719
- outline: 'outline',
20720
- block: 'block'
20721
- };
20722
-
20723
20878
  const styles$b = css `
20724
- ${styles$l}
20725
- `.withBehaviors(appearanceBehavior(DropdownAppearance.underline, css `
20726
- .control {
20727
- padding-top: ${borderWidth};
20728
- padding-left: calc(${borderWidth} + ${standardPadding} / 2);
20729
- padding-right: ${borderWidth};
20730
- }
20731
-
20732
- :host([disabled]) .control {
20733
- border-color: rgba(${borderRgbPartialColor}, 0.1);
20734
- }
20735
- `), appearanceBehavior(DropdownAppearance.outline, css `
20736
- .control {
20737
- border: ${borderWidth} solid rgba(${borderRgbPartialColor}, 0.3);
20738
- }
20739
-
20740
- :host(.invalid) .errortext {
20741
- top: calc(${controlHeight} - ${borderWidth});
20742
- }
20743
- `), appearanceBehavior(DropdownAppearance.block, css `
20744
- .control {
20745
- background-color: rgba(${borderRgbPartialColor}, 0.1);
20746
- padding-left: calc(${borderWidth} + ${standardPadding} / 2);
20747
- padding-right: ${borderWidth};
20748
- padding-bottom: calc(${borderWidth});
20749
- border-bottom: ${borderWidth}
20750
- rgba(${borderRgbPartialColor}, 0.07);
20751
- }
20752
-
20753
- :host([disabled]) .control {
20754
- background-color: rgba(${borderRgbPartialColor}, 0.07);
20755
- }
20756
- `));
20879
+ ${styles$m}
20880
+ `;
20757
20881
 
20758
20882
  /**
20759
20883
  * A nimble-styled HTML select
@@ -21391,7 +21515,7 @@
21391
21515
  /* eslint-disable @typescript-eslint/indent */
21392
21516
  const styles$4 = css `
21393
21517
  ${display('inline-block')}
21394
- ${styles$k}
21518
+ ${styles$l}
21395
21519
 
21396
21520
  :host {
21397
21521
  font: ${bodyFont};