@carbon/ibm-products 2.43.2-canary.210 → 2.43.2-canary.211

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,8 +5,10 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { Dispatch, PropsWithChildren, ReactNode, SetStateAction } from 'react';
8
+ import { ExperimentalSecondarySubmit } from './CreateTearsheetStep';
8
9
  export interface StepsContextType {
9
10
  currentStep: number;
11
+ setExperimentalSecondarySubmit: Dispatch<SetStateAction<ExperimentalSecondarySubmit>>;
10
12
  setIsDisabled: Dispatch<SetStateAction<boolean>>;
11
13
  setOnPrevious: (fn: any) => void;
12
14
  setOnNext: (fn: any) => void;
@@ -32,6 +34,10 @@ export interface CreateTearsheetProps extends PropsWithChildren {
32
34
  * An optional class or classes to be added to the outermost element.
33
35
  */
34
36
  className?: string;
37
+ /**
38
+ * The experimentalSecondary submit button text
39
+ */
40
+ experimentalSecondarySubmitText?: string;
35
41
  /**
36
42
  * A description of the flow, displayed in the header area of the tearsheet.
37
43
  */
@@ -22,7 +22,7 @@ import { useResetCreateComponent } from '../../global/js/hooks/useResetCreateCom
22
22
  import { useCreateComponentStepChange } from '../../global/js/hooks/useCreateComponentStepChange.js';
23
23
  import { CreateInfluencer } from '../CreateInfluencer/CreateInfluencer.js';
24
24
 
25
- var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "description", "influencerWidth", "initialStep", "label", "nextButtonText", "onClose", "onRequestSubmit", "open", "firstFocusElement", "slug", "submitButtonText", "title", "verticalPosition"];
25
+ var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "experimentalSecondarySubmitText", "description", "influencerWidth", "initialStep", "label", "nextButtonText", "onClose", "onRequestSubmit", "open", "firstFocusElement", "slug", "submitButtonText", "title", "verticalPosition"];
26
26
  var componentName = 'CreateTearsheet';
27
27
  var blockClass = "".concat(pkg.prefix, "--tearsheet-create");
28
28
 
@@ -40,6 +40,7 @@ var CreateTearsheet = /*#__PURE__*/forwardRef(function (_ref, ref) {
40
40
  cancelButtonText = _ref.cancelButtonText,
41
41
  children = _ref.children,
42
42
  className = _ref.className,
43
+ experimentalSecondarySubmitText = _ref.experimentalSecondarySubmitText,
43
44
  description = _ref.description,
44
45
  _ref$influencerWidth = _ref.influencerWidth,
45
46
  influencerWidth = _ref$influencerWidth === void 0 ? 'narrow' : _ref$influencerWidth,
@@ -104,6 +105,10 @@ var CreateTearsheet = /*#__PURE__*/forwardRef(function (_ref, ref) {
104
105
  _useState24 = _slicedToArray(_useState23, 2),
105
106
  lastIncludedStep = _useState24[0],
106
107
  setLastIncludedStep = _useState24[1];
108
+ var _useState25 = useState({}),
109
+ _useState26 = _slicedToArray(_useState25, 2),
110
+ experimentalSecondarySubmit = _useState26[0],
111
+ setExperimentalSecondarySubmit = _useState26[1];
107
112
  var previousState = usePreviousValue({
108
113
  currentStep: currentStep,
109
114
  open: open
@@ -170,6 +175,8 @@ var CreateTearsheet = /*#__PURE__*/forwardRef(function (_ref, ref) {
170
175
  nextButtonText: nextButtonText,
171
176
  isSubmitting: isSubmitting,
172
177
  componentBlockClass: blockClass,
178
+ experimentalSecondarySubmit: experimentalSecondarySubmit,
179
+ experimentalSecondarySubmitText: experimentalSecondarySubmit.labelText ? experimentalSecondarySubmit.labelText : experimentalSecondarySubmitText,
173
180
  setCreateComponentActions: setCreateTearsheetActions
174
181
  });
175
182
  return /*#__PURE__*/React__default.createElement(TearsheetShell, _extends({}, getDevtoolsProps(componentName), rest, {
@@ -198,6 +205,7 @@ var CreateTearsheet = /*#__PURE__*/forwardRef(function (_ref, ref) {
198
205
  }, /*#__PURE__*/React__default.createElement(StepsContext.Provider, {
199
206
  value: {
200
207
  currentStep: currentStep,
208
+ setExperimentalSecondarySubmit: setExperimentalSecondarySubmit,
201
209
  setIsDisabled: setIsDisabled,
202
210
  setOnPrevious: function setOnPrevious(fn) {
203
211
  return _setOnPrevious(function () {
@@ -254,6 +262,10 @@ CreateTearsheet.propTypes = {
254
262
  * A description of the flow, displayed in the header area of the tearsheet.
255
263
  */
256
264
  description: PropTypes.node,
265
+ /**
266
+ * The experimentalSecondary submit button text
267
+ */
268
+ experimentalSecondarySubmitText: PropTypes.string,
257
269
  /**
258
270
  * Specifies elements to focus on first on render.
259
271
  */
@@ -49,6 +49,10 @@ interface CreateTearsheetStepBaseProps extends PropsWithChildren {
49
49
  * This will conditionally disable the submit button in the multi step Tearsheet
50
50
  */
51
51
  disableSubmit?: boolean;
52
+ /**
53
+ * Configuration options for customizing the behavior of the experimentalSecondary submit button.
54
+ */
55
+ experimentalSecondarySubmit?: ExperimentalSecondarySubmit;
52
56
  /**
53
57
  * 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
54
58
  * 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
@@ -91,5 +95,19 @@ interface CreateTearsheetStepBaseProps extends PropsWithChildren {
91
95
  title: React.ReactNode;
92
96
  }
93
97
  type CreateTearsheetStepProps = CreateTearsheetStepBaseProps & fieldsetLegendTextProps;
98
+ /**
99
+ * Configuration options for customizing the behavior of the experimentalSecondary submit button.
100
+ *
101
+ * @property {string} [labelText] - Optional text to replace the default button text.
102
+ * @property {boolean} [disabled] - If true, the button will be disabled and not clickable.
103
+ * @property {boolean} [hideSecondarySubmit] - If true, the button will be hidden from view.
104
+ * @property {() => void} [onClick] - Optional click handler function to be executed when the button is clicked.
105
+ */
106
+ export type ExperimentalSecondarySubmit = {
107
+ labelText?: string;
108
+ disabled?: boolean;
109
+ hideSecondarySubmit?: boolean;
110
+ onClick?: () => void;
111
+ };
94
112
  export declare let CreateTearsheetStep: React.ForwardRefExoticComponent<CreateTearsheetStepProps & React.RefAttributes<unknown>>;
95
113
  export {};
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { forwardRef, useRef, useContext, useState, useEffect, isValidElement } from 'react';
10
10
  import PropTypes from '../../node_modules/prop-types/index.js';
11
11
  import cx from 'classnames';
@@ -16,7 +16,7 @@ import pconsole from '../../global/js/utils/pconsole.js';
16
16
  import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
17
17
  import { useRetrieveStepData } from '../../global/js/hooks/useRetrieveStepData.js';
18
18
 
19
- var _excluded = ["children", "className", "description", "disableSubmit", "fieldsetLegendText", "hasFieldset", "includeStep", "introStep", "invalid", "onMount", "onNext", "onPrevious", "secondaryLabel", "subtitle", "title"];
19
+ var _excluded = ["children", "className", "description", "disableSubmit", "experimentalSecondarySubmit", "fieldsetLegendText", "hasFieldset", "includeStep", "introStep", "invalid", "onMount", "onNext", "onPrevious", "secondaryLabel", "subtitle", "title"];
20
20
  var componentName = 'CreateTearsheetStep';
21
21
  var blockClass = "".concat(pkg.prefix, "--tearsheet-create__step");
22
22
 
@@ -25,11 +25,22 @@ var defaults = {
25
25
  hasFieldset: true,
26
26
  includeStep: true
27
27
  };
28
+
29
+ /**
30
+ * Configuration options for customizing the behavior of the experimentalSecondary submit button.
31
+ *
32
+ * @property {string} [labelText] - Optional text to replace the default button text.
33
+ * @property {boolean} [disabled] - If true, the button will be disabled and not clickable.
34
+ * @property {boolean} [hideSecondarySubmit] - If true, the button will be hidden from view.
35
+ * @property {() => void} [onClick] - Optional click handler function to be executed when the button is clicked.
36
+ */
37
+
28
38
  var CreateTearsheetStep = /*#__PURE__*/forwardRef(function (_ref, ref) {
29
39
  var children = _ref.children,
30
40
  className = _ref.className,
31
41
  description = _ref.description,
32
42
  disableSubmit = _ref.disableSubmit,
43
+ experimentalSecondarySubmit = _ref.experimentalSecondarySubmit,
33
44
  fieldsetLegendText = _ref.fieldsetLegendText,
34
45
  _ref$hasFieldset = _ref.hasFieldset,
35
46
  hasFieldset = _ref$hasFieldset === void 0 ? defaults.hasFieldset : _ref$hasFieldset,
@@ -71,8 +82,9 @@ var CreateTearsheetStep = /*#__PURE__*/forwardRef(function (_ref, ref) {
71
82
  useEffect(function () {
72
83
  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)) {
73
84
  stepsContext === null || stepsContext === void 0 || stepsContext.setOnMount(onMount);
85
+ stepsContext === null || stepsContext === void 0 || stepsContext.setExperimentalSecondarySubmit(_objectSpread2({}, experimentalSecondarySubmit));
74
86
  }
75
- }, [onMount, stepsContext, stepNumber, previousState === null || previousState === void 0 ? void 0 : previousState.currentStep]);
87
+ }, [onMount, experimentalSecondarySubmit, stepsContext, stepNumber, previousState === null || previousState === void 0 ? void 0 : previousState.currentStep]);
76
88
 
77
89
  // Used to take the `includeStep` prop and use it as a local state value
78
90
  useEffect(function () {
@@ -163,6 +175,21 @@ CreateTearsheetStep.propTypes = {
163
175
  * This will conditionally disable the submit button in the multi step Tearsheet
164
176
  */
165
177
  disableSubmit: PropTypes.bool,
178
+ /**
179
+ * Configuration options for customizing the behavior of the experimentalSecondary submit button.
180
+ *
181
+ * @property {string} [labelText] - Optional text to replace the default button text.
182
+ * @property {boolean} [disabled] - If true, the button will be disabled and not clickable.
183
+ * @property {boolean} [hideSecondarySubmit] - If true, the button will be hidden from view.
184
+ * @property {() => void} [onClick] - Optional click handler function to be executed when the button is clicked.
185
+ */
186
+ /**@ts-ignore*/
187
+ experimentalSecondarySubmit: PropTypes.shape({
188
+ labelText: PropTypes.string,
189
+ disabled: PropTypes.bool,
190
+ hideSecondarySubmit: PropTypes.bool,
191
+ onClick: PropTypes.func
192
+ }),
166
193
  /**
167
194
  * This is the required legend text that appears above a fieldset html element for accessibility purposes.
168
195
  * You can set the `hasFieldset` prop to false if you have multiple fieldset elements or want to control the children of your Full Page's step content.
@@ -1,4 +1,4 @@
1
- export function useCreateComponentStepChange({ firstIncludedStep, lastIncludedStep, stepData, onPrevious, onNext, isSubmitDisabled, setCurrentStep, setIsSubmitting, setLoadingPrevious, loadingPrevious, onClose, onRequestSubmit, componentName, currentStep, backButtonText, cancelButtonText, submitButtonText, nextButtonText, isSubmitting, componentBlockClass, setCreateComponentActions, setModalIsOpen, }: {
1
+ export function useCreateComponentStepChange({ firstIncludedStep, lastIncludedStep, stepData, onPrevious, onNext, isSubmitDisabled, setCurrentStep, setIsSubmitting, setLoadingPrevious, loadingPrevious, onClose, onRequestSubmit, componentName, currentStep, backButtonText, cancelButtonText, submitButtonText, nextButtonText, isSubmitting, componentBlockClass, setCreateComponentActions, setModalIsOpen, experimentalSecondarySubmit, experimentalSecondarySubmitText, }: {
2
2
  firstIncludedStep: any;
3
3
  lastIncludedStep: any;
4
4
  stepData: any;
@@ -21,4 +21,6 @@ export function useCreateComponentStepChange({ firstIncludedStep, lastIncludedSt
21
21
  componentBlockClass: any;
22
22
  setCreateComponentActions: any;
23
23
  setModalIsOpen: any;
24
+ experimentalSecondarySubmit: any;
25
+ experimentalSecondarySubmitText: any;
24
26
  }): void;
@@ -32,7 +32,9 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
32
32
  isSubmitting = _ref.isSubmitting,
33
33
  componentBlockClass = _ref.componentBlockClass,
34
34
  setCreateComponentActions = _ref.setCreateComponentActions,
35
- setModalIsOpen = _ref.setModalIsOpen;
35
+ setModalIsOpen = _ref.setModalIsOpen,
36
+ experimentalSecondarySubmit = _ref.experimentalSecondarySubmit,
37
+ experimentalSecondarySubmitText = _ref.experimentalSecondarySubmitText;
36
38
  var continueToNextStep = useCallback(function () {
37
39
  setIsSubmitting(false);
38
40
  setCurrentStep(function (prev) {
@@ -212,6 +214,11 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
212
214
  return _ref5.apply(this, arguments);
213
215
  };
214
216
  }();
217
+ var handleExperimentalSecondarySubmit = function handleExperimentalSecondarySubmit() {
218
+ if (typeof (experimentalSecondarySubmit === null || experimentalSecondarySubmit === void 0 ? void 0 : experimentalSecondarySubmit.onClick) === 'function') {
219
+ experimentalSecondarySubmit.onClick();
220
+ }
221
+ };
215
222
  if ((stepData === null || stepData === void 0 ? void 0 : stepData.length) > 0) {
216
223
  var buttons = [];
217
224
  if ((stepData === null || stepData === void 0 ? void 0 : stepData.length) > 1) {
@@ -232,6 +239,15 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
232
239
  } : onUnmount,
233
240
  kind: 'ghost'
234
241
  });
242
+ if (experimentalSecondarySubmitText && !(experimentalSecondarySubmit !== null && experimentalSecondarySubmit !== void 0 && experimentalSecondarySubmit.hideSecondarySubmit)) {
243
+ buttons.push({
244
+ key: 'create-action-button-experimentalSecondarySubmit',
245
+ label: experimentalSecondarySubmitText,
246
+ onClick: handleExperimentalSecondarySubmit,
247
+ kind: 'secondary',
248
+ disabled: experimentalSecondarySubmit === null || experimentalSecondarySubmit === void 0 ? void 0 : experimentalSecondarySubmit.disabled
249
+ });
250
+ }
235
251
  buttons.push({
236
252
  key: 'create-action-button-submit',
237
253
  label: currentStep < lastIncludedStep ? nextButtonText : submitButtonText,
@@ -243,7 +259,7 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
243
259
  });
244
260
  setCreateComponentActions(buttons);
245
261
  }
246
- }, [firstIncludedStep, lastIncludedStep, stepData, onNext, isSubmitDisabled, backButtonText, cancelButtonText, currentStep, onClose, nextButtonText, submitButtonText, onRequestSubmit, isSubmitting, componentBlockClass, componentName, continueToNextStep, setCurrentStep, setCreateComponentActions, setIsSubmitting, setModalIsOpen, moveToPreviousStep, onPrevious, setLoadingPrevious, loadingPrevious]);
262
+ }, [firstIncludedStep, lastIncludedStep, stepData, onNext, isSubmitDisabled, backButtonText, cancelButtonText, currentStep, onClose, nextButtonText, submitButtonText, onRequestSubmit, isSubmitting, componentBlockClass, componentName, continueToNextStep, setCurrentStep, setCreateComponentActions, setIsSubmitting, setModalIsOpen, moveToPreviousStep, onPrevious, setLoadingPrevious, loadingPrevious, experimentalSecondarySubmit, experimentalSecondarySubmitText]);
247
263
  };
248
264
 
249
265
  export { useCreateComponentStepChange };
@@ -5,8 +5,10 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { Dispatch, PropsWithChildren, ReactNode, SetStateAction } from 'react';
8
+ import { ExperimentalSecondarySubmit } from './CreateTearsheetStep';
8
9
  export interface StepsContextType {
9
10
  currentStep: number;
11
+ setExperimentalSecondarySubmit: Dispatch<SetStateAction<ExperimentalSecondarySubmit>>;
10
12
  setIsDisabled: Dispatch<SetStateAction<boolean>>;
11
13
  setOnPrevious: (fn: any) => void;
12
14
  setOnNext: (fn: any) => void;
@@ -32,6 +34,10 @@ export interface CreateTearsheetProps extends PropsWithChildren {
32
34
  * An optional class or classes to be added to the outermost element.
33
35
  */
34
36
  className?: string;
37
+ /**
38
+ * The experimentalSecondary submit button text
39
+ */
40
+ experimentalSecondarySubmitText?: string;
35
41
  /**
36
42
  * A description of the flow, displayed in the header area of the tearsheet.
37
43
  */
@@ -31,7 +31,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
31
31
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
32
32
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
33
33
 
34
- var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "description", "influencerWidth", "initialStep", "label", "nextButtonText", "onClose", "onRequestSubmit", "open", "firstFocusElement", "slug", "submitButtonText", "title", "verticalPosition"];
34
+ var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "experimentalSecondarySubmitText", "description", "influencerWidth", "initialStep", "label", "nextButtonText", "onClose", "onRequestSubmit", "open", "firstFocusElement", "slug", "submitButtonText", "title", "verticalPosition"];
35
35
  var componentName = 'CreateTearsheet';
36
36
  var blockClass = "".concat(settings.pkg.prefix, "--tearsheet-create");
37
37
 
@@ -49,6 +49,7 @@ exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
49
49
  cancelButtonText = _ref.cancelButtonText,
50
50
  children = _ref.children,
51
51
  className = _ref.className,
52
+ experimentalSecondarySubmitText = _ref.experimentalSecondarySubmitText,
52
53
  description = _ref.description,
53
54
  _ref$influencerWidth = _ref.influencerWidth,
54
55
  influencerWidth = _ref$influencerWidth === void 0 ? 'narrow' : _ref$influencerWidth,
@@ -113,6 +114,10 @@ exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
113
114
  _useState24 = _rollupPluginBabelHelpers.slicedToArray(_useState23, 2),
114
115
  lastIncludedStep = _useState24[0],
115
116
  setLastIncludedStep = _useState24[1];
117
+ var _useState25 = React.useState({}),
118
+ _useState26 = _rollupPluginBabelHelpers.slicedToArray(_useState25, 2),
119
+ experimentalSecondarySubmit = _useState26[0],
120
+ setExperimentalSecondarySubmit = _useState26[1];
116
121
  var previousState = usePreviousValue.usePreviousValue({
117
122
  currentStep: currentStep,
118
123
  open: open
@@ -179,6 +184,8 @@ exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
179
184
  nextButtonText: nextButtonText,
180
185
  isSubmitting: isSubmitting,
181
186
  componentBlockClass: blockClass,
187
+ experimentalSecondarySubmit: experimentalSecondarySubmit,
188
+ experimentalSecondarySubmitText: experimentalSecondarySubmit.labelText ? experimentalSecondarySubmit.labelText : experimentalSecondarySubmitText,
182
189
  setCreateComponentActions: setCreateTearsheetActions
183
190
  });
184
191
  return /*#__PURE__*/React__default["default"].createElement(TearsheetShell.TearsheetShell, _rollupPluginBabelHelpers["extends"]({}, devtools.getDevtoolsProps(componentName), rest, {
@@ -207,6 +214,7 @@ exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
207
214
  }, /*#__PURE__*/React__default["default"].createElement(StepsContext.Provider, {
208
215
  value: {
209
216
  currentStep: currentStep,
217
+ setExperimentalSecondarySubmit: setExperimentalSecondarySubmit,
210
218
  setIsDisabled: setIsDisabled,
211
219
  setOnPrevious: function setOnPrevious(fn) {
212
220
  return _setOnPrevious(function () {
@@ -263,6 +271,10 @@ exports.CreateTearsheet.propTypes = {
263
271
  * A description of the flow, displayed in the header area of the tearsheet.
264
272
  */
265
273
  description: index["default"].node,
274
+ /**
275
+ * The experimentalSecondary submit button text
276
+ */
277
+ experimentalSecondarySubmitText: index["default"].string,
266
278
  /**
267
279
  * Specifies elements to focus on first on render.
268
280
  */
@@ -49,6 +49,10 @@ interface CreateTearsheetStepBaseProps extends PropsWithChildren {
49
49
  * This will conditionally disable the submit button in the multi step Tearsheet
50
50
  */
51
51
  disableSubmit?: boolean;
52
+ /**
53
+ * Configuration options for customizing the behavior of the experimentalSecondary submit button.
54
+ */
55
+ experimentalSecondarySubmit?: ExperimentalSecondarySubmit;
52
56
  /**
53
57
  * 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
54
58
  * 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
@@ -91,5 +95,19 @@ interface CreateTearsheetStepBaseProps extends PropsWithChildren {
91
95
  title: React.ReactNode;
92
96
  }
93
97
  type CreateTearsheetStepProps = CreateTearsheetStepBaseProps & fieldsetLegendTextProps;
98
+ /**
99
+ * Configuration options for customizing the behavior of the experimentalSecondary submit button.
100
+ *
101
+ * @property {string} [labelText] - Optional text to replace the default button text.
102
+ * @property {boolean} [disabled] - If true, the button will be disabled and not clickable.
103
+ * @property {boolean} [hideSecondarySubmit] - If true, the button will be hidden from view.
104
+ * @property {() => void} [onClick] - Optional click handler function to be executed when the button is clicked.
105
+ */
106
+ export type ExperimentalSecondarySubmit = {
107
+ labelText?: string;
108
+ disabled?: boolean;
109
+ hideSecondarySubmit?: boolean;
110
+ onClick?: () => void;
111
+ };
94
112
  export declare let CreateTearsheetStep: React.ForwardRefExoticComponent<CreateTearsheetStepProps & React.RefAttributes<unknown>>;
95
113
  export {};
@@ -25,7 +25,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
25
25
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
26
26
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
27
27
 
28
- var _excluded = ["children", "className", "description", "disableSubmit", "fieldsetLegendText", "hasFieldset", "includeStep", "introStep", "invalid", "onMount", "onNext", "onPrevious", "secondaryLabel", "subtitle", "title"];
28
+ var _excluded = ["children", "className", "description", "disableSubmit", "experimentalSecondarySubmit", "fieldsetLegendText", "hasFieldset", "includeStep", "introStep", "invalid", "onMount", "onNext", "onPrevious", "secondaryLabel", "subtitle", "title"];
29
29
  var componentName = 'CreateTearsheetStep';
30
30
  var blockClass = "".concat(settings.pkg.prefix, "--tearsheet-create__step");
31
31
 
@@ -34,11 +34,22 @@ var defaults = {
34
34
  hasFieldset: true,
35
35
  includeStep: true
36
36
  };
37
+
38
+ /**
39
+ * Configuration options for customizing the behavior of the experimentalSecondary submit button.
40
+ *
41
+ * @property {string} [labelText] - Optional text to replace the default button text.
42
+ * @property {boolean} [disabled] - If true, the button will be disabled and not clickable.
43
+ * @property {boolean} [hideSecondarySubmit] - If true, the button will be hidden from view.
44
+ * @property {() => void} [onClick] - Optional click handler function to be executed when the button is clicked.
45
+ */
46
+
37
47
  exports.CreateTearsheetStep = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
38
48
  var children = _ref.children,
39
49
  className = _ref.className,
40
50
  description = _ref.description,
41
51
  disableSubmit = _ref.disableSubmit,
52
+ experimentalSecondarySubmit = _ref.experimentalSecondarySubmit,
42
53
  fieldsetLegendText = _ref.fieldsetLegendText,
43
54
  _ref$hasFieldset = _ref.hasFieldset,
44
55
  hasFieldset = _ref$hasFieldset === void 0 ? defaults.hasFieldset : _ref$hasFieldset,
@@ -80,8 +91,9 @@ exports.CreateTearsheetStep = /*#__PURE__*/React.forwardRef(function (_ref, ref)
80
91
  React.useEffect(function () {
81
92
  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)) {
82
93
  stepsContext === null || stepsContext === void 0 || stepsContext.setOnMount(onMount);
94
+ stepsContext === null || stepsContext === void 0 || stepsContext.setExperimentalSecondarySubmit(_rollupPluginBabelHelpers.objectSpread2({}, experimentalSecondarySubmit));
83
95
  }
84
- }, [onMount, stepsContext, stepNumber, previousState === null || previousState === void 0 ? void 0 : previousState.currentStep]);
96
+ }, [onMount, experimentalSecondarySubmit, stepsContext, stepNumber, previousState === null || previousState === void 0 ? void 0 : previousState.currentStep]);
85
97
 
86
98
  // Used to take the `includeStep` prop and use it as a local state value
87
99
  React.useEffect(function () {
@@ -172,6 +184,21 @@ exports.CreateTearsheetStep.propTypes = {
172
184
  * This will conditionally disable the submit button in the multi step Tearsheet
173
185
  */
174
186
  disableSubmit: index["default"].bool,
187
+ /**
188
+ * Configuration options for customizing the behavior of the experimentalSecondary submit button.
189
+ *
190
+ * @property {string} [labelText] - Optional text to replace the default button text.
191
+ * @property {boolean} [disabled] - If true, the button will be disabled and not clickable.
192
+ * @property {boolean} [hideSecondarySubmit] - If true, the button will be hidden from view.
193
+ * @property {() => void} [onClick] - Optional click handler function to be executed when the button is clicked.
194
+ */
195
+ /**@ts-ignore*/
196
+ experimentalSecondarySubmit: index["default"].shape({
197
+ labelText: index["default"].string,
198
+ disabled: index["default"].bool,
199
+ hideSecondarySubmit: index["default"].bool,
200
+ onClick: index["default"].func
201
+ }),
175
202
  /**
176
203
  * This is the required legend text that appears above a fieldset html element for accessibility purposes.
177
204
  * You can set the `hasFieldset` prop to false if you have multiple fieldset elements or want to control the children of your Full Page's step content.
@@ -1,4 +1,4 @@
1
- export function useCreateComponentStepChange({ firstIncludedStep, lastIncludedStep, stepData, onPrevious, onNext, isSubmitDisabled, setCurrentStep, setIsSubmitting, setLoadingPrevious, loadingPrevious, onClose, onRequestSubmit, componentName, currentStep, backButtonText, cancelButtonText, submitButtonText, nextButtonText, isSubmitting, componentBlockClass, setCreateComponentActions, setModalIsOpen, }: {
1
+ export function useCreateComponentStepChange({ firstIncludedStep, lastIncludedStep, stepData, onPrevious, onNext, isSubmitDisabled, setCurrentStep, setIsSubmitting, setLoadingPrevious, loadingPrevious, onClose, onRequestSubmit, componentName, currentStep, backButtonText, cancelButtonText, submitButtonText, nextButtonText, isSubmitting, componentBlockClass, setCreateComponentActions, setModalIsOpen, experimentalSecondarySubmit, experimentalSecondarySubmitText, }: {
2
2
  firstIncludedStep: any;
3
3
  lastIncludedStep: any;
4
4
  stepData: any;
@@ -21,4 +21,6 @@ export function useCreateComponentStepChange({ firstIncludedStep, lastIncludedSt
21
21
  componentBlockClass: any;
22
22
  setCreateComponentActions: any;
23
23
  setModalIsOpen: any;
24
+ experimentalSecondarySubmit: any;
25
+ experimentalSecondarySubmitText: any;
24
26
  }): void;
@@ -36,7 +36,9 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
36
36
  isSubmitting = _ref.isSubmitting,
37
37
  componentBlockClass = _ref.componentBlockClass,
38
38
  setCreateComponentActions = _ref.setCreateComponentActions,
39
- setModalIsOpen = _ref.setModalIsOpen;
39
+ setModalIsOpen = _ref.setModalIsOpen,
40
+ experimentalSecondarySubmit = _ref.experimentalSecondarySubmit,
41
+ experimentalSecondarySubmitText = _ref.experimentalSecondarySubmitText;
40
42
  var continueToNextStep = React.useCallback(function () {
41
43
  setIsSubmitting(false);
42
44
  setCurrentStep(function (prev) {
@@ -216,6 +218,11 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
216
218
  return _ref5.apply(this, arguments);
217
219
  };
218
220
  }();
221
+ var handleExperimentalSecondarySubmit = function handleExperimentalSecondarySubmit() {
222
+ if (typeof (experimentalSecondarySubmit === null || experimentalSecondarySubmit === void 0 ? void 0 : experimentalSecondarySubmit.onClick) === 'function') {
223
+ experimentalSecondarySubmit.onClick();
224
+ }
225
+ };
219
226
  if ((stepData === null || stepData === void 0 ? void 0 : stepData.length) > 0) {
220
227
  var buttons = [];
221
228
  if ((stepData === null || stepData === void 0 ? void 0 : stepData.length) > 1) {
@@ -236,6 +243,15 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
236
243
  } : onUnmount,
237
244
  kind: 'ghost'
238
245
  });
246
+ if (experimentalSecondarySubmitText && !(experimentalSecondarySubmit !== null && experimentalSecondarySubmit !== void 0 && experimentalSecondarySubmit.hideSecondarySubmit)) {
247
+ buttons.push({
248
+ key: 'create-action-button-experimentalSecondarySubmit',
249
+ label: experimentalSecondarySubmitText,
250
+ onClick: handleExperimentalSecondarySubmit,
251
+ kind: 'secondary',
252
+ disabled: experimentalSecondarySubmit === null || experimentalSecondarySubmit === void 0 ? void 0 : experimentalSecondarySubmit.disabled
253
+ });
254
+ }
239
255
  buttons.push({
240
256
  key: 'create-action-button-submit',
241
257
  label: currentStep < lastIncludedStep ? nextButtonText : submitButtonText,
@@ -247,7 +263,7 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
247
263
  });
248
264
  setCreateComponentActions(buttons);
249
265
  }
250
- }, [firstIncludedStep, lastIncludedStep, stepData, onNext, isSubmitDisabled, backButtonText, cancelButtonText, currentStep, onClose, nextButtonText, submitButtonText, onRequestSubmit, isSubmitting, componentBlockClass, componentName, continueToNextStep, setCurrentStep, setCreateComponentActions, setIsSubmitting, setModalIsOpen, moveToPreviousStep, onPrevious, setLoadingPrevious, loadingPrevious]);
266
+ }, [firstIncludedStep, lastIncludedStep, stepData, onNext, isSubmitDisabled, backButtonText, cancelButtonText, currentStep, onClose, nextButtonText, submitButtonText, onRequestSubmit, isSubmitting, componentBlockClass, componentName, continueToNextStep, setCurrentStep, setCreateComponentActions, setIsSubmitting, setModalIsOpen, moveToPreviousStep, onPrevious, setLoadingPrevious, loadingPrevious, experimentalSecondarySubmit, experimentalSecondarySubmitText]);
251
267
  };
252
268
 
253
269
  exports.useCreateComponentStepChange = useCreateComponentStepChange;
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.210+fac868b0b",
4
+ "version": "2.43.2-canary.211+d5f953890",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -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": "fac868b0bb3382aac79ab2780480d58e901da517"
123
+ "gitHead": "d5f9538902233075e38a60abf70efc52838f5804"
124
124
  }