Releases: chakra-ui/polymorphic
@polymorphic-factory/[email protected]
@polymorphic-factory/[email protected]
Patch Changes
4daf9a4
Thanks @TimKolberger! - Fixed an issue where the typings for the as prop where to restrictive.
@polymorphic-factory/[email protected]
Minor Changes
-
#327
b572666
Thanks @TimKolberger! - When using theas
prop, theref
will 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
4daf9a4
Thanks @TimKolberger! - Slightly relax the typings for theas
prop when it is not used.
@polymorphic-factory/[email protected]
Minor Changes
-
#327
b572666
Thanks @TimKolberger! - Removed the memberdefaultProps
from the typeComponentWithAs
to support React 18.3.0.This is possibly a breaking change for TypeScript users.
-
#327
b572666
Thanks @TimKolberger! - When using theas
prop, theref
will 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
4daf9a4
Thanks @TimKolberger! - Slightly relax the typings for theas
prop when it is not used.
@polymorphic-factory/[email protected]
Minor Changes
-
#327
b572666
Thanks @TimKolberger! - When using theas
prop, theref
will 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
bc0f72a
Thanks @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
bc0f72a
Thanks @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
bc0f72a
Thanks @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' })