@spothero/ui 14.3.1 → 14.3.2

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/CHANGELOG.tmp +2 -2
  3. package/package.json +2 -2
  4. package/styles/v2/components/index.js +1 -1
  5. package/v1/{index-bundled-cjs/index.js → index-bundled.cjs.js} +1 -1
  6. package/v1/index-bundled.cjs.js.map +1 -0
  7. package/v1/{index-bundled-esm/index.js → index-bundled.esm.js} +1 -1
  8. package/v1/index-bundled.esm.js.map +1 -0
  9. package/v1/{index-unbundled-cjs/index.js → index-unbundled.cjs.js} +1 -1
  10. package/v1/index-unbundled.cjs.js.map +1 -0
  11. package/v1/{index-unbundled-esm/index.js → index-unbundled.esm.js} +1 -1
  12. package/v1/index-unbundled.esm.js.map +1 -0
  13. package/v1/index.js +2 -2
  14. package/v2/{index-bundled-cjs/index-b41e1da9.js → index-bundled.cjs.js} +4 -4
  15. package/v2/index-bundled.cjs.js.map +1 -0
  16. package/v2/{index-bundled-esm/index-22452751.js → index-bundled.esm.js} +4 -4
  17. package/v2/index-bundled.esm.js.map +1 -0
  18. package/v2/{index-unbundled-cjs/index-c8c6025d.js → index-unbundled.cjs.js} +3594 -952
  19. package/v2/index-unbundled.cjs.js.map +1 -0
  20. package/v2/{index-unbundled-esm/index-403d8033.js → index-unbundled.esm.js} +3579 -887
  21. package/v2/index-unbundled.esm.js.map +1 -0
  22. package/v2/index.js +2 -2
  23. package/v1/index-bundled-cjs/index.js.map +0 -1
  24. package/v1/index-bundled-esm/index.js.map +0 -1
  25. package/v1/index-unbundled-cjs/index.js.map +0 -1
  26. package/v1/index-unbundled-esm/index.js.map +0 -1
  27. package/v2/index-bundled-cjs/ImageCarousel-217e7062.js +0 -2
  28. package/v2/index-bundled-cjs/ImageCarousel-217e7062.js.map +0 -1
  29. package/v2/index-bundled-cjs/index-b41e1da9.js.map +0 -1
  30. package/v2/index-bundled-cjs/index.js +0 -2
  31. package/v2/index-bundled-cjs/index.js.map +0 -1
  32. package/v2/index-bundled-esm/ImageCarousel-4127414d.js +0 -2
  33. package/v2/index-bundled-esm/ImageCarousel-4127414d.js.map +0 -1
  34. package/v2/index-bundled-esm/index-22452751.js.map +0 -1
  35. package/v2/index-bundled-esm/index.js +0 -2
  36. package/v2/index-bundled-esm/index.js.map +0 -1
  37. package/v2/index-unbundled-cjs/ImageCarousel-0575526b.js +0 -2729
  38. package/v2/index-unbundled-cjs/ImageCarousel-0575526b.js.map +0 -1
  39. package/v2/index-unbundled-cjs/index-c8c6025d.js.map +0 -1
  40. package/v2/index-unbundled-cjs/index.js +0 -72
  41. package/v2/index-unbundled-cjs/index.js.map +0 -1
  42. package/v2/index-unbundled-esm/ImageCarousel-c8a3e563.js +0 -2722
  43. package/v2/index-unbundled-esm/ImageCarousel-c8a3e563.js.map +0 -1
  44. package/v2/index-unbundled-esm/index-403d8033.js.map +0 -1
  45. package/v2/index-unbundled-esm/index.js +0 -7
  46. package/v2/index-unbundled-esm/index.js.map +0 -1
@@ -1,2729 +0,0 @@
1
- 'use strict';
2
-
3
- var index = require('./index-c8c6025d.js');
4
- var React = require('react');
5
- var PropTypes = require('prop-types');
6
- require('lodash/merge');
7
- require('lodash/template');
8
- require('react-dom');
9
-
10
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
-
12
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
13
- var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
14
-
15
- // `Array.isArray` method
16
- // https://tc39.es/ecma262/#sec-array.isarray
17
- index._export({ target: 'Array', stat: true }, {
18
- isArray: index.isArray
19
- });
20
-
21
- var isArray$4 = index.path.Array.isArray;
22
-
23
- var isArray$3 = isArray$4;
24
-
25
- var isArray$2 = isArray$3;
26
-
27
- var isArray$1 = isArray$2;
28
-
29
- var isArray = isArray$1;
30
-
31
- function _arrayWithHoles(arr) {
32
- if (isArray(arr)) return arr;
33
- }
34
-
35
- // `Symbol.asyncIterator` well-known symbol
36
- // https://tc39.es/ecma262/#sec-symbol.asynciterator
37
- index.defineWellKnownSymbol('asyncIterator');
38
-
39
- // `Symbol.hasInstance` well-known symbol
40
- // https://tc39.es/ecma262/#sec-symbol.hasinstance
41
- index.defineWellKnownSymbol('hasInstance');
42
-
43
- // `Symbol.isConcatSpreadable` well-known symbol
44
- // https://tc39.es/ecma262/#sec-symbol.isconcatspreadable
45
- index.defineWellKnownSymbol('isConcatSpreadable');
46
-
47
- // `Symbol.iterator` well-known symbol
48
- // https://tc39.es/ecma262/#sec-symbol.iterator
49
- index.defineWellKnownSymbol('iterator');
50
-
51
- // `Symbol.match` well-known symbol
52
- // https://tc39.es/ecma262/#sec-symbol.match
53
- index.defineWellKnownSymbol('match');
54
-
55
- // `Symbol.matchAll` well-known symbol
56
- // https://tc39.es/ecma262/#sec-symbol.matchall
57
- index.defineWellKnownSymbol('matchAll');
58
-
59
- // `Symbol.replace` well-known symbol
60
- // https://tc39.es/ecma262/#sec-symbol.replace
61
- index.defineWellKnownSymbol('replace');
62
-
63
- // `Symbol.search` well-known symbol
64
- // https://tc39.es/ecma262/#sec-symbol.search
65
- index.defineWellKnownSymbol('search');
66
-
67
- // `Symbol.species` well-known symbol
68
- // https://tc39.es/ecma262/#sec-symbol.species
69
- index.defineWellKnownSymbol('species');
70
-
71
- // `Symbol.split` well-known symbol
72
- // https://tc39.es/ecma262/#sec-symbol.split
73
- index.defineWellKnownSymbol('split');
74
-
75
- // `Symbol.toPrimitive` well-known symbol
76
- // https://tc39.es/ecma262/#sec-symbol.toprimitive
77
- index.defineWellKnownSymbol('toPrimitive');
78
-
79
- // `Symbol.toStringTag` well-known symbol
80
- // https://tc39.es/ecma262/#sec-symbol.tostringtag
81
- index.defineWellKnownSymbol('toStringTag');
82
-
83
- // `Symbol.unscopables` well-known symbol
84
- // https://tc39.es/ecma262/#sec-symbol.unscopables
85
- index.defineWellKnownSymbol('unscopables');
86
-
87
- // JSON[@@toStringTag] property
88
- // https://tc39.es/ecma262/#sec-json-@@tostringtag
89
- index.setToStringTag(index.global_1.JSON, 'JSON', true);
90
-
91
- var symbol$4 = index.path.Symbol;
92
-
93
- var symbol$3 = symbol$4;
94
-
95
- var symbol$2 = symbol$3;
96
-
97
- // `Symbol.asyncDispose` well-known symbol
98
- // https://github.com/tc39/proposal-using-statement
99
- index.defineWellKnownSymbol('asyncDispose');
100
-
101
- // `Symbol.dispose` well-known symbol
102
- // https://github.com/tc39/proposal-using-statement
103
- index.defineWellKnownSymbol('dispose');
104
-
105
- // `Symbol.matcher` well-known symbol
106
- // https://github.com/tc39/proposal-pattern-matching
107
- index.defineWellKnownSymbol('matcher');
108
-
109
- // `Symbol.metadata` well-known symbol
110
- // https://github.com/tc39/proposal-decorators
111
- index.defineWellKnownSymbol('metadata');
112
-
113
- // `Symbol.observable` well-known symbol
114
- // https://github.com/tc39/proposal-observable
115
- index.defineWellKnownSymbol('observable');
116
-
117
- // TODO: remove from `core-js@4`
118
-
119
-
120
- // `Symbol.patternMatch` well-known symbol
121
- // https://github.com/tc39/proposal-pattern-matching
122
- index.defineWellKnownSymbol('patternMatch');
123
-
124
- // TODO: remove from `core-js@4`
125
-
126
-
127
- index.defineWellKnownSymbol('replaceAll');
128
-
129
- // TODO: Remove from `core-js@4`
130
-
131
- // TODO: Remove from `core-js@4`
132
-
133
-
134
- var symbol$1 = symbol$2;
135
-
136
- var symbol = symbol$1;
137
-
138
- var charAt$1 = index.functionUncurryThis(''.charAt);
139
- var charCodeAt = index.functionUncurryThis(''.charCodeAt);
140
- var stringSlice = index.functionUncurryThis(''.slice);
141
-
142
- var createMethod = function (CONVERT_TO_STRING) {
143
- return function ($this, pos) {
144
- var S = index.toString_1(index.requireObjectCoercible($this));
145
- var position = index.toIntegerOrInfinity(pos);
146
- var size = S.length;
147
- var first, second;
148
- if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
149
- first = charCodeAt(S, position);
150
- return first < 0xD800 || first > 0xDBFF || position + 1 === size
151
- || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
152
- ? CONVERT_TO_STRING
153
- ? charAt$1(S, position)
154
- : first
155
- : CONVERT_TO_STRING
156
- ? stringSlice(S, position, position + 2)
157
- : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
158
- };
159
- };
160
-
161
- var stringMultibyte = {
162
- // `String.prototype.codePointAt` method
163
- // https://tc39.es/ecma262/#sec-string.prototype.codepointat
164
- codeAt: createMethod(false),
165
- // `String.prototype.at` method
166
- // https://github.com/mathiasbynens/String.prototype.at
167
- charAt: createMethod(true)
168
- };
169
-
170
- var charAt = stringMultibyte.charAt;
171
-
172
-
173
-
174
-
175
- var STRING_ITERATOR = 'String Iterator';
176
- var setInternalState$2 = index.internalState.set;
177
- var getInternalState = index.internalState.getterFor(STRING_ITERATOR);
178
-
179
- // `String.prototype[@@iterator]` method
180
- // https://tc39.es/ecma262/#sec-string.prototype-@@iterator
181
- index.defineIterator(String, 'String', function (iterated) {
182
- setInternalState$2(this, {
183
- type: STRING_ITERATOR,
184
- string: index.toString_1(iterated),
185
- index: 0
186
- });
187
- // `%StringIteratorPrototype%.next` method
188
- // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
189
- }, function next() {
190
- var state = getInternalState(this);
191
- var string = state.string;
192
- var index = state.index;
193
- var point;
194
- if (index >= string.length) return { value: undefined, done: true };
195
- point = charAt(string, index);
196
- state.index += point.length;
197
- return { value: point, done: false };
198
- });
199
-
200
- var ITERATOR$2 = index.wellKnownSymbol('iterator');
201
-
202
- var getIteratorMethod$4 = function (it) {
203
- if (it != undefined) return index.getMethod(it, ITERATOR$2)
204
- || index.getMethod(it, '@@iterator')
205
- || index.iterators[index.classof(it)];
206
- };
207
-
208
- var getIteratorMethod_1 = getIteratorMethod$4;
209
-
210
- var getIteratorMethod$3 = getIteratorMethod_1;
211
-
212
- var getIteratorMethod$2 = getIteratorMethod$3;
213
-
214
- var getIteratorMethod$1 = getIteratorMethod$2;
215
-
216
- var getIteratorMethod = getIteratorMethod$1;
217
-
218
- function _iterableToArrayLimit(arr, i) {
219
- var _i = arr == null ? null : typeof symbol !== "undefined" && getIteratorMethod(arr) || arr["@@iterator"];
220
-
221
- if (_i == null) return;
222
- var _arr = [];
223
- var _n = true;
224
- var _d = false;
225
-
226
- var _s, _e;
227
-
228
- try {
229
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
230
- _arr.push(_s.value);
231
-
232
- if (i && _arr.length === i) break;
233
- }
234
- } catch (err) {
235
- _d = true;
236
- _e = err;
237
- } finally {
238
- try {
239
- if (!_n && _i["return"] != null) _i["return"]();
240
- } finally {
241
- if (_d) throw _e;
242
- }
243
- }
244
-
245
- return _arr;
246
- }
247
-
248
- var HAS_SPECIES_SUPPORT = index.arrayMethodHasSpeciesSupport('slice');
249
-
250
- var SPECIES = index.wellKnownSymbol('species');
251
- var Array$2 = index.global_1.Array;
252
- var max = Math.max;
253
-
254
- // `Array.prototype.slice` method
255
- // https://tc39.es/ecma262/#sec-array.prototype.slice
256
- // fallback for not array-like ES3 strings and DOM objects
257
- index._export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
258
- slice: function slice(start, end) {
259
- var O = index.toIndexedObject(this);
260
- var length = index.lengthOfArrayLike(O);
261
- var k = index.toAbsoluteIndex(start, length);
262
- var fin = index.toAbsoluteIndex(end === undefined ? length : end, length);
263
- // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
264
- var Constructor, result, n;
265
- if (index.isArray(O)) {
266
- Constructor = O.constructor;
267
- // cross-realm fallback
268
- if (index.isConstructor(Constructor) && (Constructor === Array$2 || index.isArray(Constructor.prototype))) {
269
- Constructor = undefined;
270
- } else if (index.isObject(Constructor)) {
271
- Constructor = Constructor[SPECIES];
272
- if (Constructor === null) Constructor = undefined;
273
- }
274
- if (Constructor === Array$2 || Constructor === undefined) {
275
- return index.arraySlice(O, k, fin);
276
- }
277
- }
278
- result = new (Constructor === undefined ? Array$2 : Constructor)(max(fin - k, 0));
279
- for (n = 0; k < fin; k++, n++) if (k in O) index.createProperty(result, n, O[k]);
280
- result.length = n;
281
- return result;
282
- }
283
- });
284
-
285
- var slice$5 = index.entryVirtual('Array').slice;
286
-
287
- var ArrayPrototype$1 = Array.prototype;
288
-
289
- var slice$4 = function (it) {
290
- var own = it.slice;
291
- return it === ArrayPrototype$1 || (index.objectIsPrototypeOf(ArrayPrototype$1, it) && own === ArrayPrototype$1.slice) ? slice$5 : own;
292
- };
293
-
294
- var slice$3 = slice$4;
295
-
296
- var slice$2 = slice$3;
297
-
298
- var slice$1 = slice$2;
299
-
300
- var slice = slice$1;
301
-
302
- var iteratorClose = function (iterator, kind, value) {
303
- var innerResult, innerError;
304
- index.anObject(iterator);
305
- try {
306
- innerResult = index.getMethod(iterator, 'return');
307
- if (!innerResult) {
308
- if (kind === 'throw') throw value;
309
- return value;
310
- }
311
- innerResult = index.functionCall(innerResult, iterator);
312
- } catch (error) {
313
- innerError = true;
314
- innerResult = error;
315
- }
316
- if (kind === 'throw') throw value;
317
- if (innerError) throw innerResult;
318
- index.anObject(innerResult);
319
- return value;
320
- };
321
-
322
- // call something on iterator step with safe closing on error
323
- var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {
324
- try {
325
- return ENTRIES ? fn(index.anObject(value)[0], value[1]) : fn(value);
326
- } catch (error) {
327
- iteratorClose(iterator, 'throw', error);
328
- }
329
- };
330
-
331
- var ITERATOR$1 = index.wellKnownSymbol('iterator');
332
- var ArrayPrototype = Array.prototype;
333
-
334
- // check on default Array iterator
335
- var isArrayIteratorMethod = function (it) {
336
- return it !== undefined && (index.iterators.Array === it || ArrayPrototype[ITERATOR$1] === it);
337
- };
338
-
339
- var TypeError$3 = index.global_1.TypeError;
340
-
341
- var getIterator = function (argument, usingIterator) {
342
- var iteratorMethod = arguments.length < 2 ? getIteratorMethod$4(argument) : usingIterator;
343
- if (index.aCallable(iteratorMethod)) return index.anObject(index.functionCall(iteratorMethod, argument));
344
- throw TypeError$3(index.tryToString(argument) + ' is not iterable');
345
- };
346
-
347
- var Array$1 = index.global_1.Array;
348
-
349
- // `Array.from` method implementation
350
- // https://tc39.es/ecma262/#sec-array.from
351
- var arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
352
- var O = index.toObject(arrayLike);
353
- var IS_CONSTRUCTOR = index.isConstructor(this);
354
- var argumentsLength = arguments.length;
355
- var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
356
- var mapping = mapfn !== undefined;
357
- if (mapping) mapfn = index.functionBindContext(mapfn, argumentsLength > 2 ? arguments[2] : undefined);
358
- var iteratorMethod = getIteratorMethod$4(O);
359
- var index$1 = 0;
360
- var length, result, step, iterator, next, value;
361
- // if the target is not iterable or it's an array with the default iterator - use a simple case
362
- if (iteratorMethod && !(this == Array$1 && isArrayIteratorMethod(iteratorMethod))) {
363
- iterator = getIterator(O, iteratorMethod);
364
- next = iterator.next;
365
- result = IS_CONSTRUCTOR ? new this() : [];
366
- for (;!(step = index.functionCall(next, iterator)).done; index$1++) {
367
- value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index$1], true) : step.value;
368
- index.createProperty(result, index$1, value);
369
- }
370
- } else {
371
- length = index.lengthOfArrayLike(O);
372
- result = IS_CONSTRUCTOR ? new this(length) : Array$1(length);
373
- for (;length > index$1; index$1++) {
374
- value = mapping ? mapfn(O[index$1], index$1) : O[index$1];
375
- index.createProperty(result, index$1, value);
376
- }
377
- }
378
- result.length = index$1;
379
- return result;
380
- };
381
-
382
- var ITERATOR = index.wellKnownSymbol('iterator');
383
- var SAFE_CLOSING = false;
384
-
385
- try {
386
- var called = 0;
387
- var iteratorWithReturn = {
388
- next: function () {
389
- return { done: !!called++ };
390
- },
391
- 'return': function () {
392
- SAFE_CLOSING = true;
393
- }
394
- };
395
- iteratorWithReturn[ITERATOR] = function () {
396
- return this;
397
- };
398
- // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
399
- Array.from(iteratorWithReturn, function () { throw 2; });
400
- } catch (error) { /* empty */ }
401
-
402
- var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
403
- if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
404
- var ITERATION_SUPPORT = false;
405
- try {
406
- var object = {};
407
- object[ITERATOR] = function () {
408
- return {
409
- next: function () {
410
- return { done: ITERATION_SUPPORT = true };
411
- }
412
- };
413
- };
414
- exec(object);
415
- } catch (error) { /* empty */ }
416
- return ITERATION_SUPPORT;
417
- };
418
-
419
- var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
420
- // eslint-disable-next-line es/no-array-from -- required for testing
421
- Array.from(iterable);
422
- });
423
-
424
- // `Array.from` method
425
- // https://tc39.es/ecma262/#sec-array.from
426
- index._export({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
427
- from: arrayFrom
428
- });
429
-
430
- var from_1$4 = index.path.Array.from;
431
-
432
- var from_1$3 = from_1$4;
433
-
434
- var from_1$2 = from_1$3;
435
-
436
- var from_1$1 = from_1$2;
437
-
438
- var from_1 = from_1$1;
439
-
440
- function _arrayLikeToArray(arr, len) {
441
- if (len == null || len > arr.length) len = arr.length;
442
-
443
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
444
- arr2[i] = arr[i];
445
- }
446
-
447
- return arr2;
448
- }
449
-
450
- function _unsupportedIterableToArray(o, minLen) {
451
- var _context;
452
-
453
- if (!o) return;
454
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
455
-
456
- var n = slice(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);
457
-
458
- if (n === "Object" && o.constructor) n = o.constructor.name;
459
- if (n === "Map" || n === "Set") return from_1(o);
460
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
461
- }
462
-
463
- function _nonIterableRest() {
464
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
465
- }
466
-
467
- function _slicedToArray(arr, i) {
468
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
469
- }
470
-
471
- function canUseDOM() {
472
- return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
473
- }
474
- function areEqualShallow(objectA, objectB) {
475
- return Object.keys(objectA).length === Object.keys(objectB).length && Object.keys(objectA).every(function (objectKey) {
476
- if (!Object.prototype.hasOwnProperty.call(objectB, objectKey)) {
477
- return false;
478
- }
479
-
480
- return objectA[objectKey] === objectB[objectKey];
481
- });
482
- }
483
-
484
- function _extends() {
485
- _extends = Object.assign || function (target) {
486
- for (var i = 1; i < arguments.length; i++) {
487
- var source = arguments[i];
488
-
489
- for (var key in source) {
490
- if (Object.prototype.hasOwnProperty.call(source, key)) {
491
- target[key] = source[key];
492
- }
493
- }
494
- }
495
-
496
- return target;
497
- };
498
-
499
- return _extends.apply(this, arguments);
500
- }
501
-
502
- function Alignment(align, viewSize) {
503
- var predefined = {
504
- start: start,
505
- center: center,
506
- end: end
507
- };
508
-
509
- function start() {
510
- return 0;
511
- }
512
-
513
- function center(n) {
514
- return end(n) / 2;
515
- }
516
-
517
- function end(n) {
518
- return viewSize - n;
519
- }
520
-
521
- function percent() {
522
- return viewSize * Number(align);
523
- }
524
-
525
- function measure(n) {
526
- if (typeof align === 'number') return percent();
527
- return predefined[align](n);
528
- }
529
-
530
- var self = {
531
- measure: measure
532
- };
533
- return self;
534
- }
535
-
536
- function Animation(callback) {
537
- var animationFrame = 0;
538
-
539
- function ifAnimating(active, cb) {
540
- return function () {
541
- if (active === !!animationFrame) cb();
542
- };
543
- }
544
-
545
- function start() {
546
- animationFrame = window.requestAnimationFrame(callback);
547
- }
548
-
549
- function stop() {
550
- window.cancelAnimationFrame(animationFrame);
551
- animationFrame = 0;
552
- }
553
-
554
- var self = {
555
- proceed: ifAnimating(true, start),
556
- start: ifAnimating(false, start),
557
- stop: ifAnimating(true, stop)
558
- };
559
- return self;
560
- }
561
-
562
- function Axis(axis, contentDirection) {
563
- var scroll = axis === 'y' ? 'y' : 'x';
564
- var cross = axis === 'y' ? 'x' : 'y';
565
- var startEdge = getStartEdge();
566
- var endEdge = getEndEdge();
567
-
568
- function measureSize(rect) {
569
- var width = rect.width,
570
- height = rect.height;
571
- return scroll === 'x' ? width : height;
572
- }
573
-
574
- function getStartEdge() {
575
- if (scroll === 'y') return 'top';
576
- return contentDirection === 'rtl' ? 'right' : 'left';
577
- }
578
-
579
- function getEndEdge() {
580
- if (scroll === 'y') return 'bottom';
581
- return contentDirection === 'rtl' ? 'left' : 'right';
582
- }
583
-
584
- var self = {
585
- scroll: scroll,
586
- cross: cross,
587
- startEdge: startEdge,
588
- endEdge: endEdge,
589
- measureSize: measureSize
590
- };
591
- return self;
592
- }
593
-
594
- function Limit(min, max) {
595
- var length = Math.abs(min - max);
596
-
597
- function reachedMin(n) {
598
- return n < min;
599
- }
600
-
601
- function reachedMax(n) {
602
- return n > max;
603
- }
604
-
605
- function reachedAny(n) {
606
- return reachedMin(n) || reachedMax(n);
607
- }
608
-
609
- function constrain(n) {
610
- if (!reachedAny(n)) return n;
611
- return reachedMin(n) ? min : max;
612
- }
613
-
614
- function removeOffset(n) {
615
- if (!length) return n;
616
- return n - length * Math.ceil((n - max) / length);
617
- }
618
-
619
- var self = {
620
- constrain: constrain,
621
- length: length,
622
- max: max,
623
- min: min,
624
- reachedAny: reachedAny,
625
- reachedMax: reachedMax,
626
- reachedMin: reachedMin,
627
- removeOffset: removeOffset
628
- };
629
- return self;
630
- }
631
-
632
- function Counter(max, start, loop) {
633
- var _a = Limit(0, max),
634
- min = _a.min,
635
- constrain = _a.constrain;
636
-
637
- var loopEnd = max + 1;
638
- var counter = withinLimit(start);
639
-
640
- function withinLimit(n) {
641
- return !loop ? constrain(n) : Math.abs((loopEnd + n) % loopEnd);
642
- }
643
-
644
- function get() {
645
- return counter;
646
- }
647
-
648
- function set(n) {
649
- counter = withinLimit(n);
650
- return self;
651
- }
652
-
653
- function add(n) {
654
- return set(get() + n);
655
- }
656
-
657
- function clone() {
658
- return Counter(max, get(), loop);
659
- }
660
-
661
- var self = {
662
- add: add,
663
- clone: clone,
664
- get: get,
665
- set: set,
666
- min: min,
667
- max: max
668
- };
669
- return self;
670
- }
671
-
672
- function Direction(direction) {
673
- var sign = direction === 'rtl' ? -1 : 1;
674
-
675
- function applyTo(n) {
676
- return n * sign;
677
- }
678
-
679
- var self = {
680
- applyTo: applyTo
681
- };
682
- return self;
683
- }
684
-
685
- function EventStore() {
686
- var listeners = [];
687
-
688
- function add(node, type, handler, options) {
689
- if (options === void 0) {
690
- options = false;
691
- }
692
-
693
- node.addEventListener(type, handler, options);
694
- listeners.push(function () {
695
- return node.removeEventListener(type, handler, options);
696
- });
697
- return self;
698
- }
699
-
700
- function removeAll() {
701
- listeners = listeners.filter(function (remove) {
702
- return remove();
703
- });
704
- return self;
705
- }
706
-
707
- var self = {
708
- add: add,
709
- removeAll: removeAll
710
- };
711
- return self;
712
- }
713
-
714
- function Vector1D(value) {
715
- var vector = value;
716
-
717
- function get() {
718
- return vector;
719
- }
720
-
721
- function set(n) {
722
- vector = readNumber(n);
723
- return self;
724
- }
725
-
726
- function add(n) {
727
- vector += readNumber(n);
728
- return self;
729
- }
730
-
731
- function subtract(n) {
732
- vector -= readNumber(n);
733
- return self;
734
- }
735
-
736
- function multiply(n) {
737
- vector *= n;
738
- return self;
739
- }
740
-
741
- function divide(n) {
742
- vector /= n;
743
- return self;
744
- }
745
-
746
- function normalize() {
747
- if (vector !== 0) divide(vector);
748
- return self;
749
- }
750
-
751
- function readNumber(n) {
752
- return typeof n === 'number' ? n : n.get();
753
- }
754
-
755
- var self = {
756
- add: add,
757
- divide: divide,
758
- get: get,
759
- multiply: multiply,
760
- normalize: normalize,
761
- set: set,
762
- subtract: subtract
763
- };
764
- return self;
765
- }
766
-
767
- function map(value, iStart, iStop, oStart, oStop) {
768
- return oStart + (oStop - oStart) * ((value - iStart) / (iStop - iStart));
769
- }
770
-
771
- function mathSign(n) {
772
- return !n ? 0 : n / Math.abs(n);
773
- }
774
-
775
- function deltaAbs(valueB, valueA) {
776
- return Math.abs(valueB - valueA);
777
- }
778
-
779
- function factorAbs(valueB, valueA) {
780
- if (valueB === 0 || valueA === 0) return 0;
781
- if (Math.abs(valueB) <= Math.abs(valueA)) return 0;
782
- var diff = deltaAbs(Math.abs(valueB), Math.abs(valueA));
783
- return Math.abs(diff / valueB);
784
- }
785
-
786
- function roundToDecimals(decimalPoints) {
787
- var pow = Math.pow(10, decimalPoints);
788
- return function (n) {
789
- return Math.round(n * pow) / pow;
790
- };
791
- }
792
-
793
- function debounce(callback, time) {
794
- var timeout = 0;
795
- return function () {
796
- window.clearTimeout(timeout);
797
- timeout = window.setTimeout(callback, time) || 0;
798
- };
799
- }
800
-
801
- function groupArray(array, size) {
802
- var groups = [];
803
-
804
- for (var i = 0; i < array.length; i += size) {
805
- groups.push(array.slice(i, i + size));
806
- }
807
-
808
- return groups;
809
- }
810
-
811
- function arrayKeys(array) {
812
- return Object.keys(array).map(Number);
813
- }
814
-
815
- function arrayLast(array) {
816
- return array[lastIndex(array)];
817
- }
818
-
819
- function lastIndex(array) {
820
- return Math.max(0, array.length - 1);
821
- }
822
-
823
- function removeClass(node, className) {
824
- var cl = node.classList;
825
- if (className && cl.contains(className)) cl.remove(className);
826
- }
827
-
828
- function addClass(node, className) {
829
- var cl = node.classList;
830
- if (className && !cl.contains(className)) cl.add(className);
831
- }
832
-
833
- function DragHandler(axis, direction, rootNode, target, dragFree, dragTracker, location, animation, scrollTo, scrollBody, scrollTarget, index, events, loop, skipSnaps) {
834
- var scrollAxis = axis.scroll,
835
- crossAxis = axis.cross;
836
- var focusNodes = ['INPUT', 'SELECT', 'TEXTAREA'];
837
- var startScroll = Vector1D(0);
838
- var startCross = Vector1D(0);
839
- var dragStartPoint = Vector1D(0);
840
- var activationEvents = EventStore();
841
- var interactionEvents = EventStore();
842
- var snapForceBoost = {
843
- mouse: 2.5,
844
- touch: 3.5
845
- };
846
- var freeForceBoost = {
847
- mouse: 5,
848
- touch: 7
849
- };
850
- var baseSpeed = dragFree ? 5 : 16;
851
- var baseMass = 1;
852
- var dragThreshold = 20;
853
- var pointerIsDown = false;
854
- var preventScroll = false;
855
- var preventClick = false;
856
- var isMouse = false;
857
-
858
- function addActivationEvents() {
859
- var node = rootNode;
860
- activationEvents.add(node, 'touchmove', function () {
861
- return undefined;
862
- }).add(node, 'touchend', function () {
863
- return undefined;
864
- }).add(node, 'touchstart', down).add(node, 'mousedown', down).add(node, 'touchcancel', up).add(node, 'contextmenu', up).add(node, 'click', click);
865
- }
866
-
867
- function addInteractionEvents() {
868
- var node = !isMouse ? rootNode : document;
869
- interactionEvents.add(node, 'touchmove', move).add(node, 'touchend', up).add(node, 'mousemove', move).add(node, 'mouseup', up);
870
- }
871
-
872
- function removeAllEvents() {
873
- activationEvents.removeAll();
874
- interactionEvents.removeAll();
875
- }
876
-
877
- function isFocusNode(node) {
878
- var name = node.nodeName || '';
879
- return focusNodes.indexOf(name) > -1;
880
- }
881
-
882
- function forceBoost() {
883
- var boost = dragFree ? freeForceBoost : snapForceBoost;
884
- var type = isMouse ? 'mouse' : 'touch';
885
- return boost[type];
886
- }
887
-
888
- function allowedForce(force, targetChanged) {
889
- var next = index.clone().add(mathSign(force) * -1);
890
- var isEdge = next.get() === index.min || next.get() === index.max;
891
- var baseForce = scrollTarget.byDistance(force, !dragFree).distance;
892
- if (dragFree || Math.abs(force) < dragThreshold) return baseForce;
893
- if (!loop && isEdge) return baseForce * 0.6;
894
- if (skipSnaps && targetChanged) return baseForce * 0.5;
895
- return scrollTarget.byIndex(next.get(), 0).distance;
896
- }
897
-
898
- function down(evt) {
899
- isMouse = evt.type === 'mousedown';
900
- if (isMouse && evt.button !== 0) return;
901
- var isMoving = deltaAbs(target.get(), location.get()) >= 2;
902
- var clearPreventClick = isMouse || !isMoving;
903
- var isNotFocusNode = !isFocusNode(evt.target);
904
- var preventDefault = isMoving || isMouse && isNotFocusNode;
905
- pointerIsDown = true;
906
- dragTracker.pointerDown(evt);
907
- dragStartPoint.set(target);
908
- target.set(location);
909
- scrollBody.useBaseMass().useSpeed(80);
910
- addInteractionEvents();
911
- startScroll.set(dragTracker.readPoint(evt, scrollAxis));
912
- startCross.set(dragTracker.readPoint(evt, crossAxis));
913
- events.emit('pointerDown');
914
- if (clearPreventClick) preventClick = false;
915
- if (preventDefault) evt.preventDefault();
916
- }
917
-
918
- function move(evt) {
919
- if (!preventScroll && !isMouse) {
920
- if (!evt.cancelable) return up();
921
- var moveScroll = dragTracker.readPoint(evt, scrollAxis).get();
922
- var moveCross = dragTracker.readPoint(evt, crossAxis).get();
923
- var diffScroll = deltaAbs(moveScroll, startScroll.get());
924
- var diffCross = deltaAbs(moveCross, startCross.get());
925
- preventScroll = diffScroll > diffCross;
926
- if (!preventScroll && !preventClick) return up();
927
- }
928
-
929
- var diff = dragTracker.pointerMove(evt);
930
- if (!preventClick && diff) preventClick = true;
931
- animation.start();
932
- target.add(direction.applyTo(diff));
933
- evt.preventDefault();
934
- }
935
-
936
- function up() {
937
- var currentLocation = scrollTarget.byDistance(0, false);
938
- var targetChanged = currentLocation.index !== index.get();
939
- var rawForce = dragTracker.pointerUp() * forceBoost();
940
- var force = allowedForce(direction.applyTo(rawForce), targetChanged);
941
- var forceFactor = factorAbs(rawForce, force);
942
- var isMoving = deltaAbs(target.get(), dragStartPoint.get()) >= 0.5;
943
- var isVigorous = targetChanged && forceFactor > 0.75;
944
- var isBelowThreshold = Math.abs(rawForce) < dragThreshold;
945
- var speed = isVigorous ? 10 : baseSpeed;
946
- var mass = isVigorous ? baseMass + 2.5 * forceFactor : baseMass;
947
- if (isMoving && !isMouse) preventClick = true;
948
- preventScroll = false;
949
- pointerIsDown = false;
950
- interactionEvents.removeAll();
951
- scrollBody.useSpeed(isBelowThreshold ? 9 : speed).useMass(mass);
952
- scrollTo.distance(force, !dragFree);
953
- isMouse = false;
954
- events.emit('pointerUp');
955
- }
956
-
957
- function click(evt) {
958
- if (preventClick) evt.preventDefault();
959
- }
960
-
961
- function clickAllowed() {
962
- return !preventClick;
963
- }
964
-
965
- function pointerDown() {
966
- return pointerIsDown;
967
- }
968
-
969
- var self = {
970
- addActivationEvents: addActivationEvents,
971
- clickAllowed: clickAllowed,
972
- pointerDown: pointerDown,
973
- removeAllEvents: removeAllEvents
974
- };
975
- return self;
976
- }
977
-
978
- function DragTracker(axis, pxToPercent) {
979
- var scrollAxis = axis.scroll;
980
- var coords = {
981
- x: 'clientX',
982
- y: 'clientY'
983
- };
984
- var startDrag = Vector1D(0);
985
- var diffDrag = Vector1D(0);
986
- var lastDrag = Vector1D(0);
987
- var pointValue = Vector1D(0);
988
- var trackInterval = 10;
989
- var trackLength = 5;
990
- var trackTime = 100;
991
- var trackPoints = [];
992
- var lastMoveTime = new Date().getTime();
993
- var isMouse = false;
994
-
995
- function readPoint(evt, type) {
996
- isMouse = !evt.touches;
997
- var c = coords[type];
998
- var value = isMouse ? evt[c] : evt.touches[0][c];
999
- return pointValue.set(value);
1000
- }
1001
-
1002
- function pointerDown(evt) {
1003
- var point = readPoint(evt, scrollAxis);
1004
- startDrag.set(point);
1005
- lastDrag.set(point);
1006
- return pxToPercent.measure(startDrag.get());
1007
- }
1008
-
1009
- function pointerMove(evt) {
1010
- var point = readPoint(evt, scrollAxis);
1011
- var nowTime = new Date().getTime();
1012
- var diffTime = nowTime - lastMoveTime;
1013
-
1014
- if (diffTime >= trackInterval) {
1015
- if (diffTime >= trackTime) trackPoints = [];
1016
- trackPoints.push(point.get());
1017
- lastMoveTime = nowTime;
1018
- }
1019
-
1020
- diffDrag.set(point).subtract(lastDrag);
1021
- lastDrag.set(point);
1022
- return pxToPercent.measure(diffDrag.get());
1023
- }
1024
-
1025
- function pointerUp() {
1026
- var nowTime = new Date().getTime();
1027
- var diffTime = nowTime - lastMoveTime;
1028
- var currentPoint = lastDrag.get();
1029
- var force = trackPoints.slice(-trackLength).map(function (trackPoint) {
1030
- return currentPoint - trackPoint;
1031
- }).sort(function (p1, p2) {
1032
- return Math.abs(p1) < Math.abs(p2) ? 1 : -1;
1033
- })[0];
1034
- lastDrag.set(diffTime > trackTime || !force ? 0 : force);
1035
- trackPoints = [];
1036
- return pxToPercent.measure(lastDrag.get());
1037
- }
1038
-
1039
- var self = {
1040
- pointerDown: pointerDown,
1041
- pointerMove: pointerMove,
1042
- pointerUp: pointerUp,
1043
- readPoint: readPoint
1044
- };
1045
- return self;
1046
- }
1047
-
1048
- function PxToPercent(viewInPx) {
1049
- var totalPercent = 100;
1050
-
1051
- function measure(n) {
1052
- if (viewInPx === 0) return 0;
1053
- return n / viewInPx * totalPercent;
1054
- }
1055
-
1056
- var self = {
1057
- measure: measure,
1058
- totalPercent: totalPercent
1059
- };
1060
- return self;
1061
- }
1062
-
1063
- function ScrollBody(location, baseSpeed, baseMass) {
1064
- var roundToTwoDecimals = roundToDecimals(2);
1065
- var velocity = Vector1D(0);
1066
- var acceleration = Vector1D(0);
1067
- var attraction = Vector1D(0);
1068
- var attractionDirection = 0;
1069
- var speed = baseSpeed;
1070
- var mass = baseMass;
1071
-
1072
- function update() {
1073
- velocity.add(acceleration);
1074
- location.add(velocity);
1075
- acceleration.multiply(0);
1076
- }
1077
-
1078
- function applyForce(v) {
1079
- v.divide(mass);
1080
- acceleration.add(v);
1081
- }
1082
-
1083
- function seek(v) {
1084
- attraction.set(v).subtract(location);
1085
- var magnitude = map(attraction.get(), 0, 100, 0, speed);
1086
- attractionDirection = mathSign(attraction.get());
1087
- attraction.normalize().multiply(magnitude).subtract(velocity);
1088
- applyForce(attraction);
1089
- return self;
1090
- }
1091
-
1092
- function settle(v) {
1093
- var diff = v.get() - location.get();
1094
- var hasSettled = !roundToTwoDecimals(diff);
1095
- if (hasSettled) location.set(v);
1096
- return hasSettled;
1097
- }
1098
-
1099
- function direction() {
1100
- return attractionDirection;
1101
- }
1102
-
1103
- function useBaseSpeed() {
1104
- return useSpeed(baseSpeed);
1105
- }
1106
-
1107
- function useBaseMass() {
1108
- return useMass(baseMass);
1109
- }
1110
-
1111
- function useSpeed(n) {
1112
- speed = n;
1113
- return self;
1114
- }
1115
-
1116
- function useMass(n) {
1117
- mass = n;
1118
- return self;
1119
- }
1120
-
1121
- var self = {
1122
- direction: direction,
1123
- seek: seek,
1124
- settle: settle,
1125
- update: update,
1126
- useBaseMass: useBaseMass,
1127
- useBaseSpeed: useBaseSpeed,
1128
- useMass: useMass,
1129
- useSpeed: useSpeed
1130
- };
1131
- return self;
1132
- }
1133
-
1134
- function ScrollBounds(limit, location, target, scrollBody) {
1135
- var pullBackThreshold = 10;
1136
- var disabled = false;
1137
-
1138
- function shouldConstrain() {
1139
- if (disabled) return false;
1140
- if (!limit.reachedAny(target.get())) return false;
1141
- if (!limit.reachedAny(location.get())) return false;
1142
- return true;
1143
- }
1144
-
1145
- function constrain(pointerDown) {
1146
- if (!shouldConstrain()) return;
1147
- var friction = pointerDown ? 0.7 : 0.45;
1148
- var diffToTarget = target.get() - location.get();
1149
- target.subtract(diffToTarget * friction);
1150
-
1151
- if (!pointerDown && Math.abs(diffToTarget) < pullBackThreshold) {
1152
- target.set(limit.constrain(target.get()));
1153
- scrollBody.useSpeed(10).useMass(3);
1154
- }
1155
- }
1156
-
1157
- function toggleActive(active) {
1158
- disabled = !active;
1159
- }
1160
-
1161
- var self = {
1162
- constrain: constrain,
1163
- toggleActive: toggleActive
1164
- };
1165
- return self;
1166
- }
1167
-
1168
- function ScrollContain(viewSize, contentSize, snaps, snapsAligned, containScroll) {
1169
- var scrollBounds = Limit(-contentSize + viewSize, snaps[0]);
1170
- var snapsBounded = snapsAligned.map(scrollBounds.constrain);
1171
- var snapsContained = measureContained();
1172
-
1173
- function findDuplicates() {
1174
- var startSnap = snapsBounded[0];
1175
- var endSnap = arrayLast(snapsBounded);
1176
- var min = snapsBounded.lastIndexOf(startSnap);
1177
- var max = snapsBounded.indexOf(endSnap) + 1;
1178
- return Limit(min, max);
1179
- }
1180
-
1181
- function measureContained() {
1182
- if (contentSize <= viewSize) return [scrollBounds.max];
1183
- if (containScroll === 'keepSnaps') return snapsBounded;
1184
-
1185
- var _a = findDuplicates(),
1186
- min = _a.min,
1187
- max = _a.max;
1188
-
1189
- return snapsBounded.slice(min, max);
1190
- }
1191
-
1192
- var self = {
1193
- snapsContained: snapsContained
1194
- };
1195
- return self;
1196
- }
1197
-
1198
- function ScrollLimit(contentSize, scrollSnaps, loop) {
1199
- var limit = measureLimit();
1200
-
1201
- function measureLimit() {
1202
- var startSnap = scrollSnaps[0];
1203
- var endSnap = arrayLast(scrollSnaps);
1204
- var min = loop ? startSnap - contentSize : endSnap;
1205
- var max = startSnap;
1206
- return Limit(min, max);
1207
- }
1208
-
1209
- var self = {
1210
- limit: limit
1211
- };
1212
- return self;
1213
- }
1214
-
1215
- function ScrollLooper(contentSize, pxToPercent, limit, location, vectors) {
1216
- var min = limit.min + pxToPercent.measure(0.1);
1217
- var max = limit.max + pxToPercent.measure(0.1);
1218
-
1219
- var _a = Limit(min, max),
1220
- reachedMin = _a.reachedMin,
1221
- reachedMax = _a.reachedMax;
1222
-
1223
- function shouldLoop(direction) {
1224
- if (direction === 1) return reachedMax(location.get());
1225
- if (direction === -1) return reachedMin(location.get());
1226
- return false;
1227
- }
1228
-
1229
- function loop(direction) {
1230
- if (!shouldLoop(direction)) return;
1231
- var loopDistance = contentSize * (direction * -1);
1232
- vectors.forEach(function (v) {
1233
- return v.add(loopDistance);
1234
- });
1235
- }
1236
-
1237
- var self = {
1238
- loop: loop
1239
- };
1240
- return self;
1241
- }
1242
-
1243
- function ScrollProgress(limit) {
1244
- var max = limit.max,
1245
- scrollLength = limit.length;
1246
-
1247
- function get(n) {
1248
- var currentLocation = n - max;
1249
- return currentLocation / -scrollLength;
1250
- }
1251
-
1252
- var self = {
1253
- get: get
1254
- };
1255
- return self;
1256
- }
1257
-
1258
- function ScrollSnap(axis, alignment, pxToPercent, containerRect, slideRects, slidesToScroll) {
1259
- var startEdge = axis.startEdge,
1260
- endEdge = axis.endEdge;
1261
- var snaps = measureUnaligned();
1262
- var snapsAligned = measureAligned();
1263
-
1264
- function measureSizes() {
1265
- return groupArray(slideRects, slidesToScroll).map(function (rects) {
1266
- return arrayLast(rects)[endEdge] - rects[0][startEdge];
1267
- }).map(pxToPercent.measure).map(Math.abs);
1268
- }
1269
-
1270
- function measureUnaligned() {
1271
- return slideRects.map(function (rect) {
1272
- return containerRect[startEdge] - rect[startEdge];
1273
- }).map(pxToPercent.measure).map(function (snap) {
1274
- return -Math.abs(snap);
1275
- });
1276
- }
1277
-
1278
- function measureAligned() {
1279
- var groupedSnaps = groupArray(snaps, slidesToScroll).map(function (g) {
1280
- return g[0];
1281
- });
1282
- var alignments = measureSizes().map(alignment.measure);
1283
- return groupedSnaps.map(function (snap, index) {
1284
- return snap + alignments[index];
1285
- });
1286
- }
1287
-
1288
- var self = {
1289
- snaps: snaps,
1290
- snapsAligned: snapsAligned
1291
- };
1292
- return self;
1293
- }
1294
-
1295
- function ScrollTarget(loop, scrollSnaps, contentSize, limit, targetVector) {
1296
- var reachedAny = limit.reachedAny,
1297
- removeOffset = limit.removeOffset,
1298
- constrain = limit.constrain;
1299
-
1300
- function minDistance(d1, d2) {
1301
- return Math.abs(d1) < Math.abs(d2) ? d1 : d2;
1302
- }
1303
-
1304
- function findTargetSnap(target) {
1305
- var distance = loop ? removeOffset(target) : constrain(target);
1306
- var ascDiffsToSnaps = scrollSnaps.map(function (scrollSnap) {
1307
- return scrollSnap - distance;
1308
- }).map(function (diffToSnap) {
1309
- return shortcut(diffToSnap, 0);
1310
- }).map(function (diff, i) {
1311
- return {
1312
- diff: diff,
1313
- index: i
1314
- };
1315
- }).sort(function (d1, d2) {
1316
- return Math.abs(d1.diff) - Math.abs(d2.diff);
1317
- });
1318
- var index = ascDiffsToSnaps[0].index;
1319
- return {
1320
- index: index,
1321
- distance: distance
1322
- };
1323
- }
1324
-
1325
- function shortcut(target, direction) {
1326
- var t1 = target;
1327
- var t2 = target + contentSize;
1328
- var t3 = target - contentSize;
1329
- if (!loop) return t1;
1330
- if (!direction) return minDistance(minDistance(t1, t2), t3);
1331
- var shortest = minDistance(t1, direction === 1 ? t2 : t3);
1332
- return Math.abs(shortest) * direction;
1333
- }
1334
-
1335
- function byIndex(index, direction) {
1336
- var diffToSnap = scrollSnaps[index] - targetVector.get();
1337
- var distance = shortcut(diffToSnap, direction);
1338
- return {
1339
- index: index,
1340
- distance: distance
1341
- };
1342
- }
1343
-
1344
- function byDistance(distance, snap) {
1345
- var target = targetVector.get() + distance;
1346
-
1347
- var _a = findTargetSnap(target),
1348
- index = _a.index,
1349
- targetSnapDistance = _a.distance;
1350
-
1351
- var reachedBound = !loop && reachedAny(target);
1352
- if (!snap || reachedBound) return {
1353
- index: index,
1354
- distance: distance
1355
- };
1356
- var diffToSnap = scrollSnaps[index] - targetSnapDistance;
1357
- var snapDistance = distance + shortcut(diffToSnap, 0);
1358
- return {
1359
- index: index,
1360
- distance: snapDistance
1361
- };
1362
- }
1363
-
1364
- var self = {
1365
- byDistance: byDistance,
1366
- byIndex: byIndex,
1367
- shortcut: shortcut
1368
- };
1369
- return self;
1370
- }
1371
-
1372
- function ScrollTo(animation, indexCurrent, indexPrevious, scrollTarget, targetVector, events) {
1373
- function scrollTo(target) {
1374
- var distanceDiff = target.distance;
1375
- var indexDiff = target.index !== indexCurrent.get();
1376
-
1377
- if (distanceDiff) {
1378
- animation.start();
1379
- targetVector.add(distanceDiff);
1380
- }
1381
-
1382
- if (indexDiff) {
1383
- indexPrevious.set(indexCurrent.get());
1384
- indexCurrent.set(target.index);
1385
- events.emit('select');
1386
- }
1387
- }
1388
-
1389
- function distance(n, snap) {
1390
- var target = scrollTarget.byDistance(n, snap);
1391
- scrollTo(target);
1392
- }
1393
-
1394
- function index(n, direction) {
1395
- var targetIndex = indexCurrent.clone().set(n);
1396
- var target = scrollTarget.byIndex(targetIndex.get(), direction);
1397
- scrollTo(target);
1398
- }
1399
-
1400
- var self = {
1401
- distance: distance,
1402
- index: index
1403
- };
1404
- return self;
1405
- }
1406
-
1407
- function SlideLooper(axis, viewSize, contentSize, slideSizesWithGaps, scrollSnaps, slidesInView, scrollLocation, slides) {
1408
- var ascItems = arrayKeys(slideSizesWithGaps);
1409
- var descItems = arrayKeys(slideSizesWithGaps).reverse();
1410
- var loopPoints = startPoints().concat(endPoints());
1411
-
1412
- function removeSlideSizes(indexes, from) {
1413
- return indexes.reduce(function (a, i) {
1414
- return a - slideSizesWithGaps[i];
1415
- }, from);
1416
- }
1417
-
1418
- function slidesInGap(indexes, gap) {
1419
- return indexes.reduce(function (a, i) {
1420
- var remainingGap = removeSlideSizes(a, gap);
1421
- return remainingGap > 0 ? a.concat([i]) : a;
1422
- }, []);
1423
- }
1424
-
1425
- function findLoopPoints(indexes, edge) {
1426
- var isStartEdge = edge === 'start';
1427
- var offset = isStartEdge ? -contentSize : contentSize;
1428
- var slideBounds = slidesInView.findSlideBounds(offset);
1429
- return indexes.map(function (index) {
1430
- var initial = isStartEdge ? 0 : -contentSize;
1431
- var altered = isStartEdge ? contentSize : 0;
1432
- var bounds = slideBounds.filter(function (b) {
1433
- return b.index === index;
1434
- })[0];
1435
- var point = bounds[isStartEdge ? 'end' : 'start'];
1436
-
1437
- var getTarget = function getTarget() {
1438
- return scrollLocation.get() > point ? initial : altered;
1439
- };
1440
-
1441
- return {
1442
- point: point,
1443
- getTarget: getTarget,
1444
- index: index,
1445
- location: -1
1446
- };
1447
- });
1448
- }
1449
-
1450
- function startPoints() {
1451
- var gap = scrollSnaps[0] - 1;
1452
- var indexes = slidesInGap(descItems, gap);
1453
- return findLoopPoints(indexes, 'end');
1454
- }
1455
-
1456
- function endPoints() {
1457
- var gap = viewSize - scrollSnaps[0] - 1;
1458
- var indexes = slidesInGap(ascItems, gap);
1459
- return findLoopPoints(indexes, 'start');
1460
- }
1461
-
1462
- function canLoop() {
1463
- return loopPoints.every(function (_a) {
1464
- var index = _a.index;
1465
- var otherIndexes = ascItems.filter(function (i) {
1466
- return i !== index;
1467
- });
1468
- return removeSlideSizes(otherIndexes, viewSize) <= 0;
1469
- });
1470
- }
1471
-
1472
- function loop() {
1473
- loopPoints.forEach(function (loopPoint) {
1474
- var getTarget = loopPoint.getTarget,
1475
- location = loopPoint.location,
1476
- index = loopPoint.index;
1477
- var target = getTarget();
1478
-
1479
- if (target !== location) {
1480
- slides[index].style[axis.startEdge] = target + "%";
1481
- loopPoint.location = target;
1482
- }
1483
- });
1484
- }
1485
-
1486
- function clear() {
1487
- loopPoints.forEach(function (_a) {
1488
- var index = _a.index;
1489
- slides[index].style[axis.startEdge] = '';
1490
- });
1491
- }
1492
-
1493
- var self = {
1494
- canLoop: canLoop,
1495
- clear: clear,
1496
- loop: loop,
1497
- loopPoints: loopPoints
1498
- };
1499
- return self;
1500
- }
1501
-
1502
- function SlideFocus(rootNode, scrollTo, slidesToScroll) {
1503
- var eventStore = EventStore();
1504
- var removeAllEvents = eventStore.removeAll;
1505
- var lastTabPressTime = 0;
1506
-
1507
- function registerTabPress(event) {
1508
- if (event.keyCode !== 9) return;
1509
- lastTabPressTime = new Date().getTime();
1510
- }
1511
-
1512
- function addFocusEvent(slide, index) {
1513
- var focus = function focus() {
1514
- var nowTime = new Date().getTime();
1515
- var diffTime = nowTime - lastTabPressTime;
1516
- if (diffTime > 10) return;
1517
- rootNode.scrollLeft = 0;
1518
- var selectedIndex = Math.floor(index / slidesToScroll);
1519
- scrollTo.index(selectedIndex, 0);
1520
- };
1521
-
1522
- eventStore.add(slide, 'focus', focus, true);
1523
- }
1524
-
1525
- function addActivationEvents(slides) {
1526
- eventStore.add(document, 'keydown', registerTabPress, false);
1527
- slides.forEach(addFocusEvent);
1528
- }
1529
-
1530
- var self = {
1531
- addActivationEvents: addActivationEvents,
1532
- removeAllEvents: removeAllEvents
1533
- };
1534
- return self;
1535
- }
1536
-
1537
- function SlidesInView(viewSize, contentSize, slideSizes, snaps, loop, inViewThreshold) {
1538
- var threshold = Math.min(Math.max(inViewThreshold, 0.01), 0.99);
1539
- var offsets = loop ? [0, contentSize, -contentSize] : [0];
1540
- var slideBounds = offsets.reduce(function (a, offset) {
1541
- return a.concat(findSlideBounds(offset, threshold));
1542
- }, []);
1543
-
1544
- function findSlideBounds(offset, threshold) {
1545
- var thresholds = slideSizes.map(function (s) {
1546
- return s * (threshold || 0);
1547
- });
1548
- return snaps.map(function (snap, index) {
1549
- return {
1550
- start: snap - slideSizes[index] + thresholds[index] + offset,
1551
- end: snap + viewSize - thresholds[index] + offset,
1552
- index: index
1553
- };
1554
- });
1555
- }
1556
-
1557
- function check(location) {
1558
- return slideBounds.reduce(function (list, slideBound) {
1559
- var index = slideBound.index,
1560
- start = slideBound.start,
1561
- end = slideBound.end;
1562
- var inList = list.indexOf(index) !== -1;
1563
- var inView = start < location && end > location;
1564
- return !inList && inView ? list.concat([index]) : list;
1565
- }, []);
1566
- }
1567
-
1568
- var self = {
1569
- check: check,
1570
- findSlideBounds: findSlideBounds
1571
- };
1572
- return self;
1573
- }
1574
-
1575
- function SlideSizes(axis, pxToPercent, slides, slideRects, loop) {
1576
- var measureSize = axis.measureSize,
1577
- startEdge = axis.startEdge,
1578
- endEdge = axis.endEdge;
1579
- var sizesInPx = slideRects.map(measureSize);
1580
- var slideSizes = sizesInPx.map(pxToPercent.measure);
1581
- var slideSizesWithGaps = measureWithGaps();
1582
-
1583
- function measureWithGaps() {
1584
- return slideRects.map(function (rect, index, rects) {
1585
- var isLast = index === lastIndex(rects);
1586
- var style = window.getComputedStyle(arrayLast(slides));
1587
- var endGap = parseFloat(style.getPropertyValue("margin-" + endEdge));
1588
- if (isLast) return sizesInPx[index] + (loop ? endGap : 0);
1589
- return rects[index + 1][startEdge] - rect[startEdge];
1590
- }).map(pxToPercent.measure).map(Math.abs);
1591
- }
1592
-
1593
- var self = {
1594
- slideSizes: slideSizes,
1595
- slideSizesWithGaps: slideSizesWithGaps
1596
- };
1597
- return self;
1598
- }
1599
-
1600
- function Translate(axis, direction, container) {
1601
- var containerStyle = container.style;
1602
- var translate = axis.scroll === 'x' ? x : y;
1603
- var disabled = false;
1604
-
1605
- function x(n) {
1606
- return "translate3d(" + n + "%,0px,0px)";
1607
- }
1608
-
1609
- function y(n) {
1610
- return "translate3d(0px," + n + "%,0px)";
1611
- }
1612
-
1613
- function to(target) {
1614
- if (disabled) return;
1615
- containerStyle.transform = translate(direction.applyTo(target.get()));
1616
- }
1617
-
1618
- function toggleActive(active) {
1619
- disabled = !active;
1620
- }
1621
-
1622
- function clear() {
1623
- containerStyle.transform = '';
1624
- }
1625
-
1626
- var self = {
1627
- clear: clear,
1628
- to: to,
1629
- toggleActive: toggleActive
1630
- };
1631
- return self;
1632
- }
1633
-
1634
- function Engine(root, container, slides, options, events) {
1635
- // Options
1636
- var align = options.align,
1637
- scrollAxis = options.axis,
1638
- contentDirection = options.direction,
1639
- startIndex = options.startIndex,
1640
- inViewThreshold = options.inViewThreshold,
1641
- loop = options.loop,
1642
- speed = options.speed,
1643
- dragFree = options.dragFree,
1644
- slidesToScroll = options.slidesToScroll,
1645
- skipSnaps = options.skipSnaps,
1646
- containScroll = options.containScroll; // Measurements
1647
-
1648
- var containerRect = container.getBoundingClientRect();
1649
- var slideRects = slides.map(function (slide) {
1650
- return slide.getBoundingClientRect();
1651
- });
1652
- var direction = Direction(contentDirection);
1653
- var axis = Axis(scrollAxis, contentDirection);
1654
- var pxToPercent = PxToPercent(axis.measureSize(containerRect));
1655
- var viewSize = pxToPercent.totalPercent;
1656
- var alignment = Alignment(align, viewSize);
1657
-
1658
- var _a = SlideSizes(axis, pxToPercent, slides, slideRects, loop),
1659
- slideSizes = _a.slideSizes,
1660
- slideSizesWithGaps = _a.slideSizesWithGaps;
1661
-
1662
- var _b = ScrollSnap(axis, alignment, pxToPercent, containerRect, slideRects, slidesToScroll),
1663
- snaps = _b.snaps,
1664
- snapsAligned = _b.snapsAligned;
1665
-
1666
- var contentSize = -arrayLast(snaps) + arrayLast(slideSizesWithGaps);
1667
- var snapsContained = ScrollContain(viewSize, contentSize, snaps, snapsAligned, containScroll).snapsContained;
1668
- var contain = !loop && containScroll !== '';
1669
- var scrollSnaps = contain ? snapsContained : snapsAligned;
1670
- var limit = ScrollLimit(contentSize, scrollSnaps, loop).limit; // Indexes
1671
-
1672
- var index = Counter(lastIndex(scrollSnaps), startIndex, loop);
1673
- var indexPrevious = index.clone();
1674
- var slideIndexes = arrayKeys(slides); // Draw
1675
-
1676
- var update = function update() {
1677
- if (!loop) engine.scrollBounds.constrain(engine.dragHandler.pointerDown());
1678
- engine.scrollBody.seek(target).update();
1679
- var settled = engine.scrollBody.settle(target);
1680
-
1681
- if (settled && !engine.dragHandler.pointerDown()) {
1682
- engine.animation.stop();
1683
- events.emit('settle');
1684
- }
1685
-
1686
- if (!settled) {
1687
- events.emit('scroll');
1688
- }
1689
-
1690
- if (loop) {
1691
- engine.scrollLooper.loop(engine.scrollBody.direction());
1692
- engine.slideLooper.loop();
1693
- }
1694
-
1695
- engine.translate.to(location);
1696
- engine.animation.proceed();
1697
- }; // Shared
1698
-
1699
-
1700
- var animation = Animation(update);
1701
- var startLocation = scrollSnaps[index.get()];
1702
- var location = Vector1D(startLocation);
1703
- var target = Vector1D(startLocation);
1704
- var scrollBody = ScrollBody(location, speed, 1);
1705
- var scrollTarget = ScrollTarget(loop, scrollSnaps, contentSize, limit, target);
1706
- var scrollTo = ScrollTo(animation, index, indexPrevious, scrollTarget, target, events);
1707
- var slidesInView = SlidesInView(viewSize, contentSize, slideSizes, snaps, loop, inViewThreshold); // DragHandler
1708
-
1709
- var dragHandler = DragHandler(axis, direction, root, target, dragFree, DragTracker(axis, pxToPercent), location, animation, scrollTo, scrollBody, scrollTarget, index, events, loop, skipSnaps); // Slider
1710
-
1711
- var engine = {
1712
- animation: animation,
1713
- axis: axis,
1714
- direction: direction,
1715
- dragHandler: dragHandler,
1716
- pxToPercent: pxToPercent,
1717
- index: index,
1718
- indexPrevious: indexPrevious,
1719
- limit: limit,
1720
- location: location,
1721
- options: options,
1722
- scrollBody: scrollBody,
1723
- scrollBounds: ScrollBounds(limit, location, target, scrollBody),
1724
- scrollLooper: ScrollLooper(contentSize, pxToPercent, limit, location, [location, target]),
1725
- scrollProgress: ScrollProgress(limit),
1726
- scrollSnaps: scrollSnaps,
1727
- scrollTarget: scrollTarget,
1728
- scrollTo: scrollTo,
1729
- slideFocus: SlideFocus(root, scrollTo, slidesToScroll),
1730
- slideLooper: SlideLooper(axis, viewSize, contentSize, slideSizesWithGaps, scrollSnaps, slidesInView, location, slides),
1731
- slidesInView: slidesInView,
1732
- slideIndexes: slideIndexes,
1733
- target: target,
1734
- translate: Translate(axis, direction, container)
1735
- };
1736
- return engine;
1737
- }
1738
-
1739
- function EventEmitter() {
1740
- var listeners = {};
1741
-
1742
- function getListeners(evt) {
1743
- var eventListeners = listeners[evt];
1744
- return eventListeners || [];
1745
- }
1746
-
1747
- function emit(evt) {
1748
- getListeners(evt).forEach(function (e) {
1749
- return e(evt);
1750
- });
1751
- return self;
1752
- }
1753
-
1754
- function on(evt, cb) {
1755
- listeners[evt] = getListeners(evt).concat([cb]);
1756
- return self;
1757
- }
1758
-
1759
- function off(evt, cb) {
1760
- listeners[evt] = getListeners(evt).filter(function (e) {
1761
- return e !== cb;
1762
- });
1763
- return self;
1764
- }
1765
-
1766
- var self = {
1767
- emit: emit,
1768
- off: off,
1769
- on: on
1770
- };
1771
- return self;
1772
- }
1773
-
1774
- var defaultOptions = {
1775
- align: 'center',
1776
- axis: 'x',
1777
- containScroll: '',
1778
- direction: 'ltr',
1779
- dragFree: false,
1780
- draggable: true,
1781
- draggableClass: 'is-draggable',
1782
- draggingClass: 'is-dragging',
1783
- inViewThreshold: 0,
1784
- loop: false,
1785
- skipSnaps: true,
1786
- selectedClass: 'is-selected',
1787
- slidesToScroll: 1,
1788
- speed: 10,
1789
- startIndex: 0
1790
- };
1791
-
1792
- function OptionsPseudo(node) {
1793
- var pseudoString = getComputedStyle(node, ':before').content;
1794
-
1795
- function get() {
1796
- try {
1797
- return JSON.parse(pseudoString.slice(1, -1).replace(/\\/g, ''));
1798
- } catch (error) {} // eslint-disable-line no-empty
1799
-
1800
-
1801
- return {};
1802
- }
1803
-
1804
- var self = {
1805
- get: get
1806
- };
1807
- return self;
1808
- }
1809
-
1810
- function EmblaCarousel(sliderRoot, userOptions) {
1811
- var events = EventEmitter();
1812
- var eventStore = EventStore();
1813
- var debouncedResize = debounce(resize, 500);
1814
- var reInit = reActivate;
1815
- var on = events.on,
1816
- off = events.off;
1817
- var engine;
1818
- var activated = false;
1819
-
1820
- var optionsBase = _extends({}, defaultOptions);
1821
-
1822
- var options = _extends({}, optionsBase);
1823
-
1824
- var optionsPseudo;
1825
- var rootNodeSize = 0;
1826
- var container;
1827
- var slides;
1828
- activate(userOptions);
1829
-
1830
- function setupElements() {
1831
- if (!sliderRoot) throw new Error('Missing root node 😢');
1832
- var sliderContainer = sliderRoot.querySelector('*');
1833
- if (!sliderContainer) throw new Error('Missing container node 😢');
1834
- container = sliderContainer;
1835
- slides = Array.prototype.slice.call(container.children);
1836
- optionsPseudo = OptionsPseudo(sliderRoot);
1837
- }
1838
-
1839
- function activate(partialOptions) {
1840
- setupElements();
1841
- optionsBase = _extends({}, optionsBase, partialOptions);
1842
- options = _extends({}, optionsBase, optionsPseudo.get());
1843
- engine = Engine(sliderRoot, container, slides, options, events);
1844
- eventStore.add(window, 'resize', debouncedResize);
1845
- engine.translate.to(engine.location);
1846
- rootNodeSize = engine.axis.measureSize(sliderRoot.getBoundingClientRect());
1847
-
1848
- if (options.loop) {
1849
- if (!engine.slideLooper.canLoop()) {
1850
- deActivate();
1851
- return activate({
1852
- loop: false
1853
- });
1854
- }
1855
-
1856
- engine.slideLooper.loop();
1857
- }
1858
-
1859
- if (options.draggable && container.offsetParent && slides.length) {
1860
- engine.dragHandler.addActivationEvents();
1861
-
1862
- if (options.draggableClass) {
1863
- addClass(sliderRoot, options.draggableClass);
1864
- }
1865
-
1866
- if (options.draggingClass) {
1867
- events.on('pointerDown', toggleDraggingClass).on('pointerUp', toggleDraggingClass);
1868
- }
1869
- }
1870
-
1871
- if (slides.length) {
1872
- engine.slideFocus.addActivationEvents(slides);
1873
- }
1874
-
1875
- if (options.selectedClass) {
1876
- toggleSelectedClass();
1877
- events.on('select', toggleSelectedClass).on('pointerUp', toggleSelectedClass);
1878
- }
1879
-
1880
- if (!activated) {
1881
- setTimeout(function () {
1882
- return events.emit('init');
1883
- }, 0);
1884
- activated = true;
1885
- }
1886
- }
1887
-
1888
- function toggleDraggingClass(evt) {
1889
- var draggingClass = options.draggingClass;
1890
- if (evt === 'pointerDown') addClass(sliderRoot, draggingClass);else removeClass(sliderRoot, draggingClass);
1891
- }
1892
-
1893
- function toggleSelectedClass() {
1894
- var selectedClass = options.selectedClass;
1895
- var inView = slidesInView(true);
1896
- var notInView = slidesNotInView(true);
1897
- notInView.forEach(function (index) {
1898
- return removeClass(slides[index], selectedClass);
1899
- });
1900
- inView.forEach(function (index) {
1901
- return addClass(slides[index], selectedClass);
1902
- });
1903
- }
1904
-
1905
- function deActivate() {
1906
- engine.dragHandler.removeAllEvents();
1907
- engine.slideFocus.removeAllEvents();
1908
- engine.animation.stop();
1909
- eventStore.removeAll();
1910
- engine.translate.clear();
1911
- engine.slideLooper.clear();
1912
- removeClass(sliderRoot, options.draggableClass);
1913
- slides.forEach(function (slide) {
1914
- return removeClass(slide, options.selectedClass);
1915
- });
1916
- events.off('select', toggleSelectedClass).off('pointerUp', toggleSelectedClass).off('pointerDown', toggleDraggingClass).off('pointerUp', toggleDraggingClass);
1917
- }
1918
-
1919
- function reActivate(partialOptions) {
1920
- if (!activated) return;
1921
- var startIndex = selectedScrollSnap();
1922
-
1923
- var newOptions = _extends({
1924
- startIndex: startIndex
1925
- }, partialOptions);
1926
-
1927
- deActivate();
1928
- activate(newOptions);
1929
- events.emit('reInit');
1930
- }
1931
-
1932
- function destroy() {
1933
- if (!activated) return;
1934
- deActivate();
1935
- activated = false;
1936
- events.emit('destroy');
1937
- }
1938
-
1939
- function resize() {
1940
- if (!activated) return;
1941
- var size = engine.axis.measureSize(sliderRoot.getBoundingClientRect());
1942
- if (rootNodeSize !== size) reActivate();
1943
- events.emit('resize');
1944
- }
1945
-
1946
- function slidesInView(target) {
1947
- var location = engine[target ? 'target' : 'location'].get();
1948
- var type = options.loop ? 'removeOffset' : 'constrain';
1949
- return engine.slidesInView.check(engine.limit[type](location));
1950
- }
1951
-
1952
- function slidesNotInView(target) {
1953
- var inView = slidesInView(target);
1954
- return engine.slideIndexes.filter(function (index) {
1955
- return inView.indexOf(index) === -1;
1956
- });
1957
- }
1958
-
1959
- function scrollTo(index, jump, direction) {
1960
- engine.scrollBody.useBaseMass().useSpeed(jump ? 100 : options.speed);
1961
- if (activated) engine.scrollTo.index(index, direction || 0);
1962
- }
1963
-
1964
- function scrollNext(jump) {
1965
- var next = engine.index.clone().add(1);
1966
- scrollTo(next.get(), jump === true, -1);
1967
- }
1968
-
1969
- function scrollPrev(jump) {
1970
- var prev = engine.index.clone().add(-1);
1971
- scrollTo(prev.get(), jump === true, 1);
1972
- }
1973
-
1974
- function canScrollNext() {
1975
- var next = engine.index.clone().add(1);
1976
- return next.get() !== selectedScrollSnap();
1977
- }
1978
-
1979
- function canScrollPrev() {
1980
- var prev = engine.index.clone().add(-1);
1981
- return prev.get() !== selectedScrollSnap();
1982
- }
1983
-
1984
- function scrollSnapList() {
1985
- return engine.scrollSnaps.map(engine.scrollProgress.get);
1986
- }
1987
-
1988
- function scrollProgress() {
1989
- return engine.scrollProgress.get(engine.location.get());
1990
- }
1991
-
1992
- function selectedScrollSnap() {
1993
- return engine.index.get();
1994
- }
1995
-
1996
- function previousScrollSnap() {
1997
- return engine.indexPrevious.get();
1998
- }
1999
-
2000
- function clickAllowed() {
2001
- return engine.dragHandler.clickAllowed();
2002
- }
2003
-
2004
- function dangerouslyGetEngine() {
2005
- return engine;
2006
- }
2007
-
2008
- function rootNode() {
2009
- return sliderRoot;
2010
- }
2011
-
2012
- function containerNode() {
2013
- return container;
2014
- }
2015
-
2016
- function slideNodes() {
2017
- return slides;
2018
- }
2019
-
2020
- var self = {
2021
- canScrollNext: canScrollNext,
2022
- canScrollPrev: canScrollPrev,
2023
- clickAllowed: clickAllowed,
2024
- containerNode: containerNode,
2025
- dangerouslyGetEngine: dangerouslyGetEngine,
2026
- destroy: destroy,
2027
- off: off,
2028
- on: on,
2029
- previousScrollSnap: previousScrollSnap,
2030
- reInit: reInit,
2031
- rootNode: rootNode,
2032
- scrollNext: scrollNext,
2033
- scrollPrev: scrollPrev,
2034
- scrollProgress: scrollProgress,
2035
- scrollSnapList: scrollSnapList,
2036
- scrollTo: scrollTo,
2037
- selectedScrollSnap: selectedScrollSnap,
2038
- slideNodes: slideNodes,
2039
- slidesInView: slidesInView,
2040
- slidesNotInView: slidesNotInView
2041
- };
2042
- return self;
2043
- }
2044
-
2045
- function useEmblaCarousel(options) {
2046
- if (options === void 0) {
2047
- options = {};
2048
- }
2049
-
2050
- var _a = React.useState(),
2051
- embla = _a[0],
2052
- setEmbla = _a[1];
2053
-
2054
- var _b = React.useState(),
2055
- viewport = _b[0],
2056
- setViewport = _b[1];
2057
-
2058
- var storedOptions = React.useRef(options);
2059
- var activeOptions = React.useMemo(function () {
2060
- if (!areEqualShallow(storedOptions.current, options)) {
2061
- storedOptions.current = options;
2062
- }
2063
-
2064
- return storedOptions.current;
2065
- }, [storedOptions, options]);
2066
- React.useEffect(function () {
2067
- if (canUseDOM() && viewport) {
2068
- var newEmbla_1 = EmblaCarousel(viewport, activeOptions);
2069
- setEmbla(newEmbla_1);
2070
- return function () {
2071
- return newEmbla_1.destroy();
2072
- };
2073
- } else {
2074
- setEmbla(undefined);
2075
- }
2076
- }, [viewport, activeOptions, setEmbla]);
2077
- return [setViewport, embla];
2078
- }
2079
-
2080
- var iterator$4 = index.wellKnownSymbolWrapped.f('iterator');
2081
-
2082
- var iterator$3 = iterator$4;
2083
-
2084
- var iterator$2 = iterator$3;
2085
-
2086
- var iterator$1 = iterator$2;
2087
-
2088
- var iterator = iterator$1;
2089
-
2090
- function _typeof(obj) {
2091
- "@babel/helpers - typeof";
2092
-
2093
- if (typeof symbol === "function" && typeof iterator === "symbol") {
2094
- _typeof = function _typeof(obj) {
2095
- return typeof obj;
2096
- };
2097
- } else {
2098
- _typeof = function _typeof(obj) {
2099
- return obj && typeof symbol === "function" && obj.constructor === symbol && obj !== symbol.prototype ? "symbol" : typeof obj;
2100
- };
2101
- }
2102
-
2103
- return _typeof(obj);
2104
- }
2105
-
2106
- var redefineAll = function (target, src, options) {
2107
- for (var key in src) {
2108
- if (options && options.unsafe && target[key]) target[key] = src[key];
2109
- else index.redefine(target, key, src[key], options);
2110
- } return target;
2111
- };
2112
-
2113
- var TypeError$2 = index.global_1.TypeError;
2114
-
2115
- var Result = function (stopped, result) {
2116
- this.stopped = stopped;
2117
- this.result = result;
2118
- };
2119
-
2120
- var ResultPrototype = Result.prototype;
2121
-
2122
- var iterate = function (iterable, unboundFunction, options) {
2123
- var that = options && options.that;
2124
- var AS_ENTRIES = !!(options && options.AS_ENTRIES);
2125
- var IS_ITERATOR = !!(options && options.IS_ITERATOR);
2126
- var INTERRUPTED = !!(options && options.INTERRUPTED);
2127
- var fn = index.functionBindContext(unboundFunction, that);
2128
- var iterator, iterFn, index$1, length, result, next, step;
2129
-
2130
- var stop = function (condition) {
2131
- if (iterator) iteratorClose(iterator, 'normal', condition);
2132
- return new Result(true, condition);
2133
- };
2134
-
2135
- var callFn = function (value) {
2136
- if (AS_ENTRIES) {
2137
- index.anObject(value);
2138
- return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
2139
- } return INTERRUPTED ? fn(value, stop) : fn(value);
2140
- };
2141
-
2142
- if (IS_ITERATOR) {
2143
- iterator = iterable;
2144
- } else {
2145
- iterFn = getIteratorMethod$4(iterable);
2146
- if (!iterFn) throw TypeError$2(index.tryToString(iterable) + ' is not iterable');
2147
- // optimisation for array iterators
2148
- if (isArrayIteratorMethod(iterFn)) {
2149
- for (index$1 = 0, length = index.lengthOfArrayLike(iterable); length > index$1; index$1++) {
2150
- result = callFn(iterable[index$1]);
2151
- if (result && index.objectIsPrototypeOf(ResultPrototype, result)) return result;
2152
- } return new Result(false);
2153
- }
2154
- iterator = getIterator(iterable, iterFn);
2155
- }
2156
-
2157
- next = iterator.next;
2158
- while (!(step = index.functionCall(next, iterator)).done) {
2159
- try {
2160
- result = callFn(step.value);
2161
- } catch (error) {
2162
- iteratorClose(iterator, 'throw', error);
2163
- }
2164
- if (typeof result == 'object' && result && index.objectIsPrototypeOf(ResultPrototype, result)) return result;
2165
- } return new Result(false);
2166
- };
2167
-
2168
- var TypeError$1 = index.global_1.TypeError;
2169
-
2170
- var anInstance = function (it, Prototype) {
2171
- if (index.objectIsPrototypeOf(Prototype, it)) return it;
2172
- throw TypeError$1('Incorrect invocation');
2173
- };
2174
-
2175
- var defineProperty = index.objectDefineProperty.f;
2176
- var forEach = index.arrayIteration.forEach;
2177
-
2178
-
2179
-
2180
- var setInternalState$1 = index.internalState.set;
2181
- var internalStateGetterFor$1 = index.internalState.getterFor;
2182
-
2183
- var collection = function (CONSTRUCTOR_NAME, wrapper, common) {
2184
- var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
2185
- var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
2186
- var ADDER = IS_MAP ? 'set' : 'add';
2187
- var NativeConstructor = index.global_1[CONSTRUCTOR_NAME];
2188
- var NativePrototype = NativeConstructor && NativeConstructor.prototype;
2189
- var exported = {};
2190
- var Constructor;
2191
-
2192
- if (!index.descriptors || !index.isCallable(NativeConstructor)
2193
- || !(IS_WEAK || NativePrototype.forEach && !index.fails(function () { new NativeConstructor().entries().next(); }))
2194
- ) {
2195
- // create collection constructor
2196
- Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
2197
- index.internalMetadata.enable();
2198
- } else {
2199
- Constructor = wrapper(function (target, iterable) {
2200
- setInternalState$1(anInstance(target, Prototype), {
2201
- type: CONSTRUCTOR_NAME,
2202
- collection: new NativeConstructor()
2203
- });
2204
- if (iterable != undefined) iterate(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP });
2205
- });
2206
-
2207
- var Prototype = Constructor.prototype;
2208
-
2209
- var getInternalState = internalStateGetterFor$1(CONSTRUCTOR_NAME);
2210
-
2211
- forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {
2212
- var IS_ADDER = KEY == 'add' || KEY == 'set';
2213
- if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) {
2214
- index.createNonEnumerableProperty(Prototype, KEY, function (a, b) {
2215
- var collection = getInternalState(this).collection;
2216
- if (!IS_ADDER && IS_WEAK && !index.isObject(a)) return KEY == 'get' ? undefined : false;
2217
- var result = collection[KEY](a === 0 ? 0 : a, b);
2218
- return IS_ADDER ? this : result;
2219
- });
2220
- }
2221
- });
2222
-
2223
- IS_WEAK || defineProperty(Prototype, 'size', {
2224
- configurable: true,
2225
- get: function () {
2226
- return getInternalState(this).collection.size;
2227
- }
2228
- });
2229
- }
2230
-
2231
- index.setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);
2232
-
2233
- exported[CONSTRUCTOR_NAME] = Constructor;
2234
- index._export({ global: true, forced: true }, exported);
2235
-
2236
- if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
2237
-
2238
- return Constructor;
2239
- };
2240
-
2241
- var getWeakData = index.internalMetadata.getWeakData;
2242
-
2243
-
2244
-
2245
-
2246
-
2247
-
2248
-
2249
-
2250
- var setInternalState = index.internalState.set;
2251
- var internalStateGetterFor = index.internalState.getterFor;
2252
- var find = index.arrayIteration.find;
2253
- var findIndex = index.arrayIteration.findIndex;
2254
- var splice = index.functionUncurryThis([].splice);
2255
- var id = 0;
2256
-
2257
- // fallback for uncaught frozen keys
2258
- var uncaughtFrozenStore = function (store) {
2259
- return store.frozen || (store.frozen = new UncaughtFrozenStore());
2260
- };
2261
-
2262
- var UncaughtFrozenStore = function () {
2263
- this.entries = [];
2264
- };
2265
-
2266
- var findUncaughtFrozen = function (store, key) {
2267
- return find(store.entries, function (it) {
2268
- return it[0] === key;
2269
- });
2270
- };
2271
-
2272
- UncaughtFrozenStore.prototype = {
2273
- get: function (key) {
2274
- var entry = findUncaughtFrozen(this, key);
2275
- if (entry) return entry[1];
2276
- },
2277
- has: function (key) {
2278
- return !!findUncaughtFrozen(this, key);
2279
- },
2280
- set: function (key, value) {
2281
- var entry = findUncaughtFrozen(this, key);
2282
- if (entry) entry[1] = value;
2283
- else this.entries.push([key, value]);
2284
- },
2285
- 'delete': function (key) {
2286
- var index = findIndex(this.entries, function (it) {
2287
- return it[0] === key;
2288
- });
2289
- if (~index) splice(this.entries, index, 1);
2290
- return !!~index;
2291
- }
2292
- };
2293
-
2294
- var collectionWeak = {
2295
- getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
2296
- var Constructor = wrapper(function (that, iterable) {
2297
- anInstance(that, Prototype);
2298
- setInternalState(that, {
2299
- type: CONSTRUCTOR_NAME,
2300
- id: id++,
2301
- frozen: undefined
2302
- });
2303
- if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
2304
- });
2305
-
2306
- var Prototype = Constructor.prototype;
2307
-
2308
- var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
2309
-
2310
- var define = function (that, key, value) {
2311
- var state = getInternalState(that);
2312
- var data = getWeakData(index.anObject(key), true);
2313
- if (data === true) uncaughtFrozenStore(state).set(key, value);
2314
- else data[state.id] = value;
2315
- return that;
2316
- };
2317
-
2318
- redefineAll(Prototype, {
2319
- // `{ WeakMap, WeakSet }.prototype.delete(key)` methods
2320
- // https://tc39.es/ecma262/#sec-weakmap.prototype.delete
2321
- // https://tc39.es/ecma262/#sec-weakset.prototype.delete
2322
- 'delete': function (key) {
2323
- var state = getInternalState(this);
2324
- if (!index.isObject(key)) return false;
2325
- var data = getWeakData(key);
2326
- if (data === true) return uncaughtFrozenStore(state)['delete'](key);
2327
- return data && index.hasOwnProperty_1(data, state.id) && delete data[state.id];
2328
- },
2329
- // `{ WeakMap, WeakSet }.prototype.has(key)` methods
2330
- // https://tc39.es/ecma262/#sec-weakmap.prototype.has
2331
- // https://tc39.es/ecma262/#sec-weakset.prototype.has
2332
- has: function has(key) {
2333
- var state = getInternalState(this);
2334
- if (!index.isObject(key)) return false;
2335
- var data = getWeakData(key);
2336
- if (data === true) return uncaughtFrozenStore(state).has(key);
2337
- return data && index.hasOwnProperty_1(data, state.id);
2338
- }
2339
- });
2340
-
2341
- redefineAll(Prototype, IS_MAP ? {
2342
- // `WeakMap.prototype.get(key)` method
2343
- // https://tc39.es/ecma262/#sec-weakmap.prototype.get
2344
- get: function get(key) {
2345
- var state = getInternalState(this);
2346
- if (index.isObject(key)) {
2347
- var data = getWeakData(key);
2348
- if (data === true) return uncaughtFrozenStore(state).get(key);
2349
- return data ? data[state.id] : undefined;
2350
- }
2351
- },
2352
- // `WeakMap.prototype.set(key, value)` method
2353
- // https://tc39.es/ecma262/#sec-weakmap.prototype.set
2354
- set: function set(key, value) {
2355
- return define(this, key, value);
2356
- }
2357
- } : {
2358
- // `WeakSet.prototype.add(value)` method
2359
- // https://tc39.es/ecma262/#sec-weakset.prototype.add
2360
- add: function add(value) {
2361
- return define(this, value, true);
2362
- }
2363
- });
2364
-
2365
- return Constructor;
2366
- }
2367
- };
2368
-
2369
- var enforceInternalState = index.internalState.enforce;
2370
-
2371
-
2372
- var IS_IE11 = !index.global_1.ActiveXObject && 'ActiveXObject' in index.global_1;
2373
- var InternalWeakMap;
2374
-
2375
- var wrapper = function (init) {
2376
- return function WeakMap() {
2377
- return init(this, arguments.length ? arguments[0] : undefined);
2378
- };
2379
- };
2380
-
2381
- // `WeakMap` constructor
2382
- // https://tc39.es/ecma262/#sec-weakmap-constructor
2383
- var $WeakMap = collection('WeakMap', wrapper, collectionWeak);
2384
-
2385
- // IE11 WeakMap frozen keys fix
2386
- // We can't use feature detection because it crash some old IE builds
2387
- // https://github.com/zloirock/core-js/issues/485
2388
- if (index.nativeWeakMap && IS_IE11) {
2389
- InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);
2390
- index.internalMetadata.enable();
2391
- var WeakMapPrototype = $WeakMap.prototype;
2392
- var nativeDelete = index.functionUncurryThis(WeakMapPrototype['delete']);
2393
- var nativeHas = index.functionUncurryThis(WeakMapPrototype.has);
2394
- var nativeGet = index.functionUncurryThis(WeakMapPrototype.get);
2395
- var nativeSet = index.functionUncurryThis(WeakMapPrototype.set);
2396
- redefineAll(WeakMapPrototype, {
2397
- 'delete': function (key) {
2398
- if (index.isObject(key) && !index.objectIsExtensible(key)) {
2399
- var state = enforceInternalState(this);
2400
- if (!state.frozen) state.frozen = new InternalWeakMap();
2401
- return nativeDelete(this, key) || state.frozen['delete'](key);
2402
- } return nativeDelete(this, key);
2403
- },
2404
- has: function has(key) {
2405
- if (index.isObject(key) && !index.objectIsExtensible(key)) {
2406
- var state = enforceInternalState(this);
2407
- if (!state.frozen) state.frozen = new InternalWeakMap();
2408
- return nativeHas(this, key) || state.frozen.has(key);
2409
- } return nativeHas(this, key);
2410
- },
2411
- get: function get(key) {
2412
- if (index.isObject(key) && !index.objectIsExtensible(key)) {
2413
- var state = enforceInternalState(this);
2414
- if (!state.frozen) state.frozen = new InternalWeakMap();
2415
- return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key);
2416
- } return nativeGet(this, key);
2417
- },
2418
- set: function set(key, value) {
2419
- if (index.isObject(key) && !index.objectIsExtensible(key)) {
2420
- var state = enforceInternalState(this);
2421
- if (!state.frozen) state.frozen = new InternalWeakMap();
2422
- nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value);
2423
- } else nativeSet(this, key, value);
2424
- return this;
2425
- }
2426
- });
2427
- }
2428
-
2429
- var weakMap$2 = index.path.WeakMap;
2430
-
2431
- var weakMap$1 = weakMap$2;
2432
-
2433
- var weakMap = weakMap$1;
2434
-
2435
- function _interopRequireDefault(obj) {
2436
- return obj && obj.__esModule ? obj : {
2437
- "default": obj
2438
- };
2439
- }
2440
-
2441
- var ChevronLeft = index.createCommonjsModule(function (module, exports) {
2442
-
2443
-
2444
-
2445
-
2446
-
2447
-
2448
-
2449
-
2450
-
2451
-
2452
-
2453
- index.defineProperty(exports, "__esModule", {
2454
- value: true
2455
- });
2456
-
2457
- exports["default"] = void 0;
2458
-
2459
- var _extends2 = _interopRequireDefault(index._extends);
2460
-
2461
- var React = _interopRequireWildcard(React__default['default']);
2462
-
2463
- function _getRequireWildcardCache(nodeInterop) { if (typeof weakMap !== "function") return null; var cacheBabelInterop = new weakMap(); var cacheNodeInterop = new weakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
2464
-
2465
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = index.defineProperty && index.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? index.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { index.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
2466
-
2467
- function SvgChevronLeft(props, svgRef) {
2468
- return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({}, props, {
2469
- xmlns: "http://www.w3.org/2000/svg",
2470
- viewBox: "0 0 1024 1024",
2471
- fill: "currentColor",
2472
- className: "Icon ".concat(props.className ? props.className : ''),
2473
- ref: svgRef
2474
- }), /*#__PURE__*/React.createElement("path", {
2475
- d: "M199.5 480L762.8 10.5c21.3-17.1 51.2-12.8 64 8.5 17.1 25.6 12.8 55.5-8.5 68.3L306.1 514.1l516.4 426.8c21.3 17.1 25.6 42.7 8.5 64-17.1 21.3-42.7 25.6-64 8.5L199.5 556.8c-12.8-8.5-17.1-21.3-17.1-38.4 0-17.1 4.2-29.9 17.1-38.4z"
2476
- }));
2477
- }
2478
-
2479
- var ForwardRef = /*#__PURE__*/React.forwardRef(SvgChevronLeft);
2480
- var _default = ForwardRef;
2481
- exports["default"] = _default;
2482
- });
2483
-
2484
- index.unwrapExports(ChevronLeft);
2485
-
2486
- var chevronLeft = ChevronLeft;
2487
-
2488
- var ChevronRight = index.createCommonjsModule(function (module, exports) {
2489
-
2490
-
2491
-
2492
-
2493
-
2494
-
2495
-
2496
-
2497
-
2498
-
2499
-
2500
- index.defineProperty(exports, "__esModule", {
2501
- value: true
2502
- });
2503
-
2504
- exports["default"] = void 0;
2505
-
2506
- var _extends2 = _interopRequireDefault(index._extends);
2507
-
2508
- var React = _interopRequireWildcard(React__default['default']);
2509
-
2510
- function _getRequireWildcardCache(nodeInterop) { if (typeof weakMap !== "function") return null; var cacheBabelInterop = new weakMap(); var cacheNodeInterop = new weakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
2511
-
2512
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = index.defineProperty && index.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? index.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { index.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
2513
-
2514
- function SvgChevronRight(props, svgRef) {
2515
- return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({}, props, {
2516
- xmlns: "http://www.w3.org/2000/svg",
2517
- viewBox: "0 0 1024 1024",
2518
- fill: "currentColor",
2519
- className: "Icon ".concat(props.className ? props.className : ''),
2520
- ref: svgRef
2521
- }), /*#__PURE__*/React.createElement("path", {
2522
- d: "M841.6 518.4c0 17.1-4.3 29.9-17.1 38.4L257 1013.4c-21.3 17.1-46.9 12.8-64-8.5s-12.8-46.9 8.5-64l516.4-426.8L205.7 87.4c-21.3-12.8-25.6-42.7-8.5-68.3 12.8-21.3 42.7-25.6 64-8.5l563.3 469.5c12.9 8.5 17.1 21.3 17.1 38.3z"
2523
- }));
2524
- }
2525
-
2526
- var ForwardRef = /*#__PURE__*/React.forwardRef(SvgChevronRight);
2527
- var _default = ForwardRef;
2528
- exports["default"] = _default;
2529
- });
2530
-
2531
- index.unwrapExports(ChevronRight);
2532
-
2533
- var chevronRight = ChevronRight;
2534
-
2535
- var _excluded = ["images", "width", "height"];
2536
-
2537
- (function () {
2538
- var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
2539
- enterModule && enterModule(module);
2540
- })();
2541
-
2542
- var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
2543
- return a;
2544
- };
2545
-
2546
- var ImageCarousel = function ImageCarousel(_ref) {
2547
- var images = _ref.images,
2548
- width = _ref.width,
2549
- height = _ref.height,
2550
- props = index._objectWithoutProperties(_ref, _excluded);
2551
-
2552
- var imgWidth = width ? "".concat(width, "rem") : '100%';
2553
- var imgHeight = "".concat(height, "rem");
2554
-
2555
- var _useEmblaCarousel = useEmblaCarousel({
2556
- skipSnaps: false,
2557
- loop: true
2558
- }),
2559
- _useEmblaCarousel2 = _slicedToArray(_useEmblaCarousel, 2),
2560
- viewportRef = _useEmblaCarousel2[0],
2561
- embla = _useEmblaCarousel2[1];
2562
-
2563
- var _useState = React.useState(0),
2564
- _useState2 = _slicedToArray(_useState, 2),
2565
- selectedIndex = _useState2[0],
2566
- setSelectedIndex = _useState2[1];
2567
-
2568
- var scrollPrev = React.useCallback(function () {
2569
- return embla && embla.scrollPrev();
2570
- }, [embla]);
2571
- var scrollNext = React.useCallback(function () {
2572
- return embla && embla.scrollNext();
2573
- }, [embla]);
2574
- var onSelect = React.useCallback(function () {
2575
- if (!embla) return;
2576
- setSelectedIndex(embla.selectedScrollSnap());
2577
- }, [embla, setSelectedIndex]);
2578
- React.useEffect(function () {
2579
- if (!embla) return;
2580
- onSelect();
2581
- embla.on('select', onSelect);
2582
- }, [embla, onSelect]);
2583
-
2584
- if (images.length === 1) {
2585
- var image = images[0];
2586
- return /*#__PURE__*/React__default['default'].createElement(index.Box, index._extends({
2587
- width: imgWidth,
2588
- height: imgHeight
2589
- }, props), /*#__PURE__*/React__default['default'].createElement("img", {
2590
- style: {
2591
- width: '100%',
2592
- height: '100%',
2593
- objectFit: 'cover'
2594
- },
2595
- src: image.src,
2596
- alt: image.alt
2597
- }));
2598
- }
2599
-
2600
- return /*#__PURE__*/React__default['default'].createElement(index.Box, index._extends({
2601
- as: "section",
2602
- position: "relative",
2603
- overflow: "hidden",
2604
- width: imgWidth
2605
- }, props), /*#__PURE__*/React__default['default'].createElement(index.Box, {
2606
- ref: viewportRef
2607
- }, /*#__PURE__*/React__default['default'].createElement(index.Box, {
2608
- display: "flex",
2609
- role: "group"
2610
- }, index.map(images).call(images, function (image, index$1) {
2611
- var _context;
2612
-
2613
- return /*#__PURE__*/React__default['default'].createElement(index.Box, {
2614
- position: "relative",
2615
- flex: "0 0 100%",
2616
- key: index$1,
2617
- "aria-label": index.concat(_context = "Slide ".concat(index$1 + 1, " of ")).call(_context, images.length)
2618
- }, /*#__PURE__*/React__default['default'].createElement(index.Box, {
2619
- position: "relative",
2620
- height: imgHeight
2621
- }, /*#__PURE__*/React__default['default'].createElement("img", {
2622
- style: {
2623
- width: '100%',
2624
- height: '100%',
2625
- objectFit: 'cover'
2626
- },
2627
- src: image.src,
2628
- alt: image.alt
2629
- })));
2630
- }))), /*#__PURE__*/React__default['default'].createElement(index._default, {
2631
- onClick: scrollPrev,
2632
- width: "16",
2633
- height: "100%",
2634
- position: "absolute",
2635
- left: "0",
2636
- top: "0",
2637
- bg: "none",
2638
- borderRadius: "0",
2639
- border: "0",
2640
- _hover: {
2641
- bg: 'none',
2642
- border: 0
2643
- },
2644
- _focus: {
2645
- boxShadow: 'none'
2646
- },
2647
- padding: "3"
2648
- }, /*#__PURE__*/React__default['default'].createElement(index.Box, {
2649
- width: "100%",
2650
- padding: "3",
2651
- borderRadius: "50%",
2652
- bgColor: "black",
2653
- opacity: "0.6"
2654
- }, /*#__PURE__*/React__default['default'].createElement(chevronLeft, null))), /*#__PURE__*/React__default['default'].createElement(index._default, {
2655
- onClick: scrollNext,
2656
- width: "16",
2657
- height: "100%",
2658
- position: "absolute",
2659
- right: "0",
2660
- top: "0",
2661
- bg: "none",
2662
- borderRadius: "0",
2663
- border: "0",
2664
- _hover: {
2665
- bg: 'none',
2666
- border: 0
2667
- },
2668
- _focus: {
2669
- boxShadow: 'none'
2670
- },
2671
- padding: "3"
2672
- }, /*#__PURE__*/React__default['default'].createElement(index.Box, {
2673
- width: "100%",
2674
- padding: "3",
2675
- borderRadius: "50%",
2676
- bgColor: "black",
2677
- opacity: "0.6"
2678
- }, /*#__PURE__*/React__default['default'].createElement(chevronRight, null))), /*#__PURE__*/React__default['default'].createElement(index.Box, {
2679
- color: "white",
2680
- borderRadius: "1rem",
2681
- bgColor: "black",
2682
- opacity: "0.6",
2683
- paddingX: 3,
2684
- paddingY: 1,
2685
- fontSize: "xs",
2686
- position: "absolute",
2687
- bottom: 3,
2688
- left: "50%",
2689
- transform: "translateX(-50%)"
2690
- }, selectedIndex + 1, "/", images.length));
2691
- };
2692
-
2693
- __signature__(ImageCarousel, "useEmblaCarousel{[viewportRef, embla]}\nuseState{[selectedIndex, setSelectedIndex](0)}\nuseCallback{scrollPrev}\nuseCallback{scrollNext}\nuseCallback{onSelect}\nuseEffect{}", function () {
2694
- return [useEmblaCarousel];
2695
- });
2696
-
2697
- ImageCarousel.propTypes = {
2698
- /** Array of images with src and alt */
2699
- images: PropTypes__default['default'].arrayOf(PropTypes__default['default'].shape({
2700
- src: PropTypes__default['default'].string.isRequired,
2701
- alt: PropTypes__default['default'].string.isRequired
2702
- })).isRequired,
2703
-
2704
- /** Height of the carousel in rem */
2705
- height: PropTypes__default['default'].number.isRequired,
2706
-
2707
- /** Width of the carousel in rem */
2708
- width: PropTypes__default['default'].number
2709
- };
2710
- var _default = ImageCarousel;
2711
-
2712
- (function () {
2713
- var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
2714
-
2715
- if (!reactHotLoader) {
2716
- return;
2717
- }
2718
-
2719
- reactHotLoader.register(ImageCarousel, "ImageCarousel", "/tmp/build/44cb8d9a/src/src/v2/components/ImageCarousel/ImageCarousel.jsx");
2720
- reactHotLoader.register(_default, "default", "/tmp/build/44cb8d9a/src/src/v2/components/ImageCarousel/ImageCarousel.jsx");
2721
- })();
2722
-
2723
- (function () {
2724
- var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
2725
- leaveModule && leaveModule(module);
2726
- })();
2727
-
2728
- exports.default = _default;
2729
- //# sourceMappingURL=ImageCarousel-0575526b.js.map