UNPKG

@hypothesis/frontend-shared

Version:

Shared components, styles and utilities for Hypothesis projects

72 lines (71 loc) 2.89 kB
/** * Components for laying out content within a consistently-styled container */ /** * @typedef {import('preact').ComponentChildren} Children * @typedef {import('preact').JSX.HTMLAttributes<HTMLDivElement>} HTMLDivAttributes * @typedef {import('preact').Ref<HTMLElement>} ElementRef */ /** * @typedef CommonPresentationalProps * @prop {Children} [children] * @prop {string|string[]} [classes] - Optional extra CSS classes to append to * the component's default classes * @prop {ElementRef} [containerRef] - Deprecated; use * `elementRef` instead. * @prop {ElementRef} [elementRef] * * @typedef {HTMLDivAttributes & CommonPresentationalProps} PresentationalProps */ /** * Render content inside of a "frame" * * @deprecated - Use Card component in the layout group * @param {PresentationalProps} props */ export function Frame({ children, classes, containerRef, elementRef, ...restProps }: PresentationalProps): import("preact").JSX.Element; /** * Render content inside of a "card" * * @deprecated - Use re-implemented Card component in the layout group * @param {PresentationalProps} props */ export function Card({ children, classes, containerRef, elementRef, ...restProps }: PresentationalProps): import("preact").JSX.Element; /** * Render a set of actions (typically buttons) laid out either horizontally * by default or vertically. * * @deprecated - Use CardActions component in the layout group * @param {{ direction?: 'row'|'column'} & PresentationalProps} props */ export function Actions({ children, direction, classes, containerRef, elementRef, ...restProps }: { direction?: 'row' | 'column'; } & PresentationalProps): import("preact").JSX.Element; /** * Render a scrollable container to contain content that might overflow. * Optionally provide styling affordances for a sticky header (`withHeader`). * * @deprecated - Use re-implemented ScrollBox component in the data-display group * @param {{withHeader?: boolean} & PresentationalProps} props */ export function Scrollbox({ children, classes, containerRef, elementRef, withHeader, ...restProps }: { withHeader?: boolean; } & PresentationalProps): import("preact").JSX.Element; export type Children = import('preact').ComponentChildren; export type HTMLDivAttributes = import('preact').JSX.HTMLAttributes<HTMLDivElement>; export type ElementRef = import('preact').Ref<HTMLElement>; export type CommonPresentationalProps = { children?: Children; /** * - Optional extra CSS classes to append to * the component's default classes */ classes?: string | string[] | undefined; /** * - Deprecated; use * `elementRef` instead. */ containerRef?: import("preact").Ref<HTMLElement> | undefined; elementRef?: import("preact").Ref<HTMLElement> | undefined; }; export type PresentationalProps = HTMLDivAttributes & CommonPresentationalProps;