From f62ebf1af3392b78a9f67f20de97c442b4bc5582 Mon Sep 17 00:00:00 2001 From: Gilad Segal <34000019+giladsegal@users.noreply.github.com> Date: Wed, 25 Sep 2019 02:24:09 +0300 Subject: [PATCH] wix-style-react: initial types (#38307) --- types/wix-style-react/Button.d.ts | 31 +++++++++++++++++++ types/wix-style-react/Text.d.ts | 27 ++++++++++++++++ types/wix-style-react/index.d.ts | 8 +++++ types/wix-style-react/test/Button-tests.tsx | 24 ++++++++++++++ types/wix-style-react/test/Text-tests.tsx | 22 +++++++++++++ types/wix-style-react/tsconfig.json | 24 ++++++++++++++ types/wix-style-react/tslint.json | 1 + .../wix-style-react/wix-style-react-tests.ts | 3 ++ 8 files changed, 140 insertions(+) create mode 100644 types/wix-style-react/Button.d.ts create mode 100644 types/wix-style-react/Text.d.ts create mode 100644 types/wix-style-react/index.d.ts create mode 100644 types/wix-style-react/test/Button-tests.tsx create mode 100644 types/wix-style-react/test/Text-tests.tsx create mode 100644 types/wix-style-react/tsconfig.json create mode 100644 types/wix-style-react/tslint.json create mode 100644 types/wix-style-react/wix-style-react-tests.ts diff --git a/types/wix-style-react/Button.d.ts b/types/wix-style-react/Button.d.ts new file mode 100644 index 0000000000..62b68e44e8 --- /dev/null +++ b/types/wix-style-react/Button.d.ts @@ -0,0 +1,31 @@ +import * as React from 'react'; + +export interface ButtonProps { + as?: any; + className?: string; + skin?: ButtonSkin; + priority?: ButtonPriority; + size?: ButtonSize; + onClick?: React.MouseEventHandler; + fullWidth?: boolean; + suffixIcon?: React.ReactElement; + prefixIcon?: React.ReactElement; + disabled?: boolean; + dataHook?: string; +} + +export default class Button extends React.Component {} + +export type ButtonSkin = + | 'standard' + | 'inverted' + | 'destructive' + | 'premium' + | 'dark' + | 'light' + | 'transparent' + | 'premium-light'; + +export type ButtonPriority = 'primary' | 'secondary'; + +export type ButtonSize = 'tiny' | 'small' | 'medium' | 'large'; diff --git a/types/wix-style-react/Text.d.ts b/types/wix-style-react/Text.d.ts new file mode 100644 index 0000000000..b0e0a2a2fd --- /dev/null +++ b/types/wix-style-react/Text.d.ts @@ -0,0 +1,27 @@ +import * as React from 'react'; + +export interface TextProps { + showTooltip?: boolean; + ellipsed?: boolean; + tagName?: string; + className?: string; + size?: TextSize; + secondary?: boolean; + skin?: TextSkin; + light?: boolean; + weight?: TextWeight; +} + +declare const Text: React.SFC; +export default Text; + +export type TextSize = 'tiny' | 'small' | 'medium'; + +export type TextSkin = + | 'standard' + | 'error' + | 'success' + | 'premium' + | 'disabled'; + +export type TextWeight = 'thin' | 'normal' | 'bold'; diff --git a/types/wix-style-react/index.d.ts b/types/wix-style-react/index.d.ts new file mode 100644 index 0000000000..727b11a3bc --- /dev/null +++ b/types/wix-style-react/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for wix-style-react 6.17 +// Project: https://github.com/wix/wix-style-react +// Definitions by: Gilad Segal +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped`; +// TypeScript Version: 3.5 + +export { default as Button, ButtonProps } from './Button'; +export { default as Text, TextProps } from './Text'; diff --git a/types/wix-style-react/test/Button-tests.tsx b/types/wix-style-react/test/Button-tests.tsx new file mode 100644 index 0000000000..3a961a6d7d --- /dev/null +++ b/types/wix-style-react/test/Button-tests.tsx @@ -0,0 +1,24 @@ +import * as React from 'react'; +import Button from 'wix-style-react/Button'; + +function ButtonWithMandatoryProps() { + return