@ni/nimble-components 34.10.3 → 35.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.
Files changed (67) hide show
  1. package/dist/all-components-bundle.js +48 -48
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +10 -11
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/table-column/number-text/index.d.ts +1 -1
  6. package/dist/esm/table-column/number-text/index.js +2 -2
  7. package/dist/esm/table-column/number-text/index.js.map +1 -1
  8. package/dist/esm/table-column/number-text/models/{number-text-unit-format.d.ts → unit-format-number-text.d.ts} +7 -7
  9. package/dist/esm/table-column/number-text/models/{number-text-unit-format.js → unit-format-number-text.js} +14 -14
  10. package/dist/esm/table-column/number-text/models/unit-format-number-text.js.map +1 -0
  11. package/dist/esm/unit/base/unit.d.ts +1 -1
  12. package/dist/esm/unit/base/unit.js.map +1 -1
  13. package/dist/esm/unit/byte/index.js +5 -5
  14. package/dist/esm/unit/byte/index.js.map +1 -1
  15. package/dist/esm/unit/celsius/index.js +2 -2
  16. package/dist/esm/unit/celsius/index.js.map +1 -1
  17. package/dist/esm/unit/fahrenheit/index.js +2 -2
  18. package/dist/esm/unit/fahrenheit/index.js.map +1 -1
  19. package/dist/esm/unit/volt/index.js +2 -2
  20. package/dist/esm/unit/volt/index.js.map +1 -1
  21. package/package.json +2 -1
  22. package/dist/esm/table-column/number-text/models/number-text-unit-format.js.map +0 -1
  23. package/dist/esm/utilities/unit-format/decimal-unit-format.d.ts +0 -19
  24. package/dist/esm/utilities/unit-format/decimal-unit-format.js +0 -46
  25. package/dist/esm/utilities/unit-format/decimal-unit-format.js.map +0 -1
  26. package/dist/esm/utilities/unit-format/default-unit-format.d.ts +0 -22
  27. package/dist/esm/utilities/unit-format/default-unit-format.js +0 -70
  28. package/dist/esm/utilities/unit-format/default-unit-format.js.map +0 -1
  29. package/dist/esm/utilities/unit-format/scaled-unit/scaled-unit.d.ts +0 -16
  30. package/dist/esm/utilities/unit-format/scaled-unit/scaled-unit.js +0 -13
  31. package/dist/esm/utilities/unit-format/scaled-unit/scaled-unit.js.map +0 -1
  32. package/dist/esm/utilities/unit-format/scaled-unit-format/intl-number-format-scaled-unit-format.d.ts +0 -11
  33. package/dist/esm/utilities/unit-format/scaled-unit-format/intl-number-format-scaled-unit-format.js +0 -21
  34. package/dist/esm/utilities/unit-format/scaled-unit-format/intl-number-format-scaled-unit-format.js.map +0 -1
  35. package/dist/esm/utilities/unit-format/scaled-unit-format/manually-translated-scaled-unit-format.d.ts +0 -43
  36. package/dist/esm/utilities/unit-format/scaled-unit-format/manually-translated-scaled-unit-format.js +0 -63
  37. package/dist/esm/utilities/unit-format/scaled-unit-format/manually-translated-scaled-unit-format.js.map +0 -1
  38. package/dist/esm/utilities/unit-format/scaled-unit-format/scaled-unit-format.d.ts +0 -10
  39. package/dist/esm/utilities/unit-format/scaled-unit-format/scaled-unit-format.js +0 -10
  40. package/dist/esm/utilities/unit-format/scaled-unit-format/scaled-unit-format.js.map +0 -1
  41. package/dist/esm/utilities/unit-format/unit-format.d.ts +0 -16
  42. package/dist/esm/utilities/unit-format/unit-format.js +0 -21
  43. package/dist/esm/utilities/unit-format/unit-format.js.map +0 -1
  44. package/dist/esm/utilities/unit-format/unit-scale/byte-1024-unit-scale.d.ts +0 -9
  45. package/dist/esm/utilities/unit-format/unit-scale/byte-1024-unit-scale.js +0 -31
  46. package/dist/esm/utilities/unit-format/unit-scale/byte-1024-unit-scale.js.map +0 -1
  47. package/dist/esm/utilities/unit-format/unit-scale/byte-unit-scale.d.ts +0 -9
  48. package/dist/esm/utilities/unit-format/unit-scale/byte-unit-scale.js +0 -25
  49. package/dist/esm/utilities/unit-format/unit-scale/byte-unit-scale.js.map +0 -1
  50. package/dist/esm/utilities/unit-format/unit-scale/celsius-unit-scale.d.ts +0 -9
  51. package/dist/esm/utilities/unit-format/unit-scale/celsius-unit-scale.js +0 -18
  52. package/dist/esm/utilities/unit-format/unit-scale/celsius-unit-scale.js.map +0 -1
  53. package/dist/esm/utilities/unit-format/unit-scale/fahrenheit-unit-scale.d.ts +0 -9
  54. package/dist/esm/utilities/unit-format/unit-scale/fahrenheit-unit-scale.js +0 -18
  55. package/dist/esm/utilities/unit-format/unit-scale/fahrenheit-unit-scale.js.map +0 -1
  56. package/dist/esm/utilities/unit-format/unit-scale/passthrough-unit-scale.d.ts +0 -9
  57. package/dist/esm/utilities/unit-format/unit-scale/passthrough-unit-scale.js +0 -15
  58. package/dist/esm/utilities/unit-format/unit-scale/passthrough-unit-scale.js.map +0 -1
  59. package/dist/esm/utilities/unit-format/unit-scale/unit-scale.d.ts +0 -15
  60. package/dist/esm/utilities/unit-format/unit-scale/unit-scale.js +0 -49
  61. package/dist/esm/utilities/unit-format/unit-scale/unit-scale.js.map +0 -1
  62. package/dist/esm/utilities/unit-format/unit-scale/utilities/metrix-prefixes.d.ts +0 -1
  63. package/dist/esm/utilities/unit-format/unit-scale/utilities/metrix-prefixes.js +0 -17
  64. package/dist/esm/utilities/unit-format/unit-scale/utilities/metrix-prefixes.js.map +0 -1
  65. package/dist/esm/utilities/unit-format/unit-scale/volt-unit-scale.d.ts +0 -9
  66. package/dist/esm/utilities/unit-format/unit-scale/volt-unit-scale.js +0 -24
  67. package/dist/esm/utilities/unit-format/unit-scale/volt-unit-scale.js.map +0 -1
@@ -76888,7 +76888,7 @@ focus outline in that case.
76888
76888
  /**
76889
76889
  * A formatter for units that can be formatted/translated by Intl.NumberFormat
76890
76890
  */
76891
- class IntlNumberFormatScaledUnitFormat extends ScaledUnitFormat {
76891
+ class ScaledUnitFormatIntlNumberFormat extends ScaledUnitFormat {
76892
76892
  constructor(scaledUnitFormatFactoryOptions, unitSpecificIntlNumberFormatOptions) {
76893
76893
  super(scaledUnitFormatFactoryOptions);
76894
76894
  this.formatter = new Intl.NumberFormat(this.locale, {
@@ -76898,7 +76898,7 @@ focus outline in that case.
76898
76898
  });
76899
76899
  }
76900
76900
  static createFactory(unitSpecificIntlNumberFormatOptions) {
76901
- return (scaledUnitFormatFactoryOptions) => new IntlNumberFormatScaledUnitFormat(scaledUnitFormatFactoryOptions, unitSpecificIntlNumberFormatOptions);
76901
+ return (scaledUnitFormatFactoryOptions) => new ScaledUnitFormatIntlNumberFormat(scaledUnitFormatFactoryOptions, unitSpecificIntlNumberFormatOptions);
76902
76902
  }
76903
76903
  format(value) {
76904
76904
  return this.formatter.format(value);
@@ -76970,14 +76970,14 @@ focus outline in that case.
76970
76970
  /**
76971
76971
  * Unit scale that is used to passthrough a number without applying scaling or units
76972
76972
  */
76973
- class PassthroughUnitScale extends UnitScale {
76973
+ class UnitScalePassthrough extends UnitScale {
76974
76974
  constructor() {
76975
76975
  super([
76976
- new ScaledUnit(10 ** 0, IntlNumberFormatScaledUnitFormat.createFactory({}))
76976
+ new ScaledUnit(10 ** 0, ScaledUnitFormatIntlNumberFormat.createFactory({}))
76977
76977
  ]);
76978
76978
  }
76979
76979
  }
76980
- const passthroughUnitScale = new PassthroughUnitScale();
76980
+ const unitScalePassthrough = new UnitScalePassthrough();
76981
76981
 
76982
76982
  // Workaround to avoid ts errors about signDisplay not accepting the value 'negative'.
76983
76983
  // It has been supported by browsers since 8/23, but TypeScript still hasn't
@@ -76987,15 +76987,15 @@ focus outline in that case.
76987
76987
  * Format for numbers with units to show in a tabular form.
76988
76988
  * Large and tiny numbers are shown exponentially and the rest as decimal.
76989
76989
  */
76990
- class DefaultUnitFormat extends UnitFormat {
76991
- constructor(locale, { unitScale = passthroughUnitScale } = {
76992
- unitScale: passthroughUnitScale
76990
+ class UnitFormatDefault extends UnitFormat {
76991
+ constructor(locale, { unitScale = unitScalePassthrough } = {
76992
+ unitScale: unitScalePassthrough
76993
76993
  }) {
76994
76994
  super();
76995
76995
  // Format options to use by default. It renders the number with a maximum of 6 signficant digits (including zero before decimal point).
76996
76996
  this.defaultIntlNumberFormatOptions = {
76997
- maximumSignificantDigits: DefaultUnitFormat.maximumDigits,
76998
- maximumFractionDigits: DefaultUnitFormat.maximumDigits - 1,
76997
+ maximumSignificantDigits: UnitFormatDefault.maximumDigits,
76998
+ maximumFractionDigits: UnitFormatDefault.maximumDigits - 1,
76999
76999
  roundingPriority: 'lessPrecision',
77000
77000
  signDisplay
77001
77001
  };
@@ -77003,7 +77003,7 @@ focus outline in that case.
77003
77003
  // Format options for numbers that should be displayed in exponential notation. This should be used
77004
77004
  // for numbers with magintudes over 'exponentialUpperBound' or under 'exponentialLowerBound'.
77005
77005
  this.exponentialIntlNumberFormatOptions = {
77006
- maximumSignificantDigits: DefaultUnitFormat.maximumDigits,
77006
+ maximumSignificantDigits: UnitFormatDefault.maximumDigits,
77007
77007
  notation: 'scientific',
77008
77008
  signDisplay
77009
77009
  };
@@ -77028,8 +77028,8 @@ focus outline in that case.
77028
77028
  const { scaledValue, scaledUnit } = this.unitScale.scaleNumber(number);
77029
77029
  const absoluteValue = Math.abs(scaledValue);
77030
77030
  const useExponential = absoluteValue !== 0
77031
- && (absoluteValue >= DefaultUnitFormat.exponentialUpperBound
77032
- || absoluteValue < DefaultUnitFormat.exponentialLowerBound);
77031
+ && (absoluteValue >= UnitFormatDefault.exponentialUpperBound
77032
+ || absoluteValue < UnitFormatDefault.exponentialLowerBound);
77033
77033
  return useExponential
77034
77034
  ? this.exponentialScaledUnitFormatter.format(number)
77035
77035
  : this.defaultScaledUnitFormatters
@@ -77038,23 +77038,23 @@ focus outline in that case.
77038
77038
  }
77039
77039
  }
77040
77040
  // The maximum number of digits that should be rendered for any given value.
77041
- DefaultUnitFormat.maximumDigits = 6;
77041
+ UnitFormatDefault.maximumDigits = 6;
77042
77042
  // Use exponential notation for numbers that will be rendered with 3 leading 0s or more.
77043
77043
  // Because a maximum of 6 digits are rendered, showing more than 3 leading 0s is not ideal
77044
77044
  // because then at least half of the displayed digits will be leading 0s.
77045
- DefaultUnitFormat.exponentialLowerBound = 0.000995;
77045
+ UnitFormatDefault.exponentialLowerBound = 0.000995;
77046
77046
  // Use exponential formatting for numbers whose magnitude cannot otherwise be displayed
77047
77047
  // with 6 digits or less.
77048
- DefaultUnitFormat.exponentialUpperBound = 999999.5;
77048
+ UnitFormatDefault.exponentialUpperBound = 999999.5;
77049
77049
 
77050
77050
  /**
77051
77051
  * Format for decimal numbers with units.
77052
77052
  */
77053
- class DecimalUnitFormat extends UnitFormat {
77054
- constructor(locale, { minimumFractionDigits = 0, maximumFractionDigits = Math.max(3, minimumFractionDigits), unitScale = passthroughUnitScale } = {
77053
+ class UnitFormatDecimal extends UnitFormat {
77054
+ constructor(locale, { minimumFractionDigits = 0, maximumFractionDigits = Math.max(3, minimumFractionDigits), unitScale = unitScalePassthrough } = {
77055
77055
  minimumFractionDigits: 0,
77056
77056
  maximumFractionDigits: 3,
77057
- unitScale: passthroughUnitScale
77057
+ unitScale: unitScalePassthrough
77058
77058
  }) {
77059
77059
  super();
77060
77060
  this.scaledUnitFormatters = new Map();
@@ -77094,7 +77094,7 @@ focus outline in that case.
77094
77094
  /**
77095
77095
  * Format for numbers (with optional units) in a number-text table column.
77096
77096
  */
77097
- class NumberTextUnitFormat extends UnitFormat {
77097
+ class UnitFormatNumberText extends UnitFormat {
77098
77098
  constructor(locale, options) {
77099
77099
  super();
77100
77100
  this._resolvedOptions = this.resolveOptions(options);
@@ -77119,18 +77119,18 @@ focus outline in that case.
77119
77119
  resolveUnitFormat(locale, options) {
77120
77120
  const { numberTextFormat, decimalMaximumDigits, decimalDigits, unitScale } = options;
77121
77121
  if (numberTextFormat === NumberTextFormat.default) {
77122
- return new DefaultUnitFormat(locale, {
77122
+ return new UnitFormatDefault(locale, {
77123
77123
  unitScale
77124
77124
  });
77125
77125
  }
77126
77126
  if (typeof decimalDigits === 'number') {
77127
- return new DecimalUnitFormat(locale, {
77127
+ return new UnitFormatDecimal(locale, {
77128
77128
  minimumFractionDigits: decimalDigits,
77129
77129
  maximumFractionDigits: decimalDigits,
77130
77130
  unitScale
77131
77131
  });
77132
77132
  }
77133
- return new DecimalUnitFormat(locale, {
77133
+ return new UnitFormatDecimal(locale, {
77134
77134
  minimumFractionDigits: 0,
77135
77135
  maximumFractionDigits: decimalMaximumDigits,
77136
77136
  unitScale
@@ -77142,7 +77142,7 @@ focus outline in that case.
77142
77142
  numberTextFormat: NumberTextFormat.default,
77143
77143
  decimalDigits: undefined,
77144
77144
  decimalMaximumDigits: undefined,
77145
- unitScale: options?.unitScale ?? passthroughUnitScale
77145
+ unitScale: options?.unitScale ?? unitScalePassthrough
77146
77146
  };
77147
77147
  }
77148
77148
  const hasDecimalDigits = typeof options.decimalDigits === 'number';
@@ -77153,20 +77153,20 @@ focus outline in that case.
77153
77153
  if (!hasDecimalDigits && !hasDecimalMaximumDigits) {
77154
77154
  return {
77155
77155
  numberTextFormat: NumberTextFormat.decimal,
77156
- decimalDigits: NumberTextUnitFormat.defaultDecimalDigits,
77156
+ decimalDigits: UnitFormatNumberText.defaultDecimalDigits,
77157
77157
  decimalMaximumDigits: undefined,
77158
- unitScale: options.unitScale ?? passthroughUnitScale
77158
+ unitScale: options.unitScale ?? unitScalePassthrough
77159
77159
  };
77160
77160
  }
77161
77161
  return {
77162
77162
  numberTextFormat: NumberTextFormat.decimal,
77163
77163
  decimalDigits: options.decimalDigits,
77164
77164
  decimalMaximumDigits: options.decimalMaximumDigits,
77165
- unitScale: options.unitScale ?? passthroughUnitScale
77165
+ unitScale: options.unitScale ?? unitScalePassthrough
77166
77166
  };
77167
77167
  }
77168
77168
  }
77169
- NumberTextUnitFormat.defaultDecimalDigits = 2;
77169
+ UnitFormatNumberText.defaultDecimalDigits = 2;
77170
77170
 
77171
77171
  const numberTextValidityFlagNames = [
77172
77172
  'invalidDecimalDigits',
@@ -77325,7 +77325,7 @@ focus outline in that case.
77325
77325
  }
77326
77326
  createFormatter() {
77327
77327
  const unitScale = this.unit?.resolvedUnitScale;
77328
- return new NumberTextUnitFormat(lang.getValueFor(this), {
77328
+ return new UnitFormatNumberText(lang.getValueFor(this), {
77329
77329
  // Attribute values sometimes resolve to either null or undefined
77330
77330
  // See https://github.com/microsoft/fast/issues/6630
77331
77331
  numberTextFormat: this.format ?? undefined,
@@ -78921,8 +78921,6 @@ focus outline in that case.
78921
78921
  });
78922
78922
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTreeView());
78923
78923
 
78924
- const template$1 = html `<template slot="unit"></template>`;
78925
-
78926
78924
  /**
78927
78925
  * Representations of a unit in a particular language
78928
78926
  */
@@ -78936,7 +78934,7 @@ focus outline in that case.
78936
78934
  /**
78937
78935
  * A formatter for units that are not supported by Intl.NumberFormat
78938
78936
  */
78939
- class ManuallyTranslatedScaledUnitFormat extends ScaledUnitFormat {
78937
+ class ScaledUnitFormatManuallyTranslated extends ScaledUnitFormat {
78940
78938
  constructor(scaledUnitFormatFactoryOptions, { unitTranslations, scaledPrefixText }) {
78941
78939
  super(scaledUnitFormatFactoryOptions);
78942
78940
  if (!unitTranslations.get('en')) {
@@ -78947,8 +78945,8 @@ focus outline in that case.
78947
78945
  this.unitTranslation = this.getTranslationToUse(unitTranslations, this.locale);
78948
78946
  this.scaledPrefixText = scaledPrefixText;
78949
78947
  }
78950
- static createFactory(manuallyTranslatedScaledUnitFormatOptions) {
78951
- return (scaledUnitFormatFactoryOptions) => new ManuallyTranslatedScaledUnitFormat(scaledUnitFormatFactoryOptions, manuallyTranslatedScaledUnitFormatOptions);
78948
+ static createFactory(scaledUnitFormatManuallyTranslatedOptions) {
78949
+ return (scaledUnitFormatFactoryOptions) => new ScaledUnitFormatManuallyTranslated(scaledUnitFormatFactoryOptions, scaledUnitFormatManuallyTranslatedOptions);
78952
78950
  }
78953
78951
  format(value) {
78954
78952
  const formatted = this.formatter.format(value);
@@ -79003,17 +79001,17 @@ focus outline in that case.
79003
79001
  /**
79004
79002
  * Byte units (1024-based)
79005
79003
  */
79006
- class Byte1024UnitScale extends UnitScale {
79004
+ class UnitScaleByte1024 extends UnitScale {
79007
79005
  constructor() {
79008
- super(byte1024Prefixes.map(([scaleFactor, scaledPrefixText]) => new ScaledUnit(scaleFactor, ManuallyTranslatedScaledUnitFormat.createFactory({
79006
+ super(byte1024Prefixes.map(([scaleFactor, scaledPrefixText]) => new ScaledUnit(scaleFactor, ScaledUnitFormatManuallyTranslated.createFactory({
79009
79007
  unitTranslations: unitTranslations$1,
79010
79008
  scaledPrefixText
79011
79009
  }))));
79012
79010
  }
79013
79011
  }
79014
- const byte1024UnitScale = new Byte1024UnitScale();
79012
+ const unitScaleByte1024 = new UnitScaleByte1024();
79015
79013
 
79016
- const byteUnitScaleOptions = [
79014
+ const unitScaleByteConfig = [
79017
79015
  [1000 ** 0, 'byte', 'long'],
79018
79016
  [1000 ** 1, 'kilobyte', 'short'],
79019
79017
  [1000 ** 2, 'megabyte', 'short'],
@@ -79024,16 +79022,18 @@ focus outline in that case.
79024
79022
  /**
79025
79023
  * Byte units (1000-based)
79026
79024
  */
79027
- class ByteUnitScale extends UnitScale {
79025
+ class UnitScaleByte extends UnitScale {
79028
79026
  constructor() {
79029
- super(byteUnitScaleOptions.map(([scaleFactor, unit, unitDisplay]) => new ScaledUnit(scaleFactor, IntlNumberFormatScaledUnitFormat.createFactory({
79027
+ super(unitScaleByteConfig.map(([scaleFactor, unit, unitDisplay]) => new ScaledUnit(scaleFactor, ScaledUnitFormatIntlNumberFormat.createFactory({
79030
79028
  style: 'unit',
79031
79029
  unit,
79032
79030
  unitDisplay
79033
79031
  }))));
79034
79032
  }
79035
79033
  }
79036
- const byteUnitScale = new ByteUnitScale();
79034
+ const unitScaleByte = new UnitScaleByte();
79035
+
79036
+ const template$1 = html `<template slot="unit"></template>`;
79037
79037
 
79038
79038
  const styles$1 = css `
79039
79039
  ${display('none')}
@@ -79050,12 +79050,12 @@ focus outline in that case.
79050
79050
  * the default of decimal (base 1000 scale with metric prefixes)
79051
79051
  */
79052
79052
  this.binary = false;
79053
- this.resolvedUnitScale = byteUnitScale;
79053
+ this.resolvedUnitScale = unitScaleByte;
79054
79054
  }
79055
79055
  binaryChanged() {
79056
79056
  this.resolvedUnitScale = this.binary
79057
- ? byte1024UnitScale
79058
- : byteUnitScale;
79057
+ ? unitScaleByte1024
79058
+ : unitScaleByte;
79059
79059
  }
79060
79060
  }
79061
79061
  __decorate([
@@ -79095,15 +79095,15 @@ focus outline in that case.
79095
79095
  /**
79096
79096
  * Voltage unit scale
79097
79097
  */
79098
- class VoltUnitScale extends UnitScale {
79098
+ class UnitScaleVolt extends UnitScale {
79099
79099
  constructor() {
79100
- super(metricPrefixes.map(([scaleFactor, scaledPrefixText]) => new ScaledUnit(scaleFactor, ManuallyTranslatedScaledUnitFormat.createFactory({
79100
+ super(metricPrefixes.map(([scaleFactor, scaledPrefixText]) => new ScaledUnit(scaleFactor, ScaledUnitFormatManuallyTranslated.createFactory({
79101
79101
  unitTranslations,
79102
79102
  scaledPrefixText
79103
79103
  }))));
79104
79104
  }
79105
79105
  }
79106
- const voltUnitScale = new VoltUnitScale();
79106
+ const unitScaleVolt = new UnitScaleVolt();
79107
79107
 
79108
79108
  /**
79109
79109
  * Element representing units for volts
@@ -79111,7 +79111,7 @@ focus outline in that case.
79111
79111
  class UnitVolt extends Unit {
79112
79112
  constructor() {
79113
79113
  super();
79114
- this.resolvedUnitScale = voltUnitScale;
79114
+ this.resolvedUnitScale = unitScaleVolt;
79115
79115
  }
79116
79116
  }
79117
79117
  const nimbleUnitVolt = UnitVolt.compose({