@vuu-ui/vuu-popups 0.13.2 → 0.13.4

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.13.2",
2
+ "version": "0.13.4",
3
3
  "description": "VUU popup components - Context Menu, Dialog etc",
4
4
  "author": "heswell",
5
5
  "license": "Apache-2.0",
@@ -7,11 +7,11 @@
7
7
  "@salt-ds/core": "1.43.0",
8
8
  "@salt-ds/styles": "0.2.1",
9
9
  "@salt-ds/window": "0.1.1",
10
- "@vuu-ui/vuu-context-menu": "0.13.2",
11
- "@vuu-ui/vuu-data-types": "0.13.2",
12
- "@vuu-ui/vuu-layout": "0.13.2",
13
- "@vuu-ui/vuu-utils": "0.13.2",
14
- "@vuu-ui/vuu-ui-controls": "0.13.2"
10
+ "@vuu-ui/vuu-context-menu": "0.13.4",
11
+ "@vuu-ui/vuu-data-types": "0.13.4",
12
+ "@vuu-ui/vuu-layout": "0.13.4",
13
+ "@vuu-ui/vuu-utils": "0.13.4",
14
+ "@vuu-ui/vuu-ui-controls": "0.13.4"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "clsx": "^2.0.0",
@@ -22,19 +22,16 @@
22
22
  "files": [
23
23
  "README.md",
24
24
  "esm",
25
- "cjs",
26
- "/types"
25
+ "cjs"
27
26
  ],
28
27
  "exports": {
29
28
  ".": {
30
29
  "require": "./cjs/index.js",
31
- "import": "./esm/index.js",
32
- "types": "./types/index.d.ts"
30
+ "import": "./esm/index.js"
33
31
  }
34
32
  },
35
33
  "main": "cjs/index.js",
36
34
  "module": "esm/index.js",
37
35
  "name": "@vuu-ui/vuu-popups",
38
- "type": "module",
39
- "types": "types/index.d.ts"
36
+ "type": "module"
40
37
  }
@@ -1 +0,0 @@
1
- export * from "./useDialog";
@@ -1,25 +0,0 @@
1
- import { ReactElement, ReactNode } from "react";
2
- export type DialogState = {
3
- actions?: ReactElement[];
4
- content: ReactElement;
5
- title: string;
6
- hideCloseButton?: boolean;
7
- };
8
- export type SetDialog = (dialogState?: DialogState) => void;
9
- export type ShowDialog = (dialogContent: ReactElement, title: string, dialogActionButtons?: ReactElement[], hideCloseButton?: boolean) => void;
10
- export interface DialogContextProps {
11
- showDialog: ShowDialog;
12
- closeDialog: () => void;
13
- setDialogDispatchers: (showDialog: ShowDialog, closeDialog: () => void) => void;
14
- }
15
- export declare const useDialog: () => {
16
- dialog: import("react/jsx-runtime").JSX.Element | null;
17
- setDialogState: import("react").Dispatch<import("react").SetStateAction<DialogState | undefined>>;
18
- };
19
- export declare const DialogProvider: ({ children }: {
20
- children: ReactNode;
21
- }) => import("react/jsx-runtime").JSX.Element;
22
- export declare const useDialogContext: () => {
23
- showDialog: ShowDialog;
24
- closeDialog: () => void;
25
- };
@@ -1,6 +0,0 @@
1
- import { HTMLAttributes } from "react";
2
- export interface DialogHeaderProps extends HTMLAttributes<HTMLDivElement> {
3
- hideCloseButton?: boolean;
4
- onClose: () => void;
5
- }
6
- export declare const DialogHeader: ({ hideCloseButton, title, onClose, ...htmlAttributes }: DialogHeaderProps) => import("react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- export * from "./DialogHeader";
package/types/index.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export * from "./dialog";
2
- export * from "./dialog-header";
3
- export * from "./popup";
4
- export * from "./popup-menu";
5
- export * from "./portal";
6
- export * from "./prompt";
7
- export * from "./tooltip";
8
- export * from "./notifications";
@@ -1,5 +0,0 @@
1
- import { NotificationsContext } from "./NotificationsProvider";
2
- export interface NotificationsCenterProps {
3
- notificationsContext: NotificationsContext;
4
- }
5
- export declare const NotificationsCenter: ({ notificationsContext, }: NotificationsCenterProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,11 +0,0 @@
1
- import { ReactElement } from "react";
2
- import { Notification } from "./notificationTypes";
3
- export type DispatchNotification = (notification: Omit<Notification, "id">) => void;
4
- export type NotificationsContext = {
5
- notify: DispatchNotification;
6
- setNotify: (dispatcher: DispatchNotification) => void;
7
- };
8
- export declare const NotificationsProvider: (props: {
9
- children: ReactElement | ReactElement[];
10
- }) => import("react/jsx-runtime").JSX.Element;
11
- export declare const useNotifications: () => DispatchNotification;
@@ -1,7 +0,0 @@
1
- import type { Notification } from "./notificationTypes";
2
- export type ToastNotificationProps = {
3
- top: number;
4
- notification: Notification;
5
- animated?: boolean;
6
- };
7
- export declare const ToastNotification: (props: ToastNotificationProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +0,0 @@
1
- export * from "./NotificationsProvider";
2
- export * from "./notificationTypes";
3
- export * from "./ToastNotification";
@@ -1,7 +0,0 @@
1
- export type NotificationLevel = "info" | "success" | "warning" | "error";
2
- export type Notification = {
3
- type: NotificationLevel;
4
- header: string;
5
- body: string;
6
- id: string;
7
- };
@@ -1,12 +0,0 @@
1
- import { HTMLAttributes, RefObject } from "react";
2
- import { Position } from "./getPositionRelativeToAnchor";
3
- export type PopupPlacement = "absolute" | "auto" | "below" | "below-center" | "below-right" | "below-full-width" | "center" | "right";
4
- export interface PopupComponentProps extends HTMLAttributes<HTMLDivElement> {
5
- anchorElement: RefObject<HTMLElement | null>;
6
- minWidth?: number | string;
7
- offsetLeft?: number;
8
- offsetTop?: number;
9
- placement: PopupPlacement;
10
- position?: Position;
11
- }
12
- export declare const PopupComponent: ({ children, className, anchorElement, minWidth, offsetLeft, offsetTop, placement, position: positionProp, }: PopupComponentProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,19 +0,0 @@
1
- import { PopupPlacement } from "./Popup";
2
- export type Visibility = "hidden" | "visible";
3
- export type Position = {
4
- left: number;
5
- minWidth?: number | string;
6
- top: number;
7
- visibility?: Visibility;
8
- width?: number;
9
- };
10
- export declare const getPositionRelativeToAnchor: (anchorElement: HTMLElement, placement: PopupPlacement, offsetLeft: number, offsetTop: number, minWidth?: number | string, dimensions?: {
11
- height: number;
12
- width: number;
13
- }) => {
14
- left: number;
15
- minWidth?: number | string;
16
- top: number;
17
- visibility?: Visibility;
18
- width?: number;
19
- };
@@ -1,2 +0,0 @@
1
- export * from "./Popup";
2
- export * from "./useAnchoredPosition";
@@ -1,7 +0,0 @@
1
- import { Position } from "./getPositionRelativeToAnchor";
2
- import { PopupComponentProps } from "./Popup";
3
- export type AnchoredPositionHookProps = Pick<PopupComponentProps, "anchorElement" | "minWidth" | "offsetLeft" | "offsetTop" | "placement" | "position">;
4
- export declare const useAnchoredPosition: ({ anchorElement, minWidth, offsetLeft, offsetTop, placement, position: positionProp, }: AnchoredPositionHookProps) => {
5
- position: Position | undefined;
6
- popupRef: ((el: HTMLDivElement | null) => void) | undefined;
7
- };
@@ -1,45 +0,0 @@
1
- import { ButtonProps } from "@salt-ds/core";
2
- import { MenuActionHandler, MenuBuilder } from "@vuu-ui/vuu-context-menu";
3
- import { HTMLAttributes, KeyboardEvent, RefObject } from "react";
4
- import { PopupPlacement } from "../popup/Popup";
5
- export type TabAwayClosePopup = {
6
- closedBy?: string;
7
- type: "tab-away";
8
- event: KeyboardEvent;
9
- };
10
- export type ClickAwayClosePopup = {
11
- closedBy?: string;
12
- type: "click-away";
13
- mouseEvt: MouseEvent;
14
- };
15
- export type EscapeClosePopup = {
16
- closedBy?: string;
17
- event: KeyboardEvent;
18
- type: "escape";
19
- };
20
- export type MenuActionClosePopup = {
21
- closedBy?: string;
22
- menuId: string;
23
- options: unknown;
24
- type: "menu-action";
25
- };
26
- export type PopupCloseReason = ClickAwayClosePopup | EscapeClosePopup | MenuActionClosePopup | TabAwayClosePopup;
27
- export type MenuCloseHandler = (reason?: PopupCloseReason) => void;
28
- export interface PopupMenuProps extends HTMLAttributes<HTMLButtonElement> {
29
- anchorElement?: RefObject<HTMLElement | null>;
30
- disabled?: boolean;
31
- icon?: string;
32
- label?: string;
33
- menuActionHandler?: MenuActionHandler;
34
- menuBuilder?: MenuBuilder;
35
- menuClassName?: string;
36
- menuLocation?: string;
37
- menuOptions?: {
38
- [key: string]: unknown;
39
- };
40
- onMenuClose?: MenuCloseHandler;
41
- onMenuOpen?: () => void;
42
- popupPlacement?: PopupPlacement;
43
- variant?: ButtonProps["variant"];
44
- }
45
- export declare const PopupMenu: ({ anchorElement, className, disabled, label, icon, id: idProp, menuActionHandler, menuBuilder, menuClassName, menuLocation, menuOptions, onMenuClose, onMenuOpen, popupPlacement, tabIndex, variant, ...htmlAttributes }: PopupMenuProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1 +0,0 @@
1
- export * from "./PopupMenu";
@@ -1,19 +0,0 @@
1
- import { AriaAttributes, MouseEvent } from "react";
2
- import { PopupMenuProps } from "./PopupMenu";
3
- import { PopupPlacement } from "../popup/Popup";
4
- export interface PopupMenuHookProps extends Pick<PopupMenuProps, "anchorElement" | "menuActionHandler" | "menuBuilder" | "menuClassName" | "menuOptions" | "onMenuClose" | "onMenuOpen"> {
5
- id: string;
6
- menuLocation: string;
7
- popupPlacement: PopupPlacement;
8
- tabIndex: number;
9
- }
10
- export declare const usePopupMenu: ({ anchorElement, id, menuActionHandler, menuBuilder, menuLocation, menuOptions, onMenuClose, onMenuOpen, popupPlacement, tabIndex, }: PopupMenuHookProps) => {
11
- ariaAttributes: AriaAttributes;
12
- buttonProps: {
13
- id: string;
14
- onClick: (e: MouseEvent<HTMLElement>) => void;
15
- tabIndex: number;
16
- };
17
- menuOpen: boolean;
18
- rootRef: import("react").RefObject<HTMLButtonElement | null>;
19
- };
@@ -1,42 +0,0 @@
1
- import { ThemeAttributes } from "@vuu-ui/vuu-utils";
2
- import { ReactNode } from "react";
3
- export interface PortalProps {
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
- * Id of element into which portal will be rendered. If this node does not exist on the document,
18
- * it will be created for you. If more than one value is provided, the first element found will
19
- * be used.
20
- */
21
- id?: string | string[];
22
- /**
23
- * Callback invoked immediately after render (in layoutEffect). Can be
24
- * used to check position vis-a-vis viewport and adjust if out of bounds
25
- */
26
- onRender?: () => void;
27
- /**
28
- * Allow conditional rendering of this Portal, if false, will render nothing.
29
- * Defaults to true
30
- */
31
- open?: boolean;
32
- /**
33
- * ThemeAttributes can be passed in for cases where ContextMenu is
34
- * rendered via popup-service showPopup, outside the Context hierarchy.
35
- */
36
- themeAttributes?: ThemeAttributes;
37
- }
38
- /**
39
- * Portals provide a first-class way to render children into a DOM node
40
- * that exists outside the DOM hierarchy of the parent component.
41
- */
42
- export declare const Portal: ({ children, container: containerProp, id, onRender, open, themeAttributes, }: PortalProps) => import("react").ReactPortal | null;
@@ -1 +0,0 @@
1
- export * from "./Portal";
@@ -1,13 +0,0 @@
1
- import { HTMLAttributes } from "react";
2
- import { PopupComponentProps } from "../popup";
3
- export interface PromptProps extends HTMLAttributes<HTMLDialogElement> {
4
- PopupProps?: Partial<PopupComponentProps>;
5
- cancelButtonLabel?: string;
6
- confirmButtonLabel?: string;
7
- onCancel: () => void;
8
- onConfirm: () => void;
9
- icon?: string;
10
- text: string;
11
- variant?: "warn" | "error" | "info";
12
- }
13
- export declare const Prompt: ({ PopupProps, cancelButtonLabel, confirmButtonLabel, icon, onCancel, onConfirm, style, text, title, variant, ...htmlAttributes }: PromptProps) => import("react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- export * from "./Prompt";
@@ -1,15 +0,0 @@
1
- import { CSSProperties, MouseEventHandler, ReactNode, RefObject } from "react";
2
- import { TooltipPlacement } from "./useTooltipAnchoredPosition";
3
- export type TooltipStatus = "warning" | "error" | "info";
4
- export interface TooltipProps {
5
- anchorElement: RefObject<HTMLElement | null>;
6
- children: ReactNode;
7
- className?: string;
8
- id?: string;
9
- onMouseEnter: MouseEventHandler;
10
- onMouseLeave: MouseEventHandler;
11
- placement: TooltipPlacement | TooltipPlacement[];
12
- status?: TooltipStatus;
13
- style?: CSSProperties;
14
- }
15
- export declare const Tooltip: ({ anchorElement, children, className, id, onMouseEnter, onMouseLeave, placement: placementProp, status, style: styleProp, }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +0,0 @@
1
- export * from "./Tooltip";
2
- export * from "./useTooltip";
@@ -1,19 +0,0 @@
1
- import { MouseEvent, ReactNode } from "react";
2
- import { TooltipProps } from "./Tooltip";
3
- import { TooltipPlacement } from "./useTooltipAnchoredPosition";
4
- export interface TooltipHookProps {
5
- anchorQuery?: string;
6
- id: string;
7
- placement?: TooltipPlacement | TooltipPlacement[];
8
- tooltipContent: ReactNode;
9
- }
10
- export declare const useTooltip: ({ anchorQuery, id: idProp, placement, tooltipContent, }: TooltipHookProps) => {
11
- anchorProps: {
12
- "aria-describedby": string;
13
- onMouseEnter: (evt: MouseEvent) => void;
14
- onMouseLeave: () => void;
15
- };
16
- hideTooltip: (defer?: number) => void;
17
- showTooltip: (ref?: import("react").RefObject<HTMLElement | null>) => void;
18
- tooltipProps: TooltipProps | undefined;
19
- };
@@ -1,7 +0,0 @@
1
- import { RefCallback, RefObject } from "react";
2
- export type TooltipPlacement = "above" | "right" | "below" | "left";
3
- export interface TooltipAnchoredPositionHookProps {
4
- anchorElement: RefObject<HTMLElement | null>;
5
- placement: TooltipPlacement | TooltipPlacement[];
6
- }
7
- export declare const useTooltipAnchoredPosition: ({ anchorElement, placement, }: TooltipAnchoredPositionHookProps) => RefCallback<HTMLDivElement>;