diff --git a/types/wix-style-react/BaseComponents.d.ts b/types/wix-style-react/BaseComponents.d.ts new file mode 100644 index 0000000000..d07a81d48e --- /dev/null +++ b/types/wix-style-react/BaseComponents.d.ts @@ -0,0 +1,8 @@ +import * as React from 'react'; + +export interface WixComponentProps { + dataHook?: string; + styles?: string; +} + +export default class WixComponent extends React.PureComponent {} diff --git a/types/wix-style-react/Loader.d.ts b/types/wix-style-react/Loader.d.ts new file mode 100644 index 0000000000..fdc7dad7fb --- /dev/null +++ b/types/wix-style-react/Loader.d.ts @@ -0,0 +1,19 @@ +import * as React from 'react'; +import WixComponent, { WixComponentProps } from './BaseComponents'; + +export interface LoaderProps extends WixComponentProps { + size?: LoaderSize; + color?: LoaderColor; + text?: React.ReactNode; + status?: LoaderStatus; + statusMessage?: string; + shouldLoadAsync?: boolean; +} + +export default class Loader extends WixComponent {} + +export type LoaderSize = 'tiny' | 'small' | 'medium' | 'large'; + +export type LoaderColor = 'blue' | 'white'; + +export type LoaderStatus = 'loading' | 'success' | 'error'; diff --git a/types/wix-style-react/index.d.ts b/types/wix-style-react/index.d.ts index 727b11a3bc..8eba8984b9 100644 --- a/types/wix-style-react/index.d.ts +++ b/types/wix-style-react/index.d.ts @@ -6,3 +6,5 @@ export { default as Button, ButtonProps } from './Button'; export { default as Text, TextProps } from './Text'; +export { default as WixComponent, WixComponentProps } from './BaseComponents'; +export { default as Loader, LoaderProps } from './Loader'; diff --git a/types/wix-style-react/test/BaseComponents-tests.tsx b/types/wix-style-react/test/BaseComponents-tests.tsx new file mode 100644 index 0000000000..01938fc3be --- /dev/null +++ b/types/wix-style-react/test/BaseComponents-tests.tsx @@ -0,0 +1,10 @@ +import * as React from 'react'; +import WixComponent from 'wix-style-react/BaseComponents'; + +function WixComponentWithMandatoryProps() { + return ; +} + +function WixComponentWithAllProps() { + return ; +} diff --git a/types/wix-style-react/test/Loader-tests.tsx b/types/wix-style-react/test/Loader-tests.tsx new file mode 100644 index 0000000000..9062e47fc1 --- /dev/null +++ b/types/wix-style-react/test/Loader-tests.tsx @@ -0,0 +1,20 @@ +import * as React from 'react'; +import Loader from 'wix-style-react/Loader'; + +function LoaderWithMandatoryProps() { + return ; +} + +function LoaderWithAllProps() { + return ( + + ); +} diff --git a/types/wix-style-react/tsconfig.json b/types/wix-style-react/tsconfig.json index a8a7aea349..7510bd13db 100644 --- a/types/wix-style-react/tsconfig.json +++ b/types/wix-style-react/tsconfig.json @@ -19,6 +19,10 @@ "Text.d.ts", "test/Text-tests.tsx", "Button.d.ts", - "test/Button-tests.tsx" + "test/Button-tests.tsx", + "Loader.d.ts", + "test/Loader-tests.tsx", + "BaseComponents.d.ts", + "test/BaseComponents-tests.tsx" ] } \ No newline at end of file diff --git a/types/wix-style-react/wix-style-react-tests.ts b/types/wix-style-react/wix-style-react-tests.ts index 4079ea1682..9a91677e61 100644 --- a/types/wix-style-react/wix-style-react-tests.ts +++ b/types/wix-style-react/wix-style-react-tests.ts @@ -1,3 +1,3 @@ // verify that all imports work -import { Button, Text } from 'wix-style-react'; +import { Button, Text, Loader } from 'wix-style-react';