@spscommerce/ds-web-components 8.33.10 → 8.34.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 +1 -3
- package/dist/lib/components/insight-card/insight-card.d.ts +1 -3
- package/dist/lib/decorators/component.d.ts +1 -2
- package/dist/lib/index.d.ts +0 -1
- package/dist/lib/index.js +352 -359
- package/dist/lib/index.umd.cjs +17 -17
- package/dist/lib/utils/index.d.ts +0 -1
- package/dist/package.json +3 -1
- package/lib/components/file-upload/file-upload.d.ts +1 -3
- package/lib/components/insight-card/insight-card.d.ts +1 -3
- package/lib/decorators/component.d.ts +1 -2
- package/lib/index.d.ts +0 -1
- package/lib/index.js +352 -359
- package/lib/index.umd.cjs +17 -17
- package/lib/utils/index.d.ts +0 -1
- package/package.json +6 -4
- package/dist/lib/utils/i18n.d.ts +0 -3
- package/lib/utils/i18n.d.ts +0 -3
package/lib/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(i,
|
|
1
|
+
(function(i,L){typeof exports=="object"&&typeof module<"u"?L(exports,require("@spscommerce/ds-shared"),require("@spscommerce/utils"),require("@spscommerce/i18n")):typeof define=="function"&&define.amd?define(["exports","@spscommerce/ds-shared","@spscommerce/utils","@spscommerce/i18n"],L):(i=typeof globalThis<"u"?globalThis:i||self,L(i.DSWebComponents={},i.dsShared,i.utils,i.i18n))})(this,function(i,L,f,D){"use strict";const Ke={};var g={},_e;function Qe(){if(_e)return g;_e=1,Object.defineProperty(g,"__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 t=Object.prototype.hasOwnProperty;function
|
|
31
|
+
*/var t=Object.prototype.hasOwnProperty;function a(){}a.prototype=Object.create(null);function r(n,s){return t.call(n,s)}function l(){return new a}function p(n,s){for(;n.length>s;)n.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 u(n){if(n.lastIndexOf("xml:",0)===0)return"http://www.w3.org/XML/1998/namespace";if(n.lastIndexOf("xlink:",0)===0)return"http://www.w3.org/1999/xlink"}function
|
|
46
|
+
*/function u(n){if(n.lastIndexOf("xml:",0)===0)return"http://www.w3.org/XML/1998/namespace";if(n.lastIndexOf("xlink:",0)===0)return"http://www.w3.org/1999/xlink"}function R(n,s,o){if(o==null)n.removeAttribute(s);else{var c=u(s);c?n.setAttributeNS(c,s,String(o)):n.setAttribute(s,String(o))}}function xe(n,s,o){n[s]=o}function mt(n,s,o){s.indexOf("-")>=0?n.setProperty(s,o):n[s]=o}function gt(n,s,o){if(typeof o=="string")n.style.cssText=o;else{n.style.cssText="";var c=n.style;for(var h in o)r(o,h)&&mt(c,h,o[h])}}function vt(n,s,o){var c=typeof o;c==="object"||c==="function"?xe(n,s,o):R(n,s,o)}var K=l();K[e.default]=vt,K.style=gt;function Q(n,s,o){var c=K[s]||K[e.default];c(n,s,o)}/**
|
|
47
47
|
* @license
|
|
48
48
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
49
49
|
*
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
59
59
|
* See the License for the specific language governing permissions and
|
|
60
60
|
* limitations under the License.
|
|
61
|
-
*/var
|
|
61
|
+
*/var Z=!1,ge=!1;function Fe(n,s){if(!s)throw new Error("Cannot call "+n+"() unless in patch.")}function Ct(n,s){if(n!==s){for(var o=n,c=[];o&&o!==s;)c.push(o.nodeName.toLowerCase()),o=o.parentNode;throw new Error(`One or more tags were not closed:
|
|
62
62
|
`+c.join(`
|
|
63
|
-
`))}}function
|
|
63
|
+
`))}}function bt(n){n||console.warn("patchOuter requires the node have a parent if there is a key.")}function H(n){if(Z)throw new Error(n+"() can not be called between elementOpenStart() and elementOpenEnd().")}function ke(n){if(ge)throw new Error(n+"() may not be called inside an element that has called skip().")}function ve(n){if(!Z)throw new Error(n+"() can only be called after calling elementOpenStart().")}function wt(){if(Z)throw new Error("elementOpenEnd() must be called after calling elementOpenStart().")}function St(n,s){if(n!==s)throw new Error('Received a call to close "'+s+'" but "'+n+'" was open.')}function _t(n,s){if(s!==null)throw new Error(n+"() must come before any child declarations inside the current element.")}function Nt(n,s,o,c){ie(n);var h=n,m=s,y=m.nextSibling===o&&m.previousSibling===c,b=m.nextSibling===h.nextSibling&&m.previousSibling===c,A=m===h;if(!y&&!b&&!A)throw new Error("There must be exactly one top level call corresponding to the patched element.")}function ne(n){var s=Z;return Z=n,s}function se(n){var s=ge;return ge=n,s}function ie(n){if(process.env.NODE_ENV!=="production"&&!n)throw new Error("Expected value to be defined");return n}/**
|
|
64
64
|
* @license
|
|
65
65
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
66
66
|
*
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
76
76
|
* See the License for the specific language governing permissions and
|
|
77
77
|
* limitations under the License.
|
|
78
|
-
*/var
|
|
78
|
+
*/var Y={nodesCreated:null,nodesDeleted:null};/**
|
|
79
79
|
* @license
|
|
80
80
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
81
81
|
*
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
91
91
|
* See the License for the specific language governing permissions and
|
|
92
92
|
* limitations under the License.
|
|
93
|
-
*/var
|
|
93
|
+
*/var yt=function(){function n(){this.created=[],this.deleted=[]}return n.prototype.markCreated=function(s){this.created.push(s)},n.prototype.markDeleted=function(s){this.deleted.push(s)},n.prototype.notifyChanges=function(){Y.nodesCreated&&this.created.length>0&&Y.nodesCreated(this.created),Y.nodesDeleted&&this.deleted.length>0&&Y.nodesDeleted(this.deleted)},n}();/**
|
|
94
94
|
* @license
|
|
95
95
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
96
96
|
*
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
106
106
|
* See the License for the specific language governing permissions and
|
|
107
107
|
* limitations under the License.
|
|
108
|
-
*/function
|
|
108
|
+
*/function At(n){return n.nodeType===11||n.nodeType===9}function Ce(n){return n.nodeType===1}function Ot(n){return n.nodeType===3}function Dt(n,s){for(var o=[],c=n;c!==s;){var h=c;o.push(h),c=h.parentNode}return o}var Pt=Node.prototype.getRootNode||function(){for(var n=this,s=n;n;)s=n,n=n.parentNode;return s};function Et(n){var s=Pt.call(n);return At(s)?s.activeElement:null}function It(n,s){var o=Et(n);return!o||!n.contains(o)?[]:Dt(o,s)}function xt(n,s,o){for(var c=s.nextSibling,h=o;h!==null&&h!==s;){var m=h.nextSibling;n.insertBefore(h,c),h=m}}/**
|
|
109
109
|
* @license
|
|
110
110
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
111
111
|
*
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
121
121
|
* See the License for the specific language governing permissions and
|
|
122
122
|
* limitations under the License.
|
|
123
|
-
*/var
|
|
123
|
+
*/var Ft=function(){function n(s,o,c){this._attrsArr=null,this.staticsApplied=!1,this.nameOrCtor=s,this.key=o,this.text=c}return n.prototype.hasEmptyAttrsArr=function(){var s=this._attrsArr;return!s||!s.length},n.prototype.getAttrsArr=function(s){return this._attrsArr||(this._attrsArr=new Array(s))},n}();function be(n,s,o,c){var h=new Ft(s,o,c);return n.__incrementalDOMData=h,h}function q(n,s){return Le(n,s)}function kt(n){return!!n.__incrementalDOMData}function Lt(n){return ie(n.__incrementalDOMData),q(n).key}function Le(n,s){if(n.__incrementalDOMData)return n.__incrementalDOMData;var o=Ce(n)?n.localName:n.nodeName,c=Ce(n)?n.getAttribute("key")||s:null,h=Ot(n)?n.data:void 0,m=be(n,o,c,h);return Ce(n)&&Tt(n,m),m}function Te(n){Le(n);for(var s=n.firstChild;s;s=s.nextSibling)Te(s)}function Ue(n){n.__incrementalDOMData=null;for(var s=n.firstChild;s;s=s.nextSibling)Ue(s)}function Tt(n,s){var o=n.attributes,c=o.length;if(c)for(var h=s.getAttrsArr(c),m=0,y=0;m<c;m+=1,y+=2){var b=o[m],A=b.name,_=b.value;h[y]=A,h[y+1]=_}}/**
|
|
124
124
|
* @license
|
|
125
125
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
126
126
|
*
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
136
136
|
* See the License for the specific language governing permissions and
|
|
137
137
|
* limitations under the License.
|
|
138
|
-
*/function
|
|
138
|
+
*/function Ut(n,s){return n==="svg"?"http://www.w3.org/2000/svg":n==="math"?"http://www.w3.org/1998/Math/MathML":s==null||q(s).nameOrCtor==="foreignObject"?null:s.namespaceURI}function Rt(n,s,o,c){var h;if(typeof o=="function")h=new o;else{var m=Ut(o,s);m?h=n.createElementNS(m,o):h=n.createElement(o)}return be(h,o,c),h}function $t(n){var s=n.createTextNode("");return be(s,"#text",null),s}/**
|
|
139
139
|
* @license
|
|
140
140
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
141
141
|
*
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
151
151
|
* See the License for the specific language governing permissions and
|
|
152
152
|
* limitations under the License.
|
|
153
|
-
*/var
|
|
153
|
+
*/var G=null,C=null,N=null,z=null,ae=[],re=[];function oe(){return re}function Re(n){var s=function(o,c,h){var m=G,y=z,b=ae,A=re,_=C,I=N,k=!1,ce=!1;G=new yt,z=o.ownerDocument,re=[],N=o.parentNode,ae=It(o,N),process.env.NODE_ENV!=="production"&&(k=ne(!1),ce=se(!1));try{var Mt=n(o,c,h);return process.env.NODE_ENV!=="production"&&wt(),Mt}finally{z=y,re=A,C=_,N=I,ae=b,G.notifyChanges(),ne(k),se(ce),G=m}};return s}var $e=Re(function(n,s,o){return C=n,ze(),s(o),Ve(),process.env.NODE_ENV!=="production"&&Ct(C,n),n}),Bt=Re(function(n,s,o){var c={nextSibling:n},h=null,m=null;return process.env.NODE_ENV!=="production"&&(h=n.nextSibling,m=n.previousSibling),C=c,s(o),process.env.NODE_ENV!=="production"&&(bt(N),Nt(c,C,h,m)),N&&We(N,le(),n.nextSibling),c===C?null:C});function Be(n,s,o){var c=q(n,o);return s==c.nameOrCtor&&o==c.key}function jt(n,s,o){if(!n)return null;if(Be(n,s,o))return n;if(o){for(;n=n.nextSibling;)if(Be(n,s,o))return n}return null}function Wt(n,s){var o;return n==="#text"?o=$t(z):o=Rt(z,N,n,s),G.markCreated(o),o}function je(n,s){var o=jt(C,n,s),c=o||Wt(n,s);c!==C&&(ae.indexOf(c)>=0?xt(N,c,C):N.insertBefore(c,C),C=c)}function We(n,s,o){for(var c=n,h=s;h!==o;){var m=h.nextSibling;c.removeChild(h),G.markDeleted(h),h=m}}function ze(){N=C,C=null}function le(){return C?C.nextSibling:N.firstChild}function we(){C=le()}function Ve(){We(N,le(),null),C=N,N=N.parentNode}function He(n,s){return we(),je(n,s),ze(),N}function qe(){return process.env.NODE_ENV!=="production"&&se(!1),Ve(),C}function zt(){return we(),je("#text",null),C}function Vt(){return process.env.NODE_ENV!=="production"&&(Fe("currentElement",z),H("currentElement")),N}function Ht(){return process.env.NODE_ENV!=="production"&&(Fe("currentPointer",z),H("currentPointer")),le()}function qt(){process.env.NODE_ENV!=="production"&&(_t("skip",C),se(!0)),C=N.lastChild}/**
|
|
154
154
|
* @license
|
|
155
155
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
156
156
|
*
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
166
166
|
* See the License for the specific language governing permissions and
|
|
167
167
|
* limitations under the License.
|
|
168
|
-
*/var Ge=3,
|
|
168
|
+
*/var Ge=3,x=l();function Gt(n,s,o){if(s.staticsApplied=!0,!(!o||!o.length)){if(s.hasEmptyAttrsArr()){for(var c=0;c<o.length;c+=2)Q(n,o[c],o[c+1]);return}for(var c=0;c<o.length;c+=2)x[o[c]]=c+1;for(var h=s.getAttrsArr(0),m=0,c=0;c<h.length;c+=2){var y=h[c],b=h[c+1],A=x[y];if(A){o[A]===b&&delete x[y];continue}h[m]=y,h[m+1]=b,m+=2}p(h,m);for(var y in x)Q(n,y,o[x[y]]),delete x[y]}}function Se(n,s,o){process.env.NODE_ENV!=="production"&&(H("elementOpen"),ke("elementOpen"));var c=He(n,s),h=q(c);h.staticsApplied||Gt(c,h,o);var m=Math.max(0,arguments.length-Ge),y=h.hasEmptyAttrsArr();if(!m&&y)return c;for(var b=h.getAttrsArr(m),A=Ge,_=0;A<arguments.length;A+=2,_+=2){var I=arguments[A];if(y)b[_]=I;else if(b[_]!==I)break;var k=arguments[A+1];(y||b[_+1]!==k)&&(b[_+1]=k,Q(c,I,k))}if(A<arguments.length||_<b.length){for(var ce=_;_<b.length;_+=2)x[b[_]]=b[_+1];for(_=ce;A<arguments.length;A+=2,_+=2){var I=arguments[A],k=arguments[A+1];x[I]!==k&&Q(c,I,k),b[_]=I,b[_+1]=k,delete x[I]}p(b,_);for(var I in x)Q(c,I,void 0),delete x[I]}return c}function Xt(n,s,o){var c=oe();process.env.NODE_ENV!=="production"&&(H("elementOpenStart"),ne(!0)),c[0]=n,c[1]=s,c[2]=o}function Kt(n){var s=oe();process.env.NODE_ENV!=="production"&&(ve("key"),ie(s)),s[1]=n}function Qt(n,s){var o=oe();process.env.NODE_ENV!=="production"&&ve("attr"),o.push(n),o.push(s)}function Zt(){var n=oe();process.env.NODE_ENV!=="production"&&(ve("elementOpenEnd"),ne(!1)),ie(n);var s=Se.apply(null,n);return p(n,0),s}function Xe(n){process.env.NODE_ENV!=="production"&&H("elementClose");var s=qe();return process.env.NODE_ENV!=="production"&&St(q(s).nameOrCtor,n),s}function Yt(n,s,o){return Se.apply(null,arguments),Xe(n)}function Jt(n){process.env.NODE_ENV!=="production"&&(H("text"),ke("text"));var s=zt(),o=q(s);if(o.text!==n){o.text=n;for(var c=n,h=1;h<arguments.length;h+=1){var m=arguments[h];c=m(c)}s.data=c}return s}/**
|
|
169
169
|
* @license
|
|
170
170
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
171
171
|
*
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
181
181
|
* See the License for the specific language governing permissions and
|
|
182
182
|
* limitations under the License.
|
|
183
|
-
*/return g.applyAttr=U,g.applyProp=te,g.attributes=X,g.close=qe,g.currentElement=qt,g.currentPointer=Gt,g.open=He,g.patch=$e,g.patchInner=$e,g.patchOuter=zt,g.skip=Xt,g.skipNode=we,g.getKey=Ut,g.clearCache=Ue,g.importNode=Te,g.isDataInitialized=Tt,g.notifications=Z,g.symbols=e,g.attr=Yt,g.elementClose=Xe,g.elementOpen=Se,g.elementOpenEnd=Jt,g.elementOpenStart=Qt,g.elementVoid=Mt,g.text=en,g.key=Zt,g}var O=Qe();function Ne(e){let t=O.currentPointer();return t instanceof Comment&&t.data!==e?t.data=e:(t=document.createComment(e),O.currentElement().appendChild(t)),O.skipNode(),t}let ye=k.noI18nI18n;function Ze(e){ye=e}function Ye(){return ye}const R=Symbol("ComponentMetadata"),D=Object.freeze({has(e,t){return!!(e[R]&&Object.prototype.hasOwnProperty.call(e[R],t))},add(e,t){e[R]?Object.assign(e[R],t):e[R]=t},get(e,t,o){return e[R]&&e[R][t]||o}}),Ae=Symbol("ds-web-components:pragma:listeners-attached"),Oe="idom-pragma:content-begin",pe="idom-pragma:content-end";function de(e){for(const t of e)if(typeof t=="function")t();else if(typeof t=="string")O.text(t);else if(t instanceof Set)de(Array.from(t));else if(Array.isArray(t)&&t.length>0){let o=O.currentPointer();if(Ne(Oe),o===null){const l=O.currentElement();for(let a=0;a<t.length;a+=1)l.contains(t[a])||l.appendChild(t[a]),O.skipNode()}for(;o&&o.data!==pe;)O.skipNode(),o=O.currentPointer();Ne(pe)}}function d(e,t,...o){if(t){for(const l of Object.keys(t))if(l.toUpperCase()==="DATA-FRAGMENT")return()=>de(o)}return()=>{O.elementOpenStart(e);const l=[];if(t)for(const p of Object.keys(t))p.toUpperCase()==="CLASSNAME"?O.attr("class",t[p]):/^on[A-Z]/.test(p)?l.push(p):O.attr(p,t[p]);O.elementOpenEnd(e);const a=O.currentElement();if(!a[Ae]){for(const p of l)a.addEventListener(p.substr(2).toLowerCase(),t[p]);a[Ae]=!0}de(o),O.elementClose(e)}}function De(e,t){customElements.get(e)||customElements.define(e,t)}function Je(...e){for(const t of e)De(D.get(t,"tag"),t)}function Me(e){return function(...o){for(const l of o){const a=`${e}${D.get(l,"tag").substr(3)}`;De(a,l)}}}const he=Symbol("Component Attribute Bindings"),$=Symbol("Component Class Bindings"),Y=Symbol("Component Style Bindings"),et={__initialized:!1,__observer:null,__queuedUpdate:null,__managedClasses:new Set,__updateHostBindings(){const e=this;for(const t of Object.keys(e[he]||{}))e.setAttribute(t,e[he][t]);for(const t of Object.keys(e[Y]||{}))e.style[t]=e[Y][t];for(const t of e.__managedClasses)e.classList.remove(t);for(const t of(e[$]||[]).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 o of D.get(t.constructor,"childQueries",[]))if(!e||e&&o.refresh){const l=o.all?t.querySelectorAll:t.querySelector;t[o.key]=l.call(t,o.selector)}},__gatherChildren(){const e=this;let t=Array.from(e.childNodes),o=null,l=t.length;for(let a=0;a<t.length;a+=1){const p=t[a];p instanceof Comment&&(p.data===Oe?o=a+1:p.data===pe&&(l=a-1))}if(o===null)for(const a of t)a.parentNode.removeChild(a);else t=t.slice(o,l);D.has(e.constructor,"contentProp")&&(e[D.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(),O.patch(e,e.render(Ye())),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,o){const l=this,a=o===""?!0:o;a!==t&&(l.__cbAttributeChanged&&l.__cbAttributeChanged(e,l[e],a),e!=="style"&&(l[e]=a),l.__initialized&&l.update())},connectedCallback(){const e=this;e.__cbConnected&&e.__cbConnected();const t=D.get(e.constructor,"eventListeners",[]);setTimeout(()=>{if(!e.__initialized){e.__gatherChildren();for(const[,o]of t)e[o]=e[o].bind(e);e.__initialized=!0}for(const[o,l]of t)e.addEventListener(o,e[l]);e.__doRender(),setTimeout(()=>{e.__updateChildQueries(),e.__updateHostBindings()},0)},0)},disconnectedCallback(){const e=this;e.__cbDisconnected&&e.__cbDisconnected();for(const[t,o]of D.get(e.constructor,"eventListeners",[]))e.removeEventListener(t,e[o]);e.__stopMutObs()}};function B(e){return t=>{D.add(t,e),Object.assign(t.prototype,{__cbAttributeChanged:t.prototype.attributeChangedCallback,__cbConnected:t.prototype.connectedCallback,__cbDisconnected:t.prototype.disconnectedCallback},et)}}function J(){return(e,t)=>{D.add(e.constructor,{contentProp:t})}}function M(e){return(t,o)=>{Object.defineProperty(t,o,{get(){return Object.defineProperty(this,o,{value:{dispatch:l=>{const a=new CustomEvent(e||o,{detail:l});return this.dispatchEvent(a),a}}}),this[o]},configurable:!0})}}function G(e){return(t,o)=>{const l=D.get(t.constructor,"eventListeners",[]);l.push([e,o]),D.add(t.constructor,{eventListeners:l})}}function v(e){return(t,o)=>{const l=t.constructor,a=o.toLowerCase();if(l.observedAttributes=l.observedAttributes||["classname","className","style"],l.observedAttributes.push(o),l.observedAttributes.push(a),a!==o&&Object.defineProperty(t,o,{get(){return this[a]},set(p){this[a]=p}}),e){const p=Symbol.for(o);Object.defineProperty(t,a,{get(){return this[p]},set(u){let U=u;e===Boolean&&typeof u=="string"&&u.toLowerCase()==="false"?U=!1:U=e(u),this[p]=U}})}}}function Pe(e,t,o){return(l,a)=>{const p=D.get(l.constructor,"childQueries",[]);p.push({key:a,selector:e,all:o,refresh:t.refresh}),D.add(l.constructor,{childQueries:p})}}function ee(e,t={}){return Pe(e,t)}function Ee(e,t={}){return Pe(e,t,!0)}function ue(){return(e,t)=>{const o=Symbol(t);Object.defineProperties(e,{[o]:{writable:!0,enumerable:!1,configurable:!1,value:e[t]},[t]:{get(){return this[o]},set(l){this[o]!==l&&(this[o]=l,this.update())}}})}}var fe=(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.CER="application/pkix-cert",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",e))(fe||{}),tt=Object.defineProperty,nt=Object.getOwnPropertyDescriptor,w=(e,t,o,l)=>{for(var a=l>1?void 0:l?nt(t,o):t,p=e.length-1,u;p>=0;p--)(u=e[p])&&(a=(l?u(t,o,a):u(a))||a);return l&&a&&tt(t,o,a),a};const S="sps-file-upload";i.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[$](){return[S,this.active&&`${S}--active`,this.error&&`${S}--error`,!this.shown&&`${S}--hidden`,this.mini&&`${S}--mini`,this.constrainContentWidth&&`${S}--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(t,o,l){t==="acceptExtensions"&&this.processAcceptExtensions(l),t==="maxSize"&&this.parseAndValidateMaxSize(l)}dismiss(){this.dismissable&&(this.shown=!1,this.update(),this.dismissal.dispatch())}show(){this.dismissable&&(this.shown=!0,this.update())}render({t}){const o=this.error?k.SpsIcon.EXCLAMATION_CIRCLE:k.SpsIcon.UPLOAD_CLOUD,l=(this.multiple?t("design-system:fileUpload.instructions_plural",{defaultValue:"Drag and drop your files here or |browse for files| on your desktop."}):t("design-system:fileUpload.instructions",{defaultValue:"Drag and drop your file here or |browse for a file| on your desktop."})).split("|");return d("div",{"data-fragment":!0},d("div",{className:`${S}__content`},this.processing?d("div",{"data-fragment":!0},d("i",{className:"sps-spinner sps-spinner--medium","aria-hidden":"true"}),d("div",{className:`${S}__instructions`},t("design-system:fileUpload.processing",{defaultValue:"Processing Upload..."}))):d("div",{"data-fragment":!0},d("i",{className:`sps-icon sps-icon-${o} ${S}__icon-primary`,"aria-hidden":"true"}),d("div",{className:`${S}__title`},this.error?d("div",{"data-fragment":!0},t(this.namesOfUnsupportedFiles.length>1?"design-system:fileUpload.cancelled_plural":"design-system:fileUpload.cancelled",{defaultValue:this.namesOfUnsupportedFiles.length>1?"File Upload(s) Failed":"File Upload Failed"})):d("div",{"data-fragment":!0},t("design-system:fileUpload.title",{description:this.description,defaultValue:`Upload Your ${this.description}`}))),this.error?d("div",{className:`${S}__errored-files`},new Set(this.namesOfUnsupportedFiles.map((a,p)=>{const u=Math.floor(a.length/2);return d("div",{className:`${S}__errored-filename`,key:a},d("span",{className:`${S}__errored-filename-segment`},a.substr(0,u)),d("div",{className:`${S}__errored-filename-segment`},d("span",null,a.substr(u))),p<this.namesOfUnsupportedFiles.length-1?",":"")}))):d("span",null),d("div",{className:`${S}__instructions`},d("div",{"data-fragment":!0},d("span",null,l[0]),d("a",{href:"",onClick:this.handleBrowseLinkClick},l[1]),d("span",null,l[2]))),d("div",{className:`${S}__requirements`},this.acceptExtensions?d("span",null,"("," ",t("design-system:fileUpload.acceptedTypes",{fileTypes:this.acceptExtensionsDescription,defaultValue:`${this.acceptExtensionsDescription} format accepted`})," ",")"):"",this.maxSize?d("span",null,"("," ",t("design-system:fileUpload.maximumSize",{size:this.maxSize,defaultValue:`${this.maxSize} maximum`})," ",")"):"",this.customRequirement?d("span",null," ",this.customRequirement," "):""),this.downloadLabel&&d("div",{className:`sps-button sps-button--link ${S}__download-button`,onClick:this.handleDownloadButtonClick},d("button",{type:"button"},d("i",{className:"sps-icon sps-icon-download-cloud","aria-hidden":"true"})," ",this.downloadLabel)))),this.dismissable&&!this.processing&&d("div",{className:`sps-button sps-button--icon ${S}__close-button`,onClick:this.dismiss},d("button",{type:"button",title:t("design-system:fileUpload.close",{defaultValue:"Close"})},d("i",{className:"sps-icon sps-icon-x","aria-hidden":"true"}))),d("form",null,d("input",{type:"file",accept:this.accept||"*/*",multiple:this.multiple||null,onChange:this.handleFileInputChange})))}parseAndValidateMaxSize(t){try{this.maxSizeBytes=f.parseFileSize(t)}catch{throw new Error(`Could not parse "${t}" as a file size.`)}}processAcceptExtensions(t){const l=(Array.isArray(t)?t:t.trim().split(/\s?,\s?/)).map(p=>p.replace(/^\./,"")),a=l.map(p=>`.${p}`.toLowerCase());this.acceptExtensionsDescription=a.map((p,u)=>u>0&&u===a.length-1?`or ${p}`:p).join(a.length>2?", ":" "),this.acceptMIMETypes.clear();for(const p of l)for(const u of fe[p.toUpperCase()].split(","))this.acceptMIMETypes.add(u);this.accept=a.concat(Array.from(this.acceptMIMETypes)).join(",")}selectFiles(t){this.namesOfUnsupportedFiles=[];const o=Array.from(t);for(const l of o)this.acceptExtensions&&!this.acceptMIMETypes.has(l.type)&&this.namesOfUnsupportedFiles.push(l.name),this.maxSize&&l.size>this.maxSizeBytes&&this.namesOfUnsupportedFiles.indexOf(l.name)===-1&&this.namesOfUnsupportedFiles.push(l.name);this.namesOfUnsupportedFiles.length?(this.error=!0,this.fileInput.value=null,this.update()):(this.files=o,this.selection.dispatch(o))}handleDragOver(t){t.preventDefault(),t.stopPropagation()}handleDragEnter(t){t.preventDefault(),this.active=!0,this.error=!1,this.update()}handleDragLeave(t){t.preventDefault(),this.active=!1,this.update()}handleDrop(t){t.preventDefault(),t.stopPropagation(),this.active=!1,t.dataTransfer.items?this.selectFiles(Array.from(t.dataTransfer.items).map(o=>o.getAsFile())):this.selectFiles(t.dataTransfer.files),this.update()}handleBrowseLinkClick(t){t.preventDefault(),this.error=!1,this.update(),this.fileInput.click()}handleDownloadButtonClick(){this.download.dispatch()}handleFileInputChange(t){t.stopPropagation(),this.selectFiles(t.target.files)}},i.SpsFileUploadComponent.displayName=S,i.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>"}},w([v()],i.SpsFileUploadComponent.prototype,"description",2),w([v(Boolean)],i.SpsFileUploadComponent.prototype,"multiple",2),w([v(Boolean)],i.SpsFileUploadComponent.prototype,"shown",2),w([v(Boolean)],i.SpsFileUploadComponent.prototype,"dismissable",2),w([v(Boolean)],i.SpsFileUploadComponent.prototype,"processing",2),w([v(Boolean)],i.SpsFileUploadComponent.prototype,"mini",2),w([v(Boolean)],i.SpsFileUploadComponent.prototype,"constrainContentWidth",2),w([v()],i.SpsFileUploadComponent.prototype,"downloadLabel",2),w([v()],i.SpsFileUploadComponent.prototype,"acceptExtensions",2),w([v()],i.SpsFileUploadComponent.prototype,"maxSize",2),w([v()],i.SpsFileUploadComponent.prototype,"customRequirement",2),w([M()],i.SpsFileUploadComponent.prototype,"selection",2),w([M()],i.SpsFileUploadComponent.prototype,"dismissal",2),w([M()],i.SpsFileUploadComponent.prototype,"download",2),w([ee("input[type='file']")],i.SpsFileUploadComponent.prototype,"fileInput",2),w([G("dragover")],i.SpsFileUploadComponent.prototype,"handleDragOver",1),w([G("dragenter")],i.SpsFileUploadComponent.prototype,"handleDragEnter",1),w([G("dragleave")],i.SpsFileUploadComponent.prototype,"handleDragLeave",1),w([G("drop")],i.SpsFileUploadComponent.prototype,"handleDrop",1),i.SpsFileUploadComponent=w([B({tag:S})],i.SpsFileUploadComponent);const st={basic:{label:"Basic File Upload",description:f.code`
|
|
183
|
+
*/return g.applyAttr=R,g.applyProp=xe,g.attributes=K,g.close=qe,g.currentElement=Vt,g.currentPointer=Ht,g.open=He,g.patch=$e,g.patchInner=$e,g.patchOuter=Bt,g.skip=qt,g.skipNode=we,g.getKey=Lt,g.clearCache=Ue,g.importNode=Te,g.isDataInitialized=kt,g.notifications=Y,g.symbols=e,g.attr=Qt,g.elementClose=Xe,g.elementOpen=Se,g.elementOpenEnd=Zt,g.elementOpenStart=Xt,g.elementVoid=Yt,g.text=Jt,g.key=Kt,g}var O=Qe();function Ne(e){let t=O.currentPointer();return t instanceof Comment&&t.data!==e?t.data=e:(t=document.createComment(e),O.currentElement().appendChild(t)),O.skipNode(),t}const $=Symbol("ComponentMetadata"),P=Object.freeze({has(e,t){return!!(e[$]&&Object.prototype.hasOwnProperty.call(e[$],t))},add(e,t){e[$]?Object.assign(e[$],t):e[$]=t},get(e,t,a){return e[$]&&e[$][t]||a}}),ye=Symbol("ds-web-components:pragma:listeners-attached"),Ae="idom-pragma:content-begin",pe="idom-pragma:content-end";function de(e){for(const t of e)if(typeof t=="function")t();else if(typeof t=="string")O.text(t);else if(t instanceof Set)de(Array.from(t));else if(Array.isArray(t)&&t.length>0){let a=O.currentPointer();if(Ne(Ae),a===null){const r=O.currentElement();for(let l=0;l<t.length;l+=1)r.contains(t[l])||r.appendChild(t[l]),O.skipNode()}for(;a&&a.data!==pe;)O.skipNode(),a=O.currentPointer();Ne(pe)}}function d(e,t,...a){if(t){for(const r of Object.keys(t))if(r.toUpperCase()==="DATA-FRAGMENT")return()=>de(a)}return()=>{O.elementOpenStart(e);const r=[];if(t)for(const p of Object.keys(t))p.toUpperCase()==="CLASSNAME"?O.attr("class",t[p]):/^on[A-Z]/.test(p)?r.push(p):O.attr(p,t[p]);O.elementOpenEnd(e);const l=O.currentElement();if(!l[ye]){for(const p of r)l.addEventListener(p.substr(2).toLowerCase(),t[p]);l[ye]=!0}de(a),O.elementClose(e)}}function Oe(e,t){customElements.get(e)||customElements.define(e,t)}function Ze(...e){for(const t of e)Oe(P.get(t,"tag"),t)}function Ye(e){return function(...a){for(const r of a){const l=`${e}${P.get(r,"tag").substr(3)}`;Oe(l,r)}}}const he=Symbol("Component Attribute Bindings"),B=Symbol("Component Class Bindings"),J=Symbol("Component Style Bindings"),Je={__initialized:!1,__observer:null,__queuedUpdate:null,__managedClasses:new Set,__updateHostBindings(){const e=this;for(const t of Object.keys(e[he]||{}))e.setAttribute(t,e[he][t]);for(const t of Object.keys(e[J]||{}))e.style[t]=e[J][t];for(const t of e.__managedClasses)e.classList.remove(t);for(const t of(e[B]||[]).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 a of P.get(t.constructor,"childQueries",[]))if(!e||e&&a.refresh){const r=a.all?t.querySelectorAll:t.querySelector;t[a.key]=r.call(t,a.selector)}},__gatherChildren(){const e=this;let t=Array.from(e.childNodes),a=null,r=t.length;for(let l=0;l<t.length;l+=1){const p=t[l];p instanceof Comment&&(p.data===Ae?a=l+1:p.data===pe&&(r=l-1))}if(a===null)for(const l of t)l.parentNode.removeChild(l);else t=t.slice(a,r);P.has(e.constructor,"contentProp")&&(e[P.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(),O.patch(e,e.render()),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,a){const r=this,l=a===""?!0:a;l!==t&&(r.__cbAttributeChanged&&r.__cbAttributeChanged(e,r[e],l),e!=="style"&&(r[e]=l),r.__initialized&&r.update())},connectedCallback(){const e=this;e.__cbConnected&&e.__cbConnected();const t=P.get(e.constructor,"eventListeners",[]);setTimeout(()=>{if(!e.__initialized){e.__gatherChildren();for(const[,a]of t)e[a]=e[a].bind(e);e.__initialized=!0}for(const[a,r]of t)e.addEventListener(a,e[r]);e.__doRender(),setTimeout(()=>{e.__updateChildQueries(),e.__updateHostBindings()},0)},0)},disconnectedCallback(){const e=this;e.__cbDisconnected&&e.__cbDisconnected();for(const[t,a]of P.get(e.constructor,"eventListeners",[]))e.removeEventListener(t,e[a]);e.__stopMutObs()}};function j(e){return t=>{P.add(t,e),Object.assign(t.prototype,{__cbAttributeChanged:t.prototype.attributeChangedCallback,__cbConnected:t.prototype.connectedCallback,__cbDisconnected:t.prototype.disconnectedCallback},Je)}}function M(){return(e,t)=>{P.add(e.constructor,{contentProp:t})}}function ee(e){return(t,a)=>{Object.defineProperty(t,a,{get(){return Object.defineProperty(this,a,{value:{dispatch:r=>{const l=new CustomEvent(e||a,{detail:r});return this.dispatchEvent(l),l}}}),this[a]},configurable:!0})}}function X(e){return(t,a)=>{const r=P.get(t.constructor,"eventListeners",[]);r.push([e,a]),P.add(t.constructor,{eventListeners:r})}}function v(e){return(t,a)=>{const r=t.constructor,l=a.toLowerCase();if(r.observedAttributes=r.observedAttributes||["classname","className","style"],r.observedAttributes.push(a),r.observedAttributes.push(l),l!==a&&Object.defineProperty(t,a,{get(){return this[l]},set(p){this[l]=p}}),e){const p=Symbol.for(a);Object.defineProperty(t,l,{get(){return this[p]},set(u){let R=u;e===Boolean&&typeof u=="string"&&u.toLowerCase()==="false"?R=!1:R=e(u),this[p]=R}})}}}function De(e,t,a){return(r,l)=>{const p=P.get(r.constructor,"childQueries",[]);p.push({key:l,selector:e,all:a,refresh:t.refresh}),P.add(r.constructor,{childQueries:p})}}function te(e,t={}){return De(e,t)}function Pe(e,t={}){return De(e,t,!0)}function ue(){return(e,t)=>{const a=Symbol(t);Object.defineProperties(e,{[a]:{writable:!0,enumerable:!1,configurable:!1,value:e[t]},[t]:{get(){return this[a]},set(r){this[a]!==r&&(this[a]=r,this.update())}}})}}var fe=(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.CER="application/pkix-cert",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",e))(fe||{}),Me=Object.defineProperty,et=Object.getOwnPropertyDescriptor,w=(e,t,a,r)=>{for(var l=r>1?void 0:r?et(t,a):t,p=e.length-1,u;p>=0;p--)(u=e[p])&&(l=(r?u(t,a,l):u(l))||l);return r&&l&&Me(t,a,l),l};const S="sps-file-upload";i.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[B](){return[S,this.active&&`${S}--active`,this.error&&`${S}--error`,!this.shown&&`${S}--hidden`,this.mini&&`${S}--mini`,this.constrainContentWidth&&`${S}--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(t,a,r){t==="acceptExtensions"&&this.processAcceptExtensions(r),t==="maxSize"&&this.parseAndValidateMaxSize(r)}dismiss(){this.dismissable&&(this.shown=!1,this.update(),this.dismissal.dispatch())}show(){this.dismissable&&(this.shown=!0,this.update())}render(){const t=this.error?L.SpsIcon.EXCLAMATION_CIRCLE:L.SpsIcon.UPLOAD_CLOUD,a=(this.multiple?D.i18nWoodland.t("fileUpload.instructions.other",{defaultValue:"Drag and drop your files here or |browse for files| on your desktop."}):D.i18nWoodland.t("fileUpload.instructions.one",{defaultValue:"Drag and drop your file here or |browse for a file| on your desktop."})).split("|");return d("div",{"data-fragment":!0},d("div",{className:`${S}__content`},this.processing?d("div",{"data-fragment":!0},d("i",{className:"sps-spinner sps-spinner--medium","aria-hidden":"true"}),d("div",{className:`${S}__instructions`},D.i18nWoodland.t("fileUpload.processing",{defaultValue:"Processing Upload..."}))):d("div",{"data-fragment":!0},d("i",{className:`sps-icon sps-icon-${t} ${S}__icon-primary`,"aria-hidden":"true"}),d("div",{className:`${S}__title`},this.error?d("div",{"data-fragment":!0},D.i18nWoodland.t(this.namesOfUnsupportedFiles.length>1?"fileUpload.cancelled_plural":"fileUpload.cancelled",{defaultValue:this.namesOfUnsupportedFiles.length>1?"File Upload(s) Failed":"File Upload Failed"})):d("div",{"data-fragment":!0},D.i18nWoodland.t("fileUpload.title",{description:this.description,defaultValue:`Upload Your ${this.description}`}))),this.error?d("div",{className:`${S}__errored-files`},new Set(this.namesOfUnsupportedFiles.map((r,l)=>{const p=Math.floor(r.length/2);return d("div",{className:`${S}__errored-filename`,key:r},d("span",{className:`${S}__errored-filename-segment`},r.substr(0,p)),d("div",{className:`${S}__errored-filename-segment`},d("span",null,r.substr(p))),l<this.namesOfUnsupportedFiles.length-1?",":"")}))):d("span",null),d("div",{className:`${S}__instructions`},d("div",{"data-fragment":!0},d("span",null,a[0]),d("a",{href:"",onClick:this.handleBrowseLinkClick},a[1]),d("span",null,a[2]))),d("div",{className:`${S}__requirements`},this.acceptExtensions?d("span",null,"("," ",D.i18nWoodland.t("fileUpload.acceptedTypes",{fileTypes:this.acceptExtensionsDescription,defaultValue:`${this.acceptExtensionsDescription} format accepted`})," ",")"):"",this.maxSize?d("span",null,"("," ",D.i18nWoodland.t("fileUpload.maximumSize",{size:this.maxSize,defaultValue:`${this.maxSize} maximum`})," ",")"):"",this.customRequirement?d("span",null," ",this.customRequirement," "):""),this.downloadLabel&&d("div",{className:`sps-button sps-button--link ${S}__download-button`,onClick:this.handleDownloadButtonClick},d("button",{type:"button"},d("i",{className:"sps-icon sps-icon-download-cloud","aria-hidden":"true"})," ",this.downloadLabel)))),this.dismissable&&!this.processing&&d("div",{className:`sps-button sps-button--icon ${S}__close-button`,onClick:this.dismiss},d("button",{type:"button",title:D.i18nWoodland.t("fileUpload.close",{defaultValue:"Close"})},d("i",{className:"sps-icon sps-icon-x","aria-hidden":"true"}))),d("form",null,d("input",{type:"file",accept:this.accept||"*/*",multiple:this.multiple||null,onChange:this.handleFileInputChange})))}parseAndValidateMaxSize(t){try{this.maxSizeBytes=f.parseFileSize(t)}catch{throw new Error(`Could not parse "${t}" as a file size.`)}}processAcceptExtensions(t){const r=(Array.isArray(t)?t:t.trim().split(/\s?,\s?/)).map(p=>p.replace(/^\./,"")),l=r.map(p=>`.${p}`.toLowerCase());this.acceptExtensionsDescription=l.map((p,u)=>u>0&&u===l.length-1?`or ${p}`:p).join(l.length>2?", ":" "),this.acceptMIMETypes.clear();for(const p of r)for(const u of fe[p.toUpperCase()].split(","))this.acceptMIMETypes.add(u);this.accept=l.concat(Array.from(this.acceptMIMETypes)).join(",")}selectFiles(t){this.namesOfUnsupportedFiles=[];const a=Array.from(t);for(const r of a)this.acceptExtensions&&!this.acceptMIMETypes.has(r.type)&&this.namesOfUnsupportedFiles.push(r.name),this.maxSize&&r.size>this.maxSizeBytes&&this.namesOfUnsupportedFiles.indexOf(r.name)===-1&&this.namesOfUnsupportedFiles.push(r.name);this.namesOfUnsupportedFiles.length?(this.error=!0,this.fileInput.value=null,this.update()):(this.files=a,this.selection.dispatch(a))}handleDragOver(t){t.preventDefault(),t.stopPropagation()}handleDragEnter(t){t.preventDefault(),this.active=!0,this.error=!1,this.update()}handleDragLeave(t){t.preventDefault(),this.active=!1,this.update()}handleDrop(t){t.preventDefault(),t.stopPropagation(),this.active=!1,t.dataTransfer.items?this.selectFiles(Array.from(t.dataTransfer.items).map(a=>a.getAsFile())):this.selectFiles(t.dataTransfer.files),this.update()}handleBrowseLinkClick(t){t.preventDefault(),this.error=!1,this.update(),this.fileInput.click()}handleDownloadButtonClick(){this.download.dispatch()}handleFileInputChange(t){t.stopPropagation(),this.selectFiles(t.target.files)}},i.SpsFileUploadComponent.displayName=S,i.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>"}},w([v()],i.SpsFileUploadComponent.prototype,"description",2),w([v(Boolean)],i.SpsFileUploadComponent.prototype,"multiple",2),w([v(Boolean)],i.SpsFileUploadComponent.prototype,"shown",2),w([v(Boolean)],i.SpsFileUploadComponent.prototype,"dismissable",2),w([v(Boolean)],i.SpsFileUploadComponent.prototype,"processing",2),w([v(Boolean)],i.SpsFileUploadComponent.prototype,"mini",2),w([v(Boolean)],i.SpsFileUploadComponent.prototype,"constrainContentWidth",2),w([v()],i.SpsFileUploadComponent.prototype,"downloadLabel",2),w([v()],i.SpsFileUploadComponent.prototype,"acceptExtensions",2),w([v()],i.SpsFileUploadComponent.prototype,"maxSize",2),w([v()],i.SpsFileUploadComponent.prototype,"customRequirement",2),w([ee()],i.SpsFileUploadComponent.prototype,"selection",2),w([ee()],i.SpsFileUploadComponent.prototype,"dismissal",2),w([ee()],i.SpsFileUploadComponent.prototype,"download",2),w([te("input[type='file']")],i.SpsFileUploadComponent.prototype,"fileInput",2),w([X("dragover")],i.SpsFileUploadComponent.prototype,"handleDragOver",1),w([X("dragenter")],i.SpsFileUploadComponent.prototype,"handleDragEnter",1),w([X("dragleave")],i.SpsFileUploadComponent.prototype,"handleDragLeave",1),w([X("drop")],i.SpsFileUploadComponent.prototype,"handleDrop",1),i.SpsFileUploadComponent=w([j({tag:S})],i.SpsFileUploadComponent);const tt={basic:{label:"Basic File Upload",description:f.code`
|
|
184
184
|
<p>Simply allow the user to drag-and-drop or select either a single file or multiple files at once.</p>
|
|
185
185
|
`,examples:{single:{description:"<p>Single file upload</p>",react:f.code`
|
|
186
186
|
function Component() {
|
|
@@ -430,7 +430,7 @@
|
|
|
430
430
|
</div>
|
|
431
431
|
)
|
|
432
432
|
}
|
|
433
|
-
`}}}};var
|
|
433
|
+
`}}}};var nt=Object.defineProperty,st=Object.getOwnPropertyDescriptor,F=(e,t,a,r)=>{for(var l=r>1?void 0:r?st(t,a):t,p=e.length-1,u;p>=0;p--)(u=e[p])&&(l=(r?u(t,a,l):u(l))||l);return r&&l&&nt(t,a,l),l};const E="sps-insight-card";i.SpsInsightCardComponent=class extends HTMLElement{constructor(){super(...arguments),this.kind=L.SpsInsightCardKind.GENERAL}get[B](){return[E,`${E}--${this.kind}`,this.detail&&this.detail.children.length?`${E}--has-detail`:null]}render(){const t=d("div",{className:`${E}__metric-count`},this.metric),a=d("div",{className:`${E}__description`},d("div",{className:`${E}__title`,style:{"-webkit-box-orient":"vertical"}},this.title),d("div",{className:`${E}__detail`},this.content)),r=this.partnercount,l=this.totalpartners,[p,u,R]=(r?D.i18nWoodland.t("insightCard.partnerCount",{count:r,total:l,defaultValue:`${r} |of| ${l}`}):"").split("|");return d("div",{"data-fragment":!0},d("div",{className:`${E}__body`},this.icon?d("i",{className:`sps-icon sps-icon-${this.icon}`}):d("i",{className:`sps-icon sps-icon-${L.SpsInsightCardIcons[this.kind]}`}),t,a),r&&d("div",{className:`${E}__partner-count`},r===l?d("div",null,D.i18nWoodland.t("insightCard.all",{defaultValue:"ALL"})):d("div",{"data-fragment":!0},d("div",null,p),d("div",null,u),d("div",null,R)),d("div",{className:`${E}__partners-text`},D.i18nWoodland.t("insightCard.partners",{defaultValue:"PARTNERS"}))))}},i.SpsInsightCardComponent.displayName=E,i.SpsInsightCardComponent.props={icon:"SpsIcon",kind:"SpsInsightCardKind",title:"string",metric:"number",partnerCount:"number",totalPartners:"number",secondary:"boolean"},F([v()],i.SpsInsightCardComponent.prototype,"icon",2),F([v()],i.SpsInsightCardComponent.prototype,"kind",2),F([v()],i.SpsInsightCardComponent.prototype,"title",2),F([v()],i.SpsInsightCardComponent.prototype,"metric",2),F([v()],i.SpsInsightCardComponent.prototype,"partnerCount",2),F([v()],i.SpsInsightCardComponent.prototype,"totalPartners",2),F([v()],i.SpsInsightCardComponent.prototype,"secondary",2),F([M()],i.SpsInsightCardComponent.prototype,"content",2),F([te(`.${E}__detail`)],i.SpsInsightCardComponent.prototype,"detail",2),i.SpsInsightCardComponent=F([j({tag:E})],i.SpsInsightCardComponent);var it=Object.defineProperty,at=Object.getOwnPropertyDescriptor,me=(e,t,a,r)=>{for(var l=r>1?void 0:r?at(t,a):t,p=e.length-1,u;p>=0;p--)(u=e[p])&&(l=(r?u(t,a,l):u(l))||l);return r&&l&&it(t,a,l),l};const T="sps-insights";i.SpsInsightsComponent=class extends HTMLElement{constructor(){super(),this.content=[],this.showAdditionalInsights=!1,this.toggleAdditionalInsights=this.toggleAdditionalInsights.bind(this)}get[B](){return[T,this.showAdditionalInsights&&`${T}--show-additional`,this.details&&Array.from(this.details).every(t=>!t.textContent)?`${T}--no-details`:null,this.content.length===6?`${T}--break-4`:null,this.content.length===7?`${T}--break-5`:null,this.content.length===8?`${T}--break-5`:null]}toggleAdditionalInsights(){this.showAdditionalInsights=!this.showAdditionalInsights,this.update()}render(){return d("div",{"data-fragment":!0},this.content,this.content.length>10&&d("div",{className:"sps-button sps-button--link",onClick:this.toggleAdditionalInsights},d("button",{type:"button"},this.showAdditionalInsights?D.i18nWoodland.t("insights.hideAdditionalInsights",{defaultValue:"Hide Additional Insights"}):D.i18nWoodland.t("insights.showAdditionalInsights",{defaultValue:"Show Additional Insights"}))))}},i.SpsInsightsComponent.displayName=T,i.SpsInsightsComponent.props={},me([M()],i.SpsInsightsComponent.prototype,"content",2),me([Pe(".sps-insight-card__detail")],i.SpsInsightsComponent.prototype,"details",2),i.SpsInsightsComponent=me([j({tag:T})],i.SpsInsightsComponent);const rt={basic:{label:"Basic Insight Cards",examples:{basic:{jsx:f.code`
|
|
434
434
|
<sps-insights>
|
|
435
435
|
<sps-insight-card kind="general"
|
|
436
436
|
metric="1234"
|
|
@@ -712,7 +712,7 @@
|
|
|
712
712
|
</sps-insights>
|
|
713
713
|
)
|
|
714
714
|
}
|
|
715
|
-
`}}}};var
|
|
715
|
+
`}}}};var ot=Object.defineProperty,lt=Object.getOwnPropertyDescriptor,W=(e,t,a,r)=>{for(var l=r>1?void 0:r?lt(t,a):t,p=e.length-1,u;p>=0;p--)(u=e[p])&&(l=(r?u(t,a,l):u(l))||l);return r&&l&&ot(t,a,l),l};i.SpsNavTabComponent=class extends HTMLElement{constructor(){super(...arguments),this.active=!1,this.label="",this.tag=""}get[B](){return["sps-tabbed-nav__nav-item",this.active&&"sps-tabbed-nav__nav-item--active"]}render(){return d("a",{href:this.href,target:this.target,className:"sps-tabbed-nav__nav-item-link",tabIndex:0},this.icon&&d("i",{className:`sps-icon sps-icon-${this.icon}`}),this.label&&d("span",null,this.label),this.tag&&d("span",{className:"sps-tag sps-tag--default"},this.tag))}},i.SpsNavTabComponent.displayName="sps-nav-tab",i.SpsNavTabComponent.props={active:"boolean",label:"string",icon:"SpsIcon",tag:"string",href:"string",target:"string"},W([v()],i.SpsNavTabComponent.prototype,"active",2),W([v()],i.SpsNavTabComponent.prototype,"label",2),W([v()],i.SpsNavTabComponent.prototype,"icon",2),W([v()],i.SpsNavTabComponent.prototype,"tag",2),W([v()],i.SpsNavTabComponent.prototype,"href",2),W([v()],i.SpsNavTabComponent.prototype,"target",2),i.SpsNavTabComponent=W([j({tag:"sps-nav-tab"})],i.SpsNavTabComponent);var ct=Object.defineProperty,pt=Object.getOwnPropertyDescriptor,Ee=(e,t,a,r)=>{for(var l=r>1?void 0:r?pt(t,a):t,p=e.length-1,u;p>=0;p--)(u=e[p])&&(l=(r?u(t,a,l):u(l))||l);return r&&l&&ct(t,a,l),l};i.SpsNavTabSetComponent=class extends HTMLElement{constructor(){super(...arguments),this.content=[]}render(){return d("nav",{className:"sps-tabbed-nav"},this.content)}},i.SpsNavTabSetComponent.displayName="sps-nav-tab-set",i.SpsNavTabSetComponent.props={},Ee([M()],i.SpsNavTabSetComponent.prototype,"content",2),i.SpsNavTabSetComponent=Ee([j({tag:"sps-nav-tab-set"})],i.SpsNavTabSetComponent);const dt={basic:{label:"Basic Navigation Tabs",description:f.code`
|
|
716
716
|
<p>Navigation tabs native web component</p>
|
|
717
717
|
`,examples:{basic:{react:f.code`
|
|
718
718
|
function DemoComponent() {
|
|
@@ -739,7 +739,7 @@
|
|
|
739
739
|
</sps-nav-tab-set>
|
|
740
740
|
)
|
|
741
741
|
}
|
|
742
|
-
`}}}};var
|
|
742
|
+
`}}}};var ht=Object.defineProperty,ut=Object.getOwnPropertyDescriptor,U=(e,t,a,r)=>{for(var l=r>1?void 0:r?ut(t,a):t,p=e.length-1,u;p>=0;p--)(u=e[p])&&(l=(r?u(t,a,l):u(l))||l);return r&&l&&ht(t,a,l),l},Ie=(e=>(e.FIT="fit",e.FILL="fill",e))(Ie||{});const V="sps-photo";i.SpsPhotoComponent=class extends HTMLElement{constructor(){super(...arguments),this.mode="fill"}get image(){return this.imageInternal}set image(t){this.imageInternal=t,t&&(this.waitForImgHeightInterval&&window.clearInterval(this.waitForImgHeightInterval),this.waitForImgHeightInterval=window.setInterval(()=>{const a=t.getBoundingClientRect();if(a.height){window.clearInterval(this.waitForImgHeightInterval),delete this.waitForImgHeightInterval;let r=a.width/a.height>1;this.fitWidth=r===(this.mode==="fit")}},1e3/60))}get[B](){return[V,this.fitWidth?`${V}--fit-width`:`${V}--fit-height`,this.placeholderIcon&&`${V}--placeholder`]}get[J](){return{fontSize:`${this.width*.05}rem`,width:`${this.width}rem`,height:`${.75*this.width}rem`}}connectedCallback(){this.waitForWidthInterval=window.setInterval(()=>{const t=this.getBoundingClientRect();t.width&&(this.setWidth(t.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?d("img",{src:this.src,alt:this.altText}):d("span",null):d("i",{className:`sps-icon sps-icon-${this.placeholderIcon}`})}setWidth(t){if(t&&!this.width){const a=document.body.parentElement.style.fontSize||"16px",r=Number(a.substr(0,a.length-2));this.width=t/r}}},i.SpsPhotoComponent.displayName=V,i.SpsPhotoComponent.props={src:"string",altText:"string",mode:"SpsPhotoDisplayMode",placeholderIcon:"SpsIcon"},U([v()],i.SpsPhotoComponent.prototype,"src",2),U([v()],i.SpsPhotoComponent.prototype,"altText",2),U([v()],i.SpsPhotoComponent.prototype,"mode",2),U([v()],i.SpsPhotoComponent.prototype,"placeholderIcon",2),U([ue()],i.SpsPhotoComponent.prototype,"width",2),U([ue()],i.SpsPhotoComponent.prototype,"fitWidth",2),U([te("img",{refresh:!0})],i.SpsPhotoComponent.prototype,"image",1),i.SpsPhotoComponent=U([j({tag:V})],i.SpsPhotoComponent);const ft={sizing:{label:"Sizing",description:f.code`
|
|
743
743
|
<p>
|
|
744
744
|
Photos are block elements, so a photo fills its container's width unless
|
|
745
745
|
an explicit width is set. It is always a 4:3 aspect ratio. In this example,
|
|
@@ -828,4 +828,4 @@
|
|
|
828
828
|
<sps-photo placeholderIcon="building"></sps-photo>
|
|
829
829
|
</div>
|
|
830
830
|
</div>
|
|
831
|
-
`}}}};i.AttrBindings=he,i.ClassBindings
|
|
831
|
+
`}}}};i.AttrBindings=he,i.ClassBindings=B,i.Component=j,i.Content=M,i.EventDispatcher=ee,i.EventListener=X,i.MANIFEST=Ke,i.MIMEType=fe,i.Prop=v,i.QuerySelector=te,i.QuerySelectorAll=Pe,i.SpsFileUploadExamples=tt,i.SpsInsightCardExamples=rt,i.SpsNavTabsExamples=dt,i.SpsPhotoDisplayMode=Ie,i.SpsPhotoExamples=ft,i.StyleBindings=J,i.Watch=ue,i.h=d,i.namespaceOverrideRegistrar=Ye,i.register=Ze,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|
package/lib/utils/index.d.ts
CHANGED
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": "8.
|
|
4
|
+
"version": "8.34.0",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/spscommerce/woodland/tree/main/packages/@spscommerce/ds-web-components",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@spscommerce/utils": "^7.0.0",
|
|
29
|
-
"@spscommerce/ds-shared": "8.
|
|
29
|
+
"@spscommerce/ds-shared": "8.34.0",
|
|
30
|
+
"@spscommerce/i18n": "8.34.0"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@spscommerce/utils": "^7.0.0",
|
|
@@ -35,8 +36,9 @@
|
|
|
35
36
|
"package-json": "10.0.0",
|
|
36
37
|
"react": "^16.9.0",
|
|
37
38
|
"react-dom": "^16.9.0",
|
|
38
|
-
"@spscommerce/ds-shared": "8.
|
|
39
|
-
"
|
|
39
|
+
"@spscommerce/ds-shared": "8.34.0",
|
|
40
|
+
"@spscommerce/i18n": "8.34.0",
|
|
41
|
+
"test": "8.34.0"
|
|
40
42
|
},
|
|
41
43
|
"scripts": {
|
|
42
44
|
"build": "pnpm run build:js && pnpm run build:types && pnpm run build:create-dist && pnpm run build:copy-dist",
|
package/dist/lib/utils/i18n.d.ts
DELETED
package/lib/utils/i18n.d.ts
DELETED