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

@fluentui/react-utilities

Package Overview
Dependencies
Maintainers
13
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 0.0.0-nightlyc0273fdc6920211123.1 to 0.0.0-nightlyc0e3a0a1f320220217.1

lib-commonjs/hooks/useMergedEventCallbacks.d.ts

148

CHANGELOG.json

@@ -5,5 +5,5 @@ {

{
"date": "Tue, 23 Nov 2021 04:19:32 GMT",
"tag": "@fluentui/react-utilities_v0.0.0-nightlyc0273fdc6920211123.1",
"version": "0.0.0-nightlyc0273fdc6920211123.1",
"date": "Thu, 17 Feb 2022 04:12:42 GMT",
"tag": "@fluentui/react-utilities_v0.0.0-nightlyc0e3a0a1f320220217.1",
"version": "0.0.0-nightlyc0e3a0a1f320220217.1",
"comments": {

@@ -14,3 +14,3 @@ "prerelease": [

"package": "@fluentui/react-utilities",
"commit": "ecb84838dc29fe424995bfc3c2983d3cd335936e",
"commit": "4df2a77ff1d0255eee60fa6109174a7cb44dcbe6",
"comment": "Release nightly v9"

@@ -21,4 +21,4 @@ },

"package": "@fluentui/react-utilities",
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightlyc0273fdc6920211123.1",
"commit": "ecb84838dc29fe424995bfc3c2983d3cd335936e"
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightlyc0e3a0a1f320220217.1",
"commit": "4df2a77ff1d0255eee60fa6109174a7cb44dcbe6"
}

@@ -29,2 +29,138 @@ ]

{
"date": "Thu, 10 Feb 2022 08:50:32 GMT",
"tag": "@fluentui/react-utilities_v9.0.0-rc.1",
"version": "9.0.0-rc.1",
"comments": {
"prerelease": [
{
"author": "behowell@microsoft.com",
"package": "@fluentui/react-utilities",
"commit": "317209bb5cd57c40f35bc42060acb7e3cce5ec95",
"comment": "Rename component hooks add the suffix _unstable, as their API has not been finalized yet"
},
{
"author": "behowell@microsoft.com",
"package": "@fluentui/react-utilities",
"commit": "7cc28ed8320b00f42d91c63882f10316db2205c5",
"comment": "getSlots: remove slotNames param, and infer from state.components instead"
},
{
"author": "olfedias@microsoft.com",
"package": "@fluentui/react-utilities",
"commit": "d2eb57808a403b70845a732a62b55aa64d66b2a0",
"comment": "add useTriggerElement() hook"
},
{
"author": "bsunderhus@microsoft.com",
"package": "@fluentui/react-utilities",
"commit": "c0d4e63ee58e60e2c6674efbacc0783cd520984e",
"comment": "Removes nullRender from react-utilities"
},
{
"author": "olfedias@microsoft.com",
"package": "@fluentui/react-utilities",
"commit": "aa6cfd8ac825b5a280206808101de549a91094fc",
"comment": "update applyTriggerPropsToChildren() to return React.ReactElement or null"
},
{
"author": "behowell@microsoft.com",
"package": "@fluentui/react-utilities",
"commit": "53b01d71e335715fda91b33e3d7bbd9d471d5ed3",
"comment": "Refactor component Slot typings"
},
{
"author": "Humberto.Morimoto@microsoft.com",
"package": "@fluentui/react-utilities",
"commit": "0bc161458eae5ae8d387172430496ce9829b1bb1",
"comment": "Adding ComponentSlotProps to allow ref to be passed in composite components."
},
{
"author": "Humberto.Morimoto@microsoft.com",
"package": "@fluentui/react-utilities",
"commit": "e0b8e1fa6980077e7b311fd1c72c28d3e4305db0",
"comment": "Renaming most *Shorthand* composition types to *SlotProps* so they better reflect what the types do."
},
{
"author": "lingfangao@hotmail.com",
"package": "@fluentui/react-utilities",
"commit": "c00913d50e2dd15bbfbb0757cefe43b192ff1d7f",
"comment": "Bump Fluent UI packages to 9.0.0-rc"
},
{
"author": "behowell@microsoft.com",
"package": "@fluentui/react-utilities",
"commit": "f30e7585a8d2abd9db06c4076f39a779008b0eca",
"comment": "Update trigger utilities to handle nested triggers"
},
{
"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 v9.0.0-rc.1",
"commit": "e6c855f6d9019d6c73668d15fc9bc3a13291a6c8"
}
],
"none": [
{
"author": "elcraig@microsoft.com",
"package": "@fluentui/react-utilities",
"commit": "3360b45ec159250b1346c91afad7dce138e6bc20",
"comment": "Update API file to version generated by typescript 4.3"
},
{
"author": "olfedias@microsoft.com",
"package": "@fluentui/react-utilities",
"commit": "c061e98be4b4a718c72a144a1f60bb5515824612",
"comment": "remove inline-style-expand-shorthand from tsconfigs"
},
{
"author": "martinhochel@microsoft.com",
"package": "@fluentui/react-utilities",
"commit": "8dfa712156b70414205b87b5b6d099367b0c297d",
"comment": "chore: use storybook runner for all vNext packages"
},
{
"author": "seanmonahan@microsoft.com",
"package": "@fluentui/react-utilities",
"commit": "6404bef16cebf1f67b9b80a9f6d5f605f9873df1",
"comment": "Update getSlots() docs."
},
{
"author": "lingfangao@hotmail.com",
"package": "@fluentui/react-utilities",
"commit": "a4e048a0e03ddd676670da516e3a6612b26ea500",
"comment": "chore: Remove enzyme from react-utilities tests"
}
]
}
},
{
"date": "Thu, 25 Nov 2021 08:34:09 GMT",
"tag": "@fluentui/react-utilities_v9.0.0-beta.4",
"version": "9.0.0-beta.4",
"comments": {
"none": [
{
"author": "lingfangao@hotmail.com",
"package": "@fluentui/react-utilities",
"commit": "718e63006d8d07d24efab9c32942041963d78dc7",
"comment": "Migrate package to use solution style ts-configs"
}
],
"prerelease": [
{
"author": "behowell@microsoft.com",
"package": "@fluentui/react-utilities",
"commit": "99adff5a9aab9086e8bc4737040654ab23f0febe",
"comment": "Update utility types to support specifying a primary slot other than root"
}
]
}
},
{
"date": "Fri, 12 Nov 2021 13:25:10 GMT",

@@ -31,0 +167,0 @@ "tag": "@fluentui/react-utilities_v9.0.0-beta.3",

# Change Log - @fluentui/react-utilities
This log was last generated on Tue, 23 Nov 2021 04:19:32 GMT and should not be manually modified.
This log was last generated on Thu, 17 Feb 2022 04:12:42 GMT and should not be manually modified.
<!-- Start content -->
## [0.0.0-nightlyc0273fdc6920211123.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v0.0.0-nightlyc0273fdc6920211123.1)
## [0.0.0-nightlyc0e3a0a1f320220217.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v0.0.0-nightlyc0e3a0a1f320220217.1)
Tue, 23 Nov 2021 04:19:32 GMT
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-beta.3..@fluentui/react-utilities_v0.0.0-nightlyc0273fdc6920211123.1)
Thu, 17 Feb 2022 04:12:42 GMT
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-rc.1..@fluentui/react-utilities_v0.0.0-nightlyc0e3a0a1f320220217.1)
### Changes
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/ecb84838dc29fe424995bfc3c2983d3cd335936e) by email not defined)
- Bump @fluentui/keyboard-keys to v0.0.0-nightlyc0273fdc6920211123.1 ([commit](https://github.com/microsoft/fluentui/commit/ecb84838dc29fe424995bfc3c2983d3cd335936e) by beachball)
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/4df2a77ff1d0255eee60fa6109174a7cb44dcbe6) by email not defined)
- Bump @fluentui/keyboard-keys to v0.0.0-nightlyc0e3a0a1f320220217.1 ([commit](https://github.com/microsoft/fluentui/commit/4df2a77ff1d0255eee60fa6109174a7cb44dcbe6) by beachball)
## [9.0.0-rc.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-rc.1)
Thu, 10 Feb 2022 08:50:32 GMT
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-beta.4..@fluentui/react-utilities_v9.0.0-rc.1)
### Changes
- Rename component hooks add the suffix _unstable, as their API has not been finalized yet ([PR #21365](https://github.com/microsoft/fluentui/pull/21365) by behowell@microsoft.com)
- getSlots: remove slotNames param, and infer from state.components instead ([PR #21134](https://github.com/microsoft/fluentui/pull/21134) by behowell@microsoft.com)
- add useTriggerElement() hook ([PR #21225](https://github.com/microsoft/fluentui/pull/21225) by olfedias@microsoft.com)
- Removes nullRender from react-utilities ([PR #21576](https://github.com/microsoft/fluentui/pull/21576) by bsunderhus@microsoft.com)
- update applyTriggerPropsToChildren() to return React.ReactElement or null ([PR #21609](https://github.com/microsoft/fluentui/pull/21609) by olfedias@microsoft.com)
- Refactor component Slot typings ([PR #21518](https://github.com/microsoft/fluentui/pull/21518) by behowell@microsoft.com)
- Adding ComponentSlotProps to allow ref to be passed in composite components. ([PR #20890](https://github.com/microsoft/fluentui/pull/20890) by Humberto.Morimoto@microsoft.com)
- Renaming most *Shorthand* composition types to *SlotProps* so they better reflect what the types do. ([PR #20891](https://github.com/microsoft/fluentui/pull/20891) by Humberto.Morimoto@microsoft.com)
- Bump Fluent UI packages to 9.0.0-rc ([PR #21623](https://github.com/microsoft/fluentui/pull/21623) by lingfangao@hotmail.com)
- Update trigger utilities to handle nested triggers ([PR #21495](https://github.com/microsoft/fluentui/pull/21495) by behowell@microsoft.com)
- [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 v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-beta.4)
Thu, 25 Nov 2021 08:34:09 GMT
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-beta.3..@fluentui/react-utilities_v9.0.0-beta.4)
### Changes
- Update utility types to support specifying a primary slot other than root ([PR #20617](https://github.com/microsoft/fluentui/pull/20617) by behowell@microsoft.com)
## [9.0.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-beta.3)

@@ -18,0 +47,0 @@

337

dist/react-utilities.d.ts

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

*/
export declare const applyTriggerPropsToChildren: <TTriggerProps>(children: React_2.ReactElement<any, string | ((props: any) => React_2.ReactElement<any, string | any | (new (props: any) => React_2.Component<any, any, any>)> | null) | (new (props: any) => React_2.Component<any, any, any>)> | ((props: TTriggerProps) => React_2.ReactNode) | null | undefined, triggerProps: TTriggerProps) => React_2.ReactNode;
export declare const applyTriggerPropsToChildren: <TTriggerProps>(children: React_2.ReactElement<any, string | React_2.JSXElementConstructor<any>> | ((props: TTriggerProps) => React_2.ReactElement | null) | null | undefined, triggerProps: TTriggerProps) => React_2.ReactElement | null;

@@ -62,4 +62,2 @@ /**

export declare type ChangeCallback<TElement extends HTMLElement, TValue, TEvent extends React_2.SyntheticEvent<TElement> | undefined> = (ev: TEvent, newValue: TValue | undefined) => void;
/**

@@ -78,22 +76,18 @@ * Clamps `value` to a number between the min and max.

export declare type ComponentProps<Shorthands extends ObjectShorthandPropsRecord, Primary extends keyof Shorthands = 'root'> = Omit<{
[Key in keyof Shorthands]?: ShorthandProps<NonNullable<Shorthands[Key]>>;
}, Primary> & PropsWithoutRef<Shorthands[Primary]>;
/**
* Defines the Props type for a component given its slots and the definition of which one is the primary slot,
* defaulting to root if one is not provided.
*/
export declare type ComponentProps<Slots extends SlotPropsRecord, Primary extends keyof Slots = 'root'> = Omit<Slots, Primary & 'root'> & PropsWithoutRef<ExtractSlotProps<Slots[Primary]>>;
export declare type ComponentState<Shorthands extends ObjectShorthandPropsRecord> = {
components?: {
[Key in keyof Shorthands]-?: React_2.ComponentType<NonNullable<Shorthands[Key]> extends ObjectShorthandProps<infer P> ? P : NonNullable<Shorthands[Key]>> | (NonNullable<Shorthands[Key]> extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements);
};
} & Shorthands;
/**
* Matches any shorthand props type.
*
* This should ONLY be used in type templates as in `extends DefaultObjectShorthandProps`;
* it shouldn't be used as the type of a slot.
* Defines the State object of a component given its slots.
*/
export declare type DefaultObjectShorthandProps = ObjectShorthandProps<{
children?: React_2.ReactNode;
as?: keyof JSX.IntrinsicElements;
}>;
export declare type ComponentState<Slots extends SlotPropsRecord> = {
components: {
[Key in keyof Slots]-?: React_2.ComponentType<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)>>;
};

@@ -108,7 +102,2 @@ /**

/**
* Default value can be a value or an initializer
*/
declare type DefaultValue<TValue> = TValue | (() => TValue);
/**
* An array of DIV tag properties and events.

@@ -121,2 +110,31 @@ *

/**
* HTML element types that are not allowed to have children.
*
* Reference: https://developer.mozilla.org/en-US/docs/Glossary/Empty_element
*/
declare type EmptyIntrisicElements = 'area' | 'base' | 'br' | 'col' | 'embed' | 'hr' | 'img' | 'input' | 'link' | 'meta' | 'param' | 'source' | 'track' | 'wbr';
/**
* Removes SlotShorthandValue and null from the slot type, extracting just the slot's Props object.
*/
export declare type ExtractSlotProps<S> = Exclude<S, SlotShorthandValue | null | undefined>;
/**
* Allows a component to be tagged as a FluentUI trigger component.
*
* Triggers are special-case components: they attach event listeners and other props on their child,
* and use them to trigger another component to show. Examples include `MenuTrigger` and `Tooltip`.
*
* A component can be tagged as a trigger as follows:
* ```ts
* const MyComponent: React.FC<MyComponentProps> & FluentTriggerComponent = ...;
*
* MyComponent.isFluentTriggerComponent = true; // MUST also set this to true
* ```
*/
export declare type FluentTriggerComponent = {
isFluentTriggerComponent?: boolean;
};
/**
* An array of FORM tag properties and events.

@@ -159,2 +177,25 @@ *

/**
* Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
*
* This function is only for use with components that have a primary slot other than `root`.
* Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.
*
* @returns An object containing the native props for the `root` and primary slots.
*/
export declare const getPartitionedNativeProps: <Props extends Pick<React_2.HTMLAttributes<HTMLElement>, "style" | "className">, ExcludedPropKeys extends Extract<keyof Props, string> = never>({ primarySlotTagName, props, excludedPropNames, }: {
/** The primary slot's element type (e.g. 'div') */
primarySlotTagName: keyof JSX.IntrinsicElements;
/** The component's props object */
props: Props;
/** List of native props to exclude from the returned value */
excludedPropNames?: ExcludedPropKeys[] | undefined;
}) => {
root: {
style: React_2.CSSProperties | undefined;
className: string | undefined;
};
primary: Omit<Props, ExcludedPropKeys>;
};
/**
* Finds and swaps a provided key for it's right to left format.

@@ -173,15 +214,38 @@ */

* The slotProps will always omit the `as` prop within them, and for slots that are string
* primitives, the props will be filtered according the the slot type. For example, if the
* slot is rendered `as: 'a'`, the props will be filtered for acceptable anchor props.
* primitives, the props will be filtered according to the slot type by the type system.
* For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable
* anchor props. Note that this is only enforced at build time by Typescript -- there is no
* runtime code filtering props in this function.
*
* @param state - State including slot definitions
* @param slotNames - Name of which props are slots
* @returns An object containing the `slots` map and `slotProps` map.
*/
export declare function getSlots<R extends ObjectShorthandPropsRecord>(state: ComponentState<R>, slotNames?: (keyof R)[]): {
export declare function getSlots<R extends SlotPropsRecord>(state: ComponentState<R>): {
slots: Slots<R>;
slotProps: SlotProps<R>;
slotProps: ObjectSlotProps<R>;
};
/**
* Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).
*
* In the case where the immediate child is itself a FluentTriggerComponent and/or React Fragment,
* it returns the first descendant that is _not_ a FluentTriggerComponent or Fragment.
* This allows multiple triggers to be stacked, and still apply their props to the actual trigger element.
*
* For example, the following returns `<div id="child" />`:
* ```jsx
* getTriggerChild(
* <Tooltip>
* <MenuTrigger>
* <div id="child" />
* </MenuTrigger>
* </Tooltip>
* );
* ```
*/
export declare const getTriggerChild: (children: React_2.ReactNode) => React_2.ReactElement & {
ref?: React_2.Ref<unknown>;
};
/**
* An array of HTML element properties and events.

@@ -220,23 +284,17 @@ *

/**
* Define the slot arguments for a slot that supports one or more intrinsic element types, such as 'div'.
* For slots that support custom components, use {@link ObjectShorthandProps} instead.
*
* The first param is the slot's default type if no `as` prop is specified.
* The second param is an optional union of alternative types that can be specified for the `as` prop.
*
* ```
* IntrinsicShorthandProps<'div'> // Slot is always div
* IntrinsicShorthandProps<'button', 'a'> // Defaults to button, but allows as="a" with anchor-specific props
* IntrinsicShorthandProps<'label', 'span' | 'div'>; // Defaults to label, but allows as="span" or as="div"
* ```
* Helper type for {@link Slot}. Modifies `JSX.IntrinsicElements[Type]`:
* * Removes legacy string ref.
* * Disallows children for empty tags like 'img'.
*/
export declare type IntrinsicShorthandProps<DefaultAs extends keyof JSX.IntrinsicElements, AlternateAs extends keyof JSX.IntrinsicElements = never> = IsSingleton<DefaultAs> extends false ? 'Error: first parameter to IntrinsicShorthandProps must be a single element type, not a union of types' : ({
as?: DefaultAs;
} & ObjectShorthandProps<React_2.PropsWithRef<JSX.IntrinsicElements[DefaultAs]>>) | {
[As in AlternateAs]: {
as: As;
} & ObjectShorthandProps<React_2.PropsWithRef<JSX.IntrinsicElements[As]>>;
}[AlternateAs];
declare type IntrisicElementProps<Type extends keyof JSX.IntrinsicElements> = React_2.PropsWithRef<JSX.IntrinsicElements[Type]> & (Type extends EmptyIntrisicElements ? {
children?: never;
} : {});
/**
* Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).
* See the {@link FluentTriggerComponent} type for more info.
*/
export declare const isFluentTrigger: (element: React_2.ReactElement) => boolean | undefined;
/**
* Evaluates to true if the given type contains exactly one string, or false if it is a union of strings.

@@ -267,20 +325,6 @@ *

/**
* Simple constant function for returning null, used to render empty templates in JSX.
*/
export declare const nullRender: () => null;
/**
* Defines the slot props for a slot that supports a Component type.
*
* For intrinsic elements like 'div', use {@link IntrinsicShorthandProps} instead.
*/
export declare type ObjectShorthandProps<Props extends {
children?: React_2.ReactNode;
} = {}> = Props & {
children?: Props['children'] | ShorthandRenderFunction<Props>;
declare type ObjectSlotProps<S extends SlotPropsRecord> = {
[K in keyof S]-?: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As> ? UnionToIntersection<JSX.IntrinsicElements[As]> : ExtractSlotProps<S[K]> extends React_2.ComponentType<infer P> ? P : never;
};
export declare type ObjectShorthandPropsRecord = Record<string, DefaultObjectShorthandProps | undefined>;
/**

@@ -322,7 +366,2 @@ * This is part of a hack to infer the element type from a native element *props* type.

/**
* Similar to React.Children.only, but drills into fragments rather than treating them as a single child
*/
export declare const onlyChild: <P>(child: string | number | boolean | {} | React_2.ReactNodeArray | React_2.ReactPortal | React_2.ReactElement<P, string | ((props: any) => React_2.ReactElement<any, string | any | (new (props: any) => React_2.Component<any, any, any>)> | null) | (new (props: any) => React_2.Component<any, any, any>)> | null | undefined) => React_2.ReactElement<P, string | ((props: any) => React_2.ReactElement<any, string | any | (new (props: any) => React_2.Component<any, any, any>)> | null) | (new (props: any) => React_2.Component<any, any, any>)>;
export declare const optionProperties: Record<string, number>;

@@ -332,3 +371,3 @@

* Removes the 'ref' prop from the given Props type, leaving unions intact (such as the discriminated union created by
* IntrinsicShorthandProps). This allows IntrinsicShorthandProps to be used with React.forwardRef.
* IntrinsicSlotProps). This allows IntrinsicSlotProps to be used with React.forwardRef.
*

@@ -347,2 +386,7 @@ * The conditional "extends unknown" (always true) exploits a quirk in the way TypeScript handles conditional

/**
* If type T includes `null`, remove it and add `undefined` instead.
*/
export declare type ReplaceNullWithUndefined<T> = T extends null ? Exclude<T, null> | undefined : T;
/**
* Resets generated IDs, should be used only in tests.

@@ -355,10 +399,15 @@ *

/**
* Resolves ShorthandProps into ObjectShorthandProps, to ensure normalization of the signature
* Resolves shorthands into slot props, to ensure normalization of the signature
* being passed down to getSlots method
* @param value - the base ShorthandProps
* @param options - options to resolve ShorthandProps
* @param value - the base shorthand props
* @param options - options to resolve shorthand props
*/
export declare function resolveShorthand<Props extends DefaultObjectShorthandProps, Required extends boolean = false>(value: ShorthandProps<Props>, options?: ResolveShorthandOptions<Props, Required>): Required extends false ? Props | undefined : Props;
export declare const resolveShorthand: ResolveShorthandFunction;
export declare type ResolveShorthandOptions<Props extends Record<string, any>, Required extends boolean = false> = {
export declare type ResolveShorthandFunction<Props extends UnknownSlotProps = UnknownSlotProps> = {
<P extends Props | null>(value: P | SlotShorthandValue | undefined, options?: ResolveShorthandOptions<P, true>): ReplaceNullWithUndefined<P>;
<P extends Props | null>(value: P | SlotShorthandValue | undefined, options?: ResolveShorthandOptions<P, boolean>): ReplaceNullWithUndefined<P> | undefined;
};
export declare type ResolveShorthandOptions<Props, Required extends boolean = false> = {
required?: Required;

@@ -375,6 +424,2 @@ defaultProps?: Props;

export declare type ShorthandProps<Props extends DefaultObjectShorthandProps> = React_2.ReactChild | React_2.ReactNodeArray | React_2.ReactPortal | number | null | undefined | Props;
export declare type ShorthandRenderFunction<Props> = (Component: React_2.ElementType<Props>, props: Omit<Props, 'children' | 'as'>) => React_2.ReactNode;
/**

@@ -387,10 +432,51 @@ * Checks if the keyboard event should preventDefault() for Enter and Spacebar keys

declare type SlotProps<S extends ObjectShorthandPropsRecord> = {
[K in keyof S]-?: NonNullable<S[K]> extends AsIntrinsicElement<infer As> ? UnionToIntersection<JSX.IntrinsicElements[As]> : NonNullable<S[K]> extends ObjectShorthandProps<infer P> ? P : never;
};
/**
* The props type and shorthand value for a slot. Type is either a single intrinsic element like `'div'`,
* or a component like `typeof Button`.
*
* If a slot needs to support multiple intrinsic element types, use the `AlternateAs` param (see examples below).
*
* By default, slots can be set to `null` to prevent them from being rendered. If a slot must always be rendered,
* wrap with `NonNullable` (see examples below).
*
* @example
* ```
* // Intrinsic element examples:
* Slot<'div'> // Slot is always div
* Slot<'button', 'a'> // Defaults to button, but allows as="a" with anchor-specific props
* Slot<'span', 'div' | 'pre'> // Defaults to span, but allows as="div" or as="pre"
* NonNullable<Slot<'div'>> // Slot that will always be rendered (can't be set to null by the user)
*
* // Component examples:
* Slot<typeof Button> // Slot is always a Button, and accepts all of Button's Props
* NonNullable<Slot<typeof Label>> // Slot is a Label and will always be rendered (can't be set to null by the user)
* ```
*/
export declare type Slot<Type extends keyof JSX.IntrinsicElements | React_2.ComponentType | UnknownSlotProps, AlternateAs extends keyof JSX.IntrinsicElements = never> = IsSingleton<Extract<Type, string>> extends true ? WithSlotShorthandValue<Type extends keyof JSX.IntrinsicElements ? {
as?: Type;
} & WithSlotRenderFunction<IntrisicElementProps<Type>> : Type extends React_2.ComponentType<infer Props> ? WithSlotRenderFunction<Props> : Type> | {
[As in AlternateAs]: {
as: As;
} & WithSlotRenderFunction<IntrisicElementProps<As>>;
}[AlternateAs] | null : 'Error: First parameter to Slot must not be not a union of types. See documentation of Slot type.';
export declare type Slots<S extends ObjectShorthandPropsRecord> = {
[K in keyof S]-?: NonNullable<S[K]> extends AsIntrinsicElement<infer As> ? As : S[K] extends ObjectShorthandProps<infer P> ? React_2.ElementType<NonNullable<P>> : React_2.ElementType<NonNullable<S[K]>>;
/**
* Matches any component's Slots type (such as ButtonSlots).
*
* This should ONLY be used in type templates as in `extends SlotPropsRecord`;
* it shouldn't be used as a component's Slots type.
*/
export declare type SlotPropsRecord = Record<string, UnknownSlotProps | SlotShorthandValue | null | undefined>;
export declare type SlotRenderFunction<Props> = (Component: React_2.ElementType<Props>, props: Omit<Props, 'children' | 'as'>) => React_2.ReactNode;
export declare type Slots<S extends SlotPropsRecord> = {
[K in keyof S]: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As> ? As : ExtractSlotProps<S[K]> extends React_2.ComponentType<infer P> ? React_2.ElementType<NonNullable<P>> : React_2.ElementType<ExtractSlotProps<S[K]>>;
};
/**
* The shorthand value of a slot allows specifying its child
*/
export declare type SlotShorthandValue = React_2.ReactChild | React_2.ReactNodeArray | React_2.ReactPortal;
export declare const SSRContext: React_2.Context<SSRContextValue>;

@@ -457,2 +543,12 @@

/**
* Matches any slot props type.
*
* This should ONLY be used in type templates as in `extends UnknownSlotProps`;
* it shouldn't be used as the type of a slot.
*/
export declare type UnknownSlotProps = Pick<React_2.HTMLAttributes<HTMLElement>, 'children' | 'className' | 'style'> & {
as?: keyof JSX.IntrinsicElements;
};
/**
* Hook to store a value and generate callbacks for setting the value to true or false.

@@ -490,5 +586,14 @@ * The identity of the callbacks will always stay the same.

/**
* 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
*/

@@ -499,11 +604,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.
*/

@@ -514,17 +620,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

@@ -588,2 +679,21 @@ *

/**
* Combine two event callbacks into a single callback function that calls each one in order.
*
* This is useful to add an event listener to an existing element without overwriting the current listener, if any.
*
* For example:
* ```ts
* state.slot.onChange = useMergedCallbacks(state.slot.onChange, ev => {
* // Handle onChange
* });
* ```
*
* @param callback1 - The first callback to be called
* @param callback2 - The second callback to be called
*
* @returns An event callback that calls the callbacks in order, and is stable between renders
*/
export declare function useMergedEventCallbacks<Args extends unknown[]>(callback1: ((...args: Args) => void) | undefined, callback2: ((...args: Args) => void) | undefined): (...args: Args) => void;
/**
* React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that

@@ -668,2 +778,19 @@ * updates all provided refs

/**
* Helper type for {@link Slot}. Takes the props we want to support for a slot and adds the ability for `children`
* to be a render function that takes those props.
*/
declare type WithSlotRenderFunction<Props extends {
children?: unknown;
}> = Props & {
children?: Props['children'] | SlotRenderFunction<Props>;
};
/**
* Helper type for {@link Slot}. Adds shorthand types that are assignable to the slot's `children`.
*/
declare type WithSlotShorthandValue<Props extends {
children?: unknown;
}> = Props | Extract<SlotShorthandValue, Props['children']>;
export { }
import * as React from 'react';
import { AsIntrinsicElement, ComponentState, ObjectShorthandPropsRecord, ObjectShorthandProps, UnionToIntersection } from './types';
export declare type Slots<S extends ObjectShorthandPropsRecord> = {
[K in keyof S]-?: NonNullable<S[K]> extends AsIntrinsicElement<infer As> ? As : S[K] extends ObjectShorthandProps<infer P> ? React.ElementType<NonNullable<P>> : React.ElementType<NonNullable<S[K]>>;
import type { AsIntrinsicElement, ComponentState, ExtractSlotProps, SlotPropsRecord, UnionToIntersection } from './types';
export declare type Slots<S extends SlotPropsRecord> = {
[K in keyof S]: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As> ? As : ExtractSlotProps<S[K]> extends React.ComponentType<infer P> ? React.ElementType<NonNullable<P>> : React.ElementType<ExtractSlotProps<S[K]>>;
};
declare type SlotProps<S extends ObjectShorthandPropsRecord> = {
[K in keyof S]-?: NonNullable<S[K]> extends AsIntrinsicElement<infer As> ? UnionToIntersection<JSX.IntrinsicElements[As]> : NonNullable<S[K]> extends ObjectShorthandProps<infer P> ? P : never;
declare type ObjectSlotProps<S extends SlotPropsRecord> = {
[K in keyof S]-?: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As> ? UnionToIntersection<JSX.IntrinsicElements[As]> : ExtractSlotProps<S[K]> extends React.ComponentType<infer P> ? P : never;
};

@@ -18,13 +18,14 @@ /**

* The slotProps will always omit the `as` prop within them, and for slots that are string
* primitives, the props will be filtered according the the slot type. For example, if the
* slot is rendered `as: 'a'`, the props will be filtered for acceptable anchor props.
* primitives, the props will be filtered according to the slot type by the type system.
* For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable
* anchor props. Note that this is only enforced at build time by Typescript -- there is no
* runtime code filtering props in this function.
*
* @param state - State including slot definitions
* @param slotNames - Name of which props are slots
* @returns An object containing the `slots` map and `slotProps` map.
*/
export declare function getSlots<R extends ObjectShorthandPropsRecord>(state: ComponentState<R>, slotNames?: (keyof R)[]): {
export declare function getSlots<R extends SlotPropsRecord>(state: ComponentState<R>): {
slots: Slots<R>;
slotProps: SlotProps<R>;
slotProps: ObjectSlotProps<R>;
};
export {};

@@ -10,4 +10,2 @@ "use strict";

const nullRender_1 = /*#__PURE__*/require("./nullRender");
const omit_1 = /*#__PURE__*/require("../utils/omit");

@@ -23,7 +21,8 @@ /**

* The slotProps will always omit the `as` prop within them, and for slots that are string
* primitives, the props will be filtered according the the slot type. For example, if the
* slot is rendered `as: 'a'`, the props will be filtered for acceptable anchor props.
* primitives, the props will be filtered according to the slot type by the type system.
* For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable
* anchor props. Note that this is only enforced at build time by Typescript -- there is no
* runtime code filtering props in this function.
*
* @param state - State including slot definitions
* @param slotNames - Name of which props are slots
* @returns An object containing the `slots` map and `slotProps` map.

@@ -33,5 +32,6 @@ */

function getSlots(state, slotNames = ['root']) {
function getSlots(state) {
const slots = {};
const slotProps = {};
const slotNames = Object.keys(state.components);

@@ -56,3 +56,3 @@ for (const slotName of slotNames) {

if (state[slotName] === undefined) {
return [nullRender_1.nullRender, undefined];
return [null, undefined];
}

@@ -59,0 +59,0 @@

export * from './getSlots';
export * from './nullRender';
export * from './resolveShorthand';
export * from './types';

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

tslib_1.__exportStar(require("./nullRender"), exports);
tslib_1.__exportStar(require("./resolveShorthand"), exports);

@@ -15,0 +13,0 @@

@@ -1,12 +0,16 @@

import type { DefaultObjectShorthandProps, ShorthandProps } from './types';
export declare type ResolveShorthandOptions<Props extends Record<string, any>, Required extends boolean = false> = {
import type { ReplaceNullWithUndefined, SlotShorthandValue, UnknownSlotProps } from './types';
export declare type ResolveShorthandOptions<Props, Required extends boolean = false> = {
required?: Required;
defaultProps?: Props;
};
export declare type ResolveShorthandFunction<Props extends UnknownSlotProps = UnknownSlotProps> = {
<P extends Props | null>(value: P | SlotShorthandValue | undefined, options?: ResolveShorthandOptions<P, true>): ReplaceNullWithUndefined<P>;
<P extends Props | null>(value: P | SlotShorthandValue | undefined, options?: ResolveShorthandOptions<P, boolean>): ReplaceNullWithUndefined<P> | undefined;
};
/**
* Resolves ShorthandProps into ObjectShorthandProps, to ensure normalization of the signature
* Resolves shorthands into slot props, to ensure normalization of the signature
* being passed down to getSlots method
* @param value - the base ShorthandProps
* @param options - options to resolve ShorthandProps
* @param value - the base shorthand props
* @param options - options to resolve shorthand props
*/
export declare function resolveShorthand<Props extends DefaultObjectShorthandProps, Required extends boolean = false>(value: ShorthandProps<Props>, options?: ResolveShorthandOptions<Props, Required>): Required extends false ? Props | undefined : Props;
export declare const resolveShorthand: ResolveShorthandFunction;

@@ -10,10 +10,10 @@ "use strict";

/**
* Resolves ShorthandProps into ObjectShorthandProps, to ensure normalization of the signature
* Resolves shorthands into slot props, to ensure normalization of the signature
* being passed down to getSlots method
* @param value - the base ShorthandProps
* @param options - options to resolve ShorthandProps
* @param value - the base shorthand props
* @param options - options to resolve shorthand props
*/
function resolveShorthand(value, options) {
const resolveShorthand = (value, options) => {
const {

@@ -39,5 +39,5 @@ required = false,

} : resolvedShorthand;
}
};
exports.resolveShorthand = resolveShorthand;
//# sourceMappingURL=resolveShorthand.js.map
import * as React from 'react';
export declare type ShorthandRenderFunction<Props> = (Component: React.ElementType<Props>, props: Omit<Props, 'children' | 'as'>) => React.ReactNode;
export declare type ObjectShorthandPropsRecord = Record<string, DefaultObjectShorthandProps | undefined>;
export declare type ShorthandProps<Props extends DefaultObjectShorthandProps> = React.ReactChild | React.ReactNodeArray | React.ReactPortal | number | null | undefined | Props;
export declare type SlotRenderFunction<Props> = (Component: React.ElementType<Props>, props: Omit<Props, 'children' | 'as'>) => React.ReactNode;
/**
* Matches any shorthand props type.
* Matches any component's Slots type (such as ButtonSlots).
*
* This should ONLY be used in type templates as in `extends DefaultObjectShorthandProps`;
* This should ONLY be used in type templates as in `extends SlotPropsRecord`;
* it shouldn't be used as a component's Slots type.
*/
export declare type SlotPropsRecord = Record<string, UnknownSlotProps | SlotShorthandValue | null | undefined>;
/**
* The shorthand value of a slot allows specifying its child
*/
export declare type SlotShorthandValue = React.ReactChild | React.ReactNodeArray | React.ReactPortal;
/**
* Matches any slot props type.
*
* This should ONLY be used in type templates as in `extends UnknownSlotProps`;
* it shouldn't be used as the type of a slot.
*/
export declare type DefaultObjectShorthandProps = ObjectShorthandProps<{
children?: React.ReactNode;
export declare type UnknownSlotProps = Pick<React.HTMLAttributes<HTMLElement>, 'children' | 'className' | 'style'> & {
as?: keyof JSX.IntrinsicElements;
}>;
};
/**
* Defines the slot props for a slot that supports a Component type.
*
* For intrinsic elements like 'div', use {@link IntrinsicShorthandProps} instead.
* Helper type for {@link Slot}. Adds shorthand types that are assignable to the slot's `children`.
*/
export declare type ObjectShorthandProps<Props extends {
children?: React.ReactNode;
} = {}> = Props & {
children?: Props['children'] | ShorthandRenderFunction<Props>;
declare type WithSlotShorthandValue<Props extends {
children?: unknown;
}> = Props | Extract<SlotShorthandValue, Props['children']>;
/**
* Helper type for {@link Slot}. Takes the props we want to support for a slot and adds the ability for `children`
* to be a render function that takes those props.
*/
declare type WithSlotRenderFunction<Props extends {
children?: unknown;
}> = Props & {
children?: Props['children'] | SlotRenderFunction<Props>;
};
/**
* Define the slot arguments for a slot that supports one or more intrinsic element types, such as 'div'.
* For slots that support custom components, use {@link ObjectShorthandProps} instead.
* HTML element types that are not allowed to have children.
*
* The first param is the slot's default type if no `as` prop is specified.
* The second param is an optional union of alternative types that can be specified for the `as` prop.
* Reference: https://developer.mozilla.org/en-US/docs/Glossary/Empty_element
*/
declare type EmptyIntrisicElements = 'area' | 'base' | 'br' | 'col' | 'embed' | 'hr' | 'img' | 'input' | 'link' | 'meta' | 'param' | 'source' | 'track' | 'wbr';
/**
* Helper type for {@link Slot}. Modifies `JSX.IntrinsicElements[Type]`:
* * Removes legacy string ref.
* * Disallows children for empty tags like 'img'.
*/
declare type IntrisicElementProps<Type extends keyof JSX.IntrinsicElements> = React.PropsWithRef<JSX.IntrinsicElements[Type]> & (Type extends EmptyIntrisicElements ? {
children?: never;
} : {});
/**
* The props type and shorthand value for a slot. Type is either a single intrinsic element like `'div'`,
* or a component like `typeof Button`.
*
* If a slot needs to support multiple intrinsic element types, use the `AlternateAs` param (see examples below).
*
* By default, slots can be set to `null` to prevent them from being rendered. If a slot must always be rendered,
* wrap with `NonNullable` (see examples below).
*
* @example
* ```
* IntrinsicShorthandProps<'div'> // Slot is always div
* IntrinsicShorthandProps<'button', 'a'> // Defaults to button, but allows as="a" with anchor-specific props
* IntrinsicShorthandProps<'label', 'span' | 'div'>; // Defaults to label, but allows as="span" or as="div"
* // Intrinsic element examples:
* Slot<'div'> // Slot is always div
* Slot<'button', 'a'> // Defaults to button, but allows as="a" with anchor-specific props
* Slot<'span', 'div' | 'pre'> // Defaults to span, but allows as="div" or as="pre"
* NonNullable<Slot<'div'>> // Slot that will always be rendered (can't be set to null by the user)
*
* // Component examples:
* Slot<typeof Button> // Slot is always a Button, and accepts all of Button's Props
* NonNullable<Slot<typeof Label>> // Slot is a Label and will always be rendered (can't be set to null by the user)
* ```
*/
export declare type IntrinsicShorthandProps<DefaultAs extends keyof JSX.IntrinsicElements, AlternateAs extends keyof JSX.IntrinsicElements = never> = IsSingleton<DefaultAs> extends false ? 'Error: first parameter to IntrinsicShorthandProps must be a single element type, not a union of types' : ({
as?: DefaultAs;
} & ObjectShorthandProps<React.PropsWithRef<JSX.IntrinsicElements[DefaultAs]>>) | {
export declare type Slot<Type extends keyof JSX.IntrinsicElements | React.ComponentType | UnknownSlotProps, AlternateAs extends keyof JSX.IntrinsicElements = never> = IsSingleton<Extract<Type, string>> extends true ? WithSlotShorthandValue<Type extends keyof JSX.IntrinsicElements ? {
as?: Type;
} & WithSlotRenderFunction<IntrisicElementProps<Type>> : Type extends React.ComponentType<infer Props> ? WithSlotRenderFunction<Props> : Type> | {
[As in AlternateAs]: {
as: As;
} & ObjectShorthandProps<React.PropsWithRef<JSX.IntrinsicElements[As]>>;
}[AlternateAs];
} & WithSlotRenderFunction<IntrisicElementProps<As>>;
}[AlternateAs] | null : 'Error: First parameter to Slot must not be not a union of types. See documentation of Slot type.';
/**

@@ -73,3 +109,3 @@ * Evaluates to true if the given type contains exactly one string, or false if it is a union of strings.

* Removes the 'ref' prop from the given Props type, leaving unions intact (such as the discriminated union created by
* IntrinsicShorthandProps). This allows IntrinsicShorthandProps to be used with React.forwardRef.
* IntrinsicSlotProps). This allows IntrinsicSlotProps to be used with React.forwardRef.
*

@@ -80,10 +116,25 @@ * The conditional "extends unknown" (always true) exploits a quirk in the way TypeScript handles conditional

export declare type PropsWithoutRef<P> = 'ref' extends keyof P ? (P extends unknown ? Omit<P, 'ref'> : P) : P;
export declare type ComponentProps<Shorthands extends ObjectShorthandPropsRecord, Primary extends keyof Shorthands = 'root'> = Omit<{
[Key in keyof Shorthands]?: ShorthandProps<NonNullable<Shorthands[Key]>>;
}, Primary> & PropsWithoutRef<Shorthands[Primary]>;
export declare type ComponentState<Shorthands extends ObjectShorthandPropsRecord> = {
components?: {
[Key in keyof Shorthands]-?: React.ComponentType<NonNullable<Shorthands[Key]> extends ObjectShorthandProps<infer P> ? P : NonNullable<Shorthands[Key]>> | (NonNullable<Shorthands[Key]> extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements);
/**
* Removes SlotShorthandValue and null from the slot type, extracting just the slot's Props object.
*/
export declare type ExtractSlotProps<S> = Exclude<S, SlotShorthandValue | null | undefined>;
/**
* Defines the Props type for a component given its slots and the definition of which one is the primary slot,
* defaulting to root if one is not provided.
*/
export declare type ComponentProps<Slots extends SlotPropsRecord, Primary extends keyof Slots = 'root'> = Omit<Slots, Primary & 'root'> & PropsWithoutRef<ExtractSlotProps<Slots[Primary]>>;
/**
* If type T includes `null`, remove it and add `undefined` instead.
*/
export declare type ReplaceNullWithUndefined<T> = T extends null ? Exclude<T, null> | undefined : T;
/**
* Defines the State object of a component given its slots.
*/
export declare type ComponentState<Slots extends SlotPropsRecord> = {
components: {
[Key in keyof Slots]-?: React.ComponentType<ExtractSlotProps<Slots[Key]>> | (ExtractSlotProps<Slots[Key]> extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements);
};
} & Shorthands;
} & {
[Key in keyof Slots]: ReplaceNullWithUndefined<Exclude<Slots[Key], SlotShorthandValue | (Key extends 'root' ? null : never)>>;
};
/**

@@ -90,0 +141,0 @@ * This is part of a hack to infer the element type from a native element *props* type.

export * from './useControllableState';
export * from './useBoolean';
export * from './useConst';
export * from './useControllableValue';
export * from './useEventCallback';

@@ -9,2 +8,3 @@ export * from './useFirstMount';

export * from './useIsomorphicLayoutEffect';
export * from './useMergedEventCallbacks';
export * from './useMergedRefs';

@@ -11,0 +11,0 @@ export * from './useMount';

@@ -15,4 +15,2 @@ "use strict";

tslib_1.__exportStar(require("./useControllableValue"), exports);
tslib_1.__exportStar(require("./useEventCallback"), exports);

@@ -26,2 +24,4 @@

tslib_1.__exportStar(require("./useMergedEventCallbacks"), exports);
tslib_1.__exportStar(require("./useMergedRefs"), exports);

@@ -28,0 +28,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;

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

*/
export declare const applyTriggerPropsToChildren: <TTriggerProps>(children: React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | ((props: TTriggerProps) => React.ReactNode) | null | undefined, triggerProps: TTriggerProps) => React.ReactNode;
export declare const applyTriggerPropsToChildren: <TTriggerProps>(children: React.ReactElement<any, string | React.JSXElementConstructor<any>> | ((props: TTriggerProps) => React.ReactElement | null) | null | undefined, triggerProps: TTriggerProps) => React.ReactElement | null;

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

const onlyChild_1 = /*#__PURE__*/require("./onlyChild");
const isFluentTrigger_1 = /*#__PURE__*/require("./isFluentTrigger");
/**

@@ -21,9 +21,29 @@ * Apply the trigger props to the children, either by calling the render function, or cloning with the new props.

} else if (children) {
return React.cloneElement(onlyChild_1.onlyChild(children), triggerProps);
}
return cloneTriggerTree(children, triggerProps);
} // Components in React should return either JSX elements or "null", otherwise React will throw:
// Nothing was returned from render.
// This usually means a return statement is missing. Or, to render nothing, return null.
return children;
return children || null;
};
exports.applyTriggerPropsToChildren = applyTriggerPropsToChildren;
/**
* Clones a React element tree, and applies the given props to the first grandchild that is not
* a FluentTriggerComponent or React Fragment (the same element returned by {@link getTriggerChild}).
*/
const cloneTriggerTree = (child, triggerProps) => {
if (!React.isValidElement(child) || child.type === React.Fragment) {
throw new Error('A trigger element must be a single element for this component. ' + "Please ensure that you're not using React Fragments.");
}
if (isFluentTrigger_1.isFluentTrigger(child)) {
const grandchild = cloneTriggerTree(child.props.children, triggerProps);
return React.cloneElement(child, undefined, grandchild);
} else {
return React.cloneElement(child, triggerProps);
}
};
//# sourceMappingURL=applyTriggerPropsToChildren.js.map

@@ -10,1 +10,23 @@ import * as React from 'react';

export declare function getNativeElementProps<TAttributes extends React.HTMLAttributes<any>>(tagName: string, props: {}, excludedPropNames?: string[]): TAttributes;
/**
* Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
*
* This function is only for use with components that have a primary slot other than `root`.
* Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.
*
* @returns An object containing the native props for the `root` and primary slots.
*/
export declare const getPartitionedNativeProps: <Props extends Pick<React.HTMLAttributes<HTMLElement>, "style" | "className">, ExcludedPropKeys extends Extract<keyof Props, string> = never>({ primarySlotTagName, props, excludedPropNames, }: {
/** The primary slot's element type (e.g. 'div') */
primarySlotTagName: keyof JSX.IntrinsicElements;
/** The component's props object */
props: Props;
/** List of native props to exclude from the returned value */
excludedPropNames?: ExcludedPropKeys[] | undefined;
}) => {
root: {
style: React.CSSProperties | undefined;
className: string | undefined;
};
primary: Omit<Props, ExcludedPropKeys>;
};

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

});
exports.getNativeElementProps = void 0;
exports.getPartitionedNativeProps = exports.getNativeElementProps = void 0;

@@ -49,2 +49,26 @@ const properties_1 = /*#__PURE__*/require("./properties");

exports.getNativeElementProps = getNativeElementProps;
/**
* Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
*
* This function is only for use with components that have a primary slot other than `root`.
* Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.
*
* @returns An object containing the native props for the `root` and primary slots.
*/
const getPartitionedNativeProps = ({
primarySlotTagName,
props,
excludedPropNames
}) => {
return {
root: {
style: props.style,
className: props.className
},
primary: getNativeElementProps(primarySlotTagName, props, [...(excludedPropNames || []), 'style', 'className'])
};
};
exports.getPartitionedNativeProps = getPartitionedNativeProps;
//# sourceMappingURL=getNativeElementProps.js.map

@@ -5,5 +5,6 @@ export * from './applyTriggerPropsToChildren';

export * from './getRTLSafeKey';
export * from './getTriggerChild';
export * from './isFluentTrigger';
export * from './omit';
export * from './onlyChild';
export * from './properties';
export * from './shouldPreventDefaultOnKeyDown';

@@ -17,6 +17,8 @@ "use strict";

tslib_1.__exportStar(require("./getTriggerChild"), exports);
tslib_1.__exportStar(require("./isFluentTrigger"), exports);
tslib_1.__exportStar(require("./omit"), exports);
tslib_1.__exportStar(require("./onlyChild"), exports);
tslib_1.__exportStar(require("./properties"), exports);

@@ -23,0 +25,0 @@

@@ -35,3 +35,4 @@ "use strict";

exports.baseElementProperties = /*#__PURE__*/toObjectMap(['accessKey', 'children', 'className', 'contentEditable', 'dir', 'draggable', 'hidden', 'htmlFor', 'id', 'lang', 'ref', 'role', 'style', 'tabIndex', 'title', 'translate', 'spellCheck', 'name']);
exports.baseElementProperties = /*#__PURE__*/toObjectMap(['accessKey', 'children', 'className', 'contentEditable', 'dir', 'draggable', 'hidden', 'htmlFor', 'id', 'lang', 'ref', 'role', 'style', 'tabIndex', 'title', 'translate', 'spellCheck', 'name' // global
]);
/**

@@ -50,3 +51,4 @@ * An array of HTML element properties and events.

exports.labelProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['form']);
exports.labelProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['form' // button, fieldset, input, label, meter, object, output, select, textarea
]);
/**

@@ -58,3 +60,4 @@ * An array of AUDIO tag properties and events.

exports.audioProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['height', 'loop', 'muted', 'preload', 'src', 'width']);
exports.audioProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['height', 'loop', 'muted', 'preload', 'src', 'width' // canvas, embed, iframe, img, input, object, video
]);
/**

@@ -66,3 +69,4 @@ * An array of VIDEO tag properties and events.

exports.videoProperties = /*#__PURE__*/toObjectMap(exports.audioProperties, ['poster']);
exports.videoProperties = /*#__PURE__*/toObjectMap(exports.audioProperties, ['poster' // video
]);
/**

@@ -74,3 +78,4 @@ * An array of OL tag properties and events.

exports.olProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['start']);
exports.olProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['start' // ol
]);
/**

@@ -82,3 +87,4 @@ * An array of LI tag properties and events.

exports.liProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['value']);
exports.liProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['value' // button, input, li, option, meter, progress, param
]);
/**

@@ -90,3 +96,4 @@ * An array of A tag properties and events.

exports.anchorProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['download', 'href', 'hrefLang', 'media', 'rel', 'target', 'type']);
exports.anchorProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['download', 'href', 'hrefLang', 'media', 'rel', 'target', 'type' // a, button, input, link, menu, object, script, source, style
]);
/**

@@ -98,3 +105,4 @@ * An array of BUTTON tag properties and events.

exports.buttonProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['autoFocus', 'disabled', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'type', 'value']);
exports.buttonProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['autoFocus', 'disabled', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'type', 'value' // button, input, li, option, meter, progress, param,
]);
/**

@@ -106,3 +114,4 @@ * An array of INPUT tag properties and events.

exports.inputProperties = /*#__PURE__*/toObjectMap(exports.buttonProperties, ['accept', 'alt', 'autoCapitalize', 'autoComplete', 'checked', 'dirname', 'form', 'height', 'inputMode', 'list', 'max', 'maxLength', 'min', 'multiple', 'pattern', 'placeholder', 'readOnly', 'required', 'src', 'step', 'size', 'type', 'value', 'width']);
exports.inputProperties = /*#__PURE__*/toObjectMap(exports.buttonProperties, ['accept', 'alt', 'autoCapitalize', 'autoComplete', 'checked', 'dirname', 'form', 'height', 'inputMode', 'list', 'max', 'maxLength', 'min', 'multiple', 'pattern', 'placeholder', 'readOnly', 'required', 'src', 'step', 'size', 'type', 'value', 'width' // canvas, embed, iframe, img, input, object, video
]);
/**

@@ -114,3 +123,4 @@ * An array of TEXTAREA tag properties and events.

exports.textAreaProperties = /*#__PURE__*/toObjectMap(exports.buttonProperties, ['autoCapitalize', 'cols', 'dirname', 'form', 'maxLength', 'placeholder', 'readOnly', 'required', 'rows', 'wrap']);
exports.textAreaProperties = /*#__PURE__*/toObjectMap(exports.buttonProperties, ['autoCapitalize', 'cols', 'dirname', 'form', 'maxLength', 'placeholder', 'readOnly', 'required', 'rows', 'wrap' // textarea
]);
/**

@@ -122,4 +132,6 @@ * An array of SELECT tag properties and events.

exports.selectProperties = /*#__PURE__*/toObjectMap(exports.buttonProperties, ['form', 'multiple', 'required']);
exports.optionProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['selected', 'value']);
exports.selectProperties = /*#__PURE__*/toObjectMap(exports.buttonProperties, ['form', 'multiple', 'required' // input, select, textarea
]);
exports.optionProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['selected', 'value' // button, input, li, option, meter, progress, param
]);
/**

@@ -131,3 +143,4 @@ * An array of TABLE tag properties and events.

exports.tableProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['cellPadding', 'cellSpacing']);
exports.tableProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['cellPadding', 'cellSpacing' // table
]);
/**

@@ -146,3 +159,4 @@ * An array of TR tag properties and events.

exports.thProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['rowSpan', 'scope']);
exports.thProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['rowSpan', 'scope' // th
]);
/**

@@ -154,5 +168,8 @@ * An array of TD tag properties and events.

exports.tdProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['colSpan', 'headers', 'rowSpan', 'scope']);
exports.colGroupProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['span']);
exports.colProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['span']);
exports.tdProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['colSpan', 'headers', 'rowSpan', 'scope' // th
]);
exports.colGroupProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['span' // col, colgroup
]);
exports.colProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['span' // col, colgroup
]);
/**

@@ -164,3 +181,4 @@ * An array of FORM tag properties and events.

exports.formProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['acceptCharset', 'action', 'encType', 'encType', 'method', 'noValidate', 'target']);
exports.formProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['acceptCharset', 'action', 'encType', 'encType', 'method', 'noValidate', 'target' // form
]);
/**

@@ -172,3 +190,4 @@ * An array of IFRAME tag properties and events.

exports.iframeProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['allow', 'allowFullScreen', 'allowPaymentRequest', 'allowTransparency', 'csp', 'height', 'importance', 'referrerPolicy', 'sandbox', 'src', 'srcDoc', 'width']);
exports.iframeProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['allow', 'allowFullScreen', 'allowPaymentRequest', 'allowTransparency', 'csp', 'height', 'importance', 'referrerPolicy', 'sandbox', 'src', 'srcDoc', 'width' // canvas, embed, iframe, img, input, object, video,
]);
/**

@@ -180,3 +199,4 @@ * An array of IMAGE tag properties and events.

exports.imgProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['alt', 'crossOrigin', 'height', 'src', 'srcSet', 'useMap', 'width']);
exports.imgProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['alt', 'crossOrigin', 'height', 'src', 'srcSet', 'useMap', 'width' // canvas, embed, iframe, img, input, object, video
]);
/**

@@ -183,0 +203,0 @@ * @deprecated Use imgProperties for img elements.

import * as React from 'react';
import { AsIntrinsicElement, ComponentState, ObjectShorthandPropsRecord, ObjectShorthandProps, UnionToIntersection } from './types';
export declare type Slots<S extends ObjectShorthandPropsRecord> = {
[K in keyof S]-?: NonNullable<S[K]> extends AsIntrinsicElement<infer As> ? As : S[K] extends ObjectShorthandProps<infer P> ? React.ElementType<NonNullable<P>> : React.ElementType<NonNullable<S[K]>>;
import type { AsIntrinsicElement, ComponentState, ExtractSlotProps, SlotPropsRecord, UnionToIntersection } from './types';
export declare type Slots<S extends SlotPropsRecord> = {
[K in keyof S]: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As> ? As : ExtractSlotProps<S[K]> extends React.ComponentType<infer P> ? React.ElementType<NonNullable<P>> : React.ElementType<ExtractSlotProps<S[K]>>;
};
declare type SlotProps<S extends ObjectShorthandPropsRecord> = {
[K in keyof S]-?: NonNullable<S[K]> extends AsIntrinsicElement<infer As> ? UnionToIntersection<JSX.IntrinsicElements[As]> : NonNullable<S[K]> extends ObjectShorthandProps<infer P> ? P : never;
declare type ObjectSlotProps<S extends SlotPropsRecord> = {
[K in keyof S]-?: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As> ? UnionToIntersection<JSX.IntrinsicElements[As]> : ExtractSlotProps<S[K]> extends React.ComponentType<infer P> ? P : never;
};

@@ -18,13 +18,14 @@ /**

* The slotProps will always omit the `as` prop within them, and for slots that are string
* primitives, the props will be filtered according the the slot type. For example, if the
* slot is rendered `as: 'a'`, the props will be filtered for acceptable anchor props.
* primitives, the props will be filtered according to the slot type by the type system.
* For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable
* anchor props. Note that this is only enforced at build time by Typescript -- there is no
* runtime code filtering props in this function.
*
* @param state - State including slot definitions
* @param slotNames - Name of which props are slots
* @returns An object containing the `slots` map and `slotProps` map.
*/
export declare function getSlots<R extends ObjectShorthandPropsRecord>(state: ComponentState<R>, slotNames?: (keyof R)[]): {
export declare function getSlots<R extends SlotPropsRecord>(state: ComponentState<R>): {
slots: Slots<R>;
slotProps: SlotProps<R>;
slotProps: ObjectSlotProps<R>;
};
export {};
import * as React from 'react';
import { nullRender } from './nullRender';
import { omit } from '../utils/omit';

@@ -13,13 +12,15 @@ /**

* The slotProps will always omit the `as` prop within them, and for slots that are string
* primitives, the props will be filtered according the the slot type. For example, if the
* slot is rendered `as: 'a'`, the props will be filtered for acceptable anchor props.
* primitives, the props will be filtered according to the slot type by the type system.
* For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable
* anchor props. Note that this is only enforced at build time by Typescript -- there is no
* runtime code filtering props in this function.
*
* @param state - State including slot definitions
* @param slotNames - Name of which props are slots
* @returns An object containing the `slots` map and `slotProps` map.
*/
export function getSlots(state, slotNames = ['root']) {
export function getSlots(state) {
const slots = {};
const slotProps = {};
const slotNames = Object.keys(state.components);

@@ -42,3 +43,3 @@ for (const slotName of slotNames) {

if (state[slotName] === undefined) {
return [nullRender, undefined];
return [null, undefined];
}

@@ -45,0 +46,0 @@

export * from './getSlots';
export * from './nullRender';
export * from './resolveShorthand';
export * from './types';
export * from './getSlots';
export * from './nullRender';
export * from './resolveShorthand';
export * from './types';
//# sourceMappingURL=index.js.map

@@ -1,12 +0,16 @@

import type { DefaultObjectShorthandProps, ShorthandProps } from './types';
export declare type ResolveShorthandOptions<Props extends Record<string, any>, Required extends boolean = false> = {
import type { ReplaceNullWithUndefined, SlotShorthandValue, UnknownSlotProps } from './types';
export declare type ResolveShorthandOptions<Props, Required extends boolean = false> = {
required?: Required;
defaultProps?: Props;
};
export declare type ResolveShorthandFunction<Props extends UnknownSlotProps = UnknownSlotProps> = {
<P extends Props | null>(value: P | SlotShorthandValue | undefined, options?: ResolveShorthandOptions<P, true>): ReplaceNullWithUndefined<P>;
<P extends Props | null>(value: P | SlotShorthandValue | undefined, options?: ResolveShorthandOptions<P, boolean>): ReplaceNullWithUndefined<P> | undefined;
};
/**
* Resolves ShorthandProps into ObjectShorthandProps, to ensure normalization of the signature
* Resolves shorthands into slot props, to ensure normalization of the signature
* being passed down to getSlots method
* @param value - the base ShorthandProps
* @param options - options to resolve ShorthandProps
* @param value - the base shorthand props
* @param options - options to resolve shorthand props
*/
export declare function resolveShorthand<Props extends DefaultObjectShorthandProps, Required extends boolean = false>(value: ShorthandProps<Props>, options?: ResolveShorthandOptions<Props, Required>): Required extends false ? Props | undefined : Props;
export declare const resolveShorthand: ResolveShorthandFunction;
import { isValidElement } from 'react';
/**
* Resolves ShorthandProps into ObjectShorthandProps, to ensure normalization of the signature
* Resolves shorthands into slot props, to ensure normalization of the signature
* being passed down to getSlots method
* @param value - the base ShorthandProps
* @param options - options to resolve ShorthandProps
* @param value - the base shorthand props
* @param options - options to resolve shorthand props
*/
export function resolveShorthand(value, options) {
export const resolveShorthand = (value, options) => {
const {

@@ -30,3 +30,3 @@ required = false,

} : resolvedShorthand;
}
};
//# sourceMappingURL=resolveShorthand.js.map
import * as React from 'react';
export declare type ShorthandRenderFunction<Props> = (Component: React.ElementType<Props>, props: Omit<Props, 'children' | 'as'>) => React.ReactNode;
export declare type ObjectShorthandPropsRecord = Record<string, DefaultObjectShorthandProps | undefined>;
export declare type ShorthandProps<Props extends DefaultObjectShorthandProps> = React.ReactChild | React.ReactNodeArray | React.ReactPortal | number | null | undefined | Props;
export declare type SlotRenderFunction<Props> = (Component: React.ElementType<Props>, props: Omit<Props, 'children' | 'as'>) => React.ReactNode;
/**
* Matches any shorthand props type.
* Matches any component's Slots type (such as ButtonSlots).
*
* This should ONLY be used in type templates as in `extends DefaultObjectShorthandProps`;
* This should ONLY be used in type templates as in `extends SlotPropsRecord`;
* it shouldn't be used as a component's Slots type.
*/
export declare type SlotPropsRecord = Record<string, UnknownSlotProps | SlotShorthandValue | null | undefined>;
/**
* The shorthand value of a slot allows specifying its child
*/
export declare type SlotShorthandValue = React.ReactChild | React.ReactNodeArray | React.ReactPortal;
/**
* Matches any slot props type.
*
* This should ONLY be used in type templates as in `extends UnknownSlotProps`;
* it shouldn't be used as the type of a slot.
*/
export declare type DefaultObjectShorthandProps = ObjectShorthandProps<{
children?: React.ReactNode;
export declare type UnknownSlotProps = Pick<React.HTMLAttributes<HTMLElement>, 'children' | 'className' | 'style'> & {
as?: keyof JSX.IntrinsicElements;
}>;
};
/**
* Defines the slot props for a slot that supports a Component type.
*
* For intrinsic elements like 'div', use {@link IntrinsicShorthandProps} instead.
* Helper type for {@link Slot}. Adds shorthand types that are assignable to the slot's `children`.
*/
export declare type ObjectShorthandProps<Props extends {
children?: React.ReactNode;
} = {}> = Props & {
children?: Props['children'] | ShorthandRenderFunction<Props>;
declare type WithSlotShorthandValue<Props extends {
children?: unknown;
}> = Props | Extract<SlotShorthandValue, Props['children']>;
/**
* Helper type for {@link Slot}. Takes the props we want to support for a slot and adds the ability for `children`
* to be a render function that takes those props.
*/
declare type WithSlotRenderFunction<Props extends {
children?: unknown;
}> = Props & {
children?: Props['children'] | SlotRenderFunction<Props>;
};
/**
* Define the slot arguments for a slot that supports one or more intrinsic element types, such as 'div'.
* For slots that support custom components, use {@link ObjectShorthandProps} instead.
* HTML element types that are not allowed to have children.
*
* The first param is the slot's default type if no `as` prop is specified.
* The second param is an optional union of alternative types that can be specified for the `as` prop.
* Reference: https://developer.mozilla.org/en-US/docs/Glossary/Empty_element
*/
declare type EmptyIntrisicElements = 'area' | 'base' | 'br' | 'col' | 'embed' | 'hr' | 'img' | 'input' | 'link' | 'meta' | 'param' | 'source' | 'track' | 'wbr';
/**
* Helper type for {@link Slot}. Modifies `JSX.IntrinsicElements[Type]`:
* * Removes legacy string ref.
* * Disallows children for empty tags like 'img'.
*/
declare type IntrisicElementProps<Type extends keyof JSX.IntrinsicElements> = React.PropsWithRef<JSX.IntrinsicElements[Type]> & (Type extends EmptyIntrisicElements ? {
children?: never;
} : {});
/**
* The props type and shorthand value for a slot. Type is either a single intrinsic element like `'div'`,
* or a component like `typeof Button`.
*
* If a slot needs to support multiple intrinsic element types, use the `AlternateAs` param (see examples below).
*
* By default, slots can be set to `null` to prevent them from being rendered. If a slot must always be rendered,
* wrap with `NonNullable` (see examples below).
*
* @example
* ```
* IntrinsicShorthandProps<'div'> // Slot is always div
* IntrinsicShorthandProps<'button', 'a'> // Defaults to button, but allows as="a" with anchor-specific props
* IntrinsicShorthandProps<'label', 'span' | 'div'>; // Defaults to label, but allows as="span" or as="div"
* // Intrinsic element examples:
* Slot<'div'> // Slot is always div
* Slot<'button', 'a'> // Defaults to button, but allows as="a" with anchor-specific props
* Slot<'span', 'div' | 'pre'> // Defaults to span, but allows as="div" or as="pre"
* NonNullable<Slot<'div'>> // Slot that will always be rendered (can't be set to null by the user)
*
* // Component examples:
* Slot<typeof Button> // Slot is always a Button, and accepts all of Button's Props
* NonNullable<Slot<typeof Label>> // Slot is a Label and will always be rendered (can't be set to null by the user)
* ```
*/
export declare type IntrinsicShorthandProps<DefaultAs extends keyof JSX.IntrinsicElements, AlternateAs extends keyof JSX.IntrinsicElements = never> = IsSingleton<DefaultAs> extends false ? 'Error: first parameter to IntrinsicShorthandProps must be a single element type, not a union of types' : ({
as?: DefaultAs;
} & ObjectShorthandProps<React.PropsWithRef<JSX.IntrinsicElements[DefaultAs]>>) | {
export declare type Slot<Type extends keyof JSX.IntrinsicElements | React.ComponentType | UnknownSlotProps, AlternateAs extends keyof JSX.IntrinsicElements = never> = IsSingleton<Extract<Type, string>> extends true ? WithSlotShorthandValue<Type extends keyof JSX.IntrinsicElements ? {
as?: Type;
} & WithSlotRenderFunction<IntrisicElementProps<Type>> : Type extends React.ComponentType<infer Props> ? WithSlotRenderFunction<Props> : Type> | {
[As in AlternateAs]: {
as: As;
} & ObjectShorthandProps<React.PropsWithRef<JSX.IntrinsicElements[As]>>;
}[AlternateAs];
} & WithSlotRenderFunction<IntrisicElementProps<As>>;
}[AlternateAs] | null : 'Error: First parameter to Slot must not be not a union of types. See documentation of Slot type.';
/**

@@ -73,3 +109,3 @@ * Evaluates to true if the given type contains exactly one string, or false if it is a union of strings.

* Removes the 'ref' prop from the given Props type, leaving unions intact (such as the discriminated union created by
* IntrinsicShorthandProps). This allows IntrinsicShorthandProps to be used with React.forwardRef.
* IntrinsicSlotProps). This allows IntrinsicSlotProps to be used with React.forwardRef.
*

@@ -80,10 +116,25 @@ * The conditional "extends unknown" (always true) exploits a quirk in the way TypeScript handles conditional

export declare type PropsWithoutRef<P> = 'ref' extends keyof P ? (P extends unknown ? Omit<P, 'ref'> : P) : P;
export declare type ComponentProps<Shorthands extends ObjectShorthandPropsRecord, Primary extends keyof Shorthands = 'root'> = Omit<{
[Key in keyof Shorthands]?: ShorthandProps<NonNullable<Shorthands[Key]>>;
}, Primary> & PropsWithoutRef<Shorthands[Primary]>;
export declare type ComponentState<Shorthands extends ObjectShorthandPropsRecord> = {
components?: {
[Key in keyof Shorthands]-?: React.ComponentType<NonNullable<Shorthands[Key]> extends ObjectShorthandProps<infer P> ? P : NonNullable<Shorthands[Key]>> | (NonNullable<Shorthands[Key]> extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements);
/**
* Removes SlotShorthandValue and null from the slot type, extracting just the slot's Props object.
*/
export declare type ExtractSlotProps<S> = Exclude<S, SlotShorthandValue | null | undefined>;
/**
* Defines the Props type for a component given its slots and the definition of which one is the primary slot,
* defaulting to root if one is not provided.
*/
export declare type ComponentProps<Slots extends SlotPropsRecord, Primary extends keyof Slots = 'root'> = Omit<Slots, Primary & 'root'> & PropsWithoutRef<ExtractSlotProps<Slots[Primary]>>;
/**
* If type T includes `null`, remove it and add `undefined` instead.
*/
export declare type ReplaceNullWithUndefined<T> = T extends null ? Exclude<T, null> | undefined : T;
/**
* Defines the State object of a component given its slots.
*/
export declare type ComponentState<Slots extends SlotPropsRecord> = {
components: {
[Key in keyof Slots]-?: React.ComponentType<ExtractSlotProps<Slots[Key]>> | (ExtractSlotProps<Slots[Key]> extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements);
};
} & Shorthands;
} & {
[Key in keyof Slots]: ReplaceNullWithUndefined<Exclude<Slots[Key], SlotShorthandValue | (Key extends 'root' ? null : never)>>;
};
/**

@@ -90,0 +141,0 @@ * This is part of a hack to infer the element type from a native element *props* type.

export * from './useControllableState';
export * from './useBoolean';
export * from './useConst';
export * from './useControllableValue';
export * from './useEventCallback';

@@ -9,2 +8,3 @@ export * from './useFirstMount';

export * from './useIsomorphicLayoutEffect';
export * from './useMergedEventCallbacks';
export * from './useMergedRefs';

@@ -11,0 +11,0 @@ export * from './useMount';

export * from './useControllableState';
export * from './useBoolean';
export * from './useConst';
export * from './useControllableValue';
export * from './useEventCallback';

@@ -9,2 +8,3 @@ export * from './useFirstMount';

export * from './useIsomorphicLayoutEffect';
export * from './useMergedEventCallbacks';
export * from './useMergedRefs';

@@ -11,0 +11,0 @@ export * from './useMount';

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;

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

*/
export declare const applyTriggerPropsToChildren: <TTriggerProps>(children: React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | ((props: TTriggerProps) => React.ReactNode) | null | undefined, triggerProps: TTriggerProps) => React.ReactNode;
export declare const applyTriggerPropsToChildren: <TTriggerProps>(children: React.ReactElement<any, string | React.JSXElementConstructor<any>> | ((props: TTriggerProps) => React.ReactElement | null) | null | undefined, triggerProps: TTriggerProps) => React.ReactElement | null;
import * as React from 'react';
import { onlyChild } from './onlyChild';
import { isFluentTrigger } from './isFluentTrigger';
/**

@@ -11,7 +11,27 @@ * Apply the trigger props to the children, either by calling the render function, or cloning with the new props.

} else if (children) {
return /*#__PURE__*/React.cloneElement(onlyChild(children), triggerProps);
return cloneTriggerTree(children, triggerProps);
} // Components in React should return either JSX elements or "null", otherwise React will throw:
// Nothing was returned from render.
// This usually means a return statement is missing. Or, to render nothing, return null.
return children || null;
};
/**
* Clones a React element tree, and applies the given props to the first grandchild that is not
* a FluentTriggerComponent or React Fragment (the same element returned by {@link getTriggerChild}).
*/
const cloneTriggerTree = (child, triggerProps) => {
if (! /*#__PURE__*/React.isValidElement(child) || child.type === React.Fragment) {
throw new Error('A trigger element must be a single element for this component. ' + "Please ensure that you're not using React Fragments.");
}
return children;
if (isFluentTrigger(child)) {
const grandchild = cloneTriggerTree(child.props.children, triggerProps);
return /*#__PURE__*/React.cloneElement(child, undefined, grandchild);
} else {
return /*#__PURE__*/React.cloneElement(child, triggerProps);
}
};
//# sourceMappingURL=applyTriggerPropsToChildren.js.map

@@ -10,1 +10,23 @@ import * as React from 'react';

export declare function getNativeElementProps<TAttributes extends React.HTMLAttributes<any>>(tagName: string, props: {}, excludedPropNames?: string[]): TAttributes;
/**
* Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
*
* This function is only for use with components that have a primary slot other than `root`.
* Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.
*
* @returns An object containing the native props for the `root` and primary slots.
*/
export declare const getPartitionedNativeProps: <Props extends Pick<React.HTMLAttributes<HTMLElement>, "style" | "className">, ExcludedPropKeys extends Extract<keyof Props, string> = never>({ primarySlotTagName, props, excludedPropNames, }: {
/** The primary slot's element type (e.g. 'div') */
primarySlotTagName: keyof JSX.IntrinsicElements;
/** The component's props object */
props: Props;
/** List of native props to exclude from the returned value */
excludedPropNames?: ExcludedPropKeys[] | undefined;
}) => {
root: {
style: React.CSSProperties | undefined;
className: string | undefined;
};
primary: Omit<Props, ExcludedPropKeys>;
};

@@ -38,2 +38,24 @@ import { labelProperties, audioProperties, videoProperties, olProperties, liProperties, anchorProperties, buttonProperties, inputProperties, textAreaProperties, selectProperties, optionProperties, tableProperties, trProperties, thProperties, tdProperties, colGroupProperties, colProperties, formProperties, iframeProperties, imgProperties, htmlElementProperties, getNativeProps } from './properties';

}
/**
* Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
*
* This function is only for use with components that have a primary slot other than `root`.
* Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.
*
* @returns An object containing the native props for the `root` and primary slots.
*/
export const getPartitionedNativeProps = ({
primarySlotTagName,
props,
excludedPropNames
}) => {
return {
root: {
style: props.style,
className: props.className
},
primary: getNativeElementProps(primarySlotTagName, props, [...(excludedPropNames || []), 'style', 'className'])
};
};
//# sourceMappingURL=getNativeElementProps.js.map

@@ -5,5 +5,6 @@ export * from './applyTriggerPropsToChildren';

export * from './getRTLSafeKey';
export * from './getTriggerChild';
export * from './isFluentTrigger';
export * from './omit';
export * from './onlyChild';
export * from './properties';
export * from './shouldPreventDefaultOnKeyDown';

@@ -5,6 +5,7 @@ export * from './applyTriggerPropsToChildren';

export * from './getRTLSafeKey';
export * from './getTriggerChild';
export * from './isFluentTrigger';
export * from './omit';
export * from './onlyChild';
export * from './properties';
export * from './shouldPreventDefaultOnKeyDown';
//# sourceMappingURL=index.js.map

@@ -28,3 +28,4 @@ const toObjectMap = (...items) => {

export const baseElementProperties = /*#__PURE__*/toObjectMap(['accessKey', 'children', 'className', 'contentEditable', 'dir', 'draggable', 'hidden', 'htmlFor', 'id', 'lang', 'ref', 'role', 'style', 'tabIndex', 'title', 'translate', 'spellCheck', 'name']);
export const baseElementProperties = /*#__PURE__*/toObjectMap(['accessKey', 'children', 'className', 'contentEditable', 'dir', 'draggable', 'hidden', 'htmlFor', 'id', 'lang', 'ref', 'role', 'style', 'tabIndex', 'title', 'translate', 'spellCheck', 'name' // global
]);
/**

@@ -43,3 +44,4 @@ * An array of HTML element properties and events.

export const labelProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['form']);
export const labelProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['form' // button, fieldset, input, label, meter, object, output, select, textarea
]);
/**

@@ -51,3 +53,4 @@ * An array of AUDIO tag properties and events.

export const audioProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['height', 'loop', 'muted', 'preload', 'src', 'width']);
export const audioProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['height', 'loop', 'muted', 'preload', 'src', 'width' // canvas, embed, iframe, img, input, object, video
]);
/**

@@ -59,3 +62,4 @@ * An array of VIDEO tag properties and events.

export const videoProperties = /*#__PURE__*/toObjectMap(audioProperties, ['poster']);
export const videoProperties = /*#__PURE__*/toObjectMap(audioProperties, ['poster' // video
]);
/**

@@ -67,3 +71,4 @@ * An array of OL tag properties and events.

export const olProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['start']);
export const olProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['start' // ol
]);
/**

@@ -75,3 +80,4 @@ * An array of LI tag properties and events.

export const liProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['value']);
export const liProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['value' // button, input, li, option, meter, progress, param
]);
/**

@@ -83,3 +89,4 @@ * An array of A tag properties and events.

export const anchorProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['download', 'href', 'hrefLang', 'media', 'rel', 'target', 'type']);
export const anchorProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['download', 'href', 'hrefLang', 'media', 'rel', 'target', 'type' // a, button, input, link, menu, object, script, source, style
]);
/**

@@ -91,3 +98,4 @@ * An array of BUTTON tag properties and events.

export const buttonProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['autoFocus', 'disabled', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'type', 'value']);
export const buttonProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['autoFocus', 'disabled', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'type', 'value' // button, input, li, option, meter, progress, param,
]);
/**

@@ -99,3 +107,4 @@ * An array of INPUT tag properties and events.

export const inputProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['accept', 'alt', 'autoCapitalize', 'autoComplete', 'checked', 'dirname', 'form', 'height', 'inputMode', 'list', 'max', 'maxLength', 'min', 'multiple', 'pattern', 'placeholder', 'readOnly', 'required', 'src', 'step', 'size', 'type', 'value', 'width']);
export const inputProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['accept', 'alt', 'autoCapitalize', 'autoComplete', 'checked', 'dirname', 'form', 'height', 'inputMode', 'list', 'max', 'maxLength', 'min', 'multiple', 'pattern', 'placeholder', 'readOnly', 'required', 'src', 'step', 'size', 'type', 'value', 'width' // canvas, embed, iframe, img, input, object, video
]);
/**

@@ -107,3 +116,4 @@ * An array of TEXTAREA tag properties and events.

export const textAreaProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['autoCapitalize', 'cols', 'dirname', 'form', 'maxLength', 'placeholder', 'readOnly', 'required', 'rows', 'wrap']);
export const textAreaProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['autoCapitalize', 'cols', 'dirname', 'form', 'maxLength', 'placeholder', 'readOnly', 'required', 'rows', 'wrap' // textarea
]);
/**

@@ -115,4 +125,6 @@ * An array of SELECT tag properties and events.

export const selectProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['form', 'multiple', 'required']);
export const optionProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['selected', 'value']);
export const selectProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['form', 'multiple', 'required' // input, select, textarea
]);
export const optionProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['selected', 'value' // button, input, li, option, meter, progress, param
]);
/**

@@ -124,3 +136,4 @@ * An array of TABLE tag properties and events.

export const tableProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['cellPadding', 'cellSpacing']);
export const tableProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['cellPadding', 'cellSpacing' // table
]);
/**

@@ -139,3 +152,4 @@ * An array of TR tag properties and events.

export const thProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['rowSpan', 'scope']);
export const thProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['rowSpan', 'scope' // th
]);
/**

@@ -147,5 +161,8 @@ * An array of TD tag properties and events.

export const tdProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['colSpan', 'headers', 'rowSpan', 'scope']);
export const colGroupProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span']);
export const colProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span']);
export const tdProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['colSpan', 'headers', 'rowSpan', 'scope' // th
]);
export const colGroupProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span' // col, colgroup
]);
export const colProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span' // col, colgroup
]);
/**

@@ -157,3 +174,4 @@ * An array of FORM tag properties and events.

export const formProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['acceptCharset', 'action', 'encType', 'encType', 'method', 'noValidate', 'target']);
export const formProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['acceptCharset', 'action', 'encType', 'encType', 'method', 'noValidate', 'target' // form
]);
/**

@@ -165,3 +183,4 @@ * An array of IFRAME tag properties and events.

export const iframeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['allow', 'allowFullScreen', 'allowPaymentRequest', 'allowTransparency', 'csp', 'height', 'importance', 'referrerPolicy', 'sandbox', 'src', 'srcDoc', 'width']);
export const iframeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['allow', 'allowFullScreen', 'allowPaymentRequest', 'allowTransparency', 'csp', 'height', 'importance', 'referrerPolicy', 'sandbox', 'src', 'srcDoc', 'width' // canvas, embed, iframe, img, input, object, video,
]);
/**

@@ -173,3 +192,4 @@ * An array of IMAGE tag properties and events.

export const imgProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['alt', 'crossOrigin', 'height', 'src', 'srcSet', 'useMap', 'width']);
export const imgProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['alt', 'crossOrigin', 'height', 'src', 'srcSet', 'useMap', 'width' // canvas, embed, iframe, img, input, object, video
]);
/**

@@ -176,0 +196,0 @@ * @deprecated Use imgProperties for img elements.

{
"name": "@fluentui/react-utilities",
"version": "0.0.0-nightlyc0273fdc6920211123.1",
"version": "0.0.0-nightlyc0e3a0a1f320220217.1",
"description": "A set of general React-specific utilities.",

@@ -21,7 +21,7 @@ "main": "lib-commonjs/index.js",

"lint": "just-scripts lint",
"test": "jest",
"test": "jest --passWithNoTests",
"docs": "api-extractor run --config=config/api-extractor.local.json --local",
"build:local": "tsc -p . --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output dist/react-utilities/src && yarn docs",
"storybook": "start-storybook",
"start": "yarn storybook"
"build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output ./dist/packages/react-utilities/src && yarn docs",
"start": "yarn storybook",
"type-check": "tsc -b tsconfig.json"
},

@@ -31,8 +31,4 @@ "devDependencies": {

"@fluentui/scripts": "^1.0.0",
"@types/enzyme": "3.10.3",
"@types/enzyme-adapter-react-16": "1.0.3",
"@types/react": "16.9.42",
"@types/react-test-renderer": "^16.0.0",
"enzyme": "~3.10.0",
"enzyme-adapter-react-16": "^1.15.0",
"react": "16.8.6",

@@ -42,3 +38,3 @@ "react-test-renderer": "^16.3.0"

"dependencies": {
"@fluentui/keyboard-keys": "0.0.0-nightlyc0273fdc6920211123.1",
"@fluentui/keyboard-keys": "0.0.0-nightlyc0e3a0a1f320220217.1",
"tslib": "^2.1.0"

@@ -45,0 +41,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

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

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