@spscommerce/ds-web-components 4.34.0 → 4.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/components/file-upload/file-upload.d.ts +3 -0
- package/dist/lib/index.cjs.js +12 -12
- package/dist/lib/index.es.js +5 -5
- package/dist/package.json +1 -1
- package/lib/components/file-upload/file-upload.d.ts +3 -0
- package/lib/index.cjs.js +12 -12
- package/lib/index.es.js +5 -5
- package/package.json +5 -5
|
@@ -10,6 +10,7 @@ export declare class SpsFileUploadComponent extends HTMLElement {
|
|
|
10
10
|
downloadLabel: string;
|
|
11
11
|
acceptExtensions: string;
|
|
12
12
|
maxSize: string;
|
|
13
|
+
customRequirement: string;
|
|
13
14
|
selection: {
|
|
14
15
|
event: boolean;
|
|
15
16
|
type: string;
|
|
@@ -59,6 +60,8 @@ export declare class SpsFileUploadComponent extends HTMLElement {
|
|
|
59
60
|
acceptExtensions: string[] | string;
|
|
60
61
|
/** The maximum allowable size in bytes for files selected by the component. */
|
|
61
62
|
maxSize: string;
|
|
63
|
+
/** custom label in requirements place. */
|
|
64
|
+
customRequirement: string;
|
|
62
65
|
/**
|
|
63
66
|
* Event which emits when a file or files have been selected by the user. The
|
|
64
67
|
* event detail will be an array of Files.
|
package/dist/lib/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var T=require("@spscommerce/ds-shared"),l=require("@spscommerce/utils"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var T=require("@spscommerce/ds-shared"),l=require("@spscommerce/utils"),c={};Object.defineProperty(c,"__esModule",{value:!0});/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
4
4
|
*
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
29
29
|
* See the License for the specific language governing permissions and
|
|
30
30
|
* limitations under the License.
|
|
31
|
-
*/var ze=Object.prototype.hasOwnProperty;function
|
|
31
|
+
*/var ze=Object.prototype.hasOwnProperty;function pe(){}pe.prototype=Object.create(null);function We(e,t){return ze.call(e,t)}function ce(){return new pe}function Z(e,t){for(;e.length>t;)e.pop()}/**
|
|
32
32
|
* @license
|
|
33
33
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
34
34
|
*
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
44
44
|
* See the License for the specific language governing permissions and
|
|
45
45
|
* limitations under the License.
|
|
46
|
-
*/function He(e){if(e.lastIndexOf("xml:",0)===0)return"http://www.w3.org/XML/1998/namespace";if(e.lastIndexOf("xlink:",0)===0)return"http://www.w3.org/1999/xlink"}function de(e,t,s){if(s==null)e.removeAttribute(t);else{var n=He(t);n?e.setAttributeNS(n,t,String(s)):e.setAttribute(t,String(s))}}function he(e,t,s){e[t]=s}function
|
|
46
|
+
*/function He(e){if(e.lastIndexOf("xml:",0)===0)return"http://www.w3.org/XML/1998/namespace";if(e.lastIndexOf("xlink:",0)===0)return"http://www.w3.org/1999/xlink"}function de(e,t,s){if(s==null)e.removeAttribute(t);else{var n=He(t);n?e.setAttributeNS(n,t,String(s)):e.setAttribute(t,String(s))}}function he(e,t,s){e[t]=s}function qe(e,t,s){t.indexOf("-")>=0?e.setProperty(t,s):e[t]=s}function Ge(e,t,s){if(typeof s=="string")e.style.cssText=s;else{e.style.cssText="";var n=e.style;for(var i in s)We(s,i)&&qe(n,i,s[i])}}function Xe(e,t,s){var n=typeof s;n==="object"||n==="function"?he(e,t,s):de(e,t,s)}var U=ce();U[V.default]=Xe;U.style=Ge;function E(e,t,s){var n=U[t]||U[V.default];n(e,t,s)}/**
|
|
47
47
|
* @license
|
|
48
48
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
49
49
|
*
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
119
|
* See the License for the specific language governing permissions and
|
|
120
120
|
* limitations under the License.
|
|
121
|
-
*/var nt=function(){function e(t,s,n){this._attrsArr=null,this.staticsApplied=!1,this.nameOrCtor=t,this.key=s,this.text=n}return e.prototype.hasEmptyAttrsArr=function(){var t=this._attrsArr;return!t||!t.length},e.prototype.getAttrsArr=function(t){return this._attrsArr||(this._attrsArr=new Array(t))},e}();function Y(e,t,s,n){var i=new nt(t,s,n);return e.__incrementalDOMData=i,i}function
|
|
121
|
+
*/var nt=function(){function e(t,s,n){this._attrsArr=null,this.staticsApplied=!1,this.nameOrCtor=t,this.key=s,this.text=n}return e.prototype.hasEmptyAttrsArr=function(){var t=this._attrsArr;return!t||!t.length},e.prototype.getAttrsArr=function(t){return this._attrsArr||(this._attrsArr=new Array(t))},e}();function Y(e,t,s,n){var i=new nt(t,s,n);return e.__incrementalDOMData=i,i}function R(e,t){return me(e,t)}function it(e){return Boolean(e.__incrementalDOMData)}function at(e){return Qe(e.__incrementalDOMData),R(e).key}function me(e,t){if(e.__incrementalDOMData)return e.__incrementalDOMData;var s=J(e)?e.localName:e.nodeName,n=J(e)?e.getAttribute("key")||t:null,i=Je(e)?e.data:void 0,a=Y(e,s,n,i);return J(e)&&rt(e,a),a}function fe(e){me(e);for(var t=e.firstChild;t;t=t.nextSibling)fe(t)}function ge(e){e.__incrementalDOMData=null;for(var t=e.firstChild;t;t=t.nextSibling)ge(t)}function rt(e,t){var s=e.attributes,n=s.length;if(!!n)for(var i=t.getAttrsArr(n),a=0,o=0;a<n;a+=1,o+=2){var g=s[a],x=g.name,v=g.value;i[o]=x,i[o+1]=v}}/**
|
|
122
122
|
* @license
|
|
123
123
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
124
124
|
*
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
134
134
|
* See the License for the specific language governing permissions and
|
|
135
135
|
* limitations under the License.
|
|
136
|
-
*/function ot(e,t){return e==="svg"?"http://www.w3.org/2000/svg":e==="math"?"http://www.w3.org/1998/Math/MathML":t==null
|
|
136
|
+
*/function ot(e,t){return e==="svg"?"http://www.w3.org/2000/svg":e==="math"?"http://www.w3.org/1998/Math/MathML":t==null||R(t).nameOrCtor==="foreignObject"?null:t.namespaceURI}function lt(e,t,s,n){var i;if(typeof s=="function")i=new s;else{var a=ot(s,t);a?i=e.createElementNS(a,s):i=e.createElement(s)}return Y(i,s,n),i}function pt(e){var t=e.createTextNode("");return Y(t,"#text",null),t}/**
|
|
137
137
|
* @license
|
|
138
138
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
139
139
|
*
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
149
149
|
* See the License for the specific language governing permissions and
|
|
150
150
|
* limitations under the License.
|
|
151
|
-
*/var L=null,d=null,
|
|
151
|
+
*/var L=null,d=null,f=null,$=null,z=[],W=[];function H(){return W}function ve(e){var t=function(s,n,i){var a=L,o=$,g=z,x=W,v=d,S=f,m=!1;L=new Ve,$=s.ownerDocument,W=[],f=s.parentNode,z=tt(s,f);try{var C=e(s,n,i);return C}finally{$=o,W=x,d=v,f=S,z=g,L.notifyChanges(),Ke(m),L=a}};return t}var Ce=ve(function(e,t,s){return d=e,_e(),t(s),xe(),e}),ct=ve(function(e,t,s){var n={nextSibling:e},i=null,a=null;return d=n,t(s),f&&Se(f,q(),e.nextSibling),n===d?null:d});function be(e,t,s){var n=R(e,s);return t==n.nameOrCtor&&s==n.key}function dt(e,t,s){if(!e)return null;if(be(e,t,s))return e;if(s){for(;e=e.nextSibling;)if(be(e,t,s))return e}return null}function ht(e,t){var s;return e==="#text"?s=pt($):s=lt($,f,e,t),L.markCreated(s),s}function we(e,t){var s=dt(d,e,t),n=s||ht(e,t);n!==d&&(z.indexOf(n)>=0?st(f,n,d):f.insertBefore(n,d),d=n)}function Se(e,t,s){for(var n=e,i=t;i!==s;){var a=i.nextSibling;n.removeChild(i),L.markDeleted(i),i=a}}function _e(){f=d,d=null}function q(){return d?d.nextSibling:f.firstChild}function M(){d=q()}function xe(){Se(f,q(),null),d=f,f=f.parentNode}function Ne(e,t){return M(),we(e,t),_e(),f}function ye(){return xe(),d}function ut(){return M(),we("#text",null),d}function mt(){return f}function ft(){return q()}function gt(){d=f.lastChild}/**
|
|
152
152
|
* @license
|
|
153
153
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
154
154
|
*
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
164
164
|
* See the License for the specific language governing permissions and
|
|
165
165
|
* limitations under the License.
|
|
166
|
-
*/var Ae=3,_=
|
|
166
|
+
*/var Ae=3,_=ce();function vt(e,t,s){if(t.staticsApplied=!0,!(!s||!s.length)){if(t.hasEmptyAttrsArr()){for(var n=0;n<s.length;n+=2)E(e,s[n],s[n+1]);return}for(var n=0;n<s.length;n+=2)_[s[n]]=n+1;for(var i=t.getAttrsArr(0),a=0,n=0;n<i.length;n+=2){var o=i[n],g=i[n+1],x=_[o];if(x){s[x]===g&&delete _[o];continue}i[a]=o,i[a+1]=g,a+=2}Z(i,a);for(var o in _)E(e,o,s[_[o]]),delete _[o]}}function ee(e,t,s){for(var n=[],i=3;i<arguments.length;i++)n[i-3]=arguments[i];var a=Ne(e,t),o=R(a);o.staticsApplied||vt(a,o,s);var g=Math.max(0,arguments.length-Ae),x=o.hasEmptyAttrsArr();if(!g&&x)return a;for(var v=o.getAttrsArr(g),S=Ae,m=0;S<arguments.length;S+=2,m+=2){var C=arguments[S];if(x)v[m]=C;else if(v[m]!==C)break;var P=arguments[S+1];(x||v[m+1]!==P)&&(v[m+1]=P,E(a,C,P))}if(S<arguments.length||m<v.length){for(var je=m;m<v.length;m+=2)_[v[m]]=v[m+1];for(m=je;S<arguments.length;S+=2,m+=2){var C=arguments[S],P=arguments[S+1];_[C]!==P&&E(a,C,P),v[m]=C,v[m+1]=P,delete _[C]}Z(v,m);for(var C in _)E(a,C,void 0),delete _[C]}return a}function Ct(e,t,s){var n=H();n[0]=e,n[1]=t,n[2]=s}function bt(e){var t=H();t[1]=e}function wt(e,t){var s=H();s.push(e),s.push(t)}function St(){var e=H(),t=ee.apply(null,e);return Z(e,0),t}function Pe(e){var t=ye();return t}function _t(e,t,s){for(var n=[],i=3;i<arguments.length;i++)n[i-3]=arguments[i];return ee.apply(null,arguments),Pe()}function xt(e){for(var t=[],s=1;s<arguments.length;s++)t[s-1]=arguments[s];var n=ut(),i=R(n);if(i.text!==e){i.text=e;for(var a=e,o=1;o<arguments.length;o+=1){var g=arguments[o];a=g(a)}n.data=a}return n}/**
|
|
167
167
|
* @license
|
|
168
168
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
169
169
|
*
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
179
179
|
* See the License for the specific language governing permissions and
|
|
180
180
|
* limitations under the License.
|
|
181
|
-
*/p.applyAttr=de;p.applyProp=he;p.attributes=E;p.close=ye;var te=p.currentElement=ft,se=p.currentPointer=mt;p.open=Ne;var Nt=p.patch=Ce;p.patchInner=Ce;p.patchOuter=pt;p.skip=gt;var ne=p.skipNode=M;p.getKey=at;p.clearCache=ge;p.importNode=me;p.isDataInitialized=it;p.notifications=B;p.symbols=V;var Ie=p.attr=wt,yt=p.elementClose=Pe;p.elementOpen=ee;var At=p.elementOpenEnd=St,Pt=p.elementOpenStart=Ct;p.elementVoid=_t;var It=p.text=xt;p.key=bt;function De(e){let t=se();return t instanceof Comment&&t.data!==e?t.data=e:(t=document.createComment(e),te().appendChild(t)),ne(),t}let Oe=T.noI18nI18n;function Dt(e){Oe=e}function Ot(){return Oe}const I=Symbol("ComponentMetadata"),b=Object.freeze({has(e,t){return Boolean(e[I]&&Object.prototype.hasOwnProperty.call(e[I],t))},add(e,t){e[I]?Object.assign(e[I],t):e[I]=t},get(e,t,s){return e[I]&&e[I][t]||s}}),Fe=Symbol("ds-web-components:pragma:listeners-attached"),Le="idom-pragma:content-begin",ie="idom-pragma:content-end";function ae(e){for(const t of e)if(typeof t=="function")t();else if(typeof t=="string")It(t);else if(t instanceof Set)ae(Array.from(t));else if(Array.isArray(t)&&t.length>0){let s=se();if(De(Le),s===null){const n=te();for(let i=0;i<t.length;i+=1)n.contains(t[i])||n.appendChild(t[i]),ne()}for(;s&&s.data!==ie;)ne(),s=se();De(ie)}}function r(e,t,...s){if(t){for(const n of Object.keys(t))if(n.toUpperCase()==="DATA-FRAGMENT")return()=>ae(s)}return()=>{Pt(e);const n=[];if(t)for(const a of Object.keys(t))a.toUpperCase()==="CLASSNAME"?Ie("class",t[a]):/^on[A-Z]/.test(a)?n.push(a):Ie(a,t[a]);At(e);const i=te();if(!i[Fe]){for(const a of n)i.addEventListener(a.substr(2).toLowerCase(),t[a]);i[Fe]=!0}ae(s),yt(e)}}function ke(e,t){customElements.get(e)||customElements.define(e,t)}function Ft(...e){for(const t of e)ke(b.get(t,"tag"),t)}function Lt(e){return function(...s){for(const n of s){const i=`${e}${b.get(n,"tag").substr(3)}`;ke(i,n)}}}const re=Symbol("Component Attribute Bindings"),D=Symbol("Component Class Bindings"),q=Symbol("Component Style Bindings"),kt={__initialized:!1,__observer:null,__queuedUpdate:null,__managedClasses:new Set,__updateHostBindings(){const e=this;for(const t of Object.keys(e[re]||{}))e.setAttribute(t,e[re][t]);for(const t of Object.keys(e[q]||{}))e.style[t]=e[q][t];for(const t of e.__managedClasses)e.classList.remove(t);for(const t of(e[D]||[]).filter(Boolean))e.__managedClasses.add(t),e.classList.add(t);for(const t of(e.getAttribute("classname")||"").split(/\w+/).filter(Boolean))e.classList.add(t)},__updateChildQueries(e){const t=this;for(const s of b.get(t.constructor,"childQueries",[]))if(!e||e&&s.refresh){const n=s.all?t.querySelectorAll:t.querySelector;t[s.key]=n.call(t,s.selector)}},__gatherChildren(){const e=this;let t=Array.from(e.childNodes),s=null,n=t.length;for(let i=0;i<t.length;i+=1){const a=t[i];a instanceof Comment&&(a.data===Le?s=i+1:a.data===ie&&(n=i-1))}if(s===null)for(const i of t)i.parentNode.removeChild(i);else t=t.slice(s,n);b.has(e.constructor,"contentProp")&&(e[b.get(e.constructor,"contentProp")]=t)},__startMutObs(){const e=this;e.__observer||(e.__observer=new MutationObserver(()=>{e.contentChangedCallback&&e.contentChangedCallback(),e.__gatherChildren(),e.update()})),e.__observer.observe(e,{childList:!0})},__stopMutObs(){const e=this;e.__observer&&e.__observer.disconnect()},__doRender(){const e=this;e.__stopMutObs(),Nt(e,e.render(Ot())),e.__startMutObs()},update(){const e=this;e.__initialized&&!e.__queuedUpdate&&(e.__queuedUpdate=window.requestAnimationFrame(()=>{e.__doRender(),setTimeout(()=>{e.__updateChildQueries(!0),e.__updateHostBindings()},0),e.__queuedUpdate=null}))},attributeChangedCallback(e,t,s){const n=this,i=s===""?!0:s;i!==t&&(n.__cbAttributeChanged&&n.__cbAttributeChanged(e,n[e],i),e!=="style"&&(n[e]=i),n.__initialized&&n.update())},connectedCallback(){const e=this;e.__cbConnected&&e.__cbConnected();const t=b.get(e.constructor,"eventListeners",[]);setTimeout(()=>{if(!e.__initialized){e.__gatherChildren();for(const[,s]of t)e[s]=e[s].bind(e);e.__initialized=!0}for(const[s,n]of t)e.addEventListener(s,e[n]);e.__doRender(),setTimeout(()=>{e.__updateChildQueries(),e.__updateHostBindings()},0)},0)},disconnectedCallback(){const e=this;e.__cbDisconnected&&e.__cbDisconnected();for(const[t,s]of b.get(e.constructor,"eventListeners",[]))e.removeEventListener(t,e[s]);e.__stopMutObs()}};function O(e){return t=>{b.add(t,e),Object.assign(t.prototype,{__cbAttributeChanged:t.prototype.attributeChangedCallback,__cbConnected:t.prototype.connectedCallback,__cbDisconnected:t.prototype.disconnectedCallback},kt)}}function X(){return(e,t)=>{b.add(e.constructor,{contentProp:t})}}function K(e){return(t,s)=>{Object.defineProperty(t,s,{get(){return Object.defineProperty(this,s,{value:{dispatch:n=>{const i=new CustomEvent(e||s,{detail:n});return this.dispatchEvent(i),i}}}),this[s]},configurable:!0})}}function j(e){return(t,s)=>{const n=b.get(t.constructor,"eventListeners",[]);n.push([e,s]),b.add(t.constructor,{eventListeners:n})}}function c(e){return(t,s)=>{const n=t.constructor,i=s.toLowerCase();if(n.observedAttributes=n.observedAttributes||["classname","className","style"],n.observedAttributes.push(s),n.observedAttributes.push(i),i!==s&&Object.defineProperty(t,s,{get(){return this[i]},set(a){this[i]=a}}),e){const a=Symbol.for(s);Object.defineProperty(t,i,{get(){return this[a]},set(o){let g=o;e===Boolean&&typeof o=="string"&&o.toLowerCase()==="false"?g=!1:g=e(o),this[a]=g}})}}}function Te(e,t,s){return(n,i)=>{const a=b.get(n.constructor,"childQueries",[]);a.push({key:i,selector:e,all:s,refresh:t.refresh}),b.add(n.constructor,{childQueries:a})}}function Q(e,t={}){return Te(e,t)}function Ee(e,t={}){return Te(e,t,!0)}function oe(){return(e,t)=>{const s=Symbol(t);Object.defineProperties(e,{[s]:{writable:!0,enumerable:!1,configurable:!1,value:e[t]},[t]:{get(){return this[s]},set(n){this[s]!==n&&(this[s]=n,this.update())}}})}}exports.MIMEType=void 0;(function(e){e["7Z"]="application/x-7z-compressed",e.AAC="audio/aac",e.ABW="application/x-abiword",e.ARC="application/octet-stream",e.AVI="video/x-msvideo",e.AZW="application/vnd.amazon.ebook",e.BIN="application/octet-stream",e.BMP="image/bmp",e.BZ="application/x-bzip",e.BZ2="application/x-bzip2",e.CSH="application/x-csh",e.CSS="text/css",e.CSV="text/csv,application/vnd.ms-excel",e.DOC="application/msword",e.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",e.EOT="application/vnd.ms-fontobject",e.EPUB="application/epub+zip",e.ES="application/ecmascript",e.FLV="video/x-flv",e.GIF="image/gif",e.GZ="application/x-gzip",e.HTM="text/html",e.HTML="text/html",e.ICO="image/x-icon",e.ICS="text/calendar",e.JAR="application/java-archive",e.JPEG="image/jpeg",e.JPG="image/jpeg",e.JS="application/javascript",e.JSON="application/json",e.M3U="audio/x-mpequrl",e.MID="audio/midi",e.MIDI="audio/midi",e.MOV="video/quicktime",e.MP3="audio/mpeg3",e.MP4="video/mp4",e.MPEG="video/mpeg",e.MPKG="application/vnd.apple.installer+xml",e.ODP="application/vnd.oasis.opendocument.presentation",e.ODS="application/vnd.oasis.opendocument.spreadsheet",e.ODT="application/vnd.oasis.opendocument.text",e.OGA="audio/ogg",e.OGV="video/ogg",e.OGX="application/ogg",e.OTF="font/otf",e.PNG="image/png",e.PDF="application/pdf",e.PPT="application/vnd.ms-powerpoint",e.PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",e.RAR="application/x-rar-compressed",e.RTF="application/rtf",e.SH="application/x-sh",e.SVG="image/svg+xml",e.SWF="application/x-shockwave-flash",e.TAR="application/x-tar",e.TIF="image/tiff",e.TIFF="image/tiff",e.TS="application/typescript",e.TTF="font/ttf",e.TXT="text/plain",e.VSD="application/vnd.visio",e.WAV="audio/wav",e.WEBA="audio/webm",e.WEBM="video/webm",e.WEBP="image/webp",e.WOFF="font/woff",e.WOFF2="font/woff2",e.XHTML="application/xhtml+xml",e.XLS="application/vnd.ms-excel",e.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",e.XML="application/xml",e.XUL="application/vnd.mozilla.xul+xml",e.ZIP="application/zip"})(exports.MIMEType||(exports.MIMEType={}));var Tt=Object.defineProperty,Et=Object.getOwnPropertyDescriptor,u=(e,t,s,n)=>{for(var i=n>1?void 0:n?Et(t,s):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,s,i):o(i))||i);return n&&i&&Tt(t,s,i),i};const h="sps-file-upload";exports.SpsFileUploadComponent=class extends HTMLElement{constructor(){super();this.shown=!0,this.files=[],this.acceptMIMETypes=new Set,this.active=!1,this.error=!1,this.namesOfUnsupportedFiles=[],this.handleBrowseLinkClick=this.handleBrowseLinkClick.bind(this),this.handleDownloadButtonClick=this.handleDownloadButtonClick.bind(this),this.handleFileInputChange=this.handleFileInputChange.bind(this),this.dismiss=this.dismiss.bind(this)}get[D](){return[h,this.active&&`${h}--active`,this.error&&`${h}--error`,!this.shown&&`${h}--hidden`,this.mini&&`${h}--mini`,this.constrainContentWidth&&`${h}--constrained-content-width`]}connectedCallback(){this.description=this.description||(this.multiple?"Files":"File"),this.acceptExtensions&&this.processAcceptExtensions(this.acceptExtensions),this.maxSize&&this.parseAndValidateMaxSize(this.maxSize)}attributeChangedCallback(e,t,s){e==="acceptExtensions"&&this.processAcceptExtensions(s),e==="maxSize"&&this.parseAndValidateMaxSize(s)}dismiss(){this.dismissable&&(this.shown=!1,this.update(),this.dismissal.dispatch())}show(){this.dismissable&&(this.shown=!0,this.update())}render({t:e}){const t=this.error?T.SpsIcon.EXCLAMATION_CIRCLE:T.SpsIcon.UPLOAD_CLOUD,s=(this.multiple?e("design-system:fileUpload.instructions_plural"):e("design-system:fileUpload.instructions")).split("|");return r("div",{"data-fragment":!0},r("div",{className:`${h}__content`},this.processing?r("div",{"data-fragment":!0},r("i",{className:"sps-spinner sps-spinner--medium","aria-hidden":"true"}),r("div",{className:`${h}__instructions`},e("design-system:fileUpload.processing"))):r("div",{"data-fragment":!0},r("i",{className:`sps-icon sps-icon-${t} ${h}__icon-primary`,"aria-hidden":"true"}),r("div",{className:`${h}__title`},this.error?r("div",{"data-fragment":!0},e(this.namesOfUnsupportedFiles.length>1?"design-system:fileUpload.cancelled_plural":"design-system:fileUpload.cancelled")):r("div",{"data-fragment":!0},e("design-system:fileUpload.title",{description:this.description}))),this.error?r("div",{className:`${h}__errored-files`},new Set(this.namesOfUnsupportedFiles.map((n,i)=>{const a=Math.floor(n.length/2);return r("div",{className:`${h}__errored-filename`,key:n},r("span",{className:`${h}__errored-filename-segment`},n.substr(0,a)),r("div",{className:`${h}__errored-filename-segment`},r("span",null,n.substr(a))),i<this.namesOfUnsupportedFiles.length-1?",":"")}))):r("span",null),r("div",{className:`${h}__instructions`},r("div",{"data-fragment":!0},r("span",null,s[0]),r("a",{href:"",onClick:this.handleBrowseLinkClick},s[1]),r("span",null,s[2]))),r("div",{className:`${h}__requirements`},this.acceptExtensions?r("div",{"data-fragment":!0},"("," ",e("design-system:fileUpload.acceptedTypes",{fileTypes:this.acceptExtensionsDescription})," ",")"):"",this.maxSize?r("div",{"data-fragment":!0},"(",e("design-system:fileUpload.maximumSize",{size:this.maxSize})," ",")"):""),this.downloadLabel&&r("div",{className:`sps-button sps-button--link ${h}__download-button`,onClick:this.handleDownloadButtonClick},r("button",{type:"button"},r("i",{className:"sps-icon sps-icon-download-cloud","aria-hidden":"true"})," ",this.downloadLabel)))),this.dismissable&&!this.processing&&r("div",{className:`sps-button sps-button--icon ${h}__close-button`,onClick:this.dismiss},r("button",{type:"button",title:e("design-system:fileUpload.close")},r("i",{className:"sps-icon sps-icon-x","aria-hidden":"true"}))),r("form",null,r("input",{type:"file",accept:this.accept||"*/*",multiple:this.multiple||null,onChange:this.handleFileInputChange})))}parseAndValidateMaxSize(e){try{this.maxSizeBytes=l.parseFileSize(e)}catch{throw new Error(`Could not parse "${e}" as a file size.`)}}processAcceptExtensions(e){const s=(Array.isArray(e)?e:e.trim().split(/\s?,\s?/)).map(i=>i.replace(/^\./,"")),n=s.map(i=>`.${i}`.toLowerCase());this.acceptExtensionsDescription=n.map((i,a)=>a>0&&a===n.length-1?`or ${i}`:i).join(n.length>2?", ":" "),this.acceptMIMETypes.clear();for(const i of s)for(const a of exports.MIMEType[i.toUpperCase()].split(","))this.acceptMIMETypes.add(a);this.accept=n.concat(Array.from(this.acceptMIMETypes)).join(",")}selectFiles(e){this.namesOfUnsupportedFiles=[];const t=Array.from(e);for(const s of t)this.acceptExtensions&&!this.acceptMIMETypes.has(s.type)&&this.namesOfUnsupportedFiles.push(s.name),this.maxSize&&s.size>this.maxSizeBytes&&this.namesOfUnsupportedFiles.push(s.name);this.namesOfUnsupportedFiles.length?(this.error=!0,this.fileInput.value=null,this.update()):(this.files=t,this.selection.dispatch(t))}handleDragOver(e){e.preventDefault(),e.stopPropagation()}handleDragEnter(e){e.preventDefault(),this.active=!0,this.error=!1,this.update()}handleDragLeave(e){e.preventDefault(),this.active=!1,this.update()}handleDrop(e){e.preventDefault(),e.stopPropagation(),this.active=!1,e.dataTransfer.items?this.selectFiles(Array.from(e.dataTransfer.items).map(t=>t.getAsFile())):this.selectFiles(e.dataTransfer.files),this.update()}handleBrowseLinkClick(e){e.preventDefault(),this.error=!1,this.update(),this.fileInput.click()}handleDownloadButtonClick(){this.download.dispatch()}handleFileInputChange(e){e.stopPropagation(),this.selectFiles(e.target.files)}};exports.SpsFileUploadComponent.displayName=h;exports.SpsFileUploadComponent.props={description:"string",multiple:"boolean",dismissable:"boolean",processing:"boolean",mini:"boolean",downloadLabel:"string",acceptExtensions:"Array<string> | string",maxSize:"string",selection:{event:!0,type:"CustomEvent<Array<File>>"},dismissal:{event:!0,type:"CustomEvent<void>"},download:{event:!0,type:"CustomEvent<void>"}};u([c()],exports.SpsFileUploadComponent.prototype,"description",2);u([c(Boolean)],exports.SpsFileUploadComponent.prototype,"multiple",2);u([c(Boolean)],exports.SpsFileUploadComponent.prototype,"shown",2);u([c(Boolean)],exports.SpsFileUploadComponent.prototype,"dismissable",2);u([c(Boolean)],exports.SpsFileUploadComponent.prototype,"processing",2);u([c(Boolean)],exports.SpsFileUploadComponent.prototype,"mini",2);u([c(Boolean)],exports.SpsFileUploadComponent.prototype,"constrainContentWidth",2);u([c()],exports.SpsFileUploadComponent.prototype,"downloadLabel",2);u([c()],exports.SpsFileUploadComponent.prototype,"acceptExtensions",2);u([c()],exports.SpsFileUploadComponent.prototype,"maxSize",2);u([K()],exports.SpsFileUploadComponent.prototype,"selection",2);u([K()],exports.SpsFileUploadComponent.prototype,"dismissal",2);u([K()],exports.SpsFileUploadComponent.prototype,"download",2);u([Q("input[type='file']")],exports.SpsFileUploadComponent.prototype,"fileInput",2);u([j("dragover")],exports.SpsFileUploadComponent.prototype,"handleDragOver",1);u([j("dragenter")],exports.SpsFileUploadComponent.prototype,"handleDragEnter",1);u([j("dragleave")],exports.SpsFileUploadComponent.prototype,"handleDragLeave",1);u([j("drop")],exports.SpsFileUploadComponent.prototype,"handleDrop",1);exports.SpsFileUploadComponent=u([O({tag:h})],exports.SpsFileUploadComponent);const Ue={basic:{label:"Basic File Upload",description:l.code`
|
|
181
|
+
*/c.applyAttr=de;c.applyProp=he;c.attributes=U;c.close=ye;var te=c.currentElement=mt,se=c.currentPointer=ft;c.open=Ne;var Nt=c.patch=Ce;c.patchInner=Ce;c.patchOuter=ct;c.skip=gt;var ne=c.skipNode=M;c.getKey=at;c.clearCache=ge;c.importNode=fe;c.isDataInitialized=it;c.notifications=B;c.symbols=V;var Ie=c.attr=wt,yt=c.elementClose=Pe;c.elementOpen=ee;var At=c.elementOpenEnd=St,Pt=c.elementOpenStart=Ct;c.elementVoid=_t;var It=c.text=xt;c.key=bt;function De(e){let t=se();return t instanceof Comment&&t.data!==e?t.data=e:(t=document.createComment(e),te().appendChild(t)),ne(),t}let Oe=T.noI18nI18n;function Dt(e){Oe=e}function Ot(){return Oe}const I=Symbol("ComponentMetadata"),b=Object.freeze({has(e,t){return Boolean(e[I]&&Object.prototype.hasOwnProperty.call(e[I],t))},add(e,t){e[I]?Object.assign(e[I],t):e[I]=t},get(e,t,s){return e[I]&&e[I][t]||s}}),Fe=Symbol("ds-web-components:pragma:listeners-attached"),Le="idom-pragma:content-begin",ie="idom-pragma:content-end";function ae(e){for(const t of e)if(typeof t=="function")t();else if(typeof t=="string")It(t);else if(t instanceof Set)ae(Array.from(t));else if(Array.isArray(t)&&t.length>0){let s=se();if(De(Le),s===null){const n=te();for(let i=0;i<t.length;i+=1)n.contains(t[i])||n.appendChild(t[i]),ne()}for(;s&&s.data!==ie;)ne(),s=se();De(ie)}}function r(e,t,...s){if(t){for(const n of Object.keys(t))if(n.toUpperCase()==="DATA-FRAGMENT")return()=>ae(s)}return()=>{Pt(e);const n=[];if(t)for(const a of Object.keys(t))a.toUpperCase()==="CLASSNAME"?Ie("class",t[a]):/^on[A-Z]/.test(a)?n.push(a):Ie(a,t[a]);At(e);const i=te();if(!i[Fe]){for(const a of n)i.addEventListener(a.substr(2).toLowerCase(),t[a]);i[Fe]=!0}ae(s),yt(e)}}function ke(e,t){customElements.get(e)||customElements.define(e,t)}function Ft(...e){for(const t of e)ke(b.get(t,"tag"),t)}function Lt(e){return function(...s){for(const n of s){const i=`${e}${b.get(n,"tag").substr(3)}`;ke(i,n)}}}const re=Symbol("Component Attribute Bindings"),D=Symbol("Component Class Bindings"),G=Symbol("Component Style Bindings"),kt={__initialized:!1,__observer:null,__queuedUpdate:null,__managedClasses:new Set,__updateHostBindings(){const e=this;for(const t of Object.keys(e[re]||{}))e.setAttribute(t,e[re][t]);for(const t of Object.keys(e[G]||{}))e.style[t]=e[G][t];for(const t of e.__managedClasses)e.classList.remove(t);for(const t of(e[D]||[]).filter(Boolean))e.__managedClasses.add(t),e.classList.add(t);for(const t of(e.getAttribute("classname")||"").split(/\w+/).filter(Boolean))e.classList.add(t)},__updateChildQueries(e){const t=this;for(const s of b.get(t.constructor,"childQueries",[]))if(!e||e&&s.refresh){const n=s.all?t.querySelectorAll:t.querySelector;t[s.key]=n.call(t,s.selector)}},__gatherChildren(){const e=this;let t=Array.from(e.childNodes),s=null,n=t.length;for(let i=0;i<t.length;i+=1){const a=t[i];a instanceof Comment&&(a.data===Le?s=i+1:a.data===ie&&(n=i-1))}if(s===null)for(const i of t)i.parentNode.removeChild(i);else t=t.slice(s,n);b.has(e.constructor,"contentProp")&&(e[b.get(e.constructor,"contentProp")]=t)},__startMutObs(){const e=this;e.__observer||(e.__observer=new MutationObserver(()=>{e.contentChangedCallback&&e.contentChangedCallback(),e.__gatherChildren(),e.update()})),e.__observer.observe(e,{childList:!0})},__stopMutObs(){const e=this;e.__observer&&e.__observer.disconnect()},__doRender(){const e=this;e.__stopMutObs(),Nt(e,e.render(Ot())),e.__startMutObs()},update(){const e=this;e.__initialized&&!e.__queuedUpdate&&(e.__queuedUpdate=window.requestAnimationFrame(()=>{e.__doRender(),setTimeout(()=>{e.__updateChildQueries(!0),e.__updateHostBindings()},0),e.__queuedUpdate=null}))},attributeChangedCallback(e,t,s){const n=this,i=s===""?!0:s;i!==t&&(n.__cbAttributeChanged&&n.__cbAttributeChanged(e,n[e],i),e!=="style"&&(n[e]=i),n.__initialized&&n.update())},connectedCallback(){const e=this;e.__cbConnected&&e.__cbConnected();const t=b.get(e.constructor,"eventListeners",[]);setTimeout(()=>{if(!e.__initialized){e.__gatherChildren();for(const[,s]of t)e[s]=e[s].bind(e);e.__initialized=!0}for(const[s,n]of t)e.addEventListener(s,e[n]);e.__doRender(),setTimeout(()=>{e.__updateChildQueries(),e.__updateHostBindings()},0)},0)},disconnectedCallback(){const e=this;e.__cbDisconnected&&e.__cbDisconnected();for(const[t,s]of b.get(e.constructor,"eventListeners",[]))e.removeEventListener(t,e[s]);e.__stopMutObs()}};function O(e){return t=>{b.add(t,e),Object.assign(t.prototype,{__cbAttributeChanged:t.prototype.attributeChangedCallback,__cbConnected:t.prototype.connectedCallback,__cbDisconnected:t.prototype.disconnectedCallback},kt)}}function X(){return(e,t)=>{b.add(e.constructor,{contentProp:t})}}function K(e){return(t,s)=>{Object.defineProperty(t,s,{get(){return Object.defineProperty(this,s,{value:{dispatch:n=>{const i=new CustomEvent(e||s,{detail:n});return this.dispatchEvent(i),i}}}),this[s]},configurable:!0})}}function j(e){return(t,s)=>{const n=b.get(t.constructor,"eventListeners",[]);n.push([e,s]),b.add(t.constructor,{eventListeners:n})}}function p(e){return(t,s)=>{const n=t.constructor,i=s.toLowerCase();if(n.observedAttributes=n.observedAttributes||["classname","className","style"],n.observedAttributes.push(s),n.observedAttributes.push(i),i!==s&&Object.defineProperty(t,s,{get(){return this[i]},set(a){this[i]=a}}),e){const a=Symbol.for(s);Object.defineProperty(t,i,{get(){return this[a]},set(o){let g=o;e===Boolean&&typeof o=="string"&&o.toLowerCase()==="false"?g=!1:g=e(o),this[a]=g}})}}}function Te(e,t,s){return(n,i)=>{const a=b.get(n.constructor,"childQueries",[]);a.push({key:i,selector:e,all:s,refresh:t.refresh}),b.add(n.constructor,{childQueries:a})}}function Q(e,t={}){return Te(e,t)}function Ue(e,t={}){return Te(e,t,!0)}function oe(){return(e,t)=>{const s=Symbol(t);Object.defineProperties(e,{[s]:{writable:!0,enumerable:!1,configurable:!1,value:e[t]},[t]:{get(){return this[s]},set(n){this[s]!==n&&(this[s]=n,this.update())}}})}}exports.MIMEType=void 0;(function(e){e["7Z"]="application/x-7z-compressed",e.AAC="audio/aac",e.ABW="application/x-abiword",e.ARC="application/octet-stream",e.AVI="video/x-msvideo",e.AZW="application/vnd.amazon.ebook",e.BIN="application/octet-stream",e.BMP="image/bmp",e.BZ="application/x-bzip",e.BZ2="application/x-bzip2",e.CSH="application/x-csh",e.CSS="text/css",e.CSV="text/csv,application/vnd.ms-excel",e.DOC="application/msword",e.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",e.EOT="application/vnd.ms-fontobject",e.EPUB="application/epub+zip",e.ES="application/ecmascript",e.FLV="video/x-flv",e.GIF="image/gif",e.GZ="application/x-gzip",e.HTM="text/html",e.HTML="text/html",e.ICO="image/x-icon",e.ICS="text/calendar",e.JAR="application/java-archive",e.JPEG="image/jpeg",e.JPG="image/jpeg",e.JS="application/javascript",e.JSON="application/json",e.M3U="audio/x-mpequrl",e.MID="audio/midi",e.MIDI="audio/midi",e.MOV="video/quicktime",e.MP3="audio/mpeg3",e.MP4="video/mp4",e.MPEG="video/mpeg",e.MPKG="application/vnd.apple.installer+xml",e.ODP="application/vnd.oasis.opendocument.presentation",e.ODS="application/vnd.oasis.opendocument.spreadsheet",e.ODT="application/vnd.oasis.opendocument.text",e.OGA="audio/ogg",e.OGV="video/ogg",e.OGX="application/ogg",e.OTF="font/otf",e.PNG="image/png",e.PDF="application/pdf",e.PPT="application/vnd.ms-powerpoint",e.PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",e.RAR="application/x-rar-compressed",e.RTF="application/rtf",e.SH="application/x-sh",e.SVG="image/svg+xml",e.SWF="application/x-shockwave-flash",e.TAR="application/x-tar",e.TIF="image/tiff",e.TIFF="image/tiff",e.TS="application/typescript",e.TTF="font/ttf",e.TXT="text/plain",e.VSD="application/vnd.visio",e.WAV="audio/wav",e.WEBA="audio/webm",e.WEBM="video/webm",e.WEBP="image/webp",e.WOFF="font/woff",e.WOFF2="font/woff2",e.XHTML="application/xhtml+xml",e.XLS="application/vnd.ms-excel",e.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",e.XML="application/xml",e.XUL="application/vnd.mozilla.xul+xml",e.ZIP="application/zip"})(exports.MIMEType||(exports.MIMEType={}));var Tt=Object.defineProperty,Ut=Object.getOwnPropertyDescriptor,h=(e,t,s,n)=>{for(var i=n>1?void 0:n?Ut(t,s):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,s,i):o(i))||i);return n&&i&&Tt(t,s,i),i};const u="sps-file-upload";exports.SpsFileUploadComponent=class extends HTMLElement{constructor(){super();this.shown=!0,this.files=[],this.acceptMIMETypes=new Set,this.active=!1,this.error=!1,this.namesOfUnsupportedFiles=[],this.handleBrowseLinkClick=this.handleBrowseLinkClick.bind(this),this.handleDownloadButtonClick=this.handleDownloadButtonClick.bind(this),this.handleFileInputChange=this.handleFileInputChange.bind(this),this.dismiss=this.dismiss.bind(this)}get[D](){return[u,this.active&&`${u}--active`,this.error&&`${u}--error`,!this.shown&&`${u}--hidden`,this.mini&&`${u}--mini`,this.constrainContentWidth&&`${u}--constrained-content-width`]}connectedCallback(){this.description=this.description||(this.multiple?"Files":"File"),this.acceptExtensions&&this.processAcceptExtensions(this.acceptExtensions),this.maxSize&&this.parseAndValidateMaxSize(this.maxSize)}attributeChangedCallback(e,t,s){e==="acceptExtensions"&&this.processAcceptExtensions(s),e==="maxSize"&&this.parseAndValidateMaxSize(s)}dismiss(){this.dismissable&&(this.shown=!1,this.update(),this.dismissal.dispatch())}show(){this.dismissable&&(this.shown=!0,this.update())}render({t:e}){const t=this.error?T.SpsIcon.EXCLAMATION_CIRCLE:T.SpsIcon.UPLOAD_CLOUD,s=(this.multiple?e("design-system:fileUpload.instructions_plural"):e("design-system:fileUpload.instructions")).split("|");return r("div",{"data-fragment":!0},r("div",{className:`${u}__content`},this.processing?r("div",{"data-fragment":!0},r("i",{className:"sps-spinner sps-spinner--medium","aria-hidden":"true"}),r("div",{className:`${u}__instructions`},e("design-system:fileUpload.processing"))):r("div",{"data-fragment":!0},r("i",{className:`sps-icon sps-icon-${t} ${u}__icon-primary`,"aria-hidden":"true"}),r("div",{className:`${u}__title`},this.error?r("div",{"data-fragment":!0},e(this.namesOfUnsupportedFiles.length>1?"design-system:fileUpload.cancelled_plural":"design-system:fileUpload.cancelled")):r("div",{"data-fragment":!0},e("design-system:fileUpload.title",{description:this.description}))),this.error?r("div",{className:`${u}__errored-files`},new Set(this.namesOfUnsupportedFiles.map((n,i)=>{const a=Math.floor(n.length/2);return r("div",{className:`${u}__errored-filename`,key:n},r("span",{className:`${u}__errored-filename-segment`},n.substr(0,a)),r("div",{className:`${u}__errored-filename-segment`},r("span",null,n.substr(a))),i<this.namesOfUnsupportedFiles.length-1?",":"")}))):r("span",null),r("div",{className:`${u}__instructions`},r("div",{"data-fragment":!0},r("span",null,s[0]),r("a",{href:"",onClick:this.handleBrowseLinkClick},s[1]),r("span",null,s[2]))),r("div",{className:`${u}__requirements`},this.acceptExtensions?r("span",null,"("," ",e("design-system:fileUpload.acceptedTypes",{fileTypes:this.acceptExtensionsDescription})," ",")"):"",this.maxSize?r("span",null,"("," ",e("design-system:fileUpload.maximumSize",{size:this.maxSize})," ",")"):"",this.customRequirement?r("span",null," ",this.customRequirement," "):""),this.downloadLabel&&r("div",{className:`sps-button sps-button--link ${u}__download-button`,onClick:this.handleDownloadButtonClick},r("button",{type:"button"},r("i",{className:"sps-icon sps-icon-download-cloud","aria-hidden":"true"})," ",this.downloadLabel)))),this.dismissable&&!this.processing&&r("div",{className:`sps-button sps-button--icon ${u}__close-button`,onClick:this.dismiss},r("button",{type:"button",title:e("design-system:fileUpload.close")},r("i",{className:"sps-icon sps-icon-x","aria-hidden":"true"}))),r("form",null,r("input",{type:"file",accept:this.accept||"*/*",multiple:this.multiple||null,onChange:this.handleFileInputChange})))}parseAndValidateMaxSize(e){try{this.maxSizeBytes=l.parseFileSize(e)}catch{throw new Error(`Could not parse "${e}" as a file size.`)}}processAcceptExtensions(e){const s=(Array.isArray(e)?e:e.trim().split(/\s?,\s?/)).map(i=>i.replace(/^\./,"")),n=s.map(i=>`.${i}`.toLowerCase());this.acceptExtensionsDescription=n.map((i,a)=>a>0&&a===n.length-1?`or ${i}`:i).join(n.length>2?", ":" "),this.acceptMIMETypes.clear();for(const i of s)for(const a of exports.MIMEType[i.toUpperCase()].split(","))this.acceptMIMETypes.add(a);this.accept=n.concat(Array.from(this.acceptMIMETypes)).join(",")}selectFiles(e){this.namesOfUnsupportedFiles=[];const t=Array.from(e);for(const s of t)this.acceptExtensions&&!this.acceptMIMETypes.has(s.type)&&this.namesOfUnsupportedFiles.push(s.name),this.maxSize&&s.size>this.maxSizeBytes&&this.namesOfUnsupportedFiles.push(s.name);this.namesOfUnsupportedFiles.length?(this.error=!0,this.fileInput.value=null,this.update()):(this.files=t,this.selection.dispatch(t))}handleDragOver(e){e.preventDefault(),e.stopPropagation()}handleDragEnter(e){e.preventDefault(),this.active=!0,this.error=!1,this.update()}handleDragLeave(e){e.preventDefault(),this.active=!1,this.update()}handleDrop(e){e.preventDefault(),e.stopPropagation(),this.active=!1,e.dataTransfer.items?this.selectFiles(Array.from(e.dataTransfer.items).map(t=>t.getAsFile())):this.selectFiles(e.dataTransfer.files),this.update()}handleBrowseLinkClick(e){e.preventDefault(),this.error=!1,this.update(),this.fileInput.click()}handleDownloadButtonClick(){this.download.dispatch()}handleFileInputChange(e){e.stopPropagation(),this.selectFiles(e.target.files)}};exports.SpsFileUploadComponent.displayName=u;exports.SpsFileUploadComponent.props={description:"string",multiple:"boolean",dismissable:"boolean",processing:"boolean",mini:"boolean",downloadLabel:"string",acceptExtensions:"Array<string> | string",maxSize:"string",customRequirement:"string",selection:{event:!0,type:"CustomEvent<Array<File>>"},dismissal:{event:!0,type:"CustomEvent<void>"},download:{event:!0,type:"CustomEvent<void>"}};h([p()],exports.SpsFileUploadComponent.prototype,"description",2);h([p(Boolean)],exports.SpsFileUploadComponent.prototype,"multiple",2);h([p(Boolean)],exports.SpsFileUploadComponent.prototype,"shown",2);h([p(Boolean)],exports.SpsFileUploadComponent.prototype,"dismissable",2);h([p(Boolean)],exports.SpsFileUploadComponent.prototype,"processing",2);h([p(Boolean)],exports.SpsFileUploadComponent.prototype,"mini",2);h([p(Boolean)],exports.SpsFileUploadComponent.prototype,"constrainContentWidth",2);h([p()],exports.SpsFileUploadComponent.prototype,"downloadLabel",2);h([p()],exports.SpsFileUploadComponent.prototype,"acceptExtensions",2);h([p()],exports.SpsFileUploadComponent.prototype,"maxSize",2);h([p()],exports.SpsFileUploadComponent.prototype,"customRequirement",2);h([K()],exports.SpsFileUploadComponent.prototype,"selection",2);h([K()],exports.SpsFileUploadComponent.prototype,"dismissal",2);h([K()],exports.SpsFileUploadComponent.prototype,"download",2);h([Q("input[type='file']")],exports.SpsFileUploadComponent.prototype,"fileInput",2);h([j("dragover")],exports.SpsFileUploadComponent.prototype,"handleDragOver",1);h([j("dragenter")],exports.SpsFileUploadComponent.prototype,"handleDragEnter",1);h([j("dragleave")],exports.SpsFileUploadComponent.prototype,"handleDragLeave",1);h([j("drop")],exports.SpsFileUploadComponent.prototype,"handleDrop",1);exports.SpsFileUploadComponent=h([O({tag:u})],exports.SpsFileUploadComponent);const Ee={basic:{label:"Basic File Upload",description:l.code`
|
|
182
182
|
<p>Simply allow the user to drag-and-drop or select either a single file or multiple files at once.</p>
|
|
183
183
|
`,examples:{single:{description:"<p>Single file upload</p>",react:l.code`
|
|
184
184
|
function Component() {
|
|
@@ -428,7 +428,7 @@
|
|
|
428
428
|
</div>
|
|
429
429
|
)
|
|
430
430
|
}
|
|
431
|
-
`}}}};var
|
|
431
|
+
`}}}};var Et=Object.defineProperty,Bt=Object.getOwnPropertyDescriptor,F=(e,t,s,n)=>{for(var i=n>1?void 0:n?Bt(t,s):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,s,i):o(i))||i);return n&&i&&Et(t,s,i),i};exports.SpsNavTabComponent=class extends HTMLElement{constructor(){super(...arguments);this.active=!1,this.label="",this.tag=""}get[D](){return["sps-tabbed-nav__nav-item",this.active&&"sps-tabbed-nav__nav-item--active"]}render(){return r("a",{href:this.href,target:this.target,className:"sps-tabbed-nav__nav-item-link",tabIndex:0},this.icon&&r("i",{className:`sps-icon sps-icon-${this.icon}`}),this.label&&r("span",null,this.label),this.tag&&r("span",{className:"sps-tag sps-tag--default"},this.tag))}};exports.SpsNavTabComponent.displayName="sps-nav-tab";exports.SpsNavTabComponent.props={active:"boolean",label:"string",icon:"SpsIcon",tag:"string",href:"string",target:"string"};F([p()],exports.SpsNavTabComponent.prototype,"active",2);F([p()],exports.SpsNavTabComponent.prototype,"label",2);F([p()],exports.SpsNavTabComponent.prototype,"icon",2);F([p()],exports.SpsNavTabComponent.prototype,"tag",2);F([p()],exports.SpsNavTabComponent.prototype,"href",2);F([p()],exports.SpsNavTabComponent.prototype,"target",2);exports.SpsNavTabComponent=F([O({tag:"sps-nav-tab"})],exports.SpsNavTabComponent);var Rt=Object.defineProperty,$t=Object.getOwnPropertyDescriptor,Be=(e,t,s,n)=>{for(var i=n>1?void 0:n?$t(t,s):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,s,i):o(i))||i);return n&&i&&Rt(t,s,i),i};exports.SpsNavTabSetComponent=class extends HTMLElement{constructor(){super(...arguments);this.content=[]}render(){return r("nav",{className:"sps-tabbed-nav"},this.content)}};exports.SpsNavTabSetComponent.displayName="sps-nav-tab-set";exports.SpsNavTabSetComponent.props={};Be([X()],exports.SpsNavTabSetComponent.prototype,"content",2);exports.SpsNavTabSetComponent=Be([O({tag:"sps-nav-tab-set"})],exports.SpsNavTabSetComponent);const Re={basic:{label:"Basic Navigation Tabs",description:l.code`
|
|
432
432
|
<p>Navigation tabs native web component</p>
|
|
433
433
|
`,examples:{basic:{react:l.code`
|
|
434
434
|
function DemoComponent() {
|
|
@@ -455,7 +455,7 @@
|
|
|
455
455
|
</sps-nav-tab-set>
|
|
456
456
|
)
|
|
457
457
|
}
|
|
458
|
-
`}}}};var jt=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,y=(e,t,s,n)=>{for(var i=n>1?void 0:n?zt(t,s):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,s,i):o(i))||i);return n&&i&&jt(t,s,i),i};exports.SpsPhotoDisplayMode=void 0;(function(e){e.FIT="fit",e.FILL="fill"})(exports.SpsPhotoDisplayMode||(exports.SpsPhotoDisplayMode={}));const k="sps-photo";exports.SpsPhotoComponent=class extends HTMLElement{constructor(){super(...arguments);this.mode=exports.SpsPhotoDisplayMode.FILL}get image(){return this.imageInternal}set image(e){this.imageInternal=e,e&&(this.waitForImgHeightInterval&&window.clearInterval(this.waitForImgHeightInterval),this.waitForImgHeightInterval=window.setInterval(()=>{const t=e.getBoundingClientRect();if(t.height){window.clearInterval(this.waitForImgHeightInterval),delete this.waitForImgHeightInterval;let s=!0;s=t.width/t.height>1,this.fitWidth=s===(this.mode===exports.SpsPhotoDisplayMode.FIT)}},1e3/60))}get[D](){return[k,this.fitWidth?`${k}--fit-width`:`${k}--fit-height`,this.placeholderIcon&&`${k}--placeholder`]}get[
|
|
458
|
+
`}}}};var jt=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,y=(e,t,s,n)=>{for(var i=n>1?void 0:n?zt(t,s):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,s,i):o(i))||i);return n&&i&&jt(t,s,i),i};exports.SpsPhotoDisplayMode=void 0;(function(e){e.FIT="fit",e.FILL="fill"})(exports.SpsPhotoDisplayMode||(exports.SpsPhotoDisplayMode={}));const k="sps-photo";exports.SpsPhotoComponent=class extends HTMLElement{constructor(){super(...arguments);this.mode=exports.SpsPhotoDisplayMode.FILL}get image(){return this.imageInternal}set image(e){this.imageInternal=e,e&&(this.waitForImgHeightInterval&&window.clearInterval(this.waitForImgHeightInterval),this.waitForImgHeightInterval=window.setInterval(()=>{const t=e.getBoundingClientRect();if(t.height){window.clearInterval(this.waitForImgHeightInterval),delete this.waitForImgHeightInterval;let s=!0;s=t.width/t.height>1,this.fitWidth=s===(this.mode===exports.SpsPhotoDisplayMode.FIT)}},1e3/60))}get[D](){return[k,this.fitWidth?`${k}--fit-width`:`${k}--fit-height`,this.placeholderIcon&&`${k}--placeholder`]}get[G](){return{fontSize:`${this.width*.05}rem`,width:`${this.width}rem`,height:`${.75*this.width}rem`}}connectedCallback(){this.waitForWidthInterval=window.setInterval(()=>{const e=this.getBoundingClientRect();e.width&&(this.setWidth(e.width),window.clearInterval(this.waitForWidthInterval),delete this.waitForWidthInterval)},1e3/60)}disconnectedCallback(){this.waitForWidthInterval&&window.clearInterval(this.waitForWidthInterval),this.waitForImgHeightInterval&&window.clearInterval(this.waitForImgHeightInterval)}render(){return this.src?this.width?r("img",{src:this.src,alt:this.altText}):r("span",null):r("i",{className:`sps-icon sps-icon-${this.placeholderIcon}`})}setWidth(e){if(e&&!this.width){const t=document.body.parentElement.style.fontSize||"16px",s=Number(t.substr(0,t.length-2));this.width=e/s}}};exports.SpsPhotoComponent.displayName=k;exports.SpsPhotoComponent.props={src:"string",altText:"string",mode:"SpsPhotoDisplayMode",placeholderIcon:"SpsIcon"};y([p()],exports.SpsPhotoComponent.prototype,"src",2);y([p()],exports.SpsPhotoComponent.prototype,"altText",2);y([p()],exports.SpsPhotoComponent.prototype,"mode",2);y([p()],exports.SpsPhotoComponent.prototype,"placeholderIcon",2);y([oe()],exports.SpsPhotoComponent.prototype,"width",2);y([oe()],exports.SpsPhotoComponent.prototype,"fitWidth",2);y([Q("img",{refresh:!0})],exports.SpsPhotoComponent.prototype,"image",1);exports.SpsPhotoComponent=y([O({tag:k})],exports.SpsPhotoComponent);const $e={sizing:{label:"Sizing",description:l.code`
|
|
459
459
|
<p>
|
|
460
460
|
Photos are block elements, so a photo fills its container's width unless
|
|
461
461
|
an explicit width is set. It is always a 4:3 aspect ratio. In this example,
|
|
@@ -544,7 +544,7 @@
|
|
|
544
544
|
<sps-photo placeholderIcon="building"></sps-photo>
|
|
545
545
|
</div>
|
|
546
546
|
</div>
|
|
547
|
-
`}}}},Wt={"File Upload":{components:[exports.SpsFileUploadComponent],examples:
|
|
547
|
+
`}}}},Wt={"File Upload":{components:[exports.SpsFileUploadComponent],examples:Ee},"Tabbed Navigation":{components:[exports.SpsNavTabComponent,exports.SpsNavTabSetComponent],examples:Re},Photos:{components:[exports.SpsPhotoComponent],examples:$e}};var Ht=Object.defineProperty,qt=Object.getOwnPropertyDescriptor,N=(e,t,s,n)=>{for(var i=n>1?void 0:n?qt(t,s):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,s,i):o(i))||i);return n&&i&&Ht(t,s,i),i};const w="sps-insight-card";exports.SpsInsightCardComponent=class extends HTMLElement{constructor(){super(...arguments);this.kind=T.SpsInsightCardKind.GENERAL}get[D](){return[w,`${w}--${this.kind}`,this.detail&&this.detail.children.length?`${w}--has-detail`:null]}render({t:e}){const t=r("div",{className:`${w}__metric-count`},this.metric),s=r("div",{className:`${w}__description`},r("div",{className:`${w}__title`,style:{"-webkit-box-orient":"vertical"}},this.title),r("div",{className:`${w}__detail`},this.content)),[n,i,a]=(this.partnerCount?e("design-system:insightCard.partnerCount",{count:this.partnerCount,total:this.totalPartners}):"").split("|");return r("div",{"data-fragment":!0},r("div",{className:`${w}__body`},this.icon?r("i",{className:`sps-icon sps-icon-${this.icon}`}):r("i",{className:`sps-icon sps-icon-${T.SpsInsightCardIcons[this.kind]}`}),t,s),this.partnerCount&&r("div",{className:`${w}__partner-count`},this.partnerCount===this.totalPartners?r("div",null,e("design-system:insightCard.all")):r("div",{"data-fragment":!0},r("div",null,n),r("div",null,i),r("div",null,a)),r("div",{className:`${w}__partners-text`},e("design-system:insightCard.partners"))))}};exports.SpsInsightCardComponent.displayName=w;exports.SpsInsightCardComponent.props={icon:"SpsIcon",kind:"SpsInsightCardKind",title:"string",metric:"number",partnerCount:"number",totalPartners:"number",secondary:"boolean"};N([p()],exports.SpsInsightCardComponent.prototype,"icon",2);N([p()],exports.SpsInsightCardComponent.prototype,"kind",2);N([p()],exports.SpsInsightCardComponent.prototype,"title",2);N([p()],exports.SpsInsightCardComponent.prototype,"metric",2);N([p()],exports.SpsInsightCardComponent.prototype,"partnerCount",2);N([p()],exports.SpsInsightCardComponent.prototype,"totalPartners",2);N([p()],exports.SpsInsightCardComponent.prototype,"secondary",2);N([X()],exports.SpsInsightCardComponent.prototype,"content",2);N([Q(`.${w}__detail`)],exports.SpsInsightCardComponent.prototype,"detail",2);exports.SpsInsightCardComponent=N([O({tag:w})],exports.SpsInsightCardComponent);var Gt=Object.defineProperty,Xt=Object.getOwnPropertyDescriptor,le=(e,t,s,n)=>{for(var i=n>1?void 0:n?Xt(t,s):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,s,i):o(i))||i);return n&&i&&Gt(t,s,i),i};const A="sps-insights";exports.SpsInsightsComponent=class extends HTMLElement{constructor(){super();this.content=[],this.showAdditionalInsights=!1,this.toggleAdditionalInsights=this.toggleAdditionalInsights.bind(this)}get[D](){return[A,this.showAdditionalInsights&&`${A}--show-additional`,this.details&&Array.from(this.details).every(e=>!e.textContent)?`${A}--no-details`:null,this.content.length===6?`${A}--break-4`:null,this.content.length===7?`${A}--break-5`:null,this.content.length===8?`${A}--break-5`:null]}toggleAdditionalInsights(){this.showAdditionalInsights=!this.showAdditionalInsights,this.update()}render(){return r("div",{"data-fragment":!0},this.content,this.content.length>10&&r("div",{className:"sps-button sps-button--link",onClick:this.toggleAdditionalInsights},r("button",{type:"button"},this.showAdditionalInsights?"Hide ":"Show ","Additional Insights")))}};exports.SpsInsightsComponent.displayName=A;exports.SpsInsightsComponent.props={};le([X()],exports.SpsInsightsComponent.prototype,"content",2);le([Ue(".sps-insight-card__detail")],exports.SpsInsightsComponent.prototype,"details",2);exports.SpsInsightsComponent=le([O({tag:A})],exports.SpsInsightsComponent);const Kt={basic:{label:"Basic Insight Cards",examples:{basic:{jsx:l.code`
|
|
548
548
|
<sps-insights>
|
|
549
549
|
<sps-insight-card kind="general"
|
|
550
550
|
metric="1234"
|
|
@@ -826,4 +826,4 @@
|
|
|
826
826
|
</sps-insights>
|
|
827
827
|
)
|
|
828
828
|
}
|
|
829
|
-
`}}}};exports.AttrBindings=re;exports.ClassBindings=D;exports.Component=O;exports.Content=X;exports.EventDispatcher=K;exports.EventListener=j;exports.MANIFEST=Wt;exports.Prop=
|
|
829
|
+
`}}}};exports.AttrBindings=re;exports.ClassBindings=D;exports.Component=O;exports.Content=X;exports.EventDispatcher=K;exports.EventListener=j;exports.MANIFEST=Wt;exports.Prop=p;exports.QuerySelector=Q;exports.QuerySelectorAll=Ue;exports.SpsFileUploadExamples=Ee;exports.SpsInsightCardExamples=Kt;exports.SpsNavTabsExamples=Re;exports.SpsPhotoExamples=$e;exports.StyleBindings=G;exports.Watch=oe;exports.h=r;exports.namespaceOverrideRegistrar=Lt;exports.register=Ft;exports.webComponentsUseI18n=Dt;
|
package/dist/lib/index.es.js
CHANGED
|
@@ -1400,11 +1400,7 @@ let SpsFileUploadComponent = class extends HTMLElement {
|
|
|
1400
1400
|
onClick: this.handleBrowseLinkClick
|
|
1401
1401
|
}, instructions[1]), /* @__PURE__ */ h("span", null, instructions[2]))), /* @__PURE__ */ h("div", {
|
|
1402
1402
|
className: `${CPT_NAME$3}__requirements`
|
|
1403
|
-
}, this.acceptExtensions ? /* @__PURE__ */ h("div", {
|
|
1404
|
-
"data-fragment": true
|
|
1405
|
-
}, "(", " ", t("design-system:fileUpload.acceptedTypes", { fileTypes: this.acceptExtensionsDescription }), " ", ")") : "", this.maxSize ? /* @__PURE__ */ h("div", {
|
|
1406
|
-
"data-fragment": true
|
|
1407
|
-
}, "(", t("design-system:fileUpload.maximumSize", { size: this.maxSize }), " ", ")") : ""), this.downloadLabel && /* @__PURE__ */ h("div", {
|
|
1403
|
+
}, this.acceptExtensions ? /* @__PURE__ */ h("span", null, "(", " ", t("design-system:fileUpload.acceptedTypes", { fileTypes: this.acceptExtensionsDescription }), " ", ")") : "", this.maxSize ? /* @__PURE__ */ h("span", null, "(", " ", t("design-system:fileUpload.maximumSize", { size: this.maxSize }), " ", ")") : "", this.customRequirement ? /* @__PURE__ */ h("span", null, " ", this.customRequirement, " ") : ""), this.downloadLabel && /* @__PURE__ */ h("div", {
|
|
1408
1404
|
className: `sps-button sps-button--link ${CPT_NAME$3}__download-button`,
|
|
1409
1405
|
onClick: this.handleDownloadButtonClick
|
|
1410
1406
|
}, /* @__PURE__ */ h("button", {
|
|
@@ -1518,6 +1514,7 @@ SpsFileUploadComponent.props = {
|
|
|
1518
1514
|
downloadLabel: "string",
|
|
1519
1515
|
acceptExtensions: "Array<string> | string",
|
|
1520
1516
|
maxSize: "string",
|
|
1517
|
+
customRequirement: "string",
|
|
1521
1518
|
selection: { event: true, type: "CustomEvent<Array<File>>" },
|
|
1522
1519
|
dismissal: { event: true, type: "CustomEvent<void>" },
|
|
1523
1520
|
download: { event: true, type: "CustomEvent<void>" }
|
|
@@ -1552,6 +1549,9 @@ __decorateClass$5([
|
|
|
1552
1549
|
__decorateClass$5([
|
|
1553
1550
|
Prop()
|
|
1554
1551
|
], SpsFileUploadComponent.prototype, "maxSize", 2);
|
|
1552
|
+
__decorateClass$5([
|
|
1553
|
+
Prop()
|
|
1554
|
+
], SpsFileUploadComponent.prototype, "customRequirement", 2);
|
|
1555
1555
|
__decorateClass$5([
|
|
1556
1556
|
EventDispatcher()
|
|
1557
1557
|
], SpsFileUploadComponent.prototype, "selection", 2);
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spscommerce/ds-web-components",
|
|
3
3
|
"description": "SPS Design System Native Web Components",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.35.0",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/spscommerce/design-system/tree/main/packages/@spscommerce/ds-web-components",
|
|
@@ -10,6 +10,7 @@ export declare class SpsFileUploadComponent extends HTMLElement {
|
|
|
10
10
|
downloadLabel: string;
|
|
11
11
|
acceptExtensions: string;
|
|
12
12
|
maxSize: string;
|
|
13
|
+
customRequirement: string;
|
|
13
14
|
selection: {
|
|
14
15
|
event: boolean;
|
|
15
16
|
type: string;
|
|
@@ -59,6 +60,8 @@ export declare class SpsFileUploadComponent extends HTMLElement {
|
|
|
59
60
|
acceptExtensions: string[] | string;
|
|
60
61
|
/** The maximum allowable size in bytes for files selected by the component. */
|
|
61
62
|
maxSize: string;
|
|
63
|
+
/** custom label in requirements place. */
|
|
64
|
+
customRequirement: string;
|
|
62
65
|
/**
|
|
63
66
|
* Event which emits when a file or files have been selected by the user. The
|
|
64
67
|
* event detail will be an array of Files.
|
package/lib/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var T=require("@spscommerce/ds-shared"),l=require("@spscommerce/utils"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var T=require("@spscommerce/ds-shared"),l=require("@spscommerce/utils"),c={};Object.defineProperty(c,"__esModule",{value:!0});/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
4
4
|
*
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
29
29
|
* See the License for the specific language governing permissions and
|
|
30
30
|
* limitations under the License.
|
|
31
|
-
*/var ze=Object.prototype.hasOwnProperty;function
|
|
31
|
+
*/var ze=Object.prototype.hasOwnProperty;function pe(){}pe.prototype=Object.create(null);function We(e,t){return ze.call(e,t)}function ce(){return new pe}function Z(e,t){for(;e.length>t;)e.pop()}/**
|
|
32
32
|
* @license
|
|
33
33
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
34
34
|
*
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
44
44
|
* See the License for the specific language governing permissions and
|
|
45
45
|
* limitations under the License.
|
|
46
|
-
*/function He(e){if(e.lastIndexOf("xml:",0)===0)return"http://www.w3.org/XML/1998/namespace";if(e.lastIndexOf("xlink:",0)===0)return"http://www.w3.org/1999/xlink"}function de(e,t,s){if(s==null)e.removeAttribute(t);else{var n=He(t);n?e.setAttributeNS(n,t,String(s)):e.setAttribute(t,String(s))}}function he(e,t,s){e[t]=s}function
|
|
46
|
+
*/function He(e){if(e.lastIndexOf("xml:",0)===0)return"http://www.w3.org/XML/1998/namespace";if(e.lastIndexOf("xlink:",0)===0)return"http://www.w3.org/1999/xlink"}function de(e,t,s){if(s==null)e.removeAttribute(t);else{var n=He(t);n?e.setAttributeNS(n,t,String(s)):e.setAttribute(t,String(s))}}function he(e,t,s){e[t]=s}function qe(e,t,s){t.indexOf("-")>=0?e.setProperty(t,s):e[t]=s}function Ge(e,t,s){if(typeof s=="string")e.style.cssText=s;else{e.style.cssText="";var n=e.style;for(var i in s)We(s,i)&&qe(n,i,s[i])}}function Xe(e,t,s){var n=typeof s;n==="object"||n==="function"?he(e,t,s):de(e,t,s)}var U=ce();U[V.default]=Xe;U.style=Ge;function E(e,t,s){var n=U[t]||U[V.default];n(e,t,s)}/**
|
|
47
47
|
* @license
|
|
48
48
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
49
49
|
*
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
119
|
* See the License for the specific language governing permissions and
|
|
120
120
|
* limitations under the License.
|
|
121
|
-
*/var nt=function(){function e(t,s,n){this._attrsArr=null,this.staticsApplied=!1,this.nameOrCtor=t,this.key=s,this.text=n}return e.prototype.hasEmptyAttrsArr=function(){var t=this._attrsArr;return!t||!t.length},e.prototype.getAttrsArr=function(t){return this._attrsArr||(this._attrsArr=new Array(t))},e}();function Y(e,t,s,n){var i=new nt(t,s,n);return e.__incrementalDOMData=i,i}function
|
|
121
|
+
*/var nt=function(){function e(t,s,n){this._attrsArr=null,this.staticsApplied=!1,this.nameOrCtor=t,this.key=s,this.text=n}return e.prototype.hasEmptyAttrsArr=function(){var t=this._attrsArr;return!t||!t.length},e.prototype.getAttrsArr=function(t){return this._attrsArr||(this._attrsArr=new Array(t))},e}();function Y(e,t,s,n){var i=new nt(t,s,n);return e.__incrementalDOMData=i,i}function R(e,t){return me(e,t)}function it(e){return Boolean(e.__incrementalDOMData)}function at(e){return Qe(e.__incrementalDOMData),R(e).key}function me(e,t){if(e.__incrementalDOMData)return e.__incrementalDOMData;var s=J(e)?e.localName:e.nodeName,n=J(e)?e.getAttribute("key")||t:null,i=Je(e)?e.data:void 0,a=Y(e,s,n,i);return J(e)&&rt(e,a),a}function fe(e){me(e);for(var t=e.firstChild;t;t=t.nextSibling)fe(t)}function ge(e){e.__incrementalDOMData=null;for(var t=e.firstChild;t;t=t.nextSibling)ge(t)}function rt(e,t){var s=e.attributes,n=s.length;if(!!n)for(var i=t.getAttrsArr(n),a=0,o=0;a<n;a+=1,o+=2){var g=s[a],x=g.name,v=g.value;i[o]=x,i[o+1]=v}}/**
|
|
122
122
|
* @license
|
|
123
123
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
124
124
|
*
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
134
134
|
* See the License for the specific language governing permissions and
|
|
135
135
|
* limitations under the License.
|
|
136
|
-
*/function ot(e,t){return e==="svg"?"http://www.w3.org/2000/svg":e==="math"?"http://www.w3.org/1998/Math/MathML":t==null
|
|
136
|
+
*/function ot(e,t){return e==="svg"?"http://www.w3.org/2000/svg":e==="math"?"http://www.w3.org/1998/Math/MathML":t==null||R(t).nameOrCtor==="foreignObject"?null:t.namespaceURI}function lt(e,t,s,n){var i;if(typeof s=="function")i=new s;else{var a=ot(s,t);a?i=e.createElementNS(a,s):i=e.createElement(s)}return Y(i,s,n),i}function pt(e){var t=e.createTextNode("");return Y(t,"#text",null),t}/**
|
|
137
137
|
* @license
|
|
138
138
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
139
139
|
*
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
149
149
|
* See the License for the specific language governing permissions and
|
|
150
150
|
* limitations under the License.
|
|
151
|
-
*/var L=null,d=null,
|
|
151
|
+
*/var L=null,d=null,f=null,$=null,z=[],W=[];function H(){return W}function ve(e){var t=function(s,n,i){var a=L,o=$,g=z,x=W,v=d,S=f,m=!1;L=new Ve,$=s.ownerDocument,W=[],f=s.parentNode,z=tt(s,f);try{var C=e(s,n,i);return C}finally{$=o,W=x,d=v,f=S,z=g,L.notifyChanges(),Ke(m),L=a}};return t}var Ce=ve(function(e,t,s){return d=e,_e(),t(s),xe(),e}),ct=ve(function(e,t,s){var n={nextSibling:e},i=null,a=null;return d=n,t(s),f&&Se(f,q(),e.nextSibling),n===d?null:d});function be(e,t,s){var n=R(e,s);return t==n.nameOrCtor&&s==n.key}function dt(e,t,s){if(!e)return null;if(be(e,t,s))return e;if(s){for(;e=e.nextSibling;)if(be(e,t,s))return e}return null}function ht(e,t){var s;return e==="#text"?s=pt($):s=lt($,f,e,t),L.markCreated(s),s}function we(e,t){var s=dt(d,e,t),n=s||ht(e,t);n!==d&&(z.indexOf(n)>=0?st(f,n,d):f.insertBefore(n,d),d=n)}function Se(e,t,s){for(var n=e,i=t;i!==s;){var a=i.nextSibling;n.removeChild(i),L.markDeleted(i),i=a}}function _e(){f=d,d=null}function q(){return d?d.nextSibling:f.firstChild}function M(){d=q()}function xe(){Se(f,q(),null),d=f,f=f.parentNode}function Ne(e,t){return M(),we(e,t),_e(),f}function ye(){return xe(),d}function ut(){return M(),we("#text",null),d}function mt(){return f}function ft(){return q()}function gt(){d=f.lastChild}/**
|
|
152
152
|
* @license
|
|
153
153
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
154
154
|
*
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
164
164
|
* See the License for the specific language governing permissions and
|
|
165
165
|
* limitations under the License.
|
|
166
|
-
*/var Ae=3,_=
|
|
166
|
+
*/var Ae=3,_=ce();function vt(e,t,s){if(t.staticsApplied=!0,!(!s||!s.length)){if(t.hasEmptyAttrsArr()){for(var n=0;n<s.length;n+=2)E(e,s[n],s[n+1]);return}for(var n=0;n<s.length;n+=2)_[s[n]]=n+1;for(var i=t.getAttrsArr(0),a=0,n=0;n<i.length;n+=2){var o=i[n],g=i[n+1],x=_[o];if(x){s[x]===g&&delete _[o];continue}i[a]=o,i[a+1]=g,a+=2}Z(i,a);for(var o in _)E(e,o,s[_[o]]),delete _[o]}}function ee(e,t,s){for(var n=[],i=3;i<arguments.length;i++)n[i-3]=arguments[i];var a=Ne(e,t),o=R(a);o.staticsApplied||vt(a,o,s);var g=Math.max(0,arguments.length-Ae),x=o.hasEmptyAttrsArr();if(!g&&x)return a;for(var v=o.getAttrsArr(g),S=Ae,m=0;S<arguments.length;S+=2,m+=2){var C=arguments[S];if(x)v[m]=C;else if(v[m]!==C)break;var P=arguments[S+1];(x||v[m+1]!==P)&&(v[m+1]=P,E(a,C,P))}if(S<arguments.length||m<v.length){for(var je=m;m<v.length;m+=2)_[v[m]]=v[m+1];for(m=je;S<arguments.length;S+=2,m+=2){var C=arguments[S],P=arguments[S+1];_[C]!==P&&E(a,C,P),v[m]=C,v[m+1]=P,delete _[C]}Z(v,m);for(var C in _)E(a,C,void 0),delete _[C]}return a}function Ct(e,t,s){var n=H();n[0]=e,n[1]=t,n[2]=s}function bt(e){var t=H();t[1]=e}function wt(e,t){var s=H();s.push(e),s.push(t)}function St(){var e=H(),t=ee.apply(null,e);return Z(e,0),t}function Pe(e){var t=ye();return t}function _t(e,t,s){for(var n=[],i=3;i<arguments.length;i++)n[i-3]=arguments[i];return ee.apply(null,arguments),Pe()}function xt(e){for(var t=[],s=1;s<arguments.length;s++)t[s-1]=arguments[s];var n=ut(),i=R(n);if(i.text!==e){i.text=e;for(var a=e,o=1;o<arguments.length;o+=1){var g=arguments[o];a=g(a)}n.data=a}return n}/**
|
|
167
167
|
* @license
|
|
168
168
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
169
169
|
*
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
179
179
|
* See the License for the specific language governing permissions and
|
|
180
180
|
* limitations under the License.
|
|
181
|
-
*/p.applyAttr=de;p.applyProp=he;p.attributes=E;p.close=ye;var te=p.currentElement=ft,se=p.currentPointer=mt;p.open=Ne;var Nt=p.patch=Ce;p.patchInner=Ce;p.patchOuter=pt;p.skip=gt;var ne=p.skipNode=M;p.getKey=at;p.clearCache=ge;p.importNode=me;p.isDataInitialized=it;p.notifications=B;p.symbols=V;var Ie=p.attr=wt,yt=p.elementClose=Pe;p.elementOpen=ee;var At=p.elementOpenEnd=St,Pt=p.elementOpenStart=Ct;p.elementVoid=_t;var It=p.text=xt;p.key=bt;function De(e){let t=se();return t instanceof Comment&&t.data!==e?t.data=e:(t=document.createComment(e),te().appendChild(t)),ne(),t}let Oe=T.noI18nI18n;function Dt(e){Oe=e}function Ot(){return Oe}const I=Symbol("ComponentMetadata"),b=Object.freeze({has(e,t){return Boolean(e[I]&&Object.prototype.hasOwnProperty.call(e[I],t))},add(e,t){e[I]?Object.assign(e[I],t):e[I]=t},get(e,t,s){return e[I]&&e[I][t]||s}}),Fe=Symbol("ds-web-components:pragma:listeners-attached"),Le="idom-pragma:content-begin",ie="idom-pragma:content-end";function ae(e){for(const t of e)if(typeof t=="function")t();else if(typeof t=="string")It(t);else if(t instanceof Set)ae(Array.from(t));else if(Array.isArray(t)&&t.length>0){let s=se();if(De(Le),s===null){const n=te();for(let i=0;i<t.length;i+=1)n.contains(t[i])||n.appendChild(t[i]),ne()}for(;s&&s.data!==ie;)ne(),s=se();De(ie)}}function r(e,t,...s){if(t){for(const n of Object.keys(t))if(n.toUpperCase()==="DATA-FRAGMENT")return()=>ae(s)}return()=>{Pt(e);const n=[];if(t)for(const a of Object.keys(t))a.toUpperCase()==="CLASSNAME"?Ie("class",t[a]):/^on[A-Z]/.test(a)?n.push(a):Ie(a,t[a]);At(e);const i=te();if(!i[Fe]){for(const a of n)i.addEventListener(a.substr(2).toLowerCase(),t[a]);i[Fe]=!0}ae(s),yt(e)}}function ke(e,t){customElements.get(e)||customElements.define(e,t)}function Ft(...e){for(const t of e)ke(b.get(t,"tag"),t)}function Lt(e){return function(...s){for(const n of s){const i=`${e}${b.get(n,"tag").substr(3)}`;ke(i,n)}}}const re=Symbol("Component Attribute Bindings"),D=Symbol("Component Class Bindings"),q=Symbol("Component Style Bindings"),kt={__initialized:!1,__observer:null,__queuedUpdate:null,__managedClasses:new Set,__updateHostBindings(){const e=this;for(const t of Object.keys(e[re]||{}))e.setAttribute(t,e[re][t]);for(const t of Object.keys(e[q]||{}))e.style[t]=e[q][t];for(const t of e.__managedClasses)e.classList.remove(t);for(const t of(e[D]||[]).filter(Boolean))e.__managedClasses.add(t),e.classList.add(t);for(const t of(e.getAttribute("classname")||"").split(/\w+/).filter(Boolean))e.classList.add(t)},__updateChildQueries(e){const t=this;for(const s of b.get(t.constructor,"childQueries",[]))if(!e||e&&s.refresh){const n=s.all?t.querySelectorAll:t.querySelector;t[s.key]=n.call(t,s.selector)}},__gatherChildren(){const e=this;let t=Array.from(e.childNodes),s=null,n=t.length;for(let i=0;i<t.length;i+=1){const a=t[i];a instanceof Comment&&(a.data===Le?s=i+1:a.data===ie&&(n=i-1))}if(s===null)for(const i of t)i.parentNode.removeChild(i);else t=t.slice(s,n);b.has(e.constructor,"contentProp")&&(e[b.get(e.constructor,"contentProp")]=t)},__startMutObs(){const e=this;e.__observer||(e.__observer=new MutationObserver(()=>{e.contentChangedCallback&&e.contentChangedCallback(),e.__gatherChildren(),e.update()})),e.__observer.observe(e,{childList:!0})},__stopMutObs(){const e=this;e.__observer&&e.__observer.disconnect()},__doRender(){const e=this;e.__stopMutObs(),Nt(e,e.render(Ot())),e.__startMutObs()},update(){const e=this;e.__initialized&&!e.__queuedUpdate&&(e.__queuedUpdate=window.requestAnimationFrame(()=>{e.__doRender(),setTimeout(()=>{e.__updateChildQueries(!0),e.__updateHostBindings()},0),e.__queuedUpdate=null}))},attributeChangedCallback(e,t,s){const n=this,i=s===""?!0:s;i!==t&&(n.__cbAttributeChanged&&n.__cbAttributeChanged(e,n[e],i),e!=="style"&&(n[e]=i),n.__initialized&&n.update())},connectedCallback(){const e=this;e.__cbConnected&&e.__cbConnected();const t=b.get(e.constructor,"eventListeners",[]);setTimeout(()=>{if(!e.__initialized){e.__gatherChildren();for(const[,s]of t)e[s]=e[s].bind(e);e.__initialized=!0}for(const[s,n]of t)e.addEventListener(s,e[n]);e.__doRender(),setTimeout(()=>{e.__updateChildQueries(),e.__updateHostBindings()},0)},0)},disconnectedCallback(){const e=this;e.__cbDisconnected&&e.__cbDisconnected();for(const[t,s]of b.get(e.constructor,"eventListeners",[]))e.removeEventListener(t,e[s]);e.__stopMutObs()}};function O(e){return t=>{b.add(t,e),Object.assign(t.prototype,{__cbAttributeChanged:t.prototype.attributeChangedCallback,__cbConnected:t.prototype.connectedCallback,__cbDisconnected:t.prototype.disconnectedCallback},kt)}}function X(){return(e,t)=>{b.add(e.constructor,{contentProp:t})}}function K(e){return(t,s)=>{Object.defineProperty(t,s,{get(){return Object.defineProperty(this,s,{value:{dispatch:n=>{const i=new CustomEvent(e||s,{detail:n});return this.dispatchEvent(i),i}}}),this[s]},configurable:!0})}}function j(e){return(t,s)=>{const n=b.get(t.constructor,"eventListeners",[]);n.push([e,s]),b.add(t.constructor,{eventListeners:n})}}function c(e){return(t,s)=>{const n=t.constructor,i=s.toLowerCase();if(n.observedAttributes=n.observedAttributes||["classname","className","style"],n.observedAttributes.push(s),n.observedAttributes.push(i),i!==s&&Object.defineProperty(t,s,{get(){return this[i]},set(a){this[i]=a}}),e){const a=Symbol.for(s);Object.defineProperty(t,i,{get(){return this[a]},set(o){let g=o;e===Boolean&&typeof o=="string"&&o.toLowerCase()==="false"?g=!1:g=e(o),this[a]=g}})}}}function Te(e,t,s){return(n,i)=>{const a=b.get(n.constructor,"childQueries",[]);a.push({key:i,selector:e,all:s,refresh:t.refresh}),b.add(n.constructor,{childQueries:a})}}function Q(e,t={}){return Te(e,t)}function Ee(e,t={}){return Te(e,t,!0)}function oe(){return(e,t)=>{const s=Symbol(t);Object.defineProperties(e,{[s]:{writable:!0,enumerable:!1,configurable:!1,value:e[t]},[t]:{get(){return this[s]},set(n){this[s]!==n&&(this[s]=n,this.update())}}})}}exports.MIMEType=void 0;(function(e){e["7Z"]="application/x-7z-compressed",e.AAC="audio/aac",e.ABW="application/x-abiword",e.ARC="application/octet-stream",e.AVI="video/x-msvideo",e.AZW="application/vnd.amazon.ebook",e.BIN="application/octet-stream",e.BMP="image/bmp",e.BZ="application/x-bzip",e.BZ2="application/x-bzip2",e.CSH="application/x-csh",e.CSS="text/css",e.CSV="text/csv,application/vnd.ms-excel",e.DOC="application/msword",e.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",e.EOT="application/vnd.ms-fontobject",e.EPUB="application/epub+zip",e.ES="application/ecmascript",e.FLV="video/x-flv",e.GIF="image/gif",e.GZ="application/x-gzip",e.HTM="text/html",e.HTML="text/html",e.ICO="image/x-icon",e.ICS="text/calendar",e.JAR="application/java-archive",e.JPEG="image/jpeg",e.JPG="image/jpeg",e.JS="application/javascript",e.JSON="application/json",e.M3U="audio/x-mpequrl",e.MID="audio/midi",e.MIDI="audio/midi",e.MOV="video/quicktime",e.MP3="audio/mpeg3",e.MP4="video/mp4",e.MPEG="video/mpeg",e.MPKG="application/vnd.apple.installer+xml",e.ODP="application/vnd.oasis.opendocument.presentation",e.ODS="application/vnd.oasis.opendocument.spreadsheet",e.ODT="application/vnd.oasis.opendocument.text",e.OGA="audio/ogg",e.OGV="video/ogg",e.OGX="application/ogg",e.OTF="font/otf",e.PNG="image/png",e.PDF="application/pdf",e.PPT="application/vnd.ms-powerpoint",e.PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",e.RAR="application/x-rar-compressed",e.RTF="application/rtf",e.SH="application/x-sh",e.SVG="image/svg+xml",e.SWF="application/x-shockwave-flash",e.TAR="application/x-tar",e.TIF="image/tiff",e.TIFF="image/tiff",e.TS="application/typescript",e.TTF="font/ttf",e.TXT="text/plain",e.VSD="application/vnd.visio",e.WAV="audio/wav",e.WEBA="audio/webm",e.WEBM="video/webm",e.WEBP="image/webp",e.WOFF="font/woff",e.WOFF2="font/woff2",e.XHTML="application/xhtml+xml",e.XLS="application/vnd.ms-excel",e.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",e.XML="application/xml",e.XUL="application/vnd.mozilla.xul+xml",e.ZIP="application/zip"})(exports.MIMEType||(exports.MIMEType={}));var Tt=Object.defineProperty,Et=Object.getOwnPropertyDescriptor,u=(e,t,s,n)=>{for(var i=n>1?void 0:n?Et(t,s):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,s,i):o(i))||i);return n&&i&&Tt(t,s,i),i};const h="sps-file-upload";exports.SpsFileUploadComponent=class extends HTMLElement{constructor(){super();this.shown=!0,this.files=[],this.acceptMIMETypes=new Set,this.active=!1,this.error=!1,this.namesOfUnsupportedFiles=[],this.handleBrowseLinkClick=this.handleBrowseLinkClick.bind(this),this.handleDownloadButtonClick=this.handleDownloadButtonClick.bind(this),this.handleFileInputChange=this.handleFileInputChange.bind(this),this.dismiss=this.dismiss.bind(this)}get[D](){return[h,this.active&&`${h}--active`,this.error&&`${h}--error`,!this.shown&&`${h}--hidden`,this.mini&&`${h}--mini`,this.constrainContentWidth&&`${h}--constrained-content-width`]}connectedCallback(){this.description=this.description||(this.multiple?"Files":"File"),this.acceptExtensions&&this.processAcceptExtensions(this.acceptExtensions),this.maxSize&&this.parseAndValidateMaxSize(this.maxSize)}attributeChangedCallback(e,t,s){e==="acceptExtensions"&&this.processAcceptExtensions(s),e==="maxSize"&&this.parseAndValidateMaxSize(s)}dismiss(){this.dismissable&&(this.shown=!1,this.update(),this.dismissal.dispatch())}show(){this.dismissable&&(this.shown=!0,this.update())}render({t:e}){const t=this.error?T.SpsIcon.EXCLAMATION_CIRCLE:T.SpsIcon.UPLOAD_CLOUD,s=(this.multiple?e("design-system:fileUpload.instructions_plural"):e("design-system:fileUpload.instructions")).split("|");return r("div",{"data-fragment":!0},r("div",{className:`${h}__content`},this.processing?r("div",{"data-fragment":!0},r("i",{className:"sps-spinner sps-spinner--medium","aria-hidden":"true"}),r("div",{className:`${h}__instructions`},e("design-system:fileUpload.processing"))):r("div",{"data-fragment":!0},r("i",{className:`sps-icon sps-icon-${t} ${h}__icon-primary`,"aria-hidden":"true"}),r("div",{className:`${h}__title`},this.error?r("div",{"data-fragment":!0},e(this.namesOfUnsupportedFiles.length>1?"design-system:fileUpload.cancelled_plural":"design-system:fileUpload.cancelled")):r("div",{"data-fragment":!0},e("design-system:fileUpload.title",{description:this.description}))),this.error?r("div",{className:`${h}__errored-files`},new Set(this.namesOfUnsupportedFiles.map((n,i)=>{const a=Math.floor(n.length/2);return r("div",{className:`${h}__errored-filename`,key:n},r("span",{className:`${h}__errored-filename-segment`},n.substr(0,a)),r("div",{className:`${h}__errored-filename-segment`},r("span",null,n.substr(a))),i<this.namesOfUnsupportedFiles.length-1?",":"")}))):r("span",null),r("div",{className:`${h}__instructions`},r("div",{"data-fragment":!0},r("span",null,s[0]),r("a",{href:"",onClick:this.handleBrowseLinkClick},s[1]),r("span",null,s[2]))),r("div",{className:`${h}__requirements`},this.acceptExtensions?r("div",{"data-fragment":!0},"("," ",e("design-system:fileUpload.acceptedTypes",{fileTypes:this.acceptExtensionsDescription})," ",")"):"",this.maxSize?r("div",{"data-fragment":!0},"(",e("design-system:fileUpload.maximumSize",{size:this.maxSize})," ",")"):""),this.downloadLabel&&r("div",{className:`sps-button sps-button--link ${h}__download-button`,onClick:this.handleDownloadButtonClick},r("button",{type:"button"},r("i",{className:"sps-icon sps-icon-download-cloud","aria-hidden":"true"})," ",this.downloadLabel)))),this.dismissable&&!this.processing&&r("div",{className:`sps-button sps-button--icon ${h}__close-button`,onClick:this.dismiss},r("button",{type:"button",title:e("design-system:fileUpload.close")},r("i",{className:"sps-icon sps-icon-x","aria-hidden":"true"}))),r("form",null,r("input",{type:"file",accept:this.accept||"*/*",multiple:this.multiple||null,onChange:this.handleFileInputChange})))}parseAndValidateMaxSize(e){try{this.maxSizeBytes=l.parseFileSize(e)}catch{throw new Error(`Could not parse "${e}" as a file size.`)}}processAcceptExtensions(e){const s=(Array.isArray(e)?e:e.trim().split(/\s?,\s?/)).map(i=>i.replace(/^\./,"")),n=s.map(i=>`.${i}`.toLowerCase());this.acceptExtensionsDescription=n.map((i,a)=>a>0&&a===n.length-1?`or ${i}`:i).join(n.length>2?", ":" "),this.acceptMIMETypes.clear();for(const i of s)for(const a of exports.MIMEType[i.toUpperCase()].split(","))this.acceptMIMETypes.add(a);this.accept=n.concat(Array.from(this.acceptMIMETypes)).join(",")}selectFiles(e){this.namesOfUnsupportedFiles=[];const t=Array.from(e);for(const s of t)this.acceptExtensions&&!this.acceptMIMETypes.has(s.type)&&this.namesOfUnsupportedFiles.push(s.name),this.maxSize&&s.size>this.maxSizeBytes&&this.namesOfUnsupportedFiles.push(s.name);this.namesOfUnsupportedFiles.length?(this.error=!0,this.fileInput.value=null,this.update()):(this.files=t,this.selection.dispatch(t))}handleDragOver(e){e.preventDefault(),e.stopPropagation()}handleDragEnter(e){e.preventDefault(),this.active=!0,this.error=!1,this.update()}handleDragLeave(e){e.preventDefault(),this.active=!1,this.update()}handleDrop(e){e.preventDefault(),e.stopPropagation(),this.active=!1,e.dataTransfer.items?this.selectFiles(Array.from(e.dataTransfer.items).map(t=>t.getAsFile())):this.selectFiles(e.dataTransfer.files),this.update()}handleBrowseLinkClick(e){e.preventDefault(),this.error=!1,this.update(),this.fileInput.click()}handleDownloadButtonClick(){this.download.dispatch()}handleFileInputChange(e){e.stopPropagation(),this.selectFiles(e.target.files)}};exports.SpsFileUploadComponent.displayName=h;exports.SpsFileUploadComponent.props={description:"string",multiple:"boolean",dismissable:"boolean",processing:"boolean",mini:"boolean",downloadLabel:"string",acceptExtensions:"Array<string> | string",maxSize:"string",selection:{event:!0,type:"CustomEvent<Array<File>>"},dismissal:{event:!0,type:"CustomEvent<void>"},download:{event:!0,type:"CustomEvent<void>"}};u([c()],exports.SpsFileUploadComponent.prototype,"description",2);u([c(Boolean)],exports.SpsFileUploadComponent.prototype,"multiple",2);u([c(Boolean)],exports.SpsFileUploadComponent.prototype,"shown",2);u([c(Boolean)],exports.SpsFileUploadComponent.prototype,"dismissable",2);u([c(Boolean)],exports.SpsFileUploadComponent.prototype,"processing",2);u([c(Boolean)],exports.SpsFileUploadComponent.prototype,"mini",2);u([c(Boolean)],exports.SpsFileUploadComponent.prototype,"constrainContentWidth",2);u([c()],exports.SpsFileUploadComponent.prototype,"downloadLabel",2);u([c()],exports.SpsFileUploadComponent.prototype,"acceptExtensions",2);u([c()],exports.SpsFileUploadComponent.prototype,"maxSize",2);u([K()],exports.SpsFileUploadComponent.prototype,"selection",2);u([K()],exports.SpsFileUploadComponent.prototype,"dismissal",2);u([K()],exports.SpsFileUploadComponent.prototype,"download",2);u([Q("input[type='file']")],exports.SpsFileUploadComponent.prototype,"fileInput",2);u([j("dragover")],exports.SpsFileUploadComponent.prototype,"handleDragOver",1);u([j("dragenter")],exports.SpsFileUploadComponent.prototype,"handleDragEnter",1);u([j("dragleave")],exports.SpsFileUploadComponent.prototype,"handleDragLeave",1);u([j("drop")],exports.SpsFileUploadComponent.prototype,"handleDrop",1);exports.SpsFileUploadComponent=u([O({tag:h})],exports.SpsFileUploadComponent);const Ue={basic:{label:"Basic File Upload",description:l.code`
|
|
181
|
+
*/c.applyAttr=de;c.applyProp=he;c.attributes=U;c.close=ye;var te=c.currentElement=mt,se=c.currentPointer=ft;c.open=Ne;var Nt=c.patch=Ce;c.patchInner=Ce;c.patchOuter=ct;c.skip=gt;var ne=c.skipNode=M;c.getKey=at;c.clearCache=ge;c.importNode=fe;c.isDataInitialized=it;c.notifications=B;c.symbols=V;var Ie=c.attr=wt,yt=c.elementClose=Pe;c.elementOpen=ee;var At=c.elementOpenEnd=St,Pt=c.elementOpenStart=Ct;c.elementVoid=_t;var It=c.text=xt;c.key=bt;function De(e){let t=se();return t instanceof Comment&&t.data!==e?t.data=e:(t=document.createComment(e),te().appendChild(t)),ne(),t}let Oe=T.noI18nI18n;function Dt(e){Oe=e}function Ot(){return Oe}const I=Symbol("ComponentMetadata"),b=Object.freeze({has(e,t){return Boolean(e[I]&&Object.prototype.hasOwnProperty.call(e[I],t))},add(e,t){e[I]?Object.assign(e[I],t):e[I]=t},get(e,t,s){return e[I]&&e[I][t]||s}}),Fe=Symbol("ds-web-components:pragma:listeners-attached"),Le="idom-pragma:content-begin",ie="idom-pragma:content-end";function ae(e){for(const t of e)if(typeof t=="function")t();else if(typeof t=="string")It(t);else if(t instanceof Set)ae(Array.from(t));else if(Array.isArray(t)&&t.length>0){let s=se();if(De(Le),s===null){const n=te();for(let i=0;i<t.length;i+=1)n.contains(t[i])||n.appendChild(t[i]),ne()}for(;s&&s.data!==ie;)ne(),s=se();De(ie)}}function r(e,t,...s){if(t){for(const n of Object.keys(t))if(n.toUpperCase()==="DATA-FRAGMENT")return()=>ae(s)}return()=>{Pt(e);const n=[];if(t)for(const a of Object.keys(t))a.toUpperCase()==="CLASSNAME"?Ie("class",t[a]):/^on[A-Z]/.test(a)?n.push(a):Ie(a,t[a]);At(e);const i=te();if(!i[Fe]){for(const a of n)i.addEventListener(a.substr(2).toLowerCase(),t[a]);i[Fe]=!0}ae(s),yt(e)}}function ke(e,t){customElements.get(e)||customElements.define(e,t)}function Ft(...e){for(const t of e)ke(b.get(t,"tag"),t)}function Lt(e){return function(...s){for(const n of s){const i=`${e}${b.get(n,"tag").substr(3)}`;ke(i,n)}}}const re=Symbol("Component Attribute Bindings"),D=Symbol("Component Class Bindings"),G=Symbol("Component Style Bindings"),kt={__initialized:!1,__observer:null,__queuedUpdate:null,__managedClasses:new Set,__updateHostBindings(){const e=this;for(const t of Object.keys(e[re]||{}))e.setAttribute(t,e[re][t]);for(const t of Object.keys(e[G]||{}))e.style[t]=e[G][t];for(const t of e.__managedClasses)e.classList.remove(t);for(const t of(e[D]||[]).filter(Boolean))e.__managedClasses.add(t),e.classList.add(t);for(const t of(e.getAttribute("classname")||"").split(/\w+/).filter(Boolean))e.classList.add(t)},__updateChildQueries(e){const t=this;for(const s of b.get(t.constructor,"childQueries",[]))if(!e||e&&s.refresh){const n=s.all?t.querySelectorAll:t.querySelector;t[s.key]=n.call(t,s.selector)}},__gatherChildren(){const e=this;let t=Array.from(e.childNodes),s=null,n=t.length;for(let i=0;i<t.length;i+=1){const a=t[i];a instanceof Comment&&(a.data===Le?s=i+1:a.data===ie&&(n=i-1))}if(s===null)for(const i of t)i.parentNode.removeChild(i);else t=t.slice(s,n);b.has(e.constructor,"contentProp")&&(e[b.get(e.constructor,"contentProp")]=t)},__startMutObs(){const e=this;e.__observer||(e.__observer=new MutationObserver(()=>{e.contentChangedCallback&&e.contentChangedCallback(),e.__gatherChildren(),e.update()})),e.__observer.observe(e,{childList:!0})},__stopMutObs(){const e=this;e.__observer&&e.__observer.disconnect()},__doRender(){const e=this;e.__stopMutObs(),Nt(e,e.render(Ot())),e.__startMutObs()},update(){const e=this;e.__initialized&&!e.__queuedUpdate&&(e.__queuedUpdate=window.requestAnimationFrame(()=>{e.__doRender(),setTimeout(()=>{e.__updateChildQueries(!0),e.__updateHostBindings()},0),e.__queuedUpdate=null}))},attributeChangedCallback(e,t,s){const n=this,i=s===""?!0:s;i!==t&&(n.__cbAttributeChanged&&n.__cbAttributeChanged(e,n[e],i),e!=="style"&&(n[e]=i),n.__initialized&&n.update())},connectedCallback(){const e=this;e.__cbConnected&&e.__cbConnected();const t=b.get(e.constructor,"eventListeners",[]);setTimeout(()=>{if(!e.__initialized){e.__gatherChildren();for(const[,s]of t)e[s]=e[s].bind(e);e.__initialized=!0}for(const[s,n]of t)e.addEventListener(s,e[n]);e.__doRender(),setTimeout(()=>{e.__updateChildQueries(),e.__updateHostBindings()},0)},0)},disconnectedCallback(){const e=this;e.__cbDisconnected&&e.__cbDisconnected();for(const[t,s]of b.get(e.constructor,"eventListeners",[]))e.removeEventListener(t,e[s]);e.__stopMutObs()}};function O(e){return t=>{b.add(t,e),Object.assign(t.prototype,{__cbAttributeChanged:t.prototype.attributeChangedCallback,__cbConnected:t.prototype.connectedCallback,__cbDisconnected:t.prototype.disconnectedCallback},kt)}}function X(){return(e,t)=>{b.add(e.constructor,{contentProp:t})}}function K(e){return(t,s)=>{Object.defineProperty(t,s,{get(){return Object.defineProperty(this,s,{value:{dispatch:n=>{const i=new CustomEvent(e||s,{detail:n});return this.dispatchEvent(i),i}}}),this[s]},configurable:!0})}}function j(e){return(t,s)=>{const n=b.get(t.constructor,"eventListeners",[]);n.push([e,s]),b.add(t.constructor,{eventListeners:n})}}function p(e){return(t,s)=>{const n=t.constructor,i=s.toLowerCase();if(n.observedAttributes=n.observedAttributes||["classname","className","style"],n.observedAttributes.push(s),n.observedAttributes.push(i),i!==s&&Object.defineProperty(t,s,{get(){return this[i]},set(a){this[i]=a}}),e){const a=Symbol.for(s);Object.defineProperty(t,i,{get(){return this[a]},set(o){let g=o;e===Boolean&&typeof o=="string"&&o.toLowerCase()==="false"?g=!1:g=e(o),this[a]=g}})}}}function Te(e,t,s){return(n,i)=>{const a=b.get(n.constructor,"childQueries",[]);a.push({key:i,selector:e,all:s,refresh:t.refresh}),b.add(n.constructor,{childQueries:a})}}function Q(e,t={}){return Te(e,t)}function Ue(e,t={}){return Te(e,t,!0)}function oe(){return(e,t)=>{const s=Symbol(t);Object.defineProperties(e,{[s]:{writable:!0,enumerable:!1,configurable:!1,value:e[t]},[t]:{get(){return this[s]},set(n){this[s]!==n&&(this[s]=n,this.update())}}})}}exports.MIMEType=void 0;(function(e){e["7Z"]="application/x-7z-compressed",e.AAC="audio/aac",e.ABW="application/x-abiword",e.ARC="application/octet-stream",e.AVI="video/x-msvideo",e.AZW="application/vnd.amazon.ebook",e.BIN="application/octet-stream",e.BMP="image/bmp",e.BZ="application/x-bzip",e.BZ2="application/x-bzip2",e.CSH="application/x-csh",e.CSS="text/css",e.CSV="text/csv,application/vnd.ms-excel",e.DOC="application/msword",e.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",e.EOT="application/vnd.ms-fontobject",e.EPUB="application/epub+zip",e.ES="application/ecmascript",e.FLV="video/x-flv",e.GIF="image/gif",e.GZ="application/x-gzip",e.HTM="text/html",e.HTML="text/html",e.ICO="image/x-icon",e.ICS="text/calendar",e.JAR="application/java-archive",e.JPEG="image/jpeg",e.JPG="image/jpeg",e.JS="application/javascript",e.JSON="application/json",e.M3U="audio/x-mpequrl",e.MID="audio/midi",e.MIDI="audio/midi",e.MOV="video/quicktime",e.MP3="audio/mpeg3",e.MP4="video/mp4",e.MPEG="video/mpeg",e.MPKG="application/vnd.apple.installer+xml",e.ODP="application/vnd.oasis.opendocument.presentation",e.ODS="application/vnd.oasis.opendocument.spreadsheet",e.ODT="application/vnd.oasis.opendocument.text",e.OGA="audio/ogg",e.OGV="video/ogg",e.OGX="application/ogg",e.OTF="font/otf",e.PNG="image/png",e.PDF="application/pdf",e.PPT="application/vnd.ms-powerpoint",e.PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",e.RAR="application/x-rar-compressed",e.RTF="application/rtf",e.SH="application/x-sh",e.SVG="image/svg+xml",e.SWF="application/x-shockwave-flash",e.TAR="application/x-tar",e.TIF="image/tiff",e.TIFF="image/tiff",e.TS="application/typescript",e.TTF="font/ttf",e.TXT="text/plain",e.VSD="application/vnd.visio",e.WAV="audio/wav",e.WEBA="audio/webm",e.WEBM="video/webm",e.WEBP="image/webp",e.WOFF="font/woff",e.WOFF2="font/woff2",e.XHTML="application/xhtml+xml",e.XLS="application/vnd.ms-excel",e.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",e.XML="application/xml",e.XUL="application/vnd.mozilla.xul+xml",e.ZIP="application/zip"})(exports.MIMEType||(exports.MIMEType={}));var Tt=Object.defineProperty,Ut=Object.getOwnPropertyDescriptor,h=(e,t,s,n)=>{for(var i=n>1?void 0:n?Ut(t,s):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,s,i):o(i))||i);return n&&i&&Tt(t,s,i),i};const u="sps-file-upload";exports.SpsFileUploadComponent=class extends HTMLElement{constructor(){super();this.shown=!0,this.files=[],this.acceptMIMETypes=new Set,this.active=!1,this.error=!1,this.namesOfUnsupportedFiles=[],this.handleBrowseLinkClick=this.handleBrowseLinkClick.bind(this),this.handleDownloadButtonClick=this.handleDownloadButtonClick.bind(this),this.handleFileInputChange=this.handleFileInputChange.bind(this),this.dismiss=this.dismiss.bind(this)}get[D](){return[u,this.active&&`${u}--active`,this.error&&`${u}--error`,!this.shown&&`${u}--hidden`,this.mini&&`${u}--mini`,this.constrainContentWidth&&`${u}--constrained-content-width`]}connectedCallback(){this.description=this.description||(this.multiple?"Files":"File"),this.acceptExtensions&&this.processAcceptExtensions(this.acceptExtensions),this.maxSize&&this.parseAndValidateMaxSize(this.maxSize)}attributeChangedCallback(e,t,s){e==="acceptExtensions"&&this.processAcceptExtensions(s),e==="maxSize"&&this.parseAndValidateMaxSize(s)}dismiss(){this.dismissable&&(this.shown=!1,this.update(),this.dismissal.dispatch())}show(){this.dismissable&&(this.shown=!0,this.update())}render({t:e}){const t=this.error?T.SpsIcon.EXCLAMATION_CIRCLE:T.SpsIcon.UPLOAD_CLOUD,s=(this.multiple?e("design-system:fileUpload.instructions_plural"):e("design-system:fileUpload.instructions")).split("|");return r("div",{"data-fragment":!0},r("div",{className:`${u}__content`},this.processing?r("div",{"data-fragment":!0},r("i",{className:"sps-spinner sps-spinner--medium","aria-hidden":"true"}),r("div",{className:`${u}__instructions`},e("design-system:fileUpload.processing"))):r("div",{"data-fragment":!0},r("i",{className:`sps-icon sps-icon-${t} ${u}__icon-primary`,"aria-hidden":"true"}),r("div",{className:`${u}__title`},this.error?r("div",{"data-fragment":!0},e(this.namesOfUnsupportedFiles.length>1?"design-system:fileUpload.cancelled_plural":"design-system:fileUpload.cancelled")):r("div",{"data-fragment":!0},e("design-system:fileUpload.title",{description:this.description}))),this.error?r("div",{className:`${u}__errored-files`},new Set(this.namesOfUnsupportedFiles.map((n,i)=>{const a=Math.floor(n.length/2);return r("div",{className:`${u}__errored-filename`,key:n},r("span",{className:`${u}__errored-filename-segment`},n.substr(0,a)),r("div",{className:`${u}__errored-filename-segment`},r("span",null,n.substr(a))),i<this.namesOfUnsupportedFiles.length-1?",":"")}))):r("span",null),r("div",{className:`${u}__instructions`},r("div",{"data-fragment":!0},r("span",null,s[0]),r("a",{href:"",onClick:this.handleBrowseLinkClick},s[1]),r("span",null,s[2]))),r("div",{className:`${u}__requirements`},this.acceptExtensions?r("span",null,"("," ",e("design-system:fileUpload.acceptedTypes",{fileTypes:this.acceptExtensionsDescription})," ",")"):"",this.maxSize?r("span",null,"("," ",e("design-system:fileUpload.maximumSize",{size:this.maxSize})," ",")"):"",this.customRequirement?r("span",null," ",this.customRequirement," "):""),this.downloadLabel&&r("div",{className:`sps-button sps-button--link ${u}__download-button`,onClick:this.handleDownloadButtonClick},r("button",{type:"button"},r("i",{className:"sps-icon sps-icon-download-cloud","aria-hidden":"true"})," ",this.downloadLabel)))),this.dismissable&&!this.processing&&r("div",{className:`sps-button sps-button--icon ${u}__close-button`,onClick:this.dismiss},r("button",{type:"button",title:e("design-system:fileUpload.close")},r("i",{className:"sps-icon sps-icon-x","aria-hidden":"true"}))),r("form",null,r("input",{type:"file",accept:this.accept||"*/*",multiple:this.multiple||null,onChange:this.handleFileInputChange})))}parseAndValidateMaxSize(e){try{this.maxSizeBytes=l.parseFileSize(e)}catch{throw new Error(`Could not parse "${e}" as a file size.`)}}processAcceptExtensions(e){const s=(Array.isArray(e)?e:e.trim().split(/\s?,\s?/)).map(i=>i.replace(/^\./,"")),n=s.map(i=>`.${i}`.toLowerCase());this.acceptExtensionsDescription=n.map((i,a)=>a>0&&a===n.length-1?`or ${i}`:i).join(n.length>2?", ":" "),this.acceptMIMETypes.clear();for(const i of s)for(const a of exports.MIMEType[i.toUpperCase()].split(","))this.acceptMIMETypes.add(a);this.accept=n.concat(Array.from(this.acceptMIMETypes)).join(",")}selectFiles(e){this.namesOfUnsupportedFiles=[];const t=Array.from(e);for(const s of t)this.acceptExtensions&&!this.acceptMIMETypes.has(s.type)&&this.namesOfUnsupportedFiles.push(s.name),this.maxSize&&s.size>this.maxSizeBytes&&this.namesOfUnsupportedFiles.push(s.name);this.namesOfUnsupportedFiles.length?(this.error=!0,this.fileInput.value=null,this.update()):(this.files=t,this.selection.dispatch(t))}handleDragOver(e){e.preventDefault(),e.stopPropagation()}handleDragEnter(e){e.preventDefault(),this.active=!0,this.error=!1,this.update()}handleDragLeave(e){e.preventDefault(),this.active=!1,this.update()}handleDrop(e){e.preventDefault(),e.stopPropagation(),this.active=!1,e.dataTransfer.items?this.selectFiles(Array.from(e.dataTransfer.items).map(t=>t.getAsFile())):this.selectFiles(e.dataTransfer.files),this.update()}handleBrowseLinkClick(e){e.preventDefault(),this.error=!1,this.update(),this.fileInput.click()}handleDownloadButtonClick(){this.download.dispatch()}handleFileInputChange(e){e.stopPropagation(),this.selectFiles(e.target.files)}};exports.SpsFileUploadComponent.displayName=u;exports.SpsFileUploadComponent.props={description:"string",multiple:"boolean",dismissable:"boolean",processing:"boolean",mini:"boolean",downloadLabel:"string",acceptExtensions:"Array<string> | string",maxSize:"string",customRequirement:"string",selection:{event:!0,type:"CustomEvent<Array<File>>"},dismissal:{event:!0,type:"CustomEvent<void>"},download:{event:!0,type:"CustomEvent<void>"}};h([p()],exports.SpsFileUploadComponent.prototype,"description",2);h([p(Boolean)],exports.SpsFileUploadComponent.prototype,"multiple",2);h([p(Boolean)],exports.SpsFileUploadComponent.prototype,"shown",2);h([p(Boolean)],exports.SpsFileUploadComponent.prototype,"dismissable",2);h([p(Boolean)],exports.SpsFileUploadComponent.prototype,"processing",2);h([p(Boolean)],exports.SpsFileUploadComponent.prototype,"mini",2);h([p(Boolean)],exports.SpsFileUploadComponent.prototype,"constrainContentWidth",2);h([p()],exports.SpsFileUploadComponent.prototype,"downloadLabel",2);h([p()],exports.SpsFileUploadComponent.prototype,"acceptExtensions",2);h([p()],exports.SpsFileUploadComponent.prototype,"maxSize",2);h([p()],exports.SpsFileUploadComponent.prototype,"customRequirement",2);h([K()],exports.SpsFileUploadComponent.prototype,"selection",2);h([K()],exports.SpsFileUploadComponent.prototype,"dismissal",2);h([K()],exports.SpsFileUploadComponent.prototype,"download",2);h([Q("input[type='file']")],exports.SpsFileUploadComponent.prototype,"fileInput",2);h([j("dragover")],exports.SpsFileUploadComponent.prototype,"handleDragOver",1);h([j("dragenter")],exports.SpsFileUploadComponent.prototype,"handleDragEnter",1);h([j("dragleave")],exports.SpsFileUploadComponent.prototype,"handleDragLeave",1);h([j("drop")],exports.SpsFileUploadComponent.prototype,"handleDrop",1);exports.SpsFileUploadComponent=h([O({tag:u})],exports.SpsFileUploadComponent);const Ee={basic:{label:"Basic File Upload",description:l.code`
|
|
182
182
|
<p>Simply allow the user to drag-and-drop or select either a single file or multiple files at once.</p>
|
|
183
183
|
`,examples:{single:{description:"<p>Single file upload</p>",react:l.code`
|
|
184
184
|
function Component() {
|
|
@@ -428,7 +428,7 @@
|
|
|
428
428
|
</div>
|
|
429
429
|
)
|
|
430
430
|
}
|
|
431
|
-
`}}}};var
|
|
431
|
+
`}}}};var Et=Object.defineProperty,Bt=Object.getOwnPropertyDescriptor,F=(e,t,s,n)=>{for(var i=n>1?void 0:n?Bt(t,s):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,s,i):o(i))||i);return n&&i&&Et(t,s,i),i};exports.SpsNavTabComponent=class extends HTMLElement{constructor(){super(...arguments);this.active=!1,this.label="",this.tag=""}get[D](){return["sps-tabbed-nav__nav-item",this.active&&"sps-tabbed-nav__nav-item--active"]}render(){return r("a",{href:this.href,target:this.target,className:"sps-tabbed-nav__nav-item-link",tabIndex:0},this.icon&&r("i",{className:`sps-icon sps-icon-${this.icon}`}),this.label&&r("span",null,this.label),this.tag&&r("span",{className:"sps-tag sps-tag--default"},this.tag))}};exports.SpsNavTabComponent.displayName="sps-nav-tab";exports.SpsNavTabComponent.props={active:"boolean",label:"string",icon:"SpsIcon",tag:"string",href:"string",target:"string"};F([p()],exports.SpsNavTabComponent.prototype,"active",2);F([p()],exports.SpsNavTabComponent.prototype,"label",2);F([p()],exports.SpsNavTabComponent.prototype,"icon",2);F([p()],exports.SpsNavTabComponent.prototype,"tag",2);F([p()],exports.SpsNavTabComponent.prototype,"href",2);F([p()],exports.SpsNavTabComponent.prototype,"target",2);exports.SpsNavTabComponent=F([O({tag:"sps-nav-tab"})],exports.SpsNavTabComponent);var Rt=Object.defineProperty,$t=Object.getOwnPropertyDescriptor,Be=(e,t,s,n)=>{for(var i=n>1?void 0:n?$t(t,s):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,s,i):o(i))||i);return n&&i&&Rt(t,s,i),i};exports.SpsNavTabSetComponent=class extends HTMLElement{constructor(){super(...arguments);this.content=[]}render(){return r("nav",{className:"sps-tabbed-nav"},this.content)}};exports.SpsNavTabSetComponent.displayName="sps-nav-tab-set";exports.SpsNavTabSetComponent.props={};Be([X()],exports.SpsNavTabSetComponent.prototype,"content",2);exports.SpsNavTabSetComponent=Be([O({tag:"sps-nav-tab-set"})],exports.SpsNavTabSetComponent);const Re={basic:{label:"Basic Navigation Tabs",description:l.code`
|
|
432
432
|
<p>Navigation tabs native web component</p>
|
|
433
433
|
`,examples:{basic:{react:l.code`
|
|
434
434
|
function DemoComponent() {
|
|
@@ -455,7 +455,7 @@
|
|
|
455
455
|
</sps-nav-tab-set>
|
|
456
456
|
)
|
|
457
457
|
}
|
|
458
|
-
`}}}};var jt=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,y=(e,t,s,n)=>{for(var i=n>1?void 0:n?zt(t,s):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,s,i):o(i))||i);return n&&i&&jt(t,s,i),i};exports.SpsPhotoDisplayMode=void 0;(function(e){e.FIT="fit",e.FILL="fill"})(exports.SpsPhotoDisplayMode||(exports.SpsPhotoDisplayMode={}));const k="sps-photo";exports.SpsPhotoComponent=class extends HTMLElement{constructor(){super(...arguments);this.mode=exports.SpsPhotoDisplayMode.FILL}get image(){return this.imageInternal}set image(e){this.imageInternal=e,e&&(this.waitForImgHeightInterval&&window.clearInterval(this.waitForImgHeightInterval),this.waitForImgHeightInterval=window.setInterval(()=>{const t=e.getBoundingClientRect();if(t.height){window.clearInterval(this.waitForImgHeightInterval),delete this.waitForImgHeightInterval;let s=!0;s=t.width/t.height>1,this.fitWidth=s===(this.mode===exports.SpsPhotoDisplayMode.FIT)}},1e3/60))}get[D](){return[k,this.fitWidth?`${k}--fit-width`:`${k}--fit-height`,this.placeholderIcon&&`${k}--placeholder`]}get[
|
|
458
|
+
`}}}};var jt=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,y=(e,t,s,n)=>{for(var i=n>1?void 0:n?zt(t,s):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,s,i):o(i))||i);return n&&i&&jt(t,s,i),i};exports.SpsPhotoDisplayMode=void 0;(function(e){e.FIT="fit",e.FILL="fill"})(exports.SpsPhotoDisplayMode||(exports.SpsPhotoDisplayMode={}));const k="sps-photo";exports.SpsPhotoComponent=class extends HTMLElement{constructor(){super(...arguments);this.mode=exports.SpsPhotoDisplayMode.FILL}get image(){return this.imageInternal}set image(e){this.imageInternal=e,e&&(this.waitForImgHeightInterval&&window.clearInterval(this.waitForImgHeightInterval),this.waitForImgHeightInterval=window.setInterval(()=>{const t=e.getBoundingClientRect();if(t.height){window.clearInterval(this.waitForImgHeightInterval),delete this.waitForImgHeightInterval;let s=!0;s=t.width/t.height>1,this.fitWidth=s===(this.mode===exports.SpsPhotoDisplayMode.FIT)}},1e3/60))}get[D](){return[k,this.fitWidth?`${k}--fit-width`:`${k}--fit-height`,this.placeholderIcon&&`${k}--placeholder`]}get[G](){return{fontSize:`${this.width*.05}rem`,width:`${this.width}rem`,height:`${.75*this.width}rem`}}connectedCallback(){this.waitForWidthInterval=window.setInterval(()=>{const e=this.getBoundingClientRect();e.width&&(this.setWidth(e.width),window.clearInterval(this.waitForWidthInterval),delete this.waitForWidthInterval)},1e3/60)}disconnectedCallback(){this.waitForWidthInterval&&window.clearInterval(this.waitForWidthInterval),this.waitForImgHeightInterval&&window.clearInterval(this.waitForImgHeightInterval)}render(){return this.src?this.width?r("img",{src:this.src,alt:this.altText}):r("span",null):r("i",{className:`sps-icon sps-icon-${this.placeholderIcon}`})}setWidth(e){if(e&&!this.width){const t=document.body.parentElement.style.fontSize||"16px",s=Number(t.substr(0,t.length-2));this.width=e/s}}};exports.SpsPhotoComponent.displayName=k;exports.SpsPhotoComponent.props={src:"string",altText:"string",mode:"SpsPhotoDisplayMode",placeholderIcon:"SpsIcon"};y([p()],exports.SpsPhotoComponent.prototype,"src",2);y([p()],exports.SpsPhotoComponent.prototype,"altText",2);y([p()],exports.SpsPhotoComponent.prototype,"mode",2);y([p()],exports.SpsPhotoComponent.prototype,"placeholderIcon",2);y([oe()],exports.SpsPhotoComponent.prototype,"width",2);y([oe()],exports.SpsPhotoComponent.prototype,"fitWidth",2);y([Q("img",{refresh:!0})],exports.SpsPhotoComponent.prototype,"image",1);exports.SpsPhotoComponent=y([O({tag:k})],exports.SpsPhotoComponent);const $e={sizing:{label:"Sizing",description:l.code`
|
|
459
459
|
<p>
|
|
460
460
|
Photos are block elements, so a photo fills its container's width unless
|
|
461
461
|
an explicit width is set. It is always a 4:3 aspect ratio. In this example,
|
|
@@ -544,7 +544,7 @@
|
|
|
544
544
|
<sps-photo placeholderIcon="building"></sps-photo>
|
|
545
545
|
</div>
|
|
546
546
|
</div>
|
|
547
|
-
`}}}},Wt={"File Upload":{components:[exports.SpsFileUploadComponent],examples:
|
|
547
|
+
`}}}},Wt={"File Upload":{components:[exports.SpsFileUploadComponent],examples:Ee},"Tabbed Navigation":{components:[exports.SpsNavTabComponent,exports.SpsNavTabSetComponent],examples:Re},Photos:{components:[exports.SpsPhotoComponent],examples:$e}};var Ht=Object.defineProperty,qt=Object.getOwnPropertyDescriptor,N=(e,t,s,n)=>{for(var i=n>1?void 0:n?qt(t,s):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,s,i):o(i))||i);return n&&i&&Ht(t,s,i),i};const w="sps-insight-card";exports.SpsInsightCardComponent=class extends HTMLElement{constructor(){super(...arguments);this.kind=T.SpsInsightCardKind.GENERAL}get[D](){return[w,`${w}--${this.kind}`,this.detail&&this.detail.children.length?`${w}--has-detail`:null]}render({t:e}){const t=r("div",{className:`${w}__metric-count`},this.metric),s=r("div",{className:`${w}__description`},r("div",{className:`${w}__title`,style:{"-webkit-box-orient":"vertical"}},this.title),r("div",{className:`${w}__detail`},this.content)),[n,i,a]=(this.partnerCount?e("design-system:insightCard.partnerCount",{count:this.partnerCount,total:this.totalPartners}):"").split("|");return r("div",{"data-fragment":!0},r("div",{className:`${w}__body`},this.icon?r("i",{className:`sps-icon sps-icon-${this.icon}`}):r("i",{className:`sps-icon sps-icon-${T.SpsInsightCardIcons[this.kind]}`}),t,s),this.partnerCount&&r("div",{className:`${w}__partner-count`},this.partnerCount===this.totalPartners?r("div",null,e("design-system:insightCard.all")):r("div",{"data-fragment":!0},r("div",null,n),r("div",null,i),r("div",null,a)),r("div",{className:`${w}__partners-text`},e("design-system:insightCard.partners"))))}};exports.SpsInsightCardComponent.displayName=w;exports.SpsInsightCardComponent.props={icon:"SpsIcon",kind:"SpsInsightCardKind",title:"string",metric:"number",partnerCount:"number",totalPartners:"number",secondary:"boolean"};N([p()],exports.SpsInsightCardComponent.prototype,"icon",2);N([p()],exports.SpsInsightCardComponent.prototype,"kind",2);N([p()],exports.SpsInsightCardComponent.prototype,"title",2);N([p()],exports.SpsInsightCardComponent.prototype,"metric",2);N([p()],exports.SpsInsightCardComponent.prototype,"partnerCount",2);N([p()],exports.SpsInsightCardComponent.prototype,"totalPartners",2);N([p()],exports.SpsInsightCardComponent.prototype,"secondary",2);N([X()],exports.SpsInsightCardComponent.prototype,"content",2);N([Q(`.${w}__detail`)],exports.SpsInsightCardComponent.prototype,"detail",2);exports.SpsInsightCardComponent=N([O({tag:w})],exports.SpsInsightCardComponent);var Gt=Object.defineProperty,Xt=Object.getOwnPropertyDescriptor,le=(e,t,s,n)=>{for(var i=n>1?void 0:n?Xt(t,s):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,s,i):o(i))||i);return n&&i&&Gt(t,s,i),i};const A="sps-insights";exports.SpsInsightsComponent=class extends HTMLElement{constructor(){super();this.content=[],this.showAdditionalInsights=!1,this.toggleAdditionalInsights=this.toggleAdditionalInsights.bind(this)}get[D](){return[A,this.showAdditionalInsights&&`${A}--show-additional`,this.details&&Array.from(this.details).every(e=>!e.textContent)?`${A}--no-details`:null,this.content.length===6?`${A}--break-4`:null,this.content.length===7?`${A}--break-5`:null,this.content.length===8?`${A}--break-5`:null]}toggleAdditionalInsights(){this.showAdditionalInsights=!this.showAdditionalInsights,this.update()}render(){return r("div",{"data-fragment":!0},this.content,this.content.length>10&&r("div",{className:"sps-button sps-button--link",onClick:this.toggleAdditionalInsights},r("button",{type:"button"},this.showAdditionalInsights?"Hide ":"Show ","Additional Insights")))}};exports.SpsInsightsComponent.displayName=A;exports.SpsInsightsComponent.props={};le([X()],exports.SpsInsightsComponent.prototype,"content",2);le([Ue(".sps-insight-card__detail")],exports.SpsInsightsComponent.prototype,"details",2);exports.SpsInsightsComponent=le([O({tag:A})],exports.SpsInsightsComponent);const Kt={basic:{label:"Basic Insight Cards",examples:{basic:{jsx:l.code`
|
|
548
548
|
<sps-insights>
|
|
549
549
|
<sps-insight-card kind="general"
|
|
550
550
|
metric="1234"
|
|
@@ -826,4 +826,4 @@
|
|
|
826
826
|
</sps-insights>
|
|
827
827
|
)
|
|
828
828
|
}
|
|
829
|
-
`}}}};exports.AttrBindings=re;exports.ClassBindings=D;exports.Component=O;exports.Content=X;exports.EventDispatcher=K;exports.EventListener=j;exports.MANIFEST=Wt;exports.Prop=
|
|
829
|
+
`}}}};exports.AttrBindings=re;exports.ClassBindings=D;exports.Component=O;exports.Content=X;exports.EventDispatcher=K;exports.EventListener=j;exports.MANIFEST=Wt;exports.Prop=p;exports.QuerySelector=Q;exports.QuerySelectorAll=Ue;exports.SpsFileUploadExamples=Ee;exports.SpsInsightCardExamples=Kt;exports.SpsNavTabsExamples=Re;exports.SpsPhotoExamples=$e;exports.StyleBindings=G;exports.Watch=oe;exports.h=r;exports.namespaceOverrideRegistrar=Lt;exports.register=Ft;exports.webComponentsUseI18n=Dt;
|
package/lib/index.es.js
CHANGED
|
@@ -1400,11 +1400,7 @@ let SpsFileUploadComponent = class extends HTMLElement {
|
|
|
1400
1400
|
onClick: this.handleBrowseLinkClick
|
|
1401
1401
|
}, instructions[1]), /* @__PURE__ */ h("span", null, instructions[2]))), /* @__PURE__ */ h("div", {
|
|
1402
1402
|
className: `${CPT_NAME$3}__requirements`
|
|
1403
|
-
}, this.acceptExtensions ? /* @__PURE__ */ h("div", {
|
|
1404
|
-
"data-fragment": true
|
|
1405
|
-
}, "(", " ", t("design-system:fileUpload.acceptedTypes", { fileTypes: this.acceptExtensionsDescription }), " ", ")") : "", this.maxSize ? /* @__PURE__ */ h("div", {
|
|
1406
|
-
"data-fragment": true
|
|
1407
|
-
}, "(", t("design-system:fileUpload.maximumSize", { size: this.maxSize }), " ", ")") : ""), this.downloadLabel && /* @__PURE__ */ h("div", {
|
|
1403
|
+
}, this.acceptExtensions ? /* @__PURE__ */ h("span", null, "(", " ", t("design-system:fileUpload.acceptedTypes", { fileTypes: this.acceptExtensionsDescription }), " ", ")") : "", this.maxSize ? /* @__PURE__ */ h("span", null, "(", " ", t("design-system:fileUpload.maximumSize", { size: this.maxSize }), " ", ")") : "", this.customRequirement ? /* @__PURE__ */ h("span", null, " ", this.customRequirement, " ") : ""), this.downloadLabel && /* @__PURE__ */ h("div", {
|
|
1408
1404
|
className: `sps-button sps-button--link ${CPT_NAME$3}__download-button`,
|
|
1409
1405
|
onClick: this.handleDownloadButtonClick
|
|
1410
1406
|
}, /* @__PURE__ */ h("button", {
|
|
@@ -1518,6 +1514,7 @@ SpsFileUploadComponent.props = {
|
|
|
1518
1514
|
downloadLabel: "string",
|
|
1519
1515
|
acceptExtensions: "Array<string> | string",
|
|
1520
1516
|
maxSize: "string",
|
|
1517
|
+
customRequirement: "string",
|
|
1521
1518
|
selection: { event: true, type: "CustomEvent<Array<File>>" },
|
|
1522
1519
|
dismissal: { event: true, type: "CustomEvent<void>" },
|
|
1523
1520
|
download: { event: true, type: "CustomEvent<void>" }
|
|
@@ -1552,6 +1549,9 @@ __decorateClass$5([
|
|
|
1552
1549
|
__decorateClass$5([
|
|
1553
1550
|
Prop()
|
|
1554
1551
|
], SpsFileUploadComponent.prototype, "maxSize", 2);
|
|
1552
|
+
__decorateClass$5([
|
|
1553
|
+
Prop()
|
|
1554
|
+
], SpsFileUploadComponent.prototype, "customRequirement", 2);
|
|
1555
1555
|
__decorateClass$5([
|
|
1556
1556
|
EventDispatcher()
|
|
1557
1557
|
], SpsFileUploadComponent.prototype, "selection", 2);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spscommerce/ds-web-components",
|
|
3
3
|
"description": "SPS Design System Native Web Components",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.35.0",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/spscommerce/design-system/tree/main/packages/@spscommerce/ds-web-components",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"incremental-dom": "^0.6.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@spscommerce/ds-shared": "4.
|
|
20
|
-
"@spscommerce/utils": "4.
|
|
19
|
+
"@spscommerce/ds-shared": "4.35.0",
|
|
20
|
+
"@spscommerce/utils": "4.35.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@spscommerce/ds-shared": "4.
|
|
24
|
-
"@spscommerce/utils": "4.
|
|
23
|
+
"@spscommerce/ds-shared": "4.35.0",
|
|
24
|
+
"@spscommerce/utils": "4.35.0"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "pnpm run build:js && pnpm run build:types && pnpm run build:create-dist && pnpm run build:copy-dist",
|