@data-driven-forms/carbon-component-mapper
Advanced tools
Comparing version 2.18.3 to 2.18.4
@@ -1,2 +0,2 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./defineProperty-75110086.js"),t=require("./extends-edb29469.js"),r=require("./objectWithoutProperties-6a6333c3.js"),n=require("react"),o=_interopDefault(n),a=_interopDefault(require("prop-types")),i=require("./clsx.m-fe63e0e7.js"),s=_interopDefault(require("@data-driven-forms/react-form-renderer/dist/cjs/use-form-api")),c=require("./toConsumableArray-43caa138.js"),p=require("./typeof-aef86737.js"),u=require("./slicedToArray-bbb33c2c.js"),d=_interopDefault(require("@data-driven-forms/react-form-renderer/dist/cjs/wizard-context")),l=require("./_arrayPush-f10aef75.js"),f=_interopDefault(require("@data-driven-forms/react-form-renderer/dist/cjs/form-spy")),b=_interopDefault(require("carbon-components-react/lib/components/Button/Button.js")),v=_interopDefault(require("carbon-components-react/lib/components/Grid/Column.js")),m=_interopDefault(require("carbon-components-react/lib/components/Grid/Grid.js")),S=_interopDefault(require("carbon-components-react/lib/components/Grid/Row.js")),y=require("carbon-components-react/lib/components/ProgressIndicator/ProgressIndicator.js");var j=function isSymbol(e){return"symbol"==typeof e||l.isObjectLike(e)&&"[object Symbol]"==l.baseGetTag(e)},g=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,x=/^\w*$/;var _=function isKey(e,t){if(l.isArray(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!j(e))||(x.test(e)||!g.test(e)||null!=t&&e in Object(t))};function memoize(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var memoized=function(){var r=arguments,n=t?t.apply(this,r):r[0],o=memoized.cache;if(o.has(n))return o.get(n);var a=e.apply(this,r);return memoized.cache=o.set(n,a)||o,a};return memoized.cache=new(memoize.Cache||l.MapCache),memoized}memoize.Cache=l.MapCache;var O=memoize;var P=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,h=/\\(\\)?/g,w=function memoizeCapped(e){var t=O(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(P,(function(e,r,n,o){t.push(n?o.replace(h,"$1"):r||e)})),t}));var I=function arrayMap(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o},D=l.Symbol?l.Symbol.prototype:void 0,z=D?D.toString:void 0;var B=function baseToString(e){if("string"==typeof e)return e;if(l.isArray(e))return I(e,baseToString)+"";if(j(e))return z?z.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var E=function toString(e){return null==e?"":B(e)};var C=function castPath(e,t){return l.isArray(e)?e:_(e,t)?[e]:w(E(e))};var N=function toKey(e){if("string"==typeof e||j(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var T=function baseGet(e,t){for(var r=0,n=(t=C(t,e)).length;null!=e&&r<n;)e=e[N(t[r++])];return r&&r==n?e:void 0};var W=function get(e,t,r){var n=null==e?void 0:T(e,t);return void 0===n?r:n},$=function(){try{var e=l.getNative(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var q=function baseAssignValue(e,t,r){"__proto__"==t&&$?$(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},k=Object.prototype.hasOwnProperty;var A=function assignValue(e,t,r){var n=e[t];k.call(e,t)&&l.eq(n,r)&&(void 0!==r||t in e)||q(e,t,r)};var K=function baseSet(e,t,r,n){if(!l.isObject(e))return e;for(var o=-1,a=(t=C(t,e)).length,i=a-1,s=e;null!=s&&++o<a;){var c=N(t[o]),p=r;if(o!=i){var u=s[c];void 0===(p=n?n(u,c,s):void 0)&&(p=l.isObject(u)?u:l.isIndex(t[o+1])?[]:{})}A(s,c,p),s=s[c]}return e};var F=function set(e,t,r){return null==e?e:K(e,t,r)},L=l.Symbol?l.Symbol.isConcatSpreadable:void 0;var M=function isFlattenable(e){return l.isArray(e)||l.isArguments(e)||!!(L&&e&&e[L])};var R=function baseFlatten(e,t,r,n,o){var a=-1,i=e.length;for(r||(r=M),o||(o=[]);++a<i;){var s=e[a];t>0&&r(s)?t>1?baseFlatten(s,t-1,r,n,o):l.arrayPush(o,s):n||(o[o.length]=s)}return o};var G=function flattenDeep(e){return(null==e?0:e.length)?R(e,1/0):[]},H=function selectNext(e,t){if("string"==typeof e)return e;if("function"==typeof e)return e({values:t().values});var r=W(t().values,e.when);return e.stepMapper[r]};function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(n),!0).forEach((function(r){e._defineProperty(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var V=["function","object"],J=function createSchema(e){for(var t=e.formOptions,r=e.fields,n=t.getState().values,o=[],a=r[0],i=-1,s=function _loop(){var e,t;i+=1,o=[].concat(c._toConsumableArray(o),[{name:a.name,title:a.title,substepOf:(null===(e=a.substepOf)||void 0===e?void 0:e.name)||a.substepOf,substepOfTitle:(null===(t=a.substepOf)||void 0===t?void 0:t.title)||a.substepOf,index:i,primary:!o[o.length-1]||!a.substepOf||a.substepOf!==o[o.length-1].substepOf}]);var s=a.nextStep;"object"===p._typeof(a.nextStep)&&(s=s.stepMapper[W(n,s.when)]),"function"==typeof a.nextStep&&(s=a.nextStep({values:n})),a=s?r.find((function(e){return e.name===s})):void 0};a;)s();return o},Q=function findCurrentStep(e,t){return t.find((function(t){return t.name===e}))},U=function reducer(t,r){var n=r.type,o=r.payload;switch(n){case"finishLoading":return _objectSpread(_objectSpread({},t),{},{loading:!1,navSchema:J({fields:o.fields,formOptions:o.formOptions})});case"handleNext":return function handleNext(t,r,n,o){var a=t.activeStepIndex+1,i=t.prevSteps.includes(t.activeStep);return _objectSpread(_objectSpread({},t),{},{registeredFieldsHistory:_objectSpread(_objectSpread({},t.registeredFieldsHistory),{},e._defineProperty({},t.activeStep,n.getRegisteredFields())),activeStep:r,prevSteps:i?t.prevSteps:[].concat(c._toConsumableArray(t.prevSteps),[t.activeStep]),activeStepIndex:a,maxStepIndex:a>t.maxStepIndex?a:t.maxStepIndex,navSchema:t.isDynamic?J({fields:o,formOptions:n}):t.navSchema})}(t,o.nextStep,o.formOptions,o.fields);case"setPrevSteps":return _objectSpread(_objectSpread({},t),{},{prevSteps:t.prevSteps.slice(0,t.activeStepIndex),maxStepIndex:t.activeStepIndex,navSchema:J({fields:o.fields,formOptions:o.formOptions})});case"jumpToStep":return function jumpToStep(e,t,r,n,o,a){if(t===e.activeStepIndex)return e;if(e.prevSteps[t]){var i,s=e.prevSteps.includes(e.activeStep,n);i=e.activeStep;var u=_objectSpread(_objectSpread({},e),{},{activeStep:e.prevSteps[t],prevSteps:s?e.prevSteps:[].concat(c._toConsumableArray(e.prevSteps),[e.activeStep]),activeStepIndex:t}),d=Q(u.prevSteps[t],n),l=V.includes(p._typeof(d.nextStep)),f=o,b=u.isDynamic&&l,v=!1===r,m=_objectSpread({},u);if(b&&!f)m=_objectSpread(_objectSpread({},m),{},{navSchema:J({formOptions:a,fields:n}),prevSteps:u.prevSteps.slice(0,t),maxStepIndex:t});else if(d.disableForwardJumping)m=_objectSpread(_objectSpread({},m),{},{prevSteps:u.prevSteps.slice(0,t),maxStepIndex:t});else if(v){var S=u.prevSteps.indexOf(i);m=_objectSpread(_objectSpread({},m),{},{prevSteps:u.prevSteps.slice(0,S+1),maxStepIndex:u.prevSteps.slice(0,S+1).length-1})}return m}}(t,o.index,o.valid,o.fields,o.crossroads,o.formOptions);default:return t}};function ownKeys$1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread$1(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?ownKeys$1(Object(n),!0).forEach((function(r){e._defineProperty(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys$1(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var X=function Wizard(t){var a=t.fields,i=t.isDynamic,l=t.crossroads,Wizard=t.Wizard,f=(t.component,t.initialState),b=r._objectWithoutProperties(t,["fields","isDynamic","crossroads","Wizard","component","initialState"]),v=s(),m=n.useReducer(U,_objectSpread$1(_objectSpread$1({activeStep:a[0].name,prevSteps:[],activeStepIndex:0,maxStepIndex:0},f),{},{isDynamic:i||a.some((function(e){var t=e.nextStep;return V.includes(p._typeof(t))})),loading:!0})),S=u._slicedToArray(m,2),y=S[0],j=S[1];if(n.useEffect((function(){j({type:"finishLoading",payload:{formOptions:v,fields:a}})}),[a]),y.loading)return null;var g=function handleSubmit(){return v.onSubmit(function prepareValues(t,r,n){var o=_objectSpread$1(_objectSpread$1({},y.registeredFieldsHistory),{},e._defineProperty({},y.activeStep,n())),a={};return G(Object.values([].concat(c._toConsumableArray(r),[y.activeStep]).reduce((function(t,r){return _objectSpread$1(_objectSpread$1({},t),{},e._defineProperty({},r,o[r]))}),{}))).forEach((function(e){return F(a,e,W(t,e))})),a}(v.getState().values,[].concat(c._toConsumableArray(y.prevSteps),[y.activeStep]),v.getRegisteredFields),v,y)},x=function jumpToStep(e,t){return j({type:"jumpToStep",payload:{index:e,valid:t,fields:a,crossroads:l,formOptions:v}})},_=function handleNext(e){return j({type:"handleNext",payload:{nextStep:e,formOptions:v,fields:a}})},O=function findCurrentStepWrapped(e){return Q(e,a)};return o.createElement(d.Provider,{value:{handleNext:_,onKeyDown:function onKeyDown(e){return function enterHandler(e,t,r,n,o,a){if("Enter"===e.key&&"button"!==e.target.type){e.preventDefault();var i,s=n(r).nextStep,c=n(r).buttons;s&&(i=H(s,t.getState));var p=t.valid&&!t.getState().validating;p&&i&&!c?o(i,t.getRegisteredFields):!p||s||c||a()}}(e,v,y.activeStep,O,_,g)},setPrevSteps:function setPrevSteps(){return j({type:"setPrevSteps",payload:{formOptions:v,fields:a}})},currentStep:Q(y.activeStep,a),jumpToStep:x,handlePrev:function handlePrev(){return x(y.activeStepIndex-1)},formOptions:_objectSpread$1(_objectSpread$1({},v),{},{onCancel:function onCancel(){return v.onCancel(y)},handleSubmit:g}),navSchema:y.navSchema,activeStepIndex:y.activeStepIndex,maxStepIndex:y.maxStepIndex,isDynamic:y.isDynamic,crossroads:l,prevSteps:y.prevSteps,selectNext:H}},o.createElement(Wizard,b))};X.propTypes={fields:a.arrayOf(a.shape({name:a.oneOfType([a.string,a.number]).isRequired})).isRequired,isDynamic:a.bool,crossroads:a.arrayOf(a.string),Wizard:a.oneOfType([a.node,a.func]),component:a.any,initialState:a.object};a.object,a.func,a.func,a.func,a.func,a.func,a.array,a.number,a.number,a.shape({onCancel:a.func}),a.array;function ownKeys$2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread$2(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?ownKeys$2(Object(n),!0).forEach((function(r){e._defineProperty(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys$2(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}!function ___$insertStyle(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}(".ddorg__carbon-wizard-navigation-horizontal {\n margin-bottom: 48px;\n}\n\n.ddorg__carbon-wizard-button-set {\n margin-top: 48px;\n flex-direction: row-reverse;\n display: flex;\n}\n\n.ddorg__carbon-wizard-body > :not(:last-child) {\n margin-bottom: 32px;\n}");var Y=function WizardNav(e){var n=e.stepsInfo,a=e.jumpToStep,s=r._objectWithoutProperties(e,["stepsInfo","jumpToStep"]);return o.createElement(y.ProgressIndicator,t._extends({onChange:function onChange(e){return s.currentIndex>e?a(e,!0):void 0}},s,{className:i.clsx("ddorg__carbon-wizard-navigation-horizontal",s.className)}),n.map((function(e,n){var a=e.title,i=r._objectWithoutProperties(e,["title"]);return o.createElement(y.ProgressStep,t._extends({key:n,label:a,disabled:n>s.currentIndex},i))})))};Y.propTypes={stepsInfo:a.arrayOf(a.shape({title:a.node})),currentIndex:a.number,jumpToStep:a.func,className:a.string};var Z={submit:"Submit",back:"Back",next:"Next"},ee=function Layout(e){var r=e.nav,n=e.fields,a=e.WizardBodyProps;return o.createElement(o.Fragment,null,r,o.createElement("div",t._extends({},a,{className:i.clsx("ddorg__carbon-wizard-body",null==a?void 0:a.className)}),n))};ee.propTypes={nav:a.node,fields:a.node,WizardBodyProps:a.object};var te=function VerticalLayout(e){var r=e.nav,n=e.fields,a=e.WizardBodyProps;return o.createElement(m,{narrow:!0},o.createElement(S,null,o.createElement(v,{sm:1,md:2,lg:3},r),o.createElement(v,t._extends({},a,{className:i.clsx("ddorg__carbon-wizard-body",null==a?void 0:a.className)}),n)))};te.propTypes={nav:a.node,fields:a.node,WizardBodyProps:a.object};var re=function WizardInternal(e){var a=e.stepsInfo,s=e.buttonLabels,c=e.ButtonSetProps,p=e.BackButtonProps,u=e.NextButtonProps,l=e.SubmitButtonProps,v=e.ProgressIndicatorProps,m=e.vertical,S=e.WizardBodyProps,y=r._objectWithoutProperties(e,["stepsInfo","buttonLabels","ButtonSetProps","BackButtonProps","NextButtonProps","SubmitButtonProps","ProgressIndicatorProps","vertical","WizardBodyProps"]),j=n.useContext(d),g=j.formOptions,x=j.currentStep,_=j.handlePrev,O=j.onKeyDown,P=j.handleNext,h=j.activeStepIndex,w=j.selectNext,I=j.jumpToStep,D=_objectSpread$2(_objectSpread$2({},Z),s),z=a&&o.createElement(Y,t._extends({vertical:m,stepsInfo:a,currentIndex:h,jumpToStep:I},v)),B=x.fields.map((function(e){return g.renderForm([e],g)})),E=m&&z?te:ee;return o.createElement("div",t._extends({onKeyDown:O},y),o.createElement(E,{nav:z||null,fields:B,WizardBodyProps:S}),o.createElement(f,null,(function(e){var r=e.invalid,n=e.validating,a=e.submitting;return o.createElement("div",t._extends({},c,{className:i.clsx("ddorg__carbon-wizard-button-set",c.className)}),x.nextStep?o.createElement(b,t._extends({onClick:function onClick(){return P(w(x.nextStep,g.getState))},disabled:!g.valid||r||n||a},u),D.next):o.createElement(b,t._extends({onClick:function onClick(){return g.handleSubmit()},disabled:!g.valid||r||n||a},l),D.submit),o.createElement(b,t._extends({kind:"secondary",onClick:_,disabled:0===h},p),D.back))})))};re.propTypes={stepsInfo:a.arrayOf(a.shape({title:a.node})),buttonLabels:a.shape({submit:a.node,back:a.node,next:a.node}),BackButtonProps:a.object,NextButtonProps:a.object,SubmitButtonProps:a.object,ButtonSetProps:a.object,ProgressIndicatorProps:a.object,vertical:a.bool,WizardBodyProps:a.object},re.defaultProps={BackButtonProps:{},NextButtonProps:{},SubmitButtonProps:{},ButtonSetProps:{},ProgressIndicatorProps:{},WizardBodyProps:{}};exports.default=function Wizard$1(e){return o.createElement(X,t._extends({Wizard:re},e))}; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./defineProperty-75110086.js"),t=require("./extends-edb29469.js"),r=require("./objectWithoutProperties-6a6333c3.js"),n=require("react"),o=_interopDefault(n),a=_interopDefault(require("prop-types")),i=require("./clsx.m-fe63e0e7.js"),s=_interopDefault(require("@data-driven-forms/react-form-renderer/dist/cjs/use-form-api")),c=require("./toConsumableArray-43caa138.js"),p=require("./typeof-aef86737.js"),u=require("./slicedToArray-bbb33c2c.js"),d=_interopDefault(require("@data-driven-forms/react-form-renderer/dist/cjs/wizard-context")),l=require("./_arrayPush-f10aef75.js"),f=_interopDefault(require("@data-driven-forms/react-form-renderer/dist/cjs/form-spy")),b=_interopDefault(require("carbon-components-react/lib/components/Button/Button.js")),v=_interopDefault(require("carbon-components-react/lib/components/Grid/Column.js")),m=_interopDefault(require("carbon-components-react/lib/components/Grid/Grid.js")),S=_interopDefault(require("carbon-components-react/lib/components/Grid/Row.js")),y=require("carbon-components-react/lib/components/ProgressIndicator/ProgressIndicator.js");var j=function isSymbol(e){return"symbol"==typeof e||l.isObjectLike(e)&&"[object Symbol]"==l.baseGetTag(e)},g=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,x=/^\w*$/;var _=function isKey(e,t){if(l.isArray(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!j(e))||(x.test(e)||!g.test(e)||null!=t&&e in Object(t))};function memoize(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var memoized=function(){var r=arguments,n=t?t.apply(this,r):r[0],o=memoized.cache;if(o.has(n))return o.get(n);var a=e.apply(this,r);return memoized.cache=o.set(n,a)||o,a};return memoized.cache=new(memoize.Cache||l.MapCache),memoized}memoize.Cache=l.MapCache;var O=memoize;var P=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,h=/\\(\\)?/g,w=function memoizeCapped(e){var t=O(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(P,(function(e,r,n,o){t.push(n?o.replace(h,"$1"):r||e)})),t}));var I=function arrayMap(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o},D=l.Symbol?l.Symbol.prototype:void 0,z=D?D.toString:void 0;var B=function baseToString(e){if("string"==typeof e)return e;if(l.isArray(e))return I(e,baseToString)+"";if(j(e))return z?z.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var E=function toString(e){return null==e?"":B(e)};var C=function castPath(e,t){return l.isArray(e)?e:_(e,t)?[e]:w(E(e))};var T=function toKey(e){if("string"==typeof e||j(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var N=function baseGet(e,t){for(var r=0,n=(t=C(t,e)).length;null!=e&&r<n;)e=e[T(t[r++])];return r&&r==n?e:void 0};var W=function get(e,t,r){var n=null==e?void 0:N(e,t);return void 0===n?r:n},$=function(){try{var e=l.getNative(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var q=function baseAssignValue(e,t,r){"__proto__"==t&&$?$(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},k=Object.prototype.hasOwnProperty;var A=function assignValue(e,t,r){var n=e[t];k.call(e,t)&&l.eq(n,r)&&(void 0!==r||t in e)||q(e,t,r)};var K=function baseSet(e,t,r,n){if(!l.isObject(e))return e;for(var o=-1,a=(t=C(t,e)).length,i=a-1,s=e;null!=s&&++o<a;){var c=T(t[o]),p=r;if(o!=i){var u=s[c];void 0===(p=n?n(u,c,s):void 0)&&(p=l.isObject(u)?u:l.isIndex(t[o+1])?[]:{})}A(s,c,p),s=s[c]}return e};var F=function set(e,t,r){return null==e?e:K(e,t,r)},L=l.Symbol?l.Symbol.isConcatSpreadable:void 0;var M=function isFlattenable(e){return l.isArray(e)||l.isArguments(e)||!!(L&&e&&e[L])};var R=function baseFlatten(e,t,r,n,o){var a=-1,i=e.length;for(r||(r=M),o||(o=[]);++a<i;){var s=e[a];t>0&&r(s)?t>1?baseFlatten(s,t-1,r,n,o):l.arrayPush(o,s):n||(o[o.length]=s)}return o};var G=function flattenDeep(e){return(null==e?0:e.length)?R(e,1/0):[]},H=function selectNext(e,t){if("string"==typeof e)return e;if("function"==typeof e)return e({values:t().values});var r=W(t().values,e.when);return e.stepMapper[r]};function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(n),!0).forEach((function(r){e._defineProperty(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var V=["function","object"],J=function createSchema(e){for(var t=e.formOptions,r=e.fields,n=t.getState().values,o=[],a=r[0],i=-1,s=function _loop(){var e,t,s,u;i+=1,o=[].concat(c._toConsumableArray(o),[{name:a.name,title:a.title,substepOf:(null===(e=a.substepOf)||void 0===e?void 0:e.name)||a.substepOf,substepOfTitle:a.substepOf===(null===(t=o[o.length-1])||void 0===t?void 0:t.substepOf)&&(null===(s=o[o.length-1])||void 0===s?void 0:s.substepOfTitle)||(null===(u=a.substepOf)||void 0===u?void 0:u.title)||a.substepOf,index:i,primary:!o[o.length-1]||!a.substepOf||a.substepOf!==o[o.length-1].substepOf}]);var d=a.nextStep;"object"===p._typeof(a.nextStep)&&(d=d.stepMapper[W(n,d.when)]),"function"==typeof a.nextStep&&(d=a.nextStep({values:n})),a=d?r.find((function(e){return e.name===d})):void 0};a;)s();return o},Q=function findCurrentStep(e,t){return t.find((function(t){return t.name===e}))},U=function reducer(t,r){var n=r.type,o=r.payload;switch(n){case"finishLoading":return _objectSpread(_objectSpread({},t),{},{loading:!1,navSchema:J({fields:o.fields,formOptions:o.formOptions})});case"handleNext":return function handleNext(t,r,n,o){var a=t.activeStepIndex+1,i=t.prevSteps.includes(t.activeStep);return _objectSpread(_objectSpread({},t),{},{registeredFieldsHistory:_objectSpread(_objectSpread({},t.registeredFieldsHistory),{},e._defineProperty({},t.activeStep,n.getRegisteredFields())),activeStep:r,prevSteps:i?t.prevSteps:[].concat(c._toConsumableArray(t.prevSteps),[t.activeStep]),activeStepIndex:a,maxStepIndex:a>t.maxStepIndex?a:t.maxStepIndex,navSchema:t.isDynamic?J({fields:o,formOptions:n}):t.navSchema})}(t,o.nextStep,o.formOptions,o.fields);case"setPrevSteps":return _objectSpread(_objectSpread({},t),{},{prevSteps:t.prevSteps.slice(0,t.activeStepIndex),maxStepIndex:t.activeStepIndex,navSchema:J({fields:o.fields,formOptions:o.formOptions})});case"jumpToStep":return function jumpToStep(e,t,r,n,o,a){if(t===e.activeStepIndex)return e;if(e.prevSteps[t]){var i,s=e.prevSteps.includes(e.activeStep,n);i=e.activeStep;var u=_objectSpread(_objectSpread({},e),{},{activeStep:e.prevSteps[t],prevSteps:s?e.prevSteps:[].concat(c._toConsumableArray(e.prevSteps),[e.activeStep]),activeStepIndex:t}),d=Q(u.prevSteps[t],n),l=V.includes(p._typeof(d.nextStep)),f=o,b=u.isDynamic&&l,v=!1===r,m=_objectSpread({},u);if(b&&!f)m=_objectSpread(_objectSpread({},m),{},{navSchema:J({formOptions:a,fields:n}),prevSteps:u.prevSteps.slice(0,t),maxStepIndex:t});else if(d.disableForwardJumping)m=_objectSpread(_objectSpread({},m),{},{prevSteps:u.prevSteps.slice(0,t),maxStepIndex:t});else if(v){var S=u.prevSteps.indexOf(i);m=_objectSpread(_objectSpread({},m),{},{prevSteps:u.prevSteps.slice(0,S+1),maxStepIndex:u.prevSteps.slice(0,S+1).length-1})}return m}}(t,o.index,o.valid,o.fields,o.crossroads,o.formOptions);default:return t}};function ownKeys$1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread$1(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?ownKeys$1(Object(n),!0).forEach((function(r){e._defineProperty(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys$1(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var X=function Wizard(t){var a=t.fields,i=t.isDynamic,l=t.crossroads,Wizard=t.Wizard,f=(t.component,t.initialState),b=r._objectWithoutProperties(t,["fields","isDynamic","crossroads","Wizard","component","initialState"]),v=s(),m=n.useReducer(U,_objectSpread$1(_objectSpread$1({activeStep:a[0].name,prevSteps:[],activeStepIndex:0,maxStepIndex:0},f),{},{isDynamic:i||a.some((function(e){var t=e.nextStep;return V.includes(p._typeof(t))})),loading:!0})),S=u._slicedToArray(m,2),y=S[0],j=S[1];if(n.useEffect((function(){j({type:"finishLoading",payload:{formOptions:v,fields:a}})}),[a]),y.loading)return null;var g=function handleSubmit(){return v.onSubmit(function prepareValues(t,r,n){var o=_objectSpread$1(_objectSpread$1({},y.registeredFieldsHistory),{},e._defineProperty({},y.activeStep,n())),a={};return G(Object.values([].concat(c._toConsumableArray(r),[y.activeStep]).reduce((function(t,r){return _objectSpread$1(_objectSpread$1({},t),{},e._defineProperty({},r,o[r]))}),{}))).forEach((function(e){return F(a,e,W(t,e))})),a}(v.getState().values,[].concat(c._toConsumableArray(y.prevSteps),[y.activeStep]),v.getRegisteredFields),v,y)},x=function jumpToStep(e,t){return j({type:"jumpToStep",payload:{index:e,valid:t,fields:a,crossroads:l,formOptions:v}})},_=function handleNext(e){return j({type:"handleNext",payload:{nextStep:e,formOptions:v,fields:a}})},O=function findCurrentStepWrapped(e){return Q(e,a)};return o.createElement(d.Provider,{value:{handleNext:_,onKeyDown:function onKeyDown(e){return function enterHandler(e,t,r,n,o,a){if("Enter"===e.key&&"button"!==e.target.type){e.preventDefault();var i,s=n(r).nextStep,c=n(r).buttons;s&&(i=H(s,t.getState));var p=t.valid&&!t.getState().validating;p&&i&&!c?o(i,t.getRegisteredFields):!p||s||c||a()}}(e,v,y.activeStep,O,_,g)},setPrevSteps:function setPrevSteps(){return j({type:"setPrevSteps",payload:{formOptions:v,fields:a}})},currentStep:Q(y.activeStep,a),jumpToStep:x,handlePrev:function handlePrev(){return x(y.activeStepIndex-1)},formOptions:_objectSpread$1(_objectSpread$1({},v),{},{onCancel:function onCancel(){return v.onCancel(y)},handleSubmit:g}),navSchema:y.navSchema,activeStepIndex:y.activeStepIndex,maxStepIndex:y.maxStepIndex,isDynamic:y.isDynamic,crossroads:l,prevSteps:y.prevSteps,selectNext:H}},o.createElement(Wizard,b))};X.propTypes={fields:a.arrayOf(a.shape({name:a.oneOfType([a.string,a.number]).isRequired})).isRequired,isDynamic:a.bool,crossroads:a.arrayOf(a.string),Wizard:a.oneOfType([a.node,a.func]),component:a.any,initialState:a.object};a.object,a.func,a.func,a.func,a.func,a.func,a.array,a.number,a.number,a.shape({onCancel:a.func}),a.array;function ownKeys$2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread$2(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?ownKeys$2(Object(n),!0).forEach((function(r){e._defineProperty(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys$2(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}!function ___$insertStyle(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}(".ddorg__carbon-wizard-navigation-horizontal {\n margin-bottom: 48px;\n}\n\n.ddorg__carbon-wizard-button-set {\n margin-top: 48px;\n flex-direction: row-reverse;\n display: flex;\n}\n\n.ddorg__carbon-wizard-body > :not(:last-child) {\n margin-bottom: 32px;\n}");var Y=function WizardNav(e){var n=e.stepsInfo,a=e.jumpToStep,s=r._objectWithoutProperties(e,["stepsInfo","jumpToStep"]);return o.createElement(y.ProgressIndicator,t._extends({onChange:function onChange(e){return s.currentIndex>e?a(e,!0):void 0}},s,{className:i.clsx("ddorg__carbon-wizard-navigation-horizontal",s.className)}),n.map((function(e,n){var a=e.title,i=r._objectWithoutProperties(e,["title"]);return o.createElement(y.ProgressStep,t._extends({key:n,label:a,disabled:n>s.currentIndex},i))})))};Y.propTypes={stepsInfo:a.arrayOf(a.shape({title:a.node})),currentIndex:a.number,jumpToStep:a.func,className:a.string};var Z={submit:"Submit",back:"Back",next:"Next"},ee=function Layout(e){var r=e.nav,n=e.fields,a=e.WizardBodyProps;return o.createElement(o.Fragment,null,r,o.createElement("div",t._extends({},a,{className:i.clsx("ddorg__carbon-wizard-body",null==a?void 0:a.className)}),n))};ee.propTypes={nav:a.node,fields:a.node,WizardBodyProps:a.object};var te=function VerticalLayout(e){var r=e.nav,n=e.fields,a=e.WizardBodyProps;return o.createElement(m,{narrow:!0},o.createElement(S,null,o.createElement(v,{sm:1,md:2,lg:3},r),o.createElement(v,t._extends({},a,{className:i.clsx("ddorg__carbon-wizard-body",null==a?void 0:a.className)}),n)))};te.propTypes={nav:a.node,fields:a.node,WizardBodyProps:a.object};var re=function WizardInternal(e){var a=e.stepsInfo,s=e.buttonLabels,c=e.ButtonSetProps,p=e.BackButtonProps,u=e.NextButtonProps,l=e.SubmitButtonProps,v=e.ProgressIndicatorProps,m=e.vertical,S=e.WizardBodyProps,y=r._objectWithoutProperties(e,["stepsInfo","buttonLabels","ButtonSetProps","BackButtonProps","NextButtonProps","SubmitButtonProps","ProgressIndicatorProps","vertical","WizardBodyProps"]),j=n.useContext(d),g=j.formOptions,x=j.currentStep,_=j.handlePrev,O=j.onKeyDown,P=j.handleNext,h=j.activeStepIndex,w=j.selectNext,I=j.jumpToStep,D=_objectSpread$2(_objectSpread$2({},Z),s),z=a&&o.createElement(Y,t._extends({vertical:m,stepsInfo:a,currentIndex:h,jumpToStep:I},v)),B=x.fields.map((function(e){return g.renderForm([e],g)})),E=m&&z?te:ee;return o.createElement("div",t._extends({onKeyDown:O},y),o.createElement(E,{nav:z||null,fields:B,WizardBodyProps:S}),o.createElement(f,null,(function(e){var r=e.invalid,n=e.validating,a=e.submitting;return o.createElement("div",t._extends({},c,{className:i.clsx("ddorg__carbon-wizard-button-set",c.className)}),x.nextStep?o.createElement(b,t._extends({onClick:function onClick(){return P(w(x.nextStep,g.getState))},disabled:!g.valid||r||n||a},u),D.next):o.createElement(b,t._extends({onClick:function onClick(){return g.handleSubmit()},disabled:!g.valid||r||n||a},l),D.submit),o.createElement(b,t._extends({kind:"secondary",onClick:_,disabled:0===h},p),D.back))})))};re.propTypes={stepsInfo:a.arrayOf(a.shape({title:a.node})),buttonLabels:a.shape({submit:a.node,back:a.node,next:a.node}),BackButtonProps:a.object,NextButtonProps:a.object,SubmitButtonProps:a.object,ButtonSetProps:a.object,ProgressIndicatorProps:a.object,vertical:a.bool,WizardBodyProps:a.object},re.defaultProps={BackButtonProps:{},NextButtonProps:{},SubmitButtonProps:{},ButtonSetProps:{},ProgressIndicatorProps:{},WizardBodyProps:{}};exports.default=function Wizard$1(e){return o.createElement(X,t._extends({Wizard:re},e))}; | ||
//# sourceMappingURL=wizard.js.map |
@@ -1,2 +0,2 @@ | ||
import{_ as e}from"./defineProperty-984bc41a.js";import{_ as t}from"./extends-4d5fdb5f.js";import{_ as r}from"./objectWithoutProperties-85da668a.js";import n,{useReducer as o,useEffect as a,useContext as i}from"react";import s from"prop-types";import{c}from"./clsx.m-a083186a.js";import p from"@data-driven-forms/react-form-renderer/dist/esm/use-form-api";import{_ as u}from"./toConsumableArray-48c131d8.js";import{_ as d}from"./typeof-9ba06920.js";import{_ as l}from"./slicedToArray-de9f1c8c.js";import f from"@data-driven-forms/react-form-renderer/dist/esm/wizard-context";import{i as m,b as v,a as b,M as S,S as y,g as j,e as g,c as O,d as h,f as x,h as P}from"./_arrayPush-df1e7be1.js";import _ from"@data-driven-forms/react-form-renderer/dist/esm/form-spy";import w from"carbon-components-react/es/components/Button/Button.js";import I from"carbon-components-react/es/components/Grid/Column.js";import z from"carbon-components-react/es/components/Grid/Grid.js";import B from"carbon-components-react/es/components/Grid/Row.js";import{ProgressIndicator as E,ProgressStep as D}from"carbon-components-react/es/components/ProgressIndicator/ProgressIndicator.js";var N=function isSymbol(e){return"symbol"==typeof e||m(e)&&"[object Symbol]"==v(e)},T=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$=/^\w*$/;var C=function isKey(e,t){if(b(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!N(e))||($.test(e)||!T.test(e)||null!=t&&e in Object(t))};function memoize(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var memoized=function(){var r=arguments,n=t?t.apply(this,r):r[0],o=memoized.cache;if(o.has(n))return o.get(n);var a=e.apply(this,r);return memoized.cache=o.set(n,a)||o,a};return memoized.cache=new(memoize.Cache||S),memoized}memoize.Cache=S;var W=memoize;var k=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,K=/\\(\\)?/g,F=function memoizeCapped(e){var t=W(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(k,(function(e,r,n,o){t.push(n?o.replace(K,"$1"):r||e)})),t}));var L=function arrayMap(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o},A=y?y.prototype:void 0,R=A?A.toString:void 0;var G=function baseToString(e){if("string"==typeof e)return e;if(b(e))return L(e,baseToString)+"";if(N(e))return R?R.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var H=function toString(e){return null==e?"":G(e)};var M=function castPath(e,t){return b(e)?e:C(e,t)?[e]:F(H(e))};var V=function toKey(e){if("string"==typeof e||N(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var q=function baseGet(e,t){for(var r=0,n=(t=M(t,e)).length;null!=e&&r<n;)e=e[V(t[r++])];return r&&r==n?e:void 0};var J=function get(e,t,r){var n=null==e?void 0:q(e,t);return void 0===n?r:n},Q=function(){try{var e=j(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var U=function baseAssignValue(e,t,r){"__proto__"==t&&Q?Q(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},X=Object.prototype.hasOwnProperty;var Y=function assignValue(e,t,r){var n=e[t];X.call(e,t)&&g(n,r)&&(void 0!==r||t in e)||U(e,t,r)};var Z=function baseSet(e,t,r,n){if(!O(e))return e;for(var o=-1,a=(t=M(t,e)).length,i=a-1,s=e;null!=s&&++o<a;){var c=V(t[o]),p=r;if(o!=i){var u=s[c];void 0===(p=n?n(u,c,s):void 0)&&(p=O(u)?u:h(t[o+1])?[]:{})}Y(s,c,p),s=s[c]}return e};var ee=function set(e,t,r){return null==e?e:Z(e,t,r)},te=y?y.isConcatSpreadable:void 0;var re=function isFlattenable(e){return b(e)||x(e)||!!(te&&e&&e[te])};var ne=function baseFlatten(e,t,r,n,o){var a=-1,i=e.length;for(r||(r=re),o||(o=[]);++a<i;){var s=e[a];t>0&&r(s)?t>1?baseFlatten(s,t-1,r,n,o):P(o,s):n||(o[o.length]=s)}return o};var oe=function flattenDeep(e){return(null==e?0:e.length)?ne(e,1/0):[]},ae=function selectNext(e,t){if("string"==typeof e)return e;if("function"==typeof e)return e({values:t().values});var r=J(t().values,e.when);return e.stepMapper[r]};function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var ie=["function","object"],se=function createSchema(e){for(var t=e.formOptions,r=e.fields,n=t.getState().values,o=[],a=r[0],i=-1,s=function _loop(){var e,t;i+=1,o=[].concat(u(o),[{name:a.name,title:a.title,substepOf:(null===(e=a.substepOf)||void 0===e?void 0:e.name)||a.substepOf,substepOfTitle:(null===(t=a.substepOf)||void 0===t?void 0:t.title)||a.substepOf,index:i,primary:!o[o.length-1]||!a.substepOf||a.substepOf!==o[o.length-1].substepOf}]);var s=a.nextStep;"object"===d(a.nextStep)&&(s=s.stepMapper[J(n,s.when)]),"function"==typeof a.nextStep&&(s=a.nextStep({values:n})),a=s?r.find((function(e){return e.name===s})):void 0};a;)s();return o},ce=function findCurrentStep(e,t){return t.find((function(t){return t.name===e}))},pe=function reducer(t,r){var n=r.type,o=r.payload;switch(n){case"finishLoading":return _objectSpread(_objectSpread({},t),{},{loading:!1,navSchema:se({fields:o.fields,formOptions:o.formOptions})});case"handleNext":return function handleNext(t,r,n,o){var a=t.activeStepIndex+1,i=t.prevSteps.includes(t.activeStep);return _objectSpread(_objectSpread({},t),{},{registeredFieldsHistory:_objectSpread(_objectSpread({},t.registeredFieldsHistory),{},e({},t.activeStep,n.getRegisteredFields())),activeStep:r,prevSteps:i?t.prevSteps:[].concat(u(t.prevSteps),[t.activeStep]),activeStepIndex:a,maxStepIndex:a>t.maxStepIndex?a:t.maxStepIndex,navSchema:t.isDynamic?se({fields:o,formOptions:n}):t.navSchema})}(t,o.nextStep,o.formOptions,o.fields);case"setPrevSteps":return _objectSpread(_objectSpread({},t),{},{prevSteps:t.prevSteps.slice(0,t.activeStepIndex),maxStepIndex:t.activeStepIndex,navSchema:se({fields:o.fields,formOptions:o.formOptions})});case"jumpToStep":return function jumpToStep(e,t,r,n,o,a){if(t===e.activeStepIndex)return e;if(e.prevSteps[t]){var i,s=e.prevSteps.includes(e.activeStep,n);i=e.activeStep;var c=_objectSpread(_objectSpread({},e),{},{activeStep:e.prevSteps[t],prevSteps:s?e.prevSteps:[].concat(u(e.prevSteps),[e.activeStep]),activeStepIndex:t}),p=ce(c.prevSteps[t],n),l=ie.includes(d(p.nextStep)),f=o,m=c.isDynamic&&l,v=!1===r,b=_objectSpread({},c);if(m&&!f)b=_objectSpread(_objectSpread({},b),{},{navSchema:se({formOptions:a,fields:n}),prevSteps:c.prevSteps.slice(0,t),maxStepIndex:t});else if(p.disableForwardJumping)b=_objectSpread(_objectSpread({},b),{},{prevSteps:c.prevSteps.slice(0,t),maxStepIndex:t});else if(v){var S=c.prevSteps.indexOf(i);b=_objectSpread(_objectSpread({},b),{},{prevSteps:c.prevSteps.slice(0,S+1),maxStepIndex:c.prevSteps.slice(0,S+1).length-1})}return b}}(t,o.index,o.valid,o.fields,o.crossroads,o.formOptions);default:return t}};function ownKeys$1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread$1(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?ownKeys$1(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys$1(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var ue=function Wizard(t){var i=t.fields,s=t.isDynamic,c=t.crossroads,Wizard=t.Wizard,m=(t.component,t.initialState),v=r(t,["fields","isDynamic","crossroads","Wizard","component","initialState"]),b=p(),S=o(pe,_objectSpread$1(_objectSpread$1({activeStep:i[0].name,prevSteps:[],activeStepIndex:0,maxStepIndex:0},m),{},{isDynamic:s||i.some((function(e){var t=e.nextStep;return ie.includes(d(t))})),loading:!0})),y=l(S,2),j=y[0],g=y[1];if(a((function(){g({type:"finishLoading",payload:{formOptions:b,fields:i}})}),[i]),j.loading)return null;var O=function handleSubmit(){return b.onSubmit(function prepareValues(t,r,n){var o=_objectSpread$1(_objectSpread$1({},j.registeredFieldsHistory),{},e({},j.activeStep,n())),a={};return oe(Object.values([].concat(u(r),[j.activeStep]).reduce((function(t,r){return _objectSpread$1(_objectSpread$1({},t),{},e({},r,o[r]))}),{}))).forEach((function(e){return ee(a,e,J(t,e))})),a}(b.getState().values,[].concat(u(j.prevSteps),[j.activeStep]),b.getRegisteredFields),b,j)},h=function jumpToStep(e,t){return g({type:"jumpToStep",payload:{index:e,valid:t,fields:i,crossroads:c,formOptions:b}})},x=function handleNext(e){return g({type:"handleNext",payload:{nextStep:e,formOptions:b,fields:i}})},P=function findCurrentStepWrapped(e){return ce(e,i)};return n.createElement(f.Provider,{value:{handleNext:x,onKeyDown:function onKeyDown(e){return function enterHandler(e,t,r,n,o,a){if("Enter"===e.key&&"button"!==e.target.type){e.preventDefault();var i,s=n(r).nextStep,c=n(r).buttons;s&&(i=ae(s,t.getState));var p=t.valid&&!t.getState().validating;p&&i&&!c?o(i,t.getRegisteredFields):!p||s||c||a()}}(e,b,j.activeStep,P,x,O)},setPrevSteps:function setPrevSteps(){return g({type:"setPrevSteps",payload:{formOptions:b,fields:i}})},currentStep:ce(j.activeStep,i),jumpToStep:h,handlePrev:function handlePrev(){return h(j.activeStepIndex-1)},formOptions:_objectSpread$1(_objectSpread$1({},b),{},{onCancel:function onCancel(){return b.onCancel(j)},handleSubmit:O}),navSchema:j.navSchema,activeStepIndex:j.activeStepIndex,maxStepIndex:j.maxStepIndex,isDynamic:j.isDynamic,crossroads:c,prevSteps:j.prevSteps,selectNext:ae}},n.createElement(Wizard,v))};ue.propTypes={fields:s.arrayOf(s.shape({name:s.oneOfType([s.string,s.number]).isRequired})).isRequired,isDynamic:s.bool,crossroads:s.arrayOf(s.string),Wizard:s.oneOfType([s.node,s.func]),component:s.any,initialState:s.object};s.object,s.func,s.func,s.func,s.func,s.func,s.array,s.number,s.number,s.shape({onCancel:s.func}),s.array;function ownKeys$2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread$2(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?ownKeys$2(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys$2(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}!function ___$insertStyle(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}(".ddorg__carbon-wizard-navigation-horizontal {\n margin-bottom: 48px;\n}\n\n.ddorg__carbon-wizard-button-set {\n margin-top: 48px;\n flex-direction: row-reverse;\n display: flex;\n}\n\n.ddorg__carbon-wizard-body > :not(:last-child) {\n margin-bottom: 32px;\n}");var de=function WizardNav(e){var o=e.stepsInfo,a=e.jumpToStep,i=r(e,["stepsInfo","jumpToStep"]);return n.createElement(E,t({onChange:function onChange(e){return i.currentIndex>e?a(e,!0):void 0}},i,{className:c("ddorg__carbon-wizard-navigation-horizontal",i.className)}),o.map((function(e,o){var a=e.title,s=r(e,["title"]);return n.createElement(D,t({key:o,label:a,disabled:o>i.currentIndex},s))})))};de.propTypes={stepsInfo:s.arrayOf(s.shape({title:s.node})),currentIndex:s.number,jumpToStep:s.func,className:s.string};var le={submit:"Submit",back:"Back",next:"Next"},fe=function Layout(e){var r=e.nav,o=e.fields,a=e.WizardBodyProps;return n.createElement(n.Fragment,null,r,n.createElement("div",t({},a,{className:c("ddorg__carbon-wizard-body",null==a?void 0:a.className)}),o))};fe.propTypes={nav:s.node,fields:s.node,WizardBodyProps:s.object};var me=function VerticalLayout(e){var r=e.nav,o=e.fields,a=e.WizardBodyProps;return n.createElement(z,{narrow:!0},n.createElement(B,null,n.createElement(I,{sm:1,md:2,lg:3},r),n.createElement(I,t({},a,{className:c("ddorg__carbon-wizard-body",null==a?void 0:a.className)}),o)))};me.propTypes={nav:s.node,fields:s.node,WizardBodyProps:s.object};var ve=function WizardInternal(e){var o=e.stepsInfo,a=e.buttonLabels,s=e.ButtonSetProps,p=e.BackButtonProps,u=e.NextButtonProps,d=e.SubmitButtonProps,l=e.ProgressIndicatorProps,m=e.vertical,v=e.WizardBodyProps,b=r(e,["stepsInfo","buttonLabels","ButtonSetProps","BackButtonProps","NextButtonProps","SubmitButtonProps","ProgressIndicatorProps","vertical","WizardBodyProps"]),S=i(f),y=S.formOptions,j=S.currentStep,g=S.handlePrev,O=S.onKeyDown,h=S.handleNext,x=S.activeStepIndex,P=S.selectNext,I=S.jumpToStep,z=_objectSpread$2(_objectSpread$2({},le),a),B=o&&n.createElement(de,t({vertical:m,stepsInfo:o,currentIndex:x,jumpToStep:I},l)),E=j.fields.map((function(e){return y.renderForm([e],y)})),D=m&&B?me:fe;return n.createElement("div",t({onKeyDown:O},b),n.createElement(D,{nav:B||null,fields:E,WizardBodyProps:v}),n.createElement(_,null,(function(e){var r=e.invalid,o=e.validating,a=e.submitting;return n.createElement("div",t({},s,{className:c("ddorg__carbon-wizard-button-set",s.className)}),j.nextStep?n.createElement(w,t({onClick:function onClick(){return h(P(j.nextStep,y.getState))},disabled:!y.valid||r||o||a},u),z.next):n.createElement(w,t({onClick:function onClick(){return y.handleSubmit()},disabled:!y.valid||r||o||a},d),z.submit),n.createElement(w,t({kind:"secondary",onClick:g,disabled:0===x},p),z.back))})))};ve.propTypes={stepsInfo:s.arrayOf(s.shape({title:s.node})),buttonLabels:s.shape({submit:s.node,back:s.node,next:s.node}),BackButtonProps:s.object,NextButtonProps:s.object,SubmitButtonProps:s.object,ButtonSetProps:s.object,ProgressIndicatorProps:s.object,vertical:s.bool,WizardBodyProps:s.object},ve.defaultProps={BackButtonProps:{},NextButtonProps:{},SubmitButtonProps:{},ButtonSetProps:{},ProgressIndicatorProps:{},WizardBodyProps:{}};export default function Wizard$1(e){return n.createElement(ue,t({Wizard:ve},e))} | ||
import{_ as e}from"./defineProperty-984bc41a.js";import{_ as t}from"./extends-4d5fdb5f.js";import{_ as r}from"./objectWithoutProperties-85da668a.js";import n,{useReducer as o,useEffect as a,useContext as i}from"react";import s from"prop-types";import{c}from"./clsx.m-a083186a.js";import p from"@data-driven-forms/react-form-renderer/dist/esm/use-form-api";import{_ as u}from"./toConsumableArray-48c131d8.js";import{_ as d}from"./typeof-9ba06920.js";import{_ as l}from"./slicedToArray-de9f1c8c.js";import f from"@data-driven-forms/react-form-renderer/dist/esm/wizard-context";import{i as m,b as v,a as b,M as S,S as y,g as j,e as g,c as O,d as h,f as x,h as P}from"./_arrayPush-df1e7be1.js";import _ from"@data-driven-forms/react-form-renderer/dist/esm/form-spy";import w from"carbon-components-react/es/components/Button/Button.js";import I from"carbon-components-react/es/components/Grid/Column.js";import z from"carbon-components-react/es/components/Grid/Grid.js";import B from"carbon-components-react/es/components/Grid/Row.js";import{ProgressIndicator as E,ProgressStep as D}from"carbon-components-react/es/components/ProgressIndicator/ProgressIndicator.js";var N=function isSymbol(e){return"symbol"==typeof e||m(e)&&"[object Symbol]"==v(e)},T=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$=/^\w*$/;var C=function isKey(e,t){if(b(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!N(e))||($.test(e)||!T.test(e)||null!=t&&e in Object(t))};function memoize(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var memoized=function(){var r=arguments,n=t?t.apply(this,r):r[0],o=memoized.cache;if(o.has(n))return o.get(n);var a=e.apply(this,r);return memoized.cache=o.set(n,a)||o,a};return memoized.cache=new(memoize.Cache||S),memoized}memoize.Cache=S;var W=memoize;var k=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,K=/\\(\\)?/g,F=function memoizeCapped(e){var t=W(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(k,(function(e,r,n,o){t.push(n?o.replace(K,"$1"):r||e)})),t}));var L=function arrayMap(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o},A=y?y.prototype:void 0,R=A?A.toString:void 0;var G=function baseToString(e){if("string"==typeof e)return e;if(b(e))return L(e,baseToString)+"";if(N(e))return R?R.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var H=function toString(e){return null==e?"":G(e)};var M=function castPath(e,t){return b(e)?e:C(e,t)?[e]:F(H(e))};var V=function toKey(e){if("string"==typeof e||N(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var q=function baseGet(e,t){for(var r=0,n=(t=M(t,e)).length;null!=e&&r<n;)e=e[V(t[r++])];return r&&r==n?e:void 0};var J=function get(e,t,r){var n=null==e?void 0:q(e,t);return void 0===n?r:n},Q=function(){try{var e=j(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var U=function baseAssignValue(e,t,r){"__proto__"==t&&Q?Q(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},X=Object.prototype.hasOwnProperty;var Y=function assignValue(e,t,r){var n=e[t];X.call(e,t)&&g(n,r)&&(void 0!==r||t in e)||U(e,t,r)};var Z=function baseSet(e,t,r,n){if(!O(e))return e;for(var o=-1,a=(t=M(t,e)).length,i=a-1,s=e;null!=s&&++o<a;){var c=V(t[o]),p=r;if(o!=i){var u=s[c];void 0===(p=n?n(u,c,s):void 0)&&(p=O(u)?u:h(t[o+1])?[]:{})}Y(s,c,p),s=s[c]}return e};var ee=function set(e,t,r){return null==e?e:Z(e,t,r)},te=y?y.isConcatSpreadable:void 0;var re=function isFlattenable(e){return b(e)||x(e)||!!(te&&e&&e[te])};var ne=function baseFlatten(e,t,r,n,o){var a=-1,i=e.length;for(r||(r=re),o||(o=[]);++a<i;){var s=e[a];t>0&&r(s)?t>1?baseFlatten(s,t-1,r,n,o):P(o,s):n||(o[o.length]=s)}return o};var oe=function flattenDeep(e){return(null==e?0:e.length)?ne(e,1/0):[]},ae=function selectNext(e,t){if("string"==typeof e)return e;if("function"==typeof e)return e({values:t().values});var r=J(t().values,e.when);return e.stepMapper[r]};function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var ie=["function","object"],se=function createSchema(e){for(var t=e.formOptions,r=e.fields,n=t.getState().values,o=[],a=r[0],i=-1,s=function _loop(){var e,t,s,c;i+=1,o=[].concat(u(o),[{name:a.name,title:a.title,substepOf:(null===(e=a.substepOf)||void 0===e?void 0:e.name)||a.substepOf,substepOfTitle:a.substepOf===(null===(t=o[o.length-1])||void 0===t?void 0:t.substepOf)&&(null===(s=o[o.length-1])||void 0===s?void 0:s.substepOfTitle)||(null===(c=a.substepOf)||void 0===c?void 0:c.title)||a.substepOf,index:i,primary:!o[o.length-1]||!a.substepOf||a.substepOf!==o[o.length-1].substepOf}]);var p=a.nextStep;"object"===d(a.nextStep)&&(p=p.stepMapper[J(n,p.when)]),"function"==typeof a.nextStep&&(p=a.nextStep({values:n})),a=p?r.find((function(e){return e.name===p})):void 0};a;)s();return o},ce=function findCurrentStep(e,t){return t.find((function(t){return t.name===e}))},pe=function reducer(t,r){var n=r.type,o=r.payload;switch(n){case"finishLoading":return _objectSpread(_objectSpread({},t),{},{loading:!1,navSchema:se({fields:o.fields,formOptions:o.formOptions})});case"handleNext":return function handleNext(t,r,n,o){var a=t.activeStepIndex+1,i=t.prevSteps.includes(t.activeStep);return _objectSpread(_objectSpread({},t),{},{registeredFieldsHistory:_objectSpread(_objectSpread({},t.registeredFieldsHistory),{},e({},t.activeStep,n.getRegisteredFields())),activeStep:r,prevSteps:i?t.prevSteps:[].concat(u(t.prevSteps),[t.activeStep]),activeStepIndex:a,maxStepIndex:a>t.maxStepIndex?a:t.maxStepIndex,navSchema:t.isDynamic?se({fields:o,formOptions:n}):t.navSchema})}(t,o.nextStep,o.formOptions,o.fields);case"setPrevSteps":return _objectSpread(_objectSpread({},t),{},{prevSteps:t.prevSteps.slice(0,t.activeStepIndex),maxStepIndex:t.activeStepIndex,navSchema:se({fields:o.fields,formOptions:o.formOptions})});case"jumpToStep":return function jumpToStep(e,t,r,n,o,a){if(t===e.activeStepIndex)return e;if(e.prevSteps[t]){var i,s=e.prevSteps.includes(e.activeStep,n);i=e.activeStep;var c=_objectSpread(_objectSpread({},e),{},{activeStep:e.prevSteps[t],prevSteps:s?e.prevSteps:[].concat(u(e.prevSteps),[e.activeStep]),activeStepIndex:t}),p=ce(c.prevSteps[t],n),l=ie.includes(d(p.nextStep)),f=o,m=c.isDynamic&&l,v=!1===r,b=_objectSpread({},c);if(m&&!f)b=_objectSpread(_objectSpread({},b),{},{navSchema:se({formOptions:a,fields:n}),prevSteps:c.prevSteps.slice(0,t),maxStepIndex:t});else if(p.disableForwardJumping)b=_objectSpread(_objectSpread({},b),{},{prevSteps:c.prevSteps.slice(0,t),maxStepIndex:t});else if(v){var S=c.prevSteps.indexOf(i);b=_objectSpread(_objectSpread({},b),{},{prevSteps:c.prevSteps.slice(0,S+1),maxStepIndex:c.prevSteps.slice(0,S+1).length-1})}return b}}(t,o.index,o.valid,o.fields,o.crossroads,o.formOptions);default:return t}};function ownKeys$1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread$1(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?ownKeys$1(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys$1(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var ue=function Wizard(t){var i=t.fields,s=t.isDynamic,c=t.crossroads,Wizard=t.Wizard,m=(t.component,t.initialState),v=r(t,["fields","isDynamic","crossroads","Wizard","component","initialState"]),b=p(),S=o(pe,_objectSpread$1(_objectSpread$1({activeStep:i[0].name,prevSteps:[],activeStepIndex:0,maxStepIndex:0},m),{},{isDynamic:s||i.some((function(e){var t=e.nextStep;return ie.includes(d(t))})),loading:!0})),y=l(S,2),j=y[0],g=y[1];if(a((function(){g({type:"finishLoading",payload:{formOptions:b,fields:i}})}),[i]),j.loading)return null;var O=function handleSubmit(){return b.onSubmit(function prepareValues(t,r,n){var o=_objectSpread$1(_objectSpread$1({},j.registeredFieldsHistory),{},e({},j.activeStep,n())),a={};return oe(Object.values([].concat(u(r),[j.activeStep]).reduce((function(t,r){return _objectSpread$1(_objectSpread$1({},t),{},e({},r,o[r]))}),{}))).forEach((function(e){return ee(a,e,J(t,e))})),a}(b.getState().values,[].concat(u(j.prevSteps),[j.activeStep]),b.getRegisteredFields),b,j)},h=function jumpToStep(e,t){return g({type:"jumpToStep",payload:{index:e,valid:t,fields:i,crossroads:c,formOptions:b}})},x=function handleNext(e){return g({type:"handleNext",payload:{nextStep:e,formOptions:b,fields:i}})},P=function findCurrentStepWrapped(e){return ce(e,i)};return n.createElement(f.Provider,{value:{handleNext:x,onKeyDown:function onKeyDown(e){return function enterHandler(e,t,r,n,o,a){if("Enter"===e.key&&"button"!==e.target.type){e.preventDefault();var i,s=n(r).nextStep,c=n(r).buttons;s&&(i=ae(s,t.getState));var p=t.valid&&!t.getState().validating;p&&i&&!c?o(i,t.getRegisteredFields):!p||s||c||a()}}(e,b,j.activeStep,P,x,O)},setPrevSteps:function setPrevSteps(){return g({type:"setPrevSteps",payload:{formOptions:b,fields:i}})},currentStep:ce(j.activeStep,i),jumpToStep:h,handlePrev:function handlePrev(){return h(j.activeStepIndex-1)},formOptions:_objectSpread$1(_objectSpread$1({},b),{},{onCancel:function onCancel(){return b.onCancel(j)},handleSubmit:O}),navSchema:j.navSchema,activeStepIndex:j.activeStepIndex,maxStepIndex:j.maxStepIndex,isDynamic:j.isDynamic,crossroads:c,prevSteps:j.prevSteps,selectNext:ae}},n.createElement(Wizard,v))};ue.propTypes={fields:s.arrayOf(s.shape({name:s.oneOfType([s.string,s.number]).isRequired})).isRequired,isDynamic:s.bool,crossroads:s.arrayOf(s.string),Wizard:s.oneOfType([s.node,s.func]),component:s.any,initialState:s.object};s.object,s.func,s.func,s.func,s.func,s.func,s.array,s.number,s.number,s.shape({onCancel:s.func}),s.array;function ownKeys$2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread$2(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?ownKeys$2(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys$2(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}!function ___$insertStyle(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}(".ddorg__carbon-wizard-navigation-horizontal {\n margin-bottom: 48px;\n}\n\n.ddorg__carbon-wizard-button-set {\n margin-top: 48px;\n flex-direction: row-reverse;\n display: flex;\n}\n\n.ddorg__carbon-wizard-body > :not(:last-child) {\n margin-bottom: 32px;\n}");var de=function WizardNav(e){var o=e.stepsInfo,a=e.jumpToStep,i=r(e,["stepsInfo","jumpToStep"]);return n.createElement(E,t({onChange:function onChange(e){return i.currentIndex>e?a(e,!0):void 0}},i,{className:c("ddorg__carbon-wizard-navigation-horizontal",i.className)}),o.map((function(e,o){var a=e.title,s=r(e,["title"]);return n.createElement(D,t({key:o,label:a,disabled:o>i.currentIndex},s))})))};de.propTypes={stepsInfo:s.arrayOf(s.shape({title:s.node})),currentIndex:s.number,jumpToStep:s.func,className:s.string};var le={submit:"Submit",back:"Back",next:"Next"},fe=function Layout(e){var r=e.nav,o=e.fields,a=e.WizardBodyProps;return n.createElement(n.Fragment,null,r,n.createElement("div",t({},a,{className:c("ddorg__carbon-wizard-body",null==a?void 0:a.className)}),o))};fe.propTypes={nav:s.node,fields:s.node,WizardBodyProps:s.object};var me=function VerticalLayout(e){var r=e.nav,o=e.fields,a=e.WizardBodyProps;return n.createElement(z,{narrow:!0},n.createElement(B,null,n.createElement(I,{sm:1,md:2,lg:3},r),n.createElement(I,t({},a,{className:c("ddorg__carbon-wizard-body",null==a?void 0:a.className)}),o)))};me.propTypes={nav:s.node,fields:s.node,WizardBodyProps:s.object};var ve=function WizardInternal(e){var o=e.stepsInfo,a=e.buttonLabels,s=e.ButtonSetProps,p=e.BackButtonProps,u=e.NextButtonProps,d=e.SubmitButtonProps,l=e.ProgressIndicatorProps,m=e.vertical,v=e.WizardBodyProps,b=r(e,["stepsInfo","buttonLabels","ButtonSetProps","BackButtonProps","NextButtonProps","SubmitButtonProps","ProgressIndicatorProps","vertical","WizardBodyProps"]),S=i(f),y=S.formOptions,j=S.currentStep,g=S.handlePrev,O=S.onKeyDown,h=S.handleNext,x=S.activeStepIndex,P=S.selectNext,I=S.jumpToStep,z=_objectSpread$2(_objectSpread$2({},le),a),B=o&&n.createElement(de,t({vertical:m,stepsInfo:o,currentIndex:x,jumpToStep:I},l)),E=j.fields.map((function(e){return y.renderForm([e],y)})),D=m&&B?me:fe;return n.createElement("div",t({onKeyDown:O},b),n.createElement(D,{nav:B||null,fields:E,WizardBodyProps:v}),n.createElement(_,null,(function(e){var r=e.invalid,o=e.validating,a=e.submitting;return n.createElement("div",t({},s,{className:c("ddorg__carbon-wizard-button-set",s.className)}),j.nextStep?n.createElement(w,t({onClick:function onClick(){return h(P(j.nextStep,y.getState))},disabled:!y.valid||r||o||a},u),z.next):n.createElement(w,t({onClick:function onClick(){return y.handleSubmit()},disabled:!y.valid||r||o||a},d),z.submit),n.createElement(w,t({kind:"secondary",onClick:g,disabled:0===x},p),z.back))})))};ve.propTypes={stepsInfo:s.arrayOf(s.shape({title:s.node})),buttonLabels:s.shape({submit:s.node,back:s.node,next:s.node}),BackButtonProps:s.object,NextButtonProps:s.object,SubmitButtonProps:s.object,ButtonSetProps:s.object,ProgressIndicatorProps:s.object,vertical:s.bool,WizardBodyProps:s.object},ve.defaultProps={BackButtonProps:{},NextButtonProps:{},SubmitButtonProps:{},ButtonSetProps:{},ProgressIndicatorProps:{},WizardBodyProps:{}};export default function Wizard$1(e){return n.createElement(ue,t({Wizard:ve},e))} | ||
//# sourceMappingURL=wizard.js.map |
{ | ||
"name": "@data-driven-forms/carbon-component-mapper", | ||
"version": "2.18.3", | ||
"version": "2.18.4", | ||
"description": "carbon-component-mapper for data-driven-forms.", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
335458
1549