2
0
mirror of https://github.com/iconify/iconify.git synced 2024-12-12 13:47:49 +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 {
useEffect,
useState,
forwardRef,
createElement,
type Ref,
} from 'react';
import { useEffect, useState, forwardRef, createElement } from 'react';
import type { Ref, JSX } from 'react';
import type { IconifyJSON, IconifyIcon } from '@iconify/types';
// 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 { IconifyIconSize } from '@iconify/utils/lib/customisations/defaults';
import { defaultIconProps } from '@iconify/utils/lib/icon/defaults';
@ -63,25 +64,29 @@ type IconComponentType = (props: IconProps) => JSX.Element;
*
* @param props - Component properties
*/
export const Icon = memo(forwardRef<IconElement, IconProps>((props, ref) =>
export const Icon = memo(
forwardRef<IconElement, IconProps>((props, ref) =>
IconComponent({
...props,
_ref: ref,
})
)) as IconComponentType;
)
) as IconComponentType;
/**
* Inline icon (has negative verticalAlign that makes it behave like icon font)
*
* @param props - Component properties
*/
export const InlineIcon = memo(forwardRef<IconElement, IconProps>((props, ref) =>
export const InlineIcon = memo(
forwardRef<IconElement, IconProps>((props, ref) =>
IconComponent({
inline: true,
...props,
_ref: ref,
})
)) as IconComponentType;
)
) as IconComponentType;
/**
* Add icon to storage, allowing to call it by name

View File

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

File diff suppressed because it is too large Load Diff