@udecode/react-utils
Advanced tools
Comparing version 37.0.0 to 38.0.1
import React from 'react'; | ||
declare const Box: React.ForwardRefExoticComponent<{ | ||
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined; | ||
asChild?: boolean | undefined; | ||
as?: React.ElementType; | ||
asChild?: boolean; | ||
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<any>>; | ||
@@ -16,4 +16,4 @@ type BoxProps = React.ComponentPropsWithRef<typeof Box>; | ||
declare const Text: React.ForwardRefExoticComponent<{ | ||
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined; | ||
asChild?: boolean | undefined; | ||
as?: React.ElementType; | ||
asChild?: boolean; | ||
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<any>>; | ||
@@ -23,3 +23,3 @@ type TextProps = React.ComponentPropsWithRef<typeof Text>; | ||
/** @see https://github.com/radix-ui/primitives/blob/b324ec2d7ddf13a2a115cb5b11478e24d2f45b87/packages/core/primitive/src/primitive.tsx#L1 */ | ||
declare const composeEventHandlers: <E>(originalEventHandler?: ((event: E) => void) | undefined, ourEventHandler?: ((event: E) => void) | undefined, { checkForDefaultPrevented }?: { | ||
declare const composeEventHandlers: <E>(originalEventHandler?: (event: E) => void, ourEventHandler?: (event: E) => void, { checkForDefaultPrevented }?: { | ||
checkForDefaultPrevented?: boolean | undefined; | ||
@@ -53,13 +53,13 @@ }) => (event: E) => void; | ||
*/ | ||
declare const createPrimitiveComponent: <T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>, P extends React.PropsWithoutRef<React.ComponentProps<T>>>(element: T) => <SH extends (options: any) => any, PH extends (state: any) => any>({ propsHook, stateHook, }?: { | ||
propsHook?: PH | undefined; | ||
stateHook?: SH | undefined; | ||
declare const createPrimitiveComponent: <T extends React.ElementType, P extends React.ComponentPropsWithoutRef<T>>(element: T) => <SH extends (options: any) => any, PH extends (state: any) => any>({ propsHook, stateHook, }?: { | ||
propsHook?: PH; | ||
stateHook?: SH; | ||
}) => React.ForwardRefExoticComponent<React.PropsWithoutRef<{ | ||
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined; | ||
asChild?: boolean | undefined; | ||
className?: string | undefined; | ||
options?: Parameters<SH>[0] | undefined; | ||
setProps?: ((hookProps: NonNullable<ReturnType<PH>['props']>) => P) | undefined; | ||
state?: Parameters<PH>[0] | undefined; | ||
style?: React.CSSProperties | undefined; | ||
as?: React.ElementType; | ||
asChild?: boolean; | ||
className?: string; | ||
options?: Parameters<SH>[0]; | ||
setProps?: (hookProps: NonNullable<ReturnType<PH>["props"]>) => P; | ||
state?: Parameters<PH>[0]; | ||
style?: React.CSSProperties; | ||
} & P> & React.RefAttributes<any>>; | ||
@@ -69,5 +69,5 @@ | ||
declare const createSlotComponent: <T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>, P extends React.PropsWithoutRef<React.ComponentProps<T>>>(element: T) => React.ForwardRefExoticComponent<React.PropsWithoutRef<{ | ||
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined; | ||
asChild?: boolean | undefined; | ||
declare const createSlotComponent: <T extends React.ElementType, P extends React.ComponentPropsWithoutRef<T>>(element: T) => React.ForwardRefExoticComponent<React.PropsWithoutRef<{ | ||
as?: React.ElementType; | ||
asChild?: boolean; | ||
} & P> & React.RefAttributes<any>>; | ||
@@ -103,3 +103,3 @@ | ||
excludeScrollbar?: boolean; | ||
ignoreClass?: string | string[]; | ||
ignoreClass?: string[] | string; | ||
refs?: Refs; | ||
@@ -118,2 +118,7 @@ } | ||
type ElementType<P = any> = { | ||
[K in keyof JSX.IntrinsicElements]: P extends JSX.IntrinsicElements[K] ? K : never; | ||
}[keyof JSX.IntrinsicElements] | React.ComponentType<P>; | ||
type ForwardRefComponent<T, P = {}> = React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>; | ||
type InferElementRef<T> = T extends ElementType<any> ? T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] extends React.DetailedHTMLProps<React.HTMLAttributes<infer R>, any> ? R : never : T extends React.ComponentType<any> ? T extends React.ComponentClass<any> ? InstanceType<T> : T extends React.ForwardRefExoticComponent<any> ? React.ComponentPropsWithRef<T>['ref'] extends React.Ref<infer R> ? R : never : never : never : never; | ||
/** | ||
@@ -125,4 +130,4 @@ * Shorter alternative to `React.forwardRef`. | ||
*/ | ||
declare function withRef<T extends React.ComponentType<any> | keyof HTMLElementTagNameMap, E = {}>(renderFunction: React.ForwardRefRenderFunction<React.ElementRef<T>, E & Omit<React.ComponentPropsWithoutRef<T>, keyof E>>): React.ForwardRefExoticComponent<React.PropsWithoutRef<E & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, keyof E>> & React.RefAttributes<React.ElementRef<T>>>; | ||
declare function withRef<T extends ElementType, P = {}>(renderFunction: React.ForwardRefRenderFunction<InferElementRef<T>, React.ComponentPropsWithoutRef<T> & P>): ForwardRefComponent<InferElementRef<T>, React.ComponentPropsWithoutRef<T> & P>; | ||
export { Box, type BoxProps, CAN_USE_DOM, DEFAULT_IGNORE_CLASS, PortalBody, type PortalBodyProps, Text, type TextProps, type UseOnClickOutsideCallback, type UseOnClickOutsideOptions, type UseOnClickOutsideReturn, composeEventHandlers, composeRefs, createPrimitiveComponent, createPrimitiveElement, createSlotComponent, useComposedRef, useIsomorphicLayoutEffect, useOnClickOutside, useStableMemo, withProviders, withRef }; |
@@ -104,4 +104,3 @@ "use strict"; | ||
const container = element || typeof window !== "undefined" ? document.body : void 0; | ||
if (!container) | ||
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, children); | ||
if (!container) return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, children); | ||
return import_react_dom.default.createPortal(children, element || document.body); | ||
@@ -172,9 +171,8 @@ }; | ||
const style = (hookProps == null ? void 0 : hookProps.style) || props.style ? __spreadValues(__spreadValues({}, hookProps == null ? void 0 : hookProps.style), props.style) : void 0; | ||
if (!asChild && hidden) | ||
return null; | ||
if (!asChild && hidden) return null; | ||
return /* @__PURE__ */ import_react4.default.createElement( | ||
Comp, | ||
__spreadValues(__spreadValues(__spreadProps(__spreadValues({ | ||
asChild, | ||
ref: _ref | ||
ref: _ref, | ||
asChild | ||
}, hookProps), { | ||
@@ -232,4 +230,3 @@ className, | ||
if (Array.isArray(ignoreClass)) { | ||
if (ignoreClass.some((c) => checkClass(el, c))) | ||
return true; | ||
if (ignoreClass.some((c) => checkClass(el, c))) return true; | ||
} else if (checkClass(el, ignoreClass)) { | ||
@@ -261,4 +258,3 @@ return true; | ||
() => { | ||
if (!(refsOpt == null ? void 0 : refsOpt.length) && refsState.length === 0) | ||
return; | ||
if (!(refsOpt == null ? void 0 : refsOpt.length) && refsState.length === 0) return; | ||
const getEls = () => { | ||
@@ -291,4 +287,3 @@ const els = []; | ||
); | ||
if (detectIFrame) | ||
window.removeEventListener("blur", blurHandler); | ||
if (detectIFrame) window.removeEventListener("blur", blurHandler); | ||
}; | ||
@@ -302,4 +297,3 @@ if (disabled) { | ||
); | ||
if (detectIFrame) | ||
window.addEventListener("blur", blurHandler); | ||
if (detectIFrame) window.addEventListener("blur", blurHandler); | ||
return () => removeEventListener(); | ||
@@ -306,0 +300,0 @@ }, |
{ | ||
"name": "@udecode/react-utils", | ||
"version": "37.0.0", | ||
"version": "38.0.1", | ||
"description": "Udecode React utils", | ||
@@ -41,5 +41,5 @@ "license": "MIT", | ||
"dependencies": { | ||
"@radix-ui/react-slot": "^1.0.2", | ||
"@radix-ui/react-slot": "^1.1.0", | ||
"@udecode/utils": "37.0.0", | ||
"clsx": "^1.2.1" | ||
"clsx": "^2.1.1" | ||
}, | ||
@@ -46,0 +46,0 @@ "peerDependencies": { |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78645
748
+ Addedclsx@2.1.1(transitive)
- Removedclsx@1.2.1(transitive)
Updated@radix-ui/react-slot@^1.1.0
Updatedclsx@^2.1.1