UNPKG

@eccenca/gui-elements

Version:

GUI elements based on other libraries, usable in React application, written in Typescript.

65 lines (64 loc) 2.73 kB
import React from "react"; import { OverlayProps as BlueprintOverlayProps, SpinnerProps as BlueprintSpinnerProps } from "@blueprintjs/core"; import Color from "color"; import { ButtonProps } from "./../Button/Button"; type SpinnerPosition = "local" | "inline" | "global"; type SpinnerSize = "tiny" | "small" | "medium" | "large" | "xlarge" | "inherit"; type SpinnerStroke = "thin" | "medium" | "bold"; /** A spinner that is either displayed globally or locally. */ export interface SpinnerProps extends Omit<BlueprintSpinnerProps, "size" | "intent" | "color"> { /** * Must be a valid css color definition. * `intent` property will always overwrite this setting. */ color?: Color | string | "inherit"; /** * Intent state of the spinner. * When used the spinner is colored. * Property overwrites `elevated` setting. */ intent?: ButtonProps["intent"]; /** * Highlight the spinner. * It is displayed with accent color intent. */ elevated?: boolean; /** * Additional CSS class names. */ className?: string; /** * Position where and how the spinner is displayed: * * `local`: the spinner is displayed as centered overlay to the neareast parent with relative (or equivalent) positioning * * `inline`: the spinner is displayed as inline element * * `global`: the spinner is displayed including backdrop centered over the full viewport */ position?: SpinnerPosition; /** * The size of the spinner. * The default size relates to the `position`. */ size?: SpinnerSize; /** * The stroke width that is used to visualize the spinner. * The default size relates to the `position`. * There are only rare cases to set this property, */ stroke?: SpinnerStroke; /** * Delay when to show the spinner in ms. */ delay?: number; /** * Includes a backdrop behind the spinner that narrows visibility of the area behind the spinner. * This option only works with "local" spinners, for "inline" spinners there is no backdrop, "global" spinners always have backdrops. * The backdrop and the spinner are located over the nearest parent element that is styled by `position: relative` or some other CSS rule with an equivalent outcome. */ showLocalBackdrop?: boolean; /** * Use this property to alter the display of the backdrop used for the global spinner */ overlayProps?: BlueprintOverlayProps; } export declare const Spinner: ({ className, color, intent, elevated, position, size, stroke, showLocalBackdrop, delay, overlayProps, ...otherProps }: SpinnerProps) => React.JSX.Element | null; export default Spinner;