Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-aria/button

Package Overview
Dependencies
Maintainers
1
Versions
797
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-aria/button - npm Package Compare versions

Comparing version 3.0.0-rc.1 to 3.0.0-rc.2

LICENSE

36

dist/main.js

@@ -1,12 +0,12 @@

var _babelRuntimeHelpersEsmObjectSpread = $parcel$interopDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
var _babelRuntimeHelpersObjectSpread = $parcel$interopDefault(require("@babel/runtime/helpers/objectSpread2"));
var _temp = require("@react-aria/utils");
var mergeProps = require("@react-aria/utils").mergeProps;
var chain = _temp.chain;
var mergeProps = _temp.mergeProps;
var _temp = require("@react-aria/interactions");
var useDOMPropsResponder = _temp.useDOMPropsResponder;
var usePress = _temp.usePress;
var useFocusable = require("@react-aria/focus").useFocusable;
var usePress = require("@react-aria/interactions").usePress;
function $parcel$interopDefault(a) {

@@ -26,2 +26,3 @@ return a && a.__esModule ? a.default : a;

href = props.href,
target = props.target,
tabIndex = props.tabIndex,

@@ -40,4 +41,7 @@ isSelected = props.isSelected,

tabIndex: isDisabled ? undefined : tabIndex || 0,
'aria-disabled': isDisabled || undefined,
href: elementType === 'a' && isDisabled ? undefined : href
href: elementType === 'a' && isDisabled ? undefined : href,
target: elementType === 'a' ? target : undefined,
type: elementType === 'input' ? type : undefined,
disabled: elementType === 'input' ? isDisabled : undefined,
'aria-disabled': !isDisabled || elementType === 'input' ? undefined : isDisabled
};

@@ -47,9 +51,4 @@ }

var _usePress = usePress({
// Safari does not focus buttons automatically when interacting with them, so do it manually
onPressStart: chain(onPressStart, function (e) {
return e.target.focus();
}),
onPressEnd: chain(onPressEnd, function (e) {
return e.target.focus();
}),
onPressStart: onPressStart,
onPressEnd: onPressEnd,
onPressChange: onPressChange,

@@ -63,2 +62,5 @@ onPress: onPress,

var _useDOMPropsResponder = useDOMPropsResponder(ref),
contextProps = _useDOMPropsResponder.contextProps;
var _useFocusable = useFocusable(props, ref),

@@ -68,8 +70,10 @@ focusableProps = _useFocusable.focusableProps;

var handlers = mergeProps(pressProps, focusableProps);
var interactions = mergeProps(contextProps, handlers);
return {
isPressed: isPressed,
// Used to indicate press state for visual
buttonProps: mergeProps(handlers, _babelRuntimeHelpersEsmObjectSpread({
buttonProps: mergeProps(interactions, _babelRuntimeHelpersObjectSpread({
'aria-haspopup': ariaHasPopup,
'aria-expanded': ariaExpanded || ariaHasPopup && isSelected,
'aria-checked': isSelected,
'aria-invalid': validationState === 'invalid' ? true : null,

@@ -76,0 +80,0 @@ disabled: isDisabled,

import _babelRuntimeHelpersEsmObjectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import { chain, mergeProps } from "@react-aria/utils";
import { mergeProps } from "@react-aria/utils";
import { useDOMPropsResponder, usePress } from "@react-aria/interactions";
import { useFocusable } from "@react-aria/focus";
import { usePress } from "@react-aria/interactions";
export function useButton(props, ref) {

@@ -16,2 +16,3 @@ let {

href,
target,
tabIndex,

@@ -30,4 +31,7 @@ isSelected,

tabIndex: isDisabled ? undefined : tabIndex || 0,
'aria-disabled': isDisabled || undefined,
href: elementType === 'a' && isDisabled ? undefined : href
href: elementType === 'a' && isDisabled ? undefined : href,
target: elementType === 'a' ? target : undefined,
type: elementType === 'input' ? type : undefined,
disabled: elementType === 'input' ? isDisabled : undefined,
'aria-disabled': !isDisabled || elementType === 'input' ? undefined : isDisabled
};

@@ -40,5 +44,4 @@ }

} = usePress({
// Safari does not focus buttons automatically when interacting with them, so do it manually
onPressStart: chain(onPressStart, e => e.target.focus()),
onPressEnd: chain(onPressEnd, e => e.target.focus()),
onPressStart,
onPressEnd,
onPressChange,

@@ -50,11 +53,16 @@ onPress,

let {
contextProps
} = useDOMPropsResponder(ref);
let {
focusableProps
} = useFocusable(props, ref);
let handlers = mergeProps(pressProps, focusableProps);
let interactions = mergeProps(contextProps, handlers);
return {
isPressed,
// Used to indicate press state for visual
buttonProps: mergeProps(handlers, _babelRuntimeHelpersEsmObjectSpread({
buttonProps: mergeProps(interactions, _babelRuntimeHelpersEsmObjectSpread({
'aria-haspopup': ariaHasPopup,
'aria-expanded': ariaExpanded || ariaHasPopup && isSelected,
'aria-checked': isSelected,
'aria-invalid': validationState === 'invalid' ? true : null,

@@ -61,0 +69,0 @@ disabled: isDisabled,

{
"name": "@react-aria/button",
"version": "3.0.0-rc.1",
"version": "3.0.0-rc.2",
"description": "Spectrum UI components in React",

@@ -20,10 +20,10 @@ "license": "Apache-2.0",

"@babel/runtime": "^7.6.2",
"@react-aria/focus": "^3.0.0-rc.1",
"@react-aria/interactions": "^3.0.0-rc.1",
"@react-aria/utils": "^3.0.0-rc.1",
"@react-types/button": "^3.0.0-rc.1"
"@react-aria/focus": "^3.0.0-rc.2",
"@react-aria/i18n": "^3.0.0-rc.2",
"@react-aria/interactions": "^3.0.0-rc.2",
"@react-aria/utils": "^3.0.0-rc.2",
"@react-types/button": "^3.0.0-rc.2"
},
"peerDependencies": {
"react": "^16.8.0",
"react-dom": "^16.8.0"
"react": "^16.8.0"
},

@@ -33,3 +33,3 @@ "publishConfig": {

},
"gitHead": "5a9784f0bb6c25af7422215efb31ef72caeb9600"
"gitHead": "207e6ee9076905c96638a7f81a367758872e1410"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc