goobs-frontend
Version:
A comprehensive React-based libary for building modern web applications
96 lines • 3.83 kB
TypeScript
import { default as React } from 'react';
/**
* Caller-supplied styling + theme selection for the Popover surface.
*
* Theme palette / radius / shadow / border / blur / transition live in
* `Popover.module.css` keyed off `data-theme`. The fields below are
* OPTIONAL caller overrides — when set they win over the CSS defaults
* via inline style, preserving the old `getPopoverStyles` override
* semantics exactly. Anchor positioning is computed at runtime from
* `getBoundingClientRect()` and piped in via CSS custom properties.
*/
export interface PopoverStyles {
/** Theme variant: 'light' (default), 'dark', or 'sacred'. */
theme?: 'light' | 'dark' | 'sacred';
/** Surface background color. */
backgroundColor?: string;
/** Surface border color; composes `<borderWidth> solid <borderColor>` (no border override without it). */
borderColor?: string;
/** Surface border radius. */
borderRadius?: string;
/** Border width used with borderColor (default 1px); ignored without borderColor. */
borderWidth?: string;
/** Surface box shadow. */
boxShadow?: string;
/** Surface backdrop-filter (e.g. a blur). */
backdropFilter?: string;
/** Surface background-image. */
backgroundImage?: string;
/** Surface max-width. */
maxWidth?: string;
/** Surface width. */
width?: string;
/** Surface min-width. */
minWidth?: string;
/** Surface height. */
height?: string;
/** Surface max-height. */
maxHeight?: string;
/** Surface min-height. */
minHeight?: string;
/** Surface padding. */
padding?: string;
/** Surface margin. */
margin?: string;
/** Surface top margin. */
marginTop?: string;
/** Surface z-index. */
zIndex?: number;
/** CSS position override (default: fixed via the CSS module). */
position?: string;
/** CSS `top`; replaces the anchor-derived position (default: the anchor rect's bottom). */
top?: string;
/** CSS `left`; replaces the anchor-derived position (default: the anchor rect's left). */
left?: string;
/** CSS `right`. */
right?: string;
/** CSS `bottom`. */
bottom?: string;
/** Replaces the surface transition with `all <duration> <easing>`. */
transitionDuration?: string;
/** Easing used with transitionDuration (default cubic-bezier(0.4, 0, 0.2, 1)); ignored without it. */
transitionEasing?: string;
}
export interface PopoverProps {
/** Whether the popover is open */
open: boolean;
/** Function to call when the popover should close */
onClose: () => void;
/** The anchor element to position the popover relative to */
anchorEl: HTMLElement | null;
/** The content to display in the popover */
children: React.ReactNode;
/** Custom styles to apply to the popover using the theme system */
styles?: PopoverStyles;
/**
* ARIA role for the rendered surface. Defaults to `"dialog"`. Use
* `"menu"` for action lists, `"tooltip"` for hover-tip content,
* `"listbox"` for option pickers. Drives screenreader semantics.
*/
role?: 'dialog' | 'menu' | 'tooltip' | 'listbox' | 'grid' | 'region';
/** `aria-label` on the popover surface — used when no labelled-by id. */
ariaLabel?: string;
/** `aria-labelledby` — id of the heading inside `children`. */
ariaLabelledBy?: string;
/**
* Stable test selector emitted as `data-popover="<value>"` on the
* popover root. Convention is a kebab-cased noun like
* `"row-actions"`, `"date-picker"`, `"filter-menu"`.
*/
dataPopover?: string;
/** Singular entity noun emitted as `data-subject="<value>"`. */
dataSubject?: string;
}
declare const Popover: React.FC<PopoverProps>;
export default Popover;
//# sourceMappingURL=index.d.ts.map