carbon-react 106.7.0 → 107.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.d.ts +0 -0
- package/esm/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.js +0 -0
- package/esm/components/badge/badge.style.d.ts +1 -1
- package/esm/components/button/button.component.d.ts +1 -3
- package/esm/components/button/button.component.js +1 -12
- package/esm/components/button/button.style.d.ts +1 -1
- package/esm/components/button-toggle-group/button-toggle-group.component.js +1 -1
- package/esm/components/confirm/confirm.component.d.ts +1 -5
- package/esm/components/confirm/confirm.component.js +2 -14
- package/esm/components/confirm/confirm.d.ts +0 -2
- package/esm/components/dialog-full-screen/content.style.js +4 -10
- package/esm/components/heading/heading.component.d.ts +27 -52
- package/esm/components/heading/heading.component.js +86 -170
- package/esm/components/heading/heading.d.ts +5 -3
- package/esm/components/i18n-provider/i18n-provider.component.d.ts +0 -9
- package/esm/components/i18n-provider/i18n-provider.component.js +0 -9
- package/esm/components/menu/index.d.ts +0 -1
- package/esm/components/menu/index.js +0 -1
- package/esm/components/menu/menu-item/menu-item.component.js +0 -6
- package/esm/components/multi-action-button/multi-action-button.component.d.ts +1 -1
- package/esm/components/multi-action-button/multi-action-button.component.js +1 -11
- package/esm/components/navigation-bar/navigation-bar.component.d.ts +1 -6
- package/esm/components/navigation-bar/navigation-bar.component.js +1 -15
- package/esm/components/navigation-bar/navigation-bar.style.d.ts +0 -4
- package/esm/components/navigation-bar/navigation-bar.style.js +0 -8
- package/esm/components/radio-button/radio-button-group.component.js +1 -1
- package/esm/components/select/select-list/select-list.component.js +2 -2
- package/esm/components/simple-color-picker/simple-color-picker.component.js +1 -1
- package/esm/components/split-button/split-button-toggle.style.d.ts +1 -1
- package/esm/components/split-button/split-button.component.d.ts +1 -4
- package/esm/components/split-button/split-button.component.js +3 -16
- package/esm/components/split-button/split-button.d.ts +0 -2
- package/esm/components/tile/tile.component.d.ts +1 -2
- package/esm/components/tile/tile.component.js +1 -13
- package/esm/components/tile/tile.d.ts +0 -2
- package/esm/components/tile-select/tile-select-group.component.js +1 -1
- package/esm/components/toast/toast.component.d.ts +1 -4
- package/esm/components/toast/toast.component.js +1 -13
- package/esm/components/toast/toast.d.ts +0 -2
- package/esm/locales/en-gb.js +0 -9
- package/esm/locales/locale.d.ts +0 -9
- package/esm/locales/pl-pl.js +0 -9
- package/lib/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.d.ts +0 -0
- package/lib/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.js +0 -0
- package/lib/components/badge/badge.style.d.ts +1 -1
- package/lib/components/button/button.component.d.ts +1 -3
- package/lib/components/button/button.component.js +1 -14
- package/lib/components/button/button.style.d.ts +1 -1
- package/lib/components/button-toggle-group/button-toggle-group.component.js +1 -1
- package/lib/components/confirm/confirm.component.d.ts +1 -5
- package/lib/components/confirm/confirm.component.js +2 -17
- package/lib/components/confirm/confirm.d.ts +0 -2
- package/lib/components/dialog-full-screen/content.style.js +4 -10
- package/lib/components/heading/heading.component.d.ts +27 -52
- package/lib/components/heading/heading.component.js +86 -170
- package/lib/components/heading/heading.d.ts +5 -3
- package/lib/components/i18n-provider/i18n-provider.component.d.ts +0 -9
- package/lib/components/i18n-provider/i18n-provider.component.js +0 -9
- package/lib/components/menu/index.d.ts +0 -1
- package/lib/components/menu/index.js +0 -8
- package/lib/components/menu/menu-item/menu-item.component.js +0 -7
- package/lib/components/multi-action-button/multi-action-button.component.d.ts +1 -1
- package/lib/components/multi-action-button/multi-action-button.component.js +1 -14
- package/lib/components/navigation-bar/navigation-bar.component.d.ts +1 -6
- package/lib/components/navigation-bar/navigation-bar.component.js +1 -18
- package/lib/components/navigation-bar/navigation-bar.style.d.ts +0 -4
- package/lib/components/navigation-bar/navigation-bar.style.js +0 -8
- package/lib/components/radio-button/radio-button-group.component.js +1 -1
- package/lib/components/select/select-list/select-list.component.js +2 -2
- package/lib/components/simple-color-picker/simple-color-picker.component.js +1 -1
- package/lib/components/split-button/split-button-toggle.style.d.ts +1 -1
- package/lib/components/split-button/split-button.component.d.ts +1 -4
- package/lib/components/split-button/split-button.component.js +3 -18
- package/lib/components/split-button/split-button.d.ts +0 -2
- package/lib/components/tile/tile.component.d.ts +1 -2
- package/lib/components/tile/tile.component.js +1 -16
- package/lib/components/tile/tile.d.ts +0 -2
- package/lib/components/tile-select/tile-select-group.component.js +1 -1
- package/lib/components/toast/toast.component.d.ts +1 -4
- package/lib/components/toast/toast.component.js +1 -16
- package/lib/components/toast/toast.d.ts +0 -2
- package/lib/locales/en-gb.js +0 -9
- package/lib/locales/locale.d.ts +0 -9
- package/lib/locales/pl-pl.js +0 -9
- package/package.json +1 -1
- package/esm/components/app-wrapper/app-wrapper.component.d.ts +0 -25
- package/esm/components/app-wrapper/app-wrapper.component.js +0 -104
- package/esm/components/app-wrapper/app-wrapper.d.ts +0 -12
- package/esm/components/app-wrapper/app-wrapper.style.d.ts +0 -2
- package/esm/components/app-wrapper/app-wrapper.style.js +0 -17
- package/esm/components/app-wrapper/index.d.ts +0 -1
- package/esm/components/app-wrapper/index.js +0 -1
- package/esm/components/menu/submenu-block/index.d.ts +0 -2
- package/esm/components/menu/submenu-block/index.js +0 -1
- package/esm/components/menu/submenu-block/submenu-block.component.d.ts +0 -12
- package/esm/components/menu/submenu-block/submenu-block.component.js +0 -34
- package/esm/components/menu/submenu-block/submenu-block.d.ts +0 -12
- package/esm/components/menu/submenu-block/submenu-block.style.d.ts +0 -2
- package/esm/components/menu/submenu-block/submenu-block.style.js +0 -16
- package/esm/components/mount-in-app/__spec__.d.ts +0 -1
- package/esm/components/mount-in-app/__spec__.js +0 -47
- package/esm/components/mount-in-app/index.d.ts +0 -1
- package/esm/components/mount-in-app/mount-in-app.d.ts +0 -12
- package/esm/components/mount-in-app/mount-in-app.js +0 -90
- package/esm/components/mount-in-app/package.json +0 -3
- package/esm/components/multi-step-wizard/__spec__.d.ts +0 -1
- package/esm/components/multi-step-wizard/__spec__.js +0 -191
- package/esm/components/multi-step-wizard/multi-step-wizard.d.ts +0 -109
- package/esm/components/multi-step-wizard/multi-step-wizard.js +0 -383
- package/esm/components/multi-step-wizard/multi-step-wizard.style.d.ts +0 -2
- package/esm/components/multi-step-wizard/multi-step-wizard.style.js +0 -10
- package/esm/components/multi-step-wizard/package.json +0 -4
- package/esm/components/multi-step-wizard/step/__spec__.d.ts +0 -1
- package/esm/components/multi-step-wizard/step/__spec__.js +0 -399
- package/esm/components/multi-step-wizard/step/package.json +0 -4
- package/esm/components/multi-step-wizard/step/step.d.ts +0 -166
- package/esm/components/multi-step-wizard/step/step.js +0 -407
- package/esm/components/multi-step-wizard/step/step.style.d.ts +0 -13
- package/esm/components/multi-step-wizard/step/step.style.js +0 -138
- package/esm/components/scrollable-list/as-scrollable-list-item.wrapper.d.ts +0 -2
- package/esm/components/scrollable-list/as-scrollable-list-item.wrapper.js +0 -10
- package/esm/components/scrollable-list/index.d.ts +0 -4
- package/esm/components/scrollable-list/index.js +0 -4
- package/esm/components/scrollable-list/scrollable-list-item.component.d.ts +0 -2
- package/esm/components/scrollable-list/scrollable-list-item.component.js +0 -26
- package/esm/components/scrollable-list/scrollable-list.component.d.ts +0 -52
- package/esm/components/scrollable-list/scrollable-list.component.js +0 -306
- package/esm/components/scrollable-list/scrollable-list.context.d.ts +0 -3
- package/esm/components/scrollable-list/scrollable-list.context.js +0 -2
- package/esm/components/scrollable-list/scrollable-list.style.d.ts +0 -2
- package/esm/components/scrollable-list/scrollable-list.style.js +0 -30
- package/esm/components/scrollable-list/test-utils.d.ts +0 -2
- package/esm/components/scrollable-list/test-utils.js +0 -25
- package/lib/components/app-wrapper/app-wrapper.component.d.ts +0 -25
- package/lib/components/app-wrapper/app-wrapper.component.js +0 -120
- package/lib/components/app-wrapper/app-wrapper.d.ts +0 -12
- package/lib/components/app-wrapper/app-wrapper.style.d.ts +0 -2
- package/lib/components/app-wrapper/app-wrapper.style.js +0 -28
- package/lib/components/app-wrapper/index.d.ts +0 -1
- package/lib/components/app-wrapper/index.js +0 -15
- package/lib/components/app-wrapper/package.json +0 -6
- package/lib/components/menu/submenu-block/index.d.ts +0 -2
- package/lib/components/menu/submenu-block/index.js +0 -15
- package/lib/components/menu/submenu-block/package.json +0 -6
- package/lib/components/menu/submenu-block/submenu-block.component.d.ts +0 -12
- package/lib/components/menu/submenu-block/submenu-block.component.js +0 -53
- package/lib/components/menu/submenu-block/submenu-block.d.ts +0 -12
- package/lib/components/menu/submenu-block/submenu-block.style.d.ts +0 -2
- package/lib/components/menu/submenu-block/submenu-block.style.js +0 -33
- package/lib/components/mount-in-app/__spec__.d.ts +0 -1
- package/lib/components/mount-in-app/__spec__.js +0 -55
- package/lib/components/mount-in-app/index.d.ts +0 -1
- package/lib/components/mount-in-app/mount-in-app.d.ts +0 -12
- package/lib/components/mount-in-app/mount-in-app.js +0 -105
- package/lib/components/mount-in-app/package.json +0 -3
- package/lib/components/multi-step-wizard/__spec__.d.ts +0 -1
- package/lib/components/multi-step-wizard/__spec__.js +0 -202
- package/lib/components/multi-step-wizard/multi-step-wizard.d.ts +0 -109
- package/lib/components/multi-step-wizard/multi-step-wizard.js +0 -397
- package/lib/components/multi-step-wizard/multi-step-wizard.style.d.ts +0 -2
- package/lib/components/multi-step-wizard/multi-step-wizard.style.js +0 -21
- package/lib/components/multi-step-wizard/package.json +0 -4
- package/lib/components/multi-step-wizard/step/__spec__.d.ts +0 -1
- package/lib/components/multi-step-wizard/step/__spec__.js +0 -409
- package/lib/components/multi-step-wizard/step/package.json +0 -4
- package/lib/components/multi-step-wizard/step/step.d.ts +0 -166
- package/lib/components/multi-step-wizard/step/step.js +0 -421
- package/lib/components/multi-step-wizard/step/step.style.d.ts +0 -13
- package/lib/components/multi-step-wizard/step/step.style.js +0 -162
- package/lib/components/scrollable-list/as-scrollable-list-item.wrapper.d.ts +0 -2
- package/lib/components/scrollable-list/as-scrollable-list-item.wrapper.js +0 -21
- package/lib/components/scrollable-list/index.d.ts +0 -4
- package/lib/components/scrollable-list/index.js +0 -31
- package/lib/components/scrollable-list/package.json +0 -6
- package/lib/components/scrollable-list/scrollable-list-item.component.d.ts +0 -2
- package/lib/components/scrollable-list/scrollable-list-item.component.js +0 -42
- package/lib/components/scrollable-list/scrollable-list.component.d.ts +0 -52
- package/lib/components/scrollable-list/scrollable-list.component.js +0 -328
- package/lib/components/scrollable-list/scrollable-list.context.d.ts +0 -3
- package/lib/components/scrollable-list/scrollable-list.context.js +0 -14
- package/lib/components/scrollable-list/scrollable-list.style.d.ts +0 -2
- package/lib/components/scrollable-list/scrollable-list.style.js +0 -41
- package/lib/components/scrollable-list/test-utils.d.ts +0 -2
- package/lib/components/scrollable-list/test-utils.js +0 -37
|
@@ -1,397 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
|
-
var _step = _interopRequireDefault(require("./step"));
|
|
13
|
-
|
|
14
|
-
var _multiStepWizard = require("./multi-step-wizard.style");
|
|
15
|
-
|
|
16
|
-
var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
|
-
|
|
22
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
23
|
-
|
|
24
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
25
|
-
|
|
26
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
27
|
-
|
|
28
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
29
|
-
|
|
30
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
31
|
-
|
|
32
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
33
|
-
|
|
34
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
35
|
-
|
|
36
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
37
|
-
|
|
38
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
39
|
-
|
|
40
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
|
-
|
|
42
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* A MultiStepWizard widget.
|
|
46
|
-
*
|
|
47
|
-
* == How to use a MultiStepWizard in a component:
|
|
48
|
-
*
|
|
49
|
-
* In your file:
|
|
50
|
-
*
|
|
51
|
-
* import MultiStepWizard from 'carbon-react/lib/components/multi-step-wizard';
|
|
52
|
-
*
|
|
53
|
-
* To render the Wizard:
|
|
54
|
-
*
|
|
55
|
-
* <MultiStepWizard steps={ [<Step1 />, <Step2 />, ...] } />
|
|
56
|
-
*
|
|
57
|
-
* The component rendering the wizard must pass down a prop of 'steps' where you need to provide an array of custom
|
|
58
|
-
* step components. Note that Step components must be objects and you can pass props to Step components, e.g.
|
|
59
|
-
* <MultiStepWizard steps={ [<Textbox onChange={ this.updateTextboxValue } />, <div className='some-style' />] } />
|
|
60
|
-
*
|
|
61
|
-
* You also need to provide a 'onSubmit' handler to handle a submit event.
|
|
62
|
-
*
|
|
63
|
-
* The wizard also takes a 'currentStep' prop with an integer to specify a step you want to start with.
|
|
64
|
-
* e.g. currentStep={ 2 }. The wizard starts with the first step by default.
|
|
65
|
-
*
|
|
66
|
-
* The wizard disables inactive steps by default. If you wish to enable inactive steps, pass a 'enableInactiveSteps'
|
|
67
|
-
* prop and set it to true.
|
|
68
|
-
*
|
|
69
|
-
* The wizard generates Next and Back buttons by default. If you wish to use custom buttons to replace the default ones
|
|
70
|
-
* in a step component, you can pass a 'defaultButton' prop in the corresponding step component and set it to false.
|
|
71
|
-
* Also, if you want to add additional buttons beside the default Next and Back buttons, you can pass a 'extraButtons'
|
|
72
|
-
* prop in the corresponding step component with your extra buttons.
|
|
73
|
-
* Individual Steps can be optionally disabled by a passing a prop of `enabled={ false }`.
|
|
74
|
-
* e.g. <MultiStepWizard steps={ [<Step1 defaultButton={ false } />, <Step2 />] } />
|
|
75
|
-
* <MultiStepWizard steps={ [<Step1 />, <Step2 extraButtons={ [<Button>Cancel</Button>] }) />] } />
|
|
76
|
-
* <MultiStepWizard steps={ [<Step1 />, <Step2 enabled={ false } />] } />
|
|
77
|
-
*
|
|
78
|
-
* The wizard provides the ability to hook into the handle next/back/submit methods.
|
|
79
|
-
* (1) By passing a 'beforeSubmitValidation' prop in the wizard, you can add custom logic before a submit event, and
|
|
80
|
-
* the submit event can be completed only when the 'beforeSubmitValidation' prop returns 'true'.
|
|
81
|
-
* (2) By passing 'onNext' prop in the corresponding step component,
|
|
82
|
-
* you can add custom logic when moving a step forward, and
|
|
83
|
-
* the 'onNext' prop overrides the step's default behaviour of moving next.
|
|
84
|
-
* (3) By passing 'onBack' prop in the corresponding step component,
|
|
85
|
-
* you can add custom logic when moving a step backward, and
|
|
86
|
-
* the 'onBack' prop overrides the step's default behaviour of moving back.
|
|
87
|
-
* e.g. <MultiStepWizard steps={ [
|
|
88
|
-
* <Step1 onNext={ this.customMethodOnNext }/>,
|
|
89
|
-
* <Step2 onBack={ this.customMethodOnBack }) />
|
|
90
|
-
* ] } />
|
|
91
|
-
* <MultiStepWizard beforeSubmitValidation={ this.customValidation } onSubmit={ this.customMethodOnSubmit } />
|
|
92
|
-
*
|
|
93
|
-
* If you want to complete the wizard without going through steps, you can pass a 'completed' prop and set it to true.
|
|
94
|
-
*
|
|
95
|
-
* @class MultiStepWizard
|
|
96
|
-
* @constructor
|
|
97
|
-
*/
|
|
98
|
-
let deprecatedWarnTriggered = false;
|
|
99
|
-
|
|
100
|
-
let MultiStepWizard = /*#__PURE__*/function (_React$Component) {
|
|
101
|
-
_inherits(MultiStepWizard, _React$Component);
|
|
102
|
-
|
|
103
|
-
var _super = _createSuper(MultiStepWizard);
|
|
104
|
-
|
|
105
|
-
function MultiStepWizard(props) {
|
|
106
|
-
var _this;
|
|
107
|
-
|
|
108
|
-
_classCallCheck(this, MultiStepWizard);
|
|
109
|
-
|
|
110
|
-
_this = _super.call(this, props);
|
|
111
|
-
|
|
112
|
-
_defineProperty(_assertThisInitialized(_this), "validateStepProps", stepProps => {
|
|
113
|
-
const step = stepProps.currentStep;
|
|
114
|
-
const {
|
|
115
|
-
completed
|
|
116
|
-
} = stepProps;
|
|
117
|
-
const totalSteps = stepProps.steps.length;
|
|
118
|
-
|
|
119
|
-
if (completed === true) {
|
|
120
|
-
return {
|
|
121
|
-
currentStep: totalSteps,
|
|
122
|
-
completed: true
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (parseInt(step, 10) !== step || step < 1 || step > totalSteps) {
|
|
127
|
-
return {
|
|
128
|
-
currentStep: 1,
|
|
129
|
-
completed: false
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return {
|
|
134
|
-
currentStep: step,
|
|
135
|
-
completed: false
|
|
136
|
-
};
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
_defineProperty(_assertThisInitialized(_this), "next", () => {
|
|
140
|
-
if (_this.state.currentStep < _this.totalSteps) {
|
|
141
|
-
_this.setState(prevState => ({
|
|
142
|
-
currentStep: prevState.currentStep + 1
|
|
143
|
-
}));
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
_defineProperty(_assertThisInitialized(_this), "back", () => {
|
|
148
|
-
if (_this.state.currentStep > 1) {
|
|
149
|
-
_this.setState(prevState => ({
|
|
150
|
-
completed: false,
|
|
151
|
-
currentStep: prevState.currentStep - 1
|
|
152
|
-
}));
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
_defineProperty(_assertThisInitialized(_this), "complete", () => {
|
|
157
|
-
if (_this.state.currentStep === _this.totalSteps) {
|
|
158
|
-
_this.setState({
|
|
159
|
-
completed: true
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
if (!deprecatedWarnTriggered) {
|
|
165
|
-
deprecatedWarnTriggered = true; // eslint-disable-next-line max-len
|
|
166
|
-
|
|
167
|
-
_logger.default.deprecate("`Multi Step Wizard` component is deprecated and will soon be removed. Please use Step Sequence instead.");
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return _this;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Returns wizard object to child components.
|
|
174
|
-
*
|
|
175
|
-
* @method getChildContext
|
|
176
|
-
* @return {void}
|
|
177
|
-
*/
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
_createClass(MultiStepWizard, [{
|
|
181
|
-
key: "getChildContext",
|
|
182
|
-
value: function getChildContext() {
|
|
183
|
-
return {
|
|
184
|
-
wizard: {
|
|
185
|
-
nextHandler: this.props.onNext,
|
|
186
|
-
backHandler: this.props.onBack,
|
|
187
|
-
beforeSubmitValidation: this.props.beforeSubmitValidation,
|
|
188
|
-
submitHandler: this.props.onSubmit,
|
|
189
|
-
enableInactiveSteps: this.props.enableInactiveSteps,
|
|
190
|
-
currentStep: this.state.currentStep,
|
|
191
|
-
completed: this.state.completed,
|
|
192
|
-
next: this.next,
|
|
193
|
-
back: this.back,
|
|
194
|
-
complete: this.complete,
|
|
195
|
-
totalSteps: this.totalSteps
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* A lifecycle method that is called before initial render.
|
|
201
|
-
* Can set up state of component without causing a re-render.
|
|
202
|
-
*
|
|
203
|
-
* @method componentWillMount
|
|
204
|
-
*/
|
|
205
|
-
|
|
206
|
-
}, {
|
|
207
|
-
key: "UNSAFE_componentWillMount",
|
|
208
|
-
value: function UNSAFE_componentWillMount() {
|
|
209
|
-
const validProps = this.validateStepProps(this.props);
|
|
210
|
-
this.setState({
|
|
211
|
-
currentStep: validProps.currentStep,
|
|
212
|
-
completed: validProps.completed
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* A lifecycle method to update the currentStep state when a new valid value has been specified.
|
|
217
|
-
*
|
|
218
|
-
* @method componentWillReceiveProps
|
|
219
|
-
* @param {Object} props The new props passed down to the component
|
|
220
|
-
* @return {void}
|
|
221
|
-
*/
|
|
222
|
-
|
|
223
|
-
}, {
|
|
224
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
225
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
226
|
-
const validProps = this.validateStepProps(nextProps);
|
|
227
|
-
this.setState({
|
|
228
|
-
currentStep: validProps.currentStep,
|
|
229
|
-
completed: validProps.completed
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Validate step props
|
|
234
|
-
*
|
|
235
|
-
* @method validateStepProps
|
|
236
|
-
* @return {Object}
|
|
237
|
-
*/
|
|
238
|
-
|
|
239
|
-
}, {
|
|
240
|
-
key: "totalSteps",
|
|
241
|
-
get:
|
|
242
|
-
/**
|
|
243
|
-
* Get total number of steps
|
|
244
|
-
*
|
|
245
|
-
* @method totalSteps
|
|
246
|
-
* @return {Number}
|
|
247
|
-
*/
|
|
248
|
-
function () {
|
|
249
|
-
return this.props.steps.length;
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Moves to the next step.
|
|
253
|
-
*
|
|
254
|
-
* @method next
|
|
255
|
-
* @return {void}
|
|
256
|
-
*/
|
|
257
|
-
|
|
258
|
-
}, {
|
|
259
|
-
key: "wizardStepsHTML",
|
|
260
|
-
get:
|
|
261
|
-
/**
|
|
262
|
-
* Returns the computed HTML for the wizard's steps.
|
|
263
|
-
*
|
|
264
|
-
* @method wizardStepsHTML
|
|
265
|
-
* @return {Object} JSX
|
|
266
|
-
*/
|
|
267
|
-
function () {
|
|
268
|
-
return this.props.steps.map((step, index) => {
|
|
269
|
-
return (
|
|
270
|
-
/*#__PURE__*/
|
|
271
|
-
// Step is never going to be re-ordered or changed so index is safe to use
|
|
272
|
-
|
|
273
|
-
/* eslint-disable react/no-array-index-key */
|
|
274
|
-
_react.default.createElement(_step.default, _extends({
|
|
275
|
-
stepNumber: index + 1,
|
|
276
|
-
key: `multi-step-wizard-step-${index}`
|
|
277
|
-
}, step.props), step)
|
|
278
|
-
/* eslint-enable react/no-array-index-key */
|
|
279
|
-
|
|
280
|
-
);
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* Renders the component.
|
|
285
|
-
*
|
|
286
|
-
* @method render
|
|
287
|
-
* @return {Object} JSX
|
|
288
|
-
*/
|
|
289
|
-
|
|
290
|
-
}, {
|
|
291
|
-
key: "render",
|
|
292
|
-
value: function render() {
|
|
293
|
-
return /*#__PURE__*/_react.default.createElement(_multiStepWizard.StyledMultiStepWizard, {
|
|
294
|
-
className: this.props.className
|
|
295
|
-
}, /*#__PURE__*/_react.default.createElement(_multiStepWizard.StyledMultiStepWizardContent, null, this.wizardStepsHTML));
|
|
296
|
-
}
|
|
297
|
-
}]);
|
|
298
|
-
|
|
299
|
-
return MultiStepWizard;
|
|
300
|
-
}(_react.default.Component);
|
|
301
|
-
|
|
302
|
-
MultiStepWizard.propTypes = {
|
|
303
|
-
/**
|
|
304
|
-
* Individual steps
|
|
305
|
-
*
|
|
306
|
-
* @property steps
|
|
307
|
-
* @type {Array}
|
|
308
|
-
*/
|
|
309
|
-
steps: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Custom function that is called immediately before a submit event
|
|
313
|
-
*
|
|
314
|
-
* @property beforeSubmitValidation
|
|
315
|
-
* @type {Function}
|
|
316
|
-
*/
|
|
317
|
-
beforeSubmitValidation: _propTypes.default.func,
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Custom className
|
|
321
|
-
*
|
|
322
|
-
* @property className
|
|
323
|
-
* @type {String}
|
|
324
|
-
*/
|
|
325
|
-
className: _propTypes.default.string,
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* A custom submit event handler
|
|
329
|
-
*
|
|
330
|
-
* @property onSubmit
|
|
331
|
-
* @type {Function}
|
|
332
|
-
*/
|
|
333
|
-
onSubmit: _propTypes.default.func.isRequired,
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* Current step
|
|
337
|
-
*
|
|
338
|
-
* @property currentStep
|
|
339
|
-
* @type {Number}
|
|
340
|
-
* @default 1
|
|
341
|
-
*/
|
|
342
|
-
currentStep: _propTypes.default.number,
|
|
343
|
-
// eslint-disable-line react/no-unused-prop-types
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Determines if the wizard disables inactive steps
|
|
347
|
-
*
|
|
348
|
-
* @property enableInactiveSteps
|
|
349
|
-
* @type {Boolean}
|
|
350
|
-
* @default false
|
|
351
|
-
*/
|
|
352
|
-
enableInactiveSteps: _propTypes.default.bool,
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* Add custom logic to next button
|
|
356
|
-
*
|
|
357
|
-
* @property onNext
|
|
358
|
-
*/
|
|
359
|
-
onNext: _propTypes.default.func,
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* Add custom logic to previous button
|
|
363
|
-
*
|
|
364
|
-
* @property onPrevious
|
|
365
|
-
*/
|
|
366
|
-
onBack: _propTypes.default.func,
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* The completion state of the wizard
|
|
370
|
-
*
|
|
371
|
-
* @property enableInactiveSteps
|
|
372
|
-
* @type {Boolean}
|
|
373
|
-
* @default false
|
|
374
|
-
*/
|
|
375
|
-
completed: _propTypes.default.bool // eslint-disable-line react/no-unused-prop-types
|
|
376
|
-
|
|
377
|
-
};
|
|
378
|
-
MultiStepWizard.defaultProps = {
|
|
379
|
-
beforeSubmitValidation: null,
|
|
380
|
-
className: "",
|
|
381
|
-
completed: false,
|
|
382
|
-
currentStep: 1,
|
|
383
|
-
enableInactiveSteps: false,
|
|
384
|
-
onNext: null,
|
|
385
|
-
onBack: null
|
|
386
|
-
};
|
|
387
|
-
MultiStepWizard.childContextTypes = {
|
|
388
|
-
/**
|
|
389
|
-
* Defines a context object for child components of this wizard.
|
|
390
|
-
*
|
|
391
|
-
* @property wizard
|
|
392
|
-
* @type {Object}
|
|
393
|
-
*/
|
|
394
|
-
wizard: _propTypes.default.object
|
|
395
|
-
};
|
|
396
|
-
var _default = MultiStepWizard;
|
|
397
|
-
exports.default = _default;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.StyledMultiStepWizardContent = exports.StyledMultiStepWizard = void 0;
|
|
7
|
-
|
|
8
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
const StyledMultiStepWizard = _styledComponents.default.div`
|
|
13
|
-
width: 100%;
|
|
14
|
-
`;
|
|
15
|
-
exports.StyledMultiStepWizard = StyledMultiStepWizard;
|
|
16
|
-
const StyledMultiStepWizardContent = _styledComponents.default.div`
|
|
17
|
-
width: 90%;
|
|
18
|
-
padding-left: 5%;
|
|
19
|
-
padding-top: 10px;
|
|
20
|
-
`;
|
|
21
|
-
exports.StyledMultiStepWizardContent = StyledMultiStepWizardContent;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|