@fluentui/react-aria
Advanced tools
Comparing version 9.0.0-alpha.8 to 9.0.0-alpha.9
@@ -5,3 +5,24 @@ { | ||
{ | ||
"date": "Fri, 09 Jul 2021 07:30:50 GMT", | ||
"date": "Mon, 12 Jul 2021 07:32:40 GMT", | ||
"tag": "@fluentui/react-aria_v9.0.0-alpha.9", | ||
"version": "9.0.0-alpha.9", | ||
"comments": { | ||
"prerelease": [ | ||
{ | ||
"comment": "Update prop merging mechanism", | ||
"author": "bsunderhus@microsoft.com", | ||
"commit": "5d52e386874b7c44f7c1ba39091c7b5638eb9d65", | ||
"package": "@fluentui/react-aria" | ||
}, | ||
{ | ||
"comment": "Removes forcing children on useARIAButton", | ||
"author": "bsunderhus@microsoft.com", | ||
"commit": "b77307bb8ec2b07db583fda8367b73911598b4f6", | ||
"package": "@fluentui/react-aria" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Fri, 09 Jul 2021 07:39:31 GMT", | ||
"tag": "@fluentui/react-aria_v9.0.0-alpha.8", | ||
@@ -8,0 +29,0 @@ "version": "9.0.0-alpha.8", |
# Change Log - @fluentui/react-aria | ||
This log was last generated on Fri, 09 Jul 2021 07:30:50 GMT and should not be manually modified. | ||
This log was last generated on Mon, 12 Jul 2021 07:32:40 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## [9.0.0-alpha.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.0.0-alpha.9) | ||
Mon, 12 Jul 2021 07:32:40 GMT | ||
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.0.0-alpha.8..@fluentui/react-aria_v9.0.0-alpha.9) | ||
### Changes | ||
- Update prop merging mechanism ([PR #18813](https://github.com/microsoft/fluentui/pull/18813) by bsunderhus@microsoft.com) | ||
- Removes forcing children on useARIAButton ([PR #18879](https://github.com/microsoft/fluentui/pull/18879) by bsunderhus@microsoft.com) | ||
## [9.0.0-alpha.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.0.0-alpha.8) | ||
Fri, 09 Jul 2021 07:30:50 GMT | ||
Fri, 09 Jul 2021 07:39:31 GMT | ||
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.0.0-alpha.7..@fluentui/react-aria_v9.0.0-alpha.8) | ||
@@ -11,0 +21,0 @@ |
@@ -1,3 +0,4 @@ | ||
import { ObjectShorthandPropsCompat } from '@fluentui/react-utilities'; | ||
import { ObjectShorthandProps } from '@fluentui/react-utilities'; | ||
import * as React_2 from 'react'; | ||
import { ShorthandProps } from '@fluentui/react-utilities'; | ||
@@ -9,4 +10,4 @@ /** | ||
*/ | ||
export declare function useARIAButton(shorthand: ObjectShorthandPropsCompat<React_2.ButtonHTMLAttributes<HTMLElement>>): ObjectShorthandPropsCompat<React_2.ButtonHTMLAttributes<HTMLElement>>; | ||
export declare function useARIAButton<T extends React_2.ButtonHTMLAttributes<HTMLElement>>(value: ShorthandProps<T>, defaultProps?: T): ObjectShorthandProps<T>; | ||
export { } |
@@ -7,7 +7,8 @@ ## API Report File for "@fluentui/react-aria" | ||
import { ObjectShorthandPropsCompat } from '@fluentui/react-utilities'; | ||
import { ObjectShorthandProps } from '@fluentui/react-utilities'; | ||
import * as React_2 from 'react'; | ||
import { ShorthandProps } from '@fluentui/react-utilities'; | ||
// @public | ||
export function useARIAButton(shorthand: ObjectShorthandPropsCompat<React_2.ButtonHTMLAttributes<HTMLElement>>): ObjectShorthandPropsCompat<React_2.ButtonHTMLAttributes<HTMLElement>>; | ||
export function useARIAButton<T extends React_2.ButtonHTMLAttributes<HTMLElement>>(value: ShorthandProps<T>, defaultProps?: T): ObjectShorthandProps<T>; | ||
@@ -14,0 +15,0 @@ |
import * as React from 'react'; | ||
import { ObjectShorthandPropsCompat } from '@fluentui/react-utilities'; | ||
import { ObjectShorthandProps, ShorthandProps } from '@fluentui/react-utilities'; | ||
/** | ||
@@ -8,2 +8,2 @@ * button keyboard handling, role, disabled and tabIndex implementation that ensures ARIA spec | ||
*/ | ||
export declare function useARIAButton(shorthand: ObjectShorthandPropsCompat<React.ButtonHTMLAttributes<HTMLElement>>): ObjectShorthandPropsCompat<React.ButtonHTMLAttributes<HTMLElement>>; | ||
export declare function useARIAButton<T extends React.ButtonHTMLAttributes<HTMLElement>>(value: ShorthandProps<T>, defaultProps?: T): ObjectShorthandProps<T>; |
@@ -5,2 +5,8 @@ define(["require", "exports", "@fluentui/react-utilities", "@fluentui/keyboard-key"], function (require, exports, react_utilities_1, keyboard_key_1) { | ||
exports.useARIAButton = void 0; | ||
function mergeARIADisabled(disabled) { | ||
if (typeof disabled === 'string') { | ||
return disabled === 'false' ? false : true; | ||
} | ||
return disabled !== null && disabled !== void 0 ? disabled : false; | ||
} | ||
/** | ||
@@ -11,3 +17,4 @@ * button keyboard handling, role, disabled and tabIndex implementation that ensures ARIA spec | ||
*/ | ||
function useARIAButton(shorthand) { | ||
function useARIAButton(value, defaultProps) { | ||
var shorthand = react_utilities_1.resolveShorthand(value, defaultProps); | ||
var onClick = shorthand.onClick, onKeyDown = shorthand.onKeyDown, onKeyUp = shorthand.onKeyUp, defaultDisabled = shorthand.disabled, ariaDisabled = shorthand["aria-disabled"]; | ||
@@ -67,5 +74,2 @@ var disabled = mergeARIADisabled(defaultDisabled !== null && defaultDisabled !== void 0 ? defaultDisabled : ariaDisabled); | ||
}); | ||
if (!shorthand.hasOwnProperty('children')) { | ||
shorthand.children = null; | ||
} | ||
if (!shorthand.hasOwnProperty('as') || shorthand.as === 'button') { | ||
@@ -75,10 +79,2 @@ shorthand.as = 'button'; | ||
} | ||
/** | ||
* TODO: Ideally this is unnecessary after implementation of as-prop RFC. | ||
* The way to go is to have an assertion method to ensure types, | ||
* in the case of button we'd like to limit it for: button, div, span, a | ||
*/ | ||
if (typeof shorthand.as !== 'string') { | ||
return shorthand; | ||
} | ||
if (!shorthand.hasOwnProperty('role')) { | ||
@@ -102,9 +98,3 @@ shorthand.role = 'button'; | ||
exports.useARIAButton = useARIAButton; | ||
function mergeARIADisabled(disabled) { | ||
if (typeof disabled === 'string') { | ||
return disabled === 'false' ? false : true; | ||
} | ||
return disabled !== null && disabled !== void 0 ? disabled : false; | ||
} | ||
}); | ||
//# sourceMappingURL=useARIAButton.js.map |
@@ -7,3 +7,3 @@ define(["require", "exports", "tslib", "@fluentui/react-utilities", "react", "./useARIAButton"], function (require, exports, tslib_1, react_utilities_1, React, useARIAButton_1) { | ||
var props = useARIAButton_1.useARIAButton({ as: 'button', onClick: args.onClick }); | ||
var _a = react_utilities_1.getSlotsCompat(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
var _a = react_utilities_1.getSlots(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
return React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), "this is a button"); | ||
@@ -20,3 +20,3 @@ }; | ||
}); | ||
var _a = react_utilities_1.getSlotsCompat(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
var _a = react_utilities_1.getSlots(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
return (React.createElement(slots.root, tslib_1.__assign({ href: "/" }, slotProps.root), "this is an anchor")); | ||
@@ -27,3 +27,3 @@ }; | ||
var props = useARIAButton_1.useARIAButton({ as: 'span', onClick: args.onClick }); | ||
var _a = react_utilities_1.getSlotsCompat(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
var _a = react_utilities_1.getSlots(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
return React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), "this is a span"); | ||
@@ -34,3 +34,3 @@ }; | ||
var props = useARIAButton_1.useARIAButton({ as: 'div', onClick: args.onClick }); | ||
var _a = react_utilities_1.getSlotsCompat(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
var _a = react_utilities_1.getSlots(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
return React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), "this is a div"); | ||
@@ -37,0 +37,0 @@ }; |
import * as React from 'react'; | ||
import { ObjectShorthandPropsCompat } from '@fluentui/react-utilities'; | ||
import { ObjectShorthandProps, ShorthandProps } from '@fluentui/react-utilities'; | ||
/** | ||
@@ -8,2 +8,2 @@ * button keyboard handling, role, disabled and tabIndex implementation that ensures ARIA spec | ||
*/ | ||
export declare function useARIAButton(shorthand: ObjectShorthandPropsCompat<React.ButtonHTMLAttributes<HTMLElement>>): ObjectShorthandPropsCompat<React.ButtonHTMLAttributes<HTMLElement>>; | ||
export declare function useARIAButton<T extends React.ButtonHTMLAttributes<HTMLElement>>(value: ShorthandProps<T>, defaultProps?: T): ObjectShorthandProps<T>; |
@@ -6,2 +6,8 @@ "use strict"; | ||
var keyboard_key_1 = require("@fluentui/keyboard-key"); | ||
function mergeARIADisabled(disabled) { | ||
if (typeof disabled === 'string') { | ||
return disabled === 'false' ? false : true; | ||
} | ||
return disabled !== null && disabled !== void 0 ? disabled : false; | ||
} | ||
/** | ||
@@ -12,3 +18,4 @@ * button keyboard handling, role, disabled and tabIndex implementation that ensures ARIA spec | ||
*/ | ||
function useARIAButton(shorthand) { | ||
function useARIAButton(value, defaultProps) { | ||
var shorthand = react_utilities_1.resolveShorthand(value, defaultProps); | ||
var onClick = shorthand.onClick, onKeyDown = shorthand.onKeyDown, onKeyUp = shorthand.onKeyUp, defaultDisabled = shorthand.disabled, ariaDisabled = shorthand["aria-disabled"]; | ||
@@ -68,5 +75,2 @@ var disabled = mergeARIADisabled(defaultDisabled !== null && defaultDisabled !== void 0 ? defaultDisabled : ariaDisabled); | ||
}); | ||
if (!shorthand.hasOwnProperty('children')) { | ||
shorthand.children = null; | ||
} | ||
if (!shorthand.hasOwnProperty('as') || shorthand.as === 'button') { | ||
@@ -76,10 +80,2 @@ shorthand.as = 'button'; | ||
} | ||
/** | ||
* TODO: Ideally this is unnecessary after implementation of as-prop RFC. | ||
* The way to go is to have an assertion method to ensure types, | ||
* in the case of button we'd like to limit it for: button, div, span, a | ||
*/ | ||
if (typeof shorthand.as !== 'string') { | ||
return shorthand; | ||
} | ||
if (!shorthand.hasOwnProperty('role')) { | ||
@@ -103,8 +99,2 @@ shorthand.role = 'button'; | ||
exports.useARIAButton = useARIAButton; | ||
function mergeARIADisabled(disabled) { | ||
if (typeof disabled === 'string') { | ||
return disabled === 'false' ? false : true; | ||
} | ||
return disabled !== null && disabled !== void 0 ? disabled : false; | ||
} | ||
//# sourceMappingURL=useARIAButton.js.map |
@@ -10,3 +10,3 @@ "use strict"; | ||
var props = useARIAButton_1.useARIAButton({ as: 'button', onClick: args.onClick }); | ||
var _a = react_utilities_1.getSlotsCompat(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
var _a = react_utilities_1.getSlots(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
return React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), "this is a button"); | ||
@@ -23,3 +23,3 @@ }; | ||
}); | ||
var _a = react_utilities_1.getSlotsCompat(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
var _a = react_utilities_1.getSlots(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
return (React.createElement(slots.root, tslib_1.__assign({ href: "/" }, slotProps.root), "this is an anchor")); | ||
@@ -30,3 +30,3 @@ }; | ||
var props = useARIAButton_1.useARIAButton({ as: 'span', onClick: args.onClick }); | ||
var _a = react_utilities_1.getSlotsCompat(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
var _a = react_utilities_1.getSlots(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
return React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), "this is a span"); | ||
@@ -37,3 +37,3 @@ }; | ||
var props = useARIAButton_1.useARIAButton({ as: 'div', onClick: args.onClick }); | ||
var _a = react_utilities_1.getSlotsCompat(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
var _a = react_utilities_1.getSlots(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
return React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), "this is a div"); | ||
@@ -40,0 +40,0 @@ }; |
import * as React from 'react'; | ||
import { ObjectShorthandPropsCompat } from '@fluentui/react-utilities'; | ||
import { ObjectShorthandProps, ShorthandProps } from '@fluentui/react-utilities'; | ||
/** | ||
@@ -8,2 +8,2 @@ * button keyboard handling, role, disabled and tabIndex implementation that ensures ARIA spec | ||
*/ | ||
export declare function useARIAButton(shorthand: ObjectShorthandPropsCompat<React.ButtonHTMLAttributes<HTMLElement>>): ObjectShorthandPropsCompat<React.ButtonHTMLAttributes<HTMLElement>>; | ||
export declare function useARIAButton<T extends React.ButtonHTMLAttributes<HTMLElement>>(value: ShorthandProps<T>, defaultProps?: T): ObjectShorthandProps<T>; |
@@ -1,3 +0,9 @@ | ||
import { useEventCallback } from '@fluentui/react-utilities'; | ||
import { getCode, SpacebarKey, EnterKey } from '@fluentui/keyboard-key'; | ||
import { resolveShorthand, useEventCallback } from '@fluentui/react-utilities'; | ||
import { EnterKey, getCode, SpacebarKey } from '@fluentui/keyboard-key'; | ||
function mergeARIADisabled(disabled) { | ||
if (typeof disabled === 'string') { | ||
return disabled === 'false' ? false : true; | ||
} | ||
return disabled !== null && disabled !== void 0 ? disabled : false; | ||
} | ||
/** | ||
@@ -8,3 +14,4 @@ * button keyboard handling, role, disabled and tabIndex implementation that ensures ARIA spec | ||
*/ | ||
export function useARIAButton(shorthand) { | ||
export function useARIAButton(value, defaultProps) { | ||
var shorthand = resolveShorthand(value, defaultProps); | ||
var onClick = shorthand.onClick, onKeyDown = shorthand.onKeyDown, onKeyUp = shorthand.onKeyUp, defaultDisabled = shorthand.disabled, ariaDisabled = shorthand["aria-disabled"]; | ||
@@ -64,5 +71,2 @@ var disabled = mergeARIADisabled(defaultDisabled !== null && defaultDisabled !== void 0 ? defaultDisabled : ariaDisabled); | ||
}); | ||
if (!shorthand.hasOwnProperty('children')) { | ||
shorthand.children = null; | ||
} | ||
if (!shorthand.hasOwnProperty('as') || shorthand.as === 'button') { | ||
@@ -72,10 +76,2 @@ shorthand.as = 'button'; | ||
} | ||
/** | ||
* TODO: Ideally this is unnecessary after implementation of as-prop RFC. | ||
* The way to go is to have an assertion method to ensure types, | ||
* in the case of button we'd like to limit it for: button, div, span, a | ||
*/ | ||
if (typeof shorthand.as !== 'string') { | ||
return shorthand; | ||
} | ||
if (!shorthand.hasOwnProperty('role')) { | ||
@@ -98,8 +94,2 @@ shorthand.role = 'button'; | ||
} | ||
function mergeARIADisabled(disabled) { | ||
if (typeof disabled === 'string') { | ||
return disabled === 'false' ? false : true; | ||
} | ||
return disabled !== null && disabled !== void 0 ? disabled : false; | ||
} | ||
//# sourceMappingURL=useARIAButton.js.map |
import { __assign } from "tslib"; | ||
import { getSlotsCompat } from '@fluentui/react-utilities'; | ||
import { getSlots } from '@fluentui/react-utilities'; | ||
import * as React from 'react'; | ||
@@ -7,3 +7,3 @@ import { useARIAButton } from './useARIAButton'; | ||
var props = useARIAButton({ as: 'button', onClick: args.onClick }); | ||
var _a = getSlotsCompat(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
var _a = getSlots(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
return React.createElement(slots.root, __assign({}, slotProps.root), "this is a button"); | ||
@@ -19,3 +19,3 @@ }; | ||
}); | ||
var _a = getSlotsCompat(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
var _a = getSlots(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
return (React.createElement(slots.root, __assign({ href: "/" }, slotProps.root), "this is an anchor")); | ||
@@ -25,3 +25,3 @@ }; | ||
var props = useARIAButton({ as: 'span', onClick: args.onClick }); | ||
var _a = getSlotsCompat(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
var _a = getSlots(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
return React.createElement(slots.root, __assign({}, slotProps.root), "this is a span"); | ||
@@ -31,3 +31,3 @@ }; | ||
var props = useARIAButton({ as: 'div', onClick: args.onClick }); | ||
var _a = getSlotsCompat(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
var _a = getSlots(props, []), slots = _a.slots, slotProps = _a.slotProps; | ||
return React.createElement(slots.root, __assign({}, slotProps.root), "this is a div"); | ||
@@ -34,0 +34,0 @@ }; |
{ | ||
"name": "@fluentui/react-aria", | ||
"version": "9.0.0-alpha.8", | ||
"version": "9.0.0-alpha.9", | ||
"description": "React helper to ensure ARIA", | ||
@@ -5,0 +5,0 @@ "main": "lib-commonjs/index.js", |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
1152323
3902