diff --git a/package.json b/package.json index 7e815be..f4d6367 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coral-system", - "version": "0.5.1", + "version": "0.5.2", "description": "a lightweight style system with react ui primitives", "module": "dist/esm/index.js", "types": "dist/esm/index.d.ts", diff --git a/src/coral.ts b/src/coral.ts index e1dcd84..b43d3c4 100644 --- a/src/coral.ts +++ b/src/coral.ts @@ -1,7 +1,6 @@ import styled from 'styled-components'; import { shouldForwardProp, cssProps, allStyledProps } from './core'; import type { CoralProps, As, CoralComponent } from './types'; -import { DEFAULT_PREFIX } from './helpers'; interface CoralOption

{ /** @@ -21,14 +20,11 @@ interface CoralOption

{ } export function coral(component: T, css?: CoralProps['css'], options?: CoralOption

) { - const prefix = options?.prefix || DEFAULT_PREFIX; const attrs = typeof options?.attrs === 'function' ? options?.attrs : () => options?.attrs; - console.log(attrs); const shouldForward = options?.shouldForwardProp || shouldForwardProp; - return styled(component as React.ComponentType) .attrs((props) => ({ - prefix: props.prefix || prefix, + prefix: props.prefix || options?.prefix, ...attrs(props), })) .withConfig({ diff --git a/src/core/core.ts b/src/core/core.ts index bb95812..0f84e3a 100644 --- a/src/core/core.ts +++ b/src/core/core.ts @@ -62,8 +62,7 @@ export const compose = (...parsers: any[]) => { function createParser(config: any) { const parse = (props: Record) => { const styles = {}; - - const prefix = props.theme?.prefix || props.prefix || DEFAULT_PREFIX; + const prefix = props.prefix || props.theme?.prefix || DEFAULT_PREFIX; for (const key in props) { if (key === 'theme') continue;