@elliemae/ds-wizard 2.0.0-alpha.1 → 2.0.0-alpha.13
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/cjs/DSWizard.stories.js +1 -1
- package/cjs/WizardStep.js +28 -25
- package/cjs/WizardSteps.js +13 -6
- package/cjs/blockNames.js +2 -2
- package/cjs/index.js +2 -2
- package/cjs/stories/steps.js +4 -4
- package/cjs/stories/wizzard-overview.stories.js +7 -7
- package/cjs/useWizard.js +12 -15
- package/esm/WizardStep.js +23 -19
- package/esm/WizardSteps.js +7 -0
- package/esm/blockNames.js +2 -2
- package/esm/stories/wizzard-overview.stories.js +1 -1
- package/esm/useWizard.js +10 -9
- package/package.json +8 -5
- package/types/WizardStep.d.ts +47 -8
- package/types/WizardSteps.d.ts +20 -3
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
package/cjs/DSWizard.stories.js
CHANGED
package/cjs/WizardStep.js
CHANGED
|
@@ -6,57 +6,60 @@ var _jsx = require('@babel/runtime/helpers/jsx');
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var reactDesc = require('react-desc');
|
|
8
8
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
10
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
11
11
|
var blockNames = require('./blockNames.js');
|
|
12
12
|
|
|
13
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
14
|
|
|
15
15
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
16
|
-
var Checkmark__default = /*#__PURE__*/_interopDefaultLegacy(Checkmark);
|
|
17
16
|
|
|
18
17
|
var _Checkmark;
|
|
19
|
-
const Item = dsClassnames.aggregatedClasses('div')(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
const Item = dsClassnames.aggregatedClasses('div')("".concat(blockNames.indicatorItemBlockName), null, _ref => {
|
|
19
|
+
let {
|
|
20
|
+
active,
|
|
21
|
+
completed
|
|
22
|
+
} = _ref;
|
|
23
|
+
return {
|
|
24
|
+
active,
|
|
25
|
+
completed
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
const Wrapper = dsClassnames.aggregatedClasses('div')("".concat(blockNames.indicatorItemBlockName, "-wrapper"));
|
|
27
29
|
const Label = dsClassnames.aggregatedClasses('span')(blockNames.indicatorItemBlockName, 'label');
|
|
28
30
|
const Bullet = dsClassnames.aggregatedClasses('div')(blockNames.indicatorItemBlockName, 'bullet');
|
|
29
31
|
const BulletWrapper = dsClassnames.aggregatedClasses('div')(blockNames.indicatorItemBlockName, 'bullet-wrapper');
|
|
30
32
|
|
|
31
|
-
function WizardStep({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
function WizardStep(_ref2) {
|
|
34
|
+
let {
|
|
35
|
+
label = '',
|
|
36
|
+
icon = null,
|
|
37
|
+
iconCompleted = _Checkmark || (_Checkmark = /*#__PURE__*/_jsx__default["default"](dsIcons.Checkmark, {})),
|
|
38
|
+
iconActive = null,
|
|
39
|
+
active = false,
|
|
40
|
+
completed = false,
|
|
41
|
+
index = 0
|
|
42
|
+
} = _ref2;
|
|
40
43
|
const currentIcon = React.useMemo(() => {
|
|
41
44
|
if (active) return iconActive;
|
|
42
45
|
if (completed) return iconCompleted;
|
|
43
46
|
return icon;
|
|
44
47
|
}, [active, completed]) || icon;
|
|
45
48
|
const iconWithOptions = React.useMemo(() => /*#__PURE__*/React.isValidElement(currentIcon) ? /*#__PURE__*/React.cloneElement(currentIcon, {
|
|
46
|
-
color:
|
|
49
|
+
color: dsUtilities.get(currentIcon, ['props', 'color']) || ['brand-primary', completed ? 600 : 500]
|
|
47
50
|
}) : currentIcon || index + 1, [currentIcon]);
|
|
48
|
-
return /*#__PURE__*/_jsx__default[
|
|
51
|
+
return /*#__PURE__*/_jsx__default["default"](Item, {
|
|
49
52
|
classProps: {
|
|
50
53
|
active,
|
|
51
54
|
completed
|
|
52
55
|
}
|
|
53
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
56
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](Wrapper, {}, void 0, /*#__PURE__*/_jsx__default["default"](BulletWrapper, {}, void 0, /*#__PURE__*/_jsx__default["default"](Bullet, {}, void 0, iconWithOptions)), /*#__PURE__*/_jsx__default["default"](Label, {}, void 0, label)));
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
const wizzardStepProps = {
|
|
57
60
|
label: reactDesc.PropTypes.string.description('Step label'),
|
|
58
61
|
icon: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.element, reactDesc.PropTypes.string]).description('Default icon or number'),
|
|
59
|
-
iconCompleted: reactDesc.PropTypes.element.description('Icon when the step is completed').defaultValue(
|
|
62
|
+
iconCompleted: reactDesc.PropTypes.element.description('Icon when the step is completed').defaultValue(dsIcons.Checkmark),
|
|
60
63
|
iconActive: reactDesc.PropTypes.element.description('Icon when the step is active'),
|
|
61
64
|
active: reactDesc.PropTypes.bool.description('Whether the step is active or not').defaultValue(false),
|
|
62
65
|
completed: reactDesc.PropTypes.bool.description('Whether the step is completed or not').defaultValue(false),
|
|
@@ -66,4 +69,4 @@ const WizzardStepWithSchema = reactDesc.describe(WizardStep);
|
|
|
66
69
|
WizzardStepWithSchema.propTypes = wizzardStepProps;
|
|
67
70
|
|
|
68
71
|
exports.WizzardStepWithSchema = WizzardStepWithSchema;
|
|
69
|
-
exports[
|
|
72
|
+
exports["default"] = WizardStep;
|
package/cjs/WizardSteps.js
CHANGED
|
@@ -4,6 +4,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
6
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
12
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
7
14
|
var React = require('react');
|
|
8
15
|
var reactDesc = require('react-desc');
|
|
9
16
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
@@ -21,7 +28,7 @@ const _excluded = ["current", "steps", "children"];
|
|
|
21
28
|
|
|
22
29
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
23
30
|
|
|
24
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
31
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
25
32
|
const StepsWrapper = dsClassnames.aggregatedClasses('div')(blockNames.indicatorBlockName);
|
|
26
33
|
|
|
27
34
|
function WizardSteps(_ref) {
|
|
@@ -30,7 +37,7 @@ function WizardSteps(_ref) {
|
|
|
30
37
|
steps,
|
|
31
38
|
children
|
|
32
39
|
} = _ref,
|
|
33
|
-
otherProps = _objectWithoutProperties__default[
|
|
40
|
+
otherProps = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
34
41
|
|
|
35
42
|
const items = React.useMemo(() => {
|
|
36
43
|
const mergeStepProps = (step, index) => ({
|
|
@@ -39,21 +46,21 @@ function WizardSteps(_ref) {
|
|
|
39
46
|
completed: index < current
|
|
40
47
|
});
|
|
41
48
|
|
|
42
|
-
return steps ? steps.map((step, index) => /*#__PURE__*/jsxRuntime.jsx(WizardStep[
|
|
49
|
+
return steps ? steps.map((step, index) => /*#__PURE__*/jsxRuntime.jsx(WizardStep["default"], _objectSpread(_objectSpread({}, step), mergeStepProps(step, index)), index)) : React__default["default"].Children.map(children, (item, index) => /*#__PURE__*/React.cloneElement(item, mergeStepProps(item, index)));
|
|
43
50
|
}, [current, children]);
|
|
44
51
|
return /*#__PURE__*/jsxRuntime.jsx(StepsWrapper, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
45
52
|
children: items
|
|
46
53
|
}));
|
|
47
54
|
}
|
|
48
55
|
|
|
49
|
-
WizardSteps.Item = WizardStep[
|
|
56
|
+
WizardSteps.Item = WizardStep["default"];
|
|
50
57
|
const wizzardProps = {
|
|
51
58
|
current: reactDesc.PropTypes.number.description('Current active state index').defaultValue(0),
|
|
52
59
|
steps: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.shape({})).description('Array of steps objects').defaultValue([]).isRequired,
|
|
53
|
-
children: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.instanceOf(WizardStep[
|
|
60
|
+
children: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.instanceOf(WizardStep["default"])).description('List of WizardStep components')
|
|
54
61
|
};
|
|
55
62
|
const WizzardWithSchema = reactDesc.describe(WizardSteps);
|
|
56
63
|
WizzardWithSchema.propTypes = wizzardProps;
|
|
57
64
|
|
|
58
65
|
exports.WizzardWithSchema = WizzardWithSchema;
|
|
59
|
-
exports[
|
|
66
|
+
exports["default"] = WizardSteps;
|
package/cjs/blockNames.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const wizardBlockName = 'wizard';
|
|
6
|
-
const indicatorBlockName =
|
|
7
|
-
const indicatorItemBlockName =
|
|
6
|
+
const indicatorBlockName = "".concat(wizardBlockName, "-steps-indicator");
|
|
7
|
+
const indicatorItemBlockName = "".concat(indicatorBlockName, "-step");
|
|
8
8
|
|
|
9
9
|
exports.indicatorBlockName = indicatorBlockName;
|
|
10
10
|
exports.indicatorItemBlockName = indicatorItemBlockName;
|
package/cjs/index.js
CHANGED
|
@@ -8,8 +8,8 @@ var useWizard = require('./useWizard.js');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.WizardStepsIndicator = WizardSteps[
|
|
11
|
+
exports.WizardStepsIndicator = WizardSteps["default"];
|
|
12
12
|
exports.WizzardWithSchema = WizardSteps.WizzardWithSchema;
|
|
13
|
-
exports.WizardStep = WizardStep[
|
|
13
|
+
exports.WizardStep = WizardStep["default"];
|
|
14
14
|
exports.WizzardStepWithSchema = WizardStep.WizzardStepWithSchema;
|
|
15
15
|
exports.useWizard = useWizard;
|
package/cjs/stories/steps.js
CHANGED
|
@@ -11,13 +11,13 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
|
11
11
|
|
|
12
12
|
var _div, _div2, _div3, _div4;
|
|
13
13
|
|
|
14
|
-
const Step1Content = () => _div || (_div = /*#__PURE__*/_jsx__default[
|
|
14
|
+
const Step1Content = () => _div || (_div = /*#__PURE__*/_jsx__default["default"]("div", {}, void 0, "Step 1 Content"));
|
|
15
15
|
|
|
16
|
-
const Step2Content = () => _div2 || (_div2 = /*#__PURE__*/_jsx__default[
|
|
16
|
+
const Step2Content = () => _div2 || (_div2 = /*#__PURE__*/_jsx__default["default"]("div", {}, void 0, "Step 2 Content"));
|
|
17
17
|
|
|
18
|
-
const Step3Content = () => _div3 || (_div3 = /*#__PURE__*/_jsx__default[
|
|
18
|
+
const Step3Content = () => _div3 || (_div3 = /*#__PURE__*/_jsx__default["default"]("div", {}, void 0, "Step 3 Content"));
|
|
19
19
|
|
|
20
|
-
const Step4Content = () => _div4 || (_div4 = /*#__PURE__*/_jsx__default[
|
|
20
|
+
const Step4Content = () => _div4 || (_div4 = /*#__PURE__*/_jsx__default["default"]("div", {}, void 0, "Step 4 Content"));
|
|
21
21
|
|
|
22
22
|
const steps = [{
|
|
23
23
|
label: 'Step 1',
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
require('react');
|
|
7
7
|
var dsWizard = require('@elliemae/ds-wizard');
|
|
8
|
-
var DSButton = require('@elliemae/ds-
|
|
8
|
+
var DSButton = require('@elliemae/ds-button');
|
|
9
9
|
var steps = require('./steps.js');
|
|
10
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
|
|
@@ -26,31 +26,31 @@ const Overview = () => {
|
|
|
26
26
|
steps: steps.steps
|
|
27
27
|
});
|
|
28
28
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
29
|
-
children: [/*#__PURE__*/_jsx__default[
|
|
29
|
+
children: [/*#__PURE__*/_jsx__default["default"](dsWizard.WizardStepsIndicator, {
|
|
30
30
|
current: current,
|
|
31
31
|
steps: steps.steps
|
|
32
|
-
}), /*#__PURE__*/_jsx__default[
|
|
32
|
+
}), /*#__PURE__*/_jsx__default["default"]("div", {
|
|
33
33
|
style: {
|
|
34
34
|
margin: '10px 0',
|
|
35
35
|
padding: 10,
|
|
36
36
|
border: '1px solid #ddd'
|
|
37
37
|
}
|
|
38
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
38
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](WizardCurrentContent, {
|
|
39
39
|
data: {
|
|
40
40
|
someExtraData: 'step information'
|
|
41
41
|
}
|
|
42
|
-
})), /*#__PURE__*/_jsx__default[
|
|
42
|
+
})), /*#__PURE__*/_jsx__default["default"]("div", {
|
|
43
43
|
style: {
|
|
44
44
|
display: 'flex',
|
|
45
45
|
width: 180,
|
|
46
46
|
justifyContent: 'space-between'
|
|
47
47
|
}
|
|
48
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
48
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](DSButton__default["default"], {
|
|
49
49
|
buttonType: "secondary",
|
|
50
50
|
disabled: !canPrevious,
|
|
51
51
|
labelText: "Previous",
|
|
52
52
|
onClick: previous
|
|
53
|
-
}), /*#__PURE__*/_jsx__default[
|
|
53
|
+
}), /*#__PURE__*/_jsx__default["default"](DSButton__default["default"], {
|
|
54
54
|
disabled: !canNext,
|
|
55
55
|
labelText: "Next",
|
|
56
56
|
onClick: next
|
package/cjs/useWizard.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
3
4
|
var React = require('react');
|
|
4
|
-
var
|
|
5
|
-
var useDerivedStateFromProps = require('@elliemae/ds-utilities/hooks/useDerivedStateFromProps');
|
|
6
|
-
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var useDerivedStateFromProps__default = /*#__PURE__*/_interopDefaultLegacy(useDerivedStateFromProps);
|
|
5
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
10
6
|
|
|
11
7
|
const checkCanNext = (prevIndex, array) => array.length > prevIndex + 1;
|
|
12
8
|
|
|
@@ -14,14 +10,15 @@ const checkCanPrevious = prevIndex => prevIndex - 1 >= 0;
|
|
|
14
10
|
|
|
15
11
|
const noop = () => null;
|
|
16
12
|
|
|
17
|
-
function useWizard({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
function useWizard(_ref) {
|
|
14
|
+
let {
|
|
15
|
+
steps: wizardSteps,
|
|
16
|
+
current,
|
|
17
|
+
onNext = noop,
|
|
18
|
+
onPrevious = noop,
|
|
19
|
+
initial = 0
|
|
20
|
+
} = _ref;
|
|
21
|
+
const [currentStep, setCurrentStep] = dsUtilities.useDerivedStateFromProps(current || initial);
|
|
25
22
|
const handleNext = React.useCallback(() => {
|
|
26
23
|
if (checkCanNext(currentStep, wizardSteps)) {
|
|
27
24
|
onNext(currentStep);
|
|
@@ -40,7 +37,7 @@ function useWizard({
|
|
|
40
37
|
previous: handlePrevious,
|
|
41
38
|
canNext: checkCanNext(currentStep, wizardSteps),
|
|
42
39
|
canPrevious: checkCanPrevious(currentStep),
|
|
43
|
-
WizardCurrentContent:
|
|
40
|
+
WizardCurrentContent: dsUtilities.get(wizardSteps, [currentStep, 'content'], () => null)
|
|
44
41
|
};
|
|
45
42
|
}
|
|
46
43
|
|
package/esm/WizardStep.js
CHANGED
|
@@ -2,32 +2,36 @@ import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
|
2
2
|
import { useMemo, isValidElement, cloneElement } from 'react';
|
|
3
3
|
import { PropTypes, describe } from 'react-desc';
|
|
4
4
|
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
5
|
-
import { get } from '@elliemae/ds-utilities
|
|
6
|
-
import Checkmark from '@elliemae/ds-icons
|
|
5
|
+
import { get } from '@elliemae/ds-utilities';
|
|
6
|
+
import { Checkmark } from '@elliemae/ds-icons';
|
|
7
7
|
import { indicatorItemBlockName } from './blockNames.js';
|
|
8
8
|
|
|
9
9
|
var _Checkmark;
|
|
10
|
-
const Item = aggregatedClasses('div')(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
const Item = aggregatedClasses('div')("".concat(indicatorItemBlockName), null, _ref => {
|
|
11
|
+
let {
|
|
12
|
+
active,
|
|
13
|
+
completed
|
|
14
|
+
} = _ref;
|
|
15
|
+
return {
|
|
16
|
+
active,
|
|
17
|
+
completed
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
const Wrapper = aggregatedClasses('div')("".concat(indicatorItemBlockName, "-wrapper"));
|
|
18
21
|
const Label = aggregatedClasses('span')(indicatorItemBlockName, 'label');
|
|
19
22
|
const Bullet = aggregatedClasses('div')(indicatorItemBlockName, 'bullet');
|
|
20
23
|
const BulletWrapper = aggregatedClasses('div')(indicatorItemBlockName, 'bullet-wrapper');
|
|
21
24
|
|
|
22
|
-
function WizardStep({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
function WizardStep(_ref2) {
|
|
26
|
+
let {
|
|
27
|
+
label = '',
|
|
28
|
+
icon = null,
|
|
29
|
+
iconCompleted = _Checkmark || (_Checkmark = /*#__PURE__*/_jsx(Checkmark, {})),
|
|
30
|
+
iconActive = null,
|
|
31
|
+
active = false,
|
|
32
|
+
completed = false,
|
|
33
|
+
index = 0
|
|
34
|
+
} = _ref2;
|
|
31
35
|
const currentIcon = useMemo(() => {
|
|
32
36
|
if (active) return iconActive;
|
|
33
37
|
if (completed) return iconCompleted;
|
package/esm/WizardSteps.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
3
10
|
import React, { useMemo, cloneElement } from 'react';
|
|
4
11
|
import { PropTypes, describe } from 'react-desc';
|
|
5
12
|
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
package/esm/blockNames.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const wizardBlockName = 'wizard';
|
|
2
|
-
const indicatorBlockName =
|
|
3
|
-
const indicatorItemBlockName =
|
|
2
|
+
const indicatorBlockName = "".concat(wizardBlockName, "-steps-indicator");
|
|
3
|
+
const indicatorItemBlockName = "".concat(indicatorBlockName, "-step");
|
|
4
4
|
|
|
5
5
|
export { indicatorBlockName, indicatorItemBlockName, wizardBlockName };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import 'react';
|
|
3
3
|
import { useWizard, WizardStepsIndicator } from '@elliemae/ds-wizard';
|
|
4
|
-
import DSButton from '@elliemae/ds-
|
|
4
|
+
import DSButton from '@elliemae/ds-button';
|
|
5
5
|
import { steps } from './steps.js';
|
|
6
6
|
import { jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
|
package/esm/useWizard.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
1
2
|
import { useCallback } from 'react';
|
|
2
|
-
import { get } from '@elliemae/ds-utilities
|
|
3
|
-
import useDerivedStateFromProps from '@elliemae/ds-utilities/hooks/useDerivedStateFromProps';
|
|
3
|
+
import { useDerivedStateFromProps, get } from '@elliemae/ds-utilities';
|
|
4
4
|
|
|
5
5
|
const checkCanNext = (prevIndex, array) => array.length > prevIndex + 1;
|
|
6
6
|
|
|
@@ -8,13 +8,14 @@ const checkCanPrevious = prevIndex => prevIndex - 1 >= 0;
|
|
|
8
8
|
|
|
9
9
|
const noop = () => null;
|
|
10
10
|
|
|
11
|
-
function useWizard({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
function useWizard(_ref) {
|
|
12
|
+
let {
|
|
13
|
+
steps: wizardSteps,
|
|
14
|
+
current,
|
|
15
|
+
onNext = noop,
|
|
16
|
+
onPrevious = noop,
|
|
17
|
+
initial = 0
|
|
18
|
+
} = _ref;
|
|
18
19
|
const [currentStep, setCurrentStep] = useDerivedStateFromProps(current || initial);
|
|
19
20
|
const handleNext = useCallback(() => {
|
|
20
21
|
if (checkCanNext(currentStep, wizardSteps)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-wizard",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Wizard",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -52,10 +52,13 @@
|
|
|
52
52
|
"build": "node ../../scripts/build/build.js"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@elliemae/ds-
|
|
56
|
-
"@elliemae/ds-classnames": "2.0.0-alpha.
|
|
57
|
-
"@elliemae/ds-
|
|
58
|
-
"
|
|
55
|
+
"@elliemae/ds-button": "2.0.0-alpha.13",
|
|
56
|
+
"@elliemae/ds-classnames": "2.0.0-alpha.13",
|
|
57
|
+
"@elliemae/ds-icons": "2.0.0-alpha.13",
|
|
58
|
+
"@elliemae/ds-utilities": "2.0.0-alpha.13",
|
|
59
|
+
"@elliemae/ds-wizard": "2.0.0-alpha.13",
|
|
60
|
+
"prop-types": "~15.7.2",
|
|
61
|
+
"react-desc": "~4.1.3"
|
|
59
62
|
},
|
|
60
63
|
"peerDependencies": {
|
|
61
64
|
"lodash": "^4.17.21",
|
package/types/WizardStep.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
1
2
|
/// <reference types="react" />
|
|
2
3
|
declare function WizardStep({ label, icon, iconCompleted, iconActive, active, completed, index, }: {
|
|
3
4
|
label?: string | undefined;
|
|
@@ -10,15 +11,53 @@ declare function WizardStep({ label, icon, iconCompleted, iconActive, active, co
|
|
|
10
11
|
}): JSX.Element;
|
|
11
12
|
declare namespace WizardStep {
|
|
12
13
|
var propTypes: {
|
|
13
|
-
label:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
label: {
|
|
15
|
+
defaultValue<T = unknown>(arg: T): {
|
|
16
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
17
|
+
};
|
|
18
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
19
|
+
};
|
|
20
|
+
icon: {
|
|
21
|
+
defaultValue<T = unknown>(arg: T): {
|
|
22
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
23
|
+
};
|
|
24
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
25
|
+
};
|
|
26
|
+
iconCompleted: {
|
|
27
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
28
|
+
};
|
|
29
|
+
iconActive: {
|
|
30
|
+
defaultValue<T = unknown>(arg: T): {
|
|
31
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
32
|
+
};
|
|
33
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
34
|
+
};
|
|
35
|
+
active: {
|
|
36
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
37
|
+
};
|
|
38
|
+
completed: {
|
|
39
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
40
|
+
};
|
|
41
|
+
index: {
|
|
42
|
+
defaultValue<T = unknown>(arg: T): {
|
|
43
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
44
|
+
};
|
|
45
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
46
|
+
};
|
|
20
47
|
};
|
|
21
48
|
}
|
|
22
|
-
declare const WizzardStepWithSchema:
|
|
49
|
+
declare const WizzardStepWithSchema: {
|
|
50
|
+
(props?: {
|
|
51
|
+
label?: string | undefined;
|
|
52
|
+
icon?: null | undefined;
|
|
53
|
+
iconCompleted?: JSX.Element | undefined;
|
|
54
|
+
iconActive?: null | undefined;
|
|
55
|
+
active?: boolean | undefined;
|
|
56
|
+
completed?: boolean | undefined;
|
|
57
|
+
index?: number | undefined;
|
|
58
|
+
} | undefined): JSX.Element;
|
|
59
|
+
propTypes: unknown;
|
|
60
|
+
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
61
|
+
};
|
|
23
62
|
export { WizzardStepWithSchema };
|
|
24
63
|
export default WizardStep;
|
package/types/WizardSteps.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
1
2
|
/// <reference types="react" />
|
|
2
3
|
import WizardStep from './WizardStep';
|
|
3
4
|
declare function WizardSteps({ current, steps, children, ...otherProps }: {
|
|
@@ -9,11 +10,27 @@ declare function WizardSteps({ current, steps, children, ...otherProps }: {
|
|
|
9
10
|
declare namespace WizardSteps {
|
|
10
11
|
var Item: typeof WizardStep;
|
|
11
12
|
var propTypes: {
|
|
12
|
-
current:
|
|
13
|
+
current: {
|
|
14
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
15
|
+
};
|
|
13
16
|
steps: any;
|
|
14
|
-
children:
|
|
17
|
+
children: {
|
|
18
|
+
defaultValue<T = unknown>(arg: T): {
|
|
19
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
20
|
+
};
|
|
21
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
22
|
+
};
|
|
15
23
|
};
|
|
16
24
|
}
|
|
17
|
-
declare const WizzardWithSchema:
|
|
25
|
+
declare const WizzardWithSchema: {
|
|
26
|
+
(props?: {
|
|
27
|
+
[x: string]: any;
|
|
28
|
+
current?: number | undefined;
|
|
29
|
+
steps: any;
|
|
30
|
+
children: any;
|
|
31
|
+
} | undefined): JSX.Element;
|
|
32
|
+
propTypes: unknown;
|
|
33
|
+
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
34
|
+
};
|
|
18
35
|
export { WizzardWithSchema };
|
|
19
36
|
export default WizardSteps;
|
package/cjs/package.json
DELETED