@fluentui/react-utilities 0.0.0-nightly-20230503-0419.1 → 0.0.0-nightly-20230504-0417.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.json
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
"name": "@fluentui/react-utilities",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
6
|
-
"tag": "@fluentui/react-utilities_v0.0.0-nightly-
|
7
|
-
"version": "0.0.0-nightly-
|
5
|
+
"date": "Thu, 04 May 2023 04:24:55 GMT",
|
6
|
+
"tag": "@fluentui/react-utilities_v0.0.0-nightly-20230504-0417.1",
|
7
|
+
"version": "0.0.0-nightly-20230504-0417.1",
|
8
8
|
"comments": {
|
9
9
|
"prerelease": [
|
10
10
|
{
|
@@ -16,8 +16,8 @@
|
|
16
16
|
{
|
17
17
|
"author": "beachball",
|
18
18
|
"package": "@fluentui/react-utilities",
|
19
|
-
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-
|
20
|
-
"commit": "
|
19
|
+
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230504-0417.1",
|
20
|
+
"commit": "433bf105e0be3c4383e246e823c6c1a56a6aea0f"
|
21
21
|
}
|
22
22
|
]
|
23
23
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# Change Log - @fluentui/react-utilities
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Thu, 04 May 2023 04:24:55 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-nightly-
|
7
|
+
## [0.0.0-nightly-20230504-0417.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v0.0.0-nightly-20230504-0417.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.8.0..@fluentui/react-utilities_v0.0.0-nightly-
|
9
|
+
Thu, 04 May 2023 04:24:55 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.8.0..@fluentui/react-utilities_v0.0.0-nightly-20230504-0417.1)
|
11
11
|
|
12
12
|
### Changes
|
13
13
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
|
15
|
-
- Bump @fluentui/keyboard-keys to v0.0.0-nightly-
|
15
|
+
- Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230504-0417.1 ([commit](https://github.com/microsoft/fluentui/commit/433bf105e0be3c4383e246e823c6c1a56a6aea0f) by beachball)
|
16
16
|
|
17
17
|
## [9.8.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.8.0)
|
18
18
|
|
package/dist/index.d.ts
CHANGED
@@ -515,18 +515,19 @@ export declare type UnknownSlotProps = Pick<React_2.HTMLAttributes<HTMLElement>,
|
|
515
515
|
/**
|
516
516
|
* @internal
|
517
517
|
*
|
518
|
-
* A `useState
|
518
|
+
* A [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate)-like hook
|
519
|
+
* to manage a value that could be either `controlled` or `uncontrolled`,
|
519
520
|
* such as a checked state or text input string.
|
520
521
|
*
|
521
|
-
*
|
522
|
-
*
|
522
|
+
* @see https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components for more details on `controlled`/`uncontrolled`
|
523
|
+
*
|
524
|
+
* @returns an array of the current value and an updater (dispatcher) function.
|
525
|
+
* The updater function is referentially stable (won't change during the component's lifecycle).
|
526
|
+
* It can take either a new value, or a function which is passed the previous value and returns the new value.
|
527
|
+
*
|
528
|
+
* ❗️❗️ Calls to the dispatcher will only modify the state if the state is `uncontrolled`.
|
529
|
+
* Meaning that if a state is `controlled`, calls to the dispatcher do not modify the state.
|
523
530
|
*
|
524
|
-
* @returns Same as [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate): an array
|
525
|
-
* of the current value and an updater (dispatch) function. The updater function is referentially
|
526
|
-
* stable (won't change during the component's lifecycle). It can take either a new value, or a
|
527
|
-
* function which is passed the previous value and returns the new value. Unlike `setState`, calls
|
528
|
-
* to the updater function will only be respected if the component is uncontrolled.
|
529
|
-
* @see https://reactjs.org/docs/uncontrolled-components.html
|
530
531
|
*/
|
531
532
|
export declare const useControllableState: <State>(options: UseControllableStateOptions<State>) => [State, React_2.Dispatch<React_2.SetStateAction<State>>];
|
532
533
|
|
@@ -2,18 +2,19 @@ import * as React from 'react';
|
|
2
2
|
/**
|
3
3
|
* @internal
|
4
4
|
*
|
5
|
-
* A `useState
|
5
|
+
* A [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate)-like hook
|
6
|
+
* to manage a value that could be either `controlled` or `uncontrolled`,
|
6
7
|
* such as a checked state or text input string.
|
7
8
|
*
|
8
|
-
*
|
9
|
-
*
|
9
|
+
* @see https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components for more details on `controlled`/`uncontrolled`
|
10
|
+
*
|
11
|
+
* @returns an array of the current value and an updater (dispatcher) function.
|
12
|
+
* The updater function is referentially stable (won't change during the component's lifecycle).
|
13
|
+
* It can take either a new value, or a function which is passed the previous value and returns the new value.
|
14
|
+
*
|
15
|
+
* ❗️❗️ Calls to the dispatcher will only modify the state if the state is `uncontrolled`.
|
16
|
+
* Meaning that if a state is `controlled`, calls to the dispatcher do not modify the state.
|
10
17
|
*
|
11
|
-
* @returns Same as [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate): an array
|
12
|
-
* of the current value and an updater (dispatch) function. The updater function is referentially
|
13
|
-
* stable (won't change during the component's lifecycle). It can take either a new value, or a
|
14
|
-
* function which is passed the previous value and returns the new value. Unlike `setState`, calls
|
15
|
-
* to the updater function will only be respected if the component is uncontrolled.
|
16
|
-
* @see https://reactjs.org/docs/uncontrolled-components.html
|
17
18
|
*/
|
18
19
|
export const useControllableState = options => {
|
19
20
|
const initialState = typeof options.defaultState === 'undefined' ? options.initialState : options.defaultState;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","useControllableState","options","initialState","defaultState","internalState","setInternalState","useState","useIsControlled","state","noop","controlledValue","isControlled","undefined","process","env","NODE_ENV","useEffect","error","Error","controlWarning","undefinedWarning","console","stack","join"],"sources":["../../src/hooks/useControllableState.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n */\nexport type UseControllableStateOptions<State> = {\n /**\n * User-provided default state or initializer, for uncontrolled usage.\n */\n defaultState?: State | (() => State);\n /**\n * User-provided controlled state. `undefined` means internal state will be used.\n */\n state: State | undefined;\n /**\n * Used as the initial state if `state` and `defaultState` are both `undefined`.\n * If `undefined` is the correct initial state, pass that here.\n */\n initialState: State;\n};\n\n/**\n * @internal\n *\n * A `useState
|
1
|
+
{"version":3,"names":["React","useControllableState","options","initialState","defaultState","internalState","setInternalState","useState","useIsControlled","state","noop","controlledValue","isControlled","undefined","process","env","NODE_ENV","useEffect","error","Error","controlWarning","undefinedWarning","console","stack","join"],"sources":["../../src/hooks/useControllableState.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n */\nexport type UseControllableStateOptions<State> = {\n /**\n * User-provided default state or initializer, for uncontrolled usage.\n */\n defaultState?: State | (() => State);\n /**\n * User-provided controlled state. `undefined` means internal state will be used.\n */\n state: State | undefined;\n /**\n * Used as the initial state if `state` and `defaultState` are both `undefined`.\n * If `undefined` is the correct initial state, pass that here.\n */\n initialState: State;\n};\n\n/**\n * @internal\n *\n * A [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate)-like hook\n * to manage a value that could be either `controlled` or `uncontrolled`,\n * such as a checked state or text input string.\n *\n * @see https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components for more details on `controlled`/`uncontrolled`\n *\n * @returns an array of the current value and an updater (dispatcher) function.\n * The updater function is referentially stable (won't change during the component's lifecycle).\n * It can take either a new value, or a function which is passed the previous value and returns the new value.\n *\n * ❗️❗️ Calls to the dispatcher will only modify the state if the state is `uncontrolled`.\n * Meaning that if a state is `controlled`, calls to the dispatcher do not modify the state.\n *\n */\nexport const useControllableState = <State>(\n options: UseControllableStateOptions<State>,\n): [State, React.Dispatch<React.SetStateAction<State>>] => {\n const initialState = typeof options.defaultState === 'undefined' ? options.initialState : options.defaultState;\n const [internalState, setInternalState] = React.useState<State>(initialState);\n return useIsControlled(options.state) ? [options.state, noop] : [internalState, setInternalState];\n};\n\nfunction noop() {\n /* noop */\n}\n\n/**\n * Helper hook to handle previous comparison of controlled/uncontrolled\n * Prints an error when isControlled value switches between subsequent renders\n * @returns - whether the value is controlled\n */\nconst useIsControlled = <V>(controlledValue?: V): controlledValue is V => {\n const [isControlled] = React.useState<boolean>(() => controlledValue !== undefined);\n\n if (process.env.NODE_ENV !== 'production') {\n // We don't want these warnings in production even though it is against native behaviour\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (isControlled !== (controlledValue !== undefined)) {\n const error = new Error();\n\n const controlWarning = isControlled\n ? 'a controlled value to be uncontrolled'\n : 'an uncontrolled value to be controlled';\n\n const undefinedWarning = isControlled ? 'defined to an undefined' : 'undefined to a defined';\n\n // eslint-disable-next-line no-console\n console.error(\n [\n // Default react error\n 'A component is changing ' + controlWarning + '. This is likely caused by the value',\n 'changing from ' + undefinedWarning + ' value, which should not happen.',\n 'Decide between using a controlled or uncontrolled input element for the lifetime of the component.',\n 'More info: https://reactjs.org/link/controlled-components',\n error.stack,\n ].join(' '),\n );\n }\n }, [isControlled, controlledValue]);\n }\n\n return isControlled;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAqBvB;;;;;;;;;;;;;;;;;AAiBA,OAAO,MAAMC,oBAAA,GACXC,OAAA,IACyD;EACzD,MAAMC,YAAA,GAAe,OAAOD,OAAA,CAAQE,YAAY,KAAK,cAAcF,OAAA,CAAQC,YAAY,GAAGD,OAAA,CAAQE,YAAY;EAC9G,MAAM,CAACC,aAAA,EAAeC,gBAAA,CAAiB,GAAGN,KAAA,CAAMO,QAAQ,CAAQJ,YAAA;EAChE,OAAOK,eAAA,CAAgBN,OAAA,CAAQO,KAAK,IAAI,CAACP,OAAA,CAAQO,KAAK,EAAEC,IAAA,CAAK,GAAG,CAACL,aAAA,EAAeC,gBAAA,CAAiB;AACnG;AAEA,SAASI,KAAA,EAAO;EACd;AAGF;;;;;AAKA,MAAMF,eAAA,GAAsBG,eAAA,IAA8C;EACxE,MAAM,CAACC,YAAA,CAAa,GAAGZ,KAAA,CAAMO,QAAQ,CAAU,MAAMI,eAAA,KAAoBE,SAAA;EAEzE,IAAIC,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzC;IACA;IACAhB,KAAA,CAAMiB,SAAS,CAAC,MAAM;MACpB,IAAIL,YAAA,MAAkBD,eAAA,KAAoBE,SAAQ,GAAI;QACpD,MAAMK,KAAA,GAAQ,IAAIC,KAAA;QAElB,MAAMC,cAAA,GAAiBR,YAAA,GACnB,0CACA,wCAAwC;QAE5C,MAAMS,gBAAA,GAAmBT,YAAA,GAAe,4BAA4B,wBAAwB;QAE5F;QACAU,OAAA,CAAQJ,KAAK,CACX;QACE;QACA,6BAA6BE,cAAA,GAAiB,wCAC9C,mBAAmBC,gBAAA,GAAmB,oCACtC,sGACA,6DACAH,KAAA,CAAMK,KAAK,CACZ,CAACC,IAAI,CAAC;MAEX;IACF,GAAG,CAACZ,YAAA,EAAcD,eAAA,CAAgB;EACpC;EAEA,OAAOC,YAAA;AACT"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../lib/hooks/useControllableState.js"],"sourcesContent":["import * as React from 'react';\n/**\n * @internal\n *\n * A `useState
|
1
|
+
{"version":3,"sources":["../../lib/hooks/useControllableState.js"],"sourcesContent":["import * as React from 'react';\n/**\n * @internal\n *\n * A [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate)-like hook\n * to manage a value that could be either `controlled` or `uncontrolled`,\n * such as a checked state or text input string.\n *\n * @see https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components for more details on `controlled`/`uncontrolled`\n *\n * @returns an array of the current value and an updater (dispatcher) function.\n * The updater function is referentially stable (won't change during the component's lifecycle).\n * It can take either a new value, or a function which is passed the previous value and returns the new value.\n *\n * ❗️❗️ Calls to the dispatcher will only modify the state if the state is `uncontrolled`.\n * Meaning that if a state is `controlled`, calls to the dispatcher do not modify the state.\n *\n */\nexport const useControllableState = options => {\n const initialState = typeof options.defaultState === 'undefined' ? options.initialState : options.defaultState;\n const [internalState, setInternalState] = React.useState(initialState);\n return useIsControlled(options.state) ? [options.state, noop] : [internalState, setInternalState];\n};\nfunction noop() {\n /* noop */}\n/**\n * Helper hook to handle previous comparison of controlled/uncontrolled\n * Prints an error when isControlled value switches between subsequent renders\n * @returns - whether the value is controlled\n */\nconst useIsControlled = controlledValue => {\n const [isControlled] = React.useState(() => controlledValue !== undefined);\n if (process.env.NODE_ENV !== 'production') {\n // We don't want these warnings in production even though it is against native behaviour\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (isControlled !== (controlledValue !== undefined)) {\n const error = new Error();\n const controlWarning = isControlled ? 'a controlled value to be uncontrolled' : 'an uncontrolled value to be controlled';\n const undefinedWarning = isControlled ? 'defined to an undefined' : 'undefined to a defined';\n // eslint-disable-next-line no-console\n console.error([\n // Default react error\n 'A component is changing ' + controlWarning + '. This is likely caused by the value', 'changing from ' + undefinedWarning + ' value, which should not happen.', 'Decide between using a controlled or uncontrolled input element for the lifetime of the component.', 'More info: https://reactjs.org/link/controlled-components', error.stack].join(' '));\n }\n }, [isControlled, controlledValue]);\n }\n return isControlled;\n};\n//# sourceMappingURL=useControllableState.js.map"],"names":["useControllableState","options","initialState","defaultState","internalState","setInternalState","React","useState","useIsControlled","state","noop","controlledValue","isControlled","undefined","process","env","NODE_ENV","useEffect","error","Error","controlWarning","undefinedWarning","console","stack","join"],"mappings":";;;;+BAkBaA;;aAAAA;;;6DAlBU;AAkBhB,MAAMA,uBAAuBC,CAAAA,UAAW;IAC7C,MAAMC,eAAe,OAAOD,QAAQE,YAAY,KAAK,cAAcF,QAAQC,YAAY,GAAGD,QAAQE,YAAY;IAC9G,MAAM,CAACC,eAAeC,iBAAiB,GAAGC,OAAMC,QAAQ,CAACL;IACzD,OAAOM,gBAAgBP,QAAQQ,KAAK,IAAI;QAACR,QAAQQ,KAAK;QAAEC;KAAK,GAAG;QAACN;QAAeC;KAAiB;AACnG;AACA,SAASK,OAAO;AACd,QAAQ,GAAE;AACZ;;;;CAIC,GACD,MAAMF,kBAAkBG,CAAAA,kBAAmB;IACzC,MAAM,CAACC,aAAa,GAAGN,OAAMC,QAAQ,CAAC,IAAMI,oBAAoBE;IAChE,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,wFAAwF;QACxF,sDAAsD;QACtDV,OAAMW,SAAS,CAAC,IAAM;YACpB,IAAIL,iBAAkBD,CAAAA,oBAAoBE,SAAQ,GAAI;gBACpD,MAAMK,QAAQ,IAAIC;gBAClB,MAAMC,iBAAiBR,eAAe,0CAA0C,wCAAwC;gBACxH,MAAMS,mBAAmBT,eAAe,4BAA4B,wBAAwB;gBAC5F,sCAAsC;gBACtCU,QAAQJ,KAAK,CAAC;oBACd,sBAAsB;oBACtB,6BAA6BE,iBAAiB;oBAAwC,mBAAmBC,mBAAmB;oBAAoC;oBAAsG;oBAA6DH,MAAMK,KAAK;iBAAC,CAACC,IAAI,CAAC;YACvV,CAAC;QACH,GAAG;YAACZ;YAAcD;SAAgB;IACpC,CAAC;IACD,OAAOC;AACT,GACA,gDAAgD"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-utilities",
|
3
|
-
"version": "0.0.0-nightly-
|
3
|
+
"version": "0.0.0-nightly-20230504-0417.1",
|
4
4
|
"description": "A set of general React-specific utilities.",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -28,7 +28,7 @@
|
|
28
28
|
"@fluentui/scripts-tasks": "*"
|
29
29
|
},
|
30
30
|
"dependencies": {
|
31
|
-
"@fluentui/keyboard-keys": "0.0.0-nightly-
|
31
|
+
"@fluentui/keyboard-keys": "0.0.0-nightly-20230504-0417.1",
|
32
32
|
"@swc/helpers": "^0.4.14"
|
33
33
|
},
|
34
34
|
"peerDependencies": {
|
package/.swcrc
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "https://json.schemastore.org/swcrc",
|
3
|
-
"exclude": [
|
4
|
-
"/testing",
|
5
|
-
"/**/*.cy.ts",
|
6
|
-
"/**/*.cy.tsx",
|
7
|
-
"/**/*.spec.ts",
|
8
|
-
"/**/*.spec.tsx",
|
9
|
-
"/**/*.test.ts",
|
10
|
-
"/**/*.test.tsx"
|
11
|
-
],
|
12
|
-
"jsc": {
|
13
|
-
"parser": {
|
14
|
-
"syntax": "typescript",
|
15
|
-
"tsx": true,
|
16
|
-
"decorators": false,
|
17
|
-
"dynamicImport": false
|
18
|
-
},
|
19
|
-
"externalHelpers": true,
|
20
|
-
"transform": {
|
21
|
-
"react": {
|
22
|
-
"runtime": "classic",
|
23
|
-
"useSpread": true
|
24
|
-
}
|
25
|
-
},
|
26
|
-
"target": "es2019"
|
27
|
-
},
|
28
|
-
"minify": false,
|
29
|
-
"sourceMaps": true
|
30
|
-
}
|