@ni/nimble-components 20.1.21 → 20.2.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 (42) hide show
  1. package/dist/all-components-bundle.js +119 -58
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +3003 -2998
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/src/table/types.d.ts +1 -3
  6. package/dist/esm/src/table-column/base/types.d.ts +2 -1
  7. package/dist/esm/src/table-column/date-text/index.d.ts +2 -0
  8. package/dist/esm/src/theme-provider/index.d.ts +11 -3
  9. package/dist/esm/src/utilities/models/document-element-lang.d.ts +9 -0
  10. package/dist/esm/src/utilities/models/validator.d.ts +3 -1
  11. package/dist/esm/src/wafer-map/index.d.ts +3 -3
  12. package/dist/esm/src/wafer-map/modules/wafer-map-update-tracker.d.ts +1 -1
  13. package/dist/esm/src/wafer-map/types.d.ts +3 -3
  14. package/dist/esm/table/types.d.ts +1 -3
  15. package/dist/esm/table/types.js.map +1 -1
  16. package/dist/esm/table-column/base/types.d.ts +2 -1
  17. package/dist/esm/table-column/base/types.js.map +1 -1
  18. package/dist/esm/table-column/date-text/index.d.ts +2 -0
  19. package/dist/esm/table-column/date-text/index.js +12 -1
  20. package/dist/esm/table-column/date-text/index.js.map +1 -1
  21. package/dist/esm/theme-provider/index.d.ts +11 -3
  22. package/dist/esm/theme-provider/index.js +46 -7
  23. package/dist/esm/theme-provider/index.js.map +1 -1
  24. package/dist/esm/utilities/models/document-element-lang.d.ts +9 -0
  25. package/dist/esm/utilities/models/document-element-lang.js +26 -0
  26. package/dist/esm/utilities/models/document-element-lang.js.map +1 -0
  27. package/dist/esm/utilities/models/validator.d.ts +3 -1
  28. package/dist/esm/utilities/models/validator.js.map +1 -1
  29. package/dist/esm/wafer-map/index.d.ts +3 -3
  30. package/dist/esm/wafer-map/index.js +10 -20
  31. package/dist/esm/wafer-map/index.js.map +1 -1
  32. package/dist/esm/wafer-map/modules/computations.js +22 -22
  33. package/dist/esm/wafer-map/modules/computations.js.map +1 -1
  34. package/dist/esm/wafer-map/modules/hover-handler.js +6 -6
  35. package/dist/esm/wafer-map/modules/hover-handler.js.map +1 -1
  36. package/dist/esm/wafer-map/modules/wafer-map-update-tracker.d.ts +1 -1
  37. package/dist/esm/wafer-map/modules/wafer-map-update-tracker.js +3 -3
  38. package/dist/esm/wafer-map/modules/wafer-map-update-tracker.js.map +1 -1
  39. package/dist/esm/wafer-map/types.d.ts +3 -3
  40. package/dist/esm/wafer-map/types.js +1 -1
  41. package/dist/esm/wafer-map/types.js.map +1 -1
  42. package/package.json +1 -1
@@ -16288,7 +16288,7 @@
16288
16288
 
16289
16289
  /**
16290
16290
  * Do not edit directly
16291
- * Generated on Fri, 01 Sep 2023 05:37:36 GMT
16291
+ * Generated on Fri, 01 Sep 2023 19:18:16 GMT
16292
16292
  */
16293
16293
 
16294
16294
  const Information100DarkUi = "#a46eff";
@@ -16679,6 +16679,45 @@
16679
16679
  }
16680
16680
  `;
16681
16681
 
16682
+ /**
16683
+ * Observable class to subscribe to changes in the page's lang attribute
16684
+ */
16685
+ class DocumentElementLang {
16686
+ constructor() {
16687
+ this.lang = document.documentElement.lang;
16688
+ const observer = new MutationObserver(mutations => {
16689
+ for (const mutation of mutations) {
16690
+ if (mutation.type === 'attributes'
16691
+ && mutation.attributeName === 'lang') {
16692
+ this.lang = mutation.target.lang;
16693
+ }
16694
+ }
16695
+ });
16696
+ observer.observe(document.documentElement, {
16697
+ attributeFilter: ['lang']
16698
+ });
16699
+ }
16700
+ }
16701
+ __decorate$1([
16702
+ observable
16703
+ ], DocumentElementLang.prototype, "lang", void 0);
16704
+ const documentElementLang = new DocumentElementLang();
16705
+
16706
+ function isValidLang(value) {
16707
+ try {
16708
+ // We are relying on the Locale constructor to validate the value
16709
+ // eslint-disable-next-line no-new
16710
+ new Intl.Locale(value);
16711
+ return true;
16712
+ }
16713
+ catch (e) {
16714
+ return false;
16715
+ }
16716
+ }
16717
+ const lang$1 = DesignToken.create({
16718
+ name: 'lang',
16719
+ cssCustomPropertyName: null
16720
+ }).withDefault(() => (isValidLang(documentElementLang.lang) ? documentElementLang.lang : 'en-US'));
16682
16721
  // Not represented as a CSS Custom Property, instead available
16683
16722
  // as an attribute of theme provider.
16684
16723
  const direction = DesignToken.create({
@@ -16697,8 +16736,31 @@
16697
16736
  class ThemeProvider extends FoundationElement {
16698
16737
  constructor() {
16699
16738
  super(...arguments);
16700
- this.direction = Direction.ltr;
16701
16739
  this.theme = Theme.light;
16740
+ this.langIsInvalid = false;
16741
+ }
16742
+ get validity() {
16743
+ return {
16744
+ invalidLang: this.langIsInvalid
16745
+ };
16746
+ }
16747
+ checkValidity() {
16748
+ return !this.langIsInvalid;
16749
+ }
16750
+ langChanged(_prev, next) {
16751
+ if (next === null || next === undefined) {
16752
+ lang$1.deleteValueFor(this);
16753
+ this.langIsInvalid = false;
16754
+ return;
16755
+ }
16756
+ if (isValidLang(next)) {
16757
+ lang$1.setValueFor(this, next);
16758
+ this.langIsInvalid = false;
16759
+ }
16760
+ else {
16761
+ lang$1.deleteValueFor(this);
16762
+ this.langIsInvalid = true;
16763
+ }
16702
16764
  }
16703
16765
  directionChanged(_prev, next) {
16704
16766
  if (next !== undefined && next !== null) {
@@ -16718,14 +16780,13 @@
16718
16780
  }
16719
16781
  }
16720
16782
  __decorate$1([
16721
- attr({
16722
- attribute: 'direction'
16723
- })
16783
+ attr()
16784
+ ], ThemeProvider.prototype, "lang", void 0);
16785
+ __decorate$1([
16786
+ attr()
16724
16787
  ], ThemeProvider.prototype, "direction", void 0);
16725
16788
  __decorate$1([
16726
- attr({
16727
- attribute: 'theme'
16728
- })
16789
+ attr()
16729
16790
  ], ThemeProvider.prototype, "theme", void 0);
16730
16791
  const nimbleDesignSystemProvider = ThemeProvider.compose({
16731
16792
  baseName: 'theme-provider',
@@ -65148,11 +65209,21 @@ img.ProseMirror-separator {
65148
65209
  super(...arguments);
65149
65210
  /** @internal */
65150
65211
  this.validator = new TableColumnDateTextValidator(this.columnInternals);
65212
+ this.langSubscriber = {
65213
+ handleChange: () => {
65214
+ this.updateColumnConfig();
65215
+ }
65216
+ };
65151
65217
  }
65152
65218
  connectedCallback() {
65153
65219
  super.connectedCallback();
65220
+ lang$1.subscribe(this.langSubscriber, this);
65154
65221
  this.updateColumnConfig();
65155
65222
  }
65223
+ disconnectedCallback() {
65224
+ super.disconnectedCallback();
65225
+ lang$1.unsubscribe(this.langSubscriber, this);
65226
+ }
65156
65227
  get validity() {
65157
65228
  return this.validator.getValidity();
65158
65229
  }
@@ -65251,7 +65322,7 @@ img.ProseMirror-separator {
65251
65322
  options = this.getCustomFormattingOptions();
65252
65323
  }
65253
65324
  try {
65254
- return new Intl.DateTimeFormat(undefined, options);
65325
+ return new Intl.DateTimeFormat(lang$1.getValueFor(this), options);
65255
65326
  }
65256
65327
  catch (e) {
65257
65328
  return undefined;
@@ -71650,7 +71721,7 @@ img.ProseMirror-separator {
71650
71721
  return initRange.apply(scale, arguments);
71651
71722
  }
71652
71723
 
71653
- const WaferMapQuadrant = {
71724
+ const WaferMapOriginLocation = {
71654
71725
  bottomLeft: 'bottom-left',
71655
71726
  bottomRight: 'bottom-right',
71656
71727
  topLeft: 'top-left',
@@ -71732,12 +71803,12 @@ img.ProseMirror-separator {
71732
71803
  const containerDiameter = Math.min(this._containerDimensions.width, this._containerDimensions.height);
71733
71804
  const gridDimensions = this.calculateGridDimensions(this.wafermap.dies);
71734
71805
  // this scale is used for positioning the dies on the canvas
71735
- const quadrant = this.wafermap.quadrant;
71736
- this._horizontalScale = this.createHorizontalScale(quadrant, gridDimensions, containerDiameter);
71737
- this._invertedHorizontalScale = this.createInvertedHorizontalScale(quadrant, gridDimensions, containerDiameter);
71806
+ const originLocation = this.wafermap.originLocation;
71807
+ this._horizontalScale = this.createHorizontalScale(originLocation, gridDimensions, containerDiameter);
71808
+ this._invertedHorizontalScale = this.createInvertedHorizontalScale(originLocation, gridDimensions, containerDiameter);
71738
71809
  // this scale is used for positioning the dies on the canvas
71739
- this._verticalScale = this.createVerticalScale(quadrant, gridDimensions, containerDiameter);
71740
- this._invertedVerticalScale = this.createInvertedVerticalScale(quadrant, gridDimensions, containerDiameter);
71810
+ this._verticalScale = this.createVerticalScale(originLocation, gridDimensions, containerDiameter);
71811
+ this._invertedVerticalScale = this.createInvertedVerticalScale(originLocation, gridDimensions, containerDiameter);
71741
71812
  this._dieDimensions = {
71742
71813
  width: this.horizontalScale.bandwidth(),
71743
71814
  height: this.verticalScale.bandwidth()
@@ -71775,47 +71846,47 @@ img.ProseMirror-separator {
71775
71846
  height: canvasDimensions.height - margin.top - margin.bottom
71776
71847
  };
71777
71848
  }
71778
- createHorizontalScale(axisLocation, grid, containerWidth) {
71849
+ createHorizontalScale(originLocation, grid, containerWidth) {
71779
71850
  const scale = band()
71780
71851
  .domain(range(grid.origin.x, grid.origin.x + grid.cols))
71781
71852
  .paddingInner(0)
71782
71853
  .paddingOuter(0)
71783
71854
  .align(0)
71784
71855
  .round(false);
71785
- if (axisLocation === WaferMapQuadrant.bottomLeft
71786
- || axisLocation === WaferMapQuadrant.topLeft) {
71856
+ if (originLocation === WaferMapOriginLocation.bottomLeft
71857
+ || originLocation === WaferMapOriginLocation.topLeft) {
71787
71858
  return scale.range([0, containerWidth]);
71788
71859
  }
71789
71860
  return scale.range([containerWidth, 0]);
71790
71861
  }
71791
- createInvertedHorizontalScale(axisLocation, grid, containerWidth) {
71862
+ createInvertedHorizontalScale(originLocation, grid, containerWidth) {
71792
71863
  const scale = quantile().domain([0, containerWidth]);
71793
- if (axisLocation === WaferMapQuadrant.bottomLeft
71794
- || axisLocation === WaferMapQuadrant.topLeft) {
71864
+ if (originLocation === WaferMapOriginLocation.bottomLeft
71865
+ || originLocation === WaferMapOriginLocation.topLeft) {
71795
71866
  return scale.range(range(grid.origin.x, grid.origin.x + grid.cols));
71796
71867
  }
71797
71868
  return scale.range(range(grid.origin.x, grid.origin.x + grid.cols).reverse());
71798
71869
  }
71799
- createVerticalScale(axisLocation, grid, containerHeight) {
71870
+ createVerticalScale(originLocation, grid, containerHeight) {
71800
71871
  const scale = band()
71801
71872
  .domain(range(grid.origin.y, grid.origin.y + grid.rows))
71802
71873
  .paddingInner(this.defaultPadding)
71803
71874
  .paddingOuter(0)
71804
71875
  .align(0)
71805
71876
  .round(false);
71806
- if (axisLocation === WaferMapQuadrant.bottomLeft
71807
- || axisLocation === WaferMapQuadrant.bottomRight) {
71808
- return scale.range([containerHeight, 0]);
71877
+ if (originLocation === WaferMapOriginLocation.bottomLeft
71878
+ || originLocation === WaferMapOriginLocation.bottomRight) {
71879
+ return scale.range([0, containerHeight]);
71809
71880
  }
71810
- return scale.range([0, containerHeight]);
71881
+ return scale.range([containerHeight, 0]);
71811
71882
  }
71812
- createInvertedVerticalScale(axisLocation, grid, containerHeight) {
71883
+ createInvertedVerticalScale(originLocation, grid, containerHeight) {
71813
71884
  const scale = quantile().domain([0, containerHeight]);
71814
- if (axisLocation === WaferMapQuadrant.bottomLeft
71815
- || axisLocation === WaferMapQuadrant.bottomRight) {
71816
- return scale.range(range(grid.origin.y, grid.origin.y + grid.rows).reverse());
71885
+ if (originLocation === WaferMapOriginLocation.bottomLeft
71886
+ || originLocation === WaferMapOriginLocation.bottomRight) {
71887
+ return scale.range(range(grid.origin.y, grid.origin.y + grid.rows));
71817
71888
  }
71818
- return scale.range(range(grid.origin.y, grid.origin.y + grid.rows));
71889
+ return scale.range(range(grid.origin.y, grid.origin.y + grid.rows).reverse());
71819
71890
  }
71820
71891
  calculateMarginAddition(baseMargin, addedMargin) {
71821
71892
  return {
@@ -72202,13 +72273,13 @@ img.ProseMirror-separator {
72202
72273
  this.wafermap.hoverDie = undefined;
72203
72274
  }
72204
72275
  calculateDieCoordinates(wafermap, mousePosition) {
72205
- const axisLocation = wafermap.quadrant;
72206
- const xRoundFunction = axisLocation === WaferMapQuadrant.bottomLeft
72207
- || axisLocation === WaferMapQuadrant.topLeft
72276
+ const originLocation = wafermap.originLocation;
72277
+ const xRoundFunction = originLocation === WaferMapOriginLocation.bottomLeft
72278
+ || originLocation === WaferMapOriginLocation.topLeft
72208
72279
  ? Math.floor
72209
72280
  : Math.ceil;
72210
- const yRoundFunction = axisLocation === WaferMapQuadrant.topLeft
72211
- || axisLocation === WaferMapQuadrant.topRight
72281
+ const yRoundFunction = originLocation === WaferMapOriginLocation.bottomLeft
72282
+ || originLocation === WaferMapOriginLocation.bottomRight
72212
72283
  ? Math.floor
72213
72284
  : Math.ceil;
72214
72285
  // go to x and y scale to get the x,y values of the die.
@@ -72262,7 +72333,7 @@ img.ProseMirror-separator {
72262
72333
  const trackedItems = [
72263
72334
  'canvasWidth',
72264
72335
  'canvasHeight',
72265
- 'quadrant',
72336
+ 'originLocation',
72266
72337
  'dies',
72267
72338
  'maxCharacters',
72268
72339
  'colorScale',
@@ -72286,7 +72357,7 @@ img.ProseMirror-separator {
72286
72357
  get requiresEventsUpdate() {
72287
72358
  return (this.isTracked('canvasWidth')
72288
72359
  || this.isTracked('canvasHeight')
72289
- || this.isTracked('quadrant')
72360
+ || this.isTracked('originLocation')
72290
72361
  || this.isTracked('dies')
72291
72362
  || this.isTracked('maxCharacters')
72292
72363
  || this.isTracked('colorScale')
@@ -72300,7 +72371,7 @@ img.ProseMirror-separator {
72300
72371
  return this.isTracked('canvasWidth') || this.isTracked('canvasHeight');
72301
72372
  }
72302
72373
  get requiresScalesUpdate() {
72303
- return this.isTracked('quadrant') || this.isTracked('dies');
72374
+ return this.isTracked('originLocation') || this.isTracked('dies');
72304
72375
  }
72305
72376
  get requiresLabelsFontSizeUpdate() {
72306
72377
  return this.isTracked('maxCharacters');
@@ -72348,7 +72419,7 @@ img.ProseMirror-separator {
72348
72419
  * needs to be initialized before the properties trigger changes
72349
72420
  */
72350
72421
  this.waferMapUpdateTracker = new WaferMapUpdateTracker(this);
72351
- this.quadrant = WaferMapQuadrant.topLeft;
72422
+ this.originLocation = WaferMapOriginLocation.bottomLeft;
72352
72423
  this.orientation = WaferMapOrientation.top;
72353
72424
  this.maxCharacters = 4;
72354
72425
  this.dieLabelsHidden = false;
@@ -72459,8 +72530,8 @@ img.ProseMirror-separator {
72459
72530
  });
72460
72531
  return resizeObserver;
72461
72532
  }
72462
- quadrantChanged() {
72463
- this.waferMapUpdateTracker.track('quadrant');
72533
+ originLocationChanged() {
72534
+ this.waferMapUpdateTracker.track('originLocation');
72464
72535
  this.waferMapUpdateTracker.queueUpdate();
72465
72536
  }
72466
72537
  maxCharactersChanged() {
@@ -72510,32 +72581,22 @@ img.ProseMirror-separator {
72510
72581
  }
72511
72582
  }
72512
72583
  __decorate$1([
72513
- attr
72514
- ], WaferMap.prototype, "quadrant", void 0);
72584
+ attr({ attribute: 'origin-location' })
72585
+ ], WaferMap.prototype, "originLocation", void 0);
72515
72586
  __decorate$1([
72516
72587
  attr
72517
72588
  ], WaferMap.prototype, "orientation", void 0);
72518
72589
  __decorate$1([
72519
- attr({
72520
- attribute: 'max-characters',
72521
- converter: nullableNumberConverter
72522
- })
72590
+ attr({ attribute: 'max-characters', converter: nullableNumberConverter })
72523
72591
  ], WaferMap.prototype, "maxCharacters", void 0);
72524
72592
  __decorate$1([
72525
- attr({
72526
- attribute: 'die-labels-hidden',
72527
- mode: 'boolean'
72528
- })
72593
+ attr({ attribute: 'die-labels-hidden', mode: 'boolean' })
72529
72594
  ], WaferMap.prototype, "dieLabelsHidden", void 0);
72530
72595
  __decorate$1([
72531
- attr({
72532
- attribute: 'die-labels-suffix'
72533
- })
72596
+ attr({ attribute: 'die-labels-suffix' })
72534
72597
  ], WaferMap.prototype, "dieLabelsSuffix", void 0);
72535
72598
  __decorate$1([
72536
- attr({
72537
- attribute: 'color-scale-mode'
72538
- })
72599
+ attr({ attribute: 'color-scale-mode' })
72539
72600
  ], WaferMap.prototype, "colorScaleMode", void 0);
72540
72601
  __decorate$1([
72541
72602
  observable