@cleartrip/ct-design-stepper 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ct-design-stepper.browser.cjs.js +2 -0
- package/dist/ct-design-stepper.browser.cjs.js.map +1 -0
- package/dist/ct-design-stepper.browser.esm.js +2 -0
- package/dist/ct-design-stepper.browser.esm.js.map +1 -0
- package/dist/ct-design-stepper.cjs.js +148 -0
- package/dist/ct-design-stepper.cjs.js.map +1 -0
- package/dist/ct-design-stepper.esm.js +141 -0
- package/dist/ct-design-stepper.esm.js.map +1 -0
- package/dist/ct-design-stepper.umd.js +176 -0
- package/dist/ct-design-stepper.umd.js.map +1 -0
- package/dist/src/Step/Step.d.ts +7 -0
- package/dist/src/Step/Step.d.ts.map +1 -0
- package/dist/src/Stepper.d.ts +5 -0
- package/dist/src/Stepper.d.ts.map +1 -0
- package/dist/src/StyledStepper/StyledStepper.d.ts +7 -0
- package/dist/src/StyledStepper/StyledStepper.d.ts.map +1 -0
- package/dist/src/StyledStepper/index.d.ts +2 -0
- package/dist/src/StyledStepper/index.d.ts.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/type.d.ts +33 -0
- package/dist/src/type.d.ts.map +1 -0
- package/dist/stats.html +4838 -0
- package/dist/stories/Stepper.stories.d.ts +7 -0
- package/dist/stories/Stepper.stories.d.ts.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("tslib"),t=require("react/jsx-runtime"),r=require("@cleartrip/ct-design-use-theme"),n=require("styled-components"),s=require("@cleartrip/ct-design-container"),o=require("@cleartrip/ct-design-icons"),i=require("@cleartrip/ct-design-tokens"),a=require("@cleartrip/ct-design-typography");function p(e){return e&&e.__esModule?e:{default:e}}var l,c,u,d=p(r),x=p(n);exports.StepStatus=void 0,(l=exports.StepStatus||(exports.StepStatus={})).done="DONE",l.current="CURRENT",l.pending="PENDING",exports.level=void 0,(c=exports.level||(exports.level={})).outer="OUTER",c.inner="INNER",exports.LineLocation=void 0,(u=exports.LineLocation||(exports.LineLocation={})).above="ABOVE",u.below="BELOW",u.aboveAndBelow="BOTH";var S=x.default.div({display:"flex",flexDirection:"column",position:"relative"}),g=function(){var e=d.default();return t.jsx(s.Container,{borderLeft:"1px solid #E7E7E7",height:"94%",position:"absolute",zIndex:-1,marginLeft:e.spacing[3],top:e.spacing[6]})},v=x.default.div({justifySelf:"center",alignSelf:"center"}),f=x.default.div({justifySelf:"start",alignSelf:"center"}),h=function(r,n,a,p,l){var c,u,x,S=d.default();return r===exports.level.outer?(n===exports.StepStatus.done?(c=i.colors.success,u=i.colors.success,x=i.colors.neutral100):n===exports.StepStatus.current?(c=i.colors.link2,u=i.colors.link2,x=i.colors.neutral100):n===exports.StepStatus.pending&&(c=i.colors.neutral100,u=i.colors.neutral500,x=i.colors.neutral500),t.jsx(s.Container,e.__assign({onClick:p,padding:"6px",display:"flex",width:S.spacing[6],height:S.spacing[6],borderRadius:"50%",border:"1px solid ".concat(u),background:c,color:x,justifyContent:"center",alignItems:"center",fontSize:i.typography.size[12],marginRight:S.spacing[3],cursor:n!==exports.StepStatus.pending||l?"pointer":"not-allowed"},{children:n===exports.StepStatus.done?t.jsx(o.DoneTick,{size:12}):a}))):n===exports.StepStatus.done?t.jsx(s.Container,e.__assign({onClick:p,display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",marginRight:S.spacing[4],marginLeft:"6px"},{children:t.jsx(o.SmallTick,{})})):(n===exports.StepStatus.current?u="#000000":n===exports.StepStatus.pending&&(u=i.colors.neutral500),t.jsx(s.Container,{onClick:p,display:"flex",padding:"6px",borderRadius:"50%",backgroundColor:i.colors.neutral100,border:"1px solid ".concat(u),justifyContent:"center",textAlign:"center",alignItems:"center",fontSize:i.typography.size[6],marginRight:S.spacing[4],marginLeft:"6px",cursor:n!==exports.StepStatus.pending||l?"pointer":"not-allowed"}))},y=function(r,n,o,i,a){return t.jsx(s.Container,e.__assign({onClick:i,cursor:n!==exports.StepStatus.pending||a?"pointer":"not-allowed"},{children:t.jsx(j,{stepLevel:r,status:n,label:o})}))},j=function(r){var n=r.stepLevel,s=r.status,o=r.label;if(n===exports.level.inner){if(s===exports.StepStatus.done)return t.jsx(a.Typography,e.__assign({variant:"B3"},{children:o}));if(s===exports.StepStatus.current)return t.jsx(a.Typography,e.__assign({variant:"B3",color:"link2"},{children:o}));if(s===exports.StepStatus.pending)return t.jsx(a.Typography,e.__assign({variant:"B3",color:"disabled"},{children:o}))}else{if(s===exports.StepStatus.done)return t.jsx(a.Typography,e.__assign({variant:"B2"},{children:o}));if(s===exports.StepStatus.current)return t.jsx(a.Typography,e.__assign({variant:"HM4"},{children:o}));if(s===exports.StepStatus.pending)return t.jsx(a.Typography,e.__assign({variant:"B2",color:"disabled"},{children:o}))}return t.jsx(t.Fragment,{})};exports.Stepper=function(r){var n=r.steps,o=void 0===n?[]:n,i=r.activeStep,a=void 0===i?0:i,p=r.activeSubStep,l=void 0===p?0:p;r.width;var c=r.workflowStep,u=void 0===c?0:c,x=r.workflowSubStep,j=void 0===x?0:x,b=d.default(),C=[];return o.forEach((function(e,t){var r,n=t===a?exports.StepStatus.current:t<u?exports.StepStatus.done:exports.StepStatus.pending,s=h(exports.level.outer,n,t+1,e.onClick,t===u),o=y(exports.level.outer,n,e.label,e.onClick,t===u);C.push({icon:s,labelComp:o,level:exports.level.outer}),n===exports.StepStatus.current&&e.hasChildren&&(null===(r=e.subSteps)||void 0===r||r.forEach((function(e,r){var n=r===l?exports.StepStatus.current:u===t?r>=j?exports.StepStatus.pending:exports.StepStatus.done:u>t?exports.StepStatus.done:exports.StepStatus.pending,s=h(exports.level.inner,n,-1,e.onClick,r===j),o=y(exports.level.inner,n,e.label,e.onClick,r===j);C.push({icon:s,labelComp:o,level:exports.level.inner})})))})),t.jsxs(S,{children:[C.map((function(r,n){return t.jsxs(s.Container,e.__assign({display:"flex",marginTop:r.level===exports.level.inner?b.spacing[4]:b.spacing[6]},{children:[t.jsxs(v,{children:[" ",r.icon]}),t.jsx(f,{children:r.labelComp})]}),n)})),t.jsx(g,{})]})};
|
|
2
|
+
//# sourceMappingURL=ct-design-stepper.browser.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ct-design-stepper.browser.cjs.js","sources":["../../packages/components/Stepper/src/type.ts","../../packages/components/Stepper/src/StyledStepper/StyledStepper.tsx","../../packages/components/Stepper/src/Step/Step.tsx","../../packages/components/Stepper/src/Stepper.tsx"],"sourcesContent":[null,null,null,null],"names":["StepStatus","level","LineLocation","StyledStepper","styled","default","div","display","flexDirection","position","VerticalLine","theme","useTheme","_jsx","jsx","Container","borderLeft","height","zIndex","marginLeft","spacing","top","IconContainer","justifySelf","alignSelf","LabelContainer","getStepIcon","stepLevel","status","index","onClick","isWorkflow","bgColor","borderColor","iconColor","outer","done","colors","success","neutral100","current","link2","pending","neutral500","__assign","padding","width","borderRadius","border","concat","background","color","justifyContent","alignItems","fontSize","typography","size","marginRight","cursor","children","DoneTick","SmallTick","backgroundColor","textAlign","getStepLabel","label","TypographyComponent","_a","inner","Typography","variant","_b","steps","_c","activeStep","_d","activeSubStep","_f","workflowStep","_g","workflowSubStep","flattenedSteps","forEach","step","currentStatus","icon","labelComp","push","hasChildren","subSteps","substep","substepIndex","currentSubstepStatus","substepIcon","substeplabelComp","_jsxs","jsxs","map","fs","i","marginTop"],"mappings":"+WAAYA,EAMAC,EAKAC,gBAXAF,QAIXA,gBAAA,GAJWA,EAAAA,qBAAAA,QAAAA,WAIX,CAAA,IAHC,KAAA,OACAA,EAAA,QAAA,UACAA,EAAA,QAAA,UAGUC,QAGXA,WAAA,GAHWA,EAAAA,gBAAAA,QAAAA,MAGX,CAAA,IAFC,MAAA,QACAA,EAAA,MAAA,QAGUC,QAIXA,kBAAA,GAJWA,EAAAA,QAAYA,eAAZA,qBAIX,CAAA,IAHC,MAAA,QACAA,EAAA,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,eAFSa,MAKjCtF,EAAAC,IAACJ,EAAe,MAGtB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as n}from"tslib";import{jsx as e,Fragment as r,jsxs as i}from"react/jsx-runtime";import t from"@cleartrip/ct-design-use-theme";import o from"styled-components";import{Container as l}from"@cleartrip/ct-design-container";import{DoneTick as c,SmallTick as a}from"@cleartrip/ct-design-icons";import{colors as d,typography as p}from"@cleartrip/ct-design-tokens";import{Typography as s}from"@cleartrip/ct-design-typography";var u,f,g;!function(n){n.done="DONE",n.current="CURRENT",n.pending="PENDING"}(u||(u={})),function(n){n.outer="OUTER",n.inner="INNER"}(f||(f={})),function(n){n.above="ABOVE",n.below="BELOW",n.aboveAndBelow="BOTH"}(g||(g={}));var m=o.div({display:"flex",flexDirection:"column",position:"relative"}),v=function(){var n=t();return e(l,{borderLeft:"1px solid #E7E7E7",height:"94%",position:"absolute",zIndex:-1,marginLeft:n.spacing[3],top:n.spacing[6]})},h=o.div({justifySelf:"center",alignSelf:"center"}),b=o.div({justifySelf:"start",alignSelf:"center"}),x=function(r,i,o,s,g){var m,v,h,b=t();return r===f.outer?(i===u.done?(m=d.success,v=d.success,h=d.neutral100):i===u.current?(m=d.link2,v=d.link2,h=d.neutral100):i===u.pending&&(m=d.neutral100,v=d.neutral500,h=d.neutral500),e(l,n({onClick:s,padding:"6px",display:"flex",width:b.spacing[6],height:b.spacing[6],borderRadius:"50%",border:"1px solid ".concat(v),background:m,color:h,justifyContent:"center",alignItems:"center",fontSize:p.size[12],marginRight:b.spacing[3],cursor:i!==u.pending||g?"pointer":"not-allowed"},{children:i===u.done?e(c,{size:12}):o}))):i===u.done?e(l,n({onClick:s,display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",marginRight:b.spacing[4],marginLeft:"6px"},{children:e(a,{})})):(i===u.current?v="#000000":i===u.pending&&(v=d.neutral500),e(l,{onClick:s,display:"flex",padding:"6px",borderRadius:"50%",backgroundColor:d.neutral100,border:"1px solid ".concat(v),justifyContent:"center",textAlign:"center",alignItems:"center",fontSize:p.size[6],marginRight:b.spacing[4],marginLeft:"6px",cursor:i!==u.pending||g?"pointer":"not-allowed"}))},C=function(r,i,t,o,c){return e(l,n({onClick:o,cursor:i!==u.pending||c?"pointer":"not-allowed"},{children:e(k,{stepLevel:r,status:i,label:t})}))},k=function(i){var t=i.stepLevel,o=i.status,l=i.label;if(t===f.inner){if(o===u.done)return e(s,n({variant:"B3"},{children:l}));if(o===u.current)return e(s,n({variant:"B3",color:"link2"},{children:l}));if(o===u.pending)return e(s,n({variant:"B3",color:"disabled"},{children:l}))}else{if(o===u.done)return e(s,n({variant:"B2"},{children:l}));if(o===u.current)return e(s,n({variant:"HM4"},{children:l}));if(o===u.pending)return e(s,n({variant:"B2",color:"disabled"},{children:l}))}return e(r,{})},y=function(r){var o=r.steps,c=void 0===o?[]:o,a=r.activeStep,d=void 0===a?0:a,p=r.activeSubStep,s=void 0===p?0:p;r.width;var g=r.workflowStep,k=void 0===g?0:g,y=r.workflowSubStep,S=void 0===y?0:y,E=t(),w=[];return c.forEach((function(n,e){var r,i=e===d?u.current:e<k?u.done:u.pending,t=x(f.outer,i,e+1,n.onClick,e===k),o=C(f.outer,i,n.label,n.onClick,e===k);w.push({icon:t,labelComp:o,level:f.outer}),i===u.current&&n.hasChildren&&(null===(r=n.subSteps)||void 0===r||r.forEach((function(n,r){var i=r===s?u.current:k===e?r>=S?u.pending:u.done:k>e?u.done:u.pending,t=x(f.inner,i,-1,n.onClick,r===S),o=C(f.inner,i,n.label,n.onClick,r===S);w.push({icon:t,labelComp:o,level:f.inner})})))})),i(m,{children:[w.map((function(r,t){return i(l,n({display:"flex",marginTop:r.level===f.inner?E.spacing[4]:E.spacing[6]},{children:[i(h,{children:[" ",r.icon]}),e(b,{children:r.labelComp})]}),t)})),e(v,{})]})};export{g as LineLocation,u as StepStatus,y as Stepper,f as level};
|
|
2
|
+
//# sourceMappingURL=ct-design-stepper.browser.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ct-design-stepper.browser.esm.js","sources":["../../packages/components/Stepper/src/type.ts","../../packages/components/Stepper/src/StyledStepper/StyledStepper.tsx","../../packages/components/Stepper/src/Step/Step.tsx","../../packages/components/Stepper/src/Stepper.tsx"],"sourcesContent":[null,null,null,null],"names":["StepStatus","level","LineLocation","StyledStepper","styled","div","display","flexDirection","position","VerticalLine","theme","useTheme","_jsx","Container","borderLeft","height","zIndex","marginLeft","spacing","top","IconContainer","justifySelf","alignSelf","LabelContainer","getStepIcon","stepLevel","status","index","onClick","isWorkflow","bgColor","borderColor","iconColor","outer","done","colors","success","neutral100","current","link2","pending","neutral500","__assign","padding","width","borderRadius","border","concat","background","color","justifyContent","alignItems","fontSize","typography","size","marginRight","cursor","children","DoneTick","SmallTick","backgroundColor","textAlign","getStepLabel","label","TypographyComponent","_a","inner","Typography","variant","Stepper","_b","steps","_c","activeStep","_d","activeSubStep","_f","workflowStep","_g","workflowSubStep","flattenedSteps","forEach","step","currentStatus","icon","labelComp","push","hasChildren","subSteps","substep","substepIndex","currentSubstepStatus","substepIcon","substeplabelComp","_jsxs","map","fs","i","marginTop"],"mappings":"sbAAYA,EAMAC,EAKAC,GAXZ,SAAYF,GACVA,EAAA,KAAA,OACAA,EAAA,QAAA,UACAA,EAAA,QAAA,SACD,CAJD,CAAYA,IAAAA,EAIX,CAAA,IAED,SAAYC,GACVA,EAAA,MAAA,QACAA,EAAA,MAAA,OACD,CAHD,CAAYA,IAAAA,EAGX,CAAA,IAED,SAAYC,GACVA,EAAA,MAAA,QACAA,EAAA,MAAA,QACAA,EAAA,cAAA,MACD,CAJD,CAAYA,IAAAA,EAIX,CAAA,ICXD,IAAMC,EAAgBC,EAAOC,IAAI,CAC/BC,QAAS,OACTC,cAAe,SACfC,SAAU,aAGCC,EAAe,WAC1B,IAAMC,EAAQC,IACd,OACEC,EAACC,GACCC,WAAY,oBACZC,OAAO,MACPP,SAAS,WACTQ,QAAS,EAC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mB/B,EACvB7D,EAAMiE,MACNyB,EACAF,EAAQ1B,MACR0B,EAAQ7D,QACR8D,IAAiBX,GAEnBC,EAAeM,KAAK,CAAEF,KAAMQ,EAAaP,UAAWQ,EAAkB5F,MAAOA,EAAMiE,OACpF,IACL,IAGE4B,EAAC3F,EACE,CAAAsD,SAAA,CAAAuB,EAAee,KAAI,SAACC,EAAIC,GAAM,OAC7BH,EAACjF,EAAS6B,EAAA,CAACpC,QAAQ,OAAe4F,UAAWF,EAAG/F,QAAUA,EAAMiE,MAAQxD,EAAMQ,QAAQ,GAAKR,EAAMQ,QAAQ,IACvG,CAAAuC,SAAA,CAAAqC,EAAC1E,EAAgB,CAAAqC,SAAA,CAAA,IAAAuC,EAAGZ,QACpBxE,EAACW,EAAc,CAAAkC,SAAEuC,EAAGX,eAFSY,MAKjCrF,EAACH,EAAe,MAGtB"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var useTheme = require('@cleartrip/ct-design-use-theme');
|
|
6
|
+
var styled = require('styled-components');
|
|
7
|
+
var ctDesignContainer = require('@cleartrip/ct-design-container');
|
|
8
|
+
var ctDesignIcons = require('@cleartrip/ct-design-icons');
|
|
9
|
+
var ctDesignTokens = require('@cleartrip/ct-design-tokens');
|
|
10
|
+
var ctDesignTypography = require('@cleartrip/ct-design-typography');
|
|
11
|
+
|
|
12
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
|
|
14
|
+
var useTheme__default = /*#__PURE__*/_interopDefault(useTheme);
|
|
15
|
+
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
16
|
+
|
|
17
|
+
exports.StepStatus = void 0;
|
|
18
|
+
(function (StepStatus) {
|
|
19
|
+
StepStatus["done"] = "DONE";
|
|
20
|
+
StepStatus["current"] = "CURRENT";
|
|
21
|
+
StepStatus["pending"] = "PENDING";
|
|
22
|
+
})(exports.StepStatus || (exports.StepStatus = {}));
|
|
23
|
+
exports.level = void 0;
|
|
24
|
+
(function (level) {
|
|
25
|
+
level["outer"] = "OUTER";
|
|
26
|
+
level["inner"] = "INNER";
|
|
27
|
+
})(exports.level || (exports.level = {}));
|
|
28
|
+
exports.LineLocation = void 0;
|
|
29
|
+
(function (LineLocation) {
|
|
30
|
+
LineLocation["above"] = "ABOVE";
|
|
31
|
+
LineLocation["below"] = "BELOW";
|
|
32
|
+
LineLocation["aboveAndBelow"] = "BOTH";
|
|
33
|
+
})(exports.LineLocation || (exports.LineLocation = {}));
|
|
34
|
+
|
|
35
|
+
var StyledStepper = styled__default.default.div({
|
|
36
|
+
display: 'flex',
|
|
37
|
+
flexDirection: 'column',
|
|
38
|
+
position: 'relative',
|
|
39
|
+
});
|
|
40
|
+
var VerticalLine = function () {
|
|
41
|
+
var theme = useTheme__default.default();
|
|
42
|
+
return (jsxRuntime.jsx(ctDesignContainer.Container, { borderLeft: '1px solid #E7E7E7', height: '94%', position: 'absolute', zIndex: -1, marginLeft: theme.spacing[3], top: theme.spacing[6] }));
|
|
43
|
+
};
|
|
44
|
+
var IconContainer = styled__default.default.div({
|
|
45
|
+
justifySelf: 'center',
|
|
46
|
+
alignSelf: 'center',
|
|
47
|
+
});
|
|
48
|
+
var LabelContainer = styled__default.default.div({
|
|
49
|
+
justifySelf: 'start',
|
|
50
|
+
alignSelf: 'center',
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
var getStepIcon = function (stepLevel, status, index, onClick, isWorkflow) {
|
|
54
|
+
var theme = useTheme__default.default();
|
|
55
|
+
var bgColor, borderColor, iconColor, padding = '6px';
|
|
56
|
+
if (stepLevel === exports.level.outer) {
|
|
57
|
+
if (status === exports.StepStatus.done) {
|
|
58
|
+
bgColor = ctDesignTokens.colors.success;
|
|
59
|
+
borderColor = ctDesignTokens.colors.success;
|
|
60
|
+
iconColor = ctDesignTokens.colors.neutral100;
|
|
61
|
+
}
|
|
62
|
+
else if (status === exports.StepStatus.current) {
|
|
63
|
+
bgColor = ctDesignTokens.colors.link2;
|
|
64
|
+
borderColor = ctDesignTokens.colors.link2;
|
|
65
|
+
iconColor = ctDesignTokens.colors.neutral100;
|
|
66
|
+
}
|
|
67
|
+
else if (status === exports.StepStatus.pending) {
|
|
68
|
+
bgColor = ctDesignTokens.colors.neutral100;
|
|
69
|
+
borderColor = ctDesignTokens.colors.neutral500;
|
|
70
|
+
iconColor = ctDesignTokens.colors.neutral500;
|
|
71
|
+
}
|
|
72
|
+
return (jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({ onClick: onClick, padding: padding, display: 'flex', width: theme.spacing[6], height: theme.spacing[6], borderRadius: '50%', border: "1px solid ".concat(borderColor), background: bgColor, color: iconColor, justifyContent: 'center', alignItems: 'center', fontSize: ctDesignTokens.typography.size[12], marginRight: theme.spacing[3], cursor: status === exports.StepStatus.pending && !isWorkflow ? 'not-allowed' : 'pointer' }, { children: status === exports.StepStatus.done ? jsxRuntime.jsx(ctDesignIcons.DoneTick, { size: 12 }) : index })));
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
if (status === exports.StepStatus.done) {
|
|
76
|
+
return (jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({ onClick: onClick, display: 'flex', justifyContent: 'center', alignItems: 'center', cursor: 'pointer', marginRight: theme.spacing[4], marginLeft: '6px' }, { children: jsxRuntime.jsx(ctDesignIcons.SmallTick, {}) })));
|
|
77
|
+
}
|
|
78
|
+
if (status === exports.StepStatus.current) {
|
|
79
|
+
borderColor = '#000000';
|
|
80
|
+
}
|
|
81
|
+
else if (status === exports.StepStatus.pending) {
|
|
82
|
+
borderColor = ctDesignTokens.colors.neutral500;
|
|
83
|
+
}
|
|
84
|
+
return (jsxRuntime.jsx(ctDesignContainer.Container, { onClick: onClick, display: 'flex', padding: padding, borderRadius: '50%', backgroundColor: ctDesignTokens.colors.neutral100, border: "1px solid ".concat(borderColor), justifyContent: 'center', textAlign: 'center', alignItems: 'center', fontSize: ctDesignTokens.typography.size[6], marginRight: theme.spacing[4], marginLeft: '6px', cursor: status === exports.StepStatus.pending && !isWorkflow ? 'not-allowed' : 'pointer' }));
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
var getStepLabel = function (stepLevel, status, label, onClick, isWorkflow) {
|
|
88
|
+
return (jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({ onClick: onClick, cursor: status === exports.StepStatus.pending && !isWorkflow ? 'not-allowed' : 'pointer' }, { children: jsxRuntime.jsx(TypographyComponent, { stepLevel: stepLevel, status: status, label: label }) })));
|
|
89
|
+
};
|
|
90
|
+
var TypographyComponent = function (_a) {
|
|
91
|
+
var stepLevel = _a.stepLevel, status = _a.status, label = _a.label;
|
|
92
|
+
if (stepLevel === exports.level.inner) {
|
|
93
|
+
if (status === exports.StepStatus.done) {
|
|
94
|
+
return jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'B3' }, { children: label }));
|
|
95
|
+
}
|
|
96
|
+
else if (status === exports.StepStatus.current) {
|
|
97
|
+
return (jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'B3', color: 'link2' }, { children: label })));
|
|
98
|
+
}
|
|
99
|
+
else if (status === exports.StepStatus.pending) {
|
|
100
|
+
return (jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'B3', color: 'disabled' }, { children: label })));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
if (status === exports.StepStatus.done) {
|
|
105
|
+
return jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'B2' }, { children: label }));
|
|
106
|
+
}
|
|
107
|
+
else if (status === exports.StepStatus.current) {
|
|
108
|
+
return jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'HM4' }, { children: label }));
|
|
109
|
+
}
|
|
110
|
+
else if (status === exports.StepStatus.pending) {
|
|
111
|
+
return (jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'B2', color: 'disabled' }, { children: label })));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
var Stepper = function (_a) {
|
|
118
|
+
var _b = _a.steps, steps = _b === void 0 ? [] : _b, _c = _a.activeStep, activeStep = _c === void 0 ? 0 : _c, _d = _a.activeSubStep, activeSubStep = _d === void 0 ? 0 : _d; _a.width; var _f = _a.workflowStep, workflowStep = _f === void 0 ? 0 : _f, _g = _a.workflowSubStep, workflowSubStep = _g === void 0 ? 0 : _g;
|
|
119
|
+
var theme = useTheme__default.default();
|
|
120
|
+
var flattenedSteps = [];
|
|
121
|
+
steps.forEach(function (step, index) {
|
|
122
|
+
var _a;
|
|
123
|
+
var currentStatus = index === activeStep ? exports.StepStatus.current : index < workflowStep ? exports.StepStatus.done : exports.StepStatus.pending;
|
|
124
|
+
var icon = getStepIcon(exports.level.outer, currentStatus, index + 1, step.onClick, index === workflowStep);
|
|
125
|
+
var labelComp = getStepLabel(exports.level.outer, currentStatus, step.label, step.onClick, index === workflowStep);
|
|
126
|
+
flattenedSteps.push({ icon: icon, labelComp: labelComp, level: exports.level.outer });
|
|
127
|
+
currentStatus === exports.StepStatus.current &&
|
|
128
|
+
step.hasChildren &&
|
|
129
|
+
((_a = step.subSteps) === null || _a === void 0 ? void 0 : _a.forEach(function (substep, substepIndex) {
|
|
130
|
+
var currentSubstepStatus = substepIndex === activeSubStep
|
|
131
|
+
? exports.StepStatus.current
|
|
132
|
+
: workflowStep === index
|
|
133
|
+
? substepIndex >= workflowSubStep
|
|
134
|
+
? exports.StepStatus.pending
|
|
135
|
+
: exports.StepStatus.done
|
|
136
|
+
: workflowStep > index
|
|
137
|
+
? exports.StepStatus.done
|
|
138
|
+
: exports.StepStatus.pending;
|
|
139
|
+
var substepIcon = getStepIcon(exports.level.inner, currentSubstepStatus, -1, substep.onClick, substepIndex === workflowSubStep);
|
|
140
|
+
var substeplabelComp = getStepLabel(exports.level.inner, currentSubstepStatus, substep.label, substep.onClick, substepIndex === workflowSubStep);
|
|
141
|
+
flattenedSteps.push({ icon: substepIcon, labelComp: substeplabelComp, level: exports.level.inner });
|
|
142
|
+
}));
|
|
143
|
+
});
|
|
144
|
+
return (jsxRuntime.jsxs(StyledStepper, { children: [flattenedSteps.map(function (fs, i) { return (jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ display: 'flex', marginTop: fs.level === exports.level.inner ? theme.spacing[4] : theme.spacing[6] }, { children: [jsxRuntime.jsxs(IconContainer, { children: [" ", fs.icon] }), jsxRuntime.jsx(LabelContainer, { children: fs.labelComp })] }), i)); }), jsxRuntime.jsx(VerticalLine, {})] }));
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
exports.Stepper = Stepper;
|
|
148
|
+
//# sourceMappingURL=ct-design-stepper.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ct-design-stepper.cjs.js","sources":["../../packages/components/Stepper/src/type.ts","../../packages/components/Stepper/src/StyledStepper/StyledStepper.tsx","../../packages/components/Stepper/src/Step/Step.tsx","../../packages/components/Stepper/src/Stepper.tsx"],"sourcesContent":[null,null,null,null],"names":["StepStatus","level","LineLocation","styled","useTheme","_jsx","Container","colors","__assign","typography","DoneTick","SmallTick","Typography","_jsxs"],"mappings":";;;;;;;;;;;;;;;;AAAYA,4BAIX;AAJD,CAAA,UAAY,UAAU,EAAA;AACpB,IAAA,UAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,UAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,UAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACrB,CAAC,EAJWA,kBAAU,KAAVA,kBAAU,GAIrB,EAAA,CAAA,CAAA,CAAA;AAEWC,uBAGX;AAHD,CAA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GAAG,CAAC,UAAC,EAAE,EAAE,CAAC,EAAA,EAAK,QAC7BA,gBAACP,2BAAS,EAAAE,cAAA,CAAA,EAAC,OAAO,EAAC,MAAM,EAAS,SAAS,EAAE,EAAE,CAAC,KAAK,KAAKP,aAAK,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EACzG,EAAA,EAAA,QAAA,EAAA,CAAAY,eAAA,CAAC,aAAa,EAAG,EAAA,QAAA,EAAA,CAAA,GAAA,EAAA,EAAE,CAAC,IAAI,IAAiB,EACzCR,cAAA,CAAC,cAAc,EAAA,EAAA,QAAA,EAAE,EAAE,CAAC,SAAS,EAAkB,CAAA,CAAA,EAAA,CAAA,EAFlB,CAAC,CAGpB,EAJiB,EAK9B,CAAC,EACFA,cAAA,CAAC,YAAY,EAAG,EAAA,CAAA,CAAA,EAAA,CACF,EAChB;AACJ;;;;"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { __assign } from 'tslib';
|
|
2
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import useTheme from '@cleartrip/ct-design-use-theme';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { Container } from '@cleartrip/ct-design-container';
|
|
6
|
+
import { DoneTick, SmallTick } from '@cleartrip/ct-design-icons';
|
|
7
|
+
import { colors, typography } from '@cleartrip/ct-design-tokens';
|
|
8
|
+
import { Typography } from '@cleartrip/ct-design-typography';
|
|
9
|
+
|
|
10
|
+
var StepStatus;
|
|
11
|
+
(function (StepStatus) {
|
|
12
|
+
StepStatus["done"] = "DONE";
|
|
13
|
+
StepStatus["current"] = "CURRENT";
|
|
14
|
+
StepStatus["pending"] = "PENDING";
|
|
15
|
+
})(StepStatus || (StepStatus = {}));
|
|
16
|
+
var level;
|
|
17
|
+
(function (level) {
|
|
18
|
+
level["outer"] = "OUTER";
|
|
19
|
+
level["inner"] = "INNER";
|
|
20
|
+
})(level || (level = {}));
|
|
21
|
+
var LineLocation;
|
|
22
|
+
(function (LineLocation) {
|
|
23
|
+
LineLocation["above"] = "ABOVE";
|
|
24
|
+
LineLocation["below"] = "BELOW";
|
|
25
|
+
LineLocation["aboveAndBelow"] = "BOTH";
|
|
26
|
+
})(LineLocation || (LineLocation = {}));
|
|
27
|
+
|
|
28
|
+
var StyledStepper = styled.div({
|
|
29
|
+
display: 'flex',
|
|
30
|
+
flexDirection: 'column',
|
|
31
|
+
position: 'relative',
|
|
32
|
+
});
|
|
33
|
+
var VerticalLine = function () {
|
|
34
|
+
var theme = useTheme();
|
|
35
|
+
return (jsx(Container, { borderLeft: '1px solid #E7E7E7', height: '94%', position: 'absolute', zIndex: -1, marginLeft: theme.spacing[3], top: theme.spacing[6] }));
|
|
36
|
+
};
|
|
37
|
+
var IconContainer = styled.div({
|
|
38
|
+
justifySelf: 'center',
|
|
39
|
+
alignSelf: 'center',
|
|
40
|
+
});
|
|
41
|
+
var LabelContainer = styled.div({
|
|
42
|
+
justifySelf: 'start',
|
|
43
|
+
alignSelf: 'center',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
var getStepIcon = function (stepLevel, status, index, onClick, isWorkflow) {
|
|
47
|
+
var theme = useTheme();
|
|
48
|
+
var bgColor, borderColor, iconColor, padding = '6px';
|
|
49
|
+
if (stepLevel === level.outer) {
|
|
50
|
+
if (status === StepStatus.done) {
|
|
51
|
+
bgColor = colors.success;
|
|
52
|
+
borderColor = colors.success;
|
|
53
|
+
iconColor = colors.neutral100;
|
|
54
|
+
}
|
|
55
|
+
else if (status === StepStatus.current) {
|
|
56
|
+
bgColor = colors.link2;
|
|
57
|
+
borderColor = colors.link2;
|
|
58
|
+
iconColor = colors.neutral100;
|
|
59
|
+
}
|
|
60
|
+
else if (status === StepStatus.pending) {
|
|
61
|
+
bgColor = colors.neutral100;
|
|
62
|
+
borderColor = colors.neutral500;
|
|
63
|
+
iconColor = colors.neutral500;
|
|
64
|
+
}
|
|
65
|
+
return (jsx(Container, __assign({ onClick: onClick, padding: padding, display: 'flex', width: theme.spacing[6], height: theme.spacing[6], borderRadius: '50%', border: "1px solid ".concat(borderColor), background: bgColor, color: iconColor, justifyContent: 'center', alignItems: 'center', fontSize: typography.size[12], marginRight: theme.spacing[3], cursor: status === StepStatus.pending && !isWorkflow ? 'not-allowed' : 'pointer' }, { children: status === StepStatus.done ? jsx(DoneTick, { size: 12 }) : index })));
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
if (status === StepStatus.done) {
|
|
69
|
+
return (jsx(Container, __assign({ onClick: onClick, display: 'flex', justifyContent: 'center', alignItems: 'center', cursor: 'pointer', marginRight: theme.spacing[4], marginLeft: '6px' }, { children: jsx(SmallTick, {}) })));
|
|
70
|
+
}
|
|
71
|
+
if (status === StepStatus.current) {
|
|
72
|
+
borderColor = '#000000';
|
|
73
|
+
}
|
|
74
|
+
else if (status === StepStatus.pending) {
|
|
75
|
+
borderColor = colors.neutral500;
|
|
76
|
+
}
|
|
77
|
+
return (jsx(Container, { onClick: onClick, display: 'flex', padding: padding, borderRadius: '50%', backgroundColor: colors.neutral100, border: "1px solid ".concat(borderColor), justifyContent: 'center', textAlign: 'center', alignItems: 'center', fontSize: typography.size[6], marginRight: theme.spacing[4], marginLeft: '6px', cursor: status === StepStatus.pending && !isWorkflow ? 'not-allowed' : 'pointer' }));
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
var getStepLabel = function (stepLevel, status, label, onClick, isWorkflow) {
|
|
81
|
+
return (jsx(Container, __assign({ onClick: onClick, cursor: status === StepStatus.pending && !isWorkflow ? 'not-allowed' : 'pointer' }, { children: jsx(TypographyComponent, { stepLevel: stepLevel, status: status, label: label }) })));
|
|
82
|
+
};
|
|
83
|
+
var TypographyComponent = function (_a) {
|
|
84
|
+
var stepLevel = _a.stepLevel, status = _a.status, label = _a.label;
|
|
85
|
+
if (stepLevel === level.inner) {
|
|
86
|
+
if (status === StepStatus.done) {
|
|
87
|
+
return jsx(Typography, __assign({ variant: 'B3' }, { children: label }));
|
|
88
|
+
}
|
|
89
|
+
else if (status === StepStatus.current) {
|
|
90
|
+
return (jsx(Typography, __assign({ variant: 'B3', color: 'link2' }, { children: label })));
|
|
91
|
+
}
|
|
92
|
+
else if (status === StepStatus.pending) {
|
|
93
|
+
return (jsx(Typography, __assign({ variant: 'B3', color: 'disabled' }, { children: label })));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
if (status === StepStatus.done) {
|
|
98
|
+
return jsx(Typography, __assign({ variant: 'B2' }, { children: label }));
|
|
99
|
+
}
|
|
100
|
+
else if (status === StepStatus.current) {
|
|
101
|
+
return jsx(Typography, __assign({ variant: 'HM4' }, { children: label }));
|
|
102
|
+
}
|
|
103
|
+
else if (status === StepStatus.pending) {
|
|
104
|
+
return (jsx(Typography, __assign({ variant: 'B2', color: 'disabled' }, { children: label })));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return jsx(Fragment, {});
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
var Stepper = function (_a) {
|
|
111
|
+
var _b = _a.steps, steps = _b === void 0 ? [] : _b, _c = _a.activeStep, activeStep = _c === void 0 ? 0 : _c, _d = _a.activeSubStep, activeSubStep = _d === void 0 ? 0 : _d; _a.width; var _f = _a.workflowStep, workflowStep = _f === void 0 ? 0 : _f, _g = _a.workflowSubStep, workflowSubStep = _g === void 0 ? 0 : _g;
|
|
112
|
+
var theme = useTheme();
|
|
113
|
+
var flattenedSteps = [];
|
|
114
|
+
steps.forEach(function (step, index) {
|
|
115
|
+
var _a;
|
|
116
|
+
var currentStatus = index === activeStep ? StepStatus.current : index < workflowStep ? StepStatus.done : StepStatus.pending;
|
|
117
|
+
var icon = getStepIcon(level.outer, currentStatus, index + 1, step.onClick, index === workflowStep);
|
|
118
|
+
var labelComp = getStepLabel(level.outer, currentStatus, step.label, step.onClick, index === workflowStep);
|
|
119
|
+
flattenedSteps.push({ icon: icon, labelComp: labelComp, level: level.outer });
|
|
120
|
+
currentStatus === StepStatus.current &&
|
|
121
|
+
step.hasChildren &&
|
|
122
|
+
((_a = step.subSteps) === null || _a === void 0 ? void 0 : _a.forEach(function (substep, substepIndex) {
|
|
123
|
+
var currentSubstepStatus = substepIndex === activeSubStep
|
|
124
|
+
? StepStatus.current
|
|
125
|
+
: workflowStep === index
|
|
126
|
+
? substepIndex >= workflowSubStep
|
|
127
|
+
? StepStatus.pending
|
|
128
|
+
: StepStatus.done
|
|
129
|
+
: workflowStep > index
|
|
130
|
+
? StepStatus.done
|
|
131
|
+
: StepStatus.pending;
|
|
132
|
+
var substepIcon = getStepIcon(level.inner, currentSubstepStatus, -1, substep.onClick, substepIndex === workflowSubStep);
|
|
133
|
+
var substeplabelComp = getStepLabel(level.inner, currentSubstepStatus, substep.label, substep.onClick, substepIndex === workflowSubStep);
|
|
134
|
+
flattenedSteps.push({ icon: substepIcon, labelComp: substeplabelComp, level: level.inner });
|
|
135
|
+
}));
|
|
136
|
+
});
|
|
137
|
+
return (jsxs(StyledStepper, { children: [flattenedSteps.map(function (fs, i) { return (jsxs(Container, __assign({ display: 'flex', marginTop: fs.level === level.inner ? theme.spacing[4] : theme.spacing[6] }, { children: [jsxs(IconContainer, { children: [" ", fs.icon] }), jsx(LabelContainer, { children: fs.labelComp })] }), i)); }), jsx(VerticalLine, {})] }));
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export { LineLocation, StepStatus, Stepper, level };
|
|
141
|
+
//# sourceMappingURL=ct-design-stepper.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ct-design-stepper.esm.js","sources":["../../packages/components/Stepper/src/type.ts","../../packages/components/Stepper/src/StyledStepper/StyledStepper.tsx","../../packages/components/Stepper/src/Step/Step.tsx","../../packages/components/Stepper/src/Stepper.tsx"],"sourcesContent":[null,null,null,null],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;IAAY,WA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AC;aAC7F,CAAC,CAAA,CAAC;AACP,KAAC,CAAC,CAAC;AAEH,IAAA,QACEC,IAAC,CAAA,aAAa,EACX,EAAA,QAAA,EAAA,CAAA,cAAc,CAAC,GAAG,CAAC,UAAC,EAAE,EAAE,CAAC,EAAA,EAAK,QAC7BA,KAAC,SAAS,EAAA,QAAA,CAAA,EAAC,OAAO,EAAC,MAAM,EAAS,SAAS,EAAE,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EACzG,EAAA,EAAA,QAAA,EAAA,CAAAA,IAAA,CAAC,aAAa,EAAG,EAAA,QAAA,EAAA,CAAA,GAAA,EAAA,EAAE,CAAC,IAAI,IAAiB,EACzCD,GAAA,CAAC,cAAc,EAAA,EAAA,QAAA,EAAE,EAAE,CAAC,SAAS,EAAkB,CAAA,CAAA,EAAA,CAAA,EAFlB,CAAC,CAGpB,EAJiB,EAK9B,CAAC,EACFA,GAAA,CAAC,YAAY,EAAG,EAAA,CAAA,CAAA,EAAA,CACF,EAChB;AACJ;;;;"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('@cleartrip/ct-design-use-theme'), require('styled-components'), require('@cleartrip/ct-design-container'), require('@cleartrip/ct-design-icons'), require('@cleartrip/ct-design-tokens'), require('@cleartrip/ct-design-typography')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', '@cleartrip/ct-design-use-theme', 'styled-components', '@cleartrip/ct-design-container', '@cleartrip/ct-design-icons', '@cleartrip/ct-design-tokens', '@cleartrip/ct-design-typography'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystemStepper = {}, global.jsxRuntime, global.useTheme, global.styled, global.ctDesignContainer, global.ctDesignIcons, global.ctDesignTokens, global.ctDesignTypography));
|
|
5
|
+
})(this, (function (exports, jsxRuntime, useTheme, styled, ctDesignContainer, ctDesignIcons, ctDesignTokens, ctDesignTypography) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
|
|
9
|
+
var useTheme__default = /*#__PURE__*/_interopDefault(useTheme);
|
|
10
|
+
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
11
|
+
|
|
12
|
+
/******************************************************************************
|
|
13
|
+
Copyright (c) Microsoft Corporation.
|
|
14
|
+
|
|
15
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
16
|
+
purpose with or without fee is hereby granted.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
19
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
20
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
21
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
22
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
23
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
24
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
25
|
+
***************************************************************************** */
|
|
26
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
27
|
+
|
|
28
|
+
var __assign = function () {
|
|
29
|
+
__assign = Object.assign || function __assign(t) {
|
|
30
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
31
|
+
s = arguments[i];
|
|
32
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
36
|
+
return __assign.apply(this, arguments);
|
|
37
|
+
};
|
|
38
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
39
|
+
var e = new Error(message);
|
|
40
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
exports.StepStatus = void 0;
|
|
44
|
+
(function (StepStatus) {
|
|
45
|
+
StepStatus["done"] = "DONE";
|
|
46
|
+
StepStatus["current"] = "CURRENT";
|
|
47
|
+
StepStatus["pending"] = "PENDING";
|
|
48
|
+
})(exports.StepStatus || (exports.StepStatus = {}));
|
|
49
|
+
exports.level = void 0;
|
|
50
|
+
(function (level) {
|
|
51
|
+
level["outer"] = "OUTER";
|
|
52
|
+
level["inner"] = "INNER";
|
|
53
|
+
})(exports.level || (exports.level = {}));
|
|
54
|
+
exports.LineLocation = void 0;
|
|
55
|
+
(function (LineLocation) {
|
|
56
|
+
LineLocation["above"] = "ABOVE";
|
|
57
|
+
LineLocation["below"] = "BELOW";
|
|
58
|
+
LineLocation["aboveAndBelow"] = "BOTH";
|
|
59
|
+
})(exports.LineLocation || (exports.LineLocation = {}));
|
|
60
|
+
|
|
61
|
+
var StyledStepper = styled__default.default.div({
|
|
62
|
+
display: 'flex',
|
|
63
|
+
flexDirection: 'column',
|
|
64
|
+
position: 'relative',
|
|
65
|
+
});
|
|
66
|
+
var VerticalLine = function () {
|
|
67
|
+
var theme = useTheme__default.default();
|
|
68
|
+
return (jsxRuntime.jsx(ctDesignContainer.Container, { borderLeft: '1px solid #E7E7E7', height: '94%', position: 'absolute', zIndex: -1, marginLeft: theme.spacing[3], top: theme.spacing[6] }));
|
|
69
|
+
};
|
|
70
|
+
var IconContainer = styled__default.default.div({
|
|
71
|
+
justifySelf: 'center',
|
|
72
|
+
alignSelf: 'center',
|
|
73
|
+
});
|
|
74
|
+
var LabelContainer = styled__default.default.div({
|
|
75
|
+
justifySelf: 'start',
|
|
76
|
+
alignSelf: 'center',
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
var getStepIcon = function (stepLevel, status, index, onClick, isWorkflow) {
|
|
80
|
+
var theme = useTheme__default.default();
|
|
81
|
+
var bgColor, borderColor, iconColor, padding = '6px';
|
|
82
|
+
if (stepLevel === exports.level.outer) {
|
|
83
|
+
if (status === exports.StepStatus.done) {
|
|
84
|
+
bgColor = ctDesignTokens.colors.success;
|
|
85
|
+
borderColor = ctDesignTokens.colors.success;
|
|
86
|
+
iconColor = ctDesignTokens.colors.neutral100;
|
|
87
|
+
}
|
|
88
|
+
else if (status === exports.StepStatus.current) {
|
|
89
|
+
bgColor = ctDesignTokens.colors.link2;
|
|
90
|
+
borderColor = ctDesignTokens.colors.link2;
|
|
91
|
+
iconColor = ctDesignTokens.colors.neutral100;
|
|
92
|
+
}
|
|
93
|
+
else if (status === exports.StepStatus.pending) {
|
|
94
|
+
bgColor = ctDesignTokens.colors.neutral100;
|
|
95
|
+
borderColor = ctDesignTokens.colors.neutral500;
|
|
96
|
+
iconColor = ctDesignTokens.colors.neutral500;
|
|
97
|
+
}
|
|
98
|
+
return (jsxRuntime.jsx(ctDesignContainer.Container, __assign({ onClick: onClick, padding: padding, display: 'flex', width: theme.spacing[6], height: theme.spacing[6], borderRadius: '50%', border: "1px solid ".concat(borderColor), background: bgColor, color: iconColor, justifyContent: 'center', alignItems: 'center', fontSize: ctDesignTokens.typography.size[12], marginRight: theme.spacing[3], cursor: status === exports.StepStatus.pending && !isWorkflow ? 'not-allowed' : 'pointer' }, { children: status === exports.StepStatus.done ? jsxRuntime.jsx(ctDesignIcons.DoneTick, { size: 12 }) : index })));
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
if (status === exports.StepStatus.done) {
|
|
102
|
+
return (jsxRuntime.jsx(ctDesignContainer.Container, __assign({ onClick: onClick, display: 'flex', justifyContent: 'center', alignItems: 'center', cursor: 'pointer', marginRight: theme.spacing[4], marginLeft: '6px' }, { children: jsxRuntime.jsx(ctDesignIcons.SmallTick, {}) })));
|
|
103
|
+
}
|
|
104
|
+
if (status === exports.StepStatus.current) {
|
|
105
|
+
borderColor = '#000000';
|
|
106
|
+
}
|
|
107
|
+
else if (status === exports.StepStatus.pending) {
|
|
108
|
+
borderColor = ctDesignTokens.colors.neutral500;
|
|
109
|
+
}
|
|
110
|
+
return (jsxRuntime.jsx(ctDesignContainer.Container, { onClick: onClick, display: 'flex', padding: padding, borderRadius: '50%', backgroundColor: ctDesignTokens.colors.neutral100, border: "1px solid ".concat(borderColor), justifyContent: 'center', textAlign: 'center', alignItems: 'center', fontSize: ctDesignTokens.typography.size[6], marginRight: theme.spacing[4], marginLeft: '6px', cursor: status === exports.StepStatus.pending && !isWorkflow ? 'not-allowed' : 'pointer' }));
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
var getStepLabel = function (stepLevel, status, label, onClick, isWorkflow) {
|
|
114
|
+
return (jsxRuntime.jsx(ctDesignContainer.Container, __assign({ onClick: onClick, cursor: status === exports.StepStatus.pending && !isWorkflow ? 'not-allowed' : 'pointer' }, { children: jsxRuntime.jsx(TypographyComponent, { stepLevel: stepLevel, status: status, label: label }) })));
|
|
115
|
+
};
|
|
116
|
+
var TypographyComponent = function (_a) {
|
|
117
|
+
var stepLevel = _a.stepLevel, status = _a.status, label = _a.label;
|
|
118
|
+
if (stepLevel === exports.level.inner) {
|
|
119
|
+
if (status === exports.StepStatus.done) {
|
|
120
|
+
return jsxRuntime.jsx(ctDesignTypography.Typography, __assign({ variant: 'B3' }, { children: label }));
|
|
121
|
+
}
|
|
122
|
+
else if (status === exports.StepStatus.current) {
|
|
123
|
+
return (jsxRuntime.jsx(ctDesignTypography.Typography, __assign({ variant: 'B3', color: 'link2' }, { children: label })));
|
|
124
|
+
}
|
|
125
|
+
else if (status === exports.StepStatus.pending) {
|
|
126
|
+
return (jsxRuntime.jsx(ctDesignTypography.Typography, __assign({ variant: 'B3', color: 'disabled' }, { children: label })));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
if (status === exports.StepStatus.done) {
|
|
131
|
+
return jsxRuntime.jsx(ctDesignTypography.Typography, __assign({ variant: 'B2' }, { children: label }));
|
|
132
|
+
}
|
|
133
|
+
else if (status === exports.StepStatus.current) {
|
|
134
|
+
return jsxRuntime.jsx(ctDesignTypography.Typography, __assign({ variant: 'HM4' }, { children: label }));
|
|
135
|
+
}
|
|
136
|
+
else if (status === exports.StepStatus.pending) {
|
|
137
|
+
return (jsxRuntime.jsx(ctDesignTypography.Typography, __assign({ variant: 'B2', color: 'disabled' }, { children: label })));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
var Stepper = function (_a) {
|
|
144
|
+
var _b = _a.steps, steps = _b === void 0 ? [] : _b, _c = _a.activeStep, activeStep = _c === void 0 ? 0 : _c, _d = _a.activeSubStep, activeSubStep = _d === void 0 ? 0 : _d; _a.width; var _f = _a.workflowStep, workflowStep = _f === void 0 ? 0 : _f, _g = _a.workflowSubStep, workflowSubStep = _g === void 0 ? 0 : _g;
|
|
145
|
+
var theme = useTheme__default.default();
|
|
146
|
+
var flattenedSteps = [];
|
|
147
|
+
steps.forEach(function (step, index) {
|
|
148
|
+
var _a;
|
|
149
|
+
var currentStatus = index === activeStep ? exports.StepStatus.current : index < workflowStep ? exports.StepStatus.done : exports.StepStatus.pending;
|
|
150
|
+
var icon = getStepIcon(exports.level.outer, currentStatus, index + 1, step.onClick, index === workflowStep);
|
|
151
|
+
var labelComp = getStepLabel(exports.level.outer, currentStatus, step.label, step.onClick, index === workflowStep);
|
|
152
|
+
flattenedSteps.push({ icon: icon, labelComp: labelComp, level: exports.level.outer });
|
|
153
|
+
currentStatus === exports.StepStatus.current &&
|
|
154
|
+
step.hasChildren &&
|
|
155
|
+
((_a = step.subSteps) === null || _a === void 0 ? void 0 : _a.forEach(function (substep, substepIndex) {
|
|
156
|
+
var currentSubstepStatus = substepIndex === activeSubStep
|
|
157
|
+
? exports.StepStatus.current
|
|
158
|
+
: workflowStep === index
|
|
159
|
+
? substepIndex >= workflowSubStep
|
|
160
|
+
? exports.StepStatus.pending
|
|
161
|
+
: exports.StepStatus.done
|
|
162
|
+
: workflowStep > index
|
|
163
|
+
? exports.StepStatus.done
|
|
164
|
+
: exports.StepStatus.pending;
|
|
165
|
+
var substepIcon = getStepIcon(exports.level.inner, currentSubstepStatus, -1, substep.onClick, substepIndex === workflowSubStep);
|
|
166
|
+
var substeplabelComp = getStepLabel(exports.level.inner, currentSubstepStatus, substep.label, substep.onClick, substepIndex === workflowSubStep);
|
|
167
|
+
flattenedSteps.push({ icon: substepIcon, labelComp: substeplabelComp, level: exports.level.inner });
|
|
168
|
+
}));
|
|
169
|
+
});
|
|
170
|
+
return (jsxRuntime.jsxs(StyledStepper, { children: [flattenedSteps.map(function (fs, i) { return (jsxRuntime.jsxs(ctDesignContainer.Container, __assign({ display: 'flex', marginTop: fs.level === exports.level.inner ? theme.spacing[4] : theme.spacing[6] }, { children: [jsxRuntime.jsxs(IconContainer, { children: [" ", fs.icon] }), jsxRuntime.jsx(LabelContainer, { children: fs.labelComp })] }), i)); }), jsxRuntime.jsx(VerticalLine, {})] }));
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
exports.Stepper = Stepper;
|
|
174
|
+
|
|
175
|
+
}));
|
|
176
|
+
//# sourceMappingURL=ct-design-stepper.umd.js.map
|