@sps-woodland/progress-indicators 8.0.0-rc1
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/README.md +3 -0
- package/lib/index.cjs.js +232 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.es.js +571 -0
- package/lib/manifest.d.ts +2 -0
- package/lib/progress-bar/ProgressBar.css.d.ts +18 -0
- package/lib/progress-bar/ProgressBar.d.ts +12 -0
- package/lib/progress-bar/ProgressBar.examples.d.ts +2 -0
- package/lib/progress-bar/SteppedProgressBar.examples.d.ts +2 -0
- package/lib/progress-bar/progress-bar-step/ProgressBarStep.css.d.ts +13 -0
- package/lib/progress-bar/progress-bar-step/ProgressBarStep.d.ts +13 -0
- package/lib/progress-ring/ProgressRing.d.ts +7 -0
- package/lib/style.css +1 -0
- package/package.json +55 -0
- package/vite.config.js +21 -0
package/README.md
ADDED
package/lib/index.cjs.js
ADDED
@@ -0,0 +1,232 @@
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const N=require("react"),d=require("@sps-woodland/core"),q=require("@sps-woodland/buttons"),r=require("@spscommerce/ds-react"),u=require("@sps-woodland/tokens"),f=require("@spscommerce/utils");function O(t){if(t&&t.__esModule)return t;const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const l=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,l.get?l:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const e=O(N);function k(t,s,a){return s in t?Object.defineProperty(t,s,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[s]=a,t}function _(t,s){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);s&&(l=l.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),a.push.apply(a,l)}return a}function w(t){for(var s=1;s<arguments.length;s++){var a=arguments[s]!=null?arguments[s]:{};s%2?_(Object(a),!0).forEach(function(l){k(t,l,a[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):_(Object(a)).forEach(function(l){Object.defineProperty(t,l,Object.getOwnPropertyDescriptor(a,l))})}return t}var D=(t,s,a)=>{for(var l of Object.keys(t)){var o;if(t[l]!==((o=s[l])!==null&&o!==void 0?o:a[l]))return!1}return!0},S=t=>s=>{var a=t.defaultClassName,l=w(w({},t.defaultVariants),s);for(var o in l){var n,p=(n=l[o])!==null&&n!==void 0?n:t.defaultVariants[o];if(p!=null){var i=p;typeof i=="boolean"&&(i=i===!0?"true":"false");var m=t.variantClassNames[o][i];m&&(a+=" "+m)}}for(var[b,B]of t.compoundVariants)D(b,l,t.defaultVariants)&&(a+=" "+B);return a},V="_1890qme0",x=S({defaultClassName:"_1890qmef",variantClassNames:{disabled:{true:"_1890qmeg",false:"_1890qmeh"}},defaultVariants:{disabled:!1},compoundVariants:[]}),R="_1890qme2",F="_1890qme1",H="_1890qmet",M="_1890qme3",I=S({defaultClassName:"_1890qme5",variantClassNames:{completed:{true:"_1890qme6",false:"_1890qme7"},disabled:{true:"_1890qme8",false:"_1890qme9"},color:{purple:"_1890qmea",blue:"_1890qmeb",red:"_1890qmec",orange:"_1890qmed",grey:"_1890qmee"}},defaultVariants:{completed:!1,disabled:!1,color:"purple"},compoundVariants:[]}),A=S({defaultClassName:"_1890qmei",variantClassNames:{completed:{true:"_1890qmej",false:"_1890qmek"},disabled:{true:"_1890qmel",false:"_1890qmem"},color:{purple:"_1890qmen",blue:"_1890qmeo",red:"_1890qmep",orange:"_1890qmeq",grey:"_1890qmer"}},defaultVariants:{completed:!1,disabled:!1,color:"purple"},compoundVariants:[[{completed:!0,disabled:!0},"_1890qmes"]]}),$="_1890qme4";var G=S({defaultClassName:"_17lj0goj",variantClassNames:{stepCompleted:{true:"_17lj0gok",false:"_17lj0gol"}},defaultVariants:{stepCompleted:!1},compoundVariants:[]}),U=S({defaultClassName:"_17lj0gom",variantClassNames:{stepCompleted:{true:"_17lj0gon",false:"_17lj0goo"},disabled:{true:"_17lj0gop",false:"_17lj0goq"},barCompleted:{true:"_17lj0gor",false:"_17lj0gos"},color:{purple:"_17lj0got",red:"_17lj0gou",blue:"_17lj0gov",orange:"_17lj0gow",grey:"_17lj0gox"}},defaultVariants:{stepCompleted:!1,disabled:!1,barCompleted:!1,color:"purple"},compoundVariants:[[{barCompleted:!0,disabled:!0},"_17lj0goy"],[{barCompleted:!0,disabled:!1},"_17lj0goz"],[{stepCompleted:!0,disabled:!0},"_17lj0go10"],[{barCompleted:!1,disabled:!1,stepCompleted:!0,color:"purple"},"_17lj0go11"],[{barCompleted:!1,disabled:!1,stepCompleted:!0,color:"red"},"_17lj0go12"],[{barCompleted:!1,disabled:!1,stepCompleted:!0,color:"blue"},"_17lj0go13"],[{barCompleted:!1,disabled:!1,stepCompleted:!0,color:"orange"},"_17lj0go14"],[{barCompleted:!1,disabled:!1,stepCompleted:!0,color:"grey"},"_17lj0go15"]]}),W=S({defaultClassName:"",variantClassNames:{barCompleted:{true:"_17lj0goa",false:"_17lj0gob"},color:{purple:"_17lj0goc",blue:"_17lj0god",red:"_17lj0goe",orange:"_17lj0gof",grey:"_17lj0gog"},disabled:{true:"_17lj0goh",false:"_17lj0goi"}},defaultVariants:{barCompleted:!1,color:"purple",disabled:!1},compoundVariants:[]}),Y=S({defaultClassName:"_17lj0go0",variantClassNames:{barCompleted:{true:"_17lj0go1",false:"_17lj0go2"},disabled:{true:"_17lj0go3",false:"_17lj0go4"},color:{purple:"_17lj0go5",blue:"_17lj0go6",red:"_17lj0go7",orange:"_17lj0go8",grey:"_17lj0go9"}},defaultVariants:{barCompleted:!1,disabled:!1,color:"purple"},compoundVariants:[]});function C({className:t,title:s,description:a,icon:l,complete:o=!1,disabled:n,barCompleted:p,progressColor:i,...m}){const b=d.useElementId().current||void 0;return e.createElement("li",{id:b,className:d.cl(U({stepCompleted:o,disabled:n,barCompleted:p,color:i}),t),...m},l&&e.createElement(d.Icon,{icon:l,size:"sm",className:G({stepCompleted:o})}),s&&b&&e.createElement(r.SpsTooltip,{for:b,title:s},a))}d.Metadata.set(C,{name:"ProgressBarStep",props:{icon:{type:"IconName"},complete:{type:"boolean"},title:{type:"string"},description:{type:"string"}}});function E({className:t,children:s,detail:a,disabled:l,onClose:o,percentComplete:n=0,title:p,showStepsCounter:i,progressColor:m="purple",...b}){const{t:B}=e.useContext(d.I18nContext),[P,y]=e.useState([]),[g]=d.selectChildren(s,[{type:C}]);let h=[];e.useEffect(()=>{g.forEach(c=>{var T;(c==null?void 0:c.hasOwnProperty("props"))&&((T=c==null?void 0:c.props)==null?void 0:T.complete)===!0&&h.push(c),y(h)})},[]),n&&g&&console.warn(["The percentComplete prop can't be used with the ProgressBarStep subcomponent.","The progress will be determined by how many nested ProgressBarStep components have the completed prop."].join(" "));const j=e.Children.map(s,c=>e.isValidElement(c)?e.cloneElement(c,{disabled:l,barCompleted:P.length===g.length,progressColor:m}):c);return e.createElement("div",{className:d.cl(V,t),...b},e.createElement("div",{className:F},p&&e.createElement("div",{className:M},e.createElement("div",{className:$},p),g.length>0?e.createElement(e.Fragment,null,i===!0&&e.createElement("div",{className:Y({barCompleted:P.length===g.length,disabled:l,color:m})},`${P.length} of ${g.length} Complete`)):e.createElement("div",{className:I({completed:n===1,disabled:l,color:m})},`${Math.floor(n*100)}%`)),g.length>0?e.createElement("ul",{className:d.cl(W({barCompleted:P.length===g.length,disabled:l,color:m}),"d-flex align-items-center list-unstyled mb-0")},j):e.createElement("div",{className:x({disabled:l})},e.createElement("div",{className:A({completed:n===1,disabled:l,color:m}),style:{width:`${n*100}%`}})),a&&e.createElement("div",{className:H},a)),o&&n!==1&&e.createElement("div",{className:R},e.createElement(q.Button,{kind:"icon",icon:"x",onClick:o,title:B("design-system:progressBar.closeButtonTitle")})))}d.Metadata.set(E,{name:"Progress Bar",props:{detail:{type:"string"},disabled:{type:"boolean"},onClose:{type:"() => void"},percentComplete:{type:"number",default:"0"},progressColor:{type:'"purple" | "blue" | "red" | "orange" | "grey"',default:'"purple"'}}});function v({className:t,size:s="sm",progress:a=0,...l}){const n=u.Tokens.component["progress-ring"][s]-4,p=n*2*Math.PI,i=p-a/100*p;return e.createElement("div",{className:t,...l},e.createElement("svg",{height:u.Tokens.component["progress-ring"][s]*2,width:u.Tokens.component["progress-ring"][s]*2,style:{transform:"rotate(-90deg)"}},e.createElement("circle",{stroke:u.Tokens.color.grey["medium-light"],fill:"transparent",strokeWidth:4,strokeDasharray:`${p} ${p}`,r:n,cx:u.Tokens.component["progress-ring"][s],cy:u.Tokens.component["progress-ring"][s]}),e.createElement("circle",{stroke:u.Tokens.color.purple.medium,fill:"transparent",strokeWidth:4,strokeDasharray:`${p} ${p}`,style:{strokeDashoffset:i},r:n,cx:u.Tokens.component["progress-ring"][s],cy:u.Tokens.component["progress-ring"][s]})))}d.Metadata.set(v,{name:"Progress Ring",props:{size:{type:'"sm" | "md" | "lg"',default:'"sm"'},progress:{type:"number",default:"0"}}});const z={description:()=>e.createElement("p",null,"Progress Bars are used to visualize the progression of a process (such as a file upload) or series of related tasks that take place over a longer period of time. Progress Bars can be accompanied by a variety of additional content to provide more context regarding the processes being performed."),components:[E,C],examples:{general:{label:"General Usage",description:()=>e.createElement(e.Fragment,null,e.createElement("p",null,"Progress Bars can be used in a variety of situations, but the most common use case is to show the live progress of a process such as a file upload or the processing of a digital payload."),e.createElement("p",null,"For processes that typically complete within minutes or less, opt for the Standard Progress Bar."),e.createElement("p",null,"For processes that are divided into specific steps that are accomplished over a longer period of time, opt for the Stepped Progress Bar."))},standard:{label:"Standard Progress Bar",description:()=>e.createElement(e.Fragment,null,e.createElement("p",null,"Standard Progress Bars are comprised of the following Required and Optional elements."),e.createElement("img",{src:"assets/images/progress-bar-example.svg",alt:"A Progress Bar with labels on each section",className:"w-100 mb-3"}),e.createElement(r.SpsTable,null,e.createElement(r.SpsTableHead,null,e.createElement(r.SpsTableHeader,null,"Section"),e.createElement(r.SpsTableHeader,null,"Content Type"),e.createElement(r.SpsTableHeader,null,"Required"),e.createElement(r.SpsTableHeader,null,"Description/Guidelines")),e.createElement(r.SpsTableBody,null,e.createElement(r.SpsTableRow,null,e.createElement(r.SpsTableCell,null,e.createElement("span",{className:"sps-tag sps-tag--info"},"1")),e.createElement(r.SpsTableCell,null,"Title"),e.createElement(r.SpsTableCell,null,"No"),e.createElement(r.SpsTableCell,{wrap:400},"Use the Title when it provides necessary or helpful detail about the file or action that is being processed.")),e.createElement(r.SpsTableRow,null,e.createElement(r.SpsTableCell,null,e.createElement("span",{className:"sps-tag sps-tag--info"},"2")),e.createElement(r.SpsTableCell,null,"Progress Meter"),e.createElement(r.SpsTableCell,null,"Yes"),e.createElement(r.SpsTableCell,null)),e.createElement(r.SpsTableRow,null,e.createElement(r.SpsTableCell,null,e.createElement("span",{className:"sps-tag sps-tag--info"},"3")),e.createElement(r.SpsTableCell,null,"Progress Counter"),e.createElement(r.SpsTableCell,null,"No"),e.createElement(r.SpsTableCell,{wrap:400},"The Progress Counter should not be used without the existence of a Title.")),e.createElement(r.SpsTableRow,null,e.createElement(r.SpsTableCell,null,e.createElement("span",{className:"sps-tag sps-tag--info"},"4")),e.createElement(r.SpsTableCell,null,"Clear Button"),e.createElement(r.SpsTableCell,null,"No"),e.createElement(r.SpsTableCell,{wrap:400},"If the process requires the option to be cancelled or removed from a list the clear button can be used.")),e.createElement(r.SpsTableRow,null,e.createElement(r.SpsTableCell,null,e.createElement("span",{className:"sps-tag sps-tag--info"},"5")),e.createElement(r.SpsTableCell,null,"Progress Details"),e.createElement(r.SpsTableCell,null,"No"),e.createElement(r.SpsTableCell,{wrap:400},"Progress Details provide more context for the user and are especially useful when the process includes multiple steps."))))),examples:{standard:{description:()=>e.createElement("p",null,"The Standard Progress Bar is designed to expand to fit the entire width of its container. View the diagram above for rules regarding including or excluding certain elements."),react:f.code`
|
2
|
+
import { ProgressBar } from "@sps-woodland/progress-indicators";
|
3
|
+
import { Card } from "@sps-woodland/cards";
|
4
|
+
|
5
|
+
function Component() {
|
6
|
+
function handleClose() {
|
7
|
+
console.log("closed");
|
8
|
+
}
|
9
|
+
|
10
|
+
return (
|
11
|
+
<Card>
|
12
|
+
<ProgressBar
|
13
|
+
title="File Name"
|
14
|
+
detail="Step 3 of 5: Verifying Headers"
|
15
|
+
percentComplete={0.5}
|
16
|
+
onClose={handleClose}
|
17
|
+
/>
|
18
|
+
</Card>
|
19
|
+
)
|
20
|
+
}
|
21
|
+
`},completed:{description:()=>e.createElement("p",null,"Once complete, the progress bar appears in green and the clear button (if included) disappears from view."),react:f.code`
|
22
|
+
import { ProgressBar } from "@sps-woodland/progress-indicators";
|
23
|
+
import { Card } from "@sps-woodland/cards";
|
24
|
+
|
25
|
+
function Component() {
|
26
|
+
return (
|
27
|
+
<Card>
|
28
|
+
<ProgressBar
|
29
|
+
title="File Name"
|
30
|
+
detail="Process Complete"
|
31
|
+
percentComplete={1}
|
32
|
+
/>
|
33
|
+
</Card>
|
34
|
+
)
|
35
|
+
}
|
36
|
+
`},disabled:{description:()=>e.createElement("p",null,"A disabled state is available for cases when progress is intentionally paused or user interaction needs to be restricted."),react:f.code`
|
37
|
+
import { ProgressBar } from "@sps-woodland/progress-indicators";
|
38
|
+
import { Card } from "@sps-woodland/cards";
|
39
|
+
|
40
|
+
function Component() {
|
41
|
+
function handleClose() {
|
42
|
+
console.log("closed");
|
43
|
+
}
|
44
|
+
|
45
|
+
return (
|
46
|
+
<Card>
|
47
|
+
<ProgressBar
|
48
|
+
title="File Name"
|
49
|
+
detail="Step 3 of 5: Verifying Headers"
|
50
|
+
percentComplete={0.5}
|
51
|
+
disabled
|
52
|
+
onClose={handleClose}
|
53
|
+
/>
|
54
|
+
</Card>
|
55
|
+
)
|
56
|
+
}
|
57
|
+
`}}},stepped:{label:"Stepped Progress Bar",description:()=>e.createElement(e.Fragment,null,e.createElement("p",null,"Stepped Progress Bars are comprised of the following Required and Optional elements."),e.createElement("img",{src:"assets/images/stepped-progress-bar-example.svg",alt:"A Progress Bar with labels on each section",className:"w-100 mb-3"}),e.createElement(r.SpsTable,null,e.createElement(r.SpsTableHead,null,e.createElement(r.SpsTableHeader,null,"Section"),e.createElement(r.SpsTableHeader,null,"Content Type"),e.createElement(r.SpsTableHeader,null,"Required"),e.createElement(r.SpsTableHeader,null,"Description/Guidelines")),e.createElement(r.SpsTableBody,null,e.createElement(r.SpsTableRow,null,e.createElement(r.SpsTableCell,null,e.createElement("span",{className:"sps-tag sps-tag--info"},"1")),e.createElement(r.SpsTableCell,null,"Title"),e.createElement(r.SpsTableCell,null,"No"),e.createElement(r.SpsTableCell,{wrap:400},"Use the Title when it provides necessary or helpful detail about the file or action that is being processed.")),e.createElement(r.SpsTableRow,null,e.createElement(r.SpsTableCell,null,e.createElement("span",{className:"sps-tag sps-tag--info"},"2")),e.createElement(r.SpsTableCell,null,"Progress Meter"),e.createElement(r.SpsTableCell,null,"Yes"),e.createElement(r.SpsTableCell,null)),e.createElement(r.SpsTableRow,null,e.createElement(r.SpsTableCell,null,e.createElement("span",{className:"sps-tag sps-tag--info"},"3")),e.createElement(r.SpsTableCell,null,"Progress Counter"),e.createElement(r.SpsTableCell,null,"No"),e.createElement(r.SpsTableCell,{wrap:400},"The Progress Counter should not be used without the existence of a Title.")),e.createElement(r.SpsTableRow,null,e.createElement(r.SpsTableCell,null,e.createElement("span",{className:"sps-tag sps-tag--info"},"4")),e.createElement(r.SpsTableCell,null,"Step icons"),e.createElement(r.SpsTableCell,null,"No"),e.createElement(r.SpsTableCell,{wrap:400},"Icons can be set inside of steps for visual emphasis.")),e.createElement(r.SpsTableRow,null,e.createElement(r.SpsTableCell,null,e.createElement("span",{className:"sps-tag sps-tag--info"},"5")),e.createElement(r.SpsTableCell,null,"Step Tooltips"),e.createElement(r.SpsTableCell,null,"No"),e.createElement(r.SpsTableCell,{wrap:400},"Tooltips can be utilized to provide more details about each specific step. Tooltips can be exposed on click or hover."))))),examples:{standard:{description:()=>e.createElement(e.Fragment,null,e.createElement("h4",null,"Building Stepped Progress Bars"),e.createElement("p",null,"The Stepped Progress Bar is designed to expand to fit the entire width of its container. View the diagram above for rules regarding including or excluding certain elements.")),react:f.code`
|
58
|
+
import { Card } from "@sps-woodland/cards";
|
59
|
+
import { ProgressBar, ProgressBarStep } from "@sps-woodland/progress-indicators";
|
60
|
+
|
61
|
+
function Component() {
|
62
|
+
return (
|
63
|
+
<Card>
|
64
|
+
<ProgressBar
|
65
|
+
title="Process Name"
|
66
|
+
showStepsCounter={true}
|
67
|
+
>
|
68
|
+
<ProgressBarStep
|
69
|
+
title="Title 1"
|
70
|
+
description="Description"
|
71
|
+
complete
|
72
|
+
/>
|
73
|
+
<ProgressBarStep complete />
|
74
|
+
<ProgressBarStep complete />
|
75
|
+
<ProgressBarStep complete />
|
76
|
+
<ProgressBarStep
|
77
|
+
title="Title 5"
|
78
|
+
description="Description"
|
79
|
+
icon="calendar"
|
80
|
+
/>
|
81
|
+
<ProgressBarStep />
|
82
|
+
<ProgressBarStep />
|
83
|
+
<ProgressBarStep />
|
84
|
+
<ProgressBarStep
|
85
|
+
title="Title 9"
|
86
|
+
description="Description"
|
87
|
+
icon="calendar"
|
88
|
+
/>
|
89
|
+
<ProgressBarStep />
|
90
|
+
<ProgressBarStep />
|
91
|
+
<ProgressBarStep
|
92
|
+
title="Title 12"
|
93
|
+
description="Description"
|
94
|
+
/>
|
95
|
+
</ProgressBar>
|
96
|
+
</Card>
|
97
|
+
)
|
98
|
+
}
|
99
|
+
`},color:{description:()=>e.createElement("h4",null,"Alternate Color"),react:f.code`
|
100
|
+
import { Card } from "@sps-woodland/cards";
|
101
|
+
import { ProgressBar, ProgressBarStep } from "@sps-woodland/progress-indicators";
|
102
|
+
|
103
|
+
function Component() {
|
104
|
+
return (
|
105
|
+
<Card>
|
106
|
+
<ProgressBar
|
107
|
+
title="Process Name"
|
108
|
+
showStepsCounter={true}
|
109
|
+
progressColor="grey"
|
110
|
+
>
|
111
|
+
<ProgressBarStep complete />
|
112
|
+
<ProgressBarStep complete />
|
113
|
+
<ProgressBarStep complete />
|
114
|
+
<ProgressBarStep complete />
|
115
|
+
<ProgressBarStep
|
116
|
+
title="Title 5"
|
117
|
+
description="Description"
|
118
|
+
icon="calendar"
|
119
|
+
/>
|
120
|
+
<ProgressBarStep />
|
121
|
+
<ProgressBarStep />
|
122
|
+
<ProgressBarStep />
|
123
|
+
<ProgressBarStep
|
124
|
+
title="Title 9"
|
125
|
+
description="Description"
|
126
|
+
icon="calendar"
|
127
|
+
/>
|
128
|
+
<ProgressBarStep />
|
129
|
+
<ProgressBarStep />
|
130
|
+
<ProgressBarStep
|
131
|
+
title="Title 12"
|
132
|
+
description="Description"
|
133
|
+
/>
|
134
|
+
</ProgressBar>
|
135
|
+
</Card>
|
136
|
+
)
|
137
|
+
}
|
138
|
+
`},skippedSteps:{description:()=>e.createElement("h4",null,"Skip steps"),react:f.code`
|
139
|
+
import { Card } from "@sps-woodland/cards";
|
140
|
+
import { ProgressBar, ProgressBarStep } from "@sps-woodland/progress-indicators";
|
141
|
+
|
142
|
+
function Component() {
|
143
|
+
return (
|
144
|
+
<Card>
|
145
|
+
<ProgressBar
|
146
|
+
title="Process Name"
|
147
|
+
showStepsCounter={true}
|
148
|
+
>
|
149
|
+
<ProgressBarStep />
|
150
|
+
<ProgressBarStep complete />
|
151
|
+
<ProgressBarStep complete />
|
152
|
+
<ProgressBarStep complete />
|
153
|
+
<ProgressBarStep complete />
|
154
|
+
<ProgressBarStep complete />
|
155
|
+
<ProgressBarStep complete />
|
156
|
+
<ProgressBarStep />
|
157
|
+
<ProgressBarStep />
|
158
|
+
<ProgressBarStep />
|
159
|
+
<ProgressBarStep />
|
160
|
+
<ProgressBarStep />
|
161
|
+
</ProgressBar>
|
162
|
+
</Card>
|
163
|
+
)
|
164
|
+
}
|
165
|
+
`},completed:{description:()=>e.createElement(e.Fragment,null,e.createElement("h4",null,"Completed State"),e.createElement("p",null,"Once complete, the progress bar appears in green.")),react:f.code`
|
166
|
+
import { Card } from "@sps-woodland/cards";
|
167
|
+
import { ProgressBar, ProgressBarStep } from "@sps-woodland/progress-indicators";
|
168
|
+
|
169
|
+
function Component() {
|
170
|
+
return (
|
171
|
+
<Card>
|
172
|
+
<ProgressBar
|
173
|
+
title="Process Name"
|
174
|
+
showStepsCounter={true}
|
175
|
+
>
|
176
|
+
<ProgressBarStep complete />
|
177
|
+
<ProgressBarStep complete />
|
178
|
+
<ProgressBarStep complete />
|
179
|
+
<ProgressBarStep complete />
|
180
|
+
<ProgressBarStep
|
181
|
+
title="Title 5"
|
182
|
+
description="Description"
|
183
|
+
icon="calendar"
|
184
|
+
complete
|
185
|
+
/>
|
186
|
+
<ProgressBarStep complete />
|
187
|
+
<ProgressBarStep complete />
|
188
|
+
<ProgressBarStep complete />
|
189
|
+
<ProgressBarStep
|
190
|
+
title="Title 9"
|
191
|
+
description="Description"
|
192
|
+
icon="calendar"
|
193
|
+
complete
|
194
|
+
/>
|
195
|
+
<ProgressBarStep complete />
|
196
|
+
<ProgressBarStep complete />
|
197
|
+
<ProgressBarStep
|
198
|
+
title="Title 12"
|
199
|
+
description="Description"
|
200
|
+
complete
|
201
|
+
/>
|
202
|
+
</ProgressBar>
|
203
|
+
</Card>
|
204
|
+
)
|
205
|
+
}
|
206
|
+
`},disabled:{description:()=>e.createElement(e.Fragment,null,e.createElement("h4",null,"Disabled State"),e.createElement("p",null,"A disabled state is available for cases when progress is intentionally paused or user interaction needs to be restricted.")),react:f.code`
|
207
|
+
import { Card } from "@sps-woodland/cards";
|
208
|
+
import { ProgressBar, ProgressBarStep } from "@sps-woodland/progress-indicators";
|
209
|
+
|
210
|
+
function Component() {
|
211
|
+
return (
|
212
|
+
<Card>
|
213
|
+
<ProgressBar
|
214
|
+
title="Process Name"
|
215
|
+
showStepsCounter={true}
|
216
|
+
disabled
|
217
|
+
>
|
218
|
+
<ProgressBarStep complete />
|
219
|
+
<ProgressBarStep complete />
|
220
|
+
<ProgressBarStep complete />
|
221
|
+
<ProgressBarStep complete />
|
222
|
+
<ProgressBarStep complete />
|
223
|
+
<ProgressBarStep complete />
|
224
|
+
<ProgressBarStep complete />
|
225
|
+
<ProgressBarStep />
|
226
|
+
<ProgressBarStep />
|
227
|
+
<ProgressBarStep />
|
228
|
+
</ProgressBar>
|
229
|
+
</Card>
|
230
|
+
)
|
231
|
+
}
|
232
|
+
`}}}}},K={"Progress Bar":z};exports.MANIFEST=K;exports.ProgressBar=E;exports.ProgressBarStep=C;exports.ProgressRing=v;
|
package/lib/index.d.ts
ADDED
package/lib/index.es.js
ADDED
@@ -0,0 +1,571 @@
|
|
1
|
+
import * as e from "react";
|
2
|
+
import { Metadata as C, useElementId as V, cl as S, Icon as k, I18nContext as F, selectChildren as R } from "@sps-woodland/core";
|
3
|
+
import { Button as I } from "@sps-woodland/buttons";
|
4
|
+
import { SpsTooltip as A, SpsTable as y, SpsTableHead as N, SpsTableHeader as f, SpsTableBody as j, SpsTableRow as d, SpsTableCell as r } from "@spscommerce/ds-react";
|
5
|
+
import { Tokens as g } from "@sps-woodland/tokens";
|
6
|
+
import { code as P } from "@spscommerce/utils";
|
7
|
+
function M(t, s, l) {
|
8
|
+
return s in t ? Object.defineProperty(t, s, {
|
9
|
+
value: l,
|
10
|
+
enumerable: !0,
|
11
|
+
configurable: !0,
|
12
|
+
writable: !0
|
13
|
+
}) : t[s] = l, t;
|
14
|
+
}
|
15
|
+
function T(t, s) {
|
16
|
+
var l = Object.keys(t);
|
17
|
+
if (Object.getOwnPropertySymbols) {
|
18
|
+
var a = Object.getOwnPropertySymbols(t);
|
19
|
+
s && (a = a.filter(function(o) {
|
20
|
+
return Object.getOwnPropertyDescriptor(t, o).enumerable;
|
21
|
+
})), l.push.apply(l, a);
|
22
|
+
}
|
23
|
+
return l;
|
24
|
+
}
|
25
|
+
function q(t) {
|
26
|
+
for (var s = 1; s < arguments.length; s++) {
|
27
|
+
var l = arguments[s] != null ? arguments[s] : {};
|
28
|
+
s % 2 ? T(Object(l), !0).forEach(function(a) {
|
29
|
+
M(t, a, l[a]);
|
30
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(l)) : T(Object(l)).forEach(function(a) {
|
31
|
+
Object.defineProperty(t, a, Object.getOwnPropertyDescriptor(l, a));
|
32
|
+
});
|
33
|
+
}
|
34
|
+
return t;
|
35
|
+
}
|
36
|
+
var H = (t, s, l) => {
|
37
|
+
for (var a of Object.keys(t)) {
|
38
|
+
var o;
|
39
|
+
if (t[a] !== ((o = s[a]) !== null && o !== void 0 ? o : l[a]))
|
40
|
+
return !1;
|
41
|
+
}
|
42
|
+
return !0;
|
43
|
+
}, E = (t) => (s) => {
|
44
|
+
var l = t.defaultClassName, a = q(q({}, t.defaultVariants), s);
|
45
|
+
for (var o in a) {
|
46
|
+
var n, p = (n = a[o]) !== null && n !== void 0 ? n : t.defaultVariants[o];
|
47
|
+
if (p != null) {
|
48
|
+
var c = p;
|
49
|
+
typeof c == "boolean" && (c = c === !0 ? "true" : "false");
|
50
|
+
var m = t.variantClassNames[o][c];
|
51
|
+
m && (l += " " + m);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
for (var [B, b] of t.compoundVariants)
|
55
|
+
H(B, a, t.defaultVariants) && (l += " " + b);
|
56
|
+
return l;
|
57
|
+
}, $ = "_1890qme0", G = E({ defaultClassName: "_1890qmef", variantClassNames: { disabled: { true: "_1890qmeg", false: "_1890qmeh" } }, defaultVariants: { disabled: !1 }, compoundVariants: [] }), U = "_1890qme2", W = "_1890qme1", Y = "_1890qmet", K = "_1890qme3", z = E({ defaultClassName: "_1890qme5", variantClassNames: { completed: { true: "_1890qme6", false: "_1890qme7" }, disabled: { true: "_1890qme8", false: "_1890qme9" }, color: { purple: "_1890qmea", blue: "_1890qmeb", red: "_1890qmec", orange: "_1890qmed", grey: "_1890qmee" } }, defaultVariants: { completed: !1, disabled: !1, color: "purple" }, compoundVariants: [] }), J = E({ defaultClassName: "_1890qmei", variantClassNames: { completed: { true: "_1890qmej", false: "_1890qmek" }, disabled: { true: "_1890qmel", false: "_1890qmem" }, color: { purple: "_1890qmen", blue: "_1890qmeo", red: "_1890qmep", orange: "_1890qmeq", grey: "_1890qmer" } }, defaultVariants: { completed: !1, disabled: !1, color: "purple" }, compoundVariants: [[{ completed: !0, disabled: !0 }, "_1890qmes"]] }), L = "_1890qme4";
|
58
|
+
var Q = E({ defaultClassName: "_17lj0goj", variantClassNames: { stepCompleted: { true: "_17lj0gok", false: "_17lj0gol" } }, defaultVariants: { stepCompleted: !1 }, compoundVariants: [] }), X = E({ defaultClassName: "_17lj0gom", variantClassNames: { stepCompleted: { true: "_17lj0gon", false: "_17lj0goo" }, disabled: { true: "_17lj0gop", false: "_17lj0goq" }, barCompleted: { true: "_17lj0gor", false: "_17lj0gos" }, color: { purple: "_17lj0got", red: "_17lj0gou", blue: "_17lj0gov", orange: "_17lj0gow", grey: "_17lj0gox" } }, defaultVariants: { stepCompleted: !1, disabled: !1, barCompleted: !1, color: "purple" }, compoundVariants: [[{ barCompleted: !0, disabled: !0 }, "_17lj0goy"], [{ barCompleted: !0, disabled: !1 }, "_17lj0goz"], [{ stepCompleted: !0, disabled: !0 }, "_17lj0go10"], [{ barCompleted: !1, disabled: !1, stepCompleted: !0, color: "purple" }, "_17lj0go11"], [{ barCompleted: !1, disabled: !1, stepCompleted: !0, color: "red" }, "_17lj0go12"], [{ barCompleted: !1, disabled: !1, stepCompleted: !0, color: "blue" }, "_17lj0go13"], [{ barCompleted: !1, disabled: !1, stepCompleted: !0, color: "orange" }, "_17lj0go14"], [{ barCompleted: !1, disabled: !1, stepCompleted: !0, color: "grey" }, "_17lj0go15"]] }), Z = E({ defaultClassName: "", variantClassNames: { barCompleted: { true: "_17lj0goa", false: "_17lj0gob" }, color: { purple: "_17lj0goc", blue: "_17lj0god", red: "_17lj0goe", orange: "_17lj0gof", grey: "_17lj0gog" }, disabled: { true: "_17lj0goh", false: "_17lj0goi" } }, defaultVariants: { barCompleted: !1, color: "purple", disabled: !1 }, compoundVariants: [] }), ee = E({ defaultClassName: "_17lj0go0", variantClassNames: { barCompleted: { true: "_17lj0go1", false: "_17lj0go2" }, disabled: { true: "_17lj0go3", false: "_17lj0go4" }, color: { purple: "_17lj0go5", blue: "_17lj0go6", red: "_17lj0go7", orange: "_17lj0go8", grey: "_17lj0go9" } }, defaultVariants: { barCompleted: !1, disabled: !1, color: "purple" }, compoundVariants: [] });
|
59
|
+
function _({
|
60
|
+
className: t,
|
61
|
+
title: s,
|
62
|
+
description: l,
|
63
|
+
icon: a,
|
64
|
+
complete: o = !1,
|
65
|
+
disabled: n,
|
66
|
+
barCompleted: p,
|
67
|
+
progressColor: c,
|
68
|
+
...m
|
69
|
+
}) {
|
70
|
+
const B = V().current || void 0;
|
71
|
+
return /* @__PURE__ */ e.createElement("li", {
|
72
|
+
id: B,
|
73
|
+
className: S(
|
74
|
+
X({
|
75
|
+
stepCompleted: o,
|
76
|
+
disabled: n,
|
77
|
+
barCompleted: p,
|
78
|
+
color: c
|
79
|
+
}),
|
80
|
+
t
|
81
|
+
),
|
82
|
+
...m
|
83
|
+
}, a && /* @__PURE__ */ e.createElement(k, {
|
84
|
+
icon: a,
|
85
|
+
size: "sm",
|
86
|
+
className: Q({
|
87
|
+
stepCompleted: o
|
88
|
+
})
|
89
|
+
}), s && B && /* @__PURE__ */ e.createElement(A, {
|
90
|
+
for: B,
|
91
|
+
title: s
|
92
|
+
}, l));
|
93
|
+
}
|
94
|
+
C.set(_, {
|
95
|
+
name: "ProgressBarStep",
|
96
|
+
props: {
|
97
|
+
icon: { type: "IconName" },
|
98
|
+
complete: { type: "boolean" },
|
99
|
+
title: { type: "string" },
|
100
|
+
description: { type: "string" }
|
101
|
+
}
|
102
|
+
});
|
103
|
+
function O({
|
104
|
+
className: t,
|
105
|
+
children: s,
|
106
|
+
detail: l,
|
107
|
+
disabled: a,
|
108
|
+
onClose: o,
|
109
|
+
percentComplete: n = 0,
|
110
|
+
title: p,
|
111
|
+
showStepsCounter: c,
|
112
|
+
progressColor: m = "purple",
|
113
|
+
...B
|
114
|
+
}) {
|
115
|
+
const { t: b } = e.useContext(F), [h, x] = e.useState([]), [u] = R(s, [{ type: _ }]);
|
116
|
+
let v = [];
|
117
|
+
e.useEffect(() => {
|
118
|
+
u.forEach((i) => {
|
119
|
+
var w;
|
120
|
+
(i == null ? void 0 : i.hasOwnProperty("props")) && ((w = i == null ? void 0 : i.props) == null ? void 0 : w.complete) === !0 && v.push(i), x(v);
|
121
|
+
});
|
122
|
+
}, []), n && u && console.warn(
|
123
|
+
[
|
124
|
+
"The percentComplete prop can't be used with the ProgressBarStep subcomponent.",
|
125
|
+
"The progress will be determined by how many nested ProgressBarStep components have the completed prop."
|
126
|
+
].join(" ")
|
127
|
+
);
|
128
|
+
const D = e.Children.map(s, (i) => e.isValidElement(i) ? e.cloneElement(i, {
|
129
|
+
disabled: a,
|
130
|
+
barCompleted: h.length === u.length,
|
131
|
+
progressColor: m
|
132
|
+
}) : i);
|
133
|
+
return /* @__PURE__ */ e.createElement("div", {
|
134
|
+
className: S($, t),
|
135
|
+
...B
|
136
|
+
}, /* @__PURE__ */ e.createElement("div", {
|
137
|
+
className: W
|
138
|
+
}, p && /* @__PURE__ */ e.createElement("div", {
|
139
|
+
className: K
|
140
|
+
}, /* @__PURE__ */ e.createElement("div", {
|
141
|
+
className: L
|
142
|
+
}, p), u.length > 0 ? /* @__PURE__ */ e.createElement(e.Fragment, null, c === !0 && /* @__PURE__ */ e.createElement("div", {
|
143
|
+
className: ee({
|
144
|
+
barCompleted: h.length === u.length,
|
145
|
+
disabled: a,
|
146
|
+
color: m
|
147
|
+
})
|
148
|
+
}, `${h.length} of ${u.length} Complete`)) : /* @__PURE__ */ e.createElement("div", {
|
149
|
+
className: z({
|
150
|
+
completed: n === 1,
|
151
|
+
disabled: a,
|
152
|
+
color: m
|
153
|
+
})
|
154
|
+
}, `${Math.floor(n * 100)}%`)), u.length > 0 ? /* @__PURE__ */ e.createElement("ul", {
|
155
|
+
className: S(
|
156
|
+
Z({
|
157
|
+
barCompleted: h.length === u.length,
|
158
|
+
disabled: a,
|
159
|
+
color: m
|
160
|
+
}),
|
161
|
+
"d-flex align-items-center list-unstyled mb-0"
|
162
|
+
)
|
163
|
+
}, D) : /* @__PURE__ */ e.createElement("div", {
|
164
|
+
className: G({
|
165
|
+
disabled: a
|
166
|
+
})
|
167
|
+
}, /* @__PURE__ */ e.createElement("div", {
|
168
|
+
className: J({
|
169
|
+
completed: n === 1,
|
170
|
+
disabled: a,
|
171
|
+
color: m
|
172
|
+
}),
|
173
|
+
style: { width: `${n * 100}%` }
|
174
|
+
})), l && /* @__PURE__ */ e.createElement("div", {
|
175
|
+
className: Y
|
176
|
+
}, l)), o && n !== 1 && /* @__PURE__ */ e.createElement("div", {
|
177
|
+
className: U
|
178
|
+
}, /* @__PURE__ */ e.createElement(I, {
|
179
|
+
kind: "icon",
|
180
|
+
icon: "x",
|
181
|
+
onClick: o,
|
182
|
+
title: b("design-system:progressBar.closeButtonTitle")
|
183
|
+
})));
|
184
|
+
}
|
185
|
+
C.set(O, {
|
186
|
+
name: "Progress Bar",
|
187
|
+
props: {
|
188
|
+
detail: { type: "string" },
|
189
|
+
disabled: { type: "boolean" },
|
190
|
+
onClose: { type: "() => void" },
|
191
|
+
percentComplete: { type: "number", default: "0" },
|
192
|
+
progressColor: { type: '"purple" | "blue" | "red" | "orange" | "grey"', default: '"purple"' }
|
193
|
+
}
|
194
|
+
});
|
195
|
+
function re({
|
196
|
+
className: t,
|
197
|
+
size: s = "sm",
|
198
|
+
progress: l = 0,
|
199
|
+
...a
|
200
|
+
}) {
|
201
|
+
const n = g.component["progress-ring"][s] - 4, p = n * 2 * Math.PI, c = p - l / 100 * p;
|
202
|
+
return /* @__PURE__ */ e.createElement("div", {
|
203
|
+
className: t,
|
204
|
+
...a
|
205
|
+
}, /* @__PURE__ */ e.createElement("svg", {
|
206
|
+
height: g.component["progress-ring"][s] * 2,
|
207
|
+
width: g.component["progress-ring"][s] * 2,
|
208
|
+
style: { transform: "rotate(-90deg)" }
|
209
|
+
}, /* @__PURE__ */ e.createElement("circle", {
|
210
|
+
stroke: g.color.grey["medium-light"],
|
211
|
+
fill: "transparent",
|
212
|
+
strokeWidth: 4,
|
213
|
+
strokeDasharray: `${p} ${p}`,
|
214
|
+
r: n,
|
215
|
+
cx: g.component["progress-ring"][s],
|
216
|
+
cy: g.component["progress-ring"][s]
|
217
|
+
}), /* @__PURE__ */ e.createElement("circle", {
|
218
|
+
stroke: g.color.purple.medium,
|
219
|
+
fill: "transparent",
|
220
|
+
strokeWidth: 4,
|
221
|
+
strokeDasharray: `${p} ${p}`,
|
222
|
+
style: { strokeDashoffset: c },
|
223
|
+
r: n,
|
224
|
+
cx: g.component["progress-ring"][s],
|
225
|
+
cy: g.component["progress-ring"][s]
|
226
|
+
})));
|
227
|
+
}
|
228
|
+
C.set(re, {
|
229
|
+
name: "Progress Ring",
|
230
|
+
props: {
|
231
|
+
size: { type: '"sm" | "md" | "lg"', default: '"sm"' },
|
232
|
+
progress: { type: "number", default: "0" }
|
233
|
+
}
|
234
|
+
});
|
235
|
+
const te = {
|
236
|
+
description: () => /* @__PURE__ */ e.createElement("p", null, "Progress Bars are used to visualize the progression of a process (such as a file upload) or series of related tasks that take place over a longer period of time. Progress Bars can be accompanied by a variety of additional content to provide more context regarding the processes being performed."),
|
237
|
+
components: [O, _],
|
238
|
+
examples: {
|
239
|
+
general: {
|
240
|
+
label: "General Usage",
|
241
|
+
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("p", null, "Progress Bars can be used in a variety of situations, but the most common use case is to show the live progress of a process such as a file upload or the processing of a digital payload."), /* @__PURE__ */ e.createElement("p", null, "For processes that typically complete within minutes or less, opt for the Standard Progress Bar."), /* @__PURE__ */ e.createElement("p", null, "For processes that are divided into specific steps that are accomplished over a longer period of time, opt for the Stepped Progress Bar."))
|
242
|
+
},
|
243
|
+
standard: {
|
244
|
+
label: "Standard Progress Bar",
|
245
|
+
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("p", null, "Standard Progress Bars are comprised of the following Required and Optional elements."), /* @__PURE__ */ e.createElement("img", {
|
246
|
+
src: "assets/images/progress-bar-example.svg",
|
247
|
+
alt: "A Progress Bar with labels on each section",
|
248
|
+
className: "w-100 mb-3"
|
249
|
+
}), /* @__PURE__ */ e.createElement(y, null, /* @__PURE__ */ e.createElement(N, null, /* @__PURE__ */ e.createElement(f, null, "Section"), /* @__PURE__ */ e.createElement(f, null, "Content Type"), /* @__PURE__ */ e.createElement(f, null, "Required"), /* @__PURE__ */ e.createElement(f, null, "Description/Guidelines")), /* @__PURE__ */ e.createElement(j, null, /* @__PURE__ */ e.createElement(d, null, /* @__PURE__ */ e.createElement(r, null, /* @__PURE__ */ e.createElement("span", {
|
250
|
+
className: "sps-tag sps-tag--info"
|
251
|
+
}, "1")), /* @__PURE__ */ e.createElement(r, null, "Title"), /* @__PURE__ */ e.createElement(r, null, "No"), /* @__PURE__ */ e.createElement(r, {
|
252
|
+
wrap: 400
|
253
|
+
}, "Use the Title when it provides necessary or helpful detail about the file or action that is being processed.")), /* @__PURE__ */ e.createElement(d, null, /* @__PURE__ */ e.createElement(r, null, /* @__PURE__ */ e.createElement("span", {
|
254
|
+
className: "sps-tag sps-tag--info"
|
255
|
+
}, "2")), /* @__PURE__ */ e.createElement(r, null, "Progress Meter"), /* @__PURE__ */ e.createElement(r, null, "Yes"), /* @__PURE__ */ e.createElement(r, null)), /* @__PURE__ */ e.createElement(d, null, /* @__PURE__ */ e.createElement(r, null, /* @__PURE__ */ e.createElement("span", {
|
256
|
+
className: "sps-tag sps-tag--info"
|
257
|
+
}, "3")), /* @__PURE__ */ e.createElement(r, null, "Progress Counter"), /* @__PURE__ */ e.createElement(r, null, "No"), /* @__PURE__ */ e.createElement(r, {
|
258
|
+
wrap: 400
|
259
|
+
}, "The Progress Counter should not be used without the existence of a Title.")), /* @__PURE__ */ e.createElement(d, null, /* @__PURE__ */ e.createElement(r, null, /* @__PURE__ */ e.createElement("span", {
|
260
|
+
className: "sps-tag sps-tag--info"
|
261
|
+
}, "4")), /* @__PURE__ */ e.createElement(r, null, "Clear Button"), /* @__PURE__ */ e.createElement(r, null, "No"), /* @__PURE__ */ e.createElement(r, {
|
262
|
+
wrap: 400
|
263
|
+
}, "If the process requires the option to be cancelled or removed from a list the clear button can be used.")), /* @__PURE__ */ e.createElement(d, null, /* @__PURE__ */ e.createElement(r, null, /* @__PURE__ */ e.createElement("span", {
|
264
|
+
className: "sps-tag sps-tag--info"
|
265
|
+
}, "5")), /* @__PURE__ */ e.createElement(r, null, "Progress Details"), /* @__PURE__ */ e.createElement(r, null, "No"), /* @__PURE__ */ e.createElement(r, {
|
266
|
+
wrap: 400
|
267
|
+
}, "Progress Details provide more context for the user and are especially useful when the process includes multiple steps."))))),
|
268
|
+
examples: {
|
269
|
+
standard: {
|
270
|
+
description: () => /* @__PURE__ */ e.createElement("p", null, "The Standard Progress Bar is designed to expand to fit the entire width of its container. View the diagram above for rules regarding including or excluding certain elements."),
|
271
|
+
react: P`
|
272
|
+
import { ProgressBar } from "@sps-woodland/progress-indicators";
|
273
|
+
import { Card } from "@sps-woodland/cards";
|
274
|
+
|
275
|
+
function Component() {
|
276
|
+
function handleClose() {
|
277
|
+
console.log("closed");
|
278
|
+
}
|
279
|
+
|
280
|
+
return (
|
281
|
+
<Card>
|
282
|
+
<ProgressBar
|
283
|
+
title="File Name"
|
284
|
+
detail="Step 3 of 5: Verifying Headers"
|
285
|
+
percentComplete={0.5}
|
286
|
+
onClose={handleClose}
|
287
|
+
/>
|
288
|
+
</Card>
|
289
|
+
)
|
290
|
+
}
|
291
|
+
`
|
292
|
+
},
|
293
|
+
completed: {
|
294
|
+
description: () => /* @__PURE__ */ e.createElement("p", null, "Once complete, the progress bar appears in green and the clear button (if included) disappears from view."),
|
295
|
+
react: P`
|
296
|
+
import { ProgressBar } from "@sps-woodland/progress-indicators";
|
297
|
+
import { Card } from "@sps-woodland/cards";
|
298
|
+
|
299
|
+
function Component() {
|
300
|
+
return (
|
301
|
+
<Card>
|
302
|
+
<ProgressBar
|
303
|
+
title="File Name"
|
304
|
+
detail="Process Complete"
|
305
|
+
percentComplete={1}
|
306
|
+
/>
|
307
|
+
</Card>
|
308
|
+
)
|
309
|
+
}
|
310
|
+
`
|
311
|
+
},
|
312
|
+
disabled: {
|
313
|
+
description: () => /* @__PURE__ */ e.createElement("p", null, "A disabled state is available for cases when progress is intentionally paused or user interaction needs to be restricted."),
|
314
|
+
react: P`
|
315
|
+
import { ProgressBar } from "@sps-woodland/progress-indicators";
|
316
|
+
import { Card } from "@sps-woodland/cards";
|
317
|
+
|
318
|
+
function Component() {
|
319
|
+
function handleClose() {
|
320
|
+
console.log("closed");
|
321
|
+
}
|
322
|
+
|
323
|
+
return (
|
324
|
+
<Card>
|
325
|
+
<ProgressBar
|
326
|
+
title="File Name"
|
327
|
+
detail="Step 3 of 5: Verifying Headers"
|
328
|
+
percentComplete={0.5}
|
329
|
+
disabled
|
330
|
+
onClose={handleClose}
|
331
|
+
/>
|
332
|
+
</Card>
|
333
|
+
)
|
334
|
+
}
|
335
|
+
`
|
336
|
+
}
|
337
|
+
}
|
338
|
+
},
|
339
|
+
stepped: {
|
340
|
+
label: "Stepped Progress Bar",
|
341
|
+
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("p", null, "Stepped Progress Bars are comprised of the following Required and Optional elements."), /* @__PURE__ */ e.createElement("img", {
|
342
|
+
src: "assets/images/stepped-progress-bar-example.svg",
|
343
|
+
alt: "A Progress Bar with labels on each section",
|
344
|
+
className: "w-100 mb-3"
|
345
|
+
}), /* @__PURE__ */ e.createElement(y, null, /* @__PURE__ */ e.createElement(N, null, /* @__PURE__ */ e.createElement(f, null, "Section"), /* @__PURE__ */ e.createElement(f, null, "Content Type"), /* @__PURE__ */ e.createElement(f, null, "Required"), /* @__PURE__ */ e.createElement(f, null, "Description/Guidelines")), /* @__PURE__ */ e.createElement(j, null, /* @__PURE__ */ e.createElement(d, null, /* @__PURE__ */ e.createElement(r, null, /* @__PURE__ */ e.createElement("span", {
|
346
|
+
className: "sps-tag sps-tag--info"
|
347
|
+
}, "1")), /* @__PURE__ */ e.createElement(r, null, "Title"), /* @__PURE__ */ e.createElement(r, null, "No"), /* @__PURE__ */ e.createElement(r, {
|
348
|
+
wrap: 400
|
349
|
+
}, "Use the Title when it provides necessary or helpful detail about the file or action that is being processed.")), /* @__PURE__ */ e.createElement(d, null, /* @__PURE__ */ e.createElement(r, null, /* @__PURE__ */ e.createElement("span", {
|
350
|
+
className: "sps-tag sps-tag--info"
|
351
|
+
}, "2")), /* @__PURE__ */ e.createElement(r, null, "Progress Meter"), /* @__PURE__ */ e.createElement(r, null, "Yes"), /* @__PURE__ */ e.createElement(r, null)), /* @__PURE__ */ e.createElement(d, null, /* @__PURE__ */ e.createElement(r, null, /* @__PURE__ */ e.createElement("span", {
|
352
|
+
className: "sps-tag sps-tag--info"
|
353
|
+
}, "3")), /* @__PURE__ */ e.createElement(r, null, "Progress Counter"), /* @__PURE__ */ e.createElement(r, null, "No"), /* @__PURE__ */ e.createElement(r, {
|
354
|
+
wrap: 400
|
355
|
+
}, "The Progress Counter should not be used without the existence of a Title.")), /* @__PURE__ */ e.createElement(d, null, /* @__PURE__ */ e.createElement(r, null, /* @__PURE__ */ e.createElement("span", {
|
356
|
+
className: "sps-tag sps-tag--info"
|
357
|
+
}, "4")), /* @__PURE__ */ e.createElement(r, null, "Step icons"), /* @__PURE__ */ e.createElement(r, null, "No"), /* @__PURE__ */ e.createElement(r, {
|
358
|
+
wrap: 400
|
359
|
+
}, "Icons can be set inside of steps for visual emphasis.")), /* @__PURE__ */ e.createElement(d, null, /* @__PURE__ */ e.createElement(r, null, /* @__PURE__ */ e.createElement("span", {
|
360
|
+
className: "sps-tag sps-tag--info"
|
361
|
+
}, "5")), /* @__PURE__ */ e.createElement(r, null, "Step Tooltips"), /* @__PURE__ */ e.createElement(r, null, "No"), /* @__PURE__ */ e.createElement(r, {
|
362
|
+
wrap: 400
|
363
|
+
}, "Tooltips can be utilized to provide more details about each specific step. Tooltips can be exposed on click or hover."))))),
|
364
|
+
examples: {
|
365
|
+
standard: {
|
366
|
+
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h4", null, "Building Stepped Progress Bars"), /* @__PURE__ */ e.createElement("p", null, "The Stepped Progress Bar is designed to expand to fit the entire width of its container. View the diagram above for rules regarding including or excluding certain elements.")),
|
367
|
+
react: P`
|
368
|
+
import { Card } from "@sps-woodland/cards";
|
369
|
+
import { ProgressBar, ProgressBarStep } from "@sps-woodland/progress-indicators";
|
370
|
+
|
371
|
+
function Component() {
|
372
|
+
return (
|
373
|
+
<Card>
|
374
|
+
<ProgressBar
|
375
|
+
title="Process Name"
|
376
|
+
showStepsCounter={true}
|
377
|
+
>
|
378
|
+
<ProgressBarStep
|
379
|
+
title="Title 1"
|
380
|
+
description="Description"
|
381
|
+
complete
|
382
|
+
/>
|
383
|
+
<ProgressBarStep complete />
|
384
|
+
<ProgressBarStep complete />
|
385
|
+
<ProgressBarStep complete />
|
386
|
+
<ProgressBarStep
|
387
|
+
title="Title 5"
|
388
|
+
description="Description"
|
389
|
+
icon="calendar"
|
390
|
+
/>
|
391
|
+
<ProgressBarStep />
|
392
|
+
<ProgressBarStep />
|
393
|
+
<ProgressBarStep />
|
394
|
+
<ProgressBarStep
|
395
|
+
title="Title 9"
|
396
|
+
description="Description"
|
397
|
+
icon="calendar"
|
398
|
+
/>
|
399
|
+
<ProgressBarStep />
|
400
|
+
<ProgressBarStep />
|
401
|
+
<ProgressBarStep
|
402
|
+
title="Title 12"
|
403
|
+
description="Description"
|
404
|
+
/>
|
405
|
+
</ProgressBar>
|
406
|
+
</Card>
|
407
|
+
)
|
408
|
+
}
|
409
|
+
`
|
410
|
+
},
|
411
|
+
color: {
|
412
|
+
description: () => /* @__PURE__ */ e.createElement("h4", null, "Alternate Color"),
|
413
|
+
react: P`
|
414
|
+
import { Card } from "@sps-woodland/cards";
|
415
|
+
import { ProgressBar, ProgressBarStep } from "@sps-woodland/progress-indicators";
|
416
|
+
|
417
|
+
function Component() {
|
418
|
+
return (
|
419
|
+
<Card>
|
420
|
+
<ProgressBar
|
421
|
+
title="Process Name"
|
422
|
+
showStepsCounter={true}
|
423
|
+
progressColor="grey"
|
424
|
+
>
|
425
|
+
<ProgressBarStep complete />
|
426
|
+
<ProgressBarStep complete />
|
427
|
+
<ProgressBarStep complete />
|
428
|
+
<ProgressBarStep complete />
|
429
|
+
<ProgressBarStep
|
430
|
+
title="Title 5"
|
431
|
+
description="Description"
|
432
|
+
icon="calendar"
|
433
|
+
/>
|
434
|
+
<ProgressBarStep />
|
435
|
+
<ProgressBarStep />
|
436
|
+
<ProgressBarStep />
|
437
|
+
<ProgressBarStep
|
438
|
+
title="Title 9"
|
439
|
+
description="Description"
|
440
|
+
icon="calendar"
|
441
|
+
/>
|
442
|
+
<ProgressBarStep />
|
443
|
+
<ProgressBarStep />
|
444
|
+
<ProgressBarStep
|
445
|
+
title="Title 12"
|
446
|
+
description="Description"
|
447
|
+
/>
|
448
|
+
</ProgressBar>
|
449
|
+
</Card>
|
450
|
+
)
|
451
|
+
}
|
452
|
+
`
|
453
|
+
},
|
454
|
+
skippedSteps: {
|
455
|
+
description: () => /* @__PURE__ */ e.createElement("h4", null, "Skip steps"),
|
456
|
+
react: P`
|
457
|
+
import { Card } from "@sps-woodland/cards";
|
458
|
+
import { ProgressBar, ProgressBarStep } from "@sps-woodland/progress-indicators";
|
459
|
+
|
460
|
+
function Component() {
|
461
|
+
return (
|
462
|
+
<Card>
|
463
|
+
<ProgressBar
|
464
|
+
title="Process Name"
|
465
|
+
showStepsCounter={true}
|
466
|
+
>
|
467
|
+
<ProgressBarStep />
|
468
|
+
<ProgressBarStep complete />
|
469
|
+
<ProgressBarStep complete />
|
470
|
+
<ProgressBarStep complete />
|
471
|
+
<ProgressBarStep complete />
|
472
|
+
<ProgressBarStep complete />
|
473
|
+
<ProgressBarStep complete />
|
474
|
+
<ProgressBarStep />
|
475
|
+
<ProgressBarStep />
|
476
|
+
<ProgressBarStep />
|
477
|
+
<ProgressBarStep />
|
478
|
+
<ProgressBarStep />
|
479
|
+
</ProgressBar>
|
480
|
+
</Card>
|
481
|
+
)
|
482
|
+
}
|
483
|
+
`
|
484
|
+
},
|
485
|
+
completed: {
|
486
|
+
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h4", null, "Completed State"), /* @__PURE__ */ e.createElement("p", null, "Once complete, the progress bar appears in green.")),
|
487
|
+
react: P`
|
488
|
+
import { Card } from "@sps-woodland/cards";
|
489
|
+
import { ProgressBar, ProgressBarStep } from "@sps-woodland/progress-indicators";
|
490
|
+
|
491
|
+
function Component() {
|
492
|
+
return (
|
493
|
+
<Card>
|
494
|
+
<ProgressBar
|
495
|
+
title="Process Name"
|
496
|
+
showStepsCounter={true}
|
497
|
+
>
|
498
|
+
<ProgressBarStep complete />
|
499
|
+
<ProgressBarStep complete />
|
500
|
+
<ProgressBarStep complete />
|
501
|
+
<ProgressBarStep complete />
|
502
|
+
<ProgressBarStep
|
503
|
+
title="Title 5"
|
504
|
+
description="Description"
|
505
|
+
icon="calendar"
|
506
|
+
complete
|
507
|
+
/>
|
508
|
+
<ProgressBarStep complete />
|
509
|
+
<ProgressBarStep complete />
|
510
|
+
<ProgressBarStep complete />
|
511
|
+
<ProgressBarStep
|
512
|
+
title="Title 9"
|
513
|
+
description="Description"
|
514
|
+
icon="calendar"
|
515
|
+
complete
|
516
|
+
/>
|
517
|
+
<ProgressBarStep complete />
|
518
|
+
<ProgressBarStep complete />
|
519
|
+
<ProgressBarStep
|
520
|
+
title="Title 12"
|
521
|
+
description="Description"
|
522
|
+
complete
|
523
|
+
/>
|
524
|
+
</ProgressBar>
|
525
|
+
</Card>
|
526
|
+
)
|
527
|
+
}
|
528
|
+
`
|
529
|
+
},
|
530
|
+
disabled: {
|
531
|
+
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h4", null, "Disabled State"), /* @__PURE__ */ e.createElement("p", null, "A disabled state is available for cases when progress is intentionally paused or user interaction needs to be restricted.")),
|
532
|
+
react: P`
|
533
|
+
import { Card } from "@sps-woodland/cards";
|
534
|
+
import { ProgressBar, ProgressBarStep } from "@sps-woodland/progress-indicators";
|
535
|
+
|
536
|
+
function Component() {
|
537
|
+
return (
|
538
|
+
<Card>
|
539
|
+
<ProgressBar
|
540
|
+
title="Process Name"
|
541
|
+
showStepsCounter={true}
|
542
|
+
disabled
|
543
|
+
>
|
544
|
+
<ProgressBarStep complete />
|
545
|
+
<ProgressBarStep complete />
|
546
|
+
<ProgressBarStep complete />
|
547
|
+
<ProgressBarStep complete />
|
548
|
+
<ProgressBarStep complete />
|
549
|
+
<ProgressBarStep complete />
|
550
|
+
<ProgressBarStep complete />
|
551
|
+
<ProgressBarStep />
|
552
|
+
<ProgressBarStep />
|
553
|
+
<ProgressBarStep />
|
554
|
+
</ProgressBar>
|
555
|
+
</Card>
|
556
|
+
)
|
557
|
+
}
|
558
|
+
`
|
559
|
+
}
|
560
|
+
}
|
561
|
+
}
|
562
|
+
}
|
563
|
+
}, pe = {
|
564
|
+
"Progress Bar": te
|
565
|
+
};
|
566
|
+
export {
|
567
|
+
pe as MANIFEST,
|
568
|
+
O as ProgressBar,
|
569
|
+
_ as ProgressBarStep,
|
570
|
+
re as ProgressRing
|
571
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { Tokens } from "@sps-woodland/tokens";
|
2
|
+
import { BooleanRecipeVariant, RecipeVariant, VariantDefinitions } from "@sps-woodland/core";
|
3
|
+
export declare type ProgressBarKind = keyof typeof Tokens.component["progress-bar"]["progress-color"];
|
4
|
+
interface ProgressBarVariantDefinitions extends VariantDefinitions {
|
5
|
+
completed: BooleanRecipeVariant;
|
6
|
+
disabled: BooleanRecipeVariant;
|
7
|
+
color: RecipeVariant<ProgressBarKind>;
|
8
|
+
}
|
9
|
+
export declare const progressBar: string;
|
10
|
+
export declare const progressBarContent: string;
|
11
|
+
export declare const progressBarCloseButton: string;
|
12
|
+
export declare const progressBarHeading: string;
|
13
|
+
export declare const progressBarTitle: string;
|
14
|
+
export declare const progressBarPercentage: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<ProgressBarVariantDefinitions>;
|
15
|
+
export declare const progressBarBackground: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<Pick<ProgressBarVariantDefinitions, "disabled">>;
|
16
|
+
export declare const progressBarProgress: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<ProgressBarVariantDefinitions>;
|
17
|
+
export declare const progressBarDetail: string;
|
18
|
+
export {};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { ComponentProps } from "@sps-woodland/core";
|
3
|
+
import { ProgressBarKind } from "./ProgressBar.css";
|
4
|
+
export declare function ProgressBar({ className, children, detail, disabled, onClose, percentComplete, title, showStepsCounter, progressColor, ...rest }: ComponentProps<{
|
5
|
+
detail?: string;
|
6
|
+
disabled?: boolean;
|
7
|
+
onClose?: () => void;
|
8
|
+
percentComplete?: number;
|
9
|
+
title?: string;
|
10
|
+
showStepsCounter?: boolean;
|
11
|
+
progressColor?: ProgressBarKind;
|
12
|
+
}, HTMLDivElement>): React.ReactElement;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { Tokens } from "@sps-woodland/tokens";
|
2
|
+
import type { VariantDefinitions, RecipeVariant, BooleanRecipeVariant } from "@sps-woodland/core";
|
3
|
+
export declare type SteppedProgressBarKind = keyof typeof Tokens.component["stepped-progress-bar"]["progress-color"];
|
4
|
+
interface ProgressBarStepVariantDefinitions extends VariantDefinitions {
|
5
|
+
color: RecipeVariant<SteppedProgressBarKind>;
|
6
|
+
stepCompleted: BooleanRecipeVariant;
|
7
|
+
barComplete: BooleanRecipeVariant;
|
8
|
+
}
|
9
|
+
export declare const progressBarStepsComplete: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<Pick<ProgressBarStepVariantDefinitions, "color" | "disabled" | "barCompleted">>;
|
10
|
+
export declare const progressBarStepBackground: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<Pick<ProgressBarStepVariantDefinitions, "color" | "disabled" | "barCompleted">>;
|
11
|
+
export declare const progressBarIcon: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<Pick<ProgressBarStepVariantDefinitions, "stepCompleted">>;
|
12
|
+
export declare const progressBarStep: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<Pick<ProgressBarStepVariantDefinitions, "color" | "disabled" | "stepCompleted" | "barCompleted">>;
|
13
|
+
export {};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { ComponentProps } from "@sps-woodland/core";
|
3
|
+
import { IconName } from "@sps-woodland/tokens";
|
4
|
+
import { ProgressBarKind } from "../ProgressBar.css";
|
5
|
+
export declare function ProgressBarStep({ className, title, description, icon, complete, disabled, barCompleted, progressColor, ...rest }: ComponentProps<{
|
6
|
+
title?: string;
|
7
|
+
description?: string;
|
8
|
+
icon?: IconName;
|
9
|
+
complete?: boolean;
|
10
|
+
disabled?: boolean;
|
11
|
+
barCompleted?: boolean;
|
12
|
+
progressColor?: ProgressBarKind;
|
13
|
+
}, HTMLElement>): React.ReactElement;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { ComponentProps } from "@sps-woodland/core";
|
3
|
+
import { ProgressRingSize } from "@sps-woodland/tokens";
|
4
|
+
export declare function ProgressRing({ className, size, progress, ...rest }: ComponentProps<{
|
5
|
+
size: ProgressRingSize;
|
6
|
+
progress: number;
|
7
|
+
}, HTMLDivElement>): React.ReactElement;
|
package/lib/style.css
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
._1890qme0{align-items:center;display:flex}._1890qme1{flex-grow:1}._1890qme2{margin-left:.5rem;margin-top:-.375rem}._1890qme3{display:flex;font-size:.875rem;line-height:1.25rem;margin-bottom:.5rem}._1890qme4{color:#1f282c;flex-grow:1}._1890qme5{color:#91467f;font-weight:600;font-size:.875rem;line-height:1.25rem}._1890qme6{color:#0b8940}._1890qme8{color:#d2d4d4}._1890qmea{color:#91467f}._1890qmeb{color:#007db8}._1890qmec{color:#de002e}._1890qmed{color:#e7760b}._1890qmee{color:#717779}._1890qmef{background:#e9e9ea;border-radius:.5rem;height:1rem;width:100%;overflow:hidden}._1890qmeg{cursor:not-allowed}._1890qmei{background-color:#91467f;border-radius:.5rem;height:1rem}._1890qmej{background-color:#0b8940!important}._1890qmel{background-color:#d2d4d4!important}._1890qmen{background:#91467f}._1890qmen:hover{background:#6e3c65}._1890qmeo{background:#007db8}._1890qmeo:hover{background:#09638d}._1890qmep{background:#de002e}._1890qmep:hover{background:#a30d2d}._1890qmeq{background:#e7760b}._1890qmeq:hover{background:#aa5e14}._1890qmer{background:#717779}._1890qmer:hover{background:#1f282c}._1890qmes{background-color:#d2d4d4}._1890qmet{color:#4b5356;font-size:.75rem;line-height:1.125rem;margin-top:1rem}._17lj0go0{font-weight:600}._17lj0go1{color:#0b8940!important}._17lj0go3{color:#d2d4d4!important}._17lj0go5{color:#91467f}._17lj0go6{color:#007db8}._17lj0go7{color:#de002e}._17lj0go8{color:#e7760b}._17lj0go9{color:#717779}._17lj0goh{cursor:not-allowed}._17lj0goj{display:block}._17lj0gok{color:#fff}._17lj0gol{color:#717779}._17lj0gom{background:#e9e9ea;border-radius:.125rem;margin-left:.125rem;height:1rem;display:flex;flex:1 1 8%;align-items:center;justify-content:center}._17lj0gom:last-child{border-radius:.125rem .5rem .5rem .125rem}._17lj0gom:first-child{border-radius:.5rem .125rem .125rem .5rem;margin-left:0}._17lj0goy{background:#d2d4d4}._17lj0goz{background:#0b8940}._17lj0go10{background:#d2d4d4;cursor:not-allowed}._17lj0go11{background:#91467f}._17lj0go11:hover{background:#6e3c65}._17lj0go12{background:#de002e}._17lj0go12:hover{background:#a30d2d}._17lj0go13{background:#007db8}._17lj0go13:hover{background:#09638d}._17lj0go14{background:#e7760b}._17lj0go14:hover{background:#aa5e14}._17lj0go15{background:#717779}._17lj0go15:hover{background:#1f282c}
|
package/package.json
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
{
|
2
|
+
"name": "@sps-woodland/progress-indicators",
|
3
|
+
"description": "SPS Woodland Design System progress indicator components",
|
4
|
+
"version": "8.0.0-rc1",
|
5
|
+
"author": "SPS Commerce",
|
6
|
+
"license": "UNLICENSED",
|
7
|
+
"repository": "https://github.com/SPSCommerce/woodland/tree/main/packages/@sps-woodland/progress-indicators",
|
8
|
+
"homepage": "https://github.com/SPSCommerce/woodland/tree/master/packages/@sps-woodland/progress-indicators#readme",
|
9
|
+
"module": "./lib/index.es.js",
|
10
|
+
"type": "module",
|
11
|
+
"main": "./lib/index.cjs.js",
|
12
|
+
"types": "./lib/index.d.ts",
|
13
|
+
"exports": {
|
14
|
+
".": {
|
15
|
+
"import": "./lib/index.es.js",
|
16
|
+
"require": "./lib/index.cjs.js",
|
17
|
+
"default": "./lib/index.cjs.js"
|
18
|
+
},
|
19
|
+
"./lib/style.css": {
|
20
|
+
"import": "./lib/style.css",
|
21
|
+
"require": "./lib/style.css"
|
22
|
+
}
|
23
|
+
},
|
24
|
+
"publishConfig": {
|
25
|
+
"access": "public"
|
26
|
+
},
|
27
|
+
"peerDependencies": {
|
28
|
+
"@spscommerce/utils": "^6.12.1",
|
29
|
+
"react": "^16.9.0",
|
30
|
+
"react-dom": "^16.9.0",
|
31
|
+
"@sps-woodland/core": "8.0.0-rc1",
|
32
|
+
"@sps-woodland/tokens": "8.0.0-rc1",
|
33
|
+
"@sps-woodland/buttons": "8.0.0-rc1",
|
34
|
+
"@spscommerce/ds-react": "8.0.0-rc1"
|
35
|
+
},
|
36
|
+
"devDependencies": {
|
37
|
+
"@spscommerce/utils": "^6.12.1",
|
38
|
+
"@vanilla-extract/css": "^1.9.3",
|
39
|
+
"@vanilla-extract/recipes": "^0.2.5",
|
40
|
+
"react": "^16.9.0",
|
41
|
+
"react-dom": "^16.9.0",
|
42
|
+
"@sps-woodland/buttons": "8.0.0-rc1",
|
43
|
+
"@spscommerce/ds-react": "8.0.0-rc1",
|
44
|
+
"@sps-woodland/core": "8.0.0-rc1",
|
45
|
+
"@sps-woodland/tokens": "8.0.0-rc1"
|
46
|
+
},
|
47
|
+
"scripts": {
|
48
|
+
"build": "pnpm run build:js && pnpm run build:types",
|
49
|
+
"build:js": "vite build",
|
50
|
+
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib",
|
51
|
+
"watch": "vite build --watch",
|
52
|
+
"clean": "git clean -fdX",
|
53
|
+
"pub": "node ../../../scripts/publish-package.js"
|
54
|
+
}
|
55
|
+
}
|
package/vite.config.js
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
import path from "path";
|
2
|
+
import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
|
3
|
+
import { defineConfig } from "vite";
|
4
|
+
|
5
|
+
import pkg from "./package.json";
|
6
|
+
|
7
|
+
export default defineConfig({
|
8
|
+
plugins: [vanillaExtractPlugin()],
|
9
|
+
build: {
|
10
|
+
lib: {
|
11
|
+
entry: path.resolve(__dirname, "src/index.ts"),
|
12
|
+
formats: ["es", "cjs"],
|
13
|
+
fileName: (format) => `index.${format}.js`,
|
14
|
+
},
|
15
|
+
outDir: path.resolve(__dirname, "./lib"),
|
16
|
+
emptyOutDir: false,
|
17
|
+
rollupOptions: {
|
18
|
+
external: pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [],
|
19
|
+
},
|
20
|
+
},
|
21
|
+
});
|