@conveyorhq/arrow-ds 1.109.0 → 1.110.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/package.json +2 -2
- package/public/components/Floating/FloatingTooltip.d.ts +1 -1
- package/public/components/Floating/FloatingTooltip.js +10 -10
- package/public/components/Floating/index.d.ts +1 -1
- package/public/components/Modal/Modal.d.ts +5 -5
- package/public/components/Modal/Modal.js +4 -4
- package/public/components/Portal/Portal.js +2 -2
- package/src/components/Floating/FloatingTooltip.tsx +2 -2
- package/src/components/Floating/index.ts +1 -1
- package/src/components/Modal/Modal.tsx +14 -7
- package/src/components/Portal/Portal.story.mdx +1 -1
- package/src/components/Portal/Portal.tsx +1 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@conveyorhq/arrow-ds",
|
|
3
3
|
"author": "Conveyor",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.110.1",
|
|
6
6
|
"description": "Arrow Design System",
|
|
7
7
|
"repository": "https://github.com/conveyor/arrow-ds",
|
|
8
8
|
"publishConfig": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"components"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@floating-ui/react
|
|
21
|
+
"@floating-ui/react": "^0.22.2",
|
|
22
22
|
"@fortawesome/fontawesome-svg-core": "^1.2.26",
|
|
23
23
|
"@fortawesome/free-regular-svg-icons": "^5.14.0",
|
|
24
24
|
"@fortawesome/free-solid-svg-icons": "^5.14.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { HTMLProps, PropsWithChildren } from "react";
|
|
2
|
-
import type { Placement } from "@floating-ui/react
|
|
2
|
+
import type { Placement } from "@floating-ui/react";
|
|
3
3
|
import { PortalRootElementType } from "../Portal";
|
|
4
4
|
interface FloatingTooltipOptions {
|
|
5
5
|
initialOpen?: boolean;
|
|
@@ -25,7 +25,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
25
25
|
exports.FloatingTooltip = exports.FloatingTooltipArrow = exports.FloatingTooltipContent = exports.FloatingTooltipTrigger = exports.FloatingTooltipRoot = exports.useFloatingTooltipState = exports.useFloatingTooltip = void 0;
|
|
26
26
|
const react_1 = __importStar(require("react"));
|
|
27
27
|
const react_merge_refs_1 = __importDefault(require("react-merge-refs"));
|
|
28
|
-
const
|
|
28
|
+
const react_2 = require("@floating-ui/react");
|
|
29
29
|
const classnames_1 = __importDefault(require("classnames"));
|
|
30
30
|
const tokens_1 = require("../../style-dictionary/dist/tokens");
|
|
31
31
|
const bem_1 = require("../../utilities/bem");
|
|
@@ -36,28 +36,28 @@ function useFloatingTooltip({ initialOpen = false, placement = "top", open: cont
|
|
|
36
36
|
const arrowRef = react_1.useRef(null);
|
|
37
37
|
const open = controlledOpen !== null && controlledOpen !== void 0 ? controlledOpen : uncontrolledOpen;
|
|
38
38
|
const setOpen = setControlledOpen !== null && setControlledOpen !== void 0 ? setControlledOpen : setUncontrolledOpen;
|
|
39
|
-
const data =
|
|
39
|
+
const data = react_2.useFloating({
|
|
40
40
|
placement,
|
|
41
41
|
open,
|
|
42
42
|
onOpenChange: setOpen,
|
|
43
|
-
whileElementsMounted:
|
|
44
|
-
middleware: [
|
|
43
|
+
whileElementsMounted: react_2.autoUpdate,
|
|
44
|
+
middleware: [react_2.offset(8), react_2.flip(), react_2.shift(), react_2.arrow({ element: arrowRef })],
|
|
45
45
|
});
|
|
46
46
|
const { context } = data;
|
|
47
|
-
const hover =
|
|
47
|
+
const hover = react_2.useHover(context, {
|
|
48
48
|
move: false,
|
|
49
49
|
enabled: controlledOpen == null,
|
|
50
50
|
});
|
|
51
|
-
const focus =
|
|
51
|
+
const focus = react_2.useFocus(context, {
|
|
52
52
|
enabled: controlledOpen == null,
|
|
53
53
|
});
|
|
54
|
-
const dismiss =
|
|
54
|
+
const dismiss = react_2.useDismiss(context, {
|
|
55
55
|
escapeKey: false,
|
|
56
56
|
referencePress: true,
|
|
57
57
|
referencePressEvent: "click",
|
|
58
58
|
});
|
|
59
|
-
const role =
|
|
60
|
-
const interactions =
|
|
59
|
+
const role = react_2.useRole(context, { role: "tooltip" });
|
|
60
|
+
const interactions = react_2.useInteractions([hover, focus, dismiss, role]);
|
|
61
61
|
return react_1.useMemo(() => ({
|
|
62
62
|
open,
|
|
63
63
|
setOpen,
|
|
@@ -102,7 +102,7 @@ exports.FloatingTooltipContent = react_1.forwardRef(function FloatingTooltipCont
|
|
|
102
102
|
state.floating,
|
|
103
103
|
propRef,
|
|
104
104
|
]);
|
|
105
|
-
return (react_1.default.createElement(
|
|
105
|
+
return (react_1.default.createElement(react_2.FloatingPortal, { root: portalRoot }, state.open && (react_1.default.createElement(Box_1.Box, Object.assign({ ref: ref, className: classnames_1.default(`${cn({ e: "content" })}`, className), style: {
|
|
106
106
|
position: state.strategy,
|
|
107
107
|
top: (_a = state.y) !== null && _a !== void 0 ? _a : 0,
|
|
108
108
|
left: (_b = state.x) !== null && _b !== void 0 ? _b : 0,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./FloatingTooltip";
|
|
2
|
-
export type { Placement as FloatingPlacement } from "@floating-ui/react
|
|
2
|
+
export type { Placement as FloatingPlacement } from "@floating-ui/react";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { HTMLAttributes, ReactNode } from "react";
|
|
2
2
|
import { BoxProps } from "../Box";
|
|
3
|
+
import { PortalProps, PortalRootElementType } from "../Portal";
|
|
3
4
|
import { CloseButtonProps } from "../CloseButton";
|
|
4
5
|
import { StackProps } from "../Stack";
|
|
5
6
|
export declare enum MODAL_SIZE {
|
|
@@ -21,6 +22,7 @@ export interface ModalProps extends BoxProps {
|
|
|
21
22
|
size?: MODAL_SIZE;
|
|
22
23
|
center?: boolean;
|
|
23
24
|
noHeader?: boolean;
|
|
25
|
+
portalRoot?: PortalRootElementType;
|
|
24
26
|
}
|
|
25
27
|
export interface ModalBodyProps extends BoxProps {
|
|
26
28
|
padded?: boolean;
|
|
@@ -50,10 +52,8 @@ export interface ModalRootProps {
|
|
|
50
52
|
disableEscClose?: boolean;
|
|
51
53
|
}
|
|
52
54
|
export declare const ModalRoot: ({ children, isOpen, onClose, disableOutsideClick, disableEscClose, }: ModalRootProps) => JSX.Element;
|
|
53
|
-
export
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
export declare const ModalPortal: ({ children }: ModalPortalProps) => JSX.Element;
|
|
55
|
+
export declare type ModalPortalProps = PortalProps;
|
|
56
|
+
export declare const ModalPortal: ({ children, root, id }: ModalPortalProps) => JSX.Element;
|
|
57
57
|
export interface ModalOverlayProps {
|
|
58
58
|
children: ReactNode;
|
|
59
59
|
className?: string;
|
|
@@ -74,7 +74,7 @@ export declare const ModalScreen: ({ className, style, ...rest }: HTMLAttributes
|
|
|
74
74
|
export declare const Modal: {
|
|
75
75
|
(props: ModalProps): JSX.Element;
|
|
76
76
|
Root: ({ children, isOpen, onClose, disableOutsideClick, disableEscClose, }: ModalRootProps) => JSX.Element;
|
|
77
|
-
Portal: ({ children }: ModalPortalProps) => JSX.Element;
|
|
77
|
+
Portal: ({ children, root, id }: ModalPortalProps) => JSX.Element;
|
|
78
78
|
Overlay: ({ children, className, lockScroll, autoFocus, }: ModalOverlayProps) => JSX.Element;
|
|
79
79
|
Container: ({ children, className, ...rest }: ModalContainerProps) => JSX.Element;
|
|
80
80
|
Content: React.ForwardRefExoticComponent<Pick<ModalContentProps, "as" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -139,8 +139,8 @@ const ModalRoot = ({ children, isOpen, onClose, disableOutsideClick = true, disa
|
|
|
139
139
|
return (react_1.default.createElement(context_1.ModalContext.Provider, { value: context }, children));
|
|
140
140
|
};
|
|
141
141
|
exports.ModalRoot = ModalRoot;
|
|
142
|
-
const ModalPortal = ({ children }) => {
|
|
143
|
-
return react_1.default.createElement(Portal_1.Portal,
|
|
142
|
+
const ModalPortal = ({ children, root, id }) => {
|
|
143
|
+
return (react_1.default.createElement(Portal_1.Portal, { root: root, id: id }, children));
|
|
144
144
|
};
|
|
145
145
|
exports.ModalPortal = ModalPortal;
|
|
146
146
|
const ModalOverlay = ({ children, className, lockScroll = true, autoFocus = false, }) => {
|
|
@@ -183,10 +183,10 @@ const ModalScreen = ({ className, style, ...rest }) => {
|
|
|
183
183
|
};
|
|
184
184
|
exports.ModalScreen = ModalScreen;
|
|
185
185
|
const Modal = (props) => {
|
|
186
|
-
const { title, secondaryTitle, description, children, isOpen, onClose, autoFocus = false, lockScroll = true, disableOutsideClick = true, disableEscClose = false, hideCloseButton = false, size = MODAL_SIZE.DEFAULT, center = false, noHeader = false, className, ...rest } = props;
|
|
186
|
+
const { title, secondaryTitle, description, children, isOpen, onClose, autoFocus = false, lockScroll = true, disableOutsideClick = true, disableEscClose = false, hideCloseButton = false, size = MODAL_SIZE.DEFAULT, center = false, noHeader = false, portalRoot, className, ...rest } = props;
|
|
187
187
|
const showHeader = title || secondaryTitle || !hideCloseButton;
|
|
188
188
|
return (react_1.default.createElement(exports.ModalRoot, { isOpen: isOpen, onClose: onClose, disableOutsideClick: disableOutsideClick, disableEscClose: disableEscClose },
|
|
189
|
-
react_1.default.createElement(exports.ModalPortal,
|
|
189
|
+
react_1.default.createElement(exports.ModalPortal, { root: portalRoot },
|
|
190
190
|
react_1.default.createElement(exports.ModalOverlay, { autoFocus: autoFocus, lockScroll: lockScroll },
|
|
191
191
|
react_1.default.createElement(exports.ModalContainer, null,
|
|
192
192
|
react_1.default.createElement(exports.ModalContent, Object.assign({ className: classnames_1.default([
|
|
@@ -5,6 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Portal = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const
|
|
9
|
-
const Portal = (props) => react_1.default.createElement(
|
|
8
|
+
const react_2 = require("@floating-ui/react");
|
|
9
|
+
const Portal = (props) => react_1.default.createElement(react_2.FloatingPortal, Object.assign({}, props));
|
|
10
10
|
exports.Portal = Portal;
|
|
@@ -24,8 +24,8 @@ import {
|
|
|
24
24
|
useRole,
|
|
25
25
|
useInteractions,
|
|
26
26
|
FloatingPortal,
|
|
27
|
-
} from "@floating-ui/react
|
|
28
|
-
import type { Placement } from "@floating-ui/react
|
|
27
|
+
} from "@floating-ui/react";
|
|
28
|
+
import type { Placement } from "@floating-ui/react";
|
|
29
29
|
import classNames from "classnames";
|
|
30
30
|
import { tokens } from "../../style-dictionary/dist/tokens";
|
|
31
31
|
import { bemHOF } from "../../utilities/bem";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./FloatingTooltip";
|
|
2
|
-
export type { Placement as FloatingPlacement } from "@floating-ui/react
|
|
2
|
+
export type { Placement as FloatingPlacement } from "@floating-ui/react";
|
|
@@ -15,7 +15,7 @@ import { RemoveScroll } from "react-remove-scroll";
|
|
|
15
15
|
import mergeRefs from "react-merge-refs";
|
|
16
16
|
import { Box, BoxProps } from "../Box";
|
|
17
17
|
import { Flex } from "../Flex";
|
|
18
|
-
import { Portal } from "../Portal";
|
|
18
|
+
import { Portal, PortalProps, PortalRootElementType } from "../Portal";
|
|
19
19
|
import { Description } from "../Description";
|
|
20
20
|
import { CloseButton, CloseButtonProps } from "../CloseButton";
|
|
21
21
|
import { Stack, StackProps } from "../Stack";
|
|
@@ -121,6 +121,10 @@ export interface ModalProps extends BoxProps {
|
|
|
121
121
|
* `hideCloseButton`. Use when you want a custom layout.
|
|
122
122
|
*/
|
|
123
123
|
noHeader?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Root element where the modal portal should be attached
|
|
126
|
+
*/
|
|
127
|
+
portalRoot?: PortalRootElementType;
|
|
124
128
|
}
|
|
125
129
|
|
|
126
130
|
export interface ModalBodyProps extends BoxProps {
|
|
@@ -342,12 +346,14 @@ export const ModalRoot = ({
|
|
|
342
346
|
);
|
|
343
347
|
};
|
|
344
348
|
|
|
345
|
-
export
|
|
346
|
-
children: ReactNode;
|
|
347
|
-
}
|
|
349
|
+
export type ModalPortalProps = PortalProps;
|
|
348
350
|
|
|
349
|
-
export const ModalPortal = ({ children }: ModalPortalProps) => {
|
|
350
|
-
return
|
|
351
|
+
export const ModalPortal = ({ children, root, id }: ModalPortalProps) => {
|
|
352
|
+
return (
|
|
353
|
+
<Portal root={root} id={id}>
|
|
354
|
+
{children}
|
|
355
|
+
</Portal>
|
|
356
|
+
);
|
|
351
357
|
};
|
|
352
358
|
|
|
353
359
|
export interface ModalOverlayProps {
|
|
@@ -477,6 +483,7 @@ export const Modal = (props: ModalProps) => {
|
|
|
477
483
|
size = MODAL_SIZE.DEFAULT,
|
|
478
484
|
center = false,
|
|
479
485
|
noHeader = false,
|
|
486
|
+
portalRoot,
|
|
480
487
|
className,
|
|
481
488
|
...rest
|
|
482
489
|
} = props;
|
|
@@ -489,7 +496,7 @@ export const Modal = (props: ModalProps) => {
|
|
|
489
496
|
disableOutsideClick={disableOutsideClick}
|
|
490
497
|
disableEscClose={disableEscClose}
|
|
491
498
|
>
|
|
492
|
-
<ModalPortal>
|
|
499
|
+
<ModalPortal root={portalRoot}>
|
|
493
500
|
<ModalOverlay autoFocus={autoFocus} lockScroll={lockScroll}>
|
|
494
501
|
<ModalContainer>
|
|
495
502
|
<ModalContent
|
|
@@ -17,7 +17,7 @@ import { Portal } from "./Portal";
|
|
|
17
17
|
hideDemosLink
|
|
18
18
|
/>
|
|
19
19
|
|
|
20
|
-
Uses FloatingPortal via [@floating-ui/react
|
|
20
|
+
Uses FloatingPortal via [@floating-ui/react](https://floating-ui.com/docs/floatingportal)
|
|
21
21
|
|
|
22
22
|
## Installation
|
|
23
23
|
|