@vuu-ui/vuu-popups 0.8.8-debug → 0.8.9-debug
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/cjs/index.js +36889 -13242
- package/cjs/index.js.map +4 -4
- package/esm/index.js +38065 -14097
- package/esm/index.js.map +4 -4
- package/index.css +3192 -443
- package/index.css.map +3 -3
- package/package.json +3 -3
- package/types/dialog/Dialog.d.ts +2 -1
- package/types/index.d.ts +3 -0
- package/types/menu/ContextMenu.d.ts +1 -0
- package/types/menu/MenuList.d.ts +3 -3
- package/types/menu/use-keyboard-navigation.d.ts +2 -1
- package/types/menu/useContextMenu.d.ts +9 -2
- package/types/popup/Popup.d.ts +10 -0
- package/types/popup/index.d.ts +2 -0
- package/types/popup/popup-service.d.ts +5 -1
- package/types/popup/useAnchoredPosition.d.ts +12 -0
- package/types/popup-menu/PopupMenu.d.ts +4 -2
- package/types/portal/Portal.d.ts +28 -6
- package/types/portal/index.d.ts +0 -2
- package/types/portal-deprecated/PortalDeprecated.d.ts +8 -0
- package/types/portal-deprecated/index.d.ts +3 -0
- package/types/prompt/Prompt.d.ts +14 -0
- package/types/prompt/index.d.ts +1 -0
- package/types/tooltip/Tooltip.d.ts +12 -0
- package/types/tooltip/index.d.ts +2 -0
- package/types/tooltip/useAnchoredPosition.d.ts +12 -0
- package/types/tooltip/useTooltip.d.ts +16 -0
- /package/types/{portal → portal-deprecated}/portal-utils.d.ts +0 -0
- /package/types/{portal → portal-deprecated}/render-portal.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuu-ui/vuu-popups",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.9-debug",
|
|
4
4
|
"description": "VUU popup components - Context Menu, Dialog etc",
|
|
5
5
|
"author": "heswell",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"@salt-ds/core": "1.8.0",
|
|
9
9
|
"@salt-ds/icons": "1.5.1",
|
|
10
10
|
"@salt-ds/lab": "1.0.0-alpha.15",
|
|
11
|
-
"@vuu-ui/vuu-data-types": "0.8.
|
|
12
|
-
"@vuu-ui/vuu-utils": "0.8.
|
|
11
|
+
"@vuu-ui/vuu-data-types": "0.8.9-debug",
|
|
12
|
+
"@vuu-ui/vuu-utils": "0.8.9-debug"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"classnames": "^2.2.6",
|
package/types/dialog/Dialog.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ import "./Dialog.css";
|
|
|
3
3
|
export interface DialogProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
isOpen?: boolean;
|
|
5
5
|
onClose?: () => void;
|
|
6
|
+
hideCloseButton?: boolean;
|
|
6
7
|
}
|
|
7
|
-
export declare const Dialog: ({ children, className, isOpen, onClose, title, ...props }: DialogProps) => JSX.Element | null;
|
|
8
|
+
export declare const Dialog: ({ children, className, isOpen, onClose, title, hideCloseButton, ...props }: DialogProps) => JSX.Element | null;
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MenuListProps } from "./MenuList";
|
|
3
3
|
import { PopupCloseCallback } from "../popup";
|
|
4
|
+
import "./ContextMenu.css";
|
|
4
5
|
export interface ContextMenuProps extends Omit<MenuListProps, "onCloseMenu"> {
|
|
5
6
|
onClose?: PopupCloseCallback;
|
|
6
7
|
position?: {
|
package/types/menu/MenuList.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export interface MenuListProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
28
28
|
activatedByKeyboard?: boolean;
|
|
29
29
|
children: ReactElement[];
|
|
30
30
|
childMenuShowing?: string;
|
|
31
|
+
defaultHighlightedIdx?: number;
|
|
31
32
|
highlightedIdx?: number;
|
|
32
33
|
isRoot?: boolean;
|
|
33
34
|
listItemProps?: Partial<MenuItemProps>;
|
|
@@ -36,8 +37,7 @@ export interface MenuListProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
36
37
|
onOpenMenu?: (menuItemEl: HTMLElement) => void;
|
|
37
38
|
onHighlightMenuItem?: (idx: number) => void;
|
|
38
39
|
}
|
|
39
|
-
declare const MenuList: {
|
|
40
|
-
({ activatedByKeyboard, childMenuShowing, children, className, highlightedIdx: highlightedIdxProp, id: idProp, isRoot, listItemProps, onHighlightMenuItem, onActivate, onCloseMenu, onOpenMenu, ...props }: MenuListProps): JSX.Element;
|
|
40
|
+
export declare const MenuList: {
|
|
41
|
+
({ activatedByKeyboard, childMenuShowing, children, className, defaultHighlightedIdx, highlightedIdx: highlightedIdxProp, id: idProp, isRoot, listItemProps, onHighlightMenuItem, onActivate, onCloseMenu, onOpenMenu, ...props }: MenuListProps): JSX.Element;
|
|
41
42
|
displayName: string;
|
|
42
43
|
};
|
|
43
|
-
export default MenuList;
|
|
@@ -2,6 +2,7 @@ import { FocusEvent, KeyboardEvent } from "react";
|
|
|
2
2
|
export interface KeyboardNavigationProps {
|
|
3
3
|
autoHighlightFirstItem?: boolean;
|
|
4
4
|
count: number;
|
|
5
|
+
defaultHighlightedIdx?: number;
|
|
5
6
|
highlightedIndex?: number;
|
|
6
7
|
onActivate: (idx: number) => void;
|
|
7
8
|
onHighlight?: (idx: number) => void;
|
|
@@ -23,4 +24,4 @@ export interface NavigationHookResult {
|
|
|
23
24
|
listProps: KeyboardHookListProps;
|
|
24
25
|
setIgnoreFocus: (ignoreFocus: boolean) => void;
|
|
25
26
|
}
|
|
26
|
-
export declare const useKeyboardNavigation: ({ autoHighlightFirstItem, count, highlightedIndex: highlightedIndexProp, onActivate, onHighlight, onCloseMenu, onOpenMenu, }: KeyboardNavigationProps) => NavigationHookResult;
|
|
27
|
+
export declare const useKeyboardNavigation: ({ autoHighlightFirstItem, count, defaultHighlightedIdx, highlightedIndex: highlightedIndexProp, onActivate, onHighlight, onCloseMenu, onOpenMenu, }: KeyboardNavigationProps) => NavigationHookResult;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { MenuActionHandler, MenuBuilder } from "@vuu-ui/vuu-data-types";
|
|
3
3
|
import { ContextMenuProps } from "./ContextMenu";
|
|
4
4
|
export type ContextMenuOptions = {
|
|
@@ -8,6 +8,13 @@ export type ContextMenuOptions = {
|
|
|
8
8
|
className?: string;
|
|
9
9
|
"data-mode"?: string;
|
|
10
10
|
};
|
|
11
|
+
controlledComponentId?: string;
|
|
11
12
|
};
|
|
12
|
-
export type
|
|
13
|
+
export type EventLike = {
|
|
14
|
+
clientX: number;
|
|
15
|
+
clientY: number;
|
|
16
|
+
preventDefault?: () => void;
|
|
17
|
+
stopPropagation?: () => void;
|
|
18
|
+
};
|
|
19
|
+
export type ShowContextMenu = (e: EventLike, location: string, options: ContextMenuOptions) => void;
|
|
13
20
|
export declare const useContextMenu: (menuBuilder?: MenuBuilder, menuActionHandler?: MenuActionHandler) => [ShowContextMenu, () => void];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HTMLAttributes, RefObject } from "react";
|
|
2
|
+
import "./Popup.css";
|
|
3
|
+
export type PopupPlacement = "below" | "below-center" | "below-full-width" | "center" | "right";
|
|
4
|
+
export interface PopupComponentProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
placement: PopupPlacement;
|
|
6
|
+
anchorElement: RefObject<HTMLElement>;
|
|
7
|
+
offsetLeft?: number;
|
|
8
|
+
offsetTop?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const PopupComponent: ({ children, className, anchorElement, placement, }: PopupComponentProps) => JSX.Element | null;
|
package/types/popup/index.d.ts
CHANGED
|
@@ -6,12 +6,16 @@ export type ClickAwayClosePopup = {
|
|
|
6
6
|
type: "click-away";
|
|
7
7
|
mouseEvt: MouseEvent;
|
|
8
8
|
};
|
|
9
|
+
export type EscapeClosePopup = {
|
|
10
|
+
type: "escape";
|
|
11
|
+
event: KeyboardEvent;
|
|
12
|
+
};
|
|
9
13
|
export type MenuActionClosePopup = {
|
|
10
14
|
menuId: string;
|
|
11
15
|
options: ContextMenuOptions;
|
|
12
16
|
type: "menu-action";
|
|
13
17
|
};
|
|
14
|
-
export type PopupCloseReason = ClickAwayClosePopup | MenuActionClosePopup;
|
|
18
|
+
export type PopupCloseReason = ClickAwayClosePopup | EscapeClosePopup | MenuActionClosePopup;
|
|
15
19
|
export declare const reasonIsMenuAction: (reason?: PopupCloseReason) => reason is MenuActionClosePopup;
|
|
16
20
|
export declare const reasonIsClickAway: (reason?: PopupCloseReason) => reason is ClickAwayClosePopup;
|
|
17
21
|
export interface ShowPopupProps {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
import { PopupPlacement } from "./Popup";
|
|
3
|
+
export interface AnchoredPositionHookProps {
|
|
4
|
+
anchorElement: RefObject<HTMLElement>;
|
|
5
|
+
offsetLeft?: number;
|
|
6
|
+
offsetTop?: number;
|
|
7
|
+
placement: PopupPlacement;
|
|
8
|
+
}
|
|
9
|
+
export declare const useAnchoredPosition: ({ anchorElement, offsetLeft, offsetTop, placement, }: AnchoredPositionHookProps) => {
|
|
10
|
+
left: number;
|
|
11
|
+
top: number;
|
|
12
|
+
} | undefined;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
|
+
import { PopupCloseReason } from "@vuu-ui/vuu-popups";
|
|
2
3
|
import "./PopupMenu.css";
|
|
3
4
|
import { MenuActionHandler, MenuBuilder } from "@vuu-ui/vuu-data-types";
|
|
4
5
|
export interface PopupMenuProps extends HTMLAttributes<HTMLButtonElement> {
|
|
5
6
|
icon?: string;
|
|
7
|
+
label?: string;
|
|
6
8
|
menuActionHandler?: MenuActionHandler;
|
|
7
9
|
menuBuilder?: MenuBuilder;
|
|
8
10
|
menuLocation?: string;
|
|
9
11
|
menuOptions?: {
|
|
10
12
|
[key: string]: unknown;
|
|
11
13
|
};
|
|
12
|
-
onMenuClose?: () => void;
|
|
14
|
+
onMenuClose?: (reason?: PopupCloseReason) => void;
|
|
13
15
|
}
|
|
14
|
-
export declare const PopupMenu: ({ className, icon, id: idProp, menuActionHandler, menuBuilder, menuLocation, menuOptions, onMenuClose, tabIndex, ...htmlAttributes }: PopupMenuProps) => JSX.Element;
|
|
16
|
+
export declare const PopupMenu: ({ className, label, icon, id: idProp, menuActionHandler, menuBuilder, menuLocation, menuOptions, onMenuClose, tabIndex, ...htmlAttributes }: PopupMenuProps) => JSX.Element;
|
package/types/portal/Portal.d.ts
CHANGED
|
@@ -1,8 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import "./Portal.css";
|
|
2
3
|
export interface PortalProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The children to render into the `container`.
|
|
6
|
+
*/
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* An HTML element, component instance, or function that returns either.
|
|
10
|
+
* The `container` will have the portal children appended to it.
|
|
11
|
+
*
|
|
12
|
+
* By default, it uses the body of the top-level document object,
|
|
13
|
+
* so it's simply `document.body` most of the time.
|
|
14
|
+
*/
|
|
15
|
+
container?: Element | (() => Element | null) | null;
|
|
16
|
+
/**
|
|
17
|
+
* If this node does not exist on the document, it will be created for you.
|
|
18
|
+
*/
|
|
19
|
+
id?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Allow conditional rendering of this Portal, if false, will render nothing.
|
|
22
|
+
* Defaults to true
|
|
23
|
+
*/
|
|
24
|
+
open?: boolean;
|
|
7
25
|
}
|
|
8
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Portals provide a first-class way to render children into a DOM node
|
|
28
|
+
* that exists outside the DOM hierarchy of the parent component.
|
|
29
|
+
*/
|
|
30
|
+
export declare const Portal: ({ children, container: containerProp, id, open, }: PortalProps) => import("react").ReactPortal | null;
|
package/types/portal/index.d.ts
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
export interface PortalDeprecatedProps {
|
|
3
|
+
children: ReactElement;
|
|
4
|
+
onRender?: () => void;
|
|
5
|
+
x?: number;
|
|
6
|
+
y?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const PortalDeprecated: ({ children, x, y, onRender, }: PortalDeprecatedProps) => null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
import { PopupComponentProps } from "../popup";
|
|
3
|
+
import "./Prompt.css";
|
|
4
|
+
export interface PromptProps extends HTMLAttributes<HTMLDialogElement> {
|
|
5
|
+
PopupProps?: Partial<PopupComponentProps>;
|
|
6
|
+
cancelButtonLabel?: string;
|
|
7
|
+
confirmButtonLabel?: string;
|
|
8
|
+
onCancel: () => void;
|
|
9
|
+
onConfirm: () => void;
|
|
10
|
+
icon?: string;
|
|
11
|
+
text: string;
|
|
12
|
+
variant?: "warn" | "error" | "info";
|
|
13
|
+
}
|
|
14
|
+
export declare const Prompt: ({ PopupProps, cancelButtonLabel, confirmButtonLabel, icon, onCancel, onConfirm, style, text, title, variant, ...htmlAttributes }: PromptProps) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Prompt";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MouseEventHandler, ReactNode, RefObject } from "react";
|
|
2
|
+
import { TooltipPlacement } from "./useAnchoredPosition";
|
|
3
|
+
import "./Tooltip.css";
|
|
4
|
+
export interface TooltipProps {
|
|
5
|
+
anchorElement: RefObject<HTMLElement>;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
id?: string;
|
|
8
|
+
onMouseEnter: MouseEventHandler;
|
|
9
|
+
onMouseLeave: MouseEventHandler;
|
|
10
|
+
placement: TooltipPlacement;
|
|
11
|
+
}
|
|
12
|
+
export declare const Tooltip: ({ anchorElement, children, id, onMouseEnter, onMouseLeave, placement, }: TooltipProps) => JSX.Element | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
export type TooltipPlacement = "above" | "right" | "below" | "left";
|
|
3
|
+
export interface AnchoredPositionHookProps {
|
|
4
|
+
anchorElement: RefObject<HTMLElement>;
|
|
5
|
+
offsetLeft?: number;
|
|
6
|
+
offsetTop?: number;
|
|
7
|
+
placement: TooltipPlacement;
|
|
8
|
+
}
|
|
9
|
+
export declare const useAnchoredPosition: ({ anchorElement, offsetLeft, offsetTop, placement, }: AnchoredPositionHookProps) => {
|
|
10
|
+
left: number;
|
|
11
|
+
top: number;
|
|
12
|
+
} | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MouseEvent, ReactNode } from "react";
|
|
2
|
+
import { TooltipProps } from "./Tooltip";
|
|
3
|
+
import { TooltipPlacement } from "./useAnchoredPosition";
|
|
4
|
+
export interface TooltipHookProps {
|
|
5
|
+
id: string;
|
|
6
|
+
placement?: TooltipPlacement;
|
|
7
|
+
tooltipContent: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const useTooltip: ({ id: idProp, placement, tooltipContent, }: TooltipHookProps) => {
|
|
10
|
+
anchorProps: {
|
|
11
|
+
"aria-describedby": string;
|
|
12
|
+
onMouseEnter: (evt: MouseEvent) => void;
|
|
13
|
+
onMouseLeave: () => void;
|
|
14
|
+
};
|
|
15
|
+
tooltipProps: TooltipProps | undefined;
|
|
16
|
+
};
|
|
File without changes
|
|
File without changes
|