1 | import { createComponent } from "reakit-system/createComponent";
|
2 | import { createHook } from "reakit-system/createHook";
|
3 | import {
|
4 | CompositeItemOptions,
|
5 | CompositeItemHTMLProps,
|
6 | useCompositeItem,
|
7 | } from "../Composite/CompositeItem";
|
8 | import { COMBOBOX_OPTION_KEYS } from "./__keys";
|
9 | import {
|
10 | unstable_ComboboxItemOptions as ComboboxItemOptions,
|
11 | unstable_ComboboxItemHTMLProps as ComboboxItemHTMLProps,
|
12 | unstable_useComboboxItem as useComboboxItem,
|
13 | } from "./ComboboxItem";
|
14 |
|
15 | export const unstable_useComboboxOption = createHook<
|
16 | unstable_ComboboxOptionOptions,
|
17 | unstable_ComboboxOptionHTMLProps
|
18 | >({
|
19 | name: "ComboboxOption",
|
20 | compose: [useComboboxItem, useCompositeItem],
|
21 | keys: COMBOBOX_OPTION_KEYS,
|
22 |
|
23 | useProps(_, htmlProps) {
|
24 | return { role: "option", ...htmlProps };
|
25 | },
|
26 | });
|
27 |
|
28 | export const unstable_ComboboxOption = createComponent({
|
29 | as: "div",
|
30 | memo: true,
|
31 | useHook: unstable_useComboboxOption,
|
32 | });
|
33 |
|
34 | export type unstable_ComboboxOptionOptions = CompositeItemOptions &
|
35 | ComboboxItemOptions;
|
36 |
|
37 | export type unstable_ComboboxOptionHTMLProps = CompositeItemHTMLProps &
|
38 | ComboboxItemHTMLProps;
|
39 |
|
40 | export type unstable_ComboboxOptionProps = unstable_ComboboxOptionOptions &
|
41 | unstable_ComboboxOptionHTMLProps;
|