Skip to content

Commit

Permalink
chore: added all keys
Browse files Browse the repository at this point in the history
  • Loading branch information
anuraghazra committed Aug 21, 2020
1 parent 7f06658 commit 6359fa7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 22 deletions.
13 changes: 1 addition & 12 deletions src/select/SelectDropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,7 @@ export type SelectDropdownOptions = CompositeProps &
const useSelectDropdown = createHook<SelectDropdownOptions, BoxHTMLProps>({
name: "selectDropdown",
compose: useComposite,
keys: [
"maxHeight",
"move",
"isDropdownOpen",
"items",
"selected",
"setSelected",
"setCurrentId",
"typehead",
"closeDropdown",
...SELECT_KEYS,
],
keys: ["maxHeight", ...SELECT_KEYS],

useProps(
{
Expand Down
2 changes: 1 addition & 1 deletion src/select/SelectItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type SelectItemHTMLProp = CompositeItemHTMLProps;
const useSelectItem = createHook<SelectItemOptions, SelectItemHTMLProp>({
name: "selectItem",
compose: useCompositeItem,
keys: ["setSelected", "selected", "value", ...SELECT_KEYS],
keys: ["value", ...SELECT_KEYS],
useProps({ setSelected, selected, value }, { ref: htmlRef, ...htmlProps }) {
return {
role: "option",
Expand Down
10 changes: 2 additions & 8 deletions src/select/SelectMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { createOnKeyDown } from "reakit-utils";
import { BoxHTMLProps } from "reakit/ts/Box/Box";
import { SelectStateReturn } from "./useSelectState";
import { createHook, createComponent } from "reakit-system";
import { SELECT_KEYS } from "./__keys";

export type SelectMenuOptions = Pick<
SelectStateReturn,
Expand All @@ -18,14 +19,7 @@ export type SelectMenuOptions = Pick<

const useSelectMenu = createHook<SelectMenuOptions, BoxHTMLProps>({
name: "SelectMenu",
keys: [
"setTypehead",
"isDropdownOpen",
"selected",
"onChange",
"openDropdown",
"closeDropdown",
],
keys: SELECT_KEYS,

useProps(
{
Expand Down
4 changes: 3 additions & 1 deletion src/select/SelectTrigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useForkRef } from "reakit-utils";
import { BoxHTMLProps } from "reakit/ts/Box/Box";
import { SelectStateReturn } from "./useSelectState";
import { createHook, createComponent } from "reakit-system";
import { SELECT_KEYS } from "./__keys";

export type SelectTriggerOptions = Pick<
SelectStateReturn,
Expand All @@ -12,7 +13,8 @@ export type SelectTriggerOptions = Pick<

const useSelectTrigger = createHook<SelectTriggerOptions, BoxHTMLProps>({
name: "selectTrigger",
keys: ["toggleDropdown", "isDropdownOpen"],
keys: SELECT_KEYS,

useProps({ toggleDropdown, isDropdownOpen }, { ref: htmlRef, ...htmlProps }) {
const ref = React.useRef<HTMLElement>(null);

Expand Down
13 changes: 13 additions & 0 deletions src/select/__keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,17 @@ export const SELECT_KEYS = [
"setSelectedId",
"registerPanel",
"unregisterPanel",
"allowMultiselect",
"typehead",
"setTypehead",
"setDropdown",
"openDropdown",
"closeDropdown",
"isDropdownOpen",
"toggleDropdown",
"removeSelected",
"selected",
"setSelected",
"_setSelected",
"isPlaceholder",
] as const;

0 comments on commit 6359fa7

Please sign in to comment.