carbon-react 106.7.0 → 107.1.1
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/__internal__/click-away-wrapper/click-away-wrapper.component.d.ts +12 -0
- package/esm/__internal__/click-away-wrapper/click-away-wrapper.component.js +43 -0
- package/esm/__internal__/click-away-wrapper/index.d.ts +2 -0
- package/esm/__internal__/click-away-wrapper/index.js +1 -0
- 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/date/date.component.js +19 -20
- package/esm/components/date/date.d.ts +10 -1
- package/esm/components/date/index.d.ts +1 -0
- package/esm/components/date-range/date-range.d.ts +3 -3
- package/esm/components/date-range/index.d.ts +1 -0
- 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/__internal__/submenu/submenu.component.js +11 -17
- 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/popover-container/popover-container.component.js +16 -3
- 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/__internal__/click-away-wrapper/click-away-wrapper.component.d.ts +12 -0
- package/lib/__internal__/click-away-wrapper/click-away-wrapper.component.js +59 -0
- package/lib/__internal__/click-away-wrapper/index.d.ts +2 -0
- package/lib/{components/menu/submenu-block → __internal__/click-away-wrapper}/index.js +2 -2
- package/lib/{components/scrollable-list → __internal__/click-away-wrapper}/package.json +1 -1
- 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/date/date.component.js +20 -20
- package/lib/components/date/date.d.ts +10 -1
- package/lib/components/date/index.d.ts +1 -0
- package/lib/components/date-range/date-range.d.ts +3 -3
- package/lib/components/date-range/index.d.ts +1 -0
- 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/__internal__/submenu/submenu.component.js +12 -17
- 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/popover-container/popover-container.component.js +17 -3
- 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/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/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,191 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import TestUtils from "react-dom/test-utils";
|
|
3
|
-
import { shallow } from "enzyme";
|
|
4
|
-
import MultiStepWizard from "./multi-step-wizard";
|
|
5
|
-
import MultiActionButton from "./../multi-action-button";
|
|
6
|
-
import Button from "./../button";
|
|
7
|
-
import { elementsTagTest, rootTagTest } from "../../__internal__/utils/helpers/tags/tags-specs";
|
|
8
|
-
describe("MultiStepWizard", () => {
|
|
9
|
-
let instance,
|
|
10
|
-
spySubmitHandler = jasmine.createSpy("submitHandler");
|
|
11
|
-
beforeEach(() => {
|
|
12
|
-
instance = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(MultiStepWizard, {
|
|
13
|
-
steps: [/*#__PURE__*/React.createElement("div", null, "Step 1"), /*#__PURE__*/React.createElement("div", null, "Step 2")],
|
|
14
|
-
onSubmit: spySubmitHandler
|
|
15
|
-
}));
|
|
16
|
-
});
|
|
17
|
-
describe("lifecycle", () => {
|
|
18
|
-
describe("componentWillMount", () => {
|
|
19
|
-
it("sets the states", () => {
|
|
20
|
-
spyOn(instance, "validateStepProps").and.returnValue({
|
|
21
|
-
currentStep: 1,
|
|
22
|
-
completed: false
|
|
23
|
-
});
|
|
24
|
-
expect(instance.state.currentStep).toEqual(1);
|
|
25
|
-
expect(instance.state.completed).toEqual(false);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
describe("componentWillReceiveProps", () => {
|
|
29
|
-
it("sets the states", () => {
|
|
30
|
-
spyOn(instance, "validateStepProps").and.returnValue({
|
|
31
|
-
currentStep: 3,
|
|
32
|
-
completed: true
|
|
33
|
-
});
|
|
34
|
-
instance.UNSAFE_componentWillReceiveProps({});
|
|
35
|
-
expect(instance.state.currentStep).toEqual(3);
|
|
36
|
-
expect(instance.state.completed).toEqual(true);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
describe("initialize", () => {
|
|
41
|
-
it("sets current step", () => {
|
|
42
|
-
expect(instance.state.currentStep).toBeTruthy();
|
|
43
|
-
});
|
|
44
|
-
it("sets completed to false", () => {
|
|
45
|
-
expect(instance.state.completed).toBeFalsy();
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
describe("totalSteps", () => {
|
|
49
|
-
it("returns the total number of steps", () => {
|
|
50
|
-
expect(instance.totalSteps).toEqual(2);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
describe("validateStepProps", () => {
|
|
54
|
-
describe("when the completed prop equals to true", () => {
|
|
55
|
-
it("returns the valid props", () => {
|
|
56
|
-
let props = instance.validateStepProps({
|
|
57
|
-
completed: true,
|
|
58
|
-
steps: [1, 2, 3]
|
|
59
|
-
});
|
|
60
|
-
expect(props.currentStep).toEqual(3);
|
|
61
|
-
expect(props.completed).toEqual(true);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
describe("when the currentStep prop is not number", () => {
|
|
65
|
-
it("returns the valid props", () => {
|
|
66
|
-
let props = instance.validateStepProps({
|
|
67
|
-
currentStep: "test",
|
|
68
|
-
steps: [1, 2, 3]
|
|
69
|
-
});
|
|
70
|
-
expect(props.currentStep).toEqual(1);
|
|
71
|
-
expect(props.completed).toEqual(false);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
describe("when the currentStep prop is less than 1", () => {
|
|
75
|
-
it("returns the valid props", () => {
|
|
76
|
-
let props = instance.validateStepProps({
|
|
77
|
-
currentStep: 0,
|
|
78
|
-
steps: [1, 2, 3]
|
|
79
|
-
});
|
|
80
|
-
expect(props.currentStep).toEqual(1);
|
|
81
|
-
expect(props.completed).toEqual(false);
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
describe("when the currentStep prop is larger than the total of steps", () => {
|
|
85
|
-
it("returns the valid props", () => {
|
|
86
|
-
let props = instance.validateStepProps({
|
|
87
|
-
currentStep: 4,
|
|
88
|
-
steps: [1, 2, 3]
|
|
89
|
-
});
|
|
90
|
-
expect(props.currentStep).toEqual(1);
|
|
91
|
-
expect(props.completed).toEqual(false);
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
describe("when the currentStep prop is valid", () => {
|
|
95
|
-
it("returns the valid props", () => {
|
|
96
|
-
let props = instance.validateStepProps({
|
|
97
|
-
currentStep: 2,
|
|
98
|
-
steps: [1, 2, 3]
|
|
99
|
-
});
|
|
100
|
-
expect(props.currentStep).toEqual(2);
|
|
101
|
-
expect(props.completed).toEqual(false);
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
describe("next", () => {
|
|
106
|
-
beforeEach(() => {
|
|
107
|
-
spyOn(instance, "setState").and.callThrough();
|
|
108
|
-
});
|
|
109
|
-
describe("when current step is less than the total of steps", () => {
|
|
110
|
-
it("moves the step forward", () => {
|
|
111
|
-
instance.next();
|
|
112
|
-
expect(instance.state.currentStep).toEqual(2);
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
describe("when current step is not less than the total of steps", () => {
|
|
116
|
-
it("does nothing", () => {
|
|
117
|
-
instance.state.currentStep = 3;
|
|
118
|
-
instance.next();
|
|
119
|
-
expect(instance.setState).not.toHaveBeenCalled();
|
|
120
|
-
expect(instance.state.currentStep).toEqual(3);
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
describe("back", () => {
|
|
125
|
-
beforeEach(() => {
|
|
126
|
-
spyOn(instance, "setState").and.callThrough();
|
|
127
|
-
});
|
|
128
|
-
describe("when current step is larger than 1", () => {
|
|
129
|
-
it("moves the step backward", () => {
|
|
130
|
-
instance.state.currentStep = 2;
|
|
131
|
-
instance.back();
|
|
132
|
-
expect(instance.state.completed).toEqual(false);
|
|
133
|
-
expect(instance.state.currentStep).toEqual(1);
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
describe("when current step is not larger than 1", () => {
|
|
137
|
-
it("does nothing", () => {
|
|
138
|
-
instance.back();
|
|
139
|
-
expect(instance.setState).not.toHaveBeenCalled();
|
|
140
|
-
expect(instance.state.currentStep).toEqual(1);
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
describe("complete", () => {
|
|
145
|
-
beforeEach(() => {
|
|
146
|
-
spyOn(instance, "setState").and.callThrough();
|
|
147
|
-
});
|
|
148
|
-
describe("when current step is the last step", () => {
|
|
149
|
-
it("completes the wizard", () => {
|
|
150
|
-
instance.state.currentStep = 2;
|
|
151
|
-
instance.complete();
|
|
152
|
-
expect(instance.setState).toHaveBeenCalledWith({
|
|
153
|
-
completed: true
|
|
154
|
-
});
|
|
155
|
-
expect(instance.state.completed).toBeTruthy();
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
describe("when current step is not the last step", () => {
|
|
159
|
-
it("does nothing", () => {
|
|
160
|
-
instance.complete();
|
|
161
|
-
expect(instance.setState).not.toHaveBeenCalled();
|
|
162
|
-
expect(instance.state.completed).toBeFalsy();
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
describe("wizardStepsHTML", () => {
|
|
167
|
-
describe("when passing the steps prop", () => {
|
|
168
|
-
it("returns step components", () => {
|
|
169
|
-
let steps = instance.wizardStepsHTML,
|
|
170
|
-
step1 = steps[0],
|
|
171
|
-
step2 = steps[1];
|
|
172
|
-
expect(steps.length).toEqual(2);
|
|
173
|
-
expect(step1.props.children.props.children).toEqual("Step 1");
|
|
174
|
-
expect(step1.props.stepNumber).toEqual(1);
|
|
175
|
-
expect(step1.props.defaultButton).toEqual(true);
|
|
176
|
-
expect(step2.props.children.props.children).toEqual("Step 2");
|
|
177
|
-
expect(step2.props.stepNumber).toEqual(2);
|
|
178
|
-
expect(step2.props.defaultButton).toEqual(true);
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
describe("when not passing the steps prop", () => {
|
|
182
|
-
it("does not returns step components", () => {
|
|
183
|
-
instance = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(MultiStepWizard, {
|
|
184
|
-
steps: [],
|
|
185
|
-
onSubmit: spySubmitHandler
|
|
186
|
-
}));
|
|
187
|
-
expect(instance.wizardStepsHTML).toEqual([]);
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
});
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
export default MultiStepWizard;
|
|
2
|
-
declare class MultiStepWizard extends React.Component<any, any, any> {
|
|
3
|
-
constructor(props: any);
|
|
4
|
-
/**
|
|
5
|
-
* Returns wizard object to child components.
|
|
6
|
-
*
|
|
7
|
-
* @method getChildContext
|
|
8
|
-
* @return {void}
|
|
9
|
-
*/
|
|
10
|
-
getChildContext(): void;
|
|
11
|
-
/**
|
|
12
|
-
* A lifecycle method that is called before initial render.
|
|
13
|
-
* Can set up state of component without causing a re-render.
|
|
14
|
-
*
|
|
15
|
-
* @method componentWillMount
|
|
16
|
-
*/
|
|
17
|
-
UNSAFE_componentWillMount(): void;
|
|
18
|
-
/**
|
|
19
|
-
* A lifecycle method to update the currentStep state when a new valid value has been specified.
|
|
20
|
-
*
|
|
21
|
-
* @method componentWillReceiveProps
|
|
22
|
-
* @param {Object} props The new props passed down to the component
|
|
23
|
-
* @return {void}
|
|
24
|
-
*/
|
|
25
|
-
UNSAFE_componentWillReceiveProps(nextProps: any): void;
|
|
26
|
-
/**
|
|
27
|
-
* Validate step props
|
|
28
|
-
*
|
|
29
|
-
* @method validateStepProps
|
|
30
|
-
* @return {Object}
|
|
31
|
-
*/
|
|
32
|
-
validateStepProps: (stepProps: any) => Object;
|
|
33
|
-
/**
|
|
34
|
-
* Get total number of steps
|
|
35
|
-
*
|
|
36
|
-
* @method totalSteps
|
|
37
|
-
* @return {Number}
|
|
38
|
-
*/
|
|
39
|
-
get totalSteps(): number;
|
|
40
|
-
/**
|
|
41
|
-
* Moves to the next step.
|
|
42
|
-
*
|
|
43
|
-
* @method next
|
|
44
|
-
* @return {void}
|
|
45
|
-
*/
|
|
46
|
-
next: () => void;
|
|
47
|
-
/**
|
|
48
|
-
* Back to the previous step.
|
|
49
|
-
*
|
|
50
|
-
* @method back
|
|
51
|
-
* @return {void}
|
|
52
|
-
*/
|
|
53
|
-
back: () => void;
|
|
54
|
-
/**
|
|
55
|
-
* Completes the wizard.
|
|
56
|
-
*
|
|
57
|
-
* @method complete
|
|
58
|
-
* @return {void}
|
|
59
|
-
*/
|
|
60
|
-
complete: () => void;
|
|
61
|
-
/**
|
|
62
|
-
* Returns the computed HTML for the wizard's steps.
|
|
63
|
-
*
|
|
64
|
-
* @method wizardStepsHTML
|
|
65
|
-
* @return {Object} JSX
|
|
66
|
-
*/
|
|
67
|
-
get wizardStepsHTML(): Object;
|
|
68
|
-
/**
|
|
69
|
-
* Renders the component.
|
|
70
|
-
*
|
|
71
|
-
* @method render
|
|
72
|
-
* @return {Object} JSX
|
|
73
|
-
*/
|
|
74
|
-
render(): Object;
|
|
75
|
-
}
|
|
76
|
-
declare namespace MultiStepWizard {
|
|
77
|
-
namespace propTypes {
|
|
78
|
-
const steps: any[];
|
|
79
|
-
const beforeSubmitValidation: Function;
|
|
80
|
-
const className: string;
|
|
81
|
-
const onSubmit: Function;
|
|
82
|
-
const currentStep: number;
|
|
83
|
-
const enableInactiveSteps: boolean;
|
|
84
|
-
const onNext: PropTypes.Requireable<(...args: any[]) => any>;
|
|
85
|
-
const onBack: PropTypes.Requireable<(...args: any[]) => any>;
|
|
86
|
-
const completed: boolean;
|
|
87
|
-
}
|
|
88
|
-
namespace defaultProps {
|
|
89
|
-
const beforeSubmitValidation_1: null;
|
|
90
|
-
export { beforeSubmitValidation_1 as beforeSubmitValidation };
|
|
91
|
-
const className_1: string;
|
|
92
|
-
export { className_1 as className };
|
|
93
|
-
const completed_1: boolean;
|
|
94
|
-
export { completed_1 as completed };
|
|
95
|
-
const currentStep_1: number;
|
|
96
|
-
export { currentStep_1 as currentStep };
|
|
97
|
-
const enableInactiveSteps_1: boolean;
|
|
98
|
-
export { enableInactiveSteps_1 as enableInactiveSteps };
|
|
99
|
-
const onNext_1: null;
|
|
100
|
-
export { onNext_1 as onNext };
|
|
101
|
-
const onBack_1: null;
|
|
102
|
-
export { onBack_1 as onBack };
|
|
103
|
-
}
|
|
104
|
-
namespace childContextTypes {
|
|
105
|
-
const wizard: Object;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
import React from "react";
|
|
109
|
-
import PropTypes from "prop-types";
|
|
@@ -1,383 +0,0 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
|
|
3
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
-
|
|
5
|
-
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); } }
|
|
6
|
-
|
|
7
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
8
|
-
|
|
9
|
-
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); }
|
|
10
|
-
|
|
11
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
-
|
|
13
|
-
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); }; }
|
|
14
|
-
|
|
15
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
16
|
-
|
|
17
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
-
|
|
19
|
-
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; } }
|
|
20
|
-
|
|
21
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
-
|
|
23
|
-
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; }
|
|
24
|
-
|
|
25
|
-
import React from "react";
|
|
26
|
-
import PropTypes from "prop-types";
|
|
27
|
-
import Step from "./step";
|
|
28
|
-
import { StyledMultiStepWizard, StyledMultiStepWizardContent } from "./multi-step-wizard.style";
|
|
29
|
-
import Logger from "../../__internal__/utils/logger";
|
|
30
|
-
/**
|
|
31
|
-
* A MultiStepWizard widget.
|
|
32
|
-
*
|
|
33
|
-
* == How to use a MultiStepWizard in a component:
|
|
34
|
-
*
|
|
35
|
-
* In your file:
|
|
36
|
-
*
|
|
37
|
-
* import MultiStepWizard from 'carbon-react/lib/components/multi-step-wizard';
|
|
38
|
-
*
|
|
39
|
-
* To render the Wizard:
|
|
40
|
-
*
|
|
41
|
-
* <MultiStepWizard steps={ [<Step1 />, <Step2 />, ...] } />
|
|
42
|
-
*
|
|
43
|
-
* The component rendering the wizard must pass down a prop of 'steps' where you need to provide an array of custom
|
|
44
|
-
* step components. Note that Step components must be objects and you can pass props to Step components, e.g.
|
|
45
|
-
* <MultiStepWizard steps={ [<Textbox onChange={ this.updateTextboxValue } />, <div className='some-style' />] } />
|
|
46
|
-
*
|
|
47
|
-
* You also need to provide a 'onSubmit' handler to handle a submit event.
|
|
48
|
-
*
|
|
49
|
-
* The wizard also takes a 'currentStep' prop with an integer to specify a step you want to start with.
|
|
50
|
-
* e.g. currentStep={ 2 }. The wizard starts with the first step by default.
|
|
51
|
-
*
|
|
52
|
-
* The wizard disables inactive steps by default. If you wish to enable inactive steps, pass a 'enableInactiveSteps'
|
|
53
|
-
* prop and set it to true.
|
|
54
|
-
*
|
|
55
|
-
* The wizard generates Next and Back buttons by default. If you wish to use custom buttons to replace the default ones
|
|
56
|
-
* in a step component, you can pass a 'defaultButton' prop in the corresponding step component and set it to false.
|
|
57
|
-
* Also, if you want to add additional buttons beside the default Next and Back buttons, you can pass a 'extraButtons'
|
|
58
|
-
* prop in the corresponding step component with your extra buttons.
|
|
59
|
-
* Individual Steps can be optionally disabled by a passing a prop of `enabled={ false }`.
|
|
60
|
-
* e.g. <MultiStepWizard steps={ [<Step1 defaultButton={ false } />, <Step2 />] } />
|
|
61
|
-
* <MultiStepWizard steps={ [<Step1 />, <Step2 extraButtons={ [<Button>Cancel</Button>] }) />] } />
|
|
62
|
-
* <MultiStepWizard steps={ [<Step1 />, <Step2 enabled={ false } />] } />
|
|
63
|
-
*
|
|
64
|
-
* The wizard provides the ability to hook into the handle next/back/submit methods.
|
|
65
|
-
* (1) By passing a 'beforeSubmitValidation' prop in the wizard, you can add custom logic before a submit event, and
|
|
66
|
-
* the submit event can be completed only when the 'beforeSubmitValidation' prop returns 'true'.
|
|
67
|
-
* (2) By passing 'onNext' prop in the corresponding step component,
|
|
68
|
-
* you can add custom logic when moving a step forward, and
|
|
69
|
-
* the 'onNext' prop overrides the step's default behaviour of moving next.
|
|
70
|
-
* (3) By passing 'onBack' prop in the corresponding step component,
|
|
71
|
-
* you can add custom logic when moving a step backward, and
|
|
72
|
-
* the 'onBack' prop overrides the step's default behaviour of moving back.
|
|
73
|
-
* e.g. <MultiStepWizard steps={ [
|
|
74
|
-
* <Step1 onNext={ this.customMethodOnNext }/>,
|
|
75
|
-
* <Step2 onBack={ this.customMethodOnBack }) />
|
|
76
|
-
* ] } />
|
|
77
|
-
* <MultiStepWizard beforeSubmitValidation={ this.customValidation } onSubmit={ this.customMethodOnSubmit } />
|
|
78
|
-
*
|
|
79
|
-
* If you want to complete the wizard without going through steps, you can pass a 'completed' prop and set it to true.
|
|
80
|
-
*
|
|
81
|
-
* @class MultiStepWizard
|
|
82
|
-
* @constructor
|
|
83
|
-
*/
|
|
84
|
-
|
|
85
|
-
let deprecatedWarnTriggered = false;
|
|
86
|
-
|
|
87
|
-
let MultiStepWizard = /*#__PURE__*/function (_React$Component) {
|
|
88
|
-
_inherits(MultiStepWizard, _React$Component);
|
|
89
|
-
|
|
90
|
-
var _super = _createSuper(MultiStepWizard);
|
|
91
|
-
|
|
92
|
-
function MultiStepWizard(props) {
|
|
93
|
-
var _this;
|
|
94
|
-
|
|
95
|
-
_classCallCheck(this, MultiStepWizard);
|
|
96
|
-
|
|
97
|
-
_this = _super.call(this, props);
|
|
98
|
-
|
|
99
|
-
_defineProperty(_assertThisInitialized(_this), "validateStepProps", stepProps => {
|
|
100
|
-
const step = stepProps.currentStep;
|
|
101
|
-
const {
|
|
102
|
-
completed
|
|
103
|
-
} = stepProps;
|
|
104
|
-
const totalSteps = stepProps.steps.length;
|
|
105
|
-
|
|
106
|
-
if (completed === true) {
|
|
107
|
-
return {
|
|
108
|
-
currentStep: totalSteps,
|
|
109
|
-
completed: true
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (parseInt(step, 10) !== step || step < 1 || step > totalSteps) {
|
|
114
|
-
return {
|
|
115
|
-
currentStep: 1,
|
|
116
|
-
completed: false
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return {
|
|
121
|
-
currentStep: step,
|
|
122
|
-
completed: false
|
|
123
|
-
};
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
_defineProperty(_assertThisInitialized(_this), "next", () => {
|
|
127
|
-
if (_this.state.currentStep < _this.totalSteps) {
|
|
128
|
-
_this.setState(prevState => ({
|
|
129
|
-
currentStep: prevState.currentStep + 1
|
|
130
|
-
}));
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
_defineProperty(_assertThisInitialized(_this), "back", () => {
|
|
135
|
-
if (_this.state.currentStep > 1) {
|
|
136
|
-
_this.setState(prevState => ({
|
|
137
|
-
completed: false,
|
|
138
|
-
currentStep: prevState.currentStep - 1
|
|
139
|
-
}));
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
_defineProperty(_assertThisInitialized(_this), "complete", () => {
|
|
144
|
-
if (_this.state.currentStep === _this.totalSteps) {
|
|
145
|
-
_this.setState({
|
|
146
|
-
completed: true
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
if (!deprecatedWarnTriggered) {
|
|
152
|
-
deprecatedWarnTriggered = true; // eslint-disable-next-line max-len
|
|
153
|
-
|
|
154
|
-
Logger.deprecate("`Multi Step Wizard` component is deprecated and will soon be removed. Please use Step Sequence instead.");
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return _this;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Returns wizard object to child components.
|
|
161
|
-
*
|
|
162
|
-
* @method getChildContext
|
|
163
|
-
* @return {void}
|
|
164
|
-
*/
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
_createClass(MultiStepWizard, [{
|
|
168
|
-
key: "getChildContext",
|
|
169
|
-
value: function getChildContext() {
|
|
170
|
-
return {
|
|
171
|
-
wizard: {
|
|
172
|
-
nextHandler: this.props.onNext,
|
|
173
|
-
backHandler: this.props.onBack,
|
|
174
|
-
beforeSubmitValidation: this.props.beforeSubmitValidation,
|
|
175
|
-
submitHandler: this.props.onSubmit,
|
|
176
|
-
enableInactiveSteps: this.props.enableInactiveSteps,
|
|
177
|
-
currentStep: this.state.currentStep,
|
|
178
|
-
completed: this.state.completed,
|
|
179
|
-
next: this.next,
|
|
180
|
-
back: this.back,
|
|
181
|
-
complete: this.complete,
|
|
182
|
-
totalSteps: this.totalSteps
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* A lifecycle method that is called before initial render.
|
|
188
|
-
* Can set up state of component without causing a re-render.
|
|
189
|
-
*
|
|
190
|
-
* @method componentWillMount
|
|
191
|
-
*/
|
|
192
|
-
|
|
193
|
-
}, {
|
|
194
|
-
key: "UNSAFE_componentWillMount",
|
|
195
|
-
value: function UNSAFE_componentWillMount() {
|
|
196
|
-
const validProps = this.validateStepProps(this.props);
|
|
197
|
-
this.setState({
|
|
198
|
-
currentStep: validProps.currentStep,
|
|
199
|
-
completed: validProps.completed
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* A lifecycle method to update the currentStep state when a new valid value has been specified.
|
|
204
|
-
*
|
|
205
|
-
* @method componentWillReceiveProps
|
|
206
|
-
* @param {Object} props The new props passed down to the component
|
|
207
|
-
* @return {void}
|
|
208
|
-
*/
|
|
209
|
-
|
|
210
|
-
}, {
|
|
211
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
212
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
213
|
-
const validProps = this.validateStepProps(nextProps);
|
|
214
|
-
this.setState({
|
|
215
|
-
currentStep: validProps.currentStep,
|
|
216
|
-
completed: validProps.completed
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Validate step props
|
|
221
|
-
*
|
|
222
|
-
* @method validateStepProps
|
|
223
|
-
* @return {Object}
|
|
224
|
-
*/
|
|
225
|
-
|
|
226
|
-
}, {
|
|
227
|
-
key: "totalSteps",
|
|
228
|
-
get:
|
|
229
|
-
/**
|
|
230
|
-
* Get total number of steps
|
|
231
|
-
*
|
|
232
|
-
* @method totalSteps
|
|
233
|
-
* @return {Number}
|
|
234
|
-
*/
|
|
235
|
-
function () {
|
|
236
|
-
return this.props.steps.length;
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Moves to the next step.
|
|
240
|
-
*
|
|
241
|
-
* @method next
|
|
242
|
-
* @return {void}
|
|
243
|
-
*/
|
|
244
|
-
|
|
245
|
-
}, {
|
|
246
|
-
key: "wizardStepsHTML",
|
|
247
|
-
get:
|
|
248
|
-
/**
|
|
249
|
-
* Returns the computed HTML for the wizard's steps.
|
|
250
|
-
*
|
|
251
|
-
* @method wizardStepsHTML
|
|
252
|
-
* @return {Object} JSX
|
|
253
|
-
*/
|
|
254
|
-
function () {
|
|
255
|
-
return this.props.steps.map((step, index) => {
|
|
256
|
-
return (
|
|
257
|
-
/*#__PURE__*/
|
|
258
|
-
// Step is never going to be re-ordered or changed so index is safe to use
|
|
259
|
-
|
|
260
|
-
/* eslint-disable react/no-array-index-key */
|
|
261
|
-
React.createElement(Step, _extends({
|
|
262
|
-
stepNumber: index + 1,
|
|
263
|
-
key: `multi-step-wizard-step-${index}`
|
|
264
|
-
}, step.props), step)
|
|
265
|
-
/* eslint-enable react/no-array-index-key */
|
|
266
|
-
|
|
267
|
-
);
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Renders the component.
|
|
272
|
-
*
|
|
273
|
-
* @method render
|
|
274
|
-
* @return {Object} JSX
|
|
275
|
-
*/
|
|
276
|
-
|
|
277
|
-
}, {
|
|
278
|
-
key: "render",
|
|
279
|
-
value: function render() {
|
|
280
|
-
return /*#__PURE__*/React.createElement(StyledMultiStepWizard, {
|
|
281
|
-
className: this.props.className
|
|
282
|
-
}, /*#__PURE__*/React.createElement(StyledMultiStepWizardContent, null, this.wizardStepsHTML));
|
|
283
|
-
}
|
|
284
|
-
}]);
|
|
285
|
-
|
|
286
|
-
return MultiStepWizard;
|
|
287
|
-
}(React.Component);
|
|
288
|
-
|
|
289
|
-
MultiStepWizard.propTypes = {
|
|
290
|
-
/**
|
|
291
|
-
* Individual steps
|
|
292
|
-
*
|
|
293
|
-
* @property steps
|
|
294
|
-
* @type {Array}
|
|
295
|
-
*/
|
|
296
|
-
steps: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Custom function that is called immediately before a submit event
|
|
300
|
-
*
|
|
301
|
-
* @property beforeSubmitValidation
|
|
302
|
-
* @type {Function}
|
|
303
|
-
*/
|
|
304
|
-
beforeSubmitValidation: PropTypes.func,
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Custom className
|
|
308
|
-
*
|
|
309
|
-
* @property className
|
|
310
|
-
* @type {String}
|
|
311
|
-
*/
|
|
312
|
-
className: PropTypes.string,
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* A custom submit event handler
|
|
316
|
-
*
|
|
317
|
-
* @property onSubmit
|
|
318
|
-
* @type {Function}
|
|
319
|
-
*/
|
|
320
|
-
onSubmit: PropTypes.func.isRequired,
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Current step
|
|
324
|
-
*
|
|
325
|
-
* @property currentStep
|
|
326
|
-
* @type {Number}
|
|
327
|
-
* @default 1
|
|
328
|
-
*/
|
|
329
|
-
currentStep: PropTypes.number,
|
|
330
|
-
// eslint-disable-line react/no-unused-prop-types
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Determines if the wizard disables inactive steps
|
|
334
|
-
*
|
|
335
|
-
* @property enableInactiveSteps
|
|
336
|
-
* @type {Boolean}
|
|
337
|
-
* @default false
|
|
338
|
-
*/
|
|
339
|
-
enableInactiveSteps: PropTypes.bool,
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* Add custom logic to next button
|
|
343
|
-
*
|
|
344
|
-
* @property onNext
|
|
345
|
-
*/
|
|
346
|
-
onNext: PropTypes.func,
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* Add custom logic to previous button
|
|
350
|
-
*
|
|
351
|
-
* @property onPrevious
|
|
352
|
-
*/
|
|
353
|
-
onBack: PropTypes.func,
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* The completion state of the wizard
|
|
357
|
-
*
|
|
358
|
-
* @property enableInactiveSteps
|
|
359
|
-
* @type {Boolean}
|
|
360
|
-
* @default false
|
|
361
|
-
*/
|
|
362
|
-
completed: PropTypes.bool // eslint-disable-line react/no-unused-prop-types
|
|
363
|
-
|
|
364
|
-
};
|
|
365
|
-
MultiStepWizard.defaultProps = {
|
|
366
|
-
beforeSubmitValidation: null,
|
|
367
|
-
className: "",
|
|
368
|
-
completed: false,
|
|
369
|
-
currentStep: 1,
|
|
370
|
-
enableInactiveSteps: false,
|
|
371
|
-
onNext: null,
|
|
372
|
-
onBack: null
|
|
373
|
-
};
|
|
374
|
-
MultiStepWizard.childContextTypes = {
|
|
375
|
-
/**
|
|
376
|
-
* Defines a context object for child components of this wizard.
|
|
377
|
-
*
|
|
378
|
-
* @property wizard
|
|
379
|
-
* @type {Object}
|
|
380
|
-
*/
|
|
381
|
-
wizard: PropTypes.object
|
|
382
|
-
};
|
|
383
|
-
export default MultiStepWizard;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
const StyledMultiStepWizard = styled.div`
|
|
3
|
-
width: 100%;
|
|
4
|
-
`;
|
|
5
|
-
const StyledMultiStepWizardContent = styled.div`
|
|
6
|
-
width: 90%;
|
|
7
|
-
padding-left: 5%;
|
|
8
|
-
padding-top: 10px;
|
|
9
|
-
`;
|
|
10
|
-
export { StyledMultiStepWizard, StyledMultiStepWizardContent };
|