chore: reactelement to reactnode
This commit is contained in:
parent
30ede50d74
commit
ae7d588dd5
@ -31,7 +31,7 @@ type IPagination = IUsePagination & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
||||||
as?: React.ReactElement
|
as?: React.ReactNode
|
||||||
children?: string | React.ReactNode
|
children?: string | React.ReactNode
|
||||||
className?: string
|
className?: string
|
||||||
dataTestId?: string
|
dataTestId?: string
|
||||||
@ -39,9 +39,9 @@ type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|||||||
|
|
||||||
type PageButtonProps = ButtonProps & {
|
type PageButtonProps = ButtonProps & {
|
||||||
/**
|
/**
|
||||||
* Provide a custom ReactElement (e.g. Next/Link)
|
* Provide a custom ReactNode (e.g. Next/Link)
|
||||||
*/
|
*/
|
||||||
as?: React.ReactElement
|
as?: React.ReactNode
|
||||||
activeClassName?: string
|
activeClassName?: string
|
||||||
inactiveClassName?: string
|
inactiveClassName?: string
|
||||||
dataTestIdActive?: string
|
dataTestIdActive?: string
|
||||||
|
@ -9,7 +9,7 @@ export type HtmlContentProps = {
|
|||||||
|
|
||||||
type IPopover = {
|
type IPopover = {
|
||||||
className?: string
|
className?: string
|
||||||
htmlContent: React.ReactElement<HtmlContentProps>
|
htmlContent: React.ReactNode<HtmlContentProps>
|
||||||
popupClassName?: string
|
popupClassName?: string
|
||||||
trigger?: 'click' | 'hover'
|
trigger?: 'click' | 'hover'
|
||||||
position?: 'bottom' | 'br' | 'bl'
|
position?: 'bottom' | 'br' | 'bl'
|
||||||
@ -99,7 +99,7 @@ export default function CustomPopover({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{cloneElement(htmlContent as React.ReactElement<HtmlContentProps>, {
|
{cloneElement(htmlContent as React.ReactNode<HtmlContentProps>, {
|
||||||
onClose: () => onMouseLeave(open),
|
onClose: () => onMouseLeave(open),
|
||||||
...(manualClose
|
...(manualClose
|
||||||
? {
|
? {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import type { ReactElement } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
import RadioGroupContext from '../../context'
|
import RadioGroupContext from '../../context'
|
||||||
import s from '../../style.module.css'
|
import s from '../../style.module.css'
|
||||||
import cn from '@/utils/classnames'
|
import cn from '@/utils/classnames'
|
||||||
|
|
||||||
export type TRadioGroupProps = {
|
export type TRadioGroupProps = {
|
||||||
children?: ReactElement | ReactElement[]
|
children?: ReactNode | ReactNode[]
|
||||||
value?: string | number
|
value?: string | number
|
||||||
className?: string
|
className?: string
|
||||||
onChange?: (value: any) => void
|
onChange?: (value: any) => void
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import type { ReactElement } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
import { useId } from 'react'
|
import { useId } from 'react'
|
||||||
import { useContext } from 'use-context-selector'
|
import { useContext } from 'use-context-selector'
|
||||||
import RadioGroupContext from '../../context'
|
import RadioGroupContext from '../../context'
|
||||||
@ -8,7 +8,7 @@ import cn from '@/utils/classnames'
|
|||||||
export type IRadioProps = {
|
export type IRadioProps = {
|
||||||
className?: string
|
className?: string
|
||||||
labelClassName?: string
|
labelClassName?: string
|
||||||
children?: string | ReactElement
|
children?: string | ReactNode
|
||||||
checked?: boolean
|
checked?: boolean
|
||||||
value?: string | number
|
value?: string | number
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
|
@ -45,7 +45,7 @@ Object.defineProperty(globalThis, 'sessionStorage', {
|
|||||||
|
|
||||||
const BrowserInitor = ({
|
const BrowserInitor = ({
|
||||||
children,
|
children,
|
||||||
}: { children: React.ReactElement }) => {
|
}: { children: React.ReactNode }) => {
|
||||||
return children
|
return children
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ const languageNames = {
|
|||||||
} as { [key: string]: string }
|
} as { [key: string]: string }
|
||||||
|
|
||||||
type IChildrenProps = {
|
type IChildrenProps = {
|
||||||
children: React.ReactElement
|
children: React.ReactNode
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ function CodePanelHeader({ tag, label }: { tag: string; label: string }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ICodePanelProps = {
|
type ICodePanelProps = {
|
||||||
children: React.ReactElement
|
children: React.ReactNode
|
||||||
tag?: string
|
tag?: string
|
||||||
code?: string
|
code?: string
|
||||||
label?: string
|
label?: string
|
||||||
@ -182,7 +182,7 @@ function CodeGroupHeader({ title, children, selectedIndex }: IChildrenProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ICodeGroupPanelsProps = {
|
type ICodeGroupPanelsProps = {
|
||||||
children: React.ReactElement
|
children: React.ReactNode
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
function CodeGroupPanels({ children, targetCode, ...props }: ICodeGroupPanelsProps) {
|
function CodeGroupPanels({ children, targetCode, ...props }: ICodeGroupPanelsProps) {
|
||||||
|
@ -7,7 +7,7 @@ const isDevelopment = process.env.NODE_ENV === 'development'
|
|||||||
|
|
||||||
const SentryInit = ({
|
const SentryInit = ({
|
||||||
children,
|
children,
|
||||||
}: { children: React.ReactElement }) => {
|
}: { children: React.ReactNode }) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const SENTRY_DSN = document?.body?.getAttribute('data-public-sentry-dsn')
|
const SENTRY_DSN = document?.body?.getAttribute('data-public-sentry-dsn')
|
||||||
if (!isDevelopment && SENTRY_DSN) {
|
if (!isDevelopment && SENTRY_DSN) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import type {
|
import type {
|
||||||
FC,
|
FC,
|
||||||
ReactElement,
|
ReactNode,
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import {
|
import {
|
||||||
cloneElement,
|
cloneElement,
|
||||||
@ -46,7 +46,7 @@ import BlockIcon from '@/app/components/workflow/block-icon'
|
|||||||
import Tooltip from '@/app/components/base/tooltip'
|
import Tooltip from '@/app/components/base/tooltip'
|
||||||
|
|
||||||
type BaseNodeProps = {
|
type BaseNodeProps = {
|
||||||
children: ReactElement
|
children: ReactNode
|
||||||
} & NodeProps
|
} & NodeProps
|
||||||
|
|
||||||
const BaseNode: FC<BaseNodeProps> = ({
|
const BaseNode: FC<BaseNodeProps> = ({
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import type {
|
import type {
|
||||||
FC,
|
FC,
|
||||||
ReactElement,
|
ReactNode,
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import {
|
import {
|
||||||
cloneElement,
|
cloneElement,
|
||||||
@ -48,7 +48,7 @@ import { useStore as useAppStore } from '@/app/components/app/store'
|
|||||||
import { useStore } from '@/app/components/workflow/store'
|
import { useStore } from '@/app/components/workflow/store'
|
||||||
|
|
||||||
type BasePanelProps = {
|
type BasePanelProps = {
|
||||||
children: ReactElement
|
children: ReactNode
|
||||||
} & Node
|
} & Node
|
||||||
|
|
||||||
const BasePanel: FC<BasePanelProps> = ({
|
const BasePanel: FC<BasePanelProps> = ({
|
||||||
|
Loading…
Reference in New Issue
Block a user