@jobber/components 6.86.0 → 6.86.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Autocomplete/index.cjs +6 -6
- package/dist/Autocomplete/index.mjs +11 -11
- package/dist/Banner-cjs.js +1 -1
- package/dist/Banner-es.js +1 -1
- package/dist/Chip-cjs.js +2 -2
- package/dist/Chip-es.js +3 -3
- package/dist/Combobox-cjs.js +1 -1
- package/dist/Combobox-es.js +2 -2
- package/dist/ComboboxContent-cjs.js +2 -2
- package/dist/ComboboxContent-es.js +5 -5
- package/dist/ComboboxLoadMore-cjs.js +1 -1
- package/dist/ComboboxLoadMore-es.js +2 -2
- package/dist/ConfirmationModal-cjs.js +1 -1
- package/dist/ConfirmationModal-es.js +2 -2
- package/dist/ContentBlock-cjs.js +1 -1
- package/dist/ContentBlock-es.js +2 -2
- package/dist/DataListActionsMenu-cjs.js +4 -4
- package/dist/DataListActionsMenu-es.js +8 -8
- package/dist/DataListHeaderTile-cjs.js +1 -1
- package/dist/DataListHeaderTile-es.js +2 -2
- package/dist/DataListLoadMore-cjs.js +1 -1
- package/dist/DataListLoadMore-es.js +2 -2
- package/dist/DataListOverflowFade-cjs.js +2 -2
- package/dist/DataListOverflowFade-es.js +3 -3
- package/dist/DataListSearch-cjs.js +1 -1
- package/dist/DataListSearch-es.js +2 -2
- package/dist/DataListSortingOptions-cjs.js +2 -2
- package/dist/DataListSortingOptions-es.js +4 -4
- package/dist/DataTable/test-utilities/index.cjs +1 -1
- package/dist/DataTable/test-utilities/index.mjs +1 -1
- package/dist/DataTable-cjs.js +3 -3
- package/dist/DataTable-es.js +4 -4
- package/dist/DatePicker-cjs.js +1 -1
- package/dist/DatePicker-es.js +2 -2
- package/dist/Disclosure-cjs.js +2 -2
- package/dist/Disclosure-es.js +3 -3
- package/dist/FormField-cjs.js +1 -5
- package/dist/FormField-es.js +1 -5
- package/dist/InputText/InputText.d.ts +2 -2
- package/dist/InputText/index.cjs +2 -2
- package/dist/InputText/index.mjs +3 -3
- package/dist/LightBox-cjs.js +51 -67
- package/dist/LightBox-es.js +57 -73
- package/dist/Menu-cjs.js +6 -11
- package/dist/Menu-es.js +11 -16
- package/dist/Modal/index.cjs +3 -3
- package/dist/Modal/index.mjs +7 -7
- package/dist/Page-cjs.js +4 -4
- package/dist/Page-es.js +5 -5
- package/dist/Popover-cjs.js +1 -1
- package/dist/Popover-es.js +3 -3
- package/dist/SideDrawer-cjs.js +6 -6
- package/dist/SideDrawer-es.js +10 -10
- package/dist/Tooltip-cjs.js +2 -2
- package/dist/Tooltip-es.js +5 -5
- package/dist/floating-ui.react-es.js +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +5 -5
- package/dist/styles.css +27 -6
- package/dist/throttle-cjs.js +0 -1
- package/dist/throttle-es.js +1 -1
- package/dist/useDebounce-cjs.js +69 -4381
- package/dist/useDebounce-es.js +71 -4383
- package/dist/useFocusTrap-cjs.js +3 -8
- package/dist/useFocusTrap-es.js +4 -9
- package/dist/useInView-cjs.js +5 -10
- package/dist/useInView-es.js +6 -11
- package/dist/useIsMounted-cjs.js +4 -19
- package/dist/useIsMounted-es.js +5 -20
- package/dist/useOnKeyDown-cjs.js +2 -7
- package/dist/useOnKeyDown-es.js +3 -8
- package/dist/useRefocusOnActivator-cjs.js +2 -7
- package/dist/useRefocusOnActivator-es.js +3 -8
- package/dist/useResizeObserver-cjs.js +64 -92
- package/dist/useResizeObserver-es.js +65 -94
- package/dist/useSafeLayoutEffect-cjs.js +3 -8
- package/dist/useSafeLayoutEffect-es.js +5 -10
- package/dist/useScrollToActive-cjs.js +4 -9
- package/dist/useScrollToActive-es.js +6 -11
- package/package.json +3 -3
package/dist/DatePicker-es.js
CHANGED
|
@@ -5,7 +5,7 @@ import './index-es.js';
|
|
|
5
5
|
import * as ReactDOM from 'react-dom';
|
|
6
6
|
import ReactDOM__default from 'react-dom';
|
|
7
7
|
import { g as getDefaultExportFromCjs } from './_commonjsHelpers-es.js';
|
|
8
|
-
import { u as
|
|
8
|
+
import { u as useRefocusOnActivator } from './useRefocusOnActivator-es.js';
|
|
9
9
|
import { T as Typography } from './Typography-es.js';
|
|
10
10
|
import { B as Button } from './Button-es.js';
|
|
11
11
|
import { o as omit } from './omit-es.js';
|
|
@@ -9759,7 +9759,7 @@ function DatePicker({ onChange, onMonthChange, activator, inline, selected, read
|
|
|
9759
9759
|
});
|
|
9760
9760
|
const { pickerRef } = useEscapeKeyToCloseDatePicker(open, ref);
|
|
9761
9761
|
if (smartAutofocus) {
|
|
9762
|
-
|
|
9762
|
+
useRefocusOnActivator(open);
|
|
9763
9763
|
useEffect(focusOnSelectedDate, [open]);
|
|
9764
9764
|
}
|
|
9765
9765
|
return (React__default.createElement("div", { className: wrapperClassName, ref: ref, "data-elevation": "elevated" },
|
package/dist/Disclosure-cjs.js
CHANGED
|
@@ -12,8 +12,8 @@ function Disclosure({ children, title, defaultOpen = false, onToggle, open, UNSA
|
|
|
12
12
|
var _a, _b, _c, _d;
|
|
13
13
|
const [internalOpen, setInternalOpen] = React.useState(defaultOpen || open || false);
|
|
14
14
|
const isOpen = open !== undefined ? open : internalOpen;
|
|
15
|
-
const [titleRef, { exactWidth }] = useResizeObserver.useResizeObserver
|
|
16
|
-
const isBelowBreakpoint = exactWidth && exactWidth < useResizeObserver.
|
|
15
|
+
const [titleRef, { exactWidth }] = useResizeObserver.useResizeObserver();
|
|
16
|
+
const isBelowBreakpoint = exactWidth && exactWidth < useResizeObserver.Breakpoints.small;
|
|
17
17
|
const isTitleString = typeof title === "string";
|
|
18
18
|
const containerClassNames = classnames(styles.details, UNSAFE_className.container);
|
|
19
19
|
const summaryClassNames = classnames(styles.summary, UNSAFE_className.summary);
|
package/dist/Disclosure-es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default, { useState } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
|
-
import { u as useResizeObserver } from './useResizeObserver-es.js';
|
|
3
|
+
import { u as useResizeObserver, B as Breakpoints } from './useResizeObserver-es.js';
|
|
4
4
|
import { I as Icon } from './Icon-es.js';
|
|
5
5
|
import { T as Typography } from './Typography-es.js';
|
|
6
6
|
|
|
@@ -10,8 +10,8 @@ function Disclosure({ children, title, defaultOpen = false, onToggle, open, UNSA
|
|
|
10
10
|
var _a, _b, _c, _d;
|
|
11
11
|
const [internalOpen, setInternalOpen] = useState(defaultOpen || open || false);
|
|
12
12
|
const isOpen = open !== undefined ? open : internalOpen;
|
|
13
|
-
const [titleRef, { exactWidth }] = useResizeObserver
|
|
14
|
-
const isBelowBreakpoint = exactWidth && exactWidth <
|
|
13
|
+
const [titleRef, { exactWidth }] = useResizeObserver();
|
|
14
|
+
const isBelowBreakpoint = exactWidth && exactWidth < Breakpoints.small;
|
|
15
15
|
const isTitleString = typeof title === "string";
|
|
16
16
|
const containerClassNames = classnames(styles.details, UNSAFE_className.container);
|
|
17
17
|
const summaryClassNames = classnames(styles.summary, UNSAFE_className.summary);
|
package/dist/FormField-cjs.js
CHANGED
|
@@ -13,10 +13,6 @@ var Spinner = require('./Spinner-cjs.js');
|
|
|
13
13
|
var tslib_es6 = require('./tslib.es6-cjs.js');
|
|
14
14
|
var reactHookForm = require('react-hook-form');
|
|
15
15
|
|
|
16
|
-
var useShowClear$1 = {};
|
|
17
|
-
|
|
18
|
-
Object.defineProperty(useShowClear$1, "__esModule", { value: true });
|
|
19
|
-
var useShowClear_2 = useShowClear$1.useShowClear = useShowClear;
|
|
20
16
|
function useShowClear({ clearable, multiline, focused, hasValue, readonly, disabled = false, }) {
|
|
21
17
|
if (multiline && clearable !== "never") {
|
|
22
18
|
throw new Error("Multiline inputs can not be clearable");
|
|
@@ -188,7 +184,7 @@ function FormFieldWrapper({ align, description, descriptionIdentifier, placehold
|
|
|
188
184
|
showMiniLabel,
|
|
189
185
|
});
|
|
190
186
|
const { focused } = useFormFieldFocus.useFormFieldFocus({ wrapperRef });
|
|
191
|
-
const showClear =
|
|
187
|
+
const showClear = useShowClear({
|
|
192
188
|
clearable,
|
|
193
189
|
multiline: type === "textarea",
|
|
194
190
|
focused,
|
package/dist/FormField-es.js
CHANGED
|
@@ -11,10 +11,6 @@ import { S as Spinner } from './Spinner-es.js';
|
|
|
11
11
|
import { _ as __rest } from './tslib.es6-es.js';
|
|
12
12
|
import { useFormContext, useForm, useController } from 'react-hook-form';
|
|
13
13
|
|
|
14
|
-
var useShowClear$1 = {};
|
|
15
|
-
|
|
16
|
-
Object.defineProperty(useShowClear$1, "__esModule", { value: true });
|
|
17
|
-
var useShowClear_2 = useShowClear$1.useShowClear = useShowClear;
|
|
18
14
|
function useShowClear({ clearable, multiline, focused, hasValue, readonly, disabled = false, }) {
|
|
19
15
|
if (multiline && clearable !== "never") {
|
|
20
16
|
throw new Error("Multiline inputs can not be clearable");
|
|
@@ -186,7 +182,7 @@ function FormFieldWrapper({ align, description, descriptionIdentifier, placehold
|
|
|
186
182
|
showMiniLabel,
|
|
187
183
|
});
|
|
188
184
|
const { focused } = useFormFieldFocus({ wrapperRef });
|
|
189
|
-
const showClear =
|
|
185
|
+
const showClear = useShowClear({
|
|
190
186
|
clearable,
|
|
191
187
|
multiline: type === "textarea",
|
|
192
188
|
focused,
|
|
@@ -17,7 +17,7 @@ export declare const InputText: React.ForwardRefExoticComponent<({
|
|
|
17
17
|
readonly placeholder?: string | undefined;
|
|
18
18
|
readonly size?: ("small" | "large") | undefined;
|
|
19
19
|
readonly value?: (string | number | Date) | undefined;
|
|
20
|
-
readonly clearable?: import("@jobber/hooks
|
|
20
|
+
readonly clearable?: import("@jobber/hooks").Clearable | undefined;
|
|
21
21
|
version?: 1 | undefined;
|
|
22
22
|
onFocus?: ((event?: React.FocusEvent) => void) | undefined;
|
|
23
23
|
onBlur?: ((event?: React.FocusEvent) => void) | undefined;
|
|
@@ -51,7 +51,7 @@ export declare const InputText: React.ForwardRefExoticComponent<({
|
|
|
51
51
|
readonly placeholder?: string | undefined;
|
|
52
52
|
readonly size?: ("small" | "large") | undefined;
|
|
53
53
|
readonly value?: (string | number | Date) | undefined;
|
|
54
|
-
readonly clearable?: import("@jobber/hooks
|
|
54
|
+
readonly clearable?: import("@jobber/hooks").Clearable | undefined;
|
|
55
55
|
version?: 1 | undefined;
|
|
56
56
|
onFocus?: ((event?: React.FocusEvent) => void) | undefined;
|
|
57
57
|
onBlur?: ((event?: React.FocusEvent) => void) | undefined;
|
package/dist/InputText/index.cjs
CHANGED
|
@@ -34,7 +34,7 @@ require('../_setToString-cjs.js');
|
|
|
34
34
|
*/
|
|
35
35
|
function useTextAreaResize({ rows, value, inputRef, wrapperRef, }) {
|
|
36
36
|
const rowRange = getRowRange(rows);
|
|
37
|
-
useSafeLayoutEffect.
|
|
37
|
+
useSafeLayoutEffect.useSafeLayoutEffect(() => {
|
|
38
38
|
if (inputRef &&
|
|
39
39
|
inputRef.current instanceof HTMLTextAreaElement &&
|
|
40
40
|
wrapperRef &&
|
|
@@ -45,7 +45,7 @@ function useTextAreaResize({ rows, value, inputRef, wrapperRef, }) {
|
|
|
45
45
|
// When the consumer passes a new controlled value, we need to recheck the size.
|
|
46
46
|
// The timeout ensures the DOM has a enough time to render the new text before
|
|
47
47
|
// we access the height.
|
|
48
|
-
useSafeLayoutEffect.
|
|
48
|
+
useSafeLayoutEffect.useSafeLayoutEffect(() => {
|
|
49
49
|
setTimeout(() => {
|
|
50
50
|
if (inputRef &&
|
|
51
51
|
inputRef.current instanceof HTMLTextAreaElement &&
|
package/dist/InputText/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React__default, { forwardRef, useRef, useImperativeHandle, useId } from 'react';
|
|
2
|
-
import { u as
|
|
2
|
+
import { u as useSafeLayoutEffect } from '../useSafeLayoutEffect-es.js';
|
|
3
3
|
import { k as FormField, s as styles, j as useFormFieldWrapperStyles, b as useAtlantisFormFieldName, f as FormFieldWrapper, l as FormFieldPostFix, m as mergeRefs } from '../FormField-es.js';
|
|
4
4
|
import 'classnames';
|
|
5
5
|
import { _ as __rest } from '../tslib.es6-es.js';
|
|
@@ -32,7 +32,7 @@ import '../_setToString-es.js';
|
|
|
32
32
|
*/
|
|
33
33
|
function useTextAreaResize({ rows, value, inputRef, wrapperRef, }) {
|
|
34
34
|
const rowRange = getRowRange(rows);
|
|
35
|
-
|
|
35
|
+
useSafeLayoutEffect(() => {
|
|
36
36
|
if (inputRef &&
|
|
37
37
|
inputRef.current instanceof HTMLTextAreaElement &&
|
|
38
38
|
wrapperRef &&
|
|
@@ -43,7 +43,7 @@ function useTextAreaResize({ rows, value, inputRef, wrapperRef, }) {
|
|
|
43
43
|
// When the consumer passes a new controlled value, we need to recheck the size.
|
|
44
44
|
// The timeout ensures the DOM has a enough time to render the new text before
|
|
45
45
|
// we access the height.
|
|
46
|
-
|
|
46
|
+
useSafeLayoutEffect(() => {
|
|
47
47
|
setTimeout(() => {
|
|
48
48
|
if (inputRef &&
|
|
49
49
|
inputRef.current instanceof HTMLTextAreaElement &&
|
package/dist/LightBox-cjs.js
CHANGED
|
@@ -15,63 +15,47 @@ var Button = require('./Button-cjs.js');
|
|
|
15
15
|
var Heading = require('./Heading-cjs.js');
|
|
16
16
|
var AtlantisThemeContext = require('./AtlantisThemeContext-cjs.js');
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
getSnapshot(query) {
|
|
36
|
-
return () => window.matchMedia(query).matches;
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
function useMediaQuery(query) {
|
|
40
|
-
const subscribeMediaQuery = (0, react_1.useCallback)((onChange) => exports.mediaQueryStore.subscribe(onChange, query), [query]);
|
|
41
|
-
const matches = (0, react_1.useSyncExternalStore)(subscribeMediaQuery, exports.mediaQueryStore.getSnapshot(query), () => true);
|
|
42
|
-
return matches;
|
|
43
|
-
}
|
|
44
|
-
} (useMediaQuery));
|
|
18
|
+
const mediaQueryStore = {
|
|
19
|
+
subscribe(onChange, query) {
|
|
20
|
+
const matchMedia = window.matchMedia(query);
|
|
21
|
+
matchMedia.addEventListener("change", onChange);
|
|
22
|
+
return () => {
|
|
23
|
+
matchMedia.removeEventListener("change", onChange);
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
getSnapshot(query) {
|
|
27
|
+
return () => window.matchMedia(query).matches;
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
function useMediaQuery(query) {
|
|
31
|
+
const subscribeMediaQuery = React.useCallback((onChange) => mediaQueryStore.subscribe(onChange, query), [query]);
|
|
32
|
+
const matches = React.useSyncExternalStore(subscribeMediaQuery, mediaQueryStore.getSnapshot(query), () => true);
|
|
33
|
+
return matches;
|
|
34
|
+
}
|
|
45
35
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
smallOnly: smallAndUp && !mediumAndUp,
|
|
70
|
-
mediumOnly: mediumAndUp && !largeAndUp,
|
|
71
|
-
largeOnly: largeAndUp && !extraLargeAndUp,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
} (useBreakpoints));
|
|
36
|
+
const BREAKPOINT_SIZES = { sm: 490, md: 768, lg: 1080, xl: 1440 };
|
|
37
|
+
/**
|
|
38
|
+
* Hook equivalent of CSS media queries with our
|
|
39
|
+
* [supported breakpoints](https://atlantis.getjobber.com/design/breakpoints).
|
|
40
|
+
*/
|
|
41
|
+
function useBreakpoints() {
|
|
42
|
+
const { sm, md, lg, xl } = BREAKPOINT_SIZES;
|
|
43
|
+
const extraSmallOnly = useMediaQuery(`(max-width: ${sm - 1}px)`);
|
|
44
|
+
const smallAndUp = useMediaQuery(`(min-width: ${sm}px)`);
|
|
45
|
+
const mediumAndUp = useMediaQuery(`(min-width: ${md}px)`);
|
|
46
|
+
const largeAndUp = useMediaQuery(`(min-width: ${lg}px)`);
|
|
47
|
+
const extraLargeAndUp = useMediaQuery(`(min-width: ${xl}px)`);
|
|
48
|
+
return {
|
|
49
|
+
smallAndUp,
|
|
50
|
+
mediumAndUp,
|
|
51
|
+
largeAndUp,
|
|
52
|
+
extraLargeAndUp,
|
|
53
|
+
extraSmallOnly,
|
|
54
|
+
smallOnly: smallAndUp && !mediumAndUp,
|
|
55
|
+
mediumOnly: mediumAndUp && !largeAndUp,
|
|
56
|
+
largeOnly: largeAndUp && !extraLargeAndUp,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
75
59
|
|
|
76
60
|
var styles = {"backgroundImage":"i9Tw1T65W-k-","next":"Q8amcRaTGf0-","prev":"W9FVb24yJrk-","buttonHidden":"nsN0TPWsBXI-","buttonVisible":"dkLYp7AD2jE-","lightboxWrapper":"_5p2iAj4JfoE-","toolbar":"rMK4cKdOxFw-","closeButton":"_0m6vb11DgiA-","slideNumber":"kCc68gGuTgg-","image":"yYFVVScosfQ-","imageArea":"UskuwLHR6fg-","captionWrapper":"OGjhge-r-U4-","title":"tZU2g-NYdIs-","blurOverlay":"GKIdLTmvcvQ-","thumbnailBar":"_3TfQLQEE3GQ-","thumbnailImage":"eBMzUOlcfQ4-","thumbnail":"eapm2zruLn8-","selected":"PeLn2u-QB0k-","spinning":"_8tDoqjgfLcw-"};
|
|
77
61
|
|
|
@@ -106,21 +90,21 @@ function LightBox({ boxSizing = "content-box", open, images, imageIndex = 0, onR
|
|
|
106
90
|
const [currentImageIndex, setCurrentImageIndex] = React.useState(imageIndex);
|
|
107
91
|
const [direction, setDirection] = React.useState(0);
|
|
108
92
|
const [mouseIsStationary, setMouseIsStationary] = React.useState(true);
|
|
109
|
-
const lightboxRef = useFocusTrap.
|
|
93
|
+
const lightboxRef = useFocusTrap.useFocusTrap(open);
|
|
110
94
|
const selectedThumbnailRef = React.useRef(null);
|
|
111
|
-
const debouncedHandleNext = useDebounce.
|
|
112
|
-
const debouncedHandlePrevious = useDebounce.
|
|
113
|
-
const mounted = useIsMounted.
|
|
95
|
+
const debouncedHandleNext = useDebounce.useDebounce(handleMoveNext, BUTTON_DEBOUNCE_DELAY);
|
|
96
|
+
const debouncedHandlePrevious = useDebounce.useDebounce(handleMovePrevious, BUTTON_DEBOUNCE_DELAY);
|
|
97
|
+
const mounted = useIsMounted.useIsMounted();
|
|
114
98
|
const prevOpen = React.useRef(open);
|
|
115
|
-
useRefocusOnActivator.
|
|
116
|
-
const handleMouseMovement = useDebounce.
|
|
99
|
+
useRefocusOnActivator.useRefocusOnActivator(open);
|
|
100
|
+
const handleMouseMovement = useDebounce.useDebounce(() => {
|
|
117
101
|
setMouseIsStationary(true);
|
|
118
102
|
}, MOVEMENT_DEBOUNCE_DELAY);
|
|
119
|
-
useOnKeyDown.
|
|
120
|
-
useOnKeyDown.
|
|
103
|
+
useOnKeyDown.useOnKeyDown(handleRequestClose, "Escape");
|
|
104
|
+
useOnKeyDown.useOnKeyDown(debouncedHandlePrevious, {
|
|
121
105
|
key: "ArrowLeft",
|
|
122
106
|
});
|
|
123
|
-
useOnKeyDown.
|
|
107
|
+
useOnKeyDown.useOnKeyDown(debouncedHandleNext, {
|
|
124
108
|
key: "ArrowRight",
|
|
125
109
|
});
|
|
126
110
|
React.useEffect(() => {
|
|
@@ -208,12 +192,12 @@ function LightBox({ boxSizing = "content-box", open, images, imageIndex = 0, onR
|
|
|
208
192
|
}
|
|
209
193
|
}
|
|
210
194
|
function PreviousButton({ onClick, hideButton }) {
|
|
211
|
-
const { mediumAndUp } = useBreakpoints
|
|
195
|
+
const { mediumAndUp } = useBreakpoints();
|
|
212
196
|
return (React.createElement("div", { className: `${styles.prev} ${hideButton ? styles.buttonHidden : styles.buttonVisible}` },
|
|
213
197
|
React.createElement(Button.Button, { size: mediumAndUp ? "large" : "small", variation: "subtle", type: "secondary", icon: "arrowLeft", ariaLabel: "Previous image", onClick: onClick })));
|
|
214
198
|
}
|
|
215
199
|
function NextButton({ onClick, hideButton }) {
|
|
216
|
-
const { mediumAndUp } = useBreakpoints
|
|
200
|
+
const { mediumAndUp } = useBreakpoints();
|
|
217
201
|
return (React.createElement("div", { className: `${styles.next} ${hideButton ? styles.buttonHidden : styles.buttonVisible}` },
|
|
218
202
|
React.createElement(Button.Button, { size: mediumAndUp ? "large" : "small", variation: "subtle", type: "secondary", icon: "arrowRight", ariaLabel: "Next image", onClick: onClick })));
|
|
219
203
|
}
|
package/dist/LightBox-es.js
CHANGED
|
@@ -1,75 +1,59 @@
|
|
|
1
|
-
import React__default, { useState, useRef, useEffect } from 'react';
|
|
1
|
+
import React__default, { useCallback, useSyncExternalStore, useState, useRef, useEffect } from 'react';
|
|
2
2
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
3
3
|
import ReactDOM__default from 'react-dom';
|
|
4
|
-
import { u as
|
|
5
|
-
import { u as
|
|
6
|
-
import { u as
|
|
7
|
-
import { u as
|
|
4
|
+
import { u as useRefocusOnActivator } from './useRefocusOnActivator-es.js';
|
|
5
|
+
import { u as useOnKeyDown } from './useOnKeyDown-es.js';
|
|
6
|
+
import { u as useFocusTrap } from './useFocusTrap-es.js';
|
|
7
|
+
import { u as useIsMounted } from './useIsMounted-es.js';
|
|
8
8
|
import classnames from 'classnames';
|
|
9
|
-
import { u as
|
|
9
|
+
import { u as useDebounce } from './useDebounce-es.js';
|
|
10
10
|
import { B as ButtonDismiss } from './ButtonDismiss-es.js';
|
|
11
11
|
import { T as Text } from './Text-es.js';
|
|
12
12
|
import { B as Button } from './Button-es.js';
|
|
13
13
|
import { H as Heading } from './Heading-es.js';
|
|
14
14
|
import { A as AtlantisThemeContextProvider } from './AtlantisThemeContext-es.js';
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
getSnapshot(query) {
|
|
34
|
-
return () => window.matchMedia(query).matches;
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
function useMediaQuery(query) {
|
|
38
|
-
const subscribeMediaQuery = (0, react_1.useCallback)((onChange) => exports.mediaQueryStore.subscribe(onChange, query), [query]);
|
|
39
|
-
const matches = (0, react_1.useSyncExternalStore)(subscribeMediaQuery, exports.mediaQueryStore.getSnapshot(query), () => true);
|
|
40
|
-
return matches;
|
|
41
|
-
}
|
|
42
|
-
} (useMediaQuery));
|
|
16
|
+
const mediaQueryStore = {
|
|
17
|
+
subscribe(onChange, query) {
|
|
18
|
+
const matchMedia = window.matchMedia(query);
|
|
19
|
+
matchMedia.addEventListener("change", onChange);
|
|
20
|
+
return () => {
|
|
21
|
+
matchMedia.removeEventListener("change", onChange);
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
getSnapshot(query) {
|
|
25
|
+
return () => window.matchMedia(query).matches;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
function useMediaQuery(query) {
|
|
29
|
+
const subscribeMediaQuery = useCallback((onChange) => mediaQueryStore.subscribe(onChange, query), [query]);
|
|
30
|
+
const matches = useSyncExternalStore(subscribeMediaQuery, mediaQueryStore.getSnapshot(query), () => true);
|
|
31
|
+
return matches;
|
|
32
|
+
}
|
|
43
33
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
smallOnly: smallAndUp && !mediumAndUp,
|
|
68
|
-
mediumOnly: mediumAndUp && !largeAndUp,
|
|
69
|
-
largeOnly: largeAndUp && !extraLargeAndUp,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
} (useBreakpoints));
|
|
34
|
+
const BREAKPOINT_SIZES = { sm: 490, md: 768, lg: 1080, xl: 1440 };
|
|
35
|
+
/**
|
|
36
|
+
* Hook equivalent of CSS media queries with our
|
|
37
|
+
* [supported breakpoints](https://atlantis.getjobber.com/design/breakpoints).
|
|
38
|
+
*/
|
|
39
|
+
function useBreakpoints() {
|
|
40
|
+
const { sm, md, lg, xl } = BREAKPOINT_SIZES;
|
|
41
|
+
const extraSmallOnly = useMediaQuery(`(max-width: ${sm - 1}px)`);
|
|
42
|
+
const smallAndUp = useMediaQuery(`(min-width: ${sm}px)`);
|
|
43
|
+
const mediumAndUp = useMediaQuery(`(min-width: ${md}px)`);
|
|
44
|
+
const largeAndUp = useMediaQuery(`(min-width: ${lg}px)`);
|
|
45
|
+
const extraLargeAndUp = useMediaQuery(`(min-width: ${xl}px)`);
|
|
46
|
+
return {
|
|
47
|
+
smallAndUp,
|
|
48
|
+
mediumAndUp,
|
|
49
|
+
largeAndUp,
|
|
50
|
+
extraLargeAndUp,
|
|
51
|
+
extraSmallOnly,
|
|
52
|
+
smallOnly: smallAndUp && !mediumAndUp,
|
|
53
|
+
mediumOnly: mediumAndUp && !largeAndUp,
|
|
54
|
+
largeOnly: largeAndUp && !extraLargeAndUp,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
73
57
|
|
|
74
58
|
var styles = {"backgroundImage":"i9Tw1T65W-k-","next":"Q8amcRaTGf0-","prev":"W9FVb24yJrk-","buttonHidden":"nsN0TPWsBXI-","buttonVisible":"dkLYp7AD2jE-","lightboxWrapper":"_5p2iAj4JfoE-","toolbar":"rMK4cKdOxFw-","closeButton":"_0m6vb11DgiA-","slideNumber":"kCc68gGuTgg-","image":"yYFVVScosfQ-","imageArea":"UskuwLHR6fg-","captionWrapper":"OGjhge-r-U4-","title":"tZU2g-NYdIs-","blurOverlay":"GKIdLTmvcvQ-","thumbnailBar":"_3TfQLQEE3GQ-","thumbnailImage":"eBMzUOlcfQ4-","thumbnail":"eapm2zruLn8-","selected":"PeLn2u-QB0k-","spinning":"_8tDoqjgfLcw-"};
|
|
75
59
|
|
|
@@ -104,21 +88,21 @@ function LightBox({ boxSizing = "content-box", open, images, imageIndex = 0, onR
|
|
|
104
88
|
const [currentImageIndex, setCurrentImageIndex] = useState(imageIndex);
|
|
105
89
|
const [direction, setDirection] = useState(0);
|
|
106
90
|
const [mouseIsStationary, setMouseIsStationary] = useState(true);
|
|
107
|
-
const lightboxRef =
|
|
91
|
+
const lightboxRef = useFocusTrap(open);
|
|
108
92
|
const selectedThumbnailRef = useRef(null);
|
|
109
|
-
const debouncedHandleNext =
|
|
110
|
-
const debouncedHandlePrevious =
|
|
111
|
-
const mounted =
|
|
93
|
+
const debouncedHandleNext = useDebounce(handleMoveNext, BUTTON_DEBOUNCE_DELAY);
|
|
94
|
+
const debouncedHandlePrevious = useDebounce(handleMovePrevious, BUTTON_DEBOUNCE_DELAY);
|
|
95
|
+
const mounted = useIsMounted();
|
|
112
96
|
const prevOpen = useRef(open);
|
|
113
|
-
|
|
114
|
-
const handleMouseMovement =
|
|
97
|
+
useRefocusOnActivator(open);
|
|
98
|
+
const handleMouseMovement = useDebounce(() => {
|
|
115
99
|
setMouseIsStationary(true);
|
|
116
100
|
}, MOVEMENT_DEBOUNCE_DELAY);
|
|
117
|
-
|
|
118
|
-
|
|
101
|
+
useOnKeyDown(handleRequestClose, "Escape");
|
|
102
|
+
useOnKeyDown(debouncedHandlePrevious, {
|
|
119
103
|
key: "ArrowLeft",
|
|
120
104
|
});
|
|
121
|
-
|
|
105
|
+
useOnKeyDown(debouncedHandleNext, {
|
|
122
106
|
key: "ArrowRight",
|
|
123
107
|
});
|
|
124
108
|
useEffect(() => {
|
|
@@ -206,12 +190,12 @@ function LightBox({ boxSizing = "content-box", open, images, imageIndex = 0, onR
|
|
|
206
190
|
}
|
|
207
191
|
}
|
|
208
192
|
function PreviousButton({ onClick, hideButton }) {
|
|
209
|
-
const { mediumAndUp } = useBreakpoints
|
|
193
|
+
const { mediumAndUp } = useBreakpoints();
|
|
210
194
|
return (React__default.createElement("div", { className: `${styles.prev} ${hideButton ? styles.buttonHidden : styles.buttonVisible}` },
|
|
211
195
|
React__default.createElement(Button, { size: mediumAndUp ? "large" : "small", variation: "subtle", type: "secondary", icon: "arrowLeft", ariaLabel: "Previous image", onClick: onClick })));
|
|
212
196
|
}
|
|
213
197
|
function NextButton({ onClick, hideButton }) {
|
|
214
|
-
const { mediumAndUp } = useBreakpoints
|
|
198
|
+
const { mediumAndUp } = useBreakpoints();
|
|
215
199
|
return (React__default.createElement("div", { className: `${styles.next} ${hideButton ? styles.buttonHidden : styles.buttonVisible}` },
|
|
216
200
|
React__default.createElement(Button, { size: mediumAndUp ? "large" : "small", variation: "subtle", type: "secondary", icon: "arrowRight", ariaLabel: "Next image", onClick: onClick })));
|
|
217
201
|
}
|
package/dist/Menu-cjs.js
CHANGED
|
@@ -13,11 +13,6 @@ var Icon = require('./Icon-cjs.js');
|
|
|
13
13
|
var useFormFieldFocus = require('./useFormFieldFocus-cjs.js');
|
|
14
14
|
var maxHeight = require('./maxHeight-cjs.js');
|
|
15
15
|
|
|
16
|
-
var useWindowDimensions$1 = {};
|
|
17
|
-
|
|
18
|
-
Object.defineProperty(useWindowDimensions$1, "__esModule", { value: true });
|
|
19
|
-
var useWindowDimensions_2 = useWindowDimensions$1.useWindowDimensions = useWindowDimensions;
|
|
20
|
-
const react_1 = React;
|
|
21
16
|
function getWindowDimensions() {
|
|
22
17
|
if (!(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document)) {
|
|
23
18
|
return {
|
|
@@ -32,8 +27,8 @@ function getWindowDimensions() {
|
|
|
32
27
|
};
|
|
33
28
|
}
|
|
34
29
|
function useWindowDimensions() {
|
|
35
|
-
const [windowDimensions, setWindowDimensions] =
|
|
36
|
-
|
|
30
|
+
const [windowDimensions, setWindowDimensions] = React.useState(getWindowDimensions());
|
|
31
|
+
React.useEffect(() => {
|
|
37
32
|
function handleResize() {
|
|
38
33
|
setWindowDimensions(getWindowDimensions());
|
|
39
34
|
}
|
|
@@ -65,7 +60,7 @@ function Menu({ activator, items, UNSAFE_className, UNSAFE_style, }) {
|
|
|
65
60
|
var _a;
|
|
66
61
|
const [visible, setVisible] = React.useState(false);
|
|
67
62
|
const [referenceElement, setReferenceElement] = React.useState(null);
|
|
68
|
-
const { width } =
|
|
63
|
+
const { width } = useWindowDimensions();
|
|
69
64
|
const buttonID = React.useId();
|
|
70
65
|
const menuID = React.useId();
|
|
71
66
|
const fullWidth = ((_a = activator === null || activator === void 0 ? void 0 : activator.props) === null || _a === void 0 ? void 0 : _a.fullWidth) || false;
|
|
@@ -73,8 +68,8 @@ function Menu({ activator, items, UNSAFE_className, UNSAFE_style, }) {
|
|
|
73
68
|
[styles.fullWidth]: fullWidth,
|
|
74
69
|
});
|
|
75
70
|
// useRefocusOnActivator must come before useFocusTrap for them both to work
|
|
76
|
-
useRefocusOnActivator.
|
|
77
|
-
const menuRef = useFocusTrap.
|
|
71
|
+
useRefocusOnActivator.useRefocusOnActivator(visible);
|
|
72
|
+
const menuRef = useFocusTrap.useFocusTrap(visible);
|
|
78
73
|
const { refs, floatingStyles, context } = floatingUi_react.useFloating({
|
|
79
74
|
open: visible,
|
|
80
75
|
onOpenChange: setVisible,
|
|
@@ -169,7 +164,7 @@ function Action({ label, sectionLabel, icon, iconColor, destructive, UNSAFE_styl
|
|
|
169
164
|
label)));
|
|
170
165
|
}
|
|
171
166
|
function MenuPortal({ children }) {
|
|
172
|
-
const mounted = useIsMounted.
|
|
167
|
+
const mounted = useIsMounted.useIsMounted();
|
|
173
168
|
if (!(mounted === null || mounted === void 0 ? void 0 : mounted.current)) {
|
|
174
169
|
return null;
|
|
175
170
|
}
|
package/dist/Menu-es.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
import React__default, { useState, useId, useRef } from 'react';
|
|
1
|
+
import React__default, { useState, useEffect, useId, useRef } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
4
|
-
import { u as
|
|
5
|
-
import { u as useFloating,
|
|
6
|
-
import { u as
|
|
7
|
-
import { u as
|
|
4
|
+
import { u as useRefocusOnActivator } from './useRefocusOnActivator-es.js';
|
|
5
|
+
import { u as useFloating, a as useDismiss, b as useInteractions, F as FloatingPortal, o as offset, f as flip, s as size, c as autoUpdate } from './floating-ui.react-es.js';
|
|
6
|
+
import { u as useFocusTrap } from './useFocusTrap-es.js';
|
|
7
|
+
import { u as useIsMounted } from './useIsMounted-es.js';
|
|
8
8
|
import { B as Button } from './Button-es.js';
|
|
9
9
|
import { T as Typography } from './Typography-es.js';
|
|
10
10
|
import { I as Icon } from './Icon-es.js';
|
|
11
11
|
import { f as formFieldFocusAttribute } from './useFormFieldFocus-es.js';
|
|
12
12
|
import { c as calculateMaxHeight } from './maxHeight-es.js';
|
|
13
13
|
|
|
14
|
-
var useWindowDimensions$1 = {};
|
|
15
|
-
|
|
16
|
-
Object.defineProperty(useWindowDimensions$1, "__esModule", { value: true });
|
|
17
|
-
var useWindowDimensions_2 = useWindowDimensions$1.useWindowDimensions = useWindowDimensions;
|
|
18
|
-
const react_1 = React__default;
|
|
19
14
|
function getWindowDimensions() {
|
|
20
15
|
if (!(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document)) {
|
|
21
16
|
return {
|
|
@@ -30,8 +25,8 @@ function getWindowDimensions() {
|
|
|
30
25
|
};
|
|
31
26
|
}
|
|
32
27
|
function useWindowDimensions() {
|
|
33
|
-
const [windowDimensions, setWindowDimensions] =
|
|
34
|
-
|
|
28
|
+
const [windowDimensions, setWindowDimensions] = useState(getWindowDimensions());
|
|
29
|
+
useEffect(() => {
|
|
35
30
|
function handleResize() {
|
|
36
31
|
setWindowDimensions(getWindowDimensions());
|
|
37
32
|
}
|
|
@@ -63,7 +58,7 @@ function Menu({ activator, items, UNSAFE_className, UNSAFE_style, }) {
|
|
|
63
58
|
var _a;
|
|
64
59
|
const [visible, setVisible] = useState(false);
|
|
65
60
|
const [referenceElement, setReferenceElement] = useState(null);
|
|
66
|
-
const { width } =
|
|
61
|
+
const { width } = useWindowDimensions();
|
|
67
62
|
const buttonID = useId();
|
|
68
63
|
const menuID = useId();
|
|
69
64
|
const fullWidth = ((_a = activator === null || activator === void 0 ? void 0 : activator.props) === null || _a === void 0 ? void 0 : _a.fullWidth) || false;
|
|
@@ -71,8 +66,8 @@ function Menu({ activator, items, UNSAFE_className, UNSAFE_style, }) {
|
|
|
71
66
|
[styles.fullWidth]: fullWidth,
|
|
72
67
|
});
|
|
73
68
|
// useRefocusOnActivator must come before useFocusTrap for them both to work
|
|
74
|
-
|
|
75
|
-
const menuRef =
|
|
69
|
+
useRefocusOnActivator(visible);
|
|
70
|
+
const menuRef = useFocusTrap(visible);
|
|
76
71
|
const { refs, floatingStyles, context } = useFloating({
|
|
77
72
|
open: visible,
|
|
78
73
|
onOpenChange: setVisible,
|
|
@@ -167,7 +162,7 @@ function Action({ label, sectionLabel, icon, iconColor, destructive, UNSAFE_styl
|
|
|
167
162
|
label)));
|
|
168
163
|
}
|
|
169
164
|
function MenuPortal({ children }) {
|
|
170
|
-
const mounted =
|
|
165
|
+
const mounted = useIsMounted();
|
|
171
166
|
if (!(mounted === null || mounted === void 0 ? void 0 : mounted.current)) {
|
|
172
167
|
return null;
|
|
173
168
|
}
|
package/dist/Modal/index.cjs
CHANGED
|
@@ -35,9 +35,9 @@ var sizes = {"small":"BSZvIAUzFEU-","large":"-ydIALYVvGg-","spinning":"_10FfgKIT
|
|
|
35
35
|
|
|
36
36
|
function ModalLegacy({ open = false, title, size, dismissible = true, children, primaryAction, secondaryAction, tertiaryAction, onRequestClose, }) {
|
|
37
37
|
const modalClassName = classnames(styles$1.modal, size && sizes[size]);
|
|
38
|
-
useRefocusOnActivator.
|
|
39
|
-
const modalRef = useFocusTrap.
|
|
40
|
-
useOnKeyDown.
|
|
38
|
+
useRefocusOnActivator.useRefocusOnActivator(open);
|
|
39
|
+
const modalRef = useFocusTrap.useFocusTrap(open);
|
|
40
|
+
useOnKeyDown.useOnKeyDown(handleRequestClose, "Escape");
|
|
41
41
|
const template = (React.createElement(framerMotion.AnimatePresence, null, open && (React.createElement("div", { ref: modalRef, role: "dialog", className: styles$1.container, tabIndex: 0 },
|
|
42
42
|
React.createElement(framerMotion.motion.div, { key: styles$1.overlay, className: styles$1.overlay, onClick: onRequestClose, initial: { opacity: 0 }, animate: { opacity: 0.8 }, exit: { opacity: 0 }, transition: { duration: 0.2 } }),
|
|
43
43
|
React.createElement(framerMotion.motion.div, { key: styles$1.modal, className: modalClassName, initial: { scale: 0.9, opacity: 0 }, animate: { scale: 1, opacity: 1 }, exit: { scale: 0.9, opacity: 0 }, transition: {
|