@udecode/react-utils
Advanced tools
Comparing version 38.0.1 to 39.0.0
@@ -21,2 +21,6 @@ import React from 'react'; | ||
declare const MemoizedChildren: React.MemoExoticComponent<({ children }: { | ||
children: React.ReactNode; | ||
}) => React.JSX.Element>; | ||
/** @see https://github.com/radix-ui/primitives/blob/b324ec2d7ddf13a2a115cb5b11478e24d2f45b87/packages/core/primitive/src/primitive.tsx#L1 */ | ||
@@ -127,2 +131,2 @@ declare const composeEventHandlers: <E>(originalEventHandler?: (event: E) => void, ourEventHandler?: (event: E) => void, { checkForDefaultPrevented }?: { | ||
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 }; | ||
export { Box, type BoxProps, CAN_USE_DOM, DEFAULT_IGNORE_CLASS, MemoizedChildren, PortalBody, type PortalBodyProps, Text, type TextProps, type UseOnClickOutsideCallback, type UseOnClickOutsideOptions, type UseOnClickOutsideReturn, composeEventHandlers, composeRefs, createPrimitiveComponent, createPrimitiveElement, createSlotComponent, useComposedRef, useIsomorphicLayoutEffect, useOnClickOutside, useStableMemo, withProviders, withRef }; |
@@ -65,2 +65,3 @@ "use strict"; | ||
DEFAULT_IGNORE_CLASS: () => DEFAULT_IGNORE_CLASS, | ||
MemoizedChildren: () => MemoizedChildren, | ||
PortalBody: () => PortalBody, | ||
@@ -112,2 +113,10 @@ Text: () => Text, | ||
// src/MemoizedChildren.tsx | ||
var import_react3 = __toESM(require("react")); | ||
var MemoizedChildren = import_react3.default.memo( | ||
({ children }) => { | ||
return /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, children); | ||
} | ||
); | ||
// src/composeEventHandlers.ts | ||
@@ -122,3 +131,3 @@ var composeEventHandlers = (originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) => (event) => { | ||
// src/createPrimitiveComponent.tsx | ||
var import_react4 = __toESM(require("react")); | ||
var import_react5 = __toESM(require("react")); | ||
var import_utils = require("@udecode/utils"); | ||
@@ -128,3 +137,3 @@ var import_clsx = require("clsx"); | ||
// src/useComposedRef.ts | ||
var import_react3 = __toESM(require("react")); | ||
var import_react4 = __toESM(require("react")); | ||
var setRef = (ref, value) => { | ||
@@ -139,3 +148,3 @@ if (typeof ref === "function") { | ||
var useComposedRef = (...refs) => { | ||
return import_react3.default.useCallback(composeRefs(...refs), refs); | ||
return import_react4.default.useCallback(composeRefs(...refs), refs); | ||
}; | ||
@@ -150,3 +159,3 @@ | ||
} = {}) => { | ||
return import_react4.default.forwardRef( | ||
return import_react5.default.forwardRef( | ||
(_a2, ref) => { | ||
@@ -177,3 +186,3 @@ var _b = _a2, { | ||
if (!asChild && hidden) return null; | ||
return /* @__PURE__ */ import_react4.default.createElement( | ||
return /* @__PURE__ */ import_react5.default.createElement( | ||
Comp, | ||
@@ -194,7 +203,7 @@ __spreadValues(__spreadValues(__spreadProps(__spreadValues({ | ||
// src/createPrimitiveElement.tsx | ||
var import_react5 = __toESM(require("react")); | ||
var import_react6 = __toESM(require("react")); | ||
function createPrimitiveElement(tag) { | ||
return import_react5.default.forwardRef( | ||
return import_react6.default.forwardRef( | ||
function CreateComponent(props, ref) { | ||
return import_react5.default.createElement(tag, __spreadProps(__spreadValues({}, props), { ref })); | ||
return import_react6.default.createElement(tag, __spreadProps(__spreadValues({}, props), { ref })); | ||
} | ||
@@ -205,9 +214,9 @@ ); | ||
// src/useIsomorphicLayoutEffect.ts | ||
var import_react6 = __toESM(require("react")); | ||
var import_react7 = __toESM(require("react")); | ||
var _a; | ||
var CAN_USE_DOM = typeof window !== "undefined" && ((_a = window.document) == null ? void 0 : _a.createElement) !== void 0; | ||
var useIsomorphicLayoutEffect = CAN_USE_DOM ? import_react6.default.useLayoutEffect : import_react6.default.useEffect; | ||
var useIsomorphicLayoutEffect = CAN_USE_DOM ? import_react7.default.useLayoutEffect : import_react7.default.useEffect; | ||
// src/useOnClickOutside.ts | ||
var import_react7 = __toESM(require("react")); | ||
var import_react8 = __toESM(require("react")); | ||
var canUsePassiveEvents = () => { | ||
@@ -255,10 +264,10 @@ if (typeof window === "undefined" || typeof window.addEventListener !== "function") | ||
} = {}) => { | ||
const [refsState, setRefsState] = import_react7.default.useState([]); | ||
const callbackRef = import_react7.default.useRef(callback); | ||
const [refsState, setRefsState] = import_react8.default.useState([]); | ||
const callbackRef = import_react8.default.useRef(callback); | ||
callbackRef.current = callback; | ||
const ref = import_react7.default.useCallback( | ||
const ref = import_react8.default.useCallback( | ||
(el) => setRefsState((prevState) => [...prevState, { current: el }]), | ||
[] | ||
); | ||
import_react7.default.useEffect( | ||
import_react8.default.useEffect( | ||
() => { | ||
@@ -320,6 +329,6 @@ if (!(refsOpt == null ? void 0 : refsOpt.length) && refsState.length === 0) return; | ||
// src/useStableMemo.ts | ||
var import_react8 = __toESM(require("react")); | ||
var import_react9 = __toESM(require("react")); | ||
var useStableMemo = (producer, deps) => { | ||
const [value, setValue] = import_react8.default.useState(producer); | ||
import_react8.default.useLayoutEffect(() => { | ||
const [value, setValue] = import_react9.default.useState(producer); | ||
import_react9.default.useLayoutEffect(() => { | ||
setValue(producer); | ||
@@ -331,3 +340,3 @@ }, deps); | ||
// src/withProviders.tsx | ||
var import_react9 = __toESM(require("react")); | ||
var import_react10 = __toESM(require("react")); | ||
var withProviders = (...providers) => (WrappedComponent) => (props) => providers.reduceRight( | ||
@@ -338,13 +347,13 @@ (acc, prov) => { | ||
[Provider] = prov; | ||
return /* @__PURE__ */ import_react9.default.createElement(Provider, __spreadValues({}, prov[1]), acc); | ||
return /* @__PURE__ */ import_react10.default.createElement(Provider, __spreadValues({}, prov[1]), acc); | ||
} | ||
return /* @__PURE__ */ import_react9.default.createElement(Provider, null, acc); | ||
return /* @__PURE__ */ import_react10.default.createElement(Provider, null, acc); | ||
}, | ||
/* @__PURE__ */ import_react9.default.createElement(WrappedComponent, __spreadValues({}, props)) | ||
/* @__PURE__ */ import_react10.default.createElement(WrappedComponent, __spreadValues({}, props)) | ||
); | ||
// src/withRef.tsx | ||
var import_react10 = __toESM(require("react")); | ||
var import_react11 = __toESM(require("react")); | ||
function withRef(renderFunction) { | ||
return import_react10.default.forwardRef(renderFunction); | ||
return import_react11.default.forwardRef(renderFunction); | ||
} | ||
@@ -356,2 +365,3 @@ // Annotate the CommonJS export names for ESM import in node: | ||
DEFAULT_IGNORE_CLASS, | ||
MemoizedChildren, | ||
PortalBody, | ||
@@ -358,0 +368,0 @@ Text, |
{ | ||
"name": "@udecode/react-utils", | ||
"version": "38.0.1", | ||
"version": "39.0.0", | ||
"description": "Udecode React utils", | ||
"license": "MIT", | ||
"keywords": [ | ||
"utils" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/udecode/plate/issues" | ||
}, | ||
"repository": { | ||
@@ -11,12 +16,4 @@ "type": "git", | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/udecode/plate/issues" | ||
}, | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist/**/*" | ||
], | ||
"exports": { | ||
@@ -30,6 +27,12 @@ ".": { | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist/**/*" | ||
], | ||
"scripts": { | ||
"brl": "yarn p:brl", | ||
"build": "yarn p:build", | ||
"build:watch": "yarn p:build:watch", | ||
"brl": "yarn p:brl", | ||
"clean": "yarn p:clean", | ||
@@ -51,5 +54,2 @@ "lint": "yarn p:lint", | ||
}, | ||
"keywords": [ | ||
"utils" | ||
], | ||
"publishConfig": { | ||
@@ -56,0 +56,0 @@ "access": "public" |
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
80260
768
1