UNPKG

697 BPlain TextView Raw
1import * as React from "react";
2import { createComponent } from "reakit-system/createComponent";
3import { createHook } from "reakit-system/createHook";
4import {
5 TabbableOptions,
6 TabbableHTMLProps,
7 useTabbable,
8} from "../Tabbable/Tabbable";
9import { INPUT_KEYS } from "./__keys";
10
11export type InputOptions = TabbableOptions;
12
13export type InputHTMLProps = TabbableHTMLProps & React.InputHTMLAttributes<any>;
14
15export type InputProps = InputOptions & InputHTMLProps;
16
17export const useInput = createHook<InputOptions, InputHTMLProps>({
18 name: "Input",
19 compose: useTabbable,
20 keys: INPUT_KEYS,
21});
22
23export const Input = createComponent({
24 as: "input",
25 memo: true,
26 useHook: useInput,
27});