Skip to content

Commit

Permalink
Revert "feat: export Theme type from root (#3125)"
Browse files Browse the repository at this point in the history
This reverts commit 0531faa.
  • Loading branch information
mainframev committed Oct 21, 2021
1 parent 322c87e commit c0754d9
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 24 deletions.
4 changes: 2 additions & 2 deletions packages/orbit-components/src/ThemeProvider/index.d.ts
Expand Up @@ -4,10 +4,10 @@
import * as React from "react";

import { Translations } from "../Dictionary";
import { Theme } from "../defaultTheme";
import { ThemeShape } from "../defaultTheme";

interface Props {
readonly theme: Theme;
readonly theme: ThemeShape;
readonly dictionary?: Translations;
readonly children: React.ReactNode;
}
Expand Down
12 changes: 6 additions & 6 deletions packages/orbit-components/src/defaultTheme.d.ts
Expand Up @@ -3,16 +3,16 @@

import { Tokens } from "@kiwicom/orbit-design-tokens";

export interface Theme {
export interface ThemeShape {
readonly orbit: Tokens;
readonly transitions?: boolean;
readonly lockScrolling?: boolean;
readonly rtl?: boolean;
}

export interface ThemeProps {
theme: Theme;
}
export type ThemeType = {
theme: ThemeShape;
};

declare const defaultTheme: Theme;
export default defaultTheme;
declare const Theme: ThemeShape;
export default Theme;
4 changes: 2 additions & 2 deletions packages/orbit-components/src/hooks/useTheme/index.d.ts
@@ -1,5 +1,5 @@
import { Theme } from "../../defaultTheme";
import { ThemeShape } from "../../defaultTheme";

declare const useTheme: () => Theme;
declare const useTheme: () => ThemeShape;

export { useTheme, useTheme as default };
2 changes: 1 addition & 1 deletion packages/orbit-components/src/index.d.ts
Expand Up @@ -24,7 +24,7 @@ export { ChoiceGroup } from "./ChoiceGroup";
export { CountryFlag } from "./CountryFlag";
export { Collapse } from "./Collapse";
export { CarrierLogo } from "./CarrierLogo";
export { default as defaultTheme, Theme } from "./defaultTheme";
export { default as defaultTheme } from "./defaultTheme";
export { Desktop } from "./Desktop";
export { Dialog } from "./Dialog";
export { FeatureIcon } from "./FeatureIcon";
Expand Down
1 change: 0 additions & 1 deletion packages/orbit-components/src/index.js.flow
Expand Up @@ -245,7 +245,6 @@ declare export var ThemeProvider: ThemeProviderType;
declare export var Translate: TranslateType;

declare export var defaultTheme: Theme;
export type { Theme };
declare export var getTokens: GetTokens;
declare export var fromPlainObject: FromPlainObject;

Expand Down
4 changes: 2 additions & 2 deletions packages/orbit-components/src/utils/mediaQuery/index.d.ts
Expand Up @@ -2,12 +2,12 @@
// Project: http://github.com/kiwicom/orbit
import type { Interpolation } from "styled-components";

import { Theme } from "../../defaultTheme";
import { ThemeShape } from "../../defaultTheme";
import { Devices } from "./consts";

type QueryFunction = (style: Interpolation<any>) => Interpolation<any>;

declare const MediaQuery: { [key in Devices]: QueryFunction };
declare const getBreakpointWidth: (name: string, theme: Theme, pure?: boolean) => string;
declare const getBreakpointWidth: (name: string, theme: ThemeShape, pure?: boolean) => string;

export { MediaQuery, MediaQuery as default, getBreakpointWidth };
12 changes: 6 additions & 6 deletions packages/orbit-components/src/utils/rtl/index.d.ts
@@ -1,14 +1,14 @@
import { ThemeProps } from "../../defaultTheme";
import { ThemeType } from "../../defaultTheme";

export type LeftToRight = <T1, T2>(left: T1, right: T2) => (options: ThemeProps) => T1 | T2;
export type LeftToRight = <T1, T2>(left: T1, right: T2) => (theme: ThemeType) => T1 | T2;

export type RtlSpacing = (value: string) => (options: ThemeProps) => string;
export type RtlSpacing = (value: string) => (theme: ThemeType) => string;

export type BorderRadius = (value: string) => (options: ThemeProps) => string;
export type BorderRadius = (value: string) => (theme: ThemeType) => string;

export type TextAlign = (value: "left" | "right") => (options: ThemeProps) => string | LeftToRight;
export type TextAlign = (value: "left" | "right") => (theme: ThemeType) => string | LeftToRight;

export type Translate3d = (value: string) => (options: ThemeProps) => string;
export type Translate3d = (value: string) => (themeProps: ThemeType) => string;

export declare const rtlSpacing: RtlSpacing;

Expand Down
8 changes: 4 additions & 4 deletions packages/orbit-components/src/utils/transition/index.d.ts
@@ -1,11 +1,11 @@
import { ThemeProps } from "../../defaultTheme";
import { ThemeType } from "../../defaultTheme";

export type TransitionDuration = "slow" | "normal" | "fast";

export declare const transition: (
export declare const Transition: (
properties: string[],
duration: TransitionDuration,
timingFunction: string,
) => (options: ThemeProps) => string | null;
) => (theme: ThemeType) => string | null;

export default transition;
export default Transition;

0 comments on commit c0754d9

Please sign in to comment.