@elliemae/ds-wizard 2.3.0-next.0 → 3.0.0-alpha.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.
Files changed (48) hide show
  1. package/dist/cjs/WizardStep.js +85 -0
  2. package/dist/cjs/WizardStep.js.map +7 -0
  3. package/dist/cjs/WizardSteps.js +68 -0
  4. package/dist/cjs/WizardSteps.js.map +7 -0
  5. package/dist/cjs/blockNames.js +39 -0
  6. package/dist/cjs/blockNames.js.map +7 -0
  7. package/dist/cjs/index.js +41 -0
  8. package/dist/cjs/index.js.map +7 -0
  9. package/dist/cjs/stories/steps.js +57 -0
  10. package/dist/cjs/stories/steps.js.map +7 -0
  11. package/dist/cjs/useWizard.js +68 -0
  12. package/dist/cjs/useWizard.js.map +7 -0
  13. package/dist/esm/WizardStep.js +56 -0
  14. package/dist/esm/WizardStep.js.map +7 -0
  15. package/dist/esm/WizardSteps.js +39 -0
  16. package/dist/esm/WizardSteps.js.map +7 -0
  17. package/dist/esm/blockNames.js +10 -0
  18. package/dist/esm/blockNames.js.map +7 -0
  19. package/dist/esm/index.js +12 -0
  20. package/dist/esm/index.js.map +7 -0
  21. package/dist/esm/stories/steps.js +28 -0
  22. package/dist/esm/stories/steps.js.map +7 -0
  23. package/{esm → dist/esm}/useWizard.js +16 -19
  24. package/dist/esm/useWizard.js.map +7 -0
  25. package/{types → dist/types}/DSWizard.stories.d.ts +0 -2
  26. package/{types → dist/types}/WizardStep.d.ts +0 -0
  27. package/{types → dist/types}/WizardSteps.d.ts +0 -0
  28. package/{types → dist/types}/blockNames.d.ts +0 -0
  29. package/{types → dist/types}/index.d.ts +0 -0
  30. package/{types → dist/types}/stories/steps.d.ts +0 -0
  31. package/{types → dist/types}/stories/wizzard-overview.stories.d.ts +0 -0
  32. package/{types → dist/types}/useWizard.d.ts +0 -0
  33. package/package.json +38 -30
  34. package/cjs/DSWizard.stories.js +0 -18
  35. package/cjs/WizardStep.js +0 -72
  36. package/cjs/WizardSteps.js +0 -66
  37. package/cjs/blockNames.js +0 -11
  38. package/cjs/index.js +0 -15
  39. package/cjs/stories/steps.js +0 -36
  40. package/cjs/stories/wizzard-overview.stories.js +0 -61
  41. package/cjs/useWizard.js +0 -44
  42. package/esm/DSWizard.stories.js +0 -13
  43. package/esm/WizardStep.js +0 -63
  44. package/esm/WizardSteps.js +0 -55
  45. package/esm/blockNames.js +0 -5
  46. package/esm/index.js +0 -3
  47. package/esm/stories/steps.js +0 -28
  48. package/esm/stories/wizzard-overview.stories.js +0 -52
@@ -1,55 +0,0 @@
1
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
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';
10
- import React, { useMemo, cloneElement } from 'react';
11
- import { PropTypes, describe } from 'react-desc';
12
- import { aggregatedClasses } from '@elliemae/ds-classnames';
13
- import WizardStep from './WizardStep.js';
14
- import { indicatorBlockName } from './blockNames.js';
15
- import { jsx } from 'react/jsx-runtime';
16
-
17
- const _excluded = ["current", "steps", "children"];
18
-
19
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
20
-
21
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
22
- const StepsWrapper = aggregatedClasses('div')(indicatorBlockName);
23
-
24
- function WizardSteps(_ref) {
25
- let {
26
- current = 0,
27
- steps,
28
- children
29
- } = _ref,
30
- otherProps = _objectWithoutProperties(_ref, _excluded);
31
-
32
- const items = useMemo(() => {
33
- const mergeStepProps = (step, index) => ({
34
- index,
35
- active: current === index,
36
- completed: index < current
37
- });
38
-
39
- return steps ? steps.map((step, index) => /*#__PURE__*/jsx(WizardStep, _objectSpread(_objectSpread({}, step), mergeStepProps(step, index)), index)) : React.Children.map(children, (item, index) => /*#__PURE__*/cloneElement(item, mergeStepProps(item, index)));
40
- }, [current, children]);
41
- return /*#__PURE__*/jsx(StepsWrapper, _objectSpread(_objectSpread({}, otherProps), {}, {
42
- children: items
43
- }));
44
- }
45
-
46
- WizardSteps.Item = WizardStep;
47
- const wizzardProps = {
48
- current: PropTypes.number.description('Current active state index').defaultValue(0),
49
- steps: PropTypes.arrayOf(PropTypes.shape({})).description('Array of steps objects').defaultValue([]).isRequired,
50
- children: PropTypes.arrayOf(PropTypes.instanceOf(WizardStep)).description('List of WizardStep components')
51
- };
52
- const WizzardWithSchema = describe(WizardSteps);
53
- WizzardWithSchema.propTypes = wizzardProps;
54
-
55
- export { WizzardWithSchema, WizardSteps as default };
package/esm/blockNames.js DELETED
@@ -1,5 +0,0 @@
1
- const wizardBlockName = 'wizard';
2
- const indicatorBlockName = "".concat(wizardBlockName, "-steps-indicator");
3
- const indicatorItemBlockName = "".concat(indicatorBlockName, "-step");
4
-
5
- export { indicatorBlockName, indicatorItemBlockName, wizardBlockName };
package/esm/index.js DELETED
@@ -1,3 +0,0 @@
1
- export { default as WizardStepsIndicator, WizzardWithSchema } from './WizardSteps.js';
2
- export { default as WizardStep, WizzardStepWithSchema } from './WizardStep.js';
3
- export { default as useWizard } from './useWizard.js';
@@ -1,28 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'react';
3
-
4
- var _div, _div2, _div3, _div4;
5
-
6
- const Step1Content = () => _div || (_div = /*#__PURE__*/_jsx("div", {}, void 0, "Step 1 Content"));
7
-
8
- const Step2Content = () => _div2 || (_div2 = /*#__PURE__*/_jsx("div", {}, void 0, "Step 2 Content"));
9
-
10
- const Step3Content = () => _div3 || (_div3 = /*#__PURE__*/_jsx("div", {}, void 0, "Step 3 Content"));
11
-
12
- const Step4Content = () => _div4 || (_div4 = /*#__PURE__*/_jsx("div", {}, void 0, "Step 4 Content"));
13
-
14
- const steps = [{
15
- label: 'Step 1',
16
- content: Step1Content
17
- }, {
18
- label: 'Step Lorem Ipsum',
19
- content: Step2Content
20
- }, {
21
- label: 'Step Lorem',
22
- content: Step3Content
23
- }, {
24
- label: 'Step Lorem 4',
25
- content: Step4Content
26
- }];
27
-
28
- export { steps };
@@ -1,52 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'react';
3
- import { useWizard, WizardStepsIndicator } from '@elliemae/ds-wizard';
4
- import DSButton from '@elliemae/ds-button';
5
- import { steps } from './steps.js';
6
- import { jsxs, Fragment } from 'react/jsx-runtime';
7
-
8
- const Overview = () => {
9
- const {
10
- WizardCurrentContent,
11
- current,
12
- next,
13
- previous,
14
- canNext,
15
- canPrevious
16
- } = useWizard({
17
- steps
18
- });
19
- return /*#__PURE__*/jsxs(Fragment, {
20
- children: [/*#__PURE__*/_jsx(WizardStepsIndicator, {
21
- current: current,
22
- steps: steps
23
- }), /*#__PURE__*/_jsx("div", {
24
- style: {
25
- margin: '10px 0',
26
- padding: 10,
27
- border: '1px solid #ddd'
28
- }
29
- }, void 0, /*#__PURE__*/_jsx(WizardCurrentContent, {
30
- data: {
31
- someExtraData: 'step information'
32
- }
33
- })), /*#__PURE__*/_jsx("div", {
34
- style: {
35
- display: 'flex',
36
- width: 180,
37
- justifyContent: 'space-between'
38
- }
39
- }, void 0, /*#__PURE__*/_jsx(DSButton, {
40
- buttonType: "secondary",
41
- disabled: !canPrevious,
42
- labelText: "Previous",
43
- onClick: previous
44
- }), /*#__PURE__*/_jsx(DSButton, {
45
- disabled: !canNext,
46
- labelText: "Next",
47
- onClick: next
48
- }))]
49
- });
50
- };
51
-
52
- export { Overview };