@jobber/components 6.97.1 → 6.98.1-JOB-136570-fb771c1.1
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/FormField/FormFieldWrapper.d.ts +4 -2
- package/dist/FormField/hooks/useToolbar.d.ts +4 -2
- package/dist/FormField-cjs.js +10 -2
- package/dist/FormField-es.js +10 -2
- package/dist/Modal/Modal.d.ts +1 -1
- package/dist/Modal/Modal.types.d.ts +10 -22
- package/dist/Modal/ModalContext.rebuilt.d.ts +2 -1
- package/dist/Modal/constants.d.ts +1 -0
- package/dist/Modal/index.cjs +12 -7
- package/dist/Modal/index.mjs +12 -7
- package/package.json +2 -2
|
@@ -43,11 +43,13 @@ export declare function FormFieldWrapperToolbar({ toolbar, isToolbarVisible, too
|
|
|
43
43
|
readonly isToolbarVisible: boolean;
|
|
44
44
|
readonly toolbarAnimationEnd: {
|
|
45
45
|
opacity: number;
|
|
46
|
-
|
|
46
|
+
maxHeight: number;
|
|
47
|
+
overflow: string;
|
|
47
48
|
};
|
|
48
49
|
readonly toolbarAnimationStart: {
|
|
49
50
|
opacity: number;
|
|
50
|
-
|
|
51
|
+
maxHeight: string;
|
|
52
|
+
overflow: string;
|
|
51
53
|
};
|
|
52
54
|
readonly toolbar: ReactNode;
|
|
53
55
|
}): React.JSX.Element;
|
|
@@ -8,11 +8,13 @@ interface UseToolbar {
|
|
|
8
8
|
isToolbarVisible: boolean;
|
|
9
9
|
toolbarAnimationEnd: {
|
|
10
10
|
opacity: number;
|
|
11
|
-
|
|
11
|
+
maxHeight: number;
|
|
12
|
+
overflow: string;
|
|
12
13
|
};
|
|
13
14
|
toolbarAnimationStart: {
|
|
14
15
|
opacity: number;
|
|
15
|
-
|
|
16
|
+
maxHeight: string;
|
|
17
|
+
overflow: string;
|
|
16
18
|
};
|
|
17
19
|
}
|
|
18
20
|
export declare function useToolbar(props: UseToolBarProps): UseToolbar;
|
package/dist/FormField-cjs.js
CHANGED
|
@@ -66,8 +66,16 @@ function ClearAction({ onClick, visible, }) {
|
|
|
66
66
|
function useToolbar(props) {
|
|
67
67
|
const isToolbarVisible = props.toolbar !== undefined &&
|
|
68
68
|
(props.toolbarVisibility === "always" || props.focused);
|
|
69
|
-
const toolbarAnimationEnd = {
|
|
70
|
-
|
|
69
|
+
const toolbarAnimationEnd = {
|
|
70
|
+
opacity: 0,
|
|
71
|
+
maxHeight: 0,
|
|
72
|
+
overflow: "hidden",
|
|
73
|
+
};
|
|
74
|
+
const toolbarAnimationStart = {
|
|
75
|
+
opacity: 1,
|
|
76
|
+
maxHeight: "200px", // Set a reasonable max height
|
|
77
|
+
overflow: "hidden",
|
|
78
|
+
};
|
|
71
79
|
return {
|
|
72
80
|
isToolbarVisible,
|
|
73
81
|
toolbarAnimationEnd,
|
package/dist/FormField-es.js
CHANGED
|
@@ -64,8 +64,16 @@ function ClearAction({ onClick, visible, }) {
|
|
|
64
64
|
function useToolbar(props) {
|
|
65
65
|
const isToolbarVisible = props.toolbar !== undefined &&
|
|
66
66
|
(props.toolbarVisibility === "always" || props.focused);
|
|
67
|
-
const toolbarAnimationEnd = {
|
|
68
|
-
|
|
67
|
+
const toolbarAnimationEnd = {
|
|
68
|
+
opacity: 0,
|
|
69
|
+
maxHeight: 0,
|
|
70
|
+
overflow: "hidden",
|
|
71
|
+
};
|
|
72
|
+
const toolbarAnimationStart = {
|
|
73
|
+
opacity: 1,
|
|
74
|
+
maxHeight: "200px", // Set a reasonable max height
|
|
75
|
+
overflow: "hidden",
|
|
76
|
+
};
|
|
69
77
|
return {
|
|
70
78
|
isToolbarVisible,
|
|
71
79
|
toolbarAnimationEnd,
|
package/dist/Modal/Modal.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ModalLegacyProps } from "./Modal.types";
|
|
3
|
-
export declare function ModalLegacy({ open, title, size, dismissible, children, primaryAction, secondaryAction, tertiaryAction, onRequestClose, }: ModalLegacyProps): React.JSX.Element;
|
|
3
|
+
export declare function ModalLegacy({ open, title, size, dismissible, children, primaryAction, secondaryAction, tertiaryAction, onRequestClose, ariaLabel, }: ModalLegacyProps): React.JSX.Element;
|
|
@@ -1,30 +1,8 @@
|
|
|
1
1
|
import type { MutableRefObject, PropsWithChildren, ReactNode } from "react";
|
|
2
|
-
import type React from "react";
|
|
3
2
|
import type { ExtendedRefs, FloatingContext, ReferenceType, UseInteractionsReturn } from "@floating-ui/react";
|
|
4
3
|
import type { XOR } from "ts-xor";
|
|
5
4
|
import type sizes from "./ModalSizes.module.css";
|
|
6
5
|
import type { ButtonProps } from "../Button";
|
|
7
|
-
export interface ModalProviderProps {
|
|
8
|
-
readonly children: React.ReactNode;
|
|
9
|
-
/**
|
|
10
|
-
* Size of the modal.
|
|
11
|
-
*/
|
|
12
|
-
readonly size?: keyof typeof sizes;
|
|
13
|
-
/**
|
|
14
|
-
* Whether the modal is open.
|
|
15
|
-
*/
|
|
16
|
-
readonly open?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Callback executed when the user wants to close/dismiss the Modal
|
|
19
|
-
*/
|
|
20
|
-
readonly onRequestClose?: () => void;
|
|
21
|
-
/**
|
|
22
|
-
* Ref to specify the activator element. Useful if the activator can unmount
|
|
23
|
-
* and focus needs to be returned to the activator element.
|
|
24
|
-
*/
|
|
25
|
-
readonly activatorRef?: MutableRefObject<HTMLElement | null> | null;
|
|
26
|
-
readonly dismissible?: boolean;
|
|
27
|
-
}
|
|
28
6
|
export type ModalContentProps = PropsWithChildren;
|
|
29
7
|
export type ModalOverlayProps = PropsWithChildren;
|
|
30
8
|
export interface ModalContextType {
|
|
@@ -66,6 +44,11 @@ export interface ModalContextType {
|
|
|
66
44
|
* @default "ATL-Modal-Header"
|
|
67
45
|
*/
|
|
68
46
|
readonly modalLabelledBy?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Accessible name for the Modal.
|
|
49
|
+
* Intended for use when no Header/Title content is provided, as the Heading/title takes precedence over ariaLabel.
|
|
50
|
+
*/
|
|
51
|
+
readonly ariaLabel?: string;
|
|
69
52
|
/**
|
|
70
53
|
* Floating-ui props to position the modal.
|
|
71
54
|
*/
|
|
@@ -119,5 +102,10 @@ export interface ModalLegacyProps {
|
|
|
119
102
|
readonly tertiaryAction?: ButtonProps;
|
|
120
103
|
onRequestClose?(): void;
|
|
121
104
|
readonly version?: 1;
|
|
105
|
+
/**
|
|
106
|
+
* Accessible name for the Modal.
|
|
107
|
+
* Only required if no title is provided. Title takes precedence over ariaLabel.
|
|
108
|
+
*/
|
|
109
|
+
readonly ariaLabel?: string;
|
|
122
110
|
}
|
|
123
111
|
export {};
|
|
@@ -11,6 +11,7 @@ export interface ModalProviderProps {
|
|
|
11
11
|
readonly activatorRef?: MutableRefObject<HTMLElement | null> | null;
|
|
12
12
|
readonly dismissible?: boolean;
|
|
13
13
|
readonly modalLabelledBy?: string;
|
|
14
|
+
readonly ariaLabel?: string;
|
|
14
15
|
}
|
|
15
|
-
export declare function ModalProvider({ children, open, size, onRequestClose, activatorRef: refProp, dismissible, modalLabelledBy, }: ModalProviderProps): React.JSX.Element;
|
|
16
|
+
export declare function ModalProvider({ children, open, size, onRequestClose, activatorRef: refProp, dismissible, modalLabelledBy, ariaLabel, }: ModalProviderProps): React.JSX.Element;
|
|
16
17
|
export declare function useModalContext(): ModalContextType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MODAL_HEADER_ID: "ATL-Modal-Header";
|
package/dist/Modal/index.cjs
CHANGED
|
@@ -32,12 +32,14 @@ var styles$1 = {"container":"y3M-9xoEnk0-","overlay":"zkyJp1mib-U-","modal":"gMP
|
|
|
32
32
|
|
|
33
33
|
var sizes = {"small":"BSZvIAUzFEU-","large":"-ydIALYVvGg-","spinning":"_10FfgKITqY0-"};
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
const MODAL_HEADER_ID = "ATL-Modal-Header";
|
|
36
|
+
|
|
37
|
+
function ModalLegacy({ open = false, title, size, dismissible = true, children, primaryAction, secondaryAction, tertiaryAction, onRequestClose, ariaLabel, }) {
|
|
36
38
|
const modalClassName = classnames(styles$1.modal, size && sizes[size]);
|
|
37
39
|
jobberHooks.useRefocusOnActivator(open);
|
|
38
40
|
const modalRef = jobberHooks.useFocusTrap(open);
|
|
39
41
|
jobberHooks.useOnKeyDown(handleRequestClose, "Escape");
|
|
40
|
-
const template = (React.createElement(framerMotion.AnimatePresence, null, open && (React.createElement("div", { ref: modalRef, role: "dialog", className: styles$1.container, tabIndex: 0 },
|
|
42
|
+
const template = (React.createElement(framerMotion.AnimatePresence, null, open && (React.createElement("div", { ref: modalRef, role: "dialog", className: styles$1.container, tabIndex: 0, "aria-modal": "true", "aria-labelledby": title ? MODAL_HEADER_ID : undefined, "aria-label": ariaLabel },
|
|
41
43
|
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 } }),
|
|
42
44
|
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: {
|
|
43
45
|
duration: 0.2,
|
|
@@ -57,7 +59,7 @@ function ModalLegacy({ open = false, title, size, dismissible = true, children,
|
|
|
57
59
|
}
|
|
58
60
|
function Header({ title, dismissible, onRequestClose }) {
|
|
59
61
|
return (React.createElement("div", { className: styles$1.header, "data-testid": "modal-header" },
|
|
60
|
-
React.createElement(Heading.Heading, { level: 2 }, title),
|
|
62
|
+
React.createElement(Heading.Heading, { level: 2, id: MODAL_HEADER_ID }, title),
|
|
61
63
|
dismissible && (React.createElement("div", { className: styles$1.closeButton },
|
|
62
64
|
React.createElement(ButtonDismiss.ButtonDismiss, { onClick: onRequestClose, ariaLabel: "Close modal" })))));
|
|
63
65
|
}
|
|
@@ -120,7 +122,7 @@ const ModalContext = React.createContext({
|
|
|
120
122
|
dismissible: true,
|
|
121
123
|
getFloatingProps: identity.identity,
|
|
122
124
|
});
|
|
123
|
-
function ModalProvider({ children, open = false, size, onRequestClose = noop.noop, activatorRef: refProp, dismissible = true, modalLabelledBy =
|
|
125
|
+
function ModalProvider({ children, open = false, size, onRequestClose = noop.noop, activatorRef: refProp, dismissible = true, modalLabelledBy = MODAL_HEADER_ID, ariaLabel, }) {
|
|
124
126
|
const { floatingRefs, floatingContext, nodeId, activatorRef, parentId, getFloatingProps, } = useModal({
|
|
125
127
|
open,
|
|
126
128
|
activatorRef: refProp,
|
|
@@ -136,6 +138,7 @@ function ModalProvider({ children, open = false, size, onRequestClose = noop.noo
|
|
|
136
138
|
floatingNodeId: nodeId,
|
|
137
139
|
dismissible,
|
|
138
140
|
modalLabelledBy,
|
|
141
|
+
ariaLabel,
|
|
139
142
|
getFloatingProps,
|
|
140
143
|
} }, children));
|
|
141
144
|
if (parentId) {
|
|
@@ -168,8 +171,8 @@ function ModalHeader({ title, children }) {
|
|
|
168
171
|
if (children) {
|
|
169
172
|
return React.createElement(React.Fragment, null, children);
|
|
170
173
|
}
|
|
171
|
-
return (React.createElement("div", { className: header, "data-testid":
|
|
172
|
-
React.createElement(Heading.Heading, { level: 2 }, title),
|
|
174
|
+
return (React.createElement("div", { className: header, "data-testid": MODAL_HEADER_ID },
|
|
175
|
+
React.createElement(Heading.Heading, { level: 2, id: modalLabelledBy }, title),
|
|
173
176
|
dismissible && (React.createElement("div", { className: dismissButton },
|
|
174
177
|
React.createElement(ButtonDismiss.ButtonDismiss, { onClick: onRequestClose, ariaLabel: "Close modal" })))));
|
|
175
178
|
}
|
|
@@ -198,7 +201,7 @@ function ModalOverlay({ children }) {
|
|
|
198
201
|
children));
|
|
199
202
|
}
|
|
200
203
|
function ModalContent({ children }) {
|
|
201
|
-
const { open, floatingContext, activatorRef, floatingRefs, size, floatingNodeId, modalLabelledBy, getFloatingProps, } = useModalContext();
|
|
204
|
+
const { open, floatingContext, activatorRef, floatingRefs, size, floatingNodeId, modalLabelledBy, ariaLabel, getFloatingProps, } = useModalContext();
|
|
202
205
|
const { modal } = useModalStyles(size);
|
|
203
206
|
return (React.createElement(framerMotion.AnimatePresence, null, open && (React.createElement(floatingUi_react.FloatingNode, { id: floatingNodeId },
|
|
204
207
|
React.createElement(floatingUi_react.FloatingPortal, null,
|
|
@@ -213,6 +216,8 @@ function ModalContent({ children }) {
|
|
|
213
216
|
role: "dialog",
|
|
214
217
|
className: modal,
|
|
215
218
|
"aria-labelledby": modalLabelledBy,
|
|
219
|
+
"aria-label": ariaLabel,
|
|
220
|
+
"aria-modal": true,
|
|
216
221
|
})), children))))))))));
|
|
217
222
|
}
|
|
218
223
|
|
package/dist/Modal/index.mjs
CHANGED
|
@@ -30,12 +30,14 @@ var styles$1 = {"container":"y3M-9xoEnk0-","overlay":"zkyJp1mib-U-","modal":"gMP
|
|
|
30
30
|
|
|
31
31
|
var sizes = {"small":"BSZvIAUzFEU-","large":"-ydIALYVvGg-","spinning":"_10FfgKITqY0-"};
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
const MODAL_HEADER_ID = "ATL-Modal-Header";
|
|
34
|
+
|
|
35
|
+
function ModalLegacy({ open = false, title, size, dismissible = true, children, primaryAction, secondaryAction, tertiaryAction, onRequestClose, ariaLabel, }) {
|
|
34
36
|
const modalClassName = classnames(styles$1.modal, size && sizes[size]);
|
|
35
37
|
useRefocusOnActivator(open);
|
|
36
38
|
const modalRef = useFocusTrap(open);
|
|
37
39
|
useOnKeyDown(handleRequestClose, "Escape");
|
|
38
|
-
const template = (React__default.createElement(AnimatePresence, null, open && (React__default.createElement("div", { ref: modalRef, role: "dialog", className: styles$1.container, tabIndex: 0 },
|
|
40
|
+
const template = (React__default.createElement(AnimatePresence, null, open && (React__default.createElement("div", { ref: modalRef, role: "dialog", className: styles$1.container, tabIndex: 0, "aria-modal": "true", "aria-labelledby": title ? MODAL_HEADER_ID : undefined, "aria-label": ariaLabel },
|
|
39
41
|
React__default.createElement(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 } }),
|
|
40
42
|
React__default.createElement(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: {
|
|
41
43
|
duration: 0.2,
|
|
@@ -55,7 +57,7 @@ function ModalLegacy({ open = false, title, size, dismissible = true, children,
|
|
|
55
57
|
}
|
|
56
58
|
function Header({ title, dismissible, onRequestClose }) {
|
|
57
59
|
return (React__default.createElement("div", { className: styles$1.header, "data-testid": "modal-header" },
|
|
58
|
-
React__default.createElement(Heading, { level: 2 }, title),
|
|
60
|
+
React__default.createElement(Heading, { level: 2, id: MODAL_HEADER_ID }, title),
|
|
59
61
|
dismissible && (React__default.createElement("div", { className: styles$1.closeButton },
|
|
60
62
|
React__default.createElement(ButtonDismiss, { onClick: onRequestClose, ariaLabel: "Close modal" })))));
|
|
61
63
|
}
|
|
@@ -118,7 +120,7 @@ const ModalContext = createContext({
|
|
|
118
120
|
dismissible: true,
|
|
119
121
|
getFloatingProps: identity,
|
|
120
122
|
});
|
|
121
|
-
function ModalProvider({ children, open = false, size, onRequestClose = noop, activatorRef: refProp, dismissible = true, modalLabelledBy =
|
|
123
|
+
function ModalProvider({ children, open = false, size, onRequestClose = noop, activatorRef: refProp, dismissible = true, modalLabelledBy = MODAL_HEADER_ID, ariaLabel, }) {
|
|
122
124
|
const { floatingRefs, floatingContext, nodeId, activatorRef, parentId, getFloatingProps, } = useModal({
|
|
123
125
|
open,
|
|
124
126
|
activatorRef: refProp,
|
|
@@ -134,6 +136,7 @@ function ModalProvider({ children, open = false, size, onRequestClose = noop, ac
|
|
|
134
136
|
floatingNodeId: nodeId,
|
|
135
137
|
dismissible,
|
|
136
138
|
modalLabelledBy,
|
|
139
|
+
ariaLabel,
|
|
137
140
|
getFloatingProps,
|
|
138
141
|
} }, children));
|
|
139
142
|
if (parentId) {
|
|
@@ -166,8 +169,8 @@ function ModalHeader({ title, children }) {
|
|
|
166
169
|
if (children) {
|
|
167
170
|
return React__default.createElement(React__default.Fragment, null, children);
|
|
168
171
|
}
|
|
169
|
-
return (React__default.createElement("div", { className: header, "data-testid":
|
|
170
|
-
React__default.createElement(Heading, { level: 2 }, title),
|
|
172
|
+
return (React__default.createElement("div", { className: header, "data-testid": MODAL_HEADER_ID },
|
|
173
|
+
React__default.createElement(Heading, { level: 2, id: modalLabelledBy }, title),
|
|
171
174
|
dismissible && (React__default.createElement("div", { className: dismissButton },
|
|
172
175
|
React__default.createElement(ButtonDismiss, { onClick: onRequestClose, ariaLabel: "Close modal" })))));
|
|
173
176
|
}
|
|
@@ -196,7 +199,7 @@ function ModalOverlay({ children }) {
|
|
|
196
199
|
children));
|
|
197
200
|
}
|
|
198
201
|
function ModalContent({ children }) {
|
|
199
|
-
const { open, floatingContext, activatorRef, floatingRefs, size, floatingNodeId, modalLabelledBy, getFloatingProps, } = useModalContext();
|
|
202
|
+
const { open, floatingContext, activatorRef, floatingRefs, size, floatingNodeId, modalLabelledBy, ariaLabel, getFloatingProps, } = useModalContext();
|
|
200
203
|
const { modal } = useModalStyles(size);
|
|
201
204
|
return (React__default.createElement(AnimatePresence, null, open && (React__default.createElement(FloatingNode, { id: floatingNodeId },
|
|
202
205
|
React__default.createElement(FloatingPortal, null,
|
|
@@ -211,6 +214,8 @@ function ModalContent({ children }) {
|
|
|
211
214
|
role: "dialog",
|
|
212
215
|
className: modal,
|
|
213
216
|
"aria-labelledby": modalLabelledBy,
|
|
217
|
+
"aria-label": ariaLabel,
|
|
218
|
+
"aria-modal": true,
|
|
214
219
|
})), children))))))))));
|
|
215
220
|
}
|
|
216
221
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.98.1-JOB-136570-fb771c1.1+fb771c154",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -541,5 +541,5 @@
|
|
|
541
541
|
"> 1%",
|
|
542
542
|
"IE 10"
|
|
543
543
|
],
|
|
544
|
-
"gitHead": "
|
|
544
|
+
"gitHead": "fb771c154ce8a6116df0cd7535b1a8fbcbd46f5d"
|
|
545
545
|
}
|