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 { TOOLBAR_SEPARATOR_KEYS } from "./__keys";
|
9 |
|
10 | export type ToolbarSeparatorOptions = SeparatorOptions;
|
11 |
|
12 | export type ToolbarSeparatorHTMLProps = SeparatorHTMLProps;
|
13 |
|
14 | export type ToolbarSeparatorProps = ToolbarSeparatorOptions &
|
15 | ToolbarSeparatorHTMLProps;
|
16 |
|
17 | export const useToolbarSeparator = createHook<
|
18 | ToolbarSeparatorOptions,
|
19 | ToolbarSeparatorHTMLProps
|
20 | >({
|
21 | name: "ToolbarSeparator",
|
22 | compose: useSeparator,
|
23 | keys: TOOLBAR_SEPARATOR_KEYS,
|
24 |
|
25 | useOptions({ orientation = "vertical", ...options }) {
|
26 | return {
|
27 | orientation: orientation === "vertical" ? "horizontal" : "vertical",
|
28 | ...options,
|
29 | };
|
30 | },
|
31 | });
|
32 |
|
33 | export const ToolbarSeparator = createComponent({
|
34 | as: "hr",
|
35 | memo: true,
|
36 | useHook: useToolbarSeparator,
|
37 | });
|