@fluentui/react-utilities
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -5,3 +5,40 @@ { | ||
{ | ||
"date": "Thu, 18 Feb 2021 19:34:40 GMT", | ||
"date": "Mon, 22 Feb 2021 12:21:30 GMT", | ||
"tag": "@fluentui/react-utilities_v0.4.0", | ||
"version": "0.4.0", | ||
"comments": { | ||
"patch": [ | ||
{ | ||
"comment": "align typings for shorthands", | ||
"author": "olfedias@microsoft.com", | ||
"commit": "a37bab178f676de967b937a8bad1a309e3e67fd8", | ||
"package": "@fluentui/react-utilities" | ||
} | ||
], | ||
"minor": [ | ||
{ | ||
"comment": "Breaks dependency on react-hooks for convergence", | ||
"author": "lingfan.gao@microsoft.com", | ||
"commit": "68bc4c7d68b5c01022658fcc485342670d56df39", | ||
"package": "@fluentui/react-utilities" | ||
} | ||
], | ||
"prerelease": [ | ||
{ | ||
"comment": "Bump @fluentui/jest-serializer-merge-styles to v8.0.0-beta.7", | ||
"author": "elcraig@microsoft.com", | ||
"commit": "a37bab178f676de967b937a8bad1a309e3e67fd8", | ||
"package": "@fluentui/react-utilities" | ||
}, | ||
{ | ||
"comment": "Bump @fluentui/utilities to v8.0.0-beta.15", | ||
"author": "elcraig@microsoft.com", | ||
"commit": "a37bab178f676de967b937a8bad1a309e3e67fd8", | ||
"package": "@fluentui/react-utilities" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Thu, 18 Feb 2021 19:38:50 GMT", | ||
"tag": "@fluentui/react-utilities_v0.3.1", | ||
@@ -8,0 +45,0 @@ "version": "0.3.1", |
# Change Log - @fluentui/react-utilities | ||
This log was last generated on Thu, 18 Feb 2021 19:34:40 GMT and should not be manually modified. | ||
This log was last generated on Mon, 22 Feb 2021 12:21:30 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## [0.4.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v0.4.0) | ||
Mon, 22 Feb 2021 12:21:30 GMT | ||
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v0.3.1..@fluentui/react-utilities_v0.4.0) | ||
### Minor changes | ||
- Breaks dependency on react-hooks for convergence ([PR #17091](https://github.com/microsoft/fluentui/pull/17091) by lingfan.gao@microsoft.com) | ||
### Patches | ||
- align typings for shorthands ([PR #17061](https://github.com/microsoft/fluentui/pull/17061) by olfedias@microsoft.com) | ||
### Changes | ||
- Bump @fluentui/jest-serializer-merge-styles to v8.0.0-beta.7 ([PR #17061](https://github.com/microsoft/fluentui/pull/17061) by elcraig@microsoft.com) | ||
- Bump @fluentui/utilities to v8.0.0-beta.15 ([PR #17061](https://github.com/microsoft/fluentui/pull/17061) by elcraig@microsoft.com) | ||
## [0.3.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v0.3.1) | ||
Thu, 18 Feb 2021 19:34:40 GMT | ||
Thu, 18 Feb 2021 19:38:50 GMT | ||
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v0.3.0..@fluentui/react-utilities_v0.3.1) | ||
@@ -11,0 +29,0 @@ |
@@ -7,2 +7,4 @@ import * as React from 'react'; | ||
export declare type ChangeCallback<TElement extends HTMLElement, TValue, TEvent extends React.SyntheticEvent<TElement> | undefined> = (ev: TEvent, newValue: TValue | undefined) => void; | ||
/** | ||
@@ -69,2 +71,8 @@ * Class dictionary. | ||
/** | ||
* A Ref function which can be treated like a ref object in that it has an attached | ||
* current property, which will be updated as the ref is evaluated. | ||
*/ | ||
export declare type RefObjectFunction<T> = React.RefObject<T> & ((value: T) => void); | ||
/** | ||
* Ensures that the given slots are represented using object syntax. This ensures that | ||
@@ -89,2 +97,67 @@ * the object can be merged along with other objects. | ||
/** | ||
* Hook to store a value and generate callbacks for setting the value to true or false. | ||
* The identity of the callbacks will always stay the same. | ||
* | ||
* @param initialState - Initial value | ||
* @returns Array with the current value and an object containing the updater callbacks. | ||
*/ | ||
export declare function useBoolean(initialState: boolean): [boolean, UseBooleanCallbacks]; | ||
/** Updater callbacks returned by `useBoolean`. */ | ||
export declare interface UseBooleanCallbacks { | ||
/** Set the value to true. Always has the same identity. */ | ||
setTrue: () => void; | ||
/** Set the value to false. Always has the same identity. */ | ||
setFalse: () => void; | ||
/** Toggle the value. Always has the same identity. */ | ||
toggle: () => void; | ||
} | ||
/** | ||
* Hook to initialize and return a constant value. Unlike `React.useMemo`, this is guaranteed to | ||
* always return the same value (and if the initializer is a function, only call it once). | ||
* This is similar to setting a private member in a class constructor. | ||
* | ||
* If the value should ever change based on dependencies, use `React.useMemo` instead. | ||
* | ||
* @param initialValue - Initial value, or function to get the initial value. Similar to `useState`, | ||
* only the value/function passed in the first time this is called is respected. | ||
* @returns The value. The identity of this value will always be the same. | ||
*/ | ||
export declare function useConst<T>(initialValue: T | (() => T)): T; | ||
/** | ||
* 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 | undefined, defaultUncontrolledValue: TValue | undefined): Readonly<[TValue | undefined, (update: React.SetStateAction<TValue | undefined>) => void]>; | ||
export declare function useControllableValue<TValue, TElement extends HTMLElement, TEvent extends React.SyntheticEvent<TElement> | undefined>(controlledValue: TValue | undefined, defaultUncontrolledValue: TValue | undefined, onChange: ChangeCallback<TElement, TValue, TEvent> | undefined): Readonly<[TValue | undefined, (update: React.SetStateAction<TValue | undefined>, ev?: React.FormEvent<TElement>) => void]>; | ||
/** | ||
* Hook to generate a unique ID in the global scope (spanning across duplicate copies of the same library). | ||
* | ||
* @param prefix - Optional prefix for the ID | ||
* @param providedId - Optional id provided by a parent component. Defaults to the provided value if present, | ||
* without conditioning the hook call | ||
* @returns The ID | ||
*/ | ||
export declare function useId(prefix?: string, providedId?: string): string; | ||
/** | ||
* React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that | ||
* updates all provided refs | ||
* @param refs - Refs to collectively update with one ref value. | ||
* @returns A function with an attached "current" prop, so that it can be treated like a RefObject. | ||
*/ | ||
export declare function useMergedRefs<T>(...refs: (React.Ref<T> | undefined)[]): RefObjectFunction<T>; | ||
export { } |
@@ -15,2 +15,5 @@ ## API Report File for "@fluentui/react-utilities" | ||
// @public (undocumented) | ||
export type ChangeCallback<TElement extends HTMLElement, TValue, TEvent extends React.SyntheticEvent<TElement> | undefined> = (ev: TEvent, newValue: TValue | undefined) => void; | ||
// @public | ||
@@ -55,2 +58,5 @@ export type ClassDictionary = Record<string, string>; | ||
// @public | ||
export type RefObjectFunction<T> = React.RefObject<T> & ((value: T) => void); | ||
// @public | ||
export const resolveShorthandProps: <TProps>(props: TProps, shorthandPropNames: string[]) => TProps; | ||
@@ -73,5 +79,30 @@ | ||
// @public | ||
export function useBoolean(initialState: boolean): [boolean, UseBooleanCallbacks]; | ||
// @public | ||
export interface UseBooleanCallbacks { | ||
setFalse: () => void; | ||
setTrue: () => void; | ||
toggle: () => void; | ||
} | ||
// @public | ||
export function useConst<T>(initialValue: T | (() => T)): T; | ||
// @public | ||
export function useControllableValue<TValue, TElement extends HTMLElement>(controlledValue: TValue | undefined, defaultUncontrolledValue: TValue | undefined): Readonly<[TValue | undefined, (update: React.SetStateAction<TValue | undefined>) => void]>; | ||
// @public (undocumented) | ||
export function useControllableValue<TValue, TElement extends HTMLElement, TEvent extends React.SyntheticEvent<TElement> | undefined>(controlledValue: TValue | undefined, defaultUncontrolledValue: TValue | undefined, onChange: ChangeCallback<TElement, TValue, TEvent> | undefined): Readonly<[TValue | undefined, (update: React.SetStateAction<TValue | undefined>, ev?: React.FormEvent<TElement>) => void]>; | ||
// @public | ||
export function useId(prefix?: string, providedId?: string): string; | ||
// @public | ||
export function useMergedRefs<T>(...refs: (React.Ref<T> | undefined)[]): RefObjectFunction<T>; | ||
// (No @packageDocumentation comment for this package) | ||
``` |
import './version'; | ||
export * from './compose/index'; | ||
export * from './hooks/index'; |
@@ -1,6 +0,7 @@ | ||
define(["require", "exports", "tslib", "./compose/index", "./version"], function (require, exports, tslib_1, index_1) { | ||
define(["require", "exports", "tslib", "./compose/index", "./hooks/index", "./version"], function (require, exports, tslib_1, index_1, index_2) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
tslib_1.__exportStar(index_1, exports); | ||
tslib_1.__exportStar(index_2, exports); | ||
}); | ||
//# sourceMappingURL=index.js.map |
define(["require", "exports", "@fluentui/set-version"], function (require, exports, set_version_1) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
set_version_1.setVersion('@fluentui/react-utilities', '0.3.1'); | ||
set_version_1.setVersion('@fluentui/react-utilities', '0.4.0'); | ||
}); | ||
//# sourceMappingURL=version.js.map |
import './version'; | ||
export * from './compose/index'; | ||
export * from './hooks/index'; |
@@ -6,2 +6,3 @@ "use strict"; | ||
tslib_1.__exportStar(require("./compose/index"), exports); | ||
tslib_1.__exportStar(require("./hooks/index"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
var set_version_1 = require("@fluentui/set-version"); | ||
set_version_1.setVersion('@fluentui/react-utilities', '0.3.1'); | ||
set_version_1.setVersion('@fluentui/react-utilities', '0.4.0'); | ||
//# sourceMappingURL=version.js.map |
import './version'; | ||
export * from './compose/index'; | ||
export * from './hooks/index'; |
import './version'; | ||
export * from './compose/index'; | ||
export * from './hooks/index'; | ||
//# sourceMappingURL=index.js.map |
// Do not modify this file; it is generated as part of publish. | ||
// The checked in version is a placeholder only and will not be updated. | ||
import { setVersion } from '@fluentui/set-version'; | ||
setVersion('@fluentui/react-utilities', '0.3.1'); | ||
setVersion('@fluentui/react-utilities', '0.4.0'); | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@fluentui/react-utilities", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "A set of general React-specific utilities.", | ||
@@ -30,2 +30,5 @@ "main": "lib-commonjs/index.js", | ||
"@fluentui/eslint-plugin": "^1.0.0-beta.2", | ||
"@fluentui/jest-serializer-merge-styles": "^8.0.0-beta.7", | ||
"@fluentui/scripts": "^1.0.0", | ||
"@testing-library/react-hooks": "^5.0.3", | ||
"@types/enzyme": "3.10.3", | ||
@@ -36,4 +39,2 @@ "@types/enzyme-adapter-react-16": "1.0.3", | ||
"@types/webpack-env": "1.16.0", | ||
"@fluentui/scripts": "^1.0.0", | ||
"@fluentui/jest-serializer-merge-styles": "^8.0.0-beta.6", | ||
"enzyme": "~3.10.0", | ||
@@ -47,3 +48,3 @@ "enzyme-adapter-react-16": "^1.15.0", | ||
"@fluentui/set-version": "^8.0.0-beta.2", | ||
"@fluentui/utilities": "^8.0.0-beta.14", | ||
"@fluentui/utilities": "^8.0.0-beta.15", | ||
"tslib": "^1.10.0" | ||
@@ -50,0 +51,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
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
240275
191
2519
14