@carbon/ibm-products 2.43.2-canary.65 → 2.43.2-canary.67

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 (46) hide show
  1. package/css/index-full-carbon.css +7 -4
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +107 -0
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +7 -4
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +1 -1
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +7 -4
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +1 -1
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/ConditionBuilder/ConditionBuilder.js +2 -2
  18. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +2 -2
  19. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +11 -7
  20. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +4 -3
  21. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +1 -1
  22. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +1 -1
  23. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
  24. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +49 -2
  25. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
  26. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +120 -28
  27. package/es/global/js/package-settings.d.ts +1 -1
  28. package/es/global/js/package-settings.js +1 -1
  29. package/es/settings.d.ts +1 -1
  30. package/lib/components/ConditionBuilder/ConditionBuilder.js +2 -2
  31. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +2 -2
  32. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +11 -7
  33. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +4 -3
  34. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +1 -1
  35. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +1 -1
  36. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
  37. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +49 -2
  38. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
  39. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +119 -27
  40. package/lib/global/js/package-settings.d.ts +1 -1
  41. package/lib/global/js/package-settings.js +1 -1
  42. package/lib/settings.d.ts +1 -1
  43. package/package.json +3 -3
  44. package/scss/components/ConditionBuilder/_condition-builder.scss +1 -1
  45. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +5 -3
  46. package/scss/components/_index-released-only.scss +1 -0
@@ -13,14 +13,22 @@ var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHel
13
13
  var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
14
14
  var util = require('./util.js');
15
15
 
16
- var handleKeyDown = function handleKeyDown(evt, conditionBuilderRef) {
16
+ var handleKeyDown = function handleKeyDown(evt, conditionBuilderRef, variant) {
17
17
  var activeElement = document.activeElement;
18
+ if (excludeKeyPress(evt)) {
19
+ return;
20
+ }
18
21
  if (activeElement.closest("[role=\"dialog\"]")) {
19
22
  handleKeyPressForPopover(evt, activeElement.closest("[role=\"dialog\"]"));
20
23
  } else {
21
- handleKeyPressForMainContent(evt, conditionBuilderRef);
24
+ handleKeyPressForMainContent(evt, conditionBuilderRef, variant);
22
25
  }
23
26
  };
27
+ //skipping keyboard handling for date and time fields to get take carbon's
28
+ var excludeKeyPress = function excludeKeyPress(evt) {
29
+ var _evt$target$closest, _evt$target$closest2;
30
+ return !['Escape'].includes(evt.key) && (((_evt$target$closest = evt.target.closest(".".concat(DataConfigs.blockClass, "__item-date"))) === null || _evt$target$closest === void 0 ? void 0 : _evt$target$closest.length) || ((_evt$target$closest2 = evt.target.closest(".".concat(DataConfigs.blockClass, "__item-time"))) === null || _evt$target$closest2 === void 0 ? void 0 : _evt$target$closest2.length));
31
+ };
24
32
  var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentContainer) {
25
33
  var _parentContainer$quer;
26
34
  var key = evt.key;
@@ -66,8 +74,8 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
66
74
  if (document.activeElement.type !== 'button') {
67
75
  var _document$activeEleme2;
68
76
  //for button , enter key is click which already handled by framework, else trigger click
69
- (_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 || _document$activeEleme2.click();
70
77
  util.focusThisField(evt);
78
+ (_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 || _document$activeEleme2.click();
71
79
  }
72
80
  }
73
81
  break;
@@ -77,8 +85,70 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
77
85
  break;
78
86
  }
79
87
  };
88
+ var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, conditionBuilderRef, variant) {
89
+ switch (evt.key) {
90
+ case 'ArrowRight':
91
+ evt.preventDefault();
92
+ if (variant == 'tree') {
93
+ var _evt$target$closest3;
94
+ var allCellsInRow = Array.from((_evt$target$closest3 = evt.target.closest('[role="row"]')) === null || _evt$target$closest3 === void 0 ? void 0 : _evt$target$closest3.querySelectorAll('[role="gridcell"] button'));
95
+ if (evt.target.getAttribute('role') == 'row') {
96
+ //when current focus is on a row, then we need to enter inside and focus the first cell of that row
97
+ if (allCellsInRow.length === 1) {
98
+ handleRowNavigationTree(evt, conditionBuilderRef, variant);
99
+ //focus next row
100
+ } else {
101
+ var _allCellsInRow$;
102
+ (_allCellsInRow$ = allCellsInRow[0]) === null || _allCellsInRow$ === void 0 || _allCellsInRow$.focus();
103
+ }
104
+ } else {
105
+ //finding the next cell to be focussed
106
+ //next cell = current cell index + 1
107
+
108
+ var currentItemIndex = allCellsInRow.indexOf(evt.target);
109
+ if (currentItemIndex < allCellsInRow.length - 1) {
110
+ util.focusThisItem(allCellsInRow[currentItemIndex + 1]);
111
+ }
112
+ }
113
+ } else {
114
+ handleCellNavigation(evt, conditionBuilderRef);
115
+ }
116
+ break;
117
+ case 'ArrowLeft':
118
+ evt.preventDefault();
119
+ if (variant == 'tree') {
120
+ if (evt.target.getAttribute('role') !== 'row') {
121
+ var _evt$target$closest4;
122
+ //when any cell is focussed, arrow left will select the previous cell or current row
123
+
124
+ var allItems = Array.from((_evt$target$closest4 = evt.target.closest('[role="row"]')) === null || _evt$target$closest4 === void 0 ? void 0 : _evt$target$closest4.querySelectorAll('[role="gridcell"] button'));
125
+ var _currentItemIndex = allItems.indexOf(evt.target);
126
+ if (_currentItemIndex > 0) {
127
+ util.focusThisItem(allItems[_currentItemIndex - 1]);
128
+ } else {
129
+ //focus the row
130
+ var wrapper = evt.target.closest("[role=\"row\"]");
131
+ wrapper.focus();
132
+ }
133
+ }
134
+ } else {
135
+ handleCellNavigation(evt, conditionBuilderRef);
136
+ }
137
+ break;
138
+ case 'ArrowUp':
139
+ case 'ArrowDown':
140
+ evt.preventDefault();
141
+ if (variant == 'tree') {
142
+ handleRowNavigationTree(evt, conditionBuilderRef, variant);
143
+ } else {
144
+ handleRowNavigation(evt, conditionBuilderRef, variant);
145
+ }
146
+ break;
147
+ }
148
+ };
80
149
  var getRows = function getRows(conditionBuilderRef) {
81
- return Array.from(conditionBuilderRef.current.querySelectorAll('[role="row"]'));
150
+ var _conditionBuilderRef$;
151
+ return Array.from((_conditionBuilderRef$ = conditionBuilderRef.current) === null || _conditionBuilderRef$ === void 0 ? void 0 : _conditionBuilderRef$.querySelectorAll('[role="row"]'));
82
152
  };
83
153
  var getRowIndex = function getRowIndex(element, conditionBuilderRef) {
84
154
  var rows = getRows(conditionBuilderRef);
@@ -86,14 +156,39 @@ var getRowIndex = function getRowIndex(element, conditionBuilderRef) {
86
156
  return row.contains(element);
87
157
  });
88
158
  };
89
- var handleRowNavigation = function handleRowNavigation(evt, conditionBuilderRef) {
159
+ var handleRowNavigation = function handleRowNavigation(evt, conditionBuilderRef, variant) {
90
160
  var rows = getRows(conditionBuilderRef);
91
161
  var currentRowIndex = getRowIndex(evt.target, conditionBuilderRef);
92
- navigateToNextRowCell(evt, currentRowIndex, rows);
162
+ navigateToNextRowCell(evt, currentRowIndex, rows, variant);
93
163
  };
94
- var navigateToNextRowCell = function navigateToNextRowCell(evt, currentRowIndex, rows) {
95
- var _nextRow$querySelecto;
96
- //when the focussed element is a cell of the row which has only 1 cell (connector or statement) , focus the next row
164
+ function handleRowNavigationTree(evt, conditionBuilderRef, variant) {
165
+ var rows = getRows(conditionBuilderRef);
166
+ var currentRowIndex = getRowIndex(evt.target, conditionBuilderRef);
167
+ var nextRowIndex = currentRowIndex;
168
+ if (evt.target.getAttribute('role') == 'row') {
169
+ if (['ArrowDown', 'ArrowRight'].includes(evt.key)) {
170
+ nextRowIndex += 1;
171
+ } else if (evt.key === 'ArrowUp') {
172
+ nextRowIndex -= 1;
173
+ }
174
+
175
+ //maintaining selection for first and last rows
176
+ if (nextRowIndex < 0) {
177
+ nextRowIndex = 0;
178
+ } else if (nextRowIndex >= rows.length) {
179
+ nextRowIndex = rows.length - 1;
180
+ }
181
+ if (nextRowIndex !== currentRowIndex) {
182
+ rows[currentRowIndex].setAttribute('tabindex', '-1');
183
+ rows[nextRowIndex].setAttribute('tabindex', '0');
184
+ rows[nextRowIndex].focus();
185
+ }
186
+ } else {
187
+ navigateToNextRowCell(evt, currentRowIndex, rows, variant);
188
+ }
189
+ }
190
+ var navigateToNextRowCell = function navigateToNextRowCell(evt, currentRowIndex, rows, variant) {
191
+ //when the current focussed element is a cell of any row, arrow up/down will focus the next row same cell.
97
192
 
98
193
  var nextRowIndex = currentRowIndex;
99
194
  if (evt.key === 'ArrowUp') {
@@ -104,25 +199,22 @@ var navigateToNextRowCell = function navigateToNextRowCell(evt, currentRowIndex,
104
199
  }
105
200
  var nextRow = rows[nextRowIndex];
106
201
  var itemName = evt.target.dataset.name;
107
- nextRow === null || nextRow === void 0 || (_nextRow$querySelecto = nextRow.querySelector("[data-name=\"".concat(itemName, "\"]"))) === null || _nextRow$querySelecto === void 0 || _nextRow$querySelecto.focus();
108
- };
109
- var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, conditionBuilderRef) {
110
- switch (evt.key) {
111
- case 'ArrowRight':
112
- case 'ArrowLeft':
113
- conditionBuilderRef.current.querySelectorAll("[role=\"gridcell\"] button").forEach(function (eachElem, index, allElements) {
114
- if (evt.key === 'ArrowRight') {
115
- util.traverseClockVise(eachElem, index, allElements);
116
- } else {
117
- util.traverseReverse(eachElem, index, allElements);
118
- }
119
- });
120
- break;
121
- case 'ArrowUp':
122
- case 'ArrowDown':
123
- handleRowNavigation(evt, conditionBuilderRef);
124
- break;
202
+ if (nextRow !== null && nextRow !== void 0 && nextRow.querySelector("[data-name=\"".concat(itemName, "\"]"))) {
203
+ var _nextRow$querySelecto;
204
+ nextRow === null || nextRow === void 0 || (_nextRow$querySelecto = nextRow.querySelector("[data-name=\"".concat(itemName, "\"]"))) === null || _nextRow$querySelecto === void 0 || _nextRow$querySelecto.focus();
205
+ } else if (variant === 'tree') {
206
+ //when the next row is a if statement , then that row is focused. From any cell of last row of an group , arrow down select the next row (if)
207
+ nextRow === null || nextRow === void 0 || nextRow.focus();
125
208
  }
126
209
  };
210
+ var handleCellNavigation = function handleCellNavigation(evt, conditionBuilderRef) {
211
+ conditionBuilderRef.current.querySelectorAll("[role=\"gridcell\"] button").forEach(function (eachElem, index, allElements) {
212
+ if (evt.key === 'ArrowRight') {
213
+ util.traverseClockVise(eachElem, index, allElements);
214
+ } else {
215
+ util.traverseReverse(eachElem, index, allElements);
216
+ }
217
+ });
218
+ };
127
219
 
128
220
  exports.handleKeyDown = handleKeyDown;
@@ -39,6 +39,7 @@ declare namespace defaults {
39
39
  let ErrorEmptyState: boolean;
40
40
  let ExportModal: boolean;
41
41
  let ExpressiveCard: boolean;
42
+ let FullPageError: boolean;
42
43
  let HTTPError403: boolean;
43
44
  let HTTPError404: boolean;
44
45
  let HTTPErrorOther: boolean;
@@ -80,7 +81,6 @@ declare namespace defaults {
80
81
  let BigNumbers: boolean;
81
82
  let TruncatedList: boolean;
82
83
  let DelimitedList: boolean;
83
- let FullPageError: boolean;
84
84
  let ScrollGradient: boolean;
85
85
  let StringFormatter: boolean;
86
86
  let StatusIndicator: boolean;
@@ -41,6 +41,7 @@ var defaults = {
41
41
  ErrorEmptyState: true,
42
42
  ExportModal: true,
43
43
  ExpressiveCard: true,
44
+ FullPageError: true,
44
45
  HTTPError403: true,
45
46
  HTTPError404: true,
46
47
  HTTPErrorOther: true,
@@ -83,7 +84,6 @@ var defaults = {
83
84
  BigNumbers: false,
84
85
  TruncatedList: false,
85
86
  DelimitedList: false,
86
- FullPageError: false,
87
87
  ScrollGradient: false,
88
88
  StringFormatter: false,
89
89
  StatusIndicator: false,
package/lib/settings.d.ts CHANGED
@@ -25,6 +25,7 @@ export const pkg: {
25
25
  ErrorEmptyState: boolean;
26
26
  ExportModal: boolean;
27
27
  ExpressiveCard: boolean;
28
+ FullPageError: boolean;
28
29
  HTTPError403: boolean;
29
30
  HTTPError404: boolean;
30
31
  HTTPErrorOther: boolean;
@@ -66,7 +67,6 @@ export const pkg: {
66
67
  BigNumbers: boolean;
67
68
  TruncatedList: boolean;
68
69
  DelimitedList: boolean;
69
- FullPageError: boolean;
70
70
  ScrollGradient: boolean;
71
71
  StringFormatter: boolean;
72
72
  StatusIndicator: boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products",
3
3
  "description": "Carbon for IBM Products",
4
- "version": "2.43.2-canary.65+6850586b7",
4
+ "version": "2.43.2-canary.67+ebeb82381",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -96,7 +96,7 @@
96
96
  "dependencies": {
97
97
  "@babel/runtime": "^7.23.9",
98
98
  "@carbon/feature-flags": "^0.20.0",
99
- "@carbon/ibm-products-styles": "^2.40.0-rc.2",
99
+ "@carbon/ibm-products-styles": "^2.39.1-canary.77+ebeb82381",
100
100
  "@carbon/telemetry": "^0.1.0",
101
101
  "@dnd-kit/core": "^6.0.8",
102
102
  "@dnd-kit/modifiers": "^7.0.0",
@@ -120,5 +120,5 @@
120
120
  "react": "^16.8.6 || ^17.0.1 || ^18.2.0",
121
121
  "react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
122
122
  },
123
- "gitHead": "6850586b76bb36f66bdc2fd82b2256f9d089a337"
123
+ "gitHead": "ebeb8238145ca36520ee38985e70a060db997ab7"
124
124
  }
@@ -49,7 +49,7 @@ $block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
49
49
  }
50
50
  .#{$block-class}__condition-block {
51
51
  display: flex;
52
- width: max-content;
52
+ width: fit-content;
53
53
  flex-direction: row;
54
54
  }
55
55
  .#{$block-class}__content-container {
@@ -216,7 +216,7 @@ $colors: (
216
216
  > :nth-child(2)
217
217
  .#{$block-class}__button:not(
218
218
  .#{$block-class}__add-button,
219
- .#{$block-class}__add_condition_group
219
+ .#{$block-class}__add-condition-sub-group
220
220
  ) {
221
221
  /* stylelint-disable-next-line carbon/theme-token-use */
222
222
  box-shadow: inset 0 #{$spacing-01} 0 0 var(--#{$block-class}__condition-wrapper-color);
@@ -234,7 +234,7 @@ $colors: (
234
234
  align-self: center;
235
235
  margin-left: auto;
236
236
  }
237
- .#{$block-class}__add_condition_group-wrapper {
237
+ .#{$block-class}__add-condition-sub-group-wrapper {
238
238
  z-index: -1;
239
239
  width: 0;
240
240
  margin-left: -50%;
@@ -243,7 +243,7 @@ $colors: (
243
243
  // stylelint-disable-next-line carbon/motion-duration-use, carbon/motion-easing-use
244
244
  transition: all linear $duration-fast-02;
245
245
  }
246
- .#{$block-class}__add_condition_group-wrapper--show {
246
+ .#{$block-class}__add-condition-sub-group-wrapper--show {
247
247
  z-index: 0;
248
248
  width: auto;
249
249
  margin-left: 0;
@@ -254,5 +254,7 @@ $colors: (
254
254
  }
255
255
  .#{$block-class}__invalid-input {
256
256
  display: flex;
257
+ }
258
+ .#{$block-class}__invalid-input > svg {
257
259
  color: $support-warning;
258
260
  }
@@ -23,6 +23,7 @@
23
23
  @use './EmptyStates';
24
24
  @use './ExportModal';
25
25
  @use './ExpressiveCard';
26
+ @use './FullPageError';
26
27
  @use './HTTPErrors';
27
28
  @use './ImportModal';
28
29
  @use './MultiAddSelect';