@jobber/components 6.30.0 → 6.31.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/AtlantisPortalContent.d.ts +1 -0
- package/AtlantisPortalContent.js +17 -0
- package/dist/AtlantisPortalContent/AtlantisPortalContent.d.ts +2 -0
- package/dist/AtlantisPortalContent/AtlantisPortalContent.types.d.ts +4 -0
- package/dist/AtlantisPortalContent/index.cjs +19 -0
- package/dist/AtlantisPortalContent/index.d.ts +2 -0
- package/dist/AtlantisPortalContent/index.mjs +13 -0
- package/dist/AtlantisPortalContent-cjs.js +11 -0
- package/dist/AtlantisPortalContent-es.js +9 -0
- package/dist/ButtonDismiss/ButtonDismiss.d.ts +1 -2
- package/dist/ButtonDismiss/index.d.ts +1 -1
- package/dist/Chip-cjs.js +1 -1
- package/dist/Chip-es.js +1 -1
- package/dist/Popover/Popover.d.ts +7 -45
- package/dist/Popover/Popover.types.d.ts +109 -0
- package/dist/Popover/PopoverContext.d.ts +11 -0
- package/dist/Popover/index.cjs +17 -4
- package/dist/Popover/index.d.ts +3 -0
- package/dist/Popover/index.mjs +16 -5
- package/dist/Popover/usePopover.d.ts +13 -0
- package/dist/Popover/usePopoverStyles.d.ts +5 -0
- package/dist/Popover-cjs.js +93 -38
- package/dist/Popover-es.js +93 -40
- package/dist/index.cjs +3 -0
- package/dist/index.mjs +2 -1
- package/dist/useScrollToActive-cjs.js +35 -14
- package/dist/useScrollToActive-es.js +35 -14
- package/dist/utils/meta/meta.json +3 -0
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dist/AtlantisPortalContent";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true,
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var AtlantisPortalContent = require("./dist/AtlantisPortalContent");
|
|
8
|
+
|
|
9
|
+
Object.keys(AtlantisPortalContent).forEach(function(key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
Object.defineProperty(exports, key, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function get() {
|
|
14
|
+
return AtlantisPortalContent[key];
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var AtlantisPortalContent = require('../AtlantisPortalContent-cjs.js');
|
|
4
|
+
require('react');
|
|
5
|
+
require('../AtlantisThemeContext-cjs.js');
|
|
6
|
+
require('@jobber/design');
|
|
7
|
+
require('../_commonjsHelpers-cjs.js');
|
|
8
|
+
require('../identity-cjs.js');
|
|
9
|
+
require('../isTypedArray-cjs.js');
|
|
10
|
+
require('../isObjectLike-cjs.js');
|
|
11
|
+
require('../_baseAssignValue-cjs.js');
|
|
12
|
+
require('../_baseFor-cjs.js');
|
|
13
|
+
require('../keysIn-cjs.js');
|
|
14
|
+
require('../_isIterateeCall-cjs.js');
|
|
15
|
+
require('../_setToString-cjs.js');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.AtlantisPortalContent = AtlantisPortalContent.AtlantisPortalContent;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { A as AtlantisPortalContent } from '../AtlantisPortalContent-es.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '../AtlantisThemeContext-es.js';
|
|
4
|
+
import '@jobber/design';
|
|
5
|
+
import '../_commonjsHelpers-es.js';
|
|
6
|
+
import '../identity-es.js';
|
|
7
|
+
import '../isTypedArray-es.js';
|
|
8
|
+
import '../isObjectLike-es.js';
|
|
9
|
+
import '../_baseAssignValue-es.js';
|
|
10
|
+
import '../_baseFor-es.js';
|
|
11
|
+
import '../keysIn-es.js';
|
|
12
|
+
import '../_isIterateeCall-es.js';
|
|
13
|
+
import '../_setToString-es.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var AtlantisThemeContext = require('./AtlantisThemeContext-cjs.js');
|
|
5
|
+
|
|
6
|
+
function AtlantisPortalContent({ children, }) {
|
|
7
|
+
const { theme } = AtlantisThemeContext.useAtlantisTheme();
|
|
8
|
+
return (React.createElement(AtlantisThemeContext.AtlantisThemeContextProvider, { dangerouslyOverrideTheme: theme }, children));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
exports.AtlantisPortalContent = AtlantisPortalContent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { u as useAtlantisTheme, A as AtlantisThemeContextProvider } from './AtlantisThemeContext-es.js';
|
|
3
|
+
|
|
4
|
+
function AtlantisPortalContent({ children, }) {
|
|
5
|
+
const { theme } = useAtlantisTheme();
|
|
6
|
+
return (React__default.createElement(AtlantisThemeContextProvider, { dangerouslyOverrideTheme: theme }, children));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { AtlantisPortalContent as A };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
interface ButtonDismissProps {
|
|
2
|
+
export interface ButtonDismissProps {
|
|
3
3
|
onClick?(event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>): void;
|
|
4
4
|
readonly ariaLabel: string;
|
|
5
5
|
}
|
|
6
6
|
export declare function ButtonDismiss({ onClick, ariaLabel }: ButtonDismissProps): JSX.Element;
|
|
7
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ButtonDismiss } from "./ButtonDismiss";
|
|
1
|
+
export { ButtonDismiss, type ButtonDismissProps } from "./ButtonDismiss";
|
package/dist/Chip-cjs.js
CHANGED
|
@@ -22,7 +22,7 @@ var styles = {"wrapper":"NLNJBhRffp4-","input":"ulLzwMsQL3U-","inactive":"_3LLjp
|
|
|
22
22
|
|
|
23
23
|
function InternalChipButton({ icon, invalid, disabled, label, onClick, }) {
|
|
24
24
|
const buttonRef = React.useRef();
|
|
25
|
-
return (React.createElement("div", { ref: buttonRef, className: styles.button, tabIndex: 0, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, onClick: handleClick, role: "button", "aria-label": `Remove ${label}`, "aria-hidden":
|
|
25
|
+
return (React.createElement("div", { ref: buttonRef, className: styles.button, tabIndex: 0, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, onClick: handleClick, role: "button", "aria-label": `Remove ${label}`, "aria-hidden": disabled, "aria-disabled": disabled, "data-testid": "remove-chip-button" },
|
|
26
26
|
React.createElement(Icon.Icon, { size: "small", name: icon, color: getColor() })));
|
|
27
27
|
function handleKeyUp(event) {
|
|
28
28
|
if (document.activeElement === buttonRef.current &&
|
package/dist/Chip-es.js
CHANGED
|
@@ -20,7 +20,7 @@ var styles = {"wrapper":"NLNJBhRffp4-","input":"ulLzwMsQL3U-","inactive":"_3LLjp
|
|
|
20
20
|
|
|
21
21
|
function InternalChipButton({ icon, invalid, disabled, label, onClick, }) {
|
|
22
22
|
const buttonRef = useRef();
|
|
23
|
-
return (React__default.createElement("div", { ref: buttonRef, className: styles.button, tabIndex: 0, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, onClick: handleClick, role: "button", "aria-label": `Remove ${label}`, "aria-hidden":
|
|
23
|
+
return (React__default.createElement("div", { ref: buttonRef, className: styles.button, tabIndex: 0, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, onClick: handleClick, role: "button", "aria-label": `Remove ${label}`, "aria-hidden": disabled, "aria-disabled": disabled, "data-testid": "remove-chip-button" },
|
|
24
24
|
React__default.createElement(Icon, { size: "small", name: icon, color: getColor() })));
|
|
25
25
|
function handleKeyUp(event) {
|
|
26
26
|
if (document.activeElement === buttonRef.current &&
|
|
@@ -1,46 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Element the Popover will attach to and point at. A `useRef` must be attached to an html element
|
|
5
|
-
* and passed as an attachTo prop in order for the Popover to function properly
|
|
6
|
-
*/
|
|
7
|
-
readonly attachTo: Element | React.RefObject<Element | null>;
|
|
8
|
-
/**
|
|
9
|
-
* Popover content.
|
|
10
|
-
*/
|
|
11
|
-
readonly children: React.ReactNode;
|
|
12
|
-
/**
|
|
13
|
-
* Control Popover visibility.
|
|
14
|
-
*/
|
|
15
|
-
readonly open: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Callback executed when the user wants to close/dismiss the Popover
|
|
18
|
-
*/
|
|
19
|
-
readonly onRequestClose?: () => void;
|
|
20
|
-
/**
|
|
21
|
-
* Describes the preferred placement of the Popover.
|
|
22
|
-
* @default 'auto'
|
|
23
|
-
*/
|
|
24
|
-
readonly preferredPlacement?: "top" | "bottom" | "left" | "right" | "auto";
|
|
25
|
-
/**
|
|
26
|
-
* **Use at your own risk:** Custom class names for specific elements. This should only be used as a
|
|
27
|
-
* **last resort**. Using this may result in unexpected side effects.
|
|
28
|
-
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
29
|
-
*/
|
|
30
|
-
readonly UNSAFE_className?: {
|
|
31
|
-
container?: string;
|
|
32
|
-
dismissButtonContainer?: string;
|
|
33
|
-
arrow?: string;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* **Use at your own risk:** Custom style for specific elements. This should only be used as a
|
|
37
|
-
* **last resort**. Using this may result in unexpected side effects.
|
|
38
|
-
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
39
|
-
*/
|
|
40
|
-
readonly UNSAFE_style?: {
|
|
41
|
-
container?: CSSProperties;
|
|
42
|
-
dismissButtonContainer?: CSSProperties;
|
|
43
|
-
arrow?: CSSProperties;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
1
|
+
import { PopoverArrowProps, PopoverDismissButtonProps, PopoverProps } from "./Popover.types";
|
|
2
|
+
import { PopoverProvider } from "./PopoverContext";
|
|
46
3
|
export declare function Popover({ onRequestClose, children, attachTo, open, preferredPlacement, UNSAFE_className, UNSAFE_style, }: PopoverProps): JSX.Element;
|
|
4
|
+
export declare namespace Popover {
|
|
5
|
+
var Provider: typeof PopoverProvider;
|
|
6
|
+
var Arrow: ({ UNSAFE_className, UNSAFE_style, }: PopoverArrowProps) => JSX.Element;
|
|
7
|
+
var DismissButton: (props: PopoverDismissButtonProps) => JSX.Element;
|
|
8
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { CSSProperties, PropsWithChildren } from "react";
|
|
2
|
+
import { XOR } from "ts-xor";
|
|
3
|
+
import { ButtonDismissProps } from "../ButtonDismiss";
|
|
4
|
+
export interface PopoverProps {
|
|
5
|
+
/**
|
|
6
|
+
* Element the Popover will attach to and point at. A `useRef` must be attached to an html element
|
|
7
|
+
* and passed as an attachTo prop in order for the Popover to function properly
|
|
8
|
+
*/
|
|
9
|
+
readonly attachTo: Element | React.RefObject<Element | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Popover content.
|
|
12
|
+
*/
|
|
13
|
+
readonly children: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Control Popover visibility.
|
|
16
|
+
*/
|
|
17
|
+
readonly open: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Callback executed when the user wants to close/dismiss the Popover
|
|
20
|
+
*/
|
|
21
|
+
readonly onRequestClose?: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Describes the preferred placement of the Popover.
|
|
24
|
+
* @default 'auto'
|
|
25
|
+
*/
|
|
26
|
+
readonly preferredPlacement?: "top" | "bottom" | "left" | "right" | "auto";
|
|
27
|
+
/**
|
|
28
|
+
* **Use at your own risk:** Custom class names for specific elements. This should only be used as a
|
|
29
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
30
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
31
|
+
*/
|
|
32
|
+
readonly UNSAFE_className?: {
|
|
33
|
+
container?: string;
|
|
34
|
+
dismissButtonContainer?: string;
|
|
35
|
+
arrow?: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* **Use at your own risk:** Custom style for specific elements. This should only be used as a
|
|
39
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
40
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
41
|
+
*/
|
|
42
|
+
readonly UNSAFE_style?: {
|
|
43
|
+
container?: CSSProperties;
|
|
44
|
+
dismissButtonContainer?: CSSProperties;
|
|
45
|
+
arrow?: CSSProperties;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export type PopoverProviderProps = PropsWithChildren<Pick<PopoverProps, "preferredPlacement" | "attachTo" | "open"> & {
|
|
49
|
+
/**
|
|
50
|
+
* **Use at your own risk:** Custom class names for specific elements. This should only be used as a
|
|
51
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
52
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
53
|
+
*/
|
|
54
|
+
readonly UNSAFE_className?: {
|
|
55
|
+
container?: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* **Use at your own risk:** Custom style for specific elements. This should only be used as a
|
|
59
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
60
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
61
|
+
*/
|
|
62
|
+
readonly UNSAFE_style?: {
|
|
63
|
+
container?: CSSProperties;
|
|
64
|
+
};
|
|
65
|
+
}>;
|
|
66
|
+
interface PopoverDismissButtonBaseProps {
|
|
67
|
+
/**
|
|
68
|
+
* **Use at your own risk:** Custom class names for specific elements. This should only be used as a
|
|
69
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
70
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
71
|
+
*/
|
|
72
|
+
readonly UNSAFE_className?: {
|
|
73
|
+
dismissButtonContainer?: string;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* **Use at your own risk:** Custom style for specific elements. This should only be used as a
|
|
77
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
78
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
79
|
+
*/
|
|
80
|
+
readonly UNSAFE_style?: {
|
|
81
|
+
dismissButtonContainer?: CSSProperties;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
interface PopoverDismissButtonWithChildren extends PopoverDismissButtonBaseProps {
|
|
85
|
+
readonly children: React.ReactNode;
|
|
86
|
+
}
|
|
87
|
+
type PopoverDismissButtonWithoutChildren = Partial<ButtonDismissProps> & {
|
|
88
|
+
readonly children?: never;
|
|
89
|
+
} & PopoverDismissButtonBaseProps;
|
|
90
|
+
export type PopoverDismissButtonProps = XOR<PopoverDismissButtonWithChildren, PopoverDismissButtonWithoutChildren>;
|
|
91
|
+
export interface PopoverArrowProps {
|
|
92
|
+
/**
|
|
93
|
+
* **Use at your own risk:** Custom class names for specific elements. This should only be used as a
|
|
94
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
95
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
96
|
+
*/
|
|
97
|
+
readonly UNSAFE_className?: {
|
|
98
|
+
arrow?: string;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* **Use at your own risk:** Custom style for specific elements. This should only be used as a
|
|
102
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
103
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
104
|
+
*/
|
|
105
|
+
readonly UNSAFE_style?: {
|
|
106
|
+
arrow?: CSSProperties;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CSSProperties } from "react";
|
|
2
|
+
import { PopoverProviderProps } from "./Popover.types";
|
|
3
|
+
interface PopoverContextProps {
|
|
4
|
+
setArrowElement: (element: HTMLElement | null) => void;
|
|
5
|
+
popperStyles: {
|
|
6
|
+
[key: string]: CSSProperties;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare function usePopoverContext(): PopoverContextProps;
|
|
10
|
+
export declare function PopoverProvider({ children, preferredPlacement, attachTo, open, UNSAFE_className, UNSAFE_style, }: PopoverProviderProps): JSX.Element | null;
|
|
11
|
+
export {};
|
package/dist/Popover/index.cjs
CHANGED
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var Popover = require('../Popover-cjs.js');
|
|
4
|
+
require('../tslib.es6-cjs.js');
|
|
4
5
|
require('react');
|
|
5
|
-
require('react-popper');
|
|
6
|
-
require('../useRefocusOnActivator-cjs.js');
|
|
7
6
|
require('classnames');
|
|
8
7
|
require('react-dom');
|
|
8
|
+
require('react-popper');
|
|
9
|
+
require('../useRefocusOnActivator-cjs.js');
|
|
10
|
+
require('../AtlantisPortalContent-cjs.js');
|
|
11
|
+
require('../AtlantisThemeContext-cjs.js');
|
|
12
|
+
require('@jobber/design');
|
|
13
|
+
require('../_commonjsHelpers-cjs.js');
|
|
14
|
+
require('../identity-cjs.js');
|
|
15
|
+
require('../isTypedArray-cjs.js');
|
|
16
|
+
require('../isObjectLike-cjs.js');
|
|
17
|
+
require('../_baseAssignValue-cjs.js');
|
|
18
|
+
require('../_baseFor-cjs.js');
|
|
19
|
+
require('../keysIn-cjs.js');
|
|
20
|
+
require('../_isIterateeCall-cjs.js');
|
|
21
|
+
require('../_setToString-cjs.js');
|
|
9
22
|
require('../ButtonDismiss-cjs.js');
|
|
10
23
|
require('../Button-cjs.js');
|
|
11
24
|
require('react-router-dom');
|
|
12
|
-
require('../tslib.es6-cjs.js');
|
|
13
25
|
require('../Icon-cjs.js');
|
|
14
|
-
require('@jobber/design');
|
|
15
26
|
require('../Typography-cjs.js');
|
|
16
27
|
|
|
17
28
|
|
|
18
29
|
|
|
19
30
|
exports.Popover = Popover.Popover;
|
|
31
|
+
exports.usePopoverContext = Popover.usePopoverContext;
|
|
32
|
+
exports.usePopoverStyles = Popover.usePopoverStyles;
|
package/dist/Popover/index.d.ts
CHANGED
package/dist/Popover/index.mjs
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
export { P as Popover } from '../Popover-es.js';
|
|
1
|
+
export { P as Popover, u as usePopoverContext, a as usePopoverStyles } from '../Popover-es.js';
|
|
2
|
+
import '../tslib.es6-es.js';
|
|
2
3
|
import 'react';
|
|
3
|
-
import 'react-popper';
|
|
4
|
-
import '../useRefocusOnActivator-es.js';
|
|
5
4
|
import 'classnames';
|
|
6
5
|
import 'react-dom';
|
|
6
|
+
import 'react-popper';
|
|
7
|
+
import '../useRefocusOnActivator-es.js';
|
|
8
|
+
import '../AtlantisPortalContent-es.js';
|
|
9
|
+
import '../AtlantisThemeContext-es.js';
|
|
10
|
+
import '@jobber/design';
|
|
11
|
+
import '../_commonjsHelpers-es.js';
|
|
12
|
+
import '../identity-es.js';
|
|
13
|
+
import '../isTypedArray-es.js';
|
|
14
|
+
import '../isObjectLike-es.js';
|
|
15
|
+
import '../_baseAssignValue-es.js';
|
|
16
|
+
import '../_baseFor-es.js';
|
|
17
|
+
import '../keysIn-es.js';
|
|
18
|
+
import '../_isIterateeCall-es.js';
|
|
19
|
+
import '../_setToString-es.js';
|
|
7
20
|
import '../ButtonDismiss-es.js';
|
|
8
21
|
import '../Button-es.js';
|
|
9
22
|
import 'react-router-dom';
|
|
10
|
-
import '../tslib.es6-es.js';
|
|
11
23
|
import '../Icon-es.js';
|
|
12
|
-
import '@jobber/design';
|
|
13
24
|
import '../Typography-es.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PopoverProps } from "./Popover.types";
|
|
2
|
+
export declare const usePopover: ({ preferredPlacement, attachTo, open, }: Pick<PopoverProps, "preferredPlacement" | "attachTo" | "open">) => {
|
|
3
|
+
setPopperElement: import("react").Dispatch<import("react").SetStateAction<HTMLElement | null | undefined>>;
|
|
4
|
+
setArrowElement: import("react").Dispatch<import("react").SetStateAction<HTMLElement | null | undefined>>;
|
|
5
|
+
popperStyles: {
|
|
6
|
+
[key: string]: import("react").CSSProperties;
|
|
7
|
+
};
|
|
8
|
+
attributes: {
|
|
9
|
+
[key: string]: {
|
|
10
|
+
[key: string]: string;
|
|
11
|
+
} | undefined;
|
|
12
|
+
};
|
|
13
|
+
};
|
package/dist/Popover-cjs.js
CHANGED
|
@@ -1,57 +1,112 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var tslib_es6 = require('./tslib.es6-cjs.js');
|
|
3
4
|
var React = require('react');
|
|
4
|
-
var reactPopper = require('react-popper');
|
|
5
|
-
var useRefocusOnActivator = require('./useRefocusOnActivator-cjs.js');
|
|
6
5
|
var classnames = require('classnames');
|
|
7
6
|
var ReactDOM = require('react-dom');
|
|
7
|
+
var reactPopper = require('react-popper');
|
|
8
|
+
var useRefocusOnActivator = require('./useRefocusOnActivator-cjs.js');
|
|
9
|
+
var AtlantisPortalContent = require('./AtlantisPortalContent-cjs.js');
|
|
8
10
|
var ButtonDismiss = require('./ButtonDismiss-cjs.js');
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function Popover({ onRequestClose, children, attachTo, open, preferredPlacement = "auto", UNSAFE_className = {}, UNSAFE_style = {}, }) {
|
|
13
|
-
var _a, _b, _c;
|
|
12
|
+
const usePopover = ({ preferredPlacement, attachTo, open, }) => {
|
|
14
13
|
const [popperElement, setPopperElement] = React.useState();
|
|
15
14
|
const [arrowElement, setArrowElement] = React.useState();
|
|
15
|
+
const modifiers = React.useMemo(() => {
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
name: "arrow",
|
|
19
|
+
options: { element: arrowElement, padding: 10 },
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: "offset",
|
|
23
|
+
options: {
|
|
24
|
+
offset: [0, 10],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "flip",
|
|
29
|
+
options: {
|
|
30
|
+
fallbackPlacements: ["auto"],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
}, [arrowElement]);
|
|
16
35
|
const { styles: popperStyles, attributes } = reactPopper.usePopper(isHTMLElement(attachTo) ? attachTo : attachTo.current, popperElement, {
|
|
17
|
-
modifiers
|
|
36
|
+
modifiers,
|
|
18
37
|
placement: preferredPlacement,
|
|
19
38
|
});
|
|
20
39
|
useRefocusOnActivator.useRefocusOnActivator_2(open);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const arrowClassNames = classnames(classes.arrow, UNSAFE_className.arrow);
|
|
24
|
-
const popoverContent = (React.createElement("div", Object.assign({ role: "dialog", "data-elevation": "elevated", ref: setPopperElement, style: Object.assign(Object.assign({}, popperStyles.popper), ((_a = UNSAFE_style.container) !== null && _a !== void 0 ? _a : {})), className: popoverClassNames }, attributes.popper, { "data-testid": "popover-container" }),
|
|
25
|
-
React.createElement("div", { className: dismissButtonClassNames, style: (_b = UNSAFE_style.dismissButtonContainer) !== null && _b !== void 0 ? _b : {}, "data-testid": "popover-dismiss-button-container" },
|
|
26
|
-
React.createElement(ButtonDismiss.ButtonDismiss, { onClick: onRequestClose, ariaLabel: "Close dialog" })),
|
|
27
|
-
children,
|
|
28
|
-
React.createElement("div", { ref: setArrowElement, className: arrowClassNames, style: Object.assign(Object.assign({}, popperStyles.arrow), ((_c = UNSAFE_style.arrow) !== null && _c !== void 0 ? _c : {})), "data-testid": "popover-arrow" })));
|
|
29
|
-
return React.createElement(React.Fragment, null, open && ReactDOM.createPortal(popoverContent, document.body));
|
|
30
|
-
}
|
|
31
|
-
function buildModifiers(arrowElement) {
|
|
32
|
-
const modifiers = [
|
|
33
|
-
{
|
|
34
|
-
name: "arrow",
|
|
35
|
-
options: { element: arrowElement, padding: 10 },
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
name: "offset",
|
|
39
|
-
options: {
|
|
40
|
-
offset: [0, 10],
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: "flip",
|
|
45
|
-
options: {
|
|
46
|
-
fallbackPlacements: ["auto"],
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
];
|
|
50
|
-
return modifiers;
|
|
51
|
-
}
|
|
40
|
+
return { setPopperElement, setArrowElement, popperStyles, attributes };
|
|
41
|
+
};
|
|
52
42
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
43
|
function isHTMLElement(el) {
|
|
54
44
|
return (globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) && el instanceof Element;
|
|
55
45
|
}
|
|
56
46
|
|
|
47
|
+
var styles = {"popover":"rY8OtuArIi0-","header":"UI1AohefbSo-","dismissButton":"HyA0TM5soDM-","arrow":"uClo-5-xhAc-","spinning":"VA0ROLmpLPs-"};
|
|
48
|
+
|
|
49
|
+
const usePopoverStyles = () => {
|
|
50
|
+
return {
|
|
51
|
+
container: styles.popover,
|
|
52
|
+
dismissButton: styles.dismissButton,
|
|
53
|
+
arrow: styles.arrow,
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const PopoverContext = React.createContext({
|
|
58
|
+
popperStyles: {},
|
|
59
|
+
setArrowElement: () => {
|
|
60
|
+
// noop
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
function usePopoverContext() {
|
|
64
|
+
return React.useContext(PopoverContext);
|
|
65
|
+
}
|
|
66
|
+
function PopoverProvider({ children, preferredPlacement, attachTo, open, UNSAFE_className, UNSAFE_style, }) {
|
|
67
|
+
const { setPopperElement, setArrowElement, popperStyles, attributes } = usePopover({
|
|
68
|
+
preferredPlacement,
|
|
69
|
+
attachTo,
|
|
70
|
+
open,
|
|
71
|
+
});
|
|
72
|
+
if (!open)
|
|
73
|
+
return null;
|
|
74
|
+
return (React.createElement(PopoverContext.Provider, { value: {
|
|
75
|
+
setArrowElement,
|
|
76
|
+
popperStyles,
|
|
77
|
+
} },
|
|
78
|
+
React.createElement(PopoverWrapper, { attributes: attributes, UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style, setPopperElement: setPopperElement }, children)));
|
|
79
|
+
}
|
|
80
|
+
function PopoverWrapper({ children, attributes, setPopperElement, UNSAFE_className, UNSAFE_style, }) {
|
|
81
|
+
const popoverStyles = usePopoverStyles();
|
|
82
|
+
const { popperStyles } = usePopoverContext();
|
|
83
|
+
const classes = classnames(popoverStyles.container, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.container);
|
|
84
|
+
const content = (React.createElement(AtlantisPortalContent.AtlantisPortalContent, null,
|
|
85
|
+
React.createElement("div", Object.assign({ role: "dialog", "data-elevation": "elevated", ref: setPopperElement, style: Object.assign(Object.assign({}, popperStyles.popper), UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.container), className: classes }, attributes.popper, { "data-testid": "ATL-Popover-Container" }), children)));
|
|
86
|
+
return ReactDOM.createPortal(content, document.body);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function Popover({ onRequestClose, children, attachTo, open, preferredPlacement = "auto", UNSAFE_className, UNSAFE_style, }) {
|
|
90
|
+
return (React.createElement(Popover.Provider, { attachTo: attachTo, open: open, preferredPlacement: preferredPlacement, UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style },
|
|
91
|
+
React.createElement(Popover.DismissButton, { UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style, onClick: onRequestClose }),
|
|
92
|
+
children,
|
|
93
|
+
React.createElement(Popover.Arrow, { UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style })));
|
|
94
|
+
}
|
|
95
|
+
Popover.Provider = PopoverProvider;
|
|
96
|
+
Popover.Arrow = function PopoverArrow({ UNSAFE_className, UNSAFE_style, }) {
|
|
97
|
+
const { setArrowElement, popperStyles } = usePopoverContext();
|
|
98
|
+
const popoverStyles = usePopoverStyles();
|
|
99
|
+
const classes = classnames(popoverStyles.arrow, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.arrow);
|
|
100
|
+
return (React.createElement("div", { ref: setArrowElement, className: classes, style: Object.assign(Object.assign({}, popperStyles.arrow), UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.arrow), "data-testid": "ATL-Popover-Arrow" }));
|
|
101
|
+
};
|
|
102
|
+
Popover.DismissButton = function PopoverDismissButton(props) {
|
|
103
|
+
var _a;
|
|
104
|
+
const { UNSAFE_className, UNSAFE_style, children } = props, dismissButtonProps = tslib_es6.__rest(props, ["UNSAFE_className", "UNSAFE_style", "children"]);
|
|
105
|
+
const popoverStyles = usePopoverStyles();
|
|
106
|
+
const classes = classnames(popoverStyles.dismissButton, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.dismissButtonContainer);
|
|
107
|
+
return (React.createElement("div", { className: classes, style: (_a = UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.dismissButtonContainer) !== null && _a !== void 0 ? _a : {}, "data-testid": "ATL-Popover-Dismiss-Button-Container" }, children !== null && children !== void 0 ? children : (React.createElement(ButtonDismiss.ButtonDismiss, Object.assign({ ariaLabel: "Close dialog" }, dismissButtonProps)))));
|
|
108
|
+
};
|
|
109
|
+
|
|
57
110
|
exports.Popover = Popover;
|
|
111
|
+
exports.usePopoverContext = usePopoverContext;
|
|
112
|
+
exports.usePopoverStyles = usePopoverStyles;
|
package/dist/Popover-es.js
CHANGED
|
@@ -1,55 +1,108 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { u as useRefocusOnActivator_2 } from './useRefocusOnActivator-es.js';
|
|
1
|
+
import { _ as __rest } from './tslib.es6-es.js';
|
|
2
|
+
import React__default, { useState, useMemo, createContext, useContext } from 'react';
|
|
4
3
|
import classnames from 'classnames';
|
|
5
4
|
import ReactDOM__default from 'react-dom';
|
|
5
|
+
import { usePopper } from 'react-popper';
|
|
6
|
+
import { u as useRefocusOnActivator_2 } from './useRefocusOnActivator-es.js';
|
|
7
|
+
import { A as AtlantisPortalContent } from './AtlantisPortalContent-es.js';
|
|
6
8
|
import { B as ButtonDismiss } from './ButtonDismiss-es.js';
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function Popover({ onRequestClose, children, attachTo, open, preferredPlacement = "auto", UNSAFE_className = {}, UNSAFE_style = {}, }) {
|
|
11
|
-
var _a, _b, _c;
|
|
10
|
+
const usePopover = ({ preferredPlacement, attachTo, open, }) => {
|
|
12
11
|
const [popperElement, setPopperElement] = useState();
|
|
13
12
|
const [arrowElement, setArrowElement] = useState();
|
|
13
|
+
const modifiers = useMemo(() => {
|
|
14
|
+
return [
|
|
15
|
+
{
|
|
16
|
+
name: "arrow",
|
|
17
|
+
options: { element: arrowElement, padding: 10 },
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "offset",
|
|
21
|
+
options: {
|
|
22
|
+
offset: [0, 10],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "flip",
|
|
27
|
+
options: {
|
|
28
|
+
fallbackPlacements: ["auto"],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
}, [arrowElement]);
|
|
14
33
|
const { styles: popperStyles, attributes } = usePopper(isHTMLElement(attachTo) ? attachTo : attachTo.current, popperElement, {
|
|
15
|
-
modifiers
|
|
34
|
+
modifiers,
|
|
16
35
|
placement: preferredPlacement,
|
|
17
36
|
});
|
|
18
37
|
useRefocusOnActivator_2(open);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const arrowClassNames = classnames(classes.arrow, UNSAFE_className.arrow);
|
|
22
|
-
const popoverContent = (React__default.createElement("div", Object.assign({ role: "dialog", "data-elevation": "elevated", ref: setPopperElement, style: Object.assign(Object.assign({}, popperStyles.popper), ((_a = UNSAFE_style.container) !== null && _a !== void 0 ? _a : {})), className: popoverClassNames }, attributes.popper, { "data-testid": "popover-container" }),
|
|
23
|
-
React__default.createElement("div", { className: dismissButtonClassNames, style: (_b = UNSAFE_style.dismissButtonContainer) !== null && _b !== void 0 ? _b : {}, "data-testid": "popover-dismiss-button-container" },
|
|
24
|
-
React__default.createElement(ButtonDismiss, { onClick: onRequestClose, ariaLabel: "Close dialog" })),
|
|
25
|
-
children,
|
|
26
|
-
React__default.createElement("div", { ref: setArrowElement, className: arrowClassNames, style: Object.assign(Object.assign({}, popperStyles.arrow), ((_c = UNSAFE_style.arrow) !== null && _c !== void 0 ? _c : {})), "data-testid": "popover-arrow" })));
|
|
27
|
-
return React__default.createElement(React__default.Fragment, null, open && ReactDOM__default.createPortal(popoverContent, document.body));
|
|
28
|
-
}
|
|
29
|
-
function buildModifiers(arrowElement) {
|
|
30
|
-
const modifiers = [
|
|
31
|
-
{
|
|
32
|
-
name: "arrow",
|
|
33
|
-
options: { element: arrowElement, padding: 10 },
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: "offset",
|
|
37
|
-
options: {
|
|
38
|
-
offset: [0, 10],
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
name: "flip",
|
|
43
|
-
options: {
|
|
44
|
-
fallbackPlacements: ["auto"],
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
];
|
|
48
|
-
return modifiers;
|
|
49
|
-
}
|
|
38
|
+
return { setPopperElement, setArrowElement, popperStyles, attributes };
|
|
39
|
+
};
|
|
50
40
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
41
|
function isHTMLElement(el) {
|
|
52
42
|
return (globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) && el instanceof Element;
|
|
53
43
|
}
|
|
54
44
|
|
|
55
|
-
|
|
45
|
+
var styles = {"popover":"rY8OtuArIi0-","header":"UI1AohefbSo-","dismissButton":"HyA0TM5soDM-","arrow":"uClo-5-xhAc-","spinning":"VA0ROLmpLPs-"};
|
|
46
|
+
|
|
47
|
+
const usePopoverStyles = () => {
|
|
48
|
+
return {
|
|
49
|
+
container: styles.popover,
|
|
50
|
+
dismissButton: styles.dismissButton,
|
|
51
|
+
arrow: styles.arrow,
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const PopoverContext = createContext({
|
|
56
|
+
popperStyles: {},
|
|
57
|
+
setArrowElement: () => {
|
|
58
|
+
// noop
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
function usePopoverContext() {
|
|
62
|
+
return useContext(PopoverContext);
|
|
63
|
+
}
|
|
64
|
+
function PopoverProvider({ children, preferredPlacement, attachTo, open, UNSAFE_className, UNSAFE_style, }) {
|
|
65
|
+
const { setPopperElement, setArrowElement, popperStyles, attributes } = usePopover({
|
|
66
|
+
preferredPlacement,
|
|
67
|
+
attachTo,
|
|
68
|
+
open,
|
|
69
|
+
});
|
|
70
|
+
if (!open)
|
|
71
|
+
return null;
|
|
72
|
+
return (React__default.createElement(PopoverContext.Provider, { value: {
|
|
73
|
+
setArrowElement,
|
|
74
|
+
popperStyles,
|
|
75
|
+
} },
|
|
76
|
+
React__default.createElement(PopoverWrapper, { attributes: attributes, UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style, setPopperElement: setPopperElement }, children)));
|
|
77
|
+
}
|
|
78
|
+
function PopoverWrapper({ children, attributes, setPopperElement, UNSAFE_className, UNSAFE_style, }) {
|
|
79
|
+
const popoverStyles = usePopoverStyles();
|
|
80
|
+
const { popperStyles } = usePopoverContext();
|
|
81
|
+
const classes = classnames(popoverStyles.container, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.container);
|
|
82
|
+
const content = (React__default.createElement(AtlantisPortalContent, null,
|
|
83
|
+
React__default.createElement("div", Object.assign({ role: "dialog", "data-elevation": "elevated", ref: setPopperElement, style: Object.assign(Object.assign({}, popperStyles.popper), UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.container), className: classes }, attributes.popper, { "data-testid": "ATL-Popover-Container" }), children)));
|
|
84
|
+
return ReactDOM__default.createPortal(content, document.body);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function Popover({ onRequestClose, children, attachTo, open, preferredPlacement = "auto", UNSAFE_className, UNSAFE_style, }) {
|
|
88
|
+
return (React__default.createElement(Popover.Provider, { attachTo: attachTo, open: open, preferredPlacement: preferredPlacement, UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style },
|
|
89
|
+
React__default.createElement(Popover.DismissButton, { UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style, onClick: onRequestClose }),
|
|
90
|
+
children,
|
|
91
|
+
React__default.createElement(Popover.Arrow, { UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style })));
|
|
92
|
+
}
|
|
93
|
+
Popover.Provider = PopoverProvider;
|
|
94
|
+
Popover.Arrow = function PopoverArrow({ UNSAFE_className, UNSAFE_style, }) {
|
|
95
|
+
const { setArrowElement, popperStyles } = usePopoverContext();
|
|
96
|
+
const popoverStyles = usePopoverStyles();
|
|
97
|
+
const classes = classnames(popoverStyles.arrow, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.arrow);
|
|
98
|
+
return (React__default.createElement("div", { ref: setArrowElement, className: classes, style: Object.assign(Object.assign({}, popperStyles.arrow), UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.arrow), "data-testid": "ATL-Popover-Arrow" }));
|
|
99
|
+
};
|
|
100
|
+
Popover.DismissButton = function PopoverDismissButton(props) {
|
|
101
|
+
var _a;
|
|
102
|
+
const { UNSAFE_className, UNSAFE_style, children } = props, dismissButtonProps = __rest(props, ["UNSAFE_className", "UNSAFE_style", "children"]);
|
|
103
|
+
const popoverStyles = usePopoverStyles();
|
|
104
|
+
const classes = classnames(popoverStyles.dismissButton, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.dismissButtonContainer);
|
|
105
|
+
return (React__default.createElement("div", { className: classes, style: (_a = UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.dismissButtonContainer) !== null && _a !== void 0 ? _a : {}, "data-testid": "ATL-Popover-Dismiss-Button-Container" }, children !== null && children !== void 0 ? children : (React__default.createElement(ButtonDismiss, Object.assign({ ariaLabel: "Close dialog" }, dismissButtonProps)))));
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export { Popover as P, usePopoverStyles as a, usePopoverContext as u };
|
package/dist/index.cjs
CHANGED
|
@@ -174,6 +174,7 @@ require('./useFormFieldFocus-cjs.js');
|
|
|
174
174
|
require('filesize');
|
|
175
175
|
require('./GridCell-cjs.js');
|
|
176
176
|
require('axios');
|
|
177
|
+
require('./AtlantisPortalContent-cjs.js');
|
|
177
178
|
require('@jobber/formatters');
|
|
178
179
|
require('react-dom/client');
|
|
179
180
|
|
|
@@ -279,6 +280,8 @@ exports.Modal = Modal.Modal;
|
|
|
279
280
|
exports.MultiSelect = MultiSelect.MultiSelect;
|
|
280
281
|
exports.Page = Page.Page;
|
|
281
282
|
exports.Popover = Popover.Popover;
|
|
283
|
+
exports.usePopoverContext = Popover.usePopoverContext;
|
|
284
|
+
exports.usePopoverStyles = Popover.usePopoverStyles;
|
|
282
285
|
exports.ProgressBar = ProgressBar.ProgressBar;
|
|
283
286
|
exports.RadioGroup = RadioGroup.RadioGroup;
|
|
284
287
|
exports.RadioOption = RadioGroup.RadioOption;
|
package/dist/index.mjs
CHANGED
|
@@ -72,7 +72,7 @@ export { M as Menu } from './Menu-es.js';
|
|
|
72
72
|
export { M as Modal } from './Modal-es.js';
|
|
73
73
|
export { M as MultiSelect } from './MultiSelect-es.js';
|
|
74
74
|
export { P as Page } from './Page-es.js';
|
|
75
|
-
export { P as Popover } from './Popover-es.js';
|
|
75
|
+
export { P as Popover, u as usePopoverContext, a as usePopoverStyles } from './Popover-es.js';
|
|
76
76
|
export { P as ProgressBar } from './ProgressBar-es.js';
|
|
77
77
|
export { R as RadioGroup, a as RadioOption } from './RadioGroup-es.js';
|
|
78
78
|
export { R as RecurringSelect } from './RecurringSelect-es.js';
|
|
@@ -172,5 +172,6 @@ import './useFormFieldFocus-es.js';
|
|
|
172
172
|
import 'filesize';
|
|
173
173
|
import './GridCell-es.js';
|
|
174
174
|
import 'axios';
|
|
175
|
+
import './AtlantisPortalContent-es.js';
|
|
175
176
|
import '@jobber/formatters';
|
|
176
177
|
import 'react-dom/client';
|
|
@@ -290,6 +290,25 @@ function createAnnouncedElement() {
|
|
|
290
290
|
return el;
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
/**
|
|
294
|
+
* Recursively finds a focusable element (div or button) in the specified direction
|
|
295
|
+
*/
|
|
296
|
+
function findFocusableElement(element, direction) {
|
|
297
|
+
if (!element)
|
|
298
|
+
return null;
|
|
299
|
+
const nextElement = direction === "previous"
|
|
300
|
+
? element.previousElementSibling
|
|
301
|
+
: element.nextElementSibling;
|
|
302
|
+
if (!nextElement)
|
|
303
|
+
return null;
|
|
304
|
+
// Check if element is a div or button
|
|
305
|
+
if (nextElement instanceof HTMLElement &&
|
|
306
|
+
(nextElement.tagName === "DIV" || nextElement.tagName === "BUTTON")) {
|
|
307
|
+
return nextElement;
|
|
308
|
+
}
|
|
309
|
+
// Recursively continue search
|
|
310
|
+
return findFocusableElement(nextElement, direction);
|
|
311
|
+
}
|
|
293
312
|
function useInternalChipDismissible({ children, selected, onChange, onClick, onCustomAdd, }) {
|
|
294
313
|
const ref = React.useRef(null);
|
|
295
314
|
const chipOptions = children.map(chip => chip.props);
|
|
@@ -316,15 +335,17 @@ function useInternalChipDismissible({ children, selected, onChange, onClick, onC
|
|
|
316
335
|
const isInputAndHasValue = target instanceof HTMLInputElement && target.value;
|
|
317
336
|
if (isInputAndHasValue)
|
|
318
337
|
return;
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
338
|
+
if (event.key === "ArrowLeft") {
|
|
339
|
+
const prevFocusable = findFocusableElement(target, "previous");
|
|
340
|
+
if (prevFocusable) {
|
|
341
|
+
prevFocusable.focus();
|
|
342
|
+
}
|
|
324
343
|
}
|
|
325
|
-
if (event.key === "ArrowRight"
|
|
326
|
-
|
|
327
|
-
|
|
344
|
+
if (event.key === "ArrowRight") {
|
|
345
|
+
const nextFocusable = findFocusableElement(target, "next");
|
|
346
|
+
if (nextFocusable) {
|
|
347
|
+
nextFocusable.focus();
|
|
348
|
+
}
|
|
328
349
|
}
|
|
329
350
|
},
|
|
330
351
|
handleChipKeyDown: (value) => {
|
|
@@ -332,13 +353,13 @@ function useInternalChipDismissible({ children, selected, onChange, onClick, onC
|
|
|
332
353
|
if (event.key === "Backspace" || event.key === "Delete") {
|
|
333
354
|
const target = event.target;
|
|
334
355
|
if (target instanceof HTMLElement) {
|
|
335
|
-
const
|
|
336
|
-
const
|
|
337
|
-
if (
|
|
338
|
-
|
|
356
|
+
const prevFocusable = findFocusableElement(target, "previous");
|
|
357
|
+
const nextFocusable = findFocusableElement(target, "next");
|
|
358
|
+
if (prevFocusable) {
|
|
359
|
+
prevFocusable.focus();
|
|
339
360
|
}
|
|
340
|
-
else if (
|
|
341
|
-
|
|
361
|
+
else if (nextFocusable) {
|
|
362
|
+
nextFocusable.focus();
|
|
342
363
|
}
|
|
343
364
|
}
|
|
344
365
|
actions.handleChipRemove(value)();
|
|
@@ -288,6 +288,25 @@ function createAnnouncedElement() {
|
|
|
288
288
|
return el;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
+
/**
|
|
292
|
+
* Recursively finds a focusable element (div or button) in the specified direction
|
|
293
|
+
*/
|
|
294
|
+
function findFocusableElement(element, direction) {
|
|
295
|
+
if (!element)
|
|
296
|
+
return null;
|
|
297
|
+
const nextElement = direction === "previous"
|
|
298
|
+
? element.previousElementSibling
|
|
299
|
+
: element.nextElementSibling;
|
|
300
|
+
if (!nextElement)
|
|
301
|
+
return null;
|
|
302
|
+
// Check if element is a div or button
|
|
303
|
+
if (nextElement instanceof HTMLElement &&
|
|
304
|
+
(nextElement.tagName === "DIV" || nextElement.tagName === "BUTTON")) {
|
|
305
|
+
return nextElement;
|
|
306
|
+
}
|
|
307
|
+
// Recursively continue search
|
|
308
|
+
return findFocusableElement(nextElement, direction);
|
|
309
|
+
}
|
|
291
310
|
function useInternalChipDismissible({ children, selected, onChange, onClick, onCustomAdd, }) {
|
|
292
311
|
const ref = useRef(null);
|
|
293
312
|
const chipOptions = children.map(chip => chip.props);
|
|
@@ -314,15 +333,17 @@ function useInternalChipDismissible({ children, selected, onChange, onClick, onC
|
|
|
314
333
|
const isInputAndHasValue = target instanceof HTMLInputElement && target.value;
|
|
315
334
|
if (isInputAndHasValue)
|
|
316
335
|
return;
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
336
|
+
if (event.key === "ArrowLeft") {
|
|
337
|
+
const prevFocusable = findFocusableElement(target, "previous");
|
|
338
|
+
if (prevFocusable) {
|
|
339
|
+
prevFocusable.focus();
|
|
340
|
+
}
|
|
322
341
|
}
|
|
323
|
-
if (event.key === "ArrowRight"
|
|
324
|
-
|
|
325
|
-
|
|
342
|
+
if (event.key === "ArrowRight") {
|
|
343
|
+
const nextFocusable = findFocusableElement(target, "next");
|
|
344
|
+
if (nextFocusable) {
|
|
345
|
+
nextFocusable.focus();
|
|
346
|
+
}
|
|
326
347
|
}
|
|
327
348
|
},
|
|
328
349
|
handleChipKeyDown: (value) => {
|
|
@@ -330,13 +351,13 @@ function useInternalChipDismissible({ children, selected, onChange, onClick, onC
|
|
|
330
351
|
if (event.key === "Backspace" || event.key === "Delete") {
|
|
331
352
|
const target = event.target;
|
|
332
353
|
if (target instanceof HTMLElement) {
|
|
333
|
-
const
|
|
334
|
-
const
|
|
335
|
-
if (
|
|
336
|
-
|
|
354
|
+
const prevFocusable = findFocusableElement(target, "previous");
|
|
355
|
+
const nextFocusable = findFocusableElement(target, "next");
|
|
356
|
+
if (prevFocusable) {
|
|
357
|
+
prevFocusable.focus();
|
|
337
358
|
}
|
|
338
|
-
else if (
|
|
339
|
-
|
|
359
|
+
else if (nextFocusable) {
|
|
360
|
+
nextFocusable.focus();
|
|
340
361
|
}
|
|
341
362
|
}
|
|
342
363
|
actions.handleChipRemove(value)();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.31.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -490,5 +490,5 @@
|
|
|
490
490
|
"> 1%",
|
|
491
491
|
"IE 10"
|
|
492
492
|
],
|
|
493
|
-
"gitHead": "
|
|
493
|
+
"gitHead": "fc7b94413203d2412defd168c6e765e3fd114f8a"
|
|
494
494
|
}
|