Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Releases: chakra-ui/polymorphic

@polymorphic-factory/[email protected]

14 Jun 20:27
c6f52e5
Compare
Choose a tag to compare

Patch Changes

@polymorphic-factory/[email protected]

01 Apr 17:12
1536f91
Compare
Choose a tag to compare

Patch Changes

  • 4daf9a4 Thanks @TimKolberger! - Fixed an issue where the typings for the as prop where to restrictive.

@polymorphic-factory/[email protected]

01 Apr 14:12
0e30dcc
Compare
Choose a tag to compare

Minor Changes

  • #327 b572666 Thanks @TimKolberger! - When using the as prop, the ref 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]

01 Apr 17:12
1536f91
Compare
Choose a tag to compare

Patch Changes

@polymorphic-factory/[email protected]

01 Apr 14:12
0e30dcc
Compare
Choose a tag to compare

Minor Changes

  • #327 b572666 Thanks @TimKolberger! - Removed the member defaultProps from the type ComponentWithAs to support React 18.3.0.

    This is possibly a breaking change for TypeScript users.

  • #327 b572666 Thanks @TimKolberger! - When using the as prop, the ref 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]

01 Apr 17:12
1536f91
Compare
Choose a tag to compare

Patch Changes

@polymorphic-factory/[email protected]

01 Apr 14:12
0e30dcc
Compare
Choose a tag to compare

Minor Changes

  • #327 b572666 Thanks @TimKolberger! - When using the as prop, the ref 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]

28 Jan 14:12
0a493a1
Compare
Choose a tag to compare

Minor Changes

  • #192 bc0f72a Thanks @TimKolberger! - Fixed an issue where the factory options type polymorphicFactory<P, Options>() did not propagate
    to the factory function poly("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]

28 Jan 14:12
0a493a1
Compare
Choose a tag to compare

Minor Changes

  • #192 bc0f72a Thanks @TimKolberger! - Fixed an issue where the factory options type polymorphicFactory<P, Options>() did not propagate
    to the factory function poly("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]

28 Jan 14:12
0a493a1
Compare
Choose a tag to compare

Minor Changes

  • #192 bc0f72a Thanks @TimKolberger! - Fixed an issue where the factory options type polymorphicFactory<P, Options>() did not propagate
    to the factory function poly("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' })