@carbon/ibm-products 2.43.2-canary.63 → 2.43.2-canary.66
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.
- package/css/index-full-carbon.css +7 -4
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon.css +7 -4
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +7 -4
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/ConditionBuilder/ConditionBuilder.js +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +11 -7
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +4 -3
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +49 -2
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +120 -28
- package/es/components/EditTearsheet/EditTearsheet.d.ts +2 -1
- package/es/components/EditTearsheet/EditTearsheet.js +44 -9
- package/es/components/SearchBar/SearchBar.d.ts +1 -1
- package/es/components/SearchBar/SearchBar.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilder.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +11 -7
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +4 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +49 -2
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +119 -27
- package/lib/components/EditTearsheet/EditTearsheet.d.ts +2 -1
- package/lib/components/EditTearsheet/EditTearsheet.js +43 -8
- package/lib/components/SearchBar/SearchBar.d.ts +1 -1
- package/lib/components/SearchBar/SearchBar.js +2 -2
- package/package.json +3 -3
- package/scss/components/ConditionBuilder/_condition-builder.scss +1 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +5 -3
@@ -59,8 +59,9 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
59
59
|
showConditionSubGroupPreview = _useState4[0],
|
60
60
|
setShowConditionSubGroupPreview = _useState4[1];
|
61
61
|
var conditionBuilderContentRef = React.useRef();
|
62
|
-
var onRemoveHandler = function onRemoveHandler(conditionId, evt) {
|
62
|
+
var onRemoveHandler = function onRemoveHandler(conditionId, evt, conditionIndex) {
|
63
63
|
if (group.conditions.length > 1) {
|
64
|
+
variant == 'tree' ? handleFocusOnCloseTree(evt) : handleFocusOnClose(evt, conditionIndex);
|
64
65
|
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
65
66
|
conditions: group.conditions.filter(function (condition) {
|
66
67
|
return conditionId !== condition.id;
|
@@ -88,6 +89,52 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
88
89
|
conditions: [].concat(_rollupPluginBabelHelpers.toConsumableArray(group.conditions.slice(0, conditionIndex + 1)), [newCondition], _rollupPluginBabelHelpers.toConsumableArray(group.conditions.slice(conditionIndex + 1)))
|
89
90
|
}));
|
90
91
|
};
|
92
|
+
var handleFocusOnClose = function handleFocusOnClose(e, conditionIndex) {
|
93
|
+
var _e$currentTarget$clos;
|
94
|
+
//get all close buttons.
|
95
|
+
//if the last condition is closing, focus the second last one.
|
96
|
+
//or focus the next one.
|
97
|
+
var currentGroupCloseButtons = (_e$currentTarget$clos = e.currentTarget.closest(".".concat(DataConfigs.blockClass, "__group"))) === null || _e$currentTarget$clos === void 0 ? void 0 : _e$currentTarget$clos.querySelectorAll('[data-name="closeCondition"]');
|
98
|
+
if (conditionIndex == currentGroupCloseButtons.length - 1) {
|
99
|
+
var _currentGroupCloseBut;
|
100
|
+
(_currentGroupCloseBut = currentGroupCloseButtons[conditionIndex - 1]) === null || _currentGroupCloseBut === void 0 || _currentGroupCloseBut.focus();
|
101
|
+
} else {
|
102
|
+
var _currentGroupCloseBut2;
|
103
|
+
(_currentGroupCloseBut2 = currentGroupCloseButtons[conditionIndex + 1]) === null || _currentGroupCloseBut2 === void 0 || _currentGroupCloseBut2.focus();
|
104
|
+
}
|
105
|
+
};
|
106
|
+
var handleFocusOnCloseTree = function handleFocusOnCloseTree(evt) {
|
107
|
+
var _evt$currentTarget, _evt$currentTarget2, _conditionBuilderCont, _conditionBuilderCont2;
|
108
|
+
//getting the current aria-level and aria-posinset.
|
109
|
+
var currentLevel = (_evt$currentTarget = evt.currentTarget) === null || _evt$currentTarget === void 0 || (_evt$currentTarget = _evt$currentTarget.closest('[role="row"]')) === null || _evt$currentTarget === void 0 ? void 0 : _evt$currentTarget.getAttribute('aria-level');
|
110
|
+
var currentPos = (_evt$currentTarget2 = evt.currentTarget) === null || _evt$currentTarget2 === void 0 || (_evt$currentTarget2 = _evt$currentTarget2.closest('[role="row"]')) === null || _evt$currentTarget2 === void 0 ? void 0 : _evt$currentTarget2.getAttribute('aria-posinset');
|
111
|
+
|
112
|
+
//finding the next and previous items in same level
|
113
|
+
var nextElement = (_conditionBuilderCont = conditionBuilderContentRef.current) === null || _conditionBuilderCont === void 0 ? void 0 : _conditionBuilderCont.querySelector("[aria-level=\"".concat(currentLevel, "\"][aria-posinset=\"").concat(Number(currentPos) + 1, "\"]"));
|
114
|
+
var prevElement = (_conditionBuilderCont2 = conditionBuilderContentRef.current) === null || _conditionBuilderCont2 === void 0 ? void 0 : _conditionBuilderCont2.querySelector("[aria-level=\"".concat(currentLevel, "\"][aria-posinset=\"").concat(Number(currentPos) - 1, "\"]"));
|
115
|
+
//checking if next level is a valid condition. If then, focus the close button inside that condition
|
116
|
+
//Otherwise , check the previous item is a valid condition
|
117
|
+
|
118
|
+
if (nextElement !== null && nextElement !== void 0 && nextElement.classList.contains("".concat(DataConfigs.blockClass, "__condition-block"))) {
|
119
|
+
var _nextElement$querySel;
|
120
|
+
nextElement === null || nextElement === void 0 || (_nextElement$querySel = nextElement.querySelector('[data-name="closeCondition"]')) === null || _nextElement$querySel === void 0 || _nextElement$querySel.focus();
|
121
|
+
} else if (prevElement !== null && prevElement !== void 0 && prevElement.classList.contains("".concat(DataConfigs.blockClass, "__condition-block"))) {
|
122
|
+
var _prevElement$querySel;
|
123
|
+
prevElement === null || prevElement === void 0 || (_prevElement$querySel = prevElement.querySelector('[data-name="closeCondition"]')) === null || _prevElement$querySel === void 0 || _prevElement$querySel.focus();
|
124
|
+
}
|
125
|
+
//If there are no valid condition in this group, focus next or previous row
|
126
|
+
else {
|
127
|
+
var _conditionBuilderCont3, _conditionBuilderCont4;
|
128
|
+
var prevRows = (_conditionBuilderCont3 = conditionBuilderContentRef.current) === null || _conditionBuilderCont3 === void 0 ? void 0 : _conditionBuilderCont3.querySelectorAll("[aria-level=\"".concat(Number(currentLevel) - 1, "\"][role=\"row\"]"));
|
129
|
+
var nextRow = (_conditionBuilderCont4 = conditionBuilderContentRef.current) === null || _conditionBuilderCont4 === void 0 ? void 0 : _conditionBuilderCont4.querySelector("[aria-level=\"".concat(Number(currentLevel) + 1, "\"][role=\"row\"]"));
|
130
|
+
if (nextRow) {
|
131
|
+
nextRow === null || nextRow === void 0 || nextRow.focus();
|
132
|
+
} else if ((prevRows === null || prevRows === void 0 ? void 0 : prevRows.length) > 1) {
|
133
|
+
var _prevRows;
|
134
|
+
(_prevRows = prevRows[prevRows.length - 2]) === null || _prevRows === void 0 || _prevRows.focus();
|
135
|
+
}
|
136
|
+
}
|
137
|
+
};
|
91
138
|
var addConditionSubGroupHandler = function addConditionSubGroupHandler(conditionIndex) {
|
92
139
|
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
93
140
|
conditions: [].concat(_rollupPluginBabelHelpers.toConsumableArray(group.conditions.slice(0, conditionIndex + 1)), [{
|
@@ -162,7 +209,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
162
209
|
},
|
163
210
|
addConditionHandler: addConditionHandler,
|
164
211
|
onRemove: function onRemove(e) {
|
165
|
-
onRemoveHandler(eachCondition.id, e);
|
212
|
+
onRemoveHandler(eachCondition.id, e, conditionIndex);
|
166
213
|
},
|
167
214
|
onConnectorOperatorChange: onConnectorOperatorChange,
|
168
215
|
onStatementChange: onStatementChangeHandler,
|
@@ -1 +1 @@
|
|
1
|
-
export function handleKeyDown(evt: any, conditionBuilderRef: any): void;
|
1
|
+
export function handleKeyDown(evt: any, conditionBuilderRef: any, variant: any): void;
|
@@ -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
|
-
|
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
|
-
|
95
|
-
var
|
96
|
-
|
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
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
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;
|
@@ -51,7 +51,8 @@ interface EditTearsheetProps extends PropsWithChildren {
|
|
51
51
|
*/
|
52
52
|
onFormChange?: (formIndex: number) => number;
|
53
53
|
/**
|
54
|
-
* Specify a handler for submitting the tearsheet.
|
54
|
+
* Specify a handler for submitting the tearsheet. Throughout its execution
|
55
|
+
* the submit button will be disabled and include a loading indicator.
|
55
56
|
*/
|
56
57
|
onRequestSubmit: () => void;
|
57
58
|
/**
|
@@ -68,10 +68,45 @@ exports.EditTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
68
68
|
_ref$sideNavAriaLabel = _ref.sideNavAriaLabel,
|
69
69
|
sideNavAriaLabel = _ref$sideNavAriaLabel === void 0 ? defaults.sideNavAriaLabel : _ref$sideNavAriaLabel,
|
70
70
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
71
|
+
var _useState = React.useState(false),
|
72
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
73
|
+
isSubmitting = _useState2[0],
|
74
|
+
setIsSubmitting = _useState2[1];
|
75
|
+
var handleOnRequestSubmit = /*#__PURE__*/function () {
|
76
|
+
var _ref2 = _rollupPluginBabelHelpers.asyncToGenerator( /*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee() {
|
77
|
+
return _rollupPluginBabelHelpers.regeneratorRuntime().wrap(function _callee$(_context) {
|
78
|
+
while (1) switch (_context.prev = _context.next) {
|
79
|
+
case 0:
|
80
|
+
setIsSubmitting(true);
|
81
|
+
_context.prev = 1;
|
82
|
+
_context.next = 4;
|
83
|
+
return onRequestSubmit();
|
84
|
+
case 4:
|
85
|
+
_context.next = 9;
|
86
|
+
break;
|
87
|
+
case 6:
|
88
|
+
_context.prev = 6;
|
89
|
+
_context.t0 = _context["catch"](1);
|
90
|
+
console.warn("".concat(componentName, " submit error: ").concat(_context.t0));
|
91
|
+
case 9:
|
92
|
+
setIsSubmitting(false);
|
93
|
+
case 10:
|
94
|
+
case "end":
|
95
|
+
return _context.stop();
|
96
|
+
}
|
97
|
+
}, _callee, null, [[1, 6]]);
|
98
|
+
}));
|
99
|
+
return function handleOnRequestSubmit() {
|
100
|
+
return _ref2.apply(this, arguments);
|
101
|
+
};
|
102
|
+
}();
|
71
103
|
var actions = [{
|
72
104
|
key: 'edit-action-button-submit',
|
73
105
|
label: submitButtonText,
|
74
|
-
onClick:
|
106
|
+
onClick: function onClick() {
|
107
|
+
return handleOnRequestSubmit();
|
108
|
+
},
|
109
|
+
loading: isSubmitting,
|
75
110
|
kind: 'primary'
|
76
111
|
}, {
|
77
112
|
key: 'edit-action-button-cancel',
|
@@ -79,14 +114,14 @@ exports.EditTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
79
114
|
onClick: onClose,
|
80
115
|
kind: 'ghost'
|
81
116
|
}];
|
82
|
-
var
|
83
|
-
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
84
|
-
currentForm = _useState2[0],
|
85
|
-
setCurrentForm = _useState2[1];
|
86
|
-
var _useState3 = React.useState([]),
|
117
|
+
var _useState3 = React.useState(0),
|
87
118
|
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
88
|
-
|
89
|
-
|
119
|
+
currentForm = _useState4[0],
|
120
|
+
setCurrentForm = _useState4[1];
|
121
|
+
var _useState5 = React.useState([]),
|
122
|
+
_useState6 = _rollupPluginBabelHelpers.slicedToArray(_useState5, 2),
|
123
|
+
formTitles = _useState6[0],
|
124
|
+
setFormTitles = _useState6[1];
|
90
125
|
var contentRef = React.useRef(null);
|
91
126
|
var handleCurrentForm = function handleCurrentForm(formIndex) {
|
92
127
|
setCurrentForm(formIndex);
|
@@ -17,7 +17,7 @@ interface SearchBarProps extends PropsWithChildren {
|
|
17
17
|
*/
|
18
18
|
hideScopesLabel?: boolean;
|
19
19
|
/** @type {string} The label text for the search text input. */
|
20
|
-
labelText
|
20
|
+
labelText: string;
|
21
21
|
/** @type {Function} Function handler for when the user changes their query search. */
|
22
22
|
onChange?: (event: any) => void;
|
23
23
|
/** @type {Function} Function handler for when the user submits a search. */
|
@@ -144,7 +144,7 @@ exports.SearchBar = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
144
144
|
})) : null, /*#__PURE__*/React__default["default"].createElement(react.Search, {
|
145
145
|
className: "".concat(blockClass, "__input"),
|
146
146
|
closeButtonLabelText: clearButtonLabelText,
|
147
|
-
labelText: labelText
|
147
|
+
labelText: labelText,
|
148
148
|
name: "search-input",
|
149
149
|
onChange: handleInputChange,
|
150
150
|
placeholder: placeholderText,
|
@@ -197,7 +197,7 @@ exports.SearchBar.propTypes = _rollupPluginBabelHelpers.objectSpread2({
|
|
197
197
|
*/
|
198
198
|
hideScopesLabel: index["default"].bool,
|
199
199
|
/** @type {string} The label text for the search text input. */
|
200
|
-
labelText: index["default"].string,
|
200
|
+
labelText: index["default"].string.isRequired,
|
201
201
|
/** @type {Function} Function handler for when the user changes their query search. */
|
202
202
|
onChange: index["default"].func,
|
203
203
|
/** @type {Function} Function handler for when the user submits a search. */
|
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.
|
4
|
+
"version": "2.43.2-canary.66+2df7a1428",
|
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.39.1-canary.
|
99
|
+
"@carbon/ibm-products-styles": "^2.39.1-canary.76+2df7a1428",
|
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": "
|
123
|
+
"gitHead": "2df7a14288468af06ff51086047d3531832e4427"
|
124
124
|
}
|
@@ -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}
|
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}
|
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}
|
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
|
}
|