@react-aria/disclosure
Advanced tools
Comparing version 3.0.0-nightly-5ae234603-240925 to 3.0.0-nightly-69109f003-241018
@@ -32,10 +32,8 @@ var $l3cx6$react = require("react"); | ||
// @ts-ignore https://github.com/facebook/react/pull/24741 | ||
(0, $l3cx6$reactariautils.useEvent)(ref, 'beforematch', supportsBeforeMatch ? ()=>state.expand() : null); | ||
(0, $l3cx6$reactariautils.useEvent)(ref, 'beforematch', supportsBeforeMatch && !isControlled ? ()=>state.expand() : null); | ||
(0, $l3cx6$react.useEffect)(()=>{ | ||
// Until React supports hidden="until-found": https://github.com/facebook/react/pull/24741 | ||
if (supportsBeforeMatch && (ref === null || ref === void 0 ? void 0 : ref.current) && !isControlled && !isDisabled) { | ||
if (state.isExpanded) // @ts-ignore | ||
ref.current.hidden = undefined; | ||
else // @ts-ignore | ||
ref.current.hidden = 'until-found'; | ||
if (state.isExpanded) ref.current.removeAttribute('hidden'); | ||
else ref.current.setAttribute('hidden', 'until-found'); | ||
} | ||
@@ -56,3 +54,3 @@ }, [ | ||
onPress: (e)=>{ | ||
if (e.pointerType !== 'keyboard') state.toggle(); | ||
if (!isDisabled && e.pointerType !== 'keyboard') state.toggle(); | ||
}, | ||
@@ -59,0 +57,0 @@ isDisabled: isDisabled, |
@@ -26,10 +26,8 @@ import {useEffect as $6wN6e$useEffect} from "react"; | ||
// @ts-ignore https://github.com/facebook/react/pull/24741 | ||
(0, $6wN6e$useEvent)(ref, 'beforematch', supportsBeforeMatch ? ()=>state.expand() : null); | ||
(0, $6wN6e$useEvent)(ref, 'beforematch', supportsBeforeMatch && !isControlled ? ()=>state.expand() : null); | ||
(0, $6wN6e$useEffect)(()=>{ | ||
// Until React supports hidden="until-found": https://github.com/facebook/react/pull/24741 | ||
if (supportsBeforeMatch && (ref === null || ref === void 0 ? void 0 : ref.current) && !isControlled && !isDisabled) { | ||
if (state.isExpanded) // @ts-ignore | ||
ref.current.hidden = undefined; | ||
else // @ts-ignore | ||
ref.current.hidden = 'until-found'; | ||
if (state.isExpanded) ref.current.removeAttribute('hidden'); | ||
else ref.current.setAttribute('hidden', 'until-found'); | ||
} | ||
@@ -50,3 +48,3 @@ }, [ | ||
onPress: (e)=>{ | ||
if (e.pointerType !== 'keyboard') state.toggle(); | ||
if (!isDisabled && e.pointerType !== 'keyboard') state.toggle(); | ||
}, | ||
@@ -53,0 +51,0 @@ isDisabled: isDisabled, |
{ | ||
"name": "@react-aria/disclosure", | ||
"version": "3.0.0-nightly-5ae234603-240925", | ||
"version": "3.0.0-nightly-69109f003-241018", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,11 +25,11 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-aria/button": "^3.0.0-nightly-5ae234603-240925", | ||
"@react-aria/selection": "^3.0.0-nightly-5ae234603-240925", | ||
"@react-aria/ssr": "^3.0.0-nightly-5ae234603-240925", | ||
"@react-aria/utils": "^3.0.0-nightly-5ae234603-240925", | ||
"@react-stately/disclosure": "3.0.0-nightly-5ae234603-240925", | ||
"@react-stately/toggle": "^3.0.0-nightly-5ae234603-240925", | ||
"@react-stately/tree": "^3.0.0-nightly-5ae234603-240925", | ||
"@react-types/button": "^3.0.0-nightly-5ae234603-240925", | ||
"@react-types/shared": "^3.0.0-nightly-5ae234603-240925", | ||
"@react-aria/button": "^3.0.0-nightly-69109f003-241018", | ||
"@react-aria/selection": "^3.0.0-nightly-69109f003-241018", | ||
"@react-aria/ssr": "^3.0.0-nightly-69109f003-241018", | ||
"@react-aria/utils": "^3.0.0-nightly-69109f003-241018", | ||
"@react-stately/disclosure": "3.0.0-nightly-69109f003-241018", | ||
"@react-stately/toggle": "^3.0.0-nightly-69109f003-241018", | ||
"@react-stately/tree": "^3.0.0-nightly-69109f003-241018", | ||
"@react-types/button": "^3.0.0-nightly-69109f003-241018", | ||
"@react-types/shared": "^3.0.0-nightly-69109f003-241018", | ||
"@swc/helpers": "^0.5.0" | ||
@@ -44,3 +44,3 @@ }, | ||
}, | ||
"stableVersion": "3.0.0-alpha.0" | ||
"stableVersion": "3.0.0-alpha.1" | ||
} |
@@ -54,3 +54,3 @@ /* | ||
// @ts-ignore https://github.com/facebook/react/pull/24741 | ||
useEvent(ref, 'beforematch', supportsBeforeMatch ? () => state.expand() : null); | ||
useEvent(ref, 'beforematch', supportsBeforeMatch && !isControlled ? () => state.expand() : null); | ||
@@ -61,7 +61,5 @@ useEffect(() => { | ||
if (state.isExpanded) { | ||
// @ts-ignore | ||
ref.current.hidden = undefined; | ||
ref.current.removeAttribute('hidden'); | ||
} else { | ||
// @ts-ignore | ||
ref.current.hidden = 'until-found'; | ||
ref.current.setAttribute('hidden', 'until-found'); | ||
} | ||
@@ -77,3 +75,3 @@ } | ||
onPress: (e) => { | ||
if (e.pointerType !== 'keyboard') { | ||
if (!isDisabled && e.pointerType !== 'keyboard') { | ||
state.toggle(); | ||
@@ -80,0 +78,0 @@ } |
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
31125
366
+ Added@react-stately/disclosure@3.0.0-nightly-69109f003-241018(transitive)
- Removed@react-stately/disclosure@3.0.0-nightly-5ae234603-240925(transitive)
Updated@react-aria/selection@^3.0.0-nightly-69109f003-241018
Updated@react-stately/disclosure@3.0.0-nightly-69109f003-241018
Updated@react-stately/toggle@^3.0.0-nightly-69109f003-241018