@react-aria/disclosure
Advanced tools
Comparing version 3.0.0-nightly-a626c2596-240926 to 3.0.0-nightly-d57bd8d90-240927
@@ -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-a626c2596-240926", | ||
"version": "3.0.0-nightly-d57bd8d90-240927", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,11 +25,11 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-aria/button": "^3.0.0-nightly-a626c2596-240926", | ||
"@react-aria/selection": "^3.0.0-nightly-a626c2596-240926", | ||
"@react-aria/ssr": "^3.0.0-nightly-a626c2596-240926", | ||
"@react-aria/utils": "^3.0.0-nightly-a626c2596-240926", | ||
"@react-stately/disclosure": "3.0.0-nightly-a626c2596-240926", | ||
"@react-stately/toggle": "^3.0.0-nightly-a626c2596-240926", | ||
"@react-stately/tree": "^3.0.0-nightly-a626c2596-240926", | ||
"@react-types/button": "^3.0.0-nightly-a626c2596-240926", | ||
"@react-types/shared": "^3.0.0-nightly-a626c2596-240926", | ||
"@react-aria/button": "^3.0.0-nightly-d57bd8d90-240927", | ||
"@react-aria/selection": "^3.0.0-nightly-d57bd8d90-240927", | ||
"@react-aria/ssr": "^3.0.0-nightly-d57bd8d90-240927", | ||
"@react-aria/utils": "^3.0.0-nightly-d57bd8d90-240927", | ||
"@react-stately/disclosure": "3.0.0-nightly-d57bd8d90-240927", | ||
"@react-stately/toggle": "^3.0.0-nightly-d57bd8d90-240927", | ||
"@react-stately/tree": "^3.0.0-nightly-d57bd8d90-240927", | ||
"@react-types/button": "^3.0.0-nightly-d57bd8d90-240927", | ||
"@react-types/shared": "^3.0.0-nightly-d57bd8d90-240927", | ||
"@swc/helpers": "^0.5.0" | ||
@@ -36,0 +36,0 @@ }, |
@@ -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
31125
366
+ Added@react-stately/disclosure@3.0.0-nightly-d57bd8d90-240927(transitive)
- Removed@react-stately/disclosure@3.0.0-nightly-a626c2596-240926(transitive)
Updated@react-aria/selection@^3.0.0-nightly-d57bd8d90-240927
Updated@react-stately/disclosure@3.0.0-nightly-d57bd8d90-240927
Updated@react-stately/toggle@^3.0.0-nightly-d57bd8d90-240927