@micromag/core 0.3.251 → 0.3.262
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/css/styles.css +2 -2
- package/es/components.js +61 -38
- package/es/contexts.js +79 -134
- package/es/hooks.js +88 -69
- package/es/utils.js +49 -1
- package/lib/components.js +61 -38
- package/lib/contexts.js +78 -136
- package/lib/hooks.js +88 -68
- package/lib/utils.js +50 -0
- package/package.json +2 -2
package/es/hooks.js
CHANGED
|
@@ -6,8 +6,8 @@ import isString from 'lodash/isString';
|
|
|
6
6
|
import dayjs from 'dayjs';
|
|
7
7
|
import { EventsManager, MediasParser, StoryParser, ThemeParser } from '@micromag/core';
|
|
8
8
|
import { createUseEvent, getMediaFilesAsArray } from '@micromag/core/utils';
|
|
9
|
-
import { useDrag } from '@use-gesture/react';
|
|
10
9
|
import { useSpring, useSprings } from '@react-spring/core';
|
|
10
|
+
import { useDrag } from '@use-gesture/react';
|
|
11
11
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
12
12
|
import { useForm as useForm$1 } from '@folklore/forms';
|
|
13
13
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
@@ -193,41 +193,22 @@ var useFormattedTime = function useFormattedTime() {
|
|
|
193
193
|
}, [now, showNow, timeGap, format]);
|
|
194
194
|
};
|
|
195
195
|
|
|
196
|
-
var
|
|
197
|
-
var
|
|
198
|
-
|
|
199
|
-
var
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
196
|
+
var useDebounced = function useDebounced(handler, watchedValue) {
|
|
197
|
+
var delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 300;
|
|
198
|
+
useEffect(function () {
|
|
199
|
+
var timeoutHandler = setTimeout(function () {
|
|
200
|
+
if (handler !== null) {
|
|
201
|
+
handler(watchedValue);
|
|
202
|
+
}
|
|
203
|
+
}, delay);
|
|
204
|
+
return function () {
|
|
205
|
+
clearTimeout(timeoutHandler);
|
|
206
|
+
};
|
|
207
|
+
}, [watchedValue, delay]);
|
|
208
208
|
};
|
|
209
209
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
213
|
-
progress = _useState2[0],
|
|
214
|
-
setProgress = _useState2[1];
|
|
215
|
-
|
|
216
|
-
var onChange = useCallback(function (spring) {
|
|
217
|
-
return setProgress(getValueFromSpring(spring));
|
|
218
|
-
}, [setProgress]);
|
|
219
|
-
useSpring(_objectSpread({
|
|
220
|
-
progress: wantedProgress,
|
|
221
|
-
onChange: onChange,
|
|
222
|
-
immediate: immediate
|
|
223
|
-
}, params)); // useEffect(() => {
|
|
224
|
-
// if (wantedProgress !== null) {
|
|
225
|
-
// api.start({ progress: wantedProgress, immediate, ...params });
|
|
226
|
-
// }
|
|
227
|
-
// }, [wantedProgress, immediate, params, api]);
|
|
228
|
-
|
|
229
|
-
return immediate ? wantedProgress : progress;
|
|
230
|
-
}
|
|
210
|
+
var eventsManager$1 = typeof document !== 'undefined' ? new EventsManager(document) : null;
|
|
211
|
+
var useDocumentEvent = createUseEvent(eventsManager$1);
|
|
231
212
|
|
|
232
213
|
function useDragProgress() {
|
|
233
214
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
@@ -246,21 +227,28 @@ function useDragProgress() {
|
|
|
246
227
|
springParams = _ref$springParams === void 0 ? undefined : _ref$springParams,
|
|
247
228
|
_ref$dragOptions = _ref.dragOptions,
|
|
248
229
|
dragOptions = _ref$dragOptions === void 0 ? {
|
|
249
|
-
filterTaps: true
|
|
250
|
-
preventDefault: true
|
|
230
|
+
filterTaps: true
|
|
251
231
|
} : _ref$dragOptions;
|
|
252
232
|
|
|
253
233
|
var refDragging = useRef(false);
|
|
234
|
+
var refProgress = useRef(wantedProgress);
|
|
254
235
|
|
|
255
|
-
var _useState = useState(
|
|
256
|
-
dragging: false,
|
|
257
|
-
progress: wantedProgress
|
|
258
|
-
}),
|
|
236
|
+
var _useState = useState(false),
|
|
259
237
|
_useState2 = _slicedToArray(_useState, 2),
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
238
|
+
dragging = _useState2[0],
|
|
239
|
+
setDragging = _useState2[1];
|
|
240
|
+
|
|
241
|
+
var spring = useCallback(function () {
|
|
242
|
+
return _objectSpread({
|
|
243
|
+
progress: wantedProgress,
|
|
244
|
+
immediate: dragging || disabled
|
|
245
|
+
}, springParams);
|
|
246
|
+
}, []);
|
|
247
|
+
|
|
248
|
+
var _useSpring = useSpring(spring),
|
|
249
|
+
_useSpring2 = _slicedToArray(_useSpring, 2),
|
|
250
|
+
progress = _useSpring2[0].progress,
|
|
251
|
+
api = _useSpring2[1];
|
|
264
252
|
|
|
265
253
|
var onDrag = useCallback(function (gestureState) {
|
|
266
254
|
if (disabled) {
|
|
@@ -281,29 +269,35 @@ function useDragProgress() {
|
|
|
281
269
|
|
|
282
270
|
var newProgress = computeProgress(gestureState);
|
|
283
271
|
refDragging.current = active;
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
272
|
+
refProgress.current = newProgress;
|
|
273
|
+
|
|
274
|
+
if (active !== dragging) {
|
|
275
|
+
setDragging(active);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
api.start({
|
|
279
|
+
progress: newProgress,
|
|
280
|
+
immediate: active
|
|
287
281
|
});
|
|
288
282
|
|
|
289
283
|
if (onProgress !== null) {
|
|
290
284
|
onProgress(newProgress, gestureState);
|
|
291
285
|
}
|
|
292
|
-
}, [
|
|
286
|
+
}, [setDragging, disabled, onTap, computeProgress, dragging, onProgress]);
|
|
293
287
|
var bind = useDrag(onDrag, dragOptions);
|
|
294
|
-
var springedProgress = useSpringValue(progress, dragging || disabled, springParams);
|
|
295
288
|
useEffect(function () {
|
|
296
|
-
if (wantedProgress !==
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
progress: wantedProgress
|
|
289
|
+
if (!refDragging.current && wantedProgress !== refProgress.current) {
|
|
290
|
+
refProgress.current = wantedProgress;
|
|
291
|
+
api.start({
|
|
292
|
+
progress: wantedProgress,
|
|
293
|
+
immediate: false
|
|
300
294
|
});
|
|
301
295
|
}
|
|
302
296
|
}, [wantedProgress]);
|
|
303
297
|
return {
|
|
304
298
|
bind: bind,
|
|
305
299
|
dragging: dragging,
|
|
306
|
-
progress:
|
|
300
|
+
progress: progress
|
|
307
301
|
};
|
|
308
302
|
}
|
|
309
303
|
|
|
@@ -1489,16 +1483,17 @@ function useMediaProgress(media) {
|
|
|
1489
1483
|
var _useState = useState(!disabled),
|
|
1490
1484
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1491
1485
|
playing = _useState2[0],
|
|
1492
|
-
setPlaying = _useState2[1];
|
|
1486
|
+
setPlaying = _useState2[1]; // const currentTime = useMediaCurrentTime(media, {
|
|
1487
|
+
// disabled: disabled || !playing,
|
|
1488
|
+
// ...props,
|
|
1489
|
+
// });
|
|
1490
|
+
|
|
1493
1491
|
|
|
1494
|
-
var currentTime = useMediaCurrentTime(media, _objectSpread({
|
|
1495
|
-
disabled: disabled || !playing
|
|
1496
|
-
}, props));
|
|
1497
1492
|
var duration = useMediaDuration(media, _objectSpread({
|
|
1498
1493
|
disabled: disabled || !playing
|
|
1499
1494
|
}, props));
|
|
1500
1495
|
|
|
1501
|
-
var _useState3 = useState(currentTime > 0 && duration > 0 ? currentTime / duration : 0),
|
|
1496
|
+
var _useState3 = useState(media !== null && (media.currentTime || 0) > 0 && duration > 0 ? media.currentTime / duration : 0),
|
|
1502
1497
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
1503
1498
|
progress = _useState4[0],
|
|
1504
1499
|
setProgress = _useState4[1];
|
|
@@ -1533,8 +1528,8 @@ function useMediaProgress(media) {
|
|
|
1533
1528
|
|
|
1534
1529
|
media.addEventListener('play', onResume);
|
|
1535
1530
|
media.addEventListener('seeked', onResume);
|
|
1536
|
-
media.addEventListener('playing', onResume);
|
|
1537
|
-
|
|
1531
|
+
media.addEventListener('playing', onResume); // media.addEventListener('timeupdate', onResume);
|
|
1532
|
+
|
|
1538
1533
|
media.addEventListener('pause', onPause);
|
|
1539
1534
|
media.addEventListener('ended', onPause);
|
|
1540
1535
|
media.addEventListener('waiting', onPause);
|
|
@@ -1549,8 +1544,8 @@ function useMediaProgress(media) {
|
|
|
1549
1544
|
return function () {
|
|
1550
1545
|
media.removeEventListener('play', onResume);
|
|
1551
1546
|
media.removeEventListener('seeked', onResume);
|
|
1552
|
-
media.removeEventListener('playing', onResume);
|
|
1553
|
-
|
|
1547
|
+
media.removeEventListener('playing', onResume); // media.removeEventListener('timeupdate', onResume);
|
|
1548
|
+
|
|
1554
1549
|
media.removeEventListener('pause', onPause);
|
|
1555
1550
|
media.removeEventListener('ended', onPause);
|
|
1556
1551
|
media.removeEventListener('waiting', onPause);
|
|
@@ -1559,11 +1554,7 @@ function useMediaProgress(media) {
|
|
|
1559
1554
|
};
|
|
1560
1555
|
}, [media, updateProgress, setPlaying, playing]);
|
|
1561
1556
|
useEffect(function () {
|
|
1562
|
-
if (media === null) {
|
|
1563
|
-
return function () {};
|
|
1564
|
-
}
|
|
1565
|
-
|
|
1566
|
-
if (!playing || disabled) {
|
|
1557
|
+
if (media === null || !playing || disabled) {
|
|
1567
1558
|
return function () {};
|
|
1568
1559
|
}
|
|
1569
1560
|
|
|
@@ -2012,6 +2003,34 @@ var useScreenSizeFromWindow = function useScreenSizeFromWindow(opts) {
|
|
|
2012
2003
|
return useScreenSize(_objectSpread(_objectSpread({}, opts), windowSize));
|
|
2013
2004
|
};
|
|
2014
2005
|
|
|
2006
|
+
var getValueFromSpring = function getValueFromSpring(s) {
|
|
2007
|
+
var _ref = s || {},
|
|
2008
|
+
_ref$value = _ref.value,
|
|
2009
|
+
v = _ref$value === void 0 ? null : _ref$value;
|
|
2010
|
+
|
|
2011
|
+
var _ref2 = v || {},
|
|
2012
|
+
p = _ref2.progress;
|
|
2013
|
+
|
|
2014
|
+
return p;
|
|
2015
|
+
};
|
|
2016
|
+
|
|
2017
|
+
function useSpringValue(wantedProgress, immediate, params) {
|
|
2018
|
+
var _useState = useState(wantedProgress),
|
|
2019
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
2020
|
+
progress = _useState2[0],
|
|
2021
|
+
setProgress = _useState2[1];
|
|
2022
|
+
|
|
2023
|
+
var onChange = useCallback(function (spring) {
|
|
2024
|
+
return setProgress(getValueFromSpring(spring));
|
|
2025
|
+
}, [setProgress]);
|
|
2026
|
+
useSpring(_objectSpread({
|
|
2027
|
+
progress: wantedProgress,
|
|
2028
|
+
onChange: onChange,
|
|
2029
|
+
immediate: immediate
|
|
2030
|
+
}, params));
|
|
2031
|
+
return immediate ? wantedProgress : progress;
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2015
2034
|
var useSwipe = function useSwipe() {
|
|
2016
2035
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
2017
2036
|
_ref$width = _ref.width,
|
|
@@ -2333,4 +2352,4 @@ var useTrackMedia = function useTrackMedia() {
|
|
|
2333
2352
|
var eventsManager = typeof window !== 'undefined' ? new EventsManager(window) : null;
|
|
2334
2353
|
var useWindowEvent = createUseEvent(eventsManager);
|
|
2335
2354
|
|
|
2336
|
-
export { getObserver, useActivityDetector, useAnimationFrame, useDimensionObserver, useDocumentEvent, useDragProgress, useForm, useFormTransition, useFormattedDate, useFormattedTime, useFullscreen, useIntersectionObserver, useIsVisible, useLoadedFonts, useLongPress, useMediaApi, useMediaCurrentTime, useMediaDuration, useMediaLoad, useMediaProgress, useMediaReady, useMediaThumbnail, useMediaWaveform, useMediasParser, useObserver, useParsedStory, useProgressSteps, useResizeObserver, useScreenSizeFromElement, useScreenSizeFromWindow, useSpringValue, useSwipe, useThemeParser, useTrackEvent, useTrackMedia, useTrackScreenEvent, useTrackScreenMedia, useTrackScreenView, useWindowEvent };
|
|
2355
|
+
export { getObserver, useActivityDetector, useAnimationFrame, useDebounced as useDebounce, useDimensionObserver, useDocumentEvent, useDragProgress, useForm, useFormTransition, useFormattedDate, useFormattedTime, useFullscreen, useIntersectionObserver, useIsVisible, useLoadedFonts, useLongPress, useMediaApi, useMediaCurrentTime, useMediaDuration, useMediaLoad, useMediaProgress, useMediaReady, useMediaThumbnail, useMediaWaveform, useMediasParser, useObserver, useParsedStory, useProgressSteps, useResizeObserver, useScreenSizeFromElement, useScreenSizeFromWindow, useSpringValue, useSwipe, useThemeParser, useTrackEvent, useTrackMedia, useTrackScreenEvent, useTrackScreenMedia, useTrackScreenView, useWindowEvent };
|
package/es/utils.js
CHANGED
|
@@ -638,6 +638,38 @@ function getShadowCoords(angle, distance) {
|
|
|
638
638
|
};
|
|
639
639
|
}
|
|
640
640
|
|
|
641
|
+
// import isObject from 'lodash/isObject';
|
|
642
|
+
function getJustifyContent(horizontal) {
|
|
643
|
+
if (horizontal === 'left') return 'flex-start';
|
|
644
|
+
if (horizontal === 'middle') return 'center';
|
|
645
|
+
if (horizontal === 'right') return 'flex-end';
|
|
646
|
+
return null;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
function getAlignItems(vertical) {
|
|
650
|
+
if (vertical === 'top') return 'flex-start';
|
|
651
|
+
if (vertical === 'middle') return 'center';
|
|
652
|
+
if (vertical === 'bottom') return 'flex-end';
|
|
653
|
+
return null;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
var getStyleFromAlignment = function getStyleFromAlignment(value) {
|
|
657
|
+
if (value === null) {
|
|
658
|
+
return null;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
var _value$horizontal = value.horizontal,
|
|
662
|
+
horizontal = _value$horizontal === void 0 ? null : _value$horizontal,
|
|
663
|
+
_value$vertical = value.vertical,
|
|
664
|
+
vertical = _value$vertical === void 0 ? null : _value$vertical;
|
|
665
|
+
var justifyContent = getJustifyContent(horizontal);
|
|
666
|
+
var alignItems = getAlignItems(vertical);
|
|
667
|
+
return {
|
|
668
|
+
justifyContent: justifyContent,
|
|
669
|
+
alignItems: alignItems
|
|
670
|
+
};
|
|
671
|
+
};
|
|
672
|
+
|
|
641
673
|
var getStyleFromColor = function getStyleFromColor() {
|
|
642
674
|
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
643
675
|
var property = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'backgroundColor';
|
|
@@ -931,6 +963,22 @@ var getStyleFromMargin = function getStyleFromMargin(value) {
|
|
|
931
963
|
} : null);
|
|
932
964
|
};
|
|
933
965
|
|
|
966
|
+
var possibleMimes = ['video/webm', 'video/mp4', 'video/ogg'];
|
|
967
|
+
var supportedMimes = null;
|
|
968
|
+
|
|
969
|
+
function getVideoSupportedMimes() {
|
|
970
|
+
var mimes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : possibleMimes;
|
|
971
|
+
|
|
972
|
+
if (supportedMimes === null) {
|
|
973
|
+
var video = document.createElement('video');
|
|
974
|
+
supportedMimes = mimes.filter(function (mime) {
|
|
975
|
+
return video.canPlayType(mime) !== '';
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
return supportedMimes;
|
|
980
|
+
}
|
|
981
|
+
|
|
934
982
|
var getLayoutParts = function getLayoutParts() {
|
|
935
983
|
var layout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
936
984
|
|
|
@@ -1093,4 +1141,4 @@ var getContrastingColor = function getContrastingColor(backgroundColor) {
|
|
|
1093
1141
|
return tinycolor(color).spin(30).toString();
|
|
1094
1142
|
};
|
|
1095
1143
|
|
|
1096
|
-
export { convertStyleToString, copyToClipboard, createNullableOnChange, createUseEvent, easings, getColorAsString, getComponentFromName, getContrastingColor, getDeviceScreens, getDisplayName, getFieldByName, getFieldFromPath, getFileName, getFontFamily as getFontFamilyFromFont, getGridLayoutName, largestRemainderRound as getLargestRemainderRound, getLayersFromBackground, getLayoutParts, getMediaFilesAsArray, getOptimalImageUrl, getScreenExtraField, getSecondsFromTime, getShadowCoords, getStyleFromBorder, getStyleFromBox, getStyleFromColor, getStyleFromContainer, getStyleFromHighlight, getStyleFromImage, getStyleFromLink, getStyleFromMargin, getStyleFromText, isImageFilled, isIos, isTextFilled$1 as isLabelFilled, isMessage, isTextFilled, isValidUrl, schemaId, setValue as setFieldValue, slug, unique, validateFields };
|
|
1144
|
+
export { convertStyleToString, copyToClipboard, createNullableOnChange, createUseEvent, easings, getColorAsString, getComponentFromName, getContrastingColor, getDeviceScreens, getDisplayName, getFieldByName, getFieldFromPath, getFileName, getFontFamily as getFontFamilyFromFont, getGridLayoutName, largestRemainderRound as getLargestRemainderRound, getLayersFromBackground, getLayoutParts, getMediaFilesAsArray, getOptimalImageUrl, getScreenExtraField, getSecondsFromTime, getShadowCoords, getStyleFromAlignment, getStyleFromBorder, getStyleFromBox, getStyleFromColor, getStyleFromContainer, getStyleFromHighlight, getStyleFromImage, getStyleFromLink, getStyleFromMargin, getStyleFromText, getVideoSupportedMimes, isImageFilled, isIos, isTextFilled$1 as isLabelFilled, isMessage, isTextFilled, isValidUrl, schemaId, setValue as setFieldValue, slug, unique, validateFields };
|
package/lib/components.js
CHANGED
|
@@ -111,7 +111,7 @@ Label.defaultProps = defaultProps$L;
|
|
|
111
111
|
|
|
112
112
|
var styles$w = {"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","withAnimations":"micromag-core-buttons-button-withAnimations","icon-right":"micromag-core-buttons-button-icon-right","withIconColumns":"micromag-core-buttons-button-withIconColumns","linkDisabled":"micromag-core-buttons-button-linkDisabled"};
|
|
113
113
|
|
|
114
|
-
var _excluded$
|
|
114
|
+
var _excluded$b = ["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"];
|
|
115
115
|
var propTypes$K = {
|
|
116
116
|
type: PropTypes__default["default"].string,
|
|
117
117
|
theme: core.PropTypes.buttonTheme,
|
|
@@ -210,7 +210,7 @@ var Button$1 = function Button(_ref) {
|
|
|
210
210
|
iconClassName = _ref.iconClassName,
|
|
211
211
|
labelClassName = _ref.labelClassName,
|
|
212
212
|
refButton = _ref.refButton,
|
|
213
|
-
props = _objectWithoutProperties__default["default"](_ref, _excluded$
|
|
213
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded$b);
|
|
214
214
|
|
|
215
215
|
var finalLabel = label || children;
|
|
216
216
|
var text = finalLabel !== null ? /*#__PURE__*/React__default["default"].createElement(Label, null, finalLabel) : null;
|
|
@@ -269,7 +269,7 @@ Button$1.defaultProps = defaultProps$K;
|
|
|
269
269
|
|
|
270
270
|
var styles$v = {};
|
|
271
271
|
|
|
272
|
-
var _excluded$
|
|
272
|
+
var _excluded$a = ["className", "onClick", "theme"];
|
|
273
273
|
var propTypes$J = {
|
|
274
274
|
buttons: core.PropTypes.buttons,
|
|
275
275
|
size: core.PropTypes.buttonSize,
|
|
@@ -309,7 +309,7 @@ var Buttons = function Buttons(_ref) {
|
|
|
309
309
|
_onClick = _button$onClick === void 0 ? null : _button$onClick,
|
|
310
310
|
_button$theme = button.theme,
|
|
311
311
|
buttonTheme = _button$theme === void 0 ? null : _button$theme,
|
|
312
|
-
buttonProps = _objectWithoutProperties__default["default"](button, _excluded$
|
|
312
|
+
buttonProps = _objectWithoutProperties__default["default"](button, _excluded$a);
|
|
313
313
|
|
|
314
314
|
var fixedProps = {
|
|
315
315
|
key: "button-".concat(index),
|
|
@@ -332,7 +332,7 @@ var Buttons = function Buttons(_ref) {
|
|
|
332
332
|
Buttons.propTypes = propTypes$J;
|
|
333
333
|
Buttons.defaultProps = defaultProps$J;
|
|
334
334
|
|
|
335
|
-
var _excluded$
|
|
335
|
+
var _excluded$9 = ["className"];
|
|
336
336
|
var propTypes$I = {
|
|
337
337
|
className: PropTypes__default["default"].string
|
|
338
338
|
};
|
|
@@ -342,7 +342,7 @@ var defaultProps$I = {
|
|
|
342
342
|
|
|
343
343
|
var BackButton = function BackButton(_ref) {
|
|
344
344
|
var className = _ref.className,
|
|
345
|
-
props = _objectWithoutProperties__default["default"](_ref, _excluded$
|
|
345
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded$9);
|
|
346
346
|
|
|
347
347
|
return /*#__PURE__*/React__default["default"].createElement(Button$1, Object.assign({
|
|
348
348
|
className: classNames__default["default"](['px-2', _defineProperty__default["default"]({}, className, className)]),
|
|
@@ -359,7 +359,7 @@ BackButton.defaultProps = defaultProps$I;
|
|
|
359
359
|
|
|
360
360
|
var styles$u = {"actions":"micromag-core-forms-form-actions","left":"micromag-core-forms-form-left","right":"micromag-core-forms-form-right"};
|
|
361
361
|
|
|
362
|
-
var _excluded$
|
|
362
|
+
var _excluded$8 = ["type"],
|
|
363
363
|
_excluded2 = ["component", "id", "settings"];
|
|
364
364
|
var propTypes$H = {
|
|
365
365
|
name: PropTypes__default["default"].string,
|
|
@@ -403,7 +403,7 @@ var FieldForm = function FieldForm(_ref) {
|
|
|
403
403
|
var _ref2 = field || {},
|
|
404
404
|
_ref2$type = _ref2.type,
|
|
405
405
|
type = _ref2$type === void 0 ? null : _ref2$type,
|
|
406
|
-
fieldProps = _objectWithoutProperties__default["default"](_ref2, _excluded$
|
|
406
|
+
fieldProps = _objectWithoutProperties__default["default"](_ref2, _excluded$8);
|
|
407
407
|
|
|
408
408
|
var fieldDefinition = fieldsManager.getDefinition(type) || null;
|
|
409
409
|
|
|
@@ -711,7 +711,7 @@ Form.defaultProps = defaultProps$G;
|
|
|
711
711
|
|
|
712
712
|
var styles$t = {"withoutStyle":"micromag-core-partials-link-withoutStyle"};
|
|
713
713
|
|
|
714
|
-
var _excluded$
|
|
714
|
+
var _excluded$7 = ["href", "external", "children", "target", "rel", "className", "withoutStyle"];
|
|
715
715
|
var propTypes$F = {
|
|
716
716
|
href: PropTypes__default["default"].string,
|
|
717
717
|
external: PropTypes__default["default"].bool,
|
|
@@ -739,7 +739,7 @@ var Link = function Link(_ref) {
|
|
|
739
739
|
rel = _ref.rel,
|
|
740
740
|
className = _ref.className,
|
|
741
741
|
withoutStyle = _ref.withoutStyle,
|
|
742
|
-
props = _objectWithoutProperties__default["default"](_ref, _excluded$
|
|
742
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded$7);
|
|
743
743
|
|
|
744
744
|
return external ? /*#__PURE__*/React__default["default"].createElement("a", Object.assign({
|
|
745
745
|
className: classNames__default["default"]([className, _defineProperty__default["default"]({}, styles$t.withoutStyle, withoutStyle)]),
|
|
@@ -755,7 +755,7 @@ var Link = function Link(_ref) {
|
|
|
755
755
|
Link.propTypes = propTypes$F;
|
|
756
756
|
Link.defaultProps = defaultProps$F;
|
|
757
757
|
|
|
758
|
-
var _excluded$
|
|
758
|
+
var _excluded$6 = ["label", "className"];
|
|
759
759
|
var propTypes$E = {
|
|
760
760
|
href: PropTypes__default["default"].string,
|
|
761
761
|
header: PropTypes__default["default"].node,
|
|
@@ -843,7 +843,7 @@ var Card = function Card(_ref) {
|
|
|
843
843
|
var label = _ref2.label,
|
|
844
844
|
_ref2$className = _ref2.className,
|
|
845
845
|
linkClassName = _ref2$className === void 0 ? null : _ref2$className,
|
|
846
|
-
linkProps = _objectWithoutProperties__default["default"](_ref2, _excluded$
|
|
846
|
+
linkProps = _objectWithoutProperties__default["default"](_ref2, _excluded$6);
|
|
847
847
|
|
|
848
848
|
return /*#__PURE__*/React__default["default"].createElement(Link, Object.assign({
|
|
849
849
|
key: "link-".concat(label, "-").concat(index),
|
|
@@ -984,7 +984,7 @@ Spinner.defaultProps = defaultProps$D;
|
|
|
984
984
|
|
|
985
985
|
var styles$s = {};
|
|
986
986
|
|
|
987
|
-
var _excluded$
|
|
987
|
+
var _excluded$5 = ["description", "loading", "children", "className"];
|
|
988
988
|
var propTypes$C = {
|
|
989
989
|
description: PropTypes__default["default"].node,
|
|
990
990
|
loading: PropTypes__default["default"].bool,
|
|
@@ -1003,7 +1003,7 @@ var FormPanel = function FormPanel(_ref) {
|
|
|
1003
1003
|
loading = _ref.loading,
|
|
1004
1004
|
children = _ref.children,
|
|
1005
1005
|
className = _ref.className,
|
|
1006
|
-
props = _objectWithoutProperties__default["default"](_ref, _excluded$
|
|
1006
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded$5);
|
|
1007
1007
|
|
|
1008
1008
|
return /*#__PURE__*/React__default["default"].createElement(Card, Object.assign({
|
|
1009
1009
|
className: classNames__default["default"]([styles$s.container, _defineProperty__default["default"]({}, className, className !== null)])
|
|
@@ -1076,7 +1076,7 @@ var Breadcrumb = function Breadcrumb(_ref) {
|
|
|
1076
1076
|
Breadcrumb.propTypes = propTypes$B;
|
|
1077
1077
|
Breadcrumb.defaultProps = defaultProps$B;
|
|
1078
1078
|
|
|
1079
|
-
var _excluded$
|
|
1079
|
+
var _excluded$4 = ["type", "className", "label", "children", "onClick", "active"];
|
|
1080
1080
|
var propTypes$A = {
|
|
1081
1081
|
items: core.PropTypes.menuItems,
|
|
1082
1082
|
children: PropTypes__default["default"].node,
|
|
@@ -1149,7 +1149,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
1149
1149
|
customOnClick = _it$onClick === void 0 ? null : _it$onClick,
|
|
1150
1150
|
_it$active = it.active,
|
|
1151
1151
|
active = _it$active === void 0 ? false : _it$active,
|
|
1152
|
-
itemProps = _objectWithoutProperties__default["default"](it, _excluded$
|
|
1152
|
+
itemProps = _objectWithoutProperties__default["default"](it, _excluded$4);
|
|
1153
1153
|
|
|
1154
1154
|
var ItemComponent = 'div';
|
|
1155
1155
|
|
|
@@ -1188,7 +1188,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
1188
1188
|
Dropdown.propTypes = propTypes$A;
|
|
1189
1189
|
Dropdown.defaultProps = defaultProps$A;
|
|
1190
1190
|
|
|
1191
|
-
var _excluded$
|
|
1191
|
+
var _excluded$3 = ["id", "className", "linkClassName", "href", "label", "external", "items", "dropdown", "active", "onClick"];
|
|
1192
1192
|
var propTypes$z = {
|
|
1193
1193
|
items: core.PropTypes.menuItems,
|
|
1194
1194
|
tagName: PropTypes__default["default"].string,
|
|
@@ -1278,7 +1278,7 @@ var Menu = function Menu(_ref) {
|
|
|
1278
1278
|
active = _it$active === void 0 ? false : _it$active,
|
|
1279
1279
|
_it$onClick = it.onClick,
|
|
1280
1280
|
customOnClick = _it$onClick === void 0 ? null : _it$onClick,
|
|
1281
|
-
itemProps = _objectWithoutProperties__default["default"](it, _excluded$
|
|
1281
|
+
itemProps = _objectWithoutProperties__default["default"](it, _excluded$3);
|
|
1282
1282
|
|
|
1283
1283
|
var onClickItem = dropdown !== null ? function (e) {
|
|
1284
1284
|
e.preventDefault();
|
|
@@ -2222,7 +2222,7 @@ var Detector = function Detector(_ref) {
|
|
|
2222
2222
|
Detector.propTypes = propTypes$j;
|
|
2223
2223
|
Detector.defaultProps = defaultProps$j;
|
|
2224
2224
|
|
|
2225
|
-
var styles$h = {"container":"micromag-core-partials-placeholder-block-container","
|
|
2225
|
+
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"};
|
|
2226
2226
|
|
|
2227
2227
|
var propTypes$i = {
|
|
2228
2228
|
width: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, PropTypes__default["default"].string]),
|
|
@@ -2230,7 +2230,8 @@ var propTypes$i = {
|
|
|
2230
2230
|
outline: PropTypes__default["default"].bool,
|
|
2231
2231
|
className: PropTypes__default["default"].string,
|
|
2232
2232
|
boxClassName: PropTypes__default["default"].string,
|
|
2233
|
-
children: PropTypes__default["default"].node
|
|
2233
|
+
children: PropTypes__default["default"].node,
|
|
2234
|
+
withInvertedColors: PropTypes__default["default"].bool
|
|
2234
2235
|
};
|
|
2235
2236
|
var defaultProps$i = {
|
|
2236
2237
|
width: '100%',
|
|
@@ -2238,7 +2239,8 @@ var defaultProps$i = {
|
|
|
2238
2239
|
outline: false,
|
|
2239
2240
|
className: null,
|
|
2240
2241
|
boxClassName: null,
|
|
2241
|
-
children: null
|
|
2242
|
+
children: null,
|
|
2243
|
+
withInvertedColors: true
|
|
2242
2244
|
};
|
|
2243
2245
|
|
|
2244
2246
|
var PlaceholderBlock = function PlaceholderBlock(_ref) {
|
|
@@ -2249,9 +2251,10 @@ var PlaceholderBlock = function PlaceholderBlock(_ref) {
|
|
|
2249
2251
|
outline = _ref.outline,
|
|
2250
2252
|
className = _ref.className,
|
|
2251
2253
|
boxClassName = _ref.boxClassName,
|
|
2254
|
+
withInvertedColors = _ref.withInvertedColors,
|
|
2252
2255
|
children = _ref.children;
|
|
2253
2256
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2254
|
-
className: classNames__default["default"]([styles$h.container, (_ref2 = {}, _defineProperty__default["default"](_ref2, className, className !== null), _defineProperty__default["default"](_ref2, styles$h.outline, outline), _ref2)])
|
|
2257
|
+
className: classNames__default["default"]([styles$h.container, (_ref2 = {}, _defineProperty__default["default"](_ref2, className, className !== null), _defineProperty__default["default"](_ref2, styles$h.outline, outline), _defineProperty__default["default"](_ref2, styles$h.withInvertedColors, withInvertedColors), _ref2)])
|
|
2255
2258
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2256
2259
|
className: classNames__default["default"]([styles$h.box, _defineProperty__default["default"]({}, boxClassName, boxClassName !== null)]),
|
|
2257
2260
|
style: {
|
|
@@ -3309,7 +3312,7 @@ var Audio = function Audio(_ref) {
|
|
|
3309
3312
|
}));
|
|
3310
3313
|
};
|
|
3311
3314
|
|
|
3312
|
-
var styles$c = {"container":"micromag-core-partials-placeholder-text-container","line":"micromag-core-partials-placeholder-text-line"};
|
|
3315
|
+
var styles$c = {"container":"micromag-core-partials-placeholder-text-container","withInvertedColors":"micromag-core-partials-placeholder-text-withInvertedColors","line":"micromag-core-partials-placeholder-text-line"};
|
|
3313
3316
|
|
|
3314
3317
|
var propTypes$b = {
|
|
3315
3318
|
lines: PropTypes__default["default"].number,
|
|
@@ -3317,7 +3320,8 @@ var propTypes$b = {
|
|
|
3317
3320
|
width: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, PropTypes__default["default"].string]),
|
|
3318
3321
|
height: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, PropTypes__default["default"].string]),
|
|
3319
3322
|
fontSize: PropTypes__default["default"].number,
|
|
3320
|
-
className: PropTypes__default["default"].string
|
|
3323
|
+
className: PropTypes__default["default"].string,
|
|
3324
|
+
withInvertedColors: PropTypes__default["default"].bool
|
|
3321
3325
|
};
|
|
3322
3326
|
var defaultProps$b = {
|
|
3323
3327
|
lines: 1,
|
|
@@ -3325,20 +3329,24 @@ var defaultProps$b = {
|
|
|
3325
3329
|
width: '100%',
|
|
3326
3330
|
height: null,
|
|
3327
3331
|
fontSize: 16,
|
|
3328
|
-
className: null
|
|
3332
|
+
className: null,
|
|
3333
|
+
withInvertedColors: true
|
|
3329
3334
|
};
|
|
3330
3335
|
|
|
3331
3336
|
var PlaceholderText = function PlaceholderText(_ref) {
|
|
3337
|
+
var _ref2;
|
|
3338
|
+
|
|
3332
3339
|
var lines = _ref.lines,
|
|
3333
3340
|
lineMargin = _ref.lineMargin,
|
|
3334
3341
|
width = _ref.width,
|
|
3335
3342
|
height = _ref.height,
|
|
3336
3343
|
fontSize = _ref.fontSize,
|
|
3337
|
-
className = _ref.className
|
|
3344
|
+
className = _ref.className,
|
|
3345
|
+
withInvertedColors = _ref.withInvertedColors;
|
|
3338
3346
|
var lineHeight = height !== null && isNumber__default["default"](height) ? "".concat(Math.round(height * fontSize), "px") : height;
|
|
3339
|
-
var oddWidth = isNumber__default["default"](width) ? width * 0.9 : '
|
|
3347
|
+
var oddWidth = isNumber__default["default"](width) ? width * 0.9 : '80%';
|
|
3340
3348
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3341
|
-
className: classNames__default["default"]([styles$c.container, _defineProperty__default["default"](
|
|
3349
|
+
className: classNames__default["default"]([styles$c.container, (_ref2 = {}, _defineProperty__default["default"](_ref2, className, className), _defineProperty__default["default"](_ref2, styles$c.withInvertedColors, withInvertedColors), _ref2)])
|
|
3342
3350
|
}, _toConsumableArray__default["default"](Array(lines)).map(function (e, index) {
|
|
3343
3351
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3344
3352
|
key: "line-".concat(index),
|
|
@@ -3374,16 +3382,18 @@ var Button = function Button(_ref) {
|
|
|
3374
3382
|
}));
|
|
3375
3383
|
};
|
|
3376
3384
|
|
|
3377
|
-
|
|
3385
|
+
var _excluded$2 = ["width", "height", "className"];
|
|
3378
3386
|
var Image = function Image(_ref) {
|
|
3379
3387
|
var width = _ref.width,
|
|
3380
3388
|
height = _ref.height,
|
|
3381
|
-
className = _ref.className
|
|
3382
|
-
|
|
3389
|
+
className = _ref.className,
|
|
3390
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded$2);
|
|
3391
|
+
|
|
3392
|
+
return /*#__PURE__*/React__default["default"].createElement(PlaceholderBlock, Object.assign({}, props, {
|
|
3383
3393
|
width: width,
|
|
3384
3394
|
height: height,
|
|
3385
3395
|
className: className
|
|
3386
|
-
}, /*#__PURE__*/React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, {
|
|
3396
|
+
}), /*#__PURE__*/React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, {
|
|
3387
3397
|
icon: faImage.faImage,
|
|
3388
3398
|
className: styles$d.icon
|
|
3389
3399
|
}));
|
|
@@ -3463,7 +3473,9 @@ var Subtitle = function Subtitle(props) {
|
|
|
3463
3473
|
/* eslint-disable react/jsx-props-no-spreading, react/destructuring-assignment, react/prop-types */
|
|
3464
3474
|
|
|
3465
3475
|
var TextPlaceholder = function TextPlaceholder(props) {
|
|
3466
|
-
var _props$
|
|
3476
|
+
var _props$className = props.className,
|
|
3477
|
+
className = _props$className === void 0 ? null : _props$className,
|
|
3478
|
+
_props$height = props.height,
|
|
3467
3479
|
height = _props$height === void 0 ? 0.2 : _props$height,
|
|
3468
3480
|
_props$lines = props.lines,
|
|
3469
3481
|
lines = _props$lines === void 0 ? 4 : _props$lines,
|
|
@@ -3473,7 +3485,7 @@ var TextPlaceholder = function TextPlaceholder(props) {
|
|
|
3473
3485
|
height: height,
|
|
3474
3486
|
lines: lines,
|
|
3475
3487
|
lineMargin: lineMargin,
|
|
3476
|
-
className: classNames__default["default"]([
|
|
3488
|
+
className: classNames__default["default"]([className, styles$d.text])
|
|
3477
3489
|
}));
|
|
3478
3490
|
};
|
|
3479
3491
|
|
|
@@ -3486,11 +3498,17 @@ var Timeline = function Timeline(props) {
|
|
|
3486
3498
|
|
|
3487
3499
|
/* eslint-disable react/jsx-props-no-spreading, react/destructuring-assignment, react/prop-types */
|
|
3488
3500
|
var Title$1 = function Title(props) {
|
|
3501
|
+
var _props$height = props.height,
|
|
3502
|
+
height = _props$height === void 0 ? 0.5 : _props$height,
|
|
3503
|
+
_props$lines = props.lines,
|
|
3504
|
+
lines = _props$lines === void 0 ? 2 : _props$lines,
|
|
3505
|
+
_props$lineMargin = props.lineMargin,
|
|
3506
|
+
lineMargin = _props$lineMargin === void 0 ? 2 : _props$lineMargin;
|
|
3489
3507
|
return /*#__PURE__*/React__default["default"].createElement(PlaceholderText, Object.assign({}, props, {
|
|
3490
3508
|
className: classNames__default["default"]([props.className, styles$d.title]),
|
|
3491
|
-
height:
|
|
3492
|
-
lines:
|
|
3493
|
-
lineMargin:
|
|
3509
|
+
height: height,
|
|
3510
|
+
lines: lines,
|
|
3511
|
+
lineMargin: lineMargin
|
|
3494
3512
|
}));
|
|
3495
3513
|
};
|
|
3496
3514
|
|
|
@@ -3675,6 +3693,7 @@ var propTypes$9 = {
|
|
|
3675
3693
|
screen: core.PropTypes.storyComponent.isRequired,
|
|
3676
3694
|
renderContext: core.PropTypes.renderContext,
|
|
3677
3695
|
screenState: PropTypes__default["default"].string,
|
|
3696
|
+
index: PropTypes__default["default"].number,
|
|
3678
3697
|
active: PropTypes__default["default"].bool,
|
|
3679
3698
|
current: PropTypes__default["default"].bool,
|
|
3680
3699
|
component: PropTypes__default["default"].node,
|
|
@@ -3686,6 +3705,7 @@ var defaultProps$9 = {
|
|
|
3686
3705
|
active: true,
|
|
3687
3706
|
renderContext: null,
|
|
3688
3707
|
screenState: null,
|
|
3708
|
+
index: null,
|
|
3689
3709
|
current: false,
|
|
3690
3710
|
component: null,
|
|
3691
3711
|
components: null,
|
|
@@ -3697,6 +3717,7 @@ var Screen = function Screen(_ref) {
|
|
|
3697
3717
|
var screen = _ref.screen,
|
|
3698
3718
|
renderContext = _ref.renderContext,
|
|
3699
3719
|
screenState = _ref.screenState,
|
|
3720
|
+
index = _ref.index,
|
|
3700
3721
|
active = _ref.active,
|
|
3701
3722
|
current = _ref.current,
|
|
3702
3723
|
components = _ref.components,
|
|
@@ -3710,7 +3731,8 @@ var Screen = function Screen(_ref) {
|
|
|
3710
3731
|
|
|
3711
3732
|
var CustomScreenComponent = components !== null ? utils.getComponentFromName(type, components) || null : null;
|
|
3712
3733
|
var ContextScreenComponent = contexts.useScreenComponent(type);
|
|
3713
|
-
var ScreenComponent = CustomScreenComponent || ContextScreenComponent;
|
|
3734
|
+
var ScreenComponent = CustomScreenComponent || ContextScreenComponent; // Comment
|
|
3735
|
+
|
|
3714
3736
|
return /*#__PURE__*/React__default["default"].createElement(contexts.ScreenProvider, {
|
|
3715
3737
|
data: screen,
|
|
3716
3738
|
renderContext: renderContext,
|
|
@@ -3718,6 +3740,7 @@ var Screen = function Screen(_ref) {
|
|
|
3718
3740
|
}, ScreenComponent !== null ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3719
3741
|
className: classNames__default["default"]([styles$8.container, _defineProperty__default["default"]({}, className, className !== null)])
|
|
3720
3742
|
}, /*#__PURE__*/React__default["default"].createElement(ScreenComponent, Object.assign({}, screen, {
|
|
3743
|
+
index: index,
|
|
3721
3744
|
active: active,
|
|
3722
3745
|
current: current,
|
|
3723
3746
|
mediaRef: mediaRef
|