Skip to content

Commit

Permalink
Unify component exports
Browse files Browse the repository at this point in the history
  • Loading branch information
csandman committed Oct 10, 2024
1 parent afb4e50 commit b8de3b6
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 28 deletions.
4 changes: 1 addition & 3 deletions src/chakra-components/control.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {
import type { SizeProps } from "../types";
import { useSize } from "../utils";

const Control = <
export const Control = <
Option,
IsMulti extends boolean,
Group extends GroupBase<Option>,
Expand Down Expand Up @@ -348,5 +348,3 @@ export const LoadingIndicator = <
/>
);
};

export default Control;
15 changes: 9 additions & 6 deletions src/chakra-components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,31 @@ import {
SelectContainer,
ValueContainer,
} from "./containers";
import Control, {
import {
ClearIndicator,
Control,
DropdownIndicator,
IndicatorSeparator,
LoadingIndicator,
} from "./control";
import Input from "./input";
import Menu, {
import { Input } from "./input";
import {
Group,
GroupHeading,
LoadingMessage,
Menu,
MenuList,
NoOptionsMessage,
Option,
} from "./menu";
import MultiValue, {
import {
MultiValue,
MultiValueContainer,
MultiValueLabel,
MultiValueRemove,
} from "./multi-value";
import Placeholder from "./placeholder";
import SingleValue from "./single-value";
import { Placeholder } from "./placeholder";
import { SingleValue } from "./single-value";

const chakraComponents = {
ClearIndicator,
Expand Down
4 changes: 1 addition & 3 deletions src/chakra-components/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { SystemStyleObject } from "@chakra-ui/react";
import type { GroupBase, InputProps } from "react-select";
import { cleanCommonProps } from "../utils";

const Input = <
export const Input = <
Option,
IsMulti extends boolean,
Group extends GroupBase<Option>,
Expand Down Expand Up @@ -79,5 +79,3 @@ const Input = <
</Box>
);
};

export default Input;
8 changes: 5 additions & 3 deletions src/chakra-components/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ const alignToControl = (placement: CoercedMenuPlacement) => {
return placement ? placementToCSSProp[placement] : "top";
};

const Menu = <Option, IsMulti extends boolean, Group extends GroupBase<Option>>(
export const Menu = <
Option,
IsMulti extends boolean,
Group extends GroupBase<Option>,
>(
props: MenuProps<Option, IsMulti, Group>
) => {
const {
Expand Down Expand Up @@ -63,8 +67,6 @@ const Menu = <Option, IsMulti extends boolean, Group extends GroupBase<Option>>(
);
};

export default Menu;

export const MenuList = <
Option,
IsMulti extends boolean,
Expand Down
11 changes: 4 additions & 7 deletions src/chakra-components/multi-value.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const hasIsFixed = (option: unknown): option is { isFixed: boolean } =>
"isFixed" in option &&
typeof option.isFixed === "boolean";

const MultiValue = <
export const MultiValue = <
Option = unknown,
IsMulti extends boolean = boolean,
Group extends GroupBase<Option> = GroupBase<Option>,
Expand Down Expand Up @@ -166,7 +166,7 @@ const MultiValue = <
);
};

const MultiValueContainer = <
export const MultiValueContainer = <
Option = unknown,
IsMulti extends boolean = boolean,
Group extends GroupBase<Option> = GroupBase<Option>,
Expand All @@ -182,7 +182,7 @@ const MultiValueContainer = <
);
};

const MultiValueLabel = <
export const MultiValueLabel = <
Option = unknown,
IsMulti extends boolean = boolean,
Group extends GroupBase<Option> = GroupBase<Option>,
Expand Down Expand Up @@ -212,7 +212,7 @@ const TagCloseIcon = (props: IconProps) => (
</Icon>
);

const MultiValueRemove = <
export const MultiValueRemove = <
Option = unknown,
IsMulti extends boolean = boolean,
Group extends GroupBase<Option> = GroupBase<Option>,
Expand All @@ -237,6 +237,3 @@ const MultiValueRemove = <
</Box>
);
};

export { MultiValueContainer, MultiValueLabel, MultiValueRemove };
export default MultiValue;
4 changes: 1 addition & 3 deletions src/chakra-components/placeholder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Box } from "@chakra-ui/react";
import type { SystemStyleObject } from "@chakra-ui/react";
import type { GroupBase, PlaceholderProps } from "react-select";

const Placeholder = <
export const Placeholder = <
Option,
IsMulti extends boolean,
Group extends GroupBase<Option>,
Expand Down Expand Up @@ -43,5 +43,3 @@ const Placeholder = <
</Box>
);
};

export default Placeholder;
4 changes: 1 addition & 3 deletions src/chakra-components/single-value.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Box } from "@chakra-ui/react";
import type { SystemStyleObject } from "@chakra-ui/react";
import type { GroupBase, SingleValueProps } from "react-select";

const SingleValue = <
export const SingleValue = <
Option,
IsMulti extends boolean,
Group extends GroupBase<Option>,
Expand Down Expand Up @@ -47,5 +47,3 @@ const SingleValue = <
</Box>
);
};

export default SingleValue;

0 comments on commit b8de3b6

Please sign in to comment.