Skip to content

Commit

Permalink
🧱 Export subcomponents individually for ssr support (#3725)
Browse files Browse the repository at this point in the history
* 🧱 Export subcomponents for ssr support

* Test release

* switch back version
  • Loading branch information
oddvernes authored Feb 18, 2025
1 parent 75c88a9 commit 22f0744
Show file tree
Hide file tree
Showing 15 changed files with 83 additions and 45 deletions.
9 changes: 8 additions & 1 deletion packages/eds-core-react/src/components/Accordion/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ Accordion.HeaderTitle.displayName = 'Accordion.HeaderTitle'
Accordion.HeaderActions.displayName = 'Accordion.HeaderActions'
Accordion.Panel.displayName = 'Accordion.Panel'

export { Accordion }
export {
Accordion,
AccordionItem,
AccordionHeader,
AccordionHeaderTitle,
AccordionHeaderActions,
AccordionPanel,
}
export type {
AccordionProps,
AccordionPanelProps,
Expand Down
2 changes: 1 addition & 1 deletion packages/eds-core-react/src/components/Banner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Banner.Icon.displayName = 'Banner.Icon'
Banner.Message.displayName = 'Banner.Message'
Banner.Actions.displayName = 'Banner.Actions'

export { Banner }
export { Banner, BannerIcon, BannerMessage, BannerActions }
export type {
BannerProps,
BannerMessageProps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ Breadcrumbs.Breadcrumb = Breadcrumb

Breadcrumbs.Breadcrumb.displayName = 'Breadcrumbs.Breadcrumb'

export { Breadcrumbs }
export { Breadcrumbs, Breadcrumb }
export type { BreadcrumbsProps, BreadcrumbProps }
2 changes: 1 addition & 1 deletion packages/eds-core-react/src/components/Button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ Button.Toggle = ToggleButton
Button.Group.displayName = 'Button.Group'
Button.Toggle.displayName = 'Button.Toggle'

export { Button }
export { Button, ButtonGroup, ToggleButton }
export type { ButtonProps, ButtonGroupProps, ToggleButtonProps }
9 changes: 8 additions & 1 deletion packages/eds-core-react/src/components/Card/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ Card.Header.displayName = 'Card.Header'
Card.Media.displayName = 'Card.Media'
Card.HeaderTitle.displayName = 'Card.HeaderTitle'

export { Card }
export {
Card,
CardActions,
CardContent,
CardHeader,
CardMedia,
CardHeaderTitle,
}
export type {
CardProps,
CardActionsProps,
Expand Down
2 changes: 1 addition & 1 deletion packages/eds-core-react/src/components/Dialog/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Dialog.Title.displayName = 'Dialog.Title'
Dialog.Content.displayName = 'Dialog.Content'
Dialog.Header.displayName = 'Dialog.Header'

export { Dialog }
export { Dialog, DialogActions, DialogTitle, DialogContent, DialogHeader }
export type {
DialogProps,
DialogActionsProps,
Expand Down
2 changes: 1 addition & 1 deletion packages/eds-core-react/src/components/List/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ List.Item = ListItem

List.Item.displayName = 'List.Item'

export { List }
export { List, ListItem }
export type { ListProps, ListItemProps }
2 changes: 1 addition & 1 deletion packages/eds-core-react/src/components/Menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ Menu.Section = MenuSection
Menu.Item.displayName = 'Menu.Item'
Menu.Section.displayName = 'Menu.Section'

export { Menu }
export { Menu, MenuItem, MenuSection }
export type { MenuProps, MenuItemProps, MenuSectionProps }
2 changes: 1 addition & 1 deletion packages/eds-core-react/src/components/Popover/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Popover.Content.displayName = 'Popover.Content'
Popover.Header.displayName = 'Popover.Header'
Popover.Actions.displayName = 'Popover.Actions'

export { Popover }
export { Popover, PopoverTitle, PopoverContent, PopoverHeader, PopoverActions }
export type {
PopoverProps,
PopoverContentProps,
Expand Down
12 changes: 11 additions & 1 deletion packages/eds-core-react/src/components/SideBar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,15 @@ SideBar.Button.displayName = 'SideBar.Button'
SideBar.Accordion.displayName = 'SideBar.Accordion'
SideBar.AccordionItem.displayName = 'SideBar.AccordionItem'

export { SideBar, useSideBar }
export {
SideBar,
useSideBar,
SidebarLink,
SideBarContent,
SideBarFooter,
SideBarToggle,
SideBarButton,
SideBarAccordion,
SideBarAccordionItem,
}
export type { SidebarType, SidebarLinkProps }
2 changes: 1 addition & 1 deletion packages/eds-core-react/src/components/Snackbar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ type SnackbarTypes = typeof BaseComponent & {
const Snackbar = BaseComponent as SnackbarTypes
Snackbar.Action = SnackbarAction

export { Snackbar }
export { Snackbar, SnackbarAction }
export type { SnackbarProps, SnackbarActionProps }
46 changes: 27 additions & 19 deletions packages/eds-core-react/src/components/Table/index.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { Table as BaseTable, TableProps } from './Table'
import { Body, BodyProps } from './Body'
import { Cell, CellProps } from './Cell'
import { Head, HeadProps } from './Head'
import { Foot, FootProps } from './Foot'
import { Row, RowProps } from './Row'
import { Caption, CaptionProps } from './Caption'
import { Body as TableBody, BodyProps } from './Body'
import { Cell as TableCell, CellProps } from './Cell'
import { Head as TableHead, HeadProps } from './Head'
import { Foot as TableFoot, FootProps } from './Foot'
import { Row as tableRow, RowProps } from './Row'
import { Caption as TableCaption, CaptionProps } from './Caption'

type TableCompoundProps = typeof BaseTable & {
Body: typeof Body
Cell: typeof Cell
Head: typeof Head
Foot: typeof Foot
Row: typeof Row
Caption: typeof Caption
Body: typeof TableBody
Cell: typeof TableCell
Head: typeof TableHead
Foot: typeof TableFoot
Row: typeof tableRow
Caption: typeof TableCaption
}

const Table = BaseTable as TableCompoundProps

Table.Body = Body
Table.Cell = Cell
Table.Head = Head
Table.Foot = Foot
Table.Row = Row
Table.Caption = Caption
Table.Body = TableBody
Table.Cell = TableCell
Table.Head = TableHead
Table.Foot = TableFoot
Table.Row = tableRow
Table.Caption = TableCaption

Table.Body.displayName = 'Table.Body'
Table.Cell.displayName = 'Table.Cell'
Expand All @@ -31,7 +31,15 @@ Table.Foot.displayName = 'Table.Foot'
Table.Row.displayName = 'Table.Row'
Table.Caption.displayName = 'Table.Caption'

export { Table }
export {
Table,
TableBody,
TableCell,
TableHead,
TableFoot,
tableRow,
TableCaption,
}
export type {
TableProps,
CellProps,
Expand Down
11 changes: 7 additions & 4 deletions packages/eds-core-react/src/components/TableOfContents/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@ import {
TableOfContents as BaseComponent,
TableOfContentsProps,
} from './TableOfContents'
import { LinkItem, TableOfContentsLinkItemProps } from './LinkItem'
import {
LinkItem as TableOfContentsLinkItem,
TableOfContentsLinkItemProps,
} from './LinkItem'

type TableOfContentsCompoundProps = typeof BaseComponent & {
LinkItem: typeof LinkItem
LinkItem: typeof TableOfContentsLinkItem
}

const TableOfContents = BaseComponent as TableOfContentsCompoundProps

TableOfContents.LinkItem = LinkItem
TableOfContents.LinkItem = TableOfContentsLinkItem

TableOfContents.LinkItem.displayName = 'TableOfContents.LinkItem'

export { TableOfContents }
export { TableOfContents, TableOfContentsLinkItem }
export type { TableOfContentsProps, TableOfContentsLinkItemProps }
2 changes: 1 addition & 1 deletion packages/eds-core-react/src/components/Tabs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ Tabs.Panels.displayName = 'Tabs.Panels'
Tabs.Panel.displayName = 'Tabs.Panel'
Tabs.List.displayName = 'Tabs.List'

export { Tabs }
export { Tabs, Tab, TabPanels, TabPanel, TabList }
export type { TabsProps, TabProps, TabListProps, TabPanelProps, TabPanelsProps }
23 changes: 13 additions & 10 deletions packages/eds-core-react/src/components/TopBar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
import { TopBar as BaseComponent, TopbarProps } from './TopBar'
import { Actions, TopbarActionsProps } from './Actions'
import { Header, TopbarHeaderProps } from './Header'
import { CustomContent, TopbarCustomContentProps } from './CustomContent'
import { Actions as TopbarActions, TopbarActionsProps } from './Actions'
import { Header as TopbarHeader, TopbarHeaderProps } from './Header'
import {
CustomContent as TopbarCustomContent,
TopbarCustomContentProps,
} from './CustomContent'

type TopbarCompoundProps = typeof BaseComponent & {
Actions: typeof Actions
Header: typeof Header
CustomContent: typeof CustomContent
Actions: typeof TopbarActions
Header: typeof TopbarHeader
CustomContent: typeof TopbarCustomContent
}

const TopBar = BaseComponent as TopbarCompoundProps

TopBar.Actions = Actions
TopBar.Header = Header
TopBar.CustomContent = CustomContent
TopBar.Actions = TopbarActions
TopBar.Header = TopbarHeader
TopBar.CustomContent = TopbarCustomContent

TopBar.Actions.displayName = 'Topbar.Actions'
TopBar.Header.displayName = 'Topbar.Header'
TopBar.CustomContent.displayName = 'Topbar.CustomContent'

export { TopBar }
export { TopBar, TopbarActions, TopbarHeader, TopbarCustomContent }
export type {
TopbarProps,
TopbarActionsProps,
Expand Down

0 comments on commit 22f0744

Please sign in to comment.