From cf65e541746e02a055fcacf1790f68a19071959c Mon Sep 17 00:00:00 2001 From: Harsh Zalavadiya Date: Fri, 12 Aug 2022 15:38:59 +0000 Subject: [PATCH] refactor: :recycle: exported TS types back --- src/hooks/use-multi-select.tsx | 8 ++++---- src/index.tsx | 3 +++ src/lib/interfaces.ts | 2 +- src/multi-select/index.tsx | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/hooks/use-multi-select.tsx b/src/hooks/use-multi-select.tsx index 7b5c192..125956a 100644 --- a/src/hooks/use-multi-select.tsx +++ b/src/hooks/use-multi-select.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from "react"; -import { ISelectProps, Option } from "../lib/interfaces"; +import { Option, SelectProps } from "../lib/interfaces"; const defaultStrings = { allItemsAreSelected: "All items are selected.", @@ -14,7 +14,7 @@ const defaultStrings = { create: "Create", }; -const defaultProps: Partial = { +const defaultProps: Partial = { value: [], hasSelectAll: true, className: "multi-select", @@ -22,13 +22,13 @@ const defaultProps: Partial = { options: [] as Option[], }; -interface MultiSelectContextProps extends ISelectProps { +interface MultiSelectContextProps extends SelectProps { t: (key: string) => string; setOptions?; } interface MultiSelectProviderProps { - props: ISelectProps; + props: SelectProps; children; } diff --git a/src/index.tsx b/src/index.tsx index 1e3248a..bb200d8 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,6 +1,9 @@ +import { Option, SelectProps } from "./lib/interfaces"; import MultiSelect from "./multi-select"; import Dropdown from "./multi-select/dropdown"; import SelectPanel from "./select-panel"; import SelectItem from "./select-panel/select-item"; export { Dropdown, MultiSelect, SelectItem, SelectPanel }; + +export type { Option, SelectProps }; diff --git a/src/lib/interfaces.ts b/src/lib/interfaces.ts index a0f7113..bfb7554 100644 --- a/src/lib/interfaces.ts +++ b/src/lib/interfaces.ts @@ -7,7 +7,7 @@ export interface Option { disabled?: boolean; } -export interface ISelectProps { +export interface SelectProps { options: Option[]; value: Option[]; onChange?; diff --git a/src/multi-select/index.tsx b/src/multi-select/index.tsx index b1d8da2..1b1f6dc 100644 --- a/src/multi-select/index.tsx +++ b/src/multi-select/index.tsx @@ -3,10 +3,10 @@ import "../style.css"; import React from "react"; import { MultiSelectProvider } from "../hooks/use-multi-select"; -import { ISelectProps } from "../lib/interfaces"; +import { SelectProps } from "../lib/interfaces"; import Dropdown from "./dropdown"; -const MultiSelect = (props: ISelectProps) => ( +const MultiSelect = (props: SelectProps) => (