import { MaybeAccessor } from '@solid-primitives/utils'; import { JSX, Component } from 'solid-js'; declare type ItemKey = string | number; interface AsyncLoadable { /** * Whether the items are currently loading. */ isLoading?: MaybeAccessor; /** * Handler that is called when more items should be loaded, e.g. while scrolling near the bottom. */ onLoadMore?: () => any; } interface Expandable { /** * The currently expanded keys in the collection (controlled). */ expandedKeys?: MaybeAccessor | undefined>; /** * The initial expanded keys in the collection (uncontrolled). */ defaultExpandedKeys?: MaybeAccessor | undefined>; /** * Handler that is called when items are expanded or collapsed. */ onExpandedChange?: (keys: Set) => any; } interface KeyboardDelegate { /** Returns the key visually below the given one, or `undefined` for none. */ getKeyBelow?(key: ItemKey): ItemKey | undefined; /** Returns the key visually above the given one, or `undefined` for none. */ getKeyAbove?(key: ItemKey): ItemKey | undefined; /** Returns the key visually to the left of the given one, or `undefined` for none. */ getKeyLeftOf?(key: ItemKey): ItemKey | undefined; /** Returns the key visually to the right of the given one, or `undefined` for none. */ getKeyRightOf?(key: ItemKey): ItemKey | undefined; /** Returns the key visually one page below the given one, or `undefined` for none. */ getKeyPageBelow?(key: ItemKey): ItemKey | undefined; /** Returns the key visually one page above the given one, or `undefined` for none. */ getKeyPageAbove?(key: ItemKey): ItemKey | undefined; /** Returns the first key, or `undefined` for none. */ getFirstKey?(key?: ItemKey, global?: boolean): ItemKey | undefined; /** Returns the last key, or `undefined` for none. */ getLastKey?(key?: ItemKey, global?: boolean): ItemKey | undefined; /** Returns the next key after `fromKey` that matches the given search string, or `undefined` for none. */ getKeyForSearch?(search: string, fromKey?: ItemKey): ItemKey | undefined; } /** * A set of common DOM props that are allowed on any component * Ensure this is synced with DOMPropNames in utils/filterDOMProps. */ interface DOMProps { /** * The element's unique identifier. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */ id?: string; } interface TextInputDOMEvents { /** * Handler that is called when the user copies text. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/oncopy). */ onCopy?: JSX.EventHandlerUnion; /** * Handler that is called when the user cuts text. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/oncut). */ onCut?: JSX.EventHandlerUnion; /** * Handler that is called when the user pastes text. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/onpaste). */ onPaste?: JSX.EventHandlerUnion; /** * Handler that is called when a text composition system starts a new text composition session. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionstart_event). */ onCompositionStart?: JSX.EventHandlerUnion; /** * Handler that is called when a text composition system completes or cancels the current text composition session. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionend_event). */ onCompositionEnd?: JSX.EventHandlerUnion; /** * Handler that is called when a new character is received in the current text composition session. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionupdate_event). */ onCompositionUpdate?: JSX.EventHandlerUnion; /** * Handler that is called when text in the input is selected. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/select_event). */ onSelect?: JSX.EventHandlerUnion; /** * Handler that is called when the input value is about to be modified. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/beforeinput_event). */ onBeforeInput?: JSX.EventHandlerUnion; /** * Handler that is called when the input value is modified. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event). */ onInput?: JSX.EventHandlerUnion; } /** * DOM props that apply to all text inputs. * Ensure this is synced with useTextField */ interface TextInputDOMProps extends DOMProps, TextInputDOMEvents { /** * Describes the type of autocomplete functionality the input should provide if any. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautocomplete). */ autocomplete?: string; /** * The maximum number of characters supported by the input. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefmaxlength). */ maxLength?: number; /** * The minimum number of characters required by the input. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefminlength). */ minLength?: number; /** * The name of the input element, used when submitting an HTML form. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname). */ name?: string; /** * Regex pattern that the value of the input must match to be valid. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefpattern). */ pattern?: string; /** * Content that appears in the input when it is empty. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefplaceholder). */ placeholder?: string; /** * The type of input to render. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdeftype). */ type?: "text" | "search" | "url" | "tel" | "email" | "password" | string; /** * Hints at the type of data that might be entered by the user while editing the element or its contents. * See [MDN](https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute). */ inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search"; } /** * All HTML and SVG elements. */ declare type DOMElements = keyof JSX.IntrinsicElements; /** * Represent any HTML element or SolidJS component. */ declare type ElementType = DOMElements | Component; /** * A map of HTML element names and their interface types. * For example `'a'` -> `HTMLAnchorElement`. */ declare type IntrinsicHTMLElements = { [K in keyof JSX.IntrinsicElements]: JSX.IntrinsicElements[K] extends JSX.HTMLAttributes ? T : never; }; declare type HoverPointerType = "mouse" | "pen"; declare type PointerType = HoverPointerType | "touch" | "keyboard" | "virtual"; interface PressEvent { /** * The type of press event being fired. */ type: "pressstart" | "pressend" | "pressup" | "press"; /** * The pointer type that triggered the press event. */ pointerType: PointerType; /** * The target element of the press event. */ target: HTMLElement; /** * Whether the shift keyboard modifier was held during the press event. */ shiftKey: boolean; /** * Whether the ctrl keyboard modifier was held during the press event. */ ctrlKey: boolean; /** * Whether the meta keyboard modifier was held during the press event. */ metaKey: boolean; /** * Whether the alt keyboard modifier was held during the press event. */ altKey: boolean; } interface LongPressEvent extends Omit { /** * The type of long press event being fired. */ type: "longpressstart" | "longpressend" | "longpress"; } interface HoverEvent { /** * The type of hover event being fired. */ type: "hoverstart" | "hoverend"; /** * The pointer type that triggered the hover event. */ pointerType: HoverPointerType; /** * The target element of the hover event. */ target: HTMLElement; } interface PressEvents { /** * Handler that is called when the press is released over the target. */ onPress?: (e: PressEvent) => void; /** * Handler that is called when a press interaction starts. */ onPressStart?: (e: PressEvent) => void; /** * Handler that is called when a press interaction ends, either * over the target or when the pointer leaves the target. */ onPressEnd?: (e: PressEvent) => void; /** * Handler that is called when the press state changes. */ onPressChange?: (isPressed: boolean) => void; /** * Handler that is called when a press is released over the target, regardless of * whether it started on the target or not. */ onPressUp?: (e: PressEvent) => void; } interface HoverEvents { /** * Handler that is called when a hover interaction starts. */ onHoverStart?: (e: HoverEvent) => void; /** * Handler that is called when a hover interaction ends. */ onHoverEnd?: (e: HoverEvent) => void; /** * Handler that is called when the hover state changes. */ onHoverChange?: (isHovering: boolean) => void; } interface FocusEvents { /** * Handler that is called when the element receives focus. */ onFocus?: (e: FocusEvent) => void; /** * Handler that is called when the element loses focus. */ onBlur?: (e: FocusEvent) => void; /** * Handler that is called when the element's focus status changes. */ onFocusChange?: (isFocused: boolean) => void; } interface FocusWithinEvents { /** * Handler that is called when the element or a descendant receives focus. */ onFocusIn?: (e: FocusEvent) => void; /** * Handler that is called when the element and all descendants lose focus. */ onFocusOut?: (e: FocusEvent) => void; /** * Handler that is called when the the focus within state changes. */ onFocusWithinChange?: (isFocusWithin: boolean) => void; } interface KeyboardEvents { /** * Handler that is called when a key is pressed. */ onKeyDown?: (e: KeyboardEvent) => void; /** * Handler that is called when a key is released. */ onKeyUp?: (e: KeyboardEvent) => void; } interface FocusableProps extends FocusEvents, KeyboardEvents { /** * Whether the element should receive focus on render. */ autofocus?: boolean; } interface FocusableDOMProps extends DOMProps { /** * Whether to exclude the element from the sequential tab order. If true, * the element will not be focusable via the keyboard by tabbing. This should * be avoided except in rare scenarios where an alternative means of accessing * the element or its functionality via the keyboard is available. */ excludeFromTabOrder?: boolean; } declare type ValidationState = "valid" | "invalid"; interface Validation { /** * Whether the input should display its "valid" or "invalid" visual styling. */ validationState?: ValidationState; /** * Whether user input is required on the input before form submission. * Often paired with the `necessityIndicator` prop to add a visual indicator to the input. */ isRequired?: boolean; } interface AriaValidationProps { /** * Identifies the element that provides an error message for the object. * @see https://www.w3.org/TR/wai-aria-1.2/#aria-errormessage */ "aria-errormessage"?: string; } interface InputBase { /** * Whether the input is disabled. */ isDisabled?: boolean; /** * Whether the input can be selected but not changed by the user. */ isReadOnly?: boolean; } interface ValueBase { /** * The current value (controlled). */ value?: T; /** * The default value (uncontrolled). */ defaultValue?: T; /** * Handler that is called when the value changes. */ onChange?: (value: C) => void; } interface TextInputBase { /** * Temporary text that occupies the text input when it is empty. */ placeholder?: string; } interface HelpTextProps { /** * A description for the field. Provides a hint such as specific requirements for what to choose. */ description?: JSX.Element; /** * An error message for the field. */ errorMessage?: JSX.Element; } /** * A set of common labelling DOM props that are allowed on any component * Ensure this is synced with labelablePropNames in utils/filterDOMProps. */ interface AriaLabelingProps { /** * Defines a string value that labels the current element. */ "aria-label"?: string; /** * Identifies the element (or elements) that labels the current element. */ "aria-labelledby"?: string; /** * Identifies the element (or elements) that describes the object. */ "aria-describedby"?: string; /** * Identifies the element (or elements) that provide a detailed, extended description for the object. */ "aria-details"?: string; } interface LabelableProps { /** * The content to display as the label. * */ label?: JSX.Element; } declare type Direction = "ltr" | "rtl"; declare type Orientation = "horizontal" | "vertical"; interface SingleSelection { /** Whether the collection allows empty selection. */ disallowEmptySelection?: MaybeAccessor; /** The currently selected key in the collection (controlled). */ selectedKey?: MaybeAccessor; /** The initial selected key in the collection (uncontrolled). */ defaultSelectedKey?: MaybeAccessor; /** Handler that is called when the selection changes. */ onSelectionChange?: (key: ItemKey) => any; } declare type SelectionMode = "none" | "single" | "multiple"; declare type SelectionBehavior = "toggle" | "replace"; declare type SelectionType = "all" | Set; interface MultipleSelection { /** The type of selection that is allowed in the collection. */ selectionMode?: MaybeAccessor; /** Whether the collection allows empty selection. */ disallowEmptySelection?: MaybeAccessor; /** The currently selected keys in the collection (controlled). */ selectedKeys?: MaybeAccessor<"all" | Iterable | undefined>; /** The initial selected keys in the collection (uncontrolled). */ defaultSelectedKeys?: MaybeAccessor<"all" | Iterable | undefined>; /** Handler that is called when the selection changes. */ onSelectionChange?: (keys: SelectionType) => any; /** The currently disabled keys in the collection (controlled). */ disabledKeys?: MaybeAccessor | undefined>; } declare type FocusStrategy = "first" | "last"; declare type DisabledBehavior = "selection" | "all"; export { AriaLabelingProps, AriaValidationProps, AsyncLoadable, DOMElements, DOMProps, Direction, DisabledBehavior, ElementType, Expandable, FocusEvents, FocusStrategy, FocusWithinEvents, FocusableDOMProps, FocusableProps, HelpTextProps, HoverEvent, HoverEvents, HoverPointerType, InputBase, IntrinsicHTMLElements, ItemKey, KeyboardDelegate, KeyboardEvents, LabelableProps, LongPressEvent, MultipleSelection, Orientation, PointerType, PressEvent, PressEvents, SelectionBehavior, SelectionMode, SelectionType, SingleSelection, TextInputBase, TextInputDOMEvents, TextInputDOMProps, Validation, ValidationState, ValueBase };