Socket
Socket
Sign inDemoInstall

@fluentui/react-utilities

Package Overview
Dependencies
Maintainers
12
Versions
819
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 0.0.0-nightly-20240606-0405.1 to 0.0.0-nightly-20240606-0726.1

75

dist/index.d.ts

@@ -12,3 +12,3 @@ import { DispatchWithoutAction } from 'react';

*/
declare function always<Props extends UnknownSlotProps>(value: Props | SlotShorthandValue | undefined, options: SlotOptions<Props>): SlotComponentType<Props>;
declare function always<Props extends SlotPropsDataType>(value: Props | SlotShorthandValue | undefined, options: SlotOptions<Props>): SlotComponentType<Props>;

@@ -73,3 +73,3 @@ /**

*/
export declare type ComponentProps<Slots extends SlotPropsRecord, Primary extends keyof Slots = 'root'> = Omit<Slots, Primary & 'root'> & PropsWithoutRef<ExtractSlotProps<Slots[Primary]>>;
export declare type ComponentProps<Slots extends SlotPropsRecord, Primary extends keyof Slots = 'root'> = Omit<Slots, Primary & 'root'> & PropsWithoutRef<WithoutSlotRenderFunction<ExtractSlotProps<Slots[Primary]>>>;

@@ -84,3 +84,3 @@ /**

} & {
[Key in keyof Slots]: ReplaceNullWithUndefined<Exclude<Slots[Key], SlotShorthandValue | (Key extends 'root' ? null : never)>>;
[Key in keyof Slots]: ReplaceNullWithUndefined<WithoutSlotRenderFunction<Exclude<Slots[Key], SlotShorthandValue | (Key extends 'root' ? null : never)>>>;
};

@@ -177,3 +177,5 @@

*/
export declare type ForwardRefComponent<Props> = React_2.ForwardRefExoticComponent<Props & React_2.RefAttributes<InferredElementRefType<Props>>>;
export declare type ForwardRefComponent<Props> = React_2.ForwardRefExoticComponent<Props & {
ref?: React_2.Ref<InferredElementRefType<Props>>;
}>;

@@ -195,3 +197,5 @@ /**

*/
export declare const getIntrinsicElementProps: <Props extends UnknownSlotProps, ExcludedPropKeys extends Extract<keyof Props, string> = never>(tagName: NonNullable<Props["as"]>, props: Props & React_2.RefAttributes<InferredElementRefType<Props>>, excludedPropNames?: ExcludedPropKeys[] | undefined) => DistributiveOmit<Props, ExcludedPropKeys | Exclude<keyof Props, "as" | keyof HTMLAttributes>>;
export declare const getIntrinsicElementProps: <Props extends SlotPropsDataType, ExcludedPropKeys extends Extract<keyof Props, string> = never>(tagName: NonNullable<Props["as"]>, props: Props & {
ref?: React_2.Ref<InferredElementRefType<Props>> | undefined;
}, excludedPropNames?: ExcludedPropKeys[] | undefined) => DistributiveOmit<Props, ExcludedPropKeys | Exclude<keyof Props, "slot" | "style" | "title" | "as" | "children" | "className" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture">>;

@@ -272,3 +276,3 @@ /**

*/
export declare function getSlots<R extends SlotPropsRecord>(state: ComponentState<R>): {
export declare function getSlots<R extends SlotPropsRecord>(state: LegacyComponentState<R>): {
slots: Slots<R>;

@@ -288,3 +292,3 @@ slotProps: ObjectSlotProps<R>;

*/
export declare function getSlotsNext<R extends SlotPropsRecord>(state: ComponentState<R>): {
export declare function getSlotsNext<R extends SlotPropsRecord>(state: LegacyComponentState<R>): {
slots: Slots<R>;

@@ -320,4 +324,2 @@ slotProps: ObjectSlotProps<R>;

declare type HTMLAttributes = React_2.HTMLAttributes<any>;
/**

@@ -416,3 +418,3 @@ * @internal

*/
export declare function isResolvedShorthand<Shorthand extends Slot<UnknownSlotProps>>(shorthand?: Shorthand): shorthand is ExtractSlotProps<Shorthand>;
export declare function isResolvedShorthand<Shorthand extends Slot<SlotPropsDataType>>(shorthand?: Shorthand): shorthand is ExtractSlotProps<Shorthand>;

@@ -443,2 +445,17 @@ /**

/**
* @deprecated
*
* on the new API, the `ComponentState` expects to be used together with `slot.always` or `slot.optional` to define the slot's declaration on the state. Those methods ensure that the slot is properly defined.
*
* This is not true for the legacy API, where the slots are defined directly on the state object. This type is used to define the state object for the legacy API.
*/
export declare type LegacyComponentState<Slots extends SlotPropsRecord> = {
components: {
[Key in keyof Slots]-?: React_2.ComponentType<WithoutSlotRenderFunction<ExtractSlotProps<Slots[Key]>>> | (ExtractSlotProps<Slots[Key]> extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements);
};
} & {
[Key in keyof Slots]: ReplaceNullWithUndefined<Exclude<Slots[Key], SlotShorthandValue | (Key extends 'root' ? null : never)>>;
};
/**
* @internal

@@ -525,3 +542,3 @@ * Combine two event callbacks into a single callback function that calls each one in order.

*/
declare function optional<Props extends UnknownSlotProps>(value: Props | SlotShorthandValue | undefined | null, options: {
declare function optional<Props extends SlotPropsDataType>(value: Props | SlotShorthandValue | undefined | null, options: {
renderByDefault?: boolean;

@@ -602,3 +619,3 @@ } & SlotOptions<Props>): SlotComponentType<Props> | undefined;

*/
declare function resolveShorthand_2<Props extends UnknownSlotProps | null | undefined>(value: Props | SlotShorthandValue): Props;
declare function resolveShorthand_2<Props extends SlotPropsDataType | null | undefined>(value: Props | SlotShorthandValue): Props;

@@ -685,9 +702,7 @@ /**

*/
export declare type Slot<Type extends keyof JSX.IntrinsicElements | React_2.ComponentType | React_2.VoidFunctionComponent | UnknownSlotProps, AlternateAs extends keyof JSX.IntrinsicElements = never> = IsSingleton<Extract<Type, string>> extends true ? WithSlotShorthandValue<Type extends keyof JSX.IntrinsicElements ? {
export declare type Slot<Type extends keyof JSX.IntrinsicElements | React_2.ComponentType<any> | SlotPropsDataType, AlternateAs extends keyof JSX.IntrinsicElements = never> = IsSingleton<Extract<Type, string>> extends true ? WithSlotShorthandValue<Type extends keyof JSX.IntrinsicElements ? {
as?: Type;
} & WithSlotRenderFunction<IntrinsicElementProps<Type>> : Type extends React_2.ComponentType<infer Props> ? WithSlotRenderFunction<Props> : Type> | {
[As in AlternateAs]: {
as: As;
} & WithSlotRenderFunction<IntrinsicElementProps<As>>;
}[AlternateAs] | null : 'Error: First parameter to Slot must not be not a union of types. See documentation of Slot type.';
} & WithSlotRenderFunction<IntrinsicElementProps<Type>> : Type extends React_2.ComponentType<infer Props> ? Props extends SlotPropsDataType ? Props : WithSlotRenderFunction<Props> : Type> | (AlternateAs extends unknown ? {
as: AlternateAs;
} & WithSlotRenderFunction<IntrinsicElementProps<AlternateAs>> : never) | null : 'Error: First parameter to Slot must not be not a union of types. See documentation of Slot type.';

@@ -731,3 +746,3 @@ declare namespace slot {

*/
export declare type SlotComponentType<Props extends UnknownSlotProps> = Props & {
export declare type SlotComponentType<Props extends SlotPropsDataType> = WithoutSlotRenderFunction<Props> & {
/**

@@ -747,3 +762,3 @@ * **NOTE**: Slot components are not callable.

export declare type SlotOptions<Props extends UnknownSlotProps> = {
export declare type SlotOptions<Props extends SlotPropsDataType> = {
elementType: React_2.ComponentType<Props> | (Props extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements);

@@ -753,2 +768,7 @@ defaultProps?: Partial<Props>;

export declare type SlotPropsDataType = {
as?: keyof JSX.IntrinsicElements;
children?: any;
};
/**

@@ -760,3 +780,3 @@ * Matches any component's Slots type (such as ButtonSlots).

*/
export declare type SlotPropsRecord = Record<string, UnknownSlotProps | SlotShorthandValue | null | undefined>;
export declare type SlotPropsRecord = Record<string, SlotPropsDataType | SlotShorthandValue | null | undefined>;

@@ -775,3 +795,3 @@ export declare type SlotRenderFunction<Props> = (Component: React_2.ElementType<Props>, props: Omit<Props, 'as'>) => React_2.ReactNode;

*/
export declare type SlotShorthandValue = React_2.ReactChild | React_2.ReactNode[] | React_2.ReactPortal;
export declare type SlotShorthandValue = React_2.ReactElement | string | number | Iterable<React_2.ReactNode> | React_2.ReactPortal;

@@ -806,2 +826,3 @@ /**

/**
* @deprecated - SlotPropsDataType instead
* Matches any slot props type.

@@ -1011,2 +1032,6 @@ *

declare type WithoutSlotRenderFunction<Props> = Props extends unknown ? 'children' extends keyof Props ? Omit<Props, 'children'> & {
children?: Exclude<Props['children'], Function>;
} : Props : never;
/**

@@ -1016,6 +1041,4 @@ * Helper type for {@link Slot}. Takes the props we want to support for a slot and adds the ability for `children`

*/
declare type WithSlotRenderFunction<Props> = Props & {
children?: (Props extends {
children?: unknown;
} ? Props['children'] : never) | SlotRenderFunction<Props>;
declare type WithSlotRenderFunction<Props> = Omit<Props, 'children'> & {
children?: ('children' extends keyof Props ? Props['children'] : never) | SlotRenderFunction<Props>;
};

@@ -1022,0 +1045,0 @@

@@ -56,2 +56,3 @@ "use strict";

const shouldOmitAsProp = typeof slot === 'string' && asProp;
// eslint-disable-next-line deprecation/deprecation
const slotProps = shouldOmitAsProp ? (0, _omit.omit)(props, [

@@ -58,0 +59,0 @@ 'as'

@@ -46,2 +46,3 @@ "use strict";

const shouldOmitAsProp = typeof slot === 'string' && asProp;
// eslint-disable-next-line deprecation/deprecation
const slotProps = shouldOmitAsProp ? propsWithoutAs : props;

@@ -48,0 +49,0 @@ return [

@@ -51,3 +51,3 @@ "use strict";

function resolveShorthand(value) {
if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || // eslint-disable-next-line @typescript-eslint/no-explicit-any
if (typeof value === 'string' || typeof value === 'number' || isIterable(value) || // eslint-disable-next-line @typescript-eslint/no-explicit-any
/*#__PURE__*/ _react.isValidElement(value)) {

@@ -68,1 +68,2 @@ return {

}
const isIterable = (value)=>typeof value === 'object' && value !== null && Symbol.iterator in value;

@@ -17,12 +17,2 @@ "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(()=>{

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

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

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

@@ -23,3 +23,4 @@ import * as React from 'react';

* @returns An object containing the `slots` map and `slotProps` map.
*/ export function getSlots(state) {
*/ export function getSlots(// eslint-disable-next-line deprecation/deprecation
state) {
// eslint-disable-next-line deprecation/deprecation

@@ -41,3 +42,4 @@ const slots = {};

}
function getSlot(state, slotName) {
function getSlot(// eslint-disable-next-line deprecation/deprecation
state, slotName) {
var _state_components, _state_components1;

@@ -65,2 +67,3 @@ const props = state[slotName];

const shouldOmitAsProp = typeof slot === 'string' && asProp;
// eslint-disable-next-line deprecation/deprecation
const slotProps = shouldOmitAsProp ? omit(props, [

@@ -67,0 +70,0 @@ 'as'

@@ -11,3 +11,4 @@ import * as React from 'react';

* @deprecated use slot.always or slot.optional combined with assertSlots instead
*/ export function getSlotsNext(state) {
*/ export function getSlotsNext(// eslint-disable-next-line deprecation/deprecation
state) {
// eslint-disable-next-line deprecation/deprecation

@@ -32,3 +33,4 @@ const slots = {};

* @deprecated use slot.always or slot.optional combined with assertSlots instead
*/ function getSlotNext(state, slotName) {
*/ function getSlotNext(// eslint-disable-next-line deprecation/deprecation
state, slotName) {
var _state_components, _state_components1;

@@ -46,2 +48,3 @@ const props = state[slotName];

const shouldOmitAsProp = typeof slot === 'string' && asProp;
// eslint-disable-next-line deprecation/deprecation
const slotProps = shouldOmitAsProp ? propsWithoutAs : props;

@@ -48,0 +51,0 @@ return [

@@ -11,3 +11,4 @@ import * as slot from '../slot';

*/ // eslint-disable-next-line deprecation/deprecation
export const resolveShorthand = (value, options)=>slot.optional(value, {
export const resolveShorthand = (value, options)=>// eslint-disable-next-line deprecation/deprecation
slot.optional(value, {
...options,

@@ -14,0 +15,0 @@ renderByDefault: options === null || options === void 0 ? void 0 : options.required,

@@ -52,3 +52,3 @@ import * as React from 'react';

*/ export function resolveShorthand(value) {
if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || // eslint-disable-next-line @typescript-eslint/no-explicit-any
if (typeof value === 'string' || typeof value === 'number' || isIterable(value) || // eslint-disable-next-line @typescript-eslint/no-explicit-any
React.isValidElement(value)) {

@@ -69,1 +69,2 @@ return {

}
const isIterable = (value)=>typeof value === 'object' && value !== null && Symbol.iterator in value;

@@ -22,12 +22,2 @@ 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(()=>{

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

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

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

{
"name": "@fluentui/react-utilities",
"version": "0.0.0-nightly-20240606-0405.1",
"version": "0.0.0-nightly-20240606-0726.1",
"description": "A set of general React-specific utilities.",

@@ -34,4 +34,4 @@ "main": "lib-commonjs/index.js",

"dependencies": {
"@fluentui/keyboard-keys": "0.0.0-nightly-20240606-0405.1",
"@fluentui/react-shared-contexts": "0.0.0-nightly-20240606-0405.1",
"@fluentui/keyboard-keys": "0.0.0-nightly-20240606-0726.1",
"@fluentui/react-shared-contexts": "0.0.0-nightly-20240606-0726.1",
"@swc/helpers": "^0.5.1"

@@ -38,0 +38,0 @@ },

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

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

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