@ni/nimble-components 13.0.0 → 14.0.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.
@@ -14908,7 +14908,7 @@
14908
14908
  const [titlePlus1Font, titlePlus1FontColor, titlePlus1DisabledFontColor, titlePlus1FontFamily, titlePlus1FontWeight, titlePlus1FontSize, titlePlus1FontLineHeight, titlePlus1FallbackFontFamily] = createFontTokens(tokenNames.titlePlus1Font, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), Title2Family, Title2Weight, Title2Size, Title2LineHeight, 'sans-serif');
14909
14909
  createFontTokens(tokenNames.titleFont, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), Title1Family, Title1Weight, Title1Size, Title1LineHeight, 'sans-serif');
14910
14910
  createFontTokens(tokenNames.subtitlePlus1Font, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), Subtitle2Family, Subtitle2Weight, Subtitle2Size, Subtitle2LineHeight, 'sans-serif');
14911
- createFontTokens(tokenNames.subtitleFont, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), Subtitle1Family, Subtitle1Weight, Subtitle1Size, Subtitle1LineHeight, 'sans-serif');
14911
+ const [subtitleFont, subtitleFontColor, subtitleDisabledFontColor, subtitleFontFamily, subtitleFontWeight, subtitleFontSize, subtitleFontLineHeight, subtitleFallbackFontFamily] = createFontTokens(tokenNames.subtitleFont, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), Subtitle1Family, Subtitle1Weight, Subtitle1Size, Subtitle1LineHeight, 'sans-serif');
14912
14912
  createFontTokens(tokenNames.linkStandardFont, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), LinkLightUiFamily, LinkLightUiWeight, LinkLightUiSize, LinkLineHeight, 'sans-serif');
14913
14913
  const [placeholderFont, placeholderFontColor, placeholderDisabledFontColor, placeholderFontFamily, placeholderFontWeight, placeholderFontSize, placeholderFontLineHeight, placeholderFallbackFontFamily] = createFontTokens(tokenNames.placeholderFont, (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.6), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), PlaceholderFamily, PlaceholderWeight, PlaceholderSize, PlaceholderLineHeight, 'sans-serif');
14914
14914
  const [bodyEmphasizedFont, bodyEmphasizedFontColor, bodyEmphasizedDisabledFontColor, bodyEmphasizedFontFamily, bodyEmphasizedFontWeight, bodyEmphasizedFontSize, bodyEmphasizedFontLineHeight, bodyEmphasizedFallbackFontFamily] = createFontTokens(tokenNames.bodyEmphasizedFont, (element) => getDefaultFontColorForTheme(element), (element) => hexToRgbaCssColor(getDefaultFontColorForTheme(element), 0.3), BodyEmphasizedFamily, BodyEmphasizedWeight, BodyEmphasizedSize, BodyEmphasizedLineHeight, 'sans-serif');
@@ -17307,10 +17307,98 @@
17307
17307
  ${display('grid')}
17308
17308
 
17309
17309
  dialog {
17310
+ flex-direction: column;
17310
17311
  background-color: ${applicationBackgroundColor};
17311
- border: ${borderWidth} solid ${popupBorderColor};
17312
- box-shadow: 0px 2px 3px ${popupBoxShadowColor};
17313
- max-width: 50%;
17312
+ border: none;
17313
+ box-shadow: 0px 4px 8px #0000004d;
17314
+ padding: 0px;
17315
+ width: 400px;
17316
+ max-height: 600px;
17317
+ }
17318
+
17319
+ dialog[open] {
17320
+ display: flex;
17321
+ }
17322
+
17323
+ header {
17324
+ min-height: 48px;
17325
+ padding: 24px 24px 0px 24px;
17326
+ flex: none;
17327
+ display: flex;
17328
+ flex-direction: column;
17329
+ gap: ${smallPadding};
17330
+ }
17331
+
17332
+ :host([header-hidden]) header {
17333
+ ${
17334
+ /**
17335
+ * Hide content visually while keeping it screen reader-accessible.
17336
+ * Source: https://webaim.org/techniques/css/invisiblecontent/#techniques
17337
+ * See discussion here: https://github.com/microsoft/fast/issues/5740#issuecomment-1068195035
17338
+ */
17339
+ ''}
17340
+ display: inline-block;
17341
+ height: 1px;
17342
+ width: 1px;
17343
+ position: absolute;
17344
+ margin: -1px;
17345
+ clip: rect(1px, 1px, 1px, 1px);
17346
+ clip-path: inset(50%);
17347
+ overflow: hidden;
17348
+ padding: 0;
17349
+ }
17350
+
17351
+ .title {
17352
+ font: ${titlePlus1Font};
17353
+ color: ${titlePlus1FontColor};
17354
+ overflow: hidden;
17355
+ text-overflow: ellipsis;
17356
+ white-space: nowrap;
17357
+ }
17358
+
17359
+ .subtitle {
17360
+ font: ${subtitleFont};
17361
+ color: ${subtitleFontColor};
17362
+ }
17363
+
17364
+ section {
17365
+ flex: auto;
17366
+ overflow-y: auto;
17367
+ font: ${bodyFont};
17368
+ color: ${bodyFontColor};
17369
+ display: flex;
17370
+ flex-direction: column;
17371
+ gap: ${standardPadding};
17372
+
17373
+ ${
17374
+ /**
17375
+ * Use padding on all sides except the top because the padding is within
17376
+ * the scrollable area. The whole scrollable area, including the top of
17377
+ * the scrollbar, should be 24px away from the header, so use a margin
17378
+ * instead of padding for the top.
17379
+ */
17380
+ ''}
17381
+ padding: 0px 24px 24px 24px;
17382
+ margin-top: 24px;
17383
+ }
17384
+
17385
+ footer {
17386
+ border-top: 2px solid rgba(${actionRgbPartialColor}, 0.1);
17387
+ padding: 24px;
17388
+ flex: none;
17389
+ display: flex;
17390
+ justify-content: flex-end;
17391
+ gap: ${standardPadding};
17392
+ }
17393
+
17394
+ footer.empty {
17395
+ padding: 0px;
17396
+ height: 72px;
17397
+ border-top: none;
17398
+ }
17399
+
17400
+ :host([footer-hidden]) footer {
17401
+ display: none;
17314
17402
  }
17315
17403
  `.withBehaviors(
17316
17404
  /*
@@ -17335,11 +17423,27 @@
17335
17423
  <template>
17336
17424
  <dialog
17337
17425
  ${ref('dialogElement')}
17338
- role="alertdialog"
17339
- aria-label="${x => x.ariaLabel}"
17426
+ role="dialog"
17340
17427
  @cancel="${(x, c) => x.cancelHandler(c.event)}"
17428
+ aria-labelledby="header"
17341
17429
  >
17342
- <slot></slot>
17430
+ <header id="header">
17431
+ <div class="title">
17432
+ <slot name="title"></slot>
17433
+ </div>
17434
+ <div class="subtitle">
17435
+ <slot name="subtitle"></slot>
17436
+ </div>
17437
+ </header>
17438
+ <section>
17439
+ <slot></slot>
17440
+ </section>
17441
+ <footer class="${x => (x.footerIsEmpty ? 'empty' : '')}">
17442
+ <slot
17443
+ name="footer"
17444
+ ${slotted({ property: 'slottedFooterElements' })}
17445
+ ></slot>
17446
+ </footer>
17343
17447
  </dialog>
17344
17448
  </template>
17345
17449
  `;
@@ -17357,6 +17461,20 @@
17357
17461
  * Prevents dismissing the dialog via the Escape key
17358
17462
  */
17359
17463
  this.preventDismiss = false;
17464
+ /**
17465
+ * @public
17466
+ * @description
17467
+ * Hides the header of the dialog.
17468
+ */
17469
+ this.headerHidden = false;
17470
+ /**
17471
+ * @public
17472
+ * @description
17473
+ * Hides the footer of the dialog.
17474
+ */
17475
+ this.footerHidden = false;
17476
+ /** @internal */
17477
+ this.footerIsEmpty = true;
17360
17478
  }
17361
17479
  /**
17362
17480
  * True if the dialog is open/showing, false otherwise
@@ -17389,6 +17507,9 @@
17389
17507
  this.resolveShow(reason);
17390
17508
  this.resolveShow = undefined;
17391
17509
  }
17510
+ slottedFooterElementsChanged(_prev, next) {
17511
+ this.footerIsEmpty = !next?.length;
17512
+ }
17392
17513
  /**
17393
17514
  * @internal
17394
17515
  */
@@ -17409,6 +17530,18 @@
17409
17530
  __decorate([
17410
17531
  attr({ attribute: 'prevent-dismiss', mode: 'boolean' })
17411
17532
  ], Dialog.prototype, "preventDismiss", void 0);
17533
+ __decorate([
17534
+ attr({ attribute: 'header-hidden', mode: 'boolean' })
17535
+ ], Dialog.prototype, "headerHidden", void 0);
17536
+ __decorate([
17537
+ attr({ attribute: 'footer-hidden', mode: 'boolean' })
17538
+ ], Dialog.prototype, "footerHidden", void 0);
17539
+ __decorate([
17540
+ observable
17541
+ ], Dialog.prototype, "footerIsEmpty", void 0);
17542
+ __decorate([
17543
+ observable
17544
+ ], Dialog.prototype, "slottedFooterElements", void 0);
17412
17545
  applyMixins(Dialog, ARIAGlobalStatesAndProperties);
17413
17546
  const nimbleDialog = Dialog.compose({
17414
17547
  baseName: 'dialog',