@carbon/ibm-products 1.41.0 → 1.41.2
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +21 -65
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +2 -2
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +1 -0
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +21 -65
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +2 -2
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +21 -65
- package/css/index.css.map +1 -1
- package/css/index.min.css +2 -2
- package/css/index.min.css.map +1 -1
- package/es/components/APIKeyModal/APIKeyDownloader.js +21 -23
- package/es/components/APIKeyModal/APIKeyModal.js +43 -45
- package/es/components/AddSelect/AddSelectBody.js +1 -1
- package/es/components/AddSelect/hooks/usePath.js +7 -1
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +1 -1
- package/es/components/ButtonMenu/ButtonMenu.js +4 -2
- package/es/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +1 -1
- package/es/components/CreateFullPage/CreateFullPage.js +8 -2
- package/es/components/CreateTearsheet/CreateTearsheet.js +8 -2
- package/es/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +4 -2
- package/es/components/Datagrid/Datagrid/DatagridContent.js +10 -3
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +7 -9
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +11 -13
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +26 -24
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/{CustomizeColumnsModal.js → CustomizeColumnsTearsheet.js} +32 -32
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +51 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/index.js +6 -7
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +6 -4
- package/es/components/Datagrid/useCustomizeColumns.js +13 -15
- package/es/components/Datagrid/utils/getInlineEditColumns.js +1 -0
- package/es/components/Datagrid/utils/makeData.js +1 -1
- package/es/components/ImportModal/ImportModal.js +42 -44
- package/es/components/index.js +1 -1
- package/es/global/js/hooks/useCreateComponentFocus.js +31 -10
- package/es/global/js/hooks/useCreateComponentStepChange.js +73 -79
- package/es/global/js/utils/test-helper.js +12 -14
- package/es/global/js/utils/unwrap-if-fragment.js +1 -1
- package/lib/components/APIKeyModal/APIKeyDownloader.js +21 -23
- package/lib/components/APIKeyModal/APIKeyModal.js +43 -45
- package/lib/components/AddSelect/AddSelectBody.js +1 -1
- package/lib/components/AddSelect/hooks/usePath.js +6 -0
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +1 -1
- package/lib/components/ButtonMenu/ButtonMenu.js +4 -2
- package/lib/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +1 -1
- package/lib/components/CreateFullPage/CreateFullPage.js +8 -2
- package/lib/components/CreateTearsheet/CreateTearsheet.js +8 -2
- package/lib/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +4 -2
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +10 -3
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +7 -9
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +6 -6
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +26 -24
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/{CustomizeColumnsModal.js → CustomizeColumnsTearsheet.js} +26 -25
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/{ModalWrapper.js → TearsheetWrapper.js} +30 -33
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/index.js +3 -3
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +6 -4
- package/lib/components/Datagrid/useCustomizeColumns.js +7 -7
- package/lib/components/Datagrid/utils/getInlineEditColumns.js +1 -0
- package/lib/components/Datagrid/utils/makeData.js +1 -1
- package/lib/components/ImportModal/ImportModal.js +42 -44
- package/lib/components/index.js +6 -0
- package/lib/global/js/hooks/useCreateComponentFocus.js +32 -10
- package/lib/global/js/hooks/useCreateComponentStepChange.js +73 -79
- package/lib/global/js/utils/test-helper.js +12 -14
- package/lib/global/js/utils/unwrap-if-fragment.js +1 -1
- package/package.json +10 -10
- package/scss/components/Datagrid/styles/_datagrid.scss +5 -0
- package/scss/components/Datagrid/styles/_draggableElement.scss +9 -8
- package/scss/components/Datagrid/styles/_index.scss +8 -8
- package/scss/components/Datagrid/styles/addons/_CustomizeColumnsTearsheet.scss +60 -0
- package/scss/components/Tearsheet/_tearsheet.scss +2 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +0 -56
- package/scss/components/Datagrid/styles/addons/_CustomizeColumnsModal.scss +0 -86
@@ -0,0 +1,51 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
+
var _excluded = ["onSaveColumnPrefs", "isTearsheetOpen", "setIsTearsheetOpen", "labels"];
|
4
|
+
/**
|
5
|
+
* Copyright IBM Corp. 2022, 2022
|
6
|
+
*
|
7
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
9
|
+
*/
|
10
|
+
|
11
|
+
import * as React from 'react';
|
12
|
+
import PropTypes from 'prop-types';
|
13
|
+
import CustomizeColumnsTearsheet from './CustomizeColumnsTearsheet';
|
14
|
+
var TearsheetWrapper = function TearsheetWrapper(_ref) {
|
15
|
+
var instance = _ref.instance;
|
16
|
+
var _instance$customizeCo = instance.customizeColumnsProps,
|
17
|
+
_onSaveColumnPrefs = _instance$customizeCo.onSaveColumnPrefs,
|
18
|
+
isTearsheetOpen = _instance$customizeCo.isTearsheetOpen,
|
19
|
+
setIsTearsheetOpen = _instance$customizeCo.setIsTearsheetOpen,
|
20
|
+
labels = _instance$customizeCo.labels,
|
21
|
+
rest = _objectWithoutProperties(_instance$customizeCo, _excluded);
|
22
|
+
return /*#__PURE__*/React.createElement(CustomizeColumnsTearsheet, _extends({}, rest, labels, {
|
23
|
+
isOpen: isTearsheetOpen,
|
24
|
+
setIsTearsheetOpen: setIsTearsheetOpen,
|
25
|
+
columnDefinitions: instance.allColumns,
|
26
|
+
originalColumnDefinitions: instance.columns,
|
27
|
+
onSaveColumnPrefs: function onSaveColumnPrefs(updatedColDefs) {
|
28
|
+
var hiddenIds = updatedColDefs.filter(function (colDef) {
|
29
|
+
return !colDef.isVisible;
|
30
|
+
}).map(function (colDef) {
|
31
|
+
return colDef.id;
|
32
|
+
});
|
33
|
+
instance.setHiddenColumns(hiddenIds);
|
34
|
+
if (typeof instance.setColumnOrder === 'function') {
|
35
|
+
instance.setColumnOrder(updatedColDefs.map(function (colDef) {
|
36
|
+
return colDef.id;
|
37
|
+
}));
|
38
|
+
} else {
|
39
|
+
// eslint-disable-next-line no-console
|
40
|
+
console.warn("Column order can not be updated. Did you forget to add 'useColumnOrder' in 'useDatagrid'");
|
41
|
+
}
|
42
|
+
if (typeof _onSaveColumnPrefs === 'function') {
|
43
|
+
_onSaveColumnPrefs(updatedColDefs);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}));
|
47
|
+
};
|
48
|
+
TearsheetWrapper.propTypes = {
|
49
|
+
instance: PropTypes.object.isRequired
|
50
|
+
};
|
51
|
+
export default TearsheetWrapper;
|
@@ -1,10 +1,9 @@
|
|
1
|
-
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
5
|
-
*
|
6
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2022, 2022
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
7
6
|
*/
|
8
7
|
|
9
|
-
export { default as
|
8
|
+
export { default as CustomizeColumnsTearsheetWrapper } from './TearsheetWrapper';
|
10
9
|
export { default as ToggleButtonWrapper } from './ButtonWrapper';
|
@@ -360,18 +360,20 @@ export var InlineEditCell = function InlineEditCell(_ref) {
|
|
360
360
|
return num.toString().padStart(2, '0');
|
361
361
|
};
|
362
362
|
var buildDate = function buildDate(value) {
|
363
|
+
var _config$inputProps2;
|
364
|
+
var dateFormat = config === null || config === void 0 ? void 0 : (_config$inputProps2 = config.inputProps) === null || _config$inputProps2 === void 0 ? void 0 : _config$inputProps2.dateFormat;
|
363
365
|
if (value instanceof Date) {
|
364
|
-
var _config$dateFormat = config.dateFormat,
|
365
|
-
dateFormat = _config$dateFormat === void 0 ? 'm/d/Y' : _config$dateFormat;
|
366
366
|
var maskedFullYear = value.getFullYear();
|
367
367
|
var maskedMonth = padTo2Digits(value.getMonth() + 1);
|
368
368
|
var maskedDay = padTo2Digits(value.getDate());
|
369
|
-
if (dateFormat === 'm/d/Y' ||
|
369
|
+
if (dateFormat === 'm/d/Y' || value === 'm/d/y') {
|
370
370
|
return [maskedMonth, maskedDay, maskedFullYear].join('/');
|
371
371
|
}
|
372
|
-
if (dateFormat === 'd/m/Y' || dateFormat === 'd/m/y') {
|
372
|
+
if (dateFormat === 'd/m/Y' || dateFormat === 'd/m/y' || dateFormat === undefined) {
|
373
373
|
return [maskedDay, maskedMonth, maskedFullYear].join('/');
|
374
374
|
}
|
375
|
+
} else {
|
376
|
+
return value;
|
375
377
|
}
|
376
378
|
return null;
|
377
379
|
};
|
@@ -3,39 +3,37 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
4
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
6
|
-
|
7
|
-
|
8
|
-
*
|
9
|
-
*
|
10
|
-
*
|
11
|
-
* US Government Users Restricted Rights - Use, duplication or disclosure
|
12
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
6
|
+
/**
|
7
|
+
* Copyright IBM Corp. 2022, 2022
|
8
|
+
*
|
9
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
13
11
|
*/
|
14
12
|
|
15
13
|
import * as React from 'react';
|
16
|
-
import {
|
14
|
+
import { CustomizeColumnsTearsheetWrapper, ToggleButtonWrapper } from './Datagrid/addons/CustomizeColumns';
|
17
15
|
var useCustomizeColumns = function useCustomizeColumns(hooks) {
|
18
16
|
var _React$useState = React.useState(false),
|
19
17
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
20
|
-
|
21
|
-
|
18
|
+
isTearsheetOpen = _React$useState2[0],
|
19
|
+
setIsTearsheetOpen = _React$useState2[1];
|
22
20
|
hooks.useInstance.push(function (instance) {
|
23
21
|
var customizeColumnsProps = instance.customizeColumnsProps;
|
24
22
|
var _ref = customizeColumnsProps || {},
|
25
23
|
labels = _ref.labels;
|
26
24
|
Object.assign(instance, {
|
27
25
|
customizeColumnsProps: _objectSpread(_objectSpread({}, customizeColumnsProps), {}, {
|
28
|
-
|
29
|
-
|
26
|
+
isTearsheetOpen: isTearsheetOpen,
|
27
|
+
setIsTearsheetOpen: setIsTearsheetOpen
|
30
28
|
}),
|
31
29
|
CustomizeColumnsButton: function CustomizeColumnsButton(props) {
|
32
30
|
return /*#__PURE__*/React.createElement(ToggleButtonWrapper, _extends({
|
33
31
|
iconTooltipLabel: labels === null || labels === void 0 ? void 0 : labels.iconTooltipLabel,
|
34
|
-
|
35
|
-
|
32
|
+
isTearsheetOpen: isTearsheetOpen,
|
33
|
+
setIsTearsheetOpen: setIsTearsheetOpen
|
36
34
|
}, props));
|
37
35
|
},
|
38
|
-
|
36
|
+
CustomizeColumnsTearsheet: CustomizeColumnsTearsheetWrapper
|
39
37
|
});
|
40
38
|
});
|
41
39
|
};
|
@@ -93,6 +93,7 @@ export var getInlineEditColumns = function getInlineEditColumns() {
|
|
93
93
|
console.log(newDateObj, cell);
|
94
94
|
},
|
95
95
|
labelText: 'Change active since date',
|
96
|
+
dateFormat: 'd/m/Y',
|
96
97
|
// optionally pass props here to be passed through to Carbon's DatePickerInput component
|
97
98
|
datePickerInputProps: {
|
98
99
|
labelText: 'Change active since date'
|
@@ -166,7 +166,7 @@ var newPerson = function newPerson() {
|
|
166
166
|
numbers: 0
|
167
167
|
}),
|
168
168
|
chartType: initialChartTypeIndex === 0 ? inlineEditSelectItems[0] : initialChartTypeIndex === 1 ? inlineEditSelectItems[1] : inlineEditSelectItems[2],
|
169
|
-
activeSince: activeChance > 0.66 ? activeSinceDate : activeChance > 0.33 ? yesterdayDate :
|
169
|
+
activeSince: activeChance > 0.66 ? activeSinceDate : activeChance > 0.33 ? yesterdayDate : '23/05/2020',
|
170
170
|
bonus: "$\r".concat(getRandomInteger(100, 500, 2)),
|
171
171
|
passwordStrength: getPasswordStrength(),
|
172
172
|
doc_link: renderDocLink()
|
@@ -111,51 +111,49 @@ export var ImportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
111
111
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(evt) {
|
112
112
|
var fileName, pendingFile, response, blob, fetchedFile, failedFile;
|
113
113
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
114
|
-
while (1) {
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
_context.next = 10;
|
132
|
-
break;
|
133
|
-
}
|
134
|
-
throw new Error(response.status);
|
135
|
-
case 10:
|
136
|
-
_context.next = 12;
|
137
|
-
return response.blob();
|
138
|
-
case 12:
|
139
|
-
blob = _context.sent;
|
140
|
-
fetchedFile = new File([blob], fileName, {
|
141
|
-
type: blob.type
|
142
|
-
});
|
143
|
-
fetchedFile.invalidFileType = isInvalidFileType(fetchedFile);
|
144
|
-
fetchedFile.uuid = pendingFile.uuid;
|
145
|
-
updateFiles([fetchedFile]);
|
146
|
-
_context.next = 23;
|
114
|
+
while (1) switch (_context.prev = _context.next) {
|
115
|
+
case 0:
|
116
|
+
evt.preventDefault();
|
117
|
+
fileName = importUrl.substring(importUrl.lastIndexOf('/') + 1).split('?')[0];
|
118
|
+
pendingFile = {
|
119
|
+
name: fileName,
|
120
|
+
status: 'uploading',
|
121
|
+
uuid: uuidv4()
|
122
|
+
};
|
123
|
+
setFiles([pendingFile]);
|
124
|
+
_context.prev = 4;
|
125
|
+
_context.next = 7;
|
126
|
+
return fetch(importUrl);
|
127
|
+
case 7:
|
128
|
+
response = _context.sent;
|
129
|
+
if (!(!response.ok || response.status !== 200)) {
|
130
|
+
_context.next = 10;
|
147
131
|
break;
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
132
|
+
}
|
133
|
+
throw new Error(response.status);
|
134
|
+
case 10:
|
135
|
+
_context.next = 12;
|
136
|
+
return response.blob();
|
137
|
+
case 12:
|
138
|
+
blob = _context.sent;
|
139
|
+
fetchedFile = new File([blob], fileName, {
|
140
|
+
type: blob.type
|
141
|
+
});
|
142
|
+
fetchedFile.invalidFileType = isInvalidFileType(fetchedFile);
|
143
|
+
fetchedFile.uuid = pendingFile.uuid;
|
144
|
+
updateFiles([fetchedFile]);
|
145
|
+
_context.next = 23;
|
146
|
+
break;
|
147
|
+
case 19:
|
148
|
+
_context.prev = 19;
|
149
|
+
_context.t0 = _context["catch"](4);
|
150
|
+
failedFile = _objectSpread(_objectSpread({}, pendingFile), {}, {
|
151
|
+
fetchError: true
|
152
|
+
});
|
153
|
+
updateFiles([failedFile]);
|
154
|
+
case 23:
|
155
|
+
case "end":
|
156
|
+
return _context.stop();
|
159
157
|
}
|
160
158
|
}, _callee, null, [[4, 19]]);
|
161
159
|
}));
|
package/es/components/index.js
CHANGED
@@ -37,7 +37,7 @@ export { WebTerminal, WebTerminalContentWrapper, useWebTerminal, WebTerminalProv
|
|
37
37
|
export { EditSidePanel } from './EditSidePanel';
|
38
38
|
export { OptionsTile } from './OptionsTile';
|
39
39
|
export { DataSpreadsheet } from './DataSpreadsheet';
|
40
|
-
export { Datagrid, useDatagrid, useInfiniteScroll, useNestedRows, useSelectRows, useExpandedRow, useOnRowClick, useSortableColumns, useRowIsMouseOver, useColumnRightAlign, useDisableSelectRows, useStickyColumn, useActionsColumn, useCustomizeColumns, useSelectAllWithToggle, useColumnOrder, useInlineEdit } from './Datagrid';
|
40
|
+
export { Datagrid, useDatagrid, useInfiniteScroll, useNestedRows, useSelectRows, useExpandedRow, useOnRowClick, useSortableColumns, useRowIsMouseOver, useColumnRightAlign, useDisableSelectRows, useStickyColumn, useActionsColumn, useCustomizeColumns, useSelectAllWithToggle, useColumnOrder, useInlineEdit, useFiltering } from './Datagrid';
|
41
41
|
export { EditTearsheet } from './EditTearsheet';
|
42
42
|
export { EditTearsheetNarrow } from './EditTearsheetNarrow';
|
43
43
|
export { EditFullPage } from './EditFullPage';
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
1
3
|
/**
|
2
4
|
* Copyright IBM Corp. 2021, 2021
|
3
5
|
*
|
@@ -6,29 +8,48 @@
|
|
6
8
|
*/
|
7
9
|
|
8
10
|
import { useEffect } from 'react';
|
9
|
-
import
|
11
|
+
import wait from '../utils/wait';
|
10
12
|
|
11
13
|
// Focus the first focusable element and call the onMount prop for the current step if one is provided
|
12
14
|
export var useCreateComponentFocus = function useCreateComponentFocus(_ref) {
|
13
15
|
var previousState = _ref.previousState,
|
14
16
|
currentStep = _ref.currentStep,
|
15
17
|
blockClass = _ref.blockClass,
|
16
|
-
onMount = _ref.onMount
|
18
|
+
onMount = _ref.onMount,
|
19
|
+
firstFocusElement = _ref.firstFocusElement;
|
17
20
|
useEffect(function () {
|
18
21
|
if (typeof onMount === 'function') {
|
19
22
|
onMount();
|
20
23
|
}
|
21
24
|
}, [onMount]);
|
22
25
|
useEffect(function () {
|
26
|
+
// because of how handleStackChange.claimFocus in TearsheetShell works a timeout is required to focus on specific elements
|
27
|
+
var awaitFocus = /*#__PURE__*/function () {
|
28
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(elm) {
|
29
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
30
|
+
while (1) switch (_context.prev = _context.next) {
|
31
|
+
case 0:
|
32
|
+
_context.next = 2;
|
33
|
+
return wait(10);
|
34
|
+
case 2:
|
35
|
+
elm.focus();
|
36
|
+
case 3:
|
37
|
+
case "end":
|
38
|
+
return _context.stop();
|
39
|
+
}
|
40
|
+
}, _callee);
|
41
|
+
}));
|
42
|
+
return function awaitFocus(_x) {
|
43
|
+
return _ref2.apply(this, arguments);
|
44
|
+
};
|
45
|
+
}();
|
23
46
|
if ((previousState === null || previousState === void 0 ? void 0 : previousState.currentStep) !== currentStep && currentStep > 0) {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
var nextButton = document.querySelector(".".concat(blockClass, "__create-button"));
|
30
|
-
nextButton === null || nextButton === void 0 ? void 0 : nextButton.focus();
|
47
|
+
if (firstFocusElement) {
|
48
|
+
var elm = document.querySelector(firstFocusElement);
|
49
|
+
if (elm) {
|
50
|
+
awaitFocus(elm);
|
51
|
+
}
|
31
52
|
}
|
32
53
|
}
|
33
|
-
}, [currentStep, previousState, blockClass, onMount]);
|
54
|
+
}, [currentStep, previousState, blockClass, onMount, firstFocusElement]);
|
34
55
|
};
|
@@ -43,25 +43,23 @@ export var useCreateComponentStepChange = function useCreateComponentStepChange(
|
|
43
43
|
var handleOnRequestSubmit = /*#__PURE__*/function () {
|
44
44
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
45
45
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
46
|
-
while (1) {
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
return _context.stop();
|
64
|
-
}
|
46
|
+
while (1) switch (_context.prev = _context.next) {
|
47
|
+
case 0:
|
48
|
+
_context.prev = 0;
|
49
|
+
_context.next = 3;
|
50
|
+
return onRequestSubmit();
|
51
|
+
case 3:
|
52
|
+
onUnmount();
|
53
|
+
_context.next = 10;
|
54
|
+
break;
|
55
|
+
case 6:
|
56
|
+
_context.prev = 6;
|
57
|
+
_context.t0 = _context["catch"](0);
|
58
|
+
setIsSubmitting(false);
|
59
|
+
console.warn("".concat(componentName, " submit error: ").concat(_context.t0));
|
60
|
+
case 10:
|
61
|
+
case "end":
|
62
|
+
return _context.stop();
|
65
63
|
}
|
66
64
|
}, _callee, null, [[0, 6]]);
|
67
65
|
}));
|
@@ -72,35 +70,33 @@ export var useCreateComponentStepChange = function useCreateComponentStepChange(
|
|
72
70
|
var handleNext = /*#__PURE__*/function () {
|
73
71
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
74
72
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
75
|
-
while (1) {
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
_context2.next = 14;
|
81
|
-
break;
|
82
|
-
}
|
83
|
-
_context2.prev = 2;
|
84
|
-
_context2.next = 5;
|
85
|
-
return onNext();
|
86
|
-
case 5:
|
87
|
-
continueToNextStep();
|
88
|
-
_context2.next = 12;
|
89
|
-
break;
|
90
|
-
case 8:
|
91
|
-
_context2.prev = 8;
|
92
|
-
_context2.t0 = _context2["catch"](2);
|
93
|
-
setIsSubmitting(false);
|
94
|
-
console.warn("".concat(componentName, " onNext error: ").concat(_context2.t0));
|
95
|
-
case 12:
|
96
|
-
_context2.next = 15;
|
73
|
+
while (1) switch (_context2.prev = _context2.next) {
|
74
|
+
case 0:
|
75
|
+
setIsSubmitting(true);
|
76
|
+
if (!(typeof onNext === 'function')) {
|
77
|
+
_context2.next = 14;
|
97
78
|
break;
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
79
|
+
}
|
80
|
+
_context2.prev = 2;
|
81
|
+
_context2.next = 5;
|
82
|
+
return onNext();
|
83
|
+
case 5:
|
84
|
+
continueToNextStep();
|
85
|
+
_context2.next = 12;
|
86
|
+
break;
|
87
|
+
case 8:
|
88
|
+
_context2.prev = 8;
|
89
|
+
_context2.t0 = _context2["catch"](2);
|
90
|
+
setIsSubmitting(false);
|
91
|
+
console.warn("".concat(componentName, " onNext error: ").concat(_context2.t0));
|
92
|
+
case 12:
|
93
|
+
_context2.next = 15;
|
94
|
+
break;
|
95
|
+
case 14:
|
96
|
+
continueToNextStep();
|
97
|
+
case 15:
|
98
|
+
case "end":
|
99
|
+
return _context2.stop();
|
104
100
|
}
|
105
101
|
}, _callee2, null, [[2, 8]]);
|
106
102
|
}));
|
@@ -111,39 +107,37 @@ export var useCreateComponentStepChange = function useCreateComponentStepChange(
|
|
111
107
|
var handleSubmit = /*#__PURE__*/function () {
|
112
108
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
113
109
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
114
|
-
while (1) {
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
_context3.next = 15;
|
121
|
-
break;
|
122
|
-
}
|
123
|
-
_context3.prev = 2;
|
124
|
-
_context3.next = 5;
|
125
|
-
return onNext();
|
126
|
-
case 5:
|
127
|
-
_context3.next = 7;
|
128
|
-
return handleOnRequestSubmit();
|
129
|
-
case 7:
|
130
|
-
_context3.next = 13;
|
131
|
-
break;
|
132
|
-
case 9:
|
133
|
-
_context3.prev = 9;
|
134
|
-
_context3.t0 = _context3["catch"](2);
|
135
|
-
setIsSubmitting(false);
|
136
|
-
console.warn("".concat(componentName, " onNext error: ").concat(_context3.t0));
|
137
|
-
case 13:
|
138
|
-
_context3.next = 17;
|
110
|
+
while (1) switch (_context3.prev = _context3.next) {
|
111
|
+
case 0:
|
112
|
+
setIsSubmitting(true);
|
113
|
+
// last step should have onNext as well
|
114
|
+
if (!(typeof onNext === 'function')) {
|
115
|
+
_context3.next = 15;
|
139
116
|
break;
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
117
|
+
}
|
118
|
+
_context3.prev = 2;
|
119
|
+
_context3.next = 5;
|
120
|
+
return onNext();
|
121
|
+
case 5:
|
122
|
+
_context3.next = 7;
|
123
|
+
return handleOnRequestSubmit();
|
124
|
+
case 7:
|
125
|
+
_context3.next = 13;
|
126
|
+
break;
|
127
|
+
case 9:
|
128
|
+
_context3.prev = 9;
|
129
|
+
_context3.t0 = _context3["catch"](2);
|
130
|
+
setIsSubmitting(false);
|
131
|
+
console.warn("".concat(componentName, " onNext error: ").concat(_context3.t0));
|
132
|
+
case 13:
|
133
|
+
_context3.next = 17;
|
134
|
+
break;
|
135
|
+
case 15:
|
136
|
+
_context3.next = 17;
|
137
|
+
return handleOnRequestSubmit();
|
138
|
+
case 17:
|
139
|
+
case "end":
|
140
|
+
return _context3.stop();
|
147
141
|
}
|
148
142
|
}, _callee3, null, [[2, 9]]);
|
149
143
|
}));
|
@@ -137,20 +137,18 @@ export var expectWarnAsync = /*#__PURE__*/function () {
|
|
137
137
|
var _expect2;
|
138
138
|
var warn;
|
139
139
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
140
|
-
while (1) {
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
return _context.stop();
|
153
|
-
}
|
140
|
+
while (1) switch (_context.prev = _context.next) {
|
141
|
+
case 0:
|
142
|
+
warn = jest.spyOn(console, 'warn').mockImplementation(jest.fn());
|
143
|
+
_context.next = 3;
|
144
|
+
return test();
|
145
|
+
case 3:
|
146
|
+
expect(warn).toBeCalledTimes(1);
|
147
|
+
(_expect2 = expect(warn)).toHaveBeenCalledWith.apply(_expect2, _toConsumableArray(makeMatcherArray(message)));
|
148
|
+
warn.mockRestore();
|
149
|
+
case 6:
|
150
|
+
case "end":
|
151
|
+
return _context.stop();
|
154
152
|
}
|
155
153
|
}, _callee);
|
156
154
|
}));
|
@@ -1,6 +1,6 @@
|
|
1
1
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
2
2
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
3
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
3
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
4
4
|
import React from 'react';
|
5
5
|
|
6
6
|
/**
|
@@ -38,29 +38,27 @@ var APIKeyDownloader = function APIKeyDownloader(_ref) {
|
|
38
38
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
39
39
|
var data, blob, href, download, props;
|
40
40
|
return _regenerator.default.wrap(function _callee$(_context) {
|
41
|
-
while (1) {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
return _context.stop();
|
63
|
-
}
|
41
|
+
while (1) switch (_context.prev = _context.next) {
|
42
|
+
case 0:
|
43
|
+
data = fileType === 'txt' ? apiKey : JSON.stringify({
|
44
|
+
apiKey: apiKey
|
45
|
+
});
|
46
|
+
blob = new Blob([data], {
|
47
|
+
type: fileType === 'txt' ? 'text/plain' : 'application/json'
|
48
|
+
});
|
49
|
+
_context.next = 4;
|
50
|
+
return URL.createObjectURL(blob);
|
51
|
+
case 4:
|
52
|
+
href = _context.sent;
|
53
|
+
download = "".concat(fileName || 'apikey', ".").concat(fileType);
|
54
|
+
props = {
|
55
|
+
href: href,
|
56
|
+
download: download
|
57
|
+
};
|
58
|
+
setLinkProps(props);
|
59
|
+
case 8:
|
60
|
+
case "end":
|
61
|
+
return _context.stop();
|
64
62
|
}
|
65
63
|
}, _callee);
|
66
64
|
}));
|