Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@fluentui/react-utilities

Package Overview
Dependencies
Maintainers
12
Versions
853
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fluentui/react-utilities - npm Package Compare versions

Comparing version 9.18.9 to 9.18.10

10

lib-commonjs/hooks/useAnimationFrame.js

@@ -11,4 +11,4 @@ "use strict";

});
const _canUseDOM = require("../ssr/canUseDOM");
const _useBrowserTimer = require("./useBrowserTimer");
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const setAnimationFrameNoop = (callback)=>{

@@ -20,7 +20,7 @@ callback(0);

function useAnimationFrame() {
const isDOM = (0, _canUseDOM.canUseDOM)();
// TODO: figure it out a way to not call global.requestAnimationFrame and instead infer window from some context
const setAnimationFrame = isDOM ? requestAnimationFrame : setAnimationFrameNoop;
const clearAnimationFrame = isDOM ? cancelAnimationFrame : cancelAnimationFrameNoop;
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
const win = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView;
const setAnimationFrame = win ? win.requestAnimationFrame : setAnimationFrameNoop;
const clearAnimationFrame = win ? win.cancelAnimationFrame : cancelAnimationFrameNoop;
return (0, _useBrowserTimer.useBrowserTimer)(setAnimationFrame, clearAnimationFrame);
}

@@ -17,2 +17,12 @@ "use strict";

const useControllableState = (options)=>{
if (process.env.NODE_ENV !== 'production') {
if (options.state !== undefined && options.defaultState !== undefined) {
// eslint-disable-next-line no-console
console.error(`@fluentui/react-utilities [useControllableState]:
A component must be either controlled or uncontrolled (specify either the state or the defaultState, but not both).
Decide between using a controlled or uncontrolled component and remove one of this props.
More info: https://reactjs.org/link/controlled-components
${new Error().stack}`);
}
}
const [internalState, setInternalState] = _react.useState(()=>{

@@ -63,3 +73,3 @@ if (options.defaultState === undefined) {

// eslint-disable-next-line no-console
console.error(`@fluentui/react-utilities [${useControllableState.name}]:
console.error(`@fluentui/react-utilities [useControllableState]:
A component is changing ${controlWarning}. This is likely caused by the value changing from ${undefinedWarning} value, which should not happen.

@@ -66,0 +76,0 @@ Decide between using a controlled or uncontrolled input element for the lifetime of the component.

@@ -12,5 +12,11 @@ "use strict";

const _useBrowserTimer = require("./useBrowserTimer");
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const setTimeoutNoop = (_callback)=>-1;
const clearTimeoutNoop = (_handle)=>undefined;
function useTimeout() {
// TODO: figure it out a way to not call global.setTimeout and instead infer window from some context
return (0, _useBrowserTimer.useBrowserTimer)(setTimeout, clearTimeout);
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
const win = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView;
const setTimerFn = win ? win.setTimeout : setTimeoutNoop;
const clearTimerFn = win ? win.clearTimeout : clearTimeoutNoop;
return (0, _useBrowserTimer.useBrowserTimer)(setTimerFn, clearTimerFn);
}

@@ -1,3 +0,3 @@

import { canUseDOM } from '../ssr/canUseDOM';
import { useBrowserTimer } from './useBrowserTimer';
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
const setAnimationFrameNoop = (callback)=>{

@@ -16,7 +16,7 @@ callback(0);

*/ export function useAnimationFrame() {
const isDOM = canUseDOM();
// TODO: figure it out a way to not call global.requestAnimationFrame and instead infer window from some context
const setAnimationFrame = isDOM ? requestAnimationFrame : setAnimationFrameNoop;
const clearAnimationFrame = isDOM ? cancelAnimationFrame : cancelAnimationFrameNoop;
const { targetDocument } = useFluent();
const win = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView;
const setAnimationFrame = win ? win.requestAnimationFrame : setAnimationFrameNoop;
const clearAnimationFrame = win ? win.cancelAnimationFrame : cancelAnimationFrameNoop;
return useBrowserTimer(setAnimationFrame, clearAnimationFrame);
}

@@ -22,2 +22,12 @@ import * as React from 'react';

*/ export const useControllableState = (options)=>{
if (process.env.NODE_ENV !== 'production') {
if (options.state !== undefined && options.defaultState !== undefined) {
// eslint-disable-next-line no-console
console.error(`@fluentui/react-utilities [useControllableState]:
A component must be either controlled or uncontrolled (specify either the state or the defaultState, but not both).
Decide between using a controlled or uncontrolled component and remove one of this props.
More info: https://reactjs.org/link/controlled-components
${new Error().stack}`);
}
}
const [internalState, setInternalState] = React.useState(()=>{

@@ -68,3 +78,3 @@ if (options.defaultState === undefined) {

// eslint-disable-next-line no-console
console.error(`@fluentui/react-utilities [${useControllableState.name}]:
console.error(`@fluentui/react-utilities [useControllableState]:
A component is changing ${controlWarning}. This is likely caused by the value changing from ${undefinedWarning} value, which should not happen.

@@ -71,0 +81,0 @@ Decide between using a controlled or uncontrolled input element for the lifetime of the component.

import { useBrowserTimer } from './useBrowserTimer';
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
const setTimeoutNoop = (_callback)=>-1;
const clearTimeoutNoop = (_handle)=>undefined;
/**

@@ -10,4 +13,7 @@ * @internal

*/ export function useTimeout() {
// TODO: figure it out a way to not call global.setTimeout and instead infer window from some context
return useBrowserTimer(setTimeout, clearTimeout);
const { targetDocument } = useFluent();
const win = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView;
const setTimerFn = win ? win.setTimeout : setTimeoutNoop;
const clearTimerFn = win ? win.clearTimeout : clearTimeoutNoop;
return useBrowserTimer(setTimerFn, clearTimerFn);
}
{
"name": "@fluentui/react-utilities",
"version": "9.18.9",
"version": "9.18.10",
"description": "A set of general React-specific utilities.",

@@ -22,3 +22,3 @@ "main": "lib-commonjs/index.js",

"test": "jest --passWithNoTests",
"type-check": "tsc -b tsconfig.json",
"type-check": "just-scripts type-check",
"generate-api": "just-scripts generate-api",

@@ -25,0 +25,0 @@ "test-ssr": "test-ssr \"./stories/**/*.stories.tsx\"",

Sorry, the diff of this file is too big to display

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

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