-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix RSC error with createWithBsPrefix components (#6672)
* fix: fix RSC error with createWithBsPrefix components * update index
- Loading branch information
Showing
35 changed files
with
898 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import * as React from 'react'; | ||
import classNames from 'classnames'; | ||
import { useBootstrapPrefix } from './ThemeProvider'; | ||
import divWithClassName from './divWithClassName'; | ||
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers'; | ||
|
||
const DivStyledAsH4 = divWithClassName('h4'); | ||
DivStyledAsH4.displayName = 'DivStyledAsH4'; | ||
|
||
export interface AlertHeadingProps | ||
extends BsPrefixProps, | ||
React.HTMLAttributes<HTMLElement> {} | ||
|
||
const AlertHeading: BsPrefixRefForwardingComponent<'div', AlertHeadingProps> = | ||
React.forwardRef<HTMLElement, AlertHeadingProps>( | ||
({ className, bsPrefix, as: Component = DivStyledAsH4, ...props }, ref) => { | ||
bsPrefix = useBootstrapPrefix(bsPrefix, 'alert-heading'); | ||
return ( | ||
<Component | ||
ref={ref} | ||
className={classNames(className, bsPrefix)} | ||
{...props} | ||
/> | ||
); | ||
}, | ||
); | ||
|
||
AlertHeading.displayName = 'AlertHeading'; | ||
|
||
export default AlertHeading; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import * as React from 'react'; | ||
import classNames from 'classnames'; | ||
import Anchor from '@restart/ui/Anchor'; | ||
import { useBootstrapPrefix } from './ThemeProvider'; | ||
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers'; | ||
|
||
export interface AlertLinkProps | ||
extends BsPrefixProps, | ||
React.AnchorHTMLAttributes<HTMLElement> {} | ||
|
||
const AlertLink: BsPrefixRefForwardingComponent<'a', AlertLinkProps> = | ||
React.forwardRef<HTMLElement, AlertLinkProps>( | ||
({ className, bsPrefix, as: Component = Anchor, ...props }, ref) => { | ||
bsPrefix = useBootstrapPrefix(bsPrefix, 'alert-link'); | ||
return ( | ||
<Component | ||
ref={ref} | ||
className={classNames(className, bsPrefix)} | ||
{...props} | ||
/> | ||
); | ||
}, | ||
); | ||
|
||
AlertLink.displayName = 'AlertLink'; | ||
|
||
export default AlertLink; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as React from 'react'; | ||
import classNames from 'classnames'; | ||
import { useBootstrapPrefix } from './ThemeProvider'; | ||
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers'; | ||
|
||
export interface CardBodyProps | ||
extends BsPrefixProps, | ||
React.HTMLAttributes<HTMLElement> {} | ||
|
||
const CardBody: BsPrefixRefForwardingComponent<'div', CardBodyProps> = | ||
React.forwardRef<HTMLElement, CardBodyProps>( | ||
({ className, bsPrefix, as: Component = 'div', ...props }, ref) => { | ||
bsPrefix = useBootstrapPrefix(bsPrefix, 'card-body'); | ||
return ( | ||
<Component | ||
ref={ref} | ||
className={classNames(className, bsPrefix)} | ||
{...props} | ||
/> | ||
); | ||
}, | ||
); | ||
|
||
CardBody.displayName = 'CardBody'; | ||
|
||
export default CardBody; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as React from 'react'; | ||
import classNames from 'classnames'; | ||
import { useBootstrapPrefix } from './ThemeProvider'; | ||
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers'; | ||
|
||
export interface CardFooterProps | ||
extends BsPrefixProps, | ||
React.HTMLAttributes<HTMLElement> {} | ||
|
||
const CardFooter: BsPrefixRefForwardingComponent<'div', CardFooterProps> = | ||
React.forwardRef<HTMLElement, CardFooterProps>( | ||
({ className, bsPrefix, as: Component = 'div', ...props }, ref) => { | ||
bsPrefix = useBootstrapPrefix(bsPrefix, 'card-footer'); | ||
return ( | ||
<Component | ||
ref={ref} | ||
className={classNames(className, bsPrefix)} | ||
{...props} | ||
/> | ||
); | ||
}, | ||
); | ||
|
||
CardFooter.displayName = 'CardFooter'; | ||
|
||
export default CardFooter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,26 @@ | ||
import createWithBsPrefix from './createWithBsPrefix'; | ||
import * as React from 'react'; | ||
import classNames from 'classnames'; | ||
import { useBootstrapPrefix } from './ThemeProvider'; | ||
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers'; | ||
|
||
export default createWithBsPrefix('card-group'); | ||
export interface CardGroupProps | ||
extends BsPrefixProps, | ||
React.HTMLAttributes<HTMLElement> {} | ||
|
||
const CardGroup: BsPrefixRefForwardingComponent<'div', CardGroupProps> = | ||
React.forwardRef<HTMLElement, CardGroupProps>( | ||
({ className, bsPrefix, as: Component = 'div', ...props }, ref) => { | ||
bsPrefix = useBootstrapPrefix(bsPrefix, 'card-group'); | ||
return ( | ||
<Component | ||
ref={ref} | ||
className={classNames(className, bsPrefix)} | ||
{...props} | ||
/> | ||
); | ||
}, | ||
); | ||
|
||
CardGroup.displayName = 'CardGroup'; | ||
|
||
export default CardGroup; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import * as React from 'react'; | ||
import classNames from 'classnames'; | ||
import { useBootstrapPrefix } from './ThemeProvider'; | ||
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers'; | ||
|
||
export interface CardImgOverlayProps | ||
extends BsPrefixProps, | ||
React.HTMLAttributes<HTMLElement> {} | ||
|
||
const CardImgOverlay: BsPrefixRefForwardingComponent< | ||
'div', | ||
CardImgOverlayProps | ||
> = React.forwardRef<HTMLElement, CardImgOverlayProps>( | ||
({ className, bsPrefix, as: Component = 'div', ...props }, ref) => { | ||
bsPrefix = useBootstrapPrefix(bsPrefix, 'card-img-overlay'); | ||
return ( | ||
<Component | ||
ref={ref} | ||
className={classNames(className, bsPrefix)} | ||
{...props} | ||
/> | ||
); | ||
}, | ||
); | ||
|
||
CardImgOverlay.displayName = 'CardImgOverlay'; | ||
|
||
export default CardImgOverlay; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as React from 'react'; | ||
import classNames from 'classnames'; | ||
import { useBootstrapPrefix } from './ThemeProvider'; | ||
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers'; | ||
|
||
export interface CardLinkProps | ||
extends BsPrefixProps, | ||
React.AnchorHTMLAttributes<HTMLElement> {} | ||
|
||
const CardLink: BsPrefixRefForwardingComponent<'a', CardLinkProps> = | ||
React.forwardRef<HTMLElement, CardLinkProps>( | ||
({ className, bsPrefix, as: Component = 'a', ...props }, ref) => { | ||
bsPrefix = useBootstrapPrefix(bsPrefix, 'card-link'); | ||
return ( | ||
<Component | ||
ref={ref} | ||
className={classNames(className, bsPrefix)} | ||
{...props} | ||
/> | ||
); | ||
}, | ||
); | ||
|
||
CardLink.displayName = 'CardLink'; | ||
|
||
export default CardLink; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as React from 'react'; | ||
import classNames from 'classnames'; | ||
import { useBootstrapPrefix } from './ThemeProvider'; | ||
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers'; | ||
import divWithClassName from './divWithClassName'; | ||
|
||
const DivStyledAsH6 = divWithClassName('h6'); | ||
|
||
export interface CardSubtitleProps | ||
extends BsPrefixProps, | ||
React.HTMLAttributes<HTMLElement> {} | ||
|
||
const CardSubtitle: BsPrefixRefForwardingComponent<'div', CardSubtitleProps> = | ||
React.forwardRef<HTMLElement, CardSubtitleProps>( | ||
({ className, bsPrefix, as: Component = DivStyledAsH6, ...props }, ref) => { | ||
bsPrefix = useBootstrapPrefix(bsPrefix, 'card-subtitle'); | ||
return ( | ||
<Component | ||
ref={ref} | ||
className={classNames(className, bsPrefix)} | ||
{...props} | ||
/> | ||
); | ||
}, | ||
); | ||
|
||
CardSubtitle.displayName = 'CardSubtitle'; | ||
|
||
export default CardSubtitle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as React from 'react'; | ||
import classNames from 'classnames'; | ||
import { useBootstrapPrefix } from './ThemeProvider'; | ||
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers'; | ||
|
||
export interface CardTextProps | ||
extends BsPrefixProps, | ||
React.HTMLAttributes<HTMLElement> {} | ||
|
||
const CardText: BsPrefixRefForwardingComponent<'p', CardTextProps> = | ||
React.forwardRef<HTMLElement, CardTextProps>( | ||
({ className, bsPrefix, as: Component = 'p', ...props }, ref) => { | ||
bsPrefix = useBootstrapPrefix(bsPrefix, 'card-text'); | ||
return ( | ||
<Component | ||
ref={ref} | ||
className={classNames(className, bsPrefix)} | ||
{...props} | ||
/> | ||
); | ||
}, | ||
); | ||
|
||
CardText.displayName = 'CardText'; | ||
|
||
export default CardText; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as React from 'react'; | ||
import classNames from 'classnames'; | ||
import { useBootstrapPrefix } from './ThemeProvider'; | ||
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers'; | ||
import divWithClassName from './divWithClassName'; | ||
|
||
const DivStyledAsH5 = divWithClassName('h5'); | ||
|
||
export interface CardTitleProps | ||
extends BsPrefixProps, | ||
React.HTMLAttributes<HTMLElement> {} | ||
|
||
const CardTitle: BsPrefixRefForwardingComponent<'div', CardTitleProps> = | ||
React.forwardRef<HTMLElement, CardTitleProps>( | ||
({ className, bsPrefix, as: Component = DivStyledAsH5, ...props }, ref) => { | ||
bsPrefix = useBootstrapPrefix(bsPrefix, 'card-title'); | ||
return ( | ||
<Component | ||
ref={ref} | ||
className={classNames(className, bsPrefix)} | ||
{...props} | ||
/> | ||
); | ||
}, | ||
); | ||
|
||
CardTitle.displayName = 'CardTitle'; | ||
|
||
export default CardTitle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,28 @@ | ||
import createWithBsPrefix from './createWithBsPrefix'; | ||
import * as React from 'react'; | ||
import classNames from 'classnames'; | ||
import { useBootstrapPrefix } from './ThemeProvider'; | ||
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers'; | ||
|
||
export default createWithBsPrefix('carousel-caption'); | ||
export interface CarouselCaptionProps | ||
extends BsPrefixProps, | ||
React.HTMLAttributes<HTMLElement> {} | ||
|
||
const CarouselCaption: BsPrefixRefForwardingComponent< | ||
'div', | ||
CarouselCaptionProps | ||
> = React.forwardRef<HTMLElement, CarouselCaptionProps>( | ||
({ className, bsPrefix, as: Component = 'div', ...props }, ref) => { | ||
bsPrefix = useBootstrapPrefix(bsPrefix, 'carousel-caption'); | ||
return ( | ||
<Component | ||
ref={ref} | ||
className={classNames(className, bsPrefix)} | ||
{...props} | ||
/> | ||
); | ||
}, | ||
); | ||
|
||
CarouselCaption.displayName = 'CarouselCaption'; | ||
|
||
export default CarouselCaption; |
Oops, something went wrong.