@micromag/core 0.4.55 → 0.4.63
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/vendor.css +2 -2
- package/es/components.d.ts +6 -6
- package/es/components.js +4 -4
- package/es/contexts.d.ts +35 -18
- package/es/contexts.js +31 -22
- package/es/hooks.d.ts +29 -25
- package/es/hooks.js +50 -43
- package/lib/components.js +4 -4
- package/lib/contexts.js +31 -22
- package/lib/hooks.js +50 -43
- package/package.json +2 -2
package/es/components.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { CSSProperties, MouseEventHandler, ForwardedRef } from 'react';
|
|
3
3
|
|
|
4
|
+
type ButtonElement = HTMLButtonElement | HTMLAnchorElement;
|
|
4
5
|
interface ButtonProps {
|
|
5
|
-
type?:
|
|
6
|
+
type?: 'button' | 'submit' | 'reset';
|
|
6
7
|
theme?: ButtonTheme | null;
|
|
7
8
|
size?: ButtonSize | null;
|
|
8
9
|
href?: string | null;
|
|
@@ -26,13 +27,12 @@ interface ButtonProps {
|
|
|
26
27
|
withoutTheme?: boolean;
|
|
27
28
|
outline?: boolean;
|
|
28
29
|
asLink?: boolean;
|
|
30
|
+
style?: CSSProperties;
|
|
29
31
|
className?: string | null;
|
|
30
32
|
iconClassName?: string | null;
|
|
31
33
|
labelClassName?: string | null;
|
|
32
|
-
onClick?:
|
|
33
|
-
refButton?:
|
|
34
|
-
current?: unknown;
|
|
35
|
-
}) | null;
|
|
34
|
+
onClick?: MouseEventHandler<ButtonElement> | null;
|
|
35
|
+
refButton?: ForwardedRef<ButtonElement> | null;
|
|
36
36
|
}
|
|
37
37
|
declare function Button$2({ 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, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
38
38
|
|
package/es/components.js
CHANGED
|
@@ -158,12 +158,12 @@ function Button$1(_ref) {
|
|
|
158
158
|
disabled: disabled
|
|
159
159
|
}, styles$y.linkDisabled, disabled)]);
|
|
160
160
|
return external || direct ? /*#__PURE__*/jsx("a", _objectSpread(_objectSpread({}, props), {}, {
|
|
161
|
-
href: disabled ?
|
|
161
|
+
href: !disabled ? href : undefined,
|
|
162
162
|
className: linkClassNames,
|
|
163
163
|
onClick: onClick,
|
|
164
|
-
target: external ? target :
|
|
164
|
+
target: external ? target : undefined,
|
|
165
165
|
ref: refButton,
|
|
166
|
-
tabIndex: focusable ?
|
|
166
|
+
tabIndex: !focusable ? -1 : undefined,
|
|
167
167
|
children: content
|
|
168
168
|
})) : /*#__PURE__*/jsx(Link$1, {
|
|
169
169
|
href: href,
|
|
@@ -180,7 +180,7 @@ function Button$1(_ref) {
|
|
|
180
180
|
onClick: onClick,
|
|
181
181
|
disabled: disabled || disableOnLoading && loading,
|
|
182
182
|
ref: refButton,
|
|
183
|
-
tabIndex: focusable ?
|
|
183
|
+
tabIndex: !focusable ? -1 : undefined,
|
|
184
184
|
children: content
|
|
185
185
|
}));
|
|
186
186
|
}
|
package/es/contexts.d.ts
CHANGED
|
@@ -285,13 +285,8 @@ interface FieldContextProviderProps {
|
|
|
285
285
|
declare function FieldContextProvider({ context, children }: FieldContextProviderProps): react_jsx_runtime.JSX.Element;
|
|
286
286
|
|
|
287
287
|
declare const FontsContext: any;
|
|
288
|
-
declare const useGoogleFonts: (
|
|
289
|
-
|
|
290
|
-
setFonts?: any;
|
|
291
|
-
}) => any;
|
|
292
|
-
declare const useFonts: ({ withoutGoogleFonts }?: {
|
|
293
|
-
withoutGoogleFonts?: boolean;
|
|
294
|
-
}) => {
|
|
288
|
+
declare const useGoogleFonts: (options?: any) => any;
|
|
289
|
+
declare const useFonts: (options?: any) => {
|
|
295
290
|
systemFonts: any;
|
|
296
291
|
googleFonts: any;
|
|
297
292
|
customFonts: any;
|
|
@@ -359,14 +354,42 @@ interface PanelsProviderProps {
|
|
|
359
354
|
}
|
|
360
355
|
declare function PanelsProvider({ children, container: initialContainer }: PanelsProviderProps): react_jsx_runtime.JSX.Element;
|
|
361
356
|
|
|
362
|
-
|
|
363
|
-
|
|
357
|
+
interface PlaybackControlsTheme {
|
|
358
|
+
seekBarOnly?: boolean;
|
|
359
|
+
color?: unknown;
|
|
360
|
+
progressColor?: unknown;
|
|
361
|
+
}
|
|
362
|
+
type MediaElement = HTMLVideoElement | HTMLAudioElement | HTMLMediaElement;
|
|
363
|
+
interface PlaybackContext {
|
|
364
|
+
playing: boolean;
|
|
365
|
+
completed: boolean;
|
|
366
|
+
muted: boolean;
|
|
367
|
+
controls: boolean;
|
|
368
|
+
controlsSuggestPlay: boolean;
|
|
369
|
+
controlsVisible: boolean;
|
|
370
|
+
media: MediaElement | null;
|
|
371
|
+
hasAudio: boolean | null;
|
|
372
|
+
controlsTheme: PlaybackControlsTheme | null;
|
|
373
|
+
currentQualityLevel: number | null;
|
|
374
|
+
setMuted: (muted: boolean) => void;
|
|
375
|
+
setPlaying: (playing: boolean) => void;
|
|
376
|
+
setControls: (hasControls: boolean) => void;
|
|
377
|
+
setControlsVisible: (visible: boolean) => void;
|
|
378
|
+
setControlsTheme: (theme: PlaybackControlsTheme | null) => void;
|
|
379
|
+
showControls: () => void;
|
|
380
|
+
hideControls: () => void;
|
|
381
|
+
setMedia: (media: MediaElement | null) => void;
|
|
382
|
+
setCurrentQualityLevel: (qualityLevel: number | null, fromRef?: MediaElement | null) => void;
|
|
383
|
+
setIsBackground: (isBackground: boolean) => void;
|
|
384
|
+
}
|
|
385
|
+
declare const PlaybackContext: React.Context<PlaybackContext>;
|
|
386
|
+
declare const usePlaybackContext: () => PlaybackContext;
|
|
364
387
|
declare const usePlaybackMediaRef: (active?: boolean, background?: boolean, updateKey?: any) => {
|
|
365
388
|
ref: React.RefObject<HTMLMediaElement>;
|
|
366
389
|
isCurrent: boolean;
|
|
367
390
|
};
|
|
368
391
|
interface PlaybackProviderProps {
|
|
369
|
-
children:
|
|
392
|
+
children: ReactNode;
|
|
370
393
|
controls?: boolean;
|
|
371
394
|
controlsSuggestPlay?: boolean;
|
|
372
395
|
controlsVisible?: boolean;
|
|
@@ -378,7 +401,7 @@ interface PlaybackProviderProps {
|
|
|
378
401
|
muted?: boolean;
|
|
379
402
|
playing?: boolean;
|
|
380
403
|
paused?: boolean;
|
|
381
|
-
currentQualityLevel?: number;
|
|
404
|
+
currentQualityLevel?: number | null;
|
|
382
405
|
}
|
|
383
406
|
declare function PlaybackProvider({ muted: initialMuted, playing: initialPlaying, paused, controls: initialControls, controlsSuggestPlay: initialControlsSuggestPlay, controlsVisible: initialControlsVisible, controlsTheme: initialControlsTheme, currentQualityLevel: initialCurrentQualityLevel, children, }: PlaybackProviderProps): react_jsx_runtime.JSX.Element;
|
|
384
407
|
|
|
@@ -446,13 +469,7 @@ interface StoryProviderProps {
|
|
|
446
469
|
declare function StoryProvider({ story, children }: StoryProviderProps): react_jsx_runtime.JSX.Element;
|
|
447
470
|
|
|
448
471
|
declare const useTracking: () => unknown;
|
|
449
|
-
|
|
450
|
-
children: React__default.ReactNode;
|
|
451
|
-
variables?: TrackingVariables;
|
|
452
|
-
disabled?: boolean;
|
|
453
|
-
paused?: boolean;
|
|
454
|
-
}
|
|
455
|
-
declare function TrackingProvider({ variables, disabled, paused, children }: TrackingProviderProps): react_jsx_runtime.JSX.Element;
|
|
472
|
+
declare function TrackingProvider(options?: any): react_jsx_runtime.JSX.Element;
|
|
456
473
|
|
|
457
474
|
declare const ViewerContext: any;
|
|
458
475
|
declare const useViewerContext: () => unknown;
|
package/es/contexts.js
CHANGED
|
@@ -640,7 +640,8 @@ var FontsContext = /*#__PURE__*/React.createContext({
|
|
|
640
640
|
customFonts: null
|
|
641
641
|
});
|
|
642
642
|
var useGoogleFonts = function useGoogleFonts() {
|
|
643
|
-
var
|
|
643
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
644
|
+
var _ref = options || {},
|
|
644
645
|
_ref$disabled = _ref.disabled,
|
|
645
646
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
646
647
|
_ref$setFonts = _ref.setFonts,
|
|
@@ -680,7 +681,8 @@ var useGoogleFonts = function useGoogleFonts() {
|
|
|
680
681
|
return googleFonts;
|
|
681
682
|
};
|
|
682
683
|
var useFonts = function useFonts() {
|
|
683
|
-
var
|
|
684
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
685
|
+
var _ref3 = options || {},
|
|
684
686
|
_ref3$withoutGoogleFo = _ref3.withoutGoogleFonts,
|
|
685
687
|
withoutGoogleFonts = _ref3$withoutGoogleFo === void 0 ? false : _ref3$withoutGoogleFo;
|
|
686
688
|
var _useContext = useContext(FontsContext),
|
|
@@ -1009,30 +1011,28 @@ var defaultControlsThemeValue = {
|
|
|
1009
1011
|
color: null,
|
|
1010
1012
|
progressColor: null
|
|
1011
1013
|
};
|
|
1012
|
-
var
|
|
1014
|
+
var PlaybackContext = /*#__PURE__*/createContext({
|
|
1013
1015
|
playing: false,
|
|
1014
|
-
paused: false,
|
|
1015
1016
|
completed: false,
|
|
1016
1017
|
muted: true,
|
|
1017
1018
|
controls: false,
|
|
1018
1019
|
controlsSuggestPlay: false,
|
|
1019
1020
|
controlsVisible: false,
|
|
1021
|
+
hasAudio: false,
|
|
1020
1022
|
media: null,
|
|
1021
1023
|
controlsTheme: defaultControlsThemeValue,
|
|
1022
|
-
currentQualityLevel: null
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
setControlsVisible: function setControlsVisible() {},
|
|
1029
|
-
setControlsTheme: function setControlsTheme() {},
|
|
1024
|
+
currentQualityLevel: null,
|
|
1025
|
+
setMuted: function setMuted(muted) {},
|
|
1026
|
+
setPlaying: function setPlaying(playing) {},
|
|
1027
|
+
setControls: function setControls(hasControls) {},
|
|
1028
|
+
setControlsVisible: function setControlsVisible(visible) {},
|
|
1029
|
+
setControlsTheme: function setControlsTheme(theme) {},
|
|
1030
1030
|
showControls: function showControls() {},
|
|
1031
1031
|
hideControls: function hideControls() {},
|
|
1032
|
-
setMedia: function setMedia() {},
|
|
1033
|
-
setCurrentQualityLevel: function setCurrentQualityLevel() {},
|
|
1034
|
-
setIsBackground: function setIsBackground() {}
|
|
1035
|
-
})
|
|
1032
|
+
setMedia: function setMedia(media) {},
|
|
1033
|
+
setCurrentQualityLevel: function setCurrentQualityLevel(qualityLevel, fromRef) {},
|
|
1034
|
+
setIsBackground: function setIsBackground(isBackground) {}
|
|
1035
|
+
});
|
|
1036
1036
|
var usePlaybackContext = function usePlaybackContext() {
|
|
1037
1037
|
return useContext(PlaybackContext);
|
|
1038
1038
|
};
|
|
@@ -1043,29 +1043,35 @@ var usePlaybackMediaRef = function usePlaybackMediaRef() {
|
|
|
1043
1043
|
var _usePlaybackContext = usePlaybackContext(),
|
|
1044
1044
|
setMedia = _usePlaybackContext.setMedia,
|
|
1045
1045
|
setIsBackground = _usePlaybackContext.setIsBackground,
|
|
1046
|
-
media = _usePlaybackContext.media
|
|
1046
|
+
media = _usePlaybackContext.media,
|
|
1047
|
+
isBackground = _usePlaybackContext.isBackground;
|
|
1047
1048
|
var mediaRef = useRef(null);
|
|
1048
1049
|
|
|
1049
1050
|
// Cleanup: clear media registration when this screen deactivates or unmounts.
|
|
1050
1051
|
// Note: we cannot check mediaRef.current here because React clears callback refs
|
|
1051
1052
|
// before running effect cleanups, so mediaRef.current is always null at this point.
|
|
1052
1053
|
useEffect(function () {
|
|
1054
|
+
var currentMedia = mediaRef.current;
|
|
1053
1055
|
return function () {
|
|
1054
1056
|
if (active) {
|
|
1057
|
+
var playing = currentMedia !== null && !!(currentMedia.currentTime > 0 && !currentMedia.paused && !currentMedia.ended && currentMedia.readyState > 2);
|
|
1055
1058
|
setMedia(null);
|
|
1056
1059
|
setIsBackground(false);
|
|
1060
|
+
if (playing) {
|
|
1061
|
+
currentMedia.pause();
|
|
1062
|
+
}
|
|
1057
1063
|
}
|
|
1058
1064
|
};
|
|
1059
1065
|
}, [active, setMedia, setIsBackground, updateKey]);
|
|
1060
1066
|
|
|
1061
1067
|
// Register media with context when active and no media is registered
|
|
1062
1068
|
useEffect(function () {
|
|
1063
|
-
if (!active || mediaRef.current === null || media
|
|
1069
|
+
if (!active || mediaRef.current === null || mediaRef.current === media && background === isBackground) {
|
|
1064
1070
|
return;
|
|
1065
1071
|
}
|
|
1066
1072
|
setIsBackground(background);
|
|
1067
1073
|
setMedia(mediaRef.current);
|
|
1068
|
-
}, [active, background, media, updateKey, setMedia, setIsBackground]);
|
|
1074
|
+
}, [active, background, media, updateKey, setMedia, setIsBackground, isBackground]);
|
|
1069
1075
|
return {
|
|
1070
1076
|
ref: mediaRef,
|
|
1071
1077
|
isCurrent: mediaRef.current === media
|
|
@@ -1389,14 +1395,17 @@ function ScreenSizeProvider(_ref) {
|
|
|
1389
1395
|
var useTracking = function useTracking() {
|
|
1390
1396
|
return useContext(TrackingContext);
|
|
1391
1397
|
};
|
|
1392
|
-
function TrackingProvider(
|
|
1393
|
-
var
|
|
1398
|
+
function TrackingProvider() {
|
|
1399
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
1400
|
+
var _ref = options || {},
|
|
1401
|
+
_ref$variables = _ref.variables,
|
|
1394
1402
|
variables = _ref$variables === void 0 ? null : _ref$variables,
|
|
1395
1403
|
_ref$disabled = _ref.disabled,
|
|
1396
1404
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
1397
1405
|
_ref$paused = _ref.paused,
|
|
1398
1406
|
paused = _ref$paused === void 0 ? false : _ref$paused,
|
|
1399
|
-
children = _ref.children
|
|
1407
|
+
_ref$children = _ref.children,
|
|
1408
|
+
children = _ref$children === void 0 ? null : _ref$children;
|
|
1400
1409
|
var contextTracking = useTracking() || null;
|
|
1401
1410
|
var refTracking = useRef(null);
|
|
1402
1411
|
var tracking = useMemo(function () {
|
package/es/hooks.d.ts
CHANGED
|
@@ -15,15 +15,8 @@ declare const useAnimationFrame: (onFrame: any, { disabled }?: {
|
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
}) => void;
|
|
17
17
|
|
|
18
|
-
declare const useFormattedDate: (
|
|
19
|
-
|
|
20
|
-
showToday?: boolean;
|
|
21
|
-
}) => (date: any) => string;
|
|
22
|
-
declare const useFormattedTime: ({ format, showNow, timeGap }?: {
|
|
23
|
-
format?: any;
|
|
24
|
-
showNow?: boolean;
|
|
25
|
-
timeGap?: number;
|
|
26
|
-
}) => (date: any) => string;
|
|
18
|
+
declare const useFormattedDate: (options?: any) => (date: any) => string;
|
|
19
|
+
declare const useFormattedTime: (options?: any) => (date: any) => string;
|
|
27
20
|
|
|
28
21
|
declare const useDebounced: (handler: any, watchedValue: any, delay?: number) => void;
|
|
29
22
|
|
|
@@ -53,7 +46,25 @@ declare function useDragProgress({ progress: wantedProgress, onTap, disabled, dr
|
|
|
53
46
|
declare const useForm: ({ fields: providedFields, injectInFields, ...opts }?: {
|
|
54
47
|
fields?: any[];
|
|
55
48
|
injectInFields?: boolean;
|
|
56
|
-
}) =>
|
|
49
|
+
}) => {
|
|
50
|
+
fields: any[];
|
|
51
|
+
status: any;
|
|
52
|
+
response: unknown;
|
|
53
|
+
errors: Record<string, string | string[]>;
|
|
54
|
+
generalError: string;
|
|
55
|
+
success: boolean;
|
|
56
|
+
loading: boolean;
|
|
57
|
+
error: boolean;
|
|
58
|
+
value: Record<string, unknown>;
|
|
59
|
+
setValue: (value: Record<string, unknown>) => void;
|
|
60
|
+
setErrors: (errors: Record<string, string | string[]>) => void;
|
|
61
|
+
setGeneralError: (error: string | null) => void;
|
|
62
|
+
csrfToken: string;
|
|
63
|
+
submit: (submitValue?: Record<string, unknown>) => void;
|
|
64
|
+
onSubmit: (e: {
|
|
65
|
+
preventDefault: () => void;
|
|
66
|
+
}) => void;
|
|
67
|
+
};
|
|
57
68
|
|
|
58
69
|
declare const useFormTransition: (initialPaths?: any, initialStyles?: {}) => {
|
|
59
70
|
direction: string;
|
|
@@ -167,9 +178,7 @@ declare function useMediaLoad(element: any, { preload, shouldLoad }?: {
|
|
|
167
178
|
shouldLoad?: boolean;
|
|
168
179
|
}): void;
|
|
169
180
|
|
|
170
|
-
declare function useMediaProgress(media
|
|
171
|
-
disabled?: boolean;
|
|
172
|
-
}): number;
|
|
181
|
+
declare function useMediaProgress(media?: any, options?: any): number;
|
|
173
182
|
|
|
174
183
|
declare function useMediaReady(element: any, { id }?: {
|
|
175
184
|
id?: any;
|
|
@@ -220,9 +229,9 @@ declare function useMediaWaveform(media: any, { fake, reduceBufferFactor }?: {
|
|
|
220
229
|
}): any;
|
|
221
230
|
|
|
222
231
|
declare const getObserver: (Observer: any, options?: {}) => any;
|
|
223
|
-
declare const useObserver: (Observer: any, opts?:
|
|
232
|
+
declare const useObserver: (Observer: any, opts?: any, initialEntry?: any) => {
|
|
224
233
|
ref: react.RefObject<any>;
|
|
225
|
-
entry:
|
|
234
|
+
entry: any;
|
|
226
235
|
};
|
|
227
236
|
declare const useIntersectionObserver: ({ root, rootMargin, threshold, disabled, }?: {
|
|
228
237
|
root?: any;
|
|
@@ -231,16 +240,14 @@ declare const useIntersectionObserver: ({ root, rootMargin, threshold, disabled,
|
|
|
231
240
|
disabled?: boolean;
|
|
232
241
|
}) => {
|
|
233
242
|
ref: react.RefObject<any>;
|
|
234
|
-
entry:
|
|
243
|
+
entry: any;
|
|
235
244
|
};
|
|
236
|
-
declare const useResizeObserver: (
|
|
237
|
-
disabled?: boolean;
|
|
238
|
-
}) => {
|
|
245
|
+
declare const useResizeObserver: (options?: any) => {
|
|
239
246
|
ref: react.RefObject<any>;
|
|
240
|
-
entry:
|
|
247
|
+
entry: any;
|
|
241
248
|
};
|
|
242
249
|
declare const useDimensionObserver: (...args: any[]) => {
|
|
243
|
-
entry:
|
|
250
|
+
entry: any;
|
|
244
251
|
width: any;
|
|
245
252
|
height: any;
|
|
246
253
|
ref: react.RefObject<any>;
|
|
@@ -270,10 +277,7 @@ declare function useProgressSteps({ disabled, currentTime, duration, onStep, ste
|
|
|
270
277
|
}): void;
|
|
271
278
|
|
|
272
279
|
declare const useDevicePixelRatio: () => number;
|
|
273
|
-
declare const useScreenSizeFromElement: (
|
|
274
|
-
width?: any;
|
|
275
|
-
height?: any;
|
|
276
|
-
}) => {
|
|
280
|
+
declare const useScreenSizeFromElement: (options?: any) => {
|
|
277
281
|
ref: react.RefObject<any>;
|
|
278
282
|
fullWidth: any;
|
|
279
283
|
fullHeight: any;
|
package/es/hooks.js
CHANGED
|
@@ -20,8 +20,8 @@ import { useScreensManager, useFieldsManager, useTracking, useScreen } from '@mi
|
|
|
20
20
|
import isEmpty from 'lodash/isEmpty';
|
|
21
21
|
import { useWindowSize } from '@folklore/hooks';
|
|
22
22
|
import { match } from 'css-mediaquery';
|
|
23
|
-
import { useIntl } from 'react-intl';
|
|
24
23
|
import dayjs from 'dayjs';
|
|
24
|
+
import { useIntl } from 'react-intl';
|
|
25
25
|
import clamp from 'lodash/clamp';
|
|
26
26
|
|
|
27
27
|
function useActivityDetector() {
|
|
@@ -120,7 +120,8 @@ var useAnimationFrame = function useAnimationFrame(onFrame) {
|
|
|
120
120
|
};
|
|
121
121
|
|
|
122
122
|
var useFormattedDate = function useFormattedDate() {
|
|
123
|
-
var
|
|
123
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
124
|
+
var _ref = options || {},
|
|
124
125
|
_ref$format = _ref.format,
|
|
125
126
|
format = _ref$format === void 0 ? null : _ref$format,
|
|
126
127
|
_ref$showToday = _ref.showToday,
|
|
@@ -146,7 +147,8 @@ var useFormattedDate = function useFormattedDate() {
|
|
|
146
147
|
}, [today, showToday, format]);
|
|
147
148
|
};
|
|
148
149
|
var useFormattedTime = function useFormattedTime() {
|
|
149
|
-
var
|
|
150
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
151
|
+
var _ref2 = options || {},
|
|
150
152
|
_ref2$format = _ref2.format,
|
|
151
153
|
format = _ref2$format === void 0 ? null : _ref2$format,
|
|
152
154
|
_ref2$showNow = _ref2.showNow,
|
|
@@ -529,16 +531,17 @@ var getObserver = function getObserver(Observer) {
|
|
|
529
531
|
return observers[observerKey];
|
|
530
532
|
};
|
|
531
533
|
var useObserver = function useObserver(Observer) {
|
|
532
|
-
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
533
|
-
var initialEntry = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] :
|
|
534
|
-
var
|
|
535
|
-
root =
|
|
536
|
-
|
|
537
|
-
rootMargin =
|
|
538
|
-
|
|
539
|
-
threshold =
|
|
540
|
-
|
|
541
|
-
disabled =
|
|
534
|
+
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
535
|
+
var initialEntry = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
536
|
+
var _ref3 = opts || {},
|
|
537
|
+
_ref3$root = _ref3.root,
|
|
538
|
+
root = _ref3$root === void 0 ? null : _ref3$root,
|
|
539
|
+
_ref3$rootMargin = _ref3.rootMargin,
|
|
540
|
+
rootMargin = _ref3$rootMargin === void 0 ? null : _ref3$rootMargin,
|
|
541
|
+
_ref3$threshold = _ref3.threshold,
|
|
542
|
+
threshold = _ref3$threshold === void 0 ? null : _ref3$threshold,
|
|
543
|
+
_ref3$disabled = _ref3.disabled,
|
|
544
|
+
disabled = _ref3$disabled === void 0 ? false : _ref3$disabled;
|
|
542
545
|
var _useState = useState(initialEntry),
|
|
543
546
|
_useState2 = _slicedToArray(_useState, 2),
|
|
544
547
|
entry = _useState2[0],
|
|
@@ -607,15 +610,15 @@ var intersectionObserverInitialEntry = {
|
|
|
607
610
|
rootBounds: null
|
|
608
611
|
};
|
|
609
612
|
var useIntersectionObserver = function useIntersectionObserver() {
|
|
610
|
-
var
|
|
611
|
-
|
|
612
|
-
root =
|
|
613
|
-
|
|
614
|
-
rootMargin =
|
|
615
|
-
|
|
616
|
-
threshold =
|
|
617
|
-
|
|
618
|
-
disabled =
|
|
613
|
+
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
614
|
+
_ref4$root = _ref4.root,
|
|
615
|
+
root = _ref4$root === void 0 ? null : _ref4$root,
|
|
616
|
+
_ref4$rootMargin = _ref4.rootMargin,
|
|
617
|
+
rootMargin = _ref4$rootMargin === void 0 ? '0px' : _ref4$rootMargin,
|
|
618
|
+
_ref4$threshold = _ref4.threshold,
|
|
619
|
+
threshold = _ref4$threshold === void 0 ? thresholdArray : _ref4$threshold,
|
|
620
|
+
_ref4$disabled = _ref4.disabled,
|
|
621
|
+
disabled = _ref4$disabled === void 0 ? false : _ref4$disabled;
|
|
619
622
|
return useObserver(typeof window !== 'undefined' ? IntersectionObserver : null, {
|
|
620
623
|
root: root,
|
|
621
624
|
rootMargin: rootMargin,
|
|
@@ -634,9 +637,10 @@ var resizeObserverInitialEntry = {
|
|
|
634
637
|
borderBoxSize: null
|
|
635
638
|
};
|
|
636
639
|
var useResizeObserver = function useResizeObserver() {
|
|
637
|
-
var
|
|
638
|
-
|
|
639
|
-
disabled =
|
|
640
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
641
|
+
var _ref5 = options || {},
|
|
642
|
+
_ref5$disabled = _ref5.disabled,
|
|
643
|
+
disabled = _ref5$disabled === void 0 ? false : _ref5$disabled;
|
|
640
644
|
return useObserver(typeof window !== 'undefined' ? ResizeObserver : null, {
|
|
641
645
|
disabled: disabled
|
|
642
646
|
}, resizeObserverInitialEntry);
|
|
@@ -645,21 +649,21 @@ var useDimensionObserver = function useDimensionObserver() {
|
|
|
645
649
|
var _useResizeObserver = useResizeObserver.apply(void 0, arguments),
|
|
646
650
|
entry = _useResizeObserver.entry,
|
|
647
651
|
rest = _objectWithoutProperties(_useResizeObserver, _excluded$2);
|
|
648
|
-
var
|
|
649
|
-
|
|
650
|
-
contentRect =
|
|
651
|
-
|
|
652
|
-
borderBoxSize =
|
|
653
|
-
var
|
|
654
|
-
|
|
655
|
-
width =
|
|
656
|
-
|
|
657
|
-
height =
|
|
658
|
-
var
|
|
659
|
-
|
|
660
|
-
blockSize =
|
|
661
|
-
|
|
662
|
-
inlineSize =
|
|
652
|
+
var _ref6 = entry || {},
|
|
653
|
+
_ref6$contentRect = _ref6.contentRect,
|
|
654
|
+
contentRect = _ref6$contentRect === void 0 ? null : _ref6$contentRect,
|
|
655
|
+
_ref6$borderBoxSize = _ref6.borderBoxSize,
|
|
656
|
+
borderBoxSize = _ref6$borderBoxSize === void 0 ? null : _ref6$borderBoxSize;
|
|
657
|
+
var _ref7 = contentRect || {},
|
|
658
|
+
_ref7$width = _ref7.width,
|
|
659
|
+
width = _ref7$width === void 0 ? 0 : _ref7$width,
|
|
660
|
+
_ref7$height = _ref7.height,
|
|
661
|
+
height = _ref7$height === void 0 ? 0 : _ref7$height;
|
|
662
|
+
var _ref8 = isArray(borderBoxSize) ? borderBoxSize[0] || {} : borderBoxSize || {},
|
|
663
|
+
_ref8$blockSize = _ref8.blockSize,
|
|
664
|
+
blockSize = _ref8$blockSize === void 0 ? null : _ref8$blockSize,
|
|
665
|
+
_ref8$inlineSize = _ref8.inlineSize,
|
|
666
|
+
inlineSize = _ref8$inlineSize === void 0 ? null : _ref8$inlineSize;
|
|
663
667
|
return _objectSpread(_objectSpread({}, rest), {}, {
|
|
664
668
|
entry: entry,
|
|
665
669
|
width: inlineSize || width,
|
|
@@ -1640,8 +1644,10 @@ function useMediaLoad(element) {
|
|
|
1640
1644
|
}
|
|
1641
1645
|
|
|
1642
1646
|
var _excluded$1 = ["disabled"];
|
|
1643
|
-
function useMediaProgress(
|
|
1644
|
-
var
|
|
1647
|
+
function useMediaProgress() {
|
|
1648
|
+
var media = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
1649
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1650
|
+
var _ref = options || {},
|
|
1645
1651
|
_ref$disabled = _ref.disabled,
|
|
1646
1652
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
1647
1653
|
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
@@ -2056,7 +2062,8 @@ var useScreenSize = function useScreenSize(_ref) {
|
|
|
2056
2062
|
return screenSize;
|
|
2057
2063
|
};
|
|
2058
2064
|
var useScreenSizeFromElement = function useScreenSizeFromElement() {
|
|
2059
|
-
var
|
|
2065
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
2066
|
+
var _ref4 = options || {},
|
|
2060
2067
|
_ref4$width = _ref4.width,
|
|
2061
2068
|
width = _ref4$width === void 0 ? null : _ref4$width,
|
|
2062
2069
|
_ref4$height = _ref4.height,
|
package/lib/components.js
CHANGED
|
@@ -160,12 +160,12 @@ function Button$1(_ref) {
|
|
|
160
160
|
disabled: disabled
|
|
161
161
|
}, styles$y.linkDisabled, disabled)]);
|
|
162
162
|
return external || direct ? /*#__PURE__*/jsxRuntime.jsx("a", _objectSpread(_objectSpread({}, props), {}, {
|
|
163
|
-
href: disabled ?
|
|
163
|
+
href: !disabled ? href : undefined,
|
|
164
164
|
className: linkClassNames,
|
|
165
165
|
onClick: onClick,
|
|
166
|
-
target: external ? target :
|
|
166
|
+
target: external ? target : undefined,
|
|
167
167
|
ref: refButton,
|
|
168
|
-
tabIndex: focusable ?
|
|
168
|
+
tabIndex: !focusable ? -1 : undefined,
|
|
169
169
|
children: content
|
|
170
170
|
})) : /*#__PURE__*/jsxRuntime.jsx(wouter.Link, {
|
|
171
171
|
href: href,
|
|
@@ -182,7 +182,7 @@ function Button$1(_ref) {
|
|
|
182
182
|
onClick: onClick,
|
|
183
183
|
disabled: disabled || disableOnLoading && loading,
|
|
184
184
|
ref: refButton,
|
|
185
|
-
tabIndex: focusable ?
|
|
185
|
+
tabIndex: !focusable ? -1 : undefined,
|
|
186
186
|
children: content
|
|
187
187
|
}));
|
|
188
188
|
}
|