@fluentui/react-utilities
Advanced tools
Comparing version 0.0.0-nightly131c59c96120211203.1 to 0.0.0-nightly39ce3cbcf120211206.1
@@ -5,5 +5,5 @@ { | ||
{ | ||
"date": "Fri, 03 Dec 2021 04:13:24 GMT", | ||
"tag": "@fluentui/react-utilities_v0.0.0-nightly131c59c96120211203.1", | ||
"version": "0.0.0-nightly131c59c96120211203.1", | ||
"date": "Mon, 06 Dec 2021 04:16:56 GMT", | ||
"tag": "@fluentui/react-utilities_v0.0.0-nightly39ce3cbcf120211206.1", | ||
"version": "0.0.0-nightly39ce3cbcf120211206.1", | ||
"comments": { | ||
@@ -14,10 +14,16 @@ "prerelease": [ | ||
"package": "@fluentui/react-utilities", | ||
"commit": "6fe1f0a081835b662f3c880d6405724d3abc4c0b", | ||
"commit": "f5d813357240886d3e3a5215ab8304bf1034298f", | ||
"comment": "Release nightly v9" | ||
}, | ||
{ | ||
"author": "elcraig@microsoft.com", | ||
"package": "@fluentui/react-utilities", | ||
"commit": "39ce3cbcf15ce2619649e1eddccf932736ceac07", | ||
"comment": "[breaking] Remove useControllableValue hook (use useControllableState instead)" | ||
}, | ||
{ | ||
"author": "beachball", | ||
"package": "@fluentui/react-utilities", | ||
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly131c59c96120211203.1", | ||
"commit": "6fe1f0a081835b662f3c880d6405724d3abc4c0b" | ||
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly39ce3cbcf120211206.1", | ||
"commit": "f5d813357240886d3e3a5215ab8304bf1034298f" | ||
} | ||
@@ -24,0 +30,0 @@ ] |
# Change Log - @fluentui/react-utilities | ||
This log was last generated on Fri, 03 Dec 2021 04:13:24 GMT and should not be manually modified. | ||
This log was last generated on Mon, 06 Dec 2021 04:16:56 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## [0.0.0-nightly131c59c96120211203.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v0.0.0-nightly131c59c96120211203.1) | ||
## [0.0.0-nightly39ce3cbcf120211206.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v0.0.0-nightly39ce3cbcf120211206.1) | ||
Fri, 03 Dec 2021 04:13:24 GMT | ||
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-beta.4..@fluentui/react-utilities_v0.0.0-nightly131c59c96120211203.1) | ||
Mon, 06 Dec 2021 04:16:56 GMT | ||
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-beta.4..@fluentui/react-utilities_v0.0.0-nightly39ce3cbcf120211206.1) | ||
### Changes | ||
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/6fe1f0a081835b662f3c880d6405724d3abc4c0b) by email not defined) | ||
- Bump @fluentui/keyboard-keys to v0.0.0-nightly131c59c96120211203.1 ([commit](https://github.com/microsoft/fluentui/commit/6fe1f0a081835b662f3c880d6405724d3abc4c0b) by beachball) | ||
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/f5d813357240886d3e3a5215ab8304bf1034298f) by email not defined) | ||
- [breaking] Remove useControllableValue hook (use useControllableState instead) ([PR #20865](https://github.com/microsoft/fluentui/pull/20865) by elcraig@microsoft.com) | ||
- Bump @fluentui/keyboard-keys to v0.0.0-nightly39ce3cbcf120211206.1 ([commit](https://github.com/microsoft/fluentui/commit/f5d813357240886d3e3a5215ab8304bf1034298f) by beachball) | ||
@@ -17,0 +18,0 @@ ## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-beta.4) |
@@ -61,4 +61,2 @@ import { DispatchWithoutAction } from 'react'; | ||
export declare type ChangeCallback<TElement extends HTMLElement, TValue, TEvent extends React_2.SyntheticEvent<TElement> | undefined> = (ev: TEvent, newValue: TValue | undefined) => void; | ||
/** | ||
@@ -105,7 +103,2 @@ * Clamps `value` to a number between the min and max. | ||
/** | ||
* Default value can be a value or an initializer | ||
*/ | ||
declare type DefaultValue<TValue> = TValue | (() => TValue); | ||
/** | ||
* An array of DIV tag properties and events. | ||
@@ -498,5 +491,14 @@ * | ||
/** | ||
* A useState 'like' hook that allows optional user control | ||
* Useful for components which allow uncontrolled and controlled behaviour for users | ||
* @returns - https://reactjs.org/docs/hooks-state.html | ||
* A `useState`-like hook to manage a value that could be either controlled or uncontrolled, | ||
* such as a checked state or text input string. | ||
* | ||
* Unlike `setState`, it's okay to call the returned updater (dispatch) function for either a | ||
* controlled or uncontrolled component. Calls will only be respected if the component is uncontrolled. | ||
* | ||
* @returns Same as [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate): an array | ||
* of the current value and an updater (dispatch) function. The updater function is referentially | ||
* stable (won't change during the component's lifecycle). It can take either a new value, or a | ||
* function which is passed the previous value and returns the new value. Unlike `setState`, calls | ||
* to the updater function will only be respected if the component is uncontrolled. | ||
* @see https://reactjs.org/docs/uncontrolled-components.html | ||
*/ | ||
@@ -507,11 +509,12 @@ export declare const useControllableState: <State>(options: UseControllableStateOptions<State>) => [State, React_2.Dispatch<React_2.SetStateAction<State>>]; | ||
/** | ||
* User provided default state or factory initializer | ||
* User-provided default state or initializer, for uncontrolled usage. | ||
*/ | ||
defaultState?: State | (() => State); | ||
/** | ||
* User provided controllable state, undefined state means internal state will be used | ||
* User-provided controlled state. `undefined` means internal state will be used. | ||
*/ | ||
state: State | undefined; | ||
/** | ||
* Used to initialize state if all user provided states are undefined | ||
* Used as the initial state if `state` and `defaultState` are both `undefined`. | ||
* If `undefined` is the correct initial state, pass that here. | ||
*/ | ||
@@ -522,17 +525,2 @@ initialState: State; | ||
/** | ||
* Hook to manage a value that could be either controlled or uncontrolled, such as a checked state or | ||
* text box string. | ||
* @param controlledValue - The controlled value passed in the props. This value will always be used if provided, | ||
* and the internal state will be updated to reflect it. | ||
* @param defaultUncontrolledValue - Initial value for the internal state in the uncontrolled case. | ||
* @returns An array of the current value and an updater callback. Like `React.useState`, the updater | ||
* callback always has the same identity, and it can take either a new value, or a function which | ||
* is passed the previous value and returns the new value. | ||
* @see https://reactjs.org/docs/uncontrolled-components.html | ||
*/ | ||
export declare function useControllableValue<TValue, TElement extends HTMLElement>(controlledValue: TValue, defaultUncontrolledValue: DefaultValue<TValue>): Readonly<[TValue, (update: React_2.SetStateAction<TValue>) => void]>; | ||
export declare function useControllableValue<TValue, TElement extends HTMLElement, TEvent extends React_2.SyntheticEvent<TElement> | undefined>(controlledValue: TValue, defaultUncontrolledValue: DefaultValue<TValue>, onChange: ChangeCallback<TElement, TValue, TEvent>): Readonly<[TValue, (update: React_2.SetStateAction<TValue>, ev?: React_2.FormEvent<TElement>) => void]>; | ||
/** | ||
* https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback | ||
@@ -539,0 +527,0 @@ * |
export * from './useControllableState'; | ||
export * from './useBoolean'; | ||
export * from './useConst'; | ||
export * from './useControllableValue'; | ||
export * from './useEventCallback'; | ||
@@ -6,0 +5,0 @@ export * from './useFirstMount'; |
@@ -15,4 +15,2 @@ "use strict"; | ||
tslib_1.__exportStar(require("./useControllableValue"), exports); | ||
tslib_1.__exportStar(require("./useEventCallback"), exports); | ||
@@ -19,0 +17,0 @@ |
import * as React from 'react'; | ||
export declare type UseControllableStateOptions<State> = { | ||
/** | ||
* User provided default state or factory initializer | ||
* User-provided default state or initializer, for uncontrolled usage. | ||
*/ | ||
defaultState?: State | (() => State); | ||
/** | ||
* User provided controllable state, undefined state means internal state will be used | ||
* User-provided controlled state. `undefined` means internal state will be used. | ||
*/ | ||
state: State | undefined; | ||
/** | ||
* Used to initialize state if all user provided states are undefined | ||
* Used as the initial state if `state` and `defaultState` are both `undefined`. | ||
* If `undefined` is the correct initial state, pass that here. | ||
*/ | ||
@@ -17,6 +18,15 @@ initialState: State; | ||
/** | ||
* A useState 'like' hook that allows optional user control | ||
* Useful for components which allow uncontrolled and controlled behaviour for users | ||
* @returns - https://reactjs.org/docs/hooks-state.html | ||
* A `useState`-like hook to manage a value that could be either controlled or uncontrolled, | ||
* such as a checked state or text input string. | ||
* | ||
* Unlike `setState`, it's okay to call the returned updater (dispatch) function for either a | ||
* controlled or uncontrolled component. Calls will only be respected if the component is uncontrolled. | ||
* | ||
* @returns Same as [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate): an array | ||
* of the current value and an updater (dispatch) function. The updater function is referentially | ||
* stable (won't change during the component's lifecycle). It can take either a new value, or a | ||
* function which is passed the previous value and returns the new value. Unlike `setState`, calls | ||
* to the updater function will only be respected if the component is uncontrolled. | ||
* @see https://reactjs.org/docs/uncontrolled-components.html | ||
*/ | ||
export declare const useControllableState: <State>(options: UseControllableStateOptions<State>) => [State, React.Dispatch<React.SetStateAction<State>>]; |
@@ -12,6 +12,2 @@ "use strict"; | ||
function isUndefined(state) { | ||
return typeof state === 'undefined'; | ||
} | ||
function isFactoryDispatch(newState) { | ||
@@ -21,5 +17,14 @@ return typeof newState === 'function'; | ||
/** | ||
* A useState 'like' hook that allows optional user control | ||
* Useful for components which allow uncontrolled and controlled behaviour for users | ||
* @returns - https://reactjs.org/docs/hooks-state.html | ||
* A `useState`-like hook to manage a value that could be either controlled or uncontrolled, | ||
* such as a checked state or text input string. | ||
* | ||
* Unlike `setState`, it's okay to call the returned updater (dispatch) function for either a | ||
* controlled or uncontrolled component. Calls will only be respected if the component is uncontrolled. | ||
* | ||
* @returns Same as [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate): an array | ||
* of the current value and an updater (dispatch) function. The updater function is referentially | ||
* stable (won't change during the component's lifecycle). It can take either a new value, or a | ||
* function which is passed the previous value and returns the new value. Unlike `setState`, calls | ||
* to the updater function will only be respected if the component is uncontrolled. | ||
* @see https://reactjs.org/docs/uncontrolled-components.html | ||
*/ | ||
@@ -30,3 +35,3 @@ | ||
const isControlled = useIsControlled(options.state); | ||
const initialState = isUndefined(options.defaultState) ? options.initialState : options.defaultState; | ||
const initialState = typeof options.defaultState === 'undefined' ? options.initialState : options.defaultState; | ||
const [internalState, setInternalState] = React.useState(initialState); | ||
@@ -33,0 +38,0 @@ const state = isControlled ? options.state : internalState; |
export * from './useControllableState'; | ||
export * from './useBoolean'; | ||
export * from './useConst'; | ||
export * from './useControllableValue'; | ||
export * from './useEventCallback'; | ||
@@ -6,0 +5,0 @@ export * from './useFirstMount'; |
export * from './useControllableState'; | ||
export * from './useBoolean'; | ||
export * from './useConst'; | ||
export * from './useControllableValue'; | ||
export * from './useEventCallback'; | ||
@@ -6,0 +5,0 @@ export * from './useFirstMount'; |
import * as React from 'react'; | ||
export declare type UseControllableStateOptions<State> = { | ||
/** | ||
* User provided default state or factory initializer | ||
* User-provided default state or initializer, for uncontrolled usage. | ||
*/ | ||
defaultState?: State | (() => State); | ||
/** | ||
* User provided controllable state, undefined state means internal state will be used | ||
* User-provided controlled state. `undefined` means internal state will be used. | ||
*/ | ||
state: State | undefined; | ||
/** | ||
* Used to initialize state if all user provided states are undefined | ||
* Used as the initial state if `state` and `defaultState` are both `undefined`. | ||
* If `undefined` is the correct initial state, pass that here. | ||
*/ | ||
@@ -17,6 +18,15 @@ initialState: State; | ||
/** | ||
* A useState 'like' hook that allows optional user control | ||
* Useful for components which allow uncontrolled and controlled behaviour for users | ||
* @returns - https://reactjs.org/docs/hooks-state.html | ||
* A `useState`-like hook to manage a value that could be either controlled or uncontrolled, | ||
* such as a checked state or text input string. | ||
* | ||
* Unlike `setState`, it's okay to call the returned updater (dispatch) function for either a | ||
* controlled or uncontrolled component. Calls will only be respected if the component is uncontrolled. | ||
* | ||
* @returns Same as [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate): an array | ||
* of the current value and an updater (dispatch) function. The updater function is referentially | ||
* stable (won't change during the component's lifecycle). It can take either a new value, or a | ||
* function which is passed the previous value and returns the new value. Unlike `setState`, calls | ||
* to the updater function will only be respected if the component is uncontrolled. | ||
* @see https://reactjs.org/docs/uncontrolled-components.html | ||
*/ | ||
export declare const useControllableState: <State>(options: UseControllableStateOptions<State>) => [State, React.Dispatch<React.SetStateAction<State>>]; |
import * as React from 'react'; | ||
import { useConst } from './useConst'; | ||
function isUndefined(state) { | ||
return typeof state === 'undefined'; | ||
} | ||
function isFactoryDispatch(newState) { | ||
@@ -12,5 +8,14 @@ return typeof newState === 'function'; | ||
/** | ||
* A useState 'like' hook that allows optional user control | ||
* Useful for components which allow uncontrolled and controlled behaviour for users | ||
* @returns - https://reactjs.org/docs/hooks-state.html | ||
* A `useState`-like hook to manage a value that could be either controlled or uncontrolled, | ||
* such as a checked state or text input string. | ||
* | ||
* Unlike `setState`, it's okay to call the returned updater (dispatch) function for either a | ||
* controlled or uncontrolled component. Calls will only be respected if the component is uncontrolled. | ||
* | ||
* @returns Same as [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate): an array | ||
* of the current value and an updater (dispatch) function. The updater function is referentially | ||
* stable (won't change during the component's lifecycle). It can take either a new value, or a | ||
* function which is passed the previous value and returns the new value. Unlike `setState`, calls | ||
* to the updater function will only be respected if the component is uncontrolled. | ||
* @see https://reactjs.org/docs/uncontrolled-components.html | ||
*/ | ||
@@ -21,3 +26,3 @@ | ||
const isControlled = useIsControlled(options.state); | ||
const initialState = isUndefined(options.defaultState) ? options.initialState : options.defaultState; | ||
const initialState = typeof options.defaultState === 'undefined' ? options.initialState : options.defaultState; | ||
const [internalState, setInternalState] = React.useState(initialState); | ||
@@ -24,0 +29,0 @@ const state = isControlled ? options.state : internalState; |
{ | ||
"name": "@fluentui/react-utilities", | ||
"version": "0.0.0-nightly131c59c96120211203.1", | ||
"version": "0.0.0-nightly39ce3cbcf120211206.1", | ||
"description": "A set of general React-specific utilities.", | ||
@@ -40,3 +40,3 @@ "main": "lib-commonjs/index.js", | ||
"dependencies": { | ||
"@fluentui/keyboard-keys": "0.0.0-nightly131c59c96120211203.1", | ||
"@fluentui/keyboard-keys": "0.0.0-nightly39ce3cbcf120211206.1", | ||
"tslib": "^2.1.0" | ||
@@ -43,0 +43,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
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
4
323680
211
5612
+ Added@fluentui/keyboard-keys@0.0.0-nightly39ce3cbcf120211206.1(transitive)
- Removed@fluentui/keyboard-keys@0.0.0-nightly131c59c96120211203.1(transitive)
Updated@fluentui/keyboard-keys@0.0.0-nightly39ce3cbcf120211206.1