@fluentui/react-utilities
Advanced tools
Comparing version 9.0.0-alpha.30 to 9.0.0-alpha.31
@@ -5,3 +5,24 @@ { | ||
{ | ||
"date": "Fri, 02 Jul 2021 07:35:03 GMT", | ||
"date": "Fri, 02 Jul 2021 23:12:33 GMT", | ||
"tag": "@fluentui/react-utilities_v9.0.0-alpha.31", | ||
"version": "9.0.0-alpha.31", | ||
"comments": { | ||
"prerelease": [ | ||
{ | ||
"comment": "Add new prop mergin mechanism", | ||
"author": "bsunderhus@microsoft.com", | ||
"commit": "6c37a1cb5c312d4be8b239bfd9f6c9f28e9f0d24", | ||
"package": "@fluentui/react-utilities" | ||
}, | ||
{ | ||
"comment": "chore(Menu): use capture event to handle outside click", | ||
"author": "lingfan.gao@microsoft.com", | ||
"commit": "3812a10a4152a2e27ac89b16259e312f42469570", | ||
"package": "@fluentui/react-utilities" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Fri, 02 Jul 2021 07:37:06 GMT", | ||
"tag": "@fluentui/react-utilities_v9.0.0-alpha.30", | ||
@@ -8,0 +29,0 @@ "version": "9.0.0-alpha.30", |
# Change Log - @fluentui/react-utilities | ||
This log was last generated on Fri, 02 Jul 2021 07:35:03 GMT and should not be manually modified. | ||
This log was last generated on Fri, 02 Jul 2021 23:12:33 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## [9.0.0-alpha.31](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-alpha.31) | ||
Fri, 02 Jul 2021 23:12:33 GMT | ||
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-alpha.30..@fluentui/react-utilities_v9.0.0-alpha.31) | ||
### Changes | ||
- Add new prop mergin mechanism ([PR #18721](https://github.com/microsoft/fluentui/pull/18721) by bsunderhus@microsoft.com) | ||
- chore(Menu): use capture event to handle outside click ([PR #18792](https://github.com/microsoft/fluentui/pull/18792) by lingfan.gao@microsoft.com) | ||
## [9.0.0-alpha.30](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-alpha.30) | ||
Fri, 02 Jul 2021 07:35:03 GMT | ||
Fri, 02 Jul 2021 07:37:06 GMT | ||
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-alpha.29..@fluentui/react-utilities_v9.0.0-alpha.30) | ||
@@ -11,0 +21,0 @@ |
@@ -53,2 +53,4 @@ import * as React_2 from 'react'; | ||
export declare type ComponentProps<Record extends SlotPropsRecord = {}> = DefaultComponentProps & ShorthandPropsRecord<Record>; | ||
export declare interface ComponentPropsCompat { | ||
@@ -60,2 +62,12 @@ as?: React_2.ElementType; | ||
export declare type ComponentState<Record extends SlotPropsRecord = {}> = Pick<ComponentProps<Record>, keyof DefaultComponentProps> & { | ||
components?: { | ||
[K in keyof Record]?: React_2.ElementType<Record[K]>; | ||
}; | ||
} & { | ||
components?: { | ||
root?: React_2.ElementType; | ||
}; | ||
} & ObjectShorthandPropsRecord<Record>; | ||
/** | ||
@@ -76,2 +88,6 @@ * Converts a components Props type to a State type: | ||
export declare interface DefaultComponentProps { | ||
as?: keyof JSX.IntrinsicElements; | ||
} | ||
/** | ||
@@ -154,2 +170,27 @@ * Default context value to use in case there is no SSRProvider. This is fine for client-only apps. | ||
* | ||
* The root is derived from a mix of `components` props and `as` prop. | ||
* | ||
* Slots will render as null if they are rendered as primitives with undefined children. | ||
* | ||
* 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. | ||
* | ||
* @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<SlotProps extends SlotPropsRecord = {}>(state: ComponentState<any>, slotNames?: string[]): { | ||
readonly slots: { [K in keyof SlotProps]: React_2.ElementType<SlotProps[K]>; } & { | ||
root: React_2.ElementType; | ||
}; | ||
readonly slotProps: SlotProps & { | ||
root: any; | ||
}; | ||
}; | ||
/** | ||
* Given the state and an array of slot names, will break out `slots` and `slotProps` | ||
* collections. | ||
* | ||
* The root is always derived from the `as` prop. | ||
@@ -248,2 +289,8 @@ * | ||
export declare type ObjectShorthandProps<Props extends { | ||
children?: React_2.ReactNode; | ||
} = {}> = Props & Pick<ComponentProps, 'as'> & { | ||
children?: Props['children'] | ShorthandRenderFunction<Props>; | ||
}; | ||
export declare type ObjectShorthandPropsCompat<TProps extends ComponentPropsCompat = {}> = TProps & Omit<ComponentPropsCompat, 'children'> & { | ||
@@ -253,2 +300,6 @@ children?: TProps['children'] | ShorthandRenderFunctionCompat<TProps>; | ||
export declare type ObjectShorthandPropsRecord<Record extends SlotPropsRecord = SlotPropsRecord> = { | ||
[K in keyof Record]: ObjectShorthandProps<NonNullable<Record[K]>>; | ||
}; | ||
/** | ||
@@ -274,3 +325,3 @@ * An array of OL tag properties and events. | ||
*/ | ||
export declare function omit<TObj extends Record<string, any>>(obj: TObj, exclusions: (keyof TObj)[]): TObj; | ||
export declare function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(obj: TObj, exclusions: Exclusions): Omit<TObj, Exclusions[number]>; | ||
@@ -313,2 +364,10 @@ /** | ||
/** | ||
* Resolves ShorthandProps into ObjectShorthandProps, to ensure normalization of the signature | ||
* being passed down to getSlots method | ||
* @param value - the base ShorthandProps | ||
* @param defaultProps - base properties to be merged with the end ObjectShorthandProps | ||
*/ | ||
export declare function resolveShorthand<Props extends Record<string, any>>(value: ShorthandProps<Props>, defaultProps?: Props): ObjectShorthandProps<Props>; | ||
/** | ||
* Ensures that the given slots are represented using object syntax. This ensures that | ||
@@ -328,4 +387,12 @@ * the object can be merged along with other objects. | ||
export declare type ShorthandProps<Props = {}> = React_2.ReactChild | React_2.ReactNodeArray | React_2.ReactPortal | number | null | undefined | ObjectShorthandProps<Props>; | ||
export declare type ShorthandPropsCompat<TProps extends ComponentPropsCompat = {}> = React_2.ReactChild | React_2.ReactNodeArray | React_2.ReactPortal | number | null | undefined | ObjectShorthandPropsCompat<TProps>; | ||
export declare type ShorthandPropsRecord<Record extends SlotPropsRecord = SlotPropsRecord> = { | ||
[K in keyof Record]: ShorthandProps<NonNullable<Record[K]>>; | ||
}; | ||
export declare type ShorthandRenderFunction<Props> = (Component: React_2.ElementType<Props>, props: Props) => React_2.ReactNode; | ||
export declare type ShorthandRenderFunctionCompat<TProps> = (Component: React_2.ElementType<TProps>, props: TProps) => React_2.ReactNode; | ||
@@ -346,2 +413,7 @@ | ||
/** | ||
* Generic record of possible ShorthandProps | ||
*/ | ||
export declare type SlotPropsRecord = Record<string, Record<string, any> | undefined>; | ||
declare type SomeElement<T> = T extends Element ? T : HTMLElement; | ||
@@ -348,0 +420,0 @@ |
@@ -43,2 +43,5 @@ ## API Report File for "@fluentui/react-utilities" | ||
// @public (undocumented) | ||
export type ComponentProps<Record extends SlotPropsRecord = {}> = DefaultComponentProps & ShorthandPropsRecord<Record>; | ||
// @public (undocumented) | ||
export interface ComponentPropsCompat { | ||
@@ -53,2 +56,13 @@ // (undocumented) | ||
// @public (undocumented) | ||
export type ComponentState<Record extends SlotPropsRecord = {}> = Pick<ComponentProps<Record>, keyof DefaultComponentProps> & { | ||
components?: { | ||
[K in keyof Record]?: React_2.ElementType<Record[K]>; | ||
}; | ||
} & { | ||
components?: { | ||
root?: React_2.ElementType; | ||
}; | ||
} & ObjectShorthandPropsRecord<Record>; | ||
// @public | ||
@@ -63,2 +77,8 @@ export type ComponentStateCompat<Props, ShorthandPropNames extends keyof Props = never, DefaultedPropNames extends keyof ResolvedShorthandPropsCompat<Props, ShorthandPropNames> = never> = RequiredPropsCompat<ResolvedShorthandPropsCompat<Props, ShorthandPropNames>, DefaultedPropNames>; | ||
// @public (undocumented) | ||
export interface DefaultComponentProps { | ||
// (undocumented) | ||
as?: keyof JSX.IntrinsicElements; | ||
} | ||
// Warning: (ae-internal-missing-underscore) The name "defaultSSRContextValue" should be prefixed with an underscore because the declaration is marked as @internal | ||
@@ -105,2 +125,12 @@ // | ||
// @public | ||
export function getSlots<SlotProps extends SlotPropsRecord = {}>(state: ComponentState<any>, slotNames?: string[]): { | ||
readonly slots: { [K in keyof SlotProps]: React_2.ElementType<SlotProps[K]>; } & { | ||
root: React_2.ElementType; | ||
}; | ||
readonly slotProps: SlotProps & { | ||
root: any; | ||
}; | ||
}; | ||
// Warning: (ae-forgotten-export) The symbol "GenericDictionary" needs to be exported by the entry point index.d.ts | ||
@@ -152,2 +182,9 @@ // | ||
// @public (undocumented) | ||
export type ObjectShorthandProps<Props extends { | ||
children?: React_2.ReactNode; | ||
} = {}> = Props & Pick<ComponentProps, 'as'> & { | ||
children?: Props['children'] | ShorthandRenderFunction<Props>; | ||
}; | ||
// @public (undocumented) | ||
export type ObjectShorthandPropsCompat<TProps extends ComponentPropsCompat = {}> = TProps & Omit<ComponentPropsCompat, 'children'> & { | ||
@@ -157,2 +194,7 @@ children?: TProps['children'] | ShorthandRenderFunctionCompat<TProps>; | ||
// @public (undocumented) | ||
export type ObjectShorthandPropsRecord<Record extends SlotPropsRecord = SlotPropsRecord> = { | ||
[K in keyof Record]: ObjectShorthandProps<NonNullable<Record[K]>>; | ||
}; | ||
// @public | ||
@@ -162,3 +204,3 @@ export const olProperties: Record<string, number>; | ||
// @public | ||
export function omit<TObj extends Record<string, any>>(obj: TObj, exclusions: (keyof TObj)[]): TObj; | ||
export function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(obj: TObj, exclusions: Exclusions): Omit<TObj, Exclusions[number]>; | ||
@@ -188,2 +230,5 @@ // @public | ||
// @public | ||
export function resolveShorthand<Props extends Record<string, any>>(value: ShorthandProps<Props>, defaultProps?: Props): ObjectShorthandProps<Props>; | ||
// @public | ||
export const resolveShorthandProps: <TProps, TShorthandPropNames extends keyof TProps>(props: TProps, shorthandPropNames: readonly TShorthandPropNames[]) => ResolvedShorthandPropsCompat<TProps, TShorthandPropNames>; | ||
@@ -195,5 +240,16 @@ | ||
// @public (undocumented) | ||
export type ShorthandProps<Props = {}> = React_2.ReactChild | React_2.ReactNodeArray | React_2.ReactPortal | number | null | undefined | ObjectShorthandProps<Props>; | ||
// @public (undocumented) | ||
export type ShorthandPropsCompat<TProps extends ComponentPropsCompat = {}> = React_2.ReactChild | React_2.ReactNodeArray | React_2.ReactPortal | number | null | undefined | ObjectShorthandPropsCompat<TProps>; | ||
// @public (undocumented) | ||
export type ShorthandPropsRecord<Record extends SlotPropsRecord = SlotPropsRecord> = { | ||
[K in keyof Record]: ShorthandProps<NonNullable<Record[K]>>; | ||
}; | ||
// @public (undocumented) | ||
export type ShorthandRenderFunction<Props> = (Component: React_2.ElementType<Props>, props: Props) => React_2.ReactNode; | ||
// @public (undocumented) | ||
export type ShorthandRenderFunctionCompat<TProps> = (Component: React_2.ElementType<TProps>, props: TProps) => React_2.ReactNode; | ||
@@ -211,2 +267,5 @@ | ||
// @public | ||
export type SlotPropsRecord = Record<string, Record<string, any> | undefined>; | ||
// Warning: (ae-incompatible-release-tags) The symbol "SSRContext" is marked as @public, but its signature references "SSRContextValue" which is marked as @internal | ||
@@ -213,0 +272,0 @@ // |
@@ -1,2 +0,2 @@ | ||
define(["require", "exports", "react", "../utils/index", "./nullRender"], function (require, exports, React, index_1, nullRender_1) { | ||
define(["require", "exports", "react", "./nullRender", "../utils/index"], function (require, exports, React, nullRender_1, index_1) { | ||
"use strict"; | ||
@@ -3,0 +3,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,1 +1,2 @@ | ||
export * from './getSlots'; | ||
export * from './getSlotsCompat'; | ||
@@ -5,3 +6,4 @@ export * from './makeMergeProps'; | ||
export * from './nullRender'; | ||
export * from './resolveShorthand'; | ||
export * from './resolveShorthandProps'; | ||
export * from './types'; |
@@ -1,4 +0,5 @@ | ||
define(["require", "exports", "tslib", "./getSlotsCompat", "./makeMergeProps", "./makeMergePropsCompat", "./nullRender", "./resolveShorthandProps", "./types"], function (require, exports, tslib_1, getSlotsCompat_1, makeMergeProps_1, makeMergePropsCompat_1, nullRender_1, resolveShorthandProps_1, types_1) { | ||
define(["require", "exports", "tslib", "./getSlots", "./getSlotsCompat", "./makeMergeProps", "./makeMergePropsCompat", "./nullRender", "./resolveShorthand", "./resolveShorthandProps", "./types"], function (require, exports, tslib_1, getSlots_1, getSlotsCompat_1, makeMergeProps_1, makeMergePropsCompat_1, nullRender_1, resolveShorthand_1, resolveShorthandProps_1, types_1) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
tslib_1.__exportStar(getSlots_1, exports); | ||
tslib_1.__exportStar(getSlotsCompat_1, exports); | ||
@@ -8,2 +9,3 @@ tslib_1.__exportStar(makeMergeProps_1, exports); | ||
tslib_1.__exportStar(nullRender_1, exports); | ||
tslib_1.__exportStar(resolveShorthand_1, exports); | ||
tslib_1.__exportStar(resolveShorthandProps_1, exports); | ||
@@ -10,0 +12,0 @@ tslib_1.__exportStar(types_1, exports); |
import * as React from 'react'; | ||
/** | ||
* Generic record of possible ShorthandProps | ||
*/ | ||
export declare type SlotPropsRecord = Record<string, Record<string, any> | undefined>; | ||
export declare type ShorthandPropsRecord<Record extends SlotPropsRecord = SlotPropsRecord> = { | ||
[K in keyof Record]: ShorthandProps<NonNullable<Record[K]>>; | ||
}; | ||
export declare type ObjectShorthandPropsRecord<Record extends SlotPropsRecord = SlotPropsRecord> = { | ||
[K in keyof Record]: ObjectShorthandProps<NonNullable<Record[K]>>; | ||
}; | ||
export declare type ShorthandRenderFunction<Props> = (Component: React.ElementType<Props>, props: Props) => React.ReactNode; | ||
export declare type ShorthandProps<Props = {}> = React.ReactChild | React.ReactNodeArray | React.ReactPortal | number | null | undefined | ObjectShorthandProps<Props>; | ||
export declare type ObjectShorthandProps<Props extends { | ||
children?: React.ReactNode; | ||
} = {}> = Props & Pick<ComponentProps, 'as'> & { | ||
children?: Props['children'] | ShorthandRenderFunction<Props>; | ||
}; | ||
export interface DefaultComponentProps { | ||
as?: keyof JSX.IntrinsicElements; | ||
} | ||
export declare type ComponentProps<Record extends SlotPropsRecord = {}> = DefaultComponentProps & ShorthandPropsRecord<Record>; | ||
export declare type ComponentState<Record extends SlotPropsRecord = {}> = Pick<ComponentProps<Record>, keyof DefaultComponentProps> & { | ||
components?: { | ||
[K in keyof Record]?: React.ElementType<Record[K]>; | ||
}; | ||
} & { | ||
components?: { | ||
root?: React.ElementType; | ||
}; | ||
} & ObjectShorthandPropsRecord<Record>; | ||
export interface ComponentPropsCompat { | ||
@@ -3,0 +33,0 @@ as?: React.ElementType; |
@@ -32,4 +32,5 @@ define(["require", "exports", "react", "./useEventCallback"], function (require, exports, React, useEventCallback_1) { | ||
if (!disabled) { | ||
element === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler); | ||
element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler); | ||
// use capture phase because React can update DOM before the event bubbles to the document | ||
element === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler, true); | ||
element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler, true); | ||
} | ||
@@ -41,4 +42,4 @@ // Garbage collect this event after it's no longer useful to avoid memory leaks | ||
return function () { | ||
element === null || element === void 0 ? void 0 : element.removeEventListener('click', conditionalHandler); | ||
element === null || element === void 0 ? void 0 : element.removeEventListener('touchstart', conditionalHandler); | ||
element === null || element === void 0 ? void 0 : element.removeEventListener('click', conditionalHandler, true); | ||
element === null || element === void 0 ? void 0 : element.removeEventListener('touchstart', conditionalHandler, true); | ||
clearTimeout(timeoutId.current); | ||
@@ -45,0 +46,0 @@ currentEvent = undefined; |
@@ -14,2 +14,2 @@ /** | ||
*/ | ||
export declare function omit<TObj extends Record<string, any>>(obj: TObj, exclusions: (keyof TObj)[]): TObj; | ||
export declare function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(obj: TObj, exclusions: Exclusions): Omit<TObj, Exclusions[number]>; |
@@ -10,5 +10,5 @@ "use strict"; | ||
var nullRender_1 = /*#__PURE__*/require("./nullRender"); | ||
var index_1 = /*#__PURE__*/require("../utils/index"); | ||
var nullRender_1 = /*#__PURE__*/require("./nullRender"); | ||
/** | ||
@@ -15,0 +15,0 @@ * Given the state and an array of slot names, will break out `slots` and `slotProps` |
@@ -0,1 +1,2 @@ | ||
export * from './getSlots'; | ||
export * from './getSlotsCompat'; | ||
@@ -5,3 +6,4 @@ export * from './makeMergeProps'; | ||
export * from './nullRender'; | ||
export * from './resolveShorthand'; | ||
export * from './resolveShorthandProps'; | ||
export * from './types'; |
@@ -9,2 +9,4 @@ "use strict"; | ||
tslib_1.__exportStar(require("./getSlots"), exports); | ||
tslib_1.__exportStar(require("./getSlotsCompat"), exports); | ||
@@ -18,2 +20,4 @@ | ||
tslib_1.__exportStar(require("./resolveShorthand"), exports); | ||
tslib_1.__exportStar(require("./resolveShorthandProps"), exports); | ||
@@ -20,0 +24,0 @@ |
import * as React from 'react'; | ||
/** | ||
* Generic record of possible ShorthandProps | ||
*/ | ||
export declare type SlotPropsRecord = Record<string, Record<string, any> | undefined>; | ||
export declare type ShorthandPropsRecord<Record extends SlotPropsRecord = SlotPropsRecord> = { | ||
[K in keyof Record]: ShorthandProps<NonNullable<Record[K]>>; | ||
}; | ||
export declare type ObjectShorthandPropsRecord<Record extends SlotPropsRecord = SlotPropsRecord> = { | ||
[K in keyof Record]: ObjectShorthandProps<NonNullable<Record[K]>>; | ||
}; | ||
export declare type ShorthandRenderFunction<Props> = (Component: React.ElementType<Props>, props: Props) => React.ReactNode; | ||
export declare type ShorthandProps<Props = {}> = React.ReactChild | React.ReactNodeArray | React.ReactPortal | number | null | undefined | ObjectShorthandProps<Props>; | ||
export declare type ObjectShorthandProps<Props extends { | ||
children?: React.ReactNode; | ||
} = {}> = Props & Pick<ComponentProps, 'as'> & { | ||
children?: Props['children'] | ShorthandRenderFunction<Props>; | ||
}; | ||
export interface DefaultComponentProps { | ||
as?: keyof JSX.IntrinsicElements; | ||
} | ||
export declare type ComponentProps<Record extends SlotPropsRecord = {}> = DefaultComponentProps & ShorthandPropsRecord<Record>; | ||
export declare type ComponentState<Record extends SlotPropsRecord = {}> = Pick<ComponentProps<Record>, keyof DefaultComponentProps> & { | ||
components?: { | ||
[K in keyof Record]?: React.ElementType<Record[K]>; | ||
}; | ||
} & { | ||
components?: { | ||
root?: React.ElementType; | ||
}; | ||
} & ObjectShorthandPropsRecord<Record>; | ||
export interface ComponentPropsCompat { | ||
@@ -3,0 +33,0 @@ as?: React.ElementType; |
@@ -53,4 +53,5 @@ "use strict"; | ||
if (!disabled) { | ||
element === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler); | ||
element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler); | ||
// use capture phase because React can update DOM before the event bubbles to the document | ||
element === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler, true); | ||
element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler, true); | ||
} // Garbage collect this event after it's no longer useful to avoid memory leaks | ||
@@ -63,4 +64,4 @@ | ||
return function () { | ||
element === null || element === void 0 ? void 0 : element.removeEventListener('click', conditionalHandler); | ||
element === null || element === void 0 ? void 0 : element.removeEventListener('touchstart', conditionalHandler); | ||
element === null || element === void 0 ? void 0 : element.removeEventListener('click', conditionalHandler, true); | ||
element === null || element === void 0 ? void 0 : element.removeEventListener('touchstart', conditionalHandler, true); | ||
clearTimeout(timeoutId.current); | ||
@@ -67,0 +68,0 @@ currentEvent = undefined; |
@@ -14,2 +14,2 @@ /** | ||
*/ | ||
export declare function omit<TObj extends Record<string, any>>(obj: TObj, exclusions: (keyof TObj)[]): TObj; | ||
export declare function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(obj: TObj, exclusions: Exclusions): Omit<TObj, Exclusions[number]>; |
import * as React from 'react'; | ||
import { nullRender } from './nullRender'; | ||
import { getNativeElementProps, omit } from '../utils/index'; | ||
import { nullRender } from './nullRender'; | ||
/** | ||
@@ -5,0 +5,0 @@ * Given the state and an array of slot names, will break out `slots` and `slotProps` |
@@ -0,1 +1,2 @@ | ||
export * from './getSlots'; | ||
export * from './getSlotsCompat'; | ||
@@ -5,3 +6,4 @@ export * from './makeMergeProps'; | ||
export * from './nullRender'; | ||
export * from './resolveShorthand'; | ||
export * from './resolveShorthandProps'; | ||
export * from './types'; |
@@ -0,1 +1,2 @@ | ||
export * from './getSlots'; | ||
export * from './getSlotsCompat'; | ||
@@ -5,4 +6,5 @@ export * from './makeMergeProps'; | ||
export * from './nullRender'; | ||
export * from './resolveShorthand'; | ||
export * from './resolveShorthandProps'; | ||
export * from './types'; | ||
//# sourceMappingURL=index.js.map |
import * as React from 'react'; | ||
/** | ||
* Generic record of possible ShorthandProps | ||
*/ | ||
export declare type SlotPropsRecord = Record<string, Record<string, any> | undefined>; | ||
export declare type ShorthandPropsRecord<Record extends SlotPropsRecord = SlotPropsRecord> = { | ||
[K in keyof Record]: ShorthandProps<NonNullable<Record[K]>>; | ||
}; | ||
export declare type ObjectShorthandPropsRecord<Record extends SlotPropsRecord = SlotPropsRecord> = { | ||
[K in keyof Record]: ObjectShorthandProps<NonNullable<Record[K]>>; | ||
}; | ||
export declare type ShorthandRenderFunction<Props> = (Component: React.ElementType<Props>, props: Props) => React.ReactNode; | ||
export declare type ShorthandProps<Props = {}> = React.ReactChild | React.ReactNodeArray | React.ReactPortal | number | null | undefined | ObjectShorthandProps<Props>; | ||
export declare type ObjectShorthandProps<Props extends { | ||
children?: React.ReactNode; | ||
} = {}> = Props & Pick<ComponentProps, 'as'> & { | ||
children?: Props['children'] | ShorthandRenderFunction<Props>; | ||
}; | ||
export interface DefaultComponentProps { | ||
as?: keyof JSX.IntrinsicElements; | ||
} | ||
export declare type ComponentProps<Record extends SlotPropsRecord = {}> = DefaultComponentProps & ShorthandPropsRecord<Record>; | ||
export declare type ComponentState<Record extends SlotPropsRecord = {}> = Pick<ComponentProps<Record>, keyof DefaultComponentProps> & { | ||
components?: { | ||
[K in keyof Record]?: React.ElementType<Record[K]>; | ||
}; | ||
} & { | ||
components?: { | ||
root?: React.ElementType; | ||
}; | ||
} & ObjectShorthandPropsRecord<Record>; | ||
export interface ComponentPropsCompat { | ||
@@ -3,0 +33,0 @@ as?: React.ElementType; |
@@ -44,4 +44,5 @@ import * as React from 'react'; | ||
if (!disabled) { | ||
element === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler); | ||
element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler); | ||
// use capture phase because React can update DOM before the event bubbles to the document | ||
element === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler, true); | ||
element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler, true); | ||
} // Garbage collect this event after it's no longer useful to avoid memory leaks | ||
@@ -54,4 +55,4 @@ | ||
return function () { | ||
element === null || element === void 0 ? void 0 : element.removeEventListener('click', conditionalHandler); | ||
element === null || element === void 0 ? void 0 : element.removeEventListener('touchstart', conditionalHandler); | ||
element === null || element === void 0 ? void 0 : element.removeEventListener('click', conditionalHandler, true); | ||
element === null || element === void 0 ? void 0 : element.removeEventListener('touchstart', conditionalHandler, true); | ||
clearTimeout(timeoutId.current); | ||
@@ -58,0 +59,0 @@ currentEvent = undefined; |
@@ -14,2 +14,2 @@ /** | ||
*/ | ||
export declare function omit<TObj extends Record<string, any>>(obj: TObj, exclusions: (keyof TObj)[]): TObj; | ||
export declare function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(obj: TObj, exclusions: Exclusions): Omit<TObj, Exclusions[number]>; |
{ | ||
"name": "@fluentui/react-utilities", | ||
"version": "9.0.0-alpha.30", | ||
"version": "9.0.0-alpha.31", | ||
"description": "A set of general React-specific utilities.", | ||
@@ -5,0 +5,0 @@ "main": "lib-commonjs/index.js", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1541007
467
10427