@ni/nimble-components 35.2.3 → 35.3.1

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.
@@ -14876,7 +14876,25 @@
14876
14876
  calendarEventFillBlockedColor: 'calendar-event-fill-blocked-color',
14877
14877
  calendarGrabHandleBackgroundColor: 'calendar-grab-handle-background-color',
14878
14878
  calendarGridBorderColor: 'calendar-grid-border-color',
14879
- calendarGroupHeaderBackgroundColor: 'calendar-group-header-background-color'
14879
+ calendarGroupHeaderBackgroundColor: 'calendar-group-header-background-color',
14880
+ calendarEventBackgroundJobColor: 'calendar-event-background-job-color',
14881
+ calendarEventBackgroundHoverJobColor: 'calendar-event-background-hover-job-color',
14882
+ calendarEventBorderJobColor: 'calendar-event-border-job-color',
14883
+ calendarEventJobFontColor: 'calendar-event-job-font-color',
14884
+ calendarEventBackgroundMaintenanceColor: 'calendar-event-background-maintenance-color',
14885
+ calendarEventBackgroundHoverMaintenanceColor: 'calendar-event-background-hover-maintenance-color',
14886
+ calendarEventBorderMaintenanceColor: 'calendar-event-border-maintenance-color',
14887
+ calendarEventBackgroundCalibrationColor: 'calendar-event-background-calibration-color',
14888
+ calendarEventBackgroundHoverCalibrationColor: 'calendar-event-background-hover-calibration-color',
14889
+ calendarEventBorderCalibrationColor: 'calendar-event-border-calibration-color',
14890
+ calendarEventBackgroundReservationColor: 'calendar-event-background-reservation-color',
14891
+ calendarEventBackgroundHoverReservationColor: 'calendar-event-background-hover-reservation-color',
14892
+ calendarEventBorderReservationColor: 'calendar-event-border-reservation-color',
14893
+ calendarEventBackgroundTransportOrderColor: 'calendar-event-background-transport-order-color',
14894
+ calendarEventBackgroundHoverTransportOrderColor: 'calendar-event-background-hover-transport-order-color',
14895
+ calendarEventBorderTransportOrderColor: 'calendar-event-border-transport-order-color',
14896
+ calendarEventBackgroundAggregateAvailabilityColor: 'calendar-event-background-aggregate-availability-color',
14897
+ calendarEventBorderAggregateAvailabilityColor: 'calendar-event-border-aggregate-availability-color'
14880
14898
  };
14881
14899
  const prefix = 'ni-nimble';
14882
14900
  const styleNameFromTokenName = (tokenName) => `${prefix}-${tokenName}`;
@@ -16111,7 +16129,16 @@
16111
16129
 
16112
16130
  const Information100DarkUi = "#a46eff";
16113
16131
  const Information100LightUi = "#804ad9";
16132
+ const InformationLight10 = "#f3edfc";
16133
+ const InformationDark10 = "#413d4c";
16134
+ const InformationLight30 = "#d9c9f4";
16135
+ const InformationDark30 = "#574873";
16136
+ const InformationDarkTypography = "#c9abff";
16114
16137
  const Warning100DarkUi = "#ff8126";
16138
+ const WarningLight10 = "#ffede6";
16139
+ const WarningDark10 = "#4a3e36";
16140
+ const WarningLight20 = "#ffdbcc";
16141
+ const WarningDark20 = "#5e4635";
16115
16142
  const Pass100LightUi = "#009921";
16116
16143
  const Pass100DarkUi = "#00c12b";
16117
16144
  const Fail100LightUi = "#c4000c";
@@ -16132,6 +16159,8 @@
16132
16159
  const NiSky = "#3cb4e7";
16133
16160
  const BannerFail100DarkUi = "#d63434";
16134
16161
  const Warning100LightUi = "#ff4b00";
16162
+ const Black91V10 = "#e8e8e8";
16163
+ const Black82V100 = "#6e6f70";
16135
16164
  const DigitalGreenDark = "#008557";
16136
16165
  const DigitalGreenDark105 = "#00734b";
16137
16166
  const DigitalGreenDark110 = "#00613f";
@@ -16150,10 +16179,25 @@
16150
16179
  const NiSea = "#00aba5";
16151
16180
  const NiSeaLight = "#a5d8c8";
16152
16181
  const NiTulip = "#e54c8a";
16182
+ const NiTulip10 = "#fdeef4";
16183
+ const NiTulipDark10 = "#483a41";
16184
+ const NiTulip20 = "#fadbe8";
16185
+ const NiTulipDark20 = "#593b49";
16153
16186
  const NiIndigo = "#8e78b7";
16154
16187
  const NiPlumDark1 = "#8c459a";
16155
16188
  const NiIndigoDark2 = "#312e7f";
16156
16189
  const NiSeaDark2 = "#00685f";
16190
+ const NiSpec10 = "#e6f6fb";
16191
+ const NiSpecDark10 = "#304147";
16192
+ const NiSpec20 = "#ccecf6";
16193
+ const NiSpecDark20 = "#2b4c57";
16194
+ const NiSpec = "#00a1d4";
16195
+ const BrownLight10 = "#f1eeeb";
16196
+ const BrownDark10 = "#403e3d";
16197
+ const BrownLight20 = "#e2dcd7";
16198
+ const BrownDark20 = "#4a4440";
16199
+ const BrownLight = "#6f4e37";
16200
+ const BrownDark = "#9b7a60";
16157
16201
  const Title2Family = "Source Sans Pro";
16158
16202
  const Title2Weight = "400";
16159
16203
  const ControlLabel1Family = "Source Sans Pro";
@@ -16312,6 +16356,24 @@
16312
16356
  calendarGrabHandleBackgroundColor: createThemeColor(DigitalGreenLight, PowerGreen, PowerGreen),
16313
16357
  calendarGridBorderColor: createThemeColor(Black22, Black80, Black80),
16314
16358
  calendarGroupHeaderBackgroundColor: createThemeColor(Black7, hexToRgbaCssColor(Black91, 0.1), hexToRgbaCssColor(Black91, 0.1)),
16359
+ calendarEventBackgroundJobColor: createThemeColor(InformationLight10, InformationDark10, InformationDark10),
16360
+ calendarEventBackgroundHoverJobColor: createThemeColor(InformationLight30, InformationDark30, InformationDark30),
16361
+ calendarEventBorderJobColor: createThemeColor(Information100LightUi, Information100DarkUi, Information100DarkUi),
16362
+ calendarEventJobFontColor: createThemeColor(Information100LightUi, InformationDarkTypography, InformationDarkTypography),
16363
+ calendarEventBackgroundMaintenanceColor: createThemeColor(WarningLight10, WarningDark10, WarningDark10),
16364
+ calendarEventBackgroundHoverMaintenanceColor: createThemeColor(WarningLight20, WarningDark20, WarningDark20),
16365
+ calendarEventBorderMaintenanceColor: createThemeColor(Warning100LightUi, Warning100DarkUi, Warning100DarkUi),
16366
+ calendarEventBackgroundCalibrationColor: createThemeColor(NiTulip10, NiTulipDark10, NiTulipDark10),
16367
+ calendarEventBackgroundHoverCalibrationColor: createThemeColor(NiTulip20, NiTulipDark20, NiTulipDark20),
16368
+ calendarEventBorderCalibrationColor: createThemeColor(NiTulip, NiTulip, NiTulip),
16369
+ calendarEventBackgroundReservationColor: createThemeColor(NiSpec10, NiSpecDark10, NiSpecDark10),
16370
+ calendarEventBackgroundHoverReservationColor: createThemeColor(NiSpec20, NiSpecDark20, NiSpecDark20),
16371
+ calendarEventBorderReservationColor: createThemeColor(NiSpec, NiSpec, NiSpec),
16372
+ calendarEventBackgroundTransportOrderColor: createThemeColor(BrownLight10, BrownDark10, BrownDark10),
16373
+ calendarEventBackgroundHoverTransportOrderColor: createThemeColor(BrownLight20, BrownDark20, BrownDark20),
16374
+ calendarEventBorderTransportOrderColor: createThemeColor(BrownLight, BrownDark, BrownDark),
16375
+ calendarEventBackgroundAggregateAvailabilityColor: createThemeColor(Black91V10, Black82, Black82),
16376
+ calendarEventBorderAggregateAvailabilityColor: hexToRgbaCssThemeColor(createThemeColor(Black91, Black82V100, Black82V100), 0.5, 1, 1),
16315
16377
  controlHeight: '32px',
16316
16378
  controlSlimHeight: '24px',
16317
16379
  smallPadding: '4px',
@@ -16467,6 +16529,24 @@
16467
16529
  createThemeColorToken(tokenNames.calendarGrabHandleBackgroundColor, tokenValues.calendarGrabHandleBackgroundColor);
16468
16530
  createThemeColorToken(tokenNames.calendarGridBorderColor, tokenValues.calendarGridBorderColor);
16469
16531
  createThemeColorToken(tokenNames.calendarGroupHeaderBackgroundColor, tokenValues.calendarGroupHeaderBackgroundColor);
16532
+ createThemeColorToken(tokenNames.calendarEventBackgroundJobColor, tokenValues.calendarEventBackgroundJobColor);
16533
+ createThemeColorToken(tokenNames.calendarEventBackgroundHoverJobColor, tokenValues.calendarEventBackgroundHoverJobColor);
16534
+ createThemeColorToken(tokenNames.calendarEventBorderJobColor, tokenValues.calendarEventBorderJobColor);
16535
+ createThemeColorToken(tokenNames.calendarEventJobFontColor, tokenValues.calendarEventJobFontColor);
16536
+ createThemeColorToken(tokenNames.calendarEventBackgroundMaintenanceColor, tokenValues.calendarEventBackgroundMaintenanceColor);
16537
+ createThemeColorToken(tokenNames.calendarEventBackgroundHoverMaintenanceColor, tokenValues.calendarEventBackgroundHoverMaintenanceColor);
16538
+ createThemeColorToken(tokenNames.calendarEventBorderMaintenanceColor, tokenValues.calendarEventBorderMaintenanceColor);
16539
+ createThemeColorToken(tokenNames.calendarEventBackgroundCalibrationColor, tokenValues.calendarEventBackgroundCalibrationColor);
16540
+ createThemeColorToken(tokenNames.calendarEventBackgroundHoverCalibrationColor, tokenValues.calendarEventBackgroundHoverCalibrationColor);
16541
+ createThemeColorToken(tokenNames.calendarEventBorderCalibrationColor, tokenValues.calendarEventBorderCalibrationColor);
16542
+ createThemeColorToken(tokenNames.calendarEventBackgroundReservationColor, tokenValues.calendarEventBackgroundReservationColor);
16543
+ createThemeColorToken(tokenNames.calendarEventBackgroundHoverReservationColor, tokenValues.calendarEventBackgroundHoverReservationColor);
16544
+ createThemeColorToken(tokenNames.calendarEventBorderReservationColor, tokenValues.calendarEventBorderReservationColor);
16545
+ createThemeColorToken(tokenNames.calendarEventBackgroundTransportOrderColor, tokenValues.calendarEventBackgroundTransportOrderColor);
16546
+ createThemeColorToken(tokenNames.calendarEventBackgroundHoverTransportOrderColor, tokenValues.calendarEventBackgroundHoverTransportOrderColor);
16547
+ createThemeColorToken(tokenNames.calendarEventBorderTransportOrderColor, tokenValues.calendarEventBorderTransportOrderColor);
16548
+ createThemeColorToken(tokenNames.calendarEventBackgroundAggregateAvailabilityColor, tokenValues.calendarEventBackgroundAggregateAvailabilityColor);
16549
+ createThemeColorToken(tokenNames.calendarEventBorderAggregateAvailabilityColor, tokenValues.calendarEventBorderAggregateAvailabilityColor);
16470
16550
  // #endregion
16471
16551
  // #region size tokens
16472
16552
  const controlHeight = createStringToken(tokenNames.controlHeight, tokenValues.controlHeight);
@@ -73222,25 +73302,32 @@ focus outline in that case.
73222
73302
  this.columnIndex = -1;
73223
73303
  this.focusWithinTable = false;
73224
73304
  this.isCurrentlyFocusingElement = false;
73305
+ this.focusedViaPointer = false;
73225
73306
  this.visibleRowNotifiers = [];
73226
73307
  this.onTableFocusIn = (event) => {
73227
73308
  this.focusWithinTable = true;
73228
- this.updateFocusStateFromActiveElement(false);
73309
+ this.updateFocusStateFromActiveElement();
73229
73310
  // Sets initial focus on the appropriate table content
73230
73311
  const actionMenuOpen = this.table.openActionMenuRecordId !== undefined;
73231
- if ((event.target === this.table
73232
- || this.focusType === TableFocusType.none)
73233
- && !actionMenuOpen) {
73234
- let focusHeader = true;
73235
- if (this.hasRowOrCellFocusType()
73236
- && this.scrollToAndFocusRow(this.rowIndex)) {
73237
- focusHeader = false;
73312
+ if (!actionMenuOpen) {
73313
+ if (this.focusType === TableFocusType.none) {
73314
+ this.focusSomethingOtherThanTheTable();
73238
73315
  }
73239
- if (focusHeader && !this.setFocusOnHeader()) {
73240
- // nothing to focus
73241
- this.table.blur();
73316
+ else if (event.target === this.table) {
73317
+ // restore focus to last focused element
73318
+ if (this.hasRowOrCellFocusType() && this.rowIndexIsValid(this.rowIndex)) {
73319
+ this.scrollToAndFocusRow(this.rowIndex);
73320
+ }
73321
+ else if (this.hasHeaderFocusType()) {
73322
+ this.focusHeaderElement();
73323
+ }
73324
+ else {
73325
+ // should only get here if focusType was row/cell, but rowIndex was invalid
73326
+ this.focusSomethingOtherThanTheTable();
73327
+ }
73242
73328
  }
73243
73329
  }
73330
+ this.focusedViaPointer = false;
73244
73331
  };
73245
73332
  this.onTableFocusOut = () => {
73246
73333
  this.focusWithinTable = false;
@@ -73255,12 +73342,18 @@ focus outline in that case.
73255
73342
  };
73256
73343
  this.onCellViewFocusIn = (event) => {
73257
73344
  event.stopPropagation();
73258
- this.updateFocusStateFromActiveElement(false);
73345
+ this.updateFocusStateFromActiveElement();
73259
73346
  };
73260
73347
  this.onCellFocusIn = (event) => {
73261
73348
  event.stopPropagation();
73262
73349
  const cell = event.detail;
73263
- this.updateFocusStateFromActiveElement(true);
73350
+ const row = this.updateFocusStateFromActiveElement();
73351
+ if (row) {
73352
+ if (this.hasRowOrCellFocusType()
73353
+ && this.rowIndex !== row.resolvedRowIndex) {
73354
+ this.setRowFocusState(row.resolvedRowIndex);
73355
+ }
73356
+ }
73264
73357
  // Currently, clicking a non-interactive cell only updates the focus state to that row, it
73265
73358
  // doesn't focus the cell. If we revisit this, we most likely need to set the cells to tabindex=-1
73266
73359
  // upfront too, so their focusing behavior is consistent whether they've been previously keyboard
@@ -73331,6 +73424,12 @@ focus outline in that case.
73331
73424
  }
73332
73425
  }
73333
73426
  };
73427
+ this.onPointerDown = () => {
73428
+ this.focusedViaPointer = true;
73429
+ };
73430
+ this.onPointerUpOrCancel = () => {
73431
+ this.focusedViaPointer = false;
73432
+ };
73334
73433
  this.onViewportKeyDown = (event) => {
73335
73434
  let handleEvent = !this.inNavigationMode
73336
73435
  && (event.key === keyArrowUp || event.key === keyArrowDown);
@@ -73366,6 +73465,9 @@ focus outline in that case.
73366
73465
  connect() {
73367
73466
  this.table.addEventListener('keydown', this.onCaptureKeyDown, { capture: true });
73368
73467
  this.table.addEventListener('keydown', this.onKeyDown);
73468
+ this.table.addEventListener('pointerdown', this.onPointerDown);
73469
+ this.table.addEventListener('pointerup', this.onPointerUpOrCancel);
73470
+ this.table.addEventListener('pointercancel', this.onPointerUpOrCancel);
73369
73471
  this.table.addEventListener('focusin', this.onTableFocusIn);
73370
73472
  this.table.addEventListener('focusout', this.onTableFocusOut);
73371
73473
  this.table.viewport.addEventListener('keydown', this.onViewportKeyDown);
@@ -73377,6 +73479,9 @@ focus outline in that case.
73377
73479
  disconnect() {
73378
73480
  this.table.removeEventListener('keydown', this.onCaptureKeyDown, { capture: true });
73379
73481
  this.table.removeEventListener('keydown', this.onKeyDown);
73482
+ this.table.removeEventListener('pointerdown', this.onPointerDown);
73483
+ this.table.removeEventListener('pointerup', this.onPointerUpOrCancel);
73484
+ this.table.removeEventListener('pointercancel', this.onPointerUpOrCancel);
73380
73485
  this.table.removeEventListener('focusin', this.onTableFocusIn);
73381
73486
  this.table.removeEventListener('focusout', this.onTableFocusOut);
73382
73487
  this.table.viewport.removeEventListener('keydown', this.onViewportKeyDown);
@@ -73468,6 +73573,13 @@ focus outline in that case.
73468
73573
  this.setCellActionMenuFocusState(row.resolvedRowIndex, columnIndex, false);
73469
73574
  }
73470
73575
  }
73576
+ focusSomethingOtherThanTheTable() {
73577
+ this.setDefaultFocus();
73578
+ if (this.focusType === TableFocusType.none) {
73579
+ // nothing within the table to focus
73580
+ this.table.blur();
73581
+ }
73582
+ }
73471
73583
  onEnterPressed(ctrlKey) {
73472
73584
  let row;
73473
73585
  let rowElements;
@@ -73639,7 +73751,7 @@ focus outline in that case.
73639
73751
  this.headerActionIndex = nextFocusState.headerActionIndex ?? this.headerActionIndex;
73640
73752
  this.cellContentIndex = nextFocusState.cellContentIndex ?? this.cellContentIndex;
73641
73753
  if (this.hasRowOrCellFocusType()) {
73642
- this.focusCurrentRow(false);
73754
+ this.focusCurrentRow(!this.focusedViaPointer);
73643
73755
  }
73644
73756
  else {
73645
73757
  this.focusHeaderElement();
@@ -73811,35 +73923,39 @@ focus outline in that case.
73811
73923
  }
73812
73924
  return false;
73813
73925
  }
73814
- updateFocusStateFromActiveElement(setRowFocus) {
73926
+ updateFocusStateFromActiveElement() {
73815
73927
  // If the user is interacting with the table with non-keyboard methods (like mouse), we need to
73816
73928
  // update our focus state based on the current active/focused element
73817
- const activeElement = this.getActiveElement();
73818
- if (activeElement) {
73819
- const row = this.getContainingRow(activeElement);
73820
- if (row) {
73821
- if (!(row instanceof TableGroupRow)) {
73822
- const cell = this.getContainingCell(activeElement);
73823
- if (cell) {
73824
- const columnIndex = this.table.visibleColumns.indexOf(cell.column);
73825
- if (cell.actionMenuButton === activeElement) {
73826
- this.setCellActionMenuFocusState(row.resolvedRowIndex, columnIndex, false);
73827
- return;
73828
- }
73829
- const contentIndex = cell.cellView.tabbableChildren.indexOf(activeElement);
73830
- if (contentIndex > -1) {
73831
- this.setCellContentFocusState(contentIndex, row.resolvedRowIndex, columnIndex, false);
73832
- return;
73833
- }
73834
- }
73835
- }
73836
- if (setRowFocus
73837
- && this.hasRowOrCellFocusType()
73838
- && this.rowIndex !== row.resolvedRowIndex) {
73839
- this.setRowFocusState(row.resolvedRowIndex);
73840
- }
73929
+ const { activeElement, row, cell } = this.getActiveElementCellAndRow();
73930
+ if (!cell) {
73931
+ return row;
73932
+ }
73933
+ const columnIndex = this.table.visibleColumns.indexOf(cell.column);
73934
+ if (cell.actionMenuButton === activeElement) {
73935
+ this.setCellActionMenuFocusState(row.resolvedRowIndex, columnIndex, false);
73936
+ }
73937
+ else {
73938
+ const contentIndex = cell.cellView.tabbableChildren.indexOf(activeElement);
73939
+ if (contentIndex > -1) {
73940
+ this.setCellContentFocusState(contentIndex, row.resolvedRowIndex, columnIndex, false);
73841
73941
  }
73842
73942
  }
73943
+ return row;
73944
+ }
73945
+ getActiveElementCellAndRow() {
73946
+ const activeElement = this.getActiveElement();
73947
+ if (!activeElement) {
73948
+ return {};
73949
+ }
73950
+ const row = this.getContainingRow(activeElement);
73951
+ if (!row) {
73952
+ return { activeElement };
73953
+ }
73954
+ if (row instanceof TableGroupRow) {
73955
+ return { activeElement, row };
73956
+ }
73957
+ const cell = this.getContainingCell(activeElement);
73958
+ return { activeElement, row, cell };
73843
73959
  }
73844
73960
  focusElement(element, focusOptions) {
73845
73961
  const previousActiveElement = this.getActiveElement();
@@ -73870,13 +73986,6 @@ focus outline in that case.
73870
73986
  menuButton.classList.remove('cell-action-menu-focused');
73871
73987
  }
73872
73988
  }
73873
- setFocusOnHeader() {
73874
- if (this.hasHeaderFocusType()) {
73875
- return this.focusHeaderElement();
73876
- }
73877
- this.setDefaultFocus();
73878
- return this.focusType !== TableFocusType.none;
73879
- }
73880
73989
  setDefaultFocus() {
73881
73990
  const headerElements = this.getTableHeaderFocusableElements();
73882
73991
  if (!this.trySetHeaderActionFocus(headerElements, 0)
@@ -73886,20 +73995,19 @@ focus outline in that case.
73886
73995
  }
73887
73996
  }
73888
73997
  scrollToAndFocusRow(totalRowIndex, scrollOptions) {
73889
- if (totalRowIndex >= 0 && totalRowIndex < this.table.tableData.length) {
73890
- switch (this.focusType) {
73891
- case TableFocusType.none:
73892
- case TableFocusType.headerActions:
73893
- case TableFocusType.columnHeader:
73894
- this.setRowFocusState(totalRowIndex);
73895
- break;
73896
- }
73897
- this.rowIndex = totalRowIndex;
73898
- this.virtualizer.scrollToIndex(totalRowIndex, scrollOptions);
73899
- this.focusCurrentRow(true);
73900
- return true;
73998
+ if (!this.rowIndexIsValid(totalRowIndex)) {
73999
+ return false;
73901
74000
  }
73902
- return false;
74001
+ if (!this.hasRowOrCellFocusType()) {
74002
+ this.setRowFocusState();
74003
+ }
74004
+ this.rowIndex = totalRowIndex;
74005
+ this.virtualizer.scrollToIndex(totalRowIndex, scrollOptions);
74006
+ this.focusCurrentRow(!this.focusedViaPointer);
74007
+ return true;
74008
+ }
74009
+ rowIndexIsValid(rowIndex) {
74010
+ return rowIndex >= 0 && rowIndex < this.table.tableData.length;
73903
74011
  }
73904
74012
  focusCurrentRow(allowScroll) {
73905
74013
  const visibleRowIndex = this.getCurrentRowVisibleIndex();
@@ -73967,7 +74075,7 @@ focus outline in that case.
73967
74075
  break;
73968
74076
  }
73969
74077
  if (focusableElement) {
73970
- this.focusElement(focusableElement);
74078
+ this.focusElement(focusableElement, { preventScroll: this.focusedViaPointer });
73971
74079
  return true;
73972
74080
  }
73973
74081
  return false;
@@ -74088,7 +74196,7 @@ focus outline in that case.
74088
74196
  trySetRowSelectionCheckboxFocus(rowElements) {
74089
74197
  if (rowElements?.selectionCheckbox) {
74090
74198
  this.focusType = TableFocusType.rowSelectionCheckbox;
74091
- this.focusCurrentRow(true);
74199
+ this.focusCurrentRow(!this.focusedViaPointer);
74092
74200
  return true;
74093
74201
  }
74094
74202
  return false;
@@ -74177,7 +74285,7 @@ focus outline in that case.
74177
74285
  this.rowIndex = rowIndex;
74178
74286
  this.columnIndex = columnIndex;
74179
74287
  if (focusElement) {
74180
- this.focusCurrentRow(true);
74288
+ this.focusCurrentRow(!this.focusedViaPointer);
74181
74289
  }
74182
74290
  }
74183
74291
  isResolvedRowType(row) {