Skip to content

Commit

Permalink
fix: compound export pattern f** with fwd refs at root level
Browse files Browse the repository at this point in the history
  • Loading branch information
soykje committed Sep 11, 2024
1 parent c202683 commit c315c0c
Show file tree
Hide file tree
Showing 22 changed files with 47 additions and 91 deletions.
6 changes: 2 additions & 4 deletions packages/components/accordion/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import type { FC } from 'react'

import { Accordion as Root, type AccordionProps } from './Accordion'
import { Accordion as Root } from './Accordion'
import { Item } from './AccordionItem'
import { ItemContent } from './AccordionItemContent'
import { ItemHeader } from './AccordionItemHeader'
import { ItemTrigger } from './AccordionItemTrigger'

export const Accordion: FC<AccordionProps> & {
export const Accordion: typeof Root & {
Item: typeof Item
ItemHeader: typeof ItemHeader
ItemTrigger: typeof ItemTrigger
Expand Down
6 changes: 2 additions & 4 deletions packages/components/alert-dialog/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { FC } from 'react'

import { AlertDialog as Root, AlertDialogProps } from './AlertDialog'
import { AlertDialog as Root } from './AlertDialog'
import { AlertDialogAction } from './AlertDialogAction'
import { AlertDialogBody } from './AlertDialogBody'
import { AlertDialogCancel } from './AlertDialogCancel'
Expand All @@ -27,7 +25,7 @@ export { type AlertDialogPortalProps } from './AlertDialogPortal'
export { type AlertDialogTitleProps } from './AlertDialogTitle'
export { type AlertDialogTriggerProps } from './AlertDialogTrigger'

export const AlertDialog: FC<AlertDialogProps> & {
export const AlertDialog: typeof Root & {
Action: typeof AlertDialogAction
Body: typeof AlertDialogBody
Cancel: typeof AlertDialogCancel
Expand Down
8 changes: 4 additions & 4 deletions packages/components/breadcrumb/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import type { FC } from 'react'

import { Breadcrumb as Root, type BreadcrumbProps } from './Breadcrumb'
import { Breadcrumb as Root } from './Breadcrumb'
import { CurrentPage } from './BreadcrumbCurrentPage'
import { Item } from './BreadcrumbItem'
import { Link } from './BreadcrumbLink'
import { Separator } from './BreadcrumbSeparator'

export const Breadcrumb: FC<BreadcrumbProps> & {
export const Breadcrumb: typeof Root & {
Item: typeof Item
Link: typeof Link
CurrentPage: typeof CurrentPage
Expand All @@ -23,3 +21,5 @@ Item.displayName = 'Breadcrumb.Item'
Link.displayName = 'Breadcrumb.Link'
CurrentPage.displayName = 'Breadcrumb.CurrentPage'
Separator.displayName = 'Breadcrumb.Separator'

export type { BreadcrumbProps } from './Breadcrumb'
16 changes: 6 additions & 10 deletions packages/components/chip/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
import { ComponentProps, FC } from 'react'

import { Chip as Root } from './Chip'
import { ChipClearButton } from './ChipClearButton'
import { ChipContent } from './ChipContent'
import { ChipLeadingIcon } from './ChipLeadingIcon'
import { ChipTrailingIcon } from './ChipTrailingIcon'

export { type ChipClearButtonProps } from './ChipClearButton'
export { type ChipContentProps } from './ChipContent'
export { type ChipLeadingIconProps } from './ChipLeadingIcon'
export { type ChipTrailingIconProps } from './ChipTrailingIcon'

type ChipProps = ComponentProps<typeof Root>

export const Chip: FC<ChipProps> & {
export const Chip: typeof Root & {
Content: typeof ChipContent
LeadingIcon: typeof ChipLeadingIcon
TrailingIcon: typeof ChipTrailingIcon
Expand All @@ -30,3 +21,8 @@ Chip.ClearButton.displayName = 'Chip.ClearButton'
Chip.Content.displayName = 'Chip.Content'
Chip.LeadingIcon.displayName = 'Chip.LeadingIcon'
Chip.TrailingIcon.displayName = 'Chip.TrailingIcon'

export { type ChipClearButtonProps } from './ChipClearButton'
export { type ChipContentProps } from './ChipContent'
export { type ChipLeadingIconProps } from './ChipLeadingIcon'
export { type ChipTrailingIconProps } from './ChipTrailingIcon'
6 changes: 2 additions & 4 deletions packages/components/collapsible/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import type { FC } from 'react'

import { Collapsible as Root, type CollapsibleProps } from './Collapsible'
import { Collapsible as Root } from './Collapsible'
import { Content } from './CollapsibleContent'
import { Trigger } from './CollapsibleTrigger'

export const Collapsible: FC<CollapsibleProps> & {
export const Collapsible: typeof Root & {
Trigger: typeof Trigger
Content: typeof Content
} = Object.assign(Root, {
Expand Down
6 changes: 2 additions & 4 deletions packages/components/combobox/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import type { FC } from 'react'

import { Combobox as Root, type ComboboxProps } from './Combobox'
import { Combobox as Root } from './Combobox'
import { ClearButton } from './ComboboxClearButton'
import { ComboboxProvider, useComboboxContext } from './ComboboxContext'
import { Disclosure } from './ComboboxDisclosure'
Expand All @@ -20,7 +18,7 @@ import { Trigger } from './ComboboxTrigger'

export { useComboboxContext, ComboboxProvider }

export const Combobox: FC<ComboboxProps> & {
export const Combobox: typeof Root & {
Group: typeof Group
Item: typeof Item
Items: typeof Items
Expand Down
6 changes: 2 additions & 4 deletions packages/components/dialog/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import type { FC } from 'react'

import { Dialog as Root, type DialogProps } from './Dialog'
import { Dialog as Root } from './Dialog'
import { Body } from './DialogBody'
import { Close } from './DialogClose'
import { CloseButton } from './DialogCloseButton'
Expand All @@ -13,7 +11,7 @@ import { Portal } from './DialogPortal'
import { Title } from './DialogTitle' // aria-labelledby
import { Trigger } from './DialogTrigger'

export const Dialog: FC<DialogProps> & {
export const Dialog: typeof Root & {
Trigger: typeof Trigger
Portal: typeof Portal
Overlay: typeof Overlay
Expand Down
6 changes: 2 additions & 4 deletions packages/components/divider/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { FC } from 'react'

import { Divider as Root, type DividerProps } from './Divider'
import { Divider as Root } from './Divider'
import { DividerContent } from './DividerContent'

export { type DividerContentProps } from './DividerContent'

export const Divider: FC<DividerProps> & {
export const Divider: typeof Root & {
Content: typeof DividerContent
} = Object.assign(Root, {
Content: DividerContent,
Expand Down
6 changes: 2 additions & 4 deletions packages/components/drawer/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import type { FC } from 'react'

import { Drawer as Root, type DrawerProps } from './Drawer'
import { Drawer as Root } from './Drawer'
import { DrawerBody } from './DrawerBody'
import { DrawerCloseButton } from './DrawerCloseButton'
import { DrawerContent } from './DrawerContent'
Expand All @@ -12,7 +10,7 @@ import { DrawerPortal } from './DrawerPortal'
import { DrawerTitle } from './DrawerTitle'
import { DrawerTrigger } from './DrawerTrigger'

export const Drawer: FC<DrawerProps> & {
export const Drawer: typeof Root & {
Trigger: typeof DrawerTrigger
Portal: typeof DrawerPortal
Overlay: typeof DrawerOverlay
Expand Down
6 changes: 2 additions & 4 deletions packages/components/dropdown/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import type { FC } from 'react'

import { Dropdown as Root, type DropdownProps } from './Dropdown'
import { Dropdown as Root } from './Dropdown'
import { DropdownProvider, useDropdownContext } from './DropdownContext'
import { Divider } from './DropdownDivider'
import { Group } from './DropdownGroup'
Expand All @@ -17,7 +15,7 @@ import { Value } from './DropdownValue'

export { useDropdownContext, DropdownProvider }

export const Dropdown: FC<DropdownProps> & {
export const Dropdown: typeof Root & {
Group: typeof Group
Item: typeof Item
Items: typeof Items
Expand Down
6 changes: 2 additions & 4 deletions packages/components/form-field/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { FC } from 'react'

import { FormField as Root, FormFieldProps } from './FormField'
import { FormField as Root } from './FormField'
import { FormFieldAlertMessage } from './FormFieldAlertMessage'
import { FormFieldCharactersCount } from './FormFieldCharactersCount'
import { FormFieldControl } from './FormFieldControl'
Expand All @@ -11,7 +9,7 @@ import { FormFieldRequiredIndicator } from './FormFieldRequiredIndicator'
import { FormFieldStateMessage } from './FormFieldStateMessage'
import { FormFieldSuccessMessage } from './FormFieldSuccessMessage'

export const FormField: FC<FormFieldProps> & {
export const FormField: typeof Root & {
Label: typeof FormFieldLabel
Control: typeof FormFieldControl
StateMessage: typeof FormFieldStateMessage
Expand Down
6 changes: 2 additions & 4 deletions packages/components/input/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { FC } from 'react'

import { InputClearButton } from './InputClearButton'
import { InputGroup as Root, type InputGroupProps } from './InputGroup'
import { InputGroup as Root } from './InputGroup'
import { InputLeadingAddon } from './InputLeadingAddon'
import { InputLeadingIcon } from './InputLeadingIcon'
import { InputTrailingAddon } from './InputTrailingAddon'
import { InputTrailingIcon } from './InputTrailingIcon'

export * from './Input'

export const InputGroup: FC<InputGroupProps> & {
export const InputGroup: typeof Root & {
LeadingAddon: typeof InputLeadingAddon
TrailingAddon: typeof InputTrailingAddon
LeadingIcon: typeof InputLeadingIcon
Expand Down
6 changes: 2 additions & 4 deletions packages/components/link-box/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import type { FC } from 'react'

import { LinkBox as Root, LinkBoxProps } from './LinkBox'
import { LinkBox as Root } from './LinkBox'
import { LinkBoxLink } from './LinkBoxLink'
import { LinkBoxRaised } from './LinkBoxRaised'

export const LinkBox: FC<LinkBoxProps> & {
export const LinkBox: typeof Root & {
Link: typeof LinkBoxLink
Raised: typeof LinkBoxRaised
} = Object.assign(Root, { Link: LinkBoxLink, Raised: LinkBoxRaised })
Expand Down
6 changes: 2 additions & 4 deletions packages/components/popover/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import type { FC } from 'react'

import { Popover as Root, type PopoverProps } from './Popover'
import { Popover as Root } from './Popover'
import { Anchor } from './PopoverAnchor'
import { Arrow } from './PopoverArrow'
import { CloseButton } from './PopoverCloseButton'
Expand All @@ -9,7 +7,7 @@ import { Header } from './PopoverHeader'
import { Portal } from './PopoverPortal'
import { Trigger } from './PopoverTrigger'

export const Popover: FC<PopoverProps> & {
export const Popover: typeof Root & {
Anchor: typeof Anchor
Arrow: typeof Arrow
CloseButton: typeof CloseButton
Expand Down
4 changes: 1 addition & 3 deletions packages/components/progress-tracker/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { FC } from 'react'

import { ProgressTracker as Root, type ProgressTrackerProps } from './ProgressTracker'
import { ProgressTrackerStep as Step, type ProgressTrackerStepProps } from './ProgressTrackerStep'
import {
Expand All @@ -8,7 +6,7 @@ import {
} from './ProgressTrackerStepIndicator'
import { ProgressTrackerStepLabel as StepLabel } from './ProgressTrackerStepLabel'

export const ProgressTracker: FC<ProgressTrackerProps> & {
export const ProgressTracker: typeof Root & {
Step: typeof Step
StepLabel: typeof StepLabel
StepIndicator: typeof StepIndicator
Expand Down
6 changes: 2 additions & 4 deletions packages/components/progress/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { FC } from 'react'

import { Progress as Root, ProgressProps } from './Progress'
import { Progress as Root } from './Progress'
import { ProgressBar } from './ProgressBar'
import { ProgressIndicator } from './ProgressIndicator'
import { ProgressLabel } from './ProgressLabel'

export const Progress: FC<ProgressProps> & {
export const Progress: typeof Root & {
Label: typeof ProgressLabel
Bar: typeof ProgressBar
Indicator: typeof ProgressIndicator
Expand Down
6 changes: 2 additions & 4 deletions packages/components/radio-group/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import type { FC } from 'react'

import { Radio } from './Radio'
import { RadioGroup as Root, type RadioGroupProps } from './RadioGroup'
import { RadioGroup as Root } from './RadioGroup'

export const RadioGroup: FC<RadioGroupProps> & {
export const RadioGroup: typeof Root & {
Radio: typeof Radio
} = Object.assign(Root, {
Radio,
Expand Down
6 changes: 2 additions & 4 deletions packages/components/select/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import type { FC } from 'react'

import { Select as Root, type SelectProps } from './Select'
import { Select as Root } from './Select'
import { SelectProvider, useSelectContext } from './SelectContext'
import { Group } from './SelectGroup'
import { Item } from './SelectItem'
Expand All @@ -13,7 +11,7 @@ import { Value } from './SelectValue'

export { useSelectContext, SelectProvider }

export const Select: FC<SelectProps> & {
export const Select: typeof Root & {
Group: typeof Group
Item: typeof Item
Items: typeof Items
Expand Down
4 changes: 1 addition & 3 deletions packages/components/slider/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import type { FC } from 'react'

import { Slider as Root, type SliderProps } from './Slider'
import { SliderThumb as Thumb, type SliderThumbProps } from './SliderThumb'
import { SliderTrack as Track, type SliderTrackProps } from './SliderTrack'

export const Slider: FC<SliderProps> & {
export const Slider: typeof Root & {
Thumb: typeof Thumb
Track: typeof Track
} = Object.assign(Root, {
Expand Down
4 changes: 1 addition & 3 deletions packages/components/snackbar/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { FC } from 'react'

import {
addSnackbar,
type AddSnackbarArgs,
Expand All @@ -15,7 +13,7 @@ import {
import { SnackbarItemClose as ItemClose, type SnackbarItemCloseProps } from './SnackbarItemClose'
import { SnackbarItemIcon as ItemIcon, type SnackbarItemIconProps } from './SnackbarItemIcon'

export const Snackbar: FC<SnackbarProps> & {
export const Snackbar: typeof Root & {
Item: typeof Item
ItemAction: typeof ItemAction
ItemClose: typeof ItemClose
Expand Down
6 changes: 2 additions & 4 deletions packages/components/tabs/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import type { FC } from 'react'

import { Tabs as Root, type TabsProps } from './Tabs'
import { Tabs as Root } from './Tabs'
import { TabsContent as Content } from './TabsContent'
import { TabsList as List } from './TabsList'
import { TabsTrigger as Trigger } from './TabsTrigger'

export const Tabs: FC<TabsProps> & {
export const Tabs: typeof Root & {
List: typeof List
Trigger: typeof Trigger
Content: typeof Content
Expand Down
6 changes: 2 additions & 4 deletions packages/components/textarea/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { FC } from 'react'

import { TextareaGroup as Root, type TextareaGroupProps } from './TextareaGroup'
import { TextareaGroup as Root } from './TextareaGroup'
import { TextareaLeadingIcon } from './TextareaLeadingIcon'
import { TextareaTrailingIcon } from './TextareaTrailingIcon'

export * from './Textarea'

export const TextareaGroup: FC<TextareaGroupProps> & {
export const TextareaGroup: typeof Root & {
LeadingIcon: typeof TextareaLeadingIcon
TrailingIcon: typeof TextareaTrailingIcon
} = Object.assign(Root, {
Expand Down

0 comments on commit c315c0c

Please sign in to comment.