@micromag/core 0.3.767 → 0.3.769

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.
@@ -0,0 +1,4500 @@
1
+ 'use strict';
2
+
3
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
+ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
5
+ var classNames = require('classnames');
6
+ var PropTypes = require('prop-types');
7
+ var React = require('react');
8
+ var wouter = require('wouter');
9
+ var core = require('@micromag/core');
10
+ var reactIntl = require('react-intl');
11
+ var utils = require('@micromag/core/utils');
12
+ var reactFontawesome = require('@fortawesome/react-fontawesome');
13
+ var faAngleLeft = require('@fortawesome/free-solid-svg-icons/faAngleLeft');
14
+ var faClose = require('@fortawesome/free-solid-svg-icons/faClose');
15
+ var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
16
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
17
+ var hooks = require('@micromag/core/hooks');
18
+ var contexts = require('@micromag/core/contexts');
19
+ var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
20
+ var get = require('lodash/get');
21
+ var queryString = require('query-string');
22
+ var reactDom = require('react-dom');
23
+ var faAngleDown = require('@fortawesome/free-solid-svg-icons/faAngleDown');
24
+ var faAngleUp = require('@fortawesome/free-solid-svg-icons/faAngleUp');
25
+ var dayjs = require('dayjs');
26
+ var throttle = require('lodash/throttle');
27
+ var isObject = require('lodash/isObject');
28
+ var reactHelmet = require('react-helmet');
29
+ var isString = require('lodash/isString');
30
+ var isArray = require('lodash/isArray');
31
+ var faAd = require('@fortawesome/free-solid-svg-icons/faAd');
32
+ var faImage = require('@fortawesome/free-solid-svg-icons/faImage');
33
+ var faMusic = require('@fortawesome/free-solid-svg-icons/faMusic');
34
+ var isNumber = require('lodash/isNumber');
35
+ var faMapMarkerAlt = require('@fortawesome/free-solid-svg-icons/faMapMarkerAlt');
36
+ var faMapMarkedAlt = require('@fortawesome/free-solid-svg-icons/faMapMarkedAlt');
37
+ var faVideo = require('@fortawesome/free-solid-svg-icons/faVideo');
38
+ var faPlay = require('@fortawesome/free-solid-svg-icons/faPlay');
39
+ var faRedo = require('@fortawesome/free-solid-svg-icons/faRedo');
40
+ var size = require('@folklore/size');
41
+ var faCommentDots = require('@fortawesome/free-solid-svg-icons/faCommentDots');
42
+ var faCheck = require('@fortawesome/free-solid-svg-icons/faCheck');
43
+ var faTimes = require('@fortawesome/free-solid-svg-icons/faTimes');
44
+ var faCircle = require('@fortawesome/free-solid-svg-icons/faCircle');
45
+ var faPercent = require('@fortawesome/free-solid-svg-icons/faPercent');
46
+ var core$1 = require('@react-spring/core');
47
+ var web = require('@react-spring/web');
48
+
49
+ /* eslint-disable react/jsx-props-no-spreading */
50
+ var propTypes$T = {
51
+ children: core.PropTypes.label.isRequired,
52
+ isHtml: PropTypes.bool,
53
+ values: PropTypes.object // eslint-disable-line react/forbid-prop-types
54
+ };
55
+ var defaultProps$T = {
56
+ isHtml: false,
57
+ values: {}
58
+ };
59
+ var Label = function Label(_ref) {
60
+ var children = _ref.children,
61
+ isHtml = _ref.isHtml,
62
+ values = _ref.values;
63
+ var Message = isHtml ? reactIntl.FormattedMessage : reactIntl.FormattedMessage;
64
+ return utils.isMessage(children) ? /*#__PURE__*/React.createElement(Message, Object.assign({
65
+ values: values
66
+ }, children)) : children;
67
+ };
68
+ Label.propTypes = propTypes$T;
69
+ Label.defaultProps = defaultProps$T;
70
+
71
+ var styles$y = {"container":"micromag-core-buttons-button-container","asLink":"micromag-core-buttons-button-asLink","withoutStyle":"micromag-core-buttons-button-withoutStyle","icon":"micromag-core-buttons-button-icon","label":"micromag-core-buttons-button-label","withIcon":"micromag-core-buttons-button-withIcon","right":"micromag-core-buttons-button-right","withIconColumns":"micromag-core-buttons-button-withIconColumns","linkDisabled":"micromag-core-buttons-button-linkDisabled"};
72
+
73
+ var _excluded$c = ["type", "theme", "size", "href", "external", "direct", "target", "label", "children", "focusable", "active", "icon", "iconPosition", "disabled", "loading", "disableOnLoading", "small", "big", "withShadow", "withoutStyle", "withoutBootstrapStyles", "withoutTheme", "asLink", "outline", "onClick", "className", "iconClassName", "labelClassName", "refButton"];
74
+ var propTypes$S = {
75
+ type: PropTypes.string,
76
+ theme: core.PropTypes.buttonTheme,
77
+ size: core.PropTypes.buttonSize,
78
+ href: PropTypes.string,
79
+ external: PropTypes.bool,
80
+ direct: PropTypes.bool,
81
+ target: PropTypes.string,
82
+ label: core.PropTypes.label,
83
+ children: core.PropTypes.label,
84
+ focusable: PropTypes.bool,
85
+ active: PropTypes.bool,
86
+ icon: PropTypes.node,
87
+ iconPosition: PropTypes.oneOf(['left', 'right', 'inline']),
88
+ disabled: PropTypes.bool,
89
+ loading: PropTypes.bool,
90
+ disableOnLoading: PropTypes.bool,
91
+ small: PropTypes.bool,
92
+ big: PropTypes.bool,
93
+ withShadow: PropTypes.bool,
94
+ withoutStyle: PropTypes.bool,
95
+ withoutBootstrapStyles: PropTypes.bool,
96
+ withoutTheme: PropTypes.bool,
97
+ outline: PropTypes.bool,
98
+ asLink: PropTypes.bool,
99
+ className: PropTypes.string,
100
+ iconClassName: PropTypes.string,
101
+ labelClassName: PropTypes.string,
102
+ onClick: PropTypes.func,
103
+ refButton: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
104
+ current: PropTypes.any // eslint-disable-line
105
+ })])
106
+ };
107
+ var defaultProps$S = {
108
+ type: 'button',
109
+ theme: null,
110
+ size: null,
111
+ href: null,
112
+ external: false,
113
+ direct: false,
114
+ target: '_blank',
115
+ label: null,
116
+ children: null,
117
+ focusable: true,
118
+ active: false,
119
+ icon: null,
120
+ iconPosition: 'inline',
121
+ disabled: false,
122
+ loading: false,
123
+ disableOnLoading: true,
124
+ small: false,
125
+ big: false,
126
+ withShadow: false,
127
+ withoutStyle: false,
128
+ withoutBootstrapStyles: false,
129
+ withoutTheme: false,
130
+ outline: false,
131
+ asLink: false,
132
+ className: null,
133
+ iconClassName: null,
134
+ labelClassName: null,
135
+ onClick: null,
136
+ refButton: null
137
+ };
138
+ var Button$1 = function Button(_ref) {
139
+ var _ref8;
140
+ var type = _ref.type,
141
+ theme = _ref.theme,
142
+ size = _ref.size,
143
+ href = _ref.href,
144
+ external = _ref.external,
145
+ direct = _ref.direct,
146
+ target = _ref.target,
147
+ label = _ref.label,
148
+ children = _ref.children,
149
+ focusable = _ref.focusable,
150
+ active = _ref.active,
151
+ icon = _ref.icon,
152
+ iconPosition = _ref.iconPosition,
153
+ disabled = _ref.disabled,
154
+ loading = _ref.loading,
155
+ disableOnLoading = _ref.disableOnLoading,
156
+ small = _ref.small,
157
+ big = _ref.big,
158
+ withShadow = _ref.withShadow,
159
+ withoutStyle = _ref.withoutStyle,
160
+ withoutBootstrapStyles = _ref.withoutBootstrapStyles,
161
+ withoutTheme = _ref.withoutTheme,
162
+ asLink = _ref.asLink,
163
+ outline = _ref.outline,
164
+ onClick = _ref.onClick,
165
+ className = _ref.className,
166
+ iconClassName = _ref.iconClassName,
167
+ labelClassName = _ref.labelClassName,
168
+ refButton = _ref.refButton,
169
+ props = _objectWithoutProperties(_ref, _excluded$c);
170
+ var finalLabel = label || children;
171
+ var text = finalLabel !== null ? /*#__PURE__*/React.createElement(Label, null, finalLabel) : null;
172
+ var hasChildren = label !== null && children !== null;
173
+ var hasIcon = icon !== null;
174
+ var hasInlineIcon = hasIcon && (iconPosition === 'inline' || text === null);
175
+ var hasIconColumns = hasIcon && !hasInlineIcon;
176
+ var content = /*#__PURE__*/React.createElement(React.Fragment, null, hasInlineIcon ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
177
+ className: classNames([styles$y.icon, _defineProperty({}, iconClassName, iconClassName !== null)])
178
+ }, icon), text !== null ? /*#__PURE__*/React.createElement("span", {
179
+ className: classNames([styles$y.label, _defineProperty({}, labelClassName, labelClassName !== null)])
180
+ }, text) : null) : null, hasIconColumns ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
181
+ className: classNames([styles$y.left, _defineProperty({}, iconClassName, iconClassName !== null && iconPosition === 'left')])
182
+ }, iconPosition === 'left' ? icon : null), /*#__PURE__*/React.createElement("span", {
183
+ className: classNames([styles$y.center, _defineProperty({}, labelClassName, labelClassName !== null)])
184
+ }, text), /*#__PURE__*/React.createElement("span", {
185
+ className: classNames([styles$y.right, _defineProperty({}, iconClassName, iconClassName !== null && iconPosition === 'right')])
186
+ }, iconPosition === 'right' ? icon : null), hasChildren ? children : null) : null, !hasIcon ? text : null, hasChildren ? children : null);
187
+ var withStyle = !withoutTheme && !withoutStyle && !asLink;
188
+ var buttonClassNames = classNames([!withoutBootstrapStyles ? _defineProperty(_defineProperty(_defineProperty({
189
+ btn: withStyle
190
+ }, "btn-".concat(outline ? 'outline-' : '').concat(theme), withStyle && theme !== null), "btn-".concat(size), withStyle && size !== null), "active", !withoutStyle && active) : null, styles$y.container, (_ref8 = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref8, styles$y.withoutStyle, withoutStyle), styles$y.withIcon, hasIcon), styles$y.withIconColumns, hasIconColumns), styles$y.withText, text !== null), styles$y.withShadow, withShadow), styles$y.isSmall, small), styles$y.isBig, big), styles$y.isLink, href !== null), styles$y.asLink, asLink), styles$y.isDisabled, disabled), _defineProperty(_defineProperty(_ref8, styles$y.isLoading, loading), className, className !== null))]);
191
+ if (href !== null) {
192
+ var linkClassNames = classNames([buttonClassNames, _defineProperty({
193
+ disabled: disabled
194
+ }, styles$y.linkDisabled, disabled)]);
195
+ return external || direct ? /*#__PURE__*/React.createElement("a", Object.assign({}, props, {
196
+ href: disabled ? null : href,
197
+ className: linkClassNames,
198
+ onClick: onClick,
199
+ target: external ? target : null,
200
+ ref: refButton,
201
+ tabIndex: focusable ? '' : '-1'
202
+ }), content) : /*#__PURE__*/React.createElement(wouter.Link, {
203
+ href: href,
204
+ className: linkClassNames,
205
+ onClick: onClick,
206
+ ref: refButton,
207
+ tabIndex: focusable ? '' : '-1'
208
+ }, content);
209
+ }
210
+ return /*#__PURE__*/React.createElement("button", Object.assign({}, props, {
211
+ type: type,
212
+ className: buttonClassNames,
213
+ onClick: onClick,
214
+ disabled: disabled || disableOnLoading && loading,
215
+ ref: refButton,
216
+ tabIndex: focusable ? '0' : '-1'
217
+ }), content);
218
+ };
219
+ Button$1.propTypes = propTypes$S;
220
+ Button$1.defaultProps = defaultProps$S;
221
+
222
+ var styles$x = {};
223
+
224
+ var _excluded$b = ["className", "onClick", "theme"];
225
+ var propTypes$R = {
226
+ buttons: core.PropTypes.buttons,
227
+ size: core.PropTypes.buttonSize,
228
+ theme: core.PropTypes.buttonTheme,
229
+ renderButton: PropTypes.func,
230
+ onClickButton: PropTypes.func,
231
+ className: PropTypes.string,
232
+ buttonClassName: PropTypes.string
233
+ };
234
+ var defaultProps$R = {
235
+ buttons: [],
236
+ size: null,
237
+ theme: undefined,
238
+ renderButton: null,
239
+ onClickButton: null,
240
+ className: null,
241
+ buttonClassName: null
242
+ };
243
+ var Buttons = function Buttons(_ref) {
244
+ var buttons = _ref.buttons,
245
+ size = _ref.size,
246
+ theme = _ref.theme,
247
+ renderButton = _ref.renderButton,
248
+ onClickButton = _ref.onClickButton,
249
+ buttonClassName = _ref.buttonClassName,
250
+ className = _ref.className;
251
+ return /*#__PURE__*/React.createElement("div", {
252
+ className: classNames(['btn-group', _defineProperty({}, "btn-group-".concat(size), size !== null), styles$x.container, _defineProperty({}, className, className !== null)]),
253
+ role: "group"
254
+ }, buttons.map(function (button, index) {
255
+ var _button$className = button.className,
256
+ customClassName = _button$className === void 0 ? null : _button$className,
257
+ _button$onClick = button.onClick,
258
+ _onClick = _button$onClick === void 0 ? null : _button$onClick,
259
+ _button$theme = button.theme,
260
+ buttonTheme = _button$theme === void 0 ? null : _button$theme,
261
+ buttonProps = _objectWithoutProperties(button, _excluded$b);
262
+ var fixedProps = {
263
+ key: "button-".concat(index),
264
+ className: classNames([styles$x.button, _defineProperty(_defineProperty({}, buttonClassName, buttonClassName !== null), customClassName, customClassName !== null)]),
265
+ onClick: function onClick(e) {
266
+ if (_onClick !== null) {
267
+ _onClick(e, button, index);
268
+ }
269
+ if (onClickButton !== null) {
270
+ onClickButton(e, button, index);
271
+ }
272
+ },
273
+ theme: buttonTheme || theme
274
+ };
275
+ return renderButton !== null ? renderButton(button, index, fixedProps) : /*#__PURE__*/React.createElement(Button$1, Object.assign({}, fixedProps, buttonProps));
276
+ }));
277
+ };
278
+ Buttons.propTypes = propTypes$R;
279
+ Buttons.defaultProps = defaultProps$R;
280
+
281
+ var _excluded$a = ["className"];
282
+ var propTypes$Q = {
283
+ className: PropTypes.string
284
+ };
285
+ var defaultProps$Q = {
286
+ className: null
287
+ };
288
+ var BackButton = function BackButton(_ref) {
289
+ var className = _ref.className,
290
+ props = _objectWithoutProperties(_ref, _excluded$a);
291
+ return /*#__PURE__*/React.createElement(Button$1, Object.assign({
292
+ className: classNames(['px-2', _defineProperty({}, className, className)]),
293
+ size: "sm",
294
+ icon: /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
295
+ icon: faAngleLeft.faAngleLeft,
296
+ size: "lg"
297
+ })
298
+ }, props));
299
+ };
300
+ BackButton.propTypes = propTypes$Q;
301
+ BackButton.defaultProps = defaultProps$Q;
302
+
303
+ var styles$w = {"container":"micromag-core-buttons-clear-container","icon":"micromag-core-buttons-clear-icon"};
304
+
305
+ var _excluded$9 = ["onClick", "className"];
306
+ var propTypes$P = {
307
+ onClick: PropTypes.func,
308
+ className: PropTypes.string
309
+ };
310
+ var defaultProps$P = {
311
+ onClick: null,
312
+ className: null
313
+ };
314
+ var ClearButton = function ClearButton(_ref) {
315
+ var onClick = _ref.onClick,
316
+ className = _ref.className,
317
+ props = _objectWithoutProperties(_ref, _excluded$9);
318
+ return /*#__PURE__*/React.createElement("button", Object.assign({
319
+ className: classNames([styles$w.container, _defineProperty({}, className, className)]),
320
+ onClick: onClick
321
+ }, props), /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
322
+ className: styles$w.icon,
323
+ icon: faClose.faClose,
324
+ size: "md"
325
+ }));
326
+ };
327
+ ClearButton.propTypes = propTypes$P;
328
+ ClearButton.defaultProps = defaultProps$P;
329
+
330
+ var _excluded$8 = ["type"],
331
+ _excluded2 = ["component", "id", "settings"];
332
+ var propTypes$O = {
333
+ name: PropTypes.string,
334
+ // .isRequired,
335
+ value: core.PropTypes.component,
336
+ form: PropTypes.string,
337
+ formComponents: core.PropTypes.components,
338
+ fields: core.PropTypes.fields,
339
+ className: PropTypes.string,
340
+ onChange: PropTypes.func,
341
+ gotoFieldForm: PropTypes.func.isRequired,
342
+ closeFieldForm: PropTypes.func.isRequired,
343
+ fieldContext: PropTypes.any // eslint-disable-line react/forbid-prop-types
344
+ };
345
+ var defaultProps$O = {
346
+ name: null,
347
+ form: null,
348
+ formComponents: {},
349
+ fields: [],
350
+ value: null,
351
+ className: null,
352
+ onChange: null,
353
+ fieldContext: null
354
+ };
355
+ var FieldForm = function FieldForm(_ref) {
356
+ var name = _ref.name,
357
+ value = _ref.value,
358
+ form = _ref.form,
359
+ formComponents = _ref.formComponents,
360
+ fields = _ref.fields,
361
+ className = _ref.className,
362
+ onChange = _ref.onChange,
363
+ gotoFieldForm = _ref.gotoFieldForm,
364
+ closeFieldForm = _ref.closeFieldForm,
365
+ fieldContext = _ref.fieldContext;
366
+ var fieldsManager = contexts.useFieldsManager();
367
+ var field = utils.getFieldFromPath(name.split('.'), fields, fieldsManager);
368
+ var parentField = name.match(/\.[0-9]+$/) !== null ? utils.getFieldFromPath(name.split('.').slice(0, -1), fields, fieldsManager) : null;
369
+ var _ref2 = field || {},
370
+ _ref2$type = _ref2.type,
371
+ type = _ref2$type === void 0 ? null : _ref2$type,
372
+ fieldProps = _objectWithoutProperties(_ref2, _excluded$8);
373
+ var fieldDefinition = fieldsManager.getDefinition(type) || null;
374
+ var fieldData = fieldDefinition || _objectSpread({}, field);
375
+ var _ref3 = fieldData || {},
376
+ _ref3$component = _ref3.component,
377
+ fieldComponent = _ref3$component === void 0 ? null : _ref3$component;
378
+ _ref3.id;
379
+ _ref3.settings;
380
+ var definitionProps = _objectWithoutProperties(_ref3, _excluded2);
381
+ var FieldComponent = contexts.useFieldComponent(fieldComponent);
382
+ var FormComponent = utils.getComponentFromName(form, formComponents);
383
+ var fieldValue = get(value, name, null);
384
+ var onFieldChange = function onFieldChange(newFieldValue) {
385
+ // const { name, fields: subFields = null } = field || {};
386
+ var newValue = utils.setFieldValue(value, name.split('.'), newFieldValue
387
+ // field === null || subFields !== null ? newFieldValue : newFieldValue[name],
388
+ );
389
+ if (onChange !== null) {
390
+ onChange(newValue);
391
+ }
392
+ };
393
+ var closeForm = React.useCallback(function () {
394
+ return closeFieldForm(name, form);
395
+ }, [name, form, closeFieldForm]);
396
+ var formProps = {
397
+ name: name,
398
+ value: fieldValue,
399
+ onChange: onFieldChange,
400
+ gotoFieldForm: gotoFieldForm,
401
+ closeFieldForm: closeFieldForm,
402
+ closeForm: closeForm
403
+ };
404
+ if (form !== null) {
405
+ return FormComponent !== null ? /*#__PURE__*/React.createElement(contexts.FieldContextProvider, {
406
+ context: fieldContext
407
+ }, /*#__PURE__*/React.createElement(FormComponent, Object.assign({
408
+ field: field
409
+ }, formProps, {
410
+ className: className
411
+ }))) : null;
412
+ }
413
+ var _ref4 = parentField || {},
414
+ itemsProps = _ref4.itemsProps;
415
+
416
+ // Use field component with isForm props
417
+ return FieldComponent !== null ? /*#__PURE__*/React.createElement(contexts.FieldContextProvider, {
418
+ context: fieldContext
419
+ }, /*#__PURE__*/React.createElement(FieldComponent, Object.assign({
420
+ className: className
421
+ }, definitionProps, fieldProps, itemsProps, {
422
+ isForm: true
423
+ }, formProps))) : null;
424
+ };
425
+ FieldForm.propTypes = propTypes$O;
426
+ FieldForm.defaultProps = defaultProps$O;
427
+
428
+ var styles$v = {"actions":"micromag-core-forms-form-actions","left":"micromag-core-forms-form-left","right":"micromag-core-forms-form-right"};
429
+
430
+ var propTypes$N = {
431
+ action: PropTypes.string.isRequired,
432
+ method: PropTypes.string,
433
+ fields: core.PropTypes.formFields,
434
+ initialValue: PropTypes.object,
435
+ // eslint-disable-line react/forbid-prop-types
436
+ postForm: PropTypes.func,
437
+ submitButtonLabel: core.PropTypes.label,
438
+ submitButtonLoadingLabel: core.PropTypes.label,
439
+ submitButtonTheme: PropTypes.string,
440
+ cancelButtonTheme: PropTypes.string,
441
+ buttons: core.PropTypes.buttons,
442
+ children: PropTypes.node,
443
+ actionsAlign: PropTypes.oneOf(['left', 'right']),
444
+ withoutActions: PropTypes.bool,
445
+ withoutComplete: PropTypes.bool,
446
+ withoutBackButton: PropTypes.bool,
447
+ onComplete: PropTypes.func,
448
+ onResponse: PropTypes.func,
449
+ onMessage: PropTypes.func,
450
+ onCancel: PropTypes.func,
451
+ onCancelHref: PropTypes.string,
452
+ onOpenFieldForm: PropTypes.func,
453
+ onCloseFieldForm: PropTypes.func,
454
+ className: PropTypes.string,
455
+ fieldsClassName: PropTypes.string,
456
+ actionsClassName: PropTypes.string,
457
+ cancelClassName: PropTypes.string
458
+ };
459
+ var defaultProps$N = {
460
+ method: 'POST',
461
+ fields: [],
462
+ initialValue: null,
463
+ postForm: null,
464
+ submitButtonLabel: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
465
+ id: "ZLDmja",
466
+ defaultMessage: [{
467
+ "type": 0,
468
+ "value": "Submit"
469
+ }]
470
+ }),
471
+ submitButtonLoadingLabel: null,
472
+ submitButtonTheme: null,
473
+ cancelButtonTheme: null,
474
+ buttons: null,
475
+ children: null,
476
+ actionsAlign: 'left',
477
+ withoutActions: false,
478
+ withoutComplete: false,
479
+ withoutBackButton: false,
480
+ onComplete: null,
481
+ onResponse: null,
482
+ onMessage: null,
483
+ onCancel: null,
484
+ onCancelHref: null,
485
+ onOpenFieldForm: null,
486
+ onCloseFieldForm: null,
487
+ className: null,
488
+ fieldsClassName: null,
489
+ actionsClassName: null,
490
+ cancelClassName: null
491
+ };
492
+ var Form = function Form(_ref) {
493
+ var action = _ref.action,
494
+ method = _ref.method,
495
+ initialFields = _ref.fields,
496
+ initialValue = _ref.initialValue,
497
+ postForm = _ref.postForm,
498
+ submitButtonLabel = _ref.submitButtonLabel,
499
+ submitButtonLoadingLabel = _ref.submitButtonLoadingLabel,
500
+ submitButtonTheme = _ref.submitButtonTheme,
501
+ cancelButtonTheme = _ref.cancelButtonTheme,
502
+ buttons = _ref.buttons,
503
+ children = _ref.children,
504
+ actionsAlign = _ref.actionsAlign,
505
+ withoutActions = _ref.withoutActions,
506
+ withoutComplete = _ref.withoutComplete,
507
+ withoutBackButton = _ref.withoutBackButton,
508
+ onComplete = _ref.onComplete,
509
+ onResponse = _ref.onResponse,
510
+ onMessage = _ref.onMessage,
511
+ onCancel = _ref.onCancel,
512
+ onCancelHref = _ref.onCancelHref,
513
+ onOpenFieldForm = _ref.onOpenFieldForm,
514
+ onCloseFieldForm = _ref.onCloseFieldForm,
515
+ className = _ref.className,
516
+ fieldsClassName = _ref.fieldsClassName,
517
+ actionsClassName = _ref.actionsClassName,
518
+ cancelClassName = _ref.cancelClassName;
519
+ var _useState = React.useState(false),
520
+ _useState2 = _slicedToArray(_useState, 2),
521
+ complete = _useState2[0],
522
+ setComplete = _useState2[1];
523
+ React.useEffect(function () {
524
+ var id = null;
525
+ if (complete) {
526
+ id = setTimeout(function () {
527
+ setComplete(false);
528
+ }, 3000);
529
+ }
530
+ return function () {
531
+ clearTimeout(id);
532
+ };
533
+ }, [complete]);
534
+ var onCompleteForm = React.useCallback(function (data) {
535
+ if (onComplete !== null) {
536
+ onComplete(data);
537
+ }
538
+ if (!withoutComplete) {
539
+ setComplete(true);
540
+ }
541
+ }, [onComplete, setComplete]);
542
+ var _useForm = hooks.useForm({
543
+ value: initialValue,
544
+ action: action,
545
+ fields: initialFields,
546
+ postForm: postForm,
547
+ onComplete: onCompleteForm
548
+ }),
549
+ onSubmit = _useForm.onSubmit,
550
+ fields = _useForm.fields,
551
+ status = _useForm.status,
552
+ value = _useForm.value,
553
+ setValue = _useForm.setValue,
554
+ errors = _useForm.errors,
555
+ response = _useForm.response,
556
+ generalError = _useForm.generalError;
557
+ var FieldsComponent = contexts.useFieldComponent('fields');
558
+ React.useEffect(function () {
559
+ if (onResponse !== null) {
560
+ onResponse(response);
561
+ if (onMessage !== null && response && response.message) {
562
+ onMessage(response.message);
563
+ }
564
+ }
565
+ }, [response, onResponse, onMessage]);
566
+ var canSave = utils.validateFields(fields, value);
567
+ var _useState3 = React.useState([]),
568
+ _useState4 = _slicedToArray(_useState3, 2),
569
+ fieldPaths = _useState4[0],
570
+ setFieldPaths = _useState4[1];
571
+ var gotoFieldForm = React.useCallback(function (field) {
572
+ var formName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
573
+ var fieldKey = "".concat(field).concat(formName !== null ? ":".concat(formName) : '');
574
+ setFieldPaths([].concat(_toConsumableArray(fieldPaths), [fieldKey]));
575
+ if (onOpenFieldForm !== null) {
576
+ onOpenFieldForm();
577
+ }
578
+ }, [fieldPaths, setFieldPaths]);
579
+ var closeFieldForm = React.useCallback(function () {
580
+ var newFields = _toConsumableArray(fieldPaths);
581
+ newFields.pop();
582
+ setFieldPaths(_toConsumableArray(newFields));
583
+ if (onCloseFieldForm !== null) {
584
+ onCloseFieldForm();
585
+ }
586
+ }, [fieldPaths, setFieldPaths]);
587
+
588
+ // The last path
589
+ var fieldParams = fieldPaths.length > 0 ? fieldPaths[fieldPaths.length - 1] : null;
590
+ var fieldName = fieldParams !== null ? fieldParams.replace(/\//g, '.') : null;
591
+
592
+ // Get transition value
593
+ // const { name: transitionName, timeout: transitionTimeout } = useFormTransition(
594
+ // fieldPaths,
595
+ // styles,
596
+ // );
597
+
598
+ return /*#__PURE__*/React.createElement("form", {
599
+ action: action,
600
+ className: classNames([styles$v.container, _defineProperty({}, className, className !== null)]),
601
+ method: method,
602
+ onSubmit: onSubmit
603
+ }, !withoutBackButton && fields !== null && fields.length > 0 && fieldParams !== null ? /*#__PURE__*/React.createElement("div", {
604
+ className: "mb-2"
605
+ }, /*#__PURE__*/React.createElement(BackButton, {
606
+ theme: "secondary",
607
+ outline: true,
608
+ onClick: closeFieldForm
609
+ })) : null, fields !== null && fields.length > 0 && fieldParams !== null ? /*#__PURE__*/React.createElement("div", {
610
+ className: classNames(['w-100', styles$v.panel]),
611
+ key: "field"
612
+ }, /*#__PURE__*/React.createElement(FieldForm, {
613
+ name: fieldName,
614
+ fields: fields,
615
+ value: value,
616
+ onChange: setValue,
617
+ gotoFieldForm: gotoFieldForm,
618
+ closeFieldForm: closeFieldForm
619
+ })) : null, FieldsComponent && fields !== null && fields.length > 0 && fieldParams === null ? /*#__PURE__*/React.createElement(FieldsComponent, {
620
+ fields: fields,
621
+ value: value,
622
+ errors: errors,
623
+ onChange: setValue,
624
+ gotoFieldForm: gotoFieldForm,
625
+ closeFieldForm: closeFieldForm,
626
+ className: classNames([styles$v.fields, _defineProperty({}, fieldsClassName, fieldsClassName !== null)])
627
+ }) : null, generalError ? /*#__PURE__*/React.createElement("p", {
628
+ className: "text-danger my-1"
629
+ }, generalError) : null, children, !withoutActions && fieldParams === null ? /*#__PURE__*/React.createElement("div", {
630
+ className: classNames([styles$v.actions, _defineProperty(_defineProperty({}, styles$v[actionsAlign], actionsAlign), actionsClassName, actionsClassName !== null)])
631
+ }, onCancel !== null || onCancelHref !== null ? /*#__PURE__*/React.createElement(Button$1, {
632
+ type: "button",
633
+ onClick: onCancel,
634
+ href: onCancelHref,
635
+ theme: cancelButtonTheme || 'secondary',
636
+ outline: true,
637
+ disabled: status === 'loading',
638
+ className: classNames(['me-2', _defineProperty({}, cancelClassName, cancelClassName !== null)])
639
+ }, /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
640
+ id: "PyxZY2",
641
+ defaultMessage: [{
642
+ "type": 0,
643
+ "value": "Cancel"
644
+ }]
645
+ })) : null, buttons !== null ? /*#__PURE__*/React.createElement(Buttons, {
646
+ buttons: buttons,
647
+ className: styles$v.buttons
648
+ }) : /*#__PURE__*/React.createElement(Button$1, {
649
+ type: "submit",
650
+ theme: submitButtonTheme || 'primary',
651
+ disabled: status === 'loading' || !canSave
652
+ }, status === 'loading' ? submitButtonLoadingLabel || submitButtonLabel : submitButtonLabel), complete ? /*#__PURE__*/React.createElement("p", {
653
+ className: "text-success mx-2 my-1"
654
+ }, /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
655
+ id: "BpZoQZ",
656
+ defaultMessage: [{
657
+ "type": 0,
658
+ "value": "Success"
659
+ }]
660
+ })) : null) : null);
661
+ };
662
+ Form.propTypes = propTypes$N;
663
+ Form.defaultProps = defaultProps$N;
664
+
665
+ var styles$u = {"withoutStyle":"micromag-core-partials-link-withoutStyle"};
666
+
667
+ var _excluded$7 = ["href", "external", "children", "target", "rel", "className", "withoutStyle"];
668
+ var propTypes$M = {
669
+ href: PropTypes.string,
670
+ external: PropTypes.bool,
671
+ target: PropTypes.string,
672
+ children: core.PropTypes.label,
673
+ rel: PropTypes.string,
674
+ withoutStyle: PropTypes.bool,
675
+ className: PropTypes.string
676
+ };
677
+ var defaultProps$M = {
678
+ href: '',
679
+ external: false,
680
+ target: '_blank',
681
+ rel: 'noopener noreferrer',
682
+ children: null,
683
+ withoutStyle: false,
684
+ className: null
685
+ };
686
+ var Link = function Link(_ref) {
687
+ var href = _ref.href,
688
+ external = _ref.external,
689
+ children = _ref.children,
690
+ target = _ref.target,
691
+ rel = _ref.rel,
692
+ className = _ref.className,
693
+ withoutStyle = _ref.withoutStyle,
694
+ props = _objectWithoutProperties(_ref, _excluded$7);
695
+ return external ? /*#__PURE__*/React.createElement("a", Object.assign({
696
+ className: classNames([className, _defineProperty({}, styles$u.withoutStyle, withoutStyle)]),
697
+ href: href,
698
+ target: target,
699
+ rel: rel
700
+ }, props), /*#__PURE__*/React.createElement(Label, null, children)) : /*#__PURE__*/React.createElement(wouter.Link, Object.assign({
701
+ className: classNames([className, _defineProperty({}, styles$u.withoutStyle, withoutStyle)]),
702
+ href: href
703
+ }, props), /*#__PURE__*/React.createElement(Label, null, children));
704
+ };
705
+ Link.propTypes = propTypes$M;
706
+ Link.defaultProps = defaultProps$M;
707
+
708
+ var _excluded$6 = ["label", "className"];
709
+ var propTypes$L = {
710
+ href: PropTypes.string,
711
+ header: PropTypes.node,
712
+ image: PropTypes.node,
713
+ imageAlt: PropTypes.string,
714
+ imageOverlay: PropTypes.bool,
715
+ beforeBody: PropTypes.node,
716
+ title: core.PropTypes.label,
717
+ subtitle: core.PropTypes.label,
718
+ children: PropTypes.node,
719
+ afterBody: PropTypes.node,
720
+ links: PropTypes.arrayOf(PropTypes.shape({
721
+ label: core.PropTypes.label,
722
+ href: PropTypes.string
723
+ })),
724
+ linksInSameBody: PropTypes.bool,
725
+ footer: PropTypes.node,
726
+ theme: PropTypes.oneOf([null, 'dark', 'primary', 'light']),
727
+ className: PropTypes.string,
728
+ imageClassName: PropTypes.string,
729
+ headerClassName: PropTypes.string,
730
+ titleClassName: PropTypes.string,
731
+ subtitleClassName: PropTypes.string,
732
+ bodyClassName: PropTypes.string,
733
+ footerClassName: PropTypes.string,
734
+ onClick: PropTypes.func,
735
+ onClickBody: PropTypes.func,
736
+ onClickFooter: PropTypes.func
737
+ };
738
+ var defaultProps$L = {
739
+ href: null,
740
+ header: null,
741
+ image: null,
742
+ imageAlt: null,
743
+ imageOverlay: false,
744
+ beforeBody: null,
745
+ title: null,
746
+ subtitle: null,
747
+ children: null,
748
+ afterBody: null,
749
+ links: null,
750
+ linksInSameBody: false,
751
+ footer: null,
752
+ theme: null,
753
+ className: null,
754
+ imageClassName: null,
755
+ headerClassName: null,
756
+ titleClassName: null,
757
+ subtitleClassName: null,
758
+ bodyClassName: null,
759
+ footerClassName: null,
760
+ onClick: null,
761
+ onClickBody: null,
762
+ onClickFooter: null
763
+ };
764
+ var Card = function Card(_ref) {
765
+ var href = _ref.href,
766
+ header = _ref.header,
767
+ image = _ref.image,
768
+ imageAlt = _ref.imageAlt,
769
+ imageOverlay = _ref.imageOverlay,
770
+ beforeBody = _ref.beforeBody,
771
+ title = _ref.title,
772
+ subtitle = _ref.subtitle,
773
+ children = _ref.children,
774
+ afterBody = _ref.afterBody,
775
+ links = _ref.links,
776
+ linksInSameBody = _ref.linksInSameBody,
777
+ footer = _ref.footer,
778
+ theme = _ref.theme,
779
+ className = _ref.className,
780
+ imageClassName = _ref.imageClassName,
781
+ headerClassName = _ref.headerClassName,
782
+ titleClassName = _ref.titleClassName,
783
+ subtitleClassName = _ref.subtitleClassName,
784
+ bodyClassName = _ref.bodyClassName,
785
+ footerClassName = _ref.footerClassName,
786
+ onClick = _ref.onClick,
787
+ onClickBody = _ref.onClickBody,
788
+ onClickFooter = _ref.onClickFooter;
789
+ var linksElements = (links || []).map(function (_ref2, index) {
790
+ var label = _ref2.label,
791
+ _ref2$className = _ref2.className,
792
+ linkClassName = _ref2$className === void 0 ? null : _ref2$className,
793
+ linkProps = _objectWithoutProperties(_ref2, _excluded$6);
794
+ return /*#__PURE__*/React.createElement(Link, Object.assign({
795
+ key: "link-".concat(label, "-").concat(index),
796
+ className: classNames(['card-link', _defineProperty({}, linkClassName, linkClassName !== null)])
797
+ }, linkProps), label);
798
+ });
799
+ var bodyInner = title !== null || subtitle !== null || children !== null || links !== null && linksInSameBody ? /*#__PURE__*/React.createElement(React.Fragment, null, title !== null ? /*#__PURE__*/React.createElement("h5", {
800
+ className: classNames(['card-title', _defineProperty({}, titleClassName, titleClassName !== null)])
801
+ }, /*#__PURE__*/React.createElement(Label, null, title)) : null, subtitle !== null ? /*#__PURE__*/React.createElement("h6", {
802
+ className: classNames(['card-subtitle', _defineProperty({}, subtitleClassName, subtitleClassName !== null)])
803
+ }, /*#__PURE__*/React.createElement(Label, null, subtitle)) : null, children, links !== null && linksInSameBody ? /*#__PURE__*/React.createElement("div", {
804
+ className: "d-flex"
805
+ }, linksElements) : null) : null;
806
+ var cardInner = /*#__PURE__*/React.createElement(React.Fragment, null, header !== null ? /*#__PURE__*/React.createElement("div", {
807
+ className: classNames(['card-header', _defineProperty({}, headerClassName, headerClassName !== null)])
808
+ }, /*#__PURE__*/React.createElement(Label, null, header)) : null, typeof image === 'string' ? /*#__PURE__*/React.createElement("img", {
809
+ src: image,
810
+ alt: imageAlt,
811
+ className: classNames(['card-img-top', _defineProperty({}, imageClassName, imageClassName !== null)])
812
+ }) : image, beforeBody, bodyInner !== null ? onClickBody !== null ? /*#__PURE__*/React.createElement("button", {
813
+ type: "button",
814
+ className: classNames(_defineProperty({
815
+ 'card-body': !imageOverlay,
816
+ 'card-img-overlay': imageOverlay
817
+ }, bodyClassName, bodyClassName !== null)),
818
+ onClick: onClickBody
819
+ }, bodyInner) : /*#__PURE__*/React.createElement("div", {
820
+ className: classNames(_defineProperty({
821
+ 'card-body': !imageOverlay,
822
+ 'card-img-overlay': imageOverlay
823
+ }, bodyClassName, bodyClassName !== null))
824
+ }, bodyInner) : null, afterBody, links !== null && linksElements !== null && !linksInSameBody ? /*#__PURE__*/React.createElement("div", {
825
+ className: "card-body"
826
+ }, linksElements) : null, footer !== null ? onClickFooter !== null ? /*#__PURE__*/React.createElement("button", {
827
+ type: "button",
828
+ className: classNames(['card-footer', _defineProperty({}, footerClassName, footerClassName !== null)]),
829
+ onClick: onClickFooter
830
+ }, /*#__PURE__*/React.createElement(Label, null, footer)) : /*#__PURE__*/React.createElement("div", {
831
+ className: classNames(['card-footer', _defineProperty({}, footerClassName, footerClassName !== null)])
832
+ }, /*#__PURE__*/React.createElement(Label, null, footer)) : null);
833
+ var cardClassName = classNames(['card', _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "bg-".concat(theme), !imageOverlay && theme !== 'dark'), 'bg-dark', imageOverlay || theme === 'dark'), 'text-dark', theme === 'light'), 'text-light', imageOverlay || theme === 'dark' || theme === 'primary'), className, className !== null)]);
834
+ if (href !== null) {
835
+ return /*#__PURE__*/React.createElement(Link, {
836
+ href: href,
837
+ className: cardClassName
838
+ }, cardInner);
839
+ }
840
+ if (onClick !== null) {
841
+ return /*#__PURE__*/React.createElement("button", {
842
+ type: "button",
843
+ className: classNames(['p-0', 'text-start', cardClassName]),
844
+ onClick: onClick
845
+ }, cardInner);
846
+ }
847
+ return /*#__PURE__*/React.createElement("div", {
848
+ className: cardClassName
849
+ }, cardInner);
850
+ };
851
+ Card.propTypes = propTypes$L;
852
+ Card.defaultProps = defaultProps$L;
853
+
854
+ var styles$t = {"container":"micromag-core-partials-spinner-container","path":"micromag-core-partials-spinner-path","animated":"micromag-core-partials-spinner-animated"};
855
+
856
+ var propTypes$K = {
857
+ animated: PropTypes.bool,
858
+ color: PropTypes.string,
859
+ strokeWidth: PropTypes.number,
860
+ className: PropTypes.string
861
+ };
862
+ var defaultProps$K = {
863
+ animated: true,
864
+ color: 'currentColor',
865
+ strokeWidth: 3,
866
+ className: null
867
+ };
868
+ var Spinner = function Spinner(_ref) {
869
+ var animated = _ref.animated,
870
+ color = _ref.color,
871
+ strokeWidth = _ref.strokeWidth,
872
+ className = _ref.className;
873
+ return /*#__PURE__*/React.createElement("svg", {
874
+ className: classNames([styles$t.container, _defineProperty(_defineProperty({}, styles$t.animated, animated), className, className !== null)]),
875
+ width: "40",
876
+ height: "40",
877
+ viewBox: "0 0 40 40",
878
+ xmlns: "http://www.w3.org/2000/svg"
879
+ }, /*#__PURE__*/React.createElement("circle", {
880
+ className: styles$t.path,
881
+ cx: "20",
882
+ cy: "20",
883
+ r: "12",
884
+ fill: "none",
885
+ stroke: color,
886
+ strokeWidth: strokeWidth
887
+ }));
888
+ };
889
+ Spinner.propTypes = propTypes$K;
890
+ Spinner.defaultProps = defaultProps$K;
891
+
892
+ var styles$s = {};
893
+
894
+ var _excluded$5 = ["description", "loading", "children", "className"];
895
+ var propTypes$J = {
896
+ description: PropTypes.node,
897
+ loading: PropTypes.bool,
898
+ children: PropTypes.node,
899
+ className: PropTypes.string
900
+ };
901
+ var defaultProps$J = {
902
+ description: null,
903
+ loading: false,
904
+ children: null,
905
+ className: null
906
+ };
907
+ var FormPanel = function FormPanel(_ref) {
908
+ var description = _ref.description,
909
+ loading = _ref.loading,
910
+ children = _ref.children,
911
+ className = _ref.className,
912
+ props = _objectWithoutProperties(_ref, _excluded$5);
913
+ return /*#__PURE__*/React.createElement(Card, Object.assign({
914
+ className: classNames([styles$s.container, _defineProperty({}, className, className !== null)])
915
+ }, props), description, loading ? /*#__PURE__*/React.createElement(Spinner, null) : children);
916
+ };
917
+ FormPanel.propTypes = propTypes$J;
918
+ FormPanel.defaultProps = defaultProps$J;
919
+
920
+ var propTypes$I = {
921
+ className: PropTypes.string,
922
+ color: PropTypes.string
923
+ };
924
+ var defaultProps$I = {
925
+ className: null,
926
+ color: '#fff'
927
+ };
928
+ var ArrowIcon = function ArrowIcon(_ref) {
929
+ var color = _ref.color,
930
+ className = _ref.className;
931
+ return /*#__PURE__*/React.createElement("svg", {
932
+ width: "20",
933
+ height: "14",
934
+ viewBox: "0 0 20 14",
935
+ fill: "none",
936
+ xmlns: "http://www.w3.org/2000/svg",
937
+ className: className
938
+ }, /*#__PURE__*/React.createElement("path", {
939
+ fillRule: "evenodd",
940
+ clipRule: "evenodd",
941
+ d: "M13.353 0.371014L19.319 6.33704C19.6851 6.70314 19.6851 7.29671 19.319 7.66282L13.353 13.6288C12.9869 13.9949 12.3933 13.9949 12.0272 13.6288C11.6611 13.2627 11.6611 12.6692 12.0272 12.3031L16.3929 7.9374H0V6.06246H16.3929L12.0272 1.6968C11.6611 1.33069 11.6611 0.737119 12.0272 0.371014C12.3933 0.0049094 12.9869 0.0049094 13.353 0.371014Z",
942
+ fill: color
943
+ }));
944
+ };
945
+ ArrowIcon.propTypes = propTypes$I;
946
+ ArrowIcon.defaultProps = defaultProps$I;
947
+
948
+ var propTypes$H = {
949
+ className: PropTypes.string,
950
+ color: PropTypes.string
951
+ };
952
+ var defaultProps$H = {
953
+ className: null,
954
+ color: '#fff'
955
+ };
956
+ var CloseIcon = function CloseIcon(_ref) {
957
+ var color = _ref.color,
958
+ className = _ref.className;
959
+ return /*#__PURE__*/React.createElement("svg", {
960
+ width: "22",
961
+ height: "22",
962
+ viewBox: "0 0 22 22",
963
+ fill: "none",
964
+ xmlns: "http://www.w3.org/2000/svg",
965
+ className: className
966
+ }, /*#__PURE__*/React.createElement("path", {
967
+ d: "M1 1L21 21",
968
+ stroke: color,
969
+ strokeWidth: "1.5",
970
+ strokeLinecap: "round"
971
+ }), /*#__PURE__*/React.createElement("path", {
972
+ d: "M1 21L21 0.999998",
973
+ stroke: color,
974
+ strokeWidth: "1.5",
975
+ strokeLinecap: "round"
976
+ }));
977
+ };
978
+ CloseIcon.propTypes = propTypes$H;
979
+ CloseIcon.defaultProps = defaultProps$H;
980
+
981
+ var propTypes$G = {
982
+ className: PropTypes.string,
983
+ color: PropTypes.string
984
+ };
985
+ var defaultProps$G = {
986
+ className: null,
987
+ color: '#fff'
988
+ };
989
+ var FullscreenIcon = function FullscreenIcon(_ref) {
990
+ var color = _ref.color,
991
+ className = _ref.className;
992
+ return /*#__PURE__*/React.createElement("svg", {
993
+ width: "16",
994
+ height: "14",
995
+ viewBox: "0 0 16 14",
996
+ fill: "none",
997
+ xmlns: "http://www.w3.org/2000/svg",
998
+ className: className
999
+ }, /*#__PURE__*/React.createElement("path", {
1000
+ d: "M11.2 0H16V4.66667H14.4V1.55556H11.2V0ZM0 0H4.8V1.55556H1.6V4.66667H0V0ZM14.4 12.4444V9.33333H16V14H11.2V12.4444H14.4ZM1.6 12.4444H4.8V14H0V9.33333H1.6V12.4444Z",
1001
+ fill: color
1002
+ }));
1003
+ };
1004
+ FullscreenIcon.propTypes = propTypes$G;
1005
+ FullscreenIcon.defaultProps = defaultProps$G;
1006
+
1007
+ var propTypes$F = {
1008
+ className: PropTypes.string,
1009
+ color: PropTypes.string
1010
+ };
1011
+ var defaultProps$F = {
1012
+ className: null,
1013
+ color: '#fff'
1014
+ };
1015
+ var LinkIcon = function LinkIcon(_ref) {
1016
+ var color = _ref.color,
1017
+ className = _ref.className;
1018
+ return /*#__PURE__*/React.createElement("svg", {
1019
+ width: "16",
1020
+ height: "16",
1021
+ viewBox: "0 0 16 16",
1022
+ fill: "none",
1023
+ xmlns: "http://www.w3.org/2000/svg",
1024
+ className: className
1025
+ }, /*#__PURE__*/React.createElement("path", {
1026
+ d: "M6.60207 8.70208C7.75493 10.2515 9.95019 10.5697 11.4965 9.40761C11.6277 9.31077 11.7589 9.2001 11.8762 9.08251L13.9749 6.97975C15.3417 5.61018 15.3417 3.39674 13.9749 2.02717C12.608 0.657609 10.3989 0.657609 9.03205 2.02717L7.83086 3.22381",
1027
+ stroke: color,
1028
+ strokeWidth: "1.25",
1029
+ strokeLinecap: "round",
1030
+ strokeLinejoin: "round"
1031
+ }), /*#__PURE__*/React.createElement("path", {
1032
+ d: "M9.39793 7.29793C8.24507 5.74852 6.04981 5.43034 4.50345 6.59239C4.37229 6.68923 4.24113 6.7999 4.12377 6.91749L2.02515 9.02026C0.658284 10.3898 0.658284 12.6033 2.02515 13.9728C3.39201 15.3424 5.60109 15.3424 6.96795 13.9728L8.16223 12.7762",
1033
+ stroke: color,
1034
+ strokeWidth: "1.25",
1035
+ strokeLinecap: "round",
1036
+ strokeLinejoin: "round"
1037
+ }));
1038
+ };
1039
+ LinkIcon.propTypes = propTypes$F;
1040
+ LinkIcon.defaultProps = defaultProps$F;
1041
+
1042
+ var propTypes$E = {
1043
+ className: PropTypes.string,
1044
+ color: PropTypes.string
1045
+ };
1046
+ var defaultProps$E = {
1047
+ className: null,
1048
+ color: '#fff'
1049
+ };
1050
+ var MuteIcon = function MuteIcon(_ref) {
1051
+ var color = _ref.color,
1052
+ className = _ref.className;
1053
+ return /*#__PURE__*/React.createElement("svg", {
1054
+ width: "26",
1055
+ height: "26",
1056
+ viewBox: "0 0 26 26",
1057
+ fill: "none",
1058
+ xmlns: "http://www.w3.org/2000/svg",
1059
+ className: className
1060
+ }, /*#__PURE__*/React.createElement("path", {
1061
+ d: "M7.09929 8.77987H1C0.447715 8.77987 0 9.22758 0 9.77987V15.7799C0 16.3322 0.447715 16.7799 1 16.7799H7.1076C7.35984 16.7799 7.60276 16.8752 7.78768 17.0467L14.3199 23.1062C14.9599 23.6999 16 23.246 16 22.3731V3.00199C16 2.12221 14.9458 1.67117 14.3095 2.2787L7.78983 8.50316C7.6038 8.68077 7.35649 8.77987 7.09929 8.77987Z",
1062
+ fill: color
1063
+ }), /*#__PURE__*/React.createElement("path", {
1064
+ d: "M18 18.6875C21.3137 18.6875 24 16.0012 24 12.6875C24 9.37379 21.3137 6.6875 18 6.6875",
1065
+ stroke: color
1066
+ }), /*#__PURE__*/React.createElement("path", {
1067
+ d: "M18 15.6875C19.6569 15.6875 21 14.3444 21 12.6875C21 11.0306 19.6569 9.6875 18 9.6875",
1068
+ stroke: color
1069
+ }));
1070
+ };
1071
+ MuteIcon.propTypes = propTypes$E;
1072
+ MuteIcon.defaultProps = defaultProps$E;
1073
+
1074
+ var propTypes$D = {
1075
+ className: PropTypes.string,
1076
+ color: PropTypes.string
1077
+ };
1078
+ var defaultProps$D = {
1079
+ className: null,
1080
+ color: '#fff'
1081
+ };
1082
+ var PauseIcon = function PauseIcon(_ref) {
1083
+ var color = _ref.color,
1084
+ className = _ref.className;
1085
+ return /*#__PURE__*/React.createElement("svg", {
1086
+ className: className,
1087
+ width: "14",
1088
+ height: "18",
1089
+ viewBox: "0 0 14 18",
1090
+ fill: "none",
1091
+ xmlns: "http://www.w3.org/2000/svg"
1092
+ }, /*#__PURE__*/React.createElement("rect", {
1093
+ width: "6",
1094
+ height: "18",
1095
+ rx: "2",
1096
+ fill: color
1097
+ }), /*#__PURE__*/React.createElement("rect", {
1098
+ x: "8",
1099
+ width: "6",
1100
+ height: "18",
1101
+ rx: "2",
1102
+ fill: color
1103
+ }));
1104
+ };
1105
+ PauseIcon.propTypes = propTypes$D;
1106
+ PauseIcon.defaultProps = defaultProps$D;
1107
+
1108
+ var propTypes$C = {
1109
+ className: PropTypes.string,
1110
+ color: PropTypes.string
1111
+ };
1112
+ var defaultProps$C = {
1113
+ className: null,
1114
+ color: '#fff'
1115
+ };
1116
+ var PlayIcon = function PlayIcon(_ref) {
1117
+ var color = _ref.color,
1118
+ className = _ref.className;
1119
+ return /*#__PURE__*/React.createElement("svg", {
1120
+ width: "40",
1121
+ height: "45.1",
1122
+ viewBox: "0 0 40 45.1",
1123
+ fill: "none",
1124
+ xmlns: "http://www.w3.org/2000/svg",
1125
+ className: className
1126
+ }, /*#__PURE__*/React.createElement("path", {
1127
+ d: "M38.2,25.7L5.5,44.6C3,46,0,44.2,0,41.4L0,3.6c0-2.8,3-4.5,5.5-3.1l32.7,18.9C40.6,20.8,40.6,24.3,38.2,25.7z",
1128
+ fill: color,
1129
+ stroke: color
1130
+ }));
1131
+ };
1132
+ PlayIcon.propTypes = propTypes$C;
1133
+ PlayIcon.defaultProps = defaultProps$C;
1134
+
1135
+ var propTypes$B = {
1136
+ className: PropTypes.string,
1137
+ color: PropTypes.string
1138
+ };
1139
+ var defaultProps$B = {
1140
+ className: null,
1141
+ color: '#fff'
1142
+ };
1143
+ var UnmuteIcon = function UnmuteIcon(_ref) {
1144
+ var color = _ref.color,
1145
+ className = _ref.className;
1146
+ return /*#__PURE__*/React.createElement("svg", {
1147
+ width: "26",
1148
+ height: "26",
1149
+ viewBox: "0 0 26 26",
1150
+ fill: "none",
1151
+ xmlns: "http://www.w3.org/2000/svg",
1152
+ className: className
1153
+ }, /*#__PURE__*/React.createElement("path", {
1154
+ d: "M7.09929 8.77987H1C0.447715 8.77987 0 9.22758 0 9.77987V15.7799C0 16.3322 0.447715 16.7799 1 16.7799H7.1076C7.35984 16.7799 7.60276 16.8752 7.78768 17.0467L14.3199 23.1062C14.9599 23.6999 16 23.246 16 22.3731V3.00199C16 2.12221 14.9458 1.67117 14.3095 2.2787L7.78983 8.50316C7.6038 8.68077 7.35649 8.77987 7.09929 8.77987Z",
1155
+ fill: color
1156
+ }), /*#__PURE__*/React.createElement("path", {
1157
+ fillRule: "evenodd",
1158
+ clipRule: "evenodd",
1159
+ d: "M20.8536 13.3946L23 15.5411L23.7071 14.834L21.5607 12.6875L23.7071 10.5411L23 9.83398L20.8536 11.9804L18.7071 9.83398L18 10.5411L20.1464 12.6875L18 14.834L18.7071 15.5411L20.8536 13.3946Z",
1160
+ fill: color
1161
+ }));
1162
+ };
1163
+ UnmuteIcon.propTypes = propTypes$B;
1164
+ UnmuteIcon.defaultProps = defaultProps$B;
1165
+
1166
+ var styles$r = {"container":"micromag-core-menus-breadcrumb-container","arrow":"micromag-core-menus-breadcrumb-arrow"};
1167
+
1168
+ var propTypes$A = {
1169
+ items: core.PropTypes.menuItems,
1170
+ theme: core.PropTypes.bootstrapThemes,
1171
+ separator: PropTypes.oneOf([null, 'arrow']),
1172
+ withoutBar: PropTypes.bool,
1173
+ noWrap: PropTypes.bool,
1174
+ className: PropTypes.string
1175
+ };
1176
+ var defaultProps$A = {
1177
+ items: [],
1178
+ theme: null,
1179
+ separator: null,
1180
+ withoutBar: false,
1181
+ noWrap: false,
1182
+ className: null
1183
+ };
1184
+ var Breadcrumb = function Breadcrumb(_ref) {
1185
+ var items = _ref.items,
1186
+ theme = _ref.theme,
1187
+ separator = _ref.separator,
1188
+ withoutBar = _ref.withoutBar,
1189
+ noWrap = _ref.noWrap,
1190
+ className = _ref.className;
1191
+ return /*#__PURE__*/React.createElement("nav", {
1192
+ className: className
1193
+ }, /*#__PURE__*/React.createElement("ol", {
1194
+ className: classNames([styles$r.container, 'breadcrumb', 'mb-0', {
1195
+ 'p-0': withoutBar,
1196
+ 'bg-transparent': withoutBar,
1197
+ 'rounded-0': withoutBar,
1198
+ 'flex-nowrap': noWrap
1199
+ }])
1200
+ }, items.map(function (_ref2, index) {
1201
+ var url = _ref2.url,
1202
+ label = _ref2.label,
1203
+ _ref2$active = _ref2.active,
1204
+ active = _ref2$active === void 0 ? false : _ref2$active,
1205
+ _ref2$onClick = _ref2.onClick,
1206
+ onClick = _ref2$onClick === void 0 ? null : _ref2$onClick;
1207
+ return /*#__PURE__*/React.createElement("li", {
1208
+ className: classNames(['breadcrumb-item', _defineProperty(_defineProperty({
1209
+ active: active
1210
+ }, styles$r.arrow, separator === 'arrow'), "text-".concat(theme), active && theme !== null)]),
1211
+ key: "item-".concat(index)
1212
+ }, active ? /*#__PURE__*/React.createElement(Label, null, label) : null, !active && url ? /*#__PURE__*/React.createElement(wouter.Link, {
1213
+ href: url,
1214
+ onClick: onClick,
1215
+ className: classNames(['font-weight-bold', 'text-decoration-none', _defineProperty({}, "text-".concat(theme), theme !== null)])
1216
+ }, /*#__PURE__*/React.createElement(Label, null, label)) : null, !active && onClick ? /*#__PURE__*/React.createElement(Button$1, {
1217
+ onClick: onClick,
1218
+ className: classNames(['font-weight-bold', 'text-decoration-none', _defineProperty({}, "text-".concat(theme), theme !== null)])
1219
+ }, /*#__PURE__*/React.createElement(Label, null, label)) : null);
1220
+ })));
1221
+ };
1222
+ Breadcrumb.propTypes = propTypes$A;
1223
+ Breadcrumb.defaultProps = defaultProps$A;
1224
+
1225
+ var _excluded$4 = ["type", "className", "label", "children", "onClick", "active"];
1226
+ var propTypes$z = {
1227
+ items: core.PropTypes.menuItems,
1228
+ children: PropTypes.node,
1229
+ visible: PropTypes.bool,
1230
+ align: core.PropTypes.dropdownAlign,
1231
+ className: PropTypes.string,
1232
+ itemClassName: PropTypes.string,
1233
+ onClickItem: PropTypes.func,
1234
+ onClickOutside: PropTypes.func
1235
+ };
1236
+ var defaultProps$z = {
1237
+ items: [],
1238
+ children: null,
1239
+ visible: false,
1240
+ align: null,
1241
+ className: null,
1242
+ itemClassName: null,
1243
+ onClickItem: null,
1244
+ onClickOutside: null
1245
+ };
1246
+ var Dropdown = function Dropdown(_ref) {
1247
+ var items = _ref.items,
1248
+ children = _ref.children,
1249
+ visible = _ref.visible,
1250
+ align = _ref.align,
1251
+ className = _ref.className,
1252
+ itemClassName = _ref.itemClassName,
1253
+ onClickItem = _ref.onClickItem,
1254
+ onClickOutside = _ref.onClickOutside;
1255
+ var refContainer = React.useRef(null);
1256
+ var _useState = React.useState(visible),
1257
+ _useState2 = _slicedToArray(_useState, 2),
1258
+ enabled = _useState2[0],
1259
+ setEnabled = _useState2[1];
1260
+ var onDocumentClick = React.useCallback(function (e) {
1261
+ if (refContainer.current && !refContainer.current.contains(e.currentTarget) && onClickOutside !== null) {
1262
+ onClickOutside(e);
1263
+ }
1264
+ }, [refContainer.current, onClickOutside]);
1265
+ hooks.useDocumentEvent('click', onDocumentClick, enabled);
1266
+
1267
+ // Delay the outside click detection
1268
+ React.useEffect(function () {
1269
+ var id = setTimeout(function () {
1270
+ setEnabled(visible);
1271
+ }, 100);
1272
+ return function () {
1273
+ clearTimeout(id);
1274
+ };
1275
+ }, [visible, setEnabled]);
1276
+ return /*#__PURE__*/React.createElement("div", {
1277
+ className: classNames(['dropdown-menu', _defineProperty(_defineProperty(_defineProperty({}, "dropdown-menu-".concat(align), align !== null), "show", visible), className, className !== null)]),
1278
+ ref: refContainer
1279
+ }, children !== null ? children : items.map(function (it, index) {
1280
+ var _it$type = it.type,
1281
+ type = _it$type === void 0 ? 'link' : _it$type,
1282
+ _it$className = it.className,
1283
+ customClassName = _it$className === void 0 ? null : _it$className,
1284
+ _it$label = it.label,
1285
+ label = _it$label === void 0 ? null : _it$label,
1286
+ _it$children = it.children,
1287
+ itemChildren = _it$children === void 0 ? null : _it$children,
1288
+ _it$onClick = it.onClick,
1289
+ customOnClick = _it$onClick === void 0 ? null : _it$onClick,
1290
+ _it$active = it.active,
1291
+ active = _it$active === void 0 ? false : _it$active,
1292
+ itemProps = _objectWithoutProperties(it, _excluded$4);
1293
+ var ItemComponent = 'div';
1294
+ if (type === 'link') {
1295
+ ItemComponent = Link;
1296
+ } else if (type === 'button') {
1297
+ ItemComponent = 'button';
1298
+ } else if (type === 'header') {
1299
+ ItemComponent = 'h6';
1300
+ } else if (type === 'divider') {
1301
+ ItemComponent = 'hr';
1302
+ }
1303
+ var finalOnClickItem = customOnClick !== null || type === 'link' && onClickItem !== null ? function (e) {
1304
+ if (customOnClick !== null) {
1305
+ customOnClick(e);
1306
+ }
1307
+ if (type === 'link' && onClickItem !== null) {
1308
+ onClickItem(e);
1309
+ }
1310
+ } : null;
1311
+ return ItemComponent !== null ? /*#__PURE__*/React.createElement("div", {
1312
+ key: "item-".concat(index + 1, "-").concat(label, "-").concat(type)
1313
+ }, /*#__PURE__*/React.createElement(ItemComponent, Object.assign({
1314
+ className: classNames([_defineProperty(_defineProperty({
1315
+ 'dropdown-item': type === 'link' || type === 'button',
1316
+ 'dropdown-divider': type === 'divider',
1317
+ 'dropdown-header': type === 'header',
1318
+ active: active
1319
+ }, itemClassName, itemClassName !== null), customClassName, customClassName !== null)]),
1320
+ onClick: finalOnClickItem
1321
+ }, itemProps), label !== null ? /*#__PURE__*/React.createElement(Label, null, label) : itemChildren)) : null;
1322
+ }));
1323
+ };
1324
+ Dropdown.propTypes = propTypes$z;
1325
+ Dropdown.defaultProps = defaultProps$z;
1326
+
1327
+ var _excluded$3 = ["id", "className", "linkClassName", "href", "label", "external", "items", "dropdown", "active", "onClick"];
1328
+ var propTypes$y = {
1329
+ items: core.PropTypes.menuItems,
1330
+ tagName: PropTypes.string,
1331
+ itemTagName: PropTypes.string,
1332
+ children: PropTypes.node,
1333
+ linkAsItem: PropTypes.bool,
1334
+ className: PropTypes.string,
1335
+ itemClassName: PropTypes.string,
1336
+ linkClassName: PropTypes.string,
1337
+ hasSubMenuClassName: PropTypes.string,
1338
+ subMenuClassName: PropTypes.string,
1339
+ subMenuItemClassName: PropTypes.string,
1340
+ subMenuLinkClassName: PropTypes.string,
1341
+ hasDropdownClassName: PropTypes.string,
1342
+ dropdownClassName: PropTypes.string,
1343
+ dropdownItemClassName: PropTypes.string,
1344
+ dropdownLinkClassName: PropTypes.string,
1345
+ dropdownAlign: core.PropTypes.dropdownAlign
1346
+ };
1347
+ var defaultProps$y = {
1348
+ items: [],
1349
+ tagName: 'ul',
1350
+ itemTagName: 'li',
1351
+ children: null,
1352
+ linkAsItem: false,
1353
+ className: null,
1354
+ itemClassName: null,
1355
+ linkClassName: null,
1356
+ hasSubMenuClassName: null,
1357
+ subMenuClassName: null,
1358
+ subMenuItemClassName: null,
1359
+ subMenuLinkClassName: null,
1360
+ hasDropdownClassName: null,
1361
+ dropdownClassName: null,
1362
+ dropdownItemClassName: null,
1363
+ dropdownLinkClassName: null,
1364
+ dropdownAlign: null
1365
+ };
1366
+ var _Menu = function Menu(_ref) {
1367
+ var items = _ref.items,
1368
+ tagName = _ref.tagName,
1369
+ itemTagName = _ref.itemTagName,
1370
+ children = _ref.children,
1371
+ linkAsItem = _ref.linkAsItem,
1372
+ className = _ref.className,
1373
+ itemClassName = _ref.itemClassName,
1374
+ linkClassName = _ref.linkClassName,
1375
+ hasSubMenuClassName = _ref.hasSubMenuClassName,
1376
+ subMenuClassName = _ref.subMenuClassName,
1377
+ subMenuItemClassName = _ref.subMenuItemClassName,
1378
+ subMenuLinkClassName = _ref.subMenuLinkClassName,
1379
+ hasDropdownClassName = _ref.hasDropdownClassName,
1380
+ dropdownClassName = _ref.dropdownClassName,
1381
+ dropdownItemClassName = _ref.dropdownItemClassName,
1382
+ dropdownLinkClassName = _ref.dropdownLinkClassName,
1383
+ dropdownAlign = _ref.dropdownAlign;
1384
+ var _useState = React.useState(items.map(function () {
1385
+ return false;
1386
+ })),
1387
+ _useState2 = _slicedToArray(_useState, 2),
1388
+ dropdownsVisible = _useState2[0],
1389
+ setDropdownsVisible = _useState2[1];
1390
+ var ListComponent = linkAsItem ? 'div' : tagName;
1391
+ return /*#__PURE__*/React.createElement(ListComponent, {
1392
+ className: className
1393
+ }, children !== null ? children : items.map(function (it, index) {
1394
+ var id = it.id,
1395
+ _it$className = it.className,
1396
+ customClassName = _it$className === void 0 ? null : _it$className,
1397
+ _it$linkClassName = it.linkClassName,
1398
+ customLinkClassName = _it$linkClassName === void 0 ? null : _it$linkClassName,
1399
+ _it$href = it.href,
1400
+ href = _it$href === void 0 ? null : _it$href,
1401
+ label = it.label,
1402
+ _it$external = it.external,
1403
+ external = _it$external === void 0 ? false : _it$external,
1404
+ _it$items = it.items,
1405
+ subItems = _it$items === void 0 ? null : _it$items,
1406
+ _it$dropdown = it.dropdown,
1407
+ dropdown = _it$dropdown === void 0 ? null : _it$dropdown,
1408
+ _it$active = it.active,
1409
+ active = _it$active === void 0 ? false : _it$active,
1410
+ _it$onClick = it.onClick,
1411
+ customOnClick = _it$onClick === void 0 ? null : _it$onClick,
1412
+ itemProps = _objectWithoutProperties(it, _excluded$3);
1413
+ var onClickItem = dropdown !== null ? function (e) {
1414
+ e.preventDefault();
1415
+ setDropdownsVisible([].concat(_toConsumableArray(dropdownsVisible.slice(0, index)), [!(dropdownsVisible[index] || false)], _toConsumableArray(dropdownsVisible.slice(index + 1))));
1416
+ if (customOnClick !== null) {
1417
+ customOnClick(e);
1418
+ }
1419
+ } : customOnClick;
1420
+ var closeDropdown = dropdown !== null ? function () {
1421
+ setDropdownsVisible([].concat(_toConsumableArray(dropdownsVisible.slice(0, index)), [false], _toConsumableArray(dropdownsVisible.slice(index + 1))));
1422
+ } : null;
1423
+ var ItemComponent = itemTagName;
1424
+ return linkAsItem ? /*#__PURE__*/React.createElement(Link, Object.assign({}, itemProps, {
1425
+ key: "item-".concat(id || index),
1426
+ onClick: onClickItem,
1427
+ href: href,
1428
+ external: external,
1429
+ className: classNames(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
1430
+ active: active
1431
+ }, itemClassName, itemClassName !== null), customClassName, customClassName !== null), linkClassName, linkClassName !== null), customLinkClassName, customLinkClassName !== null))
1432
+ }), label) : /*#__PURE__*/React.createElement(ItemComponent, {
1433
+ key: "item-".concat(id || index),
1434
+ className: classNames(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
1435
+ dropdown: dropdown !== null,
1436
+ active: active
1437
+ }, itemClassName, itemClassName !== null), customClassName, customClassName !== null), hasSubMenuClassName, subItems !== null && hasSubMenuClassName !== null), hasDropdownClassName, subItems !== null && hasDropdownClassName !== null))
1438
+ }, href !== null ? /*#__PURE__*/React.createElement(Link, Object.assign({}, itemProps, {
1439
+ onClick: onClickItem,
1440
+ href: href,
1441
+ external: external,
1442
+ className: classNames(_defineProperty(_defineProperty(_defineProperty({}, linkClassName, linkClassName !== null), 'dropdown-toggle', dropdown !== null), customLinkClassName, customLinkClassName !== null))
1443
+ }), label) : null, href === null && onClickItem !== null ? /*#__PURE__*/React.createElement(Button$1, Object.assign({}, itemProps, {
1444
+ onClick: onClickItem,
1445
+ className: classNames(_defineProperty(_defineProperty(_defineProperty({}, linkClassName, linkClassName !== null), 'dropdown-toggle', dropdown !== null), customLinkClassName, customLinkClassName !== null))
1446
+ }), label) : null, subItems !== null ? /*#__PURE__*/React.createElement(_Menu, {
1447
+ items: subItems,
1448
+ className: subMenuClassName,
1449
+ itemClassName: classNames(_defineProperty(_defineProperty({}, subMenuItemClassName, subMenuItemClassName !== null), itemClassName, subMenuItemClassName === null && itemClassName !== null)),
1450
+ linkClassName: classNames(_defineProperty(_defineProperty({}, subMenuLinkClassName, subMenuLinkClassName !== null), linkClassName, subMenuLinkClassName === null && linkClassName !== null))
1451
+ }) : null, dropdown !== null ? /*#__PURE__*/React.createElement(Dropdown, {
1452
+ items: dropdown,
1453
+ visible: dropdownsVisible[index] || false,
1454
+ className: dropdownClassName,
1455
+ itemClassName: classNames(_defineProperty(_defineProperty({}, dropdownItemClassName, dropdownItemClassName !== null), itemClassName, dropdownItemClassName === null && itemClassName !== null)),
1456
+ linkClassName: classNames(_defineProperty(_defineProperty({}, dropdownLinkClassName, dropdownLinkClassName !== null), linkClassName, dropdownLinkClassName === null && linkClassName !== null)),
1457
+ align: dropdownAlign,
1458
+ onClickItem: closeDropdown,
1459
+ onClickOutside: closeDropdown
1460
+ }) : null);
1461
+ }));
1462
+ };
1463
+ _Menu.propTypes = propTypes$y;
1464
+ _Menu.defaultProps = defaultProps$y;
1465
+
1466
+ var styles$q = {"collapse":"micromag-core-menus-navbar-collapse"};
1467
+
1468
+ var propTypes$x = {
1469
+ brand: PropTypes.node,
1470
+ brandLink: PropTypes.string,
1471
+ breadcrumbs: PropTypes.node,
1472
+ theme: PropTypes.oneOf(['light', 'dark', 'primary', null]),
1473
+ size: PropTypes.oneOf(['sm', 'md', 'lg']),
1474
+ compact: PropTypes.bool,
1475
+ noWrap: PropTypes.bool,
1476
+ withoutCollapse: PropTypes.bool,
1477
+ withoutCollapseToggle: PropTypes.bool,
1478
+ children: PropTypes.node,
1479
+ className: PropTypes.string,
1480
+ brandClassName: PropTypes.string,
1481
+ breadCrumbsClassName: PropTypes.string,
1482
+ collapseClassName: PropTypes.string
1483
+ };
1484
+ var defaultProps$x = {
1485
+ brand: null,
1486
+ brandLink: null,
1487
+ breadcrumbs: null,
1488
+ theme: null,
1489
+ size: 'md',
1490
+ compact: false,
1491
+ noWrap: false,
1492
+ withoutCollapse: false,
1493
+ withoutCollapseToggle: false,
1494
+ children: null,
1495
+ className: null,
1496
+ brandClassName: null,
1497
+ breadCrumbsClassName: null,
1498
+ collapseClassName: null
1499
+ };
1500
+ var Navbar = function Navbar(_ref) {
1501
+ var brand = _ref.brand,
1502
+ brandLink = _ref.brandLink,
1503
+ breadcrumbs = _ref.breadcrumbs,
1504
+ theme = _ref.theme,
1505
+ size = _ref.size,
1506
+ compact = _ref.compact,
1507
+ noWrap = _ref.noWrap,
1508
+ withoutCollapse = _ref.withoutCollapse,
1509
+ withoutCollapseToggle = _ref.withoutCollapseToggle,
1510
+ children = _ref.children,
1511
+ className = _ref.className,
1512
+ brandClassName = _ref.brandClassName,
1513
+ breadCrumbsClassName = _ref.breadCrumbsClassName,
1514
+ collapseClassName = _ref.collapseClassName;
1515
+ var _useState = React.useState(false),
1516
+ _useState2 = _slicedToArray(_useState, 2),
1517
+ menuVisible = _useState2[0],
1518
+ setMenuVisible = _useState2[1];
1519
+ var onClickMenu = React.useCallback(function () {
1520
+ return setMenuVisible(!menuVisible);
1521
+ }, [setMenuVisible, menuVisible]);
1522
+ return /*#__PURE__*/React.createElement("nav", {
1523
+ className: classNames(['navbar', _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "bg-".concat(theme), theme !== null), "navbar-".concat(theme === 'light' ? 'light' : 'dark'), theme !== null), "text-".concat(theme === 'light' ? 'dark' : 'light'), theme !== null), "navbar-expand-".concat(size), !withoutCollapse), 'navbar-expand', withoutCollapse), 'py-2', compact), 'px-2', compact), 'flex-nowrap', noWrap), className, className !== null)])
1524
+ }, /*#__PURE__*/React.createElement("div", {
1525
+ className: classNames(['container-fluid', {
1526
+ 'px-0': compact
1527
+ }])
1528
+ }, brand !== null && brandLink !== null ? /*#__PURE__*/React.createElement(Link, {
1529
+ className: classNames(['navbar-brand', _defineProperty({
1530
+ 'py-0': compact
1531
+ }, brandClassName, brandClassName !== null)]),
1532
+ href: brandLink
1533
+ }, brand) : null, brand !== null && brandLink === null ? /*#__PURE__*/React.createElement("span", {
1534
+ className: classNames(['navbar-brand', _defineProperty({
1535
+ 'py-0': compact
1536
+ }, brandClassName, brandClassName !== null)])
1537
+ }, brand) : null, breadcrumbs !== null ? /*#__PURE__*/React.createElement("span", {
1538
+ className: classNames(['navbar-breadcrumbs', _defineProperty({
1539
+ 'py-0': compact
1540
+ }, breadCrumbsClassName, breadCrumbsClassName !== null)])
1541
+ }, breadcrumbs) : null, !withoutCollapse && !withoutCollapseToggle ? /*#__PURE__*/React.createElement(Button$1, {
1542
+ className: "navbar-toggler",
1543
+ onClick: onClickMenu,
1544
+ withoutTheme: true,
1545
+ "aria-controls": "navbarSupportedContent",
1546
+ "aria-expanded": "false",
1547
+ "aria-label": "Toggle navigation"
1548
+ }, /*#__PURE__*/React.createElement("span", {
1549
+ className: "navbar-toggler-icon"
1550
+ })) : null, !withoutCollapse ? /*#__PURE__*/React.createElement("div", {
1551
+ className: classNames(['navbar-collapse', 'collapse', styles$q.collapse, _defineProperty(_defineProperty({}, collapseClassName, collapseClassName !== null), "show", menuVisible)])
1552
+ }, children) : children));
1553
+ };
1554
+ Navbar.propTypes = propTypes$x;
1555
+ Navbar.defaultProps = defaultProps$x;
1556
+
1557
+ var styles$p = {};
1558
+
1559
+ var messages = reactIntl.defineMessages({
1560
+ previous: {
1561
+ id: "menus.pagination.previous",
1562
+ defaultMessage: [{
1563
+ "type": 0,
1564
+ "value": "Previous"
1565
+ }]
1566
+ },
1567
+ next: {
1568
+ id: "menus.pagination.next",
1569
+ defaultMessage: [{
1570
+ "type": 0,
1571
+ "value": "next"
1572
+ }]
1573
+ }
1574
+ });
1575
+ var propTypes$w = {
1576
+ page: PropTypes.number,
1577
+ lastPage: PropTypes.number,
1578
+ maxPages: PropTypes.number,
1579
+ total: PropTypes.number,
1580
+ url: PropTypes.string,
1581
+ query: PropTypes.object,
1582
+ // eslint-disable-line react/forbid-prop-types
1583
+ withPreviousNext: PropTypes.bool,
1584
+ className: PropTypes.string,
1585
+ paginationClassName: PropTypes.string,
1586
+ itemClassName: PropTypes.string,
1587
+ linkClassName: PropTypes.string,
1588
+ onClickPage: PropTypes.func
1589
+ };
1590
+ var defaultProps$w = {
1591
+ page: 1,
1592
+ lastPage: 1,
1593
+ maxPages: 10,
1594
+ total: 1,
1595
+ url: null,
1596
+ query: null,
1597
+ withPreviousNext: false,
1598
+ className: null,
1599
+ paginationClassName: null,
1600
+ itemClassName: null,
1601
+ linkClassName: null,
1602
+ onClickPage: null
1603
+ };
1604
+ var PaginationMenu = function PaginationMenu(_ref) {
1605
+ var parentPage = _ref.page,
1606
+ parentLastPage = _ref.lastPage,
1607
+ parentMaxPages = _ref.maxPages,
1608
+ parentTotal = _ref.total,
1609
+ url = _ref.url,
1610
+ query = _ref.query,
1611
+ withPreviousNext = _ref.withPreviousNext,
1612
+ className = _ref.className,
1613
+ paginationClassName = _ref.paginationClassName,
1614
+ itemClassName = _ref.itemClassName,
1615
+ linkClassName = _ref.linkClassName,
1616
+ onClickPage = _ref.onClickPage;
1617
+ var getUrl = React.useCallback(function (currentPage) {
1618
+ return url !== null ? "".concat(url, "?").concat(queryString.stringify(_objectSpread(_objectSpread({}, query), {}, {
1619
+ page: currentPage
1620
+ }), {
1621
+ arrayFormat: 'bracket'
1622
+ })) : null;
1623
+ }, [url, query]);
1624
+
1625
+ // TODO: test this
1626
+ // const pages = [...Array(total).keys()].map((it) => it + 1);
1627
+
1628
+ var page = parseInt(parentPage, 10);
1629
+ var total = parseInt(parentTotal, 10);
1630
+ var maxPages = parseInt(parentMaxPages, 10);
1631
+ var lastPage = parseInt(parentLastPage, 10);
1632
+ var pageNumbers = Array.from({
1633
+ length: parseInt(lastPage, 10)
1634
+ }, function (_, i) {
1635
+ return i + 1;
1636
+ });
1637
+ var stripPages = maxPages !== null && lastPage > maxPages;
1638
+ var startPage = stripPages ? Math.min(Math.max(page - maxPages / 2, 1), lastPage - maxPages) : null;
1639
+ var endPage = stripPages ? startPage + maxPages : null;
1640
+ var strippedPages = stripPages ? pageNumbers.reduce(function (selectedPages, pageNumber) {
1641
+ if (pageNumber === 1 && startPage - 1 > 1) {
1642
+ return [pageNumber, '...'];
1643
+ }
1644
+ if (pageNumber === lastPage && endPage + 1 < lastPage) {
1645
+ return [].concat(_toConsumableArray(selectedPages), ['...', pageNumber]);
1646
+ }
1647
+ return pageNumber >= startPage && pageNumber <= endPage ? [].concat(_toConsumableArray(selectedPages), [pageNumber]) : selectedPages;
1648
+ }, []) : pageNumbers;
1649
+ var pages = strippedPages.length > 0 ? strippedPages : [1];
1650
+ return /*#__PURE__*/React.createElement("nav", {
1651
+ className: classNames([styles$p.container, _defineProperty({}, className, className !== null)])
1652
+ }, /*#__PURE__*/React.createElement("ul", {
1653
+ className: classNames(['pagination', _defineProperty({}, paginationClassName, paginationClassName !== null)])
1654
+ }, withPreviousNext ? /*#__PURE__*/React.createElement("li", {
1655
+ className: classNames(['page-item', _defineProperty({
1656
+ disabled: page <= 1
1657
+ }, itemClassName, itemClassName !== null)])
1658
+ }, page > 1 ? /*#__PURE__*/React.createElement(Link, {
1659
+ className: classNames(['page-link', _defineProperty({}, linkClassName, linkClassName !== null)]),
1660
+ href: getUrl(page - 1),
1661
+ onClick: onClickPage !== null ? function () {
1662
+ return onClickPage(page - 1);
1663
+ } : null
1664
+ }, messages.previous) : /*#__PURE__*/React.createElement("span", {
1665
+ className: classNames(['page-link', _defineProperty({}, linkClassName, linkClassName !== null)])
1666
+ }, /*#__PURE__*/React.createElement(Label, null, messages.previous))) : null, pages.map(function (pageNumber) {
1667
+ return /*#__PURE__*/React.createElement("li", {
1668
+ key: "page-".concat(pageNumber),
1669
+ className: classNames(['page-item', _defineProperty({
1670
+ active: pageNumber === page
1671
+ }, itemClassName, itemClassName !== null)])
1672
+ }, /*#__PURE__*/React.createElement(Link, {
1673
+ className: classNames(['page-link', _defineProperty({}, linkClassName, linkClassName !== null)]),
1674
+ href: getUrl(pageNumber),
1675
+ onClick: onClickPage !== null ? function () {
1676
+ return onClickPage(pageNumber);
1677
+ } : null
1678
+ }, pageNumber));
1679
+ }), withPreviousNext ? /*#__PURE__*/React.createElement("li", {
1680
+ className: classNames(['page-item', _defineProperty({
1681
+ disabled: page >= total
1682
+ }, itemClassName, itemClassName !== null)])
1683
+ }, page < total ? /*#__PURE__*/React.createElement(Link, {
1684
+ className: classNames(['page-link', _defineProperty({}, linkClassName, linkClassName !== null)]),
1685
+ href: getUrl(page + 1),
1686
+ onClick: onClickPage !== null ? function () {
1687
+ return onClickPage(page + 1);
1688
+ } : null
1689
+ }, messages.next) : /*#__PURE__*/React.createElement("span", {
1690
+ className: classNames(['page-link', _defineProperty({}, linkClassName, linkClassName !== null)])
1691
+ }, /*#__PURE__*/React.createElement(Label, null, messages.next))) : null));
1692
+ };
1693
+ PaginationMenu.propTypes = propTypes$w;
1694
+ PaginationMenu.defaultProps = defaultProps$w;
1695
+
1696
+ var styles$o = {"container":"micromag-core-menus-tabs-container"};
1697
+
1698
+ var propTypes$v = {
1699
+ items: core.PropTypes.menuItems,
1700
+ size: core.PropTypes.buttonSize,
1701
+ theme: core.PropTypes.buttonTheme,
1702
+ renderItemButton: PropTypes.func,
1703
+ buttonClassName: PropTypes.string,
1704
+ className: PropTypes.string,
1705
+ onClickItem: PropTypes.func
1706
+ };
1707
+ var defaultProps$v = {
1708
+ items: [],
1709
+ size: null,
1710
+ theme: 'secondary',
1711
+ renderItemButton: null,
1712
+ buttonClassName: null,
1713
+ className: null,
1714
+ onClickItem: null
1715
+ };
1716
+ var TabsMenu = function TabsMenu(_ref) {
1717
+ var items = _ref.items,
1718
+ size = _ref.size,
1719
+ theme = _ref.theme,
1720
+ renderItemButton = _ref.renderItemButton,
1721
+ buttonClassName = _ref.buttonClassName,
1722
+ className = _ref.className,
1723
+ onClickItem = _ref.onClickItem;
1724
+ return /*#__PURE__*/React.createElement("div", {
1725
+ className: classNames([styles$o.container, _defineProperty({}, className, className)])
1726
+ }, /*#__PURE__*/React.createElement(Buttons, {
1727
+ buttons: items,
1728
+ size: size,
1729
+ theme: theme,
1730
+ renderButton: renderItemButton,
1731
+ onClickButton: onClickItem,
1732
+ className: styles$o.buttons,
1733
+ buttonClassName: classNames([styles$o.button, _defineProperty({}, buttonClassName, buttonClassName !== null)])
1734
+ }));
1735
+ };
1736
+ TabsMenu.propTypes = propTypes$v;
1737
+ TabsMenu.defaultProps = defaultProps$v;
1738
+
1739
+ var styles$n = {"container":"micromag-core-modals-container","modals":"micromag-core-modals-modals","hasModals":"micromag-core-modals-hasModals"};
1740
+
1741
+ var propTypes$u = {
1742
+ modals: core.PropTypes.modals.isRequired,
1743
+ setModalsContainer: PropTypes.func.isRequired,
1744
+ className: PropTypes.string
1745
+ };
1746
+ var defaultProps$u = {
1747
+ className: null
1748
+ };
1749
+ var ModalsContainer = function ModalsContainer(_ref) {
1750
+ var modals = _ref.modals,
1751
+ setModalsContainer = _ref.setModalsContainer,
1752
+ className = _ref.className;
1753
+ var containerRef = React.useRef(null);
1754
+ React.useEffect(function () {
1755
+ setModalsContainer(containerRef.current);
1756
+ }, []);
1757
+ return /*#__PURE__*/React.createElement("div", {
1758
+ className: classNames([styles$n.container, _defineProperty({}, className, className)])
1759
+ }, /*#__PURE__*/React.createElement("div", {
1760
+ className: classNames([styles$n.modals, _defineProperty({}, styles$n.hasModals, modals.length > 0)]),
1761
+ ref: containerRef
1762
+ }));
1763
+ };
1764
+ ModalsContainer.propTypes = propTypes$u;
1765
+ ModalsContainer.defaultProps = defaultProps$u;
1766
+ var Modals = contexts.withModals(ModalsContainer);
1767
+
1768
+ /* eslint-disable react/no-array-index-key, react/jsx-props-no-spreading */
1769
+ var propTypes$t = {
1770
+ id: PropTypes.string,
1771
+ data: PropTypes.object,
1772
+ // eslint-disable-line react/forbid-prop-types
1773
+ container: PropTypes.object,
1774
+ // eslint-disable-line react/forbid-prop-types
1775
+ register: PropTypes.func,
1776
+ unregister: PropTypes.func,
1777
+ children: PropTypes.node
1778
+ };
1779
+ var defaultProps$t = {
1780
+ id: null,
1781
+ data: null,
1782
+ container: null,
1783
+ register: null,
1784
+ unregister: null,
1785
+ children: null
1786
+ };
1787
+ var ElementPortal = function ElementPortal(_ref) {
1788
+ var id = _ref.id,
1789
+ data = _ref.data,
1790
+ children = _ref.children,
1791
+ container = _ref.container,
1792
+ register = _ref.register,
1793
+ unregister = _ref.unregister;
1794
+ var finalId = React.useMemo(function () {
1795
+ return id || "element-".concat(new Date().getTime());
1796
+ }, [id]);
1797
+ React.useEffect(function () {
1798
+ if (register !== null) {
1799
+ register(finalId, data);
1800
+ }
1801
+ return function () {
1802
+ if (unregister !== null) {
1803
+ unregister(finalId);
1804
+ }
1805
+ };
1806
+ }, [finalId, data]);
1807
+ return container !== null ? /*#__PURE__*/reactDom.createPortal(children, container) : null;
1808
+ };
1809
+ ElementPortal.propTypes = propTypes$t;
1810
+ ElementPortal.defaultProps = defaultProps$t;
1811
+
1812
+ /* eslint-disable react/no-array-index-key, react/jsx-props-no-spreading */
1813
+ var propTypes$s = {
1814
+ id: PropTypes.string,
1815
+ data: PropTypes.object,
1816
+ // eslint-disable-line react/forbid-prop-types
1817
+ children: PropTypes.node
1818
+ };
1819
+ var defaultProps$s = {
1820
+ id: null,
1821
+ data: null,
1822
+ children: null
1823
+ };
1824
+ var ModalPortal = function ModalPortal(_ref) {
1825
+ var id = _ref.id,
1826
+ data = _ref.data,
1827
+ children = _ref.children;
1828
+ var _useModals = contexts.useModals(),
1829
+ container = _useModals.container,
1830
+ _useModals$register = _useModals.register,
1831
+ register = _useModals$register === void 0 ? null : _useModals$register,
1832
+ _useModals$unregister = _useModals.unregister,
1833
+ unregister = _useModals$unregister === void 0 ? null : _useModals$unregister;
1834
+ return /*#__PURE__*/React.createElement(ElementPortal, {
1835
+ id: id,
1836
+ data: data,
1837
+ container: container,
1838
+ register: register,
1839
+ unregister: unregister
1840
+ }, children);
1841
+ };
1842
+ ModalPortal.propTypes = propTypes$s;
1843
+ ModalPortal.defaultProps = defaultProps$s;
1844
+
1845
+ var styles$m = {"container":"micromag-core-modals-modal-container","center":"micromag-core-modals-modal-center","inner":"micromag-core-modals-modal-inner","top":"micromag-core-modals-modal-top"};
1846
+
1847
+ var propTypes$r = {
1848
+ id: PropTypes.string,
1849
+ title: PropTypes.string,
1850
+ position: PropTypes.oneOf(['center', 'top']),
1851
+ children: PropTypes.node
1852
+ };
1853
+ var defaultProps$r = {
1854
+ id: null,
1855
+ title: null,
1856
+ position: 'center',
1857
+ children: null
1858
+ };
1859
+ var Modal = function Modal(_ref) {
1860
+ var id = _ref.id,
1861
+ children = _ref.children,
1862
+ position = _ref.position,
1863
+ title = _ref.title;
1864
+ var finalId = React.useMemo(function () {
1865
+ return id || utils.getDisplayName(children.type);
1866
+ }, [id, children.type]);
1867
+ var data = React.useMemo(function () {
1868
+ return {
1869
+ title: title
1870
+ };
1871
+ }, [title]);
1872
+ return /*#__PURE__*/React.createElement(ModalPortal, {
1873
+ id: finalId,
1874
+ data: data
1875
+ }, /*#__PURE__*/React.createElement("div", {
1876
+ className: classNames([styles$m.container, _defineProperty({}, styles$m[position], position !== null)])
1877
+ }, /*#__PURE__*/React.createElement("div", {
1878
+ className: classNames([styles$m.inner, 'bg-dark', 'rounded'])
1879
+ }, children)));
1880
+ };
1881
+ Modal.propTypes = propTypes$r;
1882
+ Modal.defaultProps = defaultProps$r;
1883
+
1884
+ var styles$l = {"container":"micromag-core-modals-dialog-container"};
1885
+
1886
+ var propTypes$q = {
1887
+ title: core.PropTypes.label,
1888
+ header: PropTypes.node,
1889
+ children: PropTypes.node,
1890
+ footer: PropTypes.node,
1891
+ size: PropTypes.string,
1892
+ buttons: core.PropTypes.buttons,
1893
+ onClose: PropTypes.func,
1894
+ className: PropTypes.string,
1895
+ bodyClassName: PropTypes.string
1896
+ };
1897
+ var defaultProps$q = {
1898
+ title: null,
1899
+ header: null,
1900
+ children: null,
1901
+ footer: null,
1902
+ size: null,
1903
+ buttons: null,
1904
+ onClose: null,
1905
+ className: null,
1906
+ bodyClassName: null
1907
+ };
1908
+ var ModalDialog = function ModalDialog(_ref) {
1909
+ var title = _ref.title,
1910
+ header = _ref.header,
1911
+ children = _ref.children,
1912
+ buttons = _ref.buttons,
1913
+ footer = _ref.footer,
1914
+ size = _ref.size,
1915
+ onClose = _ref.onClose,
1916
+ className = _ref.className,
1917
+ bodyClassName = _ref.bodyClassName;
1918
+ return /*#__PURE__*/React.createElement("div", {
1919
+ className: classNames([styles$l.container, 'modal-dialog', _defineProperty(_defineProperty({}, "modal-".concat(size), size !== null), className, className)]),
1920
+ role: "dialog"
1921
+ }, /*#__PURE__*/React.createElement("div", {
1922
+ className: "modal-content"
1923
+ }, header || /*#__PURE__*/React.createElement("div", {
1924
+ className: classNames(['modal-header', 'p-2', 'd-flex', 'justify-content-between', styles$l.header])
1925
+ }, /*#__PURE__*/React.createElement("h5", {
1926
+ className: "modal-title"
1927
+ }, /*#__PURE__*/React.createElement(Label, null, title)), /*#__PURE__*/React.createElement("button", {
1928
+ type: "button",
1929
+ className: "btn btn-close p-2",
1930
+ "aria-label": "Close",
1931
+ onClick: onClose
1932
+ })), /*#__PURE__*/React.createElement("div", {
1933
+ className: classNames(['modal-body', 'p-2', _defineProperty({}, bodyClassName, bodyClassName !== null)])
1934
+ }, children), footer !== null || buttons !== null ? /*#__PURE__*/React.createElement("div", {
1935
+ className: classNames(['modal-footer', 'p-2', styles$l.footer])
1936
+ }, footer, buttons !== null ? /*#__PURE__*/React.createElement(Buttons, {
1937
+ buttons: buttons,
1938
+ className: styles$l.buttons
1939
+ }) : null) : null));
1940
+ };
1941
+ ModalDialog.propTypes = propTypes$q;
1942
+ ModalDialog.defaultProps = defaultProps$q;
1943
+
1944
+ var styles$k = {"container":"micromag-core-panels-container"};
1945
+
1946
+ var propTypes$p = {
1947
+ panels: core.PropTypes.panels,
1948
+ setPanelsContainer: PropTypes.func,
1949
+ className: PropTypes.string
1950
+ };
1951
+ var defaultProps$p = {
1952
+ panels: [],
1953
+ setPanelsContainer: null,
1954
+ className: null
1955
+ };
1956
+ var PanelsContainer = function PanelsContainer(_ref) {
1957
+ var panels = _ref.panels,
1958
+ setPanelsContainer = _ref.setPanelsContainer,
1959
+ className = _ref.className;
1960
+ var containerRef = React.useRef(null);
1961
+ React.useEffect(function () {
1962
+ setPanelsContainer(containerRef.current);
1963
+ }, []);
1964
+ return /*#__PURE__*/React.createElement("div", {
1965
+ className: classNames([styles$k.container, _defineProperty({}, className, className)])
1966
+ }, /*#__PURE__*/React.createElement("div", {
1967
+ className: classNames([styles$k.panels, _defineProperty({}, styles$k.hasPanels, panels.length > 0)]),
1968
+ ref: containerRef
1969
+ }));
1970
+ };
1971
+ PanelsContainer.propTypes = propTypes$p;
1972
+ PanelsContainer.defaultProps = defaultProps$p;
1973
+ var Panels = contexts.withPanels(PanelsContainer);
1974
+
1975
+ /* eslint-disable react/no-array-index-key, react/jsx-props-no-spreading */
1976
+ var propTypes$o = {
1977
+ id: PropTypes.string,
1978
+ data: PropTypes.object,
1979
+ // eslint-disable-line react/forbid-prop-types
1980
+ children: PropTypes.node
1981
+ };
1982
+ var defaultProps$o = {
1983
+ id: null,
1984
+ data: null,
1985
+ children: null
1986
+ };
1987
+ var PanelPortal = function PanelPortal(_ref) {
1988
+ var id = _ref.id,
1989
+ data = _ref.data,
1990
+ children = _ref.children;
1991
+ var _usePanels = contexts.usePanels(),
1992
+ _usePanels$panels = _usePanels.panels,
1993
+ panels = _usePanels$panels === void 0 ? null : _usePanels$panels,
1994
+ container = _usePanels.container,
1995
+ _usePanels$register = _usePanels.register,
1996
+ register = _usePanels$register === void 0 ? null : _usePanels$register,
1997
+ _usePanels$unregister = _usePanels.unregister,
1998
+ unregister = _usePanels$unregister === void 0 ? null : _usePanels$unregister;
1999
+ if (panels === null) {
2000
+ return children;
2001
+ }
2002
+ return /*#__PURE__*/React.createElement(ElementPortal, {
2003
+ id: id,
2004
+ data: data,
2005
+ container: container,
2006
+ register: register,
2007
+ unregister: unregister
2008
+ }, children);
2009
+ };
2010
+ PanelPortal.propTypes = propTypes$o;
2011
+ PanelPortal.defaultProps = defaultProps$o;
2012
+
2013
+ var styles$j = {"container":"micromag-core-panels-panel-container"};
2014
+
2015
+ /* eslint-disable react/no-array-index-key, react/jsx-props-no-spreading */
2016
+ var propTypes$n = {
2017
+ id: PropTypes.string,
2018
+ title: PropTypes.string,
2019
+ children: PropTypes.node
2020
+ };
2021
+ var defaultProps$n = {
2022
+ id: null,
2023
+ title: null,
2024
+ children: null
2025
+ };
2026
+ var Panel = function Panel(_ref) {
2027
+ var id = _ref.id,
2028
+ children = _ref.children,
2029
+ title = _ref.title;
2030
+ var finalId = React.useMemo(function () {
2031
+ return id || utils.getDisplayName(children.type);
2032
+ }, [id, children.type]);
2033
+ var data = React.useMemo(function () {
2034
+ return {
2035
+ title: title
2036
+ };
2037
+ }, [title]);
2038
+ return /*#__PURE__*/React.createElement(PanelPortal, {
2039
+ id: finalId,
2040
+ data: data
2041
+ }, /*#__PURE__*/React.createElement("div", {
2042
+ className: styles$j.container
2043
+ }, children));
2044
+ };
2045
+ Panel.propTypes = propTypes$n;
2046
+ Panel.defaultProps = defaultProps$n;
2047
+
2048
+ var styles$i = {"container":"micromag-core-partials-collapsable-panel-container","top":"micromag-core-partials-collapsable-panel-top","button":"micromag-core-partials-collapsable-panel-button","label":"micromag-core-partials-collapsable-panel-label","content":"micromag-core-partials-collapsable-panel-content","isOpened":"micromag-core-partials-collapsable-panel-isOpened"};
2049
+
2050
+ var propTypes$m = {
2051
+ title: PropTypes.node,
2052
+ children: PropTypes.node,
2053
+ className: PropTypes.string,
2054
+ topClassName: PropTypes.string,
2055
+ contentClassName: PropTypes.string,
2056
+ openedClassName: PropTypes.string,
2057
+ buttonClassName: PropTypes.string
2058
+ };
2059
+ var defaultProps$m = {
2060
+ title: null,
2061
+ children: null,
2062
+ className: null,
2063
+ topClassName: null,
2064
+ contentClassName: null,
2065
+ openedClassName: null,
2066
+ buttonClassName: null
2067
+ };
2068
+ var CollapsablePanel = function CollapsablePanel(_ref) {
2069
+ var title = _ref.title,
2070
+ children = _ref.children,
2071
+ className = _ref.className,
2072
+ topClassName = _ref.topClassName,
2073
+ contentClassName = _ref.contentClassName,
2074
+ openedClassName = _ref.openedClassName,
2075
+ buttonClassName = _ref.buttonClassName;
2076
+ var _useState = React.useState(false),
2077
+ _useState2 = _slicedToArray(_useState, 2),
2078
+ opened = _useState2[0],
2079
+ setOpened = _useState2[1];
2080
+ var onClick = React.useCallback(function () {
2081
+ return setOpened(!opened);
2082
+ }, [opened, setOpened]);
2083
+ return /*#__PURE__*/React.createElement("div", {
2084
+ className: classNames([styles$i.container, _defineProperty(_defineProperty(_defineProperty({}, styles$i.isOpened, opened), openedClassName, opened && openedClassName !== null), className, className !== null)])
2085
+ }, /*#__PURE__*/React.createElement("div", {
2086
+ className: classNames([styles$i.top, _defineProperty({}, topClassName, topClassName !== null)])
2087
+ }, /*#__PURE__*/React.createElement(Button$1, {
2088
+ withoutStyle: true,
2089
+ className: classNames([styles$i.button, _defineProperty({}, buttonClassName, buttonClassName !== null)]),
2090
+ icon: /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
2091
+ icon: opened ? faAngleUp.faAngleUp : faAngleDown.faAngleDown,
2092
+ className: styles$i.icon
2093
+ }),
2094
+ iconPosition: "right",
2095
+ labelClassName: styles$i.label,
2096
+ onClick: onClick
2097
+ }, title)), /*#__PURE__*/React.createElement("div", {
2098
+ className: classNames([styles$i.content, _defineProperty({}, contentClassName, contentClassName !== null)])
2099
+ }, children));
2100
+ };
2101
+ CollapsablePanel.propTypes = propTypes$m;
2102
+ CollapsablePanel.defaultProps = defaultProps$m;
2103
+
2104
+ var propTypes$l = {
2105
+ stroke: PropTypes.string,
2106
+ border: PropTypes.string,
2107
+ fill: PropTypes.string,
2108
+ className: PropTypes.string
2109
+ };
2110
+ var defaultProps$l = {
2111
+ stroke: 'currentColor',
2112
+ border: 'rgba(0,0,0,0.67)',
2113
+ fill: '#fff',
2114
+ className: null
2115
+ };
2116
+ var Close = function Close(_ref) {
2117
+ var stroke = _ref.stroke,
2118
+ border = _ref.border,
2119
+ fill = _ref.fill,
2120
+ className = _ref.className;
2121
+ return /*#__PURE__*/React.createElement("svg", {
2122
+ xmlns: "http://www.w3.org/2000/svg",
2123
+ width: "42.9",
2124
+ height: "42.9",
2125
+ viewBox: "0 0 42.9 42.9",
2126
+ className: className
2127
+ }, /*#__PURE__*/React.createElement("g", {
2128
+ transform: "translate(-352.531 -47.531)"
2129
+ }, border ? /*#__PURE__*/React.createElement("path", {
2130
+ fill: border,
2131
+ d: "M374,47.5c11.9,0,21.5,9.6,21.5,21.5s-9.6,21.5-21.5,21.5s-21.5-9.6-21.5-21.5c0,0,0,0,0,0 C352.5,57.1,362.1,47.5,374,47.5z"
2132
+ }) : null, /*#__PURE__*/React.createElement("path", {
2133
+ fill: fill,
2134
+ d: "M374,50c10.5,0,19,8.5,19,19s-8.5,19-19,19s-19-8.5-19-19S363.5,50,374,50z"
2135
+ }), /*#__PURE__*/React.createElement("g", {
2136
+ transform: "translate(366.893 61.893)"
2137
+ }, /*#__PURE__*/React.createElement("g", {
2138
+ transform: "translate(0 0)"
2139
+ }, /*#__PURE__*/React.createElement("path", {
2140
+ fill: fill,
2141
+ stroke: stroke,
2142
+ strokeWidth: "2",
2143
+ strokeLinecap: "round",
2144
+ d: "M14.2,0.3L0,13.9"
2145
+ }), /*#__PURE__*/React.createElement("path", {
2146
+ fill: fill,
2147
+ stroke: stroke,
2148
+ strokeWidth: "2",
2149
+ strokeLinecap: "round",
2150
+ d: "M0.3,0l13.7,14.2"
2151
+ })))));
2152
+ };
2153
+ Close.propTypes = propTypes$l;
2154
+ Close.defaultProps = defaultProps$l;
2155
+
2156
+ /* eslint-disable react/jsx-props-no-spreading */
2157
+ var propTypes$k = {
2158
+ date: PropTypes.string,
2159
+ withTime: PropTypes.bool,
2160
+ timeSeparator: PropTypes.node
2161
+ };
2162
+ var defaultProps$k = {
2163
+ date: null,
2164
+ withTime: false,
2165
+ timeSeparator: ', '
2166
+ };
2167
+ var Date$1 = function Date(_ref) {
2168
+ var date = _ref.date,
2169
+ withTime = _ref.withTime,
2170
+ timeSeparator = _ref.timeSeparator;
2171
+ var dateObject = React.useMemo(function () {
2172
+ return dayjs(date).toDate();
2173
+ }, [date]);
2174
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(reactIntl.FormattedDate, {
2175
+ value: dateObject,
2176
+ year: "numeric",
2177
+ month: "long",
2178
+ day: "2-digit"
2179
+ }), withTime ? timeSeparator : null, withTime ? /*#__PURE__*/React.createElement(reactIntl.FormattedTime, {
2180
+ value: dateObject
2181
+ }) : null);
2182
+ };
2183
+ Date$1.propTypes = propTypes$k;
2184
+ Date$1.defaultProps = defaultProps$k;
2185
+
2186
+ /* eslint-disable react/no-danger */
2187
+ var propTypes$j = {
2188
+ throttleDelay: PropTypes.number,
2189
+ threshold: PropTypes.arrayOf(PropTypes.number),
2190
+ onEnter: PropTypes.func,
2191
+ onLeave: PropTypes.func,
2192
+ onChange: PropTypes.func,
2193
+ disabled: PropTypes.bool,
2194
+ children: PropTypes.node,
2195
+ className: PropTypes.string
2196
+ };
2197
+ var defaultProps$j = {
2198
+ throttleDelay: null,
2199
+ threshold: undefined,
2200
+ onEnter: null,
2201
+ onLeave: null,
2202
+ onChange: null,
2203
+ disabled: false,
2204
+ children: null,
2205
+ className: null
2206
+ };
2207
+ var Detector = function Detector(_ref) {
2208
+ var throttleDelay = _ref.throttleDelay,
2209
+ threshold = _ref.threshold,
2210
+ onEnter = _ref.onEnter,
2211
+ onLeave = _ref.onLeave,
2212
+ onChange = _ref.onChange,
2213
+ disabled = _ref.disabled,
2214
+ children = _ref.children,
2215
+ className = _ref.className;
2216
+ var _useIntersectionObser = hooks.useIntersectionObserver({
2217
+ threshold: threshold
2218
+ }),
2219
+ ref = _useIntersectionObser.ref,
2220
+ isIntersecting = _useIntersectionObser.entry.isIntersecting;
2221
+ var enteredRef = React.useRef(false);
2222
+ var triggerChange = React.useMemo(function () {
2223
+ var callback = function callback(intersecting) {
2224
+ var entered = enteredRef.current;
2225
+ if (onEnter !== null && intersecting && !entered) {
2226
+ onEnter();
2227
+ }
2228
+ if (onLeave !== null && !intersecting && entered) {
2229
+ onLeave();
2230
+ }
2231
+ if (onChange !== null) {
2232
+ onChange(intersecting);
2233
+ }
2234
+ if (intersecting && !entered) {
2235
+ enteredRef.current = true;
2236
+ } else if (!intersecting && entered) {
2237
+ enteredRef.current = false;
2238
+ }
2239
+ };
2240
+ return throttleDelay !== null ? throttle(callback, throttleDelay, {
2241
+ trailing: true,
2242
+ leading: true
2243
+ }) : callback;
2244
+ }, [throttleDelay, onEnter, onLeave, onChange]);
2245
+ React.useEffect(function () {
2246
+ if (disabled) {
2247
+ return function () {};
2248
+ }
2249
+ triggerChange(isIntersecting);
2250
+ return function () {
2251
+ if (throttleDelay !== null) {
2252
+ triggerChange.cancel();
2253
+ }
2254
+ };
2255
+ }, [throttleDelay, isIntersecting, disabled, triggerChange]);
2256
+ return /*#__PURE__*/React.createElement("div", {
2257
+ className: className,
2258
+ ref: ref
2259
+ }, children);
2260
+ };
2261
+ Detector.propTypes = propTypes$j;
2262
+ Detector.defaultProps = defaultProps$j;
2263
+
2264
+ var styles$h = {"container":"micromag-core-partials-placeholder-block-container","outline":"micromag-core-partials-placeholder-block-outline","withInvertedColors":"micromag-core-partials-placeholder-block-withInvertedColors","box":"micromag-core-partials-placeholder-block-box"};
2265
+
2266
+ var propTypes$i = {
2267
+ width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
2268
+ height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
2269
+ outline: PropTypes.bool,
2270
+ className: PropTypes.string,
2271
+ boxClassName: PropTypes.string,
2272
+ children: PropTypes.node,
2273
+ withInvertedColors: PropTypes.bool
2274
+ };
2275
+ var defaultProps$i = {
2276
+ width: '100%',
2277
+ height: '3em',
2278
+ outline: false,
2279
+ className: null,
2280
+ boxClassName: null,
2281
+ children: null,
2282
+ withInvertedColors: true
2283
+ };
2284
+ var PlaceholderBlock = function PlaceholderBlock(_ref) {
2285
+ var width = _ref.width,
2286
+ height = _ref.height,
2287
+ outline = _ref.outline,
2288
+ className = _ref.className,
2289
+ boxClassName = _ref.boxClassName,
2290
+ withInvertedColors = _ref.withInvertedColors,
2291
+ children = _ref.children;
2292
+ return /*#__PURE__*/React.createElement("div", {
2293
+ className: classNames([styles$h.container, _defineProperty(_defineProperty(_defineProperty({}, className, className !== null), styles$h.outline, outline), styles$h.withInvertedColors, withInvertedColors)])
2294
+ }, /*#__PURE__*/React.createElement("div", {
2295
+ className: classNames([styles$h.box, _defineProperty({}, boxClassName, boxClassName !== null)]),
2296
+ style: {
2297
+ width: width,
2298
+ height: height
2299
+ }
2300
+ }, children));
2301
+ };
2302
+ PlaceholderBlock.propTypes = propTypes$i;
2303
+ PlaceholderBlock.defaultProps = defaultProps$i;
2304
+
2305
+ /* eslint-disable react/jsx-props-no-spreading */
2306
+
2307
+ // import { PropTypes as MicromagPropTypes } from '@micromag/core';
2308
+
2309
+ var propTypes$h = {
2310
+ name: PropTypes.string.isRequired,
2311
+ components: PropTypes.object.isRequired,
2312
+ // eslint-disable-line
2313
+ props: PropTypes.object,
2314
+ // eslint-disable-line
2315
+ isPlaceholder: PropTypes.bool,
2316
+ className: PropTypes.string,
2317
+ placeholderProps: PropTypes.object // eslint-disable-line
2318
+ };
2319
+ var defaultProps$h = {
2320
+ props: {},
2321
+ isPlaceholder: false,
2322
+ className: null,
2323
+ placeholderProps: null
2324
+ };
2325
+ var ElementComponent = function ElementComponent(_ref) {
2326
+ var name = _ref.name,
2327
+ components = _ref.components,
2328
+ props = _ref.props,
2329
+ isPlaceholder = _ref.isPlaceholder,
2330
+ className = _ref.className,
2331
+ placeholderProps = _ref.placeholderProps;
2332
+ if (!name) {
2333
+ return 'Bad component name';
2334
+ }
2335
+ if (isPlaceholder) {
2336
+ // TODO: figure out what this did
2337
+ // const PlaceholderComponent = Placeholders[pascalCase(name)];
2338
+ return /*#__PURE__*/React.createElement(PlaceholderBlock, placeholderProps);
2339
+ }
2340
+ var RealComponent = components[utils.pascalCase(name)];
2341
+ if (!RealComponent) {
2342
+ return 'Bad component';
2343
+ }
2344
+ return /*#__PURE__*/React.createElement(RealComponent, Object.assign({}, props, {
2345
+ className: className
2346
+ }));
2347
+ };
2348
+ ElementComponent.propTypes = propTypes$h;
2349
+ ElementComponent.defaultProps = defaultProps$h;
2350
+
2351
+ var styles$g = {"container":"micromag-core-partials-empty-container","middle":"micromag-core-partials-empty-middle","withoutBorder":"micromag-core-partials-empty-withoutBorder"};
2352
+
2353
+ var propTypes$g = {
2354
+ children: PropTypes.node,
2355
+ withoutBorder: PropTypes.bool,
2356
+ light: PropTypes.bool,
2357
+ className: PropTypes.string
2358
+ };
2359
+ var defaultProps$g = {
2360
+ children: null,
2361
+ withoutBorder: false,
2362
+ light: false,
2363
+ className: null
2364
+ };
2365
+ var Empty = function Empty(_ref) {
2366
+ var children = _ref.children,
2367
+ withoutBorder = _ref.withoutBorder,
2368
+ light = _ref.light,
2369
+ className = _ref.className;
2370
+ return /*#__PURE__*/React.createElement("div", {
2371
+ className: classNames([styles$g.container, _defineProperty(_defineProperty(_defineProperty({}, styles$g.withoutBorder, withoutBorder), styles$g.light, light), className, className)])
2372
+ }, /*#__PURE__*/React.createElement("div", {
2373
+ className: styles$g.middle
2374
+ }, /*#__PURE__*/React.createElement(Label, null, children)));
2375
+ };
2376
+ Empty.propTypes = propTypes$g;
2377
+ Empty.defaultProps = defaultProps$g;
2378
+
2379
+ var getUrlsFromMedia = function getUrlsFromMedia(media, formats) {
2380
+ var _ref = media || {},
2381
+ _ref$files = _ref.files,
2382
+ files = _ref$files === void 0 ? {} : _ref$files;
2383
+ var _ref2 = files || {},
2384
+ _ref2$original = _ref2.original,
2385
+ originalFile = _ref2$original === void 0 ? null : _ref2$original;
2386
+ var _ref3 = originalFile || {},
2387
+ _ref3$name = _ref3.name,
2388
+ originalName = _ref3$name === void 0 ? null : _ref3$name,
2389
+ _ref3$mime = _ref3.mime,
2390
+ originalMime = _ref3$mime === void 0 ? null : _ref3$mime;
2391
+ var urls = formats.reduce(function (currentUrls, format) {
2392
+ var finalFormat = isObject(format) ? format.format : format;
2393
+ var formatExtension = isObject(format) ? format.name : format;
2394
+ var file = files["webfonts.".concat(formatExtension)] || files[formatExtension] || null;
2395
+ if (file !== null) {
2396
+ return [].concat(_toConsumableArray(currentUrls), ["url(\"".concat(file.url, "?\") format(\"").concat(finalFormat, "\")")]);
2397
+ }
2398
+ var extensionRegExp = new RegExp(".".concat(formatExtension, "$"), 'i');
2399
+ var mimeRegExp = new RegExp("".concat(finalFormat), 'i');
2400
+ if (originalName !== null && originalName.match(extensionRegExp) !== null || originalMime !== null && originalMime.match(mimeRegExp) !== null) {
2401
+ return [].concat(_toConsumableArray(currentUrls), ["url(\"".concat(originalFile.url, "?\") format(\"").concat(finalFormat, "\")")]);
2402
+ }
2403
+ return currentUrls;
2404
+ }, []);
2405
+ return urls;
2406
+ };
2407
+ var propTypes$f = {
2408
+ fonts: core.PropTypes.fonts,
2409
+ formats: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
2410
+ name: PropTypes.string,
2411
+ format: PropTypes.string
2412
+ })]))
2413
+ };
2414
+ var defaultProps$f = {
2415
+ fonts: [],
2416
+ formats: ['eot', 'woff2', 'woff', {
2417
+ name: 'otf',
2418
+ format: 'opentype'
2419
+ }, {
2420
+ name: 'ttf',
2421
+ format: 'truetype'
2422
+ }, 'svg']
2423
+ };
2424
+ var FontFaces = function FontFaces(_ref4) {
2425
+ var fonts = _ref4.fonts,
2426
+ formats = _ref4.formats;
2427
+ var fontFaces = (fonts || []).filter(function (it) {
2428
+ return isObject(it) && it.type === 'custom' && (it.media || null) !== null;
2429
+ }).reduce(function (fontFontFaces, _ref5) {
2430
+ var _ref5$name = _ref5.name,
2431
+ name = _ref5$name === void 0 ? null : _ref5$name,
2432
+ _ref5$media = _ref5.media,
2433
+ media = _ref5$media === void 0 ? null : _ref5$media,
2434
+ _ref5$variants = _ref5.variants,
2435
+ variants = _ref5$variants === void 0 ? [] : _ref5$variants;
2436
+ if (name === null) {
2437
+ return fontFontFaces;
2438
+ }
2439
+ var urls = media !== null ? getUrlsFromMedia(media, formats) : null;
2440
+ return [].concat(_toConsumableArray(fontFontFaces), [urls !== null && urls.length > 0 ? "\n @font-face {\n font-family: \"".concat(name, "\";\n src: ").concat(urls.join(','), ";\n }\n ") : null], _toConsumableArray((variants || []).map(function (_ref6) {
2441
+ var weight = _ref6.weight,
2442
+ style = _ref6.style,
2443
+ _ref6$media = _ref6.media,
2444
+ variantMedia = _ref6$media === void 0 ? null : _ref6$media;
2445
+ if (variantMedia == null) {
2446
+ return null;
2447
+ }
2448
+ var variantUrls = getUrlsFromMedia(variantMedia, formats);
2449
+ return variantUrls !== null && variantUrls.length > 0 ? "\n @font-face {\n font-family: \"".concat(name, "\";\n ").concat(weight !== null ? "font-weight: ".concat(weight, ";") : '', "\n ").concat(style !== null ? "font-style: ".concat(style, ";") : '', "\n src: ").concat(variantUrls.join(','), ";\n }\n ") : null;
2450
+ })));
2451
+ }, []).filter(function (it) {
2452
+ return it !== null;
2453
+ });
2454
+ return fontFaces.length > 0 ? /*#__PURE__*/React.createElement("style", {
2455
+ type: "text/css",
2456
+ dangerouslySetInnerHTML: {
2457
+ __html: fontFaces.join('\n')
2458
+ }
2459
+ }) : null;
2460
+ };
2461
+ FontFaces.propTypes = propTypes$f;
2462
+ FontFaces.defaultProps = defaultProps$f;
2463
+
2464
+ var styles$f = {};
2465
+
2466
+ var propTypes$e = {
2467
+ thumbnail: PropTypes.node,
2468
+ thumbnailAlign: PropTypes.oneOf(['top', 'center', 'bottom']),
2469
+ children: PropTypes.node,
2470
+ title: core.PropTypes.label,
2471
+ className: PropTypes.string,
2472
+ thumbnailClassName: PropTypes.string,
2473
+ bodyClassName: PropTypes.string,
2474
+ titleClassName: PropTypes.string
2475
+ };
2476
+ var defaultProps$e = {
2477
+ thumbnail: null,
2478
+ thumbnailAlign: 'top',
2479
+ children: null,
2480
+ title: null,
2481
+ className: null,
2482
+ thumbnailClassName: null,
2483
+ bodyClassName: null,
2484
+ titleClassName: null
2485
+ };
2486
+ var Media = function Media(_ref) {
2487
+ var thumbnail = _ref.thumbnail,
2488
+ thumbnailAlign = _ref.thumbnailAlign,
2489
+ children = _ref.children,
2490
+ title = _ref.title,
2491
+ className = _ref.className,
2492
+ thumbnailClassName = _ref.thumbnailClassName,
2493
+ bodyClassName = _ref.bodyClassName,
2494
+ titleClassName = _ref.titleClassName;
2495
+ return /*#__PURE__*/React.createElement("div", {
2496
+ className: classNames(['card', styles$f.container, _defineProperty({}, className, className !== null)])
2497
+ }, typeof thumbnail === 'string' ? /*#__PURE__*/React.createElement("img", {
2498
+ src: thumbnail,
2499
+ alt: title,
2500
+ className: classNames(['me-3', styles$f.thumbnail, _defineProperty({
2501
+ 'align-self-start': thumbnailAlign === 'top',
2502
+ 'align-self-center': thumbnailAlign === 'center',
2503
+ 'align-self-end': thumbnailAlign === 'bottom'
2504
+ }, thumbnailClassName, thumbnailClassName !== null)])
2505
+ }) : thumbnail, title !== null || children !== null ? /*#__PURE__*/React.createElement("div", {
2506
+ className: classNames(['card-body', styles$f.body, _defineProperty({}, bodyClassName, bodyClassName !== null)])
2507
+ }, title !== null ? /*#__PURE__*/React.createElement("h5", {
2508
+ className: classNames(['mt-0', 'text-truncate', styles$f.title, _defineProperty({}, titleClassName, titleClassName !== null)])
2509
+ }, /*#__PURE__*/React.createElement(Label, null, title)) : null, children) : null);
2510
+ };
2511
+ Media.propTypes = propTypes$e;
2512
+ Media.defaultProps = defaultProps$e;
2513
+
2514
+ /**
2515
+ * Core
2516
+ */
2517
+ PropTypes.shape({
2518
+ listen: PropTypes.func.isRequired,
2519
+ push: PropTypes.func.isRequired
2520
+ });
2521
+ PropTypes.shape({
2522
+ pathname: PropTypes.string,
2523
+ search: PropTypes.string
2524
+ });
2525
+ PropTypes.shape({
2526
+ locale: PropTypes.string.isRequired,
2527
+ formatMessage: PropTypes.func.isRequired
2528
+ });
2529
+ var defaultMessageContent = PropTypes.shape({
2530
+ type: PropTypes.number,
2531
+ value: PropTypes.string
2532
+ });
2533
+ var defaultMessage = PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(defaultMessageContent)]);
2534
+ var message = PropTypes.shape({
2535
+ id: PropTypes.string,
2536
+ defaultMessage: defaultMessage.isRequired,
2537
+ description: PropTypes.string
2538
+ });
2539
+ var text = PropTypes.oneOfType([message, PropTypes.string]);
2540
+ var label = PropTypes.oneOfType([message, PropTypes.node]);
2541
+ PropTypes.oneOf([401, 403, 404, 500]);
2542
+ PropTypes.oneOfType([PropTypes.shape({
2543
+ current: PropTypes.any // eslint-disable-line react/forbid-prop-types
2544
+ }), PropTypes.func]);
2545
+ var target = PropTypes.oneOf(['_blank', '_self', '_parent']);
2546
+ var interaction = PropTypes.oneOf(['tap', 'swipe']);
2547
+ PropTypes.arrayOf(interaction);
2548
+ PropTypes.objectOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]));
2549
+ PropTypes.shape({
2550
+ currentTime: PropTypes.number,
2551
+ duration: PropTypes.number
2552
+ });
2553
+
2554
+ /**
2555
+ * Site
2556
+ */
2557
+ PropTypes.shape({
2558
+ id: PropTypes.number,
2559
+ firstname: PropTypes.string,
2560
+ lastname: PropTypes.string,
2561
+ email: PropTypes.string,
2562
+ gender: PropTypes.string,
2563
+ birthdate: PropTypes.string
2564
+ });
2565
+ var menuItem = PropTypes.shape({
2566
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
2567
+ label: label,
2568
+ url: PropTypes.string,
2569
+ external: PropTypes.bool,
2570
+ active: PropTypes.bool
2571
+ });
2572
+ PropTypes.arrayOf(menuItem);
2573
+ var breadcrumb = PropTypes.shape({
2574
+ label: label,
2575
+ url: PropTypes.string
2576
+ });
2577
+ PropTypes.arrayOf(breadcrumb);
2578
+ var device = PropTypes.shape({
2579
+ id: PropTypes.string.isRequired
2580
+ });
2581
+ PropTypes.arrayOf(device);
2582
+ var modal = PropTypes.shape({
2583
+ id: PropTypes.string.isRequired
2584
+ });
2585
+ PropTypes.arrayOf(modal);
2586
+ var panel = PropTypes.shape({
2587
+ id: PropTypes.string.isRequired
2588
+ });
2589
+ PropTypes.arrayOf(panel);
2590
+ var button = PropTypes.shape({
2591
+ label: label,
2592
+ onClick: PropTypes.func
2593
+ });
2594
+ PropTypes.arrayOf(button);
2595
+ var bootstrapThemeStrings = ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark'];
2596
+ PropTypes.oneOf(bootstrapThemeStrings);
2597
+ PropTypes.oneOf([].concat(bootstrapThemeStrings, ['outline-primary', 'outline-secondary', 'outline-success', 'outline-danger', 'outline-warning', 'outline-info', 'outline-light', 'outline-dark', 'outline-link', null]));
2598
+ PropTypes.oneOf(['lg', 'sm', null]);
2599
+ PropTypes.oneOf(['lg', 'sm', null]);
2600
+ PropTypes.oneOf(['start', 'end']);
2601
+ var component = PropTypes.oneOfType([PropTypes.object, PropTypes.func]);
2602
+ PropTypes.objectOf(component);
2603
+
2604
+ /**
2605
+ * Forms
2606
+ */
2607
+ var errors = PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]);
2608
+ PropTypes.objectOf(errors);
2609
+ var selectOption = PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
2610
+ value: PropTypes.any,
2611
+ // eslint-disable-line
2612
+ label: label
2613
+ })]);
2614
+ PropTypes.arrayOf(selectOption);
2615
+ var formField = PropTypes.shape({
2616
+ name: PropTypes.string,
2617
+ component: component
2618
+ });
2619
+ PropTypes.arrayOf(formField);
2620
+
2621
+ /**
2622
+ * Medias
2623
+ */
2624
+ var mediaMetadataShape = {
2625
+ filename: PropTypes.string,
2626
+ size: PropTypes.number,
2627
+ mime: PropTypes.string
2628
+ };
2629
+ var mediaFile = PropTypes.shape({
2630
+ id: PropTypes.string,
2631
+ handle: PropTypes.string,
2632
+ type: PropTypes.string,
2633
+ mime: PropTypes.string,
2634
+ url: PropTypes.string
2635
+ });
2636
+ var mediaShape = {
2637
+ id: PropTypes.string,
2638
+ type: PropTypes.string.isRequired,
2639
+ url: PropTypes.string,
2640
+ // .isRequired,
2641
+ thumbnail_url: PropTypes.string,
2642
+ name: PropTypes.string,
2643
+ metadata: PropTypes.shape(_objectSpread({}, mediaMetadataShape)),
2644
+ files: PropTypes.objectOf(mediaFile)
2645
+ };
2646
+ var media = PropTypes.shape(mediaShape);
2647
+ PropTypes.arrayOf(media);
2648
+ PropTypes.oneOf(['image', 'video', 'audio', 'closed-captions', 'font']);
2649
+ var imageMedia = PropTypes.shape(_objectSpread(_objectSpread({}, mediaShape), {}, {
2650
+ type: PropTypes.oneOf(['image', 'video']),
2651
+ metadata: PropTypes.shape(_objectSpread(_objectSpread({}, mediaMetadataShape), {}, {
2652
+ width: PropTypes.number,
2653
+ height: PropTypes.number
2654
+ }))
2655
+ }));
2656
+ PropTypes.arrayOf(imageMedia);
2657
+ var fontMedia = PropTypes.shape(_objectSpread(_objectSpread({}, mediaShape), {}, {
2658
+ type: PropTypes.oneOf(['font']),
2659
+ metadata: PropTypes.shape(_objectSpread({}, mediaMetadataShape))
2660
+ }));
2661
+ PropTypes.arrayOf(fontMedia);
2662
+ var videoMedia = PropTypes.shape(_objectSpread(_objectSpread({}, mediaShape), {}, {
2663
+ type: PropTypes.oneOf(['video']),
2664
+ metadata: PropTypes.shape(_objectSpread(_objectSpread({}, mediaMetadataShape), {}, {
2665
+ width: PropTypes.number,
2666
+ height: PropTypes.number,
2667
+ duration: PropTypes.number
2668
+ }))
2669
+ }));
2670
+ PropTypes.arrayOf(videoMedia);
2671
+ var audioMedia = PropTypes.shape(_objectSpread(_objectSpread({}, mediaShape), {}, {
2672
+ type: PropTypes.oneOf(['audio']),
2673
+ metadata: PropTypes.shape(_objectSpread(_objectSpread({}, mediaMetadataShape), {}, {
2674
+ duration: PropTypes.number
2675
+ }))
2676
+ }));
2677
+ PropTypes.arrayOf(audioMedia);
2678
+ var closedCaptionsMedia = PropTypes.shape(_objectSpread(_objectSpread({}, mediaShape), {}, {
2679
+ type: PropTypes.oneOf(['closed-captions'])
2680
+ }));
2681
+
2682
+ /**
2683
+ * Style
2684
+ */
2685
+
2686
+ PropTypes.shape({
2687
+ type: PropTypes.oneOf(['system', 'google', 'custom']),
2688
+ name: PropTypes.string,
2689
+ media: fontMedia
2690
+ });
2691
+ var font = PropTypes.oneOfType([PropTypes.object, PropTypes.string]);
2692
+ PropTypes.arrayOf(font);
2693
+ var textAlign = PropTypes.oneOf(['left', 'right', 'center']);
2694
+ var colorObject = PropTypes.shape({
2695
+ color: PropTypes.string,
2696
+ alpha: PropTypes.number
2697
+ });
2698
+ var color = PropTypes.oneOfType([colorObject, PropTypes.string]);
2699
+ var textStyle = PropTypes.shape({
2700
+ fontFamily: font,
2701
+ fontSize: PropTypes.number,
2702
+ fontStyle: PropTypes.shape({
2703
+ bold: PropTypes.bool,
2704
+ italic: PropTypes.bool,
2705
+ underline: PropTypes.bool,
2706
+ upperCase: PropTypes.bool
2707
+ }),
2708
+ align: textAlign,
2709
+ color: color,
2710
+ letterSpacing: PropTypes.number,
2711
+ lineHeight: PropTypes.number
2712
+ });
2713
+ var borderTypes = PropTypes.oneOf(['dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset', 'hidden']);
2714
+ var shadowType = PropTypes.shape({
2715
+ shadowDistance: PropTypes.number,
2716
+ shadowBlur: PropTypes.number,
2717
+ shadowColor: color
2718
+ });
2719
+ PropTypes.shape({
2720
+ width: PropTypes.number,
2721
+ style: borderTypes,
2722
+ radius: PropTypes.number,
2723
+ color: color
2724
+ });
2725
+ var boxStyle = PropTypes.shape({
2726
+ backgroundColor: color,
2727
+ borderRadius: PropTypes.number,
2728
+ borderWidth: PropTypes.number,
2729
+ borderColor: color,
2730
+ borderStyle: borderTypes,
2731
+ shadow: shadowType
2732
+ });
2733
+ PropTypes.shape({
2734
+ top: PropTypes.number,
2735
+ bottom: PropTypes.number
2736
+ });
2737
+ PropTypes.arrayOf(PropTypes.shape({
2738
+ rows: PropTypes.oneOfType([PropTypes.number, PropTypes.arrayOf(PropTypes.number)]),
2739
+ columns: PropTypes.oneOfType([PropTypes.number, PropTypes.arrayOf(PropTypes.number)])
2740
+ }));
2741
+ var objectFitSize = PropTypes.oneOf(['cover', 'contain', null]);
2742
+ PropTypes.shape({
2743
+ fit: objectFitSize,
2744
+ horizontalPosition: PropTypes.oneOf(['left', 'center', 'right']),
2745
+ verticalPosition: PropTypes.oneOf(['top', 'center', 'bottom'])
2746
+ });
2747
+
2748
+ /**
2749
+ * Elements
2750
+ */
2751
+
2752
+ var textElement = PropTypes.shape({
2753
+ body: PropTypes.string,
2754
+ textStyle: textStyle
2755
+ });
2756
+ var headingElement = textElement;
2757
+ PropTypes.shape({
2758
+ label: PropTypes.string,
2759
+ textStyle: textStyle
2760
+ });
2761
+ var imageElement = PropTypes.shape({
2762
+ media: imageMedia
2763
+ });
2764
+ PropTypes.arrayOf(imageElement);
2765
+ PropTypes.shape({
2766
+ media: videoMedia,
2767
+ autoPlay: PropTypes.bool,
2768
+ loop: PropTypes.bool,
2769
+ closedCaptions: closedCaptionsMedia,
2770
+ withSeekBar: PropTypes.bool,
2771
+ withControls: PropTypes.bool
2772
+ });
2773
+ var visualElement = PropTypes.shape({
2774
+ media: imageMedia
2775
+ });
2776
+ PropTypes.arrayOf(visualElement);
2777
+ PropTypes.shape({
2778
+ media: audioMedia,
2779
+ autoPlay: PropTypes.bool,
2780
+ loop: PropTypes.bool,
2781
+ closedCaptions: closedCaptionsMedia,
2782
+ withPlayPause: PropTypes.bool
2783
+ });
2784
+ PropTypes.shape({
2785
+ media: closedCaptionsMedia
2786
+ });
2787
+ var backgroundElement = PropTypes.shape({
2788
+ color: color,
2789
+ image: imageMedia,
2790
+ video: videoMedia
2791
+ });
2792
+ var imageElementWithCaption = PropTypes.shape({
2793
+ image: imageMedia,
2794
+ caption: textElement
2795
+ });
2796
+ PropTypes.arrayOf(imageElementWithCaption);
2797
+ var stackDirection = PropTypes.oneOf(['horizontal', 'vertical']);
2798
+ var stackAlign = PropTypes.oneOf(['start', 'center', 'end']);
2799
+ var stackSpacing = PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(['between', 'evenly', 'around'])]);
2800
+ PropTypes.shape({
2801
+ direction: stackDirection,
2802
+ align: stackAlign,
2803
+ width: PropTypes.number,
2804
+ height: PropTypes.number,
2805
+ spacing: stackSpacing,
2806
+ reverse: PropTypes.bool
2807
+ });
2808
+ PropTypes.shape({
2809
+ layout: PropTypes.arrayOf(PropTypes.string),
2810
+ spacing: PropTypes.number
2811
+ });
2812
+ var geoPosition = PropTypes.shape({
2813
+ lat: PropTypes.number,
2814
+ lng: PropTypes.number
2815
+ });
2816
+ var markerShape = {
2817
+ id: PropTypes.number,
2818
+ geoPosition: geoPosition,
2819
+ title: headingElement,
2820
+ subtitle: headingElement,
2821
+ description: textElement
2822
+ };
2823
+ var marker = PropTypes.shape(_objectSpread({}, markerShape));
2824
+ PropTypes.arrayOf(marker);
2825
+ var markerWithImage = PropTypes.shape(_objectSpread(_objectSpread({}, markerShape), {}, {
2826
+ image: imageMedia
2827
+ }));
2828
+ PropTypes.arrayOf(markerWithImage);
2829
+ var answerShape = {
2830
+ id: PropTypes.string,
2831
+ label: textElement
2832
+ };
2833
+ var answer = PropTypes.shape(_objectSpread({}, answerShape));
2834
+ var quizAnswer = PropTypes.shape(_objectSpread(_objectSpread({}, answerShape), {}, {
2835
+ good: PropTypes.bool
2836
+ }));
2837
+ PropTypes.arrayOf(answer);
2838
+ PropTypes.arrayOf(quizAnswer);
2839
+ var callToActionTypes = PropTypes.oneOf(['swipe-up', 'button']);
2840
+ var callToAction = PropTypes.shape({
2841
+ active: PropTypes.bool,
2842
+ type: callToActionTypes,
2843
+ url: PropTypes.string,
2844
+ label: textElement,
2845
+ buttonStyle: boxStyle
2846
+ });
2847
+ PropTypes.shape({
2848
+ active: PropTypes.bool,
2849
+ label: textElement,
2850
+ boxStyle: boxStyle
2851
+ });
2852
+ PropTypes.shape({
2853
+ active: PropTypes.bool
2854
+ });
2855
+ var speaker = PropTypes.shape({
2856
+ id: PropTypes.string,
2857
+ name: PropTypes.string,
2858
+ avatar: imageMedia,
2859
+ side: PropTypes.oneOf(['left', 'right']),
2860
+ color: color
2861
+ });
2862
+ var speakers = PropTypes.arrayOf(speaker);
2863
+ var conversationMessage = PropTypes.shape({
2864
+ speaker: PropTypes.string,
2865
+ message: PropTypes.string,
2866
+ image: imageMedia,
2867
+ audio: audioMedia,
2868
+ timingOverrides: PropTypes.shape({
2869
+ enabled: PropTypes.bool,
2870
+ appearDelay: PropTypes.number,
2871
+ writingStateDuration: PropTypes.number
2872
+ })
2873
+ });
2874
+ var conversationMessages = PropTypes.arrayOf(conversationMessage);
2875
+ PropTypes.shape({
2876
+ speakers: speakers,
2877
+ textStyle: textStyle,
2878
+ messages: conversationMessages
2879
+ });
2880
+
2881
+ /**
2882
+ * Definitions
2883
+ */
2884
+
2885
+ var fieldShape = {
2886
+ name: PropTypes.string,
2887
+ type: PropTypes.string.isRequired,
2888
+ label: text
2889
+ };
2890
+ var field = PropTypes.shape(_objectSpread(_objectSpread({}, fieldShape), {}, {
2891
+ isSection: PropTypes.bool,
2892
+ fields: PropTypes.arrayOf(PropTypes.shape(fieldShape))
2893
+ }));
2894
+ var fields = PropTypes.arrayOf(field);
2895
+ var screenDefinition = PropTypes.shape({
2896
+ id: PropTypes.string.isRequired,
2897
+ type: PropTypes.oneOf(['screen']).isRequired,
2898
+ title: text.isRequired,
2899
+ layouts: PropTypes.arrayOf(PropTypes.string),
2900
+ fields: fields
2901
+ });
2902
+ PropTypes.arrayOf(screenDefinition);
2903
+ var fieldDefinition = PropTypes.shape({
2904
+ id: PropTypes.string.isRequired,
2905
+ type: PropTypes.oneOf(['field']).isRequired,
2906
+ title: text.isRequired,
2907
+ fields: fields
2908
+ });
2909
+ PropTypes.arrayOf(fieldDefinition);
2910
+
2911
+ /**
2912
+ * Components
2913
+ */
2914
+ var storyComponentShape = {
2915
+ type: PropTypes.string.isRequired
2916
+ };
2917
+ var storyComponent = PropTypes.shape(_objectSpread({}, storyComponentShape));
2918
+ PropTypes.arrayOf(storyComponent);
2919
+ var screenComponent = PropTypes.shape(_objectSpread({}, storyComponentShape));
2920
+ var screenComponents = PropTypes.arrayOf(screenComponent);
2921
+
2922
+ /**
2923
+ * Theme
2924
+ */
2925
+ var theme = PropTypes.shape({
2926
+ id: PropTypes.string,
2927
+ textStyles: PropTypes.objectOf(textStyle),
2928
+ // renamed to textstyles
2929
+ background: backgroundElement,
2930
+ colors: PropTypes.objectOf(color),
2931
+ components: screenComponents
2932
+ });
2933
+ PropTypes.shape(_objectSpread({
2934
+ logo: imageMedia
2935
+ }, theme));
2936
+
2937
+ /**
2938
+ * Branding
2939
+ */
2940
+
2941
+ // export const branding = PropTypes.shape({
2942
+ // logo: imageMedia,
2943
+ // primaryColor: color,
2944
+ // secondaryColor: color,
2945
+ // backgroundColor: color,
2946
+ // textStyle,
2947
+ // });
2948
+
2949
+ /**
2950
+ * Metadata
2951
+ */
2952
+ var metadata = PropTypes.shape({
2953
+ description: PropTypes.string,
2954
+ shareUrl: PropTypes.string,
2955
+ shareImage: imageMedia,
2956
+ favIcon: imageMedia
2957
+ });
2958
+ var tag = PropTypes.shape({
2959
+ label: PropTypes.string,
2960
+ value: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
2961
+ });
2962
+ PropTypes.arrayOf(tag);
2963
+
2964
+ /**
2965
+ * Story
2966
+ */
2967
+ PropTypes.shape({
2968
+ id: PropTypes.string,
2969
+ theme: theme,
2970
+ components: screenComponents,
2971
+ metadata: metadata
2972
+ });
2973
+
2974
+ /**
2975
+ * Render
2976
+ */
2977
+ var deviceScreen = PropTypes.shape({
2978
+ name: PropTypes.string.isRequired,
2979
+ mediaQuery: PropTypes.string
2980
+ });
2981
+ PropTypes.arrayOf(deviceScreen);
2982
+ PropTypes.shape({
2983
+ screen: PropTypes.string,
2984
+ screens: PropTypes.arrayOf(PropTypes.string),
2985
+ width: PropTypes.number,
2986
+ height: PropTypes.number,
2987
+ landscape: PropTypes.bool
2988
+ });
2989
+ PropTypes.oneOf(['view', 'placeholder', 'edit', 'preview', 'static', 'capture']);
2990
+
2991
+ /**
2992
+ * Screens
2993
+ */
2994
+
2995
+ PropTypes.shape({
2996
+ width: PropTypes.number,
2997
+ height: PropTypes.number
2998
+ });
2999
+ PropTypes.shape({
3000
+ width: PropTypes.number,
3001
+ height: PropTypes.number,
3002
+ url: PropTypes.string,
3003
+ target: target,
3004
+ iframe: PropTypes.string,
3005
+ image: imageMedia
3006
+ });
3007
+ PropTypes.shape({
3008
+ src: PropTypes.string,
3009
+ track: PropTypes.string,
3010
+ trackLng: PropTypes.number,
3011
+ controls: PropTypes.bool
3012
+ });
3013
+ var slide = PropTypes.shape({
3014
+ image: imageMedia,
3015
+ text: PropTypes.string
3016
+ });
3017
+ PropTypes.arrayOf(slide);
3018
+
3019
+ // export const imageStyle = PropTypes.shape({
3020
+ // alt: PropTypes.string,
3021
+ // fit: PropTypes.object,
3022
+ // });
3023
+
3024
+ PropTypes.shape({});
3025
+
3026
+ /**
3027
+ * Transitions
3028
+ */
3029
+
3030
+ var transitionName = PropTypes.oneOf(['fade', 'scale', 'slide']);
3031
+ var transitionParams = {
3032
+ duration: PropTypes.number,
3033
+ easing: PropTypes.oneOf(['ease', 'ease-in', 'ease-out', 'ease-in-out', 'linear'])
3034
+ };
3035
+ var transition = PropTypes.oneOfType([transitionName.isRequired, PropTypes.shape(_objectSpread({
3036
+ name: transitionName.isRequired
3037
+ }, transitionParams))]);
3038
+ PropTypes.shape({
3039
+ "in": transition,
3040
+ out: transition
3041
+ });
3042
+
3043
+ /**
3044
+ * Search
3045
+ */
3046
+
3047
+ var searchFilter = PropTypes.shape({
3048
+ type: PropTypes.string,
3049
+ value: PropTypes.oneOf([PropTypes.string, PropTypes.number])
3050
+ });
3051
+ PropTypes.arrayOf(searchFilter);
3052
+
3053
+ /**
3054
+ * Payments
3055
+ */
3056
+
3057
+ var paymentItem = PropTypes.shape({
3058
+ id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
3059
+ date: PropTypes.string,
3060
+ type: PropTypes.string,
3061
+ invoice_link: PropTypes.string,
3062
+ amount: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
3063
+ });
3064
+ PropTypes.arrayOf(paymentItem);
3065
+
3066
+ /**
3067
+ * Page Metadada
3068
+ */
3069
+
3070
+ var pageMetadata = PropTypes.shape({
3071
+ canonical: PropTypes.string,
3072
+ description: PropTypes.string,
3073
+ keywords: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
3074
+ image: PropTypes.shape({
3075
+ url: PropTypes.string
3076
+ }),
3077
+ favicon: PropTypes.shape({
3078
+ url: PropTypes.string
3079
+ }),
3080
+ rssUrl: PropTypes.string,
3081
+ atomUrl: PropTypes.string,
3082
+ microformats: PropTypes.arrayOf(PropTypes.shape({}))
3083
+ });
3084
+ PropTypes.shape({
3085
+ name: textElement,
3086
+ avatar: PropTypes.shape({
3087
+ url: PropTypes.string
3088
+ })
3089
+ });
3090
+ PropTypes.shape({
3091
+ id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
3092
+ name: PropTypes.string
3093
+ });
3094
+ var badge = PropTypes.shape({
3095
+ label: textElement,
3096
+ buttonStyle: boxStyle
3097
+ });
3098
+ PropTypes.shape({
3099
+ active: PropTypes.bool,
3100
+ placeholder: textElement,
3101
+ textStyle: textStyle,
3102
+ boxStyle: boxStyle
3103
+ });
3104
+ PropTypes.shape({
3105
+ badge: badge
3106
+ });
3107
+ PropTypes.shape({
3108
+ callToAction: callToAction
3109
+ });
3110
+ PropTypes.shape();
3111
+ PropTypes.shape({
3112
+ file: closedCaptionsMedia,
3113
+ textStyle: textStyle,
3114
+ boxStyle: boxStyle
3115
+ });
3116
+
3117
+ /* eslint-disable react/no-array-index-key */
3118
+ var propTypes$d = {
3119
+ title: PropTypes.string,
3120
+ url: PropTypes.string,
3121
+ metadata: pageMetadata,
3122
+ fullTitle: PropTypes.string,
3123
+ suffix: PropTypes.string,
3124
+ children: PropTypes.node
3125
+ };
3126
+ var defaultProps$d = {
3127
+ title: null,
3128
+ url: null,
3129
+ metadata: null,
3130
+ fullTitle: null,
3131
+ suffix: 'Micromag',
3132
+ children: null
3133
+ };
3134
+ var Meta = function Meta(_ref) {
3135
+ var title = _ref.title,
3136
+ url = _ref.url,
3137
+ metadata = _ref.metadata,
3138
+ fullTitle = _ref.fullTitle,
3139
+ suffix = _ref.suffix,
3140
+ children = _ref.children;
3141
+ var _ref2 = metadata || {},
3142
+ _ref2$canonical = _ref2.canonical,
3143
+ canonical = _ref2$canonical === void 0 ? null : _ref2$canonical,
3144
+ _ref2$description = _ref2.description,
3145
+ description = _ref2$description === void 0 ? null : _ref2$description,
3146
+ _ref2$keywords = _ref2.keywords,
3147
+ keywords = _ref2$keywords === void 0 ? null : _ref2$keywords,
3148
+ _ref2$image = _ref2.image,
3149
+ image = _ref2$image === void 0 ? null : _ref2$image,
3150
+ _ref2$favicon = _ref2.favicon,
3151
+ favicon = _ref2$favicon === void 0 ? null : _ref2$favicon,
3152
+ _ref2$rssUrl = _ref2.rssUrl,
3153
+ rssUrl = _ref2$rssUrl === void 0 ? null : _ref2$rssUrl,
3154
+ _ref2$atomUrl = _ref2.atomUrl,
3155
+ atomUrl = _ref2$atomUrl === void 0 ? null : _ref2$atomUrl,
3156
+ _ref2$microformats = _ref2.microformats,
3157
+ microformats = _ref2$microformats === void 0 ? [] : _ref2$microformats,
3158
+ _ref2$language = _ref2.language,
3159
+ language = _ref2$language === void 0 ? null : _ref2$language;
3160
+ var realTitle = title !== null ? "".concat(title, " | ").concat(suffix) : fullTitle;
3161
+ var _ref3 = image || {},
3162
+ _ref3$url = _ref3.url,
3163
+ imageUrl = _ref3$url === void 0 ? null : _ref3$url,
3164
+ _ref3$metadata = _ref3.metadata,
3165
+ imageMetadata = _ref3$metadata === void 0 ? {} : _ref3$metadata;
3166
+ var _ref4 = imageMetadata || {},
3167
+ _ref4$width = _ref4.width,
3168
+ imageWidth = _ref4$width === void 0 ? null : _ref4$width,
3169
+ _ref4$height = _ref4.height,
3170
+ imageHeight = _ref4$height === void 0 ? null : _ref4$height;
3171
+ var _ref5 = favicon || {},
3172
+ _ref5$url = _ref5.url,
3173
+ faviconUrl = _ref5$url === void 0 ? null : _ref5$url;
3174
+ return /*#__PURE__*/React.createElement(reactHelmet.Helmet, null, /*#__PURE__*/React.createElement("title", null, realTitle !== null && realTitle.length > 0 ? realTitle : 'Micromag'), description !== null ? /*#__PURE__*/React.createElement("meta", {
3175
+ name: "description",
3176
+ content: description
3177
+ }) : null, language !== null ? /*#__PURE__*/React.createElement("meta", {
3178
+ name: "language",
3179
+ content: language
3180
+ }) : null, keywords !== null && isString(keywords) ? /*#__PURE__*/React.createElement("meta", {
3181
+ name: "keywords",
3182
+ content: keywords
3183
+ }) : null, keywords !== null && isArray(keywords) ? /*#__PURE__*/React.createElement("meta", {
3184
+ name: "keywords",
3185
+ content: keywords.join(',')
3186
+ }) : null, canonical !== null ? /*#__PURE__*/React.createElement("link", {
3187
+ rel: "canonical",
3188
+ href: canonical
3189
+ }) : null, faviconUrl !== null ? /*#__PURE__*/React.createElement("link", {
3190
+ rel: "icon",
3191
+ type: "image/png",
3192
+ href: faviconUrl
3193
+ }) : null, rssUrl !== null ? /*#__PURE__*/React.createElement("link", {
3194
+ rel: "alternate",
3195
+ type: "application/rss+xml",
3196
+ href: rssUrl
3197
+ }) : null, atomUrl !== null ? /*#__PURE__*/React.createElement("link", {
3198
+ rel: "alternate",
3199
+ type: "application/atom+xml",
3200
+ href: atomUrl
3201
+ }) : null, imageUrl !== null ? /*#__PURE__*/React.createElement("meta", {
3202
+ property: "og:image",
3203
+ content: imageUrl
3204
+ }) : null, imageUrl !== null ? /*#__PURE__*/React.createElement("meta", {
3205
+ property: "og:image:url",
3206
+ content: imageUrl
3207
+ }) : null, imageWidth !== null ? /*#__PURE__*/React.createElement("meta", {
3208
+ property: "og:image:width",
3209
+ content: imageWidth
3210
+ }) : null, imageHeight !== null ? /*#__PURE__*/React.createElement("meta", {
3211
+ property: "og:image:height",
3212
+ content: imageHeight
3213
+ }) : null, /*#__PURE__*/React.createElement("meta", {
3214
+ property: "og:title",
3215
+ content: realTitle
3216
+ }), description !== null ? /*#__PURE__*/React.createElement("meta", {
3217
+ property: "og:description",
3218
+ content: description
3219
+ }) : null, url !== null ? /*#__PURE__*/React.createElement("meta", {
3220
+ property: "og:url",
3221
+ content: url
3222
+ }) : null, /*#__PURE__*/React.createElement("meta", {
3223
+ name: "twitter:card",
3224
+ content: imageUrl !== null ? 'summary_large_image' : 'summary'
3225
+ }), /*#__PURE__*/React.createElement("meta", {
3226
+ name: "twitter:title",
3227
+ content: realTitle
3228
+ }), description !== null ? /*#__PURE__*/React.createElement("meta", {
3229
+ name: "twitter:description",
3230
+ content: description
3231
+ }) : null, imageUrl !== null ? /*#__PURE__*/React.createElement("meta", {
3232
+ name: "twitter:image",
3233
+ content: imageUrl
3234
+ }) : null, (microformats || []).map(function (it) {
3235
+ return /*#__PURE__*/React.createElement("script", {
3236
+ type: "application/ld+json",
3237
+ id: "".concat(it["@type"], "-").concat(it.identifier),
3238
+ key: "microformat-".concat(it["@type"], "-").concat(it.identifier)
3239
+ }, JSON.stringify(it));
3240
+ }), children);
3241
+ };
3242
+ Meta.propTypes = propTypes$d;
3243
+ Meta.defaultProps = defaultProps$d;
3244
+
3245
+ var styles$e = {"container":"micromag-core-partials-slideshow-container","items":"micromag-core-partials-slideshow-items","item":"micromag-core-partials-slideshow-item","prev":"micromag-core-partials-slideshow-prev","current":"micromag-core-partials-slideshow-current","next":"micromag-core-partials-slideshow-next"};
3246
+
3247
+ var propTypes$c = {
3248
+ items: PropTypes.arrayOf(PropTypes.node),
3249
+ auto: PropTypes.bool,
3250
+ delay: PropTypes.number,
3251
+ width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
3252
+ height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
3253
+ className: PropTypes.string,
3254
+ children: PropTypes.node
3255
+ };
3256
+ var defaultProps$c = {
3257
+ items: [],
3258
+ auto: true,
3259
+ delay: 5000,
3260
+ width: null,
3261
+ height: null,
3262
+ className: null,
3263
+ children: null
3264
+ };
3265
+ var Slideshow = function Slideshow(_ref) {
3266
+ var items = _ref.items,
3267
+ auto = _ref.auto,
3268
+ delay = _ref.delay,
3269
+ width = _ref.width,
3270
+ height = _ref.height,
3271
+ className = _ref.className,
3272
+ children = _ref.children;
3273
+ var _useState = React.useState(0),
3274
+ _useState2 = _slicedToArray(_useState, 2),
3275
+ index = _useState2[0],
3276
+ setIndex = _useState2[1];
3277
+ React.useEffect(function () {
3278
+ var id = null;
3279
+ if (auto) {
3280
+ id = setTimeout(function () {
3281
+ if (index < items.length - 1) {
3282
+ setIndex(function (i) {
3283
+ return i + 1;
3284
+ });
3285
+ } else {
3286
+ setIndex(0);
3287
+ }
3288
+ }, delay);
3289
+ }
3290
+ return function () {
3291
+ clearTimeout(id);
3292
+ };
3293
+ }, [index, items, auto, delay]);
3294
+ var style = {
3295
+ width: width,
3296
+ height: height
3297
+ };
3298
+ return /*#__PURE__*/React.createElement("div", {
3299
+ className: classNames([styles$e.container, _defineProperty({}, className, className)]),
3300
+ style: style
3301
+ }, /*#__PURE__*/React.createElement("div", {
3302
+ className: styles$e.items
3303
+ }, items.map(function (it, i) {
3304
+ return /*#__PURE__*/React.createElement("div", {
3305
+ key: "slide-".concat(i + 1),
3306
+ className: classNames([styles$e.item, _defineProperty(_defineProperty(_defineProperty({}, styles$e.prev, i < index), styles$e.current, i === index), styles$e.next, i > index)])
3307
+ }, it);
3308
+ })), children);
3309
+ };
3310
+ Slideshow.propTypes = propTypes$c;
3311
+ Slideshow.defaultProps = defaultProps$c;
3312
+
3313
+ var styles$d = {"icon":"micromag-core-placeholders-icon"};
3314
+
3315
+ /* eslint-disable react/prop-types */
3316
+ var AdFrame = function AdFrame(_ref) {
3317
+ var width = _ref.width,
3318
+ height = _ref.height,
3319
+ className = _ref.className;
3320
+ return /*#__PURE__*/React.createElement(PlaceholderBlock, {
3321
+ width: width,
3322
+ height: height,
3323
+ className: className
3324
+ }, /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3325
+ icon: faAd.faAd,
3326
+ className: styles$d.icon
3327
+ }));
3328
+ };
3329
+
3330
+ /* eslint-disable react/prop-types */
3331
+ var AdImage = function AdImage(_ref) {
3332
+ var width = _ref.width,
3333
+ height = _ref.height,
3334
+ className = _ref.className;
3335
+ return /*#__PURE__*/React.createElement(PlaceholderBlock, {
3336
+ width: width,
3337
+ height: height,
3338
+ className: className
3339
+ }, /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3340
+ icon: faImage.faImage,
3341
+ className: styles$d.icon
3342
+ }));
3343
+ };
3344
+
3345
+ /* eslint-disable react/destructuring-assignment, react/prop-types */
3346
+ var Audio = function Audio(_ref) {
3347
+ var _ref$width = _ref.width,
3348
+ width = _ref$width === void 0 ? '100%' : _ref$width,
3349
+ _ref$height = _ref.height,
3350
+ height = _ref$height === void 0 ? '2em' : _ref$height,
3351
+ className = _ref.className;
3352
+ return /*#__PURE__*/React.createElement(PlaceholderBlock, {
3353
+ width: width,
3354
+ height: height,
3355
+ className: className
3356
+ }, /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3357
+ icon: faMusic.faMusic,
3358
+ className: styles$d.icon
3359
+ }));
3360
+ };
3361
+
3362
+ var styles$c = {"container":"micromag-core-partials-placeholder-text-container","withInvertedColors":"micromag-core-partials-placeholder-text-withInvertedColors","line":"micromag-core-partials-placeholder-text-line"};
3363
+
3364
+ var propTypes$b = {
3365
+ lines: PropTypes.number,
3366
+ lineMargin: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
3367
+ width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
3368
+ height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
3369
+ fontSize: PropTypes.number,
3370
+ className: PropTypes.string,
3371
+ withInvertedColors: PropTypes.bool
3372
+ };
3373
+ var defaultProps$b = {
3374
+ lines: 1,
3375
+ lineMargin: 1,
3376
+ width: '100%',
3377
+ height: null,
3378
+ fontSize: 16,
3379
+ className: null,
3380
+ withInvertedColors: true
3381
+ };
3382
+ var PlaceholderText = function PlaceholderText(_ref) {
3383
+ var lines = _ref.lines,
3384
+ lineMargin = _ref.lineMargin,
3385
+ width = _ref.width,
3386
+ height = _ref.height,
3387
+ fontSize = _ref.fontSize,
3388
+ className = _ref.className,
3389
+ withInvertedColors = _ref.withInvertedColors;
3390
+ var lineHeight = height !== null && isNumber(height) ? "".concat(Math.round(height * fontSize), "px") : height;
3391
+ var oddWidth = isNumber(width) ? width * 0.9 : '80%';
3392
+ return /*#__PURE__*/React.createElement("div", {
3393
+ className: classNames([styles$c.container, _defineProperty(_defineProperty({}, className, className), styles$c.withInvertedColors, withInvertedColors)])
3394
+ }, _toConsumableArray(Array(lines)).map(function (e, index) {
3395
+ return /*#__PURE__*/React.createElement("div", {
3396
+ key: "line-".concat(index),
3397
+ className: styles$c.line,
3398
+ style: {
3399
+ width: index % 2 === 0 ? width : oddWidth,
3400
+ height: lineHeight,
3401
+ marginTop: lineMargin,
3402
+ marginBottom: lineMargin
3403
+ }
3404
+ });
3405
+ }));
3406
+ };
3407
+ PlaceholderText.propTypes = propTypes$b;
3408
+ PlaceholderText.defaultProps = defaultProps$b;
3409
+
3410
+ /* eslint-disable react/destructuring-assignment, react/prop-types */
3411
+ var Button = function Button(_ref) {
3412
+ var _ref$width = _ref.width,
3413
+ width = _ref$width === void 0 ? '75%' : _ref$width,
3414
+ _ref$height = _ref.height,
3415
+ height = _ref$height === void 0 ? '0.4em' : _ref$height,
3416
+ className = _ref.className;
3417
+ return /*#__PURE__*/React.createElement(PlaceholderBlock, {
3418
+ outline: true,
3419
+ width: width,
3420
+ height: height,
3421
+ className: className
3422
+ }, /*#__PURE__*/React.createElement(PlaceholderText, {
3423
+ line: 1,
3424
+ height: "0.1em"
3425
+ }));
3426
+ };
3427
+
3428
+ var _excluded$2 = ["width", "height", "className"];
3429
+ var Image = function Image(_ref) {
3430
+ var width = _ref.width,
3431
+ height = _ref.height,
3432
+ className = _ref.className,
3433
+ props = _objectWithoutProperties(_ref, _excluded$2);
3434
+ return /*#__PURE__*/React.createElement(PlaceholderBlock, Object.assign({}, props, {
3435
+ width: width,
3436
+ height: height,
3437
+ className: className
3438
+ }), /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3439
+ icon: faImage.faImage,
3440
+ className: styles$d.icon
3441
+ }));
3442
+ };
3443
+
3444
+ /* eslint-disable react/jsx-props-no-spreading, react/destructuring-assignment, react/prop-types */
3445
+ var Line = function Line(props) {
3446
+ return /*#__PURE__*/React.createElement(PlaceholderText, Object.assign({}, props, {
3447
+ className: classNames([props.className, styles$d.shortText]),
3448
+ height: 0.2,
3449
+ lines: 1
3450
+ }));
3451
+ };
3452
+
3453
+ var styles$b = {"container":"micromag-core-placeholders-map-container","icon":"micromag-core-placeholders-map-icon"};
3454
+
3455
+ var Map = function Map(props) {
3456
+ return /*#__PURE__*/React.createElement(PlaceholderBlock, Object.assign({}, props, {
3457
+ width: "100%",
3458
+ height: "100%",
3459
+ className: classNames([styles$b.container, _defineProperty({}, props.className, props.className !== null)])
3460
+ }), /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3461
+ icon: props.withImages ? faImage.faImage : faMapMarkerAlt.faMapMarkerAlt,
3462
+ className: styles$b.icon
3463
+ }), /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3464
+ icon: props.withImages ? faImage.faImage : faMapMarkerAlt.faMapMarkerAlt,
3465
+ className: styles$b.icon
3466
+ }), /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3467
+ icon: props.withImages ? faImage.faImage : faMapMarkerAlt.faMapMarkerAlt,
3468
+ className: styles$b.icon
3469
+ }), /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3470
+ icon: props.withImages ? faImage.faImage : faMapMarkerAlt.faMapMarkerAlt,
3471
+ className: styles$b.icon
3472
+ }));
3473
+ };
3474
+
3475
+ /* eslint-disable react/jsx-props-no-spreading, react/destructuring-assignment, react/prop-types */
3476
+ var MapPath = function MapPath(props) {
3477
+ return /*#__PURE__*/React.createElement(PlaceholderBlock, Object.assign({}, props, {
3478
+ width: "100%",
3479
+ height: "70%",
3480
+ className: classNames([props.className, styles$d.mapPath])
3481
+ }), /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3482
+ icon: faMapMarkedAlt.faMapMarkedAlt,
3483
+ size: "lg",
3484
+ className: styles$d.icon
3485
+ }));
3486
+ };
3487
+
3488
+ /* eslint-disable react/jsx-props-no-spreading, react/destructuring-assignment, react/prop-types */
3489
+ var Quote = function Quote(props) {
3490
+ return /*#__PURE__*/React.createElement(PlaceholderText, Object.assign({}, props, {
3491
+ className: classNames([props.className, styles$d.subtitle]),
3492
+ height: 0.5,
3493
+ lines: 6
3494
+ }));
3495
+ };
3496
+
3497
+ /* eslint-disable react/jsx-props-no-spreading, react/destructuring-assignment, react/prop-types */
3498
+ var ShortText = function ShortText(props) {
3499
+ return /*#__PURE__*/React.createElement(PlaceholderText, Object.assign({}, props, {
3500
+ className: classNames([props.className, styles$d.shortText]),
3501
+ height: 0.2,
3502
+ lines: 2
3503
+ }));
3504
+ };
3505
+
3506
+ /* eslint-disable react/jsx-props-no-spreading, react/destructuring-assignment, react/prop-types */
3507
+ var Subtitle = function Subtitle(props) {
3508
+ return /*#__PURE__*/React.createElement(PlaceholderText, Object.assign({}, props, {
3509
+ className: classNames([props.className, styles$d.subtitle]),
3510
+ height: 0.3,
3511
+ lines: 1
3512
+ }));
3513
+ };
3514
+
3515
+ /* eslint-disable react/jsx-props-no-spreading, react/destructuring-assignment, react/prop-types */
3516
+ var TextPlaceholder = function TextPlaceholder(props) {
3517
+ var _props$className = props.className,
3518
+ className = _props$className === void 0 ? null : _props$className,
3519
+ _props$height = props.height,
3520
+ height = _props$height === void 0 ? 0.2 : _props$height,
3521
+ _props$lines = props.lines,
3522
+ lines = _props$lines === void 0 ? 4 : _props$lines,
3523
+ _props$lineMargin = props.lineMargin,
3524
+ lineMargin = _props$lineMargin === void 0 ? 2 : _props$lineMargin;
3525
+ return /*#__PURE__*/React.createElement(PlaceholderText, Object.assign({}, props, {
3526
+ height: height,
3527
+ lines: lines,
3528
+ lineMargin: lineMargin,
3529
+ className: classNames([className, styles$d.text])
3530
+ }));
3531
+ };
3532
+
3533
+ /* eslint-disable react/jsx-props-no-spreading, react/destructuring-assignment, react/prop-types */
3534
+ var Timeline = function Timeline(props) {
3535
+ return /*#__PURE__*/React.createElement(PlaceholderText, Object.assign({}, props, {
3536
+ className: classNames([props.className, styles$d.timeline])
3537
+ }));
3538
+ };
3539
+
3540
+ /* eslint-disable react/jsx-props-no-spreading, react/destructuring-assignment, react/prop-types */
3541
+ var Title$1 = function Title(props) {
3542
+ var _props$height = props.height,
3543
+ height = _props$height === void 0 ? 0.5 : _props$height,
3544
+ _props$lines = props.lines,
3545
+ lines = _props$lines === void 0 ? 2 : _props$lines,
3546
+ _props$lineMargin = props.lineMargin,
3547
+ lineMargin = _props$lineMargin === void 0 ? 2 : _props$lineMargin;
3548
+ return /*#__PURE__*/React.createElement(PlaceholderText, Object.assign({}, props, {
3549
+ className: classNames([props.className, styles$d.title]),
3550
+ height: height,
3551
+ lines: lines,
3552
+ lineMargin: lineMargin
3553
+ }));
3554
+ };
3555
+
3556
+ /* eslint-disable react/prop-types */
3557
+ var Video = function Video(_ref) {
3558
+ var width = _ref.width,
3559
+ height = _ref.height,
3560
+ className = _ref.className;
3561
+ return /*#__PURE__*/React.createElement(PlaceholderBlock, {
3562
+ width: width,
3563
+ height: height,
3564
+ className: className
3565
+ }, /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3566
+ icon: faVideo.faVideo,
3567
+ className: styles$d.icon
3568
+ }));
3569
+ };
3570
+
3571
+ var styles$a = {"container":"micromag-core-placeholders-video-360-container","box":"micromag-core-placeholders-video-360-box","icon":"micromag-core-placeholders-video-360-icon","label":"micromag-core-placeholders-video-360-label"};
3572
+
3573
+ var Video360 = function Video360(_ref) {
3574
+ var width = _ref.width,
3575
+ height = _ref.height,
3576
+ className = _ref.className;
3577
+ return /*#__PURE__*/React.createElement(PlaceholderBlock, {
3578
+ width: width,
3579
+ height: height,
3580
+ className: classNames([styles$a.container, _defineProperty({}, className, className !== null)]),
3581
+ boxClassName: styles$a.box
3582
+ }, /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3583
+ icon: faVideo.faVideo,
3584
+ className: styles$a.icon
3585
+ }), /*#__PURE__*/React.createElement("div", {
3586
+ className: styles$a.label
3587
+ }, "360"));
3588
+ };
3589
+
3590
+ /* eslint-disable react/prop-types */
3591
+ var VideoLoop = function VideoLoop(_ref) {
3592
+ var width = _ref.width,
3593
+ height = _ref.height,
3594
+ className = _ref.className;
3595
+ return /*#__PURE__*/React.createElement(PlaceholderBlock, {
3596
+ width: width,
3597
+ height: height,
3598
+ className: className
3599
+ }, /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3600
+ icon: faPlay.faPlay,
3601
+ className: styles$d.icon
3602
+ }), /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3603
+ icon: faRedo.faRedo,
3604
+ className: styles$d.icon
3605
+ }));
3606
+ };
3607
+
3608
+ var styles$9 = {"container":"micromag-core-screens-screen-sizer-container","frame":"micromag-core-screens-screen-sizer-frame","screen":"micromag-core-screens-screen-sizer-screen"};
3609
+
3610
+ var propTypes$a = {
3611
+ width: PropTypes.number,
3612
+ height: PropTypes.number,
3613
+ fit: PropTypes.oneOf([null, 'cover', 'contain']),
3614
+ screenWidth: PropTypes.number,
3615
+ screenHeight: PropTypes.number,
3616
+ className: PropTypes.string,
3617
+ children: PropTypes.node.isRequired
3618
+ };
3619
+ var defaultProps$a = {
3620
+ width: null,
3621
+ height: null,
3622
+ fit: null,
3623
+ screenWidth: 320,
3624
+ screenHeight: 480,
3625
+ className: null
3626
+ };
3627
+ var ScreenSizer = function ScreenSizer(_ref) {
3628
+ var width = _ref.width,
3629
+ height = _ref.height,
3630
+ fit = _ref.fit,
3631
+ screenWidth = _ref.screenWidth,
3632
+ screenHeight = _ref.screenHeight,
3633
+ className = _ref.className,
3634
+ children = _ref.children;
3635
+ var hasSize = width !== null || height !== null;
3636
+ var _useDimensionObserver = hooks.useDimensionObserver(),
3637
+ refContainer = _useDimensionObserver.ref,
3638
+ _useDimensionObserver2 = _useDimensionObserver.width,
3639
+ calculatedWidth = _useDimensionObserver2 === void 0 ? 0 : _useDimensionObserver2,
3640
+ _useDimensionObserver3 = _useDimensionObserver.height,
3641
+ calculatedHeight = _useDimensionObserver3 === void 0 ? 0 : _useDimensionObserver3;
3642
+ var _useMemo = React.useMemo(function () {
3643
+ var containerWidth = width || calculatedWidth || null;
3644
+ var containerHeight = height || calculatedHeight || null;
3645
+ if (containerWidth === null && containerHeight === null) {
3646
+ return {};
3647
+ }
3648
+ var screenRatio = screenWidth / screenHeight;
3649
+ var finalContainerWidth = hasSize ? width || containerHeight * screenRatio : containerWidth;
3650
+ var finalContainerHeight = hasSize ? height || containerWidth / screenRatio : containerWidth / screenRatio;
3651
+ if (fit === null) {
3652
+ var _screenScale = finalContainerWidth / screenWidth;
3653
+ return {
3654
+ width: finalContainerWidth,
3655
+ height: finalContainerHeight,
3656
+ scale: _screenScale,
3657
+ transform: "scale(".concat(_screenScale, ")")
3658
+ };
3659
+ }
3660
+ var _getSizeWithinBounds = size.getSizeWithinBounds(screenWidth, screenHeight, finalContainerWidth, finalContainerHeight, {
3661
+ cover: fit === 'cover'
3662
+ }),
3663
+ screenScaledWidth = _getSizeWithinBounds.width,
3664
+ screenScaledHeight = _getSizeWithinBounds.height,
3665
+ screenScale = _getSizeWithinBounds.scale;
3666
+ var x = (finalContainerWidth - screenScaledWidth) / 2;
3667
+ var y = (finalContainerHeight - screenScaledHeight) / 2;
3668
+ return {
3669
+ width: finalContainerWidth,
3670
+ height: finalContainerHeight,
3671
+ scale: screenScale,
3672
+ transform: "scale(".concat(screenScale, ") translate(").concat(x, "px, ").concat(y, "px)")
3673
+ };
3674
+ }, [screenWidth, screenHeight, width, height, fit, calculatedWidth, calculatedHeight, hasSize]),
3675
+ _useMemo$width = _useMemo.width,
3676
+ frameWidth = _useMemo$width === void 0 ? null : _useMemo$width,
3677
+ _useMemo$height = _useMemo.height,
3678
+ frameHeight = _useMemo$height === void 0 ? null : _useMemo$height,
3679
+ _useMemo$scale = _useMemo.scale,
3680
+ frameScale = _useMemo$scale === void 0 ? null : _useMemo$scale,
3681
+ _useMemo$transform = _useMemo.transform,
3682
+ screenTransform = _useMemo$transform === void 0 ? null : _useMemo$transform;
3683
+ var devicePixelRatio = hooks.useDevicePixelRatio();
3684
+ var screenSize = React.useMemo(function () {
3685
+ return {
3686
+ screen: 'mobile',
3687
+ screens: ['mobile'],
3688
+ width: screenWidth,
3689
+ height: screenHeight,
3690
+ resolution: frameScale !== null ? frameScale * devicePixelRatio : devicePixelRatio
3691
+ };
3692
+ }, [screenWidth, screenHeight, frameScale]);
3693
+ var hasFrameSize = frameWidth !== null && frameHeight !== null;
3694
+ return /*#__PURE__*/React.createElement("div", {
3695
+ className: classNames([styles$9.container, _defineProperty({}, className, className !== null)]),
3696
+ ref: !hasSize ? refContainer : null
3697
+ }, hasFrameSize ? /*#__PURE__*/React.createElement("div", {
3698
+ className: styles$9.frame,
3699
+ style: {
3700
+ width: frameWidth,
3701
+ height: frameHeight
3702
+ }
3703
+ }, /*#__PURE__*/React.createElement("div", {
3704
+ className: styles$9.screen,
3705
+ style: {
3706
+ width: screenWidth,
3707
+ height: screenHeight,
3708
+ transform: screenTransform
3709
+ }
3710
+ }, /*#__PURE__*/React.createElement(contexts.ScreenSizeProvider, {
3711
+ size: screenSize
3712
+ }, /*#__PURE__*/React.cloneElement(children, {
3713
+ width: screenWidth,
3714
+ height: screenHeight
3715
+ })))) : null);
3716
+ };
3717
+ ScreenSizer.propTypes = propTypes$a;
3718
+ ScreenSizer.defaultProps = defaultProps$a;
3719
+
3720
+ var styles$8 = {"container":"micromag-core-screens-screen-container"};
3721
+
3722
+ var propTypes$9 = {
3723
+ screen: core.PropTypes.storyComponent.isRequired,
3724
+ renderContext: core.PropTypes.renderContext,
3725
+ screenState: PropTypes.string,
3726
+ index: PropTypes.number,
3727
+ active: PropTypes.bool,
3728
+ preload: PropTypes.bool,
3729
+ current: PropTypes.bool,
3730
+ component: PropTypes.node,
3731
+ components: core.PropTypes.components,
3732
+ className: PropTypes.string,
3733
+ mediaRef: PropTypes.func
3734
+ };
3735
+ var defaultProps$9 = {
3736
+ active: true,
3737
+ renderContext: null,
3738
+ screenState: null,
3739
+ index: null,
3740
+ current: false,
3741
+ preload: true,
3742
+ component: null,
3743
+ components: null,
3744
+ className: null,
3745
+ mediaRef: null
3746
+ };
3747
+ var Screen = function Screen(_ref) {
3748
+ var screen = _ref.screen,
3749
+ renderContext = _ref.renderContext,
3750
+ screenState = _ref.screenState,
3751
+ index = _ref.index,
3752
+ active = _ref.active,
3753
+ current = _ref.current,
3754
+ preload = _ref.preload,
3755
+ components = _ref.components,
3756
+ component = _ref.component,
3757
+ className = _ref.className,
3758
+ mediaRef = _ref.mediaRef;
3759
+ var _ref2 = screen || {},
3760
+ _ref2$type = _ref2.type,
3761
+ type = _ref2$type === void 0 ? null : _ref2$type;
3762
+ var CustomScreenComponent = components !== null ? utils.getComponentFromName(type, components) || null : null;
3763
+ var ContextScreenComponent = contexts.useScreenComponent(type);
3764
+ var ScreenComponent = CustomScreenComponent || ContextScreenComponent;
3765
+ return /*#__PURE__*/React.createElement(contexts.ScreenProvider, {
3766
+ data: screen,
3767
+ renderContext: renderContext,
3768
+ screenState: screenState
3769
+ }, ScreenComponent !== null ? /*#__PURE__*/React.createElement("div", {
3770
+ className: classNames([styles$8.container, _defineProperty({}, className, className !== null)])
3771
+ }, /*#__PURE__*/React.createElement(ScreenComponent, Object.assign({}, screen, {
3772
+ index: index,
3773
+ active: active,
3774
+ current: current,
3775
+ preload: preload,
3776
+ mediaRef: mediaRef
3777
+ }))) : /*#__PURE__*/React.createElement("div", {
3778
+ className: className
3779
+ }, component));
3780
+ };
3781
+ Screen.propTypes = propTypes$9;
3782
+ Screen.defaultProps = defaultProps$9;
3783
+ var Screen$1 = /*#__PURE__*/React.memo(Screen);
3784
+
3785
+ var styles$7 = {"screen":"micromag-core-screens-screen-placeholder-screen"};
3786
+
3787
+ var _excluded$1 = ["screen", "layout", "screenWidth", "screenHeight", "screenState", "withSize", "className"];
3788
+ var propTypes$8 = {
3789
+ screen: core.PropTypes.component.isRequired,
3790
+ layout: PropTypes.string,
3791
+ screenWidth: PropTypes.number,
3792
+ screenHeight: PropTypes.number,
3793
+ screenState: PropTypes.string,
3794
+ withSize: PropTypes.bool,
3795
+ className: PropTypes.string
3796
+ };
3797
+ var defaultProps$8 = {
3798
+ layout: undefined,
3799
+ screenState: null,
3800
+ screenWidth: 100,
3801
+ screenHeight: 150,
3802
+ withSize: false,
3803
+ className: null
3804
+ };
3805
+ var ScreenPlaceholder = function ScreenPlaceholder(_ref) {
3806
+ var screen = _ref.screen,
3807
+ layout = _ref.layout,
3808
+ screenWidth = _ref.screenWidth,
3809
+ screenHeight = _ref.screenHeight,
3810
+ screenState = _ref.screenState,
3811
+ withSize = _ref.withSize,
3812
+ className = _ref.className,
3813
+ props = _objectWithoutProperties(_ref, _excluded$1);
3814
+ var screenElement = /*#__PURE__*/React.createElement(Screen$1, Object.assign({
3815
+ screen: screen,
3816
+ renderContext: "placeholder",
3817
+ screenState: screenState,
3818
+ layout: layout,
3819
+ className: classNames([styles$7.screen, _defineProperty({}, className, !withSize)])
3820
+ }, props));
3821
+ return withSize ? /*#__PURE__*/React.createElement(ScreenSizer, {
3822
+ className: className,
3823
+ screenWidth: screenWidth,
3824
+ screenHeight: screenHeight
3825
+ }, screenElement) : screenElement;
3826
+ };
3827
+ ScreenPlaceholder.propTypes = propTypes$8;
3828
+ ScreenPlaceholder.defaultProps = defaultProps$8;
3829
+ var Placeholder = /*#__PURE__*/React.memo(ScreenPlaceholder);
3830
+
3831
+ var styles$6 = {"screen":"micromag-core-screens-preview-screen"};
3832
+
3833
+ var _excluded = ["screen", "screenState", "width", "height", "screenWidth", "screenHeight", "className", "withSize", "fit", "hidden"];
3834
+ var propTypes$7 = {
3835
+ screen: core.PropTypes.component.isRequired,
3836
+ screenState: PropTypes.string,
3837
+ width: PropTypes.number,
3838
+ height: PropTypes.number,
3839
+ screenWidth: PropTypes.number,
3840
+ screenHeight: PropTypes.number,
3841
+ className: PropTypes.string,
3842
+ withSize: PropTypes.bool,
3843
+ hidden: PropTypes.bool
3844
+ };
3845
+ var defaultProps$7 = {
3846
+ screenState: null,
3847
+ width: undefined,
3848
+ height: undefined,
3849
+ screenWidth: undefined,
3850
+ screenHeight: undefined,
3851
+ className: null,
3852
+ withSize: false,
3853
+ hidden: false
3854
+ };
3855
+ var ScreenPreview = function ScreenPreview(_ref) {
3856
+ var screen = _ref.screen,
3857
+ screenState = _ref.screenState,
3858
+ width = _ref.width,
3859
+ height = _ref.height,
3860
+ screenWidth = _ref.screenWidth,
3861
+ screenHeight = _ref.screenHeight,
3862
+ className = _ref.className,
3863
+ withSize = _ref.withSize,
3864
+ fit = _ref.fit,
3865
+ hidden = _ref.hidden,
3866
+ props = _objectWithoutProperties(_ref, _excluded);
3867
+ var screenElement = /*#__PURE__*/React.createElement(Screen$1, Object.assign({
3868
+ screen: screen,
3869
+ renderContext: "preview",
3870
+ screenState: screenState,
3871
+ width: !withSize ? width : undefined,
3872
+ height: !withSize ? height : undefined,
3873
+ className: classNames([styles$6.screen, _defineProperty({}, className, !withSize)])
3874
+ }, props));
3875
+ var element = !hidden ? screenElement : /*#__PURE__*/React.createElement("div", null);
3876
+ var screenWithSize = withSize ? /*#__PURE__*/React.createElement(ScreenSizer, {
3877
+ className: className,
3878
+ screenWidth: screenWidth,
3879
+ screenHeight: screenHeight,
3880
+ width: width,
3881
+ height: height,
3882
+ fit: fit
3883
+ }, element) : element;
3884
+ return screenWithSize;
3885
+ };
3886
+ ScreenPreview.propTypes = propTypes$7;
3887
+ ScreenPreview.defaultProps = defaultProps$7;
3888
+ var Preview = /*#__PURE__*/React.memo(ScreenPreview);
3889
+
3890
+ var styles$5 = {"container":"micromag-core-placeholders-conversation-container","icon":"micromag-core-placeholders-conversation-icon","message":"micromag-core-placeholders-conversation-message","placeholderMessage0":"micromag-core-placeholders-conversation-placeholderMessage0","placeholderMessage1":"micromag-core-placeholders-conversation-placeholderMessage1","placeholderMessage2":"micromag-core-placeholders-conversation-placeholderMessage2","placeholderMessage3":"micromag-core-placeholders-conversation-placeholderMessage3"};
3891
+
3892
+ var Conversation = function Conversation() {
3893
+ return /*#__PURE__*/React.createElement("div", {
3894
+ className: styles$5.container
3895
+ }, _toConsumableArray(Array(4)).map(function (e, idx) {
3896
+ return /*#__PURE__*/React.createElement("div", {
3897
+ key: "message-".concat(idx + 1),
3898
+ className: classNames([styles$5.message, styles$5["placeholderMessage".concat(idx)]])
3899
+ });
3900
+ }), /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3901
+ icon: faCommentDots.faCommentDots,
3902
+ className: styles$5.icon
3903
+ }));
3904
+ };
3905
+
3906
+ /* eslint-disable react/prop-types */
3907
+ var InputText = function InputText(_ref) {
3908
+ var _ref$width = _ref.width,
3909
+ width = _ref$width === void 0 ? '75%' : _ref$width,
3910
+ _ref$height = _ref.height,
3911
+ height = _ref$height === void 0 ? '0.5em' : _ref$height,
3912
+ className = _ref.className;
3913
+ return /*#__PURE__*/React.createElement(PlaceholderBlock, {
3914
+ outline: true,
3915
+ width: width,
3916
+ height: height,
3917
+ className: className
3918
+ });
3919
+ };
3920
+
3921
+ var styles$4 = {"container":"micromag-core-placeholders-quiz-answer-container","block":"micromag-core-placeholders-quiz-answer-block","answer":"micromag-core-placeholders-quiz-answer-answer","answerIcon":"micromag-core-placeholders-quiz-answer-answerIcon","good":"micromag-core-placeholders-quiz-answer-good"};
3922
+
3923
+ var Answer$1 = function Answer(_ref) {
3924
+ var _ref$width = _ref.width,
3925
+ width = _ref$width === void 0 ? '75%' : _ref$width,
3926
+ _ref$height = _ref.height,
3927
+ height = _ref$height === void 0 ? '0.3em' : _ref$height,
3928
+ className = _ref.className,
3929
+ _ref$good = _ref.good,
3930
+ good = _ref$good === void 0 ? true : _ref$good;
3931
+ return /*#__PURE__*/React.createElement("div", {
3932
+ className: classNames([styles$4.container, _defineProperty(_defineProperty({}, className, className !== null), styles$4.good, good)])
3933
+ }, /*#__PURE__*/React.createElement("div", {
3934
+ className: styles$4.answer
3935
+ }, /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3936
+ className: styles$4.answerIcon,
3937
+ icon: good ? faCheck.faCheck : faTimes.faTimes
3938
+ })), /*#__PURE__*/React.createElement(PlaceholderBlock, {
3939
+ outline: true,
3940
+ width: width,
3941
+ height: height,
3942
+ className: styles$4.block
3943
+ }, /*#__PURE__*/React.createElement(PlaceholderText, {
3944
+ line: 1,
3945
+ height: "0.2em"
3946
+ })));
3947
+ };
3948
+
3949
+ var styles$3 = {"container":"micromag-core-placeholders-share-options-container","box":"micromag-core-placeholders-share-options-box","icon":"micromag-core-placeholders-share-options-icon","item":"micromag-core-placeholders-share-options-item"};
3950
+
3951
+ var Title = function Title(props) {
3952
+ return /*#__PURE__*/React.createElement(PlaceholderBlock, Object.assign({}, props, {
3953
+ width: "100%",
3954
+ height: "100%",
3955
+ className: classNames([styles$3.container, _defineProperty({}, props.className, props.className !== null)]),
3956
+ boxClassName: styles$3.box
3957
+ }), /*#__PURE__*/React.createElement("div", {
3958
+ className: styles$3.item
3959
+ }, /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3960
+ icon: faCircle.faCircle,
3961
+ className: styles$3.icon
3962
+ })), /*#__PURE__*/React.createElement("div", {
3963
+ className: styles$3.item
3964
+ }, /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3965
+ icon: faCircle.faCircle,
3966
+ className: styles$3.icon
3967
+ })), /*#__PURE__*/React.createElement("div", {
3968
+ className: styles$3.item
3969
+ }, /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3970
+ icon: faCircle.faCircle,
3971
+ className: styles$3.icon
3972
+ })));
3973
+ };
3974
+
3975
+ var styles$2 = {"container":"micromag-core-placeholders-survey-answer-container","block":"micromag-core-placeholders-survey-answer-block","percent":"micromag-core-placeholders-survey-answer-percent","percentIcon":"micromag-core-placeholders-survey-answer-percentIcon"};
3976
+
3977
+ var Answer = function Answer(_ref) {
3978
+ var _ref$width = _ref.width,
3979
+ width = _ref$width === void 0 ? '75%' : _ref$width,
3980
+ _ref$height = _ref.height,
3981
+ height = _ref$height === void 0 ? '0.3em' : _ref$height,
3982
+ className = _ref.className;
3983
+ return /*#__PURE__*/React.createElement("div", {
3984
+ className: classNames([styles$2.container, _defineProperty({}, className, className !== null)])
3985
+ }, /*#__PURE__*/React.createElement(PlaceholderBlock, {
3986
+ outline: true,
3987
+ width: width,
3988
+ height: height,
3989
+ className: styles$2.block
3990
+ }, /*#__PURE__*/React.createElement(PlaceholderText, {
3991
+ line: 1,
3992
+ height: "0.2em"
3993
+ })), /*#__PURE__*/React.createElement("div", {
3994
+ className: styles$2.percent
3995
+ }, /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
3996
+ className: styles$2.percentIcon,
3997
+ icon: faPercent.faPercent
3998
+ })));
3999
+ };
4000
+
4001
+ var Placeholders = /*#__PURE__*/Object.freeze({
4002
+ __proto__: null,
4003
+ AdFrame: AdFrame,
4004
+ AdImage: AdImage,
4005
+ Audio: Audio,
4006
+ Button: Button,
4007
+ Conversation: Conversation,
4008
+ Image: Image,
4009
+ InputText: InputText,
4010
+ Line: Line,
4011
+ Map: Map,
4012
+ MapPath: MapPath,
4013
+ QuizAnswer: Answer$1,
4014
+ Quote: Quote,
4015
+ ShareOptions: Title,
4016
+ ShortText: ShortText,
4017
+ Subtitle: Subtitle,
4018
+ SurveyAnswer: Answer,
4019
+ Text: TextPlaceholder,
4020
+ Timeline: Timeline,
4021
+ Title: Title$1,
4022
+ Video: Video,
4023
+ Video360: Video360,
4024
+ VideoLoop: VideoLoop
4025
+ });
4026
+
4027
+ /* eslint-disable react/jsx-props-no-spreading */
4028
+ var propTypes$6 = {
4029
+ children: PropTypes.node,
4030
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
4031
+ preview: PropTypes.node,
4032
+ empty: PropTypes.node,
4033
+ emptyLabel: core.PropTypes.label,
4034
+ isEmpty: PropTypes.bool,
4035
+ placeholderProps: PropTypes.object,
4036
+ // eslint-disable-line
4037
+ emptyClassName: PropTypes.string
4038
+ };
4039
+ var defaultProps$6 = {
4040
+ children: null,
4041
+ placeholder: null,
4042
+ preview: null,
4043
+ empty: null,
4044
+ emptyLabel: null,
4045
+ isEmpty: false,
4046
+ placeholderProps: null,
4047
+ emptyClassName: null
4048
+ };
4049
+ var ScreenElement = function ScreenElement(_ref) {
4050
+ var children = _ref.children,
4051
+ placeholder = _ref.placeholder,
4052
+ empty = _ref.empty,
4053
+ emptyLabel = _ref.emptyLabel,
4054
+ preview = _ref.preview,
4055
+ isEmpty = _ref.isEmpty,
4056
+ placeholderProps = _ref.placeholderProps,
4057
+ emptyClassName = _ref.emptyClassName;
4058
+ var _useScreenRenderConte = contexts.useScreenRenderContext(),
4059
+ isPlaceholder = _useScreenRenderConte.isPlaceholder,
4060
+ isEdit = _useScreenRenderConte.isEdit,
4061
+ isPreview = _useScreenRenderConte.isPreview;
4062
+ if (isPlaceholder) {
4063
+ var PlaceholderComponent = isString(placeholder) ? utils.getComponentFromName(placeholder, Placeholders) : null;
4064
+ return PlaceholderComponent !== null ? /*#__PURE__*/React.createElement(PlaceholderComponent, placeholderProps) : placeholder;
4065
+ }
4066
+ if (isEdit && isEmpty) {
4067
+ return empty !== null ? empty : /*#__PURE__*/React.createElement(Empty, {
4068
+ className: emptyClassName
4069
+ }, emptyLabel);
4070
+ }
4071
+ if (isPreview && preview !== null) {
4072
+ return preview;
4073
+ }
4074
+ return children;
4075
+ };
4076
+ ScreenElement.propTypes = propTypes$6;
4077
+ ScreenElement.defaultProps = defaultProps$6;
4078
+
4079
+ var styles$1 = {"container":"micromag-core-screens-container","screen":"micromag-core-screens-screen","visible":"micromag-core-screens-visible"};
4080
+
4081
+ var propTypes$5 = {
4082
+ screens: core.PropTypes.storyComponents.isRequired,
4083
+ screen: PropTypes.string,
4084
+ className: PropTypes.string
4085
+ };
4086
+ var defaultProps$5 = {
4087
+ screen: null,
4088
+ className: null
4089
+ };
4090
+ var Screens = function Screens(_ref) {
4091
+ var screens = _ref.screens,
4092
+ screenId = _ref.screen,
4093
+ className = _ref.className;
4094
+ return /*#__PURE__*/React.createElement("div", {
4095
+ className: classNames([styles$1.container, _defineProperty({}, className, className)])
4096
+ }, screens.map(function (screen) {
4097
+ var id = screen.id;
4098
+ return /*#__PURE__*/React.createElement(Screen$1, {
4099
+ key: "screen-".concat(id),
4100
+ screen: screen,
4101
+ className: classNames([styles$1.screen, _defineProperty({}, styles$1.visible, screenId === id)])
4102
+ });
4103
+ }));
4104
+ };
4105
+ Screens.propTypes = propTypes$5;
4106
+ Screens.defaultProps = defaultProps$5;
4107
+
4108
+ var styles = {"container":"micromag-core-transitions-transition-container","fullscreen":"micromag-core-transitions-transition-fullscreen"};
4109
+
4110
+ var propTypes$4 = {
4111
+ fullscreen: PropTypes.bool,
4112
+ from: PropTypes.objectOf(PropTypes.any),
4113
+ // eslint-disable-line react/forbid-prop-types
4114
+ to: PropTypes.objectOf(PropTypes.any),
4115
+ // eslint-disable-line react/forbid-prop-types
4116
+ playing: PropTypes.bool,
4117
+ direction: PropTypes.oneOf(['in', 'out']),
4118
+ delay: PropTypes.number,
4119
+ reversible: PropTypes.bool,
4120
+ duration: PropTypes.number,
4121
+ easing: PropTypes.func,
4122
+ config: PropTypes.shape({
4123
+ mass: PropTypes.number,
4124
+ friction: PropTypes.number,
4125
+ tension: PropTypes.number
4126
+ }),
4127
+ children: PropTypes.node,
4128
+ className: PropTypes.string,
4129
+ onStart: PropTypes.func,
4130
+ onComplete: PropTypes.func
4131
+ };
4132
+ var defaultProps$4 = {
4133
+ fullscreen: false,
4134
+ from: null,
4135
+ to: null,
4136
+ playing: false,
4137
+ direction: null,
4138
+ delay: 0,
4139
+ reversible: true,
4140
+ duration: undefined,
4141
+ easing: undefined,
4142
+ config: null,
4143
+ children: null,
4144
+ className: null,
4145
+ onStart: null,
4146
+ onComplete: null
4147
+ };
4148
+ function Transition(_ref) {
4149
+ var fullscreen = _ref.fullscreen,
4150
+ from = _ref.from,
4151
+ to = _ref.to,
4152
+ playing = _ref.playing,
4153
+ direction = _ref.direction,
4154
+ delay = _ref.delay,
4155
+ reversible = _ref.reversible,
4156
+ duration = _ref.duration,
4157
+ easing = _ref.easing,
4158
+ config = _ref.config,
4159
+ children = _ref.children,
4160
+ className = _ref.className,
4161
+ onStart = _ref.onStart,
4162
+ onComplete = _ref.onComplete;
4163
+ var _useSpring = core$1.useSpring(function () {
4164
+ return {};
4165
+ }),
4166
+ _useSpring2 = _slicedToArray(_useSpring, 2),
4167
+ springProps = _useSpring2[0],
4168
+ setSpringProps = _useSpring2[1];
4169
+ React.useEffect(function () {
4170
+ var immediate = !playing && direction === 'in' || playing && direction === 'out';
4171
+ var finalPlaying = immediate || playing;
4172
+ var reset = reversible && playing && !immediate;
4173
+ var finalDuration = duration !== null ? duration : undefined;
4174
+ var withDelay = delay > 0 && playing && direction !== 'out';
4175
+ var finalConfig = easing !== null && web.config[easing] ? web.config[easing] || null : config;
4176
+ var props = {
4177
+ from: finalPlaying ? from : to,
4178
+ to: finalPlaying ? to : from,
4179
+ immediate: immediate,
4180
+ delay: withDelay ? delay : null,
4181
+ reset: reset,
4182
+ onStart: onStart,
4183
+ onRest: onComplete,
4184
+ config: finalConfig !== null ? finalConfig : {
4185
+ duration: immediate ? 0 : finalDuration
4186
+ }
4187
+ };
4188
+ // Reversible always toggles between from-to (playing) to-from (!playing)
4189
+ if (finalPlaying || reversible) {
4190
+ setSpringProps.start(props);
4191
+ }
4192
+ // console.log('fx', { reset, finalPlaying, immediate, reversible });
4193
+ }, [playing, direction, delay, duration, reversible, easing, config, from, to, setSpringProps, onStart, onComplete]);
4194
+ return /*#__PURE__*/React.createElement(web.animated.div, {
4195
+ style: _objectSpread({}, springProps),
4196
+ className: classNames([styles.container, _defineProperty(_defineProperty({}, className, className !== null), styles.fullscreen, fullscreen)])
4197
+ }, children);
4198
+ }
4199
+ Transition.propTypes = propTypes$4;
4200
+ Transition.defaultProps = defaultProps$4;
4201
+
4202
+ /* eslint-disable react/jsx-props-no-spreading */
4203
+ function Fade(props) {
4204
+ var from = React.useMemo(function () {
4205
+ return {
4206
+ opacity: 0
4207
+ };
4208
+ }, []);
4209
+ var to = React.useMemo(function () {
4210
+ return {
4211
+ opacity: 1
4212
+ };
4213
+ }, []);
4214
+ return /*#__PURE__*/React.createElement(Transition, Object.assign({}, props, {
4215
+ from: from,
4216
+ to: to
4217
+ }));
4218
+ }
4219
+
4220
+ /* eslint-disable react/jsx-props-no-spreading */
4221
+ function Scale(props) {
4222
+ var from = React.useMemo(function () {
4223
+ return {
4224
+ transform: 'scale(0)'
4225
+ };
4226
+ }, []);
4227
+ var to = React.useMemo(function () {
4228
+ return {
4229
+ transform: 'scale(1)'
4230
+ };
4231
+ }, []);
4232
+ return /*#__PURE__*/React.createElement(Transition, Object.assign({}, props, {
4233
+ from: from,
4234
+ to: to
4235
+ }));
4236
+ }
4237
+
4238
+ var TransitionComponents = {
4239
+ Fade: Fade,
4240
+ Scale: Scale
4241
+ };
4242
+
4243
+ var propTypes$3 = {
4244
+ fullscreen: PropTypes.bool,
4245
+ playing: PropTypes.bool,
4246
+ delay: PropTypes.number,
4247
+ transitions: core.PropTypes.transitions,
4248
+ onComplete: PropTypes.func,
4249
+ disabled: PropTypes.bool,
4250
+ children: PropTypes.node
4251
+ };
4252
+ var defaultProps$3 = {
4253
+ fullscreen: false,
4254
+ playing: false,
4255
+ delay: 0,
4256
+ transitions: null,
4257
+ onComplete: null,
4258
+ disabled: false,
4259
+ children: null
4260
+ };
4261
+ function Transitions(_ref) {
4262
+ var fullscreen = _ref.fullscreen,
4263
+ playing = _ref.playing,
4264
+ delay = _ref.delay,
4265
+ transitions = _ref.transitions,
4266
+ onComplete = _ref.onComplete,
4267
+ disabled = _ref.disabled,
4268
+ children = _ref.children;
4269
+ var _useScreenSize = contexts.useScreenSize(),
4270
+ _useScreenSize$landsc = _useScreenSize.landscape,
4271
+ landscape = _useScreenSize$landsc === void 0 ? true : _useScreenSize$landsc;
4272
+ var finalPlaying = playing || landscape;
4273
+ var finalTransitions = {
4274
+ "in": null,
4275
+ out: null
4276
+ };
4277
+ var defaultTransitions = {
4278
+ "in": 'fade',
4279
+ out: 'fade'
4280
+ };
4281
+ var transitionsObject = transitions !== null ? transitions : defaultTransitions;
4282
+ Object.keys(transitionsObject).forEach(function (transitionKey) {
4283
+ var currentTransition = transitionsObject[transitionKey];
4284
+ finalTransitions[transitionKey] = typeof currentTransition === 'string' ? {
4285
+ name: currentTransition
4286
+ } : currentTransition;
4287
+ });
4288
+ var _finalTransitions$in = finalTransitions["in"],
4289
+ transitionIn = _finalTransitions$in === void 0 ? null : _finalTransitions$in,
4290
+ _finalTransitions$out = finalTransitions.out,
4291
+ transitionOut = _finalTransitions$out === void 0 ? null : _finalTransitions$out;
4292
+ var finalTransitionIn = transitionIn !== null ? transitionIn : transitionOut;
4293
+ var finalTransitionOut = transitionOut !== null ? transitionOut : transitionIn;
4294
+ var _ref2 = finalTransitionIn || {},
4295
+ _ref2$name = _ref2.name,
4296
+ transitionInName = _ref2$name === void 0 ? null : _ref2$name;
4297
+ var _ref3 = finalTransitionOut || {},
4298
+ _ref3$name = _ref3.name,
4299
+ transitionOutName = _ref3$name === void 0 ? null : _ref3$name;
4300
+ var sameTransitionInOut = transitionInName === transitionOutName;
4301
+ var TransitionIn = finalTransitionIn !== null ? utils.getComponentFromName(transitionInName, TransitionComponents, null) : null;
4302
+ var TransitionOut = finalTransitionOut !== null && !sameTransitionInOut ? utils.getComponentFromName(transitionOutName, TransitionComponents, null) : null;
4303
+ var transitionInProps = finalTransitionIn !== null ? _objectSpread(_objectSpread({}, finalTransitionIn), {}, {
4304
+ name: undefined,
4305
+ delay: delay,
4306
+ onComplete: onComplete
4307
+ }) : null;
4308
+ var transitionOutProps = finalTransitionOut !== null ? _objectSpread(_objectSpread({}, finalTransitionOut), {}, {
4309
+ name: undefined,
4310
+ delay: delay,
4311
+ onComplete: onComplete
4312
+ }) : null;
4313
+ var renderTransitionOut = TransitionOut !== null && !disabled ? /*#__PURE__*/React.createElement(TransitionOut, Object.assign({
4314
+ fullscreen: fullscreen,
4315
+ playing: finalPlaying,
4316
+ direction: "out"
4317
+ }, transitionOutProps), children) : children;
4318
+ return TransitionIn !== null && !disabled ? /*#__PURE__*/React.createElement(TransitionIn, Object.assign({
4319
+ fullscreen: fullscreen,
4320
+ playing: finalPlaying,
4321
+ direction: !sameTransitionInOut ? 'in' : null
4322
+ }, transitionInProps), renderTransitionOut) : renderTransitionOut;
4323
+ }
4324
+ Transitions.propTypes = propTypes$3;
4325
+ Transitions.defaultProps = defaultProps$3;
4326
+
4327
+ var propTypes$2 = {
4328
+ transitions: core.PropTypes.transitions,
4329
+ stagger: PropTypes.number,
4330
+ playing: PropTypes.bool,
4331
+ disabled: PropTypes.bool,
4332
+ delay: PropTypes.number,
4333
+ fullscreen: PropTypes.bool,
4334
+ children: PropTypes.node
4335
+ };
4336
+ var defaultProps$2 = {
4337
+ transitions: null,
4338
+ stagger: 0,
4339
+ playing: false,
4340
+ disabled: false,
4341
+ delay: 0,
4342
+ fullscreen: false,
4343
+ children: null
4344
+ };
4345
+ var TransitionsStagger = function TransitionsStagger(_ref) {
4346
+ var transitions = _ref.transitions,
4347
+ stagger = _ref.stagger,
4348
+ playing = _ref.playing,
4349
+ disabled = _ref.disabled,
4350
+ delay = _ref.delay,
4351
+ fullscreen = _ref.fullscreen,
4352
+ children = _ref.children;
4353
+ var validIndex = 0;
4354
+ var elements = React.Children.map(children, function (child) {
4355
+ if (!child) {
4356
+ return null;
4357
+ }
4358
+ var _child$type = child.type,
4359
+ type = _child$type === void 0 ? null : _child$type;
4360
+ var _ref2 = type || {},
4361
+ _ref2$withoutTransiti = _ref2.withoutTransitionsWrapper,
4362
+ withoutTransitionsWrapper = _ref2$withoutTransiti === void 0 ? false : _ref2$withoutTransiti;
4363
+ if (disabled || withoutTransitionsWrapper) {
4364
+ return child;
4365
+ }
4366
+ var el = /*#__PURE__*/React.createElement(Transitions, {
4367
+ transitions: transitions,
4368
+ delay: delay + validIndex * stagger,
4369
+ playing: playing,
4370
+ fullscreen: fullscreen
4371
+ }, child);
4372
+ validIndex += 1;
4373
+ return el;
4374
+ });
4375
+ return elements;
4376
+ };
4377
+ TransitionsStagger.propTypes = propTypes$2;
4378
+ TransitionsStagger.defaultProps = defaultProps$2;
4379
+
4380
+ var propTypes$1 = {
4381
+ selector: PropTypes.string,
4382
+ highlightSelector: PropTypes.string,
4383
+ style: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))
4384
+ };
4385
+ var defaultProps$1 = {
4386
+ selector: null,
4387
+ highlightSelector: 'mark',
4388
+ style: null
4389
+ };
4390
+ var HighlightStyle = function HighlightStyle(_ref) {
4391
+ var selector = _ref.selector,
4392
+ highlightSelector = _ref.highlightSelector,
4393
+ style = _ref.style;
4394
+ return style !== null ? /*#__PURE__*/React.createElement("style", {
4395
+ type: "text/css",
4396
+ dangerouslySetInnerHTML: {
4397
+ __html: "".concat([selector, highlightSelector].filter(function (it) {
4398
+ return it !== null;
4399
+ }).join(' '), "{").concat(utils.convertStyleToString(style), "}")
4400
+ }
4401
+ }) : null;
4402
+ };
4403
+ HighlightStyle.propTypes = propTypes$1;
4404
+ HighlightStyle.defaultProps = defaultProps$1;
4405
+
4406
+ var propTypes = {
4407
+ selector: PropTypes.string,
4408
+ linkSelector: PropTypes.string,
4409
+ style: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))
4410
+ };
4411
+ var defaultProps = {
4412
+ selector: null,
4413
+ linkSelector: 'a',
4414
+ style: null
4415
+ };
4416
+ var LinkStyle = function LinkStyle(_ref) {
4417
+ var selector = _ref.selector,
4418
+ linkSelector = _ref.linkSelector,
4419
+ style = _ref.style;
4420
+ return style !== null ? /*#__PURE__*/React.createElement("style", {
4421
+ type: "text/css",
4422
+ dangerouslySetInnerHTML: {
4423
+ __html: "".concat([selector, linkSelector].filter(function (it) {
4424
+ return it !== null;
4425
+ }).join(' '), "{").concat(utils.convertStyleToString(style), "}")
4426
+ }
4427
+ }) : null;
4428
+ };
4429
+ LinkStyle.propTypes = propTypes;
4430
+ LinkStyle.defaultProps = defaultProps;
4431
+
4432
+ exports.ArrowIcon = ArrowIcon;
4433
+ exports.BackButton = BackButton;
4434
+ exports.Breadcrumb = Breadcrumb;
4435
+ exports.Button = Button$1;
4436
+ exports.Buttons = Buttons;
4437
+ exports.Card = Card;
4438
+ exports.ClearButton = ClearButton;
4439
+ exports.Close = Close;
4440
+ exports.CloseIcon = CloseIcon;
4441
+ exports.CollapsablePanel = CollapsablePanel;
4442
+ exports.Date = Date$1;
4443
+ exports.Detector = Detector;
4444
+ exports.DropdownMenu = Dropdown;
4445
+ exports.Element = ElementComponent;
4446
+ exports.Empty = Empty;
4447
+ exports.FieldForm = FieldForm;
4448
+ exports.FontFaces = FontFaces;
4449
+ exports.Form = Form;
4450
+ exports.FormPanel = FormPanel;
4451
+ exports.FullscreenIcon = FullscreenIcon;
4452
+ exports.HighlightStyle = HighlightStyle;
4453
+ exports.Label = Label;
4454
+ exports.Link = Link;
4455
+ exports.LinkIcon = LinkIcon;
4456
+ exports.LinkStyle = LinkStyle;
4457
+ exports.Media = Media;
4458
+ exports.Menu = _Menu;
4459
+ exports.Meta = Meta;
4460
+ exports.Modal = Modal;
4461
+ exports.ModalDialog = ModalDialog;
4462
+ exports.ModalPortal = ModalPortal;
4463
+ exports.Modals = Modals;
4464
+ exports.MuteIcon = MuteIcon;
4465
+ exports.Navbar = Navbar;
4466
+ exports.Pagination = PaginationMenu;
4467
+ exports.Panel = Panel;
4468
+ exports.PanelPortal = PanelPortal;
4469
+ exports.Panels = Panels;
4470
+ exports.PauseIcon = PauseIcon;
4471
+ exports.PlaceholderAdFrame = AdFrame;
4472
+ exports.PlaceholderAdImage = AdImage;
4473
+ exports.PlaceholderAudio = Audio;
4474
+ exports.PlaceholderButton = Button;
4475
+ exports.PlaceholderImage = Image;
4476
+ exports.PlaceholderLine = Line;
4477
+ exports.PlaceholderMap = Map;
4478
+ exports.PlaceholderMapPath = MapPath;
4479
+ exports.PlaceholderQuote = Quote;
4480
+ exports.PlaceholderShortText = ShortText;
4481
+ exports.PlaceholderSubtitle = Subtitle;
4482
+ exports.PlaceholderText = TextPlaceholder;
4483
+ exports.PlaceholderTimeline = Timeline;
4484
+ exports.PlaceholderTitle = Title$1;
4485
+ exports.PlaceholderVideo = Video;
4486
+ exports.PlaceholderVideo360 = Video360;
4487
+ exports.PlaceholderVideoLoop = VideoLoop;
4488
+ exports.PlayIcon = PlayIcon;
4489
+ exports.Screen = Screen$1;
4490
+ exports.ScreenElement = ScreenElement;
4491
+ exports.ScreenPlaceholder = Placeholder;
4492
+ exports.ScreenPreview = Preview;
4493
+ exports.ScreenSizer = ScreenSizer;
4494
+ exports.Screens = Screens;
4495
+ exports.Slideshow = Slideshow;
4496
+ exports.Spinner = Spinner;
4497
+ exports.Tabs = TabsMenu;
4498
+ exports.Transitions = Transitions;
4499
+ exports.TransitionsStagger = TransitionsStagger;
4500
+ exports.UnmuteIcon = UnmuteIcon;