@spscommerce/ds-web-components 0.1.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/README.md +3 -0
- package/dist/README.md +3 -0
- package/dist/global.d.ts +15 -0
- package/dist/lib/components/file-upload/file-upload.d.ts +119 -0
- package/dist/lib/components/file-upload/file-upload.examples.d.ts +2 -0
- package/dist/lib/components/file-upload/mime-type.enum.d.ts +75 -0
- package/dist/lib/components/index.d.ts +11 -0
- package/dist/lib/components/insight-card/insight-card.d.ts +40 -0
- package/dist/lib/components/insight-card/insight-card.examples.d.ts +51 -0
- package/dist/lib/components/insight-card/insights.d.ts +18 -0
- package/dist/lib/components/nav-tabs/nav-tab-set.d.ts +7 -0
- package/dist/lib/components/nav-tabs/nav-tab.d.ts +24 -0
- package/dist/lib/components/nav-tabs/nav-tabs.examples.d.ts +11 -0
- package/dist/lib/components/photo/photo.d.ts +42 -0
- package/dist/lib/components/photo/photo.examples.d.ts +2 -0
- package/dist/lib/decorators/component.d.ts +33 -0
- package/dist/lib/decorators/content.d.ts +7 -0
- package/dist/lib/decorators/event-dispatcher.d.ts +9 -0
- package/dist/lib/decorators/event-listener.d.ts +5 -0
- package/dist/lib/decorators/index.d.ts +7 -0
- package/dist/lib/decorators/prop.d.ts +6 -0
- package/dist/lib/decorators/query-selector.d.ts +19 -0
- package/dist/lib/decorators/watch.d.ts +2 -0
- package/dist/lib/index.cjs.js +829 -0
- package/dist/lib/index.d.ts +6 -0
- package/dist/lib/index.es.js +2802 -0
- package/dist/lib/manifest.d.ts +2 -0
- package/dist/lib/utils/comment.d.ts +2 -0
- package/dist/lib/utils/i18n.d.ts +3 -0
- package/dist/lib/utils/index.d.ts +5 -0
- package/dist/lib/utils/metadata.d.ts +22 -0
- package/dist/lib/utils/pragma.d.ts +6 -0
- package/dist/lib/utils/register.d.ts +13 -0
- package/dist/package.json +36 -0
- package/global.d.ts +15 -0
- package/lib/components/file-upload/file-upload.d.ts +119 -0
- package/lib/components/file-upload/file-upload.examples.d.ts +2 -0
- package/lib/components/file-upload/mime-type.enum.d.ts +75 -0
- package/lib/components/index.d.ts +11 -0
- package/lib/components/insight-card/insight-card.d.ts +40 -0
- package/lib/components/insight-card/insight-card.examples.d.ts +51 -0
- package/lib/components/insight-card/insights.d.ts +18 -0
- package/lib/components/nav-tabs/nav-tab-set.d.ts +7 -0
- package/lib/components/nav-tabs/nav-tab.d.ts +24 -0
- package/lib/components/nav-tabs/nav-tabs.examples.d.ts +11 -0
- package/lib/components/photo/photo.d.ts +42 -0
- package/lib/components/photo/photo.examples.d.ts +2 -0
- package/lib/decorators/component.d.ts +33 -0
- package/lib/decorators/content.d.ts +7 -0
- package/lib/decorators/event-dispatcher.d.ts +9 -0
- package/lib/decorators/event-listener.d.ts +5 -0
- package/lib/decorators/index.d.ts +7 -0
- package/lib/decorators/prop.d.ts +6 -0
- package/lib/decorators/query-selector.d.ts +19 -0
- package/lib/decorators/watch.d.ts +2 -0
- package/lib/index.cjs.js +829 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.es.js +2802 -0
- package/lib/manifest.d.ts +2 -0
- package/lib/utils/comment.d.ts +2 -0
- package/lib/utils/i18n.d.ts +3 -0
- package/lib/utils/index.d.ts +5 -0
- package/lib/utils/metadata.d.ts +22 -0
- package/lib/utils/pragma.d.ts +6 -0
- package/lib/utils/register.d.ts +13 -0
- package/package.json +37 -0
- package/vite.config.js +20 -0
package/lib/index.cjs.js
ADDED
|
@@ -0,0 +1,829 @@
|
|
|
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
|
+
* @license
|
|
3
|
+
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/var V={default:"__default"};/**
|
|
17
|
+
* @license
|
|
18
|
+
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
19
|
+
*
|
|
20
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
21
|
+
* you may not use this file except in compliance with the License.
|
|
22
|
+
* You may obtain a copy of the License at
|
|
23
|
+
*
|
|
24
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
+
*
|
|
26
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
27
|
+
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
28
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
29
|
+
* See the License for the specific language governing permissions and
|
|
30
|
+
* limitations under the License.
|
|
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
|
+
* @license
|
|
33
|
+
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
34
|
+
*
|
|
35
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
36
|
+
* you may not use this file except in compliance with the License.
|
|
37
|
+
* You may obtain a copy of the License at
|
|
38
|
+
*
|
|
39
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
40
|
+
*
|
|
41
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
42
|
+
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
43
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
44
|
+
* See the License for the specific language governing permissions and
|
|
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 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
|
+
* @license
|
|
48
|
+
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
49
|
+
*
|
|
50
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
51
|
+
* you may not use this file except in compliance with the License.
|
|
52
|
+
* You may obtain a copy of the License at
|
|
53
|
+
*
|
|
54
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
55
|
+
*
|
|
56
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
57
|
+
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
58
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
59
|
+
* See the License for the specific language governing permissions and
|
|
60
|
+
* limitations under the License.
|
|
61
|
+
*/var ue=!1;function Ke(e){var t=ue;return ue=e,t}function Qe(e){return e}/**
|
|
62
|
+
* @license
|
|
63
|
+
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
64
|
+
*
|
|
65
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
66
|
+
* you may not use this file except in compliance with the License.
|
|
67
|
+
* You may obtain a copy of the License at
|
|
68
|
+
*
|
|
69
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
70
|
+
*
|
|
71
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
72
|
+
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
73
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
74
|
+
* See the License for the specific language governing permissions and
|
|
75
|
+
* limitations under the License.
|
|
76
|
+
*/var B={nodesCreated:null,nodesDeleted:null};/**
|
|
77
|
+
* @license
|
|
78
|
+
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
79
|
+
*
|
|
80
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
81
|
+
* you may not use this file except in compliance with the License.
|
|
82
|
+
* You may obtain a copy of the License at
|
|
83
|
+
*
|
|
84
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
85
|
+
*
|
|
86
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
87
|
+
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
88
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
89
|
+
* See the License for the specific language governing permissions and
|
|
90
|
+
* limitations under the License.
|
|
91
|
+
*/var Ve=function(){function e(){this.created=[],this.deleted=[]}return e.prototype.markCreated=function(t){this.created.push(t)},e.prototype.markDeleted=function(t){this.deleted.push(t)},e.prototype.notifyChanges=function(){B.nodesCreated&&this.created.length>0&&B.nodesCreated(this.created),B.nodesDeleted&&this.deleted.length>0&&B.nodesDeleted(this.deleted)},e}();/**
|
|
92
|
+
* @license
|
|
93
|
+
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
94
|
+
*
|
|
95
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
96
|
+
* you may not use this file except in compliance with the License.
|
|
97
|
+
* You may obtain a copy of the License at
|
|
98
|
+
*
|
|
99
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
100
|
+
*
|
|
101
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
102
|
+
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
103
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
104
|
+
* See the License for the specific language governing permissions and
|
|
105
|
+
* limitations under the License.
|
|
106
|
+
*/function Ze(e){return e.nodeType===11||e.nodeType===9}function J(e){return e.nodeType===1}function Je(e){return e.nodeType===3}function Ye(e,t){for(var s=[],n=e;n!==t;){var i=n;s.push(i),n=i.parentNode}return s}var Me=Node.prototype.getRootNode||function(){for(var e=this,t=e;e;)t=e,e=e.parentNode;return t};function et(e){var t=Me.call(e);return Ze(t)?t.activeElement:null}function tt(e,t){var s=et(e);return!s||!e.contains(s)?[]:Ye(s,t)}function st(e,t,s){for(var n=t.nextSibling,i=s;i!==null&&i!==t;){var a=i.nextSibling;e.insertBefore(i,n),i=a}}/**
|
|
107
|
+
* @license
|
|
108
|
+
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
109
|
+
*
|
|
110
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
111
|
+
* you may not use this file except in compliance with the License.
|
|
112
|
+
* You may obtain a copy of the License at
|
|
113
|
+
*
|
|
114
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
115
|
+
*
|
|
116
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
117
|
+
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
118
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
|
+
* See the License for the specific language governing permissions and
|
|
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 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
|
+
* @license
|
|
123
|
+
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
124
|
+
*
|
|
125
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
126
|
+
* you may not use this file except in compliance with the License.
|
|
127
|
+
* You may obtain a copy of the License at
|
|
128
|
+
*
|
|
129
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
130
|
+
*
|
|
131
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
132
|
+
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
133
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
134
|
+
* See the License for the specific language governing permissions and
|
|
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||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
|
+
* @license
|
|
138
|
+
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
139
|
+
*
|
|
140
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
141
|
+
* you may not use this file except in compliance with the License.
|
|
142
|
+
* You may obtain a copy of the License at
|
|
143
|
+
*
|
|
144
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
145
|
+
*
|
|
146
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
147
|
+
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
148
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
149
|
+
* See the License for the specific language governing permissions and
|
|
150
|
+
* limitations under the License.
|
|
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
|
+
* @license
|
|
153
|
+
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
154
|
+
*
|
|
155
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
156
|
+
* you may not use this file except in compliance with the License.
|
|
157
|
+
* You may obtain a copy of the License at
|
|
158
|
+
*
|
|
159
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
160
|
+
*
|
|
161
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
162
|
+
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
163
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
164
|
+
* See the License for the specific language governing permissions and
|
|
165
|
+
* limitations under the License.
|
|
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
|
+
* @license
|
|
168
|
+
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
169
|
+
*
|
|
170
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
171
|
+
* you may not use this file except in compliance with the License.
|
|
172
|
+
* You may obtain a copy of the License at
|
|
173
|
+
*
|
|
174
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
175
|
+
*
|
|
176
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
177
|
+
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
178
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
179
|
+
* See the License for the specific language governing permissions and
|
|
180
|
+
* limitations under the License.
|
|
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.indexOf(s.name)===-1&&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
|
+
<p>Simply allow the user to drag-and-drop or select either a single file or multiple files at once.</p>
|
|
183
|
+
`,examples:{single:{description:"<p>Single file upload</p>",react:l.code`
|
|
184
|
+
function Component() {
|
|
185
|
+
const ref = React.useRef()
|
|
186
|
+
|
|
187
|
+
function handleChange(event) {
|
|
188
|
+
console.log(event.detail)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
React.useEffect(() => {
|
|
192
|
+
ref.current.addEventListener("selection", handleChange)
|
|
193
|
+
return () => {
|
|
194
|
+
ref.current.removeEventListener("selection", handleChange)
|
|
195
|
+
}
|
|
196
|
+
})
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
<div className="sps-row">
|
|
200
|
+
<div className="col-12">
|
|
201
|
+
<sps-file-upload ref={ref}/>
|
|
202
|
+
</div>
|
|
203
|
+
</div>
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
`},multiple:{description:"<p>Multiple file upload</p>",react:l.code`
|
|
207
|
+
function Component() {
|
|
208
|
+
const ref = React.useRef()
|
|
209
|
+
|
|
210
|
+
function handleChange(event) {
|
|
211
|
+
console.log(event.detail)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
React.useEffect(() => {
|
|
215
|
+
ref.current.addEventListener("selection", handleChange)
|
|
216
|
+
return () => {
|
|
217
|
+
ref.current.removeEventListener("selection", handleChange)
|
|
218
|
+
}
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
return (
|
|
222
|
+
<div className="sps-row">
|
|
223
|
+
<div className="col-12">
|
|
224
|
+
<sps-file-upload ref={ref} multiple/>
|
|
225
|
+
</div>
|
|
226
|
+
</div>
|
|
227
|
+
)
|
|
228
|
+
}
|
|
229
|
+
`}}},restrictions:{label:"Restrictions",description:l.code`
|
|
230
|
+
<p>You can place restrictions on what files will be accepted with an extension whitelist and/or a maximum size.</p>
|
|
231
|
+
`,examples:{size:{description:"<p>Maximum size</p>",react:l.code`
|
|
232
|
+
function Component() {
|
|
233
|
+
const ref = React.useRef()
|
|
234
|
+
|
|
235
|
+
function handleChange(event) {
|
|
236
|
+
console.log(event.detail)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
React.useEffect(() => {
|
|
240
|
+
ref.current.addEventListener("selection", handleChange)
|
|
241
|
+
return () => {
|
|
242
|
+
ref.current.removeEventListener("selection", handleChange)
|
|
243
|
+
}
|
|
244
|
+
})
|
|
245
|
+
|
|
246
|
+
return (
|
|
247
|
+
<div className="sps-row">
|
|
248
|
+
<div className="col-12">
|
|
249
|
+
<sps-file-upload ref={ref} maxSize="100KB"/>
|
|
250
|
+
</div>
|
|
251
|
+
</div>
|
|
252
|
+
)
|
|
253
|
+
}
|
|
254
|
+
`},type:{description:"<p>File type whitelist</p>",react:l.code`
|
|
255
|
+
function Component() {
|
|
256
|
+
const ref = React.useRef()
|
|
257
|
+
|
|
258
|
+
function handleChange(event) {
|
|
259
|
+
console.log(event.detail)
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
React.useEffect(() => {
|
|
263
|
+
ref.current.addEventListener("selection", handleChange)
|
|
264
|
+
return () => {
|
|
265
|
+
ref.current.removeEventListener("selection", handleChange)
|
|
266
|
+
}
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
return (
|
|
270
|
+
<div className="sps-row">
|
|
271
|
+
<div className="col-12">
|
|
272
|
+
<sps-file-upload
|
|
273
|
+
ref={ref}
|
|
274
|
+
description="Spreadsheets"
|
|
275
|
+
multiple
|
|
276
|
+
acceptExtensions="XLS, xlsx, .csv"
|
|
277
|
+
/>
|
|
278
|
+
</div>
|
|
279
|
+
</div>
|
|
280
|
+
)
|
|
281
|
+
}
|
|
282
|
+
`},both:{description:"<p>Both restrictions</p>",react:l.code`
|
|
283
|
+
function Component() {
|
|
284
|
+
const ref = React.useRef()
|
|
285
|
+
|
|
286
|
+
function handleChange(event) {
|
|
287
|
+
console.log(event.detail)
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
React.useEffect(() => {
|
|
291
|
+
ref.current.addEventListener("selection", handleChange)
|
|
292
|
+
return () => {
|
|
293
|
+
ref.current.removeEventListener("selection", handleChange)
|
|
294
|
+
}
|
|
295
|
+
})
|
|
296
|
+
|
|
297
|
+
return (
|
|
298
|
+
<div className="sps-row">
|
|
299
|
+
<div className="col-12">
|
|
300
|
+
<sps-file-upload
|
|
301
|
+
ref={ref}
|
|
302
|
+
description="Spreadsheets"
|
|
303
|
+
multiple
|
|
304
|
+
acceptExtensions="XLS, xlsx, .csv"
|
|
305
|
+
maxSize="25MB"
|
|
306
|
+
/>
|
|
307
|
+
</div>
|
|
308
|
+
</div>
|
|
309
|
+
)
|
|
310
|
+
}
|
|
311
|
+
`}}},dismissable:{label:"Dismissable",description:l.code`
|
|
312
|
+
<p>With this option, the file upload component can be dismissed by the user. If the user does dismiss it, you can
|
|
313
|
+
show it again programmatically if you need to.</p>
|
|
314
|
+
`,examples:{dismissable:{react:l.code`
|
|
315
|
+
function Component() {
|
|
316
|
+
const [showFileUpload, setShowFileUpload] = React.useState(true)
|
|
317
|
+
const ref = React.useRef()
|
|
318
|
+
|
|
319
|
+
function handleDismissal() {
|
|
320
|
+
setShowFileUpload(false)
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
React.useEffect(() => {
|
|
324
|
+
ref.current.addEventListener("dismissal", handleDismissal)
|
|
325
|
+
return () => {
|
|
326
|
+
ref.current.removeEventListener("dismissal", handleDismissal)
|
|
327
|
+
}
|
|
328
|
+
})
|
|
329
|
+
|
|
330
|
+
return (
|
|
331
|
+
<div className="sps-row">
|
|
332
|
+
<div className="col-12">
|
|
333
|
+
<sps-file-upload
|
|
334
|
+
ref={ref}
|
|
335
|
+
dismissable
|
|
336
|
+
shown={showFileUpload}
|
|
337
|
+
/>
|
|
338
|
+
{!showFileUpload && (
|
|
339
|
+
<SpsButton onClick={() => setShowFileUpload(true)}>
|
|
340
|
+
Reset
|
|
341
|
+
</SpsButton>
|
|
342
|
+
)}
|
|
343
|
+
</div>
|
|
344
|
+
</div>
|
|
345
|
+
)
|
|
346
|
+
}
|
|
347
|
+
`}}},downloadButton:{label:"Download Button",description:l.code`
|
|
348
|
+
<p>You can optionally provide a button to download a file. Typically this will be a template for
|
|
349
|
+
whatever the user is expected to upload. They can then fill out the template, save it, and upload it.</p>
|
|
350
|
+
`,examples:{downloadButton:{react:l.code`
|
|
351
|
+
function Component() {
|
|
352
|
+
const ref = React.useRef()
|
|
353
|
+
|
|
354
|
+
function handleDownload() {
|
|
355
|
+
console.log("Download triggered.")
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
React.useEffect(() => {
|
|
359
|
+
ref.current.addEventListener("download", handleDownload)
|
|
360
|
+
return () => {
|
|
361
|
+
ref.current.removeEventListener("download", handleDownload)
|
|
362
|
+
}
|
|
363
|
+
})
|
|
364
|
+
|
|
365
|
+
return (
|
|
366
|
+
<div className="sps-row">
|
|
367
|
+
<div className="col-12">
|
|
368
|
+
<sps-file-upload
|
|
369
|
+
ref={ref}
|
|
370
|
+
description="Spreadsheet"
|
|
371
|
+
acceptExtensions="xlsx"
|
|
372
|
+
downloadLabel="Download Excel Template"
|
|
373
|
+
/>
|
|
374
|
+
</div>
|
|
375
|
+
</div>
|
|
376
|
+
)
|
|
377
|
+
}
|
|
378
|
+
`}}},mini:{label:"Mini File Upload",description:l.code`
|
|
379
|
+
<p>When the file upload component is to be placed in a small container,
|
|
380
|
+
it should be marked as a mini file upload so that everything fits.</p>
|
|
381
|
+
`,examples:{single:{react:l.code`
|
|
382
|
+
function Component() {
|
|
383
|
+
const ref = React.useRef()
|
|
384
|
+
|
|
385
|
+
function handleChange(event) {
|
|
386
|
+
console.log(event.detail)
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
React.useEffect(() => {
|
|
390
|
+
ref.current.addEventListener("selection", handleChange)
|
|
391
|
+
return () => {
|
|
392
|
+
ref.current.removeEventListener("selection", handleChange)
|
|
393
|
+
}
|
|
394
|
+
})
|
|
395
|
+
|
|
396
|
+
return (
|
|
397
|
+
<div className="sps-row">
|
|
398
|
+
<div className="col-4">
|
|
399
|
+
<sps-file-upload ref={ref} mini/>
|
|
400
|
+
</div>
|
|
401
|
+
</div>
|
|
402
|
+
)
|
|
403
|
+
}
|
|
404
|
+
`}}},constrainContentWidth:{label:"Constrain Content Width",description:l.code`
|
|
405
|
+
<p>If this prop is provided, the content will be restricted to 50% of
|
|
406
|
+
the overall width of the component. Consult your product designer if
|
|
407
|
+
you're not sure whether to use this variant.</p>
|
|
408
|
+
`,examples:{constrainContentWidth:{react:l.code`
|
|
409
|
+
function Component() {
|
|
410
|
+
const ref = React.useRef()
|
|
411
|
+
|
|
412
|
+
function handleChange(event: CustomEvent<Array<File>>) {
|
|
413
|
+
console.log(event.detail)
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
React.useEffect(() => {
|
|
417
|
+
ref.current.addEventListener("selection", handleChange)
|
|
418
|
+
return () => {
|
|
419
|
+
ref.current.removeEventListener("selection", handleChange)
|
|
420
|
+
}
|
|
421
|
+
})
|
|
422
|
+
|
|
423
|
+
return (
|
|
424
|
+
<div className="sps-row">
|
|
425
|
+
<div className="col-4">
|
|
426
|
+
<sps-file-upload ref={ref} constrainContentWidth/>
|
|
427
|
+
</div>
|
|
428
|
+
</div>
|
|
429
|
+
)
|
|
430
|
+
}
|
|
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
|
+
<p>Navigation tabs native web component</p>
|
|
433
|
+
`,examples:{basic:{react:l.code`
|
|
434
|
+
function DemoComponent() {
|
|
435
|
+
const tabs = [
|
|
436
|
+
{ label: "Tab A", icon: "chart-line" },
|
|
437
|
+
{ label: "Tab B", icon: "chart-bar", tag: "12" },
|
|
438
|
+
{ label: "Tab C", icon: "chart-pie" }
|
|
439
|
+
]
|
|
440
|
+
|
|
441
|
+
const [activeTab, setActiveTab] = React.useState(0)
|
|
442
|
+
|
|
443
|
+
return (
|
|
444
|
+
<sps-nav-tab-set>
|
|
445
|
+
{tabs.map((tab, index) => (
|
|
446
|
+
<sps-nav-tab
|
|
447
|
+
key={index}
|
|
448
|
+
icon={tab.icon}
|
|
449
|
+
label={tab.label}
|
|
450
|
+
tag={tab.tag}
|
|
451
|
+
active={index === activeTab || null}
|
|
452
|
+
onClick={() => setActiveTab(index)}
|
|
453
|
+
/>
|
|
454
|
+
))}
|
|
455
|
+
</sps-nav-tab-set>
|
|
456
|
+
)
|
|
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[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
|
+
<p>
|
|
460
|
+
Photos are block elements, so a photo fills its container's width unless
|
|
461
|
+
an explicit width is set. It is always a 4:3 aspect ratio. In this example,
|
|
462
|
+
photos have been placed in cards which have different widths in the 12
|
|
463
|
+
column grid.
|
|
464
|
+
</p>
|
|
465
|
+
`,examples:{basic:{jsx:l.code`
|
|
466
|
+
<div className="sfg-row">
|
|
467
|
+
<div className="sfg-col-2">
|
|
468
|
+
<sps-card>
|
|
469
|
+
<sps-photo src="assets/images/photo-landscape.jpg"></sps-photo>
|
|
470
|
+
</sps-card>
|
|
471
|
+
</div>
|
|
472
|
+
<div className="sfg-col-4">
|
|
473
|
+
<sps-card>
|
|
474
|
+
<sps-photo src="assets/images/photo-landscape.jpg"></sps-photo>
|
|
475
|
+
</sps-card>
|
|
476
|
+
</div>
|
|
477
|
+
<div className="sfg-col-6">
|
|
478
|
+
<sps-card>
|
|
479
|
+
<sps-photo src="assets/images/photo-landscape.jpg"></sps-photo>
|
|
480
|
+
</sps-card>
|
|
481
|
+
</div>
|
|
482
|
+
</div>
|
|
483
|
+
`}}},displayMode:{label:"Fill vs. Fit",description:l.code`
|
|
484
|
+
<p>
|
|
485
|
+
There are two display modes available:
|
|
486
|
+
<ul>
|
|
487
|
+
<li><b>"fill"</b> fills the entire 4:3 container, cropping off any excess portions of the image.
|
|
488
|
+
<li><b>"fit"</b> fits the entire image into the container, leaving any excess portions of the container blank.
|
|
489
|
+
</ul>
|
|
490
|
+
</p>
|
|
491
|
+
`,examples:{landscape:{description:"<p>Landscape oriented photo (container outline added for illustrative purposes)</p>",jsx:l.code`
|
|
492
|
+
<div className="sfg-row">
|
|
493
|
+
<div className="sfg-col-4">
|
|
494
|
+
<sps-photo src="assets/images/photo-landscape.jpg" mode="fill"></sps-photo>
|
|
495
|
+
</div>
|
|
496
|
+
<div className="sfg-col-4">
|
|
497
|
+
<sps-photo src="assets/images/photo-landscape.jpg" mode="fit"></sps-photo>
|
|
498
|
+
</div>
|
|
499
|
+
</div>
|
|
500
|
+
`},portrait:{description:"<p>Portrait oriented photo (container outline added for illustrative purposes)</p>",jsx:l.code`
|
|
501
|
+
<div className="sfg-row">
|
|
502
|
+
<div className="sfg-col-4">
|
|
503
|
+
<sps-photo src="assets/images/photo-portrait.jpg" mode="fill"></sps-photo>
|
|
504
|
+
</div>
|
|
505
|
+
<div className="sfg-col-4">
|
|
506
|
+
<sps-photo id="foo" src="assets/images/photo-portrait.jpg" mode="fit"></sps-photo>
|
|
507
|
+
</div>
|
|
508
|
+
</div>
|
|
509
|
+
`}}},placeholder:{label:"Placeholders",description:l.code`
|
|
510
|
+
<p>
|
|
511
|
+
When an image is not provided for a particular use case (such as a user avatar,
|
|
512
|
+
a company photo, item image, etc.), a placeholder should be shown in its place.
|
|
513
|
+
|
|
514
|
+
The placeholder's icon, selected from our SPS icon set, should represent the
|
|
515
|
+
type of image it is substituting for.
|
|
516
|
+
</p>
|
|
517
|
+
`,examples:{general:{description:"<p>General Photo</p>",jsx:l.code`
|
|
518
|
+
<div className="sfg-row">
|
|
519
|
+
<div className="sfg-col-3">
|
|
520
|
+
<sps-photo placeholderIcon="photo"></sps-photo>
|
|
521
|
+
</div>
|
|
522
|
+
</div>
|
|
523
|
+
`},photoAlt:{description:"<p>Photo Alt</p>",jsx:l.code`
|
|
524
|
+
<div className="sfg-row">
|
|
525
|
+
<div className="sfg-col-3">
|
|
526
|
+
<sps-photo placeholderIcon="camera"></sps-photo>
|
|
527
|
+
</div>
|
|
528
|
+
</div>
|
|
529
|
+
`},user:{description:"<p>User / Single Person</p>",jsx:l.code`
|
|
530
|
+
<div className="sfg-row">
|
|
531
|
+
<div className="sfg-col-3">
|
|
532
|
+
<sps-photo placeholderIcon="user"></sps-photo>
|
|
533
|
+
</div>
|
|
534
|
+
</div>
|
|
535
|
+
`},group:{description:"<p>Group / Multiple People</p>",jsx:l.code`
|
|
536
|
+
<div className="sfg-row">
|
|
537
|
+
<div className="sfg-col-3">
|
|
538
|
+
<sps-photo placeholderIcon="group"></sps-photo>
|
|
539
|
+
</div>
|
|
540
|
+
</div>
|
|
541
|
+
`},company:{description:"<p>Company / Building</p>",jsx:l.code`
|
|
542
|
+
<div className="sfg-row">
|
|
543
|
+
<div className="sfg-col-3">
|
|
544
|
+
<sps-photo placeholderIcon="building"></sps-photo>
|
|
545
|
+
</div>
|
|
546
|
+
</div>
|
|
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
|
+
<sps-insights>
|
|
549
|
+
<sps-insight-card kind="general"
|
|
550
|
+
metric="1234"
|
|
551
|
+
title="Insight Card Title"
|
|
552
|
+
></sps-insight-card>
|
|
553
|
+
<sps-insight-card kind="processing"
|
|
554
|
+
metric="1234"
|
|
555
|
+
title="Insight Card Title"
|
|
556
|
+
></sps-insight-card>
|
|
557
|
+
<sps-insight-card kind="success"
|
|
558
|
+
metric="1234"
|
|
559
|
+
title="Insight Card Title"
|
|
560
|
+
></sps-insight-card>
|
|
561
|
+
<sps-insight-card kind="warning"
|
|
562
|
+
metric="1234"
|
|
563
|
+
title="Insight Card Title"
|
|
564
|
+
></sps-insight-card>
|
|
565
|
+
<sps-insight-card kind="error"
|
|
566
|
+
metric="1234"
|
|
567
|
+
title="Insight Card Title"
|
|
568
|
+
></sps-insight-card>
|
|
569
|
+
</sps-insights>
|
|
570
|
+
`}}},details:{label:"With Details",examples:{details:{jsx:l.code`
|
|
571
|
+
<sps-insights>
|
|
572
|
+
<sps-insight-card kind="general"
|
|
573
|
+
metric="1234"
|
|
574
|
+
title="Insight Card Title"
|
|
575
|
+
>
|
|
576
|
+
<span className="gray600 font-weight-bold">Detail:</span> 792 units
|
|
577
|
+
</sps-insight-card>
|
|
578
|
+
<sps-insight-card kind="processing"
|
|
579
|
+
metric="1234"
|
|
580
|
+
title="Insight Card Title"
|
|
581
|
+
>
|
|
582
|
+
<span className="gray600 font-weight-bold">Detail:</span> 792 units
|
|
583
|
+
</sps-insight-card>
|
|
584
|
+
<sps-insight-card kind="success"
|
|
585
|
+
metric="1234"
|
|
586
|
+
title="Insight Card Title"
|
|
587
|
+
>
|
|
588
|
+
<span className="gray600 font-weight-bold">Detail:</span> 792 units
|
|
589
|
+
</sps-insight-card>
|
|
590
|
+
<sps-insight-card kind="warning"
|
|
591
|
+
metric="1234"
|
|
592
|
+
title="Insight Card Title"
|
|
593
|
+
>
|
|
594
|
+
<span className="gray600 font-weight-bold">Detail:</span> 792 units
|
|
595
|
+
</sps-insight-card>
|
|
596
|
+
<sps-insight-card kind="error"
|
|
597
|
+
metric="1234"
|
|
598
|
+
title="Insight Card Title"
|
|
599
|
+
>
|
|
600
|
+
<span className="gray600 font-weight-bold">Detail:</span> 792 units
|
|
601
|
+
</sps-insight-card>
|
|
602
|
+
<sps-insight-card kind="success"
|
|
603
|
+
metric="1234"
|
|
604
|
+
title="Insight Card Title"
|
|
605
|
+
>
|
|
606
|
+
<span className="gray600 font-weight-bold">Detail:</span> 792 units
|
|
607
|
+
</sps-insight-card>
|
|
608
|
+
<sps-insight-card kind="error"
|
|
609
|
+
metric="1234"
|
|
610
|
+
title="Insight Card Title"
|
|
611
|
+
>
|
|
612
|
+
<span className="gray600 font-weight-bold">Detail:</span> 792 units
|
|
613
|
+
</sps-insight-card>
|
|
614
|
+
</sps-insights>
|
|
615
|
+
`}}},partner_count:{label:"Partner Count",examples:{partner_count:{jsx:l.code`
|
|
616
|
+
<sps-insights>
|
|
617
|
+
<sps-insight-card kind="general"
|
|
618
|
+
metric="1234"
|
|
619
|
+
title="Insight Card Title"
|
|
620
|
+
partnerCount="250"
|
|
621
|
+
totalPartners="250"
|
|
622
|
+
></sps-insight-card>
|
|
623
|
+
<sps-insight-card kind="processing"
|
|
624
|
+
metric="1234"
|
|
625
|
+
title="Insight Card Title"
|
|
626
|
+
partnerCount="122"
|
|
627
|
+
totalPartners="250"
|
|
628
|
+
></sps-insight-card>
|
|
629
|
+
<sps-insight-card kind="success"
|
|
630
|
+
metric="1234"
|
|
631
|
+
title="Insight Card Title"
|
|
632
|
+
partnerCount="207"
|
|
633
|
+
totalPartners="250"
|
|
634
|
+
></sps-insight-card>
|
|
635
|
+
<sps-insight-card kind="warning"
|
|
636
|
+
metric="1234"
|
|
637
|
+
title="Insight Card Title"
|
|
638
|
+
partnerCount="12"
|
|
639
|
+
totalPartners="250"
|
|
640
|
+
></sps-insight-card>
|
|
641
|
+
<sps-insight-card kind="error"
|
|
642
|
+
metric="1234"
|
|
643
|
+
title="Insight Card Title"
|
|
644
|
+
partnerCount="94"
|
|
645
|
+
totalPartners="250"
|
|
646
|
+
></sps-insight-card>
|
|
647
|
+
</sps-insights>
|
|
648
|
+
`}}},expansion:{label:"10+ Insight Cards",examples:{expansion:{jsx:l.code`
|
|
649
|
+
<sps-insights>
|
|
650
|
+
<sps-insight-card kind="general"
|
|
651
|
+
metric="1234"
|
|
652
|
+
title="Insight Card Title"
|
|
653
|
+
partnerCount="100"
|
|
654
|
+
totalPartners="200"
|
|
655
|
+
>
|
|
656
|
+
<span className="gray600 font-weight-bold">Detail:</span> 792 units
|
|
657
|
+
</sps-insight-card>
|
|
658
|
+
<sps-insight-card kind="processing"
|
|
659
|
+
metric="1234"
|
|
660
|
+
title="Insight Card Title"
|
|
661
|
+
partnerCount="100"
|
|
662
|
+
totalPartners="200"
|
|
663
|
+
></sps-insight-card>
|
|
664
|
+
<sps-insight-card kind="success"
|
|
665
|
+
metric="1234"
|
|
666
|
+
title="Insight Card Title"
|
|
667
|
+
partnerCount="100"
|
|
668
|
+
totalPartners="200"
|
|
669
|
+
>
|
|
670
|
+
<span className="gray600 font-weight-bold">Detail:</span> 792 units
|
|
671
|
+
</sps-insight-card>
|
|
672
|
+
<sps-insight-card kind="warning"
|
|
673
|
+
metric="1234"
|
|
674
|
+
title="Insight Card Title"
|
|
675
|
+
partnerCount="100"
|
|
676
|
+
totalPartners="200"
|
|
677
|
+
></sps-insight-card>
|
|
678
|
+
<sps-insight-card kind="error"
|
|
679
|
+
metric="1234"
|
|
680
|
+
title="Insight Card Title"
|
|
681
|
+
partnerCount="100"
|
|
682
|
+
totalPartners="200"
|
|
683
|
+
>
|
|
684
|
+
<span className="gray600 font-weight-bold">Detail:</span> 792 units
|
|
685
|
+
</sps-insight-card>
|
|
686
|
+
<sps-insight-card kind="general"
|
|
687
|
+
metric="1234"
|
|
688
|
+
title="Insight Card Title"
|
|
689
|
+
partnerCount="100"
|
|
690
|
+
totalPartners="200"
|
|
691
|
+
></sps-insight-card>
|
|
692
|
+
<sps-insight-card kind="processing"
|
|
693
|
+
metric="1234"
|
|
694
|
+
title="Insight Card Title"
|
|
695
|
+
partnerCount="100"
|
|
696
|
+
totalPartners="200"
|
|
697
|
+
>
|
|
698
|
+
<span className="gray600 font-weight-bold">Detail:</span> 792 units
|
|
699
|
+
</sps-insight-card>
|
|
700
|
+
<sps-insight-card kind="success"
|
|
701
|
+
metric="1234"
|
|
702
|
+
title="Insight Card Title"
|
|
703
|
+
partnerCount="100"
|
|
704
|
+
totalPartners="200"
|
|
705
|
+
></sps-insight-card>
|
|
706
|
+
<sps-insight-card kind="warning"
|
|
707
|
+
metric="1234"
|
|
708
|
+
title="Insight Card Title"
|
|
709
|
+
partnerCount="100"
|
|
710
|
+
totalPartners="200"
|
|
711
|
+
>
|
|
712
|
+
<span className="gray600 font-weight-bold">Detail:</span> 792 units
|
|
713
|
+
</sps-insight-card>
|
|
714
|
+
<sps-insight-card kind="error"
|
|
715
|
+
metric="1234"
|
|
716
|
+
title="Insight Card Title"
|
|
717
|
+
partnerCount="100"
|
|
718
|
+
totalPartners="200"
|
|
719
|
+
></sps-insight-card>
|
|
720
|
+
<sps-insight-card kind="general"
|
|
721
|
+
metric="1234"
|
|
722
|
+
title="Insight Card Title"
|
|
723
|
+
partnerCount="100"
|
|
724
|
+
totalPartners="200"
|
|
725
|
+
>
|
|
726
|
+
<span className="gray600 font-weight-bold">Detail:</span> 792 units
|
|
727
|
+
</sps-insight-card>
|
|
728
|
+
<sps-insight-card kind="processing"
|
|
729
|
+
metric="1234"
|
|
730
|
+
title="Insight Card Title"
|
|
731
|
+
partnerCount="100"
|
|
732
|
+
totalPartners="200"
|
|
733
|
+
></sps-insight-card>
|
|
734
|
+
<sps-insight-card kind="success"
|
|
735
|
+
metric="1234"
|
|
736
|
+
title="Insight Card Title"
|
|
737
|
+
partnerCount="100"
|
|
738
|
+
totalPartners="200"
|
|
739
|
+
>
|
|
740
|
+
<span className="gray600 font-weight-bold">Detail:</span> 792 units
|
|
741
|
+
</sps-insight-card>
|
|
742
|
+
<sps-insight-card kind="warning"
|
|
743
|
+
metric="1234"
|
|
744
|
+
title="Insight Card Title"
|
|
745
|
+
partnerCount="100"
|
|
746
|
+
totalPartners="200"
|
|
747
|
+
></sps-insight-card>
|
|
748
|
+
<sps-insight-card kind="error"
|
|
749
|
+
metric="1234"
|
|
750
|
+
title="Insight Card Title"
|
|
751
|
+
partnerCount="100"
|
|
752
|
+
totalPartners="200"
|
|
753
|
+
>
|
|
754
|
+
<span className="gray600 font-weight-bold">Detail:</span> 792 units
|
|
755
|
+
</sps-insight-card>
|
|
756
|
+
</sps-insights>
|
|
757
|
+
`}}},events:{label:"Adding a click handler",description:l.code`
|
|
758
|
+
<p>Attaching event handlers to native web components in React cannot be done the usual way at this time.
|
|
759
|
+
Here is how to do it:</p>
|
|
760
|
+
`,examples:{events:{react:l.code`
|
|
761
|
+
function Component() {
|
|
762
|
+
function handleClick() {
|
|
763
|
+
window.alert("Insight card clicked");
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
const ref = React.useRef();
|
|
767
|
+
React.useEffect(() => {
|
|
768
|
+
ref.current.addEventListener("click", handleClick);
|
|
769
|
+
return () => {
|
|
770
|
+
ref.current.removeEventListener("click", handleClick);
|
|
771
|
+
};
|
|
772
|
+
}, []);
|
|
773
|
+
|
|
774
|
+
return (
|
|
775
|
+
<sps-insights>
|
|
776
|
+
<sps-insight-card ref={ref}
|
|
777
|
+
kind="general"
|
|
778
|
+
metric="1234"
|
|
779
|
+
title="Insight Card Title"
|
|
780
|
+
></sps-insight-card>
|
|
781
|
+
<sps-insight-card kind="general"
|
|
782
|
+
metric="1234"
|
|
783
|
+
title="Insight Card Title"
|
|
784
|
+
></sps-insight-card>
|
|
785
|
+
<sps-insight-card kind="general"
|
|
786
|
+
metric="1234"
|
|
787
|
+
title="Insight Card Title"
|
|
788
|
+
></sps-insight-card>
|
|
789
|
+
</sps-insights>
|
|
790
|
+
);
|
|
791
|
+
}
|
|
792
|
+
`}}},alternateIcon:{label:"Using alternate icons",examples:{basic:{react:l.code`
|
|
793
|
+
function DemoComponent() {
|
|
794
|
+
return (
|
|
795
|
+
<sps-insights>
|
|
796
|
+
<sps-insight-card
|
|
797
|
+
kind="general"
|
|
798
|
+
metric="1234"
|
|
799
|
+
icon={SpsIcon.DOLLAR_SIGN}
|
|
800
|
+
title="Insight Card Title"
|
|
801
|
+
></sps-insight-card>
|
|
802
|
+
<sps-insight-card
|
|
803
|
+
kind="processing"
|
|
804
|
+
metric="1234"
|
|
805
|
+
icon={SpsIcon.ASTERISK}
|
|
806
|
+
title="Insight Card Title"
|
|
807
|
+
></sps-insight-card>
|
|
808
|
+
<sps-insight-card
|
|
809
|
+
kind="success"
|
|
810
|
+
metric="1234"
|
|
811
|
+
icon={SpsIcon.USER}
|
|
812
|
+
title="Insight Card Title"
|
|
813
|
+
></sps-insight-card>
|
|
814
|
+
<sps-insight-card
|
|
815
|
+
kind="warning"
|
|
816
|
+
metric="1234"
|
|
817
|
+
icon={SpsIcon.FOLDER_OPEN}
|
|
818
|
+
title="Insight Card Title"
|
|
819
|
+
></sps-insight-card>
|
|
820
|
+
<sps-insight-card
|
|
821
|
+
kind="error"
|
|
822
|
+
metric="1234"
|
|
823
|
+
icon={SpsIcon.BAN}
|
|
824
|
+
title="Insight Card Title"
|
|
825
|
+
></sps-insight-card>
|
|
826
|
+
</sps-insights>
|
|
827
|
+
)
|
|
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=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;
|