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