From 67d97feb29fa0dfbe86c7b831837997c385bf917 Mon Sep 17 00:00:00 2001 From: Vince Picone Date: Wed, 6 Feb 2019 12:02:07 -0600 Subject: [PATCH] Add types for @carbon/themes --- types/carbon__themes/carbon__themes-tests.ts | 59 ++++++++++++++++ types/carbon__themes/index.d.ts | 74 ++++++++++++++++++++ types/carbon__themes/tsconfig.json | 19 +++++ types/carbon__themes/tslint.json | 1 + 4 files changed, 153 insertions(+) create mode 100644 types/carbon__themes/carbon__themes-tests.ts create mode 100644 types/carbon__themes/index.d.ts create mode 100644 types/carbon__themes/tsconfig.json create mode 100644 types/carbon__themes/tslint.json diff --git a/types/carbon__themes/carbon__themes-tests.ts b/types/carbon__themes/carbon__themes-tests.ts new file mode 100644 index 0000000000..7515742031 --- /dev/null +++ b/types/carbon__themes/carbon__themes-tests.ts @@ -0,0 +1,59 @@ +import ThemePackage from "@carbon/themes"; + +interface Theme { + active01: string; + activeDanger: string; + activePrimary: string; + activeSecondary: string; + activeTertiary: string; + activeUI: string; + brand01: string; + brand02: string; + brand03: string; + disabled01: string; + disabled02: string; + disabled03: string; + field01: string; + field02: string; + focus: string; + highlight: string; + hoverDanger: string; + hoverField: string; + hoverPrimary: string; + hoverPrimaryText: string; + hoverRow: string; + hoverSecondary: string; + hoverSelectedUI: string; + hoverTertiary: string; + hoverUI: string; + icon01: string; + icon02: string; + interactive01: string; + interactive02: string; + interactive03: string; + inverse01: string; + inverse02: string; + overlay01: string; + selectedUI: string; + support01: string; + support02: string; + support03: string; + support04: string; + text01: string; + text02: string; + text03: string; + text04: string; + ui01: string; + ui02: string; + ui03: string; + ui04: string; + ui05: string; + uiBackground: string; + visitedLink: string; +} + +const getDefaultTheme = (): Theme => { + return ThemePackage.white; +}; + +getDefaultTheme(); diff --git a/types/carbon__themes/index.d.ts b/types/carbon__themes/index.d.ts new file mode 100644 index 0000000000..e10f17f35c --- /dev/null +++ b/types/carbon__themes/index.d.ts @@ -0,0 +1,74 @@ +// Type definitions for @carbon/themes 0.0 +// Project: https://github.com/IBM/carbon-elements/tree/master/packages/themes +// Definitions by: Vince Picone +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export default carbon__themes; + +interface Theme { + active01: string; + activeDanger: string; + activePrimary: string; + activeSecondary: string; + activeTertiary: string; + activeUI: string; + brand01: string; + brand02: string; + brand03: string; + disabled01: string; + disabled02: string; + disabled03: string; + field01: string; + field02: string; + focus: string; + highlight: string; + hoverDanger: string; + hoverField: string; + hoverPrimary: string; + hoverPrimaryText: string; + hoverRow: string; + hoverSecondary: string; + hoverSelectedUI: string; + hoverTertiary: string; + hoverUI: string; + icon01: string; + icon02: string; + interactive01: string; + interactive02: string; + interactive03: string; + inverse01: string; + inverse02: string; + overlay01: string; + selectedUI: string; + support01: string; + support02: string; + support03: string; + support04: string; + text01: string; + text02: string; + text03: string; + text04: string; + ui01: string; + ui02: string; + ui03: string; + ui04: string; + ui05: string; + uiBackground: string; + visitedLink: string; +} + +// The default theme is included as a top level export +type ThemePackage = { + white: Theme; + g10: Theme; + g100: Theme; + g90: Theme; + themes: { + g10: Theme; + g100: Theme; + g90: Theme; + white: Theme; + }; +} & Theme; + +declare const carbon__themes: ThemePackage; diff --git a/types/carbon__themes/tsconfig.json b/types/carbon__themes/tsconfig.json new file mode 100644 index 0000000000..490b17648e --- /dev/null +++ b/types/carbon__themes/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "paths": { + "@carbon/themes": ["carbon__themes"] + } + }, + "files": ["index.d.ts", "carbon__themes-tests.ts"] +} diff --git a/types/carbon__themes/tslint.json b/types/carbon__themes/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/carbon__themes/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }