/** * `@shalecss/react` is a React component library that provides a thin wrapper * around `@shalecss/core` CSS styles. * * @packageDocumentation */ import type { ComponentPropsWithoutRef } from 'react'; import type { ElementType } from 'react'; import type { FC } from 'react'; /** @alpha */ export declare interface BaseButtonProps { /** The variant of the button */ variant?: "primary" | "secondary"; /** The initial state of the button (if you want to force a specific state) */ state?: StateVariant; } /** @alpha */ export declare interface BaseCommandBarProps { /** Whether to make the command bar grow to fill available space */ flexGrow?: boolean; /** Whether to add padding around the command bar */ gutter?: boolean; } /** @alpha */ export declare interface BaseFlexContainerProps { /** The flex layout variant */ variant?: "space-between" | "center" | "align-center"; } /** @alpha */ export declare interface BaseHeaderProps { /** The initial state of the header (if you want to force a specific state) */ state?: StateVariant; /** Move the border to the top instead of the bottom */ invertBorder?: boolean; /** More compact styles for use in a titlebar */ compact?: boolean; } /** @alpha */ export declare interface BaseLinkProps { /** The initial state of the link (if you want to force a specific state) */ state?: StateVariant; /** Shows an external link icon */ isExternal?: boolean; } /** @alpha */ export declare interface BaseMenuBarButtonProps { /** Whether this menu item is the current page */ current?: boolean; /** * The initial state of the menu button (if you want to force a specific * state) */ state?: StateVariant; } /** * The `Button` component is based off of the HTML `; * ``` * * @example With icon * * ```tsx * ; * ``` * * @alpha */ export declare const Button: PolymorphicComponent<"button", BaseButtonProps>; /** * `CaptionButton` component provide specialized button and menu styling, * typically used for window controls or the header. * * Must be used within a {@link CaptionMenu} component. * * @alpha */ export declare const CaptionButton: PolymorphicComponent<"button", CaptionButtonProps>; /** @alpha */ export declare interface CaptionButtonProps { /** The content of the `CaptionButton`. */ children?: React.ReactNode; /** Props for the wrapper element. */ wrapperProps?: React.HTMLAttributes; } /** * A `CaptionMenu` component serves as a container for {@link CaptionButton}, * arranging them in a horizontal layout suitable for window controls. * * @example Window controls * * ```tsx *
* * My Application * * * * × * * *
; * ``` * * @alpha */ export declare const CaptionMenu: PolymorphicComponent<"span", {}>; /** * `Card` is a flexible container based on {@link FlexItem} that provides a * card-like visual presentation with optional shadow variants. * * @example Basic usage * * ```tsx * This is a card with a moderate shadow; * ``` * * @example With different shadows * * ```tsx * * * subtle shadows * * * moderate shadows * * * puffy shadows * * ; * ``` * * @alpha */ export declare const Card: PolymorphicComponent; /** @alpha */ export declare interface CardProps { /** The type of shadow to apply to the card */ shadow?: ShadowVariant; } /** * An inline code component. * * @example Basic usage * * ```tsx *

* Use the npm install command to install dependencies. *

; * ``` * * @example Block code * * ```tsx * * def get_a_million_dollars(): return P == NP * print(get_a_million_dollars()) * ; * ``` * * @alpha */ export declare const Code: PolymorphicComponent<"code">; /** * The `CommandBar` component provides a container for command-based UI * elements, typically used for toolbars or action bars. * * @example Basic usage * * ```tsx * * * * * ; * ``` * * @alpha */ export declare const CommandBar: PolymorphicComponent; /** @alpha */ export declare type ComponentProp = { /** * Overrides the base React component / HTML element that is used for this * component */ Component?: C; }; /** * Container components provide layout structure and organization. * * @example Basic usage * * ```tsx * Content goes here; * ``` * * @alpha */ export declare const Container: PolymorphicComponent<"div", {}>; /** * The Dialog component is a modal dialog box that overlays the current page. It * is based on the native HTML `` element and cannot be moved or * resized. * * @example Basic usage with actions * * ```tsx * <> * * * *
* * This is a dialog * * * * × * * *
* *

Here, have some actions to choose from.

*
* * * * * *
* ; * ``` * * @alpha */ export declare const Dialog: FC; /** @alpha */ export declare interface DialogProps extends React.HTMLAttributes { } /** * A flexible container with built-in flexbox layout variants. * * @example Space between * * ```tsx * * Left * Right * ; * ``` * * @example Center * * ```tsx * * Centered Content * ; * ``` * * @example Align center * * ```tsx * * Vertically Centered Content * ; * ``` * * @alpha */ export declare const FlexContainer: PolymorphicComponent<"div", BaseFlexContainerProps>; /** * A flex form component that aligns all form items in a single line. * * @example Basic usage * * ```tsx * { * e.preventDefault(); * alert("Form submitted!"); * }} * > * * * * * ; * ``` * * @alpha */ export declare const FlexForm: PolymorphicComponent<"form", {}>; /** * A flex item component. Components like {@link Card} are based on this. * * @example Flex grow * * ```tsx * This item will grow to fill space; * ``` * * @example Half flex * * ```tsx * * half * half * ; * ``` * * @example Third flex * * ```tsx * * third * third * third * ; * ``` * * @example Quarter flex * * ```tsx * * quarter * quarter * quarter * quarter * ; * ``` * * @example Fractional flex * * ```tsx *
* Half width * Half width *
; * ``` * * @example Weird flex but ok * * ```tsx *
* * Grows twice as much * * * Grows once * *
; * ``` * * @alpha */ export declare const FlexItem: PolymorphicComponent<"div", FlexItemProps>; /** @alpha */ export declare type FlexItemProps = { /** The flex grow value */ flex?: "grow" | "half" | "third" | "quarter"; } | { /** The flex grow value as a CSS value */ flex: "custom"; /** The custom flex grow value */ flexAmount: string; }; /** * A footer component for displaying stuff at the so-called "foot". * * @example Basic usage * * ```tsx *
* *

(c) [current year] banana farmers LLC. All rights reserved

*
*
; * ``` * * @alpha */ export declare const Footer: PolymorphicComponent<"footer", {}>; /** * A heading level 1 component. * * @example Basic usage * * ```tsx *

Main Page Title

; * ``` * * @alpha */ export declare const H1: PolymorphicComponent<"h1">; /** * A heading level 2 component. * * @example Basic usage * * ```tsx *

Section Title

; * ``` * * @alpha */ export declare const H2: PolymorphicComponent<"h2">; /** * A heading level 3 component. * * @example Basic usage * * ```tsx *

Subsection Title

; * ``` * * @alpha */ export declare const H3: PolymorphicComponent<"h3">; /** * A heading level 4 component. * * @example Basic usage * * ```tsx *

Minor Heading

; * ``` * * @alpha */ export declare const H4: PolymorphicComponent<"h4">; /** * A heading level 5 component. * * @example Basic usage * * ```tsx *
Small Heading
; * ``` * * @alpha */ export declare const H5: PolymorphicComponent<"h5">; /** * A heading level 6 component. * * @example Basic usage * * ```tsx *
Smallest Heading
; * ``` * * @alpha */ export declare const H6: PolymorphicComponent<"h6">; /** * A header component. * * @example Simple example * * ```tsx *
* * example header bar (just the header) * *
; * ``` * * @example With disabled state * * ```tsx *
* * example header bar (disabled) * * *
; * ``` * * @example With all the bells and whistles * * ```tsx *
* * * example header bar with all the bells and whistles * * * * * * * * * * * * * * * * * * * * * * (command bar for optional actions) * *
; * ``` * * @alpha */ export declare const Header: PolymorphicComponent<"header", BaseHeaderProps>; /** * Text for the header component, for use in {@link HeaderTitle}. * * @example Basic usage * * ```tsx * A description or subtitle for the header.; * ``` * * @alpha */ export declare const HeaderText: PolymorphicComponent<"p", {}>; /** * A header title component, for use in {@link Header}. * * @example Basic usage * * ```tsx * My Application; * ``` * * @alpha */ export declare const HeaderTitle: PolymorphicComponent<"div", {}>; /** * The `Icon` component displays SVG icons from an icon sprite sheet using SVG's * `` element. * * @example Basic icon * * ```tsx * ; * ``` * * @example Flipped icon * * ```tsx * ; * ``` * * @example All icons provided by default * * ```tsx * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ; * ``` * * @alpha */ export declare const Icon: React.FC; /** @alpha */ export declare interface IconProps extends React.SVGAttributes { /** The icon ID from the icons.svg sprite */ icon: string; /** Whether to flip the icon horizontally */ flipX?: boolean; /** Whether to flip the icon vertically */ flipY?: boolean; /** The path to the icons.svg file */ iconPath?: string; } /** * An input component. The `type` prop is required if you want styling. * * @example Basic inputs * * ```tsx * * * * * * * * * * * * * * * * ; * ``` * * @example Disabled inputs * * ```tsx * * * * * * * * * * * * * * * * ; * ``` * * @example Input with label * * ```tsx * ; * ``` * * @example Checkboxes and radios * * ```tsx * * (document.getElementById("checkbox2").indeterminate = true) * } * > * * * * * * * ; * ``` * * @example Disabled checkboxes and radios * * ```tsx * * (document.getElementById("checkbox5").indeterminate = true) * } * > * * * * * * * ; * ``` * * @alpha */ export declare const Input: React.FC; /** @alpha */ export declare interface InputProps extends React.ComponentProps<"input"> { /** The label text for the input */ label?: string; /** The id for the input (used with label) */ id?: string; } /** * A link component. * * External links (links with `target="_blank"`) will automatically show an * external link icon, but you can also explicitly set `isExternal` to `true` to * show the icon, or set it to `false` to hide the icon. * * @example Basic link * * ```tsx * Visit Example; * ``` * * @example Link with forced state * * ```tsx * * Hovered Link * ; * ``` * * @example External link * * ```tsx * * Go to Example * ; * ``` * * @alpha */ export declare const Link: PolymorphicComponent<"a", BaseLinkProps>; /** * A menu bar button component. * * @example Basic menu button * * ```tsx * Page Link; * ``` * * @example Current page indicator * * ```tsx * * Current Page * ; * ``` * * @alpha */ export declare const MenuBarButton: PolymorphicComponent<"a", BaseMenuBarButtonProps>; /** * The navigation component. We expect you to use {@link MenuBarButton} inside as * well as wrap this in a Header. * * @example Basic navigation * * ```tsx * ; * ``` * * @alpha */ export declare const Nav: PolymorphicComponent<"nav", {}>; /** * A note component to highlight important information. * * @example Info note * * ```tsx * * Note * This is an informational note. * ; * ``` * * @example Alert note * * ```tsx * * Alert * This is an alert message! * ; * ``` * * @example Warning note * * ```tsx * * Warning * This is a warning message. * ; * ``` * * @example Tip note * * ```tsx * * Tip * This is a helpful tip. * ; * ``` * * @alpha */ export declare const Note: PolymorphicComponent; /** @alpha */ export declare interface NoteProps { /** The variant/type of note */ variant: "info" | "alert" | "warn" | "tip"; } /** * A text component for the content inside a Note. * * @example Basic usage * * ```tsx * Content inside a note.; * ``` * * @alpha */ export declare const NoteText: PolymorphicComponent<"p", {}>; /** * A paragraph component. * * @example Basic usage * * ```tsx *

This is a paragraph of text.

; * ``` * * @alpha */ export declare const P: PolymorphicComponent<"p">; /** * A helper type for a component which allows any HTML element to be used as the * base component * * @alpha */ export declare type PolymorphicComponent = (props: PolymorphicComponentProp>) => ReturnType>; /** @alpha */ export declare type PolymorphicComponentProp = Props & Omit, keyof (ComponentProp & Props)> & ComponentProp; /** * A select component. * * @example Basic select * * ```tsx * ; * ``` * * @alpha */ export declare const Select: React.FC; /** @alpha */ export declare interface SelectProps extends React.SelectHTMLAttributes { /** The initial state of the select (if you want to force a specific state) */ state?: StateVariant; } /** @alpha */ export declare type ShadowVariant = "subtle" | "moderate" | "puffy"; /** * A skip to content link component for accessibility. This link becomes visible * when focused, allowing keyboard users to skip navigation and jump directly to * main content. * * @alpha */ export declare const SkipToContent: PolymorphicComponent<"a">; /** @alpha */ export declare type StateVariant = "hover" | "active" | "focus" | "disabled"; /** * A textarea component. * * @example Basic textarea * * ```tsx *