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
805
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.1.0 to 3.2.0

src/useToggleButton.ts

27

dist/main.js

@@ -11,3 +11,4 @@ var {

filterDOMProps,
mergeProps
mergeProps,
chain
} = require("@react-aria/utils");

@@ -39,2 +40,3 @@

target,
rel,
type = 'button'

@@ -52,3 +54,4 @@ } = props;

disabled: elementType === 'input' ? isDisabled : undefined,
'aria-disabled': !isDisabled || elementType === 'input' ? undefined : isDisabled
'aria-disabled': !isDisabled || elementType === 'input' ? undefined : isDisabled,
rel: elementType === 'a' ? rel : undefined
};

@@ -97,2 +100,22 @@ }

exports.useButton = useButton;
function useToggleButton(props, state, ref) {
const {
isSelected
} = state;
const {
isPressed,
buttonProps
} = useButton(_babelRuntimeHelpersExtends({}, props, {
onPress: chain(state.toggle, props.onPress)
}), ref);
return {
isPressed,
buttonProps: mergeProps(buttonProps, {
'aria-pressed': isSelected
})
};
}
exports.useToggleButton = useToggleButton;
//# sourceMappingURL=main.js.map
import { usePress } from "@react-aria/interactions";
import { useFocusable } from "@react-aria/focus";
import { filterDOMProps, mergeProps } from "@react-aria/utils";
import { filterDOMProps, mergeProps, chain } from "@react-aria/utils";
import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends";

@@ -24,2 +24,3 @@

target,
rel,
type = 'button'

@@ -37,3 +38,4 @@ } = props;

disabled: elementType === 'input' ? isDisabled : undefined,
'aria-disabled': !isDisabled || elementType === 'input' ? undefined : isDisabled
'aria-disabled': !isDisabled || elementType === 'input' ? undefined : isDisabled,
rel: elementType === 'a' ? rel : undefined
};

@@ -80,2 +82,19 @@ }

}
export function useToggleButton(props, state, ref) {
const {
isSelected
} = state;
const {
isPressed,
buttonProps
} = useButton(_babelRuntimeHelpersEsmExtends({}, props, {
onPress: chain(state.toggle, props.onPress)
}), ref);
return {
isPressed,
buttonProps: mergeProps(buttonProps, {
'aria-pressed': isSelected
})
};
}
//# sourceMappingURL=module.js.map

6

dist/types.d.ts

@@ -1,4 +0,5 @@

import { AriaButtonProps } from "@react-types/button";
import { AriaButtonProps, AriaToggleButtonProps } from "@react-types/button";
import { ButtonHTMLAttributes, RefObject } from "react";
interface ButtonAria {
import { ToggleState } from "@react-stately/toggle";
export interface ButtonAria {
/** Props for the button element. */

@@ -16,3 +17,4 @@ buttonProps: ButtonHTMLAttributes<HTMLButtonElement>;

export function useButton(props: AriaButtonProps, ref: RefObject<HTMLElement>): ButtonAria;
export function useToggleButton(props: AriaToggleButtonProps, state: ToggleState, ref: RefObject<HTMLElement>): ButtonAria;
//# sourceMappingURL=types.d.ts.map
{
"name": "@react-aria/button",
"version": "3.1.0",
"version": "3.2.0",
"description": "Spectrum UI components in React",

@@ -21,7 +21,8 @@ "license": "Apache-2.0",

"@babel/runtime": "^7.6.2",
"@react-aria/focus": "^3.1.0",
"@react-aria/focus": "^3.2.0",
"@react-aria/i18n": "^3.1.0",
"@react-aria/interactions": "^3.1.0",
"@react-aria/utils": "^3.1.0",
"@react-types/button": "^3.1.0"
"@react-aria/interactions": "^3.2.0",
"@react-aria/utils": "^3.2.0",
"@react-stately/toggle": "^3.2.0",
"@react-types/button": "^3.2.0"
},

@@ -34,3 +35,3 @@ "peerDependencies": {

},
"gitHead": "211099972fe75ee581892efd01a7f89dfb9cdf69"
"gitHead": "661f0f2e3b8648a75aae83043267954700059fe0"
}

@@ -14,1 +14,2 @@ /*

export * from './useButton';
export * from './useToggleButton';

@@ -20,3 +20,4 @@ /*

interface ButtonAria {
export interface ButtonAria {
/** Props for the button element. */

@@ -46,2 +47,3 @@ buttonProps: ButtonHTMLAttributes<HTMLButtonElement>,

target,
rel,
type = 'button'

@@ -58,3 +60,4 @@ } = props;

disabled: elementType === 'input' ? isDisabled : undefined,
'aria-disabled': !isDisabled || elementType === 'input' ? undefined : isDisabled
'aria-disabled': !isDisabled || elementType === 'input' ? undefined : isDisabled,
rel: elementType === 'a' ? rel : undefined
};

@@ -61,0 +64,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

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