diff --git a/packages/core/src/parsers/colors/colors.ts b/packages/core/src/parsers/colors/colors.ts index 988423d7..f9a23459 100644 --- a/packages/core/src/parsers/colors/colors.ts +++ b/packages/core/src/parsers/colors/colors.ts @@ -40,7 +40,6 @@ export function parseColor({ } } - const color = theme.getValue('colors', value as Color); if (color && color.indexOf('$') === 0) { diff --git a/packages/core/tests/parsers/components.test.ts b/packages/core/tests/parsers/components.test.ts index ddbb443f..1e8d2925 100644 --- a/packages/core/tests/parsers/components.test.ts +++ b/packages/core/tests/parsers/components.test.ts @@ -22,8 +22,8 @@ const THEME: Theme = { danger: { bg: 'danger', borderColor: 'warning', - borderWidth: '1px' - } + borderWidth: '1px', + }, }, variants: { primary: { @@ -32,7 +32,7 @@ const THEME: Theme = { danger: { bg: 'warning', borderColor: 'danger', - } + }, }, }, }, @@ -151,7 +151,11 @@ describe('components', () => { componentName: 'Box', state: 'danger', }); - expect(result).toEqual({ backgroundColor: 'red', borderColor: 'orange', borderWidth: '1px' }); + expect(result).toEqual({ + backgroundColor: 'red', + borderColor: 'orange', + borderWidth: '1px', + }); }); test('should return the variant state style if state is declared within the variant', () => { @@ -160,7 +164,11 @@ describe('components', () => { variant: 'primary', state: 'danger', }); - expect(result).toEqual({ backgroundColor: 'orange', borderColor: 'red', color: '#000' }); + expect(result).toEqual({ + backgroundColor: 'orange', + borderColor: 'red', + color: '#000', + }); }); test("should return the default style if the declared state doesn't exist", () => { diff --git a/packages/spec/src/types/components.ts b/packages/spec/src/types/components.ts index 1216684e..daa1dbbd 100644 --- a/packages/spec/src/types/components.ts +++ b/packages/spec/src/types/components.ts @@ -12,18 +12,21 @@ export interface ComponentMeta { }; } -type ComponentStyle = { +type ComponentStyle< + Props extends Style = Style, + State extends string = string, +> = { tag?: string; style: Style; props?: Props; meta?: ComponentMeta; - states: Record + states: Record; }; export type ComponentConfig< Variant extends string = string, Props extends Style = Style, - State extends string = string + State extends string = string, > = ComponentStyle & { variants: Record>; }; @@ -44,11 +47,12 @@ type StateMap = { export type Variant = VariantMap[C] extends string ? VariantMap[C] : string; -export type State = - StateMap[C] extends string ? StateMap[C] : string; +export type State = StateMap[C] extends string + ? StateMap[C] + : string; export type ComponentProps = { componentName?: C; variant?: Variant; - state?: State + state?: State; };