@ni/nimble-components 21.6.6 → 21.6.8
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.
- package/dist/all-components-bundle.js +46 -66
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +378 -374
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/dialog/index.d.ts +1 -10
- package/dist/esm/dialog/index.js.map +1 -1
- package/dist/esm/drawer/index.d.ts +1 -2
- package/dist/esm/drawer/index.js.map +1 -1
- package/dist/esm/spinner/styles.js +9 -2
- package/dist/esm/spinner/styles.js.map +1 -1
- package/dist/esm/spinner/template.js +11 -0
- package/dist/esm/spinner/template.js.map +1 -1
- package/dist/esm/utilities/unit-format/decimal-unit-format.d.ts +0 -2
- package/dist/esm/utilities/unit-format/decimal-unit-format.js +6 -11
- package/dist/esm/utilities/unit-format/decimal-unit-format.js.map +1 -1
- package/dist/esm/utilities/unit-format/default-unit-format.d.ts +0 -3
- package/dist/esm/utilities/unit-format/default-unit-format.js +20 -52
- package/dist/esm/utilities/unit-format/default-unit-format.js.map +1 -1
- package/package.json +1 -1
|
@@ -16301,7 +16301,7 @@
|
|
|
16301
16301
|
|
|
16302
16302
|
/**
|
|
16303
16303
|
* Do not edit directly
|
|
16304
|
-
* Generated on
|
|
16304
|
+
* Generated on Mon, 26 Feb 2024 22:10:53 GMT
|
|
16305
16305
|
*/
|
|
16306
16306
|
|
|
16307
16307
|
const Information100DarkUi = "#a46eff";
|
|
@@ -58741,16 +58741,22 @@ img.ProseMirror-separator {
|
|
|
58741
58741
|
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleSelect());
|
|
58742
58742
|
|
|
58743
58743
|
const styles$n = css `
|
|
58744
|
-
${display('inline-
|
|
58744
|
+
${display('inline-grid')}
|
|
58745
58745
|
|
|
58746
58746
|
:host {
|
|
58747
58747
|
height: ${spinnerSmallHeight};
|
|
58748
58748
|
aspect-ratio: 1 / 1;
|
|
58749
58749
|
}
|
|
58750
58750
|
|
|
58751
|
+
div.overlay {
|
|
58752
|
+
z-index: ${ZIndexLevels.zIndex1};
|
|
58753
|
+
margin: max(2px, 6.25%);
|
|
58754
|
+
grid-area: 1/1;
|
|
58755
|
+
}
|
|
58756
|
+
|
|
58751
58757
|
div.container {
|
|
58752
58758
|
margin: max(2px, 6.25%);
|
|
58753
|
-
|
|
58759
|
+
grid-area: 1/1;
|
|
58754
58760
|
${
|
|
58755
58761
|
/**
|
|
58756
58762
|
* At some spinner sizes / browser zoom levels, the spinner bits/squares appear to slightly overlap visually.
|
|
@@ -58902,8 +58908,19 @@ img.ProseMirror-separator {
|
|
|
58902
58908
|
}
|
|
58903
58909
|
`));
|
|
58904
58910
|
|
|
58911
|
+
/* eslint-disable @typescript-eslint/indent */
|
|
58912
|
+
// prettier-ignore
|
|
58905
58913
|
const template$k = html `
|
|
58906
58914
|
<template role="progressbar">
|
|
58915
|
+
${''
|
|
58916
|
+
/**
|
|
58917
|
+
* In Firefox, the 'title' set on the spinner is very finicky when
|
|
58918
|
+
* the spinner is animating. Therefore, put a transparent overlay on
|
|
58919
|
+
* top of the spinning bits so that the title displays as expected.
|
|
58920
|
+
*/
|
|
58921
|
+
}
|
|
58922
|
+
<div class="overlay"></div>
|
|
58923
|
+
|
|
58907
58924
|
<div class="container">
|
|
58908
58925
|
<div class="bit1"></div>
|
|
58909
58926
|
<div class="bit2"></div>
|
|
@@ -68451,6 +68468,10 @@ img.ProseMirror-separator {
|
|
|
68451
68468
|
}
|
|
68452
68469
|
const passthroughUnitScale = new PassthroughUnitScale();
|
|
68453
68470
|
|
|
68471
|
+
// Workaround to avoid ts errors about signDisplay not accepting the value 'negative'.
|
|
68472
|
+
// It has been supported by browsers since 8/23, but TypeScript still hasn't
|
|
68473
|
+
// added it to the type definitions. See https://github.com/microsoft/TypeScript/issues/56269
|
|
68474
|
+
const signDisplay = 'negative';
|
|
68454
68475
|
/**
|
|
68455
68476
|
* Format for numbers with units to show in a tabular form.
|
|
68456
68477
|
* Large and tiny numbers are shown exponentially and the rest as decimal.
|
|
@@ -68460,35 +68481,26 @@ img.ProseMirror-separator {
|
|
|
68460
68481
|
unitScale: passthroughUnitScale
|
|
68461
68482
|
}) {
|
|
68462
68483
|
super();
|
|
68463
|
-
// Format options to use by default. It renders the number with a maximum of 6 signficant digits.
|
|
68484
|
+
// Format options to use by default. It renders the number with a maximum of 6 signficant digits (including zero before decimal point).
|
|
68464
68485
|
this.defaultIntlNumberFormatOptions = {
|
|
68465
68486
|
maximumSignificantDigits: DefaultUnitFormat.maximumDigits,
|
|
68466
|
-
useGrouping: true
|
|
68467
|
-
};
|
|
68468
|
-
this.defaultScaledUnitFormatters = new Map();
|
|
68469
|
-
// Format options to use for numbers that have leading zeros. It limits the number of rendered
|
|
68470
|
-
// digits using 'maximumFractionDigits', which will result in less than 6 significant digits
|
|
68471
|
-
// in order to render no more than 6 total digits.
|
|
68472
|
-
this.leadingZeroIntlNumberFormatOptions = {
|
|
68473
68487
|
maximumFractionDigits: DefaultUnitFormat.maximumDigits - 1,
|
|
68474
|
-
|
|
68488
|
+
roundingPriority: 'lessPrecision',
|
|
68489
|
+
signDisplay
|
|
68475
68490
|
};
|
|
68476
|
-
this.
|
|
68491
|
+
this.defaultScaledUnitFormatters = new Map();
|
|
68477
68492
|
// Format options for numbers that should be displayed in exponential notation. This should be used
|
|
68478
68493
|
// for numbers with magintudes over 'exponentialUpperBound' or under 'exponentialLowerBound'.
|
|
68479
68494
|
this.exponentialIntlNumberFormatOptions = {
|
|
68480
68495
|
maximumSignificantDigits: DefaultUnitFormat.maximumDigits,
|
|
68481
|
-
notation: 'scientific'
|
|
68496
|
+
notation: 'scientific',
|
|
68497
|
+
signDisplay
|
|
68482
68498
|
};
|
|
68483
68499
|
for (const unit of unitScale.supportedScaledUnits) {
|
|
68484
68500
|
this.defaultScaledUnitFormatters.set(unit.scaleFactor, unit.scaledUnitFormatFactory({
|
|
68485
68501
|
locale,
|
|
68486
68502
|
intlNumberFormatOptions: this.defaultIntlNumberFormatOptions
|
|
68487
68503
|
}));
|
|
68488
|
-
this.leadingZeroScaledUnitFormatters.set(unit.scaleFactor, unit.scaledUnitFormatFactory({
|
|
68489
|
-
locale,
|
|
68490
|
-
intlNumberFormatOptions: this.leadingZeroIntlNumberFormatOptions
|
|
68491
|
-
}));
|
|
68492
68504
|
}
|
|
68493
68505
|
this.exponentialScaledUnitFormatter = unitScale.baseScaledUnit.scaledUnitFormatFactory({
|
|
68494
68506
|
locale,
|
|
@@ -68502,43 +68514,16 @@ img.ProseMirror-separator {
|
|
|
68502
68514
|
};
|
|
68503
68515
|
}
|
|
68504
68516
|
tryFormat(number) {
|
|
68505
|
-
|
|
68506
|
-
const
|
|
68507
|
-
const
|
|
68508
|
-
|
|
68509
|
-
|
|
68510
|
-
|
|
68511
|
-
|
|
68512
|
-
|
|
68513
|
-
|
|
68514
|
-
|
|
68515
|
-
const scaledUnitFormatter = this.leadingZeroScaledUnitFormatters.get(scaledUnit.scaleFactor);
|
|
68516
|
-
return scaledUnitFormatter.format(scaledValue);
|
|
68517
|
-
}
|
|
68518
|
-
case 'exponential': {
|
|
68519
|
-
const scaledUnitFormatter = this.exponentialScaledUnitFormatter;
|
|
68520
|
-
return scaledUnitFormatter.format(numberNormalized);
|
|
68521
|
-
}
|
|
68522
|
-
default:
|
|
68523
|
-
throw new Error('Unexpected number format style');
|
|
68524
|
-
}
|
|
68525
|
-
}
|
|
68526
|
-
resolveNumberStyle(number) {
|
|
68527
|
-
if (number === 0) {
|
|
68528
|
-
return 'default';
|
|
68529
|
-
}
|
|
68530
|
-
const absoluteValue = Math.abs(number);
|
|
68531
|
-
if (absoluteValue >= DefaultUnitFormat.exponentialUpperBound
|
|
68532
|
-
|| absoluteValue < DefaultUnitFormat.exponentialLowerBound) {
|
|
68533
|
-
return 'exponential';
|
|
68534
|
-
}
|
|
68535
|
-
// Ideally, we could set 'roundingPriority: "lessPrecision"' with a formatter that has both 'maximumSignificantDigits' and
|
|
68536
|
-
// 'maximumFractionDigits' configured instead of having two different formatters that we conditionally choose between. However,
|
|
68537
|
-
// 'roundingPrioirty' is not supported yet in all browsers.
|
|
68538
|
-
if (absoluteValue < 1) {
|
|
68539
|
-
return 'leadingZero';
|
|
68540
|
-
}
|
|
68541
|
-
return 'default';
|
|
68517
|
+
const { scaledValue, scaledUnit } = this.unitScale.scaleNumber(number);
|
|
68518
|
+
const absoluteValue = Math.abs(scaledValue);
|
|
68519
|
+
const useExponential = absoluteValue !== 0
|
|
68520
|
+
&& (absoluteValue >= DefaultUnitFormat.exponentialUpperBound
|
|
68521
|
+
|| absoluteValue < DefaultUnitFormat.exponentialLowerBound);
|
|
68522
|
+
return useExponential
|
|
68523
|
+
? this.exponentialScaledUnitFormatter.format(number)
|
|
68524
|
+
: this.defaultScaledUnitFormatters
|
|
68525
|
+
.get(scaledUnit.scaleFactor)
|
|
68526
|
+
.format(scaledValue);
|
|
68542
68527
|
}
|
|
68543
68528
|
}
|
|
68544
68529
|
// The maximum number of digits that should be rendered for any given value.
|
|
@@ -68562,10 +68547,14 @@ img.ProseMirror-separator {
|
|
|
68562
68547
|
}) {
|
|
68563
68548
|
super();
|
|
68564
68549
|
this.scaledUnitFormatters = new Map();
|
|
68550
|
+
// Workaround to avoid a ts error about signDisplay not accepting the value 'negative'.
|
|
68551
|
+
// It has been supported by browsers since 8/23, but TypeScript still hasn't
|
|
68552
|
+
// added it to the type definitions. See https://github.com/microsoft/TypeScript/issues/56269
|
|
68553
|
+
const signDisplay = 'negative';
|
|
68565
68554
|
const intlNumberFormatOptions = {
|
|
68566
68555
|
maximumFractionDigits,
|
|
68567
68556
|
minimumFractionDigits,
|
|
68568
|
-
|
|
68557
|
+
signDisplay
|
|
68569
68558
|
};
|
|
68570
68559
|
for (const scaledUnit of unitScale.supportedScaledUnits) {
|
|
68571
68560
|
this.scaledUnitFormatters.set(scaledUnit.scaleFactor, scaledUnit.scaledUnitFormatFactory({
|
|
@@ -68573,7 +68562,6 @@ img.ProseMirror-separator {
|
|
|
68573
68562
|
intlNumberFormatOptions
|
|
68574
68563
|
}));
|
|
68575
68564
|
}
|
|
68576
|
-
this.tenPowDecimalDigits = 10 ** maximumFractionDigits;
|
|
68577
68565
|
this.unitScale = unitScale;
|
|
68578
68566
|
this.minimumFractionDigits = minimumFractionDigits;
|
|
68579
68567
|
this.maximumFractionDigits = maximumFractionDigits;
|
|
@@ -68587,16 +68575,8 @@ img.ProseMirror-separator {
|
|
|
68587
68575
|
}
|
|
68588
68576
|
tryFormat(number) {
|
|
68589
68577
|
const { scaledValue, scaledUnit } = this.unitScale.scaleNumber(number);
|
|
68590
|
-
const numberNormalized = this.willRoundToZero(scaledValue)
|
|
68591
|
-
? 0
|
|
68592
|
-
: scaledValue;
|
|
68593
68578
|
const scaledUnitFormatter = this.scaledUnitFormatters.get(scaledUnit.scaleFactor);
|
|
68594
|
-
return scaledUnitFormatter.format(
|
|
68595
|
-
}
|
|
68596
|
-
willRoundToZero(number) {
|
|
68597
|
-
// Multiply the value by 10 raised to maximumFractionDigits so that Math.round can be used to emulate rounding to
|
|
68598
|
-
// maximumFractionDigits decimal places. If that rounded value is 0, then the value will be rendered with only 0s.
|
|
68599
|
-
return Math.round(number * this.tenPowDecimalDigits) === 0;
|
|
68579
|
+
return scaledUnitFormatter.format(scaledValue);
|
|
68600
68580
|
}
|
|
68601
68581
|
}
|
|
68602
68582
|
|