diff --git a/notNeededPackages.json b/notNeededPackages.json index 5a6d241343..a5d711e71c 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -3102,6 +3102,12 @@ "sourceRepoURL": "https://github.com/formatjs/react-intl", "asOfVersion": "3.0.0" }, + { + "libraryName": "react-jss", + "typingsPackageName": "react-jss", + "sourceRepoURL": "https://github.com/cssinjs/react-jss#readme", + "asOfVersion": "10.0.0" + }, { "libraryName": "react-monaco-editor", "typingsPackageName": "react-monaco-editor", diff --git a/types/react-jss/index.d.ts b/types/react-jss/index.d.ts deleted file mode 100644 index b7dafa5982..0000000000 --- a/types/react-jss/index.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Type definitions for react-jss 8.6 -// Project: https://github.com/cssinjs/react-jss#readme -// Definitions by: Sebastian Silbermann -// James Lawrence -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.9 -import { createGenerateClassName, JSS, SheetsRegistry } from "jss"; -import * as React from "react"; -import { createTheming, ThemeProvider, withTheme } from "theming"; - -import injectSheet from "./lib/injectSheet"; -import JssProvider, { Props as JssProviderProps } from "./lib/JssProvider"; - -// re-export types -export * from "./lib/injectSheet"; -export { JssProviderProps }; -// library implementations -export const jss: JSS; -export { - createGenerateClassName, - createTheming, - JssProvider, - SheetsRegistry, - ThemeProvider, - withTheme -}; -export default injectSheet; diff --git a/types/react-jss/lib/JssProvider.d.ts b/types/react-jss/lib/JssProvider.d.ts deleted file mode 100644 index bde15a8ce9..0000000000 --- a/types/react-jss/lib/JssProvider.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import * as React from "react"; - -import { GenerateClassName, JSS, SheetsRegistry } from "jss"; - -export interface Props { - children: React.ReactNode; - classNamePrefix?: string; - disableStylesGeneration?: boolean; - jss?: JSS; - generateClassName?: GenerateClassName; - registry?: SheetsRegistry; -} - -export default class JssProvider extends React.Component {} diff --git a/types/react-jss/lib/injectSheet.d.ts b/types/react-jss/lib/injectSheet.d.ts deleted file mode 100644 index 68272df3e7..0000000000 --- a/types/react-jss/lib/injectSheet.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -import * as CSS from "csstype"; -import { CreateStyleSheetOptions, JSS } from "jss"; -import * as React from "react"; -import { - channel, - createTheming, - themeListener, - ThemeProvider, - withTheme -} from "theming"; - -/** - * omit from T every key K - * - * @internal - */ -export type Omit = Pick>; -/** - * `T extends ConsistentWith` means that where `T` has overlapping properties with - * `U`, their value types do not conflict. - * - * @internal - */ -export type ConsistentWith = { - [P in keyof DecorationTargetProps]: P extends keyof InjectedProps - ? InjectedProps[P] extends DecorationTargetProps[P] - ? DecorationTargetProps[P] - : InjectedProps[P] - : DecorationTargetProps[P] -}; - -/** - * Like `T & U`, but using the value types from `U` where their properties overlap. - * - * @internal - */ -export type Overwrite = Omit & U; - -/** - * @internal - */ -export type PropsOf = C extends new (props: infer P) => React.Component - ? P - : C extends (props: infer P) => React.ReactElement | null ? P : never; - -/** - * a function that takes {component} and returns a component that passes along - * all the props to {component} except the {InjectedProps} and will accept - * additional {AdditionalProps} - * - * source mui-org/material-ui#12673 - * @internal - */ -export type PropInjector = < - C extends React.ComponentType, InjectedProps>> - >( - component: C -) => React.ComponentType< - Omit>, keyof InjectedProps> & - AdditionalProps - >; - -// Allow functions that take the properties of the component and return a CSS value -export type DynamicCSSRule = { - [K in keyof CSS.Properties>]: - | CSS.Properties>[K] - | ((props: Props) => CSS.Properties>[K]) -}[keyof CSS.Properties]; - -export interface CSSProperties { - // Allow pseudo selectors and media queries - [k: string]: - | DynamicCSSRule - | CSSProperties; -} -export type Styles = Record< - ClassKey, - CSSProperties - >; -export type StyleCreator = ( - theme: T -) => Styles; - -export interface Theming { - channel: string; - createTheming: typeof createTheming; - themeListener: typeof themeListener; - ThemeProvider: typeof ThemeProvider; - withTheme: typeof withTheme; -} -export interface InjectOptions extends CreateStyleSheetOptions { - jss?: JSS; - theming?: Theming; -} - -export type ClassNameMap = Record; -export type WithSheet< - S extends string | Styles | StyleCreator, - GivenTheme = undefined, -Props = {}, - > = { - classes: ClassNameMap< - S extends string | number | symbol - ? S - : S extends StyleCreator - ? C - : S extends Styles ? C : never - >; -} & WithTheme ? T : GivenTheme>; - -export interface WithTheme { - theme: T; - innerRef?: React.Ref | React.RefObject; -} - -export interface StyledComponentProps { - classes?: Partial>; - innerRef?: React.Ref | React.RefObject; -} - -export default function injectSheet( - stylesOrCreator: Styles | StyleCreator, - options?: InjectOptions -): PropInjector, StyledComponentProps>; diff --git a/types/react-jss/package.json b/types/react-jss/package.json deleted file mode 100644 index f3be220fbc..0000000000 --- a/types/react-jss/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "csstype": "^2.0.0" - } -} diff --git a/types/react-jss/react-jss-tests.tsx b/types/react-jss/react-jss-tests.tsx deleted file mode 100644 index 5fe76ae1cb..0000000000 --- a/types/react-jss/react-jss-tests.tsx +++ /dev/null @@ -1,102 +0,0 @@ -import * as React from "react"; -import injectSheet, { - JssProvider, - SheetsRegistry, - Styles, - WithSheet, - ThemeProvider -} from "react-jss"; - -interface MyTheme { - color: { - primary: string; - secondary: string; - }; -} - -/** - * helper function to counter typescripts type widening - */ -// tslint:disable-next-line:no-unnecessary-generics -function createStyles(styles: Styles): Styles { - return styles as Styles; -} - -interface ButtonProps { - label: string; - active?: boolean; -} - -const styles = (theme: MyTheme) => createStyles({ - myButton: { - color: (props: ButtonProps) => props.active ? 'red' : theme.color.primary, - margin: 1, - "& span": { - fontWeight: "revert" - } - }, - myLabel: { - fontStyle: "italic" - } -}); -const Button: React.SFC> = ({active, classes, children}) => { - return ( - <> - - - ); -}; - -const ManuallyStyles = () => { - return ( -