@react-stately/radio
Advanced tools
Comparing version 3.0.0-rc.1 to 3.0.0-rc.2
@@ -1,5 +0,7 @@ | ||
var _babelRuntimeHelpersEsmSlicedToArray = $parcel$interopDefault(require("@babel/runtime/helpers/esm/slicedToArray")); | ||
var _babelRuntimeHelpersSlicedToArray = $parcel$interopDefault(require("@babel/runtime/helpers/slicedToArray")); | ||
var useControlledState = require("@react-stately/utils").useControlledState; | ||
var useState = require("react").useState; | ||
function $parcel$interopDefault(a) { | ||
@@ -11,6 +13,11 @@ return a && a.__esModule ? a.default : a; | ||
var _useControlledState = useControlledState(props.value, props.defaultValue, props.onChange), | ||
_useControlledState2 = _babelRuntimeHelpersEsmSlicedToArray(_useControlledState, 2), | ||
_useControlledState2 = _babelRuntimeHelpersSlicedToArray(_useControlledState, 2), | ||
selectedRadio = _useControlledState2[0], | ||
setSelected = _useControlledState2[1]; | ||
var _useState = useState(null), | ||
_useState2 = _babelRuntimeHelpersSlicedToArray(_useState, 2), | ||
focusableRadio = _useState2[0], | ||
setFocusableRadio = _useState2[1]; | ||
var setSelectedRadio = function setSelectedRadio(value) { | ||
@@ -24,3 +31,5 @@ if (!props.isReadOnly) { | ||
selectedRadio: selectedRadio, | ||
setSelectedRadio: setSelectedRadio | ||
setSelectedRadio: setSelectedRadio, | ||
focusableRadio: focusableRadio, | ||
setFocusableRadio: setFocusableRadio | ||
}; | ||
@@ -27,0 +36,0 @@ } |
import { useControlledState } from "@react-stately/utils"; | ||
import { useState } from "react"; | ||
export function useRadioGroupState(props) { | ||
let [selectedRadio, setSelected] = useControlledState(props.value, props.defaultValue, props.onChange); | ||
let [focusableRadio, setFocusableRadio] = useState(null); | ||
@@ -13,4 +15,6 @@ let setSelectedRadio = value => { | ||
selectedRadio, | ||
setSelectedRadio | ||
setSelectedRadio, | ||
focusableRadio, | ||
setFocusableRadio | ||
}; | ||
} |
@@ -5,2 +5,4 @@ import { RadioGroupProps } from "@react-types/radio"; | ||
setSelectedRadio: (value: string) => void; | ||
focusableRadio: string | undefined; | ||
setFocusableRadio: (value: string) => void; | ||
} | ||
@@ -7,0 +9,0 @@ export function useRadioGroupState(props: RadioGroupProps): RadioGroupState; |
{ | ||
"name": "@react-stately/radio", | ||
"version": "3.0.0-rc.1", | ||
"version": "3.0.0-rc.2", | ||
"description": "Spectrum UI components in React", | ||
@@ -20,4 +20,4 @@ "license": "Apache-2.0", | ||
"@babel/runtime": "^7.6.2", | ||
"@react-stately/utils": "^3.0.0-rc.1", | ||
"@react-types/radio": "^3.0.0-rc.1" | ||
"@react-stately/utils": "^3.0.0-rc.2", | ||
"@react-types/radio": "^3.0.0-rc.2" | ||
}, | ||
@@ -33,3 +33,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "5a9784f0bb6c25af7422215efb31ef72caeb9600" | ||
"gitHead": "207e6ee9076905c96638a7f81a367758872e1410" | ||
} |
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
14727
7
52