@sps-woodland/file-upload 8.20.14 → 8.20.16
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/lib/FileUpload.css.d.ts +1 -0
- package/lib/index.cjs.js +2 -2
- package/lib/index.es.js +62 -52
- package/lib/style.css +1 -1
- package/package.json +14 -12
package/lib/FileUpload.css.d.ts
CHANGED
package/lib/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _e=require("react"),w=require("@sps-woodland/core"),p=require("@spscommerce/utils"),I=require("@sps-woodland/buttons");function fe(o){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const l in o)if(l!=="default"){const a=Object.getOwnPropertyDescriptor(o,l);Object.defineProperty(i,l,a.get?a:{enumerable:!0,get:()=>o[l]})}}return i.default=o,Object.freeze(i)}const e=fe(_e),V={"7Z":["application/x-7z-compressed"],AAC:["audio/aac"],ABW:["application/x-abiword"],ARC:["application/octet-stream"],AVI:["video/x-msvideo"],AZW:["application/vnd.amazon.ebook"],BIN:["application/octet-stream"],BMP:["image/bmp"],BZ:["application/x-bzip"],BZ2:["application/x-bzip2"],CER:["application/pkix-cert","application/x-x509-ca-cert"],CSH:["application/x-csh"],CSS:["text/css"],CSV:["text/csv","application/vnd.ms-excel"],DOC:["application/msword"],DOCX:["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],EML:["application/octet-stream","message/rfc822","multipart/mixed","message/rfc5322","message/rfc6532"],EOT:["application/vnd.ms-fontobject"],EPUB:["application/epub+zip"],ES:["application/ecmascript"],FLV:["video/x-flv"],GIF:["image/gif"],GZ:["application/x-gzip"],HTM:["text/html"],HTML:["text/html"],ICO:["image/x-icon"],ICS:["text/calendar"],JAR:["application/java-archive"],JPEG:["image/jpeg"],JPG:["image/jpeg"],JS:["application/javascript"],JSON:["application/json"],M3U:["audio/x-mpequrl"],MID:["audio/midi"],MIDI:["audio/midi"],MOV:["video/quicktime"],MP3:["audio/mpeg3"],MP4:["video/mp4"],MPEG:["video/mpeg"],MPKG:["application/vnd.apple.installer+xml"],ODP:["application/vnd.oasis.opendocument.presentation"],ODS:["application/vnd.oasis.opendocument.spreadsheet"],ODT:["application/vnd.oasis.opendocument.text"],OGA:["audio/ogg"],OGV:["video/ogg"],OGX:["application/ogg"],OTF:["font/otf"],PNG:["image/png"],PDF:["application/pdf"],PPT:["application/vnd.ms-powerpoint"],PPTX:["application/vnd.openxmlformats-officedocument.presentationml.presentation"],RAR:["application/x-rar-compressed"],RTF:["application/rtf"],SH:["application/x-sh"],SVG:["image/svg+xml"],SWF:["application/x-shockwave-flash"],TAR:["application/x-tar"],TIF:["image/tiff"],TIFF:["image/tiff"],TS:["application/typescript"],TTF:["font/ttf"],TXT:["text/plain"],VSD:["application/vnd.visio"],WAV:["audio/wav"],WEBA:["audio/webm"],WEBM:["video/webm"],WEBP:["image/webp"],WOFF:["font/woff"],WOFF2:["font/woff2"],XHTML:["application/xhtml+xml"],XLS:["application/vnd.ms-excel"],XLSX:["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],XML:["application/xml"],XUL:["application/vnd.mozilla.xul+xml"],ZIP:["application/zip"]};function ue(o,i,l){return i in o?Object.defineProperty(o,i,{value:l,enumerable:!0,configurable:!0,writable:!0}):o[i]=l,o}function z(o,i){var l=Object.keys(o);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(o);i&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(o,n).enumerable})),l.push.apply(l,a)}return l}function L(o){for(var i=1;i<arguments.length;i++){var l=arguments[i]!=null?arguments[i]:{};i%2?z(Object(l),!0).forEach(function(a){ue(o,a,l[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(l)):z(Object(l)).forEach(function(a){Object.defineProperty(o,a,Object.getOwnPropertyDescriptor(l,a))})}return o}var me=(o,i,l)=>{for(var a of Object.keys(o)){var n;if(o[a]!==((n=i[a])!==null&&n!==void 0?n:l[a]))return!1}return!0},C=o=>i=>{var l=o.defaultClassName,a=L(L({},o.defaultVariants),i);for(var n in a){var v,g=(v=a[n])!==null&&v!==void 0?v:o.defaultVariants[n];if(g!=null){var d=g;typeof d=="boolean"&&(d=d===!0?"true":"false");var _=o.variantClassNames[n][d];_&&(l+=" "+_)}}for(var[x,k]of o.compoundVariants)me(x,a,o.defaultVariants)&&(l+=" "+k);return l},he="pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jws",R="pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwt",ve="pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwr",we=C({defaultClassName:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jw0",variantClassNames:{active:{true:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jw1",false:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jw2"},mini:{true:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jw3",false:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jw4"},error:{true:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jw5",false:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jw6"},shown:{true:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jw7",false:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jw8"},disabled:{true:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jw9",false:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwa"}},defaultVariants:{active:!1,mini:!1,error:!1,shown:!0,disabled:!1},compoundVariants:[]}),ge="pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jww",Fe=C({defaultClassName:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwb",variantClassNames:{constrainContentWidth:{true:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwc",false:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwd"},disabled:{true:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwe",false:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwf"}},defaultVariants:{constrainContentWidth:!1,disabled:!1},compoundVariants:[]}),xe="pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwv",be="pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwx",ye=C({defaultClassName:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwh",variantClassNames:{mini:{true:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwi",false:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwj"},error:{true:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwk",false:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwl"},disabled:{true:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwm",false:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwn"}},defaultVariants:{mini:!1,error:!1,disabled:!1},compoundVariants:[]}),W="pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwg",Se="pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwu",Ee=C({defaultClassName:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwo",variantClassNames:{mini:{true:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwp",false:"pkg_sps-woodland_file-upload__version_8_20_14__hash_rh07jwq"}},defaultVariants:{mini:!1},compoundVariants:[]});function T({constrainContentWidth:o,description:i,multiple:l=!1,dismissable:a,processing:n,mini:v,downloadLabel:g,acceptExtensions:d,maxSize:_,customRequirement:x,onSelection:k,onDismiss:N,download:P,shown:b,className:X,disabled:c,children:Ce,...G}){const y=e.useRef(new Set),[q,M]=e.useState(b),[ke,Z]=e.useState([]),[H,J]=e.useState(""),[A,K]=e.useState(),[Y,S]=e.useState(!1),[F,E]=e.useState(!1),[O,B]=e.useState([]),[Q,$]=e.useState(""),{t:h}=e.useContext(w.I18nContext),U=h(l?"design-system:fileUpload.instructions_plural":"design-system:fileUpload.instructions").split("|"),ee=i||(l?"Files":"File"),f=e.useRef(null);e.useEffect(()=>{b&&M(b)},[b]),e.useEffect(()=>{_&&te(_)},[_]),e.useEffect(()=>{d&&le(d)},[d]);function oe(){a&&(M(!1),N&&N())}function te(t){try{K(p.parseFileSize(t))}catch{throw new Error(`Could not parse "${t}" as a file size.`)}}function le(t){const u=(Array.isArray(t)?t:t.trim().split(/\s?,\s?/)).map(m=>m.replace(/^\./,"")),r=u.map(m=>`.${m}`.toLowerCase());$(r.map((m,j)=>j>0&&j===r.length-1?`or ${m}`:m).join(r.length>2?", ":" ")),y.current.clear();for(const m of u){const j=Object.keys(V).includes(m.toUpperCase())?V[m.toUpperCase()]:[];for(const ce of j)y.current.add(ce)}J(r.concat(Array.from(y.current)).join(","))}function D(t){B([]);let s=[];const u=Array.from(t);for(const r of u)r===null?s.push("Not a file"):(d&&!y.current.has(r.type)&&s.push(r.name),_&&A&&r.size>A&&s.indexOf(r.name)===-1&&s.push(r.name));s.length?(E(!0),f.current&&f.current.value&&(f.current.value="")):(Z(u),k(u)),B(s)}function ae(t){t.preventDefault(),E(!1),f.current&&f.current.click()}function ie(){P&&P()}function ne(t){t.stopPropagation(),D(t.target.files||[]),f.current&&f.current.value&&(f.current.value="")}function se(t){t.preventDefault(),t.stopPropagation(),S(!0),E(!1)}function re(t){t.preventDefault(),S(!0),E(!1)}function pe(t){t.preventDefault(),S(!1)}function de(t){t.preventDefault(),t.stopPropagation(),S(!1),t.dataTransfer.items?D(Array.from(t.dataTransfer.items).map(s=>s.getAsFile())):D(t.dataTransfer.files)}return e.createElement("div",{onDrop:c?()=>{}:de,onDragOver:c?()=>{}:se,onDragLeave:c?()=>{}:pe,onDragEnter:c?()=>{}:re,className:w.cl(we({active:Y,mini:v,error:F,shown:q,disabled:c}),X),...G},e.createElement("div",{className:w.cl(Fe({constrainContentWidth:o,disabled:c}))},n?e.createElement("div",null,e.createElement(w.Spinner,{size:"md","aria-hidden":"true"}),e.createElement("div",{className:W},h("design-system:fileUpload.processing"))):e.createElement("div",null,e.createElement(w.Icon,{className:ye({mini:v,error:F,disabled:c}),icon:F?"exclamation-circle":"upload-cloud","aria-hidden":"true"}),e.createElement("div",{className:Ee({mini:v})},F?e.createElement("div",null,h(O.length>1?"design-system:fileUpload.cancelled_plural":"design-system:fileUpload.cancelled")):e.createElement("div",null,h("design-system:fileUpload.title",{description:ee}))),F?e.createElement("div",{className:ve},new Set(O.map((t,s)=>{const u=Math.floor(t.length/2);return e.createElement("div",{className:he,key:t},e.createElement("span",{className:R},t.substr(0,u)),e.createElement("div",{className:R},e.createElement("span",null,t.substr(u))),s<O.length-1?",":"")}))):e.createElement("span",null),e.createElement("div",{className:W},e.createElement("div",null,e.createElement("span",null,U[0]),c?e.createElement("u",null,U[1]):e.createElement("a",{href:"",onClick:ae},U[1]),e.createElement("span",null,U[2]))),e.createElement("div",{className:Se},d?e.createElement("span",null,"("," ",h("design-system:fileUpload.acceptedTypes",{fileTypes:Q})," ",")"):"",_?e.createElement("span",null,"( ",h("design-system:fileUpload.maximumSize",{size:_})," )"):"",x?e.createElement("span",null," ",x," "):""),g&&e.createElement("div",{className:xe},e.createElement(I.Button,{disabled:c,kind:"link",icon:"download-cloud",onClick:ie},g)))),a&&!n&&e.createElement("div",{className:ge},e.createElement(I.Button,{disabled:c,kind:"icon",icon:"x",title:h("design-system:fileUpload.close"),onClick:oe})),e.createElement("form",{className:be},e.createElement("input",{ref:f,type:"file",accept:H||"*/*",multiple:l||void 0,onChange:ne})))}w.Metadata.set(T,{name:"FileUpload",props:{constrainContentWidth:{type:"boolean"},description:{type:"string"},multiple:{type:"boolean"},dismissable:{type:"boolean"},mini:{type:"boolean"},downloadLabel:{type:"string"},acceptExtensions:{type:"string[] | string"},maxSize:{type:"string"},customRequirement:{type:"string"},onSelection:{type:"(files: File[]) => void",required:!0},dismissal:{type:"() => void"},download:{type:"() => void"},disabled:{type:"boolean"}}});const Ue={components:[T],examples:{basic:{label:"Basic File Upload",description:"Simply allow the user to drag-and-drop or select a single file or multiple files at once.",examples:{basic:{description:"Single file upload",react:p.code`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const fe=require("react"),F=require("@sps-woodland/core"),p=require("@spscommerce/utils"),I=require("@sps-woodland/buttons"),R=require("@sps-woodland/illustrations");function ue(o){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const a in o)if(a!=="default"){const l=Object.getOwnPropertyDescriptor(o,a);Object.defineProperty(i,a,l.get?l:{enumerable:!0,get:()=>o[a]})}}return i.default=o,Object.freeze(i)}const e=ue(fe),L={"7Z":["application/x-7z-compressed"],AAC:["audio/aac"],ABW:["application/x-abiword"],ARC:["application/octet-stream"],AVI:["video/x-msvideo"],AZW:["application/vnd.amazon.ebook"],BIN:["application/octet-stream"],BMP:["image/bmp"],BZ:["application/x-bzip"],BZ2:["application/x-bzip2"],CER:["application/pkix-cert","application/x-x509-ca-cert"],CSH:["application/x-csh"],CSS:["text/css"],CSV:["text/csv","application/vnd.ms-excel"],DOC:["application/msword"],DOCX:["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],EML:["application/octet-stream","message/rfc822","multipart/mixed","message/rfc5322","message/rfc6532"],EOT:["application/vnd.ms-fontobject"],EPUB:["application/epub+zip"],ES:["application/ecmascript"],FLV:["video/x-flv"],GIF:["image/gif"],GZ:["application/x-gzip"],HTM:["text/html"],HTML:["text/html"],ICO:["image/x-icon"],ICS:["text/calendar"],JAR:["application/java-archive"],JPEG:["image/jpeg"],JPG:["image/jpeg"],JS:["application/javascript"],JSON:["application/json"],M3U:["audio/x-mpequrl"],MID:["audio/midi"],MIDI:["audio/midi"],MOV:["video/quicktime"],MP3:["audio/mpeg3"],MP4:["video/mp4"],MPEG:["video/mpeg"],MPKG:["application/vnd.apple.installer+xml"],ODP:["application/vnd.oasis.opendocument.presentation"],ODS:["application/vnd.oasis.opendocument.spreadsheet"],ODT:["application/vnd.oasis.opendocument.text"],OGA:["audio/ogg"],OGV:["video/ogg"],OGX:["application/ogg"],OTF:["font/otf"],PNG:["image/png"],PDF:["application/pdf"],PPT:["application/vnd.ms-powerpoint"],PPTX:["application/vnd.openxmlformats-officedocument.presentationml.presentation"],RAR:["application/x-rar-compressed"],RTF:["application/rtf"],SH:["application/x-sh"],SVG:["image/svg+xml"],SWF:["application/x-shockwave-flash"],TAR:["application/x-tar"],TIF:["image/tiff"],TIFF:["image/tiff"],TS:["application/typescript"],TTF:["font/ttf"],TXT:["text/plain"],VSD:["application/vnd.visio"],WAV:["audio/wav"],WEBA:["audio/webm"],WEBM:["video/webm"],WEBP:["image/webp"],WOFF:["font/woff"],WOFF2:["font/woff2"],XHTML:["application/xhtml+xml"],XLS:["application/vnd.ms-excel"],XLSX:["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],XML:["application/xml"],XUL:["application/vnd.mozilla.xul+xml"],ZIP:["application/zip"]};function me(o,i,a){return i in o?Object.defineProperty(o,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):o[i]=a,o}function V(o,i){var a=Object.keys(o);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(o);i&&(l=l.filter(function(n){return Object.getOwnPropertyDescriptor(o,n).enumerable})),a.push.apply(a,l)}return a}function z(o){for(var i=1;i<arguments.length;i++){var a=arguments[i]!=null?arguments[i]:{};i%2?V(Object(a),!0).forEach(function(l){me(o,l,a[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(a)):V(Object(a)).forEach(function(l){Object.defineProperty(o,l,Object.getOwnPropertyDescriptor(a,l))})}return o}var he=(o,i,a)=>{for(var l of Object.keys(o)){var n;if(o[l]!==((n=i[l])!==null&&n!==void 0?n:a[l]))return!1}return!0},C=o=>i=>{var a=o.defaultClassName,l=z(z({},o.defaultVariants),i);for(var n in l){var v,w=(v=l[n])!==null&&v!==void 0?v:o.defaultVariants[n];if(w!=null){var d=w;typeof d=="boolean"&&(d=d===!0?"true":"false");var _=o.variantClassNames[n][d];_&&(a+=" "+_)}}for(var[b,k]of o.compoundVariants)he(b,l,o.defaultVariants)&&(a+=" "+k);return a},ve="pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jws",W="pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwt",we="pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwr",ge=C({defaultClassName:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw0",variantClassNames:{active:{true:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw1",false:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw2"},mini:{true:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw3",false:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw4"},error:{true:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw5",false:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw6"},shown:{true:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw7",false:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw8"},disabled:{true:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw9",false:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwa"}},defaultVariants:{active:!1,mini:!1,error:!1,shown:!0,disabled:!1},compoundVariants:[]}),Fe="pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jww",be=C({defaultClassName:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwb",variantClassNames:{constrainContentWidth:{true:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwc",false:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwd"},disabled:{true:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwe",false:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwf"}},defaultVariants:{constrainContentWidth:!1,disabled:!1},compoundVariants:[]}),xe="pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwv",ye="pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwx",Ee=C({defaultClassName:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwh",variantClassNames:{mini:{true:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwi",false:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwj"},error:{true:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwk",false:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwl"},disabled:{true:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwm",false:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwn"}},defaultVariants:{mini:!1,error:!1,disabled:!1},compoundVariants:[]}),Se="pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwy",G="pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwg",Ue="pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwu",je=C({defaultClassName:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwo",variantClassNames:{mini:{true:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwp",false:"pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwq"}},defaultVariants:{mini:!1},compoundVariants:[]});function T({constrainContentWidth:o,description:i,multiple:a=!1,dismissable:l,processing:n,mini:v,downloadLabel:w,acceptExtensions:d,maxSize:_,customRequirement:b,onSelection:k,onDismiss:N,download:P,shown:x,className:X,disabled:c,children:Oe,...q}){const y=e.useRef(new Set),[Z,A]=e.useState(x),[De,H]=e.useState([]),[J,K]=e.useState(""),[M,Y]=e.useState(),[Q,E]=e.useState(!1),[g,S]=e.useState(!1),[O,B]=e.useState([]),[$,ee]=e.useState(""),{t:h}=e.useContext(F.I18nContext),U=h(a?"design-system:fileUpload.instructions_plural":"design-system:fileUpload.instructions").split("|"),oe=i||(a?"Files":"File"),f=e.useRef(null);e.useEffect(()=>{x&&A(x)},[x]),e.useEffect(()=>{_&&ae(_)},[_]),e.useEffect(()=>{d&&le(d)},[d]);function te(){l&&(A(!1),N&&N())}function ae(t){try{Y(p.parseFileSize(t))}catch{throw new Error(`Could not parse "${t}" as a file size.`)}}function le(t){const u=(Array.isArray(t)?t:t.trim().split(/\s?,\s?/)).map(m=>m.replace(/^\./,"")),r=u.map(m=>`.${m}`.toLowerCase());ee(r.map((m,j)=>j>0&&j===r.length-1?`or ${m}`:m).join(r.length>2?", ":" ")),y.current.clear();for(const m of u){const j=Object.keys(L).includes(m.toUpperCase())?L[m.toUpperCase()]:[];for(const _e of j)y.current.add(_e)}K(r.concat(Array.from(y.current)).join(","))}function D(t){B([]);let s=[];const u=Array.from(t);for(const r of u)r===null?s.push("Not a file"):(d&&!y.current.has(r.type)&&s.push(r.name),_&&M&&r.size>M&&s.indexOf(r.name)===-1&&s.push(r.name));s.length?(S(!0),f.current&&f.current.value&&(f.current.value="")):(H(u),k(u)),B(s)}function ie(t){t.preventDefault(),S(!1),f.current&&f.current.click()}function ne(){P&&P()}function se(t){t.stopPropagation(),D(t.target.files||[]),f.current&&f.current.value&&(f.current.value="")}function re(t){t.preventDefault(),t.stopPropagation(),E(!0),S(!1)}function pe(t){t.preventDefault(),E(!0),S(!1)}function de(t){t.preventDefault(),E(!1)}function ce(t){t.preventDefault(),t.stopPropagation(),E(!1),t.dataTransfer.items?D(Array.from(t.dataTransfer.items).map(s=>s.getAsFile())):D(t.dataTransfer.files)}return e.createElement("div",{onDrop:c?()=>{}:ce,onDragOver:c?()=>{}:re,onDragLeave:c?()=>{}:de,onDragEnter:c?()=>{}:pe,className:F.cl(ge({active:Q,mini:v,error:g,shown:Z,disabled:c}),X),...q},e.createElement("div",{className:F.cl(be({constrainContentWidth:o,disabled:c}))},n?e.createElement("div",null,e.createElement(F.Spinner,{size:"md","aria-hidden":"true"}),e.createElement("div",{className:G},h("design-system:fileUpload.processing"))):e.createElement("div",null,e.createElement("div",{className:Ee({mini:v,error:g,disabled:c}),"aria-hidden":"true"},e.createElement("img",{className:Se,src:g?R.GENERAL_ERROR_LARGE:R.UPLOAD_LARGE,alt:"Upload Icon"})),e.createElement("div",{className:je({mini:v})},g?e.createElement("div",null,h(O.length>1?"design-system:fileUpload.cancelled_plural":"design-system:fileUpload.cancelled")):e.createElement("div",null,h("design-system:fileUpload.title",{description:oe}))),g?e.createElement("div",{className:we},new Set(O.map((t,s)=>{const u=Math.floor(t.length/2);return e.createElement("div",{className:ve,key:t},e.createElement("span",{className:W},t.substr(0,u)),e.createElement("div",{className:W},e.createElement("span",null,t.substr(u))),s<O.length-1?",":"")}))):e.createElement("span",null),e.createElement("div",{className:G},e.createElement("div",null,e.createElement("span",null,U[0]),c?e.createElement("u",null,U[1]):e.createElement("a",{href:"",onClick:ie},U[1]),e.createElement("span",null,U[2]))),e.createElement("div",{className:Ue},d?e.createElement("span",null,"("," ",h("design-system:fileUpload.acceptedTypes",{fileTypes:$})," ",")"):"",_?e.createElement("span",null,"( ",h("design-system:fileUpload.maximumSize",{size:_})," )"):"",b?e.createElement("span",null," ",b," "):""),w&&e.createElement("div",{className:xe},e.createElement(I.Button,{disabled:c,kind:"link",icon:"download-cloud",onClick:ne},w)))),l&&!n&&e.createElement("div",{className:Fe},e.createElement(I.Button,{disabled:c,kind:"icon",icon:"x",title:h("design-system:fileUpload.close"),onClick:te})),e.createElement("form",{className:ye},e.createElement("input",{ref:f,type:"file",accept:J||"*/*",multiple:a||void 0,onChange:se})))}F.Metadata.set(T,{name:"FileUpload",props:{constrainContentWidth:{type:"boolean"},description:{type:"string"},multiple:{type:"boolean"},dismissable:{type:"boolean"},mini:{type:"boolean"},downloadLabel:{type:"string"},acceptExtensions:{type:"string[] | string"},maxSize:{type:"string"},customRequirement:{type:"string"},onSelection:{type:"(files: File[]) => void",required:!0},dismissal:{type:"() => void"},download:{type:"() => void"},disabled:{type:"boolean"}}});const Ce={components:[T],examples:{basic:{label:"Basic File Upload",description:"Simply allow the user to drag-and-drop or select a single file or multiple files at once.",examples:{basic:{description:"Single file upload",react:p.code`
|
|
2
2
|
import { FileUpload } from "@sps-woodland/file-upload";
|
|
3
3
|
|
|
4
4
|
function Component() {
|
|
@@ -170,4 +170,4 @@
|
|
|
170
170
|
onSelection={selectFile} />
|
|
171
171
|
)
|
|
172
172
|
}
|
|
173
|
-
`}}}}},
|
|
173
|
+
`}}}}},ke={"File Upload":Ce};exports.FileUpload=T;exports.MANIFEST=ke;
|
package/lib/index.es.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
|
-
import { Metadata as _e, I18nContext as fe, cl as
|
|
3
|
-
import { parseFileSize as
|
|
2
|
+
import { Metadata as _e, I18nContext as fe, cl as M, Spinner as ue } from "@sps-woodland/core";
|
|
3
|
+
import { parseFileSize as me, code as c } from "@spscommerce/utils";
|
|
4
4
|
import { Button as B } from "@sps-woodland/buttons";
|
|
5
|
+
import { GENERAL_ERROR_LARGE as he, UPLOAD_LARGE as ve } from "@sps-woodland/illustrations";
|
|
5
6
|
const I = {
|
|
6
7
|
"7Z": ["application/x-7z-compressed"],
|
|
7
8
|
AAC: ["audio/aac"],
|
|
@@ -79,7 +80,7 @@ const I = {
|
|
|
79
80
|
XUL: ["application/vnd.mozilla.xul+xml"],
|
|
80
81
|
ZIP: ["application/zip"]
|
|
81
82
|
};
|
|
82
|
-
function
|
|
83
|
+
function we(a, i, l) {
|
|
83
84
|
return i in a ? Object.defineProperty(a, i, {
|
|
84
85
|
value: l,
|
|
85
86
|
enumerable: !0,
|
|
@@ -87,7 +88,7 @@ function ve(a, i, l) {
|
|
|
87
88
|
writable: !0
|
|
88
89
|
}) : a[i] = l, a;
|
|
89
90
|
}
|
|
90
|
-
function
|
|
91
|
+
function R(a, i) {
|
|
91
92
|
var l = Object.keys(a);
|
|
92
93
|
if (Object.getOwnPropertySymbols) {
|
|
93
94
|
var t = Object.getOwnPropertySymbols(a);
|
|
@@ -97,18 +98,18 @@ function V(a, i) {
|
|
|
97
98
|
}
|
|
98
99
|
return l;
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
+
function L(a) {
|
|
101
102
|
for (var i = 1; i < arguments.length; i++) {
|
|
102
103
|
var l = arguments[i] != null ? arguments[i] : {};
|
|
103
|
-
i % 2 ?
|
|
104
|
-
|
|
105
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(l)) :
|
|
104
|
+
i % 2 ? R(Object(l), !0).forEach(function(t) {
|
|
105
|
+
we(a, t, l[t]);
|
|
106
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(l)) : R(Object(l)).forEach(function(t) {
|
|
106
107
|
Object.defineProperty(a, t, Object.getOwnPropertyDescriptor(l, t));
|
|
107
108
|
});
|
|
108
109
|
}
|
|
109
110
|
return a;
|
|
110
111
|
}
|
|
111
|
-
var
|
|
112
|
+
var ge = (a, i, l) => {
|
|
112
113
|
for (var t of Object.keys(a)) {
|
|
113
114
|
var n;
|
|
114
115
|
if (a[t] !== ((n = i[t]) !== null && n !== void 0 ? n : l[t]))
|
|
@@ -116,7 +117,7 @@ var we = (a, i, l) => {
|
|
|
116
117
|
}
|
|
117
118
|
return !0;
|
|
118
119
|
}, j = (a) => (i) => {
|
|
119
|
-
var l = a.defaultClassName, t =
|
|
120
|
+
var l = a.defaultClassName, t = L(L({}, a.defaultVariants), i);
|
|
120
121
|
for (var n in t) {
|
|
121
122
|
var v, w = (v = t[n]) !== null && v !== void 0 ? v : a.defaultVariants[n];
|
|
122
123
|
if (w != null) {
|
|
@@ -130,10 +131,10 @@ var we = (a, i, l) => {
|
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
for (var [F, C] of a.compoundVariants)
|
|
133
|
-
|
|
134
|
+
ge(F, t, a.defaultVariants) && (l += " " + C);
|
|
134
135
|
return l;
|
|
135
|
-
},
|
|
136
|
-
function
|
|
136
|
+
}, Fe = "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jws", V = "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwt", xe = "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwr", be = j({ defaultClassName: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw0", variantClassNames: { active: { true: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw1", false: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw2" }, mini: { true: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw3", false: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw4" }, error: { true: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw5", false: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw6" }, shown: { true: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw7", false: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw8" }, disabled: { true: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw9", false: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwa" } }, defaultVariants: { active: !1, mini: !1, error: !1, shown: !0, disabled: !1 }, compoundVariants: [] }), Ee = "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jww", ye = j({ defaultClassName: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwb", variantClassNames: { constrainContentWidth: { true: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwc", false: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwd" }, disabled: { true: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwe", false: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwf" } }, defaultVariants: { constrainContentWidth: !1, disabled: !1 }, compoundVariants: [] }), Ue = "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwv", Se = "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwx", je = j({ defaultClassName: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwh", variantClassNames: { mini: { true: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwi", false: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwj" }, error: { true: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwk", false: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwl" }, disabled: { true: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwm", false: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwn" } }, defaultVariants: { mini: !1, error: !1, disabled: !1 }, compoundVariants: [] }), Ce = "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwy", z = "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwg", ke = "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwu", De = j({ defaultClassName: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwo", variantClassNames: { mini: { true: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwp", false: "pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwq" } }, defaultVariants: { mini: !1 }, compoundVariants: [] });
|
|
137
|
+
function W({
|
|
137
138
|
constrainContentWidth: a,
|
|
138
139
|
description: i,
|
|
139
140
|
multiple: l = !1,
|
|
@@ -146,27 +147,27 @@ function R({
|
|
|
146
147
|
customRequirement: F,
|
|
147
148
|
onSelection: C,
|
|
148
149
|
onDismiss: O,
|
|
149
|
-
download:
|
|
150
|
+
download: N,
|
|
150
151
|
shown: x,
|
|
151
|
-
className:
|
|
152
|
+
className: G,
|
|
152
153
|
disabled: d,
|
|
153
|
-
children:
|
|
154
|
-
...
|
|
154
|
+
children: Ne,
|
|
155
|
+
...X
|
|
155
156
|
}) {
|
|
156
|
-
const b = e.useRef(/* @__PURE__ */ new Set()), [Z,
|
|
157
|
+
const b = e.useRef(/* @__PURE__ */ new Set()), [Z, T] = e.useState(x), [Te, q] = e.useState([]), [H, J] = e.useState(""), [P, K] = e.useState(), [Y, E] = e.useState(!1), [g, y] = e.useState(!1), [k, A] = e.useState([]), [Q, $] = e.useState(""), { t: h } = e.useContext(fe), U = h(l ? "design-system:fileUpload.instructions_plural" : "design-system:fileUpload.instructions").split("|"), ee = i || (l ? "Files" : "File"), f = e.useRef(null);
|
|
157
158
|
e.useEffect(() => {
|
|
158
|
-
x &&
|
|
159
|
+
x && T(x);
|
|
159
160
|
}, [x]), e.useEffect(() => {
|
|
160
161
|
_ && ae(_);
|
|
161
162
|
}, [_]), e.useEffect(() => {
|
|
162
163
|
p && le(p);
|
|
163
164
|
}, [p]);
|
|
164
165
|
function oe() {
|
|
165
|
-
t && (
|
|
166
|
+
t && (T(!1), O && O());
|
|
166
167
|
}
|
|
167
168
|
function ae(o) {
|
|
168
169
|
try {
|
|
169
|
-
K(
|
|
170
|
+
K(me(o));
|
|
170
171
|
} catch {
|
|
171
172
|
throw new Error(`Could not parse "${o}" as a file size.`);
|
|
172
173
|
}
|
|
@@ -174,43 +175,43 @@ function R({
|
|
|
174
175
|
function le(o) {
|
|
175
176
|
const u = (Array.isArray(o) ? o : o.trim().split(/\s?,\s?/)).map((m) => m.replace(/^\./, "")), r = u.map((m) => `.${m}`.toLowerCase());
|
|
176
177
|
$(
|
|
177
|
-
r.map((m,
|
|
178
|
+
r.map((m, S) => S > 0 && S === r.length - 1 ? `or ${m}` : m).join(r.length > 2 ? ", " : " ")
|
|
178
179
|
), b.current.clear();
|
|
179
180
|
for (const m of u) {
|
|
180
|
-
const
|
|
181
|
-
for (const ce of
|
|
181
|
+
const S = Object.keys(I).includes(m.toUpperCase()) ? I[m.toUpperCase()] : [];
|
|
182
|
+
for (const ce of S)
|
|
182
183
|
b.current.add(ce);
|
|
183
184
|
}
|
|
184
185
|
J(r.concat(Array.from(b.current)).join(","));
|
|
185
186
|
}
|
|
186
187
|
function D(o) {
|
|
187
|
-
|
|
188
|
+
A([]);
|
|
188
189
|
let s = [];
|
|
189
190
|
const u = Array.from(o);
|
|
190
191
|
for (const r of u)
|
|
191
192
|
r === null ? s.push("Not a file") : (p && !b.current.has(r.type) && s.push(r.name), _ && P && r.size > P && s.indexOf(r.name) === -1 && s.push(r.name));
|
|
192
|
-
s.length ? (
|
|
193
|
+
s.length ? (y(!0), f.current && f.current.value && (f.current.value = "")) : (q(u), C(u)), A(s);
|
|
193
194
|
}
|
|
194
195
|
function te(o) {
|
|
195
|
-
o.preventDefault(),
|
|
196
|
+
o.preventDefault(), y(!1), f.current && f.current.click();
|
|
196
197
|
}
|
|
197
198
|
function ie() {
|
|
198
|
-
|
|
199
|
+
N && N();
|
|
199
200
|
}
|
|
200
201
|
function ne(o) {
|
|
201
202
|
o.stopPropagation(), D(o.target.files || []), f.current && f.current.value && (f.current.value = "");
|
|
202
203
|
}
|
|
203
204
|
function se(o) {
|
|
204
|
-
o.preventDefault(), o.stopPropagation(),
|
|
205
|
+
o.preventDefault(), o.stopPropagation(), E(!0), y(!1);
|
|
205
206
|
}
|
|
206
207
|
function re(o) {
|
|
207
|
-
o.preventDefault(),
|
|
208
|
+
o.preventDefault(), E(!0), y(!1);
|
|
208
209
|
}
|
|
209
210
|
function pe(o) {
|
|
210
|
-
o.preventDefault(),
|
|
211
|
+
o.preventDefault(), E(!1);
|
|
211
212
|
}
|
|
212
213
|
function de(o) {
|
|
213
|
-
o.preventDefault(), o.stopPropagation(),
|
|
214
|
+
o.preventDefault(), o.stopPropagation(), E(!1), o.dataTransfer.items ? D(
|
|
214
215
|
Array.from(o.dataTransfer.items).map(
|
|
215
216
|
(s) => s.getAsFile()
|
|
216
217
|
)
|
|
@@ -227,27 +228,36 @@ function R({
|
|
|
227
228
|
} : pe,
|
|
228
229
|
onDragEnter: d ? () => {
|
|
229
230
|
} : re,
|
|
230
|
-
className:
|
|
231
|
-
...
|
|
231
|
+
className: M(be({ active: Y, mini: v, error: g, shown: Z, disabled: d }), G),
|
|
232
|
+
...X
|
|
232
233
|
},
|
|
233
|
-
/* @__PURE__ */ e.createElement("div", { className:
|
|
234
|
-
|
|
234
|
+
/* @__PURE__ */ e.createElement("div", { className: M(ye({ constrainContentWidth: a, disabled: d })) }, n ? /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(ue, { size: "md", "aria-hidden": "true" }), /* @__PURE__ */ e.createElement("div", { className: z }, h("design-system:fileUpload.processing"))) : /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("div", { className: je({ mini: v, error: g, disabled: d }), "aria-hidden": "true" }, /* @__PURE__ */ e.createElement(
|
|
235
|
+
"img",
|
|
235
236
|
{
|
|
236
|
-
className:
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
className: Ce,
|
|
238
|
+
src: g ? he : ve,
|
|
239
|
+
alt: "Upload Icon"
|
|
239
240
|
}
|
|
240
|
-
), /* @__PURE__ */ e.createElement("div", { className:
|
|
241
|
+
)), /* @__PURE__ */ e.createElement("div", { className: De({ mini: v }) }, g ? /* @__PURE__ */ e.createElement("div", null, h(
|
|
241
242
|
k.length > 1 ? "design-system:fileUpload.cancelled_plural" : "design-system:fileUpload.cancelled"
|
|
242
|
-
)) : /* @__PURE__ */ e.createElement("div", null, h("design-system:fileUpload.title", { description: ee }))), g ? /* @__PURE__ */ e.createElement("div", { className:
|
|
243
|
+
)) : /* @__PURE__ */ e.createElement("div", null, h("design-system:fileUpload.title", { description: ee }))), g ? /* @__PURE__ */ e.createElement("div", { className: xe }, new Set(
|
|
243
244
|
k.map((o, s) => {
|
|
244
245
|
const u = Math.floor(o.length / 2);
|
|
245
|
-
return /* @__PURE__ */ e.createElement("div", { className:
|
|
246
|
+
return /* @__PURE__ */ e.createElement("div", { className: Fe, key: o }, /* @__PURE__ */ e.createElement("span", { className: V }, o.substr(0, u)), /* @__PURE__ */ e.createElement("div", { className: V }, /* @__PURE__ */ e.createElement("span", null, o.substr(u))), s < k.length - 1 ? "," : "");
|
|
246
247
|
})
|
|
247
|
-
)) : /* @__PURE__ */ e.createElement("span", null), /* @__PURE__ */ e.createElement("div", { className:
|
|
248
|
+
)) : /* @__PURE__ */ e.createElement("span", null), /* @__PURE__ */ e.createElement("div", { className: z }, /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("span", null, U[0]), d ? /* @__PURE__ */ e.createElement("u", null, U[1]) : /* @__PURE__ */ e.createElement("a", { href: "", onClick: te }, U[1]), /* @__PURE__ */ e.createElement("span", null, U[2]))), /* @__PURE__ */ e.createElement("div", { className: ke }, p ? /* @__PURE__ */ e.createElement("span", null, "(", " ", h("design-system:fileUpload.acceptedTypes", {
|
|
248
249
|
fileTypes: Q
|
|
249
|
-
}), " ", ")") : "", _ ? /* @__PURE__ */ e.createElement("span", null, "( ", h("design-system:fileUpload.maximumSize", { size: _ }), " )") : "", F ? /* @__PURE__ */ e.createElement("span", null, " ", F, " ") : ""), w && /* @__PURE__ */ e.createElement("div", { className:
|
|
250
|
-
|
|
250
|
+
}), " ", ")") : "", _ ? /* @__PURE__ */ e.createElement("span", null, "( ", h("design-system:fileUpload.maximumSize", { size: _ }), " )") : "", F ? /* @__PURE__ */ e.createElement("span", null, " ", F, " ") : ""), w && /* @__PURE__ */ e.createElement("div", { className: Ue }, /* @__PURE__ */ e.createElement(
|
|
251
|
+
B,
|
|
252
|
+
{
|
|
253
|
+
disabled: d,
|
|
254
|
+
kind: "link",
|
|
255
|
+
icon: "download-cloud",
|
|
256
|
+
onClick: ie
|
|
257
|
+
},
|
|
258
|
+
w
|
|
259
|
+
)))),
|
|
260
|
+
t && !n && /* @__PURE__ */ e.createElement("div", { className: Ee }, /* @__PURE__ */ e.createElement(
|
|
251
261
|
B,
|
|
252
262
|
{
|
|
253
263
|
disabled: d,
|
|
@@ -269,7 +279,7 @@ function R({
|
|
|
269
279
|
))
|
|
270
280
|
);
|
|
271
281
|
}
|
|
272
|
-
_e.set(
|
|
282
|
+
_e.set(W, {
|
|
273
283
|
name: "FileUpload",
|
|
274
284
|
props: {
|
|
275
285
|
constrainContentWidth: { type: "boolean" },
|
|
@@ -287,8 +297,8 @@ _e.set(R, {
|
|
|
287
297
|
disabled: { type: "boolean" }
|
|
288
298
|
}
|
|
289
299
|
});
|
|
290
|
-
const
|
|
291
|
-
components: [
|
|
300
|
+
const Oe = {
|
|
301
|
+
components: [W],
|
|
292
302
|
examples: {
|
|
293
303
|
basic: {
|
|
294
304
|
label: "Basic File Upload",
|
|
@@ -541,10 +551,10 @@ const ke = {
|
|
|
541
551
|
}
|
|
542
552
|
}
|
|
543
553
|
}
|
|
544
|
-
},
|
|
545
|
-
"File Upload":
|
|
554
|
+
}, Ie = {
|
|
555
|
+
"File Upload": Oe
|
|
546
556
|
};
|
|
547
557
|
export {
|
|
548
|
-
|
|
549
|
-
|
|
558
|
+
W as FileUpload,
|
|
559
|
+
Ie as MANIFEST
|
|
550
560
|
};
|
package/lib/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.pkg_sps-woodland_file-
|
|
1
|
+
.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw0{border-width:.0625rem;border-style:dashed;border-radius:.25rem;display:block;padding:1rem;position:relative}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw1{background-color:#f4ecf2;border-color:#91467f;border-style:solid}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw3{padding:1rem}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw5{border-color:#de012e}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw8{display:none}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jw9{border-color:#d2d4d4}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwb{color:#4b5356;margin:0 auto;text-align:center}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwc{width:50%}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwe{color:#717779}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwg{font-size:.75rem;line-height:1.25rem}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwh{color:#717779;display:block;margin-bottom:1rem}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwi{font-size:1.5rem;line-height:1.5rem}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwj{font-size:3rem;line-height:3rem}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwk{color:#de012e}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwm{opacity:.5}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwo{font-weight:600;margin-bottom:.25rem}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwp{font-size:1rem;line-height:1.25rem}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwq{font-size:1.125rem;line-height:1.25rem}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwr{font-size:.875rem;font-weight:600;line-height:1.25rem}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jws{display:flex;justify-content:center;white-space:nowrap}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwt{max-width:50%;overflow:hidden}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwt:first-child{text-overflow:ellipsis}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwt:last-child{float:right}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwu{font-size:.75rem;line-height:1.125rem;margin-top:.25rem}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwu>span+span{margin-left:.125rem}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwv{margin-top:1rem}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jww{position:absolute;right:.5rem;top:.5rem}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwx{display:none}.pkg_sps-woodland_file-upload__version_8_20_16__hash_rh07jwy{height:3rem}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sps-woodland/file-upload",
|
|
3
3
|
"description": "SPS Woodland Design System file upload component",
|
|
4
|
-
"version": "8.20.
|
|
4
|
+
"version": "8.20.16",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/SPSCommerce/woodland/tree/main/packages/@sps-woodland/file-upload",
|
|
@@ -30,11 +30,12 @@
|
|
|
30
30
|
"@spscommerce/utils": "^7.0.0",
|
|
31
31
|
"react": "^16.14.0",
|
|
32
32
|
"react-dom": "^16.14.0",
|
|
33
|
-
"@sps-woodland/buttons": "8.20.
|
|
34
|
-
"@sps-woodland/core": "8.20.
|
|
35
|
-
"@sps-woodland/tokens": "8.20.
|
|
36
|
-
"@
|
|
37
|
-
"@spscommerce/ds-
|
|
33
|
+
"@sps-woodland/buttons": "8.20.16",
|
|
34
|
+
"@sps-woodland/core": "8.20.16",
|
|
35
|
+
"@sps-woodland/tokens": "8.20.16",
|
|
36
|
+
"@sps-woodland/illustrations": "8.20.16",
|
|
37
|
+
"@spscommerce/ds-react": "8.20.16",
|
|
38
|
+
"@spscommerce/ds-shared": "8.20.16"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@spscommerce/ds-illustrations": "^6.12.1",
|
|
@@ -43,12 +44,13 @@
|
|
|
43
44
|
"@vanilla-extract/recipes": "^0.2.5",
|
|
44
45
|
"react": "^16.14.0",
|
|
45
46
|
"react-dom": "^16.14.0",
|
|
46
|
-
"@sps-woodland/buttons": "8.20.
|
|
47
|
-
"@sps-woodland/core": "8.20.
|
|
48
|
-
"@sps-woodland/tokens": "8.20.
|
|
49
|
-
"@spscommerce/ds-colors": "8.20.
|
|
50
|
-
"@
|
|
51
|
-
"@spscommerce/ds-
|
|
47
|
+
"@sps-woodland/buttons": "8.20.16",
|
|
48
|
+
"@sps-woodland/core": "8.20.16",
|
|
49
|
+
"@sps-woodland/tokens": "8.20.16",
|
|
50
|
+
"@spscommerce/ds-colors": "8.20.16",
|
|
51
|
+
"@sps-woodland/illustrations": "8.20.16",
|
|
52
|
+
"@spscommerce/ds-react": "8.20.16",
|
|
53
|
+
"@spscommerce/ds-shared": "8.20.16"
|
|
52
54
|
},
|
|
53
55
|
"scripts": {
|
|
54
56
|
"build": "pnpm run build:js && pnpm run build:types",
|