@fluentui/react-utilities
Advanced tools
Comparing version
@@ -27,3 +27,3 @@ import * as React_2 from 'react'; | ||
*/ | ||
declare type AsIntrinsicElement<As extends keyof JSX.IntrinsicElements> = { | ||
declare type AsIntrinsicElement<As extends JSXIntrinsicElementKeys> = { | ||
as?: As; | ||
@@ -289,3 +289,3 @@ }; | ||
/** The primary slot's element type (e.g. 'div') */ | ||
primarySlotTagName: keyof JSX.IntrinsicElements; | ||
primarySlotTagName: JSXIntrinsicElementKeys; | ||
/** The component's props object */ | ||
@@ -407,7 +407,7 @@ props: Props; | ||
/** | ||
* Helper type for {@link Slot}. Modifies `JSX.IntrinsicElements[Type]`: | ||
* Helper type for {@link Slot}. Modifies `JSXIntrinsicElements<Type>`: | ||
* * Removes legacy string ref. | ||
* * Disallows children for empty tags like 'img'. | ||
*/ | ||
declare type IntrinsicElementProps<Type extends keyof JSX.IntrinsicElements> = Type extends EmptyIntrinsicElements ? PropsWithoutChildren<React_2.PropsWithRef<JSX.IntrinsicElements[Type]>> : React_2.PropsWithRef<JSX.IntrinsicElements[Type]>; | ||
declare type IntrinsicElementProps<Type extends JSXIntrinsicElementKeys> = Type extends EmptyIntrinsicElements ? PropsWithoutChildren<React_2.PropsWithRef<JSXIntrinsicElement<Type>>> : React_2.PropsWithRef<JSXIntrinsicElement<Type>>; | ||
@@ -510,2 +510,53 @@ /** | ||
/** | ||
* Our own alias for `JSX.Element` type that is compatible with both React 17 and React 18+. | ||
* Use this type when annotating JSX markup in all our code in order to avoid issues between different React versions. | ||
* | ||
* Example usage: | ||
* | ||
* BAD: | ||
* ```tsx | ||
* const renderFoo = (state: FooState) = <div {...props}>Hello World</div>; | ||
* // infers | ||
* // R17: declare const renderFoo: (state: FooState) => JSX.Element; | ||
* // R18+: declare const renderFoo: (state: FooState) => React.JSX.Element; | ||
* ``` | ||
* | ||
* GOOD: | ||
* ```tsx | ||
* import type { JSXElement } from '@fluentui/react-utilities'; | ||
* const renderFoo = (state: FooState): JSXElement = <div {...props}>Hello World</div>; | ||
* ``` | ||
*/ | ||
export declare type JSXElement = React_2.ReactElement<any, any>; | ||
/** | ||
* Our own alias for `JSX.IntrinsicElements` type that is compatible with both React 17 and React 18+. | ||
* Use this type to get the intrinsic elements from React types in order to avoid issues between different React versions. | ||
*/ | ||
export declare type JSXIntrinsicElement<Element extends JSXIntrinsicElementKeys> = React_2.ComponentProps<Element>; | ||
/** | ||
* Union of all intrinsic element keys in React. | ||
* Based on the React version, it will either be the latest set of intrinsic elements or the legacy set. | ||
*/ | ||
export declare type JSXIntrinsicElementKeys = ReactVersionDependent<JSXIntrinsicElementKeysLatest, JSXIntrinsicElementKeysCompat>; | ||
/** | ||
* ============================================ | ||
* 💡 DO NOT EDIT THIS FILE. | ||
* - This file is automatically generated and should not be edited manually. | ||
* - To regenerate run `yarn nx run react-utilities:build`. | ||
* ============================================ | ||
*/ | ||
/** | ||
* Unwrapped type for 'keyof JSX.IntrinsicElement'. (Backwards compatible with older versions of '\@types/react') | ||
*/ | ||
declare type JSXIntrinsicElementKeysCompat = 'a' | 'abbr' | 'address' | 'animate' | 'animateMotion' | 'animateTransform' | 'area' | 'article' | 'aside' | 'audio' | 'b' | 'base' | 'bdi' | 'bdo' | 'big' | 'blockquote' | 'body' | 'br' | 'button' | 'canvas' | 'caption' | 'circle' | 'cite' | 'clipPath' | 'code' | 'col' | 'colgroup' | 'data' | 'datalist' | 'dd' | 'defs' | 'del' | 'desc' | 'details' | 'dfn' | 'dialog' | 'div' | 'dl' | 'dt' | 'ellipse' | 'em' | 'embed' | 'feBlend' | 'feColorMatrix' | 'feComponentTransfer' | 'feComposite' | 'feConvolveMatrix' | 'feDiffuseLighting' | 'feDisplacementMap' | 'feDistantLight' | 'feDropShadow' | 'feFlood' | 'feFuncA' | 'feFuncB' | 'feFuncG' | 'feFuncR' | 'feGaussianBlur' | 'feImage' | 'feMerge' | 'feMergeNode' | 'feMorphology' | 'feOffset' | 'fePointLight' | 'feSpecularLighting' | 'feSpotLight' | 'feTile' | 'feTurbulence' | 'fieldset' | 'figcaption' | 'figure' | 'filter' | 'footer' | 'foreignObject' | 'form' | 'g' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'head' | 'header' | 'hgroup' | 'hr' | 'html' | 'i' | 'iframe' | 'image' | 'img' | 'input' | 'ins' | 'kbd' | 'keygen' | 'label' | 'legend' | 'li' | 'line' | 'linearGradient' | 'link' | 'main' | 'map' | 'mark' | 'marker' | 'mask' | 'menu' | 'menuitem' | 'meta' | 'metadata' | 'meter' | 'nav' | 'noindex' | 'noscript' | 'object' | 'ol' | 'optgroup' | 'option' | 'output' | 'p' | 'param' | 'path' | 'pattern' | 'picture' | 'polygon' | 'polyline' | 'pre' | 'progress' | 'q' | 'radialGradient' | 'rect' | 'rp' | 'rt' | 'ruby' | 's' | 'samp' | 'script' | 'section' | 'select' | 'slot' | 'small' | 'source' | 'span' | 'stop' | 'strong' | 'style' | 'sub' | 'summary' | 'sup' | 'svg' | 'switch' | 'symbol' | 'table' | 'tbody' | 'td' | 'template' | 'text' | 'textPath' | 'textarea' | 'tfoot' | 'th' | 'thead' | 'time' | 'title' | 'tr' | 'track' | 'tspan' | 'u' | 'ul' | 'use' | 'var' | 'video' | 'view' | 'wbr' | 'webview'; | ||
/** | ||
* Unwrapped type for 'keyof JSX.IntrinsicElement' | ||
*/ | ||
declare type JSXIntrinsicElementKeysLatest = 'set' | 'mpath' | 'center' | 'search' | JSXIntrinsicElementKeysCompat; | ||
/** | ||
* @internal | ||
@@ -795,3 +846,3 @@ * Combine two event callbacks into a single callback function that calls each one in order. | ||
*/ | ||
export declare type Slot<Type extends keyof JSX.IntrinsicElements | ComponentType<any> | UnknownSlotProps, AlternateAs extends keyof JSX.IntrinsicElements = never> = IsSingleton<Extract<Type, string>> extends true ? WithSlotShorthandValue<Type extends keyof JSX.IntrinsicElements ? { | ||
export declare type Slot<Type extends JSXIntrinsicElementKeys | ComponentType<any> | UnknownSlotProps, AlternateAs extends JSXIntrinsicElementKeys = never> = IsSingleton<Extract<Type, string>> extends true ? WithSlotShorthandValue<Type extends JSXIntrinsicElementKeys ? { | ||
as?: Type; | ||
@@ -855,3 +906,3 @@ } & WithSlotRenderFunction<IntrinsicElementProps<Type>> : Type extends ComponentType<infer Props> ? Props extends UnknownSlotProps ? Props : WithSlotRenderFunction<Props> : Type> | (AlternateAs extends unknown ? { | ||
*/ | ||
[SLOT_ELEMENT_TYPE_SYMBOL]: ComponentType<Props> | (Props extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements); | ||
[SLOT_ELEMENT_TYPE_SYMBOL]: ComponentType<Props> | (Props extends AsIntrinsicElement<infer As> ? As : JSXIntrinsicElementKeys); | ||
/** | ||
@@ -865,3 +916,3 @@ * @internal | ||
export declare type SlotOptions<Props extends UnknownSlotProps> = { | ||
elementType: React_2.ComponentType<Props> | (Props extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements); | ||
elementType: React_2.ComponentType<Props> | (Props extends AsIntrinsicElement<infer As> ? As : JSXIntrinsicElementKeys); | ||
defaultProps?: Partial<Props>; | ||
@@ -926,3 +977,3 @@ }; | ||
export declare type UnknownSlotProps = Pick<React_2.HTMLAttributes<HTMLElement>, 'className' | 'style'> & { | ||
as?: keyof JSX.IntrinsicElements; | ||
as?: JSXIntrinsicElementKeys; | ||
children?: ReactNode; | ||
@@ -929,0 +980,0 @@ }; |
{ | ||
"name": "@fluentui/react-utilities", | ||
"version": "0.0.0-nightly-20250725-0405.1", | ||
"version": "0.0.0-nightly-20250728-0406.1", | ||
"description": "A set of general React-specific utilities.", | ||
@@ -20,4 +20,4 @@ "main": "lib-commonjs/index.js", | ||
"dependencies": { | ||
"@fluentui/keyboard-keys": "0.0.0-nightly-20250725-0405.1", | ||
"@fluentui/react-shared-contexts": "0.0.0-nightly-20250725-0405.1", | ||
"@fluentui/keyboard-keys": "0.0.0-nightly-20250728-0406.1", | ||
"@fluentui/react-shared-contexts": "0.0.0-nightly-20250728-0406.1", | ||
"@swc/helpers": "^0.5.1" | ||
@@ -24,0 +24,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
671080
2.01%249
1.63%5917
1.28%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
Updated
Updated