@spscommerce/ds-web-components 5.0.0-rc1 → 5.0.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/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 +10 -10
- package/lib/components/file-upload/file-upload.d.ts +119 -107
- package/lib/components/file-upload/file-upload.examples.d.ts +2 -2
- package/lib/components/file-upload/mime-type.enum.d.ts +75 -75
- package/lib/components/index.d.ts +11 -11
- package/lib/components/insight-card/insight-card.d.ts +40 -36
- package/lib/components/insight-card/insight-card.examples.d.ts +51 -51
- package/lib/components/insight-card/insights.d.ts +18 -18
- package/lib/components/nav-tabs/nav-tab-set.d.ts +7 -7
- package/lib/components/nav-tabs/nav-tab.d.ts +24 -24
- package/lib/components/nav-tabs/nav-tabs.examples.d.ts +11 -11
- package/lib/components/photo/photo.d.ts +42 -42
- package/lib/components/photo/photo.examples.d.ts +2 -2
- package/lib/decorators/component.d.ts +33 -32
- package/lib/decorators/content.d.ts +7 -6
- package/lib/decorators/event-dispatcher.d.ts +9 -8
- package/lib/decorators/event-listener.d.ts +5 -4
- package/lib/decorators/index.d.ts +7 -7
- package/lib/decorators/prop.d.ts +6 -5
- package/lib/decorators/query-selector.d.ts +19 -16
- package/lib/decorators/watch.d.ts +2 -2
- package/lib/index.cjs.js +661 -3009
- package/lib/index.d.ts +6 -7
- package/lib/index.es.js +2802 -0
- package/lib/manifest.d.ts +2 -2
- package/lib/utils/comment.d.ts +2 -2
- package/lib/utils/i18n.d.ts +3 -3
- package/lib/utils/index.d.ts +5 -5
- package/lib/utils/metadata.d.ts +22 -22
- package/lib/utils/pragma.d.ts +6 -6
- package/lib/utils/register.d.ts +13 -11
- package/package.json +18 -17
- package/vite.config.js +20 -0
- package/lib/components/file-upload/file-upload.test-unit.d.ts +0 -1
- package/lib/components/insight-card/insight-card.test-unit.d.ts +0 -1
- package/lib/components/nav-tabs/nav-tabs.test-unit.d.ts +0 -1
- package/lib/components/photo/photo.test-unit.d.ts +0 -1
- package/lib/index.esm.js +0 -3148
package/lib/index.cjs.js
CHANGED
|
@@ -1,91 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var dsShared = require('@spscommerce/ds-shared');
|
|
6
|
-
var utils = require('@spscommerce/utils');
|
|
7
|
-
|
|
8
|
-
/*! *****************************************************************************
|
|
9
|
-
Copyright (c) Microsoft Corporation.
|
|
10
|
-
|
|
11
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
12
|
-
purpose with or without fee is hereby granted.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
15
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
16
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
17
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
18
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
19
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
20
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
21
|
-
***************************************************************************** */
|
|
22
|
-
/* global Reflect, Promise */
|
|
23
|
-
|
|
24
|
-
var extendStatics = function(d, b) {
|
|
25
|
-
extendStatics = Object.setPrototypeOf ||
|
|
26
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
27
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
28
|
-
return extendStatics(d, b);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
function __extends(d, b) {
|
|
32
|
-
if (typeof b !== "function" && b !== null)
|
|
33
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
34
|
-
extendStatics(d, b);
|
|
35
|
-
function __() { this.constructor = d; }
|
|
36
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function __decorate(decorators, target, key, desc) {
|
|
40
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
41
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
42
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
43
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function __metadata(metadataKey, metadataValue) {
|
|
47
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function __values(o) {
|
|
51
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
52
|
-
if (m) return m.call(o);
|
|
53
|
-
if (o && typeof o.length === "number") return {
|
|
54
|
-
next: function () {
|
|
55
|
-
if (o && i >= o.length) o = void 0;
|
|
56
|
-
return { value: o && o[i++], done: !o };
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function __read(o, n) {
|
|
63
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
64
|
-
if (!m) return o;
|
|
65
|
-
var i = m.call(o), r, ar = [], e;
|
|
66
|
-
try {
|
|
67
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
68
|
-
}
|
|
69
|
-
catch (error) { e = { error: error }; }
|
|
70
|
-
finally {
|
|
71
|
-
try {
|
|
72
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
73
|
-
}
|
|
74
|
-
finally { if (e) throw e.error; }
|
|
75
|
-
}
|
|
76
|
-
return ar;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function __makeTemplateObject(cooked, raw) {
|
|
80
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
81
|
-
return cooked;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
var incrementalDomCjs = {};
|
|
85
|
-
|
|
86
|
-
Object.defineProperty(incrementalDomCjs, '__esModule', { value: true });
|
|
87
|
-
|
|
88
|
-
/**
|
|
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});/**
|
|
89
2
|
* @license
|
|
90
3
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
91
4
|
*
|
|
@@ -100,12 +13,7 @@ Object.defineProperty(incrementalDomCjs, '__esModule', { value: true });
|
|
|
100
13
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
101
14
|
* See the License for the specific language governing permissions and
|
|
102
15
|
* limitations under the License.
|
|
103
|
-
*/
|
|
104
|
-
var symbols = {
|
|
105
|
-
default: '__default'
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
/**
|
|
16
|
+
*/var V={default:"__default"};/**
|
|
109
17
|
* @license
|
|
110
18
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
111
19
|
*
|
|
@@ -120,45 +28,7 @@ var symbols = {
|
|
|
120
28
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
121
29
|
* See the License for the specific language governing permissions and
|
|
122
30
|
* limitations under the License.
|
|
123
|
-
*/
|
|
124
|
-
/**
|
|
125
|
-
* A cached reference to the hasOwnProperty function.
|
|
126
|
-
*/
|
|
127
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
128
|
-
/**
|
|
129
|
-
* A constructor function that will create blank objects.
|
|
130
|
-
*/
|
|
131
|
-
function Blank() {}
|
|
132
|
-
Blank.prototype = Object.create(null);
|
|
133
|
-
/**
|
|
134
|
-
* Used to prevent property collisions between our "map" and its prototype.
|
|
135
|
-
* @param map The map to check.
|
|
136
|
-
* @param property The property to check.
|
|
137
|
-
* @return Whether map has property.
|
|
138
|
-
*/
|
|
139
|
-
function has(map, property) {
|
|
140
|
-
return hasOwnProperty.call(map, property);
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Creates an map object without a prototype.
|
|
144
|
-
*/
|
|
145
|
-
// tslint:disable-next-line:no-any
|
|
146
|
-
function createMap() {
|
|
147
|
-
// tslint:disable-next-line:no-any
|
|
148
|
-
return new Blank();
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Truncates an array, removing items up until length.
|
|
152
|
-
* @param arr The array to truncate.
|
|
153
|
-
* @param length The new length of the array.
|
|
154
|
-
*/
|
|
155
|
-
function truncateArray(arr, length) {
|
|
156
|
-
while (arr.length > length) {
|
|
157
|
-
arr.pop();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
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()}/**
|
|
162
32
|
* @license
|
|
163
33
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
164
34
|
*
|
|
@@ -173,115 +43,7 @@ function truncateArray(arr, length) {
|
|
|
173
43
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
174
44
|
* See the License for the specific language governing permissions and
|
|
175
45
|
* limitations under the License.
|
|
176
|
-
*/
|
|
177
|
-
/**
|
|
178
|
-
* Returns the namespace to use for the attribute.
|
|
179
|
-
*/
|
|
180
|
-
function getNamespace(name) {
|
|
181
|
-
if (name.lastIndexOf('xml:', 0) === 0) {
|
|
182
|
-
return 'http://www.w3.org/XML/1998/namespace';
|
|
183
|
-
}
|
|
184
|
-
if (name.lastIndexOf('xlink:', 0) === 0) {
|
|
185
|
-
return 'http://www.w3.org/1999/xlink';
|
|
186
|
-
}
|
|
187
|
-
return undefined;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Applies an attribute or property to a given Element. If the value is null
|
|
191
|
-
* or undefined, it is removed from the Element. Otherwise, the value is set
|
|
192
|
-
* as an attribute.
|
|
193
|
-
*/
|
|
194
|
-
// tslint:disable-next-line:no-any
|
|
195
|
-
function applyAttr(el, name, value) {
|
|
196
|
-
if (value == null) {
|
|
197
|
-
el.removeAttribute(name);
|
|
198
|
-
} else {
|
|
199
|
-
var attrNS = getNamespace(name);
|
|
200
|
-
if (attrNS) {
|
|
201
|
-
el.setAttributeNS(attrNS, name, String(value));
|
|
202
|
-
} else {
|
|
203
|
-
el.setAttribute(name, String(value));
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Applies a property to a given Element.
|
|
209
|
-
*/
|
|
210
|
-
// tslint:disable-next-line:no-any
|
|
211
|
-
function applyProp(el, name, value) {
|
|
212
|
-
// tslint:disable-next-line:no-any
|
|
213
|
-
el[name] = value;
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Applies a value to a style declaration. Supports CSS custom properties by
|
|
217
|
-
* setting properties containing a dash using CSSStyleDeclaration.setProperty.
|
|
218
|
-
*/
|
|
219
|
-
function setStyleValue(style, prop, value) {
|
|
220
|
-
if (prop.indexOf('-') >= 0) {
|
|
221
|
-
style.setProperty(prop, value);
|
|
222
|
-
} else {
|
|
223
|
-
// TODO(tomnguyen) Figure out why this is necessary.
|
|
224
|
-
// tslint:disable-next-line:no-any
|
|
225
|
-
style[prop] = value;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Applies a style to an Element. No vendor prefix expansion is done for
|
|
230
|
-
* property names/values.
|
|
231
|
-
* @param el
|
|
232
|
-
* @param name The attribute's name.
|
|
233
|
-
* @param style The style to set. Either a string of css or an object
|
|
234
|
-
* containing property-value pairs.
|
|
235
|
-
*/
|
|
236
|
-
function applyStyle(el, name, style) {
|
|
237
|
-
if (typeof style === 'string') {
|
|
238
|
-
el.style.cssText = style;
|
|
239
|
-
} else {
|
|
240
|
-
el.style.cssText = '';
|
|
241
|
-
var elStyle = el.style;
|
|
242
|
-
for (var prop in style) {
|
|
243
|
-
if (has(style, prop)) {
|
|
244
|
-
setStyleValue(elStyle, prop, style[prop]);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Updates a single attribute on an Element.
|
|
251
|
-
* @param el
|
|
252
|
-
* @param name The attribute's name.
|
|
253
|
-
* @param value The attribute's value. If the value is an object or
|
|
254
|
-
* function it is set on the Element, otherwise, it is set as an HTML
|
|
255
|
-
* attribute.
|
|
256
|
-
*/
|
|
257
|
-
function applyAttributeTyped(el, name, value) {
|
|
258
|
-
var type = typeof value;
|
|
259
|
-
if (type === 'object' || type === 'function') {
|
|
260
|
-
applyProp(el, name, value);
|
|
261
|
-
} else {
|
|
262
|
-
applyAttr(el, name, value);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* A publicly mutable object to provide custom mutators for attributes.
|
|
267
|
-
* NB: The result of createMap() has to be recast since closure compiler
|
|
268
|
-
* will just assume attributes is "any" otherwise and throws away
|
|
269
|
-
* the type annotation set by tsickle.
|
|
270
|
-
*/
|
|
271
|
-
var attributes = createMap();
|
|
272
|
-
// Special generic mutator that's called for any attribute that does not
|
|
273
|
-
// have a specific mutator.
|
|
274
|
-
attributes[symbols.default] = applyAttributeTyped;
|
|
275
|
-
attributes['style'] = applyStyle;
|
|
276
|
-
/**
|
|
277
|
-
* Calls the appropriate attribute mutator for this attribute.
|
|
278
|
-
*/
|
|
279
|
-
function updateAttribute(el, name, value) {
|
|
280
|
-
var mutator = attributes[name] || attributes[symbols.default];
|
|
281
|
-
mutator(el, name, value);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
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)}/**
|
|
285
47
|
* @license
|
|
286
48
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
287
49
|
*
|
|
@@ -296,151 +58,7 @@ function updateAttribute(el, name, value) {
|
|
|
296
58
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
297
59
|
* See the License for the specific language governing permissions and
|
|
298
60
|
* limitations under the License.
|
|
299
|
-
*/
|
|
300
|
-
/**
|
|
301
|
-
* Keeps track whether or not we are in an attributes declaration (after
|
|
302
|
-
* elementOpenStart, but before elementOpenEnd).
|
|
303
|
-
*/
|
|
304
|
-
var inAttributes = false;
|
|
305
|
-
/**
|
|
306
|
-
* Keeps track whether or not we are in an element that should not have its
|
|
307
|
-
* children cleared.
|
|
308
|
-
*/
|
|
309
|
-
var inSkip = false;
|
|
310
|
-
/**
|
|
311
|
-
* Makes sure that there is a current patch context.
|
|
312
|
-
*/
|
|
313
|
-
function assertInPatch(functionName, context) {
|
|
314
|
-
if (!context) {
|
|
315
|
-
throw new Error('Cannot call ' + functionName + '() unless in patch.');
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Makes sure that a patch closes every node that it opened.
|
|
320
|
-
* @param openElement
|
|
321
|
-
* @param root
|
|
322
|
-
*/
|
|
323
|
-
function assertNoUnclosedTags(openElement, root) {
|
|
324
|
-
if (openElement === root) {
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
var currentElement = openElement;
|
|
328
|
-
var openTags = [];
|
|
329
|
-
while (currentElement && currentElement !== root) {
|
|
330
|
-
openTags.push(currentElement.nodeName.toLowerCase());
|
|
331
|
-
currentElement = currentElement.parentNode;
|
|
332
|
-
}
|
|
333
|
-
throw new Error('One or more tags were not closed:\n' + openTags.join('\n'));
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
* Makes sure that node being outer patched has a parent node.
|
|
337
|
-
*/
|
|
338
|
-
function assertPatchOuterHasParentNode(parent) {
|
|
339
|
-
if (!parent) {
|
|
340
|
-
console.warn('patchOuter requires the node have a parent if there is a key.');
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Makes sure that the caller is not where attributes are expected.
|
|
345
|
-
*/
|
|
346
|
-
function assertNotInAttributes(functionName) {
|
|
347
|
-
if (inAttributes) {
|
|
348
|
-
throw new Error(functionName + '() can not be called between ' + 'elementOpenStart() and elementOpenEnd().');
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* Makes sure that the caller is not inside an element that has declared skip.
|
|
353
|
-
*/
|
|
354
|
-
function assertNotInSkip(functionName) {
|
|
355
|
-
if (inSkip) {
|
|
356
|
-
throw new Error(functionName + '() may not be called inside an element ' + 'that has called skip().');
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Makes sure that the caller is where attributes are expected.
|
|
361
|
-
*/
|
|
362
|
-
function assertInAttributes(functionName) {
|
|
363
|
-
if (!inAttributes) {
|
|
364
|
-
throw new Error(functionName + '() can only be called after calling ' + 'elementOpenStart().');
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Makes sure the patch closes virtual attributes call
|
|
369
|
-
*/
|
|
370
|
-
function assertVirtualAttributesClosed() {
|
|
371
|
-
if (inAttributes) {
|
|
372
|
-
throw new Error('elementOpenEnd() must be called after calling ' + 'elementOpenStart().');
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* Makes sure that tags are correctly nested.
|
|
377
|
-
*/
|
|
378
|
-
function assertCloseMatchesOpenTag(currentNameOrCtor, nameOrCtor) {
|
|
379
|
-
if (currentNameOrCtor !== nameOrCtor) {
|
|
380
|
-
throw new Error('Received a call to close "' + nameOrCtor + '" but "' + currentNameOrCtor + '" was open.');
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Makes sure that no children elements have been declared yet in the current
|
|
385
|
-
* element.
|
|
386
|
-
*/
|
|
387
|
-
function assertNoChildrenDeclaredYet(functionName, previousNode) {
|
|
388
|
-
if (previousNode !== null) {
|
|
389
|
-
throw new Error(functionName + '() must come before any child ' + 'declarations inside the current element.');
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* Checks that a call to patchOuter actually patched the element.
|
|
394
|
-
* @param maybeStartNode The value for the currentNode when the patch
|
|
395
|
-
* started.
|
|
396
|
-
* @param currentNode The currentNode when the patch finished.
|
|
397
|
-
* @param expectedNextNode The Node that is expected to follow the
|
|
398
|
-
* currentNode after the patch;
|
|
399
|
-
* @param expectedPrevNode The Node that is expected to preceed the
|
|
400
|
-
* currentNode after the patch.
|
|
401
|
-
*/
|
|
402
|
-
function assertPatchElementNoExtras(maybeStartNode, maybeCurrentNode, expectedNextNode, expectedPrevNode) {
|
|
403
|
-
assert(maybeStartNode);
|
|
404
|
-
var startNode = maybeStartNode;
|
|
405
|
-
// tslint:disable-next-line:no-unnecessary-type-assertion
|
|
406
|
-
var currentNode = maybeCurrentNode;
|
|
407
|
-
var wasUpdated = currentNode.nextSibling === expectedNextNode && currentNode.previousSibling === expectedPrevNode;
|
|
408
|
-
var wasChanged = currentNode.nextSibling === startNode.nextSibling && currentNode.previousSibling === expectedPrevNode;
|
|
409
|
-
var wasRemoved = currentNode === startNode;
|
|
410
|
-
if (!wasUpdated && !wasChanged && !wasRemoved) {
|
|
411
|
-
throw new Error('There must be exactly one top level call corresponding ' + 'to the patched element.');
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Updates the state of being in an attribute declaration.
|
|
416
|
-
* @return the previous value.
|
|
417
|
-
*/
|
|
418
|
-
function setInAttributes(value) {
|
|
419
|
-
var previous = inAttributes;
|
|
420
|
-
inAttributes = value;
|
|
421
|
-
return previous;
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* Updates the state of being in a skip element.
|
|
425
|
-
* @return the previous value.
|
|
426
|
-
*/
|
|
427
|
-
function setInSkip(value) {
|
|
428
|
-
var previous = inSkip;
|
|
429
|
-
inSkip = value;
|
|
430
|
-
return previous;
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* Asserts that a value exists and is not null or undefined. goog.asserts
|
|
434
|
-
* is not used in order to avoid dependencies on external code.
|
|
435
|
-
*/
|
|
436
|
-
function assert(val) {
|
|
437
|
-
if (process.env.NODE_ENV !== 'production' && !val) {
|
|
438
|
-
throw new Error('Expected value to be defined');
|
|
439
|
-
}
|
|
440
|
-
return val;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
/**
|
|
61
|
+
*/var ue=!1;function Ke(e){var t=ue;return ue=e,t}function Qe(e){return e}/**
|
|
444
62
|
* @license
|
|
445
63
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
446
64
|
*
|
|
@@ -455,13 +73,7 @@ function assert(val) {
|
|
|
455
73
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
456
74
|
* See the License for the specific language governing permissions and
|
|
457
75
|
* limitations under the License.
|
|
458
|
-
*/
|
|
459
|
-
var notifications = {
|
|
460
|
-
nodesCreated: null,
|
|
461
|
-
nodesDeleted: null
|
|
462
|
-
};
|
|
463
|
-
|
|
464
|
-
/**
|
|
76
|
+
*/var B={nodesCreated:null,nodesDeleted:null};/**
|
|
465
77
|
* @license
|
|
466
78
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
467
79
|
*
|
|
@@ -476,36 +88,7 @@ var notifications = {
|
|
|
476
88
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
477
89
|
* See the License for the specific language governing permissions and
|
|
478
90
|
* limitations under the License.
|
|
479
|
-
*/
|
|
480
|
-
/**
|
|
481
|
-
* A context object keeps track of the state of a patch.
|
|
482
|
-
*/
|
|
483
|
-
var Context = /** @class */function () {
|
|
484
|
-
function Context() {
|
|
485
|
-
this.created = [];
|
|
486
|
-
this.deleted = [];
|
|
487
|
-
}
|
|
488
|
-
Context.prototype.markCreated = function (node) {
|
|
489
|
-
this.created.push(node);
|
|
490
|
-
};
|
|
491
|
-
Context.prototype.markDeleted = function (node) {
|
|
492
|
-
this.deleted.push(node);
|
|
493
|
-
};
|
|
494
|
-
/**
|
|
495
|
-
* Notifies about nodes that were created during the patch operation.
|
|
496
|
-
*/
|
|
497
|
-
Context.prototype.notifyChanges = function () {
|
|
498
|
-
if (notifications.nodesCreated && this.created.length > 0) {
|
|
499
|
-
notifications.nodesCreated(this.created);
|
|
500
|
-
}
|
|
501
|
-
if (notifications.nodesDeleted && this.deleted.length > 0) {
|
|
502
|
-
notifications.nodesDeleted(this.deleted);
|
|
503
|
-
}
|
|
504
|
-
};
|
|
505
|
-
return Context;
|
|
506
|
-
}();
|
|
507
|
-
|
|
508
|
-
/**
|
|
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}();/**
|
|
509
92
|
* @license
|
|
510
93
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
511
94
|
*
|
|
@@ -520,103 +103,7 @@ var Context = /** @class */function () {
|
|
|
520
103
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
521
104
|
* See the License for the specific language governing permissions and
|
|
522
105
|
* limitations under the License.
|
|
523
|
-
*/
|
|
524
|
-
/**
|
|
525
|
-
* Checks if the node is the root of a document. This is either a Document
|
|
526
|
-
* or ShadowRoot. DocumentFragments are included for simplicity of the
|
|
527
|
-
* implementation, though we only want to consider Documents or ShadowRoots.
|
|
528
|
-
* @param node The node to check.
|
|
529
|
-
* @return True if the node the root of a document, false otherwise.
|
|
530
|
-
*/
|
|
531
|
-
function isDocumentRoot(node) {
|
|
532
|
-
return node.nodeType === 11 || node.nodeType === 9;
|
|
533
|
-
}
|
|
534
|
-
/**
|
|
535
|
-
* Checks if the node is an Element. This is faster than an instanceof check.
|
|
536
|
-
* @param node The node to check.
|
|
537
|
-
* @return Whether or not the node is an Element.
|
|
538
|
-
*/
|
|
539
|
-
function isElement(node) {
|
|
540
|
-
return node.nodeType === 1;
|
|
541
|
-
}
|
|
542
|
-
/**
|
|
543
|
-
* Checks if the node is a text node. This is faster than an instanceof check.
|
|
544
|
-
* @param node The node to check.
|
|
545
|
-
* @return Whether or not the node is a Text.
|
|
546
|
-
*/
|
|
547
|
-
function isText(node) {
|
|
548
|
-
return node.nodeType === 3;
|
|
549
|
-
}
|
|
550
|
-
/**
|
|
551
|
-
* @param node The node to start at, inclusive.
|
|
552
|
-
* @param root The root ancestor to get until, exclusive.
|
|
553
|
-
* @return The ancestry of DOM nodes.
|
|
554
|
-
*/
|
|
555
|
-
function getAncestry(node, root) {
|
|
556
|
-
var ancestry = [];
|
|
557
|
-
var cur = node;
|
|
558
|
-
while (cur !== root) {
|
|
559
|
-
var n = cur;
|
|
560
|
-
ancestry.push(n);
|
|
561
|
-
cur = n.parentNode;
|
|
562
|
-
}
|
|
563
|
-
return ancestry;
|
|
564
|
-
}
|
|
565
|
-
/**
|
|
566
|
-
* return The root node of the DOM tree that contains this node.
|
|
567
|
-
*/
|
|
568
|
-
var getRootNode =
|
|
569
|
-
// tslint:disable-next-line:no-any b/79476176
|
|
570
|
-
Node.prototype.getRootNode || function () {
|
|
571
|
-
// tslint:disable-next-line:no-unnecessary-type-assertion b/77361044
|
|
572
|
-
var cur = this;
|
|
573
|
-
var prev = cur;
|
|
574
|
-
while (cur) {
|
|
575
|
-
prev = cur;
|
|
576
|
-
cur = cur.parentNode;
|
|
577
|
-
}
|
|
578
|
-
return prev;
|
|
579
|
-
};
|
|
580
|
-
/**
|
|
581
|
-
* @param node The node to get the activeElement for.
|
|
582
|
-
* @return The activeElement in the Document or ShadowRoot
|
|
583
|
-
* corresponding to node, if present.
|
|
584
|
-
*/
|
|
585
|
-
function getActiveElement(node) {
|
|
586
|
-
var root = getRootNode.call(node);
|
|
587
|
-
return isDocumentRoot(root) ? root.activeElement : null;
|
|
588
|
-
}
|
|
589
|
-
/**
|
|
590
|
-
* Gets the path of nodes that contain the focused node in the same document as
|
|
591
|
-
* a reference node, up until the root.
|
|
592
|
-
* @param node The reference node to get the activeElement for.
|
|
593
|
-
* @param root The root to get the focused path until.
|
|
594
|
-
*/
|
|
595
|
-
function getFocusedPath(node, root) {
|
|
596
|
-
var activeElement = getActiveElement(node);
|
|
597
|
-
if (!activeElement || !node.contains(activeElement)) {
|
|
598
|
-
return [];
|
|
599
|
-
}
|
|
600
|
-
return getAncestry(activeElement, root);
|
|
601
|
-
}
|
|
602
|
-
/**
|
|
603
|
-
* Like insertBefore, but instead instead of moving the desired node, instead
|
|
604
|
-
* moves all the other nodes after.
|
|
605
|
-
* @param parentNode
|
|
606
|
-
* @param node
|
|
607
|
-
* @param referenceNode
|
|
608
|
-
*/
|
|
609
|
-
function moveBefore(parentNode, node, referenceNode) {
|
|
610
|
-
var insertReferenceNode = node.nextSibling;
|
|
611
|
-
var cur = referenceNode;
|
|
612
|
-
while (cur !== null && cur !== node) {
|
|
613
|
-
var next = cur.nextSibling;
|
|
614
|
-
parentNode.insertBefore(cur, insertReferenceNode);
|
|
615
|
-
cur = next;
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
/**
|
|
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}}/**
|
|
620
107
|
* @license
|
|
621
108
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
622
109
|
*
|
|
@@ -631,116 +118,7 @@ function moveBefore(parentNode, node, referenceNode) {
|
|
|
631
118
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
632
119
|
* See the License for the specific language governing permissions and
|
|
633
120
|
* limitations under the License.
|
|
634
|
-
*/
|
|
635
|
-
/**
|
|
636
|
-
* Keeps track of information needed to perform diffs for a given DOM node.
|
|
637
|
-
*/
|
|
638
|
-
var NodeData = /** @class */function () {
|
|
639
|
-
function NodeData(nameOrCtor, key, text) {
|
|
640
|
-
/**
|
|
641
|
-
* An array of attribute name/value pairs, used for quickly diffing the
|
|
642
|
-
* incomming attributes to see if the DOM node's attributes need to be
|
|
643
|
-
* updated.
|
|
644
|
-
*/
|
|
645
|
-
// tslint:disable-next-line:no-any
|
|
646
|
-
this._attrsArr = null;
|
|
647
|
-
/**
|
|
648
|
-
* Whether or not the statics have been applied for the node yet.
|
|
649
|
-
*/
|
|
650
|
-
this.staticsApplied = false;
|
|
651
|
-
this.nameOrCtor = nameOrCtor;
|
|
652
|
-
this.key = key;
|
|
653
|
-
this.text = text;
|
|
654
|
-
}
|
|
655
|
-
NodeData.prototype.hasEmptyAttrsArr = function () {
|
|
656
|
-
var attrs = this._attrsArr;
|
|
657
|
-
return !attrs || !attrs.length;
|
|
658
|
-
};
|
|
659
|
-
NodeData.prototype.getAttrsArr = function (length) {
|
|
660
|
-
return this._attrsArr || (this._attrsArr = new Array(length));
|
|
661
|
-
};
|
|
662
|
-
return NodeData;
|
|
663
|
-
}();
|
|
664
|
-
/**
|
|
665
|
-
* Initializes a NodeData object for a Node.
|
|
666
|
-
*/
|
|
667
|
-
function initData(node, nameOrCtor, key, text) {
|
|
668
|
-
var data = new NodeData(nameOrCtor, key, text);
|
|
669
|
-
node['__incrementalDOMData'] = data;
|
|
670
|
-
return data;
|
|
671
|
-
}
|
|
672
|
-
/**
|
|
673
|
-
* Retrieves the NodeData object for a Node, creating it if necessary.
|
|
674
|
-
*/
|
|
675
|
-
function getData(node, key) {
|
|
676
|
-
return importSingleNode(node, key);
|
|
677
|
-
}
|
|
678
|
-
function isDataInitialized(node) {
|
|
679
|
-
return Boolean(node['__incrementalDOMData']);
|
|
680
|
-
}
|
|
681
|
-
function getKey(node) {
|
|
682
|
-
assert(node['__incrementalDOMData']);
|
|
683
|
-
return getData(node).key;
|
|
684
|
-
}
|
|
685
|
-
/**
|
|
686
|
-
* Imports single node and its subtree, initializing caches.
|
|
687
|
-
*/
|
|
688
|
-
function importSingleNode(node, fallbackKey) {
|
|
689
|
-
if (node['__incrementalDOMData']) {
|
|
690
|
-
return node['__incrementalDOMData'];
|
|
691
|
-
}
|
|
692
|
-
var nodeName = isElement(node) ? node.localName : node.nodeName;
|
|
693
|
-
var key = isElement(node) ? node.getAttribute('key') || fallbackKey : null;
|
|
694
|
-
var text = isText(node) ? node.data : undefined;
|
|
695
|
-
var data = initData(node, nodeName, key, text);
|
|
696
|
-
if (isElement(node)) {
|
|
697
|
-
recordAttributes(node, data);
|
|
698
|
-
}
|
|
699
|
-
return data;
|
|
700
|
-
}
|
|
701
|
-
/**
|
|
702
|
-
* Imports node and its subtree, initializing caches.
|
|
703
|
-
*/
|
|
704
|
-
function importNode(node) {
|
|
705
|
-
importSingleNode(node);
|
|
706
|
-
for (var child = node.firstChild; child; child = child.nextSibling) {
|
|
707
|
-
importNode(child);
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
/**
|
|
711
|
-
* Clears all caches from a node and all of its children.
|
|
712
|
-
*/
|
|
713
|
-
function clearCache(node) {
|
|
714
|
-
node['__incrementalDOMData'] = null;
|
|
715
|
-
for (var child = node.firstChild; child; child = child.nextSibling) {
|
|
716
|
-
clearCache(child);
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
/**
|
|
720
|
-
* Records the element's attributes.
|
|
721
|
-
* @param node The Element that may have attributes
|
|
722
|
-
* @param data The Element's data
|
|
723
|
-
*/
|
|
724
|
-
function recordAttributes(node, data) {
|
|
725
|
-
var attributes = node.attributes;
|
|
726
|
-
var length = attributes.length;
|
|
727
|
-
if (!length) {
|
|
728
|
-
return;
|
|
729
|
-
}
|
|
730
|
-
var attrsArr = data.getAttrsArr(length);
|
|
731
|
-
// Use a cached length. The attributes array is really a live NamedNodeMap,
|
|
732
|
-
// which exists as a DOM "Host Object" (probably as C++ code). This makes the
|
|
733
|
-
// usual constant length iteration very difficult to optimize in JITs.
|
|
734
|
-
for (var i = 0, j = 0; i < length; i += 1, j += 2) {
|
|
735
|
-
var attr = attributes[i];
|
|
736
|
-
var name = attr.name;
|
|
737
|
-
var value = attr.value;
|
|
738
|
-
attrsArr[j] = name;
|
|
739
|
-
attrsArr[j + 1] = value;
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
/**
|
|
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}}/**
|
|
744
122
|
* @license
|
|
745
123
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
746
124
|
*
|
|
@@ -755,59 +133,7 @@ function recordAttributes(node, data) {
|
|
|
755
133
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
756
134
|
* See the License for the specific language governing permissions and
|
|
757
135
|
* limitations under the License.
|
|
758
|
-
*/
|
|
759
|
-
/**
|
|
760
|
-
* Gets the namespace to create an element (of a given tag) in.
|
|
761
|
-
*/
|
|
762
|
-
function getNamespaceForTag(tag, parent) {
|
|
763
|
-
if (tag === 'svg') {
|
|
764
|
-
return 'http://www.w3.org/2000/svg';
|
|
765
|
-
}
|
|
766
|
-
if (tag === 'math') {
|
|
767
|
-
return 'http://www.w3.org/1998/Math/MathML';
|
|
768
|
-
}
|
|
769
|
-
if (parent == null) {
|
|
770
|
-
return null;
|
|
771
|
-
}
|
|
772
|
-
if (getData(parent).nameOrCtor === 'foreignObject') {
|
|
773
|
-
return null;
|
|
774
|
-
}
|
|
775
|
-
return parent.namespaceURI;
|
|
776
|
-
}
|
|
777
|
-
/**
|
|
778
|
-
* Creates an Element.
|
|
779
|
-
* @param doc The document with which to create the Element.
|
|
780
|
-
* @param nameOrCtor The tag or constructor for the Element.
|
|
781
|
-
* @param key A key to identify the Element.
|
|
782
|
-
* @param typeId The type identifier for the Element.
|
|
783
|
-
*/
|
|
784
|
-
function createElement(doc, parent, nameOrCtor, key) {
|
|
785
|
-
var el;
|
|
786
|
-
if (typeof nameOrCtor === 'function') {
|
|
787
|
-
el = new nameOrCtor();
|
|
788
|
-
} else {
|
|
789
|
-
var namespace = getNamespaceForTag(nameOrCtor, parent);
|
|
790
|
-
if (namespace) {
|
|
791
|
-
el = doc.createElementNS(namespace, nameOrCtor);
|
|
792
|
-
} else {
|
|
793
|
-
el = doc.createElement(nameOrCtor);
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
initData(el, nameOrCtor, key);
|
|
797
|
-
return el;
|
|
798
|
-
}
|
|
799
|
-
/**
|
|
800
|
-
* Creates a Text Node.
|
|
801
|
-
* @param doc The document with which to create the Element.
|
|
802
|
-
* @return
|
|
803
|
-
*/
|
|
804
|
-
function createText(doc) {
|
|
805
|
-
var node = doc.createTextNode('');
|
|
806
|
-
initData(node, '#text', null);
|
|
807
|
-
return node;
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
/**
|
|
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}/**
|
|
811
137
|
* @license
|
|
812
138
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
813
139
|
*
|
|
@@ -822,303 +148,7 @@ function createText(doc) {
|
|
|
822
148
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
823
149
|
* See the License for the specific language governing permissions and
|
|
824
150
|
* limitations under the License.
|
|
825
|
-
*/
|
|
826
|
-
var context = null;
|
|
827
|
-
var currentNode = null;
|
|
828
|
-
var currentParent = null;
|
|
829
|
-
var doc = null;
|
|
830
|
-
var focusPath = [];
|
|
831
|
-
/**
|
|
832
|
-
* Used to build up call arguments. Each patch call gets a separate copy, so
|
|
833
|
-
* this works with nested calls to patch.
|
|
834
|
-
*/
|
|
835
|
-
var argsBuilder = [];
|
|
836
|
-
/**
|
|
837
|
-
* TODO(sparhami) We should just export argsBuilder directly when Closure
|
|
838
|
-
* Compiler supports ES6 directly.
|
|
839
|
-
*/
|
|
840
|
-
function getArgsBuilder() {
|
|
841
|
-
return argsBuilder;
|
|
842
|
-
}
|
|
843
|
-
/**
|
|
844
|
-
* Returns a patcher function that sets up and restores a patch context,
|
|
845
|
-
* running the run function with the provided data.
|
|
846
|
-
*/
|
|
847
|
-
function patchFactory(run) {
|
|
848
|
-
var f = function (node, fn, data) {
|
|
849
|
-
var prevContext = context;
|
|
850
|
-
var prevDoc = doc;
|
|
851
|
-
var prevFocusPath = focusPath;
|
|
852
|
-
var prevArgsBuilder = argsBuilder;
|
|
853
|
-
var prevCurrentNode = currentNode;
|
|
854
|
-
var prevCurrentParent = currentParent;
|
|
855
|
-
var previousInAttributes = false;
|
|
856
|
-
var previousInSkip = false;
|
|
857
|
-
context = new Context();
|
|
858
|
-
doc = node.ownerDocument;
|
|
859
|
-
argsBuilder = [];
|
|
860
|
-
currentParent = node.parentNode;
|
|
861
|
-
focusPath = getFocusedPath(node, currentParent);
|
|
862
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
863
|
-
previousInAttributes = setInAttributes(false);
|
|
864
|
-
previousInSkip = setInSkip(false);
|
|
865
|
-
}
|
|
866
|
-
try {
|
|
867
|
-
var retVal = run(node, fn, data);
|
|
868
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
869
|
-
assertVirtualAttributesClosed();
|
|
870
|
-
}
|
|
871
|
-
return retVal;
|
|
872
|
-
} finally {
|
|
873
|
-
doc = prevDoc;
|
|
874
|
-
argsBuilder = prevArgsBuilder;
|
|
875
|
-
currentNode = prevCurrentNode;
|
|
876
|
-
currentParent = prevCurrentParent;
|
|
877
|
-
focusPath = prevFocusPath;
|
|
878
|
-
context.notifyChanges();
|
|
879
|
-
// Needs to be done after assertions because assertions rely on state
|
|
880
|
-
// from these methods.
|
|
881
|
-
setInAttributes(previousInAttributes);
|
|
882
|
-
setInSkip(previousInSkip);
|
|
883
|
-
context = prevContext;
|
|
884
|
-
}
|
|
885
|
-
};
|
|
886
|
-
return f;
|
|
887
|
-
}
|
|
888
|
-
/**
|
|
889
|
-
* Patches the document starting at node with the provided function. This
|
|
890
|
-
* function may be called during an existing patch operation.
|
|
891
|
-
*/
|
|
892
|
-
var patchInner = patchFactory(function (node, fn, data) {
|
|
893
|
-
currentNode = node;
|
|
894
|
-
enterNode();
|
|
895
|
-
fn(data);
|
|
896
|
-
exitNode();
|
|
897
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
898
|
-
assertNoUnclosedTags(currentNode, node);
|
|
899
|
-
}
|
|
900
|
-
return node;
|
|
901
|
-
});
|
|
902
|
-
/**
|
|
903
|
-
* Patches an Element with the the provided function. Exactly one top level
|
|
904
|
-
* element call should be made corresponding to `node`.
|
|
905
|
-
*/
|
|
906
|
-
var patchOuter = patchFactory(function (node, fn, data) {
|
|
907
|
-
// tslint:disable-next-line:no-any
|
|
908
|
-
var startNode = { nextSibling: node };
|
|
909
|
-
var expectedNextNode = null;
|
|
910
|
-
var expectedPrevNode = null;
|
|
911
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
912
|
-
expectedNextNode = node.nextSibling;
|
|
913
|
-
expectedPrevNode = node.previousSibling;
|
|
914
|
-
}
|
|
915
|
-
currentNode = startNode;
|
|
916
|
-
fn(data);
|
|
917
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
918
|
-
assertPatchOuterHasParentNode(currentParent);
|
|
919
|
-
assertPatchElementNoExtras(startNode, currentNode, expectedNextNode, expectedPrevNode);
|
|
920
|
-
}
|
|
921
|
-
if (currentParent) {
|
|
922
|
-
clearUnvisitedDOM(currentParent, getNextNode(), node.nextSibling);
|
|
923
|
-
}
|
|
924
|
-
return startNode === currentNode ? null : currentNode;
|
|
925
|
-
});
|
|
926
|
-
/**
|
|
927
|
-
* Checks whether or not the current node matches the specified nameOrCtor and
|
|
928
|
-
* key.
|
|
929
|
-
* @param matchNode A node to match the data to.
|
|
930
|
-
* @param nameOrCtor The name or constructor to check for.
|
|
931
|
-
* @param key The key used to identify the Node.
|
|
932
|
-
* @return True if the node matches, false otherwise.
|
|
933
|
-
*/
|
|
934
|
-
function matches(matchNode, nameOrCtor, key) {
|
|
935
|
-
var data = getData(matchNode, key);
|
|
936
|
-
// Key check is done using double equals as we want to treat a null key the
|
|
937
|
-
// same as undefined. This should be okay as the only values allowed are
|
|
938
|
-
// strings, null and undefined so the == semantics are not too weird.
|
|
939
|
-
// tslint:disable-next-line:triple-equals
|
|
940
|
-
return nameOrCtor == data.nameOrCtor && key == data.key;
|
|
941
|
-
}
|
|
942
|
-
/**
|
|
943
|
-
* Finds the matching node, starting at `node` and looking at the subsequent
|
|
944
|
-
* siblings if a key is used.
|
|
945
|
-
* @param node The node to start looking at.
|
|
946
|
-
* @param nameOrCtor The name or constructor for the Node.
|
|
947
|
-
* @param key The key used to identify the Node.
|
|
948
|
-
*/
|
|
949
|
-
function getMatchingNode(matchNode, nameOrCtor, key) {
|
|
950
|
-
if (!matchNode) {
|
|
951
|
-
return null;
|
|
952
|
-
}
|
|
953
|
-
if (matches(matchNode, nameOrCtor, key)) {
|
|
954
|
-
return matchNode;
|
|
955
|
-
}
|
|
956
|
-
if (key) {
|
|
957
|
-
while (matchNode = matchNode.nextSibling) {
|
|
958
|
-
if (matches(matchNode, nameOrCtor, key)) {
|
|
959
|
-
return matchNode;
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
return null;
|
|
964
|
-
}
|
|
965
|
-
/**
|
|
966
|
-
* Creates a Node and marking it as created.
|
|
967
|
-
* @param nameOrCtor The name or constructor for the Node.
|
|
968
|
-
* @param key The key used to identify the Node.
|
|
969
|
-
* @return The newly created node.
|
|
970
|
-
*/
|
|
971
|
-
function createNode(nameOrCtor, key) {
|
|
972
|
-
var node;
|
|
973
|
-
if (nameOrCtor === '#text') {
|
|
974
|
-
node = createText(doc);
|
|
975
|
-
} else {
|
|
976
|
-
node = createElement(doc, currentParent, nameOrCtor, key);
|
|
977
|
-
}
|
|
978
|
-
context.markCreated(node);
|
|
979
|
-
return node;
|
|
980
|
-
}
|
|
981
|
-
/**
|
|
982
|
-
* Aligns the virtual Node definition with the actual DOM, moving the
|
|
983
|
-
* corresponding DOM node to the correct location or creating it if necessary.
|
|
984
|
-
* @param nameOrCtor The name or constructor for the Node.
|
|
985
|
-
* @param key The key used to identify the Node.
|
|
986
|
-
*/
|
|
987
|
-
function alignWithDOM(nameOrCtor, key) {
|
|
988
|
-
var existingNode = getMatchingNode(currentNode, nameOrCtor, key);
|
|
989
|
-
var node = existingNode || createNode(nameOrCtor, key);
|
|
990
|
-
// If we are at the matching node, then we are done.
|
|
991
|
-
if (node === currentNode) {
|
|
992
|
-
return;
|
|
993
|
-
}
|
|
994
|
-
// Re-order the node into the right position, preserving focus if either
|
|
995
|
-
// node or currentNode are focused by making sure that they are not detached
|
|
996
|
-
// from the DOM.
|
|
997
|
-
if (focusPath.indexOf(node) >= 0) {
|
|
998
|
-
// Move everything else before the node.
|
|
999
|
-
moveBefore(currentParent, node, currentNode);
|
|
1000
|
-
} else {
|
|
1001
|
-
currentParent.insertBefore(node, currentNode);
|
|
1002
|
-
}
|
|
1003
|
-
currentNode = node;
|
|
1004
|
-
}
|
|
1005
|
-
/**
|
|
1006
|
-
* Clears out any unvisited Nodes in a given range.
|
|
1007
|
-
* @param maybeParentNode
|
|
1008
|
-
* @param startNode The node to start clearing from, inclusive.
|
|
1009
|
-
* @param endNode The node to clear until, exclusive.
|
|
1010
|
-
*/
|
|
1011
|
-
function clearUnvisitedDOM(maybeParentNode, startNode, endNode) {
|
|
1012
|
-
var parentNode = maybeParentNode;
|
|
1013
|
-
var child = startNode;
|
|
1014
|
-
while (child !== endNode) {
|
|
1015
|
-
var next = child.nextSibling;
|
|
1016
|
-
parentNode.removeChild(child);
|
|
1017
|
-
context.markDeleted(child);
|
|
1018
|
-
child = next;
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
/**
|
|
1022
|
-
* Changes to the first child of the current node.
|
|
1023
|
-
*/
|
|
1024
|
-
function enterNode() {
|
|
1025
|
-
currentParent = currentNode;
|
|
1026
|
-
currentNode = null;
|
|
1027
|
-
}
|
|
1028
|
-
/**
|
|
1029
|
-
* @return The next Node to be patched.
|
|
1030
|
-
*/
|
|
1031
|
-
function getNextNode() {
|
|
1032
|
-
if (currentNode) {
|
|
1033
|
-
return currentNode.nextSibling;
|
|
1034
|
-
} else {
|
|
1035
|
-
return currentParent.firstChild;
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
/**
|
|
1039
|
-
* Changes to the next sibling of the current node.
|
|
1040
|
-
*/
|
|
1041
|
-
function nextNode() {
|
|
1042
|
-
currentNode = getNextNode();
|
|
1043
|
-
}
|
|
1044
|
-
/**
|
|
1045
|
-
* Changes to the parent of the current node, removing any unvisited children.
|
|
1046
|
-
*/
|
|
1047
|
-
function exitNode() {
|
|
1048
|
-
clearUnvisitedDOM(currentParent, getNextNode(), null);
|
|
1049
|
-
currentNode = currentParent;
|
|
1050
|
-
currentParent = currentParent.parentNode;
|
|
1051
|
-
}
|
|
1052
|
-
/**
|
|
1053
|
-
* Makes sure that the current node is an Element with a matching nameOrCtor and
|
|
1054
|
-
* key.
|
|
1055
|
-
*
|
|
1056
|
-
* @param nameOrCtor The tag or constructor for the Element.
|
|
1057
|
-
* @param key The key used to identify this element. This can be an
|
|
1058
|
-
* empty string, but performance may be better if a unique value is used
|
|
1059
|
-
* when iterating over an array of items.
|
|
1060
|
-
* @return The corresponding Element.
|
|
1061
|
-
*/
|
|
1062
|
-
function open(nameOrCtor, key) {
|
|
1063
|
-
nextNode();
|
|
1064
|
-
alignWithDOM(nameOrCtor, key);
|
|
1065
|
-
enterNode();
|
|
1066
|
-
return currentParent;
|
|
1067
|
-
}
|
|
1068
|
-
/**
|
|
1069
|
-
* Closes the currently open Element, removing any unvisited children if
|
|
1070
|
-
* necessary.
|
|
1071
|
-
*/
|
|
1072
|
-
function close() {
|
|
1073
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1074
|
-
setInSkip(false);
|
|
1075
|
-
}
|
|
1076
|
-
exitNode();
|
|
1077
|
-
return currentNode;
|
|
1078
|
-
}
|
|
1079
|
-
/**
|
|
1080
|
-
* Makes sure the current node is a Text node and creates a Text node if it is
|
|
1081
|
-
* not.
|
|
1082
|
-
*/
|
|
1083
|
-
function text() {
|
|
1084
|
-
nextNode();
|
|
1085
|
-
alignWithDOM('#text', null);
|
|
1086
|
-
return currentNode;
|
|
1087
|
-
}
|
|
1088
|
-
/**
|
|
1089
|
-
* Gets the current Element being patched.
|
|
1090
|
-
*/
|
|
1091
|
-
function currentElement() {
|
|
1092
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1093
|
-
assertInPatch('currentElement', doc);
|
|
1094
|
-
assertNotInAttributes('currentElement');
|
|
1095
|
-
}
|
|
1096
|
-
return currentParent;
|
|
1097
|
-
}
|
|
1098
|
-
/**
|
|
1099
|
-
* @return The Node that will be evaluated for the next instruction.
|
|
1100
|
-
*/
|
|
1101
|
-
function currentPointer() {
|
|
1102
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1103
|
-
assertInPatch('currentPointer', doc);
|
|
1104
|
-
assertNotInAttributes('currentPointer');
|
|
1105
|
-
}
|
|
1106
|
-
// TODO(tomnguyen): assert that this is not null
|
|
1107
|
-
return getNextNode();
|
|
1108
|
-
}
|
|
1109
|
-
/**
|
|
1110
|
-
* Skips the children in a subtree, allowing an Element to be closed without
|
|
1111
|
-
* clearing out the children.
|
|
1112
|
-
*/
|
|
1113
|
-
function skip() {
|
|
1114
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1115
|
-
assertNoChildrenDeclaredYet('skip', currentNode);
|
|
1116
|
-
setInSkip(true);
|
|
1117
|
-
}
|
|
1118
|
-
currentNode = currentParent.lastChild;
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
/**
|
|
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}/**
|
|
1122
152
|
* @license
|
|
1123
153
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
1124
154
|
*
|
|
@@ -1133,300 +163,7 @@ function skip() {
|
|
|
1133
163
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1134
164
|
* See the License for the specific language governing permissions and
|
|
1135
165
|
* limitations under the License.
|
|
1136
|
-
*/
|
|
1137
|
-
/**
|
|
1138
|
-
* The offset in the virtual element declaration where the attributes are
|
|
1139
|
-
* specified.
|
|
1140
|
-
*/
|
|
1141
|
-
var ATTRIBUTES_OFFSET = 3;
|
|
1142
|
-
/**
|
|
1143
|
-
* Used to keep track of the previous values when a 2-way diff is necessary.
|
|
1144
|
-
* This object is reused.
|
|
1145
|
-
* TODO(sparhamI) Scope this to a patch so you can call patch from an attribute
|
|
1146
|
-
* update.
|
|
1147
|
-
*/
|
|
1148
|
-
var prevAttrsMap = createMap();
|
|
1149
|
-
/**
|
|
1150
|
-
* Applies the statics. When importing an Element, any existing attributes that
|
|
1151
|
-
* match a static are converted into a static attribute.
|
|
1152
|
-
* @param node The Element to apply statics for.
|
|
1153
|
-
* @param data The Element's data
|
|
1154
|
-
* @param statics The statics array,
|
|
1155
|
-
*/
|
|
1156
|
-
function applyStatics(node, data, statics) {
|
|
1157
|
-
data.staticsApplied = true;
|
|
1158
|
-
if (!statics || !statics.length) {
|
|
1159
|
-
return;
|
|
1160
|
-
}
|
|
1161
|
-
if (data.hasEmptyAttrsArr()) {
|
|
1162
|
-
for (var i = 0; i < statics.length; i += 2) {
|
|
1163
|
-
updateAttribute(node, statics[i], statics[i + 1]);
|
|
1164
|
-
}
|
|
1165
|
-
return;
|
|
1166
|
-
}
|
|
1167
|
-
for (var i = 0; i < statics.length; i += 2) {
|
|
1168
|
-
prevAttrsMap[statics[i]] = i + 1;
|
|
1169
|
-
}
|
|
1170
|
-
var attrsArr = data.getAttrsArr(0);
|
|
1171
|
-
var j = 0;
|
|
1172
|
-
for (var i = 0; i < attrsArr.length; i += 2) {
|
|
1173
|
-
var name = attrsArr[i];
|
|
1174
|
-
var value = attrsArr[i + 1];
|
|
1175
|
-
var staticsIndex = prevAttrsMap[name];
|
|
1176
|
-
if (staticsIndex) {
|
|
1177
|
-
// For any attrs that are static and have the same value, make sure we do
|
|
1178
|
-
// not set them again.
|
|
1179
|
-
if (statics[staticsIndex] === value) {
|
|
1180
|
-
delete prevAttrsMap[name];
|
|
1181
|
-
}
|
|
1182
|
-
continue;
|
|
1183
|
-
}
|
|
1184
|
-
// For any attrs that are dynamic, move them up to the right place.
|
|
1185
|
-
attrsArr[j] = name;
|
|
1186
|
-
attrsArr[j + 1] = value;
|
|
1187
|
-
j += 2;
|
|
1188
|
-
}
|
|
1189
|
-
// Anything after `j` was either moved up already or static.
|
|
1190
|
-
truncateArray(attrsArr, j);
|
|
1191
|
-
for (var name in prevAttrsMap) {
|
|
1192
|
-
updateAttribute(node, name, statics[prevAttrsMap[name]]);
|
|
1193
|
-
delete prevAttrsMap[name];
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
/**
|
|
1197
|
-
* @param nameOrCtor The Element's tag or constructor.
|
|
1198
|
-
* @param key The key used to identify this element. This can be an
|
|
1199
|
-
* empty string, but performance may be better if a unique value is used
|
|
1200
|
-
* when iterating over an array of items.
|
|
1201
|
-
* @param statics An array of attribute name/value pairs of the static
|
|
1202
|
-
* attributes for the Element. Attributes will only be set once when the
|
|
1203
|
-
* Element is created.
|
|
1204
|
-
* @param varArgs, Attribute name/value pairs of the dynamic attributes
|
|
1205
|
-
* for the Element.
|
|
1206
|
-
* @return The corresponding Element.
|
|
1207
|
-
*/
|
|
1208
|
-
function elementOpen(nameOrCtor, key,
|
|
1209
|
-
// Ideally we could tag statics and varArgs as an array where every odd
|
|
1210
|
-
// element is a string and every even element is any, but this is hard.
|
|
1211
|
-
// tslint:disable-next-line:no-any
|
|
1212
|
-
statics) {
|
|
1213
|
-
var varArgs = [];
|
|
1214
|
-
for (var _i = 3; _i < arguments.length; _i++) {
|
|
1215
|
-
varArgs[_i - 3] = arguments[_i];
|
|
1216
|
-
}
|
|
1217
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1218
|
-
assertNotInAttributes('elementOpen');
|
|
1219
|
-
assertNotInSkip('elementOpen');
|
|
1220
|
-
}
|
|
1221
|
-
var node = open(nameOrCtor, key);
|
|
1222
|
-
var data = getData(node);
|
|
1223
|
-
if (!data.staticsApplied) {
|
|
1224
|
-
applyStatics(node, data, statics);
|
|
1225
|
-
}
|
|
1226
|
-
var attrsLength = Math.max(0, arguments.length - ATTRIBUTES_OFFSET);
|
|
1227
|
-
var hadNoAttrs = data.hasEmptyAttrsArr();
|
|
1228
|
-
if (!attrsLength && hadNoAttrs) {
|
|
1229
|
-
return node;
|
|
1230
|
-
}
|
|
1231
|
-
var attrsArr = data.getAttrsArr(attrsLength);
|
|
1232
|
-
/*
|
|
1233
|
-
* Checks to see if one or more attributes have changed for a given Element.
|
|
1234
|
-
* When no attributes have changed, this is much faster than checking each
|
|
1235
|
-
* individual argument. When attributes have changed, the overhead of this is
|
|
1236
|
-
* minimal.
|
|
1237
|
-
*/
|
|
1238
|
-
var i = ATTRIBUTES_OFFSET;
|
|
1239
|
-
var j = 0;
|
|
1240
|
-
for (; i < arguments.length; i += 2, j += 2) {
|
|
1241
|
-
var name = arguments[i];
|
|
1242
|
-
if (hadNoAttrs) {
|
|
1243
|
-
attrsArr[j] = name;
|
|
1244
|
-
} else if (attrsArr[j] !== name) {
|
|
1245
|
-
break;
|
|
1246
|
-
}
|
|
1247
|
-
var value = arguments[i + 1];
|
|
1248
|
-
if (hadNoAttrs || attrsArr[j + 1] !== value) {
|
|
1249
|
-
attrsArr[j + 1] = value;
|
|
1250
|
-
updateAttribute(node, name, value);
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
/*
|
|
1254
|
-
* Items did not line up exactly as before, need to make sure old items are
|
|
1255
|
-
* removed. This can happen if using conditional logic when declaring
|
|
1256
|
-
* attrs through the elementOpenStart flow or if one element is reused in
|
|
1257
|
-
* the place of another.
|
|
1258
|
-
*/
|
|
1259
|
-
if (i < arguments.length || j < attrsArr.length) {
|
|
1260
|
-
var attrsStart = j;
|
|
1261
|
-
for (; j < attrsArr.length; j += 2) {
|
|
1262
|
-
prevAttrsMap[attrsArr[j]] = attrsArr[j + 1];
|
|
1263
|
-
}
|
|
1264
|
-
for (j = attrsStart; i < arguments.length; i += 2, j += 2) {
|
|
1265
|
-
var name = arguments[i];
|
|
1266
|
-
var value = arguments[i + 1];
|
|
1267
|
-
if (prevAttrsMap[name] !== value) {
|
|
1268
|
-
updateAttribute(node, name, value);
|
|
1269
|
-
}
|
|
1270
|
-
attrsArr[j] = name;
|
|
1271
|
-
attrsArr[j + 1] = value;
|
|
1272
|
-
delete prevAttrsMap[name];
|
|
1273
|
-
}
|
|
1274
|
-
truncateArray(attrsArr, j);
|
|
1275
|
-
/*
|
|
1276
|
-
* At this point, only have attributes that were present before, but have
|
|
1277
|
-
* been removed.
|
|
1278
|
-
*/
|
|
1279
|
-
for (var name in prevAttrsMap) {
|
|
1280
|
-
updateAttribute(node, name, undefined);
|
|
1281
|
-
delete prevAttrsMap[name];
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
return node;
|
|
1285
|
-
}
|
|
1286
|
-
/**
|
|
1287
|
-
* Declares a virtual Element at the current location in the document. This
|
|
1288
|
-
* corresponds to an opening tag and a elementClose tag is required. This is
|
|
1289
|
-
* like elementOpen, but the attributes are defined using the attr function
|
|
1290
|
-
* rather than being passed as arguments. Must be folllowed by 0 or more calls
|
|
1291
|
-
* to attr, then a call to elementOpenEnd.
|
|
1292
|
-
* @param nameOrCtor The Element's tag or constructor.
|
|
1293
|
-
* @param key The key used to identify this element. This can be an
|
|
1294
|
-
* empty string, but performance may be better if a unique value is used
|
|
1295
|
-
* when iterating over an array of items.
|
|
1296
|
-
* @param statics An array of attribute name/value pairs of the static
|
|
1297
|
-
* attributes for the Element. Attributes will only be set once when the
|
|
1298
|
-
* Element is created.
|
|
1299
|
-
*/
|
|
1300
|
-
function elementOpenStart(nameOrCtor, key, statics) {
|
|
1301
|
-
var argsBuilder = getArgsBuilder();
|
|
1302
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1303
|
-
assertNotInAttributes('elementOpenStart');
|
|
1304
|
-
setInAttributes(true);
|
|
1305
|
-
}
|
|
1306
|
-
argsBuilder[0] = nameOrCtor;
|
|
1307
|
-
argsBuilder[1] = key;
|
|
1308
|
-
argsBuilder[2] = statics;
|
|
1309
|
-
}
|
|
1310
|
-
/**
|
|
1311
|
-
* Allows you to define a key after an elementOpenStart. This is useful in
|
|
1312
|
-
* templates that define key after an element has been opened ie
|
|
1313
|
-
* `<div key('foo')></div>`.
|
|
1314
|
-
*/
|
|
1315
|
-
function key(key) {
|
|
1316
|
-
var argsBuilder = getArgsBuilder();
|
|
1317
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1318
|
-
assertInAttributes('key');
|
|
1319
|
-
assert(argsBuilder);
|
|
1320
|
-
}
|
|
1321
|
-
argsBuilder[1] = key;
|
|
1322
|
-
}
|
|
1323
|
-
/***
|
|
1324
|
-
* Defines a virtual attribute at this point of the DOM. This is only valid
|
|
1325
|
-
* when called between elementOpenStart and elementOpenEnd.
|
|
1326
|
-
*/
|
|
1327
|
-
// tslint:disable-next-line:no-any
|
|
1328
|
-
function attr(name, value) {
|
|
1329
|
-
var argsBuilder = getArgsBuilder();
|
|
1330
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1331
|
-
assertInAttributes('attr');
|
|
1332
|
-
}
|
|
1333
|
-
argsBuilder.push(name);
|
|
1334
|
-
argsBuilder.push(value);
|
|
1335
|
-
}
|
|
1336
|
-
/**
|
|
1337
|
-
* Closes an open tag started with elementOpenStart.
|
|
1338
|
-
* @return The corresponding Element.
|
|
1339
|
-
*/
|
|
1340
|
-
function elementOpenEnd() {
|
|
1341
|
-
var argsBuilder = getArgsBuilder();
|
|
1342
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1343
|
-
assertInAttributes('elementOpenEnd');
|
|
1344
|
-
setInAttributes(false);
|
|
1345
|
-
}
|
|
1346
|
-
assert(argsBuilder);
|
|
1347
|
-
var node = elementOpen.apply(null, argsBuilder);
|
|
1348
|
-
truncateArray(argsBuilder, 0);
|
|
1349
|
-
return node;
|
|
1350
|
-
}
|
|
1351
|
-
/**
|
|
1352
|
-
* Closes an open virtual Element.
|
|
1353
|
-
*
|
|
1354
|
-
* @param nameOrCtor The Element's tag or constructor.
|
|
1355
|
-
* @return The corresponding Element.
|
|
1356
|
-
*/
|
|
1357
|
-
function elementClose(nameOrCtor) {
|
|
1358
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1359
|
-
assertNotInAttributes('elementClose');
|
|
1360
|
-
}
|
|
1361
|
-
var node = close();
|
|
1362
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1363
|
-
assertCloseMatchesOpenTag(getData(node).nameOrCtor, nameOrCtor);
|
|
1364
|
-
}
|
|
1365
|
-
return node;
|
|
1366
|
-
}
|
|
1367
|
-
/**
|
|
1368
|
-
* Declares a virtual Element at the current location in the document that has
|
|
1369
|
-
* no children.
|
|
1370
|
-
* @param nameOrCtor The Element's tag or constructor.
|
|
1371
|
-
* @param key The key used to identify this element. This can be an
|
|
1372
|
-
* empty string, but performance may be better if a unique value is used
|
|
1373
|
-
* when iterating over an array of items.
|
|
1374
|
-
* @param statics An array of attribute name/value pairs of the static
|
|
1375
|
-
* attributes for the Element. Attributes will only be set once when the
|
|
1376
|
-
* Element is created.
|
|
1377
|
-
* @param varArgs Attribute name/value pairs of the dynamic attributes
|
|
1378
|
-
* for the Element.
|
|
1379
|
-
* @return The corresponding Element.
|
|
1380
|
-
*/
|
|
1381
|
-
function elementVoid(nameOrCtor, key,
|
|
1382
|
-
// Ideally we could tag statics and varArgs as an array where every odd
|
|
1383
|
-
// element is a string and every even element is any, but this is hard.
|
|
1384
|
-
// tslint:disable-next-line:no-any
|
|
1385
|
-
statics) {
|
|
1386
|
-
var varArgs = [];
|
|
1387
|
-
for (var _i = 3; _i < arguments.length; _i++) {
|
|
1388
|
-
varArgs[_i - 3] = arguments[_i];
|
|
1389
|
-
}
|
|
1390
|
-
elementOpen.apply(null, arguments);
|
|
1391
|
-
return elementClose(nameOrCtor);
|
|
1392
|
-
}
|
|
1393
|
-
/**
|
|
1394
|
-
* Declares a virtual Text at this point in the document.
|
|
1395
|
-
*
|
|
1396
|
-
* @param value The value of the Text.
|
|
1397
|
-
* @param varArgs
|
|
1398
|
-
* Functions to format the value which are called only when the value has
|
|
1399
|
-
* changed.
|
|
1400
|
-
* @return The corresponding text node.
|
|
1401
|
-
*/
|
|
1402
|
-
function text$1(value) {
|
|
1403
|
-
var varArgs = [];
|
|
1404
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1405
|
-
varArgs[_i - 1] = arguments[_i];
|
|
1406
|
-
}
|
|
1407
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1408
|
-
assertNotInAttributes('text');
|
|
1409
|
-
assertNotInSkip('text');
|
|
1410
|
-
}
|
|
1411
|
-
var node = text();
|
|
1412
|
-
var data = getData(node);
|
|
1413
|
-
if (data.text !== value) {
|
|
1414
|
-
data.text = value;
|
|
1415
|
-
var formatted = value;
|
|
1416
|
-
for (var i = 1; i < arguments.length; i += 1) {
|
|
1417
|
-
/*
|
|
1418
|
-
* Call the formatter function directly to prevent leaking arguments.
|
|
1419
|
-
* https://github.com/google/incremental-dom/pull/204#issuecomment-178223574
|
|
1420
|
-
*/
|
|
1421
|
-
var fn = arguments[i];
|
|
1422
|
-
formatted = fn(formatted);
|
|
1423
|
-
}
|
|
1424
|
-
node.data = formatted;
|
|
1425
|
-
}
|
|
1426
|
-
return node;
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
|
-
/**
|
|
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}/**
|
|
1430
167
|
* @license
|
|
1431
168
|
* Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
|
|
1432
169
|
*
|
|
@@ -1441,1737 +178,652 @@ function text$1(value) {
|
|
|
1441
178
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1442
179
|
* See the License for the specific language governing permissions and
|
|
1443
180
|
* limitations under the License.
|
|
1444
|
-
*/
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
}
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
}
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
}
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
}
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
if (options === void 0) { options = {}; }
|
|
2094
|
-
return querySelectorDecorator(selector, options, true);
|
|
2095
|
-
}
|
|
2096
|
-
|
|
2097
|
-
/** A "watched" property will trigger an update whenever it's written to. */
|
|
2098
|
-
function Watch() {
|
|
2099
|
-
return function (target, key) {
|
|
2100
|
-
var _a;
|
|
2101
|
-
var privateKey = Symbol(key);
|
|
2102
|
-
Object.defineProperties(target, (_a = {},
|
|
2103
|
-
_a[privateKey] = {
|
|
2104
|
-
writable: true,
|
|
2105
|
-
enumerable: false,
|
|
2106
|
-
configurable: false,
|
|
2107
|
-
value: target[key],
|
|
2108
|
-
},
|
|
2109
|
-
_a[key] = {
|
|
2110
|
-
get: function () {
|
|
2111
|
-
return this[privateKey];
|
|
2112
|
-
},
|
|
2113
|
-
set: function (newValue) {
|
|
2114
|
-
if (this[privateKey] !== newValue) {
|
|
2115
|
-
this[privateKey] = newValue;
|
|
2116
|
-
this.update();
|
|
2117
|
-
}
|
|
2118
|
-
},
|
|
2119
|
-
},
|
|
2120
|
-
_a));
|
|
2121
|
-
};
|
|
2122
|
-
}
|
|
2123
|
-
|
|
2124
|
-
exports.MIMEType = void 0;
|
|
2125
|
-
(function (MIMEType) {
|
|
2126
|
-
MIMEType["7Z"] = "application/x-7z-compressed";
|
|
2127
|
-
MIMEType["AAC"] = "audio/aac";
|
|
2128
|
-
MIMEType["ABW"] = "application/x-abiword";
|
|
2129
|
-
MIMEType["ARC"] = "application/octet-stream";
|
|
2130
|
-
MIMEType["AVI"] = "video/x-msvideo";
|
|
2131
|
-
MIMEType["AZW"] = "application/vnd.amazon.ebook";
|
|
2132
|
-
MIMEType["BIN"] = "application/octet-stream";
|
|
2133
|
-
MIMEType["BMP"] = "image/bmp";
|
|
2134
|
-
MIMEType["BZ"] = "application/x-bzip";
|
|
2135
|
-
MIMEType["BZ2"] = "application/x-bzip2";
|
|
2136
|
-
MIMEType["CSH"] = "application/x-csh";
|
|
2137
|
-
MIMEType["CSS"] = "text/css";
|
|
2138
|
-
MIMEType["CSV"] = "text/csv,application/vnd.ms-excel";
|
|
2139
|
-
MIMEType["DOC"] = "application/msword";
|
|
2140
|
-
MIMEType["DOCX"] = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
2141
|
-
MIMEType["EOT"] = "application/vnd.ms-fontobject";
|
|
2142
|
-
MIMEType["EPUB"] = "application/epub+zip";
|
|
2143
|
-
MIMEType["ES"] = "application/ecmascript";
|
|
2144
|
-
MIMEType["FLV"] = "video/x-flv";
|
|
2145
|
-
MIMEType["GIF"] = "image/gif";
|
|
2146
|
-
MIMEType["GZ"] = "application/x-gzip";
|
|
2147
|
-
MIMEType["HTM"] = "text/html";
|
|
2148
|
-
MIMEType["HTML"] = "text/html";
|
|
2149
|
-
MIMEType["ICO"] = "image/x-icon";
|
|
2150
|
-
MIMEType["ICS"] = "text/calendar";
|
|
2151
|
-
MIMEType["JAR"] = "application/java-archive";
|
|
2152
|
-
MIMEType["JPEG"] = "image/jpeg";
|
|
2153
|
-
MIMEType["JPG"] = "image/jpeg";
|
|
2154
|
-
MIMEType["JS"] = "application/javascript";
|
|
2155
|
-
MIMEType["JSON"] = "application/json";
|
|
2156
|
-
MIMEType["M3U"] = "audio/x-mpequrl";
|
|
2157
|
-
MIMEType["MID"] = "audio/midi";
|
|
2158
|
-
MIMEType["MIDI"] = "audio/midi";
|
|
2159
|
-
MIMEType["MOV"] = "video/quicktime";
|
|
2160
|
-
MIMEType["MP3"] = "audio/mpeg3";
|
|
2161
|
-
MIMEType["MP4"] = "video/mp4";
|
|
2162
|
-
MIMEType["MPEG"] = "video/mpeg";
|
|
2163
|
-
MIMEType["MPKG"] = "application/vnd.apple.installer+xml";
|
|
2164
|
-
MIMEType["ODP"] = "application/vnd.oasis.opendocument.presentation";
|
|
2165
|
-
MIMEType["ODS"] = "application/vnd.oasis.opendocument.spreadsheet";
|
|
2166
|
-
MIMEType["ODT"] = "application/vnd.oasis.opendocument.text";
|
|
2167
|
-
MIMEType["OGA"] = "audio/ogg";
|
|
2168
|
-
MIMEType["OGV"] = "video/ogg";
|
|
2169
|
-
MIMEType["OGX"] = "application/ogg";
|
|
2170
|
-
MIMEType["OTF"] = "font/otf";
|
|
2171
|
-
MIMEType["PNG"] = "image/png";
|
|
2172
|
-
MIMEType["PDF"] = "application/pdf";
|
|
2173
|
-
MIMEType["PPT"] = "application/vnd.ms-powerpoint";
|
|
2174
|
-
MIMEType["PPTX"] = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
2175
|
-
MIMEType["RAR"] = "application/x-rar-compressed";
|
|
2176
|
-
MIMEType["RTF"] = "application/rtf";
|
|
2177
|
-
MIMEType["SH"] = "application/x-sh";
|
|
2178
|
-
MIMEType["SVG"] = "image/svg+xml";
|
|
2179
|
-
MIMEType["SWF"] = "application/x-shockwave-flash";
|
|
2180
|
-
MIMEType["TAR"] = "application/x-tar";
|
|
2181
|
-
MIMEType["TIF"] = "image/tiff";
|
|
2182
|
-
MIMEType["TIFF"] = "image/tiff";
|
|
2183
|
-
MIMEType["TS"] = "application/typescript";
|
|
2184
|
-
MIMEType["TTF"] = "font/ttf";
|
|
2185
|
-
MIMEType["TXT"] = "text/plain";
|
|
2186
|
-
MIMEType["VSD"] = "application/vnd.visio";
|
|
2187
|
-
MIMEType["WAV"] = "audio/wav";
|
|
2188
|
-
MIMEType["WEBA"] = "audio/webm";
|
|
2189
|
-
MIMEType["WEBM"] = "video/webm";
|
|
2190
|
-
MIMEType["WEBP"] = "image/webp";
|
|
2191
|
-
MIMEType["WOFF"] = "font/woff";
|
|
2192
|
-
MIMEType["WOFF2"] = "font/woff2";
|
|
2193
|
-
MIMEType["XHTML"] = "application/xhtml+xml";
|
|
2194
|
-
MIMEType["XLS"] = "application/vnd.ms-excel";
|
|
2195
|
-
MIMEType["XLSX"] = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
2196
|
-
MIMEType["XML"] = "application/xml";
|
|
2197
|
-
MIMEType["XUL"] = "application/vnd.mozilla.xul+xml";
|
|
2198
|
-
MIMEType["ZIP"] = "application/zip";
|
|
2199
|
-
})(exports.MIMEType || (exports.MIMEType = {}));
|
|
2200
|
-
|
|
2201
|
-
var CPT_NAME$3 = 'sps-file-upload';
|
|
2202
|
-
var SpsFileUploadComponent = /** @class */ (function (_super) {
|
|
2203
|
-
__extends(SpsFileUploadComponent, _super);
|
|
2204
|
-
function SpsFileUploadComponent() {
|
|
2205
|
-
var _this = _super.call(this) || this;
|
|
2206
|
-
/** Controls whether the component is visible. */
|
|
2207
|
-
_this.shown = true;
|
|
2208
|
-
_this.acceptMIMETypes = new Set();
|
|
2209
|
-
_this.active = false;
|
|
2210
|
-
_this.error = false;
|
|
2211
|
-
/** The list of selected files. If the `multiple` prop has not been provided,
|
|
2212
|
-
* it is still an array; it will simply be an array of one when the user selects
|
|
2213
|
-
* a file.
|
|
2214
|
-
*/
|
|
2215
|
-
_this.files = [];
|
|
2216
|
-
_this.namesOfUnsupportedFiles = [];
|
|
2217
|
-
_this.handleBrowseLinkClick = _this.handleBrowseLinkClick.bind(_this);
|
|
2218
|
-
_this.handleDownloadButtonClick = _this.handleDownloadButtonClick.bind(_this);
|
|
2219
|
-
_this.handleFileInputChange = _this.handleFileInputChange.bind(_this);
|
|
2220
|
-
_this.dismiss = _this.dismiss.bind(_this);
|
|
2221
|
-
return _this;
|
|
2222
|
-
}
|
|
2223
|
-
Object.defineProperty(SpsFileUploadComponent.prototype, ClassBindings, {
|
|
2224
|
-
get: function () {
|
|
2225
|
-
return [
|
|
2226
|
-
CPT_NAME$3,
|
|
2227
|
-
this.active && CPT_NAME$3 + "--active",
|
|
2228
|
-
this.error && CPT_NAME$3 + "--error",
|
|
2229
|
-
!this.shown && CPT_NAME$3 + "--hidden",
|
|
2230
|
-
this.mini && CPT_NAME$3 + "--mini",
|
|
2231
|
-
this.constrainContentWidth && CPT_NAME$3 + "--constrained-content-width",
|
|
2232
|
-
];
|
|
2233
|
-
},
|
|
2234
|
-
enumerable: false,
|
|
2235
|
-
configurable: true
|
|
2236
|
-
});
|
|
2237
|
-
SpsFileUploadComponent.prototype.parseAndValidateMaxSize = function (maxSize) {
|
|
2238
|
-
try {
|
|
2239
|
-
this.maxSizeBytes = utils.parseFileSize(maxSize);
|
|
2240
|
-
}
|
|
2241
|
-
catch (error) {
|
|
2242
|
-
throw new Error("Could not parse \"" + maxSize + "\" as a file size.");
|
|
2243
|
-
}
|
|
2244
|
-
};
|
|
2245
|
-
SpsFileUploadComponent.prototype.processAcceptExtensions = function (acceptExtensions) {
|
|
2246
|
-
var e_1, _a, e_2, _b;
|
|
2247
|
-
var splitExtensions = Array.isArray(acceptExtensions)
|
|
2248
|
-
? acceptExtensions
|
|
2249
|
-
: acceptExtensions.trim().split(/\s?,\s?/);
|
|
2250
|
-
var trimmedExtensions = splitExtensions.map(function (ext) { return ext.replace(/^\./, ''); });
|
|
2251
|
-
var extList = trimmedExtensions.map(function (ext) { return ("." + ext).toLowerCase(); });
|
|
2252
|
-
this.acceptExtensionsDescription = extList
|
|
2253
|
-
.map(function (ext, i) { return (i > 0 && i === extList.length - 1 ? "or " + ext : ext); })
|
|
2254
|
-
.join(extList.length > 2 ? ', ' : ' ');
|
|
2255
|
-
this.acceptMIMETypes.clear();
|
|
2256
|
-
try {
|
|
2257
|
-
for (var trimmedExtensions_1 = __values(trimmedExtensions), trimmedExtensions_1_1 = trimmedExtensions_1.next(); !trimmedExtensions_1_1.done; trimmedExtensions_1_1 = trimmedExtensions_1.next()) {
|
|
2258
|
-
var ext = trimmedExtensions_1_1.value;
|
|
2259
|
-
try {
|
|
2260
|
-
for (var _c = (e_2 = void 0, __values(exports.MIMEType[ext.toUpperCase()].split(','))), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
2261
|
-
var type = _d.value;
|
|
2262
|
-
this.acceptMIMETypes.add(type);
|
|
2263
|
-
}
|
|
2264
|
-
}
|
|
2265
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2266
|
-
finally {
|
|
2267
|
-
try {
|
|
2268
|
-
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
2269
|
-
}
|
|
2270
|
-
finally { if (e_2) throw e_2.error; }
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
|
-
}
|
|
2274
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2275
|
-
finally {
|
|
2276
|
-
try {
|
|
2277
|
-
if (trimmedExtensions_1_1 && !trimmedExtensions_1_1.done && (_a = trimmedExtensions_1.return)) _a.call(trimmedExtensions_1);
|
|
2278
|
-
}
|
|
2279
|
-
finally { if (e_1) throw e_1.error; }
|
|
2280
|
-
}
|
|
2281
|
-
this.accept = extList.concat(Array.from(this.acceptMIMETypes)).join(',');
|
|
2282
|
-
};
|
|
2283
|
-
SpsFileUploadComponent.prototype.connectedCallback = function () {
|
|
2284
|
-
this.description = this.description || (this.multiple ? 'Files' : 'File');
|
|
2285
|
-
if (this.acceptExtensions) {
|
|
2286
|
-
this.processAcceptExtensions(this.acceptExtensions);
|
|
2287
|
-
}
|
|
2288
|
-
if (this.maxSize) {
|
|
2289
|
-
this.parseAndValidateMaxSize(this.maxSize);
|
|
2290
|
-
}
|
|
2291
|
-
};
|
|
2292
|
-
SpsFileUploadComponent.prototype.attributeChangedCallback = function (attrName, oldValue, newValue) {
|
|
2293
|
-
if (attrName === 'acceptExtensions') {
|
|
2294
|
-
this.processAcceptExtensions(newValue);
|
|
2295
|
-
}
|
|
2296
|
-
if (attrName === 'maxSize') {
|
|
2297
|
-
this.parseAndValidateMaxSize(newValue);
|
|
2298
|
-
}
|
|
2299
|
-
};
|
|
2300
|
-
SpsFileUploadComponent.prototype.selectFiles = function (files) {
|
|
2301
|
-
var e_3, _a;
|
|
2302
|
-
this.namesOfUnsupportedFiles = [];
|
|
2303
|
-
var fileArray = Array.from(files);
|
|
2304
|
-
try {
|
|
2305
|
-
for (var fileArray_1 = __values(fileArray), fileArray_1_1 = fileArray_1.next(); !fileArray_1_1.done; fileArray_1_1 = fileArray_1.next()) {
|
|
2306
|
-
var file = fileArray_1_1.value;
|
|
2307
|
-
if (this.acceptExtensions && !this.acceptMIMETypes.has(file.type)) {
|
|
2308
|
-
this.namesOfUnsupportedFiles.push(file.name);
|
|
2309
|
-
}
|
|
2310
|
-
if (this.maxSize && file.size > this.maxSizeBytes) {
|
|
2311
|
-
this.namesOfUnsupportedFiles.push(file.name);
|
|
2312
|
-
}
|
|
2313
|
-
}
|
|
2314
|
-
}
|
|
2315
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
2316
|
-
finally {
|
|
2317
|
-
try {
|
|
2318
|
-
if (fileArray_1_1 && !fileArray_1_1.done && (_a = fileArray_1.return)) _a.call(fileArray_1);
|
|
2319
|
-
}
|
|
2320
|
-
finally { if (e_3) throw e_3.error; }
|
|
2321
|
-
}
|
|
2322
|
-
if (this.namesOfUnsupportedFiles.length) {
|
|
2323
|
-
this.error = true;
|
|
2324
|
-
this.fileInput.value = null;
|
|
2325
|
-
this.update();
|
|
2326
|
-
}
|
|
2327
|
-
else {
|
|
2328
|
-
this.files = fileArray;
|
|
2329
|
-
this.selection.dispatch(fileArray);
|
|
2330
|
-
}
|
|
2331
|
-
};
|
|
2332
|
-
/* eslint-disable class-methods-use-this */
|
|
2333
|
-
SpsFileUploadComponent.prototype.handleDragOver = function (event) {
|
|
2334
|
-
event.preventDefault();
|
|
2335
|
-
event.stopPropagation();
|
|
2336
|
-
};
|
|
2337
|
-
/* eslint-enable class-methods-use-this */
|
|
2338
|
-
SpsFileUploadComponent.prototype.handleDragEnter = function (event) {
|
|
2339
|
-
event.preventDefault();
|
|
2340
|
-
this.active = true;
|
|
2341
|
-
this.error = false;
|
|
2342
|
-
this.update();
|
|
2343
|
-
};
|
|
2344
|
-
SpsFileUploadComponent.prototype.handleDragLeave = function (event) {
|
|
2345
|
-
event.preventDefault();
|
|
2346
|
-
this.active = false;
|
|
2347
|
-
this.update();
|
|
2348
|
-
};
|
|
2349
|
-
SpsFileUploadComponent.prototype.handleDrop = function (event) {
|
|
2350
|
-
event.preventDefault();
|
|
2351
|
-
event.stopPropagation();
|
|
2352
|
-
this.active = false;
|
|
2353
|
-
if (event.dataTransfer.items) {
|
|
2354
|
-
this.selectFiles(Array.from(event.dataTransfer.items).map(function (item) { return item.getAsFile(); }));
|
|
2355
|
-
}
|
|
2356
|
-
else {
|
|
2357
|
-
this.selectFiles(event.dataTransfer.files);
|
|
2358
|
-
}
|
|
2359
|
-
this.update();
|
|
2360
|
-
};
|
|
2361
|
-
SpsFileUploadComponent.prototype.handleBrowseLinkClick = function (event) {
|
|
2362
|
-
event.preventDefault();
|
|
2363
|
-
this.error = false;
|
|
2364
|
-
this.update();
|
|
2365
|
-
this.fileInput.click();
|
|
2366
|
-
};
|
|
2367
|
-
SpsFileUploadComponent.prototype.handleDownloadButtonClick = function () {
|
|
2368
|
-
this.download.dispatch();
|
|
2369
|
-
};
|
|
2370
|
-
SpsFileUploadComponent.prototype.handleFileInputChange = function (event) {
|
|
2371
|
-
event.stopPropagation();
|
|
2372
|
-
this.selectFiles(event.target.files);
|
|
2373
|
-
};
|
|
2374
|
-
/** If the `dismissable` prop has been set, this will programmatically
|
|
2375
|
-
* dismiss the component and fire the "dismissal" event.
|
|
2376
|
-
*/
|
|
2377
|
-
SpsFileUploadComponent.prototype.dismiss = function () {
|
|
2378
|
-
if (this.dismissable) {
|
|
2379
|
-
this.shown = false;
|
|
2380
|
-
this.update();
|
|
2381
|
-
this.dismissal.dispatch();
|
|
2382
|
-
}
|
|
2383
|
-
};
|
|
2384
|
-
/** If the `dismissable` prop has been set, this will programmatically show the component. */
|
|
2385
|
-
SpsFileUploadComponent.prototype.show = function () {
|
|
2386
|
-
if (this.dismissable) {
|
|
2387
|
-
this.shown = true;
|
|
2388
|
-
this.update();
|
|
2389
|
-
}
|
|
2390
|
-
};
|
|
2391
|
-
SpsFileUploadComponent.prototype.render = function (_a) {
|
|
2392
|
-
var _this = this;
|
|
2393
|
-
var t = _a.t;
|
|
2394
|
-
var icon = this.error ? dsShared.SpsIcon.EXCLAMATION_CIRCLE : dsShared.SpsIcon.UPLOAD_CLOUD;
|
|
2395
|
-
var instructions = (this.multiple
|
|
2396
|
-
? t('design-system:fileUpload.instructions_plural')
|
|
2397
|
-
: t('design-system:fileUpload.instructions')).split('|');
|
|
2398
|
-
return (h("div", { "data-fragment": true },
|
|
2399
|
-
h("div", { className: CPT_NAME$3 + "__content" }, this.processing
|
|
2400
|
-
? (h("div", { "data-fragment": true },
|
|
2401
|
-
h("i", { className: "sps-spinner sps-spinner--medium", "aria-hidden": "true" }),
|
|
2402
|
-
h("div", { className: CPT_NAME$3 + "__instructions" }, t('design-system:fileUpload.processing'))))
|
|
2403
|
-
: (h("div", { "data-fragment": true },
|
|
2404
|
-
h("i", { className: "sps-icon sps-icon-" + icon + " " + CPT_NAME$3 + "__icon-primary", "aria-hidden": "true" }),
|
|
2405
|
-
h("div", { className: CPT_NAME$3 + "__title" }, this.error
|
|
2406
|
-
? (h("div", { "data-fragment": true }, t(this.namesOfUnsupportedFiles.length > 1
|
|
2407
|
-
? 'design-system:fileUpload.cancelled_plural'
|
|
2408
|
-
: 'design-system:fileUpload.cancelled')))
|
|
2409
|
-
: h("div", { "data-fragment": true }, t('design-system:fileUpload.title', { description: this.description }))),
|
|
2410
|
-
this.error
|
|
2411
|
-
? (h("div", { className: CPT_NAME$3 + "__errored-files" }, new Set(this.namesOfUnsupportedFiles.map(function (name, i) {
|
|
2412
|
-
var breakpoint = Math.floor(name.length / 2);
|
|
2413
|
-
return (h("div", { className: CPT_NAME$3 + "__errored-filename", key: name },
|
|
2414
|
-
h("span", { className: CPT_NAME$3 + "__errored-filename-segment" }, name.substr(0, breakpoint)),
|
|
2415
|
-
h("div", { className: CPT_NAME$3 + "__errored-filename-segment" },
|
|
2416
|
-
h("span", null, name.substr(breakpoint))),
|
|
2417
|
-
i < _this.namesOfUnsupportedFiles.length - 1 ? ',' : ''));
|
|
2418
|
-
}))))
|
|
2419
|
-
: h("span", null),
|
|
2420
|
-
h("div", { className: CPT_NAME$3 + "__instructions" },
|
|
2421
|
-
h("div", { "data-fragment": true },
|
|
2422
|
-
h("span", null, instructions[0]),
|
|
2423
|
-
h("a", { href: "", onClick: this.handleBrowseLinkClick }, instructions[1]),
|
|
2424
|
-
h("span", null, instructions[2]))),
|
|
2425
|
-
h("div", { className: CPT_NAME$3 + "__requirements" },
|
|
2426
|
-
this.acceptExtensions
|
|
2427
|
-
? (h("div", { "data-fragment": true },
|
|
2428
|
-
"(",
|
|
2429
|
-
' ',
|
|
2430
|
-
t('design-system:fileUpload.acceptedTypes', { fileTypes: this.acceptExtensionsDescription }),
|
|
2431
|
-
' ',
|
|
2432
|
-
")"))
|
|
2433
|
-
: '',
|
|
2434
|
-
this.maxSize
|
|
2435
|
-
? (h("div", { "data-fragment": true },
|
|
2436
|
-
"(",
|
|
2437
|
-
t('design-system:fileUpload.maximumSize', { size: this.maxSize }),
|
|
2438
|
-
' ',
|
|
2439
|
-
")"))
|
|
2440
|
-
: ''),
|
|
2441
|
-
this.downloadLabel
|
|
2442
|
-
&& (h("div", { className: "sps-button sps-button--link " + CPT_NAME$3 + "__download-button", onClick: this.handleDownloadButtonClick },
|
|
2443
|
-
h("button", { type: "button" },
|
|
2444
|
-
h("i", { className: "sps-icon sps-icon-download-cloud", "aria-hidden": "true" }),
|
|
2445
|
-
' ',
|
|
2446
|
-
this.downloadLabel)))))),
|
|
2447
|
-
this.dismissable && !this.processing
|
|
2448
|
-
&& (h("div", { className: "sps-button sps-button--icon " + CPT_NAME$3 + "__close-button", onClick: this.dismiss },
|
|
2449
|
-
h("button", { type: "button", title: t('design-system:fileUpload.close') },
|
|
2450
|
-
h("i", { className: "sps-icon sps-icon-x", "aria-hidden": "true" })))),
|
|
2451
|
-
h("form", null,
|
|
2452
|
-
h("input", { type: "file", accept: this.accept || '*/*', multiple: this.multiple || null, onChange: this.handleFileInputChange }))));
|
|
2453
|
-
};
|
|
2454
|
-
SpsFileUploadComponent.displayName = CPT_NAME$3;
|
|
2455
|
-
SpsFileUploadComponent.props = {
|
|
2456
|
-
description: 'string',
|
|
2457
|
-
multiple: 'boolean',
|
|
2458
|
-
dismissable: 'boolean',
|
|
2459
|
-
processing: 'boolean',
|
|
2460
|
-
mini: 'boolean',
|
|
2461
|
-
downloadLabel: 'string',
|
|
2462
|
-
acceptExtensions: 'Array<string> | string',
|
|
2463
|
-
maxSize: 'string',
|
|
2464
|
-
selection: { event: true, type: 'CustomEvent<Array<File>>' },
|
|
2465
|
-
dismissal: { event: true, type: 'CustomEvent<void>' },
|
|
2466
|
-
download: { event: true, type: 'CustomEvent<void>' },
|
|
2467
|
-
};
|
|
2468
|
-
__decorate([
|
|
2469
|
-
Prop(),
|
|
2470
|
-
__metadata("design:type", Object)
|
|
2471
|
-
], SpsFileUploadComponent.prototype, "description", void 0);
|
|
2472
|
-
__decorate([
|
|
2473
|
-
Prop(Boolean),
|
|
2474
|
-
__metadata("design:type", Boolean)
|
|
2475
|
-
], SpsFileUploadComponent.prototype, "multiple", void 0);
|
|
2476
|
-
__decorate([
|
|
2477
|
-
Prop(Boolean),
|
|
2478
|
-
__metadata("design:type", Object)
|
|
2479
|
-
], SpsFileUploadComponent.prototype, "shown", void 0);
|
|
2480
|
-
__decorate([
|
|
2481
|
-
Prop(Boolean),
|
|
2482
|
-
__metadata("design:type", Boolean)
|
|
2483
|
-
], SpsFileUploadComponent.prototype, "dismissable", void 0);
|
|
2484
|
-
__decorate([
|
|
2485
|
-
Prop(Boolean),
|
|
2486
|
-
__metadata("design:type", Boolean)
|
|
2487
|
-
], SpsFileUploadComponent.prototype, "processing", void 0);
|
|
2488
|
-
__decorate([
|
|
2489
|
-
Prop(Boolean),
|
|
2490
|
-
__metadata("design:type", Boolean)
|
|
2491
|
-
], SpsFileUploadComponent.prototype, "mini", void 0);
|
|
2492
|
-
__decorate([
|
|
2493
|
-
Prop(Boolean),
|
|
2494
|
-
__metadata("design:type", Boolean)
|
|
2495
|
-
], SpsFileUploadComponent.prototype, "constrainContentWidth", void 0);
|
|
2496
|
-
__decorate([
|
|
2497
|
-
Prop(),
|
|
2498
|
-
__metadata("design:type", String)
|
|
2499
|
-
], SpsFileUploadComponent.prototype, "downloadLabel", void 0);
|
|
2500
|
-
__decorate([
|
|
2501
|
-
Prop(),
|
|
2502
|
-
__metadata("design:type", Object)
|
|
2503
|
-
], SpsFileUploadComponent.prototype, "acceptExtensions", void 0);
|
|
2504
|
-
__decorate([
|
|
2505
|
-
Prop(),
|
|
2506
|
-
__metadata("design:type", String)
|
|
2507
|
-
], SpsFileUploadComponent.prototype, "maxSize", void 0);
|
|
2508
|
-
__decorate([
|
|
2509
|
-
EventDispatcher(),
|
|
2510
|
-
__metadata("design:type", Object)
|
|
2511
|
-
], SpsFileUploadComponent.prototype, "selection", void 0);
|
|
2512
|
-
__decorate([
|
|
2513
|
-
EventDispatcher(),
|
|
2514
|
-
__metadata("design:type", Object)
|
|
2515
|
-
], SpsFileUploadComponent.prototype, "dismissal", void 0);
|
|
2516
|
-
__decorate([
|
|
2517
|
-
EventDispatcher(),
|
|
2518
|
-
__metadata("design:type", Object)
|
|
2519
|
-
], SpsFileUploadComponent.prototype, "download", void 0);
|
|
2520
|
-
__decorate([
|
|
2521
|
-
QuerySelector("input[type='file']"),
|
|
2522
|
-
__metadata("design:type", HTMLInputElement)
|
|
2523
|
-
], SpsFileUploadComponent.prototype, "fileInput", void 0);
|
|
2524
|
-
__decorate([
|
|
2525
|
-
EventListener('dragover'),
|
|
2526
|
-
__metadata("design:type", Function),
|
|
2527
|
-
__metadata("design:paramtypes", [Event]),
|
|
2528
|
-
__metadata("design:returntype", void 0)
|
|
2529
|
-
], SpsFileUploadComponent.prototype, "handleDragOver", null);
|
|
2530
|
-
__decorate([
|
|
2531
|
-
EventListener('dragenter'),
|
|
2532
|
-
__metadata("design:type", Function),
|
|
2533
|
-
__metadata("design:paramtypes", [Event]),
|
|
2534
|
-
__metadata("design:returntype", void 0)
|
|
2535
|
-
], SpsFileUploadComponent.prototype, "handleDragEnter", null);
|
|
2536
|
-
__decorate([
|
|
2537
|
-
EventListener('dragleave'),
|
|
2538
|
-
__metadata("design:type", Function),
|
|
2539
|
-
__metadata("design:paramtypes", [Event]),
|
|
2540
|
-
__metadata("design:returntype", void 0)
|
|
2541
|
-
], SpsFileUploadComponent.prototype, "handleDragLeave", null);
|
|
2542
|
-
__decorate([
|
|
2543
|
-
EventListener('drop'),
|
|
2544
|
-
__metadata("design:type", Function),
|
|
2545
|
-
__metadata("design:paramtypes", [Object]),
|
|
2546
|
-
__metadata("design:returntype", void 0)
|
|
2547
|
-
], SpsFileUploadComponent.prototype, "handleDrop", null);
|
|
2548
|
-
SpsFileUploadComponent = __decorate([
|
|
2549
|
-
Component({ tag: CPT_NAME$3 }),
|
|
2550
|
-
__metadata("design:paramtypes", [])
|
|
2551
|
-
], SpsFileUploadComponent);
|
|
2552
|
-
return SpsFileUploadComponent;
|
|
2553
|
-
}(HTMLElement));
|
|
2554
|
-
|
|
2555
|
-
var SpsFileUploadExamples = {
|
|
2556
|
-
basic: {
|
|
2557
|
-
label: 'Basic File Upload',
|
|
2558
|
-
description: utils.code(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n <p>Simply allow the user to drag-and-drop or select either a single file or multiple files at once.</p>\n "], ["\n <p>Simply allow the user to drag-and-drop or select either a single file or multiple files at once.</p>\n "]))),
|
|
2559
|
-
examples: {
|
|
2560
|
-
single: {
|
|
2561
|
-
description: '<p>Single file upload</p>',
|
|
2562
|
-
react: utils.code(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n function Component() {\n const ref = React.useRef()\n\n function handleChange(event) {\n console.log(event.detail)\n }\n\n React.useEffect(() => {\n ref.current.addEventListener(\"selection\", handleChange)\n return () => {\n ref.current.removeEventListener(\"selection\", handleChange)\n }\n })\n\n return (\n <div className=\"sps-row\">\n <div className=\"col-12\">\n <sps-file-upload ref={ref}/>\n </div>\n </div>\n )\n }\n "], ["\n function Component() {\n const ref = React.useRef()\n\n function handleChange(event) {\n console.log(event.detail)\n }\n\n React.useEffect(() => {\n ref.current.addEventListener(\"selection\", handleChange)\n return () => {\n ref.current.removeEventListener(\"selection\", handleChange)\n }\n })\n\n return (\n <div className=\"sps-row\">\n <div className=\"col-12\">\n <sps-file-upload ref={ref}/>\n </div>\n </div>\n )\n }\n "]))),
|
|
2563
|
-
},
|
|
2564
|
-
multiple: {
|
|
2565
|
-
description: '<p>Multiple file upload</p>',
|
|
2566
|
-
react: utils.code(templateObject_3$2 || (templateObject_3$2 = __makeTemplateObject(["\n function Component() {\n const ref = React.useRef()\n\n function handleChange(event) {\n console.log(event.detail)\n }\n\n React.useEffect(() => {\n ref.current.addEventListener(\"selection\", handleChange)\n return () => {\n ref.current.removeEventListener(\"selection\", handleChange)\n }\n })\n\n return (\n <div className=\"sps-row\">\n <div className=\"col-12\">\n <sps-file-upload ref={ref} multiple/>\n </div>\n </div>\n )\n }\n "], ["\n function Component() {\n const ref = React.useRef()\n\n function handleChange(event) {\n console.log(event.detail)\n }\n\n React.useEffect(() => {\n ref.current.addEventListener(\"selection\", handleChange)\n return () => {\n ref.current.removeEventListener(\"selection\", handleChange)\n }\n })\n\n return (\n <div className=\"sps-row\">\n <div className=\"col-12\">\n <sps-file-upload ref={ref} multiple/>\n </div>\n </div>\n )\n }\n "]))),
|
|
2567
|
-
},
|
|
2568
|
-
},
|
|
2569
|
-
},
|
|
2570
|
-
restrictions: {
|
|
2571
|
-
label: 'Restrictions',
|
|
2572
|
-
description: utils.code(templateObject_4$2 || (templateObject_4$2 = __makeTemplateObject(["\n <p>You can place restrictions on what files will be accepted with an extension whitelist and/or a maximum size.</p>\n "], ["\n <p>You can place restrictions on what files will be accepted with an extension whitelist and/or a maximum size.</p>\n "]))),
|
|
2573
|
-
examples: {
|
|
2574
|
-
size: {
|
|
2575
|
-
description: '<p>Maximum size</p>',
|
|
2576
|
-
react: utils.code(templateObject_5$2 || (templateObject_5$2 = __makeTemplateObject(["\n function Component() {\n const ref = React.useRef()\n\n function handleChange(event) {\n console.log(event.detail)\n }\n\n React.useEffect(() => {\n ref.current.addEventListener(\"selection\", handleChange)\n return () => {\n ref.current.removeEventListener(\"selection\", handleChange)\n }\n })\n\n return (\n <div className=\"sps-row\">\n <div className=\"col-12\">\n <sps-file-upload ref={ref} maxSize=\"100KB\"/>\n </div>\n </div>\n )\n }\n "], ["\n function Component() {\n const ref = React.useRef()\n\n function handleChange(event) {\n console.log(event.detail)\n }\n\n React.useEffect(() => {\n ref.current.addEventListener(\"selection\", handleChange)\n return () => {\n ref.current.removeEventListener(\"selection\", handleChange)\n }\n })\n\n return (\n <div className=\"sps-row\">\n <div className=\"col-12\">\n <sps-file-upload ref={ref} maxSize=\"100KB\"/>\n </div>\n </div>\n )\n }\n "]))),
|
|
2577
|
-
},
|
|
2578
|
-
type: {
|
|
2579
|
-
description: '<p>File type whitelist</p>',
|
|
2580
|
-
react: utils.code(templateObject_6$2 || (templateObject_6$2 = __makeTemplateObject(["\n function Component() {\n const ref = React.useRef()\n\n function handleChange(event) {\n console.log(event.detail)\n }\n\n React.useEffect(() => {\n ref.current.addEventListener(\"selection\", handleChange)\n return () => {\n ref.current.removeEventListener(\"selection\", handleChange)\n }\n })\n\n return (\n <div className=\"sps-row\">\n <div className=\"col-12\">\n <sps-file-upload\n ref={ref}\n description=\"Spreadsheets\"\n multiple\n acceptExtensions=\"XLS, xlsx, .csv\"\n />\n </div>\n </div>\n )\n }\n "], ["\n function Component() {\n const ref = React.useRef()\n\n function handleChange(event) {\n console.log(event.detail)\n }\n\n React.useEffect(() => {\n ref.current.addEventListener(\"selection\", handleChange)\n return () => {\n ref.current.removeEventListener(\"selection\", handleChange)\n }\n })\n\n return (\n <div className=\"sps-row\">\n <div className=\"col-12\">\n <sps-file-upload\n ref={ref}\n description=\"Spreadsheets\"\n multiple\n acceptExtensions=\"XLS, xlsx, .csv\"\n />\n </div>\n </div>\n )\n }\n "]))),
|
|
2581
|
-
},
|
|
2582
|
-
both: {
|
|
2583
|
-
description: '<p>Both restrictions</p>',
|
|
2584
|
-
react: utils.code(templateObject_7$2 || (templateObject_7$2 = __makeTemplateObject(["\n function Component() {\n const ref = React.useRef()\n\n function handleChange(event) {\n console.log(event.detail)\n }\n\n React.useEffect(() => {\n ref.current.addEventListener(\"selection\", handleChange)\n return () => {\n ref.current.removeEventListener(\"selection\", handleChange)\n }\n })\n\n return (\n <div className=\"sps-row\">\n <div className=\"col-12\">\n <sps-file-upload\n ref={ref}\n description=\"Spreadsheets\"\n multiple\n acceptExtensions=\"XLS, xlsx, .csv\"\n maxSize=\"25MB\"\n />\n </div>\n </div>\n )\n }\n "], ["\n function Component() {\n const ref = React.useRef()\n\n function handleChange(event) {\n console.log(event.detail)\n }\n\n React.useEffect(() => {\n ref.current.addEventListener(\"selection\", handleChange)\n return () => {\n ref.current.removeEventListener(\"selection\", handleChange)\n }\n })\n\n return (\n <div className=\"sps-row\">\n <div className=\"col-12\">\n <sps-file-upload\n ref={ref}\n description=\"Spreadsheets\"\n multiple\n acceptExtensions=\"XLS, xlsx, .csv\"\n maxSize=\"25MB\"\n />\n </div>\n </div>\n )\n }\n "]))),
|
|
2585
|
-
},
|
|
2586
|
-
},
|
|
2587
|
-
},
|
|
2588
|
-
dismissable: {
|
|
2589
|
-
label: 'Dismissable',
|
|
2590
|
-
description: utils.code(templateObject_8$1 || (templateObject_8$1 = __makeTemplateObject(["\n <p>With this option, the file upload component can be dismissed by the user. If the user does dismiss it, you can\n show it again programmatically if you need to.</p>\n "], ["\n <p>With this option, the file upload component can be dismissed by the user. If the user does dismiss it, you can\n show it again programmatically if you need to.</p>\n "]))),
|
|
2591
|
-
examples: {
|
|
2592
|
-
dismissable: {
|
|
2593
|
-
react: utils.code(templateObject_9$1 || (templateObject_9$1 = __makeTemplateObject(["\n function Component() {\n const [showFileUpload, setShowFileUpload] = React.useState(true)\n const ref = React.useRef()\n\n function handleDismissal() {\n setShowFileUpload(false)\n }\n\n React.useEffect(() => {\n ref.current.addEventListener(\"dismissal\", handleDismissal)\n return () => {\n ref.current.removeEventListener(\"dismissal\", handleDismissal)\n }\n })\n\n return (\n <div className=\"sps-row\">\n <div className=\"col-12\">\n <sps-file-upload\n ref={ref}\n dismissable\n shown={showFileUpload}\n />\n {!showFileUpload && (\n <SpsButton onClick={() => setShowFileUpload(true)}>\n Reset\n </SpsButton>\n )}\n </div>\n </div>\n )\n }\n "], ["\n function Component() {\n const [showFileUpload, setShowFileUpload] = React.useState(true)\n const ref = React.useRef()\n\n function handleDismissal() {\n setShowFileUpload(false)\n }\n\n React.useEffect(() => {\n ref.current.addEventListener(\"dismissal\", handleDismissal)\n return () => {\n ref.current.removeEventListener(\"dismissal\", handleDismissal)\n }\n })\n\n return (\n <div className=\"sps-row\">\n <div className=\"col-12\">\n <sps-file-upload\n ref={ref}\n dismissable\n shown={showFileUpload}\n />\n {!showFileUpload && (\n <SpsButton onClick={() => setShowFileUpload(true)}>\n Reset\n </SpsButton>\n )}\n </div>\n </div>\n )\n }\n "]))),
|
|
2594
|
-
},
|
|
2595
|
-
},
|
|
2596
|
-
},
|
|
2597
|
-
downloadButton: {
|
|
2598
|
-
label: 'Download Button',
|
|
2599
|
-
description: utils.code(templateObject_10$1 || (templateObject_10$1 = __makeTemplateObject(["\n <p>You can optionally provide a button to download a file. Typically this will be a template for\n whatever the user is expected to upload. They can then fill out the template, save it, and upload it.</p>\n "], ["\n <p>You can optionally provide a button to download a file. Typically this will be a template for\n whatever the user is expected to upload. They can then fill out the template, save it, and upload it.</p>\n "]))),
|
|
2600
|
-
examples: {
|
|
2601
|
-
downloadButton: {
|
|
2602
|
-
react: utils.code(templateObject_11$1 || (templateObject_11$1 = __makeTemplateObject(["\n function Component() {\n const ref = React.useRef()\n\n function handleDownload() {\n console.log(\"Download triggered.\")\n }\n\n React.useEffect(() => {\n ref.current.addEventListener(\"download\", handleDownload)\n return () => {\n ref.current.removeEventListener(\"download\", handleDownload)\n }\n })\n\n return (\n <div className=\"sps-row\">\n <div className=\"col-12\">\n <sps-file-upload\n ref={ref}\n description=\"Spreadsheet\"\n acceptExtensions=\"xlsx\"\n downloadLabel=\"Download Excel Template\"\n />\n </div>\n </div>\n )\n }\n "], ["\n function Component() {\n const ref = React.useRef()\n\n function handleDownload() {\n console.log(\"Download triggered.\")\n }\n\n React.useEffect(() => {\n ref.current.addEventListener(\"download\", handleDownload)\n return () => {\n ref.current.removeEventListener(\"download\", handleDownload)\n }\n })\n\n return (\n <div className=\"sps-row\">\n <div className=\"col-12\">\n <sps-file-upload\n ref={ref}\n description=\"Spreadsheet\"\n acceptExtensions=\"xlsx\"\n downloadLabel=\"Download Excel Template\"\n />\n </div>\n </div>\n )\n }\n "]))),
|
|
2603
|
-
},
|
|
2604
|
-
},
|
|
2605
|
-
},
|
|
2606
|
-
mini: {
|
|
2607
|
-
label: 'Mini File Upload',
|
|
2608
|
-
description: utils.code(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n <p>When the file upload component is to be placed in a small container,\n it should be marked as a mini file upload so that everything fits.</p>\n "], ["\n <p>When the file upload component is to be placed in a small container,\n it should be marked as a mini file upload so that everything fits.</p>\n "]))),
|
|
2609
|
-
examples: {
|
|
2610
|
-
single: {
|
|
2611
|
-
react: utils.code(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n function Component() {\n const ref = React.useRef()\n\n function handleChange(event) {\n console.log(event.detail)\n }\n\n React.useEffect(() => {\n ref.current.addEventListener(\"selection\", handleChange)\n return () => {\n ref.current.removeEventListener(\"selection\", handleChange)\n }\n })\n\n return (\n <div className=\"sps-row\">\n <div className=\"col-4\">\n <sps-file-upload ref={ref} mini/>\n </div>\n </div>\n )\n }\n "], ["\n function Component() {\n const ref = React.useRef()\n\n function handleChange(event) {\n console.log(event.detail)\n }\n\n React.useEffect(() => {\n ref.current.addEventListener(\"selection\", handleChange)\n return () => {\n ref.current.removeEventListener(\"selection\", handleChange)\n }\n })\n\n return (\n <div className=\"sps-row\">\n <div className=\"col-4\">\n <sps-file-upload ref={ref} mini/>\n </div>\n </div>\n )\n }\n "]))),
|
|
2612
|
-
},
|
|
2613
|
-
},
|
|
2614
|
-
},
|
|
2615
|
-
constrainContentWidth: {
|
|
2616
|
-
label: 'Constrain Content Width',
|
|
2617
|
-
description: utils.code(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n <p>If this prop is provided, the content will be restricted to 50% of\n the overall width of the component. Consult your product designer if\n you're not sure whether to use this variant.</p>\n "], ["\n <p>If this prop is provided, the content will be restricted to 50% of\n the overall width of the component. Consult your product designer if\n you're not sure whether to use this variant.</p>\n "]))),
|
|
2618
|
-
examples: {
|
|
2619
|
-
constrainContentWidth: {
|
|
2620
|
-
react: utils.code(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n function Component() {\n const ref = React.useRef()\n\n function handleChange(event: CustomEvent<Array<File>>) {\n console.log(event.detail)\n }\n\n React.useEffect(() => {\n ref.current.addEventListener(\"selection\", handleChange)\n return () => {\n ref.current.removeEventListener(\"selection\", handleChange)\n }\n })\n\n return (\n <div className=\"sps-row\">\n <div className=\"col-4\">\n <sps-file-upload ref={ref} constrainContentWidth/>\n </div>\n </div>\n )\n }\n "], ["\n function Component() {\n const ref = React.useRef()\n\n function handleChange(event: CustomEvent<Array<File>>) {\n console.log(event.detail)\n }\n\n React.useEffect(() => {\n ref.current.addEventListener(\"selection\", handleChange)\n return () => {\n ref.current.removeEventListener(\"selection\", handleChange)\n }\n })\n\n return (\n <div className=\"sps-row\">\n <div className=\"col-4\">\n <sps-file-upload ref={ref} constrainContentWidth/>\n </div>\n </div>\n )\n }\n "]))),
|
|
2621
|
-
},
|
|
2622
|
-
},
|
|
2623
|
-
},
|
|
2624
|
-
};
|
|
2625
|
-
var templateObject_1$3, templateObject_2$3, templateObject_3$2, templateObject_4$2, templateObject_5$2, templateObject_6$2, templateObject_7$2, templateObject_8$1, templateObject_9$1, templateObject_10$1, templateObject_11$1, templateObject_12, templateObject_13, templateObject_14, templateObject_15;
|
|
2626
|
-
|
|
2627
|
-
var CPT_NAME$2 = 'sps-insights';
|
|
2628
|
-
/** Container for Insight Cards. */
|
|
2629
|
-
var SpsInsightsComponent = /** @class */ (function (_super) {
|
|
2630
|
-
__extends(SpsInsightsComponent, _super);
|
|
2631
|
-
function SpsInsightsComponent() {
|
|
2632
|
-
var _this = _super.call(this) || this;
|
|
2633
|
-
_this.content = [];
|
|
2634
|
-
_this.showAdditionalInsights = false;
|
|
2635
|
-
_this.toggleAdditionalInsights = _this.toggleAdditionalInsights.bind(_this);
|
|
2636
|
-
return _this;
|
|
2637
|
-
}
|
|
2638
|
-
Object.defineProperty(SpsInsightsComponent.prototype, ClassBindings, {
|
|
2639
|
-
get: function () {
|
|
2640
|
-
return [
|
|
2641
|
-
CPT_NAME$2,
|
|
2642
|
-
this.showAdditionalInsights && CPT_NAME$2 + "--show-additional",
|
|
2643
|
-
this.details && Array.from(this.details).every(function (d) { return !d.textContent; })
|
|
2644
|
-
? CPT_NAME$2 + "--no-details"
|
|
2645
|
-
: null,
|
|
2646
|
-
this.content.length === 6 ? CPT_NAME$2 + "--break-4" : null,
|
|
2647
|
-
this.content.length === 7 ? CPT_NAME$2 + "--break-5" : null,
|
|
2648
|
-
this.content.length === 8 ? CPT_NAME$2 + "--break-5" : null,
|
|
2649
|
-
];
|
|
2650
|
-
},
|
|
2651
|
-
enumerable: false,
|
|
2652
|
-
configurable: true
|
|
2653
|
-
});
|
|
2654
|
-
/** Only the first ten Insight Cards are visible by default; the rest are behind
|
|
2655
|
-
* the "Show Additional Insights"/"Hide Additional Insights" button. This method
|
|
2656
|
-
* will toggle the additional insights.
|
|
2657
|
-
*/
|
|
2658
|
-
SpsInsightsComponent.prototype.toggleAdditionalInsights = function () {
|
|
2659
|
-
this.showAdditionalInsights = !this.showAdditionalInsights;
|
|
2660
|
-
this.update();
|
|
2661
|
-
};
|
|
2662
|
-
SpsInsightsComponent.prototype.render = function () {
|
|
2663
|
-
return (h("div", { "data-fragment": true },
|
|
2664
|
-
this.content,
|
|
2665
|
-
this.content.length > 10
|
|
2666
|
-
&& (h("div", { className: "sps-button sps-button--link", onClick: this.toggleAdditionalInsights },
|
|
2667
|
-
h("button", { type: "button" },
|
|
2668
|
-
this.showAdditionalInsights ? 'Hide ' : 'Show ',
|
|
2669
|
-
"Additional Insights")))));
|
|
2670
|
-
};
|
|
2671
|
-
SpsInsightsComponent.displayName = CPT_NAME$2;
|
|
2672
|
-
SpsInsightsComponent.props = {};
|
|
2673
|
-
__decorate([
|
|
2674
|
-
Content(),
|
|
2675
|
-
__metadata("design:type", Object)
|
|
2676
|
-
], SpsInsightsComponent.prototype, "content", void 0);
|
|
2677
|
-
__decorate([
|
|
2678
|
-
QuerySelectorAll('.sps-insight-card__detail'),
|
|
2679
|
-
__metadata("design:type", NodeList)
|
|
2680
|
-
], SpsInsightsComponent.prototype, "details", void 0);
|
|
2681
|
-
SpsInsightsComponent = __decorate([
|
|
2682
|
-
Component({ tag: CPT_NAME$2 }),
|
|
2683
|
-
__metadata("design:paramtypes", [])
|
|
2684
|
-
], SpsInsightsComponent);
|
|
2685
|
-
return SpsInsightsComponent;
|
|
2686
|
-
}(HTMLElement));
|
|
2687
|
-
|
|
2688
|
-
var CPT_NAME$1 = 'sps-insight-card';
|
|
2689
|
-
var SpsInsightCardComponent = /** @class */ (function (_super) {
|
|
2690
|
-
__extends(SpsInsightCardComponent, _super);
|
|
2691
|
-
function SpsInsightCardComponent() {
|
|
2692
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
2693
|
-
/** Specifies which of the visual styling variants of the Insight Card to use. */
|
|
2694
|
-
_this.kind = dsShared.SpsInsightCardKind.GENERAL;
|
|
2695
|
-
return _this;
|
|
2696
|
-
}
|
|
2697
|
-
Object.defineProperty(SpsInsightCardComponent.prototype, ClassBindings, {
|
|
2698
|
-
get: function () {
|
|
2699
|
-
return [
|
|
2700
|
-
CPT_NAME$1,
|
|
2701
|
-
CPT_NAME$1 + "--" + this.kind,
|
|
2702
|
-
this.detail && this.detail.children.length ? CPT_NAME$1 + "--has-detail" : null,
|
|
2703
|
-
];
|
|
2704
|
-
},
|
|
2705
|
-
enumerable: false,
|
|
2706
|
-
configurable: true
|
|
2707
|
-
});
|
|
2708
|
-
SpsInsightCardComponent.prototype.render = function (_a) {
|
|
2709
|
-
var t = _a.t;
|
|
2710
|
-
var metric = h("div", { className: CPT_NAME$1 + "__metric-count" }, this.metric);
|
|
2711
|
-
var description = (h("div", { className: CPT_NAME$1 + "__description" },
|
|
2712
|
-
h("div", { className: CPT_NAME$1 + "__title",
|
|
2713
|
-
// Both Chrome & FF ignore -webkit-box-orient in the actual CSS for some reason
|
|
2714
|
-
// Also the TS types don't think -webkit-box-orient is a real CSS property
|
|
2715
|
-
style: { '-webkit-box-orient': 'vertical' } }, this.title),
|
|
2716
|
-
h("div", { className: CPT_NAME$1 + "__detail" }, this.content)));
|
|
2717
|
-
var _b = __read((this.partnerCount
|
|
2718
|
-
? t('design-system:insightCard.partnerCount', { count: this.partnerCount, total: this.totalPartners })
|
|
2719
|
-
: '').split('|'), 3), count = _b[0], ofText = _b[1], total = _b[2];
|
|
2720
|
-
return (h("div", { "data-fragment": true },
|
|
2721
|
-
h("div", { className: CPT_NAME$1 + "__body" },
|
|
2722
|
-
this.icon ? h("i", { className: "sps-icon sps-icon-" + this.icon }) : h("i", { className: "sps-icon sps-icon-" + dsShared.SpsInsightCardIcons[this.kind] }),
|
|
2723
|
-
metric,
|
|
2724
|
-
description),
|
|
2725
|
-
this.partnerCount && (h("div", { className: CPT_NAME$1 + "__partner-count" },
|
|
2726
|
-
this.partnerCount === this.totalPartners
|
|
2727
|
-
? h("div", null, t('design-system:insightCard.all'))
|
|
2728
|
-
: (h("div", { "data-fragment": true },
|
|
2729
|
-
h("div", null, count),
|
|
2730
|
-
h("div", null, ofText),
|
|
2731
|
-
h("div", null, total))),
|
|
2732
|
-
h("div", { className: CPT_NAME$1 + "__partners-text" }, t('design-system:insightCard.partners'))))));
|
|
2733
|
-
};
|
|
2734
|
-
SpsInsightCardComponent.displayName = CPT_NAME$1;
|
|
2735
|
-
SpsInsightCardComponent.props = {
|
|
2736
|
-
icon: 'SpsIcon',
|
|
2737
|
-
kind: 'SpsInsightCardKind',
|
|
2738
|
-
title: 'string',
|
|
2739
|
-
metric: 'number',
|
|
2740
|
-
partnerCount: 'number',
|
|
2741
|
-
totalPartners: 'number',
|
|
2742
|
-
secondary: 'boolean',
|
|
2743
|
-
};
|
|
2744
|
-
__decorate([
|
|
2745
|
-
Prop(),
|
|
2746
|
-
__metadata("design:type", String)
|
|
2747
|
-
], SpsInsightCardComponent.prototype, "icon", void 0);
|
|
2748
|
-
__decorate([
|
|
2749
|
-
Prop(),
|
|
2750
|
-
__metadata("design:type", Object)
|
|
2751
|
-
], SpsInsightCardComponent.prototype, "kind", void 0);
|
|
2752
|
-
__decorate([
|
|
2753
|
-
Prop(),
|
|
2754
|
-
__metadata("design:type", String)
|
|
2755
|
-
], SpsInsightCardComponent.prototype, "title", void 0);
|
|
2756
|
-
__decorate([
|
|
2757
|
-
Prop(),
|
|
2758
|
-
__metadata("design:type", Number)
|
|
2759
|
-
], SpsInsightCardComponent.prototype, "metric", void 0);
|
|
2760
|
-
__decorate([
|
|
2761
|
-
Prop(),
|
|
2762
|
-
__metadata("design:type", Number)
|
|
2763
|
-
], SpsInsightCardComponent.prototype, "partnerCount", void 0);
|
|
2764
|
-
__decorate([
|
|
2765
|
-
Prop(),
|
|
2766
|
-
__metadata("design:type", Number)
|
|
2767
|
-
], SpsInsightCardComponent.prototype, "totalPartners", void 0);
|
|
2768
|
-
__decorate([
|
|
2769
|
-
Prop(),
|
|
2770
|
-
__metadata("design:type", Boolean)
|
|
2771
|
-
], SpsInsightCardComponent.prototype, "secondary", void 0);
|
|
2772
|
-
__decorate([
|
|
2773
|
-
Content(),
|
|
2774
|
-
__metadata("design:type", Object)
|
|
2775
|
-
], SpsInsightCardComponent.prototype, "content", void 0);
|
|
2776
|
-
__decorate([
|
|
2777
|
-
QuerySelector("." + CPT_NAME$1 + "__detail"),
|
|
2778
|
-
__metadata("design:type", Object)
|
|
2779
|
-
], SpsInsightCardComponent.prototype, "detail", void 0);
|
|
2780
|
-
SpsInsightCardComponent = __decorate([
|
|
2781
|
-
Component({ tag: CPT_NAME$1 })
|
|
2782
|
-
], SpsInsightCardComponent);
|
|
2783
|
-
return SpsInsightCardComponent;
|
|
2784
|
-
}(HTMLElement));
|
|
2785
|
-
|
|
2786
|
-
var SpsInsightCardExamples = {
|
|
2787
|
-
basic: {
|
|
2788
|
-
label: 'Basic Insight Cards',
|
|
2789
|
-
examples: {
|
|
2790
|
-
basic: {
|
|
2791
|
-
jsx: utils.code(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n <sps-insights>\n <sps-insight-card kind=\"general\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card kind=\"processing\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card kind=\"success\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card kind=\"warning\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card kind=\"error\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n ></sps-insight-card>\n </sps-insights>\n "], ["\n <sps-insights>\n <sps-insight-card kind=\"general\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card kind=\"processing\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card kind=\"success\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card kind=\"warning\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card kind=\"error\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n ></sps-insight-card>\n </sps-insights>\n "]))),
|
|
2792
|
-
},
|
|
2793
|
-
},
|
|
2794
|
-
},
|
|
2795
|
-
details: {
|
|
2796
|
-
label: 'With Details',
|
|
2797
|
-
examples: {
|
|
2798
|
-
details: {
|
|
2799
|
-
jsx: utils.code(templateObject_2$2 || (templateObject_2$2 = __makeTemplateObject(["\n <sps-insights>\n <sps-insight-card kind=\"general\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"processing\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"success\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"warning\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"error\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"success\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"error\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n </sps-insights>\n "], ["\n <sps-insights>\n <sps-insight-card kind=\"general\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"processing\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"success\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"warning\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"error\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"success\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"error\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n </sps-insights>\n "]))),
|
|
2800
|
-
},
|
|
2801
|
-
},
|
|
2802
|
-
},
|
|
2803
|
-
partner_count: {
|
|
2804
|
-
label: 'Partner Count',
|
|
2805
|
-
examples: {
|
|
2806
|
-
partner_count: {
|
|
2807
|
-
jsx: utils.code(templateObject_3$1 || (templateObject_3$1 = __makeTemplateObject(["\n <sps-insights>\n <sps-insight-card kind=\"general\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"250\"\n totalPartners=\"250\"\n ></sps-insight-card>\n <sps-insight-card kind=\"processing\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"122\"\n totalPartners=\"250\"\n ></sps-insight-card>\n <sps-insight-card kind=\"success\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"207\"\n totalPartners=\"250\"\n ></sps-insight-card>\n <sps-insight-card kind=\"warning\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"12\"\n totalPartners=\"250\"\n ></sps-insight-card>\n <sps-insight-card kind=\"error\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"94\"\n totalPartners=\"250\"\n ></sps-insight-card>\n </sps-insights>\n "], ["\n <sps-insights>\n <sps-insight-card kind=\"general\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"250\"\n totalPartners=\"250\"\n ></sps-insight-card>\n <sps-insight-card kind=\"processing\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"122\"\n totalPartners=\"250\"\n ></sps-insight-card>\n <sps-insight-card kind=\"success\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"207\"\n totalPartners=\"250\"\n ></sps-insight-card>\n <sps-insight-card kind=\"warning\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"12\"\n totalPartners=\"250\"\n ></sps-insight-card>\n <sps-insight-card kind=\"error\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"94\"\n totalPartners=\"250\"\n ></sps-insight-card>\n </sps-insights>\n "]))),
|
|
2808
|
-
},
|
|
2809
|
-
},
|
|
2810
|
-
},
|
|
2811
|
-
expansion: {
|
|
2812
|
-
label: '10+ Insight Cards',
|
|
2813
|
-
examples: {
|
|
2814
|
-
expansion: {
|
|
2815
|
-
jsx: utils.code(templateObject_4$1 || (templateObject_4$1 = __makeTemplateObject(["\n <sps-insights>\n <sps-insight-card kind=\"general\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"processing\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n ></sps-insight-card>\n <sps-insight-card kind=\"success\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"warning\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n ></sps-insight-card>\n <sps-insight-card kind=\"error\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"general\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n ></sps-insight-card>\n <sps-insight-card kind=\"processing\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"success\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n ></sps-insight-card>\n <sps-insight-card kind=\"warning\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"error\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n ></sps-insight-card>\n <sps-insight-card kind=\"general\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"processing\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n ></sps-insight-card>\n <sps-insight-card kind=\"success\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"warning\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n ></sps-insight-card>\n <sps-insight-card kind=\"error\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n </sps-insights>\n "], ["\n <sps-insights>\n <sps-insight-card kind=\"general\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"processing\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n ></sps-insight-card>\n <sps-insight-card kind=\"success\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"warning\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n ></sps-insight-card>\n <sps-insight-card kind=\"error\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"general\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n ></sps-insight-card>\n <sps-insight-card kind=\"processing\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"success\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n ></sps-insight-card>\n <sps-insight-card kind=\"warning\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"error\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n ></sps-insight-card>\n <sps-insight-card kind=\"general\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"processing\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n ></sps-insight-card>\n <sps-insight-card kind=\"success\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n <sps-insight-card kind=\"warning\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n ></sps-insight-card>\n <sps-insight-card kind=\"error\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n partnerCount=\"100\"\n totalPartners=\"200\"\n >\n <span className=\"gray600 font-weight-bold\">Detail:</span> 792 units\n </sps-insight-card>\n </sps-insights>\n "]))),
|
|
2816
|
-
},
|
|
2817
|
-
},
|
|
2818
|
-
},
|
|
2819
|
-
events: {
|
|
2820
|
-
label: 'Adding a click handler',
|
|
2821
|
-
description: utils.code(templateObject_5$1 || (templateObject_5$1 = __makeTemplateObject(["\n <p>Attaching event handlers to native web components in React cannot be done the usual way at this time.\n Here is how to do it:</p>\n "], ["\n <p>Attaching event handlers to native web components in React cannot be done the usual way at this time.\n Here is how to do it:</p>\n "]))),
|
|
2822
|
-
examples: {
|
|
2823
|
-
events: {
|
|
2824
|
-
react: utils.code(templateObject_6$1 || (templateObject_6$1 = __makeTemplateObject(["\n function Component() {\n function handleClick() {\n window.alert(\"Insight card clicked\");\n }\n\n const ref = React.useRef();\n React.useEffect(() => {\n ref.current.addEventListener(\"click\", handleClick);\n return () => {\n ref.current.removeEventListener(\"click\", handleClick);\n };\n }, []);\n\n return (\n <sps-insights>\n <sps-insight-card ref={ref}\n kind=\"general\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card kind=\"general\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card kind=\"general\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n ></sps-insight-card>\n </sps-insights>\n );\n }\n "], ["\n function Component() {\n function handleClick() {\n window.alert(\"Insight card clicked\");\n }\n\n const ref = React.useRef();\n React.useEffect(() => {\n ref.current.addEventListener(\"click\", handleClick);\n return () => {\n ref.current.removeEventListener(\"click\", handleClick);\n };\n }, []);\n\n return (\n <sps-insights>\n <sps-insight-card ref={ref}\n kind=\"general\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card kind=\"general\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card kind=\"general\"\n metric=\"1234\"\n title=\"Insight Card Title\"\n ></sps-insight-card>\n </sps-insights>\n );\n }\n "]))),
|
|
2825
|
-
},
|
|
2826
|
-
},
|
|
2827
|
-
},
|
|
2828
|
-
alternateIcon: {
|
|
2829
|
-
label: 'Using alternate icons',
|
|
2830
|
-
examples: {
|
|
2831
|
-
basic: {
|
|
2832
|
-
react: utils.code(templateObject_7$1 || (templateObject_7$1 = __makeTemplateObject(["\n function DemoComponent() {\n return (\n <sps-insights>\n <sps-insight-card\n kind=\"general\"\n metric=\"1234\"\n icon={SpsIcon.DOLLAR_SIGN}\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card\n kind=\"processing\"\n metric=\"1234\"\n icon={SpsIcon.ASTERISK}\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card\n kind=\"success\"\n metric=\"1234\"\n icon={SpsIcon.USER}\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card\n kind=\"warning\"\n metric=\"1234\"\n icon={SpsIcon.FOLDER_OPEN}\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card\n kind=\"error\"\n metric=\"1234\"\n icon={SpsIcon.BAN}\n title=\"Insight Card Title\"\n ></sps-insight-card>\n </sps-insights>\n )\n }\n "], ["\n function DemoComponent() {\n return (\n <sps-insights>\n <sps-insight-card\n kind=\"general\"\n metric=\"1234\"\n icon={SpsIcon.DOLLAR_SIGN}\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card\n kind=\"processing\"\n metric=\"1234\"\n icon={SpsIcon.ASTERISK}\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card\n kind=\"success\"\n metric=\"1234\"\n icon={SpsIcon.USER}\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card\n kind=\"warning\"\n metric=\"1234\"\n icon={SpsIcon.FOLDER_OPEN}\n title=\"Insight Card Title\"\n ></sps-insight-card>\n <sps-insight-card\n kind=\"error\"\n metric=\"1234\"\n icon={SpsIcon.BAN}\n title=\"Insight Card Title\"\n ></sps-insight-card>\n </sps-insights>\n )\n }\n "]))),
|
|
2833
|
-
},
|
|
2834
|
-
},
|
|
2835
|
-
},
|
|
2836
|
-
};
|
|
2837
|
-
var templateObject_1$2, templateObject_2$2, templateObject_3$1, templateObject_4$1, templateObject_5$1, templateObject_6$1, templateObject_7$1;
|
|
2838
|
-
|
|
2839
|
-
var SpsNavTabComponent = /** @class */ (function (_super) {
|
|
2840
|
-
__extends(SpsNavTabComponent, _super);
|
|
2841
|
-
function SpsNavTabComponent() {
|
|
2842
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
2843
|
-
_this.active = false;
|
|
2844
|
-
_this.label = '';
|
|
2845
|
-
_this.tag = '';
|
|
2846
|
-
return _this;
|
|
2847
|
-
}
|
|
2848
|
-
Object.defineProperty(SpsNavTabComponent.prototype, ClassBindings, {
|
|
2849
|
-
get: function () {
|
|
2850
|
-
return [
|
|
2851
|
-
'sps-tabbed-nav__nav-item',
|
|
2852
|
-
this.active && 'sps-tabbed-nav__nav-item--active',
|
|
2853
|
-
];
|
|
2854
|
-
},
|
|
2855
|
-
enumerable: false,
|
|
2856
|
-
configurable: true
|
|
2857
|
-
});
|
|
2858
|
-
SpsNavTabComponent.prototype.render = function () {
|
|
2859
|
-
return (h("a", { href: this.href, target: this.target, className: "sps-tabbed-nav__nav-item-link", tabIndex: 0 },
|
|
2860
|
-
this.icon && h("i", { className: "sps-icon sps-icon-" + this.icon }),
|
|
2861
|
-
this.label && h("span", null, this.label),
|
|
2862
|
-
this.tag && h("span", { className: "sps-tag sps-tag--default" }, this.tag)));
|
|
2863
|
-
};
|
|
2864
|
-
SpsNavTabComponent.displayName = 'sps-nav-tab';
|
|
2865
|
-
SpsNavTabComponent.props = {
|
|
2866
|
-
active: 'boolean',
|
|
2867
|
-
label: 'string',
|
|
2868
|
-
icon: 'SpsIcon',
|
|
2869
|
-
tag: 'string',
|
|
2870
|
-
href: 'string',
|
|
2871
|
-
target: 'string',
|
|
2872
|
-
};
|
|
2873
|
-
__decorate([
|
|
2874
|
-
Prop(),
|
|
2875
|
-
__metadata("design:type", Object)
|
|
2876
|
-
], SpsNavTabComponent.prototype, "active", void 0);
|
|
2877
|
-
__decorate([
|
|
2878
|
-
Prop(),
|
|
2879
|
-
__metadata("design:type", Object)
|
|
2880
|
-
], SpsNavTabComponent.prototype, "label", void 0);
|
|
2881
|
-
__decorate([
|
|
2882
|
-
Prop(),
|
|
2883
|
-
__metadata("design:type", String)
|
|
2884
|
-
], SpsNavTabComponent.prototype, "icon", void 0);
|
|
2885
|
-
__decorate([
|
|
2886
|
-
Prop(),
|
|
2887
|
-
__metadata("design:type", Object)
|
|
2888
|
-
], SpsNavTabComponent.prototype, "tag", void 0);
|
|
2889
|
-
__decorate([
|
|
2890
|
-
Prop(),
|
|
2891
|
-
__metadata("design:type", String)
|
|
2892
|
-
], SpsNavTabComponent.prototype, "href", void 0);
|
|
2893
|
-
__decorate([
|
|
2894
|
-
Prop(),
|
|
2895
|
-
__metadata("design:type", String)
|
|
2896
|
-
], SpsNavTabComponent.prototype, "target", void 0);
|
|
2897
|
-
SpsNavTabComponent = __decorate([
|
|
2898
|
-
Component({ tag: 'sps-nav-tab' })
|
|
2899
|
-
], SpsNavTabComponent);
|
|
2900
|
-
return SpsNavTabComponent;
|
|
2901
|
-
}(HTMLElement));
|
|
2902
|
-
|
|
2903
|
-
/** Contains a set of navigation tabs. */
|
|
2904
|
-
var SpsNavTabSetComponent = /** @class */ (function (_super) {
|
|
2905
|
-
__extends(SpsNavTabSetComponent, _super);
|
|
2906
|
-
function SpsNavTabSetComponent() {
|
|
2907
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
2908
|
-
_this.content = [];
|
|
2909
|
-
return _this;
|
|
2910
|
-
}
|
|
2911
|
-
SpsNavTabSetComponent.prototype.render = function () {
|
|
2912
|
-
return (h("nav", { className: "sps-tabbed-nav" }, this.content));
|
|
2913
|
-
};
|
|
2914
|
-
SpsNavTabSetComponent.displayName = 'sps-nav-tab-set';
|
|
2915
|
-
SpsNavTabSetComponent.props = {};
|
|
2916
|
-
__decorate([
|
|
2917
|
-
Content(),
|
|
2918
|
-
__metadata("design:type", Object)
|
|
2919
|
-
], SpsNavTabSetComponent.prototype, "content", void 0);
|
|
2920
|
-
SpsNavTabSetComponent = __decorate([
|
|
2921
|
-
Component({ tag: 'sps-nav-tab-set' })
|
|
2922
|
-
], SpsNavTabSetComponent);
|
|
2923
|
-
return SpsNavTabSetComponent;
|
|
2924
|
-
}(HTMLElement));
|
|
2925
|
-
|
|
2926
|
-
var SpsNavTabsExamples = {
|
|
2927
|
-
basic: {
|
|
2928
|
-
label: 'Basic Navigation Tabs',
|
|
2929
|
-
description: utils.code(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n <p>Navigation tabs native web component</p>\n "], ["\n <p>Navigation tabs native web component</p>\n "]))),
|
|
2930
|
-
examples: {
|
|
2931
|
-
basic: {
|
|
2932
|
-
react: utils.code(templateObject_2$1 || (templateObject_2$1 = __makeTemplateObject(["\n function DemoComponent() {\n const tabs = [\n { label: \"Tab A\", icon: \"chart-line\" },\n { label: \"Tab B\", icon: \"chart-bar\", tag: \"12\" },\n { label: \"Tab C\", icon: \"chart-pie\" }\n ]\n\n const [activeTab, setActiveTab] = React.useState(0)\n\n return (\n <sps-nav-tab-set>\n {tabs.map((tab, index) => (\n <sps-nav-tab\n key={index}\n icon={tab.icon}\n label={tab.label}\n tag={tab.tag}\n active={index === activeTab || null}\n onClick={() => setActiveTab(index)}\n />\n ))}\n </sps-nav-tab-set>\n )\n }\n "], ["\n function DemoComponent() {\n const tabs = [\n { label: \"Tab A\", icon: \"chart-line\" },\n { label: \"Tab B\", icon: \"chart-bar\", tag: \"12\" },\n { label: \"Tab C\", icon: \"chart-pie\" }\n ]\n\n const [activeTab, setActiveTab] = React.useState(0)\n\n return (\n <sps-nav-tab-set>\n {tabs.map((tab, index) => (\n <sps-nav-tab\n key={index}\n icon={tab.icon}\n label={tab.label}\n tag={tab.tag}\n active={index === activeTab || null}\n onClick={() => setActiveTab(index)}\n />\n ))}\n </sps-nav-tab-set>\n )\n }\n "]))),
|
|
2933
|
-
},
|
|
2934
|
-
},
|
|
2935
|
-
},
|
|
2936
|
-
};
|
|
2937
|
-
var templateObject_1$1, templateObject_2$1;
|
|
2938
|
-
|
|
2939
|
-
exports.SpsPhotoDisplayMode = void 0;
|
|
2940
|
-
(function (SpsPhotoDisplayMode) {
|
|
2941
|
-
SpsPhotoDisplayMode["FIT"] = "fit";
|
|
2942
|
-
SpsPhotoDisplayMode["FILL"] = "fill";
|
|
2943
|
-
})(exports.SpsPhotoDisplayMode || (exports.SpsPhotoDisplayMode = {}));
|
|
2944
|
-
var CPT_NAME = 'sps-photo';
|
|
2945
|
-
var SpsPhotoComponent = /** @class */ (function (_super) {
|
|
2946
|
-
__extends(SpsPhotoComponent, _super);
|
|
2947
|
-
function SpsPhotoComponent() {
|
|
2948
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
2949
|
-
/** Display mode - fill or fit. */
|
|
2950
|
-
_this.mode = exports.SpsPhotoDisplayMode.FILL;
|
|
2951
|
-
return _this;
|
|
2952
|
-
}
|
|
2953
|
-
Object.defineProperty(SpsPhotoComponent.prototype, "image", {
|
|
2954
|
-
/** The native HTML <img> element within the photo component. */
|
|
2955
|
-
get: function () {
|
|
2956
|
-
return this.imageInternal;
|
|
2957
|
-
},
|
|
2958
|
-
set: function (newValue) {
|
|
2959
|
-
var _this = this;
|
|
2960
|
-
this.imageInternal = newValue;
|
|
2961
|
-
if (newValue) {
|
|
2962
|
-
if (this.waitForImgHeightInterval) {
|
|
2963
|
-
window.clearInterval(this.waitForImgHeightInterval);
|
|
2964
|
-
}
|
|
2965
|
-
this.waitForImgHeightInterval = window.setInterval(function () {
|
|
2966
|
-
var imgRect = newValue.getBoundingClientRect();
|
|
2967
|
-
if (imgRect.height) {
|
|
2968
|
-
window.clearInterval(_this.waitForImgHeightInterval);
|
|
2969
|
-
delete _this.waitForImgHeightInterval;
|
|
2970
|
-
var imageIsLandscape = true;
|
|
2971
|
-
imageIsLandscape = imgRect.width / imgRect.height > 1;
|
|
2972
|
-
_this.fitWidth = imageIsLandscape === (_this.mode === exports.SpsPhotoDisplayMode.FIT);
|
|
2973
|
-
}
|
|
2974
|
-
}, 1000 / 60);
|
|
2975
|
-
}
|
|
2976
|
-
},
|
|
2977
|
-
enumerable: false,
|
|
2978
|
-
configurable: true
|
|
2979
|
-
});
|
|
2980
|
-
Object.defineProperty(SpsPhotoComponent.prototype, ClassBindings, {
|
|
2981
|
-
get: function () {
|
|
2982
|
-
return [
|
|
2983
|
-
CPT_NAME,
|
|
2984
|
-
this.fitWidth
|
|
2985
|
-
? CPT_NAME + "--fit-width"
|
|
2986
|
-
: CPT_NAME + "--fit-height",
|
|
2987
|
-
this.placeholderIcon && CPT_NAME + "--placeholder",
|
|
2988
|
-
];
|
|
2989
|
-
},
|
|
2990
|
-
enumerable: false,
|
|
2991
|
-
configurable: true
|
|
2992
|
-
});
|
|
2993
|
-
Object.defineProperty(SpsPhotoComponent.prototype, StyleBindings, {
|
|
2994
|
-
get: function () {
|
|
2995
|
-
return {
|
|
2996
|
-
fontSize: this.width * 0.05 + "rem",
|
|
2997
|
-
width: this.width + "rem",
|
|
2998
|
-
height: 0.75 * this.width + "rem",
|
|
2999
|
-
};
|
|
3000
|
-
},
|
|
3001
|
-
enumerable: false,
|
|
3002
|
-
configurable: true
|
|
3003
|
-
});
|
|
3004
|
-
SpsPhotoComponent.prototype.setWidth = function (hostWidth) {
|
|
3005
|
-
if (hostWidth && !this.width) {
|
|
3006
|
-
var baseFontSize = document.body.parentElement.style.fontSize || '16px';
|
|
3007
|
-
var remPx = +(baseFontSize.substr(0, baseFontSize.length - 2));
|
|
3008
|
-
this.width = hostWidth / remPx;
|
|
3009
|
-
}
|
|
3010
|
-
};
|
|
3011
|
-
SpsPhotoComponent.prototype.connectedCallback = function () {
|
|
3012
|
-
var _this = this;
|
|
3013
|
-
this.waitForWidthInterval = window.setInterval(function () {
|
|
3014
|
-
var boundingClientRect = _this.getBoundingClientRect();
|
|
3015
|
-
if (boundingClientRect.width) {
|
|
3016
|
-
_this.setWidth(boundingClientRect.width);
|
|
3017
|
-
window.clearInterval(_this.waitForWidthInterval);
|
|
3018
|
-
delete _this.waitForWidthInterval;
|
|
3019
|
-
}
|
|
3020
|
-
}, 1000 / 60);
|
|
3021
|
-
};
|
|
3022
|
-
SpsPhotoComponent.prototype.disconnectedCallback = function () {
|
|
3023
|
-
if (this.waitForWidthInterval) {
|
|
3024
|
-
window.clearInterval(this.waitForWidthInterval);
|
|
3025
|
-
}
|
|
3026
|
-
if (this.waitForImgHeightInterval) {
|
|
3027
|
-
window.clearInterval(this.waitForImgHeightInterval);
|
|
3028
|
-
}
|
|
3029
|
-
};
|
|
3030
|
-
SpsPhotoComponent.prototype.render = function () {
|
|
3031
|
-
if (this.src) {
|
|
3032
|
-
return this.width
|
|
3033
|
-
? h("img", { src: this.src, alt: this.altText })
|
|
3034
|
-
: h("span", null);
|
|
3035
|
-
}
|
|
3036
|
-
return h("i", { className: "sps-icon sps-icon-" + this.placeholderIcon });
|
|
3037
|
-
};
|
|
3038
|
-
SpsPhotoComponent.displayName = CPT_NAME;
|
|
3039
|
-
SpsPhotoComponent.props = {
|
|
3040
|
-
src: 'string',
|
|
3041
|
-
altText: 'string',
|
|
3042
|
-
mode: 'SpsPhotoDisplayMode',
|
|
3043
|
-
placeholderIcon: 'SpsIcon',
|
|
3044
|
-
};
|
|
3045
|
-
__decorate([
|
|
3046
|
-
Prop(),
|
|
3047
|
-
__metadata("design:type", String)
|
|
3048
|
-
], SpsPhotoComponent.prototype, "src", void 0);
|
|
3049
|
-
__decorate([
|
|
3050
|
-
Prop(),
|
|
3051
|
-
__metadata("design:type", String)
|
|
3052
|
-
], SpsPhotoComponent.prototype, "altText", void 0);
|
|
3053
|
-
__decorate([
|
|
3054
|
-
Prop(),
|
|
3055
|
-
__metadata("design:type", Object)
|
|
3056
|
-
], SpsPhotoComponent.prototype, "mode", void 0);
|
|
3057
|
-
__decorate([
|
|
3058
|
-
Prop(),
|
|
3059
|
-
__metadata("design:type", String)
|
|
3060
|
-
], SpsPhotoComponent.prototype, "placeholderIcon", void 0);
|
|
3061
|
-
__decorate([
|
|
3062
|
-
QuerySelector('img', { refresh: true }),
|
|
3063
|
-
__metadata("design:type", HTMLImageElement),
|
|
3064
|
-
__metadata("design:paramtypes", [HTMLImageElement])
|
|
3065
|
-
], SpsPhotoComponent.prototype, "image", null);
|
|
3066
|
-
__decorate([
|
|
3067
|
-
Watch(),
|
|
3068
|
-
__metadata("design:type", Object)
|
|
3069
|
-
], SpsPhotoComponent.prototype, "width", void 0);
|
|
3070
|
-
__decorate([
|
|
3071
|
-
Watch(),
|
|
3072
|
-
__metadata("design:type", Object)
|
|
3073
|
-
], SpsPhotoComponent.prototype, "fitWidth", void 0);
|
|
3074
|
-
SpsPhotoComponent = __decorate([
|
|
3075
|
-
Component({ tag: CPT_NAME })
|
|
3076
|
-
], SpsPhotoComponent);
|
|
3077
|
-
return SpsPhotoComponent;
|
|
3078
|
-
}(HTMLElement));
|
|
3079
|
-
|
|
3080
|
-
var SpsPhotoExamples = {
|
|
3081
|
-
sizing: {
|
|
3082
|
-
label: 'Sizing',
|
|
3083
|
-
description: utils.code(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n <p>\n Photos are block elements, so a photo fills its container's width unless\n an explicit width is set. It is always a 4:3 aspect ratio. In this example,\n photos have been placed in cards which have different widths in the 12\n column grid.\n </p>\n "], ["\n <p>\n Photos are block elements, so a photo fills its container's width unless\n an explicit width is set. It is always a 4:3 aspect ratio. In this example,\n photos have been placed in cards which have different widths in the 12\n column grid.\n </p>\n "]))),
|
|
3084
|
-
examples: {
|
|
3085
|
-
basic: {
|
|
3086
|
-
jsx: utils.code(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n <div className=\"sfg-row\">\n <div className=\"sfg-col-2\">\n <sps-card>\n <sps-photo src=\"assets/images/photo-landscape.jpg\"></sps-photo>\n </sps-card>\n </div>\n <div className=\"sfg-col-4\">\n <sps-card>\n <sps-photo src=\"assets/images/photo-landscape.jpg\"></sps-photo>\n </sps-card>\n </div>\n <div className=\"sfg-col-6\">\n <sps-card>\n <sps-photo src=\"assets/images/photo-landscape.jpg\"></sps-photo>\n </sps-card>\n </div>\n </div>\n "], ["\n <div className=\"sfg-row\">\n <div className=\"sfg-col-2\">\n <sps-card>\n <sps-photo src=\"assets/images/photo-landscape.jpg\"></sps-photo>\n </sps-card>\n </div>\n <div className=\"sfg-col-4\">\n <sps-card>\n <sps-photo src=\"assets/images/photo-landscape.jpg\"></sps-photo>\n </sps-card>\n </div>\n <div className=\"sfg-col-6\">\n <sps-card>\n <sps-photo src=\"assets/images/photo-landscape.jpg\"></sps-photo>\n </sps-card>\n </div>\n </div>\n "]))),
|
|
3087
|
-
},
|
|
3088
|
-
},
|
|
3089
|
-
},
|
|
3090
|
-
displayMode: {
|
|
3091
|
-
label: 'Fill vs. Fit',
|
|
3092
|
-
description: utils.code(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n <p>\n There are two display modes available:\n <ul>\n <li><b>\"fill\"</b> fills the entire 4:3 container, cropping off any excess portions of the image.\n <li><b>\"fit\"</b> fits the entire image into the container, leaving any excess portions of the container blank.\n </ul>\n </p>\n "], ["\n <p>\n There are two display modes available:\n <ul>\n <li><b>\"fill\"</b> fills the entire 4:3 container, cropping off any excess portions of the image.\n <li><b>\"fit\"</b> fits the entire image into the container, leaving any excess portions of the container blank.\n </ul>\n </p>\n "]))),
|
|
3093
|
-
examples: {
|
|
3094
|
-
landscape: {
|
|
3095
|
-
description: '<p>Landscape oriented photo (container outline added for illustrative purposes)</p>',
|
|
3096
|
-
jsx: utils.code(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n <div className=\"sfg-row\">\n <div className=\"sfg-col-4\">\n <sps-photo src=\"assets/images/photo-landscape.jpg\" mode=\"fill\"></sps-photo>\n </div>\n <div className=\"sfg-col-4\">\n <sps-photo src=\"assets/images/photo-landscape.jpg\" mode=\"fit\"></sps-photo>\n </div>\n </div>\n "], ["\n <div className=\"sfg-row\">\n <div className=\"sfg-col-4\">\n <sps-photo src=\"assets/images/photo-landscape.jpg\" mode=\"fill\"></sps-photo>\n </div>\n <div className=\"sfg-col-4\">\n <sps-photo src=\"assets/images/photo-landscape.jpg\" mode=\"fit\"></sps-photo>\n </div>\n </div>\n "]))),
|
|
3097
|
-
},
|
|
3098
|
-
portrait: {
|
|
3099
|
-
description: '<p>Portrait oriented photo (container outline added for illustrative purposes)</p>',
|
|
3100
|
-
jsx: utils.code(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n <div className=\"sfg-row\">\n <div className=\"sfg-col-4\">\n <sps-photo src=\"assets/images/photo-portrait.jpg\" mode=\"fill\"></sps-photo>\n </div>\n <div className=\"sfg-col-4\">\n <sps-photo id=\"foo\" src=\"assets/images/photo-portrait.jpg\" mode=\"fit\"></sps-photo>\n </div>\n </div>\n "], ["\n <div className=\"sfg-row\">\n <div className=\"sfg-col-4\">\n <sps-photo src=\"assets/images/photo-portrait.jpg\" mode=\"fill\"></sps-photo>\n </div>\n <div className=\"sfg-col-4\">\n <sps-photo id=\"foo\" src=\"assets/images/photo-portrait.jpg\" mode=\"fit\"></sps-photo>\n </div>\n </div>\n "]))),
|
|
3101
|
-
},
|
|
3102
|
-
},
|
|
3103
|
-
},
|
|
3104
|
-
placeholder: {
|
|
3105
|
-
label: 'Placeholders',
|
|
3106
|
-
description: utils.code(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n <p>\n When an image is not provided for a particular use case (such as a user avatar,\n a company photo, item image, etc.), a placeholder should be shown in its place.\n\n The placeholder's icon, selected from our SPS icon set, should represent the\n type of image it is substituting for.\n </p>\n "], ["\n <p>\n When an image is not provided for a particular use case (such as a user avatar,\n a company photo, item image, etc.), a placeholder should be shown in its place.\n\n The placeholder's icon, selected from our SPS icon set, should represent the\n type of image it is substituting for.\n </p>\n "]))),
|
|
3107
|
-
examples: {
|
|
3108
|
-
general: {
|
|
3109
|
-
description: '<p>General Photo</p>',
|
|
3110
|
-
jsx: utils.code(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n <div className=\"sfg-row\">\n <div className=\"sfg-col-3\">\n <sps-photo placeholderIcon=\"photo\"></sps-photo>\n </div>\n </div>\n "], ["\n <div className=\"sfg-row\">\n <div className=\"sfg-col-3\">\n <sps-photo placeholderIcon=\"photo\"></sps-photo>\n </div>\n </div>\n "]))),
|
|
3111
|
-
},
|
|
3112
|
-
photoAlt: {
|
|
3113
|
-
description: '<p>Photo Alt</p>',
|
|
3114
|
-
jsx: utils.code(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n <div className=\"sfg-row\">\n <div className=\"sfg-col-3\">\n <sps-photo placeholderIcon=\"camera\"></sps-photo>\n </div>\n </div>\n "], ["\n <div className=\"sfg-row\">\n <div className=\"sfg-col-3\">\n <sps-photo placeholderIcon=\"camera\"></sps-photo>\n </div>\n </div>\n "]))),
|
|
3115
|
-
},
|
|
3116
|
-
user: {
|
|
3117
|
-
description: '<p>User / Single Person</p>',
|
|
3118
|
-
jsx: utils.code(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n <div className=\"sfg-row\">\n <div className=\"sfg-col-3\">\n <sps-photo placeholderIcon=\"user\"></sps-photo>\n </div>\n </div>\n "], ["\n <div className=\"sfg-row\">\n <div className=\"sfg-col-3\">\n <sps-photo placeholderIcon=\"user\"></sps-photo>\n </div>\n </div>\n "]))),
|
|
3119
|
-
},
|
|
3120
|
-
group: {
|
|
3121
|
-
description: '<p>Group / Multiple People</p>',
|
|
3122
|
-
jsx: utils.code(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n <div className=\"sfg-row\">\n <div className=\"sfg-col-3\">\n <sps-photo placeholderIcon=\"group\"></sps-photo>\n </div>\n </div>\n "], ["\n <div className=\"sfg-row\">\n <div className=\"sfg-col-3\">\n <sps-photo placeholderIcon=\"group\"></sps-photo>\n </div>\n </div>\n "]))),
|
|
3123
|
-
},
|
|
3124
|
-
company: {
|
|
3125
|
-
description: '<p>Company / Building</p>',
|
|
3126
|
-
jsx: utils.code(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n <div className=\"sfg-row\">\n <div className=\"sfg-col-3\">\n <sps-photo placeholderIcon=\"building\"></sps-photo>\n </div>\n </div>\n "], ["\n <div className=\"sfg-row\">\n <div className=\"sfg-col-3\">\n <sps-photo placeholderIcon=\"building\"></sps-photo>\n </div>\n </div>\n "]))),
|
|
3127
|
-
},
|
|
3128
|
-
},
|
|
3129
|
-
},
|
|
3130
|
-
};
|
|
3131
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11;
|
|
3132
|
-
|
|
3133
|
-
var MANIFEST = {
|
|
3134
|
-
'File Upload': {
|
|
3135
|
-
components: [SpsFileUploadComponent],
|
|
3136
|
-
examples: SpsFileUploadExamples,
|
|
3137
|
-
},
|
|
3138
|
-
'Insight Cards': {
|
|
3139
|
-
components: [SpsInsightCardComponent, SpsInsightsComponent],
|
|
3140
|
-
examples: SpsInsightCardExamples,
|
|
3141
|
-
},
|
|
3142
|
-
'Tabbed Navigation': {
|
|
3143
|
-
components: [SpsNavTabComponent, SpsNavTabSetComponent],
|
|
3144
|
-
examples: SpsNavTabsExamples,
|
|
3145
|
-
},
|
|
3146
|
-
Photos: {
|
|
3147
|
-
components: [SpsPhotoComponent],
|
|
3148
|
-
examples: SpsPhotoExamples,
|
|
3149
|
-
},
|
|
3150
|
-
};
|
|
3151
|
-
|
|
3152
|
-
exports.AttrBindings = AttrBindings;
|
|
3153
|
-
exports.ClassBindings = ClassBindings;
|
|
3154
|
-
exports.Component = Component;
|
|
3155
|
-
exports.Content = Content;
|
|
3156
|
-
exports.EventDispatcher = EventDispatcher;
|
|
3157
|
-
exports.EventListener = EventListener;
|
|
3158
|
-
exports.MANIFEST = MANIFEST;
|
|
3159
|
-
exports.Prop = Prop;
|
|
3160
|
-
exports.QuerySelector = QuerySelector;
|
|
3161
|
-
exports.QuerySelectorAll = QuerySelectorAll;
|
|
3162
|
-
exports.SpsFileUploadComponent = SpsFileUploadComponent;
|
|
3163
|
-
exports.SpsFileUploadExamples = SpsFileUploadExamples;
|
|
3164
|
-
exports.SpsInsightCardComponent = SpsInsightCardComponent;
|
|
3165
|
-
exports.SpsInsightCardExamples = SpsInsightCardExamples;
|
|
3166
|
-
exports.SpsInsightsComponent = SpsInsightsComponent;
|
|
3167
|
-
exports.SpsNavTabComponent = SpsNavTabComponent;
|
|
3168
|
-
exports.SpsNavTabSetComponent = SpsNavTabSetComponent;
|
|
3169
|
-
exports.SpsNavTabsExamples = SpsNavTabsExamples;
|
|
3170
|
-
exports.SpsPhotoComponent = SpsPhotoComponent;
|
|
3171
|
-
exports.SpsPhotoExamples = SpsPhotoExamples;
|
|
3172
|
-
exports.StyleBindings = StyleBindings;
|
|
3173
|
-
exports.Watch = Watch;
|
|
3174
|
-
exports.h = h;
|
|
3175
|
-
exports.namespaceOverrideRegistrar = namespaceOverrideRegistrar;
|
|
3176
|
-
exports.register = register;
|
|
3177
|
-
exports.webComponentsUseI18n = webComponentsUseI18n;
|
|
181
|
+
*/c.applyAttr=de;c.applyProp=he;c.attributes=U;c.close=ye;var te=c.currentElement=mt,se=c.currentPointer=ft;c.open=Ne;var Nt=c.patch=Ce;c.patchInner=Ce;c.patchOuter=ct;c.skip=gt;var ne=c.skipNode=M;c.getKey=at;c.clearCache=ge;c.importNode=fe;c.isDataInitialized=it;c.notifications=B;c.symbols=V;var Ie=c.attr=wt,yt=c.elementClose=Pe;c.elementOpen=ee;var At=c.elementOpenEnd=St,Pt=c.elementOpenStart=Ct;c.elementVoid=_t;var It=c.text=xt;c.key=bt;function De(e){let t=se();return t instanceof Comment&&t.data!==e?t.data=e:(t=document.createComment(e),te().appendChild(t)),ne(),t}let Oe=T.noI18nI18n;function Dt(e){Oe=e}function Ot(){return Oe}const I=Symbol("ComponentMetadata"),b=Object.freeze({has(e,t){return Boolean(e[I]&&Object.prototype.hasOwnProperty.call(e[I],t))},add(e,t){e[I]?Object.assign(e[I],t):e[I]=t},get(e,t,s){return e[I]&&e[I][t]||s}}),Fe=Symbol("ds-web-components:pragma:listeners-attached"),Le="idom-pragma:content-begin",ie="idom-pragma:content-end";function ae(e){for(const t of e)if(typeof t=="function")t();else if(typeof t=="string")It(t);else if(t instanceof Set)ae(Array.from(t));else if(Array.isArray(t)&&t.length>0){let s=se();if(De(Le),s===null){const n=te();for(let i=0;i<t.length;i+=1)n.contains(t[i])||n.appendChild(t[i]),ne()}for(;s&&s.data!==ie;)ne(),s=se();De(ie)}}function r(e,t,...s){if(t){for(const n of Object.keys(t))if(n.toUpperCase()==="DATA-FRAGMENT")return()=>ae(s)}return()=>{Pt(e);const n=[];if(t)for(const a of Object.keys(t))a.toUpperCase()==="CLASSNAME"?Ie("class",t[a]):/^on[A-Z]/.test(a)?n.push(a):Ie(a,t[a]);At(e);const i=te();if(!i[Fe]){for(const a of n)i.addEventListener(a.substr(2).toLowerCase(),t[a]);i[Fe]=!0}ae(s),yt(e)}}function ke(e,t){customElements.get(e)||customElements.define(e,t)}function Ft(...e){for(const t of e)ke(b.get(t,"tag"),t)}function Lt(e){return function(...s){for(const n of s){const i=`${e}${b.get(n,"tag").substr(3)}`;ke(i,n)}}}const re=Symbol("Component Attribute Bindings"),D=Symbol("Component Class Bindings"),G=Symbol("Component Style Bindings"),kt={__initialized:!1,__observer:null,__queuedUpdate:null,__managedClasses:new Set,__updateHostBindings(){const e=this;for(const t of Object.keys(e[re]||{}))e.setAttribute(t,e[re][t]);for(const t of Object.keys(e[G]||{}))e.style[t]=e[G][t];for(const t of e.__managedClasses)e.classList.remove(t);for(const t of(e[D]||[]).filter(Boolean))e.__managedClasses.add(t),e.classList.add(t);for(const t of(e.getAttribute("classname")||"").split(/\w+/).filter(Boolean))e.classList.add(t)},__updateChildQueries(e){const t=this;for(const s of b.get(t.constructor,"childQueries",[]))if(!e||e&&s.refresh){const n=s.all?t.querySelectorAll:t.querySelector;t[s.key]=n.call(t,s.selector)}},__gatherChildren(){const e=this;let t=Array.from(e.childNodes),s=null,n=t.length;for(let i=0;i<t.length;i+=1){const a=t[i];a instanceof Comment&&(a.data===Le?s=i+1:a.data===ie&&(n=i-1))}if(s===null)for(const i of t)i.parentNode.removeChild(i);else t=t.slice(s,n);b.has(e.constructor,"contentProp")&&(e[b.get(e.constructor,"contentProp")]=t)},__startMutObs(){const e=this;e.__observer||(e.__observer=new MutationObserver(()=>{e.contentChangedCallback&&e.contentChangedCallback(),e.__gatherChildren(),e.update()})),e.__observer.observe(e,{childList:!0})},__stopMutObs(){const e=this;e.__observer&&e.__observer.disconnect()},__doRender(){const e=this;e.__stopMutObs(),Nt(e,e.render(Ot())),e.__startMutObs()},update(){const e=this;e.__initialized&&!e.__queuedUpdate&&(e.__queuedUpdate=window.requestAnimationFrame(()=>{e.__doRender(),setTimeout(()=>{e.__updateChildQueries(!0),e.__updateHostBindings()},0),e.__queuedUpdate=null}))},attributeChangedCallback(e,t,s){const n=this,i=s===""?!0:s;i!==t&&(n.__cbAttributeChanged&&n.__cbAttributeChanged(e,n[e],i),e!=="style"&&(n[e]=i),n.__initialized&&n.update())},connectedCallback(){const e=this;e.__cbConnected&&e.__cbConnected();const t=b.get(e.constructor,"eventListeners",[]);setTimeout(()=>{if(!e.__initialized){e.__gatherChildren();for(const[,s]of t)e[s]=e[s].bind(e);e.__initialized=!0}for(const[s,n]of t)e.addEventListener(s,e[n]);e.__doRender(),setTimeout(()=>{e.__updateChildQueries(),e.__updateHostBindings()},0)},0)},disconnectedCallback(){const e=this;e.__cbDisconnected&&e.__cbDisconnected();for(const[t,s]of b.get(e.constructor,"eventListeners",[]))e.removeEventListener(t,e[s]);e.__stopMutObs()}};function O(e){return t=>{b.add(t,e),Object.assign(t.prototype,{__cbAttributeChanged:t.prototype.attributeChangedCallback,__cbConnected:t.prototype.connectedCallback,__cbDisconnected:t.prototype.disconnectedCallback},kt)}}function X(){return(e,t)=>{b.add(e.constructor,{contentProp:t})}}function K(e){return(t,s)=>{Object.defineProperty(t,s,{get(){return Object.defineProperty(this,s,{value:{dispatch:n=>{const i=new CustomEvent(e||s,{detail:n});return this.dispatchEvent(i),i}}}),this[s]},configurable:!0})}}function j(e){return(t,s)=>{const n=b.get(t.constructor,"eventListeners",[]);n.push([e,s]),b.add(t.constructor,{eventListeners:n})}}function p(e){return(t,s)=>{const n=t.constructor,i=s.toLowerCase();if(n.observedAttributes=n.observedAttributes||["classname","className","style"],n.observedAttributes.push(s),n.observedAttributes.push(i),i!==s&&Object.defineProperty(t,s,{get(){return this[i]},set(a){this[i]=a}}),e){const a=Symbol.for(s);Object.defineProperty(t,i,{get(){return this[a]},set(o){let g=o;e===Boolean&&typeof o=="string"&&o.toLowerCase()==="false"?g=!1:g=e(o),this[a]=g}})}}}function Te(e,t,s){return(n,i)=>{const a=b.get(n.constructor,"childQueries",[]);a.push({key:i,selector:e,all:s,refresh:t.refresh}),b.add(n.constructor,{childQueries:a})}}function Q(e,t={}){return Te(e,t)}function Ue(e,t={}){return Te(e,t,!0)}function oe(){return(e,t)=>{const s=Symbol(t);Object.defineProperties(e,{[s]:{writable:!0,enumerable:!1,configurable:!1,value:e[t]},[t]:{get(){return this[s]},set(n){this[s]!==n&&(this[s]=n,this.update())}}})}}exports.MIMEType=void 0;(function(e){e["7Z"]="application/x-7z-compressed",e.AAC="audio/aac",e.ABW="application/x-abiword",e.ARC="application/octet-stream",e.AVI="video/x-msvideo",e.AZW="application/vnd.amazon.ebook",e.BIN="application/octet-stream",e.BMP="image/bmp",e.BZ="application/x-bzip",e.BZ2="application/x-bzip2",e.CSH="application/x-csh",e.CSS="text/css",e.CSV="text/csv,application/vnd.ms-excel",e.DOC="application/msword",e.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",e.EOT="application/vnd.ms-fontobject",e.EPUB="application/epub+zip",e.ES="application/ecmascript",e.FLV="video/x-flv",e.GIF="image/gif",e.GZ="application/x-gzip",e.HTM="text/html",e.HTML="text/html",e.ICO="image/x-icon",e.ICS="text/calendar",e.JAR="application/java-archive",e.JPEG="image/jpeg",e.JPG="image/jpeg",e.JS="application/javascript",e.JSON="application/json",e.M3U="audio/x-mpequrl",e.MID="audio/midi",e.MIDI="audio/midi",e.MOV="video/quicktime",e.MP3="audio/mpeg3",e.MP4="video/mp4",e.MPEG="video/mpeg",e.MPKG="application/vnd.apple.installer+xml",e.ODP="application/vnd.oasis.opendocument.presentation",e.ODS="application/vnd.oasis.opendocument.spreadsheet",e.ODT="application/vnd.oasis.opendocument.text",e.OGA="audio/ogg",e.OGV="video/ogg",e.OGX="application/ogg",e.OTF="font/otf",e.PNG="image/png",e.PDF="application/pdf",e.PPT="application/vnd.ms-powerpoint",e.PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",e.RAR="application/x-rar-compressed",e.RTF="application/rtf",e.SH="application/x-sh",e.SVG="image/svg+xml",e.SWF="application/x-shockwave-flash",e.TAR="application/x-tar",e.TIF="image/tiff",e.TIFF="image/tiff",e.TS="application/typescript",e.TTF="font/ttf",e.TXT="text/plain",e.VSD="application/vnd.visio",e.WAV="audio/wav",e.WEBA="audio/webm",e.WEBM="video/webm",e.WEBP="image/webp",e.WOFF="font/woff",e.WOFF2="font/woff2",e.XHTML="application/xhtml+xml",e.XLS="application/vnd.ms-excel",e.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",e.XML="application/xml",e.XUL="application/vnd.mozilla.xul+xml",e.ZIP="application/zip"})(exports.MIMEType||(exports.MIMEType={}));var Tt=Object.defineProperty,Ut=Object.getOwnPropertyDescriptor,h=(e,t,s,n)=>{for(var i=n>1?void 0:n?Ut(t,s):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,s,i):o(i))||i);return n&&i&&Tt(t,s,i),i};const u="sps-file-upload";exports.SpsFileUploadComponent=class extends HTMLElement{constructor(){super();this.shown=!0,this.files=[],this.acceptMIMETypes=new Set,this.active=!1,this.error=!1,this.namesOfUnsupportedFiles=[],this.handleBrowseLinkClick=this.handleBrowseLinkClick.bind(this),this.handleDownloadButtonClick=this.handleDownloadButtonClick.bind(this),this.handleFileInputChange=this.handleFileInputChange.bind(this),this.dismiss=this.dismiss.bind(this)}get[D](){return[u,this.active&&`${u}--active`,this.error&&`${u}--error`,!this.shown&&`${u}--hidden`,this.mini&&`${u}--mini`,this.constrainContentWidth&&`${u}--constrained-content-width`]}connectedCallback(){this.description=this.description||(this.multiple?"Files":"File"),this.acceptExtensions&&this.processAcceptExtensions(this.acceptExtensions),this.maxSize&&this.parseAndValidateMaxSize(this.maxSize)}attributeChangedCallback(e,t,s){e==="acceptExtensions"&&this.processAcceptExtensions(s),e==="maxSize"&&this.parseAndValidateMaxSize(s)}dismiss(){this.dismissable&&(this.shown=!1,this.update(),this.dismissal.dispatch())}show(){this.dismissable&&(this.shown=!0,this.update())}render({t:e}){const t=this.error?T.SpsIcon.EXCLAMATION_CIRCLE:T.SpsIcon.UPLOAD_CLOUD,s=(this.multiple?e("design-system:fileUpload.instructions_plural"):e("design-system:fileUpload.instructions")).split("|");return r("div",{"data-fragment":!0},r("div",{className:`${u}__content`},this.processing?r("div",{"data-fragment":!0},r("i",{className:"sps-spinner sps-spinner--medium","aria-hidden":"true"}),r("div",{className:`${u}__instructions`},e("design-system:fileUpload.processing"))):r("div",{"data-fragment":!0},r("i",{className:`sps-icon sps-icon-${t} ${u}__icon-primary`,"aria-hidden":"true"}),r("div",{className:`${u}__title`},this.error?r("div",{"data-fragment":!0},e(this.namesOfUnsupportedFiles.length>1?"design-system:fileUpload.cancelled_plural":"design-system:fileUpload.cancelled")):r("div",{"data-fragment":!0},e("design-system:fileUpload.title",{description:this.description}))),this.error?r("div",{className:`${u}__errored-files`},new Set(this.namesOfUnsupportedFiles.map((n,i)=>{const a=Math.floor(n.length/2);return r("div",{className:`${u}__errored-filename`,key:n},r("span",{className:`${u}__errored-filename-segment`},n.substr(0,a)),r("div",{className:`${u}__errored-filename-segment`},r("span",null,n.substr(a))),i<this.namesOfUnsupportedFiles.length-1?",":"")}))):r("span",null),r("div",{className:`${u}__instructions`},r("div",{"data-fragment":!0},r("span",null,s[0]),r("a",{href:"",onClick:this.handleBrowseLinkClick},s[1]),r("span",null,s[2]))),r("div",{className:`${u}__requirements`},this.acceptExtensions?r("span",null,"("," ",e("design-system:fileUpload.acceptedTypes",{fileTypes:this.acceptExtensionsDescription})," ",")"):"",this.maxSize?r("span",null,"("," ",e("design-system:fileUpload.maximumSize",{size:this.maxSize})," ",")"):"",this.customRequirement?r("span",null," ",this.customRequirement," "):""),this.downloadLabel&&r("div",{className:`sps-button sps-button--link ${u}__download-button`,onClick:this.handleDownloadButtonClick},r("button",{type:"button"},r("i",{className:"sps-icon sps-icon-download-cloud","aria-hidden":"true"})," ",this.downloadLabel)))),this.dismissable&&!this.processing&&r("div",{className:`sps-button sps-button--icon ${u}__close-button`,onClick:this.dismiss},r("button",{type:"button",title:e("design-system:fileUpload.close")},r("i",{className:"sps-icon sps-icon-x","aria-hidden":"true"}))),r("form",null,r("input",{type:"file",accept:this.accept||"*/*",multiple:this.multiple||null,onChange:this.handleFileInputChange})))}parseAndValidateMaxSize(e){try{this.maxSizeBytes=l.parseFileSize(e)}catch{throw new Error(`Could not parse "${e}" as a file size.`)}}processAcceptExtensions(e){const s=(Array.isArray(e)?e:e.trim().split(/\s?,\s?/)).map(i=>i.replace(/^\./,"")),n=s.map(i=>`.${i}`.toLowerCase());this.acceptExtensionsDescription=n.map((i,a)=>a>0&&a===n.length-1?`or ${i}`:i).join(n.length>2?", ":" "),this.acceptMIMETypes.clear();for(const i of s)for(const a of exports.MIMEType[i.toUpperCase()].split(","))this.acceptMIMETypes.add(a);this.accept=n.concat(Array.from(this.acceptMIMETypes)).join(",")}selectFiles(e){this.namesOfUnsupportedFiles=[];const t=Array.from(e);for(const s of t)this.acceptExtensions&&!this.acceptMIMETypes.has(s.type)&&this.namesOfUnsupportedFiles.push(s.name),this.maxSize&&s.size>this.maxSizeBytes&&this.namesOfUnsupportedFiles.push(s.name);this.namesOfUnsupportedFiles.length?(this.error=!0,this.fileInput.value=null,this.update()):(this.files=t,this.selection.dispatch(t))}handleDragOver(e){e.preventDefault(),e.stopPropagation()}handleDragEnter(e){e.preventDefault(),this.active=!0,this.error=!1,this.update()}handleDragLeave(e){e.preventDefault(),this.active=!1,this.update()}handleDrop(e){e.preventDefault(),e.stopPropagation(),this.active=!1,e.dataTransfer.items?this.selectFiles(Array.from(e.dataTransfer.items).map(t=>t.getAsFile())):this.selectFiles(e.dataTransfer.files),this.update()}handleBrowseLinkClick(e){e.preventDefault(),this.error=!1,this.update(),this.fileInput.click()}handleDownloadButtonClick(){this.download.dispatch()}handleFileInputChange(e){e.stopPropagation(),this.selectFiles(e.target.files)}};exports.SpsFileUploadComponent.displayName=u;exports.SpsFileUploadComponent.props={description:"string",multiple:"boolean",dismissable:"boolean",processing:"boolean",mini:"boolean",downloadLabel:"string",acceptExtensions:"Array<string> | string",maxSize:"string",customRequirement:"string",selection:{event:!0,type:"CustomEvent<Array<File>>"},dismissal:{event:!0,type:"CustomEvent<void>"},download:{event:!0,type:"CustomEvent<void>"}};h([p()],exports.SpsFileUploadComponent.prototype,"description",2);h([p(Boolean)],exports.SpsFileUploadComponent.prototype,"multiple",2);h([p(Boolean)],exports.SpsFileUploadComponent.prototype,"shown",2);h([p(Boolean)],exports.SpsFileUploadComponent.prototype,"dismissable",2);h([p(Boolean)],exports.SpsFileUploadComponent.prototype,"processing",2);h([p(Boolean)],exports.SpsFileUploadComponent.prototype,"mini",2);h([p(Boolean)],exports.SpsFileUploadComponent.prototype,"constrainContentWidth",2);h([p()],exports.SpsFileUploadComponent.prototype,"downloadLabel",2);h([p()],exports.SpsFileUploadComponent.prototype,"acceptExtensions",2);h([p()],exports.SpsFileUploadComponent.prototype,"maxSize",2);h([p()],exports.SpsFileUploadComponent.prototype,"customRequirement",2);h([K()],exports.SpsFileUploadComponent.prototype,"selection",2);h([K()],exports.SpsFileUploadComponent.prototype,"dismissal",2);h([K()],exports.SpsFileUploadComponent.prototype,"download",2);h([Q("input[type='file']")],exports.SpsFileUploadComponent.prototype,"fileInput",2);h([j("dragover")],exports.SpsFileUploadComponent.prototype,"handleDragOver",1);h([j("dragenter")],exports.SpsFileUploadComponent.prototype,"handleDragEnter",1);h([j("dragleave")],exports.SpsFileUploadComponent.prototype,"handleDragLeave",1);h([j("drop")],exports.SpsFileUploadComponent.prototype,"handleDrop",1);exports.SpsFileUploadComponent=h([O({tag:u})],exports.SpsFileUploadComponent);const Ee={basic:{label:"Basic File Upload",description:l.code`
|
|
182
|
+
<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;
|