From f6f02ef79e8f421046df8b3f955988ca5311e69c Mon Sep 17 00:00:00 2001 From: Jordan Phillips Date: Sat, 4 May 2024 16:42:22 +1000 Subject: [PATCH] fix: export own and element props separately (#76) * fix: export own and element props separately * fix: additional find and replace T to TElement edits --- packages/react/src/components/alert/Alert.tsx | 16 ++++--- .../react/src/components/alert/AlertBody.tsx | 16 ++++--- .../src/components/alert/AlertHeading.tsx | 16 ++++--- .../react/src/components/alert/AlertItem.tsx | 16 ++++--- .../react/src/components/alert/AlertList.tsx | 16 ++++--- packages/react/src/components/alert/index.ts | 10 ++--- .../react/src/components/avatar/Avatar.tsx | 16 ++++--- .../src/components/avatar/AvatarGroup.tsx | 16 ++++--- .../src/components/avatar/AvatarIcon.tsx | 16 ++++--- .../src/components/avatar/AvatarImage.tsx | 16 ++++--- .../components/avatar/AvatarNotification.tsx | 16 ++++--- packages/react/src/components/avatar/index.ts | 10 ++--- .../src/components/breadcrumb/Breadcrumb.tsx | 24 +++++------ .../components/breadcrumb/BreadcrumbItem.tsx | 16 ++++--- .../react/src/components/breadcrumb/index.ts | 4 +- .../react/src/components/button/Button.tsx | 16 ++++--- packages/react/src/components/button/index.ts | 2 +- packages/react/src/components/card/Card.tsx | 16 ++++--- .../react/src/components/card/CardBody.tsx | 16 ++++--- .../react/src/components/card/CardFooter.tsx | 16 ++++--- .../react/src/components/card/CardHeader.tsx | 16 ++++--- packages/react/src/components/card/index.ts | 8 ++-- .../src/components/checkbox/Checkbox.tsx | 16 ++++--- .../react/src/components/checkbox/index.ts | 2 +- packages/react/src/components/chip/Chip.tsx | 16 ++++--- packages/react/src/components/chip/index.ts | 2 +- .../react/src/components/dialog/Dialog.tsx | 15 ++++--- .../src/components/dialog/DialogContent.tsx | 16 ++++--- packages/react/src/components/dialog/index.ts | 4 +- .../react/src/components/divider/Divider.tsx | 16 ++++--- .../react/src/components/divider/index.ts | 2 +- packages/react/src/components/form/Form.tsx | 16 ++++--- .../react/src/components/form/FormCaption.tsx | 16 ++++--- .../src/components/form/FormFeedback.tsx | 16 ++++--- .../react/src/components/form/FormGroup.tsx | 16 ++++--- .../react/src/components/form/FormLabel.tsx | 16 ++++--- packages/react/src/components/form/index.ts | 10 ++--- packages/react/src/components/link/Link.tsx | 16 ++++--- packages/react/src/components/link/index.ts | 2 +- packages/react/src/components/menu/Menu.tsx | 15 ++++--- .../react/src/components/menu/MenuItem.tsx | 16 ++++--- .../react/src/components/menu/MenuList.tsx | 22 +++++----- .../react/src/components/menu/MenuPopover.tsx | 16 ++++--- packages/react/src/components/menu/index.ts | 5 ++- .../src/components/navigation/Navigation.tsx | 16 ++++--- .../components/navigation/NavigationBrand.tsx | 16 ++++--- .../navigation/NavigationContent.tsx | 16 ++++--- .../navigation/NavigationDivider.tsx | 16 ++++--- .../components/navigation/NavigationItem.tsx | 16 ++++--- .../components/navigation/NavigationLink.tsx | 16 ++++--- .../navigation/NavigationPortal.tsx | 16 ++++--- .../navigation/NavigationSegment.tsx | 16 ++++--- .../components/navigation/NavigationTitle.tsx | 16 ++++--- .../navigation/NavigationTrigger.tsx | 16 ++++--- .../react/src/components/navigation/index.ts | 20 ++++----- .../src/components/progress/Progress.tsx | 16 ++++--- .../src/components/progress/ProgressBar.tsx | 16 ++++--- .../react/src/components/progress/index.ts | 4 +- .../react/src/components/select/Select.tsx | 42 +++++++++---------- .../src/components/select/SelectOption.tsx | 16 ++++--- .../src/components/select/SelectValue.tsx | 22 +++++----- packages/react/src/components/select/index.ts | 4 +- .../src/components/select/use-select.hook.ts | 6 +-- .../react/src/components/spinner/Spinner.tsx | 16 ++++--- .../react/src/components/spinner/index.ts | 2 +- .../react/src/components/switch/Switch.tsx | 16 ++++--- packages/react/src/components/switch/index.ts | 2 +- packages/react/src/components/table/Table.tsx | 16 ++++--- .../react/src/components/table/TableBody.tsx | 22 +++++----- .../react/src/components/table/TableCell.tsx | 16 ++++--- .../src/components/table/TableColumn.tsx | 16 ++++--- .../react/src/components/table/TableHead.tsx | 22 +++++----- .../react/src/components/table/TableRow.tsx | 22 +++++----- packages/react/src/components/table/index.ts | 12 +++--- .../typography/TypographyHeading.tsx | 16 ++++--- .../typography/TypographyParagraph.tsx | 16 ++++--- .../components/typography/TypographyText.tsx | 16 ++++--- .../react/src/components/typography/index.ts | 6 +-- packages/react/src/utilities/types.ts | 2 +- packages/theme/src/components/input.ts | 2 +- 80 files changed, 709 insertions(+), 402 deletions(-) diff --git a/packages/react/src/components/alert/Alert.tsx b/packages/react/src/components/alert/Alert.tsx index aa3d0fc..d3d97b3 100644 --- a/packages/react/src/components/alert/Alert.tsx +++ b/packages/react/src/components/alert/Alert.tsx @@ -13,14 +13,20 @@ const __ELEMENT_TYPE__ = 'div' type ComponentOwnProps = AlertVariantProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, color, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -45,7 +51,7 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as AlertProps } +export type { ComponentOwnProps as AlertOwnProps, ComponentProps as AlertProps } export default Object.assign(Component, { Body: AlertBody, Heading: AlertHeading, diff --git a/packages/react/src/components/alert/AlertBody.tsx b/packages/react/src/components/alert/AlertBody.tsx index e4d509c..369ceb2 100644 --- a/packages/react/src/components/alert/AlertBody.tsx +++ b/packages/react/src/components/alert/AlertBody.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'div' type ComponentOwnProps = {} -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -38,5 +44,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as AlertBodyProps } +export type { ComponentOwnProps as AlertBodyOwnProps, ComponentProps as AlertBodyProps } export default Component diff --git a/packages/react/src/components/alert/AlertHeading.tsx b/packages/react/src/components/alert/AlertHeading.tsx index a0f9d6f..fa0ea16 100644 --- a/packages/react/src/components/alert/AlertHeading.tsx +++ b/packages/react/src/components/alert/AlertHeading.tsx @@ -10,14 +10,20 @@ const __ELEMENT_TYPE__ = 'h1' type ComponentOwnProps = HeadingProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, level = 3, ...rest } = props const Element = as ?? Heading @@ -41,5 +47,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as AlertHeadingProps } +export type { ComponentOwnProps as AlertHeadingOwnProps, ComponentProps as AlertHeadingProps } export default Component diff --git a/packages/react/src/components/alert/AlertItem.tsx b/packages/react/src/components/alert/AlertItem.tsx index 9e7b01f..2320bca 100644 --- a/packages/react/src/components/alert/AlertItem.tsx +++ b/packages/react/src/components/alert/AlertItem.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'li' type ComponentOwnProps = {} -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -38,5 +44,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as AlertItemProps } +export type { ComponentOwnProps as AlertItemOwnProps, ComponentProps as AlertItemProps } export default Component diff --git a/packages/react/src/components/alert/AlertList.tsx b/packages/react/src/components/alert/AlertList.tsx index a51e39b..84a095d 100644 --- a/packages/react/src/components/alert/AlertList.tsx +++ b/packages/react/src/components/alert/AlertList.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'ul' type ComponentOwnProps = {} -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -38,5 +44,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as AlertListProps } +export type { ComponentOwnProps as AlertListOwnProps, ComponentProps as AlertListProps } export default Component diff --git a/packages/react/src/components/alert/index.ts b/packages/react/src/components/alert/index.ts index 1278a1d..55067e7 100644 --- a/packages/react/src/components/alert/index.ts +++ b/packages/react/src/components/alert/index.ts @@ -1,7 +1,7 @@ -export type { AlertProps } from '@/components/alert/Alert' -export type { AlertBodyProps } from '@/components/alert/AlertBody' -export type { AlertHeadingProps } from '@/components/alert/AlertHeading' -export type { AlertItemProps } from '@/components/alert/AlertItem' -export type { AlertListProps } from '@/components/alert/AlertList' +export type * from '@/components/alert/Alert' +export type * from '@/components/alert/AlertBody' +export type * from '@/components/alert/AlertHeading' +export type * from '@/components/alert/AlertItem' +export type * from '@/components/alert/AlertList' export { default as Alert } from '@/components/alert/Alert' diff --git a/packages/react/src/components/avatar/Avatar.tsx b/packages/react/src/components/avatar/Avatar.tsx index 8bd7c55..2f192b5 100644 --- a/packages/react/src/components/avatar/Avatar.tsx +++ b/packages/react/src/components/avatar/Avatar.tsx @@ -13,14 +13,20 @@ const __ELEMENT_TYPE__ = 'span' type ComponentOwnProps = AvatarVariantProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, color, radius, size, zoomed, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -51,7 +57,7 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as AvatarProps } +export type { ComponentOwnProps as AvatarOwnProps, ComponentProps as AvatarProps } export default Object.assign(Component, { Group: AvatarGroup, Image: AvatarImage, diff --git a/packages/react/src/components/avatar/AvatarGroup.tsx b/packages/react/src/components/avatar/AvatarGroup.tsx index d93f400..31128f8 100644 --- a/packages/react/src/components/avatar/AvatarGroup.tsx +++ b/packages/react/src/components/avatar/AvatarGroup.tsx @@ -9,14 +9,20 @@ const __ELEMENT_TYPE__ = 'span' type ComponentOwnProps = AvatarVariantProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, color, radius, size, zoomed, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -41,5 +47,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as AvatarGroupProps } +export type { ComponentOwnProps as AvatarGroupOwnProps, ComponentProps as AvatarGroupProps } export default Component diff --git a/packages/react/src/components/avatar/AvatarIcon.tsx b/packages/react/src/components/avatar/AvatarIcon.tsx index 58c733b..044ca07 100644 --- a/packages/react/src/components/avatar/AvatarIcon.tsx +++ b/packages/react/src/components/avatar/AvatarIcon.tsx @@ -10,14 +10,20 @@ type ComponentOwnProps = { icon: React.ReactNode } -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, className, icon, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -40,5 +46,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as AvatarIconProps } +export type { ComponentOwnProps as AvatarIconOwnProps, ComponentProps as AvatarIconProps } export default Component diff --git a/packages/react/src/components/avatar/AvatarImage.tsx b/packages/react/src/components/avatar/AvatarImage.tsx index dd977c5..6a1d6bb 100644 --- a/packages/react/src/components/avatar/AvatarImage.tsx +++ b/packages/react/src/components/avatar/AvatarImage.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'img' type ComponentOwnProps = {} -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -38,5 +44,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as AvatarImageProps } +export type { ComponentOwnProps as AvatarImageOwnProps, ComponentProps as AvatarImageProps } export default Component diff --git a/packages/react/src/components/avatar/AvatarNotification.tsx b/packages/react/src/components/avatar/AvatarNotification.tsx index 0cb6e62..3b1b8ed 100644 --- a/packages/react/src/components/avatar/AvatarNotification.tsx +++ b/packages/react/src/components/avatar/AvatarNotification.tsx @@ -9,14 +9,20 @@ const __ELEMENT_TYPE__ = 'span' type ComponentOwnProps = Pick -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, color, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -39,5 +45,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as AvatarNotificationProps } +export type { ComponentOwnProps as AvatarNotificationOwnProps, ComponentProps as AvatarNotificationProps } export default Component diff --git a/packages/react/src/components/avatar/index.ts b/packages/react/src/components/avatar/index.ts index be0fed2..980692d 100644 --- a/packages/react/src/components/avatar/index.ts +++ b/packages/react/src/components/avatar/index.ts @@ -1,7 +1,7 @@ -export type { AvatarProps } from '@/components/avatar/Avatar' -export type { AvatarGroupProps } from '@/components/avatar/AvatarGroup' -export type { AvatarIconProps } from '@/components/avatar/AvatarIcon' -export type { AvatarImageProps } from '@/components/avatar/AvatarImage' -export type { AvatarNotificationProps } from '@/components/avatar/AvatarNotification' +export type * from '@/components/avatar/Avatar' +export type * from '@/components/avatar/AvatarGroup' +export type * from '@/components/avatar/AvatarIcon' +export type * from '@/components/avatar/AvatarImage' +export type * from '@/components/avatar/AvatarNotification' export { default as Avatar } from '@/components/avatar/Avatar' diff --git a/packages/react/src/components/breadcrumb/Breadcrumb.tsx b/packages/react/src/components/breadcrumb/Breadcrumb.tsx index 4d9d121..185d3b2 100644 --- a/packages/react/src/components/breadcrumb/Breadcrumb.tsx +++ b/packages/react/src/components/breadcrumb/Breadcrumb.tsx @@ -10,21 +10,21 @@ import { BreadcrumbContext, useBreadcrumb } from '@/components/breadcrumb/use-br const __ELEMENT_TYPE__ = 'ol' -type ComponentOwnProps = BreadcrumbsProps & BreadcrumbVariantProps +type ComponentOwnProps = BreadcrumbsProps & BreadcrumbVariantProps -type ComponentProps = Polymophic.ComponentPropsWithRef< - T, - ComponentOwnProps -> +type ComponentProps< + TData extends object, + TElement extends React.ElementType = typeof __ELEMENT_TYPE__, +> = Polymophic.ComponentPropsWithRef> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - ( - props: ComponentProps, - ref: Polymophic.Ref + ( + props: ComponentProps, + ref: Polymophic.Ref ) => { const { as, children, className, size, separator, ...rest } = props @@ -32,7 +32,7 @@ const Component: ComponentType = React.forwardRef( const context = useBreadcrumb({ size, separator }) - const component = React.useMemo>( + const component = React.useMemo>( () => ({ className: context.slots.base({ className }), ...rest, @@ -50,7 +50,7 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as BreadcrumbProps } +export type { ComponentOwnProps as BreadcrumbOwnProps, ComponentProps as BreadcrumbProps } export default Object.assign(Component, { Item: BreadcrumbItem, }) diff --git a/packages/react/src/components/breadcrumb/BreadcrumbItem.tsx b/packages/react/src/components/breadcrumb/BreadcrumbItem.tsx index 1d5921f..29089c5 100644 --- a/packages/react/src/components/breadcrumb/BreadcrumbItem.tsx +++ b/packages/react/src/components/breadcrumb/BreadcrumbItem.tsx @@ -12,14 +12,20 @@ type ComponentOwnProps = { href?: string } & BreadcrumbProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, href, ...rest } = props const Element = as ?? Breadcrumb @@ -48,5 +54,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as BreadcrumbItemProps } +export type { ComponentOwnProps as BreadcrumbItemOwnProps, ComponentProps as BreadcrumbItemProps } export default Component diff --git a/packages/react/src/components/breadcrumb/index.ts b/packages/react/src/components/breadcrumb/index.ts index eea1061..a21b488 100644 --- a/packages/react/src/components/breadcrumb/index.ts +++ b/packages/react/src/components/breadcrumb/index.ts @@ -1,4 +1,4 @@ -export type { BreadcrumbProps } from '@/components/breadcrumb/Breadcrumb' -export type { BreadcrumbItemProps } from '@/components/breadcrumb/BreadcrumbItem' +export type * from '@/components/breadcrumb/Breadcrumb' +export type * from '@/components/breadcrumb/BreadcrumbItem' export { default as Breadcrumb } from '@/components/breadcrumb/Breadcrumb' diff --git a/packages/react/src/components/button/Button.tsx b/packages/react/src/components/button/Button.tsx index 19b422b..9e6d834 100644 --- a/packages/react/src/components/button/Button.tsx +++ b/packages/react/src/components/button/Button.tsx @@ -15,14 +15,20 @@ type ComponentOwnProps = { } & ButtonProps & ButtonVariantProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, isLoading = false, isDisabled = false, color, size, ...rest } = props const Element = as ?? Button @@ -51,5 +57,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as ButtonProps } +export type { ComponentOwnProps as ButtonOwnProps, ComponentProps as ButtonProps } export default Component diff --git a/packages/react/src/components/button/index.ts b/packages/react/src/components/button/index.ts index 2aea22a..b3a33c8 100644 --- a/packages/react/src/components/button/index.ts +++ b/packages/react/src/components/button/index.ts @@ -1,3 +1,3 @@ -export type { ButtonProps } from '@/components/button/Button' +export type * from '@/components/button/Button' export { default as Button } from '@/components/button/Button' diff --git a/packages/react/src/components/card/Card.tsx b/packages/react/src/components/card/Card.tsx index 1bad7ac..67de64a 100644 --- a/packages/react/src/components/card/Card.tsx +++ b/packages/react/src/components/card/Card.tsx @@ -12,14 +12,20 @@ const __ELEMENT_TYPE__ = 'div' type ComponentOwnProps = CardVariantProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -44,7 +50,7 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as CardProps } +export type { ComponentOwnProps as CardOwnProps, ComponentProps as CardProps } export default Object.assign(Component, { Body: CardBody, Footer: CardFooter, diff --git a/packages/react/src/components/card/CardBody.tsx b/packages/react/src/components/card/CardBody.tsx index e18e8e8..792d226 100644 --- a/packages/react/src/components/card/CardBody.tsx +++ b/packages/react/src/components/card/CardBody.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'div' type ComponentOwnProps = {} -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -38,5 +44,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as CardBodyProps } +export type { ComponentOwnProps as CardBodyOwnProps, ComponentProps as CardBodyProps } export default Component diff --git a/packages/react/src/components/card/CardFooter.tsx b/packages/react/src/components/card/CardFooter.tsx index 669f8a1..b39e504 100644 --- a/packages/react/src/components/card/CardFooter.tsx +++ b/packages/react/src/components/card/CardFooter.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'div' type ComponentOwnProps = {} -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -38,5 +44,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as CardFooterProps } +export type { ComponentOwnProps as CardFooterOwnProps, ComponentProps as CardFooterProps } export default Component diff --git a/packages/react/src/components/card/CardHeader.tsx b/packages/react/src/components/card/CardHeader.tsx index 888f172..c34b7b8 100644 --- a/packages/react/src/components/card/CardHeader.tsx +++ b/packages/react/src/components/card/CardHeader.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'div' type ComponentOwnProps = {} -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -38,5 +44,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as CardHeaderProps } +export type { ComponentOwnProps as CardHeaderOwnProps, ComponentProps as CardHeaderProps } export default Component diff --git a/packages/react/src/components/card/index.ts b/packages/react/src/components/card/index.ts index c1c5659..609a54c 100644 --- a/packages/react/src/components/card/index.ts +++ b/packages/react/src/components/card/index.ts @@ -1,6 +1,6 @@ -export type { CardProps } from '@/components/card/Card' -export type { CardBodyProps } from '@/components/card/CardBody' -export type { CardFooterProps } from '@/components/card/CardFooter' -export type { CardHeaderProps } from '@/components/card/CardHeader' +export type * from '@/components/card/Card' +export type * from '@/components/card/CardBody' +export type * from '@/components/card/CardFooter' +export type * from '@/components/card/CardHeader' export { default as Card } from '@/components/card/Card' diff --git a/packages/react/src/components/checkbox/Checkbox.tsx b/packages/react/src/components/checkbox/Checkbox.tsx index f6627c1..1b6afc3 100644 --- a/packages/react/src/components/checkbox/Checkbox.tsx +++ b/packages/react/src/components/checkbox/Checkbox.tsx @@ -10,14 +10,20 @@ const __ELEMENT_TYPE__ = 'label' type ComponentOwnProps = CheckboxProps & CheckboxVariantProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, color, size, ...rest } = props const Element = as ?? Checkbox @@ -53,5 +59,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as CheckboxProps } +export type { ComponentOwnProps as CheckboxOwnProps, ComponentProps as CheckboxProps } export default Component diff --git a/packages/react/src/components/checkbox/index.ts b/packages/react/src/components/checkbox/index.ts index e9e1cd8..e221877 100644 --- a/packages/react/src/components/checkbox/index.ts +++ b/packages/react/src/components/checkbox/index.ts @@ -1,3 +1,3 @@ -export type { CheckboxProps } from '@/components/checkbox/Checkbox' +export type * from '@/components/checkbox/Checkbox' export { default as Checkbox } from '@/components/checkbox/Checkbox' diff --git a/packages/react/src/components/chip/Chip.tsx b/packages/react/src/components/chip/Chip.tsx index e37eed3..a2ba6ff 100644 --- a/packages/react/src/components/chip/Chip.tsx +++ b/packages/react/src/components/chip/Chip.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'span' type ComponentOwnProps = ChipVariantProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, color, size, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -38,5 +44,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as ChipProps } +export type { ComponentOwnProps as ChipOwnProps, ComponentProps as ChipProps } export default Component diff --git a/packages/react/src/components/chip/index.ts b/packages/react/src/components/chip/index.ts index defb27d..f034514 100644 --- a/packages/react/src/components/chip/index.ts +++ b/packages/react/src/components/chip/index.ts @@ -1,3 +1,3 @@ -export type { ChipProps } from '@/components/chip/Chip' +export type * from '@/components/chip/Chip' export { default as Chip } from '@/components/chip/Chip' diff --git a/packages/react/src/components/dialog/Dialog.tsx b/packages/react/src/components/dialog/Dialog.tsx index ef1b0bb..828f8dd 100644 --- a/packages/react/src/components/dialog/Dialog.tsx +++ b/packages/react/src/components/dialog/Dialog.tsx @@ -12,13 +12,18 @@ const __ELEMENT_TYPE__ = 'div' type ComponentOwnProps = DialogTriggerProps & DialogVariantProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode -const Component: ComponentType = (props: ComponentProps) => { +const Component: ComponentType = ( + props: ComponentProps +) => { const { as, children, className, blur, placement, ...rest } = props const Element = as ?? DialogTrigger @@ -40,7 +45,7 @@ const Component: ComponentType = = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? Dialog @@ -44,5 +50,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as DialogContentProps } +export type { ComponentOwnProps as DialogContentOwnProps, ComponentProps as DialogContentProps } export default Component diff --git a/packages/react/src/components/dialog/index.ts b/packages/react/src/components/dialog/index.ts index 01a6efd..b466069 100644 --- a/packages/react/src/components/dialog/index.ts +++ b/packages/react/src/components/dialog/index.ts @@ -1,4 +1,4 @@ -export type { DialogProps } from '@/components/dialog/Dialog' -export type { DialogContentProps } from '@/components/dialog/DialogContent' +export type * from '@/components/dialog/Dialog' +export type * from '@/components/dialog/DialogContent' export { default as Dialog } from '@/components/dialog/Dialog' diff --git a/packages/react/src/components/divider/Divider.tsx b/packages/react/src/components/divider/Divider.tsx index a368700..58f3006 100644 --- a/packages/react/src/components/divider/Divider.tsx +++ b/packages/react/src/components/divider/Divider.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'hr' type ComponentOwnProps = DividerVariantProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, orientation, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -40,5 +46,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as DividerProps } +export type { ComponentOwnProps as DividerOwnProps, ComponentProps as DividerProps } export default Component diff --git a/packages/react/src/components/divider/index.ts b/packages/react/src/components/divider/index.ts index 06ea18c..ada1c7a 100644 --- a/packages/react/src/components/divider/index.ts +++ b/packages/react/src/components/divider/index.ts @@ -1,3 +1,3 @@ -export type { DividerProps } from '@/components/divider/Divider' +export type * from '@/components/divider/Divider' export { default as Divider } from '@/components/divider/Divider' diff --git a/packages/react/src/components/form/Form.tsx b/packages/react/src/components/form/Form.tsx index d1ad48a..aa5bb8f 100644 --- a/packages/react/src/components/form/Form.tsx +++ b/packages/react/src/components/form/Form.tsx @@ -15,14 +15,20 @@ const __ELEMENT_TYPE__ = 'form' type ComponentOwnProps = FormProps & FormVariantProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, status, ...rest } = props const Element = as ?? Form @@ -45,7 +51,7 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as FormProps } +export type { ComponentOwnProps as FormOwnProps, ComponentProps as FormProps } export default Object.assign(Component, { Caption: FormCaption, Feedback: FormFeedback, diff --git a/packages/react/src/components/form/FormCaption.tsx b/packages/react/src/components/form/FormCaption.tsx index 5f37e57..e155091 100644 --- a/packages/react/src/components/form/FormCaption.tsx +++ b/packages/react/src/components/form/FormCaption.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'span' type ComponentOwnProps = {} -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -38,5 +44,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as FormCaptionProps } +export type { ComponentOwnProps as FormCaptionOwnProps, ComponentProps as FormCaptionProps } export default Component diff --git a/packages/react/src/components/form/FormFeedback.tsx b/packages/react/src/components/form/FormFeedback.tsx index 6bae9af..46615f1 100644 --- a/packages/react/src/components/form/FormFeedback.tsx +++ b/packages/react/src/components/form/FormFeedback.tsx @@ -13,14 +13,20 @@ type ComponentOwnProps = { type: FeedbackType } -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, type, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -46,5 +52,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as FormFeedbackProps, FeedbackType } +export type { ComponentOwnProps as FormFeedbackOwnProps, ComponentProps as FormFeedbackProps, FeedbackType } export default Component diff --git a/packages/react/src/components/form/FormGroup.tsx b/packages/react/src/components/form/FormGroup.tsx index 2123a93..6134823 100644 --- a/packages/react/src/components/form/FormGroup.tsx +++ b/packages/react/src/components/form/FormGroup.tsx @@ -14,14 +14,20 @@ type ComponentOwnProps = { error?: boolean } -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, name, success, warning, error, onChange, onBlur, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -55,5 +61,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as FormGroupProps } +export type { ComponentOwnProps as FormGroupOwnProps, ComponentProps as FormGroupProps } export default Component diff --git a/packages/react/src/components/form/FormLabel.tsx b/packages/react/src/components/form/FormLabel.tsx index 46aa885..f3dd9cf 100644 --- a/packages/react/src/components/form/FormLabel.tsx +++ b/packages/react/src/components/form/FormLabel.tsx @@ -10,14 +10,20 @@ const __ELEMENT_TYPE__ = 'label' type ComponentOwnProps = LabelProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, color, radius, size, variant, ...rest } = props const Element = as ?? Label @@ -41,5 +47,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as FormLabelProps } +export type { ComponentOwnProps as FormLabelOwnProps, ComponentProps as FormLabelProps } export default Component diff --git a/packages/react/src/components/form/index.ts b/packages/react/src/components/form/index.ts index d7c0d7a..22afdd3 100644 --- a/packages/react/src/components/form/index.ts +++ b/packages/react/src/components/form/index.ts @@ -1,7 +1,7 @@ -export type { FormProps } from '@/components/form/Form' -export type { FormCaptionProps } from '@/components/form/FormCaption' -export type { FormFeedbackProps } from '@/components/form/FormFeedback' -export type { FormGroupProps } from '@/components/form/FormGroup' -export type { FormLabelProps } from '@/components/form/FormLabel' +export type * from '@/components/form/Form' +export type * from '@/components/form/FormCaption' +export type * from '@/components/form/FormFeedback' +export type * from '@/components/form/FormGroup' +export type * from '@/components/form/FormLabel' export { default as Form } from '@/components/form/Form' diff --git a/packages/react/src/components/link/Link.tsx b/packages/react/src/components/link/Link.tsx index 28f2f37..58d266e 100644 --- a/packages/react/src/components/link/Link.tsx +++ b/packages/react/src/components/link/Link.tsx @@ -10,14 +10,20 @@ const __ELEMENT_TYPE__ = 'a' type ComponentOwnProps = LinkVariantProps & LinkProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, underline, ...rest } = props const Element = as ?? Link @@ -40,5 +46,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as LinkProps } +export type { ComponentOwnProps as LinkOwnProps, ComponentProps as LinkProps } export default Component diff --git a/packages/react/src/components/link/index.ts b/packages/react/src/components/link/index.ts index 1d3395b..0657809 100644 --- a/packages/react/src/components/link/index.ts +++ b/packages/react/src/components/link/index.ts @@ -1,3 +1,3 @@ -export type { LinkProps } from '@/components/link/Link' +export type * from '@/components/link/Link' export { default as Link } from '@/components/link/Link' diff --git a/packages/react/src/components/menu/Menu.tsx b/packages/react/src/components/menu/Menu.tsx index e833079..fdc2420 100644 --- a/packages/react/src/components/menu/Menu.tsx +++ b/packages/react/src/components/menu/Menu.tsx @@ -14,13 +14,18 @@ const __ELEMENT_TYPE__ = 'div' type ComponentOwnProps = MenuTriggerProps & MenuVariantProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode -const Component: ComponentType = (props: ComponentProps) => { +const Component: ComponentType = ( + props: ComponentProps +) => { const { as, children, className, size, status, ...rest } = props const Element = as ?? MenuTrigger @@ -42,7 +47,7 @@ const Component: ComponentType = = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? MenuItem @@ -40,5 +46,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as MenuItemProps } +export type { ComponentOwnProps as MenuItemOwnProps, ComponentProps as MenuItemProps } export default Component diff --git a/packages/react/src/components/menu/MenuList.tsx b/packages/react/src/components/menu/MenuList.tsx index b6806bc..cf28a8a 100644 --- a/packages/react/src/components/menu/MenuList.tsx +++ b/packages/react/src/components/menu/MenuList.tsx @@ -8,21 +8,21 @@ import { useMenuContext } from '@/components/menu/use-menu.hook' const __ELEMENT_TYPE__ = 'div' -type ComponentOwnProps = MenuProps +type ComponentOwnProps = MenuProps -type ComponentProps = Polymophic.ComponentPropsWithRef< - T, - ComponentOwnProps +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps > -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - ( - props: ComponentProps, - ref: Polymophic.Ref + ( + props: ComponentProps, + ref: Polymophic.Ref ) => { const { as, children, className, ...rest } = props @@ -30,7 +30,7 @@ const Component: ComponentType = React.forwardRef( const { slots } = useMenuContext() - const component = React.useMemo>( + const component = React.useMemo>( () => ({ className: slots.list({ className: className?.toString() }), ...rest, @@ -46,5 +46,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as MenuListProps } +export type { ComponentOwnProps as MenuListOwnProps, ComponentProps as MenuListProps } export default Component diff --git a/packages/react/src/components/menu/MenuPopover.tsx b/packages/react/src/components/menu/MenuPopover.tsx index 17c2c60..6c0bb0c 100644 --- a/packages/react/src/components/menu/MenuPopover.tsx +++ b/packages/react/src/components/menu/MenuPopover.tsx @@ -10,14 +10,20 @@ const __ELEMENT_TYPE__ = 'div' type ComponentOwnProps = PopoverProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? Popover @@ -40,5 +46,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as MenuPopoverProps } +export type { ComponentOwnProps as MenuPopoverOwnProps, ComponentProps as MenuPopoverProps } export default Component diff --git a/packages/react/src/components/menu/index.ts b/packages/react/src/components/menu/index.ts index 851e079..4d04019 100644 --- a/packages/react/src/components/menu/index.ts +++ b/packages/react/src/components/menu/index.ts @@ -1,3 +1,6 @@ -export type { MenuProps } from '@/components/menu/Menu' +export type * from '@/components/menu/Menu' +export type * from '@/components/menu/MenuItem' +export type * from '@/components/menu/MenuList' +export type * from '@/components/menu/MenuPopover' export { default as Menu } from '@/components/menu/Menu' diff --git a/packages/react/src/components/navigation/Navigation.tsx b/packages/react/src/components/navigation/Navigation.tsx index 3ea89fc..5500f3f 100644 --- a/packages/react/src/components/navigation/Navigation.tsx +++ b/packages/react/src/components/navigation/Navigation.tsx @@ -18,14 +18,20 @@ const __ELEMENT_TYPE__ = 'nav' type ComponentOwnProps = NavigationVariantProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, orientation, position, size, variant, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -50,7 +56,7 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as NavigationProps } +export type { ComponentOwnProps as NavigationOwnProps, ComponentProps as NavigationProps } export default Object.assign(Component, { Brand: NavigationBrand, Content: NavigationContent, diff --git a/packages/react/src/components/navigation/NavigationBrand.tsx b/packages/react/src/components/navigation/NavigationBrand.tsx index b86d928..cf24ed4 100644 --- a/packages/react/src/components/navigation/NavigationBrand.tsx +++ b/packages/react/src/components/navigation/NavigationBrand.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'div' type ComponentOwnProps = {} -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -38,5 +44,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as NavigationBrandProps } +export type { ComponentOwnProps as NavigationBrandOwnProps, ComponentProps as NavigationBrandProps } export default Component diff --git a/packages/react/src/components/navigation/NavigationContent.tsx b/packages/react/src/components/navigation/NavigationContent.tsx index 77157a4..f3e48eb 100644 --- a/packages/react/src/components/navigation/NavigationContent.tsx +++ b/packages/react/src/components/navigation/NavigationContent.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'div' type ComponentOwnProps = {} -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -38,5 +44,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as NavigationContentProps } +export type { ComponentOwnProps as NavigationContentOwnProps, ComponentProps as NavigationContentProps } export default Component diff --git a/packages/react/src/components/navigation/NavigationDivider.tsx b/packages/react/src/components/navigation/NavigationDivider.tsx index 8dc3851..4951be0 100644 --- a/packages/react/src/components/navigation/NavigationDivider.tsx +++ b/packages/react/src/components/navigation/NavigationDivider.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'hr' type ComponentOwnProps = {} -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -38,5 +44,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as NavigationDividerProps } +export type { ComponentOwnProps as NavigationDividerOwnProps, ComponentProps as NavigationDividerProps } export default Component diff --git a/packages/react/src/components/navigation/NavigationItem.tsx b/packages/react/src/components/navigation/NavigationItem.tsx index 4fd745a..5527d57 100644 --- a/packages/react/src/components/navigation/NavigationItem.tsx +++ b/packages/react/src/components/navigation/NavigationItem.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'li' type ComponentOwnProps = {} -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -38,5 +44,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as NavigationItemProps } +export type { ComponentOwnProps as NavigationItemOwnProps, ComponentProps as NavigationItemProps } export default Component diff --git a/packages/react/src/components/navigation/NavigationLink.tsx b/packages/react/src/components/navigation/NavigationLink.tsx index 98de6f5..e76c614 100644 --- a/packages/react/src/components/navigation/NavigationLink.tsx +++ b/packages/react/src/components/navigation/NavigationLink.tsx @@ -12,14 +12,20 @@ type ComponentOwnProps = LinkProps & { isSelected?: boolean } -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, isSelected, ...rest } = props const Element = as ?? Link @@ -42,5 +48,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as NavigationLinkProps } +export type { ComponentOwnProps as NavigationLinkOwnProps, ComponentProps as NavigationLinkProps } export default Component diff --git a/packages/react/src/components/navigation/NavigationPortal.tsx b/packages/react/src/components/navigation/NavigationPortal.tsx index e7153bd..e9244ee 100644 --- a/packages/react/src/components/navigation/NavigationPortal.tsx +++ b/packages/react/src/components/navigation/NavigationPortal.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'div' type ComponentOwnProps = {} -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -38,5 +44,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as NavigationPortalProps } +export type { ComponentOwnProps as NavigationPortalOwnProps, ComponentProps as NavigationPortalProps } export default Component diff --git a/packages/react/src/components/navigation/NavigationSegment.tsx b/packages/react/src/components/navigation/NavigationSegment.tsx index 06a3009..a275863 100644 --- a/packages/react/src/components/navigation/NavigationSegment.tsx +++ b/packages/react/src/components/navigation/NavigationSegment.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'ul' type ComponentOwnProps = {} -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -38,5 +44,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as NavigationSegmentProps } +export type { ComponentOwnProps as NavigationSegmentOwnProps, ComponentProps as NavigationSegmentProps } export default Component diff --git a/packages/react/src/components/navigation/NavigationTitle.tsx b/packages/react/src/components/navigation/NavigationTitle.tsx index 9c01da2..fca0cfd 100644 --- a/packages/react/src/components/navigation/NavigationTitle.tsx +++ b/packages/react/src/components/navigation/NavigationTitle.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'span' type ComponentOwnProps = {} -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -38,5 +44,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as NavigationTitleProps } +export type { ComponentOwnProps as NavigationTitleOwnProps, ComponentProps as NavigationTitleProps } export default Component diff --git a/packages/react/src/components/navigation/NavigationTrigger.tsx b/packages/react/src/components/navigation/NavigationTrigger.tsx index ed52813..5e996cd 100644 --- a/packages/react/src/components/navigation/NavigationTrigger.tsx +++ b/packages/react/src/components/navigation/NavigationTrigger.tsx @@ -10,14 +10,20 @@ const __ELEMENT_TYPE__ = 'button' type ComponentOwnProps = ButtonProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? Button @@ -40,5 +46,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as NavigationTriggerProps } +export type { ComponentOwnProps as NavigationTriggerOwnProps, ComponentProps as NavigationTriggerProps } export default Component diff --git a/packages/react/src/components/navigation/index.ts b/packages/react/src/components/navigation/index.ts index 0bd0415..98d34ed 100644 --- a/packages/react/src/components/navigation/index.ts +++ b/packages/react/src/components/navigation/index.ts @@ -1,12 +1,12 @@ -export type { NavigationProps } from '@/components/navigation/Navigation' -export type { NavigationBrandProps } from '@/components/navigation/NavigationBrand' -export type { NavigationContentProps } from '@/components/navigation/NavigationContent' -export type { NavigationDividerProps } from '@/components/navigation/NavigationDivider' -export type { NavigationItemProps } from '@/components/navigation/NavigationItem' -export type { NavigationLinkProps } from '@/components/navigation/NavigationLink' -export type { NavigationPortalProps } from '@/components/navigation/NavigationPortal' -export type { NavigationSegmentProps } from '@/components/navigation/NavigationSegment' -export type { NavigationTitleProps } from '@/components/navigation/NavigationTitle' -export type { NavigationTriggerProps } from '@/components/navigation/NavigationTrigger' +export type * from '@/components/navigation/Navigation' +export type * from '@/components/navigation/NavigationBrand' +export type * from '@/components/navigation/NavigationContent' +export type * from '@/components/navigation/NavigationDivider' +export type * from '@/components/navigation/NavigationItem' +export type * from '@/components/navigation/NavigationLink' +export type * from '@/components/navigation/NavigationPortal' +export type * from '@/components/navigation/NavigationSegment' +export type * from '@/components/navigation/NavigationTitle' +export type * from '@/components/navigation/NavigationTrigger' export { default as Navigation } from '@/components/navigation/Navigation' diff --git a/packages/react/src/components/progress/Progress.tsx b/packages/react/src/components/progress/Progress.tsx index 022f848..99867a4 100644 --- a/packages/react/src/components/progress/Progress.tsx +++ b/packages/react/src/components/progress/Progress.tsx @@ -10,14 +10,20 @@ const __ELEMENT_TYPE__ = 'div' type ComponentOwnProps = ProgressVariantProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, radius, size, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -42,7 +48,7 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as ProgressProps } +export type { ComponentOwnProps as ProgressOwnProps, ComponentProps as ProgressProps } export default Object.assign(Component, { Bar: ProgressBar, }) diff --git a/packages/react/src/components/progress/ProgressBar.tsx b/packages/react/src/components/progress/ProgressBar.tsx index 4f04ab2..aafab24 100644 --- a/packages/react/src/components/progress/ProgressBar.tsx +++ b/packages/react/src/components/progress/ProgressBar.tsx @@ -11,14 +11,20 @@ type ComponentOwnProps = { width: number } -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, style, color, width, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -46,5 +52,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as ProgressBarProps } +export type { ComponentOwnProps as ProgressBarOwnProps, ComponentProps as ProgressBarProps } export default Component diff --git a/packages/react/src/components/progress/index.ts b/packages/react/src/components/progress/index.ts index 8917b26..7f8a165 100644 --- a/packages/react/src/components/progress/index.ts +++ b/packages/react/src/components/progress/index.ts @@ -1,4 +1,4 @@ -export type { ProgressProps } from '@/components/progress/Progress' -export type { ProgressBarProps } from '@/components/progress/ProgressBar' +export type * from '@/components/progress/Progress' +export type * from '@/components/progress/ProgressBar' export { default as Progress } from '@/components/progress/Progress' diff --git a/packages/react/src/components/select/Select.tsx b/packages/react/src/components/select/Select.tsx index cb6f8ab..3b54ae4 100644 --- a/packages/react/src/components/select/Select.tsx +++ b/packages/react/src/components/select/Select.tsx @@ -13,39 +13,39 @@ import { SelectContext, useSelect } from '@/components/select/use-select.hook' const __ELEMENT_TYPE__ = 'select' -type OveriddenSelectProps = Override< - SelectProps, +type OveriddenSelectProps = Override< + SelectProps, { - children?: React.ReactNode | ((item: T) => React.ReactNode) + children?: React.ReactNode | ((item: TElement) => React.ReactNode) } > -type OveriddenListBoxProps = Override< - ListBoxProps, +type OveriddenListBoxProps = Override< + ListBoxProps, { - items?: Iterable | null + items?: Iterable | null } > -type ComponentOwnProps = SelectVariantProps & - OveriddenSelectProps & - OveriddenListBoxProps & { +type ComponentOwnProps = SelectVariantProps & + OveriddenSelectProps & + OveriddenListBoxProps & { placement?: 'top' | 'bottom' } -type ComponentProps = Polymophic.ComponentPropsWithRef< - T, - ComponentOwnProps -> +type ComponentProps< + TData extends object, + TElement extends React.ElementType = typeof __ELEMENT_TYPE__, +> = Polymophic.ComponentPropsWithRef> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - ( - props: ComponentProps, - ref: Polymophic.Ref + ( + props: ComponentProps, + ref: Polymophic.Ref ) => { const { as, @@ -78,7 +78,7 @@ const Component: ComponentType = React.forwardRef( onChange: group?.onChange ?? onChange, }) - const select = React.useMemo>( + const select = React.useMemo>( () => ({ name: group?.name, placeholder, @@ -116,7 +116,7 @@ const Component: ComponentType = React.forwardRef( [context.slots, placement] ) - const listbox = React.useMemo>( + const listbox = React.useMemo>( () => ({ items: items ?? undefined, selectionMode: mode, @@ -159,7 +159,7 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as SelectProps } +export type { ComponentOwnProps as SelectOwnProps, ComponentProps as SelectProps } export default Object.assign(Component, { Option: SelectOption, }) diff --git a/packages/react/src/components/select/SelectOption.tsx b/packages/react/src/components/select/SelectOption.tsx index 3358c99..0489e94 100644 --- a/packages/react/src/components/select/SelectOption.tsx +++ b/packages/react/src/components/select/SelectOption.tsx @@ -10,14 +10,20 @@ const __ELEMENT_TYPE__ = 'option' type ComponentOwnProps = ListBoxItemProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? ListBoxItem @@ -40,5 +46,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as SelectOptionProps } +export type { ComponentOwnProps as SelectOptionOwnProps, ComponentProps as SelectOptionProps } export default Component diff --git a/packages/react/src/components/select/SelectValue.tsx b/packages/react/src/components/select/SelectValue.tsx index f98da74..0f4ddd1 100644 --- a/packages/react/src/components/select/SelectValue.tsx +++ b/packages/react/src/components/select/SelectValue.tsx @@ -8,21 +8,21 @@ import { useSelectContext } from '@/components/select/use-select.hook' const __ELEMENT_TYPE__ = 'span' -type ComponentOwnProps = SelectValueProps +type ComponentOwnProps = SelectValueProps -type ComponentProps = Polymophic.ComponentPropsWithRef< - T, - ComponentOwnProps +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps > -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - ( - props: ComponentProps, - ref: Polymophic.Ref + ( + props: ComponentProps, + ref: Polymophic.Ref ) => { const { as, children, className, ...rest } = props @@ -31,7 +31,7 @@ const Component: ComponentType = React.forwardRef( const { slots } = useSelectContext() const { selectedItem } = React.useContext(SelectStateContext) - const component = React.useMemo>( + const component = React.useMemo>( () => ({ className: slots.placeholder({ className: className?.toString() }), ...rest, @@ -49,5 +49,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as SelectValueProps } +export type { ComponentOwnProps as SelectValueOwnProps, ComponentProps as SelectValueProps } export default Component diff --git a/packages/react/src/components/select/index.ts b/packages/react/src/components/select/index.ts index c171348..e602608 100644 --- a/packages/react/src/components/select/index.ts +++ b/packages/react/src/components/select/index.ts @@ -1,4 +1,4 @@ -export type { SelectProps } from '@/components/select/Select' -export type { SelectOptionProps } from '@/components/select/SelectOption' +export type * from '@/components/select/Select' +export type * from '@/components/select/SelectOption' export { default as Select } from '@/components/select/Select' diff --git a/packages/react/src/components/select/use-select.hook.ts b/packages/react/src/components/select/use-select.hook.ts index c5a4e35..8866ea0 100644 --- a/packages/react/src/components/select/use-select.hook.ts +++ b/packages/react/src/components/select/use-select.hook.ts @@ -7,8 +7,8 @@ import React from 'react' import { createContext } from '@/utilities/context' -type UseSelectProps = SelectVariantProps & - Pick, 'onSelectionChange'> & { +type UseSelectProps = SelectVariantProps & + Pick, 'onSelectionChange'> & { ref?: React.RefObject name?: string behavior?: 'toggle' | 'replace' @@ -18,7 +18,7 @@ type UseSelectProps = SelectVariantProps & type UseSelectReturn = ReturnType -export const useSelect = (props: UseSelectProps) => { +export const useSelect = (props: UseSelectProps) => { const { ref, name, size, status, onChange, onSelectionChange } = props const slots = React.useMemo(() => select({ size, status }), [size, status]) diff --git a/packages/react/src/components/spinner/Spinner.tsx b/packages/react/src/components/spinner/Spinner.tsx index 366a96d..58c1d01 100644 --- a/packages/react/src/components/spinner/Spinner.tsx +++ b/packages/react/src/components/spinner/Spinner.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'svg' type ComponentOwnProps = SpinnerVariantProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, size, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -43,5 +49,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as SpinnerProps } +export type { ComponentOwnProps as SpinnerOwnProps, ComponentProps as SpinnerProps } export default Component diff --git a/packages/react/src/components/spinner/index.ts b/packages/react/src/components/spinner/index.ts index f02fc3b..4d6625c 100644 --- a/packages/react/src/components/spinner/index.ts +++ b/packages/react/src/components/spinner/index.ts @@ -1,3 +1,3 @@ -export type { SpinnerProps } from '@/components/spinner/Spinner' +export type * from '@/components/spinner/Spinner' export { default as Spinner } from '@/components/spinner/Spinner' diff --git a/packages/react/src/components/switch/Switch.tsx b/packages/react/src/components/switch/Switch.tsx index a5cf54d..823214b 100644 --- a/packages/react/src/components/switch/Switch.tsx +++ b/packages/react/src/components/switch/Switch.tsx @@ -12,14 +12,20 @@ const __ELEMENT_TYPE__ = 'label' type ComponentOwnProps = SwitchProps & ToggleVariantProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, color, size, ...rest } = props const Element = as ?? Switch @@ -48,5 +54,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as SwitchProps } +export type { ComponentOwnProps as SwitchOwnProps, ComponentProps as SwitchProps } export default Component diff --git a/packages/react/src/components/switch/index.ts b/packages/react/src/components/switch/index.ts index fdb3315..868cfae 100644 --- a/packages/react/src/components/switch/index.ts +++ b/packages/react/src/components/switch/index.ts @@ -1,3 +1,3 @@ -export type { SwitchProps } from '@/components/switch/Switch' +export type * from '@/components/switch/Switch' export { default as Switch } from '@/components/switch/Switch' diff --git a/packages/react/src/components/table/Table.tsx b/packages/react/src/components/table/Table.tsx index b830db7..f08ab5c 100644 --- a/packages/react/src/components/table/Table.tsx +++ b/packages/react/src/components/table/Table.tsx @@ -20,14 +20,20 @@ type ComponentOwnProps = Omit mode?: 'none' | 'single' | 'multiple' } -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, behavior, mode, size, sticky, striped, headingless, ...rest } = props const Element = as ?? Table @@ -54,7 +60,7 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as TableProps } +export type { ComponentOwnProps as TableOwnProps, ComponentProps as TableProps } export default Object.assign(Component, { Body: TableBody, Cell: TableCell, diff --git a/packages/react/src/components/table/TableBody.tsx b/packages/react/src/components/table/TableBody.tsx index b105afa..e3e12e4 100644 --- a/packages/react/src/components/table/TableBody.tsx +++ b/packages/react/src/components/table/TableBody.tsx @@ -8,21 +8,21 @@ import { useTableContext } from './use-table.hook' const __ELEMENT_TYPE__ = 'tbody' -type ComponentOwnProps = TableBodyProps +type ComponentOwnProps = TableBodyProps -type ComponentProps = Polymophic.ComponentPropsWithRef< - T, - ComponentOwnProps +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps > -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - ( - props: ComponentProps, - ref: Polymophic.Ref + ( + props: ComponentProps, + ref: Polymophic.Ref ) => { const { as, children, className, ...rest } = props @@ -30,7 +30,7 @@ const Component: ComponentType = React.forwardRef( const { slots } = useTableContext() - const component = React.useMemo>( + const component = React.useMemo>( () => ({ className: slots.tbody({ className: className?.toString() }), ...rest, @@ -46,5 +46,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as TableBodyProps } +export type { ComponentOwnProps as TableBodyOwnProps, ComponentProps as TableBodyProps } export default Component diff --git a/packages/react/src/components/table/TableCell.tsx b/packages/react/src/components/table/TableCell.tsx index bcad2c4..67b70ab 100644 --- a/packages/react/src/components/table/TableCell.tsx +++ b/packages/react/src/components/table/TableCell.tsx @@ -11,14 +11,20 @@ const __ELEMENT_TYPE__ = 'td' type ComponentOwnProps = CellProps & Pick -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, size, ...rest } = props const Element = as ?? Cell @@ -41,5 +47,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as TableCellProps } +export type { ComponentOwnProps as TableCellOwnProps, ComponentProps as TableCellProps } export default Component diff --git a/packages/react/src/components/table/TableColumn.tsx b/packages/react/src/components/table/TableColumn.tsx index da11bd3..2d93f76 100644 --- a/packages/react/src/components/table/TableColumn.tsx +++ b/packages/react/src/components/table/TableColumn.tsx @@ -11,14 +11,20 @@ const __ELEMENT_TYPE__ = 'th' type ComponentOwnProps = ColumnProps & Pick -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, size, ...rest } = props const Element = as ?? Column @@ -41,5 +47,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as TableColumnProps } +export type { ComponentOwnProps as TableColumnOwnProps, ComponentProps as TableColumnProps } export default Component diff --git a/packages/react/src/components/table/TableHead.tsx b/packages/react/src/components/table/TableHead.tsx index 01ec5a7..082159e 100644 --- a/packages/react/src/components/table/TableHead.tsx +++ b/packages/react/src/components/table/TableHead.tsx @@ -10,21 +10,21 @@ import { useTableContext } from '@/components/table/use-table.hook' const __ELEMENT_TYPE__ = 'thead' -type ComponentOwnProps = TableHeaderProps +type ComponentOwnProps = TableHeaderProps -type ComponentProps = Polymophic.ComponentPropsWithRef< - T, - ComponentOwnProps +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps > -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - ( - props: ComponentProps, - ref: Polymophic.Ref + ( + props: ComponentProps, + ref: Polymophic.Ref ) => { const { as, children, className, columns, ...rest } = props @@ -33,7 +33,7 @@ const Component: ComponentType = React.forwardRef( const { slots } = useTableContext() const { selectionBehavior, selectionMode, allowsDragging } = useTableOptions() - const component = React.useMemo>( + const component = React.useMemo>( () => ({ className: slots.thead({ className: className?.toString() }), ...rest, @@ -55,5 +55,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as TableHeadProps } +export type { ComponentOwnProps as TableHeadOwnProps, ComponentProps as TableHeadProps } export default Component diff --git a/packages/react/src/components/table/TableRow.tsx b/packages/react/src/components/table/TableRow.tsx index 27e37f6..9a64f9c 100644 --- a/packages/react/src/components/table/TableRow.tsx +++ b/packages/react/src/components/table/TableRow.tsx @@ -10,21 +10,21 @@ import { useTableContext } from '@/components/table/use-table.hook' const __ELEMENT_TYPE__ = 'tr' -type ComponentOwnProps = RowProps +type ComponentOwnProps = RowProps -type ComponentProps = Polymophic.ComponentPropsWithRef< - T, - ComponentOwnProps +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps > -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - ( - props: ComponentProps, - ref: Polymophic.Ref + ( + props: ComponentProps, + ref: Polymophic.Ref ) => { const { as, children, className, columns, ...rest } = props @@ -33,7 +33,7 @@ const Component: ComponentType = React.forwardRef( const { slots } = useTableContext() const { selectionBehavior, allowsDragging } = useTableOptions() - const component = React.useMemo>( + const component = React.useMemo>( () => ({ className: slots.tr({ className: className?.toString() }), ...rest, @@ -61,5 +61,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as TableRowProps } +export type { ComponentOwnProps as TableRowOwnProps, ComponentProps as TableRowProps } export default Component diff --git a/packages/react/src/components/table/index.ts b/packages/react/src/components/table/index.ts index 5521e8b..73e97ec 100644 --- a/packages/react/src/components/table/index.ts +++ b/packages/react/src/components/table/index.ts @@ -1,8 +1,8 @@ -export type { TableProps } from '@/components/table/Table' -export type { TableBodyProps } from '@/components/table/TableBody' -export type { TableCellProps } from '@/components/table/TableCell' -export type { TableColumnProps } from '@/components/table/TableColumn' -export type { TableHeadProps } from '@/components/table/TableHead' -export type { TableRowProps } from '@/components/table/TableRow' +export type * from '@/components/table/Table' +export type * from '@/components/table/TableBody' +export type * from '@/components/table/TableCell' +export type * from '@/components/table/TableColumn' +export type * from '@/components/table/TableHead' +export type * from '@/components/table/TableRow' export { default as Table } from '@/components/table/Table' diff --git a/packages/react/src/components/typography/TypographyHeading.tsx b/packages/react/src/components/typography/TypographyHeading.tsx index 97653a6..87dd3a9 100644 --- a/packages/react/src/components/typography/TypographyHeading.tsx +++ b/packages/react/src/components/typography/TypographyHeading.tsx @@ -14,14 +14,20 @@ type ComponentOwnProps = HeadingProps & { level?: HeadingLevel } -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, ...rest } = props const Element = as ?? Heading @@ -56,5 +62,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as TypographyHeadingProps } +export type { ComponentOwnProps as TypographyHeadingOwnProps, ComponentProps as TypographyHeadingProps } export default Component diff --git a/packages/react/src/components/typography/TypographyParagraph.tsx b/packages/react/src/components/typography/TypographyParagraph.tsx index e1b3ad7..cd31c3b 100644 --- a/packages/react/src/components/typography/TypographyParagraph.tsx +++ b/packages/react/src/components/typography/TypographyParagraph.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'p' type ComponentOwnProps = TypographyVariantProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, variant, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -38,5 +44,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as TypographyParagraphProps } +export type { ComponentOwnProps as TypographyParagraphOwnProps, ComponentProps as TypographyParagraphProps } export default Component diff --git a/packages/react/src/components/typography/TypographyText.tsx b/packages/react/src/components/typography/TypographyText.tsx index ba6264f..4815f58 100644 --- a/packages/react/src/components/typography/TypographyText.tsx +++ b/packages/react/src/components/typography/TypographyText.tsx @@ -8,14 +8,20 @@ const __ELEMENT_TYPE__ = 'span' type ComponentOwnProps = TypographyVariantProps -type ComponentProps = Polymophic.ComponentPropsWithRef +type ComponentProps = Polymophic.ComponentPropsWithRef< + TElement, + ComponentOwnProps +> -type ComponentType = ( - props: ComponentProps +type ComponentType = ( + props: ComponentProps ) => React.ReactNode const Component: ComponentType = React.forwardRef( - (props: ComponentProps, ref: Polymophic.Ref) => { + ( + props: ComponentProps, + ref: Polymophic.Ref + ) => { const { as, children, className, variant, ...rest } = props const Element = as ?? __ELEMENT_TYPE__ @@ -38,5 +44,5 @@ const Component: ComponentType = React.forwardRef( } ) -export type { ComponentOwnProps as TypographyTextProps } +export type { ComponentOwnProps as TypographyTextProps, ComponentProps as TypographyTextOwnProps } export default Component diff --git a/packages/react/src/components/typography/index.ts b/packages/react/src/components/typography/index.ts index cf48956..276e63b 100644 --- a/packages/react/src/components/typography/index.ts +++ b/packages/react/src/components/typography/index.ts @@ -1,5 +1,5 @@ -export type { TypographyHeadingProps } from '@/components/typography/TypographyHeading' -export type { TypographyHeadingLevelProps } from '@/components/typography/TypographyHeadingLevel' -export type { TypographyParagraphProps } from '@/components/typography/TypographyParagraph' +export type * from '@/components/typography/TypographyHeading' +export type * from '@/components/typography/TypographyHeadingLevel' +export type * from '@/components/typography/TypographyParagraph' export { default as Typography } from '@/components/typography/Typography' diff --git a/packages/react/src/utilities/types.ts b/packages/react/src/utilities/types.ts index 4a87318..e45d9c3 100644 --- a/packages/react/src/utilities/types.ts +++ b/packages/react/src/utilities/types.ts @@ -7,7 +7,7 @@ export type Component< export type Override = Omit & R -export type ComponentWithoutAs = Omit, 'as'> +export type ComponentWithoutAs = Omit, 'as'> export type Selection = 'all' | Set diff --git a/packages/theme/src/components/input.ts b/packages/theme/src/components/input.ts index 6c6899e..ef4b24c 100644 --- a/packages/theme/src/components/input.ts +++ b/packages/theme/src/components/input.ts @@ -12,7 +12,7 @@ export const input = tv({ 'has-[:disabled]:opacity-50', 'focus-within:outline-dashed focus-within:outline-offset-2 focus-within:outline-1', ], - input: ['flex-1', 'bg-foreground', 'w-full', 'font-normal', 'placeholder-subtitle', 'outline-none', 'py-2 px-1'], + input: ['flex-1', 'bg-foreground', 'w-full', 'font-normal', 'placeholder-subtitle', 'outline-none', 'p-1.5'], addon: ['flex items-center', 'bg-foreground', 'px-3'], }, variants: {