1 | import { createComponent } from "reakit-system/createComponent";
|
2 | import { createHook } from "reakit-system/createHook";
|
3 | import {
|
4 | SeparatorOptions,
|
5 | SeparatorHTMLProps,
|
6 | useSeparator,
|
7 | } from "../Separator/Separator";
|
8 | import { MENU_SEPARATOR_KEYS } from "./__keys";
|
9 |
|
10 | export type MenuSeparatorOptions = SeparatorOptions;
|
11 |
|
12 | export type MenuSeparatorHTMLProps = SeparatorHTMLProps;
|
13 |
|
14 | export type MenuSeparatorProps = MenuSeparatorOptions & MenuSeparatorHTMLProps;
|
15 |
|
16 | export const useMenuSeparator = createHook<
|
17 | MenuSeparatorOptions,
|
18 | MenuSeparatorHTMLProps
|
19 | >({
|
20 | name: "MenuSeparator",
|
21 | compose: useSeparator,
|
22 | keys: MENU_SEPARATOR_KEYS,
|
23 |
|
24 | useOptions({ orientation = "vertical", ...options }) {
|
25 | return {
|
26 | orientation: orientation === "vertical" ? "horizontal" : "vertical",
|
27 | ...options,
|
28 | };
|
29 | },
|
30 | });
|
31 |
|
32 | export const MenuSeparator = createComponent({
|
33 | as: "hr",
|
34 | memo: true,
|
35 | useHook: useMenuSeparator,
|
36 | });
|