@hypothesis/frontend-shared
Version: 
Shared components, styles and utilities for Hypothesis projects
85 lines (84 loc) • 2.74 kB
TypeScript
/**
 * Props common to components that play a primarily presentational role.
 *
 * @typedef PresentationalProps
 * @prop {import('preact').ComponentChildren} [children]
 * @prop {string|string[]} [classes] - Optional extra CSS classes to append to the
 *   component's default classes
 * @prop {never} [className] - Use variants, props, unstyled component (when
 *   available) or `classes` instead
 * @prop {import('preact').Ref<HTMLElement>} [elementRef] - Ref for component's
 *   outermost element.
 */
/**
 * Props common to components that are opinionated compositions of other
 * components.
 *
 * @typedef {Omit<PresentationalProps, 'classes'>} CompositeProps
 */
/**
 * Props common to Base, abstract components. These are not part of the
 * package API.
 *
 * @typedef BaseProps
 * @prop {import('preact').ComponentChildren} [children]
 * @prop {string} className - Base components require a className for base
 *   styling.
 * @prop {never} [classes] - Use `className` instead
 * @prop {import('preact').Ref<HTMLElement>} [elementRef]
 */
/**
 * A type describing any of the standalone icon components, which take any
 * valid `<svg>` element attribute as props.
 *
 *  @typedef {import('preact').FunctionComponent<import('preact').JSX.SVGAttributes<SVGSVGElement>>} IconComponent
 */
export const unused: {};
/**
 * Props common to components that play a primarily presentational role.
 */
export type PresentationalProps = {
    children?: import('preact').ComponentChildren;
    /**
     * - Optional extra CSS classes to append to the
     * component's default classes
     */
    classes?: string | string[] | undefined;
    /**
     * - Use variants, props, unstyled component (when
     * available) or `classes` instead
     */
    className?: undefined;
    /**
     * - Ref for component's
     * outermost element.
     */
    elementRef?: import("preact").Ref<HTMLElement> | undefined;
};
/**
 * Props common to components that are opinionated compositions of other
 * components.
 */
export type CompositeProps = Omit<PresentationalProps, 'classes'>;
/**
 * Props common to Base, abstract components. These are not part of the
 * package API.
 */
export type BaseProps = {
    children?: import('preact').ComponentChildren;
    /**
     * - Base components require a className for base
     * styling.
     */
    className: string;
    /**
     * - Use `className` instead
     */
    classes?: undefined;
    elementRef?: import("preact").Ref<HTMLElement> | undefined;
};
/**
 * A type describing any of the standalone icon components, which take any
 * valid `<svg>` element attribute as props.
 */
export type IconComponent = import('preact').FunctionComponent<import('preact').JSX.SVGAttributes<SVGSVGElement>>;