@elliemae/ds-wizard 3.0.0-next.9 → 3.0.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.
@@ -4,32 +4,26 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
7
  var __export = (target, all) => {
9
8
  for (var name in all)
10
9
  __defProp(target, name, { get: all[name], enumerable: true });
11
10
  };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
16
  }
18
- return target;
17
+ return to;
19
18
  };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
21
  var WizardStep_exports = {};
29
22
  __export(WizardStep_exports, {
30
23
  WizzardStepWithSchema: () => WizzardStepWithSchema,
31
24
  default: () => WizardStep_default
32
25
  });
26
+ module.exports = __toCommonJS(WizardStep_exports);
33
27
  var React = __toESM(require("react"));
34
28
  var import_react = __toESM(require("react"));
35
29
  var import_react_desc = require("react-desc");
@@ -78,8 +72,8 @@ const wizzardStepProps = {
78
72
  index: import_react_desc.PropTypes.number.description("Current item index")
79
73
  };
80
74
  WizardStep.propTypes = wizzardStepProps;
75
+ WizardStep.displayName = "WizardStep";
81
76
  const WizzardStepWithSchema = (0, import_react_desc.describe)(WizardStep);
82
77
  WizzardStepWithSchema.propTypes = wizzardStepProps;
83
78
  var WizardStep_default = WizardStep;
84
- module.exports = __toCommonJS(WizardStep_exports);
85
79
  //# sourceMappingURL=WizardStep.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/WizardStep.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable indent */\nimport React, { cloneElement, useMemo, isValidElement } from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { get } from '@elliemae/ds-utilities';\nimport { Checkmark } from '@elliemae/ds-icons';\nimport { indicatorItemBlockName } from './blockNames';\n\nconst Item = aggregatedClasses('div')(`${indicatorItemBlockName}`, null, ({ active, completed }) => ({\n active,\n completed,\n}));\nconst Wrapper = aggregatedClasses('div')(`${indicatorItemBlockName}-wrapper`);\nconst Label = aggregatedClasses('span')(indicatorItemBlockName, 'label');\nconst Bullet = aggregatedClasses('div')(indicatorItemBlockName, 'bullet');\nconst BulletWrapper = aggregatedClasses('div')(indicatorItemBlockName, 'bullet-wrapper');\n\nfunction WizardStep({\n label = '',\n icon = null,\n iconCompleted = <Checkmark />,\n iconActive = null,\n active = false,\n completed = false,\n index = 0,\n}) {\n const currentIcon =\n useMemo(() => {\n if (active) return iconActive;\n if (completed) return iconCompleted;\n return icon;\n }, [active, completed]) || icon;\n\n const iconWithOptions = useMemo(\n () =>\n isValidElement(currentIcon)\n ? cloneElement(currentIcon, {\n color: get(currentIcon, ['props', 'color']) || ['brand-primary', completed ? 600 : 500],\n })\n : currentIcon || index + 1,\n [currentIcon],\n );\n\n return (\n <Item classProps={{ active, completed }}>\n <Wrapper>\n <BulletWrapper>\n <Bullet>{iconWithOptions}</Bullet>\n </BulletWrapper>\n <Label>{label}</Label>\n </Wrapper>\n </Item>\n );\n}\n\nconst wizzardStepProps = {\n label: PropTypes.string.description('Step label'),\n icon: PropTypes.oneOfType([PropTypes.element, PropTypes.string]).description('Default icon or number'),\n iconCompleted: PropTypes.element.description('Icon when the step is completed').defaultValue(Checkmark),\n iconActive: PropTypes.element.description('Icon when the step is active'),\n active: PropTypes.bool.description('Whether the step is active or not').defaultValue(false),\n completed: PropTypes.bool.description('Whether the step is completed or not').defaultValue(false),\n index: PropTypes.number.description('Current item index'),\n};\n\nWizardStep.propTypes = wizzardStepProps;\n\nconst WizzardStepWithSchema = describe(WizardStep);\nWizzardStepWithSchema.propTypes = wizzardStepProps;\n\nexport { WizzardStepWithSchema };\nexport default WizardStep;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAA6D;AAC7D,wBAAoC;AACpC,2BAAkC;AAClC,0BAAoB;AACpB,sBAA0B;AAC1B,wBAAuC;AAEvC,MAAM,OAAO,4CAAkB,OAAO,GAAG,4CAA0B,MAAM,CAAC,EAAE,QAAQ,gBAAiB;AAAA,EACnG;AAAA,EACA;AAAA;AAEF,MAAM,UAAU,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;",
4
+ "sourcesContent": ["/* eslint-disable indent */\nimport React, { cloneElement, useMemo, isValidElement } from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { get } from '@elliemae/ds-utilities';\nimport { Checkmark } from '@elliemae/ds-icons';\nimport { indicatorItemBlockName } from './blockNames';\n\nconst Item = aggregatedClasses('div')(`${indicatorItemBlockName}`, null, ({ active, completed }) => ({\n active,\n completed,\n}));\nconst Wrapper = aggregatedClasses('div')(`${indicatorItemBlockName}-wrapper`);\nconst Label = aggregatedClasses('span')(indicatorItemBlockName, 'label');\nconst Bullet = aggregatedClasses('div')(indicatorItemBlockName, 'bullet');\nconst BulletWrapper = aggregatedClasses('div')(indicatorItemBlockName, 'bullet-wrapper');\n\nfunction WizardStep({\n label = '',\n icon = null,\n iconCompleted = <Checkmark />,\n iconActive = null,\n active = false,\n completed = false,\n index = 0,\n}) {\n const currentIcon =\n useMemo(() => {\n if (active) return iconActive;\n if (completed) return iconCompleted;\n return icon;\n }, [active, completed]) || icon;\n\n const iconWithOptions = useMemo(\n () =>\n isValidElement(currentIcon)\n ? cloneElement(currentIcon, {\n color: get(currentIcon, ['props', 'color']) || ['brand-primary', completed ? 600 : 500],\n })\n : currentIcon || index + 1,\n [currentIcon],\n );\n\n return (\n <Item classProps={{ active, completed }}>\n <Wrapper>\n <BulletWrapper>\n <Bullet>{iconWithOptions}</Bullet>\n </BulletWrapper>\n <Label>{label}</Label>\n </Wrapper>\n </Item>\n );\n}\n\nconst wizzardStepProps = {\n label: PropTypes.string.description('Step label'),\n icon: PropTypes.oneOfType([PropTypes.element, PropTypes.string]).description('Default icon or number'),\n iconCompleted: PropTypes.element.description('Icon when the step is completed').defaultValue(Checkmark),\n iconActive: PropTypes.element.description('Icon when the step is active'),\n active: PropTypes.bool.description('Whether the step is active or not').defaultValue(false),\n completed: PropTypes.bool.description('Whether the step is completed or not').defaultValue(false),\n index: PropTypes.number.description('Current item index'),\n};\n\nWizardStep.propTypes = wizzardStepProps;\nWizardStep.displayName = 'WizardStep';\nconst WizzardStepWithSchema = describe(WizardStep);\nWizzardStepWithSchema.propTypes = wizzardStepProps;\n\nexport { WizzardStepWithSchema };\nexport default WizardStep;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAA6D;AAC7D,wBAAoC;AACpC,2BAAkC;AAClC,0BAAoB;AACpB,sBAA0B;AAC1B,wBAAuC;AAEvC,MAAM,OAAO,4CAAkB,KAAK,EAAE,GAAG,4CAA0B,MAAM,CAAC,EAAE,QAAQ,gBAAiB;AAAA,EACnG;AAAA,EACA;AACF,EAAE;AACF,MAAM,UAAU,4CAAkB,KAAK,EAAE,GAAG,kDAAgC;AAC5E,MAAM,QAAQ,4CAAkB,MAAM,EAAE,0CAAwB,OAAO;AACvE,MAAM,SAAS,4CAAkB,KAAK,EAAE,0CAAwB,QAAQ;AACxE,MAAM,gBAAgB,4CAAkB,KAAK,EAAE,0CAAwB,gBAAgB;AAEvF,oBAAoB;AAAA,EAClB,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,gBAAgB,mDAAC,+BAAU;AAAA,EAC3B,aAAa;AAAA,EACb,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,QAAQ;AAAA,GACP;AACD,QAAM,cACJ,0BAAQ,MAAM;AACZ,QAAI;AAAQ,aAAO;AACnB,QAAI;AAAW,aAAO;AACtB,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,SAAS,CAAC,KAAK;AAE7B,QAAM,kBAAkB,0BACtB,MACE,iCAAe,WAAW,IACtB,+BAAa,aAAa;AAAA,IACxB,OAAO,6BAAI,aAAa,CAAC,SAAS,OAAO,CAAC,KAAK,CAAC,iBAAiB,YAAY,MAAM,GAAG;AAAA,EACxF,CAAC,IACD,eAAe,QAAQ,GAC7B,CAAC,WAAW,CACd;AAEA,SACE,mDAAC;AAAA,IAAK,YAAY,EAAE,QAAQ,UAAU;AAAA,KACpC,mDAAC,eACC,mDAAC,qBACC,mDAAC,cAAQ,eAAgB,CAC3B,GACA,mDAAC,aAAO,KAAM,CAChB,CACF;AAEJ;AAEA,MAAM,mBAAmB;AAAA,EACvB,OAAO,4BAAU,OAAO,YAAY,YAAY;AAAA,EAChD,MAAM,4BAAU,UAAU,CAAC,4BAAU,SAAS,4BAAU,MAAM,CAAC,EAAE,YAAY,wBAAwB;AAAA,EACrG,eAAe,4BAAU,QAAQ,YAAY,iCAAiC,EAAE,aAAa,yBAAS;AAAA,EACtG,YAAY,4BAAU,QAAQ,YAAY,8BAA8B;AAAA,EACxE,QAAQ,4BAAU,KAAK,YAAY,mCAAmC,EAAE,aAAa,KAAK;AAAA,EAC1F,WAAW,4BAAU,KAAK,YAAY,sCAAsC,EAAE,aAAa,KAAK;AAAA,EAChG,OAAO,4BAAU,OAAO,YAAY,oBAAoB;AAC1D;AAEA,WAAW,YAAY;AACvB,WAAW,cAAc;AACzB,MAAM,wBAAwB,gCAAS,UAAU;AACjD,sBAAsB,YAAY;AAGlC,IAAO,qBAAQ;",
6
6
  "names": []
7
7
  }
@@ -18,7 +18,6 @@ var __spreadValues = (a, b) => {
18
18
  }
19
19
  return a;
20
20
  };
21
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
22
21
  var __objRest = (source, exclude) => {
23
22
  var target = {};
24
23
  for (var prop in source)
@@ -35,27 +34,22 @@ var __export = (target, all) => {
35
34
  for (var name in all)
36
35
  __defProp(target, name, { get: all[name], enumerable: true });
37
36
  };
38
- var __reExport = (target, module2, copyDefault, desc) => {
39
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
40
- for (let key of __getOwnPropNames(module2))
41
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
42
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
37
+ var __copyProps = (to, from, except, desc) => {
38
+ if (from && typeof from === "object" || typeof from === "function") {
39
+ for (let key of __getOwnPropNames(from))
40
+ if (!__hasOwnProp.call(to, key) && key !== except)
41
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
43
42
  }
44
- return target;
45
- };
46
- var __toESM = (module2, isNodeMode) => {
47
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
43
+ return to;
48
44
  };
49
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
50
- return (module2, temp) => {
51
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
52
- };
53
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
45
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
46
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
54
47
  var WizardSteps_exports = {};
55
48
  __export(WizardSteps_exports, {
56
49
  WizzardWithSchema: () => WizzardWithSchema,
57
50
  default: () => WizardSteps_default
58
51
  });
52
+ module.exports = __toCommonJS(WizardSteps_exports);
59
53
  var React = __toESM(require("react"));
60
54
  var import_react = __toESM(require("react"));
61
55
  var import_react_desc = require("react-desc");
@@ -84,8 +78,8 @@ const wizzardProps = {
84
78
  children: import_react_desc.PropTypes.arrayOf(import_react_desc.PropTypes.instanceOf(import_WizardStep.default)).description("List of WizardStep components")
85
79
  };
86
80
  WizardSteps.propTypes = wizzardProps;
81
+ WizardSteps.displayName = "WizardSteps";
87
82
  const WizzardWithSchema = (0, import_react_desc.describe)(WizardSteps);
88
83
  WizzardWithSchema.propTypes = wizzardProps;
89
84
  var WizardSteps_default = WizardSteps;
90
- module.exports = __toCommonJS(WizardSteps_exports);
91
85
  //# sourceMappingURL=WizardSteps.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/WizardSteps.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable indent */\n/* eslint-disable react/no-array-index-key */\nimport React, { cloneElement, useMemo } from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport WizardStep from './WizardStep';\nimport { indicatorBlockName } from './blockNames';\n\nconst StepsWrapper = aggregatedClasses('div')(indicatorBlockName);\n\nfunction WizardSteps({ current = 0, steps, children, ...otherProps }) {\n const items = useMemo(() => {\n const mergeStepProps = (step, index) => ({\n index,\n active: current === index,\n completed: index < current,\n });\n\n return steps\n ? steps.map((step, index) => (\n <WizardStep key={index} {...step} {...mergeStepProps(step, index)} />\n ))\n : React.Children.map(children, (item, index) =>\n cloneElement(item, mergeStepProps(item, index)),\n );\n }, [current, children]);\n\n return <StepsWrapper {...otherProps}>{items}</StepsWrapper>;\n}\n\nWizardSteps.Item = WizardStep;\n\nconst wizzardProps = {\n current: PropTypes.number\n .description('Current active state index')\n .defaultValue(0),\n steps: PropTypes.arrayOf(PropTypes.shape({}))\n .description('Array of steps objects')\n .defaultValue([]).isRequired,\n children: PropTypes.arrayOf(PropTypes.instanceOf(WizardStep)).description(\n 'List of WizardStep components',\n ),\n};\n\nWizardSteps.propTypes = wizzardProps;\n\nconst WizzardWithSchema = describe(WizardSteps);\nWizzardWithSchema.propTypes = wizzardProps;\n\nexport { WizzardWithSchema };\nexport default WizardSteps;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAA6C;AAC7C,wBAAoC;AACpC,2BAAkC;AAClC,wBAAuB;AACvB,wBAAmC;AAEnC,MAAM,eAAe,4CAAkB,OAAO;AAE9C,qBAAqB,IAAiD;AAAjD,eAAE,YAAU,GAAG,OAAO,aAAtB,IAAmC,uBAAnC,IAAmC,CAAjC,WAAa,SAAO;AACzC,QAAM,QAAQ,0BAAQ,MAAM;AAC1B,UAAM,iBAAiB,CAAC,MAAM,UAAW;AAAA,MACvC;AAAA,MACA,QAAQ,YAAY;AAAA,MACpB,WAAW,QAAQ;AAAA;AAGrB,WAAO,QACH,MAAM,IAAI,CAAC,MAAM,UACf,mDAAC,2BAAD;AAAA,MAAY,KAAK;AAAA,OAAW,OAAU,eAAe,MAAM,YAE7D,qBAAM,SAAS,IAAI,UAAU,CAAC,MAAM,UAClC,+BAAa,MAAM,eAAe,MAAM;AAAA,KAE7C,CAAC,SAAS;AAEb,SAAO,mDAAC,cAAD,mBAAkB,aAAa;AAAA;AAGxC,YAAY,OAAO;AAEnB,MAAM,eAAe;AAAA,EACnB,SAAS,4BAAU,OAChB,YAAY,8BACZ,aAAa;AAAA,EAChB,OAAO,4BAAU,QAAQ,4BAAU,MAAM,KACtC,YAAY,0BACZ,aAAa,IAAI;AAAA,EACpB,UAAU,4BAAU,QAAQ,4BAAU,WAAW,4BAAa,YAC5D;AAAA;AAIJ,YAAY,YAAY;AAExB,MAAM,oBAAoB,gCAAS;AACnC,kBAAkB,YAAY;AAG9B,IAAO,sBAAQ;",
4
+ "sourcesContent": ["/* eslint-disable indent */\n/* eslint-disable react/no-array-index-key */\nimport React, { cloneElement, useMemo } from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport WizardStep from './WizardStep';\nimport { indicatorBlockName } from './blockNames';\n\nconst StepsWrapper = aggregatedClasses('div')(indicatorBlockName);\n\nfunction WizardSteps({ current = 0, steps, children, ...otherProps }) {\n const items = useMemo(() => {\n const mergeStepProps = (step, index) => ({\n index,\n active: current === index,\n completed: index < current,\n });\n\n return steps\n ? steps.map((step, index) => (\n <WizardStep key={index} {...step} {...mergeStepProps(step, index)} />\n ))\n : React.Children.map(children, (item, index) =>\n cloneElement(item, mergeStepProps(item, index)),\n );\n }, [current, children]);\n\n return <StepsWrapper {...otherProps}>{items}</StepsWrapper>;\n}\n\nWizardSteps.Item = WizardStep;\n\nconst wizzardProps = {\n current: PropTypes.number\n .description('Current active state index')\n .defaultValue(0),\n steps: PropTypes.arrayOf(PropTypes.shape({}))\n .description('Array of steps objects')\n .defaultValue([]).isRequired,\n children: PropTypes.arrayOf(PropTypes.instanceOf(WizardStep)).description(\n 'List of WizardStep components',\n ),\n};\n\nWizardSteps.propTypes = wizzardProps;\nWizardSteps.displayName = 'WizardSteps';\nconst WizzardWithSchema = describe(WizardSteps);\nWizzardWithSchema.propTypes = wizzardProps;\n\nexport { WizzardWithSchema };\nexport default WizardSteps;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAA6C;AAC7C,wBAAoC;AACpC,2BAAkC;AAClC,wBAAuB;AACvB,wBAAmC;AAEnC,MAAM,eAAe,4CAAkB,KAAK,EAAE,oCAAkB;AAEhE,qBAAqB,IAAiD;AAAjD,eAAE,YAAU,GAAG,OAAO,aAAtB,IAAmC,uBAAnC,IAAmC,CAAjC,WAAa,SAAO;AACzC,QAAM,QAAQ,0BAAQ,MAAM;AAC1B,UAAM,iBAAiB,CAAC,MAAM,UAAW;AAAA,MACvC;AAAA,MACA,QAAQ,YAAY;AAAA,MACpB,WAAW,QAAQ;AAAA,IACrB;AAEA,WAAO,QACH,MAAM,IAAI,CAAC,MAAM,UACf,mDAAC;AAAA,MAAW,KAAK;AAAA,OAAW,OAAU,eAAe,MAAM,KAAK,EAAG,CACpE,IACD,qBAAM,SAAS,IAAI,UAAU,CAAC,MAAM,UAClC,+BAAa,MAAM,eAAe,MAAM,KAAK,CAAC,CAChD;AAAA,EACN,GAAG,CAAC,SAAS,QAAQ,CAAC;AAEtB,SAAO,mDAAC,iCAAiB,aAAa,KAAM;AAC9C;AAEA,YAAY,OAAO;AAEnB,MAAM,eAAe;AAAA,EACnB,SAAS,4BAAU,OAChB,YAAY,4BAA4B,EACxC,aAAa,CAAC;AAAA,EACjB,OAAO,4BAAU,QAAQ,4BAAU,MAAM,CAAC,CAAC,CAAC,EACzC,YAAY,wBAAwB,EACpC,aAAa,CAAC,CAAC,EAAE;AAAA,EACpB,UAAU,4BAAU,QAAQ,4BAAU,WAAW,yBAAU,CAAC,EAAE,YAC5D,+BACF;AACF;AAEA,YAAY,YAAY;AACxB,YAAY,cAAc;AAC1B,MAAM,oBAAoB,gCAAS,WAAW;AAC9C,kBAAkB,YAAY;AAG9B,IAAO,sBAAQ;",
6
6
  "names": []
7
7
  }
@@ -4,36 +4,29 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
7
  var __export = (target, all) => {
9
8
  for (var name in all)
10
9
  __defProp(target, name, { get: all[name], enumerable: true });
11
10
  };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
16
  }
18
- return target;
17
+ return to;
19
18
  };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
21
  var blockNames_exports = {};
29
22
  __export(blockNames_exports, {
30
23
  indicatorBlockName: () => indicatorBlockName,
31
24
  indicatorItemBlockName: () => indicatorItemBlockName,
32
25
  wizardBlockName: () => wizardBlockName
33
26
  });
27
+ module.exports = __toCommonJS(blockNames_exports);
34
28
  var React = __toESM(require("react"));
35
29
  const wizardBlockName = "wizard";
36
30
  const indicatorBlockName = `${wizardBlockName}-steps-indicator`;
37
31
  const indicatorItemBlockName = `${indicatorBlockName}-step`;
38
- module.exports = __toCommonJS(blockNames_exports);
39
32
  //# sourceMappingURL=blockNames.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/blockNames.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
4
  "sourcesContent": ["export const wizardBlockName = 'wizard';\nexport const indicatorBlockName = `${wizardBlockName}-steps-indicator`;\nexport const indicatorItemBlockName = `${indicatorBlockName}-step`;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,kBAAkB;AACxB,MAAM,qBAAqB,GAAG;AAC9B,MAAM,yBAAyB,GAAG;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,kBAAkB;AACxB,MAAM,qBAAqB,GAAG;AAC9B,MAAM,yBAAyB,GAAG;",
6
6
  "names": []
7
7
  }
package/dist/cjs/index.js CHANGED
@@ -4,27 +4,20 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
7
  var __export = (target, all) => {
9
8
  for (var name in all)
10
9
  __defProp(target, name, { get: all[name], enumerable: true });
11
10
  };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
16
  }
18
- return target;
17
+ return to;
19
18
  };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
21
  var src_exports = {};
29
22
  __export(src_exports, {
30
23
  WizardStep: () => import_WizardStep.default,
@@ -33,9 +26,9 @@ __export(src_exports, {
33
26
  WizzardWithSchema: () => import_WizardSteps.WizzardWithSchema,
34
27
  useWizard: () => import_useWizard.default
35
28
  });
29
+ module.exports = __toCommonJS(src_exports);
36
30
  var React = __toESM(require("react"));
37
31
  var import_WizardSteps = __toESM(require("./WizardSteps"));
38
32
  var import_WizardStep = __toESM(require("./WizardStep"));
39
33
  var import_useWizard = __toESM(require("./useWizard"));
40
- module.exports = __toCommonJS(src_exports);
41
34
  //# sourceMappingURL=index.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
4
  "sourcesContent": ["import WizardStepsIndicator, { WizzardWithSchema } from './WizardSteps';\nimport WizardStep, { WizzardStepWithSchema } from './WizardStep';\nimport useWizard from './useWizard';\n\nexport {\n useWizard,\n WizardStepsIndicator,\n WizardStep,\n WizzardWithSchema,\n WizzardStepWithSchema,\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,yBAAwD;AACxD,wBAAkD;AAClD,uBAAsB;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,yBAAwD;AACxD,wBAAkD;AAClD,uBAAsB;",
6
6
  "names": []
7
7
  }
@@ -4,31 +4,25 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
7
  var __export = (target, all) => {
9
8
  for (var name in all)
10
9
  __defProp(target, name, { get: all[name], enumerable: true });
11
10
  };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
16
  }
18
- return target;
17
+ return to;
19
18
  };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
21
  var useWizard_exports = {};
29
22
  __export(useWizard_exports, {
30
23
  default: () => useWizard
31
24
  });
25
+ module.exports = __toCommonJS(useWizard_exports);
32
26
  var React = __toESM(require("react"));
33
27
  var import_react = require("react");
34
28
  var import_ds_utilities = require("@elliemae/ds-utilities");
@@ -64,5 +58,4 @@ function useWizard({
64
58
  WizardCurrentContent: (0, import_ds_utilities.get)(wizardSteps, [currentStep, "content"], () => null)
65
59
  };
66
60
  }
67
- module.exports = __toCommonJS(useWizard_exports);
68
61
  //# sourceMappingURL=useWizard.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/useWizard.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
4
  "sourcesContent": ["import { useCallback } from 'react';\nimport { get, useDerivedStateFromProps } from '@elliemae/ds-utilities';\n\nconst checkCanNext = (prevIndex, array) => array.length > prevIndex + 1;\nconst checkCanPrevious = prevIndex => prevIndex - 1 >= 0;\n\nconst noop = () => null;\n\nexport default function useWizard({\n steps: wizardSteps,\n current,\n onNext = noop,\n onPrevious = noop,\n initial = 0,\n}) {\n const [currentStep, setCurrentStep] = useDerivedStateFromProps(\n current || initial,\n );\n\n const handleNext = useCallback(() => {\n if (checkCanNext(currentStep, wizardSteps)) {\n onNext(currentStep);\n setCurrentStep(currentStep + 1);\n }\n });\n\n const handlePrevious = useCallback(() => {\n if (checkCanPrevious(currentStep)) {\n onPrevious(currentStep);\n setCurrentStep(currentStep - 1);\n }\n });\n\n return {\n current: currentStep,\n next: handleNext,\n previous: handlePrevious,\n canNext: checkCanNext(currentStep, wizardSteps),\n canPrevious: checkCanPrevious(currentStep),\n WizardCurrentContent: get(\n wizardSteps,\n [currentStep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M,aAAa,8BAAY,MAAM;AACnC,QAAI,aAAa,aAAa,WAAW,GAAG;AAC1C,aAAO,WAAW;AAClB,qBAAe,cAAc,CAAC;AAAA,IAChC;AAAA,EACF,CAAC;AAED,QAAM,iBAAiB,8BAAY,MAAM;AACvC,QAAI,iBAAiB,WAAW,GAAG;AACjC,iBAAW,WAAW;AACtB,qBAAe,cAAc,CAAC;AAAA,IAChC;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS,aAAa,aAAa,WAAW;AAAA,IAC9C,aAAa,iBAAiB,WAAW;AAAA,IACzC,sBAAsB,6BACpB,aACA,CAAC,aAAa,SAAS,GACvB,MAAM,IACR;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -46,6 +46,7 @@ const wizzardStepProps = {
46
46
  index: PropTypes.number.description("Current item index")
47
47
  };
48
48
  WizardStep.propTypes = wizzardStepProps;
49
+ WizardStep.displayName = "WizardStep";
49
50
  const WizzardStepWithSchema = describe(WizardStep);
50
51
  WizzardStepWithSchema.propTypes = wizzardStepProps;
51
52
  var WizardStep_default = WizardStep;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/WizardStep.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable indent */\nimport React, { cloneElement, useMemo, isValidElement } from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { get } from '@elliemae/ds-utilities';\nimport { Checkmark } from '@elliemae/ds-icons';\nimport { indicatorItemBlockName } from './blockNames';\n\nconst Item = aggregatedClasses('div')(`${indicatorItemBlockName}`, null, ({ active, completed }) => ({\n active,\n completed,\n}));\nconst Wrapper = aggregatedClasses('div')(`${indicatorItemBlockName}-wrapper`);\nconst Label = aggregatedClasses('span')(indicatorItemBlockName, 'label');\nconst Bullet = aggregatedClasses('div')(indicatorItemBlockName, 'bullet');\nconst BulletWrapper = aggregatedClasses('div')(indicatorItemBlockName, 'bullet-wrapper');\n\nfunction WizardStep({\n label = '',\n icon = null,\n iconCompleted = <Checkmark />,\n iconActive = null,\n active = false,\n completed = false,\n index = 0,\n}) {\n const currentIcon =\n useMemo(() => {\n if (active) return iconActive;\n if (completed) return iconCompleted;\n return icon;\n }, [active, completed]) || icon;\n\n const iconWithOptions = useMemo(\n () =>\n isValidElement(currentIcon)\n ? cloneElement(currentIcon, {\n color: get(currentIcon, ['props', 'color']) || ['brand-primary', completed ? 600 : 500],\n })\n : currentIcon || index + 1,\n [currentIcon],\n );\n\n return (\n <Item classProps={{ active, completed }}>\n <Wrapper>\n <BulletWrapper>\n <Bullet>{iconWithOptions}</Bullet>\n </BulletWrapper>\n <Label>{label}</Label>\n </Wrapper>\n </Item>\n );\n}\n\nconst wizzardStepProps = {\n label: PropTypes.string.description('Step label'),\n icon: PropTypes.oneOfType([PropTypes.element, PropTypes.string]).description('Default icon or number'),\n iconCompleted: PropTypes.element.description('Icon when the step is completed').defaultValue(Checkmark),\n iconActive: PropTypes.element.description('Icon when the step is active'),\n active: PropTypes.bool.description('Whether the step is active or not').defaultValue(false),\n completed: PropTypes.bool.description('Whether the step is completed or not').defaultValue(false),\n index: PropTypes.number.description('Current item index'),\n};\n\nWizardStep.propTypes = wizzardStepProps;\n\nconst WizzardStepWithSchema = describe(WizardStep);\nWizzardStepWithSchema.propTypes = wizzardStepProps;\n\nexport { WizzardStepWithSchema };\nexport default WizardStep;\n"],
5
- "mappings": "AAAA;ACCA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,OAAO,kBAAkB,OAAO,GAAG,0BAA0B,MAAM,CAAC,EAAE,QAAQ,gBAAiB;AAAA,EACnG;AAAA,EACA;AAAA;AAEF,MAAM,UAAU,kBAAkB,OAAO,GAAG;AAC5C,MAAM,QAAQ,kBAAkB,QAAQ,wBAAwB;AAChE,MAAM,SAAS,kBAAkB,OAAO,wBAAwB;AAChE,MAAM,gBAAgB,kBAAkB,OAAO,wBAAwB;AAEvE,oBAAoB;AAAA,EAClB,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,gBAAgB,qCAAC,WAAD;AAAA,EAChB,aAAa;AAAA,EACb,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,QAAQ;AAAA,GACP;AACD,QAAM,cACJ,QAAQ,MAAM;AACZ,QAAI;AAAQ,aAAO;AACnB,QAAI;AAAW,aAAO;AACtB,WAAO;AAAA,KACN,CAAC,QAAQ,eAAe;AAE7B,QAAM,kBAAkB,QACtB,MACE,eAAe,eACX,aAAa,aAAa;AAAA,IACxB,OAAO,IAAI,aAAa,CAAC,SAAS,aAAa,CAAC,iBAAiB,YAAY,MAAM;AAAA,OAErF,eAAe,QAAQ,GAC7B,CAAC;AAGH,SACE,qCAAC,MAAD;AAAA,IAAM,YAAY,EAAE,QAAQ;AAAA,KAC1B,qCAAC,SAAD,MACE,qCAAC,eAAD,MACE,qCAAC,QAAD,MAAS,mBAEX,qCAAC,OAAD,MAAQ;AAAA;AAMhB,MAAM,mBAAmB;AAAA,EACvB,OAAO,UAAU,OAAO,YAAY;AAAA,EACpC,MAAM,UAAU,UAAU,CAAC,UAAU,SAAS,UAAU,SAAS,YAAY;AAAA,EAC7E,eAAe,UAAU,QAAQ,YAAY,mCAAmC,aAAa;AAAA,EAC7F,YAAY,UAAU,QAAQ,YAAY;AAAA,EAC1C,QAAQ,UAAU,KAAK,YAAY,qCAAqC,aAAa;AAAA,EACrF,WAAW,UAAU,KAAK,YAAY,wCAAwC,aAAa;AAAA,EAC3F,OAAO,UAAU,OAAO,YAAY;AAAA;AAGtC,WAAW,YAAY;AAEvB,MAAM,wBAAwB,SAAS;AACvC,sBAAsB,YAAY;AAGlC,IAAO,qBAAQ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable indent */\nimport React, { cloneElement, useMemo, isValidElement } from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { get } from '@elliemae/ds-utilities';\nimport { Checkmark } from '@elliemae/ds-icons';\nimport { indicatorItemBlockName } from './blockNames';\n\nconst Item = aggregatedClasses('div')(`${indicatorItemBlockName}`, null, ({ active, completed }) => ({\n active,\n completed,\n}));\nconst Wrapper = aggregatedClasses('div')(`${indicatorItemBlockName}-wrapper`);\nconst Label = aggregatedClasses('span')(indicatorItemBlockName, 'label');\nconst Bullet = aggregatedClasses('div')(indicatorItemBlockName, 'bullet');\nconst BulletWrapper = aggregatedClasses('div')(indicatorItemBlockName, 'bullet-wrapper');\n\nfunction WizardStep({\n label = '',\n icon = null,\n iconCompleted = <Checkmark />,\n iconActive = null,\n active = false,\n completed = false,\n index = 0,\n}) {\n const currentIcon =\n useMemo(() => {\n if (active) return iconActive;\n if (completed) return iconCompleted;\n return icon;\n }, [active, completed]) || icon;\n\n const iconWithOptions = useMemo(\n () =>\n isValidElement(currentIcon)\n ? cloneElement(currentIcon, {\n color: get(currentIcon, ['props', 'color']) || ['brand-primary', completed ? 600 : 500],\n })\n : currentIcon || index + 1,\n [currentIcon],\n );\n\n return (\n <Item classProps={{ active, completed }}>\n <Wrapper>\n <BulletWrapper>\n <Bullet>{iconWithOptions}</Bullet>\n </BulletWrapper>\n <Label>{label}</Label>\n </Wrapper>\n </Item>\n );\n}\n\nconst wizzardStepProps = {\n label: PropTypes.string.description('Step label'),\n icon: PropTypes.oneOfType([PropTypes.element, PropTypes.string]).description('Default icon or number'),\n iconCompleted: PropTypes.element.description('Icon when the step is completed').defaultValue(Checkmark),\n iconActive: PropTypes.element.description('Icon when the step is active'),\n active: PropTypes.bool.description('Whether the step is active or not').defaultValue(false),\n completed: PropTypes.bool.description('Whether the step is completed or not').defaultValue(false),\n index: PropTypes.number.description('Current item index'),\n};\n\nWizardStep.propTypes = wizzardStepProps;\nWizardStep.displayName = 'WizardStep';\nconst WizzardStepWithSchema = describe(W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AM,UAAU,UAAU,CAAC,UAAU,SAAS,UAAU,MAAM,CAAC,EAAE,YAAY,wBAAwB;AAAA,EACrG,eAAe,UAAU,QAAQ,YAAY,iCAAiC,EAAE,aAAa,SAAS;AAAA,EACtG,YAAY,UAAU,QAAQ,YAAY,8BAA8B;AAAA,EACxE,QAAQ,UAAU,KAAK,YAAY,mCAAmC,EAAE,aAAa,KAAK;AAAA,EAC1F,WAAW,UAAU,KAAK,YAAY,sCAAsC,EAAE,aAAa,KAAK;AAAA,EAChG,OAAO,UAAU,OAAO,YAAY,oBAAoB;AAC1D;AAEA,WAAW,YAAY;AACvB,WAAW,cAAc;AACzB,MAAM,wBAAwB,SAAS,UAAU;AACjD,sBAAsB,YAAY;AAGlC,IAAO,qBAAQ;",
6
6
  "names": []
7
7
  }
@@ -54,6 +54,7 @@ const wizzardProps = {
54
54
  children: PropTypes.arrayOf(PropTypes.instanceOf(WizardStep)).description("List of WizardStep components")
55
55
  };
56
56
  WizardSteps.propTypes = wizzardProps;
57
+ WizardSteps.displayName = "WizardSteps";
57
58
  const WizzardWithSchema = describe(WizardSteps);
58
59
  WizzardWithSchema.propTypes = wizzardProps;
59
60
  var WizardSteps_default = WizardSteps;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/WizardSteps.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable indent */\n/* eslint-disable react/no-array-index-key */\nimport React, { cloneElement, useMemo } from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport WizardStep from './WizardStep';\nimport { indicatorBlockName } from './blockNames';\n\nconst StepsWrapper = aggregatedClasses('div')(indicatorBlockName);\n\nfunction WizardSteps({ current = 0, steps, children, ...otherProps }) {\n const items = useMemo(() => {\n const mergeStepProps = (step, index) => ({\n index,\n active: current === index,\n completed: index < current,\n });\n\n return steps\n ? steps.map((step, index) => (\n <WizardStep key={index} {...step} {...mergeStepProps(step, index)} />\n ))\n : React.Children.map(children, (item, index) =>\n cloneElement(item, mergeStepProps(item, index)),\n );\n }, [current, children]);\n\n return <StepsWrapper {...otherProps}>{items}</StepsWrapper>;\n}\n\nWizardSteps.Item = WizardStep;\n\nconst wizzardProps = {\n current: PropTypes.number\n .description('Current active state index')\n .defaultValue(0),\n steps: PropTypes.arrayOf(PropTypes.shape({}))\n .description('Array of steps objects')\n .defaultValue([]).isRequired,\n children: PropTypes.arrayOf(PropTypes.instanceOf(WizardStep)).description(\n 'List of WizardStep components',\n ),\n};\n\nWizardSteps.propTypes = wizzardProps;\n\nconst WizzardWithSchema = describe(WizardSteps);\nWizzardWithSchema.propTypes = wizzardProps;\n\nexport { WizzardWithSchema };\nexport default WizardSteps;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;ACEA;AACA;AACA;AACA;AACA;AAEA,MAAM,eAAe,kBAAkB,OAAO;AAE9C,qBAAqB,IAAiD;AAAjD,eAAE,YAAU,GAAG,OAAO,aAAtB,IAAmC,uBAAnC,IAAmC,CAAjC,WAAa,SAAO;AACzC,QAAM,QAAQ,QAAQ,MAAM;AAC1B,UAAM,iBAAiB,CAAC,MAAM,UAAW;AAAA,MACvC;AAAA,MACA,QAAQ,YAAY;AAAA,MACpB,WAAW,QAAQ;AAAA;AAGrB,WAAO,QACH,MAAM,IAAI,CAAC,MAAM,UACf,qCAAC,YAAD;AAAA,MAAY,KAAK;AAAA,OAAW,OAAU,eAAe,MAAM,YAE7D,OAAM,SAAS,IAAI,UAAU,CAAC,MAAM,UAClC,aAAa,MAAM,eAAe,MAAM;AAAA,KAE7C,CAAC,SAAS;AAEb,SAAO,qCAAC,cAAD,mBAAkB,aAAa;AAAA;AAGxC,YAAY,OAAO;AAEnB,MAAM,eAAe;AAAA,EACnB,SAAS,UAAU,OAChB,YAAY,8BACZ,aAAa;AAAA,EAChB,OAAO,UAAU,QAAQ,UAAU,MAAM,KACtC,YAAY,0BACZ,aAAa,IAAI;AAAA,EACpB,UAAU,UAAU,QAAQ,UAAU,WAAW,aAAa,YAC5D;AAAA;AAIJ,YAAY,YAAY;AAExB,MAAM,oBAAoB,SAAS;AACnC,kBAAkB,YAAY;AAG9B,IAAO,sBAAQ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable indent */\n/* eslint-disable react/no-array-index-key */\nimport React, { cloneElement, useMemo } from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport WizardStep from './WizardStep';\nimport { indicatorBlockName } from './blockNames';\n\nconst StepsWrapper = aggregatedClasses('div')(indicatorBlockName);\n\nfunction WizardSteps({ current = 0, steps, children, ...otherProps }) {\n const items = useMemo(() => {\n const mergeStepProps = (step, index) => ({\n index,\n active: current === index,\n completed: index < current,\n });\n\n return steps\n ? steps.map((step, index) => (\n <WizardStep key={index} {...step} {...mergeStepProps(step, index)} />\n ))\n : React.Children.map(children, (item, index) =>\n cloneElement(item, mergeStepProps(item, index)),\n );\n }, [current, children]);\n\n return <StepsWrapper {...otherProps}>{items}</StepsWrapper>;\n}\n\nWizardSteps.Item = WizardStep;\n\nconst wizzardProps = {\n current: PropTypes.number\n .description('Current active state index')\n .defaultValue(0),\n steps: PropTypes.arrayOf(PropTypes.shape({}))\n .description('Array of steps objects')\n .defaultValue([]).isRequired,\n children: PropTypes.arrayOf(PropTypes.instanceOf(WizardStep)).description(\n 'List of WizardStep components',\n ),\n};\n\nWizardSteps.propTypes = wizzardProps;\nWizardSteps.displayName = 'WizardSteps';\nconst WizzardWithSchema = describe(WizardSteps);\nWizzardWithSchema.propTypes = wizzardProps;\n\nexport { WizzardWithSchema };\nexport default WizardSteps;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;ACEA;AACA;AACA;AACA;AACA;AAEA,MAAM,eAAe,kBAAkB,KAAK,EAAE,kBAAkB;AAEhE,qBAAqB,IAAiD;AAAjD,eAAE,YAAU,GAAG,OAAO,aAAtB,IAAmC,uBAAnC,IAAmC,CAAjC,WAAa,SAAO;AACzC,QAAM,QAAQ,QAAQ,MAAM;AAC1B,UAAM,iBAAiB,CAAC,MAAM,UAAW;AAAA,MACvC;AAAA,MACA,QAAQ,YAAY;AAAA,MACpB,WAAW,QAAQ;AAAA,IACrB;AAEA,WAAO,QACH,MAAM,IAAI,CAAC,MAAM,UACf,qCAAC;AAAA,MAAW,KAAK;AAAA,OAAW,OAAU,eAAe,MAAM,KAAK,EAAG,CACpE,IACD,OAAM,SAAS,IAAI,UAAU,CAAC,MAAM,UAClC,aAAa,MAAM,eAAe,MAAM,KAAK,CAAC,CAChD;AAAA,EACN,GAAG,CAAC,SAAS,QAAQ,CAAC;AAEtB,SAAO,qCAAC,iCAAiB,aAAa,KAAM;AAC9C;AAEA,YAAY,OAAO;AAEnB,MAAM,eAAe;AAAA,EACnB,SAAS,UAAU,OAChB,YAAY,4BAA4B,EACxC,aAAa,CAAC;AAAA,EACjB,OAAO,UAAU,QAAQ,UAAU,MAAM,CAAC,CAAC,CAAC,EACzC,YAAY,wBAAwB,EACpC,aAAa,CAAC,CAAC,EAAE;AAAA,EACpB,UAAU,UAAU,QAAQ,UAAU,WAAW,UAAU,CAAC,EAAE,YAC5D,+BACF;AACF;AAEA,YAAY,YAAY;AACxB,YAAY,cAAc;AAC1B,MAAM,oBAAoB,SAAS,WAAW;AAC9C,kBAAkB,YAAY;AAG9B,IAAO,sBAAQ;",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/useWizard.tsx"],
4
4
  "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useCallback } from 'react';\nimport { get, useDerivedStateFromProps } from '@elliemae/ds-utilities';\n\nconst checkCanNext = (prevIndex, array) => array.length > prevIndex + 1;\nconst checkCanPrevious = prevIndex => prevIndex - 1 >= 0;\n\nconst noop = () => null;\n\nexport default function useWizard({\n steps: wizardSteps,\n current,\n onNext = noop,\n onPrevious = noop,\n initial = 0,\n}) {\n const [currentStep, setCurrentStep] = useDerivedStateFromProps(\n current || initial,\n );\n\n const handleNext = useCallback(() => {\n if (checkCanNext(currentStep, wizardSteps)) {\n onNext(currentStep);\n setCurrentStep(currentStep + 1);\n }\n });\n\n const handlePrevious = useCallback(() => {\n if (checkCanPrevious(currentStep)) {\n onPrevious(currentStep);\n setCurrentStep(currentStep - 1);\n }\n });\n\n return {\n current: currentStep,\n next: handleNext,\n previous: handlePrevious,\n canNext: checkCanNext(currentStep, wizardSteps),\n canPrevious: checkCanPrevious(currentStep),\n WizardCurrentContent: get(\n wizardSteps,\n [currentStep, 'content'],\n () => null,\n ),\n };\n}\n"],
5
- "mappings": "AAAA;ACAA;AACA;AAEA,MAAM,eAAe,CAAC,WAAW,UAAU,MAAM,SAAS,YAAY;AACtE,MAAM,mBAAmB,eAAa,YAAY,KAAK;AAEvD,MAAM,OAAO,MAAM;AAEJ,mBAAmB;AAAA,EAChC,OAAO;AAAA,EACP;AAAA,EACA,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU;AAAA,GACT;AACD,QAAM,CAAC,aAAa,kBAAkB,yBACpC,WAAW;AAGb,QAAM,aAAa,YAAY,MAAM;AACnC,QAAI,aAAa,aAAa,cAAc;AAC1C,aAAO;AACP,qBAAe,cAAc;AAAA;AAAA;AAIjC,QAAM,iBAAiB,YAAY,MAAM;AACvC,QAAI,iBAAiB,cAAc;AACjC,iBAAW;AACX,qBAAe,cAAc;AAAA;AAAA;AAIjC,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS,aAAa,aAAa;AAAA,IACnC,aAAa,iBAAiB;AAAA,IAC9B,sBAAsB,IACpB,aACA,CAAC,aAAa,YACd,MAAM;AAAA;AAAA;",
5
+ "mappings": "AAAA;ACAA;AACA;AAEA,MAAM,eAAe,CAAC,WAAW,UAAU,MAAM,SAAS,YAAY;AACtE,MAAM,mBAAmB,eAAa,YAAY,KAAK;AAEvD,MAAM,OAAO,MAAM;AAEJ,mBAAmB;AAAA,EAChC,OAAO;AAAA,EACP;AAAA,EACA,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU;AAAA,GACT;AACD,QAAM,CAAC,aAAa,kBAAkB,yBACpC,WAAW,OACb;AAEA,QAAM,aAAa,YAAY,MAAM;AACnC,QAAI,aAAa,aAAa,WAAW,GAAG;AAC1C,aAAO,WAAW;AAClB,qBAAe,cAAc,CAAC;AAAA,IAChC;AAAA,EACF,CAAC;AAED,QAAM,iBAAiB,YAAY,MAAM;AACvC,QAAI,iBAAiB,WAAW,GAAG;AACjC,iBAAW,WAAW;AACtB,qBAAe,cAAc,CAAC;AAAA,IAChC;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS,aAAa,aAAa,WAAW;AAAA,IAC9C,aAAa,iBAAiB,WAAW;AAAA,IACzC,sBAAsB,IACpB,aACA,CAAC,aAAa,SAAS,GACvB,MAAM,IACR;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-wizard",
3
- "version": "3.0.0-next.9",
3
+ "version": "3.0.1",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Wizard",
6
6
  "files": [
@@ -54,12 +54,19 @@
54
54
  "reportFile": "tests.xml",
55
55
  "indent": 4
56
56
  },
57
+ "scripts": {
58
+ "dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
59
+ "test": "node ../../scripts/testing/test.mjs",
60
+ "lint": "node ../../scripts/lint.mjs",
61
+ "dts": "node ../../scripts/dts.mjs",
62
+ "build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
63
+ },
57
64
  "dependencies": {
58
- "@elliemae/ds-button": "3.0.0-next.9",
59
- "@elliemae/ds-classnames": "3.0.0-next.9",
60
- "@elliemae/ds-icons": "3.0.0-next.9",
61
- "@elliemae/ds-utilities": "3.0.0-next.9",
62
- "@elliemae/ds-wizard": "3.0.0-next.9",
65
+ "@elliemae/ds-button": "workspace:*",
66
+ "@elliemae/ds-classnames": "workspace:*",
67
+ "@elliemae/ds-icons": "workspace:*",
68
+ "@elliemae/ds-utilities": "workspace:*",
69
+ "@elliemae/ds-wizard": "workspace:*",
63
70
  "prop-types": "~15.8.1",
64
71
  "react-desc": "~4.1.3"
65
72
  },
@@ -71,12 +78,5 @@
71
78
  "publishConfig": {
72
79
  "access": "public",
73
80
  "typeSafety": false
74
- },
75
- "scripts": {
76
- "dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
77
- "test": "node ../../scripts/testing/test.mjs",
78
- "lint": "node ../../scripts/lint.mjs",
79
- "dts": "node ../../scripts/dts.mjs",
80
- "build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
81
81
  }
82
- }
82
+ }