@carbon/ibm-products 1.2.5 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +1028 -517
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +3 -3
- package/css/index-without-carbon-released-only.css +187 -108
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +3 -3
- package/css/index-without-carbon.css +580 -114
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +3 -3
- package/css/index.css +804 -116
- package/css/index.css.map +1 -1
- package/css/index.min.css +3 -3
- 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 +198 -0
- package/es/components/AddSelect/AddSelectBreadcrumbs.js +56 -0
- package/es/components/AddSelect/AddSelectList.js +94 -0
- package/es/components/AddSelect/AddSelectSidebar.js +46 -0
- package/es/components/AddSelect/index.js +7 -0
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +24 -17
- package/es/components/CancelableTextEdit/CancelableTextEdit.js +245 -0
- package/es/components/{CreateTearsheet/constants.js → CancelableTextEdit/index.js} +1 -2
- package/es/components/Card/Card.js +6 -4
- 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 +373 -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/NotificationsPanel/NotificationsPanel.js +16 -3
- package/es/components/OptionsTile/OptionsTile.js +36 -15
- package/es/components/PageHeader/PageHeader.js +59 -35
- package/es/components/PageHeader/PageHeaderTitle.js +82 -7
- package/es/components/PageHeader/PageHeaderUtils.js +21 -2
- package/es/components/RemoveModal/RemoveModal.js +4 -2
- package/es/components/SidePanel/SidePanel.js +33 -16
- 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/WebTerminal/WebTerminal.js +1 -1
- 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/settings.js +0 -5
- 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 +223 -0
- package/lib/components/AddSelect/AddSelectBreadcrumbs.js +71 -0
- package/lib/components/AddSelect/AddSelectList.js +112 -0
- package/lib/components/AddSelect/AddSelectSidebar.js +63 -0
- package/lib/components/AddSelect/index.js +13 -0
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +23 -16
- package/lib/components/CancelableTextEdit/CancelableTextEdit.js +265 -0
- package/lib/components/CancelableTextEdit/index.js +13 -0
- package/lib/components/Card/Card.js +6 -4
- 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 +389 -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/NotificationsPanel/NotificationsPanel.js +13 -1
- package/lib/components/OptionsTile/OptionsTile.js +36 -15
- package/lib/components/PageHeader/PageHeader.js +59 -35
- package/lib/components/PageHeader/PageHeaderTitle.js +91 -9
- package/lib/components/PageHeader/PageHeaderUtils.js +21 -2
- package/lib/components/RemoveModal/RemoveModal.js +4 -2
- package/lib/components/SidePanel/SidePanel.js +33 -16
- 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/WebTerminal/WebTerminal.js +1 -1
- 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/settings.js +0 -6
- package/package.json +19 -19
- package/scss/components/AddSelect/_add-select.scss +108 -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/BreadcrumbWithOverflow/_index.scss +1 -1
- package/scss/components/CancelableTextEdit/_cancelable-text-edit.scss +212 -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/CreateInfluencer/_create-influencer.scss +4 -4
- package/scss/components/CreateTearsheet/_create-tearsheet.scss +6 -10
- package/scss/components/InlineEdit/_index.scss +8 -0
- package/scss/components/InlineEdit/_inline-edit.scss +245 -0
- package/scss/components/InlineEdit/_storybook-styles.scss +28 -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/NotificationsPanel/_notifications-panel.scss +2 -2
- package/scss/components/PageHeader/_index.scss +1 -1
- package/scss/components/PageHeader/_page-header.scss +15 -5
- package/scss/components/ProductiveCard/_productive-card.scss +0 -4
- package/scss/components/SidePanel/_side-panel.scss +15 -6
- 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/_index.scss +1 -1
- package/scss/components/StatusIcon/_status-icon.scss +2 -0
- package/scss/components/TagSet/_index.scss +1 -1
- package/scss/components/UserProfileImage/_index.scss +1 -1
- package/scss/components/WebTerminal/_web-terminal.scss +2 -2
- package/scss/components/_index.scss +4 -0
- package/scss/global/styles/_project-settings.scss +5 -1
- 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/generated/feature-flags/feature-flags.js +0 -15
- 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/generated/feature-flags/feature-flags.js +0 -22
- package/lib/global/js/utils/hasValidType.js +0 -110
- package/scss/generated/feature-flags/_feature-flags.scss +0 -19
@@ -1,44 +1,94 @@
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
|
+
|
1
4
|
/**
|
2
|
-
* Copyright IBM Corp. 2021,
|
5
|
+
* Copyright IBM Corp. 2021, 2022
|
3
6
|
*
|
4
7
|
* This source code is licensed under the Apache-2.0 license found in the
|
5
8
|
* LICENSE file in the root directory of this source tree.
|
6
9
|
*/
|
7
|
-
import React, { forwardRef } from 'react';
|
10
|
+
import React, { forwardRef, useContext, useEffect, useState } from 'react';
|
8
11
|
import PropTypes from 'prop-types';
|
9
12
|
import cx from 'classnames';
|
10
13
|
import { Column, FormGroup, Row } from 'carbon-components-react';
|
14
|
+
import { StepsContext, StepNumberContext } from './CreateTearsheet';
|
11
15
|
import { pkg } from '../../settings';
|
12
|
-
import
|
16
|
+
import pconsole from '../../global/js/utils/pconsole';
|
17
|
+
import { usePreviousValue, useRetrieveStepData } from '../../global/js/hooks';
|
13
18
|
var componentName = 'CreateTearsheetStep';
|
14
19
|
var blockClass = "".concat(pkg.prefix, "--tearsheet-create__step");
|
15
20
|
export var CreateTearsheetStep = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
21
|
+
var _cx;
|
22
|
+
|
16
23
|
var children = _ref.children,
|
17
24
|
className = _ref.className,
|
18
|
-
subtitle = _ref.subtitle,
|
19
25
|
description = _ref.description,
|
20
|
-
|
21
|
-
hasFieldset = _ref.hasFieldset,
|
26
|
+
disableSubmit = _ref.disableSubmit,
|
22
27
|
fieldsetLegendText = _ref.fieldsetLegendText,
|
23
|
-
|
24
|
-
|
25
|
-
|
28
|
+
hasFieldset = _ref.hasFieldset,
|
29
|
+
includeStep = _ref.includeStep,
|
30
|
+
introStep = _ref.introStep,
|
31
|
+
onNext = _ref.onNext,
|
32
|
+
onMount = _ref.onMount,
|
33
|
+
secondaryLabel = _ref.secondaryLabel,
|
34
|
+
subtitle = _ref.subtitle,
|
35
|
+
title = _ref.title;
|
36
|
+
var stepsContext = useContext(StepsContext);
|
37
|
+
var stepNumber = useContext(StepNumberContext);
|
38
|
+
|
39
|
+
var _useState = useState(),
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
41
|
+
shouldIncludeStep = _useState2[0],
|
42
|
+
setShouldIncludeStep = _useState2[1];
|
43
|
+
|
44
|
+
var previousState = usePreviousValue({
|
45
|
+
currentStep: stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep
|
46
|
+
});
|
47
|
+
useRetrieveStepData({
|
48
|
+
stepsContext: stepsContext,
|
49
|
+
stepNumber: stepNumber,
|
50
|
+
introStep: introStep,
|
51
|
+
shouldIncludeStep: shouldIncludeStep,
|
52
|
+
secondaryLabel: secondaryLabel,
|
53
|
+
title: title
|
54
|
+
}); // This useEffect reports back the onNext and onMount values so that they can be used
|
55
|
+
// in the appropriate custom hooks.
|
56
|
+
|
57
|
+
useEffect(function () {
|
58
|
+
if (stepNumber === (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep) && (previousState === null || previousState === void 0 ? void 0 : previousState.currentStep) !== (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)) {
|
59
|
+
stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.setOnNext(onNext);
|
60
|
+
stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.setOnMount(onMount);
|
61
|
+
}
|
62
|
+
}, [onMount, onNext, stepsContext, stepNumber, previousState === null || previousState === void 0 ? void 0 : previousState.currentStep]); // Used to take the `includeStep` prop and use it as a local state value
|
63
|
+
|
64
|
+
useEffect(function () {
|
65
|
+
setShouldIncludeStep(includeStep);
|
66
|
+
}, [includeStep, stepsContext, title]); // Whenever we are the current step, supply our disableSubmit value to the
|
67
|
+
// steps container context so that it can manage the 'Next' button appropriately.
|
68
|
+
|
69
|
+
useEffect(function () {
|
70
|
+
if (stepNumber === (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)) {
|
71
|
+
stepsContext.setIsDisabled(disableSubmit);
|
72
|
+
}
|
73
|
+
}, [stepsContext, stepNumber, disableSubmit, onNext]);
|
74
|
+
return stepsContext ? /*#__PURE__*/React.createElement("div", {
|
75
|
+
className: cx(blockClass, className, (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__step--hidden-step"), stepNumber !== (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)), _defineProperty(_cx, "".concat(blockClass, "__step--visible-step"), stepNumber === (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)), _cx)),
|
26
76
|
ref: ref
|
27
77
|
}, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Column, {
|
28
78
|
xlg: 12,
|
29
79
|
lg: 12,
|
30
80
|
md: 8,
|
31
81
|
sm: 8
|
32
|
-
},
|
82
|
+
}, /*#__PURE__*/React.createElement("h4", {
|
33
83
|
className: "".concat(blockClass, "--title")
|
34
|
-
}, title),
|
84
|
+
}, title), subtitle && /*#__PURE__*/React.createElement("h6", {
|
35
85
|
className: "".concat(blockClass, "--subtitle")
|
36
|
-
}, subtitle),
|
86
|
+
}, subtitle), description && /*#__PURE__*/React.createElement("p", {
|
37
87
|
className: "".concat(blockClass, "--description")
|
38
88
|
}, description))), hasFieldset ? /*#__PURE__*/React.createElement(FormGroup, {
|
39
89
|
legendText: fieldsetLegendText,
|
40
90
|
className: "".concat(blockClass, "--fieldset")
|
41
|
-
}, children) : children);
|
91
|
+
}, children) : children) : pconsole.warn("You have tried using a ".concat(componentName, " component outside of a CreateTearsheet. This is not allowed. ").concat(componentName, "s should always be children of the CreateTearsheet"));
|
42
92
|
}); // Return a placeholder if not released and not enabled by feature flag
|
43
93
|
|
44
94
|
CreateTearsheetStep = pkg.checkComponentEnabled(CreateTearsheetStep, componentName);
|
@@ -81,15 +131,15 @@ CreateTearsheetStep.propTypes = {
|
|
81
131
|
hasFieldset: PropTypes.bool,
|
82
132
|
|
83
133
|
/**
|
84
|
-
* This prop
|
134
|
+
* This prop is used to help track dynamic steps. If this value is `false` then the step is not included in the visible steps or the ProgressIndicator
|
135
|
+
* steps. If this value is `true` then the step will be included in the list of visible steps, as well as being included in the ProgressIndicator step list
|
85
136
|
*/
|
86
|
-
|
137
|
+
includeStep: PropTypes.bool,
|
87
138
|
|
88
139
|
/**
|
89
|
-
*
|
90
|
-
* The is an internal prop set in CreateTearsheet so the step knows when to render it's title
|
140
|
+
* This prop can be used on the first step to mark it as an intro step, which will not render the progress indicator steps
|
91
141
|
*/
|
92
|
-
|
142
|
+
introStep: PropTypes.bool,
|
93
143
|
|
94
144
|
/**
|
95
145
|
* Optional function to be called on initial mount of a step.
|
@@ -124,6 +174,6 @@ CreateTearsheetStep.propTypes = {
|
|
124
174
|
// component needs to make a choice or assumption when a prop is not supplied.
|
125
175
|
|
126
176
|
CreateTearsheetStep.defaultProps = {
|
127
|
-
|
128
|
-
|
177
|
+
hasFieldset: true,
|
178
|
+
includeStep: true
|
129
179
|
};
|
@@ -1,30 +1,57 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
4
|
+
var _excluded = ["value1", "setValue1"];
|
2
5
|
|
3
6
|
/* eslint-disable react/prop-types */
|
4
7
|
|
5
8
|
/**
|
6
|
-
* Copyright IBM Corp. 2021,
|
9
|
+
* Copyright IBM Corp. 2021, 2022
|
7
10
|
*
|
8
11
|
* This source code is licensed under the Apache-2.0 license found in the
|
9
12
|
* LICENSE file in the root directory of this source tree.
|
10
13
|
*/
|
11
14
|
import React, { useState } from 'react';
|
12
|
-
import { Button, Column, InlineNotification, RadioButtonGroup, RadioButton, Row, TextInput, Toggle, NumberInput } from 'carbon-components-react';
|
15
|
+
import { Button, Column, InlineNotification, RadioButtonGroup, RadioButton, Row, TextInput, Toggle, NumberInput, Checkbox } from 'carbon-components-react';
|
13
16
|
import cx from 'classnames';
|
14
17
|
import { pkg } from '../../../settings';
|
15
18
|
import { CreateTearsheet } from '../CreateTearsheet';
|
16
19
|
import { CreateTearsheetStep } from '../CreateTearsheetStep';
|
17
20
|
var blockClass = "".concat(pkg.prefix, "--tearsheet-create-multi-step");
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
|
22
|
+
var CustomStep = function CustomStep(_ref) {
|
23
|
+
var value1 = _ref.value1,
|
24
|
+
setValue1 = _ref.setValue1,
|
25
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
26
|
+
|
27
|
+
return /*#__PURE__*/React.createElement(CreateTearsheetStep, _extends({}, rest, {
|
28
|
+
disableSubmit: !value1
|
29
|
+
}), /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Column, {
|
30
|
+
xlg: 8,
|
31
|
+
lg: 8,
|
32
|
+
md: 8,
|
33
|
+
sm: 8
|
34
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
35
|
+
value: value1,
|
36
|
+
onChange: function onChange(event) {
|
37
|
+
return setValue1(event.target.value);
|
38
|
+
},
|
39
|
+
id: "custom-step-input",
|
40
|
+
labelText: "Location",
|
41
|
+
placeholder: "Enter location"
|
42
|
+
}))));
|
43
|
+
};
|
44
|
+
|
45
|
+
export var MultiStepTearsheet = function MultiStepTearsheet(_ref2) {
|
46
|
+
var backButtonText = _ref2.backButtonText,
|
47
|
+
cancelButtonText = _ref2.cancelButtonText,
|
48
|
+
className = _ref2.className,
|
49
|
+
description = _ref2.description,
|
50
|
+
influencerWidth = _ref2.influencerWidth,
|
51
|
+
label = _ref2.label,
|
52
|
+
nextButtonText = _ref2.nextButtonText,
|
53
|
+
submitButtonText = _ref2.submitButtonText,
|
54
|
+
title = _ref2.title;
|
28
55
|
|
29
56
|
var _useState = useState(750),
|
30
57
|
_useState2 = _slicedToArray(_useState, 1),
|
@@ -47,33 +74,43 @@ export var MultiStepTearsheet = function MultiStepTearsheet(_ref) {
|
|
47
74
|
|
48
75
|
var _useState9 = useState(''),
|
49
76
|
_useState10 = _slicedToArray(_useState9, 2),
|
50
|
-
|
51
|
-
|
77
|
+
value1 = _useState10[0],
|
78
|
+
setValue1 = _useState10[1];
|
52
79
|
|
53
80
|
var _useState11 = useState(''),
|
54
81
|
_useState12 = _slicedToArray(_useState11, 2),
|
55
|
-
|
56
|
-
|
82
|
+
stepOneTextInputValue = _useState12[0],
|
83
|
+
setStepOneTextInputValue = _useState12[1];
|
57
84
|
|
58
85
|
var _useState13 = useState(''),
|
59
86
|
_useState14 = _slicedToArray(_useState13, 2),
|
60
|
-
|
61
|
-
|
87
|
+
topicDescriptionValue = _useState14[0],
|
88
|
+
setTopicDescriptionValue = _useState14[1];
|
62
89
|
|
63
|
-
var _useState15 = useState(
|
90
|
+
var _useState15 = useState(''),
|
64
91
|
_useState16 = _slicedToArray(_useState15, 2),
|
65
|
-
|
66
|
-
|
92
|
+
topicVersionValue = _useState16[0],
|
93
|
+
setTopicVersionValue = _useState16[1];
|
67
94
|
|
68
|
-
var _useState17 = useState(
|
95
|
+
var _useState17 = useState(1),
|
69
96
|
_useState18 = _slicedToArray(_useState17, 2),
|
70
|
-
|
71
|
-
|
97
|
+
stepTwoTextInputValue = _useState18[0],
|
98
|
+
setStepTwoTextInputValue = _useState18[1];
|
72
99
|
|
73
|
-
var _useState19 = useState(
|
100
|
+
var _useState19 = useState('one-day'),
|
74
101
|
_useState20 = _slicedToArray(_useState19, 2),
|
75
|
-
|
76
|
-
|
102
|
+
stepThreeTextInputValue = _useState20[0],
|
103
|
+
setStepThreeTextInputValue = _useState20[1];
|
104
|
+
|
105
|
+
var _useState21 = useState(false),
|
106
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
107
|
+
isInvalid = _useState22[0],
|
108
|
+
setIsInvalid = _useState22[1];
|
109
|
+
|
110
|
+
var _useState23 = useState(false),
|
111
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
112
|
+
shouldIncludeAdditionalStep = _useState24[0],
|
113
|
+
setShouldIncludeAdditionalStep = _useState24[1];
|
77
114
|
|
78
115
|
var clearCreateData = function clearCreateData() {
|
79
116
|
setStepOneTextInputValue('');
|
@@ -84,6 +121,8 @@ export var MultiStepTearsheet = function MultiStepTearsheet(_ref) {
|
|
84
121
|
setHasSubmitError(false);
|
85
122
|
setIsInvalid(false);
|
86
123
|
setOpen(false);
|
124
|
+
setValue1('');
|
125
|
+
setShouldIncludeAdditionalStep(false);
|
87
126
|
};
|
88
127
|
|
89
128
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("style", null, ".".concat(blockClass, " { opacity: 0 }"), ";"), /*#__PURE__*/React.createElement(Button, {
|
@@ -138,9 +177,9 @@ export var MultiStepTearsheet = function MultiStepTearsheet(_ref) {
|
|
138
177
|
sm: 8
|
139
178
|
}, /*#__PURE__*/React.createElement(TextInput, {
|
140
179
|
labelText: "Topic name",
|
180
|
+
placeholder: "Enter topic name",
|
141
181
|
id: "tearsheet-multi-step-story-text-input-multi-step-1",
|
142
182
|
value: stepOneTextInputValue,
|
143
|
-
placeholder: "Enter topic name",
|
144
183
|
onChange: function onChange(event) {
|
145
184
|
if (event.target.value.length) {
|
146
185
|
setIsInvalid(false);
|
@@ -186,7 +225,27 @@ export var MultiStepTearsheet = function MultiStepTearsheet(_ref) {
|
|
186
225
|
onToggle: function onToggle(event) {
|
187
226
|
return setShouldReject(event);
|
188
227
|
}
|
228
|
+
}), /*#__PURE__*/React.createElement(Checkbox, {
|
229
|
+
labelText: "Include additional step",
|
230
|
+
id: "include-additional-step-checkbox",
|
231
|
+
onChange: function onChange(value) {
|
232
|
+
return setShouldIncludeAdditionalStep(value);
|
233
|
+
},
|
234
|
+
checked: shouldIncludeAdditionalStep
|
189
235
|
})))), /*#__PURE__*/React.createElement(CreateTearsheetStep, {
|
236
|
+
title: "Dynamic step",
|
237
|
+
subtitle: "Dynamic step subtitle",
|
238
|
+
description: "This is an example showing how to include a dynamic step into the CreateTearsheet",
|
239
|
+
hasFieldset: false,
|
240
|
+
includeStep: shouldIncludeAdditionalStep
|
241
|
+
}, "dynamic step content"), /*#__PURE__*/React.createElement(CustomStep, {
|
242
|
+
title: "Location",
|
243
|
+
subtitle: "Custom step subtitle",
|
244
|
+
description: "Custom step description (see storybook implementation for new custom step capability)",
|
245
|
+
value1: value1,
|
246
|
+
setValue1: setValue1,
|
247
|
+
hasFieldset: false
|
248
|
+
}), /*#__PURE__*/React.createElement(CreateTearsheetStep, {
|
190
249
|
title: "Partitions",
|
191
250
|
disableSubmit: !stepTwoTextInputValue,
|
192
251
|
subtitle: "One or more partitions make up a topic. A partition is an ordered list of messages.",
|
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
/* eslint-disable react/prop-types */
|
4
4
|
|
5
5
|
/**
|
6
|
-
* Copyright IBM Corp. 2021,
|
6
|
+
* Copyright IBM Corp. 2021, 2022
|
7
7
|
*
|
8
8
|
* This source code is licensed under the Apache-2.0 license found in the
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
@@ -154,14 +154,16 @@ export var MultiStepWithIntro = function MultiStepWithIntro(_ref) {
|
|
154
154
|
size: "lg"
|
155
155
|
}), /*#__PURE__*/React.createElement("span", {
|
156
156
|
className: "".concat(pkg.prefix, "--tearsheet-create-multi-step--custom-tile-label")
|
157
|
-
}, "Plus")))),
|
157
|
+
}, "Plus")))), /*#__PURE__*/React.createElement(CreateTearsheetStep, {
|
158
158
|
title: "Conditional step",
|
159
159
|
subtitle: "This step will only show for plus category creation flows",
|
160
|
-
hasFieldset: false
|
161
|
-
|
160
|
+
hasFieldset: false,
|
161
|
+
includeStep: selectedCategory === 'plus'
|
162
|
+
}, "This step will only show for plus create flows"), /*#__PURE__*/React.createElement(CreateTearsheetStep, {
|
162
163
|
title: "Standard step only",
|
163
|
-
hasFieldset: false
|
164
|
-
|
164
|
+
hasFieldset: false,
|
165
|
+
includeStep: selectedCategory === 'standard'
|
166
|
+
}, "This step will only show for standard create flows"), /*#__PURE__*/React.createElement(CreateTearsheetStep, {
|
165
167
|
onNext: function onNext() {
|
166
168
|
return new Promise(function (resolve, reject) {
|
167
169
|
setTimeout(function () {
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
5
|
-
var _excluded = ["body", "className", "error", "errorMessage", "filename", "inputLabel", "invalidInputText", "loading", "loadingMessage", "onClose", "onRequestSubmit", "open", "preformattedExtensions", "preformattedExtensionsLabel", "primaryButtonText", "secondaryButtonText", "successMessage", "successful", "title", "validExtensions"];
|
5
|
+
var _excluded = ["body", "className", "error", "errorMessage", "filename", "hidePasswordLabel", "inputLabel", "inputType", "invalidInputText", "loading", "loadingMessage", "onClose", "onRequestSubmit", "open", "preformattedExtensions", "preformattedExtensionsLabel", "primaryButtonText", "secondaryButtonText", "showPasswordLabel", "successMessage", "successful", "title", "validExtensions"];
|
6
6
|
|
7
7
|
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; }
|
8
8
|
|
@@ -15,7 +15,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
15
15
|
// LICENSE file in the root directory of this source tree.
|
16
16
|
//
|
17
17
|
import React, { useState, useRef, forwardRef } from 'react';
|
18
|
-
import { Button, ComposedModal, ModalHeader, ModalFooter, ModalBody, TextInput, RadioButton, RadioButtonGroup, FormGroup, Loading } from 'carbon-components-react';
|
18
|
+
import { Button, ComposedModal, ModalHeader, ModalFooter, ModalBody, TextInput, RadioButton, RadioButtonGroup, FormGroup, Loading, PasswordInput } from 'carbon-components-react';
|
19
19
|
import cx from 'classnames';
|
20
20
|
import { ErrorFilled16, CheckmarkFilled16 } from '@carbon/icons-react';
|
21
21
|
import PropTypes from 'prop-types';
|
@@ -31,7 +31,9 @@ export var ExportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
31
31
|
error = _ref.error,
|
32
32
|
errorMessage = _ref.errorMessage,
|
33
33
|
filename = _ref.filename,
|
34
|
+
hidePasswordLabel = _ref.hidePasswordLabel,
|
34
35
|
inputLabel = _ref.inputLabel,
|
36
|
+
inputType = _ref.inputType,
|
35
37
|
invalidInputText = _ref.invalidInputText,
|
36
38
|
loading = _ref.loading,
|
37
39
|
loadingMessage = _ref.loadingMessage,
|
@@ -42,6 +44,7 @@ export var ExportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
42
44
|
preformattedExtensionsLabel = _ref.preformattedExtensionsLabel,
|
43
45
|
primaryButtonText = _ref.primaryButtonText,
|
44
46
|
secondaryButtonText = _ref.secondaryButtonText,
|
47
|
+
showPasswordLabel = _ref.showPasswordLabel,
|
45
48
|
successMessage = _ref.successMessage,
|
46
49
|
successful = _ref.successful,
|
47
50
|
title = _ref.title,
|
@@ -103,6 +106,17 @@ export var ExportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
103
106
|
var internalId = useRef(uuidv4());
|
104
107
|
var primaryButtonDisabled = loading || !name || hasInvalidExtension();
|
105
108
|
var submitted = loading || error || successful;
|
109
|
+
|
110
|
+
var commonInputProps = _defineProperty({
|
111
|
+
id: "text-input--".concat(internalId.current),
|
112
|
+
value: name,
|
113
|
+
onChange: onNameChangeHandler,
|
114
|
+
labelText: inputLabel,
|
115
|
+
invalid: hasInvalidExtension(),
|
116
|
+
invalidText: invalidInputText,
|
117
|
+
onBlur: onBlurHandler
|
118
|
+
}, 'data-modal-primary-focus', true);
|
119
|
+
|
106
120
|
return /*#__PURE__*/React.createElement(ComposedModal, _extends({}, rest, {
|
107
121
|
className: cx(blockClass, className),
|
108
122
|
"aria-label": title,
|
@@ -131,17 +145,16 @@ export var ExportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
131
145
|
key: o.extension,
|
132
146
|
id: o.extension,
|
133
147
|
value: o.extension,
|
134
|
-
labelText: "".concat(o.extension, " (").concat(o.description, ")")
|
148
|
+
labelText: "".concat(o.extension, " (").concat(o.description, ")"),
|
149
|
+
"data-modal-primary-focus": true
|
135
150
|
});
|
136
|
-
}))) : /*#__PURE__*/React.createElement(
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
onBlur: onBlurHandler
|
144
|
-
})), /*#__PURE__*/React.createElement("div", {
|
151
|
+
}))) : /*#__PURE__*/React.createElement("div", {
|
152
|
+
className: "".concat(blockClass, "__input-container")
|
153
|
+
}, inputType === 'text' ? /*#__PURE__*/React.createElement(TextInput, commonInputProps) : /*#__PURE__*/React.createElement(PasswordInput, _extends({}, commonInputProps, {
|
154
|
+
showPasswordLabel: showPasswordLabel,
|
155
|
+
hidePasswordLabel: hidePasswordLabel,
|
156
|
+
tooltipPosition: "left"
|
157
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
145
158
|
className: "".concat(blockClass, "__messaging")
|
146
159
|
}, loading && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Loading, {
|
147
160
|
small: true,
|
@@ -191,11 +204,21 @@ ExportModal.propTypes = {
|
|
191
204
|
*/
|
192
205
|
filename: PropTypes.string.isRequired,
|
193
206
|
|
207
|
+
/**
|
208
|
+
* label text that's displayed when hovering over visibility toggler to hide key
|
209
|
+
*/
|
210
|
+
hidePasswordLabel: PropTypes.string,
|
211
|
+
|
194
212
|
/**
|
195
213
|
* label for the text input
|
196
214
|
*/
|
197
215
|
inputLabel: PropTypes.string,
|
198
216
|
|
217
|
+
/**
|
218
|
+
* specify the type of text input
|
219
|
+
*/
|
220
|
+
inputType: PropTypes.oneOf(['text', 'password']),
|
221
|
+
|
199
222
|
/**
|
200
223
|
* text for an invalid input
|
201
224
|
*/
|
@@ -249,6 +272,11 @@ ExportModal.propTypes = {
|
|
249
272
|
*/
|
250
273
|
secondaryButtonText: PropTypes.string.isRequired,
|
251
274
|
|
275
|
+
/**
|
276
|
+
* label text that's displayed when hovering over visibility toggler to show key
|
277
|
+
*/
|
278
|
+
showPasswordLabel: PropTypes.string,
|
279
|
+
|
252
280
|
/**
|
253
281
|
* messaging to display if the export was successful
|
254
282
|
*/
|
@@ -270,6 +298,7 @@ ExportModal.propTypes = {
|
|
270
298
|
validExtensions: PropTypes.array
|
271
299
|
};
|
272
300
|
ExportModal.defaultProps = {
|
301
|
+
inputType: 'text',
|
273
302
|
preformattedExtensions: [],
|
274
303
|
validExtensions: []
|
275
304
|
};
|
@@ -229,7 +229,8 @@ export var ImportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
229
229
|
accept: accept,
|
230
230
|
labelText: fileDropLabel,
|
231
231
|
onAddFiles: onAddFile,
|
232
|
-
disabled: hasFiles
|
232
|
+
disabled: hasFiles,
|
233
|
+
"data-modal-primary-focus": true
|
233
234
|
}), inputLabel && /*#__PURE__*/React.createElement("p", {
|
234
235
|
className: "".concat(blockClass, "__label")
|
235
236
|
}, inputLabel), /*#__PURE__*/React.createElement("div", {
|