Releases: chakra-ui/polymorphic
@polymorphic-factory/[email protected]
@polymorphic-factory/[email protected]
Patch Changes
4daf9a4Thanks @TimKolberger! - Fixed an issue where the typings for the as prop where to restrictive.
@polymorphic-factory/[email protected]
Minor Changes
-
#327
b572666Thanks @TimKolberger! - When using theasprop, therefwill now be typed accordingly.This is possibly a breaking change for TypeScript users.
let ref: HTMLAnchorElement = undefined return <poly.button as="a" ref={ref} />
@polymorphic-factory/[email protected]
Patch Changes
4daf9a4Thanks @TimKolberger! - Slightly relax the typings for theasprop when it is not used.
@polymorphic-factory/[email protected]
Minor Changes
-
#327
b572666Thanks @TimKolberger! - Removed the memberdefaultPropsfrom the typeComponentWithAsto support React 18.3.0.This is possibly a breaking change for TypeScript users.
-
#327
b572666Thanks @TimKolberger! - When using theasprop, therefwill now be typed accordingly.This is possibly a breaking change for TypeScript users.
const ref = useRef<HTMLAnchorElement>(null) return <poly.button as="a" ref={ref} />
@polymorphic-factory/[email protected]
Patch Changes
4daf9a4Thanks @TimKolberger! - Slightly relax the typings for theasprop when it is not used.
@polymorphic-factory/[email protected]
Minor Changes
-
#327
b572666Thanks @TimKolberger! - When using theasprop, therefwill now be typed accordingly.This is possibly a breaking change for TypeScript users.
const ref = useRef<HTMLAnchorElement>(null) return <poly.button as="a" ref={ref} />
@polymorphic-factory/[email protected]
Minor Changes
-
#192
bc0f72aThanks @TimKolberger! - Fixed an issue where the factory options typepolymorphicFactory<P, Options>()did not propagate
to the factory functionpoly("div", options). This is possibly a breaking change for TypeScript
users.type AdditionalProps = Record<never, never> type Options = { 'data-custom-option': string } const poly = polymorphicFactory<AdditionalProps, Options>({ styled: (component, options) => (props) => { const Component = props.as || component return <Component data-custom-styled data-options={JSON.stringify(options)} {...props} /> }, }) const CustomDiv = poly('div', { 'data-custom-option': 'hello' })
@polymorphic-factory/[email protected]
Minor Changes
-
#192
bc0f72aThanks @TimKolberger! - Fixed an issue where the factory options typepolymorphicFactory<P, Options>()did not propagate
to the factory functionpoly("div", options). This is possibly a breaking change for TypeScript
users.type AdditionalProps = Record<never, never> type Options = { 'data-custom-option': string } const poly = polymorphicFactory<AdditionalProps, Options>({ styled: (component, options) => (props) => { const Component = props.as || component return <Component data-custom-styled data-options={JSON.stringify(options)} {...props} /> }, }) const CustomDiv = poly('div', { 'data-custom-option': 'hello' })
@polymorphic-factory/[email protected]
Minor Changes
-
#192
bc0f72aThanks @TimKolberger! - Fixed an issue where the factory options typepolymorphicFactory<P, Options>()did not propagate
to the factory functionpoly("div", options). This is possibly a breaking change for TypeScript
users.type AdditionalProps = Record<never, never> type Options = { 'data-custom-option': string } const poly = polymorphicFactory<AdditionalProps, Options>({ styled: (component, options) => (props) => { const Component = props.as || component return <Component data-custom-styled data-options={JSON.stringify(options)} {...props} /> }, }) const CustomDiv = poly('div', { 'data-custom-option': 'hello' })