@sps-woodland/file-upload 8.33.5 → 8.33.6

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/index.js CHANGED
@@ -133,7 +133,7 @@ var ge = (a, i, l) => {
133
133
  for (var [F, k] of a.compoundVariants)
134
134
  ge(F, t, a.defaultVariants) && (l += " " + k);
135
135
  return l;
136
- }, Fe = C({ defaultClassName: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw0", variantClassNames: { active: { true: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw1", false: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw2" }, mini: { true: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw3", false: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw4" }, error: { true: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw5", false: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw6" }, shown: { true: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw7", false: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw8" }, disabled: { true: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw9", false: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwa" } }, defaultVariants: { active: !1, mini: !1, error: !1, shown: !0, disabled: !1 }, compoundVariants: [] }), xe = C({ defaultClassName: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwb", variantClassNames: { constrainContentWidth: { true: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwc", false: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwd" }, disabled: { true: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwe", false: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwf" } }, defaultVariants: { constrainContentWidth: !1, disabled: !1 }, compoundVariants: [] }), z = "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwg", be = C({ defaultClassName: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwh", variantClassNames: { mini: { true: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwi", false: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwj" }, error: { true: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwk", false: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwl" }, disabled: { true: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwm", false: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwn" } }, defaultVariants: { mini: !1, error: !1, disabled: !1 }, compoundVariants: [] }), ye = C({ defaultClassName: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwo", variantClassNames: { mini: { true: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwp", false: "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwq" } }, defaultVariants: { mini: !1 }, compoundVariants: [] }), Ee = "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwr", Ue = "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jws", G = "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwt", Se = "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwu", je = "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwv", Ce = "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jww", ke = "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwx", De = "pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwy";
136
+ }, Fe = C({ defaultClassName: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw0", variantClassNames: { active: { true: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw1", false: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw2" }, mini: { true: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw3", false: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw4" }, error: { true: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw5", false: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw6" }, shown: { true: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw7", false: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw8" }, disabled: { true: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw9", false: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwa" } }, defaultVariants: { active: !1, mini: !1, error: !1, shown: !0, disabled: !1 }, compoundVariants: [] }), xe = C({ defaultClassName: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwb", variantClassNames: { constrainContentWidth: { true: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwc", false: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwd" }, disabled: { true: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwe", false: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwf" } }, defaultVariants: { constrainContentWidth: !1, disabled: !1 }, compoundVariants: [] }), z = "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwg", be = C({ defaultClassName: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwh", variantClassNames: { mini: { true: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwi", false: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwj" }, error: { true: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwk", false: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwl" }, disabled: { true: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwm", false: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwn" } }, defaultVariants: { mini: !1, error: !1, disabled: !1 }, compoundVariants: [] }), ye = C({ defaultClassName: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwo", variantClassNames: { mini: { true: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwp", false: "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwq" } }, defaultVariants: { mini: !1 }, compoundVariants: [] }), Ee = "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwr", Ue = "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jws", G = "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwt", Se = "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwu", je = "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwv", Ce = "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jww", ke = "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwx", De = "pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwy";
137
137
  function X({
138
138
  constrainContentWidth: a,
139
139
  description: i,
package/lib/index.umd.cjs CHANGED
@@ -1,4 +1,4 @@
1
- (function(n,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react"),require("@sps-woodland/core"),require("@spscommerce/utils"),require("@sps-woodland/buttons"),require("@sps-woodland/illustrations")):typeof define=="function"&&define.amd?define(["exports","react","@sps-woodland/core","@spscommerce/utils","@sps-woodland/buttons","@sps-woodland/illustrations"],g):(n=typeof globalThis<"u"?globalThis:n||self,g(n.FileUpload={},n.React,n.core,n.utils,n.buttons,n.illustrations))})(this,function(n,g,F,p,A,M){"use strict";function J(o){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const l in o)if(l!=="default"){const t=Object.getOwnPropertyDescriptor(o,l);Object.defineProperty(i,l,t.get?t:{enumerable:!0,get:()=>o[l]})}}return i.default=o,Object.freeze(i)}const e=J(g),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 K(o,i,l){return i in o?Object.defineProperty(o,i,{value:l,enumerable:!0,configurable:!0,writable:!0}):o[i]=l,o}function B(o,i){var l=Object.keys(o);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(o);i&&(t=t.filter(function(s){return Object.getOwnPropertyDescriptor(o,s).enumerable})),l.push.apply(l,t)}return l}function I(o){for(var i=1;i<arguments.length;i++){var l=arguments[i]!=null?arguments[i]:{};i%2?B(Object(l),!0).forEach(function(t){K(o,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(l)):B(Object(l)).forEach(function(t){Object.defineProperty(o,t,Object.getOwnPropertyDescriptor(l,t))})}return o}var Y=(o,i,l)=>{for(var t of Object.keys(o)){var s;if(o[t]!==((s=i[t])!==null&&s!==void 0?s:l[t]))return!1}return!0},b=o=>i=>{var l=o.defaultClassName,t=I(I({},o.defaultVariants),i);for(var s in t){var v,x=(v=t[s])!==null&&v!==void 0?v:o.defaultVariants[s];if(x!=null){var c=x;typeof c=="boolean"&&(c=c===!0?"true":"false");var _=o.variantClassNames[s][c];_&&(l+=" "+_)}}for(var[E,N]of o.compoundVariants)Y(E,t,o.defaultVariants)&&(l+=" "+N);return l},$=b({defaultClassName:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw0",variantClassNames:{active:{true:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw1",false:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw2"},mini:{true:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw3",false:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw4"},error:{true:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw5",false:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw6"},shown:{true:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw7",false:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw8"},disabled:{true:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw9",false:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwa"}},defaultVariants:{active:!1,mini:!1,error:!1,shown:!0,disabled:!1},compoundVariants:[]}),Q=b({defaultClassName:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwb",variantClassNames:{constrainContentWidth:{true:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwc",false:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwd"},disabled:{true:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwe",false:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwf"}},defaultVariants:{constrainContentWidth:!1,disabled:!1},compoundVariants:[]}),R="pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwg",ee=b({defaultClassName:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwh",variantClassNames:{mini:{true:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwi",false:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwj"},error:{true:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwk",false:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwl"},disabled:{true:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwm",false:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwn"}},defaultVariants:{mini:!1,error:!1,disabled:!1},compoundVariants:[]}),oe=b({defaultClassName:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwo",variantClassNames:{mini:{true:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwp",false:"pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwq"}},defaultVariants:{mini:!1},compoundVariants:[]}),ae="pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwr",le="pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jws",L="pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwt",te="pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwu",ie="pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwv",ne="pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jww",se="pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwx",re="pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwy";function T({constrainContentWidth:o,description:i,multiple:l=!1,dismissable:t,processing:s,mini:v,downloadLabel:x,acceptExtensions:c,maxSize:_,customRequirement:E,onSelection:N,onDismiss:z,download:W,shown:U,className:de,disabled:f,children:De,...ce}){const S=e.useRef(new Set),[_e,G]=e.useState(U),[Te,fe]=e.useState([]),[ue,me]=e.useState(""),[X,he]=e.useState(),[we,j]=e.useState(!1),[y,C]=e.useState(!1),[k,q]=e.useState([]),[Z,ve]=e.useState(""),{t:w}=e.useContext(F.I18nContext),O=(l?w("design-system:fileUpload.instructions_plural",{defaultValue:"Drag and drop your files here or |browse for files| on your desktop."}):w("design-system:fileUpload.instructions",{defaultValue:"Drag and drop your file here or |browse for a file| on your desktop."})).split("|"),H=i||(l?"Files":"File"),u=e.useRef(null);e.useEffect(()=>{U&&G(U)},[U]),e.useEffect(()=>{_&&Fe(_)},[_]),e.useEffect(()=>{c&&xe(c)},[c]);function ge(){t&&(G(!1),z&&z())}function Fe(a){try{he(p.parseFileSize(a))}catch{throw new Error(`Could not parse "${a}" as a file size.`)}}function xe(a){const m=(Array.isArray(a)?a:a.trim().split(/\s?,\s?/)).map(h=>h.replace(/^\./,"")),d=m.map(h=>`.${h}`.toLowerCase());ve(d.map((h,D)=>D>0&&D===d.length-1?`or ${h}`:h).join(d.length>2?", ":" ")),S.current.clear();for(const h of m){const D=Object.keys(V).includes(h.toUpperCase())?V[h.toUpperCase()]:[];for(const ke of D)S.current.add(ke)}me(d.concat(Array.from(S.current)).join(","))}function P(a){q([]);let r=[];const m=Array.from(a);for(const d of m)d===null?r.push("Not a file"):(c&&!S.current.has(d.type)&&r.push(d.name),_&&X&&d.size>X&&r.indexOf(d.name)===-1&&r.push(d.name));r.length?(C(!0),u.current&&u.current.value&&(u.current.value="")):(fe(m),N(m)),q(r)}function ye(a){a.preventDefault(),C(!1),u.current&&u.current.click()}function be(){W&&W()}function Ee(a){a.stopPropagation(),P(a.target.files||[]),u.current&&u.current.value&&(u.current.value="")}function Ue(a){a.preventDefault(),a.stopPropagation(),j(!0),C(!1)}function Se(a){a.preventDefault(),j(!0),C(!1)}function je(a){a.preventDefault(),j(!1)}function Ce(a){a.preventDefault(),a.stopPropagation(),j(!1),a.dataTransfer.items?P(Array.from(a.dataTransfer.items).map(r=>r.getAsFile())):P(a.dataTransfer.files)}return e.createElement("div",{onDrop:f?()=>{}:Ce,onDragOver:f?()=>{}:Ue,onDragLeave:f?()=>{}:je,onDragEnter:f?()=>{}:Se,className:F.cl($({active:we,mini:v,error:y,shown:_e,disabled:f}),de),...ce},e.createElement("div",{className:F.cl(Q({constrainContentWidth:o,disabled:f}))},s?e.createElement("div",null,e.createElement(F.Spinner,{size:"md","aria-hidden":"true"}),e.createElement("div",{className:R},w("design-system:fileUpload.processing",{defaultValue:"Processing Upload..."}))):e.createElement("div",null,e.createElement("div",{className:ee({mini:v,error:y,disabled:f}),"aria-hidden":"true"},e.createElement("img",{className:re,src:y?M.GENERAL_ERROR_LARGE:M.UPLOAD_LARGE,alt:"Upload Icon"})),e.createElement("div",{className:oe({mini:v})},y?e.createElement("div",null,w(k.length>1?"design-system:fileUpload.cancelled_plural":"design-system:fileUpload.cancelled",{defaultValue:k.length>1?"File Upload(s) Failed":"File Upload Failed"})):e.createElement("div",null,w("design-system:fileUpload.title",{description:H,defaultValue:`Upload your ${H}`}))),y?e.createElement("div",{className:ae},new Set(k.map((a,r)=>{const m=Math.floor(a.length/2);return e.createElement("div",{className:le,key:a},e.createElement("span",{className:L},a.substr(0,m)),e.createElement("div",{className:L},e.createElement("span",null,a.substr(m))),r<k.length-1?",":"")}))):e.createElement("span",null),e.createElement("div",{className:R},e.createElement("div",null,e.createElement("span",null,O[0]),f?e.createElement("u",null,O[1]):e.createElement("a",{href:"",onClick:ye},O[1]),e.createElement("span",null,O[2]))),e.createElement("div",{className:te},c?e.createElement("span",null,"("," ",w("design-system:fileUpload.acceptedTypes",{fileTypes:Z,defaultValue:`${Z} format accepted`})," ",")"):"",_?e.createElement("span",null,"( ",w("design-system:fileUpload.maximumSize",{size:_,defaultValue:`${_} maximum`})," )"):"",E?e.createElement("span",null," ",E," "):""),x&&e.createElement("div",{className:ie},e.createElement(A.Button,{disabled:f,kind:"link",icon:"download-cloud",onClick:be},x)))),t&&!s&&e.createElement("div",{className:ne},e.createElement(A.Button,{disabled:f,kind:"icon",icon:"x",title:w("design-system:fileUpload.close",{defaultValue:"Close"}),onClick:ge})),e.createElement("form",{className:se},e.createElement("input",{ref:u,type:"file",accept:ue||"*/*",multiple:l||void 0,onChange:Ee})))}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 pe={"File Upload":{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
+ (function(n,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react"),require("@sps-woodland/core"),require("@spscommerce/utils"),require("@sps-woodland/buttons"),require("@sps-woodland/illustrations")):typeof define=="function"&&define.amd?define(["exports","react","@sps-woodland/core","@spscommerce/utils","@sps-woodland/buttons","@sps-woodland/illustrations"],g):(n=typeof globalThis<"u"?globalThis:n||self,g(n.FileUpload={},n.React,n.core,n.utils,n.buttons,n.illustrations))})(this,function(n,g,F,p,A,M){"use strict";function J(o){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const l in o)if(l!=="default"){const t=Object.getOwnPropertyDescriptor(o,l);Object.defineProperty(i,l,t.get?t:{enumerable:!0,get:()=>o[l]})}}return i.default=o,Object.freeze(i)}const e=J(g),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 K(o,i,l){return i in o?Object.defineProperty(o,i,{value:l,enumerable:!0,configurable:!0,writable:!0}):o[i]=l,o}function B(o,i){var l=Object.keys(o);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(o);i&&(t=t.filter(function(s){return Object.getOwnPropertyDescriptor(o,s).enumerable})),l.push.apply(l,t)}return l}function I(o){for(var i=1;i<arguments.length;i++){var l=arguments[i]!=null?arguments[i]:{};i%2?B(Object(l),!0).forEach(function(t){K(o,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(l)):B(Object(l)).forEach(function(t){Object.defineProperty(o,t,Object.getOwnPropertyDescriptor(l,t))})}return o}var Y=(o,i,l)=>{for(var t of Object.keys(o)){var s;if(o[t]!==((s=i[t])!==null&&s!==void 0?s:l[t]))return!1}return!0},b=o=>i=>{var l=o.defaultClassName,t=I(I({},o.defaultVariants),i);for(var s in t){var v,x=(v=t[s])!==null&&v!==void 0?v:o.defaultVariants[s];if(x!=null){var c=x;typeof c=="boolean"&&(c=c===!0?"true":"false");var _=o.variantClassNames[s][c];_&&(l+=" "+_)}}for(var[E,N]of o.compoundVariants)Y(E,t,o.defaultVariants)&&(l+=" "+N);return l},$=b({defaultClassName:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw0",variantClassNames:{active:{true:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw1",false:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw2"},mini:{true:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw3",false:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw4"},error:{true:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw5",false:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw6"},shown:{true:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw7",false:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw8"},disabled:{true:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw9",false:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwa"}},defaultVariants:{active:!1,mini:!1,error:!1,shown:!0,disabled:!1},compoundVariants:[]}),Q=b({defaultClassName:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwb",variantClassNames:{constrainContentWidth:{true:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwc",false:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwd"},disabled:{true:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwe",false:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwf"}},defaultVariants:{constrainContentWidth:!1,disabled:!1},compoundVariants:[]}),R="pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwg",ee=b({defaultClassName:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwh",variantClassNames:{mini:{true:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwi",false:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwj"},error:{true:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwk",false:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwl"},disabled:{true:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwm",false:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwn"}},defaultVariants:{mini:!1,error:!1,disabled:!1},compoundVariants:[]}),oe=b({defaultClassName:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwo",variantClassNames:{mini:{true:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwp",false:"pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwq"}},defaultVariants:{mini:!1},compoundVariants:[]}),ae="pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwr",le="pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jws",L="pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwt",te="pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwu",ie="pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwv",ne="pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jww",se="pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwx",re="pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwy";function T({constrainContentWidth:o,description:i,multiple:l=!1,dismissable:t,processing:s,mini:v,downloadLabel:x,acceptExtensions:c,maxSize:_,customRequirement:E,onSelection:N,onDismiss:z,download:W,shown:U,className:de,disabled:f,children:De,...ce}){const S=e.useRef(new Set),[_e,G]=e.useState(U),[Te,fe]=e.useState([]),[ue,me]=e.useState(""),[X,he]=e.useState(),[we,j]=e.useState(!1),[y,C]=e.useState(!1),[k,q]=e.useState([]),[Z,ve]=e.useState(""),{t:w}=e.useContext(F.I18nContext),O=(l?w("design-system:fileUpload.instructions_plural",{defaultValue:"Drag and drop your files here or |browse for files| on your desktop."}):w("design-system:fileUpload.instructions",{defaultValue:"Drag and drop your file here or |browse for a file| on your desktop."})).split("|"),H=i||(l?"Files":"File"),u=e.useRef(null);e.useEffect(()=>{U&&G(U)},[U]),e.useEffect(()=>{_&&Fe(_)},[_]),e.useEffect(()=>{c&&xe(c)},[c]);function ge(){t&&(G(!1),z&&z())}function Fe(a){try{he(p.parseFileSize(a))}catch{throw new Error(`Could not parse "${a}" as a file size.`)}}function xe(a){const m=(Array.isArray(a)?a:a.trim().split(/\s?,\s?/)).map(h=>h.replace(/^\./,"")),d=m.map(h=>`.${h}`.toLowerCase());ve(d.map((h,D)=>D>0&&D===d.length-1?`or ${h}`:h).join(d.length>2?", ":" ")),S.current.clear();for(const h of m){const D=Object.keys(V).includes(h.toUpperCase())?V[h.toUpperCase()]:[];for(const ke of D)S.current.add(ke)}me(d.concat(Array.from(S.current)).join(","))}function P(a){q([]);let r=[];const m=Array.from(a);for(const d of m)d===null?r.push("Not a file"):(c&&!S.current.has(d.type)&&r.push(d.name),_&&X&&d.size>X&&r.indexOf(d.name)===-1&&r.push(d.name));r.length?(C(!0),u.current&&u.current.value&&(u.current.value="")):(fe(m),N(m)),q(r)}function ye(a){a.preventDefault(),C(!1),u.current&&u.current.click()}function be(){W&&W()}function Ee(a){a.stopPropagation(),P(a.target.files||[]),u.current&&u.current.value&&(u.current.value="")}function Ue(a){a.preventDefault(),a.stopPropagation(),j(!0),C(!1)}function Se(a){a.preventDefault(),j(!0),C(!1)}function je(a){a.preventDefault(),j(!1)}function Ce(a){a.preventDefault(),a.stopPropagation(),j(!1),a.dataTransfer.items?P(Array.from(a.dataTransfer.items).map(r=>r.getAsFile())):P(a.dataTransfer.files)}return e.createElement("div",{onDrop:f?()=>{}:Ce,onDragOver:f?()=>{}:Ue,onDragLeave:f?()=>{}:je,onDragEnter:f?()=>{}:Se,className:F.cl($({active:we,mini:v,error:y,shown:_e,disabled:f}),de),...ce},e.createElement("div",{className:F.cl(Q({constrainContentWidth:o,disabled:f}))},s?e.createElement("div",null,e.createElement(F.Spinner,{size:"md","aria-hidden":"true"}),e.createElement("div",{className:R},w("design-system:fileUpload.processing",{defaultValue:"Processing Upload..."}))):e.createElement("div",null,e.createElement("div",{className:ee({mini:v,error:y,disabled:f}),"aria-hidden":"true"},e.createElement("img",{className:re,src:y?M.GENERAL_ERROR_LARGE:M.UPLOAD_LARGE,alt:"Upload Icon"})),e.createElement("div",{className:oe({mini:v})},y?e.createElement("div",null,w(k.length>1?"design-system:fileUpload.cancelled_plural":"design-system:fileUpload.cancelled",{defaultValue:k.length>1?"File Upload(s) Failed":"File Upload Failed"})):e.createElement("div",null,w("design-system:fileUpload.title",{description:H,defaultValue:`Upload your ${H}`}))),y?e.createElement("div",{className:ae},new Set(k.map((a,r)=>{const m=Math.floor(a.length/2);return e.createElement("div",{className:le,key:a},e.createElement("span",{className:L},a.substr(0,m)),e.createElement("div",{className:L},e.createElement("span",null,a.substr(m))),r<k.length-1?",":"")}))):e.createElement("span",null),e.createElement("div",{className:R},e.createElement("div",null,e.createElement("span",null,O[0]),f?e.createElement("u",null,O[1]):e.createElement("a",{href:"",onClick:ye},O[1]),e.createElement("span",null,O[2]))),e.createElement("div",{className:te},c?e.createElement("span",null,"("," ",w("design-system:fileUpload.acceptedTypes",{fileTypes:Z,defaultValue:`${Z} format accepted`})," ",")"):"",_?e.createElement("span",null,"( ",w("design-system:fileUpload.maximumSize",{size:_,defaultValue:`${_} maximum`})," )"):"",E?e.createElement("span",null," ",E," "):""),x&&e.createElement("div",{className:ie},e.createElement(A.Button,{disabled:f,kind:"link",icon:"download-cloud",onClick:be},x)))),t&&!s&&e.createElement("div",{className:ne},e.createElement(A.Button,{disabled:f,kind:"icon",icon:"x",title:w("design-system:fileUpload.close",{defaultValue:"Close"}),onClick:ge})),e.createElement("form",{className:se},e.createElement("input",{ref:u,type:"file",accept:ue||"*/*",multiple:l||void 0,onChange:Ee})))}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 pe={"File Upload":{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() {
package/lib/style.css CHANGED
@@ -1 +1 @@
1
- .pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw0{border-width:.0625rem;border-style:dashed;border-radius:.25rem;display:block;padding:1rem;position:relative}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw1{background-color:#f4ecf2;border-color:#91467f;border-style:solid}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw3{padding:1rem}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw5{border-color:#de002e}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw8{display:none}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jw9{border-color:#d2d4d4}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwb{color:#4b5356;margin:0 auto;text-align:center}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwc{width:50%}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwe{color:#717779}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwg{font-size:.75rem;line-height:1.25rem}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwh{color:#717779;display:block;margin-bottom:1rem}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwi{font-size:1.5rem;line-height:1.5rem}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwj{font-size:3rem;line-height:3rem}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwk{color:#de002e}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwm{opacity:.5}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwo{font-weight:600;margin-bottom:.25rem}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwp{font-size:1rem;line-height:1.25rem}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwq{font-size:1.125rem;line-height:1.25rem}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwr{font-size:.875rem;font-weight:600;line-height:1.25rem}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jws{display:flex;justify-content:center;white-space:nowrap}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwt{max-width:50%;overflow:hidden}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwt:first-child{text-overflow:ellipsis}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwt:last-child{float:right}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwu{font-size:.75rem;line-height:1.125rem;margin-top:.25rem}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwu>span+span{margin-left:.125rem}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwv{margin-top:1rem}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jww{position:absolute;right:.5rem;top:.5rem}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwx{display:none}.pkg_sps-woodland_file-upload__version_8_33_5__hash_rh07jwy{height:3rem}
1
+ .pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw0{border-width:.0625rem;border-style:dashed;border-radius:.25rem;display:block;padding:1rem;position:relative}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw1{background-color:#f4ecf2;border-color:#91467f;border-style:solid}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw3{padding:1rem}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw5{border-color:#de002e}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw8{display:none}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jw9{border-color:#d2d4d4}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwb{color:#4b5356;margin:0 auto;text-align:center}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwc{width:50%}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwe{color:#717779}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwg{font-size:.75rem;line-height:1.25rem}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwh{color:#717779;display:block;margin-bottom:1rem}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwi{font-size:1.5rem;line-height:1.5rem}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwj{font-size:3rem;line-height:3rem}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwk{color:#de002e}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwm{opacity:.5}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwo{font-weight:600;margin-bottom:.25rem}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwp{font-size:1rem;line-height:1.25rem}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwq{font-size:1.125rem;line-height:1.25rem}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwr{font-size:.875rem;font-weight:600;line-height:1.25rem}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jws{display:flex;justify-content:center;white-space:nowrap}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwt{max-width:50%;overflow:hidden}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwt:first-child{text-overflow:ellipsis}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwt:last-child{float:right}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwu{font-size:.75rem;line-height:1.125rem;margin-top:.25rem}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwu>span+span{margin-left:.125rem}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwv{margin-top:1rem}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jww{position:absolute;right:.5rem;top:.5rem}.pkg_sps-woodland_file-upload__version_8_33_6__hash_rh07jwx{display:none}.pkg_sps-woodland_file-upload__version_8_33_6__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.33.5",
4
+ "version": "8.33.6",
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,12 +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.33.5",
34
- "@sps-woodland/tokens": "8.33.5",
35
- "@sps-woodland/core": "8.33.5",
36
- "@sps-woodland/illustrations": "8.33.5",
37
- "@spscommerce/ds-react": "8.33.5",
38
- "@spscommerce/ds-shared": "8.33.5"
33
+ "@sps-woodland/buttons": "8.33.6",
34
+ "@sps-woodland/core": "8.33.6",
35
+ "@sps-woodland/tokens": "8.33.6",
36
+ "@sps-woodland/illustrations": "8.33.6",
37
+ "@spscommerce/ds-react": "8.33.6",
38
+ "@spscommerce/ds-shared": "8.33.6"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@spscommerce/ds-illustrations": "^6.12.1",
@@ -44,13 +44,13 @@
44
44
  "@vanilla-extract/recipes": "^0.2.5",
45
45
  "react": "^16.14.0",
46
46
  "react-dom": "^16.14.0",
47
- "@sps-woodland/buttons": "8.33.5",
48
- "@sps-woodland/core": "8.33.5",
49
- "@sps-woodland/tokens": "8.33.5",
50
- "@spscommerce/ds-colors": "8.33.5",
51
- "@sps-woodland/illustrations": "8.33.5",
52
- "@spscommerce/ds-react": "8.33.5",
53
- "@spscommerce/ds-shared": "8.33.5"
47
+ "@sps-woodland/buttons": "8.33.6",
48
+ "@sps-woodland/core": "8.33.6",
49
+ "@sps-woodland/tokens": "8.33.6",
50
+ "@spscommerce/ds-colors": "8.33.6",
51
+ "@sps-woodland/illustrations": "8.33.6",
52
+ "@spscommerce/ds-react": "8.33.6",
53
+ "@spscommerce/ds-shared": "8.33.6"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "pnpm run build:js && pnpm run build:types",