@ni/nimble-components 21.6.7 → 21.7.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 (36) hide show
  1. package/dist/all-components-bundle.js +124 -65
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +2793 -2792
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/dialog/index.d.ts +1 -10
  6. package/dist/esm/dialog/index.js.map +1 -1
  7. package/dist/esm/drawer/index.d.ts +1 -2
  8. package/dist/esm/drawer/index.js.map +1 -1
  9. package/dist/esm/icons/all-icons.d.ts +6 -0
  10. package/dist/esm/icons/all-icons.js +6 -0
  11. package/dist/esm/icons/all-icons.js.map +1 -1
  12. package/dist/esm/icons/eye-dash.d.ts +13 -0
  13. package/dist/esm/icons/eye-dash.js +15 -0
  14. package/dist/esm/icons/eye-dash.js.map +1 -0
  15. package/dist/esm/icons/horizontal-triangle-outline.d.ts +13 -0
  16. package/dist/esm/icons/horizontal-triangle-outline.js +15 -0
  17. package/dist/esm/icons/horizontal-triangle-outline.js.map +1 -0
  18. package/dist/esm/icons/inward-squares-three.d.ts +13 -0
  19. package/dist/esm/icons/inward-squares-three.js +15 -0
  20. package/dist/esm/icons/inward-squares-three.js.map +1 -0
  21. package/dist/esm/icons/outward-squares-three.d.ts +13 -0
  22. package/dist/esm/icons/outward-squares-three.js +15 -0
  23. package/dist/esm/icons/outward-squares-three.js.map +1 -0
  24. package/dist/esm/icons/square-x.d.ts +13 -0
  25. package/dist/esm/icons/square-x.js +15 -0
  26. package/dist/esm/icons/square-x.js.map +1 -0
  27. package/dist/esm/icons/three-circles-ascending-container.d.ts +13 -0
  28. package/dist/esm/icons/three-circles-ascending-container.js +15 -0
  29. package/dist/esm/icons/three-circles-ascending-container.js.map +1 -0
  30. package/dist/esm/utilities/unit-format/decimal-unit-format.d.ts +0 -2
  31. package/dist/esm/utilities/unit-format/decimal-unit-format.js +6 -11
  32. package/dist/esm/utilities/unit-format/decimal-unit-format.js.map +1 -1
  33. package/dist/esm/utilities/unit-format/default-unit-format.d.ts +0 -3
  34. package/dist/esm/utilities/unit-format/default-unit-format.js +20 -52
  35. package/dist/esm/utilities/unit-format/default-unit-format.js.map +1 -1
  36. package/package.json +2 -2
@@ -16301,7 +16301,7 @@
16301
16301
 
16302
16302
  /**
16303
16303
  * Do not edit directly
16304
- * Generated on Fri, 23 Feb 2024 22:40:01 GMT
16304
+ * Generated on Wed, 28 Feb 2024 19:19:19 GMT
16305
16305
  */
16306
16306
 
16307
16307
  const Information100DarkUi = "#a46eff";
@@ -19208,6 +19208,10 @@
19208
19208
  name: 'eye_16_x_16',
19209
19209
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M7.856 3.657A7 7 0 0 0 1 8.001a7.59 7.59 0 0 0 7.146 4.342A7 7 0 0 0 15 8a7.59 7.59 0 0 0-7.144-4.344m-1.199 7.289A5.11 5.11 0 0 1 2.443 8s.665-2.585 4.33-3.037a2.8 2.8 0 0 0-1.414 1.223l2.787 1.22H4.977a3.5 3.5 0 0 0-.053.576 3.35 3.35 0 0 0 1.734 2.962m2.85.02a3.4 3.4 0 0 0 .107-5.908 5 5 0 0 1 3.942 2.944s-.603 2.44-4.05 2.963" class="cls-1"/></svg>`
19210
19210
  };
19211
+ const eyeDash16X16 = {
19212
+ name: 'eye_dash_16_x_16',
19213
+ data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M5.832 3.902a9.5 9.5 0 0 1 2.024-.245c3.264.09 5.676 1.427 7.144 4.344-.543 1.222-1.279 2.157-2.173 2.852l-.83-.825c1.277-.888 1.56-2.027 1.56-2.027a5 5 0 0 0-3.942-2.944 3.36 3.36 0 0 1 1.664 2.926 3.3 3.3 0 0 1-.196 1.137zm-.674 3.505h-.18q-.052.286-.054.576a3.35 3.35 0 0 0 1.734 2.962 5.11 5.11 0 0 1-4.215-2.944s.252-.981 1.303-1.84c.029-.024.067-.046.097-.069l-.828-.828C2.19 5.947 1.512 6.849 1 8c1.469 2.916 3.882 4.252 7.146 4.342a9.7 9.7 0 0 0 1.754-.194zm-1.77-4.733-.708.708 9.9 9.9.707-.708z" class="cls-1"/></svg>`
19214
+ };
19211
19215
  const fancyA16X16 = {
19212
19216
  name: 'fancy_a_16_x_16',
19213
19217
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M10.597 9.844H7.865A7.5 7.5 0 0 1 6.19 11.96a3.32 3.32 0 0 1-2.042.667 2.84 2.84 0 0 1-1.964-.753L2 11.706l1.153-1.152.157.251a1.35 1.35 0 0 0 1.2.716 1.98 1.98 0 0 0 1.385-.625 11.6 11.6 0 0 0 1.722-2.403l2.252-3.88a8 8 0 0 0-.679-.037 2.37 2.37 0 0 0-1.66.54 1.97 1.97 0 0 0-.556 1.51V6.7l-.067.106-1.564.762.045-.423a3.85 3.85 0 0 1 .645-1.874 3.3 3.3 0 0 1 1.34-1.177 6.7 6.7 0 0 1 2.208-.443c.127 0 .277-.013.471-.029l.369-.03 1.387-.257.087 2.154.33 3.886a4.9 4.9 0 0 0 .29 1.701.5.5 0 0 0 .528.31c.057 0 .277 0 .641-.03L14 11.33l-.172.83-3.003.506Zm-.086-.896-.275-3.22-1.855 3.22Z" class="cls-1"/></svg>`
@@ -19296,6 +19300,10 @@
19296
19300
  name: 'home_16_x_16',
19297
19301
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M7.988 2 2.5 9H4v5h3v-3h2v3h3V9h1.5z" class="cls-1"/></svg>`
19298
19302
  };
19303
+ const horizontalTriangleOutline16X16 = {
19304
+ name: 'horizontal_triangle_outline_16_x_16',
19305
+ data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M2.05 2v12l11.4-6zM4 5.313 9.156 8 4 10.688z" class="cls-1"/></svg>`
19306
+ };
19299
19307
  const hourglass16X16 = {
19300
19308
  name: 'hourglass_16_x_16',
19301
19309
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M10.774 13.4h-.047v-.49h-.404a2.5 2.5 0 0 0 .355-1.258c0-1.826-2.083-2.886-2.083-3.652s2.083-1.826 2.083-3.652a2.5 2.5 0 0 0-.355-1.257h.404V2.6h.047a.556.556 0 0 0 .499-.6H4.727a.556.556 0 0 0 .499.6h.047v.49h.404a2.5 2.5 0 0 0-.355 1.258c0 1.826 2.083 2.87 2.083 3.652s-2.083 1.826-2.083 3.652a2.5 2.5 0 0 0 .355 1.257h-.404v.491h-.047a.556.556 0 0 0-.499.6h6.546a.556.556 0 0 0-.499-.6M8 12.957c-1.565 0-1.975-.585-1.975-1.305a7.2 7.2 0 0 1 1.723-.656c.268 0 .289-3.513 0-3.779l-.988-1h2.454l-.962 1c-.268.286-.275 3.779 0 3.779a7.7 7.7 0 0 1 1.738.656c0 .72-.409 1.305-1.99 1.305" class="cls-1"/></svg>`
@@ -19316,6 +19324,10 @@
19316
19324
  name: 'info_circle_16_x_16',
19317
19325
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M8 2a6 6 0 1 0 6 6 6 6 0 0 0-6-6m-.697 2.28a.95.95 0 0 1 1.35 0 .93.93 0 0 1 .276.675.952.952 0 0 1-1.905 0 .92.92 0 0 1 .279-.674M9.7 12H6.3v-1.264h.833V7.777H6.3V6.513h2.584v4.223H9.7Z" class="cls-1"/></svg>`
19318
19326
  };
19327
+ const inwardSquaresThree16X16 = {
19328
+ name: 'inward_squares_three_16_x_16',
19329
+ data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M4 10h2v2H4zm-1 3h1v-1H3zm7-7H6v4h4zM3 3v4h2V5h6v6H9v2h4V3z" class="cls-1"/></svg>`
19330
+ };
19319
19331
  const italicI16X16 = {
19320
19332
  name: 'italic_i_16_x_16',
19321
19333
  data: `<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 16 16"><path d="M8.99 13.802H4.38l.258-1.133h1.523l2.17-9.367H6.808l.258-1.133h4.61l-.258 1.133H9.895l-2.17 9.367h1.523z"/></svg>`
@@ -19396,6 +19408,10 @@
19396
19408
  name: 'outdent_16_x_16',
19397
19409
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="m7.5 12.5-1-2.5 1-2.5-5 2.5zM2 3h12v2H2zM9 7h5v2H9zM9 11h5v2H9z" class="cls-1"/></svg>`
19398
19410
  };
19411
+ const outwardSquaresThree16X16 = {
19412
+ name: 'outward_squares_three_16_x_16',
19413
+ data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M9 9H7V7h2zm-6 4h4V9H3zM3 3v4h2V5h6v6H9v2h4V3zm7 3H9v1h1z" class="cls-1"/></svg>`
19414
+ };
19399
19415
  const paste16X16 = {
19400
19416
  name: 'paste_16_x_16',
19401
19417
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M9 5V3H3v6h2v1H2V2h8v3ZM6 6v8h8V6Z" class="cls-1"/></svg>`
@@ -19462,7 +19478,7 @@
19462
19478
  };
19463
19479
  const skipArrow16X16 = {
19464
19480
  name: 'skip_arrow_16_x_16',
19465
- data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M10.002 8.29 2 12.304v-8.01ZM14 2h-2v12h2Z" class="cls-1"/></svg>`
19481
+ data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M14 2h-2v12h2zm-4 6.5-8 4v-8z" class="cls-1"/></svg>`
19466
19482
  };
19467
19483
  const spinner = {
19468
19484
  name: 'spinner',
@@ -19476,6 +19492,10 @@
19476
19492
  name: 'square_t_16_x_16',
19477
19493
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M2 2v12h12V2Zm9.033 4.199-.016-.076a2.34 2.34 0 0 0-.497-1.18 2.1 2.1 0 0 0-1.281-.26h-.56v5.941c0 .552.11.718.176.768a1.8 1.8 0 0 0 .88.196l.09.006V12H6.193v-.405l.09-.007c.59-.046.8-.144.87-.218.06-.06.158-.255.158-.884V4.683h-.565a2.2 2.2 0 0 0-1.274.262 2 2 0 0 0-.498 1.174l-.015.08H4.49L4.565 4h6.859l.07 2.199Z" class="cls-1"/></svg>`
19478
19494
  };
19495
+ const squareX16X16 = {
19496
+ name: 'square_x_16_x_16',
19497
+ data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M3 3v10h10V3zm8 7.01-.99.99L8 8.99 5.99 11 5 10.01 7.01 8 5 5.99 5.99 5 8 7.01 10.01 5l.99.99L8.99 8z" class="cls-1"/></svg>`
19498
+ };
19479
19499
  const stopSquare16X16 = {
19480
19500
  name: 'stop_square_16_x_16',
19481
19501
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M3 3h10v10H3z" class="cls-1"/></svg>`
@@ -19508,6 +19528,10 @@
19508
19528
  name: 'target_crosshairs_progress_16_x_16',
19509
19529
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M15 7v2h-2.1A5 5 0 0 1 9 12.9V15H7v-2.108a4.99 4.99 0 0 1-3.898-3.985l-1.52.583 2.003-4 1.998 4L4.11 8.9A3.999 3.999 0 1 0 7 4.13V1h2v2.1A5 5 0 0 1 12.9 7Zm-5 1.01a2 2 0 1 1-2-2 2 2 0 0 1 2 2" class="cls-1"/></svg>`
19510
19530
  };
19531
+ const threeCirclesAscendingContainer16X16 = {
19532
+ name: 'three_circles_ascending_container_16_x_16',
19533
+ data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M12 4H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2M4 8.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5m3 .5a1.25 1.25 0 1 1 0-2.5 1.25 1.25 0 0 1 0 2.5m4 .5a1.75 1.75 0 1 1 0-3.5 1.75 1.75 0 0 1 0 3.5" class="cls-1"/></svg>`
19534
+ };
19511
19535
  const threeDotsLine16X16 = {
19512
19536
  name: 'three_dots_line_16_x_16',
19513
19537
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M8 6.5A1.5 1.5 0 1 1 6.5 8 1.5 1.5 0 0 1 8 6.5M.5 8A1.5 1.5 0 1 0 2 6.5 1.5 1.5 0 0 0 .5 8m12 0A1.5 1.5 0 1 0 14 6.5 1.5 1.5 0 0 0 12.5 8" class="cls-1"/></svg>`
@@ -22763,6 +22787,18 @@
22763
22787
  }
22764
22788
  registerIcon('icon-eye', IconEye);
22765
22789
 
22790
+ // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
22791
+ // See generation source in nimble-components/build/generate-icons
22792
+ /**
22793
+ * The icon component for the 'eyeDash' icon
22794
+ */
22795
+ class IconEyeDash extends Icon {
22796
+ constructor() {
22797
+ super(eyeDash16X16);
22798
+ }
22799
+ }
22800
+ registerIcon('icon-eye-dash', IconEyeDash);
22801
+
22766
22802
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
22767
22803
  // See generation source in nimble-components/build/generate-icons
22768
22804
  /**
@@ -23027,6 +23063,18 @@
23027
23063
  }
23028
23064
  registerIcon('icon-home', IconHome);
23029
23065
 
23066
+ // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
23067
+ // See generation source in nimble-components/build/generate-icons
23068
+ /**
23069
+ * The icon component for the 'horizontalTriangleOutline' icon
23070
+ */
23071
+ class IconHorizontalTriangleOutline extends Icon {
23072
+ constructor() {
23073
+ super(horizontalTriangleOutline16X16);
23074
+ }
23075
+ }
23076
+ registerIcon('icon-horizontal-triangle-outline', IconHorizontalTriangleOutline);
23077
+
23030
23078
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
23031
23079
  // See generation source in nimble-components/build/generate-icons
23032
23080
  /**
@@ -23075,6 +23123,18 @@
23075
23123
  }
23076
23124
  registerIcon('icon-info-circle', IconInfoCircle);
23077
23125
 
23126
+ // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
23127
+ // See generation source in nimble-components/build/generate-icons
23128
+ /**
23129
+ * The icon component for the 'inwardSquaresThree' icon
23130
+ */
23131
+ class IconInwardSquaresThree extends Icon {
23132
+ constructor() {
23133
+ super(inwardSquaresThree16X16);
23134
+ }
23135
+ }
23136
+ registerIcon('icon-inward-squares-three', IconInwardSquaresThree);
23137
+
23078
23138
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
23079
23139
  // See generation source in nimble-components/build/generate-icons
23080
23140
  /**
@@ -23320,6 +23380,18 @@
23320
23380
  }
23321
23381
  registerIcon('icon-outdent', IconOutdent);
23322
23382
 
23383
+ // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
23384
+ // See generation source in nimble-components/build/generate-icons
23385
+ /**
23386
+ * The icon component for the 'outwardSquaresThree' icon
23387
+ */
23388
+ class IconOutwardSquaresThree extends Icon {
23389
+ constructor() {
23390
+ super(outwardSquaresThree16X16);
23391
+ }
23392
+ }
23393
+ registerIcon('icon-outward-squares-three', IconOutwardSquaresThree);
23394
+
23323
23395
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
23324
23396
  // See generation source in nimble-components/build/generate-icons
23325
23397
  /**
@@ -23560,6 +23632,18 @@
23560
23632
  }
23561
23633
  registerIcon('icon-square-t', IconSquareT);
23562
23634
 
23635
+ // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
23636
+ // See generation source in nimble-components/build/generate-icons
23637
+ /**
23638
+ * The icon component for the 'squareX' icon
23639
+ */
23640
+ class IconSquareX extends Icon {
23641
+ constructor() {
23642
+ super(squareX16X16);
23643
+ }
23644
+ }
23645
+ registerIcon('icon-square-x', IconSquareX);
23646
+
23563
23647
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
23564
23648
  // See generation source in nimble-components/build/generate-icons
23565
23649
  /**
@@ -23656,6 +23740,18 @@
23656
23740
  }
23657
23741
  registerIcon('icon-target-crosshairs-progress', IconTargetCrosshairsProgress);
23658
23742
 
23743
+ // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
23744
+ // See generation source in nimble-components/build/generate-icons
23745
+ /**
23746
+ * The icon component for the 'threeCirclesAscendingContainer' icon
23747
+ */
23748
+ class IconThreeCirclesAscendingContainer extends Icon {
23749
+ constructor() {
23750
+ super(threeCirclesAscendingContainer16X16);
23751
+ }
23752
+ }
23753
+ registerIcon('icon-three-circles-ascending-container', IconThreeCirclesAscendingContainer);
23754
+
23659
23755
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
23660
23756
  // See generation source in nimble-components/build/generate-icons
23661
23757
  /**
@@ -68468,6 +68564,10 @@ img.ProseMirror-separator {
68468
68564
  }
68469
68565
  const passthroughUnitScale = new PassthroughUnitScale();
68470
68566
 
68567
+ // Workaround to avoid ts errors about signDisplay not accepting the value 'negative'.
68568
+ // It has been supported by browsers since 8/23, but TypeScript still hasn't
68569
+ // added it to the type definitions. See https://github.com/microsoft/TypeScript/issues/56269
68570
+ const signDisplay = 'negative';
68471
68571
  /**
68472
68572
  * Format for numbers with units to show in a tabular form.
68473
68573
  * Large and tiny numbers are shown exponentially and the rest as decimal.
@@ -68477,35 +68577,26 @@ img.ProseMirror-separator {
68477
68577
  unitScale: passthroughUnitScale
68478
68578
  }) {
68479
68579
  super();
68480
- // Format options to use by default. It renders the number with a maximum of 6 signficant digits.
68580
+ // Format options to use by default. It renders the number with a maximum of 6 signficant digits (including zero before decimal point).
68481
68581
  this.defaultIntlNumberFormatOptions = {
68482
68582
  maximumSignificantDigits: DefaultUnitFormat.maximumDigits,
68483
- useGrouping: true
68484
- };
68485
- this.defaultScaledUnitFormatters = new Map();
68486
- // Format options to use for numbers that have leading zeros. It limits the number of rendered
68487
- // digits using 'maximumFractionDigits', which will result in less than 6 significant digits
68488
- // in order to render no more than 6 total digits.
68489
- this.leadingZeroIntlNumberFormatOptions = {
68490
68583
  maximumFractionDigits: DefaultUnitFormat.maximumDigits - 1,
68491
- useGrouping: true
68584
+ roundingPriority: 'lessPrecision',
68585
+ signDisplay
68492
68586
  };
68493
- this.leadingZeroScaledUnitFormatters = new Map();
68587
+ this.defaultScaledUnitFormatters = new Map();
68494
68588
  // Format options for numbers that should be displayed in exponential notation. This should be used
68495
68589
  // for numbers with magintudes over 'exponentialUpperBound' or under 'exponentialLowerBound'.
68496
68590
  this.exponentialIntlNumberFormatOptions = {
68497
68591
  maximumSignificantDigits: DefaultUnitFormat.maximumDigits,
68498
- notation: 'scientific'
68592
+ notation: 'scientific',
68593
+ signDisplay
68499
68594
  };
68500
68595
  for (const unit of unitScale.supportedScaledUnits) {
68501
68596
  this.defaultScaledUnitFormatters.set(unit.scaleFactor, unit.scaledUnitFormatFactory({
68502
68597
  locale,
68503
68598
  intlNumberFormatOptions: this.defaultIntlNumberFormatOptions
68504
68599
  }));
68505
- this.leadingZeroScaledUnitFormatters.set(unit.scaleFactor, unit.scaledUnitFormatFactory({
68506
- locale,
68507
- intlNumberFormatOptions: this.leadingZeroIntlNumberFormatOptions
68508
- }));
68509
68600
  }
68510
68601
  this.exponentialScaledUnitFormatter = unitScale.baseScaledUnit.scaledUnitFormatFactory({
68511
68602
  locale,
@@ -68519,43 +68610,16 @@ img.ProseMirror-separator {
68519
68610
  };
68520
68611
  }
68521
68612
  tryFormat(number) {
68522
- // Normalize +0 / -0 --> +0
68523
- const numberNormalized = number === 0 ? 0 : number;
68524
- const { scaledValue, scaledUnit } = this.unitScale.scaleNumber(numberNormalized);
68525
- const numberStyle = this.resolveNumberStyle(scaledValue);
68526
- switch (numberStyle) {
68527
- case 'default': {
68528
- const scaledUnitFormatter = this.defaultScaledUnitFormatters.get(scaledUnit.scaleFactor);
68529
- return scaledUnitFormatter.format(scaledValue);
68530
- }
68531
- case 'leadingZero': {
68532
- const scaledUnitFormatter = this.leadingZeroScaledUnitFormatters.get(scaledUnit.scaleFactor);
68533
- return scaledUnitFormatter.format(scaledValue);
68534
- }
68535
- case 'exponential': {
68536
- const scaledUnitFormatter = this.exponentialScaledUnitFormatter;
68537
- return scaledUnitFormatter.format(numberNormalized);
68538
- }
68539
- default:
68540
- throw new Error('Unexpected number format style');
68541
- }
68542
- }
68543
- resolveNumberStyle(number) {
68544
- if (number === 0) {
68545
- return 'default';
68546
- }
68547
- const absoluteValue = Math.abs(number);
68548
- if (absoluteValue >= DefaultUnitFormat.exponentialUpperBound
68549
- || absoluteValue < DefaultUnitFormat.exponentialLowerBound) {
68550
- return 'exponential';
68551
- }
68552
- // Ideally, we could set 'roundingPriority: "lessPrecision"' with a formatter that has both 'maximumSignificantDigits' and
68553
- // 'maximumFractionDigits' configured instead of having two different formatters that we conditionally choose between. However,
68554
- // 'roundingPrioirty' is not supported yet in all browsers.
68555
- if (absoluteValue < 1) {
68556
- return 'leadingZero';
68557
- }
68558
- return 'default';
68613
+ const { scaledValue, scaledUnit } = this.unitScale.scaleNumber(number);
68614
+ const absoluteValue = Math.abs(scaledValue);
68615
+ const useExponential = absoluteValue !== 0
68616
+ && (absoluteValue >= DefaultUnitFormat.exponentialUpperBound
68617
+ || absoluteValue < DefaultUnitFormat.exponentialLowerBound);
68618
+ return useExponential
68619
+ ? this.exponentialScaledUnitFormatter.format(number)
68620
+ : this.defaultScaledUnitFormatters
68621
+ .get(scaledUnit.scaleFactor)
68622
+ .format(scaledValue);
68559
68623
  }
68560
68624
  }
68561
68625
  // The maximum number of digits that should be rendered for any given value.
@@ -68579,10 +68643,14 @@ img.ProseMirror-separator {
68579
68643
  }) {
68580
68644
  super();
68581
68645
  this.scaledUnitFormatters = new Map();
68646
+ // Workaround to avoid a ts error about signDisplay not accepting the value 'negative'.
68647
+ // It has been supported by browsers since 8/23, but TypeScript still hasn't
68648
+ // added it to the type definitions. See https://github.com/microsoft/TypeScript/issues/56269
68649
+ const signDisplay = 'negative';
68582
68650
  const intlNumberFormatOptions = {
68583
68651
  maximumFractionDigits,
68584
68652
  minimumFractionDigits,
68585
- useGrouping: true
68653
+ signDisplay
68586
68654
  };
68587
68655
  for (const scaledUnit of unitScale.supportedScaledUnits) {
68588
68656
  this.scaledUnitFormatters.set(scaledUnit.scaleFactor, scaledUnit.scaledUnitFormatFactory({
@@ -68590,7 +68658,6 @@ img.ProseMirror-separator {
68590
68658
  intlNumberFormatOptions
68591
68659
  }));
68592
68660
  }
68593
- this.tenPowDecimalDigits = 10 ** maximumFractionDigits;
68594
68661
  this.unitScale = unitScale;
68595
68662
  this.minimumFractionDigits = minimumFractionDigits;
68596
68663
  this.maximumFractionDigits = maximumFractionDigits;
@@ -68604,16 +68671,8 @@ img.ProseMirror-separator {
68604
68671
  }
68605
68672
  tryFormat(number) {
68606
68673
  const { scaledValue, scaledUnit } = this.unitScale.scaleNumber(number);
68607
- const numberNormalized = this.willRoundToZero(scaledValue)
68608
- ? 0
68609
- : scaledValue;
68610
68674
  const scaledUnitFormatter = this.scaledUnitFormatters.get(scaledUnit.scaleFactor);
68611
- return scaledUnitFormatter.format(numberNormalized);
68612
- }
68613
- willRoundToZero(number) {
68614
- // Multiply the value by 10 raised to maximumFractionDigits so that Math.round can be used to emulate rounding to
68615
- // maximumFractionDigits decimal places. If that rounded value is 0, then the value will be rendered with only 0s.
68616
- return Math.round(number * this.tenPowDecimalDigits) === 0;
68675
+ return scaledUnitFormatter.format(scaledValue);
68617
68676
  }
68618
68677
  }
68619
68678