@carbon/ibm-products 1.2.4 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +662 -313
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +2 -2
- package/css/index-without-carbon-released-only.css +156 -81
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +2 -2
- package/css/index-without-carbon.css +393 -81
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +2 -2
- package/css/index.css +615 -81
- package/css/index.css.map +1 -1
- package/css/index.min.css +2 -2
- package/es/components/APIKeyModal/APIKeyModal.js +25 -29
- package/es/components/ActionBar/ActionBar.js +4 -1
- package/es/components/ActionSet/ActionSet.js +22 -10
- package/es/components/ActionSet/actions.js +25 -17
- package/es/components/AddSelect/AddSelect.js +157 -0
- package/es/components/AddSelect/index.js +7 -0
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +19 -15
- package/es/components/CancelableTextEdit/CancelableTextEdit.js +245 -0
- package/es/components/{CreateTearsheet/constants.js → CancelableTextEdit/index.js} +1 -2
- package/es/components/CreateFullPage/CreateFullPage.js +102 -258
- package/es/components/CreateFullPage/CreateFullPageStep.js +65 -13
- package/es/components/CreateFullPage/index.js +1 -2
- package/es/components/CreateInfluencer/CreateInfluencer.js +40 -220
- package/es/components/CreateTearsheet/CreateTearsheet.js +95 -146
- package/es/components/CreateTearsheet/CreateTearsheetStep.js +70 -20
- package/es/components/CreateTearsheet/index.js +0 -1
- package/es/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +87 -28
- package/es/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +8 -6
- package/es/components/ExportModal/ExportModal.js +41 -12
- package/es/components/ImportModal/ImportModal.js +2 -1
- package/es/components/InlineEdit/InlineEdit.js +224 -0
- package/es/components/InlineEdit/index.js +7 -0
- package/es/components/MultiAddSelect/MultiAddSelect.js +16 -0
- package/es/components/MultiAddSelect/index.js +1 -0
- package/es/components/OptionsTile/OptionsTile.js +36 -15
- package/es/components/PageHeader/PageHeader.js +54 -33
- package/es/components/PageHeader/PageHeaderTitle.js +78 -7
- package/es/components/PageHeader/PageHeaderUtils.js +21 -2
- package/es/components/RemoveModal/RemoveModal.js +4 -2
- package/es/components/SidePanel/SidePanel.js +1 -1
- package/es/components/SingleAddSelect/SingleAddSelect.js +15 -0
- package/es/components/SingleAddSelect/index.js +1 -0
- package/es/components/TagSet/TagSet.js +4 -1
- package/es/components/Tearsheet/Tearsheet.js +1 -1
- package/es/components/Tearsheet/TearsheetNarrow.js +1 -1
- package/es/components/Tearsheet/TearsheetShell.js +1 -1
- package/es/components/Toolbar/Toolbar.js +69 -8
- package/es/components/index.js +5 -1
- package/es/global/js/hooks/index.js +1 -0
- package/es/global/js/hooks/useCreateComponentFocus.js +15 -19
- package/es/global/js/hooks/useCreateComponentStepChange.js +69 -79
- package/es/global/js/hooks/useResetCreateComponent.js +7 -4
- package/es/global/js/hooks/useRetrieveStepData.js +51 -0
- package/es/global/js/hooks/useValidCreateStepCount.js +4 -7
- package/es/global/js/package-settings.js +5 -1
- package/es/global/js/utils/lastIndexInArray.js +26 -0
- package/es/global/js/utils/story-helper.js +1 -1
- package/lib/components/APIKeyModal/APIKeyModal.js +25 -29
- package/lib/components/ActionBar/ActionBar.js +4 -1
- package/lib/components/ActionSet/ActionSet.js +22 -10
- package/lib/components/ActionSet/actions.js +25 -17
- package/lib/components/AddSelect/AddSelect.js +178 -0
- package/lib/components/AddSelect/index.js +13 -0
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +18 -14
- package/lib/components/CancelableTextEdit/CancelableTextEdit.js +265 -0
- package/lib/components/CancelableTextEdit/index.js +13 -0
- package/lib/components/CreateFullPage/CreateFullPage.js +102 -258
- package/lib/components/CreateFullPage/CreateFullPageStep.js +68 -13
- package/lib/components/CreateFullPage/index.js +1 -9
- package/lib/components/CreateInfluencer/CreateInfluencer.js +38 -231
- package/lib/components/CreateTearsheet/CreateTearsheet.js +97 -148
- package/lib/components/CreateTearsheet/CreateTearsheetStep.js +72 -19
- package/lib/components/CreateTearsheet/index.js +0 -8
- package/lib/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +86 -34
- package/lib/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +8 -6
- package/lib/components/ExportModal/ExportModal.js +38 -11
- package/lib/components/ImportModal/ImportModal.js +2 -1
- package/lib/components/InlineEdit/InlineEdit.js +242 -0
- package/lib/components/InlineEdit/index.js +13 -0
- package/lib/components/MultiAddSelect/MultiAddSelect.js +37 -0
- package/lib/components/MultiAddSelect/index.js +13 -0
- package/lib/components/OptionsTile/OptionsTile.js +36 -15
- package/lib/components/PageHeader/PageHeader.js +54 -33
- package/lib/components/PageHeader/PageHeaderTitle.js +87 -9
- package/lib/components/PageHeader/PageHeaderUtils.js +21 -2
- package/lib/components/RemoveModal/RemoveModal.js +4 -2
- package/lib/components/SidePanel/SidePanel.js +1 -1
- package/lib/components/SingleAddSelect/SingleAddSelect.js +36 -0
- package/lib/components/SingleAddSelect/index.js +13 -0
- package/lib/components/TagSet/TagSet.js +4 -1
- package/lib/components/Tearsheet/Tearsheet.js +1 -1
- package/lib/components/Tearsheet/TearsheetNarrow.js +1 -1
- package/lib/components/Tearsheet/TearsheetShell.js +1 -1
- package/lib/components/Toolbar/Toolbar.js +69 -6
- package/lib/components/index.js +33 -1
- package/lib/global/js/hooks/index.js +8 -0
- package/lib/global/js/hooks/useCreateComponentFocus.js +15 -19
- package/lib/global/js/hooks/useCreateComponentStepChange.js +69 -79
- package/lib/global/js/hooks/useResetCreateComponent.js +7 -4
- package/lib/global/js/hooks/useRetrieveStepData.js +62 -0
- package/lib/global/js/hooks/useValidCreateStepCount.js +4 -7
- package/lib/global/js/package-settings.js +5 -1
- package/lib/global/js/utils/lastIndexInArray.js +35 -0
- package/lib/global/js/utils/story-helper.js +1 -1
- package/package.json +22 -22
- package/scss/components/AddSelect/_add-select.scss +84 -0
- package/scss/components/AddSelect/_index.scss +10 -0
- package/scss/components/AddSelect/_storybook-styles.scss +6 -0
- package/scss/components/BreadcrumbWithOverflow/_breadcrumb-with-overflow.scss +19 -15
- package/scss/components/CancelableTextEdit/_cancelable-text-edit.scss +211 -0
- package/{es/components/CreateFullPage/constants.js → scss/components/CancelableTextEdit/_index.scss} +2 -2
- package/scss/components/CancelableTextEdit/_storybook-styles.scss +15 -0
- package/scss/components/CreateFullPage/_create-full-page.scss +4 -11
- package/scss/components/CreateTearsheet/_create-tearsheet.scss +4 -8
- package/scss/components/InlineEdit/_index.scss +8 -0
- package/scss/components/InlineEdit/_inline-edit.scss +44 -0
- package/scss/components/InlineEdit/_storybook-styles.scss +15 -0
- package/scss/components/MultiAddSelect/_index.scss +1 -0
- package/scss/components/MultiAddSelect/_multi-add-select.scss +1 -0
- package/scss/components/MultiAddSelect/_storybook-styles.scss +6 -0
- package/scss/components/PageHeader/_page-header.scss +14 -4
- package/scss/components/SingleAddSelect/_index.scss +1 -0
- package/scss/components/SingleAddSelect/_single-add-select.scss +1 -0
- package/scss/components/SingleAddSelect/_storybook-styles.scss +6 -0
- package/scss/components/StatusIcon/_status-icon.scss +2 -0
- package/scss/components/_index.scss +4 -0
- package/es/components/CreateFullPage/CreateFullPageSection.js +0 -53
- package/es/components/CreateTearsheet/CreateTearsheetSection.js +0 -83
- package/es/components/CreateTearsheet/preview-components/MultiStepWithSectionsTearsheet.js +0 -327
- package/es/global/js/utils/hasValidType.js +0 -94
- package/lib/components/CreateFullPage/CreateFullPageSection.js +0 -74
- package/lib/components/CreateFullPage/constants.js +0 -16
- package/lib/components/CreateTearsheet/CreateTearsheetSection.js +0 -105
- package/lib/components/CreateTearsheet/constants.js +0 -17
- package/lib/components/CreateTearsheet/preview-components/MultiStepWithSectionsTearsheet.js +0 -354
- package/lib/global/js/utils/hasValidType.js +0 -110
@@ -1,110 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.hasValidChildrenType = exports.hasValidChildType = exports.getExtractedSteps = void 0;
|
7
|
-
|
8
|
-
var _react = require("react");
|
9
|
-
|
10
|
-
/**
|
11
|
-
* Copyright IBM Corp. 2021, 2021
|
12
|
-
*
|
13
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
14
|
-
* LICENSE file in the root directory of this source tree.
|
15
|
-
*/
|
16
|
-
// Custom PropType validator which checks and ensures that all children of the create component are indeed all CreateStep components.
|
17
|
-
var hasValidChildrenType = function hasValidChildrenType(_ref) {
|
18
|
-
var componentName = _ref.componentName,
|
19
|
-
childType = _ref.childType;
|
20
|
-
return function (_ref2) {
|
21
|
-
var children = _ref2.children;
|
22
|
-
children.length > 1 && children.map(function (child) {
|
23
|
-
var _child$type;
|
24
|
-
|
25
|
-
if (typeof (child === null || child === void 0 ? void 0 : child.type) !== 'function' && child && child.props && child.props.type !== childType || typeof (child === null || child === void 0 ? void 0 : child.type) === 'function' && ((_child$type = child.type()) === null || _child$type === void 0 ? void 0 : _child$type.props.type) !== childType) {
|
26
|
-
throw new Error("Each child of ".concat(componentName, " is required to be a ").concat(childType, ". Please remove the HTML element, or wrap it around the ").concat(childType, " component."));
|
27
|
-
}
|
28
|
-
|
29
|
-
return;
|
30
|
-
});
|
31
|
-
};
|
32
|
-
};
|
33
|
-
/**
|
34
|
-
* Returns array of CreateTearsheetSteps or CreateFullPageSteps
|
35
|
-
* @param {Array} arr All of the children passed to the create tearsheet component
|
36
|
-
* @param {string} type string that represents the `type` of component/s we're looking for
|
37
|
-
*/
|
38
|
-
|
39
|
-
|
40
|
-
exports.hasValidChildrenType = hasValidChildrenType;
|
41
|
-
|
42
|
-
var getExtractedSteps = function getExtractedSteps(arr, type) {
|
43
|
-
var steps = [];
|
44
|
-
|
45
|
-
var validateChild = function validateChild(child) {
|
46
|
-
var _child$type2;
|
47
|
-
|
48
|
-
// If the child is a CreateTearsheetStep component
|
49
|
-
// we can add it to our array of steps
|
50
|
-
if (typeof (child === null || child === void 0 ? void 0 : child.type) !== 'function' && child && child.props && child.props.type === type) {
|
51
|
-
steps.push(child);
|
52
|
-
} // Creating custom step components will follow this format
|
53
|
-
|
54
|
-
|
55
|
-
if (typeof (child === null || child === void 0 ? void 0 : child.type) === 'function' && ((_child$type2 = child.type()) === null || _child$type2 === void 0 ? void 0 : _child$type2.props.type) === type) {
|
56
|
-
// If the custom component does not have any props
|
57
|
-
// ie all of the create tearsheet step props are set
|
58
|
-
// inside of the custom component
|
59
|
-
if (!Object.entries(child.props).length) {
|
60
|
-
steps.push(child.type());
|
61
|
-
} else {
|
62
|
-
steps.push(child);
|
63
|
-
}
|
64
|
-
}
|
65
|
-
};
|
66
|
-
|
67
|
-
var validateFragmentChild = function validateFragmentChild(child) {
|
68
|
-
if (child.props.children.length) {
|
69
|
-
child.props.children.map(function (fragmentChild) {
|
70
|
-
// We need to make sure that we catch all fragments that have
|
71
|
-
// fragments as children, so we recursively call `validateFragmentChild`
|
72
|
-
// again until child.type is not a `Fragment`
|
73
|
-
if ((fragmentChild === null || fragmentChild === void 0 ? void 0 : fragmentChild.type) === _react.Fragment) {
|
74
|
-
validateFragmentChild(fragmentChild);
|
75
|
-
}
|
76
|
-
|
77
|
-
validateChild(fragmentChild);
|
78
|
-
});
|
79
|
-
} else {
|
80
|
-
validateChild(child.props.children);
|
81
|
-
}
|
82
|
-
};
|
83
|
-
|
84
|
-
arr.length && arr.map(function (child) {
|
85
|
-
if ((child === null || child === void 0 ? void 0 : child.type) === _react.Fragment) {
|
86
|
-
validateFragmentChild(child);
|
87
|
-
}
|
88
|
-
|
89
|
-
validateChild(child);
|
90
|
-
});
|
91
|
-
return steps;
|
92
|
-
}; // Utility used to check the `type` of a child component
|
93
|
-
|
94
|
-
|
95
|
-
exports.getExtractedSteps = getExtractedSteps;
|
96
|
-
|
97
|
-
var hasValidChildType = function hasValidChildType(_ref3) {
|
98
|
-
var _child$props;
|
99
|
-
|
100
|
-
var child = _ref3.child,
|
101
|
-
type = _ref3.type;
|
102
|
-
|
103
|
-
if (child && child !== null && child !== void 0 && child.props && (child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.type) === type) {
|
104
|
-
return true;
|
105
|
-
}
|
106
|
-
|
107
|
-
return false;
|
108
|
-
};
|
109
|
-
|
110
|
-
exports.hasValidChildType = hasValidChildType;
|