2
0
mirror of https://github.com/iconify/iconify.git synced 2024-12-13 14:13:06 +00:00

chore(react): import jsx from react for react 19 compatibility

This commit is contained in:
Vjacheslav Trushkin 2024-12-07 08:58:59 +02:00
parent 60baa1907c
commit 533263df50
4 changed files with 176 additions and 1565 deletions

View File

@ -1,10 +1,5 @@
import { import { useEffect, useState, forwardRef, createElement } from 'react';
useEffect, import type { Ref, JSX } from 'react';
useState,
forwardRef,
createElement,
type Ref,
} from 'react';
import type { IconifyJSON, IconifyIcon } from '@iconify/types'; import type { IconifyJSON, IconifyIcon } from '@iconify/types';
// Core // Core

View File

@ -1,4 +1,5 @@
import { forwardRef, createElement, memo, type Ref } from 'react'; import { forwardRef, createElement, memo } from 'react';
import type { Ref, JSX } from 'react';
import type { IconifyIcon, IconifyJSON } from '@iconify/types'; import type { IconifyIcon, IconifyJSON } from '@iconify/types';
import type { IconifyIconSize } from '@iconify/utils/lib/customisations/defaults'; import type { IconifyIconSize } from '@iconify/utils/lib/customisations/defaults';
import { defaultIconProps } from '@iconify/utils/lib/icon/defaults'; import { defaultIconProps } from '@iconify/utils/lib/icon/defaults';
@ -63,25 +64,29 @@ type IconComponentType = (props: IconProps) => JSX.Element;
* *
* @param props - Component properties * @param props - Component properties
*/ */
export const Icon = memo(forwardRef<IconElement, IconProps>((props, ref) => export const Icon = memo(
IconComponent({ forwardRef<IconElement, IconProps>((props, ref) =>
...props, IconComponent({
_ref: ref, ...props,
}) _ref: ref,
)) as IconComponentType; })
)
) as IconComponentType;
/** /**
* Inline icon (has negative verticalAlign that makes it behave like icon font) * Inline icon (has negative verticalAlign that makes it behave like icon font)
* *
* @param props - Component properties * @param props - Component properties
*/ */
export const InlineIcon = memo(forwardRef<IconElement, IconProps>((props, ref) => export const InlineIcon = memo(
IconComponent({ forwardRef<IconElement, IconProps>((props, ref) =>
inline: true, IconComponent({
...props, inline: true,
_ref: ref, ...props,
}) _ref: ref,
)) as IconComponentType; })
)
) as IconComponentType;
/** /**
* Add icon to storage, allowing to call it by name * Add icon to storage, allowing to call it by name

View File

@ -1,5 +1,5 @@
import { createElement } from 'react'; import { createElement } from 'react';
import type { SVGProps, CSSProperties } from 'react'; import type { SVGProps, CSSProperties, JSX } from 'react';
import type { IconifyIcon } from '@iconify/types'; import type { IconifyIcon } from '@iconify/types';
import { mergeCustomisations } from '@iconify/utils/lib/customisations/merge'; import { mergeCustomisations } from '@iconify/utils/lib/customisations/merge';
import { flipFromString } from '@iconify/utils/lib/customisations/flip'; import { flipFromString } from '@iconify/utils/lib/customisations/flip';

File diff suppressed because it is too large Load Diff