UNPKG

950 BPlain TextView Raw
1import * as React from "react";
2import { createComponent } from "reakit-system/createComponent";
3import { createHook } from "reakit-system/createHook";
4import {
5 CompositeItemOptions,
6 CompositeItemHTMLProps,
7 useCompositeItem,
8} from "../Composite/CompositeItem";
9import { GRID_CELL_KEYS } from "./__keys";
10
11export type unstable_GridCellOptions = CompositeItemOptions;
12
13export type unstable_GridCellHTMLProps = CompositeItemHTMLProps &
14 React.TdHTMLAttributes<any>;
15
16export type unstable_GridCellProps = unstable_GridCellOptions &
17 unstable_GridCellHTMLProps;
18
19export const unstable_useGridCell = createHook<
20 unstable_GridCellOptions,
21 unstable_GridCellHTMLProps
22>({
23 name: "GridCell",
24 compose: useCompositeItem,
25 keys: GRID_CELL_KEYS,
26
27 useProps(_, htmlProps) {
28 return { role: "gridcell", ...htmlProps };
29 },
30});
31
32export const unstable_GridCell = createComponent({
33 as: "span",
34 memo: true,
35 useHook: unstable_useGridCell,
36});